basalt-ui 2.27.2 → 2.28.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 (238) hide show
  1. package/CHANGELOG.md +99 -0
  2. package/MIGRATING.md +168 -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-design/SKILL.md +1 -1
  7. package/agent/skills/basalt-design/references/catalogue.md +40 -36
  8. package/agent/skills/basalt-design/references/recipes.md +47 -0
  9. package/configs/oxlint-basalt.json +2 -1
  10. package/configs/oxlint-plugin.js +110 -2
  11. package/configs/oxlint-plugin.test.ts +99 -4
  12. package/dist/agent/chat/thread-message.d.ts +1 -160
  13. package/dist/agent/chat/thread-message.d.ts.map +1 -1
  14. package/dist/agent/chat/thread-message.js +7 -162
  15. package/dist/agent/chat/virtualize.d.ts +5 -5
  16. package/dist/charts/ChartCard.d.ts +5 -2
  17. package/dist/charts/ChartCard.d.ts.map +1 -1
  18. package/dist/charts/ChartCard.js +46 -13
  19. package/dist/charts/Lines.d.ts.map +1 -1
  20. package/dist/charts/Lines.js +11 -4
  21. package/dist/charts/Sparkline.d.ts +9 -2
  22. package/dist/charts/Sparkline.d.ts.map +1 -1
  23. package/dist/charts/Sparkline.js +104 -41
  24. package/dist/charts/chart-box.module.css +50 -0
  25. package/dist/charts/chart-box.module.css.d.ts +5 -0
  26. package/dist/charts/chart-card.module.css +12 -4
  27. package/dist/charts/chart-card.module.css.d.ts +1 -0
  28. package/dist/charts/compile.d.ts.map +1 -1
  29. package/dist/charts/compile.js +20 -18
  30. package/dist/charts/labels.d.ts +13 -3
  31. package/dist/charts/labels.d.ts.map +1 -1
  32. package/dist/charts/labels.js +131 -20
  33. package/dist/charts/legend.d.ts.map +1 -1
  34. package/dist/charts/legend.js +1 -1
  35. package/dist/charts/ref-label.d.ts +31 -8
  36. package/dist/charts/ref-label.d.ts.map +1 -1
  37. package/dist/charts/ref-label.js +40 -9
  38. package/dist/charts/sparkline.module.css +6 -0
  39. package/dist/charts/state.d.ts +3 -3
  40. package/dist/charts/state.d.ts.map +1 -1
  41. package/dist/charts/state.js +20 -2
  42. package/dist/cli/shot/capture.d.ts +6 -1
  43. package/dist/cli/shot/capture.d.ts.map +1 -1
  44. package/dist/cli/shot/capture.js +18 -5
  45. package/dist/common/empty-copy.d.ts +16 -0
  46. package/dist/common/empty-copy.d.ts.map +1 -0
  47. package/dist/common/empty-copy.js +9 -0
  48. package/dist/common/virtual-rows.d.ts +196 -0
  49. package/dist/common/virtual-rows.d.ts.map +1 -0
  50. package/dist/common/virtual-rows.js +290 -0
  51. package/dist/controls/controls.module.css +33 -1
  52. package/dist/controls/controls.module.css.d.ts +2 -0
  53. package/dist/controls/enum-filter.d.ts.map +1 -1
  54. package/dist/controls/enum-filter.js +8 -2
  55. package/dist/controls/filter-pill.d.ts +27 -3
  56. package/dist/controls/filter-pill.d.ts.map +1 -1
  57. package/dist/controls/filter-pill.js +15 -4
  58. package/dist/controls/form-layout.d.ts +9 -3
  59. package/dist/controls/form-layout.d.ts.map +1 -1
  60. package/dist/controls/form-layout.js +74 -12
  61. package/dist/controls/form-layout.module.css +112 -7
  62. package/dist/controls/form-layout.module.css.d.ts +1 -0
  63. package/dist/controls/multi-select-filter.d.ts +2 -2
  64. package/dist/controls/multi-select-filter.d.ts.map +1 -1
  65. package/dist/controls/multi-select-filter.js +12 -6
  66. package/dist/controls/range-filter.d.ts +1 -1
  67. package/dist/controls/range-filter.d.ts.map +1 -1
  68. package/dist/controls/range-filter.js +8 -2
  69. package/dist/dashboard/bar-list.d.ts +1 -1
  70. package/dist/dashboard/bar-list.d.ts.map +1 -1
  71. package/dist/dashboard/bar-list.js +6 -2
  72. package/dist/dashboard/bar-list.module.css +0 -2
  73. package/dist/dashboard/board-nav.d.ts +22 -0
  74. package/dist/dashboard/board-nav.d.ts.map +1 -0
  75. package/dist/dashboard/board-nav.js +49 -0
  76. package/dist/dashboard/board.d.ts +52 -0
  77. package/dist/dashboard/board.d.ts.map +1 -0
  78. package/dist/dashboard/board.js +228 -0
  79. package/dist/dashboard/board.module.css +160 -0
  80. package/dist/dashboard/board.module.css.d.ts +26 -0
  81. package/dist/dashboard/empty-state.d.ts +3 -3
  82. package/dist/dashboard/empty-state.d.ts.map +1 -1
  83. package/dist/dashboard/empty-state.js +13 -6
  84. package/dist/dashboard/event-list-model.d.ts +51 -0
  85. package/dist/dashboard/event-list-model.d.ts.map +1 -0
  86. package/dist/dashboard/event-list-model.js +72 -0
  87. package/dist/dashboard/event-list-rows.d.ts +23 -0
  88. package/dist/dashboard/event-list-rows.d.ts.map +1 -0
  89. package/dist/dashboard/event-list-rows.js +93 -0
  90. package/dist/dashboard/event-list-scroll.d.ts +27 -0
  91. package/dist/dashboard/event-list-scroll.d.ts.map +1 -0
  92. package/dist/dashboard/event-list-scroll.js +103 -0
  93. package/dist/dashboard/event-list-skeleton.d.ts +10 -0
  94. package/dist/dashboard/event-list-skeleton.d.ts.map +1 -0
  95. package/dist/dashboard/event-list-skeleton.js +36 -0
  96. package/dist/dashboard/event-list.d.ts +65 -0
  97. package/dist/dashboard/event-list.d.ts.map +1 -0
  98. package/dist/dashboard/event-list.js +178 -0
  99. package/dist/dashboard/event-list.module.css +283 -0
  100. package/dist/dashboard/event-list.module.css.d.ts +33 -0
  101. package/dist/dashboard/index.d.ts +2 -0
  102. package/dist/dashboard/index.d.ts.map +1 -1
  103. package/dist/dashboard/index.js +4 -0
  104. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  105. package/dist/dashboard/meter-parts.js +5 -3
  106. package/dist/dashboard/meter.module.css +2 -1
  107. package/dist/dashboard/query-state.js +1 -1
  108. package/dist/dashboard/settings-section.d.ts +4 -1
  109. package/dist/dashboard/settings-section.d.ts.map +1 -1
  110. package/dist/dashboard/settings-section.js +1 -1
  111. package/dist/dashboard/settings-section.module.css +19 -4
  112. package/dist/dashboard/stat-card-parts.d.ts +5 -1
  113. package/dist/dashboard/stat-card-parts.d.ts.map +1 -1
  114. package/dist/dashboard/stat-card-parts.js +8 -3
  115. package/dist/dashboard/stat-card.d.ts.map +1 -1
  116. package/dist/dashboard/stat-card.js +25 -6
  117. package/dist/dashboard/stat-card.module.css +31 -7
  118. package/dist/dashboard/stat-card.module.css.d.ts +3 -0
  119. package/dist/dashboard/stat-strip.module.css +4 -1
  120. package/dist/dashboard/widget-header.module.css +17 -1
  121. package/dist/guard/index.d.ts.map +1 -1
  122. package/dist/guard/index.js +2 -0
  123. package/dist/index.d.ts +1 -1
  124. package/dist/index.d.ts.map +1 -1
  125. package/dist/index.js +4 -0
  126. package/dist/shell/app-main.module.css +18 -0
  127. package/dist/styles.css +46 -0
  128. package/dist/surfaces.d.ts +2 -2
  129. package/dist/surfaces.d.ts.map +1 -1
  130. package/dist/surfaces.js +8 -2
  131. package/dist/table/cell-kinds.d.ts +44 -0
  132. package/dist/table/cell-kinds.d.ts.map +1 -0
  133. package/dist/table/cell-kinds.js +169 -0
  134. package/dist/table/cell-kinds.module.css +55 -0
  135. package/dist/table/cell-kinds.module.css.d.ts +15 -0
  136. package/dist/table/data-table-fold.d.ts +147 -0
  137. package/dist/table/data-table-fold.d.ts.map +1 -0
  138. package/dist/table/data-table-fold.js +288 -0
  139. package/dist/table/data-table-state.d.ts +10 -3
  140. package/dist/table/data-table-state.d.ts.map +1 -1
  141. package/dist/table/data-table-state.js +11 -6
  142. package/dist/table/data-table.d.ts +11 -26
  143. package/dist/table/data-table.d.ts.map +1 -1
  144. package/dist/table/data-table.js +354 -254
  145. package/dist/table/data-table.module.css +210 -3
  146. package/dist/table/data-table.module.css.d.ts +12 -0
  147. package/dist/table/table-features.d.ts +34 -4
  148. package/dist/table/table-features.d.ts.map +1 -1
  149. package/dist/table/table-features.js +10 -0
  150. package/dist/theme/card-inset.module.css +35 -0
  151. package/dist/theme/controls.module.css +32 -0
  152. package/dist/theme/ctl-theme.d.ts.map +1 -1
  153. package/dist/theme/ctl-theme.js +5 -0
  154. package/dist/theme/index.d.ts.map +1 -1
  155. package/dist/theme/index.js +14 -10
  156. package/dist/tokens/core.d.ts +1 -0
  157. package/dist/tokens/core.d.ts.map +1 -1
  158. package/dist/tokens/core.js +1 -0
  159. package/dist/tokens/derive.js +1 -1
  160. package/dist/tokens/palette.d.ts +2 -1
  161. package/dist/tokens/palette.d.ts.map +1 -1
  162. package/llms.txt +34 -5
  163. package/package.json +1 -1
  164. package/src/agent/chat/thread-message.tsx +10 -403
  165. package/src/agent/chat/virtualize.ts +5 -5
  166. package/src/charts/ChartCard.tsx +79 -17
  167. package/src/charts/Lines.tsx +13 -4
  168. package/src/charts/Sparkline.tsx +131 -45
  169. package/src/charts/chart-box.module.css +50 -0
  170. package/src/charts/chart-box.module.css.d.ts +5 -0
  171. package/src/charts/chart-card.module.css +12 -4
  172. package/src/charts/chart-card.module.css.d.ts +1 -0
  173. package/src/charts/compile.ts +22 -18
  174. package/src/charts/labels.ts +175 -24
  175. package/src/charts/legend.tsx +3 -2
  176. package/src/charts/ref-label.ts +86 -17
  177. package/src/charts/sparkline.module.css +6 -0
  178. package/src/charts/state.tsx +36 -7
  179. package/src/cli/shot/capture.ts +29 -6
  180. package/src/common/empty-copy.ts +17 -0
  181. package/src/common/virtual-rows.tsx +682 -0
  182. package/src/controls/controls.module.css +33 -1
  183. package/src/controls/controls.module.css.d.ts +2 -0
  184. package/src/controls/enum-filter.tsx +8 -2
  185. package/src/controls/filter-pill.tsx +80 -27
  186. package/src/controls/form-layout.module.css +112 -7
  187. package/src/controls/form-layout.module.css.d.ts +1 -0
  188. package/src/controls/form-layout.tsx +115 -22
  189. package/src/controls/multi-select-filter.tsx +22 -11
  190. package/src/controls/range-filter.tsx +9 -3
  191. package/src/dashboard/bar-list.module.css +0 -2
  192. package/src/dashboard/bar-list.tsx +8 -5
  193. package/src/dashboard/board-nav.ts +67 -0
  194. package/src/dashboard/board.module.css +160 -0
  195. package/src/dashboard/board.module.css.d.ts +26 -0
  196. package/src/dashboard/board.tsx +394 -0
  197. package/src/dashboard/empty-state.tsx +16 -9
  198. package/src/dashboard/event-list-model.ts +113 -0
  199. package/src/dashboard/event-list-rows.tsx +120 -0
  200. package/src/dashboard/event-list-scroll.ts +145 -0
  201. package/src/dashboard/event-list-skeleton.tsx +58 -0
  202. package/src/dashboard/event-list.module.css +283 -0
  203. package/src/dashboard/event-list.module.css.d.ts +33 -0
  204. package/src/dashboard/event-list.tsx +309 -0
  205. package/src/dashboard/index.ts +2 -0
  206. package/src/dashboard/meter-parts.tsx +9 -2
  207. package/src/dashboard/meter.module.css +2 -1
  208. package/src/dashboard/query-state.tsx +1 -1
  209. package/src/dashboard/settings-section.module.css +19 -4
  210. package/src/dashboard/settings-section.tsx +7 -2
  211. package/src/dashboard/stat-card-parts.tsx +20 -3
  212. package/src/dashboard/stat-card.module.css +31 -7
  213. package/src/dashboard/stat-card.module.css.d.ts +3 -0
  214. package/src/dashboard/stat-card.tsx +24 -5
  215. package/src/dashboard/stat-strip.module.css +4 -1
  216. package/src/dashboard/widget-header.module.css +17 -1
  217. package/src/guard/index.ts +2 -0
  218. package/src/index.ts +4 -0
  219. package/src/shell/app-main.module.css +18 -0
  220. package/src/styles.css +46 -0
  221. package/src/surfaces.ts +7 -1
  222. package/src/table/cell-kinds.module.css +55 -0
  223. package/src/table/cell-kinds.module.css.d.ts +15 -0
  224. package/src/table/cell-kinds.tsx +234 -0
  225. package/src/table/data-table-fold.tsx +514 -0
  226. package/src/table/data-table-state.ts +24 -13
  227. package/src/table/data-table.module.css +210 -3
  228. package/src/table/data-table.module.css.d.ts +12 -0
  229. package/src/table/data-table.tsx +406 -359
  230. package/src/table/table-features.ts +44 -4
  231. package/src/theme/__snapshots__/plain-theme.test.ts.snap +2 -66
  232. package/src/theme/card-inset.module.css +35 -0
  233. package/src/theme/controls.module.css +32 -0
  234. package/src/theme/ctl-theme.tsx +8 -0
  235. package/src/theme/index.ts +12 -8
  236. package/src/tokens/core.ts +1 -0
  237. package/src/tokens/derive.ts +1 -1
  238. package/src/tokens/palette.ts +4 -1
