@tabler/charts 0.0.0-stage → 0.0.1-alpha.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 (324) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +248 -2
  3. package/dist/annotations-Bp7HwtF5.d.ts +86 -0
  4. package/dist/annotations-BszTTjf9.js +202 -0
  5. package/dist/annotations-BszTTjf9.js.map +1 -0
  6. package/dist/annotations-DpETO8dE.cjs +213 -0
  7. package/dist/annotations-DpETO8dE.cjs.map +1 -0
  8. package/dist/annotations-lyt0I3HU.d.cts +86 -0
  9. package/dist/annotations.cjs +14 -0
  10. package/dist/annotations.cjs.map +1 -0
  11. package/dist/annotations.d.cts +2 -0
  12. package/dist/annotations.d.ts +2 -0
  13. package/dist/annotations.js +12 -0
  14. package/dist/annotations.js.map +1 -0
  15. package/dist/area-BFvkc-ZM.d.cts +20 -0
  16. package/dist/area-DQsLERhx.js +26 -0
  17. package/dist/area-DQsLERhx.js.map +1 -0
  18. package/dist/area-DaO4MQl4.d.ts +20 -0
  19. package/dist/area-sHCE3pg5.cjs +31 -0
  20. package/dist/area-sHCE3pg5.cjs.map +1 -0
  21. package/dist/area.cjs +3 -0
  22. package/dist/area.d.cts +2 -0
  23. package/dist/area.d.ts +2 -0
  24. package/dist/area.js +2 -0
  25. package/dist/band-DTcNDAFO.d.cts +50 -0
  26. package/dist/band-DTcNDAFO.d.ts +50 -0
  27. package/dist/bar-C-7zR2qp.cjs +243 -0
  28. package/dist/bar-C-7zR2qp.cjs.map +1 -0
  29. package/dist/bar-DGuUN3nc.cjs +67 -0
  30. package/dist/bar-DGuUN3nc.cjs.map +1 -0
  31. package/dist/bar-DM16NUvV.js +56 -0
  32. package/dist/bar-DM16NUvV.js.map +1 -0
  33. package/dist/bar-DdsDxk3W.d.ts +43 -0
  34. package/dist/bar-a0h9KC8A.d.cts +43 -0
  35. package/dist/bar-jZEoao74.js +238 -0
  36. package/dist/bar-jZEoao74.js.map +1 -0
  37. package/dist/bar.cjs +3 -0
  38. package/dist/bar.d.cts +2 -0
  39. package/dist/bar.d.ts +2 -0
  40. package/dist/bar.js +2 -0
  41. package/dist/candlestick-B5r1w3kc.cjs +150 -0
  42. package/dist/candlestick-B5r1w3kc.cjs.map +1 -0
  43. package/dist/candlestick-BKdPyorY.d.cts +44 -0
  44. package/dist/candlestick-BnUG1SGi.d.ts +44 -0
  45. package/dist/candlestick-DuXwAFID.js +145 -0
  46. package/dist/candlestick-DuXwAFID.js.map +1 -0
  47. package/dist/candlestick.cjs +11 -0
  48. package/dist/candlestick.cjs.map +1 -0
  49. package/dist/candlestick.d.cts +2 -0
  50. package/dist/candlestick.d.ts +2 -0
  51. package/dist/candlestick.js +10 -0
  52. package/dist/candlestick.js.map +1 -0
  53. package/dist/cartesian-BoDfgBCV.cjs +900 -0
  54. package/dist/cartesian-BoDfgBCV.cjs.map +1 -0
  55. package/dist/cartesian-Cr0AF0nG.js +709 -0
  56. package/dist/cartesian-Cr0AF0nG.js.map +1 -0
  57. package/dist/chart-BF2CK9I_.js +790 -0
  58. package/dist/chart-BF2CK9I_.js.map +1 -0
  59. package/dist/chart-CowF_lWY.cjs +903 -0
  60. package/dist/chart-CowF_lWY.cjs.map +1 -0
  61. package/dist/chart-Qa417fJo.d.cts +927 -0
  62. package/dist/chart-iJGxMz9z.d.ts +927 -0
  63. package/dist/circle-BQMuAfls.cjs +12 -0
  64. package/dist/circle-BQMuAfls.cjs.map +1 -0
  65. package/dist/circle-Z7YfCoCM.js +7 -0
  66. package/dist/circle-Z7YfCoCM.js.map +1 -0
  67. package/dist/clean-Byl6kzf0.cjs +115 -0
  68. package/dist/clean-Byl6kzf0.cjs.map +1 -0
  69. package/dist/clean-o1vDEhFV.js +56 -0
  70. package/dist/clean-o1vDEhFV.js.map +1 -0
  71. package/dist/core-C7fPm6t7.cjs +976 -0
  72. package/dist/core-C7fPm6t7.cjs.map +1 -0
  73. package/dist/core-CjgbhS_v.d.ts +219 -0
  74. package/dist/core-CnGFKojH.d.cts +219 -0
  75. package/dist/core-plobgBC7.js +875 -0
  76. package/dist/core-plobgBC7.js.map +1 -0
  77. package/dist/core.cjs +113 -0
  78. package/dist/core.d.cts +20 -0
  79. package/dist/core.d.ts +20 -0
  80. package/dist/core.js +24 -0
  81. package/dist/dates-Btm7Zm6W.cjs +32 -0
  82. package/dist/dates-Btm7Zm6W.cjs.map +1 -0
  83. package/dist/dates-CG-FvioW.js +27 -0
  84. package/dist/dates-CG-FvioW.js.map +1 -0
  85. package/dist/decimate-BGg9XgF0.d.ts +17 -0
  86. package/dist/decimate-C87cl_Sp.js +84 -0
  87. package/dist/decimate-C87cl_Sp.js.map +1 -0
  88. package/dist/decimate-CNSpgGa5.d.cts +17 -0
  89. package/dist/decimate-tLhDk1ys.cjs +95 -0
  90. package/dist/decimate-tLhDk1ys.cjs.map +1 -0
  91. package/dist/decimate.cjs +14 -0
  92. package/dist/decimate.cjs.map +1 -0
  93. package/dist/decimate.d.cts +2 -0
  94. package/dist/decimate.d.ts +2 -0
  95. package/dist/decimate.js +12 -0
  96. package/dist/decimate.js.map +1 -0
  97. package/dist/dom-CLF868Qs.cjs +222 -0
  98. package/dist/dom-CLF868Qs.cjs.map +1 -0
  99. package/dist/dom-vP3IcMak.js +175 -0
  100. package/dist/dom-vP3IcMak.js.map +1 -0
  101. package/dist/export-chart-9w8t3rjZ.js +232 -0
  102. package/dist/export-chart-9w8t3rjZ.js.map +1 -0
  103. package/dist/export-chart-BhhYgksr.cjs +249 -0
  104. package/dist/export-chart-BhhYgksr.cjs.map +1 -0
  105. package/dist/export.cjs +18 -0
  106. package/dist/export.cjs.map +1 -0
  107. package/dist/export.d.cts +2 -0
  108. package/dist/export.d.ts +2 -0
  109. package/dist/export.js +15 -0
  110. package/dist/export.js.map +1 -0
  111. package/dist/extent-BAMZo0Nq.js +19 -0
  112. package/dist/extent-BAMZo0Nq.js.map +1 -0
  113. package/dist/extent-DsFWvAHJ.cjs +24 -0
  114. package/dist/extent-DsFWvAHJ.cjs.map +1 -0
  115. package/dist/fade-Cs74puQS.cjs +217 -0
  116. package/dist/fade-Cs74puQS.cjs.map +1 -0
  117. package/dist/fade-D3NxH5Qg.js +200 -0
  118. package/dist/fade-D3NxH5Qg.js.map +1 -0
  119. package/dist/features-BclHgg2W.cjs +48 -0
  120. package/dist/features-BclHgg2W.cjs.map +1 -0
  121. package/dist/features-wASyHGic.js +25 -0
  122. package/dist/features-wASyHGic.js.map +1 -0
  123. package/dist/format-B0yKXBTH.cjs +183 -0
  124. package/dist/format-B0yKXBTH.cjs.map +1 -0
  125. package/dist/format-lStwuc1L.js +142 -0
  126. package/dist/format-lStwuc1L.js.map +1 -0
  127. package/dist/gauge-CEfkWXSu.cjs +235 -0
  128. package/dist/gauge-CEfkWXSu.cjs.map +1 -0
  129. package/dist/gauge-Cu9jttC0.d.ts +65 -0
  130. package/dist/gauge-Cu_OFxBd.d.cts +65 -0
  131. package/dist/gauge-_ljQHrMN.js +230 -0
  132. package/dist/gauge-_ljQHrMN.js.map +1 -0
  133. package/dist/gauge.cjs +3 -0
  134. package/dist/gauge.d.cts +2 -0
  135. package/dist/gauge.d.ts +2 -0
  136. package/dist/gauge.js +2 -0
  137. package/dist/heatmap-BK18EBgJ.cjs +247 -0
  138. package/dist/heatmap-BK18EBgJ.cjs.map +1 -0
  139. package/dist/heatmap-BwS-y0c6.d.cts +81 -0
  140. package/dist/heatmap-DSZ2bVIa.js +242 -0
  141. package/dist/heatmap-DSZ2bVIa.js.map +1 -0
  142. package/dist/heatmap-PhLPXIg1.d.ts +81 -0
  143. package/dist/heatmap.cjs +3 -0
  144. package/dist/heatmap.d.cts +2 -0
  145. package/dist/heatmap.d.ts +2 -0
  146. package/dist/heatmap.js +2 -0
  147. package/dist/hydrate-CTTmQy0x.d.cts +10 -0
  148. package/dist/hydrate-CxwTXDqO.cjs +60 -0
  149. package/dist/hydrate-CxwTXDqO.cjs.map +1 -0
  150. package/dist/hydrate-CzfxLfTv.d.ts +10 -0
  151. package/dist/hydrate-DDNIHYv_.js +55 -0
  152. package/dist/hydrate-DDNIHYv_.js.map +1 -0
  153. package/dist/hydrate.cjs +13 -0
  154. package/dist/hydrate.cjs.map +1 -0
  155. package/dist/hydrate.d.cts +2 -0
  156. package/dist/hydrate.d.ts +2 -0
  157. package/dist/hydrate.js +12 -0
  158. package/dist/hydrate.js.map +1 -0
  159. package/dist/index.cjs +211 -0
  160. package/dist/index.cjs.map +1 -0
  161. package/dist/index.d.cts +45 -0
  162. package/dist/index.d.ts +45 -0
  163. package/dist/index.js +113 -0
  164. package/dist/index.js.map +1 -0
  165. package/dist/layout-B3hiqVEw.js +69 -0
  166. package/dist/layout-B3hiqVEw.js.map +1 -0
  167. package/dist/layout-CtMBhNd9.cjs +98 -0
  168. package/dist/layout-CtMBhNd9.cjs.map +1 -0
  169. package/dist/line-B3Ed6u7j.js +120 -0
  170. package/dist/line-B3Ed6u7j.js.map +1 -0
  171. package/dist/line-CMDGH6q5.d.cts +47 -0
  172. package/dist/line-D5kb8e6w.d.ts +47 -0
  173. package/dist/line-fQbtP_jL.cjs +131 -0
  174. package/dist/line-fQbtP_jL.cjs.map +1 -0
  175. package/dist/line.cjs +14 -0
  176. package/dist/line.cjs.map +1 -0
  177. package/dist/line.d.cts +2 -0
  178. package/dist/line.d.ts +2 -0
  179. package/dist/line.js +13 -0
  180. package/dist/line.js.map +1 -0
  181. package/dist/log-CaofN3-n.d.cts +48 -0
  182. package/dist/log-CaofN3-n.d.ts +48 -0
  183. package/dist/log-axis-83rSpvL5.cjs +130 -0
  184. package/dist/log-axis-83rSpvL5.cjs.map +1 -0
  185. package/dist/log-axis-B_uvvOFc.js +113 -0
  186. package/dist/log-axis-B_uvvOFc.js.map +1 -0
  187. package/dist/log.cjs +17 -0
  188. package/dist/log.cjs.map +1 -0
  189. package/dist/log.d.cts +2 -0
  190. package/dist/log.d.ts +2 -0
  191. package/dist/log.js +16 -0
  192. package/dist/log.js.map +1 -0
  193. package/dist/morph-BMxz3X2b.d.cts +10 -0
  194. package/dist/morph-BMxz3X2b.d.ts +10 -0
  195. package/dist/morph-Bgg-24l8.js +36 -0
  196. package/dist/morph-Bgg-24l8.js.map +1 -0
  197. package/dist/morph-CqYDu1bY.cjs +41 -0
  198. package/dist/morph-CqYDu1bY.cjs.map +1 -0
  199. package/dist/morph.cjs +14 -0
  200. package/dist/morph.cjs.map +1 -0
  201. package/dist/morph.d.cts +2 -0
  202. package/dist/morph.d.ts +2 -0
  203. package/dist/morph.js +13 -0
  204. package/dist/morph.js.map +1 -0
  205. package/dist/named-BWWb5LQJ.cjs +50 -0
  206. package/dist/named-BWWb5LQJ.cjs.map +1 -0
  207. package/dist/named-DE15TOgh.js +33 -0
  208. package/dist/named-DE15TOgh.js.map +1 -0
  209. package/dist/path-CwB28da0.d.cts +29 -0
  210. package/dist/path-CwB28da0.d.ts +29 -0
  211. package/dist/patterns-DtgcnA8o.js +85 -0
  212. package/dist/patterns-DtgcnA8o.js.map +1 -0
  213. package/dist/patterns-LfcQAWCy.cjs +102 -0
  214. package/dist/patterns-LfcQAWCy.cjs.map +1 -0
  215. package/dist/patterns.cjs +15 -0
  216. package/dist/patterns.cjs.map +1 -0
  217. package/dist/patterns.d.cts +2 -0
  218. package/dist/patterns.d.ts +2 -0
  219. package/dist/patterns.js +12 -0
  220. package/dist/patterns.js.map +1 -0
  221. package/dist/pie-B8UlOZiq.d.ts +58 -0
  222. package/dist/pie-C1Pa6W_l.cjs +211 -0
  223. package/dist/pie-C1Pa6W_l.cjs.map +1 -0
  224. package/dist/pie-DnQQmxkk.d.cts +58 -0
  225. package/dist/pie-RnMTQWMS.js +200 -0
  226. package/dist/pie-RnMTQWMS.js.map +1 -0
  227. package/dist/pie.cjs +4 -0
  228. package/dist/pie.d.cts +2 -0
  229. package/dist/pie.d.ts +2 -0
  230. package/dist/pie.js +2 -0
  231. package/dist/point-shapes-CGl4dugc.cjs +166 -0
  232. package/dist/point-shapes-CGl4dugc.cjs.map +1 -0
  233. package/dist/point-shapes-DI84NNpI.js +155 -0
  234. package/dist/point-shapes-DI84NNpI.js.map +1 -0
  235. package/dist/point-shapes.cjs +15 -0
  236. package/dist/point-shapes.cjs.map +1 -0
  237. package/dist/point-shapes.d.cts +2 -0
  238. package/dist/point-shapes.d.ts +2 -0
  239. package/dist/point-shapes.js +13 -0
  240. package/dist/point-shapes.js.map +1 -0
  241. package/dist/radar-BB13CGmq.d.cts +60 -0
  242. package/dist/radar-CYPab_I4.js +285 -0
  243. package/dist/radar-CYPab_I4.js.map +1 -0
  244. package/dist/radar-CoGUNNSb.cjs +290 -0
  245. package/dist/radar-CoGUNNSb.cjs.map +1 -0
  246. package/dist/radar-pFI6fvOq.d.ts +60 -0
  247. package/dist/radar.cjs +3 -0
  248. package/dist/radar.d.cts +2 -0
  249. package/dist/radar.d.ts +2 -0
  250. package/dist/radar.js +2 -0
  251. package/dist/sankey-B4PNKusJ.js +420 -0
  252. package/dist/sankey-B4PNKusJ.js.map +1 -0
  253. package/dist/sankey-B9JYnx7e.d.cts +67 -0
  254. package/dist/sankey-Bacx4fVe.cjs +425 -0
  255. package/dist/sankey-Bacx4fVe.cjs.map +1 -0
  256. package/dist/sankey-Bm518bqL.d.ts +67 -0
  257. package/dist/sankey.cjs +3 -0
  258. package/dist/sankey.d.cts +2 -0
  259. package/dist/sankey.d.ts +2 -0
  260. package/dist/sankey.js +2 -0
  261. package/dist/scatter-Bl7nasE6.d.ts +61 -0
  262. package/dist/scatter-DgMN9zRy.cjs +250 -0
  263. package/dist/scatter-DgMN9zRy.cjs.map +1 -0
  264. package/dist/scatter-DrJ8xYz4.d.cts +61 -0
  265. package/dist/scatter-kgtgR318.js +245 -0
  266. package/dist/scatter-kgtgR318.js.map +1 -0
  267. package/dist/scatter.cjs +3 -0
  268. package/dist/scatter.d.cts +2 -0
  269. package/dist/scatter.d.ts +2 -0
  270. package/dist/scatter.js +2 -0
  271. package/dist/sparkline-BG13V4Pz.d.cts +43 -0
  272. package/dist/sparkline-BQzt27Fr.js +171 -0
  273. package/dist/sparkline-BQzt27Fr.js.map +1 -0
  274. package/dist/sparkline-BS9-hltA.cjs +176 -0
  275. package/dist/sparkline-BS9-hltA.cjs.map +1 -0
  276. package/dist/sparkline-iWuXbKpd.d.ts +43 -0
  277. package/dist/sparkline.cjs +3 -0
  278. package/dist/sparkline.d.cts +2 -0
  279. package/dist/sparkline.d.ts +2 -0
  280. package/dist/sparkline.js +2 -0
  281. package/dist/stack-CpR6RGKd.d.cts +6 -0
  282. package/dist/stack-CpR6RGKd.d.ts +6 -0
  283. package/dist/stack-DRbwTeF3.js +66 -0
  284. package/dist/stack-DRbwTeF3.js.map +1 -0
  285. package/dist/stack-DVhJWaki.cjs +77 -0
  286. package/dist/stack-DVhJWaki.cjs.map +1 -0
  287. package/dist/style.css +2 -0
  288. package/dist/sweep-Duowaput.cjs +369 -0
  289. package/dist/sweep-Duowaput.cjs.map +1 -0
  290. package/dist/sweep-WSgn2etB.js +334 -0
  291. package/dist/sweep-WSgn2etB.js.map +1 -0
  292. package/dist/time-CHjiY9Q4.d.ts +112 -0
  293. package/dist/time-CNVnt-B2.d.cts +112 -0
  294. package/dist/time-axis-Bc9eHX1r.js +365 -0
  295. package/dist/time-axis-Bc9eHX1r.js.map +1 -0
  296. package/dist/time-axis-VSX34_Tb.cjs +382 -0
  297. package/dist/time-axis-VSX34_Tb.cjs.map +1 -0
  298. package/dist/time.cjs +22 -0
  299. package/dist/time.cjs.map +1 -0
  300. package/dist/time.d.cts +2 -0
  301. package/dist/time.d.ts +2 -0
  302. package/dist/time.js +20 -0
  303. package/dist/time.js.map +1 -0
  304. package/dist/tween-BCYd0RTY.js +40 -0
  305. package/dist/tween-BCYd0RTY.js.map +1 -0
  306. package/dist/tween-CIGBlryn.cjs +51 -0
  307. package/dist/tween-CIGBlryn.cjs.map +1 -0
  308. package/dist/value-labels-B0WJoJ7x.cjs +134 -0
  309. package/dist/value-labels-B0WJoJ7x.cjs.map +1 -0
  310. package/dist/value-labels-IZIQPhfk.js +123 -0
  311. package/dist/value-labels-IZIQPhfk.js.map +1 -0
  312. package/dist/value-labels.cjs +14 -0
  313. package/dist/value-labels.cjs.map +1 -0
  314. package/dist/value-labels.d.cts +2 -0
  315. package/dist/value-labels.d.ts +2 -0
  316. package/dist/value-labels.js +12 -0
  317. package/dist/value-labels.js.map +1 -0
  318. package/dist/vnode-BUflsBsa.d.cts +66 -0
  319. package/dist/vnode-BUflsBsa.d.ts +66 -0
  320. package/dist/vnode-CkQ27Cxe.cjs +110 -0
  321. package/dist/vnode-CkQ27Cxe.cjs.map +1 -0
  322. package/dist/vnode-tCWItoUH.js +93 -0
  323. package/dist/vnode-tCWItoUH.js.map +1 -0
  324. package/package.json +310 -3
