@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
package/dist/index.es.js CHANGED
@@ -1,4 +1,4 @@
1
- import { EventEmitter, Logger, isBoolean, isObject, isFunction, isString, has, isUndefined, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, pointAt, isNumber as isNumber$1, sqrt, isPointInLine, Color, DEFAULT_COLORS, LRU, isEqual, OBBBounds, isNil, normalTransform, isValidUrl, isBase64, lowerCamelCaseToMiddle, isValid, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, getIntersectPoint, merge, calculateAnchorOfBounds, styleStringToObject } from '@visactor/vutils';
1
+ import { EventEmitter, Logger, isBoolean, isObject, isFunction, isString, has, isUndefined, tau, halfPi as halfPi$1, AABBBounds, degreeToRadian, PointService, Point, abs, max, min, atan2, epsilon, Matrix, pi2, isArray, cos, sin, pi, pointAt, isNumber as isNumber$1, sqrt, isPointInLine, Color, DEFAULT_COLORS, LRU, OBBBounds, isEqual, isNil, normalTransform, isValidUrl, isBase64, lowerCamelCaseToMiddle, isValid, getContextFont, rotatePoint, transformBoundsWithMatrix, clampAngleByRadian, asin, isNumberClose, TextMeasure, Bounds, getRectIntersect, isRectIntersect, arrayEqual, acos, getIntersectPoint, merge, calculateAnchorOfBounds, styleStringToObject } from '@visactor/vutils';
2
2
 
