@visactor/vrender-core 1.1.0-alpha.9 → 1.1.1-alpha.0

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 (578) hide show
  1. package/cjs/allocator/graphic-allocate.js +1 -2
  2. package/cjs/canvas/constants.js +2 -1
  3. package/cjs/common/contribution-provider.d.ts +2 -2
  4. package/cjs/common/contribution-provider.js +8 -4
  5. package/cjs/common/contribution-provider.js.map +1 -1
  6. package/cjs/common/diff.js +2 -1
  7. package/cjs/common/event-listener-manager.js +1 -2
  8. package/cjs/common/module-guard.d.ts +1 -0
  9. package/cjs/common/module-guard.js +11 -0
  10. package/cjs/common/module-guard.js.map +1 -0
  11. package/cjs/common/performance-raf.js +1 -1
  12. package/cjs/common/polygon.js +2 -2
  13. package/cjs/common/rect-utils.js +1 -1
  14. package/cjs/common/render-area.js +1 -1
  15. package/cjs/common/render-command-list.js +1 -1
  16. package/cjs/common/render-curve.js +1 -1
  17. package/cjs/common/render-utils.js +1 -1
  18. package/cjs/common/seg-context.js +2 -1
  19. package/cjs/common/simplify.js +1 -1
  20. package/cjs/common/sort.js +1 -1
  21. package/cjs/common/split-path.js +1 -1
  22. package/cjs/common/text.js +1 -1
  23. package/cjs/common/utils.js +1 -1
  24. package/cjs/common/xml/is-xml.d.ts +2 -0
  25. package/cjs/common/xml/is-xml.js +14 -0
  26. package/cjs/common/xml/is-xml.js.map +1 -0
  27. package/cjs/common/xml/parser.d.ts +2 -2
  28. package/cjs/common/xml/parser.js +14 -11
  29. package/cjs/common/xml/parser.js.map +1 -1
  30. package/cjs/container.d.ts +2 -0
  31. package/cjs/container.js +50 -0
  32. package/cjs/container.js.map +1 -0
  33. package/cjs/core/camera.js +1 -1
  34. package/cjs/core/constants.js +1 -1
  35. package/cjs/core/contributions/layerHandler/canvas2d-contribution.js +1 -0
  36. package/cjs/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
  37. package/cjs/core/core-modules.js +1 -1
  38. package/cjs/core/global.js +1 -1
  39. package/cjs/core/graphic-utils.js +1 -2
  40. package/cjs/core/index.js +1 -1
  41. package/cjs/core/layer-service.js +1 -1
  42. package/cjs/core/layer.js +1 -1
  43. package/cjs/core/light.js +1 -1
  44. package/cjs/core/stage.d.ts +2 -8
  45. package/cjs/core/stage.js +22 -28
  46. package/cjs/core/stage.js.map +1 -1
  47. package/cjs/core/window.js +1 -1
  48. package/cjs/entries/miniapp.d.ts +0 -1
  49. package/cjs/entries/miniapp.js +1 -5
  50. package/cjs/entries/miniapp.js.map +1 -1
  51. package/cjs/entries/node.d.ts +0 -1
  52. package/cjs/entries/node.js +1 -5
  53. package/cjs/entries/node.js.map +1 -1
  54. package/cjs/entries/runtime-installer.d.ts +13 -0
  55. package/cjs/entries/runtime-installer.js +81 -12
  56. package/cjs/entries/runtime-installer.js.map +1 -1
  57. package/cjs/env.d.ts +1 -0
  58. package/cjs/env.js +25 -0
  59. package/cjs/env.js.map +1 -0
  60. package/cjs/event/public-constant.d.ts +7 -0
  61. package/cjs/event/public-constant.js +100 -0
  62. package/cjs/event/public-constant.js.map +1 -0
  63. package/cjs/event/util.d.ts +1 -1
  64. package/cjs/graphic/arc.js +6 -4
  65. package/cjs/graphic/arc.js.map +1 -1
  66. package/cjs/graphic/base.d.ts +2 -0
  67. package/cjs/graphic/base.js +15 -0
  68. package/cjs/graphic/base.js.map +1 -0
  69. package/cjs/graphic/config.js +1 -0
  70. package/cjs/graphic/config.js.map +1 -1
  71. package/cjs/graphic/creator.d.ts +16 -0
  72. package/cjs/graphic/creator.js +160 -0
  73. package/cjs/graphic/creator.js.map +1 -0
  74. package/cjs/graphic/glyph.js +4 -8
  75. package/cjs/graphic/glyph.js.map +1 -1
  76. package/cjs/graphic/graphic-service/graphic-service.d.ts +4 -1
  77. package/cjs/graphic/graphic-service/graphic-service.js +7 -13
  78. package/cjs/graphic/graphic-service/graphic-service.js.map +1 -1
  79. package/cjs/graphic/graphic.d.ts +80 -28
  80. package/cjs/graphic/graphic.js +499 -220
  81. package/cjs/graphic/graphic.js.map +1 -1
  82. package/cjs/graphic/group.d.ts +5 -3
  83. package/cjs/graphic/group.js +44 -31
  84. package/cjs/graphic/group.js.map +1 -1
  85. package/cjs/graphic/modules.d.ts +16 -0
  86. package/cjs/graphic/modules.js +150 -0
  87. package/cjs/graphic/modules.js.map +1 -0
  88. package/cjs/graphic/node-tree.d.ts +3 -3
  89. package/cjs/graphic/node-tree.js +1 -0
  90. package/cjs/graphic/node-tree.js.map +1 -1
  91. package/cjs/graphic/state/shared-state-refresh.js +11 -31
  92. package/cjs/graphic/state/shared-state-refresh.js.map +1 -1
  93. package/cjs/graphic/state/shared-state-scope.d.ts +2 -5
  94. package/cjs/graphic/state/shared-state-scope.js +8 -27
  95. package/cjs/graphic/state/shared-state-scope.js.map +1 -1
  96. package/cjs/graphic/state/state-definition-compiler.js +4 -5
  97. package/cjs/graphic/state/state-definition-compiler.js.map +1 -1
  98. package/cjs/graphic/state/state-definition.d.ts +2 -5
  99. package/cjs/graphic/state/state-definition.js.map +1 -1
  100. package/cjs/graphic/state/state-engine.d.ts +0 -5
  101. package/cjs/graphic/state/state-engine.js +21 -70
  102. package/cjs/graphic/state/state-engine.js.map +1 -1
  103. package/cjs/graphic/state/state-transition-orchestrator.d.ts +7 -9
  104. package/cjs/graphic/state/state-transition-orchestrator.js +10 -13
  105. package/cjs/graphic/state/state-transition-orchestrator.js.map +1 -1
  106. package/cjs/graphic/tools.js +2 -2
  107. package/cjs/graphic/tools.js.map +1 -1
  108. package/cjs/index.js.map +1 -1
  109. package/cjs/interface/animation/animate.d.ts +1 -0
  110. package/cjs/interface/animation/animate.js.map +1 -1
  111. package/cjs/interface/global.d.ts +8 -4
  112. package/cjs/interface/global.js.map +1 -1
  113. package/cjs/interface/graphic/arc.d.ts +1 -0
  114. package/cjs/interface/graphic/arc.js.map +1 -1
  115. package/cjs/interface/graphic/group.d.ts +0 -2
  116. package/cjs/interface/graphic/group.js.map +1 -1
  117. package/cjs/interface/graphic.d.ts +10 -5
  118. package/cjs/interface/graphic.js.map +1 -1
  119. package/cjs/interface/index.js.map +1 -1
  120. package/cjs/interface/node-tree.d.ts +3 -0
  121. package/cjs/interface/node-tree.js.map +1 -1
  122. package/cjs/interface/stage.d.ts +0 -7
  123. package/cjs/interface/stage.js.map +1 -1
  124. package/cjs/interpolate.d.ts +2 -0
  125. package/cjs/interpolate.js +34 -0
  126. package/cjs/interpolate.js.map +1 -0
  127. package/cjs/modules.js.map +1 -1
  128. package/cjs/path.d.ts +4 -0
  129. package/cjs/path.js +33 -0
  130. package/cjs/path.js.map +1 -0
  131. package/cjs/plugin/3d.d.ts +3 -0
  132. package/cjs/plugin/3d.js +33 -0
  133. package/cjs/plugin/3d.js.map +1 -0
  134. package/cjs/plugin/attribute.d.ts +2 -0
  135. package/cjs/plugin/attribute.js +24 -0
  136. package/cjs/plugin/attribute.js.map +1 -0
  137. package/cjs/plugin/flex-layout.d.ts +1 -0
  138. package/cjs/plugin/flex-layout.js +15 -0
  139. package/cjs/plugin/flex-layout.js.map +1 -0
  140. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  141. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +27 -17
  142. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  143. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  144. package/cjs/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  145. package/cjs/plugins/index.d.ts +0 -4
  146. package/cjs/plugins/index.js +1 -3
  147. package/cjs/plugins/index.js.map +1 -1
  148. package/cjs/plugins/plugin-service.d.ts +0 -1
  149. package/cjs/plugins/plugin-service.js +2 -3
  150. package/cjs/plugins/plugin-service.js.map +1 -1
  151. package/cjs/plugins/types.d.ts +1 -8
  152. package/cjs/plugins/types.js.map +1 -1
  153. package/cjs/register/graphic.d.ts +19 -0
  154. package/cjs/register/graphic.js +177 -0
  155. package/cjs/register/graphic.js.map +1 -0
  156. package/cjs/registry/contribution-registry.d.ts +1 -1
  157. package/cjs/registry/contribution-registry.js +6 -2
  158. package/cjs/registry/contribution-registry.js.map +1 -1
  159. package/cjs/registry/picker-registry.d.ts +1 -1
  160. package/cjs/registry/picker-registry.js +2 -2
  161. package/cjs/registry/picker-registry.js.map +1 -1
  162. package/cjs/registry/renderer-registry.d.ts +1 -1
  163. package/cjs/registry/renderer-registry.js +2 -2
  164. package/cjs/registry/renderer-registry.js.map +1 -1
  165. package/cjs/registry/types.d.ts +3 -3
  166. package/cjs/registry/types.js.map +1 -1
  167. package/cjs/render/contributions/render/arc-module.js +5 -6
  168. package/cjs/render/contributions/render/arc-module.js.map +1 -1
  169. package/cjs/render/contributions/render/arc3d-module.js +3 -5
  170. package/cjs/render/contributions/render/arc3d-module.js.map +1 -1
  171. package/cjs/render/contributions/render/area-module.js +6 -8
  172. package/cjs/render/contributions/render/area-module.js.map +1 -1
  173. package/cjs/render/contributions/render/base-render.js +8 -7
  174. package/cjs/render/contributions/render/base-render.js.map +1 -1
  175. package/cjs/render/contributions/render/circle-module.js +4 -5
  176. package/cjs/render/contributions/render/circle-module.js.map +1 -1
  177. package/cjs/render/contributions/render/contributions/rect-contribution-render.js +6 -2
  178. package/cjs/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  179. package/cjs/render/contributions/render/glyph-module.js +3 -5
  180. package/cjs/render/contributions/render/glyph-module.js.map +1 -1
  181. package/cjs/render/contributions/render/image-module.js +3 -4
  182. package/cjs/render/contributions/render/image-module.js.map +1 -1
  183. package/cjs/render/contributions/render/line-module.js +3 -7
  184. package/cjs/render/contributions/render/line-module.js.map +1 -1
  185. package/cjs/render/contributions/render/path-module.js +5 -6
  186. package/cjs/render/contributions/render/path-module.js.map +1 -1
  187. package/cjs/render/contributions/render/polygon-module.js +3 -4
  188. package/cjs/render/contributions/render/polygon-module.js.map +1 -1
  189. package/cjs/render/contributions/render/pyramid3d-module.js +3 -4
  190. package/cjs/render/contributions/render/pyramid3d-module.js.map +1 -1
  191. package/cjs/render/contributions/render/rect-module.js +2 -4
  192. package/cjs/render/contributions/render/rect-module.js.map +1 -1
  193. package/cjs/render/contributions/render/rect3d-module.js +3 -4
  194. package/cjs/render/contributions/render/rect3d-module.js.map +1 -1
  195. package/cjs/render/contributions/render/richtext-module.js +3 -4
  196. package/cjs/render/contributions/render/richtext-module.js.map +1 -1
  197. package/cjs/render/contributions/render/star-module.js +4 -5
  198. package/cjs/render/contributions/render/star-module.js.map +1 -1
  199. package/cjs/render/contributions/render/star-render.d.ts +2 -2
  200. package/cjs/render/contributions/render/star-render.js +3 -3
  201. package/cjs/render/contributions/render/star-render.js.map +1 -1
  202. package/cjs/render/contributions/render/symbol-module.js +4 -5
  203. package/cjs/render/contributions/render/symbol-module.js.map +1 -1
  204. package/cjs/render/contributions/render/text-module.js +3 -4
  205. package/cjs/render/contributions/render/text-module.js.map +1 -1
  206. package/cjs/resource-loader/loader.js +5 -0
  207. package/cjs/resource-loader/loader.js.map +1 -1
  208. package/cjs/svg.d.ts +1 -0
  209. package/cjs/svg.js +15 -0
  210. package/cjs/svg.js.map +1 -0
  211. package/cjs/text.d.ts +2 -0
  212. package/cjs/text.js +29 -0
  213. package/cjs/text.js.map +1 -0
  214. package/dist/index.es.js +1440 -1780
  215. package/es/allocator/graphic-allocate.js +1 -2
  216. package/es/canvas/constants.js +2 -1
  217. package/es/common/contribution-provider.d.ts +2 -2
  218. package/es/common/contribution-provider.js +8 -4
  219. package/es/common/contribution-provider.js.map +1 -1
  220. package/es/common/diff.js +2 -1
  221. package/es/common/event-listener-manager.js +1 -2
  222. package/es/common/module-guard.d.ts +1 -0
  223. package/es/common/module-guard.js +5 -0
  224. package/es/common/module-guard.js.map +1 -0
  225. package/es/common/performance-raf.js +1 -1
  226. package/es/common/polygon.js +1 -1
  227. package/es/common/rect-utils.js +1 -1
  228. package/es/common/render-area.js +1 -1
  229. package/es/common/render-command-list.js +1 -1
  230. package/es/common/render-curve.js +1 -1
  231. package/es/common/render-utils.js +1 -1
  232. package/es/common/seg-context.js +2 -1
  233. package/es/common/simplify.js +1 -1
  234. package/es/common/sort.js +1 -1
  235. package/es/common/split-path.js +1 -1
  236. package/es/common/text.js +1 -1
  237. package/es/common/utils.js +1 -1
  238. package/es/common/xml/is-xml.d.ts +2 -0
  239. package/es/common/xml/is-xml.js +8 -0
  240. package/es/common/xml/is-xml.js.map +1 -0
  241. package/es/common/xml/parser.d.ts +2 -2
  242. package/es/common/xml/parser.js +3 -7
  243. package/es/common/xml/parser.js.map +1 -1
  244. package/es/container.d.ts +2 -0
  245. package/es/container.js +2 -0
  246. package/es/container.js.map +1 -0
  247. package/es/core/camera.js +1 -1
  248. package/es/core/constants.js +1 -1
  249. package/es/core/contributions/layerHandler/canvas2d-contribution.js +1 -0
  250. package/es/core/contributions/layerHandler/canvas2d-contribution.js.map +1 -1
  251. package/es/core/core-modules.js +1 -1
  252. package/es/core/global.js +1 -1
  253. package/es/core/graphic-utils.js +1 -2
  254. package/es/core/index.js +1 -1
  255. package/es/core/layer-service.js +1 -1
  256. package/es/core/layer.js +1 -1
  257. package/es/core/light.js +1 -1
  258. package/es/core/stage.d.ts +2 -8
  259. package/es/core/stage.js +20 -30
  260. package/es/core/stage.js.map +1 -1
  261. package/es/core/window.js +1 -1
  262. package/es/entries/miniapp.d.ts +0 -1
  263. package/es/entries/miniapp.js +1 -5
  264. package/es/entries/miniapp.js.map +1 -1
  265. package/es/entries/node.d.ts +0 -1
  266. package/es/entries/node.js +1 -5
  267. package/es/entries/node.js.map +1 -1
  268. package/es/entries/runtime-installer.d.ts +13 -0
  269. package/es/entries/runtime-installer.js +80 -9
  270. package/es/entries/runtime-installer.js.map +1 -1
  271. package/es/env.d.ts +1 -0
  272. package/es/env.js +2 -0
  273. package/es/env.js.map +1 -0
  274. package/es/event/public-constant.d.ts +7 -0
  275. package/es/event/public-constant.js +12 -0
  276. package/es/event/public-constant.js.map +1 -0
  277. package/es/event/util.d.ts +1 -1
  278. package/es/graphic/arc.js +5 -4
  279. package/es/graphic/arc.js.map +1 -1
  280. package/es/graphic/base.d.ts +2 -0
  281. package/es/graphic/base.js +2 -0
  282. package/es/graphic/base.js.map +1 -0
  283. package/es/graphic/config.js +1 -0
  284. package/es/graphic/config.js.map +1 -1
  285. package/es/graphic/creator.d.ts +16 -0
  286. package/es/graphic/creator.js +32 -0
  287. package/es/graphic/creator.js.map +1 -0
  288. package/es/graphic/glyph.js +4 -8
  289. package/es/graphic/glyph.js.map +1 -1
  290. package/es/graphic/graphic-service/graphic-service.d.ts +4 -1
  291. package/es/graphic/graphic-service/graphic-service.js +6 -15
  292. package/es/graphic/graphic-service/graphic-service.js.map +1 -1
  293. package/es/graphic/graphic.d.ts +80 -28
  294. package/es/graphic/graphic.js +492 -217
  295. package/es/graphic/graphic.js.map +1 -1
  296. package/es/graphic/group.d.ts +5 -3
  297. package/es/graphic/group.js +43 -31
  298. package/es/graphic/group.js.map +1 -1
  299. package/es/graphic/modules.d.ts +16 -0
  300. package/es/graphic/modules.js +32 -0
  301. package/es/graphic/modules.js.map +1 -0
  302. package/es/graphic/node-tree.d.ts +3 -3
  303. package/es/graphic/node-tree.js +1 -0
  304. package/es/graphic/node-tree.js.map +1 -1
  305. package/es/graphic/state/shared-state-refresh.js +8 -27
  306. package/es/graphic/state/shared-state-refresh.js.map +1 -1
  307. package/es/graphic/state/shared-state-scope.d.ts +2 -5
  308. package/es/graphic/state/shared-state-scope.js +7 -28
  309. package/es/graphic/state/shared-state-scope.js.map +1 -1
  310. package/es/graphic/state/state-definition-compiler.js +4 -5
  311. package/es/graphic/state/state-definition-compiler.js.map +1 -1
  312. package/es/graphic/state/state-definition.d.ts +2 -5
  313. package/es/graphic/state/state-definition.js.map +1 -1
  314. package/es/graphic/state/state-engine.d.ts +0 -5
  315. package/es/graphic/state/state-engine.js +18 -67
  316. package/es/graphic/state/state-engine.js.map +1 -1
  317. package/es/graphic/state/state-transition-orchestrator.d.ts +7 -9
  318. package/es/graphic/state/state-transition-orchestrator.js +10 -13
  319. package/es/graphic/state/state-transition-orchestrator.js.map +1 -1
  320. package/es/graphic/tools.js +1 -3
  321. package/es/graphic/tools.js.map +1 -1
  322. package/es/index.js.map +1 -1
  323. package/es/interface/animation/animate.d.ts +1 -0
  324. package/es/interface/animation/animate.js.map +1 -1
  325. package/es/interface/global.d.ts +8 -4
  326. package/es/interface/global.js.map +1 -1
  327. package/es/interface/graphic/arc.d.ts +1 -0
  328. package/es/interface/graphic/arc.js.map +1 -1
  329. package/es/interface/graphic/group.d.ts +0 -2
  330. package/es/interface/graphic/group.js.map +1 -1
  331. package/es/interface/graphic.d.ts +10 -5
  332. package/es/interface/graphic.js.map +1 -1
  333. package/es/interface/index.js.map +1 -1
  334. package/es/interface/node-tree.d.ts +3 -0
  335. package/es/interface/node-tree.js.map +1 -1
  336. package/es/interface/stage.d.ts +0 -7
  337. package/es/interface/stage.js.map +1 -1
  338. package/es/interpolate.d.ts +2 -0
  339. package/es/interpolate.js +4 -0
  340. package/es/interpolate.js.map +1 -0
  341. package/es/modules.js.map +1 -1
  342. package/es/path.d.ts +4 -0
  343. package/es/path.js +6 -0
  344. package/es/path.js.map +1 -0
  345. package/es/plugin/3d.d.ts +3 -0
  346. package/es/plugin/3d.js +6 -0
  347. package/es/plugin/3d.js.map +1 -0
  348. package/es/plugin/attribute.d.ts +2 -0
  349. package/es/plugin/attribute.js +4 -0
  350. package/es/plugin/attribute.js.map +1 -0
  351. package/es/plugin/flex-layout.d.ts +1 -0
  352. package/es/plugin/flex-layout.js +2 -0
  353. package/es/plugin/flex-layout.js.map +1 -0
  354. package/es/plugins/builtin-plugin/dirty-bounds-plugin.d.ts +4 -1
  355. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +27 -17
  356. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  357. package/es/plugins/builtin-plugin/flex-layout-plugin.js +3 -2
  358. package/es/plugins/builtin-plugin/flex-layout-plugin.js.map +1 -1
  359. package/es/plugins/index.d.ts +0 -4
  360. package/es/plugins/index.js +0 -8
  361. package/es/plugins/index.js.map +1 -1
  362. package/es/plugins/plugin-service.d.ts +0 -1
  363. package/es/plugins/plugin-service.js +2 -3
  364. package/es/plugins/plugin-service.js.map +1 -1
  365. package/es/plugins/types.d.ts +1 -8
  366. package/es/plugins/types.js.map +1 -1
  367. package/es/register/graphic.d.ts +19 -0
  368. package/es/register/graphic.js +38 -0
  369. package/es/register/graphic.js.map +1 -0
  370. package/es/registry/contribution-registry.d.ts +1 -1
  371. package/es/registry/contribution-registry.js +6 -2
  372. package/es/registry/contribution-registry.js.map +1 -1
  373. package/es/registry/picker-registry.d.ts +1 -1
  374. package/es/registry/picker-registry.js +2 -2
  375. package/es/registry/picker-registry.js.map +1 -1
  376. package/es/registry/renderer-registry.d.ts +1 -1
  377. package/es/registry/renderer-registry.js +2 -2
  378. package/es/registry/renderer-registry.js.map +1 -1
  379. package/es/registry/types.d.ts +3 -3
  380. package/es/registry/types.js.map +1 -1
  381. package/es/render/contributions/render/arc-module.js +6 -4
  382. package/es/render/contributions/render/arc-module.js.map +1 -1
  383. package/es/render/contributions/render/arc3d-module.js +5 -3
  384. package/es/render/contributions/render/arc3d-module.js.map +1 -1
  385. package/es/render/contributions/render/area-module.js +7 -7
  386. package/es/render/contributions/render/area-module.js.map +1 -1
  387. package/es/render/contributions/render/base-render.js +8 -6
  388. package/es/render/contributions/render/base-render.js.map +1 -1
  389. package/es/render/contributions/render/circle-module.js +6 -4
  390. package/es/render/contributions/render/circle-module.js.map +1 -1
  391. package/es/render/contributions/render/contributions/rect-contribution-render.js +6 -2
  392. package/es/render/contributions/render/contributions/rect-contribution-render.js.map +1 -1
  393. package/es/render/contributions/render/glyph-module.js +5 -3
  394. package/es/render/contributions/render/glyph-module.js.map +1 -1
  395. package/es/render/contributions/render/image-module.js +5 -3
  396. package/es/render/contributions/render/image-module.js.map +1 -1
  397. package/es/render/contributions/render/line-module.js +4 -5
  398. package/es/render/contributions/render/line-module.js.map +1 -1
  399. package/es/render/contributions/render/path-module.js +6 -4
  400. package/es/render/contributions/render/path-module.js.map +1 -1
  401. package/es/render/contributions/render/polygon-module.js +5 -3
  402. package/es/render/contributions/render/polygon-module.js.map +1 -1
  403. package/es/render/contributions/render/pyramid3d-module.js +5 -3
  404. package/es/render/contributions/render/pyramid3d-module.js.map +1 -1
  405. package/es/render/contributions/render/rect-module.js +4 -2
  406. package/es/render/contributions/render/rect-module.js.map +1 -1
  407. package/es/render/contributions/render/rect3d-module.js +5 -3
  408. package/es/render/contributions/render/rect3d-module.js.map +1 -1
  409. package/es/render/contributions/render/richtext-module.js +5 -3
  410. package/es/render/contributions/render/richtext-module.js.map +1 -1
  411. package/es/render/contributions/render/star-module.js +7 -4
  412. package/es/render/contributions/render/star-module.js.map +1 -1
  413. package/es/render/contributions/render/star-render.d.ts +2 -2
  414. package/es/render/contributions/render/star-render.js +3 -3
  415. package/es/render/contributions/render/star-render.js.map +1 -1
  416. package/es/render/contributions/render/symbol-module.js +6 -4
  417. package/es/render/contributions/render/symbol-module.js.map +1 -1
  418. package/es/render/contributions/render/text-module.js +5 -3
  419. package/es/render/contributions/render/text-module.js.map +1 -1
  420. package/es/resource-loader/loader.js +5 -0
  421. package/es/resource-loader/loader.js.map +1 -1
  422. package/es/svg.d.ts +1 -0
  423. package/es/svg.js +2 -0
  424. package/es/svg.js.map +1 -0
  425. package/es/text.d.ts +2 -0
  426. package/es/text.js +4 -0
  427. package/es/text.js.map +1 -0
  428. package/package.json +247 -3
  429. package/cjs/allocator/constants.d.ts +0 -9
  430. package/cjs/allocator/constants.js +0 -11
  431. package/cjs/allocator/constants.js.map +0 -1
  432. package/cjs/common/Reflect-metadata.d.ts +0 -2
  433. package/cjs/common/Reflect-metadata.js +0 -182
  434. package/cjs/common/Reflect-metadata.js.map +0 -1
  435. package/cjs/common/segment/curve/arc.d.ts +0 -17
  436. package/cjs/common/segment/curve/arc.js +0 -38
  437. package/cjs/common/segment/curve/arc.js.map +0 -1
  438. package/cjs/common/segment/curve/ellipse.d.ts +0 -21
  439. package/cjs/common/segment/curve/ellipse.js +0 -39
  440. package/cjs/common/segment/curve/ellipse.js.map +0 -1
  441. package/cjs/common/segment/curve/move.d.ts +0 -16
  442. package/cjs/common/segment/curve/move.js +0 -37
  443. package/cjs/common/segment/curve/move.js.map +0 -1
  444. package/cjs/common/store.d.ts +0 -2
  445. package/cjs/common/store.js +0 -2
  446. package/cjs/common/store.js.map +0 -1
  447. package/cjs/core/application.d.ts +0 -1
  448. package/cjs/core/application.js +0 -6
  449. package/cjs/core/application.js.map +0 -1
  450. package/cjs/core/global-module.d.ts +0 -1
  451. package/cjs/core/global-module.js +0 -3
  452. package/cjs/core/global-module.js.map +0 -1
  453. package/cjs/export.d.ts +0 -1
  454. package/cjs/export.js +0 -1
  455. package/cjs/export.js.map +0 -1
  456. package/cjs/graphic/state/state-batch-scheduler.d.ts +0 -42
  457. package/cjs/graphic/state/state-batch-scheduler.js +0 -285
  458. package/cjs/graphic/state/state-batch-scheduler.js.map +0 -1
  459. package/cjs/graphic/state/state-model.d.ts +0 -43
  460. package/cjs/graphic/state/state-model.js +0 -143
  461. package/cjs/graphic/state/state-model.js.map +0 -1
  462. package/cjs/graphic/state/state-perf-monitor.d.ts +0 -119
  463. package/cjs/graphic/state/state-perf-monitor.js +0 -217
  464. package/cjs/graphic/state/state-perf-monitor.js.map +0 -1
  465. package/cjs/graphic/state/state-style-resolver.d.ts +0 -22
  466. package/cjs/graphic/state/state-style-resolver.js +0 -73
  467. package/cjs/graphic/state/state-style-resolver.js.map +0 -1
  468. package/cjs/interface/animate.d.ts +0 -1
  469. package/cjs/interface/animate.js +0 -3
  470. package/cjs/interface/animate.js.map +0 -1
  471. package/cjs/interface/creator.d.ts +0 -4
  472. package/cjs/interface/creator.js +0 -6
  473. package/cjs/interface/creator.js.map +0 -1
  474. package/cjs/interface/graphic/dynamic-path.d.ts +0 -1
  475. package/cjs/interface/graphic/dynamic-path.js +0 -3
  476. package/cjs/interface/graphic/dynamic-path.js.map +0 -1
  477. package/cjs/interface/graphic-utils.d.ts +0 -1
  478. package/cjs/interface/graphic-utils.js +0 -3
  479. package/cjs/interface/graphic-utils.js.map +0 -1
  480. package/cjs/interface/theme-service.d.ts +0 -1
  481. package/cjs/interface/theme-service.js +0 -3
  482. package/cjs/interface/theme-service.js.map +0 -1
  483. package/cjs/plugins/base-plugin.d.ts +0 -8
  484. package/cjs/plugins/base-plugin.js +0 -15
  485. package/cjs/plugins/base-plugin.js.map +0 -1
  486. package/cjs/plugins/browser-env-plugin.d.ts +0 -8
  487. package/cjs/plugins/browser-env-plugin.js +0 -24
  488. package/cjs/plugins/browser-env-plugin.js.map +0 -1
  489. package/cjs/plugins/builtin-plugin/poptip-plugin.d.ts +0 -1
  490. package/cjs/plugins/builtin-plugin/poptip-plugin.js +0 -3
  491. package/cjs/plugins/builtin-plugin/poptip-plugin.js.map +0 -1
  492. package/cjs/plugins/picker-plugin.d.ts +0 -7
  493. package/cjs/plugins/picker-plugin.js +0 -19
  494. package/cjs/plugins/picker-plugin.js.map +0 -1
  495. package/cjs/plugins/renderer-plugin.d.ts +0 -7
  496. package/cjs/plugins/renderer-plugin.js +0 -19
  497. package/cjs/plugins/renderer-plugin.js.map +0 -1
  498. package/cjs/render/contributions/render/clear-screen.d.ts +0 -1
  499. package/cjs/render/contributions/render/clear-screen.js +0 -3
  500. package/cjs/render/contributions/render/clear-screen.js.map +0 -1
  501. package/cjs/render/contributions/render/render-slector.d.ts +0 -1
  502. package/cjs/render/contributions/render/render-slector.js +0 -3
  503. package/cjs/render/contributions/render/render-slector.js.map +0 -1
  504. package/es/allocator/constants.d.ts +0 -9
  505. package/es/allocator/constants.js +0 -18
  506. package/es/allocator/constants.js.map +0 -1
  507. package/es/common/Reflect-metadata.d.ts +0 -2
  508. package/es/common/Reflect-metadata.js +0 -178
  509. package/es/common/Reflect-metadata.js.map +0 -1
  510. package/es/common/segment/curve/arc.d.ts +0 -17
  511. package/es/common/segment/curve/arc.js +0 -31
  512. package/es/common/segment/curve/arc.js.map +0 -1
  513. package/es/common/segment/curve/ellipse.d.ts +0 -21
  514. package/es/common/segment/curve/ellipse.js +0 -33
  515. package/es/common/segment/curve/ellipse.js.map +0 -1
  516. package/es/common/segment/curve/move.d.ts +0 -16
  517. package/es/common/segment/curve/move.js +0 -31
  518. package/es/common/segment/curve/move.js.map +0 -1
  519. package/es/common/store.d.ts +0 -2
  520. package/es/common/store.js +0 -2
  521. package/es/common/store.js.map +0 -1
  522. package/es/core/application.d.ts +0 -1
  523. package/es/core/application.js +0 -2
  524. package/es/core/application.js.map +0 -1
  525. package/es/core/global-module.d.ts +0 -1
  526. package/es/core/global-module.js +0 -3
  527. package/es/core/global-module.js.map +0 -1
  528. package/es/export.d.ts +0 -1
  529. package/es/export.js +0 -1
  530. package/es/export.js.map +0 -1
  531. package/es/graphic/state/state-batch-scheduler.d.ts +0 -42
  532. package/es/graphic/state/state-batch-scheduler.js +0 -278
  533. package/es/graphic/state/state-batch-scheduler.js.map +0 -1
  534. package/es/graphic/state/state-model.d.ts +0 -43
  535. package/es/graphic/state/state-model.js +0 -135
  536. package/es/graphic/state/state-model.js.map +0 -1
  537. package/es/graphic/state/state-perf-monitor.d.ts +0 -119
  538. package/es/graphic/state/state-perf-monitor.js +0 -207
  539. package/es/graphic/state/state-perf-monitor.js.map +0 -1
  540. package/es/graphic/state/state-style-resolver.d.ts +0 -22
  541. package/es/graphic/state/state-style-resolver.js +0 -65
  542. package/es/graphic/state/state-style-resolver.js.map +0 -1
  543. package/es/interface/animate.d.ts +0 -1
  544. package/es/interface/animate.js +0 -3
  545. package/es/interface/animate.js.map +0 -1
  546. package/es/interface/creator.d.ts +0 -4
  547. package/es/interface/creator.js +0 -2
  548. package/es/interface/creator.js.map +0 -1
  549. package/es/interface/graphic/dynamic-path.d.ts +0 -1
  550. package/es/interface/graphic/dynamic-path.js +0 -3
  551. package/es/interface/graphic/dynamic-path.js.map +0 -1
  552. package/es/interface/graphic-utils.d.ts +0 -1
  553. package/es/interface/graphic-utils.js +0 -3
  554. package/es/interface/graphic-utils.js.map +0 -1
  555. package/es/interface/theme-service.d.ts +0 -1
  556. package/es/interface/theme-service.js +0 -3
  557. package/es/interface/theme-service.js.map +0 -1
  558. package/es/plugins/base-plugin.d.ts +0 -8
  559. package/es/plugins/base-plugin.js +0 -7
  560. package/es/plugins/base-plugin.js.map +0 -1
  561. package/es/plugins/browser-env-plugin.d.ts +0 -8
  562. package/es/plugins/browser-env-plugin.js +0 -16
  563. package/es/plugins/browser-env-plugin.js.map +0 -1
  564. package/es/plugins/builtin-plugin/poptip-plugin.d.ts +0 -1
  565. package/es/plugins/builtin-plugin/poptip-plugin.js +0 -3
  566. package/es/plugins/builtin-plugin/poptip-plugin.js.map +0 -1
  567. package/es/plugins/picker-plugin.d.ts +0 -7
  568. package/es/plugins/picker-plugin.js +0 -11
  569. package/es/plugins/picker-plugin.js.map +0 -1
  570. package/es/plugins/renderer-plugin.d.ts +0 -7
  571. package/es/plugins/renderer-plugin.js +0 -11
  572. package/es/plugins/renderer-plugin.js.map +0 -1
  573. package/es/render/contributions/render/clear-screen.d.ts +0 -1
  574. package/es/render/contributions/render/clear-screen.js +0 -3
  575. package/es/render/contributions/render/clear-screen.js.map +0 -1
  576. package/es/render/contributions/render/render-slector.d.ts +0 -1
  577. package/es/render/contributions/render/render-slector.js +0 -3
  578. package/es/render/contributions/render/render-slector.js.map +0 -1