@@ -0,0 +1,334 @@
1
+ import { t as h } from "./vnode-tCWItoUH.js";
2
+ import { n as tween, t as stop } from "./tween-BCYd0RTY.js";
3
+ //#region src/shapes/arc.ts
4
+ /**
5
+ * Annular sector paths with padding and rounded corners, ported from
6
+ * d3-shape's `arc()` (ISC license, Mike Bostock) so geometry matches d3.
7
+ *
8
+ * Angles are in radians, clockwise from 12 o'clock; paths are centered on
9
+ * the origin (translate the group to place them).
10
+ */
11
+ const EPSILON = 1e-12;
12
+ const PI = Math.PI;
13
+ const HALF_PI = PI / 2;
14
+ const TAU = 2 * PI;
15
+ /** Degrees to radians. */
16
+ const DEG = Math.PI / 180;
17
+ const asin = (x) => x >= 1 ? HALF_PI : x <= -1 ? -HALF_PI : Math.asin(x);
18
+ const acos = (x) => x > 1 ? 0 : x < -1 ? PI : Math.acos(x);
19
+ function intersect(x0, y0, x1, y1, x2, y2, x3, y3) {
20
+ const x10 = x1 - x0;
21
+ const y10 = y1 - y0;
22
+ const x32 = x3 - x2;
23
+ const y32 = y3 - y2;
24
+ let t = y32 * x10 - x32 * y10;
25
+ if (t * t < EPSILON) return void 0;
26
+ t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t;
27
+ return [x0 + t * x10, y0 + t * y10];
28
+ }
29
+ /** Center and tangent points of a rounded corner between a radial edge and an arc. */
30
+ function cornerTangents(x0, y0, x1, y1, r1, rc, cw) {
31
+ const x01 = x0 - x1;
32
+ const y01 = y0 - y1;
33
+ const lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01);
34
+ const ox = lo * y01;
35
+ const oy = -lo * x01;
36
+ const x11 = x0 + ox;
37
+ const y11 = y0 + oy;
38
+ const x10 = x1 + ox;
39
+ const y10 = y1 + oy;
40
+ const x00 = (x11 + x10) / 2;
41
+ const y00 = (y11 + y10) / 2;
42
+ const dx = x10 - x11;
43
+ const dy = y10 - y11;
44
+ const d2 = dx * dx + dy * dy;
45
+ const r = r1 - rc;
46
+ const D = x11 * y10 - x10 * y11;
47
+ const d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D));
48
+ let cx0 = (D * dy - dx * d) / d2;
49
+ let cy0 = (-D * dx - dy * d) / d2;
50
+ const cx1 = (D * dy + dx * d) / d2;
51
+ const cy1 = (-D * dx + dy * d) / d2;
52
+ const dx0 = cx0 - x00;
53
+ const dy0 = cy0 - y00;
54
+ const dx1 = cx1 - x00;
55
+ const dy1 = cy1 - y00;
56
+ if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {
57
+ cx0 = cx1;
58
+ cy0 = cy1;
59
+ }
60
+ return {
61
+ cx: cx0,
62
+ cy: cy0,
63
+ x01: -ox,
64
+ y01: -oy,
65
+ x11: cx0 * (r1 / r - 1),
66
+ y11: cy0 * (r1 / r - 1)
67
+ };
68
+ }
69
+ /**
70
+ * Padded angles, clamped corner radii and edge points of a partial sector,
71
+ * shared by both path generators so they agree exactly.
72
+ */
73
+ function sector(options, r0, r1, a0, a1, da, cw) {
74
+ let a01 = a0;
75
+ let a11 = a1;
76
+ let a00 = a0;
77
+ let a10 = a1;
78
+ let da0 = da;
79
+ let da1 = da;
80
+ const ap = (options.padAngle ?? 0) / 2;
81
+ const rp = ap > EPSILON ? options.padRadius ?? Math.sqrt(r0 * r0 + r1 * r1) : 0;
82
+ const rc = Math.min(Math.abs(r1 - r0) / 2, options.cornerRadius ?? 0);
83
+ let rc0 = rc;
84
+ let rc1 = rc;
85
+ if (rp > EPSILON) {
86
+ let p0 = asin(rp / r0 * Math.sin(ap));
87
+ let p1 = asin(rp / r1 * Math.sin(ap));
88
+ da0 -= p0 * 2;
89
+ if (da0 > EPSILON) {
90
+ p0 *= cw ? 1 : -1;
91
+ a00 += p0;
92
+ a10 -= p0;
93
+ } else {
94
+ da0 = 0;
95
+ a00 = a10 = (a0 + a1) / 2;
96
+ }
97
+ da1 -= p1 * 2;
98
+ if (da1 > EPSILON) {
99
+ p1 *= cw ? 1 : -1;
100
+ a01 += p1;
101
+ a11 -= p1;
102
+ } else {
103
+ da1 = 0;
104
+ a01 = a11 = (a0 + a1) / 2;
105
+ }
106
+ }
107
+ const x01 = r1 * Math.cos(a01);
108
+ const y01 = r1 * Math.sin(a01);
109
+ const x10 = r0 * Math.cos(a10);
110
+ const y10 = r0 * Math.sin(a10);
111
+ const x11 = r1 * Math.cos(a11);
112
+ const y11 = r1 * Math.sin(a11);
113
+ const x00 = r0 * Math.cos(a00);
114
+ const y00 = r0 * Math.sin(a00);
115
+ if (rc > EPSILON && da < PI) {
116
+ const oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10);
117
+ if (oc) {
118
+ const ax = x01 - oc[0];
119
+ const ay = y01 - oc[1];
120
+ const bx = x11 - oc[0];
121
+ const by = y11 - oc[1];
122
+ const cos = (ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by));
123
+ const kc = 1 / Math.sin(acos(cos) / 2);
124
+ const lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1]);
125
+ rc0 = Math.min(rc, (r0 - lc) / (kc - 1));
126
+ rc1 = Math.min(rc, (r1 - lc) / (kc + 1));
127
+ } else rc0 = rc1 = 0;
128
+ }
129
+ return {
130
+ a00,
131
+ a01,
132
+ a10,
133
+ a11,
134
+ da0,
135
+ da1,
136
+ rc,
137
+ rc0,
138
+ rc1,
139
+ x01,
140
+ y01,
141
+ x10,
142
+ y10,
143
+ x11,
144
+ y11,
145
+ x00,
146
+ y00
147
+ };
148
+ }
149
+ /** Midpoint of an arc, e.g. to anchor a tooltip or label (like d3's `arc.centroid`). */
150
+ function arcCentroid(options) {
151
+ const r = (options.innerRadius + options.outerRadius) / 2;
152
+ const a = (options.startAngle + options.endAngle) / 2 - HALF_PI;
153
+ return [Math.cos(a) * r, Math.sin(a) * r];
154
+ }
155
+ /** Pad angle giving a constant `gap` (in pixels) between arcs of a ring. */
156
+ function padAngleForGap(gap, innerRadius, outerRadius) {
157
+ const rp = Math.sqrt(innerRadius * innerRadius + outerRadius * outerRadius);
158
+ return rp > 0 ? 2 * Math.asin(Math.min(1, gap / 2 / rp)) : 0;
159
+ }
160
+ /** Angle of a point around the origin. */
161
+ const angleOf = (x, y) => Math.atan2(y, x);
162
+ /**
163
+ * The same sector as {@link arcPath}, drawn with a fixed command structure:
164
+ * every corner is always present (zero length when there is none) and each
165
+ * ring is split into two half arcs, so the large-arc flag never flips.
166
+ * Paths of different angles therefore keep their commands while an arc is
167
+ * redrawn frame by frame, turning to its new angles (see `sweep`).
168
+ */
169
+ function arcPathStable(options) {
170
+ const k = 10 ** Math.max(0, Math.min(12, Math.floor(options.precision ?? 2)));
171
+ const n = (v) => {
172
+ const r = Math.round(v * k) / k;
173
+ return String(r === 0 ? 0 : r);
174
+ };
175
+ let d = "";
176
+ const move = (x, y) => {
177
+ d += `M${n(x)},${n(y)}`;
178
+ };
179
+ const line = (x, y) => {
180
+ d += `L${n(x)},${n(y)}`;
181
+ };
182
+ const arc = (r, sweep, x, y) => {
183
+ d += `A${n(r)},${n(r)},0,0,${sweep},${n(x)},${n(y)}`;
184
+ };
185
+ /** Two half arcs of radius `r` around the origin from angle `a0` to `a1`. */
186
+ const ring = (r, a0, a1, ccw) => {
187
+ let delta = ccw ? a0 - a1 : a1 - a0;
188
+ delta = (delta % TAU + TAU) % TAU;
189
+ if (delta < EPSILON && Math.abs(a1 - a0) > EPSILON) delta = TAU;
190
+ const mid = ccw ? a0 - delta / 2 : a0 + delta / 2;
191
+ const sweep = ccw ? 0 : 1;
192
+ arc(r, sweep, r * Math.cos(mid), r * Math.sin(mid));
193
+ arc(r, sweep, r * Math.cos(a1), r * Math.sin(a1));
194
+ };
195
+ let r0 = Math.max(0, options.innerRadius);
196
+ let r1 = Math.max(0, options.outerRadius);
197
+ if (r1 < r0) [r0, r1] = [r1, r0];
198
+ const a0 = options.startAngle - HALF_PI;
199
+ const a1 = options.endAngle - HALF_PI;
200
+ const da = Math.abs(a1 - a0);
201
+ const cw = a1 > a0;
202
+ const outerSweep = cw ? 1 : 0;
203
+ if (!(r1 > EPSILON)) {
204
+ move(0, 0);
205
+ for (let i = 0; i < 4; i++) arc(0, outerSweep, 0, 0);
206
+ line(0, 0);
207
+ for (let i = 0; i < 4; i++) arc(0, outerSweep, 0, 0);
208
+ return `${d}Z`;
209
+ }
210
+ if (da > TAU - EPSILON) {
211
+ const ox = r1 * Math.cos(a0);
212
+ const oy = r1 * Math.sin(a0);
213
+ move(ox, oy);
214
+ arc(r1, outerSweep, ox, oy);
215
+ ring(r1, a0, a0 + (cw ? TAU : -TAU) * (1 - 1e-9), !cw);
216
+ arc(r1, outerSweep, ox, oy);
217
+ const ix = r0 * Math.cos(a0);
218
+ const iy = r0 * Math.sin(a0);
219
+ line(ix, iy);
220
+ arc(r0, outerSweep, ix, iy);
221
+ if (r0 > EPSILON) ring(r0, a0, a0 + (cw ? -TAU : TAU) * (1 - 1e-9), cw);
222
+ else for (let i = 0; i < 2; i++) arc(0, outerSweep, 0, 0);
223
+ arc(r0, outerSweep, ix, iy);
224
+ return `${d}Z`;
225
+ }
226
+ const { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10, x11, y11, x00, y00 } = sector(options, r0, r1, a0, a1, da, cw);
227
+ if (da1 > EPSILON && rc1 > EPSILON) {
228
+ const t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw);
229
+ const t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw);
230
+ move(t0.cx + t0.x01, t0.cy + t0.y01);
231
+ if (rc1 < rc) {
232
+ const ex = t1.cx + t1.x01;
233
+ const ey = t1.cy + t1.y01;
234
+ arc(rc1, outerSweep, ex, ey);
235
+ arc(r1, outerSweep, ex, ey);
236
+ arc(r1, outerSweep, ex, ey);
237
+ arc(rc1, outerSweep, ex, ey);
238
+ } else {
239
+ arc(rc1, outerSweep, t0.cx + t0.x11, t0.cy + t0.y11);
240
+ ring(r1, angleOf(t0.cx + t0.x11, t0.cy + t0.y11), angleOf(t1.cx + t1.x11, t1.cy + t1.y11), !cw);
241
+ arc(rc1, outerSweep, t1.cx + t1.x01, t1.cy + t1.y01);
242
+ }
243
+ } else {
244
+ move(x01, y01);
245
+ arc(r1, outerSweep, x01, y01);
246
+ if (da1 > EPSILON) ring(r1, a01, a11, !cw);
247
+ else for (let i = 0; i < 2; i++) arc(r1, outerSweep, x01, y01);
248
+ arc(r1, outerSweep, x11, y11);
249
+ }
250
+ if (!(r0 > EPSILON) || !(da0 > EPSILON)) {
251
+ line(x10, y10);
252
+ for (let i = 0; i < 4; i++) arc(r0, outerSweep, x10, y10);
253
+ } else if (rc0 > EPSILON) {
254
+ const t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw);
255
+ const t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw);
256
+ line(t0.cx + t0.x01, t0.cy + t0.y01);
257
+ if (rc0 < rc) {
258
+ const ex = t1.cx + t1.x01;
259
+ const ey = t1.cy + t1.y01;
260
+ arc(rc0, outerSweep, ex, ey);
261
+ arc(r0, outerSweep, ex, ey);
262
+ arc(r0, outerSweep, ex, ey);
263
+ arc(rc0, outerSweep, ex, ey);
264
+ } else {
265
+ arc(rc0, outerSweep, t0.cx + t0.x11, t0.cy + t0.y11);
266
+ ring(r0, angleOf(t0.cx + t0.x11, t0.cy + t0.y11), angleOf(t1.cx + t1.x11, t1.cy + t1.y11), cw);
267
+ arc(rc0, outerSweep, t1.cx + t1.x01, t1.cy + t1.y01);
268
+ }
269
+ } else {
270
+ line(x10, y10);
271
+ arc(r0, outerSweep, x10, y10);
272
+ ring(r0, a10, a00, cw);
273
+ arc(r0, outerSweep, x00, y00);
274
+ }
275
+ return `${d}Z`;
276
+ }
277
+ //#endregion
278
+ //#region src/render/sweep.ts
279
+ /**
280
+ * Arcs that turn to their new angles: a transition of `d` moves each point
281
+ * of a path along a straight line, which bends a slice out of its ring on
282
+ * the way. A path that knows which arc it draws (the `arc` of its node, see
283
+ * `arcNode`) is redrawn frame by frame instead, with the angles and radii
284
+ * in between, so slices grow and shrink around the center. Timed by the
285
+ * path's `transition-duration` (`--tc-duration`), with an ease-out curve.
286
+ */
287
+ /**
288
+ * A path drawing this arc, which keeps the arc with it (radii, angles, pad
289
+ * angle, corner radius): out of the markup, for the next render to sweep from.
290
+ */
291
+ function arcNode(name, arc) {
292
+ const node = h("path", {
293
+ class: name,
294
+ d: arcPathStable(arc)
295
+ });
296
+ node.arc = [
297
+ arc.innerRadius,
298
+ arc.outerRadius,
299
+ arc.startAngle,
300
+ arc.endAngle,
301
+ arc.padAngle ?? 0,
302
+ arc.cornerRadius ?? 0
303
+ ];
304
+ return node;
305
+ }
306
+ /**
307
+ * Take `el` from the arc of its last render, `prev`, to the arc of `next`.
308
+ * Returns the attributes left for the caller to patch (all but `d`, set
309
+ * here frame by frame), or nothing when there is no sweep: not an arc, the
310
+ * same path, no arc to come from, or a chart without transitions.
311
+ */
312
+ function sweep(el, prev, next) {
313
+ const { arc, attrs } = next;
314
+ if (!arc || prev.attrs.d === attrs.d) return;
315
+ const origin = stop(el) ?? prev.arc;
316
+ const duration = Number.parseFloat(getComputedStyle(el).transitionDuration) * 1e3;
317
+ if (!origin || !(duration > 0)) return;
318
+ tween(el, origin, arc, duration, ([innerRadius, outerRadius, startAngle, endAngle, padAngle, cornerRadius]) => arcPathStable({
319
+ innerRadius,
320
+ outerRadius,
321
+ startAngle,
322
+ endAngle,
323
+ padAngle,
324
+ cornerRadius
325
+ }), String(attrs.d));
326
+ return {
327
+ ...attrs,
328
+ d: prev.attrs.d
329
+ };
330
+ }
331
+ //#endregion
332
+ export { arcPathStable as a, arcCentroid as i, sweep as n, padAngleForGap as o, DEG as r, arcNode as t };
333
+
334
+ //# sourceMappingURL=sweep-WSgn2etB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sweep-WSgn2etB.js","names":[],"sources":["../src/shapes/arc.ts","../src/render/sweep.ts"],"sourcesContent":["/**\n * Annular sector paths with padding and rounded corners, ported from\n * d3-shape's `arc()` (ISC license, Mike Bostock) so geometry matches d3.\n *\n * Angles are in radians, clockwise from 12 o'clock; paths are centered on\n * the origin (translate the group to place them).\n */\n\nconst EPSILON = 1e-12\nconst PI = Math.PI\nconst HALF_PI = PI / 2\nconst TAU = 2 * PI\n\n/** Degrees to radians. */\nexport const DEG: number = Math.PI / 180\n\n/** Room kept around pies and gauges for the halo of the hovered arc, in pixels. */\nexport const HALO = 8\n\n// Clamped like d3-shape's math helpers, so out-of-range inputs saturate instead of NaN.\nconst asin = (x: number): number => (x >= 1 ? HALF_PI : x <= -1 ? -HALF_PI : Math.asin(x))\nconst acos = (x: number): number => (x > 1 ? 0 : x < -1 ? PI : Math.acos(x))\n\nexport interface ArcOptions {\n innerRadius: number\n outerRadius: number\n startAngle: number\n endAngle: number\n /** Angle removed between adjacent arcs, split between both ends. Defaults to `0`. */\n padAngle?: number\n /** Radius the pad angle is measured at. Defaults to `sqrt(inner² + outer²)` like d3. */\n padRadius?: number\n /** Radius of the rounded corners, clamped to half the ring thickness. Defaults to `0`. */\n cornerRadius?: number\n /** Decimal places kept in the path data. Defaults to `2`. */\n precision?: number\n}\n\n/** Canvas-like path builder emitting SVG path data (after d3-path). */\nclass ArcPath {\n d = ''\n #x0: number | null = null\n #y0: number | null = null\n #x1: number | null = null\n #y1: number | null = null\n readonly #k: number\n\n constructor(precision: number) {\n this.#k = 10 ** Math.max(0, Math.min(12, Math.floor(precision)))\n }\n\n #n(value: number): string {\n const rounded = Math.round(value * this.#k) / this.#k\n return String(rounded === 0 ? 0 : rounded)\n }\n\n moveTo(x: number, y: number): void {\n this.#x0 = this.#x1 = x\n this.#y0 = this.#y1 = y\n this.d += `M${this.#n(x)},${this.#n(y)}`\n }\n\n lineTo(x: number, y: number): void {\n this.#x1 = x\n this.#y1 = y\n this.d += `L${this.#n(x)},${this.#n(y)}`\n }\n\n closePath(): void {\n if (this.#x1 !== null) {\n this.#x1 = this.#x0\n this.#y1 = this.#y0\n this.d += 'Z'\n }\n }\n\n arc(x: number, y: number, r: number, a0: number, a1: number, ccw: boolean): void {\n const dx = r * Math.cos(a0)\n const dy = r * Math.sin(a0)\n const x0 = x + dx\n const y0 = y + dy\n const cw = ccw ? 0 : 1\n let da = ccw ? a0 - a1 : a1 - a0\n\n if (this.#x1 === null || this.#y1 === null) {\n this.d += `M${this.#n(x0)},${this.#n(y0)}`\n this.#x0 = x0\n this.#y0 = y0\n } else if (Math.abs(this.#x1 - x0) > EPSILON || Math.abs(this.#y1 - y0) > EPSILON) {\n this.d += `L${this.#n(x0)},${this.#n(y0)}`\n }\n this.#x1 = x0\n this.#y1 = y0\n if (!r) return\n\n if (da < 0) da = (da % TAU) + TAU\n const rr = this.#n(r)\n if (da > TAU - EPSILON) {\n // A complete circle: two half arcs.\n this.d += `A${rr},${rr},0,1,${cw},${this.#n(x - dx)},${this.#n(y - dy)}`\n this.d += `A${rr},${rr},0,1,${cw},${this.#n(x0)},${this.#n(y0)}`\n } else if (da > EPSILON) {\n this.#x1 = x + r * Math.cos(a1)\n this.#y1 = y + r * Math.sin(a1)\n this.d += `A${rr},${rr},0,${da >= PI ? 1 : 0},${cw},${this.#n(this.#x1)},${this.#n(this.#y1)}`\n }\n }\n}\n\nfunction intersect(\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n x2: number,\n y2: number,\n x3: number,\n y3: number,\n): [number, number] | undefined {\n const x10 = x1 - x0\n const y10 = y1 - y0\n const x32 = x3 - x2\n const y32 = y3 - y2\n let t = y32 * x10 - x32 * y10\n if (t * t < EPSILON) return undefined\n t = (x32 * (y0 - y2) - y32 * (x0 - x2)) / t\n return [x0 + t * x10, y0 + t * y10]\n}\n\n/** Center and tangent points of a rounded corner between a radial edge and an arc. */\nfunction cornerTangents(\n x0: number,\n y0: number,\n x1: number,\n y1: number,\n r1: number,\n rc: number,\n cw: boolean,\n) {\n const x01 = x0 - x1\n const y01 = y0 - y1\n const lo = (cw ? rc : -rc) / Math.sqrt(x01 * x01 + y01 * y01)\n const ox = lo * y01\n const oy = -lo * x01\n const x11 = x0 + ox\n const y11 = y0 + oy\n const x10 = x1 + ox\n const y10 = y1 + oy\n const x00 = (x11 + x10) / 2\n const y00 = (y11 + y10) / 2\n const dx = x10 - x11\n const dy = y10 - y11\n const d2 = dx * dx + dy * dy\n const r = r1 - rc\n const D = x11 * y10 - x10 * y11\n const d = (dy < 0 ? -1 : 1) * Math.sqrt(Math.max(0, r * r * d2 - D * D))\n let cx0 = (D * dy - dx * d) / d2\n let cy0 = (-D * dx - dy * d) / d2\n const cx1 = (D * dy + dx * d) / d2\n const cy1 = (-D * dx + dy * d) / d2\n const dx0 = cx0 - x00\n const dy0 = cy0 - y00\n const dx1 = cx1 - x00\n const dy1 = cy1 - y00\n // Pick the intersection closest to the edge midpoint.\n if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) {\n cx0 = cx1\n cy0 = cy1\n }\n return {\n cx: cx0,\n cy: cy0,\n x01: -ox,\n y01: -oy,\n x11: cx0 * (r1 / r - 1),\n y11: cy0 * (r1 / r - 1),\n }\n}\n\n/**\n * Padded angles, clamped corner radii and edge points of a partial sector,\n * shared by both path generators so they agree exactly.\n */\nfunction sector(\n options: ArcOptions,\n r0: number,\n r1: number,\n a0: number,\n a1: number,\n da: number,\n cw: boolean,\n) {\n let a01 = a0\n let a11 = a1\n let a00 = a0\n let a10 = a1\n let da0 = da\n let da1 = da\n const ap = (options.padAngle ?? 0) / 2\n const rp = ap > EPSILON ? (options.padRadius ?? Math.sqrt(r0 * r0 + r1 * r1)) : 0\n const rc = Math.min(Math.abs(r1 - r0) / 2, options.cornerRadius ?? 0)\n let rc0 = rc\n let rc1 = rc\n\n // Apply padding: equal linear offsets at both radii keep the gap parallel.\n if (rp > EPSILON) {\n let p0 = asin((rp / r0) * Math.sin(ap))\n let p1 = asin((rp / r1) * Math.sin(ap))\n da0 -= p0 * 2\n if (da0 > EPSILON) {\n p0 *= cw ? 1 : -1\n a00 += p0\n a10 -= p0\n } else {\n da0 = 0\n a00 = a10 = (a0 + a1) / 2\n }\n da1 -= p1 * 2\n if (da1 > EPSILON) {\n p1 *= cw ? 1 : -1\n a01 += p1\n a11 -= p1\n } else {\n da1 = 0\n a01 = a11 = (a0 + a1) / 2\n }\n }\n\n const x01 = r1 * Math.cos(a01)\n const y01 = r1 * Math.sin(a01)\n const x10 = r0 * Math.cos(a10)\n const y10 = r0 * Math.sin(a10)\n const x11 = r1 * Math.cos(a11)\n const y11 = r1 * Math.sin(a11)\n const x00 = r0 * Math.cos(a00)\n const y00 = r0 * Math.sin(a00)\n\n // Restrict the corner radius for narrow sectors, where corners would overlap.\n if (rc > EPSILON && da < PI) {\n const oc = intersect(x01, y01, x00, y00, x11, y11, x10, y10)\n if (oc) {\n const ax = x01 - oc[0]\n const ay = y01 - oc[1]\n const bx = x11 - oc[0]\n const by = y11 - oc[1]\n const cos =\n (ax * bx + ay * by) / (Math.sqrt(ax * ax + ay * ay) * Math.sqrt(bx * bx + by * by))\n const kc = 1 / Math.sin(acos(cos) / 2)\n const lc = Math.sqrt(oc[0] * oc[0] + oc[1] * oc[1])\n rc0 = Math.min(rc, (r0 - lc) / (kc - 1))\n rc1 = Math.min(rc, (r1 - lc) / (kc + 1))\n } else {\n rc0 = rc1 = 0\n }\n }\n return { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10, x11, y11, x00, y00 }\n}\n\n/** SVG path data of an annular sector (a pie slice when `innerRadius` is 0). */\nexport function arcPath(options: ArcOptions): string {\n const path = new ArcPath(options.precision ?? 2)\n let r0 = Math.max(0, options.innerRadius)\n let r1 = Math.max(0, options.outerRadius)\n if (r1 < r0) [r0, r1] = [r1, r0]\n const a0 = options.startAngle - HALF_PI\n const a1 = options.endAngle - HALF_PI\n const da = Math.abs(a1 - a0)\n const cw = a1 > a0\n\n if (!(r1 > EPSILON)) {\n path.moveTo(0, 0)\n } else if (da > TAU - EPSILON) {\n // A full ring (or disc).\n path.moveTo(r1 * Math.cos(a0), r1 * Math.sin(a0))\n path.arc(0, 0, r1, a0, a1, !cw)\n if (r0 > EPSILON) {\n path.moveTo(r0 * Math.cos(a1), r0 * Math.sin(a1))\n path.arc(0, 0, r0, a1, a0, cw)\n }\n } else {\n const g = sector(options, r0, r1, a0, a1, da, cw)\n const { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10 } = g\n\n // Outer ring.\n if (!(da1 > EPSILON)) {\n path.moveTo(x01, y01)\n } else if (rc1 > EPSILON) {\n const { x00, y00, x11, y11 } = g\n const t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw)\n const t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw)\n path.moveTo(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc1 < rc) {\n path.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw)\n } else {\n path.arc(t0.cx, t0.cy, rc1, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw)\n path.arc(\n 0,\n 0,\n r1,\n Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11),\n Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11),\n !cw,\n )\n path.arc(t1.cx, t1.cy, rc1, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw)\n }\n } else {\n path.moveTo(x01, y01)\n path.arc(0, 0, r1, a01, a11, !cw)\n }\n\n // Inner ring (or the center of a pie slice).\n if (!(r0 > EPSILON) || !(da0 > EPSILON)) {\n path.lineTo(x10, y10)\n } else if (rc0 > EPSILON) {\n const { x00, y00, x11, y11 } = g\n const t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw)\n const t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw)\n path.lineTo(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc0 < rc) {\n path.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t1.y01, t1.x01), !cw)\n } else {\n path.arc(t0.cx, t0.cy, rc0, Math.atan2(t0.y01, t0.x01), Math.atan2(t0.y11, t0.x11), !cw)\n path.arc(\n 0,\n 0,\n r0,\n Math.atan2(t0.cy + t0.y11, t0.cx + t0.x11),\n Math.atan2(t1.cy + t1.y11, t1.cx + t1.x11),\n cw,\n )\n path.arc(t1.cx, t1.cy, rc0, Math.atan2(t1.y11, t1.x11), Math.atan2(t1.y01, t1.x01), !cw)\n }\n } else {\n path.arc(0, 0, r0, a10, a00, cw)\n }\n }\n\n path.closePath()\n return path.d\n}\n\n/** Midpoint of an arc, e.g. to anchor a tooltip or label (like d3's `arc.centroid`). */\nexport function arcCentroid(options: ArcOptions): [number, number] {\n const r = (options.innerRadius + options.outerRadius) / 2\n const a = (options.startAngle + options.endAngle) / 2 - HALF_PI\n return [Math.cos(a) * r, Math.sin(a) * r]\n}\n\n/** Pad angle giving a constant `gap` (in pixels) between arcs of a ring. */\nexport function padAngleForGap(gap: number, innerRadius: number, outerRadius: number): number {\n const rp = Math.sqrt(innerRadius * innerRadius + outerRadius * outerRadius)\n return rp > 0 ? 2 * Math.asin(Math.min(1, gap / 2 / rp)) : 0\n}\n\n/** Angle of a point around the origin. */\nconst angleOf = (x: number, y: number): number => Math.atan2(y, x)\n\n/**\n * The same sector as {@link arcPath}, drawn with a fixed command structure:\n * every corner is always present (zero length when there is none) and each\n * ring is split into two half arcs, so the large-arc flag never flips.\n * Paths of different angles therefore keep their commands while an arc is\n * redrawn frame by frame, turning to its new angles (see `sweep`).\n */\nexport function arcPathStable(options: ArcOptions): string {\n const k = 10 ** Math.max(0, Math.min(12, Math.floor(options.precision ?? 2)))\n const n = (v: number): string => {\n const r = Math.round(v * k) / k\n return String(r === 0 ? 0 : r)\n }\n let d = ''\n const move = (x: number, y: number) => {\n d += `M${n(x)},${n(y)}`\n }\n const line = (x: number, y: number) => {\n d += `L${n(x)},${n(y)}`\n }\n const arc = (r: number, sweep: 0 | 1, x: number, y: number) => {\n d += `A${n(r)},${n(r)},0,0,${sweep},${n(x)},${n(y)}`\n }\n /** Two half arcs of radius `r` around the origin from angle `a0` to `a1`. */\n const ring = (r: number, a0: number, a1: number, ccw: boolean) => {\n let delta = ccw ? a0 - a1 : a1 - a0\n delta = ((delta % TAU) + TAU) % TAU\n if (delta < EPSILON && Math.abs(a1 - a0) > EPSILON) delta = TAU\n const mid = ccw ? a0 - delta / 2 : a0 + delta / 2\n const sweep: 0 | 1 = ccw ? 0 : 1\n arc(r, sweep, r * Math.cos(mid), r * Math.sin(mid))\n arc(r, sweep, r * Math.cos(a1), r * Math.sin(a1))\n }\n\n let r0 = Math.max(0, options.innerRadius)\n let r1 = Math.max(0, options.outerRadius)\n if (r1 < r0) [r0, r1] = [r1, r0]\n const a0 = options.startAngle - HALF_PI\n const a1 = options.endAngle - HALF_PI\n const da = Math.abs(a1 - a0)\n const cw = a1 > a0\n const outerSweep: 0 | 1 = cw ? 1 : 0\n\n if (!(r1 > EPSILON)) {\n // A point: eleven no-op commands at the origin.\n move(0, 0)\n for (let i = 0; i < 4; i++) arc(0, outerSweep, 0, 0)\n line(0, 0)\n for (let i = 0; i < 4; i++) arc(0, outerSweep, 0, 0)\n return `${d}Z`\n }\n\n if (da > TAU - EPSILON) {\n // A full ring (or disc): the seam between the two rings closes the path.\n const ox = r1 * Math.cos(a0)\n const oy = r1 * Math.sin(a0)\n move(ox, oy)\n arc(r1, outerSweep, ox, oy)\n ring(r1, a0, a0 + (cw ? TAU : -TAU) * (1 - 1e-9), !cw)\n arc(r1, outerSweep, ox, oy)\n const ix = r0 * Math.cos(a0)\n const iy = r0 * Math.sin(a0)\n line(ix, iy)\n arc(r0, outerSweep, ix, iy)\n if (r0 > EPSILON) ring(r0, a0, a0 + (cw ? -TAU : TAU) * (1 - 1e-9), cw)\n else for (let i = 0; i < 2; i++) arc(0, outerSweep, 0, 0)\n arc(r0, outerSweep, ix, iy)\n return `${d}Z`\n }\n\n const { a00, a01, a10, a11, da0, da1, rc, rc0, rc1, x01, y01, x10, y10, x11, y11, x00, y00 } =\n sector(options, r0, r1, a0, a1, da, cw)\n\n // Outer edge: corner, two ring halves, corner.\n if (da1 > EPSILON && rc1 > EPSILON) {\n const t0 = cornerTangents(x00, y00, x01, y01, r1, rc1, cw)\n const t1 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw)\n move(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc1 < rc) {\n // Corners merged: one corner arc covers the edge, the rest is empty.\n const ex = t1.cx + t1.x01\n const ey = t1.cy + t1.y01\n arc(rc1, outerSweep, ex, ey)\n arc(r1, outerSweep, ex, ey)\n arc(r1, outerSweep, ex, ey)\n arc(rc1, outerSweep, ex, ey)\n } else {\n arc(rc1, outerSweep, t0.cx + t0.x11, t0.cy + t0.y11)\n ring(\n r1,\n angleOf(t0.cx + t0.x11, t0.cy + t0.y11),\n angleOf(t1.cx + t1.x11, t1.cy + t1.y11),\n !cw,\n )\n arc(rc1, outerSweep, t1.cx + t1.x01, t1.cy + t1.y01)\n }\n } else {\n move(x01, y01)\n arc(r1, outerSweep, x01, y01)\n if (da1 > EPSILON) ring(r1, a01, a11, !cw)\n else for (let i = 0; i < 2; i++) arc(r1, outerSweep, x01, y01)\n arc(r1, outerSweep, x11, y11)\n }\n\n // Inner edge (or the center of a pie slice): corner, two ring halves, corner.\n if (!(r0 > EPSILON) || !(da0 > EPSILON)) {\n line(x10, y10)\n for (let i = 0; i < 4; i++) arc(r0, outerSweep, x10, y10)\n } else if (rc0 > EPSILON) {\n const t0 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw)\n const t1 = cornerTangents(x01, y01, x00, y00, r0, -rc0, cw)\n line(t0.cx + t0.x01, t0.cy + t0.y01)\n if (rc0 < rc) {\n const ex = t1.cx + t1.x01\n const ey = t1.cy + t1.y01\n arc(rc0, outerSweep, ex, ey)\n arc(r0, outerSweep, ex, ey)\n arc(r0, outerSweep, ex, ey)\n arc(rc0, outerSweep, ex, ey)\n } else {\n arc(rc0, outerSweep, t0.cx + t0.x11, t0.cy + t0.y11)\n ring(r0, angleOf(t0.cx + t0.x11, t0.cy + t0.y11), angleOf(t1.cx + t1.x11, t1.cy + t1.y11), cw)\n arc(rc0, outerSweep, t1.cx + t1.x01, t1.cy + t1.y01)\n }\n } else {\n line(x10, y10)\n arc(r0, outerSweep, x10, y10)\n ring(r0, a10, a00, cw)\n arc(r0, outerSweep, x00, y00)\n }\n return `${d}Z`\n}\n","/**\n * Arcs that turn to their new angles: a transition of `d` moves each point\n * of a path along a straight line, which bends a slice out of its ring on\n * the way. A path that knows which arc it draws (the `arc` of its node, see\n * `arcNode`) is redrawn frame by frame instead, with the angles and radii\n * in between, so slices grow and shrink around the center. Timed by the\n * path's `transition-duration` (`--tc-duration`), with an ease-out curve.\n */\n\nimport { type ArcOptions, arcPathStable } from '../shapes/arc.ts'\nimport { type Attrs, h, type VNode } from '../vnode.ts'\nimport { stop, tween } from './tween.ts'\n\n/**\n * A path drawing this arc, which keeps the arc with it (radii, angles, pad\n * angle, corner radius): out of the markup, for the next render to sweep from.\n */\nexport function arcNode(name: string, arc: ArcOptions): VNode {\n const node = h('path', { class: name, d: arcPathStable(arc) })\n node.arc = [\n arc.innerRadius,\n arc.outerRadius,\n arc.startAngle,\n arc.endAngle,\n arc.padAngle ?? 0,\n arc.cornerRadius ?? 0,\n ]\n return node\n}\n\n/**\n * Take `el` from the arc of its last render, `prev`, to the arc of `next`.\n * Returns the attributes left for the caller to patch (all but `d`, set\n * here frame by frame), or nothing when there is no sweep: not an arc, the\n * same path, no arc to come from, or a chart without transitions.\n */\nexport function sweep(el: Element, prev: VNode, next: VNode): Attrs | undefined {\n const { arc, attrs } = next\n if (!arc || prev.attrs.d === attrs.d) return\n // An interrupted sweep continues from where the arc is now.\n const origin = stop(el) ?? prev.arc\n // Zero in a chart without transitions (static, resizing, reduced motion).\n const duration = Number.parseFloat(getComputedStyle(el).transitionDuration) * 1000\n if (!origin || !(duration > 0)) return\n tween(\n el,\n origin,\n arc,\n duration,\n ([innerRadius, outerRadius, startAngle, endAngle, padAngle, cornerRadius]) =>\n arcPathStable({\n innerRadius,\n outerRadius,\n startAngle,\n endAngle,\n padAngle,\n cornerRadius,\n } as ArcOptions),\n String(attrs.d),\n )\n return { ...attrs, d: prev.attrs.d as string }\n}\n"],"mappings":";;;;;;;;;;AAQA,MAAM,UAAU;AAChB,MAAM,KAAK,KAAK;AAChB,MAAM,UAAU,KAAK;AACrB,MAAM,MAAM,IAAI;;AAGhB,MAAa,MAAc,KAAK,KAAK;AAMrC,MAAM,QAAQ,MAAuB,KAAK,IAAI,UAAU,KAAK,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC;AACxF,MAAM,QAAQ,MAAuB,IAAI,IAAI,IAAI,IAAI,KAAK,KAAK,KAAK,KAAK,CAAC;AAwF1E,SAAS,UACP,IACA,IACA,IACA,IACA,IACA,IACA,IACA,IAC8B;CAC9B,MAAM,MAAM,KAAK;CACjB,MAAM,MAAM,KAAK;CACjB,MAAM,MAAM,KAAK;CACjB,MAAM,MAAM,KAAK;CACjB,IAAI,IAAI,MAAM,MAAM,MAAM;CAC1B,IAAI,IAAI,IAAI,SAAS,OAAO,KAAA;CAC5B,KAAK,OAAO,KAAK,MAAM,O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AAM,EAAE,KAAK,UAAU;CACvB,IAAI,CAAC,OAAO,KAAK,MAAM,MAAM,MAAM,GAAG;CAEtC,MAAM,SAAS,KAAK,EAAE,KAAK,KAAK;CAEhC,MAAM,WAAW,OAAO,WAAW,iBAAiB,EAAE,CAAC,CAAC,kBAAkB,IAAI;CAC9E,IAAI,CAAC,UAAU,EAAE,WAAW,IAAI;CAChC,MACE,IACA,QACA,KACA,WACC,CAAC,aAAa,aAAa,YAAY,UAAU,UAAU,kBAC1D,cAAc;EACZ;EACA;EACA;EACA;EACA;EACA;CACF,CAAe,GACjB,OAAO,MAAM,CAAC,CAChB;CACA,OAAO;EAAE,GAAG;EAAO,GAAG,KAAK,MAAM;CAAY;AAC/C"}
@@ -0,0 +1,112 @@
1
+ import { n as BandScale, t as BandKey } from "./band-DTcNDAFO.js";
2
+ //#region src/format.d.ts
3
+ /**
4
+ * Number and date formatting built on `Intl` — locale aware, zero bytes of
5
+ * locale data shipped.
6
+ *
7
+ * Formats are plain data (`Intl` options) or functions, so chart configs stay
8
+ * serializable (JSON attributes, SSR). Pass an explicit `locale` when
9
+ * rendering on the server, otherwise server and browser may disagree.
10
+ */
11
+ /** Locale(s) passed to `Intl`; `undefined` uses the runtime default. */
12
+ type Locale = string | readonly string[] | undefined;
13
+ /** `Intl.NumberFormat` options, plus suffixes of our own for compact notation. */
14
+ interface NumberFormatOptions extends Intl.NumberFormatOptions {
15
+ /**
16
+ * Compact notation with these suffixes for thousands, millions, billions…
17
+ * instead of the locale's words: `['k', 'M', 'G']` writes 1500 as "1.5k",
18
+ * or "1,5k" in Polish, where the locale itself writes "1,5 tys.". `true`
19
+ * stands for `['K', 'M', 'B', 'T']`. Larger numbers keep the last suffix.
20
+ */
21
+ compactSymbols?: boolean | readonly string[];
22
+ }
23
+ /** Number format options or a custom formatter. */
24
+ type NumberFormat = NumberFormatOptions | ((value: number) => string);
25
+ /** `Intl.DateTimeFormat` options or a custom formatter. */
26
+ type DateFormat = Intl.DateTimeFormatOptions | ((value: Date) => string);
27
+ /** Shared, cached `Intl.NumberFormat` instance. */
28
+ declare function getNumberFormat(locale?: Locale, options?: Intl.NumberFormatOptions): Intl.NumberFormat;
29
+ /** Shared, cached `Intl.DateTimeFormat` instance. */
30
+ declare function getDateFormat(locale?: Locale, options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
31
+ /**
32
+ * Create a number formatter.
33
+ *
34
+ * ```ts
35
+ * formatNumber({ style: 'currency', currency: 'PLN' }, 'pl-PL')(1234.5) // "1234,50 zł"
36
+ * ```
37
+ */
38
+ declare function formatNumber(format?: NumberFormat, locale?: Locale): (value: number) => string;
39
+ /**
40
+ * A formatter for values read one at a time (tooltips, data tables) in an
41
+ * axis format. Compact notation suits ticks ("$25K") but hides the
42
+ * difference between values: unless the format sets its own precision, it
43
+ * keeps three significant digits ("$24.8K").
44
+ */
45
+ declare function formatDetail(format?: NumberFormat, locale?: Locale): (value: number) => string;
46
+ /**
47
+ * Number of fraction digits needed to tell apart ticks `step` apart,
48
+ * e.g. `1 → 0`, `0.2 → 1`, `0.05 → 2`.
49
+ */
50
+ declare function stepPrecision(step: number): number;
51
+ /**
52
+ * Create a formatter for axis ticks `step` apart. Unless `format` sets its
53
+ * own precision, every tick gets the same number of fraction digits, derived
54
+ * from the step (`0, 0.5, 1` → `0.0, 0.5, 1.0`).
55
+ */
56
+ declare function formatTicks(step: number, format?: NumberFormat, locale?: Locale): (value: number) => string;
57
+ /**
58
+ * Create a date formatter accepting `Date` objects or timestamps.
59
+ *
60
+ * ```ts
61
+ * formatDate({ month: 'short', day: 'numeric' }, 'en-US')(new Date(2026, 0, 5)) // "Jan 5"
62
+ * ```
63
+ */
64
+ declare function formatDate(format?: DateFormat, locale?: Locale): (value: Date | number) => string;
65
+ //#endregion
66
+ //#region src/scales/time.d.ts
67
+ /** A point in time: a `Date` or a timestamp in milliseconds. */
68
+ type TimeValue = Date | number;
69
+ interface TimeScaleOptions {
70
+ /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */
71
+ utc?: boolean;
72
+ /** Clamp output to the range. */
73
+ clamp?: boolean;
74
+ }
75
+ /** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */
76
+ interface TimeScale {
77
+ (value: TimeValue): number;
78
+ readonly domain: readonly [number, number];
79
+ readonly range: readonly [number, number];
80
+ readonly utc: boolean;
81
+ /** Map a pixel back to a time. */
82
+ invert(pixel: number): Date;
83
+ /** Tick dates at calendar boundaries, roughly `count` of them. */
84
+ ticks(count?: number): Date[];
85
+ /** A formatter suited to the tick interval chosen for `count`. */
86
+ tickFormat(count?: number, locale?: Locale): (date: Date) => string;
87
+ /** A copy with the domain extended to tick boundaries. */
88
+ nice(count?: number): TimeScale;
89
+ }
90
+ /**
91
+ * Create a time scale over `[start, end]`.
92
+ *
93
+ * ```ts
94
+ * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])
95
+ * x.ticks() // first of each month, or every week, depending on the range
96
+ * x.tickFormat() // e.g. "Jan", "Feb"
97
+ * ```
98
+ */
99
+ declare function time(domain: readonly [TimeValue, TimeValue], range: readonly [number, number], options?: TimeScaleOptions): TimeScale;
100
+ /**
101
+ * A point scale over time for category charts: each category sits at its
102
+ * real distance in time. Conforms to `BandScale` (zero bandwidth), so line
103
+ * and area charts and their hit testing work unchanged. `stamps` must be
104
+ * ascending; `keys` are the categories' keys.
105
+ */
106
+ declare function timePointScale(stamps: readonly number[], keys: readonly BandKey[], range: readonly [number, number], utc: boolean): {
107
+ scale: BandScale;
108
+ time: TimeScale;
109
+ };
110
+ //#endregion
111
+ export { timePointScale as a, NumberFormat as c, formatDetail as d, formatNumber as f, stepPrecision as g, getNumberFormat as h, time as i, NumberFormatOptions as l, getDateFormat as m, TimeScaleOptions as n, DateFormat as o, formatTicks as p, TimeValue as r, Locale as s, TimeScale as t, formatDate as u };
112
+ //# sourceMappingURL=time-CHjiY9Q4.d.ts.map
@@ -0,0 +1,112 @@
1
+ import { n as BandScale, t as BandKey } from "./band-DTcNDAFO.cjs";
2
+ //#region src/format.d.ts
3
+ /**
4
+ * Number and date formatting built on `Intl` — locale aware, zero bytes of
5
+ * locale data shipped.
6
+ *
7
+ * Formats are plain data (`Intl` options) or functions, so chart configs stay
8
+ * serializable (JSON attributes, SSR). Pass an explicit `locale` when
9
+ * rendering on the server, otherwise server and browser may disagree.
10
+ */
11
+ /** Locale(s) passed to `Intl`; `undefined` uses the runtime default. */
12
+ type Locale = string | readonly string[] | undefined;
13
+ /** `Intl.NumberFormat` options, plus suffixes of our own for compact notation. */
14
+ interface NumberFormatOptions extends Intl.NumberFormatOptions {
15
+ /**
16
+ * Compact notation with these suffixes for thousands, millions, billions…
17
+ * instead of the locale's words: `['k', 'M', 'G']` writes 1500 as "1.5k",
18
+ * or "1,5k" in Polish, where the locale itself writes "1,5 tys.". `true`
19
+ * stands for `['K', 'M', 'B', 'T']`. Larger numbers keep the last suffix.
20
+ */
21
+ compactSymbols?: boolean | readonly string[];
22
+ }
23
+ /** Number format options or a custom formatter. */
24
+ type NumberFormat = NumberFormatOptions | ((value: number) => string);
25
+ /** `Intl.DateTimeFormat` options or a custom formatter. */
26
+ type DateFormat = Intl.DateTimeFormatOptions | ((value: Date) => string);
27
+ /** Shared, cached `Intl.NumberFormat` instance. */
28
+ declare function getNumberFormat(locale?: Locale, options?: Intl.NumberFormatOptions): Intl.NumberFormat;
29
+ /** Shared, cached `Intl.DateTimeFormat` instance. */
30
+ declare function getDateFormat(locale?: Locale, options?: Intl.DateTimeFormatOptions): Intl.DateTimeFormat;
31
+ /**
32
+ * Create a number formatter.
33
+ *
34
+ * ```ts
35
+ * formatNumber({ style: 'currency', currency: 'PLN' }, 'pl-PL')(1234.5) // "1234,50 zł"
36
+ * ```
37
+ */
38
+ declare function formatNumber(format?: NumberFormat, locale?: Locale): (value: number) => string;
39
+ /**
40
+ * A formatter for values read one at a time (tooltips, data tables) in an
41
+ * axis format. Compact notation suits ticks ("$25K") but hides the
42
+ * difference between values: unless the format sets its own precision, it
43
+ * keeps three significant digits ("$24.8K").
44
+ */
45
+ declare function formatDetail(format?: NumberFormat, locale?: Locale): (value: number) => string;
46
+ /**
47
+ * Number of fraction digits needed to tell apart ticks `step` apart,
48
+ * e.g. `1 → 0`, `0.2 → 1`, `0.05 → 2`.
49
+ */
50
+ declare function stepPrecision(step: number): number;
51
+ /**
52
+ * Create a formatter for axis ticks `step` apart. Unless `format` sets its
53
+ * own precision, every tick gets the same number of fraction digits, derived
54
+ * from the step (`0, 0.5, 1` → `0.0, 0.5, 1.0`).
55
+ */
56
+ declare function formatTicks(step: number, format?: NumberFormat, locale?: Locale): (value: number) => string;
57
+ /**
58
+ * Create a date formatter accepting `Date` objects or timestamps.
59
+ *
60
+ * ```ts
61
+ * formatDate({ month: 'short', day: 'numeric' }, 'en-US')(new Date(2026, 0, 5)) // "Jan 5"
62
+ * ```
63
+ */
64
+ declare function formatDate(format?: DateFormat, locale?: Locale): (value: Date | number) => string;
65
+ //#endregion
66
+ //#region src/scales/time.d.ts
67
+ /** A point in time: a `Date` or a timestamp in milliseconds. */
68
+ type TimeValue = Date | number;
69
+ interface TimeScaleOptions {
70
+ /** Align ticks to UTC instead of local time (use it for SSR). Defaults to `false`. */
71
+ utc?: boolean;
72
+ /** Clamp output to the range. */
73
+ clamp?: boolean;
74
+ }
75
+ /** Continuous scale mapping time to a pixel range, with calendar-aware ticks. */
76
+ interface TimeScale {
77
+ (value: TimeValue): number;
78
+ readonly domain: readonly [number, number];
79
+ readonly range: readonly [number, number];
80
+ readonly utc: boolean;
81
+ /** Map a pixel back to a time. */
82
+ invert(pixel: number): Date;
83
+ /** Tick dates at calendar boundaries, roughly `count` of them. */
84
+ ticks(count?: number): Date[];
85
+ /** A formatter suited to the tick interval chosen for `count`. */
86
+ tickFormat(count?: number, locale?: Locale): (date: Date) => string;
87
+ /** A copy with the domain extended to tick boundaries. */
88
+ nice(count?: number): TimeScale;
89
+ }
90
+ /**
91
+ * Create a time scale over `[start, end]`.
92
+ *
93
+ * ```ts
94
+ * const x = time([new Date(2026, 0, 1), new Date(2026, 2, 31)], [0, 600])
95
+ * x.ticks() // first of each month, or every week, depending on the range
96
+ * x.tickFormat() // e.g. "Jan", "Feb"
97
+ * ```
98
+ */
99
+ declare function time(domain: readonly [TimeValue, TimeValue], range: readonly [number, number], options?: TimeScaleOptions): TimeScale;
100
+ /**
101
+ * A point scale over time for category charts: each category sits at its
102
+ * real distance in time. Conforms to `BandScale` (zero bandwidth), so line
103
+ * and area charts and their hit testing work unchanged. `stamps` must be
104
+ * ascending; `keys` are the categories' keys.
105
+ */
106
+ declare function timePointScale(stamps: readonly number[], keys: readonly BandKey[], range: readonly [number, number], utc: boolean): {
107
+ scale: BandScale;
108
+ time: TimeScale;
109
+ };
110
+ //#endregion
111
+ export { timePointScale as a, NumberFormat as c, formatDetail as d, formatNumber as f, stepPrecision as g, getNumberFormat as h, time as i, NumberFormatOptions as l, getDateFormat as m, TimeScaleOptions as n, DateFormat as o, formatTicks as p, TimeValue as r, Locale as s, TimeScale as t, formatDate as u };
112
+ //# sourceMappingURL=time-CNVnt-B2.d.cts.map