basalt-ui 2.27.2 → 2.29.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 (343) hide show
  1. package/CHANGELOG.md +466 -307
  2. package/MIGRATING.md +358 -12
  3. package/agent/rules/basalt-batteries.md +1 -1
  4. package/agent/rules/basalt-mantine.md +1 -1
  5. package/agent/rules/basalt-tokens.md +2 -2
  6. package/agent/skills/basalt-app/SKILL.md +3 -3
  7. package/agent/skills/basalt-charts/SKILL.md +1 -1
  8. package/agent/skills/basalt-design/SKILL.md +12 -6
  9. package/agent/skills/basalt-design/references/catalogue.md +42 -36
  10. package/agent/skills/basalt-design/references/recipes.md +47 -0
  11. package/agent/skills/basalt-design/references/states.md +1 -1
  12. package/configs/oxlint-basalt.json +2 -1
  13. package/configs/oxlint-plugin.js +112 -3
  14. package/configs/oxlint-plugin.test.ts +99 -4
  15. package/configs/oxlint.json +1 -0
  16. package/dist/agent/chat/thread-message.d.ts +1 -160
  17. package/dist/agent/chat/thread-message.d.ts.map +1 -1
  18. package/dist/agent/chat/thread-message.js +7 -162
  19. package/dist/agent/chat/virtualize.d.ts +5 -5
  20. package/dist/charts/ChartCard.d.ts +14 -7
  21. package/dist/charts/ChartCard.d.ts.map +1 -1
  22. package/dist/charts/ChartCard.js +112 -23
  23. package/dist/charts/Lines.d.ts.map +1 -1
  24. package/dist/charts/Lines.js +11 -4
  25. package/dist/charts/Sparkline.d.ts +14 -2
  26. package/dist/charts/Sparkline.d.ts.map +1 -1
  27. package/dist/charts/Sparkline.js +155 -44
  28. package/dist/charts/chart-box.module.css +59 -2
  29. package/dist/charts/chart-box.module.css.d.ts +5 -0
  30. package/dist/charts/chart-card.module.css +28 -17
  31. package/dist/charts/chart-card.module.css.d.ts +3 -0
  32. package/dist/charts/compile.d.ts +1 -1
  33. package/dist/charts/compile.d.ts.map +1 -1
  34. package/dist/charts/compile.js +38 -27
  35. package/dist/charts/labels.d.ts +13 -3
  36. package/dist/charts/labels.d.ts.map +1 -1
  37. package/dist/charts/labels.js +131 -20
  38. package/dist/charts/legend.d.ts.map +1 -1
  39. package/dist/charts/legend.js +1 -1
  40. package/dist/charts/ref-label.d.ts +37 -8
  41. package/dist/charts/ref-label.d.ts.map +1 -1
  42. package/dist/charts/ref-label.js +55 -10
  43. package/dist/charts/sparkline.module.css +50 -0
  44. package/dist/charts/sparkline.module.css.d.ts +3 -0
  45. package/dist/charts/state.d.ts +4 -4
  46. package/dist/charts/state.d.ts.map +1 -1
  47. package/dist/charts/state.js +23 -5
  48. package/dist/cli/doctor-upgrade.d.ts +11 -0
  49. package/dist/cli/doctor-upgrade.d.ts.map +1 -1
  50. package/dist/cli/doctor-upgrade.js +54 -0
  51. package/dist/cli/doctor.d.ts.map +1 -1
  52. package/dist/cli/doctor.js +32 -0
  53. package/dist/cli/help.d.ts.map +1 -1
  54. package/dist/cli/help.js +8 -3
  55. package/dist/cli/index.d.ts +13 -13
  56. package/dist/cli/index.d.ts.map +1 -1
  57. package/dist/cli/index.js +36 -2
  58. package/dist/cli/init.d.ts +6 -0
  59. package/dist/cli/init.d.ts.map +1 -1
  60. package/dist/cli/init.js +118 -27
  61. package/dist/cli/router-wiring.d.ts +3 -0
  62. package/dist/cli/router-wiring.d.ts.map +1 -1
  63. package/dist/cli/router-wiring.js +2 -0
  64. package/dist/cli/shot/capture.d.ts +34 -2
  65. package/dist/cli/shot/capture.d.ts.map +1 -1
  66. package/dist/cli/shot/capture.js +95 -12
  67. package/dist/cli/shot/detect.d.ts +4 -1
  68. package/dist/cli/shot/detect.d.ts.map +1 -1
  69. package/dist/cli/shot/detect.js +38 -16
  70. package/dist/cli/shot/index.d.ts.map +1 -1
  71. package/dist/cli/shot/index.js +9 -2
  72. package/dist/cli/shot/measure.d.ts.map +1 -1
  73. package/dist/cli/shot/measure.js +11 -2
  74. package/dist/cli/shot/types.d.ts +4 -1
  75. package/dist/cli/shot/types.d.ts.map +1 -1
  76. package/dist/cli/sync.d.ts.map +1 -1
  77. package/dist/cli/sync.js +10 -2
  78. package/dist/common/could-not-load.d.ts +13 -0
  79. package/dist/common/could-not-load.d.ts.map +1 -0
  80. package/dist/common/could-not-load.js +14 -0
  81. package/dist/common/empty-copy.d.ts +16 -0
  82. package/dist/common/empty-copy.d.ts.map +1 -0
  83. package/dist/common/empty-copy.js +9 -0
  84. package/dist/common/index.d.ts +1 -0
  85. package/dist/common/index.d.ts.map +1 -1
  86. package/dist/common/index.js +3 -0
  87. package/dist/common/props.d.ts +20 -0
  88. package/dist/common/props.d.ts.map +1 -1
  89. package/dist/common/props.js +13 -1
  90. package/dist/common/retry-button.module.css +7 -3
  91. package/dist/common/virtual-rows.d.ts +196 -0
  92. package/dist/common/virtual-rows.d.ts.map +1 -0
  93. package/dist/common/virtual-rows.js +290 -0
  94. package/dist/controls/controls.module.css +33 -1
  95. package/dist/controls/controls.module.css.d.ts +2 -0
  96. package/dist/controls/enum-filter.d.ts.map +1 -1
  97. package/dist/controls/enum-filter.js +8 -2
  98. package/dist/controls/filter-pill.d.ts +27 -3
  99. package/dist/controls/filter-pill.d.ts.map +1 -1
  100. package/dist/controls/filter-pill.js +15 -4
  101. package/dist/controls/form-layout.d.ts +9 -3
  102. package/dist/controls/form-layout.d.ts.map +1 -1
  103. package/dist/controls/form-layout.js +74 -12
  104. package/dist/controls/form-layout.module.css +112 -7
  105. package/dist/controls/form-layout.module.css.d.ts +1 -0
  106. package/dist/controls/multi-select-filter.d.ts +2 -2
  107. package/dist/controls/multi-select-filter.d.ts.map +1 -1
  108. package/dist/controls/multi-select-filter.js +12 -6
  109. package/dist/controls/range-filter.d.ts +1 -1
  110. package/dist/controls/range-filter.d.ts.map +1 -1
  111. package/dist/controls/range-filter.js +8 -2
  112. package/dist/dashboard/bar-list.d.ts +5 -5
  113. package/dist/dashboard/bar-list.d.ts.map +1 -1
  114. package/dist/dashboard/bar-list.js +15 -8
  115. package/dist/dashboard/bar-list.module.css +21 -5
  116. package/dist/dashboard/board-nav.d.ts +22 -0
  117. package/dist/dashboard/board-nav.d.ts.map +1 -0
  118. package/dist/dashboard/board-nav.js +49 -0
  119. package/dist/dashboard/board.d.ts +52 -0
  120. package/dist/dashboard/board.d.ts.map +1 -0
  121. package/dist/dashboard/board.js +247 -0
  122. package/dist/dashboard/board.module.css +179 -0
  123. package/dist/dashboard/board.module.css.d.ts +28 -0
  124. package/dist/dashboard/empty-state.d.ts +6 -6
  125. package/dist/dashboard/empty-state.d.ts.map +1 -1
  126. package/dist/dashboard/empty-state.js +17 -8
  127. package/dist/dashboard/event-list-model.d.ts +54 -0
  128. package/dist/dashboard/event-list-model.d.ts.map +1 -0
  129. package/dist/dashboard/event-list-model.js +76 -0
  130. package/dist/dashboard/event-list-rows.d.ts +23 -0
  131. package/dist/dashboard/event-list-rows.d.ts.map +1 -0
  132. package/dist/dashboard/event-list-rows.js +89 -0
  133. package/dist/dashboard/event-list-scroll.d.ts +55 -0
  134. package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
  135. package/dist/dashboard/event-list-scroll.js +216 -0
  136. package/dist/dashboard/event-list-skeleton.d.ts +10 -0
  137. package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
  138. package/dist/dashboard/event-list-skeleton.js +34 -0
  139. package/dist/dashboard/event-list.d.ts +65 -0
  140. package/dist/dashboard/event-list.d.ts.map +1 -0
  141. package/dist/dashboard/event-list.js +208 -0
  142. package/dist/dashboard/event-list.module.css +336 -0
  143. package/dist/dashboard/event-list.module.css.d.ts +34 -0
  144. package/dist/dashboard/index.d.ts +2 -0
  145. package/dist/dashboard/index.d.ts.map +1 -1
  146. package/dist/dashboard/index.js +4 -0
  147. package/dist/dashboard/meter-model.d.ts +6 -3
  148. package/dist/dashboard/meter-model.d.ts.map +1 -1
  149. package/dist/dashboard/meter-model.js +9 -4
  150. package/dist/dashboard/meter-parts.d.ts +3 -0
  151. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  152. package/dist/dashboard/meter-parts.js +36 -6
  153. package/dist/dashboard/meter.d.ts +3 -3
  154. package/dist/dashboard/meter.d.ts.map +1 -1
  155. package/dist/dashboard/meter.js +10 -2
  156. package/dist/dashboard/meter.module.css +20 -12
  157. package/dist/dashboard/meter.module.css.d.ts +0 -1
  158. package/dist/dashboard/page-summary.d.ts +3 -3
  159. package/dist/dashboard/page-summary.d.ts.map +1 -1
  160. package/dist/dashboard/page-summary.js +7 -2
  161. package/dist/dashboard/page-summary.module.css +5 -2
  162. package/dist/dashboard/query-state.d.ts +9 -8
  163. package/dist/dashboard/query-state.d.ts.map +1 -1
  164. package/dist/dashboard/query-state.js +29 -11
  165. package/dist/dashboard/section.d.ts +11 -3
  166. package/dist/dashboard/section.d.ts.map +1 -1
  167. package/dist/dashboard/section.js +34 -7
  168. package/dist/dashboard/settings-section.d.ts +8 -5
  169. package/dist/dashboard/settings-section.d.ts.map +1 -1
  170. package/dist/dashboard/settings-section.js +12 -8
  171. package/dist/dashboard/settings-section.module.css +25 -4
  172. package/dist/dashboard/settings-section.module.css.d.ts +1 -0
  173. package/dist/dashboard/stat-card-parts.d.ts +5 -1
  174. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  175. package/dist/dashboard/stat-card-parts.js +8 -3
  176. package/dist/dashboard/stat-card.d.ts +3 -3
  177. package/dist/dashboard/stat-card.d.ts.map +1 -1
  178. package/dist/dashboard/stat-card.js +47 -12
  179. package/dist/dashboard/stat-card.module.css +42 -7
  180. package/dist/dashboard/stat-card.module.css.d.ts +3 -0
  181. package/dist/dashboard/stat-group.d.ts +2 -2
  182. package/dist/dashboard/stat-group.d.ts.map +1 -1
  183. package/dist/dashboard/stat-group.js +10 -3
  184. package/dist/dashboard/stat-strip.d.ts +5 -4
  185. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  186. package/dist/dashboard/stat-strip.js +41 -31
  187. package/dist/dashboard/stat-strip.module.css +8 -6
  188. package/dist/dashboard/visual-slot.d.ts +4 -0
  189. package/dist/dashboard/visual-slot.d.ts.map +1 -1
  190. package/dist/dashboard/visual-slot.js +2 -0
  191. package/dist/dashboard/widget-header.d.ts +6 -6
  192. package/dist/dashboard/widget-header.d.ts.map +1 -1
  193. package/dist/dashboard/widget-header.js +4 -2
  194. package/dist/dashboard/widget-header.module.css +12 -15
  195. package/dist/format/shared.d.ts.map +1 -1
  196. package/dist/format/shared.js +24 -1
  197. package/dist/guard/index.d.ts +1 -1
  198. package/dist/guard/index.d.ts.map +1 -1
  199. package/dist/guard/index.js +4 -1
  200. package/dist/index.d.ts +1 -1
  201. package/dist/index.d.ts.map +1 -1
  202. package/dist/index.js +4 -0
  203. package/dist/shell/app-main.module.css +18 -0
  204. package/dist/styles.css +69 -0
  205. package/dist/surfaces.d.ts +2 -2
  206. package/dist/surfaces.d.ts.map +1 -1
  207. package/dist/surfaces.js +8 -2
  208. package/dist/table/cell-kinds.d.ts +47 -0
  209. package/dist/table/cell-kinds.d.ts.map +1 -0
  210. package/dist/table/cell-kinds.js +180 -0
  211. package/dist/table/cell-kinds.module.css +55 -0
  212. package/dist/table/cell-kinds.module.css.d.ts +15 -0
  213. package/dist/table/data-table-fold.d.ts +155 -0
  214. package/dist/table/data-table-fold.d.ts.map +1 -0
  215. package/dist/table/data-table-fold.js +320 -0
  216. package/dist/table/data-table-state.d.ts +10 -3
  217. package/dist/table/data-table-state.d.ts.map +1 -1
  218. package/dist/table/data-table-state.js +11 -6
  219. package/dist/table/data-table.d.ts +13 -28
  220. package/dist/table/data-table.d.ts.map +1 -1
  221. package/dist/table/data-table.js +362 -255
  222. package/dist/table/data-table.module.css +282 -3
  223. package/dist/table/data-table.module.css.d.ts +16 -0
  224. package/dist/table/table-features.d.ts +34 -4
  225. package/dist/table/table-features.d.ts.map +1 -1
  226. package/dist/table/table-features.js +10 -0
  227. package/dist/theme/card-inset.module.css +35 -0
  228. package/dist/theme/controls.module.css +55 -2
  229. package/dist/theme/ctl-theme.d.ts.map +1 -1
  230. package/dist/theme/ctl-theme.js +5 -0
  231. package/dist/theme/index.d.ts.map +1 -1
  232. package/dist/theme/index.js +14 -10
  233. package/dist/tokens/core.d.ts +1 -0
  234. package/dist/tokens/core.d.ts.map +1 -1
  235. package/dist/tokens/core.js +1 -0
  236. package/dist/tokens/derive.js +1 -1
  237. package/dist/tokens/palette.d.ts +2 -1
  238. package/dist/tokens/palette.d.ts.map +1 -1
  239. package/llms.txt +295 -5
  240. package/package.json +1 -1
  241. package/src/agent/chat/thread-message.tsx +10 -403
  242. package/src/agent/chat/virtualize.ts +5 -5
  243. package/src/charts/ChartCard.tsx +175 -31
  244. package/src/charts/Lines.tsx +13 -4
  245. package/src/charts/Sparkline.tsx +213 -48
  246. package/src/charts/chart-box.module.css +59 -2
  247. package/src/charts/chart-box.module.css.d.ts +5 -0
  248. package/src/charts/chart-card.module.css +28 -17
  249. package/src/charts/chart-card.module.css.d.ts +3 -0
  250. package/src/charts/compile.ts +59 -33
  251. package/src/charts/labels.ts +175 -24
  252. package/src/charts/legend.tsx +3 -2
  253. package/src/charts/ref-label.ts +114 -18
  254. package/src/charts/sparkline.module.css +50 -0
  255. package/src/charts/sparkline.module.css.d.ts +3 -0
  256. package/src/charts/state.tsx +40 -10
  257. package/src/cli/doctor-upgrade.ts +75 -0
  258. package/src/cli/doctor.ts +36 -0
  259. package/src/cli/help.ts +16 -6
  260. package/src/cli/index.ts +73 -67
  261. package/src/cli/init.ts +157 -36
  262. package/src/cli/router-wiring.ts +2 -2
  263. package/src/cli/shot/capture.ts +138 -16
  264. package/src/cli/shot/detect.ts +46 -22
  265. package/src/cli/shot/index.ts +8 -2
  266. package/src/cli/shot/measure.ts +11 -2
  267. package/src/cli/shot/types.ts +4 -1
  268. package/src/cli/sync.ts +12 -2
  269. package/src/common/could-not-load.ts +22 -0
  270. package/src/common/empty-copy.ts +17 -0
  271. package/src/common/index.ts +1 -0
  272. package/src/common/props.ts +30 -0
  273. package/src/common/retry-button.module.css +7 -3
  274. package/src/common/virtual-rows.tsx +682 -0
  275. package/src/controls/controls.module.css +33 -1
  276. package/src/controls/controls.module.css.d.ts +2 -0
  277. package/src/controls/enum-filter.tsx +8 -2
  278. package/src/controls/filter-pill.tsx +80 -27
  279. package/src/controls/form-layout.module.css +112 -7
  280. package/src/controls/form-layout.module.css.d.ts +1 -0
  281. package/src/controls/form-layout.tsx +115 -22
  282. package/src/controls/multi-select-filter.tsx +22 -11
  283. package/src/controls/range-filter.tsx +9 -3
  284. package/src/dashboard/bar-list.module.css +21 -5
  285. package/src/dashboard/bar-list.tsx +53 -45
  286. package/src/dashboard/board-nav.ts +67 -0
  287. package/src/dashboard/board.module.css +179 -0
  288. package/src/dashboard/board.module.css.d.ts +28 -0
  289. package/src/dashboard/board.tsx +415 -0
  290. package/src/dashboard/empty-state.tsx +21 -11
  291. package/src/dashboard/event-list-model.ts +125 -0
  292. package/src/dashboard/event-list-rows.tsx +117 -0
  293. package/src/dashboard/event-list-scroll.ts +291 -0
  294. package/src/dashboard/event-list-skeleton.tsx +62 -0
  295. package/src/dashboard/event-list.module.css +336 -0
  296. package/src/dashboard/event-list.module.css.d.ts +34 -0
  297. package/src/dashboard/event-list.tsx +336 -0
  298. package/src/dashboard/index.ts +2 -0
  299. package/src/dashboard/meter-model.ts +16 -7
  300. package/src/dashboard/meter-parts.tsx +53 -14
  301. package/src/dashboard/meter.module.css +20 -12
  302. package/src/dashboard/meter.module.css.d.ts +0 -1
  303. package/src/dashboard/meter.tsx +36 -18
  304. package/src/dashboard/page-summary.module.css +5 -2
  305. package/src/dashboard/page-summary.tsx +13 -6
  306. package/src/dashboard/query-state.tsx +55 -30
  307. package/src/dashboard/section.tsx +83 -41
  308. package/src/dashboard/settings-section.module.css +25 -4
  309. package/src/dashboard/settings-section.module.css.d.ts +1 -0
  310. package/src/dashboard/settings-section.tsx +18 -8
  311. package/src/dashboard/stat-card-parts.tsx +20 -3
  312. package/src/dashboard/stat-card.module.css +42 -7
  313. package/src/dashboard/stat-card.module.css.d.ts +3 -0
  314. package/src/dashboard/stat-card.tsx +55 -13
  315. package/src/dashboard/stat-group.tsx +22 -14
  316. package/src/dashboard/stat-strip.module.css +8 -6
  317. package/src/dashboard/stat-strip.tsx +29 -20
  318. package/src/dashboard/visual-slot.ts +5 -0
  319. package/src/dashboard/widget-header.module.css +12 -15
  320. package/src/dashboard/widget-header.tsx +8 -5
  321. package/src/format/shared.ts +30 -1
  322. package/src/guard/index.ts +7 -1
  323. package/src/index.ts +4 -0
  324. package/src/shell/app-main.module.css +18 -0
  325. package/src/styles.css +69 -0
  326. package/src/surfaces.ts +7 -1
  327. package/src/table/cell-kinds.module.css +55 -0
  328. package/src/table/cell-kinds.module.css.d.ts +15 -0
  329. package/src/table/cell-kinds.tsx +263 -0
  330. package/src/table/data-table-fold.tsx +567 -0
  331. package/src/table/data-table-state.ts +24 -13
  332. package/src/table/data-table.module.css +282 -3
  333. package/src/table/data-table.module.css.d.ts +16 -0
  334. package/src/table/data-table.tsx +430 -362
  335. package/src/table/table-features.ts +44 -4
  336. package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
  337. package/src/theme/card-inset.module.css +35 -0
  338. package/src/theme/controls.module.css +55 -2
  339. package/src/theme/ctl-theme.tsx +8 -0
  340. package/src/theme/index.ts +12 -8
  341. package/src/tokens/core.ts +1 -0
  342. package/src/tokens/derive.ts +1 -1
  343. package/src/tokens/palette.ts +4 -1