@@ -2,17 +2,17 @@
2
2
 
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: !0
5
- }), exports.Graphic = exports.NOWORK_ANIMATE_ATTR = exports.shouldUseSimpleAttributeFastPath = exports.GRAPHIC_UPDATE_TAG_KEY = exports.PURE_STYLE_KEY = void 0;
5
+ }), exports.Graphic = exports.NOWORK_ANIMATE_ATTR = exports.GRAPHIC_UPDATE_TAG_KEY = exports.PURE_STYLE_KEY = void 0;
6
6
 
7
- const vutils_1 = require("@visactor/vutils"), node_tree_1 = require("./node-tree"), event_1 = require("../event"), config_1 = require("./config"), application_1 = require("../application"), custom_path2d_1 = require("../common/custom-path2d"), loader_1 = require("../resource-loader/loader"), enums_1 = require("../common/enums"), bounds_context_1 = require("../common/bounds-context"), render_command_list_1 = require("../common/render-command-list"), utils_1 = require("../common/utils"), builtin_symbol_1 = require("./builtin-symbol"), xml_1 = require("../common/xml"), constants_1 = require("./constants"), config_2 = require("../animate/config"), canvas_1 = require("../canvas"), state_definition_compiler_1 = require("./state/state-definition-compiler"), state_engine_1 = require("./state/state-engine"), state_model_1 = require("./state/state-model"), attribute_update_classifier_1 = require("./state/attribute-update-classifier"), state_style_resolver_1 = require("./state/state-style-resolver"), state_transition_orchestrator_1 = require("./state/state-transition-orchestrator"), shared_state_scope_1 = require("./state/shared-state-scope"), shared_state_refresh_1 = require("./state/shared-state-refresh"), state_perf_monitor_1 = require("./state/state-perf-monitor"), _tempBounds = new vutils_1.AABBBounds, loadShadowRootFactory = () => require("./shadow-root"), tempMatrix = new vutils_1.Matrix;
7
+ const vutils_1 = require("@visactor/vutils"), node_tree_1 = require("./node-tree"), event_1 = require("../event"), config_1 = require("./config"), application_1 = require("../application"), custom_path2d_1 = require("../common/custom-path2d"), loader_1 = require("../resource-loader/loader"), enums_1 = require("../common/enums"), bounds_context_1 = require("../common/bounds-context"), render_command_list_1 = require("../common/render-command-list"), utils_1 = require("../common/utils"), builtin_symbol_1 = require("./builtin-symbol"), xml_1 = require("../common/xml"), constants_1 = require("./constants"), config_2 = require("../animate/config"), canvas_1 = require("../canvas"), state_definition_compiler_1 = require("./state/state-definition-compiler"), state_engine_1 = require("./state/state-engine"), attribute_update_classifier_1 = require("./state/attribute-update-classifier"), state_transition_orchestrator_1 = require("./state/state-transition-orchestrator"), shared_state_scope_1 = require("./state/shared-state-scope"), shared_state_refresh_1 = require("./state/shared-state-refresh"), _tempBounds = new vutils_1.AABBBounds, loadShadowRootFactory = () => require("./shadow-root"), tempMatrix = new vutils_1.Matrix;
8
8
 
