@visactor/vgrammar-core 0.16.0 → 1.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.d.ts +1 -1
- package/cjs/index.js +1 -1
- package/cjs/index.js.map +1 -1
- package/cjs/types/plot.d.ts +4 -0
- package/cjs/types/plot.js.map +1 -1
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/index.js.map +1 -1
- package/es/interactions/dimension-tooltip.js +1 -2
- package/es/interactions/element-active.js +2 -1
- package/es/interactions/element-highlight-by-name.js +1 -1
- package/es/interactions/element-highlight.js +1 -1
- package/es/interactions/element-select-by-graphic-name.js +1 -1
- package/es/semantic-marks/cell.js +1 -1
- package/es/semantic-marks/interval.js +1 -1
- package/es/semantic-marks/text.js +1 -1
- package/es/types/plot.d.ts +4 -0
- package/es/types/plot.js.map +1 -1
- package/package.json +5 -5
package/cjs/index.d.ts
CHANGED
package/cjs/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
|
|
|
18
18
|
Object.defineProperty(exports, "__esModule", {
|
|
19
19
|
value: !0
|
|
20
20
|
}), exports.registerAnimate = exports.registerGesturePlugin = exports.registerDragPlugin = exports.GlyphMark = exports.registerGlyphMark = exports.defaultDoLayout = exports.registerDefaultLayout = exports.vglobal = exports.ThemeManager = exports.registerViewMorphAPI = exports.registerViewEventsAPI = exports.SIGNAL_VIEW_BOX = exports.SIGNAL_WIDTH = exports.SIGNAL_VIEW_WIDTH = exports.SIGNAL_VIEW_HEIGHT = exports.SIGNAL_PADDING = exports.SIGNAL_HEIGHT = exports.SIGNAL_AUTOFIT = exports.Factory = exports.GrammarBase = exports.invokeFunctionType = exports.parseFunctionType = exports.registerCoordinate = exports.Coordinate = exports.registerScale = exports.Scale = exports.View = exports.version = void 0,
|
|
21
|
-
exports.version = "0.
|
|
21
|
+
exports.version = "1.0.0-alpha.0", __exportStar(require("./graph"), exports), __exportStar(require("./interactions"), exports);
|
|
22
22
|
|
|
23
23
|
var view_1 = require("./view");
|
|
24
24
|
|
package/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,eAAe,CAAC;AAEvC,0CAAwB;AAExB,iDAA+B;AAE/B,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,sCAAoD;AAA3C,8FAAA,KAAK,OAAA;AAAE,sGAAA,aAAa,OAAA;AAC7B,gDAAmE;AAA1D,wGAAA,UAAU,OAAA;AAAE,gHAAA,kBAAkB,OAAA;AACvC,qCAAqE;AAA5D,yGAAA,iBAAiB,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAC9C,oDAAkD;AAAzC,2GAAA,WAAW,OAAA;AACpB,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAChB,8CAQ0B;AAPxB,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,2GAAA,cAAc,OAAA;AACd,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AAEjB,4DAAgE;AAAvD,yHAAA,qBAAqB,OAAA;AAC9B,4DAA+D;AAAtD,wHAAA,oBAAoB,OAAA;AAE7B,uDAAqD;AAA5C,6GAAA,YAAY,OAAA;AAErB,0CAAwB;AACxB,8CAA4B;AAC5B,+CAA6B;AAC7B,8DAA4C;AAE5C,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAChB,wCAAsB;AACtB,iDAA+B;AAC/B,wDAAsC;AACtC,4DAA0C;AAC1C,uDAAqC;AACrC,gDAA+E;AAAtE,+GAAA,qBAAqB,OAAA;AAAE,yGAAA,eAAe,OAAA;AAC/C,sCAA4D;AAAnD,0GAAA,iBAAiB,OAAA;AAAE,kGAAA,SAAS,OAAA;AAErC,yDAA4D;AAC5D,4CAAyC;AAElC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,iBAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,wBAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AAFW,QAAA,kBAAkB,sBAE7B;AAEK,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,iBAAO,CAAC,wBAAwB,CAAC,SAAS,EAAE,sBAAO,CAAC,CAAC;AACvD,CAAC,CAAC;AAFW,QAAA,qBAAqB,yBAEhC;AAEF,kEAAmE;AACnE,kEAAmE;AAE5D,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,IAAA,2CAAsB,GAAE,CAAC;IACzB,IAAA,2CAAsB,GAAE,CAAC;AAC3B,CAAC,CAAC;AAHW,QAAA,eAAe,mBAG1B","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"1.0.0-alpha.0\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { Scale, registerScale } from './view/scale';\nexport { Coordinate, registerCoordinate } from './view/coordinate';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\nexport { registerViewEventsAPI } from './view/view-event-mixin';\nexport { registerViewMorphAPI } from './view/view-morph-mixin';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\nexport * from './graph/mark/graphic';\nexport { registerDefaultLayout, defaultDoLayout } from './graph/layout/layout';\nexport { registerGlyphMark, GlyphMark } from './view/glyph';\n\nimport { DragNDrop, Gesture } from '@visactor/vrender-kits';\nimport { Factory } from './core/factory';\n\nexport const registerDragPlugin = () => {\n Factory.registerStageEventPlugin('drag', DragNDrop);\n};\n\nexport const registerGesturePlugin = () => {\n Factory.registerStageEventPlugin('gesture', Gesture);\n};\n\nimport { registerViewAnimateAPI } from './view/view-animate-mixin';\nimport { registerMarkAnimateAPI } from './view/mark-animate-mixin';\n\nexport const registerAnimate = () => {\n registerViewAnimateAPI();\n registerMarkAnimateAPI();\n};\n"]}
|
package/cjs/types/plot.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export type PlotTreemapEncodeSpec = BasicEncoderSpecMap['rect'];
|
|
|
75
75
|
export type PlotCirclePackingEncodeSpec = BasicEncoderSpecMap['circle'];
|
|
76
76
|
export type PlotWordcloudEncodeSpec = BasicEncoderSpecMap['text'];
|
|
77
77
|
export type PlotWordcloudShapeEncodeSpec = BasicEncoderSpecMap['text'];
|
|
78
|
+
export type PlotImagecloudEncodeSpec = BasicEncoderSpecMap['image'];
|
|
78
79
|
export type CoordinateOption = CartesianCoordinateOption | PolarCoordinateOption;
|
|
79
80
|
export type PlotIntervalSpec = Partial<ISemanticMarkSpec<PlotIntervalEncoderSpec, IntervalEncodeChannels>> & {
|
|
80
81
|
type: 'interval';
|
|
@@ -156,6 +157,7 @@ export interface IPlot {
|
|
|
156
157
|
rule: () => IRule;
|
|
157
158
|
wordcloud: () => IWordcloud;
|
|
158
159
|
wordcloudShape: () => IWordcloudShape;
|
|
160
|
+
imagecloud: () => IImagecloud;
|
|
159
161
|
circlePacking: () => ICirclePacking;
|
|
160
162
|
treemap: () => ITreemap;
|
|
161
163
|
tree: () => ITree;
|
|
@@ -296,6 +298,7 @@ export type TreemapEncodeChannels = 'node' | 'value' | 'color' | 'stroke';
|
|
|
296
298
|
export type CirclepackingEncodeChannels = 'node' | 'value' | 'color' | 'stroke';
|
|
297
299
|
export type WordcloudEncodeChannels = 'text' | 'color' | 'stroke';
|
|
298
300
|
export type WordcloudShapeEncodeChannels = 'text' | 'color' | 'stroke';
|
|
301
|
+
export type ImagecloudShapeEncodeChannels = 'image' | 'weight';
|
|
299
302
|
export type IInterval = ISemanticMark<PlotIntervalEncoderSpec, IntervalEncodeChannels>;
|
|
300
303
|
export type ILine = ISemanticMark<BasicEncoderSpecMap['line'], LineEncodeChannels>;
|
|
301
304
|
export type ICell = ISemanticMark<BasicEncoderSpecMap['cell'], CellEncodeChannels>;
|
|
@@ -318,6 +321,7 @@ export type IWordcloudShape = ISemanticMark<PlotWordcloudShapeEncodeSpec, Wordcl
|
|
|
318
321
|
export type ITree = ISemanticMark<PlotTreeEncodeSpec, TreeEncodeChannels>;
|
|
319
322
|
export type ITreemap = ISemanticMark<PlotTreemapEncodeSpec, TreemapEncodeChannels>;
|
|
320
323
|
export type ICirclePacking = ISemanticMark<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>;
|
|
324
|
+
export type IImagecloud = ISemanticMark<PlotImagecloudEncodeSpec, ImagecloudShapeEncodeChannels>;
|
|
321
325
|
export type PlotMark = IInterval | IRuleX | IRuleY | ICell | ILine | IArea | ISymbol | IText | IRect | IRectX | IRectY | IPolygon | IRule | IImage | IPath | ISankey | ISunburst | ICirclePacking | ITreemap | ITree | IWordcloud | IWordcloudShape;
|
|
322
326
|
export interface IPlotMarkConstructor {
|
|
323
327
|
readonly type: string;
|
package/cjs/types/plot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/plot.ts"],"names":[],"mappings":"","file":"plot.js","sourcesContent":["import type {\n AxisBaseAttributes,\n BaseCrosshairAttrs,\n BaseLabelAttrs,\n ColorLegendAttributes,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n GridBaseAttributes,\n PlayerAttributes,\n SizeLegendAttributes,\n SliderAttributes,\n TitleAttrs\n} from '@visactor/vrender-components';\nimport type { CoordinateType } from '@visactor/vgrammar-coordinate';\nimport type { IColor } from '@visactor/vrender-core';\nimport type { IEnvironmentOptions, IRendererOptions, IRunningConfig, ViewSpec, srIOption3DType, IView } from './view';\nimport type { CommonPaddingSpec, ValueOf } from './base';\nimport type { BasicEncoderSpecMap, LinkPathEncoderSpec, MarkRelativeItemSpec } from './mark';\nimport type { BaseEventHandler } from './event';\nimport type { TransformSpec } from './transform';\nimport type { IAnimationConfig } from './animate';\nimport type { ScaleSpec } from './scale';\nimport type { DataSpec } from './data';\nimport type { GridShape } from './component';\n\nexport interface IPlotOptions extends IEnvironmentOptions, IRendererOptions {\n width?: number;\n height?: number;\n padding?: CommonPaddingSpec;\n autoFit?: boolean;\n options3d?: srIOption3DType;\n theme?: string;\n logLevel?: number;\n}\n\nexport interface CartesianCoordinateOption {\n id?: string;\n type: 'cartesian';\n transpose?: boolean;\n}\n\nexport interface PolarCoordinateOption {\n id?: string;\n type: 'polar';\n origin?: [string | number, string | number];\n transpose?: boolean;\n}\n\nexport type PlotIntervalEncoderSpec = Omit<BasicEncoderSpecMap['interval'], 'y'> & {\n y?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'y' | 'x'> & {\n y?: number | number[];\n x?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectXEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'x'> & {\n x?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectYEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'y'> & {\n y?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotAreaEncoderSpec = Omit<BasicEncoderSpecMap['area'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\n\nexport type PlotRuleEncoderSpec = Omit<BasicEncoderSpecMap['rule'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\n\nexport type PlotImageEncoderSpec = Omit<BasicEncoderSpecMap['image'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\nexport type PlotPolygonEncoderSpec = Omit<BasicEncoderSpecMap['polygon'], 'x' | 'y'> & {\n x?: number[];\n y?: number[];\n};\n\nexport type PlotSankeyEncoderSpec = Partial<LinkPathEncoderSpec>;\nexport type PlotSunburstEncodeSpec = BasicEncoderSpecMap['arc'];\nexport type PlotTreeEncodeSpec = BasicEncoderSpecMap['symbol'];\nexport type PlotTreemapEncodeSpec = BasicEncoderSpecMap['rect'];\nexport type PlotCirclePackingEncodeSpec = BasicEncoderSpecMap['circle'];\nexport type PlotWordcloudEncodeSpec = BasicEncoderSpecMap['text'];\nexport type PlotWordcloudShapeEncodeSpec = BasicEncoderSpecMap['text'];\n\nexport type CoordinateOption = CartesianCoordinateOption | PolarCoordinateOption;\nexport type PlotIntervalSpec = Partial<ISemanticMarkSpec<PlotIntervalEncoderSpec, IntervalEncodeChannels>> & {\n type: 'interval';\n};\nexport type PlotLineSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['line'], LineEncodeChannels>> & {\n type: 'line';\n};\nexport type PlotCellSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['cell'], CellEncodeChannels>> & {\n type: 'cell';\n};\nexport type PlotRuleXSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['rule'], RuleXEncodeChannels>> & {\n type: 'ruleX';\n};\nexport type PlotRuleYSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['rule'], RuleYEncodeChannels>> & {\n type: 'ruleY';\n};\nexport type PlotAreaSpec = Partial<ISemanticMarkSpec<PlotAreaEncoderSpec, AreaEncodeChannels>> & {\n type: 'area';\n};\nexport type PlotSymbolSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['symbol'], SymbolEncodeChannels>> & {\n type: 'symbol';\n};\nexport type PlotTextSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['text'], TextEncodeChannels>> & {\n type: 'text';\n};\nexport type PlotRectSpec = Partial<ISemanticMarkSpec<PlotRectEncoderSpec, RectEncodeChannels>> & {\n type: 'rect';\n};\nexport type PlotRectXSpec = Partial<ISemanticMarkSpec<PlotRectXEncoderSpec, RectXEncodeChannels>> & {\n type: 'rectX';\n};\nexport type PlotRectYSpec = Partial<ISemanticMarkSpec<PlotRectYEncoderSpec, RectYEncodeChannels>> & {\n type: 'rectY';\n};\nexport type PlotPolygonSpec = Partial<ISemanticMarkSpec<PlotPolygonEncoderSpec, PolygonEncodeChannels>> & {\n type: 'polygon';\n};\nexport type PlotRuleSpec = Partial<ISemanticMarkSpec<PlotRuleEncoderSpec, RuleEncodeChannels>> & {\n type: 'rule';\n};\nexport type PlotImageSpec = Partial<ISemanticMarkSpec<PlotImageEncoderSpec, ImageEncodeChannels>> & {\n type: 'image';\n};\nexport type PlotPathSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['path'], PathEncodeChannels>> & {\n type: 'path';\n};\n\nexport interface PlotSpec {\n background?: IColor;\n width?: number;\n height?: number;\n padding?: number;\n coordinate?: CoordinateOption;\n marks?: Array<\n | PlotIntervalSpec\n | PlotLineSpec\n | PlotCellSpec\n | PlotRuleXSpec\n | PlotRuleYSpec\n | PlotAreaSpec\n | PlotSymbolSpec\n | PlotTextSpec\n | PlotRectSpec\n | PlotRectXSpec\n | PlotRectYSpec\n | PlotPolygonSpec\n | PlotRuleSpec\n | PlotImageSpec\n | PlotPathSpec\n >;\n}\n\nexport interface IPlot {\n readonly view: IView;\n\n theme: (theme: string) => this;\n /**\n * todo: 直接接text图元还是title组件\n */\n // title: (text: ITextAttribute['text'], style: Omit<ITextAttribute, 'text'>) => this;\n coordinate: (type: CoordinateType, option?: Omit<CoordinateOption, 'type'>) => this;\n // interaction: (type: string, options: boolean | any) => this;\n\n // facet: (type: string, options: any) => this;\n\n ///--------- life cycle ---------///\n\n run: (runningConfig?: IRunningConfig) => this;\n release: () => this;\n parseSpec: (spec: PlotSpec) => this;\n updateSpec: (spec: PlotSpec) => this;\n getImageBuffer: () => Buffer;\n\n ///--------- events api ---------///\n on: (type: string, handler: BaseEventHandler) => this;\n off: (type: string, handler?: BaseEventHandler) => this;\n\n ///--------- marks ---------///\n\n interval: () => IInterval;\n cell: () => ICell;\n area: () => IArea;\n image: () => IImage;\n line: () => ILine;\n ruleX: () => IRuleX;\n ruleY: () => IRectY;\n symbol: () => ISymbol;\n polygon: () => IPolygon;\n text: () => IText;\n rect: () => IRect;\n rectX: () => IRectX;\n rectY: () => IRectY;\n rule: () => IRule;\n\n // wordcloud 包如果没注册,会存在问题\n wordcloud: () => IWordcloud;\n wordcloudShape: () => IWordcloudShape;\n circlePacking: () => ICirclePacking;\n treemap: () => ITreemap;\n tree: () => ITree;\n sunburst: () => ISunburst;\n sankey: () => ISankey;\n\n // P2\n // forceGraph: () => ISemanticMark;\n // geoPath: () => ISemanticMark;\n // vector: () => ISemanticMark;\n // shape: () => ISemanticMark;\n // gauge: () => ISemanticMark;\n // heatmap: () => ISemanticMark;\n // density: () => ISemanticMark;\n // boxplot: () => ISemanticMark;\n // box: () => ISemanticMark;\n // contour: () => ISemanticMark;\n\n // observable auto define type by data\n // auto: () => ISemanticMark;\n}\n\nexport interface IPlotConstructor {\n new (options?: IPlotOptions): IPlot;\n}\n\nexport type WithDefaultEncode<T, K extends string> = {\n [Key in K]?: Key extends keyof T ? ISemanticEncodeValue<T[Key]> : ISemanticEncodeValue<string | number>;\n};\nexport type ISemanticEncodeValue<T> = T extends any[]\n ? string[] | ((datum: any) => any)[]\n : string | ((datum: any) => T);\nexport type ISemanticEncodeSpec<T> = {\n [Key in keyof T]?: ISemanticEncodeValue<T[Key]>;\n};\nexport type ISemanticStyle<T, K extends string> = Omit<T, K>;\n\nexport interface SemanticTooltipContentItem {\n key?: ISemanticEncodeValue<string | number>;\n value?: ISemanticEncodeValue<string | number>;\n symbol?: ISemanticEncodeValue<string>;\n}\nexport type SemanticTooltipOption = {\n disableGraphicTooltip?: boolean;\n disableDimensionTooltip?: boolean;\n staticTitle?: string;\n staticContentKey?: string | string[];\n title?: ISemanticEncodeValue<string | number>;\n dimensionTooltipChannel?: 'x' | 'y';\n content?: SemanticTooltipContentItem[];\n};\n\nexport interface SemanticAxisOption extends Partial<AxisBaseAttributes> {\n tickCount?: number;\n}\n\nexport interface SemanticGridOption extends Partial<GridBaseAttributes> {\n type?: GridShape;\n tickCount?: number;\n inside?: boolean;\n baseValue?: number;\n sides?: number;\n}\nexport type SemanticDataZoomOption = Partial<DataZoomAttributes>;\nexport type SemanticSliderOption = Partial<SliderAttributes>;\nexport type SemanticLegendOption = Partial<ColorLegendAttributes | DiscreteLegendAttrs | SizeLegendAttributes>;\nexport type SemanticCrosshairOption = Partial<BaseCrosshairAttrs>;\nexport type SemanticLabelOption = Partial<BaseLabelAttrs>;\nexport type SemanticPlayerOption = Partial<PlayerAttributes>;\nexport type SemanticTitleOption = Partial<TitleAttrs>;\n\nexport interface ISemanticMark<EncodeSpec, K extends string> {\n readonly uid: number;\n readonly type: string;\n data: (values: any, transform?: TransformSpec[], id?: string) => this;\n style: (style: Partial<EncodeSpec & any>) => this;\n encode: (channel: K, option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>) => this;\n scale: (channel: K, option: Partial<ScaleSpec>) => this;\n transform: (option: TransformSpec[]) => this;\n animate: (state: string, option: IAnimationConfig | IAnimationConfig[]) => this;\n state: (state: string, option: Partial<EncodeSpec>) => this;\n\n axis: (channel: string, option?: SemanticAxisOption | boolean, layout?: MarkRelativeItemSpec) => this;\n legend: (channel: string, option?: SemanticLegendOption | boolean, layout?: MarkRelativeItemSpec) => this;\n crosshair: (channel: string, option?: SemanticCrosshairOption | boolean) => this;\n tooltip: (option: SemanticTooltipOption | boolean) => this;\n coordinate: (option: CoordinateOption) => this;\n grid: (channel: string, option?: SemanticGridOption | boolean) => this;\n title: (option: SemanticTitleOption, layout?: MarkRelativeItemSpec) => this;\n\n slider: (channel: string, option?: SemanticSliderOption | boolean, layout?: MarkRelativeItemSpec) => this;\n datazoom: (channel: string, option?: SemanticDataZoomOption | boolean, layout?: MarkRelativeItemSpec) => this;\n label: (channel: string, option?: SemanticLabelOption | boolean) => this;\n player: (data?: any[], option?: SemanticPlayerOption | boolean, layout?: MarkRelativeItemSpec) => this;\n\n toViewSpec: () => ViewSpec;\n parseSpec: (spec: Partial<ISemanticMarkSpec<EncodeSpec, K>>) => this;\n}\n\nexport interface ISemanticMarkSpec<EncodeSpec, K extends string> {\n id: string | number;\n data?: DataSpec;\n encode?: WithDefaultEncode<EncodeSpec, K>;\n scale?: Partial<Record<K, ScaleSpec>>;\n style?: Partial<EncodeSpec & any>;\n axis?: Partial<\n Record<K, { option?: SemanticAxisOption | boolean; layout?: MarkRelativeItemSpec } | SemanticAxisOption | boolean>\n >;\n grid?: Partial<Record<K, SemanticGridOption | boolean>>;\n transform?: TransformSpec[];\n state?: Record<string, Partial<EncodeSpec>>;\n animation?: Record<string, IAnimationConfig | IAnimationConfig[]>;\n legend?: Record<\n string,\n { option: SemanticLegendOption | boolean; layout?: MarkRelativeItemSpec } | SemanticLegendOption | boolean\n >;\n crosshair?: Record<string, SemanticCrosshairOption | boolean>;\n tooltip?: SemanticTooltipOption | boolean;\n slider?: Record<\n string,\n { option: SemanticSliderOption | boolean; layout?: MarkRelativeItemSpec } | SemanticSliderOption | boolean\n >;\n datazoom?: Record<\n string,\n { option: SemanticDataZoomOption | boolean; layout?: MarkRelativeItemSpec } | SemanticDataZoomOption | boolean\n >;\n label?: Record<string, SemanticLabelOption | boolean>;\n player?: { data?: any[]; option?: SemanticPlayerOption | boolean; layout?: MarkRelativeItemSpec };\n title?: { option?: SemanticTitleOption; layout?: MarkRelativeItemSpec } | SemanticTitleOption;\n}\n\nexport type ParsedSimpleEncode<T, K extends string> = {\n [Key in K]?: {\n field: Key extends keyof T ? ISemanticEncodeValue<T[Key]> : ISemanticEncodeValue<string>;\n scale: string;\n };\n};\n\nexport type SemanticEncodeChannels = 'x' | 'y' | 'group' | 'color';\nexport type IntervalEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type CellEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type LineEncodeChannels = 'x' | 'y' | 'group' | 'color';\nexport type AreaEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type RuleXEncodeChannels = 'x' | 'x' | 'color' | 'group';\nexport type RuleYEncodeChannels = 'x' | 'y' | 'color' | 'group';\nexport type SymbolEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'size' | 'shape' | 'stroke';\nexport type TextEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'text' | 'stroke';\nexport type RectEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'stroke';\nexport type RectXEncodeChannels = 'x' | 'color' | 'group' | 'stroke';\nexport type RectYEncodeChannels = 'y' | 'color' | 'group' | 'stroke';\nexport type PolygonEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'stroke';\nexport type RuleEncodeChannels = 'x' | 'y' | 'color' | 'group';\nexport type ImageEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'src' | 'stroke';\nexport type PathEncodeChannels = 'color' | 'stroke';\nexport type SankeyEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type SunburstEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type TreeEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type TreemapEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type CirclepackingEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type WordcloudEncodeChannels = 'text' | 'color' | 'stroke';\nexport type WordcloudShapeEncodeChannels = 'text' | 'color' | 'stroke';\n\nexport type IInterval = ISemanticMark<PlotIntervalEncoderSpec, IntervalEncodeChannels>;\nexport type ILine = ISemanticMark<BasicEncoderSpecMap['line'], LineEncodeChannels>;\nexport type ICell = ISemanticMark<BasicEncoderSpecMap['cell'], CellEncodeChannels>;\nexport type IRuleX = ISemanticMark<BasicEncoderSpecMap['rule'], RuleXEncodeChannels>;\nexport type IRuleY = ISemanticMark<BasicEncoderSpecMap['rule'], RuleYEncodeChannels>;\nexport type IArea = ISemanticMark<PlotAreaEncoderSpec, AreaEncodeChannels>;\nexport type ISymbol = ISemanticMark<BasicEncoderSpecMap['symbol'], SymbolEncodeChannels>;\nexport type IText = ISemanticMark<BasicEncoderSpecMap['text'], TextEncodeChannels>;\nexport type IRect = ISemanticMark<PlotRectEncoderSpec, RectEncodeChannels>;\nexport type IRectX = ISemanticMark<BasicEncoderSpecMap['rect'], RectXEncodeChannels>;\nexport type IRectY = ISemanticMark<BasicEncoderSpecMap['rect'], RectYEncodeChannels>;\nexport type IPolygon = ISemanticMark<PlotPolygonEncoderSpec, PolygonEncodeChannels>;\nexport type IRule = ISemanticMark<BasicEncoderSpecMap['rule'], RuleEncodeChannels>;\nexport type IImage = ISemanticMark<PlotImageEncoderSpec, ImageEncodeChannels>;\nexport type IPath = ISemanticMark<BasicEncoderSpecMap['path'], PathEncodeChannels>;\nexport type ISankey = ISemanticMark<PlotSankeyEncoderSpec, SankeyEncodeChannels>;\nexport type ISunburst = ISemanticMark<PlotSunburstEncodeSpec, SunburstEncodeChannels>;\nexport type IWordcloud = ISemanticMark<PlotWordcloudEncodeSpec, WordcloudEncodeChannels>;\nexport type IWordcloudShape = ISemanticMark<PlotWordcloudShapeEncodeSpec, WordcloudShapeEncodeChannels>;\nexport type ITree = ISemanticMark<PlotTreeEncodeSpec, TreeEncodeChannels>;\nexport type ITreemap = ISemanticMark<PlotTreemapEncodeSpec, TreemapEncodeChannels>;\nexport type ICirclePacking = ISemanticMark<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>;\n\nexport type PlotMark =\n | IInterval\n | IRuleX\n | IRuleY\n | ICell\n | ILine\n | IArea\n | ISymbol\n | IText\n | IRect\n | IRectX\n | IRectY\n | IPolygon\n | IRule\n | IImage\n | IPath\n | ISankey\n | ISunburst\n | ICirclePacking\n | ITreemap\n | ITree\n | IWordcloud\n | IWordcloudShape;\n\nexport interface IPlotMarkConstructor {\n readonly type: string;\n\n new (id?: string): PlotMark;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/plot.ts"],"names":[],"mappings":"","file":"plot.js","sourcesContent":["import type {\n AxisBaseAttributes,\n BaseCrosshairAttrs,\n BaseLabelAttrs,\n ColorLegendAttributes,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n GridBaseAttributes,\n PlayerAttributes,\n SizeLegendAttributes,\n SliderAttributes,\n TitleAttrs\n} from '@visactor/vrender-components';\nimport type { CoordinateType } from '@visactor/vgrammar-coordinate';\nimport type { IColor } from '@visactor/vrender-core';\nimport type { IEnvironmentOptions, IRendererOptions, IRunningConfig, ViewSpec, srIOption3DType, IView } from './view';\nimport type { CommonPaddingSpec, ValueOf } from './base';\nimport type { BasicEncoderSpecMap, LinkPathEncoderSpec, MarkRelativeItemSpec } from './mark';\nimport type { BaseEventHandler } from './event';\nimport type { TransformSpec } from './transform';\nimport type { IAnimationConfig } from './animate';\nimport type { ScaleSpec } from './scale';\nimport type { DataSpec } from './data';\nimport type { GridShape } from './component';\n\nexport interface IPlotOptions extends IEnvironmentOptions, IRendererOptions {\n width?: number;\n height?: number;\n padding?: CommonPaddingSpec;\n autoFit?: boolean;\n options3d?: srIOption3DType;\n theme?: string;\n logLevel?: number;\n}\n\nexport interface CartesianCoordinateOption {\n id?: string;\n type: 'cartesian';\n transpose?: boolean;\n}\n\nexport interface PolarCoordinateOption {\n id?: string;\n type: 'polar';\n origin?: [string | number, string | number];\n transpose?: boolean;\n}\n\nexport type PlotIntervalEncoderSpec = Omit<BasicEncoderSpecMap['interval'], 'y'> & {\n y?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'y' | 'x'> & {\n y?: number | number[];\n x?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectXEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'x'> & {\n x?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectYEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'y'> & {\n y?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotAreaEncoderSpec = Omit<BasicEncoderSpecMap['area'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\n\nexport type PlotRuleEncoderSpec = Omit<BasicEncoderSpecMap['rule'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\n\nexport type PlotImageEncoderSpec = Omit<BasicEncoderSpecMap['image'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\nexport type PlotPolygonEncoderSpec = Omit<BasicEncoderSpecMap['polygon'], 'x' | 'y'> & {\n x?: number[];\n y?: number[];\n};\n\nexport type PlotSankeyEncoderSpec = Partial<LinkPathEncoderSpec>;\nexport type PlotSunburstEncodeSpec = BasicEncoderSpecMap['arc'];\nexport type PlotTreeEncodeSpec = BasicEncoderSpecMap['symbol'];\nexport type PlotTreemapEncodeSpec = BasicEncoderSpecMap['rect'];\nexport type PlotCirclePackingEncodeSpec = BasicEncoderSpecMap['circle'];\nexport type PlotWordcloudEncodeSpec = BasicEncoderSpecMap['text'];\nexport type PlotWordcloudShapeEncodeSpec = BasicEncoderSpecMap['text'];\nexport type PlotImagecloudEncodeSpec = BasicEncoderSpecMap['image'];\n\nexport type CoordinateOption = CartesianCoordinateOption | PolarCoordinateOption;\nexport type PlotIntervalSpec = Partial<ISemanticMarkSpec<PlotIntervalEncoderSpec, IntervalEncodeChannels>> & {\n type: 'interval';\n};\nexport type PlotLineSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['line'], LineEncodeChannels>> & {\n type: 'line';\n};\nexport type PlotCellSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['cell'], CellEncodeChannels>> & {\n type: 'cell';\n};\nexport type PlotRuleXSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['rule'], RuleXEncodeChannels>> & {\n type: 'ruleX';\n};\nexport type PlotRuleYSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['rule'], RuleYEncodeChannels>> & {\n type: 'ruleY';\n};\nexport type PlotAreaSpec = Partial<ISemanticMarkSpec<PlotAreaEncoderSpec, AreaEncodeChannels>> & {\n type: 'area';\n};\nexport type PlotSymbolSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['symbol'], SymbolEncodeChannels>> & {\n type: 'symbol';\n};\nexport type PlotTextSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['text'], TextEncodeChannels>> & {\n type: 'text';\n};\nexport type PlotRectSpec = Partial<ISemanticMarkSpec<PlotRectEncoderSpec, RectEncodeChannels>> & {\n type: 'rect';\n};\nexport type PlotRectXSpec = Partial<ISemanticMarkSpec<PlotRectXEncoderSpec, RectXEncodeChannels>> & {\n type: 'rectX';\n};\nexport type PlotRectYSpec = Partial<ISemanticMarkSpec<PlotRectYEncoderSpec, RectYEncodeChannels>> & {\n type: 'rectY';\n};\nexport type PlotPolygonSpec = Partial<ISemanticMarkSpec<PlotPolygonEncoderSpec, PolygonEncodeChannels>> & {\n type: 'polygon';\n};\nexport type PlotRuleSpec = Partial<ISemanticMarkSpec<PlotRuleEncoderSpec, RuleEncodeChannels>> & {\n type: 'rule';\n};\nexport type PlotImageSpec = Partial<ISemanticMarkSpec<PlotImageEncoderSpec, ImageEncodeChannels>> & {\n type: 'image';\n};\nexport type PlotPathSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['path'], PathEncodeChannels>> & {\n type: 'path';\n};\n\nexport interface PlotSpec {\n background?: IColor;\n width?: number;\n height?: number;\n padding?: number;\n coordinate?: CoordinateOption;\n marks?: Array<\n | PlotIntervalSpec\n | PlotLineSpec\n | PlotCellSpec\n | PlotRuleXSpec\n | PlotRuleYSpec\n | PlotAreaSpec\n | PlotSymbolSpec\n | PlotTextSpec\n | PlotRectSpec\n | PlotRectXSpec\n | PlotRectYSpec\n | PlotPolygonSpec\n | PlotRuleSpec\n | PlotImageSpec\n | PlotPathSpec\n >;\n}\n\nexport interface IPlot {\n readonly view: IView;\n\n theme: (theme: string) => this;\n /**\n * todo: 直接接text图元还是title组件\n */\n // title: (text: ITextAttribute['text'], style: Omit<ITextAttribute, 'text'>) => this;\n coordinate: (type: CoordinateType, option?: Omit<CoordinateOption, 'type'>) => this;\n // interaction: (type: string, options: boolean | any) => this;\n\n // facet: (type: string, options: any) => this;\n\n ///--------- life cycle ---------///\n\n run: (runningConfig?: IRunningConfig) => this;\n release: () => this;\n parseSpec: (spec: PlotSpec) => this;\n updateSpec: (spec: PlotSpec) => this;\n getImageBuffer: () => Buffer;\n\n ///--------- events api ---------///\n on: (type: string, handler: BaseEventHandler) => this;\n off: (type: string, handler?: BaseEventHandler) => this;\n\n ///--------- marks ---------///\n\n interval: () => IInterval;\n cell: () => ICell;\n area: () => IArea;\n image: () => IImage;\n line: () => ILine;\n ruleX: () => IRuleX;\n ruleY: () => IRectY;\n symbol: () => ISymbol;\n polygon: () => IPolygon;\n text: () => IText;\n rect: () => IRect;\n rectX: () => IRectX;\n rectY: () => IRectY;\n rule: () => IRule;\n\n // wordcloud 包如果没注册,会存在问题\n wordcloud: () => IWordcloud;\n wordcloudShape: () => IWordcloudShape;\n // 需要注册 imagecloud 包\n imagecloud: () => IImagecloud;\n circlePacking: () => ICirclePacking;\n treemap: () => ITreemap;\n tree: () => ITree;\n sunburst: () => ISunburst;\n sankey: () => ISankey;\n\n // P2\n // forceGraph: () => ISemanticMark;\n // geoPath: () => ISemanticMark;\n // vector: () => ISemanticMark;\n // shape: () => ISemanticMark;\n // gauge: () => ISemanticMark;\n // heatmap: () => ISemanticMark;\n // density: () => ISemanticMark;\n // boxplot: () => ISemanticMark;\n // box: () => ISemanticMark;\n // contour: () => ISemanticMark;\n\n // observable auto define type by data\n // auto: () => ISemanticMark;\n}\n\nexport interface IPlotConstructor {\n new (options?: IPlotOptions): IPlot;\n}\n\nexport type WithDefaultEncode<T, K extends string> = {\n [Key in K]?: Key extends keyof T ? ISemanticEncodeValue<T[Key]> : ISemanticEncodeValue<string | number>;\n};\nexport type ISemanticEncodeValue<T> = T extends any[]\n ? string[] | ((datum: any) => any)[]\n : string | ((datum: any) => T);\nexport type ISemanticEncodeSpec<T> = {\n [Key in keyof T]?: ISemanticEncodeValue<T[Key]>;\n};\nexport type ISemanticStyle<T, K extends string> = Omit<T, K>;\n\nexport interface SemanticTooltipContentItem {\n key?: ISemanticEncodeValue<string | number>;\n value?: ISemanticEncodeValue<string | number>;\n symbol?: ISemanticEncodeValue<string>;\n}\nexport type SemanticTooltipOption = {\n disableGraphicTooltip?: boolean;\n disableDimensionTooltip?: boolean;\n staticTitle?: string;\n staticContentKey?: string | string[];\n title?: ISemanticEncodeValue<string | number>;\n dimensionTooltipChannel?: 'x' | 'y';\n content?: SemanticTooltipContentItem[];\n};\n\nexport interface SemanticAxisOption extends Partial<AxisBaseAttributes> {\n tickCount?: number;\n}\n\nexport interface SemanticGridOption extends Partial<GridBaseAttributes> {\n type?: GridShape;\n tickCount?: number;\n inside?: boolean;\n baseValue?: number;\n sides?: number;\n}\nexport type SemanticDataZoomOption = Partial<DataZoomAttributes>;\nexport type SemanticSliderOption = Partial<SliderAttributes>;\nexport type SemanticLegendOption = Partial<ColorLegendAttributes | DiscreteLegendAttrs | SizeLegendAttributes>;\nexport type SemanticCrosshairOption = Partial<BaseCrosshairAttrs>;\nexport type SemanticLabelOption = Partial<BaseLabelAttrs>;\nexport type SemanticPlayerOption = Partial<PlayerAttributes>;\nexport type SemanticTitleOption = Partial<TitleAttrs>;\n\nexport interface ISemanticMark<EncodeSpec, K extends string> {\n readonly uid: number;\n readonly type: string;\n data: (values: any, transform?: TransformSpec[], id?: string) => this;\n style: (style: Partial<EncodeSpec & any>) => this;\n encode: (channel: K, option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>) => this;\n scale: (channel: K, option: Partial<ScaleSpec>) => this;\n transform: (option: TransformSpec[]) => this;\n animate: (state: string, option: IAnimationConfig | IAnimationConfig[]) => this;\n state: (state: string, option: Partial<EncodeSpec>) => this;\n\n axis: (channel: string, option?: SemanticAxisOption | boolean, layout?: MarkRelativeItemSpec) => this;\n legend: (channel: string, option?: SemanticLegendOption | boolean, layout?: MarkRelativeItemSpec) => this;\n crosshair: (channel: string, option?: SemanticCrosshairOption | boolean) => this;\n tooltip: (option: SemanticTooltipOption | boolean) => this;\n coordinate: (option: CoordinateOption) => this;\n grid: (channel: string, option?: SemanticGridOption | boolean) => this;\n title: (option: SemanticTitleOption, layout?: MarkRelativeItemSpec) => this;\n\n slider: (channel: string, option?: SemanticSliderOption | boolean, layout?: MarkRelativeItemSpec) => this;\n datazoom: (channel: string, option?: SemanticDataZoomOption | boolean, layout?: MarkRelativeItemSpec) => this;\n label: (channel: string, option?: SemanticLabelOption | boolean) => this;\n player: (data?: any[], option?: SemanticPlayerOption | boolean, layout?: MarkRelativeItemSpec) => this;\n\n toViewSpec: () => ViewSpec;\n parseSpec: (spec: Partial<ISemanticMarkSpec<EncodeSpec, K>>) => this;\n}\n\nexport interface ISemanticMarkSpec<EncodeSpec, K extends string> {\n id: string | number;\n data?: DataSpec;\n encode?: WithDefaultEncode<EncodeSpec, K>;\n scale?: Partial<Record<K, ScaleSpec>>;\n style?: Partial<EncodeSpec & any>;\n axis?: Partial<\n Record<K, { option?: SemanticAxisOption | boolean; layout?: MarkRelativeItemSpec } | SemanticAxisOption | boolean>\n >;\n grid?: Partial<Record<K, SemanticGridOption | boolean>>;\n transform?: TransformSpec[];\n state?: Record<string, Partial<EncodeSpec>>;\n animation?: Record<string, IAnimationConfig | IAnimationConfig[]>;\n legend?: Record<\n string,\n { option: SemanticLegendOption | boolean; layout?: MarkRelativeItemSpec } | SemanticLegendOption | boolean\n >;\n crosshair?: Record<string, SemanticCrosshairOption | boolean>;\n tooltip?: SemanticTooltipOption | boolean;\n slider?: Record<\n string,\n { option: SemanticSliderOption | boolean; layout?: MarkRelativeItemSpec } | SemanticSliderOption | boolean\n >;\n datazoom?: Record<\n string,\n { option: SemanticDataZoomOption | boolean; layout?: MarkRelativeItemSpec } | SemanticDataZoomOption | boolean\n >;\n label?: Record<string, SemanticLabelOption | boolean>;\n player?: { data?: any[]; option?: SemanticPlayerOption | boolean; layout?: MarkRelativeItemSpec };\n title?: { option?: SemanticTitleOption; layout?: MarkRelativeItemSpec } | SemanticTitleOption;\n}\n\nexport type ParsedSimpleEncode<T, K extends string> = {\n [Key in K]?: {\n field: Key extends keyof T ? ISemanticEncodeValue<T[Key]> : ISemanticEncodeValue<string>;\n scale: string;\n };\n};\n\nexport type SemanticEncodeChannels = 'x' | 'y' | 'group' | 'color';\nexport type IntervalEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type CellEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type LineEncodeChannels = 'x' | 'y' | 'group' | 'color';\nexport type AreaEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type RuleXEncodeChannels = 'x' | 'x' | 'color' | 'group';\nexport type RuleYEncodeChannels = 'x' | 'y' | 'color' | 'group';\nexport type SymbolEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'size' | 'shape' | 'stroke';\nexport type TextEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'text' | 'stroke';\nexport type RectEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'stroke';\nexport type RectXEncodeChannels = 'x' | 'color' | 'group' | 'stroke';\nexport type RectYEncodeChannels = 'y' | 'color' | 'group' | 'stroke';\nexport type PolygonEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'stroke';\nexport type RuleEncodeChannels = 'x' | 'y' | 'color' | 'group';\nexport type ImageEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'src' | 'stroke';\nexport type PathEncodeChannels = 'color' | 'stroke';\nexport type SankeyEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type SunburstEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type TreeEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type TreemapEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type CirclepackingEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type WordcloudEncodeChannels = 'text' | 'color' | 'stroke';\nexport type WordcloudShapeEncodeChannels = 'text' | 'color' | 'stroke';\nexport type ImagecloudShapeEncodeChannels = 'image' | 'weight';\n\nexport type IInterval = ISemanticMark<PlotIntervalEncoderSpec, IntervalEncodeChannels>;\nexport type ILine = ISemanticMark<BasicEncoderSpecMap['line'], LineEncodeChannels>;\nexport type ICell = ISemanticMark<BasicEncoderSpecMap['cell'], CellEncodeChannels>;\nexport type IRuleX = ISemanticMark<BasicEncoderSpecMap['rule'], RuleXEncodeChannels>;\nexport type IRuleY = ISemanticMark<BasicEncoderSpecMap['rule'], RuleYEncodeChannels>;\nexport type IArea = ISemanticMark<PlotAreaEncoderSpec, AreaEncodeChannels>;\nexport type ISymbol = ISemanticMark<BasicEncoderSpecMap['symbol'], SymbolEncodeChannels>;\nexport type IText = ISemanticMark<BasicEncoderSpecMap['text'], TextEncodeChannels>;\nexport type IRect = ISemanticMark<PlotRectEncoderSpec, RectEncodeChannels>;\nexport type IRectX = ISemanticMark<BasicEncoderSpecMap['rect'], RectXEncodeChannels>;\nexport type IRectY = ISemanticMark<BasicEncoderSpecMap['rect'], RectYEncodeChannels>;\nexport type IPolygon = ISemanticMark<PlotPolygonEncoderSpec, PolygonEncodeChannels>;\nexport type IRule = ISemanticMark<BasicEncoderSpecMap['rule'], RuleEncodeChannels>;\nexport type IImage = ISemanticMark<PlotImageEncoderSpec, ImageEncodeChannels>;\nexport type IPath = ISemanticMark<BasicEncoderSpecMap['path'], PathEncodeChannels>;\nexport type ISankey = ISemanticMark<PlotSankeyEncoderSpec, SankeyEncodeChannels>;\nexport type ISunburst = ISemanticMark<PlotSunburstEncodeSpec, SunburstEncodeChannels>;\nexport type IWordcloud = ISemanticMark<PlotWordcloudEncodeSpec, WordcloudEncodeChannels>;\nexport type IWordcloudShape = ISemanticMark<PlotWordcloudShapeEncodeSpec, WordcloudShapeEncodeChannels>;\nexport type ITree = ISemanticMark<PlotTreeEncodeSpec, TreeEncodeChannels>;\nexport type ITreemap = ISemanticMark<PlotTreemapEncodeSpec, TreemapEncodeChannels>;\nexport type ICirclePacking = ISemanticMark<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>;\nexport type IImagecloud = ISemanticMark<PlotImagecloudEncodeSpec, ImagecloudShapeEncodeChannels>;\n\nexport type PlotMark =\n | IInterval\n | IRuleX\n | IRuleY\n | ICell\n | ILine\n | IArea\n | ISymbol\n | IText\n | IRect\n | IRectX\n | IRectY\n | IPolygon\n | IRule\n | IImage\n | IPath\n | ISankey\n | ISunburst\n | ICirclePacking\n | ITreemap\n | ITree\n | IWordcloud\n | IWordcloudShape;\n\nexport interface IPlotMarkConstructor {\n readonly type: string;\n\n new (id?: string): PlotMark;\n}\n"]}
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAC;AAEvC,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,EAAE;IACrC,OAAO,CAAC,wBAAwB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACtD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACxC,OAAO,CAAC,wBAAwB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AACvD,CAAC,CAAC;AAEF,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AAEnE,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,sBAAsB,EAAE,CAAC;IACzB,sBAAsB,EAAE,CAAC;AAC3B,CAAC,CAAC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"1.0.0-alpha.0\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { Scale, registerScale } from './view/scale';\nexport { Coordinate, registerCoordinate } from './view/coordinate';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\nexport { registerViewEventsAPI } from './view/view-event-mixin';\nexport { registerViewMorphAPI } from './view/view-morph-mixin';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\nexport * from './graph/mark/graphic';\nexport { registerDefaultLayout, defaultDoLayout } from './graph/layout/layout';\nexport { registerGlyphMark, GlyphMark } from './view/glyph';\n\nimport { DragNDrop, Gesture } from '@visactor/vrender-kits';\nimport { Factory } from './core/factory';\n\nexport const registerDragPlugin = () => {\n Factory.registerStageEventPlugin('drag', DragNDrop);\n};\n\nexport const registerGesturePlugin = () => {\n Factory.registerStageEventPlugin('gesture', Gesture);\n};\n\nimport { registerViewAnimateAPI } from './view/view-animate-mixin';\nimport { registerMarkAnimateAPI } from './view/mark-animate-mixin';\n\nexport const registerAnimate = () => {\n registerViewAnimateAPI();\n registerMarkAnimateAPI();\n};\n"]}
|
package/es/types/plot.d.ts
CHANGED
|
@@ -75,6 +75,7 @@ export type PlotTreemapEncodeSpec = BasicEncoderSpecMap['rect'];
|
|
|
75
75
|
export type PlotCirclePackingEncodeSpec = BasicEncoderSpecMap['circle'];
|
|
76
76
|
export type PlotWordcloudEncodeSpec = BasicEncoderSpecMap['text'];
|
|
77
77
|
export type PlotWordcloudShapeEncodeSpec = BasicEncoderSpecMap['text'];
|
|
78
|
+
export type PlotImagecloudEncodeSpec = BasicEncoderSpecMap['image'];
|
|
78
79
|
export type CoordinateOption = CartesianCoordinateOption | PolarCoordinateOption;
|
|
79
80
|
export type PlotIntervalSpec = Partial<ISemanticMarkSpec<PlotIntervalEncoderSpec, IntervalEncodeChannels>> & {
|
|
80
81
|
type: 'interval';
|
|
@@ -156,6 +157,7 @@ export interface IPlot {
|
|
|
156
157
|
rule: () => IRule;
|
|
157
158
|
wordcloud: () => IWordcloud;
|
|
158
159
|
wordcloudShape: () => IWordcloudShape;
|
|
160
|
+
imagecloud: () => IImagecloud;
|
|
159
161
|
circlePacking: () => ICirclePacking;
|
|
160
162
|
treemap: () => ITreemap;
|
|
161
163
|
tree: () => ITree;
|
|
@@ -296,6 +298,7 @@ export type TreemapEncodeChannels = 'node' | 'value' | 'color' | 'stroke';
|
|
|
296
298
|
export type CirclepackingEncodeChannels = 'node' | 'value' | 'color' | 'stroke';
|
|
297
299
|
export type WordcloudEncodeChannels = 'text' | 'color' | 'stroke';
|
|
298
300
|
export type WordcloudShapeEncodeChannels = 'text' | 'color' | 'stroke';
|
|
301
|
+
export type ImagecloudShapeEncodeChannels = 'image' | 'weight';
|
|
299
302
|
export type IInterval = ISemanticMark<PlotIntervalEncoderSpec, IntervalEncodeChannels>;
|
|
300
303
|
export type ILine = ISemanticMark<BasicEncoderSpecMap['line'], LineEncodeChannels>;
|
|
301
304
|
export type ICell = ISemanticMark<BasicEncoderSpecMap['cell'], CellEncodeChannels>;
|
|
@@ -318,6 +321,7 @@ export type IWordcloudShape = ISemanticMark<PlotWordcloudShapeEncodeSpec, Wordcl
|
|
|
318
321
|
export type ITree = ISemanticMark<PlotTreeEncodeSpec, TreeEncodeChannels>;
|
|
319
322
|
export type ITreemap = ISemanticMark<PlotTreemapEncodeSpec, TreemapEncodeChannels>;
|
|
320
323
|
export type ICirclePacking = ISemanticMark<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>;
|
|
324
|
+
export type IImagecloud = ISemanticMark<PlotImagecloudEncodeSpec, ImagecloudShapeEncodeChannels>;
|
|
321
325
|
export type PlotMark = IInterval | IRuleX | IRuleY | ICell | ILine | IArea | ISymbol | IText | IRect | IRectX | IRectY | IPolygon | IRule | IImage | IPath | ISankey | ISunburst | ICirclePacking | ITreemap | ITree | IWordcloud | IWordcloudShape;
|
|
322
326
|
export interface IPlotMarkConstructor {
|
|
323
327
|
readonly type: string;
|
package/es/types/plot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/types/plot.ts"],"names":[],"mappings":"","file":"plot.js","sourcesContent":["import type {\n AxisBaseAttributes,\n BaseCrosshairAttrs,\n BaseLabelAttrs,\n ColorLegendAttributes,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n GridBaseAttributes,\n PlayerAttributes,\n SizeLegendAttributes,\n SliderAttributes,\n TitleAttrs\n} from '@visactor/vrender-components';\nimport type { CoordinateType } from '@visactor/vgrammar-coordinate';\nimport type { IColor } from '@visactor/vrender-core';\nimport type { IEnvironmentOptions, IRendererOptions, IRunningConfig, ViewSpec, srIOption3DType, IView } from './view';\nimport type { CommonPaddingSpec, ValueOf } from './base';\nimport type { BasicEncoderSpecMap, LinkPathEncoderSpec, MarkRelativeItemSpec } from './mark';\nimport type { BaseEventHandler } from './event';\nimport type { TransformSpec } from './transform';\nimport type { IAnimationConfig } from './animate';\nimport type { ScaleSpec } from './scale';\nimport type { DataSpec } from './data';\nimport type { GridShape } from './component';\n\nexport interface IPlotOptions extends IEnvironmentOptions, IRendererOptions {\n width?: number;\n height?: number;\n padding?: CommonPaddingSpec;\n autoFit?: boolean;\n options3d?: srIOption3DType;\n theme?: string;\n logLevel?: number;\n}\n\nexport interface CartesianCoordinateOption {\n id?: string;\n type: 'cartesian';\n transpose?: boolean;\n}\n\nexport interface PolarCoordinateOption {\n id?: string;\n type: 'polar';\n origin?: [string | number, string | number];\n transpose?: boolean;\n}\n\nexport type PlotIntervalEncoderSpec = Omit<BasicEncoderSpecMap['interval'], 'y'> & {\n y?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'y' | 'x'> & {\n y?: number | number[];\n x?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectXEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'x'> & {\n x?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectYEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'y'> & {\n y?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotAreaEncoderSpec = Omit<BasicEncoderSpecMap['area'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\n\nexport type PlotRuleEncoderSpec = Omit<BasicEncoderSpecMap['rule'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\n\nexport type PlotImageEncoderSpec = Omit<BasicEncoderSpecMap['image'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\nexport type PlotPolygonEncoderSpec = Omit<BasicEncoderSpecMap['polygon'], 'x' | 'y'> & {\n x?: number[];\n y?: number[];\n};\n\nexport type PlotSankeyEncoderSpec = Partial<LinkPathEncoderSpec>;\nexport type PlotSunburstEncodeSpec = BasicEncoderSpecMap['arc'];\nexport type PlotTreeEncodeSpec = BasicEncoderSpecMap['symbol'];\nexport type PlotTreemapEncodeSpec = BasicEncoderSpecMap['rect'];\nexport type PlotCirclePackingEncodeSpec = BasicEncoderSpecMap['circle'];\nexport type PlotWordcloudEncodeSpec = BasicEncoderSpecMap['text'];\nexport type PlotWordcloudShapeEncodeSpec = BasicEncoderSpecMap['text'];\n\nexport type CoordinateOption = CartesianCoordinateOption | PolarCoordinateOption;\nexport type PlotIntervalSpec = Partial<ISemanticMarkSpec<PlotIntervalEncoderSpec, IntervalEncodeChannels>> & {\n type: 'interval';\n};\nexport type PlotLineSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['line'], LineEncodeChannels>> & {\n type: 'line';\n};\nexport type PlotCellSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['cell'], CellEncodeChannels>> & {\n type: 'cell';\n};\nexport type PlotRuleXSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['rule'], RuleXEncodeChannels>> & {\n type: 'ruleX';\n};\nexport type PlotRuleYSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['rule'], RuleYEncodeChannels>> & {\n type: 'ruleY';\n};\nexport type PlotAreaSpec = Partial<ISemanticMarkSpec<PlotAreaEncoderSpec, AreaEncodeChannels>> & {\n type: 'area';\n};\nexport type PlotSymbolSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['symbol'], SymbolEncodeChannels>> & {\n type: 'symbol';\n};\nexport type PlotTextSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['text'], TextEncodeChannels>> & {\n type: 'text';\n};\nexport type PlotRectSpec = Partial<ISemanticMarkSpec<PlotRectEncoderSpec, RectEncodeChannels>> & {\n type: 'rect';\n};\nexport type PlotRectXSpec = Partial<ISemanticMarkSpec<PlotRectXEncoderSpec, RectXEncodeChannels>> & {\n type: 'rectX';\n};\nexport type PlotRectYSpec = Partial<ISemanticMarkSpec<PlotRectYEncoderSpec, RectYEncodeChannels>> & {\n type: 'rectY';\n};\nexport type PlotPolygonSpec = Partial<ISemanticMarkSpec<PlotPolygonEncoderSpec, PolygonEncodeChannels>> & {\n type: 'polygon';\n};\nexport type PlotRuleSpec = Partial<ISemanticMarkSpec<PlotRuleEncoderSpec, RuleEncodeChannels>> & {\n type: 'rule';\n};\nexport type PlotImageSpec = Partial<ISemanticMarkSpec<PlotImageEncoderSpec, ImageEncodeChannels>> & {\n type: 'image';\n};\nexport type PlotPathSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['path'], PathEncodeChannels>> & {\n type: 'path';\n};\n\nexport interface PlotSpec {\n background?: IColor;\n width?: number;\n height?: number;\n padding?: number;\n coordinate?: CoordinateOption;\n marks?: Array<\n | PlotIntervalSpec\n | PlotLineSpec\n | PlotCellSpec\n | PlotRuleXSpec\n | PlotRuleYSpec\n | PlotAreaSpec\n | PlotSymbolSpec\n | PlotTextSpec\n | PlotRectSpec\n | PlotRectXSpec\n | PlotRectYSpec\n | PlotPolygonSpec\n | PlotRuleSpec\n | PlotImageSpec\n | PlotPathSpec\n >;\n}\n\nexport interface IPlot {\n readonly view: IView;\n\n theme: (theme: string) => this;\n /**\n * todo: 直接接text图元还是title组件\n */\n // title: (text: ITextAttribute['text'], style: Omit<ITextAttribute, 'text'>) => this;\n coordinate: (type: CoordinateType, option?: Omit<CoordinateOption, 'type'>) => this;\n // interaction: (type: string, options: boolean | any) => this;\n\n // facet: (type: string, options: any) => this;\n\n ///--------- life cycle ---------///\n\n run: (runningConfig?: IRunningConfig) => this;\n release: () => this;\n parseSpec: (spec: PlotSpec) => this;\n updateSpec: (spec: PlotSpec) => this;\n getImageBuffer: () => Buffer;\n\n ///--------- events api ---------///\n on: (type: string, handler: BaseEventHandler) => this;\n off: (type: string, handler?: BaseEventHandler) => this;\n\n ///--------- marks ---------///\n\n interval: () => IInterval;\n cell: () => ICell;\n area: () => IArea;\n image: () => IImage;\n line: () => ILine;\n ruleX: () => IRuleX;\n ruleY: () => IRectY;\n symbol: () => ISymbol;\n polygon: () => IPolygon;\n text: () => IText;\n rect: () => IRect;\n rectX: () => IRectX;\n rectY: () => IRectY;\n rule: () => IRule;\n\n // wordcloud 包如果没注册,会存在问题\n wordcloud: () => IWordcloud;\n wordcloudShape: () => IWordcloudShape;\n circlePacking: () => ICirclePacking;\n treemap: () => ITreemap;\n tree: () => ITree;\n sunburst: () => ISunburst;\n sankey: () => ISankey;\n\n // P2\n // forceGraph: () => ISemanticMark;\n // geoPath: () => ISemanticMark;\n // vector: () => ISemanticMark;\n // shape: () => ISemanticMark;\n // gauge: () => ISemanticMark;\n // heatmap: () => ISemanticMark;\n // density: () => ISemanticMark;\n // boxplot: () => ISemanticMark;\n // box: () => ISemanticMark;\n // contour: () => ISemanticMark;\n\n // observable auto define type by data\n // auto: () => ISemanticMark;\n}\n\nexport interface IPlotConstructor {\n new (options?: IPlotOptions): IPlot;\n}\n\nexport type WithDefaultEncode<T, K extends string> = {\n [Key in K]?: Key extends keyof T ? ISemanticEncodeValue<T[Key]> : ISemanticEncodeValue<string | number>;\n};\nexport type ISemanticEncodeValue<T> = T extends any[]\n ? string[] | ((datum: any) => any)[]\n : string | ((datum: any) => T);\nexport type ISemanticEncodeSpec<T> = {\n [Key in keyof T]?: ISemanticEncodeValue<T[Key]>;\n};\nexport type ISemanticStyle<T, K extends string> = Omit<T, K>;\n\nexport interface SemanticTooltipContentItem {\n key?: ISemanticEncodeValue<string | number>;\n value?: ISemanticEncodeValue<string | number>;\n symbol?: ISemanticEncodeValue<string>;\n}\nexport type SemanticTooltipOption = {\n disableGraphicTooltip?: boolean;\n disableDimensionTooltip?: boolean;\n staticTitle?: string;\n staticContentKey?: string | string[];\n title?: ISemanticEncodeValue<string | number>;\n dimensionTooltipChannel?: 'x' | 'y';\n content?: SemanticTooltipContentItem[];\n};\n\nexport interface SemanticAxisOption extends Partial<AxisBaseAttributes> {\n tickCount?: number;\n}\n\nexport interface SemanticGridOption extends Partial<GridBaseAttributes> {\n type?: GridShape;\n tickCount?: number;\n inside?: boolean;\n baseValue?: number;\n sides?: number;\n}\nexport type SemanticDataZoomOption = Partial<DataZoomAttributes>;\nexport type SemanticSliderOption = Partial<SliderAttributes>;\nexport type SemanticLegendOption = Partial<ColorLegendAttributes | DiscreteLegendAttrs | SizeLegendAttributes>;\nexport type SemanticCrosshairOption = Partial<BaseCrosshairAttrs>;\nexport type SemanticLabelOption = Partial<BaseLabelAttrs>;\nexport type SemanticPlayerOption = Partial<PlayerAttributes>;\nexport type SemanticTitleOption = Partial<TitleAttrs>;\n\nexport interface ISemanticMark<EncodeSpec, K extends string> {\n readonly uid: number;\n readonly type: string;\n data: (values: any, transform?: TransformSpec[], id?: string) => this;\n style: (style: Partial<EncodeSpec & any>) => this;\n encode: (channel: K, option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>) => this;\n scale: (channel: K, option: Partial<ScaleSpec>) => this;\n transform: (option: TransformSpec[]) => this;\n animate: (state: string, option: IAnimationConfig | IAnimationConfig[]) => this;\n state: (state: string, option: Partial<EncodeSpec>) => this;\n\n axis: (channel: string, option?: SemanticAxisOption | boolean, layout?: MarkRelativeItemSpec) => this;\n legend: (channel: string, option?: SemanticLegendOption | boolean, layout?: MarkRelativeItemSpec) => this;\n crosshair: (channel: string, option?: SemanticCrosshairOption | boolean) => this;\n tooltip: (option: SemanticTooltipOption | boolean) => this;\n coordinate: (option: CoordinateOption) => this;\n grid: (channel: string, option?: SemanticGridOption | boolean) => this;\n title: (option: SemanticTitleOption, layout?: MarkRelativeItemSpec) => this;\n\n slider: (channel: string, option?: SemanticSliderOption | boolean, layout?: MarkRelativeItemSpec) => this;\n datazoom: (channel: string, option?: SemanticDataZoomOption | boolean, layout?: MarkRelativeItemSpec) => this;\n label: (channel: string, option?: SemanticLabelOption | boolean) => this;\n player: (data?: any[], option?: SemanticPlayerOption | boolean, layout?: MarkRelativeItemSpec) => this;\n\n toViewSpec: () => ViewSpec;\n parseSpec: (spec: Partial<ISemanticMarkSpec<EncodeSpec, K>>) => this;\n}\n\nexport interface ISemanticMarkSpec<EncodeSpec, K extends string> {\n id: string | number;\n data?: DataSpec;\n encode?: WithDefaultEncode<EncodeSpec, K>;\n scale?: Partial<Record<K, ScaleSpec>>;\n style?: Partial<EncodeSpec & any>;\n axis?: Partial<\n Record<K, { option?: SemanticAxisOption | boolean; layout?: MarkRelativeItemSpec } | SemanticAxisOption | boolean>\n >;\n grid?: Partial<Record<K, SemanticGridOption | boolean>>;\n transform?: TransformSpec[];\n state?: Record<string, Partial<EncodeSpec>>;\n animation?: Record<string, IAnimationConfig | IAnimationConfig[]>;\n legend?: Record<\n string,\n { option: SemanticLegendOption | boolean; layout?: MarkRelativeItemSpec } | SemanticLegendOption | boolean\n >;\n crosshair?: Record<string, SemanticCrosshairOption | boolean>;\n tooltip?: SemanticTooltipOption | boolean;\n slider?: Record<\n string,\n { option: SemanticSliderOption | boolean; layout?: MarkRelativeItemSpec } | SemanticSliderOption | boolean\n >;\n datazoom?: Record<\n string,\n { option: SemanticDataZoomOption | boolean; layout?: MarkRelativeItemSpec } | SemanticDataZoomOption | boolean\n >;\n label?: Record<string, SemanticLabelOption | boolean>;\n player?: { data?: any[]; option?: SemanticPlayerOption | boolean; layout?: MarkRelativeItemSpec };\n title?: { option?: SemanticTitleOption; layout?: MarkRelativeItemSpec } | SemanticTitleOption;\n}\n\nexport type ParsedSimpleEncode<T, K extends string> = {\n [Key in K]?: {\n field: Key extends keyof T ? ISemanticEncodeValue<T[Key]> : ISemanticEncodeValue<string>;\n scale: string;\n };\n};\n\nexport type SemanticEncodeChannels = 'x' | 'y' | 'group' | 'color';\nexport type IntervalEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type CellEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type LineEncodeChannels = 'x' | 'y' | 'group' | 'color';\nexport type AreaEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type RuleXEncodeChannels = 'x' | 'x' | 'color' | 'group';\nexport type RuleYEncodeChannels = 'x' | 'y' | 'color' | 'group';\nexport type SymbolEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'size' | 'shape' | 'stroke';\nexport type TextEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'text' | 'stroke';\nexport type RectEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'stroke';\nexport type RectXEncodeChannels = 'x' | 'color' | 'group' | 'stroke';\nexport type RectYEncodeChannels = 'y' | 'color' | 'group' | 'stroke';\nexport type PolygonEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'stroke';\nexport type RuleEncodeChannels = 'x' | 'y' | 'color' | 'group';\nexport type ImageEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'src' | 'stroke';\nexport type PathEncodeChannels = 'color' | 'stroke';\nexport type SankeyEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type SunburstEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type TreeEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type TreemapEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type CirclepackingEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type WordcloudEncodeChannels = 'text' | 'color' | 'stroke';\nexport type WordcloudShapeEncodeChannels = 'text' | 'color' | 'stroke';\n\nexport type IInterval = ISemanticMark<PlotIntervalEncoderSpec, IntervalEncodeChannels>;\nexport type ILine = ISemanticMark<BasicEncoderSpecMap['line'], LineEncodeChannels>;\nexport type ICell = ISemanticMark<BasicEncoderSpecMap['cell'], CellEncodeChannels>;\nexport type IRuleX = ISemanticMark<BasicEncoderSpecMap['rule'], RuleXEncodeChannels>;\nexport type IRuleY = ISemanticMark<BasicEncoderSpecMap['rule'], RuleYEncodeChannels>;\nexport type IArea = ISemanticMark<PlotAreaEncoderSpec, AreaEncodeChannels>;\nexport type ISymbol = ISemanticMark<BasicEncoderSpecMap['symbol'], SymbolEncodeChannels>;\nexport type IText = ISemanticMark<BasicEncoderSpecMap['text'], TextEncodeChannels>;\nexport type IRect = ISemanticMark<PlotRectEncoderSpec, RectEncodeChannels>;\nexport type IRectX = ISemanticMark<BasicEncoderSpecMap['rect'], RectXEncodeChannels>;\nexport type IRectY = ISemanticMark<BasicEncoderSpecMap['rect'], RectYEncodeChannels>;\nexport type IPolygon = ISemanticMark<PlotPolygonEncoderSpec, PolygonEncodeChannels>;\nexport type IRule = ISemanticMark<BasicEncoderSpecMap['rule'], RuleEncodeChannels>;\nexport type IImage = ISemanticMark<PlotImageEncoderSpec, ImageEncodeChannels>;\nexport type IPath = ISemanticMark<BasicEncoderSpecMap['path'], PathEncodeChannels>;\nexport type ISankey = ISemanticMark<PlotSankeyEncoderSpec, SankeyEncodeChannels>;\nexport type ISunburst = ISemanticMark<PlotSunburstEncodeSpec, SunburstEncodeChannels>;\nexport type IWordcloud = ISemanticMark<PlotWordcloudEncodeSpec, WordcloudEncodeChannels>;\nexport type IWordcloudShape = ISemanticMark<PlotWordcloudShapeEncodeSpec, WordcloudShapeEncodeChannels>;\nexport type ITree = ISemanticMark<PlotTreeEncodeSpec, TreeEncodeChannels>;\nexport type ITreemap = ISemanticMark<PlotTreemapEncodeSpec, TreemapEncodeChannels>;\nexport type ICirclePacking = ISemanticMark<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>;\n\nexport type PlotMark =\n | IInterval\n | IRuleX\n | IRuleY\n | ICell\n | ILine\n | IArea\n | ISymbol\n | IText\n | IRect\n | IRectX\n | IRectY\n | IPolygon\n | IRule\n | IImage\n | IPath\n | ISankey\n | ISunburst\n | ICirclePacking\n | ITreemap\n | ITree\n | IWordcloud\n | IWordcloudShape;\n\nexport interface IPlotMarkConstructor {\n readonly type: string;\n\n new (id?: string): PlotMark;\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/types/plot.ts"],"names":[],"mappings":"","file":"plot.js","sourcesContent":["import type {\n AxisBaseAttributes,\n BaseCrosshairAttrs,\n BaseLabelAttrs,\n ColorLegendAttributes,\n DataZoomAttributes,\n DiscreteLegendAttrs,\n GridBaseAttributes,\n PlayerAttributes,\n SizeLegendAttributes,\n SliderAttributes,\n TitleAttrs\n} from '@visactor/vrender-components';\nimport type { CoordinateType } from '@visactor/vgrammar-coordinate';\nimport type { IColor } from '@visactor/vrender-core';\nimport type { IEnvironmentOptions, IRendererOptions, IRunningConfig, ViewSpec, srIOption3DType, IView } from './view';\nimport type { CommonPaddingSpec, ValueOf } from './base';\nimport type { BasicEncoderSpecMap, LinkPathEncoderSpec, MarkRelativeItemSpec } from './mark';\nimport type { BaseEventHandler } from './event';\nimport type { TransformSpec } from './transform';\nimport type { IAnimationConfig } from './animate';\nimport type { ScaleSpec } from './scale';\nimport type { DataSpec } from './data';\nimport type { GridShape } from './component';\n\nexport interface IPlotOptions extends IEnvironmentOptions, IRendererOptions {\n width?: number;\n height?: number;\n padding?: CommonPaddingSpec;\n autoFit?: boolean;\n options3d?: srIOption3DType;\n theme?: string;\n logLevel?: number;\n}\n\nexport interface CartesianCoordinateOption {\n id?: string;\n type: 'cartesian';\n transpose?: boolean;\n}\n\nexport interface PolarCoordinateOption {\n id?: string;\n type: 'polar';\n origin?: [string | number, string | number];\n transpose?: boolean;\n}\n\nexport type PlotIntervalEncoderSpec = Omit<BasicEncoderSpecMap['interval'], 'y'> & {\n y?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'y' | 'x'> & {\n y?: number | number[];\n x?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectXEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'x'> & {\n x?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotRectYEncoderSpec = Omit<BasicEncoderSpecMap['rect'], 'y'> & {\n y?: number | number[];\n y1?: number;\n x1?: number;\n};\n\nexport type PlotAreaEncoderSpec = Omit<BasicEncoderSpecMap['area'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\n\nexport type PlotRuleEncoderSpec = Omit<BasicEncoderSpecMap['rule'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\n\nexport type PlotImageEncoderSpec = Omit<BasicEncoderSpecMap['image'], 'x' | 'y'> & {\n x?: number | number[];\n y?: number | number[];\n};\nexport type PlotPolygonEncoderSpec = Omit<BasicEncoderSpecMap['polygon'], 'x' | 'y'> & {\n x?: number[];\n y?: number[];\n};\n\nexport type PlotSankeyEncoderSpec = Partial<LinkPathEncoderSpec>;\nexport type PlotSunburstEncodeSpec = BasicEncoderSpecMap['arc'];\nexport type PlotTreeEncodeSpec = BasicEncoderSpecMap['symbol'];\nexport type PlotTreemapEncodeSpec = BasicEncoderSpecMap['rect'];\nexport type PlotCirclePackingEncodeSpec = BasicEncoderSpecMap['circle'];\nexport type PlotWordcloudEncodeSpec = BasicEncoderSpecMap['text'];\nexport type PlotWordcloudShapeEncodeSpec = BasicEncoderSpecMap['text'];\nexport type PlotImagecloudEncodeSpec = BasicEncoderSpecMap['image'];\n\nexport type CoordinateOption = CartesianCoordinateOption | PolarCoordinateOption;\nexport type PlotIntervalSpec = Partial<ISemanticMarkSpec<PlotIntervalEncoderSpec, IntervalEncodeChannels>> & {\n type: 'interval';\n};\nexport type PlotLineSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['line'], LineEncodeChannels>> & {\n type: 'line';\n};\nexport type PlotCellSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['cell'], CellEncodeChannels>> & {\n type: 'cell';\n};\nexport type PlotRuleXSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['rule'], RuleXEncodeChannels>> & {\n type: 'ruleX';\n};\nexport type PlotRuleYSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['rule'], RuleYEncodeChannels>> & {\n type: 'ruleY';\n};\nexport type PlotAreaSpec = Partial<ISemanticMarkSpec<PlotAreaEncoderSpec, AreaEncodeChannels>> & {\n type: 'area';\n};\nexport type PlotSymbolSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['symbol'], SymbolEncodeChannels>> & {\n type: 'symbol';\n};\nexport type PlotTextSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['text'], TextEncodeChannels>> & {\n type: 'text';\n};\nexport type PlotRectSpec = Partial<ISemanticMarkSpec<PlotRectEncoderSpec, RectEncodeChannels>> & {\n type: 'rect';\n};\nexport type PlotRectXSpec = Partial<ISemanticMarkSpec<PlotRectXEncoderSpec, RectXEncodeChannels>> & {\n type: 'rectX';\n};\nexport type PlotRectYSpec = Partial<ISemanticMarkSpec<PlotRectYEncoderSpec, RectYEncodeChannels>> & {\n type: 'rectY';\n};\nexport type PlotPolygonSpec = Partial<ISemanticMarkSpec<PlotPolygonEncoderSpec, PolygonEncodeChannels>> & {\n type: 'polygon';\n};\nexport type PlotRuleSpec = Partial<ISemanticMarkSpec<PlotRuleEncoderSpec, RuleEncodeChannels>> & {\n type: 'rule';\n};\nexport type PlotImageSpec = Partial<ISemanticMarkSpec<PlotImageEncoderSpec, ImageEncodeChannels>> & {\n type: 'image';\n};\nexport type PlotPathSpec = Partial<ISemanticMarkSpec<BasicEncoderSpecMap['path'], PathEncodeChannels>> & {\n type: 'path';\n};\n\nexport interface PlotSpec {\n background?: IColor;\n width?: number;\n height?: number;\n padding?: number;\n coordinate?: CoordinateOption;\n marks?: Array<\n | PlotIntervalSpec\n | PlotLineSpec\n | PlotCellSpec\n | PlotRuleXSpec\n | PlotRuleYSpec\n | PlotAreaSpec\n | PlotSymbolSpec\n | PlotTextSpec\n | PlotRectSpec\n | PlotRectXSpec\n | PlotRectYSpec\n | PlotPolygonSpec\n | PlotRuleSpec\n | PlotImageSpec\n | PlotPathSpec\n >;\n}\n\nexport interface IPlot {\n readonly view: IView;\n\n theme: (theme: string) => this;\n /**\n * todo: 直接接text图元还是title组件\n */\n // title: (text: ITextAttribute['text'], style: Omit<ITextAttribute, 'text'>) => this;\n coordinate: (type: CoordinateType, option?: Omit<CoordinateOption, 'type'>) => this;\n // interaction: (type: string, options: boolean | any) => this;\n\n // facet: (type: string, options: any) => this;\n\n ///--------- life cycle ---------///\n\n run: (runningConfig?: IRunningConfig) => this;\n release: () => this;\n parseSpec: (spec: PlotSpec) => this;\n updateSpec: (spec: PlotSpec) => this;\n getImageBuffer: () => Buffer;\n\n ///--------- events api ---------///\n on: (type: string, handler: BaseEventHandler) => this;\n off: (type: string, handler?: BaseEventHandler) => this;\n\n ///--------- marks ---------///\n\n interval: () => IInterval;\n cell: () => ICell;\n area: () => IArea;\n image: () => IImage;\n line: () => ILine;\n ruleX: () => IRuleX;\n ruleY: () => IRectY;\n symbol: () => ISymbol;\n polygon: () => IPolygon;\n text: () => IText;\n rect: () => IRect;\n rectX: () => IRectX;\n rectY: () => IRectY;\n rule: () => IRule;\n\n // wordcloud 包如果没注册,会存在问题\n wordcloud: () => IWordcloud;\n wordcloudShape: () => IWordcloudShape;\n // 需要注册 imagecloud 包\n imagecloud: () => IImagecloud;\n circlePacking: () => ICirclePacking;\n treemap: () => ITreemap;\n tree: () => ITree;\n sunburst: () => ISunburst;\n sankey: () => ISankey;\n\n // P2\n // forceGraph: () => ISemanticMark;\n // geoPath: () => ISemanticMark;\n // vector: () => ISemanticMark;\n // shape: () => ISemanticMark;\n // gauge: () => ISemanticMark;\n // heatmap: () => ISemanticMark;\n // density: () => ISemanticMark;\n // boxplot: () => ISemanticMark;\n // box: () => ISemanticMark;\n // contour: () => ISemanticMark;\n\n // observable auto define type by data\n // auto: () => ISemanticMark;\n}\n\nexport interface IPlotConstructor {\n new (options?: IPlotOptions): IPlot;\n}\n\nexport type WithDefaultEncode<T, K extends string> = {\n [Key in K]?: Key extends keyof T ? ISemanticEncodeValue<T[Key]> : ISemanticEncodeValue<string | number>;\n};\nexport type ISemanticEncodeValue<T> = T extends any[]\n ? string[] | ((datum: any) => any)[]\n : string | ((datum: any) => T);\nexport type ISemanticEncodeSpec<T> = {\n [Key in keyof T]?: ISemanticEncodeValue<T[Key]>;\n};\nexport type ISemanticStyle<T, K extends string> = Omit<T, K>;\n\nexport interface SemanticTooltipContentItem {\n key?: ISemanticEncodeValue<string | number>;\n value?: ISemanticEncodeValue<string | number>;\n symbol?: ISemanticEncodeValue<string>;\n}\nexport type SemanticTooltipOption = {\n disableGraphicTooltip?: boolean;\n disableDimensionTooltip?: boolean;\n staticTitle?: string;\n staticContentKey?: string | string[];\n title?: ISemanticEncodeValue<string | number>;\n dimensionTooltipChannel?: 'x' | 'y';\n content?: SemanticTooltipContentItem[];\n};\n\nexport interface SemanticAxisOption extends Partial<AxisBaseAttributes> {\n tickCount?: number;\n}\n\nexport interface SemanticGridOption extends Partial<GridBaseAttributes> {\n type?: GridShape;\n tickCount?: number;\n inside?: boolean;\n baseValue?: number;\n sides?: number;\n}\nexport type SemanticDataZoomOption = Partial<DataZoomAttributes>;\nexport type SemanticSliderOption = Partial<SliderAttributes>;\nexport type SemanticLegendOption = Partial<ColorLegendAttributes | DiscreteLegendAttrs | SizeLegendAttributes>;\nexport type SemanticCrosshairOption = Partial<BaseCrosshairAttrs>;\nexport type SemanticLabelOption = Partial<BaseLabelAttrs>;\nexport type SemanticPlayerOption = Partial<PlayerAttributes>;\nexport type SemanticTitleOption = Partial<TitleAttrs>;\n\nexport interface ISemanticMark<EncodeSpec, K extends string> {\n readonly uid: number;\n readonly type: string;\n data: (values: any, transform?: TransformSpec[], id?: string) => this;\n style: (style: Partial<EncodeSpec & any>) => this;\n encode: (channel: K, option: ValueOf<WithDefaultEncode<EncodeSpec, K>, K>) => this;\n scale: (channel: K, option: Partial<ScaleSpec>) => this;\n transform: (option: TransformSpec[]) => this;\n animate: (state: string, option: IAnimationConfig | IAnimationConfig[]) => this;\n state: (state: string, option: Partial<EncodeSpec>) => this;\n\n axis: (channel: string, option?: SemanticAxisOption | boolean, layout?: MarkRelativeItemSpec) => this;\n legend: (channel: string, option?: SemanticLegendOption | boolean, layout?: MarkRelativeItemSpec) => this;\n crosshair: (channel: string, option?: SemanticCrosshairOption | boolean) => this;\n tooltip: (option: SemanticTooltipOption | boolean) => this;\n coordinate: (option: CoordinateOption) => this;\n grid: (channel: string, option?: SemanticGridOption | boolean) => this;\n title: (option: SemanticTitleOption, layout?: MarkRelativeItemSpec) => this;\n\n slider: (channel: string, option?: SemanticSliderOption | boolean, layout?: MarkRelativeItemSpec) => this;\n datazoom: (channel: string, option?: SemanticDataZoomOption | boolean, layout?: MarkRelativeItemSpec) => this;\n label: (channel: string, option?: SemanticLabelOption | boolean) => this;\n player: (data?: any[], option?: SemanticPlayerOption | boolean, layout?: MarkRelativeItemSpec) => this;\n\n toViewSpec: () => ViewSpec;\n parseSpec: (spec: Partial<ISemanticMarkSpec<EncodeSpec, K>>) => this;\n}\n\nexport interface ISemanticMarkSpec<EncodeSpec, K extends string> {\n id: string | number;\n data?: DataSpec;\n encode?: WithDefaultEncode<EncodeSpec, K>;\n scale?: Partial<Record<K, ScaleSpec>>;\n style?: Partial<EncodeSpec & any>;\n axis?: Partial<\n Record<K, { option?: SemanticAxisOption | boolean; layout?: MarkRelativeItemSpec } | SemanticAxisOption | boolean>\n >;\n grid?: Partial<Record<K, SemanticGridOption | boolean>>;\n transform?: TransformSpec[];\n state?: Record<string, Partial<EncodeSpec>>;\n animation?: Record<string, IAnimationConfig | IAnimationConfig[]>;\n legend?: Record<\n string,\n { option: SemanticLegendOption | boolean; layout?: MarkRelativeItemSpec } | SemanticLegendOption | boolean\n >;\n crosshair?: Record<string, SemanticCrosshairOption | boolean>;\n tooltip?: SemanticTooltipOption | boolean;\n slider?: Record<\n string,\n { option: SemanticSliderOption | boolean; layout?: MarkRelativeItemSpec } | SemanticSliderOption | boolean\n >;\n datazoom?: Record<\n string,\n { option: SemanticDataZoomOption | boolean; layout?: MarkRelativeItemSpec } | SemanticDataZoomOption | boolean\n >;\n label?: Record<string, SemanticLabelOption | boolean>;\n player?: { data?: any[]; option?: SemanticPlayerOption | boolean; layout?: MarkRelativeItemSpec };\n title?: { option?: SemanticTitleOption; layout?: MarkRelativeItemSpec } | SemanticTitleOption;\n}\n\nexport type ParsedSimpleEncode<T, K extends string> = {\n [Key in K]?: {\n field: Key extends keyof T ? ISemanticEncodeValue<T[Key]> : ISemanticEncodeValue<string>;\n scale: string;\n };\n};\n\nexport type SemanticEncodeChannels = 'x' | 'y' | 'group' | 'color';\nexport type IntervalEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type CellEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type LineEncodeChannels = 'x' | 'y' | 'group' | 'color';\nexport type AreaEncodeChannels = 'x' | 'y' | 'group' | 'color' | 'stroke';\nexport type RuleXEncodeChannels = 'x' | 'x' | 'color' | 'group';\nexport type RuleYEncodeChannels = 'x' | 'y' | 'color' | 'group';\nexport type SymbolEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'size' | 'shape' | 'stroke';\nexport type TextEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'text' | 'stroke';\nexport type RectEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'stroke';\nexport type RectXEncodeChannels = 'x' | 'color' | 'group' | 'stroke';\nexport type RectYEncodeChannels = 'y' | 'color' | 'group' | 'stroke';\nexport type PolygonEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'stroke';\nexport type RuleEncodeChannels = 'x' | 'y' | 'color' | 'group';\nexport type ImageEncodeChannels = 'x' | 'y' | 'color' | 'group' | 'src' | 'stroke';\nexport type PathEncodeChannels = 'color' | 'stroke';\nexport type SankeyEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type SunburstEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type TreeEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type TreemapEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type CirclepackingEncodeChannels = 'node' | 'value' | 'color' | 'stroke';\nexport type WordcloudEncodeChannels = 'text' | 'color' | 'stroke';\nexport type WordcloudShapeEncodeChannels = 'text' | 'color' | 'stroke';\nexport type ImagecloudShapeEncodeChannels = 'image' | 'weight';\n\nexport type IInterval = ISemanticMark<PlotIntervalEncoderSpec, IntervalEncodeChannels>;\nexport type ILine = ISemanticMark<BasicEncoderSpecMap['line'], LineEncodeChannels>;\nexport type ICell = ISemanticMark<BasicEncoderSpecMap['cell'], CellEncodeChannels>;\nexport type IRuleX = ISemanticMark<BasicEncoderSpecMap['rule'], RuleXEncodeChannels>;\nexport type IRuleY = ISemanticMark<BasicEncoderSpecMap['rule'], RuleYEncodeChannels>;\nexport type IArea = ISemanticMark<PlotAreaEncoderSpec, AreaEncodeChannels>;\nexport type ISymbol = ISemanticMark<BasicEncoderSpecMap['symbol'], SymbolEncodeChannels>;\nexport type IText = ISemanticMark<BasicEncoderSpecMap['text'], TextEncodeChannels>;\nexport type IRect = ISemanticMark<PlotRectEncoderSpec, RectEncodeChannels>;\nexport type IRectX = ISemanticMark<BasicEncoderSpecMap['rect'], RectXEncodeChannels>;\nexport type IRectY = ISemanticMark<BasicEncoderSpecMap['rect'], RectYEncodeChannels>;\nexport type IPolygon = ISemanticMark<PlotPolygonEncoderSpec, PolygonEncodeChannels>;\nexport type IRule = ISemanticMark<BasicEncoderSpecMap['rule'], RuleEncodeChannels>;\nexport type IImage = ISemanticMark<PlotImageEncoderSpec, ImageEncodeChannels>;\nexport type IPath = ISemanticMark<BasicEncoderSpecMap['path'], PathEncodeChannels>;\nexport type ISankey = ISemanticMark<PlotSankeyEncoderSpec, SankeyEncodeChannels>;\nexport type ISunburst = ISemanticMark<PlotSunburstEncodeSpec, SunburstEncodeChannels>;\nexport type IWordcloud = ISemanticMark<PlotWordcloudEncodeSpec, WordcloudEncodeChannels>;\nexport type IWordcloudShape = ISemanticMark<PlotWordcloudShapeEncodeSpec, WordcloudShapeEncodeChannels>;\nexport type ITree = ISemanticMark<PlotTreeEncodeSpec, TreeEncodeChannels>;\nexport type ITreemap = ISemanticMark<PlotTreemapEncodeSpec, TreemapEncodeChannels>;\nexport type ICirclePacking = ISemanticMark<PlotCirclePackingEncodeSpec, CirclepackingEncodeChannels>;\nexport type IImagecloud = ISemanticMark<PlotImagecloudEncodeSpec, ImagecloudShapeEncodeChannels>;\n\nexport type PlotMark =\n | IInterval\n | IRuleX\n | IRuleY\n | ICell\n | ILine\n | IArea\n | ISymbol\n | IText\n | IRect\n | IRectX\n | IRectY\n | IPolygon\n | IRule\n | IImage\n | IPath\n | ISankey\n | ISunburst\n | ICirclePacking\n | ITreemap\n | ITree\n | IWordcloud\n | IWordcloudShape;\n\nexport interface IPlotMarkConstructor {\n readonly type: string;\n\n new (id?: string): PlotMark;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@visactor/vgrammar-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0-alpha.0",
|
|
4
4
|
"description": "VGrammar is a visual grammar library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"grammar",
|
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@visactor/vutils": "~0.19.4",
|
|
28
28
|
"@visactor/vdataset": "~0.19.4",
|
|
29
|
-
"@visactor/vgrammar-coordinate": "0.
|
|
30
|
-
"@visactor/vgrammar-util": "0.
|
|
29
|
+
"@visactor/vgrammar-coordinate": "1.0.0-alpha.0",
|
|
30
|
+
"@visactor/vgrammar-util": "1.0.0-alpha.0",
|
|
31
31
|
"@visactor/vscale": "~0.19.4",
|
|
32
32
|
"@visactor/vrender-core": "0.22.4",
|
|
33
33
|
"@visactor/vrender-kits": "0.22.4",
|
|
@@ -44,10 +44,10 @@
|
|
|
44
44
|
"ts-jest": "~29.1.0",
|
|
45
45
|
"@types/jest": "~29.5.0",
|
|
46
46
|
"typescript": "4.9.5",
|
|
47
|
-
"@internal/eslint-config": "0.0.1",
|
|
48
47
|
"@internal/jest-config": "0.0.1",
|
|
48
|
+
"@internal/bundler": "0.0.1",
|
|
49
49
|
"@internal/ts-config": "0.0.1",
|
|
50
|
-
"@internal/
|
|
50
|
+
"@internal/eslint-config": "0.0.1"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public",
|