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