@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,72 @@
1
+ import { utcFormat as e } from "d3-time-format";
2
+ import { z as t } from "zod";
3
+ //#region src/schema/format.ts
4
+ var n = [
5
+ "integer",
6
+ "decimal",
7
+ "compact",
8
+ "percent"
9
+ ], r = t.strictObject({
10
+ compactDisplay: t.enum(["short", "long"]).optional(),
11
+ currency: t.string().length(3).optional(),
12
+ locale: t.string().min(2).optional(),
13
+ maximumFractionDigits: t.number().int().min(0).max(20).optional(),
14
+ minimumFractionDigits: t.number().int().min(0).max(20).optional(),
15
+ notation: t.enum(["standard", "compact"]).optional(),
16
+ signDisplay: t.enum([
17
+ "auto",
18
+ "always",
19
+ "exceptZero",
20
+ "never"
21
+ ]).optional(),
22
+ style: t.enum([
23
+ "decimal",
24
+ "percent",
25
+ "currency",
26
+ "unit"
27
+ ]).optional(),
28
+ unit: t.string().optional(),
29
+ useGrouping: t.boolean().optional()
30
+ }), i = t.union([t.enum(n), r]), a = t.instanceof(Function).pipe(t.custom()), o = t.instanceof(Function).pipe(t.custom()), s = t.enum(n), c = {
31
+ compact: new Intl.NumberFormat("en-US", {
32
+ compactDisplay: "short",
33
+ maximumFractionDigits: 1,
34
+ notation: "compact"
35
+ }),
36
+ decimal: new Intl.NumberFormat("en-US", {
37
+ maximumFractionDigits: 1,
38
+ minimumFractionDigits: 1
39
+ }),
40
+ integer: new Intl.NumberFormat("en-US", { maximumFractionDigits: 0 }),
41
+ percent: new Intl.NumberFormat("en-US", {
42
+ maximumFractionDigits: 0,
43
+ style: "percent"
44
+ })
45
+ }, l = /* @__PURE__ */ new Map(), u = (e) => {
46
+ if (e === void 0) return String;
47
+ let t = a.safeParse(e);
48
+ if (t.success) return t.data;
49
+ let n = s.safeParse(e);
50
+ if (n.success) return (e) => c[n.data].format(e);
51
+ let i = JSON.stringify(e), o = l.get(i);
52
+ if (o === void 0) {
53
+ let { locale: t, ...n } = r.parse(e);
54
+ o = new Intl.NumberFormat(t ?? "en-US", n), l.set(i, o);
55
+ }
56
+ let u = o;
57
+ return (e) => u.format(e);
58
+ }, d = [
59
+ "day-month",
60
+ "day-month-year",
61
+ "month-year"
62
+ ], f = t.enum(d), p = {
63
+ "day-month": e("%-d %b"),
64
+ "day-month-year": e("%-d %b %Y"),
65
+ "month-year": e("%b %Y")
66
+ }, m = (e) => {
67
+ if (e === void 0) return p["day-month"];
68
+ let t = o.safeParse(e);
69
+ return t.success ? t.data : p[f.parse(e)];
70
+ };
71
+ //#endregion
72
+ export { d as DATE_FORMAT_PRESETS, n as FORMAT_PRESETS, f as dateFormatSchema, i as formatSchema, r as intlFormatSchema, m as resolveDateFormat, u as resolveFormat };
@@ -0,0 +1,24 @@
1
+ import { dateFormatSchema as e, formatSchema as t } from "./format.js";
2
+ import { keyOf as n } from "./key.js";
3
+ import { noteShape as r, sharedShape as i } from "./options.js";
4
+ import { dailyDatumSchema as a } from "./daily.js";
5
+ import { z as o } from "zod";
6
+ //#region src/schema/hairline-area.ts
7
+ var s = o.strictObject({
8
+ ...r,
9
+ ...i,
10
+ data: o.array(a).min(1).max(731).describe("Readings by date, in any order. A null value is a gap."),
11
+ dateFormat: e.optional().describe("How dates print on the axis and in the tooltip. Defaults to day-month."),
12
+ emphasis: o.string().optional().describe("The reading to draw in the hero colour, by key. Defaults to the peak."),
13
+ format: t.optional().describe("How values print: a preset name or Intl number-format options."),
14
+ height: o.number().int().positive().optional().describe("Fixed height in px. Without it an area chart is 440 tall."),
15
+ initialWidth: o.number().int().positive().optional().describe("Responsive mode only: the width of the first render, before measuring."),
16
+ maxWidth: o.number().positive().optional().describe("Widest the plot gets, in px. Defaults to 640."),
17
+ ticks: o.array(o.number()).min(2).max(12).optional().describe("Value-axis ticks, ascending; the scale runs from 0 to the last."),
18
+ width: o.number().int().positive().optional().describe("Fixed width in px. Giving it turns measuring off.")
19
+ }).refine((e) => e.emphasis === void 0 || e.data.some((t) => n(t) === e.emphasis), {
20
+ message: "emphasis names no reading: it must equal a datum's id or date",
21
+ path: ["emphasis"]
22
+ });
23
+ //#endregion
24
+ export { s as hairlineAreaSchema };
@@ -0,0 +1,23 @@
1
+ import { dateFormatSchema as e, formatSchema as t } from "./format.js";
2
+ import { keyOf as n } from "./key.js";
3
+ import { noteShape as r, sharedShape as i } from "./options.js";
4
+ import { dailyDatumSchema as a } from "./daily.js";
5
+ import { z as o } from "zod";
6
+ //#region src/schema/hairline-line.ts
7
+ var s = o.strictObject({
8
+ ...r,
9
+ ...i,
10
+ data: o.array(a).min(1).max(731).describe("Readings by date, in any order. A null value is a gap."),
11
+ dateFormat: e.optional().describe("How dates print on the axis and in the tooltip. Defaults to day-month."),
12
+ emphasis: o.string().optional().describe("The reading to draw in the hero colour, by key. Defaults to `extreme`."),
13
+ extreme: o.enum(["peak", "trough"]).optional().describe("Which extreme the hero marks when `emphasis` is not given."),
14
+ format: t.optional().describe("How values print: a preset name or Intl number-format options."),
15
+ height: o.number().int().positive().optional().describe("Fixed height in px. Without it a line chart is 440 tall."),
16
+ initialWidth: o.number().int().positive().optional().describe("Responsive mode only: the width of the first render, before measuring."),
17
+ width: o.number().int().positive().optional().describe("Fixed width in px. Giving it turns measuring off.")
18
+ }).refine((e) => e.emphasis === void 0 || e.data.some((t) => n(t) === e.emphasis), {
19
+ message: "emphasis names no reading: it must equal a datum's id or date",
20
+ path: ["emphasis"]
21
+ });
22
+ //#endregion
23
+ export { s as hairlineLineSchema };
@@ -0,0 +1,4 @@
1
+ //#region src/schema/key.ts
2
+ var e = (e) => e.id === void 0 ? "label" in e ? e.label : "name" in e ? e.name : e.date : e.id;
3
+ //#endregion
4
+ export { e as keyOf };
@@ -0,0 +1,26 @@
1
+ import { z as e } from "zod";
2
+ //#region src/schema/metrics.ts
3
+ var t = e.strictObject({
4
+ advances: e.record(e.string().length(1), e.number().positive()),
5
+ fallback: e.number().positive(),
6
+ tabular: e.number().positive().optional()
7
+ }), n = (e, t) => Object.fromEntries(e.split("").map((e) => [e, t])), r = {
8
+ advances: {
9
+ ...n(" !',.:;Iijl|·’", .3),
10
+ ...n("()/1[]frt", .41),
11
+ ...n("mw", .9),
12
+ ...n("%@MW—…", 1.02)
13
+ },
14
+ fallback: .63,
15
+ tabular: .65
16
+ }, i = .76, a = /\d/u, o = (e, t, n) => {
17
+ if (n && t.tabular !== void 0 && a.test(e)) return t.tabular;
18
+ let o = t.advances[e];
19
+ return o === void 0 ? t === r && e !== e.toLowerCase() ? i : t.fallback : o;
20
+ }, s = (e, t, n = r, i = !1) => {
21
+ let a = 0;
22
+ for (let t of e) a += o(t, n, i);
23
+ return a * t;
24
+ };
25
+ //#endregion
26
+ export { r as INTER_METRICS, t as fontMetricsSchema, s as textWidth };
@@ -0,0 +1,12 @@
1
+ import { z as e } from "zod";
2
+ //#region src/schema/motion.ts
3
+ var t = {
4
+ animate: e.enum([
5
+ "scroll",
6
+ "mount",
7
+ "off"
8
+ ]).optional().describe("When the entry draws in: \"scroll\" as the chart scrolls into view, \"mount\" at once, \"off\" never (drawn, and ready, in the first HTML). The default is \"off\" for a fixed-size chart and \"scroll\" for a responsive one. Under reduced motion the chart is drawn in the first paint."),
9
+ replayKey: e.union([e.string(), e.number()]).optional().describe("Change it to replay the entry without remounting the chart.")
10
+ };
11
+ //#endregion
12
+ export { t as motionShape };
@@ -0,0 +1,21 @@
1
+ import { fontMetricsSchema as e } from "./metrics.js";
2
+ import { motionShape as t } from "./motion.js";
3
+ import { scaleShape as n } from "./scale.js";
4
+ import { z as r } from "zod";
5
+ //#region src/schema/options.ts
6
+ var i = {
7
+ ...t,
8
+ ...n,
9
+ idPrefix: r.string().regex(/^[A-Za-z][\w-]*$/u).optional().describe("Leads every SVG id, to separate charts rendered in separate React roots on one page."),
10
+ metrics: e.optional().describe("Glyph widths of a face other than Inter, so notes wrap and reserve room for it."),
11
+ table: r.boolean().optional().describe("Show the data table to sighted readers too. It is always there for screen readers."),
12
+ title: r.string().min(1).optional().describe("The chart's accessible name. Each chart has a default that reads the data.")
13
+ }, a = {
14
+ note: r.string().optional().meta({
15
+ deprecated: !0,
16
+ description: "Deprecated: use `unitNote`."
17
+ }),
18
+ unitNote: r.string().optional().describe("The in-plot key under the axis.")
19
+ };
20
+ //#endregion
21
+ export { a as noteShape, i as sharedShape };
@@ -0,0 +1,48 @@
1
+ import { formatSchema as e } from "./format.js";
2
+ import { keyOf as t } from "./key.js";
3
+ import { noteShape as n, sharedShape as r } from "./options.js";
4
+ import { z as i } from "zod";
5
+ //#region src/schema/plumb-scatter.ts
6
+ var a = i.strictObject({
7
+ id: i.string().min(1).optional().describe("A unique key, for when two points share a label."),
8
+ label: i.string().describe("Names the point, and is its key unless `id` is given."),
9
+ x: i.number().describe("Position along the x axis."),
10
+ y: i.number().describe("Position up the y axis.")
11
+ }), o = i.tuple([i.number(), i.number()]), s = i.strictObject({
12
+ ...n,
13
+ ...r,
14
+ data: i.array(a).min(1).max(20).describe("The points, 1 to 20."),
15
+ emphasis: i.string().optional().describe("The point to draw in the hero colour, by key. Defaults to the highest."),
16
+ format: e.optional().describe("How y prints: a preset name or Intl number-format options."),
17
+ formatX: e.optional().describe("How x prints. Defaults to a rounded integer."),
18
+ height: i.number().int().positive().optional().describe("Fixed height in px. Without it a scatter is 440 tall."),
19
+ initialWidth: i.number().int().positive().optional().describe("Responsive mode only: the width of the first render, before measuring."),
20
+ labelled: i.array(i.string()).optional().describe("Points to name beside their dot, by key. Defaults to the highest and lowest."),
21
+ width: i.number().int().positive().optional().describe("Fixed width in px. Giving it turns measuring off."),
22
+ xDomain: o.optional().describe("The x axis range, [low, high]."),
23
+ xLabels: i.tuple([i.string(), i.string()]).optional().describe("Names for the low and high ends of the x axis."),
24
+ yDomain: o.optional().describe("The y axis range, [low, high]."),
25
+ yLabel: i.string().optional().describe("Name for the y direction, drawn up the left side.")
26
+ }).superRefine((e, n) => {
27
+ let r = new Set(e.data.map(t));
28
+ e.emphasis !== void 0 && !r.has(e.emphasis) && n.addIssue({
29
+ code: "custom",
30
+ message: "emphasis names no point: it must equal a datum's id or label",
31
+ path: ["emphasis"]
32
+ });
33
+ for (let [t, i] of (e.labelled ?? []).entries()) r.has(i) || n.addIssue({
34
+ code: "custom",
35
+ message: "labelled names no point: it must equal a datum's id or label",
36
+ path: ["labelled", t]
37
+ });
38
+ for (let t of ["xDomain", "yDomain"]) {
39
+ let r = e[t];
40
+ r !== void 0 && !(r[0] < r[1]) && n.addIssue({
41
+ code: "custom",
42
+ message: `${t} must run from low to high`,
43
+ path: [t]
44
+ });
45
+ }
46
+ });
47
+ //#endregion
48
+ export { a as plumbDatumSchema, s as plumbScatterSchema };
@@ -0,0 +1,132 @@
1
+ import { dumbbellQueueSchema as e } from "./dumbbell-queue.js";
2
+ import { hairlineAreaSchema as t } from "./hairline-area.js";
3
+ import { hairlineLineSchema as n } from "./hairline-line.js";
4
+ import { plumbScatterSchema as r } from "./plumb-scatter.js";
5
+ import { rungBarsSchema as i } from "./rung-bars.js";
6
+ import { slopeSchema as a } from "./slope.js";
7
+ import { validate as o } from "./validate.js";
8
+ //#region src/schema/registry.ts
9
+ var s = (e) => ({
10
+ ...e,
11
+ validate: (t) => o(e.schema, t)
12
+ }), c = {
13
+ "dumbbell-queue": s({
14
+ component: "DumbbellQueue",
15
+ dataShape: "data: { label: string; before: number; after: number; id?: string }[], one row each; optional emphasis (a row's id or label), alert (\"rise\" or \"fall\": the direction drawn in the alert colour), unit (change per rung), ends (two axis labels), format, note.",
16
+ jobs: ["deviation", "change-over-time"],
17
+ kind: "dumbbell-queue",
18
+ limits: {
19
+ categories: {
20
+ max: 12,
21
+ min: 1
22
+ },
23
+ series: {
24
+ max: 2,
25
+ min: 2
26
+ }
27
+ },
28
+ schema: e,
29
+ whenNotToUse: "More than a dozen rows, more than two states per row, or changes so large that counting rungs is hopeless (raise `unit`).",
30
+ whenToUse: "The same few things measured at two moments, or against a target: how far each moved, and which way."
31
+ }),
32
+ "hairline-area": s({
33
+ component: "HairlineArea",
34
+ dataShape: "data: { date: ISO string; value: number | null; id?: string }[], one reading a day; optional emphasis (a reading's id or date), format, dateFormat, ticks (value-axis ticks from 0), maxWidth, note. A null value is a gap.",
35
+ jobs: ["change-over-time", "magnitude"],
36
+ kind: "hairline-area",
37
+ limits: {
38
+ categories: {
39
+ max: 731,
40
+ min: 1
41
+ },
42
+ series: {
43
+ max: 1,
44
+ min: 1
45
+ }
46
+ },
47
+ schema: t,
48
+ whenNotToUse: "Values that go negative (the area is drawn from zero), several series, readings that are not daily, or a chart where the exact path matters more than the volume under it.",
49
+ whenToUse: "One quantity measured every day over weeks to a year, where the volume under the line is the story: daylight, sales, traffic."
50
+ }),
51
+ "hairline-line": s({
52
+ component: "HairlineLine",
53
+ dataShape: "data: { date: ISO string; value: number | null; id?: string }[], one reading a day; optional emphasis (a reading's id or date), extreme (peak or trough, when no emphasis), format, dateFormat, note. A null value is a gap.",
54
+ jobs: ["change-over-time", "ranking"],
55
+ kind: "hairline-line",
56
+ limits: {
57
+ categories: {
58
+ max: 731,
59
+ min: 1
60
+ },
61
+ series: {
62
+ max: 1,
63
+ min: 1
64
+ }
65
+ },
66
+ schema: n,
67
+ whenNotToUse: "More than one series, readings that are not daily, or hundreds of points where individual dots stop being readable (use the area).",
68
+ whenToUse: "One quantity read every day for a few weeks, where each day is worth a dot and the peak or trough is the point: a price, a temperature."
69
+ }),
70
+ "plumb-scatter": s({
71
+ component: "PlumbScatter",
72
+ dataShape: "data: { label: string; x: number; y: number; id?: string }[], one point each; optional emphasis and labelled (points' ids or labels), format and formatX, xDomain, yDomain, xLabels [low, high], yLabel, note.",
73
+ jobs: ["correlation", "ranking"],
74
+ kind: "plumb-scatter",
75
+ limits: {
76
+ categories: {
77
+ max: 20,
78
+ min: 1
79
+ },
80
+ series: {
81
+ max: 1,
82
+ min: 1
83
+ }
84
+ },
85
+ schema: r,
86
+ whenNotToUse: "More than about twenty points, several series, or when the reader needs to read y off a scale rather than from a stem and a name: the stems carry x, the height carries y.",
87
+ whenToUse: "A dozen or so named things measured on two quantities, to show whether they move together and which stand apart."
88
+ }),
89
+ "rung-bars": s({
90
+ component: "RungBars",
91
+ dataShape: "data: { label: string; value: number; id?: string }[], one bar each; optional emphasis (a bar's id or label), unit (value per rung), format, unitNote.",
92
+ jobs: ["magnitude", "ranking"],
93
+ kind: "rung-bars",
94
+ limits: {
95
+ categories: {
96
+ max: 24,
97
+ min: 1
98
+ },
99
+ series: {
100
+ max: 1,
101
+ min: 1
102
+ }
103
+ },
104
+ schema: i,
105
+ whenNotToUse: "Values in the thousands (one rung per unit becomes a solid block; raise `unit`), negative values, many categories, or more than one series.",
106
+ whenToUse: "A handful of counts the reader can tally by eye: years against events, one number per category."
107
+ }),
108
+ slope: s({
109
+ component: "Slope",
110
+ dataShape: "rows: { name: string; from: number; to: number; id?: string }[], one line each; labels: [string, string] naming the two points; optional emphasis (a row's id or name), domain ([low, high]), format and narrowFormat, label (accessible name).",
111
+ jobs: ["change-over-time", "ranking"],
112
+ kind: "slope",
113
+ limits: {
114
+ categories: {
115
+ max: 12,
116
+ min: 1
117
+ },
118
+ series: {
119
+ max: 1,
120
+ min: 1
121
+ }
122
+ },
123
+ schema: a,
124
+ whenNotToUse: "More than two points in time (use a line), more than a dozen rows (the labels collide), or a single total with no rows to compare.",
125
+ whenToUse: "The change between two points for a handful of rows: before and after, this year against last, where the reader should see which rose and which fell."
126
+ })
127
+ }, l = Object.values(c);
128
+ function u(e) {
129
+ return l.find((t) => t.kind === e);
130
+ }
131
+ //#endregion
132
+ export { c as charts, u as getChart, l as registry };
@@ -0,0 +1,25 @@
1
+ import { formatSchema as e } from "./format.js";
2
+ import { keyOf as t } from "./key.js";
3
+ import { noteShape as n, sharedShape as r } from "./options.js";
4
+ import { z as i } from "zod";
5
+ //#region src/schema/rung-bars.ts
6
+ var a = i.strictObject({
7
+ id: i.string().min(1).optional().describe("A unique key, for when two bars share a label."),
8
+ label: i.string().describe("Names the bar, and is its key unless `id` is given."),
9
+ value: i.number().describe("The bar's value, counted off in rungs of `unit`.")
10
+ }), o = i.strictObject({
11
+ ...n,
12
+ ...r,
13
+ data: i.array(a).min(1).max(24).describe("The bars, 1 to 24."),
14
+ emphasis: i.string().optional().describe("The bar to draw in the hero colour, by key. Defaults to the largest."),
15
+ format: e.optional().describe("How values print: a preset name or Intl number-format options."),
16
+ height: i.number().int().positive().optional().describe("Fixed height in px. Without it a bar chart is 460 tall."),
17
+ initialWidth: i.number().int().positive().optional().describe("Responsive mode only: the width of the first render, before measuring."),
18
+ unit: i.number().positive().optional().describe("Units per rung."),
19
+ width: i.number().int().positive().optional().describe("Fixed width in px. Giving it turns measuring off.")
20
+ }).refine((e) => e.emphasis === void 0 || e.data.some((n) => t(n) === e.emphasis), {
21
+ message: "emphasis names no bar: it must equal a datum's id or label",
22
+ path: ["emphasis"]
23
+ });
24
+ //#endregion
25
+ export { o as rungBarsSchema, a as rungDatumSchema };
@@ -0,0 +1,9 @@
1
+ import { z as e } from "zod";
2
+ //#region src/schema/scale.ts
3
+ var t = {
4
+ fit: e.boolean().optional().describe("Fill the container's width at the chart's aspect ratio. Wins over `scale`."),
5
+ scale: e.number().positive().optional().describe("Slides: draw at the logical width, then show the composition this many times larger, type and textures with it."),
6
+ strokes: e.enum(["proportional", "device"]).optional().describe("\"device\" keeps every stroke at one device pixel, and is the default when the chart is scaled (`scale` or `fit`); \"proportional\" scales strokes with the composition. It acts on stroked geometry only (rules, lines, rings, outlines): filled marks, such as the bars of RungBars, scale either way.")
7
+ };
8
+ //#endregion
9
+ export { t as scaleShape };
@@ -0,0 +1,28 @@
1
+ import { formatSchema as e } from "./format.js";
2
+ import { keyOf as t } from "./key.js";
3
+ import { sharedShape as n } from "./options.js";
4
+ import { z as r } from "zod";
5
+ //#region src/schema/slope.ts
6
+ var i = r.strictObject({
7
+ from: r.number().describe("The value at the left point."),
8
+ id: r.string().min(1).optional().describe("A unique key, for when two rows share a name."),
9
+ name: r.string().describe("Names the row, and is its key unless `id` is given."),
10
+ to: r.number().describe("The value at the right point.")
11
+ }), a = r.strictObject({
12
+ ...n,
13
+ domain: r.tuple([r.number(), r.number()]).refine(([e, t]) => e < t, { message: "domain must run from lower to higher" }).optional().describe("The y range as [lowest, highest]. Defaults to the extent of the rows."),
14
+ emphasis: r.string().optional().describe("The row to draw in the hero colour, by key. Defaults to the biggest fall."),
15
+ format: e.optional().describe("How values print: a preset name or Intl number-format options."),
16
+ height: r.number().int().positive().optional().describe("Fixed height in px. Without it a slope chart is 420 tall."),
17
+ initialWidth: r.number().int().positive().optional().describe("Responsive mode only: the width of the first render, before measuring."),
18
+ label: r.string().optional().describe("The accessible name. Defaults to a reading of the rows."),
19
+ labels: r.tuple([r.string(), r.string()]).describe("Names the two points, left then right, e.g. [\"Jan 2023\", \"Dec 2024\"]."),
20
+ narrowFormat: e.optional().describe("The same on a phone (under 520px wide), where a unit would crowd the columns."),
21
+ rows: r.array(i).min(1).max(12).describe("The rows, 1 to 12."),
22
+ width: r.number().int().positive().optional().describe("Fixed width in px. Giving it turns measuring off.")
23
+ }).refine((e) => e.emphasis === void 0 || e.rows.some((n) => t(n) === e.emphasis), {
24
+ message: "emphasis names no row: it must equal a row's id or name",
25
+ path: ["emphasis"]
26
+ });
27
+ //#endregion
28
+ export { i as slopeRowSchema, a as slopeSchema };
@@ -0,0 +1,25 @@
1
+ //#region src/schema/validate.ts
2
+ var e = (e) => Number.isInteger(e) ? Number(e) : String(e), t = (e) => {
3
+ let t = "";
4
+ for (let n of e) t += Number.isInteger(n) ? `[${n}]` : t === "" ? String(n) : `.${n}`;
5
+ return t;
6
+ }, n = (n, r) => {
7
+ let i = n.safeParse(r);
8
+ return i.success ? {
9
+ ok: !0,
10
+ value: i.data
11
+ } : {
12
+ issues: i.error.issues.map((n) => {
13
+ let r = n.path.map(e);
14
+ return {
15
+ code: n.code,
16
+ message: n.message,
17
+ path: r,
18
+ pointer: t(r)
19
+ };
20
+ }),
21
+ ok: !1
22
+ };
23
+ };
24
+ //#endregion
25
+ export { t as pointerOf, n as validate };
package/lib/schema.js ADDED
@@ -0,0 +1,16 @@
1
+ import { DATE_FORMAT_PRESETS as e, FORMAT_PRESETS as t, dateFormatSchema as n, formatSchema as r, intlFormatSchema as i, resolveDateFormat as a, resolveFormat as o } from "./schema/format.js";
2
+ import { keyOf as s } from "./schema/key.js";
3
+ import { INTER_METRICS as c, fontMetricsSchema as l, textWidth as u } from "./schema/metrics.js";
4
+ import { motionShape as d } from "./schema/motion.js";
5
+ import { scaleShape as f } from "./schema/scale.js";
6
+ import { noteShape as p, sharedShape as m } from "./schema/options.js";
7
+ import { dumbbellDatumSchema as h, dumbbellQueueSchema as g } from "./schema/dumbbell-queue.js";
8
+ import { dailyDatumSchema as _, isoDateSchema as v } from "./schema/daily.js";
9
+ import { hairlineAreaSchema as y } from "./schema/hairline-area.js";
10
+ import { hairlineLineSchema as b } from "./schema/hairline-line.js";
11
+ import { plumbDatumSchema as x, plumbScatterSchema as S } from "./schema/plumb-scatter.js";
12
+ import { rungBarsSchema as C, rungDatumSchema as w } from "./schema/rung-bars.js";
13
+ import { slopeRowSchema as T, slopeSchema as E } from "./schema/slope.js";
14
+ import { pointerOf as D, validate as O } from "./schema/validate.js";
15
+ import { charts as k, getChart as A, registry as j } from "./schema/registry.js";
16
+ export { e as DATE_FORMAT_PRESETS, t as FORMAT_PRESETS, c as INTER_METRICS, k as charts, _ as dailyDatumSchema, n as dateFormatSchema, h as dumbbellDatumSchema, g as dumbbellQueueSchema, l as fontMetricsSchema, r as formatSchema, A as getChart, y as hairlineAreaSchema, b as hairlineLineSchema, i as intlFormatSchema, v as isoDateSchema, s as keyOf, d as motionShape, p as noteShape, x as plumbDatumSchema, S as plumbScatterSchema, D as pointerOf, j as registry, a as resolveDateFormat, o as resolveFormat, C as rungBarsSchema, w as rungDatumSchema, f as scaleShape, m as sharedShape, T as slopeRowSchema, E as slopeSchema, u as textWidth, O as validate };
@@ -0,0 +1,98 @@
1
+ //#region src/theme/derive.ts
2
+ var e = {
3
+ dark: {
4
+ alert: "#d87a6e",
5
+ grain: .036,
6
+ grid: .931,
7
+ hero: .105,
8
+ muted: .442,
9
+ ramp: [
10
+ 0,
11
+ .148,
12
+ .296,
13
+ .442,
14
+ .589,
15
+ .725,
16
+ .832
17
+ ],
18
+ rule: .887
19
+ },
20
+ light: {
21
+ alert: "#c05951",
22
+ grain: .045,
23
+ grid: .942,
24
+ hero: 0,
25
+ muted: .39,
26
+ ramp: [
27
+ 0,
28
+ .17,
29
+ .33,
30
+ .49,
31
+ .64,
32
+ .78,
33
+ .89
34
+ ],
35
+ rule: .9
36
+ }
37
+ }, t = (e) => e <= .04045 ? e / 12.92 : ((e + .055) / 1.055) ** 2.4, n = (e) => e <= .0031308 ? e * 12.92 : 1.055 * e ** (1 / 2.4) - .055, r = /^#(?<digits>[\da-f]{3}|[\da-f]{6})$/iu, i = (e) => {
38
+ let n = r.exec(e.trim())?.groups?.digits;
39
+ if (n === void 0) throw TypeError(`deriveTheme: "${e}" is not a #rgb or #rrggbb colour`);
40
+ let i = n.length === 3 ? n.replaceAll(/[\da-f]/giu, (e) => e + e) : n, a = (e) => t(Number.parseInt(i.slice(e, e + 2), 16) / 255);
41
+ return [
42
+ a(0),
43
+ a(2),
44
+ a(4)
45
+ ];
46
+ }, a = (e) => {
47
+ let [t, n, r] = i(e), a = Math.cbrt(.4122214708 * t + .5363325363 * n + .0514459929 * r), o = Math.cbrt(.2119034982 * t + .6806995451 * n + .1073969566 * r), s = Math.cbrt(.0883024619 * t + .2817188376 * n + .6299787005 * r);
48
+ return [
49
+ .2104542553 * a + .793617785 * o - .0040720468 * s,
50
+ 1.9779984951 * a - 2.428592205 * o + .4505937099 * s,
51
+ .0259040371 * a + .7827717662 * o - .808675766 * s
52
+ ];
53
+ }, o = (e) => Math.round(Math.min(1, Math.max(0, n(e))) * 255).toString(16).padStart(2, "0"), s = ([e, t, n]) => {
54
+ let r = (e + .3963377774 * t + .2158037573 * n) ** 3, i = (e - .1055613458 * t - .0638541728 * n) ** 3, a = (e - .0894841775 * t - 1.291485548 * n) ** 3;
55
+ return `#${o(4.0767416621 * r - 3.3077115913 * i + .2309699292 * a)}${o(-1.2684380046 * r + 2.6097574011 * i - .3413193965 * a)}${o(-.0041960863 * r - .7034186147 * i + 1.707614701 * a)}`;
56
+ }, c = (e, t, n) => [
57
+ e[0] + (t[0] - e[0]) * n,
58
+ e[1] + (t[1] - e[1]) * n,
59
+ e[2] + (t[2] - e[2]) * n
60
+ ], l = (e) => s(a(e)), u = (e, t) => {
61
+ let [r, a, o] = i(e), [s, c, l] = [
62
+ r,
63
+ a,
64
+ o
65
+ ].map((e) => n(e).toFixed(3));
66
+ return `url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 ${s} 0 0 0 0 ${c} 0 0 0 0 ${l} 0 0 0 ${t} 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url%28%23g%29'/%3E%3C/svg%3E")`;
67
+ }, d = (t) => {
68
+ let n = e[t.mode ?? "light"], r = l(t.paper), i = l(t.ink), o = a(i), d = a(r), f = (e) => s(c(o, d, e)), p = (e, t) => e === void 0 || e === "" ? t() : l(e), [m, h, g, _, v, y, b] = n.ramp, x = f(m), S = f(h), C = f(g), w = f(_), T = f(v), E = f(y), D = f(b), O = {
69
+ "--hl-alert": l(t.alert ?? n.alert),
70
+ "--hl-faint": T,
71
+ "--hl-grain": u(i, n.grain),
72
+ "--hl-grid": p(t.grid, () => f(n.grid)),
73
+ "--hl-heat-1": D,
74
+ "--hl-heat-2": T,
75
+ "--hl-heat-3": w,
76
+ "--hl-heat-4": S,
77
+ "--hl-heat-5": x,
78
+ "--hl-hero": p(t.hero, () => f(n.hero)),
79
+ "--hl-ink": i,
80
+ "--hl-l0": x,
81
+ "--hl-l1": S,
82
+ "--hl-l2": C,
83
+ "--hl-l3": w,
84
+ "--hl-l4": T,
85
+ "--hl-l5": E,
86
+ "--hl-l6": D,
87
+ "--hl-muted": f(n.muted),
88
+ "--hl-paper": r,
89
+ "--hl-rule": p(t.rule, () => f(n.rule)),
90
+ "--hl-text": i
91
+ };
92
+ return t.font === void 0 || t.font === "" ? O : {
93
+ ...O,
94
+ "--hl-font": t.font
95
+ };
96
+ };
97
+ //#endregion
98
+ export { d as deriveTheme };