basalt-ui 1.30.2 → 1.32.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 (357) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +54 -0
  3. package/MIGRATING.md +256 -12
  4. package/agent/rules/basalt-controls.md +19 -19
  5. package/agent/rules/basalt-mantine.md +5 -5
  6. package/configs/oxlint-plugin.js +371 -4
  7. package/configs/oxlint-plugin.test.ts +327 -2
  8. package/configs/oxlint.json +2 -1
  9. package/dist/agent-chat/composer.d.ts.map +1 -1
  10. package/dist/agent-chat/composer.js +41 -43
  11. package/dist/agent-chat/thread-workspace.d.ts +2 -2
  12. package/dist/agent-chat/thread-workspace.d.ts.map +1 -1
  13. package/dist/agent-chat/thread-workspace.js +3 -4
  14. package/dist/agent-chat/use-keyboard-inset.d.ts +2 -0
  15. package/dist/agent-chat/use-keyboard-inset.d.ts.map +1 -0
  16. package/dist/agent-chat/use-keyboard-inset.js +34 -0
  17. package/dist/charts/cursor/touch-pin.d.ts +45 -0
  18. package/dist/charts/cursor/touch-pin.d.ts.map +1 -0
  19. package/dist/charts/cursor/touch-pin.js +79 -0
  20. package/dist/charts/hooks/use-discrete-cursor.d.ts +66 -0
  21. package/dist/charts/hooks/use-discrete-cursor.d.ts.map +1 -0
  22. package/dist/charts/hooks/use-discrete-cursor.js +198 -0
  23. package/dist/charts/hooks/use-hysteresis.d.ts +18 -0
  24. package/dist/charts/hooks/use-hysteresis.d.ts.map +1 -0
  25. package/dist/charts/hooks/use-hysteresis.js +12 -0
  26. package/dist/charts/hooks/useBandPlot.d.ts +7 -0
  27. package/dist/charts/hooks/useBandPlot.d.ts.map +1 -1
  28. package/dist/charts/hooks/useBandPlot.js +62 -18
  29. package/dist/charts/hooks/useChartCursor.d.ts +40 -11
  30. package/dist/charts/hooks/useChartCursor.d.ts.map +1 -1
  31. package/dist/charts/hooks/useChartCursor.js +102 -11
  32. package/dist/charts/index.d.ts +0 -1
  33. package/dist/charts/index.d.ts.map +1 -1
  34. package/dist/charts/index.js +0 -10
  35. package/dist/charts/kinds/BandStrip.d.ts.map +1 -1
  36. package/dist/charts/kinds/BandStrip.js +47 -82
  37. package/dist/charts/kinds/Donut.d.ts +9 -3
  38. package/dist/charts/kinds/Donut.d.ts.map +1 -1
  39. package/dist/charts/kinds/Donut.js +110 -48
  40. package/dist/charts/kinds/DualPanel.d.ts.map +1 -1
  41. package/dist/charts/kinds/DualPanel.js +138 -145
  42. package/dist/charts/kinds/Heatmap.d.ts +7 -0
  43. package/dist/charts/kinds/Heatmap.d.ts.map +1 -1
  44. package/dist/charts/kinds/Heatmap.js +37 -16
  45. package/dist/charts/kinds/MirroredBars.d.ts.map +1 -1
  46. package/dist/charts/kinds/MirroredBars.js +68 -111
  47. package/dist/charts/kinds/band-chrome.d.ts +31 -0
  48. package/dist/charts/kinds/band-chrome.d.ts.map +1 -0
  49. package/dist/charts/kinds/band-chrome.js +71 -0
  50. package/dist/charts/kinds/donut-layout.d.ts +47 -0
  51. package/dist/charts/kinds/donut-layout.d.ts.map +1 -0
  52. package/dist/charts/kinds/donut-layout.js +52 -0
  53. package/dist/charts/layout/auto-margin.d.ts +7 -2
  54. package/dist/charts/layout/auto-margin.d.ts.map +1 -1
  55. package/dist/charts/layout/auto-margin.js +12 -3
  56. package/dist/charts/layout/end-labels.d.ts +64 -0
  57. package/dist/charts/layout/end-labels.d.ts.map +1 -0
  58. package/dist/charts/layout/end-labels.js +76 -0
  59. package/dist/charts/primitives/Axes.d.ts +32 -4
  60. package/dist/charts/primitives/Axes.d.ts.map +1 -1
  61. package/dist/charts/primitives/Axes.js +62 -16
  62. package/dist/charts/primitives/CartesianChart.d.ts +7 -6
  63. package/dist/charts/primitives/CartesianChart.d.ts.map +1 -1
  64. package/dist/charts/primitives/CartesianChart.js +264 -145
  65. package/dist/charts/primitives/ChartCard.d.ts +0 -14
  66. package/dist/charts/primitives/ChartCard.d.ts.map +1 -1
  67. package/dist/charts/primitives/ChartCard.js +56 -21
  68. package/dist/charts/primitives/ChartFrame.d.ts +28 -22
  69. package/dist/charts/primitives/ChartFrame.d.ts.map +1 -1
  70. package/dist/charts/primitives/ChartFrame.js +116 -34
  71. package/dist/charts/primitives/ChartLegend.d.ts +19 -15
  72. package/dist/charts/primitives/ChartLegend.d.ts.map +1 -1
  73. package/dist/charts/primitives/ChartLegend.js +86 -73
  74. package/dist/charts/primitives/ChartTooltip.d.ts +5 -0
  75. package/dist/charts/primitives/ChartTooltip.d.ts.map +1 -1
  76. package/dist/charts/primitives/ChartTooltip.js +20 -4
  77. package/dist/charts/primitives/Crosshair.js +2 -2
  78. package/dist/charts/primitives/HoverOverlay.d.ts +29 -9
  79. package/dist/charts/primitives/HoverOverlay.d.ts.map +1 -1
  80. package/dist/charts/primitives/HoverOverlay.js +54 -27
  81. package/dist/charts/primitives/HoverOverlay.module.css +13 -0
  82. package/dist/charts/primitives/HoverOverlay.module.css.d.ts +8 -0
  83. package/dist/charts/primitives/chart-card-context.d.ts +33 -0
  84. package/dist/charts/primitives/chart-card-context.d.ts.map +1 -0
  85. package/dist/charts/primitives/chart-card-context.js +18 -0
  86. package/dist/charts/primitives/chart-frame-layout.d.ts +93 -113
  87. package/dist/charts/primitives/chart-frame-layout.d.ts.map +1 -1
  88. package/dist/charts/primitives/chart-frame-layout.js +75 -34
  89. package/dist/charts/primitives/chart-layout.d.ts +112 -0
  90. package/dist/charts/primitives/chart-layout.d.ts.map +1 -0
  91. package/dist/charts/primitives/chart-layout.js +175 -0
  92. package/dist/charts/primitives/chart-tier.d.ts +13 -11
  93. package/dist/charts/primitives/chart-tier.d.ts.map +1 -1
  94. package/dist/charts/primitives/chart-tier.js +42 -13
  95. package/dist/charts/primitives/legend-disclosure.d.ts +27 -0
  96. package/dist/charts/primitives/legend-disclosure.d.ts.map +1 -0
  97. package/dist/charts/primitives/legend-disclosure.js +153 -0
  98. package/dist/charts/series.d.ts +4 -1
  99. package/dist/charts/series.d.ts.map +1 -1
  100. package/dist/charts/utils/ticks.d.ts +27 -8
  101. package/dist/charts/utils/ticks.d.ts.map +1 -1
  102. package/dist/charts/utils/ticks.js +35 -11
  103. package/dist/common/errors.d.ts +11 -1
  104. package/dist/common/errors.d.ts.map +1 -1
  105. package/dist/common/errors.js +16 -2
  106. package/dist/common/hit-floor.d.ts +10 -0
  107. package/dist/common/hit-floor.d.ts.map +1 -0
  108. package/dist/common/hit-floor.js +6 -0
  109. package/dist/{shell → common}/isomorphic-layout-effect.d.ts +4 -3
  110. package/dist/common/isomorphic-layout-effect.d.ts.map +1 -0
  111. package/dist/common/use-measured-widths.d.ts +37 -0
  112. package/dist/common/use-measured-widths.d.ts.map +1 -0
  113. package/dist/common/use-measured-widths.js +51 -0
  114. package/dist/common/use-media-query.d.ts +6 -0
  115. package/dist/common/use-media-query.d.ts.map +1 -0
  116. package/dist/common/use-media-query.js +40 -0
  117. package/dist/common/validate.d.ts +9 -0
  118. package/dist/common/validate.d.ts.map +1 -1
  119. package/dist/common/validate.js +9 -4
  120. package/dist/content/article-layout.d.ts +4 -2
  121. package/dist/content/article-layout.d.ts.map +1 -1
  122. package/dist/content/article-layout.js +43 -3
  123. package/dist/content/article-layout.module.css +45 -4
  124. package/dist/content/article-layout.module.css.d.ts +3 -0
  125. package/dist/content/code-block.d.ts.map +1 -1
  126. package/dist/content/code-block.js +40 -2
  127. package/dist/content/code-block.module.css +32 -2
  128. package/dist/content/prose.module.css +13 -8
  129. package/dist/controls/actions.d.ts +29 -6
  130. package/dist/controls/actions.d.ts.map +1 -1
  131. package/dist/controls/actions.js +158 -27
  132. package/dist/controls/actions.module.css +14 -1
  133. package/dist/controls/actions.module.css.d.ts +1 -0
  134. package/dist/controls/controls.module.css +13 -31
  135. package/dist/controls/enum-filter.js +2 -2
  136. package/dist/controls/filter-context.d.ts +10 -0
  137. package/dist/controls/filter-context.d.ts.map +1 -1
  138. package/dist/controls/filter-context.js +2 -0
  139. package/dist/controls/filter-pill.d.ts.map +1 -1
  140. package/dist/controls/filter-pill.js +1 -0
  141. package/dist/controls/index.d.ts +1 -1
  142. package/dist/controls/index.d.ts.map +1 -1
  143. package/dist/controls/index.js +0 -2
  144. package/dist/controls/multi-select-filter.js +2 -2
  145. package/dist/controls/sync-button.module.css +2 -1
  146. package/dist/dashboard/section.d.ts.map +1 -1
  147. package/dist/dashboard/section.js +1 -0
  148. package/dist/dashboard/section.module.css +1 -26
  149. package/dist/dashboard/stat-card.d.ts +1 -1
  150. package/dist/dashboard/stat-card.d.ts.map +1 -1
  151. package/dist/dashboard/stat-card.js +4 -1
  152. package/dist/dashboard/stat-card.module.css +6 -9
  153. package/dist/dashboard/stat-group.module.css +33 -66
  154. package/dist/dashboard/widget-grid.d.ts.map +1 -1
  155. package/dist/dashboard/widget-grid.module.css +11 -38
  156. package/dist/dashboard/widget-header.d.ts +14 -4
  157. package/dist/dashboard/widget-header.d.ts.map +1 -1
  158. package/dist/dashboard/widget-header.js +23 -6
  159. package/dist/dashboard/widget-header.module.css +145 -133
  160. package/dist/dashboard/widget-header.module.css.d.ts +2 -0
  161. package/dist/data/data-table-state.d.ts +83 -0
  162. package/dist/data/data-table-state.d.ts.map +1 -0
  163. package/dist/data/data-table-state.js +139 -0
  164. package/dist/data/data-table.d.ts +56 -2
  165. package/dist/data/data-table.d.ts.map +1 -1
  166. package/dist/data/data-table.js +436 -336
  167. package/dist/data/data-table.module.css +94 -0
  168. package/dist/data/data-table.module.css.d.ts +11 -0
  169. package/dist/data/virtual-list.d.ts.map +1 -1
  170. package/dist/data/virtual-list.js +10 -0
  171. package/dist/forms/form-layout.d.ts.map +1 -1
  172. package/dist/forms/form-layout.js +3 -3
  173. package/dist/forms/form-layout.module.css +20 -5
  174. package/dist/forms/form-layout.module.css.d.ts +1 -0
  175. package/dist/guard/index.d.ts +8 -2
  176. package/dist/guard/index.d.ts.map +1 -1
  177. package/dist/guard/index.js +68 -2
  178. package/dist/guard/types.d.ts +3 -3
  179. package/dist/guard/types.d.ts.map +1 -1
  180. package/dist/index.d.ts +1 -1
  181. package/dist/index.d.ts.map +1 -1
  182. package/dist/index.js +3 -1
  183. package/dist/notifications/center.d.ts.map +1 -1
  184. package/dist/provider/index.d.ts +20 -1
  185. package/dist/provider/index.d.ts.map +1 -1
  186. package/dist/provider/index.js +30 -8
  187. package/dist/shell/app-brand.d.ts.map +1 -1
  188. package/dist/shell/app-brand.js +1 -0
  189. package/dist/shell/app-brand.module.css +2 -2
  190. package/dist/shell/app-header.module.css +18 -8
  191. package/dist/shell/app-main.module.css +54 -3
  192. package/dist/shell/app-main.module.css.d.ts +1 -0
  193. package/dist/shell/app-mobile-nav.module.css +16 -4
  194. package/dist/shell/app-sidebar.module.css +4 -6
  195. package/dist/shell/aside-docking.d.ts +31 -0
  196. package/dist/shell/aside-docking.d.ts.map +1 -0
  197. package/dist/shell/aside-docking.js +19 -0
  198. package/dist/shell/index.d.ts +1 -0
  199. package/dist/shell/index.d.ts.map +1 -1
  200. package/dist/shell/index.js +56 -16
  201. package/dist/shell/mobile-nav-model.d.ts +1 -1
  202. package/dist/shell/page-aside.d.ts +22 -3
  203. package/dist/shell/page-aside.d.ts.map +1 -1
  204. package/dist/shell/page-aside.js +27 -13
  205. package/dist/shell/page-bar.d.ts.map +1 -1
  206. package/dist/shell/page-bar.js +10 -5
  207. package/dist/shell/page-bar.module.css +10 -34
  208. package/dist/shell/use-breakpoint.d.ts +3 -4
  209. package/dist/shell/use-breakpoint.d.ts.map +1 -1
  210. package/dist/shell/use-breakpoint.js +3 -25
  211. package/dist/shell/use-size-class.d.ts +6 -0
  212. package/dist/shell/use-size-class.d.ts.map +1 -0
  213. package/dist/shell/use-size-class.js +19 -0
  214. package/dist/state/persisted-or-local.d.ts +4 -1
  215. package/dist/state/persisted-or-local.d.ts.map +1 -1
  216. package/dist/state/persisted-or-local.js +4 -3
  217. package/dist/state/persisted.d.ts +10 -0
  218. package/dist/state/persisted.d.ts.map +1 -1
  219. package/dist/state/persisted.js +44 -14
  220. package/dist/styles.css +41 -0
  221. package/dist/surfaces.d.ts +4 -4
  222. package/dist/surfaces.d.ts.map +1 -1
  223. package/dist/surfaces.js +11 -3
  224. package/dist/theme/controls.module.css +7 -0
  225. package/dist/theme/ctl-theme.d.ts +1 -0
  226. package/dist/theme/ctl-theme.d.ts.map +1 -1
  227. package/dist/theme/ctl-theme.js +12 -4
  228. package/dist/theme/floating.module.css +37 -0
  229. package/dist/theme/floating.module.css.d.ts +3 -0
  230. package/dist/theme/index.d.ts +2 -2
  231. package/dist/theme/index.d.ts.map +1 -1
  232. package/dist/theme/index.js +34 -5
  233. package/dist/theme/nav-link.module.css +7 -0
  234. package/dist/theme-lab/derive-controls.d.ts.map +1 -1
  235. package/dist/tokens/index.d.ts +7 -16
  236. package/dist/tokens/index.d.ts.map +1 -1
  237. package/dist/tokens/index.js +23 -28
  238. package/dist/tokens/palette.d.ts +5 -27
  239. package/dist/tokens/palette.d.ts.map +1 -1
  240. package/dist/tokens/palette.js +8 -30
  241. package/dist/tokens/size-classes.d.ts +40 -0
  242. package/dist/tokens/size-classes.d.ts.map +1 -0
  243. package/dist/tokens/size-classes.js +29 -0
  244. package/dist/tokens.css +8 -4
  245. package/llms.txt +3 -3
  246. package/package.json +18 -17
  247. package/src/agent-chat/composer.tsx +74 -47
  248. package/src/agent-chat/thread-workspace.tsx +8 -11
  249. package/src/agent-chat/use-keyboard-inset.ts +68 -0
  250. package/src/charts/cursor/touch-pin.ts +138 -0
  251. package/src/charts/hooks/use-discrete-cursor.ts +335 -0
  252. package/src/charts/hooks/use-hysteresis.ts +26 -0
  253. package/src/charts/hooks/useBandPlot.ts +90 -27
  254. package/src/charts/hooks/useChartCursor.ts +211 -26
  255. package/src/charts/index.ts +0 -8
  256. package/src/charts/kinds/BandStrip.tsx +25 -61
  257. package/src/charts/kinds/Donut.tsx +153 -62
  258. package/src/charts/kinds/DualPanel.tsx +21 -26
  259. package/src/charts/kinds/Heatmap.tsx +61 -22
  260. package/src/charts/kinds/MirroredBars.tsx +23 -65
  261. package/src/charts/kinds/band-chrome.tsx +91 -0
  262. package/src/charts/kinds/donut-layout.ts +82 -0
  263. package/src/charts/layout/auto-margin.ts +24 -5
  264. package/src/charts/layout/end-labels.ts +135 -0
  265. package/src/charts/primitives/Axes.tsx +112 -21
  266. package/src/charts/primitives/CartesianChart.tsx +282 -111
  267. package/src/charts/primitives/ChartCard.tsx +119 -48
  268. package/src/charts/primitives/ChartFrame.tsx +204 -60
  269. package/src/charts/primitives/ChartLegend.tsx +115 -78
  270. package/src/charts/primitives/ChartTooltip.tsx +24 -3
  271. package/src/charts/primitives/Crosshair.tsx +2 -2
  272. package/src/charts/primitives/HoverOverlay.module.css +13 -0
  273. package/src/charts/primitives/HoverOverlay.module.css.d.ts +8 -0
  274. package/src/charts/primitives/HoverOverlay.tsx +62 -20
  275. package/src/charts/primitives/chart-card-context.ts +46 -0
  276. package/src/charts/primitives/chart-frame-layout.ts +207 -182
  277. package/src/charts/primitives/chart-layout.ts +318 -0
  278. package/src/charts/primitives/chart-tier.tsx +66 -21
  279. package/src/charts/primitives/legend-disclosure.tsx +177 -0
  280. package/src/charts/series.ts +4 -1
  281. package/src/charts/utils/ticks.ts +95 -19
  282. package/src/common/errors.ts +25 -1
  283. package/src/common/hit-floor.ts +9 -0
  284. package/src/{shell → common}/isomorphic-layout-effect.ts +4 -3
  285. package/src/common/use-measured-widths.ts +88 -0
  286. package/src/common/use-media-query.ts +56 -0
  287. package/src/common/validate.ts +17 -4
  288. package/src/content/article-layout.module.css +45 -4
  289. package/src/content/article-layout.module.css.d.ts +3 -0
  290. package/src/content/article-layout.tsx +60 -5
  291. package/src/content/code-block.module.css +32 -2
  292. package/src/content/code-block.tsx +47 -3
  293. package/src/content/prose.module.css +13 -8
  294. package/src/controls/actions.module.css +14 -1
  295. package/src/controls/actions.module.css.d.ts +1 -0
  296. package/src/controls/actions.tsx +223 -75
  297. package/src/controls/controls.module.css +13 -31
  298. package/src/controls/enum-filter.tsx +2 -2
  299. package/src/controls/filter-context.tsx +11 -0
  300. package/src/controls/filter-pill.tsx +1 -0
  301. package/src/controls/index.ts +0 -1
  302. package/src/controls/multi-select-filter.tsx +2 -2
  303. package/src/controls/sync-button.module.css +2 -1
  304. package/src/dashboard/section.module.css +1 -26
  305. package/src/dashboard/section.tsx +1 -0
  306. package/src/dashboard/stat-card.module.css +6 -9
  307. package/src/dashboard/stat-card.tsx +6 -3
  308. package/src/dashboard/stat-group.module.css +33 -66
  309. package/src/dashboard/widget-grid.module.css +11 -38
  310. package/src/dashboard/widget-grid.tsx +7 -6
  311. package/src/dashboard/widget-header.module.css +145 -133
  312. package/src/dashboard/widget-header.module.css.d.ts +2 -0
  313. package/src/dashboard/widget-header.tsx +45 -11
  314. package/src/data/data-table-state.ts +218 -0
  315. package/src/data/data-table.module.css +94 -0
  316. package/src/data/data-table.module.css.d.ts +11 -0
  317. package/src/data/data-table.tsx +547 -299
  318. package/src/data/virtual-list.tsx +31 -0
  319. package/src/forms/form-layout.module.css +20 -5
  320. package/src/forms/form-layout.module.css.d.ts +1 -0
  321. package/src/forms/form-layout.tsx +12 -10
  322. package/src/guard/index.ts +188 -3
  323. package/src/guard/types.ts +3 -2
  324. package/src/index.ts +2 -0
  325. package/src/notifications/center.tsx +3 -0
  326. package/src/provider/index.tsx +60 -7
  327. package/src/shell/app-brand.module.css +2 -2
  328. package/src/shell/app-brand.tsx +1 -0
  329. package/src/shell/app-header.module.css +18 -8
  330. package/src/shell/app-main.module.css +54 -3
  331. package/src/shell/app-main.module.css.d.ts +1 -0
  332. package/src/shell/app-mobile-nav.module.css +16 -4
  333. package/src/shell/app-sidebar.module.css +4 -6
  334. package/src/shell/aside-docking.ts +54 -0
  335. package/src/shell/index.tsx +178 -129
  336. package/src/shell/mobile-nav-model.ts +1 -1
  337. package/src/shell/page-aside.tsx +70 -21
  338. package/src/shell/page-bar.module.css +10 -34
  339. package/src/shell/page-bar.tsx +10 -5
  340. package/src/shell/use-breakpoint.ts +9 -45
  341. package/src/shell/use-size-class.ts +31 -0
  342. package/src/state/persisted-or-local.ts +10 -4
  343. package/src/state/persisted.ts +76 -17
  344. package/src/styles.css +41 -0
  345. package/src/surfaces.ts +9 -1
  346. package/src/theme/controls.module.css +7 -0
  347. package/src/theme/ctl-theme.tsx +15 -3
  348. package/src/theme/floating.module.css +37 -0
  349. package/src/theme/floating.module.css.d.ts +3 -0
  350. package/src/theme/index.ts +46 -8
  351. package/src/theme/nav-link.module.css +7 -0
  352. package/src/theme-lab/derive-controls.tsx +2 -0
  353. package/src/tokens/index.ts +20 -30
  354. package/src/tokens/palette.ts +6 -28
  355. package/src/tokens/size-classes.ts +46 -0
  356. package/dist/shell/isomorphic-layout-effect.d.ts.map +0 -1
  357. /package/dist/{shell → common}/isomorphic-layout-effect.js +0 -0