@@ -0,0 +1,120 @@
1
+ /** `EventList`'s row, day header and the flat rows of its windowed path. */
2
+ import type { VirtualRow } from '../common/virtual-rows'
3
+ import classes from './event-list.module.css'
4
+ import type { EventListProps } from './event-list'
5
+ import {
6
+ formatEventTime,
7
+ isValidEventDate,
8
+ present,
9
+ rowAttributes,
10
+ toEventDate,
11
+ } from './event-list-model'
12
+ import type { EventGroup, RowContext } from './event-list-model'
13
+
14
+ export type EventItem = EventListProps['items'][number]
15
+
16
+ export function EventRow({
17
+ item,
18
+ ctx,
19
+ first,
20
+ last,
21
+ tag: Tag,
22
+ }: {
23
+ item: EventItem
24
+ ctx: RowContext
25
+ first: boolean
26
+ last: boolean
27
+ tag: 'li' | 'div'
28
+ }) {
29
+ const at = toEventDate(item.at)
30
+ const valid = isValidEventDate(at)
31
+ const stamp = formatEventTime(at, ctx.timeMode, ctx.now)
32
+ const hasMeta = present(item.body) || present(item.chips)
33
+ return (
34
+ <Tag
35
+ className={classes.row}
36
+ // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- a windowed row is a div under the seam's wrappers, never a li
37
+ role={Tag === 'div' ? 'listitem' : undefined}
38
+ data-event-id={item.id}
39
+ data-untimed={stamp === '' ? '' : undefined}
40
+ // A row whose only meta is chips and has no time: the chips join the sentence's line, not a line of their own.
41
+ data-chips-only={stamp === '' && !present(item.body) && present(item.chips) ? '' : undefined}
42
+ {...rowAttributes(ctx, first, last)}
43
+ >
44
+ {ctx.lead && <span className={classes.leading}>{item.leading}</span>}
45
+ <span className={classes.line}>
46
+ {present(item.actor) && <span className={classes.actor}>{item.actor} </span>}
47
+ {item.title}
48
+ </span>
49
+ {stamp !== '' && (
50
+ <time className={classes.time} {...(valid && { dateTime: at.toISOString() })}>
51
+ {stamp}
52
+ </time>
53
+ )}
54
+ {hasMeta && (
55
+ <div className={classes.meta}>
56
+ {present(item.body) && <span className={classes.body}>{item.body}</span>}
57
+ {present(item.chips) && <span className={classes.chips}>{item.chips}</span>}
58
+ </div>
59
+ )}
60
+ </Tag>
61
+ )
62
+ }
63
+
64
+ const countLabel = (n: number): string => `· ${n} ${n === 1 ? 'event' : 'events'}`
65
+
66
+ /** The flat rows of the windowed path: a sticky header row per day, then its items. */
67
+ export function buildRows(
68
+ groups: readonly EventGroup<EventItem>[],
69
+ showHeaders: boolean,
70
+ ctx: RowContext,
71
+ headerText: (day: Date) => string,
72
+ ): VirtualRow[] {
73
+ return groups.flatMap((g) => {
74
+ const itemRows = g.items.map((item, i) => ({
75
+ key: `item:${item.id}`,
76
+ node: (
77
+ <EventRow item={item} ctx={ctx} first={i === 0} last={i === g.items.length - 1} tag="div" />
78
+ ),
79
+ }))
80
+ if (!showHeaders) return itemRows
81
+ return [
82
+ {
83
+ key: `day:${g.id}`,
84
+ sticky: true,
85
+ node: <DayHeader text={headerText(g.day)} count={g.items.length} windowed />,
86
+ },
87
+ ...itemRows,
88
+ ]
89
+ })
90
+ }
91
+
92
+ export function DayHeader({
93
+ text,
94
+ count,
95
+ id,
96
+ as: Tag = 'div',
97
+ windowed = false,
98
+ }: {
99
+ text: string
100
+ count: number
101
+ id?: string
102
+ as?: 'h3' | 'div'
103
+ /** A windowed header is its own list item, its inner element a level-3 heading like the plain `<h3>`. */
104
+ windowed?: boolean
105
+ }) {
106
+ const header = (
107
+ <Tag
108
+ id={id}
109
+ data-day-header=""
110
+ {...(windowed && { role: 'heading', 'aria-level': 3 })}
111
+ className={classes.header}
112
+ >
113
+ {text}
114
+ <span className={classes.count}>{countLabel(count)}</span>
115
+ </Tag>
116
+ )
117
+ if (!windowed) return header
118
+ // oxlint-disable-next-line jsx-a11y/prefer-tag-over-role -- see EventRow: a windowed header is a div
119
+ return <div role="listitem">{header}</div>
120
+ }
@@ -0,0 +1,145 @@
1
+ /**
2
+ * `EventList`'s scroll behaviour: keep the visible row across a prepend, open an oldest-first box on
3
+ * its newest end while the layout settles, and mark a scrolled box so its sticky day header can lift. Every hook takes the scroll node
4
+ * as state (null until mounted) and is inert without one.
5
+ */
6
+ import { useEffect, useRef } from 'react'
7
+ import { useIsomorphicLayoutEffect } from '../common/isomorphic-layout-effect'
8
+
9
+ type AnchorMemory = { firstId: string; count: number; scrollHeight: number }
10
+
11
+ /**
12
+ * The list's own scroll node keeps the visible row across a prepend: the count grew and the old
13
+ * first id is still in the list, so the height delta goes onto `scrollTop`. Memory resets whenever
14
+ * there is nothing to anchor (disabled, no rows, node absent), so a reload is never read as a
15
+ * prepend. The node sets `overflow-anchor: none` so the browser cannot add the same delta twice.
16
+ */
17
+ export function usePrependAnchor(
18
+ node: HTMLElement | null,
19
+ enabled: boolean,
20
+ items: readonly { readonly id: string }[],
21
+ ): void {
22
+ const prev = useRef<AnchorMemory | null>(null)
23
+ const firstId = items[0]?.id
24
+ const count = items.length
25
+ // oxlint-disable-next-line react-hooks/exhaustive-deps -- every commit, by design
26
+ useIsomorphicLayoutEffect(() => {
27
+ const root = enabled ? node : null
28
+ if (root === null || firstId === undefined) {
29
+ prev.current = null
30
+ return
31
+ }
32
+ const before = prev.current
33
+ if (
34
+ before !== null &&
35
+ before.firstId !== firstId &&
36
+ count > before.count &&
37
+ items.some((item) => item.id === before.firstId)
38
+ ) {
39
+ root.scrollTop += root.scrollHeight - before.scrollHeight
40
+ }
41
+ prev.current = { firstId, count, scrollHeight: root.scrollHeight }
42
+ })
43
+ }
44
+
45
+ /** The inputs that mean the user has taken over the scroll position. */
46
+ const USER_INPUT = ['wheel', 'touchstart', 'pointerdown', 'keydown'] as const
47
+
48
+ /** How long a list that has not been touched keeps re-applying "open on the newest end". */
49
+ const OPEN_AT_END_MS = 3000
50
+
51
+ /**
52
+ * An oldest-first list with its own scroll node opens on the newest end — and keeps opening there
53
+ * while the layout is still settling (fonts, the narrow time move, wrapping grow `scrollHeight`
54
+ * after the first jump), until the user touches it, the item count changes (an `earlier` load), or
55
+ * a few seconds pass. Plain path only: the windowed seam opens itself with `initialScroll`.
56
+ */
57
+ export function useOpenAtEnd(node: HTMLElement | null, active: boolean, count: number): void {
58
+ const latest = useRef(count)
59
+ // The first jump happens before paint: no frame at the top, then a jump.
60
+ useIsomorphicLayoutEffect(() => {
61
+ if (node === null || !active) return
62
+ const el: HTMLElement = node
63
+ el.scrollTo({ top: el.scrollHeight, behavior: 'instant' })
64
+ }, [node, active])
65
+ useIsomorphicLayoutEffect(() => {
66
+ latest.current = count
67
+ })
68
+ useEffect(() => {
69
+ if (node === null || !active) return
70
+ const opened = latest.current
71
+ const el: HTMLElement = node
72
+ let stopped = false
73
+ const toEnd = (): void => {
74
+ el.scrollTo({ top: el.scrollHeight, behavior: 'instant' })
75
+ }
76
+ const reapply = (): void => {
77
+ if (stopped) return
78
+ if (latest.current === opened) toEnd()
79
+ else stop()
80
+ }
81
+ const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(reapply)
82
+ const timer = setTimeout(() => stop(), OPEN_AT_END_MS)
83
+ function stop(): void {
84
+ stopped = true
85
+ observer?.disconnect()
86
+ clearTimeout(timer)
87
+ for (const type of USER_INPUT) el.removeEventListener(type, stop)
88
+ }
89
+ for (const type of USER_INPUT) el.addEventListener(type, stop, { passive: true })
90
+ observer?.observe(el)
91
+ if (el.firstElementChild !== null) observer?.observe(el.firstElementChild)
92
+ toEnd()
93
+ void document.fonts?.ready?.then(reapply)
94
+ return stop
95
+ }, [node, active])
96
+ }
97
+
98
+ /** Marks the scroll node `data-scrolled` while it is off the top, so CSS can lift the sticky day header. */
99
+ export function useScrolledEdge(node: HTMLElement | null): void {
100
+ useEffect(() => {
101
+ if (node === null) return
102
+ const el: HTMLElement = node
103
+ const mark = (): void => {
104
+ if (el.scrollTop > 0) el.setAttribute('data-scrolled', '')
105
+ else el.removeAttribute('data-scrolled')
106
+ }
107
+ mark()
108
+ el.addEventListener('scroll', mark, { passive: true })
109
+ return () => el.removeEventListener('scroll', mark)
110
+ }, [node])
111
+ }
112
+
113
+ const HELD = '--event-list-held'
114
+
115
+ /**
116
+ * While rows are plain DOM the content height is kept on the node as `--event-list-held`; the
117
+ * windowed wrapper takes it as a minimum height, so swapping plain rows for the lazy seam never
118
+ * collapses the scroller (the browser would clamp `scrollTop` to 0 before the peer resolves). It is
119
+ * only for that handoff: it is released as soon as the windowed rows have rendered, and whenever
120
+ * there are no rows, so a shorter list never leaves blank space below its last row.
121
+ */
122
+ export function useHeldHeight(node: HTMLElement | null, mode: 'plain' | 'windowed' | 'none'): void {
123
+ useEffect(() => {
124
+ const content = node?.firstElementChild
125
+ if (node === null || content === null || content === undefined) return
126
+ const el: HTMLElement = node
127
+ if (mode === 'none') {
128
+ el.style.removeProperty(HELD)
129
+ return
130
+ }
131
+ const observer = typeof ResizeObserver === 'undefined' ? null : new ResizeObserver(() => run())
132
+ function run(): void {
133
+ if (mode === 'plain') {
134
+ el.style.setProperty(HELD, `${content?.getBoundingClientRect().height ?? 0}px`)
135
+ } else if (observer === null || content?.querySelector('[data-index]') !== null) {
136
+ // The seam has committed rows (or there is nothing to observe): the hold is spent.
137
+ el.style.removeProperty(HELD)
138
+ observer?.disconnect()
139
+ }
140
+ }
141
+ observer?.observe(content)
142
+ run()
143
+ return () => observer?.disconnect()
144
+ }, [node, mode])
145
+ }
@@ -0,0 +1,58 @@
1
+ /** Skeleton rows in the loaded shape of an `EventList`, enough to fill a bounded height. */
2
+ import { Skeleton } from '@mantine/core'
3
+ import classes from './event-list.module.css'
4
+ import { rowAttributes } from './event-list-model'
5
+ import type { RowContext } from './event-list-model'
6
+
7
+ /** Rows per skeleton day header. */
8
+ const SKELETON_GROUP = 3
9
+ /** Skeleton rows per px of a bounded height (feed ≈ 48 px a row, timeline ≈ 76). */
10
+ const SKELETON_ROW_PX = { feed: 48, timeline: 76 } as const
11
+
12
+ /** Skeleton rows in the loaded shape (header bars when grouped, glyph, sentence, time, meta and, on
13
+ * a timeline, chips), enough to fill a bounded height. */
14
+ export function SkeletonRows({
15
+ count,
16
+ ctx,
17
+ grouped,
18
+ height,
19
+ }: {
20
+ count: number
21
+ ctx: RowContext
22
+ grouped: boolean
23
+ height: number | string | undefined
24
+ }) {
25
+ const total =
26
+ typeof height === 'number'
27
+ ? Math.max(count, Math.ceil(height / SKELETON_ROW_PX[ctx.density]) + 1)
28
+ : count
29
+ return Array.from({ length: total }, (_, i) => (
30
+ <div key={i} className={classes.skeletonGroup} aria-hidden>
31
+ {grouped && i % SKELETON_GROUP === 0 && (
32
+ <div className={classes.header}>
33
+ <Skeleton className={classes.skeletonHeader} />
34
+ </div>
35
+ )}
36
+ <div
37
+ className={classes.row}
38
+ {...rowAttributes(ctx, i % SKELETON_GROUP === 0, i === total - 1)}
39
+ >
40
+ {ctx.lead && (
41
+ <span className={classes.leading}>
42
+ <Skeleton className={classes.skeletonGlyph} circle />
43
+ </span>
44
+ )}
45
+ <span className={classes.line}>
46
+ <Skeleton className={classes.skeletonLine} />
47
+ </span>
48
+ <span className={classes.time}>
49
+ <Skeleton className={classes.skeletonTime} />
50
+ </span>
51
+ <div className={classes.meta}>
52
+ <Skeleton className={classes.skeletonMeta} />
53
+ {ctx.density === 'timeline' && <Skeleton className={classes.skeletonChip} />}
54
+ </div>
55
+ </div>
56
+ </div>
57
+ ))
58
+ }
@@ -0,0 +1,283 @@
1
+ /*
2
+ * EventList (docs/waves/design-parity/SPEC.md § 6.7). One row shape for the plain and the virtualised
3
+ * path: nothing here keys on a parent selector, so the seam's wrapper divs change no geometry.
4
+ * Two sizes only: the row size (actor, sentence, body) and the micro size (day header, time, chips).
5
+ * Two lines at every width: line one is the glyph and the sentence at full width; line two leads
6
+ * with the mono time, then the body (it wraps, never truncates), then the chips.
7
+ */
8
+ .frame {
9
+ inline-size: 100%;
10
+ min-width: 0;
11
+ /* The sticky header backdrop, for the plain path and the seam alike: the page surface a `Section`
12
+ sits on. A list inside a card sets `--event-list-bg: var(--vx-surface-panel)` via `className`. */
13
+ --event-list-bg: var(--vx-surface-bg);
14
+ --virtual-rows-sticky-bg: var(--event-list-bg);
15
+ /* Chip and hover fill: a faint ink tint over the backdrop, visible in both schemes. */
16
+ --event-list-tint: color-mix(in srgb, var(--vx-ink) 7%, var(--event-list-bg));
17
+ --event-list-hover: color-mix(in srgb, var(--vx-ink) 12%, var(--event-list-bg));
18
+ }
19
+
20
+ .root {
21
+ min-width: 0;
22
+ }
23
+
24
+ .scroll {
25
+ overflow: auto;
26
+ /* The prepend anchor is manual (event-list.tsx); native anchoring would add the delta twice. */
27
+ overflow-anchor: none;
28
+ }
29
+
30
+ .virtual {
31
+ min-width: 0;
32
+ /* The plain rows' last height (see useHeldHeight): no collapse while the seam loads. */
33
+ min-block-size: var(--event-list-held, 0px);
34
+ }
35
+
36
+ .group {
37
+ min-width: 0;
38
+ }
39
+
40
+ .list {
41
+ margin: 0;
42
+ padding: 0;
43
+ list-style: none;
44
+ }
45
+
46
+ .header {
47
+ position: sticky;
48
+ top: 0;
49
+ z-index: 1;
50
+ display: flex;
51
+ align-items: baseline;
52
+ gap: var(--vx-space-control-gap);
53
+ margin: 0;
54
+ padding-block: var(--vx-space-stack-xs);
55
+ background: var(--event-list-bg);
56
+ font-family: var(--basalt-font-mono);
57
+ font-size: var(--vx-text-micro);
58
+ font-weight: 400;
59
+ letter-spacing: 0.06em;
60
+ color: var(--vx-muted);
61
+ }
62
+
63
+ /* A scrolled box: a short fade under the sticky day header, so a row passing beneath it reads as
64
+ scrolled, not overlapped. */
65
+ .scroll[data-scrolled] .header::after {
66
+ content: '';
67
+ position: absolute;
68
+ inset-inline: 0;
69
+ inset-block-start: 100%;
70
+ block-size: var(--vx-space-stack-sm);
71
+ background: linear-gradient(var(--event-list-bg), transparent);
72
+ pointer-events: none;
73
+ }
74
+
75
+ .count {
76
+ opacity: 0.7;
77
+ }
78
+
79
+ .row {
80
+ --event-list-lead: calc(1.25rem * var(--mantine-scale, 1));
81
+ position: relative;
82
+ display: grid;
83
+ grid-template-columns: auto minmax(0, 1fr);
84
+ grid-template-areas:
85
+ 'line line'
86
+ 'time meta';
87
+ column-gap: var(--vx-space-stack-md);
88
+ padding-block: var(--vx-space-stack-xs);
89
+ font-size: var(--vx-text-sm);
90
+ line-height: 1.4;
91
+ color: var(--vx-ink);
92
+ }
93
+
94
+ .row[data-density='timeline'] {
95
+ padding-block: var(--vx-space-stack-sm);
96
+ }
97
+
98
+ .row[data-lead] {
99
+ grid-template-columns: var(--event-list-lead) auto minmax(0, 1fr);
100
+ grid-template-areas:
101
+ 'lead line line'
102
+ '. time meta';
103
+ }
104
+
105
+ /* An untimed row has no time to lead the meta line: the meta takes the whole line. */
106
+ .row[data-untimed] {
107
+ grid-template-areas:
108
+ 'line line'
109
+ 'meta meta';
110
+ }
111
+
112
+ .row[data-lead][data-untimed] {
113
+ grid-template-areas:
114
+ 'lead line line'
115
+ '. meta meta';
116
+ }
117
+
118
+ /* The chips follow the sentence's last word, not the row's far edge: the sentence's track grows to
119
+ its content (and shrinks, wrapping, when the chips need the room), the chips' track hugs them. */
120
+ .row[data-chips-only] {
121
+ grid-template-columns: minmax(0, max-content) auto;
122
+ grid-template-areas: 'line meta';
123
+ justify-content: start;
124
+ align-items: start;
125
+ }
126
+
127
+ .row[data-lead][data-chips-only] {
128
+ grid-template-columns: var(--event-list-lead) minmax(0, max-content) auto;
129
+ grid-template-areas: 'lead line meta';
130
+ }
131
+
132
+ .leading {
133
+ grid-area: lead;
134
+ display: flex;
135
+ align-items: center;
136
+ justify-content: center;
137
+ min-height: 1.4em;
138
+ color: var(--vx-muted);
139
+ }
140
+
141
+ /* The rail: a 1 px neutral line through the leading column; the first and last rows start and stop at the glyph. */
142
+ .row[data-rail]::before {
143
+ content: '';
144
+ position: absolute;
145
+ inset-inline-start: calc(var(--event-list-lead) / 2);
146
+ inset-block: 0;
147
+ inline-size: 1px;
148
+ background: var(--vx-surface-border);
149
+ }
150
+
151
+ .row[data-rail][data-first]::before {
152
+ inset-block-start: calc(var(--vx-space-stack-sm) + 0.7em);
153
+ }
154
+
155
+ .row[data-rail][data-last]::before {
156
+ inset-block-end: calc(100% - var(--vx-space-stack-sm) - 0.7em);
157
+ }
158
+
159
+ .row[data-rail][data-first][data-last]::before {
160
+ display: none;
161
+ }
162
+
163
+ .line {
164
+ grid-area: line;
165
+ min-width: 0;
166
+ overflow: hidden;
167
+ text-overflow: ellipsis;
168
+ white-space: nowrap;
169
+ }
170
+
171
+ .row[data-density='timeline'] .line {
172
+ overflow: visible;
173
+ white-space: normal;
174
+ overflow-wrap: anywhere;
175
+ }
176
+
177
+ .actor {
178
+ /* 550, the theme's medium: at 13 px a plain 500 reads the same as the sentence. */
179
+ font-weight: 550;
180
+ }
181
+
182
+ .time {
183
+ grid-area: time;
184
+ font-family: var(--basalt-font-mono);
185
+ font-size: var(--vx-text-micro);
186
+ line-height: 1.4;
187
+ color: var(--vx-muted);
188
+ white-space: nowrap;
189
+ /* As tall as a row line and centred in it, so it sits on the first line of a wrapped body. */
190
+ display: flex;
191
+ align-items: center;
192
+ align-self: start;
193
+ block-size: calc(var(--vx-text-sm) * 1.4);
194
+ }
195
+
196
+ /* The meta line: the body, then the chips. The body wraps inside its own box and the chips stay beside
197
+ it on the first line, never on a line of their own; body text is never truncated. */
198
+ .meta {
199
+ grid-area: meta;
200
+ display: flex;
201
+ flex-wrap: nowrap;
202
+ align-items: flex-start;
203
+ gap: var(--vx-space-stack-xs) var(--vx-space-control-gap);
204
+ min-width: 0;
205
+ color: var(--vx-muted);
206
+ }
207
+
208
+ .body {
209
+ flex: 0 1 auto;
210
+ min-width: 0;
211
+ max-inline-size: 100%;
212
+ overflow-wrap: anywhere;
213
+ }
214
+
215
+ .chips {
216
+ display: inline-flex;
217
+ flex: none;
218
+ align-items: center;
219
+ align-self: flex-start;
220
+ gap: var(--vx-space-control-gap);
221
+ font-size: var(--vx-text-micro);
222
+ }
223
+
224
+ /* A neutral chip needs a visible surface in light as well: the theme's subtle fill is the page. */
225
+ .chips :global(.mantine-Badge-root) {
226
+ background: var(--event-list-tint);
227
+ }
228
+
229
+ .earlier {
230
+ display: flex;
231
+ justify-content: flex-start;
232
+ padding-block: var(--vx-space-stack-xs);
233
+ }
234
+
235
+ .earlierButton {
236
+ /* The label starts on the rows' edge: cancel the button's own inline padding. */
237
+ margin-inline-start: calc(var(--button-padding-x, 0px) * -1);
238
+ }
239
+
240
+ .earlierButton:hover:not(:disabled, [data-disabled]) {
241
+ background: var(--event-list-hover);
242
+ }
243
+
244
+ .skeletonGlyph {
245
+ inline-size: 0.5rem;
246
+ block-size: 0.5rem;
247
+ }
248
+
249
+ .skeletonLine {
250
+ /* A share of the row, capped near a loaded sentence so a wide list does not stretch the bar. */
251
+ inline-size: min(70%, 28rem);
252
+ block-size: 0.75rem;
253
+ margin-block: 0.25rem;
254
+ }
255
+
256
+ .skeletonTime {
257
+ inline-size: 3rem;
258
+ block-size: 0.625rem;
259
+ }
260
+
261
+ .skeletonGroup {
262
+ min-width: 0;
263
+ }
264
+
265
+ .skeletonHeader {
266
+ inline-size: 6rem;
267
+ block-size: 0.5rem;
268
+ }
269
+
270
+ .skeletonChip {
271
+ inline-size: 3rem;
272
+ block-size: 1rem;
273
+ }
274
+
275
+ .skeletonMeta {
276
+ inline-size: min(40%, 16rem);
277
+ block-size: 0.625rem;
278
+ }
279
+
280
+ /* The live region around the `EmptyState` tile (SPEC § 6.11); the tile paints its own ring. */
281
+ .empty {
282
+ display: block;
283
+ }
@@ -0,0 +1,33 @@
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 frame: string
7
+ readonly root: string
8
+ readonly scroll: string
9
+ readonly virtual: string
10
+ readonly group: string
11
+ readonly list: string
12
+ readonly header: string
13
+ readonly count: string
14
+ readonly row: string
15
+ readonly leading: string
16
+ readonly line: string
17
+ readonly actor: string
18
+ readonly time: string
19
+ readonly meta: string
20
+ readonly body: string
21
+ readonly chips: string
22
+ readonly earlier: string
23
+ readonly earlierButton: string
24
+ readonly empty: string
25
+ readonly skeletonGroup: string
26
+ readonly skeletonHeader: string
27
+ readonly skeletonChip: string
28
+ readonly skeletonGlyph: string
29
+ readonly skeletonLine: string
30
+ readonly skeletonTime: string
31
+ readonly skeletonMeta: string
32
+ }
33
+ export default classes