@@ -29,6 +29,26 @@ export interface BasaltProps {
29
29
  /** Merged onto the root element's own inline style, if it has one. */
30
30
  readonly style?: CSSProperties | undefined;
31
31
  }
32
+ /**
33
+ * Free-form `data-*` attributes. A composite takes them on top of `BasaltProps` and forwards them to
34
+ * its ROOT element through `pickDataAttributes` — the seam `basalt-ui shot` (`data-shot`,
35
+ * `data-shot-states`) and consumer test hooks read. Only `data-*` crosses: basalt still does not
36
+ * spread `...rest`.
37
+ */
38
+ export type DataAttributes = {
39
+ readonly [K in `data-${string}`]?: string | number | boolean | undefined;
40
+ };
41
+ /**
42
+ * Splits `props` into its `data-*` entries (spread them onto the root: `{...data}`) and everything
43
+ * else. A composite that already forwards its remainder to a child (`...header`) splits first, or
44
+ * the anchor lands on the child instead of the root.
45
+ */
46
+ export declare function splitDataAttributes<P extends object>(props: P): {
47
+ data: DataAttributes;
48
+ rest: Omit<P, `data-${string}`>;
49
+ };
50
+ /** The `data-*` entries of `props` alone, for a component that destructures the rest itself. */
51
+ export declare const pickDataAttributes: (props: object) => DataAttributes;
32
52
  /** One class per named slot. The slot union is the component's documented contract. */