@@ -0,0 +1,175 @@
1
+ import { resolveContainerClass } from "../../tokens/size-classes.js";
2
+ import { VX } from "../../tokens/index.js";
3
+ import { measureText } from "../utils/measure-text.js";
4
+ import {
5
+ entriesWithinChipRows,
6
+ entriesWithinDotRows,
7
+ entriesWithinRows,
8
+ orderEntries
9
+ } from "./chart-frame-layout.js";
10
+ const HEIGHT_RATIO = { micro: 0.5, compact: 0.62, regular: 0.5, wide: 0.4 };
11
+ const HEIGHT_MIN = 160;
12
+ const HEIGHT_MAX = 420;
13
+ const COARSE_VIEWPORT_SHARE = 0.45;
14
+ const UNMEASURED_WIDTH = { micro: 200, compact: 360, regular: 640, wide: 960 };
15
+ const TICK_SPACING = 44;
16
+ const COMPACT_LABEL_CHARS = 4;
17
+ const X_LABEL_GAP = 8;
18
+ const LEGEND_ROWS = { header: 1, band: 2 };
19
+ const CONTAINER_CLASS_OF_SIZE_CLASS = {
20
+ compact: "compact",
21
+ medium: "regular",
22
+ expanded: "wide"
23
+ };
24
+ function containerClassFromSizeClass(sizeClass) {
25
+ return CONTAINER_CLASS_OF_SIZE_CLASS[sizeClass];
26
+ }
27
+ const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
28
+ function resolveHeight(input, containerClass) {
29
+ const override = input.override?.height;
30
+ const width = input.frameW > 0 ? input.frameW : UNMEASURED_WIDTH[containerClass];
31
+ const derived = override ?? clamp(Math.round(width * HEIGHT_RATIO[containerClass]), HEIGHT_MIN, HEIGHT_MAX);
32
+ if (!input.coarse || input.viewportH <= 0) return derived;
33
+ return Math.min(derived, Math.round(input.viewportH * COARSE_VIEWPORT_SHARE));
34
+ }
35
+ function rollUp(total, fitted) {
36
+ const visible = total - fitted < 2 ? total : fitted;
37
+ return { visible, overflow: total - visible };
38
+ }
39
+ function resolveLegend(input, containerClass) {
40
+ const total = input.legendItems.length;
41
+ if (containerClass === "micro" || total === 0) return { mode: "none" };
42
+ const where = input.slotW > 0 ? "header" : "band";
43
+ const width = where === "header" ? input.slotW : input.frameW;
44
+ if (width <= 0) return { mode: "chips", where, visible: total, overflow: 0 };
45
+ const { entries: ordered, dividerAfter } = orderEntries(input.legendItems, input.groups === true);
46
+ const chipFit = entriesWithinRows(ordered, width, LEGEND_ROWS[where]);
47
+ const allChipsFit = chipFit >= total;
48
+ const wantsDots = where === "header" && !allChipsFit && (input.cardShort === true || containerClass === "compact");
49
+ if (!wantsDots) {
50
+ const fitted = allChipsFit ? chipFit : entriesWithinChipRows(ordered, width, LEGEND_ROWS[where]);
51
+ const { visible: visible2, overflow: overflow2 } = rollUp(total, fitted);
52
+ return { mode: "chips", where, visible: visible2, overflow: overflow2 };
53
+ }
54
+ const dotFit = entriesWithinDotRows(ordered, width, LEGEND_ROWS[where], dividerAfter);
55
+ const { visible, overflow } = rollUp(total, dotFit);
56
+ return { mode: "dots", where, visible, overflow };
57
+ }
58
+ function isTightClass(containerClass) {
59
+ return containerClass === "compact" || containerClass === "micro";
60
+ }
61
+ function resolveYPlacement(containerClass, opts = {}) {
62
+ const { hasLeftAxis = true, marginOverrideLeft } = opts;
63
+ if (!isTightClass(containerClass) || !hasLeftAxis || marginOverrideLeft !== void 0)
64
+ return "outside";
65
+ return containerClass === "micro" ? "none" : "inside";
66
+ }
67
+ const INSIDE_Y_FLOOR = 4;
68
+ function resolveMarginFloor(yPlacement, tierMargin) {
69
+ return yPlacement === "outside" ? tierMargin : { ...tierMargin, left: INSIDE_Y_FLOOR };
70
+ }
71
+ const COMPACT_UNITS = [
72
+ [1e12, "T"],
73
+ [1e9, "B"],
74
+ [1e6, "M"],
75
+ [1e3, "k"]
76
+ ];
77
+ const roundTenth = (value) => Math.round(value * 10) / 10;
78
+ function compactNumber(value) {
79
+ const abs = Math.abs(value);
80
+ if (!Number.isFinite(value) || abs < 1e3) return null;
81
+ let index = COMPACT_UNITS.findIndex(([unit]) => abs >= unit);
82
+ let scaled = roundTenth(abs / COMPACT_UNITS[index][0]);
83
+ if (scaled >= 1e3 && index > 0) {
84
+ index -= 1;
85
+ scaled = roundTenth(abs / COMPACT_UNITS[index][0]);
86
+ }
87
+ return `${value < 0 ? "-" : ""}${scaled}${COMPACT_UNITS[index][1]}`;
88
+ }
89
+ function shouldCompactYLabels(labels) {
90
+ return labels.some((label) => label.length > COMPACT_LABEL_CHARS);
91
+ }
92
+ function yTickCount(plotHeight) {
93
+ if (plotHeight < VX.minPlotHeight) return 2;
94
+ return clamp(Math.round(plotHeight / TICK_SPACING), 2, 6);
95
+ }
96
+ function wrapLabel(label, maxPx, fontPx) {
97
+ const words = label.split(/\s+/).filter((word) => word !== "");
98
+ const lines = [];
99
+ let current = "";
100
+ for (const word of words) {
101
+ const candidate = current === "" ? word : `${current} ${word}`;
102
+ if (current !== "" && measureText(candidate, fontPx) > maxPx) {
103
+ lines.push(current);
104
+ current = word;
105
+ continue;
106
+ }
107
+ current = candidate;
108
+ }
109
+ if (current !== "") lines.push(current);
110
+ return lines.length > 0 ? lines : [label];
111
+ }
112
+ function planXLabels(input) {
113
+ const { labels, plotWidth, fontPx, categorical } = input;
114
+ const count = labels.length;
115
+ const widest = labels.reduce((max, label) => Math.max(max, measureText(label, fontPx)), 0);
116
+ const flatPx = widest + X_LABEL_GAP;
117
+ const fit = plotWidth > 0 && widest > 0 ? Math.floor(plotWidth / flatPx) : count;
118
+ const flat = {
119
+ wrap: false,
120
+ rotate: 0,
121
+ lines: 1,
122
+ labelPx: flatPx,
123
+ wrapPx: 0
124
+ };
125
+ if (!categorical || count <= fit || plotWidth <= 0) return flat;
126
+ const widestWord = labels.reduce(
127
+ (max, label) => Math.max(max, ...label.split(/\s+/).map((word) => measureText(word, fontPx))),
128
+ 0
129
+ );
130
+ const wrapPx = Math.min(widest, Math.max(widestWord, Math.floor(plotWidth / count) - X_LABEL_GAP));
131
+ const wrapped = labels.map((label) => wrapLabel(label, wrapPx, fontPx));
132
+ const lines = wrapped.reduce((max, parts) => Math.max(max, parts.length), 1);
133
+ if (lines === 1) {
134
+ return count > 2 * Math.max(fit, 1) ? { ...flat, rotate: 45 } : flat;
135
+ }
136
+ const wrappedWidest = wrapped.reduce(
137
+ (max, parts) => Math.max(max, ...parts.map((part) => measureText(part, fontPx))),
138
+ 0
139
+ );
140
+ const wrappedFit = Math.max(Math.floor(plotWidth / (wrappedWidest + X_LABEL_GAP)), 1);
141
+ if (wrappedFit >= count) {
142
+ return {
143
+ wrap: true,
144
+ rotate: 0,
145
+ lines,
146
+ labelPx: wrappedWidest + X_LABEL_GAP,
147
+ wrapPx
148
+ };
149
+ }
150
+ return count > 2 * wrappedFit ? { ...flat, rotate: 45 } : flat;
151
+ }
152
+ function resolveFrameClass(input) {
153
+ return input.frameW > 0 ? resolveContainerClass(input.frameW) : containerClassFromSizeClass(input.sizeClass);
154
+ }
155
+ function resolveChartLayout(input) {
156
+ const containerClass = resolveFrameClass(input);
157
+ return {
158
+ containerClass,
159
+ height: resolveHeight(input, containerClass),
160
+ legend: resolveLegend(input, containerClass)
161
+ };
162
+ }
163
+ export {
164
+ INSIDE_Y_FLOOR,
165
+ compactNumber,
166
+ isTightClass,
167
+ planXLabels,
168
+ resolveChartLayout,
169
+ resolveFrameClass,
170
+ resolveMarginFloor,
171
+ resolveYPlacement,
172
+ shouldCompactYLabels,
173
+ wrapLabel,
174
+ yTickCount
175
+ };
@@ -1,16 +1,18 @@
1
1
  import type { ReactNode } from 'react';