9
9
  exports.PURE_STYLE_KEY = [ "stroke", "opacity", "strokeOpacity", "lineDash", "lineDashOffset", "lineCap", "lineJoin", "miterLimit", "fill", "fillOpacity" ],
10
10
  exports.GRAPHIC_UPDATE_TAG_KEY = [ "lineWidth", "scaleX", "scaleY", "angle", "anchor", "visible" ];
11
11
 
12
- 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 vutils_1.Point;
12
+ 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 vutils_1.Point, EMPTY_STATE_NAMES = [], BROAD_UPDATE_CATEGORY = attribute_update_classifier_1.UpdateCategory.PAINT | attribute_update_classifier_1.UpdateCategory.SHAPE | attribute_update_classifier_1.UpdateCategory.BOUNDS | attribute_update_classifier_1.UpdateCategory.TRANSFORM | attribute_update_classifier_1.UpdateCategory.LAYOUT;
13
13
 
14
14
  function isPlainObjectValue(value) {
15
- return "object" == typeof value && null != value && !(0, vutils_1.isArray)(value);
15
+ return "object" == typeof value && null != value && !Array.isArray(value);
16
16
  }
17
17
 
18
18
  function cloneAttributeValue(value) {
@@ -24,14 +24,6 @@ function cloneAttributeValue(value) {
24
24
  })), clone;
25
25
  }
26
26
 
27
- function cloneSimpleAttributeRecord(value) {
28
- return isPlainObjectValue(value) ? Object.assign({}, value) : value;
29
- }
30
-
31
- function shouldUseSimpleAttributeFastPath(value) {
32
- return !!isPlainObjectValue(value) && !Object.keys(value).some((key => isPlainObjectValue(value[key])));
33
- }
34
-
35
27
  function cloneAttributeSurface(value) {
36
28
  if (!isPlainObjectValue(value)) return value;
37
29
  const source = value, clone = {};
@@ -41,6 +33,11 @@ function cloneAttributeSurface(value) {
41
33
  })), clone;
42
34
  }
43
35
 
36
+ function areAttributeValuesEqual(left, right) {
37
+ return left === right || !!(isPlainObjectValue(left) || isPlainObjectValue(right) || Array.isArray(left) || Array.isArray(right)) && (0,
38
+ vutils_1.isEqual)(left, right);
39
+ }
40
+
44
41
  function deepMergeAttributeValue(base, value) {
45
42
  var _a;
46
43
  const result = null !== (_a = cloneAttributeValue(base)) && void 0 !== _a ? _a : {};
@@ -50,7 +47,7 @@ function deepMergeAttributeValue(base, value) {
50
47
  })), result;
