import { SGItem , MarkType } from '@chart-parts/interfaces' ; import { MarkBuilder } from './MarkBuilder' ; import * as Elements from './elements' ; import { createItemType } from './registry' ; param markType param item export function createMark ( markType , items ) { items . forEach ( ( item , index ) => { if ( item . itemtype !== markType ) { throw new Error ( `Mark type must match the type of it's child items. Mark ${ markType }, child ${ item . itemtype }@${ index }` ) ; } } ) ; const result = new Elements . Mark ( ) ; result . marktype = markType ; result . items = items as Elements . Item [ ] ; return result ; } export function createItem ( itemType , props = { } ) { return createItemType ( itemType , props ) ; } export function buildMark ( markType ) { return new MarkBuilder ( markType ) ; }