@visactor/vrender-core 1.1.0-alpha.24 → 1.1.0-alpha.25

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 (322) hide show
  1. package/cjs/allocator/bounds-allocate.js +1 -2
  2. package/cjs/canvas/constants.js +2 -1
  3. package/cjs/common/bezier-utils.js +1 -2
  4. package/cjs/common/event-transformer.js +2 -1
  5. package/cjs/common/performance-raf.js +1 -2
  6. package/cjs/common/polygon.js +2 -2
  7. package/cjs/common/rect-utils.js +1 -1
  8. package/cjs/common/render-area.js +1 -1
  9. package/cjs/common/render-command-list.js +1 -1
  10. package/cjs/common/render-curve.js +1 -1
  11. package/cjs/common/render-utils.js +1 -1
  12. package/cjs/common/seg-context.js +1 -1
  13. package/cjs/container.d.ts +2 -0
  14. package/cjs/container.js +50 -0
  15. package/cjs/container.js.map +1 -0
  16. package/cjs/core/application.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 +0 -9
  28. package/cjs/core/stage.js +12 -30
  29. package/cjs/core/stage.js.map +1 -1
  30. package/cjs/core/window.js +1 -1
  31. package/cjs/entries/miniapp.d.ts +0 -1
  32. package/cjs/entries/miniapp.js +1 -5
  33. package/cjs/entries/miniapp.js.map +1 -1
  34. package/cjs/entries/node.d.ts +0 -1
  35. package/cjs/entries/node.js +1 -5
  36. package/cjs/entries/node.js.map +1 -1
  37. package/cjs/env.d.ts +1 -0
  38. package/cjs/env.js +25 -0
  39. package/cjs/env.js.map +1 -0
  40. package/cjs/event/public-constant.d.ts +7 -0
  41. package/cjs/event/public-constant.js +100 -0
  42. package/cjs/event/public-constant.js.map +1 -0
  43. package/cjs/event/util.d.ts +1 -1
  44. package/cjs/graphic/base.d.ts +2 -0
  45. package/cjs/graphic/base.js +15 -0
  46. package/cjs/graphic/base.js.map +1 -0
  47. package/cjs/graphic/creator.d.ts +16 -0
  48. package/cjs/graphic/creator.js +160 -0
  49. package/cjs/graphic/creator.js.map +1 -0
  50. package/cjs/graphic/glyph.js +4 -8
  51. package/cjs/graphic/glyph.js.map +1 -1
  52. package/cjs/graphic/graphic.d.ts +19 -29
  53. package/cjs/graphic/graphic.js +121 -199
  54. package/cjs/graphic/graphic.js.map +1 -1
  55. package/cjs/graphic/group.d.ts +1 -3
  56. package/cjs/graphic/group.js +22 -28
  57. package/cjs/graphic/group.js.map +1 -1
  58. package/cjs/graphic/modules.d.ts +16 -0
  59. package/cjs/graphic/modules.js +150 -0
  60. package/cjs/graphic/modules.js.map +1 -0
  61. package/cjs/graphic/node-tree.d.ts +3 -3
  62. package/cjs/graphic/node-tree.js +1 -0
  63. package/cjs/graphic/node-tree.js.map +1 -1
  64. package/cjs/graphic/state/shared-state-refresh.js +11 -32
  65. package/cjs/graphic/state/shared-state-refresh.js.map +1 -1
  66. package/cjs/graphic/state/shared-state-scope.d.ts +2 -5
  67. package/cjs/graphic/state/shared-state-scope.js +8 -27
  68. package/cjs/graphic/state/shared-state-scope.js.map +1 -1
  69. package/cjs/graphic/state/state-definition-compiler.js +4 -5
  70. package/cjs/graphic/state/state-definition-compiler.js.map +1 -1
  71. package/cjs/graphic/state/state-definition.d.ts +2 -5
  72. package/cjs/graphic/state/state-definition.js.map +1 -1
  73. package/cjs/graphic/state/state-engine.d.ts +0 -5
  74. package/cjs/graphic/state/state-engine.js +20 -70
  75. package/cjs/graphic/state/state-engine.js.map +1 -1
  76. package/cjs/graphic/state/state-transition-orchestrator.d.ts +7 -9
  77. package/cjs/graphic/state/state-transition-orchestrator.js +10 -13
  78. package/cjs/graphic/state/state-transition-orchestrator.js.map +1 -1
  79. package/cjs/interface/graphic/group.d.ts +0 -2
  80. package/cjs/interface/graphic/group.js.map +1 -1
  81. package/cjs/interface/graphic.d.ts +1 -5
  82. package/cjs/interface/graphic.js.map +1 -1
  83. package/cjs/interface/index.js.map +1 -1
  84. package/cjs/interface/node-tree.d.ts +3 -0
  85. package/cjs/interface/node-tree.js.map +1 -1
  86. package/cjs/interface/stage.d.ts +0 -7
  87. package/cjs/interface/stage.js.map +1 -1
  88. package/cjs/interpolate.d.ts +2 -0
  89. package/cjs/interpolate.js +34 -0
  90. package/cjs/interpolate.js.map +1 -0
  91. package/cjs/modules.js.map +1 -1
  92. package/cjs/path.d.ts +4 -0
  93. package/cjs/path.js +33 -0
  94. package/cjs/path.js.map +1 -0
  95. package/cjs/plugin/3d.d.ts +3 -0
  96. package/cjs/plugin/3d.js +33 -0
  97. package/cjs/plugin/3d.js.map +1 -0
  98. package/cjs/plugin/attribute.d.ts +2 -0
  99. package/cjs/plugin/attribute.js +24 -0
  100. package/cjs/plugin/attribute.js.map +1 -0
  101. package/cjs/plugin/flex-layout.d.ts +1 -0
  102. package/cjs/plugin/flex-layout.js +15 -0
  103. package/cjs/plugin/flex-layout.js.map +1 -0
  104. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +8 -8
  105. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  106. package/cjs/plugins/index.d.ts +0 -4
  107. package/cjs/plugins/index.js +1 -3
  108. package/cjs/plugins/index.js.map +1 -1
  109. package/cjs/plugins/plugin-service.d.ts +0 -1
  110. package/cjs/plugins/plugin-service.js +2 -3
  111. package/cjs/plugins/plugin-service.js.map +1 -1
  112. package/cjs/plugins/types.d.ts +1 -8
  113. package/cjs/plugins/types.js.map +1 -1
  114. package/cjs/register/graphic.d.ts +19 -0
  115. package/cjs/register/graphic.js +177 -0
  116. package/cjs/register/graphic.js.map +1 -0
  117. package/cjs/registry/contribution-registry.d.ts +0 -1
  118. package/cjs/registry/contribution-registry.js +0 -3
  119. package/cjs/registry/contribution-registry.js.map +1 -1
  120. package/cjs/registry/picker-registry.d.ts +0 -1
  121. package/cjs/registry/picker-registry.js +0 -3
  122. package/cjs/registry/picker-registry.js.map +1 -1
  123. package/cjs/registry/renderer-registry.d.ts +0 -1
  124. package/cjs/registry/renderer-registry.js +0 -3
  125. package/cjs/registry/renderer-registry.js.map +1 -1
  126. package/cjs/registry/types.d.ts +0 -3
  127. package/cjs/registry/types.js.map +1 -1
  128. package/cjs/svg.d.ts +1 -0
  129. package/cjs/svg.js +15 -0
  130. package/cjs/svg.js.map +1 -0
  131. package/cjs/text.d.ts +2 -0
  132. package/cjs/text.js +29 -0
  133. package/cjs/text.js.map +1 -0
  134. package/dist/index.es.js +279 -1591
  135. package/es/allocator/bounds-allocate.js +1 -2
  136. package/es/canvas/constants.js +2 -1
  137. package/es/common/bezier-utils.js +1 -2
  138. package/es/common/event-transformer.js +2 -1
  139. package/es/common/performance-raf.js +1 -2
  140. package/es/common/polygon.js +1 -1
  141. package/es/common/rect-utils.js +1 -1
  142. package/es/common/render-area.js +1 -1
  143. package/es/common/render-command-list.js +1 -1
  144. package/es/common/render-curve.js +1 -1
  145. package/es/common/render-utils.js +1 -1
  146. package/es/common/seg-context.js +1 -1
  147. package/es/container.d.ts +2 -0
  148. package/es/container.js +2 -0
  149. package/es/container.js.map +1 -0
  150. package/es/core/application.js +1 -1
  151. package/es/core/camera.js +1 -1
  152. package/es/core/constants.js +1 -1
  153. package/es/core/core-modules.js +1 -1
  154. package/es/core/global-module.js +2 -0
  155. package/es/core/global.js +1 -1
  156. package/es/core/graphic-utils.js +1 -1
  157. package/es/core/index.js +1 -1
  158. package/es/core/layer-service.js +2 -1
  159. package/es/core/layer.js +1 -1
  160. package/es/core/light.js +1 -1
  161. package/es/core/stage.d.ts +0 -9
  162. package/es/core/stage.js +10 -31
  163. package/es/core/stage.js.map +1 -1
  164. package/es/core/window.js +1 -1
  165. package/es/entries/miniapp.d.ts +0 -1
  166. package/es/entries/miniapp.js +1 -5
  167. package/es/entries/miniapp.js.map +1 -1
  168. package/es/entries/node.d.ts +0 -1
  169. package/es/entries/node.js +1 -5
  170. package/es/entries/node.js.map +1 -1
  171. package/es/env.d.ts +1 -0
  172. package/es/env.js +2 -0
  173. package/es/env.js.map +1 -0
  174. package/es/event/public-constant.d.ts +7 -0
  175. package/es/event/public-constant.js +12 -0
  176. package/es/event/public-constant.js.map +1 -0
  177. package/es/event/util.d.ts +1 -1
  178. package/es/graphic/base.d.ts +2 -0
  179. package/es/graphic/base.js +2 -0
  180. package/es/graphic/base.js.map +1 -0
  181. package/es/graphic/creator.d.ts +16 -0
  182. package/es/graphic/creator.js +32 -0
  183. package/es/graphic/creator.js.map +1 -0
  184. package/es/graphic/glyph.js +4 -8
  185. package/es/graphic/glyph.js.map +1 -1
  186. package/es/graphic/graphic.d.ts +19 -29
  187. package/es/graphic/graphic.js +120 -204
  188. package/es/graphic/graphic.js.map +1 -1
  189. package/es/graphic/group.d.ts +1 -3
  190. package/es/graphic/group.js +22 -28
  191. package/es/graphic/group.js.map +1 -1
  192. package/es/graphic/modules.d.ts +16 -0
  193. package/es/graphic/modules.js +32 -0
  194. package/es/graphic/modules.js.map +1 -0
  195. package/es/graphic/node-tree.d.ts +3 -3
  196. package/es/graphic/node-tree.js +1 -0
  197. package/es/graphic/node-tree.js.map +1 -1
  198. package/es/graphic/state/shared-state-refresh.js +8 -28
  199. package/es/graphic/state/shared-state-refresh.js.map +1 -1
  200. package/es/graphic/state/shared-state-scope.d.ts +2 -5
  201. package/es/graphic/state/shared-state-scope.js +7 -28
  202. package/es/graphic/state/shared-state-scope.js.map +1 -1
  203. package/es/graphic/state/state-definition-compiler.js +4 -5
  204. package/es/graphic/state/state-definition-compiler.js.map +1 -1
  205. package/es/graphic/state/state-definition.d.ts +2 -5
  206. package/es/graphic/state/state-definition.js.map +1 -1
  207. package/es/graphic/state/state-engine.d.ts +0 -5
  208. package/es/graphic/state/state-engine.js +17 -67
  209. package/es/graphic/state/state-engine.js.map +1 -1
  210. package/es/graphic/state/state-transition-orchestrator.d.ts +7 -9
  211. package/es/graphic/state/state-transition-orchestrator.js +10 -13
  212. package/es/graphic/state/state-transition-orchestrator.js.map +1 -1
  213. package/es/interface/graphic/group.d.ts +0 -2
  214. package/es/interface/graphic/group.js.map +1 -1
  215. package/es/interface/graphic.d.ts +1 -5
  216. package/es/interface/graphic.js.map +1 -1
  217. package/es/interface/index.js.map +1 -1
  218. package/es/interface/node-tree.d.ts +3 -0
  219. package/es/interface/node-tree.js.map +1 -1
  220. package/es/interface/stage.d.ts +0 -7
  221. package/es/interface/stage.js.map +1 -1
  222. package/es/interpolate.d.ts +2 -0
  223. package/es/interpolate.js +4 -0
  224. package/es/interpolate.js.map +1 -0
  225. package/es/modules.js.map +1 -1
  226. package/es/path.d.ts +4 -0
  227. package/es/path.js +6 -0
  228. package/es/path.js.map +1 -0
  229. package/es/plugin/3d.d.ts +3 -0
  230. package/es/plugin/3d.js +6 -0
  231. package/es/plugin/3d.js.map +1 -0
  232. package/es/plugin/attribute.d.ts +2 -0
  233. package/es/plugin/attribute.js +4 -0
  234. package/es/plugin/attribute.js.map +1 -0
  235. package/es/plugin/flex-layout.d.ts +1 -0
  236. package/es/plugin/flex-layout.js +2 -0
  237. package/es/plugin/flex-layout.js.map +1 -0
  238. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +8 -8
  239. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  240. package/es/plugins/index.d.ts +0 -4
  241. package/es/plugins/index.js +0 -8
  242. package/es/plugins/index.js.map +1 -1
  243. package/es/plugins/plugin-service.d.ts +0 -1
  244. package/es/plugins/plugin-service.js +2 -3
  245. package/es/plugins/plugin-service.js.map +1 -1
  246. package/es/plugins/types.d.ts +1 -8
  247. package/es/plugins/types.js.map +1 -1
  248. package/es/register/graphic.d.ts +19 -0
  249. package/es/register/graphic.js +38 -0
  250. package/es/register/graphic.js.map +1 -0
  251. package/es/registry/contribution-registry.d.ts +0 -1
  252. package/es/registry/contribution-registry.js +0 -3
  253. package/es/registry/contribution-registry.js.map +1 -1
  254. package/es/registry/picker-registry.d.ts +0 -1
  255. package/es/registry/picker-registry.js +0 -3
  256. package/es/registry/picker-registry.js.map +1 -1
  257. package/es/registry/renderer-registry.d.ts +0 -1
  258. package/es/registry/renderer-registry.js +0 -3
  259. package/es/registry/renderer-registry.js.map +1 -1
  260. package/es/registry/types.d.ts +0 -3
  261. package/es/registry/types.js.map +1 -1
  262. package/es/svg.d.ts +1 -0
  263. package/es/svg.js +2 -0
  264. package/es/svg.js.map +1 -0
  265. package/es/text.d.ts +2 -0
  266. package/es/text.js +4 -0
  267. package/es/text.js.map +1 -0
  268. package/package.json +247 -3
  269. package/cjs/graphic/state/state-batch-scheduler.d.ts +0 -42
  270. package/cjs/graphic/state/state-batch-scheduler.js +0 -285
  271. package/cjs/graphic/state/state-batch-scheduler.js.map +0 -1
  272. package/cjs/graphic/state/state-model.d.ts +0 -43
  273. package/cjs/graphic/state/state-model.js +0 -143
  274. package/cjs/graphic/state/state-model.js.map +0 -1
  275. package/cjs/graphic/state/state-perf-monitor.d.ts +0 -120
  276. package/cjs/graphic/state/state-perf-monitor.js +0 -224
  277. package/cjs/graphic/state/state-perf-monitor.js.map +0 -1
  278. package/cjs/graphic/state/state-style-resolver.d.ts +0 -13
  279. package/cjs/graphic/state/state-style-resolver.js +0 -50
  280. package/cjs/graphic/state/state-style-resolver.js.map +0 -1
  281. package/cjs/interface/animate.d.ts +0 -1
  282. package/cjs/interface/animate.js +0 -3
  283. package/cjs/interface/animate.js.map +0 -1
  284. package/cjs/plugins/base-plugin.d.ts +0 -8
  285. package/cjs/plugins/base-plugin.js +0 -15
  286. package/cjs/plugins/base-plugin.js.map +0 -1
  287. package/cjs/plugins/browser-env-plugin.d.ts +0 -8
  288. package/cjs/plugins/browser-env-plugin.js +0 -24
  289. package/cjs/plugins/browser-env-plugin.js.map +0 -1
  290. package/cjs/plugins/picker-plugin.d.ts +0 -7
  291. package/cjs/plugins/picker-plugin.js +0 -19
  292. package/cjs/plugins/picker-plugin.js.map +0 -1
  293. package/cjs/plugins/renderer-plugin.d.ts +0 -7
  294. package/cjs/plugins/renderer-plugin.js +0 -19
  295. package/cjs/plugins/renderer-plugin.js.map +0 -1
  296. package/es/graphic/state/state-batch-scheduler.d.ts +0 -42
  297. package/es/graphic/state/state-batch-scheduler.js +0 -278
  298. package/es/graphic/state/state-batch-scheduler.js.map +0 -1
  299. package/es/graphic/state/state-model.d.ts +0 -43
  300. package/es/graphic/state/state-model.js +0 -135
  301. package/es/graphic/state/state-model.js.map +0 -1
  302. package/es/graphic/state/state-perf-monitor.d.ts +0 -120
  303. package/es/graphic/state/state-perf-monitor.js +0 -214
  304. package/es/graphic/state/state-perf-monitor.js.map +0 -1
  305. package/es/graphic/state/state-style-resolver.d.ts +0 -13
  306. package/es/graphic/state/state-style-resolver.js +0 -42
  307. package/es/graphic/state/state-style-resolver.js.map +0 -1
  308. package/es/interface/animate.d.ts +0 -1
  309. package/es/interface/animate.js +0 -3
  310. package/es/interface/animate.js.map +0 -1
  311. package/es/plugins/base-plugin.d.ts +0 -8
  312. package/es/plugins/base-plugin.js +0 -7
  313. package/es/plugins/base-plugin.js.map +0 -1
  314. package/es/plugins/browser-env-plugin.d.ts +0 -8
  315. package/es/plugins/browser-env-plugin.js +0 -16
  316. package/es/plugins/browser-env-plugin.js.map +0 -1
  317. package/es/plugins/picker-plugin.d.ts +0 -7
  318. package/es/plugins/picker-plugin.js +0 -11
  319. package/es/plugins/picker-plugin.js.map +0 -1
  320. package/es/plugins/renderer-plugin.d.ts +0 -7
  321. package/es/plugins/renderer-plugin.js +0 -11
  322. package/es/plugins/renderer-plugin.js.map +0 -1