3
3
  /******************************************************************************
4
4
  Copyright (c) Microsoft Corporation.
@@ -698,6 +698,9 @@ class Node extends EventEmitter {
698
698
  this.parent = null;
699
699
  this._count = 1;
700
700
  }
701
+ onParentSharedStateTreeChanged(_stage, _layer) {
702
+ return;
703
+ }
701
704
  forEachChildren(cb, reverse = false) {
702
705
  if (reverse) {
703
706
  let child = this._lastChild;
@@ -4759,7 +4762,7 @@ function addAttributeToPrototype(obj, c, keys) {
4759
4762
  function rewriteProto(obj, c) {
4760
4763
  Object.setPrototypeOf(obj, c);
4761
4764
  }
4762
- const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), { startAngle: 0, endAngle: pi2, innerRadius: 0, outerRadius: 1, innerPadding: 0, outerPadding: 0, cornerRadius: 0, padRadius: 0, padAngle: 0, cap: false, forceShowCap: false });
4765
+ const DefaultArcAttribute = Object.assign(Object.assign({}, DefaultAttribute), { startAngle: 0, endAngle: pi2, innerRadius: 0, outerRadius: 1, innerPadding: 0, outerPadding: 0, cornerRadius: 0, padRadius: 0, padAngle: 0, clipRange: 1, cap: false, forceShowCap: false });
4763
4766
  const DefaultAreaAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultConnectAttribute), { points: [], segments: [], curveType: 'linear', clipRange: 1, closePath: false, curveTension: 1 });
4764
4767
  const DefaultCircleAttribute = Object.assign(Object.assign({}, DefaultAttribute), { radius: 1, startAngle: 0, endAngle: pi2 });
4765
4768
  const DefaultGroupAttribute = Object.assign(Object.assign({}, DefaultAttribute), { width: 0, height: 0, cornerRadius: 0, path: [], clip: false, visibleAll: true, display: 'relative', flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'flex-start', alignItems: 'flex-start', alignContent: 'flex-start', baseOpacity: 1, cornerType: 'round' });
@@ -4826,7 +4829,8 @@ class ResourceLoader {
4826
4829
  }
4827
4830
  else {
4828
4831
  data.waitingMark = [mark];
4829
- data.dataPromise.then(res => {
4832
+ data.dataPromise
4833
+ .then(res => {
4830
4834
  var _a;
4831
4835
  data.loadState = (res === null || res === void 0 ? void 0 : res.data) ? 'success' : 'fail';
4832
4836
  data.data = res === null || res === void 0 ? void 0 : res.data;
@@ -4842,6 +4846,14 @@ class ResourceLoader {
4842
4846
  }
4843
4847
  });
4844
4848
  data.waitingMark && (data.waitingMark = []);
4849
+ })
4850
+ .catch(() => {
4851
+ var _a;
4852
+ data.loadState = 'fail';
4853
+ (_a = data.waitingMark) === null || _a === void 0 ? void 0 : _a.map((mark) => {
4854
+ mark.imageLoadFail(svgStr);
4855
+ });
4856
+ data.waitingMark && (data.waitingMark = []);
4845
4857
  });
4846
4858
  }
4847
4859
  }
@@ -6258,6 +6270,13 @@ function isLeafTag(obj) {
6258
6270
  return false;
6259
6271
  }
6260
6272
 
6273
+ function isSvg(str) {
6274
+ return str.startsWith('<svg') || str.startsWith('<?xml');
6275
+ }
6276
+ function isXML(str) {
6277
+ return str.startsWith('<');
6278
+ }
6279
+
6261
6280
  class XMLParser {
6262
6281
  constructor(options) {
6263
6282
  this.options = Object.assign({}, XMLParser.defaultOptions, options);
@@ -6275,12 +6294,6 @@ class XMLParser {
6275
6294
  }
6276
6295
  }
6277
6296
  XMLParser.defaultOptions = {};
6278
- function isSvg(str) {
6279
- return str.startsWith('<svg') || str.startsWith('<?xml');
6280
- }
6281
- function isXML(str) {
6282
- return str.startsWith('<');
6283
- }
6284
6297
 
6285
6298
  function incrementalAddTo(group, graphic) {
6286
6299
  group.incrementalAppendChild(graphic);
@@ -9015,7 +9028,7 @@ function createConicalGradient(context, stops, x, y, deltaAngle, startAngle, end
9015
9028
  return pattern;
9016
9029
  }
9017
9030
 
9018
- const FULL_DEFINITION_KEYS$1 = new Set([
9031
+ const FULL_DEFINITION_KEYS = new Set([
9019
9032
  'name',
9020
9033
  'patch',
9021
9034
  'priority',
@@ -9024,7 +9037,7 @@ const FULL_DEFINITION_KEYS$1 = new Set([
9024
9037
  'resolver',
9025
9038
  'declaredAffectedKeys'
9026
9039
  ]);
9027
- function isPlainObject$2(value) {
9040
+ function isPlainObject$1(value) {
9028
9041
  return value != null && typeof value === 'object' && !Array.isArray(value);
9029
9042
  }
9030
9043
  function normalizePatch(value) {
@@ -9086,14 +9099,13 @@ class StateDefinitionCompiler {
9086
9099
  patch: undefined
9087
9100
  };
9088
9101
  }
9089
- const keys = isPlainObject$2(value) ? Object.keys(value) : [];
9090
- const hasFullKey = keys.some(key => FULL_DEFINITION_KEYS$1.has(key));
9102
+ const keys = isPlainObject$1(value) ? Object.keys(value) : [];
9103
+ const hasFullKey = keys.some(key => FULL_DEFINITION_KEYS.has(key));
9091
9104
  if (hasFullKey) {
9092
9105
  const definition = value;
9093
9106
  return {
9094
9107
  name: (_a = definition.name) !== null && _a !== void 0 ? _a : name,
9095
9108
  priority: (_b = definition.priority) !== null && _b !== void 0 ? _b : 0,
9096
- rank: definition.rank,
9097
9109
  patch: normalizePatch(definition.patch),
9098
9110
  resolver: definition.resolver,
9099
9111
  declaredAffectedKeys: definition.declaredAffectedKeys,
@@ -9114,414 +9126,54 @@ class StateDefinitionCompiler {
9114
9126
  });
9115
9127
  compiled.forEach((definition, origin) => {
9116
9128
  const closure = new Set();
9117
- const walk = (stateName, stack) => {
9129
+ const walk = (stateName, visiting) => {
9118
9130
  const nextStates = rawRelationMap.get(stateName);
9119
9131
  if (!nextStates || !nextStates.size) {
9120
9132
  return;
9121
9133
  }
9122
9134
  nextStates.forEach(nextState => {
9123
- if (nextState === origin) {
9124
- console.warn(`[StateDefinitionCompiler] circular ${relation} relation detected: ${stack.join(' -> ')} -> ${origin}`);
9125
- return;
9126
- }
9127
- if (stack.includes(nextState)) {
9128
- console.warn(`[StateDefinitionCompiler] circular ${relation} relation detected: ${stack.join(' -> ')} -> ${nextState}`);
9129
- return;
9130
- }
9131
- if (closure.has(nextState)) {
9135
+ if (nextState === origin || visiting.has(nextState) || closure.has(nextState)) {
9132
9136
  return;
9133
9137
  }
9134
9138
  closure.add(nextState);
9135
- walk(nextState, stack.concat(nextState));
9139
+ visiting.add(nextState);
9140
+ walk(nextState, visiting);
9141
+ visiting.delete(nextState);
9136
9142
  });
9137
9143
  };
9138
- walk(origin, [origin]);
9144
+ walk(origin, new Set([origin]));
9139
9145
  definition[relation] = closure;
9140
9146
  });
9141
9147
  }
9142
9148
  }
9143
9149
 
9144
- var UpdateCategory;
9145
- (function (UpdateCategory) {
9146
- UpdateCategory[UpdateCategory["NONE"] = 0] = "NONE";
9147
- UpdateCategory[UpdateCategory["PAINT"] = 1] = "PAINT";
9148
- UpdateCategory[UpdateCategory["SHAPE"] = 2] = "SHAPE";
9149
- UpdateCategory[UpdateCategory["BOUNDS"] = 4] = "BOUNDS";
9150
- UpdateCategory[UpdateCategory["TRANSFORM"] = 8] = "TRANSFORM";
9151
- UpdateCategory[UpdateCategory["LAYOUT"] = 16] = "LAYOUT";
9152
- UpdateCategory[UpdateCategory["PICK"] = 32] = "PICK";
9153
- })(UpdateCategory || (UpdateCategory = {}));
9154
- const ATTRIBUTE_CATEGORY = {
9155
- fill: UpdateCategory.PAINT,
9156
- opacity: UpdateCategory.PAINT,
9157
- fillOpacity: UpdateCategory.PAINT,
9158
- strokeOpacity: UpdateCategory.PAINT,
9159
- lineDash: UpdateCategory.PAINT,
9160
- lineDashOffset: UpdateCategory.PAINT,
9161
- lineCap: UpdateCategory.PAINT,
9162
- lineJoin: UpdateCategory.PAINT,
9163
- miterLimit: UpdateCategory.PAINT,
9164
- shadowColor: UpdateCategory.PAINT,
9165
- x: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9166
- y: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9167
- scaleX: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9168
- scaleY: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9169
- angle: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9170
- anchor: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9171
- anchor3d: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9172
- postMatrix: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9173
- layout: UpdateCategory.LAYOUT,
9174
- zIndex: UpdateCategory.PAINT,
9175
- visible: UpdateCategory.PAINT | UpdateCategory.PICK,
9176
- lineWidth: UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.PICK,
9177
- width: UpdateCategory.SHAPE | UpdateCategory.BOUNDS,
9178
- height: UpdateCategory.SHAPE | UpdateCategory.BOUNDS
9179
- };
9180
- const ATTRIBUTE_DELTA_CLASSIFIER = {
9181
- stroke: (prev, next) => {
9182
- const prevEnabled = prev != null && prev !== false;
9183
- const nextEnabled = next != null && next !== false;
9184
- if (prevEnabled !== nextEnabled) {
9185
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK;
9186
- }
9187
- return UpdateCategory.PAINT;
9188
- },
9189
- shadowBlur: (prev, next) => {
9190
- const prevBlur = Number(prev !== null && prev !== void 0 ? prev : 0);
9191
- const nextBlur = Number(next !== null && next !== void 0 ? next : 0);
9192
- if (prevBlur !== nextBlur && (prevBlur > 0 || nextBlur > 0)) {
9193
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS;
9194
- }
9195
- return UpdateCategory.PAINT;
9196
- }
9197
- };
9198
- function classifyAttributeDelta(key, prev, next) {
9199
- var _a;
9200
- const dynamicClassifier = ATTRIBUTE_DELTA_CLASSIFIER[key];
9201
- if (dynamicClassifier) {
9202
- return dynamicClassifier(prev, next);
9203
- }
9204
- return (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
9205
- }
9206
- function classifyAffectedKeyConservatively(key) {
9207
- var _a;
9208
- if (key === 'stroke') {
9209
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK;
9210
- }
9211
- if (key === 'shadowBlur') {
9212
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS;
9213
- }
9214
- return (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
9215
- }
9216
- function classifyAffectedKeys(keys) {
9217
- let category = UpdateCategory.NONE;
9218
- for (const key of keys) {
9219
- category |= classifyAffectedKeyConservatively(key);
9220
- }
9221
- return category;
9222
- }
9223
-
9224
- const DEFAULT_MAX_EVENT_RECORDS = 100;
9225
- const STAGE_PERF_MONITOR = Symbol('vrender.statePerfMonitor');
9226
- function createReasonBreakdown() {
9227
- return {
9228
- config_disabled: 0,
9229
- context_disabled: 0,
9230
- non_batch_operation: 0,
9231
- mixed_update_category: 0,
9232
- resolver_unstable_keys: 0,
9233
- graphic_unavailable: 0
9234
- };
9235
- }
9236
- function createEmptyStatePerfSnapshot() {
9237
- return {
9238
- counters: {
9239
- stateCommits: 0,
9240
- sharedRefreshCommits: 0,
9241
- deferredJobsCreated: 0,
9242
- deferredJobsCompleted: 0,
9243
- deferredJobsCancelled: 0,
9244
- deferredJobsCoalesced: 0,
9245
- deferredGraphicsCommitted: 0,
9246
- deferredBudgetYields: 0,
9247
- deferredIneligibleGraphics: 0
9248
- },
9249
- deferredIneligibleByReason: createReasonBreakdown(),
9250
- categoryBreakdown: {
9251
- paint: 0,
9252
- transform: 0,
9253
- shape: 0,
9254
- bounds: 0,
9255
- layout: 0,
9256
- pick: 0
9257
- },
9258
- refresh: {
9259
- queuedGraphics: 0,
9260
- flushedGraphics: 0,
9261
- ensureFreshCalls: 0,
9262
- renderScheduled: 0
9263
- },
9264
- resolver: {
9265
- cacheHits: 0,
9266
- cacheMisses: 0,
9267
- invalidations: 0
9268
- },
9269
- cost: {
9270
- resolverTotalMs: 0,
9271
- resolverMaxMs: 0,
9272
- patchTotalMs: 0,
9273
- patchMaxMs: 0,
9274
- sharedRefreshTotalMs: 0,
9275
- sharedRefreshMaxMs: 0,
9276
- batchSliceTotalMs: 0,
9277
- batchSliceMaxMs: 0
9278
- },
9279
- allocationHints: {
9280
- patchObjectsCreated: 0,
9281
- batchEntriesCreated: 0,
9282
- refreshQueuePushes: 0
9283
- },
9284
- batch: {
9285
- pendingJobs: 0,
9286
- maxPendingJobs: 0,
9287
- maxGraphicsInJob: 0,
9288
- maxFrameSliceCost: 0
9289
- },
9290
- events: []
9291
- };
9292
- }
9293
- function cloneSnapshot(snapshot) {
9294
- return {
9295
- counters: Object.assign({}, snapshot.counters),
9296
- deferredIneligibleByReason: Object.assign({}, snapshot.deferredIneligibleByReason),
9297
- categoryBreakdown: Object.assign({}, snapshot.categoryBreakdown),
9298
- refresh: Object.assign({}, snapshot.refresh),
9299
- resolver: Object.assign({}, snapshot.resolver),
9300
- cost: Object.assign({}, snapshot.cost),
9301
- allocationHints: Object.assign({}, snapshot.allocationHints),
9302
- batch: Object.assign({}, snapshot.batch),
9303
- events: snapshot.events ? snapshot.events.slice() : []
9304
- };
9305
- }
9306
- function isDeferredStateContextConfig(value) {
9307
- return (!!value &&
9308
- (Object.prototype.hasOwnProperty.call(value, 'deferred') ||
9309
- Object.prototype.hasOwnProperty.call(value, 'localEnabled')));
9310
- }
9311
- function normalizeDeferredStateOwnerConfig(value) {
9312
- if (!value) {
9313
- return undefined;
9314
- }
9315
- if (isDeferredStateContextConfig(value)) {
9316
- return value;
9317
- }
9318
- return {
9319
- deferred: value
9320
- };
9321
- }
9322
- function normalizeDeferredStateConfig(config) {
9323
- var _a, _b, _c;
9324
- return {
9325
- enabled: (_a = config === null || config === void 0 ? void 0 : config.enabled) !== null && _a !== void 0 ? _a : false,
9326
- frameBudget: (_b = config === null || config === void 0 ? void 0 : config.frameBudget) !== null && _b !== void 0 ? _b : 8,
9327
- maxGraphicsPerFrame: (_c = config === null || config === void 0 ? void 0 : config.maxGraphicsPerFrame) !== null && _c !== void 0 ? _c : 100
9328
- };
9329
- }
9330
- function fingerprintDeferredStateConfig(config) {
9331
- return `${config.enabled ? 1 : 0}:${config.frameBudget}:${config.maxGraphicsPerFrame}`;
9332
- }
9333
- class StatePerfMonitor {
9334
- constructor(configSource) {
9335
- this.configSource = configSource;
9336
- this.snapshot = createEmptyStatePerfSnapshot();
9337
- }
9338
- setConfig(config) {
9339
- this.configSource = config;
9340
- }
9341
- getSnapshot() {
9342
- return cloneSnapshot(this.snapshot);
9343
- }
9344
- reset() {
9345
- const next = createEmptyStatePerfSnapshot();
9346
- Object.assign(this.snapshot.counters, next.counters);
9347
- Object.assign(this.snapshot.deferredIneligibleByReason, next.deferredIneligibleByReason);
9348
- Object.assign(this.snapshot.categoryBreakdown, next.categoryBreakdown);
9349
- Object.assign(this.snapshot.refresh, next.refresh);
9350
- Object.assign(this.snapshot.resolver, next.resolver);
9351
- Object.assign(this.snapshot.cost, next.cost);
9352
- Object.assign(this.snapshot.allocationHints, next.allocationHints);
9353
- Object.assign(this.snapshot.batch, next.batch);
9354
- this.snapshot.events = [];
9355
- }
9356
- incrementCounter(key, delta = 1) {
9357
- if (!this.isEnabled()) {
9358
- return;
9359
- }
9360
- this.snapshot.counters[key] += delta;
9361
- }
9362
- recordDeferredIneligible(reason, delta = 1) {
9363
- if (!this.isEnabled()) {
9364
- return;
9365
- }
9366
- this.snapshot.deferredIneligibleByReason[reason] += delta;
9367
- this.snapshot.counters.deferredIneligibleGraphics += delta;
9368
- this.recordEvent('deferred-ineligible', { reason, count: delta });
9369
- }
9370
- recordCategory(category) {
9371
- if (!this.isEnabled()) {
9372
- return;
9373
- }
9374
- if (category & UpdateCategory.PAINT) {
9375
- this.snapshot.categoryBreakdown.paint += 1;
9376
- }
9377
- if (category & UpdateCategory.TRANSFORM) {
9378
- this.snapshot.categoryBreakdown.transform += 1;
9379
- }
9380
- if (category & UpdateCategory.SHAPE) {
9381
- this.snapshot.categoryBreakdown.shape += 1;
9382
- }
9383
- if (category & UpdateCategory.BOUNDS) {
9384
- this.snapshot.categoryBreakdown.bounds += 1;
9385
- }
9386
- if (category & UpdateCategory.LAYOUT) {
9387
- this.snapshot.categoryBreakdown.layout += 1;
9388
- }
9389
- if (category & UpdateCategory.PICK) {
9390
- this.snapshot.categoryBreakdown.pick += 1;
9391
- }
9392
- }
9393
- recordRefresh(key, delta = 1) {
9394
- if (!this.isEnabled()) {
9395
- return;
9396
- }
9397
- this.snapshot.refresh[key] += delta;
9398
- }
9399
- recordResolver(key, delta = 1) {
9400
- if (!this.isEnabled()) {
9401
- return;
9402
- }
9403
- this.snapshot.resolver[key] += delta;
9404
- }
9405
- recordCost(kind, durationMs) {
9406
- if (!this.isEnabled()) {
9407
- return;
9408
- }
9409
- if (kind === 'resolver') {
9410
- this.snapshot.cost.resolverTotalMs += durationMs;
9411
- this.snapshot.cost.resolverMaxMs = Math.max(this.snapshot.cost.resolverMaxMs, durationMs);
9412
- return;
9413
- }
9414
- if (kind === 'patch') {
9415
- this.snapshot.cost.patchTotalMs += durationMs;
9416
- this.snapshot.cost.patchMaxMs = Math.max(this.snapshot.cost.patchMaxMs, durationMs);
9417
- return;
9418
- }
9419
- if (kind === 'sharedRefresh') {
9420
- this.snapshot.cost.sharedRefreshTotalMs += durationMs;
9421
- this.snapshot.cost.sharedRefreshMaxMs = Math.max(this.snapshot.cost.sharedRefreshMaxMs, durationMs);
9422
- return;
9423
- }
9424
- this.snapshot.cost.batchSliceTotalMs += durationMs;
9425
- this.snapshot.cost.batchSliceMaxMs = Math.max(this.snapshot.cost.batchSliceMaxMs, durationMs);
9426
- this.snapshot.batch.maxFrameSliceCost = Math.max(this.snapshot.batch.maxFrameSliceCost, durationMs);
9427
- }
9428
- recordAllocation(key, delta = 1) {
9429
- if (!this.isEnabled()) {
9430
- return;
9431
- }
9432
- this.snapshot.allocationHints[key] += delta;
9433
- }
9434
- updateBatchPending(pendingJobs) {
9435
- if (!this.isEnabled()) {
9436
- return;
9437
- }
9438
- this.snapshot.batch.pendingJobs = pendingJobs;
9439
- this.snapshot.batch.maxPendingJobs = Math.max(this.snapshot.batch.maxPendingJobs, pendingJobs);
9440
- }
9441
- updateMaxGraphicsInJob(count) {
9442
- if (!this.isEnabled()) {
9443
- return;
9444
- }
9445
- this.snapshot.batch.maxGraphicsInJob = Math.max(this.snapshot.batch.maxGraphicsInJob, count);
9446
- }
9447
- recordEvent(type, detail) {
9448
- var _a, _b, _c;
9449
- if (!this.shouldRecordEvents()) {
9450
- return;
9451
- }
9452
- const events = (_a = this.snapshot.events) !== null && _a !== void 0 ? _a : (this.snapshot.events = []);
9453
- events.push({
9454
- type,
9455
- at: Date.now(),
9456
- detail
9457
- });
9458
- const max = (_c = (_b = this.getConfig()) === null || _b === void 0 ? void 0 : _b.maxEventRecords) !== null && _c !== void 0 ? _c : DEFAULT_MAX_EVENT_RECORDS;
9459
- if (events.length > max) {
9460
- events.splice(0, events.length - max);
9461
- }
9462
- }
9463
- isEnabled() {
9464
- var _a;
9465
- return ((_a = this.getConfig()) === null || _a === void 0 ? void 0 : _a.enabled) === true;
9466
- }
9467
- shouldRecordEvents() {
9468
- const config = this.getConfig();
9469
- return !!(config === null || config === void 0 ? void 0 : config.enabled) && !!config.recordEvents;
9470
- }
9471
- getConfig() {
9472
- return typeof this.configSource === 'function' ? this.configSource() : this.configSource;
9473
- }
9474
- }
9475
- function ensureStageStatePerfMonitor(stage) {
9476
- const stageAny = stage;
9477
- if (!stageAny[STAGE_PERF_MONITOR]) {
9478
- stageAny[STAGE_PERF_MONITOR] = new StatePerfMonitor(() => stage.statePerfConfig);
9479
- }
9480
- return stageAny[STAGE_PERF_MONITOR];
9481
- }
9482
- function getStageStatePerfMonitor(stage) {
9483
- if (!stage) {
9484
- return undefined;
9485
- }
9486
- return stage[STAGE_PERF_MONITOR];
9487
- }
9488
-
9489
- function isPlainObject$1(value) {
9150
+ function isPlainObject(value) {
9490
9151
  return value != null && typeof value === 'object' && !Array.isArray(value);
9491
9152
  }
9492
- function cloneValue$1(value) {
9493
- if (!isPlainObject$1(value)) {
9153
+ function cloneValue(value) {
9154
+ if (!isPlainObject(value)) {
9494
9155
  return value;
9495
9156
  }
9496
9157
  const clone = {};
9497
9158
  Object.keys(value).forEach(key => {
9498
- clone[key] = cloneValue$1(value[key]);
9159
+ clone[key] = cloneValue(value[key]);
9499
9160
  });
9500
9161
  return clone;
9501
9162
  }
9502
- function deepMerge$1(base, value) {
9163
+ function deepMerge(base, value) {
9503
9164
  var _a;
9504
- const result = (_a = cloneValue$1(base)) !== null && _a !== void 0 ? _a : {};
9165
+ const result = (_a = cloneValue(base)) !== null && _a !== void 0 ? _a : {};
9505
9166
  Object.keys(value).forEach(key => {
9506
9167
  const nextValue = value[key];
9507
9168
  const previousValue = result[key];
9508
- if (isPlainObject$1(previousValue) && isPlainObject$1(nextValue)) {
9509
- result[key] = deepMerge$1(previousValue, nextValue);
9169
+ if (isPlainObject(previousValue) && isPlainObject(nextValue)) {
9170
+ result[key] = deepMerge(previousValue, nextValue);
9510
9171
  return;
9511
9172
  }
9512
- result[key] = cloneValue$1(nextValue);
9173
+ result[key] = cloneValue(nextValue);
9513
9174
  });
9514
9175
  return result;
9515
9176
  }
9516
- const FULL_DEFINITION_KEYS = new Set([
9517
- 'name',
9518
- 'patch',
9519
- 'priority',
9520
- 'exclude',
9521
- 'suppress',
9522
- 'resolver',
9523
- 'declaredAffectedKeys'
9524
- ]);
9525
9177
  class StateEngine {
9526
9178
  constructor(options) {
9527
9179
  var _a;
@@ -9535,9 +9187,6 @@ class StateEngine {
9535
9187
  this.baseAttributes = {};
9536
9188
  this.compiledDefinitions = options.compiledDefinitions;
9537
9189
  this.stateSort = options.stateSort;
9538
- this.stateProxy = options.stateProxy;
9539
- this.stateProxyEligibility = options.stateProxyEligibility;
9540
- this.states = options.states;
9541
9190
  this.mergeMode = (_a = options.mergeMode) !== null && _a !== void 0 ? _a : 'shallow';
9542
9191
  }
9543
9192
  get activeStates() {
@@ -9553,6 +9202,9 @@ class StateEngine {
9553
9202
  return this._suppressed;
9554
9203
  }
9555
9204
  setResolveContext(graphic, baseAttributes) {
9205
+ if (this.graphic !== graphic || this.baseAttributes !== baseAttributes) {
9206
+ this.invalidateResolverCache();
9207
+ }
9556
9208
  this.graphic = graphic;
9557
9209
  this.baseAttributes = baseAttributes;
9558
9210
  }
@@ -9636,11 +9288,9 @@ class StateEngine {
9636
9288
  };
9637
9289
  }
9638
9290
  invalidateResolverCache() {
9639
- var _a, _b;
9640
9291
  this.resolverPatchCache.clear();
9641
9292
  this.resolverCacheKey = '';
9642
9293
  this.resolverCacheValid = false;
9643
- (_b = getStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage)) === null || _b === void 0 ? void 0 : _b.recordResolver('invalidations');
9644
9294
  }
9645
9295
  hasState(stateName) {
9646
9296
  if (!this._activeStates.length) {
@@ -9651,28 +9301,6 @@ class StateEngine {
9651
9301
  }
9652
9302
  return this._activeStates.includes(stateName);
9653
9303
  }
9654
- getCompatPatch(stateName) {
9655
- var _a, _b, _c;
9656
- const targetStates = this._activeStates.length ? this._activeStates : this._effectiveStates;
9657
- const canUseStateProxy = this.canUseStateProxy(stateName);
9658
- const proxyPatch = canUseStateProxy ? (_a = this.stateProxy) === null || _a === void 0 ? void 0 : _a.call(this, stateName, targetStates) : undefined;
9659
- if (this.stateProxy && canUseStateProxy) {
9660
- return proxyPatch !== null && proxyPatch !== void 0 ? proxyPatch : undefined;
9661
- }
9662
- const value = (_b = this.states) === null || _b === void 0 ? void 0 : _b[stateName];
9663
- if (value == null) {
9664
- return undefined;
9665
- }
9666
- if (!isPlainObject$1(value)) {
9667
- return value;
9668
- }
9669
- const keys = Object.keys(value);
9670
- const hasFullKey = keys.some(key => FULL_DEFINITION_KEYS.has(key));
9671
- if (!hasFullKey) {
9672
- return value;
9673
- }
9674
- return cloneValue$1(((_c = value.patch) !== null && _c !== void 0 ? _c : undefined));
9675
- }
9676
9304
  sortStates(states) {
9677
9305
  const withDefinition = [];
9678
9306
  const withoutDefinition = [];
@@ -9729,96 +9357,44 @@ class StateEngine {
9729
9357
  };
9730
9358
  }
9731
9359
  recomputePatch(effectiveStates) {
9732
- var _a;
9733
- const perfMonitor = getStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage);
9734
- const patchStart = perfMonitor ? performance.now() : 0;
9735
- let resolverCost = 0;
9736
9360
  const cacheKey = effectiveStates.join(',');
9737
9361
  const nextPatch = {};
9738
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordAllocation('patchObjectsCreated');
9739
- if (this.resolverCacheValid && this.resolverCacheKey === cacheKey) {
9740
- effectiveStates.forEach(stateName => {
9741
- var _a;
9742
- const canUseStateProxy = this.canUseStateProxy(stateName);
9743
- const proxyPatch = canUseStateProxy ? (_a = this.stateProxy) === null || _a === void 0 ? void 0 : _a.call(this, stateName, effectiveStates) : undefined;
9744
- if (this.stateProxy && canUseStateProxy) {
9745
- if (proxyPatch != null) {
9746
- this.mergeInto(nextPatch, proxyPatch);
9747
- }
9748
- return;
9749
- }
9750
- const definition = this.compiledDefinitions.get(stateName);
9751
- if (!definition) {
9752
- const compatPatch = this.getCompatPatch(stateName);
9753
- if (compatPatch) {
9754
- this.mergeInto(nextPatch, compatPatch);
9755
- }
9756
- return;
9757
- }
9758
- if (definition.patch) {
9759
- this.mergeInto(nextPatch, definition.patch);
9760
- }
9761
- if (definition.hasResolver) {
9762
- const cachedPatch = this.resolverPatchCache.get(stateName);
9763
- if (cachedPatch) {
9764
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordResolver('cacheHits');
9765
- this.mergeInto(nextPatch, cachedPatch);
9766
- }
9767
- }
9768
- });
9769
- }
9770
- else {
9362
+ const useResolverCache = this.resolverCacheValid && this.resolverCacheKey === cacheKey;
9363
+ if (!useResolverCache) {
9771
9364
  this.resolverPatchCache.clear();
9772
9365
  this.resolverCacheKey = cacheKey;
9773
- effectiveStates.forEach(stateName => {
9774
- var _a;
9775
- const canUseStateProxy = this.canUseStateProxy(stateName);
9776
- const proxyPatch = canUseStateProxy ? (_a = this.stateProxy) === null || _a === void 0 ? void 0 : _a.call(this, stateName, effectiveStates) : undefined;
9777
- if (this.stateProxy && canUseStateProxy) {
9778
- if (proxyPatch != null) {
9779
- this.mergeInto(nextPatch, proxyPatch);
9780
- }
9781
- return;
9782
- }
9783
- const definition = this.compiledDefinitions.get(stateName);
9784
- if (!definition) {
9785
- const compatPatch = this.getCompatPatch(stateName);
9786
- if (compatPatch) {
9787
- this.mergeInto(nextPatch, compatPatch);
9788
- }
9789
- return;
9790
- }
9791
- if (definition.patch) {
9792
- this.mergeInto(nextPatch, definition.patch);
9793
- }
9794
- if (definition.hasResolver && definition.resolver) {
9795
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordResolver('cacheMisses');
9796
- const resolverStart = perfMonitor ? performance.now() : 0;
9797
- const resolverPatch = definition.resolver({
9366
+ }
9367
+ effectiveStates.forEach(stateName => {
9368
+ var _a;
9369
+ const definition = this.compiledDefinitions.get(stateName);
9370
+ if (!definition) {
9371
+ return;
9372
+ }
9373
+ if (definition.patch) {
9374
+ this.mergeInto(nextPatch, definition.patch);
9375
+ }
9376
+ if (definition.hasResolver) {
9377
+ const resolverPatch = useResolverCache
9378
+ ? this.resolverPatchCache.get(stateName)
9379
+ : (_a = definition.resolver) === null || _a === void 0 ? void 0 : _a.call(definition, {
9798
9380
  graphic: this.graphic,
9799
9381
  activeStates: this._activeStates,
9800
9382
  effectiveStates: this._effectiveStates,
9801
9383
  baseAttributes: this.baseAttributes,
9802
9384
  resolvedPatch: nextPatch
9803
9385
  });
9804
- if (perfMonitor) {
9805
- const duration = performance.now() - resolverStart;
9806
- resolverCost += duration;
9807
- perfMonitor.recordCost('resolver', duration);
9808
- }
9809
- if (resolverPatch) {
9386
+ if (resolverPatch) {
9387
+ if (!useResolverCache) {
9810
9388
  this.resolverPatchCache.set(stateName, resolverPatch);
9811
- this.mergeInto(nextPatch, resolverPatch);
9812
9389
  }
9390
+ this.mergeInto(nextPatch, resolverPatch);
9813
9391
  }
9814
- });
9392
+ }
9393
+ });
9394
+ if (!useResolverCache) {
9815
9395
  this.resolverCacheValid = true;
9816
9396
  }
9817
9397
  this._resolvedPatch = nextPatch;
9818
- if (perfMonitor) {
9819
- const totalCost = performance.now() - patchStart;
9820
- perfMonitor.recordCost('patch', Math.max(0, totalCost - resolverCost));
9821
- }
9822
9398
  }
9823
9399
  mergeInto(target, patch) {
9824
9400
  if (this.mergeMode === 'deep') {
@@ -9827,20 +9403,20 @@ class StateEngine {
9827
9403
  const nextValue = patch[key];
9828
9404
  const previousValue = target[key];
9829
9405
  const baseValue = (_a = this.baseAttributes) === null || _a === void 0 ? void 0 : _a[key];
9830
- if (isPlainObject$1(previousValue) && isPlainObject$1(nextValue)) {
9831
- target[key] = deepMerge$1(previousValue, nextValue);
9406
+ if (isPlainObject(previousValue) && isPlainObject(nextValue)) {
9407
+ target[key] = deepMerge(previousValue, nextValue);
9832
9408
  return;
9833
9409
  }
9834
- if (!isPlainObject$1(previousValue) && isPlainObject$1(baseValue) && isPlainObject$1(nextValue)) {
9835
- target[key] = deepMerge$1(baseValue, nextValue);
9410
+ if (!isPlainObject(previousValue) && isPlainObject(baseValue) && isPlainObject(nextValue)) {
9411
+ target[key] = deepMerge(baseValue, nextValue);
9836
9412
  return;
9837
9413
  }
9838
- target[key] = cloneValue$1(nextValue);
9414
+ target[key] = cloneValue(nextValue);
9839
9415
  });
9840
9416
  return;
9841
9417
  }
9842
9418
  Object.keys(patch).forEach(key => {
9843
- target[key] = cloneValue$1(patch[key]);
9419
+ target[key] = cloneValue(patch[key]);
9844
9420
  });
9845
9421
  }
9846
9422
  sameArray(left, right) {
@@ -9854,341 +9430,69 @@ class StateEngine {
9854
9430
  }
9855
9431
  return true;
9856
9432
  }
9857
- canUseStateProxy(stateName) {
9858
- if (!this.stateProxy) {
9859
- return false;
9860
- }
9861
- return this.stateProxyEligibility ? this.stateProxyEligibility(stateName) : true;
9862
- }
9863
9433
  }
9864
9434
 
9865
- class StateModel {
9866
- constructor(options = {}) {
9867
- var _a;
9868
- this.exclusiveGroupMap = new Map();
9869
- this.exclusiveGroups = new Map();
9870
- this.states = options.states;
9871
- this.currentStates = options.currentStates ? [...options.currentStates] : undefined;
9872
- this.stateSort = options.stateSort;
9873
- this.stateProxy = options.stateProxy;
9874
- this.stateEngine = options.stateEngine;
9875
- if (this.stateEngine &&
9876
- options.currentStates &&
9877
- !this.sameStates(this.stateEngine.activeStates, options.currentStates)) {
9878
- this.stateEngine.applyStates(options.currentStates);
9879
- }
9880
- const exclusiveGroups = (_a = options.exclusiveGroups) !== null && _a !== void 0 ? _a : {};
9881
- for (const groupName in exclusiveGroups) {
9882
- if (!Object.prototype.hasOwnProperty.call(exclusiveGroups, groupName)) {
9883
- continue;
9884
- }
9885
- this.registerExclusiveGroup(groupName, exclusiveGroups[groupName]);
9886
- }
9887
- }
9888
- getCurrentStates() {
9889
- return this.currentStates ? [...this.currentStates] : [];
9890
- }
9891
- hasState(stateName) {
9892
- if (this.stateEngine) {
9893
- return this.stateEngine.hasState(stateName);
9894
- }
9895
- if (!this.currentStates || !this.currentStates.length) {
9896
- return false;
9897
- }
9898
- if (stateName == null) {
9899
- return true;
9900
- }
9901
- return this.currentStates.includes(stateName);
9902
- }
9903
- getState(stateName) {
9904
- var _a;
9905
- return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
9906
- }
9907
- useStates(states) {
9908
- var _a;
9909
- if (this.stateEngine) {
9910
- const result = this.stateEngine.applyStates(states);
9911
- this.currentStates = [...result.activeStates];
9912
- return {
9913
- changed: result.changed,
9914
- states: [...result.activeStates],
9915
- effectiveStates: [...result.effectiveStates]
9916
- };
9917
- }
9918
- if (!states.length) {
9919
- return this.clearStates();
9920
- }
9921
- const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : [];
9922
- const changed = previousStates.length !== states.length || states.some((stateName, index) => previousStates[index] !== stateName);
9923
- const nextStates = this.sortStates(states);
9924
- if (changed) {
9925
- this.currentStates = nextStates;
9926
- }
9927
- return {
9928
- changed,
9929
- states: changed ? [...nextStates] : [...previousStates]
9930
- };
9931
- }
9932
- clearStates() {
9933
- if (this.stateEngine) {
9934
- const result = this.stateEngine.clearStates();
9935
- this.currentStates = [];
9936
- return {
9937
- changed: result.changed,
9938
- states: [],
9939
- effectiveStates: []
9940
- };
9941
- }
9942
- const changed = this.hasState();
9943
- this.currentStates = [];
9944
- return {
9945
- changed,
9946
- states: []
9947
- };
9948
- }
9949
- addState(stateName, keepCurrentStates) {
9950
- var _a;
9951
- if (this.stateEngine) {
9952
- const result = this.stateEngine.addState(stateName, keepCurrentStates);
9953
- this.currentStates = [...result.activeStates];
9954
- return {
9955
- changed: result.changed,
9956
- states: [...result.activeStates],
9957
- effectiveStates: [...result.effectiveStates]
9958
- };
9959
- }
9960
- if (this.currentStates &&
9961
- this.currentStates.includes(stateName) &&
9962
- (keepCurrentStates || this.currentStates.length === 1)) {
9963
- return {
9964
- changed: false,
9965
- states: this.getCurrentStates()
9966
- };
9967
- }
9968
- const nextStates = keepCurrentStates && ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ? this.currentStates.concat([stateName]) : [stateName];
9969
- return this.useStates(nextStates);
9970
- }
9971
- removeState(stateName) {
9972
- if (this.stateEngine) {
9973
- const result = this.stateEngine.removeState(stateName);
9974
- this.currentStates = [...result.activeStates];
9975
- return {
9976
- changed: result.changed,
9977
- states: [...result.activeStates],
9978
- effectiveStates: [...result.effectiveStates]
9979
- };
9980
- }
9981
- if (!this.currentStates) {
9982
- return {
9983
- changed: false,
9984
- states: []
9985
- };
9986
- }
9987
- const filter = Array.isArray(stateName) ? (s) => !stateName.includes(s) : (s) => s !== stateName;
9988
- const nextStates = this.currentStates.filter(filter);
9989
- if (nextStates.length === this.currentStates.length) {
9990
- return {
9991
- changed: false,
9992
- states: this.getCurrentStates()
9993
- };
9994
- }
9995
- return this.useStates(nextStates);
9996
- }
9997
- toggleState(stateName) {
9998
- if (this.stateEngine) {
9999
- const result = this.stateEngine.toggleState(stateName);
10000
- this.currentStates = [...result.activeStates];
10001
- return {
10002
- changed: result.changed,
10003
- states: [...result.activeStates],
10004
- effectiveStates: [...result.effectiveStates]
10005
- };
10006
- }
10007
- if (this.hasState(stateName)) {
10008
- return this.removeState(stateName);
10009
- }
10010
- const nextStates = this.currentStates ? this.currentStates.slice() : [];
10011
- if (!nextStates.includes(stateName)) {
10012
- nextStates.push(stateName);
10013
- }
10014
- return this.useStates(nextStates);
10015
- }
10016
- sortStates(states) {
10017
- if (this.stateEngine) {
10018
- return [...this.stateEngine.activeStates];
10019
- }
10020
- if (!this.stateSort) {
10021
- return [...states];
10022
- }
10023
- return [...states].sort(this.stateSort);
10024
- }
10025
- registerExclusiveGroup(groupName, states) {
10026
- const uniqueStates = Array.from(new Set(states));
10027
- this.exclusiveGroups.set(groupName, uniqueStates);
10028
- uniqueStates.forEach(stateName => this.exclusiveGroupMap.set(stateName, groupName));
10029
- }
10030
- getExclusiveGroup(stateName) {
10031
- return this.exclusiveGroupMap.get(stateName);
10032
- }
10033
- getMutuallyExclusiveStates(stateName) {
10034
- var _a;
10035
- const groupName = this.getExclusiveGroup(stateName);
10036
- if (!groupName) {
10037
- return [];
10038
- }
10039
- return ((_a = this.exclusiveGroups.get(groupName)) !== null && _a !== void 0 ? _a : []).filter(name => name !== stateName);
10040
- }
10041
- isMutuallyExclusive(stateA, stateB) {
10042
- const groupName = this.getExclusiveGroup(stateA);
10043
- return !!groupName && groupName === this.getExclusiveGroup(stateB) && stateA !== stateB;
10044
- }
10045
- get effectiveStates() {
10046
- var _a, _b, _c;
10047
- return (_c = (_b = (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.effectiveStates) !== null && _b !== void 0 ? _b : this.currentStates) !== null && _c !== void 0 ? _c : [];
10048
- }
10049
- get resolvedPatch() {
10050
- var _a;
10051
- return (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.resolvedPatch;
10052
- }
10053
- sameStates(left, right) {
10054
- if (left.length !== right.length) {
10055
- return false;
10056
- }
10057
- for (let index = 0; index < left.length; index++) {
10058
- if (left[index] !== right[index]) {
10059
- return false;
10060
- }
10061
- }
10062
- return true;
10063
- }
10064
- }
10065
-
10066
- function isPlainObject(value) {
10067
- return value != null && typeof value === 'object' && !Array.isArray(value);
10068
- }
10069
- function cloneValue(value) {
10070
- if (!isPlainObject(value)) {
10071
- return value;
10072
- }
10073
- const clone = {};
10074
- for (const key in value) {
10075
- if (!Object.prototype.hasOwnProperty.call(value, key)) {
10076
- continue;
10077
- }
10078
- clone[key] = cloneValue(value[key]);
10079
- }
10080
- return clone;
10081
- }
10082
- function deepMerge(base, value) {
10083
- const result = cloneValue(base) || {};
10084
- for (const key in value) {
10085
- if (!Object.prototype.hasOwnProperty.call(value, key)) {
10086
- continue;
10087
- }
10088
- const nextValue = value[key];
10089
- const previousValue = result[key];
10090
- if (isPlainObject(previousValue) && isPlainObject(nextValue)) {
10091
- result[key] = deepMerge(previousValue, nextValue);
9435
+ var UpdateCategory;
9436
+ (function (UpdateCategory) {
9437
+ UpdateCategory[UpdateCategory["NONE"] = 0] = "NONE";
9438
+ UpdateCategory[UpdateCategory["PAINT"] = 1] = "PAINT";
9439
+ UpdateCategory[UpdateCategory["SHAPE"] = 2] = "SHAPE";
9440
+ UpdateCategory[UpdateCategory["BOUNDS"] = 4] = "BOUNDS";
9441
+ UpdateCategory[UpdateCategory["TRANSFORM"] = 8] = "TRANSFORM";
9442
+ UpdateCategory[UpdateCategory["LAYOUT"] = 16] = "LAYOUT";
9443
+ UpdateCategory[UpdateCategory["PICK"] = 32] = "PICK";
9444
+ })(UpdateCategory || (UpdateCategory = {}));
9445
+ const ATTRIBUTE_CATEGORY = {
9446
+ fill: UpdateCategory.PAINT,
9447
+ opacity: UpdateCategory.PAINT,
9448
+ fillOpacity: UpdateCategory.PAINT,
9449
+ strokeOpacity: UpdateCategory.PAINT,
9450
+ lineDash: UpdateCategory.PAINT,
9451
+ lineDashOffset: UpdateCategory.PAINT,
9452
+ lineCap: UpdateCategory.PAINT,
9453
+ lineJoin: UpdateCategory.PAINT,
9454
+ miterLimit: UpdateCategory.PAINT,
9455
+ shadowColor: UpdateCategory.PAINT,
9456
+ x: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9457
+ y: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9458
+ scaleX: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9459
+ scaleY: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9460
+ angle: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9461
+ anchor: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9462
+ anchor3d: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9463
+ postMatrix: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9464
+ layout: UpdateCategory.LAYOUT,
9465
+ zIndex: UpdateCategory.PAINT,
9466
+ visible: UpdateCategory.PAINT | UpdateCategory.PICK,
9467
+ lineWidth: UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.PICK,
9468
+ width: UpdateCategory.SHAPE | UpdateCategory.BOUNDS,
9469
+ height: UpdateCategory.SHAPE | UpdateCategory.BOUNDS
9470
+ };
9471
+ const ATTRIBUTE_DELTA_CLASSIFIER = {
9472
+ stroke: (prev, next) => {
9473
+ const prevEnabled = prev != null && prev !== false;
9474
+ const nextEnabled = next != null && next !== false;
9475
+ if (prevEnabled !== nextEnabled) {
9476
+ return UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK;
10092
9477
  }
10093
- else {
10094
- result[key] = cloneValue(nextValue);
9478
+ return UpdateCategory.PAINT;
9479
+ },
9480
+ shadowBlur: (prev, next) => {
9481
+ const prevBlur = Number(prev !== null && prev !== void 0 ? prev : 0);
9482
+ const nextBlur = Number(next !== null && next !== void 0 ? next : 0);
9483
+ if (prevBlur !== nextBlur && (prevBlur > 0 || nextBlur > 0)) {
9484
+ return UpdateCategory.PAINT | UpdateCategory.BOUNDS;
10095
9485
  }
9486
+ return UpdateCategory.PAINT;
10096
9487
  }
10097
- return result;
10098
- }
10099
- class StateStyleResolver {
10100
- constructor(options = {}) {
10101
- this.options = options;
10102
- }
10103
- resolve(normalAttrs, states, stateProxy, currentStates, stateSort) {
10104
- var _a;
10105
- const mergeMode = (_a = this.options.mergeMode) !== null && _a !== void 0 ? _a : 'shallow';
10106
- const sortedStates = stateSort ? currentStates.slice().sort(stateSort) : currentStates.slice();
10107
- const resolvedAttrs = {};
10108
- sortedStates.forEach(stateName => {
10109
- const attrs = stateProxy ? stateProxy(stateName, sortedStates) : states === null || states === void 0 ? void 0 : states[stateName];
10110
- if (attrs == null) {
10111
- return;
10112
- }
10113
- for (const key in attrs) {
10114
- if (!Object.prototype.hasOwnProperty.call(attrs, key)) {
10115
- continue;
10116
- }
10117
- const nextValue = attrs[key];
10118
- if (mergeMode === 'deep' &&
10119
- isPlainObject(nextValue) &&
10120
- (isPlainObject(resolvedAttrs[key]) ||
10121
- isPlainObject(normalAttrs[key]))) {
10122
- const baseValue = isPlainObject(resolvedAttrs[key])
10123
- ? resolvedAttrs[key]
10124
- : isPlainObject(normalAttrs[key])
10125
- ? normalAttrs[key]
10126
- : {};
10127
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
10128
- }
10129
- else {
10130
- resolvedAttrs[key] = cloneValue(nextValue);
10131
- }
10132
- }
10133
- });
10134
- return resolvedAttrs;
10135
- }
10136
- resolveWithCompiled(normalAttrs, compiledDefinitions, stateProxy, effectiveStates, resolvedPatch) {
10137
- var _a, _b;
10138
- const mergeMode = (_a = this.options.mergeMode) !== null && _a !== void 0 ? _a : 'shallow';
10139
- const resolvedAttrs = (_b = cloneValue(resolvedPatch)) !== null && _b !== void 0 ? _b : {};
10140
- effectiveStates.forEach(stateName => {
10141
- const proxyPatch = stateProxy === null || stateProxy === void 0 ? void 0 : stateProxy(stateName, effectiveStates);
10142
- if (proxyPatch == null) {
10143
- return;
10144
- }
10145
- Object.keys(proxyPatch).forEach(key => {
10146
- const nextValue = proxyPatch[key];
10147
- const hasCompiledDefinition = compiledDefinitions.has(stateName);
10148
- if (mergeMode === 'deep' &&
10149
- isPlainObject(nextValue) &&
10150
- (isPlainObject(resolvedAttrs[key]) ||
10151
- (!hasCompiledDefinition && isPlainObject(normalAttrs[key])))) {
10152
- const baseValue = isPlainObject(resolvedAttrs[key])
10153
- ? resolvedAttrs[key]
10154
- : isPlainObject(normalAttrs[key])
10155
- ? normalAttrs[key]
10156
- : {};
10157
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
10158
- return;
10159
- }
10160
- resolvedAttrs[key] = cloneValue(nextValue);
10161
- });
10162
- });
10163
- return resolvedAttrs;
10164
- }
10165
- computeNormalAttrsBackup(normalAttrs, targetAttrs, finalAttribute) {
10166
- const nextNormalAttrs = {};
10167
- const nextTargetAttrs = Object.assign({}, targetAttrs);
10168
- for (const key in targetAttrs) {
10169
- if (!Object.prototype.hasOwnProperty.call(targetAttrs, key)) {
10170
- continue;
10171
- }
10172
- if (normalAttrs && key in normalAttrs) {
10173
- nextNormalAttrs[key] = cloneValue(normalAttrs[key]);
10174
- }
10175
- else {
10176
- nextNormalAttrs[key] = cloneValue(finalAttribute[key]);
10177
- }
10178
- }
10179
- if (normalAttrs) {
10180
- for (const key in normalAttrs) {
10181
- if (!Object.prototype.hasOwnProperty.call(normalAttrs, key) || key in targetAttrs) {
10182
- continue;
10183
- }
10184
- nextTargetAttrs[key] = cloneValue(normalAttrs[key]);
10185
- }
10186
- }
10187
- return {
10188
- attrs: nextTargetAttrs,
10189
- normalAttrs: nextNormalAttrs
10190
- };
9488
+ };
9489
+ function classifyAttributeDelta(key, prev, next) {
9490
+ var _a;
9491
+ const dynamicClassifier = ATTRIBUTE_DELTA_CLASSIFIER[key];
9492
+ if (dynamicClassifier) {
9493
+ return dynamicClassifier(prev, next);
10191
9494
  }
9495
+ return (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
10192
9496
  }
10193
9497
 
10194
9498
  function hasOwnKeys(value) {
@@ -10212,13 +9516,11 @@ function normalizeNoAnimateAttrConfig(config) {
10212
9516
  }, {});
10213
9517
  }
10214
9518
  class StateTransitionOrchestrator {
10215
- analyzeTransition(_currentAttrs, targetAttrs, stateNames, hasAnimation, options = {}) {
9519
+ analyzeTransition(targetAttrs, hasAnimation, options = {}) {
10216
9520
  var _a, _b;
10217
9521
  const plan = {
10218
- stateNames,
10219
9522
  targetAttrs: Object.assign({}, targetAttrs),
10220
9523
  animateAttrs: {},
10221
- jumpAttrs: {},
10222
9524
  noAnimateAttrs: {}
10223
9525
  };
10224
9526
  if (!hasAnimation) {
@@ -10227,10 +9529,10 @@ class StateTransitionOrchestrator {
10227
9529
  const noWorkAnimateAttr = Object.assign(Object.assign({}, ((_a = options.noWorkAnimateAttr) !== null && _a !== void 0 ? _a : {})), normalizeNoAnimateAttrConfig((_b = options.animateConfig) === null || _b === void 0 ? void 0 : _b.noAnimateAttrs));
10228
9530
  const isClear = options.isClear === true;
10229
9531
  const getDefaultAttribute = options.getDefaultAttribute;
9532
+ const readDefaultAttribute = getDefaultAttribute;
10230
9533
  const shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute;
10231
9534
  const assignTransitionAttr = (key, value) => {
10232
9535
  if (noWorkAnimateAttr[key]) {
10233
- plan.jumpAttrs[key] = value;
10234
9536
  plan.noAnimateAttrs[key] = value;
10235
9537
  return;
10236
9538
  }
@@ -10238,7 +9540,7 @@ class StateTransitionOrchestrator {
10238
9540
  if (shouldSkipDefaultAttribute === null || shouldSkipDefaultAttribute === void 0 ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) {
10239
9541
  return;
10240
9542
  }
10241
- plan.animateAttrs[key] = getDefaultAttribute ? getDefaultAttribute(key) : value;
9543
+ plan.animateAttrs[key] = readDefaultAttribute(key);
10242
9544
  return;
10243
9545
  }
10244
9546
  plan.animateAttrs[key] = value;
@@ -10292,13 +9594,13 @@ class StateTransitionOrchestrator {
10292
9594
  graphic._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
10293
9595
  return plan;
10294
9596
  }
10295
- applyClearTransition(graphic, targetAttrs, hasAnimation, stateNames, options = {}) {
10296
- var _a, _b, _c, _d;
10297
- const plan = this.analyzeTransition({}, targetAttrs, stateNames, hasAnimation, {
10298
- noWorkAnimateAttr: (_a = graphic.getNoWorkAnimateAttr) === null || _a === void 0 ? void 0 : _a.call(graphic),
9597
+ applyClearTransition(graphic, targetAttrs, hasAnimation, options = {}) {
9598
+ var _a;
9599
+ const plan = this.analyzeTransition(targetAttrs, hasAnimation, {
9600
+ noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
10299
9601
  isClear: true,
10300
- getDefaultAttribute: (_b = graphic.getDefaultAttribute) === null || _b === void 0 ? void 0 : _b.bind(graphic),
10301
- shouldSkipDefaultAttribute: (_c = options.shouldSkipDefaultAttribute) !== null && _c !== void 0 ? _c : (_d = graphic.shouldSkipStateTransitionDefaultAttribute) === null || _d === void 0 ? void 0 : _d.bind(graphic),
9602
+ getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
9603
+ shouldSkipDefaultAttribute: (_a = options.shouldSkipDefaultAttribute) !== null && _a !== void 0 ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
10302
9604
  animateConfig: options.animateConfig,
10303
9605
  extraAnimateAttrs: options.extraAnimateAttrs
10304
9606
  });
@@ -10307,33 +9609,11 @@ class StateTransitionOrchestrator {
10307
9609
  }
10308
9610
 
10309
9611
  const compiler = new StateDefinitionCompiler();
10310
- function copyDefinitions(definitions) {
10311
- return definitions ? Object.assign({}, definitions) : {};
10312
- }
10313
9612
  function buildEffectiveSourceDefinitions(parentScope, localStateDefinitions, themeStateDefinitions) {
10314
- const merged = parentScope
10315
- ? copyDefinitions(parentScope.effectiveSourceDefinitions)
10316
- : copyDefinitions(themeStateDefinitions);
10317
- if (localStateDefinitions) {
10318
- Object.keys(localStateDefinitions).forEach(stateName => {
10319
- merged[stateName] = localStateDefinitions[stateName];
10320
- });
10321
- }
10322
- return merged;
10323
- }
10324
- function initializeScope(scope, revision = 0) {
10325
- var _a;
10326
- const effectiveSourceDefinitions = buildEffectiveSourceDefinitions(scope.parentScope, scope.localStateDefinitions, scope.themeStateDefinitions);
10327
- scope.effectiveSourceDefinitions = effectiveSourceDefinitions;
10328
- scope.effectiveCompiledDefinitions = compiler.compile(effectiveSourceDefinitions);
10329
- scope.parentRevisionAtBuild = (_a = scope.parentScope) === null || _a === void 0 ? void 0 : _a.revision;
10330
- scope.revision = revision;
10331
- scope.dirty = false;
10332
- return scope;
9613
+ return Object.assign({}, parentScope ? parentScope.effectiveSourceDefinitions : themeStateDefinitions, localStateDefinitions);
10333
9614
  }
10334
9615
  function createRootSharedStateScope(stage, themeStateDefinitions) {
10335
- return initializeScope({
10336
- ownerKind: 'root',
9616
+ return rebuildSharedStateScope({
10337
9617
  ownerStage: stage,
10338
9618
  themeStateDefinitions,
10339
9619
  effectiveSourceDefinitions: {},
@@ -10344,9 +9624,7 @@ function createRootSharedStateScope(stage, themeStateDefinitions) {
10344
9624
  }, 0);
10345
9625
  }
10346
9626
  function createGroupSharedStateScope(group, parentScope, localStateDefinitions) {
10347
- return initializeScope({
10348
- ownerKind: 'group',
10349
- ownerGroup: group,
9627
+ return rebuildSharedStateScope({
10350
9628
  ownerStage: group.stage,
10351
9629
  parentScope,
10352
9630
  localStateDefinitions,
@@ -10381,22 +9659,20 @@ function setRootSharedStateScopeThemeDefinitions(scope, themeStateDefinitions) {
10381
9659
  rebuildSharedStateScope(scope);
10382
9660
  return true;
10383
9661
  }
10384
- function rebuildSharedStateScope(scope) {
9662
+ function rebuildSharedStateScope(scope, revision = scope.revision + 1) {
10385
9663
  var _a;
10386
9664
  const effectiveSourceDefinitions = buildEffectiveSourceDefinitions(scope.parentScope, scope.localStateDefinitions, scope.themeStateDefinitions);
10387
9665
  scope.effectiveSourceDefinitions = effectiveSourceDefinitions;
10388
9666
  scope.effectiveCompiledDefinitions = compiler.compile(effectiveSourceDefinitions);
10389
9667
  scope.parentRevisionAtBuild = (_a = scope.parentScope) === null || _a === void 0 ? void 0 : _a.revision;
10390
- scope.revision += 1;
9668
+ scope.revision = revision;
10391
9669
  scope.dirty = false;
10392
9670
  return scope;
10393
9671
  }
10394
9672
  function ensureSharedStateScopeFresh(scope) {
10395
- var _a;
10396
9673
  if (!scope) {
10397
9674
  return undefined;
10398
9675
  }
10399
- (_a = getStageStatePerfMonitor(scope.ownerStage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('ensureFreshCalls');
10400
9676
  if (scope.parentScope) {
10401
9677
  ensureSharedStateScopeFresh(scope.parentScope);
10402
9678
  }
@@ -10416,11 +9692,9 @@ function collectSharedStateScopeChain(scope) {
10416
9692
  }
10417
9693
 
10418
9694
  function scheduleStageSharedStateRefresh(stage) {
10419
- var _a;
10420
9695
  if (!stage || stage.releaseStatus === 'released') {
10421
9696
  return;
10422
9697
  }
10423
- (_a = getStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('renderScheduled');
10424
9698
  stage.renderNextFrame();
10425
9699
  }
10426
9700
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
@@ -10429,36 +9703,27 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
10429
9703
  return;
10430
9704
  }
10431
9705
  const pending = (_a = stage._pendingSharedStateRefreshGraphics) !== null && _a !== void 0 ? _a : (stage._pendingSharedStateRefreshGraphics = new Set());
10432
- if (!pending.has(graphic)) {
10433
- pending.add(graphic);
10434
- const perfMonitor = getStageStatePerfMonitor(stage);
10435
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordRefresh('queuedGraphics');
10436
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordAllocation('refreshQueuePushes');
10437
- }
9706
+ pending.add(graphic);
10438
9707
  }
10439
9708
  function markScopeActiveDescendantsDirty(scope, stage) {
10440
- let marked = false;
9709
+ if (!scope.subtreeActiveDescendants.size) {
9710
+ return;
9711
+ }
10441
9712
  scope.subtreeActiveDescendants.forEach(graphic => {
10442
9713
  var _a;
10443
9714
  graphic.sharedStateDirty = true;
10444
9715
  const ownerStage = (_a = stage !== null && stage !== void 0 ? stage : graphic.stage) !== null && _a !== void 0 ? _a : scope.ownerStage;
10445
9716
  enqueueGraphicSharedStateRefresh(ownerStage, graphic);
10446
- marked = true;
10447
9717
  });
10448
- if (marked) {
10449
- scheduleStageSharedStateRefresh(stage !== null && stage !== void 0 ? stage : scope.ownerStage);
10450
- }
9718
+ scheduleStageSharedStateRefresh(stage !== null && stage !== void 0 ? stage : scope.ownerStage);
10451
9719
  }
10452
9720
  function flushStageSharedStateRefresh(stage) {
10453
9721
  const pending = stage._pendingSharedStateRefreshGraphics;
10454
9722
  if (!pending || !pending.size) {
10455
9723
  return;
10456
9724
  }
10457
- const perfMonitor = getStageStatePerfMonitor(stage);
10458
- const start = perfMonitor ? performance.now() : 0;
10459
9725
  const graphics = Array.from(pending.values());
10460
9726
  pending.clear();
10461
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordRefresh('flushedGraphics', graphics.length);
10462
9727
  graphics.forEach(graphic => {
10463
9728
  if (graphic.releaseStatus === 'released') {
10464
9729
  return;
@@ -10466,19 +9731,11 @@ function flushStageSharedStateRefresh(stage) {
10466
9731
  if (graphic.stage !== stage) {
10467
9732
  return;
10468
9733
  }
10469
- const refresh = graphic.refreshSharedStateBeforeRender;
10470
- if (typeof refresh === 'function') {
10471
- refresh.call(graphic);
10472
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('sharedRefreshCommits');
9734
+ if (!graphic.sharedStateDirty) {
9735
+ return;
10473
9736
  }
9737
+ graphic.refreshSharedStateBeforeRender();
10474
9738
  });
10475
- if (perfMonitor) {
10476
- perfMonitor.recordCost('sharedRefresh', performance.now() - start);
10477
- perfMonitor.recordEvent('shared-refresh-flush', {
10478
- stageId: stage._uid,
10479
- flushedGraphics: graphics.length
10480
- });
10481
- }
10482
9739
  }
10483
9740
 
10484
9741
  const _tempBounds$1 = new AABBBounds();
@@ -10519,8 +9776,14 @@ const builtinTextureTypes = new Set([
10519
9776
  'wave'
10520
9777
  ]);
10521
9778
  const point = new Point();
9779
+ const EMPTY_STATE_NAMES = [];
9780
+ const BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT |
9781
+ UpdateCategory.SHAPE |
9782
+ UpdateCategory.BOUNDS |
9783
+ UpdateCategory.TRANSFORM |
9784
+ UpdateCategory.LAYOUT;
10522
9785
  function isPlainObjectValue(value) {
10523
- return typeof value === 'object' && value != null && !isArray(value);
9786
+ return typeof value === 'object' && value != null && !Array.isArray(value);
10524
9787
  }
10525
9788
  function cloneAttributeValue(value) {
10526
9789
  if (!isPlainObjectValue(value)) {
@@ -10534,18 +9797,6 @@ function cloneAttributeValue(value) {
10534
9797
  });
10535
9798
  return clone;
10536
9799
  }
10537
- function cloneSimpleAttributeRecord(value) {
10538
- if (!isPlainObjectValue(value)) {
10539
- return value;
10540
- }
10541
- return Object.assign({}, value);
10542
- }
10543
- function shouldUseSimpleAttributeFastPath(value) {
10544
- if (!isPlainObjectValue(value)) {
10545
- return false;
10546
- }
10547
- return !Object.keys(value).some(key => isPlainObjectValue(value[key]));
10548
- }
10549
9800
  function cloneAttributeSurface(value) {
10550
9801
  if (!isPlainObjectValue(value)) {
10551
9802
  return value;
@@ -10558,6 +9809,15 @@ function cloneAttributeSurface(value) {
10558
9809
  });
10559
9810
  return clone;
10560
9811
  }
9812
+ function areAttributeValuesEqual(left, right) {
9813
+ if (left === right) {
9814
+ return true;
9815
+ }
9816
+ if (!isPlainObjectValue(left) && !isPlainObjectValue(right) && !Array.isArray(left) && !Array.isArray(right)) {
9817
+ return false;
9818
+ }
9819
+ return isEqual(left, right);
9820
+ }
10561
9821
  function deepMergeAttributeValue(base, value) {
10562
9822
  var _a;
10563
9823
  const result = (_a = cloneAttributeValue(base)) !== null && _a !== void 0 ? _a : {};
@@ -10625,24 +9885,29 @@ class Graphic extends Node {
10625
9885
  get globalTransMatrix() {
10626
9886
  return this.tryUpdateGlobalTransMatrix(true);
10627
9887
  }
9888
+ get baseAttributes() {
9889
+ var _a;
9890
+ return (_a = this._baseAttributes) !== null && _a !== void 0 ? _a : this.attribute;
9891
+ }
9892
+ set baseAttributes(value) {
9893
+ if (value === this.attribute) {
9894
+ this._baseAttributes = undefined;
9895
+ return;
9896
+ }
9897
+ this._baseAttributes = value;
9898
+ }
10628
9899
  constructor(params = {}) {
10629
9900
  var _a;
10630
9901
  super();
10631
- this.resolverEpoch = 0;
10632
9902
  this._AABBBounds = new AABBBounds();
10633
9903
  this._updateTag = UpdateTag.INIT;
10634
- const useSimpleAttributeFastPath = shouldUseSimpleAttributeFastPath(params);
10635
- const initialBaseAttributes = (useSimpleAttributeFastPath ? cloneSimpleAttributeRecord(params) : cloneAttributeValue(params));
10636
- this.baseAttributes = initialBaseAttributes;
10637
- this.attribute = (useSimpleAttributeFastPath
10638
- ? cloneSimpleAttributeRecord(initialBaseAttributes)
10639
- : cloneAttributeSurface(initialBaseAttributes));
9904
+ this.attribute = params;
10640
9905
  this.valid = this.isValid();
10641
9906
  this.updateAABBBoundsStamp = 0;
10642
9907
  if (params.background) {
10643
9908
  this.loadImage((_a = params.background.background) !== null && _a !== void 0 ? _a : params.background, true);
10644
9909
  }
10645
- if (isExternalTexture(params.texture)) {
9910
+ if (params.texture && isExternalTexture(params.texture)) {
10646
9911
  this.loadImage(params.texture, false);
10647
9912
  }
10648
9913
  if (params.shadowGraphic) {
@@ -10652,8 +9917,11 @@ class Graphic extends Node {
10652
9917
  get normalAttrs() {
10653
9918
  return this.baseAttributes;
10654
9919
  }
10655
- set normalAttrs(value) {
10656
- this._deprecatedNormalAttrsView = value !== null && value !== void 0 ? value : undefined;
9920
+ set normalAttrs(_value) {
9921
+ }
9922
+ getBaseAttributesStorage() {
9923
+ var _a;
9924
+ return (_a = this._baseAttributes) !== null && _a !== void 0 ? _a : this.attribute;
10657
9925
  }
10658
9926
  getGraphicService() {
10659
9927
  var _a, _b;
@@ -10662,18 +9930,6 @@ class Graphic extends Node {
10662
9930
  getAttributes() {
10663
9931
  return this.attribute;
10664
9932
  }
10665
- getStateStyleResolver(mergeMode) {
10666
- if (mergeMode === 'deep') {
10667
- if (!this.deepStateStyleResolver) {
10668
- this.deepStateStyleResolver = new StateStyleResolver({ mergeMode: 'deep' });
10669
- }
10670
- return this.deepStateStyleResolver;
10671
- }
10672
- if (!this.stateStyleResolver) {
10673
- this.stateStyleResolver = new StateStyleResolver();
10674
- }
10675
- return this.stateStyleResolver;
10676
- }
10677
9933
  getStateTransitionOrchestrator() {
10678
9934
  if (!this.stateTransitionOrchestrator) {
10679
9935
  this.stateTransitionOrchestrator = new StateTransitionOrchestrator();
@@ -10700,25 +9956,41 @@ class Graphic extends Node {
10700
9956
  }
10701
9957
  this.boundSharedStateScope = nextScope;
10702
9958
  this.boundSharedStateRevision = undefined;
10703
- this.localFallbackCompiledDefinitions = undefined;
10704
9959
  this.compiledStateDefinitions = undefined;
10705
9960
  this.compiledStateDefinitionsCacheKey = undefined;
10706
9961
  this.stateEngine = undefined;
10707
9962
  this.stateEngineCompiledDefinitions = undefined;
10708
- this.stateEngineStateProxyModeKey = undefined;
10709
9963
  this.syncSharedStateActiveRegistrations();
10710
9964
  if (markDirty && ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length)) {
10711
9965
  this.markSharedStateDirty();
10712
9966
  }
10713
9967
  return true;
10714
9968
  }
10715
- syncSharedStateActiveRegistrations() {
9969
+ syncSharedStateScopeBindingOnTreeChange(markDirty = true) {
10716
9970
  var _a, _b;
10717
- const nextScopes = ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) && this.boundSharedStateScope
10718
- ? new Set(collectSharedStateScopeChain(this.boundSharedStateScope))
10719
- : new Set();
10720
- const previousScopes = (_b = this.registeredActiveScopes) !== null && _b !== void 0 ? _b : new Set();
10721
- previousScopes.forEach(scope => {
9971
+ if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) &&
9972
+ !this.boundSharedStateScope &&
9973
+ !((_b = this.registeredActiveScopes) === null || _b === void 0 ? void 0 : _b.size) &&
9974
+ !this.sharedStateDirty) {
9975
+ return false;
9976
+ }
9977
+ return this.syncSharedStateScopeBindingFromTree(markDirty);
9978
+ }
9979
+ syncSharedStateActiveRegistrations() {
9980
+ var _a;
9981
+ const previousScopes = this.registeredActiveScopes;
9982
+ if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.boundSharedStateScope) {
9983
+ if (previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.size) {
9984
+ previousScopes.forEach(scope => {
9985
+ scope.subtreeActiveDescendants.delete(this);
9986
+ });
9987
+ previousScopes.clear();
9988
+ }
9989
+ this.registeredActiveScopes = undefined;
9990
+ return;
9991
+ }
9992
+ const nextScopes = new Set(collectSharedStateScopeChain(this.boundSharedStateScope));
9993
+ previousScopes === null || previousScopes === void 0 ? void 0 : previousScopes.forEach(scope => {
10722
9994
  if (!nextScopes.has(scope)) {
10723
9995
  scope.subtreeActiveDescendants.delete(this);
10724
9996
  }
@@ -10748,7 +10020,7 @@ class Graphic extends Node {
10748
10020
  this.setStage(stage, layer);
10749
10021
  return;
10750
10022
  }
10751
- this.syncSharedStateScopeBindingFromTree();
10023
+ this.syncSharedStateScopeBindingOnTreeChange();
10752
10024
  }
10753
10025
  refreshSharedStateBeforeRender() {
10754
10026
  var _a;
@@ -10763,16 +10035,16 @@ class Graphic extends Node {
10763
10035
  this.recomputeCurrentStatePatch();
10764
10036
  this.stopStateAnimates();
10765
10037
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
10766
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
10038
+ this.emitStateUpdateEvent();
10767
10039
  this.sharedStateDirty = false;
10768
10040
  }
10769
10041
  getLocalStatesVersion() {
10770
10042
  var _a, _b;
10771
10043
  if (this.localStateDefinitionsSource !== this.states) {
10772
10044
  this.localStateDefinitionsSource = this.states;
10773
- this.localFallbackVersion = ((_a = this.localFallbackVersion) !== null && _a !== void 0 ? _a : 0) + 1;
10045
+ this.localStateDefinitionsVersion = ((_a = this.localStateDefinitionsVersion) !== null && _a !== void 0 ? _a : 0) + 1;
10774
10046
  }
10775
- return (_b = this.localFallbackVersion) !== null && _b !== void 0 ? _b : 0;
10047
+ return (_b = this.localStateDefinitionsVersion) !== null && _b !== void 0 ? _b : 0;
10776
10048
  }
10777
10049
  resolveEffectiveCompiledDefinitions() {
10778
10050
  this.syncSharedStateScopeBindingFromTree(false);
@@ -10785,8 +10057,7 @@ class Graphic extends Node {
10785
10057
  if (!boundScope) {
10786
10058
  if (!hasStates) {
10787
10059
  return {
10788
- compiledDefinitions: undefined,
10789
- stateProxyModeKey: 'none'
10060
+ compiledDefinitions: undefined
10790
10061
  };
10791
10062
  }
10792
10063
  const localStatesVersion = this.getLocalStatesVersion();
@@ -10796,72 +10067,29 @@ class Graphic extends Node {
10796
10067
  this.compiledStateDefinitionsCacheKey = cacheKey;
10797
10068
  }
10798
10069
  return {
10799
- compiledDefinitions: this.compiledStateDefinitions,
10800
- stateProxyModeKey: this.stateProxy ? 'legacy-all' : 'none'
10070
+ compiledDefinitions: this.compiledStateDefinitions
10801
10071
  };
10802
10072
  }
10803
10073
  const sharedCompiledDefinitions = boundScope.effectiveCompiledDefinitions;
10804
- const sharedStateProxyModeKey = this.stateProxy ? 'shared-missing-only' : 'none';
10805
- const sharedStateProxyEligibility = this.stateProxy
10806
- ? (stateName) => !sharedCompiledDefinitions.has(stateName)
10807
- : undefined;
10808
- if (!hasStates) {
10809
- this.localFallbackCompiledDefinitions = undefined;
10810
- return {
10811
- compiledDefinitions: sharedCompiledDefinitions,
10812
- stateProxyModeKey: sharedStateProxyModeKey,
10813
- stateProxyEligibility: sharedStateProxyEligibility
10814
- };
10815
- }
10816
- const localStates = this.states;
10817
- const missingLocalStateDefinitions = {};
10818
- const missingStateNames = [];
10819
- Object.keys(localStates).forEach(stateName => {
10820
- if (sharedCompiledDefinitions.has(stateName)) {
10821
- return;
10822
- }
10823
- missingLocalStateDefinitions[stateName] = localStates[stateName];
10824
- missingStateNames.push(stateName);
10825
- });
10826
- if (!missingStateNames.length) {
10827
- this.localFallbackCompiledDefinitions = undefined;
10828
- return {
10829
- compiledDefinitions: sharedCompiledDefinitions,
10830
- stateProxyModeKey: sharedStateProxyModeKey,
10831
- stateProxyEligibility: sharedStateProxyEligibility
10832
- };
10833
- }
10834
- const localStatesVersion = this.getLocalStatesVersion();
10835
- const stateProxyModeKey = this.stateProxy ? `missing:${missingStateNames.sort().join('|')}` : 'none';
10836
- const cacheKey = `shared:${boundScope.revision}:fallback:${localStatesVersion}:${stateProxyModeKey}`;
10837
- if (!this.localFallbackCompiledDefinitions || this.compiledStateDefinitionsCacheKey !== cacheKey) {
10838
- this.localFallbackCompiledDefinitions = new StateDefinitionCompiler().compile(Object.assign(Object.assign({}, boundScope.effectiveSourceDefinitions), missingLocalStateDefinitions));
10839
- this.compiledStateDefinitionsCacheKey = cacheKey;
10840
- }
10841
10074
  return {
10842
- compiledDefinitions: this.localFallbackCompiledDefinitions,
10843
- stateProxyModeKey,
10844
- stateProxyEligibility: sharedStateProxyEligibility
10075
+ compiledDefinitions: sharedCompiledDefinitions
10845
10076
  };
10846
10077
  }
10847
10078
  recomputeCurrentStatePatch() {
10848
- var _a, _b, _c, _d;
10079
+ var _a, _b;
10849
10080
  if (!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length)) {
10850
10081
  this.effectiveStates = [];
10851
10082
  this.resolvedStatePatch = undefined;
10852
10083
  this.syncSharedStateActiveRegistrations();
10853
10084
  return;
10854
10085
  }
10855
- const stateResolveBaseAttrs = ((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : this.attribute);
10856
- const stateModel = this.createStateModel();
10857
- (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.setResolveContext(this, stateResolveBaseAttrs);
10858
- const transition = stateModel.useStates(this.currentStates);
10859
- const effectiveStates = (_d = transition.effectiveStates) !== null && _d !== void 0 ? _d : transition.states;
10860
- const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
10861
- ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
10086
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
10087
+ const transition = this.resolveUseStatesTransition(this.currentStates, stateResolveBaseAttrs);
10088
+ const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
10089
+ const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
10862
10090
  this.currentStates = transition.states;
10863
10091
  this.effectiveStates = [...effectiveStates];
10864
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
10092
+ this.resolvedStatePatch = resolvedStateAttrs;
10865
10093
  this.syncSharedStateActiveRegistrations();
10866
10094
  }
10867
10095
  buildStaticAttributeSnapshot() {
@@ -10913,10 +10141,13 @@ class Graphic extends Node {
10913
10141
  });
10914
10142
  return extraAttrs;
10915
10143
  }
10916
- syncObjectToSnapshot(target, snapshot) {
10144
+ syncObjectToSnapshot(target, snapshot, excludedKeys) {
10917
10145
  const delta = new Map();
10918
10146
  const keySet = new Set([...Object.keys(target), ...Object.keys(snapshot)]);
10919
10147
  keySet.forEach(key => {
10148
+ if ((excludedKeys === null || excludedKeys === void 0 ? void 0 : excludedKeys[key]) === true) {
10149
+ return;
10150
+ }
10920
10151
  const hasNext = Object.prototype.hasOwnProperty.call(snapshot, key);
10921
10152
  const previousValue = target[key];
10922
10153
  if (!hasNext) {
@@ -10927,7 +10158,7 @@ class Graphic extends Node {
10927
10158
  return;
10928
10159
  }
10929
10160
  const nextValue = snapshot[key];
10930
- if (isEqual(previousValue, nextValue)) {
10161
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
10931
10162
  return;
10932
10163
  }
10933
10164
  delta.set(key, { prev: previousValue, next: nextValue });
@@ -10935,41 +10166,47 @@ class Graphic extends Node {
10935
10166
  });
10936
10167
  return delta;
10937
10168
  }
10938
- _syncAttribute() {
10169
+ _syncAttribute(excludedKeys) {
10170
+ if (this.attribute === this.baseAttributes && this.resolvedStatePatch) {
10171
+ this.detachAttributeFromBaseAttributes();
10172
+ }
10939
10173
  const snapshot = this.buildStaticAttributeSnapshot();
10940
- const delta = this.syncObjectToSnapshot(this.attribute, snapshot);
10174
+ const delta = this.syncObjectToSnapshot(this.attribute, snapshot, excludedKeys);
10941
10175
  this.valid = this.isValid();
10176
+ this.attributeMayContainTransientAttrs = !!excludedKeys;
10942
10177
  return delta;
10943
10178
  }
10944
- _syncFinalAttributeFromStaticTruth() {
10179
+ _syncFinalAttributeFromStaticTruth(excludedKeys) {
10945
10180
  const target = this.finalAttribute;
10946
10181
  if (!target) {
10947
10182
  return;
10948
10183
  }
10949
10184
  const snapshot = this.buildStaticAttributeSnapshot();
10950
- this.syncObjectToSnapshot(target, snapshot);
10185
+ this.syncObjectToSnapshot(target, snapshot, excludedKeys);
10951
10186
  }
10952
- submitUpdateByDelta(delta, forceUpdateTag = false) {
10187
+ mergeAttributeDeltaCategory(category, key, prev, next) {
10953
10188
  var _a;
10189
+ let nextCategory = key === 'stroke' || key === 'shadowBlur'
10190
+ ? classifyAttributeDelta(key, prev, next)
10191
+ : (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
10192
+ if (nextCategory & UpdateCategory.PICK) {
10193
+ nextCategory |= UpdateCategory.BOUNDS;
10194
+ }
10195
+ if (nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key)) {
10196
+ nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS;
10197
+ }
10198
+ return category | nextCategory;
10199
+ }
10200
+ submitUpdateByCategory(category, forceUpdateTag = false) {
10954
10201
  if (forceUpdateTag) {
10955
10202
  this.addUpdateShapeAndBoundsTag();
10956
10203
  this.addUpdatePositionTag();
10957
10204
  this.addUpdateLayoutTag();
10958
10205
  return;
10959
10206
  }
10960
- let category = UpdateCategory.NONE;
10961
- delta.forEach((entry, key) => {
10962
- let nextCategory = classifyAttributeDelta(key, entry.prev, entry.next);
10963
- if (nextCategory & UpdateCategory.PICK) {
10964
- nextCategory |= UpdateCategory.BOUNDS;
10965
- }
10966
- if (nextCategory === UpdateCategory.PAINT && this.needUpdateTag(key)) {
10967
- nextCategory = UpdateCategory.SHAPE | UpdateCategory.BOUNDS;
10968
- }
10969
- category |= nextCategory;
10970
- });
10971
- if (category !== UpdateCategory.NONE) {
10972
- (_a = getStageStatePerfMonitor(this.stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10207
+ if ((category & BROAD_UPDATE_CATEGORY) === BROAD_UPDATE_CATEGORY) {
10208
+ this.addBroadUpdateTag();
10209
+ return;
10973
10210
  }
10974
10211
  if (category & UpdateCategory.SHAPE) {
10975
10212
  this.addUpdateShapeAndBoundsTag();
@@ -10987,47 +10224,269 @@ class Graphic extends Node {
10987
10224
  this.addUpdateLayoutTag();
10988
10225
  }
10989
10226
  }
10227
+ submitUpdateByDelta(delta, forceUpdateTag = false) {
10228
+ let category = UpdateCategory.NONE;
10229
+ delta.forEach((entry, key) => {
10230
+ category = this.mergeAttributeDeltaCategory(category, key, entry.prev, entry.next);
10231
+ });
10232
+ this.submitUpdateByCategory(category, forceUpdateTag);
10233
+ }
10234
+ submitTouchedKeyUpdate(keys, forceUpdateTag = false) {
10235
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTags(keys));
10236
+ }
10237
+ submitTouchedUpdate(needsShapeAndBounds) {
10238
+ if (!this.updateShapeAndBoundsTagSetted() && needsShapeAndBounds) {
10239
+ this.addUpdateShapeAndBoundsTag();
10240
+ }
10241
+ else {
10242
+ this.addUpdateBoundTag();
10243
+ }
10244
+ this.addUpdatePositionTag();
10245
+ this.addUpdateLayoutTag();
10246
+ }
10990
10247
  commitBaseAttributeMutation(forceUpdateTag = false, context) {
10991
- var _a, _b;
10248
+ var _a, _b, _c;
10992
10249
  if ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) {
10993
- this.resolverEpoch += 1;
10994
- (_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.invalidateResolverCache();
10250
+ this.resolverEpoch = ((_b = this.resolverEpoch) !== null && _b !== void 0 ? _b : 0) + 1;
10251
+ (_c = this.stateEngine) === null || _c === void 0 ? void 0 : _c.invalidateResolverCache();
10995
10252
  this.recomputeCurrentStatePatch();
10996
10253
  }
10997
10254
  const delta = this._syncAttribute();
10998
10255
  this.submitUpdateByDelta(delta, forceUpdateTag);
10999
10256
  this.onAttributeUpdate(context);
11000
10257
  }
10258
+ canCommitBaseAttributesByTouchedKeys() {
10259
+ var _a, _b;
10260
+ if (((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || this.resolvedStatePatch || this.attributeMayContainTransientAttrs) {
10261
+ return false;
10262
+ }
10263
+ if (!((_b = this.animates) === null || _b === void 0 ? void 0 : _b.size) && !this._animationStateManager) {
10264
+ return true;
10265
+ }
10266
+ return !this.hasAnyTrackedAnimate();
10267
+ }
10268
+ detachAttributeFromBaseAttributes() {
10269
+ if (this.attribute === this.baseAttributes) {
10270
+ this._baseAttributes = this.attribute;
10271
+ this.attribute = cloneAttributeSurface(this.attribute);
10272
+ }
10273
+ }
10274
+ commitInternalBaseAttributes(params, context) {
10275
+ if (!params || !Object.keys(params).length) {
10276
+ return;
10277
+ }
10278
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
10279
+ this.commitBaseAttributesByTouchedKeys(params, false, context);
10280
+ return;
10281
+ }
10282
+ this.detachAttributeFromBaseAttributes();
10283
+ this.applyBaseAttributes(params);
10284
+ this.commitBaseAttributeMutation(false, context);
10285
+ }
10286
+ commitBaseAttributesByTouchedKeys(params, forceUpdateTag = false, context) {
10287
+ const source = params;
10288
+ const baseAttributes = this.getBaseAttributesStorage();
10289
+ let hasKeys = false;
10290
+ let needsShapeAndBounds = forceUpdateTag;
10291
+ for (const key in source) {
10292
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
10293
+ continue;
10294
+ }
10295
+ hasKeys = true;
10296
+ baseAttributes[key] = source[key];
10297
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
10298
+ needsShapeAndBounds = true;
10299
+ }
10300
+ }
10301
+ if (!hasKeys) {
10302
+ return;
10303
+ }
10304
+ this.attribute = baseAttributes;
10305
+ this._baseAttributes = undefined;
10306
+ this.valid = this.isValid();
10307
+ this.attributeMayContainTransientAttrs = false;
10308
+ this.submitTouchedUpdate(needsShapeAndBounds);
10309
+ this.onAttributeUpdate(context);
10310
+ }
10311
+ commitBaseAttributeBySingleKey(key, value, forceUpdateTag = false, context) {
10312
+ this.getBaseAttributesStorage()[key] = value;
10313
+ this.attribute = this.getBaseAttributesStorage();
10314
+ this._baseAttributes = undefined;
10315
+ this.valid = this.isValid();
10316
+ this.attributeMayContainTransientAttrs = false;
10317
+ this.submitTouchedUpdate(forceUpdateTag || this.needUpdateTag(key));
10318
+ this.onAttributeUpdate(context);
10319
+ }
11001
10320
  applyBaseAttributes(params) {
11002
10321
  const keys = Object.keys(params);
11003
10322
  for (let i = 0; i < keys.length; i++) {
11004
10323
  const key = keys[i];
11005
- this.baseAttributes[key] = cloneAttributeValue(params[key]);
10324
+ this.getBaseAttributesStorage()[key] = params[key];
10325
+ }
10326
+ }
10327
+ _commitAnimationStaticAttributes(params, context) {
10328
+ if (!params) {
10329
+ return;
11006
10330
  }
10331
+ const source = params;
10332
+ const baseAttributes = this.getBaseAttributesStorage();
10333
+ const target = this.attribute;
10334
+ const delta = new Map();
10335
+ let hasKeys = false;
10336
+ for (const key in source) {
10337
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
10338
+ continue;
10339
+ }
10340
+ hasKeys = true;
10341
+ const previousValue = target[key];
10342
+ const nextValue = source[key];
10343
+ baseAttributes[key] = nextValue;
10344
+ target[key] = nextValue;
10345
+ if (!areAttributeValuesEqual(previousValue, nextValue)) {
10346
+ delta.set(key, { prev: previousValue, next: nextValue });
10347
+ }
10348
+ }
10349
+ if (!hasKeys) {
10350
+ return;
10351
+ }
10352
+ this.valid = this.isValid();
10353
+ this.attributeMayContainTransientAttrs = true;
10354
+ this.submitUpdateByDelta(delta);
10355
+ this.onAttributeUpdate(context);
10356
+ }
10357
+ applyAnimationTransientAttributes(params, forceUpdateTag = false, context) {
10358
+ const source = params;
10359
+ let target;
10360
+ let needsShapeAndBounds = forceUpdateTag;
10361
+ for (const key in source) {
10362
+ if (!Object.prototype.hasOwnProperty.call(source, key)) {
10363
+ continue;
10364
+ }
10365
+ if (!target) {
10366
+ this.detachAttributeFromBaseAttributes();
10367
+ target = this.attribute;
10368
+ }
10369
+ target[key] = source[key];
10370
+ if (!needsShapeAndBounds && this.needUpdateTag(key)) {
10371
+ needsShapeAndBounds = true;
10372
+ }
10373
+ }
10374
+ if (!target) {
10375
+ return;
10376
+ }
10377
+ this.attributeMayContainTransientAttrs = true;
10378
+ this.valid = this.isValid();
10379
+ this.submitTouchedUpdate(needsShapeAndBounds);
10380
+ this.onAttributeUpdate(context);
11007
10381
  }
11008
10382
  applyTransientAttributes(params, forceUpdateTag = false, context) {
10383
+ this.detachAttributeFromBaseAttributes();
11009
10384
  const delta = new Map();
11010
10385
  const keys = Object.keys(params);
11011
10386
  for (let i = 0; i < keys.length; i++) {
11012
10387
  const key = keys[i];
11013
10388
  const previousValue = this.attribute[key];
11014
10389
  const nextValue = params[key];
11015
- if (isEqual(previousValue, nextValue)) {
10390
+ if (areAttributeValuesEqual(previousValue, nextValue)) {
11016
10391
  continue;
11017
10392
  }
11018
10393
  delta.set(key, { prev: previousValue, next: nextValue });
11019
- this.attribute[key] = cloneAttributeValue(nextValue);
10394
+ this.attribute[key] = nextValue;
10395
+ }
10396
+ if (delta.size) {
10397
+ this.attributeMayContainTransientAttrs = true;
11020
10398
  }
11021
10399
  this.valid = this.isValid();
11022
10400
  this.submitUpdateByDelta(delta, forceUpdateTag);
11023
10401
  this.onAttributeUpdate(context);
11024
10402
  }
11025
- _restoreAttributeFromStaticTruth(context) {
11026
- this._syncFinalAttributeFromStaticTruth();
11027
- const delta = this._syncAttribute();
10403
+ _restoreAttributeFromStaticTruth(context, excludedKeys) {
10404
+ this._syncFinalAttributeFromStaticTruth(excludedKeys);
10405
+ const delta = this._syncAttribute(excludedKeys);
11028
10406
  this.submitUpdateByDelta(delta);
11029
10407
  this.onAttributeUpdate(context);
11030
10408
  }
10409
+ collectStatePatchDeltaKeys(previousPatch, nextPatch) {
10410
+ const keys = previousPatch ? Object.keys(previousPatch) : [];
10411
+ if (!nextPatch) {
10412
+ return keys;
10413
+ }
10414
+ for (const key in nextPatch) {
10415
+ if (Object.prototype.hasOwnProperty.call(nextPatch, key) &&
10416
+ !Object.prototype.hasOwnProperty.call(previousPatch !== null && previousPatch !== void 0 ? previousPatch : {}, key)) {
10417
+ keys.push(key);
10418
+ }
10419
+ }
10420
+ return keys;
10421
+ }
10422
+ getStaticTruthValueForStateKey(key, nextPatch) {
10423
+ var _a;
10424
+ const baseAttributes = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {});
10425
+ const patch = nextPatch;
10426
+ if (patch && Object.prototype.hasOwnProperty.call(patch, key)) {
10427
+ const patchValue = patch[key];
10428
+ const baseValue = baseAttributes[key];
10429
+ if (this.stateMergeMode === 'deep' && isPlainObjectValue(baseValue) && isPlainObjectValue(patchValue)) {
10430
+ return {
10431
+ hasValue: true,
10432
+ value: deepMergeAttributeValue(baseValue, patchValue)
10433
+ };
10434
+ }
10435
+ return {
10436
+ hasValue: true,
10437
+ value: patchValue
10438
+ };
10439
+ }
10440
+ if (Object.prototype.hasOwnProperty.call(baseAttributes, key)) {
10441
+ return {
10442
+ hasValue: true,
10443
+ value: baseAttributes[key]
10444
+ };
10445
+ }
10446
+ return {
10447
+ hasValue: false,
10448
+ value: undefined
10449
+ };
10450
+ }
10451
+ syncStatePatchDeltaToTarget(target, keys, nextPatch, collectCategory = false) {
10452
+ let category = UpdateCategory.NONE;
10453
+ for (let i = 0; i < keys.length; i++) {
10454
+ const key = keys[i];
10455
+ const previousValue = target[key];
10456
+ const next = this.getStaticTruthValueForStateKey(key, nextPatch);
10457
+ if (!next.hasValue) {
10458
+ if (Object.prototype.hasOwnProperty.call(target, key)) {
10459
+ delete target[key];
10460
+ if (collectCategory) {
10461
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, undefined);
10462
+ }
10463
+ }
10464
+ continue;
10465
+ }
10466
+ if (areAttributeValuesEqual(previousValue, next.value)) {
10467
+ continue;
10468
+ }
10469
+ const nextValue = cloneAttributeValue(next.value);
10470
+ target[key] = nextValue;
10471
+ if (collectCategory) {
10472
+ category = this.mergeAttributeDeltaCategory(category, key, previousValue, nextValue);
10473
+ }
10474
+ }
10475
+ return category;
10476
+ }
10477
+ restoreAttributeFromStatePatchDelta(previousPatch, nextPatch, context) {
10478
+ this.detachAttributeFromBaseAttributes();
10479
+ const keys = this.collectStatePatchDeltaKeys(previousPatch, nextPatch);
10480
+ const finalAttribute = this.finalAttribute;
10481
+ if (finalAttribute) {
10482
+ this.syncStatePatchDeltaToTarget(finalAttribute, keys, nextPatch, false);
10483
+ }
10484
+ const category = this.syncStatePatchDeltaToTarget(this.attribute, keys, nextPatch, true);
10485
+ this.valid = this.isValid();
10486
+ this.attributeMayContainTransientAttrs = false;
10487
+ this.submitUpdateByCategory(category);
10488
+ this.onAttributeUpdate(context);
10489
+ }
11031
10490
  setMode(mode) {
11032
10491
  mode === '3d' ? this.set3dMode() : this.set2dMode();
11033
10492
  }
@@ -11052,6 +10511,7 @@ class Graphic extends Node {
11052
10511
  return point;
11053
10512
  }
11054
10513
  onAnimateBind(animate) {
10514
+ this.detachAttributeFromBaseAttributes();
11055
10515
  this._emitCustomEvent('animate-bind', animate);
11056
10516
  }
11057
10517
  visitTrackedAnimates(cb) {
@@ -11074,8 +10534,33 @@ class Graphic extends Node {
11074
10534
  }
11075
10535
  return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size);
11076
10536
  }
10537
+ mayHaveTrackedAnimates() {
10538
+ var _a;
10539
+ return !!((_a = this.animates) === null || _a === void 0 ? void 0 : _a.size) || !!this._animationStateManager;
10540
+ }
11077
10541
  tryUpdateAABBBounds() {
10542
+ if (!this.shadowRoot && !(this._updateTag & UpdateTag.UPDATE_BOUNDS)) {
10543
+ return this._AABBBounds;
10544
+ }
11078
10545
  const full = this.attribute.boundsMode === 'imprecise';
10546
+ if (!this.shadowRoot) {
10547
+ const graphicService = this.getGraphicService();
10548
+ const graphicTheme = this.getGraphicTheme();
10549
+ if (!graphicService.validCheck(this.attribute, graphicTheme, this._AABBBounds, this)) {
10550
+ return this._AABBBounds;
10551
+ }
10552
+ if (!this.valid) {
10553
+ this._AABBBounds.clear();
10554
+ return this._AABBBounds;
10555
+ }
10556
+ graphicService.beforeUpdateAABBBounds(this, this.stage, true, this._AABBBounds);
10557
+ const bounds = this.doUpdateAABBBounds(full, graphicTheme);
10558
+ graphicService.afterUpdateAABBBounds(this, this.stage, this._AABBBounds, this, true);
10559
+ if (this.attribute.boundsMode === 'empty') {
10560
+ bounds.clear();
10561
+ }
10562
+ return bounds;
10563
+ }
11079
10564
  if (!this.shouldUpdateAABBBounds()) {
11080
10565
  return this._AABBBounds;
11081
10566
  }
@@ -11192,13 +10677,13 @@ class Graphic extends Node {
11192
10677
  Graphic.userSymbolMap[symbolType] = _parsedPath;
11193
10678
  return _parsedPath;
11194
10679
  }
11195
- doUpdateAABBBounds(full) {
10680
+ doUpdateAABBBounds(full, graphicTheme) {
11196
10681
  this.updateAABBBoundsStamp++;
11197
- const graphicTheme = this.getGraphicTheme();
10682
+ const resolvedGraphicTheme = graphicTheme !== null && graphicTheme !== void 0 ? graphicTheme : this.getGraphicTheme();
11198
10683
  this._AABBBounds.clear();
11199
10684
  const attribute = this.attribute;
11200
- const bounds = this.updateAABBBounds(attribute, graphicTheme, this._AABBBounds, full);
11201
- const { boundsPadding = graphicTheme.boundsPadding } = attribute;
10685
+ const bounds = this.updateAABBBounds(attribute, resolvedGraphicTheme, this._AABBBounds, full);
10686
+ const { boundsPadding = resolvedGraphicTheme.boundsPadding } = attribute;
11202
10687
  const paddingArray = parsePadding(boundsPadding);
11203
10688
  if (paddingArray) {
11204
10689
  bounds.expand(paddingArray);
@@ -11290,34 +10775,135 @@ class Graphic extends Node {
11290
10775
  clearUpdateShapeTag() {
11291
10776
  this._updateTag &= UpdateTag.CLEAR_SHAPE;
11292
10777
  }
11293
- containsPoint(x, y, mode, picker) {
11294
- if (!picker) {
11295
- return false;
10778
+ containsPoint(x, y, mode, picker) {
10779
+ if (!picker) {
10780
+ return false;
10781
+ }
10782
+ if (mode === IContainPointMode.GLOBAL) {
10783
+ const point = new Point(x, y);
10784
+ if (this.parent) {
10785
+ this.parent.globalTransMatrix.transformPoint(point, point);
10786
+ }
10787
+ x = point.x;
10788
+ y = point.y;
10789
+ }
10790
+ return picker.containsPoint(this, { x, y });
10791
+ }
10792
+ setWidthHeightWithoutTransform(aabbBounds) {
10793
+ this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1;
10794
+ this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
10795
+ }
10796
+ setAttributesAndPreventAnimate(params, forceUpdateTag = false, context, ignorePriority) {
10797
+ if (!params) {
10798
+ return;
10799
+ }
10800
+ const keys = Object.keys(params);
10801
+ this.captureTransientFromAttrsBeforePreventAnimate(params, keys, context);
10802
+ this.syncFinalAttributesFromUpdateContext(context);
10803
+ this.visitTrackedAnimates(animate => {
10804
+ if (animate.priority === Infinity && !ignorePriority) {
10805
+ return;
10806
+ }
10807
+ animate.preventAttrs(keys);
10808
+ });
10809
+ this.applyTransientAttributes(params, forceUpdateTag, context);
10810
+ }
10811
+ syncFinalAttributesFromUpdateContext(context) {
10812
+ var _a;
10813
+ const updateType = context === null || context === void 0 ? void 0 : context.type;
10814
+ if (updateType === AttributeUpdateType.STATE ||
10815
+ (updateType != null &&
10816
+ updateType >= AttributeUpdateType.ANIMATE_BIND &&
10817
+ updateType <= AttributeUpdateType.ANIMATE_END)) {
10818
+ return;
10819
+ }
10820
+ const finalAttrs = (_a = this.context) === null || _a === void 0 ? void 0 : _a.finalAttrs;
10821
+ const setFinalAttributes = this.setFinalAttributes;
10822
+ if (finalAttrs && typeof setFinalAttributes === 'function') {
10823
+ setFinalAttributes.call(this, finalAttrs);
10824
+ }
10825
+ }
10826
+ captureTransientFromAttrsBeforePreventAnimate(params, keys, context) {
10827
+ var _a, _b;
10828
+ const graphicContext = this.context;
10829
+ const diffAttrs = (_a = graphicContext === null || graphicContext === void 0 ? void 0 : graphicContext.diffAttrs) !== null && _a !== void 0 ? _a : params;
10830
+ const updateType = context === null || context === void 0 ? void 0 : context.type;
10831
+ if (!keys.length ||
10832
+ !diffAttrs ||
10833
+ updateType === AttributeUpdateType.STATE ||
10834
+ (updateType != null &&
10835
+ updateType >= AttributeUpdateType.ANIMATE_BIND &&
10836
+ updateType <= AttributeUpdateType.ANIMATE_END)) {
10837
+ return;
10838
+ }
10839
+ const sameDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs === diffAttrs;
10840
+ let fromAttrs = sameDiffAttrs
10841
+ ? (_b = this.transientFromAttrsBeforePreventAnimate) !== null && _b !== void 0 ? _b : null
10842
+ : null;
10843
+ if (!sameDiffAttrs) {
10844
+ this.transientFromAttrsBeforePreventAnimate = null;
10845
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
10846
+ }
10847
+ let captured = false;
10848
+ for (let i = 0; i < keys.length; i++) {
10849
+ const key = keys[i];
10850
+ if (!Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
10851
+ continue;
10852
+ }
10853
+ const previousValue = this.attribute[key];
10854
+ const nextValue = params[key];
10855
+ if (isEqual(previousValue, nextValue)) {
10856
+ continue;
10857
+ }
10858
+ fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : (fromAttrs = {});
10859
+ fromAttrs[key] = cloneAttributeValue(previousValue);
10860
+ captured = true;
10861
+ }
10862
+ if (captured) {
10863
+ this.transientFromAttrsBeforePreventAnimate = fromAttrs;
10864
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = diffAttrs;
10865
+ }
10866
+ }
10867
+ consumeTransientFromAttrsBeforePreventAnimate(diffAttrs) {
10868
+ const transientFromAttrs = this.transientFromAttrsBeforePreventAnimate;
10869
+ const sourceDiffAttrs = this.transientFromAttrsBeforePreventAnimateDiffAttrs;
10870
+ if (!transientFromAttrs || !sourceDiffAttrs) {
10871
+ return null;
11296
10872
  }
11297
- if (mode === IContainPointMode.GLOBAL) {
11298
- const point = new Point(x, y);
11299
- if (this.parent) {
11300
- this.parent.globalTransMatrix.transformPoint(point, point);
10873
+ for (const key in diffAttrs) {
10874
+ if (Object.prototype.hasOwnProperty.call(diffAttrs, key) &&
10875
+ (!Object.prototype.hasOwnProperty.call(sourceDiffAttrs, key) || !isEqual(sourceDiffAttrs[key], diffAttrs[key]))) {
10876
+ return null;
11301
10877
  }
11302
- x = point.x;
11303
- y = point.y;
11304
10878
  }
11305
- return picker.containsPoint(this, { x, y });
11306
- }
11307
- setWidthHeightWithoutTransform(aabbBounds) {
11308
- this.widthWithoutTransform = aabbBounds.x2 - aabbBounds.x1;
11309
- this.heightWithoutTransform = aabbBounds.y2 - aabbBounds.y1;
11310
- }
11311
- setAttributesAndPreventAnimate(params, forceUpdateTag = false, context, ignorePriority) {
11312
- this.visitTrackedAnimates(animate => {
11313
- if (animate.priority === Infinity && !ignorePriority) {
11314
- return;
10879
+ let fromAttrs = null;
10880
+ let remaining = false;
10881
+ for (const key in transientFromAttrs) {
10882
+ if (!Object.prototype.hasOwnProperty.call(transientFromAttrs, key)) {
10883
+ continue;
11315
10884
  }
11316
- Object.keys(params).forEach(key => {
11317
- animate.preventAttr(key);
11318
- });
11319
- });
11320
- this.applyTransientAttributes(params, forceUpdateTag, context);
10885
+ if (Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
10886
+ fromAttrs !== null && fromAttrs !== void 0 ? fromAttrs : (fromAttrs = {});
10887
+ fromAttrs[key] = transientFromAttrs[key];
10888
+ continue;
10889
+ }
10890
+ remaining = true;
10891
+ }
10892
+ if (remaining) {
10893
+ const nextTransientFromAttrs = {};
10894
+ for (const key in transientFromAttrs) {
10895
+ if (Object.prototype.hasOwnProperty.call(transientFromAttrs, key) &&
10896
+ !Object.prototype.hasOwnProperty.call(diffAttrs, key)) {
10897
+ nextTransientFromAttrs[key] = transientFromAttrs[key];
10898
+ }
10899
+ }
10900
+ this.transientFromAttrsBeforePreventAnimate = nextTransientFromAttrs;
10901
+ }
10902
+ else {
10903
+ this.transientFromAttrsBeforePreventAnimate = null;
10904
+ this.transientFromAttrsBeforePreventAnimateDiffAttrs = null;
10905
+ }
10906
+ return fromAttrs;
11321
10907
  }
11322
10908
  setAttributes(params, forceUpdateTag = false, context) {
11323
10909
  if (!params) {
@@ -11328,7 +10914,7 @@ class Graphic extends Node {
11328
10914
  if (params.background) {
11329
10915
  this.loadImage(params.background, true);
11330
10916
  }
11331
- if (isExternalTexture(params.texture)) {
10917
+ if (params.texture && isExternalTexture(params.texture)) {
11332
10918
  this.loadImage(params.texture, false);
11333
10919
  }
11334
10920
  if (params.shadowGraphic) {
@@ -11337,14 +10923,25 @@ class Graphic extends Node {
11337
10923
  this._setAttributes(params, forceUpdateTag, context);
11338
10924
  }
11339
10925
  _setAttributes(params, forceUpdateTag = false, context) {
10926
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
10927
+ this.commitBaseAttributesByTouchedKeys(params, forceUpdateTag, context);
10928
+ return;
10929
+ }
10930
+ this.detachAttributeFromBaseAttributes();
11340
10931
  this.applyBaseAttributes(params);
11341
10932
  this.commitBaseAttributeMutation(forceUpdateTag, context);
11342
10933
  }
11343
10934
  setAttribute(key, value, forceUpdateTag, context) {
11344
10935
  const params = this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate({ [key]: value }, this.attribute, key, context);
11345
10936
  if (!params) {
11346
- this.applyBaseAttributes({ [key]: value });
11347
- this.commitBaseAttributeMutation(!!forceUpdateTag, context);
10937
+ if (this.canCommitBaseAttributesByTouchedKeys()) {
10938
+ this.commitBaseAttributeBySingleKey(key, value, !!forceUpdateTag, context);
10939
+ }
10940
+ else {
10941
+ const nextAttrs = { [key]: value };
10942
+ this.applyBaseAttributes(nextAttrs);
10943
+ this.commitBaseAttributeMutation(!!forceUpdateTag, context);
10944
+ }
11348
10945
  }
11349
10946
  else {
11350
10947
  this._setAttributes(params, forceUpdateTag, context);
@@ -11381,16 +10978,15 @@ class Graphic extends Node {
11381
10978
  const context = { type: AttributeUpdateType.INIT };
11382
10979
  params =
11383
10980
  (this.onBeforeAttributeUpdate && this.onBeforeAttributeUpdate(params, this.attribute, null, context)) || params;
11384
- this.baseAttributes = cloneAttributeValue(params);
11385
- if (!this.attribute) {
11386
- this.attribute = {};
11387
- }
10981
+ this.attribute = params;
10982
+ this._baseAttributes = undefined;
11388
10983
  this.resolvedStatePatch = undefined;
11389
- this._syncAttribute();
10984
+ this.attributeMayContainTransientAttrs = false;
10985
+ this.valid = this.isValid();
11390
10986
  if (params.background) {
11391
10987
  this.loadImage(params.background, true);
11392
10988
  }
11393
- if (isExternalTexture(params.texture)) {
10989
+ if (params.texture && isExternalTexture(params.texture)) {
11394
10990
  this.loadImage(params.texture, false);
11395
10991
  }
11396
10992
  if (params.shadowGraphic) {
@@ -11415,18 +11011,20 @@ class Graphic extends Node {
11415
11011
  y = params.y;
11416
11012
  delete params.x;
11417
11013
  delete params.y;
11418
- this.applyBaseAttributes(params);
11419
11014
  }
11420
11015
  const attribute = this.baseAttributes;
11421
11016
  const postMatrix = attribute.postMatrix;
11017
+ const nextAttrs = (params || {});
11422
11018
  if (!postMatrix) {
11423
- attribute.x = ((_a = attribute.x) !== null && _a !== void 0 ? _a : DefaultTransform.x) + x;
11424
- attribute.y = ((_b = attribute.y) !== null && _b !== void 0 ? _b : DefaultTransform.y) + y;
11019
+ nextAttrs.x = ((_a = attribute.x) !== null && _a !== void 0 ? _a : DefaultTransform.x) + x;
11020
+ nextAttrs.y = ((_b = attribute.y) !== null && _b !== void 0 ? _b : DefaultTransform.y) + y;
11425
11021
  }
11426
11022
  else {
11427
- application.transformUtil.fromMatrix(postMatrix, postMatrix).translate(x, y);
11023
+ const nextPostMatrix = postMatrix.clone();
11024
+ application.transformUtil.fromMatrix(nextPostMatrix, nextPostMatrix).translate(x, y);
11025
+ nextAttrs.postMatrix = nextPostMatrix;
11428
11026
  }
11429
- this.commitBaseAttributeMutation(false, context);
11027
+ this.commitInternalBaseAttributes(nextAttrs, context);
11430
11028
  return this;
11431
11029
  }
11432
11030
  translateTo(x, y) {
@@ -11440,13 +11038,10 @@ class Graphic extends Node {
11440
11038
  const params = this.onBeforeAttributeUpdate &&
11441
11039
  this.onBeforeAttributeUpdate({ x, y }, this.attribute, tempConstantXYKey, context);
11442
11040
  if (params) {
11443
- this.applyBaseAttributes(params);
11444
- this.commitBaseAttributeMutation(false, context);
11041
+ this.commitInternalBaseAttributes(params, context);
11445
11042
  return this;
11446
11043
  }
11447
- attribute.x = x;
11448
- attribute.y = y;
11449
- this.commitBaseAttributeMutation(false, context);
11044
+ this.commitInternalBaseAttributes({ x, y }, context);
11450
11045
  return this;
11451
11046
  }
11452
11047
  scale(scaleX, scaleY, scaleCenter) {
@@ -11464,22 +11059,25 @@ class Graphic extends Node {
11464
11059
  scaleY = params.scaleY;
11465
11060
  delete params.scaleX;
11466
11061
  delete params.scaleY;
11467
- this.applyBaseAttributes(params);
11468
11062
  }
11469
11063
  const attribute = this.baseAttributes;
11064
+ const nextAttrs = (params || {});
11470
11065
  if (!scaleCenter) {
11471
- attribute.scaleX = ((_a = attribute.scaleX) !== null && _a !== void 0 ? _a : DefaultTransform.scaleX) * scaleX;
11472
- attribute.scaleY = ((_b = attribute.scaleY) !== null && _b !== void 0 ? _b : DefaultTransform.scaleY) * scaleY;
11066
+ nextAttrs.scaleX = ((_a = attribute.scaleX) !== null && _a !== void 0 ? _a : DefaultTransform.scaleX) * scaleX;
11067
+ nextAttrs.scaleY = ((_b = attribute.scaleY) !== null && _b !== void 0 ? _b : DefaultTransform.scaleY) * scaleY;
11473
11068
  }
11474
11069
  else {
11475
- let { postMatrix } = this.attribute;
11070
+ let { postMatrix } = this.baseAttributes;
11476
11071
  if (!postMatrix) {
11477
11072
  postMatrix = new Matrix();
11478
- attribute.postMatrix = postMatrix;
11073
+ }
11074
+ else {
11075
+ postMatrix = postMatrix.clone();
11479
11076
  }
11480
11077
  application.transformUtil.fromMatrix(postMatrix, postMatrix).scale(scaleX, scaleY, scaleCenter);
11078
+ nextAttrs.postMatrix = postMatrix;
11481
11079
  }
11482
- this.commitBaseAttributeMutation(false, context);
11080
+ this.commitInternalBaseAttributes(nextAttrs, context);
11483
11081
  return this;
11484
11082
  }
11485
11083
  scaleTo(scaleX, scaleY) {
@@ -11493,13 +11091,10 @@ class Graphic extends Node {
11493
11091
  const params = this.onBeforeAttributeUpdate &&
11494
11092
  this.onBeforeAttributeUpdate({ scaleX, scaleY }, this.attribute, tempConstantScaleXYKey, context);
11495
11093
  if (params) {
11496
- this.applyBaseAttributes(params);
11497
- this.commitBaseAttributeMutation(false, context);
11094
+ this.commitInternalBaseAttributes(params, context);
11498
11095
  return this;
11499
11096
  }
11500
- attribute.scaleX = scaleX;
11501
- attribute.scaleY = scaleY;
11502
- this.commitBaseAttributeMutation(false, context);
11097
+ this.commitInternalBaseAttributes({ scaleX, scaleY }, context);
11503
11098
  return this;
11504
11099
  }
11505
11100
  rotate(angle, rotateCenter) {
@@ -11512,21 +11107,24 @@ class Graphic extends Node {
11512
11107
  this.onBeforeAttributeUpdate({ angle, rotateCenter }, this.attribute, tempConstantAngleKey, context);
11513
11108
  if (params) {
11514
11109
  delete params.angle;
11515
- this.applyBaseAttributes(params);
11516
11110
  }
11517
11111
  const attribute = this.baseAttributes;
11112
+ const nextAttrs = (params || {});
11518
11113
  if (!rotateCenter) {
11519
- attribute.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11114
+ nextAttrs.angle = ((_a = attribute.angle) !== null && _a !== void 0 ? _a : DefaultTransform.angle) + angle;
11520
11115
  }
11521
11116
  else {
11522
11117
  let { postMatrix } = this.baseAttributes;
11523
11118
  if (!postMatrix) {
11524
11119
  postMatrix = new Matrix();
11525
- this.baseAttributes.postMatrix = postMatrix;
11120
+ }
11121
+ else {
11122
+ postMatrix = postMatrix.clone();
11526
11123
  }
11527
11124
  application.transformUtil.fromMatrix(postMatrix, postMatrix).rotate(angle, rotateCenter);
11125
+ nextAttrs.postMatrix = postMatrix;
11528
11126
  }
11529
- this.commitBaseAttributeMutation(false, context);
11127
+ this.commitInternalBaseAttributes(nextAttrs, context);
11530
11128
  return this;
11531
11129
  }
11532
11130
  rotateTo(angle) {
@@ -11540,12 +11138,10 @@ class Graphic extends Node {
11540
11138
  const params = this.onBeforeAttributeUpdate &&
11541
11139
  this.onBeforeAttributeUpdate(angle, this.attribute, tempConstantAngleKey, context);
11542
11140
  if (params) {
11543
- this.applyBaseAttributes(params);
11544
- this.commitBaseAttributeMutation(false, context);
11141
+ this.commitInternalBaseAttributes(params, context);
11545
11142
  return this;
11546
11143
  }
11547
- attribute.angle = angle;
11548
- this.commitBaseAttributeMutation(false, context);
11144
+ this.commitInternalBaseAttributes({ angle }, context);
11549
11145
  return this;
11550
11146
  }
11551
11147
  skewTo(b, c) {
@@ -11581,41 +11177,216 @@ class Graphic extends Node {
11581
11177
  var _a;
11582
11178
  return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
11583
11179
  }
11584
- createStateModel() {
11585
- const { compiledDefinitions, stateProxyEligibility, stateProxyModeKey } = this.resolveEffectiveCompiledDefinitions();
11180
+ getStateResolveBaseAttrs() {
11181
+ var _a;
11182
+ return ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
11183
+ }
11184
+ syncStateResolveContext(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11185
+ var _a;
11186
+ (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.setResolveContext(this, stateResolveBaseAttrs);
11187
+ return stateResolveBaseAttrs;
11188
+ }
11189
+ ensureStateEngine(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11190
+ const { compiledDefinitions } = this.resolveEffectiveCompiledDefinitions();
11586
11191
  this.compiledStateDefinitions = compiledDefinitions;
11587
11192
  if (!compiledDefinitions) {
11588
11193
  this.stateEngine = undefined;
11589
11194
  this.stateEngineCompiledDefinitions = undefined;
11590
- this.stateEngineStateProxyModeKey = undefined;
11591
11195
  }
11592
11196
  else if (!this.stateEngine ||
11593
11197
  this.stateEngineCompiledDefinitions !== compiledDefinitions ||
11594
- this.stateEngineStateProxy !== this.stateProxy ||
11595
11198
  this.stateEngineStateSort !== this.stateSort ||
11596
- this.stateEngineMergeMode !== this.stateMergeMode ||
11597
- this.stateEngineStateProxyModeKey !== stateProxyModeKey) {
11199
+ this.stateEngineMergeMode !== this.stateMergeMode) {
11598
11200
  this.stateEngine = new StateEngine({
11599
11201
  compiledDefinitions,
11600
11202
  stateSort: this.stateSort,
11601
- stateProxy: this.stateProxy,
11602
- stateProxyEligibility,
11603
- states: this.states,
11604
11203
  mergeMode: this.stateMergeMode
11605
11204
  });
11606
11205
  this.stateEngineCompiledDefinitions = compiledDefinitions;
11607
- this.stateEngineStateProxy = this.stateProxy;
11608
11206
  this.stateEngineStateSort = this.stateSort;
11609
11207
  this.stateEngineMergeMode = this.stateMergeMode;
11610
- this.stateEngineStateProxyModeKey = stateProxyModeKey;
11611
- }
11612
- return new StateModel({
11613
- states: this.states,
11614
- currentStates: this.currentStates,
11615
- stateSort: this.stateSort,
11616
- stateProxy: this.stateProxy,
11617
- stateEngine: this.stateEngine
11618
- });
11208
+ }
11209
+ this.syncStateResolveContext(stateResolveBaseAttrs);
11210
+ if (this.stateEngine &&
11211
+ this.currentStates &&
11212
+ !this.sameStateNames(this.stateEngine.activeStates, this.currentStates)) {
11213
+ this.stateEngine.applyStates(this.currentStates);
11214
+ }
11215
+ return this.stateEngine;
11216
+ }
11217
+ toGraphicStateTransition(result) {
11218
+ return {
11219
+ changed: result.changed,
11220
+ states: [...result.activeStates],
11221
+ effectiveStates: [...result.effectiveStates]
11222
+ };
11223
+ }
11224
+ sortLocalStates(states) {
11225
+ return this.stateSort ? [...states].sort(this.stateSort) : [...states];
11226
+ }
11227
+ resolveLocalUseStatesTransition(states) {
11228
+ var _a;
11229
+ if (!states.length) {
11230
+ return this.resolveLocalClearStatesTransition();
11231
+ }
11232
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
11233
+ const changed = previousStates.length !== states.length || states.some((stateName, index) => previousStates[index] !== stateName);
11234
+ const nextStates = this.sortLocalStates(states);
11235
+ return {
11236
+ changed,
11237
+ states: changed ? nextStates : [...previousStates]
11238
+ };
11239
+ }
11240
+ resolveLocalClearStatesTransition() {
11241
+ return {
11242
+ changed: this.hasState(),
11243
+ states: []
11244
+ };
11245
+ }
11246
+ resolveUseStatesTransition(states, stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11247
+ const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
11248
+ return stateEngine
11249
+ ? this.toGraphicStateTransition(stateEngine.applyStates(states))
11250
+ : this.resolveLocalUseStatesTransition(states);
11251
+ }
11252
+ resolveClearStatesTransition() {
11253
+ const stateEngine = this.ensureStateEngine();
11254
+ return stateEngine
11255
+ ? this.toGraphicStateTransition(stateEngine.clearStates())
11256
+ : this.resolveLocalClearStatesTransition();
11257
+ }
11258
+ resolveAddStateTransition(stateName, keepCurrentStates) {
11259
+ var _a;
11260
+ const stateEngine = this.ensureStateEngine();
11261
+ if (stateEngine) {
11262
+ return this.toGraphicStateTransition(stateEngine.addState(stateName, keepCurrentStates));
11263
+ }
11264
+ if (this.currentStates &&
11265
+ this.currentStates.includes(stateName) &&
11266
+ (keepCurrentStates || this.currentStates.length === 1)) {
11267
+ return {
11268
+ changed: false,
11269
+ states: [...this.currentStates]
11270
+ };
11271
+ }
11272
+ const nextStates = keepCurrentStates && ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ? this.currentStates.concat([stateName]) : [stateName];
11273
+ return this.resolveLocalUseStatesTransition(nextStates);
11274
+ }
11275
+ resolveRemoveStateTransition(stateName) {
11276
+ const stateEngine = this.ensureStateEngine();
11277
+ if (stateEngine) {
11278
+ return this.toGraphicStateTransition(stateEngine.removeState(stateName));
11279
+ }
11280
+ if (!this.currentStates) {
11281
+ return {
11282
+ changed: false,
11283
+ states: []
11284
+ };
11285
+ }
11286
+ const filter = Array.isArray(stateName) ? (s) => !stateName.includes(s) : (s) => s !== stateName;
11287
+ const nextStates = this.currentStates.filter(filter);
11288
+ if (nextStates.length === this.currentStates.length) {
11289
+ return {
11290
+ changed: false,
11291
+ states: [...this.currentStates]
11292
+ };
11293
+ }
11294
+ return this.resolveLocalUseStatesTransition(nextStates);
11295
+ }
11296
+ resolveToggleStateTransition(stateName) {
11297
+ const stateEngine = this.ensureStateEngine();
11298
+ if (stateEngine) {
11299
+ return this.toGraphicStateTransition(stateEngine.toggleState(stateName));
11300
+ }
11301
+ if (this.hasState(stateName)) {
11302
+ return this.resolveRemoveStateTransition(stateName);
11303
+ }
11304
+ const nextStates = this.currentStates ? this.currentStates.slice() : [];
11305
+ nextStates.push(stateName);
11306
+ return this.resolveLocalUseStatesTransition(nextStates);
11307
+ }
11308
+ resolveGraphicStateTransition(states, forceResolverRefresh = false) {
11309
+ var _a;
11310
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
11311
+ const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
11312
+ if (forceResolverRefresh) {
11313
+ stateEngine === null || stateEngine === void 0 ? void 0 : stateEngine.invalidateResolverCache();
11314
+ }
11315
+ const transition = stateEngine
11316
+ ? this.toGraphicStateTransition(stateEngine.applyStates(states))
11317
+ : this.resolveLocalUseStatesTransition(states);
11318
+ const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
11319
+ const effectiveStates = (_a = transition.effectiveStates) !== null && _a !== void 0 ? _a : transition.states;
11320
+ return {
11321
+ transition,
11322
+ effectiveStates: effectiveStates,
11323
+ resolvedStateAttrs
11324
+ };
11325
+ }
11326
+ normalizeSetStatesOptions(options) {
11327
+ if (options && typeof options === 'object') {
11328
+ return {
11329
+ hasAnimation: options.animate,
11330
+ animateSameStatePatchChange: options.animateSameStatePatchChange === true,
11331
+ shouldRefreshSameStatePatch: true
11332
+ };
11333
+ }
11334
+ return {
11335
+ hasAnimation: typeof options === 'boolean' ? options : undefined,
11336
+ animateSameStatePatchChange: false,
11337
+ shouldRefreshSameStatePatch: false
11338
+ };
11339
+ }
11340
+ sameStatePatches(left, right) {
11341
+ const leftRecord = (left !== null && left !== void 0 ? left : {});
11342
+ const rightRecord = (right !== null && right !== void 0 ? right : {});
11343
+ const keys = new Set([...Object.keys(leftRecord), ...Object.keys(rightRecord)]);
11344
+ for (const key of keys) {
11345
+ const hasLeft = Object.prototype.hasOwnProperty.call(leftRecord, key);
11346
+ const hasRight = Object.prototype.hasOwnProperty.call(rightRecord, key);
11347
+ if (hasLeft !== hasRight) {
11348
+ return false;
11349
+ }
11350
+ if (!areAttributeValuesEqual(leftRecord[key], rightRecord[key])) {
11351
+ return false;
11352
+ }
11353
+ }
11354
+ return true;
11355
+ }
11356
+ commitSameStatePatchRefresh(states, hasAnimation, animateSameStatePatchChange = false) {
11357
+ var _a;
11358
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
11359
+ const previousResolvedStatePatch = this.resolvedStatePatch;
11360
+ const { transition, effectiveStates, resolvedStateAttrs } = this.resolveGraphicStateTransition(states, true);
11361
+ const patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
11362
+ if (patchChanged &&
11363
+ !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
11364
+ return;
11365
+ }
11366
+ this.currentStates = transition.states;
11367
+ this.effectiveStates = [...effectiveStates];
11368
+ this.resolvedStatePatch = resolvedStateAttrs;
11369
+ this.sharedStateDirty = false;
11370
+ this.syncSharedStateActiveRegistrations();
11371
+ if (!patchChanged) {
11372
+ return;
11373
+ }
11374
+ if (hasAnimation && animateSameStatePatchChange) {
11375
+ this._syncFinalAttributeFromStaticTruth();
11376
+ this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11377
+ }
11378
+ else {
11379
+ this.stopStateAnimates();
11380
+ if (this.attributeMayContainTransientAttrs) {
11381
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11382
+ }
11383
+ else {
11384
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
11385
+ type: AttributeUpdateType.STATE
11386
+ });
11387
+ }
11388
+ this.emitStateUpdateEvent();
11389
+ }
11619
11390
  }
11620
11391
  resolveStateAnimateConfig(animateConfig) {
11621
11392
  var _a, _b, _c;
@@ -11631,10 +11402,10 @@ class Graphic extends Node {
11631
11402
  }
11632
11403
  : undefined;
11633
11404
  if (isClear) {
11634
- this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
11405
+ this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
11635
11406
  return;
11636
11407
  }
11637
- const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
11408
+ const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
11638
11409
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
11639
11410
  animateConfig: resolvedAnimateConfig,
11640
11411
  extraAnimateAttrs: extraAnimateAttrs,
@@ -11642,8 +11413,7 @@ class Graphic extends Node {
11642
11413
  });
11643
11414
  this.getStateTransitionOrchestrator().applyTransition(this, plan, hasAnimation, transitionOptions);
11644
11415
  }
11645
- updateNormalAttrs(stateAttrs) {
11646
- this._deprecatedNormalAttrsView = cloneAttributeValue(this.baseAttributes);
11416
+ updateNormalAttrs(_stateAttrs) {
11647
11417
  }
11648
11418
  getStateTransitionDefaultAttribute(key, targetAttrs) {
11649
11419
  return this.getDefaultAttribute(key);
@@ -11657,6 +11427,9 @@ class Graphic extends Node {
11657
11427
  stopAnimationState.call(this, 'state', type);
11658
11428
  return;
11659
11429
  }
11430
+ if (!this.mayHaveTrackedAnimates()) {
11431
+ return;
11432
+ }
11660
11433
  const stateAnimates = [];
11661
11434
  this.visitTrackedAnimates(animate => {
11662
11435
  if (animate.stateNames) {
@@ -11665,21 +11438,11 @@ class Graphic extends Node {
11665
11438
  });
11666
11439
  stateAnimates.forEach(animate => animate.stop(type));
11667
11440
  }
11668
- getNormalAttribute(key) {
11669
- var _a, _b;
11670
- const value = this.attribute[key];
11671
- if (this.hasAnyTrackedAnimate()) {
11672
- return (_a = this.finalAttribute) === null || _a === void 0 ? void 0 : _a[key];
11673
- }
11674
- return value !== null && value !== void 0 ? value : (_b = this.finalAttribute) === null || _b === void 0 ? void 0 : _b[key];
11675
- }
11676
11441
  clearStates(hasAnimation) {
11677
11442
  var _a, _b, _c;
11678
- const previousStates = this.currentStates ? this.currentStates.slice() : [];
11679
- const previousResolvedStatePatch = this.resolvedStatePatch
11680
- ? cloneAttributeValue(this.resolvedStatePatch)
11681
- : undefined;
11682
- const transition = this.createStateModel().clearStates();
11443
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
11444
+ const previousResolvedStatePatch = this.resolvedStatePatch;
11445
+ const transition = this.resolveClearStatesTransition();
11683
11446
  if (!transition.changed && previousStates.length === 0) {
11684
11447
  this.currentStates = [];
11685
11448
  this.effectiveStates = [];
@@ -11688,7 +11451,9 @@ class Graphic extends Node {
11688
11451
  this.clearSharedStateActiveRegistrations();
11689
11452
  return;
11690
11453
  }
11691
- const resolvedStateAttrs = cloneAttributeValue(((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : {}));
11454
+ const resolvedStateAttrs = hasAnimation || this.hasCustomEvent('beforeStateUpdate')
11455
+ ? cloneAttributeValue(((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : {}))
11456
+ : ((_c = this.baseAttributes) !== null && _c !== void 0 ? _c : {});
11692
11457
  if (transition.changed &&
11693
11458
  !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, true)) {
11694
11459
  return;
@@ -11698,81 +11463,104 @@ class Graphic extends Node {
11698
11463
  this.resolvedStatePatch = undefined;
11699
11464
  this.sharedStateDirty = false;
11700
11465
  this.clearSharedStateActiveRegistrations();
11701
- (_b = getStageStatePerfMonitor(this.stage)) === null || _b === void 0 ? void 0 : _b.incrementCounter('stateCommits');
11702
- (_c = getStageStatePerfMonitor(this.stage)) === null || _c === void 0 ? void 0 : _c.recordEvent('state-commit', {
11703
- graphicId: this._uid,
11704
- targetStates: []
11705
- });
11706
11466
  if (hasAnimation) {
11707
11467
  this._syncFinalAttributeFromStaticTruth();
11708
11468
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, true, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11709
11469
  }
11710
11470
  else {
11711
11471
  this.stopStateAnimates();
11712
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11713
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
11472
+ if (this.attributeMayContainTransientAttrs) {
11473
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11474
+ }
11475
+ else {
11476
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, undefined, {
11477
+ type: AttributeUpdateType.STATE
11478
+ });
11479
+ }
11480
+ this.emitStateUpdateEvent();
11714
11481
  }
11715
11482
  }
11716
11483
  removeState(stateName, hasAnimation) {
11717
- const transition = this.createStateModel().removeState(stateName);
11484
+ const transition = this.resolveRemoveStateTransition(stateName);
11718
11485
  if (transition.changed) {
11719
11486
  this.useStates(transition.states, hasAnimation);
11720
11487
  }
11721
11488
  }
11722
11489
  toggleState(stateName, hasAnimation) {
11723
- const transition = this.createStateModel().toggleState(stateName);
11490
+ const transition = this.resolveToggleStateTransition(stateName);
11724
11491
  if (transition.changed) {
11725
11492
  this.useStates(transition.states, hasAnimation);
11726
11493
  }
11727
11494
  }
11728
11495
  addState(stateName, keepCurrentStates, hasAnimation) {
11729
- const transition = this.createStateModel().addState(stateName, keepCurrentStates);
11496
+ const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
11730
11497
  if (!transition.changed) {
11731
11498
  return;
11732
11499
  }
11733
11500
  this.useStates(transition.states, hasAnimation);
11734
11501
  }
11502
+ setStates(states, options) {
11503
+ var _a, _b, _c;
11504
+ const { hasAnimation, animateSameStatePatchChange, shouldRefreshSameStatePatch } = this.normalizeSetStatesOptions(options);
11505
+ const nextStates = (states === null || states === void 0 ? void 0 : states.length) ? states : EMPTY_STATE_NAMES;
11506
+ const hasCurrentState = !!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ||
11507
+ !!((_b = this.effectiveStates) === null || _b === void 0 ? void 0 : _b.length) ||
11508
+ !!this.resolvedStatePatch ||
11509
+ !!((_c = this.registeredActiveScopes) === null || _c === void 0 ? void 0 : _c.size);
11510
+ if (!nextStates.length) {
11511
+ if (!hasCurrentState && !this.sharedStateDirty) {
11512
+ return;
11513
+ }
11514
+ this.clearStates(hasAnimation);
11515
+ return;
11516
+ }
11517
+ if (this.sameStateNames(this.currentStates, nextStates)) {
11518
+ if (shouldRefreshSameStatePatch) {
11519
+ this.commitSameStatePatchRefresh(nextStates, hasAnimation, animateSameStatePatchChange);
11520
+ return;
11521
+ }
11522
+ if (this.sharedStateDirty) {
11523
+ this.refreshSharedStateBeforeRender();
11524
+ }
11525
+ return;
11526
+ }
11527
+ this.useStates(nextStates, hasAnimation);
11528
+ }
11735
11529
  useStates(states, hasAnimation) {
11736
- var _a, _b, _c, _d, _e;
11530
+ var _a;
11737
11531
  if (!states.length) {
11738
11532
  this.clearStates(hasAnimation);
11739
11533
  return;
11740
11534
  }
11741
- const previousStates = this.currentStates ? this.currentStates.slice() : [];
11742
- const previousResolvedStatePatch = this.resolvedStatePatch
11743
- ? cloneAttributeValue(this.resolvedStatePatch)
11744
- : undefined;
11745
- const stateResolveBaseAttrs = ((_a = this.baseAttributes) !== null && _a !== void 0 ? _a : this.attribute);
11746
- const stateModel = this.createStateModel();
11747
- (_b = this.stateEngine) === null || _b === void 0 ? void 0 : _b.setResolveContext(this, stateResolveBaseAttrs);
11748
- const transition = stateModel.useStates(states);
11535
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
11536
+ const previousResolvedStatePatch = this.resolvedStatePatch;
11537
+ const { transition, effectiveStates, resolvedStateAttrs } = this.resolveGraphicStateTransition(states);
11749
11538
  if (!transition.changed && this.sameStateNames(previousStates, transition.states)) {
11750
11539
  return;
11751
11540
  }
11752
- const effectiveStates = (_c = transition.effectiveStates) !== null && _c !== void 0 ? _c : transition.states;
11753
- const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
11754
- ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
11755
11541
  if (!this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
11756
11542
  return;
11757
11543
  }
11758
11544
  this.currentStates = transition.states;
11759
11545
  this.effectiveStates = [...effectiveStates];
11760
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
11546
+ this.resolvedStatePatch = resolvedStateAttrs;
11761
11547
  this.sharedStateDirty = false;
11762
11548
  this.syncSharedStateActiveRegistrations();
11763
- (_d = getStageStatePerfMonitor(this.stage)) === null || _d === void 0 ? void 0 : _d.incrementCounter('stateCommits');
11764
- (_e = getStageStatePerfMonitor(this.stage)) === null || _e === void 0 ? void 0 : _e.recordEvent('state-commit', {
11765
- graphicId: this._uid,
11766
- targetStates: [...transition.states]
11767
- });
11768
11549
  if (hasAnimation) {
11769
11550
  this._syncFinalAttributeFromStaticTruth();
11770
11551
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
11771
11552
  }
11772
11553
  else {
11773
11554
  this.stopStateAnimates();
11774
- this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11775
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
11555
+ if (this.attributeMayContainTransientAttrs) {
11556
+ this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11557
+ }
11558
+ else {
11559
+ this.restoreAttributeFromStatePatchDelta(previousResolvedStatePatch, this.resolvedStatePatch, {
11560
+ type: AttributeUpdateType.STATE
11561
+ });
11562
+ }
11563
+ this.emitStateUpdateEvent();
11776
11564
  }
11777
11565
  }
11778
11566
  invalidateResolver() {
@@ -11780,19 +11568,18 @@ class Graphic extends Node {
11780
11568
  if (!this.stateEngine || !((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) || !this.compiledStateDefinitions) {
11781
11569
  return;
11782
11570
  }
11783
- const stateResolveBaseAttrs = ((_b = this.baseAttributes) !== null && _b !== void 0 ? _b : this.attribute);
11784
- this.stateEngine.setResolveContext(this, stateResolveBaseAttrs);
11785
- this.resolverEpoch += 1;
11571
+ this.syncStateResolveContext();
11572
+ this.resolverEpoch = ((_b = this.resolverEpoch) !== null && _b !== void 0 ? _b : 0) + 1;
11786
11573
  this.stateEngine.invalidateResolverCache();
11787
11574
  const transition = this.stateEngine.applyStates(this.currentStates);
11788
11575
  const resolvedStateAttrs = Object.assign({}, this.stateEngine.resolvedPatch);
11789
11576
  this.effectiveStates = [...transition.effectiveStates];
11790
- this.resolvedStatePatch = Object.assign({}, resolvedStateAttrs);
11577
+ this.resolvedStatePatch = resolvedStateAttrs;
11791
11578
  this.sharedStateDirty = false;
11792
11579
  this.syncSharedStateActiveRegistrations();
11793
11580
  this.stopStateAnimates();
11794
11581
  this._restoreAttributeFromStaticTruth({ type: AttributeUpdateType.STATE });
11795
- this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
11582
+ this.emitStateUpdateEvent();
11796
11583
  }
11797
11584
  sameStateNames(left, right) {
11798
11585
  const normalizedLeft = left !== null && left !== void 0 ? left : [];
@@ -11831,6 +11618,20 @@ class Graphic extends Node {
11831
11618
  this.glyphHost.addUpdateBoundTag();
11832
11619
  }
11833
11620
  }
11621
+ addBroadUpdateTag() {
11622
+ this.shadowRoot && this.shadowRoot.addUpdateGlobalPositionTag();
11623
+ this._updateTag |=
11624
+ UpdateTag.UPDATE_SHAPE_AND_BOUNDS |
11625
+ UpdateTag.UPDATE_PAINT |
11626
+ UpdateTag.UPDATE_GLOBAL_LOCAL_MATRIX |
11627
+ UpdateTag.UPDATE_LAYOUT;
11628
+ if (this.parent) {
11629
+ this.parent.addChildUpdateBoundTag();
11630
+ }
11631
+ if (this.glyphHost) {
11632
+ this.glyphHost.addUpdateBoundTag();
11633
+ }
11634
+ }
11834
11635
  updateShapeAndBoundsTagSetted() {
11835
11636
  return (this._updateTag & UpdateTag.UPDATE_SHAPE_AND_BOUNDS) === UpdateTag.UPDATE_SHAPE_AND_BOUNDS;
11836
11637
  }
@@ -11935,17 +11736,22 @@ class Graphic extends Node {
11935
11736
  }
11936
11737
  }
11937
11738
  setStage(stage, layer) {
11938
- var _a, _b, _c, _d, _e, _f, _g, _h;
11739
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
11939
11740
  const graphicService = (_c = (_a = stage === null || stage === void 0 ? void 0 : stage.graphicService) !== null && _a !== void 0 ? _a : (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
11940
11741
  const previousStage = this.stage;
11941
11742
  if (this.stage !== stage || this.layer !== layer) {
11942
11743
  this.stage = stage;
11943
11744
  this.layer = layer;
11944
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
11745
+ if (((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
11746
+ this.boundSharedStateScope ||
11747
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
11748
+ this.sharedStateDirty) {
11749
+ this.syncSharedStateScopeBindingOnTreeChange(true);
11750
+ }
11945
11751
  this.setStageToShadowRoot(stage, layer);
11946
- if (this.hasAnyTrackedAnimate()) {
11947
- const previousTimeline = (_e = previousStage === null || previousStage === void 0 ? void 0 : previousStage.getTimeline) === null || _e === void 0 ? void 0 : _e.call(previousStage);
11948
- const nextTimeline = (_f = stage === null || stage === void 0 ? void 0 : stage.getTimeline) === null || _f === void 0 ? void 0 : _f.call(stage);
11752
+ if (this.mayHaveTrackedAnimates() && this.hasAnyTrackedAnimate()) {
11753
+ const previousTimeline = (_f = previousStage === null || previousStage === void 0 ? void 0 : previousStage.getTimeline) === null || _f === void 0 ? void 0 : _f.call(previousStage);
11754
+ const nextTimeline = (_g = stage === null || stage === void 0 ? void 0 : stage.getTimeline) === null || _g === void 0 ? void 0 : _g.call(stage);
11949
11755
  const detachedStageAnimates = [];
11950
11756
  this.visitTrackedAnimates(a => {
11951
11757
  const boundToPreviousStage = !!previousTimeline && a.timeline === previousTimeline;
@@ -11983,10 +11789,36 @@ class Graphic extends Node {
11983
11789
  }
11984
11790
  }
11985
11791
  this._onSetStage && this._onSetStage(this, stage, layer);
11986
- (_g = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _g === void 0 ? void 0 : _g.call(graphicService, this, stage);
11792
+ (_h = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _h === void 0 ? void 0 : _h.call(graphicService, this, stage);
11987
11793
  return;
11988
11794
  }
11989
- this.syncSharedStateScopeBindingFromTree(!!((_h = this.currentStates) === null || _h === void 0 ? void 0 : _h.length));
11795
+ if (((_j = this.currentStates) === null || _j === void 0 ? void 0 : _j.length) ||
11796
+ this.boundSharedStateScope ||
11797
+ ((_k = this.registeredActiveScopes) === null || _k === void 0 ? void 0 : _k.size) ||
11798
+ this.sharedStateDirty) {
11799
+ this.syncSharedStateScopeBindingOnTreeChange(true);
11800
+ }
11801
+ }
11802
+ detachStageForRelease() {
11803
+ var _a, _b, _c;
11804
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
11805
+ this.clearSharedStateActiveRegistrations();
11806
+ }
11807
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
11808
+ this.stopAnimates();
11809
+ }
11810
+ this.boundSharedStateScope = undefined;
11811
+ this.boundSharedStateRevision = undefined;
11812
+ this.compiledStateDefinitions = undefined;
11813
+ this.compiledStateDefinitionsCacheKey = undefined;
11814
+ this.stateEngine = undefined;
11815
+ this.stateEngineCompiledDefinitions = undefined;
11816
+ this.sharedStateDirty = false;
11817
+ this.stage = null;
11818
+ this.layer = null;
11819
+ if (this.shadowRoot) {
11820
+ (_c = (_b = this.shadowRoot).detachStageForRelease) === null || _c === void 0 ? void 0 : _c.call(_b);
11821
+ }
11990
11822
  }
11991
11823
  setStageToShadowRoot(stage, layer) {
11992
11824
  if (this.shadowRoot) {
@@ -12122,6 +11954,9 @@ class Graphic extends Node {
12122
11954
  cb && cb();
12123
11955
  }
12124
11956
  _stopAnimates() {
11957
+ if (!this.mayHaveTrackedAnimates()) {
11958
+ return;
11959
+ }
12125
11960
  const animates = [];
12126
11961
  this.visitTrackedAnimates(animate => {
12127
11962
  animates.push(animate);
@@ -12142,17 +11977,24 @@ class Graphic extends Node {
12142
11977
  }
12143
11978
  }
12144
11979
  release() {
12145
- var _a, _b, _c;
11980
+ var _a, _b, _c, _d;
12146
11981
  this.releaseStatus = 'released';
12147
- this.clearSharedStateActiveRegistrations();
12148
- this.stopAnimates();
12149
- const graphicService = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.graphicService) !== null && _b !== void 0 ? _b : application.graphicService;
12150
- (_c = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onRelease) === null || _c === void 0 ? void 0 : _c.call(graphicService, this);
11982
+ if ((_a = this.registeredActiveScopes) === null || _a === void 0 ? void 0 : _a.size) {
11983
+ this.clearSharedStateActiveRegistrations();
11984
+ }
11985
+ if (this.mayHaveTrackedAnimates() || this.shadowRoot) {
11986
+ this.stopAnimates();
11987
+ }
11988
+ const graphicService = (_c = (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
11989
+ (_d = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onRelease) === null || _d === void 0 ? void 0 : _d.call(graphicService, this);
12151
11990
  super.release();
12152
11991
  }
11992
+ hasCustomEvent(type) {
11993
+ return !!this._events && type in this._events;
11994
+ }
12153
11995
  _dispatchCustomEvent(type, context) {
12154
11996
  var _a, _b;
12155
- if (this._events && type in this._events) {
11997
+ if (this.hasCustomEvent(type)) {
12156
11998
  const changeEvent = new CustomEvent(type, context);
12157
11999
  changeEvent.bubbles = false;
12158
12000
  const manager = (_b = (_a = this.stage) === null || _a === void 0 ? void 0 : _a.eventSystem) === null || _b === void 0 ? void 0 : _b.manager;
@@ -12165,6 +12007,9 @@ class Graphic extends Node {
12165
12007
  return true;
12166
12008
  }
12167
12009
  beforeStateUpdate(attrs, prevStates, nextStates, hasAnimation, isClear) {
12010
+ if (!this.hasCustomEvent('beforeStateUpdate')) {
12011
+ return true;
12012
+ }
12168
12013
  return this._dispatchCustomEvent('beforeStateUpdate', {
12169
12014
  type: AttributeUpdateType.STATE,
12170
12015
  attrs: Object.assign({}, attrs),
@@ -12174,6 +12019,11 @@ class Graphic extends Node {
12174
12019
  isClear: !!isClear
12175
12020
  });
12176
12021
  }
12022
+ emitStateUpdateEvent() {
12023
+ if (this.hasCustomEvent('afterStateUpdate')) {
12024
+ this._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
12025
+ }
12026
+ }
12177
12027
  _emitCustomEvent(type, context) {
12178
12028
  this._dispatchCustomEvent(type, context);
12179
12029
  }
@@ -13951,23 +13801,15 @@ class Glyph extends Graphic {
13951
13801
  states = states.sort(this.stateSort);
13952
13802
  }
13953
13803
  const stateAttrs = {};
13954
- const subAttrs = this.subGraphic.map(() => ({}));
13955
13804
  states.forEach(stateName => {
13956
- var _a;
13957
13805
  const attrs = this.glyphStateProxy ? this.glyphStateProxy(stateName, states) : this.glyphStates[stateName];
13958
13806
  if (attrs) {
13959
13807
  Object.assign(stateAttrs, attrs.attributes);
13960
- if ((_a = attrs.subAttributes) === null || _a === void 0 ? void 0 : _a.length) {
13961
- subAttrs.forEach((subAttrs, index) => {
13962
- Object.assign(subAttrs, attrs.subAttributes[index]);
13963
- });
13964
- }
13965
13808
  }
13966
13809
  });
13967
13810
  if (!this.beforeStateUpdate(stateAttrs, previousStates, states, hasAnimation, false)) {
13968
13811
  return;
13969
13812
  }
13970
- this.updateNormalAttrs(stateAttrs);
13971
13813
  this.currentStates = states;
13972
13814
  this.applyStateAttrs(stateAttrs, states, hasAnimation);
13973
13815
  }
@@ -13984,7 +13826,6 @@ class Glyph extends Graphic {
13984
13826
  else {
13985
13827
  this.currentStates = [];
13986
13828
  }
13987
- this.normalAttrs = null;
13988
13829
  }
13989
13830
  clone() {
13990
13831
  const glyph = new Glyph(Object.assign({}, this.attribute));
@@ -16022,6 +15863,7 @@ const ARC_UPDATE_TAG_KEY = [
16022
15863
  'cornerRadius',
16023
15864
  'padAngle',
16024
15865
  'padRadius',
15866
+ 'clipRange',
16025
15867
  'cap',
16026
15868
  ...GRAPHIC_UPDATE_TAG_KEY
16027
15869
  ];
@@ -16074,12 +15916,13 @@ class Arc extends Graphic {
16074
15916
  getParsedAngle() {
16075
15917
  const arcTheme = this.getGraphicTheme();
16076
15918
  let { startAngle = arcTheme.startAngle, endAngle = arcTheme.endAngle } = this.attribute;
16077
- const { cap = arcTheme.cap } = this.attribute;
15919
+ const { cap = arcTheme.cap, clipRange = arcTheme.clipRange } = this.attribute;
16078
15920
  const sign = endAngle - startAngle >= 0 ? 1 : -1;
16079
- const deltaAngle = endAngle - startAngle;
15921
+ let deltaAngle = endAngle - startAngle;
15922
+ deltaAngle *= Math.max(0, Math.min(clipRange, 1));
16080
15923
  startAngle = clampAngleByRadian(startAngle);
16081
15924
  endAngle = startAngle + deltaAngle;
16082
- if (cap && abs(deltaAngle) < pi2 - epsilon) {
15925
+ if (cap && abs(deltaAngle) > epsilon && abs(deltaAngle) < pi2 - epsilon) {
16083
15926
  let startCap = 1;
16084
15927
  let endCap = 1;
16085
15928
  if (cap.length) {
@@ -16434,12 +16277,16 @@ class Group extends Graphic {
16434
16277
  if (this._sharedStateDefinitions === value) {
16435
16278
  return;
16436
16279
  }
16280
+ const previousScope = this.sharedStateScope;
16437
16281
  this._sharedStateDefinitions = value;
16438
16282
  this.ensureSharedStateScopeBound();
16439
16283
  if (this.sharedStateScope) {
16440
16284
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, value);
16441
16285
  markScopeActiveDescendantsDirty(this.sharedStateScope, this.stage);
16442
16286
  }
16287
+ if (previousScope !== this.sharedStateScope) {
16288
+ this.notifyChildrenSharedStateTreeChanged();
16289
+ }
16443
16290
  }
16444
16291
  setMode(mode) {
16445
16292
  mode === '3d' ? this.set3dMode() : this.set2dMode();
@@ -16576,13 +16423,7 @@ class Group extends Graphic {
16576
16423
  incrementalAppendChild(node) {
16577
16424
  const data = super.appendChild(node);
16578
16425
  if (data) {
16579
- if (this.stage &&
16580
- (data.stage !== this.stage || data.layer !== this.layer)) {
16581
- data.setStage(this.stage, this.layer);
16582
- }
16583
- else if (data.onParentSharedStateTreeChanged) {
16584
- data.onParentSharedStateTreeChanged(this.stage, this.layer);
16585
- }
16426
+ this.syncChildSharedStateTreeBinding(data);
16586
16427
  }
16587
16428
  this.addUpdateBoundTag();
16588
16429
  this.getGraphicService().onAddIncremental(node, this, this.stage);
@@ -16596,12 +16437,7 @@ class Group extends Graphic {
16596
16437
  }
16597
16438
  _updateChildToStage(child) {
16598
16439
  if (child) {
16599
- if (this.stage && (child.stage !== this.stage || child.layer !== this.layer)) {
16600
- child.setStage(this.stage, this.layer);
16601
- }
16602
- else if (child.onParentSharedStateTreeChanged) {
16603
- child.onParentSharedStateTreeChanged(this.stage, this.layer);
16604
- }
16440
+ this.syncChildSharedStateTreeBinding(child);
16605
16441
  }
16606
16442
  this.addUpdateBoundTag();
16607
16443
  return child;
@@ -16609,13 +16445,8 @@ class Group extends Graphic {
16609
16445
  appendChild(node, addStage = true) {
16610
16446
  const data = super.appendChild(node);
16611
16447
  if (data) {
16612
- if (addStage &&
16613
- this.stage &&
16614
- (data.stage !== this.stage || data.layer !== this.layer)) {
16615
- data.setStage(this.stage, this.layer);
16616
- }
16617
- else if (data.onParentSharedStateTreeChanged) {
16618
- data.onParentSharedStateTreeChanged(this.stage, this.layer);
16448
+ if (addStage) {
16449
+ this.syncChildSharedStateTreeBinding(data);
16619
16450
  }
16620
16451
  }
16621
16452
  this.addUpdateBoundTag();
@@ -16630,8 +16461,15 @@ class Group extends Graphic {
16630
16461
  insertInto(newNode, idx) {
16631
16462
  return this._updateChildToStage(super.insertInto(newNode, idx));
16632
16463
  }
16633
- removeChild(child) {
16464
+ removeChild(child, highPerformance = false) {
16634
16465
  const data = super.removeChild(child);
16466
+ if (!data) {
16467
+ return data;
16468
+ }
16469
+ if (highPerformance) {
16470
+ child.detachStageForRelease();
16471
+ return data;
16472
+ }
16635
16473
  this.getGraphicService().onRemove(child);
16636
16474
  child.setStage(null, null);
16637
16475
  this.addUpdateBoundTag();
@@ -16654,29 +16492,37 @@ class Group extends Graphic {
16654
16492
  setStage(stage, layer) {
16655
16493
  var _a, _b, _c, _d, _e, _f;
16656
16494
  const graphicService = (_c = (_a = stage === null || stage === void 0 ? void 0 : stage.graphicService) !== null && _a !== void 0 ? _a : (_b = this.stage) === null || _b === void 0 ? void 0 : _b.graphicService) !== null && _c !== void 0 ? _c : application.graphicService;
16495
+ const needsSharedStateTreeSync = this.hasSharedStateDefinitions() ||
16496
+ this.sharedStateScope ||
16497
+ ((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
16498
+ this.boundSharedStateScope ||
16499
+ ((_e = this.registeredActiveScopes) === null || _e === void 0 ? void 0 : _e.size) ||
16500
+ this.sharedStateDirty;
16657
16501
  if (this.stage !== stage) {
16658
16502
  this.stage = stage;
16659
16503
  this.layer = layer;
16660
- this.ensureSharedStateScopeBound();
16661
- this.syncSharedStateScopeBindingFromTree(!!((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length));
16504
+ if (needsSharedStateTreeSync) {
16505
+ this.ensureSharedStateScopeBound();
16506
+ this.syncSharedStateScopeBindingOnTreeChange(true);
16507
+ }
16662
16508
  this.setStageToShadowRoot(stage, layer);
16663
16509
  this._onSetStage && this._onSetStage(this, stage, layer);
16664
- (_e = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _e === void 0 ? void 0 : _e.call(graphicService, this, stage);
16665
- this.forEachChildren(item => {
16666
- item.setStage(stage, this.layer);
16667
- });
16510
+ (_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
16511
+ this.notifyChildrenSharedStateTreeChanged();
16668
16512
  return;
16669
16513
  }
16670
- if (this.layer !== layer) {
16514
+ const layerChanged = this.layer !== layer;
16515
+ if (layerChanged) {
16671
16516
  this.layer = layer;
16672
16517
  }
16673
- this.ensureSharedStateScopeBound();
16674
- this.syncSharedStateScopeBindingFromTree(!!((_f = this.currentStates) === null || _f === void 0 ? void 0 : _f.length));
16675
- this.forEachChildren(item => {
16676
- if (item.onParentSharedStateTreeChanged) {
16677
- item.onParentSharedStateTreeChanged(stage, this.layer);
16678
- }
16679
- });
16518
+ if (needsSharedStateTreeSync) {
16519
+ this.ensureSharedStateScopeBound();
16520
+ this.syncSharedStateScopeBindingOnTreeChange(true);
16521
+ this.notifyChildrenSharedStateTreeChanged();
16522
+ }
16523
+ else if (layerChanged) {
16524
+ this.notifyChildrenSharedStateTreeChanged();
16525
+ }
16680
16526
  }
16681
16527
  addUpdatePositionTag() {
16682
16528
  super.addUpdatePositionTag();
@@ -16743,32 +16589,50 @@ class Group extends Graphic {
16743
16589
  }
16744
16590
  super.release();
16745
16591
  }
16592
+ detachStageForRelease() {
16593
+ super.detachStageForRelease();
16594
+ this.sharedStateScope = undefined;
16595
+ this.forEachChildren((item) => {
16596
+ item.detachStageForRelease();
16597
+ });
16598
+ }
16746
16599
  ensureSharedStateScopeBound() {
16747
16600
  var _a, _b, _c;
16601
+ if (!this.hasSharedStateDefinitions()) {
16602
+ this.sharedStateScope = undefined;
16603
+ return;
16604
+ }
16748
16605
  const parentScope = (_b = (_a = this.parent) === null || _a === void 0 ? void 0 : _a.sharedStateScope) !== null && _b !== void 0 ? _b : (_c = this.stage) === null || _c === void 0 ? void 0 : _c.rootSharedStateScope;
16749
16606
  if (!this.sharedStateScope) {
16750
16607
  this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
16751
16608
  return;
16752
16609
  }
16753
- this.sharedStateScope.ownerGroup = this;
16754
16610
  this.sharedStateScope.ownerStage = this.stage;
16755
16611
  setSharedStateScopeParent(this.sharedStateScope, parentScope);
16756
16612
  if (this.sharedStateScope.localStateDefinitions !== this._sharedStateDefinitions) {
16757
16613
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, this._sharedStateDefinitions);
16758
16614
  }
16759
16615
  }
16616
+ hasSharedStateDefinitions() {
16617
+ return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
16618
+ }
16619
+ notifyChildrenSharedStateTreeChanged() {
16620
+ this.forEachChildren(item => {
16621
+ this.syncChildSharedStateTreeBinding(item);
16622
+ });
16623
+ }
16624
+ syncChildSharedStateTreeBinding(child) {
16625
+ child.onParentSharedStateTreeChanged(this.stage, this.layer);
16626
+ }
16760
16627
  onParentSharedStateTreeChanged(stage, layer) {
16628
+ var _a;
16761
16629
  if (this.stage !== stage || this.layer !== layer) {
16762
16630
  this.setStage(stage, layer);
16763
16631
  return;
16764
16632
  }
16765
- this.ensureSharedStateScopeBound();
16766
- this.syncSharedStateScopeBindingFromTree();
16767
- this.forEachChildren(item => {
16768
- if (item.onParentSharedStateTreeChanged) {
16769
- item.onParentSharedStateTreeChanged(stage, this.layer);
16770
- }
16771
- });
16633
+ this.ensureSharedStateScopeBound();
16634
+ this.syncSharedStateScopeBindingOnTreeChange(!!((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length));
16635
+ this.notifyChildrenSharedStateTreeChanged();
16772
16636
  }
16773
16637
  }
16774
16638
  Group.NOWORK_ANIMATE_ATTR = NOWORK_ANIMATE_ATTR;
@@ -17210,6 +17074,10 @@ class DefaultGraphicService {
17210
17074
  };
17211
17075
  this.tempAABBBounds1 = new AABBBounds();
17212
17076
  this.tempAABBBounds2 = new AABBBounds();
17077
+ this.tempAABBBoundsResult = {
17078
+ tb1: this.tempAABBBounds1,
17079
+ tb2: this.tempAABBBounds2
17080
+ };
17213
17081
  }
17214
17082
  onAttributeUpdate(graphic) {
17215
17083
  if (this.hooks.onAttributeUpdate.taps.length) {
@@ -17256,15 +17124,6 @@ class DefaultGraphicService {
17256
17124
  this.hooks.clearAABBBounds.call(graphic, stage, b);
17257
17125
  }
17258
17126
  }
17259
- updatePathProxyAABBBounds(aabbBounds, graphic) {
17260
- const path = typeof graphic.pathProxy === 'function' ? graphic.pathProxy(graphic.attribute) : graphic.pathProxy;
17261
- if (!path) {
17262
- return false;
17263
- }
17264
- const boundsContext = new BoundsContext(aabbBounds);
17265
- renderCommandList(path.commandList, boundsContext, 0, 0);
17266
- return true;
17267
- }
17268
17127
  updateHTMLTextAABBBounds(attribute, textTheme, aabbBounds, graphic) {
17269
17128
  const { textAlign, textBaseline } = attribute;
17270
17129
  if (attribute.forceBoundsHeight != null) {
@@ -17340,7 +17199,7 @@ class DefaultGraphicService {
17340
17199
  const tb2 = this.tempAABBBounds2;
17341
17200
  tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17342
17201
  tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2);
17343
- return { tb1, tb2 };
17202
+ return this.tempAABBBoundsResult;
17344
17203
  }
17345
17204
  }
17346
17205
 
@@ -18856,10 +18715,9 @@ class RendererRegistry {
18856
18715
  this.entries.set(key, renderer);
18857
18716
  this.cache.delete(key);
18858
18717
  }
18859
- registerMany(entries) {
18860
- for (const [key, renderer] of entries) {
18861
- this.register(key, renderer);
18862
- }
18718
+ unregister(key) {
18719
+ this.entries.delete(key);
18720
+ this.cache.delete(key);
18863
18721
  }
18864
18722
  get(key) {
18865
18723
  if (this.cache.has(key)) {
@@ -18891,10 +18749,8 @@ class PickerRegistry {
18891
18749
  register(key, picker) {
18892
18750
  this.entries.set(key, picker);
18893
18751
  }
18894
- registerMany(entries) {
18895
- for (const [key, picker] of entries) {
18896
- this.register(key, picker);
18897
- }
18752
+ unregister(key) {
18753
+ this.entries.delete(key);
18898
18754
  }
18899
18755
  get(key) {
18900
18756
  return this.entries.get(key);
@@ -18938,9 +18794,21 @@ class ContributionRegistry {
18938
18794
  current.push(contribution);
18939
18795
  this.entries.set(key, current);
18940
18796
  }
18941
- registerMany(entries) {
18942
- for (const [key, contribution] of entries) {
18943
- this.register(key, contribution);
18797
+ unregister(key, contribution) {
18798
+ if (contribution === undefined) {
18799
+ this.entries.delete(key);
18800
+ return;
18801
+ }
18802
+ const current = this.entries.get(key);
18803
+ if (!current) {
18804
+ return;
18805
+ }
18806
+ const next = current.filter(entry => entry !== contribution);
18807
+ if (next.length) {
18808
+ this.entries.set(key, next);
18809
+ }
18810
+ else {
18811
+ this.entries.delete(key);
18944
18812
  }
18945
18813
  }
18946
18814
  get(key) {
@@ -18967,13 +18835,12 @@ const EMPTY_AUTO_ENABLE_PROVIDER = {
18967
18835
  };
18968
18836
  class DefaultPluginService {
18969
18837
  constructor(autoEnablePlugins = EMPTY_AUTO_ENABLE_PROVIDER, deps = {}) {
18970
- var _a, _b, _c;
18838
+ var _a;
18971
18839
  this.autoEnablePlugins = autoEnablePlugins;
18972
18840
  this.onStartupFinishedPlugin = [];
18973
18841
  this.onRegisterPlugin = [];
18974
18842
  this.actived = false;
18975
18843
  this.pluginRegistry = (_a = deps.pluginRegistry) !== null && _a !== void 0 ? _a : new PluginRegistry();
18976
- this.autoEnablePlugins = (_c = (_b = deps.autoEnablePlugins) !== null && _b !== void 0 ? _b : this.autoEnablePlugins) !== null && _c !== void 0 ? _c : EMPTY_AUTO_ENABLE_PROVIDER;
18977
18844
  }
18978
18845
  active(stage, params) {
18979
18846
  this.stage = stage;
@@ -19243,8 +19110,9 @@ class DirtyBoundsPlugin {
19243
19110
  this.activeEvent = 'onRegister';
19244
19111
  this._uid = Generator.GenAutoIncrementId();
19245
19112
  this.key = this.name + this._uid;
19113
+ this.dirtyBoundsHooksRegistered = false;
19246
19114
  this.handlePaintOnlyUpdate = (graphic) => {
19247
- var _a, _b, _c, _d;
19115
+ var _a;
19248
19116
  const stage = this.pluginService.stage;
19249
19117
  if (!(stage && stage === graphic.stage && stage.renderCount)) {
19250
19118
  return;
@@ -19257,7 +19125,7 @@ class DirtyBoundsPlugin {
19257
19125
  if (ownerBounds && !ownerBounds.empty()) {
19258
19126
  stage.dirty(ownerBounds);
19259
19127
  }
19260
- (_b = owner.clearUpdatePaintTag) === null || _b === void 0 ? void 0 : _b.call(owner);
19128
+ owner.clearUpdatePaintTag();
19261
19129
  const shadowRoot = owner.shadowRoot;
19262
19130
  if (!shadowRoot) {
19263
19131
  return;
@@ -19266,34 +19134,30 @@ class DirtyBoundsPlugin {
19266
19134
  if (shadowBounds && !shadowBounds.empty()) {
19267
19135
  stage.dirty(shadowBounds);
19268
19136
  }
19269
- (_d = (_c = shadowRoot).clearUpdatePaintTag) === null || _d === void 0 ? void 0 : _d.call(_c);
19137
+ shadowRoot.clearUpdatePaintTag();
19270
19138
  };
19271
19139
  }
19272
19140
  ensurePaintDirtyBoundsCache(graphic) {
19273
- var _a, _b;
19141
+ var _a;
19274
19142
  const owner = graphic;
19275
- const hasLocalBounds = owner._AABBBounds && typeof owner._AABBBounds.empty === 'function' && !owner._AABBBounds.empty();
19276
- if (!hasLocalBounds && typeof owner.doUpdateAABBBounds === 'function') {
19143
+ if (owner._AABBBounds.empty()) {
19277
19144
  owner.doUpdateAABBBounds(((_a = owner.attribute) === null || _a === void 0 ? void 0 : _a.boundsMode) === 'imprecise');
19278
19145
  }
19279
- const hasGlobalBounds = owner._globalAABBBounds &&
19280
- typeof owner._globalAABBBounds.empty === 'function' &&
19281
- !owner._globalAABBBounds.empty();
19282
- if (!hasGlobalBounds && typeof owner.tryUpdateGlobalAABBBounds === 'function') {
19146
+ if (!owner._globalAABBBounds || owner._globalAABBBounds.empty()) {
19283
19147
  owner.tryUpdateGlobalAABBBounds();
19284
19148
  }
19285
- return (_b = owner._globalAABBBounds) !== null && _b !== void 0 ? _b : owner.globalAABBBounds;
19149
+ return owner._globalAABBBounds;
19286
19150
  }
19287
- activate(context) {
19288
- this.pluginService = context;
19289
- context.stage.hooks.afterRender.tap(this.key, stage => {
19290
- if (!(stage && stage === this.pluginService.stage)) {
19291
- return;
19292
- }
19293
- stage.dirtyBounds.clear();
19294
- });
19295
- const stage = this.pluginService.stage;
19296
- if (!stage) {
19151
+ getRemoveDirtyBounds(graphic) {
19152
+ var _a;
19153
+ const owner = ((_a = graphic.glyphHost) !== null && _a !== void 0 ? _a : graphic);
19154
+ const cachedBounds = owner._globalAABBBounds;
19155
+ if (cachedBounds && !cachedBounds.empty()) {
19156
+ return cachedBounds;
19157
+ }
19158
+ }
19159
+ registerDirtyBoundsHooks(stage) {
19160
+ if (this.dirtyBoundsHooksRegistered) {
19297
19161
  return;
19298
19162
  }
19299
19163
  stage.graphicService.hooks.onAttributeUpdate.tap(this.key, this.handlePaintOnlyUpdate);
@@ -19334,10 +19198,29 @@ class DirtyBoundsPlugin {
19334
19198
  if (!(stage && stage === this.pluginService.stage && stage.renderCount)) {
19335
19199
  return;
19336
19200
  }
19337
- if (stage) {
19338
- stage.dirty(graphic.globalAABBBounds);
19201
+ const bounds = this.getRemoveDirtyBounds(graphic);
19202
+ if (bounds && !bounds.empty()) {
19203
+ stage.dirty(bounds);
19204
+ }
19205
+ });
19206
+ this.dirtyBoundsHooksRegistered = true;
19207
+ }
19208
+ activate(context) {
19209
+ this.pluginService = context;
19210
+ context.stage.hooks.afterRender.tap(this.key, stage => {
19211
+ if (!(stage && stage === this.pluginService.stage)) {
19212
+ return;
19339
19213
  }
19214
+ stage.dirtyBounds.clear();
19215
+ this.registerDirtyBoundsHooks(stage);
19340
19216
  });
19217
+ const stage = this.pluginService.stage;
19218
+ if (!stage) {
19219
+ return;
19220
+ }
19221
+ if (stage.renderCount) {
19222
+ this.registerDirtyBoundsHooks(stage);
19223
+ }
19341
19224
  }
19342
19225
  deactivate(context) {
19343
19226
  const stage = this.pluginService.stage;
@@ -19347,6 +19230,7 @@ class DirtyBoundsPlugin {
19347
19230
  stage.graphicService.hooks.onAttributeUpdate.taps = stage.graphicService.hooks.onAttributeUpdate.taps.filter(item => {
19348
19231
  return item.name !== this.key;
19349
19232
  });
19233
+ this.dirtyBoundsHooksRegistered = false;
19350
19234
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps =
19351
19235
  stage.graphicService.hooks.beforeUpdateAABBBounds.taps.filter(item => {
19352
19236
  return item.name !== this.key;
@@ -19404,387 +19288,6 @@ function getCurrentEnv() {
19404
19288
  return isBrowserEnv() ? 'browser' : 'node';
19405
19289
  }
19406
19290
 
19407
- function isRenderableGraphic(graphic) {
19408
- return !!graphic.stage && graphic.releaseStatus !== 'released';
19409
- }
19410
- function createTargetStatesKey(targetStates) {
19411
- return targetStates.length ? targetStates.join('|') : '__clear__';
19412
- }
19413
- function createIntentKey(contextOwnerId, configFingerprint, targetStatesKey) {
19414
- return `${contextOwnerId}:${configFingerprint}:${targetStatesKey}`;
19415
- }
19416
- function hasMeaningfulDeferredConfig(config) {
19417
- const normalized = normalizeDeferredStateOwnerConfig(config);
19418
- return !!normalized && (normalized.localEnabled != null || normalized.deferred != null);
19419
- }
19420
- function getGraphicCompiledDefinitions(graphic) {
19421
- const graphicAny = graphic;
19422
- if (typeof graphicAny.resolveEffectiveCompiledDefinitions === 'function') {
19423
- const result = graphicAny.resolveEffectiveCompiledDefinitions();
19424
- return {
19425
- compiledDefinitions: result.compiledDefinitions,
19426
- stateProxyEligibility: result.stateProxyEligibility
19427
- };
19428
- }
19429
- return {};
19430
- }
19431
- function getCurrentStateNames(graphic) {
19432
- var _a, _b;
19433
- return (_b = (_a = graphic.currentStates) === null || _a === void 0 ? void 0 : _a.slice()) !== null && _b !== void 0 ? _b : [];
19434
- }
19435
- class StateBatchScheduler {
19436
- constructor(stage, perfMonitor) {
19437
- this.stage = stage;
19438
- this.perfMonitor = perfMonitor;
19439
- this.jobsByIntentKey = new Map();
19440
- this.pendingIntentByGraphic = new Map();
19441
- this.nextJobId = 1;
19442
- this.runningJobs = new Map();
19443
- }
19444
- schedule(graphics, targetStates) {
19445
- const batchOperation = graphics.length > 1;
19446
- graphics.forEach(graphic => {
19447
- const eligibility = this.resolveEligibility(graphic, targetStates, batchOperation, true);
19448
- if ('reason' in eligibility) {
19449
- this.removeGraphicFromPending(graphic);
19450
- if (eligibility.reason !== 'graphic_unavailable') {
19451
- this.commitSynchronously(graphic, targetStates);
19452
- }
19453
- return;
19454
- }
19455
- this.enqueueDeferredIntent(graphic, targetStates, eligibility.context, eligibility.targetStatesKey);
19456
- });
19457
- }
19458
- release() {
19459
- var _a;
19460
- this.jobsByIntentKey.forEach(job => {
19461
- job.status = 'cancelled';
19462
- });
19463
- this.jobsByIntentKey.clear();
19464
- this.pendingIntentByGraphic.clear();
19465
- this.runningJobs.clear();
19466
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.updateBatchPending(0);
19467
- }
19468
- resolveEligibility(graphic, targetStates, batchOperation, recordObservability) {
19469
- var _a, _b, _c, _d, _e, _f;
19470
- if (!isRenderableGraphic(graphic)) {
19471
- if (recordObservability) {
19472
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.recordDeferredIneligible('graphic_unavailable');
19473
- }
19474
- return { eligible: false, reason: 'graphic_unavailable' };
19475
- }
19476
- if (!batchOperation) {
19477
- if (recordObservability) {
19478
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.recordDeferredIneligible('non_batch_operation');
19479
- }
19480
- return { eligible: false, reason: 'non_batch_operation' };
19481
- }
19482
- const context = this.resolveDeferredContext(graphic);
19483
- if (!context) {
19484
- if (recordObservability) {
19485
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.recordDeferredIneligible('graphic_unavailable');
19486
- }
19487
- return { eligible: false, reason: 'graphic_unavailable' };
19488
- }
19489
- if (!context.config.enabled) {
19490
- const normalizedOwnerConfig = normalizeDeferredStateOwnerConfig(context.contextOwner.deferredStateConfig);
19491
- const reason = (normalizedOwnerConfig === null || normalizedOwnerConfig === void 0 ? void 0 : normalizedOwnerConfig.localEnabled) === false ? 'context_disabled' : 'config_disabled';
19492
- if (recordObservability) {
19493
- (_d = this.perfMonitor) === null || _d === void 0 ? void 0 : _d.recordDeferredIneligible(reason);
19494
- }
19495
- return { eligible: false, reason };
19496
- }
19497
- const classification = this.classifyGraphicTargetStates(graphic, targetStates);
19498
- if (classification.reason) {
19499
- if (recordObservability) {
19500
- (_e = this.perfMonitor) === null || _e === void 0 ? void 0 : _e.recordDeferredIneligible(classification.reason);
19501
- }
19502
- return { eligible: false, reason: classification.reason };
19503
- }
19504
- if (classification.category !== UpdateCategory.PAINT) {
19505
- if (recordObservability) {
19506
- (_f = this.perfMonitor) === null || _f === void 0 ? void 0 : _f.recordDeferredIneligible('mixed_update_category');
19507
- }
19508
- return { eligible: false, reason: 'mixed_update_category' };
19509
- }
19510
- return {
19511
- eligible: true,
19512
- context,
19513
- targetStatesKey: createTargetStatesKey(targetStates)
19514
- };
19515
- }
19516
- resolveDeferredContext(graphic) {
19517
- var _a;
19518
- const stage = graphic.stage;
19519
- if (!stage) {
19520
- return undefined;
19521
- }
19522
- let owner = stage;
19523
- let config = normalizeDeferredStateConfig(undefined);
19524
- const ownerConfigs = [stage];
19525
- const parents = [];
19526
- let parent = graphic.parent;
19527
- while (parent && parent !== stage) {
19528
- parents.push(parent);
19529
- parent = parent.parent;
19530
- }
19531
- parents.reverse().forEach(current => ownerConfigs.push(current));
19532
- ownerConfigs.forEach(current => {
19533
- const deferredStateConfig = normalizeDeferredStateOwnerConfig(current.deferredStateConfig);
19534
- if (!deferredStateConfig) {
19535
- return;
19536
- }
19537
- if (deferredStateConfig.deferred) {
19538
- config = Object.assign(Object.assign({}, config), deferredStateConfig.deferred);
19539
- }
19540
- if (deferredStateConfig.localEnabled != null) {
19541
- config.enabled = deferredStateConfig.localEnabled;
19542
- }
19543
- if (hasMeaningfulDeferredConfig(current.deferredStateConfig)) {
19544
- owner = current;
19545
- }
19546
- });
19547
- const normalized = normalizeDeferredStateConfig(config);
19548
- return {
19549
- contextOwner: owner,
19550
- contextOwnerId: (_a = owner._uid) !== null && _a !== void 0 ? _a : 0,
19551
- config: normalized,
19552
- configFingerprint: fingerprintDeferredStateConfig(normalized)
19553
- };
19554
- }
19555
- classifyGraphicTargetStates(graphic, targetStates) {
19556
- const { compiledDefinitions, stateProxyEligibility } = getGraphicCompiledDefinitions(graphic);
19557
- const candidateStates = Array.from(new Set([...getCurrentStateNames(graphic), ...targetStates]));
19558
- let category = UpdateCategory.NONE;
19559
- candidateStates.forEach(stateName => {
19560
- if (stateProxyEligibility === null || stateProxyEligibility === void 0 ? void 0 : stateProxyEligibility(stateName)) {
19561
- category = UpdateCategory.NONE;
19562
- return;
19563
- }
19564
- const definition = compiledDefinitions === null || compiledDefinitions === void 0 ? void 0 : compiledDefinitions.get(stateName);
19565
- if (!definition) {
19566
- return;
19567
- }
19568
- if (definition.hasResolver && definition.affectedKeys.size === 0) {
19569
- category = UpdateCategory.NONE;
19570
- return;
19571
- }
19572
- category |= classifyAffectedKeys(definition.affectedKeys);
19573
- });
19574
- if (candidateStates.some(stateName => stateProxyEligibility === null || stateProxyEligibility === void 0 ? void 0 : stateProxyEligibility(stateName)) ||
19575
- candidateStates.some(stateName => {
19576
- const definition = compiledDefinitions === null || compiledDefinitions === void 0 ? void 0 : compiledDefinitions.get(stateName);
19577
- return !!(definition === null || definition === void 0 ? void 0 : definition.hasResolver) && definition.affectedKeys.size === 0;
19578
- })) {
19579
- return {
19580
- category: UpdateCategory.NONE,
19581
- reason: 'resolver_unstable_keys'
19582
- };
19583
- }
19584
- return {
19585
- category: category === UpdateCategory.NONE ? UpdateCategory.PAINT : category
19586
- };
19587
- }
19588
- enqueueDeferredIntent(graphic, targetStates, context, targetStatesKey) {
19589
- var _a, _b, _c, _d, _e, _f;
19590
- const nextIntentKey = createIntentKey(context.contextOwnerId, context.configFingerprint, targetStatesKey);
19591
- const prevIntentKey = this.pendingIntentByGraphic.get(graphic);
19592
- if (prevIntentKey === nextIntentKey) {
19593
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.incrementCounter('deferredJobsCoalesced');
19594
- return;
19595
- }
19596
- if (prevIntentKey) {
19597
- this.removeGraphicFromIntentJob(graphic, prevIntentKey);
19598
- }
19599
- let job = this.jobsByIntentKey.get(nextIntentKey);
19600
- if (!job) {
19601
- job = {
19602
- id: this.nextJobId++,
19603
- kind: 'apply_states',
19604
- intentKey: nextIntentKey,
19605
- status: 'pending',
19606
- targetStates: [...targetStates],
19607
- targetStatesKey,
19608
- pendingGraphics: new Set(),
19609
- orderedGraphics: [],
19610
- config: context.config,
19611
- contextOwner: context.contextOwner,
19612
- contextOwnerId: context.contextOwnerId,
19613
- configFingerprint: context.configFingerprint,
19614
- createdAt: Date.now(),
19615
- processedCount: 0
19616
- };
19617
- this.jobsByIntentKey.set(nextIntentKey, job);
19618
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.incrementCounter('deferredJobsCreated');
19619
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.updateBatchPending(this.jobsByIntentKey.size);
19620
- }
19621
- else {
19622
- (_d = this.perfMonitor) === null || _d === void 0 ? void 0 : _d.incrementCounter('deferredJobsCoalesced');
19623
- }
19624
- if (!job.pendingGraphics.has(graphic)) {
19625
- job.pendingGraphics.add(graphic);
19626
- job.orderedGraphics.push(graphic);
19627
- this.pendingIntentByGraphic.set(graphic, nextIntentKey);
19628
- (_e = this.perfMonitor) === null || _e === void 0 ? void 0 : _e.recordAllocation('batchEntriesCreated');
19629
- (_f = this.perfMonitor) === null || _f === void 0 ? void 0 : _f.updateMaxGraphicsInJob(job.pendingGraphics.size);
19630
- }
19631
- this.ensureJobRunning(job);
19632
- }
19633
- removeGraphicFromPending(graphic) {
19634
- const prevIntentKey = this.pendingIntentByGraphic.get(graphic);
19635
- if (!prevIntentKey) {
19636
- return;
19637
- }
19638
- this.removeGraphicFromIntentJob(graphic, prevIntentKey);
19639
- }
19640
- removeGraphicFromIntentJob(graphic, intentKey) {
19641
- var _a, _b, _c;
19642
- const job = this.jobsByIntentKey.get(intentKey);
19643
- if (!job) {
19644
- this.pendingIntentByGraphic.delete(graphic);
19645
- return;
19646
- }
19647
- job.pendingGraphics.delete(graphic);
19648
- if (this.pendingIntentByGraphic.get(graphic) === intentKey) {
19649
- this.pendingIntentByGraphic.delete(graphic);
19650
- }
19651
- if (job.pendingGraphics.size === 0 && job.status !== 'completed') {
19652
- job.status = 'cancelled';
19653
- this.jobsByIntentKey.delete(intentKey);
19654
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.incrementCounter('deferredJobsCancelled');
19655
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.recordEvent('deferred-job-cancel', {
19656
- intentKey,
19657
- jobId: job.id
19658
- });
19659
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.updateBatchPending(this.jobsByIntentKey.size);
19660
- }
19661
- }
19662
- ensureJobRunning(job) {
19663
- if (this.runningJobs.has(job.intentKey)) {
19664
- return;
19665
- }
19666
- const runner = this.runJob(job).then(() => {
19667
- this.runningJobs.delete(job.intentKey);
19668
- }, () => {
19669
- this.runningJobs.delete(job.intentKey);
19670
- });
19671
- this.runningJobs.set(job.intentKey, runner);
19672
- }
19673
- runJob(job) {
19674
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
19675
- return __awaiter(this, void 0, void 0, function* () {
19676
- if (job.status === 'cancelled') {
19677
- return;
19678
- }
19679
- yield this.waitForNextFrame();
19680
- if (job.status === 'cancelled') {
19681
- return;
19682
- }
19683
- job.status = 'running';
19684
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.recordEvent('deferred-job-start', {
19685
- intentKey: job.intentKey,
19686
- jobId: job.id
19687
- });
19688
- let index = 0;
19689
- let frameStart = performance.now();
19690
- let processedInFrame = 0;
19691
- let committedInSlice = 0;
19692
- while (index < job.orderedGraphics.length) {
19693
- if (job.status === 'cancelled') {
19694
- return;
19695
- }
19696
- if (processedInFrame > 0 &&
19697
- (processedInFrame >= job.config.maxGraphicsPerFrame || performance.now() - frameStart >= job.config.frameBudget)) {
19698
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.incrementCounter('deferredBudgetYields');
19699
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.recordCost('batchSlice', performance.now() - frameStart);
19700
- (_d = this.perfMonitor) === null || _d === void 0 ? void 0 : _d.recordEvent('deferred-job-yield', {
19701
- intentKey: job.intentKey,
19702
- jobId: job.id,
19703
- processedInFrame
19704
- });
19705
- if (committedInSlice > 0) {
19706
- this.stage.renderNextFrame();
19707
- }
19708
- yield this.waitForNextFrame();
19709
- frameStart = performance.now();
19710
- processedInFrame = 0;
19711
- committedInSlice = 0;
19712
- }
19713
- const graphic = job.orderedGraphics[index++];
19714
- if (!job.pendingGraphics.has(graphic)) {
19715
- continue;
19716
- }
19717
- if (!isRenderableGraphic(graphic)) {
19718
- job.pendingGraphics.delete(graphic);
19719
- if (this.pendingIntentByGraphic.get(graphic) === job.intentKey) {
19720
- this.pendingIntentByGraphic.delete(graphic);
19721
- }
19722
- continue;
19723
- }
19724
- if (this.pendingIntentByGraphic.get(graphic) !== job.intentKey) {
19725
- job.pendingGraphics.delete(graphic);
19726
- continue;
19727
- }
19728
- const nextEligibility = this.resolveEligibility(graphic, job.targetStates, true, false);
19729
- if (!nextEligibility.eligible) {
19730
- job.pendingGraphics.delete(graphic);
19731
- this.pendingIntentByGraphic.delete(graphic);
19732
- this.commitSynchronously(graphic, job.targetStates);
19733
- continue;
19734
- }
19735
- const nextIntentKey = createIntentKey(nextEligibility.context.contextOwnerId, nextEligibility.context.configFingerprint, nextEligibility.targetStatesKey);
19736
- if (nextIntentKey !== job.intentKey) {
19737
- job.pendingGraphics.delete(graphic);
19738
- this.pendingIntentByGraphic.delete(graphic);
19739
- this.enqueueDeferredIntent(graphic, job.targetStates, nextEligibility.context, nextEligibility.targetStatesKey);
19740
- continue;
19741
- }
19742
- this.commitSynchronously(graphic, job.targetStates);
19743
- job.pendingGraphics.delete(graphic);
19744
- this.pendingIntentByGraphic.delete(graphic);
19745
- job.processedCount += 1;
19746
- processedInFrame += 1;
19747
- committedInSlice += 1;
19748
- (_e = this.perfMonitor) === null || _e === void 0 ? void 0 : _e.incrementCounter('deferredGraphicsCommitted');
19749
- }
19750
- if (processedInFrame > 0) {
19751
- (_f = this.perfMonitor) === null || _f === void 0 ? void 0 : _f.recordCost('batchSlice', performance.now() - frameStart);
19752
- this.stage.renderNextFrame();
19753
- }
19754
- if (job.pendingGraphics.size === 0 && this.jobsByIntentKey.get(job.intentKey) === job) {
19755
- job.status = 'completed';
19756
- this.jobsByIntentKey.delete(job.intentKey);
19757
- (_g = this.perfMonitor) === null || _g === void 0 ? void 0 : _g.incrementCounter('deferredJobsCompleted');
19758
- (_h = this.perfMonitor) === null || _h === void 0 ? void 0 : _h.recordEvent('deferred-job-complete', {
19759
- intentKey: job.intentKey,
19760
- jobId: job.id,
19761
- processedCount: job.processedCount
19762
- });
19763
- (_j = this.perfMonitor) === null || _j === void 0 ? void 0 : _j.updateBatchPending(this.jobsByIntentKey.size);
19764
- }
19765
- });
19766
- }
19767
- waitForNextFrame() {
19768
- const stageGlobal = this.stage.global;
19769
- if (stageGlobal === null || stageGlobal === void 0 ? void 0 : stageGlobal.getSpecifiedPerformanceRAF) {
19770
- return stageGlobal.getSpecifiedPerformanceRAF(this.stage.rafId).wait();
19771
- }
19772
- return new Promise(resolve => {
19773
- stageGlobal === null || stageGlobal === void 0 ? void 0 : stageGlobal.getSpecifiedRequestAnimationFrame(this.stage.rafId)(() => resolve());
19774
- });
19775
- }
19776
- commitSynchronously(graphic, targetStates) {
19777
- if (!isRenderableGraphic(graphic)) {
19778
- return;
19779
- }
19780
- if (!targetStates.length) {
19781
- graphic.clearStates(false);
19782
- return;
19783
- }
19784
- graphic.useStates(targetStates, false);
19785
- }
19786
- }
19787
-
19788
19291
  const DefaultConfig = {
19789
19292
  WIDTH: 500,
19790
19293
  HEIGHT: 500,
@@ -19871,7 +19374,7 @@ class Stage extends Group {
19871
19374
  this._ticker.on('tick', this.afterTickCb);
19872
19375
  }
19873
19376
  constructor(params = {}, deps = {}) {
19874
- var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y;
19377
+ var _a, _b, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
19875
19378
  super({});
19876
19379
  this.tickedBeforeRender = true;
19877
19380
  this._onVisibleChange = (visible) => {
@@ -19893,7 +19396,10 @@ class Stage extends Group {
19893
19396
  }
19894
19397
  };
19895
19398
  this.beforeRender = (stage) => {
19896
- flushStageSharedStateRefresh(this);
19399
+ const pendingSharedRefresh = this._pendingSharedStateRefreshGraphics;
19400
+ if (pendingSharedRefresh === null || pendingSharedRefresh === void 0 ? void 0 : pendingSharedRefresh.size) {
19401
+ flushStageSharedStateRefresh(this);
19402
+ }
19897
19403
  this._beforeRenderList.forEach(cb => cb(stage));
19898
19404
  };
19899
19405
  this.afterClearScreen = (drawParams) => {
@@ -19959,16 +19465,17 @@ class Stage extends Group {
19959
19465
  this.appendChild(this.layerService.createLayer(this, { main: true }));
19960
19466
  this.nextFrameRenderLayerSet = new Set();
19961
19467
  this.willNextFrameRender = false;
19962
- ensureStageStatePerfMonitor(this);
19963
- this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
19964
- this.rootSharedStateScope = createRootSharedStateScope(this, (_x = this.theme) === null || _x === void 0 ? void 0 : _x.stateDefinitions);
19965
19468
  this.theme.onStateDefinitionsChange = () => {
19966
19469
  var _a;
19967
- if (!this.rootSharedStateScope) {
19470
+ const definitions = (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions;
19471
+ const rootScope = definitions && Object.keys(definitions).length
19472
+ ? this.ensureRootSharedStateScope(definitions)
19473
+ : this.rootSharedStateScope;
19474
+ if (!rootScope) {
19968
19475
  return;
19969
19476
  }
19970
- setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions);
19971
- markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
19477
+ setRootSharedStateScopeThemeDefinitions(rootScope, definitions);
19478
+ markScopeActiveDescendantsDirty(rootScope, this);
19972
19479
  };
19973
19480
  this.renderStyle = params.renderStyle;
19974
19481
  if (params.autoRender) {
@@ -20010,7 +19517,7 @@ class Stage extends Group {
20010
19517
  this.setAttributes({ background: this._background });
20011
19518
  }
20012
19519
  this.initAnimate(params);
20013
- this.rafId = (_y = params.rafId) !== null && _y !== void 0 ? _y : Math.floor(Math.random() * 6);
19520
+ this.rafId = (_x = params.rafId) !== null && _x !== void 0 ? _x : Math.floor(Math.random() * 6);
20014
19521
  }
20015
19522
  initAnimate(params) {
20016
19523
  var _a;
@@ -20390,14 +19897,13 @@ class Stage extends Group {
20390
19897
  });
20391
19898
  }
20392
19899
  }
20393
- scheduleStateBatch(graphics, targetStates) {
20394
- this._stateBatchScheduler.schedule(graphics, targetStates);
20395
- }
20396
- getStatePerfSnapshot() {
20397
- return ensureStageStatePerfMonitor(this).getSnapshot();
20398
- }
20399
- resetStatePerfSnapshot() {
20400
- ensureStageStatePerfMonitor(this).reset();
19900
+ ensureRootSharedStateScope(themeStateDefinitions) {
19901
+ if (!this.rootSharedStateScope) {
19902
+ this.rootSharedStateScope = createRootSharedStateScope(this, themeStateDefinitions);
19903
+ return this.rootSharedStateScope;
19904
+ }
19905
+ this.rootSharedStateScope.ownerStage = this;
19906
+ return this.rootSharedStateScope;
20401
19907
  }
20402
19908
  _doRenderInThisFrame() {
20403
19909
  if (this.releaseStatus === 'released') {
@@ -20532,8 +20038,7 @@ class Stage extends Group {
20532
20038
  throw new Error('暂不支持');
20533
20039
  }
20534
20040
  release() {
20535
- var _a, _b, _d, _e;
20536
- (_a = this._stateBatchScheduler) === null || _a === void 0 ? void 0 : _a.release();
20041
+ var _a, _b, _d;
20537
20042
  super.release();
20538
20043
  this.hooks.beforeRender.unTap('constructor', this.beforeRender);
20539
20044
  this.hooks.afterRender.unTap('constructor', this.afterRender);
@@ -20551,10 +20056,10 @@ class Stage extends Group {
20551
20056
  this.interactiveLayer.release();
20552
20057
  }
20553
20058
  this.window.release();
20554
- (_b = this._ticker) === null || _b === void 0 ? void 0 : _b.remTimeline(this === null || this === void 0 ? void 0 : this.timeline);
20555
- (_d = this._ticker) === null || _d === void 0 ? void 0 : _d.removeListener('tick', this.afterTickCb);
20059
+ (_a = this._ticker) === null || _a === void 0 ? void 0 : _a.remTimeline(this === null || this === void 0 ? void 0 : this.timeline);
20060
+ (_b = this._ticker) === null || _b === void 0 ? void 0 : _b.removeListener('tick', this.afterTickCb);
20556
20061
  if (!this.params.ticker) {
20557
- (_e = this._ticker) === null || _e === void 0 ? void 0 : _e.release();
20062
+ (_d = this._ticker) === null || _d === void 0 ? void 0 : _d.release();
20558
20063
  }
20559
20064
  this.renderService.renderTreeRoots = [];
20560
20065
  }
@@ -20981,14 +20486,22 @@ function bindContributionProviderNoSingletonScope(bind, id) {
20981
20486
  }
20982
20487
  class ContributionStore {
20983
20488
  static getStore(id) {
20984
- return this.store.get(id);
20489
+ var _a;
20490
+ return (_a = this.store.get(id)) === null || _a === void 0 ? void 0 : _a.values().next().value;
20985
20491
  }
20986
20492
  static setStore(id, cache) {
20987
- this.store.set(id, cache);
20493
+ let caches = this.store.get(id);
20494
+ if (!caches) {
20495
+ caches = new Set();
20496
+ this.store.set(id, caches);
20497
+ }
20498
+ caches.add(cache);
20988
20499
  }
20989
20500
  static refreshAllContributions() {
20990
- this.store.forEach(cache => {
20991
- cache.refresh();
20501
+ this.store.forEach(caches => {
20502
+ caches.forEach(cache => {
20503
+ cache.refresh();
20504
+ });
20992
20505
  });
20993
20506
  }
20994
20507
  }
@@ -21748,6 +21261,7 @@ class CanvasLayerHandlerContribution {
21748
21261
  }
21749
21262
  if (!nativeCanvas) {
21750
21263
  nativeCanvas = this.global.createCanvas({
21264
+ id: params.canvasId,
21751
21265
  width: window.width,
21752
21266
  height: window.height
21753
21267
  });
@@ -22755,6 +22269,9 @@ class DefaultGroupBackgroundRenderContribution extends DefaultBaseBackgroundRend
22755
22269
  }
22756
22270
  const defaultGroupBackgroundRenderContribution = new DefaultGroupBackgroundRenderContribution();
22757
22271
 
22272
+ function hasDisabledStrokeSide(stroke) {
22273
+ return Array.isArray(stroke) && stroke.some(s => s === false || s === null);
22274
+ }
22758
22275
  class DefaultRectRenderContribution {
22759
22276
  constructor() {
22760
22277
  this.time = BaseRenderContributionTime.afterFillStroke;
@@ -22812,7 +22329,7 @@ class SplitRectBeforeRenderContribution {
22812
22329
  }
22813
22330
  drawShape(group, context, x, y, doFill, doStroke, fVisible, sVisible, groupAttribute, drawContext, fillCb, strokeCb, doFillOrStroke) {
22814
22331
  const { stroke = groupAttribute.stroke } = group.attribute;
22815
- if (Array.isArray(stroke) && stroke.some(s => s === false)) {
22332
+ if (hasDisabledStrokeSide(stroke)) {
22816
22333
  doFillOrStroke.doStroke = false;
22817
22334
  }
22818
22335
  }
@@ -22828,7 +22345,7 @@ class SplitRectAfterRenderContribution {
22828
22345
  let { width, height } = rect.attribute;
22829
22346
  width = (width !== null && width !== void 0 ? width : x1 - originX) || 0;
22830
22347
  height = (height !== null && height !== void 0 ? height : y1 - originY) || 0;
22831
- if (!(Array.isArray(stroke) && stroke.some(s => s === false))) {
22348
+ if (!hasDisabledStrokeSide(stroke)) {
22832
22349
  return;
22833
22350
  }
22834
22351
  context.setStrokeStyle(rect, rect.attribute, x, y, groupAttribute);
@@ -23981,23 +23498,27 @@ function createStage(params) {
23981
23498
  const result = { x: 0, y: 0, z: 0, lastModelMatrix: null };
23982
23499
  class BaseRender {
23983
23500
  init(contributions) {
23984
- if (contributions) {
23985
- this._renderContribitions = contributions.getContributions();
23986
- }
23987
- if (!this._renderContribitions) {
23988
- this._renderContribitions = [];
23989
- }
23990
23501
  if (!this.builtinContributions) {
23991
23502
  this.builtinContributions = [];
23992
23503
  }
23993
- this.builtinContributions.push(defaultBaseClipRenderBeforeContribution);
23994
- this.builtinContributions.push(defaultBaseClipRenderAfterContribution);
23995
- this.builtinContributions.forEach(item => this._renderContribitions.push(item));
23504
+ this._renderContribitions = contributions ? contributions.getContributions().slice() : [];
23505
+ const addContribution = (item) => {
23506
+ if (!this._renderContribitions.includes(item)) {
23507
+ this._renderContribitions.push(item);
23508
+ }
23509
+ };
23510
+ this.builtinContributions.forEach(addContribution);
23511
+ addContribution(defaultBaseClipRenderBeforeContribution);
23512
+ addContribution(defaultBaseClipRenderAfterContribution);
23996
23513
  if (this._renderContribitions.length) {
23997
23514
  this._renderContribitions.sort((a, b) => b.order - a.order);
23998
23515
  this._beforeRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.beforeFillStroke);
23999
23516
  this._afterRenderContribitions = this._renderContribitions.filter(c => c.time === BaseRenderContributionTime.afterFillStroke);
24000
23517
  }
23518
+ else {
23519
+ this._beforeRenderContribitions = [];
23520
+ this._afterRenderContribitions = [];
23521
+ }
24001
23522
  }
24002
23523
  reInit() {
24003
23524
  this.init(this.graphicRenderContributions);
@@ -26845,18 +26366,12 @@ function createBrowserApp(options = {}) {
26845
26366
  }
26846
26367
 
26847
26368
  class NodeEntry extends BrowserEntry {
26848
- constructor(options = {}) {
26849
- super(options);
26850
- }
26851
26369
  }
26852
26370
  function createNodeApp(options = {}) {
26853
26371
  return new NodeEntry(options);
26854
26372
  }
26855
26373
 
26856
26374
  class MiniappEntry extends BrowserEntry {
26857
- constructor(options = {}) {
26858
- super(options);
26859
- }
26860
26375
  }
26861
26376
  function createMiniappApp(options = {}) {
26862
26377
  return new MiniappEntry(options);
@@ -26961,6 +26476,13 @@ class DefaultIncrementalCanvasLineRender extends DefaultCanvasLineRender {
26961
26476
  const runtimeInstallerContext = createLegacyBindingContext();
26962
26477
  let runtimeInstallerPreloaded = false;
26963
26478
  let runtimeGlobal;
26479
+ const RUNTIME_RENDERER_NAMESPACE = 'vrender:runtime-renderer';
26480
+ const RUNTIME_PICKER_NAMESPACE = 'vrender:runtime-picker';
26481
+ const runtimeEntryKeys = new WeakMap();
26482
+ const runtimeDrawContributions = new WeakMap();
26483
+ const loadedRuntimeContributionModules = new WeakMap();
26484
+ const DEFAULT_RUNTIME_CONTRIBUTION_TARGETS = ['graphic-renderer'];
26485
+ const noopUnbindRuntimeContributionService = () => undefined;
26964
26486
  function ensureRuntimeInstallerPreloaded() {
26965
26487
  if (runtimeInstallerPreloaded) {
26966
26488
  return;
@@ -26988,6 +26510,26 @@ function registerRuntimeEntries(register, entries, prefix) {
26988
26510
  register(`${prefix}:${String(name)}:${index}`, entry);
26989
26511
  });
26990
26512
  }
26513
+ function getTrackedEntryKeys(registry, namespace) {
26514
+ let namespaces = runtimeEntryKeys.get(registry);
26515
+ if (!namespaces) {
26516
+ namespaces = new Map();
26517
+ runtimeEntryKeys.set(registry, namespaces);
26518
+ }
26519
+ let keys = namespaces.get(namespace);
26520
+ if (!keys) {
26521
+ keys = new Set();
26522
+ namespaces.set(namespace, keys);
26523
+ }
26524
+ return keys;
26525
+ }
26526
+ function clearTrackedEntryKeys(registry, namespace, unregister) {
26527
+ const keys = getTrackedEntryKeys(registry, namespace);
26528
+ if (unregister) {
26529
+ keys.forEach(key => unregister(key));
26530
+ }
26531
+ keys.clear();
26532
+ }
26991
26533
  function createAppRegistryContributionProvider(app, key) {
26992
26534
  return {
26993
26535
  getContributions: () => app.context.registry.contribution.get(key)
@@ -27019,31 +26561,119 @@ function configureRuntimeApplicationForApp(app) {
27019
26561
  application.incrementalDrawContributionFactory = () => new DefaultIncrementalDrawContribution([], new DefaultIncrementalCanvasLineRender(), new DefaultIncrementalCanvasAreaRender(createContributionProvider(AreaRenderContribution, bindingContext)), createAppRegistryContributionProvider(app, DrawItemInterceptor));
27020
26562
  }
27021
26563
  function installRuntimeGraphicRenderersToApp(app) {
26564
+ var _a;
27022
26565
  const bindingContext = getRuntimeInstallerBindingContext();
27023
26566
  refreshRuntimeInstallerContributions();
27024
26567
  const renderers = bindingContext.getAll(GraphicRender);
27025
- app.registry.renderer.clear();
26568
+ const registeredKeys = getTrackedEntryKeys(app.registry.renderer, RUNTIME_RENDERER_NAMESPACE);
26569
+ clearTrackedEntryKeys(app.registry.renderer, RUNTIME_RENDERER_NAMESPACE, (_a = app.registry.renderer.unregister) === null || _a === void 0 ? void 0 : _a.bind(app.registry.renderer));
27026
26570
  registerRuntimeEntries((key, renderer) => {
27027
26571
  var _a;
27028
26572
  (_a = renderer === null || renderer === void 0 ? void 0 : renderer.reInit) === null || _a === void 0 ? void 0 : _a.call(renderer);
27029
26573
  app.registry.renderer.register(key, renderer);
27030
- }, renderers, 'runtime-renderer');
26574
+ registeredKeys.add(key);
26575
+ }, renderers, RUNTIME_RENDERER_NAMESPACE);
27031
26576
  }
27032
26577
  function installRuntimeDrawContributionsToApp(app) {
26578
+ var _a;
27033
26579
  const bindingContext = getRuntimeInstallerBindingContext();
27034
26580
  refreshRuntimeInstallerContributions();
27035
26581
  const contributions = bindingContext.getAll(DrawItemInterceptor);
27036
- app.context.registry.contribution.clear(DrawItemInterceptor);
26582
+ const tracked = (_a = runtimeDrawContributions.get(app.context.registry.contribution)) !== null && _a !== void 0 ? _a : new Set();
26583
+ tracked.forEach(contribution => {
26584
+ var _a, _b;
26585
+ (_b = (_a = app.context.registry.contribution).unregister) === null || _b === void 0 ? void 0 : _b.call(_a, DrawItemInterceptor, contribution);
26586
+ });
26587
+ tracked.clear();
26588
+ runtimeDrawContributions.set(app.context.registry.contribution, tracked);
26589
+ const registered = new Set(app.context.registry.contribution.get(DrawItemInterceptor));
27037
26590
  contributions.forEach(contribution => {
27038
- app.context.registry.contribution.register(DrawItemInterceptor, contribution);
26591
+ if (!registered.has(contribution)) {
26592
+ app.context.registry.contribution.register(DrawItemInterceptor, contribution);
26593
+ registered.add(contribution);
26594
+ }
26595
+ tracked.add(contribution);
27039
26596
  });
27040
26597
  }
27041
26598
  function installRuntimePickersToApp(app, serviceIdentifier) {
26599
+ var _a;
27042
26600
  const bindingContext = getRuntimeInstallerBindingContext();
27043
26601
  refreshRuntimeInstallerContributions();
27044
26602
  const pickers = bindingContext.getAll(serviceIdentifier);
27045
- app.registry.picker.clear();
27046
- registerRuntimeEntries((key, picker) => app.registry.picker.register(key, picker), pickers, 'runtime-picker');
26603
+ const registeredKeys = getTrackedEntryKeys(app.registry.picker, RUNTIME_PICKER_NAMESPACE);
26604
+ clearTrackedEntryKeys(app.registry.picker, RUNTIME_PICKER_NAMESPACE, (_a = app.registry.picker.unregister) === null || _a === void 0 ? void 0 : _a.bind(app.registry.picker));
26605
+ registerRuntimeEntries((key, picker) => {
26606
+ app.registry.picker.register(key, picker);
26607
+ registeredKeys.add(key);
26608
+ }, pickers, RUNTIME_PICKER_NAMESPACE);
26609
+ }
26610
+ function getRuntimeContributionModuleIdentity(module) {
26611
+ return module;
26612
+ }
26613
+ function hasLoadedRuntimeContributionModule(context, module) {
26614
+ var _a, _b;
26615
+ return (_b = (_a = loadedRuntimeContributionModules.get(context)) === null || _a === void 0 ? void 0 : _a.has(getRuntimeContributionModuleIdentity(module))) !== null && _b !== void 0 ? _b : false;
26616
+ }
26617
+ function markRuntimeContributionModuleLoaded(context, module) {
26618
+ let modules = loadedRuntimeContributionModules.get(context);
26619
+ if (!modules) {
26620
+ modules = new WeakSet();
26621
+ loadedRuntimeContributionModules.set(context, modules);
26622
+ }
26623
+ modules.add(getRuntimeContributionModuleIdentity(module));
26624
+ }
26625
+ function loadRuntimeContributionModuleToContext(context, module) {
26626
+ if (hasLoadedRuntimeContributionModule(context, module)) {
26627
+ return;
26628
+ }
26629
+ if (typeof module === 'function') {
26630
+ module(context);
26631
+ }
26632
+ else {
26633
+ module.registry(context.bind, noopUnbindRuntimeContributionService, context.isBound, context.rebind);
26634
+ }
26635
+ markRuntimeContributionModuleLoaded(context, module);
26636
+ }
26637
+ function isRuntimePickerTarget(target) {
26638
+ return typeof target === 'object' && target !== null && 'picker' in target;
26639
+ }
26640
+ function installRuntimeContributionTargetsToApp(app, targets) {
26641
+ const resolvedTargets = targets !== null && targets !== void 0 ? targets : DEFAULT_RUNTIME_CONTRIBUTION_TARGETS;
26642
+ let installGraphicRenderers = false;
26643
+ let installDrawContributions = false;
26644
+ const pickerTargets = new Set();
26645
+ resolvedTargets.forEach(target => {
26646
+ if (target === 'graphic-renderer') {
26647
+ installGraphicRenderers = true;
26648
+ }
26649
+ else if (target === 'draw-contribution') {
26650
+ installDrawContributions = true;
26651
+ }
26652
+ else if (isRuntimePickerTarget(target)) {
26653
+ pickerTargets.add(target.picker);
26654
+ }
26655
+ });
26656
+ if (installDrawContributions) {
26657
+ installRuntimeDrawContributionsToApp(app);
26658
+ }
26659
+ if (installGraphicRenderers) {
26660
+ installRuntimeGraphicRenderersToApp(app);
26661
+ }
26662
+ pickerTargets.forEach(serviceIdentifier => {
26663
+ installRuntimePickersToApp(app, serviceIdentifier);
26664
+ });
26665
+ }
26666
+ function installRuntimeContributionModule(module, { app, legacy = true, targets } = {}) {
26667
+ const runtimeContext = getRuntimeInstallerBindingContext();
26668
+ loadRuntimeContributionModuleToContext(runtimeContext, module);
26669
+ if (legacy) {
26670
+ preLoadAllModule();
26671
+ loadRuntimeContributionModuleToContext(getLegacyBindingContext(), module);
26672
+ }
26673
+ refreshRuntimeInstallerContributions();
26674
+ if (app) {
26675
+ installRuntimeContributionTargetsToApp(app, targets);
26676
+ }
27047
26677
  }
27048
26678
 
27049
26679
  function simplifyRadialDist(points, sqTolerance) {
@@ -29400,26 +29030,37 @@ function resolveContainerBinding(container, serviceIdentifier) {
29400
29030
  return instance;
29401
29031
  }
29402
29032
 
29403
- let loadArcModule = false;
29033
+ function isBindingContextLoaded(loadedContexts, context) {
29034
+ const key = (typeof context === 'object' && context !== null) || typeof context === 'function'
29035
+ ? context
29036
+ : loadedContexts;
29037
+ if (loadedContexts.has(key)) {
29038
+ return true;
29039
+ }
29040
+ loadedContexts.add(key);
29041
+ return false;
29042
+ }
29043
+
29044
+ const loadedArcModuleContexts = new WeakSet();
29404
29045
  function bindArcRenderModule({ bind }) {
29405
- if (loadArcModule) {
29046
+ if (isBindingContextLoaded(loadedArcModuleContexts, bind)) {
29406
29047
  return;
29407
29048
  }
29408
- loadArcModule = true;
29409
- bind(DefaultCanvasArcRender).toSelf().inSingletonScope();
29410
- bind(ArcRender).to(DefaultCanvasArcRender).inSingletonScope();
29049
+ bind(DefaultCanvasArcRender)
29050
+ .toDynamicValue(({ container }) => new DefaultCanvasArcRender(createContributionProvider(ArcRenderContribution, container)))
29051
+ .inSingletonScope();
29052
+ bind(ArcRender).toService(DefaultCanvasArcRender);
29411
29053
  bind(GraphicRender).toService(ArcRender);
29412
29054
  bind(ArcRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
29413
29055
  bindContributionProvider(bind, ArcRenderContribution);
29414
29056
  }
29415
29057
  const arcModule = bindArcRenderModule;
29416
29058
 
29417
- let loadRectModule = false;
29059
+ const loadedRectModuleContexts = new WeakSet();
29418
29060
  function bindRectRenderModule({ bind }) {
29419
- if (loadRectModule) {
29061
+ if (isBindingContextLoaded(loadedRectModuleContexts, bind)) {
29420
29062
  return;
29421
29063
  }
29422
- loadRectModule = true;
29423
29064
  bind(DefaultCanvasRectRender)
29424
29065
  .toDynamicValue(({ container }) => new DefaultCanvasRectRender(createContributionProvider(RectRenderContribution, container)))
29425
29066
  .inSingletonScope();
@@ -29434,96 +29075,101 @@ function bindRectRenderModule({ bind }) {
29434
29075
  }
29435
29076
  const rectModule = bindRectRenderModule;
29436
29077
 
29437
- let loadLineModule = false;
29078
+ const loadedLineModuleContexts = new WeakSet();
29438
29079
  function bindLineRenderModule({ bind }) {
29439
- if (loadLineModule) {
29080
+ if (isBindingContextLoaded(loadedLineModuleContexts, bind)) {
29440
29081
  return;
29441
29082
  }
29442
- loadLineModule = true;
29443
- bind(DefaultCanvasLineRender).toSelf().inSingletonScope();
29444
- bind(DefaultIncrementalCanvasLineRender).toSelf().inSingletonScope();
29445
- bind(LineRender).to(DefaultCanvasLineRender).inSingletonScope();
29083
+ bind(DefaultCanvasLineRender)
29084
+ .toDynamicValue(() => new DefaultCanvasLineRender())
29085
+ .inSingletonScope();
29086
+ bind(LineRender).toService(DefaultCanvasLineRender);
29446
29087
  bind(GraphicRender).toService(LineRender);
29447
29088
  }
29448
29089
  const lineModule = bindLineRenderModule;
29449
29090
 
29450
- let loadAreaModule = false;
29091
+ const loadedAreaModuleContexts = new WeakSet();
29451
29092
  function bindAreaRenderModule({ bind }) {
29452
- if (loadAreaModule) {
29093
+ if (isBindingContextLoaded(loadedAreaModuleContexts, bind)) {
29453
29094
  return;
29454
29095
  }
29455
- loadAreaModule = true;
29456
- bind(DefaultCanvasAreaRender).toSelf().inSingletonScope();
29457
- bind(AreaRender).to(DefaultCanvasAreaRender).inSingletonScope();
29096
+ bind(DefaultCanvasAreaRender)
29097
+ .toDynamicValue(({ container }) => new DefaultCanvasAreaRender(createContributionProvider(AreaRenderContribution, container)))
29098
+ .inSingletonScope();
29099
+ bind(AreaRender).toService(DefaultCanvasAreaRender);
29458
29100
  bind(GraphicRender).toService(AreaRender);
29459
29101
  bind(AreaRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
29460
29102
  bindContributionProvider(bind, AreaRenderContribution);
29461
- bind(DefaultIncrementalCanvasAreaRender).toSelf().inSingletonScope();
29462
29103
  }
29463
29104
  const areaModule = bindAreaRenderModule;
29464
29105
 
29465
- let loadSymbolModule = false;
29106
+ const loadedSymbolModuleContexts = new WeakSet();
29466
29107
  function bindSymbolRenderModule({ bind }) {
29467
- if (loadSymbolModule) {
29108
+ if (isBindingContextLoaded(loadedSymbolModuleContexts, bind)) {
29468
29109
  return;
29469
29110
  }
29470
- loadSymbolModule = true;
29471
- bind(DefaultCanvasSymbolRender).toSelf().inSingletonScope();
29472
- bind(SymbolRender).to(DefaultCanvasSymbolRender).inSingletonScope();
29111
+ bind(DefaultCanvasSymbolRender)
29112
+ .toDynamicValue(({ container }) => new DefaultCanvasSymbolRender(createContributionProvider(SymbolRenderContribution, container)))
29113
+ .inSingletonScope();
29114
+ bind(SymbolRender).toService(DefaultCanvasSymbolRender);
29473
29115
  bind(GraphicRender).toService(SymbolRender);
29474
29116
  bind(SymbolRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
29475
29117
  bindContributionProvider(bind, SymbolRenderContribution);
29476
29118
  }
29477
29119
  const symbolModule = bindSymbolRenderModule;
29478
29120
 
29479
- let loadCircleModule = false;
29121
+ const loadedCircleModuleContexts = new WeakSet();
29480
29122
  function bindCircleRenderModule({ bind }) {
29481
- if (loadCircleModule) {
29123
+ if (isBindingContextLoaded(loadedCircleModuleContexts, bind)) {
29482
29124
  return;
29483
29125
  }
29484
- loadCircleModule = true;
29485
- bind(DefaultCanvasCircleRender).toSelf().inSingletonScope();
29486
- bind(CircleRender).to(DefaultCanvasCircleRender).inSingletonScope();
29126
+ bind(DefaultCanvasCircleRender)
29127
+ .toDynamicValue(({ container }) => new DefaultCanvasCircleRender(createContributionProvider(CircleRenderContribution, container)))
29128
+ .inSingletonScope();
29129
+ bind(CircleRender).toService(DefaultCanvasCircleRender);
29487
29130
  bind(GraphicRender).toService(CircleRender);
29488
29131
  bind(CircleRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
29489
29132
  bindContributionProvider(bind, CircleRenderContribution);
29490
29133
  }
29491
29134
  const circleModule = bindCircleRenderModule;
29492
29135
 
29493
- let loadTextModule = false;
29136
+ const loadedTextModuleContexts = new WeakSet();
29494
29137
  function bindTextRenderModule({ bind }) {
29495
- if (loadTextModule) {
29138
+ if (isBindingContextLoaded(loadedTextModuleContexts, bind)) {
29496
29139
  return;
29497
29140
  }
29498
- loadTextModule = true;
29499
- bind(TextRender).to(DefaultCanvasTextRender).inSingletonScope();
29141
+ bind(TextRender)
29142
+ .toDynamicValue(({ container }) => new DefaultCanvasTextRender(createContributionProvider(TextRenderContribution, container)))
29143
+ .inSingletonScope();
29500
29144
  bind(GraphicRender).toService(TextRender);
29501
29145
  bind(TextRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
29502
29146
  bindContributionProvider(bind, TextRenderContribution);
29503
29147
  }
29504
29148
  const textModule = bindTextRenderModule;
29505
29149
 
29506
- let loadPathModule = false;
29150
+ const loadedPathModuleContexts = new WeakSet();
29507
29151
  function bindPathRenderModule({ bind }) {
29508
- if (loadPathModule) {
29152
+ if (isBindingContextLoaded(loadedPathModuleContexts, bind)) {
29509
29153
  return;
29510
29154
  }
29511
- loadPathModule = true;
29512
- bind(DefaultCanvasPathRender).toSelf().inSingletonScope();
29513
- bind(PathRender).to(DefaultCanvasPathRender).inSingletonScope();
29155
+ bind(DefaultCanvasPathRender)
29156
+ .toDynamicValue(({ container }) => new DefaultCanvasPathRender(createContributionProvider(PathRenderContribution, container)))
29157
+ .inSingletonScope();
29158
+ bind(PathRender).toService(DefaultCanvasPathRender);
29514
29159
  bind(GraphicRender).toService(PathRender);
29515
29160
  bind(PathRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
29516
29161
  bindContributionProvider(bind, PathRenderContribution);
29517
29162
  }
29518
29163
  const pathModule = bindPathRenderModule;
29519
29164
 
29520
- let loadPolygonModule = false;
29165
+ const loadedPolygonModuleContexts = new WeakSet();
29521
29166
  function bindPolygonRenderModule({ bind }) {
29522
- if (loadPolygonModule) {
29167
+ if (isBindingContextLoaded(loadedPolygonModuleContexts, bind)) {
29523
29168
  return;
29524
29169
  }
29525
- loadPolygonModule = true;
29526
- bind(PolygonRender).to(DefaultCanvasPolygonRender).inSingletonScope();
29170
+ bind(PolygonRender)
29171
+ .toDynamicValue(({ container }) => new DefaultCanvasPolygonRender(createContributionProvider(PolygonRenderContribution, container)))
29172
+ .inSingletonScope();
29527
29173
  bind(GraphicRender).toService(PolygonRender);
29528
29174
  bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
29529
29175
  bindContributionProvider(bind, PolygonRenderContribution);
@@ -29531,12 +29177,12 @@ function bindPolygonRenderModule({ bind }) {
29531
29177
  const polygonModule = bindPolygonRenderModule;
29532
29178
 
29533
29179
  class DefaultCanvasStarRender extends BaseRender {
29534
- constructor(starRenderContribitions) {
29180
+ constructor(graphicRenderContributions) {
29535
29181
  super();
29536
- this.starRenderContribitions = starRenderContribitions;
29182
+ this.graphicRenderContributions = graphicRenderContributions;
29537
29183
  this.numberType = STAR_NUMBER_TYPE;
29538
29184
  this.builtinContributions = [defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution];
29539
- this.init(starRenderContribitions);
29185
+ this.init(graphicRenderContributions);
29540
29186
  }
29541
29187
  drawShape(star, context, x, y, drawContext, params, fillCb, strokeCb) {
29542
29188
  const starAttribute = getTheme(star, params === null || params === void 0 ? void 0 : params.theme).star;
@@ -29599,17 +29245,17 @@ class DefaultCanvasStarRender extends BaseRender {
29599
29245
  }
29600
29246
  }
29601
29247
 
29602
- let loadStarModule = false;
29248
+ const loadedStarModuleContexts = new WeakSet();
29603
29249
  function bindStarRenderModule({ bind }) {
29604
- if (loadStarModule) {
29250
+ if (isBindingContextLoaded(loadedStarModuleContexts, bind)) {
29605
29251
  return;
29606
29252
  }
29607
- loadStarModule = true;
29608
29253
  bind(DefaultCanvasStarRender)
29609
29254
  .toDynamicValue(({ container }) => new DefaultCanvasStarRender(createContributionProvider(StarRenderContribution, container)))
29610
29255
  .inSingletonScope();
29611
29256
  bind(StarRender).toService(DefaultCanvasStarRender);
29612
29257
  bind(GraphicRender).toService(StarRender);
29258
+ bindContributionProvider(bind, StarRenderContribution);
29613
29259
  }
29614
29260
  const starModule = bindStarRenderModule;
29615
29261
 
@@ -29650,13 +29296,15 @@ class DefaultCanvasGlyphRender {
29650
29296
  }
29651
29297
  }
29652
29298
 
29653
- let loadGlyphModule = false;
29299
+ const loadedGlyphModuleContexts = new WeakSet();
29654
29300
  function bindGlyphRenderModule({ bind }) {
29655
- if (loadGlyphModule) {
29301
+ if (isBindingContextLoaded(loadedGlyphModuleContexts, bind)) {
29656
29302
  return;
29657
29303
  }
29658
- loadGlyphModule = true;
29659
- bind(GlyphRender).to(DefaultCanvasGlyphRender).inSingletonScope();
29304
+ bind(DefaultCanvasGlyphRender)
29305
+ .toDynamicValue(() => new DefaultCanvasGlyphRender())
29306
+ .inSingletonScope();
29307
+ bind(GlyphRender).toService(DefaultCanvasGlyphRender);
29660
29308
  bind(GraphicRender).toService(GlyphRender);
29661
29309
  }
29662
29310
  const glyphModule = bindGlyphRenderModule;
@@ -29730,24 +29378,27 @@ class DefaultCanvasRichTextRender extends BaseRender {
29730
29378
  }
29731
29379
  }
29732
29380
 
29733
- let loadRichtextModule = false;
29381
+ const loadedRichtextModuleContexts = new WeakSet();
29734
29382
  function bindRichtextRenderModule({ bind }) {
29735
- if (loadRichtextModule) {
29383
+ if (isBindingContextLoaded(loadedRichtextModuleContexts, bind)) {
29736
29384
  return;
29737
29385
  }
29738
- loadRichtextModule = true;
29739
- bind(RichTextRender).to(DefaultCanvasRichTextRender).inSingletonScope();
29386
+ bind(DefaultCanvasRichTextRender)
29387
+ .toDynamicValue(() => new DefaultCanvasRichTextRender())
29388
+ .inSingletonScope();
29389
+ bind(RichTextRender).toService(DefaultCanvasRichTextRender);
29740
29390
  bind(GraphicRender).toService(RichTextRender);
29741
29391
  }
29742
29392
  const richtextModule = bindRichtextRenderModule;
29743
29393
 
29744
- let loadImageModule = false;
29394
+ const loadedImageModuleContexts = new WeakSet();
29745
29395
  function bindImageRenderModule({ bind }) {
29746
- if (loadImageModule) {
29396
+ if (isBindingContextLoaded(loadedImageModuleContexts, bind)) {
29747
29397
  return;
29748
29398
  }
29749
- loadImageModule = true;
29750
- bind(ImageRender).to(DefaultCanvasImageRender).inSingletonScope();
29399
+ bind(ImageRender)
29400
+ .toDynamicValue(({ container }) => new DefaultCanvasImageRender(createContributionProvider(ImageRenderContribution, container)))
29401
+ .inSingletonScope();
29751
29402
  bind(GraphicRender).toService(ImageRender);
29752
29403
  bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
29753
29404
  bindContributionProvider(bind, ImageRenderContribution);
@@ -29890,13 +29541,15 @@ class DefaultCanvasRect3dRender extends Base3dRender {
29890
29541
  }
29891
29542
  }
29892
29543
 
29893
- let loadRect3dModule = false;
29544
+ const loadedRect3dModuleContexts = new WeakSet();
29894
29545
  function bindRect3dRenderModule({ bind }) {
29895
- if (loadRect3dModule) {
29546
+ if (isBindingContextLoaded(loadedRect3dModuleContexts, bind)) {
29896
29547
  return;
29897
29548
  }
29898
- loadRect3dModule = true;
29899
- bind(Rect3DRender).to(DefaultCanvasRect3dRender).inSingletonScope();
29549
+ bind(DefaultCanvasRect3dRender)
29550
+ .toDynamicValue(() => new DefaultCanvasRect3dRender())
29551
+ .inSingletonScope();
29552
+ bind(Rect3DRender).toService(DefaultCanvasRect3dRender);
29900
29553
  bind(GraphicRender).toService(Rect3DRender);
29901
29554
  }
29902
29555
  const rect3dModule = bindRect3dRenderModule;
@@ -30090,13 +29743,15 @@ class DefaultCanvasArc3DRender extends BaseRender {
30090
29743
  }
30091
29744
  }
30092
29745
 
30093
- let loadArc3dModule = false;
29746
+ const loadedArc3dModuleContexts = new WeakSet();
30094
29747
  function bindArc3dRenderModule({ bind }) {
30095
- if (loadArc3dModule) {
29748
+ if (isBindingContextLoaded(loadedArc3dModuleContexts, bind)) {
30096
29749
  return;
30097
29750
  }
30098
- loadArc3dModule = true;
30099
- bind(Arc3dRender).to(DefaultCanvasArc3DRender).inSingletonScope();
29751
+ bind(DefaultCanvasArc3DRender)
29752
+ .toDynamicValue(() => new DefaultCanvasArc3DRender())
29753
+ .inSingletonScope();
29754
+ bind(Arc3dRender).toService(DefaultCanvasArc3DRender);
30100
29755
  bind(GraphicRender).toService(Arc3dRender);
30101
29756
  }
30102
29757
  const arc3dModule = bindArc3dRenderModule;
@@ -30137,13 +29792,15 @@ class DefaultCanvasPyramid3dRender extends Base3dRender {
30137
29792
  }
30138
29793
  }
30139
29794
 
30140
- let loadPyramid3dModule = false;
29795
+ const loadedPyramid3dModuleContexts = new WeakSet();
30141
29796
  function bindPyramid3dRenderModule({ bind }) {
30142
- if (loadPyramid3dModule) {
29797
+ if (isBindingContextLoaded(loadedPyramid3dModuleContexts, bind)) {
30143
29798
  return;
30144
29799
  }
30145
- loadPyramid3dModule = true;
30146
- bind(Pyramid3dRender).to(DefaultCanvasPyramid3dRender).inSingletonScope();
29800
+ bind(DefaultCanvasPyramid3dRender)
29801
+ .toDynamicValue(() => new DefaultCanvasPyramid3dRender())
29802
+ .inSingletonScope();
29803
+ bind(Pyramid3dRender).toService(DefaultCanvasPyramid3dRender);
30147
29804
  bind(GraphicRender).toService(Pyramid3dRender);
30148
29805
  }
30149
29806
  const pyramid3dModule = bindPyramid3dRenderModule;
@@ -31035,7 +30692,10 @@ class FlexLayoutPlugin {
31035
30692
  this.tryLayout(graphic, false);
31036
30693
  }
31037
30694
  });
31038
- stage.graphicService.hooks.onSetStage.tap(this.key, graphic => {
30695
+ stage.graphicService.hooks.onSetStage.tap(this.key, (graphic, nextStage) => {
30696
+ if (!(nextStage && nextStage === this.pluginService.stage)) {
30697
+ return;
30698
+ }
31039
30699
  if (graphic.glyphHost) {
31040
30700
  graphic = graphic.glyphHost;
31041
30701
  }
@@ -31070,4 +30730,4 @@ const registerFlexLayoutPlugin = () => {
31070
30730
  Factory.registerPlugin('FlexLayoutPlugin', FlexLayoutPlugin);
31071
30731
  };
31072
30732
 
31073
- export { ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, AnimateMode, AnimateStatus, AnimateStepType, AppContext, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEntry, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, Circle, CircleRender, CircleRenderContribution, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Context2dFactory, ContributionProvider, ContributionRegistry, ContributionStore, CubicBezierCurve, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DEFAULT_TEXT_FONT_FAMILY, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseClipRenderAfterContribution, DefaultBaseClipRenderBeforeContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStarAttribute, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolClipRangeStrokeRenderContribution, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction, DirectionalLight, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EditModule, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ALL_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, GradientParser, Graphic, GraphicCreator$1 as GraphicCreator, GraphicFactory, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncrementalDrawContribution, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerFactory, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, Mat4Allocate, MatrixAllocate, MeasureModeEnum, MiniappEntry, MonotoneX, MonotoneY, NOWORK_ANIMATE_ATTR, Node, NodeEntry, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PerformanceRAF, PickItemInterceptor, PickServiceInterceptor, PickerRegistry, PickerService, PluginRegistry, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, RendererRegistry, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, STAR_NUMBER_TYPE, STATUS$1 as STATUS, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowPickServiceInterceptorContribution, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StageFactory, Star, StarRender, StarRenderContribution, StateDefinitionCompiler, StateEngine, StaticLayerHandlerContribution, Step, StepClosed, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TransformUtil, UpdateTag, VGlobal, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _calculateLineHeight, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindArc3dRenderModule, bindArcRenderModule, bindAreaRenderModule, bindCircleRenderModule, bindContributionProvider, bindContributionProviderNoSingletonScope, bindGlyphRenderModule, bindImageRenderModule, bindLineRenderModule, bindPathRenderModule, bindPolygonRenderModule, bindPyramid3dRenderModule, bindRect3dRenderModule, bindRectRenderModule, bindRichtextRenderModule, bindStarRenderModule, bindSymbolRenderModule, bindTextRenderModule, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, colorEqual, colorStringInterpolationToStr, configureRuntimeApplicationForApp, container, cornerTangents, createBrowserApp as createApp, createArc, createArc3d, createArea, createBrowserApp, createCanvasEventTransformer, createCircle, createColor, createConicalGradient, createContributionProvider, createEventTransformer, createGlyph, createGraphic, createGroup, createImage, createLine, createMat4, createMiniappApp, createNodeApp, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createStar, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseClipRenderAfterContribution, defaultBaseClipRenderBeforeContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolClipRangeStrokeRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, diff, divideCubic, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawBackgroundImage, drawImageWithLayout, drawIncrementalAreaSegments, drawIncrementalSegments, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findConfigIndexByCursorIdx, findCursorIdxByConfigIndex, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepClosedSegments, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getBackgroundImage, getConicGradientAt, getCurrentEnv, getDefaultCharacterConfig, getExtraModelMatrix, getLegacyBindingContext, getModelMatrix, getRichTextBounds, getRuntimeInstallerBindingContext, getRuntimeInstallerGlobal, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, identityMat4, imageModule, incrementalAddTo, installRuntimeDrawContributionsToApp, installRuntimeGraphicRenderersToApp, installRuntimePickersToApp, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, interpolatePureColorArrayToStr, intersect, isBrowserEnv, isNoRepeatSizingMode, isNodeEnv, isSvg, isXML, layerService, lineModule, lookAt, mapToCanvasPointForCanvas, mat3Tomat4, mat4Allocate, matrixAllocate, multiplyMat4Mat3, multiplyMat4Mat4, newThemeObj, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, quadCalc, quadLength, quadPointAt, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, refreshRuntimeInstallerContributions, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlobalEventTransformer, registerGlyphGraphic, registerGraphic, registerGroupGraphic, registerHtmlAttributePlugin, registerImageGraphic, registerLineGraphic, registerOrthoCamera, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerStarGraphic, registerSymbolGraphic, registerTextGraphic, registerViewTransform3dPlugin, registerWindowEventTransformer, registerWrapTextGraphic, renderCommandList, resolveBackgroundDrawMode, resolveBackgroundParamsByImageSizing, resolveBackgroundPosition, resolveBackgroundSizing, resolveContainerBinding, resolveImageMode, resolveImageRepeatMode, resolveRenderableImageSize, rewriteProto, richtextModule, rotateX, rotateY, rotateZ, runFill, runStroke, scaleMat4, segments, shouldClipImageByLayout, shouldUseMat4, shouldUseSimpleAttributeFastPath, snapLength, splitArc, splitArea, splitCircle, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, starModule, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformMat4, transformPointForCanvas, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };
30733
+ export { ARC3D_NUMBER_TYPE, ARC_NUMBER_TYPE, AREA_NUMBER_TYPE, AbstractGraphicRender, AnimateMode, AnimateStatus, AnimateStepType, AppContext, Application, Arc, Arc3d, Arc3dRender, ArcRender, ArcRenderContribution, Area, AreaRender, AreaRenderContribution, AttributeUpdateType, AutoEnablePlugins, BaseCanvas, BaseEnvContribution, BaseRender, BaseRenderContributionTime, BaseWindowHandlerContribution, Basis, BeforeRenderConstribution, BoundsContext, BoundsPicker, BrowserEntry, CIRCLE_NUMBER_TYPE, Canvas3DDrawItemInterceptor, Canvas3DPickItemInterceptor, CanvasFactory, CanvasTextLayout, Circle, CircleRender, CircleRenderContribution, ColorInterpolate, ColorStore, ColorType, CommonDrawItemInterceptorContribution, CommonRenderContribution, Context2dFactory, ContributionProvider, ContributionRegistry, ContributionStore, CubicBezierCurve, CurveContext, CurveTypeEnum, CustomEvent, CustomPath2D, CustomSymbolClass, DEFAULT_TEXT_FONT_FAMILY, DebugDrawItemInterceptorContribution, DefaultArcAllocate, DefaultArcAttribute, DefaultArcRenderContribution, DefaultAreaAllocate, DefaultAreaAttribute, DefaultAreaTextureRenderContribution, DefaultAttribute, DefaultBaseBackgroundRenderContribution, DefaultBaseClipRenderAfterContribution, DefaultBaseClipRenderBeforeContribution, DefaultBaseInteractiveRenderContribution, DefaultBaseTextureRenderContribution, DefaultCanvasAllocate, DefaultCanvasArcRender, DefaultCanvasAreaRender, DefaultCanvasCircleRender, DefaultCanvasGroupRender, DefaultCanvasImageRender, DefaultCanvasLineRender, DefaultCanvasPathRender, DefaultCanvasPolygonRender, DefaultCanvasRectRender, DefaultCanvasSymbolRender, DefaultCanvasTextRender, DefaultCircleAllocate, DefaultCircleAttribute, DefaultCircleRenderContribution, DefaultConnectAttribute, DefaultDebugAttribute, DefaultFillStyle, DefaultGlobal, DefaultGlobalPickerService, DefaultGlyphAttribute, DefaultGraphicAllocate, DefaultGraphicMemoryManager, DefaultGraphicService, DefaultGraphicUtil, DefaultGroupAttribute, DefaultGroupBackgroundRenderContribution, DefaultImageAttribute, DefaultImageRenderContribution, DefaultLayerService, DefaultLayout, DefaultLineAllocate, DefaultLineAttribute, DefaultMat4Allocate, DefaultMatrixAllocate, DefaultPathAllocate, DefaultPathAttribute, DefaultPickService, DefaultPickStyle, DefaultPolygonAttribute, DefaultRect3dAttribute, DefaultRectAllocate, DefaultRectAttribute, DefaultRectRenderContribution, DefaultRenderService, DefaultRichTextAttribute, DefaultRichTextIconAttribute, DefaultStarAttribute, DefaultStrokeStyle, DefaultStyle, DefaultSymbolAllocate, DefaultSymbolAttribute, DefaultSymbolClipRangeStrokeRenderContribution, DefaultSymbolRenderContribution, DefaultTextAllocate, DefaultTextAttribute, DefaultTextMeasureContribution, DefaultTextStyle, DefaultTransform, DefaultTransformUtil, DefaultWindow, Direction, DirectionalLight, DrawContribution, DrawItemInterceptor, DynamicLayerHandlerContribution, Edge, EditModule, EmptyContext2d, EnvContribution, EventManager, EventSystem, EventTarget, FORMAT_ALL_TEXT_COMMAND, FORMAT_ELEMENT_COMMAND, FORMAT_TEXT_COMMAND, Factory, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FlexLayoutPlugin, GLYPH_NUMBER_TYPE, GRAPHIC_UPDATE_TAG_KEY, GROUP_NUMBER_TYPE, Generator, GlobalPickerService, Glyph, GlyphRender, GradientParser, Graphic, GraphicCreator$1 as GraphicCreator, GraphicFactory, GraphicPicker, GraphicRender, GraphicService, GraphicUtil, Group, GroupRender, GroupRenderContribution, GroupUpdateAABBBoundsMode, HtmlAttributePlugin, IContainPointMode, IMAGE_NUMBER_TYPE, Image, ImageRender, ImageRenderContribution, IncrementalDrawContribution, InteractiveDrawItemInterceptorContribution, InteractivePickItemInterceptorContribution, InteractiveSubRenderContribution, LINE_NUMBER_TYPE, Layer, LayerFactory, LayerService, Line$1 as Line, LineRender, Linear, LinearClosed, Mat4Allocate, MatrixAllocate, MeasureModeEnum, MiniappEntry, MonotoneX, MonotoneY, NOWORK_ANIMATE_ATTR, Node, NodeEntry, OrthoCamera, PATH_NUMBER_TYPE, POLYGON_NUMBER_TYPE, PURE_STYLE_KEY, PYRAMID3D_NUMBER_TYPE, Path, PathRender, PathRenderContribution, PerformanceRAF, PickItemInterceptor, PickServiceInterceptor, PickerRegistry, PickerService, PluginRegistry, PluginService, Polygon, PolygonRender, PolygonRenderContribution, Pyramid3d, Pyramid3dRender, RECT3D_NUMBER_TYPE, RECT_NUMBER_TYPE, RICHTEXT_NUMBER_TYPE, RafBasedSTO, ReactAttributePlugin, Rect, Rect3DRender, Rect3d, RectRender, RectRenderContribution, ReflectSegContext, RenderSelector, RenderService, RendererRegistry, ResourceLoader, RichText, RichTextEditPlugin, RichTextRender, STAR_NUMBER_TYPE, STATUS$1 as STATUS, SVG_ATTRIBUTE_MAP, SVG_ATTRIBUTE_MAP_KEYS, SVG_PARSE_ATTRIBUTE_MAP, SVG_PARSE_ATTRIBUTE_MAP_KEYS, SYMBOL_NUMBER_TYPE, SegContext, ShadowPickServiceInterceptorContribution, ShadowRoot, ShadowRootDrawItemInterceptorContribution, ShadowRootPickItemInterceptorContribution, SplitRectAfterRenderContribution, SplitRectBeforeRenderContribution, Stage, StageFactory, Star, StarRender, StarRenderContribution, StateDefinitionCompiler, StateEngine, StaticLayerHandlerContribution, Step, StepClosed, Symbol$1 as Symbol, SymbolRender, SymbolRenderContribution, TEXT_NUMBER_TYPE, Text, TextDirection, TextMeasureContribution, TextRender, TextRenderContribution, Theme, TransformUtil, UpdateTag, VGlobal, VWindow, ViewTransform3dPlugin, VirtualLayerHandlerContribution, WILDCARD, WindowHandlerContribution, WrapText, XMLParser, _calculateLineHeight, _interpolateColor, addArcToBezierPath, addAttributeToPrototype, alignBezierCurves, alignSubpath, application, applyTransformOnBezierCurves, arc3dModule, arcModule, areaModule, bezier, bezierCurversToPath, binarySplitPolygon, bindArc3dRenderModule, bindArcRenderModule, bindAreaRenderModule, bindCircleRenderModule, bindContributionProvider, bindContributionProviderNoSingletonScope, bindGlyphRenderModule, bindImageRenderModule, bindLineRenderModule, bindPathRenderModule, bindPolygonRenderModule, bindPyramid3dRenderModule, bindRect3dRenderModule, bindRectRenderModule, bindRichtextRenderModule, bindStarRenderModule, bindSymbolRenderModule, bindTextRenderModule, boundStroke, builtInSymbolStrMap, builtinSymbols, builtinSymbolsMap, calcLineCache, calculateArcCornerRadius, calculateLineHeight, canvasAllocate, centroidOfSubpath, circleBounds, circleModule, clock, colorEqual, colorStringInterpolationToStr, configureRuntimeApplicationForApp, container, cornerTangents, createBrowserApp as createApp, createArc, createArc3d, createArea, createBrowserApp, createCanvasEventTransformer, createCircle, createColor, createConicalGradient, createContributionProvider, createEventTransformer, createGlyph, createGraphic, createGroup, createImage, createLine, createMat4, createMiniappApp, createNodeApp, createPath, createPolygon, createPyramid3d, createRect, createRect3d, createRectPath, createRichText, createShadowRoot, createStage, createStar, createSymbol, createText, createWrapText, cubicCalc, cubicLength, cubicPointAt, cubicSubdivide, defaultArcAllocate, defaultArcBackgroundRenderContribution, defaultArcRenderContribution, defaultArcTextureRenderContribution, defaultAreaAllocate, defaultBaseBackgroundRenderContribution, defaultBaseClipRenderAfterContribution, defaultBaseClipRenderBeforeContribution, defaultBaseTextureRenderContribution, defaultCircleAllocate, defaultCircleBackgroundRenderContribution, defaultCircleRenderContribution, defaultCircleTextureRenderContribution, defaultGraphicMemoryManager, defaultGroupBackgroundRenderContribution, defaultImageBackgroundRenderContribution, defaultImageRenderContribution, defaultLineAllocate, defaultPathAllocate, defaultRectAllocate, defaultRectBackgroundRenderContribution, defaultRectRenderContribution, defaultRectTextureRenderContribution, defaultStarBackgroundRenderContribution, defaultStarTextureRenderContribution, defaultSymbolAllocate, defaultSymbolBackgroundRenderContribution, defaultSymbolClipRangeStrokeRenderContribution, defaultSymbolRenderContribution, defaultSymbolTextureRenderContribution, defaultTextAllocate, diff, divideCubic, drawArc, drawArcPath$1 as drawArcPath, drawAreaSegments, drawBackgroundImage, drawImageWithLayout, drawIncrementalAreaSegments, drawIncrementalSegments, drawSegments, enumCommandMap, fillVisible, findBestMorphingRotation, findConfigIndexByCursorIdx, findCursorIdxByConfigIndex, findNextGraphic, flatten_simplify, foreach, foreachAsync, genBasisSegments, genBasisTypeSegments, genLinearClosedSegments, genLinearClosedTypeSegments, genLinearSegments, genLinearTypeSegments, genMonotoneXSegments, genMonotoneXTypeSegments, genMonotoneYSegments, genMonotoneYTypeSegments, genNumberType, genStepClosedSegments, genStepSegments, genStepTypeSegments, getAttributeFromDefaultAttrList, getBackgroundImage, getConicGradientAt, getCurrentEnv, getDefaultCharacterConfig, getExtraModelMatrix, getLegacyBindingContext, getModelMatrix, getRichTextBounds, getRuntimeInstallerBindingContext, getRuntimeInstallerGlobal, getScaledStroke, getTextBounds, getTheme, getThemeFromGroup, globalTheme, glyphModule, graphicCreator, graphicService, graphicUtil, identityMat4, imageModule, incrementalAddTo, installRuntimeContributionModule, installRuntimeDrawContributionsToApp, installRuntimeGraphicRenderersToApp, installRuntimePickersToApp, interpolateColor, interpolateGradientConicalColor, interpolateGradientLinearColor, interpolateGradientRadialColor, interpolatePureColorArray, interpolatePureColorArrayToStr, intersect, isBrowserEnv, isNoRepeatSizingMode, isNodeEnv, isSvg, isXML, layerService, lineModule, lookAt, mapToCanvasPointForCanvas, mat3Tomat4, mat4Allocate, matrixAllocate, multiplyMat4Mat3, multiplyMat4Mat4, newThemeObj, ortho, parsePadding, parseStroke, parseSvgPath, pathModule, pathToBezierCurves, point$3 as point, pointEqual, pointInterpolation, pointInterpolationHighPerformance, pointsEqual, pointsInterpolation, polygonModule, preLoadAllModule, pyramid3dModule, quadCalc, quadLength, quadPointAt, rafBasedSto, rect3dModule, rectFillVisible, rectModule, rectStrokeVisible, recursiveCallBinarySplit, refreshRuntimeInstallerContributions, registerArc3dGraphic, registerArcGraphic, registerAreaGraphic, registerCircleGraphic, registerDirectionalLight, registerFlexLayoutPlugin, registerGlobalEventTransformer, registerGlyphGraphic, registerGraphic, registerGroupGraphic, registerHtmlAttributePlugin, registerImageGraphic, registerLineGraphic, registerOrthoCamera, registerPathGraphic, registerPolygonGraphic, registerPyramid3dGraphic, registerReactAttributePlugin, registerRect3dGraphic, registerRectGraphic, registerRichtextGraphic, registerShadowRootGraphic, registerStarGraphic, registerSymbolGraphic, registerTextGraphic, registerViewTransform3dPlugin, registerWindowEventTransformer, registerWrapTextGraphic, renderCommandList, resolveBackgroundDrawMode, resolveBackgroundParamsByImageSizing, resolveBackgroundPosition, resolveBackgroundSizing, resolveContainerBinding, resolveImageMode, resolveImageRepeatMode, resolveRenderableImageSize, rewriteProto, richtextModule, rotateX, rotateY, rotateZ, runFill, runStroke, scaleMat4, segments, shouldClipImageByLayout, shouldUseMat4, snapLength, splitArc, splitArea, splitCircle, splitLine, splitPath, splitPolygon, splitRect, splitToGrids, starModule, strCommandMap, strokeVisible, symbolModule, textAttributesToStyle, textDrawOffsetX, textDrawOffsetY, textLayoutOffsetY, textModule, transformMat4, transformPointForCanvas, transformUtil, translate, verticalLayout, vglobal, waitForAllSubLayers, wrapCanvas, wrapContext, xul };