51
48
  }
52
49
 
53
- exports.shouldUseSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath, exports.NOWORK_ANIMATE_ATTR = {
50
+ exports.NOWORK_ANIMATE_ATTR = {
54
51
  strokeSeg: 1,
55
52
  boundsPadding: 2,
56
53
  pickMode: 1,
@@ -104,19 +101,28 @@ class Graphic extends node_tree_1.Node {
104
101
  get globalTransMatrix() {
105
102
  return this.tryUpdateGlobalTransMatrix(!0);
106
103
  }
104
+ get baseAttributes() {
105
+ var _a;
106
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
107
+ }
108
+ set baseAttributes(value) {
109
+ value !== this.attribute ? this._baseAttributes = value : this._baseAttributes = void 0;
110
+ }
107
111
  constructor(params = {}) {
108
112
  var _a;
109
- super(), this.resolverEpoch = 0, this._AABBBounds = new vutils_1.AABBBounds, this._updateTag = enums_1.UpdateTag.INIT;
110
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params), initialBaseAttributes = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params);
111
- this.baseAttributes = initialBaseAttributes, this.attribute = useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(initialBaseAttributes) : cloneAttributeSurface(initialBaseAttributes),
112
- this.valid = this.isValid(), this.updateAABBBoundsStamp = 0, params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0),
113
- isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
113
+ super(), this._AABBBounds = new vutils_1.AABBBounds, this._updateTag = enums_1.UpdateTag.INIT,
114
+ this.attribute = params, this.valid = this.isValid(), this.updateAABBBoundsStamp = 0,
115
+ params.background && this.loadImage(null !== (_a = params.background.background) && void 0 !== _a ? _a : params.background, !0),
116
+ params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1),
117
+ params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic);
114
118
  }
115
119
  get normalAttrs() {
116
120
  return this.baseAttributes;
117
121
  }
