@visactor/vgrammar-core 0.8.1 → 0.8.2

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.
Files changed (209) hide show
  1. package/cjs/component/axis.js +9 -9
  2. package/cjs/component/axis.js.map +1 -1
  3. package/cjs/component/datazoom.js +5 -5
  4. package/cjs/component/datazoom.js.map +1 -1
  5. package/cjs/component/grid.js +18 -18
  6. package/cjs/component/grid.js.map +1 -1
  7. package/cjs/component/label.js +16 -16
  8. package/cjs/component/label.js.map +1 -1
  9. package/cjs/component/legend.js +13 -13
  10. package/cjs/component/legend.js.map +1 -1
  11. package/cjs/component/scrollbar.js +7 -7
  12. package/cjs/component/scrollbar.js.map +1 -1
  13. package/cjs/component/slider.js +5 -5
  14. package/cjs/component/slider.js.map +1 -1
  15. package/cjs/component/title.js +5 -5
  16. package/cjs/component/title.js.map +1 -1
  17. package/cjs/core/factory.d.ts +5 -1
  18. package/cjs/core/factory.js +13 -3
  19. package/cjs/core/factory.js.map +1 -1
  20. package/cjs/graph/animation/animation/move.js +10 -8
  21. package/cjs/graph/animation/animation/move.js.map +1 -1
  22. package/cjs/graph/attributes/common.js +2 -10
  23. package/cjs/graph/attributes/common.js.map +1 -1
  24. package/cjs/graph/attributes/helpers.d.ts +2 -2
  25. package/cjs/graph/attributes/helpers.js +50 -17
  26. package/cjs/graph/attributes/helpers.js.map +1 -1
  27. package/cjs/graph/attributes/index.d.ts +4 -10
  28. package/cjs/graph/attributes/index.js +16 -251
  29. package/cjs/graph/attributes/index.js.map +1 -1
  30. package/cjs/graph/attributes/line.d.ts +3 -0
  31. package/cjs/graph/attributes/line.js +46 -0
  32. package/cjs/graph/attributes/line.js.map +1 -0
  33. package/cjs/graph/attributes/transform.d.ts +5 -0
  34. package/cjs/graph/attributes/transform.js +167 -0
  35. package/cjs/graph/attributes/transform.js.map +1 -0
  36. package/cjs/graph/canvas-renderer.js +1 -1
  37. package/cjs/graph/canvas-renderer.js.map +1 -1
  38. package/cjs/graph/constants.d.ts +0 -1
  39. package/cjs/graph/constants.js +2 -3
  40. package/cjs/graph/constants.js.map +1 -1
  41. package/cjs/graph/element.js +5 -5
  42. package/cjs/graph/element.js.map +1 -1
  43. package/cjs/graph/glyph-element.js +4 -4
  44. package/cjs/graph/glyph-element.js.map +1 -1
  45. package/cjs/graph/layout/relative.js.map +1 -1
  46. package/cjs/graph/mark/encode.js +4 -4
  47. package/cjs/graph/mark/encode.js.map +1 -1
  48. package/cjs/index.d.ts +3 -1
  49. package/cjs/index.js +3 -2
  50. package/cjs/index.js.map +1 -1
  51. package/cjs/interactions/base.js.map +1 -1
  52. package/cjs/interactions/brush-base.js +2 -2
  53. package/cjs/interactions/brush-base.js.map +1 -1
  54. package/cjs/interactions/brush-filter.js +2 -2
  55. package/cjs/interactions/brush-filter.js.map +1 -1
  56. package/cjs/interactions/crosshair.d.ts +1 -1
  57. package/cjs/interactions/crosshair.js +15 -15
  58. package/cjs/interactions/crosshair.js.map +1 -1
  59. package/cjs/interactions/datazoom-filter.js +3 -3
  60. package/cjs/interactions/datazoom-filter.js.map +1 -1
  61. package/cjs/interactions/drill-down.js +2 -2
  62. package/cjs/interactions/drill-down.js.map +1 -1
  63. package/cjs/interactions/legend-filter.js +3 -3
  64. package/cjs/interactions/legend-filter.js.map +1 -1
  65. package/cjs/interactions/player-filter.js +3 -3
  66. package/cjs/interactions/player-filter.js.map +1 -1
  67. package/cjs/interactions/roll-up.js +2 -2
  68. package/cjs/interactions/roll-up.js.map +1 -1
  69. package/cjs/interactions/scrollbar-filter.js +3 -3
  70. package/cjs/interactions/scrollbar-filter.js.map +1 -1
  71. package/cjs/interactions/slider-filter.js +3 -3
  72. package/cjs/interactions/slider-filter.js.map +1 -1
  73. package/cjs/parse/view.js +1 -1
  74. package/cjs/parse/view.js.map +1 -1
  75. package/cjs/semantic-marks/cell.d.ts +3 -1
  76. package/cjs/semantic-marks/cell.js +10 -4
  77. package/cjs/semantic-marks/cell.js.map +1 -1
  78. package/cjs/semantic-marks/interval.d.ts +2 -0
  79. package/cjs/semantic-marks/interval.js +10 -4
  80. package/cjs/semantic-marks/interval.js.map +1 -1
  81. package/cjs/semantic-marks/text.d.ts +1 -0
  82. package/cjs/semantic-marks/text.js +3 -3
  83. package/cjs/semantic-marks/text.js.map +1 -1
  84. package/cjs/types/animate.d.ts +5 -1
  85. package/cjs/types/animate.js.map +1 -1
  86. package/cjs/types/grammar.d.ts +1 -1
  87. package/cjs/types/grammar.js.map +1 -1
  88. package/cjs/types/mark.d.ts +5 -1
  89. package/cjs/types/mark.js.map +1 -1
  90. package/cjs/types/view.d.ts +1 -0
  91. package/cjs/types/view.js.map +1 -1
  92. package/cjs/view/View.d.ts +0 -1
  93. package/cjs/view/View.js +15 -25
  94. package/cjs/view/View.js.map +1 -1
  95. package/cjs/view/animate.d.ts +1 -0
  96. package/cjs/view/animate.js +12 -12
  97. package/cjs/view/animate.js.map +1 -1
  98. package/cjs/view/constants.d.ts +0 -3
  99. package/cjs/view/constants.js +2 -3
  100. package/cjs/view/constants.js.map +1 -1
  101. package/cjs/view/grammar-record.js +5 -5
  102. package/cjs/view/grammar-record.js.map +1 -1
  103. package/cjs/view/mark.js +1 -1
  104. package/cjs/view/mark.js.map +1 -1
  105. package/es/component/axis.js +1 -1
  106. package/es/component/axis.js.map +1 -1
  107. package/es/component/datazoom.js +1 -1
  108. package/es/component/datazoom.js.map +1 -1
  109. package/es/component/grid.js +1 -1
  110. package/es/component/grid.js.map +1 -1
  111. package/es/component/label.js +1 -1
  112. package/es/component/label.js.map +1 -1
  113. package/es/component/legend.js +1 -1
  114. package/es/component/legend.js.map +1 -1
  115. package/es/component/scrollbar.js +1 -1
  116. package/es/component/scrollbar.js.map +1 -1
  117. package/es/component/slider.js +1 -1
  118. package/es/component/slider.js.map +1 -1
  119. package/es/component/title.js +1 -1
  120. package/es/component/title.js.map +1 -1
  121. package/es/core/factory.d.ts +5 -1
  122. package/es/core/factory.js +11 -1
  123. package/es/core/factory.js.map +1 -1
  124. package/es/graph/animation/animation/move.js +5 -5
  125. package/es/graph/animation/animation/move.js.map +1 -1
  126. package/es/graph/attributes/common.js +2 -7
  127. package/es/graph/attributes/common.js.map +1 -1
  128. package/es/graph/attributes/helpers.d.ts +2 -2
  129. package/es/graph/attributes/helpers.js +46 -12
  130. package/es/graph/attributes/helpers.js.map +1 -1
  131. package/es/graph/attributes/index.d.ts +4 -10
  132. package/es/graph/attributes/index.js +4 -227
  133. package/es/graph/attributes/index.js.map +1 -1
  134. package/es/graph/attributes/line.d.ts +3 -0
  135. package/es/graph/attributes/line.js +42 -0
  136. package/es/graph/attributes/line.js.map +1 -0
  137. package/es/graph/attributes/transform.d.ts +5 -0
  138. package/es/graph/attributes/transform.js +153 -0
  139. package/es/graph/attributes/transform.js.map +1 -0
  140. package/es/graph/canvas-renderer.js +1 -1
  141. package/es/graph/canvas-renderer.js.map +1 -1
  142. package/es/graph/constants.d.ts +0 -1
  143. package/es/graph/constants.js +0 -2
  144. package/es/graph/constants.js.map +1 -1
  145. package/es/graph/element.js +4 -2
  146. package/es/graph/element.js.map +1 -1
  147. package/es/graph/glyph-element.js +1 -1
  148. package/es/graph/glyph-element.js.map +1 -1
  149. package/es/graph/layout/relative.js.map +1 -1
  150. package/es/graph/mark/encode.js +1 -1
  151. package/es/graph/mark/encode.js.map +1 -1
  152. package/es/index.d.ts +3 -1
  153. package/es/index.js +5 -1
  154. package/es/index.js.map +1 -1
  155. package/es/interactions/base.js.map +1 -1
  156. package/es/interactions/brush-base.js +1 -1
  157. package/es/interactions/brush-base.js.map +1 -1
  158. package/es/interactions/brush-filter.js +1 -1
  159. package/es/interactions/brush-filter.js.map +1 -1
  160. package/es/interactions/crosshair.d.ts +1 -1
  161. package/es/interactions/crosshair.js +1 -1
  162. package/es/interactions/crosshair.js.map +1 -1
  163. package/es/interactions/datazoom-filter.js +1 -1
  164. package/es/interactions/datazoom-filter.js.map +1 -1
  165. package/es/interactions/drill-down.js +1 -1
  166. package/es/interactions/drill-down.js.map +1 -1
  167. package/es/interactions/legend-filter.js +1 -1
  168. package/es/interactions/legend-filter.js.map +1 -1
  169. package/es/interactions/player-filter.js +1 -1
  170. package/es/interactions/player-filter.js.map +1 -1
  171. package/es/interactions/roll-up.js +1 -1
  172. package/es/interactions/roll-up.js.map +1 -1
  173. package/es/interactions/scrollbar-filter.js +1 -1
  174. package/es/interactions/scrollbar-filter.js.map +1 -1
  175. package/es/interactions/slider-filter.js +1 -1
  176. package/es/interactions/slider-filter.js.map +1 -1
  177. package/es/parse/view.js +1 -1
  178. package/es/parse/view.js.map +1 -1
  179. package/es/semantic-marks/cell.d.ts +3 -1
  180. package/es/semantic-marks/cell.js +11 -1
  181. package/es/semantic-marks/cell.js.map +1 -1
  182. package/es/semantic-marks/interval.d.ts +2 -0
  183. package/es/semantic-marks/interval.js +9 -1
  184. package/es/semantic-marks/interval.js.map +1 -1
  185. package/es/semantic-marks/text.d.ts +1 -0
  186. package/es/semantic-marks/text.js +3 -1
  187. package/es/semantic-marks/text.js.map +1 -1
  188. package/es/types/animate.d.ts +5 -1
  189. package/es/types/animate.js.map +1 -1
  190. package/es/types/grammar.d.ts +1 -1
  191. package/es/types/grammar.js.map +1 -1
  192. package/es/types/mark.d.ts +5 -1
  193. package/es/types/mark.js.map +1 -1
  194. package/es/types/view.d.ts +1 -0
  195. package/es/types/view.js.map +1 -1
  196. package/es/view/View.d.ts +0 -1
  197. package/es/view/View.js +13 -27
  198. package/es/view/View.js.map +1 -1
  199. package/es/view/animate.d.ts +1 -0
  200. package/es/view/animate.js +6 -6
  201. package/es/view/animate.js.map +1 -1
  202. package/es/view/constants.d.ts +0 -3
  203. package/es/view/constants.js +0 -6
  204. package/es/view/constants.js.map +1 -1
  205. package/es/view/grammar-record.js +1 -1
  206. package/es/view/grammar-record.js.map +1 -1
  207. package/es/view/mark.js +1 -1
  208. package/es/view/mark.js.map +1 -1
  209. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/grammar.ts"],"names":[],"mappings":"","file":"grammar.js","sourcesContent":["import type { EventEmitter, IBounds, IPointLike } from '@visactor/vutils';\nimport type { IGraphic, IGroup } from '@visactor/vrender-core';\nimport type { IBaseScale, ScaleFishEyeOptions, TickData } from '@visactor/vscale';\nimport type { ITransform, TransformSpec } from './transform';\nimport type { DataFormatSpec, IDataFilter } from './data';\nimport type { ParameterFunctionType, SignalFunctionType } from './signal';\nimport type { IAnimate } from './animate';\nimport type { IGlyphMeta } from './glyph';\nimport type { GrammarTypeEnum } from '../graph/enums';\nimport type { Nil } from './base';\nimport type { CoordinateFunctionType } from './coordinate';\nimport type { IElement } from './element';\nimport type {\n MarkFunctionType,\n MarkAnimationSpec,\n MarkType,\n MarkLayoutSpec,\n MarkLayoutCallback,\n MarkSortSpec,\n MarkKeySpec,\n IMarkConfig,\n ChannelEncodeType,\n AttributeTransform,\n BaseSignleEncodeSpec\n} from './mark';\nimport type { ScaleConfigureSpec, ScaleData, ScaleFunctionType, GrammarScaleType, MultiScaleData } from './scale';\nimport type { IView } from './view';\nimport type { BaseEventHandler } from './event';\nimport type { ICartesianCoordinate, IPolarCoordinate } from '@visactor/vgrammar-coordinate';\n\nexport type BuiltInGrammarType = keyof typeof GrammarTypeEnum;\nexport type GrammarType = BuiltInGrammarType | string;\n\n/** 语法元素内置运行的任务 */\nexport interface IGrammarTask extends ITransform {\n /**\n * 参数依赖\n * 只做一级解析\n */\n options?: Record<string, any | IGrammarBase> | (IGrammarBase | any)[];\n /**\n * 依赖的语法元素\n */\n references?: IGrammarBase[];\n /**\n * 是否只支持简单的options配置,不支持在options引用语法元素\n */\n isRawOptions?: boolean;\n}\n\nexport interface GrammarSpec {\n id?: string;\n dependency?: IGrammarBase[] | IGrammarBase | string[] | string;\n}\n\nexport interface IGrammarBase {\n readonly grammarType: GrammarType;\n readonly view: IView;\n readonly uid: number;\n /**\n * 执行的上游节点\n */\n grammarSource: IGrammarBase;\n /**\n * 影响的下游节点\n */\n targets: IGrammarBase[];\n /**\n * 依赖的上游节点,由于不同 spec 配置项中可能引用同一个节点,需要进行计数\n */\n references: Map<IGrammarBase, number>;\n\n depend: (grammar: IGrammarBase[] | IGrammarBase | string[] | string) => this;\n\n addEventListener: (type: string, handler: BaseEventHandler, options?: any) => this;\n removeEventListener: (type: string, handler: BaseEventHandler) => this;\n\n // extended from EventEmitter\n emit: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n emitGrammarEvent: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n\n tasks?: IGrammarTask[];\n // value?: any;\n /** FIXME: operator执行顺序,改造后,dataflow执行元素,应该抽象出来 */\n rank?: number;\n // todo\n set: (value: any) => boolean;\n id: (() => string) & ((id: string) => this);\n name: (() => string) & ((name: string) => this);\n attach: (reference: IGrammarBase | IGrammarBase[], count?: number) => this;\n detach: (reference: IGrammarBase | IGrammarBase[], count?: number) => this;\n detachAll: () => void;\n commit: () => void;\n output: () => any;\n parse: (spec: any) => this;\n parameters: () => { [key: string]: any };\n evaluateSync?: (upstream: any, parameters: any) => this;\n getSpec: () => any;\n reuse: (grammar: IGrammarBase) => this;\n /** clear references */\n clear: () => void;\n /** release all memory storage */\n release: () => void;\n}\n\nexport interface IData extends IGrammarBase {\n values: (values: any | Nil, format?: ParameterFunctionType<DataFormatSpec>, load?: boolean) => this;\n url: (\n url: ParameterFunctionType<string> | Nil,\n format?: ParameterFunctionType<DataFormatSpec>,\n load?: boolean\n ) => this;\n source: (\n source: string | string[] | IData | IData[],\n format?: ParameterFunctionType<DataFormatSpec>,\n load?: boolean\n ) => this;\n transform: (transform: TransformSpec[] | Nil) => this;\n\n // only used in VGrammar\n addDataFilter: (filter: IDataFilter | IDataFilter[]) => this;\n removeDataFilter: (filter: IDataFilter | IDataFilter[]) => this;\n\n // data util methods\n field: (field: string) => any[];\n getValue: () => any[];\n getInput: () => any[];\n getDataIDKey: () => string;\n}\n\n/** 语法元素,TODO */\nexport interface ISignal<T> extends IGrammarBase {\n value: (value: T | Nil) => this;\n update: (update: SignalFunctionType<T> | Nil) => this;\n\n getValue: () => T;\n}\n\n/** 语法元素,TODO */\nexport interface IScale extends IGrammarBase {\n domain: (domain: ScaleFunctionType<any[]> | ScaleData | MultiScaleData | Nil) => this;\n range: (range: ScaleFunctionType<any[]> | ScaleData | MultiScaleData | Nil) => this;\n configure: (config: ScaleConfigureSpec | Nil) => this;\n\n // only used in VGrammar\n getRangeFactor: () => [number, number] | Nil;\n setRangeFactor: (range?: [number, number]) => this;\n getFishEye: () => ScaleFishEyeOptions | Nil;\n setFishEye: (option?: ScaleFishEyeOptions) => this;\n\n // scale util methods\n getScaleType: () => GrammarScaleType;\n getScale: () => IBaseScale;\n ticks: (count?: number) => TickData[];\n getCoordinateAxisPoints: (baseValue?: number) => [IPointLike, IPointLike];\n getCoordinate: () => IPolarCoordinate | ICartesianCoordinate;\n getCoordinateAxisPosition: () => 'top' | 'bottom' | 'left' | 'right' | 'inside' | 'outside' | 'start' | 'end';\n}\n\nexport interface ICoordinate extends IGrammarBase {\n start: (start: CoordinateFunctionType<[number, number]> | Nil) => this;\n end: (end: CoordinateFunctionType<[number, number]> | Nil) => this;\n origin: (origin: CoordinateFunctionType<[number, number]> | Nil) => this;\n\n translate: (offset: CoordinateFunctionType<[number, number]> | Nil) => this;\n rotate: (angle: CoordinateFunctionType<number> | Nil) => this;\n scale: (ratio: CoordinateFunctionType<[number, number]> | Nil) => this;\n transpose: (isTransposed: CoordinateFunctionType<boolean> | Nil) => this;\n\n // coordinate util methods\n}\n\n/** 语法元素,TODO */\n\n/** group mark */\nexport interface IGroupMark extends IMark {\n children: (IMark | IGroupMark | IGlyphMark)[];\n\n layoutChildren?: (IMark | IGroupMark | IGlyphMark)[];\n\n appendChild: (mark: IMark | IGroupMark | IGlyphMark) => this;\n removeChild: (mark: IMark | IGroupMark | IGlyphMark) => this;\n includesChild: (mark: IMark, descendant?: boolean) => boolean;\n\n updateLayoutChildren: () => this;\n}\n\nexport interface IGlyphMark extends IMark {\n glyphType: string;\n getGlyphMeta: () => IGlyphMeta;\n configureGlyph: (config: any) => this;\n getGlyphConfig: () => any;\n}\n\nexport interface IComponent extends IMark {\n componentType: string;\n configureComponent: (config: any) => this;\n}\n\nexport interface IProgressiveGrammar {\n /** 是否启动了增量渲染模式 */\n isProgressive: () => boolean;\n /** 是否正在执行增量渲染 */\n isDoingProgressive: () => boolean;\n /** 清除增量渲染相关状态 */\n clearProgressive: () => void;\n /** 从第一帧开始增量计算 */\n restartProgressive: () => void;\n /** 分片执行 */\n evaluateProgressive: () => void;\n}\n\nexport interface IMark extends IGrammarBase, IProgressiveGrammar {\n group?: IGroupMark;\n\n markType: MarkType;\n context: any;\n coord: ICoordinate;\n /**\n * disable coordinate transform when need\n */\n disableCoordinateTransform?: boolean;\n elements: IElement[];\n elementMap: Map<string, IElement>;\n graphicIndex: number;\n graphicItem?: IGroup;\n animate: IAnimate;\n\n join: (\n data: IData | string | Nil,\n key?: MarkKeySpec,\n sort?: MarkSortSpec,\n groupBy?: MarkKeySpec,\n groupSort?: MarkSortSpec\n ) => this;\n coordinate: (coordinate: ICoordinate | string | Nil) => this;\n state: (state: MarkFunctionType<string | string[]> | Nil) => this;\n encode: ((encoders: BaseSignleEncodeSpec) => this) & ((channel: string, value: ChannelEncodeType) => this);\n encodeState: ((state: string, channel: string, value: ChannelEncodeType) => this) &\n ((state: string, encoders: BaseSignleEncodeSpec) => this);\n animation: (animationConfig: MarkAnimationSpec | Nil) => this;\n animationState: (animationState: MarkFunctionType<string> | Nil) => this;\n layout: (layout: MarkLayoutSpec | MarkLayoutCallback | Nil) => this;\n configure: (config: IMarkConfig | Nil) => this;\n transform: (transform: TransformSpec[] | Nil) => this;\n\n needAnimate: () => boolean;\n getBounds: () => IBounds;\n isCollectionMark: () => boolean;\n getAllElements: () => IElement[];\n\n // position: () => this;\n // color: () => this;\n // shape: () => this;\n\n // mark 执行流程相关接口\n\n isUpdated: boolean;\n getGroupGraphicItem: () => any;\n cleanExitElements: () => void;\n addGraphicItem: (attrs: any, groupKey?: string) => IGraphic;\n getMorphConfig: () => { morph: boolean; morphKey: string | undefined; morphElementKey: string | undefined };\n prepareRelease: () => void;\n\n layoutBounds?: IBounds;\n relativePosition?: { top?: number; bottom?: number; left?: number; right?: number };\n needLayout: () => boolean;\n handleLayoutEnd: () => void;\n handleRenderEnd: () => void;\n isLargeMode: () => boolean;\n getAttributeTransforms: () => AttributeTransform[];\n\n getScalesByChannel: () => Record<string, IBaseScale> | undefined;\n getFieldsByChannel: () => Record<string, string> | undefined;\n getScales: () => Record<string, IBaseScale> | undefined;\n}\n\nexport interface IGrammarBaseConstructor {\n new (view: IView): IGrammarBase;\n}\n\nexport interface ProgressiveContext {\n currentIndex: number;\n totalStep: number;\n step: number;\n data: any[];\n groupKeys?: string[];\n groupedData?: Map<string, any[]>;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/grammar.ts"],"names":[],"mappings":"","file":"grammar.js","sourcesContent":["import type { EventEmitter, IBounds, IPointLike } from '@visactor/vutils';\nimport type { IGraphic, IGroup } from '@visactor/vrender-core';\nimport type { IBaseScale, ScaleFishEyeOptions, TickData } from '@visactor/vscale';\nimport type { ITransform, TransformSpec } from './transform';\nimport type { DataFormatSpec, IDataFilter } from './data';\nimport type { ParameterFunctionType, SignalFunctionType } from './signal';\nimport type { IAnimate } from './animate';\nimport type { IGlyphMeta } from './glyph';\nimport type { GrammarTypeEnum } from '../graph/enums';\nimport type { Nil } from './base';\nimport type { CoordinateFunctionType } from './coordinate';\nimport type { IElement } from './element';\nimport type {\n MarkFunctionType,\n MarkAnimationSpec,\n MarkType,\n MarkLayoutSpec,\n MarkLayoutCallback,\n MarkSortSpec,\n MarkKeySpec,\n IMarkConfig,\n ChannelEncodeType,\n AttributeTransform,\n BaseSignleEncodeSpec\n} from './mark';\nimport type { ScaleConfigureSpec, ScaleData, ScaleFunctionType, GrammarScaleType, MultiScaleData } from './scale';\nimport type { IView } from './view';\nimport type { BaseEventHandler } from './event';\nimport type { ICartesianCoordinate, IPolarCoordinate } from '@visactor/vgrammar-coordinate';\n\nexport type BuiltInGrammarType = keyof typeof GrammarTypeEnum;\nexport type GrammarType = BuiltInGrammarType | string;\n\n/** 语法元素内置运行的任务 */\nexport interface IGrammarTask extends ITransform {\n /**\n * 参数依赖\n * 只做一级解析\n */\n options?: Record<string, any | IGrammarBase> | (IGrammarBase | any)[];\n /**\n * 依赖的语法元素\n */\n references?: IGrammarBase[];\n /**\n * 是否只支持简单的options配置,不支持在options引用语法元素\n */\n isRawOptions?: boolean;\n}\n\nexport interface GrammarSpec {\n id?: string;\n dependency?: IGrammarBase[] | IGrammarBase | string[] | string;\n}\n\nexport interface IGrammarBase {\n readonly grammarType: GrammarType;\n readonly view: IView;\n readonly uid: number;\n /**\n * 执行的上游节点\n */\n grammarSource: IGrammarBase;\n /**\n * 影响的下游节点\n */\n targets: IGrammarBase[];\n /**\n * 依赖的上游节点,由于不同 spec 配置项中可能引用同一个节点,需要进行计数\n */\n references: Map<IGrammarBase, number>;\n\n depend: (grammar: IGrammarBase[] | IGrammarBase | string[] | string) => this;\n\n addEventListener: (type: string, handler: BaseEventHandler, options?: any) => this;\n removeEventListener: (type: string, handler: BaseEventHandler) => this;\n\n // extended from EventEmitter\n emit: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n emitGrammarEvent: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n\n tasks?: IGrammarTask[];\n // value?: any;\n /** FIXME: operator执行顺序,改造后,dataflow执行元素,应该抽象出来 */\n rank?: number;\n // todo\n set: (value: any) => boolean;\n id: (() => string) & ((id: string) => this);\n name: (() => string) & ((name: string) => this);\n attach: (reference: IGrammarBase | IGrammarBase[], count?: number) => this;\n detach: (reference: IGrammarBase | IGrammarBase[], count?: number) => this;\n detachAll: () => void;\n commit: () => void;\n output: () => any;\n parse: (spec: any) => this;\n parameters: () => { [key: string]: any };\n evaluateSync?: (upstream: any, parameters: any) => this;\n getSpec: () => any;\n reuse: (grammar: IGrammarBase) => this;\n /** clear references */\n clear: () => void;\n /** release all memory storage */\n release: () => void;\n}\n\nexport interface IData extends IGrammarBase {\n values: (values: any | Nil, format?: ParameterFunctionType<DataFormatSpec>, load?: boolean) => this;\n url: (\n url: ParameterFunctionType<string> | Nil,\n format?: ParameterFunctionType<DataFormatSpec>,\n load?: boolean\n ) => this;\n source: (\n source: string | string[] | IData | IData[],\n format?: ParameterFunctionType<DataFormatSpec>,\n load?: boolean\n ) => this;\n transform: (transform: TransformSpec[] | Nil) => this;\n\n // only used in VGrammar\n addDataFilter: (filter: IDataFilter | IDataFilter[]) => this;\n removeDataFilter: (filter: IDataFilter | IDataFilter[]) => this;\n\n // data util methods\n field: (field: string) => any[];\n getValue: () => any[];\n getInput: () => any[];\n getDataIDKey: () => string;\n}\n\n/** 语法元素,TODO */\nexport interface ISignal<T> extends IGrammarBase {\n value: (value: T | Nil) => this;\n update: (update: SignalFunctionType<T> | Nil) => this;\n\n getValue: () => T;\n}\n\n/** 语法元素,TODO */\nexport interface IScale extends IGrammarBase {\n domain: (domain: ScaleFunctionType<any[]> | ScaleData | MultiScaleData | Nil) => this;\n range: (range: ScaleFunctionType<any[]> | ScaleData | MultiScaleData | Nil) => this;\n configure: (config: ScaleConfigureSpec | Nil) => this;\n\n // only used in VGrammar\n getRangeFactor: () => [number, number] | Nil;\n setRangeFactor: (range?: [number, number]) => this;\n getFishEye: () => ScaleFishEyeOptions | Nil;\n setFishEye: (option?: ScaleFishEyeOptions) => this;\n\n // scale util methods\n getScaleType: () => GrammarScaleType;\n getScale: () => IBaseScale;\n ticks: (count?: number) => TickData[];\n getCoordinateAxisPoints: (baseValue?: number) => [IPointLike, IPointLike];\n getCoordinate: () => IPolarCoordinate | ICartesianCoordinate;\n getCoordinateAxisPosition: () => 'top' | 'bottom' | 'left' | 'right' | 'inside' | 'outside' | 'start' | 'end';\n}\n\nexport interface ICoordinate extends IGrammarBase {\n start: (start: CoordinateFunctionType<[number, number]> | Nil) => this;\n end: (end: CoordinateFunctionType<[number, number]> | Nil) => this;\n origin: (origin: CoordinateFunctionType<[number, number]> | Nil) => this;\n\n translate: (offset: CoordinateFunctionType<[number, number]> | Nil) => this;\n rotate: (angle: CoordinateFunctionType<number> | Nil) => this;\n scale: (ratio: CoordinateFunctionType<[number, number]> | Nil) => this;\n transpose: (isTransposed: CoordinateFunctionType<boolean> | Nil) => this;\n\n // coordinate util methods\n}\n\n/** 语法元素,TODO */\n\n/** group mark */\nexport interface IGroupMark extends IMark {\n children: (IMark | IGroupMark | IGlyphMark)[];\n\n layoutChildren?: (IMark | IGroupMark | IGlyphMark)[];\n\n appendChild: (mark: IMark | IGroupMark | IGlyphMark) => this;\n removeChild: (mark: IMark | IGroupMark | IGlyphMark) => this;\n includesChild: (mark: IMark, descendant?: boolean) => boolean;\n\n updateLayoutChildren: () => this;\n}\n\nexport interface IGlyphMark extends IMark {\n glyphType: string;\n getGlyphMeta: () => IGlyphMeta;\n configureGlyph: (config: any) => this;\n getGlyphConfig: () => any;\n}\n\nexport interface IComponent extends IMark {\n componentType: string;\n configureComponent: (config: any) => this;\n}\n\nexport interface IProgressiveGrammar {\n /** 是否启动了增量渲染模式 */\n isProgressive: () => boolean;\n /** 是否正在执行增量渲染 */\n isDoingProgressive: () => boolean;\n /** 清除增量渲染相关状态 */\n clearProgressive: () => void;\n /** 从第一帧开始增量计算 */\n restartProgressive: () => void;\n /** 分片执行 */\n evaluateProgressive: () => void;\n}\n\nexport interface IMark extends IGrammarBase, IProgressiveGrammar {\n group?: IGroupMark;\n\n markType: MarkType;\n context: any;\n coord: ICoordinate;\n /**\n * disable coordinate transform when need\n */\n disableCoordinateTransform?: boolean;\n elements: IElement[];\n elementMap: Map<string, IElement>;\n graphicIndex: number;\n graphicItem?: IGroup;\n animate?: IAnimate;\n\n join: (\n data: IData | string | Nil,\n key?: MarkKeySpec,\n sort?: MarkSortSpec,\n groupBy?: MarkKeySpec,\n groupSort?: MarkSortSpec\n ) => this;\n coordinate: (coordinate: ICoordinate | string | Nil) => this;\n state: (state: MarkFunctionType<string | string[]> | Nil) => this;\n encode: ((encoders: BaseSignleEncodeSpec) => this) & ((channel: string, value: ChannelEncodeType) => this);\n encodeState: ((state: string, channel: string, value: ChannelEncodeType) => this) &\n ((state: string, encoders: BaseSignleEncodeSpec) => this);\n animation: (animationConfig: MarkAnimationSpec | Nil) => this;\n animationState: (animationState: MarkFunctionType<string> | Nil) => this;\n layout: (layout: MarkLayoutSpec | MarkLayoutCallback | Nil) => this;\n configure: (config: IMarkConfig | Nil) => this;\n transform: (transform: TransformSpec[] | Nil) => this;\n\n needAnimate: () => boolean;\n getBounds: () => IBounds;\n isCollectionMark: () => boolean;\n getAllElements: () => IElement[];\n\n // position: () => this;\n // color: () => this;\n // shape: () => this;\n\n // mark 执行流程相关接口\n\n isUpdated: boolean;\n getGroupGraphicItem: () => any;\n cleanExitElements: () => void;\n addGraphicItem: (attrs: any, groupKey?: string) => IGraphic;\n getMorphConfig: () => { morph: boolean; morphKey: string | undefined; morphElementKey: string | undefined };\n prepareRelease: () => void;\n\n layoutBounds?: IBounds;\n relativePosition?: { top?: number; bottom?: number; left?: number; right?: number };\n needLayout: () => boolean;\n handleLayoutEnd: () => void;\n handleRenderEnd: () => void;\n isLargeMode: () => boolean;\n getAttributeTransforms: () => AttributeTransform[];\n\n getScalesByChannel: () => Record<string, IBaseScale> | undefined;\n getFieldsByChannel: () => Record<string, string> | undefined;\n getScales: () => Record<string, IBaseScale> | undefined;\n}\n\nexport interface IGrammarBaseConstructor {\n new (view: IView): IGrammarBase;\n}\n\nexport interface ProgressiveContext {\n currentIndex: number;\n totalStep: number;\n step: number;\n data: any[];\n groupKeys?: string[];\n groupedData?: Map<string, any[]>;\n}\n"]}
@@ -6,7 +6,7 @@ import type { IMark, IScale, IGroupMark, ICoordinate, GrammarSpec, IData } from
6
6
  import type { GenericFunctionType } from './signal';
7
7
  import type { TransformSpec } from './transform';
8
8
  import type { CommonPaddingSpec } from './base';
9
- import type { ILayoutOptions } from './view';
9
+ import type { ILayoutOptions, IView } from './view';
10
10
  import type { AxisSpec, BuiltInComponentSpec, DatazoomSpec, LabelSpec, LegendSpec, PlayerSpec, SliderSpec } from './component';
11
11
  import type { GrammarMarkType } from '../graph/enums';
12
12
  export type MarkFunctionCallback<T> = (datum: any, element: IElement, parameters: any) => T;
@@ -341,3 +341,7 @@ export interface AttributeTransform {
341
341
  transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => void;
342
342
  storedAttrs?: string;
343
343
  }
344
+ export interface IMarkConstructor {
345
+ readonly markType: string;
346
+ new (view: IView, markType: MarkType, group?: IGroupMark): IMark;
347
+ }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/mark.ts"],"names":[],"mappings":"","file":"mark.js","sourcesContent":["import type {\n ICustomPath2D,\n IPyramid3dGraphicAttribute,\n IArc3dGraphicAttribute,\n IRect3dGraphicAttribute,\n ISymbolAttribute,\n IRectGraphicAttribute,\n ILineGraphicAttribute,\n ICircleGraphicAttribute,\n IArcGraphicAttribute,\n IPolygonGraphicAttribute,\n IAreaGraphicAttribute,\n IGlyphGraphicAttribute,\n IImageGraphicAttribute,\n IPathGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute,\n IGraphicAttribute,\n IGroupGraphicAttribute,\n IRichTextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Bounds, IPointLike } from '@visactor/vutils';\nimport type { IAnimationConfig, IStateAnimationConfig } from './animate';\nimport type { IElement } from './element';\nimport type { IMark, IScale, IGroupMark, ICoordinate, GrammarSpec, IData } from './grammar';\nimport type { GenericFunctionType } from './signal';\nimport type { TransformSpec } from './transform';\nimport type { CommonPaddingSpec } from './base';\nimport type { ILayoutOptions } from './view';\nimport type {\n AxisSpec,\n BuiltInComponentSpec,\n DatazoomSpec,\n LabelSpec,\n LegendSpec,\n PlayerSpec,\n SliderSpec\n} from './component';\nimport type { GrammarMarkType } from '../graph/enums';\n\nexport type MarkFunctionCallback<T> = (datum: any, element: IElement, parameters: any) => T;\n\nexport type MarkFunctionType<T> = GenericFunctionType<MarkFunctionCallback<T>, T>;\n\nexport type MarkType = keyof typeof GrammarMarkType | string;\n\nexport interface MarkFromSpec {\n data: string | IData;\n transform?: {\n name: string;\n transform?: TransformSpec[];\n };\n}\n\nexport type MarkStateSpec = MarkFunctionType<string | string[]>;\n\nexport type ScaleEncodeType = {\n scale: IScale | string;\n field?: string | ((datum: any) => any) | string[] | ((datum: any) => any)[];\n value?: any;\n band?: number;\n offset?: number;\n};\n\nexport type FieldEncodeType = {\n field: string | ((datum: any) => any) | string[] | ((datum: any) => any)[];\n};\n\nexport type ChannelEncodeType<T = any> = MarkFunctionType<T> | ScaleEncodeType | FieldEncodeType;\n\nexport type GenerateEncoderSpec<T> = {\n [Key in keyof T]?: ChannelEncodeType<T[Key]>;\n};\n\n/**\n * the common channel supported by graphic marks\n */\nexport type GenerateBasicEncoderSpec<T> = Partial<\n Omit<\n T,\n | 'strokeSeg'\n | 'boundsPadding'\n | 'pickMode'\n | 'boundsMode'\n | 'customPickShape'\n | 'pickable'\n | 'childrenPickable'\n | 'visible'\n | 'zIndex'\n | 'layout'\n | 'keepDirIn3d'\n | 'postMatrix'\n | 'anchor'\n | 'anchor3d'\n >\n>;\n\nexport type BasicEncoderSpecMap = {\n rect: GenerateBasicEncoderSpec<IRectGraphicAttribute & { y1?: number; x1?: number }>;\n line: Omit<GenerateBasicEncoderSpec<ILineGraphicAttribute>, 'points' | 'segments'>;\n circle: GenerateBasicEncoderSpec<ICircleGraphicAttribute>;\n arc: GenerateBasicEncoderSpec<IArcGraphicAttribute>;\n polygon: GenerateBasicEncoderSpec<IPolygonGraphicAttribute>;\n arc3d: GenerateBasicEncoderSpec<IArc3dGraphicAttribute>;\n pyramid3d: GenerateBasicEncoderSpec<IPyramid3dGraphicAttribute>;\n area: Omit<GenerateBasicEncoderSpec<IAreaGraphicAttribute>, 'points' | 'segments'>;\n group: GenerateBasicEncoderSpec<IGroupGraphicAttribute>;\n glyph: GenerateBasicEncoderSpec<IGlyphGraphicAttribute & any>;\n image: GenerateBasicEncoderSpec<IImageGraphicAttribute>;\n rect3d: GenerateBasicEncoderSpec<IRect3dGraphicAttribute>;\n path: GenerateBasicEncoderSpec<IPathGraphicAttribute>;\n rule: Omit<GenerateBasicEncoderSpec<ILineGraphicAttribute>, 'points' | 'segments'> & { x1?: number; y1?: number };\n shape: GenerateBasicEncoderSpec<IPathGraphicAttribute>;\n symbol: GenerateBasicEncoderSpec<ISymbolGraphicAttribute> & {\n shape?: ISymbolGraphicAttribute['symbolType'];\n image?: ISymbolGraphicAttribute['background'];\n };\n text: GenerateBasicEncoderSpec<ITextGraphicAttribute> & {\n limit?: number;\n autoLimit?: number;\n };\n richtext: GenerateBasicEncoderSpec<IRichTextGraphicAttribute>;\n interval: Omit<GenerateBasicEncoderSpec<IRectGraphicAttribute>, 'width' | 'height'> & {\n /**\n * the gap for two graphic elements\n */\n innerGap?: number | string;\n /**\n * only used for rect / interval mark\n */\n maxWidth?: number;\n minWidth?: number;\n /** the gap between two category */\n categoryGap?: number | string;\n };\n cell: GenerateBasicEncoderSpec<ISymbolGraphicAttribute> & {\n padding?: number | [number, number];\n shape?: ISymbolAttribute['symbolType'];\n };\n};\nexport type GenerateBaseEncodeSpec<BasicSpec = GenerateBasicEncoderSpec<IGraphicAttribute>> =\n | GenerateEncoderSpec<BasicSpec>\n | MarkFunctionCallback<BasicSpec>;\n\nexport type StateProxyEncodeSpec<T = any> = (datum: any, element: IElement, state: string, nextStates: string[]) => T;\n\nexport type StateEncodeSpec<BasicSpec = GenerateBasicEncoderSpec<IGraphicAttribute>> =\n | {\n enter?: GenerateBaseEncodeSpec<BasicSpec>;\n update?: GenerateBaseEncodeSpec<BasicSpec>;\n exit?: GenerateBaseEncodeSpec<BasicSpec>;\n }\n | {\n [state: string]: GenerateEncoderSpec<BasicSpec> | StateProxyEncodeSpec<BasicSpec>;\n };\n\nexport type MarkAnimationSpec = Record<string, IAnimationConfig | IAnimationConfig[]> & {\n state?: IStateAnimationConfig;\n};\n\n// TODO: support string[]\nexport type MarkKeySpec = string | ((datum: any) => string);\n\nexport type MarkSortSpec = (datumA: any, datumB: any) => number;\n\nexport type MarkStateSortSpec = (stateA: string, stateB: string) => number;\n\nexport interface MarkGridContainerSpec extends MarkBaseLayoutSpec {\n display: 'grid';\n gridTemplateRows?: (number | string | 'auto')[];\n gridTemplateColumns?: (number | string | 'auto')[];\n gridRowGap?: number;\n gridColumnGap?: number;\n}\n\nexport interface MarkGridItemSpec extends MarkBaseLayoutSpec {\n gridRowStart?: number;\n gridRowEnd?: number;\n gridColumnStart?: number;\n gridColumnEnd?: number;\n}\n\nexport interface MarkBaseLayoutSpec {\n callback?: MarkLayoutCallback;\n skipBeforeLayouted?: boolean;\n updateViewSignals?: boolean;\n}\n\nexport interface MarkRelativeItemSpec extends MarkBaseLayoutSpec {\n position?: 'top' | 'bottom' | 'left' | 'right' | 'content' | 'auto' | string;\n padding?: CommonPaddingSpec;\n align?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n order?: number;\n}\n\nexport interface MarkRelativeContainerSpec extends MarkBaseLayoutSpec {\n display: 'relative';\n maxChildWidth?: string | number;\n maxChildHeight?: string | number;\n}\n\nexport type MarkLayoutSpec =\n | MarkGridContainerSpec\n | MarkGridItemSpec\n | MarkRelativeContainerSpec\n | MarkRelativeItemSpec;\n\nexport type MarkLayoutCallback = (\n group: IGroupMark,\n children: IMark[],\n parentLayoutBounds: Bounds,\n options?: ILayoutOptions\n) => void;\n\nexport interface IMarkConfig {\n clip?: boolean;\n zIndex?: number;\n interactive?: boolean;\n context?: any;\n /**\n * set customized shape\n */\n setCustomizedShape?: (datum: any[], attrs: any, path: ICustomPath2D) => ICustomPath2D;\n /** 是否开启大数据渲染模式 */\n large?: boolean;\n /** 开启大数据渲染优化的阀值,对应的是data的长度 */\n largeThreshold?: number;\n /** 分片长度 */\n progressiveStep?: number;\n /** 开启分片渲染的阀值,对应的是单系列data的长度 */\n progressiveThreshold?: number;\n /**\n * use 'sequential' for symbol chart\n * use 'mod' for bar/line chart\n */\n // largeChunkMode?: 'sequential' | 'mod';\n support3d?: boolean;\n /**\n * enable global morphing animation of the mark\n */\n morph?: boolean;\n /**\n * this key will be used to match the mark to morph\n */\n morphKey?: string;\n /**\n * this key will be used to match the element of two marks to morph\n * If not specified, we'll use the \"key\" of the mark by default\n */\n morphElementKey?: string;\n /** transforms of attributes */\n attributeTransforms?: AttributeTransform[];\n}\n\n/**\n * Base mark specification type\n */\nexport interface GenerateMarkSpec<T extends MarkType = string, P = any> extends IMarkConfig, GrammarSpec {\n type: T;\n name?: string;\n group?: string | IGroupMark;\n // data attributes\n from?: MarkFromSpec;\n key?: MarkKeySpec;\n /**\n * sort all the elements in the mark\n */\n sort?: MarkSortSpec;\n /**\n * set the group key of the mark\n */\n groupBy?: MarkKeySpec;\n /**\n * sort the data of each group\n */\n groupSort?: MarkSortSpec;\n context?: any;\n // coordinate attributes\n coordinate?: string | ICoordinate;\n // encode attributes\n state?: MarkStateSpec;\n stateSort?: MarkStateSortSpec;\n encode?: GetEncoderSpecByType<T, P>;\n // animation attributes\n animationState?: MarkFunctionType<string>;\n animation?: MarkAnimationSpec;\n transform?: TransformSpec[];\n layout?: MarkLayoutSpec | MarkLayoutCallback;\n}\n\nexport type CircleMarkSpec = GenerateMarkSpec<'circle'>;\nexport type ArcMarkSpec = GenerateMarkSpec<'arc'>;\nexport type AreaMarkSpec = GenerateMarkSpec<'area'>;\nexport type LineMarkSpec = GenerateMarkSpec<'line'>;\nexport type RectMarkSpec = GenerateMarkSpec<'rect'>;\nexport type ImageMarkSpec = GenerateMarkSpec<'image'>;\nexport type PathMarkSpec = GenerateMarkSpec<'path'>;\nexport type RuleMarkSpec = GenerateMarkSpec<'rule'>;\nexport type ShapeMarkSpec = GenerateMarkSpec<'shape'>;\nexport type SymbolMarkSpec = GenerateMarkSpec<'symbol'>;\nexport type TextMarkSpec = GenerateMarkSpec<'text'>;\nexport type RichTextMarkSpec = GenerateMarkSpec<'richtext'>;\nexport type PolygonMarkSpec = GenerateMarkSpec<'polygon'>;\nexport type CellMarkSpec = GenerateMarkSpec<'cell'>;\nexport type IntervalMarkSpec = GenerateMarkSpec<'interval'>;\nexport type Arc3dMarkSpec = GenerateMarkSpec<'arc3d'>;\nexport type Pyramid3dMarkSpec = GenerateMarkSpec<'pyramid3d'>;\nexport type Rect3dMarkSpec = GenerateMarkSpec<'rect3d'>;\n\nexport type BasicGlyphEncoderSpec = BasicEncoderSpecMap['glyph'];\nexport type BasicGroupEncoderSpec = BasicEncoderSpecMap['group'];\nexport interface GroupMarkSpec extends GenerateMarkSpec<'group'> {\n marks?: MarkSpec[];\n}\n\nexport interface GlyphMarkSpec<CustomizedEncoderSpec = any> extends GenerateMarkSpec<'glyph', CustomizedEncoderSpec> {\n glyphType: string;\n glyphConfig?: any;\n}\n\nexport interface BoxPlotEncoderSpec extends BasicGlyphEncoderSpec {\n boxWidth?: number;\n boxHeight?: number;\n ruleWidth?: number;\n ruleHeight?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n anchor?: [number, number];\n}\n\nexport interface BarBoxPlotEncoderSpec extends BasicGlyphEncoderSpec {\n minMaxWidth?: number;\n q1q3Width?: number;\n minMaxHeight?: number;\n q1q3Height?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n lineWidth?: number;\n minMaxFillOpacity?: number;\n anchor?: [number, number];\n}\n\nexport interface LinkPathEncoderSpec extends BasicGlyphEncoderSpec {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n thickness: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n ratio?: number;\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n endArrow?: boolean;\n startArrow?: boolean;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\nexport interface TreePathEncoderSpec extends BasicGlyphEncoderSpec {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n startArrowStyle?: Partial<IGraphicAttribute>;\n endArrowStyle?: Partial<IGraphicAttribute>;\n endArrow?: boolean;\n startArrow?: boolean;\n arrowSize?: number;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\n\nexport interface RipplePointEncoderSpec extends BasicGlyphEncoderSpec {\n ripple?: number;\n size?: number;\n}\n\nexport interface ViolinEncoderSpec extends BasicGlyphEncoderSpec {\n violinFill: string;\n violinStroke: string;\n medianFill?: string;\n density?: IPointLike[];\n boxWidth?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n anchor?: [number, number];\n}\n\nexport interface WaveEncoderSpec extends BasicGlyphEncoderSpec {\n wave?: number;\n}\nexport interface BoxPlotGlyphSpec extends GlyphMarkSpec<BoxPlotEncoderSpec> {\n glyphType: 'boxplot';\n}\nexport interface BarBoxPlotGlyphSpec extends GlyphMarkSpec<BarBoxPlotEncoderSpec> {\n glyphType: 'barBoxplot';\n}\nexport interface LinkPathGlyphSpec extends GlyphMarkSpec<LinkPathEncoderSpec> {\n glyphType: 'linkPath';\n}\nexport interface TreePathGlyphSpec extends GlyphMarkSpec<TreePathEncoderSpec> {\n glyphType: 'treePath';\n}\nexport interface RipplePointGlyphSpec extends GlyphMarkSpec<RipplePointEncoderSpec> {\n glyphType: 'ripplePoint';\n}\nexport interface ViolinGlyphSpec extends GlyphMarkSpec<ViolinEncoderSpec> {\n glyphType: 'violin';\n}\nexport interface WaveGlyphSpec extends GlyphMarkSpec<WaveEncoderSpec> {\n glyphType: 'wave';\n}\n\nexport interface ComponentSpec<\n BasicEncoderSpec extends GenerateBasicEncoderSpec<IGraphicAttribute> = GenerateBasicEncoderSpec<IGraphicAttribute>\n> extends GenerateMarkSpec<'component', BasicEncoderSpec> {\n componentType: string;\n componentConfig?: any;\n mode?: '2d' | '3d';\n}\n\nexport type BaseMarkSpec = GenerateMarkSpec<MarkType>;\nexport type MarkSpecMap = {\n circle: CircleMarkSpec;\n arc: ArcMarkSpec;\n area: AreaMarkSpec;\n image: ImageMarkSpec;\n line: LineMarkSpec;\n path: PathMarkSpec;\n rule: RuleMarkSpec;\n shape: ShapeMarkSpec;\n symbol: SymbolMarkSpec;\n text: TextMarkSpec;\n richtext: RichTextMarkSpec;\n polygon: PolygonMarkSpec;\n cell: CellMarkSpec;\n interval: IntervalMarkSpec;\n rect: RectMarkSpec;\n rect3d: Rect3dMarkSpec;\n arc3d: Arc3dMarkSpec;\n pyramid3d: Pyramid3dMarkSpec;\n group: GroupMarkSpec;\n glyph: GlyphMarkSpec;\n linkPath: LinkPathGlyphSpec;\n treePath: TreePathGlyphSpec;\n wave: WaveEncoderSpec;\n ripplePoint: RipplePointGlyphSpec;\n barBoxplot: BarBoxPlotGlyphSpec;\n boxPlot: BoxPlotGlyphSpec;\n component: ComponentSpec;\n axis: AxisSpec;\n legend: LegendSpec;\n slider: SliderSpec;\n datazoom: DatazoomSpec;\n label: LabelSpec;\n player: PlayerSpec;\n};\n\nexport type GetMarkSpecByType<T, P = any> = T extends keyof MarkSpecMap ? MarkSpecMap[T] : GenerateMarkSpec<string, P>;\nexport type GetBasicEncoderSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? BasicEncoderSpecMap[T]\n : GenerateBasicEncoderSpec<IGraphicAttribute & P>;\nexport type GetEncoderSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? StateEncodeSpec<BasicEncoderSpecMap[T]>\n : StateEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute> & P>;\n\nexport type BaseEncodeSpec<P = any> = StateEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>;\nexport type BaseSignleEncodeSpec<P = any> =\n | GenerateEncoderSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>\n | StateProxyEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>;\n\nexport type GetSignleEncodeSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? GenerateEncoderSpec<BasicEncoderSpecMap[T]> | StateProxyEncodeSpec<BasicEncoderSpecMap[T]>\n : BaseSignleEncodeSpec<P>;\n\nexport type MarkSpec =\n | GenerateMarkSpec<string, any>\n | CircleMarkSpec\n | ArcMarkSpec\n | AreaMarkSpec\n | ImageMarkSpec\n | LineMarkSpec\n | PathMarkSpec\n | RuleMarkSpec\n | ShapeMarkSpec\n | SymbolMarkSpec\n | TextMarkSpec\n | RichTextMarkSpec\n | PolygonMarkSpec\n | CellMarkSpec\n | IntervalMarkSpec\n | RectMarkSpec\n | Rect3dMarkSpec\n | Arc3dMarkSpec\n | Pyramid3dMarkSpec\n | GroupMarkSpec\n | GlyphMarkSpec\n | LinkPathGlyphSpec\n | TreePathGlyphSpec\n | WaveGlyphSpec\n | RipplePointGlyphSpec\n | BarBoxPlotGlyphSpec\n | BoxPlotGlyphSpec\n | ViolinGlyphSpec\n | ComponentSpec\n | BuiltInComponentSpec;\n\nexport interface AttributeTransform {\n channels: string[];\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => void;\n storedAttrs?: string;\n}\n"]}
1
+ {"version":3,"sources":["../src/types/mark.ts"],"names":[],"mappings":"","file":"mark.js","sourcesContent":["import type {\n ICustomPath2D,\n IPyramid3dGraphicAttribute,\n IArc3dGraphicAttribute,\n IRect3dGraphicAttribute,\n ISymbolAttribute,\n IRectGraphicAttribute,\n ILineGraphicAttribute,\n ICircleGraphicAttribute,\n IArcGraphicAttribute,\n IPolygonGraphicAttribute,\n IAreaGraphicAttribute,\n IGlyphGraphicAttribute,\n IImageGraphicAttribute,\n IPathGraphicAttribute,\n ISymbolGraphicAttribute,\n ITextGraphicAttribute,\n IGraphicAttribute,\n IGroupGraphicAttribute,\n IRichTextGraphicAttribute\n} from '@visactor/vrender-core';\nimport type { Bounds, IPointLike } from '@visactor/vutils';\nimport type { IAnimationConfig, IStateAnimationConfig } from './animate';\nimport type { IElement } from './element';\nimport type { IMark, IScale, IGroupMark, ICoordinate, GrammarSpec, IData } from './grammar';\nimport type { GenericFunctionType } from './signal';\nimport type { TransformSpec } from './transform';\nimport type { CommonPaddingSpec } from './base';\nimport type { ILayoutOptions, IView } from './view';\nimport type {\n AxisSpec,\n BuiltInComponentSpec,\n DatazoomSpec,\n LabelSpec,\n LegendSpec,\n PlayerSpec,\n SliderSpec\n} from './component';\nimport type { GrammarMarkType } from '../graph/enums';\n\nexport type MarkFunctionCallback<T> = (datum: any, element: IElement, parameters: any) => T;\n\nexport type MarkFunctionType<T> = GenericFunctionType<MarkFunctionCallback<T>, T>;\n\nexport type MarkType = keyof typeof GrammarMarkType | string;\n\nexport interface MarkFromSpec {\n data: string | IData;\n transform?: {\n name: string;\n transform?: TransformSpec[];\n };\n}\n\nexport type MarkStateSpec = MarkFunctionType<string | string[]>;\n\nexport type ScaleEncodeType = {\n scale: IScale | string;\n field?: string | ((datum: any) => any) | string[] | ((datum: any) => any)[];\n value?: any;\n band?: number;\n offset?: number;\n};\n\nexport type FieldEncodeType = {\n field: string | ((datum: any) => any) | string[] | ((datum: any) => any)[];\n};\n\nexport type ChannelEncodeType<T = any> = MarkFunctionType<T> | ScaleEncodeType | FieldEncodeType;\n\nexport type GenerateEncoderSpec<T> = {\n [Key in keyof T]?: ChannelEncodeType<T[Key]>;\n};\n\n/**\n * the common channel supported by graphic marks\n */\nexport type GenerateBasicEncoderSpec<T> = Partial<\n Omit<\n T,\n | 'strokeSeg'\n | 'boundsPadding'\n | 'pickMode'\n | 'boundsMode'\n | 'customPickShape'\n | 'pickable'\n | 'childrenPickable'\n | 'visible'\n | 'zIndex'\n | 'layout'\n | 'keepDirIn3d'\n | 'postMatrix'\n | 'anchor'\n | 'anchor3d'\n >\n>;\n\nexport type BasicEncoderSpecMap = {\n rect: GenerateBasicEncoderSpec<IRectGraphicAttribute & { y1?: number; x1?: number }>;\n line: Omit<GenerateBasicEncoderSpec<ILineGraphicAttribute>, 'points' | 'segments'>;\n circle: GenerateBasicEncoderSpec<ICircleGraphicAttribute>;\n arc: GenerateBasicEncoderSpec<IArcGraphicAttribute>;\n polygon: GenerateBasicEncoderSpec<IPolygonGraphicAttribute>;\n arc3d: GenerateBasicEncoderSpec<IArc3dGraphicAttribute>;\n pyramid3d: GenerateBasicEncoderSpec<IPyramid3dGraphicAttribute>;\n area: Omit<GenerateBasicEncoderSpec<IAreaGraphicAttribute>, 'points' | 'segments'>;\n group: GenerateBasicEncoderSpec<IGroupGraphicAttribute>;\n glyph: GenerateBasicEncoderSpec<IGlyphGraphicAttribute & any>;\n image: GenerateBasicEncoderSpec<IImageGraphicAttribute>;\n rect3d: GenerateBasicEncoderSpec<IRect3dGraphicAttribute>;\n path: GenerateBasicEncoderSpec<IPathGraphicAttribute>;\n rule: Omit<GenerateBasicEncoderSpec<ILineGraphicAttribute>, 'points' | 'segments'> & { x1?: number; y1?: number };\n shape: GenerateBasicEncoderSpec<IPathGraphicAttribute>;\n symbol: GenerateBasicEncoderSpec<ISymbolGraphicAttribute> & {\n shape?: ISymbolGraphicAttribute['symbolType'];\n image?: ISymbolGraphicAttribute['background'];\n };\n text: GenerateBasicEncoderSpec<ITextGraphicAttribute> & {\n limit?: number;\n autoLimit?: number;\n };\n richtext: GenerateBasicEncoderSpec<IRichTextGraphicAttribute>;\n interval: Omit<GenerateBasicEncoderSpec<IRectGraphicAttribute>, 'width' | 'height'> & {\n /**\n * the gap for two graphic elements\n */\n innerGap?: number | string;\n /**\n * only used for rect / interval mark\n */\n maxWidth?: number;\n minWidth?: number;\n /** the gap between two category */\n categoryGap?: number | string;\n };\n cell: GenerateBasicEncoderSpec<ISymbolGraphicAttribute> & {\n padding?: number | [number, number];\n shape?: ISymbolAttribute['symbolType'];\n };\n};\nexport type GenerateBaseEncodeSpec<BasicSpec = GenerateBasicEncoderSpec<IGraphicAttribute>> =\n | GenerateEncoderSpec<BasicSpec>\n | MarkFunctionCallback<BasicSpec>;\n\nexport type StateProxyEncodeSpec<T = any> = (datum: any, element: IElement, state: string, nextStates: string[]) => T;\n\nexport type StateEncodeSpec<BasicSpec = GenerateBasicEncoderSpec<IGraphicAttribute>> =\n | {\n enter?: GenerateBaseEncodeSpec<BasicSpec>;\n update?: GenerateBaseEncodeSpec<BasicSpec>;\n exit?: GenerateBaseEncodeSpec<BasicSpec>;\n }\n | {\n [state: string]: GenerateEncoderSpec<BasicSpec> | StateProxyEncodeSpec<BasicSpec>;\n };\n\nexport type MarkAnimationSpec = Record<string, IAnimationConfig | IAnimationConfig[]> & {\n state?: IStateAnimationConfig;\n};\n\n// TODO: support string[]\nexport type MarkKeySpec = string | ((datum: any) => string);\n\nexport type MarkSortSpec = (datumA: any, datumB: any) => number;\n\nexport type MarkStateSortSpec = (stateA: string, stateB: string) => number;\n\nexport interface MarkGridContainerSpec extends MarkBaseLayoutSpec {\n display: 'grid';\n gridTemplateRows?: (number | string | 'auto')[];\n gridTemplateColumns?: (number | string | 'auto')[];\n gridRowGap?: number;\n gridColumnGap?: number;\n}\n\nexport interface MarkGridItemSpec extends MarkBaseLayoutSpec {\n gridRowStart?: number;\n gridRowEnd?: number;\n gridColumnStart?: number;\n gridColumnEnd?: number;\n}\n\nexport interface MarkBaseLayoutSpec {\n callback?: MarkLayoutCallback;\n skipBeforeLayouted?: boolean;\n updateViewSignals?: boolean;\n}\n\nexport interface MarkRelativeItemSpec extends MarkBaseLayoutSpec {\n position?: 'top' | 'bottom' | 'left' | 'right' | 'content' | 'auto' | string;\n padding?: CommonPaddingSpec;\n align?: 'left' | 'right' | 'center' | 'top' | 'bottom' | 'middle';\n order?: number;\n}\n\nexport interface MarkRelativeContainerSpec extends MarkBaseLayoutSpec {\n display: 'relative';\n maxChildWidth?: string | number;\n maxChildHeight?: string | number;\n}\n\nexport type MarkLayoutSpec =\n | MarkGridContainerSpec\n | MarkGridItemSpec\n | MarkRelativeContainerSpec\n | MarkRelativeItemSpec;\n\nexport type MarkLayoutCallback = (\n group: IGroupMark,\n children: IMark[],\n parentLayoutBounds: Bounds,\n options?: ILayoutOptions\n) => void;\n\nexport interface IMarkConfig {\n clip?: boolean;\n zIndex?: number;\n interactive?: boolean;\n context?: any;\n /**\n * set customized shape\n */\n setCustomizedShape?: (datum: any[], attrs: any, path: ICustomPath2D) => ICustomPath2D;\n /** 是否开启大数据渲染模式 */\n large?: boolean;\n /** 开启大数据渲染优化的阀值,对应的是data的长度 */\n largeThreshold?: number;\n /** 分片长度 */\n progressiveStep?: number;\n /** 开启分片渲染的阀值,对应的是单系列data的长度 */\n progressiveThreshold?: number;\n /**\n * use 'sequential' for symbol chart\n * use 'mod' for bar/line chart\n */\n // largeChunkMode?: 'sequential' | 'mod';\n support3d?: boolean;\n /**\n * enable global morphing animation of the mark\n */\n morph?: boolean;\n /**\n * this key will be used to match the mark to morph\n */\n morphKey?: string;\n /**\n * this key will be used to match the element of two marks to morph\n * If not specified, we'll use the \"key\" of the mark by default\n */\n morphElementKey?: string;\n /** transforms of attributes */\n attributeTransforms?: AttributeTransform[];\n}\n\n/**\n * Base mark specification type\n */\nexport interface GenerateMarkSpec<T extends MarkType = string, P = any> extends IMarkConfig, GrammarSpec {\n type: T;\n name?: string;\n group?: string | IGroupMark;\n // data attributes\n from?: MarkFromSpec;\n key?: MarkKeySpec;\n /**\n * sort all the elements in the mark\n */\n sort?: MarkSortSpec;\n /**\n * set the group key of the mark\n */\n groupBy?: MarkKeySpec;\n /**\n * sort the data of each group\n */\n groupSort?: MarkSortSpec;\n context?: any;\n // coordinate attributes\n coordinate?: string | ICoordinate;\n // encode attributes\n state?: MarkStateSpec;\n stateSort?: MarkStateSortSpec;\n encode?: GetEncoderSpecByType<T, P>;\n // animation attributes\n animationState?: MarkFunctionType<string>;\n animation?: MarkAnimationSpec;\n transform?: TransformSpec[];\n layout?: MarkLayoutSpec | MarkLayoutCallback;\n}\n\nexport type CircleMarkSpec = GenerateMarkSpec<'circle'>;\nexport type ArcMarkSpec = GenerateMarkSpec<'arc'>;\nexport type AreaMarkSpec = GenerateMarkSpec<'area'>;\nexport type LineMarkSpec = GenerateMarkSpec<'line'>;\nexport type RectMarkSpec = GenerateMarkSpec<'rect'>;\nexport type ImageMarkSpec = GenerateMarkSpec<'image'>;\nexport type PathMarkSpec = GenerateMarkSpec<'path'>;\nexport type RuleMarkSpec = GenerateMarkSpec<'rule'>;\nexport type ShapeMarkSpec = GenerateMarkSpec<'shape'>;\nexport type SymbolMarkSpec = GenerateMarkSpec<'symbol'>;\nexport type TextMarkSpec = GenerateMarkSpec<'text'>;\nexport type RichTextMarkSpec = GenerateMarkSpec<'richtext'>;\nexport type PolygonMarkSpec = GenerateMarkSpec<'polygon'>;\nexport type CellMarkSpec = GenerateMarkSpec<'cell'>;\nexport type IntervalMarkSpec = GenerateMarkSpec<'interval'>;\nexport type Arc3dMarkSpec = GenerateMarkSpec<'arc3d'>;\nexport type Pyramid3dMarkSpec = GenerateMarkSpec<'pyramid3d'>;\nexport type Rect3dMarkSpec = GenerateMarkSpec<'rect3d'>;\n\nexport type BasicGlyphEncoderSpec = BasicEncoderSpecMap['glyph'];\nexport type BasicGroupEncoderSpec = BasicEncoderSpecMap['group'];\nexport interface GroupMarkSpec extends GenerateMarkSpec<'group'> {\n marks?: MarkSpec[];\n}\n\nexport interface GlyphMarkSpec<CustomizedEncoderSpec = any> extends GenerateMarkSpec<'glyph', CustomizedEncoderSpec> {\n glyphType: string;\n glyphConfig?: any;\n}\n\nexport interface BoxPlotEncoderSpec extends BasicGlyphEncoderSpec {\n boxWidth?: number;\n boxHeight?: number;\n ruleWidth?: number;\n ruleHeight?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n anchor?: [number, number];\n}\n\nexport interface BarBoxPlotEncoderSpec extends BasicGlyphEncoderSpec {\n minMaxWidth?: number;\n q1q3Width?: number;\n minMaxHeight?: number;\n q1q3Height?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n lineWidth?: number;\n minMaxFillOpacity?: number;\n anchor?: [number, number];\n}\n\nexport interface LinkPathEncoderSpec extends BasicGlyphEncoderSpec {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n thickness: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n ratio?: number;\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n endArrow?: boolean;\n startArrow?: boolean;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\nexport interface TreePathEncoderSpec extends BasicGlyphEncoderSpec {\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n curvature?: number;\n /** round all the coordinates */\n round?: boolean;\n /** the ratio of normal style path */\n align?: 'start' | 'end' | 'center';\n pathType?: 'line' | 'smooth' | 'polyline';\n startArrowStyle?: Partial<IGraphicAttribute>;\n endArrowStyle?: Partial<IGraphicAttribute>;\n endArrow?: boolean;\n startArrow?: boolean;\n arrowSize?: number;\n backgroundStyle?: any;\n direction?: 'horizontal' | 'vertical' | 'LR' | 'RL' | 'TB' | 'BL' | 'radial';\n}\n\nexport interface RipplePointEncoderSpec extends BasicGlyphEncoderSpec {\n ripple?: number;\n size?: number;\n}\n\nexport interface ViolinEncoderSpec extends BasicGlyphEncoderSpec {\n violinFill: string;\n violinStroke: string;\n medianFill?: string;\n density?: IPointLike[];\n boxWidth?: number;\n q1?: number;\n q3?: number;\n min?: number;\n max?: number;\n median?: number;\n angle?: number;\n anchor?: [number, number];\n}\n\nexport interface WaveEncoderSpec extends BasicGlyphEncoderSpec {\n wave?: number;\n}\nexport interface BoxPlotGlyphSpec extends GlyphMarkSpec<BoxPlotEncoderSpec> {\n glyphType: 'boxplot';\n}\nexport interface BarBoxPlotGlyphSpec extends GlyphMarkSpec<BarBoxPlotEncoderSpec> {\n glyphType: 'barBoxplot';\n}\nexport interface LinkPathGlyphSpec extends GlyphMarkSpec<LinkPathEncoderSpec> {\n glyphType: 'linkPath';\n}\nexport interface TreePathGlyphSpec extends GlyphMarkSpec<TreePathEncoderSpec> {\n glyphType: 'treePath';\n}\nexport interface RipplePointGlyphSpec extends GlyphMarkSpec<RipplePointEncoderSpec> {\n glyphType: 'ripplePoint';\n}\nexport interface ViolinGlyphSpec extends GlyphMarkSpec<ViolinEncoderSpec> {\n glyphType: 'violin';\n}\nexport interface WaveGlyphSpec extends GlyphMarkSpec<WaveEncoderSpec> {\n glyphType: 'wave';\n}\n\nexport interface ComponentSpec<\n BasicEncoderSpec extends GenerateBasicEncoderSpec<IGraphicAttribute> = GenerateBasicEncoderSpec<IGraphicAttribute>\n> extends GenerateMarkSpec<'component', BasicEncoderSpec> {\n componentType: string;\n componentConfig?: any;\n mode?: '2d' | '3d';\n}\n\nexport type BaseMarkSpec = GenerateMarkSpec<MarkType>;\nexport type MarkSpecMap = {\n circle: CircleMarkSpec;\n arc: ArcMarkSpec;\n area: AreaMarkSpec;\n image: ImageMarkSpec;\n line: LineMarkSpec;\n path: PathMarkSpec;\n rule: RuleMarkSpec;\n shape: ShapeMarkSpec;\n symbol: SymbolMarkSpec;\n text: TextMarkSpec;\n richtext: RichTextMarkSpec;\n polygon: PolygonMarkSpec;\n cell: CellMarkSpec;\n interval: IntervalMarkSpec;\n rect: RectMarkSpec;\n rect3d: Rect3dMarkSpec;\n arc3d: Arc3dMarkSpec;\n pyramid3d: Pyramid3dMarkSpec;\n group: GroupMarkSpec;\n glyph: GlyphMarkSpec;\n linkPath: LinkPathGlyphSpec;\n treePath: TreePathGlyphSpec;\n wave: WaveEncoderSpec;\n ripplePoint: RipplePointGlyphSpec;\n barBoxplot: BarBoxPlotGlyphSpec;\n boxPlot: BoxPlotGlyphSpec;\n component: ComponentSpec;\n axis: AxisSpec;\n legend: LegendSpec;\n slider: SliderSpec;\n datazoom: DatazoomSpec;\n label: LabelSpec;\n player: PlayerSpec;\n};\n\nexport type GetMarkSpecByType<T, P = any> = T extends keyof MarkSpecMap ? MarkSpecMap[T] : GenerateMarkSpec<string, P>;\nexport type GetBasicEncoderSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? BasicEncoderSpecMap[T]\n : GenerateBasicEncoderSpec<IGraphicAttribute & P>;\nexport type GetEncoderSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? StateEncodeSpec<BasicEncoderSpecMap[T]>\n : StateEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute> & P>;\n\nexport type BaseEncodeSpec<P = any> = StateEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>;\nexport type BaseSignleEncodeSpec<P = any> =\n | GenerateEncoderSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>\n | StateProxyEncodeSpec<GenerateBasicEncoderSpec<IGraphicAttribute & P>>;\n\nexport type GetSignleEncodeSpecByType<T, P = any> = T extends keyof BasicEncoderSpecMap\n ? GenerateEncoderSpec<BasicEncoderSpecMap[T]> | StateProxyEncodeSpec<BasicEncoderSpecMap[T]>\n : BaseSignleEncodeSpec<P>;\n\nexport type MarkSpec =\n | GenerateMarkSpec<string, any>\n | CircleMarkSpec\n | ArcMarkSpec\n | AreaMarkSpec\n | ImageMarkSpec\n | LineMarkSpec\n | PathMarkSpec\n | RuleMarkSpec\n | ShapeMarkSpec\n | SymbolMarkSpec\n | TextMarkSpec\n | RichTextMarkSpec\n | PolygonMarkSpec\n | CellMarkSpec\n | IntervalMarkSpec\n | RectMarkSpec\n | Rect3dMarkSpec\n | Arc3dMarkSpec\n | Pyramid3dMarkSpec\n | GroupMarkSpec\n | GlyphMarkSpec\n | LinkPathGlyphSpec\n | TreePathGlyphSpec\n | WaveGlyphSpec\n | RipplePointGlyphSpec\n | BarBoxPlotGlyphSpec\n | BoxPlotGlyphSpec\n | ViolinGlyphSpec\n | ComponentSpec\n | BuiltInComponentSpec;\n\nexport interface AttributeTransform {\n channels: string[];\n transform: (graphicAttributes: any, nextAttrs: any, storedAttrs: any) => void;\n storedAttrs?: string;\n}\n\nexport interface IMarkConstructor {\n readonly markType: string;\n\n new (view: IView, markType: MarkType, group?: IGroupMark): IMark;\n}\n"]}
@@ -65,6 +65,7 @@ export interface IViewOptions extends IEnvironmentOptions, IRendererOptions, ILa
65
65
  hooks?: Hooks;
66
66
  eventConfig?: IViewEventConfig;
67
67
  background?: IColor;
68
+ disableTheme?: boolean;
68
69
  }
