@howells/hairline 0.0.0-stage → 0.2.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 (456) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +148 -2
  4. package/lib/charts/axes.js +5 -0
  5. package/lib/charts/basics/candlestick.data.js +44 -0
  6. package/lib/charts/basics/candlestick.js +180 -0
  7. package/lib/charts/basics/daily-empty.js +24 -0
  8. package/lib/charts/basics/daily-readings.js +16 -0
  9. package/lib/charts/basics/dot-heat.data.js +225 -0
  10. package/lib/charts/basics/dot-heat.js +174 -0
  11. package/lib/charts/basics/dumbbell-queue.js +203 -0
  12. package/lib/charts/basics/hairline-area.js +208 -0
  13. package/lib/charts/basics/hairline-line.js +195 -0
  14. package/lib/charts/basics/nested-treemap.data.js +55 -0
  15. package/lib/charts/basics/nested-treemap.js +191 -0
  16. package/lib/charts/basics/paired-rungs.data.js +31 -0
  17. package/lib/charts/basics/paired-rungs.js +151 -0
  18. package/lib/charts/basics/plumb-scatter.js +229 -0
  19. package/lib/charts/basics/rung-bars.js +178 -0
  20. package/lib/charts/basics/rung-geometry.js +6 -0
  21. package/lib/charts/basics/rung-histogram.data.js +73 -0
  22. package/lib/charts/basics/rung-histogram.js +153 -0
  23. package/lib/charts/basics/rung-waterfall.data.js +30 -0
  24. package/lib/charts/basics/rung-waterfall.js +150 -0
  25. package/lib/charts/basics/rungs.js +22 -0
  26. package/lib/charts/basics/series-key.js +26 -0
  27. package/lib/charts/basics/stacked-rungs.data.js +42 -0
  28. package/lib/charts/basics/stacked-rungs.js +174 -0
  29. package/lib/charts/basics/stream-ribbon.data.js +124 -0
  30. package/lib/charts/basics/stream-ribbon.js +336 -0
  31. package/lib/charts/basics/tick-box.data.js +50 -0
  32. package/lib/charts/basics/tick-box.js +226 -0
  33. package/lib/charts/basics/tick-donut.data.js +30 -0
  34. package/lib/charts/basics/tick-donut.js +210 -0
  35. package/lib/charts/basics/tick-gauge.data.js +8 -0
  36. package/lib/charts/basics/tick-gauge.js +169 -0
  37. package/lib/charts/basics/tick-rows.data.js +30 -0
  38. package/lib/charts/basics/tick-rows.js +121 -0
  39. package/lib/charts/basics/util-a.js +15 -0
  40. package/lib/charts/basics/util-b.js +13 -0
  41. package/lib/charts/big/circular-graph.data.js +827 -0
  42. package/lib/charts/big/circular-graph.js +289 -0
  43. package/lib/charts/big/force-galaxy-model.js +167 -0
  44. package/lib/charts/big/force-galaxy.data.js +813 -0
  45. package/lib/charts/big/force-galaxy.js +276 -0
  46. package/lib/charts/big/thread-triptych.data.js +204 -0
  47. package/lib/charts/big/thread-triptych.js +334 -0
  48. package/lib/charts/board/room.js +6 -0
  49. package/lib/charts/board/slope.js +176 -0
  50. package/lib/charts/board/spread.js +28 -0
  51. package/lib/charts/control.js +18 -0
  52. package/lib/charts/core.js +84 -0
  53. package/lib/charts/data-table.js +34 -0
  54. package/lib/charts/fills.js +153 -0
  55. package/lib/charts/forms/area-difference.data.js +62 -0
  56. package/lib/charts/forms/area-difference.js +192 -0
  57. package/lib/charts/forms/brush-math.js +42 -0
  58. package/lib/charts/forms/brush-strip.js +199 -0
  59. package/lib/charts/forms/brushed-overview.data.js +374 -0
  60. package/lib/charts/forms/brushed-overview.js +162 -0
  61. package/lib/charts/forms/chord-ring.data.js +140 -0
  62. package/lib/charts/forms/chord-ring.js +167 -0
  63. package/lib/charts/forms/circle-pack.data.js +80 -0
  64. package/lib/charts/forms/circle-pack.js +99 -0
  65. package/lib/charts/forms/hatched-stack.data.js +71 -0
  66. package/lib/charts/forms/hatched-stack.js +228 -0
  67. package/lib/charts/forms/radial-year.data.js +13 -0
  68. package/lib/charts/forms/radial-year.js +156 -0
  69. package/lib/charts/frame.js +73 -0
  70. package/lib/charts/glance/aggregate-sankey.data.js +74 -0
  71. package/lib/charts/glance/aggregate-sankey.js +242 -0
  72. package/lib/charts/glance/bar-race.data.js +122 -0
  73. package/lib/charts/glance/bar-race.js +246 -0
  74. package/lib/charts/glance/big-slice.data.js +41 -0
  75. package/lib/charts/glance/big-slice.js +238 -0
  76. package/lib/charts/glance/chunky-bars.data.js +22 -0
  77. package/lib/charts/glance/chunky-bars.js +113 -0
  78. package/lib/charts/glance/circular-graph.data.js +146 -0
  79. package/lib/charts/glance/circular-graph.js +138 -0
  80. package/lib/charts/glance/control-slot.js +9 -0
  81. package/lib/charts/glance/diverging-bar.data.js +34 -0
  82. package/lib/charts/glance/diverging-bar.js +154 -0
  83. package/lib/charts/glance/dot-waffle.data.js +26 -0
  84. package/lib/charts/glance/dot-waffle.js +179 -0
  85. package/lib/charts/glance/draw-in.data.js +9 -0
  86. package/lib/charts/glance/draw-in.goals.json.js +289 -0
  87. package/lib/charts/glance/draw-in.js +214 -0
  88. package/lib/charts/glance/dynamic-stream.data.js +6 -0
  89. package/lib/charts/glance/dynamic-stream.js +189 -0
  90. package/lib/charts/glance/force-graph.data.js +77 -0
  91. package/lib/charts/glance/force-graph.js +211 -0
  92. package/lib/charts/glance/jitter-strip.data.js +10 -0
  93. package/lib/charts/glance/jitter-strip.easter.json.js +430 -0
  94. package/lib/charts/glance/jitter-strip.js +157 -0
  95. package/lib/charts/glance/link-bundle.js +51 -0
  96. package/lib/charts/glance/matrix-heat-glance.data.js +108 -0
  97. package/lib/charts/glance/matrix-heat-glance.js +170 -0
  98. package/lib/charts/glance/pictorial-bar.data.js +22 -0
  99. package/lib/charts/glance/pictorial-bar.js +180 -0
  100. package/lib/charts/glance/rainfall-dual-area.data.js +177 -0
  101. package/lib/charts/glance/rainfall-dual-area.js +192 -0
  102. package/lib/charts/glance/rank-strip.data.js +76 -0
  103. package/lib/charts/glance/rank-strip.js +172 -0
  104. package/lib/charts/glance/scatter-labels.js +60 -0
  105. package/lib/charts/glance/scatter-morph.data.js +78 -0
  106. package/lib/charts/glance/scatter-morph.js +338 -0
  107. package/lib/charts/glance/single-axis.data.js +6 -0
  108. package/lib/charts/glance/single-axis.js +150 -0
  109. package/lib/charts/glance/single-axis.tides.json.js +180 -0
  110. package/lib/charts/glance/stagger-wave.data.js +66 -0
  111. package/lib/charts/glance/stagger-wave.js +132 -0
  112. package/lib/charts/glance/tree-lr.data.js +41 -0
  113. package/lib/charts/glance/tree-lr.js +135 -0
  114. package/lib/charts/glance/util-a.js +49 -0
  115. package/lib/charts/glance/util-b.js +19 -0
  116. package/lib/charts/glance/violin.data.js +9 -0
  117. package/lib/charts/glance/violin.js +185 -0
  118. package/lib/charts/glance/violin.tenors.json.js +5 -0
  119. package/lib/charts/hooks.js +154 -0
  120. package/lib/charts/hover.js +19 -0
  121. package/lib/charts/lupi/arc-matrix.data.js +83 -0
  122. package/lib/charts/lupi/arc-matrix.js +146 -0
  123. package/lib/charts/lupi/ballot-tally.data.js +22 -0
  124. package/lib/charts/lupi/ballot-tally.js +125 -0
  125. package/lib/charts/lupi/barcode-lollipop.data.js +195 -0
  126. package/lib/charts/lupi/barcode-lollipop.js +161 -0
  127. package/lib/charts/lupi/brand-spectrum.data.js +70 -0
  128. package/lib/charts/lupi/brand-spectrum.js +233 -0
  129. package/lib/charts/lupi/bubble-almanac.data.js +689 -0
  130. package/lib/charts/lupi/bubble-almanac.js +164 -0
  131. package/lib/charts/lupi/calendar-heat.data.js +399 -0
  132. package/lib/charts/lupi/calendar-heat.js +175 -0
  133. package/lib/charts/lupi/cluster-field.data.js +83 -0
  134. package/lib/charts/lupi/cluster-field.js +173 -0
  135. package/lib/charts/lupi/dot-cascade.data.js +54 -0
  136. package/lib/charts/lupi/dot-cascade.js +124 -0
  137. package/lib/charts/lupi/dotty-matrix.data.js +170 -0
  138. package/lib/charts/lupi/dotty-matrix.js +126 -0
  139. package/lib/charts/lupi/hourglass-stream.data.js +30 -0
  140. package/lib/charts/lupi/hourglass-stream.js +158 -0
  141. package/lib/charts/lupi/hundred-field.data.js +38 -0
  142. package/lib/charts/lupi/hundred-field.js +237 -0
  143. package/lib/charts/lupi/launch-fan.data.js +315 -0
  144. package/lib/charts/lupi/launch-fan.js +198 -0
  145. package/lib/charts/lupi/matrix-heat.data.js +97 -0
  146. package/lib/charts/lupi/matrix-heat.js +246 -0
  147. package/lib/charts/lupi/parallel-coordinates.data.js +54 -0
  148. package/lib/charts/lupi/parallel-coordinates.js +218 -0
  149. package/lib/charts/lupi/radial-convergence.data.js +178 -0
  150. package/lib/charts/lupi/radial-convergence.js +208 -0
  151. package/lib/charts/lupi/radial-patchwork.data.js +454 -0
  152. package/lib/charts/lupi/radial-patchwork.js +181 -0
  153. package/lib/charts/lupi/ridgeline.data.js +1834 -0
  154. package/lib/charts/lupi/ridgeline.js +195 -0
  155. package/lib/charts/lupi/trend-lineage.data.js +51 -0
  156. package/lib/charts/lupi/trend-lineage.js +198 -0
  157. package/lib/charts/lupi/type-colonnade.data.js +18 -0
  158. package/lib/charts/lupi/type-colonnade.js +198 -0
  159. package/lib/charts/lupi/util-a.js +14 -0
  160. package/lib/charts/lupi/util-b.js +12 -0
  161. package/lib/charts/maps/choropleth.js +295 -0
  162. package/lib/charts/maps/geo.js +84 -0
  163. package/lib/charts/maps/legend.js +83 -0
  164. package/lib/charts/maps/step-fill.js +9 -0
  165. package/lib/charts/maps/us-choropleth.data.js +249 -0
  166. package/lib/charts/maps/us-choropleth.js +41 -0
  167. package/lib/charts/maps/world-choropleth.data.js +681 -0
  168. package/lib/charts/maps/world-choropleth.js +46 -0
  169. package/lib/charts/markers.js +35 -0
  170. package/lib/charts/marks.js +31 -0
  171. package/lib/charts/motion.js +11 -0
  172. package/lib/charts/originals/daily-users.data.js +101 -0
  173. package/lib/charts/originals/daily-users.js +203 -0
  174. package/lib/charts/originals/feature-rank.data.js +92 -0
  175. package/lib/charts/originals/feature-rank.js +167 -0
  176. package/lib/charts/originals/format.js +5 -0
  177. package/lib/charts/originals/key.js +26 -0
  178. package/lib/charts/originals/response-time.data.js +98 -0
  179. package/lib/charts/originals/response-time.js +187 -0
  180. package/lib/charts/originals/revenue-by-plan.data.js +26 -0
  181. package/lib/charts/originals/revenue-by-plan.js +248 -0
  182. package/lib/charts/playback.js +68 -0
  183. package/lib/charts/plot-note.js +27 -0
  184. package/lib/charts/roles.js +5 -0
  185. package/lib/charts/rules.js +66 -0
  186. package/lib/charts/scale-context.js +6 -0
  187. package/lib/charts/shapes.js +8 -0
  188. package/lib/charts/shared-options.js +25 -0
  189. package/lib/charts/svg.js +43 -0
  190. package/lib/charts/text.js +30 -0
  191. package/lib/charts/texture-ids.js +20 -0
  192. package/lib/charts/texture.js +286 -0
  193. package/lib/charts/util.js +43 -0
  194. package/lib/charts/value-grid.js +26 -0
  195. package/lib/draw.js +27 -0
  196. package/lib/entries/dumbbell-queue.js +2 -0
  197. package/lib/entries/hairline-area.js +2 -0
  198. package/lib/entries/hairline-line.js +2 -0
  199. package/lib/entries/plumb-scatter.js +2 -0
  200. package/lib/entries/rung-bars.js +2 -0
  201. package/lib/entries/slope.js +2 -0
  202. package/lib/frame.js +2 -0
  203. package/lib/hairline.css +1385 -0
  204. package/lib/index.js +72 -0
  205. package/lib/json-schema/dumbbell-queue.json +258 -0
  206. package/lib/json-schema/hairline-area.json +262 -0
  207. package/lib/json-schema/hairline-line.json +256 -0
  208. package/lib/json-schema/index.json +50 -0
  209. package/lib/json-schema/plumb-scatter.json +363 -0
  210. package/lib/json-schema/rung-bars.json +230 -0
  211. package/lib/json-schema/slope.json +333 -0
  212. package/lib/kit.js +16 -0
  213. package/lib/lib/format.js +29 -0
  214. package/lib/lib/random.js +8 -0
  215. package/lib/maps.js +4 -0
  216. package/lib/schema/daily.js +9 -0
  217. package/lib/schema/dumbbell-queue.js +28 -0
  218. package/lib/schema/format.js +72 -0
  219. package/lib/schema/hairline-area.js +24 -0
  220. package/lib/schema/hairline-line.js +23 -0
  221. package/lib/schema/key.js +4 -0
  222. package/lib/schema/metrics.js +26 -0
  223. package/lib/schema/motion.js +12 -0
  224. package/lib/schema/options.js +21 -0
  225. package/lib/schema/plumb-scatter.js +48 -0
  226. package/lib/schema/registry.js +132 -0
  227. package/lib/schema/rung-bars.js +25 -0
  228. package/lib/schema/scale.js +9 -0
  229. package/lib/schema/slope.js +28 -0
  230. package/lib/schema/validate.js +25 -0
  231. package/lib/schema.js +16 -0
  232. package/lib/theme/derive.js +98 -0
  233. package/lib/theme.css +443 -0
  234. package/lib/theme.js +1 -0
  235. package/lib/tokens.css +306 -0
  236. package/lib/types/charts/axes.d.ts +14 -0
  237. package/lib/types/charts/basics/candlestick.d.ts +22 -0
  238. package/lib/types/charts/basics/candlestick.data.d.ts +10 -0
  239. package/lib/types/charts/basics/daily-empty.d.ts +7 -0
  240. package/lib/types/charts/basics/daily-readings.d.ts +38 -0
  241. package/lib/types/charts/basics/dot-heat.d.ts +19 -0
  242. package/lib/types/charts/basics/dot-heat.data.d.ts +28 -0
  243. package/lib/types/charts/basics/dumbbell-queue.d.ts +15 -0
  244. package/lib/types/charts/basics/hairline-area.d.ts +18 -0
  245. package/lib/types/charts/basics/hairline-line.d.ts +18 -0
  246. package/lib/types/charts/basics/nested-treemap.d.ts +18 -0
  247. package/lib/types/charts/basics/nested-treemap.data.d.ts +30 -0
  248. package/lib/types/charts/basics/paired-rungs.d.ts +21 -0
  249. package/lib/types/charts/basics/paired-rungs.data.d.ts +43 -0
  250. package/lib/types/charts/basics/plumb-scatter.d.ts +14 -0
  251. package/lib/types/charts/basics/rung-bars.d.ts +16 -0
  252. package/lib/types/charts/basics/rung-geometry.d.ts +6 -0
  253. package/lib/types/charts/basics/rung-histogram.d.ts +22 -0
  254. package/lib/types/charts/basics/rung-histogram.data.d.ts +34 -0
  255. package/lib/types/charts/basics/rung-waterfall.d.ts +19 -0
  256. package/lib/types/charts/basics/rung-waterfall.data.d.ts +31 -0
  257. package/lib/types/charts/basics/rungs.d.ts +28 -0
  258. package/lib/types/charts/basics/series-key.d.ts +19 -0
  259. package/lib/types/charts/basics/stacked-rungs.d.ts +20 -0
  260. package/lib/types/charts/basics/stacked-rungs.data.d.ts +26 -0
  261. package/lib/types/charts/basics/stream-ribbon.d.ts +19 -0
  262. package/lib/types/charts/basics/stream-ribbon.data.d.ts +29 -0
  263. package/lib/types/charts/basics/tick-box.d.ts +19 -0
  264. package/lib/types/charts/basics/tick-box.data.d.ts +30 -0
  265. package/lib/types/charts/basics/tick-donut.d.ts +24 -0
  266. package/lib/types/charts/basics/tick-donut.data.d.ts +25 -0
  267. package/lib/types/charts/basics/tick-gauge.d.ts +22 -0
  268. package/lib/types/charts/basics/tick-gauge.data.d.ts +24 -0
  269. package/lib/types/charts/basics/tick-rows.d.ts +18 -0
  270. package/lib/types/charts/basics/tick-rows.data.d.ts +23 -0
  271. package/lib/types/charts/basics/util-a.d.ts +10 -0
  272. package/lib/types/charts/basics/util-b.d.ts +13 -0
  273. package/lib/types/charts/big/circular-graph.d.ts +20 -0
  274. package/lib/types/charts/big/circular-graph.data.d.ts +46 -0
  275. package/lib/types/charts/big/force-galaxy-model.d.ts +109 -0
  276. package/lib/types/charts/big/force-galaxy.d.ts +18 -0
  277. package/lib/types/charts/big/force-galaxy.data.d.ts +48 -0
  278. package/lib/types/charts/big/thread-triptych.d.ts +17 -0
  279. package/lib/types/charts/big/thread-triptych.data.d.ts +41 -0
  280. package/lib/types/charts/board/room.d.ts +18 -0
  281. package/lib/types/charts/board/slope.d.ts +14 -0
  282. package/lib/types/charts/board/spread.d.ts +5 -0
  283. package/lib/types/charts/control.d.ts +17 -0
  284. package/lib/types/charts/core.d.ts +77 -0
  285. package/lib/types/charts/data-table.d.ts +18 -0
  286. package/lib/types/charts/fills.d.ts +103 -0
  287. package/lib/types/charts/forms/area-difference.d.ts +9 -0
  288. package/lib/types/charts/forms/area-difference.data.d.ts +26 -0
  289. package/lib/types/charts/forms/brush-math.d.ts +19 -0
  290. package/lib/types/charts/forms/brush-strip.d.ts +19 -0
  291. package/lib/types/charts/forms/brushed-overview.d.ts +12 -0
  292. package/lib/types/charts/forms/brushed-overview.data.d.ts +16 -0
  293. package/lib/types/charts/forms/chord-ring.d.ts +12 -0
  294. package/lib/types/charts/forms/chord-ring.data.d.ts +29 -0
  295. package/lib/types/charts/forms/circle-pack.d.ts +9 -0
  296. package/lib/types/charts/forms/circle-pack.data.d.ts +23 -0
  297. package/lib/types/charts/forms/hatched-stack.d.ts +10 -0
  298. package/lib/types/charts/forms/hatched-stack.data.d.ts +36 -0
  299. package/lib/types/charts/forms/radial-year.d.ts +8 -0
  300. package/lib/types/charts/forms/radial-year.data.d.ts +17 -0
  301. package/lib/types/charts/frame.d.ts +21 -0
  302. package/lib/types/charts/glance/aggregate-sankey.d.ts +23 -0
  303. package/lib/types/charts/glance/aggregate-sankey.data.d.ts +32 -0
  304. package/lib/types/charts/glance/bar-race.d.ts +20 -0
  305. package/lib/types/charts/glance/bar-race.data.d.ts +32 -0
  306. package/lib/types/charts/glance/big-slice.d.ts +27 -0
  307. package/lib/types/charts/glance/big-slice.data.d.ts +30 -0
  308. package/lib/types/charts/glance/chunky-bars.d.ts +18 -0
  309. package/lib/types/charts/glance/chunky-bars.data.d.ts +24 -0
  310. package/lib/types/charts/glance/circular-graph.d.ts +19 -0
  311. package/lib/types/charts/glance/circular-graph.data.d.ts +43 -0
  312. package/lib/types/charts/glance/control-slot.d.ts +9 -0
  313. package/lib/types/charts/glance/diverging-bar.d.ts +19 -0
  314. package/lib/types/charts/glance/diverging-bar.data.d.ts +27 -0
  315. package/lib/types/charts/glance/dot-waffle.d.ts +19 -0
  316. package/lib/types/charts/glance/dot-waffle.data.d.ts +31 -0
  317. package/lib/types/charts/glance/draw-in.d.ts +20 -0
  318. package/lib/types/charts/glance/draw-in.data.d.ts +6 -0
  319. package/lib/types/charts/glance/dynamic-stream.d.ts +22 -0
  320. package/lib/types/charts/glance/dynamic-stream.data.d.ts +7 -0
  321. package/lib/types/charts/glance/force-graph.d.ts +16 -0
  322. package/lib/types/charts/glance/force-graph.data.d.ts +45 -0
  323. package/lib/types/charts/glance/jitter-strip.d.ts +24 -0
  324. package/lib/types/charts/glance/jitter-strip.data.d.ts +27 -0
  325. package/lib/types/charts/glance/link-bundle.d.ts +22 -0
  326. package/lib/types/charts/glance/matrix-heat-glance.d.ts +22 -0
  327. package/lib/types/charts/glance/matrix-heat-glance.data.d.ts +35 -0
  328. package/lib/types/charts/glance/pictorial-bar.d.ts +20 -0
  329. package/lib/types/charts/glance/pictorial-bar.data.d.ts +27 -0
  330. package/lib/types/charts/glance/rainfall-dual-area.d.ts +19 -0
  331. package/lib/types/charts/glance/rainfall-dual-area.data.d.ts +32 -0
  332. package/lib/types/charts/glance/rank-strip.d.ts +19 -0
  333. package/lib/types/charts/glance/rank-strip.data.d.ts +36 -0
  334. package/lib/types/charts/glance/scatter-labels.d.ts +23 -0
  335. package/lib/types/charts/glance/scatter-morph.d.ts +22 -0
  336. package/lib/types/charts/glance/scatter-morph.data.d.ts +30 -0
  337. package/lib/types/charts/glance/single-axis.d.ts +27 -0
  338. package/lib/types/charts/glance/single-axis.data.d.ts +6 -0
  339. package/lib/types/charts/glance/stagger-wave.d.ts +18 -0
  340. package/lib/types/charts/glance/stagger-wave.data.d.ts +26 -0
  341. package/lib/types/charts/glance/tree-lr.d.ts +16 -0
  342. package/lib/types/charts/glance/tree-lr.data.d.ts +27 -0
  343. package/lib/types/charts/glance/util-a.d.ts +31 -0
  344. package/lib/types/charts/glance/util-b.d.ts +12 -0
  345. package/lib/types/charts/glance/violin.d.ts +22 -0
  346. package/lib/types/charts/glance/violin.data.d.ts +24 -0
  347. package/lib/types/charts/hooks.d.ts +109 -0
  348. package/lib/types/charts/hover.d.ts +26 -0
  349. package/lib/types/charts/lupi/arc-matrix.d.ts +18 -0
  350. package/lib/types/charts/lupi/arc-matrix.data.d.ts +28 -0
  351. package/lib/types/charts/lupi/ballot-tally.d.ts +19 -0
  352. package/lib/types/charts/lupi/ballot-tally.data.d.ts +28 -0
  353. package/lib/types/charts/lupi/barcode-lollipop.d.ts +19 -0
  354. package/lib/types/charts/lupi/barcode-lollipop.data.d.ts +26 -0
  355. package/lib/types/charts/lupi/brand-spectrum.d.ts +28 -0
  356. package/lib/types/charts/lupi/brand-spectrum.data.d.ts +34 -0
  357. package/lib/types/charts/lupi/bubble-almanac.d.ts +22 -0
  358. package/lib/types/charts/lupi/bubble-almanac.data.d.ts +45 -0
  359. package/lib/types/charts/lupi/calendar-heat.d.ts +19 -0
  360. package/lib/types/charts/lupi/calendar-heat.data.d.ts +20 -0
  361. package/lib/types/charts/lupi/cluster-field.d.ts +21 -0
  362. package/lib/types/charts/lupi/cluster-field.data.d.ts +52 -0
  363. package/lib/types/charts/lupi/dot-cascade.d.ts +22 -0
  364. package/lib/types/charts/lupi/dot-cascade.data.d.ts +24 -0
  365. package/lib/types/charts/lupi/dotty-matrix.d.ts +17 -0
  366. package/lib/types/charts/lupi/dotty-matrix.data.d.ts +32 -0
  367. package/lib/types/charts/lupi/hourglass-stream.d.ts +18 -0
  368. package/lib/types/charts/lupi/hourglass-stream.data.d.ts +27 -0
  369. package/lib/types/charts/lupi/hundred-field.d.ts +18 -0
  370. package/lib/types/charts/lupi/hundred-field.data.d.ts +24 -0
  371. package/lib/types/charts/lupi/launch-fan.d.ts +37 -0
  372. package/lib/types/charts/lupi/launch-fan.data.d.ts +41 -0
  373. package/lib/types/charts/lupi/matrix-heat.d.ts +20 -0
  374. package/lib/types/charts/lupi/matrix-heat.data.d.ts +29 -0
  375. package/lib/types/charts/lupi/parallel-coordinates.d.ts +23 -0
  376. package/lib/types/charts/lupi/parallel-coordinates.data.d.ts +40 -0
  377. package/lib/types/charts/lupi/radial-convergence.d.ts +15 -0
  378. package/lib/types/charts/lupi/radial-convergence.data.d.ts +24 -0
  379. package/lib/types/charts/lupi/radial-patchwork.d.ts +16 -0
  380. package/lib/types/charts/lupi/radial-patchwork.data.d.ts +35 -0
  381. package/lib/types/charts/lupi/ridgeline.d.ts +23 -0
  382. package/lib/types/charts/lupi/ridgeline.data.d.ts +19 -0
  383. package/lib/types/charts/lupi/trend-lineage.d.ts +18 -0
  384. package/lib/types/charts/lupi/trend-lineage.data.d.ts +56 -0
  385. package/lib/types/charts/lupi/type-colonnade.d.ts +20 -0
  386. package/lib/types/charts/lupi/type-colonnade.data.d.ts +30 -0
  387. package/lib/types/charts/lupi/util-a.d.ts +9 -0
  388. package/lib/types/charts/lupi/util-b.d.ts +11 -0
  389. package/lib/types/charts/maps/choropleth.d.ts +33 -0
  390. package/lib/types/charts/maps/geo.d.ts +48 -0
  391. package/lib/types/charts/maps/legend.d.ts +14 -0
  392. package/lib/types/charts/maps/step-fill.d.ts +6 -0
  393. package/lib/types/charts/maps/us-choropleth.d.ts +25 -0
  394. package/lib/types/charts/maps/us-choropleth.data.d.ts +23 -0
  395. package/lib/types/charts/maps/world-choropleth.d.ts +22 -0
  396. package/lib/types/charts/maps/world-choropleth.data.d.ts +35 -0
  397. package/lib/types/charts/markers.d.ts +42 -0
  398. package/lib/types/charts/marks.d.ts +58 -0
  399. package/lib/types/charts/motion.d.ts +12 -0
  400. package/lib/types/charts/originals/daily-users.d.ts +13 -0
  401. package/lib/types/charts/originals/daily-users.data.d.ts +17 -0
  402. package/lib/types/charts/originals/feature-rank.d.ts +13 -0
  403. package/lib/types/charts/originals/feature-rank.data.d.ts +29 -0
  404. package/lib/types/charts/originals/format.d.ts +2 -0
  405. package/lib/types/charts/originals/key.d.ts +16 -0
  406. package/lib/types/charts/originals/response-time.d.ts +11 -0
  407. package/lib/types/charts/originals/response-time.data.d.ts +24 -0
  408. package/lib/types/charts/originals/revenue-by-plan.d.ts +12 -0
  409. package/lib/types/charts/originals/revenue-by-plan.data.d.ts +26 -0
  410. package/lib/types/charts/playback.d.ts +42 -0
  411. package/lib/types/charts/plot-note.d.ts +37 -0
  412. package/lib/types/charts/roles.d.ts +28 -0
  413. package/lib/types/charts/rules.d.ts +62 -0
  414. package/lib/types/charts/scale-context.d.ts +3 -0
  415. package/lib/types/charts/shapes.d.ts +9 -0
  416. package/lib/types/charts/shared-options.d.ts +25 -0
  417. package/lib/types/charts/svg.d.ts +24 -0
  418. package/lib/types/charts/text.d.ts +36 -0
  419. package/lib/types/charts/texture-ids.d.ts +24 -0
  420. package/lib/types/charts/texture.d.ts +185 -0
  421. package/lib/types/charts/util.d.ts +66 -0
  422. package/lib/types/charts/value-grid.d.ts +22 -0
  423. package/lib/types/draw.d.ts +279 -0
  424. package/lib/types/entries/dumbbell-queue.d.ts +2 -0
  425. package/lib/types/entries/hairline-area.d.ts +2 -0
  426. package/lib/types/entries/hairline-line.d.ts +2 -0
  427. package/lib/types/entries/plumb-scatter.d.ts +2 -0
  428. package/lib/types/entries/rung-bars.d.ts +2 -0
  429. package/lib/types/entries/slope.d.ts +2 -0
  430. package/lib/types/frame.d.ts +2 -0
  431. package/lib/types/index.d.ts +82 -0
  432. package/lib/types/kit.d.ts +22 -0
  433. package/lib/types/lib/format.d.ts +58 -0
  434. package/lib/types/lib/random.d.ts +5 -0
  435. package/lib/types/maps.d.ts +2 -0
  436. package/lib/types/schema/daily.d.ts +14 -0
  437. package/lib/types/schema/dumbbell-queue.d.ts +91 -0
  438. package/lib/types/schema/format.d.ts +101 -0
  439. package/lib/types/schema/hairline-area.d.ts +83 -0
  440. package/lib/types/schema/hairline-line.d.ts +85 -0
  441. package/lib/types/schema/key.d.ts +12 -0
  442. package/lib/types/schema/metrics.d.ts +26 -0
  443. package/lib/types/schema/motion.d.ts +22 -0
  444. package/lib/types/schema/options.d.ts +51 -0
  445. package/lib/types/schema/plumb-scatter.d.ts +124 -0
  446. package/lib/types/schema/registry.d.ts +309 -0
  447. package/lib/types/schema/rung-bars.d.ts +84 -0
  448. package/lib/types/schema/scale.d.ts +36 -0
  449. package/lib/types/schema/slope.d.ts +120 -0
  450. package/lib/types/schema/validate.d.ts +29 -0
  451. package/lib/types/schema.d.ts +30 -0
  452. package/lib/types/theme/derive.d.ts +23 -0
  453. package/lib/types/theme.d.ts +2 -0
  454. package/lib/vendor/us-atlas/states-10m.json.js +13855 -0
  455. package/lib/vendor/world-atlas/countries-110m.json.js +9357 -0
  456. package/package.json +160 -3