33
53
  export type SlotClassNames<S extends string> = Partial<Record<S, string>>;
34
54
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/common/props.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAE1C;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACvC,sEAAsE;IACtE,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,SAAS,CAAA;CAC3C;AAED,uFAAuF;AACvF,MAAM,MAAM,cAAc,CAAC,CAAC,SAAS,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAA;AAEzE;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,SAAS,MAAM;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,GAAG,SAAS,CAAA;CACpD;AAED;;;;;GAKG;AACH,MAAM,MAAM,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;AAE1C,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,SAAS,CAAA;AAE9C;;;;GAIG;AACH,YAAY,EAAE,gBAAgB,IAAI,IAAI,EAAE,MAAM,4BAA4B,CAAA;AAE1E;;;GAGG;AACH,wBAAgB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M,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAA;AAE1C,mFAAmF;AACnF,MAAM,MAAM,eAAe,GAAG,IAAI,GAAG,SAAS,CAAA;AAE9C;;;;GAIG;AACH,YAAY,EAAE,gBAAgB,IAAI,IAAI,EAAE,MAAM,4BAA4B,CAAA;AAE1E;;;GAGG;AACH,wBAAgB,EAAE,CAAC,GAAG,KAAK,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,MAAM,CAE7E"}
@@ -1,6 +1,18 @@
1
+ function splitDataAttributes(props) {
2
+ const data = {};
3
+ const rest = {};
4
+ for (const [key, value] of Object.entries(props)) {
5
+ if (key.startsWith("data-")) data[key] = value;
6
+ else rest[key] = value;
7
+ }
8
+ return { data, rest };
9
+ }
10
+ const pickDataAttributes = (props) => splitDataAttributes(props).data;
1
11
  function cx(...parts) {
2
12
  return parts.filter((part) => typeof part === "string" && part !== "").join(" ");
3
13
  }
