@visactor/vrender-core 1.1.8-alpha.1 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -11409,6 +11409,17 @@ class GraphicImpl extends Node {
11409
11409
  }
11410
11410
  return true;
11411
11411
  }
11412
+ hasStatePatch(patch) {
11413
+ if (!patch) {
11414
+ return false;
11415
+ }
11416
+ for (const key in patch) {
11417
+ if (Object.prototype.hasOwnProperty.call(patch, key)) {
11418
+ return true;
11419
+ }
11420
+ }
11421
+ return false;
11422
+ }
11412
11423
  commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = false) {
11413
11424
  var _a;
11414
11425
  const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
@@ -11524,6 +11535,10 @@ class GraphicImpl extends Node {
11524
11535
  this.resolvedStatePatch = undefined;
11525
11536
  this.sharedStateDirty = false;
11526
11537
  this.clearSharedStateActiveRegistrations();
11538
+ if (!this.attributeMayContainTransientAttrs && !this.hasStatePatch(previousResolvedStatePatch)) {
11539
+ this.emitStateUpdateEvent();
11540
+ return;
11541
+ }
11527
11542
  if (hasAnimation) {
11528
11543
  this._syncFinalAttributeFromStaticTruth();
11529
11544
  const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
@@ -11608,6 +11623,12 @@ class GraphicImpl extends Node {
11608
11623
  this.resolvedStatePatch = resolvedStateAttrs;
11609
11624
  this.sharedStateDirty = false;
11610
11625
  this.syncSharedStateActiveRegistrations();
11626
+ if (!this.attributeMayContainTransientAttrs &&
11627
+ !this.hasStatePatch(previousResolvedStatePatch) &&
11628
+ !this.hasStatePatch(resolvedStateAttrs)) {
11629
+ this.emitStateUpdateEvent();
11630
+ return;
11631
+ }
11611
11632
  if (hasAnimation) {
11612
11633
  this._syncFinalAttributeFromStaticTruth();
11613
11634
  const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
@@ -28,5 +28,4 @@ export class DefaultBoundsAllocate {
28
28
  }
29
29
  }
30
30
 
31
- export const boundsAllocate = new DefaultBoundsAllocate;
32
- //# sourceMappingURL=bounds-allocate.js.map
31
+ export const boundsAllocate = new DefaultBoundsAllocate;
@@ -1,4 +1,5 @@
1
1
  export const DefaultStateAnimateConfig = {
2
2
  duration: 200,
3
3
  easing: "cubicOut"
4
- };
4
+ };
5
+ //# sourceMappingURL=config.js.map
@@ -8,4 +8,4 @@ Object.keys(DEFAULT_COLORS).forEach((k => {
8
8
  }));
9
9
 
10
10
  export default parsedColors;
11
- //# sourceMappingURL=colorName.js.map
11
+ //# sourceMappingURL=colorName.js.map
@@ -3,4 +3,4 @@ export * from "./interpolate";
3
3
  export * from "./store";
4
4
 
5
5
  export * from "./colorName";
6
- //# sourceMappingURL=index.js.map
6
+ //# sourceMappingURL=index.js.map
@@ -104,4 +104,4 @@ export function colorStringInterpolationToStr(fromColor, toColor, ratio) {
104
104
  return ColorStore.Get(fromColor, ColorType.Color255, _fromColorRGB), ColorStore.Get(toColor, ColorType.Color255, _toColorRGB),
105
105
  `rgba(${Math.round(_fromColorRGB[0] + (_toColorRGB[0] - _fromColorRGB[0]) * ratio)},${Math.round(_fromColorRGB[1] + (_toColorRGB[1] - _fromColorRGB[1]) * ratio)},${Math.round(_fromColorRGB[2] + (_toColorRGB[2] - _fromColorRGB[2]) * ratio)},${_fromColorRGB[3] + (_toColorRGB[3] - _fromColorRGB[3]) * ratio})`;
106
106
  }
107
- //# sourceMappingURL=interpolate.js.map
107
+ //# sourceMappingURL=interpolate.js.map
@@ -45,4 +45,4 @@ export class ColorStore {
45
45
  }
46
46
 
47
47
  ColorStore.store255 = {}, ColorStore.store1 = {};
48
- //# sourceMappingURL=store.js.map
48
+ //# sourceMappingURL=store.js.map
@@ -49,4 +49,5 @@ export class BoundsContext {
49
49
  this.bounds.clear();
50
50
  }
51
51
  release(...params) {}
52
- }
52
+ }
53
+ //# sourceMappingURL=bounds-context.js.map
@@ -10,5 +10,4 @@ export function getContributionStoreState() {
10
10
  const scope = globalThis;
11
11
  return scope[CONTRIBUTION_STORE_STATE_SYMBOL] || (scope[CONTRIBUTION_STORE_STATE_SYMBOL] = createContributionStoreState()),
12
12
  scope[CONTRIBUTION_STORE_STATE_SYMBOL];
13
- }
14
- //# sourceMappingURL=contribution-store-state.js.map
13
+ }
@@ -25,4 +25,5 @@ export class PerformanceRAF {
25
25
  this.addAnimationFrameCb((() => resolve()));
26
26
  }));
27
27
  }
28
- }
28
+ }
29
+ //# sourceMappingURL=performance-raf.js.map
@@ -5,5 +5,4 @@ export function renderCommandList(commandList, context, x = 0, y = 0, sx = 1, sy
5
5
  const command = commandList[i];
6
6
  commandFuncs[command[0]](command, context, x, y, sx, sy, z);
7
7
  }