2
- import { chartTierMetrics, resolveChartTier } from './chart-frame-layout.js';
3
- import type { ChartTier, ChartTierMetrics } from './chart-frame-layout.js';
2
+ import type { ContainerClass } from '../../tokens/size-classes.js';
3
+ import type { ChartTierMetrics } from './chart-frame-layout.js';
4
4
  export type ChartTierProviderProps = {
5
- tier: ChartTier;
5
+ containerClass: ContainerClass;
6
6
  children: ReactNode;
7
7
  };
8
- /** Publishes a resolved tier to the subtree. Mounted once, by `ChartFrame`. */
9
- export declare function ChartTierProvider({ tier, children }: ChartTierProviderProps): ReactNode;
10
- /** The tier of the nearest measured `ChartFrame`, or `'desktop'` outside one. */
11
- export declare function useChartTier(): ChartTier;
12
- /** The resolved sizes for the ambient tier — the form every primitive actually wants. */
13
- export declare function useChartTierMetrics(): ChartTierMetrics;
14
- export { chartTierMetrics, resolveChartTier };
15
- export type { ChartTier, ChartTierMetrics };
8
+ /** Publishes a resolved container class to the subtree. Mounted once, by `ChartFrame`. */
9
+ export declare function ChartTierProvider({ containerClass, children }: ChartTierProviderProps): ReactNode;
10
+ /** The ambient container class (`'regular'` outside a `ChartFrame`). Internal. */
11
+ export declare function useChartContainerClass(): ContainerClass;
12
+ /** The resolved sizes for the ambient container class — what every internal primitive wants. */
13
+ export declare function useChartMetrics(): ChartTierMetrics;
14
+ /** Whether the primary pointer is coarse. Server snapshot `false`: hydration agrees, then updates. */
15
+ export declare function useCoarsePointer(): boolean;
16
+ /** Viewport height in px (`0` on the server). Only the coarse-pointer height clamp reads it. */
17
+ export declare function useViewportHeight(): number;
16
18
  //# sourceMappingURL=chart-tier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"chart-tier.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/chart-tier.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,EA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AAI,MAAM,CAE1C"}
