@visactor/vgrammar-core 0.13.15 → 0.13.16-alpha.1

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.
@@ -10,7 +10,12 @@ vrender_core_1.Animate.mode |= vrender_core_1.AnimateMode.SET_ATTR_IMMEDIATELY;
10
10
 
11
11
  let GlobalAnimatorId = 0;
12
12
 
13
- const isCustomAnimateCtor = custom => !(0, vutils_1.isNil)(custom) && !(0, vutils_1.isNil)(custom.prototype) && (custom.prototype instanceof vrender_core_1.ACustomAnimate || "onBind" in custom.prototype && "onStart" in custom.prototype && "onEnd" in custom.prototype && "onUpdate" in custom.prototype);
13
+ const isCustomAnimateCtor = custom => {
14
+ var _a;
15
+ if ((0, vutils_1.isNil)(custom) || (0, vutils_1.isNil)(custom.prototype)) return !1;
16
+ const prototype = null !== (_a = custom.prototype) && void 0 !== _a ? _a : {};
17
+ return prototype instanceof vrender_core_1.ACustomAnimate || "onBind" in prototype && "onStart" in prototype && "onEnd" in prototype && "onUpdate" in prototype;
18
+ };
14
19
 
15
20
  class Animator {
16
21
  constructor(element, unit, animationOptions) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/animation/animator.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAGxD,yDAA4F;AAa5F,2CAAwH;AAExH,sBAAO,CAAC,IAAI,IAAI,0BAAW,CAAC,oBAAoB,CAAC;AAEjD,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,MAAoE,EAAE,EAAE;IACnG,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC5C,OAAO,KAAK,CAAC;KACd;IACD,OAAO,CACL,MAAM,CAAC,SAAS,YAAY,6BAAc;QAE1C,CAAC,QAAQ,IAAI,MAAM,CAAC,SAAS;YAC3B,SAAS,IAAI,MAAM,CAAC,SAAS;YAC7B,O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C,MAAM,GAAG,CAAC,EAAE;gBACpC,cAAc,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;aACjE;SACF;QAED,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjC;IACH,CAAC;CACF;AArMD,4BAqMC","file":"animator.js","sourcesContent":["import { isNil, isValidNumber } from '@visactor/vutils';\nimport type { IAnimate as IGraphicAnimate } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, Animate, AnimateGroup, AnimateMode } from '@visactor/vrender-core';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationCustomConstructor,\n IAnimationTimeline,\n IAnimator,\n IAnimatorOptions,\n IAnimationUnit,\n IAnimationParameters,\n IAnimationTimeSlice,\n IElement,\n IAnimationEffect\n} from '../../types';\nimport { AttributeAnimate, channelAnimationAttributes, CustomInterpolator, typeAnimationAttributes } from './attribute';\n\nAnimate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nlet GlobalAnimatorId = 0;\n\nconst isCustomAnimateCtor = (custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor) => {\n if (isNil(custom) || isNil(custom.prototype)) {\n return false;\n }\n return (\n custom.prototype instanceof ACustomAnimate ||\n // similar to ACustomAnimate, apply for different vrender version\n ('onBind' in custom.prototype &&\n 'onStart' in custom.prototype &&\n 'onEnd' in custom.prototype &&\n 'onUpdate' in custom.prototype)\n );\n};\n\nexport class Animator implements IAnimator {\n id: number = GlobalAnimatorId++;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean = false;\n\n private unit: IAnimationUnit;\n private runnings: IGraphicAnimate[] = [];\n private callbackFunction: (...args: any[]) => any;\n\n constructor(\n element: IElement,\n unit: IAnimationUnit,\n animationOptions: {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n }\n ) {\n this.element = element;\n this.animationOptions = animationOptions;\n this.unit = unit;\n }\n\n callback(callbackFunction: (...args: any[]) => void): this {\n this.callbackFunction = callbackFunction;\n return this;\n }\n\n animate(animationParameters: IAnimationParameters, parameters: any): this {\n this.isAnimating = true;\n\n this.animateElement(animationParameters, parameters);\n\n // if no valid running, end animating immediately\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n return this;\n }\n\n stop(stopState: 'start' | 'end' = 'end', invokeCallback: boolean = true): this {\n // FIXME: wait for VRender to fix 'end' parameter\n this.runnings.forEach(running => running.stop(stopState));\n this.animationEnd(invokeCallback);\n return this;\n }\n\n pause(): this {\n this.runnings.forEach(running => running.pause());\n return this;\n }\n\n resume(): this {\n this.runnings.forEach(running => running.resume());\n return this;\n }\n\n startAt(startTime: number): this {\n this.runnings.forEach(running => {\n const initialDelay = this.unit.initialDelay;\n running.startAt(initialDelay + startTime);\n });\n return this;\n }\n\n getTotalAnimationTime() {\n const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;\n return this.unit.totalTime ?? timeLineDuration;\n }\n\n getEndAttributes() {\n return this.runnings.reduce((attributes, running) => {\n return Object.assign(attributes, running.getEndProps());\n }, {} as Record<string, any>);\n }\n\n private animationEnd(invokeCallback: boolean = true) {\n this.isAnimating = false;\n this.runnings = null;\n if (invokeCallback) {\n this.callbackFunction?.call(null);\n }\n }\n\n private animateElement(animationParameters: IAnimationParameters, parameters: any) {\n const graphicItem = this.element.getGraphicItem();\n\n if (!graphicItem) {\n return;\n }\n\n const graphicAnimate: IGraphicAnimate = graphicItem.animate();\n this.runnings.push(graphicAnimate);\n // initialDelay is only used at first loop\n graphicAnimate.startAt(this.unit.initialDelay);\n // execute loop animation\n graphicAnimate.wait(this.unit.loopDelay);\n this.unit.timeSlices.forEach(timeSlice => {\n this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);\n });\n graphicAnimate.wait(this.unit.loopDelayAfter);\n\n graphicAnimate.loop(this.unit.loopCount - 1);\n\n if (isValidNumber(this.unit.totalTime)) {\n // FIXME: use VRender api instead after VRender refactor is finished\n setTimeout(() => {\n if (graphicAnimate) {\n graphicAnimate.stop('end');\n }\n }, this.unit.totalTime);\n }\n\n graphicAnimate.onEnd(() => {\n this.runnings = this.runnings.filter(running => running !== graphicAnimate);\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n });\n }\n\n private animateTimeSlice(\n graphicAnimate: IGraphicAnimate,\n timeSlice: IAnimationTimeSlice,\n animationParameters: IAnimationParameters,\n parameters: any\n ) {\n const delay = timeSlice.delay as number;\n const delayAfter = timeSlice.delayAfter as number;\n const duration = timeSlice.duration as number;\n const effects = timeSlice.effects as IAnimationEffect[];\n\n // wait in loop animation before animation starts\n if (delay > 0) {\n graphicAnimate.wait(delay);\n }\n\n if (effects.length < 0) {\n graphicAnimate.wait(duration);\n } else {\n const customAnimates = effects\n .map((effect, index) => {\n const attributes =\n (effect.type\n ? typeAnimationAttributes(this.element, effect, animationParameters, parameters)\n : effect.channel\n ? channelAnimationAttributes(this.element, effect, animationParameters, parameters)\n : undefined) ?? {};\n\n const customOption = attributes.custom || effect?.custom;\n const customParametersOption = attributes?.customParameters || effect?.customParameters;\n\n if (\n attributes.from &&\n Object.keys(attributes.from).length &&\n this.unit &&\n this.animationOptions.timeline.controlOptions.immediatelyApply &&\n this.element.mark.markType !== 'component'\n ) {\n this.element.getGraphicItem().setAttributes(attributes.from);\n }\n\n const isCustomAnimate = isCustomAnimateCtor(customOption);\n const isCustomInterpolator = !isNil(customOption) && !isCustomAnimateCtor(customOption);\n\n if (isCustomInterpolator) {\n return new CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {\n interpolator: customOption as IAnimationChannelInterpolator,\n element: this.element,\n parameters: customParametersOption\n });\n } else if (isCustomAnimate) {\n return new (customOption as IAnimationCustomConstructor)(\n attributes.from,\n attributes.to,\n duration,\n effect.easing,\n customParametersOption\n );\n } else if (attributes.to) {\n return new AttributeAnimate(attributes.from, attributes.to, duration, effect.easing);\n }\n })\n .filter(animate => !isNil(animate));\n\n if (customAnimates.length === 1) {\n graphicAnimate.play(customAnimates[0]);\n } else if (customAnimates.length > 1) {\n graphicAnimate.play(new AnimateGroup(duration, customAnimates));\n }\n }\n\n if (delayAfter > 0) {\n graphicAnimate.wait(delayAfter);\n }\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/graph/animation/animator.ts"],"names":[],"mappings":";;;AAAA,6CAAwD;AAGxD,yDAA4F;AAa5F,2CAAwH;AAExH,sBAAO,CAAC,IAAI,IAAI,0BAAW,CAAC,oBAAoB,CAAC;AAEjD,IAAI,gBAAgB,GAAG,CAAC,CAAC;AAEzB,MAAM,mBAAmB,GAAG,CAAC,MAAoE,EAAE,EAAE;;IACnG,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,IAAI,IAAA,cAAK,EAAC,MAAM,CAAC,SAAS,CAAC,EAAE;QAC5C,OAAO,KAAK,CAAC;KACd;IACD,MAAM,SAAS,GAAG,MAAA,MAAM,CAAC,SAAS,mCAAI,EAAE,CAAC;IACzC,OAAO,CACL,SAAS,YAAY,6BAAc;QAEnC,CAAC,QAAQ,IAAI,SAAS,IAAI,SAAS,IAAI,SAAS,IAAI,OAAO,IAAI,SAAS,IAAI,UAAU,IAAI,SAAS,CAAC,CACrG,CAAC;AACJ,CAAC,CAAC;AAEF,MAAa,QAAQ;IAUnB,YACE,OAAiB,EACjB,IAAoB,EACpB,gBAIC;QAhBH,OAAE,GAAW,gBAAgB,EAAE,CAAC;QAGhC,gBAAW,GAAY,KAAK,CAAC;QAGrB,aAAQ,GAAsB,EAAE,CAAC;QAYvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;IAED,QAAQ,CAAC,gBAA0C;QACjD,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;QACzC,OAAO,IAAI,CAAC;IACd,CAA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wBACrF,YAAY,EAAE,YAA6C;wBAC3D,OAAO,EAAE,IAAI,CAAC,OAAO;wBACrB,UAAU,EAAE,sBAAsB;qBACnC,CAAC,CAAC;iBACJ;qBAAM,IAAI,eAAe,EAAE;oBAC1B,OAAO,IAAK,YAA4C,CACtD,UAAU,CAAC,IAAI,EACf,UAAU,CAAC,EAAE,EACb,QAAQ,EACR,MAAM,CAAC,MAAM,EACb,sBAAsB,CACvB,CAAC;iBACH;qBAAM,IAAI,UAAU,CAAC,EAAE,EAAE;oBACxB,OAAO,IAAI,4BAAgB,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;iBACtF;YACH,CAAC,CAAC;iBACD,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,CAAC,CAAC;YAEtC,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC/B,cAAc,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;aACxC;iBAAM,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;gBACpC,cAAc,CAAC,IAAI,CAAC,IAAI,2BAAY,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC,CAAC;aACjE;SACF;QAED,IAAI,UAAU,GAAG,CAAC,EAAE;YAClB,cAAc,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACjC;IACH,CAAC;CACF;AArMD,4BAqMC","file":"animator.js","sourcesContent":["import { isNil, isValidNumber } from '@visactor/vutils';\nimport type { IAnimate as IGraphicAnimate } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { ACustomAnimate, Animate, AnimateGroup, AnimateMode } from '@visactor/vrender-core';\nimport type {\n IAnimationChannelInterpolator,\n IAnimationCustomConstructor,\n IAnimationTimeline,\n IAnimator,\n IAnimatorOptions,\n IAnimationUnit,\n IAnimationParameters,\n IAnimationTimeSlice,\n IElement,\n IAnimationEffect\n} from '../../types';\nimport { AttributeAnimate, channelAnimationAttributes, CustomInterpolator, typeAnimationAttributes } from './attribute';\n\nAnimate.mode |= AnimateMode.SET_ATTR_IMMEDIATELY;\n\nlet GlobalAnimatorId = 0;\n\nconst isCustomAnimateCtor = (custom?: IAnimationChannelInterpolator | IAnimationCustomConstructor) => {\n if (isNil(custom) || isNil(custom.prototype)) {\n return false;\n }\n const prototype = custom.prototype ?? {};\n return (\n prototype instanceof ACustomAnimate ||\n // similar to ACustomAnimate, apply for different vrender version\n ('onBind' in prototype && 'onStart' in prototype && 'onEnd' in prototype && 'onUpdate' in prototype)\n );\n};\n\nexport class Animator implements IAnimator {\n id: number = GlobalAnimatorId++;\n element: IElement;\n animationOptions: IAnimatorOptions;\n isAnimating: boolean = false;\n\n private unit: IAnimationUnit;\n private runnings: IGraphicAnimate[] = [];\n private callbackFunction: (...args: any[]) => any;\n\n constructor(\n element: IElement,\n unit: IAnimationUnit,\n animationOptions: {\n state: string;\n timeline: IAnimationTimeline;\n id: string;\n }\n ) {\n this.element = element;\n this.animationOptions = animationOptions;\n this.unit = unit;\n }\n\n callback(callbackFunction: (...args: any[]) => void): this {\n this.callbackFunction = callbackFunction;\n return this;\n }\n\n animate(animationParameters: IAnimationParameters, parameters: any): this {\n this.isAnimating = true;\n\n this.animateElement(animationParameters, parameters);\n\n // if no valid running, end animating immediately\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n return this;\n }\n\n stop(stopState: 'start' | 'end' = 'end', invokeCallback: boolean = true): this {\n // FIXME: wait for VRender to fix 'end' parameter\n this.runnings.forEach(running => running.stop(stopState));\n this.animationEnd(invokeCallback);\n return this;\n }\n\n pause(): this {\n this.runnings.forEach(running => running.pause());\n return this;\n }\n\n resume(): this {\n this.runnings.forEach(running => running.resume());\n return this;\n }\n\n startAt(startTime: number): this {\n this.runnings.forEach(running => {\n const initialDelay = this.unit.initialDelay;\n running.startAt(initialDelay + startTime);\n });\n return this;\n }\n\n getTotalAnimationTime() {\n const timeLineDuration = this.unit.initialDelay + this.unit.loopDuration * this.unit.loopCount;\n return this.unit.totalTime ?? timeLineDuration;\n }\n\n getEndAttributes() {\n return this.runnings.reduce((attributes, running) => {\n return Object.assign(attributes, running.getEndProps());\n }, {} as Record<string, any>);\n }\n\n private animationEnd(invokeCallback: boolean = true) {\n this.isAnimating = false;\n this.runnings = null;\n if (invokeCallback) {\n this.callbackFunction?.call(null);\n }\n }\n\n private animateElement(animationParameters: IAnimationParameters, parameters: any) {\n const graphicItem = this.element.getGraphicItem();\n\n if (!graphicItem) {\n return;\n }\n\n const graphicAnimate: IGraphicAnimate = graphicItem.animate();\n this.runnings.push(graphicAnimate);\n // initialDelay is only used at first loop\n graphicAnimate.startAt(this.unit.initialDelay);\n // execute loop animation\n graphicAnimate.wait(this.unit.loopDelay);\n this.unit.timeSlices.forEach(timeSlice => {\n this.animateTimeSlice(graphicAnimate, timeSlice, animationParameters, parameters);\n });\n graphicAnimate.wait(this.unit.loopDelayAfter);\n\n graphicAnimate.loop(this.unit.loopCount - 1);\n\n if (isValidNumber(this.unit.totalTime)) {\n // FIXME: use VRender api instead after VRender refactor is finished\n setTimeout(() => {\n if (graphicAnimate) {\n graphicAnimate.stop('end');\n }\n }, this.unit.totalTime);\n }\n\n graphicAnimate.onEnd(() => {\n this.runnings = this.runnings.filter(running => running !== graphicAnimate);\n if (this.runnings.length === 0) {\n this.animationEnd();\n }\n });\n }\n\n private animateTimeSlice(\n graphicAnimate: IGraphicAnimate,\n timeSlice: IAnimationTimeSlice,\n animationParameters: IAnimationParameters,\n parameters: any\n ) {\n const delay = timeSlice.delay as number;\n const delayAfter = timeSlice.delayAfter as number;\n const duration = timeSlice.duration as number;\n const effects = timeSlice.effects as IAnimationEffect[];\n\n // wait in loop animation before animation starts\n if (delay > 0) {\n graphicAnimate.wait(delay);\n }\n\n if (effects.length < 0) {\n graphicAnimate.wait(duration);\n } else {\n const customAnimates = effects\n .map((effect, index) => {\n const attributes =\n (effect.type\n ? typeAnimationAttributes(this.element, effect, animationParameters, parameters)\n : effect.channel\n ? channelAnimationAttributes(this.element, effect, animationParameters, parameters)\n : undefined) ?? {};\n\n const customOption = attributes.custom || effect?.custom;\n const customParametersOption = attributes?.customParameters || effect?.customParameters;\n\n if (\n attributes.from &&\n Object.keys(attributes.from).length &&\n this.unit &&\n this.animationOptions.timeline.controlOptions.immediatelyApply &&\n this.element.mark.markType !== 'component'\n ) {\n this.element.getGraphicItem().setAttributes(attributes.from);\n }\n\n const isCustomAnimate = isCustomAnimateCtor(customOption);\n const isCustomInterpolator = !isNil(customOption) && !isCustomAnimateCtor(customOption);\n\n if (isCustomInterpolator) {\n return new CustomInterpolator(attributes.from, attributes.to, duration, effect.easing, {\n interpolator: customOption as IAnimationChannelInterpolator,\n element: this.element,\n parameters: customParametersOption\n });\n } else if (isCustomAnimate) {\n return new (customOption as IAnimationCustomConstructor)(\n attributes.from,\n attributes.to,\n duration,\n effect.easing,\n customParametersOption\n );\n } else if (attributes.to) {\n return new AttributeAnimate(attributes.from, attributes.to, duration, effect.easing);\n }\n })\n .filter(animate => !isNil(animate));\n\n if (customAnimates.length === 1) {\n graphicAnimate.play(customAnimates[0]);\n } else if (customAnimates.length > 1) {\n graphicAnimate.play(new AnimateGroup(duration, customAnimates));\n }\n }\n\n if (delayAfter > 0) {\n graphicAnimate.wait(delayAfter);\n }\n }\n}\n"]}
@@ -21,3 +21,4 @@ export declare const DefaultAnimationOneByOne = false;
21
21
  export declare const DefaultAnimationEasing = "quintInOut";
22
22
  export declare const DefaultAnimationControlOptions: IAnimationControlOptions;
23
23
  export declare const DefaultAnimationParameters = "VGRAMMAR_ANIMATION_PARAMETERS";
24
+ export declare const MARK_OVERLAP_HIDE_KEY = "_mo_hide_";
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.DefaultAnimationParameters = exports.DefaultAnimationControlOptions = exports.DefaultAnimationEasing = exports.DefaultAnimationOneByOne = exports.DefaultAnimationLoop = exports.DefaultAnimationDelayAfter = exports.DefaultAnimationDelay = exports.DefaultAnimationDuration = exports.DefaultAnimationStartTime = exports.ImmediateAnimationState = exports.DefaultEnableExitAnimation = exports.DefaultSplitPath = exports.DefaultMorphAll = exports.DefaultMorph = exports.DefaultReuse = exports.DefaultGroupKeys = exports.DefaultMarkData = exports.DefaultKey = exports.Mark3DType = exports.CollectionMarkType = exports.BridgeElementKey = void 0;
5
+ }), exports.MARK_OVERLAP_HIDE_KEY = exports.DefaultAnimationParameters = exports.DefaultAnimationControlOptions = exports.DefaultAnimationEasing = exports.DefaultAnimationOneByOne = exports.DefaultAnimationLoop = exports.DefaultAnimationDelayAfter = exports.DefaultAnimationDelay = exports.DefaultAnimationDuration = exports.DefaultAnimationStartTime = exports.ImmediateAnimationState = exports.DefaultEnableExitAnimation = exports.DefaultSplitPath = exports.DefaultMorphAll = exports.DefaultMorph = exports.DefaultReuse = exports.DefaultGroupKeys = exports.DefaultMarkData = exports.DefaultKey = exports.Mark3DType = exports.CollectionMarkType = exports.BridgeElementKey = void 0;
6
6
 
