@visactor/vrender-core 1.1.0-alpha.2 → 1.1.0-alpha.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/cjs/canvas/constants.js +2 -1
  2. package/cjs/color-string/index.js +1 -2
  3. package/cjs/common/diff.js +1 -2
  4. package/cjs/common/event-transformer.js +2 -1
  5. package/cjs/common/rect-utils.js +1 -1
  6. package/cjs/common/render-area.js +1 -1
  7. package/cjs/common/render-command-list.js +1 -1
  8. package/cjs/common/render-curve.js +1 -1
  9. package/cjs/common/render-utils.js +1 -1
  10. package/cjs/common/seg-context.js +1 -2
  11. package/cjs/common/simplify.js +1 -1
  12. package/cjs/common/sort.js +1 -1
  13. package/cjs/common/split-path.js +1 -1
  14. package/cjs/common/store.js +1 -1
  15. package/cjs/common/text.js +1 -1
  16. package/cjs/common/utils.js +1 -1
  17. package/cjs/core/camera.js +1 -1
  18. package/cjs/core/constants.js +1 -1
  19. package/cjs/core/core-modules.js +1 -1
  20. package/cjs/core/global-module.js +2 -0
  21. package/cjs/core/global.js +1 -1
  22. package/cjs/core/graphic-utils.js +1 -1
  23. package/cjs/core/index.js +1 -1
  24. package/cjs/core/layer-service.js +2 -1
  25. package/cjs/core/layer.js +1 -1
  26. package/cjs/core/light.js +1 -1
  27. package/cjs/core/stage.d.ts +4 -1
  28. package/cjs/core/stage.js +24 -12
  29. package/cjs/core/stage.js.map +1 -1
  30. package/cjs/core/window.js +1 -1
  31. package/cjs/graphic/graphic-service/graphic-service.d.ts +4 -0
  32. package/cjs/graphic/graphic-service/graphic-service.js +6 -5
  33. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  34. package/cjs/graphic/graphic.d.ts +72 -11
  35. package/cjs/graphic/graphic.js +509 -158
  36. package/cjs/graphic/graphic.js.map +1 -1
  37. package/cjs/graphic/group.d.ts +5 -1
  38. package/cjs/graphic/group.js +37 -18
  39. package/cjs/graphic/group.js.map +1 -1
  40. package/cjs/graphic/rect.d.ts +2 -0
  41. package/cjs/graphic/rect.js +44 -0
  42. package/cjs/graphic/rect.js.map +1 -1
  43. package/cjs/graphic/state/shared-state-refresh.js +4 -3
  44. package/cjs/graphic/state/shared-state-refresh.js.map +1 -1
  45. package/cjs/graphic/state/shared-state-scope.js +1 -1
  46. package/cjs/graphic/state/shared-state-scope.js.map +1 -1
  47. package/cjs/graphic/state/state-engine.js +2 -2
  48. package/cjs/graphic/state/state-engine.js.map +1 -1
  49. package/cjs/graphic/state/state-perf-monitor.d.ts +1 -0
  50. package/cjs/graphic/state/state-perf-monitor.js +9 -2
  51. package/cjs/graphic/state/state-perf-monitor.js.map +1 -1
  52. package/cjs/graphic/state/state-style-resolver.d.ts +0 -9
  53. package/cjs/graphic/state/state-style-resolver.js +0 -23
  54. package/cjs/graphic/state/state-style-resolver.js.map +1 -1
  55. package/cjs/graphic/state/state-transition-orchestrator.d.ts +5 -0
  56. package/cjs/graphic/state/state-transition-orchestrator.js +17 -5
  57. package/cjs/graphic/state/state-transition-orchestrator.js.map +1 -1
  58. package/cjs/interface/animation/animate.d.ts +1 -0
  59. package/cjs/interface/animation/animate.js.map +1 -1
  60. package/cjs/interface/graphic.d.ts +9 -0
  61. package/cjs/interface/graphic.js.map +1 -1
  62. package/cjs/interface/node-tree.js.map +1 -1
  63. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  64. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +20 -10
  65. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  66. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  67. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  68. package/cjs/render/contributions/render/base-render.js +8 -7
  69. package/cjs/render/contributions/render/base-render.js.map +1 -1
  70. package/dist/index.es.js +1134 -279
  71. package/es/canvas/constants.js +2 -1
  72. package/es/color-string/index.js +1 -2
  73. package/es/common/diff.js +1 -2
  74. package/es/common/event-transformer.js +2 -1
  75. package/es/common/rect-utils.js +1 -1
  76. package/es/common/render-area.js +1 -1
  77. package/es/common/render-command-list.js +1 -1
  78. package/es/common/render-curve.js +1 -1
  79. package/es/common/render-utils.js +1 -1
  80. package/es/common/seg-context.js +1 -2
  81. package/es/common/simplify.js +1 -1
  82. package/es/common/sort.js +1 -1
  83. package/es/common/split-path.js +1 -1
  84. package/es/common/store.js +1 -1
  85. package/es/common/text.js +1 -1
  86. package/es/common/utils.js +1 -1
  87. package/es/core/camera.js +1 -1
  88. package/es/core/constants.js +1 -1
  89. package/es/core/core-modules.js +1 -1
  90. package/es/core/global-module.js +2 -0
  91. package/es/core/global.js +1 -1
  92. package/es/core/graphic-utils.js +1 -1
  93. package/es/core/index.js +1 -1
  94. package/es/core/layer-service.js +2 -1
  95. package/es/core/layer.js +1 -1
  96. package/es/core/light.js +1 -1
  97. package/es/core/stage.d.ts +4 -1
  98. package/es/core/stage.js +22 -11
  99. package/es/core/stage.js.map +1 -1
  100. package/es/core/window.js +1 -1
  101. package/es/graphic/graphic-service/graphic-service.d.ts +4 -0
  102. package/es/graphic/graphic-service/graphic-service.js +6 -5
  103. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  104. package/es/graphic/graphic.d.ts +72 -11
  105. package/es/graphic/graphic.js +504 -151
  106. package/es/graphic/graphic.js.map +1 -1
  107. package/es/graphic/group.d.ts +5 -1
  108. package/es/graphic/group.js +36 -18
  109. package/es/graphic/group.js.map +1 -1
  110. package/es/graphic/rect.d.ts +2 -0
  111. package/es/graphic/rect.js +44 -0
  112. package/es/graphic/rect.js.map +1 -1
  113. package/es/graphic/state/shared-state-refresh.js +5 -4
  114. package/es/graphic/state/shared-state-refresh.js.map +1 -1
  115. package/es/graphic/state/shared-state-scope.js +2 -2
  116. package/es/graphic/state/shared-state-scope.js.map +1 -1
  117. package/es/graphic/state/state-engine.js +3 -3
  118. package/es/graphic/state/state-engine.js.map +1 -1
  119. package/es/graphic/state/state-perf-monitor.d.ts +1 -0
  120. package/es/graphic/state/state-perf-monitor.js +7 -0
  121. package/es/graphic/state/state-perf-monitor.js.map +1 -1
  122. package/es/graphic/state/state-style-resolver.d.ts +0 -9
  123. package/es/graphic/state/state-style-resolver.js +0 -23
  124. package/es/graphic/state/state-style-resolver.js.map +1 -1
  125. package/es/graphic/state/state-transition-orchestrator.d.ts +5 -0
  126. package/es/graphic/state/state-transition-orchestrator.js +17 -5
  127. package/es/graphic/state/state-transition-orchestrator.js.map +1 -1
  128. package/es/interface/animation/animate.d.ts +1 -0
  129. package/es/interface/animation/animate.js.map +1 -1
  130. package/es/interface/graphic.d.ts +9 -0
  131. package/es/interface/graphic.js.map +1 -1
  132. package/es/interface/node-tree.js.map +1 -1
  133. package/es/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  134. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +20 -10
  135. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  136. package/es/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  137. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  138. package/es/render/contributions/render/base-render.js +8 -6
  139. package/es/render/contributions/render/base-render.js.map +1 -1
  140. package/package.json +3 -3
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { EventEmitter, Logger, isBoolean, isObject, isFunction, isString, has, isUndefined, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, pointAt, isNumber as isNumber$1, sqrt, isPointInLine, Color, DEFAULT_COLORS, LRU, isEqual, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, lowerCamelCaseToMiddle, isValid, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, getIntersectPoint, merge, calculateAnchorOfBounds, styleStringToObject } from '@visactor/vutils';
1
+ import { EventEmitter, Logger, isBoolean, isObject, isFunction, isString, has, isUndefined, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, pointAt, isNumber as isNumber$1, sqrt, isPointInLine, Color, DEFAULT_COLORS, LRU, OBBBounds, isEqual, isNil, normalTransform, isValidUrl, isBase64, lowerCamelCaseToMiddle, isValid, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, getIntersectPoint, merge, calculateAnchorOfBounds, styleStringToObject } from '@visactor/vutils';
2
2
 
3
3
  /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -9485,6 +9485,17 @@ function getStageStatePerfMonitor(stage) {
9485
9485
  }
9486
9486
  return stage[STAGE_PERF_MONITOR];
9487
9487
  }
9488
+ function getActiveStageStatePerfMonitor(stage) {
9489
+ var _a;
9490
+ if (!stage) {
9491
+ return undefined;
9492
+ }
9493
+ const current = getStageStatePerfMonitor(stage);
9494
+ if (current) {
9495
+ return current;
9496
+ }
9497
+ return ((_a = stage.statePerfConfig) === null || _a === void 0 ? void 0 : _a.enabled) === true ? ensureStageStatePerfMonitor(stage) : undefined;
9498
+ }
9488
9499
 
9489
9500
  function isPlainObject$1(value) {
9490
9501
  return value != null && typeof value === 'object' && !Array.isArray(value);
@@ -9640,7 +9651,7 @@ class StateEngine {
9640
9651
  this.resolverPatchCache.clear();
9641
9652
  this.resolverCacheKey = '';
9642
9653
  this.resolverCacheValid = false;
9643
- (_b = getStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage)) === null || _b === void 0 ? void 0 : _b.recordResolver('invalidations');
9654
+ (_b = getActiveStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage)) === null || _b === void 0 ? void 0 : _b.recordResolver('invalidations');
9644
9655
  }
9645
9656
  hasState(stateName) {
9646
9657
  if (!this._activeStates.length) {
@@ -9730,7 +9741,7 @@ class StateEngine {
9730
9741
  }
9731
9742
  recomputePatch(effectiveStates) {
9732
9743
  var _a;
9733
- const perfMonitor = getStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage);
9744
+ const perfMonitor = getActiveStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage);
9734
9745
  const patchStart = perfMonitor ? performance.now() : 0;
9735
9746
  let resolverCost = 0;
9736
9747
  const cacheKey = effectiveStates.join(',');
@@ -10133,62 +10144,6 @@ class StateStyleResolver {
10133
10144
  });
10134
10145
  return resolvedAttrs;
10135
10146
  }
10136
- resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
10137
- var _a, _b;
10138
- const mergeMode = (_a = this.options.mergeMode) !== null && _a !== void 0 ? _a : 'shallow';
10139
- const resolvedAttrs = (_b = cloneValue(resolvedPatch)) !== null && _b !== void 0 ? _b : {};
10140
- effectiveStates.forEach(stateName => {
10141
- const proxyPatch = stateProxy === null || stateProxy === void 0 ? void 0 : stateProxy(stateName, effectiveStates);
10142
- if (proxyPatch == null) {
10143
- return;
10144
- }
10145
- Object.keys(proxyPatch).forEach(key => {
10146
- const nextValue = proxyPatch[key];
10147
- const hasCompiledDefinition = compiledDefinitions.has(stateName);
10148
- if (mergeMode === 'deep' &&
10149
- isPlainObject(nextValue) &&
10150
- (isPlainObject(resolvedAttrs[key]) ||
10151
- (!hasCompiledDefinition && isPlainObject(normalAttrs[key])))) {
10152
- const baseValue = isPlainObject(resolvedAttrs[key])
10153
- ? resolvedAttrs[key]
10154
- : isPlainObject(normalAttrs[key])
10155
- ? normalAttrs[key]
10156
- : {};
10157
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
10158
- return;
10159
- }
10160
- resolvedAttrs[key] = cloneValue(nextValue);
10161
- });
10162
- });
10163
- return resolvedAttrs;
10164
- }
10165
- computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
10166
- const nextNormalAttrs = {};
10167
- const nextTargetAttrs = Object.assign({}, targetAttrs);
10168
- for (const key in targetAttrs) {
10169
- if (!Object.prototype.hasOwnProperty.call(targetAttrs, key)) {
10170
- continue;
10171
- }
10172
- if (normalAttrs && key in normalAttrs) {
10173
- nextNormalAttrs[key] = cloneValue(normalAttrs[key]);
10174
- }
10175
- else {
10176
- nextNormalAttrs[key] = cloneValue(finalAttribute[key]);
10177
- }
10178
- }
10179
- if (normalAttrs) {
10180
- for (const key in normalAttrs) {
10181
- if (!Object.prototype.hasOwnProperty.call(normalAttrs, key) || key in targetAttrs) {
10182
- continue;
10183
- }
10184
- nextTargetAttrs[key] = cloneValue(normalAttrs[key]);
10185
- }
10186
- }
10187
- return {
10188
- attrs: nextTargetAttrs,
10189
- normalAttrs: nextNormalAttrs
10190
- };
10191
- }
10192
10147
  }
10193
10148
 
