minerva-design 1.4.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (824) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +21 -21
  3. package/custom-elements.json +3072 -611
  4. package/dist/angular/fesm2022/minerva-angular.mjs +1491 -5
  5. package/dist/angular/fesm2022/minerva-angular.mjs.map +1 -1
  6. package/dist/angular/types/minerva-angular.d.ts +595 -5
  7. package/dist/charts/canvas.d.cts +4 -3
  8. package/dist/charts/canvas.d.ts +4 -3
  9. package/dist/charts/core.cjs +1 -1
  10. package/dist/charts/core.d.cts +6 -4
  11. package/dist/charts/core.d.ts +6 -4
  12. package/dist/charts/core.js +24 -16
  13. package/dist/charts/engine/axis.cjs +1 -1
  14. package/dist/charts/engine/axis.cjs.map +1 -1
  15. package/dist/charts/engine/axis.js +42 -19
  16. package/dist/charts/engine/axis.js.map +1 -1
  17. package/dist/charts/engine/canvas.cjs +1 -1
  18. package/dist/charts/engine/canvas.cjs.map +1 -1
  19. package/dist/charts/engine/canvas.js +155 -127
  20. package/dist/charts/engine/canvas.js.map +1 -1
  21. package/dist/charts/engine/chart.cjs +1 -1
  22. package/dist/charts/engine/chart.cjs.map +1 -1
  23. package/dist/charts/engine/chart.js +370 -255
  24. package/dist/charts/engine/chart.js.map +1 -1
  25. package/dist/charts/engine/color.cjs +1 -1
  26. package/dist/charts/engine/color.cjs.map +1 -1
  27. package/dist/charts/engine/color.d.cts +18 -0
  28. package/dist/charts/engine/color.d.ts +18 -0
  29. package/dist/charts/engine/color.js +48 -2
  30. package/dist/charts/engine/color.js.map +1 -1
  31. package/dist/charts/engine/controller.cjs +2 -2
  32. package/dist/charts/engine/controller.cjs.map +1 -1
  33. package/dist/charts/engine/controller.d.cts +34 -1
  34. package/dist/charts/engine/controller.d.ts +34 -1
  35. package/dist/charts/engine/controller.js +318 -273
  36. package/dist/charts/engine/controller.js.map +1 -1
  37. package/dist/charts/engine/data.cjs +1 -1
  38. package/dist/charts/engine/data.cjs.map +1 -1
  39. package/dist/charts/engine/data.d.cts +3 -1
  40. package/dist/charts/engine/data.d.ts +3 -1
  41. package/dist/charts/engine/data.js +6 -4
  42. package/dist/charts/engine/data.js.map +1 -1
  43. package/dist/charts/engine/defaults.cjs +2 -0
  44. package/dist/charts/engine/defaults.cjs.map +1 -0
  45. package/dist/charts/engine/defaults.d.cts +20 -0
  46. package/dist/charts/engine/defaults.d.ts +20 -0
  47. package/dist/charts/engine/defaults.js +35 -0
  48. package/dist/charts/engine/defaults.js.map +1 -0
  49. package/dist/charts/engine/format.cjs +1 -1
  50. package/dist/charts/engine/format.cjs.map +1 -1
  51. package/dist/charts/engine/format.d.cts +6 -0
  52. package/dist/charts/engine/format.d.ts +6 -0
  53. package/dist/charts/engine/format.js +15 -2
  54. package/dist/charts/engine/format.js.map +1 -1
  55. package/dist/charts/engine/graph/chart.cjs +2 -0
  56. package/dist/charts/engine/graph/chart.cjs.map +1 -0
  57. package/dist/charts/engine/graph/chart.d.cts +3 -0
  58. package/dist/charts/engine/graph/chart.d.ts +3 -0
  59. package/dist/charts/engine/graph/chart.js +1708 -0
  60. package/dist/charts/engine/graph/chart.js.map +1 -0
  61. package/dist/charts/engine/graph/circular.cjs +2 -0
  62. package/dist/charts/engine/graph/circular.cjs.map +1 -0
  63. package/dist/charts/engine/graph/circular.d.cts +16 -0
  64. package/dist/charts/engine/graph/circular.d.ts +16 -0
  65. package/dist/charts/engine/graph/circular.js +62 -0
  66. package/dist/charts/engine/graph/circular.js.map +1 -0
  67. package/dist/charts/engine/graph/dag.cjs +2 -0
  68. package/dist/charts/engine/graph/dag.cjs.map +1 -0
  69. package/dist/charts/engine/graph/dag.d.cts +34 -0
  70. package/dist/charts/engine/graph/dag.d.ts +34 -0
  71. package/dist/charts/engine/graph/dag.js +339 -0
  72. package/dist/charts/engine/graph/dag.js.map +1 -0
  73. package/dist/charts/engine/graph/dom.cjs +2 -0
  74. package/dist/charts/engine/graph/dom.cjs.map +1 -0
  75. package/dist/charts/engine/graph/dom.d.cts +23 -0
  76. package/dist/charts/engine/graph/dom.d.ts +23 -0
  77. package/dist/charts/engine/graph/dom.js +158 -0
  78. package/dist/charts/engine/graph/dom.js.map +1 -0
  79. package/dist/charts/engine/graph/force.cjs +2 -0
  80. package/dist/charts/engine/graph/force.cjs.map +1 -0
  81. package/dist/charts/engine/graph/force.d.cts +76 -0
  82. package/dist/charts/engine/graph/force.d.ts +76 -0
  83. package/dist/charts/engine/graph/force.js +423 -0
  84. package/dist/charts/engine/graph/force.js.map +1 -0
  85. package/dist/charts/engine/graph/geometry.cjs +2 -0
  86. package/dist/charts/engine/graph/geometry.cjs.map +1 -0
  87. package/dist/charts/engine/graph/geometry.d.cts +50 -0
  88. package/dist/charts/engine/graph/geometry.d.ts +50 -0
  89. package/dist/charts/engine/graph/geometry.js +197 -0
  90. package/dist/charts/engine/graph/geometry.js.map +1 -0
  91. package/dist/charts/engine/graph/index.cjs +1 -0
  92. package/dist/charts/engine/graph/index.d.cts +6 -0
  93. package/dist/charts/engine/graph/index.d.ts +6 -0
  94. package/dist/charts/engine/graph/index.js +6 -0
  95. package/dist/charts/engine/graph/labels.cjs +2 -0
  96. package/dist/charts/engine/graph/labels.cjs.map +1 -0
  97. package/dist/charts/engine/graph/labels.d.cts +12 -0
  98. package/dist/charts/engine/graph/labels.d.ts +12 -0
  99. package/dist/charts/engine/graph/labels.js +128 -0
  100. package/dist/charts/engine/graph/labels.js.map +1 -0
  101. package/dist/charts/engine/graph/model.cjs +2 -0
  102. package/dist/charts/engine/graph/model.cjs.map +1 -0
  103. package/dist/charts/engine/graph/model.d.cts +52 -0
  104. package/dist/charts/engine/graph/model.d.ts +52 -0
  105. package/dist/charts/engine/graph/model.js +108 -0
  106. package/dist/charts/engine/graph/model.js.map +1 -0
  107. package/dist/charts/engine/graph/sizing.cjs +2 -0
  108. package/dist/charts/engine/graph/sizing.cjs.map +1 -0
  109. package/dist/charts/engine/graph/sizing.d.cts +33 -0
  110. package/dist/charts/engine/graph/sizing.d.ts +33 -0
  111. package/dist/charts/engine/graph/sizing.js +60 -0
  112. package/dist/charts/engine/graph/sizing.js.map +1 -0
  113. package/dist/charts/engine/graph/tree.cjs +2 -0
  114. package/dist/charts/engine/graph/tree.cjs.map +1 -0
  115. package/dist/charts/engine/graph/tree.d.cts +30 -0
  116. package/dist/charts/engine/graph/tree.d.ts +30 -0
  117. package/dist/charts/engine/graph/tree.js +218 -0
  118. package/dist/charts/engine/graph/tree.js.map +1 -0
  119. package/dist/charts/engine/graph/types.d.cts +640 -0
  120. package/dist/charts/engine/graph/types.d.ts +640 -0
  121. package/dist/charts/engine/graph/worker.cjs +52 -0
  122. package/dist/charts/engine/graph/worker.cjs.map +1 -0
  123. package/dist/charts/engine/graph/worker.d.cts +36 -0
  124. package/dist/charts/engine/graph/worker.d.ts +36 -0
  125. package/dist/charts/engine/graph/worker.js +135 -0
  126. package/dist/charts/engine/graph/worker.js.map +1 -0
  127. package/dist/charts/engine/items.cjs +1 -1
  128. package/dist/charts/engine/items.cjs.map +1 -1
  129. package/dist/charts/engine/items.d.cts +15 -2
  130. package/dist/charts/engine/items.d.ts +15 -2
  131. package/dist/charts/engine/items.js +131 -112
  132. package/dist/charts/engine/items.js.map +1 -1
  133. package/dist/charts/engine/labels.cjs +1 -1
  134. package/dist/charts/engine/labels.cjs.map +1 -1
  135. package/dist/charts/engine/labels.d.cts +17 -0
  136. package/dist/charts/engine/labels.d.ts +17 -0
  137. package/dist/charts/engine/labels.js +28 -4
  138. package/dist/charts/engine/labels.js.map +1 -1
  139. package/dist/charts/engine/layout.cjs +1 -1
  140. package/dist/charts/engine/layout.cjs.map +1 -1
  141. package/dist/charts/engine/layout.d.cts +9 -0
  142. package/dist/charts/engine/layout.d.ts +9 -0
  143. package/dist/charts/engine/layout.js +11 -2
  144. package/dist/charts/engine/layout.js.map +1 -1
  145. package/dist/charts/engine/model.cjs +1 -1
  146. package/dist/charts/engine/model.cjs.map +1 -1
  147. package/dist/charts/engine/model.d.cts +73 -3
  148. package/dist/charts/engine/model.d.ts +73 -3
  149. package/dist/charts/engine/model.js +258 -154
  150. package/dist/charts/engine/model.js.map +1 -1
  151. package/dist/charts/engine/orderbook/field.cjs +37 -0
  152. package/dist/charts/engine/orderbook/field.cjs.map +1 -0
  153. package/dist/charts/engine/orderbook/field.d.cts +92 -0
  154. package/dist/charts/engine/orderbook/field.d.ts +92 -0
  155. package/dist/charts/engine/orderbook/field.js +297 -0
  156. package/dist/charts/engine/orderbook/field.js.map +1 -0
  157. package/dist/charts/engine/orderbook/format.cjs +1 -1
  158. package/dist/charts/engine/orderbook/format.cjs.map +1 -1
  159. package/dist/charts/engine/orderbook/format.d.cts +3 -2
  160. package/dist/charts/engine/orderbook/format.d.ts +3 -2
  161. package/dist/charts/engine/orderbook/format.js +5 -5
  162. package/dist/charts/engine/orderbook/format.js.map +1 -1
  163. package/dist/charts/engine/orderbook/heatmap.cjs +1 -1
  164. package/dist/charts/engine/orderbook/heatmap.cjs.map +1 -1
  165. package/dist/charts/engine/orderbook/heatmap.js +566 -475
  166. package/dist/charts/engine/orderbook/heatmap.js.map +1 -1
  167. package/dist/charts/engine/orderbook/host.cjs +1 -1
  168. package/dist/charts/engine/orderbook/host.cjs.map +1 -1
  169. package/dist/charts/engine/orderbook/host.d.cts +8 -1
  170. package/dist/charts/engine/orderbook/host.d.ts +8 -1
  171. package/dist/charts/engine/orderbook/host.js +27 -5
  172. package/dist/charts/engine/orderbook/host.js.map +1 -1
  173. package/dist/charts/engine/orderbook/ladder.cjs +1 -1
  174. package/dist/charts/engine/orderbook/ladder.cjs.map +1 -1
  175. package/dist/charts/engine/orderbook/ladder.js +1 -1
  176. package/dist/charts/engine/orderbook/ladder.js.map +1 -1
  177. package/dist/charts/engine/orderbook/layout.cjs +2 -0
  178. package/dist/charts/engine/orderbook/layout.cjs.map +1 -0
  179. package/dist/charts/engine/orderbook/layout.d.cts +42 -0
  180. package/dist/charts/engine/orderbook/layout.d.ts +42 -0
  181. package/dist/charts/engine/orderbook/layout.js +76 -0
  182. package/dist/charts/engine/orderbook/layout.js.map +1 -0
  183. package/dist/charts/engine/orderbook/tape.cjs +1 -1
  184. package/dist/charts/engine/orderbook/tape.cjs.map +1 -1
  185. package/dist/charts/engine/orderbook/tape.js +4 -4
  186. package/dist/charts/engine/orderbook/tape.js.map +1 -1
  187. package/dist/charts/engine/orderbook/types.d.cts +27 -3
  188. package/dist/charts/engine/orderbook/types.d.ts +27 -3
  189. package/dist/charts/engine/overlay.cjs +1 -1
  190. package/dist/charts/engine/overlay.cjs.map +1 -1
  191. package/dist/charts/engine/overlay.d.cts +27 -0
  192. package/dist/charts/engine/overlay.d.ts +27 -0
  193. package/dist/charts/engine/overlay.js +34 -12
  194. package/dist/charts/engine/overlay.js.map +1 -1
  195. package/dist/charts/engine/presets.cjs +2 -2
  196. package/dist/charts/engine/presets.cjs.map +1 -1
  197. package/dist/charts/engine/presets.d.cts +35 -3
  198. package/dist/charts/engine/presets.d.ts +35 -3
  199. package/dist/charts/engine/presets.js +121 -101
  200. package/dist/charts/engine/presets.js.map +1 -1
  201. package/dist/charts/engine/renderers/canvas2d.cjs +1 -1
  202. package/dist/charts/engine/renderers/canvas2d.cjs.map +1 -1
  203. package/dist/charts/engine/renderers/canvas2d.js +13 -9
  204. package/dist/charts/engine/renderers/canvas2d.js.map +1 -1
  205. package/dist/charts/engine/renderers/detect.cjs +1 -1
  206. package/dist/charts/engine/renderers/detect.cjs.map +1 -1
  207. package/dist/charts/engine/renderers/detect.d.cts +2 -1
  208. package/dist/charts/engine/renderers/detect.d.ts +2 -1
  209. package/dist/charts/engine/renderers/detect.js +23 -21
  210. package/dist/charts/engine/renderers/detect.js.map +1 -1
  211. package/dist/charts/engine/renderers/follow.cjs +2 -0
  212. package/dist/charts/engine/renderers/follow.cjs.map +1 -0
  213. package/dist/charts/engine/renderers/follow.d.cts +8 -0
  214. package/dist/charts/engine/renderers/follow.d.ts +8 -0
  215. package/dist/charts/engine/renderers/follow.js +10 -0
  216. package/dist/charts/engine/renderers/follow.js.map +1 -0
  217. package/dist/charts/engine/renderers/gl-budget.cjs +2 -0
  218. package/dist/charts/engine/renderers/gl-budget.cjs.map +1 -0
  219. package/dist/charts/engine/renderers/gl-budget.d.cts +32 -0
  220. package/dist/charts/engine/renderers/gl-budget.d.ts +32 -0
  221. package/dist/charts/engine/renderers/gl-budget.js +95 -0
  222. package/dist/charts/engine/renderers/gl-budget.js.map +1 -0
  223. package/dist/charts/engine/renderers/gl.cjs +1 -1
  224. package/dist/charts/engine/renderers/gl.cjs.map +1 -1
  225. package/dist/charts/engine/renderers/gl.js +1 -1
  226. package/dist/charts/engine/renderers/gl.js.map +1 -1
  227. package/dist/charts/engine/renderers/shaders.cjs +9 -6
  228. package/dist/charts/engine/renderers/shaders.cjs.map +1 -1
  229. package/dist/charts/engine/renderers/shaders.d.cts +1 -1
  230. package/dist/charts/engine/renderers/shaders.d.ts +1 -1
  231. package/dist/charts/engine/renderers/shaders.js +9 -6
  232. package/dist/charts/engine/renderers/shaders.js.map +1 -1
  233. package/dist/charts/engine/renderers/types.cjs.map +1 -1
  234. package/dist/charts/engine/renderers/types.d.cts +2 -0
  235. package/dist/charts/engine/renderers/types.d.ts +2 -0
  236. package/dist/charts/engine/renderers/types.js.map +1 -1
  237. package/dist/charts/engine/renderers/webgl.cjs +1 -1
  238. package/dist/charts/engine/renderers/webgl.cjs.map +1 -1
  239. package/dist/charts/engine/renderers/webgl.js +85 -64
  240. package/dist/charts/engine/renderers/webgl.js.map +1 -1
  241. package/dist/charts/engine/renderers/webgl2.cjs +1 -1
  242. package/dist/charts/engine/renderers/webgl2.cjs.map +1 -1
  243. package/dist/charts/engine/renderers/webgl2.js +72 -58
  244. package/dist/charts/engine/renderers/webgl2.js.map +1 -1
  245. package/dist/charts/engine/renderers/webgpu.cjs +1 -1
  246. package/dist/charts/engine/renderers/webgpu.cjs.map +1 -1
  247. package/dist/charts/engine/renderers/webgpu.js +1 -1
  248. package/dist/charts/engine/renderers/webgpu.js.map +1 -1
  249. package/dist/charts/engine/scene.cjs +1 -1
  250. package/dist/charts/engine/scene.cjs.map +1 -1
  251. package/dist/charts/engine/scene.d.cts +104 -4
  252. package/dist/charts/engine/scene.d.ts +104 -4
  253. package/dist/charts/engine/scene.js +412 -193
  254. package/dist/charts/engine/scene.js.map +1 -1
  255. package/dist/charts/engine/shapes/bullet.cjs +1 -1
  256. package/dist/charts/engine/shapes/bullet.cjs.map +1 -1
  257. package/dist/charts/engine/shapes/bullet.js +110 -110
  258. package/dist/charts/engine/shapes/bullet.js.map +1 -1
  259. package/dist/charts/engine/shapes/chart.cjs +1 -1
  260. package/dist/charts/engine/shapes/chart.cjs.map +1 -1
  261. package/dist/charts/engine/shapes/chart.js +4 -1
  262. package/dist/charts/engine/shapes/chart.js.map +1 -1
  263. package/dist/charts/engine/shapes/chord.cjs +2 -0
  264. package/dist/charts/engine/shapes/chord.cjs.map +1 -0
  265. package/dist/charts/engine/shapes/chord.d.cts +18 -0
  266. package/dist/charts/engine/shapes/chord.d.ts +18 -0
  267. package/dist/charts/engine/shapes/chord.js +419 -0
  268. package/dist/charts/engine/shapes/chord.js.map +1 -0
  269. package/dist/charts/engine/shapes/draw.cjs +1 -1
  270. package/dist/charts/engine/shapes/draw.cjs.map +1 -1
  271. package/dist/charts/engine/shapes/draw.d.cts +5 -1
  272. package/dist/charts/engine/shapes/draw.d.ts +5 -1
  273. package/dist/charts/engine/shapes/draw.js +47 -17
  274. package/dist/charts/engine/shapes/draw.js.map +1 -1
  275. package/dist/charts/engine/shapes/hit.cjs +1 -1
  276. package/dist/charts/engine/shapes/hit.cjs.map +1 -1
  277. package/dist/charts/engine/shapes/hit.d.cts +3 -1
  278. package/dist/charts/engine/shapes/hit.d.ts +3 -1
  279. package/dist/charts/engine/shapes/hit.js +75 -46
  280. package/dist/charts/engine/shapes/hit.js.map +1 -1
  281. package/dist/charts/engine/shapes/index.d.cts +3 -2
  282. package/dist/charts/engine/shapes/index.d.ts +3 -2
  283. package/dist/charts/engine/shapes/labels.cjs +1 -1
  284. package/dist/charts/engine/shapes/labels.cjs.map +1 -1
  285. package/dist/charts/engine/shapes/labels.js +12 -4
  286. package/dist/charts/engine/shapes/labels.js.map +1 -1
  287. package/dist/charts/engine/shapes/layout.cjs +2 -2
  288. package/dist/charts/engine/shapes/layout.cjs.map +1 -1
  289. package/dist/charts/engine/shapes/layout.d.cts +3 -1
  290. package/dist/charts/engine/shapes/layout.d.ts +3 -1
  291. package/dist/charts/engine/shapes/layout.js +106 -78
  292. package/dist/charts/engine/shapes/layout.js.map +1 -1
  293. package/dist/charts/engine/shapes/scene.cjs +1 -1
  294. package/dist/charts/engine/shapes/scene.cjs.map +1 -1
  295. package/dist/charts/engine/shapes/scene.d.cts +33 -3
  296. package/dist/charts/engine/shapes/scene.d.ts +33 -3
  297. package/dist/charts/engine/shapes/scene.js +62 -19
  298. package/dist/charts/engine/shapes/scene.js.map +1 -1
  299. package/dist/charts/engine/shapes/types.d.cts +121 -8
  300. package/dist/charts/engine/shapes/types.d.ts +121 -8
  301. package/dist/charts/engine/signature.cjs +1 -1
  302. package/dist/charts/engine/signature.cjs.map +1 -1
  303. package/dist/charts/engine/signature.js +1 -1
  304. package/dist/charts/engine/signature.js.map +1 -1
  305. package/dist/charts/engine/three-d/canvas2d.cjs +1 -1
  306. package/dist/charts/engine/three-d/canvas2d.cjs.map +1 -1
  307. package/dist/charts/engine/three-d/canvas2d.d.cts +41 -3
  308. package/dist/charts/engine/three-d/canvas2d.d.ts +41 -3
  309. package/dist/charts/engine/three-d/canvas2d.js +166 -67
  310. package/dist/charts/engine/three-d/canvas2d.js.map +1 -1
  311. package/dist/charts/engine/three-d/chart.cjs +1 -1
  312. package/dist/charts/engine/three-d/chart.cjs.map +1 -1
  313. package/dist/charts/engine/three-d/chart.js +219 -215
  314. package/dist/charts/engine/three-d/chart.js.map +1 -1
  315. package/dist/charts/engine/three-d/detect.cjs +1 -1
  316. package/dist/charts/engine/three-d/detect.cjs.map +1 -1
  317. package/dist/charts/engine/three-d/detect.d.cts +3 -2
  318. package/dist/charts/engine/three-d/detect.d.ts +3 -2
  319. package/dist/charts/engine/three-d/detect.js +22 -20
  320. package/dist/charts/engine/three-d/detect.js.map +1 -1
  321. package/dist/charts/engine/three-d/geometry.cjs +1 -1
  322. package/dist/charts/engine/three-d/geometry.cjs.map +1 -1
  323. package/dist/charts/engine/three-d/geometry.d.cts +6 -0
  324. package/dist/charts/engine/three-d/geometry.d.ts +6 -0
  325. package/dist/charts/engine/three-d/geometry.js +106 -90
  326. package/dist/charts/engine/three-d/geometry.js.map +1 -1
  327. package/dist/charts/engine/three-d/model.cjs +1 -1
  328. package/dist/charts/engine/three-d/model.cjs.map +1 -1
  329. package/dist/charts/engine/three-d/model.d.cts +2 -0
  330. package/dist/charts/engine/three-d/model.d.ts +2 -0
  331. package/dist/charts/engine/three-d/model.js +2 -0
  332. package/dist/charts/engine/three-d/model.js.map +1 -1
  333. package/dist/charts/engine/three-d/oit.cjs +109 -0
  334. package/dist/charts/engine/three-d/oit.cjs.map +1 -0
  335. package/dist/charts/engine/three-d/oit.d.cts +34 -0
  336. package/dist/charts/engine/three-d/oit.d.ts +34 -0
  337. package/dist/charts/engine/three-d/oit.js +111 -0
  338. package/dist/charts/engine/three-d/oit.js.map +1 -0
  339. package/dist/charts/engine/three-d/overlay.cjs +1 -1
  340. package/dist/charts/engine/three-d/overlay.cjs.map +1 -1
  341. package/dist/charts/engine/three-d/overlay.js +43 -36
  342. package/dist/charts/engine/three-d/overlay.js.map +1 -1
  343. package/dist/charts/engine/three-d/render-types.cjs +1 -1
  344. package/dist/charts/engine/three-d/render-types.cjs.map +1 -1
  345. package/dist/charts/engine/three-d/render-types.d.cts +37 -3
  346. package/dist/charts/engine/three-d/render-types.d.ts +37 -3
  347. package/dist/charts/engine/three-d/render-types.js +6 -10
  348. package/dist/charts/engine/three-d/render-types.js.map +1 -1
  349. package/dist/charts/engine/three-d/shaders.cjs +109 -48
  350. package/dist/charts/engine/three-d/shaders.cjs.map +1 -1
  351. package/dist/charts/engine/three-d/shaders.d.cts +12 -5
  352. package/dist/charts/engine/three-d/shaders.d.ts +12 -5
  353. package/dist/charts/engine/three-d/shaders.js +118 -55
  354. package/dist/charts/engine/three-d/shaders.js.map +1 -1
  355. package/dist/charts/engine/three-d/sort.cjs +1 -1
  356. package/dist/charts/engine/three-d/sort.cjs.map +1 -1
  357. package/dist/charts/engine/three-d/sort.d.cts +18 -5
  358. package/dist/charts/engine/three-d/sort.d.ts +18 -5
  359. package/dist/charts/engine/three-d/sort.js +129 -43
  360. package/dist/charts/engine/three-d/sort.js.map +1 -1
  361. package/dist/charts/engine/three-d/types.d.cts +36 -0
  362. package/dist/charts/engine/three-d/types.d.ts +36 -0
  363. package/dist/charts/engine/three-d/webgl.cjs +1 -1
  364. package/dist/charts/engine/three-d/webgl.cjs.map +1 -1
  365. package/dist/charts/engine/three-d/webgl.d.cts +9 -0
  366. package/dist/charts/engine/three-d/webgl.d.ts +9 -0
  367. package/dist/charts/engine/three-d/webgl.js +199 -74
  368. package/dist/charts/engine/three-d/webgl.js.map +1 -1
  369. package/dist/charts/engine/three-d/webgpu.cjs +1 -1
  370. package/dist/charts/engine/three-d/webgpu.cjs.map +1 -1
  371. package/dist/charts/engine/three-d/webgpu.js +231 -94
  372. package/dist/charts/engine/three-d/webgpu.js.map +1 -1
  373. package/dist/charts/engine/trading/chart.cjs +1 -1
  374. package/dist/charts/engine/trading/chart.cjs.map +1 -1
  375. package/dist/charts/engine/trading/chart.d.cts +10 -1
  376. package/dist/charts/engine/trading/chart.d.ts +10 -1
  377. package/dist/charts/engine/trading/chart.js +1677 -813
  378. package/dist/charts/engine/trading/chart.js.map +1 -1
  379. package/dist/charts/engine/trading/drawings.cjs +2 -1
  380. package/dist/charts/engine/trading/drawings.cjs.map +1 -1
  381. package/dist/charts/engine/trading/drawings.d.cts +53 -9
  382. package/dist/charts/engine/trading/drawings.d.ts +53 -9
  383. package/dist/charts/engine/trading/drawings.js +346 -71
  384. package/dist/charts/engine/trading/drawings.js.map +1 -1
  385. package/dist/charts/engine/trading/format.cjs +1 -1
  386. package/dist/charts/engine/trading/format.cjs.map +1 -1
  387. package/dist/charts/engine/trading/format.d.cts +19 -0
  388. package/dist/charts/engine/trading/format.d.ts +19 -0
  389. package/dist/charts/engine/trading/format.js +65 -21
  390. package/dist/charts/engine/trading/format.js.map +1 -1
  391. package/dist/charts/engine/trading/geometry.cjs +1 -1
  392. package/dist/charts/engine/trading/geometry.cjs.map +1 -1
  393. package/dist/charts/engine/trading/geometry.d.cts +16 -0
  394. package/dist/charts/engine/trading/geometry.d.ts +16 -0
  395. package/dist/charts/engine/trading/geometry.js +19 -4
  396. package/dist/charts/engine/trading/geometry.js.map +1 -1
  397. package/dist/charts/engine/trading/index.cjs +1 -1
  398. package/dist/charts/engine/trading/index.d.cts +2 -1
  399. package/dist/charts/engine/trading/index.d.ts +2 -1
  400. package/dist/charts/engine/trading/index.js +4 -3
  401. package/dist/charts/engine/trading/indicators.cjs +1 -1
  402. package/dist/charts/engine/trading/indicators.cjs.map +1 -1
  403. package/dist/charts/engine/trading/indicators.d.cts +180 -10
  404. package/dist/charts/engine/trading/indicators.d.ts +180 -10
  405. package/dist/charts/engine/trading/indicators.js +449 -173
  406. package/dist/charts/engine/trading/indicators.js.map +1 -1
  407. package/dist/charts/engine/trading/labels.cjs +1 -1
  408. package/dist/charts/engine/trading/labels.cjs.map +1 -1
  409. package/dist/charts/engine/trading/labels.js +104 -4
  410. package/dist/charts/engine/trading/labels.js.map +1 -1
  411. package/dist/charts/engine/trading/store.cjs +1 -1
  412. package/dist/charts/engine/trading/store.cjs.map +1 -1
  413. package/dist/charts/engine/trading/store.d.cts +21 -0
  414. package/dist/charts/engine/trading/store.d.ts +21 -0
  415. package/dist/charts/engine/trading/store.js +22 -1
  416. package/dist/charts/engine/trading/store.js.map +1 -1
  417. package/dist/charts/engine/trading/studies.cjs +1 -1
  418. package/dist/charts/engine/trading/studies.cjs.map +1 -1
  419. package/dist/charts/engine/trading/studies.d.cts +49 -8
  420. package/dist/charts/engine/trading/studies.d.ts +49 -8
  421. package/dist/charts/engine/trading/studies.js +352 -93
  422. package/dist/charts/engine/trading/studies.js.map +1 -1
  423. package/dist/charts/engine/trading/sync.cjs +2 -0
  424. package/dist/charts/engine/trading/sync.cjs.map +1 -0
  425. package/dist/charts/engine/trading/sync.d.cts +8 -0
  426. package/dist/charts/engine/trading/sync.d.ts +8 -0
  427. package/dist/charts/engine/trading/sync.js +25 -0
  428. package/dist/charts/engine/trading/sync.js.map +1 -0
  429. package/dist/charts/engine/trading/types.d.cts +514 -16
  430. package/dist/charts/engine/trading/types.d.ts +514 -16
  431. package/dist/charts/engine/types.d.cts +106 -11
  432. package/dist/charts/engine/types.d.ts +106 -11
  433. package/dist/charts/index.cjs +1 -1
  434. package/dist/charts/index.d.cts +3 -2
  435. package/dist/charts/index.d.ts +3 -2
  436. package/dist/charts/index.js +30 -22
  437. package/dist/charts/react/charts.cjs +1 -1
  438. package/dist/charts/react/charts.cjs.map +1 -1
  439. package/dist/charts/react/charts.js +51 -34
  440. package/dist/charts/react/charts.js.map +1 -1
  441. package/dist/charts/react/graph.cjs +2 -0
  442. package/dist/charts/react/graph.cjs.map +1 -0
  443. package/dist/charts/react/graph.d.cts +219 -0
  444. package/dist/charts/react/graph.d.ts +219 -0
  445. package/dist/charts/react/graph.js +160 -0
  446. package/dist/charts/react/graph.js.map +1 -0
  447. package/dist/charts/react/orderbook.cjs +1 -1
  448. package/dist/charts/react/orderbook.cjs.map +1 -1
  449. package/dist/charts/react/orderbook.d.cts +3 -1
  450. package/dist/charts/react/orderbook.d.ts +3 -1
  451. package/dist/charts/react/orderbook.js +1 -0
  452. package/dist/charts/react/orderbook.js.map +1 -1
  453. package/dist/charts/react/shapes.cjs +1 -1
  454. package/dist/charts/react/shapes.cjs.map +1 -1
  455. package/dist/charts/react/shapes.d.cts +88 -4
  456. package/dist/charts/react/shapes.d.ts +88 -4
  457. package/dist/charts/react/shapes.js +55 -12
  458. package/dist/charts/react/shapes.js.map +1 -1
  459. package/dist/charts/react/three-d.cjs +1 -1
  460. package/dist/charts/react/three-d.cjs.map +1 -1
  461. package/dist/charts/react/three-d.d.cts +7 -0
  462. package/dist/charts/react/three-d.d.ts +7 -0
  463. package/dist/charts/react/three-d.js +14 -13
  464. package/dist/charts/react/three-d.js.map +1 -1
  465. package/dist/charts/react/trading.cjs +1 -1
  466. package/dist/charts/react/trading.cjs.map +1 -1
  467. package/dist/charts/react/trading.d.cts +54 -2
  468. package/dist/charts/react/trading.d.ts +54 -2
  469. package/dist/charts/react/trading.js +68 -37
  470. package/dist/charts/react/trading.js.map +1 -1
  471. package/dist/charts/react/types.d.cts +11 -0
  472. package/dist/charts/react/types.d.ts +11 -0
  473. package/dist/core/contracts.cjs +1 -1
  474. package/dist/core/contracts.cjs.map +1 -1
  475. package/dist/core/contracts.js +1 -1
  476. package/dist/core/contracts.js.map +1 -1
  477. package/dist/native/charts/src/canvas.cjs +1 -1
  478. package/dist/native/charts/src/canvas.js +5 -4
  479. package/dist/native/charts/src/engine/axis.cjs +1 -1
  480. package/dist/native/charts/src/engine/axis.cjs.map +1 -1
  481. package/dist/native/charts/src/engine/axis.js +42 -19
  482. package/dist/native/charts/src/engine/axis.js.map +1 -1
  483. package/dist/native/charts/src/engine/color.cjs +1 -1
  484. package/dist/native/charts/src/engine/color.cjs.map +1 -1
  485. package/dist/native/charts/src/engine/color.js +47 -5
  486. package/dist/native/charts/src/engine/color.js.map +1 -1
  487. package/dist/native/charts/src/engine/controller.cjs +2 -2
  488. package/dist/native/charts/src/engine/controller.cjs.map +1 -1
  489. package/dist/native/charts/src/engine/controller.js +296 -251
  490. package/dist/native/charts/src/engine/controller.js.map +1 -1
  491. package/dist/native/charts/src/engine/data.cjs +1 -1
  492. package/dist/native/charts/src/engine/data.cjs.map +1 -1
  493. package/dist/native/charts/src/engine/data.js +6 -4
  494. package/dist/native/charts/src/engine/data.js.map +1 -1
  495. package/dist/native/charts/src/engine/format.cjs +1 -1
  496. package/dist/native/charts/src/engine/format.cjs.map +1 -1
  497. package/dist/native/charts/src/engine/format.js +15 -2
  498. package/dist/native/charts/src/engine/format.js.map +1 -1
  499. package/dist/native/charts/src/engine/labels.cjs +1 -1
  500. package/dist/native/charts/src/engine/labels.cjs.map +1 -1
  501. package/dist/native/charts/src/engine/labels.js +42 -5
  502. package/dist/native/charts/src/engine/labels.js.map +1 -1
  503. package/dist/native/charts/src/engine/layout.cjs +1 -1
  504. package/dist/native/charts/src/engine/layout.cjs.map +1 -1
  505. package/dist/native/charts/src/engine/layout.js +11 -2
  506. package/dist/native/charts/src/engine/layout.js.map +1 -1
  507. package/dist/native/charts/src/engine/model.cjs +1 -1
  508. package/dist/native/charts/src/engine/model.cjs.map +1 -1
  509. package/dist/native/charts/src/engine/model.js +278 -174
  510. package/dist/native/charts/src/engine/model.js.map +1 -1
  511. package/dist/native/charts/src/engine/overlay.cjs.map +1 -1
  512. package/dist/native/charts/src/engine/overlay.js.map +1 -1
  513. package/dist/native/charts/src/engine/presets.cjs +2 -2
  514. package/dist/native/charts/src/engine/presets.cjs.map +1 -1
  515. package/dist/native/charts/src/engine/presets.js +110 -90
  516. package/dist/native/charts/src/engine/presets.js.map +1 -1
  517. package/dist/native/charts/src/engine/scene.cjs +1 -1
  518. package/dist/native/charts/src/engine/scene.cjs.map +1 -1
  519. package/dist/native/charts/src/engine/scene.js +421 -202
  520. package/dist/native/charts/src/engine/scene.js.map +1 -1
  521. package/dist/native/charts/src/engine/shapes/bullet.cjs +1 -1
  522. package/dist/native/charts/src/engine/shapes/bullet.cjs.map +1 -1
  523. package/dist/native/charts/src/engine/shapes/bullet.js +110 -110
  524. package/dist/native/charts/src/engine/shapes/bullet.js.map +1 -1
  525. package/dist/native/charts/src/engine/shapes/calendar.cjs +1 -1
  526. package/dist/native/charts/src/engine/shapes/calendar.cjs.map +1 -1
  527. package/dist/native/charts/src/engine/shapes/calendar.js +21 -16
  528. package/dist/native/charts/src/engine/shapes/calendar.js.map +1 -1
  529. package/dist/native/charts/src/engine/shapes/chord.cjs +2 -0
  530. package/dist/native/charts/src/engine/shapes/chord.cjs.map +1 -0
  531. package/dist/native/charts/src/engine/shapes/chord.js +419 -0
  532. package/dist/native/charts/src/engine/shapes/chord.js.map +1 -0
  533. package/dist/native/charts/src/engine/shapes/draw.cjs +1 -1
  534. package/dist/native/charts/src/engine/shapes/draw.cjs.map +1 -1
  535. package/dist/native/charts/src/engine/shapes/draw.js +47 -17
  536. package/dist/native/charts/src/engine/shapes/draw.js.map +1 -1
  537. package/dist/native/charts/src/engine/shapes/hit.cjs +1 -1
  538. package/dist/native/charts/src/engine/shapes/hit.cjs.map +1 -1
  539. package/dist/native/charts/src/engine/shapes/hit.js +73 -44
  540. package/dist/native/charts/src/engine/shapes/hit.js.map +1 -1
  541. package/dist/native/charts/src/engine/shapes/labels.cjs +1 -1
  542. package/dist/native/charts/src/engine/shapes/labels.cjs.map +1 -1
  543. package/dist/native/charts/src/engine/shapes/labels.js +12 -4
  544. package/dist/native/charts/src/engine/shapes/labels.js.map +1 -1
  545. package/dist/native/charts/src/engine/shapes/layout.cjs +2 -2
  546. package/dist/native/charts/src/engine/shapes/layout.cjs.map +1 -1
  547. package/dist/native/charts/src/engine/shapes/layout.js +136 -94
  548. package/dist/native/charts/src/engine/shapes/layout.js.map +1 -1
  549. package/dist/native/charts/src/engine/shapes/scene.cjs +1 -1
  550. package/dist/native/charts/src/engine/shapes/scene.cjs.map +1 -1
  551. package/dist/native/charts/src/engine/shapes/scene.js +62 -19
  552. package/dist/native/charts/src/engine/shapes/scene.js.map +1 -1
  553. package/dist/native/components/Chart/ChartBase.cjs +1 -1
  554. package/dist/native/components/Chart/ChartBase.cjs.map +1 -1
  555. package/dist/native/components/Chart/ChartBase.js +127 -115
  556. package/dist/native/components/Chart/ChartBase.js.map +1 -1
  557. package/dist/native/components/Chart/charts.cjs +1 -1
  558. package/dist/native/components/Chart/charts.cjs.map +1 -1
  559. package/dist/native/components/Chart/charts.js +8 -5
  560. package/dist/native/components/Chart/charts.js.map +1 -1
  561. package/dist/native/components/Chart/scene.cjs +1 -1
  562. package/dist/native/components/Chart/scene.cjs.map +1 -1
  563. package/dist/native/components/Chart/scene.d.cts +6 -1
  564. package/dist/native/components/Chart/scene.d.ts +6 -1
  565. package/dist/native/components/Chart/scene.js +226 -108
  566. package/dist/native/components/Chart/scene.js.map +1 -1
  567. package/dist/native/components/Chart/types.d.cts +7 -1
  568. package/dist/native/components/Chart/types.d.ts +7 -1
  569. package/dist/native/components/Charts/charts.cjs +1 -1
  570. package/dist/native/components/Charts/charts.cjs.map +1 -1
  571. package/dist/native/components/Charts/charts.js +60 -43
  572. package/dist/native/components/Charts/charts.js.map +1 -1
  573. package/dist/native/components/Charts/types.d.cts +11 -0
  574. package/dist/native/components/Charts/types.d.ts +11 -0
  575. package/dist/native/components/ShapeChart/ShapeChartBase.cjs +1 -1
  576. package/dist/native/components/ShapeChart/ShapeChartBase.cjs.map +1 -1
  577. package/dist/native/components/ShapeChart/ShapeChartBase.d.cts +1 -1
  578. package/dist/native/components/ShapeChart/ShapeChartBase.d.ts +1 -1
  579. package/dist/native/components/ShapeChart/ShapeChartBase.js +97 -106
  580. package/dist/native/components/ShapeChart/ShapeChartBase.js.map +1 -1
  581. package/dist/native/components/ShapeChart/charts.cjs +1 -1
  582. package/dist/native/components/ShapeChart/charts.cjs.map +1 -1
  583. package/dist/native/components/ShapeChart/charts.d.cts +6 -1
  584. package/dist/native/components/ShapeChart/charts.d.ts +6 -1
  585. package/dist/native/components/ShapeChart/charts.js +138 -96
  586. package/dist/native/components/ShapeChart/charts.js.map +1 -1
  587. package/dist/native/components/ShapeChart/draw.cjs +1 -1
  588. package/dist/native/components/ShapeChart/draw.cjs.map +1 -1
  589. package/dist/native/components/ShapeChart/draw.d.cts +1 -1
  590. package/dist/native/components/ShapeChart/draw.d.ts +1 -1
  591. package/dist/native/components/ShapeChart/draw.js +26 -17
  592. package/dist/native/components/ShapeChart/draw.js.map +1 -1
  593. package/dist/native/components/ShapeChart/geometry.cjs +1 -1
  594. package/dist/native/components/ShapeChart/geometry.cjs.map +1 -1
  595. package/dist/native/components/ShapeChart/geometry.js +233 -70
  596. package/dist/native/components/ShapeChart/geometry.js.map +1 -1
  597. package/dist/native/components/ShapeChart/index.cjs +1 -1
  598. package/dist/native/components/ShapeChart/index.d.cts +1 -1
  599. package/dist/native/components/ShapeChart/index.d.ts +1 -1
  600. package/dist/native/components/ShapeChart/index.js +2 -2
  601. package/dist/native/components/ShapeChart/recorder.cjs +1 -1
  602. package/dist/native/components/ShapeChart/recorder.cjs.map +1 -1
  603. package/dist/native/components/ShapeChart/recorder.d.cts +10 -1
  604. package/dist/native/components/ShapeChart/recorder.d.ts +10 -1
  605. package/dist/native/components/ShapeChart/recorder.js +19 -10
  606. package/dist/native/components/ShapeChart/recorder.js.map +1 -1
  607. package/dist/native/components/ShapeChart/types.d.cts +95 -8
  608. package/dist/native/components/ShapeChart/types.d.ts +95 -8
  609. package/dist/native/index.cjs +1 -1
  610. package/dist/native/index.js +2 -2
  611. package/dist/native/source/components/Chart/ChartBase.tsx +19 -6
  612. package/dist/native/source/components/Chart/charts.tsx +10 -3
  613. package/dist/native/source/components/Chart/scene.tsx +243 -14
  614. package/dist/native/source/components/Chart/types.ts +7 -0
  615. package/dist/native/source/components/Charts/charts.tsx +37 -2
  616. package/dist/native/source/components/Charts/types.ts +11 -0
  617. package/dist/native/source/components/ShapeChart/ShapeChartBase.tsx +10 -34
  618. package/dist/native/source/components/ShapeChart/charts.tsx +91 -35
  619. package/dist/native/source/components/ShapeChart/draw.tsx +39 -8
  620. package/dist/native/source/components/ShapeChart/geometry.ts +376 -25
  621. package/dist/native/source/components/ShapeChart/index.ts +1 -0
  622. package/dist/native/source/components/ShapeChart/recorder.ts +20 -5
  623. package/dist/native/source/components/ShapeChart/types.ts +99 -6
  624. package/dist/native/source/manifest.ts +1 -0
  625. package/dist/taro/chart-a11y.d.ts +7 -0
  626. package/dist/taro/charts.d.ts +29 -6
  627. package/dist/taro/index.js +3129 -1902
  628. package/dist/taro/shape-charts.d.ts +99 -5
  629. package/dist/uni/AreaChart.vue +2 -1
  630. package/dist/uni/AreaChart.vue.d.ts +5 -1
  631. package/dist/uni/Badge.vue.d.ts +1 -1
  632. package/dist/uni/BarChart.vue +2 -1
  633. package/dist/uni/BarChart.vue.d.ts +5 -1
  634. package/dist/uni/BoxPlotChart.vue +2 -1
  635. package/dist/uni/BoxPlotChart.vue.d.ts +8 -0
  636. package/dist/uni/BubbleChart.vue +2 -1
  637. package/dist/uni/BubbleChart.vue.d.ts +4 -0
  638. package/dist/uni/BulletChart.vue.d.ts +4 -0
  639. package/dist/uni/CalendarHeatmap.vue.d.ts +2 -0
  640. package/dist/uni/CandlestickChart.vue +2 -1
  641. package/dist/uni/CandlestickChart.vue.d.ts +4 -0
  642. package/dist/uni/Chart.vue +2 -1
  643. package/dist/uni/Chart.vue.d.ts +4 -0
  644. package/dist/uni/ChordChart.vue +93 -0
  645. package/dist/uni/ChordChart.vue.d.ts +136 -0
  646. package/dist/uni/Divider.vue.d.ts +1 -1
  647. package/dist/uni/DonutChart.vue.d.ts +5 -1
  648. package/dist/uni/FunnelChart.vue.d.ts +4 -0
  649. package/dist/uni/GanttChart.vue +2 -1
  650. package/dist/uni/GanttChart.vue.d.ts +15 -0
  651. package/dist/uni/GaugeChart.vue.d.ts +5 -1
  652. package/dist/uni/HeatmapChart.vue +2 -1
  653. package/dist/uni/HeatmapChart.vue.d.ts +8 -2
  654. package/dist/uni/HistogramChart.vue +2 -1
  655. package/dist/uni/HistogramChart.vue.d.ts +4 -0
  656. package/dist/uni/HorizontalBarChart.vue +2 -1
  657. package/dist/uni/HorizontalBarChart.vue.d.ts +3 -1
  658. package/dist/uni/LineChart.vue +2 -1
  659. package/dist/uni/LineChart.vue.d.ts +4 -0
  660. package/dist/uni/MixedChart.vue +2 -1
  661. package/dist/uni/MixedChart.vue.d.ts +4 -0
  662. package/dist/uni/PieChart.vue.d.ts +5 -1
  663. package/dist/uni/QuadrantChart.vue +2 -1
  664. package/dist/uni/QuadrantChart.vue.d.ts +4 -0
  665. package/dist/uni/RadarChart.vue.d.ts +4 -0
  666. package/dist/uni/RadialBarChart.vue.d.ts +4 -0
  667. package/dist/uni/RangeAreaChart.vue +2 -1
  668. package/dist/uni/RangeAreaChart.vue.d.ts +4 -0
  669. package/dist/uni/SankeyChart.vue.d.ts +4 -0
  670. package/dist/uni/ScatterChart.vue +2 -1
  671. package/dist/uni/ScatterChart.vue.d.ts +4 -0
  672. package/dist/uni/Sparkline.vue +2 -1
  673. package/dist/uni/Sparkline.vue.d.ts +4 -0
  674. package/dist/uni/SunburstChart.vue.d.ts +4 -0
  675. package/dist/uni/ToastProvider.vue.d.ts +1 -1
  676. package/dist/uni/TreemapChart.vue.d.ts +4 -0
  677. package/dist/uni/WaterfallChart.vue +2 -1
  678. package/dist/uni/WaterfallChart.vue.d.ts +9 -0
  679. package/dist/uni/chart-a11y.d.ts +7 -0
  680. package/dist/uni/chart-a11y.js +29 -0
  681. package/dist/uni/chart-canvas.d.ts +12 -0
  682. package/dist/uni/chart-canvas.js +15 -1
  683. package/dist/uni/chart-types.d.ts +36 -5
  684. package/dist/uni/chart-types.js +31 -3
  685. package/dist/uni/charts-canvas.js +3 -2
  686. package/dist/uni/index.d.ts +2 -1
  687. package/dist/uni/index.js +1 -0
  688. package/dist/uni/manifest.d.ts +7 -0
  689. package/dist/uni/manifest.js +10 -0
  690. package/dist/uni/named-chart-options.d.ts +11 -2
  691. package/dist/uni/named-chart-options.js +21 -1
  692. package/dist/uni/shape-chart-canvas.d.ts +3 -3
  693. package/dist/uni/shape-chart-canvas.js +17 -58
  694. package/dist/uni/shape-chart-types.d.ts +53 -3
  695. package/dist/uni/shape-chart-types.js +45 -1
  696. package/dist/vue/charts-global.d.ts +48 -0
  697. package/dist/vue/charts.d.ts +18 -0
  698. package/dist/vue/charts.js +56 -0
  699. package/dist/vue/charts.js.map +1 -0
  700. package/dist/vue/components/Chart/Bar3DChart.vue.d.ts +2 -0
  701. package/dist/vue/components/Chart/BoxPlotChart.vue.d.ts +8 -0
  702. package/dist/vue/components/Chart/BoxPlotChart.vue.js.map +1 -1
  703. package/dist/vue/components/Chart/BoxPlotChart.vue_vue_type_script_setup_true_lang.js +8 -2
  704. package/dist/vue/components/Chart/BoxPlotChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
  705. package/dist/vue/components/Chart/ChordChart.vue.d.ts +153 -0
  706. package/dist/vue/components/Chart/ChordChart.vue.js +7 -0
  707. package/dist/vue/components/Chart/ChordChart.vue.js.map +1 -0
  708. package/dist/vue/components/Chart/ChordChart.vue_vue_type_script_setup_true_lang.js +81 -0
  709. package/dist/vue/components/Chart/ChordChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
  710. package/dist/vue/components/Chart/DependencyGraph.vue.d.ts +181 -0
  711. package/dist/vue/components/Chart/DependencyGraph.vue.js +7 -0
  712. package/dist/vue/components/Chart/DependencyGraph.vue.js.map +1 -0
  713. package/dist/vue/components/Chart/DependencyGraph.vue_vue_type_script_setup_true_lang.js +65 -0
  714. package/dist/vue/components/Chart/DependencyGraph.vue_vue_type_script_setup_true_lang.js.map +1 -0
  715. package/dist/vue/components/Chart/GanttChart.vue.d.ts +19 -0
  716. package/dist/vue/components/Chart/GanttChart.vue.js.map +1 -1
  717. package/dist/vue/components/Chart/GanttChart.vue_vue_type_script_setup_true_lang.js +12 -1
  718. package/dist/vue/components/Chart/GanttChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
  719. package/dist/vue/components/Chart/GraphChart.vue.d.ts +186 -0
  720. package/dist/vue/components/Chart/GraphChart.vue.js +7 -0
  721. package/dist/vue/components/Chart/GraphChart.vue.js.map +1 -0
  722. package/dist/vue/components/Chart/GraphChart.vue_vue_type_script_setup_true_lang.js +62 -0
  723. package/dist/vue/components/Chart/GraphChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
  724. package/dist/vue/components/Chart/HeatmapChart.vue.d.ts +9 -5
  725. package/dist/vue/components/Chart/HeatmapChart.vue.js.map +1 -1
  726. package/dist/vue/components/Chart/HeatmapChart.vue_vue_type_script_setup_true_lang.js +3 -1
  727. package/dist/vue/components/Chart/HeatmapChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
  728. package/dist/vue/components/Chart/Line3DChart.vue.d.ts +2 -0
  729. package/dist/vue/components/Chart/OrderBookHeatmap.vue.d.ts +2 -0
  730. package/dist/vue/components/Chart/Scatter3DChart.vue.d.ts +2 -0
  731. package/dist/vue/components/Chart/Surface3DChart.vue.d.ts +2 -0
  732. package/dist/vue/components/Chart/TimeAndSales.vue.d.ts +2 -0
  733. package/dist/vue/components/Chart/TradingChart.vue.d.ts +58 -1
  734. package/dist/vue/components/Chart/TradingChart.vue.js.map +1 -1
  735. package/dist/vue/components/Chart/TradingChart.vue_vue_type_script_setup_true_lang.js +31 -0
  736. package/dist/vue/components/Chart/TradingChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
  737. package/dist/vue/components/Chart/TreeChart.vue.d.ts +174 -0
  738. package/dist/vue/components/Chart/TreeChart.vue.js +7 -0
  739. package/dist/vue/components/Chart/TreeChart.vue.js.map +1 -0
  740. package/dist/vue/components/Chart/TreeChart.vue_vue_type_script_setup_true_lang.js +56 -0
  741. package/dist/vue/components/Chart/TreeChart.vue_vue_type_script_setup_true_lang.js.map +1 -0
  742. package/dist/vue/components/Chart/WaterfallChart.vue.d.ts +12 -1
  743. package/dist/vue/components/Chart/WaterfallChart.vue.js.map +1 -1
  744. package/dist/vue/components/Chart/WaterfallChart.vue_vue_type_script_setup_true_lang.js +8 -2
  745. package/dist/vue/components/Chart/WaterfallChart.vue_vue_type_script_setup_true_lang.js.map +1 -1
  746. package/dist/vue/components/Chart/graph.d.ts +156 -0
  747. package/dist/vue/components/Chart/graph.js +137 -0
  748. package/dist/vue/components/Chart/graph.js.map +1 -0
  749. package/dist/vue/components/Chart/index.d.ts +5 -1
  750. package/dist/vue/components/Chart/index.js +5 -1
  751. package/dist/vue/components/Chart/orderbook.d.ts +5 -1
  752. package/dist/vue/components/Chart/orderbook.js +2 -0
  753. package/dist/vue/components/Chart/orderbook.js.map +1 -1
  754. package/dist/vue/components/Chart/three-d.d.ts +3 -0
  755. package/dist/vue/components/Chart/three-d.js +2 -0
  756. package/dist/vue/components/Chart/three-d.js.map +1 -1
  757. package/dist/vue/components/Chart/trading.d.ts +30 -3
  758. package/dist/vue/components/Chart/trading.js +9 -0
  759. package/dist/vue/components/Chart/trading.js.map +1 -1
  760. package/dist/vue/components/Chart/types.d.ts +74 -2
  761. package/dist/vue/global.d.ts +2 -38
  762. package/dist/vue/groups/charts.js +10 -2
  763. package/dist/vue/groups/charts.js.map +1 -1
  764. package/dist/vue/index.js +6 -2
  765. package/dist/vue/internal/register.d.ts +7 -0
  766. package/dist/vue/internal/register.js +14 -0
  767. package/dist/vue/internal/register.js.map +1 -0
  768. package/dist/vue/plugin.d.ts +9 -4
  769. package/dist/vue/plugin.js +6 -11
  770. package/dist/vue/plugin.js.map +1 -1
  771. package/dist/weapp/area-chart/index.wxml +1 -1
  772. package/dist/weapp/bar-chart/index.wxml +1 -1
  773. package/dist/weapp/box-plot-chart/index.wxml +1 -1
  774. package/dist/weapp/bubble-chart/index.wxml +1 -1
  775. package/dist/weapp/candlestick-chart/index.wxml +1 -1
  776. package/dist/weapp/chart/index.wxml +1 -1
  777. package/dist/weapp/charts/canvas.js +1987 -175
  778. package/dist/weapp/charts/core.js +3 -0
  779. package/dist/weapp/chord-chart/index.js +1 -0
  780. package/dist/weapp/chord-chart/index.json +1 -0
  781. package/dist/weapp/chord-chart/index.wxml +1 -0
  782. package/dist/weapp/chord-chart/index.wxss +1 -0
  783. package/dist/weapp/controls.js +148 -57
  784. package/dist/weapp/gantt-chart/index.wxml +1 -1
  785. package/dist/weapp/heatmap-chart/index.wxml +1 -1
  786. package/dist/weapp/histogram-chart/index.wxml +1 -1
  787. package/dist/weapp/horizontal-bar-chart/index.wxml +1 -1
  788. package/dist/weapp/line-chart/index.wxml +1 -1
  789. package/dist/weapp/mixed-chart/index.wxml +1 -1
  790. package/dist/weapp/quadrant-chart/index.wxml +1 -1
  791. package/dist/weapp/range-area-chart/index.wxml +1 -1
  792. package/dist/weapp/scatter-chart/index.wxml +1 -1
  793. package/dist/weapp/sparkline/index.wxml +1 -1
  794. package/dist/weapp/types.d.ts +96 -4
  795. package/dist/weapp/waterfall-chart/index.wxml +1 -1
  796. package/dist/web-components/components/chart/charts.d.ts +4 -2
  797. package/dist/web-components/components/chart/charts.js +8 -1
  798. package/dist/web-components/components/chart/charts.js.map +1 -1
  799. package/dist/web-components/components/chart/extended.d.ts +21 -7
  800. package/dist/web-components/components/chart/extended.js +29 -9
  801. package/dist/web-components/components/chart/extended.js.map +1 -1
  802. package/dist/web-components/components/chart/shapes-extended.d.ts +37 -1
  803. package/dist/web-components/components/chart/shapes-extended.js +27 -1
  804. package/dist/web-components/components/chart/shapes-extended.js.map +1 -1
  805. package/dist/web-components/components/chart-3d/chart-3d.d.ts +1 -1
  806. package/dist/web-components/components/chart-3d/chart-3d.js.map +1 -1
  807. package/dist/web-components/components/graph/graph.d.ts +156 -0
  808. package/dist/web-components/components/graph/graph.js +150 -0
  809. package/dist/web-components/components/graph/graph.js.map +1 -0
  810. package/dist/web-components/components/trading-chart/trading-chart.d.ts +49 -2
  811. package/dist/web-components/components/trading-chart/trading-chart.js +62 -0
  812. package/dist/web-components/components/trading-chart/trading-chart.js.map +1 -1
  813. package/dist/web-components/elements/chart.d.ts +1 -1
  814. package/dist/web-components/elements/chart.js +6 -5
  815. package/dist/web-components/elements/chart.js.map +1 -1
  816. package/dist/web-components/elements/graph.d.ts +2 -0
  817. package/dist/web-components/elements/graph.js +12 -0
  818. package/dist/web-components/elements/graph.js.map +1 -0
  819. package/dist/web-components/html-custom-data.json +318 -4
  820. package/dist/web-components/types/react.d.ts +63 -4
  821. package/dist/web-components/types/solid.d.ts +55 -8
  822. package/dist/web-components/types/svelte.d.ts +55 -8
  823. package/dist/web-components/types/vue.d.ts +55 -4
  824. package/package.json +16 -1
