@voila.dev/chart 4.0.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 (377) hide show
  1. package/README.md +85 -0
  2. package/dist/brush/brush-layer.d.ts +16 -0
  3. package/dist/brush/brush-layer.d.ts.map +1 -0
  4. package/dist/brush/brush-layer.js +137 -0
  5. package/dist/brush/brush-layer.js.map +7 -0
  6. package/dist/brush/index.d.ts +10 -0
  7. package/dist/brush/index.d.ts.map +1 -0
  8. package/dist/brush/index.js +8 -0
  9. package/dist/brush/index.js.map +7 -0
  10. package/dist/canvas/canvas-renderer.d.ts +11 -0
  11. package/dist/canvas/canvas-renderer.d.ts.map +1 -0
  12. package/dist/canvas/canvas-renderer.js +49 -0
  13. package/dist/canvas/canvas-renderer.js.map +7 -0
  14. package/dist/canvas/index.d.ts +2 -0
  15. package/dist/canvas/index.d.ts.map +1 -0
  16. package/dist/canvas/index.js +5 -0
  17. package/dist/canvas/index.js.map +7 -0
  18. package/dist/canvas/paint-scene.d.ts +4 -0
  19. package/dist/canvas/paint-scene.d.ts.map +1 -0
  20. package/dist/canvas/paint-scene.js +130 -0
  21. package/dist/canvas/paint-scene.js.map +7 -0
  22. package/dist/canvas/resolve-color.d.ts +18 -0
  23. package/dist/canvas/resolve-color.d.ts.map +1 -0
  24. package/dist/canvas/resolve-color.js +52 -0
  25. package/dist/canvas/resolve-color.js.map +7 -0
  26. package/dist/contour/density.d.ts +20 -0
  27. package/dist/contour/density.d.ts.map +1 -0
  28. package/dist/contour/density.js +59 -0
  29. package/dist/contour/density.js.map +7 -0
  30. package/dist/contour/index.d.ts +2 -0
  31. package/dist/contour/index.d.ts.map +1 -0
  32. package/dist/contour/index.js +5 -0
  33. package/dist/contour/index.js.map +7 -0
  34. package/dist/core/channel.d.ts +11 -0
  35. package/dist/core/channel.d.ts.map +1 -0
  36. package/dist/core/channel.js +44 -0
  37. package/dist/core/channel.js.map +7 -0
  38. package/dist/core/compile.d.ts +22 -0
  39. package/dist/core/compile.d.ts.map +1 -0
  40. package/dist/core/compile.js +295 -0
  41. package/dist/core/compile.js.map +7 -0
  42. package/dist/core/define-chart.d.ts +96 -0
  43. package/dist/core/define-chart.d.ts.map +1 -0
  44. package/dist/core/define-chart.js +7 -0
  45. package/dist/core/define-chart.js.map +7 -0
  46. package/dist/core/facet.d.ts +7 -0
  47. package/dist/core/facet.d.ts.map +1 -0
  48. package/dist/core/facet.js +134 -0
  49. package/dist/core/facet.js.map +7 -0
  50. package/dist/core/format.d.ts +37 -0
  51. package/dist/core/format.d.ts.map +1 -0
  52. package/dist/core/format.js +108 -0
  53. package/dist/core/format.js.map +7 -0
  54. package/dist/core/guides/axes.d.ts +25 -0
  55. package/dist/core/guides/axes.d.ts.map +1 -0
  56. package/dist/core/guides/axes.js +204 -0
  57. package/dist/core/guides/axes.js.map +7 -0
  58. package/dist/core/marks/area.d.ts +23 -0
  59. package/dist/core/marks/area.d.ts.map +1 -0
  60. package/dist/core/marks/area.js +187 -0
  61. package/dist/core/marks/area.js.map +7 -0
  62. package/dist/core/marks/bar.d.ts +26 -0
  63. package/dist/core/marks/bar.d.ts.map +1 -0
  64. package/dist/core/marks/bar.js +200 -0
  65. package/dist/core/marks/bar.js.map +7 -0
  66. package/dist/core/marks/cell.d.ts +16 -0
  67. package/dist/core/marks/cell.d.ts.map +1 -0
  68. package/dist/core/marks/cell.js +98 -0
  69. package/dist/core/marks/cell.js.map +7 -0
  70. package/dist/core/marks/dot.d.ts +17 -0
  71. package/dist/core/marks/dot.d.ts.map +1 -0
  72. package/dist/core/marks/dot.js +125 -0
  73. package/dist/core/marks/dot.js.map +7 -0
  74. package/dist/core/marks/funnel-layout.d.ts +37 -0
  75. package/dist/core/marks/funnel-layout.d.ts.map +1 -0
  76. package/dist/core/marks/funnel-layout.js +61 -0
  77. package/dist/core/marks/funnel-layout.js.map +7 -0
  78. package/dist/core/marks/funnel.d.ts +19 -0
  79. package/dist/core/marks/funnel.d.ts.map +1 -0
  80. package/dist/core/marks/funnel.js +143 -0
  81. package/dist/core/marks/funnel.js.map +7 -0
  82. package/dist/core/marks/line.d.ts +17 -0
  83. package/dist/core/marks/line.d.ts.map +1 -0
  84. package/dist/core/marks/line.js +150 -0
  85. package/dist/core/marks/line.js.map +7 -0
  86. package/dist/core/marks/polar.d.ts +61 -0
  87. package/dist/core/marks/polar.d.ts.map +1 -0
  88. package/dist/core/marks/polar.js +436 -0
  89. package/dist/core/marks/polar.js.map +7 -0
  90. package/dist/core/marks/rect.d.ts +22 -0
  91. package/dist/core/marks/rect.d.ts.map +1 -0
  92. package/dist/core/marks/rect.js +119 -0
  93. package/dist/core/marks/rect.js.map +7 -0
  94. package/dist/core/marks/rule.d.ts +17 -0
  95. package/dist/core/marks/rule.d.ts.map +1 -0
  96. package/dist/core/marks/rule.js +73 -0
  97. package/dist/core/marks/rule.js.map +7 -0
  98. package/dist/core/marks/shared.d.ts +41 -0
  99. package/dist/core/marks/shared.d.ts.map +1 -0
  100. package/dist/core/marks/shared.js +74 -0
  101. package/dist/core/marks/shared.js.map +7 -0
  102. package/dist/core/marks/stack.d.ts +13 -0
  103. package/dist/core/marks/stack.d.ts.map +1 -0
  104. package/dist/core/marks/stack.js +28 -0
  105. package/dist/core/marks/stack.js.map +7 -0
  106. package/dist/core/marks/stats/difference.d.ts +20 -0
  107. package/dist/core/marks/stats/difference.d.ts.map +1 -0
  108. package/dist/core/marks/stats/difference.js +168 -0
  109. package/dist/core/marks/stats/difference.js.map +7 -0
  110. package/dist/core/marks/stats/distribution.d.ts +41 -0
  111. package/dist/core/marks/stats/distribution.d.ts.map +1 -0
  112. package/dist/core/marks/stats/distribution.js +354 -0
  113. package/dist/core/marks/stats/distribution.js.map +7 -0
  114. package/dist/core/marks/stats/dodge.d.ts +16 -0
  115. package/dist/core/marks/stats/dodge.d.ts.map +1 -0
  116. package/dist/core/marks/stats/dodge.js +104 -0
  117. package/dist/core/marks/stats/dodge.js.map +7 -0
  118. package/dist/core/marks/stats/hexbin.d.ts +26 -0
  119. package/dist/core/marks/stats/hexbin.d.ts.map +1 -0
  120. package/dist/core/marks/stats/hexbin.js +113 -0
  121. package/dist/core/marks/stats/hexbin.js.map +7 -0
  122. package/dist/core/marks/stats/histogram.d.ts +27 -0
  123. package/dist/core/marks/stats/histogram.d.ts.map +1 -0
  124. package/dist/core/marks/stats/histogram.js +70 -0
  125. package/dist/core/marks/stats/histogram.js.map +7 -0
  126. package/dist/core/marks/stats/regression.d.ts +13 -0
  127. package/dist/core/marks/stats/regression.d.ts.map +1 -0
  128. package/dist/core/marks/stats/regression.js +80 -0
  129. package/dist/core/marks/stats/regression.js.map +7 -0
  130. package/dist/core/marks/stats/statistics.d.ts +34 -0
  131. package/dist/core/marks/stats/statistics.d.ts.map +1 -0
  132. package/dist/core/marks/stats/statistics.js +111 -0
  133. package/dist/core/marks/stats/statistics.js.map +7 -0
  134. package/dist/core/marks/stats/waffle.d.ts +18 -0
  135. package/dist/core/marks/stats/waffle.d.ts.map +1 -0
  136. package/dist/core/marks/stats/waffle.js +117 -0
  137. package/dist/core/marks/stats/waffle.js.map +7 -0
  138. package/dist/core/marks/text.d.ts +19 -0
  139. package/dist/core/marks/text.d.ts.map +1 -0
  140. package/dist/core/marks/text.js +60 -0
  141. package/dist/core/marks/text.js.map +7 -0
  142. package/dist/core/motion/tween.d.ts +6 -0
  143. package/dist/core/motion/tween.d.ts.map +1 -0
  144. package/dist/core/motion/tween.js +98 -0
  145. package/dist/core/motion/tween.js.map +7 -0
  146. package/dist/core/nearest.d.ts +25 -0
  147. package/dist/core/nearest.d.ts.map +1 -0
  148. package/dist/core/nearest.js +151 -0
  149. package/dist/core/nearest.js.map +7 -0
  150. package/dist/core/paths.d.ts +65 -0
  151. package/dist/core/paths.d.ts.map +1 -0
  152. package/dist/core/paths.js +192 -0
  153. package/dist/core/paths.js.map +7 -0
  154. package/dist/core/scales/color.d.ts +11 -0
  155. package/dist/core/scales/color.d.ts.map +1 -0
  156. package/dist/core/scales/color.js +35 -0
  157. package/dist/core/scales/color.js.map +7 -0
  158. package/dist/core/scales/continuous.d.ts +18 -0
  159. package/dist/core/scales/continuous.d.ts.map +1 -0
  160. package/dist/core/scales/continuous.js +82 -0
  161. package/dist/core/scales/continuous.js.map +7 -0
  162. package/dist/core/scales/discrete.d.ts +22 -0
  163. package/dist/core/scales/discrete.d.ts.map +1 -0
  164. package/dist/core/scales/discrete.js +103 -0
  165. package/dist/core/scales/discrete.js.map +7 -0
  166. package/dist/core/scales/resolve.d.ts +18 -0
  167. package/dist/core/scales/resolve.d.ts.map +1 -0
  168. package/dist/core/scales/resolve.js +112 -0
  169. package/dist/core/scales/resolve.js.map +7 -0
  170. package/dist/core/scales/time.d.ts +4 -0
  171. package/dist/core/scales/time.d.ts.map +1 -0
  172. package/dist/core/scales/time.js +140 -0
  173. package/dist/core/scales/time.js.map +7 -0
  174. package/dist/core/text.d.ts +3 -0
  175. package/dist/core/text.d.ts.map +1 -0
  176. package/dist/core/text.js +29 -0
  177. package/dist/core/text.js.map +7 -0
  178. package/dist/core/theme.d.ts +8 -0
  179. package/dist/core/theme.d.ts.map +1 -0
  180. package/dist/core/theme.js +21 -0
  181. package/dist/core/theme.js.map +7 -0
  182. package/dist/core/ticks.d.ts +27 -0
  183. package/dist/core/ticks.d.ts.map +1 -0
  184. package/dist/core/ticks.js +76 -0
  185. package/dist/core/ticks.js.map +7 -0
  186. package/dist/core/types.d.ts +305 -0
  187. package/dist/core/types.d.ts.map +1 -0
  188. package/dist/core/types.js +1 -0
  189. package/dist/core/types.js.map +7 -0
  190. package/dist/force/force.d.ts +30 -0
  191. package/dist/force/force.d.ts.map +1 -0
  192. package/dist/force/force.js +143 -0
  193. package/dist/force/force.js.map +7 -0
  194. package/dist/force/index.d.ts +2 -0
  195. package/dist/force/index.d.ts.map +1 -0
  196. package/dist/force/index.js +7 -0
  197. package/dist/force/index.js.map +7 -0
  198. package/dist/geo/geo.d.ts +59 -0
  199. package/dist/geo/geo.d.ts.map +1 -0
  200. package/dist/geo/geo.js +231 -0
  201. package/dist/geo/geo.js.map +7 -0
  202. package/dist/geo/index.d.ts +2 -0
  203. package/dist/geo/index.d.ts.map +1 -0
  204. package/dist/geo/index.js +13 -0
  205. package/dist/geo/index.js.map +7 -0
  206. package/dist/hierarchy/hierarchy.d.ts +24 -0
  207. package/dist/hierarchy/hierarchy.d.ts.map +1 -0
  208. package/dist/hierarchy/hierarchy.js +279 -0
  209. package/dist/hierarchy/hierarchy.js.map +7 -0
  210. package/dist/hierarchy/index.d.ts +2 -0
  211. package/dist/hierarchy/index.d.ts.map +1 -0
  212. package/dist/hierarchy/index.js +11 -0
  213. package/dist/hierarchy/index.js.map +7 -0
  214. package/dist/index.d.ts +29 -0
  215. package/dist/index.d.ts.map +1 -0
  216. package/dist/index.js +96 -0
  217. package/dist/index.js.map +7 -0
  218. package/dist/react/brush-contract.d.ts +23 -0
  219. package/dist/react/brush-contract.d.ts.map +1 -0
  220. package/dist/react/brush-contract.js +7 -0
  221. package/dist/react/brush-contract.js.map +7 -0
  222. package/dist/react/chart-data-table.d.ts +18 -0
  223. package/dist/react/chart-data-table.d.ts.map +1 -0
  224. package/dist/react/chart-data-table.js +55 -0
  225. package/dist/react/chart-data-table.js.map +7 -0
  226. package/dist/react/chart-legend.d.ts +17 -0
  227. package/dist/react/chart-legend.d.ts.map +1 -0
  228. package/dist/react/chart-legend.js +126 -0
  229. package/dist/react/chart-legend.js.map +7 -0
  230. package/dist/react/chart-tooltip.d.ts +18 -0
  231. package/dist/react/chart-tooltip.d.ts.map +1 -0
  232. package/dist/react/chart-tooltip.js +95 -0
  233. package/dist/react/chart-tooltip.js.map +7 -0
  234. package/dist/react/chart.d.ts +45 -0
  235. package/dist/react/chart.d.ts.map +1 -0
  236. package/dist/react/chart.js +383 -0
  237. package/dist/react/chart.js.map +7 -0
  238. package/dist/react/focus-overlay.d.ts +14 -0
  239. package/dist/react/focus-overlay.d.ts.map +1 -0
  240. package/dist/react/focus-overlay.js +147 -0
  241. package/dist/react/focus-overlay.js.map +7 -0
  242. package/dist/react/index.d.ts +7 -0
  243. package/dist/react/index.d.ts.map +1 -0
  244. package/dist/react/index.js +11 -0
  245. package/dist/react/index.js.map +7 -0
  246. package/dist/react/messages.d.ts +16 -0
  247. package/dist/react/messages.d.ts.map +1 -0
  248. package/dist/react/messages.js +33 -0
  249. package/dist/react/messages.js.map +7 -0
  250. package/dist/react/renderer.d.ts +14 -0
  251. package/dist/react/renderer.d.ts.map +1 -0
  252. package/dist/react/renderer.js +1 -0
  253. package/dist/react/renderer.js.map +7 -0
  254. package/dist/react/sr-only.d.ts +4 -0
  255. package/dist/react/sr-only.d.ts.map +1 -0
  256. package/dist/react/sr-only.js +15 -0
  257. package/dist/react/sr-only.js.map +7 -0
  258. package/dist/react/svg-renderer.d.ts +4 -0
  259. package/dist/react/svg-renderer.d.ts.map +1 -0
  260. package/dist/react/svg-renderer.js +20 -0
  261. package/dist/react/svg-renderer.js.map +7 -0
  262. package/dist/react/svg-scene.d.ts +8 -0
  263. package/dist/react/svg-scene.d.ts.map +1 -0
  264. package/dist/react/svg-scene.js +121 -0
  265. package/dist/react/svg-scene.js.map +7 -0
  266. package/dist/react/use-animated-scene.d.ts +10 -0
  267. package/dist/react/use-animated-scene.d.ts.map +1 -0
  268. package/dist/react/use-animated-scene.js +41 -0
  269. package/dist/react/use-animated-scene.js.map +7 -0
  270. package/dist/react/use-chart-focus.d.ts +29 -0
  271. package/dist/react/use-chart-focus.d.ts.map +1 -0
  272. package/dist/react/use-chart-focus.js +180 -0
  273. package/dist/react/use-chart-focus.js.map +7 -0
  274. package/dist/react/use-chart-width.d.ts +12 -0
  275. package/dist/react/use-chart-width.d.ts.map +1 -0
  276. package/dist/react/use-chart-width.js +23 -0
  277. package/dist/react/use-chart-width.js.map +7 -0
  278. package/dist/react/use-chart-zoom.d.ts +13 -0
  279. package/dist/react/use-chart-zoom.d.ts.map +1 -0
  280. package/dist/react/use-chart-zoom.js +52 -0
  281. package/dist/react/use-chart-zoom.js.map +7 -0
  282. package/dist/react/use-text-measurer.d.ts +8 -0
  283. package/dist/react/use-text-measurer.d.ts.map +1 -0
  284. package/dist/react/use-text-measurer.js +44 -0
  285. package/dist/react/use-text-measurer.js.map +7 -0
  286. package/dist/sankey/index.d.ts +2 -0
  287. package/dist/sankey/index.d.ts.map +1 -0
  288. package/dist/sankey/index.js +7 -0
  289. package/dist/sankey/index.js.map +7 -0
  290. package/dist/sankey/sankey.d.ts +29 -0
  291. package/dist/sankey/sankey.d.ts.map +1 -0
  292. package/dist/sankey/sankey.js +127 -0
  293. package/dist/sankey/sankey.js.map +7 -0
  294. package/dist/voronoi/index.d.ts +2 -0
  295. package/dist/voronoi/index.d.ts.map +1 -0
  296. package/dist/voronoi/index.js +5 -0
  297. package/dist/voronoi/index.js.map +7 -0
  298. package/dist/voronoi/voronoi.d.ts +16 -0
  299. package/dist/voronoi/voronoi.d.ts.map +1 -0
  300. package/dist/voronoi/voronoi.js +62 -0
  301. package/dist/voronoi/voronoi.js.map +7 -0
  302. package/package.json +74 -0
  303. package/src/brush/brush-layer.tsx +174 -0
  304. package/src/brush/index.ts +14 -0
  305. package/src/canvas/canvas-renderer.tsx +56 -0
  306. package/src/canvas/index.ts +1 -0
  307. package/src/canvas/paint-scene.ts +152 -0
  308. package/src/canvas/resolve-color.ts +65 -0
  309. package/src/contour/density.ts +90 -0
  310. package/src/contour/index.ts +1 -0
  311. package/src/core/channel.ts +53 -0
  312. package/src/core/compile.ts +436 -0
  313. package/src/core/define-chart.ts +128 -0
  314. package/src/core/facet.ts +189 -0
  315. package/src/core/format.ts +163 -0
  316. package/src/core/guides/axes.ts +283 -0
  317. package/src/core/marks/area.ts +238 -0
  318. package/src/core/marks/bar.ts +278 -0
  319. package/src/core/marks/cell.ts +123 -0
  320. package/src/core/marks/dot.ts +157 -0
  321. package/src/core/marks/funnel-layout.ts +113 -0
  322. package/src/core/marks/funnel.ts +172 -0
  323. package/src/core/marks/line.ts +206 -0
  324. package/src/core/marks/polar.ts +568 -0
  325. package/src/core/marks/rect.ts +156 -0
  326. package/src/core/marks/rule.ts +104 -0
  327. package/src/core/marks/shared.ts +134 -0
  328. package/src/core/marks/stack.ts +42 -0
  329. package/src/core/marks/stats/difference.ts +205 -0
  330. package/src/core/marks/stats/distribution.ts +425 -0
  331. package/src/core/marks/stats/dodge.ts +136 -0
  332. package/src/core/marks/stats/hexbin.ts +152 -0
  333. package/src/core/marks/stats/histogram.ts +108 -0
  334. package/src/core/marks/stats/regression.ts +108 -0
  335. package/src/core/marks/stats/statistics.ts +153 -0
  336. package/src/core/marks/stats/waffle.ts +141 -0
  337. package/src/core/marks/text.ts +97 -0
  338. package/src/core/motion/tween.ts +131 -0
  339. package/src/core/nearest.ts +223 -0
  340. package/src/core/paths.ts +323 -0
  341. package/src/core/scales/color.ts +51 -0
  342. package/src/core/scales/continuous.ts +111 -0
  343. package/src/core/scales/discrete.ts +156 -0
  344. package/src/core/scales/resolve.ts +158 -0
  345. package/src/core/scales/time.ts +180 -0
  346. package/src/core/text.ts +42 -0
  347. package/src/core/theme.ts +26 -0
  348. package/src/core/ticks.ts +118 -0
  349. package/src/core/types.ts +358 -0
  350. package/src/force/force.ts +200 -0
  351. package/src/force/index.ts +6 -0
  352. package/src/geo/geo.ts +346 -0
  353. package/src/geo/index.ts +10 -0
  354. package/src/hierarchy/hierarchy.ts +377 -0
  355. package/src/hierarchy/index.ts +6 -0
  356. package/src/index.ts +70 -0
  357. package/src/react/brush-contract.ts +35 -0
  358. package/src/react/chart-data-table.tsx +98 -0
  359. package/src/react/chart-legend.tsx +130 -0
  360. package/src/react/chart-tooltip.tsx +111 -0
  361. package/src/react/chart.tsx +489 -0
  362. package/src/react/focus-overlay.tsx +164 -0
  363. package/src/react/index.ts +9 -0
  364. package/src/react/messages.ts +49 -0
  365. package/src/react/renderer.ts +15 -0
  366. package/src/react/sr-only.ts +14 -0
  367. package/src/react/svg-renderer.tsx +18 -0
  368. package/src/react/svg-scene.tsx +146 -0
  369. package/src/react/use-animated-scene.ts +57 -0
  370. package/src/react/use-chart-focus.ts +245 -0
  371. package/src/react/use-chart-width.ts +27 -0
  372. package/src/react/use-chart-zoom.ts +67 -0
  373. package/src/react/use-text-measurer.ts +49 -0
  374. package/src/sankey/index.ts +6 -0
  375. package/src/sankey/sankey.ts +179 -0
  376. package/src/voronoi/index.ts +1 -0
  377. package/src/voronoi/voronoi.ts +84 -0
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/canvas/resolve-color.ts"],
4
+ "sourcesContent": ["/**\n * Canvas takes colours as computed values only: no `var()`, and `currentColor`\n * means black. A hidden probe inside the chart resolves each CSS colour\n * against the page, theme and inherited colour included; the answers are\n * cached until the theme can have changed.\n */\nexport interface ColorResolver {\n\treadonly resolve: (color: string) => string;\n\treadonly dispose: () => void;\n}\n\nexport function createColorResolver(host: HTMLElement): ColorResolver {\n\tconst probe = document.createElement(\"span\");\n\tprobe.setAttribute(\"aria-hidden\", \"true\");\n\tprobe.style.cssText =\n\t\t\"position:absolute;width:0;height:0;overflow:hidden;visibility:hidden\";\n\thost.append(probe);\n\tconst cache = new Map<string, string>();\n\treturn {\n\t\tresolve(color) {\n\t\t\tconst cached = cache.get(color);\n\t\t\tif (cached !== undefined) {\n\t\t\t\treturn cached;\n\t\t\t}\n\t\t\tprobe.style.color = \"\";\n\t\t\tprobe.style.color = color;\n\t\t\tconst resolved = getComputedStyle(probe).color || color;\n\t\t\tcache.set(color, resolved);\n\t\t\treturn resolved;\n\t\t},\n\t\tdispose() {\n\t\t\tprobe.remove();\n\t\t},\n\t};\n}\n\n/**\n * Calls `onChange` whenever the colours a chart resolved may be stale: a\n * class, style or theme attribute change on the root, a colour-scheme or\n * forced-colours switch.\n */\nexport function watchTheme(onChange: () => void): () => void {\n\tconst observer = new MutationObserver(onChange);\n\tfor (const node of [document.documentElement, document.body]) {\n\t\tif (node) {\n\t\t\tobserver.observe(node, {\n\t\t\t\tattributes: true,\n\t\t\t\tattributeFilter: [\"class\", \"style\", \"data-theme\"],\n\t\t\t});\n\t\t}\n\t}\n\tconst queries = [\n\t\t\"(prefers-color-scheme: dark)\",\n\t\t\"(forced-colors: active)\",\n\t].map((query) => window.matchMedia(query));\n\tfor (const query of queries) {\n\t\tquery.addEventListener(\"change\", onChange);\n\t}\n\treturn () => {\n\t\tobserver.disconnect();\n\t\tfor (const query of queries) {\n\t\t\tquery.removeEventListener(\"change\", onChange);\n\t\t}\n\t};\n}\n"],
5
+ "mappings": "AAWO,SAAS,oBAAoB,MAAkC;AACrE,QAAM,QAAQ,SAAS,cAAc,MAAM;AAC3C,QAAM,aAAa,eAAe,MAAM;AACxC,QAAM,MAAM,UACX;AACD,OAAK,OAAO,KAAK;AACjB,QAAM,QAAQ,oBAAI,IAAoB;AACtC,SAAO;AAAA,IACN,QAAQ,OAAO;AACd,YAAM,SAAS,MAAM,IAAI,KAAK;AAC9B,UAAI,WAAW,QAAW;AACzB,eAAO;AAAA,MACR;AACA,YAAM,MAAM,QAAQ;AACpB,YAAM,MAAM,QAAQ;AACpB,YAAM,WAAW,iBAAiB,KAAK,EAAE,SAAS;AAClD,YAAM,IAAI,OAAO,QAAQ;AACzB,aAAO;AAAA,IACR;AAAA,IACA,UAAU;AACT,YAAM,OAAO;AAAA,IACd;AAAA,EACD;AACD;AAOO,SAAS,WAAW,UAAkC;AAC5D,QAAM,WAAW,IAAI,iBAAiB,QAAQ;AAC9C,aAAW,QAAQ,CAAC,SAAS,iBAAiB,SAAS,IAAI,GAAG;AAC7D,QAAI,MAAM;AACT,eAAS,QAAQ,MAAM;AAAA,QACtB,YAAY;AAAA,QACZ,iBAAiB,CAAC,SAAS,SAAS,YAAY;AAAA,MACjD,CAAC;AAAA,IACF;AAAA,EACD;AACA,QAAM,UAAU;AAAA,IACf;AAAA,IACA;AAAA,EACD,EAAE,IAAI,CAAC,UAAU,OAAO,WAAW,KAAK,CAAC;AACzC,aAAW,SAAS,SAAS;AAC5B,UAAM,iBAAiB,UAAU,QAAQ;AAAA,EAC1C;AACA,SAAO,MAAM;AACZ,aAAS,WAAW;AACpB,eAAW,SAAS,SAAS;AAC5B,YAAM,oBAAoB,UAAU,QAAQ;AAAA,IAC7C;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,20 @@
1
+ import type { ChartAccessor, ChartMark, ChartValue } from "../core/types.js";
2
+ export interface Density2dOptions<TDatum> {
3
+ readonly id?: string;
4
+ readonly x: ChartAccessor<TDatum, ChartValue>;
5
+ readonly y: ChartAccessor<TDatum, ChartValue>;
6
+ /** Smoothing, in pixels. */
7
+ readonly bandwidth?: number;
8
+ /** How many density levels to draw. */
9
+ readonly thresholds?: number;
10
+ readonly fill?: string;
11
+ /** Outline the levels instead of filling them. */
12
+ readonly stroke?: boolean;
13
+ }
14
+ /**
15
+ * Where points crowd, as nested contours: the shape of a scatter too dense
16
+ * to read. Decorative on its own (the levels are not values a reader can
17
+ * visit), so draw the points too, or give the chart a description.
18
+ */
19
+ export declare function density2d<TDatum>(data: ReadonlyArray<TDatum>, options: Density2dOptions<TDatum>): ChartMark;
20
+ //# sourceMappingURL=density.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"density.d.ts","sourceRoot":"","sources":["../../src/contour/density.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACX,aAAa,EACb,SAAS,EACT,UAAU,EAEV,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,gBAAgB,CAAC,MAAM;IACvC,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC9C,QAAQ,CAAC,CAAC,EAAE,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAC9C,4BAA4B;IAC5B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,uCAAuC;IACvC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,kDAAkD;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAC/B,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,GAC/B,SAAS,CAyDX"}
@@ -0,0 +1,59 @@
1
+ import { contourDensity } from "d3-contour";
2
+ import { isPlaceable, readChannel } from "../core/channel.js";
3
+ import { markId, valueOn } from "../core/marks/shared.js";
4
+ import { multiPolygonPath } from "../core/paths.js";
5
+ function density2d(data, options) {
6
+ const xs = readChannel(data, options.x);
7
+ const ys = readChannel(data, options.y);
8
+ return {
9
+ id: options.id,
10
+ coordinate: "cartesian",
11
+ channels: {
12
+ x: { values: xs.filter(isPlaceable) },
13
+ y: { values: ys.filter(isPlaceable) }
14
+ },
15
+ render(context) {
16
+ const id = markId(options.id, "density2d", context);
17
+ const { x: xScale, y: yScale } = context.scales;
18
+ if (xScale === void 0 || yScale === void 0) {
19
+ return { nodes: [] };
20
+ }
21
+ const { plot } = context;
22
+ const pixels = [];
23
+ for (const [index, raw] of xs.entries()) {
24
+ const x = valueOn(xScale, raw);
25
+ const y = valueOn(yScale, ys[index]);
26
+ if (x !== void 0 && y !== void 0) {
27
+ pixels.push([xScale.center(x) - plot.x, yScale.center(y) - plot.y]);
28
+ }
29
+ }
30
+ const levels = contourDensity().x((pixel) => pixel[0]).y((pixel) => pixel[1]).size([
31
+ Math.max(1, Math.round(plot.width)),
32
+ Math.max(1, Math.round(plot.height))
33
+ ]).bandwidth(options.bandwidth ?? 20).thresholds(options.thresholds ?? 8)(pixels);
34
+ const color = options.fill ?? context.paletteColor(context.markIndex);
35
+ const nodes = levels.map((level, index) => {
36
+ const share = levels.length <= 1 ? 1 : (index + 1) / levels.length;
37
+ return {
38
+ kind: "path",
39
+ key: `${id}:${index}`,
40
+ role: "mark",
41
+ d: multiPolygonPath(level.coordinates, plot.x, plot.y),
42
+ paint: options.stroke ? {
43
+ fill: "none",
44
+ stroke: color,
45
+ strokeWidth: 1,
46
+ strokeOpacity: 0.3 + 0.7 * share
47
+ } : { fill: color, fillOpacity: 0.12 }
48
+ };
49
+ });
50
+ return {
51
+ nodes: nodes.filter((node) => node.kind !== "path" || node.d !== "")
52
+ };
53
+ }
54
+ };
55
+ }
56
+ export {
57
+ density2d
58
+ };
59
+ //# sourceMappingURL=density.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/contour/density.ts"],
4
+ "sourcesContent": ["import { contourDensity } from \"d3-contour\";\nimport { isPlaceable, readChannel } from \"#/core/channel.ts\";\nimport { markId, valueOn } from \"#/core/marks/shared.ts\";\nimport { multiPolygonPath } from \"#/core/paths.ts\";\nimport type {\n\tChartAccessor,\n\tChartMark,\n\tChartValue,\n\tSceneNode,\n} from \"#/core/types.ts\";\n\nexport interface Density2dOptions<TDatum> {\n\treadonly id?: string;\n\treadonly x: ChartAccessor<TDatum, ChartValue>;\n\treadonly y: ChartAccessor<TDatum, ChartValue>;\n\t/** Smoothing, in pixels. */\n\treadonly bandwidth?: number;\n\t/** How many density levels to draw. */\n\treadonly thresholds?: number;\n\treadonly fill?: string;\n\t/** Outline the levels instead of filling them. */\n\treadonly stroke?: boolean;\n}\n\n/**\n * Where points crowd, as nested contours: the shape of a scatter too dense\n * to read. Decorative on its own (the levels are not values a reader can\n * visit), so draw the points too, or give the chart a description.\n */\nexport function density2d<TDatum>(\n\tdata: ReadonlyArray<TDatum>,\n\toptions: Density2dOptions<TDatum>,\n): ChartMark {\n\tconst xs = readChannel(data, options.x);\n\tconst ys = readChannel(data, options.y);\n\treturn {\n\t\tid: options.id,\n\t\tcoordinate: \"cartesian\",\n\t\tchannels: {\n\t\t\tx: { values: xs.filter(isPlaceable) },\n\t\t\ty: { values: ys.filter(isPlaceable) },\n\t\t},\n\t\trender(context) {\n\t\t\tconst id = markId(options.id, \"density2d\", context);\n\t\t\tconst { x: xScale, y: yScale } = context.scales;\n\t\t\tif (xScale === undefined || yScale === undefined) {\n\t\t\t\treturn { nodes: [] };\n\t\t\t}\n\t\t\tconst { plot } = context;\n\t\t\tconst pixels: Array<[number, number]> = [];\n\t\t\tfor (const [index, raw] of xs.entries()) {\n\t\t\t\tconst x = valueOn(xScale, raw);\n\t\t\t\tconst y = valueOn(yScale, ys[index]);\n\t\t\t\tif (x !== undefined && y !== undefined) {\n\t\t\t\t\tpixels.push([xScale.center(x) - plot.x, yScale.center(y) - plot.y]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst levels = contourDensity()\n\t\t\t\t.x((pixel) => pixel[0])\n\t\t\t\t.y((pixel) => pixel[1])\n\t\t\t\t.size([\n\t\t\t\t\tMath.max(1, Math.round(plot.width)),\n\t\t\t\t\tMath.max(1, Math.round(plot.height)),\n\t\t\t\t])\n\t\t\t\t.bandwidth(options.bandwidth ?? 20)\n\t\t\t\t.thresholds(options.thresholds ?? 8)(pixels);\n\t\t\tconst color = options.fill ?? context.paletteColor(context.markIndex);\n\t\t\tconst nodes: SceneNode[] = levels.map((level, index) => {\n\t\t\t\tconst share = levels.length <= 1 ? 1 : (index + 1) / levels.length;\n\t\t\t\treturn {\n\t\t\t\t\tkind: \"path\",\n\t\t\t\t\tkey: `${id}:${index}`,\n\t\t\t\t\trole: \"mark\",\n\t\t\t\t\td: multiPolygonPath(level.coordinates as never, plot.x, plot.y),\n\t\t\t\t\tpaint: options.stroke\n\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\tfill: \"none\",\n\t\t\t\t\t\t\t\tstroke: color,\n\t\t\t\t\t\t\t\tstrokeWidth: 1,\n\t\t\t\t\t\t\t\tstrokeOpacity: 0.3 + 0.7 * share,\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t: { fill: color, fillOpacity: 0.12 },\n\t\t\t\t};\n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,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,KAAK,CAAC;AAAA,QAClC,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,MAAM,CAAC;AAAA,MACpC,CAAC,EACA,UAAU,QAAQ,aAAa,EAAE,EACjC,WAAW,QAAQ,cAAc,CAAC,EAAE,MAAM;AAC5C,YAAM,QAAQ,QAAQ,QAAQ,QAAQ,aAAa,QAAQ,SAAS;AACpE,YAAM,QAAqB,OAAO,IAAI,CAAC,OAAO,UAAU;AACvD,cAAM,QAAQ,OAAO,UAAU,IAAI,KAAK,QAAQ,KAAK,OAAO;AAC5D,eAAO;AAAA,UACN,MAAM;AAAA,UACN,KAAK,GAAG,EAAE,IAAI,KAAK;AAAA,UACnB,MAAM;AAAA,UACN,GAAG,iBAAiB,MAAM,aAAsB,KAAK,GAAG,KAAK,CAAC;AAAA,UAC9D,OAAO,QAAQ,SACZ;AAAA,YACA,MAAM;AAAA,YACN,QAAQ;AAAA,YACR,aAAa;AAAA,YACb,eAAe,MAAM,MAAM;AAAA,UAC5B,IACC,EAAE,MAAM,OAAO,aAAa,KAAK;AAAA,QACrC;AAAA,MACD,CAAC;AACD,aAAO;AAAA,QACN,OAAO,MAAM,OAAO,CAAC,SAAS,KAAK,SAAS,UAAU,KAAK,MAAM,EAAE;AAAA,MACpE;AAAA,IACD;AAAA,EACD;AACD;",
6
+ "names": []
7
+ }
@@ -0,0 +1,2 @@
1
+ export { type Density2dOptions, density2d } from "./density.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contour/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,gBAAgB,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { density2d } from "./density.js";
2
+ export {
3
+ density2d
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/contour/index.ts"],
4
+ "sourcesContent": ["export { type Density2dOptions, density2d } from \"#/contour/density.ts\";\n"],
5
+ "mappings": "AAAA,SAAgC,iBAAiB;",
6
+ "names": []
7
+ }
@@ -0,0 +1,11 @@
1
+ import type { ChartAccessor, ChartValue } from "./types.js";
2
+ /** Reads one channel off every datum. A missing field reads as `undefined`, never a throw. */
3
+ export declare function readChannel<TDatum, TValue>(data: ReadonlyArray<TDatum>, accessor: ChartAccessor<TDatum, TValue> | undefined): ReadonlyArray<TValue | undefined>;
4
+ /** The field name an accessor reads, for an axis or column heading. */
5
+ export declare function channelLabel<TDatum, TValue>(accessor: ChartAccessor<TDatum, TValue> | undefined): string | undefined;
6
+ /** A value a scale can place: finite numbers, valid dates and strings. */
7
+ export declare function isPlaceable(value: unknown): value is ChartValue;
8
+ /** A number off a channel, or `undefined` for a gap. Numeric strings count. */
9
+ export declare function numericValue(value: unknown): number | undefined;
10
+ export declare function placeableValues(values: ReadonlyArray<unknown>): ReadonlyArray<ChartValue>;
11
+ //# sourceMappingURL=channel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/core/channel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEjE,8FAA8F;AAC9F,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EACzC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,EAC3B,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GACjD,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,CAUnC;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAC1C,QAAQ,EAAE,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GACjD,MAAM,GAAG,SAAS,CAEpB;AAED,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAQ/D;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,CAS/D;AAED,wBAAgB,eAAe,CAC9B,MAAM,EAAE,aAAa,CAAC,OAAO,CAAC,GAC5B,aAAa,CAAC,UAAU,CAAC,CAE3B"}
@@ -0,0 +1,44 @@
1
+ function readChannel(data, accessor) {
2
+ if (accessor === void 0) {
3
+ return data.map(() => void 0);
4
+ }
5
+ if (typeof accessor === "function") {
6
+ return data.map((datum, index) => accessor(datum, index));
7
+ }
8
+ return data.map(
9
+ (datum) => datum[accessor]
10
+ );
11
+ }
12
+ function channelLabel(accessor) {
13
+ return typeof accessor === "string" ? accessor : void 0;
14
+ }
15
+ function isPlaceable(value) {
16
+ if (typeof value === "number") {
17
+ return Number.isFinite(value);
18
+ }
19
+ if (value instanceof Date) {
20
+ return !Number.isNaN(value.getTime());
21
+ }
22
+ return typeof value === "string";
23
+ }
24
+ function numericValue(value) {
25
+ if (typeof value === "number") {
26
+ return Number.isFinite(value) ? value : void 0;
27
+ }
28
+ if (typeof value === "string" && value.trim() !== "") {
29
+ const parsed = Number(value);
30
+ return Number.isFinite(parsed) ? parsed : void 0;
31
+ }
32
+ return void 0;
33
+ }
34
+ function placeableValues(values) {
35
+ return values.filter(isPlaceable);
36
+ }
37
+ export {
38
+ channelLabel,
39
+ isPlaceable,
40
+ numericValue,
41
+ placeableValues,
42
+ readChannel
43
+ };
44
+ //# sourceMappingURL=channel.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/core/channel.ts"],
4
+ "sourcesContent": ["import type { ChartAccessor, ChartValue } from \"#/core/types.ts\";\n\n/** Reads one channel off every datum. A missing field reads as `undefined`, never a throw. */\nexport function readChannel<TDatum, TValue>(\n\tdata: ReadonlyArray<TDatum>,\n\taccessor: ChartAccessor<TDatum, TValue> | undefined,\n): ReadonlyArray<TValue | undefined> {\n\tif (accessor === undefined) {\n\t\treturn data.map(() => undefined);\n\t}\n\tif (typeof accessor === \"function\") {\n\t\treturn data.map((datum, index) => accessor(datum, index));\n\t}\n\treturn data.map(\n\t\t(datum) => (datum as Record<string, unknown>)[accessor] as TValue,\n\t);\n}\n\n/** The field name an accessor reads, for an axis or column heading. */\nexport function channelLabel<TDatum, TValue>(\n\taccessor: ChartAccessor<TDatum, TValue> | undefined,\n): string | undefined {\n\treturn typeof accessor === \"string\" ? accessor : undefined;\n}\n\n/** A value a scale can place: finite numbers, valid dates and strings. */\nexport function isPlaceable(value: unknown): value is ChartValue {\n\tif (typeof value === \"number\") {\n\t\treturn Number.isFinite(value);\n\t}\n\tif (value instanceof Date) {\n\t\treturn !Number.isNaN(value.getTime());\n\t}\n\treturn typeof value === \"string\";\n}\n\n/** A number off a channel, or `undefined` for a gap. Numeric strings count. */\nexport function numericValue(value: unknown): number | undefined {\n\tif (typeof value === \"number\") {\n\t\treturn Number.isFinite(value) ? value : undefined;\n\t}\n\tif (typeof value === \"string\" && value.trim() !== \"\") {\n\t\tconst parsed = Number(value);\n\t\treturn Number.isFinite(parsed) ? parsed : undefined;\n\t}\n\treturn undefined;\n}\n\nexport function placeableValues(\n\tvalues: ReadonlyArray<unknown>,\n): ReadonlyArray<ChartValue> {\n\treturn values.filter(isPlaceable);\n}\n"],
5
+ "mappings": "AAGO,SAAS,YACf,MACA,UACoC;AACpC,MAAI,aAAa,QAAW;AAC3B,WAAO,KAAK,IAAI,MAAM,MAAS;AAAA,EAChC;AACA,MAAI,OAAO,aAAa,YAAY;AACnC,WAAO,KAAK,IAAI,CAAC,OAAO,UAAU,SAAS,OAAO,KAAK,CAAC;AAAA,EACzD;AACA,SAAO,KAAK;AAAA,IACX,CAAC,UAAW,MAAkC,QAAQ;AAAA,EACvD;AACD;AAGO,SAAS,aACf,UACqB;AACrB,SAAO,OAAO,aAAa,WAAW,WAAW;AAClD;AAGO,SAAS,YAAY,OAAqC;AAChE,MAAI,OAAO,UAAU,UAAU;AAC9B,WAAO,OAAO,SAAS,KAAK;AAAA,EAC7B;AACA,MAAI,iBAAiB,MAAM;AAC1B,WAAO,CAAC,OAAO,MAAM,MAAM,QAAQ,CAAC;AAAA,EACrC;AACA,SAAO,OAAO,UAAU;AACzB;AAGO,SAAS,aAAa,OAAoC;AAChE,MAAI,OAAO,UAAU,UAAU;AAC9B,WAAO,OAAO,SAAS,KAAK,IAAI,QAAQ;AAAA,EACzC;AACA,MAAI,OAAO,UAAU,YAAY,MAAM,KAAK,MAAM,IAAI;AACrD,UAAM,SAAS,OAAO,KAAK;AAC3B,WAAO,OAAO,SAAS,MAAM,IAAI,SAAS;AAAA,EAC3C;AACA,SAAO;AACR;AAEO,SAAS,gBACf,QAC4B;AAC5B,SAAO,OAAO,OAAO,WAAW;AACjC;",
6
+ "names": []
7
+ }
@@ -0,0 +1,22 @@
1
+ import type { ChartDefinition, ChartSpec } from "./define-chart.js";
2
+ import type { ChartChannel, ChartMark, ChartScene, ChartTextMeasurer } from "./types.js";
3
+ export interface CompileOptions {
4
+ readonly width: number;
5
+ readonly height: number;
6
+ readonly measureText?: ChartTextMeasurer;
7
+ /** Series the legend has switched off. The scales keep their domain, so the axes hold still. */
8
+ readonly hiddenSeries?: ReadonlySet<string>;
9
+ /** The part of a continuous x on show, when zoomed. */
10
+ readonly xDomain?: readonly [number, number];
11
+ }
12
+ export declare function isMark(mark: ChartMark | false | null | undefined): mark is ChartMark;
13
+ export declare function channelsOf(marks: ReadonlyArray<ChartMark>, name: "x" | "y" | "color"): ReadonlyArray<ChartChannel>;
14
+ /**
15
+ * Definition and size in, scene out. Pure: the same inputs give the same
16
+ * scene, on the server and in the browser, which is what lets the SVG render
17
+ * on the server hydrate without a mismatch.
18
+ */
19
+ export declare function compileChart(definition: ChartDefinition, options: CompileOptions): ChartScene;
20
+ /** One chart's scene from its spec: what `compileChart` does once per facet cell. */
21
+ export declare function compileSpec(spec: ChartSpec, options: CompileOptions): ChartScene;
22
+ //# sourceMappingURL=compile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../src/core/compile.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,eAAe,EAEf,SAAS,EACT,MAAM,wBAAwB,CAAC;AAuBhC,OAAO,KAAK,EACX,YAAY,EAKZ,SAAS,EAIT,UAAU,EACV,iBAAiB,EAIjB,MAAM,iBAAiB,CAAC;AASzB,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IACzC,gGAAgG;IAChG,QAAQ,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC5C,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C;AAiCD,wBAAgB,MAAM,CACrB,IAAI,EAAE,SAAS,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,GACxC,IAAI,IAAI,SAAS,CAEnB;AAED,wBAAgB,UAAU,CACzB,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,EAC/B,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GACvB,aAAa,CAAC,YAAY,CAAC,CAK7B;AAyFD;;;;GAIG;AACH,wBAAgB,YAAY,CAC3B,UAAU,EAAE,eAAe,EAC3B,OAAO,EAAE,cAAc,GACrB,UAAU,CAQZ;AAED,qFAAqF;AACrF,wBAAgB,WAAW,CAC1B,IAAI,EAAE,SAAS,EACf,OAAO,EAAE,cAAc,GACrB,UAAU,CA0NZ"}
@@ -0,0 +1,295 @@
1
+ import { dateValueFormatter, formatValue } from "./format.js";
2
+ import {
3
+ bottomAxis,
4
+ bottomMargin,
5
+ leftAxis,
6
+ leftMargin,
7
+ rightMargin
8
+ } from "./guides/axes.js";
9
+ import {
10
+ ordinalColorScale,
11
+ sequentialColorScale
12
+ } from "./scales/color.js";
13
+ import { toNumber } from "./scales/continuous.js";
14
+ import { categoryKey } from "./scales/discrete.js";
15
+ import {
16
+ buildScale,
17
+ planScale
18
+ } from "./scales/resolve.js";
19
+ import { estimateTextWidth } from "./text.js";
20
+ import { DEFAULT_THEME } from "./theme.js";
21
+ const DEFAULT_LOCALE = "fr-FR";
22
+ const EDGE = 8;
23
+ const X_TICK_SPACING = 80;
24
+ const Y_TICK_SPACING = 48;
25
+ const MIN_TICKS = 2;
26
+ function distinctBy(items, keyOf) {
27
+ const seen = /* @__PURE__ */ new Set();
28
+ return items.filter((item) => {
29
+ const key = keyOf(item);
30
+ if (seen.has(key)) {
31
+ return false;
32
+ }
33
+ seen.add(key);
34
+ return true;
35
+ });
36
+ }
37
+ const RAMP_STOPS = 5;
38
+ function rampOf(color, format) {
39
+ const [low, high] = color.domain.map(toNumber);
40
+ return {
41
+ stops: Array.from(
42
+ { length: RAMP_STOPS },
43
+ (_unused, index) => color.map(low + (high - low) * index / (RAMP_STOPS - 1))
44
+ ),
45
+ low: format(low),
46
+ high: format(high)
47
+ };
48
+ }
49
+ function isMark(mark) {
50
+ return Boolean(mark);
51
+ }
52
+ function channelsOf(marks, name) {
53
+ return marks.flatMap((mark) => {
54
+ const channel = mark.channels[name];
55
+ return channel === void 0 ? [] : [channel];
56
+ });
57
+ }
58
+ function tickCount(length, spacing) {
59
+ return Math.max(MIN_TICKS, Math.floor(length / spacing));
60
+ }
61
+ function colorScaleOf(spec, channels, theme) {
62
+ if (channels.length === 0) {
63
+ return void 0;
64
+ }
65
+ const options = spec.color;
66
+ const values = channels.flatMap((channel) => channel.values);
67
+ const sequential = options?.type === "sequential" || options?.type === void 0 && values.length > 0 && values.every((value) => typeof value === "number");
68
+ if (sequential) {
69
+ const numbers = (options?.domain ?? values).map(toNumber);
70
+ const [from = theme.background, to = theme.palette[0]] = options?.range ?? [
71
+ `color-mix(in oklab, ${theme.palette[0]} 12%, ${theme.background})`,
72
+ theme.palette[0]
73
+ ];
74
+ return sequentialColorScale(
75
+ [Math.min(...numbers), Math.max(...numbers)],
76
+ [from, to]
77
+ );
78
+ }
79
+ const domain = distinctBy(options?.domain ?? values, categoryKey);
80
+ return ordinalColorScale(domain, options?.range ?? theme.palette);
81
+ }
82
+ function withoutHidden(nodes, hidden) {
83
+ if (hidden.size === 0) {
84
+ return nodes;
85
+ }
86
+ return nodes.filter((node) => node.series === void 0 || !hidden.has(node.series)).map(
87
+ (node) => node.kind === "group" ? { ...node, children: withoutHidden(node.children, hidden) } : node
88
+ );
89
+ }
90
+ function focusOrderOf(spec, marks, x, y) {
91
+ if (spec.focus !== void 0) {
92
+ return spec.focus;
93
+ }
94
+ if (marks.some(
95
+ (mark) => mark.coordinate === "frame" || mark.focusOrder === "point"
96
+ )) {
97
+ return "point";
98
+ }
99
+ const yDiscrete = y?.kind === "band" || y?.kind === "point";
100
+ const xDiscrete = x?.kind === "band" || x?.kind === "point";
101
+ return yDiscrete && !xDiscrete ? "y" : "x";
102
+ }
103
+ function marginFor(spec, width, xInput, yInput, fontSize) {
104
+ const computed = {
105
+ top: yInput === void 0 ? EDGE : Math.max(EDGE, fontSize / 2 + 2),
106
+ right: xInput === void 0 ? EDGE : rightMargin(xInput),
107
+ bottom: xInput === void 0 ? EDGE : bottomMargin(xInput),
108
+ left: yInput === void 0 ? EDGE : leftMargin(yInput, width)
109
+ };
110
+ return { ...computed, ...spec.margin };
111
+ }
112
+ function compileChart(definition, options) {
113
+ const spec = definition.build({
114
+ width: options.width,
115
+ height: options.height
116
+ });
117
+ return spec.facet === void 0 ? compileSpec(spec, options) : spec.facet.compile(spec, { ...options, compileCell: compileSpec });
118
+ }
119
+ function compileSpec(spec, options) {
120
+ const { width, height } = options;
121
+ const measureText = options.measureText ?? estimateTextWidth;
122
+ const hidden = options.hiddenSeries ?? /* @__PURE__ */ new Set();
123
+ const locale = spec.locale ?? DEFAULT_LOCALE;
124
+ const theme = { ...DEFAULT_THEME, ...spec.theme };
125
+ const marks = (spec.marks ?? []).filter(isMark);
126
+ const cartesian = marks.filter((mark) => mark.coordinate === "cartesian");
127
+ const plannedX = planScale(channelsOf(cartesian, "x"), spec.x, "x");
128
+ const zoomed = options.xDomain !== void 0 && plannedX !== void 0 && plannedX.kind !== "band" && plannedX.kind !== "point";
129
+ const xPlan = zoomed && plannedX && options.xDomain ? { ...plannedX, domain: options.xDomain } : plannedX;
130
+ const yPlan = planScale(channelsOf(cartesian, "y"), spec.y, "y");
131
+ function provisional(plan, axisOptions, range, count) {
132
+ if (plan === void 0) {
133
+ return void 0;
134
+ }
135
+ return {
136
+ scale: buildScale(plan, axisOptions, range, locale, count),
137
+ options: axisOptions,
138
+ title: axisOptions?.label,
139
+ theme,
140
+ measureText
141
+ };
142
+ }
143
+ const yDiscrete = yPlan?.kind === "band" || yPlan?.kind === "point";
144
+ const yRange = (top, bottom) => yDiscrete ? [top, bottom] : [bottom, top];
145
+ const margin = marginFor(
146
+ spec,
147
+ width,
148
+ provisional(xPlan, spec.x, [0, width], tickCount(width, X_TICK_SPACING)),
149
+ provisional(
150
+ yPlan,
151
+ spec.y,
152
+ yRange(0, height),
153
+ tickCount(height, Y_TICK_SPACING)
154
+ ),
155
+ theme.fontSize
156
+ );
157
+ const plot = {
158
+ x: margin.left,
159
+ y: margin.top,
160
+ width: Math.max(0, width - margin.left - margin.right),
161
+ height: Math.max(0, height - margin.top - margin.bottom)
162
+ };
163
+ function insetOf(name) {
164
+ return Math.max(
165
+ 0,
166
+ ...channelsOf(cartesian, name).map((channel) => channel.inset ?? 0)
167
+ );
168
+ }
169
+ const xInset = insetOf("x");
170
+ const yInset = insetOf("y");
171
+ const x = xPlan && buildScale(
172
+ xPlan,
173
+ spec.x,
174
+ [plot.x + xInset, plot.x + plot.width - xInset],
175
+ locale,
176
+ tickCount(plot.width, X_TICK_SPACING)
177
+ );
178
+ const y = yPlan && buildScale(
179
+ yPlan,
180
+ spec.y,
181
+ yRange(plot.y + yInset, plot.y + plot.height - yInset),
182
+ locale,
183
+ tickCount(plot.height, Y_TICK_SPACING)
184
+ );
185
+ const color = colorScaleOf(spec, channelsOf(marks, "color"), theme);
186
+ const scales = { x, y, color };
187
+ function channelFormatter(channels, custom) {
188
+ if (custom !== void 0) {
189
+ return custom;
190
+ }
191
+ const dates = dateValueFormatter(
192
+ channels.flatMap((channel) => channel.values),
193
+ locale
194
+ );
195
+ return (value) => dates !== void 0 && value instanceof Date ? dates(value) : formatValue(value, locale);
196
+ }
197
+ const formatX = channelFormatter(channelsOf(cartesian, "x"), spec.x?.format);
198
+ const formatY = channelFormatter(channelsOf(cartesian, "y"), spec.y?.format);
199
+ const seriesLabel = (value) => spec.color?.labels?.[categoryKey(value)] ?? formatValue(value, locale);
200
+ const grid = [];
201
+ const guides = [];
202
+ const xContinuous = x !== void 0 && x.kind !== "band" && x.kind !== "point";
203
+ const yContinuous = y !== void 0 && y.kind !== "band" && y.kind !== "point";
204
+ if (x !== void 0) {
205
+ const axis = bottomAxis(
206
+ { scale: x, options: spec.x, title: spec.x?.label, theme, measureText },
207
+ plot,
208
+ spec.x?.grid ?? (xContinuous && !yContinuous)
209
+ );
210
+ grid.push(...axis.grid);
211
+ guides.push(...axis.labels);
212
+ }
213
+ if (y !== void 0) {
214
+ const axis = leftAxis(
215
+ { scale: y, options: spec.y, title: spec.y?.label, theme, measureText },
216
+ plot,
217
+ spec.y?.grid ?? yContinuous,
218
+ width
219
+ );
220
+ grid.push(...axis.grid);
221
+ guides.push(...axis.labels);
222
+ }
223
+ const markNodes = [];
224
+ const points = [];
225
+ const legend = [];
226
+ const paletteColor = (index) => theme.palette[index % theme.palette.length];
227
+ const projection = spec.projection?.fit(plot);
228
+ for (const [markIndex, mark] of marks.entries()) {
229
+ const rendered = mark.render({
230
+ scales,
231
+ plot,
232
+ theme,
233
+ measureText,
234
+ locale,
235
+ paletteColor,
236
+ colorOf: (value) => color?.map(value) ?? paletteColor(markIndex),
237
+ seriesLabel,
238
+ formatX,
239
+ formatY,
240
+ markIndex,
241
+ projection
242
+ });
243
+ markNodes.push(...rendered.nodes);
244
+ points.push(
245
+ ...(rendered.points ?? []).filter(
246
+ (point) => point.series === void 0 || !hidden.has(point.series)
247
+ )
248
+ );
249
+ legend.push(...rendered.legend ?? []);
250
+ }
251
+ const colored = marks.filter((mark) => mark.channels.color !== void 0);
252
+ const legendWanted = spec.color?.legend ?? colored.some((mark) => mark.colorLegend !== false);
253
+ if (color?.kind === "ordinal" && legendWanted) {
254
+ for (const value of color.domain) {
255
+ legend.push({
256
+ key: categoryKey(value),
257
+ label: seriesLabel(value),
258
+ color: color.map(value),
259
+ shape: "square"
260
+ });
261
+ }
262
+ }
263
+ return {
264
+ width,
265
+ height,
266
+ plot,
267
+ nodes: [
268
+ { kind: "group", key: "grid", role: "grid", children: grid },
269
+ {
270
+ kind: "group",
271
+ key: "marks",
272
+ role: "marks",
273
+ clip: zoomed ? plot : void 0,
274
+ children: withoutHidden(markNodes, hidden)
275
+ },
276
+ { kind: "group", key: "axes", role: "axes", children: guides }
277
+ ],
278
+ points,
279
+ legend: distinctBy(legend, (item) => item.key),
280
+ focusOrder: focusOrderOf(spec, marks, x, y),
281
+ scales,
282
+ xLabel: xPlan?.label ?? marks.find((mark) => mark.titles?.category)?.titles?.category ?? "x",
283
+ yLabel: yPlan?.label ?? marks.find((mark) => mark.titles?.value)?.titles?.value ?? "y",
284
+ theme,
285
+ locale,
286
+ colorRamp: color?.kind === "sequential" && spec.color?.legend !== false ? rampOf(color, (value) => formatValue(value, locale)) : void 0
287
+ };
288
+ }
289
+ export {
290
+ channelsOf,
291
+ compileChart,
292
+ compileSpec,
293
+ isMark
294
+ };
295
+ //# sourceMappingURL=compile.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/core/compile.ts"],
4
+ "sourcesContent": ["import type {\n\tChartDefinition,\n\tChartPositionScaleOptions,\n\tChartSpec,\n} from \"#/core/define-chart.ts\";\nimport { dateValueFormatter, formatValue } from \"#/core/format.ts\";\nimport {\n\ttype AxisMeasureInput,\n\tbottomAxis,\n\tbottomMargin,\n\tleftAxis,\n\tleftMargin,\n\trightMargin,\n} from \"#/core/guides/axes.ts\";\nimport {\n\tordinalColorScale,\n\tsequentialColorScale,\n} from \"#/core/scales/color.ts\";\nimport { toNumber } from \"#/core/scales/continuous.ts\";\nimport { categoryKey } from \"#/core/scales/discrete.ts\";\nimport {\n\tbuildScale,\n\tplanScale,\n\ttype ScalePlan,\n} from \"#/core/scales/resolve.ts\";\nimport { estimateTextWidth } from \"#/core/text.ts\";\nimport { DEFAULT_THEME } from \"#/core/theme.ts\";\nimport type {\n\tChartChannel,\n\tChartColorScale,\n\tChartFocusOrder,\n\tChartLegendItem,\n\tChartMargin,\n\tChartMark,\n\tChartPoint,\n\tChartPositionScale,\n\tChartRect,\n\tChartScene,\n\tChartTextMeasurer,\n\tChartTheme,\n\tChartValue,\n\tSceneNode,\n} from \"#/core/types.ts\";\n\nconst DEFAULT_LOCALE = \"fr-FR\";\nconst EDGE = 8;\n/** Pixels per tick an axis aims for: about one label every 80 px across, 48 px down. */\nconst X_TICK_SPACING = 80;\nconst Y_TICK_SPACING = 48;\nconst MIN_TICKS = 2;\n\nexport interface CompileOptions {\n\treadonly width: number;\n\treadonly height: number;\n\treadonly measureText?: ChartTextMeasurer;\n\t/** Series the legend has switched off. The scales keep their domain, so the axes hold still. */\n\treadonly hiddenSeries?: ReadonlySet<string>;\n\t/** The part of a continuous x on show, when zoomed. */\n\treadonly xDomain?: readonly [number, number];\n}\n\nfunction distinctBy<T>(\n\titems: ReadonlyArray<T>,\n\tkeyOf: (item: T) => string,\n): T[] {\n\tconst seen = new Set<string>();\n\treturn items.filter((item) => {\n\t\tconst key = keyOf(item);\n\t\tif (seen.has(key)) {\n\t\t\treturn false;\n\t\t}\n\t\tseen.add(key);\n\t\treturn true;\n\t});\n}\n\nconst RAMP_STOPS = 5;\n\nfunction rampOf(\n\tcolor: ChartColorScale,\n\tformat: (value: ChartValue) => string,\n): ChartScene[\"colorRamp\"] {\n\tconst [low, high] = color.domain.map(toNumber);\n\treturn {\n\t\tstops: Array.from({ length: RAMP_STOPS }, (_unused, index) =>\n\t\t\tcolor.map(low + ((high - low) * index) / (RAMP_STOPS - 1)),\n\t\t),\n\t\tlow: format(low),\n\t\thigh: format(high),\n\t};\n}\n\nexport function isMark(\n\tmark: ChartMark | false | null | undefined,\n): mark is ChartMark {\n\treturn Boolean(mark);\n}\n\nexport function channelsOf(\n\tmarks: ReadonlyArray<ChartMark>,\n\tname: \"x\" | \"y\" | \"color\",\n): ReadonlyArray<ChartChannel> {\n\treturn marks.flatMap((mark) => {\n\t\tconst channel = mark.channels[name];\n\t\treturn channel === undefined ? [] : [channel];\n\t});\n}\n\nfunction tickCount(length: number, spacing: number): number {\n\treturn Math.max(MIN_TICKS, Math.floor(length / spacing));\n}\n\nfunction colorScaleOf(\n\tspec: ChartSpec,\n\tchannels: ReadonlyArray<ChartChannel>,\n\ttheme: ChartTheme,\n): ChartColorScale | undefined {\n\tif (channels.length === 0) {\n\t\treturn undefined;\n\t}\n\tconst options = spec.color;\n\tconst values = channels.flatMap((channel) => channel.values);\n\tconst sequential =\n\t\toptions?.type === \"sequential\" ||\n\t\t(options?.type === undefined &&\n\t\t\tvalues.length > 0 &&\n\t\t\tvalues.every((value) => typeof value === \"number\"));\n\tif (sequential) {\n\t\tconst numbers = (options?.domain ?? values).map(toNumber);\n\t\tconst [from = theme.background, to = theme.palette[0]] = options?.range ?? [\n\t\t\t`color-mix(in oklab, ${theme.palette[0]} 12%, ${theme.background})`,\n\t\t\ttheme.palette[0],\n\t\t];\n\t\treturn sequentialColorScale(\n\t\t\t[Math.min(...numbers), Math.max(...numbers)],\n\t\t\t[from, to],\n\t\t);\n\t}\n\tconst domain = distinctBy(options?.domain ?? values, categoryKey);\n\treturn ordinalColorScale(domain, options?.range ?? theme.palette);\n}\n\nfunction withoutHidden(\n\tnodes: ReadonlyArray<SceneNode>,\n\thidden: ReadonlySet<string>,\n): ReadonlyArray<SceneNode> {\n\tif (hidden.size === 0) {\n\t\treturn nodes;\n\t}\n\treturn nodes\n\t\t.filter((node) => node.series === undefined || !hidden.has(node.series))\n\t\t.map((node) =>\n\t\t\tnode.kind === \"group\"\n\t\t\t\t? { ...node, children: withoutHidden(node.children, hidden) }\n\t\t\t\t: node,\n\t\t);\n}\n\nfunction focusOrderOf(\n\tspec: ChartSpec,\n\tmarks: ReadonlyArray<ChartMark>,\n\tx: ChartPositionScale | undefined,\n\ty: ChartPositionScale | undefined,\n): ChartFocusOrder {\n\tif (spec.focus !== undefined) {\n\t\treturn spec.focus;\n\t}\n\tif (\n\t\tmarks.some(\n\t\t\t(mark) => mark.coordinate === \"frame\" || mark.focusOrder === \"point\",\n\t\t)\n\t) {\n\t\treturn \"point\";\n\t}\n\tconst yDiscrete = y?.kind === \"band\" || y?.kind === \"point\";\n\tconst xDiscrete = x?.kind === \"band\" || x?.kind === \"point\";\n\treturn yDiscrete && !xDiscrete ? \"y\" : \"x\";\n}\n\nfunction marginFor(\n\tspec: ChartSpec,\n\twidth: number,\n\txInput: AxisMeasureInput | undefined,\n\tyInput: AxisMeasureInput | undefined,\n\tfontSize: number,\n): ChartMargin {\n\tconst computed: ChartMargin = {\n\t\ttop: yInput === undefined ? EDGE : Math.max(EDGE, fontSize / 2 + 2),\n\t\tright: xInput === undefined ? EDGE : rightMargin(xInput),\n\t\tbottom: xInput === undefined ? EDGE : bottomMargin(xInput),\n\t\tleft: yInput === undefined ? EDGE : leftMargin(yInput, width),\n\t};\n\treturn { ...computed, ...spec.margin };\n}\n\n/**\n * Definition and size in, scene out. Pure: the same inputs give the same\n * scene, on the server and in the browser, which is what lets the SVG render\n * on the server hydrate without a mismatch.\n */\nexport function compileChart(\n\tdefinition: ChartDefinition,\n\toptions: CompileOptions,\n): ChartScene {\n\tconst spec = definition.build({\n\t\twidth: options.width,\n\t\theight: options.height,\n\t});\n\treturn spec.facet === undefined\n\t\t? compileSpec(spec, options)\n\t\t: spec.facet.compile(spec, { ...options, compileCell: compileSpec });\n}\n\n/** One chart's scene from its spec: what `compileChart` does once per facet cell. */\nexport function compileSpec(\n\tspec: ChartSpec,\n\toptions: CompileOptions,\n): ChartScene {\n\tconst { width, height } = options;\n\tconst measureText = options.measureText ?? estimateTextWidth;\n\tconst hidden = options.hiddenSeries ?? new Set<string>();\n\tconst locale = spec.locale ?? DEFAULT_LOCALE;\n\tconst theme: ChartTheme = { ...DEFAULT_THEME, ...spec.theme };\n\tconst marks = (spec.marks ?? []).filter(isMark);\n\tconst cartesian = marks.filter((mark) => mark.coordinate === \"cartesian\");\n\n\tconst plannedX = planScale(channelsOf(cartesian, \"x\"), spec.x, \"x\");\n\t// A zoomed chart shows part of a continuous x: the viewport replaces the\n\t// domain, and the marks are clipped to the plot.\n\tconst zoomed =\n\t\toptions.xDomain !== undefined &&\n\t\tplannedX !== undefined &&\n\t\tplannedX.kind !== \"band\" &&\n\t\tplannedX.kind !== \"point\";\n\tconst xPlan =\n\t\tzoomed && plannedX && options.xDomain\n\t\t\t? { ...plannedX, domain: options.xDomain }\n\t\t\t: plannedX;\n\tconst yPlan = planScale(channelsOf(cartesian, \"y\"), spec.y, \"y\");\n\n\t// First pass: scales over the whole chart, only to measure tick labels.\n\tfunction provisional(\n\t\tplan: ScalePlan | undefined,\n\t\taxisOptions: ChartPositionScaleOptions | undefined,\n\t\trange: readonly [number, number],\n\t\tcount: number,\n\t): AxisMeasureInput | undefined {\n\t\tif (plan === undefined) {\n\t\t\treturn undefined;\n\t\t}\n\t\treturn {\n\t\t\tscale: buildScale(plan, axisOptions, range, locale, count),\n\t\t\toptions: axisOptions,\n\t\t\ttitle: axisOptions?.label,\n\t\t\ttheme,\n\t\t\tmeasureText,\n\t\t};\n\t}\n\tconst yDiscrete = yPlan?.kind === \"band\" || yPlan?.kind === \"point\";\n\tconst yRange = (top: number, bottom: number): readonly [number, number] =>\n\t\tyDiscrete ? [top, bottom] : [bottom, top];\n\n\tconst margin = marginFor(\n\t\tspec,\n\t\twidth,\n\t\tprovisional(xPlan, spec.x, [0, width], tickCount(width, X_TICK_SPACING)),\n\t\tprovisional(\n\t\t\tyPlan,\n\t\t\tspec.y,\n\t\t\tyRange(0, height),\n\t\t\ttickCount(height, Y_TICK_SPACING),\n\t\t),\n\t\ttheme.fontSize,\n\t);\n\tconst plot: ChartRect = {\n\t\tx: margin.left,\n\t\ty: margin.top,\n\t\twidth: Math.max(0, width - margin.left - margin.right),\n\t\theight: Math.max(0, height - margin.top - margin.bottom),\n\t};\n\n\tfunction insetOf(name: \"x\" | \"y\"): number {\n\t\treturn Math.max(\n\t\t\t0,\n\t\t\t...channelsOf(cartesian, name).map((channel) => channel.inset ?? 0),\n\t\t);\n\t}\n\tconst xInset = insetOf(\"x\");\n\tconst yInset = insetOf(\"y\");\n\tconst x =\n\t\txPlan &&\n\t\tbuildScale(\n\t\t\txPlan,\n\t\t\tspec.x,\n\t\t\t[plot.x + xInset, plot.x + plot.width - xInset],\n\t\t\tlocale,\n\t\t\ttickCount(plot.width, X_TICK_SPACING),\n\t\t);\n\tconst y =\n\t\tyPlan &&\n\t\tbuildScale(\n\t\t\tyPlan,\n\t\t\tspec.y,\n\t\t\tyRange(plot.y + yInset, plot.y + plot.height - yInset),\n\t\t\tlocale,\n\t\t\ttickCount(plot.height, Y_TICK_SPACING),\n\t\t);\n\tconst color = colorScaleOf(spec, channelsOf(marks, \"color\"), theme);\n\tconst scales = { x, y, color };\n\n\tfunction channelFormatter(\n\t\tchannels: ReadonlyArray<ChartChannel>,\n\t\tcustom: ((value: ChartValue) => string) | undefined,\n\t): (value: ChartValue) => string {\n\t\tif (custom !== undefined) {\n\t\t\treturn custom;\n\t\t}\n\t\tconst dates = dateValueFormatter(\n\t\t\tchannels.flatMap((channel) => channel.values),\n\t\t\tlocale,\n\t\t);\n\t\treturn (value) =>\n\t\t\tdates !== undefined && value instanceof Date\n\t\t\t\t? dates(value)\n\t\t\t\t: formatValue(value, locale);\n\t}\n\tconst formatX = channelFormatter(channelsOf(cartesian, \"x\"), spec.x?.format);\n\tconst formatY = channelFormatter(channelsOf(cartesian, \"y\"), spec.y?.format);\n\tconst seriesLabel = (value: ChartValue) =>\n\t\tspec.color?.labels?.[categoryKey(value)] ?? formatValue(value, locale);\n\n\tconst grid: SceneNode[] = [];\n\tconst guides: SceneNode[] = [];\n\tconst xContinuous =\n\t\tx !== undefined && x.kind !== \"band\" && x.kind !== \"point\";\n\tconst yContinuous =\n\t\ty !== undefined && y.kind !== \"band\" && y.kind !== \"point\";\n\tif (x !== undefined) {\n\t\tconst axis = bottomAxis(\n\t\t\t{ scale: x, options: spec.x, title: spec.x?.label, theme, measureText },\n\t\t\tplot,\n\t\t\tspec.x?.grid ?? (xContinuous && !yContinuous),\n\t\t);\n\t\tgrid.push(...axis.grid);\n\t\tguides.push(...axis.labels);\n\t}\n\tif (y !== undefined) {\n\t\tconst axis = leftAxis(\n\t\t\t{ scale: y, options: spec.y, title: spec.y?.label, theme, measureText },\n\t\t\tplot,\n\t\t\tspec.y?.grid ?? yContinuous,\n\t\t\twidth,\n\t\t);\n\t\tgrid.push(...axis.grid);\n\t\tguides.push(...axis.labels);\n\t}\n\n\tconst markNodes: SceneNode[] = [];\n\tconst points: ChartPoint[] = [];\n\tconst legend: ChartLegendItem[] = [];\n\tconst paletteColor = (index: number) =>\n\t\ttheme.palette[index % theme.palette.length];\n\tconst projection = spec.projection?.fit(plot);\n\tfor (const [markIndex, mark] of marks.entries()) {\n\t\tconst rendered = mark.render({\n\t\t\tscales,\n\t\t\tplot,\n\t\t\ttheme,\n\t\t\tmeasureText,\n\t\t\tlocale,\n\t\t\tpaletteColor,\n\t\t\tcolorOf: (value) => color?.map(value) ?? paletteColor(markIndex),\n\t\t\tseriesLabel,\n\t\t\tformatX,\n\t\t\tformatY,\n\t\t\tmarkIndex,\n\t\t\tprojection,\n\t\t});\n\t\tmarkNodes.push(...rendered.nodes);\n\t\tpoints.push(\n\t\t\t...(rendered.points ?? []).filter(\n\t\t\t\t(point) => point.series === undefined || !hidden.has(point.series),\n\t\t\t),\n\t\t);\n\t\tlegend.push(...(rendered.legend ?? []));\n\t}\n\n\tconst colored = marks.filter((mark) => mark.channels.color !== undefined);\n\tconst legendWanted =\n\t\tspec.color?.legend ?? colored.some((mark) => mark.colorLegend !== false);\n\tif (color?.kind === \"ordinal\" && legendWanted) {\n\t\tfor (const value of color.domain) {\n\t\t\tlegend.push({\n\t\t\t\tkey: categoryKey(value),\n\t\t\t\tlabel: seriesLabel(value),\n\t\t\t\tcolor: color.map(value),\n\t\t\t\tshape: \"square\",\n\t\t\t});\n\t\t}\n\t}\n\n\treturn {\n\t\twidth,\n\t\theight,\n\t\tplot,\n\t\tnodes: [\n\t\t\t{ kind: \"group\", key: \"grid\", role: \"grid\", children: grid },\n\t\t\t{\n\t\t\t\tkind: \"group\",\n\t\t\t\tkey: \"marks\",\n\t\t\t\trole: \"marks\",\n\t\t\t\tclip: zoomed ? plot : undefined,\n\t\t\t\tchildren: withoutHidden(markNodes, hidden),\n\t\t\t},\n\t\t\t{ kind: \"group\", key: \"axes\", role: \"axes\", children: guides },\n\t\t],\n\t\tpoints,\n\t\tlegend: distinctBy(legend, (item) => item.key),\n\t\tfocusOrder: focusOrderOf(spec, marks, x, y),\n\t\tscales,\n\t\txLabel:\n\t\t\txPlan?.label ??\n\t\t\tmarks.find((mark) => mark.titles?.category)?.titles?.category ??\n\t\t\t\"x\",\n\t\tyLabel:\n\t\t\tyPlan?.label ??\n\t\t\tmarks.find((mark) => mark.titles?.value)?.titles?.value ??\n\t\t\t\"y\",\n\t\ttheme,\n\t\tlocale,\n\t\tcolorRamp:\n\t\t\tcolor?.kind === \"sequential\" && spec.color?.legend !== false\n\t\t\t\t? rampOf(color, (value) => formatValue(value, locale))\n\t\t\t\t: undefined,\n\t};\n}\n"],
5
+ "mappings": "AA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