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