118
- set normalAttrs(value) {
119
- this._deprecatedNormalAttrsView = null != value ? value : void 0;
122
+ set normalAttrs(_value) {}
123
+ getBaseAttributesStorage() {
124
+ var _a;
125
+ return null !== (_a = this._baseAttributes) && void 0 !== _a ? _a : this.attribute;
120
126
  }
121
127
  getGraphicService() {
122
128
  var _a, _b;
@@ -125,12 +131,6 @@ class Graphic extends node_tree_1.Node {
125
131
  getAttributes() {
126
132
  return this.attribute;
127
133
  }
128
- getStateStyleResolver(mergeMode) {
129
- return "deep" === mergeMode ? (this.deepStateStyleResolver || (this.deepStateStyleResolver = new state_style_resolver_1.StateStyleResolver({
130
- mergeMode: "deep"
131
- })), this.deepStateStyleResolver) : (this.stateStyleResolver || (this.stateStyleResolver = new state_style_resolver_1.StateStyleResolver),
132
- this.stateStyleResolver);
133
- }
134
134
  getStateTransitionOrchestrator() {
135
135
  return this.stateTransitionOrchestrator || (this.stateTransitionOrchestrator = new state_transition_orchestrator_1.StateTransitionOrchestrator),
136
136
  this.stateTransitionOrchestrator;
@@ -149,17 +149,23 @@ class Graphic extends node_tree_1.Node {
149
149
  const nextScope = this.resolveBoundSharedStateScope();
150
150
  return this.boundSharedStateScope === nextScope ? (this.syncSharedStateActiveRegistrations(),
151
151
  !1) : (this.boundSharedStateScope = nextScope, this.boundSharedStateRevision = void 0,
152
- this.localFallbackCompiledDefinitions = void 0, this.compiledStateDefinitions = void 0,
153
- this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0,
154
- this.stateEngineStateProxyModeKey = void 0, this.syncSharedStateActiveRegistrations(),
152
+ this.compiledStateDefinitions = void 0, this.compiledStateDefinitionsCacheKey = void 0,
153
+ this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0, this.syncSharedStateActiveRegistrations(),
155
154
  markDirty && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.markSharedStateDirty(),
156
155
  !0);
157
156
  }
158
- syncSharedStateActiveRegistrations() {
157
+ syncSharedStateScopeBindingOnTreeChange(markDirty = !0) {
159
158
  var _a, _b;
160
- const nextScopes = (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && this.boundSharedStateScope ? new Set((0,
161
- shared_state_scope_1.collectSharedStateScopeChain)(this.boundSharedStateScope)) : new Set;
162
- (null !== (_b = this.registeredActiveScopes) && void 0 !== _b ? _b : new Set).forEach((scope => {
159
+ return !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.boundSharedStateScope || (null === (_b = this.registeredActiveScopes) || void 0 === _b ? void 0 : _b.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingFromTree(markDirty);
160
+ }
161
+ syncSharedStateActiveRegistrations() {
162
+ var _a;
163
+ const previousScopes = this.registeredActiveScopes;
164
+ if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.boundSharedStateScope) return (null == previousScopes ? void 0 : previousScopes.size) && (previousScopes.forEach((scope => {
165
+ scope.subtreeActiveDescendants.delete(this);
166
+ })), previousScopes.clear()), void (this.registeredActiveScopes = void 0);
167
+ const nextScopes = new Set((0, shared_state_scope_1.collectSharedStateScopeChain)(this.boundSharedStateScope));
168
+ null == previousScopes || previousScopes.forEach((scope => {
163
169
  nextScopes.has(scope) || scope.subtreeActiveDescendants.delete(this);
164
170
  })), nextScopes.forEach((scope => {
165
171
  scope.subtreeActiveDescendants.add(this);
@@ -176,7 +182,7 @@ class Graphic extends node_tree_1.Node {
176
182
  (0, shared_state_refresh_1.scheduleStageSharedStateRefresh)(this.stage);
177
183
  }
178
184
  onParentSharedStateTreeChanged(stage, layer) {
179
- this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingFromTree() : this.setStage(stage, layer);
185
+ this.stage === stage && this.layer === layer ? this.syncSharedStateScopeBindingOnTreeChange() : this.setStage(stage, layer);
180
186
  }
181
187
  refreshSharedStateBeforeRender() {
182
188
  var _a;
@@ -184,15 +190,13 @@ class Graphic extends node_tree_1.Node {
184
190
  this.boundSharedStateScope && (0, shared_state_scope_1.ensureSharedStateScopeFresh)(this.boundSharedStateScope),
185
191
  this.recomputeCurrentStatePatch(), this.stopStateAnimates(), this._restoreAttributeFromStaticTruth({
186
192
  type: enums_1.AttributeUpdateType.STATE
187
- }), this._emitCustomEvent("afterStateUpdate", {
188
- type: enums_1.AttributeUpdateType.STATE
189
- }), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
193
+ }), this.emitStateUpdateEvent(), this.sharedStateDirty = !1) : this.sharedStateDirty = !1;
190
194
  }
191
195
  getLocalStatesVersion() {
192
196
  var _a, _b;
193
197
  return this.localStateDefinitionsSource !== this.states && (this.localStateDefinitionsSource = this.states,
194
- this.localFallbackVersion = (null !== (_a = this.localFallbackVersion) && void 0 !== _a ? _a : 0) + 1),
195
- null !== (_b = this.localFallbackVersion) && void 0 !== _b ? _b : 0;
198
+ this.localStateDefinitionsVersion = (null !== (_a = this.localStateDefinitionsVersion) && void 0 !== _a ? _a : 0) + 1),
199
+ null !== (_b = this.localStateDefinitionsVersion) && void 0 !== _b ? _b : 0;
196
200
  }
197
201
  resolveEffectiveCompiledDefinitions() {
198
202
  this.syncSharedStateScopeBindingFromTree(!1);
@@ -202,49 +206,25 @@ class Graphic extends node_tree_1.Node {
202
206
  const hasStates = !!this.states && Object.keys(this.states).length > 0;
203
207
  if (!boundScope) {
204
208
  if (!hasStates) return {
205
- compiledDefinitions: void 0,
206
- stateProxyModeKey: "none"
209
+ compiledDefinitions: void 0
207
210
  };
208
211
  const cacheKey = `local:${this.getLocalStatesVersion()}`;
209
212
  return this.compiledStateDefinitions && this.compiledStateDefinitionsCacheKey === cacheKey || (this.compiledStateDefinitions = (new state_definition_compiler_1.StateDefinitionCompiler).compile(this.states),
210
213
  this.compiledStateDefinitionsCacheKey = cacheKey), {
211
- compiledDefinitions: this.compiledStateDefinitions,
212
- stateProxyModeKey: this.stateProxy ? "legacy-all" : "none"
214
+ compiledDefinitions: this.compiledStateDefinitions
213
215
  };
214
216
  }
215
- const sharedCompiledDefinitions = boundScope.effectiveCompiledDefinitions, sharedStateProxyModeKey = this.stateProxy ? "shared-missing-only" : "none", sharedStateProxyEligibility = this.stateProxy ? stateName => !sharedCompiledDefinitions.has(stateName) : void 0;
216
- if (!hasStates) return this.localFallbackCompiledDefinitions = void 0, {
217
- compiledDefinitions: sharedCompiledDefinitions,
218
- stateProxyModeKey: sharedStateProxyModeKey,
219
- stateProxyEligibility: sharedStateProxyEligibility
220
- };
221
- const localStates = this.states, missingLocalStateDefinitions = {}, missingStateNames = [];
222
- if (Object.keys(localStates).forEach((stateName => {
223
- sharedCompiledDefinitions.has(stateName) || (missingLocalStateDefinitions[stateName] = localStates[stateName],
224
- missingStateNames.push(stateName));
225
- })), !missingStateNames.length) return this.localFallbackCompiledDefinitions = void 0,
226
- {
227
- compiledDefinitions: sharedCompiledDefinitions,
228
- stateProxyModeKey: sharedStateProxyModeKey,
229
- stateProxyEligibility: sharedStateProxyEligibility
230
- };
231
- const localStatesVersion = this.getLocalStatesVersion(), stateProxyModeKey = this.stateProxy ? `missing:${missingStateNames.sort().join("|")}` : "none", cacheKey = `shared:${boundScope.revision}:fallback:${localStatesVersion}:${stateProxyModeKey}`;
232
- return this.localFallbackCompiledDefinitions && this.compiledStateDefinitionsCacheKey === cacheKey || (this.localFallbackCompiledDefinitions = (new state_definition_compiler_1.StateDefinitionCompiler).compile(Object.assign(Object.assign({}, boundScope.effectiveSourceDefinitions), missingLocalStateDefinitions)),
233
- this.compiledStateDefinitionsCacheKey = cacheKey), {
234
- compiledDefinitions: this.localFallbackCompiledDefinitions,
235
- stateProxyModeKey: stateProxyModeKey,
236
- stateProxyEligibility: sharedStateProxyEligibility
217
+ return {
218
+ compiledDefinitions: boundScope.effectiveCompiledDefinitions
237
219
  };
238
220
  }
239
221
  recomputeCurrentStatePatch() {
240
- var _a, _b, _c, _d;
222
+ var _a, _b;
241
223
  if (!(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length)) return this.effectiveStates = [],
242
224
  this.resolvedStatePatch = void 0, void this.syncSharedStateActiveRegistrations();
243
- const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute, stateModel = this.createStateModel();
244
- null === (_c = this.stateEngine) || void 0 === _c || _c.setResolveContext(this, stateResolveBaseAttrs);
245
- const transition = stateModel.useStates(this.currentStates), effectiveStates = null !== (_d = transition.effectiveStates) && void 0 !== _d ? _d : 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);
225
+ 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) : {};
246
226
  this.currentStates = transition.states, this.effectiveStates = [ ...effectiveStates ],
247
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs), this.syncSharedStateActiveRegistrations();
227
+ this.resolvedStatePatch = resolvedStateAttrs, this.syncSharedStateActiveRegistrations();
248
228
  }
249
229
  buildStaticAttributeSnapshot() {
250
230
  var _a;
@@ -270,79 +250,194 @@ class Graphic extends node_tree_1.Node {
270
250
  } else assignFallbackAttr(this.getStateTransitionDefaultAttribute(key, staticTargetAttrs));
271
251
  })), extraAttrs;
272
252
  }
273
- syncObjectToSnapshot(target, snapshot) {
253
+ syncObjectToSnapshot(target, snapshot, excludedKeys) {
274
254
  const delta = new Map;
275
255
  return new Set([ ...Object.keys(target), ...Object.keys(snapshot) ]).forEach((key => {
256
+ if (!0 === (null == excludedKeys ? void 0 : excludedKeys[key])) return;
276
257
  const hasNext = Object.prototype.hasOwnProperty.call(snapshot, key), previousValue = target[key];
277
258
  if (!hasNext) return void (Object.prototype.hasOwnProperty.call(target, key) && (delta.set(key, {
278
259
  prev: previousValue,
279
260
  next: void 0
280
261
  }), delete target[key]));
281
262
  const nextValue = snapshot[key];
282
- (0, vutils_1.isEqual)(previousValue, nextValue) || (delta.set(key, {
263
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
283
264
  prev: previousValue,
284
265
  next: nextValue
285
266
  }), target[key] = cloneAttributeValue(nextValue));
286
267
  })), delta;
287
268
  }
288
- _syncAttribute() {
289
- const snapshot = this.buildStaticAttributeSnapshot(), delta = this.syncObjectToSnapshot(this.attribute, snapshot);
290
- return this.valid = this.isValid(), delta;
269
+ _syncAttribute(excludedKeys) {
270
+ this.attribute === this.baseAttributes && this.resolvedStatePatch && this.detachAttributeFromBaseAttributes();
271
+ const snapshot = this.buildStaticAttributeSnapshot(), delta = this.syncObjectToSnapshot(this.attribute, snapshot, excludedKeys);
272
+ return this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !!excludedKeys,
273
+ delta;
291
274
  }
292
- _syncFinalAttributeFromStaticTruth() {
275
+ _syncFinalAttributeFromStaticTruth(excludedKeys) {
293
276
  const target = this.finalAttribute;
294
277
  if (!target) return;
295
278
  const snapshot = this.buildStaticAttributeSnapshot();
296
- this.syncObjectToSnapshot(target, snapshot);
279
+ this.syncObjectToSnapshot(target, snapshot, excludedKeys);
297
280
  }
298
- submitUpdateByDelta(delta, forceUpdateTag = !1) {
281
+ mergeAttributeDeltaCategory(category, key, prev, next) {
299
282
  var _a;
283
+ let nextCategory = "stroke" === key || "shadowBlur" === key ? (0, attribute_update_classifier_1.classifyAttributeDelta)(key, prev, next) : null !== (_a = attribute_update_classifier_1.ATTRIBUTE_CATEGORY[key]) && void 0 !== _a ? _a : attribute_update_classifier_1.UpdateCategory.PAINT;
284
+ return nextCategory & attribute_update_classifier_1.UpdateCategory.PICK && (nextCategory |= attribute_update_classifier_1.UpdateCategory.BOUNDS),
285
+ nextCategory === attribute_update_classifier_1.UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = attribute_update_classifier_1.UpdateCategory.SHAPE | attribute_update_classifier_1.UpdateCategory.BOUNDS),
286
+ category | nextCategory;
287
+ }
288
+ submitUpdateByCategory(category, forceUpdateTag = !1) {
300
289
  if (forceUpdateTag) return this.addUpdateShapeAndBoundsTag(), this.addUpdatePositionTag(),
301
290
  void this.addUpdateLayoutTag();
302
- let category = attribute_update_classifier_1.UpdateCategory.NONE;
303
- delta.forEach(((entry, key) => {
304
- let nextCategory = (0, attribute_update_classifier_1.classifyAttributeDelta)(key, entry.prev, entry.next);
305
- nextCategory & attribute_update_classifier_1.UpdateCategory.PICK && (nextCategory |= attribute_update_classifier_1.UpdateCategory.BOUNDS),
306
- nextCategory === attribute_update_classifier_1.UpdateCategory.PAINT && this.needUpdateTag(key) && (nextCategory = attribute_update_classifier_1.UpdateCategory.SHAPE | attribute_update_classifier_1.UpdateCategory.BOUNDS),
307
- category |= nextCategory;
308
- })), category !== attribute_update_classifier_1.UpdateCategory.NONE && (null === (_a = (0,
309
- state_perf_monitor_1.getStageStatePerfMonitor)(this.stage)) || void 0 === _a || _a.recordCategory(category)),
310
- category & attribute_update_classifier_1.UpdateCategory.SHAPE ? this.addUpdateShapeAndBoundsTag() : category & attribute_update_classifier_1.UpdateCategory.BOUNDS && this.addUpdateBoundTag(),
291
+ (category & BROAD_UPDATE_CATEGORY) !== BROAD_UPDATE_CATEGORY ? (category & attribute_update_classifier_1.UpdateCategory.SHAPE ? this.addUpdateShapeAndBoundsTag() : category & attribute_update_classifier_1.UpdateCategory.BOUNDS && this.addUpdateBoundTag(),
311
292
  category & attribute_update_classifier_1.UpdateCategory.PAINT && this.addUpdatePaintTag(),
312
293
  category & attribute_update_classifier_1.UpdateCategory.TRANSFORM && this.addUpdatePositionTag(),
313
- category & attribute_update_classifier_1.UpdateCategory.LAYOUT && this.addUpdateLayoutTag();
294
+ category & attribute_update_classifier_1.UpdateCategory.LAYOUT && this.addUpdateLayoutTag()) : this.addBroadUpdateTag();
295
+ }
296
+ submitUpdateByDelta(delta, forceUpdateTag = !1) {
297
+ let category = attribute_update_classifier_1.UpdateCategory.NONE;
298
+ delta.forEach(((entry, key) => {
299
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
300
+ })), this.submitUpdateByCategory(category, forceUpdateTag);
301
+ }
302
+ submitTouchedKeyUpdate(keys, forceUpdateTag = !1) {
303
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
304
+ }
305
+ submitTouchedUpdate(needsShapeAndBounds) {
306
+ !this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds ? this.addUpdateShapeAndBoundsTag() : this.addUpdateBoundTag(),
307
+ this.addUpdatePositionTag(), this.addUpdateLayoutTag();
314
308
  }
315
309
  commitBaseAttributeMutation(forceUpdateTag = !1, context) {
316
- var _a, _b;
317
- (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && (this.resolverEpoch += 1,
318
- null === (_b = this.stateEngine) || void 0 === _b || _b.invalidateResolverCache(),
310
+ var _a, _b, _c;
311
+ (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) && (this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1,
312
+ null === (_c = this.stateEngine) || void 0 === _c || _c.invalidateResolverCache(),
319
313
  this.recomputeCurrentStatePatch());
320
314
  const delta = this._syncAttribute();
321
315
  this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
322
316
  }
317
+ canCommitBaseAttributesByTouchedKeys() {
318
+ var _a, _b;
319
+ return !((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || this.resolvedStatePatch || this.attributeMayContainTransientAttrs) && (!(null === (_b = this.animates) || void 0 === _b ? void 0 : _b.size) && !this._animationStateManager || !this.hasAnyTrackedAnimate());
320
+ }
321
+ detachAttributeFromBaseAttributes() {
322
+ this.attribute === this.baseAttributes && (this._baseAttributes = this.attribute,
323
+ this.attribute = cloneAttributeSurface(this.attribute));
324
+ }
325
+ commitInternalBaseAttributes(params, context) {
326
+ params && Object.keys(params).length && (this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, !1, context) : (this.detachAttributeFromBaseAttributes(),
327
+ this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context)));
328
+ }
329
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = !1, context) {
330
+ const source = params, baseAttributes = this.getBaseAttributesStorage();
331
+ let hasKeys = !1, needsShapeAndBounds = forceUpdateTag;
332
+ for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (hasKeys = !0,
333
+ baseAttributes[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
334
+ hasKeys && (this.attribute = baseAttributes, this._baseAttributes = void 0, this.valid = this.isValid(),
335
+ this.attributeMayContainTransientAttrs = !1, this.submitTouchedUpdate(needsShapeAndBounds),
336
+ this.onAttributeUpdate(context));
337
+ }
338
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = !1, context) {
339
+ this.getBaseAttributesStorage()[key] = value, this.attribute = this.getBaseAttributesStorage(),
340
+ this._baseAttributes = void 0, this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1,
341
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTag(key)), this.onAttributeUpdate(context);
342
+ }
323
343
  applyBaseAttributes(params) {
324
344
  const keys = Object.keys(params);
325
345
  for (let i = 0; i < keys.length; i++) {
326
346
  const key = keys[i];
327
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
347
+ this.getBaseAttributesStorage()[key] = params[key];
328
348
  }
329
349
  }
350
+ _commitAnimationStaticAttributes(params, context) {
351
+ if (!params) return;
352
+ const source = params, baseAttributes = this.getBaseAttributesStorage(), target = this.attribute, delta = new Map;
353
+ let hasKeys = !1;
354
+ for (const key in source) {
355
+ if (!Object.prototype.hasOwnProperty.call(source, key)) continue;
356
+ hasKeys = !0;
357
+ const previousValue = target[key], nextValue = source[key];
358
+ baseAttributes[key] = nextValue, target[key] = nextValue, areAttributeValuesEqual(previousValue, nextValue) || delta.set(key, {
359
+ prev: previousValue,
360
+ next: nextValue
361
+ });
362
+ }
363
+ hasKeys && (this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !0,
364
+ this.submitUpdateByDelta(delta), this.onAttributeUpdate(context));
365
+ }
366
+ applyAnimationTransientAttributes(params, forceUpdateTag = !1, context) {
367
+ const source = params;
368
+ let target, needsShapeAndBounds = forceUpdateTag;
369
+ for (const key in source) Object.prototype.hasOwnProperty.call(source, key) && (target || (this.detachAttributeFromBaseAttributes(),
370
+ target = this.attribute), target[key] = source[key], !needsShapeAndBounds && this.needUpdateTag(key) && (needsShapeAndBounds = !0));
371
+ target && (this.attributeMayContainTransientAttrs = !0, this.valid = this.isValid(),
372
+ this.submitTouchedUpdate(needsShapeAndBounds), this.onAttributeUpdate(context));
373
+ }
330
374
  applyTransientAttributes(params, forceUpdateTag = !1, context) {
375
+ this.detachAttributeFromBaseAttributes();
331
376
  const delta = new Map, keys = Object.keys(params);
332
377
  for (let i = 0; i < keys.length; i++) {
333
378
  const key = keys[i], previousValue = this.attribute[key], nextValue = params[key];
334
- (0, vutils_1.isEqual)(previousValue, nextValue) || (delta.set(key, {
379
+ areAttributeValuesEqual(previousValue, nextValue) || (delta.set(key, {
335
380
  prev: previousValue,
336
381
  next: nextValue
337
- }), this.attribute[key] = cloneAttributeValue(nextValue));
382
+ }), this.attribute[key] = nextValue);
338
383
  }
339
- this.valid = this.isValid(), this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
384
+ delta.size && (this.attributeMayContainTransientAttrs = !0), this.valid = this.isValid(),
385
+ this.submitUpdateByDelta(delta, forceUpdateTag), this.onAttributeUpdate(context);
340
386
  }
341
- _restoreAttributeFromStaticTruth(context) {
342
- this._syncFinalAttributeFromStaticTruth();
343
- const delta = this._syncAttribute();
387
+ _restoreAttributeFromStaticTruth(context, excludedKeys) {
388
+ this._syncFinalAttributeFromStaticTruth(excludedKeys);
389
+ const delta = this._syncAttribute(excludedKeys);
344
390
  this.submitUpdateByDelta(delta), this.onAttributeUpdate(context);
345
391
  }
392
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
393
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
394
+ if (!nextPatch) return keys;
395
+ for (const key in nextPatch) Object.prototype.hasOwnProperty.call(nextPatch, key) && !Object.prototype.hasOwnProperty.call(null != previousPatch ? previousPatch : {}, key) && keys.push(key);
396
+ return keys;
397
+ }
398
+ getStaticTruthValueForStateKey(key, nextPatch) {
399
+ var _a;
400
+ const baseAttributes = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {}, patch = nextPatch;
401
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
402
+ const patchValue = patch[key], baseValue = baseAttributes[key];
403
+ return "deep" === this.stateMergeMode && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue) ? {
404
+ hasValue: !0,
405
+ value: deepMergeAttributeValue(baseValue, patchValue)
406
+ } : {
407
+ hasValue: !0,
408
+ value: patchValue
409
+ };
410
+ }
411
+ return Object.prototype.hasOwnProperty.call(baseAttributes, key) ? {
412
+ hasValue: !0,
413
+ value: baseAttributes[key]
414
+ } : {
415
+ hasValue: !1,
416
+ value: void 0
417
+ };
418
+ }
419
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = !1) {
420
+ let category = attribute_update_classifier_1.UpdateCategory.NONE;
421
+ for (let i = 0; i < keys.length; i++) {
422
+ const key = keys[i], previousValue = target[key], next = this.getStaticTruthValueForStateKey(key, nextPatch);
423
+ if (!next.hasValue) {
424
+ Object.prototype.hasOwnProperty.call(target, key) && (delete target[key], collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, void 0)));
425
+ continue;
426
+ }
427
+ if (areAttributeValuesEqual(previousValue, next.value)) continue;
428
+ const nextValue = cloneAttributeValue(next.value);
429
+ target[key] = nextValue, collectCategory && (category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue));
430
+ }
431
+ return category;
432
+ }
433
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
434
+ this.detachAttributeFromBaseAttributes();
435
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch), finalAttribute = this.finalAttribute;
436
+ finalAttribute && this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, !1);
437
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, !0);
438
+ this.valid = this.isValid(), this.attributeMayContainTransientAttrs = !1, this.submitUpdateByCategory(category),
439
+ this.onAttributeUpdate(context);
440
+ }
346
441
  setMode(mode) {
347
442
  "3d" === mode ? this.set3dMode() : this.set2dMode();
348
443
  }
@@ -362,7 +457,7 @@ class Graphic extends node_tree_1.Node {
362
457
  return point;
363
458
  }
364
459
  onAnimateBind(animate) {
365
- this._emitCustomEvent("animate-bind", animate);
460
+ this.detachAttributeFromBaseAttributes(), this._emitCustomEvent("animate-bind", animate);
366
461
  }
367
462
  visitTrackedAnimates(cb) {
368
463
  const hook = this.forEachTrackedAnimate;
@@ -375,8 +470,22 @@ class Graphic extends node_tree_1.Node {
375
470
  const getTrackedAnimates = this.getTrackedAnimates;
376
471
  return "function" == typeof getTrackedAnimates ? getTrackedAnimates.call(this).size > 0 : !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size);
377
472
  }
473
+ mayHaveTrackedAnimates() {
474
+ var _a;
475
+ return !!(null === (_a = this.animates) || void 0 === _a ? void 0 : _a.size) || !!this._animationStateManager;
476
+ }
378
477
  tryUpdateAABBBounds() {
478
+ if (!(this.shadowRoot || this._updateTag & enums_1.UpdateTag.UPDATE_BOUNDS)) return this._AABBBounds;
379
479
  const full = "imprecise" === this.attribute.boundsMode;
480
+ if (!this.shadowRoot) {
481
+ const graphicService = this.getGraphicService(), graphicTheme = this.getGraphicTheme();
482
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) return this._AABBBounds;
483
+ if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
484
+ graphicService.beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
485
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
486
+ return graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, !0),
487
+ "empty" === this.attribute.boundsMode && bounds.clear(), bounds;
488
+ }
380
489
  if (!this.shouldUpdateAABBBounds()) return this._AABBBounds;