@@ -1 +1 @@
1
- {"version":3,"file":"scene.cjs","names":["toCss","mix","parseColor","font","require_color","require_overlay","TAU","estimateText","size","f","text","clamp","v","lo","hi","positive","finite","fallback","sum","s","values","easeOutCubic","t","upright","r","a","inset","top","padding","right","bottom","left","rect","ellipsize","measure","font","max","mid","uniqueKeys","seen","names","name","LIGHT_INK","DARK_INK","channel","relativeLuminance","c","over","contrastRatio","ink","fill","b","WHITE","inkOn","solid","backdrop","light","dark","textOn","readableFill","best","target","toward","limit","next","resolveWith","css","theme","emptyLayout","cx","area","cy","r1"],"sources":["../../../../../charts/src/engine/shapes/scene.ts"],"sourcesContent":["// Drawable scene of a shape chart: resolved geometry, colors and texts,\n// produced by the (DOM-free) layouts and consumed by draw / hit testing.\n\nimport { mix, parseColor, toCss, type Rgba } from \"../color\";\n\nimport { font } from \"../overlay\";\nimport type { ChartTheme } from \"../theme\";\nimport type { ChartPadding } from \"../types\";\nimport type {\n ShapeChartLabels,\n ShapeChartType,\n ShapeHoverEvent,\n} from \"./types\";\n\nexport const TAU = Math.PI * 2;\n\n/** Rectangle in CSS pixels */\nexport interface ShapeRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface NodeBase {\n /** Index of the item the node belongs to (hover, dimming); none for decorations */\n hit?: number;\n /**\n * Other items whose hover also emphasizes the node (the flows of a hovered\n * sankey node, the ancestors of a hovered sunburst sector); hit testing\n * only uses `hit`\n */\n also?: readonly number[];\n /** Opacity multiplier */\n alpha?: number;\n /** Offset applied while the node's item is hovered (pie slices pop out) */\n shift?: [number, number];\n}\n\n/** Annular sector (pie slice, donut segment, ring) */\nexport interface SectorNode extends NodeBase {\n kind: \"sector\";\n cx: number;\n cy: number;\n r0: number;\n r1: number;\n /** Canvas angles (radians, clockwise from 3 o'clock) */\n a0: number;\n a1: number;\n /** Gap with the neighbours, in pixels */\n pad: number;\n /** Corner radius, in pixels */\n corner: number;\n fill: string;\n}\n\n/** Polygon (radar grid / series, funnel stage); `hole` is cut out */\nexport interface PolygonNode extends NodeBase {\n kind: \"polygon\";\n /** Flat x, y list */\n points: number[];\n hole?: number[];\n fill?: string;\n stroke?: string;\n lineWidth?: number;\n /** Corner radius, in pixels */\n radius?: number;\n /** Fill / stroke width when hovered */\n hoverFill?: string;\n hoverLineWidth?: number;\n /** Lightens the shape when hovered */\n brighten?: boolean;\n}\n\nexport interface RectNode extends NodeBase {\n kind: \"rect\";\n x: number;\n y: number;\n width: number;\n height: number;\n radius: number;\n fill: string;\n brighten?: boolean;\n /** Outline drawn inside the rectangle while its item is hovered */\n hoverStroke?: string;\n /** Distance (px) around the rectangle still picked by hit testing (default 0) */\n hitPad?: number;\n}\n\n/** Stroked arc (gauge track / value) */\nexport interface ArcNode extends NodeBase {\n kind: \"arc\";\n cx: number;\n cy: number;\n r: number;\n a0: number;\n a1: number;\n width: number;\n color: string;\n cap: \"round\" | \"butt\";\n /** Distance (px) beyond the stroke still picked by hit testing (default 4) */\n hitPad?: number;\n}\n\n/** Dot; without fill nor stroke it is only a hit area */\nexport interface CircleNode extends NodeBase {\n kind: \"circle\";\n cx: number;\n cy: number;\n r: number;\n fill?: string;\n stroke?: string;\n lineWidth?: number;\n /** Radar: indicator of the vertex */\n indicator?: number;\n /** Radius and halo color when the vertex is hovered */\n hoverR?: number;\n halo?: string;\n}\n\nexport interface LineNode extends NodeBase {\n kind: \"line\";\n points: number[];\n color: string;\n width: number;\n dash?: number[];\n}\n\nexport interface TextNode extends NodeBase {\n kind: \"text\";\n x: number;\n y: number;\n text: string;\n font: string;\n color: string;\n align: \"left\" | \"center\" | \"right\";\n baseline: \"top\" | \"middle\" | \"bottom\" | \"alphabetic\";\n /** Radar: indicator of the label */\n indicator?: number;\n hoverColor?: string;\n hoverFont?: string;\n /** Rotation around (x, y), radians clockwise */\n rotate?: number;\n /** Outline drawn behind the text so it reads over other marks */\n halo?: string;\n}\n\n/**\n * Sankey flow: a horizontal S-curve (cubic Bézier) of constant thickness\n * from (x0, y0) to (x1, y1), filled with a gradient from `color0` to `color1`\n */\nexport interface LinkNode extends NodeBase {\n kind: \"link\";\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n /** Thickness, in pixels */\n width: number;\n color0: string;\n color1: string;\n /** Opacity while the link (or one of its `also` items) is hovered */\n activeAlpha?: number;\n}\n\n/** Radar: dashed guide from the center to the hovered indicator */\nexport interface GuideNode extends NodeBase {\n kind: \"guide\";\n cx: number;\n cy: number;\n /** End of each spoke */\n ends: [number, number][];\n color: string;\n}\n\nexport type ShapeNode =\n | SectorNode\n | PolygonNode\n | RectNode\n | ArcNode\n | CircleNode\n | LineNode\n | TextNode\n | GuideNode\n | LinkNode;\n\n/** A row of the default tooltip */\nexport interface ShapeTooltipRow {\n name: string;\n value: string;\n color?: string;\n strong?: boolean;\n}\n\n/** Something the pointer / keyboard can focus */\nexport interface ShapeItem {\n index: number;\n name: string;\n value: number;\n percent: number;\n /** `percent` formatted for screen readers (`percentFormat`) */\n share?: string;\n color: string;\n path?: string[];\n /** Anchor of the tooltip when focused with the keyboard */\n x: number;\n y: number;\n /** Rows of the default tooltip */\n rows: ShapeTooltipRow[];\n /** Radar: one entry per indicator */\n indicators?: {\n name: string;\n value: number;\n percent: number;\n x: number;\n y: number;\n }[];\n /** Extra fields of the hover event (calendar date, sankey link ends) */\n event?: Pick<ShapeHoverEvent, \"date\" | \"source\" | \"target\">;\n /** Sunburst: path focused when the item is activated (click, Enter) */\n drill?: string[];\n}\n\n/** What is hovered: an item (and a radar indicator) */\nexport interface ShapeHover {\n index: number;\n indicator?: number;\n}\n\nexport interface ShapeLegendEntry {\n /** Index passed to `toggle` */\n index: number;\n name: string;\n color: string;\n hidden: boolean;\n}\n\nexport interface ShapeScene {\n type: ShapeChartType;\n /** Size of the whole drawing */\n width: number;\n height: number;\n nodes: ShapeNode[];\n /** Focusable items, in keyboard order */\n items: ShapeItem[];\n /** Opacity of the other marks while one is hovered */\n dim: number;\n /** Entry animation of funnels / treemaps: fade and scale around a point */\n enter?: { alpha: number; scale: number; cx: number; cy: number };\n /**\n * Arrow-key moves in a grid of items (calendar heatmap), in positions of\n * `items`: `next` for Left / Right, `down` for Up / Down; no wrapping\n */\n steps?: { next: number; down: number };\n /** Radar geometry used by hit testing (and to keep the tooltip off the labels) */\n radar?: {\n cx: number;\n cy: number;\n radius: number;\n angles: number[];\n series: { index: number; points: number[] }[];\n /** Boxes of the indicator labels */\n labels?: ShapeRect[];\n };\n /** No data to draw (placeholder shown) */\n empty: boolean;\n /** Built-in texts of the chart's locale (accessible descriptions) */\n labels?: ShapeChartLabels;\n /** Resolved locale of the chart */\n locale?: string;\n}\n\n/** Measures a text in a CSS font */\nexport type MeasureText = (text: string, font: string) => number;\n\n/** Approximate width of a text without a canvas (tests, SSR) */\nexport const estimateText: MeasureText = (text, f) => {\n const size = /(\\d+(?:\\.\\d+)?)px/.exec(f);\n return text.length * (size ? Number(size[1]) : 12) * 0.6;\n};\n\n/** What the layouts of every type get */\nexport interface LayoutContext {\n theme: ChartTheme;\n measure: MeasureText;\n hidden: ReadonlySet<number>;\n /** Entry progress, eased (1 when done) */\n enter: number;\n /** Displayed (animated) value of a key */\n value(key: string, target: number): number;\n format(value: number): string;\n /** Formats a share (0-1): `percentFormat` or a locale percent with one decimal */\n percent(share: number): string;\n /** Built-in texts (locale and `texts` overrides) */\n labels: ShapeChartLabels;\n /** Resolved locale */\n locale: string;\n /** Color of the `i`-th mark (custom `color` or the palette) */\n color(css: string | undefined, i: number): Rgba;\n /** Drawing area, padding excluded */\n area: ShapeRect;\n /** Sunburst: names from the root to the focused node */\n focus: readonly string[];\n}\n\nexport type LayoutResult = Omit<\n ShapeScene,\n \"type\" | \"width\" | \"height\" | \"labels\" | \"locale\"\n>;\n\nexport const clamp = (v: number, lo: number, hi: number) =>\n v < lo ? lo : v > hi ? hi : v;\n\n/** Non-negative finite number */\nexport const positive = (v: number | undefined) =>\n typeof v === \"number\" && Number.isFinite(v) && v > 0 ? v : 0;\n\nexport const finite = (v: number | undefined, fallback = 0) =>\n typeof v === \"number\" && Number.isFinite(v) ? v : fallback;\n\nexport const sum = (values: readonly number[]) => {\n let s = 0;\n for (const v of values) s += v;\n return s;\n};\n\nexport const easeOutCubic = (t: number) => 1 - Math.pow(1 - clamp(t, 0, 1), 3);\n\n/** Angle brought into (-π/2, π/2] so that text rotated by it reads left to right */\nexport const upright = (a: number) => {\n let r = a % TAU;\n if (r > Math.PI) r -= TAU;\n if (r <= -Math.PI) r += TAU;\n if (r > Math.PI / 2) r -= Math.PI;\n else if (r <= -Math.PI / 2) r += Math.PI;\n return r;\n};\n\nexport const inset = (rect: ShapeRect, padding?: ChartPadding): ShapeRect => {\n const top = padding?.top ?? 8;\n const right = padding?.right ?? 8;\n const bottom = padding?.bottom ?? 8;\n const left = padding?.left ?? 8;\n return {\n x: rect.x + left,\n y: rect.y + top,\n width: Math.max(0, rect.width - left - right),\n height: Math.max(0, rect.height - top - bottom),\n };\n};\n\n/** Shortens a text with an ellipsis so it fits in `max` pixels (\"\" if nothing fits) */\nexport const ellipsize = (\n text: string,\n max: number,\n font: string,\n measure: MeasureText,\n): string => {\n if (measure(text, font) <= max) return text;\n if (measure(\"…\", font) > max) return \"\";\n let lo = 0;\n let hi = text.length;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (measure(text.slice(0, mid) + \"…\", font) <= max) lo = mid;\n else hi = mid - 1;\n }\n return lo ? text.slice(0, lo).trimEnd() + \"…\" : \"\";\n};\n\n/** Stable keys of named values: the name, `name#2` for duplicates */\nexport const uniqueKeys = (names: readonly string[]) => {\n const seen = new Map<string, number>();\n return names.map((name) => {\n const n = (seen.get(name) ?? 0) + 1;\n seen.set(name, n);\n return n === 1 ? name : `${name}#${n}`;\n });\n};\n\nconst LIGHT_INK: Rgba = [1, 1, 1, 0.96];\nconst DARK_INK: Rgba = [15 / 255, 23 / 255, 42 / 255, 0.88];\n\nconst channel = (v: number) =>\n v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n\n/** WCAG relative luminance of an opaque color */\nexport const relativeLuminance = (c: Rgba) =>\n 0.2126 * channel(c[0]) + 0.7152 * channel(c[1]) + 0.0722 * channel(c[2]);\n\n/** `top` composited over the opaque `bottom` */\nexport const over = (top: Rgba, bottom: Rgba): Rgba => {\n const a = clamp(top[3], 0, 1);\n return [\n top[0] * a + bottom[0] * (1 - a),\n top[1] * a + bottom[1] * (1 - a),\n top[2] * a + bottom[2] * (1 - a),\n 1,\n ];\n};\n\n/** WCAG contrast ratio (1-21) of `ink` drawn on the opaque `fill` */\nexport const contrastRatio = (ink: Rgba, fill: Rgba) => {\n const a = relativeLuminance(over(ink, fill));\n const b = relativeLuminance(fill);\n return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);\n};\n\nconst WHITE: Rgba = [1, 1, 1, 1];\n\n/** Light or dark ink, whichever contrasts more with the fill, and its contrast */\nexport const inkOn = (\n fill: Rgba,\n backdrop: Rgba = WHITE,\n): { ink: Rgba; css: string; contrast: number } => {\n const solid = over(fill, over(backdrop, WHITE));\n const light = contrastRatio(LIGHT_INK, solid);\n const dark = contrastRatio(DARK_INK, solid);\n return light >= dark\n ? { ink: LIGHT_INK, css: toCss(LIGHT_INK), contrast: light }\n : { ink: DARK_INK, css: toCss(DARK_INK), contrast: dark };\n};\n\n/** Readable text color on a fill (WCAG contrast) */\nexport const textOn = (fill: Rgba, backdrop?: Rgba) =>\n inkOn(fill, backdrop).css;\n\n/**\n * Fill adjusted so that its best ink reaches `target` contrast: darkened\n * under white text, lightened under dark text (at most `limit` of the way)\n */\nexport const readableFill = (fill: Rgba, target = 4.5, limit = 0.3): Rgba => {\n let best = inkOn(fill);\n if (best.contrast >= target) return fill;\n const toward: Rgba =\n best.ink === LIGHT_INK ? [0, 0, 0, fill[3]] : [1, 1, 1, fill[3]];\n for (let t = 0.04; t <= limit + 1e-9; t += 0.04) {\n const next = mix(fill, toward, t);\n best = inkOn(next);\n if (best.contrast >= target) return next;\n }\n return mix(fill, toward, limit);\n};\n\n/** Resolves a custom color with the theme resolver (static parsing otherwise) */\nexport const resolveWith = (\n theme: ChartTheme,\n css: string | undefined,\n fallback: Rgba,\n): Rgba => {\n if (!css) return fallback;\n return theme.resolve\n ? theme.resolve(css, fallback)\n : (parseColor(css) ?? fallback);\n};\n\n/** Placeholder of a chart without data: a muted ring and \"No data\" (localized) */\nexport const emptyLayout = (c: LayoutContext): LayoutResult => {\n const { area, theme } = c;\n const cx = area.x + area.width / 2;\n const cy = area.y + area.height / 2;\n const r1 = Math.max(0, Math.min(area.width, area.height) / 2 - 6);\n return {\n nodes: [\n {\n kind: \"sector\",\n cx,\n cy,\n r0: r1 * 0.66,\n r1,\n a0: 0,\n a1: TAU,\n pad: 0,\n corner: 0,\n fill: toCss(theme.grid, 0.8),\n },\n {\n kind: \"text\",\n x: cx,\n y: cy,\n text: c.labels.noData,\n font: font(theme, 12),\n color: toCss(theme.textMuted),\n align: \"center\",\n baseline: \"middle\",\n },\n ],\n items: [],\n dim: 1,\n empty: true,\n };\n};\n"],"mappings":"4DAcA,IAAaM,EAAM,KAAK,GAAK,EAsQhBC,GAA6B,EAAM,IAAM,CACpD,IAAMC,EAAO,oBAAoB,KAAKC,CAAC,EACvC,OAAOC,EAAK,QAAUF,EAAO,OAAOA,EAAK,EAAE,EAAI,IAAM,EACvD,EA+BaG,GAAS,EAAW,EAAY,IAC3CC,EAAIC,EAAKA,EAAKD,EAAIE,EAAKA,EAAKF,EAGjBG,EAAY,GACvB,OAAOH,GAAM,UAAY,OAAO,SAASA,CAAC,GAAKA,EAAI,EAAIA,EAAI,EAEhDI,GAAU,EAAuB,EAAW,IACvD,OAAOJ,GAAM,UAAY,OAAO,SAASA,CAAC,EAAIA,EAAIK,EAEvCC,EAAO,GAA8B,CAChD,IAAIC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,MAAOnE,EAAAA,MAAMmE,EAAM,SAAS,EAC5B,MAAO,SACP,SAAU,QACZ,CACF,EACA,MAAO,CAAC,EACR,IAAK,EACL,MAAO,EACT,CACF"}
1
+ {"version":3,"file":"scene.cjs","names":["toCss","mix","parseColor","font","require_color","require_overlay","TAU","estimateText","size","f","text","clamp","v","lo","hi","positive","finite","fallback","sum","s","values","easeOutCubic","t","upright","r","a","inset","top","padding","right","bottom","left","rect","ellipsize","measure","font","max","mid","NO_LINE_START","breakLines","lines","rest","cut","space","wrapText","whole","maxLines","last","head","line","tail","k","balanced","uniqueKeys","seen","names","name","LIGHT_INK","DARK_INK","channel","relativeLuminance","c","over","contrastRatio","ink","fill","b","WHITE","inkOn","solid","backdrop","light","dark","textOn","readableFill","best","target","toward","limit","next","resolveWith","css","theme","emptyLayout","cx","area","cy","r1"],"sources":["../../../../../charts/src/engine/shapes/scene.ts"],"sourcesContent":["// Drawable scene of a shape chart: resolved geometry, colors and texts,\n// produced by the (DOM-free) layouts and consumed by draw / hit testing.\n\nimport { mix, parseColor, toCss, type Rgba } from \"../color\";\n\nimport { font } from \"../overlay\";\nimport type { ChartTheme } from \"../theme\";\nimport type { ChartPadding } from \"../types\";\nimport type {\n ShapeChartLabels,\n ShapeChartType,\n ShapeHoverEvent,\n} from \"./types\";\n\nexport const TAU = Math.PI * 2;\n\n/** Rectangle in CSS pixels */\nexport interface ShapeRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface NodeBase {\n /** Index of the item the node belongs to (hover, dimming); none for decorations */\n hit?: number;\n /**\n * Other items whose hover also emphasizes the node (the flows of a hovered\n * sankey node, the ancestors of a hovered sunburst sector); hit testing\n * only uses `hit`\n */\n also?: readonly number[];\n /** Opacity multiplier */\n alpha?: number;\n /** Offset applied while the node's item is hovered (pie slices pop out) */\n shift?: [number, number];\n}\n\n/** Annular sector (pie slice, donut segment, ring) */\nexport interface SectorNode extends NodeBase {\n kind: \"sector\";\n cx: number;\n cy: number;\n r0: number;\n r1: number;\n /** Canvas angles (radians, clockwise from 3 o'clock) */\n a0: number;\n a1: number;\n /** Gap with the neighbours, in pixels */\n pad: number;\n /** Corner radius, in pixels */\n corner: number;\n fill: string;\n}\n\n/** Polygon (radar grid / series, funnel stage); `hole` is cut out */\nexport interface PolygonNode extends NodeBase {\n kind: \"polygon\";\n /** Flat x, y list */\n points: number[];\n hole?: number[];\n fill?: string;\n stroke?: string;\n lineWidth?: number;\n /** Corner radius, in pixels */\n radius?: number;\n /** Fill / stroke width when hovered */\n hoverFill?: string;\n hoverLineWidth?: number;\n /** Lightens the shape when hovered */\n brighten?: boolean;\n}\n\nexport interface RectNode extends NodeBase {\n kind: \"rect\";\n x: number;\n y: number;\n width: number;\n height: number;\n radius: number;\n fill: string;\n brighten?: boolean;\n /** Outline drawn inside the rectangle while its item is hovered */\n hoverStroke?: string;\n /** Distance (px) around the rectangle still picked by hit testing (default 0) */\n hitPad?: number;\n}\n\n/** Stroked arc (gauge track / value) */\nexport interface ArcNode extends NodeBase {\n kind: \"arc\";\n cx: number;\n cy: number;\n r: number;\n a0: number;\n a1: number;\n width: number;\n color: string;\n cap: \"round\" | \"butt\";\n /** Distance (px) beyond the stroke still picked by hit testing (default 4) */\n hitPad?: number;\n}\n\n/** Dot; without fill nor stroke it is only a hit area */\nexport interface CircleNode extends NodeBase {\n kind: \"circle\";\n cx: number;\n cy: number;\n r: number;\n fill?: string;\n stroke?: string;\n lineWidth?: number;\n /** Radar: indicator of the vertex */\n indicator?: number;\n /** Radius and halo color when the vertex is hovered */\n hoverR?: number;\n halo?: string;\n}\n\nexport interface LineNode extends NodeBase {\n kind: \"line\";\n points: number[];\n color: string;\n width: number;\n dash?: number[];\n}\n\nexport interface TextNode extends NodeBase {\n kind: \"text\";\n x: number;\n y: number;\n text: string;\n font: string;\n color: string;\n align: \"left\" | \"center\" | \"right\";\n baseline: \"top\" | \"middle\" | \"bottom\" | \"alphabetic\";\n /** Radar: indicator of the label */\n indicator?: number;\n hoverColor?: string;\n hoverFont?: string;\n /** Rotation around (x, y), radians clockwise */\n rotate?: number;\n /** Outline drawn behind the text so it reads over other marks */\n halo?: string;\n}\n\n/**\n * Sankey flow: a horizontal S-curve (cubic Bézier) of constant thickness\n * from (x0, y0) to (x1, y1), filled with a gradient from `color0` to `color1`\n */\nexport interface LinkNode extends NodeBase {\n kind: \"link\";\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n /** Thickness, in pixels */\n width: number;\n color0: string;\n color1: string;\n /** Opacity while the link (or one of its `also` items) is hovered */\n activeAlpha?: number;\n}\n\n/**\n * Chord ribbon: the source arc (s0 to s1) and the target arc (t0 to t1) at\n * radius `r`, joined by quadratic curves through the center, filled with a\n * gradient from `color0` to `color1`; `head` > 0 replaces the target arc with\n * an arrowhead of that length\n */\nexport interface RibbonNode extends NodeBase {\n kind: \"ribbon\";\n cx: number;\n cy: number;\n r: number;\n /** Canvas angles (radians, clockwise from 3 o'clock) */\n s0: number;\n s1: number;\n t0: number;\n t1: number;\n /** Arrowhead length, in pixels (0 = none) */\n head: number;\n color0: string;\n color1: string;\n /** Opacity while the ribbon (or one of its `also` items) is hovered */\n activeAlpha?: number;\n}\n\n/** Radar: dashed guide from the center to the hovered indicator */\nexport interface GuideNode extends NodeBase {\n kind: \"guide\";\n cx: number;\n cy: number;\n /** End of each spoke */\n ends: [number, number][];\n color: string;\n}\n\nexport type ShapeNode =\n | SectorNode\n | PolygonNode\n | RectNode\n | ArcNode\n | CircleNode\n | LineNode\n | TextNode\n | GuideNode\n | LinkNode\n | RibbonNode;\n\n/** A row of the default tooltip */\nexport interface ShapeTooltipRow {\n name: string;\n value: string;\n color?: string;\n strong?: boolean;\n}\n\n/** Something the pointer / keyboard can focus */\nexport interface ShapeItem {\n index: number;\n name: string;\n value: number;\n percent: number;\n /** `percent` formatted for screen readers (`percentFormat`) */\n share?: string;\n color: string;\n path?: string[];\n /** Anchor of the tooltip when focused with the keyboard */\n x: number;\n y: number;\n /** Rows of the default tooltip */\n rows: ShapeTooltipRow[];\n /** Radar: one entry per indicator */\n indicators?: {\n name: string;\n value: number;\n percent: number;\n x: number;\n y: number;\n }[];\n /** Extra fields of the hover event (calendar date, sankey link / chord ribbon ends) */\n event?: Pick<ShapeHoverEvent, \"date\" | \"source\" | \"target\" | \"reverseValue\">;\n /** Sunburst: path focused when the item is activated (click, Enter) */\n drill?: string[];\n}\n\n/** What is hovered: an item (and a radar indicator) */\nexport interface ShapeHover {\n index: number;\n indicator?: number;\n}\n\nexport interface ShapeLegendEntry {\n /** Index passed to `toggle` */\n index: number;\n name: string;\n color: string;\n hidden: boolean;\n}\n\nexport interface ShapeScene {\n type: ShapeChartType;\n /** Size of the whole drawing */\n width: number;\n height: number;\n nodes: ShapeNode[];\n /** Focusable items, in keyboard order */\n items: ShapeItem[];\n /** Opacity of the other marks while one is hovered */\n dim: number;\n /** Entry animation of funnels / treemaps: fade and scale around a point */\n enter?: { alpha: number; scale: number; cx: number; cy: number };\n /**\n * Arrow-key moves in a grid of items (calendar heatmap), in positions of\n * `items`: `next` for Left / Right, `down` for Up / Down; no wrapping\n */\n steps?: { next: number; down: number };\n /** Radar geometry used by hit testing (and to keep the tooltip off the labels) */\n radar?: {\n cx: number;\n cy: number;\n radius: number;\n angles: number[];\n series: { index: number; points: number[] }[];\n /** Boxes of the indicator labels */\n labels?: ShapeRect[];\n };\n /** No data to draw (placeholder shown) */\n empty: boolean;\n /** Built-in texts of the chart's locale (accessible descriptions) */\n labels?: ShapeChartLabels;\n /** Resolved locale of the chart */\n locale?: string;\n}\n\n/** Measures a text in a CSS font */\nexport type MeasureText = (text: string, font: string) => number;\n\n/** Approximate width of a text without a canvas (tests, SSR) */\nexport const estimateText: MeasureText = (text, f) => {\n const size = /(\\d+(?:\\.\\d+)?)px/.exec(f);\n return text.length * (size ? Number(size[1]) : 12) * 0.6;\n};\n\n/** What the layouts of every type get */\nexport interface LayoutContext {\n theme: ChartTheme;\n measure: MeasureText;\n hidden: ReadonlySet<number>;\n /** Entry progress, eased (1 when done) */\n enter: number;\n /** Displayed (animated) value of a key */\n value(key: string, target: number): number;\n format(value: number): string;\n /** Formats a share (0-1): `percentFormat` or a locale percent with one decimal */\n percent(share: number): string;\n /** Built-in texts (locale and `texts` overrides) */\n labels: ShapeChartLabels;\n /** Resolved locale */\n locale: string;\n /** Color of the `i`-th mark (custom `color` or the palette) */\n color(css: string | undefined, i: number): Rgba;\n /** Drawing area, padding excluded */\n area: ShapeRect;\n /** Sunburst: names from the root to the focused node */\n focus: readonly string[];\n}\n\nexport type LayoutResult = Omit<\n ShapeScene,\n \"type\" | \"width\" | \"height\" | \"labels\" | \"locale\"\n>;\n\nexport const clamp = (v: number, lo: number, hi: number) =>\n v < lo ? lo : v > hi ? hi : v;\n\n/** Non-negative finite number */\nexport const positive = (v: number | undefined) =>\n typeof v === \"number\" && Number.isFinite(v) && v > 0 ? v : 0;\n\nexport const finite = (v: number | undefined, fallback = 0) =>\n typeof v === \"number\" && Number.isFinite(v) ? v : fallback;\n\nexport const sum = (values: readonly number[]) => {\n let s = 0;\n for (const v of values) s += v;\n return s;\n};\n\nexport const easeOutCubic = (t: number) => 1 - Math.pow(1 - clamp(t, 0, 1), 3);\n\n/** Angle brought into (-π/2, π/2] so that text rotated by it reads left to right */\nexport const upright = (a: number) => {\n let r = a % TAU;\n if (r > Math.PI) r -= TAU;\n if (r <= -Math.PI) r += TAU;\n if (r > Math.PI / 2) r -= Math.PI;\n else if (r <= -Math.PI / 2) r += Math.PI;\n return r;\n};\n\nexport const inset = (rect: ShapeRect, padding?: ChartPadding): ShapeRect => {\n const top = padding?.top ?? 8;\n const right = padding?.right ?? 8;\n const bottom = padding?.bottom ?? 8;\n const left = padding?.left ?? 8;\n return {\n x: rect.x + left,\n y: rect.y + top,\n width: Math.max(0, rect.width - left - right),\n height: Math.max(0, rect.height - top - bottom),\n };\n};\n\n/** Shortens a text with an ellipsis so it fits in `max` pixels (\"\" if nothing fits) */\nexport const ellipsize = (\n text: string,\n max: number,\n font: string,\n measure: MeasureText,\n): string => {\n if (measure(text, font) <= max) return text;\n if (measure(\"…\", font) > max) return \"\";\n let lo = 0;\n let hi = text.length;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (measure(text.slice(0, mid) + \"…\", font) <= max) lo = mid;\n else hi = mid - 1;\n }\n return lo ? text.slice(0, lo).trimEnd() + \"…\" : \"\";\n};\n\n/** Characters that must not start a line (closing brackets and punctuation) */\nconst NO_LINE_START = /^[)\\]}、。,.:;!?)」』】》〉,.:;!?%…]/;\n\n/** Greedy line breaking at `max` pixels, without a line limit */\nconst breakLines = (\n text: string,\n max: number,\n font: string,\n measure: MeasureText,\n): string[] | null => {\n const lines: string[] = [];\n let rest = text.trim();\n while (rest) {\n if (measure(rest, font) <= max) {\n lines.push(rest);\n break;\n }\n // longest prefix that fits\n let lo = 0;\n let hi = rest.length;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (measure(rest.slice(0, mid), font) <= max) lo = mid;\n else hi = mid - 1;\n }\n if (!lo) return null;\n let cut = lo;\n if (rest[lo] !== \" \") {\n const space = rest.lastIndexOf(\" \", lo);\n if (space > lo * 0.4) cut = space;\n // keep closing punctuation with the word before it\n else while (cut > 1 && NO_LINE_START.test(rest.slice(cut))) cut--;\n }\n lines.push(rest.slice(0, cut).trimEnd());\n rest = rest.slice(cut).trimStart();\n }\n return lines;\n};\n\n/**\n * Breaks a text into at most `maxLines` lines of `max` pixels, at spaces when\n * possible (anywhere otherwise, e.g. CJK, never before closing punctuation);\n * a text that fits is balanced across its lines, one that does not ends the\n * last line with an ellipsis\n */\nexport const wrapText = (\n text: string,\n max: number,\n font: string,\n measure: MeasureText,\n maxLines = 2,\n): string[] => {\n const whole = text.trim();\n if (!whole || maxLines < 1) return [];\n const lines = breakLines(whole, max, font, measure);\n if (!lines) {\n const last = ellipsize(whole, max, font, measure);\n return last ? [last] : [];\n }\n if (lines.length > maxLines) {\n const head = lines.slice(0, maxLines - 1);\n // the text after the kept lines (each line is a prefix of the rest)\n let rest = whole;\n for (const line of head) rest = rest.slice(line.length).trimStart();\n const tail = ellipsize(rest, max, font, measure);\n return tail ? [...head, tail] : head;\n }\n if (lines.length < 2) return lines;\n // balance: the narrowest width that still needs as many lines\n const total = measure(whole, font);\n const lo = total / lines.length;\n for (let k = 0; k <= 8; k++) {\n const width = lo + ((max - lo) * k) / 8;\n const balanced = breakLines(whole, width, font, measure);\n if (balanced && balanced.length <= lines.length) return balanced;\n }\n return lines;\n};\n\n/** Stable keys of named values: the name, `name#2` for duplicates */\nexport const uniqueKeys = (names: readonly string[]) => {\n const seen = new Map<string, number>();\n return names.map((name) => {\n const n = (seen.get(name) ?? 0) + 1;\n seen.set(name, n);\n return n === 1 ? name : `${name}#${n}`;\n });\n};\n\nconst LIGHT_INK: Rgba = [1, 1, 1, 0.96];\nconst DARK_INK: Rgba = [15 / 255, 23 / 255, 42 / 255, 0.88];\n\nconst channel = (v: number) =>\n v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n\n/** WCAG relative luminance of an opaque color */\nexport const relativeLuminance = (c: Rgba) =>\n 0.2126 * channel(c[0]) + 0.7152 * channel(c[1]) + 0.0722 * channel(c[2]);\n\n/** `top` composited over the opaque `bottom` */\nexport const over = (top: Rgba, bottom: Rgba): Rgba => {\n const a = clamp(top[3], 0, 1);\n return [\n top[0] * a + bottom[0] * (1 - a),\n top[1] * a + bottom[1] * (1 - a),\n top[2] * a + bottom[2] * (1 - a),\n 1,\n ];\n};\n\n/** WCAG contrast ratio (1-21) of `ink` drawn on the opaque `fill` */\nexport const contrastRatio = (ink: Rgba, fill: Rgba) => {\n const a = relativeLuminance(over(ink, fill));\n const b = relativeLuminance(fill);\n return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);\n};\n\nconst WHITE: Rgba = [1, 1, 1, 1];\n\n/** Light or dark ink, whichever contrasts more with the fill, and its contrast */\nexport const inkOn = (\n fill: Rgba,\n backdrop: Rgba = WHITE,\n): { ink: Rgba; css: string; contrast: number } => {\n const solid = over(fill, over(backdrop, WHITE));\n const light = contrastRatio(LIGHT_INK, solid);\n const dark = contrastRatio(DARK_INK, solid);\n return light >= dark\n ? { ink: LIGHT_INK, css: toCss(LIGHT_INK), contrast: light }\n : { ink: DARK_INK, css: toCss(DARK_INK), contrast: dark };\n};\n\n/** Readable text color on a fill (WCAG contrast) */\nexport const textOn = (fill: Rgba, backdrop?: Rgba) =>\n inkOn(fill, backdrop).css;\n\n/**\n * Fill adjusted so that its best ink reaches `target` contrast: darkened\n * under white text, lightened under dark text (at most `limit` of the way)\n */\nexport const readableFill = (fill: Rgba, target = 4.5, limit = 0.3): Rgba => {\n let best = inkOn(fill);\n if (best.contrast >= target) return fill;\n const toward: Rgba =\n best.ink === LIGHT_INK ? [0, 0, 0, fill[3]] : [1, 1, 1, fill[3]];\n for (let t = 0.04; t <= limit + 1e-9; t += 0.04) {\n const next = mix(fill, toward, t);\n best = inkOn(next);\n if (best.contrast >= target) return next;\n }\n return mix(fill, toward, limit);\n};\n\n/** Resolves a custom color with the theme resolver (static parsing otherwise) */\nexport const resolveWith = (\n theme: ChartTheme,\n css: string | undefined,\n fallback: Rgba,\n): Rgba => {\n if (!css) return fallback;\n return theme.resolve\n ? theme.resolve(css, fallback)\n : (parseColor(css) ?? fallback);\n};\n\n/** Placeholder of a chart without data: a muted ring and \"No data\" (localized) */\nexport const emptyLayout = (c: LayoutContext): LayoutResult => {\n const { area, theme } = c;\n const cx = area.x + area.width / 2;\n const cy = area.y + area.height / 2;\n const r1 = Math.max(0, Math.min(area.width, area.height) / 2 - 6);\n return {\n nodes: [\n {\n kind: \"sector\",\n cx,\n cy,\n r0: r1 * 0.66,\n r1,\n a0: 0,\n a1: TAU,\n pad: 0,\n corner: 0,\n fill: toCss(theme.grid, 0.8),\n },\n {\n kind: \"text\",\n x: cx,\n y: cy,\n text: c.labels.noData,\n font: font(theme, 12),\n color: toCss(theme.textMuted),\n align: \"center\",\n baseline: \"middle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,OAAOX,EACpC,IAAMY,EACJF,EAAK,MAAQlB,EAAY,CAAC,EAAG,EAAG,EAAGQ,EAAK,EAAE,EAAI,CAAC,EAAG,EAAG,EAAGA,EAAK,EAAE,EACjE,IAAK,IAAI3C,EAAI,IAAMA,GAAKwD,EAAQ,KAAM,GAAK,IAAM,CAC/C,IAAMC,EAAO9E,EAAAA,IAAIgE,EAAMY,EAAQvD,CAAC,EAEhC,GADA,EAAO8C,EAAMW,CAAI,EACbJ,EAAK,UAAYC,EAAQ,OAAOG,CACtC,CACA,OAAO9E,EAAAA,IAAIgE,EAAMY,EAAQC,CAAK,CAChC,EAGaE,GACX,EACA,EACA,IAEKC,EACEC,EAAM,QACTA,EAAM,QAAQD,EAAKhE,CAAQ,EAC1Bf,EAAAA,WAAW+E,CAAG,GAAKhE,EAHPA,EAONkE,EAAe,GAAmC,CAC7D,GAAM,CAAE,OAAM,SAAUtB,EAClBuB,EAAKC,EAAK,EAAIA,EAAK,MAAQ,EAC3BC,EAAKD,EAAK,EAAIA,EAAK,OAAS,EAC5BE,EAAK,KAAK,IAAI,EAAG,KAAK,IAAIF,EAAK,MAAOA,EAAK,MAAM,EAAI,EAAI,CAAC,EAChE,MAAO,CACL,MAAO,CACL,CACE,KAAM,SACN,KACA,KACA,GAAIE,EAAK,IACT,KACA,GAAI,EACJ,GAAIjF,EACJ,IAAK,EACL,OAAQ,EACR,KAAMN,EAAAA,MAAMkF,EAAM,KAAM,EAAG,CAC7B,EACA,CACE,KAAM,OACN,EAAGE,EACH,EAAGE,EACH,KAAMzB,EAAE,OAAO,OACf,KAAM1D,EAAAA,KAAK+E,EAAO,EAAE,EACpB,MAAOlF,EAAAA,MAAMkF,EAAM,SAAS,EAC5B,MAAO,SACP,SAAU,QACZ,CACF,EACA,MAAO,CAAC,EACR,IAAK,EACL,MAAO,EACT,CACF"}
@@ -142,6 +142,29 @@ export interface LinkNode extends NodeBase {
142
142
  /** Opacity while the link (or one of its `also` items) is hovered */
143
143
  activeAlpha?: number;
144
144
  }
145
+ /**
146
+ * Chord ribbon: the source arc (s0 to s1) and the target arc (t0 to t1) at
147
+ * radius `r`, joined by quadratic curves through the center, filled with a
148
+ * gradient from `color0` to `color1`; `head` > 0 replaces the target arc with
149
+ * an arrowhead of that length
150
+ */
151
+ export interface RibbonNode extends NodeBase {
152
+ kind: "ribbon";
153
+ cx: number;
154
+ cy: number;
155
+ r: number;
156
+ /** Canvas angles (radians, clockwise from 3 o'clock) */
157
+ s0: number;
158
+ s1: number;
159
+ t0: number;
160
+ t1: number;
161
+ /** Arrowhead length, in pixels (0 = none) */
162
+ head: number;
163
+ color0: string;
164
+ color1: string;
165
+ /** Opacity while the ribbon (or one of its `also` items) is hovered */
166
+ activeAlpha?: number;
167
+ }
145
168
  /** Radar: dashed guide from the center to the hovered indicator */
146
169
  export interface GuideNode extends NodeBase {
147
170
  kind: "guide";
@@ -151,7 +174,7 @@ export interface GuideNode extends NodeBase {
151
174
  ends: [number, number][];
152
175
  color: string;
153
176
  }
154
- export type ShapeNode = SectorNode | PolygonNode | RectNode | ArcNode | CircleNode | LineNode | TextNode | GuideNode | LinkNode;
177
+ export type ShapeNode = SectorNode | PolygonNode | RectNode | ArcNode | CircleNode | LineNode | TextNode | GuideNode | LinkNode | RibbonNode;
155
178
  /** A row of the default tooltip */
156
179
  export interface ShapeTooltipRow {
157
180
  name: string;
@@ -182,8 +205,8 @@ export interface ShapeItem {
182
205
  x: number;
183
206
  y: number;
184
207
  }[];
185
- /** Extra fields of the hover event (calendar date, sankey link ends) */
186
- event?: Pick<ShapeHoverEvent, "date" | "source" | "target">;
208
+ /** Extra fields of the hover event (calendar date, sankey link / chord ribbon ends) */
209
+ event?: Pick<ShapeHoverEvent, "date" | "source" | "target" | "reverseValue">;
187
210
  /** Sunburst: path focused when the item is activated (click, Enter) */
188
211
  drill?: string[];
189
212
  }
@@ -283,6 +306,13 @@ export declare const upright: (a: number) => number;
283
306
  export declare const inset: (rect: ShapeRect, padding?: ChartPadding) => ShapeRect;
284
307
  /** Shortens a text with an ellipsis so it fits in `max` pixels ("" if nothing fits) */
285
308
  export declare const ellipsize: (text: string, max: number, font: string, measure: MeasureText) => string;
309
+ /**
310
+ * Breaks a text into at most `maxLines` lines of `max` pixels, at spaces when
311
+ * possible (anywhere otherwise, e.g. CJK, never before closing punctuation);
312
+ * a text that fits is balanced across its lines, one that does not ends the
313
+ * last line with an ellipsis
314
+ */
315
+ export declare const wrapText: (text: string, max: number, font: string, measure: MeasureText, maxLines?: number) => string[];
286
316
  /** Stable keys of named values: the name, `name#2` for duplicates */
287
317
  export declare const uniqueKeys: (names: readonly string[]) => string[];
288
318
  /** WCAG relative luminance of an opaque color */
@@ -142,6 +142,29 @@ export interface LinkNode extends NodeBase {
142
142
  /** Opacity while the link (or one of its `also` items) is hovered */
143
143
  activeAlpha?: number;
144
144
  }
145
+ /**
146
+ * Chord ribbon: the source arc (s0 to s1) and the target arc (t0 to t1) at
147
+ * radius `r`, joined by quadratic curves through the center, filled with a
148
+ * gradient from `color0` to `color1`; `head` > 0 replaces the target arc with
149
+ * an arrowhead of that length
150
+ */
151
+ export interface RibbonNode extends NodeBase {
152
+ kind: "ribbon";
153
+ cx: number;
154
+ cy: number;
155
+ r: number;
156
+ /** Canvas angles (radians, clockwise from 3 o'clock) */
157
+ s0: number;
158
+ s1: number;
159
+ t0: number;
160
+ t1: number;
161
+ /** Arrowhead length, in pixels (0 = none) */
162
+ head: number;
163
+ color0: string;
164
+ color1: string;
165
+ /** Opacity while the ribbon (or one of its `also` items) is hovered */
166
+ activeAlpha?: number;
167
+ }
145
168
  /** Radar: dashed guide from the center to the hovered indicator */
146
169
  export interface GuideNode extends NodeBase {
147
170
  kind: "guide";
@@ -151,7 +174,7 @@ export interface GuideNode extends NodeBase {
151
174
  ends: [number, number][];
152
175
  color: string;
153
176
  }
154
- export type ShapeNode = SectorNode | PolygonNode | RectNode | ArcNode | CircleNode | LineNode | TextNode | GuideNode | LinkNode;
177
+ export type ShapeNode = SectorNode | PolygonNode | RectNode | ArcNode | CircleNode | LineNode | TextNode | GuideNode | LinkNode | RibbonNode;
155
178
  /** A row of the default tooltip */
156
179
  export interface ShapeTooltipRow {
157
180
  name: string;
@@ -182,8 +205,8 @@ export interface ShapeItem {
182
205
  x: number;
183
206
  y: number;
184
207
  }[];
185
- /** Extra fields of the hover event (calendar date, sankey link ends) */
186
- event?: Pick<ShapeHoverEvent, "date" | "source" | "target">;
208
+ /** Extra fields of the hover event (calendar date, sankey link / chord ribbon ends) */
209
+ event?: Pick<ShapeHoverEvent, "date" | "source" | "target" | "reverseValue">;
187
210
  /** Sunburst: path focused when the item is activated (click, Enter) */
188
211
  drill?: string[];
189
212
  }
@@ -283,6 +306,13 @@ export declare const upright: (a: number) => number;
283
306
  export declare const inset: (rect: ShapeRect, padding?: ChartPadding) => ShapeRect;
284
307
  /** Shortens a text with an ellipsis so it fits in `max` pixels ("" if nothing fits) */
285
308
  export declare const ellipsize: (text: string, max: number, font: string, measure: MeasureText) => string;
309
+ /**
310
+ * Breaks a text into at most `maxLines` lines of `max` pixels, at spaces when
311
+ * possible (anywhere otherwise, e.g. CJK, never before closing punctuation);
312
+ * a text that fits is balanced across its lines, one that does not ends the
313
+ * last line with an ellipsis
314
+ */
315
+ export declare const wrapText: (text: string, max: number, font: string, measure: MeasureText, maxLines?: number) => string[];
286
316
  /** Stable keys of named values: the name, `name#2` for duplicates */
287
317
  export declare const uniqueKeys: (names: readonly string[]) => string[];
288
318
  /** WCAG relative luminance of an opaque color */
@@ -28,23 +28,66 @@ var i = Math.PI * 2, a = (e, t) => {
28
28
  r(e.slice(0, o) + "…", n) <= t ? i = o : a = o - 1;
29
29
  }
30
30
  return i ? e.slice(0, i).trimEnd() + "…" : "";
31
- }, m = (e) => {
31
+ }, m = /^[)\]}、。,.:;!?)」』】》〉,.:;!?%…]/, h = (e, t, n, r) => {
32
+ let i = [], a = e.trim();
33
+ for (; a;) {
34
+ if (r(a, n) <= t) {
35
+ i.push(a);
36
+ break;
37
+ }
38
+ let e = 0, o = a.length;
39
+ for (; e < o;) {
40
+ let i = e + o + 1 >> 1;
41
+ r(a.slice(0, i), n) <= t ? e = i : o = i - 1;
42
+ }
43
+ if (!e) return null;
44
+ let s = e;
45
+ if (a[e] !== " ") {
46
+ let t = a.lastIndexOf(" ", e);
47
+ if (t > e * .4) s = t;
48
+ else for (; s > 1 && m.test(a.slice(s));) s--;
49
+ }
50
+ i.push(a.slice(0, s).trimEnd()), a = a.slice(s).trimStart();
51
+ }
52
+ return i;
53
+ }, g = (e, t, n, r, i = 2) => {
54
+ let a = e.trim();
55
+ if (!a || i < 1) return [];
56
+ let o = h(a, t, n, r);
57
+ if (!o) {
58
+ let e = p(a, t, n, r);
59
+ return e ? [e] : [];
60
+ }
61
+ if (o.length > i) {
62
+ let e = o.slice(0, i - 1), s = a;
63
+ for (let t of e) s = s.slice(t.length).trimStart();
64
+ let c = p(s, t, n, r);
65
+ return c ? [...e, c] : e;
66
+ }
67
+ if (o.length < 2) return o;
68
+ let s = r(a, n) / o.length;
69
+ for (let e = 0; e <= 8; e++) {
70
+ let i = h(a, s + (t - s) * e / 8, n, r);
71
+ if (i && i.length <= o.length) return i;
72
+ }
73
+ return o;
74
+ }, _ = (e) => {
32
75
  let t = /* @__PURE__ */ new Map();
33
76
  return e.map((e) => {
34
77
  let n = (t.get(e) ?? 0) + 1;
35
78
  return t.set(e, n), n === 1 ? e : `${e}#${n}`;
36
79
  });
37
- }, h = [
80
+ }, v = [
38
81
  1,
39
82
  1,
40
83
  1,
41
84
  .96
42
- ], g = [
85
+ ], y = [
43
86
  15 / 255,
44
87
  23 / 255,
45
88
  42 / 255,
46
89
  .88
47
- ], _ = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4, v = (e) => .2126 * _(e[0]) + .7152 * _(e[1]) + .0722 * _(e[2]), y = (e, t) => {
90
+ ], b = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4, x = (e) => .2126 * b(e[0]) + .7152 * b(e[1]) + .0722 * b(e[2]), S = (e, t) => {
48
91
  let n = o(e[3], 0, 1);
49
92
  return [
50
93
  e[0] * n + t[0] * (1 - n),
@@ -52,29 +95,29 @@ var i = Math.PI * 2, a = (e, t) => {
52
95
  e[2] * n + t[2] * (1 - n),
53
96
  1
54
97
  ];
55
- }, b = (e, t) => {
56
- let n = v(y(e, t)), r = v(t);
98
+ }, C = (e, t) => {
99
+ let n = x(S(e, t)), r = x(t);
57
100
  return (Math.max(n, r) + .05) / (Math.min(n, r) + .05);
58
- }, x = [
101
+ }, w = [
59
102
  1,
60
103
  1,
61
104
  1,
62
105
  1
63
- ], S = (e, t = x) => {
64
- let r = y(e, y(t, x)), i = b(h, r), a = b(g, r);
106
+ ], T = (e, t = w) => {
107
+ let r = S(e, S(t, w)), i = C(v, r), a = C(y, r);
65
108
  return i >= a ? {
66
- ink: h,
67
- css: n(h),
109
+ ink: v,
110
+ css: n(v),
68
111
  contrast: i
69
112
  } : {
70
- ink: g,
71
- css: n(g),
113
+ ink: y,
114
+ css: n(y),
72
115
  contrast: a
73
116
  };
74
- }, C = (e, t) => S(e, t).css, w = (t, n = 4.5, r = .3) => {
75
- let i = S(t);
117
+ }, E = (e, t) => T(e, t).css, D = (t, n = 4.5, r = .3) => {
118
+ let i = T(t);
76
119
  if (i.contrast >= n) return t;
77
- let a = i.ink === h ? [
120
+ let a = i.ink === v ? [
78
121
  0,
79
122
  0,
80
123
  0,
@@ -87,10 +130,10 @@ var i = Math.PI * 2, a = (e, t) => {
87
130
  ];
88
131
  for (let o = .04; o <= r + 1e-9; o += .04) {
89
132
  let r = e(t, a, o);
90
- if (i = S(r), i.contrast >= n) return r;
133
+ if (i = T(r), i.contrast >= n) return r;
91
134
  }
92
135
  return e(t, a, r);
93
- }, T = (e, n, r) => n ? e.resolve ? e.resolve(n, r) : t(n) ?? r : r, E = (e) => {
136
+ }, O = (e, n, r) => n ? e.resolve ? e.resolve(n, r) : t(n) ?? r : r, k = (e) => {
94
137
  let { area: t, theme: a } = e, o = t.x + t.width / 2, s = t.y + t.height / 2, c = Math.max(0, Math.min(t.width, t.height) / 2 - 6);
95
138
  return {
96
139
  nodes: [{
@@ -120,6 +163,6 @@ var i = Math.PI * 2, a = (e, t) => {
120
163
  };
121
164
  };
122
165
  //#endregion
123
- export { i as TAU, o as clamp, b as contrastRatio, u as easeOutCubic, p as ellipsize, E as emptyLayout, a as estimateText, c as finite, S as inkOn, f as inset, y as over, s as positive, w as readableFill, v as relativeLuminance, T as resolveWith, l as sum, C as textOn, m as uniqueKeys, d as upright };
166
+ export { i as TAU, o as clamp, C as contrastRatio, u as easeOutCubic, p as ellipsize, k as emptyLayout, a as estimateText, c as finite, T as inkOn, f as inset, S as over, s as positive, D as readableFill, x as relativeLuminance, O as resolveWith, l as sum, E as textOn, _ as uniqueKeys, d as upright, g as wrapText };
124
167
 
125
168
  //# sourceMappingURL=scene.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scene.js","names":["TAU","estimateText","size","f","text","clamp","v","lo","hi","positive","finite","fallback","sum","s","values","easeOutCubic","t","upright","r","a","inset","top","padding","right","bottom","left","rect","ellipsize","measure","font","max","mid","uniqueKeys","seen","names","name","LIGHT_INK","DARK_INK","channel","relativeLuminance","c","over","contrastRatio","ink","fill","b","WHITE","inkOn","solid","backdrop","light","dark","toCss","textOn","readableFill","best","target","toward","limit","next","mix","resolveWith","css","theme","parseColor","emptyLayout","cx","area","cy","r1"],"sources":["../../../../../charts/src/engine/shapes/scene.ts"],"sourcesContent":["// Drawable scene of a shape chart: resolved geometry, colors and texts,\n// produced by the (DOM-free) layouts and consumed by draw / hit testing.\n\nimport { mix, parseColor, toCss, type Rgba } from \"../color\";\n\nimport { font } from \"../overlay\";\nimport type { ChartTheme } from \"../theme\";\nimport type { ChartPadding } from \"../types\";\nimport type {\n ShapeChartLabels,\n ShapeChartType,\n ShapeHoverEvent,\n} from \"./types\";\n\nexport const TAU = Math.PI * 2;\n\n/** Rectangle in CSS pixels */\nexport interface ShapeRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface NodeBase {\n /** Index of the item the node belongs to (hover, dimming); none for decorations */\n hit?: number;\n /**\n * Other items whose hover also emphasizes the node (the flows of a hovered\n * sankey node, the ancestors of a hovered sunburst sector); hit testing\n * only uses `hit`\n */\n also?: readonly number[];\n /** Opacity multiplier */\n alpha?: number;\n /** Offset applied while the node's item is hovered (pie slices pop out) */\n shift?: [number, number];\n}\n\n/** Annular sector (pie slice, donut segment, ring) */\nexport interface SectorNode extends NodeBase {\n kind: \"sector\";\n cx: number;\n cy: number;\n r0: number;\n r1: number;\n /** Canvas angles (radians, clockwise from 3 o'clock) */\n a0: number;\n a1: number;\n /** Gap with the neighbours, in pixels */\n pad: number;\n /** Corner radius, in pixels */\n corner: number;\n fill: string;\n}\n\n/** Polygon (radar grid / series, funnel stage); `hole` is cut out */\nexport interface PolygonNode extends NodeBase {\n kind: \"polygon\";\n /** Flat x, y list */\n points: number[];\n hole?: number[];\n fill?: string;\n stroke?: string;\n lineWidth?: number;\n /** Corner radius, in pixels */\n radius?: number;\n /** Fill / stroke width when hovered */\n hoverFill?: string;\n hoverLineWidth?: number;\n /** Lightens the shape when hovered */\n brighten?: boolean;\n}\n\nexport interface RectNode extends NodeBase {\n kind: \"rect\";\n x: number;\n y: number;\n width: number;\n height: number;\n radius: number;\n fill: string;\n brighten?: boolean;\n /** Outline drawn inside the rectangle while its item is hovered */\n hoverStroke?: string;\n /** Distance (px) around the rectangle still picked by hit testing (default 0) */\n hitPad?: number;\n}\n\n/** Stroked arc (gauge track / value) */\nexport interface ArcNode extends NodeBase {\n kind: \"arc\";\n cx: number;\n cy: number;\n r: number;\n a0: number;\n a1: number;\n width: number;\n color: string;\n cap: \"round\" | \"butt\";\n /** Distance (px) beyond the stroke still picked by hit testing (default 4) */\n hitPad?: number;\n}\n\n/** Dot; without fill nor stroke it is only a hit area */\nexport interface CircleNode extends NodeBase {\n kind: \"circle\";\n cx: number;\n cy: number;\n r: number;\n fill?: string;\n stroke?: string;\n lineWidth?: number;\n /** Radar: indicator of the vertex */\n indicator?: number;\n /** Radius and halo color when the vertex is hovered */\n hoverR?: number;\n halo?: string;\n}\n\nexport interface LineNode extends NodeBase {\n kind: \"line\";\n points: number[];\n color: string;\n width: number;\n dash?: number[];\n}\n\nexport interface TextNode extends NodeBase {\n kind: \"text\";\n x: number;\n y: number;\n text: string;\n font: string;\n color: string;\n align: \"left\" | \"center\" | \"right\";\n baseline: \"top\" | \"middle\" | \"bottom\" | \"alphabetic\";\n /** Radar: indicator of the label */\n indicator?: number;\n hoverColor?: string;\n hoverFont?: string;\n /** Rotation around (x, y), radians clockwise */\n rotate?: number;\n /** Outline drawn behind the text so it reads over other marks */\n halo?: string;\n}\n\n/**\n * Sankey flow: a horizontal S-curve (cubic Bézier) of constant thickness\n * from (x0, y0) to (x1, y1), filled with a gradient from `color0` to `color1`\n */\nexport interface LinkNode extends NodeBase {\n kind: \"link\";\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n /** Thickness, in pixels */\n width: number;\n color0: string;\n color1: string;\n /** Opacity while the link (or one of its `also` items) is hovered */\n activeAlpha?: number;\n}\n\n/** Radar: dashed guide from the center to the hovered indicator */\nexport interface GuideNode extends NodeBase {\n kind: \"guide\";\n cx: number;\n cy: number;\n /** End of each spoke */\n ends: [number, number][];\n color: string;\n}\n\nexport type ShapeNode =\n | SectorNode\n | PolygonNode\n | RectNode\n | ArcNode\n | CircleNode\n | LineNode\n | TextNode\n | GuideNode\n | LinkNode;\n\n/** A row of the default tooltip */\nexport interface ShapeTooltipRow {\n name: string;\n value: string;\n color?: string;\n strong?: boolean;\n}\n\n/** Something the pointer / keyboard can focus */\nexport interface ShapeItem {\n index: number;\n name: string;\n value: number;\n percent: number;\n /** `percent` formatted for screen readers (`percentFormat`) */\n share?: string;\n color: string;\n path?: string[];\n /** Anchor of the tooltip when focused with the keyboard */\n x: number;\n y: number;\n /** Rows of the default tooltip */\n rows: ShapeTooltipRow[];\n /** Radar: one entry per indicator */\n indicators?: {\n name: string;\n value: number;\n percent: number;\n x: number;\n y: number;\n }[];\n /** Extra fields of the hover event (calendar date, sankey link ends) */\n event?: Pick<ShapeHoverEvent, \"date\" | \"source\" | \"target\">;\n /** Sunburst: path focused when the item is activated (click, Enter) */\n drill?: string[];\n}\n\n/** What is hovered: an item (and a radar indicator) */\nexport interface ShapeHover {\n index: number;\n indicator?: number;\n}\n\nexport interface ShapeLegendEntry {\n /** Index passed to `toggle` */\n index: number;\n name: string;\n color: string;\n hidden: boolean;\n}\n\nexport interface ShapeScene {\n type: ShapeChartType;\n /** Size of the whole drawing */\n width: number;\n height: number;\n nodes: ShapeNode[];\n /** Focusable items, in keyboard order */\n items: ShapeItem[];\n /** Opacity of the other marks while one is hovered */\n dim: number;\n /** Entry animation of funnels / treemaps: fade and scale around a point */\n enter?: { alpha: number; scale: number; cx: number; cy: number };\n /**\n * Arrow-key moves in a grid of items (calendar heatmap), in positions of\n * `items`: `next` for Left / Right, `down` for Up / Down; no wrapping\n */\n steps?: { next: number; down: number };\n /** Radar geometry used by hit testing (and to keep the tooltip off the labels) */\n radar?: {\n cx: number;\n cy: number;\n radius: number;\n angles: number[];\n series: { index: number; points: number[] }[];\n /** Boxes of the indicator labels */\n labels?: ShapeRect[];\n };\n /** No data to draw (placeholder shown) */\n empty: boolean;\n /** Built-in texts of the chart's locale (accessible descriptions) */\n labels?: ShapeChartLabels;\n /** Resolved locale of the chart */\n locale?: string;\n}\n\n/** Measures a text in a CSS font */\nexport type MeasureText = (text: string, font: string) => number;\n\n/** Approximate width of a text without a canvas (tests, SSR) */\nexport const estimateText: MeasureText = (text, f) => {\n const size = /(\\d+(?:\\.\\d+)?)px/.exec(f);\n return text.length * (size ? Number(size[1]) : 12) * 0.6;\n};\n\n/** What the layouts of every type get */\nexport interface LayoutContext {\n theme: ChartTheme;\n measure: MeasureText;\n hidden: ReadonlySet<number>;\n /** Entry progress, eased (1 when done) */\n enter: number;\n /** Displayed (animated) value of a key */\n value(key: string, target: number): number;\n format(value: number): string;\n /** Formats a share (0-1): `percentFormat` or a locale percent with one decimal */\n percent(share: number): string;\n /** Built-in texts (locale and `texts` overrides) */\n labels: ShapeChartLabels;\n /** Resolved locale */\n locale: string;\n /** Color of the `i`-th mark (custom `color` or the palette) */\n color(css: string | undefined, i: number): Rgba;\n /** Drawing area, padding excluded */\n area: ShapeRect;\n /** Sunburst: names from the root to the focused node */\n focus: readonly string[];\n}\n\nexport type LayoutResult = Omit<\n ShapeScene,\n \"type\" | \"width\" | \"height\" | \"labels\" | \"locale\"\n>;\n\nexport const clamp = (v: number, lo: number, hi: number) =>\n v < lo ? lo : v > hi ? hi : v;\n\n/** Non-negative finite number */\nexport const positive = (v: number | undefined) =>\n typeof v === \"number\" && Number.isFinite(v) && v > 0 ? v : 0;\n\nexport const finite = (v: number | undefined, fallback = 0) =>\n typeof v === \"number\" && Number.isFinite(v) ? v : fallback;\n\nexport const sum = (values: readonly number[]) => {\n let s = 0;\n for (const v of values) s += v;\n return s;\n};\n\nexport const easeOutCubic = (t: number) => 1 - Math.pow(1 - clamp(t, 0, 1), 3);\n\n/** Angle brought into (-π/2, π/2] so that text rotated by it reads left to right */\nexport const upright = (a: number) => {\n let r = a % TAU;\n if (r > Math.PI) r -= TAU;\n if (r <= -Math.PI) r += TAU;\n if (r > Math.PI / 2) r -= Math.PI;\n else if (r <= -Math.PI / 2) r += Math.PI;\n return r;\n};\n\nexport const inset = (rect: ShapeRect, padding?: ChartPadding): ShapeRect => {\n const top = padding?.top ?? 8;\n const right = padding?.right ?? 8;\n const bottom = padding?.bottom ?? 8;\n const left = padding?.left ?? 8;\n return {\n x: rect.x + left,\n y: rect.y + top,\n width: Math.max(0, rect.width - left - right),\n height: Math.max(0, rect.height - top - bottom),\n };\n};\n\n/** Shortens a text with an ellipsis so it fits in `max` pixels (\"\" if nothing fits) */\nexport const ellipsize = (\n text: string,\n max: number,\n font: string,\n measure: MeasureText,\n): string => {\n if (measure(text, font) <= max) return text;\n if (measure(\"…\", font) > max) return \"\";\n let lo = 0;\n let hi = text.length;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (measure(text.slice(0, mid) + \"…\", font) <= max) lo = mid;\n else hi = mid - 1;\n }\n return lo ? text.slice(0, lo).trimEnd() + \"…\" : \"\";\n};\n\n/** Stable keys of named values: the name, `name#2` for duplicates */\nexport const uniqueKeys = (names: readonly string[]) => {\n const seen = new Map<string, number>();\n return names.map((name) => {\n const n = (seen.get(name) ?? 0) + 1;\n seen.set(name, n);\n return n === 1 ? name : `${name}#${n}`;\n });\n};\n\nconst LIGHT_INK: Rgba = [1, 1, 1, 0.96];\nconst DARK_INK: Rgba = [15 / 255, 23 / 255, 42 / 255, 0.88];\n\nconst channel = (v: number) =>\n v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n\n/** WCAG relative luminance of an opaque color */\nexport const relativeLuminance = (c: Rgba) =>\n 0.2126 * channel(c[0]) + 0.7152 * channel(c[1]) + 0.0722 * channel(c[2]);\n\n/** `top` composited over the opaque `bottom` */\nexport const over = (top: Rgba, bottom: Rgba): Rgba => {\n const a = clamp(top[3], 0, 1);\n return [\n top[0] * a + bottom[0] * (1 - a),\n top[1] * a + bottom[1] * (1 - a),\n top[2] * a + bottom[2] * (1 - a),\n 1,\n ];\n};\n\n/** WCAG contrast ratio (1-21) of `ink` drawn on the opaque `fill` */\nexport const contrastRatio = (ink: Rgba, fill: Rgba) => {\n const a = relativeLuminance(over(ink, fill));\n const b = relativeLuminance(fill);\n return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);\n};\n\nconst WHITE: Rgba = [1, 1, 1, 1];\n\n/** Light or dark ink, whichever contrasts more with the fill, and its contrast */\nexport const inkOn = (\n fill: Rgba,\n backdrop: Rgba = WHITE,\n): { ink: Rgba; css: string; contrast: number } => {\n const solid = over(fill, over(backdrop, WHITE));\n const light = contrastRatio(LIGHT_INK, solid);\n const dark = contrastRatio(DARK_INK, solid);\n return light >= dark\n ? { ink: LIGHT_INK, css: toCss(LIGHT_INK), contrast: light }\n : { ink: DARK_INK, css: toCss(DARK_INK), contrast: dark };\n};\n\n/** Readable text color on a fill (WCAG contrast) */\nexport const textOn = (fill: Rgba, backdrop?: Rgba) =>\n inkOn(fill, backdrop).css;\n\n/**\n * Fill adjusted so that its best ink reaches `target` contrast: darkened\n * under white text, lightened under dark text (at most `limit` of the way)\n */\nexport const readableFill = (fill: Rgba, target = 4.5, limit = 0.3): Rgba => {\n let best = inkOn(fill);\n if (best.contrast >= target) return fill;\n const toward: Rgba =\n best.ink === LIGHT_INK ? [0, 0, 0, fill[3]] : [1, 1, 1, fill[3]];\n for (let t = 0.04; t <= limit + 1e-9; t += 0.04) {\n const next = mix(fill, toward, t);\n best = inkOn(next);\n if (best.contrast >= target) return next;\n }\n return mix(fill, toward, limit);\n};\n\n/** Resolves a custom color with the theme resolver (static parsing otherwise) */\nexport const resolveWith = (\n theme: ChartTheme,\n css: string | undefined,\n fallback: Rgba,\n): Rgba => {\n if (!css) return fallback;\n return theme.resolve\n ? theme.resolve(css, fallback)\n : (parseColor(css) ?? fallback);\n};\n\n/** Placeholder of a chart without data: a muted ring and \"No data\" (localized) */\nexport const emptyLayout = (c: LayoutContext): LayoutResult => {\n const { area, theme } = c;\n const cx = area.x + area.width / 2;\n const cy = area.y + area.height / 2;\n const r1 = Math.max(0, Math.min(area.width, area.height) / 2 - 6);\n return {\n nodes: [\n {\n kind: \"sector\",\n cx,\n cy,\n r0: r1 * 0.66,\n r1,\n a0: 0,\n a1: TAU,\n pad: 0,\n corner: 0,\n fill: toCss(theme.grid, 0.8),\n },\n {\n kind: \"text\",\n x: cx,\n y: cy,\n text: c.labels.noData,\n font: font(theme, 12),\n color: toCss(theme.textMuted),\n align: \"center\",\n baseline: \"middle\",\n },\n ],\n items: [],\n dim: 1,\n empty: true,\n };\n};\n"],"mappings":";;;AAcA,IAAaA,IAAM,KAAK,KAAK,GA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K,IAAIA,EAAK,SAAS,GAC5BE,IAAK,KAAK,IAAI,GAAG,KAAK,IAAIF,EAAK,OAAOA,EAAK,MAAM,IAAI,IAAI,CAAC;CAChE,OAAO;EACL,OAAO,CACL;GACE,MAAM;GACN;GACA;GACA,IAAIE,IAAK;GACT;GACA,IAAI;GACJ,IAAIrE;GACJ,KAAK;GACL,QAAQ;GACR,MAAMoD,EAAMW,EAAM,MAAM,EAAG;EAC7B,GACA;GACE,MAAM;GACN,GAAGG;GACH,GAAGE;GACH,MAAM5B,EAAE,OAAO;GACf,MAAMX,EAAKkC,GAAO,EAAE;GACpB,OAAOX,EAAMW,EAAM,SAAS;GAC5B,OAAO;GACP,UAAU;EACZ,CACF;EACA,OAAO,CAAC;EACR,KAAK;EACL,OAAO;CACT;AACF"}
1
+ {"version":3,"file":"scene.js","names":["TAU","estimateText","size","f","text","clamp","v","lo","hi","positive","finite","fallback","sum","s","values","easeOutCubic","t","upright","r","a","inset","top","padding","right","bottom","left","rect","ellipsize","measure","font","max","mid","NO_LINE_START","breakLines","lines","rest","cut","space","wrapText","whole","maxLines","last","head","line","tail","k","balanced","uniqueKeys","seen","names","name","LIGHT_INK","DARK_INK","channel","relativeLuminance","c","over","contrastRatio","ink","fill","b","WHITE","inkOn","solid","backdrop","light","dark","toCss","textOn","readableFill","best","target","toward","limit","next","mix","resolveWith","css","theme","parseColor","emptyLayout","cx","area","cy","r1"],"sources":["../../../../../charts/src/engine/shapes/scene.ts"],"sourcesContent":["// Drawable scene of a shape chart: resolved geometry, colors and texts,\n// produced by the (DOM-free) layouts and consumed by draw / hit testing.\n\nimport { mix, parseColor, toCss, type Rgba } from \"../color\";\n\nimport { font } from \"../overlay\";\nimport type { ChartTheme } from \"../theme\";\nimport type { ChartPadding } from \"../types\";\nimport type {\n ShapeChartLabels,\n ShapeChartType,\n ShapeHoverEvent,\n} from \"./types\";\n\nexport const TAU = Math.PI * 2;\n\n/** Rectangle in CSS pixels */\nexport interface ShapeRect {\n x: number;\n y: number;\n width: number;\n height: number;\n}\n\ninterface NodeBase {\n /** Index of the item the node belongs to (hover, dimming); none for decorations */\n hit?: number;\n /**\n * Other items whose hover also emphasizes the node (the flows of a hovered\n * sankey node, the ancestors of a hovered sunburst sector); hit testing\n * only uses `hit`\n */\n also?: readonly number[];\n /** Opacity multiplier */\n alpha?: number;\n /** Offset applied while the node's item is hovered (pie slices pop out) */\n shift?: [number, number];\n}\n\n/** Annular sector (pie slice, donut segment, ring) */\nexport interface SectorNode extends NodeBase {\n kind: \"sector\";\n cx: number;\n cy: number;\n r0: number;\n r1: number;\n /** Canvas angles (radians, clockwise from 3 o'clock) */\n a0: number;\n a1: number;\n /** Gap with the neighbours, in pixels */\n pad: number;\n /** Corner radius, in pixels */\n corner: number;\n fill: string;\n}\n\n/** Polygon (radar grid / series, funnel stage); `hole` is cut out */\nexport interface PolygonNode extends NodeBase {\n kind: \"polygon\";\n /** Flat x, y list */\n points: number[];\n hole?: number[];\n fill?: string;\n stroke?: string;\n lineWidth?: number;\n /** Corner radius, in pixels */\n radius?: number;\n /** Fill / stroke width when hovered */\n hoverFill?: string;\n hoverLineWidth?: number;\n /** Lightens the shape when hovered */\n brighten?: boolean;\n}\n\nexport interface RectNode extends NodeBase {\n kind: \"rect\";\n x: number;\n y: number;\n width: number;\n height: number;\n radius: number;\n fill: string;\n brighten?: boolean;\n /** Outline drawn inside the rectangle while its item is hovered */\n hoverStroke?: string;\n /** Distance (px) around the rectangle still picked by hit testing (default 0) */\n hitPad?: number;\n}\n\n/** Stroked arc (gauge track / value) */\nexport interface ArcNode extends NodeBase {\n kind: \"arc\";\n cx: number;\n cy: number;\n r: number;\n a0: number;\n a1: number;\n width: number;\n color: string;\n cap: \"round\" | \"butt\";\n /** Distance (px) beyond the stroke still picked by hit testing (default 4) */\n hitPad?: number;\n}\n\n/** Dot; without fill nor stroke it is only a hit area */\nexport interface CircleNode extends NodeBase {\n kind: \"circle\";\n cx: number;\n cy: number;\n r: number;\n fill?: string;\n stroke?: string;\n lineWidth?: number;\n /** Radar: indicator of the vertex */\n indicator?: number;\n /** Radius and halo color when the vertex is hovered */\n hoverR?: number;\n halo?: string;\n}\n\nexport interface LineNode extends NodeBase {\n kind: \"line\";\n points: number[];\n color: string;\n width: number;\n dash?: number[];\n}\n\nexport interface TextNode extends NodeBase {\n kind: \"text\";\n x: number;\n y: number;\n text: string;\n font: string;\n color: string;\n align: \"left\" | \"center\" | \"right\";\n baseline: \"top\" | \"middle\" | \"bottom\" | \"alphabetic\";\n /** Radar: indicator of the label */\n indicator?: number;\n hoverColor?: string;\n hoverFont?: string;\n /** Rotation around (x, y), radians clockwise */\n rotate?: number;\n /** Outline drawn behind the text so it reads over other marks */\n halo?: string;\n}\n\n/**\n * Sankey flow: a horizontal S-curve (cubic Bézier) of constant thickness\n * from (x0, y0) to (x1, y1), filled with a gradient from `color0` to `color1`\n */\nexport interface LinkNode extends NodeBase {\n kind: \"link\";\n x0: number;\n y0: number;\n x1: number;\n y1: number;\n /** Thickness, in pixels */\n width: number;\n color0: string;\n color1: string;\n /** Opacity while the link (or one of its `also` items) is hovered */\n activeAlpha?: number;\n}\n\n/**\n * Chord ribbon: the source arc (s0 to s1) and the target arc (t0 to t1) at\n * radius `r`, joined by quadratic curves through the center, filled with a\n * gradient from `color0` to `color1`; `head` > 0 replaces the target arc with\n * an arrowhead of that length\n */\nexport interface RibbonNode extends NodeBase {\n kind: \"ribbon\";\n cx: number;\n cy: number;\n r: number;\n /** Canvas angles (radians, clockwise from 3 o'clock) */\n s0: number;\n s1: number;\n t0: number;\n t1: number;\n /** Arrowhead length, in pixels (0 = none) */\n head: number;\n color0: string;\n color1: string;\n /** Opacity while the ribbon (or one of its `also` items) is hovered */\n activeAlpha?: number;\n}\n\n/** Radar: dashed guide from the center to the hovered indicator */\nexport interface GuideNode extends NodeBase {\n kind: \"guide\";\n cx: number;\n cy: number;\n /** End of each spoke */\n ends: [number, number][];\n color: string;\n}\n\nexport type ShapeNode =\n | SectorNode\n | PolygonNode\n | RectNode\n | ArcNode\n | CircleNode\n | LineNode\n | TextNode\n | GuideNode\n | LinkNode\n | RibbonNode;\n\n/** A row of the default tooltip */\nexport interface ShapeTooltipRow {\n name: string;\n value: string;\n color?: string;\n strong?: boolean;\n}\n\n/** Something the pointer / keyboard can focus */\nexport interface ShapeItem {\n index: number;\n name: string;\n value: number;\n percent: number;\n /** `percent` formatted for screen readers (`percentFormat`) */\n share?: string;\n color: string;\n path?: string[];\n /** Anchor of the tooltip when focused with the keyboard */\n x: number;\n y: number;\n /** Rows of the default tooltip */\n rows: ShapeTooltipRow[];\n /** Radar: one entry per indicator */\n indicators?: {\n name: string;\n value: number;\n percent: number;\n x: number;\n y: number;\n }[];\n /** Extra fields of the hover event (calendar date, sankey link / chord ribbon ends) */\n event?: Pick<ShapeHoverEvent, \"date\" | \"source\" | \"target\" | \"reverseValue\">;\n /** Sunburst: path focused when the item is activated (click, Enter) */\n drill?: string[];\n}\n\n/** What is hovered: an item (and a radar indicator) */\nexport interface ShapeHover {\n index: number;\n indicator?: number;\n}\n\nexport interface ShapeLegendEntry {\n /** Index passed to `toggle` */\n index: number;\n name: string;\n color: string;\n hidden: boolean;\n}\n\nexport interface ShapeScene {\n type: ShapeChartType;\n /** Size of the whole drawing */\n width: number;\n height: number;\n nodes: ShapeNode[];\n /** Focusable items, in keyboard order */\n items: ShapeItem[];\n /** Opacity of the other marks while one is hovered */\n dim: number;\n /** Entry animation of funnels / treemaps: fade and scale around a point */\n enter?: { alpha: number; scale: number; cx: number; cy: number };\n /**\n * Arrow-key moves in a grid of items (calendar heatmap), in positions of\n * `items`: `next` for Left / Right, `down` for Up / Down; no wrapping\n */\n steps?: { next: number; down: number };\n /** Radar geometry used by hit testing (and to keep the tooltip off the labels) */\n radar?: {\n cx: number;\n cy: number;\n radius: number;\n angles: number[];\n series: { index: number; points: number[] }[];\n /** Boxes of the indicator labels */\n labels?: ShapeRect[];\n };\n /** No data to draw (placeholder shown) */\n empty: boolean;\n /** Built-in texts of the chart's locale (accessible descriptions) */\n labels?: ShapeChartLabels;\n /** Resolved locale of the chart */\n locale?: string;\n}\n\n/** Measures a text in a CSS font */\nexport type MeasureText = (text: string, font: string) => number;\n\n/** Approximate width of a text without a canvas (tests, SSR) */\nexport const estimateText: MeasureText = (text, f) => {\n const size = /(\\d+(?:\\.\\d+)?)px/.exec(f);\n return text.length * (size ? Number(size[1]) : 12) * 0.6;\n};\n\n/** What the layouts of every type get */\nexport interface LayoutContext {\n theme: ChartTheme;\n measure: MeasureText;\n hidden: ReadonlySet<number>;\n /** Entry progress, eased (1 when done) */\n enter: number;\n /** Displayed (animated) value of a key */\n value(key: string, target: number): number;\n format(value: number): string;\n /** Formats a share (0-1): `percentFormat` or a locale percent with one decimal */\n percent(share: number): string;\n /** Built-in texts (locale and `texts` overrides) */\n labels: ShapeChartLabels;\n /** Resolved locale */\n locale: string;\n /** Color of the `i`-th mark (custom `color` or the palette) */\n color(css: string | undefined, i: number): Rgba;\n /** Drawing area, padding excluded */\n area: ShapeRect;\n /** Sunburst: names from the root to the focused node */\n focus: readonly string[];\n}\n\nexport type LayoutResult = Omit<\n ShapeScene,\n \"type\" | \"width\" | \"height\" | \"labels\" | \"locale\"\n>;\n\nexport const clamp = (v: number, lo: number, hi: number) =>\n v < lo ? lo : v > hi ? hi : v;\n\n/** Non-negative finite number */\nexport const positive = (v: number | undefined) =>\n typeof v === \"number\" && Number.isFinite(v) && v > 0 ? v : 0;\n\nexport const finite = (v: number | undefined, fallback = 0) =>\n typeof v === \"number\" && Number.isFinite(v) ? v : fallback;\n\nexport const sum = (values: readonly number[]) => {\n let s = 0;\n for (const v of values) s += v;\n return s;\n};\n\nexport const easeOutCubic = (t: number) => 1 - Math.pow(1 - clamp(t, 0, 1), 3);\n\n/** Angle brought into (-π/2, π/2] so that text rotated by it reads left to right */\nexport const upright = (a: number) => {\n let r = a % TAU;\n if (r > Math.PI) r -= TAU;\n if (r <= -Math.PI) r += TAU;\n if (r > Math.PI / 2) r -= Math.PI;\n else if (r <= -Math.PI / 2) r += Math.PI;\n return r;\n};\n\nexport const inset = (rect: ShapeRect, padding?: ChartPadding): ShapeRect => {\n const top = padding?.top ?? 8;\n const right = padding?.right ?? 8;\n const bottom = padding?.bottom ?? 8;\n const left = padding?.left ?? 8;\n return {\n x: rect.x + left,\n y: rect.y + top,\n width: Math.max(0, rect.width - left - right),\n height: Math.max(0, rect.height - top - bottom),\n };\n};\n\n/** Shortens a text with an ellipsis so it fits in `max` pixels (\"\" if nothing fits) */\nexport const ellipsize = (\n text: string,\n max: number,\n font: string,\n measure: MeasureText,\n): string => {\n if (measure(text, font) <= max) return text;\n if (measure(\"…\", font) > max) return \"\";\n let lo = 0;\n let hi = text.length;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (measure(text.slice(0, mid) + \"…\", font) <= max) lo = mid;\n else hi = mid - 1;\n }\n return lo ? text.slice(0, lo).trimEnd() + \"…\" : \"\";\n};\n\n/** Characters that must not start a line (closing brackets and punctuation) */\nconst NO_LINE_START = /^[)\\]}、。,.:;!?)」』】》〉,.:;!?%…]/;\n\n/** Greedy line breaking at `max` pixels, without a line limit */\nconst breakLines = (\n text: string,\n max: number,\n font: string,\n measure: MeasureText,\n): string[] | null => {\n const lines: string[] = [];\n let rest = text.trim();\n while (rest) {\n if (measure(rest, font) <= max) {\n lines.push(rest);\n break;\n }\n // longest prefix that fits\n let lo = 0;\n let hi = rest.length;\n while (lo < hi) {\n const mid = (lo + hi + 1) >> 1;\n if (measure(rest.slice(0, mid), font) <= max) lo = mid;\n else hi = mid - 1;\n }\n if (!lo) return null;\n let cut = lo;\n if (rest[lo] !== \" \") {\n const space = rest.lastIndexOf(\" \", lo);\n if (space > lo * 0.4) cut = space;\n // keep closing punctuation with the word before it\n else while (cut > 1 && NO_LINE_START.test(rest.slice(cut))) cut--;\n }\n lines.push(rest.slice(0, cut).trimEnd());\n rest = rest.slice(cut).trimStart();\n }\n return lines;\n};\n\n/**\n * Breaks a text into at most `maxLines` lines of `max` pixels, at spaces when\n * possible (anywhere otherwise, e.g. CJK, never before closing punctuation);\n * a text that fits is balanced across its lines, one that does not ends the\n * last line with an ellipsis\n */\nexport const wrapText = (\n text: string,\n max: number,\n font: string,\n measure: MeasureText,\n maxLines = 2,\n): string[] => {\n const whole = text.trim();\n if (!whole || maxLines < 1) return [];\n const lines = breakLines(whole, max, font, measure);\n if (!lines) {\n const last = ellipsize(whole, max, font, measure);\n return last ? [last] : [];\n }\n if (lines.length > maxLines) {\n const head = lines.slice(0, maxLines - 1);\n // the text after the kept lines (each line is a prefix of the rest)\n let rest = whole;\n for (const line of head) rest = rest.slice(line.length).trimStart();\n const tail = ellipsize(rest, max, font, measure);\n return tail ? [...head, tail] : head;\n }\n if (lines.length < 2) return lines;\n // balance: the narrowest width that still needs as many lines\n const total = measure(whole, font);\n const lo = total / lines.length;\n for (let k = 0; k <= 8; k++) {\n const width = lo + ((max - lo) * k) / 8;\n const balanced = breakLines(whole, width, font, measure);\n if (balanced && balanced.length <= lines.length) return balanced;\n }\n return lines;\n};\n\n/** Stable keys of named values: the name, `name#2` for duplicates */\nexport const uniqueKeys = (names: readonly string[]) => {\n const seen = new Map<string, number>();\n return names.map((name) => {\n const n = (seen.get(name) ?? 0) + 1;\n seen.set(name, n);\n return n === 1 ? name : `${name}#${n}`;\n });\n};\n\nconst LIGHT_INK: Rgba = [1, 1, 1, 0.96];\nconst DARK_INK: Rgba = [15 / 255, 23 / 255, 42 / 255, 0.88];\n\nconst channel = (v: number) =>\n v <= 0.04045 ? v / 12.92 : Math.pow((v + 0.055) / 1.055, 2.4);\n\n/** WCAG relative luminance of an opaque color */\nexport const relativeLuminance = (c: Rgba) =>\n 0.2126 * channel(c[0]) + 0.7152 * channel(c[1]) + 0.0722 * channel(c[2]);\n\n/** `top` composited over the opaque `bottom` */\nexport const over = (top: Rgba, bottom: Rgba): Rgba => {\n const a = clamp(top[3], 0, 1);\n return [\n top[0] * a + bottom[0] * (1 - a),\n top[1] * a + bottom[1] * (1 - a),\n top[2] * a + bottom[2] * (1 - a),\n 1,\n ];\n};\n\n/** WCAG contrast ratio (1-21) of `ink` drawn on the opaque `fill` */\nexport const contrastRatio = (ink: Rgba, fill: Rgba) => {\n const a = relativeLuminance(over(ink, fill));\n const b = relativeLuminance(fill);\n return (Math.max(a, b) + 0.05) / (Math.min(a, b) + 0.05);\n};\n\nconst WHITE: Rgba = [1, 1, 1, 1];\n\n/** Light or dark ink, whichever contrasts more with the fill, and its contrast */\nexport const inkOn = (\n fill: Rgba,\n backdrop: Rgba = WHITE,\n): { ink: Rgba; css: string; contrast: number } => {\n const solid = over(fill, over(backdrop, WHITE));\n const light = contrastRatio(LIGHT_INK, solid);\n const dark = contrastRatio(DARK_INK, solid);\n return light >= dark\n ? { ink: LIGHT_INK, css: toCss(LIGHT_INK), contrast: light }\n : { ink: DARK_INK, css: toCss(DARK_INK), contrast: dark };\n};\n\n/** Readable text color on a fill (WCAG contrast) */\nexport const textOn = (fill: Rgba, backdrop?: Rgba) =>\n inkOn(fill, backdrop).css;\n\n/**\n * Fill adjusted so that its best ink reaches `target` contrast: darkened\n * under white text, lightened under dark text (at most `limit` of the way)\n */\nexport const readableFill = (fill: Rgba, target = 4.5, limit = 0.3): Rgba => {\n let best = inkOn(fill);\n if (best.contrast >= target) return fill;\n const toward: Rgba =\n best.ink === LIGHT_INK ? [0, 0, 0, fill[3]] : [1, 1, 1, fill[3]];\n for (let t = 0.04; t <= limit + 1e-9; t += 0.04) {\n const next = mix(fill, toward, t);\n best = inkOn(next);\n if (best.contrast >= target) return next;\n }\n return mix(fill, toward, limit);\n};\n\n/** Resolves a custom color with the theme resolver (static parsing otherwise) */\nexport const resolveWith = (\n theme: ChartTheme,\n css: string | undefined,\n fallback: Rgba,\n): Rgba => {\n if (!css) return fallback;\n return theme.resolve\n ? theme.resolve(css, fallback)\n : (parseColor(css) ?? fallback);\n};\n\n/** Placeholder of a chart without data: a muted ring and \"No data\" (localized) */\nexport const emptyLayout = (c: LayoutContext): LayoutResult => {\n const { area, theme } = c;\n const cx = area.x + area.width / 2;\n const cy = area.y + area.height / 2;\n const r1 = Math.max(0, Math.min(area.width, area.height) / 2 - 6);\n return {\n nodes: [\n {\n kind: \"sector\",\n cx,\n cy,\n r0: r1 * 0.66,\n r1,\n a0: 0,\n a1: TAU,\n pad: 0,\n corner: 0,\n fill: toCss(theme.grid, 0.8),\n },\n {\n kind: \"text\",\n x: cx,\n y: cy,\n text: c.labels.noData,\n font: font(theme, 12),\n color: toCss(theme.textMuted),\n align: \"center\",\n baseline: \"middle\",\n },\n ],\n items: [],\n dim: 1,\n empty: true,\n };\n};\n"],"mappings":";;;AAcA,IAAaA,IAAM,KAAK,KAAK,GA+RhBC,KAA6B,GAAM,MAAM;CACpD,IAAMC,IAAO,oBAAoB,KAAKC,CAAC;CACvC,OAAOC,EAAK,UAAUF,IAAO,OAAOA,EAAK,EAAE,IAAI,MAAM;AACvD,GA+BaG,KAAS,GAAW,GAAY,MAC3CC,IAAIC,IAAKA,IAAKD,IAAIE,IAAKA,IAAKF,GAGjBG,KAAY,MACvB,OAAOH,KAAM,YAAY,OAAO,SAASA,CAAC,KAAKA,IAAI,IAAIA,IAAI,GAEhDI,KAAU,GAAuB,IAAW,MACvD,OAAOJ,KAAM,YAAY,OAAO,SAASA,CAAC,IAAIA,IAAIK,GAEvCC,KAAO,MAA8B;CAChD,IAAIC,IAAI;CACR,KAAK,IAAMP,KAAKQ,GAAQ,KAAKR;CAC7B,OAAOO;AACT,GAEaE,KAAgB,MAAc,KAAa,IAAIV,EAAMW,GAAG,GAAG,CAAC,MAAG,GAG/DC,KAAW,MAAc;CACpC,IAAIC,IAAIC,IAAInB;CAKZ,OAJIkB,IAAI,KAAK,OAAI,KAAKlB,IAClBkB,KAAK,CAAC,KAAK,OAAI,KAAKlB,IACpBkB,IAAI,KAAK,KAAK,IAAG,KAAK,KAAK,KACtBA,KAAK,CAAC,KAAK,KAAK,MAAG,KAAK,KAAK,KAC/BA;AAC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