@@ -0,0 +1,336 @@
1
+ "use client";
2
+ import { fmtDay as e, fmtInt as t, monthTickLabels as n } from "../../lib/format.js";
3
+ import { useSvgId as r } from "../hooks.js";
4
+ import { Plot as i, Tooltip as a } from "../core.js";
5
+ import { noteOf as o, sansWidth as s, stagger as c, sum as l } from "../util.js";
6
+ import { crisp as u } from "../axes.js";
7
+ import { TICK as d } from "../marks.js";
8
+ import { PlotNote as f } from "../plot-note.js";
9
+ import { HRule as p, Stem as m } from "../rules.js";
10
+ import { ChartSvg as h } from "../svg.js";
11
+ import { Label as g } from "../text.js";
12
+ import { inkWidth as _, maxIndex as v } from "./util-b.js";
13
+ import { paint as y, useTextureIds as b } from "../texture-ids.js";
14
+ import { CrossHatch as x, Hatch as S, PlateLabel as C, Rules as w, Stipple as T } from "../texture.js";
15
+ import { streamRibbonDemo as E } from "./stream-ribbon.data.js";
16
+ import { useState as D } from "react";
17
+ import { scaleLinear as O, scaleUtc as k } from "d3-scale";
18
+ import { utcFormat as A } from "d3-time-format";
19
+ import { jsx as j, jsxs as M } from "react/jsx-runtime";
20
+ import { area as N, curveCatmullRom as P, line as F, stack as I, stackOffsetWiggle as L, stackOrderNone as R } from "d3-shape";
21
+ //#region src/charts/basics/stream-ribbon.tsx
22
+ var z = [
23
+ "cross",
24
+ "hatch",
25
+ "stipple",
26
+ "rules"
27
+ ], B = [
28
+ [0],
29
+ [0, 4],
30
+ [
31
+ 0,
32
+ 3,
33
+ 5
34
+ ],
35
+ [
36
+ 0,
37
+ 2,
38
+ 4,
39
+ 5
40
+ ],
41
+ [
42
+ 0,
43
+ 2,
44
+ 3,
45
+ 4,
46
+ 5
47
+ ]
48
+ ], V = P.alpha(.5), H = (e) => {
49
+ let t = (e.length - 1) / 2, n = l(e) / Math.max(1, e.length), r = 0, i = 0;
50
+ for (let [a, o] of e.entries()) r += (a - t) * (o - n), i += (a - t) ** 2;
51
+ return {
52
+ mean: n,
53
+ mid: t,
54
+ slope: i === 0 ? 0 : r / i
55
+ };
56
+ }, U = (e) => {
57
+ let t = e.dates.map((t, n) => e.series.map((e) => e.values[n] ?? 0)), n = I().keys(e.series.map((e, t) => t)).value((e, t) => e[t] ?? 0).order(R).offset(L)(t), r = n[0] ?? [], i = n.at(-1) ?? [], { mean: a, mid: o, slope: s } = H(r.map((e, t) => (e[0] + (i[t]?.[1] ?? e[1])) / 2)), c = n.map((e) => e.map((e, t) => ({
58
+ y0: e[0] - a - s * (t - o),
59
+ y1: e[1] - a - s * (t - o)
60
+ }))), u = B[Math.min(5, e.series.length) - 1] ?? [
61
+ 0,
62
+ 2,
63
+ 3,
64
+ 4,
65
+ 5
66
+ ], d = e.series.map((e, t) => ({
67
+ k: t,
68
+ v: e.values.at(-1) ?? 0
69
+ })).toSorted((e, t) => t.v - e.v), f = e.series.map((e, t) => u[Math.min(d.findIndex((e) => e.k === t), u.length - 1)] ?? 0);
70
+ return {
71
+ hi: Math.max(...(c.at(-1) ?? []).map((e) => e.y1)),
72
+ layers: c,
73
+ lo: Math.min(...(c[0] ?? []).map((e) => e.y0)),
74
+ names: e.series.map((e) => e.name),
75
+ steps: f,
76
+ totals: t.map((e) => l(e))
77
+ };
78
+ }, W = (e, t, n, r, i, a) => {
79
+ let o = e < 560, s = Math.max(_(a(r.totals.at(-1) ?? 0)), _("Total")), c = 12 + Math.ceil(s), l = Math.min(e - 12 - c, 1180), u = 12 + (e - 12 - c - l) / 2, d = n.dates[0] ?? /* @__PURE__ */ new Date(0), f = n.dates.at(-1) ?? d, p = k().domain([d, f]).range([u, u + l]), m = t - (i ? 84 : 42) - 18, h = Math.min((m - 18) / (r.hi - r.lo), l * .6 / Math.max(...r.totals)), g = (r.hi - r.lo) * h / 2, v = Math.max(0, Math.floor(m - 18 - 12 - g * 2)), y = m - v, b = Math.max((y + 18) / 2, y - 12 - g);
80
+ return {
81
+ height: t - v,
82
+ narrow: o,
83
+ plotW: l,
84
+ px0: u,
85
+ xs: n.dates.map((e) => p(e)),
86
+ y: O().domain([r.lo, r.hi]).range([b + g, b - g])
87
+ };
88
+ }, G = (e) => {
89
+ let t = [...new Set(e)].toSorted((e, t) => e - t);
90
+ return e.map((e) => t.indexOf(e));
91
+ }, K = (e) => {
92
+ let { layout: t, river: n, hover: r } = e, i = (e, n) => t.xs[n] ?? 0, a = N().x(i).y0((e) => t.y(e.y0)).y1((e) => t.y(e.y1)).curve(V), o = F().x(i).y((e) => t.y(e.y1)).curve(V), s = r === null ? 0 : t.y(n.layers.at(-1)?.[r.i]?.y1 ?? 0), c = r === null ? 0 : t.y(n.layers[0]?.[r.i]?.y0 ?? 0), l = G(n.steps), u = (e) => r !== null && r.s !== null && r.s !== e ? "opacity-30" : "", d = l.indexOf(0), f = n.layers[d];
93
+ return /* @__PURE__ */ M("g", {
94
+ clipPath: `url(#${e.clip})`,
95
+ children: [
96
+ n.layers.map((t, r) => {
97
+ let i = z[Math.min(l[r] ?? 0, z.length - 1)];
98
+ return /* @__PURE__ */ j("path", {
99
+ className: `stroke-l5 transition-opacity ${u(r)}`,
100
+ d: a(t) ?? "",
101
+ fill: y(e.textures(i ?? "rules")),
102
+ strokeWidth: 1
103
+ }, n.names[r]);
104
+ }),
105
+ f === void 0 ? null : /* @__PURE__ */ j("path", {
106
+ className: `cap-round stroke-ink fill-none transition-opacity ${u(d)}`,
107
+ d: o(f) ?? "",
108
+ strokeWidth: 2
109
+ }),
110
+ r === null ? null : /* @__PURE__ */ j(m, {
111
+ className: "stroke-paper",
112
+ x: r.x,
113
+ y0: s,
114
+ y1: c
115
+ })
116
+ ]
117
+ });
118
+ }, q = (e) => {
119
+ let { layout: t, river: n } = e, r = n.layers.map((r, i) => {
120
+ let a = e.data.series[i]?.name ?? "", o = (s(a, 12) + 16) / 2, c = r.map((e, n) => {
121
+ let r = t.xs[n] ?? 0;
122
+ return r - o >= t.px0 + 6 && r + o <= t.px0 + t.plotW - 6 ? t.y(e.y0) - t.y(e.y1) : 0;
123
+ }), l = v(c), u = r[l] ?? {
124
+ y0: 0,
125
+ y1: 0
126
+ };
127
+ return {
128
+ fits: (c[l] ?? 0) >= 18,
129
+ hero: (G(n.steps)[i] ?? 0) === 0,
130
+ name: a,
131
+ x: t.xs[l] ?? 0,
132
+ y: (t.y(u.y0) + t.y(u.y1)) / 2
133
+ };
134
+ });
135
+ return /* @__PURE__ */ j("g", {
136
+ className: "fade pointer-events-none",
137
+ style: c(8),
138
+ children: r.map((e) => e.fits ? /* @__PURE__ */ j(C, {
139
+ className: "t-label",
140
+ hero: e.hero,
141
+ text: e.name,
142
+ x: e.x,
143
+ y: e.y
144
+ }, e.name) : null)
145
+ });
146
+ }, J = (e) => {
147
+ let { format: t, layout: n, river: r } = e, i = r.totals.length - 1, a = n.y(r.layers.at(-1)?.[i]?.y1 ?? 0), o = n.y(r.layers[0]?.[i]?.y0 ?? 0), s = n.px0 + n.plotW, l = (a + o) / 2;
148
+ return /* @__PURE__ */ M("g", {
149
+ className: "fade",
150
+ style: c(9),
151
+ children: [/* @__PURE__ */ j(g, {
152
+ voice: "value",
153
+ x: s + 10,
154
+ y: l - 2,
155
+ children: t(r.totals.at(-1) ?? 0)
156
+ }), /* @__PURE__ */ j(g, {
157
+ voice: "axis",
158
+ x: s + 10,
159
+ y: l + 12,
160
+ children: "Total"
161
+ })]
162
+ });
163
+ }, Y = A("%Y"), X = 80, Z = (e) => {
164
+ let { layout: t, data: r, yearly: i } = e, a = t.narrow ? 6 : 3, o = r.dates.flatMap((e, n) => {
165
+ let o = r.dates[n - 1], s = o === void 0 || o.getUTCMonth() !== e.getUTCMonth();
166
+ return i || s && e.getUTCMonth() % a === 0 ? [{
167
+ date: e,
168
+ x: t.xs[n] ?? 0
169
+ }] : [];
170
+ }), s = [];
171
+ for (let e of o) {
172
+ let t = s.at(-1);
173
+ (t === void 0 || e.x - t.x >= X) && s.push(e);
174
+ }
175
+ let c = i ? s.map((e) => Y(e.date)) : n(s.map((e) => e.date));
176
+ return /* @__PURE__ */ M("g", { children: [
177
+ /* @__PURE__ */ j(p, {
178
+ x0: Math.round(t.px0 - 10),
179
+ x1: Math.round(t.px0 + t.plotW + 10),
180
+ y: e.y
181
+ }),
182
+ s.map((t) => /* @__PURE__ */ j("line", {
183
+ className: "hairline",
184
+ x1: u(t.x),
185
+ x2: u(t.x),
186
+ y1: Math.round(e.y) - d.md,
187
+ y2: Math.round(e.y)
188
+ }, t.date.getTime())),
189
+ s.map((t, n) => /* @__PURE__ */ j(g, {
190
+ anchor: n === 0 ? "start" : "middle",
191
+ voice: "axis",
192
+ x: n === 0 ? t.x - 2 : t.x,
193
+ y: e.y + 20,
194
+ children: c[n]
195
+ }, t.date.getTime()))
196
+ ] });
197
+ }, Q = (e, t, n) => {
198
+ let r = e.currentTarget.getBoundingClientRect(), i = e.clientX - r.left;
199
+ if (i < t.px0 - 10 || i > t.px0 + t.plotW + 10) return null;
200
+ let a = v(t.xs.map((e) => -Math.abs(e - i))), o = t.y.invert(e.clientY - r.top), s = n.layers.findIndex((e) => {
201
+ let t = e[a];
202
+ return t !== void 0 && o >= t.y0 && o <= t.y1;
203
+ });
204
+ return {
205
+ i: a,
206
+ narrow: t.narrow,
207
+ s: s === -1 ? null : s,
208
+ x: t.xs[a] ?? 0,
209
+ y: t.y(n.layers.at(-1)?.[a]?.y1 ?? 0) - 6
210
+ };
211
+ }, $ = (t) => {
212
+ let { data: n, format: r, hover: i } = t, o = n.dates[i.i] ?? /* @__PURE__ */ new Date(0), s = t.yearly ? Y(o) : `Period from ${e(o)}`, c = r(t.river.totals[i.i] ?? 0);
213
+ if (i.narrow) {
214
+ let e = i.s === null ? void 0 : n.series[i.s];
215
+ return /* @__PURE__ */ M(a, {
216
+ x: i.x,
217
+ y: i.y,
218
+ children: [
219
+ /* @__PURE__ */ j("b", { children: s }),
220
+ /* @__PURE__ */ j("br", {}),
221
+ e === void 0 ? "" : `${e.name} ${r(e.values[i.i] ?? 0)} · `,
222
+ "Total ",
223
+ c
224
+ ]
225
+ });
226
+ }
227
+ return /* @__PURE__ */ M(a, {
228
+ x: i.x,
229
+ y: i.y,
230
+ children: [
231
+ /* @__PURE__ */ j("b", { children: s }),
232
+ n.series.toReversed().map((e) => {
233
+ let t = n.series.indexOf(e);
234
+ return /* @__PURE__ */ M("span", {
235
+ className: i.s === null || i.s === t ? "" : "opacity-55",
236
+ children: [
237
+ " ",
238
+ "· ",
239
+ e.name,
240
+ " ",
241
+ r(e.values[i.i] ?? 0)
242
+ ]
243
+ }, e.name);
244
+ }),
245
+ " ",
246
+ "· Total ",
247
+ c
248
+ ]
249
+ });
250
+ }, ee = (e) => {
251
+ let n = e.data ?? E, a = e.height ?? 440, s = e.format ?? t, c = r("stream"), l = b("stream"), [u, d] = D(null), p = U(n), m = `Stream of ${n.series.map((e) => e.name).join(", ")} over ${n.dates.length} ${e.yearly === !0 ? "years" : "periods"}; latest total ${s(p.totals.at(-1) ?? 0)}`;
252
+ return /* @__PURE__ */ j(i, {
253
+ overlay: u === null ? null : /* @__PURE__ */ j($, {
254
+ data: n,
255
+ format: s,
256
+ hover: u,
257
+ river: p,
258
+ yearly: e.yearly === !0
259
+ }),
260
+ children: (t) => {
261
+ let r = o(e) !== void 0, i = W(t, a, n, p, r, s);
262
+ return /* @__PURE__ */ M(h, {
263
+ height: i.height,
264
+ label: m,
265
+ leave: () => {
266
+ d(null);
267
+ },
268
+ onPointerMove: (e) => {
269
+ d(Q(e, i, p));
270
+ },
271
+ width: t,
272
+ children: [
273
+ /* @__PURE__ */ j("defs", { children: /* @__PURE__ */ j("clipPath", {
274
+ id: c,
275
+ children: /* @__PURE__ */ j("rect", {
276
+ className: "sweep",
277
+ height: i.height,
278
+ width: i.plotW + 8,
279
+ x: i.px0 - 4,
280
+ y: 0
281
+ })
282
+ }) }),
283
+ /* @__PURE__ */ M("defs", { children: [
284
+ /* @__PURE__ */ j(x, {
285
+ id: l("cross"),
286
+ tone: "fill-hero"
287
+ }),
288
+ /* @__PURE__ */ j(S, {
289
+ id: l("hatch"),
290
+ tone: "fill-l3"
291
+ }),
292
+ /* @__PURE__ */ j(T, {
293
+ id: l("stipple"),
294
+ tone: "fill-l3"
295
+ }),
296
+ /* @__PURE__ */ j(w, {
297
+ id: l("rules"),
298
+ tone: "fill-l4"
299
+ })
300
+ ] }),
301
+ /* @__PURE__ */ j(K, {
302
+ clip: c,
303
+ hover: u,
304
+ layout: i,
305
+ river: p,
306
+ textures: l
307
+ }),
308
+ /* @__PURE__ */ j(q, {
309
+ data: n,
310
+ layout: i,
311
+ river: p
312
+ }),
313
+ /* @__PURE__ */ j(J, {
314
+ format: s,
315
+ layout: i,
316
+ river: p
317
+ }),
318
+ /* @__PURE__ */ j(Z, {
319
+ data: n,
320
+ layout: i,
321
+ yearly: e.yearly === !0,
322
+ y: i.height - (r ? 84 : 42) + 10
323
+ }),
324
+ /* @__PURE__ */ j(f, {
325
+ text: o(e),
326
+ width: t - 16,
327
+ x: i.px0 + i.plotW / 2,
328
+ y: i.height - 6
329
+ })
330
+ ]
331
+ });
332
+ }
333
+ });
334
+ };
335
+ //#endregion
336
+ export { ee as StreamRibbon };
@@ -0,0 +1,50 @@
1
+ "use client";
2
+ //#region src/charts/basics/tick-box.data.ts
3
+ var e = [
4
+ {
5
+ label: "Spring",
6
+ max: 285,
7
+ median: 154.55,
8
+ min: 48.8,
9
+ outliers: [300.8, 322.8],
10
+ q1: 123.125,
11
+ q3: 188.275
12
+ },
13
+ {
14
+ label: "Summer",
15
+ max: 303.7,
16
+ median: 192,
17
+ min: 97.5,
18
+ outliers: [353],
19
+ q1: 161.875,
20
+ q3: 226.875
21
+ },
22
+ {
23
+ label: "Autumn",
24
+ max: 199.1,
25
+ median: 101.85,
26
+ min: 31,
27
+ outliers: [210.4, 213.9],
28
+ q1: 76.7,
29
+ q3: 129.25
30
+ },
31
+ {
32
+ label: "Winter",
33
+ max: 107,
34
+ median: 59.7,
35
+ min: 18.2,
36
+ outliers: [
37
+ 112.9,
38
+ 113,
39
+ 115.1,
40
+ 115.9,
41
+ 117.6,
42
+ 124.1,
43
+ 127.8
44
+ ],
45
+ q1: 47.7,
46
+ q3: 72.3
47
+ }
48
+ ];
49
+ //#endregion
50
+ export { e as tickBoxDemo };
@@ -0,0 +1,226 @@
1
+ "use client";
2
+ import { useHover as e } from "../hooks.js";
3
+ import { Plot as t, Tooltip as n } from "../core.js";
4
+ import { noteOf as r, stagger as i } from "../util.js";
5
+ import { DimGroup as a, HitRect as o, TipText as s } from "../hover.js";
6
+ import { crisp as c } from "../axes.js";
7
+ import "../marks.js";
8
+ import { Ring as l } from "../markers.js";
9
+ import { FootNote as u } from "../plot-note.js";
10
+ import { HRule as d, VRule as f } from "../rules.js";
11
+ import { ChartSvg as p } from "../svg.js";
12
+ import { Label as m } from "../text.js";
13
+ import { inkWidth as h } from "./util-b.js";
14
+ import { paint as g, useTextureIds as _ } from "../texture-ids.js";
15
+ import { CrossHatch as v, Hatch as y } from "../texture.js";
16
+ import { tickBoxDemo as b } from "./tick-box.data.js";
17
+ import { scaleBand as x, scaleLinear as S } from "d3-scale";
18
+ import { jsx as C, jsxs as w } from "react/jsx-runtime";
19
+ //#region src/charts/basics/tick-box.tsx
20
+ var T = (e, t, n, r, i, a) => {
21
+ let o = Math.max(...n.flatMap((e) => [e.max, ...e.outliers ?? []])), s = S().domain([0, o]).nice(4), c = a ?? s.ticks(4), l = 16 + Math.max(0, ...c.map((e) => Math.ceil(h(i(e))))), u = (e) => x().domain(n.map((e) => e.label)).range([0, e]).paddingInner(.3).paddingOuter(.25), d = (e) => {
22
+ let t = u(e), r = Math.min(50, t.bandwidth() * .55), a = e / n.length >= 110, o = l, s = 0;
23
+ for (let c of n) {
24
+ let n = (t(c.label) ?? 0) + t.bandwidth() / 2, l = Math.ceil(h(c.label)) / 2;
25
+ o = Math.max(o, l - n), s = Math.max(s, n + l - e, a ? n + r / 2 + 10 + h(i(c.median)) - e : 0);
26
+ }
27
+ return {
28
+ l: o,
29
+ r: s
30
+ };
31
+ }, f = n.length * 160, p = Math.min(e - 4 - l, f);
32
+ for (let t = 0; t < 3; t += 1) {
33
+ let { l: t, r: n } = d(p);
34
+ p = Math.min(e - 4 - t - n, f);
35
+ }
36
+ let { l: m, r: g } = d(p), _ = p / n.length < 110, v = (r ? 70 : 34) + (_ ? 16 : 0), y = s.copy().range([t - v, 14]), b = (e - m - p - g) / 2 + m, C = u(p).range([b, b + p]), w = Math.min(50, C.bandwidth() * .55);
37
+ return {
38
+ boxW: w,
39
+ cap: Math.min(14, w * .45),
40
+ floor: y.range()[0] ?? t,
41
+ narrow: _,
42
+ plotW: p,
43
+ px0: b,
44
+ ticks: c,
45
+ top: 14,
46
+ x: C,
47
+ y
48
+ };
49
+ }, E = (e) => {
50
+ let { layout: t } = e;
51
+ return /* @__PURE__ */ C("g", { children: e.ticks.map((n) => /* @__PURE__ */ w("g", { children: [/* @__PURE__ */ C(d, {
52
+ kind: n === 0 ? "hairline" : "grid",
53
+ x0: Math.round(t.px0 - 8),
54
+ x1: Math.round(t.px0 + t.plotW),
55
+ y: t.y(n)
56
+ }), /* @__PURE__ */ C(m, {
57
+ anchor: "end",
58
+ middle: !0,
59
+ voice: "axis",
60
+ x: t.px0 - 16,
61
+ y: t.y(n),
62
+ children: e.format(n)
63
+ })] }, n)) });
64
+ }, D = (e) => {
65
+ let { cx: t, datum: n, layout: r } = e, { cap: a, y: o } = r, s = Math.round(t - a), l = Math.round(t + a) + 1;
66
+ return /* @__PURE__ */ w("g", {
67
+ className: "fade stroke-l3 shape-crisp",
68
+ strokeWidth: 1,
69
+ style: i(e.index + 2, "series"),
70
+ children: [
71
+ /* @__PURE__ */ C(f, {
72
+ kind: "plain",
73
+ x: t,
74
+ y0: c(o(n.max)),
75
+ y1: o(n.q3)
76
+ }),
77
+ /* @__PURE__ */ C(f, {
78
+ kind: "plain",
79
+ x: t,
80
+ y0: o(n.q1),
81
+ y1: c(o(n.min))
82
+ }),
83
+ /* @__PURE__ */ C(d, {
84
+ kind: "plain",
85
+ x0: s,
86
+ x1: l,
87
+ y: o(n.max)
88
+ }),
89
+ /* @__PURE__ */ C(d, {
90
+ kind: "plain",
91
+ x0: s,
92
+ x1: l,
93
+ y: o(n.min)
94
+ })
95
+ ]
96
+ });
97
+ }, O = (e) => {
98
+ let { datum: t, layout: n, index: r } = e, { boxW: s, y: u } = n, d = n.x.bandwidth(), f = (n.x(t.label) ?? 0) + d / 2, p = Math.round(u(t.q3)), h = Math.max(2, Math.round(u(t.q1)) - p), _ = Math.round(f - s / 2), v = Math.round(s);
99
+ return /* @__PURE__ */ w(a, {
100
+ dim: e.dim,
101
+ onPointerEnter: () => {
102
+ e.onHover(f, u(t.max) - 10);
103
+ },
104
+ children: [
105
+ /* @__PURE__ */ C(o, {
106
+ height: n.floor - n.top + 24,
107
+ width: d,
108
+ x: f - d / 2,
109
+ y: n.top
110
+ }),
111
+ /* @__PURE__ */ C(D, {
112
+ cx: f,
113
+ datum: t,
114
+ index: r,
115
+ layout: n
116
+ }),
117
+ /* @__PURE__ */ C("rect", {
118
+ className: `grow-y shape-crisp ${e.hero ? "stroke-hero" : "stroke-l5"}`,
119
+ fill: g(e.hero ? e.textures("cross") : e.textures("hatch")),
120
+ height: h - 1,
121
+ rx: Math.min(h, v) < 24 ? 1.5 : 3.5,
122
+ strokeWidth: 1,
123
+ style: i(r, "series"),
124
+ width: v - 1,
125
+ x: _ + .5,
126
+ y: p + .5
127
+ }),
128
+ e.hero ? /* @__PURE__ */ C("rect", {
129
+ className: "grow-x fill-paper",
130
+ height: 6,
131
+ style: i(r + 3, "series"),
132
+ width: v - 2,
133
+ x: _ + 1,
134
+ y: Math.round(u(t.median)) - 3
135
+ }) : null,
136
+ /* @__PURE__ */ C("rect", {
137
+ className: `grow-x ${e.hero ? "fill-hero" : "fill-l2"}`,
138
+ height: 2,
139
+ style: i(r + 3, "series"),
140
+ width: Math.max(2, v - 12),
141
+ x: _ + 6,
142
+ y: Math.round(u(t.median)) - 1
143
+ }),
144
+ (t.outliers ?? []).map((e, t) => /* @__PURE__ */ C(l, {
145
+ className: "pop stroke-l3",
146
+ cx: c(f),
147
+ cy: u(e),
148
+ size: "sm",
149
+ style: i(r * 3 + t + 6, "mark")
150
+ }, e)),
151
+ /* @__PURE__ */ C(m, {
152
+ anchor: n.narrow ? "middle" : "start",
153
+ middle: !0,
154
+ order: r + 3,
155
+ tier: "series",
156
+ voice: "value",
157
+ x: n.narrow ? f : f + s / 2 + 10,
158
+ y: n.narrow ? n.floor + 38 : u(t.median),
159
+ children: e.format(t.median)
160
+ }),
161
+ /* @__PURE__ */ C(m, {
162
+ anchor: "middle",
163
+ muted: !0,
164
+ voice: "label",
165
+ x: f,
166
+ y: n.floor + 22,
167
+ children: t.label
168
+ })
169
+ ]
170
+ });
171
+ }, k = (e, t) => {
172
+ let n = e.outliers?.length ?? 0, r = n > 0 ? ` · ${n} outlier${n > 1 ? "s" : ""}` : "";
173
+ return `median ${t(e.median)} · middle half ${t(e.q1)}–${t(e.q3)}${r}`;
174
+ }, A = (i) => {
175
+ let a = i.data ?? b, o = i.height ?? 400, c = i.format ?? String, l = e(), d = _("box"), [f] = a.toSorted((e, t) => i.darkest === "high" ? t.median - e.median : e.median - t.median), m = a.map((e) => `${e.label}: ${k(e, c)}`).join("; ");
176
+ return /* @__PURE__ */ C(t, {
177
+ overlay: l.at === null ? null : /* @__PURE__ */ C(n, {
178
+ x: l.at.x,
179
+ y: l.at.y,
180
+ children: /* @__PURE__ */ C(s, {
181
+ facts: [k(a[l.at.key], c)],
182
+ lead: a[l.at.key].label
183
+ })
184
+ }),
185
+ children: (e) => {
186
+ let t = T(e, o, a, r(i) !== void 0, c, i.ticks);
187
+ return /* @__PURE__ */ w(p, {
188
+ height: o,
189
+ label: m,
190
+ leave: l.clear,
191
+ width: e,
192
+ children: [
193
+ /* @__PURE__ */ w("defs", { children: [/* @__PURE__ */ C(y, {
194
+ id: d("hatch"),
195
+ tone: "fill-l4"
196
+ }), /* @__PURE__ */ C(v, {
197
+ id: d("cross"),
198
+ tone: "fill-hero"
199
+ })] }),
200
+ /* @__PURE__ */ C(E, {
201
+ format: c,
202
+ layout: t,
203
+ ticks: t.ticks
204
+ }),
205
+ a.map((e, n) => /* @__PURE__ */ C(O, {
206
+ datum: e,
207
+ dim: l.dim(n),
208
+ hero: e === f,
209
+ textures: d,
210
+ format: c,
211
+ index: n,
212
+ layout: t,
213
+ onHover: l.showAt(n)
214
+ }, e.label)),
215
+ /* @__PURE__ */ C(u, {
216
+ height: o,
217
+ text: r(i),
218
+ width: e
219
+ })
220
+ ]
221
+ });
222
+ }
223
+ });
224
+ };
225
+ //#endregion
226
+ export { A as TickBox };
@@ -0,0 +1,30 @@
1
+ "use client";
2
+ //#region src/charts/basics/tick-donut.data.ts
3
+ var e = [
4
+ {
5
+ label: "Wholesale",
6
+ value: 720
7
+ },
8
+ {
9
+ label: "Networks",
10
+ value: 396
11
+ },
12
+ {
13
+ label: "Operating",
14
+ value: 270
15
+ },
16
+ {
17
+ label: "Policy",
18
+ value: 215
19
+ },
20
+ {
21
+ label: "VAT",
22
+ value: 84
23
+ },
24
+ {
25
+ label: "Other",
26
+ value: 70
27
+ }
28
+ ];
29
+ //#endregion
30
+ export { e as tickDonutDemo };