@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
@@ -34,27 +34,21 @@ import { StateDefinitionCompiler } from "./state/state-definition-compiler";
34
34
 
35
35
  import { StateEngine } from "./state/state-engine";
36
36
 
37
- import { StateModel } from "./state/state-model";
38
-
39
37
  import { ATTRIBUTE_CATEGORY, UpdateCategory, classifyAttributeDelta } from "./state/attribute-update-classifier";
40
38
 
41
- import { StateStyleResolver } from "./state/state-style-resolver";
42
-
43
39
  import { StateTransitionOrchestrator } from "./state/state-transition-orchestrator";
44
40
 
45
41
  import { collectSharedStateScopeChain, ensureSharedStateScopeFresh } from "./state/shared-state-scope";
46
42
 
47
43
  import { enqueueGraphicSharedStateRefresh, scheduleStageSharedStateRefresh } from "./state/shared-state-refresh";
48
44
 
49
- import { getActiveStageStatePerfMonitor } from "./state/state-perf-monitor";
50
-
51
45
  const _tempBounds = new AABBBounds, loadShadowRootFactory = () => require("./shadow-root"), tempMatrix = new Matrix;
52
46
 
53
47
  export const PURE_STYLE_KEY = [ "stroke", "opacity", "strokeOpacity", "lineDash", "lineDashOffset", "lineCap", "lineJoin", "miterLimit", "fill", "fillOpacity" ];
54
48
 
55
49
  export const GRAPHIC_UPDATE_TAG_KEY = [ "lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible" ];
56
50
 
57
- const tempConstantXYKey = [ "x", "y" ], tempConstantScaleXYKey = [ "scaleX", "scaleY" ], tempConstantAngleKey = [ "angle" ], builtinTextureTypes = new Set([ "circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave" ]), FULL_STATE_DEFINITION_KEYS = new Set([ "name", "patch", "priority", "exclude", "suppress", "resolver", "declaredAffectedKeys" ]), point = new Point, EMPTY_STATE_NAMES = [], deprecatedLocalStateFallbackWarningStateNames = new Set, BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
51
+ const tempConstantXYKey = [ "x", "y" ], tempConstantScaleXYKey = [ "scaleX", "scaleY" ], tempConstantAngleKey = [ "angle" ], builtinTextureTypes = new Set([ "circle", "diamond", "rect", "vertical-line", "horizontal-line", "bias-lr", "bias-rl", "grid", "wave" ]), point = new Point, EMPTY_STATE_NAMES = [], BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT | UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.TRANSFORM | UpdateCategory.LAYOUT;
58
52
 
