@visactor/vgrammar-core 0.14.0-alpha.1 → 0.14.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/component/axis.d.ts +0 -2
- package/cjs/component/axis.js +1 -15
- package/cjs/component/axis.js.map +1 -1
- package/cjs/component/grid.d.ts +0 -2
- package/cjs/component/grid.js +1 -15
- package/cjs/component/grid.js.map +1 -1
- package/cjs/component/index.d.ts +2 -2
- package/cjs/component/index.js +1 -21
- package/cjs/component/index.js.map +1 -1
- package/cjs/core/factory.d.ts +1 -8
- package/cjs/core/factory.js +1 -8
- package/cjs/core/factory.js.map +1 -1
- package/cjs/glyph/boxplot.js +5 -5
- package/cjs/glyph/boxplot.js.map +1 -1
- package/cjs/glyph/link-path.js +2 -2
- package/cjs/glyph/link-path.js.map +1 -1
- package/cjs/glyph/ripple.js +2 -3
- package/cjs/glyph/ripple.js.map +1 -1
- package/cjs/glyph/tree-path.js +2 -2
- package/cjs/glyph/tree-path.js.map +1 -1
- package/cjs/glyph/violin.js +4 -4
- package/cjs/glyph/violin.js.map +1 -1
- package/cjs/glyph/wave.js +2 -3
- package/cjs/glyph/wave.js.map +1 -1
- package/cjs/graph/animation/animation/fade.js +4 -4
- package/cjs/graph/animation/animation/fade.js.map +1 -1
- package/cjs/graph/animation/animation/grow-cartesian.js +14 -14
- package/cjs/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/cjs/graph/animation/animation/grow-interval.js +9 -9
- package/cjs/graph/animation/animation/grow-interval.js.map +1 -1
- package/cjs/graph/animation/animation/grow-points.js +9 -9
- package/cjs/graph/animation/animation/grow-points.js.map +1 -1
- package/cjs/graph/animation/animation/grow-polar.js +24 -24
- package/cjs/graph/animation/animation/grow-polar.js.map +1 -1
- package/cjs/graph/animation/animation/move.js +6 -6
- package/cjs/graph/animation/animation/move.js.map +1 -1
- package/cjs/graph/animation/animation/rotate.js +5 -5
- package/cjs/graph/animation/animation/rotate.js.map +1 -1
- package/cjs/graph/animation/animation/scale.js +5 -5
- package/cjs/graph/animation/animation/scale.js.map +1 -1
- package/cjs/graph/animation/animation/update.js +2 -2
- package/cjs/graph/animation/animation/update.js.map +1 -1
- package/cjs/graph/animation/animator.js +6 -1
- package/cjs/graph/animation/animator.js.map +1 -1
- package/cjs/graph/animation/morph.d.ts +12 -2
- package/cjs/graph/animation/morph.js +163 -76
- package/cjs/graph/animation/morph.js.map +1 -1
- package/cjs/graph/attributes/line.d.ts +1 -0
- package/cjs/graph/attributes/line.js +17 -5
- package/cjs/graph/attributes/line.js.map +1 -1
- package/cjs/graph/canvas-renderer.d.ts +1 -1
- package/cjs/graph/canvas-renderer.js +4 -4
- package/cjs/graph/canvas-renderer.js.map +1 -1
- package/cjs/graph/constants.d.ts +1 -0
- package/cjs/graph/constants.js +2 -2
- package/cjs/graph/constants.js.map +1 -1
- package/cjs/graph/element.d.ts +2 -1
- package/cjs/graph/element.js +22 -20
- package/cjs/graph/element.js.map +1 -1
- package/cjs/graph/glyph-element.js +6 -7
- package/cjs/graph/glyph-element.js.map +1 -1
- package/cjs/graph/layout/layout.d.ts +0 -1
- package/cjs/graph/layout/layout.js +2 -8
- package/cjs/graph/layout/layout.js.map +1 -1
- package/cjs/graph/mark/graphic.js +8 -14
- package/cjs/graph/mark/graphic.js.map +1 -1
- package/cjs/graph/util/element.d.ts +2 -0
- package/cjs/graph/util/element.js +10 -0
- package/cjs/graph/util/element.js.map +1 -0
- package/cjs/graph/util/point.js +26 -10
- package/cjs/graph/util/point.js.map +1 -1
- package/cjs/index.d.ts +1 -8
- package/cjs/index.js +2 -66
- package/cjs/index.js.map +1 -1
- package/cjs/interactions/brush-base.js +2 -1
- package/cjs/interactions/brush-filter.js +1 -2
- package/cjs/interactions/fish-eye.js +2 -1
- package/cjs/interactions/index.js +1 -2
- package/cjs/interactions/tooltip.js +1 -1
- package/cjs/parse/event.d.ts +2 -0
- package/cjs/parse/event.js +10 -4
- package/cjs/parse/event.js.map +1 -1
- package/cjs/parse/util.js.map +1 -1
- package/cjs/transforms/mark/mark-overlap.js +6 -6
- package/cjs/transforms/mark/mark-overlap.js.map +1 -1
- package/cjs/types/animate.d.ts +1 -0
- package/cjs/types/animate.js.map +1 -1
- package/cjs/types/element.d.ts +5 -1
- package/cjs/types/element.js.map +1 -1
- package/cjs/types/morph.d.ts +2 -1
- package/cjs/types/morph.js.map +1 -1
- package/cjs/types/renderer.d.ts +1 -6
- package/cjs/types/renderer.js.map +1 -1
- package/cjs/view/View.d.ts +6 -3
- package/cjs/view/View.js +105 -52
- package/cjs/view/View.js.map +1 -1
- package/cjs/view/animate.js +1 -2
- package/cjs/view/animate.js.map +1 -1
- package/cjs/view/constants.d.ts +0 -2
- package/cjs/view/constants.js +2 -3
- package/cjs/view/constants.js.map +1 -1
- package/cjs/view/events.d.ts +1 -0
- package/cjs/view/events.js +17 -3
- package/cjs/view/events.js.map +1 -1
- package/cjs/view/glyph.d.ts +0 -4
- package/cjs/view/glyph.js +3 -12
- package/cjs/view/glyph.js.map +1 -1
- package/cjs/view/grammar-record.js +2 -3
- package/cjs/view/grammar-record.js.map +1 -1
- package/cjs/view/group.js +3 -3
- package/cjs/view/group.js.map +1 -1
- package/cjs/view/mark.d.ts +0 -2
- package/cjs/view/mark.js +28 -31
- package/cjs/view/mark.js.map +1 -1
- package/es/component/axis.d.ts +0 -2
- package/es/component/axis.js +0 -10
- package/es/component/axis.js.map +1 -1
- package/es/component/grid.d.ts +0 -2
- package/es/component/grid.js +0 -10
- package/es/component/grid.js.map +1 -1
- package/es/component/index.d.ts +2 -2
- package/es/component/index.js +2 -2
- package/es/component/index.js.map +1 -1
- package/es/core/factory.d.ts +1 -8
- package/es/core/factory.js +1 -8
- package/es/core/factory.js.map +1 -1
- package/es/glyph/boxplot.js +2 -4
- package/es/glyph/boxplot.js.map +1 -1
- package/es/glyph/link-path.js +2 -4
- package/es/glyph/link-path.js.map +1 -1
- package/es/glyph/ripple.js +1 -3
- package/es/glyph/ripple.js.map +1 -1
- package/es/glyph/tree-path.js +2 -4
- package/es/glyph/tree-path.js.map +1 -1
- package/es/glyph/violin.js +2 -4
- package/es/glyph/violin.js.map +1 -1
- package/es/glyph/wave.js +1 -3
- package/es/glyph/wave.js.map +1 -1
- package/es/graph/animation/animation/fade.js +4 -4
- package/es/graph/animation/animation/fade.js.map +1 -1
- package/es/graph/animation/animation/grow-cartesian.js +14 -14
- package/es/graph/animation/animation/grow-cartesian.js.map +1 -1
- package/es/graph/animation/animation/grow-interval.js +9 -9
- package/es/graph/animation/animation/grow-interval.js.map +1 -1
- package/es/graph/animation/animation/grow-points.js +9 -9
- package/es/graph/animation/animation/grow-points.js.map +1 -1
- package/es/graph/animation/animation/grow-polar.js +24 -24
- package/es/graph/animation/animation/grow-polar.js.map +1 -1
- package/es/graph/animation/animation/move.js +6 -6
- package/es/graph/animation/animation/move.js.map +1 -1
- package/es/graph/animation/animation/rotate.js +4 -4
- package/es/graph/animation/animation/rotate.js.map +1 -1
- package/es/graph/animation/animation/scale.js +5 -5
- package/es/graph/animation/animation/scale.js.map +1 -1
- package/es/graph/animation/animation/update.js +3 -1
- package/es/graph/animation/animation/update.js.map +1 -1
- package/es/graph/animation/animator.js +6 -1
- package/es/graph/animation/animator.js.map +1 -1
- package/es/graph/animation/morph.d.ts +12 -2
- package/es/graph/animation/morph.js +159 -72
- package/es/graph/animation/morph.js.map +1 -1
- package/es/graph/attributes/line.d.ts +1 -0
- package/es/graph/attributes/line.js +14 -3
- package/es/graph/attributes/line.js.map +1 -1
- package/es/graph/canvas-renderer.d.ts +1 -1
- package/es/graph/canvas-renderer.js +5 -5
- package/es/graph/canvas-renderer.js.map +1 -1
- package/es/graph/constants.d.ts +1 -0
- package/es/graph/constants.js +2 -0
- package/es/graph/constants.js.map +1 -1
- package/es/graph/element.d.ts +2 -1
- package/es/graph/element.js +24 -20
- package/es/graph/element.js.map +1 -1
- package/es/graph/glyph-element.js +8 -6
- package/es/graph/glyph-element.js.map +1 -1
- package/es/graph/layout/layout.d.ts +0 -1
- package/es/graph/layout/layout.js +0 -6
- package/es/graph/layout/layout.js.map +1 -1
- package/es/graph/mark/graphic.js +7 -13
- package/es/graph/mark/graphic.js.map +1 -1
- package/es/graph/util/element.d.ts +2 -0
- package/es/graph/util/element.js +8 -0
- package/es/graph/util/element.js.map +1 -0
- package/es/graph/util/point.js +26 -10
- package/es/graph/util/point.js.map +1 -1
- package/es/index.d.ts +1 -8
- package/es/index.js +1 -29
- package/es/index.js.map +1 -1
- package/es/interactions/element-active.js +2 -1
- package/es/interactions/element-highlight-by-group.js +1 -2
- package/es/interactions/fish-eye.js +1 -1
- package/es/parse/event.d.ts +2 -0
- package/es/parse/event.js +7 -3
- package/es/parse/event.js.map +1 -1
- package/es/parse/option.js +2 -1
- package/es/parse/scale.js +1 -2
- package/es/parse/util.js.map +1 -1
- package/es/transforms/mark/mark-overlap.js +6 -6
- package/es/transforms/mark/mark-overlap.js.map +1 -1
- package/es/types/animate.d.ts +1 -0
- package/es/types/animate.js.map +1 -1
- package/es/types/element.d.ts +5 -1
- package/es/types/element.js.map +1 -1
- package/es/types/morph.d.ts +2 -1
- package/es/types/morph.js.map +1 -1
- package/es/types/renderer.d.ts +1 -6
- package/es/types/renderer.js.map +1 -1
- package/es/view/View.d.ts +6 -3
- package/es/view/View.js +114 -53
- package/es/view/View.js.map +1 -1
- package/es/view/animate.js +1 -2
- package/es/view/animate.js.map +1 -1
- package/es/view/constants.d.ts +0 -2
- package/es/view/constants.js +0 -4
- package/es/view/constants.js.map +1 -1
- package/es/view/events.d.ts +1 -0
- package/es/view/events.js +15 -1
- package/es/view/events.js.map +1 -1
- package/es/view/glyph.d.ts +0 -4
- package/es/view/glyph.js +0 -11
- package/es/view/glyph.js.map +1 -1
- package/es/view/grammar-record.js +2 -3
- package/es/view/grammar-record.js.map +1 -1
- package/es/view/group.js +4 -2
- package/es/view/group.js.map +1 -1
- package/es/view/mark.d.ts +0 -2
- package/es/view/mark.js +30 -32
- package/es/view/mark.js.map +1 -1
- package/package.json +9 -9
- package/cjs/graph/view-diff.d.ts +0 -8
- package/cjs/graph/view-diff.js +0 -93
- package/cjs/graph/view-diff.js.map +0 -1
- package/cjs/view/mark-animate-mixin.d.ts +0 -1
- package/cjs/view/mark-animate-mixin.js +0 -29
- package/cjs/view/mark-animate-mixin.js.map +0 -1
- package/cjs/view/view-animate-mixin.d.ts +0 -1
- package/cjs/view/view-animate-mixin.js +0 -26
- package/cjs/view/view-animate-mixin.js.map +0 -1
- package/cjs/view/view-event-mixin.d.ts +0 -1
- package/cjs/view/view-event-mixin.js +0 -92
- package/cjs/view/view-event-mixin.js.map +0 -1
- package/cjs/view/view-morph-mixin.d.ts +0 -1
- package/cjs/view/view-morph-mixin.js +0 -32
- package/cjs/view/view-morph-mixin.js.map +0 -1
- package/es/graph/view-diff.d.ts +0 -8
- package/es/graph/view-diff.js +0 -89
- package/es/graph/view-diff.js.map +0 -1
- package/es/view/mark-animate-mixin.d.ts +0 -1
- package/es/view/mark-animate-mixin.js +0 -25
- package/es/view/mark-animate-mixin.js.map +0 -1
- package/es/view/view-animate-mixin.d.ts +0 -1
- package/es/view/view-animate-mixin.js +0 -16
- package/es/view/view-animate-mixin.js.map +0 -1
- package/es/view/view-event-mixin.d.ts +0 -1
- package/es/view/view-event-mixin.js +0 -90
- package/es/view/view-event-mixin.js.map +0 -1
- package/es/view/view-morph-mixin.d.ts +0 -1
- package/es/view/view-morph-mixin.js +0 -22
- package/es/view/view-morph-mixin.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAU9E,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,M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,sBAAsB;QACpB,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;YACrD,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,yBAAyB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM;QACJ,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;QAC9B,KAAK,CAAC,MAAM,EAAE,CAAC;IACjB,CAAC;IAED,OAAO;QACL,IAAI,IAAI,CAAC,iBAAiB,EAAE;YAC1B,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;gBAC1D,WAAW,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;YACvC,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,iBAAiB,GAAG,IAAI,CAAC;SAC/B;QACD,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC;CACF","file":"glyph-element.js","sourcesContent":["import { has, isNil, isBoolean, isFunction, isEqual } from '@visactor/vutils';\nimport type {\n IGlyphElement,\n IGlyphMark,\n MarkElementItem,\n MarkSpec,\n IGlyphMeta,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport { cloneTransformAttributes, transformAttributes } from './attributes/transform';\nimport { BridgeElementKey, CollectionMarkType } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType } from './enums';\nimport { Element } from './element';\nimport { invokeEncoderToItems } from './mark/encode';\nimport type { IGraphicAttribute, IGlyph } from '@visactor/vrender-core';\n\nexport class GlyphElement extends Element implements IGlyphElement {\n declare graphicItem: IGlyph;\n\n declare mark: IGlyphMark;\n protected glyphGraphicItems: { [markName: string]: any };\n\n private glyphMeta: IGlyphMeta;\n\n constructor(mark: IGlyphMark) {\n super(mark);\n this.glyphMeta = this.mark.getGlyphMeta();\n }\n\n getGlyphGraphicItems() {\n return this.glyphGraphicItems;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n\n this.graphicItem = this.mark.addGraphicItem(attributes, this.groupKey) as IGlyph;\n this.graphicItem[BridgeElementKey] = this;\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n\n const glyphMarks = this.glyphMeta.getMarks();\n this.glyphGraphicItems = {};\n this.graphicItem.getSubGraphic().forEach((graphic: any) => {\n const markType = glyphMarks[graphic.name];\n this.glyphGraphicItems[graphic.name] = graphic;\n graphic.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(markType, attributes, this, graphic.name);\n return graphicAttributes;\n };\n });\n\n this.clearGraphicAttributes();\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!this.graphicItem) {\n return false;\n }\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, { states }, this);\n\n this.states = states.slice();\n\n const stateAnimationEnable = isBoolean(hasAnimation) ? hasAnimation : this.hasStateAnimation();\n\n this.graphicItem.glyphStateProxy = this.getStateAttrs;\n this.graphicItem.useStates(this.states, stateAnimationEnable);\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, { states }, this);\n\n return true;\n }\n\n protected getStateAttrs = (stateName: string, nextStates: string[]) => {\n const isRuntimeState = !isNil(this.runtimeStatesEncoder?.[stateName]);\n const encoder = isRuntimeState\n ? {\n ...(this.mark.getSpec() as MarkSpec).encode?.[stateName],\n ...this.runtimeStatesEncoder[stateName]\n }\n : (this.mark.getSpec() as MarkSpec).encode?.[stateName];\n\n const glyphStateAttributes = {} as {\n attributes: Partial<IGraphicAttribute>;\n subAttributes: Partial<IGraphicAttribute>[];\n };\n\n if (!encoder) {\n return glyphStateAttributes;\n }\n\n if (isFunction(encoder)) {\n glyphStateAttributes.attributes = (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n return glyphStateAttributes;\n }\n\n if (!isRuntimeState && this.graphicItem.glyphStates?.[stateName]) {\n return this.graphicItem.glyphStates[stateName];\n }\n\n if (encoder) {\n const item = this.items[0];\n const targetItems = [Object.assign({}, item, { nextAttrs: {} })];\n\n invokeEncoderToItems(this, targetItems, encoder, (this.mark as any).parameters());\n this.coordinateTransformEncode(targetItems);\n\n glyphStateAttributes.attributes = targetItems[0].nextAttrs;\n\n if (!this.graphicItem.glyphStates) {\n this.graphicItem.glyphStates = { [stateName]: glyphStateAttributes };\n } else if (!this.graphicItem.glyphStates[stateName]) {\n this.graphicItem.glyphStates[stateName] = glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n };\n\n encodeGraphic() {\n this.coordinateTransformEncode(this.items);\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n if (!this.graphicItem) {\n this.initGraphicItem();\n }\n\n if (this.diffState === DiffState.enter) {\n // apply default encoder when enter\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(true);\n this.applyGraphicAttributes(graphicAttributes);\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n } else {\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n // 更新数据流后,states计算不缓存\n graphicItem.states = {};\n });\n this.useStates(this.states);\n }\n\n // clear item attributes\n this.items.map(item => {\n item.nextAttrs = {};\n });\n }\n\n encodeCustom(nextAttrs?: any): { [markName: string]: any } {\n let customEncodeValues: { [markName: string]: any } = {};\n const channelEncoder = this.glyphMeta.getChannelEncoder();\n const functionEncoder = this.glyphMeta.getFunctionEncoder();\n\n if (functionEncoder) {\n customEncodeValues = functionEncoder.call(\n null,\n Object.assign({}, this.graphicItem?.attribute, nextAttrs),\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n }\n if (channelEncoder) {\n // TODO: maybe delete origin encode value?\n let allAttrs: any;\n Object.keys(channelEncoder).forEach(channel => {\n if (!isNil(nextAttrs[channel])) {\n if (!allAttrs) {\n allAttrs = Object.assign({}, this.graphicItem?.attribute, nextAttrs);\n }\n const encodeResult = channelEncoder[channel].call(\n null,\n channel,\n nextAttrs[channel],\n allAttrs,\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n Object.keys(encodeResult ?? {}).forEach(markName => {\n customEncodeValues[markName] = Object.assign(customEncodeValues[markName] ?? {}, encodeResult[markName]);\n });\n }\n });\n }\n return customEncodeValues;\n }\n\n private encodeDefault() {\n const defaultEncodeValues: { [markName: string]: any } = {};\n // apply default encode\n if (this.diffState === DiffState.enter && this.glyphMeta.getDefaultEncoder()) {\n const defaultEncodeResult = this.glyphMeta\n .getDefaultEncoder()\n .call(null, this.getDatum(), this, this.mark.getGlyphConfig());\n Object.assign(defaultEncodeValues, defaultEncodeResult);\n }\n return defaultEncodeValues;\n }\n\n private _onGlyphAttributeUpdate(first: boolean = false) {\n return (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const glyphMarks = this.glyphMeta.getMarks();\n\n const graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this);\n\n // apply default encode\n const defaultEncodeValues = first ? this.encodeDefault() : null;\n // apply custom encode\n const customEncodeValues = this.encodeCustom(attributes);\n\n Object.keys(glyphMarks).forEach(markName => {\n const markType = glyphMarks[markName];\n const graphicItem = this.glyphGraphicItems[markName];\n const customAttributes = customEncodeValues?.[markName];\n const additionalAttributes = Object.assign({}, customAttributes);\n if (first) {\n // apply default attributes when visual channel is not set\n const defaultAttributes = defaultEncodeValues?.[markName];\n Object.keys(defaultAttributes ?? {}).forEach(key => {\n if (!has(this.items[0].nextAttrs, key) && !has(additionalAttributes, key)) {\n additionalAttributes[key] = defaultAttributes[key];\n }\n });\n }\n const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes);\n const glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);\n this.coordinateTransformEncode(glyphItems);\n const graphicAttributes = this.transformElementItems(glyphItems, markType);\n\n this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem);\n\n if (markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n graphicItem.datum = glyphItems[0].datum;\n }\n });\n\n return graphicAttributes;\n };\n }\n\n private _generateGlyphItems(markType: MarkType, items: MarkElementItem[], additionalAttributes: any) {\n const glyphItems = items.map(item => Object.assign({}, item, { nextAttrs: additionalAttributes }));\n\n if ((CollectionMarkType as string[]).includes(markType) && this.mark.getSpec().enableSegments) {\n // segment mark require all items to apply additional attributes\n glyphItems.forEach((glyphItem, index) => {\n glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);\n });\n }\n\n return glyphItems;\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false, markName?: any) {\n if (!this.graphicItem) {\n return undefined;\n }\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n if (prev && has(prevGraphicAttributes, channel)) {\n return prevGraphicAttributes[channel];\n }\n\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.attribute[channel];\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n if (final) {\n finalGraphicAttributes[channel] = value;\n }\n if (!has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n }\n\n graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n Object.keys(attributes).forEach(key => {\n if (final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (!has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = graphicItem.attribute[key];\n }\n });\n\n graphicItem.setAttributes(attributes);\n }\n\n protected diffAttributes(graphicAttributes: { [channel: string]: any }, markName?: string) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n for (const key in graphicAttributes) {\n if (!has(finalGraphicAttributes, key) || !isEqual(finalGraphicAttributes[key], graphicAttributes[key])) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n protected applyGlyphGraphicAttributes(graphicAttributes: any, markName: string, graphicItem: any): void {\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName) ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName) ?? {};\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes, markName);\n this.setPrevGraphicAttributes(prevGraphicAttributes, markName);\n this.setFinalGraphicAttributes(finalGraphicAttributes, markName);\n\n // Apply next attributes to current graphic item immediately.\n // Scene graph tree should be handled like no animation exists in dataflow procedure.\n graphicItem.setAttributes(nextGraphicAttributes);\n } else {\n graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getFinalGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.finalAttrs = attributes;\n }\n\n getPrevGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.prevAttrs = attributes;\n }\n\n getNextGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.nextAttrs;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n });\n }\n\n clearGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n this.setFinalGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n this.setFinalGraphicAttributes(null, markName);\n });\n }\n\n remove() {\n this.glyphGraphicItems = null;\n super.remove();\n }\n\n release() {\n if (this.glyphGraphicItems) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n graphicItem[BridgeElementKey] = null;\n });\n this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O,EAAE,CAAC;IAClB,CAAC;CACF","file":"glyph-element.js","sourcesContent":["import { has, isNil, isBoolean, isFunction } from '@visactor/vutils';\nimport { isEqual } from '@visactor/vgrammar-util';\nimport type {\n IGlyphElement,\n IGlyphMark,\n MarkElementItem,\n MarkSpec,\n IGlyphMeta,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport { cloneTransformAttributes, transformAttributes } from './attributes/transform';\nimport { BridgeElementKey, CollectionMarkType } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType } from './enums';\nimport { Element } from './element';\nimport { invokeEncoderToItems } from './mark/encode';\nimport type { IGraphicAttribute, IGlyph } from '@visactor/vrender-core';\n\nexport class GlyphElement extends Element implements IGlyphElement {\n declare graphicItem: IGlyph;\n\n declare mark: IGlyphMark;\n protected glyphGraphicItems: { [markName: string]: any };\n\n private glyphMeta: IGlyphMeta;\n\n constructor(mark: IGlyphMark) {\n super(mark);\n this.glyphMeta = this.mark.getGlyphMeta();\n }\n\n getGlyphGraphicItems() {\n return this.glyphGraphicItems;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n\n this.graphicItem = this.mark.addGraphicItem(attributes, this.groupKey) as IGlyph;\n this.graphicItem[BridgeElementKey] = this;\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n\n const glyphMarks = this.glyphMeta.getMarks();\n this.glyphGraphicItems = {};\n this.graphicItem.getSubGraphic().forEach((graphic: any) => {\n const markType = glyphMarks[graphic.name];\n this.glyphGraphicItems[graphic.name] = graphic;\n graphic.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(markType, attributes, this, graphic.name);\n return graphicAttributes;\n };\n });\n\n this.clearGraphicAttributes();\n }\n\n useStates(states: string[], hasAnimation?: boolean) {\n if (!this.graphicItem) {\n return false;\n }\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_STATE, { states }, this);\n\n this.states = states.slice();\n\n const stateAnimationEnable = isBoolean(hasAnimation)\n ? hasAnimation\n : this.mark.animate.getAnimationConfigs('state').length !== 0;\n\n this.graphicItem.glyphStateProxy = this.getStateAttrs;\n this.graphicItem.useStates(this.states, stateAnimationEnable);\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_STATE, { states }, this);\n\n return true;\n }\n\n protected getStateAttrs = (stateName: string, nextStates: string[]) => {\n const isRuntimeState = !isNil(this.runtimeStatesEncoder?.[stateName]);\n const encoder = isRuntimeState\n ? {\n ...(this.mark.getSpec() as MarkSpec).encode?.[stateName],\n ...this.runtimeStatesEncoder[stateName]\n }\n : (this.mark.getSpec() as MarkSpec).encode?.[stateName];\n\n const glyphStateAttributes = {} as {\n attributes: Partial<IGraphicAttribute>;\n subAttributes: Partial<IGraphicAttribute>[];\n };\n\n if (!encoder) {\n return glyphStateAttributes;\n }\n\n if (isFunction(encoder)) {\n glyphStateAttributes.attributes = (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n return glyphStateAttributes;\n }\n\n if (!isRuntimeState && this.graphicItem.glyphStates?.[stateName]) {\n return this.graphicItem.glyphStates[stateName];\n }\n\n if (encoder) {\n const item = this.items[0];\n const targetItems = [Object.assign({}, item, { nextAttrs: {} })];\n\n invokeEncoderToItems(this, targetItems, encoder, (this.mark as any).parameters());\n this.coordinateTransformEncode(targetItems);\n\n glyphStateAttributes.attributes = targetItems[0].nextAttrs;\n\n if (!this.graphicItem.glyphStates) {\n this.graphicItem.glyphStates = { [stateName]: glyphStateAttributes };\n } else if (!this.graphicItem.glyphStates[stateName]) {\n this.graphicItem.glyphStates[stateName] = glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n }\n\n return glyphStateAttributes;\n };\n\n encodeGraphic() {\n this.coordinateTransformEncode(this.items);\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n const isGraphicInit = !this.graphicItem;\n if (!this.graphicItem) {\n this.initGraphicItem();\n }\n\n if (this.diffState === DiffState.enter || isGraphicInit) {\n // apply default encoder when enter or graphic item is created\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(true);\n this.applyGraphicAttributes(graphicAttributes);\n this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(false);\n } else {\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n // 更新数据流后,states计算不缓存\n graphicItem.states = {};\n });\n this.useStates(this.states);\n }\n\n // clear item attributes\n this.items.map(item => {\n item.nextAttrs = {};\n });\n }\n\n encodeCustom(nextAttrs?: any): { [markName: string]: any } {\n let customEncodeValues: { [markName: string]: any } = {};\n const channelEncoder = this.glyphMeta.getChannelEncoder();\n const functionEncoder = this.glyphMeta.getFunctionEncoder();\n\n if (functionEncoder) {\n customEncodeValues = functionEncoder.call(\n null,\n Object.assign({}, this.graphicItem?.attribute, nextAttrs),\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n }\n if (channelEncoder) {\n // TODO: maybe delete origin encode value?\n let allAttrs: any;\n Object.keys(channelEncoder).forEach(channel => {\n if (!isNil(nextAttrs[channel])) {\n if (!allAttrs) {\n allAttrs = Object.assign({}, this.graphicItem?.attribute, nextAttrs);\n }\n const encodeResult = channelEncoder[channel].call(\n null,\n channel,\n nextAttrs[channel],\n allAttrs,\n this.getDatum(),\n this,\n this.mark.getGlyphConfig()\n );\n Object.keys(encodeResult ?? {}).forEach(markName => {\n customEncodeValues[markName] = Object.assign(customEncodeValues[markName] ?? {}, encodeResult[markName]);\n });\n }\n });\n }\n return customEncodeValues;\n }\n\n private encodeDefault() {\n const defaultEncodeValues: { [markName: string]: any } = {};\n // apply default encode\n if (this.glyphMeta.getDefaultEncoder()) {\n const defaultEncodeResult = this.glyphMeta\n .getDefaultEncoder()\n .call(null, this.getDatum(), this, this.mark.getGlyphConfig());\n Object.assign(defaultEncodeValues, defaultEncodeResult);\n }\n return defaultEncodeValues;\n }\n\n private _onGlyphAttributeUpdate(first: boolean = false) {\n return (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const glyphMarks = this.glyphMeta.getMarks();\n\n const graphicAttributes = transformAttributes(this.mark.getAttributeTransforms(), attributes, this);\n\n // apply default encode\n const defaultEncodeValues = first ? this.encodeDefault() : null;\n // apply custom encode\n const customEncodeValues = this.encodeCustom(attributes);\n\n Object.keys(glyphMarks).forEach(markName => {\n const markType = glyphMarks[markName];\n const graphicItem = this.glyphGraphicItems[markName];\n const customAttributes = customEncodeValues?.[markName];\n const additionalAttributes = Object.assign({}, customAttributes);\n if (first) {\n // apply default attributes when visual channel is not set\n const defaultAttributes = defaultEncodeValues?.[markName];\n Object.keys(defaultAttributes ?? {}).forEach(key => {\n if (!has(this.items[0].nextAttrs, key) && !has(additionalAttributes, key)) {\n additionalAttributes[key] = defaultAttributes[key];\n }\n });\n }\n const glyphAttributes = Object.assign({}, cloneTransformAttributes(markType, attributes), additionalAttributes);\n const glyphItems = this._generateGlyphItems(markType, this.items, glyphAttributes);\n this.coordinateTransformEncode(glyphItems);\n const graphicAttributes = this.transformElementItems(glyphItems, markType);\n\n this.applyGlyphGraphicAttributes(graphicAttributes, markName, graphicItem);\n\n if (markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n graphicItem.datum = glyphItems[0].datum;\n }\n });\n\n return graphicAttributes;\n };\n }\n\n private _generateGlyphItems(markType: MarkType, items: MarkElementItem[], additionalAttributes: any) {\n const glyphItems = items.map(item => Object.assign({}, item, { nextAttrs: additionalAttributes }));\n\n if ((CollectionMarkType as string[]).includes(markType) && this.mark.getSpec().enableSegments) {\n // segment mark require all items to apply additional attributes\n glyphItems.forEach((glyphItem, index) => {\n glyphItem.nextAttrs = Object.assign({}, items[index].nextAttrs, additionalAttributes);\n });\n }\n\n return glyphItems;\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false, markName?: any) {\n if (!this.graphicItem) {\n return undefined;\n }\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n if (prev && has(prevGraphicAttributes, channel)) {\n return prevGraphicAttributes[channel];\n }\n\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.attribute[channel];\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n if (final) {\n finalGraphicAttributes[channel] = value;\n }\n if (!has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n }\n\n graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true, markName?: any) {\n if (!this.graphicItem) {\n return;\n }\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName);\n\n Object.keys(attributes).forEach(key => {\n if (final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (!has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = graphicItem.attribute[key];\n }\n });\n\n graphicItem.setAttributes(attributes);\n }\n\n protected diffAttributes(graphicAttributes: { [channel: string]: any }, markName?: string) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName);\n for (const key in graphicAttributes) {\n if (!isEqual(key, finalGraphicAttributes, graphicAttributes)) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n protected applyGlyphGraphicAttributes(graphicAttributes: any, markName: string, graphicItem: any): void {\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes, markName);\n const prevGraphicAttributes = this.getPrevGraphicAttributes(markName) ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes(markName) ?? {};\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = graphicItem.attribute[channel];\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes, markName);\n this.setPrevGraphicAttributes(prevGraphicAttributes, markName);\n this.setFinalGraphicAttributes(finalGraphicAttributes, markName);\n\n // Apply next attributes to current graphic item immediately.\n // Scene graph tree should be handled like no animation exists in dataflow procedure.\n graphicItem.setAttributes(nextGraphicAttributes);\n } else {\n graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getFinalGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.finalAttrs = attributes;\n }\n\n getPrevGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.prevAttrs = attributes;\n }\n\n getNextGraphicAttributes(markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n return graphicItem.nextAttrs;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }, markName?: string) {\n const graphicItem = markName ? this.glyphGraphicItems[markName] : this.graphicItem;\n graphicItem.nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n });\n }\n\n clearGraphicAttributes() {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n this.setFinalGraphicAttributes(null);\n Object.keys(this.glyphGraphicItems).forEach(markName => {\n this.setPrevGraphicAttributes(null, markName);\n this.setNextGraphicAttributes(null, markName);\n this.setFinalGraphicAttributes(null, markName);\n });\n }\n\n remove() {\n this.glyphGraphicItems = null;\n super.remove();\n }\n\n release() {\n if (this.glyphGraphicItems) {\n Object.values(this.glyphGraphicItems).forEach(graphicItem => {\n graphicItem[BridgeElementKey] = null;\n });\n this.glyphGraphicItems = null;\n }\n super.release();\n }\n}\n"]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import type { IMark } from '../../types/grammar';
|
|
2
2
|
import type { ILayoutOptions, IView } from '../../types/view';
|
|
3
3
|
export declare const defaultDoLayout: (layoutMarks: IMark[], options: ILayoutOptions, view: IView) => void;
|
|
4
|
-
export declare const registerDefaultLayout: () => void;
|
|
@@ -8,8 +8,6 @@ import { doGridLayout } from "./grid";
|
|
|
8
8
|
|
|
9
9
|
import { doRelativeLayout } from "./relative";
|
|
10
10
|
|
|
11
|
-
import { Factory } from "../../core/factory";
|
|
12
|
-
|
|
13
11
|
export const defaultDoLayout = (layoutMarks, options, view) => {
|
|
14
12
|
null == layoutMarks || layoutMarks.forEach((mark => {
|
|
15
13
|
var _a;
|
|
@@ -32,8 +30,4 @@ export const defaultDoLayout = (layoutMarks, options, view) => {
|
|
|
32
30
|
}
|
|
33
31
|
}));
|
|
34
32
|
};
|
|
35
|
-
|
|
36
|
-
export const registerDefaultLayout = () => {
|
|
37
|
-
Factory.registerDefaultLayout(defaultDoLayout);
|
|
38
|
-
};
|
|
39
33
|
//# sourceMappingURL=layout.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/layout/layout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UA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,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;SACnE;QAED,eAAe,CAAC,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","file":"layout.js","sourcesContent":["import { isFunction } from '@visactor/vutils';\nimport { SIGNAL_VIEW_HEIGHT, SIGNAL_PADDING, SIGNAL_VIEW_WIDTH } from './../../view/constants';\nimport type { MarkRelativeContainerSpec, MarkGridContainerSpec } from './../../types/mark';\nimport { GrammarMarkType } from '../enums';\nimport type { IMark, IGroupMark } from '../../types/grammar';\nimport type { ILayoutOptions, IView } from '../../types/view';\nimport { doGridLayout } from './grid';\nimport { doRelativeLayout } from './relative';\n\nexport const defaultDoLayout = (layoutMarks: IMark[], options: ILayoutOptions, view: IView) => {\n layoutMarks?.forEach(mark => {\n if (mark.markType !== GrammarMarkType.group) {\n return;\n }\n\n const layoutChildren = (mark as IGroupMark).layoutChildren;\n\n // FIXME buildLayoutTree的时候过滤一下空的group\n // if (!layoutChildren?.length) {\n // return;\n // }\n\n const layoutSpec = mark.getSpec().layout;\n const bounds = mark.layoutBounds ?? mark.getBounds();\n\n if (!bounds) {\n return;\n }\n\n if (isFunction(layoutSpec)) {\n layoutSpec.call(null, mark as IGroupMark, layoutChildren, bounds, options);\n } else if (isFunction(layoutSpec.callback)) {\n layoutSpec.callback.call(null, mark as IGroupMark, layoutChildren, bounds, options);\n } else if ((layoutSpec as MarkRelativeContainerSpec).display === 'relative') {\n if (layoutSpec.updateViewSignals) {\n const oldViewBox = view.getViewBox();\n\n if (oldViewBox) {\n bounds.intersect(oldViewBox);\n }\n\n const viewBounds = doRelativeLayout(mark as IGroupMark, layoutChildren, bounds, options);\n const viewWidth = viewBounds.width();\n const viewHeight = viewBounds.height();\n const padding = {\n top: viewBounds.y1,\n right: view.width() - viewBounds.x2,\n left: viewBounds.x1,\n bottom: view.height() - viewBounds.y2\n };\n (view as any).updateSignal(SIGNAL_VIEW_WIDTH, viewWidth);\n (view as any).updateSignal(SIGNAL_VIEW_HEIGHT, viewHeight);\n (view as any).updateSignal(SIGNAL_PADDING, padding);\n } else {\n doRelativeLayout(mark as IGroupMark, layoutChildren, bounds, options);\n }\n } else if ((layoutSpec as MarkGridContainerSpec).display === 'grid') {\n doGridLayout(mark as IGroupMark, layoutChildren, bounds, options);\n }\n\n defaultDoLayout(layoutChildren, options, view);\n });\n};\n"]}
|
package/es/graph/mark/graphic.js
CHANGED
|
@@ -10,15 +10,12 @@ import { registerCircle, registerArc, registerArc3d, registerPyramid3d, register
|
|
|
10
10
|
|
|
11
11
|
import { createArc, createCircle, createArc3d, createPyramid3d, createArea, createGroup, createImage, createRect3d, createLine, createPath, createRect, createSymbol, createText, createPolygon, createRichText, createGlyph } from "@visactor/vrender-core";
|
|
12
12
|
|
|
13
|
-
import { registerRectDataLabel, registerLineDataLabel, registerArcDataLabel, registerSymbolDataLabel } from "@visactor/vrender-components";
|
|
14
|
-
|
|
15
13
|
export const registerCircleGraphic = () => {
|
|
16
14
|
registerShadowRoot(), registerCircle(), Factory.registerGraphic(GrammarMarkType.circle, createCircle);
|
|
17
15
|
};
|
|
18
16
|
|
|
19
17
|
export const registerArcGraphic = () => {
|
|
20
|
-
registerShadowRoot(), registerArc(), Factory.registerGraphic(GrammarMarkType.arc, createArc)
|
|
21
|
-
registerArcDataLabel();
|
|
18
|
+
registerShadowRoot(), registerArc(), Factory.registerGraphic(GrammarMarkType.arc, createArc);
|
|
22
19
|
};
|
|
23
20
|
|
|
24
21
|
export const registerArc3dGraphic = () => {
|
|
@@ -30,8 +27,7 @@ export const registerPyramid3dGraphic = () => {
|
|
|
30
27
|
};
|
|
31
28
|
|
|
32
29
|
export const registerAreaGraphic = () => {
|
|
33
|
-
registerShadowRoot(), registerArea(), Factory.registerGraphic(GrammarMarkType.area, createArea)
|
|
34
|
-
registerLineDataLabel(), registerSymbolDataLabel();
|
|
30
|
+
registerShadowRoot(), registerArea(), Factory.registerGraphic(GrammarMarkType.area, createArea);
|
|
35
31
|
};
|
|
36
32
|
|
|
37
33
|
export const registerGroupGraphic = () => {
|
|
@@ -43,8 +39,7 @@ export const registerImageGraphic = () => {
|
|
|
43
39
|
};
|
|
44
40
|
|
|
45
41
|
export const registerLineGraphic = () => {
|
|
46
|
-
registerShadowRoot(), registerLine(),
|
|
47
|
-
Factory.registerGraphic(GrammarMarkType.line, createLine);
|
|
42
|
+
registerShadowRoot(), registerLine(), Factory.registerGraphic(GrammarMarkType.line, createLine);
|
|
48
43
|
};
|
|
49
44
|
|
|
50
45
|
export const registerPathGraphic = () => {
|
|
@@ -52,7 +47,7 @@ export const registerPathGraphic = () => {
|
|
|
52
47
|
};
|
|
53
48
|
|
|
54
49
|
export const registerRectGraphic = () => {
|
|
55
|
-
registerShadowRoot(), registerRect(),
|
|
50
|
+
registerShadowRoot(), registerRect(), Factory.registerGraphic(GrammarMarkType.rect, createRect);
|
|
56
51
|
};
|
|
57
52
|
|
|
58
53
|
export const registerRect3dGraphic = () => {
|
|
@@ -68,7 +63,7 @@ export const registerShapeGraphic = () => {
|
|
|
68
63
|
};
|
|
69
64
|
|
|
70
65
|
export const registerSymbolGraphic = () => {
|
|
71
|
-
registerShadowRoot(), registerSymbol(),
|
|
66
|
+
registerShadowRoot(), registerSymbol(), Factory.registerGraphic(GrammarMarkType.symbol, createSymbol);
|
|
72
67
|
};
|
|
73
68
|
|
|
74
69
|
export const registerTextGraphic = () => {
|
|
@@ -84,12 +79,11 @@ export const registerRichTextGraphic = () => {
|
|
|
84
79
|
};
|
|
85
80
|
|
|
86
81
|
export const registerCellGraphic = () => {
|
|
87
|
-
registerShadowRoot(), registerSymbol(),
|
|
82
|
+
registerShadowRoot(), registerSymbol(), Factory.registerGraphic(GrammarMarkType.cell, createSymbol);
|
|
88
83
|
};
|
|
89
84
|
|
|
90
85
|
export const registerIntervalGraphic = () => {
|
|
91
|
-
registerShadowRoot(), registerRect(),
|
|
92
|
-
Factory.registerGraphic(GrammarMarkType.interval, createRect);
|
|
86
|
+
registerShadowRoot(), registerRect(), registerArc(), Factory.registerGraphic(GrammarMarkType.interval, createRect);
|
|
93
87
|
};
|
|
94
88
|
|
|
95
89
|
export const registerGlyphGraphic = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/mark/graphic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACL,cAAc,EACd,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EACnB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,WAAW,EACX,WAAW,EACX,YAAY,EACZ,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,EACZ,UAAU,EACV,aAAa,EACb,cAAc,EACd,WAAW,EACZ,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/graph/mark/graphic.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACL,cAAc,EACd,WAAW,EACX,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,aAAa,EACb,cA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IACtC,kBAAkB,EAAE,CAAC;IACrB,cAAc,EAAE,CAAC;IACjB,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,GAAG,EAAE;IAC1C,kBAAkB,EAAE,CAAC;IACrB,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAChE,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACvC,kBAAkB,EAAE,CAAC;IACrB,aAAa,EAAE,CAAC;IAChB,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AAC9D,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG,GAAG,EAAE;IAC5C,kBAAkB,EAAE,CAAC;IACrB,YAAY,EAAE,CAAC;IACf,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC,KAAU,EAAE,EAAE;QACjE,OAAO,IAAI,UAAU,CAAC,KAAK,CAAwB,CAAC;IACtD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,GAAG,EAAE;IAC9C,kBAAkB,EAAE,CAAC;IACrB,YAAY,EAAE,CAAC;IACf,OAAO,CAAC,eAAe,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC,KAAU,EAAE,EAAE;QACnE,OAAO,IAAI,YAAY,CAAC,KAAK,CAAwB,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC","file":"graphic.js","sourcesContent":["import { Factory } from '../../core/factory';\nimport { GrammarMarkType } from '../enums';\nimport { LargeRects } from './large-rects';\nimport { LargeSymbols } from './large-symbols';\nimport type { IGraphic } from '@visactor/vrender-core';\nimport {\n registerCircle,\n registerArc,\n registerArc3d,\n registerPyramid3d,\n registerArea,\n registerGroup,\n registerImage,\n registerRect3d,\n registerLine,\n registerPath,\n registerRect,\n registerSymbol,\n registerText,\n registerPolygon,\n registerRichtext,\n registerGlyph,\n registerShadowRoot\n} from '@visactor/vrender-kits';\nimport {\n createArc,\n createCircle,\n createArc3d,\n createPyramid3d,\n createArea,\n createGroup,\n createImage,\n createRect3d,\n createLine,\n createPath,\n createRect,\n createSymbol,\n createText,\n createPolygon,\n createRichText,\n createGlyph\n} from '@visactor/vrender-core';\n\nexport const registerCircleGraphic = () => {\n registerShadowRoot();\n registerCircle();\n Factory.registerGraphic(GrammarMarkType.circle, createCircle);\n};\n\nexport const registerArcGraphic = () => {\n registerShadowRoot();\n registerArc();\n Factory.registerGraphic(GrammarMarkType.arc, createArc);\n};\n\nexport const registerArc3dGraphic = () => {\n registerShadowRoot();\n registerArc3d();\n Factory.registerGraphic(GrammarMarkType.arc3d, createArc3d);\n};\n\nexport const registerPyramid3dGraphic = () => {\n registerShadowRoot();\n registerPyramid3d();\n Factory.registerGraphic(GrammarMarkType.pyramid3d, createPyramid3d);\n};\n\nexport const registerAreaGraphic = () => {\n registerShadowRoot();\n registerArea();\n Factory.registerGraphic(GrammarMarkType.area, createArea);\n};\n\nexport const registerGroupGraphic = () => {\n registerShadowRoot();\n registerGroup();\n Factory.registerGraphic(GrammarMarkType.group, createGroup);\n};\n\nexport const registerImageGraphic = () => {\n registerShadowRoot();\n registerImage();\n Factory.registerGraphic(GrammarMarkType.image, createImage);\n};\n\nexport const registerLineGraphic = () => {\n registerShadowRoot();\n registerLine();\n Factory.registerGraphic(GrammarMarkType.line, createLine);\n};\n\nexport const registerPathGraphic = () => {\n registerShadowRoot();\n registerPath();\n Factory.registerGraphic(GrammarMarkType.path, createPath);\n};\n\nexport const registerRectGraphic = () => {\n registerShadowRoot();\n registerRect();\n Factory.registerGraphic(GrammarMarkType.rect, createRect);\n};\n\nexport const registerRect3dGraphic = () => {\n registerShadowRoot();\n registerRect3d();\n Factory.registerGraphic(GrammarMarkType.rect3d, createRect3d);\n};\n\nexport const registerRuleGraphic = () => {\n registerShadowRoot();\n registerLine();\n Factory.registerGraphic(GrammarMarkType.rule, createLine);\n};\n\nexport const registerShapeGraphic = () => {\n registerShadowRoot();\n registerPath();\n Factory.registerGraphic(GrammarMarkType.shape, createPath);\n};\n\nexport const registerSymbolGraphic = () => {\n registerShadowRoot();\n registerSymbol();\n Factory.registerGraphic(GrammarMarkType.symbol, createSymbol);\n};\n\nexport const registerTextGraphic = () => {\n registerShadowRoot();\n registerText();\n registerRichtext();\n Factory.registerGraphic(GrammarMarkType.text, createText);\n};\n\nexport const registerPolygonGraphic = () => {\n registerShadowRoot();\n registerPolygon();\n Factory.registerGraphic(GrammarMarkType.polygon, createPolygon);\n};\n\nexport const registerRichTextGraphic = () => {\n registerShadowRoot();\n registerRichtext();\n Factory.registerGraphic(GrammarMarkType.richtext, createRichText);\n};\n\nexport const registerCellGraphic = () => {\n registerShadowRoot();\n registerSymbol();\n Factory.registerGraphic(GrammarMarkType.cell, createSymbol);\n};\n\nexport const registerIntervalGraphic = () => {\n registerShadowRoot();\n registerRect();\n registerArc();\n Factory.registerGraphic(GrammarMarkType.interval, createRect);\n};\n\nexport const registerGlyphGraphic = () => {\n registerShadowRoot();\n registerGlyph();\n Factory.registerGraphic(GrammarMarkType.glyph, createGlyph);\n};\n\nexport const registerLargeRectsGraphic = () => {\n registerShadowRoot();\n registerPath();\n Factory.registerGraphic(GrammarMarkType.largeRects, (attrs: any) => {\n return new LargeRects(attrs) as unknown as IGraphic;\n });\n};\n\nexport const registerLargeSymbolsGraphic = () => {\n registerShadowRoot();\n registerPath();\n Factory.registerGraphic(GrammarMarkType.largeSymbols, (attrs: any) => {\n return new LargeSymbols(attrs) as unknown as IGraphic;\n });\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { GrammarMarkType } from "../enums";
|
|
2
|
+
|
|
3
|
+
import { Element } from "../element";
|
|
4
|
+
|
|
5
|
+
import { GlyphElement } from "../glyph-element";
|
|
6
|
+
|
|
7
|
+
export const createElement = mark => mark.markType === GrammarMarkType.glyph ? new GlyphElement(mark) : new Element(mark);
|
|
8
|
+
//# sourceMappingURL=element.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/graph/util/element.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAEhD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAW,EAAY,EAAE;IACrD,IAAI,IAAI,CAAC,QAAQ,KAAK,eAAe,CAAC,KAAK,EAAE;QAC3C,OAAO,IAAI,YAAY,CAAC,IAAkB,CAAC,CAAC;KAC7C;IACD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC,CAAC","file":"element.js","sourcesContent":["import type { IElement, IGlyphMark, IMark } from '../../types';\nimport { GrammarMarkType } from '../enums';\nimport { Element } from '../element';\nimport { GlyphElement } from '../glyph-element';\n\nexport const createElement = (mark: IMark): IElement => {\n if (mark.markType === GrammarMarkType.glyph) {\n return new GlyphElement(mark as IGlyphMark);\n }\n return new Element(mark);\n};\n"]}
|
package/es/graph/util/point.js
CHANGED
|
@@ -24,6 +24,17 @@ function getOffsetPos(e) {
|
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
function getBoundingClientRectPos(e, el) {
|
|
28
|
+
const result = {
|
|
29
|
+
canvasX: 0,
|
|
30
|
+
canvasY: 0
|
|
31
|
+
}, rect = el.getBoundingClientRect(), currentWidth = rect.width, widthRatio = currentWidth / (el.offsetWidth || currentWidth), currentHeight = rect.height, heightRatio = currentHeight / (el.offsetHeight || currentHeight);
|
|
32
|
+
return [ "touchstart", "touchmove", "touchend" ].includes(e.type) && e.changedTouches && e.changedTouches.length ? (result.canvasX = (e.changedTouches[0].clientX - rect.left - (el.clientLeft || 0)) / widthRatio,
|
|
33
|
+
result.canvasY = (e.changedTouches[0].clientY - rect.top - (el.clientTop || 0)) / heightRatio,
|
|
34
|
+
result.clientX = e.changedTouches[0].clientX, result.clientY = e.changedTouches[0].clientY) : (result.canvasX = (e.clientX - rect.left - (el.clientLeft || 0)) / widthRatio,
|
|
35
|
+
result.canvasY = (e.clientY - rect.top - (el.clientTop || 0)) / heightRatio), result;
|
|
36
|
+
}
|
|
37
|
+
|
|
27
38
|
function getXYPos(e) {
|
|
28
39
|
return {
|
|
29
40
|
canvasX: e.x,
|
|
@@ -32,20 +43,25 @@ function getXYPos(e) {
|
|
|
32
43
|
}
|
|
33
44
|
|
|
34
45
|
function getChangedTouchesPos(e) {
|
|
35
|
-
const pos = e.changedTouches[0];
|
|
36
46
|
return {
|
|
37
|
-
canvasX:
|
|
38
|
-
canvasY:
|
|
47
|
+
canvasX: e.changedTouches[0].x,
|
|
48
|
+
canvasY: e.changedTouches[0].y
|
|
39
49
|
};
|
|
40
50
|
}
|
|
41
51
|
|
|
42
52
|
function defineSrPosition(event, pos, client = !0) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
})
|
|
53
|
+
return isValidNumber(pos.canvasX) && Object.defineProperty(event, "canvasX", {
|
|
54
|
+
value: pos.canvasX,
|
|
55
|
+
writable: !0
|
|
56
|
+
}), isValidNumber(pos.canvasY) && Object.defineProperty(event, "canvasY", {
|
|
57
|
+
value: pos.canvasY,
|
|
58
|
+
writable: !0
|
|
59
|
+
}), client && isValidNumber(pos.clientX) && Object.defineProperty(event, "clientX", {
|
|
60
|
+
value: pos.clientX,
|
|
61
|
+
writable: !0
|
|
62
|
+
}), client && isValidNumber(pos.clientY) && Object.defineProperty(event, "clientY", {
|
|
63
|
+
value: pos.clientY,
|
|
64
|
+
writable: !0
|
|
65
|
+
}), [ pos.canvasX, pos.canvasY ];
|
|
50
66
|
}
|
|
51
67
|
//# sourceMappingURL=point.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/graph/util/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AASxD,MAAM,UAAU,KAAK,CAAC,KAAY;IAChC,CAAC,SAAS,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;QAChE,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE;YAC7C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBAC1C,MAAM,aAAa,GAAG,aAAa,CAAC,KAAc,CAAC,CAAC;gBACpD,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;SACJ;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,aAAa,CAAC,CAAQ;IAE7B,IAAI,CAAC,KAAK,CAAE,CAAS,CAAC,OAAO,CAAC,EAAE;QAC9B,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC;KACxB;
|
|
1
|
+
{"version":3,"sources":["../src/graph/util/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AASxD,MAAM,UAAU,KAAK,CAAC,KAAY;IAChC,CAAC,SAAS,EAAE,gBAAgB,EAAE,eAAe,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;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AG,CAAC,OAAO;YAClB,QAAQ,EAAE,IAAI;SACf,CAAC,CAAC;IACL,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;AACpC,CAAC","file":"point.js","sourcesContent":["import { isValidNumber, isNil } from '@visactor/vutils';\n\ninterface EventPosition {\n canvasX: number;\n canvasY: number;\n clientX?: number;\n clientY?: number;\n}\n\nexport function point(event: Event) {\n ['touches', 'changedTouches', 'targetTouches'].forEach(touchKey => {\n if (event[touchKey] && event[touchKey].length) {\n Array.from(event[touchKey]).forEach(touch => {\n const touchPosition = clientToLocal(touch as Event);\n defineSrPosition(touch, touchPosition, false);\n });\n }\n });\n\n const pos = clientToLocal(event);\n return defineSrPosition(event, pos);\n}\n\nfunction clientToLocal(e: Event): EventPosition {\n // For IE6+, chrome, safari, opera. (When will ff support offsetX?)\n if (!isNil((e as any).offsetX)) {\n return getOffsetPos(e);\n }\n\n // if (el && el.getBoundingClientRect) {\n // return getBoundingClientRectPos(e, el);\n // }\n\n // for miniApp\n if (!isNil((e as any).x)) {\n return getXYPos(e);\n }\n\n // for miniApp\n if ((e as any).changedTouches && (e as any).changedTouches.length) {\n return getChangedTouchesPos(e);\n }\n\n // For some other device, e.g., IOS safari.\n return {\n canvasX: 0,\n canvasY: 0\n };\n}\n\nfunction getOffsetPos(e: any) {\n return {\n canvasX: e.offsetX,\n canvasY: e.offsetY\n };\n}\n\nfunction getBoundingClientRectPos(e: any, el: HTMLElement) {\n const result: EventPosition = { canvasX: 0, canvasY: 0 };\n const rect = el.getBoundingClientRect();\n const currentWidth = rect.width;\n const originWidth = el.offsetWidth || currentWidth;\n const widthRatio = currentWidth / originWidth;\n const currentHeight = rect.height;\n const originHeight = el.offsetHeight || currentHeight;\n const heightRatio = currentHeight / originHeight;\n if (['touchstart', 'touchmove', 'touchend'].includes(e.type) && e.changedTouches && e.changedTouches.length) {\n result.canvasX = (e.changedTouches[0].clientX - rect.left - (el.clientLeft || 0)) / widthRatio;\n result.canvasY = (e.changedTouches[0].clientY - rect.top - (el.clientTop || 0)) / heightRatio;\n result.clientX = e.changedTouches[0].clientX;\n result.clientY = e.changedTouches[0].clientY;\n } else {\n result.canvasX = (e.clientX - rect.left - (el.clientLeft || 0)) / widthRatio;\n result.canvasY = (e.clientY - rect.top - (el.clientTop || 0)) / heightRatio;\n }\n return result;\n}\n\nfunction getXYPos(e: any) {\n return { canvasX: e.x, canvasY: e.y };\n}\n\nfunction getChangedTouchesPos(e: any) {\n return { canvasX: e.changedTouches[0].x, canvasY: e.changedTouches[0].y };\n}\n\nfunction defineSrPosition(event: any, pos: EventPosition, client = true) {\n isValidNumber(pos.canvasX) &&\n Object.defineProperty(event, 'canvasX', {\n value: pos.canvasX,\n writable: true\n });\n isValidNumber(pos.canvasY) &&\n Object.defineProperty(event, 'canvasY', {\n value: pos.canvasY,\n writable: true\n });\n client &&\n isValidNumber(pos.clientX) &&\n Object.defineProperty(event, 'clientX', {\n value: pos.clientX,\n writable: true\n });\n client &&\n isValidNumber(pos.clientY) &&\n Object.defineProperty(event, 'clientY', {\n value: pos.clientY,\n writable: true\n });\n return [pos.canvasX, pos.canvasY];\n}\n"]}
|
package/es/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const version = "0.14.0-alpha.
|
|
1
|
+
export declare const version = "0.14.0-alpha.3";
|
|
2
2
|
export * from './graph';
|
|
3
3
|
export * from './interactions';
|
|
4
4
|
export { View } from './view';
|
|
@@ -10,8 +10,6 @@ export * from './util/text';
|
|
|
10
10
|
export * from './types';
|
|
11
11
|
export { Factory } from './core/factory';
|
|
12
12
|
export { SIGNAL_AUTOFIT, SIGNAL_HEIGHT, SIGNAL_PADDING, SIGNAL_VIEW_HEIGHT, SIGNAL_VIEW_WIDTH, SIGNAL_WIDTH, SIGNAL_VIEW_BOX } from './view/constants';
|
|
13
|
-
export { registerViewEventsAPI } from './view/view-event-mixin';
|
|
14
|
-
export { registerViewMorphAPI } from './view/view-morph-mixin';
|
|
15
13
|
export { ThemeManager } from './theme/theme-manager';
|
|
16
14
|
export * from './glyph';
|
|
17
15
|
export * from './component';
|
|
@@ -23,8 +21,3 @@ export * from './interactions';
|
|
|
23
21
|
export * from './semantic-marks/cell';
|
|
24
22
|
export * from './semantic-marks/interval';
|
|
25
23
|
export * from './graph/mark/graphic';
|
|
26
|
-
export { registerDefaultLayout, defaultDoLayout } from './graph/layout/layout';
|
|
27
|
-
export { registerGlyphMark, GlyphMark } from './view/glyph';
|
|
28
|
-
export declare const registerDragPlugin: () => void;
|
|
29
|
-
export declare const registerGesturePlugin: () => void;
|
|
30
|
-
export declare const registerAnimate: () => void;
|
package/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export const version = "0.14.0-alpha.
|
|
1
|
+
export const version = "0.14.0-alpha.3";
|
|
2
2
|
|
|
3
3
|
export * from "./graph";
|
|
4
4
|
|
|
@@ -22,10 +22,6 @@ export { Factory } from "./core/factory";
|
|
|
22
22
|
|
|
23
23
|
export { SIGNAL_AUTOFIT, SIGNAL_HEIGHT, SIGNAL_PADDING, SIGNAL_VIEW_HEIGHT, SIGNAL_VIEW_WIDTH, SIGNAL_WIDTH, SIGNAL_VIEW_BOX } from "./view/constants";
|
|
24
24
|
|
|
25
|
-
export { registerViewEventsAPI } from "./view/view-event-mixin";
|
|
26
|
-
|
|
27
|
-
export { registerViewMorphAPI } from "./view/view-morph-mixin";
|
|
28
|
-
|
|
29
25
|
export { ThemeManager } from "./theme/theme-manager";
|
|
30
26
|
|
|
31
27
|
export * from "./glyph";
|
|
@@ -47,28 +43,4 @@ export * from "./semantic-marks/cell";
|
|
|
47
43
|
export * from "./semantic-marks/interval";
|
|
48
44
|
|
|
49
45
|
export * from "./graph/mark/graphic";
|
|
50
|
-
|
|
51
|
-
export { registerDefaultLayout, defaultDoLayout } from "./graph/layout/layout";
|
|
52
|
-
|
|
53
|
-
export { registerGlyphMark, GlyphMark } from "./view/glyph";
|
|
54
|
-
|
|
55
|
-
import { DragNDrop, Gesture } from "@visactor/vrender-kits";
|
|
56
|
-
|
|
57
|
-
import { Factory } from "./core/factory";
|
|
58
|
-
|
|
59
|
-
export const registerDragPlugin = () => {
|
|
60
|
-
Factory.registerStageEventPlugin("drag", DragNDrop);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export const registerGesturePlugin = () => {
|
|
64
|
-
Factory.registerStageEventPlugin("gesture", Gesture);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
import { registerViewAnimateAPI } from "./view/view-animate-mixin";
|
|
68
|
-
|
|
69
|
-
import { registerMarkAnimateAPI } from "./view/mark-animate-mixin";
|
|
70
|
-
|
|
71
|
-
export const registerAnimate = () => {
|
|
72
|
-
registerViewAnimateAPI(), registerMarkAnimateAPI();
|
|
73
|
-
};
|
|
74
46
|
//# sourceMappingURL=index.js.map
|
package/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAC;AAExC,cAAc,SAAS,CAAC;AAExB,cAAc,gBAAgB,CAAC;AAE/B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EACL,cAAc,EACd,aAAa,EACb,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,6BAA6B,CAAC;AAE5C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,sBAAsB,CAAC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.14.0-alpha.3\";\n\nexport * from './graph';\n\nexport * from './interactions';\n\nexport { View } from './view';\nexport { Scale, registerScale } from './view/scale';\nexport { Coordinate, registerCoordinate } from './view/coordinate';\nexport { parseFunctionType, invokeFunctionType } from './parse/util';\nexport { GrammarBase } from './view/grammar-base';\nexport * from './util/text';\nexport * from './types';\nexport { Factory } from './core/factory';\nexport {\n SIGNAL_AUTOFIT,\n SIGNAL_HEIGHT,\n SIGNAL_PADDING,\n SIGNAL_VIEW_HEIGHT,\n SIGNAL_VIEW_WIDTH,\n SIGNAL_WIDTH,\n SIGNAL_VIEW_BOX\n} from './view/constants';\n\nexport { ThemeManager } from './theme/theme-manager';\n\nexport * from './glyph';\nexport * from './component';\nexport * from './transforms';\nexport * from './graph/animation/animation';\n\nexport { vglobal } from '@visactor/vrender-core';\nexport * from './env';\nexport * from './interactions';\nexport * from './semantic-marks/cell';\nexport * from './semantic-marks/interval';\nexport * from './graph/mark/graphic';\n"]}
|
package/es/parse/event.d.ts
CHANGED
|
@@ -5,4 +5,6 @@ export declare const parseHandler: (callback: EventCallback, config: {
|
|
|
5
5
|
debounce?: number;
|
|
6
6
|
throttle?: number;
|
|
7
7
|
}) => (...args: any[]) => any;
|
|
8
|
+
export declare const NAME_PREFIX = "@";
|
|
9
|
+
export declare const ID_PREFIX = "#";
|
|
8
10
|
export declare const parseEventSelector: (selector: string, source?: EventSourceType) => Partial<ParsedViewEventSpec | ParsedWindowEventSpec>;
|
package/es/parse/event.js
CHANGED
|
@@ -2,19 +2,23 @@ import { debounce, isNil, throttle } from "@visactor/vutils";
|
|
|
2
2
|
|
|
3
3
|
import { isMarkType } from "../graph/util/graphic";
|
|
4
4
|
|
|
5
|
-
import { EVENT_SOURCE_VIEW, EVENT_SOURCE_WINDOW
|
|
5
|
+
import { EVENT_SOURCE_VIEW, EVENT_SOURCE_WINDOW } from "../view/constants";
|
|
6
6
|
|
|
7
|
-
export const generateFilterByMark = evtSpec => isNil(evtSpec.markId) ?
|
|
7
|
+
export const generateFilterByMark = evtSpec => isNil(evtSpec.markId) ? el => el && el.mark.id() === evtSpec.markId : isNil(evtSpec.markName) ? el => el && el.mark.name() === evtSpec.markName : isNil(evtSpec.type) ? el => el && el.mark.markType === evtSpec.type : () => !0;
|
|
8
8
|
|
|
9
9
|
export const parseHandler = (callback, config) => config && config.debounce ? debounce(callback, config.debounce) : config && config.throttle ? throttle(callback, config.throttle) : callback;
|
|
10
10
|
|
|
11
11
|
const JOIN_SYMBOL = ":";
|
|
12
12
|
|
|
13
|
+
export const NAME_PREFIX = "@";
|
|
14
|
+
|
|
15
|
+
export const ID_PREFIX = "#";
|
|
16
|
+
|
|
13
17
|
export const parseEventSelector = (selector, source = EVENT_SOURCE_VIEW) => {
|
|
14
18
|
const spec = {}, splitArr = selector.split(":");
|
|
15
19
|
if (2 === splitArr.length) {
|
|
16
20
|
const [space, eventType] = splitArr;
|
|
17
|
-
space[0]
|
|
21
|
+
"#" === space[0] ? (spec.markId = space.slice(1), spec.source = source) : "@" === space[0] ? (spec.markName = space.slice(1),
|
|
18
22
|
spec.source = source) : isMarkType(space) ? (spec.markType = space, spec.source = source) : spec.source = space === EVENT_SOURCE_WINDOW ? EVENT_SOURCE_WINDOW : source,
|
|
19
23
|
spec.type = eventType;
|
|
20
24
|
} else 1 === splitArr.length && (spec.type = selector, spec.source = source);
|
package/es/parse/event.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/parse/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAS7D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"sources":["../src/parse/event.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAS7D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE3E,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,OA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,QAAgB,EAChB,SAA0B,iBAAiB,EACW,EAAE;IACxD,MAAM,IAAI,GAAyD,EAAE,CAAC;IAEtE,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAE7C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QACzB,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC;QAEpC,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;YAE1B,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC7B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;aAAM,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,WAAW,EAAE;YAEnC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;aAAM,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE;YAC5B,IAAI,CAAC,QAAQ,GAAG,KAAiB,CAAC;YAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;aAAM,IAAI,KAAK,KAAK,mBAAmB,EAAE;YACxC,IAAI,CAAC,MAAM,GAAG,mBAAmB,CAAC;SACnC;aAAM;YACL,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;QAED,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;KACvB;SAAM,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QAChC,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;KACtB;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC","file":"event.js","sourcesContent":["import { debounce, isNil, throttle } from '@visactor/vutils';\nimport type {\n EventSourceType,\n ParsedViewEventSpec,\n ParsedWindowEventSpec,\n EventCallback,\n MarkType,\n IElement\n} from '../types';\nimport { isMarkType } from '../graph/util/graphic';\nimport { EVENT_SOURCE_VIEW, EVENT_SOURCE_WINDOW } from '../view/constants';\n\nexport const generateFilterByMark = (evtSpec: Partial<ParsedViewEventSpec | ParsedWindowEventSpec>) => {\n if (isNil(evtSpec.markId)) {\n return (el: IElement) => {\n return el && el.mark.id() === evtSpec.markId;\n };\n }\n\n if (isNil(evtSpec.markName)) {\n return (el: IElement) => {\n return el && el.mark.name() === evtSpec.markName;\n };\n }\n\n if (isNil(evtSpec.type)) {\n return (el: IElement) => {\n return el && el.mark.markType === evtSpec.type;\n };\n }\n\n return () => true;\n};\n\nexport const parseHandler = (callback: EventCallback, config: { debounce?: number; throttle?: number }) => {\n if (config && config.debounce) {\n return debounce(callback, config.debounce);\n }\n\n if (config && config.throttle) {\n return throttle(callback, config.throttle);\n }\n\n return callback;\n};\n\nconst JOIN_SYMBOL = ':';\nexport const NAME_PREFIX = '@';\nexport const ID_PREFIX = '#';\n\n/**\n * Parse an event selector string.\n * Supported rules:\n * 1. mousedown\n * 2. rect:mousedown\n * 3. window:mousemove\n * 4. @foo:mousedown\n * Returns an event stream definitions.\n */\nexport const parseEventSelector = (\n selector: string,\n source: EventSourceType = EVENT_SOURCE_VIEW\n): Partial<ParsedViewEventSpec | ParsedWindowEventSpec> => {\n const spec: Partial<ParsedViewEventSpec | ParsedWindowEventSpec> = {};\n\n const splitArr = selector.split(JOIN_SYMBOL);\n\n if (splitArr.length === 2) {\n const [space, eventType] = splitArr;\n\n if (space[0] === ID_PREFIX) {\n // events on marks id\n spec.markId = space.slice(1);\n spec.source = source;\n } else if (space[0] === NAME_PREFIX) {\n // events on marks name\n spec.markName = space.slice(1);\n spec.source = source;\n } else if (isMarkType(space)) {\n spec.markType = space as MarkType;\n spec.source = source;\n } else if (space === EVENT_SOURCE_WINDOW) {\n spec.source = EVENT_SOURCE_WINDOW;\n } else {\n spec.source = source;\n }\n\n spec.type = eventType;\n } else if (splitArr.length === 1) {\n spec.type = selector;\n spec.source = source;\n }\n\n return spec;\n};\n"]}
|
package/es/parse/option.js
CHANGED
|
@@ -7,4 +7,5 @@ export const parseOptionValue = (value, params) => isGrammar(value) ? value.outp
|
|
|
7
7
|
export const parseOptions = (options, params) => options ? isObject(options) ? Object.keys(options).reduce(((res, key) => {
|
|
8
8
|
const option = options[key];
|
|
9
9
|
return res[key] = parseOptionValue(option, params), res;
|
|
10
|
-
}), {}) : options.map((option => parseOptionValue(option, params))) : options;
|
|
10
|
+
}), {}) : options.map((option => parseOptionValue(option, params))) : options;
|
|
11
|
+
//# sourceMappingURL=option.js.map
|
package/es/parse/scale.js
CHANGED