10194
10149
  function hasOwnKeys(value) {
@@ -10227,18 +10182,39 @@ class StateTransitionOrchestrator {
10227
10182
  const noWorkAnimateAttr = Object.assign(Object.assign({}, ((_a = options.noWorkAnimateAttr) !== null && _a !== void 0 ? _a : {})), normalizeNoAnimateAttrConfig((_b = options.animateConfig) === null || _b === void 0 ? void 0 : _b.noAnimateAttrs));
10228
10183
  const isClear = options.isClear === true;
10229
10184
  const getDefaultAttribute = options.getDefaultAttribute;
10185
+ const shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute;
10186
+ const assignTransitionAttr = (key, value) => {
10187
+ if (noWorkAnimateAttr[key]) {
10188
+ plan.jumpAttrs[key] = value;
10189
+ plan.noAnimateAttrs[key] = value;
10190
+ return;
10191
+ }
10192
+ if (isClear && value === undefined) {
10193
+ if (shouldSkipDefaultAttribute === null || shouldSkipDefaultAttribute === void 0 ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) {
10194
+ return;
10195
+ }
10196
+ plan.animateAttrs[key] = getDefaultAttribute ? getDefaultAttribute(key) : value;
10197
+ return;
10198
+ }
10199
+ plan.animateAttrs[key] = value;
10200
+ };
10230
10201
  for (const key in targetAttrs) {
10231
10202
  if (!Object.prototype.hasOwnProperty.call(targetAttrs, key)) {
10232
10203
  continue;
10233
10204
  }
10234
10205
  const value = targetAttrs[key];
10235
- if (noWorkAnimateAttr[key]) {
10236
- plan.jumpAttrs[key] = value;
10237
- plan.noAnimateAttrs[key] = value;
10238
- continue;
10206
+ assignTransitionAttr(key, value);
10207
+ }
10208
+ const extraAnimateAttrs = options.extraAnimateAttrs;
10209
+ if (extraAnimateAttrs) {
10210
+ for (const key in extraAnimateAttrs) {
10211
+ const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetAttrs, key);
10212
+ if (!Object.prototype.hasOwnProperty.call(extraAnimateAttrs, key) ||
10213
+ (hasTargetAttr && targetAttrs[key] !== undefined)) {
10214
+ continue;
10215
+ }
10216
+ assignTransitionAttr(key, extraAnimateAttrs[key]);
10239
10217
  }
10240
- plan.animateAttrs[key] =
10241
- isClear && value === undefined && getDefaultAttribute ? getDefaultAttribute(key) : value;
10242
10218
  }
10243
10219
  return plan;
10244
10220
  }
@@ -10272,12 +10248,14 @@ class StateTransitionOrchestrator {
10272
10248
  return plan;
10273
10249
  }
10274
10250
  applyClearTransition(graphic, targetAttrs, hasAnimation, stateNames, options = {}) {
10275
- var _a, _b;
10251
+ var _a, _b, _c, _d;
10276
10252
  const plan = this.analyzeTransition({}, targetAttrs, stateNames, hasAnimation, {
10277
10253
  noWorkAnimateAttr: (_a = graphic.getNoWorkAnimateAttr) === null || _a === void 0 ? void 0 : _a.call(graphic),
10278
10254
  isClear: true,
10279
10255
  getDefaultAttribute: (_b = graphic.getDefaultAttribute) === null || _b === void 0 ? void 0 : _b.bind(graphic),
10280
- animateConfig: options.animateConfig
10256
+ shouldSkipDefaultAttribute: (_c = options.shouldSkipDefaultAttribute) !== null && _c !== void 0 ? _c : (_d = graphic.shouldSkipStateTransitionDefaultAttribute) === null || _d === void 0 ? void 0 : _d.bind(graphic),
10257
+ animateConfig: options.animateConfig,
10258
+ extraAnimateAttrs: options.extraAnimateAttrs
10281
10259
  });
10282
10260
  return this.applyTransition(graphic, plan, hasAnimation, options);
10283
10261
  }
@@ -10373,7 +10351,7 @@ function ensureSharedStateScopeFresh(scope) {
10373
10351
  if (!scope) {
10374
10352
  return undefined;
10375
10353
  }
10376
- (_a = getStageStatePerfMonitor(scope.ownerStage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('ensureFreshCalls');
10354
+ (_a = getActiveStageStatePerfMonitor(scope.ownerStage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('ensureFreshCalls');
10377
10355
  if (scope.parentScope) {
10378
10356
  ensureSharedStateScopeFresh(scope.parentScope);
10379
10357
  }
@@ -10397,7 +10375,7 @@ function scheduleStageSharedStateRefresh(stage) {
10397
10375
  if (!stage || stage.releaseStatus === 'released') {
10398
10376
  return;
10399
10377
  }
10400
- (_a = getStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('renderScheduled');
10378
+ (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('renderScheduled');
10401
10379
  stage.renderNextFrame();
10402
10380
  }
10403
10381
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
@@ -10408,7 +10386,7 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
10408
10386
  const pending = (_a = stage._pendingSharedStateRefreshGraphics) !== null && _a !== void 0 ? _a : (stage._pendingSharedStateRefreshGraphics = new Set());
10409
10387
  if (!pending.has(graphic)) {
10410
10388
  pending.add(graphic);
10411
- const perfMonitor = getStageStatePerfMonitor(stage);
10389
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
10412
10390
  perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordRefresh('queuedGraphics');
10413
10391
  perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordAllocation('refreshQueuePushes');
10414
10392
  }
@@ -10431,7 +10409,7 @@ function flushStageSharedStateRefresh(stage) {
10431
10409
  if (!pending || !pending.size) {
10432
10410
  return;
10433
10411
  }
10434
- const perfMonitor = getStageStatePerfMonitor(stage);
10412
+ const perfMonitor = getActiveStageStatePerfMonitor(stage);
10435
10413
  const start = perfMonitor ? performance.now() : 0;
10436
10414
  const graphics = Array.from(pending.values());
10437
10415
  pending.clear();
@@ -10443,6 +10421,9 @@ function flushStageSharedStateRefresh(stage) {
10443
10421
  if (graphic.stage !== stage) {
10444
10422
  return;
10445
10423
  }
10424
+ if (!graphic.sharedStateDirty) {
10425
+ return;
10426
+ }
10446
10427
  const refresh = graphic.refreshSharedStateBeforeRender;
10447
10428
  if (typeof refresh === 'function') {
10448
10429
  refresh.call(graphic);
@@ -10495,9 +10476,24 @@ const builtinTextureTypes = new Set([
10495
10476
  'grid',
10496
10477
  'wave'
10497
10478
  ]);
10479
+ const FULL_STATE_DEFINITION_KEYS = new Set([
10480
+ 'name',
10481
+ 'patch',
10482
+ 'priority',
10483
+ 'exclude',
10484
+ 'suppress',
10485
+ 'resolver',
10486
+ 'declaredAffectedKeys'
10487
+ ]);
10498
10488
  const point = new Point();
10489
+ const EMPTY_STATE_NAMES = [];
10490
+ const BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT |
10491
+ UpdateCategory.SHAPE |
10492
+ UpdateCategory.BOUNDS |
10493
+ UpdateCategory.TRANSFORM |
10494
+ UpdateCategory.LAYOUT;
10499
10495
  function isPlainObjectValue(value) {
10500
- return typeof value === 'object' && value != null && !isArray(value);
10496
+ return typeof value === 'object' && value != null && !Array.isArray(value);
10501
10497
  }
10502
10498
  function cloneAttributeValue(value) {
10503
10499
  if (!isPlainObjectValue(value)) {
@@ -10511,18 +10507,6 @@ function cloneAttributeValue(value) {
10511
10507
  });
10512
10508
  return clone;
10513
10509
  }
10514
- function cloneSimpleAttributeRecord(value) {
10515
- if (!isPlainObjectValue(value)) {
10516
- return value;
10517
- }
10518
- return Object.assign({}, value);
10519
- }
10520
- function shouldUseSimpleAttributeFastPath(value) {
10521
- if (!isPlainObjectValue(value)) {
10522
- return false;
10523
- }
10524
- return !Object.keys(value).some(key => isPlainObjectValue(value[key]));
10525
- }
10526
10510
  function cloneAttributeSurface(value) {
10527
10511
  if (!isPlainObjectValue(value)) {
10528
10512
  return value;
@@ -10535,6 +10519,15 @@ function cloneAttributeSurface(value) {
10535
10519
  });
10536
10520
  return clone;
10537
10521
  }
10522
+ function areAttributeValuesEqual(left, right) {
10523
+ if (left === right) {
10524
+ return true;
10525
+ }
10526
+ if (!isPlainObjectValue(left) && !isPlainObjectValue(right) && !Array.isArray(left) && !Array.isArray(right)) {
10527
+ return false;
10528
+ }
10529
+ return isEqual(left, right);
10530
+ }
10538
10531
  function deepMergeAttributeValue(base, value) {
10539
10532
  var _a;
10540
10533
  const result = (_a = cloneAttributeValue(base)) !== null && _a !== void 0 ? _a : {};
@@ -10602,24 +10595,29 @@ class Graphic extends Node {
10602
10595
  get globalTransMatrix() {
10603
10596
  return this.tryUpdateGlobalTransMatrix(true);
10604
10597
  }
10598
+ get baseAttributes() {
10599
+ var _a;
10600
+ return (_a = this._baseAttributes) !== null && _a !== void 0 ? _a : this.attribute;
10601
+ }
10602
+ set baseAttributes(value) {
10603
+ if (value === this.attribute) {
10604
+ this._baseAttributes = undefined;
10605
+ return;
10606
+ }
10607
+ this._baseAttributes = value;
10608
+ }
10605
10609
  constructor(params = {}) {
10606
10610
  var _a;
10607
10611
  super();
10608
- this.resolverEpoch = 0;
10609
10612
  this._AABBBounds = new AABBBounds();
10610
10613
  this._updateTag = UpdateTag.INIT;
10611
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params);
10612
- const initialBaseAttributes = (useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params));
10613
- this.baseAttributes = initialBaseAttributes;
10614
- this.attribute = (useSimpleAttributeFastPath
10615
- ? cloneSimpleAttributeRecord(initialBaseAttributes)
10616
- : cloneAttributeSurface(initialBaseAttributes));
10614
+ this.attribute = params;
10617
10615
  this.valid = this.isValid();
10618
10616
  this.updateAABBBoundsStamp = 0;
10619
10617
  if (params.background) {
10620
10618
  this.loadImage((_a = params.background.background) !== null && _a !== void 0 ? _a : params.background, true);
10621
10619
  }
10622
- if (isExternalTexture(params.texture)) {
10620
+ if (params.texture && isExternalTexture(params.texture)) {
10623
10621
  this.loadImage(params.texture, false);
10624
10622
  }
10625
10623
  if (params.shadowGraphic) {
@@ -10629,8 +10627,11 @@ class Graphic extends Node {
10629
10627
  get normalAttrs() {
10630
10628
  return this.baseAttributes;
10631
10629
  }
10632
- set normalAttrs(value) {
10633
- this._deprecatedNormalAttrsView = value !== null && value !== void 0 ? value : undefined;
10630
+ set normalAttrs(_value) {
10631
+ }
10632
+ getBaseAttributesStorage() {
10633
+ var _a;
10634
+ return (_a = this._baseAttributes) !== null && _a !== void 0 ? _a : this.attribute;
10634
10635
  }
10635
10636
  getGraphicService() {
10636
10637
  var _a, _b;
@@ -10689,13 +10690,31 @@ class Graphic extends Node {
10689
10690
  }
10690
10691
  return true;
10691
10692
  }
10692
- syncSharedStateActiveRegistrations() {
10693
+ syncSharedStateScopeBindingOnTreeChange(markDirty = true) {
10693
10694
  var _a, _b;
10694
- const nextScopes = ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) && this.boundSharedStateScope
10695
- ? new Set(collectSharedStateScopeChain(this.boundSharedStateScope))
10696
- : new Set();
10697
- const previousScopes = (_b = this.registeredActiveScopes) !== null && _b !== void 0 ? _b : new Set();
10698
- previousScopes.forEach(scope => {
10695
+ if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) &&
10696
+ !this.boundSharedStateScope &&
10697
+ !((_b = this.registeredActiveScopes) === null || _b === void 0 ? void 0 : _b.size) &&
10698
+ !this.sharedStateDirty) {
10699
+ return false;
10700
+ }
10701
+ return this.syncSharedStateScopeBindingFromTree(markDirty);
10702
+ }
10703
+ syncSharedStateActiveRegistrations() {
10704
+ var _a;
10705
+ const previousScopes = this.registeredActiveScopes;
10706
+ if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.boundSharedStateScope) {
10707
+ if (previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.size) {
10708
+ previousScopes.forEach(scope => {
10709
+ scope.subtreeActiveDescendants.delete(this);
10710
+ });
10711
+ previousScopes.clear();
10712
+ }
10713
+ this.registeredActiveScopes = undefined;
10714
+ return;
10715
+ }
10716
+ const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
10717
+ previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.forEach(scope => {
10699
10718
  if (!nextScopes.has(scope)) {
10700
10719
  scope.subtreeActiveDescendants.delete(this);
10701
10720
  }
@@ -10725,7 +10744,7 @@ class Graphic extends Node {
10725
10744
  this.setStage(stage, layer);
10726
10745
  return;
10727
10746
  }
10728
- this.syncSharedStateScopeBindingFromTree();
10747
+ this.syncSharedStateScopeBindingOnTreeChange();
10729
10748
  }
10730
10749
  refreshSharedStateBeforeRender() {
10731
10750
  var _a;
@@ -10740,7 +10759,7 @@ class Graphic extends Node {
10740
10759
  this.recomputeCurrentStatePatch();
10741
10760
  this.stopStateAnimates();
10742
10761
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
10743
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
10762
+ this.emitStateUpdateEvent();
10744
10763
  this.sharedStateDirty = false;
10745
10764
  }
10746
10765
  getLocalStatesVersion() {
@@ -10822,23 +10841,22 @@ class Graphic extends Node {
10822
10841
  };
10823
10842
  }
10824
10843
  recomputeCurrentStatePatch() {
10825
- var _a, _b, _c, _d;
10844
+ var _a, _b;
10826
10845
  if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length)) {
10827
10846
  this.effectiveStates = [];
10828
10847
  this.resolvedStatePatch = undefined;
10829
10848
  this.syncSharedStateActiveRegistrations();
10830
10849
  return;
10831
10850
  }
10832
- const stateResolveBaseAttrs = ((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : this.attribute);
10833
- const stateModel = this.createStateModel();
10834
- (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.setResolveContext(this, stateResolveBaseAttrs);
10851
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
10852
+ const stateModel = this.createStateModel(stateResolveBaseAttrs);
10835
10853
  const transition = stateModel.useStates(this.currentStates);
10836
- const effectiveStates = (_d = transition.effectiveStates) !== null && _d !== void 0 ? _d : transition.states;
10854
+ const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
10837
10855
  const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
10838
10856
  ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
10839
10857
  this.currentStates = transition.states;
10840
10858
  this.effectiveStates = [...effectiveStates];
10841
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
10859
+ this.resolvedStatePatch = resolvedStateAttrs;
10842
10860
  this.syncSharedStateActiveRegistrations();
10843
10861
  }
10844
10862
  buildStaticAttributeSnapshot() {
@@ -10859,6 +10877,37 @@ class Graphic extends Node {
10859
10877
  });
10860
10878
  return snapshot;
10861
10879
  }
10880
+ buildRemovedStateAnimationAttrs(targetStateAttrs, previousResolvedStatePatch) {
10881
+ const extraAttrs = {};
10882
+ if (!previousResolvedStatePatch) {
10883
+ return extraAttrs;
10884
+ }
10885
+ const snapshot = this.buildStaticAttributeSnapshot();
10886
+ const staticTargetAttrs = snapshot;
10887
+ Object.keys(previousResolvedStatePatch).forEach(key => {
10888
+ const hasTargetAttr = Object.prototype.hasOwnProperty.call(targetStateAttrs, key);
10889
+ if (hasTargetAttr && targetStateAttrs[key] !== undefined) {
10890
+ return;
10891
+ }
10892
+ const assignFallbackAttr = (value) => {
10893
+ if (value === undefined && this.shouldSkipStateTransitionDefaultAttribute(key, staticTargetAttrs)) {
10894
+ return;
10895
+ }
10896
+ extraAttrs[key] = value === undefined ? value : cloneAttributeValue(value);
10897
+ };
10898
+ if (hasTargetAttr) {
10899
+ assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
10900
+ return;
10901
+ }
10902
+ if (Object.prototype.hasOwnProperty.call(snapshot, key)) {
10903
+ const snapshotValue = snapshot[key];
10904
+ assignFallbackAttr(snapshotValue === undefined ? this.getStateTransitionDefaultAttribute(key, staticTargetAttrs) : snapshotValue);
10905
+ return;
10906
+ }
10907
+ assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
10908
+ });
10909
+ return extraAttrs;
10910
+ }
10862
10911
  syncObjectToSnapshot(target, snapshot) {
10863
10912
  const delta = new Map();
10864
10913
  const keySet = new Set([...Object.keys(target), ...Object.keys(snapshot)]);
@@ -10873,7 +10922,7 @@ class Graphic extends Node {
10873
10922
  return;
10874
10923
  }
10875
10924
  const nextValue = snapshot[key];
10876
- if (isEqual(previousValue, nextValue)) {
10925
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
10877
10926
  return;
10878
10927
  }
10879
10928
  delta.set(key, { prev: previousValue, next: nextValue });
@@ -10882,9 +10931,13 @@ class Graphic extends Node {
10882
10931
  return delta;
10883
10932
  }
10884
10933
  _syncAttribute() {
10934
+ if (this.attribute === this.baseAttributes && this.resolvedStatePatch) {
10935
+ this.detachAttributeFromBaseAttributes();
10936
+ }
10885
10937
  const snapshot = this.buildStaticAttributeSnapshot();
10886
10938
  const delta = this.syncObjectToSnapshot(this.attribute, snapshot);
10887
10939
  this.valid = this.isValid();
10940
+ this.attributeMayContainTransientAttrs = false;
10888
10941
  return delta;
10889
10942
  }
10890
10943
  _syncFinalAttributeFromStaticTruth() {
@@ -10895,7 +10948,20 @@ class Graphic extends Node {
10895
10948
  const snapshot = this.buildStaticAttributeSnapshot();
10896
10949
  this.syncObjectToSnapshot(target, snapshot);
10897
10950
  }
10898
- submitUpdateByDelta(delta, forceUpdateTag = false) {
10951
+ mergeAttributeDeltaCategory(category, key, prev, next) {
10952
+ var _a;
10953
+ let nextCategory = key === 'stroke' || key === 'shadowBlur'
10954
+ ? classifyAttributeDelta(key, prev, next)
10955
+ : (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
10956
+ if (nextCategory & UpdateCategory.PICK) {
10957
+ nextCategory |= UpdateCategory.BOUNDS;
10958
+ }
10959
+ if (nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key)) {
10960
+ nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS;
10961
+ }
10962
+ return category | nextCategory;
10963
+ }
10964
+ submitUpdateByCategory(category, forceUpdateTag = false) {
10899
10965
  var _a;
10900
10966
  if (forceUpdateTag) {
10901
10967
  this.addUpdateShapeAndBoundsTag();
@@ -10903,19 +10969,15 @@ class Graphic extends Node {
10903
10969
  this.addUpdateLayoutTag();
10904
10970
  return;
10905
10971
  }
10906
- let category = UpdateCategory.NONE;
10907
- delta.forEach((entry, key) => {
10908
- let nextCategory = classifyAttributeDelta(key, entry.prev, entry.next);
10909
- if (nextCategory & UpdateCategory.PICK) {
10910
- nextCategory |= UpdateCategory.BOUNDS;
10911
- }
10912
- if (nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key)) {
10913
- nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS;
10914
- }
10915
- category |= nextCategory;
10916
- });
10917
10972
  if (category !== UpdateCategory.NONE) {
10918
- (_a = getStageStatePerfMonitor(this.stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10973
+ const stage = this.stage;
10974
+ if (stage) {
10975
+ (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10976
+ }
10977
+ }
10978
+ if ((category & BROAD_UPDATE_CATEGORY) === BROAD_UPDATE_CATEGORY) {
10979
+ this.addBroadUpdateTag();
10980
+ return;
10919
10981
  }
10920
10982
  if (category & UpdateCategory.SHAPE) {
10921
10983
  this.addUpdateShapeAndBoundsTag();
@@ -10933,36 +10995,147 @@ class Graphic extends Node {
10933
10995
  this.addUpdateLayoutTag();
10934
10996
  }
10935
10997
  }
10998
+ submitUpdateByDelta(delta, forceUpdateTag = false) {
10999
+ let category = UpdateCategory.NONE;
11000
+ delta.forEach((entry, key) => {
11001
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
11002
+ });
11003
+ this.submitUpdateByCategory(category, forceUpdateTag);
11004
+ }
11005
+ submitTouchedKeyUpdate(keys, forceUpdateTag = false) {
11006
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
11007
+ }
11008
+ submitTouchedUpdate(needsShapeAndBounds) {
11009
+ if (!this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds) {
11010
+ this.addUpdateShapeAndBoundsTag();
11011
+ }
11012
+ else {
11013
+ this.addUpdateBoundTag();
11014
+ }
11015
+ this.addUpdatePositionTag();
11016
+ this.addUpdateLayoutTag();
11017
+ }
10936
11018
  commitBaseAttributeMutation(forceUpdateTag = false, context) {
10937
- var _a, _b;
11019
+ var _a, _b, _c;
10938
11020
  if ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) {
10939
- this.resolverEpoch += 1;
10940
- (_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.invalidateResolverCache();
11021
+ this.resolverEpoch = ((_b = this.resolverEpoch) !== null && _b !== void 0 ? _b : 0) + 1;
11022
+ (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.invalidateResolverCache();
10941
11023
  this.recomputeCurrentStatePatch();
10942
11024
  }
10943
11025
  const delta = this._syncAttribute();
10944
11026
  this.submitUpdateByDelta(delta, forceUpdateTag);
10945
11027
  this.onAttributeUpdate(context);
10946
11028
  }
11029
+ canCommitBaseAttributesByTouchedKeys() {
11030
+ var _a, _b;
11031
+ if (((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || this.resolvedStatePatch || this.attributeMayContainTransientAttrs) {
11032
+ return false;
11033
+ }
11034
+ if (!((_b = this.animates) === null || _b === void 0 ? void 0 : _b.size) && !this._animationStateManager) {
11035
+ return true;
11036
+ }
11037
+ return !this.hasAnyTrackedAnimate();
11038
+ }
11039
+ detachAttributeFromBaseAttributes() {
11040
+ if (this.attribute === this.baseAttributes) {
11041
+ this._baseAttributes = this.attribute;
11042
+ this.attribute = cloneAttributeSurface(this.attribute);
11043
+ }
11044
+ }
11045
+ commitInternalBaseAttributes(params, context) {
11046
+ if (!params || !Object.keys(params).length) {
11047
+ return;
11048
+ }
11049
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11050
+ this.commitBaseAttributesByTouchedKeys(params, false, context);
11051
+ return;
11052
+ }
11053
+ this.detachAttributeFromBaseAttributes();
11054
+ this.applyBaseAttributes(params);
11055
+ this.commitBaseAttributeMutation(false, context);
11056
+ }
11057
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = false, context) {
11058
+ const source = params;
11059
+ const baseAttributes = this.getBaseAttributesStorage();
11060
+ let hasKeys = false;
11061
+ let needsShapeAndBounds = forceUpdateTag;
11062
+ for (const key in source) {
11063
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
11064
+ continue;
11065
+ }
11066
+ hasKeys = true;
11067
+ baseAttributes[key] = source[key];
11068
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
11069
+ needsShapeAndBounds = true;
11070
+ }
11071
+ }
11072
+ if (!hasKeys) {
11073
+ return;
11074
+ }
11075
+ this.attribute = baseAttributes;
11076
+ this._baseAttributes = undefined;
11077
+ this.valid = this.isValid();
11078
+ this.attributeMayContainTransientAttrs = false;
11079
+ this.submitTouchedUpdate(needsShapeAndBounds);
11080
+ this.onAttributeUpdate(context);
11081
+ }
11082
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = false, context) {
11083
+ this.getBaseAttributesStorage()[key] = value;
11084
+ this.attribute = this.getBaseAttributesStorage();
11085
+ this._baseAttributes = undefined;
11086
+ this.valid = this.isValid();
11087
+ this.attributeMayContainTransientAttrs = false;
11088
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTag(key));
11089
+ this.onAttributeUpdate(context);
11090
+ }
10947
11091
  applyBaseAttributes(params) {
10948
11092
  const keys = Object.keys(params);
10949
11093
  for (let i = 0; i < keys.length; i++) {
10950
11094
  const key = keys[i];
10951
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
11095
+ this.getBaseAttributesStorage()[key] = params[key];
10952
11096
  }
10953
11097
  }
11098
+ applyAnimationTransientAttributes(params, forceUpdateTag = false, context) {
11099
+ const source = params;
11100
+ let target;
11101
+ let needsShapeAndBounds = forceUpdateTag;
11102
+ for (const key in source) {
11103
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
11104
+ continue;
11105
+ }
11106
+ if (!target) {
11107
+ this.detachAttributeFromBaseAttributes();
11108
+ target = this.attribute;
11109
+ }
11110
+ target[key] = source[key];
11111
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
11112
+ needsShapeAndBounds = true;
11113
+ }
11114
+ }
11115
+ if (!target) {
11116
+ return;
11117
+ }
11118
+ this.attributeMayContainTransientAttrs = true;
11119
+ this.valid = this.isValid();
11120
+ this.submitTouchedUpdate(needsShapeAndBounds);
11121
+ this.onAttributeUpdate(context);
11122
+ }
10954
11123
  applyTransientAttributes(params, forceUpdateTag = false, context) {
11124
+ this.detachAttributeFromBaseAttributes();
10955
11125
  const delta = new Map();
10956
11126
  const keys = Object.keys(params);
10957
11127
  for (let i = 0; i < keys.length; i++) {
10958
11128
  const key = keys[i];
10959
11129
  const previousValue = this.attribute[key];
10960
11130
  const nextValue = params[key];
10961
- if (isEqual(previousValue, nextValue)) {
11131
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
10962
11132
  continue;
10963
11133
  }
10964
11134
  delta.set(key, { prev: previousValue, next: nextValue });
10965
- this.attribute[key] = cloneAttributeValue(nextValue);
11135
+ this.attribute[key] = nextValue;
11136
+ }
11137
+ if (delta.size) {
11138
+ this.attributeMayContainTransientAttrs = true;
10966
11139
  }
10967
11140
  this.valid = this.isValid();
10968
11141
  this.submitUpdateByDelta(delta, forceUpdateTag);
@@ -10974,6 +11147,87 @@ class Graphic extends Node {
10974
11147
  this.submitUpdateByDelta(delta);
10975
11148
  this.onAttributeUpdate(context);
10976
11149
  }
11150
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
11151
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
11152
+ if (!nextPatch) {
11153
+ return keys;
11154
+ }
11155
+ for (const key in nextPatch) {
11156
+ if (Object.prototype.hasOwnProperty.call(nextPatch, key) &&
11157
+ !Object.prototype.hasOwnProperty.call(previousPatch !== null && previousPatch !== void 0 ? previousPatch : {}, key)) {
11158
+ keys.push(key);
11159
+ }
11160
+ }
11161
+ return keys;
11162
+ }
11163
+ getStaticTruthValueForStateKey(key, nextPatch) {
11164
+ var _a;
11165
+ const baseAttributes = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {});
11166
+ const patch = nextPatch;
11167
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
11168
+ const patchValue = patch[key];
11169
+ const baseValue = baseAttributes[key];
11170
+ if (this.stateMergeMode === 'deep' && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue)) {
11171
+ return {
11172
+ hasValue: true,
11173
+ value: deepMergeAttributeValue(baseValue, patchValue)
11174
+ };
11175
+ }
11176
+ return {
11177
+ hasValue: true,
11178
+ value: patchValue
11179
+ };
11180
+ }
11181
+ if (Object.prototype.hasOwnProperty.call(baseAttributes, key)) {
11182
+ return {
11183
+ hasValue: true,
11184
+ value: baseAttributes[key]
11185
+ };
11186
+ }
11187
+ return {
11188
+ hasValue: false,
11189
+ value: undefined
11190
+ };
11191
+ }
11192
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = false) {
11193
+ let category = UpdateCategory.NONE;
11194
+ for (let i = 0; i < keys.length; i++) {
11195
+ const key = keys[i];
11196
+ const previousValue = target[key];
11197
+ const next = this.getStaticTruthValueForStateKey(key, nextPatch);
11198
+ if (!next.hasValue) {
11199
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
11200
+ delete target[key];
11201
+ if (collectCategory) {
11202
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, undefined);
11203
+ }
11204
+ }
11205
+ continue;
11206
+ }
11207
+ if (areAttributeValuesEqual(previousValue, next.value)) {
11208
+ continue;
11209
+ }
11210
+ const nextValue = cloneAttributeValue(next.value);
11211
+ target[key] = nextValue;
11212
+ if (collectCategory) {
11213
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue);
11214
+ }
11215
+ }
11216
+ return category;
11217
+ }
11218
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
11219
+ this.detachAttributeFromBaseAttributes();
11220
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch);
11221
+ const finalAttribute = this.finalAttribute;
11222
+ if (finalAttribute) {
11223
+ this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, false);
11224
+ }
11225
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, true);
11226
+ this.valid = this.isValid();
11227
+ this.attributeMayContainTransientAttrs = false;
11228
+ this.submitUpdateByCategory(category);
11229
+ this.onAttributeUpdate(context);
11230
+ }
10977
11231
  setMode(mode) {
10978
11232
  mode === '3d' ? this.set3dMode() : this.set2dMode();
10979
11233
  }
@@ -10998,6 +11252,7 @@ class Graphic extends Node {
10998
11252
  return point;
10999
11253
  }
11000
11254
  onAnimateBind(animate) {
11255
+ this.detachAttributeFromBaseAttributes();
11001
11256
  this._emitCustomEvent('animate-bind', animate);
11002
11257
  }
11003
11258
  visitTrackedAnimates(cb) {
@@ -11020,8 +11275,33 @@ class Graphic extends Node {
11020
11275
  }
11021
11276
  return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size);
11022
11277
  }
11278
+ mayHaveTrackedAnimates() {
11279
+ var _a;
11280
+ return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size) || !!this._animationStateManager;
11281
+ }
11023
11282
  tryUpdateAABBBounds() {
11283
+ if (!this.shadowRoot && !(this._updateTag & UpdateTag.UPDATE_BOUNDS)) {
11284
+ return this._AABBBounds;
11285
+ }
11024
11286
  const full = this.attribute.boundsMode === 'imprecise';
11287
+ if (!this.shadowRoot) {
11288
+ const graphicService = this.getGraphicService();
11289
+ const graphicTheme = this.getGraphicTheme();
11290
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) {
11291
+ return this._AABBBounds;
11292
+ }
11293
+ if (!this.valid) {
11294
+ this._AABBBounds.clear();
11295
+ return this._AABBBounds;
11296
+ }
11297
+ graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);
11298
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
11299
+ graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, true);
11300
+ if (this.attribute.boundsMode === 'empty') {
11301
+ bounds.clear();
11302
+ }
11303
+ return bounds;
11304
+ }
11025
11305
  if (!this.shouldUpdateAABBBounds()) {
11026
11306
  return this._AABBBounds;
11027
11307
  }
@@ -11138,13 +11418,13 @@ class Graphic extends Node {
11138
11418
  Graphic.userSymbolMap[symbolType] = _parsedPath;
11139
11419
  return _parsedPath;
11140
11420
  }
11141
- doUpdateAABBBounds(full) {
11421
+ doUpdateAABBBounds(full, graphicTheme) {
11142
11422
  this.updateAABBBoundsStamp++;
11143
- const graphicTheme = this.getGraphicTheme();
11423
+ const resolvedGraphicTheme = graphicTheme !== null && graphicTheme !== void 0 ? graphicTheme : this.getGraphicTheme();
11144
11424
  this._AABBBounds.clear();
11145
11425
  const attribute = this.attribute;
11146
- const bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full);
11147
- const { boundsPadding = graphicTheme.boundsPadding } = attribute;
11426
+ const bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full);
11427
+ const { boundsPadding = resolvedGraphicTheme.boundsPadding } = attribute;
11148
11428
  const paddingArray = parsePadding(boundsPadding);
11149
11429
  if (paddingArray) {
11150
11430
  bounds.expand(paddingArray);
@@ -11255,16 +11535,101 @@ class Graphic extends Node {
11255
11535
  this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
11256
11536
  }
11257
11537
  setAttributesAndPreventAnimate(params, forceUpdateTag = false, context, ignorePriority) {
11538
+ if (!params) {
11539
+ return;
11540
+ }
11541
+ const keys = Object.keys(params);
11542
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context);
11258
11543
  this.visitTrackedAnimates(animate => {
11259
11544
  if (animate.priority === Infinity && !ignorePriority) {
11260
11545
  return;
11261
11546
  }
11262
- Object.keys(params).forEach(key => {
11263
- animate.preventAttr(key);
11264
- });
11547
+ animate.preventAttrs(keys);
11265
11548
  });
11266
11549
  this.applyTransientAttributes(params, forceUpdateTag, context);
11267
11550
  }
11551
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
11552
+ var _a, _b;
11553
+ const graphicContext = this.context;
11554
+ const diffAttrs = (_a = graphicContext === null || graphicContext === void 0 ? void 0 : graphicContext.diffAttrs) !== null && _a !== void 0 ? _a : params;
11555
+ const updateType = context === null || context === void 0 ? void 0 : context.type;
11556
+ if (!keys.length ||
11557
+ !diffAttrs ||
11558
+ updateType === AttributeUpdateType.STATE ||
11559
+ (updateType != null &&
11560
+ updateType >= AttributeUpdateType.ANIMATE_BIND &&
11561
+ updateType <= AttributeUpdateType.ANIMATE_END)) {
11562
+ return;
11563
+ }
11564
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
11565
+ let fromAttrs = sameDiffAttrs
11566
+ ? (_b = this.transientFromAttrsBeforePreventAnimate) !== null && _b !== void 0 ? _b : null
11567
+ : null;
11568
+ if (!sameDiffAttrs) {
11569
+ this.transientFromAttrsBeforePreventAnimate = null;
11570
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
11571
+ }
11572
+ let captured = false;
11573
+ for (let i = 0; i < keys.length; i++) {
11574
+ const key = keys[i];
11575
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
11576
+ continue;
11577
+ }
11578
+ const previousValue = this.attribute[key];
11579
+ const nextValue = params[key];
11580
+ if (isEqual(previousValue, nextValue)) {
11581
+ continue;
11582
+ }
11583
+ fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : (fromAttrs = {});
11584
+ fromAttrs[key] = cloneAttributeValue(previousValue);
11585
+ captured = true;
11586
+ }
11587
+ if (captured) {
11588
+ this.transientFromAttrsBeforePreventAnimate = fromAttrs;
11589
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs;
11590
+ }
11591
+ }
11592
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
11593
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate;
11594
+ const sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
11595
+ if (!transientFromAttrs || !sourceDiffAttrs) {
11596
+ return null;
11597
+ }
11598
+ for (const key in diffAttrs) {
11599
+ if (Object.prototype.hasOwnProperty.call(diffAttrs, key) &&
11600
+ (!Object.prototype.hasOwnProperty.call(sourceDiffAttrs, key) || !isEqual(sourceDiffAttrs[key], diffAttrs[key]))) {
11601
+ return null;
11602
+ }
11603
+ }
11604
+ let fromAttrs = null;
11605
+ let remaining = false;
11606
+ for (const key in transientFromAttrs) {
11607
+ if (!Object.prototype.hasOwnProperty.call(transientFromAttrs, key)) {
11608
+ continue;
11609
+ }
11610
+ if (Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
11611
+ fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : (fromAttrs = {});
11612
+ fromAttrs[key] = transientFromAttrs[key];
11613
+ continue;
11614
+ }
11615
+ remaining = true;
11616
+ }
11617
+ if (remaining) {
11618
+ const nextTransientFromAttrs = {};
11619
+ for (const key in transientFromAttrs) {
11620
+ if (Object.prototype.hasOwnProperty.call(transientFromAttrs, key) &&
11621
+ !Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
11622
+ nextTransientFromAttrs[key] = transientFromAttrs[key];
11623
+ }
11624
+ }
11625
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
11626
+ }
11627
+ else {
11628
+ this.transientFromAttrsBeforePreventAnimate = null;
11629
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
11630
+ }
11631
+ return fromAttrs;
11632
+ }
11268
11633
  setAttributes(params, forceUpdateTag = false, context) {
11269
11634
  if (!params) {
11270
11635
  return;
@@ -11274,7 +11639,7 @@ class Graphic extends Node {
11274
11639
  if (params.background) {
11275
11640
  this.loadImage(params.background, true);
11276
11641
  }
11277
- if (isExternalTexture(params.texture)) {
11642
+ if (params.texture && isExternalTexture(params.texture)) {
11278
11643
  this.loadImage(params.texture, false);
11279
11644
  }
11280
11645
  if (params.shadowGraphic) {
@@ -11283,14 +11648,25 @@ class Graphic extends Node {
11283
11648
  this._setAttributes(params, forceUpdateTag, context);
11284
11649
  }
11285
11650
  _setAttributes(params, forceUpdateTag = false, context) {
11651
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11652
+ this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context);
11653
+ return;
11654
+ }
11655
+ this.detachAttributeFromBaseAttributes();
11286
11656
  this.applyBaseAttributes(params);
11287
11657
  this.commitBaseAttributeMutation(forceUpdateTag, context);
11288
11658
  }
11289
11659
  setAttribute(key, value, forceUpdateTag, context) {
11290
11660
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);
11291
11661
  if (!params) {
11292
- this.applyBaseAttributes({ [key]: value });
11293
- this.commitBaseAttributeMutation(!!forceUpdateTag, context);
11662
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
11663
+ this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);
11664
+ }
11665
+ else {
11666
+ const nextAttrs = { [key]: value };
11667
+ this.applyBaseAttributes(nextAttrs);
11668
+ this.commitBaseAttributeMutation(!!forceUpdateTag, context);
11669
+ }
11294
11670
  }
11295
11671
  else {
11296
11672
  this._setAttributes(params, forceUpdateTag, context);
@@ -11327,16 +11703,15 @@ class Graphic extends Node {
11327
11703
  const context = { type: AttributeUpdateType.INIT };
11328
11704
  params =
11329
11705
  (this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context)) || params;
11330
- this.baseAttributes = cloneAttributeValue(params);
11331
- if (!this.attribute) {
11332
- this.attribute = {};
11333
- }
11706
+ this.attribute = params;
11707
+ this._baseAttributes = undefined;
11334
11708
  this.resolvedStatePatch = undefined;
11335
- this._syncAttribute();
11709
+ this.attributeMayContainTransientAttrs = false;
11710
+ this.valid = this.isValid();
11336
11711
  if (params.background) {
11337
11712
  this.loadImage(params.background, true);
11338
11713
  }
11339
- if (isExternalTexture(params.texture)) {
11714
+ if (params.texture && isExternalTexture(params.texture)) {
11340
11715
  this.loadImage(params.texture, false);
11341
11716
  }
11342
11717
  if (params.shadowGraphic) {
@@ -11361,18 +11736,20 @@ class Graphic extends Node {
11361
11736
  y = params.y;
11362
11737
  delete params.x;
11363
11738
  delete params.y;
11364
- this.applyBaseAttributes(params);
11365
11739
  }
11366
11740
  const attribute = this.baseAttributes;
11367
11741
  const postMatrix = attribute.postMatrix;
11742
+ const nextAttrs = (params || {});
11368
11743
  if (!postMatrix) {
11369
- attribute.x = ((_a = attribute.x) !== null && _a !== void 0 ? _a : DefaultTransform.x) + x;
11370
- attribute.y = ((_b = attribute.y) !== null && _b !== void 0 ? _b : DefaultTransform.y) + y;
11744
+ nextAttrs.x = ((_a = attribute.x) !== null && _a !== void 0 ? _a : DefaultTransform.x) + x;
11745
+ nextAttrs.y = ((_b = attribute.y) !== null && _b !== void 0 ? _b : DefaultTransform.y) + y;
11371
11746
  }
11372
11747
  else {
11373
- application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y);
11748
+ const nextPostMatrix = postMatrix.clone();
11749
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y);
11750
+ nextAttrs.postMatrix = nextPostMatrix;
11374
11751
  }
11375
- this.commitBaseAttributeMutation(false, context);
11752
+ this.commitInternalBaseAttributes(nextAttrs, context);
11376
11753
  return this;
11377
11754
  }
11378
11755
  translateTo(x, y) {
@@ -11386,13 +11763,10 @@ class Graphic extends Node {
11386
11763
  const params = this.onBeforeAttributeUpdate &&
11387
11764
  this.onBeforeAttributeUpdate({ x, y }, this.attribute, tempConstantXYKey, context);
11388
11765
  if (params) {
11389
- this.applyBaseAttributes(params);
11390
- this.commitBaseAttributeMutation(false, context);
11766
+ this.commitInternalBaseAttributes(params, context);
11391
11767
  return this;
11392
11768
  }
11393
- attribute.x = x;
11394
- attribute.y = y;
11395
- this.commitBaseAttributeMutation(false, context);
11769
+ this.commitInternalBaseAttributes({ x, y }, context);
11396
11770
  return this;
11397
11771
  }
11398
11772
  scale(scaleX, scaleY, scaleCenter) {
@@ -11410,22 +11784,25 @@ class Graphic extends Node {
11410
11784
  scaleY = params.scaleY;
11411
11785
  delete params.scaleX;
11412
11786
  delete params.scaleY;
11413
- this.applyBaseAttributes(params);
11414
11787
  }
11415
11788
  const attribute = this.baseAttributes;
11789
+ const nextAttrs = (params || {});
11416
11790
  if (!scaleCenter) {
11417
- attribute.scaleX = ((_a = attribute.scaleX) !== null && _a !== void 0 ? _a : DefaultTransform.scaleX) * scaleX;
11418
- attribute.scaleY = ((_b = attribute.scaleY) !== null && _b !== void 0 ? _b : DefaultTransform.scaleY) * scaleY;
11791
+ nextAttrs.scaleX = ((_a = attribute.scaleX) !== null && _a !== void 0 ? _a : DefaultTransform.scaleX) * scaleX;
11792
+ nextAttrs.scaleY = ((_b = attribute.scaleY) !== null && _b !== void 0 ? _b : DefaultTransform.scaleY) * scaleY;
11419
11793
  }
11420
11794
  else {
11421
- let { postMatrix } = this.attribute;
11795
+ let { postMatrix } = this.baseAttributes;
11422
11796
  if (!postMatrix) {
11423
11797
  postMatrix = new Matrix();
11424
- attribute.postMatrix = postMatrix;
11798
+ }
11799
+ else {
11800
+ postMatrix = postMatrix.clone();
11425
11801
  }
11426
11802
  application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
11803
+ nextAttrs.postMatrix = postMatrix;
11427
11804
  }
11428
- this.commitBaseAttributeMutation(false, context);
11805
+ this.commitInternalBaseAttributes(nextAttrs, context);
11429
11806
  return this;
11430
11807
  }
11431
11808
  scaleTo(scaleX, scaleY) {
@@ -11439,13 +11816,10 @@ class Graphic extends Node {
11439
11816
  const params = this.onBeforeAttributeUpdate &&
11440
11817
  this.onBeforeAttributeUpdate({ scaleX, scaleY }, this.attribute, tempConstantScaleXYKey, context);
11441
11818
  if (params) {
11442
- this.applyBaseAttributes(params);
11443
- this.commitBaseAttributeMutation(false, context);
11819
+ this.commitInternalBaseAttributes(params, context);
11444
11820
  return this;
11445
11821
  }
11446
- attribute.scaleX = scaleX;
11447
- attribute.scaleY = scaleY;
11448
- this.commitBaseAttributeMutation(false, context);
11822
+ this.commitInternalBaseAttributes({ scaleX, scaleY }, context);
11449
11823
  return this;
11450
11824
  }
11451
11825
  rotate(angle, rotateCenter) {
@@ -11458,21 +11832,24 @@ class Graphic extends Node {
11458
11832
  this.onBeforeAttributeUpdate({ angle, rotateCenter }, this.attribute, tempConstantAngleKey, context);
11459
11833
  if (params) {
11460
11834
  delete params.angle;
11461
- this.applyBaseAttributes(params);
11462
11835
  }
11463
11836
  const attribute = this.baseAttributes;
11837
+ const nextAttrs = (params || {});
11464
11838
  if (!rotateCenter) {
11465
- attribute.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11839
+ nextAttrs.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11466
11840
  }
11467
11841
  else {
11468
11842
  let { postMatrix } = this.baseAttributes;
11469
11843
  if (!postMatrix) {
11470
11844
  postMatrix = new Matrix();
11471
- this.baseAttributes.postMatrix = postMatrix;
11845
+ }
11846
+ else {
11847
+ postMatrix = postMatrix.clone();
11472
11848
  }
11473
11849
  application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
11850
+ nextAttrs.postMatrix = postMatrix;
11474
11851
  }
11475
- this.commitBaseAttributeMutation(false, context);
11852
+ this.commitInternalBaseAttributes(nextAttrs, context);
11476
11853
  return this;
11477
11854
  }
11478
11855
  rotateTo(angle) {
@@ -11486,12 +11863,10 @@ class Graphic extends Node {
11486
11863
  const params = this.onBeforeAttributeUpdate &&
11487
11864
  this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
11488
11865
  if (params) {
11489
- this.applyBaseAttributes(params);
11490
- this.commitBaseAttributeMutation(false, context);
11866
+ this.commitInternalBaseAttributes(params, context);
11491
11867
  return this;
11492
11868
  }
11493
- attribute.angle = angle;
11494
- this.commitBaseAttributeMutation(false, context);
11869
+ this.commitInternalBaseAttributes({ angle }, context);
11495
11870
  return this;
11496
11871
  }
11497
11872
  skewTo(b, c) {
@@ -11525,9 +11900,18 @@ class Graphic extends Node {
11525
11900
  }
11526
11901
  getState(stateName) {
11527
11902
  var _a;
11528
- return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
11903
+ return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
11904
+ }
11905
+ getStateResolveBaseAttrs() {
11906
+ var _a;
11907
+ return ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
11908
+ }
11909
+ syncStateResolveContext(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11910
+ var _a;
11911
+ (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.setResolveContext(this, stateResolveBaseAttrs);
11912
+ return stateResolveBaseAttrs;
11529
11913
  }
11530
- createStateModel() {
11914
+ createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11531
11915
  const { compiledDefinitions, stateProxyEligibility, stateProxyModeKey } = this.resolveEffectiveCompiledDefinitions();
11532
11916
  this.compiledStateDefinitions = compiledDefinitions;
11533
11917
  if (!compiledDefinitions) {
@@ -11555,6 +11939,7 @@ class Graphic extends Node {
11555
11939
  this.stateEngineMergeMode = this.stateMergeMode;
11556
11940
  this.stateEngineStateProxyModeKey = stateProxyModeKey;
11557
11941
  }
11942
+ this.syncStateResolveContext(stateResolveBaseAttrs);
11558
11943
  return new StateModel({
11559
11944
  states: this.states,
11560
11945
  currentStates: this.currentStates,
@@ -11563,25 +11948,229 @@ class Graphic extends Node {
11563
11948
  stateEngine: this.stateEngine
11564
11949
  });
11565
11950
  }
11951
+ resolveSimpleLocalStateTransition(states, previousStates) {
11952
+ var _a;
11953
+ if (!this.states ||
11954
+ this.stateProxy ||
11955
+ this.stateSort ||
11956
+ this.stateMergeMode === 'deep' ||
11957
+ this.parent ||
11958
+ ((_a = this.stage) === null || _a === void 0 ? void 0 : _a.rootSharedStateScope) ||
11959
+ this.boundSharedStateScope) {
11960
+ return null;
11961
+ }
11962
+ if (states.length === 1) {
11963
+ const stateName = states[0];
11964
+ const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
11965
+ const nextStates = [stateName];
11966
+ const changed = !this.sameStateNames(previousStates, nextStates);
11967
+ const resolvedStateAttrs = {};
11968
+ if (hasDefinition) {
11969
+ const attrs = this.states[stateName];
11970
+ if (attrs != null) {
11971
+ if (!isPlainObjectValue(attrs)) {
11972
+ return null;
11973
+ }
11974
+ const keys = Object.keys(attrs);
11975
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
11976
+ const key = keys[keyIndex];
11977
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) {
11978
+ return null;
11979
+ }
11980
+ const attrValue = attrs[key];
11981
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
11982
+ ? cloneAttributeValue(attrValue)
11983
+ : attrValue;
11984
+ }
11985
+ }
11986
+ }
11987
+ return {
11988
+ changed,
11989
+ states: nextStates,
11990
+ effectiveStates: nextStates,
11991
+ resolvedStateAttrs
11992
+ };
11993
+ }
11994
+ const uniqueStates = Array.from(new Set(states));
11995
+ const withDefinition = [];
11996
+ const withoutDefinition = [];
11997
+ for (let i = 0; i < uniqueStates.length; i++) {
11998
+ const stateName = uniqueStates[i];
11999
+ if (Object.prototype.hasOwnProperty.call(this.states, stateName)) {
12000
+ withDefinition.push(stateName);
12001
+ }
12002
+ else {
12003
+ withoutDefinition.push(stateName);
12004
+ }
12005
+ }
12006
+ withDefinition.sort((left, right) => left.localeCompare(right));
12007
+ const nextStates = withDefinition.concat(withoutDefinition);
12008
+ const changed = !this.sameStateNames(previousStates, nextStates);
12009
+ const resolvedStateAttrs = {};
12010
+ for (let i = 0; i < nextStates.length; i++) {
12011
+ const stateName = nextStates[i];
12012
+ const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
12013
+ if (!hasDefinition) {
12014
+ continue;
12015
+ }
12016
+ const attrs = this.states[stateName];
12017
+ if (attrs == null) {
12018
+ continue;
12019
+ }
12020
+ if (!isPlainObjectValue(attrs)) {
12021
+ return null;
12022
+ }
12023
+ const keys = Object.keys(attrs);
12024
+ for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
12025
+ const key = keys[keyIndex];
12026
+ if (FULL_STATE_DEFINITION_KEYS.has(key)) {
12027
+ return null;
12028
+ }
12029
+ const attrValue = attrs[key];
12030
+ resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
12031
+ ? cloneAttributeValue(attrValue)
12032
+ : attrValue;
12033
+ }
12034
+ }
12035
+ return {
12036
+ changed,
12037
+ states: nextStates,
12038
+ effectiveStates: nextStates,
12039
+ resolvedStateAttrs
12040
+ };
12041
+ }
12042
+ resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = false) {
12043
+ var _a, _b;
12044
+ let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
12045
+ const isSimpleLocalTransition = !!transition;
12046
+ let resolvedStateAttrs;
12047
+ if (transition) {
12048
+ resolvedStateAttrs = transition.resolvedStateAttrs;
12049
+ }
12050
+ else {
12051
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
12052
+ const stateModel = this.createStateModel(stateResolveBaseAttrs);
12053
+ if (forceResolverRefresh) {
12054
+ (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.invalidateResolverCache();
12055
+ }
12056
+ transition = stateModel.useStates(states);
12057
+ resolvedStateAttrs =
12058
+ this.stateEngine && this.compiledStateDefinitions
12059
+ ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
12060
+ }
12061
+ const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
12062
+ return {
12063
+ transition,
12064
+ effectiveStates: effectiveStates,
12065
+ resolvedStateAttrs,
12066
+ isSimpleLocalTransition
12067
+ };
12068
+ }
12069
+ normalizeSetStatesOptions(options) {
12070
+ if (options && typeof options === 'object') {
12071
+ return {
12072
+ hasAnimation: options.animate,
12073
+ animateSameStatePatchChange: options.animateSameStatePatchChange === true,
12074
+ shouldRefreshSameStatePatch: true
12075
+ };
12076
+ }
12077
+ return {
12078
+ hasAnimation: typeof options === 'boolean' ? options : undefined,
12079
+ animateSameStatePatchChange: false,
12080
+ shouldRefreshSameStatePatch: false
12081
+ };
12082
+ }
12083
+ sameStatePatches(left, right) {
12084
+ const leftRecord = (left !== null && left !== void 0 ? left : {});
12085
+ const rightRecord = (right !== null && right !== void 0 ? right : {});
12086
+ const keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
12087
+ for (const key of keys) {
12088
+ const hasLeft = Object.prototype.hasOwnProperty.call(leftRecord, key);
12089
+ const hasRight = Object.prototype.hasOwnProperty.call(rightRecord, key);
12090
+ if (hasLeft !== hasRight) {
12091
+ return false;
12092
+ }
12093
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) {
12094
+ return false;
12095
+ }
12096
+ }
12097
+ return true;
12098
+ }
12099
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = false) {
12100
+ var _a;
12101
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12102
+ const previousResolvedStatePatch = this.resolvedStatePatch;
12103
+ const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates, true);
12104
+ const patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
12105
+ if (patchChanged &&
12106
+ !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
12107
+ return;
12108
+ }
12109
+ this.currentStates = transition.states;
12110
+ this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
12111
+ this.resolvedStatePatch = resolvedStateAttrs;
12112
+ this.sharedStateDirty = false;
12113
+ this.syncSharedStateActiveRegistrations();
12114
+ if (!patchChanged) {
12115
+ return;
12116
+ }
12117
+ if (this.stage) {
12118
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12119
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12120
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12121
+ graphicId: this._uid,
12122
+ targetStates: [...transition.states]
12123
+ });
12124
+ }
12125
+ if (hasAnimation && animateSameStatePatchChange) {
12126
+ this._syncFinalAttributeFromStaticTruth();
12127
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
12128
+ }
12129
+ else {
12130
+ this.stopStateAnimates();
12131
+ if (this.attributeMayContainTransientAttrs) {
12132
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12133
+ }
12134
+ else {
12135
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
12136
+ type: AttributeUpdateType.STATE
12137
+ });
12138
+ }
12139
+ this.emitStateUpdateEvent();
12140
+ }
12141
+ }
11566
12142
  resolveStateAnimateConfig(animateConfig) {
11567
12143
  var _a, _b, _c;
11568
12144
  return (_c = (_a = animateConfig !== null && animateConfig !== void 0 ? animateConfig : this.stateAnimateConfig) !== null && _a !== void 0 ? _a : (_b = this.context) === null || _b === void 0 ? void 0 : _b.stateAnimateConfig) !== null && _c !== void 0 ? _c : DefaultStateAnimateConfig;
11569
12145
  }