381
490
  if (!this.valid) return this._AABBBounds.clear(), this._AABBBounds;
382
491
  this.getGraphicService().beforeUpdateAABBBounds(this, this.stage, !0, this._AABBBounds);
@@ -442,11 +551,11 @@ class Graphic extends node_tree_1.Node {
442
551
  const _parsedPath = new builtin_symbol_1.CustomSymbolClass(symbolType, cache);
443
552
  return Graphic.userSymbolMap[symbolType] = _parsedPath, _parsedPath;
444
553
  }
445
- doUpdateAABBBounds(full) {
554
+ doUpdateAABBBounds(full, graphicTheme) {
446
555
  this.updateAABBBoundsStamp++;
447
- const graphicTheme = this.getGraphicTheme();
556
+ const resolvedGraphicTheme = null != graphicTheme ? graphicTheme : this.getGraphicTheme();
448
557
  this._AABBBounds.clear();
449
- const attribute = this.attribute, bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full), {boundsPadding: boundsPadding = graphicTheme.boundsPadding} = attribute, paddingArray = (0,
558
+ const attribute = this.attribute, bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full), {boundsPadding: boundsPadding = resolvedGraphicTheme.boundsPadding} = attribute, paddingArray = (0,
450
559
  utils_1.parsePadding)(boundsPadding);
451
560
  return paddingArray && bounds.expand(paddingArray), this.clearUpdateBoundTag(),
452
561
  bounds;
@@ -519,27 +628,72 @@ class Graphic extends node_tree_1.Node {
519
628
  this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1, this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
520
629
  }
521
630
  setAttributesAndPreventAnimate(params, forceUpdateTag = !1, context, ignorePriority) {
631
+ if (!params) return;
632
+ const keys = Object.keys(params);
633
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context), this.syncFinalAttributesFromUpdateContext(context),
522
634
  this.visitTrackedAnimates((animate => {
523
- (animate.priority !== 1 / 0 || ignorePriority) && Object.keys(params).forEach((key => {
524
- animate.preventAttr(key);
525
- }));
635
+ (animate.priority !== 1 / 0 || ignorePriority) && animate.preventAttrs(keys);
526
636
  })), this.applyTransientAttributes(params, forceUpdateTag, context);
527
637
  }
638
+ syncFinalAttributesFromUpdateContext(context) {
639
+ var _a;
640
+ const updateType = null == context ? void 0 : context.type;
641
+ if (updateType === enums_1.AttributeUpdateType.STATE || null != updateType && updateType >= enums_1.AttributeUpdateType.ANIMATE_BIND && updateType <= enums_1.AttributeUpdateType.ANIMATE_END) return;
642
+ const finalAttrs = null === (_a = this.context) || void 0 === _a ? void 0 : _a.finalAttrs, setFinalAttributes = this.setFinalAttributes;
643
+ finalAttrs && "function" == typeof setFinalAttributes && setFinalAttributes.call(this, finalAttrs);
644
+ }
645
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
646
+ var _a, _b;
647
+ const graphicContext = this.context, diffAttrs = null !== (_a = null == graphicContext ? void 0 : graphicContext.diffAttrs) && void 0 !== _a ? _a : params, updateType = null == context ? void 0 : context.type;
648
+ if (!keys.length || !diffAttrs || updateType === enums_1.AttributeUpdateType.STATE || null != updateType && updateType >= enums_1.AttributeUpdateType.ANIMATE_BIND && updateType <= enums_1.AttributeUpdateType.ANIMATE_END) return;
649
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
650
+ let fromAttrs = sameDiffAttrs && null !== (_b = this.transientFromAttrsBeforePreventAnimate) && void 0 !== _b ? _b : null;
651
+ sameDiffAttrs || (this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null);
652
+ let captured = !1;
653
+ for (let i = 0; i < keys.length; i++) {
654
+ const key = keys[i];
655
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) continue;
656
+ const previousValue = this.attribute[key], nextValue = params[key];
657
+ (0, vutils_1.isEqual)(previousValue, nextValue) || (null != fromAttrs || (fromAttrs = {}),
658
+ fromAttrs[key] = cloneAttributeValue(previousValue), captured = !0);
659
+ }
660
+ captured && (this.transientFromAttrsBeforePreventAnimate = fromAttrs, this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs);
661
+ }
662
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
663
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate, sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
664
+ if (!transientFromAttrs || !sourceDiffAttrs) return null;
665
+ for (const key in diffAttrs) if (Object.prototype.hasOwnProperty.call(diffAttrs, key) && (!Object.prototype.hasOwnProperty.call(sourceDiffAttrs, key) || !(0,
666
+ vutils_1.isEqual)(sourceDiffAttrs[key], diffAttrs[key]))) return null;
667
+ let fromAttrs = null, remaining = !1;
668
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && (Object.prototype.hasOwnProperty.call(diffAttrs, key) ? (null != fromAttrs || (fromAttrs = {}),
669
+ fromAttrs[key] = transientFromAttrs[key]) : remaining = !0);
670
+ if (remaining) {
671
+ const nextTransientFromAttrs = {};
672
+ for (const key in transientFromAttrs) Object.prototype.hasOwnProperty.call(transientFromAttrs, key) && !Object.prototype.hasOwnProperty.call(diffAttrs, key) && (nextTransientFromAttrs[key] = transientFromAttrs[key]);
673
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
674
+ } else this.transientFromAttrsBeforePreventAnimate = null, this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
675
+ return fromAttrs;
676
+ }
528
677
  setAttributes(params, forceUpdateTag = !1, context) {
529
678
  params && ((params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params).background && this.loadImage(params.background, !0),
530
- isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic),
531
- this._setAttributes(params, forceUpdateTag, context));
679
+ params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1),
680
+ params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._setAttributes(params, forceUpdateTag, context));
532
681
  }
533
682
  _setAttributes(params, forceUpdateTag = !1, context) {
534
- this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context);
683
+ this.canCommitBaseAttributesByTouchedKeys() ? this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context) : (this.detachAttributeFromBaseAttributes(),
684
+ this.applyBaseAttributes(params), this.commitBaseAttributeMutation(forceUpdateTag, context));
535
685
  }
536
686
  setAttribute(key, value, forceUpdateTag, context) {
537
687
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({
538
688
  [key]: value
539
689
  }, this.attribute, key, context);
540
- params ? this._setAttributes(params, forceUpdateTag, context) : (this.applyBaseAttributes({
541
- [key]: value
542
- }), this.commitBaseAttributeMutation(!!forceUpdateTag, context)), "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
690
+ if (params) this._setAttributes(params, forceUpdateTag, context); else if (this.canCommitBaseAttributesByTouchedKeys()) this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context); else {
691
+ const nextAttrs = {
692
+ [key]: value
693
+ };
694
+ this.applyBaseAttributes(nextAttrs), this.commitBaseAttributeMutation(!!forceUpdateTag, context);
695
+ }
696
+ "background" === key ? this.loadImage(value, !0) : "texture" === key && isExternalTexture(value) ? this.loadImage(value, !1) : "shadowGraphic" === key && this.setShadowGraphic(value);
543
697
  }
544
698
  needUpdateTags(keys, k = exports.GRAPHIC_UPDATE_TAG_KEY) {
545
699
  for (let i = 0; i < k.length; i++) {
@@ -559,10 +713,11 @@ class Graphic extends node_tree_1.Node {
559
713
  type: enums_1.AttributeUpdateType.INIT
560
714
  };
561
715
  params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context) || params,
562
- this.baseAttributes = cloneAttributeValue(params), this.attribute || (this.attribute = {}),
563
- this.resolvedStatePatch = void 0, this._syncAttribute(), params.background && this.loadImage(params.background, !0),
564
- isExternalTexture(params.texture) && this.loadImage(params.texture, !1), params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic),
565
- this._updateTag = enums_1.UpdateTag.INIT, this.valid = this.isValid(), this.onAttributeUpdate(context);
716
+ this.attribute = params, this._baseAttributes = void 0, this.resolvedStatePatch = void 0,
717
+ this.attributeMayContainTransientAttrs = !1, this.valid = this.isValid(), params.background && this.loadImage(params.background, !0),
718
+ params.texture && isExternalTexture(params.texture) && this.loadImage(params.texture, !1),
719
+ params.shadowGraphic && this.setShadowGraphic(params.shadowGraphic), this._updateTag = enums_1.UpdateTag.INIT,
720
+ this.valid = this.isValid(), this.onAttributeUpdate(context);
566
721
  }
567
722
  translate(x, y) {
568
723
  var _a, _b;
@@ -573,11 +728,15 @@ class Graphic extends node_tree_1.Node {
573
728
  x: x,
574
729
  y: y
575
730
  }, this.attribute, tempConstantXYKey, context);
576
- params && (x = params.x, y = params.y, delete params.x, delete params.y, this.applyBaseAttributes(params));
577
- const attribute = this.baseAttributes, postMatrix = attribute.postMatrix;
578
- return postMatrix ? application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y) : (attribute.x = (null !== (_a = attribute.x) && void 0 !== _a ? _a : config_1.DefaultTransform.x) + x,
579
- attribute.y = (null !== (_b = attribute.y) && void 0 !== _b ? _b : config_1.DefaultTransform.y) + y),
580
- this.commitBaseAttributeMutation(!1, context), this;
731
+ params && (x = params.x, y = params.y, delete params.x, delete params.y);
732
+ const attribute = this.baseAttributes, postMatrix = attribute.postMatrix, nextAttrs = params || {};
733
+ if (postMatrix) {
734
+ const nextPostMatrix = postMatrix.clone();
735
+ application_1.application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y),
736
+ nextAttrs.postMatrix = nextPostMatrix;
737
+ } else nextAttrs.x = (null !== (_a = attribute.x) && void 0 !== _a ? _a : config_1.DefaultTransform.x) + x,
738
+ nextAttrs.y = (null !== (_b = attribute.y) && void 0 !== _b ? _b : config_1.DefaultTransform.y) + y;
739
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
581
740
  }
582
741
  translateTo(x, y) {
583
742
  const attribute = this.baseAttributes;
@@ -588,9 +747,10 @@ class Graphic extends node_tree_1.Node {
588
747
  x: x,
589
748
  y: y
590
749
  }, this.attribute, tempConstantXYKey, context);
591
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context),
592
- this) : (attribute.x = x, attribute.y = y, this.commitBaseAttributeMutation(!1, context),
593
- this);
750
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
751
+ x: x,
752
+ y: y
753
+ }, context), this);
594
754
  }
595
755
  scale(scaleX, scaleY, scaleCenter) {
596
756
  var _a, _b;
@@ -603,15 +763,15 @@ class Graphic extends node_tree_1.Node {
603
763
  scaleCenter: scaleCenter
604
764
  }, this.attribute, tempConstantScaleXYKey, context);
605
765
  params && (scaleX = params.scaleX, scaleY = params.scaleY, delete params.scaleX,
606
- delete params.scaleY, this.applyBaseAttributes(params));
607
- const attribute = this.baseAttributes;
766
+ delete params.scaleY);
767
+ const attribute = this.baseAttributes, nextAttrs = params || {};
608
768
  if (scaleCenter) {
609
- let {postMatrix: postMatrix} = this.attribute;
610
- postMatrix || (postMatrix = new vutils_1.Matrix, attribute.postMatrix = postMatrix),
611
- application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
612
- } else attribute.scaleX = (null !== (_a = attribute.scaleX) && void 0 !== _a ? _a : config_1.DefaultTransform.scaleX) * scaleX,
613
- attribute.scaleY = (null !== (_b = attribute.scaleY) && void 0 !== _b ? _b : config_1.DefaultTransform.scaleY) * scaleY;
614
- return this.commitBaseAttributeMutation(!1, context), this;
769
+ let {postMatrix: postMatrix} = this.baseAttributes;
770
+ postMatrix = postMatrix ? postMatrix.clone() : new vutils_1.Matrix, application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter),
771
+ nextAttrs.postMatrix = postMatrix;
772
+ } else nextAttrs.scaleX = (null !== (_a = attribute.scaleX) && void 0 !== _a ? _a : config_1.DefaultTransform.scaleX) * scaleX,
773
+ nextAttrs.scaleY = (null !== (_b = attribute.scaleY) && void 0 !== _b ? _b : config_1.DefaultTransform.scaleY) * scaleY;
774
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
615
775
  }
616
776
  scaleTo(scaleX, scaleY) {
617
777
  const attribute = this.baseAttributes;
@@ -622,9 +782,10 @@ class Graphic extends node_tree_1.Node {
622
782
  scaleX: scaleX,
623
783
  scaleY: scaleY
624
784
  }, this.attribute, tempConstantScaleXYKey, context);
625
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context),
626
- this) : (attribute.scaleX = scaleX, attribute.scaleY = scaleY, this.commitBaseAttributeMutation(!1, context),
627
- this);
785
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
786
+ scaleX: scaleX,
787
+ scaleY: scaleY
788
+ }, context), this);
628
789
  }
629
790
  rotate(angle, rotateCenter) {
630
791
  var _a;
@@ -635,24 +796,23 @@ class Graphic extends node_tree_1.Node {
635
796
  angle: angle,
636
797
  rotateCenter: rotateCenter
637
798
  }, this.attribute, tempConstantAngleKey, context);
638
- params && (delete params.angle, this.applyBaseAttributes(params));
639
- const attribute = this.baseAttributes;
799
+ params && delete params.angle;
800
+ const attribute = this.baseAttributes, nextAttrs = params || {};
640
801
  if (rotateCenter) {
641
802
  let {postMatrix: postMatrix} = this.baseAttributes;
642
- postMatrix || (postMatrix = new vutils_1.Matrix, this.baseAttributes.postMatrix = postMatrix),
643
- application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
644
- } else attribute.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : config_1.DefaultTransform.angle) + angle;
645
- return this.commitBaseAttributeMutation(!1, context), this;
803
+ postMatrix = postMatrix ? postMatrix.clone() : new vutils_1.Matrix, application_1.application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter),
804
+ nextAttrs.postMatrix = postMatrix;
805
+ } else nextAttrs.angle = (null !== (_a = attribute.angle) && void 0 !== _a ? _a : config_1.DefaultTransform.angle) + angle;
806
+ return this.commitInternalBaseAttributes(nextAttrs, context), this;
646
807
  }