8
- }
9
- //# sourceMappingURL=render-command-list.js.map
8
+ }
@@ -30,4 +30,4 @@ export function flatten_simplify(points, tolerance, highestQuality) {
30
30
  if (points.length <= 10) return points;
31
31
  return points = highestQuality ? points : simplifyRadialDist(points, void 0 !== tolerance ? tolerance * tolerance : 1);
32
32
  }
33
- //# sourceMappingURL=simplify.js.map
33
+ //# sourceMappingURL=simplify.js.map
package/es/common/sort.js CHANGED
@@ -94,4 +94,4 @@ export function findNextGraphic(graphic, id, defaultZIndex, reverse = !1) {
94
94
  !1)), reverse);
95
95
  return result;
96
96
  }
97
- //# sourceMappingURL=sort.js.map
97
+ //# sourceMappingURL=sort.js.map
@@ -248,4 +248,4 @@ export const splitPath = (path, count) => {
248
248
  }
249
249
  return res;
250
250
  };
251
- //# sourceMappingURL=split-path.js.map
251
+ //# sourceMappingURL=split-path.js.map
package/es/common/text.js CHANGED
@@ -24,4 +24,4 @@ export function textAttributesToStyle(attrs) {
24
24
  attrs.underline ? style["text-decoration"] = "underline" : attrs.lineThrough && (style["text-decoration"] = "line-through"),
25
25
  attrs.fill && isString(attrs.fill) && (style.color = attrs.fill), style;
26
26
  }
27
- //# sourceMappingURL=text.js.map
27
+ //# sourceMappingURL=text.js.map
@@ -262,6 +262,7 @@ declare abstract class GraphicImpl<T extends Partial<IGraphicAttribute> = Partia
262
262
  shouldRefreshSameStatePatch: boolean;
263
263
  };
264
264
  protected sameStatePatches(left?: Partial<T>, right?: Partial<T>): boolean;
265
+ protected hasStatePatch(patch?: Partial<T>): boolean;
265
266
  protected commitSameStatePatchRefresh(states: string[], hasAnimation?: boolean, animateSameStatePatchChange?: boolean): void;
266
267
  protected resolveStateAnimateConfig(animateConfig?: IAnimateConfig): any;
267
268
  applyStateAttrs(attrs: Partial<T>, stateNames: string[], hasAnimation?: boolean, isClear?: boolean, animateConfig?: IAnimateConfig, extraAnimateAttrs?: Partial<T>, stateTransitionTargetAttrs?: Partial<T>): void;
@@ -993,6 +993,11 @@ class GraphicImpl extends Node {
993
993
  }
994
994
  return !0;
995
995
  }
996
+ hasStatePatch(patch) {
997
+ if (!patch) return !1;
998
+ for (const key in patch) if (Object.prototype.hasOwnProperty.call(patch, key)) return !0;
999
+ return !1;
1000
+ }
996
1001
  commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
997
1002
  var _a;
998
1003
  const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, {transition: transition, effectiveStates: effectiveStates, resolvedStateAttrs: resolvedStateAttrs} = this.resolveGraphicStateTransition(states, !0), patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
@@ -1056,7 +1061,7 @@ class GraphicImpl extends Node {
1056
1061
  const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
1057
1062
  if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) if (this.currentStates = transition.states,
1058
1063
  this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1,
1059
- this.clearSharedStateActiveRegistrations(), hasAnimation) {
1064
+ this.clearSharedStateActiveRegistrations(), this.attributeMayContainTransientAttrs || this.hasStatePatch(previousResolvedStatePatch)) if (hasAnimation) {
1060
1065
  this._syncFinalAttributeFromStaticTruth();
1061
1066
  const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
1062
1067
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
@@ -1064,7 +1069,7 @@ class GraphicImpl extends Node {
1064
1069
  type: AttributeUpdateType.STATE
1065
1070
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
1066
1071
  type: AttributeUpdateType.STATE
1067
- }), this.emitStateUpdateEvent();
1072
+ }), this.emitStateUpdateEvent(); else this.emitStateUpdateEvent();
1068
1073
  }
1069
1074
  removeState(stateName, hasAnimation) {
1070
1075
  const transition = this.resolveRemoveStateTransition(stateName);
@@ -1095,7 +1100,7 @@ class GraphicImpl extends Node {
1095
1100
  const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, {transition: transition, effectiveStates: effectiveStates, resolvedStateAttrs: resolvedStateAttrs} = this.resolveGraphicStateTransition(states);
1096
1101
  if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) if (this.currentStates = transition.states,
1097
1102
  this.effectiveStates = [ ...effectiveStates ], this.resolvedStatePatch = resolvedStateAttrs,
1098
- this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation) {
1103
+ this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.attributeMayContainTransientAttrs || this.hasStatePatch(previousResolvedStatePatch) || this.hasStatePatch(resolvedStateAttrs)) if (hasAnimation) {
1099
1104
  this._syncFinalAttributeFromStaticTruth();
1100
1105
  const removedStateAnimationAttrs = this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch);
1101
1106
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.extraAttrs, null == removedStateAnimationAttrs ? void 0 : removedStateAnimationAttrs.stateTransitionTargetAttrs);
@@ -1103,7 +1108,7 @@ class GraphicImpl extends Node {
1103
1108
  type: AttributeUpdateType.STATE
1104
1109
  }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
1105
1110
  type: AttributeUpdateType.STATE
1106
- }), this.emitStateUpdateEvent();
1111
+ }), this.emitStateUpdateEvent(); else this.emitStateUpdateEvent();
1107
1112
  }
1108
1113
  invalidateResolver() {
1109
1114
  var _a, _b;