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

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