7
7
  const enums_1 = require("./enums");
8
8
 
@@ -16,5 +16,5 @@ exports.DefaultAnimationDelayAfter = 0, exports.DefaultAnimationLoop = !1, expor
16
16
  exports.DefaultAnimationEasing = "quintInOut", exports.DefaultAnimationControlOptions = {
17
17
  stopWhenStateChange: !1,
18
18
  immediatelyApply: !0
19
- }, exports.DefaultAnimationParameters = "VGRAMMAR_ANIMATION_PARAMETERS";
19
+ }, exports.DefaultAnimationParameters = "VGRAMMAR_ANIMATION_PARAMETERS", exports.MARK_OVERLAP_HIDE_KEY = "_mo_hide_";
20
20
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/constants.ts"],"names":[],"mappings":";;;AACA,mCAA0C;AAE7B,QAAA,gBAAgB,GAAG,yBAAyB,CAAC;AAE7C,QAAA,kBAAkB,GAAG,CAAC,uBAAe,CAAC,IAAI,EAAE,uBAAe,CAAC,IAAI,CAAC,CAAC;AAElE,QAAA,UAAU,GAAG,CAAC,uBAAe,CAAC,KAAK,EAAE,uBAAe,CAAC,MAAM,EAAE,uBAAe,CAAC,SAAS,CAAC,CAAC;AAExF,QAAA,UAAU,GAAG,KAAK,CAAC;AAEnB,QAAA,eAAe,GAAG,CAAC,EAAE,CAAC,CAAC;AAEvB,QAAA,gBAAgB,GAAG,CAAC,kBAAU,CAAC,CAAC;AAEhC,QAAA,YAAY,GAAG,IAAI,CAAC;AACpB,QAAA,YAAY,GAAG,IAAI,CAAC;AACpB,QAAA,eAAe,GAAG,KAAK,CAAC;AACxB,QAAA,gBAAgB,GAAmB,IAAI,CAAC;AACxC,QAAA,0BAA0B,GAAG,IAAI,CAAC;AAElC,QAAA,uBAAuB,GAAG,8BAA8B,CAAC;AAGzD,QAAA,yBAAyB,GAAG,CAAC,CAAC;AAC9B,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAC1B,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAC/B,QAAA,oBAAoB,GAAG,KAAK,CAAC;AAC7B,QAAA,wBAAwB,GAAG,KAAK,CAAC;AACjC,QAAA,sBAAsB,GAAG,YAAY,CAAC;AACtC,QAAA,8BAA8B,GAA6B;IACtE,mBAAmB,EAAE,KAAK;IAC1B,gBAAgB,EAAE,IAAI;CACvB,CAAC;AACW,QAAA,0BAA0B,GAAG,+BAA+B,CAAC","file":"constants.js","sourcesContent":["import type { IAnimationControlOptions } from '../types/animate';\nimport { GrammarMarkType } from './enums';\n\nexport const BridgeElementKey = '__vgrammar_scene_item__';\n\nexport const CollectionMarkType = [GrammarMarkType.line, GrammarMarkType.area];\n\nexport const Mark3DType = [GrammarMarkType.arc3d, GrammarMarkType.rect3d, GrammarMarkType.pyramid3d];\n\nexport const DefaultKey = 'key';\n\nexport const DefaultMarkData = [{}];\n\nexport const DefaultGroupKeys = [DefaultKey];\n\nexport const DefaultReuse = true;\nexport const DefaultMorph = true;\nexport const DefaultMorphAll = false;\nexport const DefaultSplitPath: null | 'clone' = null;\nexport const DefaultEnableExitAnimation = true;\n\nexport const ImmediateAnimationState = 'VGRAMMAR_IMMEDIATE_ANIMATION';\n\n/** default animation configs */\nexport const DefaultAnimationStartTime = 0;\nexport const DefaultAnimationDuration = 1000;\nexport const DefaultAnimationDelay = 0;\nexport const DefaultAnimationDelayAfter = 0;\nexport const DefaultAnimationLoop = false;\nexport const DefaultAnimationOneByOne = false;\nexport const DefaultAnimationEasing = 'quintInOut';\nexport const DefaultAnimationControlOptions: IAnimationControlOptions = {\n stopWhenStateChange: false,\n immediatelyApply: true\n};\nexport const DefaultAnimationParameters = 'VGRAMMAR_ANIMATION_PARAMETERS';\n"]}
1
+ {"version":3,"sources":["../src/graph/constants.ts"],"names":[],"mappings":";;;AACA,mCAA0C;AAE7B,QAAA,gBAAgB,GAAG,yBAAyB,CAAC;AAE7C,QAAA,kBAAkB,GAAG,CAAC,uBAAe,CAAC,IAAI,EAAE,uBAAe,CAAC,IAAI,CAAC,CAAC;AAElE,QAAA,UAAU,GAAG,CAAC,uBAAe,CAAC,KAAK,EAAE,uBAAe,CAAC,MAAM,EAAE,uBAAe,CAAC,SAAS,CAAC,CAAC;AAExF,QAAA,UAAU,GAAG,KAAK,CAAC;AAEnB,QAAA,eAAe,GAAG,CAAC,EAAE,CAAC,CAAC;AAEvB,QAAA,gBAAgB,GAAG,CAAC,kBAAU,CAAC,CAAC;AAEhC,QAAA,YAAY,GAAG,IAAI,CAAC;AACpB,QAAA,YAAY,GAAG,IAAI,CAAC;AACpB,QAAA,eAAe,GAAG,KAAK,CAAC;AACxB,QAAA,gBAAgB,GAAmB,IAAI,CAAC;AACxC,QAAA,0BAA0B,GAAG,IAAI,CAAC;AAElC,QAAA,uBAAuB,GAAG,8BAA8B,CAAC;AAGzD,QAAA,yBAAyB,GAAG,CAAC,CAAC;AAC9B,QAAA,wBAAwB,GAAG,IAAI,CAAC;AAChC,QAAA,qBAAqB,GAAG,CAAC,CAAC;AAC1B,QAAA,0BAA0B,GAAG,CAAC,CAAC;AAC/B,QAAA,oBAAoB,GAAG,KAAK,CAAC;AAC7B,QAAA,wBAAwB,GAAG,KAAK,CAAC;AACjC,QAAA,sBAAsB,GAAG,YAAY,CAAC;AACtC,QAAA,8BAA8B,GAA6B;IACtE,mBAAmB,EAAE,KAAK;IAC1B,gBAAgB,EAAE,IAAI;CACvB,CAAC;AACW,QAAA,0BAA0B,GAAG,+BAA+B,CAAC;AAE7D,QAAA,qBAAqB,GAAG,WAAW,CAAC","file":"constants.js","sourcesContent":["import type { IAnimationControlOptions } from '../types/animate';\nimport { GrammarMarkType } from './enums';\n\nexport const BridgeElementKey = '__vgrammar_scene_item__';\n\nexport const CollectionMarkType = [GrammarMarkType.line, GrammarMarkType.area];\n\nexport const Mark3DType = [GrammarMarkType.arc3d, GrammarMarkType.rect3d, GrammarMarkType.pyramid3d];\n\nexport const DefaultKey = 'key';\n\nexport const DefaultMarkData = [{}];\n\nexport const DefaultGroupKeys = [DefaultKey];\n\nexport const DefaultReuse = true;\nexport const DefaultMorph = true;\nexport const DefaultMorphAll = false;\nexport const DefaultSplitPath: null | 'clone' = null;\nexport const DefaultEnableExitAnimation = true;\n\nexport const ImmediateAnimationState = 'VGRAMMAR_IMMEDIATE_ANIMATION';\n\n/** default animation configs */\nexport const DefaultAnimationStartTime = 0;\nexport const DefaultAnimationDuration = 1000;\nexport const DefaultAnimationDelay = 0;\nexport const DefaultAnimationDelayAfter = 0;\nexport const DefaultAnimationLoop = false;\nexport const DefaultAnimationOneByOne = false;\nexport const DefaultAnimationEasing = 'quintInOut';\nexport const DefaultAnimationControlOptions: IAnimationControlOptions = {\n stopWhenStateChange: false,\n immediatelyApply: true\n};\nexport const DefaultAnimationParameters = 'VGRAMMAR_ANIMATION_PARAMETERS';\n\nexport const MARK_OVERLAP_HIDE_KEY = '_mo_hide_';\n"]}
@@ -92,7 +92,8 @@ class Element {
92
92
  this.coordinateTransformEncode(this.items);
93
93
  const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);