59
53
  function isPlainObjectValue(value) {
60
54
  return "object" == typeof value && null != value && !Array.isArray(value);
@@ -174,12 +168,6 @@ export class Graphic extends Node {
174
168
  getAttributes() {
175
169
  return this.attribute;
176
170
  }
177
- getStateStyleResolver(mergeMode) {
178
- return "deep" === mergeMode ? (this.deepStateStyleResolver || (this.deepStateStyleResolver = new StateStyleResolver({
179
- mergeMode: "deep"
180
- })), this.deepStateStyleResolver) : (this.stateStyleResolver || (this.stateStyleResolver = new StateStyleResolver),
181
- this.stateStyleResolver);
182
- }
183
171
  getStateTransitionOrchestrator() {
184
172
  return this.stateTransitionOrchestrator || (this.stateTransitionOrchestrator = new StateTransitionOrchestrator),
185
173
  this.stateTransitionOrchestrator;
@@ -198,9 +186,8 @@ export class Graphic extends Node {
198
186
  const nextScope = this.resolveBoundSharedStateScope();
199
187
  return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(),
200
188
  !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0,
201
- this.localFallbackCompiledDefinitions = void 0, this.compiledStateDefinitions = void 0,
202
- this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0,
203
- this.stateEngineStateProxyModeKey = void 0, this.syncSharedStateActiveRegistrations(),
189
+ this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0,
190
+ this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.syncSharedStateActiveRegistrations(),
204
191
  markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(),
205
192
  !0);
206
193
  }
@@ -245,15 +232,8 @@ export class Graphic extends Node {
245
232
  getLocalStatesVersion() {
246
233
  var _a, _b;
247
234
  return this.localStateDefinitionsSource !== this.states && (this.localStateDefinitionsSource = this.states,
248
- this.localFallbackVersion = (null !== (_a = this.localFallbackVersion) && void 0 !== _a ? _a : 0) + 1),
249
- null !== (_b = this.localFallbackVersion) && void 0 !== _b ? _b : 0;
250
- }
251
- warnDeprecatedLocalStatesFallback(stateNames) {
252
- for (let index = 0; index < stateNames.length; index++) {
253
- const stateName = stateNames[index];
254
- deprecatedLocalStateFallbackWarningStateNames.has(stateName) || (deprecatedLocalStateFallbackWarningStateNames.add(stateName),
255
- console.warn(`[VRender] graphic.states fallback for missing shared state definition "${stateName}" is deprecated. Move the state definition to sharedStateDefinitions or use stateProxy for dynamic per-graphic styles.`));
256
- }
235
+ this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1),
236
+ null !== (_b = this.localStateDefinitionsVersion) && void 0 !== _b ? _b : 0;
257
237
  }
258
238
  resolveEffectiveCompiledDefinitions() {
259
239
  this.syncSharedStateScopeBindingFromTree(!1);
@@ -262,46 +242,23 @@ export class Graphic extends Node {
262
242
  const hasStates = !!this.states && Object.keys(this.states).length > 0;
263
243
  if (!boundScope) {
264
244
  if (!hasStates) return {
265
- compiledDefinitions: void 0,
266
- stateProxyModeKey: "none"
245
+ compiledDefinitions: void 0
267
246
  };
268
247
  const cacheKey = `local:${this.getLocalStatesVersion()}`;
269
248
  return this.compiledStateDefinitions && this.compiledStateDefinitionsCacheKey === cacheKey || (this.compiledStateDefinitions = (new StateDefinitionCompiler).compile(this.states),
270
249
  this.compiledStateDefinitionsCacheKey = cacheKey), {
271
- compiledDefinitions: this.compiledStateDefinitions,
272
- stateProxyModeKey: this.stateProxy ? "legacy-all" : "none"
250
+ compiledDefinitions: this.compiledStateDefinitions
273
251
  };
274
252
  }
275
- const sharedCompiledDefinitions = boundScope.effectiveCompiledDefinitions, sharedStateProxyModeKey = this.stateProxy ? "shared-missing-only" : "none", sharedStateProxyEligibility = this.stateProxy ? stateName => !sharedCompiledDefinitions.has(stateName) : void 0;
276
- if (!hasStates) return this.localFallbackCompiledDefinitions = void 0, {
277
- compiledDefinitions: sharedCompiledDefinitions,
278
- stateProxyModeKey: sharedStateProxyModeKey,
279
- stateProxyEligibility: sharedStateProxyEligibility
280
- };
281
- const localStates = this.states, missingLocalStateDefinitions = {}, missingStateNames = [];
282
- if (Object.keys(localStates).forEach((stateName => {
283
- sharedCompiledDefinitions.has(stateName) || (missingLocalStateDefinitions[stateName] = localStates[stateName],
284
- missingStateNames.push(stateName));
285
- })), !missingStateNames.length) return this.localFallbackCompiledDefinitions = void 0,
286
- {
287
- compiledDefinitions: sharedCompiledDefinitions,
288
- stateProxyModeKey: sharedStateProxyModeKey,
289
- stateProxyEligibility: sharedStateProxyEligibility
290
- };
291
- this.warnDeprecatedLocalStatesFallback(missingStateNames);
292
- const localStatesVersion = this.getLocalStatesVersion(), stateProxyModeKey = this.stateProxy ? `missing:${missingStateNames.sort().join("|")}` : "none", cacheKey = `shared:${boundScope.revision}:fallback:${localStatesVersion}:${stateProxyModeKey}`;
293
- return this.localFallbackCompiledDefinitions && this.compiledStateDefinitionsCacheKey === cacheKey || (this.localFallbackCompiledDefinitions = (new StateDefinitionCompiler).compile(Object.assign(Object.assign({}, boundScope.effectiveSourceDefinitions), missingLocalStateDefinitions)),
294
- this.compiledStateDefinitionsCacheKey = cacheKey), {
295
- compiledDefinitions: this.localFallbackCompiledDefinitions,
296
- stateProxyModeKey: stateProxyModeKey,
297
- stateProxyEligibility: sharedStateProxyEligibility
253
+ return {
254
+ compiledDefinitions: boundScope.effectiveCompiledDefinitions
298
255
  };
299
256
  }
300
257
  recomputeCurrentStatePatch() {
301
258
  var _a, _b;
302
259
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)) return this.effectiveStates = [],
303
260
  this.resolvedStatePatch = void 0, void this.syncSharedStateActiveRegistrations();
304
- const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(), transition = this.createStateModel(stateResolveBaseAttrs).useStates(this.currentStates), effectiveStates = null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states, resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
261
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(), transition = this.resolveUseStatesTransition(this.currentStates, stateResolveBaseAttrs), effectiveStates = null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states, resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
305
262
  this.currentStates = transition.states, this.effectiveStates = [ ...effectiveStates ],
306
263
  this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
307
264
  }
@@ -364,13 +321,8 @@ export class Graphic extends Node {
364
321
  category | nextCategory;
365
322
  }
366
323
  submitUpdateByCategory(category, forceUpdateTag = !1) {
367
- var _a;
368
324
  if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(),
369
325
  void this.addUpdateLayoutTag();
370
- if (category !== UpdateCategory.NONE) {
371
- const stage = this.stage;
372
- stage && (null === (_a = getActiveStageStatePerfMonitor(stage)) || void 0 === _a || _a.recordCategory(category));
373
- }
374
326
  (category & BROAD_UPDATE_CATEGORY) !== BROAD_UPDATE_CATEGORY ? (category & UpdateCategory.SHAPE ? this.addUpdateShapeAndBoundsTag() : category & UpdateCategory.BOUNDS && this.addUpdateBoundTag(),
375
327
  category & UpdateCategory.PAINT && this.addUpdatePaintTag(), category & UpdateCategory.TRANSFORM && this.addUpdatePositionTag(),
376
328
  category & UpdateCategory.LAYOUT && this.addUpdateLayoutTag()) : this.addBroadUpdateTag();
@@ -902,95 +854,90 @@ export class Graphic extends Node {
902
854
  return null === (_a = this.stateEngine) || void 0 === _a || _a.setResolveContext(this, stateResolveBaseAttrs),
903
855
  stateResolveBaseAttrs;
904
856
  }
905
- createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
906
- const {compiledDefinitions: compiledDefinitions, stateProxyEligibility: stateProxyEligibility, stateProxyModeKey: stateProxyModeKey} = this.resolveEffectiveCompiledDefinitions();
907
- return this.compiledStateDefinitions = compiledDefinitions, compiledDefinitions ? this.stateEngine && this.stateEngineCompiledDefinitions === compiledDefinitions && this.stateEngineStateProxy === this.stateProxy && this.stateEngineStateSort === this.stateSort && this.stateEngineMergeMode === this.stateMergeMode && this.stateEngineStateProxyModeKey === stateProxyModeKey || (this.stateEngine = new StateEngine({
857
+ ensureStateEngine(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
858
+ const {compiledDefinitions: compiledDefinitions} = this.resolveEffectiveCompiledDefinitions();
859
+ return this.compiledStateDefinitions = compiledDefinitions, compiledDefinitions ? this.stateEngine && this.stateEngineCompiledDefinitions === compiledDefinitions && this.stateEngineStateSort === this.stateSort && this.stateEngineMergeMode === this.stateMergeMode || (this.stateEngine = new StateEngine({
908
860
  compiledDefinitions: compiledDefinitions,
909
861
  stateSort: this.stateSort,
910
- stateProxy: this.stateProxy,
911
- stateProxyEligibility: stateProxyEligibility,
912
- states: this.states,
913
862
  mergeMode: this.stateMergeMode
914
- }), this.stateEngineCompiledDefinitions = compiledDefinitions, this.stateEngineStateProxy = this.stateProxy,
915
- this.stateEngineStateSort = this.stateSort, this.stateEngineMergeMode = this.stateMergeMode,
916
- this.stateEngineStateProxyModeKey = stateProxyModeKey) : (this.stateEngine = void 0,
917
- this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0),
918
- this.syncStateResolveContext(stateResolveBaseAttrs), new StateModel({
919
- states: this.states,
920
- currentStates: this.currentStates,
921
- stateSort: this.stateSort,
922
- stateProxy: this.stateProxy,
923
- stateEngine: this.stateEngine
924
- });
863
+ }), this.stateEngineCompiledDefinitions = compiledDefinitions, this.stateEngineStateSort = this.stateSort,
864
+ this.stateEngineMergeMode = this.stateMergeMode) : (this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0),
865
+ this.syncStateResolveContext(stateResolveBaseAttrs), this.stateEngine && this.currentStates && !this.sameStateNames(this.stateEngine.activeStates, this.currentStates) && this.stateEngine.applyStates(this.currentStates),
866
+ this.stateEngine;
925
867
  }
926
- resolveSimpleLocalStateTransition(states, previousStates) {
868
+ toGraphicStateTransition(result) {
869
+ return {
870
+ changed: result.changed,
871
+ states: [ ...result.activeStates ],
872
+ effectiveStates: [ ...result.effectiveStates ]
873
+ };
874
+ }
875
+ sortLocalStates(states) {
876
+ return this.stateSort ? [ ...states ].sort(this.stateSort) : [ ...states ];
877
+ }
878
+ resolveLocalUseStatesTransition(states) {
927
879
  var _a;
928
- if (!this.states || this.stateProxy || this.stateSort || "deep" === this.stateMergeMode || this.parent || (null === (_a = this.stage) || void 0 === _a ? void 0 : _a.rootSharedStateScope) || this.boundSharedStateScope) return null;
929
- if (1 === states.length) {
930
- const stateName = states[0], hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName), nextStates = [ stateName ], changed = !this.sameStateNames(previousStates, nextStates), resolvedStateAttrs = {};
931
- if (hasDefinition) {
932
- const attrs = this.states[stateName];
933
- if (null != attrs) {
934
- if (!isPlainObjectValue(attrs)) return null;
935
- const keys = Object.keys(attrs);
936
- for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
937
- const key = keys[keyIndex];
938
- if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
939
- const attrValue = attrs[key];
940
- resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
941
- }
942
- }
943
- }
944
- return {
945
- changed: changed,
946
- states: nextStates,
947
- effectiveStates: nextStates,
948
- resolvedStateAttrs: resolvedStateAttrs
949
- };
950
- }
951
- const uniqueStates = Array.from(new Set(states)), withDefinition = [], withoutDefinition = [];
952
- for (let i = 0; i < uniqueStates.length; i++) {
953
- const stateName = uniqueStates[i];
954
- Object.prototype.hasOwnProperty.call(this.states, stateName) ? withDefinition.push(stateName) : withoutDefinition.push(stateName);
955
- }
956
- withDefinition.sort(((left, right) => left.localeCompare(right)));
957
- const nextStates = withDefinition.concat(withoutDefinition), changed = !this.sameStateNames(previousStates, nextStates), resolvedStateAttrs = {};
958
- for (let i = 0; i < nextStates.length; i++) {
959
- const stateName = nextStates[i];
960
- if (!Object.prototype.hasOwnProperty.call(this.states, stateName)) continue;
961
- const attrs = this.states[stateName];
962
- if (null == attrs) continue;
963
- if (!isPlainObjectValue(attrs)) return null;
964
- const keys = Object.keys(attrs);
965
- for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
966
- const key = keys[keyIndex];
967
- if (FULL_STATE_DEFINITION_KEYS.has(key)) return null;
968
- const attrValue = attrs[key];
969
- resolvedStateAttrs[key] = isPlainObjectValue(attrValue) ? cloneAttributeValue(attrValue) : attrValue;
970
- }
971
- }
880
+ if (!states.length) return this.resolveLocalClearStatesTransition();
881
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, changed = previousStates.length !== states.length || states.some(((stateName, index) => previousStates[index] !== stateName)), nextStates = this.sortLocalStates(states);
972
882
  return {
973
883
  changed: changed,
974
- states: nextStates,
975
- effectiveStates: nextStates,
976
- resolvedStateAttrs: resolvedStateAttrs
884
+ states: changed ? nextStates : [ ...previousStates ]
977
885
  };
978
886
  }
979
- resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = !1) {
980
- var _a, _b;
981
- let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
982
- const isSimpleLocalTransition = !!transition;
983
- let resolvedStateAttrs;
984
- if (transition) resolvedStateAttrs = transition.resolvedStateAttrs; else {
985
- const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(), stateModel = this.createStateModel(stateResolveBaseAttrs);
986
- forceResolverRefresh && (null === (_a = this.stateEngine) || void 0 === _a || _a.invalidateResolverCache()),
987
- transition = stateModel.useStates(states), resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
988
- }
887
+ resolveLocalClearStatesTransition() {
888
+ return {
889
+ changed: this.hasState(),
890
+ states: []
891
+ };
892
+ }
893
+ resolveUseStatesTransition(states, stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
894
+ const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
895
+ return stateEngine ? this.toGraphicStateTransition(stateEngine.applyStates(states)) : this.resolveLocalUseStatesTransition(states);
896
+ }
897
+ resolveClearStatesTransition() {
898
+ const stateEngine = this.ensureStateEngine();
899
+ return stateEngine ? this.toGraphicStateTransition(stateEngine.clearStates()) : this.resolveLocalClearStatesTransition();
900
+ }
901
+ resolveAddStateTransition(stateName, keepCurrentStates) {
902
+ var _a;
903
+ const stateEngine = this.ensureStateEngine();
904
+ if (stateEngine) return this.toGraphicStateTransition(stateEngine.addState(stateName, keepCurrentStates));
905
+ if (this.currentStates && this.currentStates.includes(stateName) && (keepCurrentStates || 1 === this.currentStates.length)) return {
906
+ changed: !1,
907
+ states: [ ...this.currentStates ]
908
+ };
909
+ const nextStates = keepCurrentStates && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) ? this.currentStates.concat([ stateName ]) : [ stateName ];
910
+ return this.resolveLocalUseStatesTransition(nextStates);
911
+ }
912
+ resolveRemoveStateTransition(stateName) {
913
+ const stateEngine = this.ensureStateEngine();
914
+ if (stateEngine) return this.toGraphicStateTransition(stateEngine.removeState(stateName));
915
+ if (!this.currentStates) return {
916
+ changed: !1,
917
+ states: []
918
+ };
919
+ const filter = Array.isArray(stateName) ? s => !stateName.includes(s) : s => s !== stateName, nextStates = this.currentStates.filter(filter);
920
+ return nextStates.length === this.currentStates.length ? {
921
+ changed: !1,
922
+ states: [ ...this.currentStates ]
923
+ } : this.resolveLocalUseStatesTransition(nextStates);
924
+ }
925
+ resolveToggleStateTransition(stateName) {
926
+ const stateEngine = this.ensureStateEngine();
927
+ if (stateEngine) return this.toGraphicStateTransition(stateEngine.toggleState(stateName));
928
+ if (this.hasState(stateName)) return this.resolveRemoveStateTransition(stateName);
929
+ const nextStates = this.currentStates ? this.currentStates.slice() : [];
930
+ return nextStates.push(stateName), this.resolveLocalUseStatesTransition(nextStates);
931
+ }
932
+ resolveGraphicStateTransition(states, forceResolverRefresh = !1) {
933
+ var _a;
934
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(), stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
935
+ forceResolverRefresh && (null == stateEngine || stateEngine.invalidateResolverCache());
936
+ const transition = stateEngine ? this.toGraphicStateTransition(stateEngine.applyStates(states)) : this.resolveLocalUseStatesTransition(states), resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
989
937
  return {
990
938
  transition: transition,
991
- effectiveStates: null !== (_b = transition.effectiveStates) && void 0 !== _b ? _b : transition.states,
992
- resolvedStateAttrs: resolvedStateAttrs,
993
- isSimpleLocalTransition: isSimpleLocalTransition
939
+ effectiveStates: null !== (_a = transition.effectiveStates) && void 0 !== _a ? _a : transition.states,
940
+ resolvedStateAttrs: resolvedStateAttrs
994
941
  };
995
942
  }