11570
- applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig) {
12146
+ applyStateAttrs(attrs, stateNames, hasAnimation, isClear, animateConfig, extraAnimateAttrs) {
11571
12147
  const resolvedAnimateConfig = hasAnimation ? this.resolveStateAnimateConfig(animateConfig) : undefined;
11572
- const transitionOptions = resolvedAnimateConfig ? { animateConfig: resolvedAnimateConfig } : undefined;
12148
+ const transitionOptions = resolvedAnimateConfig
12149
+ ? {
12150
+ animateConfig: resolvedAnimateConfig,
12151
+ extraAnimateAttrs: extraAnimateAttrs,
12152
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
12153
+ }
12154
+ : undefined;
11573
12155
  if (isClear) {
11574
12156
  this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
11575
12157
  return;
11576
12158
  }
11577
12159
  const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
11578
12160
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
11579
- animateConfig: resolvedAnimateConfig
12161
+ animateConfig: resolvedAnimateConfig,
12162
+ extraAnimateAttrs: extraAnimateAttrs,
12163
+ shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
11580
12164
  });
11581
12165
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
11582
12166
  }
11583
- updateNormalAttrs(stateAttrs) {
11584
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
12167
+ updateNormalAttrs(_stateAttrs) {
12168
+ }
12169
+ getStateTransitionDefaultAttribute(key, targetAttrs) {
12170
+ return this.getDefaultAttribute(key);
12171
+ }
12172
+ shouldSkipStateTransitionDefaultAttribute(_key, _targetAttrs) {
12173
+ return false;
11585
12174
  }
11586
12175
  stopStateAnimates(type = 'end') {
11587
12176
  const stopAnimationState = this.stopAnimationState;
@@ -11589,6 +12178,9 @@ class Graphic extends Node {
11589
12178
  stopAnimationState.call(this, 'state', type);
11590
12179
  return;
11591
12180
  }
12181
+ if (!this.mayHaveTrackedAnimates()) {
12182
+ return;
12183
+ }
11592
12184
  const stateAnimates = [];
11593
12185
  this.visitTrackedAnimates(animate => {
11594
12186
  if (animate.stateNames) {
@@ -11607,7 +12199,8 @@ class Graphic extends Node {
11607
12199
  }
11608
12200
  clearStates(hasAnimation) {
11609
12201
  var _a, _b, _c;
11610
- const previousStates = this.currentStates ? this.currentStates.slice() : [];
12202
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12203
+ const previousResolvedStatePatch = this.resolvedStatePatch;
11611
12204
  const transition = this.createStateModel().clearStates();
11612
12205
  if (!transition.changed && previousStates.length === 0) {
11613
12206
  this.currentStates = [];
@@ -11617,7 +12210,9 @@ class Graphic extends Node {
11617
12210
  this.clearSharedStateActiveRegistrations();
11618
12211
  return;
11619
12212
  }
11620
- const resolvedStateAttrs = cloneAttributeValue(((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {}));
12213
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent('beforeStateUpdate')
12214
+ ? cloneAttributeValue(((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : {}))
12215
+ : ((_c = this.baseAttributes) !== null && _c !== void 0 ? _c : {});
11621
12216
  if (transition.changed &&
11622
12217
  !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, true)) {
11623
12218
  return;
@@ -11627,19 +12222,29 @@ class Graphic extends Node {
11627
12222
  this.resolvedStatePatch = undefined;
11628
12223
  this.sharedStateDirty = false;
11629
12224
  this.clearSharedStateActiveRegistrations();
11630
- (_b = getStageStatePerfMonitor(this.stage)) === null || _b === void 0 ? void 0 : _b.incrementCounter('stateCommits');
11631
- (_c = getStageStatePerfMonitor(this.stage)) === null || _c === void 0 ? void 0 : _c.recordEvent('state-commit', {
11632
- graphicId: this._uid,
11633
- targetStates: []
11634
- });
12225
+ if (this.stage) {
12226
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12227
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12228
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12229
+ graphicId: this._uid,
12230
+ targetStates: []
12231
+ });
12232
+ }
11635
12233
  if (hasAnimation) {
11636
12234
  this._syncFinalAttributeFromStaticTruth();
11637
- this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, true);
12235
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, true, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11638
12236
  }
11639
12237
  else {
11640
12238
  this.stopStateAnimates();
11641
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11642
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12239
+ if (this.attributeMayContainTransientAttrs) {
12240
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12241
+ }
12242
+ else {
12243
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, undefined, {
12244
+ type: AttributeUpdateType.STATE
12245
+ });
12246
+ }
12247
+ this.emitStateUpdateEvent();
11643
12248
  }
11644
12249
  }
11645
12250
  removeState(stateName, hasAnimation) {
@@ -11661,44 +12266,76 @@ class Graphic extends Node {
11661
12266
  }
11662
12267
  this.useStates(transition.states, hasAnimation);
11663
12268
  }
12269
+ setStates(states, options) {
12270
+ var _a, _b, _c;
12271
+ const { hasAnimation, animateSameStatePatchChange, shouldRefreshSameStatePatch } = this.normalizeSetStatesOptions(options);
12272
+ const nextStates = (states === null || states === void 0 ? void 0 : states.length) ? states : EMPTY_STATE_NAMES;
12273
+ const hasCurrentState = !!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ||
12274
+ !!((_b = this.effectiveStates) === null || _b === void 0 ? void 0 : _b.length) ||
12275
+ !!this.resolvedStatePatch ||
12276
+ !!((_c = this.registeredActiveScopes) === null || _c === void 0 ? void 0 : _c.size);
12277
+ if (!nextStates.length) {
12278
+ if (!hasCurrentState && !this.sharedStateDirty) {
12279
+ return;
12280
+ }
12281
+ this.clearStates(hasAnimation);
12282
+ return;
12283
+ }
12284
+ if (this.sameStateNames(this.currentStates, nextStates)) {
12285
+ if (shouldRefreshSameStatePatch) {
12286
+ this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange);
12287
+ return;
12288
+ }
12289
+ if (this.sharedStateDirty) {
12290
+ this.refreshSharedStateBeforeRender();
12291
+ }
12292
+ return;
12293
+ }
12294
+ this.useStates(nextStates, hasAnimation);
12295
+ }
11664
12296
  useStates(states, hasAnimation) {
11665
- var _a, _b, _c, _d, _e;
12297
+ var _a;
11666
12298
  if (!states.length) {
11667
12299
  this.clearStates(hasAnimation);
11668
12300
  return;
11669
12301
  }
11670
- const previousStates = this.currentStates ? this.currentStates.slice() : [];
11671
- const stateResolveBaseAttrs = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
11672
- const stateModel = this.createStateModel();
11673
- (_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.setResolveContext(this, stateResolveBaseAttrs);
11674
- const transition = stateModel.useStates(states);
12302
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12303
+ const previousResolvedStatePatch = this.resolvedStatePatch;
12304
+ const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates);
11675
12305
  if (!transition.changed && this.sameStateNames(previousStates, transition.states)) {
11676
12306
  return;
11677
12307
  }
11678
- const effectiveStates = (_c = transition.effectiveStates) !== null && _c !== void 0 ? _c : transition.states;
11679
- const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
11680
- ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
11681
12308
  if (!this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
11682
12309
  return;
11683
12310
  }
11684
12311
  this.currentStates = transition.states;
11685
- this.effectiveStates = [...effectiveStates];
11686
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
12312
+ this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
12313
+ this.resolvedStatePatch = resolvedStateAttrs;
11687
12314
  this.sharedStateDirty = false;
11688
12315
  this.syncSharedStateActiveRegistrations();
11689
- (_d = getStageStatePerfMonitor(this.stage)) === null || _d === void 0 ? void 0 : _d.incrementCounter('stateCommits');
11690
- (_e = getStageStatePerfMonitor(this.stage)) === null || _e === void 0 ? void 0 : _e.recordEvent('state-commit', {
11691
- graphicId: this._uid,
11692
- targetStates: [...transition.states]
11693
- });
12316
+ if (this.stage) {
12317
+ const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12318
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12319
+ perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12320
+ graphicId: this._uid,
12321
+ targetStates: [...transition.states]
12322
+ });
12323
+ }
11694
12324
  if (hasAnimation) {
11695
12325
  this._syncFinalAttributeFromStaticTruth();
11696
- this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation);
12326
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11697
12327
  }
11698
12328
  else {
11699
12329
  this.stopStateAnimates();
11700
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11701
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12330
+ if (this.attributeMayContainTransientAttrs) {
12331
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
12332
+ }
12333
+ else {
12334
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
12335
+ type: AttributeUpdateType.STATE
12336
+ });
12337
+ }
12338
+ this.emitStateUpdateEvent();
11702
12339
  }
