import { Mark , Channels , ChannelHandler , MarkEncoding , MarkEncodings , Facet , MarkType , ItemIdGenerator , } from '@chart-parts/interfaces' ; import { SceneNodeSpec } from './SceneNodeSpec' ; category export class MarkSpec implements Mark { private _table : string | undefined ; private _channels : Channels = { } ; private _encodings : MarkEncodings = { } ; private _role ? : string ; private _name ? : string ; private _child ? : SceneNodeSpec ; private _facet ? : Facet ; private _idGenerator ? : ItemIdGenerator ; public constructor ( public readonly type ) { } public get child ( ) { return this . _child ; } public set child ( value ) { this . _child = value ; } public get table ( ) : string | undefined { return this . _table ; } public set table ( value ) { this . _table = value ; } public get name ( ) : string | undefined { return this . _name ; } public set name ( value ) { this . _name = value ; } public get role ( ) { return this . _role ; } public set role ( value ) { this . _role = value ; } public get idGenerator ( ) : ItemIdGenerator | undefined { return this . _idGenerator ; } public set idGenerator ( value ) { this . _idGenerator = value ; } public get facet ( ) : Facet | undefined { return this . _facet ; } public set facet ( value ) { this . _facet = value ; } public get encodings ( ) : MarkEncodings { return this . _encodings ; } public get channels ( ) : Channels { return this . _channels ; } public applyHandler ( key , handler ) { if ( handler != null ) { this . _channels [ key ] = handler ; } else { delete this . _channels [ key ] ; } } public applyEncoding < T > ( key , encoding ) { if ( encoding != null ) { this . _encodings [ key ] = encoding ; } else { delete this . _encodings [ key ] ; } } }