package/dist/index.es.js CHANGED
@@ -698,6 +698,9 @@ class Node extends EventEmitter {
698
698
  this.parent = null;
699
699
  this._count = 1;
700
700
  }
701
+ onParentSharedStateTreeChanged(_stage, _layer) {
702
+ return;
703
+ }
701
704
  forEachChildren(cb, reverse = false) {
702
705
  if (reverse) {
703
706
  let child = this._lastChild;
@@ -9024,7 +9027,7 @@ function createConicalGradient(context, stops, x, y, deltaAngle, startAngle, end
9024
9027
  return pattern;
9025
9028
  }
9026
9029
 
9027
- const FULL_DEFINITION_KEYS$1 = new Set([
9030
+ const FULL_DEFINITION_KEYS = new Set([
9028
9031
  'name',
9029
9032
  'patch',
9030
9033
  'priority',
@@ -9033,7 +9036,7 @@ const FULL_DEFINITION_KEYS$1 = new Set([
9033
9036
  'resolver',
9034
9037
  'declaredAffectedKeys'
9035
9038
  ]);
9036
- function isPlainObject$2(value) {
9039
+ function isPlainObject$1(value) {
9037
9040
  return value != null && typeof value === 'object' && !Array.isArray(value);
9038
9041
  }
9039
9042
  function normalizePatch(value) {
@@ -9095,14 +9098,13 @@ class StateDefinitionCompiler {
9095
9098
  patch: undefined
9096
9099
  };
9097
9100
  }
9098
- const keys = isPlainObject$2(value) ? Object.keys(value) : [];
9099
- const hasFullKey = keys.some(key => FULL_DEFINITION_KEYS$1.has(key));
9101
+ const keys = isPlainObject$1(value) ? Object.keys(value) : [];
9102
+ const hasFullKey = keys.some(key => FULL_DEFINITION_KEYS.has(key));
9100
9103
  if (hasFullKey) {
9101
9104
  const definition = value;
9102
9105
  return {
9103
9106
  name: (_a = definition.name) !== null && _a !== void 0 ? _a : name,
9104
9107
  priority: (_b = definition.priority) !== null && _b !== void 0 ? _b : 0,
9105
- rank: definition.rank,
9106
9108
  patch: normalizePatch(definition.patch),
9107
9109
  resolver: definition.resolver,
9108
9110
  declaredAffectedKeys: definition.declaredAffectedKeys,
@@ -9123,425 +9125,54 @@ class StateDefinitionCompiler {
9123
9125
  });
9124
9126
  compiled.forEach((definition, origin) => {
9125
9127
  const closure = new Set();
9126
- const walk = (stateName, stack) => {
9128
+ const walk = (stateName, visiting) => {
9127
9129
  const nextStates = rawRelationMap.get(stateName);
9128
9130
  if (!nextStates || !nextStates.size) {
9129
9131
  return;
9130
9132
  }
9131
9133
  nextStates.forEach(nextState => {
9132
- if (nextState === origin) {
9133
- console.warn(`[StateDefinitionCompiler] circular ${relation} relation detected: ${stack.join(' -> ')} -> ${origin}`);
9134
- return;
9135
- }
9136
- if (stack.includes(nextState)) {
9137
- console.warn(`[StateDefinitionCompiler] circular ${relation} relation detected: ${stack.join(' -> ')} -> ${nextState}`);
9138
- return;
9139
- }
9140
- if (closure.has(nextState)) {
9134
+ if (nextState === origin || visiting.has(nextState) || closure.has(nextState)) {
9141
9135
  return;
9142
9136
  }
9143
9137
  closure.add(nextState);
9144
- walk(nextState, stack.concat(nextState));
9138
+ visiting.add(nextState);
9139
+ walk(nextState, visiting);
9140
+ visiting.delete(nextState);
9145
9141
  });
9146
9142
  };
9147
- walk(origin, [origin]);
9143
+ walk(origin, new Set([origin]));
9148
9144
  definition[relation] = closure;
9149
9145
  });
9150
9146
  }
9151
9147
  }
9152
9148
 
9153
- var UpdateCategory;
9154
- (function (UpdateCategory) {
9155
- UpdateCategory[UpdateCategory["NONE"] = 0] = "NONE";
9156
- UpdateCategory[UpdateCategory["PAINT"] = 1] = "PAINT";
9157
- UpdateCategory[UpdateCategory["SHAPE"] = 2] = "SHAPE";
9158
- UpdateCategory[UpdateCategory["BOUNDS"] = 4] = "BOUNDS";
9159
- UpdateCategory[UpdateCategory["TRANSFORM"] = 8] = "TRANSFORM";
9160
- UpdateCategory[UpdateCategory["LAYOUT"] = 16] = "LAYOUT";
9161
- UpdateCategory[UpdateCategory["PICK"] = 32] = "PICK";
9162
- })(UpdateCategory || (UpdateCategory = {}));
9163
- const ATTRIBUTE_CATEGORY = {
9164
- fill: UpdateCategory.PAINT,
9165
- opacity: UpdateCategory.PAINT,
9166
- fillOpacity: UpdateCategory.PAINT,
9167
- strokeOpacity: UpdateCategory.PAINT,
9168
- lineDash: UpdateCategory.PAINT,
9169
- lineDashOffset: UpdateCategory.PAINT,
9170
- lineCap: UpdateCategory.PAINT,
9171
- lineJoin: UpdateCategory.PAINT,
9172
- miterLimit: UpdateCategory.PAINT,
9173
- shadowColor: UpdateCategory.PAINT,
9174
- x: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9175
- y: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9176
- scaleX: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9177
- scaleY: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9178
- angle: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9179
- anchor: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9180
- anchor3d: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9181
- postMatrix: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9182
- layout: UpdateCategory.LAYOUT,
9183
- zIndex: UpdateCategory.PAINT,
9184
- visible: UpdateCategory.PAINT | UpdateCategory.PICK,
9185
- lineWidth: UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.PICK,
9186
- width: UpdateCategory.SHAPE | UpdateCategory.BOUNDS,
9187
- height: UpdateCategory.SHAPE | UpdateCategory.BOUNDS
9188
- };
9189
- const ATTRIBUTE_DELTA_CLASSIFIER = {
9190
- stroke: (prev, next) => {
9191
- const prevEnabled = prev != null && prev !== false;
9192
- const nextEnabled = next != null && next !== false;
9193
- if (prevEnabled !== nextEnabled) {
9194
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK;
9195
- }
9196
- return UpdateCategory.PAINT;
9197
- },
9198
- shadowBlur: (prev, next) => {
9199
- const prevBlur = Number(prev !== null && prev !== void 0 ? prev : 0);
9200
- const nextBlur = Number(next !== null && next !== void 0 ? next : 0);
9201
- if (prevBlur !== nextBlur && (prevBlur > 0 || nextBlur > 0)) {
9202
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS;
9203
- }
9204
- return UpdateCategory.PAINT;
9205
- }
9206
- };
9207
- function classifyAttributeDelta(key, prev, next) {
9208
- var _a;
9209
- const dynamicClassifier = ATTRIBUTE_DELTA_CLASSIFIER[key];
9210
- if (dynamicClassifier) {
9211
- return dynamicClassifier(prev, next);
9212
- }
9213
- return (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
9214
- }
9215
- function classifyAffectedKeyConservatively(key) {
9216
- var _a;
9217
- if (key === 'stroke') {
9218
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK;
9219
- }
9220
- if (key === 'shadowBlur') {
9221
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS;
9222
- }
9223
- return (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
9224
- }
9225
- function classifyAffectedKeys(keys) {
9226
- let category = UpdateCategory.NONE;
9227
- for (const key of keys) {
9228
- category |= classifyAffectedKeyConservatively(key);
9229
- }
9230
- return category;
9231
- }
9232
-
9233
- const DEFAULT_MAX_EVENT_RECORDS = 100;
9234
- const STAGE_PERF_MONITOR = Symbol('vrender.statePerfMonitor');
9235
- function createReasonBreakdown() {
9236
- return {
9237
- config_disabled: 0,
9238
- context_disabled: 0,
9239
- non_batch_operation: 0,
9240
- mixed_update_category: 0,
9241
- resolver_unstable_keys: 0,
9242
- graphic_unavailable: 0
9243
- };
9244
- }
9245
- function createEmptyStatePerfSnapshot() {
9246
- return {
9247
- counters: {
9248
- stateCommits: 0,
9249
- sharedRefreshCommits: 0,
9250
- deferredJobsCreated: 0,
9251
- deferredJobsCompleted: 0,
9252
- deferredJobsCancelled: 0,
9253
- deferredJobsCoalesced: 0,
9254
- deferredGraphicsCommitted: 0,
9255
- deferredBudgetYields: 0,
9256
- deferredIneligibleGraphics: 0
9257
- },
9258
- deferredIneligibleByReason: createReasonBreakdown(),
9259
- categoryBreakdown: {
9260
- paint: 0,
9261
- transform: 0,
9262
- shape: 0,
9263
- bounds: 0,
9264
- layout: 0,
9265
- pick: 0
9266
- },
9267
- refresh: {
9268
- queuedGraphics: 0,
9269
- flushedGraphics: 0,
9270
- ensureFreshCalls: 0,
9271
- renderScheduled: 0
9272
- },
9273
- resolver: {
9274
- cacheHits: 0,
9275
- cacheMisses: 0,
9276
- invalidations: 0
9277
- },
9278
- cost: {
9279
- resolverTotalMs: 0,
9280
- resolverMaxMs: 0,
9281
- patchTotalMs: 0,
9282
- patchMaxMs: 0,
9283
- sharedRefreshTotalMs: 0,
9284
- sharedRefreshMaxMs: 0,
9285
- batchSliceTotalMs: 0,
9286
- batchSliceMaxMs: 0
9287
- },
9288
- allocationHints: {
9289
- patchObjectsCreated: 0,
9290
- batchEntriesCreated: 0,
9291
- refreshQueuePushes: 0
9292
- },
9293
- batch: {
9294
- pendingJobs: 0,
9295
- maxPendingJobs: 0,
9296
- maxGraphicsInJob: 0,
9297
- maxFrameSliceCost: 0
9298
- },
9299
- events: []
9300
- };
9301
- }
9302
- function cloneSnapshot(snapshot) {
9303
- return {
9304
- counters: Object.assign({}, snapshot.counters),
9305
- deferredIneligibleByReason: Object.assign({}, snapshot.deferredIneligibleByReason),
9306
- categoryBreakdown: Object.assign({}, snapshot.categoryBreakdown),
9307
- refresh: Object.assign({}, snapshot.refresh),
9308
- resolver: Object.assign({}, snapshot.resolver),
9309
- cost: Object.assign({}, snapshot.cost),
9310
- allocationHints: Object.assign({}, snapshot.allocationHints),
9311
- batch: Object.assign({}, snapshot.batch),
9312
- events: snapshot.events ? snapshot.events.slice() : []
9313
- };
9314
- }
9315
- function isDeferredStateContextConfig(value) {
9316
- return (!!value &&
9317
- (Object.prototype.hasOwnProperty.call(value, 'deferred') ||
9318
- Object.prototype.hasOwnProperty.call(value, 'localEnabled')));
9319
- }
9320
- function normalizeDeferredStateOwnerConfig(value) {
9321
- if (!value) {
9322
- return undefined;
9323
- }
9324
- if (isDeferredStateContextConfig(value)) {
9325
- return value;
9326
- }
9327
- return {
9328
- deferred: value
9329
- };
9330
- }
9331
- function normalizeDeferredStateConfig(config) {
9332
- var _a, _b, _c;
9333
- return {
9334
- enabled: (_a = config === null || config === void 0 ? void 0 : config.enabled) !== null && _a !== void 0 ? _a : false,
9335
- frameBudget: (_b = config === null || config === void 0 ? void 0 : config.frameBudget) !== null && _b !== void 0 ? _b : 8,
9336
- maxGraphicsPerFrame: (_c = config === null || config === void 0 ? void 0 : config.maxGraphicsPerFrame) !== null && _c !== void 0 ? _c : 100
9337
- };
9338
- }
9339
- function fingerprintDeferredStateConfig(config) {
9340
- return `${config.enabled ? 1 : 0}:${config.frameBudget}:${config.maxGraphicsPerFrame}`;
9341
- }
9342
- class StatePerfMonitor {
9343
- constructor(configSource) {
9344
- this.configSource = configSource;
9345
- this.snapshot = createEmptyStatePerfSnapshot();
9346
- }
9347
- setConfig(config) {
9348
- this.configSource = config;
9349
- }
9350
- getSnapshot() {
9351
- return cloneSnapshot(this.snapshot);
9352
- }
9353
- reset() {
9354
- const next = createEmptyStatePerfSnapshot();
9355
- Object.assign(this.snapshot.counters, next.counters);
9356
- Object.assign(this.snapshot.deferredIneligibleByReason, next.deferredIneligibleByReason);
9357
- Object.assign(this.snapshot.categoryBreakdown, next.categoryBreakdown);
9358
- Object.assign(this.snapshot.refresh, next.refresh);
9359
- Object.assign(this.snapshot.resolver, next.resolver);
9360
- Object.assign(this.snapshot.cost, next.cost);
9361
- Object.assign(this.snapshot.allocationHints, next.allocationHints);
9362
- Object.assign(this.snapshot.batch, next.batch);
9363
- this.snapshot.events = [];
9364
- }
9365
- incrementCounter(key, delta = 1) {
9366
- if (!this.isEnabled()) {
9367
- return;
9368
- }
9369
- this.snapshot.counters[key] += delta;
9370
- }
9371
- recordDeferredIneligible(reason, delta = 1) {
9372
- if (!this.isEnabled()) {
9373
- return;
9374
- }
9375
- this.snapshot.deferredIneligibleByReason[reason] += delta;
9376
- this.snapshot.counters.deferredIneligibleGraphics += delta;
9377
- this.recordEvent('deferred-ineligible', { reason, count: delta });
9378
- }
9379
- recordCategory(category) {
9380
- if (!this.isEnabled()) {
9381
- return;
9382
- }
9383
- if (category & UpdateCategory.PAINT) {
9384
- this.snapshot.categoryBreakdown.paint += 1;
9385
- }
9386
- if (category & UpdateCategory.TRANSFORM) {
9387
- this.snapshot.categoryBreakdown.transform += 1;
9388
- }
9389
- if (category & UpdateCategory.SHAPE) {
9390
- this.snapshot.categoryBreakdown.shape += 1;
9391
- }
9392
- if (category & UpdateCategory.BOUNDS) {
9393
- this.snapshot.categoryBreakdown.bounds += 1;
9394
- }
9395
- if (category & UpdateCategory.LAYOUT) {
9396
- this.snapshot.categoryBreakdown.layout += 1;
9397
- }
9398
- if (category & UpdateCategory.PICK) {
9399
- this.snapshot.categoryBreakdown.pick += 1;
9400
- }
9401
- }
9402
- recordRefresh(key, delta = 1) {
9403
- if (!this.isEnabled()) {
9404
- return;
9405
- }
9406
- this.snapshot.refresh[key] += delta;
9407
- }
9408
- recordResolver(key, delta = 1) {
9409
- if (!this.isEnabled()) {
9410
- return;
9411
- }
9412
- this.snapshot.resolver[key] += delta;
9413
- }
9414
- recordCost(kind, durationMs) {
9415
- if (!this.isEnabled()) {
9416
- return;
9417
- }
9418
- if (kind === 'resolver') {
9419
- this.snapshot.cost.resolverTotalMs += durationMs;
9420
- this.snapshot.cost.resolverMaxMs = Math.max(this.snapshot.cost.resolverMaxMs, durationMs);
9421
- return;
9422
- }
9423
- if (kind === 'patch') {
9424
- this.snapshot.cost.patchTotalMs += durationMs;
9425
- this.snapshot.cost.patchMaxMs = Math.max(this.snapshot.cost.patchMaxMs, durationMs);
9426
- return;
9427
- }
9428
- if (kind === 'sharedRefresh') {
9429
- this.snapshot.cost.sharedRefreshTotalMs += durationMs;
9430
- this.snapshot.cost.sharedRefreshMaxMs = Math.max(this.snapshot.cost.sharedRefreshMaxMs, durationMs);
9431
- return;
9432
- }
9433
- this.snapshot.cost.batchSliceTotalMs += durationMs;
9434
- this.snapshot.cost.batchSliceMaxMs = Math.max(this.snapshot.cost.batchSliceMaxMs, durationMs);
9435
- this.snapshot.batch.maxFrameSliceCost = Math.max(this.snapshot.batch.maxFrameSliceCost, durationMs);
9436
- }
9437
- recordAllocation(key, delta = 1) {
9438
- if (!this.isEnabled()) {
9439
- return;
9440
- }
9441
- this.snapshot.allocationHints[key] += delta;
9442
- }
9443
- updateBatchPending(pendingJobs) {
9444
- if (!this.isEnabled()) {
9445
- return;
9446
- }
9447
- this.snapshot.batch.pendingJobs = pendingJobs;
9448
- this.snapshot.batch.maxPendingJobs = Math.max(this.snapshot.batch.maxPendingJobs, pendingJobs);
9449
- }
9450
- updateMaxGraphicsInJob(count) {
9451
- if (!this.isEnabled()) {
9452
- return;
9453
- }
9454
- this.snapshot.batch.maxGraphicsInJob = Math.max(this.snapshot.batch.maxGraphicsInJob, count);
9455
- }
9456
- recordEvent(type, detail) {
9457
- var _a, _b, _c;
9458
- if (!this.shouldRecordEvents()) {
9459
- return;
9460
- }
9461
- const events = (_a = this.snapshot.events) !== null && _a !== void 0 ? _a : (this.snapshot.events = []);
9462
- events.push({
9463
- type,
9464
- at: Date.now(),
9465
- detail
9466
- });
9467
- const max = (_c = (_b = this.getConfig()) === null || _b === void 0 ? void 0 : _b.maxEventRecords) !== null && _c !== void 0 ? _c : DEFAULT_MAX_EVENT_RECORDS;
9468
- if (events.length > max) {
9469
- events.splice(0, events.length - max);
9470
- }
9471
- }
9472
- isEnabled() {
9473
- var _a;
9474
- return ((_a = this.getConfig()) === null || _a === void 0 ? void 0 : _a.enabled) === true;
9475
- }
9476
- shouldRecordEvents() {
9477
- const config = this.getConfig();
9478
- return !!(config === null || config === void 0 ? void 0 : config.enabled) && !!config.recordEvents;
9479
- }
9480
- getConfig() {
9481
- return typeof this.configSource === 'function' ? this.configSource() : this.configSource;
9482
- }
9483
- }
9484
- function ensureStageStatePerfMonitor(stage) {
9485
- const stageAny = stage;
9486
- if (!stageAny[STAGE_PERF_MONITOR]) {
9487
- stageAny[STAGE_PERF_MONITOR] = new StatePerfMonitor(() => stage.statePerfConfig);
9488
- }
9489
- return stageAny[STAGE_PERF_MONITOR];
9490
- }
9491
- function getStageStatePerfMonitor(stage) {
9492
- if (!stage) {
9493
- return undefined;
9494
- }
9495
- return stage[STAGE_PERF_MONITOR];
9496
- }
9497
- function getActiveStageStatePerfMonitor(stage) {
9498
- var _a;
9499
- if (!stage) {
9500
- return undefined;
9501
- }
9502
- const current = getStageStatePerfMonitor(stage);
9503
- if (current) {
9504
- return current;
9505
- }
9506
- return ((_a = stage.statePerfConfig) === null || _a === void 0 ? void 0 : _a.enabled) === true ? ensureStageStatePerfMonitor(stage) : undefined;
9507
- }
9508
-
9509
- function isPlainObject$1(value) {
9149
+ function isPlainObject(value) {
9510
9150
  return value != null && typeof value === 'object' && !Array.isArray(value);
9511
9151
  }
9512
- function cloneValue$1(value) {
9513
- if (!isPlainObject$1(value)) {
9152
+ function cloneValue(value) {
9153
+ if (!isPlainObject(value)) {
9514
9154
  return value;
9515
9155
  }
9516
9156
  const clone = {};
9517
9157
  Object.keys(value).forEach(key => {
9518
- clone[key] = cloneValue$1(value[key]);
9158
+ clone[key] = cloneValue(value[key]);
9519
9159
  });
9520
9160
  return clone;
9521
9161
  }
9522
- function deepMerge$1(base, value) {
9162
+ function deepMerge(base, value) {
9523
9163
  var _a;
9524
- const result = (_a = cloneValue$1(base)) !== null && _a !== void 0 ? _a : {};
9164
+ const result = (_a = cloneValue(base)) !== null && _a !== void 0 ? _a : {};
9525
9165
  Object.keys(value).forEach(key => {
9526
9166
  const nextValue = value[key];
9527
9167
  const previousValue = result[key];
9528
- if (isPlainObject$1(previousValue) && isPlainObject$1(nextValue)) {
9529
- result[key] = deepMerge$1(previousValue, nextValue);
9168
+ if (isPlainObject(previousValue) && isPlainObject(nextValue)) {
9169
+ result[key] = deepMerge(previousValue, nextValue);
9530
9170
  return;
9531
9171
  }
9532
- result[key] = cloneValue$1(nextValue);
9172
+ result[key] = cloneValue(nextValue);
9533
9173
  });
9534
9174
  return result;
9535
9175
  }
9536
- const FULL_DEFINITION_KEYS = new Set([
9537
- 'name',
9538
- 'patch',
9539
- 'priority',
9540
- 'exclude',
9541
- 'suppress',
9542
- 'resolver',
9543
- 'declaredAffectedKeys'
9544
- ]);
9545
9176
  class StateEngine {
9546
9177
  constructor(options) {
9547
9178
  var _a;
@@ -9555,9 +9186,6 @@ class StateEngine {
9555
9186
  this.baseAttributes = {};
9556
9187
  this.compiledDefinitions = options.compiledDefinitions;
9557
9188
  this.stateSort = options.stateSort;
9558
- this.stateProxy = options.stateProxy;
9559
- this.stateProxyEligibility = options.stateProxyEligibility;
9560
- this.states = options.states;
9561
9189
  this.mergeMode = (_a = options.mergeMode) !== null && _a !== void 0 ? _a : 'shallow';
9562
9190
  }
9563
9191
  get activeStates() {
@@ -9656,11 +9284,9 @@ class StateEngine {
9656
9284
  };
9657
9285
  }
9658
9286
  invalidateResolverCache() {
9659
- var _a, _b;
9660
9287
  this.resolverPatchCache.clear();
9661
9288
  this.resolverCacheKey = '';
9662
9289
  this.resolverCacheValid = false;
9663
- (_b = getActiveStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage)) === null || _b === void 0 ? void 0 : _b.recordResolver('invalidations');
9664
9290
  }
9665
9291
  hasState(stateName) {
9666
9292
  if (!this._activeStates.length) {
@@ -9671,28 +9297,6 @@ class StateEngine {
9671
9297
  }
9672
9298
  return this._activeStates.includes(stateName);
9673
9299
  }
9674
- getCompatPatch(stateName) {
9675
- var _a, _b, _c;
9676
- const targetStates = this._activeStates.length ? this._activeStates : this._effectiveStates;
9677
- const canUseStateProxy = this.canUseStateProxy(stateName);
9678
- const proxyPatch = canUseStateProxy ? (_a = this.stateProxy) === null || _a === void 0 ? void 0 : _a.call(this, stateName, targetStates) : undefined;
9679
- if (this.stateProxy && canUseStateProxy) {
9680
- return proxyPatch !== null && proxyPatch !== void 0 ? proxyPatch : undefined;
9681
- }
9682
- const value = (_b = this.states) === null || _b === void 0 ? void 0 : _b[stateName];
9683
- if (value == null) {
9684
- return undefined;
9685
- }
9686
- if (!isPlainObject$1(value)) {
9687
- return value;
9688
- }
9689
- const keys = Object.keys(value);
9690
- const hasFullKey = keys.some(key => FULL_DEFINITION_KEYS.has(key));
9691
- if (!hasFullKey) {
9692
- return value;
9693
- }
9694
- return cloneValue$1(((_c = value.patch) !== null && _c !== void 0 ? _c : undefined));
9695
- }
9696
9300
  sortStates(states) {
9697
9301
  const withDefinition = [];
9698
9302
  const withoutDefinition = [];
@@ -9749,96 +9353,44 @@ class StateEngine {
9749
9353
  };
9750
9354
  }
9751
9355
  recomputePatch(effectiveStates) {
9752
- var _a;
9753
- const perfMonitor = getActiveStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage);
9754
- const patchStart = perfMonitor ? performance.now() : 0;
9755
- let resolverCost = 0;
9756
9356
  const cacheKey = effectiveStates.join(',');
9757
9357
  const nextPatch = {};
9758
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordAllocation('patchObjectsCreated');
9759
- if (this.resolverCacheValid && this.resolverCacheKey === cacheKey) {
9760
- effectiveStates.forEach(stateName => {
9761
- var _a;
9762
- const canUseStateProxy = this.canUseStateProxy(stateName);
9763
- const proxyPatch = canUseStateProxy ? (_a = this.stateProxy) === null || _a === void 0 ? void 0 : _a.call(this, stateName, effectiveStates) : undefined;
9764
- if (this.stateProxy && canUseStateProxy) {
9765
- if (proxyPatch != null) {
9766
- this.mergeInto(nextPatch, proxyPatch);
9767
- }
9768
- return;
9769
- }
9770
- const definition = this.compiledDefinitions.get(stateName);
9771
- if (!definition) {
9772
- const compatPatch = this.getCompatPatch(stateName);
9773
- if (compatPatch) {
9774
- this.mergeInto(nextPatch, compatPatch);
9775
- }
9776
- return;
9777
- }
9778
- if (definition.patch) {
9779
- this.mergeInto(nextPatch, definition.patch);
9780
- }
9781
- if (definition.hasResolver) {
9782
- const cachedPatch = this.resolverPatchCache.get(stateName);
9783
- if (cachedPatch) {
9784
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordResolver('cacheHits');
9785
- this.mergeInto(nextPatch, cachedPatch);
9786
- }
9787
- }
9788
- });
9789
- }
9790
- else {
9358
+ const useResolverCache = this.resolverCacheValid && this.resolverCacheKey === cacheKey;
9359
+ if (!useResolverCache) {
9791
9360
  this.resolverPatchCache.clear();
9792
9361
  this.resolverCacheKey = cacheKey;
9793
- effectiveStates.forEach(stateName => {
9794
- var _a;
9795
- const canUseStateProxy = this.canUseStateProxy(stateName);
9796
- const proxyPatch = canUseStateProxy ? (_a = this.stateProxy) === null || _a === void 0 ? void 0 : _a.call(this, stateName, effectiveStates) : undefined;
9797
- if (this.stateProxy && canUseStateProxy) {
9798
- if (proxyPatch != null) {
9799
- this.mergeInto(nextPatch, proxyPatch);
9800
- }
9801
- return;
9802
- }
9803
- const definition = this.compiledDefinitions.get(stateName);
9804
- if (!definition) {
9805
- const compatPatch = this.getCompatPatch(stateName);
9806
- if (compatPatch) {
9807
- this.mergeInto(nextPatch, compatPatch);
9808
- }
9809
- return;
9810
- }
9811
- if (definition.patch) {
9812
- this.mergeInto(nextPatch, definition.patch);
9813
- }
9814
- if (definition.hasResolver && definition.resolver) {
9815
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordResolver('cacheMisses');
9816
- const resolverStart = perfMonitor ? performance.now() : 0;
9817
- const resolverPatch = definition.resolver({
9362
+ }
9363
+ effectiveStates.forEach(stateName => {
9364
+ var _a;
9365
+ const definition = this.compiledDefinitions.get(stateName);
9366
+ if (!definition) {
9367
+ return;
9368
+ }
9369
+ if (definition.patch) {
9370
+ this.mergeInto(nextPatch, definition.patch);
9371
+ }
9372
+ if (definition.hasResolver) {
9373
+ const resolverPatch = useResolverCache
9374
+ ? this.resolverPatchCache.get(stateName)
9375
+ : (_a = definition.resolver) === null || _a === void 0 ? void 0 : _a.call(definition, {
9818
9376
  graphic: this.graphic,
9819
9377
  activeStates: this._activeStates,
9820
9378
  effectiveStates: this._effectiveStates,
9821
9379
  baseAttributes: this.baseAttributes,
9822
9380
  resolvedPatch: nextPatch
9823
9381
  });
9824
- if (perfMonitor) {
9825
- const duration = performance.now() - resolverStart;
9826
- resolverCost += duration;
9827
- perfMonitor.recordCost('resolver', duration);
9828
- }
9829
- if (resolverPatch) {
9382
+ if (resolverPatch) {
9383
+ if (!useResolverCache) {
9830
9384
  this.resolverPatchCache.set(stateName, resolverPatch);
9831
- this.mergeInto(nextPatch, resolverPatch);
9832
9385
  }
9386
+ this.mergeInto(nextPatch, resolverPatch);
9833
9387
  }
9834
- });
9388
+ }
9389
+ });
9390
+ if (!useResolverCache) {
9835
9391
  this.resolverCacheValid = true;
9836
9392
  }
9837
9393
  this._resolvedPatch = nextPatch;
9838
- if (perfMonitor) {
9839
- const totalCost = performance.now() - patchStart;
9840
- perfMonitor.recordCost('patch', Math.max(0, totalCost - resolverCost));
9841
- }
9842
9394
  }
9843
9395
  mergeInto(target, patch) {
9844
9396
  if (this.mergeMode === 'deep') {
@@ -9847,20 +9399,20 @@ class StateEngine {
9847
9399
  const nextValue = patch[key];
9848
9400
  const previousValue = target[key];
9849
9401
  const baseValue = (_a = this.baseAttributes) === null || _a === void 0 ? void 0 : _a[key];
9850
- if (isPlainObject$1(previousValue) && isPlainObject$1(nextValue)) {
9851
- target[key] = deepMerge$1(previousValue, nextValue);
9402
+ if (isPlainObject(previousValue) && isPlainObject(nextValue)) {
9403
+ target[key] = deepMerge(previousValue, nextValue);
9852
9404
  return;
9853
9405
  }
9854
- if (!isPlainObject$1(previousValue) && isPlainObject$1(baseValue) && isPlainObject$1(nextValue)) {
9855
- target[key] = deepMerge$1(baseValue, nextValue);
9406
+ if (!isPlainObject(previousValue) && isPlainObject(baseValue) && isPlainObject(nextValue)) {
9407
+ target[key] = deepMerge(baseValue, nextValue);
9856
9408
  return;
9857
9409
  }
9858
- target[key] = cloneValue$1(nextValue);
9410
+ target[key] = cloneValue(nextValue);
9859
9411
  });
9860
9412
  return;
9861
9413
  }
9862
9414
  Object.keys(patch).forEach(key => {
9863
- target[key] = cloneValue$1(patch[key]);
9415
+ target[key] = cloneValue(patch[key]);
9864
9416
  });
9865
9417
  }
9866
9418
  sameArray(left, right) {
@@ -9874,285 +9426,69 @@ class StateEngine {
9874
9426
  }
9875
9427
  return true;
9876
9428
  }
9877
- canUseStateProxy(stateName) {
9878
- if (!this.stateProxy) {
9879
- return false;
9880
- }
9881
- return this.stateProxyEligibility ? this.stateProxyEligibility(stateName) : true;
9882
- }
9883
9429
  }
9884
9430
 
9885
- class StateModel {
9886
- constructor(options = {}) {
9887
- var _a;
9888
- this.exclusiveGroupMap = new Map();
9889
- this.exclusiveGroups = new Map();
9890
- this.states = options.states;
9891
- this.currentStates = options.currentStates ? [...options.currentStates] : undefined;
9892
- this.stateSort = options.stateSort;
9893
- this.stateProxy = options.stateProxy;
9894
- this.stateEngine = options.stateEngine;
9895
- if (this.stateEngine &&
9896
- options.currentStates &&
9897
- !this.sameStates(this.stateEngine.activeStates, options.currentStates)) {
9898
- this.stateEngine.applyStates(options.currentStates);
9899
- }
9900
- const exclusiveGroups = (_a = options.exclusiveGroups) !== null && _a !== void 0 ? _a : {};
9901
- for (const groupName in exclusiveGroups) {
9902
- if (!Object.prototype.hasOwnProperty.call(exclusiveGroups, groupName)) {
9903
- continue;
9904
- }
9905
- this.registerExclusiveGroup(groupName, exclusiveGroups[groupName]);
9906
- }
9907
- }
9908
- getCurrentStates() {
9909
- return this.currentStates ? [...this.currentStates] : [];
9910
- }
9911
- hasState(stateName) {
9912
- if (this.stateEngine) {
9913
- return this.stateEngine.hasState(stateName);
9914
- }
9915
- if (!this.currentStates || !this.currentStates.length) {
9916
- return false;
9917
- }
9918
- if (stateName == null) {
9919
- return true;
9920
- }
9921
- return this.currentStates.includes(stateName);
9922
- }
9923
- getState(stateName) {
9924
- var _a;
9925
- return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
9926
- }
9927
- useStates(states) {
9928
- var _a;
9929
- if (this.stateEngine) {
9930
- const result = this.stateEngine.applyStates(states);
9931
- this.currentStates = [...result.activeStates];
9932
- return {
9933
- changed: result.changed,
9934
- states: [...result.activeStates],
9935
- effectiveStates: [...result.effectiveStates]
9936
- };
9937
- }
9938
- if (!states.length) {
9939
- return this.clearStates();
9940
- }
9941
- const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : [];
9942
- const changed = previousStates.length !== states.length || states.some((stateName, index) => previousStates[index] !== stateName);
9943
- const nextStates = this.sortStates(states);
9944
- if (changed) {
9945
- this.currentStates = nextStates;
9946
- }
9947
- return {
9948
- changed,
9949
- states: changed ? [...nextStates] : [...previousStates]
9950
- };
9951
- }
9952
- clearStates() {
9953
- if (this.stateEngine) {
9954
- const result = this.stateEngine.clearStates();
9955
- this.currentStates = [];
9956
- return {
9957
- changed: result.changed,
9958
- states: [],
9959
- effectiveStates: []
9960
- };
9961
- }
9962
- const changed = this.hasState();
9963
- this.currentStates = [];
9964
- return {
9965
- changed,
9966
- states: []
9967
- };
9968
- }
9969
- addState(stateName, keepCurrentStates) {
9970
- var _a;
9971
- if (this.stateEngine) {
9972
- const result = this.stateEngine.addState(stateName, keepCurrentStates);
9973
- this.currentStates = [...result.activeStates];
9974
- return {
9975
- changed: result.changed,
9976
- states: [...result.activeStates],
9977
- effectiveStates: [...result.effectiveStates]
9978
- };
9979
- }
9980
- if (this.currentStates &&
9981
- this.currentStates.includes(stateName) &&
9982
- (keepCurrentStates || this.currentStates.length === 1)) {
9983
- return {
9984
- changed: false,
9985
- states: this.getCurrentStates()
9986
- };
9987
- }
9988
- const nextStates = keepCurrentStates && ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ? this.currentStates.concat([stateName]) : [stateName];
9989
- return this.useStates(nextStates);
9990
- }
9991
- removeState(stateName) {
9992
- if (this.stateEngine) {
9993
- const result = this.stateEngine.removeState(stateName);
9994
- this.currentStates = [...result.activeStates];
9995
- return {
9996
- changed: result.changed,
9997
- states: [...result.activeStates],
9998
- effectiveStates: [...result.effectiveStates]
9999
- };
10000
- }
10001
- if (!this.currentStates) {
10002
- return {
10003
- changed: false,
10004
- states: []
10005
- };
10006
- }
10007
- const filter = Array.isArray(stateName) ? (s) => !stateName.includes(s) : (s) => s !== stateName;
10008
- const nextStates = this.currentStates.filter(filter);
10009
- if (nextStates.length === this.currentStates.length) {
10010
- return {
10011
- changed: false,
10012
- states: this.getCurrentStates()
10013
- };
10014
- }
10015
- return this.useStates(nextStates);
10016
- }
10017
- toggleState(stateName) {
10018
- if (this.stateEngine) {
10019
- const result = this.stateEngine.toggleState(stateName);
10020
- this.currentStates = [...result.activeStates];
10021
- return {
10022
- changed: result.changed,
10023
- states: [...result.activeStates],
10024
- effectiveStates: [...result.effectiveStates]
10025
- };
10026
- }
10027
- if (this.hasState(stateName)) {
10028
- return this.removeState(stateName);
10029
- }
10030
- const nextStates = this.currentStates ? this.currentStates.slice() : [];
10031
- if (!nextStates.includes(stateName)) {
10032
- nextStates.push(stateName);
10033
- }
10034
- return this.useStates(nextStates);
10035
- }
10036
- sortStates(states) {
10037
- if (this.stateEngine) {
10038
- return [...this.stateEngine.activeStates];
10039
- }
10040
- if (!this.stateSort) {
10041
- return [...states];
10042
- }
10043
- return [...states].sort(this.stateSort);
10044
- }
10045
- registerExclusiveGroup(groupName, states) {
10046
- const uniqueStates = Array.from(new Set(states));
10047
- this.exclusiveGroups.set(groupName, uniqueStates);
10048
- uniqueStates.forEach(stateName => this.exclusiveGroupMap.set(stateName, groupName));
10049
- }
10050
- getExclusiveGroup(stateName) {
10051
- return this.exclusiveGroupMap.get(stateName);
10052
- }
10053
- getMutuallyExclusiveStates(stateName) {
10054
- var _a;
10055
- const groupName = this.getExclusiveGroup(stateName);
10056
- if (!groupName) {
10057
- return [];
10058
- }
10059
- return ((_a = this.exclusiveGroups.get(groupName)) !== null && _a !== void 0 ? _a : []).filter(name => name !== stateName);
10060
- }
10061
- isMutuallyExclusive(stateA, stateB) {
10062
- const groupName = this.getExclusiveGroup(stateA);
10063
- return !!groupName && groupName === this.getExclusiveGroup(stateB) && stateA !== stateB;
10064
- }
10065
- get effectiveStates() {
10066
- var _a, _b, _c;
10067
- return (_c = (_b = (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.effectiveStates) !== null && _b !== void 0 ? _b : this.currentStates) !== null && _c !== void 0 ? _c : [];
10068
- }
10069
- get resolvedPatch() {
10070
- var _a;
10071
- return (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.resolvedPatch;
10072
- }
10073
- sameStates(left, right) {
10074
- if (left.length !== right.length) {
10075
- return false;
10076
- }
10077
- for (let index = 0; index < left.length; index++) {
10078
- if (left[index] !== right[index]) {
10079
- return false;
10080
- }
10081
- }
10082
- return true;
10083
- }
10084
- }
10085
-
10086
- function isPlainObject(value) {
10087
- return value != null && typeof value === 'object' && !Array.isArray(value);
10088
- }
10089
- function cloneValue(value) {
10090
- if (!isPlainObject(value)) {
10091
- return value;
10092
- }
10093
- const clone = {};
10094
- for (const key in value) {
10095
- if (!Object.prototype.hasOwnProperty.call(value, key)) {
10096
- continue;
10097
- }
10098
- clone[key] = cloneValue(value[key]);
10099
- }
10100
- return clone;
10101
- }
10102
- function deepMerge(base, value) {
10103
- const result = cloneValue(base) || {};
10104
- for (const key in value) {
10105
- if (!Object.prototype.hasOwnProperty.call(value, key)) {
10106
- continue;
10107
- }
10108
- const nextValue = value[key];
10109
- const previousValue = result[key];
10110
- if (isPlainObject(previousValue) && isPlainObject(nextValue)) {
10111
- result[key] = deepMerge(previousValue, nextValue);
9431
+ var UpdateCategory;
9432
+ (function (UpdateCategory) {
9433
+ UpdateCategory[UpdateCategory["NONE"] = 0] = "NONE";
9434
+ UpdateCategory[UpdateCategory["PAINT"] = 1] = "PAINT";
9435
+ UpdateCategory[UpdateCategory["SHAPE"] = 2] = "SHAPE";
9436
+ UpdateCategory[UpdateCategory["BOUNDS"] = 4] = "BOUNDS";
9437
+ UpdateCategory[UpdateCategory["TRANSFORM"] = 8] = "TRANSFORM";
9438
+ UpdateCategory[UpdateCategory["LAYOUT"] = 16] = "LAYOUT";
9439
+ UpdateCategory[UpdateCategory["PICK"] = 32] = "PICK";
9440
+ })(UpdateCategory || (UpdateCategory = {}));
9441
+ const ATTRIBUTE_CATEGORY = {
9442
+ fill: UpdateCategory.PAINT,
9443
+ opacity: UpdateCategory.PAINT,
9444
+ fillOpacity: UpdateCategory.PAINT,
9445
+ strokeOpacity: UpdateCategory.PAINT,
9446
+ lineDash: UpdateCategory.PAINT,
9447
+ lineDashOffset: UpdateCategory.PAINT,
9448
+ lineCap: UpdateCategory.PAINT,
9449
+ lineJoin: UpdateCategory.PAINT,
9450
+ miterLimit: UpdateCategory.PAINT,
9451
+ shadowColor: UpdateCategory.PAINT,
9452
+ x: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9453
+ y: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9454
+ scaleX: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9455
+ scaleY: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9456
+ angle: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9457
+ anchor: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9458
+ anchor3d: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9459
+ postMatrix: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9460
+ layout: UpdateCategory.LAYOUT,
9461
+ zIndex: UpdateCategory.PAINT,
9462
+ visible: UpdateCategory.PAINT | UpdateCategory.PICK,
9463
+ lineWidth: UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.PICK,
9464
+ width: UpdateCategory.SHAPE | UpdateCategory.BOUNDS,
9465
+ height: UpdateCategory.SHAPE | UpdateCategory.BOUNDS
9466
+ };
9467
+ const ATTRIBUTE_DELTA_CLASSIFIER = {
9468
+ stroke: (prev, next) => {
9469
+ const prevEnabled = prev != null && prev !== false;
9470
+ const nextEnabled = next != null && next !== false;
9471
+ if (prevEnabled !== nextEnabled) {
9472
+ return UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK;
10112
9473
  }
10113
- else {
10114
- result[key] = cloneValue(nextValue);
9474
+ return UpdateCategory.PAINT;
9475
+ },
9476
+ shadowBlur: (prev, next) => {
9477
+ const prevBlur = Number(prev !== null && prev !== void 0 ? prev : 0);
9478
+ const nextBlur = Number(next !== null && next !== void 0 ? next : 0);
9479
+ if (prevBlur !== nextBlur && (prevBlur > 0 || nextBlur > 0)) {
9480
+ return UpdateCategory.PAINT | UpdateCategory.BOUNDS;
10115
9481
  }
9482
+ return UpdateCategory.PAINT;
10116
9483
  }
10117
- return result;
10118
- }
10119
- class StateStyleResolver {
10120
- constructor(options = {}) {
10121
- this.options = options;
10122
- }
10123
- resolve(normalAttrs, states, stateProxy, currentStates, stateSort) {
10124
- var _a;
10125
- const mergeMode = (_a = this.options.mergeMode) !== null && _a !== void 0 ? _a : 'shallow';
10126
- const sortedStates = stateSort ? currentStates.slice().sort(stateSort) : currentStates.slice();
10127
- const resolvedAttrs = {};
10128
- sortedStates.forEach(stateName => {
10129
- const attrs = stateProxy ? stateProxy(stateName, sortedStates) : states === null || states === void 0 ? void 0 : states[stateName];
10130
- if (attrs == null) {
10131
- return;
10132
- }
10133
- for (const key in attrs) {
10134
- if (!Object.prototype.hasOwnProperty.call(attrs, key)) {
10135
- continue;
10136
- }
10137
- const nextValue = attrs[key];
10138
- if (mergeMode === 'deep' &&
10139
- isPlainObject(nextValue) &&
10140
- (isPlainObject(resolvedAttrs[key]) ||
10141
- isPlainObject(normalAttrs[key]))) {
10142
- const baseValue = isPlainObject(resolvedAttrs[key])
10143
- ? resolvedAttrs[key]
10144
- : isPlainObject(normalAttrs[key])
10145
- ? normalAttrs[key]
10146
- : {};
10147
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
10148
- }
10149
- else {
10150
- resolvedAttrs[key] = cloneValue(nextValue);
10151
- }
10152
- }
10153
- });
10154
- return resolvedAttrs;
9484
+ };
9485
+ function classifyAttributeDelta(key, prev, next) {
9486
+ var _a;
9487
+ const dynamicClassifier = ATTRIBUTE_DELTA_CLASSIFIER[key];
9488
+ if (dynamicClassifier) {
9489
+ return dynamicClassifier(prev, next);
10155
9490
  }
9491
+ return (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
10156
9492
  }
10157
9493
 
10158
9494
  function hasOwnKeys(value) {
@@ -10176,13 +9512,11 @@ function normalizeNoAnimateAttrConfig(config) {
10176
9512
  }, {});
10177
9513
  }
10178
9514
  class StateTransitionOrchestrator {
10179
- analyzeTransition(_currentAttrs, targetAttrs, stateNames, hasAnimation, options = {}) {
9515
+ analyzeTransition(targetAttrs, hasAnimation, options = {}) {
10180
9516
  var _a, _b;
10181
9517
  const plan = {
10182
- stateNames,
10183
9518
  targetAttrs: Object.assign({}, targetAttrs),
10184
9519
  animateAttrs: {},
10185
- jumpAttrs: {},
10186
9520
  noAnimateAttrs: {}
10187
9521
  };
10188
9522
  if (!hasAnimation) {
@@ -10191,10 +9525,10 @@ class StateTransitionOrchestrator {
10191
9525
  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));
10192
9526
  const isClear = options.isClear === true;
10193
9527
  const getDefaultAttribute = options.getDefaultAttribute;
9528
+ const readDefaultAttribute = getDefaultAttribute;
10194
9529
  const shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute;
10195
9530
  const assignTransitionAttr = (key, value) => {
10196
9531
  if (noWorkAnimateAttr[key]) {
10197
- plan.jumpAttrs[key] = value;
10198
9532
  plan.noAnimateAttrs[key] = value;
10199
9533
  return;
10200
9534
  }
@@ -10202,7 +9536,7 @@ class StateTransitionOrchestrator {
10202
9536
  if (shouldSkipDefaultAttribute === null || shouldSkipDefaultAttribute === void 0 ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) {
10203
9537
  return;
10204
9538
  }
10205
- plan.animateAttrs[key] = getDefaultAttribute ? getDefaultAttribute(key) : value;
9539
+ plan.animateAttrs[key] = readDefaultAttribute(key);
10206
9540
  return;
10207
9541
  }
10208
9542
  plan.animateAttrs[key] = value;
@@ -10256,13 +9590,13 @@ class StateTransitionOrchestrator {
10256
9590
  graphic._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
10257
9591
  return plan;
10258
9592
  }
10259
- applyClearTransition(graphic, targetAttrs, hasAnimation, stateNames, options = {}) {
10260
- var _a, _b, _c, _d;
10261
- const plan = this.analyzeTransition({}, targetAttrs, stateNames, hasAnimation, {
10262
- noWorkAnimateAttr: (_a = graphic.getNoWorkAnimateAttr) === null || _a === void 0 ? void 0 : _a.call(graphic),
9593
+ applyClearTransition(graphic, targetAttrs, hasAnimation, options = {}) {
9594
+ var _a;
9595
+ const plan = this.analyzeTransition(targetAttrs, hasAnimation, {
9596
+ noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
10263
9597
  isClear: true,
10264
- getDefaultAttribute: (_b = graphic.getDefaultAttribute) === null || _b === void 0 ? void 0 : _b.bind(graphic),
10265
- shouldSkipDefaultAttribute: (_c = options.shouldSkipDefaultAttribute) !== null && _c !== void 0 ? _c : (_d = graphic.shouldSkipStateTransitionDefaultAttribute) === null || _d === void 0 ? void 0 : _d.bind(graphic),
9598
+ getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
9599
+ shouldSkipDefaultAttribute: (_a = options.shouldSkipDefaultAttribute) !== null && _a !== void 0 ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
10266
9600
  animateConfig: options.animateConfig,
10267
9601
  extraAnimateAttrs: options.extraAnimateAttrs
10268
9602
  });
@@ -10271,33 +9605,11 @@ class StateTransitionOrchestrator {
10271
9605
  }
10272
9606
 
10273
9607
  const compiler = new StateDefinitionCompiler();
10274
- function copyDefinitions(definitions) {
10275
- return definitions ? Object.assign({}, definitions) : {};
10276
- }
10277
9608
  function buildEffectiveSourceDefinitions(parentScope, localStateDefinitions, themeStateDefinitions) {
10278
- const merged = parentScope
10279
- ? copyDefinitions(parentScope.effectiveSourceDefinitions)
10280
- : copyDefinitions(themeStateDefinitions);
10281
- if (localStateDefinitions) {
10282
- Object.keys(localStateDefinitions).forEach(stateName => {
10283
- merged[stateName] = localStateDefinitions[stateName];
10284
- });
10285
- }
10286
- return merged;
10287
- }
10288
- function initializeScope(scope, revision = 0) {
10289
- var _a;
10290
- const effectiveSourceDefinitions = buildEffectiveSourceDefinitions(scope.parentScope, scope.localStateDefinitions, scope.themeStateDefinitions);
10291
- scope.effectiveSourceDefinitions = effectiveSourceDefinitions;
10292
- scope.effectiveCompiledDefinitions = compiler.compile(effectiveSourceDefinitions);
10293
- scope.parentRevisionAtBuild = (_a = scope.parentScope) === null || _a === void 0 ? void 0 : _a.revision;
10294
- scope.revision = revision;
10295
- scope.dirty = false;
10296
- return scope;
9609
+ return Object.assign({}, parentScope ? parentScope.effectiveSourceDefinitions : themeStateDefinitions, localStateDefinitions);
10297
9610
  }
10298
9611
  function createRootSharedStateScope(stage, themeStateDefinitions) {
10299
- return initializeScope({
10300
- ownerKind: 'root',
9612
+ return rebuildSharedStateScope({
10301
9613
  ownerStage: stage,
10302
9614
  themeStateDefinitions,
10303
9615
  effectiveSourceDefinitions: {},
@@ -10308,9 +9620,7 @@ function createRootSharedStateScope(stage, themeStateDefinitions) {
10308
9620
  }, 0);
10309
9621
  }
10310
9622
  function createGroupSharedStateScope(group, parentScope, localStateDefinitions) {
10311
- return initializeScope({
10312
- ownerKind: 'group',
10313
- ownerGroup: group,
9623
+ return rebuildSharedStateScope({
10314
9624
  ownerStage: group.stage,
10315
9625
  parentScope,
10316
9626
  localStateDefinitions,
@@ -10345,22 +9655,20 @@ function setRootSharedStateScopeThemeDefinitions(scope, themeStateDefinitions) {
10345
9655
  rebuildSharedStateScope(scope);
10346
9656
  return true;
10347
9657
  }
10348
- function rebuildSharedStateScope(scope) {
9658
+ function rebuildSharedStateScope(scope, revision = scope.revision + 1) {
10349
9659
  var _a;
10350
9660
  const effectiveSourceDefinitions = buildEffectiveSourceDefinitions(scope.parentScope, scope.localStateDefinitions, scope.themeStateDefinitions);
10351
9661
  scope.effectiveSourceDefinitions = effectiveSourceDefinitions;
10352
9662
  scope.effectiveCompiledDefinitions = compiler.compile(effectiveSourceDefinitions);
10353
9663
  scope.parentRevisionAtBuild = (_a = scope.parentScope) === null || _a === void 0 ? void 0 : _a.revision;
10354
- scope.revision += 1;
9664
+ scope.revision = revision;
10355
9665
  scope.dirty = false;
10356
9666
  return scope;
10357
9667
  }
10358
9668
  function ensureSharedStateScopeFresh(scope) {
10359
- var _a;
10360
9669
  if (!scope) {
10361
9670
  return undefined;
10362
9671
  }
10363
- (_a = getActiveStageStatePerfMonitor(scope.ownerStage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('ensureFreshCalls');
10364
9672
  if (scope.parentScope) {
10365
9673
  ensureSharedStateScopeFresh(scope.parentScope);
10366
9674
  }
@@ -10380,11 +9688,9 @@ function collectSharedStateScopeChain(scope) {
10380
9688
  }
10381
9689
 
10382
9690
  function scheduleStageSharedStateRefresh(stage) {
10383
- var _a;
10384
9691
  if (!stage || stage.releaseStatus === 'released') {
10385
9692
  return;
10386
9693
  }
10387
- (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('renderScheduled');
10388
9694
  stage.renderNextFrame();
10389
9695
  }
10390
9696
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
@@ -10393,36 +9699,27 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
10393
9699
  return;
10394
9700
  }
10395
9701
  const pending = (_a = stage._pendingSharedStateRefreshGraphics) !== null && _a !== void 0 ? _a : (stage._pendingSharedStateRefreshGraphics = new Set());
10396
- if (!pending.has(graphic)) {
10397
- pending.add(graphic);
10398
- const perfMonitor = getActiveStageStatePerfMonitor(stage);
10399
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordRefresh('queuedGraphics');
10400
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordAllocation('refreshQueuePushes');
10401
- }
9702
+ pending.add(graphic);
10402
9703
  }
10403
9704
  function markScopeActiveDescendantsDirty(scope, stage) {
10404
- let marked = false;
9705
+ if (!scope.subtreeActiveDescendants.size) {
9706
+ return;
9707
+ }
10405
9708
  scope.subtreeActiveDescendants.forEach(graphic => {
10406
9709
  var _a;
10407
9710
  graphic.sharedStateDirty = true;
10408
9711
  const ownerStage = (_a = stage !== null && stage !== void 0 ? stage : graphic.stage) !== null && _a !== void 0 ? _a : scope.ownerStage;
10409
9712
  enqueueGraphicSharedStateRefresh(ownerStage, graphic);
10410
- marked = true;
10411
9713
  });
10412
- if (marked) {
10413
- scheduleStageSharedStateRefresh(stage !== null && stage !== void 0 ? stage : scope.ownerStage);
10414
- }
9714
+ scheduleStageSharedStateRefresh(stage !== null && stage !== void 0 ? stage : scope.ownerStage);
10415
9715
  }
10416
9716
  function flushStageSharedStateRefresh(stage) {
10417
9717
  const pending = stage._pendingSharedStateRefreshGraphics;
10418
9718
  if (!pending || !pending.size) {
10419
9719
  return;
10420
9720
  }
10421
- const perfMonitor = getActiveStageStatePerfMonitor(stage);
10422
- const start = perfMonitor ? performance.now() : 0;
10423
9721
  const graphics = Array.from(pending.values());
10424
9722
  pending.clear();
10425
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordRefresh('flushedGraphics', graphics.length);
10426
9723
  graphics.forEach(graphic => {
10427
9724
  if (graphic.releaseStatus === 'released') {
10428
9725
  return;
@@ -10433,19 +9730,8 @@ function flushStageSharedStateRefresh(stage) {
10433
9730
  if (!graphic.sharedStateDirty) {
10434
9731
  return;
10435
9732
  }
10436
- const refresh = graphic.refreshSharedStateBeforeRender;
10437
- if (typeof refresh === 'function') {
10438
- refresh.call(graphic);
10439
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('sharedRefreshCommits');
10440
- }
9733
+ graphic.refreshSharedStateBeforeRender();
10441
9734
  });
10442
- if (perfMonitor) {
10443
- perfMonitor.recordCost('sharedRefresh', performance.now() - start);
10444
- perfMonitor.recordEvent('shared-refresh-flush', {
10445
- stageId: stage._uid,
10446
- flushedGraphics: graphics.length
10447
- });
10448
- }
10449
9735
  }
10450
9736
 
10451
9737
  const _tempBounds$1 = new AABBBounds();
@@ -10485,18 +9771,8 @@ const builtinTextureTypes = new Set([
10485
9771
  'grid',
10486
9772
  'wave'
10487
9773
  ]);
10488
- const FULL_STATE_DEFINITION_KEYS = new Set([
10489
- 'name',
10490
- 'patch',
10491
- 'priority',
10492
- 'exclude',
10493
- 'suppress',
10494
- 'resolver',
10495
- 'declaredAffectedKeys'
10496
- ]);
10497
9774
  const point = new Point();
10498
9775
  const EMPTY_STATE_NAMES = [];
10499
- const deprecatedLocalStateFallbackWarningStateNames = new Set();
10500
9776
  const BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT |
10501
9777
  UpdateCategory.SHAPE |
10502
9778
  UpdateCategory.BOUNDS |
@@ -10650,18 +9926,6 @@ class Graphic extends Node {
10650
9926
  getAttributes() {
10651
9927
  return this.attribute;
10652
9928
  }
10653
- getStateStyleResolver(mergeMode) {
10654
- if (mergeMode === 'deep') {
10655
- if (!this.deepStateStyleResolver) {
10656
- this.deepStateStyleResolver = new StateStyleResolver({ mergeMode: 'deep' });
10657
- }
10658
- return this.deepStateStyleResolver;
10659
- }
10660
- if (!this.stateStyleResolver) {
10661
- this.stateStyleResolver = new StateStyleResolver();
10662
- }
10663
- return this.stateStyleResolver;
10664
- }
10665
9929
  getStateTransitionOrchestrator() {
10666
9930
  if (!this.stateTransitionOrchestrator) {
10667
9931
  this.stateTransitionOrchestrator = new StateTransitionOrchestrator();
@@ -10688,12 +9952,10 @@ class Graphic extends Node {
10688
9952
  }
10689
9953
  this.boundSharedStateScope = nextScope;
10690
9954
  this.boundSharedStateRevision = undefined;
10691
- this.localFallbackCompiledDefinitions = undefined;
10692
9955
  this.compiledStateDefinitions = undefined;
10693
9956
  this.compiledStateDefinitionsCacheKey = undefined;
10694
9957
  this.stateEngine = undefined;
10695
9958
  this.stateEngineCompiledDefinitions = undefined;
10696
- this.stateEngineStateProxyModeKey = undefined;
10697
9959
  this.syncSharedStateActiveRegistrations();
10698
9960
  if (markDirty && ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length)) {
10699
9961
  this.markSharedStateDirty();
@@ -10776,20 +10038,9 @@ class Graphic extends Node {
10776
10038
  var _a, _b;
10777
10039
  if (this.localStateDefinitionsSource !== this.states) {
10778
10040
  this.localStateDefinitionsSource = this.states;
10779
- this.localFallbackVersion = ((_a = this.localFallbackVersion) !== null && _a !== void 0 ? _a : 0) + 1;
10780
- }
10781
- return (_b = this.localFallbackVersion) !== null && _b !== void 0 ? _b : 0;
10782
- }
10783
- warnDeprecatedLocalStatesFallback(stateNames) {
10784
- for (let index = 0; index < stateNames.length; index++) {
10785
- const stateName = stateNames[index];
10786
- if (deprecatedLocalStateFallbackWarningStateNames.has(stateName)) {
10787
- continue;
10788
- }
10789
- deprecatedLocalStateFallbackWarningStateNames.add(stateName);
10790
- console.warn(`[VRender] graphic.states fallback for missing shared state definition "${stateName}" is deprecated. ` +
10791
- 'Move the state definition to sharedStateDefinitions or use stateProxy for dynamic per-graphic styles.');
10041
+ this.localStateDefinitionsVersion = ((_a = this.localStateDefinitionsVersion) !== null && _a !== void 0 ? _a : 0) + 1;
10792
10042
  }
10043
+ return (_b = this.localStateDefinitionsVersion) !== null && _b !== void 0 ? _b : 0;
10793
10044
  }
10794
10045
  resolveEffectiveCompiledDefinitions() {
10795
10046
  this.syncSharedStateScopeBindingFromTree(false);
@@ -10802,8 +10053,7 @@ class Graphic extends Node {
10802
10053
  if (!boundScope) {
10803
10054
  if (!hasStates) {
10804
10055
  return {
10805
- compiledDefinitions: undefined,
10806
- stateProxyModeKey: 'none'
10056
+ compiledDefinitions: undefined
10807
10057
  };
10808
10058
  }
10809
10059
  const localStatesVersion = this.getLocalStatesVersion();
@@ -10813,53 +10063,12 @@ class Graphic extends Node {
10813
10063
  this.compiledStateDefinitionsCacheKey = cacheKey;
10814
10064
  }
10815
10065
  return {
10816
- compiledDefinitions: this.compiledStateDefinitions,
10817
- stateProxyModeKey: this.stateProxy ? 'legacy-all' : 'none'
10818
- };
10819
- }
10820
- const sharedCompiledDefinitions = boundScope.effectiveCompiledDefinitions;
10821
- const sharedStateProxyModeKey = this.stateProxy ? 'shared-missing-only' : 'none';
10822
- const sharedStateProxyEligibility = this.stateProxy
10823
- ? (stateName) => !sharedCompiledDefinitions.has(stateName)
10824
- : undefined;
10825
- if (!hasStates) {
10826
- this.localFallbackCompiledDefinitions = undefined;
10827
- return {
10828
- compiledDefinitions: sharedCompiledDefinitions,
10829
- stateProxyModeKey: sharedStateProxyModeKey,
10830
- stateProxyEligibility: sharedStateProxyEligibility
10831
- };
10832
- }
10833
- const localStates = this.states;
10834
- const missingLocalStateDefinitions = {};
10835
- const missingStateNames = [];
10836
- Object.keys(localStates).forEach(stateName => {
10837
- if (sharedCompiledDefinitions.has(stateName)) {
10838
- return;
10839
- }
10840
- missingLocalStateDefinitions[stateName] = localStates[stateName];
10841
- missingStateNames.push(stateName);
10842
- });
10843
- if (!missingStateNames.length) {
10844
- this.localFallbackCompiledDefinitions = undefined;
10845
- return {
10846
- compiledDefinitions: sharedCompiledDefinitions,
10847
- stateProxyModeKey: sharedStateProxyModeKey,
10848
- stateProxyEligibility: sharedStateProxyEligibility
10066
+ compiledDefinitions: this.compiledStateDefinitions
10849
10067
  };
10850
10068
  }
10851
- this.warnDeprecatedLocalStatesFallback(missingStateNames);
10852
- const localStatesVersion = this.getLocalStatesVersion();
10853
- const stateProxyModeKey = this.stateProxy ? `missing:${missingStateNames.sort().join('|')}` : 'none';
10854
- const cacheKey = `shared:${boundScope.revision}:fallback:${localStatesVersion}:${stateProxyModeKey}`;
10855
- if (!this.localFallbackCompiledDefinitions || this.compiledStateDefinitionsCacheKey !== cacheKey) {
10856
- this.localFallbackCompiledDefinitions = new StateDefinitionCompiler().compile(Object.assign(Object.assign({}, boundScope.effectiveSourceDefinitions), missingLocalStateDefinitions));
10857
- this.compiledStateDefinitionsCacheKey = cacheKey;
10858
- }
10069
+ const sharedCompiledDefinitions = boundScope.effectiveCompiledDefinitions;
10859
10070
  return {
10860
- compiledDefinitions: this.localFallbackCompiledDefinitions,
10861
- stateProxyModeKey,
10862
- stateProxyEligibility: sharedStateProxyEligibility
10071
+ compiledDefinitions: sharedCompiledDefinitions
10863
10072
  };
10864
10073
  }
10865
10074
  recomputeCurrentStatePatch() {
@@ -10871,11 +10080,9 @@ class Graphic extends Node {
10871
10080
  return;
10872
10081
  }
10873
10082
  const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
10874
- const stateModel = this.createStateModel(stateResolveBaseAttrs);
10875
- const transition = stateModel.useStates(this.currentStates);
10083
+ const transition = this.resolveUseStatesTransition(this.currentStates, stateResolveBaseAttrs);
10876
10084
  const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
10877
- const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
10878
- ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
10085
+ const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
10879
10086
  this.currentStates = transition.states;
10880
10087
  this.effectiveStates = [...effectiveStates];
10881
10088
  this.resolvedStatePatch = resolvedStateAttrs;
@@ -10984,19 +10191,12 @@ class Graphic extends Node {
10984
10191
  return category | nextCategory;
10985
10192
  }
10986
10193
  submitUpdateByCategory(category, forceUpdateTag = false) {
10987
- var _a;
10988
10194
  if (forceUpdateTag) {
10989
10195
  this.addUpdateShapeAndBoundsTag();
10990
10196
  this.addUpdatePositionTag();
10991
10197
  this.addUpdateLayoutTag();
10992
10198
  return;
10993
10199
  }
10994
- if (category !== UpdateCategory.NONE) {
10995
- const stage = this.stage;
10996
- if (stage) {
10997
- (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10998
- }
10999
- }
11000
10200
  if ((category & BROAD_UPDATE_CATEGORY) === BROAD_UPDATE_CATEGORY) {
11001
10201
  this.addBroadUpdateTag();
11002
10202
  return;
@@ -11949,159 +11149,141 @@ class Graphic extends Node {
11949
11149
  (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.setResolveContext(this, stateResolveBaseAttrs);
11950
11150
  return stateResolveBaseAttrs;
11951
11151
  }
11952
- createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11953
- const { compiledDefinitions, stateProxyEligibility, stateProxyModeKey } = this.resolveEffectiveCompiledDefinitions();
11152
+ ensureStateEngine(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11153
+ const { compiledDefinitions } = this.resolveEffectiveCompiledDefinitions();
11954
11154
  this.compiledStateDefinitions = compiledDefinitions;
11955
11155
  if (!compiledDefinitions) {
11956
11156
  this.stateEngine = undefined;
11957
11157
  this.stateEngineCompiledDefinitions = undefined;
11958
- this.stateEngineStateProxyModeKey = undefined;
11959
11158
  }
11960
11159
  else if (!this.stateEngine ||
11961
11160
  this.stateEngineCompiledDefinitions !== compiledDefinitions ||
11962
- this.stateEngineStateProxy !== this.stateProxy ||
11963
11161
  this.stateEngineStateSort !== this.stateSort ||
11964
- this.stateEngineMergeMode !== this.stateMergeMode ||
11965
- this.stateEngineStateProxyModeKey !== stateProxyModeKey) {
11162
+ this.stateEngineMergeMode !== this.stateMergeMode) {
11966
11163
  this.stateEngine = new StateEngine({
11967
11164
  compiledDefinitions,
11968
11165
  stateSort: this.stateSort,
11969
- stateProxy: this.stateProxy,
11970
- stateProxyEligibility,
11971
- states: this.states,
11972
11166
  mergeMode: this.stateMergeMode
11973
11167
  });
11974
11168
  this.stateEngineCompiledDefinitions = compiledDefinitions;
11975
- this.stateEngineStateProxy = this.stateProxy;
11976
11169
  this.stateEngineStateSort = this.stateSort;
11977
11170
  this.stateEngineMergeMode = this.stateMergeMode;
11978
- this.stateEngineStateProxyModeKey = stateProxyModeKey;
11979
11171
  }
11980
11172
  this.syncStateResolveContext(stateResolveBaseAttrs);
11981
- return new StateModel({
11982
- states: this.states,
11983
- currentStates: this.currentStates,
11984
- stateSort: this.stateSort,
11985
- stateProxy: this.stateProxy,
11986
- stateEngine: this.stateEngine
11987
- });
11173
+ if (this.stateEngine &&
11174
+ this.currentStates &&
11175
+ !this.sameStateNames(this.stateEngine.activeStates, this.currentStates)) {
11176
+ this.stateEngine.applyStates(this.currentStates);
11177
+ }
11178
+ return this.stateEngine;
11179
+ }
11180
+ toGraphicStateTransition(result) {
11181
+ return {
11182
+ changed: result.changed,
11183
+ states: [...result.activeStates],
11184
+ effectiveStates: [...result.effectiveStates]
11185
+ };
11988
11186
  }
11989
- resolveSimpleLocalStateTransition(states, previousStates) {
11187
+ sortLocalStates(states) {
11188
+ return this.stateSort ? [...states].sort(this.stateSort) : [...states];
11189
+ }
11190
+ resolveLocalUseStatesTransition(states) {
11990
11191
  var _a;
11991
- if (!this.states ||
11992
- this.stateProxy ||
11993
- this.stateSort ||
11994
- this.stateMergeMode === 'deep' ||
11995
- this.parent ||
11996
- ((_a = this.stage) === null || _a === void 0 ? void 0 : _a.rootSharedStateScope) ||
11997
- this.boundSharedStateScope) {
11998
- return null;
11192
+ if (!states.length) {
11193
+ return this.resolveLocalClearStatesTransition();
11999
11194
  }
12000
- if (states.length === 1) {
12001
- const stateName = states[0];
12002
- const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
12003
- const nextStates = [stateName];
12004
- const changed = !this.sameStateNames(previousStates, nextStates);
12005
- const resolvedStateAttrs = {};
12006
- if (hasDefinition) {
12007
- const attrs = this.states[stateName];
12008
- if (attrs != null) {
12009
- if (!isPlainObjectValue(attrs)) {
12010
- return null;
12011
- }
12012
- const keys = Object.keys(attrs);
12013
- for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
12014
- const key = keys[keyIndex];
12015
- if (FULL_STATE_DEFINITION_KEYS.has(key)) {
12016
- return null;
12017
- }
12018
- const attrValue = attrs[key];
12019
- resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
12020
- ? cloneAttributeValue(attrValue)
12021
- : attrValue;
12022
- }
12023
- }
12024
- }
11195
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
11196
+ const changed = previousStates.length !== states.length || states.some((stateName, index) => previousStates[index] !== stateName);
11197
+ const nextStates = this.sortLocalStates(states);
11198
+ return {
11199
+ changed,
11200
+ states: changed ? nextStates : [...previousStates]
11201
+ };
11202
+ }
11203
+ resolveLocalClearStatesTransition() {
11204
+ return {
11205
+ changed: this.hasState(),
11206
+ states: []
11207
+ };
11208
+ }
11209
+ resolveUseStatesTransition(states, stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11210
+ const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
11211
+ return stateEngine
11212
+ ? this.toGraphicStateTransition(stateEngine.applyStates(states))
11213
+ : this.resolveLocalUseStatesTransition(states);
11214
+ }
11215
+ resolveClearStatesTransition() {
11216
+ const stateEngine = this.ensureStateEngine();
11217
+ return stateEngine
11218
+ ? this.toGraphicStateTransition(stateEngine.clearStates())
11219
+ : this.resolveLocalClearStatesTransition();
11220
+ }
11221
+ resolveAddStateTransition(stateName, keepCurrentStates) {
11222
+ var _a;
11223
+ const stateEngine = this.ensureStateEngine();
11224
+ if (stateEngine) {
11225
+ return this.toGraphicStateTransition(stateEngine.addState(stateName, keepCurrentStates));
11226
+ }
11227
+ if (this.currentStates &&
11228
+ this.currentStates.includes(stateName) &&
11229
+ (keepCurrentStates || this.currentStates.length === 1)) {
12025
11230
  return {
12026
- changed,
12027
- states: nextStates,
12028
- effectiveStates: nextStates,
12029
- resolvedStateAttrs
11231
+ changed: false,
11232
+ states: [...this.currentStates]
12030
11233
  };
12031
11234
  }
12032
- const uniqueStates = Array.from(new Set(states));
12033
- const withDefinition = [];
12034
- const withoutDefinition = [];
12035
- for (let i = 0; i < uniqueStates.length; i++) {
12036
- const stateName = uniqueStates[i];
12037
- if (Object.prototype.hasOwnProperty.call(this.states, stateName)) {
12038
- withDefinition.push(stateName);
12039
- }
12040
- else {
12041
- withoutDefinition.push(stateName);
12042
- }
11235
+ const nextStates = keepCurrentStates && ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ? this.currentStates.concat([stateName]) : [stateName];
11236
+ return this.resolveLocalUseStatesTransition(nextStates);
11237
+ }
11238
+ resolveRemoveStateTransition(stateName) {
11239
+ const stateEngine = this.ensureStateEngine();
11240
+ if (stateEngine) {
11241
+ return this.toGraphicStateTransition(stateEngine.removeState(stateName));
12043
11242
  }
12044
- withDefinition.sort((left, right) => left.localeCompare(right));
12045
- const nextStates = withDefinition.concat(withoutDefinition);
12046
- const changed = !this.sameStateNames(previousStates, nextStates);
12047
- const resolvedStateAttrs = {};
12048
- for (let i = 0; i < nextStates.length; i++) {
12049
- const stateName = nextStates[i];
12050
- const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
12051
- if (!hasDefinition) {
12052
- continue;
12053
- }
12054
- const attrs = this.states[stateName];
12055
- if (attrs == null) {
12056
- continue;
12057
- }
12058
- if (!isPlainObjectValue(attrs)) {
12059
- return null;
12060
- }
12061
- const keys = Object.keys(attrs);
12062
- for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
12063
- const key = keys[keyIndex];
12064
- if (FULL_STATE_DEFINITION_KEYS.has(key)) {
12065
- return null;
12066
- }
12067
- const attrValue = attrs[key];
12068
- resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
12069
- ? cloneAttributeValue(attrValue)
12070
- : attrValue;
12071
- }
11243
+ if (!this.currentStates) {
11244
+ return {
11245
+ changed: false,
11246
+ states: []
11247
+ };
12072
11248
  }
12073
- return {
12074
- changed,
12075
- states: nextStates,
12076
- effectiveStates: nextStates,
12077
- resolvedStateAttrs
12078
- };
11249
+ const filter = Array.isArray(stateName) ? (s) => !stateName.includes(s) : (s) => s !== stateName;
11250
+ const nextStates = this.currentStates.filter(filter);
11251
+ if (nextStates.length === this.currentStates.length) {
11252
+ return {
11253
+ changed: false,
11254
+ states: [...this.currentStates]
11255
+ };
11256
+ }
11257
+ return this.resolveLocalUseStatesTransition(nextStates);
12079
11258
  }
12080
- resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = false) {
12081
- var _a, _b;
12082
- let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
12083
- const isSimpleLocalTransition = !!transition;
12084
- let resolvedStateAttrs;
12085
- if (transition) {
12086
- resolvedStateAttrs = transition.resolvedStateAttrs;
11259
+ resolveToggleStateTransition(stateName) {
11260
+ const stateEngine = this.ensureStateEngine();
11261
+ if (stateEngine) {
11262
+ return this.toGraphicStateTransition(stateEngine.toggleState(stateName));
12087
11263
  }
12088
- else {
12089
- const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
12090
- const stateModel = this.createStateModel(stateResolveBaseAttrs);
12091
- if (forceResolverRefresh) {
12092
- (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.invalidateResolverCache();
12093
- }
12094
- transition = stateModel.useStates(states);
12095
- resolvedStateAttrs =
12096
- this.stateEngine && this.compiledStateDefinitions
12097
- ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
11264
+ if (this.hasState(stateName)) {
11265
+ return this.resolveRemoveStateTransition(stateName);
12098
11266
  }
12099
- const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
11267
+ const nextStates = this.currentStates ? this.currentStates.slice() : [];
11268
+ nextStates.push(stateName);
11269
+ return this.resolveLocalUseStatesTransition(nextStates);
11270
+ }
11271
+ resolveGraphicStateTransition(states, forceResolverRefresh = false) {
11272
+ var _a;
11273
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
11274
+ const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
11275
+ if (forceResolverRefresh) {
11276
+ stateEngine === null || stateEngine === void 0 ? void 0 : stateEngine.invalidateResolverCache();
11277
+ }
11278
+ const transition = stateEngine
11279
+ ? this.toGraphicStateTransition(stateEngine.applyStates(states))
11280
+ : this.resolveLocalUseStatesTransition(states);
11281
+ const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
11282
+ const effectiveStates = (_a = transition.effectiveStates) !== null && _a !== void 0 ? _a : transition.states;
12100
11283
  return {
12101
11284
  transition,
12102
11285
  effectiveStates: effectiveStates,
12103
- resolvedStateAttrs,
12104
- isSimpleLocalTransition
11286
+ resolvedStateAttrs
12105
11287
  };
12106
11288
  }
12107
11289
  normalizeSetStatesOptions(options) {
@@ -12138,28 +11320,20 @@ class Graphic extends Node {
12138
11320
  var _a;
12139
11321
  const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12140
11322
  const previousResolvedStatePatch = this.resolvedStatePatch;
12141
- const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates, true);
11323
+ const { transition, effectiveStates, resolvedStateAttrs } = this.resolveGraphicStateTransition(states, true);
12142
11324
  const patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
12143
11325
  if (patchChanged &&
12144
11326
  !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
12145
11327
  return;
12146
11328
  }
12147
11329
  this.currentStates = transition.states;
12148
- this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
11330
+ this.effectiveStates = [...effectiveStates];
12149
11331
  this.resolvedStatePatch = resolvedStateAttrs;
12150
11332
  this.sharedStateDirty = false;
12151
11333
  this.syncSharedStateActiveRegistrations();
12152
11334
  if (!patchChanged) {
12153
11335
  return;
12154
11336
  }
12155
- if (this.stage) {
12156
- const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12157
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12158
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12159
- graphicId: this._uid,
12160
- targetStates: [...transition.states]
12161
- });
12162
- }
12163
11337
  if (hasAnimation && animateSameStatePatchChange) {
12164
11338
  this._syncFinalAttributeFromStaticTruth();
12165
11339
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
@@ -12191,10 +11365,10 @@ class Graphic extends Node {
12191
11365
  }
12192
11366
  : undefined;
12193
11367
  if (isClear) {
12194
- this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
11368
+ this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
12195
11369
  return;
12196
11370
  }
12197
- const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
11371
+ const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
12198
11372
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
12199
11373
  animateConfig: resolvedAnimateConfig,
12200
11374
  extraAnimateAttrs: extraAnimateAttrs,
@@ -12227,19 +11401,11 @@ class Graphic extends Node {
12227
11401
  });
12228
11402
  stateAnimates.forEach(animate => animate.stop(type));
12229
11403
  }
12230
- getNormalAttribute(key) {
12231
- var _a, _b;
12232
- const value = this.attribute[key];
12233
- if (this.hasAnyTrackedAnimate()) {
12234
- return (_a = this.finalAttribute) === null || _a === void 0 ? void 0 : _a[key];
12235
- }
12236
- return value !== null && value !== void 0 ? value : (_b = this.finalAttribute) === null || _b === void 0 ? void 0 : _b[key];
12237
- }
12238
11404
  clearStates(hasAnimation) {
12239
11405
  var _a, _b, _c;
12240
11406
  const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12241
11407
  const previousResolvedStatePatch = this.resolvedStatePatch;
12242
- const transition = this.createStateModel().clearStates();
11408
+ const transition = this.resolveClearStatesTransition();
12243
11409
  if (!transition.changed && previousStates.length === 0) {
12244
11410
  this.currentStates = [];
12245
11411
  this.effectiveStates = [];
@@ -12260,14 +11426,6 @@ class Graphic extends Node {
12260
11426
  this.resolvedStatePatch = undefined;
12261
11427
  this.sharedStateDirty = false;
12262
11428
  this.clearSharedStateActiveRegistrations();
12263
- if (this.stage) {
12264
- const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12265
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12266
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12267
- graphicId: this._uid,
12268
- targetStates: []
12269
- });
12270
- }
12271
11429
  if (hasAnimation) {
12272
11430
  this._syncFinalAttributeFromStaticTruth();
12273
11431
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, true, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
@@ -12286,19 +11444,19 @@ class Graphic extends Node {
12286
11444
  }
12287
11445
  }
12288
11446
  removeState(stateName, hasAnimation) {
12289
- const transition = this.createStateModel().removeState(stateName);
11447
+ const transition = this.resolveRemoveStateTransition(stateName);
12290
11448
  if (transition.changed) {
12291
11449
  this.useStates(transition.states, hasAnimation);
12292
11450
  }
12293
11451
  }
12294
11452
  toggleState(stateName, hasAnimation) {
12295
- const transition = this.createStateModel().toggleState(stateName);
11453
+ const transition = this.resolveToggleStateTransition(stateName);
12296
11454
  if (transition.changed) {
12297
11455
  this.useStates(transition.states, hasAnimation);
12298
11456
  }
12299
11457
  }
12300
11458
  addState(stateName, keepCurrentStates, hasAnimation) {
12301
- const transition = this.createStateModel().addState(stateName, keepCurrentStates);
11459
+ const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
12302
11460
  if (!transition.changed) {
12303
11461
  return;
12304
11462
  }
@@ -12339,7 +11497,7 @@ class Graphic extends Node {
12339
11497
  }
12340
11498
  const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12341
11499
  const previousResolvedStatePatch = this.resolvedStatePatch;
12342
- const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates);
11500
+ const { transition, effectiveStates, resolvedStateAttrs } = this.resolveGraphicStateTransition(states);
12343
11501
  if (!transition.changed && this.sameStateNames(previousStates, transition.states)) {
12344
11502
  return;
12345
11503
  }
@@ -12347,18 +11505,10 @@ class Graphic extends Node {
12347
11505
  return;
12348
11506
  }
12349
11507
  this.currentStates = transition.states;
12350
- this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
11508
+ this.effectiveStates = [...effectiveStates];
12351
11509
  this.resolvedStatePatch = resolvedStateAttrs;
12352
11510
  this.sharedStateDirty = false;
12353
11511
  this.syncSharedStateActiveRegistrations();
12354
- if (this.stage) {
12355
- const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12356
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12357
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12358
- graphicId: this._uid,
12359
- targetStates: [...transition.states]
12360
- });
12361
- }
12362
11512
  if (hasAnimation) {
12363
11513
  this._syncFinalAttributeFromStaticTruth();
12364
11514
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
@@ -12622,12 +11772,10 @@ class Graphic extends Node {
12622
11772
  }
12623
11773
  this.boundSharedStateScope = undefined;
12624
11774
  this.boundSharedStateRevision = undefined;
12625
- this.localFallbackCompiledDefinitions = undefined;
12626
11775
  this.compiledStateDefinitions = undefined;
12627
11776
  this.compiledStateDefinitionsCacheKey = undefined;
12628
11777
  this.stateEngine = undefined;
12629
11778
  this.stateEngineCompiledDefinitions = undefined;
12630
- this.stateEngineStateProxyModeKey = undefined;
12631
11779
  this.sharedStateDirty = false;
12632
11780
  this.stage = null;
12633
11781
  this.layer = null;
@@ -14616,23 +13764,15 @@ class Glyph extends Graphic {
14616
13764
  states = states.sort(this.stateSort);
14617
13765
  }
14618
13766
  const stateAttrs = {};
14619
- const subAttrs = this.subGraphic.map(() => ({}));
14620
13767
  states.forEach(stateName => {
14621
- var _a;
14622
13768
  const attrs = this.glyphStateProxy ? this.glyphStateProxy(stateName, states) : this.glyphStates[stateName];
14623
13769
  if (attrs) {
14624
13770
  Object.assign(stateAttrs, attrs.attributes);
14625
- if ((_a = attrs.subAttributes) === null || _a === void 0 ? void 0 : _a.length) {
14626
- subAttrs.forEach((subAttrs, index) => {
14627
- Object.assign(subAttrs, attrs.subAttributes[index]);
14628
- });
14629
- }
14630
13771
  }
14631
13772
  });
14632
13773
  if (!this.beforeStateUpdate(stateAttrs, previousStates, states, hasAnimation, false)) {
14633
13774
  return;
14634
13775
  }
14635
- this.updateNormalAttrs(stateAttrs);
14636
13776
  this.currentStates = states;
14637
13777
  this.applyStateAttrs(stateAttrs, states, hasAnimation);
14638
13778
  }
@@ -14649,7 +13789,6 @@ class Glyph extends Graphic {
14649
13789
  else {
14650
13790
  this.currentStates = [];
14651
13791
  }
14652
- this.normalAttrs = null;
14653
13792
  }
14654
13793
  clone() {
14655
13794
  const glyph = new Glyph(Object.assign({}, this.attribute));
@@ -17091,7 +16230,6 @@ class Group extends Graphic {
17091
16230
  this.type = 'group';
17092
16231
  this.parent = null;
17093
16232
  this.isContainer = true;
17094
- this._hasSharedStateDefinitions = false;
17095
16233
  this.numberType = GROUP_NUMBER_TYPE;
17096
16234
  this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
17097
16235
  }
@@ -17104,7 +16242,6 @@ class Group extends Graphic {
17104
16242
  }
17105
16243
  const previousScope = this.sharedStateScope;
17106
16244
  this._sharedStateDefinitions = value;
17107
- this._hasSharedStateDefinitions = !!value && Object.keys(value).length > 0;
17108
16245
  this.ensureSharedStateScopeBound();
17109
16246
  if (this.sharedStateScope) {
17110
16247
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, value);
@@ -17249,13 +16386,7 @@ class Group extends Graphic {
17249
16386
  incrementalAppendChild(node) {
17250
16387
  const data = super.appendChild(node);
17251
16388
  if (data) {
17252
- if (this.stage &&
17253
- (data.stage !== this.stage || data.layer !== this.layer)) {
17254
- data.setStage(this.stage, this.layer);
17255
- }
17256
- else if (data.onParentSharedStateTreeChanged) {
17257
- data.onParentSharedStateTreeChanged(this.stage, this.layer);
17258
- }
16389
+ this.syncChildSharedStateTreeBinding(data);
17259
16390
  }
17260
16391
  this.addUpdateBoundTag();
17261
16392
  this.getGraphicService().onAddIncremental(node, this, this.stage);
@@ -17269,12 +16400,7 @@ class Group extends Graphic {
17269
16400
  }
17270
16401
  _updateChildToStage(child) {
17271
16402
  if (child) {
17272
- if (this.stage && (child.stage !== this.stage || child.layer !== this.layer)) {
17273
- child.setStage(this.stage, this.layer);
17274
- }
17275
- else if (child.onParentSharedStateTreeChanged) {
17276
- child.onParentSharedStateTreeChanged(this.stage, this.layer);
17277
- }
16403
+ this.syncChildSharedStateTreeBinding(child);
17278
16404
  }
17279
16405
  this.addUpdateBoundTag();
17280
16406
  return child;
@@ -17282,13 +16408,8 @@ class Group extends Graphic {
17282
16408
  appendChild(node, addStage = true) {
17283
16409
  const data = super.appendChild(node);
17284
16410
  if (data) {
17285
- if (addStage &&
17286
- this.stage &&
17287
- (data.stage !== this.stage || data.layer !== this.layer)) {
17288
- data.setStage(this.stage, this.layer);
17289
- }
17290
- else if (data.onParentSharedStateTreeChanged) {
17291
- data.onParentSharedStateTreeChanged(this.stage, this.layer);
16411
+ if (addStage) {
16412
+ this.syncChildSharedStateTreeBinding(data);
17292
16413
  }
17293
16414
  }
17294
16415
  this.addUpdateBoundTag();
@@ -17304,13 +16425,12 @@ class Group extends Graphic {
17304
16425
  return this._updateChildToStage(super.insertInto(newNode, idx));
17305
16426
  }
17306
16427
  removeChild(child, highPerformance = false) {
17307
- var _a;
17308
16428
  const data = super.removeChild(child);
17309
16429
  if (!data) {
17310
16430
  return data;
17311
16431
  }
17312
16432
  if (highPerformance) {
17313
- (_a = child.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(child);
16433
+ child.detachStageForRelease();
17314
16434
  return data;
17315
16435
  }
17316
16436
  this.getGraphicService().onRemove(child);
@@ -17335,7 +16455,7 @@ class Group extends Graphic {
17335
16455
  setStage(stage, layer) {
17336
16456
  var _a, _b, _c, _d, _e, _f;
17337
16457
  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;
17338
- const needsSharedStateTreeSync = this._hasSharedStateDefinitions ||
16458
+ const needsSharedStateTreeSync = this.hasSharedStateDefinitions() ||
17339
16459
  this.sharedStateScope ||
17340
16460
  ((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
17341
16461
  this.boundSharedStateScope ||
@@ -17351,9 +16471,7 @@ class Group extends Graphic {
17351
16471
  this.setStageToShadowRoot(stage, layer);
17352
16472
  this._onSetStage && this._onSetStage(this, stage, layer);
17353
16473
  (_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
17354
- this.forEachChildren(item => {
17355
- item.setStage(stage, this.layer);
17356
- });
16474
+ this.notifyChildrenSharedStateTreeChanged();
17357
16475
  return;
17358
16476
  }
17359
16477
  const layerChanged = this.layer !== layer;
@@ -17366,11 +16484,7 @@ class Group extends Graphic {
17366
16484
  this.notifyChildrenSharedStateTreeChanged();
17367
16485
  }
17368
16486
  else if (layerChanged) {
17369
- this.forEachChildren(item => {
17370
- if (item.onParentSharedStateTreeChanged) {
17371
- item.onParentSharedStateTreeChanged(stage, this.layer);
17372
- }
17373
- });
16487
+ this.notifyChildrenSharedStateTreeChanged();
17374
16488
  }
17375
16489
  }
17376
16490
  addUpdatePositionTag() {
@@ -17442,8 +16556,7 @@ class Group extends Graphic {
17442
16556
  super.detachStageForRelease();
17443
16557
  this.sharedStateScope = undefined;
17444
16558
  this.forEachChildren((item) => {
17445
- var _a;
17446
- (_a = item.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(item);
16559
+ item.detachStageForRelease();
17447
16560
  });
17448
16561
  }
17449
16562
  ensureSharedStateScopeBound() {
@@ -17457,7 +16570,6 @@ class Group extends Graphic {
17457
16570
  this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
17458
16571
  return;
17459
16572
  }
17460
- this.sharedStateScope.ownerGroup = this;
17461
16573
  this.sharedStateScope.ownerStage = this.stage;
17462
16574
  setSharedStateScopeParent(this.sharedStateScope, parentScope);
17463
16575
  if (this.sharedStateScope.localStateDefinitions !== this._sharedStateDefinitions) {
@@ -17465,15 +16577,16 @@ class Group extends Graphic {
17465
16577
  }
17466
16578
  }
17467
16579
  hasSharedStateDefinitions() {
17468
- return this._hasSharedStateDefinitions;
16580
+ return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
17469
16581
  }
17470
16582
  notifyChildrenSharedStateTreeChanged() {
17471
16583
  this.forEachChildren(item => {
17472
- if (item.onParentSharedStateTreeChanged) {
17473
- item.onParentSharedStateTreeChanged(this.stage, this.layer);
17474
- }
16584
+ this.syncChildSharedStateTreeBinding(item);
17475
16585
  });
17476
16586
  }
16587
+ syncChildSharedStateTreeBinding(child) {
16588
+ child.onParentSharedStateTreeChanged(this.stage, this.layer);
16589
+ }
17477
16590
  onParentSharedStateTreeChanged(stage, layer) {
17478
16591
  var _a;
17479
16592
  if (this.stage !== stage || this.layer !== layer) {
@@ -19574,11 +18687,6 @@ class RendererRegistry {
19574
18687
  this.entries.set(key, renderer);
19575
18688
  this.cache.delete(key);
19576
18689
  }
19577
- registerMany(entries) {
19578
- for (const [key, renderer] of entries) {
19579
- this.register(key, renderer);
19580
- }
19581
- }
19582
18690
  get(key) {
19583
18691
  if (this.cache.has(key)) {
19584
18692
  return this.cache.get(key);
@@ -19609,11 +18717,6 @@ class PickerRegistry {
19609
18717
  register(key, picker) {
19610
18718
  this.entries.set(key, picker);
19611
18719
  }
19612
- registerMany(entries) {
19613
- for (const [key, picker] of entries) {
19614
- this.register(key, picker);
19615
- }
19616
- }
19617
18720
  get(key) {
19618
18721
  return this.entries.get(key);
19619
18722
  }
@@ -19656,11 +18759,6 @@ class ContributionRegistry {
19656
18759
  current.push(contribution);
19657
18760
  this.entries.set(key, current);
19658
18761
  }
19659
- registerMany(entries) {
19660
- for (const [key, contribution] of entries) {
19661
- this.register(key, contribution);
19662
- }
19663
- }
19664
18762
  get(key) {
19665
18763
  var _a;
19666
18764
  return [...((_a = this.entries.get(key)) !== null && _a !== void 0 ? _a : [])];
@@ -19685,13 +18783,12 @@ const EMPTY_AUTO_ENABLE_PROVIDER = {
19685
18783
  };
19686
18784
  class DefaultPluginService {
19687
18785
  constructor(autoEnablePlugins = EMPTY_AUTO_ENABLE_PROVIDER, deps = {}) {
19688
- var _a, _b, _c;
18786
+ var _a;
19689
18787
  this.autoEnablePlugins = autoEnablePlugins;
19690
18788
  this.onStartupFinishedPlugin = [];
19691
18789
  this.onRegisterPlugin = [];
19692
18790
  this.actived = false;
19693
18791
  this.pluginRegistry = (_a = deps.pluginRegistry) !== null && _a !== void 0 ? _a : new PluginRegistry();
19694
- this.autoEnablePlugins = (_c = (_b = deps.autoEnablePlugins) !== null && _b !== void 0 ? _b : this.autoEnablePlugins) !== null && _c !== void 0 ? _c : EMPTY_AUTO_ENABLE_PROVIDER;
19695
18792
  }
19696
18793
  active(stage, params) {
19697
18794
  this.stage = stage;
@@ -19963,7 +19060,7 @@ class DirtyBoundsPlugin {
19963
19060
  this.key = this.name + this._uid;
19964
19061
  this.dirtyBoundsHooksRegistered = false;
19965
19062
  this.handlePaintOnlyUpdate = (graphic) => {
19966
- var _a, _b, _c, _d;
19063
+ var _a;
19967
19064
  const stage = this.pluginService.stage;
19968
19065
  if (!(stage && stage === graphic.stage && stage.renderCount)) {
19969
19066
  return;
@@ -19976,7 +19073,7 @@ class DirtyBoundsPlugin {
19976
19073
  if (ownerBounds && !ownerBounds.empty()) {
19977
19074
  stage.dirty(ownerBounds);
19978
19075
  }
19979
- (_b = owner.clearUpdatePaintTag) === null || _b === void 0 ? void 0 : _b.call(owner);
19076
+ owner.clearUpdatePaintTag();
19980
19077
  const shadowRoot = owner.shadowRoot;
19981
19078
  if (!shadowRoot) {
19982
19079
  return;
@@ -19985,29 +19082,25 @@ class DirtyBoundsPlugin {
19985
19082
  if (shadowBounds && !shadowBounds.empty()) {
19986
19083
  stage.dirty(shadowBounds);
19987
19084
  }
19988
- (_d = (_c = shadowRoot).clearUpdatePaintTag) === null || _d === void 0 ? void 0 : _d.call(_c);
19085
+ shadowRoot.clearUpdatePaintTag();
19989
19086
  };
19990
19087
  }
19991
19088
  ensurePaintDirtyBoundsCache(graphic) {
19992
- var _a, _b;
19089
+ var _a;
19993
19090
  const owner = graphic;
19994
- const hasLocalBounds = owner._AABBBounds && typeof owner._AABBBounds.empty === 'function' && !owner._AABBBounds.empty();
19995
- if (!hasLocalBounds && typeof owner.doUpdateAABBBounds === 'function') {
19091
+ if (owner._AABBBounds.empty()) {
19996
19092
  owner.doUpdateAABBBounds(((_a = owner.attribute) === null || _a === void 0 ? void 0 : _a.boundsMode) === 'imprecise');
19997
19093
  }
19998
- const hasGlobalBounds = owner._globalAABBBounds &&
19999
- typeof owner._globalAABBBounds.empty === 'function' &&
20000
- !owner._globalAABBBounds.empty();
20001
- if (!hasGlobalBounds && typeof owner.tryUpdateGlobalAABBBounds === 'function') {
19094
+ if (!owner._globalAABBBounds || owner._globalAABBBounds.empty()) {
20002
19095
  owner.tryUpdateGlobalAABBBounds();
20003
19096
  }
20004
- return (_b = owner._globalAABBBounds) !== null && _b !== void 0 ? _b : owner.globalAABBBounds;
19097
+ return owner._globalAABBBounds;
20005
19098
  }
20006
19099
  getRemoveDirtyBounds(graphic) {
20007
19100
  var _a;
20008
19101
  const owner = ((_a = graphic.glyphHost) !== null && _a !== void 0 ? _a : graphic);
20009
19102
  const cachedBounds = owner._globalAABBBounds;
20010
- if (cachedBounds && typeof cachedBounds.empty === 'function' && !cachedBounds.empty()) {
19103
+ if (cachedBounds && !cachedBounds.empty()) {
20011
19104
  return cachedBounds;
20012
19105
  }
20013
19106
  }
@@ -20143,387 +19236,6 @@ function getCurrentEnv() {
20143
19236
  return isBrowserEnv() ? 'browser' : 'node';
20144
19237
  }
20145
19238
 
20146
- function isRenderableGraphic(graphic) {
20147
- return !!graphic.stage && graphic.releaseStatus !== 'released';
20148
- }
20149
- function createTargetStatesKey(targetStates) {
20150
- return targetStates.length ? targetStates.join('|') : '__clear__';
20151
- }
20152
- function createIntentKey(contextOwnerId, configFingerprint, targetStatesKey) {
20153
- return `${contextOwnerId}:${configFingerprint}:${targetStatesKey}`;
20154
- }
20155
- function hasMeaningfulDeferredConfig(config) {
20156
- const normalized = normalizeDeferredStateOwnerConfig(config);
20157
- return !!normalized && (normalized.localEnabled != null || normalized.deferred != null);
20158
- }
20159
- function getGraphicCompiledDefinitions(graphic) {
20160
- const graphicAny = graphic;
20161
- if (typeof graphicAny.resolveEffectiveCompiledDefinitions === 'function') {
20162
- const result = graphicAny.resolveEffectiveCompiledDefinitions();
20163
- return {
20164
- compiledDefinitions: result.compiledDefinitions,
20165
- stateProxyEligibility: result.stateProxyEligibility
20166
- };
20167
- }
20168
- return {};
20169
- }
20170
- function getCurrentStateNames(graphic) {
20171
- var _a, _b;
20172
- return (_b = (_a = graphic.currentStates) === null || _a === void 0 ? void 0 : _a.slice()) !== null && _b !== void 0 ? _b : [];
20173
- }
20174
- class StateBatchScheduler {
20175
- constructor(stage, perfMonitor) {
20176
- this.stage = stage;
20177
- this.perfMonitor = perfMonitor;
20178
- this.jobsByIntentKey = new Map();
20179
- this.pendingIntentByGraphic = new Map();
20180
- this.nextJobId = 1;
20181
- this.runningJobs = new Map();
20182
- }
20183
- schedule(graphics, targetStates) {
20184
- const batchOperation = graphics.length > 1;
20185
- graphics.forEach(graphic => {
20186
- const eligibility = this.resolveEligibility(graphic, targetStates, batchOperation, true);
20187
- if ('reason' in eligibility) {
20188
- this.removeGraphicFromPending(graphic);
20189
- if (eligibility.reason !== 'graphic_unavailable') {
20190
- this.commitSynchronously(graphic, targetStates);
20191
- }
20192
- return;
20193
- }
20194
- this.enqueueDeferredIntent(graphic, targetStates, eligibility.context, eligibility.targetStatesKey);
20195
- });
20196
- }
20197
- release() {
20198
- var _a;
20199
- this.jobsByIntentKey.forEach(job => {
20200
- job.status = 'cancelled';
20201
- });
20202
- this.jobsByIntentKey.clear();
20203
- this.pendingIntentByGraphic.clear();
20204
- this.runningJobs.clear();
20205
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.updateBatchPending(0);
20206
- }
20207
- resolveEligibility(graphic, targetStates, batchOperation, recordObservability) {
20208
- var _a, _b, _c, _d, _e, _f;
20209
- if (!isRenderableGraphic(graphic)) {
20210
- if (recordObservability) {
20211
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.recordDeferredIneligible('graphic_unavailable');
20212
- }
20213
- return { eligible: false, reason: 'graphic_unavailable' };
20214
- }
20215
- if (!batchOperation) {
20216
- if (recordObservability) {
20217
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.recordDeferredIneligible('non_batch_operation');
20218
- }
20219
- return { eligible: false, reason: 'non_batch_operation' };
20220
- }
20221
- const context = this.resolveDeferredContext(graphic);
20222
- if (!context) {
20223
- if (recordObservability) {
20224
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.recordDeferredIneligible('graphic_unavailable');
20225
- }
20226
- return { eligible: false, reason: 'graphic_unavailable' };
20227
- }
20228
- if (!context.config.enabled) {
20229
- const normalizedOwnerConfig = normalizeDeferredStateOwnerConfig(context.contextOwner.deferredStateConfig);
20230
- const reason = (normalizedOwnerConfig === null || normalizedOwnerConfig === void 0 ? void 0 : normalizedOwnerConfig.localEnabled) === false ? 'context_disabled' : 'config_disabled';
20231
- if (recordObservability) {
20232
- (_d = this.perfMonitor) === null || _d === void 0 ? void 0 : _d.recordDeferredIneligible(reason);
20233
- }
20234
- return { eligible: false, reason };
20235
- }
20236
- const classification = this.classifyGraphicTargetStates(graphic, targetStates);
20237
- if (classification.reason) {
20238
- if (recordObservability) {
20239
- (_e = this.perfMonitor) === null || _e === void 0 ? void 0 : _e.recordDeferredIneligible(classification.reason);
20240
- }
20241
- return { eligible: false, reason: classification.reason };
20242
- }
20243
- if (classification.category !== UpdateCategory.PAINT) {
20244
- if (recordObservability) {
20245
- (_f = this.perfMonitor) === null || _f === void 0 ? void 0 : _f.recordDeferredIneligible('mixed_update_category');
20246
- }
20247
- return { eligible: false, reason: 'mixed_update_category' };
20248
- }
20249
- return {
20250
- eligible: true,
20251
- context,
20252
- targetStatesKey: createTargetStatesKey(targetStates)
20253
- };
20254
- }
20255
- resolveDeferredContext(graphic) {
20256
- var _a;
20257
- const stage = graphic.stage;
20258
- if (!stage) {
20259
- return undefined;
20260
- }
20261
- let owner = stage;
20262
- let config = normalizeDeferredStateConfig(undefined);
20263
- const ownerConfigs = [stage];
20264
- const parents = [];
20265
- let parent = graphic.parent;
20266
- while (parent && parent !== stage) {
20267
- parents.push(parent);
20268
- parent = parent.parent;
20269
- }
20270
- parents.reverse().forEach(current => ownerConfigs.push(current));
20271
- ownerConfigs.forEach(current => {
20272
- const deferredStateConfig = normalizeDeferredStateOwnerConfig(current.deferredStateConfig);
20273
- if (!deferredStateConfig) {
20274
- return;
20275
- }
20276
- if (deferredStateConfig.deferred) {
20277
- config = Object.assign(Object.assign({}, config), deferredStateConfig.deferred);
20278
- }
20279
- if (deferredStateConfig.localEnabled != null) {
20280
- config.enabled = deferredStateConfig.localEnabled;
20281
- }
20282
- if (hasMeaningfulDeferredConfig(current.deferredStateConfig)) {
20283
- owner = current;
20284
- }
20285
- });
20286
- const normalized = normalizeDeferredStateConfig(config);
20287
- return {
20288
- contextOwner: owner,
20289
- contextOwnerId: (_a = owner._uid) !== null && _a !== void 0 ? _a : 0,
20290
- config: normalized,
20291
- configFingerprint: fingerprintDeferredStateConfig(normalized)
20292
- };
20293
- }
20294
- classifyGraphicTargetStates(graphic, targetStates) {
20295
- const { compiledDefinitions, stateProxyEligibility } = getGraphicCompiledDefinitions(graphic);
20296
- const candidateStates = Array.from(new Set([...getCurrentStateNames(graphic), ...targetStates]));
20297
- let category = UpdateCategory.NONE;
20298
- candidateStates.forEach(stateName => {
20299
- if (stateProxyEligibility === null || stateProxyEligibility === void 0 ? void 0 : stateProxyEligibility(stateName)) {
20300
- category = UpdateCategory.NONE;
20301
- return;
20302
- }
20303
- const definition = compiledDefinitions === null || compiledDefinitions === void 0 ? void 0 : compiledDefinitions.get(stateName);
20304
- if (!definition) {
20305
- return;
20306
- }
20307
- if (definition.hasResolver && definition.affectedKeys.size === 0) {
20308
- category = UpdateCategory.NONE;
20309
- return;
20310
- }
20311
- category |= classifyAffectedKeys(definition.affectedKeys);
20312
- });
20313
- if (candidateStates.some(stateName => stateProxyEligibility === null || stateProxyEligibility === void 0 ? void 0 : stateProxyEligibility(stateName)) ||
20314
- candidateStates.some(stateName => {
20315
- const definition = compiledDefinitions === null || compiledDefinitions === void 0 ? void 0 : compiledDefinitions.get(stateName);
20316
- return !!(definition === null || definition === void 0 ? void 0 : definition.hasResolver) && definition.affectedKeys.size === 0;
20317
- })) {
20318
- return {
20319
- category: UpdateCategory.NONE,
20320
- reason: 'resolver_unstable_keys'
20321
- };
20322
- }
20323
- return {
20324
- category: category === UpdateCategory.NONE ? UpdateCategory.PAINT : category
20325
- };
20326
- }
20327
- enqueueDeferredIntent(graphic, targetStates, context, targetStatesKey) {
20328
- var _a, _b, _c, _d, _e, _f;
20329
- const nextIntentKey = createIntentKey(context.contextOwnerId, context.configFingerprint, targetStatesKey);
20330
- const prevIntentKey = this.pendingIntentByGraphic.get(graphic);
20331
- if (prevIntentKey === nextIntentKey) {
20332
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.incrementCounter('deferredJobsCoalesced');
20333
- return;
20334
- }
20335
- if (prevIntentKey) {
20336
- this.removeGraphicFromIntentJob(graphic, prevIntentKey);
20337
- }
20338
- let job = this.jobsByIntentKey.get(nextIntentKey);
20339
- if (!job) {
20340
- job = {
20341
- id: this.nextJobId++,
20342
- kind: 'apply_states',
20343
- intentKey: nextIntentKey,
20344
- status: 'pending',
20345
- targetStates: [...targetStates],
20346
- targetStatesKey,
20347
- pendingGraphics: new Set(),
20348
- orderedGraphics: [],
20349
- config: context.config,
20350
- contextOwner: context.contextOwner,
20351
- contextOwnerId: context.contextOwnerId,
20352
- configFingerprint: context.configFingerprint,
20353
- createdAt: Date.now(),
20354
- processedCount: 0
20355
- };
20356
- this.jobsByIntentKey.set(nextIntentKey, job);
20357
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.incrementCounter('deferredJobsCreated');
20358
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.updateBatchPending(this.jobsByIntentKey.size);
20359
- }
20360
- else {
20361
- (_d = this.perfMonitor) === null || _d === void 0 ? void 0 : _d.incrementCounter('deferredJobsCoalesced');
20362
- }
20363
- if (!job.pendingGraphics.has(graphic)) {
20364
- job.pendingGraphics.add(graphic);
20365
- job.orderedGraphics.push(graphic);
20366
- this.pendingIntentByGraphic.set(graphic, nextIntentKey);
20367
- (_e = this.perfMonitor) === null || _e === void 0 ? void 0 : _e.recordAllocation('batchEntriesCreated');
20368
- (_f = this.perfMonitor) === null || _f === void 0 ? void 0 : _f.updateMaxGraphicsInJob(job.pendingGraphics.size);
20369
- }
20370
- this.ensureJobRunning(job);
20371
- }
20372
- removeGraphicFromPending(graphic) {
20373
- const prevIntentKey = this.pendingIntentByGraphic.get(graphic);
20374
- if (!prevIntentKey) {
20375
- return;
20376
- }
20377
- this.removeGraphicFromIntentJob(graphic, prevIntentKey);
20378
- }
20379
- removeGraphicFromIntentJob(graphic, intentKey) {
20380
- var _a, _b, _c;
20381
- const job = this.jobsByIntentKey.get(intentKey);
20382
- if (!job) {
20383
- this.pendingIntentByGraphic.delete(graphic);
20384
- return;
20385
- }
20386
- job.pendingGraphics.delete(graphic);
20387
- if (this.pendingIntentByGraphic.get(graphic) === intentKey) {
20388
- this.pendingIntentByGraphic.delete(graphic);
20389
- }
20390
- if (job.pendingGraphics.size === 0 && job.status !== 'completed') {
20391
- job.status = 'cancelled';
20392
- this.jobsByIntentKey.delete(intentKey);
20393
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.incrementCounter('deferredJobsCancelled');
20394
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.recordEvent('deferred-job-cancel', {
20395
- intentKey,
20396
- jobId: job.id
20397
- });
20398
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.updateBatchPending(this.jobsByIntentKey.size);
20399
- }
20400
- }
20401
- ensureJobRunning(job) {
20402
- if (this.runningJobs.has(job.intentKey)) {
20403
- return;
20404
- }
20405
- const runner = this.runJob(job).then(() => {
20406
- this.runningJobs.delete(job.intentKey);
20407
- }, () => {
20408
- this.runningJobs.delete(job.intentKey);
20409
- });
20410
- this.runningJobs.set(job.intentKey, runner);
20411
- }
20412
- runJob(job) {
20413
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
20414
- return __awaiter(this, void 0, void 0, function* () {
20415
- if (job.status === 'cancelled') {
20416
- return;
20417
- }
20418
- yield this.waitForNextFrame();
20419
- if (job.status === 'cancelled') {
20420
- return;
20421
- }
20422
- job.status = 'running';
20423
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.recordEvent('deferred-job-start', {
20424
- intentKey: job.intentKey,
20425
- jobId: job.id
20426
- });
20427
- let index = 0;
20428
- let frameStart = performance.now();
20429
- let processedInFrame = 0;
20430
- let committedInSlice = 0;
20431
- while (index < job.orderedGraphics.length) {
20432
- if (job.status === 'cancelled') {
20433
- return;
20434
- }
20435
- if (processedInFrame > 0 &&
20436
- (processedInFrame >= job.config.maxGraphicsPerFrame || performance.now() - frameStart >= job.config.frameBudget)) {
20437
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.incrementCounter('deferredBudgetYields');
20438
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.recordCost('batchSlice', performance.now() - frameStart);
20439
- (_d = this.perfMonitor) === null || _d === void 0 ? void 0 : _d.recordEvent('deferred-job-yield', {
20440
- intentKey: job.intentKey,
20441
- jobId: job.id,
20442
- processedInFrame
20443
- });
20444
- if (committedInSlice > 0) {
20445
- this.stage.renderNextFrame();
20446
- }
20447
- yield this.waitForNextFrame();
20448
- frameStart = performance.now();
20449
- processedInFrame = 0;
20450
- committedInSlice = 0;
20451
- }
20452
- const graphic = job.orderedGraphics[index++];
20453
- if (!job.pendingGraphics.has(graphic)) {
20454
- continue;
20455
- }
20456
- if (!isRenderableGraphic(graphic)) {
20457
- job.pendingGraphics.delete(graphic);
20458
- if (this.pendingIntentByGraphic.get(graphic) === job.intentKey) {
20459
- this.pendingIntentByGraphic.delete(graphic);
20460
- }
20461
- continue;
20462
- }
20463
- if (this.pendingIntentByGraphic.get(graphic) !== job.intentKey) {
20464
- job.pendingGraphics.delete(graphic);
20465
- continue;
20466
- }
20467
- const nextEligibility = this.resolveEligibility(graphic, job.targetStates, true, false);
20468
- if (!nextEligibility.eligible) {
20469
- job.pendingGraphics.delete(graphic);
20470
- this.pendingIntentByGraphic.delete(graphic);
20471
- this.commitSynchronously(graphic, job.targetStates);
20472
- continue;
20473
- }
20474
- const nextIntentKey = createIntentKey(nextEligibility.context.contextOwnerId, nextEligibility.context.configFingerprint, nextEligibility.targetStatesKey);
20475
- if (nextIntentKey !== job.intentKey) {
20476
- job.pendingGraphics.delete(graphic);
20477
- this.pendingIntentByGraphic.delete(graphic);
20478
- this.enqueueDeferredIntent(graphic, job.targetStates, nextEligibility.context, nextEligibility.targetStatesKey);
20479
- continue;
20480
- }
20481
- this.commitSynchronously(graphic, job.targetStates);
20482
- job.pendingGraphics.delete(graphic);
20483
- this.pendingIntentByGraphic.delete(graphic);
20484
- job.processedCount += 1;
20485
- processedInFrame += 1;
20486
- committedInSlice += 1;
20487
- (_e = this.perfMonitor) === null || _e === void 0 ? void 0 : _e.incrementCounter('deferredGraphicsCommitted');
20488
- }
20489
- if (processedInFrame > 0) {
20490
- (_f = this.perfMonitor) === null || _f === void 0 ? void 0 : _f.recordCost('batchSlice', performance.now() - frameStart);
20491
- this.stage.renderNextFrame();
20492
- }
20493
- if (job.pendingGraphics.size === 0 && this.jobsByIntentKey.get(job.intentKey) === job) {
20494
- job.status = 'completed';
20495
- this.jobsByIntentKey.delete(job.intentKey);
20496
- (_g = this.perfMonitor) === null || _g === void 0 ? void 0 : _g.incrementCounter('deferredJobsCompleted');
20497
- (_h = this.perfMonitor) === null || _h === void 0 ? void 0 : _h.recordEvent('deferred-job-complete', {
20498
- intentKey: job.intentKey,
20499
- jobId: job.id,
20500
- processedCount: job.processedCount
20501
- });
20502
- (_j = this.perfMonitor) === null || _j === void 0 ? void 0 : _j.updateBatchPending(this.jobsByIntentKey.size);
20503
- }
20504
- });
20505
- }
20506
- waitForNextFrame() {
20507
- const stageGlobal = this.stage.global;
20508
- if (stageGlobal === null || stageGlobal === void 0 ? void 0 : stageGlobal.getSpecifiedPerformanceRAF) {
20509
- return stageGlobal.getSpecifiedPerformanceRAF(this.stage.rafId).wait();
20510
- }
20511
- return new Promise(resolve => {
20512
- stageGlobal === null || stageGlobal === void 0 ? void 0 : stageGlobal.getSpecifiedRequestAnimationFrame(this.stage.rafId)(() => resolve());
20513
- });
20514
- }
20515
- commitSynchronously(graphic, targetStates) {
20516
- if (!isRenderableGraphic(graphic)) {
20517
- return;
20518
- }
20519
- if (!targetStates.length) {
20520
- graphic.clearStates(false);
20521
- return;
20522
- }
20523
- graphic.useStates(targetStates, false);
20524
- }
20525
- }
20526
-
20527
19239
  const DefaultConfig = {
20528
19240
  WIDTH: 500,
20529
19241
  HEIGHT: 500,
@@ -20704,14 +19416,12 @@ class Stage extends Group {
20704
19416
  this.theme.onStateDefinitionsChange = () => {
20705
19417
  var _a;
20706
19418
  const definitions = (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions;
20707
- if (!definitions || !Object.keys(definitions).length) {
20708
- if (this.rootSharedStateScope) {
20709
- setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions);
20710
- markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20711
- }
19419
+ const rootScope = definitions && Object.keys(definitions).length
19420
+ ? this.ensureRootSharedStateScope(definitions)
19421
+ : this.rootSharedStateScope;
19422
+ if (!rootScope) {
20712
19423
  return;
20713
19424
  }
20714
- const rootScope = this.ensureRootSharedStateScope(definitions);
20715
19425
  setRootSharedStateScopeThemeDefinitions(rootScope, definitions);
20716
19426
  markScopeActiveDescendantsDirty(rootScope, this);
20717
19427
  };
@@ -21143,21 +19853,6 @@ class Stage extends Group {
21143
19853
  this.rootSharedStateScope.ownerStage = this;
21144
19854
  return this.rootSharedStateScope;
21145
19855
  }
21146
- getStateBatchScheduler() {
21147
- if (!this._stateBatchScheduler) {
21148
- this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
21149
- }
21150
- return this._stateBatchScheduler;
21151
- }
21152
- scheduleStateBatch(graphics, targetStates) {
21153
- this.getStateBatchScheduler().schedule(graphics, targetStates);
21154
- }
21155
- getStatePerfSnapshot() {
21156
- return ensureStageStatePerfMonitor(this).getSnapshot();
21157
- }
21158
- resetStatePerfSnapshot() {
21159
- ensureStageStatePerfMonitor(this).reset();
21160
- }
21161
19856
  _doRenderInThisFrame() {
21162
19857
  if (this.releaseStatus === 'released') {
21163
19858
  return;
@@ -21291,8 +19986,7 @@ class Stage extends Group {
21291
19986
  throw new Error('暂不支持');
21292
19987
  }
21293
19988
  release() {
21294
- var _a, _b, _d, _e;
21295
- (_a = this._stateBatchScheduler) === null || _a === void 0 ? void 0 : _a.release();
19989
+ var _a, _b, _d;
21296
19990
  super.release();
21297
19991
  this.hooks.beforeRender.unTap('constructor', this.beforeRender);
21298
19992
  this.hooks.afterRender.unTap('constructor', this.afterRender);
@@ -21310,10 +20004,10 @@ class Stage extends Group {
21310
20004
  this.interactiveLayer.release();
21311
20005
  }
21312
20006
  this.window.release();
21313
- (_b = this._ticker) === null || _b === void 0 ? void 0 : _b.remTimeline(this === null || this === void 0 ? void 0 : this.timeline);
21314
- (_d = this._ticker) === null || _d === void 0 ? void 0 : _d.removeListener('tick', this.afterTickCb);
20007
+ (_a = this._ticker) === null || _a === void 0 ? void 0 : _a.remTimeline(this === null || this === void 0 ? void 0 : this.timeline);
20008
+ (_b = this._ticker) === null || _b === void 0 ? void 0 : _b.removeListener('tick', this.afterTickCb);
21315
20009
  if (!this.params.ticker) {
21316
- (_e = this._ticker) === null || _e === void 0 ? void 0 : _e.release();
20010
+ (_d = this._ticker) === null || _d === void 0 ? void 0 : _d.release();
21317
20011
  }
21318
20012
  this.renderService.renderTreeRoots = [];
21319
20013
  }
@@ -27609,18 +26303,12 @@ function createBrowserApp(options = {}) {
27609
26303
  }
27610
26304
 
27611
26305
  class NodeEntry extends BrowserEntry {
27612
- constructor(options = {}) {
27613
- super(options);
27614
- }
27615
26306
  }
27616
26307
  function createNodeApp(options = {}) {
27617
26308
  return new NodeEntry(options);
27618
26309
  }
27619
26310
 
27620
26311
  class MiniappEntry extends BrowserEntry {
27621
- constructor(options = {}) {
27622
- super(options);
27623
- }
27624
26312
  }
27625
26313
  function createMiniappApp(options = {}) {
27626
26314
  return new MiniappEntry(options);