@@ -1,20 +1,49 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { createContext, useContext } from "react";
3
- import { chartTierMetrics, resolveChartTier } from "./chart-frame-layout.js";
4
- const ChartTierContext = createContext("desktop");
5
- function ChartTierProvider({ tier, children }) {
6
- return /* @__PURE__ */ jsx(ChartTierContext.Provider, { value: tier, children });
2
+ import { createContext, useContext, useSyncExternalStore } from "react";
3
+ import { useMediaQuery } from "../../common/use-media-query.js";
4
+ import { chartMetrics } from "./chart-frame-layout.js";
5
+ const ChartContainerClassContext = createContext("regular");
6
+ function ChartTierProvider({ containerClass, children }) {
7
+ return /* @__PURE__ */ jsx(ChartContainerClassContext.Provider, { value: containerClass, children });
7
8
  }
8
- function useChartTier() {
9
- return useContext(ChartTierContext);
9
+ function useChartContainerClass() {
10
+ return useContext(ChartContainerClassContext);
10
11
  }
11
- function useChartTierMetrics() {
12
- return chartTierMetrics(useContext(ChartTierContext));
12
+ function useChartMetrics() {
13
+ return chartMetrics(useChartContainerClass());
14
+ }
15
+ const subscribeNothing = () => () => {
16
+ };
17
+ function useCoarsePointer() {
18
+ return useMediaQuery("(pointer: coarse)", false);
19
+ }
20
+ const VIEWPORT_H_STEP = 50;
21
+ const viewportHListeners = /* @__PURE__ */ new Set();
22
+ let viewportHListenerAttached = false;
23
+ function ensureViewportHListener() {
24
+ if (viewportHListenerAttached || typeof window === "undefined") return;
25
+ viewportHListenerAttached = true;
26
+ window.addEventListener("resize", () => {
27
+ for (const listener of viewportHListeners) listener();
28
+ });
29
+ }
30
+ function subscribeViewportH(onChange) {
31
+ if (typeof window === "undefined") return subscribeNothing();
32
+ ensureViewportHListener();
33
+ viewportHListeners.add(onChange);
34
+ return () => viewportHListeners.delete(onChange);
35
+ }
36
+ function readViewportH() {
37
+ if (typeof window === "undefined") return 0;
38
+ return Math.round(window.innerHeight / VIEWPORT_H_STEP) * VIEWPORT_H_STEP;
39
+ }
40
+ function useViewportHeight() {
41
+ return useSyncExternalStore(subscribeViewportH, readViewportH, () => 0);
13
42
  }
14
43
  export {
15
44
  ChartTierProvider,
16
- chartTierMetrics,
17
- resolveChartTier,
18
- useChartTier,
19
- useChartTierMetrics
45
+ useChartContainerClass,
46
+ useChartMetrics,
47
+ useCoarsePointer,
48
+ useViewportHeight
20
49
  };
@@ -0,0 +1,27 @@
1
+ import type { CSSProperties, ReactNode } from 'react';
2
+ /**
3
+ * `ChartLegend`'s `All N` disclosure state: which button opened it (the chip, or a dots-mode entry)
4
+ * and where the fixed panel sits. Focus moves into the panel on open and back to that trigger on
5
+ * EVERY close path; a scroll outside the panel or a resize closes it, since it is fixed to where the
6
+ * trigger WAS.
7
+ */
8
+ export declare function useLegendDisclosure(coarse: boolean): {
9
+ open: boolean;
10
+ panelId: string;
11
+ openFrom: (trigger: HTMLButtonElement) => void;
12
+ close: () => void;
13
+ panel: {
14
+ panelRef: import("react").RefObject<HTMLDialogElement | null>;
15
+ panelId: string;
16
+ coarse: boolean;
17
+ placement: CSSProperties | null;
18
+ close: () => void;
19
+ };
20
+ };
21
+ /** The portalled panel itself — a popover under the chip on a fine pointer, a docked sheet (over a
22
+ * scrim) on a coarse one. Fixed-position, so opening it never grows the legend band. */
23
+ export declare function LegendDisclosure({ panelRef, panelId, coarse, placement, close, fontSize, children, }: ReturnType<typeof useLegendDisclosure>['panel'] & {
24
+ fontSize: number;
25
+ children: ReactNode;
26
+ }): import("react").ReactPortal | null;
27
+ //# sourceMappingURL=legend-disclosure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"legend-disclosure.d.ts","sourceRoot":"","sources":["../../../src/charts/primitives/legend-disclosure.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAwDrD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,OAAO;;;wBAQtB,iBAAiB;;;;;;;;;EAuD7C;AAED;wFACwF;AACxF,wBAAgB,gBAAgB,CAAC,EAC/B,QAAQ,EACR,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,QAAQ,EACR,QAAQ,GACT,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,OAAO,CAAC,GAAG;IACnD,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,SAAS,CAAA;CACpB,sCAoCA"}
@@ -0,0 +1,153 @@
1
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useEffect, useId, useRef, useState } from "react";
3
+ import { createPortal } from "react-dom";
4
+ import { alpha, VX } from "../../tokens/index.js";
5
+ import { useDismissOnOutside } from "../cursor/touch-pin.js";
6
+ import { LEGEND_ROW_GAP } from "./chart-frame-layout.js";
7
+ const DISCLOSURE_PANEL = {
8
+ position: "fixed",
9
+ zIndex: VX.zIndexFloating,
10
+ display: "flex",
11
+ flexDirection: "column",
12
+ gap: LEGEND_ROW_GAP,
13
+ // theme-allow raw-scroll-container — a fixed floating panel of one legend, not app chrome
14
+ overflowY: "auto",
15
+ // `<dialog open>` brings UA chrome (centring margin, border, fit-content box) this resets.
16
+ margin: 0,
17
+ border: "none",
18
+ width: "auto",
19
+ height: "auto",
20
+ padding: 10,
21
+ boxSizing: "border-box",
22
+ backgroundColor: VX.surface.overlay,
23
+ boxShadow: VX.shadowOverlay,
24
+ color: VX.muted,
25
+ borderRadius: VX.radiusCard
26
+ };
27
+ const DISCLOSURE_MIN_HEIGHT = 96;
28
+ function disclosurePlacement(chip, coarse) {
29
+ if (coarse) {
30
+ return {
31
+ left: 0,
32
+ right: 0,
33
+ bottom: 0,
34
+ maxHeight: "60dvh",
35
+ borderBottomLeftRadius: 0,
36
+ borderBottomRightRadius: 0,
37
+ padding: "12px 16px calc(12px + env(safe-area-inset-bottom, 0px))"
38
+ };
39
+ }
40
+ const below = window.innerHeight - chip.bottom;
41
+ const left = Math.max(8, Math.min(chip.left, window.innerWidth - 248));
42
+ const base = { left, right: "auto", minWidth: 200, maxWidth: "calc(100vw - 16px)" };
43
+ return below >= 200 || below >= chip.top ? { ...base, top: chip.bottom + 4, maxHeight: Math.max(below - 12, DISCLOSURE_MIN_HEIGHT) } : {
44
+ ...base,
45
+ bottom: window.innerHeight - chip.top + 4,
46
+ maxHeight: Math.max(chip.top - 12, DISCLOSURE_MIN_HEIGHT)
47
+ };
48
+ }
49
+ function useLegendDisclosure(coarse) {
50
+ const [placement, setPlacement] = useState(null);
51
+ const triggerRef = useRef(null);
52
+ const panelRef = useRef(null);
53
+ const panelId = useId();
54
+ const wasOpen = useRef(false);
55
+ const open = placement !== null;
56
+ const close = useCallback(() => setPlacement(null), []);
57
+ const openFrom = (trigger) => {
58
+ triggerRef.current = trigger;
59
+ setPlacement(disclosurePlacement(trigger.getBoundingClientRect(), coarse));
60
+ };
61
+ useEffect(() => {
62
+ if (open) panelRef.current?.focus();
63
+ else if (wasOpen.current) triggerRef.current?.focus();
64
+ wasOpen.current = open;
65
+ }, [open]);
66
+ const isInsidePanel = useCallback(
67
+ (target) => panelRef.current?.contains(target) === true || triggerRef.current?.contains(target) === true,
68
+ []
69
+ );
70
+ useDismissOnOutside({
71
+ enabled: open,
72
+ isInside: isInsidePanel,
73
+ onDismiss: close,
74
+ dismissOnResize: true,
75
+ scrollExemptInside: true
76
+ });
77
+ useEffect(() => {
78
+ if (!open || !coarse) return;
79
+ const panel = panelRef.current;
80
+ if (panel === null) return;
81
+ const onKeyDown = (e) => {
82
+ if (e.key !== "Tab") return;
83
+ const focusable = panel.querySelectorAll(
84
+ 'button, [tabindex]:not([tabindex="-1"])'
85
+ );
86
+ const first = focusable[0];
87
+ const last = focusable[focusable.length - 1];
88
+ if (first === void 0 || last === void 0) return;
89
+ if (e.shiftKey && document.activeElement === first) {
90
+ e.preventDefault();
91
+ last.focus();
92
+ } else if (!e.shiftKey && document.activeElement === last) {
93
+ e.preventDefault();
94
+ first.focus();
95
+ }
96
+ };
97
+ panel.addEventListener("keydown", onKeyDown);
98
+ return () => panel.removeEventListener("keydown", onKeyDown);
99
+ }, [open, coarse]);
100
+ return { open, panelId, openFrom, close, panel: { panelRef, panelId, coarse, placement, close } };
101
+ }
102
+ function LegendDisclosure({
103
+ panelRef,
104
+ panelId,
105
+ coarse,
106
+ placement,
107
+ close,
108
+ fontSize,
109
+ children
110
+ }) {
111
+ if (placement === null) return null;
112
+ return createPortal(
113
+ /* @__PURE__ */ jsxs(Fragment, { children: [
114
+ coarse && /* @__PURE__ */ jsx(
115
+ "div",
116
+ {
117
+ "aria-hidden": true,
118
+ onPointerDown: (e) => {
119
+ e.stopPropagation();
120
+ close();
121
+ },
122
+ style: {
123
+ position: "fixed",
124
+ inset: 0,
125
+ // One below the panel it sits behind — still `VX.zIndexFloating`-derived, never a
126
+ // second unrelated literal (B14).
127
+ zIndex: VX.zIndexFloating - 1,
128
+ backgroundColor: alpha(VX.neutral, 0.35)
129
+ }
130
+ }
131
+ ),
132
+ /* @__PURE__ */ jsx(
133
+ "dialog",
134
+ {
135
+ ref: panelRef,
136
+ id: panelId,
137
+ open: true,
138
+ tabIndex: -1,
139
+ "aria-label": "Legend",
140
+ ...coarse && { "aria-modal": true },
141
+ "data-basalt-legend-disclosure": coarse ? "sheet" : "popover",
142
+ style: { ...DISCLOSURE_PANEL, fontSize, ...placement },
143
+ children
144
+ }
145
+ )
146
+ ] }),
147
+ document.body
148
+ );
149
+ }
150
+ export {
151
+ LegendDisclosure,
152
+ useLegendDisclosure
153
+ };
@@ -59,7 +59,10 @@ export type ChartLegendConfig = {
59
59
  placement?: LegendPlacement;
60
60
  /** Visually separate role: series | overlay | reference. */
61
61
  groups?: boolean;
62
- /** Wrap cap → "+N more" rollup at high cardinality. */
62
+ /**
63
+ * @deprecated Removed in 1.32.0 — the legend fits by measured width and folds overflow into an
64
+ * `All N` disclosure on its own. An explicit value still wins this release (entry count).
65
+ */
63
66
  maxRows?: number;
64
67
  /** Clicking an entry hides that series. Default: on whenever there is more than one entry. */
65
68
  toggle?: boolean;
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AE,CAAC,EACR,cAAc,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GACpC,cAAc,EAAE,CAkBlB;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAEvE;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,GAAG,CAAC,CAAC,EAAE;IAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,KAAK,OAAO,CAE9F"}
@@ -6,27 +6,46 @@ import type { ChartTier } from '../primitives/chart-frame-layout.js';
6
6
  * `useBandPlot` and `DualPanel` — the three call sites that used to reimplement this formula.
7
7
  *
8
8
  * `fontPx` defaults to `VX.axisFont`; a phone-tier chart passes its own smaller tick font
9
- * (`chartTierMetrics().axisFont`) so the spacing is derived from the size actually painted.
9
+ * (`chartMetrics().axisFont`) so the spacing is derived from the size actually painted.
10
10
  */
11
11
  export declare function xLabelPxFor(labels: string[], fontPx?: number): number;
12
+ /**
13
+ * The horizontal room one 45°-rotated x label takes: its projected box (`cos 45°` of the width plus
14
+ * one line box) plus the gap. A tilted label still competes with its neighbour for this much, so
15
+ * thinning by the bare `VX.minPxPerTick` floor let two of them touch as soon as the plot widened.
16
+ */
17
+ export declare function rotatedXLabelPx(labels: string[], fontPx?: number): number;
12
18
  /**
13
19
  * Pick evenly-spaced tick values that fit the available width.
14
20
  *
15
21
  * `labelPx` is the width one formatted label actually needs (measured, plus the gap it wants from
16
- * its neighbour) and overrides the `VX.minPxPerTick` floor whenever it is wider. Without it the
17
- * spacing came from that constant alone regardless of what was painted, so a `formatX` returning
18
- * `Mar 08 14:00` overlapped at every width — the one side of the chart that did not follow §1's
19
- * "measure what you paint" law. Omit it and nothing moves.
22
+ * its neighbour) and REPLACES the `VX.minPxPerTick` constant whenever it is supplied, in either
23
+ * direction — a wide label needs more room than the constant assumed (a `formatX` returning
24
+ * `Mar 08 14:00` used to overlap at every width, the one side of the chart that did not follow
25
+ * §1's "measure what you paint" law), and a narrow one (single-digit band labels) can pack in
26
+ * MORE ticks than the constant would allow, which the floor used to suppress (R2C-11). Omit it and
27
+ * the constant is what governs, same as before.
20
28
  *
21
29
  * The final key is still appended when the step misses the last index — a thinned axis would
22
30
  * otherwise paint no label at the right edge at all — but it no longer prints ON TOP of its
23
31
  * neighbour. An appended tick lands a PARTIAL step from the last one on the grid, so at any tick
24
32
  * count wide enough labels overlap there; measured at `/charts-stress` block (f1), `Mar 13 14:00`
25
33
  * and `Mar 14 14:00` printed over each other at 1440px. When that gap is narrower than one label,
26
- * the grid tick before it is dropped instead. Index 0 is never dropped: the left edge is the one
27
- * label a reader orients from.
34
+ * the grid tick before it is dropped instead.
35
+ *
36
+ * `anchorTerminals` (default false) mirrors the SAME flag `autoMargin`/`Axes.tsx` take: when the
37
+ * axis anchors index 0 and the last index at their TEXT edge rather than their centre
38
+ * (`terminalAnchor`), each reaches a FULL label's width toward its neighbour instead of half, so
39
+ * the plain per-tick pitch above (sized for two centred labels) isn't enough at either boundary —
40
+ * `Bars` with 30 daily "Jan DD HH:MM" keys overlapped there at phone width even though the interior
41
+ * pitch was fine (R2C-6). The SAME rule then applies, symmetrically, to the tick right after
42
+ * index 0. 1.5× is a deliberately generous (cheap, simple) stand-in for "one label plus half a
43
+ * label" rather than measuring the split precisely; it's skipped when `labelPx` is only the bare
44
+ * `VX.minPxPerTick` floor, which has no relationship to how wide a label actually is. Index 0
45
+ * always survives (never the one dropped here) and `last` is always (re-)added below, so dropping
46
+ * any OTHER index never breaks the "at least 2 ticks" floor.
28
47
  */
29
- export declare function smartTicks(dates: string[], xMax: number, labelPx?: number): string[];
48
+ export declare function smartTicks(dates: string[], xMax: number, labelPx?: number, anchorTerminals?: boolean): string[];
30
49
  /**
31
50
  * Which of a BAND axis's category labels may be painted so that no two neighbours overlap — the
32
51
  * same measured law {@link smartTicks} applies to a point axis, for a chart that lays its labels
@@ -1 +1 @@
1
- {"version":3,"file":"ticks.d.ts","sourceRoot":"","sources":["../../../src/charts/utils/ticks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAMjE;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAoB,GAAG,MAAM,CAElF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBpF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,GAAG,CAAC,MAAM,CAAC,CAkBb;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAKxE;AAaD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,IAAI,EAAE,SAAS,CAAA;IACf,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAA;IACZ,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAA;IACf;qEACiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,CAAC,GAAG,EAAE,CAST"}
1
+ {"version":3,"file":"ticks.d.ts","sourceRoot":"","sources":["../../../src/charts/utils/ticks.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAA;AAMjE;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAoB,GAAG,MAAM,CAElF;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,MAAM,GAAE,MAAoB,GAAG,MAAM,CAItF;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,UAAU,CACxB,KAAK,EAAE,MAAM,EAAE,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,eAAe,UAAQ,GACtB,MAAM,EAAE,CAoEV;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,GAAG,CAAC,MAAM,CAAC,CAkBb;AAED,8FAA8F;AAC9F,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAKxE;AAaD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE;IACtC,IAAI,EAAE,SAAS,CAAA;IACf,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAA;IACZ,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAA;IACf;qEACiE;IACjE,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG,CAAC,GAAG,EAAE,CAST"}
@@ -4,21 +4,44 @@ const X_TICK_LABEL_GAP = 8;
4
4
  function xLabelPxFor(labels, fontPx = VX.axisFont) {
5
5
  return maxTextWidth(labels, fontPx) + X_TICK_LABEL_GAP;
6
6
  }
7
- function smartTicks(dates, xMax, labelPx) {
7
+ function rotatedXLabelPx(labels, fontPx = VX.axisFont) {
8
+ return Math.ceil(COS_45 * (maxTextWidth(labels, fontPx) + Math.ceil(fontPx * 1.35))) + X_TICK_LABEL_GAP;
9
+ }
10
+ function smartTicks(dates, xMax, labelPx, anchorTerminals = false) {
8
11
  if (dates.length === 0) return [];
9
- const perTick = Math.max(VX.minPxPerTick, labelPx ?? 0);
12
+ const perTick = labelPx !== void 0 && labelPx > 0 ? labelPx : VX.minPxPerTick;
10
13
  const maxTicks = Math.max(2, Math.floor(xMax / perTick));
11
- if (dates.length <= maxTicks) return dates;
12
- const step = Math.ceil(dates.length / maxTicks);
13
14
  const last = dates.length - 1;
15
+ const pxPerIndex = dates.length > 0 ? xMax / dates.length : 0;
16
+ const anchored = anchorTerminals && labelPx !== void 0 && labelPx > 0;
14
17
  const keep = /* @__PURE__ */ new Set();
15
- for (let i = 0; i <= last; i += step) keep.add(i);
16
- const lastOnGrid = Math.floor(last / step) * step;
17
- if (lastOnGrid !== last) {
18
- const pxPerIndex = dates.length > 0 ? xMax / dates.length : 0;
19
- const gapPx = (last - lastOnGrid) * pxPerIndex;
20
- if (lastOnGrid > 0 && gapPx > 0 && gapPx < perTick) keep.delete(lastOnGrid);
21
- keep.add(last);
18
+ if (dates.length <= maxTicks) {
19
+ for (let i = 0; i <= last; i += 1) keep.add(i);
20
+ } else {
21
+ const step = Math.ceil(dates.length / maxTicks);
22
+ for (let i = 0; i <= last; i += step) keep.add(i);
23
+ const BOUNDARY_FACTOR = 1.5;
24
+ const boundaryPx = anchored ? perTick * BOUNDARY_FACTOR : perTick;
25
+ const lastOnGrid = Math.floor(last / step) * step;
26
+ if (lastOnGrid !== last) {
27
+ const gapPx = (last - lastOnGrid) * pxPerIndex;
28
+ if (lastOnGrid > 0 && gapPx > 0 && gapPx < boundaryPx) keep.delete(lastOnGrid);
29
+ keep.add(last);
30
+ }
31
+ }
32
+ if (anchored && keep.size > 1) {
33
+ const BOUNDARY_FACTOR = 1.5;
34
+ const boundaryPx = perTick * BOUNDARY_FACTOR;
35
+ const sorted = [...keep].toSorted((a, b) => a - b);
36
+ const second = sorted[1];
37
+ if (second !== void 0 && second !== last && second * pxPerIndex < boundaryPx) {
38
+ keep.delete(second);
39
+ }
40
+ const afterHead = [...keep].toSorted((a, b) => a - b);
41
+ const secondLast = afterHead[afterHead.length - 2];
42
+ if (secondLast !== void 0 && secondLast !== 0 && (last - secondLast) * pxPerIndex < boundaryPx) {
43
+ keep.delete(secondLast);
44
+ }
22
45
  }
23
46
  return dates.filter((_, i) => keep.has(i));
24
47
  }
@@ -61,6 +84,7 @@ function autoXLabelRotate(input) {
61
84
  }
62
85
  export {
63
86
  autoXLabelRotate,
87
+ rotatedXLabelPx,
64
88
  smartTicks,
65
89
  smartTicksEvery,
66
90
  thinLabels,
@@ -22,7 +22,7 @@ export declare function oneOf(component: string, prop: string, allowed: readonly
22
22
  * A prop still shipped and still working, with a named successor and the version it goes away in.
23
23
  * Majors are banned here, so the deprecation notice IS the migration channel.
24
24
  */
25
- export declare function deprecatedProp(component: string, oldProp: string, newProp: string, removeIn: string): string;
25
+ export declare function deprecatedProp(component: string, oldProp: string, newProp: string, removeIn: string, note?: string): string;
26
26
  /**
27
27
  * A prop the component ACCEPTS, reads nothing from, and cannot report as wrong — because a SECOND
28
28
  * prop it was passed alongside decides the same thing and won.
@@ -34,6 +34,12 @@ export declare function deprecatedProp(component: string, oldProp: string, newPr
34
34
  * constants and a whole `compact` branch changed no pixel.
35
35
  */
36
36
  export declare function ignoredProp(component: string, prop: string, because: string): string;
37
+ /**
38
+ * A numeric `height` the caller stated that, once the legend band is taken out, leaves the plot
39
+ * under the floor. The frame keeps the plot at the floor and grows past the number, so the chart
40
+ * is taller than the caller asked for and nothing else says why.
41
+ */
42
+ export declare function plotBelowFloor(component: string, height: number, floor: number): string;
37
43
  /**
38
44
  * An imperative call needs a layer that is not there — the optional peer is not installed, or the
39
45
  * mount that subscribes to its event bus is disabled. Both halves are named because the remedy
@@ -42,6 +48,10 @@ export declare function ignoredProp(component: string, prop: string, because: st
42
48
  export declare function missingLayer(component: string, layer: string, remedy: string): string;
43
49
  /** A single-mount component found a second instance alive (`BasaltProvider`, `Notifications`). */
44
50
  export declare function duplicateMount(component: string): string;
51
+ /** Two frames inside one `ChartCard` both want the header legend slot (`docs/waves/PLAN.md` wave
52
+ * 3, P2-9) — only the first to mount keeps it, every later one falls back to its own band legend
53
+ * rather than silently overwriting the portal. */
54
+ export declare function legendSlotContention(component: string): string;
45
55
  /**
46
56
  * The HTTP status behind a thrown envelope (Eden Treaty's `{ status, value }`, a `Response`-shaped
47
57
  * throw), when there is one. Use it to BRANCH — 404 → "not found" copy — rather than to build a