996
943
  normalizeSetStatesOptions(options) {
@@ -1014,26 +961,16 @@ export class Graphic extends Node {
1014
961
  }
1015
962
  commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
1016
963
  var _a;
1017
- const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, {transition: transition, effectiveStates: effectiveStates, resolvedStateAttrs: resolvedStateAttrs, isSimpleLocalTransition: isSimpleLocalTransition} = this.resolveGraphicStateTransition(states, previousStates, !0), patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
1018
- if ((!patchChanged || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) && (this.currentStates = transition.states,
1019
- this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [ ...effectiveStates ],
1020
- this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(),
1021
- patchChanged)) {
1022
- if (this.stage) {
1023
- const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
1024
- null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
1025
- graphicId: this._uid,
1026
- targetStates: [ ...transition.states ]
1027
- });
1028
- }
1029
- hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(),
1030
- this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
1031
- this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
1032
- type: AttributeUpdateType.STATE
1033
- }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
1034
- type: AttributeUpdateType.STATE
1035
- }), this.emitStateUpdateEvent());
1036
- }
964
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, {transition: transition, effectiveStates: effectiveStates, resolvedStateAttrs: resolvedStateAttrs} = this.resolveGraphicStateTransition(states, !0), patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
965
+ patchChanged && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) || (this.currentStates = transition.states,
966
+ this.effectiveStates = [ ...effectiveStates ], this.resolvedStatePatch = resolvedStateAttrs,
967
+ this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged && (hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(),
968
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
969
+ this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
970
+ type: AttributeUpdateType.STATE
971
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
972
+ type: AttributeUpdateType.STATE
973
+ }), this.emitStateUpdateEvent())));
1037
974
  }