647
808
  rotateTo(angle) {
648
- const attribute = this.baseAttributes;
649
- if (attribute.angle === angle) return this;
809
+ if (this.baseAttributes.angle === angle) return this;
650
810
  const context = {
651
811
  type: enums_1.AttributeUpdateType.ROTATE_TO
652
812
  }, params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
653
- return params ? (this.applyBaseAttributes(params), this.commitBaseAttributeMutation(!1, context),
654
- this) : (attribute.angle = angle, this.commitBaseAttributeMutation(!1, context),
655
- this);
813
+ return params ? (this.commitInternalBaseAttributes(params, context), this) : (this.commitInternalBaseAttributes({
814
+ angle: angle
815
+ }, context), this);
656
816
  }
657
817
  skewTo(b, c) {
658
818
  return this;
@@ -672,26 +832,132 @@ class Graphic extends node_tree_1.Node {
672
832
  var _a;
673
833
  return null === (_a = this.states) || void 0 === _a ? void 0 : _a[stateName];
674
834
  }
675
- createStateModel() {
676
- const {compiledDefinitions: compiledDefinitions, stateProxyEligibility: stateProxyEligibility, stateProxyModeKey: stateProxyModeKey} = this.resolveEffectiveCompiledDefinitions();
677
- 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 state_engine_1.StateEngine({
835
+ getStateResolveBaseAttrs() {
836
+ var _a;
837
+ return null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute;
838
+ }
839
+ syncStateResolveContext(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
840
+ var _a;
841
+ return null === (_a = this.stateEngine) || void 0 === _a || _a.setResolveContext(this, stateResolveBaseAttrs),
842
+ stateResolveBaseAttrs;
843
+ }
844
+ ensureStateEngine(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
845
+ const {compiledDefinitions: compiledDefinitions} = this.resolveEffectiveCompiledDefinitions();
846
+ return this.compiledStateDefinitions = compiledDefinitions, compiledDefinitions ? this.stateEngine && this.stateEngineCompiledDefinitions === compiledDefinitions && this.stateEngineStateSort === this.stateSort && this.stateEngineMergeMode === this.stateMergeMode || (this.stateEngine = new state_engine_1.StateEngine({
678
847
  compiledDefinitions: compiledDefinitions,
679
848
  stateSort: this.stateSort,
680
- stateProxy: this.stateProxy,
681
- stateProxyEligibility: stateProxyEligibility,
682
- states: this.states,
683
849
  mergeMode: this.stateMergeMode
684
- }), this.stateEngineCompiledDefinitions = compiledDefinitions, this.stateEngineStateProxy = this.stateProxy,
685
- this.stateEngineStateSort = this.stateSort, this.stateEngineMergeMode = this.stateMergeMode,
686
- this.stateEngineStateProxyModeKey = stateProxyModeKey) : (this.stateEngine = void 0,
687
- this.stateEngineCompiledDefinitions = void 0, this.stateEngineStateProxyModeKey = void 0),
688
- new state_model_1.StateModel({
689
- states: this.states,
690
- currentStates: this.currentStates,
691
- stateSort: this.stateSort,
692
- stateProxy: this.stateProxy,
693
- stateEngine: this.stateEngine
694
- });
850
+ }), this.stateEngineCompiledDefinitions = compiledDefinitions, this.stateEngineStateSort = this.stateSort,
851
+ this.stateEngineMergeMode = this.stateMergeMode) : (this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0),
852
+ this.syncStateResolveContext(stateResolveBaseAttrs), this.stateEngine && this.currentStates && !this.sameStateNames(this.stateEngine.activeStates, this.currentStates) && this.stateEngine.applyStates(this.currentStates),
853
+ this.stateEngine;
854
+ }
855
+ toGraphicStateTransition(result) {
856
+ return {
857
+ changed: result.changed,
858
+ states: [ ...result.activeStates ],
859
+ effectiveStates: [ ...result.effectiveStates ]
860
+ };
861
+ }
862
+ sortLocalStates(states) {
863
+ return this.stateSort ? [ ...states ].sort(this.stateSort) : [ ...states ];
864
+ }
865
+ resolveLocalUseStatesTransition(states) {
866
+ var _a;
867
+ if (!states.length) return this.resolveLocalClearStatesTransition();
868
+ 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);
869
+ return {
870
+ changed: changed,
871
+ states: changed ? nextStates : [ ...previousStates ]
872
+ };
873
+ }
874
+ resolveLocalClearStatesTransition() {
875
+ return {
876
+ changed: this.hasState(),
877
+ states: []
878
+ };
879
+ }
880
+ resolveUseStatesTransition(states, stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
881
+ const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
882
+ return stateEngine ? this.toGraphicStateTransition(stateEngine.applyStates(states)) : this.resolveLocalUseStatesTransition(states);
883
+ }
884
+ resolveClearStatesTransition() {
885
+ const stateEngine = this.ensureStateEngine();
886
+ return stateEngine ? this.toGraphicStateTransition(stateEngine.clearStates()) : this.resolveLocalClearStatesTransition();
887
+ }
888
+ resolveAddStateTransition(stateName, keepCurrentStates) {
889
+ var _a;
890
+ const stateEngine = this.ensureStateEngine();
891
+ if (stateEngine) return this.toGraphicStateTransition(stateEngine.addState(stateName, keepCurrentStates));
892
+ if (this.currentStates && this.currentStates.includes(stateName) && (keepCurrentStates || 1 === this.currentStates.length)) return {
893
+ changed: !1,
894
+ states: [ ...this.currentStates ]
895
+ };
896
+ const nextStates = keepCurrentStates && (null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) ? this.currentStates.concat([ stateName ]) : [ stateName ];
897
+ return this.resolveLocalUseStatesTransition(nextStates);
898
+ }
899
+ resolveRemoveStateTransition(stateName) {
900
+ const stateEngine = this.ensureStateEngine();
901
+ if (stateEngine) return this.toGraphicStateTransition(stateEngine.removeState(stateName));
902
+ if (!this.currentStates) return {
903
+ changed: !1,
904
+ states: []
905
+ };
906
+ const filter = Array.isArray(stateName) ? s => !stateName.includes(s) : s => s !== stateName, nextStates = this.currentStates.filter(filter);
907
+ return nextStates.length === this.currentStates.length ? {
908
+ changed: !1,
909
+ states: [ ...this.currentStates ]
910
+ } : this.resolveLocalUseStatesTransition(nextStates);
911
+ }
912
+ resolveToggleStateTransition(stateName) {
913
+ const stateEngine = this.ensureStateEngine();
914
+ if (stateEngine) return this.toGraphicStateTransition(stateEngine.toggleState(stateName));
915
+ if (this.hasState(stateName)) return this.resolveRemoveStateTransition(stateName);
916
+ const nextStates = this.currentStates ? this.currentStates.slice() : [];
917
+ return nextStates.push(stateName), this.resolveLocalUseStatesTransition(nextStates);
918
+ }
919
+ resolveGraphicStateTransition(states, forceResolverRefresh = !1) {
920
+ var _a;
921
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs(), stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
922
+ forceResolverRefresh && (null == stateEngine || stateEngine.invalidateResolverCache());
923
+ const transition = stateEngine ? this.toGraphicStateTransition(stateEngine.applyStates(states)) : this.resolveLocalUseStatesTransition(states), resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
924
+ return {
925
+ transition: transition,
926
+ effectiveStates: null !== (_a = transition.effectiveStates) && void 0 !== _a ? _a : transition.states,
927
+ resolvedStateAttrs: resolvedStateAttrs
928
+ };
929
+ }
930
+ normalizeSetStatesOptions(options) {
931
+ return options && "object" == typeof options ? {
932
+ hasAnimation: options.animate,
933
+ animateSameStatePatchChange: !0 === options.animateSameStatePatchChange,
934
+ shouldRefreshSameStatePatch: !0
935
+ } : {
936
+ hasAnimation: "boolean" == typeof options ? options : void 0,
937
+ animateSameStatePatchChange: !1,
938
+ shouldRefreshSameStatePatch: !1
939
+ };
940
+ }
941
+ sameStatePatches(left, right) {
942
+ const leftRecord = null != left ? left : {}, rightRecord = null != right ? right : {}, keys = new Set([ ...Object.keys(leftRecord), ...Object.keys(rightRecord) ]);
943
+ for (const key of keys) {
944
+ if (Object.prototype.hasOwnProperty.call(leftRecord, key) !== Object.prototype.hasOwnProperty.call(rightRecord, key)) return !1;
945
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) return !1;
946
+ }
947
+ return !0;
948
+ }
949
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = !1) {
950
+ var _a;
951
+ 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);
952
+ patchChanged && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) || (this.currentStates = transition.states,
953
+ this.effectiveStates = [ ...effectiveStates ], this.resolvedStatePatch = resolvedStateAttrs,
954
+ this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), patchChanged && (hasAnimation && animateSameStatePatchChange ? (this._syncFinalAttributeFromStaticTruth(),
955
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
956
+ this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
957
+ type: enums_1.AttributeUpdateType.STATE
958
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
959
+ type: enums_1.AttributeUpdateType.STATE
960
+ }), this.emitStateUpdateEvent())));
695
961
  }
696
962
  resolveStateAnimateConfig(animateConfig) {
697
963
  var _a, _b, _c;
@@ -703,8 +969,8 @@ class Graphic extends node_tree_1.Node {
703
969
  extraAnimateAttrs: extraAnimateAttrs,
704
970
  shouldSkipDefaultAttribute: this.shouldSkipStateTransitionDefaultAttribute.bind(this)
705
971
  } : void 0;
706
- if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
707
- const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
972
+ if (isClear) return void this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
973
+ const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
708
974
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
709
975
  animateConfig: resolvedAnimateConfig,
710
976
  extraAnimateAttrs: extraAnimateAttrs,
@@ -712,9 +978,7 @@ class Graphic extends node_tree_1.Node {
712
978
  });
713
979
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
714
980
  }
715
- updateNormalAttrs(stateAttrs) {
716
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
717
- }
981
+ updateNormalAttrs(_stateAttrs) {}
718
982
  getStateTransitionDefaultAttribute(key, targetAttrs) {
719
983
  return this.getDefaultAttribute(key);
720
984
  }
@@ -724,84 +988,77 @@ class Graphic extends node_tree_1.Node {
724
988
  stopStateAnimates(type = "end") {
725
989
  const stopAnimationState = this.stopAnimationState;
726
990
  if ("function" == typeof stopAnimationState) return void stopAnimationState.call(this, "state", type);
991
+ if (!this.mayHaveTrackedAnimates()) return;
727
992
  const stateAnimates = [];
728
993
  this.visitTrackedAnimates((animate => {
729
994
  animate.stateNames && stateAnimates.push(animate);
730
995
  })), stateAnimates.forEach((animate => animate.stop(type)));
731
996
  }
732
- getNormalAttribute(key) {
733
- var _a, _b;
734
- const value = this.attribute[key];
735
- 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];
736
- }
737
997
  clearStates(hasAnimation) {
738
998
  var _a, _b, _c;
739
- const previousStates = this.currentStates ? this.currentStates.slice() : [], previousResolvedStatePatch = this.resolvedStatePatch ? cloneAttributeValue(this.resolvedStatePatch) : void 0, transition = this.createStateModel().clearStates();
999
+ const previousStates = null !== (_a = this.currentStates) && void 0 !== _a ? _a : EMPTY_STATE_NAMES, previousResolvedStatePatch = this.resolvedStatePatch, transition = this.resolveClearStatesTransition();
740
1000
  if (!transition.changed && 0 === previousStates.length) return this.currentStates = [],
741
1001
  this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1,
742
1002
  void this.clearSharedStateActiveRegistrations();
743
- const resolvedStateAttrs = cloneAttributeValue(null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : {});
1003
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent("beforeStateUpdate") ? cloneAttributeValue(null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : {}) : null !== (_c = this.baseAttributes) && void 0 !== _c ? _c : {};
744
1004
  transition.changed && !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !0) || (this.currentStates = transition.states,
745
1005
  this.effectiveStates = [], this.resolvedStatePatch = void 0, this.sharedStateDirty = !1,
746
- this.clearSharedStateActiveRegistrations(), null === (_b = (0, state_perf_monitor_1.getStageStatePerfMonitor)(this.stage)) || void 0 === _b || _b.incrementCounter("stateCommits"),
747
- null === (_c = (0, state_perf_monitor_1.getStageStatePerfMonitor)(this.stage)) || void 0 === _c || _c.recordEvent("state-commit", {
748
- graphicId: this._uid,
749
- targetStates: []
750
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
751
- this._restoreAttributeFromStaticTruth({
1006
+ this.clearSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(),
1007
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !0, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
1008
+ this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
752
1009
  type: enums_1.AttributeUpdateType.STATE
753
- }), this._emitCustomEvent("afterStateUpdate", {
1010
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, void 0, {
754
1011
  type: enums_1.AttributeUpdateType.STATE
755
- })));
1012
+ }), this.emitStateUpdateEvent()));
756
1013
  }
757
1014
  removeState(stateName, hasAnimation) {
758
- const transition = this.createStateModel().removeState(stateName);
1015
+ const transition = this.resolveRemoveStateTransition(stateName);
759
1016
  transition.changed && this.useStates(transition.states, hasAnimation);
760
1017
  }
761
1018
  toggleState(stateName, hasAnimation) {
762
- const transition = this.createStateModel().toggleState(stateName);
1019
+ const transition = this.resolveToggleStateTransition(stateName);
763
1020
  transition.changed && this.useStates(transition.states, hasAnimation);
764
1021
  }