11703
12340
  }
11704
12341
  invalidateResolver() {
@@ -11706,19 +12343,18 @@ class Graphic extends Node {
11706
12343
  if (!this.stateEngine || !((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.compiledStateDefinitions) {
11707
12344
  return;
11708
12345
  }
11709
- const stateResolveBaseAttrs = ((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : this.attribute);
11710
- this.stateEngine.setResolveContext(this, stateResolveBaseAttrs);
11711
- this.resolverEpoch += 1;
12346
+ this.syncStateResolveContext();
12347
+ this.resolverEpoch = ((_b = this.resolverEpoch) !== null && _b !== void 0 ? _b : 0) + 1;
11712
12348
  this.stateEngine.invalidateResolverCache();
11713
12349
  const transition = this.stateEngine.applyStates(this.currentStates);
11714
12350
  const resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
11715
12351
  this.effectiveStates = [...transition.effectiveStates];
11716
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
12352
+ this.resolvedStatePatch = resolvedStateAttrs;
11717
12353
  this.sharedStateDirty = false;
11718
12354
  this.syncSharedStateActiveRegistrations();
11719
12355
  this.stopStateAnimates();
11720
12356
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11721
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12357
+ this.emitStateUpdateEvent();
11722
12358
  }
11723
12359
  sameStateNames(left, right) {
11724
12360
  const normalizedLeft = left !== null && left !== void 0 ? left : [];
@@ -11757,6 +12393,20 @@ class Graphic extends Node {
11757
12393
  this.glyphHost.addUpdateBoundTag();
11758
12394
  }
11759
12395
  }
12396
+ addBroadUpdateTag() {
12397
+ this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag();
12398
+ this._updateTag |=
12399
+ UpdateTag.UPDATE_SHAPE_AND_BOUNDS |
12400
+ UpdateTag.UPDATE_PAINT |
12401
+ UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX |
12402
+ UpdateTag.UPDATE_LAYOUT;
12403
+ if (this.parent) {
12404
+ this.parent.addChildUpdateBoundTag();
12405
+ }
12406
+ if (this.glyphHost) {
12407
+ this.glyphHost.addUpdateBoundTag();
12408
+ }
12409
+ }
11760
12410
  updateShapeAndBoundsTagSetted() {
11761
12411
  return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
11762
12412
  }
@@ -11861,17 +12511,22 @@ class Graphic extends Node {
11861
12511
  }
11862
12512
  }
11863
12513
  setStage(stage, layer) {
11864
- var _a, _b, _c, _d, _e, _f, _g, _h;
12514
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11865
12515
  const graphicService = (_c = (_a = stage === null || stage === void 0 ? void 0 : stage.graphicService) !== null && _a !== void 0 ? _a : (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
11866
12516
  const previousStage = this.stage;
11867
12517
  if (this.stage !== stage || this.layer !== layer) {
11868
12518
  this.stage = stage;
11869
12519
  this.layer = layer;
11870
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
12520
+ if (((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
12521
+ this.boundSharedStateScope ||
12522
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
12523
+ this.sharedStateDirty) {
12524
+ this.syncSharedStateScopeBindingOnTreeChange(true);
12525
+ }
11871
12526
  this.setStageToShadowRoot(stage, layer);
11872
- if (this.hasAnyTrackedAnimate()) {
11873
- const previousTimeline = (_e = previousStage === null || previousStage === void 0 ? void 0 : previousStage.getTimeline) === null || _e === void 0 ? void 0 : _e.call(previousStage);
11874
- const nextTimeline = (_f = stage === null || stage === void 0 ? void 0 : stage.getTimeline) === null || _f === void 0 ? void 0 : _f.call(stage);
12527
+ if (this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
12528
+ const previousTimeline = (_f = previousStage === null || previousStage === void 0 ? void 0 : previousStage.getTimeline) === null || _f === void 0 ? void 0 : _f.call(previousStage);
12529
+ const nextTimeline = (_g = stage === null || stage === void 0 ? void 0 : stage.getTimeline) === null || _g === void 0 ? void 0 : _g.call(stage);
11875
12530
  const detachedStageAnimates = [];
11876
12531
  this.visitTrackedAnimates(a => {
11877
12532
  const boundToPreviousStage = !!previousTimeline && a.timeline === previousTimeline;
@@ -11909,10 +12564,38 @@ class Graphic extends Node {
11909
12564
  }
11910
12565
  }
11911
12566
  this._onSetStage && this._onSetStage(this, stage, layer);
11912
- (_g = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _g === void 0 ? void 0 : _g.call(graphicService, this, stage);
12567
+ (_h = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _h === void 0 ? void 0 : _h.call(graphicService, this, stage);
11913
12568
  return;
11914
12569
  }
11915
- this.syncSharedStateScopeBindingFromTree(!!((_h = this.currentStates) === null || _h === void 0 ? void 0 : _h.length));
12570
+ if (((_j = this.currentStates) === null || _j === void 0 ? void 0 : _j.length) ||
12571
+ this.boundSharedStateScope ||
12572
+ ((_k = this.registeredActiveScopes) === null || _k === void 0 ? void 0 : _k.size) ||
12573
+ this.sharedStateDirty) {
12574
+ this.syncSharedStateScopeBindingOnTreeChange(true);
12575
+ }
12576
+ }
12577
+ detachStageForRelease() {
12578
+ var _a, _b, _c;
12579
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
12580
+ this.clearSharedStateActiveRegistrations();
12581
+ }
12582
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
12583
+ this.stopAnimates();
12584
+ }
12585
+ this.boundSharedStateScope = undefined;
12586
+ this.boundSharedStateRevision = undefined;
12587
+ this.localFallbackCompiledDefinitions = undefined;
12588
+ this.compiledStateDefinitions = undefined;
12589
+ this.compiledStateDefinitionsCacheKey = undefined;
12590
+ this.stateEngine = undefined;
12591
+ this.stateEngineCompiledDefinitions = undefined;
12592
+ this.stateEngineStateProxyModeKey = undefined;
12593
+ this.sharedStateDirty = false;
12594
+ this.stage = null;
12595
+ this.layer = null;
12596
+ if (this.shadowRoot) {
12597
+ (_c = (_b = this.shadowRoot).detachStageForRelease) === null || _c === void 0 ? void 0 : _c.call(_b);
12598
+ }
11916
12599
  }
11917
12600
  setStageToShadowRoot(stage, layer) {
11918
12601
  if (this.shadowRoot) {
@@ -12048,6 +12731,9 @@ class Graphic extends Node {
12048
12731
  cb && cb();
12049
12732
  }
12050
12733
  _stopAnimates() {
12734
+ if (!this.mayHaveTrackedAnimates()) {
12735
+ return;
12736
+ }
12051
12737
  const animates = [];
12052
12738
  this.visitTrackedAnimates(animate => {
12053
12739
  animates.push(animate);
@@ -12068,17 +12754,24 @@ class Graphic extends Node {
12068
12754
  }
12069
12755
  }
12070
12756
  release() {
12071
- var _a, _b, _c;
12757
+ var _a, _b, _c, _d;
12072
12758
  this.releaseStatus = 'released';
12073
- this.clearSharedStateActiveRegistrations();
12074
- this.stopAnimates();
12075
- const graphicService = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService) !== null && _b !== void 0 ? _b : application.graphicService;
12076
- (_c = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onRelease) === null || _c === void 0 ? void 0 : _c.call(graphicService, this);
12759
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
12760
+ this.clearSharedStateActiveRegistrations();
12761
+ }
12762
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
12763
+ this.stopAnimates();
12764
+ }
12765
+ const graphicService = (_c = (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
12766
+ (_d = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onRelease) === null || _d === void 0 ? void 0 : _d.call(graphicService, this);
12077
12767
  super.release();
12078
12768
  }
12769
+ hasCustomEvent(type) {
12770
+ return !!this._events && type in this._events;
12771
+ }
12079
12772
  _dispatchCustomEvent(type, context) {
12080
12773
  var _a, _b;
12081
- if (this._events && type in this._events) {
12774
+ if (this.hasCustomEvent(type)) {
12082
12775
  const changeEvent = new CustomEvent(type, context);
12083
12776
  changeEvent.bubbles = false;
12084
12777
  const manager = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem) === null || _b === void 0 ? void 0 : _b.manager;
@@ -12091,6 +12784,9 @@ class Graphic extends Node {
12091
12784
  return true;
12092
12785
  }
12093
12786
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
12787
+ if (!this.hasCustomEvent('beforeStateUpdate')) {
12788
+ return true;
12789
+ }
12094
12790
  return this._dispatchCustomEvent('beforeStateUpdate', {
12095
12791
  type: AttributeUpdateType.STATE,
12096
12792
  attrs: Object.assign({}, attrs),
@@ -12100,6 +12796,11 @@ class Graphic extends Node {
12100
12796
  isClear: !!isClear
12101
12797
  });
12102
12798
  }
12799
+ emitStateUpdateEvent() {
12800
+ if (this.hasCustomEvent('afterStateUpdate')) {
12801
+ this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12802
+ }
12803
+ }
12103
12804
  _emitCustomEvent(type, context) {
12104
12805
  this._dispatchCustomEvent(type, context);
12105
12806
  }
@@ -13602,6 +14303,61 @@ class Rect extends Graphic {
13602
14303
  needUpdateTag(key) {
13603
14304
  return super.needUpdateTag(key, RECT_UPDATE_TAG_KEY);
13604
14305
  }
14306
+ shouldSkipStateTransitionDefaultAttribute(key, targetAttrs) {
14307
+ var _a;
14308
+ const attrs = ((_a = targetAttrs !== null && targetAttrs !== void 0 ? targetAttrs : this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
14309
+ const hasValue = (attrKey) => attrs[attrKey] != null;
14310
+ const isNilValue = (attrKey) => attrs[attrKey] == null;
14311
+ switch (key) {
14312
+ case 'width':
14313
+ return isNilValue('width') && hasValue('x') && hasValue('x1');
14314
+ case 'height':
14315
+ return isNilValue('height') && hasValue('y') && hasValue('y1');
14316
+ case 'x1':
14317
+ return isNilValue('x1') && hasValue('x') && hasValue('width');
14318
+ case 'y1':
14319
+ return isNilValue('y1') && hasValue('y') && hasValue('height');
14320
+ default:
14321
+ return false;
14322
+ }
14323
+ }
14324
+ getStateTransitionDefaultAttribute(key, targetAttrs) {
14325
+ var _a;
14326
+ const attrs = ((_a = targetAttrs !== null && targetAttrs !== void 0 ? targetAttrs : this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
14327
+ const getNumber = (attrKey) => {
14328
+ const value = attrs[attrKey];
14329
+ return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
14330
+ };
14331
+ const x = getNumber('x');
14332
+ const y = getNumber('y');
14333
+ const x1 = getNumber('x1');
14334
+ const y1 = getNumber('y1');
14335
+ const width = getNumber('width');
14336
+ const height = getNumber('height');
14337
+ switch (key) {
14338
+ case 'width':
14339
+ if (width == null && x != null && x1 != null) {
14340
+ return x1 - x;
14341
+ }
14342
+ break;
14343
+ case 'height':
14344
+ if (height == null && y != null && y1 != null) {
14345
+ return y1 - y;
14346
+ }
14347
+ break;
14348
+ case 'x1':
14349
+ if (x1 == null && x != null && width != null) {
14350
+ return x + width;
14351
+ }
14352
+ break;
14353
+ case 'y1':
14354
+ if (y1 == null && y != null && height != null) {
14355
+ return y + height;
14356
+ }
14357
+ break;
14358
+ }
14359
+ return super.getStateTransitionDefaultAttribute(key, targetAttrs);
14360
+ }
13605
14361
  toCustomPath() {
13606
14362
  let path = super.toCustomPath();
13607
14363
  if (path) {
@@ -16295,6 +17051,7 @@ class Group extends Graphic {
16295
17051
  this.type = 'group';
16296
17052
  this.parent = null;
16297
17053
  this.isContainer = true;
17054
+ this._hasSharedStateDefinitions = false;
16298
17055
  this.numberType = GROUP_NUMBER_TYPE;
16299
17056
  this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
16300
17057
  }
@@ -16305,12 +17062,17 @@ class Group extends Graphic {
16305
17062
  if (this._sharedStateDefinitions === value) {
16306
17063
  return;
16307
17064
  }
17065
+ const previousScope = this.sharedStateScope;
16308
17066
  this._sharedStateDefinitions = value;
17067
+ this._hasSharedStateDefinitions = !!value && Object.keys(value).length > 0;
16309
17068
  this.ensureSharedStateScopeBound();
16310
17069
  if (this.sharedStateScope) {
16311
17070
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, value);
16312
17071
  markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage);
16313
17072
  }
17073
+ if (previousScope !== this.sharedStateScope) {
17074
+ this.notifyChildrenSharedStateTreeChanged();
17075
+ }
16314
17076
  }
16315
17077
  setMode(mode) {
16316
17078
  mode === '3d' ? this.set3dMode() : this.set2dMode();
@@ -16501,8 +17263,16 @@ class Group extends Graphic {
16501
17263
  insertInto(newNode, idx) {
16502
17264
  return this._updateChildToStage(super.insertInto(newNode, idx));
16503
17265
  }
16504
- removeChild(child) {
17266
+ removeChild(child, highPerformance = false) {
17267
+ var _a;
16505
17268
  const data = super.removeChild(child);
17269
+ if (!data) {
17270
+ return data;
17271
+ }
17272
+ if (highPerformance) {
17273
+ (_a = child.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(child);
17274
+ return data;
17275
+ }
16506
17276
  this.getGraphicService().onRemove(child);
16507
17277
  child.setStage(null, null);
16508
17278
  this.addUpdateBoundTag();
@@ -16525,29 +17295,43 @@ class Group extends Graphic {
16525
17295
  setStage(stage, layer) {
16526
17296
  var _a, _b, _c, _d, _e, _f;
16527
17297
  const graphicService = (_c = (_a = stage === null || stage === void 0 ? void 0 : stage.graphicService) !== null && _a !== void 0 ? _a : (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
17298
+ const needsSharedStateTreeSync = this._hasSharedStateDefinitions ||
17299
+ this.sharedStateScope ||
17300
+ ((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
17301
+ this.boundSharedStateScope ||
17302
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
17303
+ this.sharedStateDirty;
16528
17304
  if (this.stage !== stage) {
16529
17305
  this.stage = stage;
16530
17306
  this.layer = layer;
16531
- this.ensureSharedStateScopeBound();
16532
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
17307
+ if (needsSharedStateTreeSync) {
17308
+ this.ensureSharedStateScopeBound();
17309
+ this.syncSharedStateScopeBindingOnTreeChange(true);
17310
+ }
16533
17311
  this.setStageToShadowRoot(stage, layer);
16534
17312
  this._onSetStage && this._onSetStage(this, stage, layer);
16535
- (_e = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _e === void 0 ? void 0 : _e.call(graphicService, this, stage);
17313
+ (_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
16536
17314
  this.forEachChildren(item => {
16537
17315
  item.setStage(stage, this.layer);
16538
17316
  });
16539
17317
  return;
16540
17318
  }
16541
- if (this.layer !== layer) {
17319
+ const layerChanged = this.layer !== layer;
17320
+ if (layerChanged) {
16542
17321
  this.layer = layer;
16543
17322
  }
16544
- this.ensureSharedStateScopeBound();
16545
- this.syncSharedStateScopeBindingFromTree(!!((_f = this.currentStates) === null || _f === void 0 ? void 0 : _f.length));
16546
- this.forEachChildren(item => {
16547
- if (item.onParentSharedStateTreeChanged) {
16548
- item.onParentSharedStateTreeChanged(stage, this.layer);
16549
- }
16550
- });
17323
+ if (needsSharedStateTreeSync) {
17324
+ this.ensureSharedStateScopeBound();
17325
+ this.syncSharedStateScopeBindingOnTreeChange(true);
17326
+ this.notifyChildrenSharedStateTreeChanged();
17327
+ }
17328
+ else if (layerChanged) {
17329
+ this.forEachChildren(item => {
17330
+ if (item.onParentSharedStateTreeChanged) {
17331
+ item.onParentSharedStateTreeChanged(stage, this.layer);
17332
+ }
17333
+ });
17334
+ }
16551
17335
  }
16552
17336
  addUpdatePositionTag() {
16553
17337
  super.addUpdatePositionTag();
@@ -16614,8 +17398,20 @@ class Group extends Graphic {
16614
17398
  }
16615
17399
  super.release();
16616
17400
  }
17401
+ detachStageForRelease() {
17402
+ super.detachStageForRelease();
17403
+ this.sharedStateScope = undefined;
17404
+ this.forEachChildren((item) => {
17405
+ var _a;
17406
+ (_a = item.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(item);
17407
+ });
17408
+ }
16617
17409
  ensureSharedStateScopeBound() {
16618
17410
  var _a, _b, _c;
17411
+ if (!this.hasSharedStateDefinitions()) {
17412
+ this.sharedStateScope = undefined;
17413
+ return;
17414
+ }
16619
17415
  const parentScope = (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.sharedStateScope) !== null && _b !== void 0 ? _b : (_c = this.stage) === null || _c === void 0 ? void 0 : _c.rootSharedStateScope;
16620
17416
  if (!this.sharedStateScope) {
16621
17417
  this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
@@ -16628,18 +17424,25 @@ class Group extends Graphic {
16628
17424
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, this._sharedStateDefinitions);
16629
17425
  }
16630
17426
  }
17427
+ hasSharedStateDefinitions() {
17428
+ return this._hasSharedStateDefinitions;
17429
+ }
17430
+ notifyChildrenSharedStateTreeChanged() {
17431
+ this.forEachChildren(item => {
17432
+ if (item.onParentSharedStateTreeChanged) {
17433
+ item.onParentSharedStateTreeChanged(this.stage, this.layer);
17434
+ }
17435
+ });
17436
+ }
16631
17437
  onParentSharedStateTreeChanged(stage, layer) {
17438
+ var _a;
16632
17439
  if (this.stage !== stage || this.layer !== layer) {
16633
17440
  this.setStage(stage, layer);
16634
17441
  return;
16635
17442
  }
16636
17443
  this.ensureSharedStateScopeBound();
16637
- this.syncSharedStateScopeBindingFromTree();
16638
- this.forEachChildren(item => {
16639
- if (item.onParentSharedStateTreeChanged) {
16640
- item.onParentSharedStateTreeChanged(stage, this.layer);
16641
- }
16642
- });
17444
+ this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length));
17445
+ this.notifyChildrenSharedStateTreeChanged();
16643
17446
  }
16644
17447
  }
16645
17448
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -17081,6 +17884,10 @@ class DefaultGraphicService {
17081
17884
  };
17082
17885
  this.tempAABBBounds1 = new AABBBounds();
17083
17886
  this.tempAABBBounds2 = new AABBBounds();
17887
+ this.tempAABBBoundsResult = {
17888
+ tb1: this.tempAABBBounds1,
17889
+ tb2: this.tempAABBBounds2
17890
+ };
17084
17891
  }
17085
17892
  onAttributeUpdate(graphic) {
17086
17893
  if (this.hooks.onAttributeUpdate.taps.length) {
@@ -17211,7 +18018,7 @@ class DefaultGraphicService {
17211
18018
  const tb2 = this.tempAABBBounds2;
17212
18019
  tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17213
18020
  tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17214
- return { tb1, tb2 };
18021
+ return this.tempAABBBoundsResult;
17215
18022
  }
17216
18023
  }
17217
18024
 
@@ -19114,6 +19921,7 @@ class DirtyBoundsPlugin {
19114
19921
  this.activeEvent = 'onRegister';
19115
19922
  this._uid = Generator.GenAutoIncrementId();
19116
19923
  this.key = this.name + this._uid;
19924
+ this.dirtyBoundsHooksRegistered = false;
19117
19925
  this.handlePaintOnlyUpdate = (graphic) => {
19118
19926
  var _a, _b, _c, _d;
19119
19927
  const stage = this.pluginService.stage;
@@ -19155,16 +19963,16 @@ class DirtyBoundsPlugin {
19155
19963
  }
19156
19964
  return (_b = owner._globalAABBBounds) !== null && _b !== void 0 ? _b : owner.globalAABBBounds;
19157
19965
  }
19158
- activate(context) {
19159
- this.pluginService = context;
19160
- context.stage.hooks.afterRender.tap(this.key, stage => {
19161
- if (!(stage && stage === this.pluginService.stage)) {
19162
- return;
19163
- }
19164
- stage.dirtyBounds.clear();
19165
- });
19166
- const stage = this.pluginService.stage;
19167
- if (!stage) {
19966
+ getRemoveDirtyBounds(graphic) {
19967
+ var _a;
19968
+ const owner = ((_a = graphic.glyphHost) !== null && _a !== void 0 ? _a : graphic);
19969
+ const cachedBounds = owner._globalAABBBounds;
19970
+ if (cachedBounds && typeof cachedBounds.empty === 'function' && !cachedBounds.empty()) {
19971
+ return cachedBounds;
19972
+ }
19973
+ }
19974
+ registerDirtyBoundsHooks(stage) {
19975
+ if (this.dirtyBoundsHooksRegistered) {
19168
19976
  return;
19169
19977
  }
19170
19978
  stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate);
@@ -19205,10 +20013,29 @@ class DirtyBoundsPlugin {
19205
20013
  if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
19206
20014
  return;
19207
20015
  }
19208
- if (stage) {
19209
- stage.dirty(graphic.globalAABBBounds);
20016
+ const bounds = this.getRemoveDirtyBounds(graphic);
20017
+ if (bounds && !bounds.empty()) {
20018
+ stage.dirty(bounds);
20019
+ }
20020
+ });
20021
+ this.dirtyBoundsHooksRegistered = true;
20022
+ }
20023
+ activate(context) {
20024
+ this.pluginService = context;
20025
+ context.stage.hooks.afterRender.tap(this.key, stage => {
20026
+ if (!(stage && stage === this.pluginService.stage)) {
20027
+ return;
19210
20028
  }
20029
+ stage.dirtyBounds.clear();
20030
+ this.registerDirtyBoundsHooks(stage);
19211
20031
  });
20032
+ const stage = this.pluginService.stage;
20033
+ if (!stage) {
20034
+ return;
20035
+ }
20036
+ if (stage.renderCount) {
20037
+ this.registerDirtyBoundsHooks(stage);
20038
+ }
19212
20039
  }
19213
20040
  deactivate(context) {
19214
20041
  const stage = this.pluginService.stage;
@@ -19218,6 +20045,7 @@ class DirtyBoundsPlugin {
19218
20045
  stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(item => {
19219
20046
  return item.name !== this.key;
19220
20047
  });
20048
+ this.dirtyBoundsHooksRegistered = false;
19221
20049
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps =
19222
20050
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {
19223
20051
  return item.name !== this.key;
@@ -19742,7 +20570,7 @@ class Stage extends Group {
19742
20570
  this._ticker.on('tick', this.afterTickCb);
19743
20571
  }
19744
20572
  constructor(params = {}, deps = {}) {
19745
- var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
20573
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
19746
20574
  super({});
19747
20575
  this.tickedBeforeRender = true;
19748
20576
  this._onVisibleChange = (visible) => {
@@ -19764,7 +20592,10 @@ class Stage extends Group {
19764
20592
  }
19765
20593
  };
19766
20594
  this.beforeRender = (stage) => {
19767
- flushStageSharedStateRefresh(this);
20595
+ const pendingSharedRefresh = this._pendingSharedStateRefreshGraphics;
20596
+ if (pendingSharedRefresh === null || pendingSharedRefresh === void 0 ? void 0 : pendingSharedRefresh.size) {
20597
+ flushStageSharedStateRefresh(this);
20598
+ }
19768
20599
  this._beforeRenderList.forEach(cb => cb(stage));
19769
20600
  };
19770
20601
  this.afterClearScreen = (drawParams) => {
@@ -19830,16 +20661,19 @@ class Stage extends Group {
19830
20661
  this.appendChild(this.layerService.createLayer(this, { main: true }));
19831
20662
  this.nextFrameRenderLayerSet = new Set();
19832
20663
  this.willNextFrameRender = false;
19833
- ensureStageStatePerfMonitor(this);
19834
- this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
19835
- this.rootSharedStateScope = createRootSharedStateScope(this, (_x = this.theme) === null || _x === void 0 ? void 0 : _x.stateDefinitions);
19836
20664
  this.theme.onStateDefinitionsChange = () => {
19837
20665
  var _a;
19838
- if (!this.rootSharedStateScope) {
20666
+ const definitions = (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions;
20667
+ if (!definitions || !Object.keys(definitions).length) {
20668
+ if (this.rootSharedStateScope) {
20669
+ setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions);
20670
+ markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20671
+ }
19839
20672
  return;
19840
20673
  }
19841
- setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions);
19842
- markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20674
+ const rootScope = this.ensureRootSharedStateScope(definitions);
20675
+ setRootSharedStateScopeThemeDefinitions(rootScope, definitions);
20676
+ markScopeActiveDescendantsDirty(rootScope, this);
19843
20677
  };
19844
20678
  this.renderStyle = params.renderStyle;
19845
20679
  if (params.autoRender) {
@@ -19881,7 +20715,7 @@ class Stage extends Group {
19881
20715
  this.setAttributes({ background: this._background });
19882
20716
  }
19883
20717
  this.initAnimate(params);
19884
- this.rafId = (_y = params.rafId) !== null && _y !== void 0 ? _y : Math.floor(Math.random() * 6);
20718
+ this.rafId = (_x = params.rafId) !== null && _x !== void 0 ? _x : Math.floor(Math.random() * 6);
19885
20719
  }
19886
20720
  initAnimate(params) {
19887
20721
  var _a;
@@ -20261,8 +21095,22 @@ class Stage extends Group {
20261
21095
  });
20262
21096
  }
20263
21097
  }
21098
+ ensureRootSharedStateScope(themeStateDefinitions) {
21099
+ if (!this.rootSharedStateScope) {
21100
+ this.rootSharedStateScope = createRootSharedStateScope(this, themeStateDefinitions);
21101
+ return this.rootSharedStateScope;
21102
+ }
21103
+ this.rootSharedStateScope.ownerStage = this;
21104
+ return this.rootSharedStateScope;
21105
+ }
21106
+ getStateBatchScheduler() {
21107
+ if (!this._stateBatchScheduler) {
21108
+ this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
21109
+ }
21110
+ return this._stateBatchScheduler;
21111
+ }
20264
21112
  scheduleStateBatch(graphics, targetStates) {
20265
- this._stateBatchScheduler.schedule(graphics, targetStates);
21113
+ this.getStateBatchScheduler().schedule(graphics, targetStates);
20266
21114
  }
20267
21115
  getStatePerfSnapshot() {
20268
21116
  return ensureStageStatePerfMonitor(this).getSnapshot();
@@ -23852,23 +24700,27 @@ function createStage(params) {
23852
24700
  const result = { x: 0, y: 0, z: 0, lastModelMatrix: null };
23853
24701
  class BaseRender {
23854
24702
  init(contributions) {
23855
- if (contributions) {
23856
- this._renderContribitions = contributions.getContributions();
23857
- }
23858
- if (!this._renderContribitions) {
23859
- this._renderContribitions = [];
23860
- }
23861
24703
  if (!this.builtinContributions) {
23862
24704
  this.builtinContributions = [];
23863
24705
  }
23864
- this.builtinContributions.push(defaultBaseClipRenderBeforeContribution);
23865
- this.builtinContributions.push(defaultBaseClipRenderAfterContribution);
23866
- this.builtinContributions.forEach(item => this._renderContribitions.push(item));
24706
+ this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
24707
+ const addContribution = (item) => {
24708
+ if (!this._renderContribitions.includes(item)) {
24709
+ this._renderContribitions.push(item);
24710
+ }
24711
+ };
24712
+ this.builtinContributions.forEach(addContribution);
24713
+ addContribution(defaultBaseClipRenderBeforeContribution);
24714
+ addContribution(defaultBaseClipRenderAfterContribution);
23867
24715
  if (this._renderContribitions.length) {
23868
24716
  this._renderContribitions.sort((a, b) => b.order - a.order);
23869
24717
  this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke);
23870
24718
  this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke);
23871
24719
  }
24720
+ else {
24721
+ this._beforeRenderContribitions = [];
24722
+ this._afterRenderContribitions = [];
24723
+ }
23872
24724
  }
23873
24725
  reInit() {
23874
24726
  this.init(this.graphicRenderContributions);
@@ -30906,7 +31758,10 @@ class FlexLayoutPlugin {
30906
31758
  this.tryLayout(graphic, false);
30907
31759
  }
30908
31760
  });
30909
- stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
31761
+ stage.graphicService.hooks.onSetStage.tap(this.key, (graphic, nextStage) => {
31762
+ if (!(nextStage && nextStage === this.pluginService.stage)) {
31763
+ return;
31764
+ }
30910
31765
  if (graphic.glyphHost) {
30911
31766
  graphic = graphic.glyphHost;
30912
31767
  }
@@ -30941,4 +31796,4 @@ const registerFlexLayoutPlugin = () => {
30941
31796
  Factory.registerPlugin('FlexLayoutPlugin', FlexLayoutPlugin);
30942
31797
  };
30943
31798
 
30944
- export { ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, AnimateMode, AnimateStatus, AnimateStepType, AppContext, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEntry, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, Circle, CircleRender, CircleRenderContribution, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Context2dFactory, ContributionProvider, ContributionRegistry, ContributionStore, CubicBezierCurve, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DEFAULT_TEXT_FONT_FAMILY, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseClipRenderAfterContribution, DefaultBaseClipRenderBeforeContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStarAttribute, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolClipRangeStrokeRenderContribution, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction, DirectionalLight, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EditModule, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ALL_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, GradientParser, Graphic, GraphicCreator$1 as GraphicCreator, GraphicFactory, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncrementalDrawContribution, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerFactory, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, Mat4Allocate, MatrixAllocate, MeasureModeEnum, MiniappEntry, MonotoneX, MonotoneY, NOWORK_ANIMATE_ATTR, Node, NodeEntry, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PerformanceRAF, PickItemInterceptor, PickServiceInterceptor, PickerRegistry, PickerService, PluginRegistry, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, RendererRegistry, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, STAR_NUMBER_TYPE, STATUS$1 as STATUS, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowPickServiceInterceptorContribution, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StageFactory, Star, StarRender, StarRenderContribution, StateDefinitionCompiler, StateEngine, StaticLayerHandlerContribution, Step, StepClosed, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TransformUtil, UpdateTag, VGlobal, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _calculateLineHeight, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindArc3dRenderModule, bindArcRenderModule, bindAreaRenderModule, bindCircleRenderModule, bindContributionProvider, bindContributionProviderNoSingletonScope, bindGlyphRenderModule, bindImageRenderModule, bindLineRenderModule, bindPathRenderModule, bindPolygonRenderModule, bindPyramid3dRenderModule, bindRect3dRenderModule, bindRectRenderModule, bindRichtextRenderModule, bindStarRenderModule, bindSymbolRenderModule, bindTextRenderModule, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, colorEqual, colorStringInterpolationToStr, configureRuntimeApplicationForApp, container, cornerTangents, createBrowserApp as createApp, createArc, createArc3d, createArea, createBrowserApp, createCanvasEventTransformer, createCircle, createColor, createConicalGradient, createContributionProvider, createEventTransformer, createGlyph, createGraphic, createGroup, createImage, createLine, createMat4, createMiniappApp, createNodeApp, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createStar, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseClipRenderAfterContribution, defaultBaseClipRenderBeforeContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolClipRangeStrokeRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, diff, divideCubic, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawBackgroundImage, drawImageWithLayout, drawIncrementalAreaSegments, drawIncrementalSegments, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findConfigIndexByCursorIdx, findCursorIdxByConfigIndex, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepClosedSegments, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getBackgroundImage, getConicGradientAt, getCurrentEnv, getDefaultCharacterConfig, getExtraModelMatrix, getLegacyBindingContext, getModelMatrix, getRichTextBounds, getRuntimeInstallerBindingContext, getRuntimeInstallerGlobal, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, identityMat4, imageModule, incrementalAddTo, installRuntimeDrawContributionsToApp, installRuntimeGraphicRenderersToApp, installRuntimePickersToApp, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, interpolatePureColorArrayToStr, intersect, isBrowserEnv, isNoRepeatSizingMode, isNodeEnv, isSvg, isXML, layerService, lineModule, lookAt, mapToCanvasPointForCanvas, mat3Tomat4, mat4Allocate, matrixAllocate, multiplyMat4Mat3, multiplyMat4Mat4, newThemeObj, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, quadCalc, quadLength, quadPointAt, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, refreshRuntimeInstallerContributions, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlobalEventTransformer, registerGlyphGraphic, registerGraphic, registerGroupGraphic, registerHtmlAttributePlugin, registerImageGraphic, registerLineGraphic, registerOrthoCamera, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerStarGraphic, registerSymbolGraphic, registerTextGraphic, registerViewTransform3dPlugin, registerWindowEventTransformer, registerWrapTextGraphic, renderCommandList, resolveBackgroundDrawMode, resolveBackgroundParamsByImageSizing, resolveBackgroundPosition, resolveBackgroundSizing, resolveContainerBinding, resolveImageMode, resolveImageRepeatMode, resolveRenderableImageSize, rewriteProto, richtextModule, rotateX, rotateY, rotateZ, runFill, runStroke, scaleMat4, segments, shouldClipImageByLayout, shouldUseMat4, shouldUseSimpleAttributeFastPath, snapLength, splitArc, splitArea, splitCircle, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, starModule, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformMat4, transformPointForCanvas, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
31799
+ export { ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, AnimateMode, AnimateStatus, AnimateStepType, AppContext, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEntry, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, Circle, CircleRender, CircleRenderContribution, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Context2dFactory, ContributionProvider, ContributionRegistry, ContributionStore, CubicBezierCurve, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DEFAULT_TEXT_FONT_FAMILY, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseClipRenderAfterContribution, DefaultBaseClipRenderBeforeContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStarAttribute, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolClipRangeStrokeRenderContribution, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction, DirectionalLight, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EditModule, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ALL_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, GradientParser, Graphic, GraphicCreator$1 as GraphicCreator, GraphicFactory, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncrementalDrawContribution, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerFactory, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, Mat4Allocate, MatrixAllocate, MeasureModeEnum, MiniappEntry, MonotoneX, MonotoneY, NOWORK_ANIMATE_ATTR, Node, NodeEntry, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PerformanceRAF, PickItemInterceptor, PickServiceInterceptor, PickerRegistry, PickerService, PluginRegistry, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, RendererRegistry, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, STAR_NUMBER_TYPE, STATUS$1 as STATUS, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowPickServiceInterceptorContribution, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StageFactory, Star, StarRender, StarRenderContribution, StateDefinitionCompiler, StateEngine, StaticLayerHandlerContribution, Step, StepClosed, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TransformUtil, UpdateTag, VGlobal, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _calculateLineHeight, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindArc3dRenderModule, bindArcRenderModule, bindAreaRenderModule, bindCircleRenderModule, bindContributionProvider, bindContributionProviderNoSingletonScope, bindGlyphRenderModule, bindImageRenderModule, bindLineRenderModule, bindPathRenderModule, bindPolygonRenderModule, bindPyramid3dRenderModule, bindRect3dRenderModule, bindRectRenderModule, bindRichtextRenderModule, bindStarRenderModule, bindSymbolRenderModule, bindTextRenderModule, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, colorEqual, colorStringInterpolationToStr, configureRuntimeApplicationForApp, container, cornerTangents, createBrowserApp as createApp, createArc, createArc3d, createArea, createBrowserApp, createCanvasEventTransformer, createCircle, createColor, createConicalGradient, createContributionProvider, createEventTransformer, createGlyph, createGraphic, createGroup, createImage, createLine, createMat4, createMiniappApp, createNodeApp, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createStar, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseClipRenderAfterContribution, defaultBaseClipRenderBeforeContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolClipRangeStrokeRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, diff, divideCubic, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawBackgroundImage, drawImageWithLayout, drawIncrementalAreaSegments, drawIncrementalSegments, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findConfigIndexByCursorIdx, findCursorIdxByConfigIndex, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepClosedSegments, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getBackgroundImage, getConicGradientAt, getCurrentEnv, getDefaultCharacterConfig, getExtraModelMatrix, getLegacyBindingContext, getModelMatrix, getRichTextBounds, getRuntimeInstallerBindingContext, getRuntimeInstallerGlobal, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, identityMat4, imageModule, incrementalAddTo, installRuntimeDrawContributionsToApp, installRuntimeGraphicRenderersToApp, installRuntimePickersToApp, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, interpolatePureColorArrayToStr, intersect, isBrowserEnv, isNoRepeatSizingMode, isNodeEnv, isSvg, isXML, layerService, lineModule, lookAt, mapToCanvasPointForCanvas, mat3Tomat4, mat4Allocate, matrixAllocate, multiplyMat4Mat3, multiplyMat4Mat4, newThemeObj, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, quadCalc, quadLength, quadPointAt, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, refreshRuntimeInstallerContributions, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlobalEventTransformer, registerGlyphGraphic, registerGraphic, registerGroupGraphic, registerHtmlAttributePlugin, registerImageGraphic, registerLineGraphic, registerOrthoCamera, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerStarGraphic, registerSymbolGraphic, registerTextGraphic, registerViewTransform3dPlugin, registerWindowEventTransformer, registerWrapTextGraphic, renderCommandList, resolveBackgroundDrawMode, resolveBackgroundParamsByImageSizing, resolveBackgroundPosition, resolveBackgroundSizing, resolveContainerBinding, resolveImageMode, resolveImageRepeatMode, resolveRenderableImageSize, rewriteProto, richtextModule, rotateX, rotateY, rotateZ, runFill, runStroke, scaleMat4, segments, shouldClipImageByLayout, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, starModule, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformMat4, transformPointForCanvas, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };