import { SGMark , SGItem , SceneNode , MarkType , ItemSpace , } from '@chart-parts/interfaces' ; import { buildMark } from '@chart-parts/scenegraph' ; import { buildAxes } from './axes' ; import { SceneFrame } from './context/SceneFrame' ; import { processMark } from './marks/processMark' ; export type SGMarkAny = SGMark < SGItem > ; ignore param node param scaleFrame export function processNode ( node , parentFrame ) { const frame = parentFrame . pushNode ( node ) ; const { remainingSpace , axes } = buildAxes ( node , frame ) ; const viewFrame = frame . pushView ( remainingSpace . shape as any ) ; const markItems = node . marks . map ( mark => processMark ( mark , viewFrame ) ) ; if ( axes . length > 0 ) { return [ ... axes , createMarkGrouping ( markItems , remainingSpace ) ] ; } else { return markItems ; } } function createMarkGrouping ( items , space ) { return buildMark ( MarkType . Group ) . role ( 'marks' ) . items ( { ... space . origin , ... space . shape , items , } ) . build ( ) ; }