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
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Typed CSS-module declaration (the S4 CSS-modules path). Named string props — not an index
3
+ * signature — so dot access stays verbatim under the package's strict flags.
4
+ */
5
+ declare const classes: {
6
+ readonly root: string
7
+ readonly columns: string
8
+ readonly column: string
9
+ readonly viewport: string
10
+ readonly head: string
11
+ readonly title: string
12
+ readonly thumb: string
13
+ readonly count: string
14
+ readonly total: string
15
+ readonly list: string
16
+ readonly card: string
17
+ readonly caption: string
18
+ readonly open: string
19
+ readonly record: string
20
+ readonly meter: string
21
+ readonly status: string
22
+ readonly empty: string
23
+ readonly skeletonTitle: string
24
+ readonly skeletonCaption: string
25
+ readonly skeletonLine: string
26
+ readonly skeletonStatus: string
27
+ }
28
+ export default classes
@@ -1,14 +1,14 @@
1
1
  import type { ReactNode } from 'react';
2
- import type { BasaltProps, SlotStylesProps } from '../common/props.js';
2
+ import type { BasaltProps, DataAttributes, SlotStylesProps } from '../common/props.js';
3
3
  /** The five boxes `EmptyState` paints, and the whole styling seam it offers (`common/props.ts`). */
4
4
  export type EmptyStateSlot = 'root' | 'icon' | 'title' | 'description' | 'action';