4
14
  export {
5
- cx
15
+ cx,
16
+ pickDataAttributes,
17
+ splitDataAttributes
6
18
  };
@@ -2,8 +2,8 @@
2
2
  * The one Retry. ErrorState (Mantine, StatCard / pages), ChartCard's placeholder and a strip cell's
3
3
  * error all render this, so the three read as one button. It is a plain element because `./charts`
4
4
  * resolves with no Mantine, and it is styled to be a Mantine `size="xs" variant="default"` Button
5
- * reading the same `--vx-*` tokens the theme binds that button to: panel fill (elevated on hover), no
6
- * border, `shadow-raised`, the control radius, the xs type size, the theme's inline padding step and
5
+ * reading the same `--vx-*` tokens the theme binds that button to: panel fill (elevated on hover),
6
+ * `shadow-raised`, the control radius, the xs type size, the theme's inline padding step and
7
7
  * Mantine's 30px xs height. `--mantine-scale` carries the app's scale knob, 1 where Mantine is absent.
8
8
  */
9
9
  .retry {
@@ -15,7 +15,10 @@
15
15
  height: calc(1.875rem * var(--mantine-scale, 1));
16
16
  padding-block: 0;
17
17
  padding-inline: calc(var(--vx-space-stack-md, 0.75rem) * var(--mantine-scale, 1));
18
- border: calc(0.0625rem * var(--mantine-scale, 1)) solid transparent;
18
+ /* A visible edge: the panel fill and `shadow-raised` alone read as a pale chip on the page or a card,
19
+ so the border is ink mixed into the panel (>= 3:1 against it in both schemes), not the hairline. */
20
+ border: calc(0.0625rem * var(--mantine-scale, 1)) solid var(--vx-muted);
21
+ border-color: color-mix(in srgb, var(--vx-ink) 55%, var(--vx-surface-panel));
19
22
  border-radius: var(--vx-radius-ctrl);
20
23
  background: var(--vx-surface-panel);
21
24
  box-shadow: var(--vx-shadow-raised);
@@ -46,6 +49,7 @@
46
49
  /* Busy is Mantine's disabled paint: its own disabled colour and background, flat, no border. */
47
50
  .retry:disabled {
48
51
  background: var(--mantine-color-disabled, var(--vx-surface-subtle));
52
+ border-color: transparent;
49
53
  color: var(--mantine-color-disabled-color, var(--vx-muted));
50
54
  box-shadow: none;
51
55
  cursor: not-allowed;
@@ -0,0 +1,196 @@
1
+ import type { JSX, ReactNode } from 'react';
2
+ import type { Range } from '@tanstack/react-virtual';
3
+ import type { BasaltProps } from './props.js';
4
+ export type VirtualRow = {
5
+ readonly key: string;
6
+ readonly node: ReactNode;
7
+ /** A group header: the active one stays rendered while scrolled and is drawn `position: sticky`. */
8
+ readonly sticky?: boolean;
9
+ };
10
+ type InitialScroll = 'start' | 'end';
11
+ type ScrollOwner = {
12
+ readonly height: number | string;
13
+ readonly scroll?: never;
14
+ } | {
15
+ readonly scroll: 'parent';
16
+ readonly height?: never;
17
+ /**
18
+ * The caller's own scroll node for the parent mode, instead of the detected scrolling ancestor:
19
+ * lets one stable element own the scroll whether or not its rows are windowed. `null` = not
20
+ * mounted yet (the rows wait for it); omitted = detect the ancestor.
21
+ */
22
+ readonly scrollRoot?: HTMLElement | null;
23
+ };
24
+ export type VirtualRowsProps = BasaltProps & ScrollOwner & {
25
+ readonly rows: readonly VirtualRow[];
26
+ /** Extra rows rendered beyond the viewport, each side. */
27
+ readonly overscan: number;
28
+ /** Estimated row height in px before a row is measured; estimate toward the LARGER end. */
29
+ readonly estimateSize: number;
30
+ /** px between rows. Default 0. */
31
+ readonly gap?: number;
32
+ /** Row gap of the peer-absent degrade when it should differ from the windowed `gap`. */
33
+ readonly fallbackGap?: number | string;
34
+ /** Where the list sits on first mount. Default 'start'. */
35
+ readonly initialScroll?: InitialScroll;
36
+ /** Which edge a count/edge-key change keeps fixed. Default 'start'. */
37
+ readonly anchorTo?: 'start' | 'end';
38
+ /** Follow an append while at the end. Default false. */
39
+ readonly followOnAppend?: boolean;
40
+ };
41
+ /** Caps `applyInitialScroll`'s clobber-recovery retries (see `agent/chat/virtualize.ts`'s fourth composition
42
+ * rule for the full mechanism this guards). A small fixed budget, not a time/frame-based deadline:
43
+ * every observed case of virtual-core's `_willUpdate` clobbering this effect's jump resolves within
44
+ * one extra commit, so this exists purely as a backstop against a pathological DOM that never
45
+ * reports settled — not as the expected path. Once exhausted, the effect gives up and marks the
46
+ * jump permanently done wherever the last attempt landed, rather than fighting the DOM (or a user
47
+ * who has since scrolled away) forever. Exported (like `messageBlockRenderCounter`) purely so its
48
+ * test can assert the exact bound without duplicating the number; not part of the public surface. */
49
+ export declare const MAX_INITIAL_SCROLL_ATTEMPTS = 5;
50
+ /**
51
+ * Minimal structural slice of `Virtualizer` (virtual-core 3.18.0) that
52
+ * {@link resolveGuardedMeasurement} needs — `indexFromElement`/`itemSizeCache`/`options` are all
53
+ * public instance members, but typing against the real (generic, peer-only) `Virtualizer` class
54
+ * would force this test-only-exported helper to import the peer's runtime types at module scope,
55
+ * the exact static-import-forces-the-peer problem the surrounding `lazy(() => import(...))` exists
56
+ * to avoid. A structural type sidesteps that without loosening to `any`. Generic over the item
57
+ * element type (rather than fixed at `Element`) so it stays exactly assignable FROM a real
58
+ * `Virtualizer<TScrollElement, TItemElement>` at the call site below — `indexFromElement` is
59
+ * declared with arrow-property (not method) syntax upstream, so it is checked contravariantly, and
60
+ * a fixed `Element` parameter there does not structurally match a real instance's narrower
61
+ * `TItemElement` parameter.
62
+ */
63
+ type MeasurementCacheHost<TItemElement extends Element> = {
64
+ readonly indexFromElement: (node: TItemElement) => number;
65
+ readonly itemSizeCache: Map<unknown, number>;
66
+ readonly options: {
67
+ readonly getItemKey: (index: number) => unknown;
68
+ readonly estimateSize: (index: number) => number;
69
+ };
70
+ };
71
+ /**
72
+ * Resolves the size a `measureElement` implementation should report, given what the underlying
73
+ * (default or custom) measurement already produced: that value unchanged when it is a genuine
74
+ * measurement, or the row's own last-known size when it is `0` — never a real reading for a mounted
75
+ * row, so a `0` only ever means the ResizeObserver measured through a `display: none` (or otherwise
76
+ * unlaid-out) ancestor, e.g. a virtualized transcript sitting inside a collapsed `ThreadFeedRow`.
77
+ * Falling through to it unguarded is what corrupted `itemSizeCache`/`measurementsCache`: virtual-
78
+ * core's default `resizeItem` writes whatever `measureElement` returns with no floor, so every
79
+ * mounted row remeasures at 0px the instant an ancestor hides, `getTotalSize()` collapses within
80
+ * the same tick, and the collapse is never undone — a later real remeasurement only OVERWRITES
81
+ * entries the ResizeObserver happens to re-fire for, it does not restore ones that silently kept
82
+ * their poisoned 0 (see `virtualize.ts`'s composition-rule doc for the full mechanism and the
83
+ * measured numbers).
84
+ *
85
+ * Takes the already-computed `size` plus the {@link MeasurementCacheHost} slice, rather than
86
+ * wrapping the `measureElement` function itself, so this stays a plain, non-generic-over-a-
87
+ * generic-function call at its one call site below (`instance` there is `Virtualizer<TScrollElement,
88
+ * TItemElement>` for THAT call's concrete type arguments, not the peer's own generic
89
+ * `measureElement` export — wrapping the latter directly hits TS's higher-rank inference limits on
90
+ * a doubly-generic HOF). That shape is also what makes this unit-testable with a fake host object
91
+ * and no ResizeObserver/layout engine at all (happy-dom has neither). Not exported from
92
+ * `agent-chat/index.ts`: a test-only escape hatch, matching
93
+ * `messageBlockRenderCounter`/`nonVirtualizedRowsFallback` above.
94
+ */
95
+ export declare function resolveGuardedMeasurement<TItemElement extends Element>(host: MeasurementCacheHost<TItemElement>, element: TItemElement, size: number): number;
96
+ /**
97
+ * Decides what `VirtualRowsInner`'s one-shot initial-scroll effect should do this render,
98
+ * given the inputs the effect closes over. Pure and peer/DOM-free — pulled out of the lazy-loaded
99
+ * closure for the same reason `resolveGuardedMeasurement` is: it stays unit-testable without a
100
+ * real `Virtualizer` instance or `@tanstack/react-virtual` itself.
101
+ *
102
+ * `'start'` and an empty transcript resolve to `'skip-done'` — there is nothing to scroll to, and
103
+ * DONE is permanent (see `virtualize.ts`'s fourth composition rule: the real scroll must fire at
104
+ * most once, ever, so a later append never yanks a user who has scrolled up). A non-positive
105
+ * `containerHeight` — the transcript's own scroll node measuring `0`, e.g. mounted behind a
106
+ * `display: none` ancestor per `virtualize.ts`'s third composition rule — resolves to
107
+ * `'skip-retry'`: NOT done, so the caller's effect (which re-runs after EVERY commit until the jump
108
+ * lands — see {@link applyInitialScroll}) gets another chance the next time this subtree renders,
109
+ * instead of permanently stranding the transcript at the top the moment it becomes visible. Only a
110
+ * genuinely measured, non-empty, `'end'`-targeted mount resolves to `'scroll'`.
111
+ */
112
+ export declare function resolveInitialScrollAction(initialScroll: InitialScroll, rowCount: number, containerHeight: number): 'scroll' | 'skip-done' | 'skip-retry';
113
+ /** The mutable half of the one-shot initial-scroll contract. `hasApplied` is whether it has
114
+ * PERMANENTLY finished — either there was nothing to do (`'start'`/empty transcript), or
115
+ * `scrollToEnd` fired and was subsequently CONFIRMED (via a real DOM read — see
116
+ * {@link applyInitialScroll}'s doc for why virtual-core's own tracked offset can't be trusted for
117
+ * this) to have survived whatever else committed since. `attempts` counts how many times
118
+ * `scrollToEnd` has been (re-)fired this mount; 0 means never attempted, and also gates whether a
119
+ * call re-derives {@link resolveInitialScrollAction} at all. One instance lives for the lifetime of
120
+ * a `VirtualRowsInner` mount, held in a `useRef` so it survives re-renders without itself
121
+ * triggering one. */
122
+ export type InitialScrollState = {
123
+ hasApplied: boolean;
124
+ attempts: number;
125
+ };
126
+ /**
127
+ * The stateful half of "fires once, on first mount, and never again" (`virtualize.ts`'s fourth
128
+ * composition rule): wraps {@link resolveInitialScrollAction}'s per-call decision with the
129
+ * ACROSS-CALLS memory that decision alone can't carry. Exported (like `resolveGuardedMeasurement`)
130
+ * so `VirtualRowsInner`'s effect below calls this SAME function rather than a hand-mirrored
131
+ * copy for tests — a fake `scrollToEnd` is the only DOM/peer-free way to prove the guard, since a
132
+ * real `Virtualizer`'s own `followOnAppend` also calls the real DOM `scrollTo` on a later append,
133
+ * making that specific call indistinguishable from this one at the DOM boundary (see this
134
+ * function's test suite for the measurement that ruled that boundary out).
135
+ *
136
+ * Firing `scrollToEnd()` once is NOT the same as landing there: virtual-core 3.18.0's own
137
+ * `_willUpdate` (verified against the installed dist) writes to the SAME scroll container from
138
+ * `this.scrollOffset`, which updates only from the ASYNCHRONOUS native `scroll` event — never from
139
+ * the synchronous call that requested a scroll. A commit that runs `_willUpdate` before this
140
+ * effect gets a turn (element-attach) or that re-derives an anchor while `scrollOffset` still holds
141
+ * the pre-jump value writes that STALE offset straight back to `scrollTop`, undoing the jump within
142
+ * about one extra commit of it landing (see `agent/chat/virtualize.ts`'s fourth composition rule for the full
143
+ * trace this was diagnosed from). So `resolveInitialScrollAction`'s `'scroll'` outcome does not, by
144
+ * itself, set `hasApplied`: `isAtEnd` — a real `scrollTop`/`scrollHeight`/`clientHeight` read, the
145
+ * one piece of ground truth that is NEVER stale, unlike virtual-core's own tracked offset — is
146
+ * consulted on the NEXT call (i.e. the next commit, exactly the cadence this dependency-free effect
147
+ * already runs on) to confirm the jump survived. If it didn't, `scrollToEnd` fires again; if it did,
148
+ * `hasApplied` is set and the effect is inert for the rest of the mount. `MAX_INITIAL_SCROLL_ATTEMPTS`
149
+ * bounds this so a DOM that pathologically never reports settled — or a user who scrolls away mid-
150
+ * measurement — can never be fought forever; once exhausted, `hasApplied` is set regardless, wherever
151
+ * the last attempt left the container.
152
+ *
153
+ * `state.hasApplied` is the ONLY thing that can permanently stop this from calling `scrollToEnd`
154
+ * again: `'start'` and an empty transcript set it immediately (nothing to verify), and `'skip-retry'`
155
+ * deliberately leaves it `false` so a transcript that mounted behind a hidden ancestor gets another
156
+ * attempt on the caller's next commit, rather than being silently abandoned the moment it becomes
157
+ * visible. That retry — and the clobber-recovery above — is why the caller's effect carries NO
158
+ * dependency array: the commit that matters (a collapsed `ThreadFeedRow` flipping its body back to
159
+ * `display: block`, or virtual-core's own follow-up commit after this effect's own jump) changes
160
+ * neither the row count nor the virtualizer identity, so a dependency-keyed effect would never
161
+ * re-run for it.
162
+ *
163
+ * `getContainerHeight` is a THUNK, not a number, for the same reason: reading `offsetHeight` forces
164
+ * a synchronous layout, and it is read at most ONCE per mount — only on the very first call
165
+ * (`attempts === 0`) — never again while verifying or retrying, so a landed transcript still pays
166
+ * nothing for the effect it keeps re-running (a streaming transcript commits on every chunk).
167
+ * `isAtEnd` is cheaper (a plain property read, no forced reflow beyond what the browser already
168
+ * tracks) and is exactly what the verification/retry loop above consults instead.
169
+ */
170
+ export declare function applyInitialScroll(state: InitialScrollState, initialScroll: InitialScroll, rowCount: number, getContainerHeight: () => number, scrollToEnd: () => void, isAtEnd: () => boolean): void;
171
+ /** `scroll: 'parent'`'s ground-truth "at the end": the LIST's bottom edge against the scrollport's
172
+ * visible bottom (`null` scroller → the window). Not the whole scrollport — content after the list
173
+ * keeps that distance positive forever, which would make {@link applyInitialScroll} re-fire
174
+ * `scrollToEnd` up to its attempt cap and yank a user who has scrolled away. */
175
+ export declare function isListAtEnd(list: Element | null, scroller: HTMLElement | null, threshold: number): boolean;
176
+ /** The active sticky header: the last sticky index at or before the first visible index. */
177
+ export declare function activeStickyIndex(stickyIndexes: readonly number[], firstVisible: number | undefined): number | undefined;
178
+ /** `base` (virtual-core's `defaultRangeExtractor`) plus the active sticky index, ascending. */
179
+ export declare function extractRangeWithSticky(range: Range, stickyIndexes: readonly number[], base: (range: Range) => number[]): number[];
180
+ /**
181
+ * Every row rendered unwindowed in the same scroll owner. This is what a list falls back to when
182
+ * `@tanstack/react-virtual` fails to resolve (peer absent). Sticky headers stay `position: sticky`
183
+ * through CSS alone.
184
+ *
185
+ * NOT used as the `Suspense` fallback (see `SuspensePane`): mounting every real row for the one
186
+ * tick the lazy import takes would make that settle a genuine unmount/remount of every row,
187
+ * re-firing each row's effects and risking a message mid-stream during the resolve window.
188
+ */
189
+ export declare function NonVirtualizedRows({ rows, height, gap, fallbackGap, className, style, }: VirtualRowsProps): JSX.Element;
190
+ /** Test-only escape hatch: proves the peer-absent degrade renders every row without having to fight
191
+ * `React.lazy`'s permanent once-per-module-instance resolution cache. */
192
+ export declare const nonVirtualizedRowsFallback: typeof NonVirtualizedRows;
193
+ /** The seam. `height` → own scroll node; `scroll: 'parent'` → the nearest scrolling ancestor. */
194
+ export declare function VirtualRows(props: VirtualRowsProps): JSX.Element;
195
+ export {};
196
+ //# sourceMappingURL=virtual-rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-rows.d.ts","sourceRoot":"","sources":["../../src/common/virtual-rows.tsx"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAgC,GAAG,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACzE,OAAO,KAAK,EAAE,KAAK,EAAe,MAAM,yBAAyB,CAAA;AAEjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAA;IACxB,oGAAoG;IACpG,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,KAAK,aAAa,GAAG,OAAO,GAAG,KAAK,CAAA;AAEpC,KAAK,WAAW,GACZ;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,GAC7D;IACE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CA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V;AAID;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,IAAI,EACJ,MAAM,EACN,GAAO,EACP,WAAiB,EACjB,SAAS,EACT,KAAK,GACN,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CA4BhC;AAED;yEACyE;AACzE,eAAO,MAAM,0BAA0B,2BAAqB,CAAA;AAgR5D,iGAAiG;AACjG,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,GAAG,CAAC,OAAO,CAehE"}
@@ -0,0 +1,290 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import {
3
+ Fragment,
4
+ lazy,
5
+ Suspense,
6
+ useEffect,
7
+ useLayoutEffect,
8
+ useMemo,
9
+ useRef,
10
+ useState
11
+ } from "react";
12
+ import { cx } from "./props.js";
13
+ import { scrollParentOf } from "./scroll-parent.js";
14
+ const STICKY_STYLE = {
15
+ position: "sticky",
16
+ top: 0,
17
+ zIndex: 1,
18
+ background: "var(--virtual-rows-sticky-bg, var(--vx-surface-bg))"
19
+ };
20
+ const SCROLL_END_THRESHOLD = 64;
21
+ const MAX_INITIAL_SCROLL_ATTEMPTS = 5;
22
+ function resolveGuardedMeasurement(host, element, size) {
23
+ if (size > 0) return size;
24
+ const index = host.indexFromElement(element);
25
+ const key = host.options.getItemKey(index);
26
+ return host.itemSizeCache.get(key) ?? host.options.estimateSize(index);
27
+ }
28
+ function resolveInitialScrollAction(initialScroll, rowCount, containerHeight) {
29
+ if (initialScroll === "start") return "skip-done";
30
+ if (rowCount === 0) return "skip-done";
31
+ if (containerHeight <= 0) return "skip-retry";
32
+ return "scroll";
33
+ }
34
+ function applyInitialScroll(state, initialScroll, rowCount, getContainerHeight, scrollToEnd, isAtEnd) {
35
+ if (state.hasApplied) return;
36
+ if (state.attempts > 0) {
37
+ if (isAtEnd() || state.attempts >= MAX_INITIAL_SCROLL_ATTEMPTS) {
38
+ state.hasApplied = true;
39
+ return;
40
+ }
41
+ scrollToEnd();
42
+ state.attempts += 1;
43
+ return;
44
+ }
45
+ const action = resolveInitialScrollAction(initialScroll, rowCount, getContainerHeight());
46
+ if (action === "skip-retry") return;
47
+ if (action === "skip-done") {
48
+ state.hasApplied = true;
49
+ return;
50
+ }
51
+ scrollToEnd();
52
+ state.attempts += 1;
53
+ }
54
+ function isContainerAtEnd(container, threshold) {
55
+ if (container === null) return false;
56
+ const distanceFromEnd = container.scrollHeight - container.clientHeight - container.scrollTop;
57
+ return distanceFromEnd <= threshold;
58
+ }
59
+ function isListAtEnd(list, scroller, threshold) {
60
+ if (list === null) return false;
61
+ const visibleBottom = scroller === null ? window.innerHeight : scroller.getBoundingClientRect().top + scroller.clientTop + scroller.clientHeight;
62
+ return list.getBoundingClientRect().bottom - visibleBottom <= threshold;
63
+ }
64
+ function activeStickyIndex(stickyIndexes, firstVisible) {
65
+ if (firstVisible === void 0) return void 0;
66
+ let active;
67
+ for (const index of stickyIndexes) {
68
+ if (index > firstVisible) break;
69
+ active = index;
70
+ }
71
+ return active;
72
+ }
73
+ function extractRangeWithSticky(range, stickyIndexes, base) {
74
+ const indexes = base(range);
75
+ const active = activeStickyIndex(stickyIndexes, range.startIndex);
76
+ if (active === void 0 || indexes.includes(active)) return indexes;
77
+ return [active, ...indexes];
78
+ }
79
+ function NonVirtualizedRows({
80
+ rows,
81
+ height,
82
+ gap = 0,
83
+ fallbackGap = gap,
84
+ className,
85
+ style
86
+ }) {
87
+ const list = (
88
+ // theme-allow inline-display — the degrade target is a plain column of rows.
89
+ /* @__PURE__ */ jsx("div", { style: { display: "flex", flexDirection: "column", gap: fallbackGap }, children: rows.map(
90
+ (row) => row.sticky === true ? /* @__PURE__ */ jsx("div", { style: STICKY_STYLE, children: row.node }, row.key) : /* @__PURE__ */ jsx(Fragment, { children: row.node }, row.key)
91
+ ) })
92
+ );
93
+ if (height === void 0)
94
+ return /* @__PURE__ */ jsx("div", { className: cx(className), style, children: list });
95
+ return (
96
+ // theme-allow raw-scroll-container — as above.
97
+ /* @__PURE__ */ jsx("div", { className: cx(className), style: { height, overflow: "auto", ...style }, children: list })
98
+ );
99
+ }
100
+ const nonVirtualizedRowsFallback = NonVirtualizedRows;
101
+ function guardedMeasure(base) {
102
+ return (element, entry, instance) => resolveGuardedMeasurement(instance, element, base(element, entry, instance));
103
+ }
104
+ function createRows(rv, useRowsVirtualizer, onWindow) {
105
+ return function VirtualRowsInner({
106
+ rows,
107
+ height,
108
+ overscan,
109
+ estimateSize,
110
+ gap = 0,
111
+ initialScroll = "start",
112
+ anchorTo = "start",
113
+ followOnAppend = false,
114
+ parent,
115
+ className,
116
+ style
117
+ }) {
118
+ "use no memo";
119
+ const ownRef = useRef(null);
120
+ const listRef = useRef(null);
121
+ const initialScrollStateRef = useRef({ hasApplied: false, attempts: 0 });
122
+ const stickyIndexes = useMemo(
123
+ () => rows.flatMap((row, index) => row.sticky === true ? [index] : []),
124
+ [rows]
125
+ );
126
+ const rangeExtractor = useMemo(
127
+ () => (range) => extractRangeWithSticky(range, stickyIndexes, rv.defaultRangeExtractor),
128
+ [stickyIndexes]
129
+ );
130
+ const elementNode = () => parent?.element ?? ownRef.current;
131
+ const scrollNode = () => onWindow ? document.scrollingElement : elementNode();
132
+ const virtualizer = useRowsVirtualizer({
133
+ count: rows.length,
134
+ getScrollElement: scrollNode,
135
+ estimateSize: () => estimateSize,
136
+ overscan,
137
+ gap,
138
+ scrollMargin: parent?.margin ?? 0,
139
+ // `scroll: 'parent'` mounts on a scroller that may already be scrolled (a list that was plain
140
+ // DOM a frame ago): start at that offset, not 0 — virtual-core writes its tracked offset back
141
+ // on attach, which would jump the scroller to the top.
142
+ ...parent !== void 0 && { initialOffset: () => scrollNode()?.scrollTop ?? 0 },
143
+ rangeExtractor,
144
+ getItemKey: (index) => rows[index]?.key ?? index,
145
+ anchorTo,
146
+ followOnAppend,
147
+ scrollEndThreshold: SCROLL_END_THRESHOLD,
148
+ useFlushSync: false
149
+ });
150
+ useLayoutEffect(() => {
151
+ applyInitialScroll(
152
+ initialScrollStateRef.current,
153
+ initialScroll,
154
+ rows.length,
155
+ () => onWindow ? window.innerHeight : elementNode()?.offsetHeight ?? 0,
156
+ () => virtualizer.scrollToEnd({ behavior: "auto" }),
157
+ () => parent === void 0 ? isContainerAtEnd(scrollNode(), SCROLL_END_THRESHOLD) : isListAtEnd(listRef.current, parent.element, SCROLL_END_THRESHOLD)
158
+ );
159
+ });
160
+ const margin = parent?.margin ?? 0;
161
+ const virtualItems = virtualizer.getVirtualItems();
162
+ const activeSticky = activeStickyIndex(stickyIndexes, virtualizer.range?.startIndex);
163
+ const items = /* @__PURE__ */ jsx("div", { ref: listRef, style: { height: virtualizer.getTotalSize(), position: "relative" }, children: virtualItems.map((virtualItem) => {
164
+ const row = rows[virtualItem.index];
165
+ if (row === void 0) return null;
166
+ return /* @__PURE__ */ jsx(
167
+ "div",
168
+ {
169
+ ref: virtualizer.measureElement,
170
+ "data-index": virtualItem.index,
171
+ style: virtualItem.index === activeSticky ? STICKY_STYLE : {
172
+ position: "absolute",
173
+ top: 0,
174
+ left: 0,
175
+ width: "100%",
176
+ transform: `translateY(${virtualItem.start - margin}px)`
177
+ },
178
+ children: row.node
179
+ },
180
+ row.key
181
+ );
182
+ }) });
183
+ if (height === void 0) return items;
184
+ return /* @__PURE__ */ jsx(
185
+ "div",
186
+ {
187
+ ref: ownRef,
188
+ className: cx(className),
189
+ style: { height, overflow: "auto", ...style },
190
+ children: items
191
+ }
192
+ );
193
+ };
194
+ }
195
+ const LazyVirtualRows = lazy(
196
+ () => import("@tanstack/react-virtual").then((rv) => {
197
+ const { useVirtualizer, useWindowVirtualizer, measureElement } = rv;
198
+ const Rows = createRows(
199
+ rv,
200
+ (o) => useVirtualizer({
201
+ ...o,
202
+ measureElement: guardedMeasure(measureElement)
203
+ }),
204
+ false
205
+ );
206
+ const WindowRows = createRows(
207
+ rv,
208
+ ({ getScrollElement: _unused, ...o }) => useWindowVirtualizer({ ...o, measureElement: guardedMeasure(measureElement) }),
209
+ true
210
+ );
211
+ return {
212
+ default: function Dispatch(props) {
213
+ return props.parent?.element === null ? /* @__PURE__ */ jsx(WindowRows, { ...props }) : /* @__PURE__ */ jsx(Rows, { ...props });
214
+ }
215
+ };
216
+ }).catch(() => ({ default: NonVirtualizedRows }))
217
+ );
218
+ Object.assign(LazyVirtualRows, { displayName: "LazyVirtualRows" });
219
+ function SuspensePane({
220
+ height,
221
+ className,
222
+ style
223
+ }) {
224
+ return /* @__PURE__ */ jsx("div", { className: cx(className), style: { height, overflow: "auto", ...style } });
225
+ }
226
+ function measureParent(list, scrollRoot) {
227
+ if (list === null || scrollRoot === null) return null;
228
+ const element = scrollRoot ?? scrollParentOf(list);
229
+ const top = list.getBoundingClientRect().top;
230
+ const margin = element === null ? top + window.scrollY : top - element.getBoundingClientRect().top - element.clientTop + element.scrollTop;
231
+ return { element, margin: Math.round(margin) };
232
+ }
233
+ function sameParent(a, b) {
234
+ return a !== null && a.element === b.element && a.margin === b.margin;
235
+ }
236
+ function ParentRows(props) {
237
+ const { className, style, scrollRoot, ...rest } = props;
238
+ const listRef = useRef(null);
239
+ const [parent, setParent] = useState(null);
240
+ const remeasure = () => {
241
+ const next = measureParent(listRef.current, scrollRoot);
242
+ if (next !== null) setParent((prev) => sameParent(prev, next) ? prev : next);
243
+ };
244
+ useLayoutEffect(remeasure);
245
+ const scroller = parent?.element;
246
+ useEffect(() => {
247
+ const list = listRef.current;
248
+ if (list === null) return;
249
+ window.addEventListener("resize", remeasure);
250
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(remeasure);
251
+ for (let node = list; node !== null; node = node.parentElement) {
252
+ observer?.observe(node);
253
+ if (node === scroller) break;
254
+ }
255
+ return () => {
256
+ window.removeEventListener("resize", remeasure);
257
+ observer?.disconnect();
258
+ };
259
+ }, [scroller, scrollRoot]);
260
+ return /* @__PURE__ */ jsx("div", { ref: listRef, className: cx(className), style, children: parent !== null && /* @__PURE__ */ jsx(Suspense, { fallback: null, children: /* @__PURE__ */ jsx(LazyVirtualRows, { ...rest, parent }) }) });
261
+ }
262
+ function VirtualRows(props) {
263
+ if (props.scroll === "parent") return /* @__PURE__ */ jsx(ParentRows, { ...props });
264
+ return /* @__PURE__ */ jsx(
265
+ Suspense,
266
+ {
267
+ fallback: /* @__PURE__ */ jsx(
268
+ SuspensePane,
269
+ {
270
+ height: props.height,
271
+ ...props.className !== void 0 && { className: props.className },
272
+ ...props.style !== void 0 && { style: props.style }
273
+ }
274
+ ),
275
+ children: /* @__PURE__ */ jsx(LazyVirtualRows, { ...props })
276
+ }
277
+ );
278
+ }
279
+ export {
280
+ MAX_INITIAL_SCROLL_ATTEMPTS,
281
+ NonVirtualizedRows,
282
+ VirtualRows,
283
+ activeStickyIndex,
284
+ applyInitialScroll,
285
+ extractRangeWithSticky,
286
+ isListAtEnd,
287
+ nonVirtualizedRowsFallback,
288
+ resolveGuardedMeasurement,
289
+ resolveInitialScrollAction
290
+ };
@@ -131,8 +131,9 @@
131
131
  padding-inline: var(--button-padding-x-ctl);
132
132
  }
133
133
 
134
+ /* An active filter is selection state, so its border is ink, not the accent (SPEC § 6.12). */
134
135
  .pill[data-active] {
135
- border-color: var(--vx-accent);
136
+ border-color: color-mix(in srgb, var(--vx-ink) 55%, transparent);
136
137
  color: var(--vx-ink);
137
138
  }
138
139
 
@@ -176,6 +177,37 @@
176
177
  font-weight: 500;
177
178
  }