1038
975
  resolveStateAnimateConfig(animateConfig) {
1039
976
  var _a, _b, _c;
@@ -1045,8 +982,8 @@ export class Graphic extends Node {
1045
982
  extraAnimateAttrs: extraAnimateAttrs,
1046
983
  shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
1047
984
  } : void 0;
1048
- if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
1049
- const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
985
+ if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
986
+ const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
1050
987
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
1051
988
  animateConfig: resolvedAnimateConfig,
1052
989
  extraAnimateAttrs: extraAnimateAttrs,
@@ -1070,45 +1007,33 @@ export class Graphic extends Node {
1070
1007
  animate.stateNames && stateAnimates.push(animate);
1071
1008
  })), stateAnimates.forEach((animate => animate.stop(type)));
1072
1009
  }
1073
- getNormalAttribute(key) {
1074
- var _a, _b;
1075
- const value = this.attribute[key];
1076
- return this.hasAnyTrackedAnimate() ? null === (_a = this.finalAttribute) || void 0 === _a ? void 0 : _a[key] : null != value ? value : null === (_b = this.finalAttribute) || void 0 === _b ? void 0 : _b[key];
1077
- }
1078
1010
  clearStates(hasAnimation) {
1079
1011
  var _a, _b, _c;
1080
- const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, transition = this.createStateModel().clearStates();
1012
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, transition = this.resolveClearStatesTransition();
1081
1013
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [],
1082
1014
  this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1,
1083
1015
  void this.clearSharedStateActiveRegistrations();
1084
1016
  const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
1085
- if (!transition.changed || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0)) {
1086
- if (this.currentStates = transition.states, this.effectiveStates = [], this.resolvedStatePatch = void 0,
1087
- this.sharedStateDirty = !1, this.clearSharedStateActiveRegistrations(), this.stage) {
1088
- const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
1089
- null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
1090
- graphicId: this._uid,
1091
- targetStates: []
1092
- });
1093
- }
1094
- hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
1095
- this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
1096
- type: AttributeUpdateType.STATE
1097
- }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
1098
- type: AttributeUpdateType.STATE
1099
- }), this.emitStateUpdateEvent());
1100
- }
1017
+ transition.changed && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0) || (this.currentStates = transition.states,
1018
+ this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1,
1019
+ this.clearSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(),
1020
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
1021
+ this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
1022
+ type: AttributeUpdateType.STATE
1023
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
1024
+ type: AttributeUpdateType.STATE
1025
+ }), this.emitStateUpdateEvent()));
1101
1026
  }