5
- export type EmptyStateProps = BasaltProps & SlotStylesProps<EmptyStateSlot> & {
5
+ export type EmptyStateProps = BasaltProps & DataAttributes & SlotStylesProps<EmptyStateSlot> & {
6
6
  /** Optional glyph slot, rendered faint at ~28-32px. No shipped illustration assets. */
7
7
  icon?: ReactNode;
8
- /** Head-font title (18px, weight 550, ink). */
8
+ /** Weight 500, ink: `sm` in a section tile (never louder than its host's title), `md` on a page (SPEC § 6.11). */
9
9
  title: string;
10
10
  /**
11
- * Muted 15px description, capped at ~360px so it reads as a short explanation. Optional: a
11
+ * Muted `sm` description, capped at ~360px so it reads as a short explanation. Optional: a
12
12
  * compact panel ("No data yet") should not have to invent a second sentence, and five argo
13
13
  * features wrapped this component solely to avoid doing so.
14
14
  */
@@ -16,8 +16,8 @@ export type EmptyStateProps = BasaltProps & SlotStylesProps<EmptyStateSlot> & {
16
16
  /** Optional call-to-action rendered below the description. */
17
17
  action?: ReactNode;
18
18
  /** How loud this state is: `'page'` (default) = generous padding for a full-page state;
19
- * `'section'` = compact. */
19
+ * `'section'` = a compact, ring-edged tile (one ring, card radius) inside the surface it replaces. */
20
20
  tier?: 'page' | 'section';
21
21
  };
22
- export declare function EmptyState({ icon, title, description, action, tier, className, style, classNames, }: EmptyStateProps): import("react").JSX.Element;
22
+ export declare function EmptyState({ icon, title, description, action, tier, className, style, classNames, ...rest }: EmptyStateProps): import("react").JSX.Element;
23
23
  //# sourceMappingURL=empty-state.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/dashboard/empty-state.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEnE,oGAAoG;AACpG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAA;AAEjF,MAAM,MAAM,eAAe,GAAG,WAAW,GACvC,eAAe,CAAC,cAAc,CAAC,GAAG;IAChC,uFAAuF;IACvF,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,+CAA+C;IAC/C,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;gCAC4B;IAC5B,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAAA;AAaH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,EACJ,SAAS,EACT,KAAK,EACL,UAAU,GACX,EAAE,eAAe,+BAkDjB"}
1
+ {"version":3,"file":"empty-state.d.ts","sourceRoot":"","sources":["../../src/dashboard/empty-state.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAEnF,oGAAoG;AACpG,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,QAAQ,CAAA;AAEjF,MAAM,MAAM,eAAe,GAAG,WAAW,GACvC,cAAc,GACd,eAAe,CAAC,cAAc,CAAC,GAAG;IAChC,uFAAuF;IACvF,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,kHAAkH;IAClH,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB;0GACsG;IACtG,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAC1B,CAAA;AAaH,wBAAgB,UAAU,CAAC,EACzB,IAAI,EACJ,KAAK,EACL,WAAW,EACX,MAAM,EACN,IAAI,EACJ,SAAS,EACT,KAAK,EACL,UAAU,EACV,GAAG,IAAI,EACR,EAAE,eAAe,+BA0DjB"}
@@ -1,7 +1,7 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { Center, Stack } from "@mantine/core";
3
- import { VX } from "../tokens/index.js";
4
- import { cx } from "../common/props.js";
3
+ import { VX, alpha } from "../tokens/index.js";
4
+ import { cx, pickDataAttributes } from "../common/props.js";
5
5
  const STACK_XS = "var(--vx-space-stack-xs, 0.25rem)";
6
6
  const PAGE_PADDING_Y = `calc(${STACK_XS} * 16)`;
7
7
  const PAGE_PADDING_X = `calc(${STACK_XS} * 6)`;
@@ -15,18 +15,28 @@ function EmptyState({
15
15
  tier,
16
16
  className,
17
17
  style,
18
- classNames
18
+ classNames,
19
+ ...rest
19
20
  }) {
20
21
  const resolved = tier ?? "page";
21
22
  return /* @__PURE__ */ jsxs(
22
23
  Stack,
23
24
  {
25
+ ...pickDataAttributes(rest),
24
26
  align: "center",
25
27
  gap: "xs",
26
28
  className: cx(classNames?.root, className),
27
29
  style: {
28
30
  padding: resolved === "page" ? `${PAGE_PADDING_Y} ${PAGE_PADDING_X}` : `${SECTION_PADDING_Y} ${SECTION_PADDING_X}`,
29
31
  textAlign: "center",
32
+ // The section tile: one ring (a shadow, never a border), card radius. The ring is a neutral
33
+ // tint, not the card hairline: the tile sits on the page or a panel, and the hairline (a card
34
+ // edge on a white card) vanishes on the grey page in light.
35
+ ...resolved === "section" && {
36
+ // theme-allow surface-shadow-override — an inset ring on a tile inside a surface, not a card's depth
37
+ boxShadow: `inset 0 0 0 1px ${alpha(VX.neutral, 0.25)}`,
38
+ borderRadius: "var(--vx-radius-card)"
39
+ },
30
40
  ...style
31
41
  },
32
42
  children: [
@@ -45,10 +55,9 @@ function EmptyState({
45
55
  {
46
56
  className: classNames?.title,
47
57
  style: {
48
- fontFamily: "var(--basalt-font-head)",
49
- fontStretch: "88%",
50
- fontSize: VX.text.xl,
51
- fontWeight: 550,
58
+ // A section tile never out-sizes its host's own title (`sm`); the page tier has none and keeps `md`.
59
+ fontSize: resolved === "section" ? VX.text.sm : VX.text.md,
60
+ fontWeight: 500,
52
61
  color: VX.ink
53
62
  },
54
63
  children: title
@@ -59,7 +68,7 @@ function EmptyState({
59
68
  "span",
60
69
  {
61
70
  className: classNames?.description,
62
- style: { fontSize: VX.text.md, color: VX.muted, maxWidth: "22.5rem" },
71
+ style: { fontSize: VX.text.sm, color: VX.muted, maxWidth: "22.5rem" },
63
72
  children: description
64
73
  }
65
74
  ),
@@ -0,0 +1,54 @@
1
+ /**
2
+ * `EventList`'s pure half: day grouping and the labels. Local-time day boundaries, the caller's
3
+ * order kept (a group is a run of adjacent items on one local day, never a re-sort).
4
+ */
5
+ import type { ReactNode } from 'react';
6
+ export type EventTimeMode = 'clock' | 'relative' | 'date-time' | ((at: Date) => string);
7
+ export declare const toEventDate: (at: Date | number) => Date;
8
+ export declare const isValidEventDate: (at: Date) => boolean;
9
+ /** Local calendar day, `YYYY-MM-DD`. */
10
+ export declare function dayKey(at: Date): string;
11
+ export type EventGroup<T extends {
12
+ readonly at: Date | number;
13
+ }> = {
14
+ readonly day: Date;
15
+ /** The local day, `YYYY-MM-DD`, or `invalid` for a list with no real instant. */
16
+ readonly key: string;
17
+ /** `key` plus the run's occurrence, so a same-day prepend keeps every group's identity. */
18
+ readonly id: string;
19
+ readonly items: readonly T[];
20
+ };
21
+ /**
22
+ * Runs of adjacent items on one local day, in the order given. An item whose `at` is invalid has no
23
+ * day of its own: it joins the run before it, or (leading) the first real run that follows. A list
24
+ * with no real instant at all is one group on an invalid day, which renders without a header.
25
+ */
26
+ export declare function groupByDay<T extends {
27
+ readonly at: Date | number;
28
+ }>(items: readonly T[]): EventGroup<T>[];
29
+ /** `Today`, `Yesterday`, else `Wed, Sep 2, 2026`. With no clock yet (the server render) always the date. */
30
+ export declare function defaultDayLabel(day: Date, now: Date | null): string;
31
+ export declare function formatEventTime(at: Date, mode: EventTimeMode, now: Date | null): string;
32
+ /** What every row (real or skeleton) shares: the list's density, rail, lead column, time mode and "now". */
33
+ export type RowContext = {
34
+ readonly density: 'feed' | 'timeline';
35
+ readonly rail: boolean;
36
+ readonly lead: boolean;
37
+ readonly timeMode: EventTimeMode;
38
+ /** `null` until the client clock is read (the server render and the hydrating paint). */
39
+ readonly now: Date | null;
40
+ };
41
+ /** `null`, `undefined`, booleans and the empty string render nothing, so they are not content. */
42
+ export declare const present: (node: ReactNode) => boolean;
43
+ /** Skeleton rows while loading, shared by `EventList` and `BarList`: an explicit `loadingRows`, else the
44
+ * rows held now (a refetch), capped at 30, else 5 (a cold load has no count to keep). */
45
+ export declare const skeletonRowCount: (loadingRows: number | undefined, held: number) => number;
46
+ /** The data attributes a row (real or skeleton) carries; the CSS keys on them. */
47
+ export declare function rowAttributes(ctx: RowContext, first: boolean, last: boolean): {
48
+ 'data-density': "feed" | "timeline";
49
+ 'data-lead': string | undefined;
50
+ 'data-rail': string | undefined;
51
+ 'data-first': string | undefined;
52
+ 'data-last': string | undefined;
53
+ };
54
+ //# sourceMappingURL=event-list-model.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-list-model.d.ts","sourceRoot":"","sources":["../../src/dashboard/event-list-model.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,CAAC,CAAC,EAAE,EAAE,IAAI,KAAK,MAAM,CAAC,CAAA;AAEvF,eAAO,MAAM,WAAW,GAAI,IAAI,IAAI,GAAG,MAAM,KAAG,IAAgD,CAAA;AAEhG,eAAO,MAAM,gBAAgB,GAAI,IAAI,IAAI,KAAG,OAAwC,CAAA;AAKpF,wCAAwC;AACxC,wBAAgB,MAAM,CAAC,EAAE,EAAE,IAAI,GAAG,MAAM,CAIvC;AAED,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,IAAI;IACjE,QAAQ,CAAC,GAAG,EAAE,IAAI,CAAA;IAClB,iFAAiF;IACjF,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,2FAA2F;IAC3F,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,CAAA;CAC7B,CAAA;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,IAAI,GAAG,MAAM,CAAA;CAAE,EACjE,KAAK,EAAE,SAAS,CAAC,EAAE,GAClB,UAAU,CAAC,CAAC,CAAC,EAAE,CA0BjB;AAED,4GAA4G;AAC5G,wBAAgB,eAAe,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CASnE;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,GAAG,MAAM,CAQvF;AAED,4GAA4G;AAC5G,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,CAAA;IACrC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAA;IACtB,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAA;IAChC,yFAAyF;IACzF,QAAQ,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAA;CAC1B,CAAA;AAED,kGAAkG;AAClG,eAAO,MAAM,OAAO,GAAI,MAAM,SAAS,KAAG,OAKK,CAAA;AAK/C;yFACyF;AACzF,eAAO,MAAM,gBAAgB,GAAI,aAAa,MAAM,GAAG,SAAS,EAAE,MAAM,MAAM,KAAG,MACM,CAAA;AAEvF,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO;;;;;;EAQ3E"}
@@ -0,0 +1,76 @@
1
+ import { date, dateTime, relativeTime, time, weekday } from "../format/index.js";
2
+ const toEventDate = (at) => at instanceof Date ? at : new Date(at);
3
+ const isValidEventDate = (at) => Number.isFinite(at.getTime());
4
+ const NO_TIME = "\u2014";
5
+ function dayKey(at) {
6
+ const month = String(at.getMonth() + 1).padStart(2, "0");
7
+ const day = String(at.getDate()).padStart(2, "0");
8
+ return `${at.getFullYear()}-${month}-${day}`;
9
+ }
10
+ function groupByDay(items) {
11
+ const runs = [];
12
+ const leading = [];
13
+ for (const item of items) {
14
+ const at = toEventDate(item.at);
15
+ const last = runs[runs.length - 1];
16
+ if (!isValidEventDate(at)) {
17
+ if (last === void 0) leading.push(item);
18
+ else last.items.push(item);
19
+ continue;
20
+ }
21
+ const key = dayKey(at);
22
+ if (last !== void 0 && last.key === key) last.items.push(item);
23
+ else runs.push({ day: at, key, items: runs.length === 0 ? [...leading, item] : [item] });
24
+ }
25
+ if (runs.length === 0) {
26
+ return leading.length === 0 ? [] : [{ day: new Date(Number.NaN), key: "invalid", id: "invalid#0", items: leading }];
27
+ }
28
+ const seen = /* @__PURE__ */ new Map();
29
+ return runs.map((run) => {
30
+ const n = seen.get(run.key) ?? 0;
31
+ seen.set(run.key, n + 1);
32
+ return { ...run, id: `${run.key}#${n}` };
33
+ });
34
+ }
35
+ function defaultDayLabel(day, now) {
36
+ if (!isValidEventDate(day)) return NO_TIME;
37
+ if (now === null) return `${weekday(day)}, ${date(day)}`;
38
+ const key = dayKey(day);
39
+ if (key === dayKey(now)) return "Today";
40
+ const before = new Date(now);
41
+ before.setDate(before.getDate() - 1);
42
+ if (key === dayKey(before)) return "Yesterday";
43
+ return `${weekday(day)}, ${date(day)}`;
44
+ }
45
+ function formatEventTime(at, mode, now) {
46
+ if (!isValidEventDate(at)) return NO_TIME;
47
+ if (typeof mode === "function") return mode(at);
48
+ if (mode === "relative" && now !== null) return relativeTime(at, { now: now.getTime() });
49
+ if (mode === "relative") return dateTime(at, { format: "short" });
50
+ if (mode === "date-time") return dateTime(at, { format: "short" });
51
+ return time(at, { format: "short" });
52
+ }
53
+ const present = (node) => node !== void 0 && node !== null && typeof node !== "boolean" && node !== "" && !(Array.isArray(node) && !node.some(present));
54
+ const SKELETON_DEFAULT_ROWS = 5;
55
+ const SKELETON_MAX_ROWS = 30;
56
+ const skeletonRowCount = (loadingRows, held) => loadingRows ?? (held > 0 ? Math.min(held, SKELETON_MAX_ROWS) : SKELETON_DEFAULT_ROWS);
57
+ function rowAttributes(ctx, first, last) {
58
+ return {
59
+ "data-density": ctx.density,
60
+ "data-lead": ctx.lead ? "" : void 0,
61
+ "data-rail": ctx.rail ? "" : void 0,
62
+ "data-first": first ? "" : void 0,
63
+ "data-last": last ? "" : void 0
64
+ };
65
+ }
66
+ export {
67
+ dayKey,
68
+ defaultDayLabel,
69
+ formatEventTime,
70
+ groupByDay,
71
+ isValidEventDate,
72
+ present,
73
+ rowAttributes,
74
+ skeletonRowCount,
75
+ toEventDate
76
+ };
@@ -0,0 +1,23 @@
1
+ /** `EventList`'s row, day header and the flat rows of its windowed path. */
2
+ import type { VirtualRow } from '../common/virtual-rows.js';
3
+ import type { EventListProps } from './event-list.js';
4
+ import type { EventGroup, RowContext } from './event-list-model.js';
5
+ export type EventItem = EventListProps['items'][number];
6
+ export declare function EventRow({ item, ctx, first, last, tag: Tag, }: {
7
+ item: EventItem;
8
+ ctx: RowContext;
9
+ first: boolean;
10
+ last: boolean;
11
+ tag: 'li' | 'div';
12
+ }): import("react").JSX.Element;
13
+ /** The flat rows of the windowed path: a sticky header row per day, then its items. */
14
+ export declare function buildRows(groups: readonly EventGroup<EventItem>[], showHeaders: boolean, ctx: RowContext, headerText: (day: Date) => string): VirtualRow[];
15
+ export declare function DayHeader({ text, count, id, as: Tag, windowed, }: {
16
+ text: string;
17
+ count: number;
18
+ id?: string;
19
+ as?: 'h3' | 'div';
20
+ /** A windowed header is its own list item, its inner element a level-3 heading like the plain `<h3>`. */
21
+ windowed?: boolean;
22
+ }): import("react").JSX.Element;
23
+ //# sourceMappingURL=event-list-rows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-list-rows.d.ts","sourceRoot":"","sources":["../../src/dashboard/event-list-rows.tsx"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAExD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAQlD,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEhE,MAAM,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAA;AAEvD,wBAAgB,QAAQ,CAAC,EACvB,IAAI,EACJ,GAAG,EACH,KAAK,EACL,IAAI,EACJ,GAAG,EAAE,GAAG,GACT,EAAE;IACD,IAAI,EAAE,SAAS,CAAA;IACf,GAAG,EAAE,UAAU,CAAA;IACf,KAAK,EAAE,OAAO,CAAA;IACd,IAAI,EAAE,OAAO,CAAA;IACb,GAAG,EAAE,IAAI,GAAG,KAAK,CAAA;CAClB,+BA+BA;AAID,uFAAuF;AACvF,wBAAgB,SAAS,CACvB,MAAM,EAAE,SAAS,UAAU,CAAC,SAAS,CAAC,EAAE,EACxC,WAAW,EAAE,OAAO,EACpB,GAAG,EAAE,UAAU,EACf,UAAU,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,MAAM,GAChC,UAAU,EAAE,CAkBd;AAED,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,KAAK,EACL,EAAE,EACF,EAAE,EAAE,GAAW,EACf,QAAgB,GACjB,EAAE;IACD,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,EAAE,CAAC,EAAE,IAAI,GAAG,KAAK,CAAA;IACjB,yGAAyG;IACzG,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,+BAeA"}
@@ -0,0 +1,89 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import classes from "./event-list.module.css";
3
+ import {
4
+ formatEventTime,
5
+ isValidEventDate,
6
+ present,
7
+ rowAttributes,
8
+ toEventDate
9
+ } from "./event-list-model.js";
10
+ function EventRow({
11
+ item,
12
+ ctx,
13
+ first,
14
+ last,
15
+ tag: Tag
16
+ }) {
17
+ const at = toEventDate(item.at);
18
+ const valid = isValidEventDate(at);
19
+ const stamp = formatEventTime(at, ctx.timeMode, ctx.now);
20
+ return /* @__PURE__ */ jsxs(
21
+ Tag,
22
+ {
23
+ className: classes.row,
24
+ role: Tag === "div" ? "listitem" : void 0,
25
+ "data-event-id": item.id,
26
+ "data-untimed": stamp === "" ? "" : void 0,
27
+ ...rowAttributes(ctx, first, last),
28
+ children: [
29
+ ctx.lead && /* @__PURE__ */ jsx("span", { className: classes.leading, children: item.leading }),
30
+ /* @__PURE__ */ jsxs("span", { className: classes.line, children: [
31
+ present(item.actor) && /* @__PURE__ */ jsxs("span", { className: classes.actor, children: [
32
+ item.actor,
33
+ " "
34
+ ] }),
35
+ item.title
36
+ ] }),
37
+ stamp !== "" && /* @__PURE__ */ jsx("time", { className: classes.time, ...valid && { dateTime: at.toISOString() }, children: stamp }),
38
+ present(item.body) && /* @__PURE__ */ jsx("div", { className: classes.meta, children: /* @__PURE__ */ jsx("span", { className: classes.body, children: item.body }) }),
39
+ present(item.chips) && /* @__PURE__ */ jsx("div", { className: classes.chips, children: item.chips })
40
+ ]
41
+ }
42
+ );
43
+ }
44
+ const countLabel = (n) => `\xB7 ${n} ${n === 1 ? "event" : "events"}`;
45
+ function buildRows(groups, showHeaders, ctx, headerText) {
46
+ return groups.flatMap((g) => {
47
+ const itemRows = g.items.map((item, i) => ({
48
+ key: `item:${item.id}`,
49
+ node: /* @__PURE__ */ jsx(EventRow, { item, ctx, first: i === 0, last: i === g.items.length - 1, tag: "div" })
50
+ }));
51
+ if (!showHeaders) return itemRows;
52
+ return [
53
+ {
54
+ key: `day:${g.id}`,
55
+ sticky: true,
56
+ node: /* @__PURE__ */ jsx(DayHeader, { text: headerText(g.day), count: g.items.length, windowed: true })
57
+ },
58
+ ...itemRows
59
+ ];
60
+ });
61
+ }
62
+ function DayHeader({
63
+ text,
64
+ count,
65
+ id,
66
+ as: Tag = "div",
67
+ windowed = false
68
+ }) {
69
+ const header = /* @__PURE__ */ jsxs(
70
+ Tag,
71
+ {
72
+ id,
73
+ "data-day-header": "",
74
+ ...windowed && { role: "heading", "aria-level": 3 },
75
+ className: classes.header,
76
+ children: [
77
+ text,
78
+ /* @__PURE__ */ jsx("span", { className: classes.count, children: countLabel(count) })
79
+ ]
80
+ }
81
+ );
82
+ if (!windowed) return header;
83
+ return /* @__PURE__ */ jsx("div", { role: "listitem", children: header });
84
+ }
85
+ export {
86
+ DayHeader,
87
+ EventRow,
88
+ buildRows
89
+ };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * The list's own scroll node keeps the visible row across a prepend: the count grew and the old
3
+ * first id is still in the list, so the height delta goes onto `scrollTop`. Memory resets whenever
4
+ * there is nothing to anchor (disabled, no rows, node absent), so a reload is never read as a
5
+ * prepend. The node sets `overflow-anchor: none` so the browser cannot add the same delta twice.
6
+ */
7
+ export declare function usePrependAnchor(node: HTMLElement | null, enabled: boolean, items: readonly {
8
+ readonly id: string;
9
+ }[]): void;
10
+ /**
11
+ * An oldest-first list with its own scroll node opens on the newest end — and keeps opening there
12
+ * while the layout is still settling (fonts, the narrow time move, wrapping grow `scrollHeight`
13
+ * after the first jump), until the user touches it, the item count changes (an `earlier` load), or
14
+ * a few seconds pass. Plain path only: the windowed seam opens itself with `initialScroll`.
15
+ */
16
+ export declare function useOpenAtEnd(node: HTMLElement | null, active: boolean, count: number): void;
17
+ /**
18
+ * How far the box must be shorter for its newest end to open on a row boundary: with a sticky day
19
+ * header stuck at the top, the row beneath its lower edge is cut across its first line. Trimming the
20
+ * box by that row's remainder hides it entirely, so the first row in view is whole and the last row
21
+ * still ends on the box's floor. Pure of the current trim (it adds it back), so it settles in one
22
+ * step. 0 when no header is stuck or nothing is cut.
23
+ */
24
+ export declare function rowBoundaryTrim(el: HTMLElement, content: Element, current: number): number;
25
+ /**
26
+ * Keeps `--event-list-trim` on the scroll node at `rowBoundaryTrim` (the box subtracts it from its
27
+ * height) while an oldest-first box opens on its newest end; cleared otherwise.
28
+ */
29
+ export declare function useRowBoundary(node: HTMLElement | null, active: boolean): void;
30
+ /**
31
+ * How many plain rows sit above and below what the box shows (a row not wholly in view counts), measured
32
+ * under the stuck day header. Windowed rows (the seam) are a slice of the list, so they have no count.
33
+ */
34
+ export declare function rowsOutOfView(el: HTMLElement): {
35
+ above: number;
36
+ below: number;
37
+ };
38
+ /**
39
+ * Marks the scroll node `data-scrolled` while it is off the top (CSS lifts the sticky day header) and
40
+ * `data-more` while content remains below the fold (CSS paints a bottom fade), so a clipped last row
41
+ * is never silent. `data-above` / `data-below` carry how many rows are out of view each way: CSS names
42
+ * them ("1 above" at the top edge, "2 below" at the bottom; "earlier" stays the load control's word) so a cut row has a cue, not only a fade.
43
+ */
44
+ export declare function useScrolledEdge(node: HTMLElement | null): void;
45
+ /**
46
+ * While rows are plain DOM the content height is kept on the node as `--event-list-held`; the
47
+ * windowed wrapper takes it as a minimum height, so swapping plain rows for the lazy seam never
48
+ * collapses the scroller (the browser would clamp `scrollTop` to 0 before the peer resolves). It is
49
+ * only for that handoff: it is released as soon as the windowed rows have rendered (their height is
50
+ * measured into `--event-list-last` first), and whenever there are no rows, so a shorter list never
51
+ * leaves blank space below its last row. `loading` leaves both untouched: the skeleton takes
52
+ * `--event-list-held`, else `--event-list-last`, as its minimum height, so a refetch keeps the box.
53
+ */
54
+ export declare function useHeldHeight(node: HTMLElement | null, mode: 'plain' | 'windowed' | 'loading' | 'none'): void;
55
+ //# sourceMappingURL=event-list-scroll.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-list-scroll.d.ts","sourceRoot":"","sources":["../../src/dashboard/event-list-scroll.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,GACxC,IAAI,CAsBN;AAQD;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAuC3F;AAID;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAqB1F;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,CA0B9E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,WAAW,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAiB/E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAyD9D;AAKD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,WAAW,GAAG,IAAI,EACxB,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,GAAG,MAAM,GAC9C,IAAI,CA0BN"}
@@ -0,0 +1,216 @@
1
+ import { useEffect, useRef } from "react";
2
+ import { useIsomorphicLayoutEffect } from "../common/isomorphic-layout-effect.js";
3
+ function usePrependAnchor(node, enabled, items) {
4
+ const prev = useRef(null);
5
+ const firstId = items[0]?.id;
6
+ const count = items.length;
7
+ useIsomorphicLayoutEffect(() => {
8
+ const root = enabled ? node : null;
9
+ if (root === null || firstId === void 0) {
10
+ prev.current = null;
11
+ return;
12
+ }
13
+ const before = prev.current;
14
+ if (before !== null && before.firstId !== firstId && count > before.count && items.some((item) => item.id === before.firstId)) {
15
+ root.scrollTop += root.scrollHeight - before.scrollHeight;
16
+ }
17
+ prev.current = { firstId, count, scrollHeight: root.scrollHeight };
18
+ });
19
+ }
20
+ const USER_INPUT = ["wheel", "touchstart", "pointerdown", "keydown"];
21
+ const OPEN_AT_END_MS = 3e3;
22
+ function useOpenAtEnd(node, active, count) {
23
+ const latest = useRef(count);
24
+ useIsomorphicLayoutEffect(() => {
25
+ if (node === null || !active) return;
26
+ const el = node;
27
+ el.scrollTo({ top: el.scrollHeight, behavior: "instant" });
28
+ }, [node, active]);
29
+ useIsomorphicLayoutEffect(() => {
30
+ latest.current = count;
31
+ });
32
+ useEffect(() => {
33
+ if (node === null || !active) return;
34
+ const opened = latest.current;
35
+ const el = node;
36
+ let stopped = false;
37
+ const toEnd = () => {
38
+ el.scrollTo({ top: el.scrollHeight, behavior: "instant" });
39
+ };
40
+ const reapply = () => {
41
+ if (stopped) return;
42
+ if (latest.current === opened) toEnd();
43
+ else stop();
44
+ };
45
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(reapply);
46
+ const timer = setTimeout(() => stop(), OPEN_AT_END_MS);
47
+ function stop() {
48
+ stopped = true;
49
+ observer?.disconnect();
50
+ clearTimeout(timer);
51
+ for (const type of USER_INPUT) el.removeEventListener(type, stop);
52
+ }
53
+ for (const type of USER_INPUT) el.addEventListener(type, stop, { passive: true });
54
+ observer?.observe(el);
55
+ if (el.firstElementChild !== null) observer?.observe(el.firstElementChild);
56
+ toEnd();
57
+ void document.fonts?.ready?.then(reapply);
58
+ return stop;
59
+ }, [node, active]);
60
+ }
61
+ const TRIM = "--event-list-trim";
62
+ function rowBoundaryTrim(el, content, current) {
63
+ const header = content.querySelector("[data-day-header]");
64
+ if (header === null) return 0;
65
+ const origin = content.getBoundingClientRect().top;
66
+ const rel = (e, edge) => e.getBoundingClientRect()[edge] - origin;
67
+ const end = el.scrollHeight - (el.clientHeight + current);
68
+ const stuck = Array.from(content.querySelectorAll("[data-day-header]")).some(
69
+ (h) => h.parentElement !== null && rel(h.parentElement, "top") < end - 0.5
70
+ );
71
+ if (!stuck) return 0;
72
+ const cut = end + header.offsetHeight;
73
+ for (const row of content.querySelectorAll("[data-event-id]")) {
74
+ const [top, bottom] = [rel(row, "top"), rel(row, "bottom")];
75
+ if (top >= cut - 0.5 || bottom <= cut + 0.5) continue;
76
+ if (cut - top <= Number.parseFloat(getComputedStyle(row).paddingTop)) return 0;
77
+ return bottom - cut;
78
+ }
79
+ return 0;
80
+ }
81
+ function useRowBoundary(node, active) {
82
+ useIsomorphicLayoutEffect(() => {
83
+ const content = node?.firstElementChild;
84
+ if (node === null || content === null || content === void 0 || !active) return;
85
+ const el = node;
86
+ let disposed = false;
87
+ const run = () => {
88
+ if (disposed) return;
89
+ const current = Number.parseFloat(el.style.getPropertyValue(TRIM)) || 0;
90
+ const untrimmed = el.clientHeight + current;
91
+ const next = Math.min(rowBoundaryTrim(el, content, current), untrimmed / 2);
92
+ if (Math.abs(next - current) < 1.5) return;
93
+ el.style.setProperty(TRIM, `${next}px`);
94
+ };
95
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(run);
96
+ observer?.observe(content);
97
+ observer?.observe(el);
98
+ run();
99
+ void document.fonts?.ready?.then(run);
100
+ return () => {
101
+ disposed = true;
102
+ observer?.disconnect();
103
+ el.style.removeProperty(TRIM);
104
+ };
105
+ }, [node, active]);
106
+ }
107
+ function rowsOutOfView(el) {
108
+ const rows = el.querySelectorAll("[data-event-id]");
109
+ if (rows.length === 0 || el.querySelector("[data-index]") !== null) return { above: 0, below: 0 };
110
+ const box = el.getBoundingClientRect();
111
+ const stuck = Array.from(el.querySelectorAll("[data-day-header]")).findLast(
112
+ (h) => h.getBoundingClientRect().top <= box.top + 1
113
+ );
114
+ const top = box.top + (stuck?.getBoundingClientRect().height ?? 0);
115
+ let above = 0;
116
+ let below = 0;
117
+ for (const row of rows) {
118
+ const rect = row.getBoundingClientRect();
119
+ if (rect.top < top - 1) above += 1;
120
+ else if (rect.bottom > box.bottom + 1) below += 1;
121
+ }
122
+ return { above, below };
123
+ }
124
+ function useScrolledEdge(node) {
125
+ useEffect(() => {
126
+ if (node === null) return;
127
+ const el = node;
128
+ const flag = (name, on) => {
129
+ if (on === el.hasAttribute(name)) return;
130
+ if (on) el.setAttribute(name, "");
131
+ else el.removeAttribute(name);
132
+ };
133
+ const flags = () => {
134
+ flag("data-scrolled", el.scrollTop > 0);
135
+ flag("data-more", el.scrollHeight - el.scrollTop - el.clientHeight > 1);
136
+ };
137
+ const counts = () => {
138
+ const { above, below } = rowsOutOfView(el);
139
+ for (const [name, count] of [
140
+ ["data-above", above],
141
+ ["data-below", below]
142
+ ]) {
143
+ if (count === 0) el.removeAttribute(name);
144
+ else if (el.getAttribute(name) !== String(count)) el.setAttribute(name, String(count));
145
+ }
146
+ };
147
+ const mark = () => {
148
+ flags();
149
+ counts();
150
+ };
151
+ mark();
152
+ let frame = 0;
153
+ const onScroll = () => {
154
+ flags();
155
+ if (frame !== 0) return;
156
+ frame = requestAnimationFrame(() => {
157
+ frame = 0;
158
+ counts();
159
+ });
160
+ };
161
+ el.addEventListener("scroll", onScroll, { passive: true });
162
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(mark);
163
+ observer?.observe(el);
164
+ const content = el.firstElementChild;
165
+ if (content !== null) observer?.observe(content);
166
+ const swaps = typeof MutationObserver === "undefined" ? null : new MutationObserver(mark);
167
+ if (content !== null) swaps?.observe(content, { childList: true });
168
+ return () => {
169
+ cancelAnimationFrame(frame);
170
+ el.removeEventListener("scroll", onScroll);
171
+ observer?.disconnect();
172
+ swaps?.disconnect();
173
+ el.removeAttribute("data-scrolled");
174
+ el.removeAttribute("data-more");
175
+ el.removeAttribute("data-above");
176
+ el.removeAttribute("data-below");
177
+ };
178
+ }, [node]);
179
+ }
180
+ const HELD = "--event-list-held";
181
+ const LAST = "--event-list-last";
182
+ function useHeldHeight(node, mode) {
183
+ useEffect(() => {
184
+ const content = node?.firstElementChild;
185
+ if (node === null || content === null || content === void 0) return;
186
+ const el = node;
187
+ if (mode === "loading") return;
188
+ if (mode === "none") {
189
+ el.style.removeProperty(HELD);
190
+ el.style.removeProperty(LAST);
191
+ return;
192
+ }
193
+ const observer = typeof ResizeObserver === "undefined" ? null : new ResizeObserver(() => run());
194
+ function run() {
195
+ if (mode === "plain") {
196
+ el.style.setProperty(HELD, `${content?.getBoundingClientRect().height ?? 0}px`);
197
+ } else if (observer === null || content?.querySelector("[data-index]") !== null) {
198
+ el.style.setProperty(LAST, `${content?.getBoundingClientRect().height ?? 0}px`);
199
+ el.style.removeProperty(HELD);
200
+ observer?.disconnect();
201
+ }
202
+ }
203
+ observer?.observe(content);
204
+ run();
205
+ return () => observer?.disconnect();
206
+ }, [node, mode]);
207
+ }
208
+ export {
209
+ rowBoundaryTrim,
210
+ rowsOutOfView,
211
+ useHeldHeight,
212
+ useOpenAtEnd,
213
+ usePrependAnchor,
214
+ useRowBoundary,
215
+ useScrolledEdge
216
+ };