@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,153 @@
1
+ "use client";
2
+ import { HALFTONE_R as e, TEXTURE_PITCH as t } from "./texture-ids.js";
3
+ //#region src/charts/fills.ts
4
+ var n = [
5
+ {
6
+ cls: "fill-hero",
7
+ id: "ink",
8
+ label: "Ink"
9
+ },
10
+ {
11
+ cls: "fill-l2",
12
+ id: "strong",
13
+ label: "Strong"
14
+ },
15
+ {
16
+ cls: "fill-l3",
17
+ id: "mid",
18
+ label: "Mid"
19
+ },
20
+ {
21
+ cls: "fill-l4",
22
+ id: "quiet",
23
+ label: "Quiet"
24
+ },
25
+ {
26
+ cls: "fill-l5",
27
+ id: "faint",
28
+ label: "Faint"
29
+ },
30
+ {
31
+ cls: "fill-alert",
32
+ id: "alert",
33
+ label: "Alert"
34
+ }
35
+ ], r = [
36
+ {
37
+ id: "solid",
38
+ label: "Solid",
39
+ tones: [
40
+ "ink",
41
+ "strong",
42
+ "mid",
43
+ "quiet",
44
+ "faint",
45
+ "alert"
46
+ ]
47
+ },
48
+ {
49
+ id: "hatch",
50
+ label: "Hatch",
51
+ pitch: t.hatch,
52
+ tones: [
53
+ "ink",
54
+ "strong",
55
+ "mid",
56
+ "quiet",
57
+ "faint",
58
+ "alert"
59
+ ]
60
+ },
61
+ {
62
+ id: "cross",
63
+ label: "Crosshatch",
64
+ pitch: t.cross,
65
+ tones: [
66
+ "ink",
67
+ "strong",
68
+ "mid",
69
+ "quiet",
70
+ "alert"
71
+ ]
72
+ },
73
+ {
74
+ id: "rules",
75
+ label: "Rules",
76
+ pitch: t.dense,
77
+ tones: [
78
+ "ink",
79
+ "strong",
80
+ "mid",
81
+ "quiet",
82
+ "faint"
83
+ ]
84
+ },
85
+ {
86
+ id: "upright",
87
+ label: "Upright rules",
88
+ pitch: t.dense,
89
+ tones: [
90
+ "ink",
91
+ "strong",
92
+ "mid",
93
+ "quiet",
94
+ "faint"
95
+ ]
96
+ },
97
+ {
98
+ id: "stipple",
99
+ label: "Stipple",
100
+ pitch: t.screen,
101
+ tones: [
102
+ "strong",
103
+ "mid",
104
+ "quiet",
105
+ "faint"
106
+ ]
107
+ },
108
+ {
109
+ id: "dense",
110
+ label: "Dense stipple",
111
+ pitch: t.dense,
112
+ tones: [
113
+ "strong",
114
+ "mid",
115
+ "quiet",
116
+ "faint"
117
+ ]
118
+ },
119
+ {
120
+ id: "beads",
121
+ label: "Broken rungs",
122
+ pitch: t.dense,
123
+ tones: ["mid"]
124
+ }
125
+ ], i = [{
126
+ id: "halftone",
127
+ label: "Halftone",
128
+ steps: e.map((e) => ({
129
+ pitch: t.screen,
130
+ r: e
131
+ })),
132
+ tones: ["mid", "quiet"]
133
+ }, {
134
+ id: "density",
135
+ label: "Hatch density",
136
+ steps: [
137
+ {
138
+ pitch: t.cross,
139
+ r: 0
140
+ },
141
+ {
142
+ pitch: t.hatch,
143
+ r: 0
144
+ },
145
+ {
146
+ pitch: t.dense,
147
+ r: 0
148
+ }
149
+ ],
150
+ tones: ["mid"]
151
+ }], a = (e) => n.find((t) => t.id === e)?.cls ?? "fill-l3";
152
+ //#endregion
153
+ export { r as FILL_FAMILIES, i as FILL_LADDERS, n as FILL_TONES, a as toneClass };
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ //#region src/charts/forms/area-difference.data.ts
3
+ var e = Date.UTC(2022, 0, 1), t = 6048e5, n = [
4
+ [6, 4.6],
5
+ [4.5, 5.3],
6
+ [2.8, 4.8],
7
+ [4.9, 4.3],
8
+ [7.1, 4.5],
9
+ [6.4, 4.6],
10
+ [7.4, 5],
11
+ [6.6, 5.4],
12
+ [6.5, 5.2],
13
+ [7.1, 6.5],
14
+ [8.5, 7.2],
15
+ [9.5, 7.1],
16
+ [7.4, 7.7],
17
+ [7.3, 8.2],
18
+ [9.9, 8.5],
19
+ [11.4, 9.3],
20
+ [9.3, 10.3],
21
+ [11.4, 10.6],
22
+ [13.2, 11.4],
23
+ [14.9, 11.7],
24
+ [13.3, 13],
25
+ [11.7, 13.6],
26
+ [14.2, 13.9],
27
+ [16.1, 14.4],
28
+ [15.5, 15.1],
29
+ [14.8, 16],
30
+ [15.8, 16.3],
31
+ [18.5, 16.4],
32
+ [20.9, 17],
33
+ [17.7, 17.4],
34
+ [18.7, 17.4],
35
+ [19.2, 17.2],
36
+ [20.2, 16.6],
37
+ [17.9, 16.4],
38
+ [17.3, 15.3],
39
+ [17.6, 15.1],
40
+ [15, 14.3],
41
+ [13.2, 13.8],
42
+ [10.9, 13.2],
43
+ [13.6, 12],
44
+ [10.7, 11.7],
45
+ [12.4, 10.2],
46
+ [14.4, 10],
47
+ [11.7, 9.3],
48
+ [11, 8.2],
49
+ [10.2, 7.4],
50
+ [7.3, 6.2],
51
+ [6.2, 6.1],
52
+ [2.4, 5.5],
53
+ [-2.2, 4.9],
54
+ [5.8, 4.8],
55
+ [6.9, 4.3]
56
+ ].map(([n, r], i) => ({
57
+ actual: n,
58
+ plan: r,
59
+ week: new Date(e + i * t)
60
+ }));
61
+ //#endregion
62
+ export { n as planWeeksDemo };
@@ -0,0 +1,192 @@
1
+ "use client";
2
+ import { fmtDegC as e, monthTickLabels as t } from "../../lib/format.js";
3
+ import { useHover as n } from "../hooks.js";
4
+ import { Plot as r, Tooltip as i } from "../core.js";
5
+ import { clamp as a, sansWidth as o } from "../util.js";
6
+ import { TipText as s } from "../hover.js";
7
+ import { Dot as c } from "../markers.js";
8
+ import { HRule as l, Stem as u } from "../rules.js";
9
+ import { ChartSvg as d } from "../svg.js";
10
+ import { Label as f } from "../text.js";
11
+ import { paint as p, useTextureIds as m } from "../texture-ids.js";
12
+ import { CrossHatch as h, Hatch as g } from "../texture.js";
13
+ import { ValueGrid as _ } from "../value-grid.js";
14
+ import { planWeeksDemo as v } from "./area-difference.data.js";
15
+ import { scaleLinear as y } from "d3-scale";
16
+ import { utcFormat as b } from "d3-time-format";
17
+ import { jsx as x, jsxs as S } from "react/jsx-runtime";
18
+ import { area as C, curveMonotoneX as w, line as T } from "d3-shape";
19
+ //#region src/charts/forms/area-difference.tsx
20
+ var E = 5, D = b("%-d %b"), O = "2022", k = "Normal", A = e, j = (t) => e(t).replace(".0 °C", " °C"), M = (e, t, n) => {
21
+ let r = e.flatMap((e) => [e.actual, e.plan]), i = n - 30, a = Math.min(...r), s = Math.max(...r), c = y().domain([a - (s - a) * .06, s]).range([i, 12]), l = Math.ceil(Math.max(...c.ticks(E).map((e) => o(j(e).replaceAll("1", "0"), 11)))) + 8, u = t - 8 - Math.ceil(Math.max(o(O, 11), o(k, 11))), d = y().domain([0, e.length - 1]).range([l, u]);
22
+ return {
23
+ bottom: i,
24
+ top: 12,
25
+ x: (e) => d(e),
26
+ x0: l,
27
+ x1: u,
28
+ y: c
29
+ };
30
+ }, N = (e) => {
31
+ let t = e.data.at(-1);
32
+ if (t === void 0) return null;
33
+ let n = e.frame.y(t.actual), r = e.frame.y(t.plan), i = (n + r) / 2, a = Math.max(Math.abs(n - r), 14) / 2, o = n <= r;
34
+ return /* @__PURE__ */ S("g", {
35
+ className: "fade",
36
+ children: [/* @__PURE__ */ x(f, {
37
+ middle: !0,
38
+ voice: "label",
39
+ x: e.frame.x1 + 8,
40
+ y: o ? i - a : i + a,
41
+ children: O
42
+ }), /* @__PURE__ */ x(f, {
43
+ middle: !0,
44
+ voice: "axis",
45
+ x: e.frame.x1 + 8,
46
+ y: o ? i + a : i - a,
47
+ children: k
48
+ })]
49
+ });
50
+ }, P = (e) => {
51
+ let { frame: n } = e, r = e.width < 520 ? 3 : 2, i = e.data.flatMap((t, n) => {
52
+ let i = e.data[n - 1];
53
+ return (i === void 0 || i.week.getUTCMonth() !== t.week.getUTCMonth()) && t.week.getUTCMonth() % r === 0 ? [n] : [];
54
+ }), a = t(i.map((t) => e.data[t].week));
55
+ return /* @__PURE__ */ S("g", { children: [/* @__PURE__ */ x(_, {
56
+ floor: n.bottom - 8,
57
+ ticks: n.y.ticks(E),
58
+ format: j,
59
+ x0: n.x0,
60
+ x1: n.x1,
61
+ y: n.y
62
+ }), i.map((t, r) => /* @__PURE__ */ x(f, {
63
+ anchor: "middle",
64
+ voice: "axis",
65
+ x: n.x(t),
66
+ y: n.bottom + 22,
67
+ children: a[r]
68
+ }, e.data[t].week.toISOString()))] });
69
+ }, F = (e) => {
70
+ let t = e.frame.x(e.i), n = e.frame.y(e.d.actual), r = e.frame.y(e.d.plan);
71
+ return /* @__PURE__ */ S("g", {
72
+ className: "pointer-events-none",
73
+ children: [
74
+ /* @__PURE__ */ x(u, {
75
+ className: "stroke-ink",
76
+ x: t,
77
+ y0: Math.min(n, r),
78
+ y1: Math.max(n, r)
79
+ }),
80
+ /* @__PURE__ */ x(c, {
81
+ className: "fill-l4",
82
+ cx: t,
83
+ cy: r,
84
+ size: "sm"
85
+ }),
86
+ /* @__PURE__ */ x(c, {
87
+ className: "fill-hero",
88
+ cx: t,
89
+ cy: n,
90
+ size: "md"
91
+ })
92
+ ]
93
+ });
94
+ }, I = (e) => {
95
+ let t = m("plan-gap"), { data: n } = e, r = M(n, e.width, e.height), i = (e, t) => r.x(t), o = C().curve(w).x(i).y0((e) => r.y(e.plan)).y1((e) => r.y(e.actual))(n), s = C().curve(w).x(i).y0(r.top - 8).y1((e) => r.y(e.plan))(n), c = C().curve(w).x(i).y0(r.bottom + 8).y1((e) => r.y(e.plan))(n), u = (e) => T().curve(w).x(i).y((t) => r.y(t[e]))(n) ?? "", f = `Weekly mean temperature in Central England, 2022, against the 1991 to 2020 normal: above normal in ${n.filter((e) => e.actual >= e.plan).length} of ${n.length} weeks`;
96
+ return /* @__PURE__ */ S(d, {
97
+ className: "touch-pan-y",
98
+ height: e.height,
99
+ label: f,
100
+ leave: e.hover.clear,
101
+ onPointerMove: (t) => {
102
+ let i = (t.clientX - t.currentTarget.getBoundingClientRect().left - r.x0) / (r.x1 - r.x0), o = a(Math.round(i * (n.length - 1)), 0, n.length - 1), s = n[o];
103
+ e.hover.show(o, r.x(o), r.y(Math.max(s.actual, s.plan)) - 8);
104
+ },
105
+ width: e.width,
106
+ children: [
107
+ /* @__PURE__ */ S("defs", { children: [
108
+ /* @__PURE__ */ x(h, {
109
+ id: t("lead"),
110
+ tone: "fill-hero"
111
+ }),
112
+ /* @__PURE__ */ x(g, {
113
+ angle: "rising",
114
+ id: t("hatch"),
115
+ tone: "fill-l4"
116
+ }),
117
+ /* @__PURE__ */ x("clipPath", {
118
+ id: t("above"),
119
+ children: /* @__PURE__ */ x("path", { d: s ?? "" })
120
+ }),
121
+ /* @__PURE__ */ x("clipPath", {
122
+ id: t("below"),
123
+ children: /* @__PURE__ */ x("path", { d: c ?? "" })
124
+ })
125
+ ] }),
126
+ /* @__PURE__ */ x(P, {
127
+ data: n,
128
+ frame: r,
129
+ width: e.width
130
+ }),
131
+ /* @__PURE__ */ S("g", {
132
+ className: "fade",
133
+ children: [/* @__PURE__ */ x("path", {
134
+ clipPath: p(t("above")),
135
+ d: o ?? "",
136
+ fill: p(t("lead"))
137
+ }), /* @__PURE__ */ x("path", {
138
+ clipPath: p(t("below")),
139
+ d: o ?? "",
140
+ fill: p(t("hatch"))
141
+ })]
142
+ }),
143
+ /* @__PURE__ */ x(l, {
144
+ x0: r.x0,
145
+ x1: r.x1,
146
+ y: r.bottom
147
+ }),
148
+ /* @__PURE__ */ x("path", {
149
+ className: "draw stroke-l3 stroke-medium cap-round fill-none",
150
+ d: u("plan"),
151
+ pathLength: 1
152
+ }),
153
+ /* @__PURE__ */ x("path", {
154
+ className: "draw stroke-ink stroke-medium cap-round fill-none",
155
+ d: u("actual"),
156
+ pathLength: 1
157
+ }),
158
+ /* @__PURE__ */ x(N, {
159
+ data: n,
160
+ frame: r
161
+ }),
162
+ e.hover.key === null ? null : /* @__PURE__ */ x(F, {
163
+ d: n[e.hover.key],
164
+ frame: r,
165
+ i: e.hover.key
166
+ })
167
+ ]
168
+ });
169
+ }, L = (e) => {
170
+ let t = e.actual - e.plan;
171
+ return t === 0 ? "at normal" : t > 0 ? `${A(t)} above normal` : `${A(-t)} below normal`;
172
+ }, R = (e) => {
173
+ let t = e.data ?? v, a = n();
174
+ return /* @__PURE__ */ x(r, {
175
+ overlay: a.at === null ? null : /* @__PURE__ */ x(i, {
176
+ x: a.at.x,
177
+ y: a.at.y,
178
+ children: /* @__PURE__ */ x(s, {
179
+ facts: [A(t[a.at.key].actual), L(t[a.at.key])],
180
+ lead: `Week of ${D(t[a.at.key].week)}`
181
+ })
182
+ }),
183
+ children: (e) => /* @__PURE__ */ x(I, {
184
+ data: t,
185
+ height: 460,
186
+ hover: a,
187
+ width: e
188
+ })
189
+ });
190
+ };
191
+ //#endregion
192
+ export { R as AreaDifference };
@@ -0,0 +1,42 @@
1
+ "use client";
2
+ import { clamp as e } from "../util.js";
3
+ //#region src/charts/forms/brush-math.ts
4
+ var t = 6, n = (n, r, i) => {
5
+ if (n.grip === "start") return {
6
+ a: e(n.from.a + r, 0, n.from.b - t),
7
+ b: n.from.b
8
+ };
9
+ if (n.grip === "end") return {
10
+ a: n.from.a,
11
+ b: e(n.from.b + r, n.from.a + t, i)
12
+ };
13
+ let a = e(r, -n.from.a, i - n.from.b);
14
+ return {
15
+ a: n.from.a + a,
16
+ b: n.from.b + a
17
+ };
18
+ }, r = (t, n, r) => {
19
+ let i = t.b - t.a, a = e(Math.round(n - i / 2), 0, r - i);
20
+ return {
21
+ a,
22
+ b: a + i
23
+ };
24
+ }, i = (t, n, r) => {
25
+ let i = n.b - n.a;
26
+ if (t === "Home") return {
27
+ a: 0,
28
+ b: i
29
+ };
30
+ if (t === "End") return {
31
+ a: r - i,
32
+ b: r
33
+ };
34
+ if (t !== "ArrowLeft" && t !== "ArrowRight") return null;
35
+ let a = e(t === "ArrowLeft" ? -7 : 7, -n.a, r - n.b);
36
+ return {
37
+ a: n.a + a,
38
+ b: n.b + a
39
+ };
40
+ };
41
+ //#endregion
42
+ export { r as centreOn, n as dragTo, i as keyTo };
@@ -0,0 +1,199 @@
1
+ "use client";
2
+ import { monthTickLabels as e } from "../../lib/format.js";
3
+ import { HitRect as t } from "../hover.js";
4
+ import "../marks.js";
5
+ import { HRule as n } from "../rules.js";
6
+ import { Label as r } from "../text.js";
7
+ import { TEXTURE_PITCH as i, paint as a, useTextureIds as o } from "../texture-ids.js";
8
+ import { Stipple as s } from "../texture.js";
9
+ import { centreOn as c, dragTo as l, keyTo as u } from "./brush-math.js";
10
+ import { useRef as d, useState as f } from "react";
11
+ import { scaleLinear as p } from "d3-scale";
12
+ import { utcFormat as m } from "d3-time-format";
13
+ import { jsx as h, jsxs as g } from "react/jsx-runtime";
14
+ import { area as _, curveMonotoneX as v, line as y } from "d3-shape";
15
+ //#region src/charts/forms/brush-strip.tsx
16
+ var b = 48, x = 22, S = m("%-d %b %Y"), C = 64, w = (e) => {
17
+ let t = e / 12;
18
+ return t >= C ? 1 : t * 2 >= C ? 2 : 3;
19
+ }, T = (t) => {
20
+ let n = t.data.flatMap((e, n) => e.date.getUTCDate() === 1 && e.date.getUTCMonth() % t.every === 0 ? [n] : []), i = e(n.map((e) => t.data[e].date));
21
+ return /* @__PURE__ */ h("g", { children: n.map((e, n) => /* @__PURE__ */ h(r, {
22
+ voice: "axis",
23
+ x: t.x(e) + 4,
24
+ y: 64,
25
+ children: i[n]
26
+ }, t.data[e].date.toISOString())) });
27
+ }, E = (e, t, n, r) => {
28
+ let i = d(null), a = (t) => {
29
+ let n = t.currentTarget.ownerSVGElement?.getBoundingClientRect();
30
+ return e.invert(t.clientX - (n?.left ?? 0));
31
+ }, o = () => {
32
+ i.current = null;
33
+ };
34
+ return (e) => ({
35
+ onLostPointerCapture: o,
36
+ onPointerDown: (o) => {
37
+ o.currentTarget.setPointerCapture(o.pointerId);
38
+ let s = e === "outside" ? c(t, a(o), n) : t;
39
+ e === "outside" && r(s), i.current = {
40
+ from: s,
41
+ grip: e === "outside" ? "body" : e,
42
+ origin: a(o)
43
+ };
44
+ },
45
+ onPointerMove: (e) => {
46
+ if (i.current !== null) {
47
+ let t = Math.round(a(e) - i.current.origin);
48
+ r(l(i.current, t, n));
49
+ }
50
+ },
51
+ onPointerUp: o
52
+ });
53
+ }, D = (e) => {
54
+ let { xa: n, xb: r } = e, i = Math.min(x, Math.max(0, (r - n) / 2)), a = e.focused ? 2 : 1;
55
+ return /* @__PURE__ */ g("g", { children: [
56
+ /* @__PURE__ */ h("rect", {
57
+ className: "stroke-ink shape-crisp fill-none",
58
+ height: b - a,
59
+ strokeWidth: a,
60
+ width: Math.max(1, r - n),
61
+ x: n + a / 2,
62
+ y: a / 2
63
+ }),
64
+ [n + 1, r].map((e) => /* @__PURE__ */ h("line", {
65
+ className: "stroke-ink",
66
+ strokeWidth: 2,
67
+ x1: e,
68
+ x2: e,
69
+ y1: b / 2 - 8,
70
+ y2: 32
71
+ }, e === r ? "end" : "start")),
72
+ /* @__PURE__ */ h(t, {
73
+ className: "cursor-grab active:cursor-grabbing",
74
+ height: b,
75
+ width: Math.max(0, r - n),
76
+ x: n,
77
+ y: 0,
78
+ ...e.grip("body")
79
+ }),
80
+ /* @__PURE__ */ h(t, {
81
+ className: "cursor-ew-resize",
82
+ height: b,
83
+ width: x + i,
84
+ x: n - x,
85
+ y: 0,
86
+ ...e.grip("start")
87
+ }),
88
+ /* @__PURE__ */ h(t, {
89
+ className: "cursor-ew-resize",
90
+ height: b,
91
+ width: x + i,
92
+ x: r - i,
93
+ y: 0,
94
+ ...e.grip("end")
95
+ })
96
+ ] });
97
+ }, O = (e) => {
98
+ let r = o("brush"), [c, l] = f(!1), d = e.data.length - 1, m = p().domain([0, d]).range([e.x0, e.x1]), x = E(m, e.span, d, e.onChange), C = p().domain([Math.min(...e.mean), Math.max(...e.mean)]).range([42, 6]), O = y().x((e, t) => m(t)).y((e) => C(e)).curve(v)(e.mean) ?? "", k = _().x((e, t) => m(t)).y0(47).y1((e) => C(e)).curve(v)(e.mean) ?? "", A = Math.round(m(e.span.a)), j = Math.round(m(e.span.b)), M = e.span.b - e.span.a;
99
+ return /* @__PURE__ */ g("div", {
100
+ className: "relative",
101
+ children: [/* @__PURE__ */ h("input", {
102
+ "aria-label": "Window over the year",
103
+ "aria-valuetext": `${S(e.data[e.span.a].date)} to ${S(e.data[e.span.b].date)}`,
104
+ className: "sr-only",
105
+ max: d - M,
106
+ min: 0,
107
+ onBlur: () => {
108
+ l(!1);
109
+ },
110
+ onChange: (t) => {
111
+ let n = Number(t.currentTarget.value);
112
+ e.onChange({
113
+ a: n,
114
+ b: n + M
115
+ });
116
+ },
117
+ onFocus: () => {
118
+ l(!0);
119
+ },
120
+ onKeyDown: (t) => {
121
+ let n = u(t.key, e.span, d);
122
+ n !== null && (t.preventDefault(), e.onChange(n));
123
+ },
124
+ type: "range",
125
+ value: e.span.a
126
+ }), /* @__PURE__ */ g("svg", {
127
+ "aria-hidden": "true",
128
+ className: "touch-none",
129
+ height: 72,
130
+ width: e.width,
131
+ children: [
132
+ /* @__PURE__ */ g("defs", { children: [
133
+ /* @__PURE__ */ h("clipPath", {
134
+ id: r("in"),
135
+ children: /* @__PURE__ */ h("rect", {
136
+ height: b,
137
+ width: Math.max(0, j - A),
138
+ x: A,
139
+ y: 0
140
+ })
141
+ }),
142
+ /* @__PURE__ */ h(s, {
143
+ id: r("out"),
144
+ pitch: i.dense,
145
+ tone: "fill-l5"
146
+ }),
147
+ /* @__PURE__ */ h(s, {
148
+ id: r("sel"),
149
+ pitch: i.dense,
150
+ tone: "fill-l4"
151
+ })
152
+ ] }),
153
+ /* @__PURE__ */ h(n, {
154
+ x0: e.x0,
155
+ x1: e.x1,
156
+ y: 47
157
+ }),
158
+ /* @__PURE__ */ h("path", {
159
+ d: k,
160
+ fill: a(r("out"))
161
+ }),
162
+ /* @__PURE__ */ h("path", {
163
+ clipPath: a(r("in")),
164
+ d: k,
165
+ fill: a(r("sel"))
166
+ }),
167
+ /* @__PURE__ */ h("path", {
168
+ className: "stroke-l5 stroke-medium cap-round fill-none",
169
+ d: O
170
+ }),
171
+ /* @__PURE__ */ h("path", {
172
+ className: "stroke-l2 stroke-medium cap-round fill-none",
173
+ clipPath: a(r("in")),
174
+ d: O
175
+ }),
176
+ /* @__PURE__ */ h(T, {
177
+ data: e.data,
178
+ every: w(e.x1 - e.x0),
179
+ x: (e) => m(e)
180
+ }),
181
+ /* @__PURE__ */ h(t, {
182
+ height: b,
183
+ width: e.x1 - e.x0,
184
+ x: e.x0,
185
+ y: 0,
186
+ ...x("outside")
187
+ }),
188
+ /* @__PURE__ */ h(D, {
189
+ focused: c,
190
+ grip: x,
191
+ xa: A,
192
+ xb: j
193
+ })
194
+ ]
195
+ })]
196
+ });
197
+ };
198
+ //#endregion
199
+ export { O as BrushStrip };