@visactor/vrender-core 1.1.0-alpha.23 → 1.1.0-alpha.25

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 (402) hide show
  1. package/cjs/allocator/bounds-allocate.js +1 -2
  2. package/cjs/canvas/constants.js +2 -1
  3. package/cjs/common/bezier-utils.js +1 -2
  4. package/cjs/common/event-transformer.js +2 -1
  5. package/cjs/common/module-guard.d.ts +1 -0
  6. package/cjs/common/module-guard.js +11 -0
  7. package/cjs/common/module-guard.js.map +1 -0
  8. package/cjs/common/performance-raf.js +1 -2
  9. package/cjs/common/rect-utils.js +1 -1
  10. package/cjs/common/render-area.js +1 -1
  11. package/cjs/common/render-command-list.js +1 -1
  12. package/cjs/common/render-curve.js +1 -1
  13. package/cjs/common/render-utils.js +1 -1
  14. package/cjs/common/seg-context.js +1 -1
  15. package/cjs/container.d.ts +2 -0
  16. package/cjs/container.js +50 -0
  17. package/cjs/container.js.map +1 -0
  18. package/cjs/core/application.js +1 -1
  19. package/cjs/core/camera.js +1 -1
  20. package/cjs/core/constants.js +1 -1
  21. package/cjs/core/core-modules.js +1 -1
  22. package/cjs/core/global-module.js +2 -0
  23. package/cjs/core/global.js +1 -1
  24. package/cjs/core/graphic-utils.js +1 -1
  25. package/cjs/core/index.js +1 -1
  26. package/cjs/core/layer-service.js +2 -1
  27. package/cjs/core/layer.js +1 -1
  28. package/cjs/core/light.js +1 -1
  29. package/cjs/core/stage.d.ts +0 -9
  30. package/cjs/core/stage.js +12 -30
  31. package/cjs/core/stage.js.map +1 -1
  32. package/cjs/core/window.js +1 -1
  33. package/cjs/entries/miniapp.d.ts +0 -1
  34. package/cjs/entries/miniapp.js +1 -5
  35. package/cjs/entries/miniapp.js.map +1 -1
  36. package/cjs/entries/node.d.ts +0 -1
  37. package/cjs/entries/node.js +1 -5
  38. package/cjs/entries/node.js.map +1 -1
  39. package/cjs/env.d.ts +1 -0
  40. package/cjs/env.js +25 -0
  41. package/cjs/env.js.map +1 -0
  42. package/cjs/event/public-constant.d.ts +7 -0
  43. package/cjs/event/public-constant.js +100 -0
  44. package/cjs/event/public-constant.js.map +1 -0
  45. package/cjs/event/util.d.ts +1 -1
  46. package/cjs/graphic/arc.js +6 -4
  47. package/cjs/graphic/arc.js.map +1 -1
  48. package/cjs/graphic/base.d.ts +2 -0
  49. package/cjs/graphic/base.js +15 -0
  50. package/cjs/graphic/base.js.map +1 -0
  51. package/cjs/graphic/config.js +1 -0
  52. package/cjs/graphic/config.js.map +1 -1
  53. package/cjs/graphic/creator.d.ts +16 -0
  54. package/cjs/graphic/creator.js +160 -0
  55. package/cjs/graphic/creator.js.map +1 -0
  56. package/cjs/graphic/glyph.js +4 -8
  57. package/cjs/graphic/glyph.js.map +1 -1
  58. package/cjs/graphic/graphic.d.ts +19 -28
  59. package/cjs/graphic/graphic.js +122 -193
  60. package/cjs/graphic/graphic.js.map +1 -1
  61. package/cjs/graphic/group.d.ts +1 -3
  62. package/cjs/graphic/group.js +22 -28
  63. package/cjs/graphic/group.js.map +1 -1
  64. package/cjs/graphic/modules.d.ts +16 -0
  65. package/cjs/graphic/modules.js +150 -0
  66. package/cjs/graphic/modules.js.map +1 -0
  67. package/cjs/graphic/node-tree.d.ts +3 -3
  68. package/cjs/graphic/node-tree.js +1 -0
  69. package/cjs/graphic/node-tree.js.map +1 -1
  70. package/cjs/graphic/state/shared-state-refresh.js +11 -32
  71. package/cjs/graphic/state/shared-state-refresh.js.map +1 -1
  72. package/cjs/graphic/state/shared-state-scope.d.ts +2 -5
  73. package/cjs/graphic/state/shared-state-scope.js +8 -27
  74. package/cjs/graphic/state/shared-state-scope.js.map +1 -1
  75. package/cjs/graphic/state/state-definition-compiler.js +4 -5
  76. package/cjs/graphic/state/state-definition-compiler.js.map +1 -1
  77. package/cjs/graphic/state/state-definition.d.ts +2 -5
  78. package/cjs/graphic/state/state-definition.js.map +1 -1
  79. package/cjs/graphic/state/state-engine.d.ts +0 -5
  80. package/cjs/graphic/state/state-engine.js +20 -70
  81. package/cjs/graphic/state/state-engine.js.map +1 -1
  82. package/cjs/graphic/state/state-transition-orchestrator.d.ts +7 -9
  83. package/cjs/graphic/state/state-transition-orchestrator.js +10 -13
  84. package/cjs/graphic/state/state-transition-orchestrator.js.map +1 -1
  85. package/cjs/interface/graphic/arc.d.ts +1 -0
  86. package/cjs/interface/graphic/arc.js.map +1 -1
  87. package/cjs/interface/graphic/group.d.ts +0 -2
  88. package/cjs/interface/graphic/group.js.map +1 -1
  89. package/cjs/interface/graphic.d.ts +1 -5
  90. package/cjs/interface/graphic.js.map +1 -1
  91. package/cjs/interface/index.js.map +1 -1
  92. package/cjs/interface/node-tree.d.ts +3 -0
  93. package/cjs/interface/node-tree.js.map +1 -1
  94. package/cjs/interface/stage.d.ts +0 -7
  95. package/cjs/interface/stage.js.map +1 -1
  96. package/cjs/interpolate.d.ts +2 -0
  97. package/cjs/interpolate.js +34 -0
  98. package/cjs/interpolate.js.map +1 -0
  99. package/cjs/modules.js.map +1 -1
  100. package/cjs/path.d.ts +4 -0
  101. package/cjs/path.js +33 -0
  102. package/cjs/path.js.map +1 -0
  103. package/cjs/plugin/3d.d.ts +3 -0
  104. package/cjs/plugin/3d.js +33 -0
  105. package/cjs/plugin/3d.js.map +1 -0
  106. package/cjs/plugin/attribute.d.ts +2 -0
  107. package/cjs/plugin/attribute.js +24 -0
  108. package/cjs/plugin/attribute.js.map +1 -0
  109. package/cjs/plugin/flex-layout.d.ts +1 -0
  110. package/cjs/plugin/flex-layout.js +15 -0
  111. package/cjs/plugin/flex-layout.js.map +1 -0
  112. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js +8 -8
  113. package/cjs/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  114. package/cjs/plugins/index.d.ts +0 -4
  115. package/cjs/plugins/index.js +1 -3
  116. package/cjs/plugins/index.js.map +1 -1
  117. package/cjs/plugins/plugin-service.d.ts +0 -1
  118. package/cjs/plugins/plugin-service.js +2 -3
  119. package/cjs/plugins/plugin-service.js.map +1 -1
  120. package/cjs/plugins/types.d.ts +1 -8
  121. package/cjs/plugins/types.js.map +1 -1
  122. package/cjs/register/graphic.d.ts +19 -0
  123. package/cjs/register/graphic.js +177 -0
  124. package/cjs/register/graphic.js.map +1 -0
  125. package/cjs/registry/contribution-registry.d.ts +0 -1
  126. package/cjs/registry/contribution-registry.js +0 -3
  127. package/cjs/registry/contribution-registry.js.map +1 -1
  128. package/cjs/registry/picker-registry.d.ts +0 -1
  129. package/cjs/registry/picker-registry.js +0 -3
  130. package/cjs/registry/picker-registry.js.map +1 -1
  131. package/cjs/registry/renderer-registry.d.ts +0 -1
  132. package/cjs/registry/renderer-registry.js +0 -3
  133. package/cjs/registry/renderer-registry.js.map +1 -1
  134. package/cjs/registry/types.d.ts +0 -3
  135. package/cjs/registry/types.js.map +1 -1
  136. package/cjs/render/contributions/render/arc-module.js +2 -4
  137. package/cjs/render/contributions/render/arc-module.js.map +1 -1
  138. package/cjs/render/contributions/render/arc3d-module.js +2 -4
  139. package/cjs/render/contributions/render/arc3d-module.js.map +1 -1
  140. package/cjs/render/contributions/render/area-module.js +2 -4
  141. package/cjs/render/contributions/render/area-module.js.map +1 -1
  142. package/cjs/render/contributions/render/circle-module.js +2 -4
  143. package/cjs/render/contributions/render/circle-module.js.map +1 -1
  144. package/cjs/render/contributions/render/glyph-module.js +2 -4
  145. package/cjs/render/contributions/render/glyph-module.js.map +1 -1
  146. package/cjs/render/contributions/render/image-module.js +2 -4
  147. package/cjs/render/contributions/render/image-module.js.map +1 -1
  148. package/cjs/render/contributions/render/line-module.js +2 -4
  149. package/cjs/render/contributions/render/line-module.js.map +1 -1
  150. package/cjs/render/contributions/render/path-module.js +2 -4
  151. package/cjs/render/contributions/render/path-module.js.map +1 -1
  152. package/cjs/render/contributions/render/polygon-module.js +2 -4
  153. package/cjs/render/contributions/render/polygon-module.js.map +1 -1
  154. package/cjs/render/contributions/render/pyramid3d-module.js +2 -4
  155. package/cjs/render/contributions/render/pyramid3d-module.js.map +1 -1
  156. package/cjs/render/contributions/render/rect-module.js +2 -4
  157. package/cjs/render/contributions/render/rect-module.js.map +1 -1
  158. package/cjs/render/contributions/render/rect3d-module.js +2 -4
  159. package/cjs/render/contributions/render/rect3d-module.js.map +1 -1
  160. package/cjs/render/contributions/render/richtext-module.js +2 -4
  161. package/cjs/render/contributions/render/richtext-module.js.map +1 -1
  162. package/cjs/render/contributions/render/star-module.js +2 -4
  163. package/cjs/render/contributions/render/star-module.js.map +1 -1
  164. package/cjs/render/contributions/render/symbol-module.js +2 -4
  165. package/cjs/render/contributions/render/symbol-module.js.map +1 -1
  166. package/cjs/render/contributions/render/text-module.js +2 -4
  167. package/cjs/render/contributions/render/text-module.js.map +1 -1
  168. package/cjs/svg.d.ts +1 -0
  169. package/cjs/svg.js +15 -0
  170. package/cjs/svg.js.map +1 -0
  171. package/cjs/text.d.ts +2 -0
  172. package/cjs/text.js +29 -0
  173. package/cjs/text.js.map +1 -0
  174. package/dist/index.es.js +328 -1630
  175. package/es/allocator/bounds-allocate.js +1 -2
  176. package/es/canvas/constants.js +2 -1
  177. package/es/common/bezier-utils.js +1 -2
  178. package/es/common/event-transformer.js +2 -1
  179. package/es/common/module-guard.d.ts +1 -0
  180. package/es/common/module-guard.js +5 -0
  181. package/es/common/module-guard.js.map +1 -0
  182. package/es/common/performance-raf.js +1 -2
  183. package/es/common/rect-utils.js +1 -1
  184. package/es/common/render-area.js +1 -1
  185. package/es/common/render-command-list.js +1 -1
  186. package/es/common/render-curve.js +1 -1
  187. package/es/common/render-utils.js +1 -1
  188. package/es/common/seg-context.js +1 -1
  189. package/es/container.d.ts +2 -0
  190. package/es/container.js +2 -0
  191. package/es/container.js.map +1 -0
  192. package/es/core/application.js +1 -1
  193. package/es/core/camera.js +1 -1
  194. package/es/core/constants.js +1 -1
  195. package/es/core/core-modules.js +1 -1
  196. package/es/core/global-module.js +2 -0
  197. package/es/core/global.js +1 -1
  198. package/es/core/graphic-utils.js +1 -1
  199. package/es/core/index.js +1 -1
  200. package/es/core/layer-service.js +2 -1
  201. package/es/core/layer.js +1 -1
  202. package/es/core/light.js +1 -1
  203. package/es/core/stage.d.ts +0 -9
  204. package/es/core/stage.js +10 -31
  205. package/es/core/stage.js.map +1 -1
  206. package/es/core/window.js +1 -1
  207. package/es/entries/miniapp.d.ts +0 -1
  208. package/es/entries/miniapp.js +1 -5
  209. package/es/entries/miniapp.js.map +1 -1
  210. package/es/entries/node.d.ts +0 -1
  211. package/es/entries/node.js +1 -5
  212. package/es/entries/node.js.map +1 -1
  213. package/es/env.d.ts +1 -0
  214. package/es/env.js +2 -0
  215. package/es/env.js.map +1 -0
  216. package/es/event/public-constant.d.ts +7 -0
  217. package/es/event/public-constant.js +12 -0
  218. package/es/event/public-constant.js.map +1 -0
  219. package/es/event/util.d.ts +1 -1
  220. package/es/graphic/arc.js +5 -4
  221. package/es/graphic/arc.js.map +1 -1
  222. package/es/graphic/base.d.ts +2 -0
  223. package/es/graphic/base.js +2 -0
  224. package/es/graphic/base.js.map +1 -0
  225. package/es/graphic/config.js +1 -0
  226. package/es/graphic/config.js.map +1 -1
  227. package/es/graphic/creator.d.ts +16 -0
  228. package/es/graphic/creator.js +32 -0
  229. package/es/graphic/creator.js.map +1 -0
  230. package/es/graphic/glyph.js +4 -8
  231. package/es/graphic/glyph.js.map +1 -1
  232. package/es/graphic/graphic.d.ts +19 -28
  233. package/es/graphic/graphic.js +121 -198
  234. package/es/graphic/graphic.js.map +1 -1
  235. package/es/graphic/group.d.ts +1 -3
  236. package/es/graphic/group.js +22 -28
  237. package/es/graphic/group.js.map +1 -1
  238. package/es/graphic/modules.d.ts +16 -0
  239. package/es/graphic/modules.js +32 -0
  240. package/es/graphic/modules.js.map +1 -0
  241. package/es/graphic/node-tree.d.ts +3 -3
  242. package/es/graphic/node-tree.js +1 -0
  243. package/es/graphic/node-tree.js.map +1 -1
  244. package/es/graphic/state/shared-state-refresh.js +8 -28
  245. package/es/graphic/state/shared-state-refresh.js.map +1 -1
  246. package/es/graphic/state/shared-state-scope.d.ts +2 -5
  247. package/es/graphic/state/shared-state-scope.js +7 -28
  248. package/es/graphic/state/shared-state-scope.js.map +1 -1
  249. package/es/graphic/state/state-definition-compiler.js +4 -5
  250. package/es/graphic/state/state-definition-compiler.js.map +1 -1
  251. package/es/graphic/state/state-definition.d.ts +2 -5
  252. package/es/graphic/state/state-definition.js.map +1 -1
  253. package/es/graphic/state/state-engine.d.ts +0 -5
  254. package/es/graphic/state/state-engine.js +17 -67
  255. package/es/graphic/state/state-engine.js.map +1 -1
  256. package/es/graphic/state/state-transition-orchestrator.d.ts +7 -9
  257. package/es/graphic/state/state-transition-orchestrator.js +10 -13
  258. package/es/graphic/state/state-transition-orchestrator.js.map +1 -1
  259. package/es/interface/graphic/arc.d.ts +1 -0
  260. package/es/interface/graphic/arc.js.map +1 -1
  261. package/es/interface/graphic/group.d.ts +0 -2
  262. package/es/interface/graphic/group.js.map +1 -1
  263. package/es/interface/graphic.d.ts +1 -5
  264. package/es/interface/graphic.js.map +1 -1
  265. package/es/interface/index.js.map +1 -1
  266. package/es/interface/node-tree.d.ts +3 -0
  267. package/es/interface/node-tree.js.map +1 -1
  268. package/es/interface/stage.d.ts +0 -7
  269. package/es/interface/stage.js.map +1 -1
  270. package/es/interpolate.d.ts +2 -0
  271. package/es/interpolate.js +4 -0
  272. package/es/interpolate.js.map +1 -0
  273. package/es/modules.js.map +1 -1
  274. package/es/path.d.ts +4 -0
  275. package/es/path.js +6 -0
  276. package/es/path.js.map +1 -0
  277. package/es/plugin/3d.d.ts +3 -0
  278. package/es/plugin/3d.js +6 -0
  279. package/es/plugin/3d.js.map +1 -0
  280. package/es/plugin/attribute.d.ts +2 -0
  281. package/es/plugin/attribute.js +4 -0
  282. package/es/plugin/attribute.js.map +1 -0
  283. package/es/plugin/flex-layout.d.ts +1 -0
  284. package/es/plugin/flex-layout.js +2 -0
  285. package/es/plugin/flex-layout.js.map +1 -0
  286. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js +8 -8
  287. package/es/plugins/builtin-plugin/dirty-bounds-plugin.js.map +1 -1
  288. package/es/plugins/index.d.ts +0 -4
  289. package/es/plugins/index.js +0 -8
  290. package/es/plugins/index.js.map +1 -1
  291. package/es/plugins/plugin-service.d.ts +0 -1
  292. package/es/plugins/plugin-service.js +2 -3
  293. package/es/plugins/plugin-service.js.map +1 -1
  294. package/es/plugins/types.d.ts +1 -8
  295. package/es/plugins/types.js.map +1 -1
  296. package/es/register/graphic.d.ts +19 -0
  297. package/es/register/graphic.js +38 -0
  298. package/es/register/graphic.js.map +1 -0
  299. package/es/registry/contribution-registry.d.ts +0 -1
  300. package/es/registry/contribution-registry.js +0 -3
  301. package/es/registry/contribution-registry.js.map +1 -1
  302. package/es/registry/picker-registry.d.ts +0 -1
  303. package/es/registry/picker-registry.js +0 -3
  304. package/es/registry/picker-registry.js.map +1 -1
  305. package/es/registry/renderer-registry.d.ts +0 -1
  306. package/es/registry/renderer-registry.js +0 -3
  307. package/es/registry/renderer-registry.js.map +1 -1
  308. package/es/registry/types.d.ts +0 -3
  309. package/es/registry/types.js.map +1 -1
  310. package/es/render/contributions/render/arc-module.js +4 -2
  311. package/es/render/contributions/render/arc-module.js.map +1 -1
  312. package/es/render/contributions/render/arc3d-module.js +4 -2
  313. package/es/render/contributions/render/arc3d-module.js.map +1 -1
  314. package/es/render/contributions/render/area-module.js +4 -2
  315. package/es/render/contributions/render/area-module.js.map +1 -1
  316. package/es/render/contributions/render/circle-module.js +4 -2
  317. package/es/render/contributions/render/circle-module.js.map +1 -1
  318. package/es/render/contributions/render/glyph-module.js +4 -2
  319. package/es/render/contributions/render/glyph-module.js.map +1 -1
  320. package/es/render/contributions/render/image-module.js +4 -2
  321. package/es/render/contributions/render/image-module.js.map +1 -1
  322. package/es/render/contributions/render/line-module.js +4 -2
  323. package/es/render/contributions/render/line-module.js.map +1 -1
  324. package/es/render/contributions/render/path-module.js +4 -2
  325. package/es/render/contributions/render/path-module.js.map +1 -1
  326. package/es/render/contributions/render/polygon-module.js +4 -2
  327. package/es/render/contributions/render/polygon-module.js.map +1 -1
  328. package/es/render/contributions/render/pyramid3d-module.js +4 -2
  329. package/es/render/contributions/render/pyramid3d-module.js.map +1 -1
  330. package/es/render/contributions/render/rect-module.js +4 -2
  331. package/es/render/contributions/render/rect-module.js.map +1 -1
  332. package/es/render/contributions/render/rect3d-module.js +4 -2
  333. package/es/render/contributions/render/rect3d-module.js.map +1 -1
  334. package/es/render/contributions/render/richtext-module.js +4 -2
  335. package/es/render/contributions/render/richtext-module.js.map +1 -1
  336. package/es/render/contributions/render/star-module.js +4 -2
  337. package/es/render/contributions/render/star-module.js.map +1 -1
  338. package/es/render/contributions/render/symbol-module.js +4 -2
  339. package/es/render/contributions/render/symbol-module.js.map +1 -1
  340. package/es/render/contributions/render/text-module.js +4 -2
  341. package/es/render/contributions/render/text-module.js.map +1 -1
  342. package/es/svg.d.ts +1 -0
  343. package/es/svg.js +2 -0
  344. package/es/svg.js.map +1 -0
  345. package/es/text.d.ts +2 -0
  346. package/es/text.js +4 -0
  347. package/es/text.js.map +1 -0
  348. package/package.json +245 -1
  349. package/cjs/graphic/state/state-batch-scheduler.d.ts +0 -42
  350. package/cjs/graphic/state/state-batch-scheduler.js +0 -285
  351. package/cjs/graphic/state/state-batch-scheduler.js.map +0 -1
  352. package/cjs/graphic/state/state-model.d.ts +0 -43
  353. package/cjs/graphic/state/state-model.js +0 -143
  354. package/cjs/graphic/state/state-model.js.map +0 -1
  355. package/cjs/graphic/state/state-perf-monitor.d.ts +0 -120
  356. package/cjs/graphic/state/state-perf-monitor.js +0 -224
  357. package/cjs/graphic/state/state-perf-monitor.js.map +0 -1
  358. package/cjs/graphic/state/state-style-resolver.d.ts +0 -13
  359. package/cjs/graphic/state/state-style-resolver.js +0 -50
  360. package/cjs/graphic/state/state-style-resolver.js.map +0 -1
  361. package/cjs/interface/animate.d.ts +0 -1
  362. package/cjs/interface/animate.js +0 -3
  363. package/cjs/interface/animate.js.map +0 -1
  364. package/cjs/plugins/base-plugin.d.ts +0 -8
  365. package/cjs/plugins/base-plugin.js +0 -15
  366. package/cjs/plugins/base-plugin.js.map +0 -1
  367. package/cjs/plugins/browser-env-plugin.d.ts +0 -8
  368. package/cjs/plugins/browser-env-plugin.js +0 -24
  369. package/cjs/plugins/browser-env-plugin.js.map +0 -1
  370. package/cjs/plugins/picker-plugin.d.ts +0 -7
  371. package/cjs/plugins/picker-plugin.js +0 -19
  372. package/cjs/plugins/picker-plugin.js.map +0 -1
  373. package/cjs/plugins/renderer-plugin.d.ts +0 -7
  374. package/cjs/plugins/renderer-plugin.js +0 -19
  375. package/cjs/plugins/renderer-plugin.js.map +0 -1
  376. package/es/graphic/state/state-batch-scheduler.d.ts +0 -42
  377. package/es/graphic/state/state-batch-scheduler.js +0 -278
  378. package/es/graphic/state/state-batch-scheduler.js.map +0 -1
  379. package/es/graphic/state/state-model.d.ts +0 -43
  380. package/es/graphic/state/state-model.js +0 -135
  381. package/es/graphic/state/state-model.js.map +0 -1
  382. package/es/graphic/state/state-perf-monitor.d.ts +0 -120
  383. package/es/graphic/state/state-perf-monitor.js +0 -214
  384. package/es/graphic/state/state-perf-monitor.js.map +0 -1
  385. package/es/graphic/state/state-style-resolver.d.ts +0 -13
  386. package/es/graphic/state/state-style-resolver.js +0 -42
  387. package/es/graphic/state/state-style-resolver.js.map +0 -1
  388. package/es/interface/animate.d.ts +0 -1
  389. package/es/interface/animate.js +0 -3
  390. package/es/interface/animate.js.map +0 -1
  391. package/es/plugins/base-plugin.d.ts +0 -8
  392. package/es/plugins/base-plugin.js +0 -7
  393. package/es/plugins/base-plugin.js.map +0 -1
  394. package/es/plugins/browser-env-plugin.d.ts +0 -8
  395. package/es/plugins/browser-env-plugin.js +0 -16
  396. package/es/plugins/browser-env-plugin.js.map +0 -1
  397. package/es/plugins/picker-plugin.d.ts +0 -7
  398. package/es/plugins/picker-plugin.js +0 -11
  399. package/es/plugins/picker-plugin.js.map +0 -1
  400. package/es/plugins/renderer-plugin.d.ts +0 -7
  401. package/es/plugins/renderer-plugin.js +0 -11
  402. package/es/plugins/renderer-plugin.js.map +0 -1