69
70
  export interface IRunningConfig {
70
71
  reuse?: boolean;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types/view.ts"],"names":[],"mappings":"","file":"view.js","sourcesContent":["import type { EventEmitter, IBounds, ILogger } from '@visactor/vutils';\nimport type { EnvType, IStage, IColor, IOption3D, ILayer, IStageParams } from '@visactor/vrender-core';\nimport type { CoordinateType } from '@visactor/vgrammar-coordinate';\nimport type { DataSpec } from './data';\nimport type { SignalFunctionType, SignalSpec } from './signal';\nimport type {\n IData,\n ISignal,\n IScale,\n IMark,\n IGrammarBase,\n ICoordinate,\n IGlyphMark,\n IGroupMark,\n IComponent\n} from './grammar';\nimport type { ScaleSpec, GrammarScaleType } from './scale';\nimport type { MarkSpec, MarkType } from './mark';\nimport type { Hooks } from './hooks';\nimport type { ProjectionSpec } from './projection';\nimport type { BaseEventHandler, EventSpec } from './event';\nimport type { CommonPaddingSpec } from './base';\nimport type { IMorphAnimationConfig } from './morph';\nimport type { IBaseAnimate } from './animate';\nimport type { IRenderer } from './renderer';\nimport type { IAxis, IDatazoom, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle } from './component';\nimport type { CoordinateSpec } from './coordinate';\nimport type { ITheme } from './theme';\nimport type { IInteraction, InteractionSpec } from './interaction';\n\nexport interface IViewThemeConfig {\n labelMonospace?: boolean;\n}\n\n/**\n * 获取state相关配置\n */\nexport interface IViewStateOptions {\n signals?: (name?: string, operator?: any) => boolean;\n data?: (name?: string, object?: any) => boolean;\n recurse?: boolean;\n}\n\nexport interface IEnvironmentOptions {\n /** 环境参数 */\n mode?: EnvType;\n /**\n * 环境带的配置\n */\n modeParams?: any;\n}\n\nexport interface IRendererOptions extends Partial<IStageParams> {\n /** 非浏览器环境下,如小程序,需要传入经过包装的伪 canvas 实例 */\n renderCanvas?: string | HTMLCanvasElement;\n /** vRender stage */\n stage?: IStage;\n rendererTitle?: string;\n /** vRender layer */\n layer?: ILayer;\n}\n\nexport interface ILayoutOptions {\n parseMarkBounds?: (bounds: IBounds, mark: IMark) => IBounds;\n doLayout?: (marks: IMark[], options: ILayoutOptions, view: IView) => void;\n}\n\n/** 事件配置 */\nexport interface IViewEventConfig {\n /**\n * preventDefaults相关配置\n */\n defaults?: {\n prevent?: boolean | Record<string, boolean>;\n allow?: boolean | Record<string, boolean>;\n };\n /**\n * whether permit events of view\n */\n view?: boolean | Record<string, boolean>;\n /** disable all the events */\n disable?: boolean;\n /** use gesture events or not */\n gesture?: boolean;\n /** use drag events or not */\n drag?: boolean;\n}\n\nexport interface srIOption3DType extends IOption3D {\n enable?: boolean;\n /* 是否支持3d视角变换 */\n enableView3dTranform?: boolean;\n}\nexport interface IViewOptions extends IEnvironmentOptions, IRendererOptions, ILayoutOptions {\n width?: number;\n height?: number;\n padding?: CommonPaddingSpec;\n autoFit?: boolean;\n\n options3d?: srIOption3DType;\n /** 外部传入的logger方法 */\n logger?: ILogger;\n /**\n * 0 - None\n * 1 - Error\n * 2 - Warn\n * 3 - Info\n * 4 - Debug\n */\n logLevel?: number;\n\n /** 生命周期等事件钩子 */\n hooks?: Hooks;\n\n /**\n * 事件相关配置\n * {\n * defaults: {\n * prevent: ['mousemove', 'mouseenter']\n * }\n * }\n */\n eventConfig?: IViewEventConfig;\n background?: IColor;\n}\n\nexport interface IRunningConfig {\n /** whether enable reusing of grammar */\n reuse?: boolean;\n /** whether enable morph */\n morph?: boolean;\n /** force all marks to participate in morphing */\n morphAll?: boolean;\n /** morphing animation config */\n animation?: IMorphAnimationConfig;\n /** whether apply exit animations for released marks */\n enableExitAnimation?: boolean;\n}\n\nexport interface IView {\n readonly renderer: IRenderer;\n readonly rootMark: IGroupMark;\n readonly animate: IBaseAnimate;\n readonly grammars: IRecordedGrammars;\n readonly logger: ILogger;\n\n // --- Grammar API ---\n signal: <T>(value?: T, update?: SignalFunctionType<T>) => ISignal<T>;\n data: (values?: any[]) => IData;\n scale: (type: GrammarScaleType) => IScale;\n coordinate: (type: CoordinateType) => ICoordinate;\n mark: (\n type: MarkType,\n group: IGroupMark | string,\n markOptions?: { glyphType?: string; componentType?: string; mode?: '2d' | '3d' }\n ) => IMark;\n group: (group: IGroupMark | string) => IGroupMark;\n glyph: (glyphType: string, group: IGroupMark | string) => IGlyphMark;\n component: (componentType: string, group: IGroupMark | string, mode?: '2d' | '3d') => IComponent;\n axis: (group: IGroupMark | string, mode?: '2d' | '3d') => IAxis;\n grid: (group: IGroupMark | string, mode?: '2d' | '3d') => IGrid;\n legend: (group: IGroupMark | string) => ILegend;\n slider: (group: IGroupMark | string) => ISlider;\n label: (group: IGroupMark | string) => ILabel;\n datazoom: (group: IGroupMark | string) => IDatazoom;\n player: (group: IGroupMark | string) => IPlayer;\n title: (group: IGroupMark | string) => ITitle;\n scrollbar: (group: IGroupMark | string) => IScrollbar;\n\n interaction: (type: string, spec: Partial<InteractionSpec>) => IInteraction;\n removeInteraction: (type: string) => this;\n removeAllInteractions: () => this;\n\n addGrammar: (grammar: IGrammarBase) => this;\n removeGrammar: (grammar: string | IGrammarBase) => this;\n removeAllGrammars: () => this;\n\n getGrammarById: (id: string) => IGrammarBase | null;\n getCustomizedById: (id: string) => IGrammarBase | null;\n getSignalById: <T>(id: string) => ISignal<T> | null;\n getDataById: (id: string) => IData | null;\n getScaleById: (id: string) => IScale | null;\n getCoordinateById: (id: string) => ICoordinate | null;\n getMarkById: (id: string) => IMark | null;\n getGrammarsByName: (name: string) => IGrammarBase[];\n getGrammarsByType: (grammarType: string) => IGrammarBase[];\n getMarksByType: (markType: string) => IMark[];\n getMarksByName: (name: string) => IMark[] | null;\n getMarksBySelector: (selector: string | string[] | IMark | IMark[]) => IMark[] | null;\n\n commit: (grammar: IGrammarBase) => this;\n\n // --- Spec API ---\n parseSpec: (spec: ViewSpec) => this;\n updateSpec: (spec: ViewSpec) => this;\n\n // --- Evaluate API ---\n run: (runningConfig?: IRunningConfig) => this;\n runNextTick: (runningConfig?: IRunningConfig) => Promise<this>;\n runAsync: (runningConfig?: IRunningConfig) => Promise<this>;\n runSync: (runningConfig?: IRunningConfig) => this;\n runBefore: (callback: (view: IView) => void) => this;\n runAfter: (callback: (view: IView) => void) => this;\n\n // --- Theme API ---\n theme: (theme: ITheme | string) => this;\n getCurrentTheme: () => ITheme;\n setCurrentTheme: (theme: ITheme | string, render?: boolean) => Promise<this>;\n\n // --- Global Config API ---\n background: (value?: IColor) => IColor;\n width: (value?: number) => number;\n height: (value?: number) => number;\n viewWidth: (value?: number) => number;\n viewHeight: (value?: number) => number;\n padding: (p?: number | { left?: number; right?: number; top?: number; bottom?: number }) => {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n getViewBox: () => IBounds;\n\n // --- Event API ---\n addEventListener: (type: string, handler: BaseEventHandler, options?: any) => this;\n removeEventListener: (type: string, handler: BaseEventHandler) => this;\n\n // --- Other API ---\n emit: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n\n resize: (width: number, height: number, render?: boolean) => Promise<this>;\n traverseMarkTree: (apply: (mark: IMark) => any, filter?: (mark: IMark) => boolean, leafFirst?: boolean) => this;\n\n getLayoutState: () => string;\n updateLayoutTag: () => this;\n\n pauseProgressive: () => boolean;\n resumeProgressive: () => boolean;\n restartProgressive: () => boolean;\n\n release: () => void;\n getImageBuffer: () => Buffer;\n}\n\nexport interface IViewConstructor {\n new (options?: IViewOptions, config?: IViewThemeConfig): IView;\n}\n\nexport interface ViewSpec {\n /** 梳理详细配置 */\n theme?: string;\n background?: IColor;\n width?: number;\n height?: number;\n padding?: number | { left?: number; right?: number; top?: number; bottom?: number };\n signals?: SignalSpec<any>[];\n projections?: ProjectionSpec[];\n data?: DataSpec[];\n scales?: ScaleSpec[];\n coordinates?: CoordinateSpec[];\n marks?: MarkSpec[];\n events?: EventSpec[];\n interactions?: InteractionSpec[];\n animation?: boolean;\n}\n\nexport interface IRecordedGrammars {\n record: (grammar: IGrammarBase) => this;\n unrecord: (grammar: IGrammarBase) => this;\n\n size: () => number;\n\n getSignal: <T>(key: string) => ISignal<T> | null;\n getData: (key: string) => IData | null;\n getScale: (key: string) => IScale | null;\n getCoordinate: (key: string) => ICoordinate | null;\n getMark: (key: string) => IMark | null;\n getCustomized: (key: string) => IGrammarBase | null;\n getGrammar: (key: string) => IGrammarBase | null;\n\n getAllSignals: () => ISignal<any>[];\n getAllData: () => IData[];\n getAllScales: () => IScale[];\n getAllCoordinates: () => ICoordinate[];\n getAllMarks: () => IMark[];\n getAllCustomized: () => IGrammarBase[];\n\n clear: () => void;\n\n traverse: (func: (grammar: IGrammarBase) => boolean | void) => void;\n find: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase | null;\n filter: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase[];\n\n release: () => void;\n}\n\nexport interface IMarkTreeNode {\n mark: IMark;\n parent: IMarkTreeNode;\n children: IMarkTreeNode[];\n}\n\nexport interface IRecordedTreeGrammars extends IRecordedGrammars {\n getAllMarkNodes: () => IMarkTreeNode[];\n}\n"]}
1
+ {"version":3,"sources":["../src/types/view.ts"],"names":[],"mappings":"","file":"view.js","sourcesContent":["import type { EventEmitter, IBounds, ILogger } from '@visactor/vutils';\nimport type { EnvType, IStage, IColor, IOption3D, ILayer, IStageParams } from '@visactor/vrender-core';\nimport type { CoordinateType } from '@visactor/vgrammar-coordinate';\nimport type { DataSpec } from './data';\nimport type { SignalFunctionType, SignalSpec } from './signal';\nimport type {\n IData,\n ISignal,\n IScale,\n IMark,\n IGrammarBase,\n ICoordinate,\n IGlyphMark,\n IGroupMark,\n IComponent\n} from './grammar';\nimport type { ScaleSpec, GrammarScaleType } from './scale';\nimport type { MarkSpec, MarkType } from './mark';\nimport type { Hooks } from './hooks';\nimport type { ProjectionSpec } from './projection';\nimport type { BaseEventHandler, EventSpec } from './event';\nimport type { CommonPaddingSpec } from './base';\nimport type { IMorphAnimationConfig } from './morph';\nimport type { IBaseAnimate } from './animate';\nimport type { IRenderer } from './renderer';\nimport type { IAxis, IDatazoom, IGrid, ILabel, ILegend, IPlayer, IScrollbar, ISlider, ITitle } from './component';\nimport type { CoordinateSpec } from './coordinate';\nimport type { ITheme } from './theme';\nimport type { IInteraction, InteractionSpec } from './interaction';\n\nexport interface IViewThemeConfig {\n labelMonospace?: boolean;\n}\n\n/**\n * 获取state相关配置\n */\nexport interface IViewStateOptions {\n signals?: (name?: string, operator?: any) => boolean;\n data?: (name?: string, object?: any) => boolean;\n recurse?: boolean;\n}\n\nexport interface IEnvironmentOptions {\n /** 环境参数 */\n mode?: EnvType;\n /**\n * 环境带的配置\n */\n modeParams?: any;\n}\n\nexport interface IRendererOptions extends Partial<IStageParams> {\n /** 非浏览器环境下,如小程序,需要传入经过包装的伪 canvas 实例 */\n renderCanvas?: string | HTMLCanvasElement;\n /** vRender stage */\n stage?: IStage;\n rendererTitle?: string;\n /** vRender layer */\n layer?: ILayer;\n}\n\nexport interface ILayoutOptions {\n parseMarkBounds?: (bounds: IBounds, mark: IMark) => IBounds;\n doLayout?: (marks: IMark[], options: ILayoutOptions, view: IView) => void;\n}\n\n/** 事件配置 */\nexport interface IViewEventConfig {\n /**\n * preventDefaults相关配置\n */\n defaults?: {\n prevent?: boolean | Record<string, boolean>;\n allow?: boolean | Record<string, boolean>;\n };\n /**\n * whether permit events of view\n */\n view?: boolean | Record<string, boolean>;\n /** disable all the events */\n disable?: boolean;\n /** use gesture events or not */\n gesture?: boolean;\n /** use drag events or not */\n drag?: boolean;\n}\n\nexport interface srIOption3DType extends IOption3D {\n enable?: boolean;\n /* 是否支持3d视角变换 */\n enableView3dTranform?: boolean;\n}\nexport interface IViewOptions extends IEnvironmentOptions, IRendererOptions, ILayoutOptions {\n width?: number;\n height?: number;\n padding?: CommonPaddingSpec;\n autoFit?: boolean;\n\n options3d?: srIOption3DType;\n /** 外部传入的logger方法 */\n logger?: ILogger;\n /**\n * 0 - None\n * 1 - Error\n * 2 - Warn\n * 3 - Info\n * 4 - Debug\n */\n logLevel?: number;\n\n /** 生命周期等事件钩子 */\n hooks?: Hooks;\n\n /**\n * 事件相关配置\n * {\n * defaults: {\n * prevent: ['mousemove', 'mouseenter']\n * }\n * }\n */\n eventConfig?: IViewEventConfig;\n background?: IColor;\n disableTheme?: boolean;\n}\n\nexport interface IRunningConfig {\n /** whether enable reusing of grammar */\n reuse?: boolean;\n /** whether enable morph */\n morph?: boolean;\n /** force all marks to participate in morphing */\n morphAll?: boolean;\n /** morphing animation config */\n animation?: IMorphAnimationConfig;\n /** whether apply exit animations for released marks */\n enableExitAnimation?: boolean;\n}\n\nexport interface IView {\n readonly renderer: IRenderer;\n readonly rootMark: IGroupMark;\n readonly animate: IBaseAnimate;\n readonly grammars: IRecordedGrammars;\n readonly logger: ILogger;\n\n // --- Grammar API ---\n signal: <T>(value?: T, update?: SignalFunctionType<T>) => ISignal<T>;\n data: (values?: any[]) => IData;\n scale: (type: GrammarScaleType) => IScale;\n coordinate: (type: CoordinateType) => ICoordinate;\n mark: (\n type: MarkType,\n group: IGroupMark | string,\n markOptions?: { glyphType?: string; componentType?: string; mode?: '2d' | '3d' }\n ) => IMark;\n group: (group: IGroupMark | string) => IGroupMark;\n glyph: (glyphType: string, group: IGroupMark | string) => IGlyphMark;\n component: (componentType: string, group: IGroupMark | string, mode?: '2d' | '3d') => IComponent;\n axis: (group: IGroupMark | string, mode?: '2d' | '3d') => IAxis;\n grid: (group: IGroupMark | string, mode?: '2d' | '3d') => IGrid;\n legend: (group: IGroupMark | string) => ILegend;\n slider: (group: IGroupMark | string) => ISlider;\n label: (group: IGroupMark | string) => ILabel;\n datazoom: (group: IGroupMark | string) => IDatazoom;\n player: (group: IGroupMark | string) => IPlayer;\n title: (group: IGroupMark | string) => ITitle;\n scrollbar: (group: IGroupMark | string) => IScrollbar;\n\n interaction: (type: string, spec: Partial<InteractionSpec>) => IInteraction;\n removeInteraction: (type: string) => this;\n removeAllInteractions: () => this;\n\n addGrammar: (grammar: IGrammarBase) => this;\n removeGrammar: (grammar: string | IGrammarBase) => this;\n removeAllGrammars: () => this;\n\n getGrammarById: (id: string) => IGrammarBase | null;\n getCustomizedById: (id: string) => IGrammarBase | null;\n getSignalById: <T>(id: string) => ISignal<T> | null;\n getDataById: (id: string) => IData | null;\n getScaleById: (id: string) => IScale | null;\n getCoordinateById: (id: string) => ICoordinate | null;\n getMarkById: (id: string) => IMark | null;\n getGrammarsByName: (name: string) => IGrammarBase[];\n getGrammarsByType: (grammarType: string) => IGrammarBase[];\n getMarksByType: (markType: string) => IMark[];\n getMarksByName: (name: string) => IMark[] | null;\n getMarksBySelector: (selector: string | string[] | IMark | IMark[]) => IMark[] | null;\n\n commit: (grammar: IGrammarBase) => this;\n\n // --- Spec API ---\n parseSpec: (spec: ViewSpec) => this;\n updateSpec: (spec: ViewSpec) => this;\n\n // --- Evaluate API ---\n run: (runningConfig?: IRunningConfig) => this;\n runNextTick: (runningConfig?: IRunningConfig) => Promise<this>;\n runAsync: (runningConfig?: IRunningConfig) => Promise<this>;\n runSync: (runningConfig?: IRunningConfig) => this;\n runBefore: (callback: (view: IView) => void) => this;\n runAfter: (callback: (view: IView) => void) => this;\n\n // --- Theme API ---\n theme: (theme: ITheme | string) => this;\n getCurrentTheme: () => ITheme;\n setCurrentTheme: (theme: ITheme | string, render?: boolean) => Promise<this>;\n\n // --- Global Config API ---\n background: (value?: IColor) => IColor;\n width: (value?: number) => number;\n height: (value?: number) => number;\n viewWidth: (value?: number) => number;\n viewHeight: (value?: number) => number;\n padding: (p?: number | { left?: number; right?: number; top?: number; bottom?: number }) => {\n left: number;\n right: number;\n top: number;\n bottom: number;\n };\n getViewBox: () => IBounds;\n\n // --- Event API ---\n addEventListener: (type: string, handler: BaseEventHandler, options?: any) => this;\n removeEventListener: (type: string, handler: BaseEventHandler) => this;\n\n // --- Other API ---\n emit: <T extends EventEmitter.EventNames<string | symbol>>(\n event: T,\n ...args: EventEmitter.EventArgs<string | symbol, T>\n ) => boolean;\n\n resize: (width: number, height: number, render?: boolean) => Promise<this>;\n traverseMarkTree: (apply: (mark: IMark) => any, filter?: (mark: IMark) => boolean, leafFirst?: boolean) => this;\n\n getLayoutState: () => string;\n updateLayoutTag: () => this;\n\n pauseProgressive: () => boolean;\n resumeProgressive: () => boolean;\n restartProgressive: () => boolean;\n\n release: () => void;\n getImageBuffer: () => Buffer;\n}\n\nexport interface IViewConstructor {\n new (options?: IViewOptions, config?: IViewThemeConfig): IView;\n}\n\nexport interface ViewSpec {\n /** 梳理详细配置 */\n theme?: string;\n background?: IColor;\n width?: number;\n height?: number;\n padding?: number | { left?: number; right?: number; top?: number; bottom?: number };\n signals?: SignalSpec<any>[];\n projections?: ProjectionSpec[];\n data?: DataSpec[];\n scales?: ScaleSpec[];\n coordinates?: CoordinateSpec[];\n marks?: MarkSpec[];\n events?: EventSpec[];\n interactions?: InteractionSpec[];\n animation?: boolean;\n}\n\nexport interface IRecordedGrammars {\n record: (grammar: IGrammarBase) => this;\n unrecord: (grammar: IGrammarBase) => this;\n\n size: () => number;\n\n getSignal: <T>(key: string) => ISignal<T> | null;\n getData: (key: string) => IData | null;\n getScale: (key: string) => IScale | null;\n getCoordinate: (key: string) => ICoordinate | null;\n getMark: (key: string) => IMark | null;\n getCustomized: (key: string) => IGrammarBase | null;\n getGrammar: (key: string) => IGrammarBase | null;\n\n getAllSignals: () => ISignal<any>[];\n getAllData: () => IData[];\n getAllScales: () => IScale[];\n getAllCoordinates: () => ICoordinate[];\n getAllMarks: () => IMark[];\n getAllCustomized: () => IGrammarBase[];\n\n clear: () => void;\n\n traverse: (func: (grammar: IGrammarBase) => boolean | void) => void;\n find: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase | null;\n filter: (func: (grammar: IGrammarBase) => boolean) => IGrammarBase[];\n\n release: () => void;\n}\n\nexport interface IMarkTreeNode {\n mark: IMark;\n parent: IMarkTreeNode;\n children: IMarkTreeNode[];\n}\n\nexport interface IRecordedTreeGrammars extends IRecordedGrammars {\n getAllMarkNodes: () => IMarkTreeNode[];\n}\n"]}
@@ -139,7 +139,6 @@ export default class View extends EventEmitter implements IView {
139
139
  removeEventListener(type: string, handler?: BaseEventHandler): this;
140
140
  private initializeRenderer;
141
141
  private initialize;
142
- normalBrowserEnv(): boolean;
143
142
  pauseProgressive(): boolean;
144
143
  resumeProgressive(): boolean;
145
144
  restartProgressive(): boolean;
package/cjs/view/View.js CHANGED
@@ -34,7 +34,7 @@ Object.defineProperty(exports, "__esModule", {
34
34
  value: !0
35
35
  });
36
36
 
37
- const vutils_1 = require("@visactor/vutils"), vrender_core_1 = require("@visactor/vrender-core"), data_1 = require("./data"), events_1 = require("./events"), dataflow_1 = __importDefault(require("./dataflow")), mark_tree_1 = require("../graph/mark-tree"), constants_1 = require("../graph/constants"), canvas_renderer_1 = __importDefault(require("../graph/canvas-renderer")), events_extend_1 = __importDefault(require("../graph/util/events-extend")), constants_2 = require("./constants"), signal_1 = require("./signal"), scale_1 = require("./scale"), view_1 = require("../parse/view"), event_1 = require("../parse/event"), util_1 = require("../parse/util"), env_1 = require("../graph/util/env"), group_1 = require("./group"), mark_1 = require("./mark"), layout_1 = require("../graph/layout/layout"), glyph_1 = require("./glyph"), coordinate_1 = require("./coordinate"), morph_1 = require("../graph/animation/morph"), grammar_record_1 = require("./grammar-record"), animate_1 = require("./animate"), enums_1 = require("../graph/enums"), interval_1 = require("../semantic-marks/interval"), cell_1 = require("../semantic-marks/cell"), text_1 = require("../semantic-marks/text"), theme_manager_1 = require("../theme/theme-manager"), factory_1 = require("../core/factory"), component_1 = require("./component"), graphic_1 = require("../graph/util/graphic");
37
+ const vutils_1 = require("@visactor/vutils"), vrender_core_1 = require("@visactor/vrender-core"), data_1 = require("./data"), events_1 = require("./events"), dataflow_1 = __importDefault(require("./dataflow")), mark_tree_1 = require("../graph/mark-tree"), constants_1 = require("../graph/constants"), canvas_renderer_1 = __importDefault(require("../graph/canvas-renderer")), events_extend_1 = __importDefault(require("../graph/util/events-extend")), constants_2 = require("./constants"), signal_1 = require("./signal"), scale_1 = require("./scale"), view_1 = require("../parse/view"), event_1 = require("../parse/event"), util_1 = require("../parse/util"), env_1 = require("../graph/util/env"), group_1 = require("./group"), mark_1 = require("./mark"), layout_1 = require("../graph/layout/layout"), glyph_1 = require("./glyph"), coordinate_1 = require("./coordinate"), morph_1 = require("../graph/animation/morph"), grammar_record_1 = require("./grammar-record"), animate_1 = require("./animate"), enums_1 = require("../graph/enums"), text_1 = require("../semantic-marks/text"), theme_manager_1 = require("../theme/theme-manager"), factory_1 = require("../core/factory"), component_1 = require("./component"), graphic_1 = require("../graph/util/graphic");
38
38
 
39
39
  class View extends vutils_1.EventEmitter {
40
40
  static useRegisters(comps) {
@@ -139,20 +139,12 @@ class View extends vutils_1.EventEmitter {
139
139
  mark = factory_1.Factory.hasComponent(null == markOptions ? void 0 : markOptions.componentType) ? factory_1.Factory.createComponent(null == markOptions ? void 0 : markOptions.componentType, this, groupMark, null == markOptions ? void 0 : markOptions.mode) : new component_1.Component(this, null == markOptions ? void 0 : markOptions.componentType, groupMark, null == markOptions ? void 0 : markOptions.mode);
140
140
  break;
141
141
 
142
- case enums_1.GrammarMarkType.interval:
143
- mark = new interval_1.Interval(this, type, groupMark);
144
- break;
145
-
146
- case enums_1.GrammarMarkType.cell:
147
- mark = new cell_1.Cell(this, type, groupMark);
148
- break;
149
-
150
142
  case enums_1.GrammarMarkType.text:
151
143
  mark = new text_1.Text(this, type, groupMark);
152
144
  break;
153
145
 
154
146
  default:
155
- mark = new mark_1.Mark(this, type, groupMark);
147
+ mark = factory_1.Factory.hasMark(type) ? factory_1.Factory.createMark(type, this, groupMark) : new mark_1.Mark(this, type, groupMark);
156
148
  }
157
149
  return this.grammars.record(mark), this._dataflow.add(mark), mark;
158
150
  }
@@ -277,7 +269,7 @@ class View extends vutils_1.EventEmitter {
277
269
  return this.removeAllInteractions(), this.removeAllGrammars(), this.parseSpec(spec);
278
270
  }
279
271
  parseBuiltIn() {
280
- (0, view_1.builtInSignals)(this._options, this._config, this.getCurrentTheme()).map((signalSpec => {
272
+ (0, view_1.builtInSignals)(this._options, this._config, this.getCurrentTheme()).forEach((signalSpec => {
281
273
  const signal = this.signal().parse(signalSpec);
282
274
  signalSpec.value && signal.set(signalSpec.value);
283
275
  }));
@@ -313,11 +305,12 @@ class View extends vutils_1.EventEmitter {
313
305
  }));
314
306
  }
315
307
  theme(theme) {
316
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
308
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
317
309
  return (0, vutils_1.isString)(theme) ? this._theme = null !== (_a = theme_manager_1.ThemeManager.getTheme(theme)) && void 0 !== _a ? _a : theme_manager_1.ThemeManager.getDefaultTheme() : this._theme = theme,
318
- this.background(null !== (_d = null !== (_c = null === (_b = this._spec) || void 0 === _b ? void 0 : _b.background) && void 0 !== _c ? _c : this._options.background) && void 0 !== _d ? _d : this._theme.background),
310
+ this._theme ? (this.background(null !== (_d = null !== (_c = null === (_b = this._spec) || void 0 === _b ? void 0 : _b.background) && void 0 !== _c ? _c : this._options.background) && void 0 !== _d ? _d : this._theme.background),
319
311
  this.padding(null !== (_g = null !== (_f = null === (_e = this._spec) || void 0 === _e ? void 0 : _e.padding) && void 0 !== _f ? _f : this._options.padding) && void 0 !== _g ? _g : this._theme.padding),
320
- null === (_j = null === (_h = this.renderer.stage()) || void 0 === _h ? void 0 : _h.setTheme) || void 0 === _j || _j.call(_h, Object.assign({}, this._theme.marks)),
312
+ null === (_j = null === (_h = this.renderer.stage()) || void 0 === _h ? void 0 : _h.setTheme) || void 0 === _j || _j.call(_h, Object.assign({}, this._theme.marks))) : (this.background(null !== (_l = null === (_k = this._spec) || void 0 === _k ? void 0 : _k.background) && void 0 !== _l ? _l : this._options.background),
313
+ this.padding(null !== (_o = null === (_m = this._spec) || void 0 === _m ? void 0 : _m.padding) && void 0 !== _o ? _o : this._options.padding)),
321
314
  this;
322
315
  }
323
316
  getCurrentTheme() {
@@ -448,7 +441,7 @@ class View extends vutils_1.EventEmitter {
448
441
  const normalizedRunningConfig = (0, view_1.normalizeRunningConfig)(runningConfig);
449
442
  this.reuseCachedGrammars(normalizedRunningConfig);
450
443
  const grammarWillDetach = this._cachedGrammars.size() > 0;
451
- this.detachCachedGrammar();
444
+ grammarWillDetach && this.detachCachedGrammar();
452
445
  const hasResize = this._resizeRenderer(), hasUpdate = this._dataflow.hasCommitted();
453
446
  return grammarWillDetach || hasUpdate || this._layoutState || hasResize ? (this.clearProgressive(),
454
447
  yield this._dataflow.evaluate(), this._needBuildLayoutTree && (this.buildLayoutTree(),
@@ -468,7 +461,7 @@ class View extends vutils_1.EventEmitter {
468
461
  const normalizedRunningConfig = (0, view_1.normalizeRunningConfig)(runningConfig);
469
462
  this.reuseCachedGrammars(normalizedRunningConfig);
470
463
  const grammarWillDetach = this._cachedGrammars.size() > 0;
471
- this.detachCachedGrammar();
464
+ grammarWillDetach && this.detachCachedGrammar();
472
465
  const hasResize = this._resizeRenderer(), hasUpdate = this._dataflow.hasCommitted();
473
466
  return grammarWillDetach || hasUpdate || this._layoutState || hasResize ? (this.clearProgressive(),
474
467
  this._dataflow.evaluateSync(), this._needBuildLayoutTree && (this.buildLayoutTree(),
@@ -711,18 +704,15 @@ class View extends vutils_1.EventEmitter {
711
704
  this._cachedGrammars = new grammar_record_1.RecordedTreeGrammars((grammar => grammar.id())),
712
705
  this._options.logger && vutils_1.Logger.setInstance(this._options.logger), this.logger = vutils_1.Logger.getInstance(null !== (_a = this._options.logLevel) && void 0 !== _a ? _a : 0),
713
706
  this._dataflow = new dataflow_1.default, this.animate = new animate_1.ViewAnimate(this),
714
- this._morph = new morph_1.Morph, this._theme = theme_manager_1.ThemeManager.getDefaultTheme(),
715
- this._options.hooks && (Object.keys(this._options.hooks).forEach((key => {
707
+ this._morph = new morph_1.Morph, this._options.hooks && (Object.keys(this._options.hooks).forEach((key => {
716
708
  this.on(key, this._options.hooks[key]);
717
709
  })), this.hooks = this._options.hooks), this.container = null, this.renderer = null,
718
710
  this._eventListeners = [], this._eventConfig = (0, events_1.initializeEventConfig)(this._options.eventConfig),
719
- this._theme = theme_manager_1.ThemeManager.getDefaultTheme(), this.parseBuiltIn(),
720
- (0, env_1.configureEnvironment)(this._options), this.initializeRenderer(), this._eventConfig.disable || this.initEvent(),
721
- this._bindResizeEvent(), this._currentDataflow = null, this._needBuildLayoutTree = !0,
722
- this._layoutState = enums_1.LayoutState.before, this.theme(this._theme);
723
- }
724
- normalBrowserEnv() {
725
- return "browser" === this._options.mode;
711
+ this._theme = this._options.disableTheme ? null : theme_manager_1.ThemeManager.getDefaultTheme(),
712
+ this.parseBuiltIn(), (0, env_1.configureEnvironment)(this._options), this.initializeRenderer(),
713
+ this._eventConfig.disable || this.initEvent(), this._bindResizeEvent(), this._currentDataflow = null,
714
+ this._needBuildLayoutTree = !0, this._layoutState = enums_1.LayoutState.before,
715
+ this.theme(this._theme);
726
716
  }
727
717
  pauseProgressive() {
728
718
  return !1;