94
94
  attrs && Object.assign(graphicAttributes, attrs), this.graphicItem ? (this.graphicItem.clearStates(),
95
- this.graphicItem.states = {}, this.graphicItem.stateProxy = null, this.applyGraphicAttributes(graphicAttributes)) : this.initGraphicItem(graphicAttributes),
95
+ this.graphicItem.states = {}, this.graphicItem.stateProxy = null, constants_1.MARK_OVERLAP_HIDE_KEY in this.graphicItem.attribute && "visible" in graphicAttributes && delete this.graphicItem.attribute[constants_1.MARK_OVERLAP_HIDE_KEY],
96
+ this.applyGraphicAttributes(graphicAttributes)) : this.initGraphicItem(graphicAttributes),
96
97
  this.diffState !== enums_1.DiffState.enter && this.diffState !== enums_1.DiffState.update || !this.states.length || this.useStates(this.states),
97
98
  this.mark.markType === enums_1.GrammarMarkType.shape && (this.graphicItem.datum = this.items[0].datum),
98
99
  this.items.forEach((item => {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/element.ts"],"names":[],"mappings":";;;AAEA,6CAY0B;AAC1B,2DAAkD;AAElD,2CAA+C;AAC/C,mCAAqF;AACrF,0CAAoE;AACpE,4CAAmD;AACnD,sDAA6D;AAC7D,kDAM8B;AAC9B,4CAK2B;AAgB3B,yDAAsD;AACtD,wCAA+D;AAE/D,MAAa,OAAO;IAoBlB,YAAY,IAAW;QAfvB,SAAI,GAAU,IAAI,CAAC;QAEnB,WAAM,GAAa,EAAE,CAAC;QAEtB,cAAS,GAAc,iBAAS,CAAC,KAAK,CAAC;QAEvC,eAAU,GAAY,KAAK,CAAC;QAE5B,yBAAoB,GAAmB,IAAI,CAAC;QAK5C,UAAK,GAAsB,EAAE,CAAC;QA8XpB,kBAAa,GAAG,CAAC,SAAiB,EAAE,UAAoB,EAAE,EAAE;;YACpE,MAAM,cAAc,GAAG,CAAC,IAAA,cAAK,EAAC,MAAA,IAAI,CAAC,oBAAoB,0CAA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plicate-imports\nimport {\n array,\n has,\n isBoolean,\n isNil,\n isFunction,\n isString,\n isArray,\n get,\n isEmpty,\n isEqual as isObjEqual,\n isObject\n} from '@visactor/vutils';\nimport { isEqual } from '@visactor/vgrammar-util';\nimport type { IBaseCoordinate } from '@visactor/vgrammar-coordinate';\nimport { BridgeElementKey } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType, BuiltInEncodeNames } from './enums';\nimport { invokeEncoder, invokeEncoderToItems } from './mark/encode';\nimport { removeGraphicItem } from './util/graphic';\nimport { transformAttributes } from './attributes/transform';\nimport {\n getLargeRectsPoints,\n getLargeSymbolsPoints,\n getLinePoints,\n isValidPointsChannel,\n isPointsMarkType\n} from './attributes/helpers';\nimport {\n getLineSegmentConfigs,\n getLinePointsFromSegments,\n parseCollectionMarkAttributes,\n getConnectLineSegmentConfigs\n} from './attributes/line';\nimport type {\n BaseEncodeSpec,\n BaseSingleEncodeSpec,\n IElement,\n IMark,\n IMarkConfig,\n MarkElementItem,\n MarkFunctionType,\n MarkKeySpec,\n MarkSpec,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport type { IGraphic, ILine, IGraphicAttribute } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { CustomPath2D } from '@visactor/vrender-core';\nimport { invokeFunctionType, parseField } from '../parse/util';\n\nexport class Element implements IElement {\n mark: IMark;\n\n key: string;\n groupKey?: string;\n data: any[] = null;\n\n states: string[] = [];\n\n diffState: DiffState = DiffState.enter;\n // Element should be reserved as long as it need to animate\n isReserved: boolean = false;\n\n runtimeStatesEncoder: BaseEncodeSpec = null;\n\n protected graphicItem: IGraphic;\n\n // hack before vRender refactoring\n items: MarkElementItem[] = [];\n\n constructor(mark: IMark) {\n this.mark = mark;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n // 统一读取mark中是否可交互的配置\n const attrTransforms = this.mark.getAttributeTransforms();\n\n this.graphicItem = this.mark.addGraphicItem(\n attrTransforms ? transformAttributes(attrTransforms, attributes, this) : attributes,\n this.groupKey\n );\n\n if (!this.graphicItem) {\n return;\n }\n // 统一读取mark中是否可交互的配置\n this.graphicItem[BridgeElementKey] = this;\n if (attrTransforms) {\n this.graphicItem.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(attrTransforms, attributes, this);\n return graphicAttributes;\n };\n }\n\n // transform initial attributes\n this.clearGraphicAttributes();\n if (this.mark.needAnimate()) {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(Object.assign({}, attributes));\n this.setFinalGraphicAttributes(Object.assign({}, attributes));\n }\n }\n\n updateGraphicItem() {\n if (!this.graphicItem) {\n return;\n }\n if (this.diffState === DiffState.exit) {\n (this.graphicItem as any).releaseStatus = 'willRelease';\n } else {\n (this.graphicItem as any).releaseStatus = undefined;\n }\n\n const stateAnimation = this.mark.animate.getAnimationConfigs('state');\n if (stateAnimation.length !== 0) {\n (this.graphicItem as any).stateAnimateConfig = stateAnimation[0].originConfig;\n }\n }\n\n getGraphicItem() {\n return this.graphicItem;\n }\n\n removeGraphicItem() {\n // stop all animation when releasing including normal animation & morphing animation\n if (this.graphicItem) {\n this.graphicItem.animates?.forEach?.(animate => animate.stop());\n }\n\n if (this.graphicItem) {\n removeGraphicItem(this.graphicItem);\n this.graphicItem[BridgeElementKey] = null;\n this.graphicItem = null;\n }\n }\n\n resetGraphicItem() {\n if (this.graphicItem) {\n this.graphicItem = null;\n }\n }\n\n getBounds() {\n // FIXME: 没有更新 bounds 时拿到的 bound 可能为 null\n return this.graphicItem?.AABBBounds as IBounds;\n }\n\n getStates() {\n return this.states;\n }\n\n updateData(groupKey: string | null, data: any[], key: MarkKeySpec) {\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA, { groupKey, data, key }, this);\n this.data = data;\n const keyGetter = parseField(key);\n this.items = data.map(datum => {\n const key = keyGetter(datum);\n const item = {\n datum,\n key,\n view: this.mark.view,\n nextAttrs: {}\n };\n\n return item;\n });\n\n this.groupKey = groupKey;\n this.key = this.mark.isCollectionMark() ? groupKey : this.items?.[0].key;\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA, { groupKey, data, key }, this);\n return this.items;\n }\n\n state(markState: MarkFunctionType<string | string[]>, parameters?: any) {\n const isCollectionMark = this.mark.isCollectionMark();\n\n const prevStateValues = this.states;\n const newStateValues = array(invokeFunctionType(markState, parameters, this.getDatum(), this));\n const stateSort = this.mark.getSpec()?.stateSort;\n\n if (stateSort && newStateValues.length) {\n newStateValues.sort(stateSort);\n }\n\n const isStateChanged =\n newStateValues.length !== prevStateValues.length ||\n newStateValues.some((newState: string, index: number) => newState !== prevStateValues[index]);\n this.states = newStateValues;\n\n // early logic didn't handle collection mark, only update signal mark state for now\n if (!isCollectionMark && isStateChanged && this.diffState === DiffState.unChange) {\n this.diffState = DiffState.update;\n }\n }\n\n encodeGraphic(attrs?: any) {\n this.coordinateTransformEncode(this.items);\n\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n if (attrs) {\n Object.assign(graphicAttributes, attrs);\n }\n\n if (!this.graphicItem) {\n this.initGraphicItem(graphicAttributes);\n } else {\n this.graphicItem.clearStates();\n // 更新数据流后,states计算不缓存\n this.graphicItem.states = {};\n this.graphicItem.stateProxy = null;\n\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n this.useStates(this.states);\n }\n\n if (this.mark.markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n (this.graphicItem as any).datum = this.items[0].datum;\n }\n\n // clear item attributes\n this.items.forEach(item => {\n item.nextAttrs = {};\n });\n this._setCustomizedShape();\n }\n\n private _setCustomizedShape() {\n if (!this.graphicItem) {\n return;\n }\n const setCustomizedShape = this.mark.getSpec()?.setCustomizedShape;\n\n if (!setCustomizedShape) {\n return;\n }\n\n this.graphicItem.pathProxy = (attrs: Partial<IGraphicAttribute>) => {\n return setCustomizedShape(this.data, attrs, new CustomPath2D());\n };\n }\n\n encodeItems(items: MarkElementItem[], encoders: BaseEncodeSpec, isReentered: boolean = false, parameters?: any) {\n const isCollectionMark = this.mark.isCollectionMark();\n // marshall encoder functions\n const updateEncoder = encoders[BuiltInEncodeNames.update];\n const enterEncoder = encoders[BuiltInEncodeNames.enter];\n const exitEncoder = encoders[BuiltInEncodeNames.exit];\n const onlyFullEncodeFirst = this.mark.isLargeMode() || (isCollectionMark && !this.mark.getSpec().enableSegments);\n\n if (this.diffState === DiffState.enter) {\n if (enterEncoder) {\n invokeEncoderToItems(this, items, enterEncoder, parameters, onlyFullEncodeFirst);\n }\n if (updateEncoder) {\n invokeEncoderToItems(this, items, updateEncoder, parameters, onlyFullEncodeFirst);\n }\n } else if (this.diffState === DiffState.update) {\n // if mark is reentered or mark is collection type, evaluate enter encode\n if ((isCollectionMark && enterEncoder) || isReentered) {\n invokeEncoderToItems(this, items, enterEncoder, parameters, onlyFullEncodeFirst);\n }\n if (updateEncoder) {\n invokeEncoderToItems(this, items, updateEncoder, parameters, onlyFullEncodeFirst);\n }\n } else if (this.diffState === DiffState.exit && exitEncoder) {\n // if mark is reentered, evaluate enter encode\n if (isReentered) {\n invokeEncoderToItems(this, items, enterEncoder, parameters, onlyFullEncodeFirst);\n }\n invokeEncoderToItems(this, items, exitEncoder, parameters, onlyFullEncodeFirst);\n }\n }\n\n protected coordinateTransformEncode(items: MarkElementItem[]) {\n if (!this.mark.coord || this.mark.markType === 'arc' || this.mark.disableCoordinateTransform === true) {\n return;\n }\n const coord = this.mark.coord.output() as IBaseCoordinate;\n\n items.forEach(item => {\n const nextAttrs = item.nextAttrs;\n const convertedPoint: IPointLike = coord.convert(nextAttrs);\n Object.assign(nextAttrs, convertedPoint);\n });\n }\n\n clearStates(hasAnimation?: boolean) {\n const stateAnimationEnable = isBoolean(hasAnimation)\n ? hasAnimation\n : this.mark.animate.getAnimationConfigs('state').length !== 0;\n\n this.states = [];\n\n if (this.graphicItem) {\n this.graphicItem.clearStates(stateAnimationEnable);\n }\n\n if (this.runtimeStatesEncoder) {\n this.runtimeStatesEncoder = {};\n }\n }\n\n private _updateRuntimeStates(state: string, attrs: any) {\n if (!this.runtimeStatesEncoder) {\n this.runtimeStatesEncoder = {};\n }\n\n this.runtimeStatesEncoder[state] = attrs;\n }\n\n hasState(state: string) {\n return this.states && state && this.states.includes(state);\n }\n\n updateStates(states: Record<string, boolean | BaseSingleEncodeSpec>) {\n if (!this.graphicItem) {\n return false;\n }\n let nextStates = this.states.slice();\n const encode = (this.mark.getSpec() as MarkSpec).encode;\n let forceClearState = false;\n let hasUpdate = false;\n\n Object.keys(states).forEach(stateKey => {\n if (!stateKey) {\n return;\n }\n\n const stateValue = states[stateKey];\n const isRuntimeStateUpdate =\n isObject(stateValue) && !isObjEqual(stateValue, this.runtimeStatesEncoder?.[stateKey]);\n\n if (isRuntimeStateUpdate) {\n if (nextStates.includes(stateKey)) {\n forceClearState = true;\n } else {\n nextStates.push(stateKey);\n }\n this._updateRuntimeStates(stateKey, stateValue);\n hasUpdate = true;\n } else if (stateValue) {\n if (!nextStates.includes(stateKey) && encode?.[stateKey]) {\n nextStates.push(stateKey);\n hasUpdate = true;\n }\n } else {\n if (nextStates.length) {\n const newNextStates = nextStates.filter(state => state !== stateKey);\n\n if (newNextStates.length !== nextStates.length) {\n hasUpdate = true;\n nextStates = newNextStates;\n }\n\n if (this.runtimeStatesEncoder && this.runtimeStatesEncoder[stateKey]) {\n this.runtimeStatesEncoder[stateKey] = null;\n }\n }\n }\n });\n\n if (forceClearState) {\n this.graphicItem.clearStates();\n }\n\n if (hasUpdate) {\n this.useStates(nextStates);\n return true;\n }\n\n return false;\n }\n\n addState(state: string | string[], attrs?: BaseSingleEncodeSpec) {\n if (!this.graphicItem) {\n return false;\n }\n\n const isRuntimeStateUpdate = attrs && isString(state) && !isObjEqual(attrs, this.runtimeStatesEncoder?.[state]);\n if (isRuntimeStateUpdate) {\n const nextStates = this.states.slice();\n if (!nextStates.includes(state)) {\n nextStates.push(state);\n } else {\n this.graphicItem.clearStates();\n }\n this._updateRuntimeStates(state, attrs);\n\n this.useStates(nextStates);\n return true;\n }\n\n const encode = (this.mark.getSpec() as MarkSpec).encode;\n const states = array(state);\n const nextStates = states.reduce((nextStates: string[], stateName: string) => {\n if (stateName && !nextStates.includes(stateName) && encode?.[stateName]) {\n nextStates.push(stateName);\n }\n return nextStates;\n }, this.states.slice());\n\n if (nextStates.length !== this.states.length) {\n this.useStates(nextStates);\n\n return true;\n }\n\n return false;\n }\n\n removeState(state: string | string[]) {\n if (!this.graphicItem) {\n return false;\n }\n\n const states = array(state);\n\n if (!states.length) {\n return false;\n }\n\n const nextStates = this.states.filter(state => !states.includes(state));\n if (nextStates.length === this.states.length) {\n return false;\n }\n\n if (this.runtimeStatesEncoder) {\n states.forEach(state => {\n this.runtimeStatesEncoder[state] = null;\n });\n }\n this.useStates(nextStates);\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 if (!encoder) {\n return {};\n }\n\n if (isFunction(encoder)) {\n return (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n }\n\n if (!isRuntimeState && this.graphicItem.states?.[stateName]) {\n return this.graphicItem.states[stateName];\n }\n\n const stateItems = this.items.map(item => Object.assign({}, item, { nextAttrs: {} }));\n // collection图元,暂时不支持在state更新中,支持更新points更新\n invokeEncoderToItems(this, stateItems, encoder, (this.mark as any).parameters());\n\n const graphicAttributes = this.transformElementItems(stateItems, this.mark.markType);\n\n if (!this.graphicItem.states) {\n this.graphicItem.states = { [stateName]: graphicAttributes };\n } else if (!this.graphicItem.states[stateName]) {\n this.graphicItem.states[stateName] = graphicAttributes;\n }\n\n return graphicAttributes;\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 const stateSort = this.mark.getSpec()?.stateSort;\n\n if (stateSort) {\n states.sort(stateSort);\n }\n this.states = states;\n\n const stateAnimationEnable = isBoolean(hasAnimation)\n ? hasAnimation\n : this.mark.animate.getAnimationConfigs('state').length !== 0;\n\n this.graphicItem.stateProxy = 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 diffAttributes(graphicAttributes: { [channel: string]: any }) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes();\n for (const key in graphicAttributes) {\n if (!isEqual(key, finalGraphicAttributes, graphicAttributes) || !has(finalGraphicAttributes, key)) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n /**\n * tranform the attribute to graphic attribute\n * @param items\n * @param markType In ordinary, markType is equal to mark.markType, but in glyph, markType is different from mark.markType\n * @param markName\n * @param computePoints\n * @returns\n */\n transformElementItems(items: MarkElementItem[], markType: MarkType, computePoints?: boolean): Record<string, any> {\n const item = items[0];\n\n if (!item.nextAttrs || Object.keys(item.nextAttrs).length === 0) {\n return {};\n }\n\n let nextAttrs = item.nextAttrs;\n\n if (\n isPointsMarkType(markType) &&\n items &&\n items.length &&\n isNil(item.nextAttrs?.points) &&\n (computePoints === true || isValidPointsChannel(Object.keys(item.nextAttrs), this.mark.markType))\n ) {\n const markSpec = this.mark.getSpec();\n const lastPoints = this.getGraphicAttribute('points', false);\n const lastSegments = this.getGraphicAttribute('segments', false);\n const enableSegments = markSpec.enableSegments;\n const connectNullsEncoder = (this.mark.getSpec() as MarkSpec).encode?.[BuiltInEncodeNames.connectNulls];\n const itemNextAttrs = items.map(item => item.nextAttrs);\n const isProgressive = this.mark.isProgressive();\n nextAttrs = parseCollectionMarkAttributes(nextAttrs);\n\n if (markType === GrammarMarkType.line || markType === GrammarMarkType.area) {\n const linePoints = getLinePoints(items, true, lastPoints, markType === GrammarMarkType.area);\n\n // vchart新增了配置,用于开启线段解析;渐进渲染状态不支持线段样式;也不支持连接线\n if (isProgressive) {\n nextAttrs.segments = ((this.graphicItem as ILine)?.attribute?.segments ?? []).concat([\n { points: linePoints }\n ]);\n } else if (connectNullsEncoder) {\n nextAttrs.segments = getConnectLineSegmentConfigs(itemNextAttrs, linePoints, this);\n\n if (nextAttrs.segments && nextAttrs.segments.some((seg: any) => seg.isConnect)) {\n const connectStyle = invokeEncoder(connectNullsEncoder, this.getDatum(), this, this.mark.parameters());\n\n connectStyle &&\n nextAttrs.segments.forEach((seg: any) => {\n if (seg.isConnect) {\n Object.assign(seg, connectStyle);\n }\n });\n }\n // when connectNulls, points need to be saved\n nextAttrs.points = linePoints;\n } else if (enableSegments) {\n const points = !linePoints || linePoints.length === 0 ? getLinePointsFromSegments(lastSegments) : linePoints;\n const segments = getLineSegmentConfigs(itemNextAttrs, points, this);\n\n if (segments) {\n nextAttrs.segments = segments;\n nextAttrs.points = null;\n } else {\n nextAttrs.segments = null;\n nextAttrs.points = points;\n }\n } else {\n nextAttrs.points = linePoints;\n nextAttrs.segments = null;\n }\n } else if (markType === GrammarMarkType.largeRects) {\n nextAttrs.points = getLargeRectsPoints(items, true, lastPoints);\n } else if (markType === GrammarMarkType.largeSymbols) {\n nextAttrs.points = getLargeSymbolsPoints(items, true, lastPoints);\n }\n }\n\n return nextAttrs;\n }\n\n protected applyGraphicAttributes(graphicAttributes: any) {\n if (isEmpty(graphicAttributes)) {\n return;\n }\n\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes);\n const prevGraphicAttributes = this.getPrevGraphicAttributes() ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes() ?? {};\n\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = this.getGraphicAttribute(channel);\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes);\n this.setPrevGraphicAttributes(prevGraphicAttributes);\n this.setFinalGraphicAttributes(finalGraphicAttributes);\n\n const currentAnimators = this.mark.animate.getElementAnimators(this);\n const animateGraphicAttributes = currentAnimators.reduce((attributes, animator) => {\n return Object.assign(attributes, animator.getEndAttributes());\n }, {});\n const currentGraphicAttributes = Object.assign({}, animateGraphicAttributes, finalGraphicAttributes);\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 this.graphicItem.setAttributes(currentGraphicAttributes);\n } else {\n // Otherwise, directly apply all attributes.\n this.graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false) {\n if (!this.graphicItem) {\n return undefined;\n }\n\n if (prev) {\n let value: any;\n const prevGraphicAttributes = this.getPrevGraphicAttributes();\n if (!isNil((value = get(prevGraphicAttributes, channel)))) {\n return value;\n }\n }\n\n // get attribute before transformed\n const trans = this.mark.getAttributeTransforms();\n let getKey: string[] = [channel];\n if (trans && trans.length) {\n const channelTransform = trans.find(entry => {\n return entry.storedAttrs && entry.channels.includes(channel);\n });\n\n if (channelTransform) {\n getKey = [channelTransform.storedAttrs, channel];\n }\n }\n return get(this.graphicItem?.attribute, getKey);\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true) {\n if (!this.graphicItem) {\n return;\n }\n const finalGraphicAttributes = this.getFinalGraphicAttributes();\n const prevGraphicAttributes = this.getPrevGraphicAttributes();\n\n if (final && finalGraphicAttributes) {\n finalGraphicAttributes[channel] = value;\n }\n if (prevGraphicAttributes && !has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = this.graphicItem.attribute[channel];\n }\n\n this.graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true) {\n if (!this.graphicItem) {\n return;\n }\n const finalGraphicAttributes = this.getFinalGraphicAttributes();\n const prevGraphicAttributes = this.getPrevGraphicAttributes();\n\n Object.keys(attributes).forEach(key => {\n if (finalGraphicAttributes && final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (prevGraphicAttributes && !has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = this.graphicItem.attribute[key];\n }\n });\n\n this.graphicItem.setAttributes(attributes);\n }\n\n /**\n * 获取 vRender 已变更的视觉通道属性,只应当由 VGrammar 中 调用\n * @returns 视觉通道键值对\n */\n getFinalGraphicAttributes() {\n return (this.graphicItem as any).finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }) {\n (this.graphicItem as any).finalAttrs = attributes;\n }\n\n /**\n * 获取 vRender 变更前的视觉通道属性,只应当由 VGrammar 调用\n * @returns 视觉通道键值对\n */\n getPrevGraphicAttributes() {\n return (this.graphicItem as any).prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }) {\n (this.graphicItem as any).prevAttrs = attributes;\n }\n\n /**\n * 获取 vRender 在单次 dataflow 中变更的视觉通道属性,只应当由 VGrammar 调用\n * @returns 视觉通道键值对\n */\n getNextGraphicAttributes() {\n return (this.graphicItem as any).nextAttrs;\n }\n\n /**\n * 在动画执行中获取图元最终的视觉通道结果\n * @param channel 视觉通道\n */\n getFinalAnimationAttribute(channel: string) {\n return this.getFinalGraphicAttributes()?.[channel] ?? this.getGraphicAttribute(channel);\n }\n getFinalAnimationAttributes() {\n return this.getFinalGraphicAttributes() ?? this.graphicItem.attribute;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }) {\n (this.graphicItem as any).nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n if (this.graphicItem) {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n }\n }\n\n clearGraphicAttributes() {\n if (this.graphicItem) {\n (this.graphicItem as any).prevAttrs && this.setPrevGraphicAttributes(null);\n (this.graphicItem as any).nextAttrs && this.setNextGraphicAttributes(null);\n (this.graphicItem as any).finalAttrs && this.setFinalGraphicAttributes(null);\n }\n }\n\n remove() {\n if (this.graphicItem) {\n removeGraphicItem(this.graphicItem);\n this.graphicItem = null;\n }\n }\n\n release() {\n this.removeGraphicItem();\n this.mark = null;\n this.data = null;\n this.items = null;\n }\n /**\n * hack support for transform & encode logic. DO NOT USE.\n */\n getItemAttribute(channel?: string) {\n if (!this.items?.length) {\n return;\n }\n\n if (this.mark.isCollectionMark()) {\n return isNil(channel)\n ? this.items.map(item => item.nextAttrs)\n : this.items.map(item => item.nextAttrs?.[channel]);\n }\n\n return isNil(channel) ? this.items[0].nextAttrs : this.items[0].nextAttrs?.[channel];\n }\n setItemAttributes(attributes: { [channel: string]: any } | any[]) {\n if (!this.items?.length) {\n return;\n }\n\n if (this.mark.isCollectionMark()) {\n if (isArray(attributes)) {\n this.items.forEach((item, index) => {\n Object.assign(item.nextAttrs, attributes[index]);\n });\n }\n } else {\n Object.assign(this.items[0].nextAttrs, attributes);\n }\n }\n /**\n * hack support for transform & encode logic. DO NOT USE.\n */\n getItem() {\n return this.mark && this.mark.isCollectionMark() ? this.items ?? [] : this.items?.[0];\n }\n getDatum() {\n return this.mark && this.mark.isCollectionMark() ? this.data ?? [] : this.data?.[0];\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/graph/element.ts"],"names":[],"mappings":";;;AAEA,6CAY0B;AAC1B,2DAAkD;AAElD,2CAAsE;AACtE,mCAAqF;AACrF,0CAAoE;AACpE,4CAAmD;AACnD,sDAA6D;AAC7D,kDAM8B;AAC9B,4CAK2B;AAgB3B,yDAAsD;AACtD,wCAA+D;AAE/D,MAAa,OAAO;IAoBlB,YAAY,IAAW;QAfvB,SAAI,GA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AI,IAAI,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,KAAK,mCAAI,EAAE,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,KAAK,0CAAG,CAAC,CAAC,CAAC;IACxF,CAAC;IACD,QAAQ;;QACN,OAAO,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,IAAI,mCAAI,EAAE,CAAC,CAAC,CAAC,MAAA,IAAI,CAAC,IAAI,0CAAG,CAAC,CAAC,CAAC;IACtF,CAAC;CACF;AAlwBD,0BAkwBC","file":"element.js","sourcesContent":["import type { IBounds, IPointLike } from '@visactor/vutils';\n// eslint-disable-next-line no-duplicate-imports\nimport {\n array,\n has,\n isBoolean,\n isNil,\n isFunction,\n isString,\n isArray,\n get,\n isEmpty,\n isEqual as isObjEqual,\n isObject\n} from '@visactor/vutils';\nimport { isEqual } from '@visactor/vgrammar-util';\nimport type { IBaseCoordinate } from '@visactor/vgrammar-coordinate';\nimport { BridgeElementKey, MARK_OVERLAP_HIDE_KEY } from './constants';\nimport { DiffState, HOOK_EVENT, GrammarMarkType, BuiltInEncodeNames } from './enums';\nimport { invokeEncoder, invokeEncoderToItems } from './mark/encode';\nimport { removeGraphicItem } from './util/graphic';\nimport { transformAttributes } from './attributes/transform';\nimport {\n getLargeRectsPoints,\n getLargeSymbolsPoints,\n getLinePoints,\n isValidPointsChannel,\n isPointsMarkType\n} from './attributes/helpers';\nimport {\n getLineSegmentConfigs,\n getLinePointsFromSegments,\n parseCollectionMarkAttributes,\n getConnectLineSegmentConfigs\n} from './attributes/line';\nimport type {\n BaseEncodeSpec,\n BaseSingleEncodeSpec,\n IElement,\n IMark,\n IMarkConfig,\n MarkElementItem,\n MarkFunctionType,\n MarkKeySpec,\n MarkSpec,\n MarkType,\n StateProxyEncodeSpec\n} from '../types';\nimport type { IGraphic, ILine, IGraphicAttribute } from '@visactor/vrender-core';\n// eslint-disable-next-line no-duplicate-imports\nimport { CustomPath2D } from '@visactor/vrender-core';\nimport { invokeFunctionType, parseField } from '../parse/util';\n\nexport class Element implements IElement {\n mark: IMark;\n\n key: string;\n groupKey?: string;\n data: any[] = null;\n\n states: string[] = [];\n\n diffState: DiffState = DiffState.enter;\n // Element should be reserved as long as it need to animate\n isReserved: boolean = false;\n\n runtimeStatesEncoder: BaseEncodeSpec = null;\n\n protected graphicItem: IGraphic;\n\n // hack before vRender refactoring\n items: MarkElementItem[] = [];\n\n constructor(mark: IMark) {\n this.mark = mark;\n }\n\n initGraphicItem(attributes: any = {}) {\n if (this.graphicItem) {\n return;\n }\n // 统一读取mark中是否可交互的配置\n const attrTransforms = this.mark.getAttributeTransforms();\n\n this.graphicItem = this.mark.addGraphicItem(\n attrTransforms ? transformAttributes(attrTransforms, attributes, this) : attributes,\n this.groupKey\n );\n\n if (!this.graphicItem) {\n return;\n }\n // 统一读取mark中是否可交互的配置\n this.graphicItem[BridgeElementKey] = this;\n if (attrTransforms) {\n this.graphicItem.onBeforeAttributeUpdate = (attributes: any) => {\n // mark might be released\n if (!this.mark) {\n return attributes;\n }\n const graphicAttributes = transformAttributes(attrTransforms, attributes, this);\n return graphicAttributes;\n };\n }\n\n // transform initial attributes\n this.clearGraphicAttributes();\n if (this.mark.needAnimate()) {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(Object.assign({}, attributes));\n this.setFinalGraphicAttributes(Object.assign({}, attributes));\n }\n }\n\n updateGraphicItem() {\n if (!this.graphicItem) {\n return;\n }\n if (this.diffState === DiffState.exit) {\n (this.graphicItem as any).releaseStatus = 'willRelease';\n } else {\n (this.graphicItem as any).releaseStatus = undefined;\n }\n\n const stateAnimation = this.mark.animate.getAnimationConfigs('state');\n if (stateAnimation.length !== 0) {\n (this.graphicItem as any).stateAnimateConfig = stateAnimation[0].originConfig;\n }\n }\n\n getGraphicItem() {\n return this.graphicItem;\n }\n\n removeGraphicItem() {\n // stop all animation when releasing including normal animation & morphing animation\n if (this.graphicItem) {\n this.graphicItem.animates?.forEach?.(animate => animate.stop());\n }\n\n if (this.graphicItem) {\n removeGraphicItem(this.graphicItem);\n this.graphicItem[BridgeElementKey] = null;\n this.graphicItem = null;\n }\n }\n\n resetGraphicItem() {\n if (this.graphicItem) {\n this.graphicItem = null;\n }\n }\n\n getBounds() {\n // FIXME: 没有更新 bounds 时拿到的 bound 可能为 null\n return this.graphicItem?.AABBBounds as IBounds;\n }\n\n getStates() {\n return this.states;\n }\n\n updateData(groupKey: string | null, data: any[], key: MarkKeySpec) {\n this.mark.emit(HOOK_EVENT.BEFORE_ELEMENT_UPDATE_DATA, { groupKey, data, key }, this);\n this.data = data;\n const keyGetter = parseField(key);\n this.items = data.map(datum => {\n const key = keyGetter(datum);\n const item = {\n datum,\n key,\n view: this.mark.view,\n nextAttrs: {}\n };\n\n return item;\n });\n\n this.groupKey = groupKey;\n this.key = this.mark.isCollectionMark() ? groupKey : this.items?.[0].key;\n\n this.mark.emit(HOOK_EVENT.AFTER_ELEMENT_UPDATE_DATA, { groupKey, data, key }, this);\n return this.items;\n }\n\n state(markState: MarkFunctionType<string | string[]>, parameters?: any) {\n const isCollectionMark = this.mark.isCollectionMark();\n\n const prevStateValues = this.states;\n const newStateValues = array(invokeFunctionType(markState, parameters, this.getDatum(), this));\n const stateSort = this.mark.getSpec()?.stateSort;\n\n if (stateSort && newStateValues.length) {\n newStateValues.sort(stateSort);\n }\n\n const isStateChanged =\n newStateValues.length !== prevStateValues.length ||\n newStateValues.some((newState: string, index: number) => newState !== prevStateValues[index]);\n this.states = newStateValues;\n\n // early logic didn't handle collection mark, only update signal mark state for now\n if (!isCollectionMark && isStateChanged && this.diffState === DiffState.unChange) {\n this.diffState = DiffState.update;\n }\n }\n\n encodeGraphic(attrs?: any) {\n this.coordinateTransformEncode(this.items);\n\n const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);\n\n if (attrs) {\n Object.assign(graphicAttributes, attrs);\n }\n\n if (!this.graphicItem) {\n this.initGraphicItem(graphicAttributes);\n } else {\n this.graphicItem.clearStates();\n // 更新数据流后,states计算不缓存\n this.graphicItem.states = {};\n this.graphicItem.stateProxy = null;\n\n if (MARK_OVERLAP_HIDE_KEY in this.graphicItem.attribute && 'visible' in graphicAttributes) {\n delete this.graphicItem.attribute[MARK_OVERLAP_HIDE_KEY];\n }\n\n this.applyGraphicAttributes(graphicAttributes);\n }\n\n if ((this.diffState === DiffState.enter || this.diffState === DiffState.update) && this.states.length) {\n this.useStates(this.states);\n }\n\n if (this.mark.markType === GrammarMarkType.shape) {\n // FIXME: shape需要拿到原始数据进行编码,暂时把数据绑定到graphicItem上,看后续graphicItem是否需要支持数据绑定\n (this.graphicItem as any).datum = this.items[0].datum;\n }\n\n // clear item attributes\n this.items.forEach(item => {\n item.nextAttrs = {};\n });\n this._setCustomizedShape();\n }\n\n private _setCustomizedShape() {\n if (!this.graphicItem) {\n return;\n }\n const setCustomizedShape = this.mark.getSpec()?.setCustomizedShape;\n\n if (!setCustomizedShape) {\n return;\n }\n\n this.graphicItem.pathProxy = (attrs: Partial<IGraphicAttribute>) => {\n return setCustomizedShape(this.data, attrs, new CustomPath2D());\n };\n }\n\n encodeItems(items: MarkElementItem[], encoders: BaseEncodeSpec, isReentered: boolean = false, parameters?: any) {\n const isCollectionMark = this.mark.isCollectionMark();\n // marshall encoder functions\n const updateEncoder = encoders[BuiltInEncodeNames.update];\n const enterEncoder = encoders[BuiltInEncodeNames.enter];\n const exitEncoder = encoders[BuiltInEncodeNames.exit];\n const onlyFullEncodeFirst = this.mark.isLargeMode() || (isCollectionMark && !this.mark.getSpec().enableSegments);\n\n if (this.diffState === DiffState.enter) {\n if (enterEncoder) {\n invokeEncoderToItems(this, items, enterEncoder, parameters, onlyFullEncodeFirst);\n }\n if (updateEncoder) {\n invokeEncoderToItems(this, items, updateEncoder, parameters, onlyFullEncodeFirst);\n }\n } else if (this.diffState === DiffState.update) {\n // if mark is reentered or mark is collection type, evaluate enter encode\n if ((isCollectionMark && enterEncoder) || isReentered) {\n invokeEncoderToItems(this, items, enterEncoder, parameters, onlyFullEncodeFirst);\n }\n if (updateEncoder) {\n invokeEncoderToItems(this, items, updateEncoder, parameters, onlyFullEncodeFirst);\n }\n } else if (this.diffState === DiffState.exit && exitEncoder) {\n // if mark is reentered, evaluate enter encode\n if (isReentered) {\n invokeEncoderToItems(this, items, enterEncoder, parameters, onlyFullEncodeFirst);\n }\n invokeEncoderToItems(this, items, exitEncoder, parameters, onlyFullEncodeFirst);\n }\n }\n\n protected coordinateTransformEncode(items: MarkElementItem[]) {\n if (!this.mark.coord || this.mark.markType === 'arc' || this.mark.disableCoordinateTransform === true) {\n return;\n }\n const coord = this.mark.coord.output() as IBaseCoordinate;\n\n items.forEach(item => {\n const nextAttrs = item.nextAttrs;\n const convertedPoint: IPointLike = coord.convert(nextAttrs);\n Object.assign(nextAttrs, convertedPoint);\n });\n }\n\n clearStates(hasAnimation?: boolean) {\n const stateAnimationEnable = isBoolean(hasAnimation)\n ? hasAnimation\n : this.mark.animate.getAnimationConfigs('state').length !== 0;\n\n this.states = [];\n\n if (this.graphicItem) {\n this.graphicItem.clearStates(stateAnimationEnable);\n }\n\n if (this.runtimeStatesEncoder) {\n this.runtimeStatesEncoder = {};\n }\n }\n\n private _updateRuntimeStates(state: string, attrs: any) {\n if (!this.runtimeStatesEncoder) {\n this.runtimeStatesEncoder = {};\n }\n\n this.runtimeStatesEncoder[state] = attrs;\n }\n\n hasState(state: string) {\n return this.states && state && this.states.includes(state);\n }\n\n updateStates(states: Record<string, boolean | BaseSingleEncodeSpec>) {\n if (!this.graphicItem) {\n return false;\n }\n let nextStates = this.states.slice();\n const encode = (this.mark.getSpec() as MarkSpec).encode;\n let forceClearState = false;\n let hasUpdate = false;\n\n Object.keys(states).forEach(stateKey => {\n if (!stateKey) {\n return;\n }\n\n const stateValue = states[stateKey];\n const isRuntimeStateUpdate =\n isObject(stateValue) && !isObjEqual(stateValue, this.runtimeStatesEncoder?.[stateKey]);\n\n if (isRuntimeStateUpdate) {\n if (nextStates.includes(stateKey)) {\n forceClearState = true;\n } else {\n nextStates.push(stateKey);\n }\n this._updateRuntimeStates(stateKey, stateValue);\n hasUpdate = true;\n } else if (stateValue) {\n if (!nextStates.includes(stateKey) && encode?.[stateKey]) {\n nextStates.push(stateKey);\n hasUpdate = true;\n }\n } else {\n if (nextStates.length) {\n const newNextStates = nextStates.filter(state => state !== stateKey);\n\n if (newNextStates.length !== nextStates.length) {\n hasUpdate = true;\n nextStates = newNextStates;\n }\n\n if (this.runtimeStatesEncoder && this.runtimeStatesEncoder[stateKey]) {\n this.runtimeStatesEncoder[stateKey] = null;\n }\n }\n }\n });\n\n if (forceClearState) {\n this.graphicItem.clearStates();\n }\n\n if (hasUpdate) {\n this.useStates(nextStates);\n return true;\n }\n\n return false;\n }\n\n addState(state: string | string[], attrs?: BaseSingleEncodeSpec) {\n if (!this.graphicItem) {\n return false;\n }\n\n const isRuntimeStateUpdate = attrs && isString(state) && !isObjEqual(attrs, this.runtimeStatesEncoder?.[state]);\n if (isRuntimeStateUpdate) {\n const nextStates = this.states.slice();\n if (!nextStates.includes(state)) {\n nextStates.push(state);\n } else {\n this.graphicItem.clearStates();\n }\n this._updateRuntimeStates(state, attrs);\n\n this.useStates(nextStates);\n return true;\n }\n\n const encode = (this.mark.getSpec() as MarkSpec).encode;\n const states = array(state);\n const nextStates = states.reduce((nextStates: string[], stateName: string) => {\n if (stateName && !nextStates.includes(stateName) && encode?.[stateName]) {\n nextStates.push(stateName);\n }\n return nextStates;\n }, this.states.slice());\n\n if (nextStates.length !== this.states.length) {\n this.useStates(nextStates);\n\n return true;\n }\n\n return false;\n }\n\n removeState(state: string | string[]) {\n if (!this.graphicItem) {\n return false;\n }\n\n const states = array(state);\n\n if (!states.length) {\n return false;\n }\n\n const nextStates = this.states.filter(state => !states.includes(state));\n if (nextStates.length === this.states.length) {\n return false;\n }\n\n if (this.runtimeStatesEncoder) {\n states.forEach(state => {\n this.runtimeStatesEncoder[state] = null;\n });\n }\n this.useStates(nextStates);\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 if (!encoder) {\n return {};\n }\n\n if (isFunction(encoder)) {\n return (encoder as StateProxyEncodeSpec)(this.getDatum(), this, stateName, nextStates);\n }\n\n if (!isRuntimeState && this.graphicItem.states?.[stateName]) {\n return this.graphicItem.states[stateName];\n }\n\n const stateItems = this.items.map(item => Object.assign({}, item, { nextAttrs: {} }));\n // collection图元,暂时不支持在state更新中,支持更新points更新\n invokeEncoderToItems(this, stateItems, encoder, (this.mark as any).parameters());\n\n const graphicAttributes = this.transformElementItems(stateItems, this.mark.markType);\n\n if (!this.graphicItem.states) {\n this.graphicItem.states = { [stateName]: graphicAttributes };\n } else if (!this.graphicItem.states[stateName]) {\n this.graphicItem.states[stateName] = graphicAttributes;\n }\n\n return graphicAttributes;\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 const stateSort = this.mark.getSpec()?.stateSort;\n\n if (stateSort) {\n states.sort(stateSort);\n }\n this.states = states;\n\n const stateAnimationEnable = isBoolean(hasAnimation)\n ? hasAnimation\n : this.mark.animate.getAnimationConfigs('state').length !== 0;\n\n this.graphicItem.stateProxy = 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 diffAttributes(graphicAttributes: { [channel: string]: any }) {\n const diffResult = {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes();\n for (const key in graphicAttributes) {\n if (!isEqual(key, finalGraphicAttributes, graphicAttributes) || !has(finalGraphicAttributes, key)) {\n diffResult[key] = graphicAttributes[key];\n }\n }\n return diffResult;\n }\n\n /**\n * tranform the attribute to graphic attribute\n * @param items\n * @param markType In ordinary, markType is equal to mark.markType, but in glyph, markType is different from mark.markType\n * @param markName\n * @param computePoints\n * @returns\n */\n transformElementItems(items: MarkElementItem[], markType: MarkType, computePoints?: boolean): Record<string, any> {\n const item = items[0];\n\n if (!item.nextAttrs || Object.keys(item.nextAttrs).length === 0) {\n return {};\n }\n\n let nextAttrs = item.nextAttrs;\n\n if (\n isPointsMarkType(markType) &&\n items &&\n items.length &&\n isNil(item.nextAttrs?.points) &&\n (computePoints === true || isValidPointsChannel(Object.keys(item.nextAttrs), this.mark.markType))\n ) {\n const markSpec = this.mark.getSpec();\n const lastPoints = this.getGraphicAttribute('points', false);\n const lastSegments = this.getGraphicAttribute('segments', false);\n const enableSegments = markSpec.enableSegments;\n const connectNullsEncoder = (this.mark.getSpec() as MarkSpec).encode?.[BuiltInEncodeNames.connectNulls];\n const itemNextAttrs = items.map(item => item.nextAttrs);\n const isProgressive = this.mark.isProgressive();\n nextAttrs = parseCollectionMarkAttributes(nextAttrs);\n\n if (markType === GrammarMarkType.line || markType === GrammarMarkType.area) {\n const linePoints = getLinePoints(items, true, lastPoints, markType === GrammarMarkType.area);\n\n // vchart新增了配置,用于开启线段解析;渐进渲染状态不支持线段样式;也不支持连接线\n if (isProgressive) {\n nextAttrs.segments = ((this.graphicItem as ILine)?.attribute?.segments ?? []).concat([\n { points: linePoints }\n ]);\n } else if (connectNullsEncoder) {\n nextAttrs.segments = getConnectLineSegmentConfigs(itemNextAttrs, linePoints, this);\n\n if (nextAttrs.segments && nextAttrs.segments.some((seg: any) => seg.isConnect)) {\n const connectStyle = invokeEncoder(connectNullsEncoder, this.getDatum(), this, this.mark.parameters());\n\n connectStyle &&\n nextAttrs.segments.forEach((seg: any) => {\n if (seg.isConnect) {\n Object.assign(seg, connectStyle);\n }\n });\n }\n // when connectNulls, points need to be saved\n nextAttrs.points = linePoints;\n } else if (enableSegments) {\n const points = !linePoints || linePoints.length === 0 ? getLinePointsFromSegments(lastSegments) : linePoints;\n const segments = getLineSegmentConfigs(itemNextAttrs, points, this);\n\n if (segments) {\n nextAttrs.segments = segments;\n nextAttrs.points = null;\n } else {\n nextAttrs.segments = null;\n nextAttrs.points = points;\n }\n } else {\n nextAttrs.points = linePoints;\n nextAttrs.segments = null;\n }\n } else if (markType === GrammarMarkType.largeRects) {\n nextAttrs.points = getLargeRectsPoints(items, true, lastPoints);\n } else if (markType === GrammarMarkType.largeSymbols) {\n nextAttrs.points = getLargeSymbolsPoints(items, true, lastPoints);\n }\n }\n\n return nextAttrs;\n }\n\n protected applyGraphicAttributes(graphicAttributes: any) {\n if (isEmpty(graphicAttributes)) {\n return;\n }\n\n if (this.mark.needAnimate()) {\n // If mark need animate, diff attributes.\n const nextGraphicAttributes = this.diffAttributes(graphicAttributes);\n const prevGraphicAttributes = this.getPrevGraphicAttributes() ?? {};\n const finalGraphicAttributes = this.getFinalGraphicAttributes() ?? {};\n\n Object.keys(nextGraphicAttributes).forEach(channel => {\n prevGraphicAttributes[channel] = this.getGraphicAttribute(channel);\n finalGraphicAttributes[channel] = nextGraphicAttributes[channel];\n });\n this.setNextGraphicAttributes(nextGraphicAttributes);\n this.setPrevGraphicAttributes(prevGraphicAttributes);\n this.setFinalGraphicAttributes(finalGraphicAttributes);\n\n const currentAnimators = this.mark.animate.getElementAnimators(this);\n const animateGraphicAttributes = currentAnimators.reduce((attributes, animator) => {\n return Object.assign(attributes, animator.getEndAttributes());\n }, {});\n const currentGraphicAttributes = Object.assign({}, animateGraphicAttributes, finalGraphicAttributes);\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 this.graphicItem.setAttributes(currentGraphicAttributes);\n } else {\n // Otherwise, directly apply all attributes.\n this.graphicItem.setAttributes(graphicAttributes);\n }\n }\n\n getGraphicAttribute(channel: string, prev: boolean = false) {\n if (!this.graphicItem) {\n return undefined;\n }\n\n if (prev) {\n let value: any;\n const prevGraphicAttributes = this.getPrevGraphicAttributes();\n if (!isNil((value = get(prevGraphicAttributes, channel)))) {\n return value;\n }\n }\n\n // get attribute before transformed\n const trans = this.mark.getAttributeTransforms();\n let getKey: string[] = [channel];\n if (trans && trans.length) {\n const channelTransform = trans.find(entry => {\n return entry.storedAttrs && entry.channels.includes(channel);\n });\n\n if (channelTransform) {\n getKey = [channelTransform.storedAttrs, channel];\n }\n }\n return get(this.graphicItem?.attribute, getKey);\n }\n\n setGraphicAttribute(channel: string, value: any, final: boolean = true) {\n if (!this.graphicItem) {\n return;\n }\n const finalGraphicAttributes = this.getFinalGraphicAttributes();\n const prevGraphicAttributes = this.getPrevGraphicAttributes();\n\n if (final && finalGraphicAttributes) {\n finalGraphicAttributes[channel] = value;\n }\n if (prevGraphicAttributes && !has(prevGraphicAttributes, channel)) {\n prevGraphicAttributes[channel] = this.graphicItem.attribute[channel];\n }\n\n this.graphicItem.setAttribute(channel, value);\n }\n\n setGraphicAttributes(attributes: { [channel: string]: any }, final: boolean = true) {\n if (!this.graphicItem) {\n return;\n }\n const finalGraphicAttributes = this.getFinalGraphicAttributes();\n const prevGraphicAttributes = this.getPrevGraphicAttributes();\n\n Object.keys(attributes).forEach(key => {\n if (finalGraphicAttributes && final) {\n finalGraphicAttributes[key] = attributes[key];\n }\n if (prevGraphicAttributes && !has(prevGraphicAttributes, key)) {\n prevGraphicAttributes[key] = this.graphicItem.attribute[key];\n }\n });\n\n this.graphicItem.setAttributes(attributes);\n }\n\n /**\n * 获取 vRender 已变更的视觉通道属性,只应当由 VGrammar 中 调用\n * @returns 视觉通道键值对\n */\n getFinalGraphicAttributes() {\n return (this.graphicItem as any).finalAttrs;\n }\n\n protected setFinalGraphicAttributes(attributes: { [channel: string]: any }) {\n (this.graphicItem as any).finalAttrs = attributes;\n }\n\n /**\n * 获取 vRender 变更前的视觉通道属性,只应当由 VGrammar 调用\n * @returns 视觉通道键值对\n */\n getPrevGraphicAttributes() {\n return (this.graphicItem as any).prevAttrs;\n }\n\n protected setPrevGraphicAttributes(attributes: { [channel: string]: any }) {\n (this.graphicItem as any).prevAttrs = attributes;\n }\n\n /**\n * 获取 vRender 在单次 dataflow 中变更的视觉通道属性,只应当由 VGrammar 调用\n * @returns 视觉通道键值对\n */\n getNextGraphicAttributes() {\n return (this.graphicItem as any).nextAttrs;\n }\n\n /**\n * 在动画执行中获取图元最终的视觉通道结果\n * @param channel 视觉通道\n */\n getFinalAnimationAttribute(channel: string) {\n return this.getFinalGraphicAttributes()?.[channel] ?? this.getGraphicAttribute(channel);\n }\n getFinalAnimationAttributes() {\n return this.getFinalGraphicAttributes() ?? this.graphicItem.attribute;\n }\n\n protected setNextGraphicAttributes(attributes: { [channel: string]: any }) {\n (this.graphicItem as any).nextAttrs = attributes;\n }\n\n clearChangedGraphicAttributes() {\n if (this.graphicItem) {\n this.setPrevGraphicAttributes(null);\n this.setNextGraphicAttributes(null);\n }\n }\n\n clearGraphicAttributes() {\n if (this.graphicItem) {\n (this.graphicItem as any).prevAttrs && this.setPrevGraphicAttributes(null);\n (this.graphicItem as any).nextAttrs && this.setNextGraphicAttributes(null);\n (this.graphicItem as any).finalAttrs && this.setFinalGraphicAttributes(null);\n }\n }\n\n remove() {\n if (this.graphicItem) {\n removeGraphicItem(this.graphicItem);\n this.graphicItem = null;\n }\n }\n\n release() {\n this.removeGraphicItem();\n this.mark = null;\n this.data = null;\n this.items = null;\n }\n /**\n * hack support for transform & encode logic. DO NOT USE.\n */\n getItemAttribute(channel?: string) {\n if (!this.items?.length) {\n return;\n }\n\n if (this.mark.isCollectionMark()) {\n return isNil(channel)\n ? this.items.map(item => item.nextAttrs)\n : this.items.map(item => item.nextAttrs?.[channel]);\n }\n\n return isNil(channel) ? this.items[0].nextAttrs : this.items[0].nextAttrs?.[channel];\n }\n setItemAttributes(attributes: { [channel: string]: any } | any[]) {\n if (!this.items?.length) {\n return;\n }\n\n if (this.mark.isCollectionMark()) {\n if (isArray(attributes)) {\n this.items.forEach((item, index) => {\n Object.assign(item.nextAttrs, attributes[index]);\n });\n }\n } else {\n Object.assign(this.items[0].nextAttrs, attributes);\n }\n }\n /**\n * hack support for transform & encode logic. DO NOT USE.\n */\n getItem() {\n return this.mark && this.mark.isCollectionMark() ? this.items ?? [] : this.items?.[0];\n }\n getDatum() {\n return this.mark && this.mark.isCollectionMark() ? this.data ?? [] : this.data?.[0];\n }\n}\n"]}
@@ -57,8 +57,8 @@ class GlyphElement extends element_1.Element {
57
57
  }
58
58
  encodeGraphic() {
59
59
  this.coordinateTransformEncode(this.items);
60
- const graphicAttributes = this.transformElementItems(this.items, this.mark.markType);
61
- this.graphicItem || this.initGraphicItem(), this.diffState === enums_1.DiffState.enter ? (this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!0),
60
+ const graphicAttributes = this.transformElementItems(this.items, this.mark.markType), isGraphicInit = !this.graphicItem;
61
+ this.graphicItem || this.initGraphicItem(), this.diffState === enums_1.DiffState.enter || isGraphicInit ? (this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!0),
62
62
  this.applyGraphicAttributes(graphicAttributes), this.graphicItem.onBeforeAttributeUpdate = this._onGlyphAttributeUpdate(!1)) : this.applyGraphicAttributes(graphicAttributes),
63
63
  this.diffState !== enums_1.DiffState.enter && this.diffState !== enums_1.DiffState.update || !this.states.length || (Object.values(this.glyphGraphicItems).forEach((graphicItem => {
64
64
  graphicItem.states = {};
@@ -89,7 +89,7 @@ class GlyphElement extends element_1.Element {
89
89
  }
90
90
  encodeDefault() {
91
91
  const defaultEncodeValues = {};
92
- if (this.diffState === enums_1.DiffState.enter && this.glyphMeta.getDefaultEncoder()) {
92
+ if (this.glyphMeta.getDefaultEncoder()) {
93
93
  const defaultEncodeResult = this.glyphMeta.getDefaultEncoder().call(null, this.getDatum(), this, this.mark.getGlyphConfig());
94
94
  Object.assign(defaultEncodeValues, defaultEncodeResult);
95
95
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":";;;AAAA,6CAAqE;AACrE,2DAAkD;AAUlD,sDAAuF;AACvF,2CAAmE;AACnE,mCAAiE;AACjE,uCAAoC;AACpC,0CAAqD;AAGrD,MAAa,YAAa,SAAQ,iBAAO;IAQvC,YAAY,IAAgB;QAC1B,KAAK,CAAC,IAAI,CAAC,CAAC;QAuDJ,kBAAa,GAAG,CAAC,SAAiB,EAAE,UAAoB,EAAE,EAAE;;YACpE,MAAM,cAAc,GAAG,CAAC,IAAA,cAAK,EAAC,MAAA,IAAI,CAAC,oBAAoB,0CAAG,SAAS,CAAC,CAAC,CAAC;YACtE,MAAM,OAAO,GAAG,cAAc;gBAC5B,CAAC,iCACM,MAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAe,CAAC,MAAM,0CAAG,SAAS,CAAC,GACrD,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAE3C,CAAC,CAAC,MAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAe,CAAC,MAAM,0CAAG,SAAS,CAAC,CAAC;YAE1D,MAAM,oBAAoB,GAAG,EAG5B,CAAC;YAEF,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,oBAAoB,CAAC;aAC7B;YAED,IAAI,IAAA,mBAAU,EAAC,OAAO,CAAC,EAAE;gBACvB,oBAAoB,CAAC,UAAU,GAAI,OAAgC,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;gBAClH,OAAO,oBAAoB,CAAC;aAC7B;YAED,IAAI,CAAC,cAAc,KAAI,MAAA,IAAI,CAAC,WAAW,CAAC,WAAW,0CAAG,SAAS,CAAC,CAAA,EAAE;gBAChE,OAAO,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,CA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E,QAAQ,CAAC,CAAC;YAC9C,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAChD,CAAC,CAAC,CAAC;IACL,CAAC;IAED,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,4BAAgB,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;AAlZD,oCAkZC","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 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 (!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
+ {"version":3,"sources":["../src/graph/glyph-element.ts"],"names":[],"mappings":";;;AAAA,6CAAqE;AACrE,2DAAkD;AAUlD,sDAAuF;AACvF,2CAAmE;AACnE,mCAAiE;AACjE,uCAAoC;AACpC,0CAAqD;AAGrD,MAAa,YAAa,SAAQ,iBAAO;IAQvC,YAAY,IAAgB;QAC1B,KAAK,CAAC,IAAI,CAAC,CAAC;QAuDJ,kBAAa,GAAG,CAAC,SAAiB,EAAE,UAAoB,EAAE,EAAE;;YACpE,MAAM,cAAc,GAAG,CAAC,IAAA,cAAK,EAAC,MAAA,IAAI,CAAC,oBAAoB,0CAAG,SAAS,CAAC,CAAC,CAAC;YACtE,MAAM,OAAO,GAAG,cAAc;gBAC5B,CAAC,iCACM,MAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAe,CAAC,MAAM,0CAAG,SAAS,CAAC,GACrD,IAAI,CAAC,oBAAoB,CAAC,SAAS,CAAC,EAE3C,CAAC,CAAC,MAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAe,CAAC,MAAM,0CAAG,SAAS,CAAC,CAAC;YAE1D,MAAM,oBAAoB,GAAG,EAG5B,CAAC;YAEF,IAAI,CAAC,OAAO,EAAE;gBACZ,OAAO,oBAAoB,CAAC;aAC7B;YAED,IAAI,IAAA,mBAAU,EAAC,OAAO,CAAC,EAAE;gBACvB,oBAAoB,CAAC,UAAU,GAAI,OAAgC,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;gBAClH,OAAO,oBAAoB,CAAC;aAC7B;YAED,IAAI,CAAC,cAAc,KAAI,MAAA,I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unction } 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"]}
package/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const version = "0.13.15";
1
+ export declare const version = "0.13.16-alpha.1";
2
2
  export * from './graph';
3
3
  export * from './interactions';
4
4
  export { View } from './view';
package/cjs/index.js CHANGED
@@ -18,7 +18,8 @@ var __createBinding = this && this.__createBinding || (Object.create ? function(
18
18
  Object.defineProperty(exports, "__esModule", {
19
19
  value: !0
20
20
  }), exports.vglobal = exports.ThemeManager = exports.SIGNAL_VIEW_BOX = exports.SIGNAL_WIDTH = exports.SIGNAL_VIEW_WIDTH = exports.SIGNAL_VIEW_HEIGHT = exports.SIGNAL_PADDING = exports.SIGNAL_HEIGHT = exports.SIGNAL_AUTOFIT = exports.Factory = exports.GrammarBase = exports.invokeFunctionType = exports.parseFunctionType = exports.registerCoordinate = exports.Coordinate = exports.registerScale = exports.Scale = exports.View = exports.version = void 0,
21
- exports.version = "0.13.15", __exportStar(require("./graph"), exports), __exportStar(require("./interactions"), exports);
21
+ exports.version = "0.13.16-alpha.1", __exportStar(require("./graph"), exports),
22
+ __exportStar(require("./interactions"), exports);
22
23
 
23
24
  var view_1 = require("./view");
24
25
 
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,SAAS,CAAC;AAEjC,0CAAwB;AAExB,iDAA+B;AAE/B,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,sCAAoD;AAA3C,8FAAA,KAAK,OAAA;AAAE,sGAAA,aAAa,OAAA;AAC7B,gDAAmE;AAA1D,wGAAA,UAAU,OAAA;AAAE,gHAAA,kBAAkB,OAAA;AACvC,qCAAqE;AAA5D,yGAAA,iBAAiB,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAC9C,oDAAkD;AAAzC,2GAAA,WAAW,OAAA;AACpB,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAChB,8CAQ0B;AAPxB,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,2GAAA,cAAc,OAAA;AACd,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AAGjB,uDAAqD;AAA5C,6GAAA,YAAY,OAAA;AAErB,0CAAwB;AACxB,8CAA4B;AAC5B,+CAA6B;AAC7B,8DAA4C;AAE5C,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAChB,wCAAsB;AACtB,iDAA+B;AAC/B,wDAAsC;AACtC,4DAA0C;AAC1C,uDAAqC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.13.15\";\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"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AACa,QAAA,OAAO,GAAG,iBAAiB,CAAC;AAEzC,0CAAwB;AAExB,iDAA+B;AAE/B,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,sCAAoD;AAA3C,8FAAA,KAAK,OAAA;AAAE,sGAAA,aAAa,OAAA;AAC7B,gDAAmE;AAA1D,wGAAA,UAAU,OAAA;AAAE,gHAAA,kBAAkB,OAAA;AACvC,qCAAqE;AAA5D,yGAAA,iBAAiB,OAAA;AAAE,0GAAA,kBAAkB,OAAA;AAC9C,oDAAkD;AAAzC,2GAAA,WAAW,OAAA;AACpB,8CAA4B;AAC5B,0CAAwB;AACxB,0CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAChB,8CAQ0B;AAPxB,2GAAA,cAAc,OAAA;AACd,0GAAA,aAAa,OAAA;AACb,2GAAA,cAAc,OAAA;AACd,+GAAA,kBAAkB,OAAA;AAClB,8GAAA,iBAAiB,OAAA;AACjB,yGAAA,YAAY,OAAA;AACZ,4GAAA,eAAe,OAAA;AAGjB,uDAAqD;AAA5C,6GAAA,YAAY,OAAA;AAErB,0CAAwB;AACxB,8CAA4B;AAC5B,+CAA6B;AAC7B,8DAA4C;AAE5C,uDAAiD;AAAxC,uGAAA,OAAO,OAAA;AAChB,wCAAsB;AACtB,iDAA+B;AAC/B,wDAAsC;AACtC,4DAA0C;AAC1C,uDAAqC","file":"index.js","sourcesContent":["// -- Exports -----\nexport const version = \"0.13.16-alpha.1\";\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"]}