178
179
 
180
+ /* The two-span anatomy (`filter-pill.tsx`): the facet's name muted, the selection bright. A pill
181
+ * without a value renders neither span, so its single label keeps the button's own colour. */
182
+ .pillName {
183
+ flex-shrink: 0;
184
+ color: var(--vx-muted);
185
+ }
186
+
187
+ /* The Button label is a flex row (whitespace between its spans collapses), so the gap is the
188
+ * tier's own control gap, and the VALUE is what truncates past the pill's width cap. */
189
+ .pillLabel:has(.pillValue) {
190
+ column-gap: var(--vx-space-control-gap, 0.375rem);
191
+ }
192
+
193
+ .pillValue {
194
+ overflow: hidden;
195
+ text-overflow: ellipsis;
196
+ color: var(--vx-ink);
197
+ }
198
+
199
+ /* A numeric pill that also carries a name keeps the NAME in the body face — only the value is a
200
+ * number. */
201
+ .pill[data-numeric]:has(.pillValue) .pillName {
202
+ font-family: var(--mantine-font-family);
203
+ font-size: var(--vx-text-sm);
204
+ }
205
+
206
+ .pill[data-numeric] .pillValue {
207
+ font-family: var(--basalt-font-mono);
208
+ font-size: var(--vx-text-xs);
209
+ }
210
+
179
211
  /* Numeric pill labels read mono at the smaller step. The FACE comes from the package-wide
180
212
  * `[data-numeric]` law in `styles.css`; the `font-size` is the pill's own decision, which is why
181
213
  * this rule exists at all. */
@@ -11,6 +11,8 @@ declare const classes: {
11
11
  readonly pill: string
12
12
  readonly pillIcon: string
13
13
  readonly pillLabel: string
14
+ readonly pillName: string
15
+ readonly pillValue: string
14
16
  readonly glyph: string
15
17
  readonly dropdown: string
16
18
  readonly optionList: string
@@ -1 +1 @@
1
- {"version":3,"file":"enum-filter.d.ts","sourceRoot":"","sources":["../../src/controls/enum-filter.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACtC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAGlD,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAK7D;;;;;GAKG;AACH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,IAAI;IAC3C,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAA;IACpB,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAA;IACxC,GAAG,IAAI,SAAS,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,CAAA;IACtC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,OAAO,CAAA;IACxB;kFAC8E;IAC9E,KAAK,IAAI,IAAI,CAAA;CACd,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