765
1022
  addState(stateName, keepCurrentStates, hasAnimation) {
766
- const transition = this.createStateModel().addState(stateName, keepCurrentStates);
1023
+ const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
767
1024
  transition.changed && this.useStates(transition.states, hasAnimation);
768
1025
  }
1026
+ setStates(states, options) {
1027
+ var _a, _b, _c;
1028
+ const {hasAnimation: hasAnimation, animateSameStatePatchChange: animateSameStatePatchChange, shouldRefreshSameStatePatch: shouldRefreshSameStatePatch} = this.normalizeSetStatesOptions(options), nextStates = (null == states ? void 0 : states.length) ? states : EMPTY_STATE_NAMES, hasCurrentState = !!((null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || (null === (_b = this.effectiveStates) || void 0 === _b ? void 0 : _b.length) || this.resolvedStatePatch || (null === (_c = this.registeredActiveScopes) || void 0 === _c ? void 0 : _c.size));
1029
+ if (nextStates.length) {
1030
+ if (this.sameStateNames(this.currentStates, nextStates)) return shouldRefreshSameStatePatch ? void this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange) : void (this.sharedStateDirty && this.refreshSharedStateBeforeRender());
1031
+ this.useStates(nextStates, hasAnimation);
1032
+ } else {
1033
+ if (!hasCurrentState && !this.sharedStateDirty) return;
1034
+ this.clearStates(hasAnimation);
1035
+ }
1036
+ }
769
1037
  useStates(states, hasAnimation) {
770
- var _a, _b, _c, _d, _e;
1038
+ var _a;
771
1039
  if (!states.length) return void this.clearStates(hasAnimation);
772
- const previousStates = this.currentStates ? this.currentStates.slice() : [], previousResolvedStatePatch = this.resolvedStatePatch ? cloneAttributeValue(this.resolvedStatePatch) : void 0, stateResolveBaseAttrs = null !== (_a = this.baseAttributes) && void 0 !== _a ? _a : this.attribute, stateModel = this.createStateModel();
773
- null === (_b = this.stateEngine) || void 0 === _b || _b.setResolveContext(this, stateResolveBaseAttrs);
774
- const transition = stateModel.useStates(states);
775
- if (!transition.changed && this.sameStateNames(previousStates, transition.states)) return;
776
- const effectiveStates = null !== (_c = transition.effectiveStates) && void 0 !== _c ? _c : 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);
777
- this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) && (this.currentStates = transition.states,
778
- this.effectiveStates = [ ...effectiveStates ], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs),
779
- this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), null === (_d = (0,
780
- state_perf_monitor_1.getStageStatePerfMonitor)(this.stage)) || void 0 === _d || _d.incrementCounter("stateCommits"),
781
- null === (_e = (0, state_perf_monitor_1.getStageStatePerfMonitor)(this.stage)) || void 0 === _e || _e.recordEvent("state-commit", {
782
- graphicId: this._uid,
783
- targetStates: [ ...transition.states ]
784
- }), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(), this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
785
- this._restoreAttributeFromStaticTruth({
1040
+ 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);
1041
+ !transition.changed && this.sameStateNames(previousStates, transition.states) || this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, !1) && (this.currentStates = transition.states,
1042
+ this.effectiveStates = [ ...effectiveStates ], this.resolvedStatePatch = resolvedStateAttrs,
1043
+ this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), hasAnimation ? (this._syncFinalAttributeFromStaticTruth(),
1044
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, !1, void 0, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch))) : (this.stopStateAnimates(),
1045
+ this.attributeMayContainTransientAttrs ? this._restoreAttributeFromStaticTruth({
786
1046
  type: enums_1.AttributeUpdateType.STATE
787
- }), this._emitCustomEvent("afterStateUpdate", {
1047
+ }) : this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
788
1048
  type: enums_1.AttributeUpdateType.STATE
789
- })));
1049
+ }), this.emitStateUpdateEvent()));
790
1050
  }
791
1051
  invalidateResolver() {
792
1052
  var _a, _b;
793
1053
  if (!this.stateEngine || !(null === (_a = this.currentStates) || void 0 === _a ? void 0 : _a.length) || !this.compiledStateDefinitions) return;
794
- const stateResolveBaseAttrs = null !== (_b = this.baseAttributes) && void 0 !== _b ? _b : this.attribute;
795
- this.stateEngine.setResolveContext(this, stateResolveBaseAttrs), this.resolverEpoch += 1,
1054
+ this.syncStateResolveContext(), this.resolverEpoch = (null !== (_b = this.resolverEpoch) && void 0 !== _b ? _b : 0) + 1,
796
1055
  this.stateEngine.invalidateResolverCache();
797
1056
  const transition = this.stateEngine.applyStates(this.currentStates), resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
798
- this.effectiveStates = [ ...transition.effectiveStates ], this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs),
1057
+ this.effectiveStates = [ ...transition.effectiveStates ], this.resolvedStatePatch = resolvedStateAttrs,
799
1058
  this.sharedStateDirty = !1, this.syncSharedStateActiveRegistrations(), this.stopStateAnimates(),
800
1059
  this._restoreAttributeFromStaticTruth({
801
1060
  type: enums_1.AttributeUpdateType.STATE
802
- }), this._emitCustomEvent("afterStateUpdate", {
803
- type: enums_1.AttributeUpdateType.STATE
804
- });
1061
+ }), this.emitStateUpdateEvent();
805
1062
  }
806
1063
  sameStateNames(left, right) {
807
1064
  const normalizedLeft = null != left ? left : [], normalizedRight = null != right ? right : [];
@@ -823,6 +1080,10 @@ class Graphic extends node_tree_1.Node {
823
1080
  this._updateTag |= enums_1.UpdateTag.UPDATE_SHAPE_AND_BOUNDS, this.parent && this.parent.addChildUpdateBoundTag(),
824
1081
  this.glyphHost && this.glyphHost.addUpdateBoundTag();
825
1082
  }
1083
+ addBroadUpdateTag() {
1084
+ this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag(), this._updateTag |= enums_1.UpdateTag.UPDATE_SHAPE_AND_BOUNDS | enums_1.UpdateTag.UPDATE_PAINT | enums_1.UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX | enums_1.UpdateTag.UPDATE_LAYOUT,
1085
+ this.parent && this.parent.addChildUpdateBoundTag(), this.glyphHost && this.glyphHost.addUpdateBoundTag();
1086
+ }
826
1087
  updateShapeAndBoundsTagSetted() {
827
1088
  return (this._updateTag & enums_1.UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === enums_1.UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
828
1089
  }
@@ -897,12 +1158,12 @@ class Graphic extends node_tree_1.Node {
897
1158
  }
898
1159
  }
899
1160
  setStage(stage, layer) {
900
- var _a, _b, _c, _d, _e, _f, _g, _h;
1161
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
901
1162
  const graphicService = null !== (_c = null !== (_a = null == stage ? void 0 : stage.graphicService) && void 0 !== _a ? _a : null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application_1.application.graphicService, previousStage = this.stage;
902
1163
  if (this.stage !== stage || this.layer !== layer) {
903
- if (this.stage = stage, this.layer = layer, this.syncSharedStateScopeBindingFromTree(!!(null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length)),
904
- this.setStageToShadowRoot(stage, layer), this.hasAnyTrackedAnimate()) {
905
- const previousTimeline = null === (_e = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _e ? void 0 : _e.call(previousStage), nextTimeline = null === (_f = null == stage ? void 0 : stage.getTimeline) || void 0 === _f ? void 0 : _f.call(stage), detachedStageAnimates = [];
1164
+ if (this.stage = stage, this.layer = layer, ((null === (_d = this.currentStates) || void 0 === _d ? void 0 : _d.length) || this.boundSharedStateScope || (null === (_e = this.registeredActiveScopes) || void 0 === _e ? void 0 : _e.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0),
1165
+ this.setStageToShadowRoot(stage, layer), this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
1166
+ const previousTimeline = null === (_f = null == previousStage ? void 0 : previousStage.getTimeline) || void 0 === _f ? void 0 : _f.call(previousStage), nextTimeline = null === (_g = null == stage ? void 0 : stage.getTimeline) || void 0 === _g ? void 0 : _g.call(stage), detachedStageAnimates = [];
906
1167
  this.visitTrackedAnimates((a => {
907
1168
  (!!previousTimeline && a.timeline === previousTimeline || a.timeline.isGlobal) && (nextTimeline ? a.timeline !== nextTimeline && (previousTimeline && a.timeline === previousTimeline && previousTimeline.removeAnimate(a, !1),
908
1169
  a.setTimeline(nextTimeline), nextTimeline.addAnimate(a)) : previousTimeline && a.timeline === previousTimeline && (previousTimeline.removeAnimate(a, !1),
@@ -916,9 +1177,17 @@ class Graphic extends node_tree_1.Node {
916
1177
  type: enums_1.AttributeUpdateType.ANIMATE_END
917
1178
  }));
918
1179
  }
919
- return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (_g = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _g || _g.call(graphicService, this, stage));
1180
+ return this._onSetStage && this._onSetStage(this, stage, layer), void (null === (_h = null == graphicService ? void 0 : graphicService.onSetStage) || void 0 === _h || _h.call(graphicService, this, stage));
920
1181
  }
921
- this.syncSharedStateScopeBindingFromTree(!!(null === (_h = this.currentStates) || void 0 === _h ? void 0 : _h.length));
1182
+ ((null === (_j = this.currentStates) || void 0 === _j ? void 0 : _j.length) || this.boundSharedStateScope || (null === (_k = this.registeredActiveScopes) || void 0 === _k ? void 0 : _k.size) || this.sharedStateDirty) && this.syncSharedStateScopeBindingOnTreeChange(!0);
1183
+ }
1184
+ detachStageForRelease() {
1185
+ var _a, _b, _c;
1186
+ (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(),
1187
+ (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates(), this.boundSharedStateScope = void 0,
1188
+ this.boundSharedStateRevision = void 0, this.compiledStateDefinitions = void 0,
1189
+ this.compiledStateDefinitionsCacheKey = void 0, this.stateEngine = void 0, this.stateEngineCompiledDefinitions = void 0,
1190
+ this.sharedStateDirty = !1, this.stage = null, this.layer = null, this.shadowRoot && (null === (_c = (_b = this.shadowRoot).detachStageForRelease) || void 0 === _c || _c.call(_b));
922
1191
  }
923
1192
  setStageToShadowRoot(stage, layer) {
924
1193
  this.shadowRoot && this.shadowRoot.setStage(stage, layer);
@@ -993,6 +1262,7 @@ class Graphic extends node_tree_1.Node {
993
1262
  res && (res.state = "fail", cb && cb());
994
1263
  }
995
1264
  _stopAnimates() {
1265
+ if (!this.mayHaveTrackedAnimates()) return;
996
1266
  const animates = [];
997
1267
  this.visitTrackedAnimates((animate => {
998
1268
  animates.push(animate);
@@ -1006,15 +1276,19 @@ class Graphic extends node_tree_1.Node {
1006
1276
  }));
1007
1277
  }
1008
1278
  release() {
1009
- var _a, _b, _c;
1010
- this.releaseStatus = "released", this.clearSharedStateActiveRegistrations(), this.stopAnimates();
1011
- const graphicService = null !== (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.graphicService) && void 0 !== _b ? _b : application_1.application.graphicService;
1012
- null === (_c = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _c || _c.call(graphicService, this),
1279
+ var _a, _b, _c, _d;
1280
+ this.releaseStatus = "released", (null === (_a = this.registeredActiveScopes) || void 0 === _a ? void 0 : _a.size) && this.clearSharedStateActiveRegistrations(),
1281
+ (this.mayHaveTrackedAnimates() || this.shadowRoot) && this.stopAnimates();
1282
+ const graphicService = null !== (_c = null === (_b = this.stage) || void 0 === _b ? void 0 : _b.graphicService) && void 0 !== _c ? _c : application_1.application.graphicService;
1283
+ null === (_d = null == graphicService ? void 0 : graphicService.onRelease) || void 0 === _d || _d.call(graphicService, this),
1013
1284
  super.release();
1014
1285
  }
1286
+ hasCustomEvent(type) {
1287
+ return !!this._events && type in this._events;
1288
+ }
1015
1289
  _dispatchCustomEvent(type, context) {
1016
1290
  var _a, _b;
1017
- if (this._events && type in this._events) {
1291
+ if (this.hasCustomEvent(type)) {
1018
1292
  const changeEvent = new event_1.CustomEvent(type, context);
1019
1293
  changeEvent.bubbles = !1;
1020
1294
  const manager = null === (_b = null === (_a = this.stage) || void 0 === _a ? void 0 : _a.eventSystem) || void 0 === _b ? void 0 : _b.manager;
@@ -1023,7 +1297,7 @@ class Graphic extends node_tree_1.Node {
1023
1297
  return !0;
1024
1298
  }
1025
1299
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
1026
- return this._dispatchCustomEvent("beforeStateUpdate", {
1300
+ return !this.hasCustomEvent("beforeStateUpdate") || this._dispatchCustomEvent("beforeStateUpdate", {
1027
1301
  type: enums_1.AttributeUpdateType.STATE,
1028
1302
  attrs: Object.assign({}, attrs),
1029
1303
  prevStates: prevStates.slice(),
@@ -1032,6 +1306,11 @@ class Graphic extends node_tree_1.Node {
1032
1306
  isClear: !!isClear
1033
1307
  });
1034
1308
  }
1309
+ emitStateUpdateEvent() {
1310
+ this.hasCustomEvent("afterStateUpdate") && this._emitCustomEvent("afterStateUpdate", {
1311
+ type: enums_1.AttributeUpdateType.STATE
1312
+ });
1313
+ }
1035
1314
  _emitCustomEvent(type, context) {
1036
1315
  this._dispatchCustomEvent(type, context);
1037
1316
  }