package/dist/index.es.js CHANGED
@@ -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' });
@@ -9024,7 +9027,7 @@ function createConicalGradient(context, stops, x, y, deltaAngle, startAngle, end
9024
9027
  return pattern;
9025
9028
  }
9026
9029
 
9027
- const FULL_DEFINITION_KEYS$1 = new Set([
9030
+ const FULL_DEFINITION_KEYS = new Set([
9028
9031
  'name',
9029
9032
  'patch',
9030
9033
  'priority',
@@ -9033,7 +9036,7 @@ const FULL_DEFINITION_KEYS$1 = new Set([
9033
9036
  'resolver',
9034
9037
  'declaredAffectedKeys'
9035
9038
  ]);
9036
- function isPlainObject$2(value) {
9039
+ function isPlainObject$1(value) {
9037
9040
  return value != null && typeof value === 'object' && !Array.isArray(value);
9038
9041
  }
9039
9042
  function normalizePatch(value) {
@@ -9095,14 +9098,13 @@ class StateDefinitionCompiler {
9095
9098
  patch: undefined
9096
9099
  };
9097
9100
  }
9098
- const keys = isPlainObject$2(value) ? Object.keys(value) : [];
9099
- const hasFullKey = keys.some(key => FULL_DEFINITION_KEYS$1.has(key));
9101
+ const keys = isPlainObject$1(value) ? Object.keys(value) : [];
9102
+ const hasFullKey = keys.some(key => FULL_DEFINITION_KEYS.has(key));
9100
9103
  if (hasFullKey) {
9101
9104
  const definition = value;
9102
9105
  return {
9103
9106
  name: (_a = definition.name) !== null && _a !== void 0 ? _a : name,
9104
9107
  priority: (_b = definition.priority) !== null && _b !== void 0 ? _b : 0,
9105
- rank: definition.rank,
9106
9108
  patch: normalizePatch(definition.patch),
9107
9109
  resolver: definition.resolver,
9108
9110
  declaredAffectedKeys: definition.declaredAffectedKeys,
@@ -9123,425 +9125,54 @@ class StateDefinitionCompiler {
9123
9125
  });
9124
9126
  compiled.forEach((definition, origin) => {
9125
9127
  const closure = new Set();
9126
- const walk = (stateName, stack) => {
9128
+ const walk = (stateName, visiting) => {
9127
9129
  const nextStates = rawRelationMap.get(stateName);
9128
9130
  if (!nextStates || !nextStates.size) {
9129
9131
  return;
9130
9132
  }
9131
9133
  nextStates.forEach(nextState => {
9132
- if (nextState === origin) {
9133
- console.warn(`[StateDefinitionCompiler] circular ${relation} relation detected: ${stack.join(' -> ')} -> ${origin}`);
9134
- return;
9135
- }
9136
- if (stack.includes(nextState)) {
9137
- console.warn(`[StateDefinitionCompiler] circular ${relation} relation detected: ${stack.join(' -> ')} -> ${nextState}`);
9138
- return;
9139
- }
9140
- if (closure.has(nextState)) {
9134
+ if (nextState === origin || visiting.has(nextState) || closure.has(nextState)) {
9141
9135
  return;
9142
9136
  }
9143
9137
  closure.add(nextState);
9144
- walk(nextState, stack.concat(nextState));
9138
+ visiting.add(nextState);
9139
+ walk(nextState, visiting);
9140
+ visiting.delete(nextState);
9145
9141
  });
9146
9142
  };
9147
- walk(origin, [origin]);
9143
+ walk(origin, new Set([origin]));
9148
9144
  definition[relation] = closure;
9149
9145
  });
9150
9146
  }
9151
9147
  }
9152
9148
 
9153
- var UpdateCategory;
9154
- (function (UpdateCategory) {
9155
- UpdateCategory[UpdateCategory["NONE"] = 0] = "NONE";
9156
- UpdateCategory[UpdateCategory["PAINT"] = 1] = "PAINT";
9157
- UpdateCategory[UpdateCategory["SHAPE"] = 2] = "SHAPE";
9158
- UpdateCategory[UpdateCategory["BOUNDS"] = 4] = "BOUNDS";
9159
- UpdateCategory[UpdateCategory["TRANSFORM"] = 8] = "TRANSFORM";
9160
- UpdateCategory[UpdateCategory["LAYOUT"] = 16] = "LAYOUT";
9161
- UpdateCategory[UpdateCategory["PICK"] = 32] = "PICK";
9162
- })(UpdateCategory || (UpdateCategory = {}));
9163
- const ATTRIBUTE_CATEGORY = {
9164
- fill: UpdateCategory.PAINT,
9165
- opacity: UpdateCategory.PAINT,
9166
- fillOpacity: UpdateCategory.PAINT,
9167
- strokeOpacity: UpdateCategory.PAINT,
9168
- lineDash: UpdateCategory.PAINT,
9169
- lineDashOffset: UpdateCategory.PAINT,
9170
- lineCap: UpdateCategory.PAINT,
9171
- lineJoin: UpdateCategory.PAINT,
9172
- miterLimit: UpdateCategory.PAINT,
9173
- shadowColor: UpdateCategory.PAINT,
9174
- x: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9175
- y: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9176
- scaleX: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9177
- scaleY: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9178
- angle: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9179
- anchor: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9180
- anchor3d: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9181
- postMatrix: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9182
- layout: UpdateCategory.LAYOUT,
9183
- zIndex: UpdateCategory.PAINT,
9184
- visible: UpdateCategory.PAINT | UpdateCategory.PICK,
9185
- lineWidth: UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.PICK,
9186
- width: UpdateCategory.SHAPE | UpdateCategory.BOUNDS,
9187
- height: UpdateCategory.SHAPE | UpdateCategory.BOUNDS
9188
- };
9189
- const ATTRIBUTE_DELTA_CLASSIFIER = {
9190
- stroke: (prev, next) => {
9191
- const prevEnabled = prev != null && prev !== false;
9192
- const nextEnabled = next != null && next !== false;
9193
- if (prevEnabled !== nextEnabled) {
9194
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK;
9195
- }
9196
- return UpdateCategory.PAINT;
9197
- },
9198
- shadowBlur: (prev, next) => {
9199
- const prevBlur = Number(prev !== null && prev !== void 0 ? prev : 0);
9200
- const nextBlur = Number(next !== null && next !== void 0 ? next : 0);
9201
- if (prevBlur !== nextBlur && (prevBlur > 0 || nextBlur > 0)) {
9202
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS;
9203
- }
9204
- return UpdateCategory.PAINT;
9205
- }
9206
- };
9207
- function classifyAttributeDelta(key, prev, next) {
9208
- var _a;
9209
- const dynamicClassifier = ATTRIBUTE_DELTA_CLASSIFIER[key];
9210
- if (dynamicClassifier) {
9211
- return dynamicClassifier(prev, next);
9212
- }
9213
- return (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
9214
- }
9215
- function classifyAffectedKeyConservatively(key) {
9216
- var _a;
9217
- if (key === 'stroke') {
9218
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK;
9219
- }
9220
- if (key === 'shadowBlur') {
9221
- return UpdateCategory.PAINT | UpdateCategory.BOUNDS;
9222
- }
9223
- return (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
9224
- }
9225
- function classifyAffectedKeys(keys) {
9226
- let category = UpdateCategory.NONE;
9227
- for (const key of keys) {
9228
- category |= classifyAffectedKeyConservatively(key);
9229
- }
9230
- return category;
9231
- }
9232
-
9233
- const DEFAULT_MAX_EVENT_RECORDS = 100;
9234
- const STAGE_PERF_MONITOR = Symbol('vrender.statePerfMonitor');
9235
- function createReasonBreakdown() {
9236
- return {
9237
- config_disabled: 0,
9238
- context_disabled: 0,
9239
- non_batch_operation: 0,
9240
- mixed_update_category: 0,
9241
- resolver_unstable_keys: 0,
9242
- graphic_unavailable: 0
9243
- };
9244
- }
9245
- function createEmptyStatePerfSnapshot() {
9246
- return {
9247
- counters: {
9248
- stateCommits: 0,
9249
- sharedRefreshCommits: 0,
9250
- deferredJobsCreated: 0,
9251
- deferredJobsCompleted: 0,
9252
- deferredJobsCancelled: 0,
9253
- deferredJobsCoalesced: 0,
9254
- deferredGraphicsCommitted: 0,
9255
- deferredBudgetYields: 0,
9256
- deferredIneligibleGraphics: 0
9257
- },
9258
- deferredIneligibleByReason: createReasonBreakdown(),
9259
- categoryBreakdown: {
9260
- paint: 0,
9261
- transform: 0,
9262
- shape: 0,
9263
- bounds: 0,
9264
- layout: 0,
9265
- pick: 0
9266
- },
9267
- refresh: {
9268
- queuedGraphics: 0,
9269
- flushedGraphics: 0,
9270
- ensureFreshCalls: 0,
9271
- renderScheduled: 0
9272
- },
9273
- resolver: {
9274
- cacheHits: 0,
9275
- cacheMisses: 0,
9276
- invalidations: 0
9277
- },
9278
- cost: {
9279
- resolverTotalMs: 0,
9280
- resolverMaxMs: 0,
9281
- patchTotalMs: 0,
9282
- patchMaxMs: 0,
9283
- sharedRefreshTotalMs: 0,
9284
- sharedRefreshMaxMs: 0,
9285
- batchSliceTotalMs: 0,
9286
- batchSliceMaxMs: 0
9287
- },
9288
- allocationHints: {
9289
- patchObjectsCreated: 0,
9290
- batchEntriesCreated: 0,
9291
- refreshQueuePushes: 0
9292
- },
9293
- batch: {
9294
- pendingJobs: 0,
9295
- maxPendingJobs: 0,
9296
- maxGraphicsInJob: 0,
9297
- maxFrameSliceCost: 0
9298
- },
9299
- events: []
9300
- };
9301
- }
9302
- function cloneSnapshot(snapshot) {
9303
- return {
9304
- counters: Object.assign({}, snapshot.counters),
9305
- deferredIneligibleByReason: Object.assign({}, snapshot.deferredIneligibleByReason),
9306
- categoryBreakdown: Object.assign({}, snapshot.categoryBreakdown),
9307
- refresh: Object.assign({}, snapshot.refresh),
9308
- resolver: Object.assign({}, snapshot.resolver),
9309
- cost: Object.assign({}, snapshot.cost),
9310
- allocationHints: Object.assign({}, snapshot.allocationHints),
9311
- batch: Object.assign({}, snapshot.batch),
9312
- events: snapshot.events ? snapshot.events.slice() : []
9313
- };
9314
- }
9315
- function isDeferredStateContextConfig(value) {
9316
- return (!!value &&
9317
- (Object.prototype.hasOwnProperty.call(value, 'deferred') ||
9318
- Object.prototype.hasOwnProperty.call(value, 'localEnabled')));
9319
- }
9320
- function normalizeDeferredStateOwnerConfig(value) {
9321
- if (!value) {
9322
- return undefined;
9323
- }
9324
- if (isDeferredStateContextConfig(value)) {
9325
- return value;
9326
- }
9327
- return {
9328
- deferred: value
9329
- };
9330
- }
9331
- function normalizeDeferredStateConfig(config) {
9332
- var _a, _b, _c;
9333
- return {
9334
- enabled: (_a = config === null || config === void 0 ? void 0 : config.enabled) !== null && _a !== void 0 ? _a : false,
9335
- frameBudget: (_b = config === null || config === void 0 ? void 0 : config.frameBudget) !== null && _b !== void 0 ? _b : 8,
9336
- maxGraphicsPerFrame: (_c = config === null || config === void 0 ? void 0 : config.maxGraphicsPerFrame) !== null && _c !== void 0 ? _c : 100
9337
- };
9338
- }
9339
- function fingerprintDeferredStateConfig(config) {
9340
- return `${config.enabled ? 1 : 0}:${config.frameBudget}:${config.maxGraphicsPerFrame}`;
9341
- }
9342
- class StatePerfMonitor {
9343
- constructor(configSource) {
9344
- this.configSource = configSource;
9345
- this.snapshot = createEmptyStatePerfSnapshot();
9346
- }
9347
- setConfig(config) {
9348
- this.configSource = config;
9349
- }
9350
- getSnapshot() {
9351
- return cloneSnapshot(this.snapshot);
9352
- }
9353
- reset() {
9354
- const next = createEmptyStatePerfSnapshot();
9355
- Object.assign(this.snapshot.counters, next.counters);
9356
- Object.assign(this.snapshot.deferredIneligibleByReason, next.deferredIneligibleByReason);
9357
- Object.assign(this.snapshot.categoryBreakdown, next.categoryBreakdown);
9358
- Object.assign(this.snapshot.refresh, next.refresh);
9359
- Object.assign(this.snapshot.resolver, next.resolver);
9360
- Object.assign(this.snapshot.cost, next.cost);
9361
- Object.assign(this.snapshot.allocationHints, next.allocationHints);
9362
- Object.assign(this.snapshot.batch, next.batch);
9363
- this.snapshot.events = [];
9364
- }
9365
- incrementCounter(key, delta = 1) {
9366
- if (!this.isEnabled()) {
9367
- return;
9368
- }
9369
- this.snapshot.counters[key] += delta;
9370
- }
9371
- recordDeferredIneligible(reason, delta = 1) {
9372
- if (!this.isEnabled()) {
9373
- return;
9374
- }
9375
- this.snapshot.deferredIneligibleByReason[reason] += delta;
9376
- this.snapshot.counters.deferredIneligibleGraphics += delta;
9377
- this.recordEvent('deferred-ineligible', { reason, count: delta });
9378
- }
9379
- recordCategory(category) {
9380
- if (!this.isEnabled()) {
9381
- return;
9382
- }
9383
- if (category & UpdateCategory.PAINT) {
9384
- this.snapshot.categoryBreakdown.paint += 1;
9385
- }
9386
- if (category & UpdateCategory.TRANSFORM) {
9387
- this.snapshot.categoryBreakdown.transform += 1;
9388
- }
9389
- if (category & UpdateCategory.SHAPE) {
9390
- this.snapshot.categoryBreakdown.shape += 1;
9391
- }
9392
- if (category & UpdateCategory.BOUNDS) {
9393
- this.snapshot.categoryBreakdown.bounds += 1;
9394
- }
9395
- if (category & UpdateCategory.LAYOUT) {
9396
- this.snapshot.categoryBreakdown.layout += 1;
9397
- }
9398
- if (category & UpdateCategory.PICK) {
9399
- this.snapshot.categoryBreakdown.pick += 1;
9400
- }
9401
- }
9402
- recordRefresh(key, delta = 1) {
9403
- if (!this.isEnabled()) {
9404
- return;
9405
- }
9406
- this.snapshot.refresh[key] += delta;
9407
- }
9408
- recordResolver(key, delta = 1) {
9409
- if (!this.isEnabled()) {
9410
- return;
9411
- }
9412
- this.snapshot.resolver[key] += delta;
9413
- }
9414
- recordCost(kind, durationMs) {
9415
- if (!this.isEnabled()) {
9416
- return;
9417
- }
9418
- if (kind === 'resolver') {
9419
- this.snapshot.cost.resolverTotalMs += durationMs;
9420
- this.snapshot.cost.resolverMaxMs = Math.max(this.snapshot.cost.resolverMaxMs, durationMs);
9421
- return;
9422
- }
9423
- if (kind === 'patch') {
9424
- this.snapshot.cost.patchTotalMs += durationMs;
9425
- this.snapshot.cost.patchMaxMs = Math.max(this.snapshot.cost.patchMaxMs, durationMs);
9426
- return;
9427
- }
9428
- if (kind === 'sharedRefresh') {
9429
- this.snapshot.cost.sharedRefreshTotalMs += durationMs;
9430
- this.snapshot.cost.sharedRefreshMaxMs = Math.max(this.snapshot.cost.sharedRefreshMaxMs, durationMs);
9431
- return;
9432
- }
9433
- this.snapshot.cost.batchSliceTotalMs += durationMs;
9434
- this.snapshot.cost.batchSliceMaxMs = Math.max(this.snapshot.cost.batchSliceMaxMs, durationMs);
9435
- this.snapshot.batch.maxFrameSliceCost = Math.max(this.snapshot.batch.maxFrameSliceCost, durationMs);
9436
- }
9437
- recordAllocation(key, delta = 1) {
9438
- if (!this.isEnabled()) {
9439
- return;
9440
- }
9441
- this.snapshot.allocationHints[key] += delta;
9442
- }
9443
- updateBatchPending(pendingJobs) {
9444
- if (!this.isEnabled()) {
9445
- return;
9446
- }
9447
- this.snapshot.batch.pendingJobs = pendingJobs;
9448
- this.snapshot.batch.maxPendingJobs = Math.max(this.snapshot.batch.maxPendingJobs, pendingJobs);
9449
- }
9450
- updateMaxGraphicsInJob(count) {
9451
- if (!this.isEnabled()) {
9452
- return;
9453
- }
9454
- this.snapshot.batch.maxGraphicsInJob = Math.max(this.snapshot.batch.maxGraphicsInJob, count);
9455
- }
9456
- recordEvent(type, detail) {
9457
- var _a, _b, _c;
9458
- if (!this.shouldRecordEvents()) {
9459
- return;
9460
- }
9461
- const events = (_a = this.snapshot.events) !== null && _a !== void 0 ? _a : (this.snapshot.events = []);
9462
- events.push({
9463
- type,
9464
- at: Date.now(),
9465
- detail
9466
- });
9467
- const max = (_c = (_b = this.getConfig()) === null || _b === void 0 ? void 0 : _b.maxEventRecords) !== null && _c !== void 0 ? _c : DEFAULT_MAX_EVENT_RECORDS;
9468
- if (events.length > max) {
9469
- events.splice(0, events.length - max);
9470
- }
9471
- }
9472
- isEnabled() {
9473
- var _a;
9474
- return ((_a = this.getConfig()) === null || _a === void 0 ? void 0 : _a.enabled) === true;
9475
- }
9476
- shouldRecordEvents() {
9477
- const config = this.getConfig();
9478
- return !!(config === null || config === void 0 ? void 0 : config.enabled) && !!config.recordEvents;
9479
- }
9480
- getConfig() {
9481
- return typeof this.configSource === 'function' ? this.configSource() : this.configSource;
9482
- }
9483
- }
9484
- function ensureStageStatePerfMonitor(stage) {
9485
- const stageAny = stage;
9486
- if (!stageAny[STAGE_PERF_MONITOR]) {
9487
- stageAny[STAGE_PERF_MONITOR] = new StatePerfMonitor(() => stage.statePerfConfig);
9488
- }
9489
- return stageAny[STAGE_PERF_MONITOR];
9490
- }
9491
- function getStageStatePerfMonitor(stage) {
9492
- if (!stage) {
9493
- return undefined;
9494
- }
9495
- return stage[STAGE_PERF_MONITOR];
9496
- }
9497
- function getActiveStageStatePerfMonitor(stage) {
9498
- var _a;
9499
- if (!stage) {
9500
- return undefined;
9501
- }
9502
- const current = getStageStatePerfMonitor(stage);
9503
- if (current) {
9504
- return current;
9505
- }
9506
- return ((_a = stage.statePerfConfig) === null || _a === void 0 ? void 0 : _a.enabled) === true ? ensureStageStatePerfMonitor(stage) : undefined;
9507
- }
9508
-
9509
- function isPlainObject$1(value) {
9149
+ function isPlainObject(value) {
9510
9150
  return value != null && typeof value === 'object' && !Array.isArray(value);
9511
9151
  }
9512
- function cloneValue$1(value) {
9513
- if (!isPlainObject$1(value)) {
9152
+ function cloneValue(value) {
9153
+ if (!isPlainObject(value)) {
9514
9154
  return value;
9515
9155
  }
9516
9156
  const clone = {};
9517
9157
  Object.keys(value).forEach(key => {
9518
- clone[key] = cloneValue$1(value[key]);
9158
+ clone[key] = cloneValue(value[key]);
9519
9159
  });
9520
9160
  return clone;
9521
9161
  }
9522
- function deepMerge$1(base, value) {
9162
+ function deepMerge(base, value) {
9523
9163
  var _a;
9524
- const result = (_a = cloneValue$1(base)) !== null && _a !== void 0 ? _a : {};
9164
+ const result = (_a = cloneValue(base)) !== null && _a !== void 0 ? _a : {};
9525
9165
  Object.keys(value).forEach(key => {
9526
9166
  const nextValue = value[key];
9527
9167
  const previousValue = result[key];
9528
- if (isPlainObject$1(previousValue) && isPlainObject$1(nextValue)) {
9529
- result[key] = deepMerge$1(previousValue, nextValue);
9168
+ if (isPlainObject(previousValue) && isPlainObject(nextValue)) {
9169
+ result[key] = deepMerge(previousValue, nextValue);
9530
9170
  return;
9531
9171
  }
9532
- result[key] = cloneValue$1(nextValue);
9172
+ result[key] = cloneValue(nextValue);
9533
9173
  });
9534
9174
  return result;
9535
9175
  }
9536
- const FULL_DEFINITION_KEYS = new Set([
9537
- 'name',
9538
- 'patch',
9539
- 'priority',
9540
- 'exclude',
9541
- 'suppress',
9542
- 'resolver',
9543
- 'declaredAffectedKeys'
9544
- ]);
9545
9176
  class StateEngine {
9546
9177
  constructor(options) {
9547
9178
  var _a;
@@ -9555,9 +9186,6 @@ class StateEngine {
9555
9186
  this.baseAttributes = {};
9556
9187
  this.compiledDefinitions = options.compiledDefinitions;
9557
9188
  this.stateSort = options.stateSort;
9558
- this.stateProxy = options.stateProxy;
9559
- this.stateProxyEligibility = options.stateProxyEligibility;
9560
- this.states = options.states;
9561
9189
  this.mergeMode = (_a = options.mergeMode) !== null && _a !== void 0 ? _a : 'shallow';
9562
9190
  }
9563
9191
  get activeStates() {
@@ -9656,11 +9284,9 @@ class StateEngine {
9656
9284
  };
9657
9285
  }
9658
9286
  invalidateResolverCache() {
9659
- var _a, _b;
9660
9287
  this.resolverPatchCache.clear();
9661
9288
  this.resolverCacheKey = '';
9662
9289
  this.resolverCacheValid = false;
9663
- (_b = getActiveStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage)) === null || _b === void 0 ? void 0 : _b.recordResolver('invalidations');
9664
9290
  }
9665
9291
  hasState(stateName) {
9666
9292
  if (!this._activeStates.length) {
@@ -9671,28 +9297,6 @@ class StateEngine {
9671
9297
  }
9672
9298
  return this._activeStates.includes(stateName);
9673
9299
  }
9674
- getCompatPatch(stateName) {
9675
- var _a, _b, _c;
9676
- const targetStates = this._activeStates.length ? this._activeStates : this._effectiveStates;
9677
- const canUseStateProxy = this.canUseStateProxy(stateName);
9678
- const proxyPatch = canUseStateProxy ? (_a = this.stateProxy) === null || _a === void 0 ? void 0 : _a.call(this, stateName, targetStates) : undefined;
9679
- if (this.stateProxy && canUseStateProxy) {
9680
- return proxyPatch !== null && proxyPatch !== void 0 ? proxyPatch : undefined;
9681
- }
9682
- const value = (_b = this.states) === null || _b === void 0 ? void 0 : _b[stateName];
9683
- if (value == null) {
9684
- return undefined;
9685
- }
9686
- if (!isPlainObject$1(value)) {
9687
- return value;
9688
- }
9689
- const keys = Object.keys(value);
9690
- const hasFullKey = keys.some(key => FULL_DEFINITION_KEYS.has(key));
9691
- if (!hasFullKey) {
9692
- return value;
9693
- }
9694
- return cloneValue$1(((_c = value.patch) !== null && _c !== void 0 ? _c : undefined));
9695
- }
9696
9300
  sortStates(states) {
9697
9301
  const withDefinition = [];
9698
9302
  const withoutDefinition = [];
@@ -9749,96 +9353,44 @@ class StateEngine {
9749
9353
  };
9750
9354
  }
9751
9355
  recomputePatch(effectiveStates) {
9752
- var _a;
9753
- const perfMonitor = getActiveStageStatePerfMonitor((_a = this.graphic) === null || _a === void 0 ? void 0 : _a.stage);
9754
- const patchStart = perfMonitor ? performance.now() : 0;
9755
- let resolverCost = 0;
9756
9356
  const cacheKey = effectiveStates.join(',');
9757
9357
  const nextPatch = {};
9758
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordAllocation('patchObjectsCreated');
9759
- if (this.resolverCacheValid && this.resolverCacheKey === cacheKey) {
9760
- effectiveStates.forEach(stateName => {
9761
- var _a;
9762
- const canUseStateProxy = this.canUseStateProxy(stateName);
9763
- const proxyPatch = canUseStateProxy ? (_a = this.stateProxy) === null || _a === void 0 ? void 0 : _a.call(this, stateName, effectiveStates) : undefined;
9764
- if (this.stateProxy && canUseStateProxy) {
9765
- if (proxyPatch != null) {
9766
- this.mergeInto(nextPatch, proxyPatch);
9767
- }
9768
- return;
9769
- }
9770
- const definition = this.compiledDefinitions.get(stateName);
9771
- if (!definition) {
9772
- const compatPatch = this.getCompatPatch(stateName);
9773
- if (compatPatch) {
9774
- this.mergeInto(nextPatch, compatPatch);
9775
- }
9776
- return;
9777
- }
9778
- if (definition.patch) {
9779
- this.mergeInto(nextPatch, definition.patch);
9780
- }
9781
- if (definition.hasResolver) {
9782
- const cachedPatch = this.resolverPatchCache.get(stateName);
9783
- if (cachedPatch) {
9784
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordResolver('cacheHits');
9785
- this.mergeInto(nextPatch, cachedPatch);
9786
- }
9787
- }
9788
- });
9789
- }
9790
- else {
9358
+ const useResolverCache = this.resolverCacheValid && this.resolverCacheKey === cacheKey;
9359
+ if (!useResolverCache) {
9791
9360
  this.resolverPatchCache.clear();
9792
9361
  this.resolverCacheKey = cacheKey;
9793
- effectiveStates.forEach(stateName => {
9794
- var _a;
9795
- const canUseStateProxy = this.canUseStateProxy(stateName);
9796
- const proxyPatch = canUseStateProxy ? (_a = this.stateProxy) === null || _a === void 0 ? void 0 : _a.call(this, stateName, effectiveStates) : undefined;
9797
- if (this.stateProxy && canUseStateProxy) {
9798
- if (proxyPatch != null) {
9799
- this.mergeInto(nextPatch, proxyPatch);
9800
- }
9801
- return;
9802
- }
9803
- const definition = this.compiledDefinitions.get(stateName);
9804
- if (!definition) {
9805
- const compatPatch = this.getCompatPatch(stateName);
9806
- if (compatPatch) {
9807
- this.mergeInto(nextPatch, compatPatch);
9808
- }
9809
- return;
9810
- }
9811
- if (definition.patch) {
9812
- this.mergeInto(nextPatch, definition.patch);
9813
- }
9814
- if (definition.hasResolver && definition.resolver) {
9815
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordResolver('cacheMisses');
9816
- const resolverStart = perfMonitor ? performance.now() : 0;
9817
- const resolverPatch = definition.resolver({
9362
+ }
9363
+ effectiveStates.forEach(stateName => {
9364
+ var _a;
9365
+ const definition = this.compiledDefinitions.get(stateName);
9366
+ if (!definition) {
9367
+ return;
9368
+ }
9369
+ if (definition.patch) {
9370
+ this.mergeInto(nextPatch, definition.patch);
9371
+ }
9372
+ if (definition.hasResolver) {
9373
+ const resolverPatch = useResolverCache
9374
+ ? this.resolverPatchCache.get(stateName)
9375
+ : (_a = definition.resolver) === null || _a === void 0 ? void 0 : _a.call(definition, {
9818
9376
  graphic: this.graphic,
9819
9377
  activeStates: this._activeStates,
9820
9378
  effectiveStates: this._effectiveStates,
9821
9379
  baseAttributes: this.baseAttributes,
9822
9380
  resolvedPatch: nextPatch
9823
9381
  });
9824
- if (perfMonitor) {
9825
- const duration = performance.now() - resolverStart;
9826
- resolverCost += duration;
9827
- perfMonitor.recordCost('resolver', duration);
9828
- }
9829
- if (resolverPatch) {
9382
+ if (resolverPatch) {
9383
+ if (!useResolverCache) {
9830
9384
  this.resolverPatchCache.set(stateName, resolverPatch);
9831
- this.mergeInto(nextPatch, resolverPatch);
9832
9385
  }
9386
+ this.mergeInto(nextPatch, resolverPatch);
9833
9387
  }
9834
- });
9388
+ }
9389
+ });
9390
+ if (!useResolverCache) {
9835
9391
  this.resolverCacheValid = true;
9836
9392
  }
9837
9393
  this._resolvedPatch = nextPatch;
9838
- if (perfMonitor) {
9839
- const totalCost = performance.now() - patchStart;
9840
- perfMonitor.recordCost('patch', Math.max(0, totalCost - resolverCost));
9841
- }
9842
9394
  }
9843
9395
  mergeInto(target, patch) {
9844
9396
  if (this.mergeMode === 'deep') {
@@ -9847,20 +9399,20 @@ class StateEngine {
9847
9399
  const nextValue = patch[key];
9848
9400
  const previousValue = target[key];
9849
9401
  const baseValue = (_a = this.baseAttributes) === null || _a === void 0 ? void 0 : _a[key];
9850
- if (isPlainObject$1(previousValue) && isPlainObject$1(nextValue)) {
9851
- target[key] = deepMerge$1(previousValue, nextValue);
9402
+ if (isPlainObject(previousValue) && isPlainObject(nextValue)) {
9403
+ target[key] = deepMerge(previousValue, nextValue);
9852
9404
  return;
9853
9405
  }
9854
- if (!isPlainObject$1(previousValue) && isPlainObject$1(baseValue) && isPlainObject$1(nextValue)) {
9855
- target[key] = deepMerge$1(baseValue, nextValue);
9406
+ if (!isPlainObject(previousValue) && isPlainObject(baseValue) && isPlainObject(nextValue)) {
9407
+ target[key] = deepMerge(baseValue, nextValue);
9856
9408
  return;
9857
9409
  }
9858
- target[key] = cloneValue$1(nextValue);
9410
+ target[key] = cloneValue(nextValue);
9859
9411
  });
9860
9412
  return;
9861
9413
  }
9862
9414
  Object.keys(patch).forEach(key => {
9863
- target[key] = cloneValue$1(patch[key]);
9415
+ target[key] = cloneValue(patch[key]);
9864
9416
  });
9865
9417
  }
9866
9418
  sameArray(left, right) {
@@ -9874,285 +9426,69 @@ class StateEngine {
9874
9426
  }
9875
9427
  return true;
9876
9428
  }
9877
- canUseStateProxy(stateName) {
9878
- if (!this.stateProxy) {
9879
- return false;
9880
- }
9881
- return this.stateProxyEligibility ? this.stateProxyEligibility(stateName) : true;
9882
- }
9883
- }
9884
-
9885
- class StateModel {
9886
- constructor(options = {}) {
9887
- var _a;
9888
- this.exclusiveGroupMap = new Map();
9889
- this.exclusiveGroups = new Map();
9890
- this.states = options.states;
9891
- this.currentStates = options.currentStates ? [...options.currentStates] : undefined;
9892
- this.stateSort = options.stateSort;
9893
- this.stateProxy = options.stateProxy;
9894
- this.stateEngine = options.stateEngine;
9895
- if (this.stateEngine &&
9896
- options.currentStates &&
9897
- !this.sameStates(this.stateEngine.activeStates, options.currentStates)) {
9898
- this.stateEngine.applyStates(options.currentStates);
9899
- }
9900
- const exclusiveGroups = (_a = options.exclusiveGroups) !== null && _a !== void 0 ? _a : {};
9901
- for (const groupName in exclusiveGroups) {
9902
- if (!Object.prototype.hasOwnProperty.call(exclusiveGroups, groupName)) {
9903
- continue;
9904
- }
9905
- this.registerExclusiveGroup(groupName, exclusiveGroups[groupName]);
9906
- }
9907
- }
9908
- getCurrentStates() {
9909
- return this.currentStates ? [...this.currentStates] : [];
9910
- }
9911
- hasState(stateName) {
9912
- if (this.stateEngine) {
9913
- return this.stateEngine.hasState(stateName);
9914
- }
9915
- if (!this.currentStates || !this.currentStates.length) {
9916
- return false;
9917
- }
9918
- if (stateName == null) {
9919
- return true;
9920
- }
9921
- return this.currentStates.includes(stateName);
9922
- }
9923
- getState(stateName) {
9924
- var _a;
9925
- return (_a = this.states) === null || _a === void 0 ? void 0 : _a[stateName];
9926
- }
9927
- useStates(states) {
9928
- var _a;
9929
- if (this.stateEngine) {
9930
- const result = this.stateEngine.applyStates(states);
9931
- this.currentStates = [...result.activeStates];
9932
- return {
9933
- changed: result.changed,
9934
- states: [...result.activeStates],
9935
- effectiveStates: [...result.effectiveStates]
9936
- };
9937
- }
9938
- if (!states.length) {
9939
- return this.clearStates();
9940
- }
9941
- const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : [];
9942
- const changed = previousStates.length !== states.length || states.some((stateName, index) => previousStates[index] !== stateName);
9943
- const nextStates = this.sortStates(states);
9944
- if (changed) {
9945
- this.currentStates = nextStates;
9946
- }
9947
- return {
9948
- changed,
9949
- states: changed ? [...nextStates] : [...previousStates]
9950
- };
9951
- }
9952
- clearStates() {
9953
- if (this.stateEngine) {
9954
- const result = this.stateEngine.clearStates();
9955
- this.currentStates = [];
9956
- return {
9957
- changed: result.changed,
9958
- states: [],
9959
- effectiveStates: []
9960
- };
9961
- }
9962
- const changed = this.hasState();
9963
- this.currentStates = [];
9964
- return {
9965
- changed,
9966
- states: []
9967
- };
9968
- }
9969
- addState(stateName, keepCurrentStates) {
9970
- var _a;
9971
- if (this.stateEngine) {
9972
- const result = this.stateEngine.addState(stateName, keepCurrentStates);
9973
- this.currentStates = [...result.activeStates];
9974
- return {
9975
- changed: result.changed,
9976
- states: [...result.activeStates],
9977
- effectiveStates: [...result.effectiveStates]
9978
- };
9979
- }
9980
- if (this.currentStates &&
9981
- this.currentStates.includes(stateName) &&
9982
- (keepCurrentStates || this.currentStates.length === 1)) {
9983
- return {
9984
- changed: false,
9985
- states: this.getCurrentStates()
9986
- };
9987
- }
9988
- const nextStates = keepCurrentStates && ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ? this.currentStates.concat([stateName]) : [stateName];
9989
- return this.useStates(nextStates);
9990
- }
9991
- removeState(stateName) {
9992
- if (this.stateEngine) {
9993
- const result = this.stateEngine.removeState(stateName);
9994
- this.currentStates = [...result.activeStates];
9995
- return {
9996
- changed: result.changed,
9997
- states: [...result.activeStates],
9998
- effectiveStates: [...result.effectiveStates]
9999
- };
10000
- }
10001
- if (!this.currentStates) {
10002
- return {
10003
- changed: false,
10004
- states: []
10005
- };
10006
- }
10007
- const filter = Array.isArray(stateName) ? (s) => !stateName.includes(s) : (s) => s !== stateName;
10008
- const nextStates = this.currentStates.filter(filter);
10009
- if (nextStates.length === this.currentStates.length) {
10010
- return {
10011
- changed: false,
10012
- states: this.getCurrentStates()
10013
- };
10014
- }
10015
- return this.useStates(nextStates);
10016
- }
10017
- toggleState(stateName) {
10018
- if (this.stateEngine) {
10019
- const result = this.stateEngine.toggleState(stateName);
10020
- this.currentStates = [...result.activeStates];
10021
- return {
10022
- changed: result.changed,
10023
- states: [...result.activeStates],
10024
- effectiveStates: [...result.effectiveStates]
10025
- };
10026
- }
10027
- if (this.hasState(stateName)) {
10028
- return this.removeState(stateName);
10029
- }
10030
- const nextStates = this.currentStates ? this.currentStates.slice() : [];
10031
- if (!nextStates.includes(stateName)) {
10032
- nextStates.push(stateName);
10033
- }
10034
- return this.useStates(nextStates);
10035
- }
10036
- sortStates(states) {
10037
- if (this.stateEngine) {
10038
- return [...this.stateEngine.activeStates];
10039
- }
10040
- if (!this.stateSort) {
10041
- return [...states];
10042
- }
10043
- return [...states].sort(this.stateSort);
10044
- }
10045
- registerExclusiveGroup(groupName, states) {
10046
- const uniqueStates = Array.from(new Set(states));
10047
- this.exclusiveGroups.set(groupName, uniqueStates);
10048
- uniqueStates.forEach(stateName => this.exclusiveGroupMap.set(stateName, groupName));
10049
- }
10050
- getExclusiveGroup(stateName) {
10051
- return this.exclusiveGroupMap.get(stateName);
10052
- }
10053
- getMutuallyExclusiveStates(stateName) {
10054
- var _a;
10055
- const groupName = this.getExclusiveGroup(stateName);
10056
- if (!groupName) {
10057
- return [];
10058
- }
10059
- return ((_a = this.exclusiveGroups.get(groupName)) !== null && _a !== void 0 ? _a : []).filter(name => name !== stateName);
10060
- }
10061
- isMutuallyExclusive(stateA, stateB) {
10062
- const groupName = this.getExclusiveGroup(stateA);
10063
- return !!groupName && groupName === this.getExclusiveGroup(stateB) && stateA !== stateB;
10064
- }
10065
- get effectiveStates() {
10066
- var _a, _b, _c;
10067
- 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 : [];
10068
- }
10069
- get resolvedPatch() {
10070
- var _a;
10071
- return (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.resolvedPatch;
10072
- }
10073
- sameStates(left, right) {
10074
- if (left.length !== right.length) {
10075
- return false;
10076
- }
10077
- for (let index = 0; index < left.length; index++) {
10078
- if (left[index] !== right[index]) {
10079
- return false;
10080
- }
10081
- }
10082
- return true;
10083
- }
10084
9429
  }
10085
9430
 
10086
- function isPlainObject(value) {
10087
- return value != null && typeof value === 'object' && !Array.isArray(value);
10088
- }
10089
- function cloneValue(value) {
10090
- if (!isPlainObject(value)) {
10091
- return value;
10092
- }
10093
- const clone = {};
10094
- for (const key in value) {
10095
- if (!Object.prototype.hasOwnProperty.call(value, key)) {
10096
- continue;
10097
- }
10098
- clone[key] = cloneValue(value[key]);
10099
- }
10100
- return clone;
10101
- }
10102
- function deepMerge(base, value) {
10103
- const result = cloneValue(base) || {};
10104
- for (const key in value) {
10105
- if (!Object.prototype.hasOwnProperty.call(value, key)) {
10106
- continue;
10107
- }
10108
- const nextValue = value[key];
10109
- const previousValue = result[key];
10110
- if (isPlainObject(previousValue) && isPlainObject(nextValue)) {
10111
- result[key] = deepMerge(previousValue, nextValue);
9431
+ var UpdateCategory;
9432
+ (function (UpdateCategory) {
9433
+ UpdateCategory[UpdateCategory["NONE"] = 0] = "NONE";
9434
+ UpdateCategory[UpdateCategory["PAINT"] = 1] = "PAINT";
9435
+ UpdateCategory[UpdateCategory["SHAPE"] = 2] = "SHAPE";
9436
+ UpdateCategory[UpdateCategory["BOUNDS"] = 4] = "BOUNDS";
9437
+ UpdateCategory[UpdateCategory["TRANSFORM"] = 8] = "TRANSFORM";
9438
+ UpdateCategory[UpdateCategory["LAYOUT"] = 16] = "LAYOUT";
9439
+ UpdateCategory[UpdateCategory["PICK"] = 32] = "PICK";
9440
+ })(UpdateCategory || (UpdateCategory = {}));
9441
+ const ATTRIBUTE_CATEGORY = {
9442
+ fill: UpdateCategory.PAINT,
9443
+ opacity: UpdateCategory.PAINT,
9444
+ fillOpacity: UpdateCategory.PAINT,
9445
+ strokeOpacity: UpdateCategory.PAINT,
9446
+ lineDash: UpdateCategory.PAINT,
9447
+ lineDashOffset: UpdateCategory.PAINT,
9448
+ lineCap: UpdateCategory.PAINT,
9449
+ lineJoin: UpdateCategory.PAINT,
9450
+ miterLimit: UpdateCategory.PAINT,
9451
+ shadowColor: UpdateCategory.PAINT,
9452
+ x: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9453
+ y: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9454
+ scaleX: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9455
+ scaleY: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9456
+ angle: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9457
+ anchor: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9458
+ anchor3d: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9459
+ postMatrix: UpdateCategory.TRANSFORM | UpdateCategory.BOUNDS,
9460
+ layout: UpdateCategory.LAYOUT,
9461
+ zIndex: UpdateCategory.PAINT,
9462
+ visible: UpdateCategory.PAINT | UpdateCategory.PICK,
9463
+ lineWidth: UpdateCategory.SHAPE | UpdateCategory.BOUNDS | UpdateCategory.PICK,
9464
+ width: UpdateCategory.SHAPE | UpdateCategory.BOUNDS,
9465
+ height: UpdateCategory.SHAPE | UpdateCategory.BOUNDS
9466
+ };
9467
+ const ATTRIBUTE_DELTA_CLASSIFIER = {
9468
+ stroke: (prev, next) => {
9469
+ const prevEnabled = prev != null && prev !== false;
9470
+ const nextEnabled = next != null && next !== false;
9471
+ if (prevEnabled !== nextEnabled) {
9472
+ return UpdateCategory.PAINT | UpdateCategory.BOUNDS | UpdateCategory.PICK;
10112
9473
  }
10113
- else {
10114
- result[key] = cloneValue(nextValue);
9474
+ return UpdateCategory.PAINT;
9475
+ },
9476
+ shadowBlur: (prev, next) => {
9477
+ const prevBlur = Number(prev !== null && prev !== void 0 ? prev : 0);
9478
+ const nextBlur = Number(next !== null && next !== void 0 ? next : 0);
9479
+ if (prevBlur !== nextBlur && (prevBlur > 0 || nextBlur > 0)) {
9480
+ return UpdateCategory.PAINT | UpdateCategory.BOUNDS;
10115
9481
  }
9482
+ return UpdateCategory.PAINT;
10116
9483
  }
10117
- return result;
10118
- }
10119
- class StateStyleResolver {
10120
- constructor(options = {}) {
10121
- this.options = options;
10122
- }
10123
- resolve(normalAttrs, states, stateProxy, currentStates, stateSort) {
10124
- var _a;
10125
- const mergeMode = (_a = this.options.mergeMode) !== null && _a !== void 0 ? _a : 'shallow';
10126
- const sortedStates = stateSort ? currentStates.slice().sort(stateSort) : currentStates.slice();
10127
- const resolvedAttrs = {};
10128
- sortedStates.forEach(stateName => {
10129
- const attrs = stateProxy ? stateProxy(stateName, sortedStates) : states === null || states === void 0 ? void 0 : states[stateName];
10130
- if (attrs == null) {
10131
- return;
10132
- }
10133
- for (const key in attrs) {
10134
- if (!Object.prototype.hasOwnProperty.call(attrs, key)) {
10135
- continue;
10136
- }
10137
- const nextValue = attrs[key];
10138
- if (mergeMode === 'deep' &&
10139
- isPlainObject(nextValue) &&
10140
- (isPlainObject(resolvedAttrs[key]) ||
10141
- isPlainObject(normalAttrs[key]))) {
10142
- const baseValue = isPlainObject(resolvedAttrs[key])
10143
- ? resolvedAttrs[key]
10144
- : isPlainObject(normalAttrs[key])
10145
- ? normalAttrs[key]
10146
- : {};
10147
- resolvedAttrs[key] = deepMerge(baseValue, nextValue);
10148
- }
10149
- else {
10150
- resolvedAttrs[key] = cloneValue(nextValue);
10151
- }
10152
- }
10153
- });
10154
- return resolvedAttrs;
9484
+ };
9485
+ function classifyAttributeDelta(key, prev, next) {
9486
+ var _a;
9487
+ const dynamicClassifier = ATTRIBUTE_DELTA_CLASSIFIER[key];
9488
+ if (dynamicClassifier) {
9489
+ return dynamicClassifier(prev, next);
10155
9490
  }
9491
+ return (_a = ATTRIBUTE_CATEGORY[key]) !== null && _a !== void 0 ? _a : UpdateCategory.PAINT;
10156
9492
  }
10157
9493
 
10158
9494
  function hasOwnKeys(value) {
@@ -10176,13 +9512,11 @@ function normalizeNoAnimateAttrConfig(config) {
10176
9512
  }, {});
10177
9513
  }
10178
9514
  class StateTransitionOrchestrator {
10179
- analyzeTransition(_currentAttrs, targetAttrs, stateNames, hasAnimation, options = {}) {
9515
+ analyzeTransition(targetAttrs, hasAnimation, options = {}) {
10180
9516
  var _a, _b;
10181
9517
  const plan = {
10182
- stateNames,
10183
9518
  targetAttrs: Object.assign({}, targetAttrs),
10184
9519
  animateAttrs: {},
10185
- jumpAttrs: {},
10186
9520
  noAnimateAttrs: {}
10187
9521
  };
10188
9522
  if (!hasAnimation) {
@@ -10191,10 +9525,10 @@ class StateTransitionOrchestrator {
10191
9525
  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));
10192
9526
  const isClear = options.isClear === true;
10193
9527
  const getDefaultAttribute = options.getDefaultAttribute;
9528
+ const readDefaultAttribute = getDefaultAttribute;
10194
9529
  const shouldSkipDefaultAttribute = options.shouldSkipDefaultAttribute;
10195
9530
  const assignTransitionAttr = (key, value) => {
10196
9531
  if (noWorkAnimateAttr[key]) {
10197
- plan.jumpAttrs[key] = value;
10198
9532
  plan.noAnimateAttrs[key] = value;
10199
9533
  return;
10200
9534
  }
@@ -10202,7 +9536,7 @@ class StateTransitionOrchestrator {
10202
9536
  if (shouldSkipDefaultAttribute === null || shouldSkipDefaultAttribute === void 0 ? void 0 : shouldSkipDefaultAttribute(key, targetAttrs)) {
10203
9537
  return;
10204
9538
  }
10205
- plan.animateAttrs[key] = getDefaultAttribute ? getDefaultAttribute(key) : value;
9539
+ plan.animateAttrs[key] = readDefaultAttribute(key);
10206
9540
  return;
10207
9541
  }
10208
9542
  plan.animateAttrs[key] = value;
@@ -10256,13 +9590,13 @@ class StateTransitionOrchestrator {
10256
9590
  graphic._emitCustomEvent('afterStateUpdate', { type: AttributeUpdateType.STATE });
10257
9591
  return plan;
10258
9592
  }
10259
- applyClearTransition(graphic, targetAttrs, hasAnimation, stateNames, options = {}) {
10260
- var _a, _b, _c, _d;
10261
- const plan = this.analyzeTransition({}, targetAttrs, stateNames, hasAnimation, {
10262
- noWorkAnimateAttr: (_a = graphic.getNoWorkAnimateAttr) === null || _a === void 0 ? void 0 : _a.call(graphic),
9593
+ applyClearTransition(graphic, targetAttrs, hasAnimation, options = {}) {
9594
+ var _a;
9595
+ const plan = this.analyzeTransition(targetAttrs, hasAnimation, {
9596
+ noWorkAnimateAttr: graphic.getNoWorkAnimateAttr(),
10263
9597
  isClear: true,
10264
- getDefaultAttribute: (_b = graphic.getDefaultAttribute) === null || _b === void 0 ? void 0 : _b.bind(graphic),
10265
- shouldSkipDefaultAttribute: (_c = options.shouldSkipDefaultAttribute) !== null && _c !== void 0 ? _c : (_d = graphic.shouldSkipStateTransitionDefaultAttribute) === null || _d === void 0 ? void 0 : _d.bind(graphic),
9598
+ getDefaultAttribute: graphic.getDefaultAttribute.bind(graphic),
9599
+ shouldSkipDefaultAttribute: (_a = options.shouldSkipDefaultAttribute) !== null && _a !== void 0 ? _a : graphic.shouldSkipStateTransitionDefaultAttribute.bind(graphic),
10266
9600
  animateConfig: options.animateConfig,
10267
9601
  extraAnimateAttrs: options.extraAnimateAttrs
10268
9602
  });
@@ -10271,33 +9605,11 @@ class StateTransitionOrchestrator {
10271
9605
  }
10272
9606
 
10273
9607
  const compiler = new StateDefinitionCompiler();
10274
- function copyDefinitions(definitions) {
10275
- return definitions ? Object.assign({}, definitions) : {};
10276
- }
10277
9608
  function buildEffectiveSourceDefinitions(parentScope, localStateDefinitions, themeStateDefinitions) {
10278
- const merged = parentScope
10279
- ? copyDefinitions(parentScope.effectiveSourceDefinitions)
10280
- : copyDefinitions(themeStateDefinitions);
10281
- if (localStateDefinitions) {
10282
- Object.keys(localStateDefinitions).forEach(stateName => {
10283
- merged[stateName] = localStateDefinitions[stateName];
10284
- });
10285
- }
10286
- return merged;
10287
- }
10288
- function initializeScope(scope, revision = 0) {
10289
- var _a;
10290
- const effectiveSourceDefinitions = buildEffectiveSourceDefinitions(scope.parentScope, scope.localStateDefinitions, scope.themeStateDefinitions);
10291
- scope.effectiveSourceDefinitions = effectiveSourceDefinitions;
10292
- scope.effectiveCompiledDefinitions = compiler.compile(effectiveSourceDefinitions);
10293
- scope.parentRevisionAtBuild = (_a = scope.parentScope) === null || _a === void 0 ? void 0 : _a.revision;
10294
- scope.revision = revision;
10295
- scope.dirty = false;
10296
- return scope;
9609
+ return Object.assign({}, parentScope ? parentScope.effectiveSourceDefinitions : themeStateDefinitions, localStateDefinitions);
10297
9610
  }
10298
9611
  function createRootSharedStateScope(stage, themeStateDefinitions) {
10299
- return initializeScope({
10300
- ownerKind: 'root',
9612
+ return rebuildSharedStateScope({
10301
9613
  ownerStage: stage,
10302
9614
  themeStateDefinitions,
10303
9615
  effectiveSourceDefinitions: {},
@@ -10308,9 +9620,7 @@ function createRootSharedStateScope(stage, themeStateDefinitions) {
10308
9620
  }, 0);
10309
9621
  }
10310
9622
  function createGroupSharedStateScope(group, parentScope, localStateDefinitions) {
10311
- return initializeScope({
10312
- ownerKind: 'group',
10313
- ownerGroup: group,
9623
+ return rebuildSharedStateScope({
10314
9624
  ownerStage: group.stage,
10315
9625
  parentScope,
10316
9626
  localStateDefinitions,
@@ -10345,22 +9655,20 @@ function setRootSharedStateScopeThemeDefinitions(scope, themeStateDefinitions) {
10345
9655
  rebuildSharedStateScope(scope);
10346
9656
  return true;
10347
9657
  }
10348
- function rebuildSharedStateScope(scope) {
9658
+ function rebuildSharedStateScope(scope, revision = scope.revision + 1) {
10349
9659
  var _a;
10350
9660
  const effectiveSourceDefinitions = buildEffectiveSourceDefinitions(scope.parentScope, scope.localStateDefinitions, scope.themeStateDefinitions);
10351
9661
  scope.effectiveSourceDefinitions = effectiveSourceDefinitions;
10352
9662
  scope.effectiveCompiledDefinitions = compiler.compile(effectiveSourceDefinitions);
10353
9663
  scope.parentRevisionAtBuild = (_a = scope.parentScope) === null || _a === void 0 ? void 0 : _a.revision;
10354
- scope.revision += 1;
9664
+ scope.revision = revision;
10355
9665
  scope.dirty = false;
10356
9666
  return scope;
10357
9667
  }
10358
9668
  function ensureSharedStateScopeFresh(scope) {
10359
- var _a;
10360
9669
  if (!scope) {
10361
9670
  return undefined;
10362
9671
  }
10363
- (_a = getActiveStageStatePerfMonitor(scope.ownerStage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('ensureFreshCalls');
10364
9672
  if (scope.parentScope) {
10365
9673
  ensureSharedStateScopeFresh(scope.parentScope);
10366
9674
  }
@@ -10380,11 +9688,9 @@ function collectSharedStateScopeChain(scope) {
10380
9688
  }
10381
9689
 
10382
9690
  function scheduleStageSharedStateRefresh(stage) {
10383
- var _a;
10384
9691
  if (!stage || stage.releaseStatus === 'released') {
10385
9692
  return;
10386
9693
  }
10387
- (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordRefresh('renderScheduled');
10388
9694
  stage.renderNextFrame();
10389
9695
  }
10390
9696
  function enqueueGraphicSharedStateRefresh(stage, graphic) {
@@ -10393,36 +9699,27 @@ function enqueueGraphicSharedStateRefresh(stage, graphic) {
10393
9699
  return;
10394
9700
  }
10395
9701
  const pending = (_a = stage._pendingSharedStateRefreshGraphics) !== null && _a !== void 0 ? _a : (stage._pendingSharedStateRefreshGraphics = new Set());
10396
- if (!pending.has(graphic)) {
10397
- pending.add(graphic);
10398
- const perfMonitor = getActiveStageStatePerfMonitor(stage);
10399
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordRefresh('queuedGraphics');
10400
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordAllocation('refreshQueuePushes');
10401
- }
9702
+ pending.add(graphic);
10402
9703
  }
10403
9704
  function markScopeActiveDescendantsDirty(scope, stage) {
10404
- let marked = false;
9705
+ if (!scope.subtreeActiveDescendants.size) {
9706
+ return;
9707
+ }
10405
9708
  scope.subtreeActiveDescendants.forEach(graphic => {
10406
9709
  var _a;
10407
9710
  graphic.sharedStateDirty = true;
10408
9711
  const ownerStage = (_a = stage !== null && stage !== void 0 ? stage : graphic.stage) !== null && _a !== void 0 ? _a : scope.ownerStage;
10409
9712
  enqueueGraphicSharedStateRefresh(ownerStage, graphic);
10410
- marked = true;
10411
9713
  });
10412
- if (marked) {
10413
- scheduleStageSharedStateRefresh(stage !== null && stage !== void 0 ? stage : scope.ownerStage);
10414
- }
9714
+ scheduleStageSharedStateRefresh(stage !== null && stage !== void 0 ? stage : scope.ownerStage);
10415
9715
  }
10416
9716
  function flushStageSharedStateRefresh(stage) {
10417
9717
  const pending = stage._pendingSharedStateRefreshGraphics;
10418
9718
  if (!pending || !pending.size) {
10419
9719
  return;
10420
9720
  }
10421
- const perfMonitor = getActiveStageStatePerfMonitor(stage);
10422
- const start = perfMonitor ? performance.now() : 0;
10423
9721
  const graphics = Array.from(pending.values());
10424
9722
  pending.clear();
10425
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordRefresh('flushedGraphics', graphics.length);
10426
9723
  graphics.forEach(graphic => {
10427
9724
  if (graphic.releaseStatus === 'released') {
10428
9725
  return;
@@ -10433,19 +9730,8 @@ function flushStageSharedStateRefresh(stage) {
10433
9730
  if (!graphic.sharedStateDirty) {
10434
9731
  return;
10435
9732
  }
10436
- const refresh = graphic.refreshSharedStateBeforeRender;
10437
- if (typeof refresh === 'function') {
10438
- refresh.call(graphic);
10439
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('sharedRefreshCommits');
10440
- }
9733
+ graphic.refreshSharedStateBeforeRender();
10441
9734
  });
10442
- if (perfMonitor) {
10443
- perfMonitor.recordCost('sharedRefresh', performance.now() - start);
10444
- perfMonitor.recordEvent('shared-refresh-flush', {
10445
- stageId: stage._uid,
10446
- flushedGraphics: graphics.length
10447
- });
10448
- }
10449
9735
  }
10450
9736
 
10451
9737
  const _tempBounds$1 = new AABBBounds();
@@ -10485,15 +9771,6 @@ const builtinTextureTypes = new Set([
10485
9771
  'grid',
10486
9772
  'wave'
10487
9773
  ]);
10488
- const FULL_STATE_DEFINITION_KEYS = new Set([
10489
- 'name',
10490
- 'patch',
10491
- 'priority',
10492
- 'exclude',
10493
- 'suppress',
10494
- 'resolver',
10495
- 'declaredAffectedKeys'
10496
- ]);
10497
9774
  const point = new Point();
10498
9775
  const EMPTY_STATE_NAMES = [];
10499
9776
  const BROAD_UPDATE_CATEGORY = UpdateCategory.PAINT |
@@ -10649,18 +9926,6 @@ class Graphic extends Node {
10649
9926
  getAttributes() {
10650
9927
  return this.attribute;
10651
9928
  }
10652
- getStateStyleResolver(mergeMode) {
10653
- if (mergeMode === 'deep') {
10654
- if (!this.deepStateStyleResolver) {
10655
- this.deepStateStyleResolver = new StateStyleResolver({ mergeMode: 'deep' });
10656
- }
10657
- return this.deepStateStyleResolver;
10658
- }
10659
- if (!this.stateStyleResolver) {
10660
- this.stateStyleResolver = new StateStyleResolver();
10661
- }
10662
- return this.stateStyleResolver;
10663
- }
10664
9929
  getStateTransitionOrchestrator() {
10665
9930
  if (!this.stateTransitionOrchestrator) {
10666
9931
  this.stateTransitionOrchestrator = new StateTransitionOrchestrator();
@@ -10687,12 +9952,10 @@ class Graphic extends Node {
10687
9952
  }
10688
9953
  this.boundSharedStateScope = nextScope;
10689
9954
  this.boundSharedStateRevision = undefined;
10690
- this.localFallbackCompiledDefinitions = undefined;
10691
9955
  this.compiledStateDefinitions = undefined;
10692
9956
  this.compiledStateDefinitionsCacheKey = undefined;
10693
9957
  this.stateEngine = undefined;
10694
9958
  this.stateEngineCompiledDefinitions = undefined;
10695
- this.stateEngineStateProxyModeKey = undefined;
10696
9959
  this.syncSharedStateActiveRegistrations();
10697
9960
  if (markDirty && ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length)) {
10698
9961
  this.markSharedStateDirty();
@@ -10775,9 +10038,9 @@ class Graphic extends Node {
10775
10038
  var _a, _b;
10776
10039
  if (this.localStateDefinitionsSource !== this.states) {
10777
10040
  this.localStateDefinitionsSource = this.states;
10778
- this.localFallbackVersion = ((_a = this.localFallbackVersion) !== null && _a !== void 0 ? _a : 0) + 1;
10041
+ this.localStateDefinitionsVersion = ((_a = this.localStateDefinitionsVersion) !== null && _a !== void 0 ? _a : 0) + 1;
10779
10042
  }
10780
- return (_b = this.localFallbackVersion) !== null && _b !== void 0 ? _b : 0;
10043
+ return (_b = this.localStateDefinitionsVersion) !== null && _b !== void 0 ? _b : 0;
10781
10044
  }
10782
10045
  resolveEffectiveCompiledDefinitions() {
10783
10046
  this.syncSharedStateScopeBindingFromTree(false);
@@ -10790,8 +10053,7 @@ class Graphic extends Node {
10790
10053
  if (!boundScope) {
10791
10054
  if (!hasStates) {
10792
10055
  return {
10793
- compiledDefinitions: undefined,
10794
- stateProxyModeKey: 'none'
10056
+ compiledDefinitions: undefined
10795
10057
  };
10796
10058
  }
10797
10059
  const localStatesVersion = this.getLocalStatesVersion();
@@ -10801,52 +10063,12 @@ class Graphic extends Node {
10801
10063
  this.compiledStateDefinitionsCacheKey = cacheKey;
10802
10064
  }
10803
10065
  return {
10804
- compiledDefinitions: this.compiledStateDefinitions,
10805
- stateProxyModeKey: this.stateProxy ? 'legacy-all' : 'none'
10066
+ compiledDefinitions: this.compiledStateDefinitions
10806
10067
  };
10807
10068
  }
10808
10069
  const sharedCompiledDefinitions = boundScope.effectiveCompiledDefinitions;
10809
- const sharedStateProxyModeKey = this.stateProxy ? 'shared-missing-only' : 'none';
10810
- const sharedStateProxyEligibility = this.stateProxy
10811
- ? (stateName) => !sharedCompiledDefinitions.has(stateName)
10812
- : undefined;
10813
- if (!hasStates) {
10814
- this.localFallbackCompiledDefinitions = undefined;
10815
- return {
10816
- compiledDefinitions: sharedCompiledDefinitions,
10817
- stateProxyModeKey: sharedStateProxyModeKey,
10818
- stateProxyEligibility: sharedStateProxyEligibility
10819
- };
10820
- }
10821
- const localStates = this.states;
10822
- const missingLocalStateDefinitions = {};
10823
- const missingStateNames = [];
10824
- Object.keys(localStates).forEach(stateName => {
10825
- if (sharedCompiledDefinitions.has(stateName)) {
10826
- return;
10827
- }
10828
- missingLocalStateDefinitions[stateName] = localStates[stateName];
10829
- missingStateNames.push(stateName);
10830
- });
10831
- if (!missingStateNames.length) {
10832
- this.localFallbackCompiledDefinitions = undefined;
10833
- return {
10834
- compiledDefinitions: sharedCompiledDefinitions,
10835
- stateProxyModeKey: sharedStateProxyModeKey,
10836
- stateProxyEligibility: sharedStateProxyEligibility
10837
- };
10838
- }
10839
- const localStatesVersion = this.getLocalStatesVersion();
10840
- const stateProxyModeKey = this.stateProxy ? `missing:${missingStateNames.sort().join('|')}` : 'none';
10841
- const cacheKey = `shared:${boundScope.revision}:fallback:${localStatesVersion}:${stateProxyModeKey}`;
10842
- if (!this.localFallbackCompiledDefinitions || this.compiledStateDefinitionsCacheKey !== cacheKey) {
10843
- this.localFallbackCompiledDefinitions = new StateDefinitionCompiler().compile(Object.assign(Object.assign({}, boundScope.effectiveSourceDefinitions), missingLocalStateDefinitions));
10844
- this.compiledStateDefinitionsCacheKey = cacheKey;
10845
- }
10846
10070
  return {
10847
- compiledDefinitions: this.localFallbackCompiledDefinitions,
10848
- stateProxyModeKey,
10849
- stateProxyEligibility: sharedStateProxyEligibility
10071
+ compiledDefinitions: sharedCompiledDefinitions
10850
10072
  };
10851
10073
  }
10852
10074
  recomputeCurrentStatePatch() {
@@ -10858,11 +10080,9 @@ class Graphic extends Node {
10858
10080
  return;
10859
10081
  }
10860
10082
  const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
10861
- const stateModel = this.createStateModel(stateResolveBaseAttrs);
10862
- const transition = stateModel.useStates(this.currentStates);
10083
+ const transition = this.resolveUseStatesTransition(this.currentStates, stateResolveBaseAttrs);
10863
10084
  const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
10864
- const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions
10865
- ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
10085
+ const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
10866
10086
  this.currentStates = transition.states;
10867
10087
  this.effectiveStates = [...effectiveStates];
10868
10088
  this.resolvedStatePatch = resolvedStateAttrs;
@@ -10971,18 +10191,11 @@ class Graphic extends Node {
10971
10191
  return category | nextCategory;
10972
10192
  }
10973
10193
  submitUpdateByCategory(category, forceUpdateTag = false) {
10974
- var _a;
10975
10194
  if (forceUpdateTag) {
10976
10195
  this.addUpdateShapeAndBoundsTag();
10977
10196
  this.addUpdatePositionTag();
10978
10197
  this.addUpdateLayoutTag();
10979
- return;
10980
- }
10981
- if (category !== UpdateCategory.NONE) {
10982
- const stage = this.stage;
10983
- if (stage) {
10984
- (_a = getActiveStageStatePerfMonitor(stage)) === null || _a === void 0 ? void 0 : _a.recordCategory(category);
10985
- }
10198
+ return;
10986
10199
  }
10987
10200
  if ((category & BROAD_UPDATE_CATEGORY) === BROAD_UPDATE_CATEGORY) {
10988
10201
  this.addBroadUpdateTag();
@@ -11936,159 +11149,141 @@ class Graphic extends Node {
11936
11149
  (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.setResolveContext(this, stateResolveBaseAttrs);
11937
11150
  return stateResolveBaseAttrs;
11938
11151
  }
11939
- createStateModel(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11940
- const { compiledDefinitions, stateProxyEligibility, stateProxyModeKey } = this.resolveEffectiveCompiledDefinitions();
11152
+ ensureStateEngine(stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11153
+ const { compiledDefinitions } = this.resolveEffectiveCompiledDefinitions();
11941
11154
  this.compiledStateDefinitions = compiledDefinitions;
11942
11155
  if (!compiledDefinitions) {
11943
11156
  this.stateEngine = undefined;
11944
11157
  this.stateEngineCompiledDefinitions = undefined;
11945
- this.stateEngineStateProxyModeKey = undefined;
11946
11158
  }
11947
11159
  else if (!this.stateEngine ||
11948
11160
  this.stateEngineCompiledDefinitions !== compiledDefinitions ||
11949
- this.stateEngineStateProxy !== this.stateProxy ||
11950
11161
  this.stateEngineStateSort !== this.stateSort ||
11951
- this.stateEngineMergeMode !== this.stateMergeMode ||
11952
- this.stateEngineStateProxyModeKey !== stateProxyModeKey) {
11162
+ this.stateEngineMergeMode !== this.stateMergeMode) {
11953
11163
  this.stateEngine = new StateEngine({
11954
11164
  compiledDefinitions,
11955
11165
  stateSort: this.stateSort,
11956
- stateProxy: this.stateProxy,
11957
- stateProxyEligibility,
11958
- states: this.states,
11959
11166
  mergeMode: this.stateMergeMode
11960
11167
  });
11961
11168
  this.stateEngineCompiledDefinitions = compiledDefinitions;
11962
- this.stateEngineStateProxy = this.stateProxy;
11963
11169
  this.stateEngineStateSort = this.stateSort;
11964
11170
  this.stateEngineMergeMode = this.stateMergeMode;
11965
- this.stateEngineStateProxyModeKey = stateProxyModeKey;
11966
11171
  }
11967
11172
  this.syncStateResolveContext(stateResolveBaseAttrs);
11968
- return new StateModel({
11969
- states: this.states,
11970
- currentStates: this.currentStates,
11971
- stateSort: this.stateSort,
11972
- stateProxy: this.stateProxy,
11973
- stateEngine: this.stateEngine
11974
- });
11173
+ if (this.stateEngine &&
11174
+ this.currentStates &&
11175
+ !this.sameStateNames(this.stateEngine.activeStates, this.currentStates)) {
11176
+ this.stateEngine.applyStates(this.currentStates);
11177
+ }
11178
+ return this.stateEngine;
11179
+ }
11180
+ toGraphicStateTransition(result) {
11181
+ return {
11182
+ changed: result.changed,
11183
+ states: [...result.activeStates],
11184
+ effectiveStates: [...result.effectiveStates]
11185
+ };
11186
+ }
11187
+ sortLocalStates(states) {
11188
+ return this.stateSort ? [...states].sort(this.stateSort) : [...states];
11975
11189
  }
11976
- resolveSimpleLocalStateTransition(states, previousStates) {
11190
+ resolveLocalUseStatesTransition(states) {
11977
11191
  var _a;
11978
- if (!this.states ||
11979
- this.stateProxy ||
11980
- this.stateSort ||
11981
- this.stateMergeMode === 'deep' ||
11982
- this.parent ||
11983
- ((_a = this.stage) === null || _a === void 0 ? void 0 : _a.rootSharedStateScope) ||
11984
- this.boundSharedStateScope) {
11985
- return null;
11192
+ if (!states.length) {
11193
+ return this.resolveLocalClearStatesTransition();
11986
11194
  }
11987
- if (states.length === 1) {
11988
- const stateName = states[0];
11989
- const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
11990
- const nextStates = [stateName];
11991
- const changed = !this.sameStateNames(previousStates, nextStates);
11992
- const resolvedStateAttrs = {};
11993
- if (hasDefinition) {
11994
- const attrs = this.states[stateName];
11995
- if (attrs != null) {
11996
- if (!isPlainObjectValue(attrs)) {
11997
- return null;
11998
- }
11999
- const keys = Object.keys(attrs);
12000
- for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
12001
- const key = keys[keyIndex];
12002
- if (FULL_STATE_DEFINITION_KEYS.has(key)) {
12003
- return null;
12004
- }
12005
- const attrValue = attrs[key];
12006
- resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
12007
- ? cloneAttributeValue(attrValue)
12008
- : attrValue;
12009
- }
12010
- }
12011
- }
11195
+ const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
11196
+ const changed = previousStates.length !== states.length || states.some((stateName, index) => previousStates[index] !== stateName);
11197
+ const nextStates = this.sortLocalStates(states);
11198
+ return {
11199
+ changed,
11200
+ states: changed ? nextStates : [...previousStates]
11201
+ };
11202
+ }
11203
+ resolveLocalClearStatesTransition() {
11204
+ return {
11205
+ changed: this.hasState(),
11206
+ states: []
11207
+ };
11208
+ }
11209
+ resolveUseStatesTransition(states, stateResolveBaseAttrs = this.getStateResolveBaseAttrs()) {
11210
+ const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
11211
+ return stateEngine
11212
+ ? this.toGraphicStateTransition(stateEngine.applyStates(states))
11213
+ : this.resolveLocalUseStatesTransition(states);
11214
+ }
11215
+ resolveClearStatesTransition() {
11216
+ const stateEngine = this.ensureStateEngine();
11217
+ return stateEngine
11218
+ ? this.toGraphicStateTransition(stateEngine.clearStates())
11219
+ : this.resolveLocalClearStatesTransition();
11220
+ }
11221
+ resolveAddStateTransition(stateName, keepCurrentStates) {
11222
+ var _a;
11223
+ const stateEngine = this.ensureStateEngine();
11224
+ if (stateEngine) {
11225
+ return this.toGraphicStateTransition(stateEngine.addState(stateName, keepCurrentStates));
11226
+ }
11227
+ if (this.currentStates &&
11228
+ this.currentStates.includes(stateName) &&
11229
+ (keepCurrentStates || this.currentStates.length === 1)) {
12012
11230
  return {
12013
- changed,
12014
- states: nextStates,
12015
- effectiveStates: nextStates,
12016
- resolvedStateAttrs
11231
+ changed: false,
11232
+ states: [...this.currentStates]
12017
11233
  };
12018
11234
  }
12019
- const uniqueStates = Array.from(new Set(states));
12020
- const withDefinition = [];
12021
- const withoutDefinition = [];
12022
- for (let i = 0; i < uniqueStates.length; i++) {
12023
- const stateName = uniqueStates[i];
12024
- if (Object.prototype.hasOwnProperty.call(this.states, stateName)) {
12025
- withDefinition.push(stateName);
12026
- }
12027
- else {
12028
- withoutDefinition.push(stateName);
12029
- }
11235
+ const nextStates = keepCurrentStates && ((_a = this.currentStates) === null || _a === void 0 ? void 0 : _a.length) ? this.currentStates.concat([stateName]) : [stateName];
11236
+ return this.resolveLocalUseStatesTransition(nextStates);
11237
+ }
11238
+ resolveRemoveStateTransition(stateName) {
11239
+ const stateEngine = this.ensureStateEngine();
11240
+ if (stateEngine) {
11241
+ return this.toGraphicStateTransition(stateEngine.removeState(stateName));
12030
11242
  }
12031
- withDefinition.sort((left, right) => left.localeCompare(right));
12032
- const nextStates = withDefinition.concat(withoutDefinition);
12033
- const changed = !this.sameStateNames(previousStates, nextStates);
12034
- const resolvedStateAttrs = {};
12035
- for (let i = 0; i < nextStates.length; i++) {
12036
- const stateName = nextStates[i];
12037
- const hasDefinition = Object.prototype.hasOwnProperty.call(this.states, stateName);
12038
- if (!hasDefinition) {
12039
- continue;
12040
- }
12041
- const attrs = this.states[stateName];
12042
- if (attrs == null) {
12043
- continue;
12044
- }
12045
- if (!isPlainObjectValue(attrs)) {
12046
- return null;
12047
- }
12048
- const keys = Object.keys(attrs);
12049
- for (let keyIndex = 0; keyIndex < keys.length; keyIndex++) {
12050
- const key = keys[keyIndex];
12051
- if (FULL_STATE_DEFINITION_KEYS.has(key)) {
12052
- return null;
12053
- }
12054
- const attrValue = attrs[key];
12055
- resolvedStateAttrs[key] = isPlainObjectValue(attrValue)
12056
- ? cloneAttributeValue(attrValue)
12057
- : attrValue;
12058
- }
11243
+ if (!this.currentStates) {
11244
+ return {
11245
+ changed: false,
11246
+ states: []
11247
+ };
12059
11248
  }
12060
- return {
12061
- changed,
12062
- states: nextStates,
12063
- effectiveStates: nextStates,
12064
- resolvedStateAttrs
12065
- };
11249
+ const filter = Array.isArray(stateName) ? (s) => !stateName.includes(s) : (s) => s !== stateName;
11250
+ const nextStates = this.currentStates.filter(filter);
11251
+ if (nextStates.length === this.currentStates.length) {
11252
+ return {
11253
+ changed: false,
11254
+ states: [...this.currentStates]
11255
+ };
11256
+ }
11257
+ return this.resolveLocalUseStatesTransition(nextStates);
12066
11258
  }
12067
- resolveGraphicStateTransition(states, previousStates, forceResolverRefresh = false) {
12068
- var _a, _b;
12069
- let transition = this.resolveSimpleLocalStateTransition(states, previousStates);
12070
- const isSimpleLocalTransition = !!transition;
12071
- let resolvedStateAttrs;
12072
- if (transition) {
12073
- resolvedStateAttrs = transition.resolvedStateAttrs;
11259
+ resolveToggleStateTransition(stateName) {
11260
+ const stateEngine = this.ensureStateEngine();
11261
+ if (stateEngine) {
11262
+ return this.toGraphicStateTransition(stateEngine.toggleState(stateName));
12074
11263
  }
12075
- else {
12076
- const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
12077
- const stateModel = this.createStateModel(stateResolveBaseAttrs);
12078
- if (forceResolverRefresh) {
12079
- (_a = this.stateEngine) === null || _a === void 0 ? void 0 : _a.invalidateResolverCache();
12080
- }
12081
- transition = stateModel.useStates(states);
12082
- resolvedStateAttrs =
12083
- this.stateEngine && this.compiledStateDefinitions
12084
- ? Object.assign({}, this.stateEngine.resolvedPatch) : this.getStateStyleResolver(this.stateMergeMode).resolve(stateResolveBaseAttrs, this.states, this.stateProxy, transition.states, this.stateSort);
11264
+ if (this.hasState(stateName)) {
11265
+ return this.resolveRemoveStateTransition(stateName);
12085
11266
  }
12086
- const effectiveStates = (_b = transition.effectiveStates) !== null && _b !== void 0 ? _b : transition.states;
11267
+ const nextStates = this.currentStates ? this.currentStates.slice() : [];
11268
+ nextStates.push(stateName);
11269
+ return this.resolveLocalUseStatesTransition(nextStates);
11270
+ }
11271
+ resolveGraphicStateTransition(states, forceResolverRefresh = false) {
11272
+ var _a;
11273
+ const stateResolveBaseAttrs = this.getStateResolveBaseAttrs();
11274
+ const stateEngine = this.ensureStateEngine(stateResolveBaseAttrs);
11275
+ if (forceResolverRefresh) {
11276
+ stateEngine === null || stateEngine === void 0 ? void 0 : stateEngine.invalidateResolverCache();
11277
+ }
11278
+ const transition = stateEngine
11279
+ ? this.toGraphicStateTransition(stateEngine.applyStates(states))
11280
+ : this.resolveLocalUseStatesTransition(states);
11281
+ const resolvedStateAttrs = this.stateEngine && this.compiledStateDefinitions ? Object.assign({}, this.stateEngine.resolvedPatch) : {};
11282
+ const effectiveStates = (_a = transition.effectiveStates) !== null && _a !== void 0 ? _a : transition.states;
12087
11283
  return {
12088
11284
  transition,
12089
11285
  effectiveStates: effectiveStates,
12090
- resolvedStateAttrs,
12091
- isSimpleLocalTransition
11286
+ resolvedStateAttrs
12092
11287
  };
12093
11288
  }
12094
11289
  normalizeSetStatesOptions(options) {
@@ -12125,28 +11320,20 @@ class Graphic extends Node {
12125
11320
  var _a;
12126
11321
  const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12127
11322
  const previousResolvedStatePatch = this.resolvedStatePatch;
12128
- const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates, true);
11323
+ const { transition, effectiveStates, resolvedStateAttrs } = this.resolveGraphicStateTransition(states, true);
12129
11324
  const patchChanged = !this.sameStatePatches(previousResolvedStatePatch, resolvedStateAttrs);
12130
11325
  if (patchChanged &&
12131
11326
  !this.beforeStateUpdate(resolvedStateAttrs, previousStates, transition.states, hasAnimation, false)) {
12132
11327
  return;
12133
11328
  }
12134
11329
  this.currentStates = transition.states;
12135
- this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
11330
+ this.effectiveStates = [...effectiveStates];
12136
11331
  this.resolvedStatePatch = resolvedStateAttrs;
12137
11332
  this.sharedStateDirty = false;
12138
11333
  this.syncSharedStateActiveRegistrations();
12139
11334
  if (!patchChanged) {
12140
11335
  return;
12141
11336
  }
12142
- if (this.stage) {
12143
- const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12144
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12145
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12146
- graphicId: this._uid,
12147
- targetStates: [...transition.states]
12148
- });
12149
- }
12150
11337
  if (hasAnimation && animateSameStatePatchChange) {
12151
11338
  this._syncFinalAttributeFromStaticTruth();
12152
11339
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
@@ -12178,10 +11365,10 @@ class Graphic extends Node {
12178
11365
  }
12179
11366
  : undefined;
12180
11367
  if (isClear) {
12181
- this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, stateNames, transitionOptions);
11368
+ this.getStateTransitionOrchestrator().applyClearTransition(this, attrs, hasAnimation, transitionOptions);
12182
11369
  return;
12183
11370
  }
12184
- const plan = this.getStateTransitionOrchestrator().analyzeTransition({}, attrs, stateNames, hasAnimation, {
11371
+ const plan = this.getStateTransitionOrchestrator().analyzeTransition(attrs, hasAnimation, {
12185
11372
  noWorkAnimateAttr: this.getNoWorkAnimateAttr(),
12186
11373
  animateConfig: resolvedAnimateConfig,
12187
11374
  extraAnimateAttrs: extraAnimateAttrs,
@@ -12214,19 +11401,11 @@ class Graphic extends Node {
12214
11401
  });
12215
11402
  stateAnimates.forEach(animate => animate.stop(type));
12216
11403
  }
12217
- getNormalAttribute(key) {
12218
- var _a, _b;
12219
- const value = this.attribute[key];
12220
- if (this.hasAnyTrackedAnimate()) {
12221
- return (_a = this.finalAttribute) === null || _a === void 0 ? void 0 : _a[key];
12222
- }
12223
- return value !== null && value !== void 0 ? value : (_b = this.finalAttribute) === null || _b === void 0 ? void 0 : _b[key];
12224
- }
12225
11404
  clearStates(hasAnimation) {
12226
11405
  var _a, _b, _c;
12227
11406
  const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12228
11407
  const previousResolvedStatePatch = this.resolvedStatePatch;
12229
- const transition = this.createStateModel().clearStates();
11408
+ const transition = this.resolveClearStatesTransition();
12230
11409
  if (!transition.changed && previousStates.length === 0) {
12231
11410
  this.currentStates = [];
12232
11411
  this.effectiveStates = [];
@@ -12247,14 +11426,6 @@ class Graphic extends Node {
12247
11426
  this.resolvedStatePatch = undefined;
12248
11427
  this.sharedStateDirty = false;
12249
11428
  this.clearSharedStateActiveRegistrations();
12250
- if (this.stage) {
12251
- const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12252
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12253
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12254
- graphicId: this._uid,
12255
- targetStates: []
12256
- });
12257
- }
12258
11429
  if (hasAnimation) {
12259
11430
  this._syncFinalAttributeFromStaticTruth();
12260
11431
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, true, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
@@ -12273,19 +11444,19 @@ class Graphic extends Node {
12273
11444
  }
12274
11445
  }
12275
11446
  removeState(stateName, hasAnimation) {
12276
- const transition = this.createStateModel().removeState(stateName);
11447
+ const transition = this.resolveRemoveStateTransition(stateName);
12277
11448
  if (transition.changed) {
12278
11449
  this.useStates(transition.states, hasAnimation);
12279
11450
  }
12280
11451
  }
12281
11452
  toggleState(stateName, hasAnimation) {
12282
- const transition = this.createStateModel().toggleState(stateName);
11453
+ const transition = this.resolveToggleStateTransition(stateName);
12283
11454
  if (transition.changed) {
12284
11455
  this.useStates(transition.states, hasAnimation);
12285
11456
  }
12286
11457
  }
12287
11458
  addState(stateName, keepCurrentStates, hasAnimation) {
12288
- const transition = this.createStateModel().addState(stateName, keepCurrentStates);
11459
+ const transition = this.resolveAddStateTransition(stateName, keepCurrentStates);
12289
11460
  if (!transition.changed) {
12290
11461
  return;
12291
11462
  }
@@ -12326,7 +11497,7 @@ class Graphic extends Node {
12326
11497
  }
12327
11498
  const previousStates = (_a = this.currentStates) !== null && _a !== void 0 ? _a : EMPTY_STATE_NAMES;
12328
11499
  const previousResolvedStatePatch = this.resolvedStatePatch;
12329
- const { transition, effectiveStates, resolvedStateAttrs, isSimpleLocalTransition } = this.resolveGraphicStateTransition(states, previousStates);
11500
+ const { transition, effectiveStates, resolvedStateAttrs } = this.resolveGraphicStateTransition(states);
12330
11501
  if (!transition.changed && this.sameStateNames(previousStates, transition.states)) {
12331
11502
  return;
12332
11503
  }
@@ -12334,18 +11505,10 @@ class Graphic extends Node {
12334
11505
  return;
12335
11506
  }
12336
11507
  this.currentStates = transition.states;
12337
- this.effectiveStates = isSimpleLocalTransition ? effectiveStates : [...effectiveStates];
11508
+ this.effectiveStates = [...effectiveStates];
12338
11509
  this.resolvedStatePatch = resolvedStateAttrs;
12339
11510
  this.sharedStateDirty = false;
12340
11511
  this.syncSharedStateActiveRegistrations();
12341
- if (this.stage) {
12342
- const perfMonitor = getActiveStageStatePerfMonitor(this.stage);
12343
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.incrementCounter('stateCommits');
12344
- perfMonitor === null || perfMonitor === void 0 ? void 0 : perfMonitor.recordEvent('state-commit', {
12345
- graphicId: this._uid,
12346
- targetStates: [...transition.states]
12347
- });
12348
- }
12349
11512
  if (hasAnimation) {
12350
11513
  this._syncFinalAttributeFromStaticTruth();
12351
11514
  this.applyStateAttrs(resolvedStateAttrs, transition.states, hasAnimation, false, undefined, this.buildRemovedStateAnimationAttrs(resolvedStateAttrs, previousResolvedStatePatch));
@@ -12609,12 +11772,10 @@ class Graphic extends Node {
12609
11772
  }
12610
11773
  this.boundSharedStateScope = undefined;
12611
11774
  this.boundSharedStateRevision = undefined;
12612
- this.localFallbackCompiledDefinitions = undefined;
12613
11775
  this.compiledStateDefinitions = undefined;
12614
11776
  this.compiledStateDefinitionsCacheKey = undefined;
12615
11777
  this.stateEngine = undefined;
12616
11778
  this.stateEngineCompiledDefinitions = undefined;
12617
- this.stateEngineStateProxyModeKey = undefined;
12618
11779
  this.sharedStateDirty = false;
12619
11780
  this.stage = null;
12620
11781
  this.layer = null;
@@ -14603,23 +13764,15 @@ class Glyph extends Graphic {
14603
13764
  states = states.sort(this.stateSort);
14604
13765
  }
14605
13766
  const stateAttrs = {};
14606
- const subAttrs = this.subGraphic.map(() => ({}));
14607
13767
  states.forEach(stateName => {
14608
- var _a;
14609
13768
  const attrs = this.glyphStateProxy ? this.glyphStateProxy(stateName, states) : this.glyphStates[stateName];
14610
13769
  if (attrs) {
14611
13770
  Object.assign(stateAttrs, attrs.attributes);
14612
- if ((_a = attrs.subAttributes) === null || _a === void 0 ? void 0 : _a.length) {
14613
- subAttrs.forEach((subAttrs, index) => {
14614
- Object.assign(subAttrs, attrs.subAttributes[index]);
14615
- });
14616
- }
14617
13771
  }
14618
13772
  });
14619
13773
  if (!this.beforeStateUpdate(stateAttrs, previousStates, states, hasAnimation, false)) {
14620
13774
  return;
14621
13775
  }
14622
- this.updateNormalAttrs(stateAttrs);
14623
13776
  this.currentStates = states;
14624
13777
  this.applyStateAttrs(stateAttrs, states, hasAnimation);
14625
13778
  }
@@ -14636,7 +13789,6 @@ class Glyph extends Graphic {
14636
13789
  else {
14637
13790
  this.currentStates = [];
14638
13791
  }
14639
- this.normalAttrs = null;
14640
13792
  }
14641
13793
  clone() {
14642
13794
  const glyph = new Glyph(Object.assign({}, this.attribute));
@@ -16674,6 +15826,7 @@ const ARC_UPDATE_TAG_KEY = [
16674
15826
  'cornerRadius',
16675
15827
  'padAngle',
16676
15828
  'padRadius',
15829
+ 'clipRange',
16677
15830
  'cap',
16678
15831
  ...GRAPHIC_UPDATE_TAG_KEY
16679
15832
  ];
@@ -16726,12 +15879,13 @@ class Arc extends Graphic {
16726
15879
  getParsedAngle() {
16727
15880
  const arcTheme = this.getGraphicTheme();
16728
15881
  let { startAngle = arcTheme.startAngle, endAngle = arcTheme.endAngle } = this.attribute;
16729
- const { cap = arcTheme.cap } = this.attribute;
15882
+ const { cap = arcTheme.cap, clipRange = arcTheme.clipRange } = this.attribute;
16730
15883
  const sign = endAngle - startAngle >= 0 ? 1 : -1;
16731
- const deltaAngle = endAngle - startAngle;
15884
+ let deltaAngle = endAngle - startAngle;
15885
+ deltaAngle *= Math.max(0, Math.min(clipRange, 1));
16732
15886
  startAngle = clampAngleByRadian(startAngle);
16733
15887
  endAngle = startAngle + deltaAngle;
16734
- if (cap && abs(deltaAngle) < pi2 - epsilon) {
15888
+ if (cap && abs(deltaAngle) > epsilon && abs(deltaAngle) < pi2 - epsilon) {
16735
15889
  let startCap = 1;
16736
15890
  let endCap = 1;
16737
15891
  if (cap.length) {
@@ -17076,7 +16230,6 @@ class Group extends Graphic {
17076
16230
  this.type = 'group';
17077
16231
  this.parent = null;
17078
16232
  this.isContainer = true;
17079
- this._hasSharedStateDefinitions = false;
17080
16233
  this.numberType = GROUP_NUMBER_TYPE;
17081
16234
  this._childUpdateTag = UpdateTag.UPDATE_BOUNDS;
17082
16235
  }
@@ -17089,7 +16242,6 @@ class Group extends Graphic {
17089
16242
  }
17090
16243
  const previousScope = this.sharedStateScope;
17091
16244
  this._sharedStateDefinitions = value;
17092
- this._hasSharedStateDefinitions = !!value && Object.keys(value).length > 0;
17093
16245
  this.ensureSharedStateScopeBound();
17094
16246
  if (this.sharedStateScope) {
17095
16247
  setSharedStateScopeLocalDefinitions(this.sharedStateScope, value);
@@ -17234,13 +16386,7 @@ class Group extends Graphic {
17234
16386
  incrementalAppendChild(node) {
17235
16387
  const data = super.appendChild(node);
17236
16388
  if (data) {
17237
- if (this.stage &&
17238
- (data.stage !== this.stage || data.layer !== this.layer)) {
17239
- data.setStage(this.stage, this.layer);
17240
- }
17241
- else if (data.onParentSharedStateTreeChanged) {
17242
- data.onParentSharedStateTreeChanged(this.stage, this.layer);
17243
- }
16389
+ this.syncChildSharedStateTreeBinding(data);
17244
16390
  }
17245
16391
  this.addUpdateBoundTag();
17246
16392
  this.getGraphicService().onAddIncremental(node, this, this.stage);
@@ -17254,12 +16400,7 @@ class Group extends Graphic {
17254
16400
  }
17255
16401
  _updateChildToStage(child) {
17256
16402
  if (child) {
17257
- if (this.stage && (child.stage !== this.stage || child.layer !== this.layer)) {
17258
- child.setStage(this.stage, this.layer);
17259
- }
17260
- else if (child.onParentSharedStateTreeChanged) {
17261
- child.onParentSharedStateTreeChanged(this.stage, this.layer);
17262
- }
16403
+ this.syncChildSharedStateTreeBinding(child);
17263
16404
  }
17264
16405
  this.addUpdateBoundTag();
17265
16406
  return child;
@@ -17267,13 +16408,8 @@ class Group extends Graphic {
17267
16408
  appendChild(node, addStage = true) {
17268
16409
  const data = super.appendChild(node);
17269
16410
  if (data) {
17270
- if (addStage &&
17271
- this.stage &&
17272
- (data.stage !== this.stage || data.layer !== this.layer)) {
17273
- data.setStage(this.stage, this.layer);
17274
- }
17275
- else if (data.onParentSharedStateTreeChanged) {
17276
- data.onParentSharedStateTreeChanged(this.stage, this.layer);
16411
+ if (addStage) {
16412
+ this.syncChildSharedStateTreeBinding(data);
17277
16413
  }
17278
16414
  }
17279
16415
  this.addUpdateBoundTag();
@@ -17289,13 +16425,12 @@ class Group extends Graphic {
17289
16425
  return this._updateChildToStage(super.insertInto(newNode, idx));
17290
16426
  }
17291
16427
  removeChild(child, highPerformance = false) {
17292
- var _a;
17293
16428
  const data = super.removeChild(child);
17294
16429
  if (!data) {
17295
16430
  return data;
17296
16431
  }
17297
16432
  if (highPerformance) {
17298
- (_a = child.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(child);
16433
+ child.detachStageForRelease();
17299
16434
  return data;
17300
16435
  }
17301
16436
  this.getGraphicService().onRemove(child);
@@ -17320,7 +16455,7 @@ class Group extends Graphic {
17320
16455
  setStage(stage, layer) {
17321
16456
  var _a, _b, _c, _d, _e, _f;
17322
16457
  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;
17323
- const needsSharedStateTreeSync = this._hasSharedStateDefinitions ||
16458
+ const needsSharedStateTreeSync = this.hasSharedStateDefinitions() ||
17324
16459
  this.sharedStateScope ||
17325
16460
  ((_d = this.currentStates) === null || _d === void 0 ? void 0 : _d.length) ||
17326
16461
  this.boundSharedStateScope ||
@@ -17336,9 +16471,7 @@ class Group extends Graphic {
17336
16471
  this.setStageToShadowRoot(stage, layer);
17337
16472
  this._onSetStage && this._onSetStage(this, stage, layer);
17338
16473
  (_f = graphicService === null || graphicService === void 0 ? void 0 : graphicService.onSetStage) === null || _f === void 0 ? void 0 : _f.call(graphicService, this, stage);
17339
- this.forEachChildren(item => {
17340
- item.setStage(stage, this.layer);
17341
- });
16474
+ this.notifyChildrenSharedStateTreeChanged();
17342
16475
  return;
17343
16476
  }
17344
16477
  const layerChanged = this.layer !== layer;
@@ -17351,11 +16484,7 @@ class Group extends Graphic {
17351
16484
  this.notifyChildrenSharedStateTreeChanged();
17352
16485
  }
17353
16486
  else if (layerChanged) {
17354
- this.forEachChildren(item => {
17355
- if (item.onParentSharedStateTreeChanged) {
17356
- item.onParentSharedStateTreeChanged(stage, this.layer);
17357
- }
17358
- });
16487
+ this.notifyChildrenSharedStateTreeChanged();
17359
16488
  }
17360
16489
  }
17361
16490
  addUpdatePositionTag() {
@@ -17427,8 +16556,7 @@ class Group extends Graphic {
17427
16556
  super.detachStageForRelease();
17428
16557
  this.sharedStateScope = undefined;
17429
16558
  this.forEachChildren((item) => {
17430
- var _a;
17431
- (_a = item.detachStageForRelease) === null || _a === void 0 ? void 0 : _a.call(item);
16559
+ item.detachStageForRelease();
17432
16560
  });
17433
16561
  }
17434
16562
  ensureSharedStateScopeBound() {
@@ -17442,7 +16570,6 @@ class Group extends Graphic {
17442
16570
  this.sharedStateScope = createGroupSharedStateScope(this, parentScope, this._sharedStateDefinitions);
17443
16571
  return;
17444
16572
  }
17445
- this.sharedStateScope.ownerGroup = this;
17446
16573
  this.sharedStateScope.ownerStage = this.stage;
17447
16574
  setSharedStateScopeParent(this.sharedStateScope, parentScope);
17448
16575
  if (this.sharedStateScope.localStateDefinitions !== this._sharedStateDefinitions) {
@@ -17450,15 +16577,16 @@ class Group extends Graphic {
17450
16577
  }
17451
16578
  }
17452
16579
  hasSharedStateDefinitions() {
17453
- return this._hasSharedStateDefinitions;
16580
+ return !!this._sharedStateDefinitions && Object.keys(this._sharedStateDefinitions).length > 0;
17454
16581
  }
17455
16582
  notifyChildrenSharedStateTreeChanged() {
17456
16583
  this.forEachChildren(item => {
17457
- if (item.onParentSharedStateTreeChanged) {
17458
- item.onParentSharedStateTreeChanged(this.stage, this.layer);
17459
- }
16584
+ this.syncChildSharedStateTreeBinding(item);
17460
16585
  });
17461
16586
  }
16587
+ syncChildSharedStateTreeBinding(child) {
16588
+ child.onParentSharedStateTreeChanged(this.stage, this.layer);
16589
+ }
17462
16590
  onParentSharedStateTreeChanged(stage, layer) {
17463
16591
  var _a;
17464
16592
  if (this.stage !== stage || this.layer !== layer) {
@@ -19559,11 +18687,6 @@ class RendererRegistry {
19559
18687
  this.entries.set(key, renderer);
19560
18688
  this.cache.delete(key);
19561
18689
  }
19562
- registerMany(entries) {
19563
- for (const [key, renderer] of entries) {
19564
- this.register(key, renderer);
19565
- }
19566
- }
19567
18690
  get(key) {
19568
18691
  if (this.cache.has(key)) {
19569
18692
  return this.cache.get(key);
@@ -19594,11 +18717,6 @@ class PickerRegistry {
19594
18717
  register(key, picker) {
19595
18718
  this.entries.set(key, picker);
19596
18719
  }
19597
- registerMany(entries) {
19598
- for (const [key, picker] of entries) {
19599
- this.register(key, picker);
19600
- }
19601
- }
19602
18720
  get(key) {
19603
18721
  return this.entries.get(key);
19604
18722
  }
@@ -19641,11 +18759,6 @@ class ContributionRegistry {
19641
18759
  current.push(contribution);
19642
18760
  this.entries.set(key, current);
19643
18761
  }
19644
- registerMany(entries) {
19645
- for (const [key, contribution] of entries) {
19646
- this.register(key, contribution);
19647
- }
19648
- }
19649
18762
  get(key) {
19650
18763
  var _a;
19651
18764
  return [...((_a = this.entries.get(key)) !== null && _a !== void 0 ? _a : [])];
@@ -19670,13 +18783,12 @@ const EMPTY_AUTO_ENABLE_PROVIDER = {
19670
18783
  };
19671
18784
  class DefaultPluginService {
19672
18785
  constructor(autoEnablePlugins = EMPTY_AUTO_ENABLE_PROVIDER, deps = {}) {
19673
- var _a, _b, _c;
18786
+ var _a;
19674
18787
  this.autoEnablePlugins = autoEnablePlugins;
19675
18788
  this.onStartupFinishedPlugin = [];
19676
18789
  this.onRegisterPlugin = [];
19677
18790
  this.actived = false;
19678
18791
  this.pluginRegistry = (_a = deps.pluginRegistry) !== null && _a !== void 0 ? _a : new PluginRegistry();
19679
- this.autoEnablePlugins = (_c = (_b = deps.autoEnablePlugins) !== null && _b !== void 0 ? _b : this.autoEnablePlugins) !== null && _c !== void 0 ? _c : EMPTY_AUTO_ENABLE_PROVIDER;
19680
18792
  }
19681
18793
  active(stage, params) {
19682
18794
  this.stage = stage;
@@ -19948,7 +19060,7 @@ class DirtyBoundsPlugin {
19948
19060
  this.key = this.name + this._uid;
19949
19061
  this.dirtyBoundsHooksRegistered = false;
19950
19062
  this.handlePaintOnlyUpdate = (graphic) => {
19951
- var _a, _b, _c, _d;
19063
+ var _a;
19952
19064
  const stage = this.pluginService.stage;
19953
19065
  if (!(stage && stage === graphic.stage && stage.renderCount)) {
19954
19066
  return;
@@ -19961,7 +19073,7 @@ class DirtyBoundsPlugin {
19961
19073
  if (ownerBounds && !ownerBounds.empty()) {
19962
19074
  stage.dirty(ownerBounds);
19963
19075
  }
19964
- (_b = owner.clearUpdatePaintTag) === null || _b === void 0 ? void 0 : _b.call(owner);
19076
+ owner.clearUpdatePaintTag();
19965
19077
  const shadowRoot = owner.shadowRoot;
19966
19078
  if (!shadowRoot) {
19967
19079
  return;
@@ -19970,29 +19082,25 @@ class DirtyBoundsPlugin {
19970
19082
  if (shadowBounds && !shadowBounds.empty()) {
19971
19083
  stage.dirty(shadowBounds);
19972
19084
  }
19973
- (_d = (_c = shadowRoot).clearUpdatePaintTag) === null || _d === void 0 ? void 0 : _d.call(_c);
19085
+ shadowRoot.clearUpdatePaintTag();
19974
19086
  };
19975
19087
  }
19976
19088
  ensurePaintDirtyBoundsCache(graphic) {
19977
- var _a, _b;
19089
+ var _a;
19978
19090
  const owner = graphic;
19979
- const hasLocalBounds = owner._AABBBounds && typeof owner._AABBBounds.empty === 'function' && !owner._AABBBounds.empty();
19980
- if (!hasLocalBounds && typeof owner.doUpdateAABBBounds === 'function') {
19091
+ if (owner._AABBBounds.empty()) {
19981
19092
  owner.doUpdateAABBBounds(((_a = owner.attribute) === null || _a === void 0 ? void 0 : _a.boundsMode) === 'imprecise');
19982
19093
  }
19983
- const hasGlobalBounds = owner._globalAABBBounds &&
19984
- typeof owner._globalAABBBounds.empty === 'function' &&
19985
- !owner._globalAABBBounds.empty();
19986
- if (!hasGlobalBounds && typeof owner.tryUpdateGlobalAABBBounds === 'function') {
19094
+ if (!owner._globalAABBBounds || owner._globalAABBBounds.empty()) {
19987
19095
  owner.tryUpdateGlobalAABBBounds();
19988
19096
  }
19989
- return (_b = owner._globalAABBBounds) !== null && _b !== void 0 ? _b : owner.globalAABBBounds;
19097
+ return owner._globalAABBBounds;
19990
19098
  }
19991
19099
  getRemoveDirtyBounds(graphic) {
19992
19100
  var _a;
19993
19101
  const owner = ((_a = graphic.glyphHost) !== null && _a !== void 0 ? _a : graphic);
19994
19102
  const cachedBounds = owner._globalAABBBounds;
19995
- if (cachedBounds && typeof cachedBounds.empty === 'function' && !cachedBounds.empty()) {
19103
+ if (cachedBounds && !cachedBounds.empty()) {
19996
19104
  return cachedBounds;
19997
19105
  }
19998
19106
  }
@@ -20128,387 +19236,6 @@ function getCurrentEnv() {
20128
19236
  return isBrowserEnv() ? 'browser' : 'node';
20129
19237
  }
20130
19238
 
20131
- function isRenderableGraphic(graphic) {
20132
- return !!graphic.stage && graphic.releaseStatus !== 'released';
20133
- }
20134
- function createTargetStatesKey(targetStates) {
20135
- return targetStates.length ? targetStates.join('|') : '__clear__';
20136
- }
20137
- function createIntentKey(contextOwnerId, configFingerprint, targetStatesKey) {
20138
- return `${contextOwnerId}:${configFingerprint}:${targetStatesKey}`;
20139
- }
20140
- function hasMeaningfulDeferredConfig(config) {
20141
- const normalized = normalizeDeferredStateOwnerConfig(config);
20142
- return !!normalized && (normalized.localEnabled != null || normalized.deferred != null);
20143
- }
20144
- function getGraphicCompiledDefinitions(graphic) {
20145
- const graphicAny = graphic;
20146
- if (typeof graphicAny.resolveEffectiveCompiledDefinitions === 'function') {
20147
- const result = graphicAny.resolveEffectiveCompiledDefinitions();
20148
- return {
20149
- compiledDefinitions: result.compiledDefinitions,
20150
- stateProxyEligibility: result.stateProxyEligibility
20151
- };
20152
- }
20153
- return {};
20154
- }
20155
- function getCurrentStateNames(graphic) {
20156
- var _a, _b;
20157
- return (_b = (_a = graphic.currentStates) === null || _a === void 0 ? void 0 : _a.slice()) !== null && _b !== void 0 ? _b : [];
20158
- }
20159
- class StateBatchScheduler {
20160
- constructor(stage, perfMonitor) {
20161
- this.stage = stage;
20162
- this.perfMonitor = perfMonitor;
20163
- this.jobsByIntentKey = new Map();
20164
- this.pendingIntentByGraphic = new Map();
20165
- this.nextJobId = 1;
20166
- this.runningJobs = new Map();
20167
- }
20168
- schedule(graphics, targetStates) {
20169
- const batchOperation = graphics.length > 1;
20170
- graphics.forEach(graphic => {
20171
- const eligibility = this.resolveEligibility(graphic, targetStates, batchOperation, true);
20172
- if ('reason' in eligibility) {
20173
- this.removeGraphicFromPending(graphic);
20174
- if (eligibility.reason !== 'graphic_unavailable') {
20175
- this.commitSynchronously(graphic, targetStates);
20176
- }
20177
- return;
20178
- }
20179
- this.enqueueDeferredIntent(graphic, targetStates, eligibility.context, eligibility.targetStatesKey);
20180
- });
20181
- }
20182
- release() {
20183
- var _a;
20184
- this.jobsByIntentKey.forEach(job => {
20185
- job.status = 'cancelled';
20186
- });
20187
- this.jobsByIntentKey.clear();
20188
- this.pendingIntentByGraphic.clear();
20189
- this.runningJobs.clear();
20190
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.updateBatchPending(0);
20191
- }
20192
- resolveEligibility(graphic, targetStates, batchOperation, recordObservability) {
20193
- var _a, _b, _c, _d, _e, _f;
20194
- if (!isRenderableGraphic(graphic)) {
20195
- if (recordObservability) {
20196
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.recordDeferredIneligible('graphic_unavailable');
20197
- }
20198
- return { eligible: false, reason: 'graphic_unavailable' };
20199
- }
20200
- if (!batchOperation) {
20201
- if (recordObservability) {
20202
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.recordDeferredIneligible('non_batch_operation');
20203
- }
20204
- return { eligible: false, reason: 'non_batch_operation' };
20205
- }
20206
- const context = this.resolveDeferredContext(graphic);
20207
- if (!context) {
20208
- if (recordObservability) {
20209
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.recordDeferredIneligible('graphic_unavailable');
20210
- }
20211
- return { eligible: false, reason: 'graphic_unavailable' };
20212
- }
20213
- if (!context.config.enabled) {
20214
- const normalizedOwnerConfig = normalizeDeferredStateOwnerConfig(context.contextOwner.deferredStateConfig);
20215
- const reason = (normalizedOwnerConfig === null || normalizedOwnerConfig === void 0 ? void 0 : normalizedOwnerConfig.localEnabled) === false ? 'context_disabled' : 'config_disabled';
20216
- if (recordObservability) {
20217
- (_d = this.perfMonitor) === null || _d === void 0 ? void 0 : _d.recordDeferredIneligible(reason);
20218
- }
20219
- return { eligible: false, reason };
20220
- }
20221
- const classification = this.classifyGraphicTargetStates(graphic, targetStates);
20222
- if (classification.reason) {
20223
- if (recordObservability) {
20224
- (_e = this.perfMonitor) === null || _e === void 0 ? void 0 : _e.recordDeferredIneligible(classification.reason);
20225
- }
20226
- return { eligible: false, reason: classification.reason };
20227
- }
20228
- if (classification.category !== UpdateCategory.PAINT) {
20229
- if (recordObservability) {
20230
- (_f = this.perfMonitor) === null || _f === void 0 ? void 0 : _f.recordDeferredIneligible('mixed_update_category');
20231
- }
20232
- return { eligible: false, reason: 'mixed_update_category' };
20233
- }
20234
- return {
20235
- eligible: true,
20236
- context,
20237
- targetStatesKey: createTargetStatesKey(targetStates)
20238
- };
20239
- }
20240
- resolveDeferredContext(graphic) {
20241
- var _a;
20242
- const stage = graphic.stage;
20243
- if (!stage) {
20244
- return undefined;
20245
- }
20246
- let owner = stage;
20247
- let config = normalizeDeferredStateConfig(undefined);
20248
- const ownerConfigs = [stage];
20249
- const parents = [];
20250
- let parent = graphic.parent;
20251
- while (parent && parent !== stage) {
20252
- parents.push(parent);
20253
- parent = parent.parent;
20254
- }
20255
- parents.reverse().forEach(current => ownerConfigs.push(current));
20256
- ownerConfigs.forEach(current => {
20257
- const deferredStateConfig = normalizeDeferredStateOwnerConfig(current.deferredStateConfig);
20258
- if (!deferredStateConfig) {
20259
- return;
20260
- }
20261
- if (deferredStateConfig.deferred) {
20262
- config = Object.assign(Object.assign({}, config), deferredStateConfig.deferred);
20263
- }
20264
- if (deferredStateConfig.localEnabled != null) {
20265
- config.enabled = deferredStateConfig.localEnabled;
20266
- }
20267
- if (hasMeaningfulDeferredConfig(current.deferredStateConfig)) {
20268
- owner = current;
20269
- }
20270
- });
20271
- const normalized = normalizeDeferredStateConfig(config);
20272
- return {
20273
- contextOwner: owner,
20274
- contextOwnerId: (_a = owner._uid) !== null && _a !== void 0 ? _a : 0,
20275
- config: normalized,
20276
- configFingerprint: fingerprintDeferredStateConfig(normalized)
20277
- };
20278
- }
20279
- classifyGraphicTargetStates(graphic, targetStates) {
20280
- const { compiledDefinitions, stateProxyEligibility } = getGraphicCompiledDefinitions(graphic);
20281
- const candidateStates = Array.from(new Set([...getCurrentStateNames(graphic), ...targetStates]));
20282
- let category = UpdateCategory.NONE;
20283
- candidateStates.forEach(stateName => {
20284
- if (stateProxyEligibility === null || stateProxyEligibility === void 0 ? void 0 : stateProxyEligibility(stateName)) {
20285
- category = UpdateCategory.NONE;
20286
- return;
20287
- }
20288
- const definition = compiledDefinitions === null || compiledDefinitions === void 0 ? void 0 : compiledDefinitions.get(stateName);
20289
- if (!definition) {
20290
- return;
20291
- }
20292
- if (definition.hasResolver && definition.affectedKeys.size === 0) {
20293
- category = UpdateCategory.NONE;
20294
- return;
20295
- }
20296
- category |= classifyAffectedKeys(definition.affectedKeys);
20297
- });
20298
- if (candidateStates.some(stateName => stateProxyEligibility === null || stateProxyEligibility === void 0 ? void 0 : stateProxyEligibility(stateName)) ||
20299
- candidateStates.some(stateName => {
20300
- const definition = compiledDefinitions === null || compiledDefinitions === void 0 ? void 0 : compiledDefinitions.get(stateName);
20301
- return !!(definition === null || definition === void 0 ? void 0 : definition.hasResolver) && definition.affectedKeys.size === 0;
20302
- })) {
20303
- return {
20304
- category: UpdateCategory.NONE,
20305
- reason: 'resolver_unstable_keys'
20306
- };
20307
- }
20308
- return {
20309
- category: category === UpdateCategory.NONE ? UpdateCategory.PAINT : category
20310
- };
20311
- }
20312
- enqueueDeferredIntent(graphic, targetStates, context, targetStatesKey) {
20313
- var _a, _b, _c, _d, _e, _f;
20314
- const nextIntentKey = createIntentKey(context.contextOwnerId, context.configFingerprint, targetStatesKey);
20315
- const prevIntentKey = this.pendingIntentByGraphic.get(graphic);
20316
- if (prevIntentKey === nextIntentKey) {
20317
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.incrementCounter('deferredJobsCoalesced');
20318
- return;
20319
- }
20320
- if (prevIntentKey) {
20321
- this.removeGraphicFromIntentJob(graphic, prevIntentKey);
20322
- }
20323
- let job = this.jobsByIntentKey.get(nextIntentKey);
20324
- if (!job) {
20325
- job = {
20326
- id: this.nextJobId++,
20327
- kind: 'apply_states',
20328
- intentKey: nextIntentKey,
20329
- status: 'pending',
20330
- targetStates: [...targetStates],
20331
- targetStatesKey,
20332
- pendingGraphics: new Set(),
20333
- orderedGraphics: [],
20334
- config: context.config,
20335
- contextOwner: context.contextOwner,
20336
- contextOwnerId: context.contextOwnerId,
20337
- configFingerprint: context.configFingerprint,
20338
- createdAt: Date.now(),
20339
- processedCount: 0
20340
- };
20341
- this.jobsByIntentKey.set(nextIntentKey, job);
20342
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.incrementCounter('deferredJobsCreated');
20343
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.updateBatchPending(this.jobsByIntentKey.size);
20344
- }
20345
- else {
20346
- (_d = this.perfMonitor) === null || _d === void 0 ? void 0 : _d.incrementCounter('deferredJobsCoalesced');
20347
- }
20348
- if (!job.pendingGraphics.has(graphic)) {
20349
- job.pendingGraphics.add(graphic);
20350
- job.orderedGraphics.push(graphic);
20351
- this.pendingIntentByGraphic.set(graphic, nextIntentKey);
20352
- (_e = this.perfMonitor) === null || _e === void 0 ? void 0 : _e.recordAllocation('batchEntriesCreated');
20353
- (_f = this.perfMonitor) === null || _f === void 0 ? void 0 : _f.updateMaxGraphicsInJob(job.pendingGraphics.size);
20354
- }
20355
- this.ensureJobRunning(job);
20356
- }
20357
- removeGraphicFromPending(graphic) {
20358
- const prevIntentKey = this.pendingIntentByGraphic.get(graphic);
20359
- if (!prevIntentKey) {
20360
- return;
20361
- }
20362
- this.removeGraphicFromIntentJob(graphic, prevIntentKey);
20363
- }
20364
- removeGraphicFromIntentJob(graphic, intentKey) {
20365
- var _a, _b, _c;
20366
- const job = this.jobsByIntentKey.get(intentKey);
20367
- if (!job) {
20368
- this.pendingIntentByGraphic.delete(graphic);
20369
- return;
20370
- }
20371
- job.pendingGraphics.delete(graphic);
20372
- if (this.pendingIntentByGraphic.get(graphic) === intentKey) {
20373
- this.pendingIntentByGraphic.delete(graphic);
20374
- }
20375
- if (job.pendingGraphics.size === 0 && job.status !== 'completed') {
20376
- job.status = 'cancelled';
20377
- this.jobsByIntentKey.delete(intentKey);
20378
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.incrementCounter('deferredJobsCancelled');
20379
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.recordEvent('deferred-job-cancel', {
20380
- intentKey,
20381
- jobId: job.id
20382
- });
20383
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.updateBatchPending(this.jobsByIntentKey.size);
20384
- }
20385
- }
20386
- ensureJobRunning(job) {
20387
- if (this.runningJobs.has(job.intentKey)) {
20388
- return;
20389
- }
20390
- const runner = this.runJob(job).then(() => {
20391
- this.runningJobs.delete(job.intentKey);
20392
- }, () => {
20393
- this.runningJobs.delete(job.intentKey);
20394
- });
20395
- this.runningJobs.set(job.intentKey, runner);
20396
- }
20397
- runJob(job) {
20398
- var _a, _b, _c, _d, _e, _f, _g, _h, _j;
20399
- return __awaiter(this, void 0, void 0, function* () {
20400
- if (job.status === 'cancelled') {
20401
- return;
20402
- }
20403
- yield this.waitForNextFrame();
20404
- if (job.status === 'cancelled') {
20405
- return;
20406
- }
20407
- job.status = 'running';
20408
- (_a = this.perfMonitor) === null || _a === void 0 ? void 0 : _a.recordEvent('deferred-job-start', {
20409
- intentKey: job.intentKey,
20410
- jobId: job.id
20411
- });
20412
- let index = 0;
20413
- let frameStart = performance.now();
20414
- let processedInFrame = 0;
20415
- let committedInSlice = 0;
20416
- while (index < job.orderedGraphics.length) {
20417
- if (job.status === 'cancelled') {
20418
- return;
20419
- }
20420
- if (processedInFrame > 0 &&
20421
- (processedInFrame >= job.config.maxGraphicsPerFrame || performance.now() - frameStart >= job.config.frameBudget)) {
20422
- (_b = this.perfMonitor) === null || _b === void 0 ? void 0 : _b.incrementCounter('deferredBudgetYields');
20423
- (_c = this.perfMonitor) === null || _c === void 0 ? void 0 : _c.recordCost('batchSlice', performance.now() - frameStart);
20424
- (_d = this.perfMonitor) === null || _d === void 0 ? void 0 : _d.recordEvent('deferred-job-yield', {
20425
- intentKey: job.intentKey,
20426
- jobId: job.id,
20427
- processedInFrame
20428
- });
20429
- if (committedInSlice > 0) {
20430
- this.stage.renderNextFrame();
20431
- }
20432
- yield this.waitForNextFrame();
20433
- frameStart = performance.now();
20434
- processedInFrame = 0;
20435
- committedInSlice = 0;
20436
- }
20437
- const graphic = job.orderedGraphics[index++];
20438
- if (!job.pendingGraphics.has(graphic)) {
20439
- continue;
20440
- }
20441
- if (!isRenderableGraphic(graphic)) {
20442
- job.pendingGraphics.delete(graphic);
20443
- if (this.pendingIntentByGraphic.get(graphic) === job.intentKey) {
20444
- this.pendingIntentByGraphic.delete(graphic);
20445
- }
20446
- continue;
20447
- }
20448
- if (this.pendingIntentByGraphic.get(graphic) !== job.intentKey) {
20449
- job.pendingGraphics.delete(graphic);
20450
- continue;
20451
- }
20452
- const nextEligibility = this.resolveEligibility(graphic, job.targetStates, true, false);
20453
- if (!nextEligibility.eligible) {
20454
- job.pendingGraphics.delete(graphic);
20455
- this.pendingIntentByGraphic.delete(graphic);
20456
- this.commitSynchronously(graphic, job.targetStates);
20457
- continue;
20458
- }
20459
- const nextIntentKey = createIntentKey(nextEligibility.context.contextOwnerId, nextEligibility.context.configFingerprint, nextEligibility.targetStatesKey);
20460
- if (nextIntentKey !== job.intentKey) {
20461
- job.pendingGraphics.delete(graphic);
20462
- this.pendingIntentByGraphic.delete(graphic);
20463
- this.enqueueDeferredIntent(graphic, job.targetStates, nextEligibility.context, nextEligibility.targetStatesKey);
20464
- continue;
20465
- }
20466
- this.commitSynchronously(graphic, job.targetStates);
20467
- job.pendingGraphics.delete(graphic);
20468
- this.pendingIntentByGraphic.delete(graphic);
20469
- job.processedCount += 1;
20470
- processedInFrame += 1;
20471
- committedInSlice += 1;
20472
- (_e = this.perfMonitor) === null || _e === void 0 ? void 0 : _e.incrementCounter('deferredGraphicsCommitted');
20473
- }
20474
- if (processedInFrame > 0) {
20475
- (_f = this.perfMonitor) === null || _f === void 0 ? void 0 : _f.recordCost('batchSlice', performance.now() - frameStart);
20476
- this.stage.renderNextFrame();
20477
- }
20478
- if (job.pendingGraphics.size === 0 && this.jobsByIntentKey.get(job.intentKey) === job) {
20479
- job.status = 'completed';
20480
- this.jobsByIntentKey.delete(job.intentKey);
20481
- (_g = this.perfMonitor) === null || _g === void 0 ? void 0 : _g.incrementCounter('deferredJobsCompleted');
20482
- (_h = this.perfMonitor) === null || _h === void 0 ? void 0 : _h.recordEvent('deferred-job-complete', {
20483
- intentKey: job.intentKey,
20484
- jobId: job.id,
20485
- processedCount: job.processedCount
20486
- });
20487
- (_j = this.perfMonitor) === null || _j === void 0 ? void 0 : _j.updateBatchPending(this.jobsByIntentKey.size);
20488
- }
20489
- });
20490
- }
20491
- waitForNextFrame() {
20492
- const stageGlobal = this.stage.global;
20493
- if (stageGlobal === null || stageGlobal === void 0 ? void 0 : stageGlobal.getSpecifiedPerformanceRAF) {
20494
- return stageGlobal.getSpecifiedPerformanceRAF(this.stage.rafId).wait();
20495
- }
20496
- return new Promise(resolve => {
20497
- stageGlobal === null || stageGlobal === void 0 ? void 0 : stageGlobal.getSpecifiedRequestAnimationFrame(this.stage.rafId)(() => resolve());
20498
- });
20499
- }
20500
- commitSynchronously(graphic, targetStates) {
20501
- if (!isRenderableGraphic(graphic)) {
20502
- return;
20503
- }
20504
- if (!targetStates.length) {
20505
- graphic.clearStates(false);
20506
- return;
20507
- }
20508
- graphic.useStates(targetStates, false);
20509
- }
20510
- }
20511
-
20512
19239
  const DefaultConfig = {
20513
19240
  WIDTH: 500,
20514
19241
  HEIGHT: 500,
@@ -20689,14 +19416,12 @@ class Stage extends Group {
20689
19416
  this.theme.onStateDefinitionsChange = () => {
20690
19417
  var _a;
20691
19418
  const definitions = (_a = this.theme) === null || _a === void 0 ? void 0 : _a.stateDefinitions;
20692
- if (!definitions || !Object.keys(definitions).length) {
20693
- if (this.rootSharedStateScope) {
20694
- setRootSharedStateScopeThemeDefinitions(this.rootSharedStateScope, definitions);
20695
- markScopeActiveDescendantsDirty(this.rootSharedStateScope, this);
20696
- }
19419
+ const rootScope = definitions && Object.keys(definitions).length
19420
+ ? this.ensureRootSharedStateScope(definitions)
19421
+ : this.rootSharedStateScope;
19422
+ if (!rootScope) {
20697
19423
  return;
20698
19424
  }
20699
- const rootScope = this.ensureRootSharedStateScope(definitions);
20700
19425
  setRootSharedStateScopeThemeDefinitions(rootScope, definitions);
20701
19426
  markScopeActiveDescendantsDirty(rootScope, this);
20702
19427
  };
@@ -21128,21 +19853,6 @@ class Stage extends Group {
21128
19853
  this.rootSharedStateScope.ownerStage = this;
21129
19854
  return this.rootSharedStateScope;
21130
19855
  }
21131
- getStateBatchScheduler() {
21132
- if (!this._stateBatchScheduler) {
21133
- this._stateBatchScheduler = new StateBatchScheduler(this, ensureStageStatePerfMonitor(this));
21134
- }
21135
- return this._stateBatchScheduler;
21136
- }
21137
- scheduleStateBatch(graphics, targetStates) {
21138
- this.getStateBatchScheduler().schedule(graphics, targetStates);
21139
- }
21140
- getStatePerfSnapshot() {
21141
- return ensureStageStatePerfMonitor(this).getSnapshot();
21142
- }
21143
- resetStatePerfSnapshot() {
21144
- ensureStageStatePerfMonitor(this).reset();
21145
- }
21146
19856
  _doRenderInThisFrame() {
21147
19857
  if (this.releaseStatus === 'released') {
21148
19858
  return;
@@ -21276,8 +19986,7 @@ class Stage extends Group {
21276
19986
  throw new Error('暂不支持');
21277
19987
  }
21278
19988
  release() {
21279
- var _a, _b, _d, _e;
21280
- (_a = this._stateBatchScheduler) === null || _a === void 0 ? void 0 : _a.release();
19989
+ var _a, _b, _d;
21281
19990
  super.release();
21282
19991
  this.hooks.beforeRender.unTap('constructor', this.beforeRender);
21283
19992
  this.hooks.afterRender.unTap('constructor', this.afterRender);
@@ -21295,10 +20004,10 @@ class Stage extends Group {
21295
20004
  this.interactiveLayer.release();
21296
20005
  }
21297
20006
  this.window.release();
21298
- (_b = this._ticker) === null || _b === void 0 ? void 0 : _b.remTimeline(this === null || this === void 0 ? void 0 : this.timeline);
21299
- (_d = this._ticker) === null || _d === void 0 ? void 0 : _d.removeListener('tick', this.afterTickCb);
20007
+ (_a = this._ticker) === null || _a === void 0 ? void 0 : _a.remTimeline(this === null || this === void 0 ? void 0 : this.timeline);
20008
+ (_b = this._ticker) === null || _b === void 0 ? void 0 : _b.removeListener('tick', this.afterTickCb);
21300
20009
  if (!this.params.ticker) {
21301
- (_e = this._ticker) === null || _e === void 0 ? void 0 : _e.release();
20010
+ (_d = this._ticker) === null || _d === void 0 ? void 0 : _d.release();
21302
20011
  }
21303
20012
  this.renderService.renderTreeRoots = [];
21304
20013
  }
@@ -27594,18 +26303,12 @@ function createBrowserApp(options = {}) {
27594
26303
  }
27595
26304
 
27596
26305
  class NodeEntry extends BrowserEntry {
27597
- constructor(options = {}) {
27598
- super(options);
27599
- }
27600
26306
  }
27601
26307
  function createNodeApp(options = {}) {
27602
26308
  return new NodeEntry(options);
27603
26309
  }
27604
26310
 
27605
26311
  class MiniappEntry extends BrowserEntry {
27606
- constructor(options = {}) {
27607
- super(options);
27608
- }
27609
26312
  }
27610
26313
  function createMiniappApp(options = {}) {
27611
26314
  return new MiniappEntry(options);
@@ -30149,12 +28852,22 @@ function resolveContainerBinding(container, serviceIdentifier) {
30149
28852
  return instance;
30150
28853
  }
30151
28854
 
30152
- let loadArcModule = false;
28855
+ function isBindingContextLoaded(loadedContexts, context) {
28856
+ const key = (typeof context === 'object' && context !== null) || typeof context === 'function'
28857
+ ? context
28858
+ : loadedContexts;
28859
+ if (loadedContexts.has(key)) {
28860
+ return true;
28861
+ }
28862
+ loadedContexts.add(key);
28863
+ return false;
28864
+ }
28865
+
28866
+ const loadedArcModuleContexts = new WeakSet();
30153
28867
  function bindArcRenderModule({ bind }) {
30154
- if (loadArcModule) {
28868
+ if (isBindingContextLoaded(loadedArcModuleContexts, bind)) {
30155
28869
  return;
30156
28870
  }
30157
- loadArcModule = true;
30158
28871
  bind(DefaultCanvasArcRender).toSelf().inSingletonScope();
30159
28872
  bind(ArcRender).to(DefaultCanvasArcRender).inSingletonScope();
30160
28873
  bind(GraphicRender).toService(ArcRender);
@@ -30163,12 +28876,11 @@ function bindArcRenderModule({ bind }) {
30163
28876
  }
30164
28877
  const arcModule = bindArcRenderModule;
30165
28878
 
30166
- let loadRectModule = false;
28879
+ const loadedRectModuleContexts = new WeakSet();
30167
28880
  function bindRectRenderModule({ bind }) {
30168
- if (loadRectModule) {
28881
+ if (isBindingContextLoaded(loadedRectModuleContexts, bind)) {
30169
28882
  return;
30170
28883
  }
30171
- loadRectModule = true;
30172
28884
  bind(DefaultCanvasRectRender)
30173
28885
  .toDynamicValue(({ container }) => new DefaultCanvasRectRender(createContributionProvider(RectRenderContribution, container)))
30174
28886
  .inSingletonScope();
@@ -30183,12 +28895,11 @@ function bindRectRenderModule({ bind }) {
30183
28895
  }
30184
28896
  const rectModule = bindRectRenderModule;
30185
28897
 
30186
- let loadLineModule = false;
28898
+ const loadedLineModuleContexts = new WeakSet();
30187
28899
  function bindLineRenderModule({ bind }) {
30188
- if (loadLineModule) {
28900
+ if (isBindingContextLoaded(loadedLineModuleContexts, bind)) {
30189
28901
  return;
30190
28902
  }
30191
- loadLineModule = true;
30192
28903
  bind(DefaultCanvasLineRender).toSelf().inSingletonScope();
30193
28904
  bind(DefaultIncrementalCanvasLineRender).toSelf().inSingletonScope();
30194
28905
  bind(LineRender).to(DefaultCanvasLineRender).inSingletonScope();
@@ -30196,12 +28907,11 @@ function bindLineRenderModule({ bind }) {
30196
28907
  }
30197
28908
  const lineModule = bindLineRenderModule;
30198
28909
 
30199
- let loadAreaModule = false;
28910
+ const loadedAreaModuleContexts = new WeakSet();
30200
28911
  function bindAreaRenderModule({ bind }) {
30201
- if (loadAreaModule) {
28912
+ if (isBindingContextLoaded(loadedAreaModuleContexts, bind)) {
30202
28913
  return;
30203
28914
  }
30204
- loadAreaModule = true;
30205
28915
  bind(DefaultCanvasAreaRender).toSelf().inSingletonScope();
30206
28916
  bind(AreaRender).to(DefaultCanvasAreaRender).inSingletonScope();
30207
28917
  bind(GraphicRender).toService(AreaRender);
@@ -30211,12 +28921,11 @@ function bindAreaRenderModule({ bind }) {
30211
28921
  }
30212
28922
  const areaModule = bindAreaRenderModule;
30213
28923
 
30214
- let loadSymbolModule = false;
28924
+ const loadedSymbolModuleContexts = new WeakSet();
30215
28925
  function bindSymbolRenderModule({ bind }) {
30216
- if (loadSymbolModule) {
28926
+ if (isBindingContextLoaded(loadedSymbolModuleContexts, bind)) {
30217
28927
  return;
30218
28928
  }
30219
- loadSymbolModule = true;
30220
28929
  bind(DefaultCanvasSymbolRender).toSelf().inSingletonScope();
30221
28930
  bind(SymbolRender).to(DefaultCanvasSymbolRender).inSingletonScope();
30222
28931
  bind(GraphicRender).toService(SymbolRender);
@@ -30225,12 +28934,11 @@ function bindSymbolRenderModule({ bind }) {
30225
28934
  }
30226
28935
  const symbolModule = bindSymbolRenderModule;
30227
28936
 
30228
- let loadCircleModule = false;
28937
+ const loadedCircleModuleContexts = new WeakSet();
30229
28938
  function bindCircleRenderModule({ bind }) {
30230
- if (loadCircleModule) {
28939
+ if (isBindingContextLoaded(loadedCircleModuleContexts, bind)) {
30231
28940
  return;
30232
28941
  }
30233
- loadCircleModule = true;
30234
28942
  bind(DefaultCanvasCircleRender).toSelf().inSingletonScope();
30235
28943
  bind(CircleRender).to(DefaultCanvasCircleRender).inSingletonScope();
30236
28944
  bind(GraphicRender).toService(CircleRender);
@@ -30239,12 +28947,11 @@ function bindCircleRenderModule({ bind }) {
30239
28947
  }
30240
28948
  const circleModule = bindCircleRenderModule;
30241
28949
 
30242
- let loadTextModule = false;
28950
+ const loadedTextModuleContexts = new WeakSet();
30243
28951
  function bindTextRenderModule({ bind }) {
30244
- if (loadTextModule) {
28952
+ if (isBindingContextLoaded(loadedTextModuleContexts, bind)) {
30245
28953
  return;
30246
28954
  }
30247
- loadTextModule = true;
30248
28955
  bind(TextRender).to(DefaultCanvasTextRender).inSingletonScope();
30249
28956
  bind(GraphicRender).toService(TextRender);
30250
28957
  bind(TextRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
@@ -30252,12 +28959,11 @@ function bindTextRenderModule({ bind }) {
30252
28959
  }
30253
28960
  const textModule = bindTextRenderModule;
30254
28961
 
30255
- let loadPathModule = false;
28962
+ const loadedPathModuleContexts = new WeakSet();
30256
28963
  function bindPathRenderModule({ bind }) {
30257
- if (loadPathModule) {
28964
+ if (isBindingContextLoaded(loadedPathModuleContexts, bind)) {
30258
28965
  return;
30259
28966
  }
30260
- loadPathModule = true;
30261
28967
  bind(DefaultCanvasPathRender).toSelf().inSingletonScope();
30262
28968
  bind(PathRender).to(DefaultCanvasPathRender).inSingletonScope();
30263
28969
  bind(GraphicRender).toService(PathRender);
@@ -30266,12 +28972,11 @@ function bindPathRenderModule({ bind }) {
30266
28972
  }
30267
28973
  const pathModule = bindPathRenderModule;
30268
28974
 
30269
- let loadPolygonModule = false;
28975
+ const loadedPolygonModuleContexts = new WeakSet();
30270
28976
  function bindPolygonRenderModule({ bind }) {
30271
- if (loadPolygonModule) {
28977
+ if (isBindingContextLoaded(loadedPolygonModuleContexts, bind)) {
30272
28978
  return;
30273
28979
  }
30274
- loadPolygonModule = true;
30275
28980
  bind(PolygonRender).to(DefaultCanvasPolygonRender).inSingletonScope();
30276
28981
  bind(GraphicRender).toService(PolygonRender);
30277
28982
  bind(PolygonRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
@@ -30348,12 +29053,11 @@ class DefaultCanvasStarRender extends BaseRender {
30348
29053
  }
30349
29054
  }
30350
29055
 
30351
- let loadStarModule = false;
29056
+ const loadedStarModuleContexts = new WeakSet();
30352
29057
  function bindStarRenderModule({ bind }) {
30353
- if (loadStarModule) {
29058
+ if (isBindingContextLoaded(loadedStarModuleContexts, bind)) {
30354
29059
  return;
30355
29060
  }
30356
- loadStarModule = true;
30357
29061
  bind(DefaultCanvasStarRender)
30358
29062
  .toDynamicValue(({ container }) => new DefaultCanvasStarRender(createContributionProvider(StarRenderContribution, container)))
30359
29063
  .inSingletonScope();
@@ -30399,12 +29103,11 @@ class DefaultCanvasGlyphRender {
30399
29103
  }
30400
29104
  }
30401
29105
 
30402
- let loadGlyphModule = false;
29106
+ const loadedGlyphModuleContexts = new WeakSet();
30403
29107
  function bindGlyphRenderModule({ bind }) {
30404
- if (loadGlyphModule) {
29108
+ if (isBindingContextLoaded(loadedGlyphModuleContexts, bind)) {
30405
29109
  return;
30406
29110
  }
30407
- loadGlyphModule = true;
30408
29111
  bind(GlyphRender).to(DefaultCanvasGlyphRender).inSingletonScope();
30409
29112
  bind(GraphicRender).toService(GlyphRender);
30410
29113
  }
@@ -30479,23 +29182,21 @@ class DefaultCanvasRichTextRender extends BaseRender {
30479
29182
  }
30480
29183
  }
30481
29184
 
30482
- let loadRichtextModule = false;
29185
+ const loadedRichtextModuleContexts = new WeakSet();
30483
29186
  function bindRichtextRenderModule({ bind }) {
30484
- if (loadRichtextModule) {
29187
+ if (isBindingContextLoaded(loadedRichtextModuleContexts, bind)) {
30485
29188
  return;
30486
29189
  }
30487
- loadRichtextModule = true;
30488
29190
  bind(RichTextRender).to(DefaultCanvasRichTextRender).inSingletonScope();
30489
29191
  bind(GraphicRender).toService(RichTextRender);
30490
29192
  }
30491
29193
  const richtextModule = bindRichtextRenderModule;
30492
29194
 
30493
- let loadImageModule = false;
29195
+ const loadedImageModuleContexts = new WeakSet();
30494
29196
  function bindImageRenderModule({ bind }) {
30495
- if (loadImageModule) {
29197
+ if (isBindingContextLoaded(loadedImageModuleContexts, bind)) {
30496
29198
  return;
30497
29199
  }
30498
- loadImageModule = true;
30499
29200
  bind(ImageRender).to(DefaultCanvasImageRender).inSingletonScope();
30500
29201
  bind(GraphicRender).toService(ImageRender);
30501
29202
  bind(ImageRenderContribution).toService(DefaultBaseInteractiveRenderContribution);
@@ -30639,12 +29340,11 @@ class DefaultCanvasRect3dRender extends Base3dRender {
30639
29340
  }
30640
29341
  }
30641
29342
 
30642
- let loadRect3dModule = false;
29343
+ const loadedRect3dModuleContexts = new WeakSet();
30643
29344
  function bindRect3dRenderModule({ bind }) {
30644
- if (loadRect3dModule) {
29345
+ if (isBindingContextLoaded(loadedRect3dModuleContexts, bind)) {
30645
29346
  return;
30646
29347
  }
30647
- loadRect3dModule = true;
30648
29348
  bind(Rect3DRender).to(DefaultCanvasRect3dRender).inSingletonScope();
30649
29349
  bind(GraphicRender).toService(Rect3DRender);
30650
29350
  }
@@ -30839,12 +29539,11 @@ class DefaultCanvasArc3DRender extends BaseRender {
30839
29539
  }
30840
29540
  }
30841
29541
 
30842
- let loadArc3dModule = false;
29542
+ const loadedArc3dModuleContexts = new WeakSet();
30843
29543
  function bindArc3dRenderModule({ bind }) {
30844
- if (loadArc3dModule) {
29544
+ if (isBindingContextLoaded(loadedArc3dModuleContexts, bind)) {
30845
29545
  return;
30846
29546
  }
30847
- loadArc3dModule = true;
30848
29547
  bind(Arc3dRender).to(DefaultCanvasArc3DRender).inSingletonScope();
30849
29548
  bind(GraphicRender).toService(Arc3dRender);
30850
29549
  }
@@ -30886,12 +29585,11 @@ class DefaultCanvasPyramid3dRender extends Base3dRender {
30886
29585
  }
30887
29586
  }
30888
29587
 
30889
- let loadPyramid3dModule = false;
29588
+ const loadedPyramid3dModuleContexts = new WeakSet();
30890
29589
  function bindPyramid3dRenderModule({ bind }) {
30891
- if (loadPyramid3dModule) {
29590
+ if (isBindingContextLoaded(loadedPyramid3dModuleContexts, bind)) {
30892
29591
  return;
30893
29592
  }
30894
- loadPyramid3dModule = true;
30895
29593
  bind(Pyramid3dRender).to(DefaultCanvasPyramid3dRender).inSingletonScope();
30896
29594
  bind(GraphicRender).toService(Pyramid3dRender);
30897
29595
  }