1102
1027
  removeState(stateName, hasAnimation) {
1103
- const transition = this.createStateModel().removeState(stateName);
1028
+ const transition = this.resolveRemoveStateTransition(stateName);
1104
1029
  transition.changed && this.useStates(transition.states, hasAnimation);
1105
1030
  }
1106
1031
  toggleState(stateName, hasAnimation) {
1107
- const transition = this.createStateModel().toggleState(stateName);
1032
+ const transition = this.resolveToggleStateTransition(stateName);
1108
1033
  transition.changed && this.useStates(transition.states, hasAnimation);
1109
1034
  }
1110
1035
  addState(stateName, keepCurrentStates, hasAnimation) {
1111
- const transition = this.createStateModel().addState(stateName, keepCurrentStates);
1036
+ const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
1112
1037
  transition.changed && this.useStates(transition.states, hasAnimation);
1113
1038
  }
1114
1039
  setStates(states, options) {
@@ -1125,24 +1050,16 @@ export class Graphic extends Node {
1125
1050
  useStates(states, hasAnimation) {
1126
1051
  var _a;
1127
1052
  if (!states.length) return void this.clearStates(hasAnimation);
1128
- const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, {transition: transition, effectiveStates: effectiveStates, resolvedStateAttrs: resolvedStateAttrs, isSimpleLocalTransition: isSimpleLocalTransition} = this.resolveGraphicStateTransition(states, previousStates);
1129
- if ((transition.changed || !this.sameStateNames(previousStates, transition.states)) && this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1)) {
1130
- if (this.currentStates = transition.states, this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [ ...effectiveStates ],
1131
- this.resolvedStatePatch = resolvedStateAttrs, this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(),
1132
- this.stage) {
1133
- const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
1134
- null == perfMonitor || perfMonitor.incrementCounter("stateCommits"), null == perfMonitor || perfMonitor.recordEvent("state-commit", {
1135
- graphicId: this._uid,
1136
- targetStates: [ ...transition.states ]
1137
- });
1138
- }
1139
- hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
1140
- this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
1141
- type: AttributeUpdateType.STATE
1142
- }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
1143
- type: AttributeUpdateType.STATE
1144
- }), this.emitStateUpdateEvent());
1145
- }
1053
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, {transition: transition, effectiveStates: effectiveStates, resolvedStateAttrs: resolvedStateAttrs} = this.resolveGraphicStateTransition(states);
1054
+ !transition.changed && this.sameStateNames(previousStates, transition.states) || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) && (this.currentStates = transition.states,
1055
+ this.effectiveStates = [ ...effectiveStates ], this.resolvedStatePatch = resolvedStateAttrs,
1056
+ this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(),
1057
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
1058
+ this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
1059
+ type: AttributeUpdateType.STATE
1060
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
1061
+ type: AttributeUpdateType.STATE
1062
+ }), this.emitStateUpdateEvent()));
1146
1063
  }
1147
1064
  invalidateResolver() {
1148
1065
  var _a, _b;
@@ -1280,9 +1197,8 @@ export class Graphic extends Node {
1280
1197
  var _a, _b, _c;
1281
1198
  (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(),
1282
1199
  (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates(), this.boundSharedStateScope = void 0,
1283
- this.boundSharedStateRevision = void 0, this.localFallbackCompiledDefinitions = void 0,
1284
- this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0,
1285
- this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0,
1200
+ this.boundSharedStateRevision = void 0, this.compiledStateDefinitions = void 0,
1201
+ this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0,
1286
1202
  this.sharedStateDirty = !1, this.stage = null, this.layer = null, this.shadowRoot && (null === (_c = (_b = this.shadowRoot).detachStageForRelease) || void 0 === _c || _c.call(_b));
1287
1203
  }
1288
1204
  setStageToShadowRoot(stage, layer) {