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
@@ -11,12 +11,13 @@ import {
11
11
  UnstyledButton
12
12
  } from "@mantine/core";
13
13
  import { useDisclosure, useFocusWithin, useHover, useMergedRef } from "@mantine/hooks";
14
- import { Fragment, lazy, memo, Suspense, useLayoutEffect, useMemo, useRef } from "react";
14
+ import { Fragment, memo, useLayoutEffect, useMemo, useRef } from "react";
15
15
  import { isLiveStatus } from "../thread.js";
16
16
  import { coalesceParts } from "../coalesce.js";
17
17
  import { narrowAgentPart } from "../foreign.js";
18
18
  import { PartList } from "../part-list.js";
19
19
  import { cx } from "../../common/props.js";
20
+ import { VirtualRows } from "../../common/virtual-rows.js";
20
21
  import { assertRequiredProps } from "../../common/validate.js";
21
22
  import { Markdown } from "../../content/markdown.js";
22
23
  import { CopyAction } from "../../content/copy-action.js";
@@ -243,162 +244,7 @@ const MessageBlock = memo(MessageBlockImpl, areMessageBlockPropsEqual);
243
244
  MessageBlock.displayName = "MessageBlock";
244
245
  const DEFAULT_VIRTUALIZE_OVERSCAN = 6;
245
246
  const DEFAULT_VIRTUALIZE_ESTIMATE_SIZE = 160;
246
- const DEFAULT_VIRTUALIZE_SCROLL_END_THRESHOLD = 64;
247
247
  const DEFAULT_VIRTUALIZE_INITIAL_SCROLL = "end";
248
- const MAX_INITIAL_SCROLL_ATTEMPTS = 5;
249
- function NonVirtualizedRows({
250
- rows,
251
- height,
252
- className,
253
- style
254
- }) {
255
- return (
256
- // theme-allow raw-scroll-container — degrade target owns its own scroll node, same as the real virtualizer below.
257
- /* @__PURE__ */ jsx(Box, { className: cx(className), style: { height, overflow: "auto", ...style }, children: /* @__PURE__ */ jsx(Stack, { gap: "sm", children: rows.map((row) => /* @__PURE__ */ jsx(Fragment, { children: row.node }, row.key)) }) })
258
- );
259
- }
260
- const nonVirtualizedRowsFallback = NonVirtualizedRows;
261
- function resolveGuardedMeasurement(host, element, size) {
262
- if (size > 0) return size;
263
- const index = host.indexFromElement(element);
264
- const key = host.options.getItemKey(index);
265
- return host.itemSizeCache.get(key) ?? host.options.estimateSize(index);
266
- }
267
- function resolveInitialScrollAction(initialScroll, rowCount, containerHeight) {
268
- if (initialScroll === "start") return "skip-done";
269
- if (rowCount === 0) return "skip-done";
270
- if (containerHeight <= 0) return "skip-retry";
271
- return "scroll";
272
- }
273
- function applyInitialScroll(state, initialScroll, rowCount, getContainerHeight, scrollToEnd, isAtEnd) {
274
- if (state.hasApplied) return;
275
- if (state.attempts > 0) {
276
- if (isAtEnd() || state.attempts >= MAX_INITIAL_SCROLL_ATTEMPTS) {
277
- state.hasApplied = true;
278
- return;
279
- }
280
- scrollToEnd();
281
- state.attempts += 1;
282
- return;
283
- }
284
- const action = resolveInitialScrollAction(initialScroll, rowCount, getContainerHeight());
285
- if (action === "skip-retry") return;
286
- if (action === "skip-done") {
287
- state.hasApplied = true;
288
- return;
289
- }
290
- scrollToEnd();
291
- state.attempts += 1;
292
- }
293
- function isContainerAtEnd(container, threshold) {
294
- if (container === null) return false;
295
- const distanceFromEnd = container.scrollHeight - container.clientHeight - container.scrollTop;
296
- return distanceFromEnd <= threshold;
297
- }
298
- const LazyVirtualizedRows = lazy(
299
- () => import("@tanstack/react-virtual").then(({ useVirtualizer, measureElement: defaultMeasureElement }) => {
300
- function VirtualizedRowsInner({
301
- rows,
302
- height,
303
- overscan,
304
- estimateSize,
305
- initialScroll,
306
- className,
307
- style
308
- }) {
309
- const parentRef = useRef(null);
310
- const initialScrollStateRef = useRef({
311
- hasApplied: false,
312
- attempts: 0
313
- });
314
- const virtualizer = useVirtualizer({
315
- count: rows.length,
316
- getScrollElement: () => parentRef.current,
317
- estimateSize: () => estimateSize,
318
- overscan,
319
- getItemKey: (index) => rows[index]?.key ?? index,
320
- anchorTo: "end",
321
- followOnAppend: true,
322
- scrollEndThreshold: DEFAULT_VIRTUALIZE_SCROLL_END_THRESHOLD,
323
- useFlushSync: false,
324
- // Guards against the hidden-ancestor cache-poisoning mechanism
325
- // `resolveGuardedMeasurement`'s doc and `virtualize.ts`'s composition rules describe —
326
- // NOT `enabled: false`, which virtual-core 3.17.1 wires to WIPE
327
- // `itemSizeCache`/`measurementsCache` entirely (`getMeasurements`'s `!enabled` branch)
328
- // rather than pause measurement, so toggling it off/on around a collapse would be
329
- // strictly worse than the bug it was meant to fix.
330
- measureElement: (element, entry, instance) => resolveGuardedMeasurement(
331
- instance,
332
- element,
333
- defaultMeasureElement(element, entry, instance)
334
- )
335
- });
336
- useLayoutEffect(() => {
337
- applyInitialScroll(
338
- initialScrollStateRef.current,
339
- initialScroll,
340
- rows.length,
341
- () => parentRef.current?.offsetHeight ?? 0,
342
- () => virtualizer.scrollToEnd({ behavior: "auto" }),
343
- () => isContainerAtEnd(parentRef.current, DEFAULT_VIRTUALIZE_SCROLL_END_THRESHOLD)
344
- );
345
- });
346
- return /* @__PURE__ */ jsx(
347
- Box,
348
- {
349
- ref: parentRef,
350
- className: cx(className),
351
- style: { height, overflow: "auto", ...style },
352
- children: /* @__PURE__ */ jsx(Box, { style: { height: virtualizer.getTotalSize(), position: "relative" }, children: virtualizer.getVirtualItems().map((virtualItem) => {
353
- const row = rows[virtualItem.index];
354
- if (row === void 0) return null;
355
- return /* @__PURE__ */ jsx(
356
- Box,
357
- {
358
- ref: virtualizer.measureElement,
359
- "data-index": virtualItem.index,
360
- style: {
361
- position: "absolute",
362
- top: 0,
363
- left: 0,
364
- width: "100%",
365
- transform: `translateY(${virtualItem.start}px)`
366
- },
367
- children: row.node
368
- },
369
- row.key
370
- );
371
- }) })
372
- }
373
- );
374
- }
375
- return { default: VirtualizedRowsInner };
376
- }).catch(() => ({ default: NonVirtualizedRows }))
377
- );
378
- Object.assign(LazyVirtualizedRows, { displayName: "LazyVirtualizedRows" });
379
- function VirtualizeSuspenseFallback({
380
- height,
381
- className,
382
- style
383
- }) {
384
- return /* @__PURE__ */ jsx(Box, { className: cx(className), style: { height, overflow: "auto", ...style } });
385
- }
386
- function VirtualizedTranscript(props) {
387
- return /* @__PURE__ */ jsx(
388
- Suspense,
389
- {
390
- fallback: /* @__PURE__ */ jsx(
391
- VirtualizeSuspenseFallback,
392
- {
393
- height: props.height,
394
- ...props.className !== void 0 && { className: props.className },
395
- ...props.style !== void 0 && { style: props.style }
396
- }
397
- ),
398
- children: /* @__PURE__ */ jsx(LazyVirtualizedRows, { ...props })
399
- }
400
- );
401
- }
402
248
  const EMPTY_RENDERERS = {};
403
249
  function useStableCallback(callback) {
404
250
  const callbackRef = useRef(callback);
@@ -496,10 +342,14 @@ function ThreadTranscript(props) {
496
342
  );
497
343
  if (virtualized !== null) {
498
344
  return /* @__PURE__ */ jsx(
499
- VirtualizedTranscript,
345
+ VirtualRows,
500
346
  {
501
347
  rows,
502
348
  height: virtualized.height,
349
+ gap: 0,
350
+ fallbackGap: "var(--mantine-spacing-sm)",
351
+ anchorTo: "end",
352
+ followOnAppend: true,
503
353
  overscan: virtualized.options.overscan ?? DEFAULT_VIRTUALIZE_OVERSCAN,
504
354
  estimateSize: virtualized.options.estimateSize ?? DEFAULT_VIRTUALIZE_ESTIMATE_SIZE,
505
355
  initialScroll: virtualized.options.initialScroll ?? DEFAULT_VIRTUALIZE_INITIAL_SCROLL,
@@ -511,12 +361,7 @@ function ThreadTranscript(props) {
511
361
  return /* @__PURE__ */ jsx(Stack, { gap: "sm", className: cx(className), ...style !== void 0 && { style }, children: rows.map((row) => /* @__PURE__ */ jsx(Fragment, { children: row.node }, row.key)) });
512
362
  }
513
363
  export {
514
- MAX_INITIAL_SCROLL_ATTEMPTS,
515
364
  ThreadTranscript,
516
- applyInitialScroll,
517
365
  messageBlockRenderCounter,
518
- nonVirtualizedRowsFallback,
519
- resolveGuardedMeasurement,
520
- resolveInitialScrollAction,
521
366
  threadPartRenderers
522
367
  };
@@ -24,11 +24,11 @@
24
24
  * `ThreadFeedRow`) — collapsing does not corrupt its measurement cache, and re-expanding restores
25
25
  * the same scroll position (same top-visible row) it had before the collapse. This is NOT free of
26
26
  * virtual-core: hiding an ancestor makes every mounted row's ResizeObserver box report `0` (a
27
- * `display: none` ancestor un-lays-out its descendants), and virtual-core 3.17.1's default
27
+ * `display: none` ancestor un-lays-out its descendants), and virtual-core 3.18.0's default
28
28
  * `measureElement`/`resizeItem` write that `0` into `itemSizeCache` with no floor — unguarded, a
29
29
  * few collapse/expand cycles permanently shrink `getTotalSize()` and silently scroll the visible
30
30
  * window to a DIFFERENT part of the transcript (`scrollTop` stays put; the content under it moves).
31
- * `thread-message.tsx` closes this with a `measureElement` override (`resolveGuardedMeasurement`)
31
+ * `common/virtual-rows.tsx` closes this with a `measureElement` override (`resolveGuardedMeasurement`)
32
32
  * that treats a `0` reading as unreliable and keeps the last-known size instead of committing it —
33
33
  * see that function's doc for the full mechanism, including why `useVirtualizer`'s `enabled` option
34
34
  * is NOT the fix (it wipes the measurement cache outright, worse than the bug). A consumer combining a
@@ -37,7 +37,7 @@
37
37
  * `useVirtualizer` call has no stale cache to poison).
38
38
  *
39
39
  * A fourth composition rule: a virtualized transcript SCROLLS ITSELF on mount. `initialScroll`
40
- * defaults to `'end'` — `anchorTo: 'end'` and `followOnAppend` (both wired in `thread-message.tsx`)
40
+ * defaults to `'end'` — `anchorTo: 'end'` and `followOnAppend` (both wired in `common/virtual-rows.tsx`)
41
41
  * only keep an ALREADY-at-the-end transcript pinned as content changes; neither performs the initial
42
42
  * jump, so left alone a freshly mounted virtualized transcript renders at message #0, not the
43
43
  * newest. The fix fires exactly once, on first mount, via `scrollToEnd()` — never again, so a user
@@ -50,11 +50,11 @@
50
50
  * if the transcript's own scroll container measures 0px on mount (e.g. mounted behind a hidden
51
51
  * ancestor) — it then lands on the first commit where the container is genuinely measurable, which
52
52
  * is what makes "opens at the newest message" hold for a transcript whose lazy virtualizer settled
53
- * while its `ThreadFeedRow` was collapsed. See `thread-message.tsx`'s `applyInitialScroll` for the
53
+ * while its `ThreadFeedRow` was collapsed. See `common/virtual-rows.tsx`'s `applyInitialScroll` for the
54
54
  * guard, and `VirtualizedRowsInner` for why its effect is deliberately dependency-free.
55
55
  *
56
56
  * Firing `scrollToEnd()` once is not sufficient on its own to land there, because virtual-core
57
- * 3.17.1's own `_willUpdate` writes to the SAME scroll container on the very next commit it runs
57
+ * 3.18.0's own `_willUpdate` writes to the SAME scroll container on the very next commit it runs
58
58
  * on, from state that lags behind the DOM: `_scrollToOffset` only ever records the write's
59
59
  * intent (`_intendedScrollOffset`) — `this.scrollOffset` itself updates ASYNCHRONOUSLY, from the
60
60
  * native `scroll` event, not from the call that requested it. So a commit that runs `_willUpdate`
@@ -50,8 +50,11 @@ type ChartCardBaseProps = BasaltProps & SlotStylesProps<ChartCardSlot> & {
50
50
  * fallback>` should pass a numeric height instead. */
51
51
  placeholderHeight?: number | ResponsiveChartHeight | 'content' | undefined;
52
52
  /** The pending plot's ghost: `'bars'` (default), `'line'` for a line or area chart, or the bar
53
- * count when the loaded chart's data length is known. */
54
- ghost?: 'bars' | 'line' | number | undefined;
53
+ * count when the loaded chart's data length is known, `'band'` for a `BandStrip`. Omitted, a
54
+ * `Lines` or `StackedArea` body (bare, or inside plain elements) loads as a line, a `BandStrip`
55
+ * as one band row at its own `height`; a body wrapped in your own component hides
56
+ * its kind from the card, so pass `ghost="line"` there. */
57
+ ghost?: 'bars' | 'line' | 'band' | number | undefined;
55
58
  /** Placeholder data is showing: the facts row dims with the plot (a strip cell's `stale`). */
56
59
  stale?: boolean | undefined;
57
60
  /** What an errored `state` names: "Could not load {stateNoun}". Default: no noun. */
@@ -1 +1 @@
1
- {"version":3,"file":"ChartCard.d.ts","sourceRoot":"","sources":["../../src/charts/ChartCard.tsx"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAiB,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGnE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAM7D,OA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,GAAG,YAAY,CAgE/B"}
@@ -1,10 +1,13 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { useRef, useState } from "react";
2
+ import { Children, isValidElement, useRef, useState } from "react";
3
3
  import { useIsomorphicLayoutEffect } from "../common/isomorphic-layout-effect.js";
4
4
  import { cx } from "../common/props.js";
5
5
  import { WidgetHeader } from "../dashboard/widget-header.js";
6
6
  import { VX } from "../tokens/index.js";
7
7
  import { ChartCardContext } from "./card-context.js";
8
+ import { BandStrip } from "./BandStrip.js";
9
+ import { Lines } from "./Lines.js";
10
+ import { StackedArea } from "./StackedArea.js";
8
11
  import classes from "./chart-card.module.css";
9
12
  import { ChartPlaceholder, resolveChartState } from "./state.js";
10
13
  const cardStyle = {
@@ -106,6 +109,30 @@ function FactsSkeleton({ basis }) {
106
109
  basis && /* @__PURE__ */ jsx("p", { className: cx(classes.factsBasis, classes.skeletonBasis) })
107
110
  ] });
108
111
  }
112
+ function isChartHeight(value) {
113
+ return typeof value === "number" || typeof value === "object" && value !== null && typeof value.base === "number";
114
+ }
115
+ function bodyKindOf(node) {
116
+ for (const child of Children.toArray(node)) {
117
+ if (!isValidElement(child)) continue;
118
+ if (child.type === Lines || child.type === StackedArea) return { ghost: "line" };
119
+ if (child.type === BandStrip) {
120
+ const { height, states, legend } = child.props;
121
+ return {
122
+ ghost: "band",
123
+ ...isChartHeight(height) && { height },
124
+ // The loaded strip's legend row sits under the box: the ghost keeps its room.
125
+ ...legend !== false && (states?.length ?? 0) > 1 && { legend: true }
126
+ };
127
+ }
128
+ const inner = bodyKindOf(child.props.children);
129
+ if (inner !== void 0) return inner;
130
+ }
131
+ return void 0;
132
+ }
133
+ function reserveLegend(reserve, placeholder) {
134
+ return reserve ? /* @__PURE__ */ jsx("div", { className: classes.legendReserve, "data-basalt-legend-reserve": "", children: placeholder }) : placeholder;
135
+ }
109
136
  function ChartCard({
110
137
  actions,
111
138
  state,
@@ -125,6 +152,9 @@ function ChartCard({
125
152
  }) {
126
153
  const { ref, short } = useShortCard();
127
154
  const resolved = resolveChartState(state);
155
+ const kind = resolved === "pending" ? bodyKindOf(children) : void 0;
156
+ const plotGhost = ghost ?? kind?.ghost;
157
+ const pendingHeight = placeholderHeight ?? kind?.height;
128
158
  const showFacts = facts !== void 0 && resolved === null;
129
159
  const skeletonFacts = facts !== void 0 && resolved === "pending";
130
160
  const hasHeader = actions !== void 0 || showFacts || skeletonFacts || HEADER_TRIGGERS.some((k) => header[k] !== void 0);
@@ -140,7 +170,7 @@ function ChartCard({
140
170
  ...resolved === "pending" && { "aria-busy": "true" },
141
171
  ...short && { "data-basalt-card-short": "" },
142
172
  children: [
143
- hasHeader && /* @__PURE__ */ jsxs("div", { className: cx(classes.header, classNames?.header), children: [
173
+ hasHeader && /* @__PURE__ */ jsxs("div", { "data-basalt-chart-header": "", className: cx(classes.header, classNames?.header), children: [
144
174
  /* @__PURE__ */ jsx(
145
175
  WidgetHeader,
146
176
  {
@@ -160,17 +190,20 @@ function ChartCard({
160
190
  {
161
191
  ...classNames?.body !== void 0 && { className: classNames.body },
162
192
  style: bodyClipStyle,
163
- children: resolved === null || resolved === "pending" && placeholderHeight === "content" ? children : /* @__PURE__ */ jsx(
164
- ChartPlaceholder,
165
- {
166
- state,
167
- ...placeholderHeight !== void 0 && { height: placeholderHeight },
168
- ...stateNoun !== void 0 && { noun: stateNoun },
169
- ...ghost !== void 0 && { ghost },
170
- ...onRetry !== void 0 && { onRetry },
171
- ...retrying !== void 0 && { retrying },
172
- action: stateAction
173
- }
193
+ children: resolved === null || resolved === "pending" && placeholderHeight === "content" ? children : reserveLegend(
194
+ kind?.legend === true,
195
+ /* @__PURE__ */ jsx(
196
+ ChartPlaceholder,
197
+ {
198
+ state,
199
+ ...pendingHeight !== void 0 && { height: pendingHeight },
200
+ ...stateNoun !== void 0 && { noun: stateNoun },
201
+ ...plotGhost !== void 0 && { ghost: plotGhost },
202
+ ...onRetry !== void 0 && { onRetry },
203
+ ...retrying !== void 0 && { retrying },
204
+ action: stateAction
205
+ }
206
+ )
174
207
  )
175
208
  }
176
209
  )
@@ -1 +1 @@
1
- {"version":3,"file":"Lines.d.ts","sourceRoot":"","sources":["../../src/charts/Lines.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAQzC,OAAO,KAAK,EACV,mBAAmB,EAGnB,MAAM,EAGN,SAAS,EACV,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG;IAChG;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,SAAS,SAAS,EAAE,CAAA;IAChE;sCACkC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;CACrD,CAAA;AAoBD,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CAoFzF"}
1
+ {"version":3,"file":"Lines.d.ts","sourceRoot":"","sources":["../../src/charts/Lines.tsx"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAA;AAQzC,OAAO,KAAK,EACV,mBAAmB,EAGnB,MAAM,EAGN,SAAS,EACV,MAAM,SAAS,CAAA;AAEhB,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,IAAI,CAAC,mBAAmB,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,GAAG;IAChG;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,KAAK,GAAG,SAAS,SAAS,EAAE,CAAA;IAChE;sCACkC;IAClC,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,SAAS,CAAA;CACrD,CAAA;AAoBD,wBAAgB,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,GAAG,MAAM,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,YAAY,CA6FzF"}
@@ -6,7 +6,7 @@ import { useCallback } from "react";
6
6
  import { CartesianRung } from "./CartesianChart.js";
7
7
  import { areaGradientId } from "./compile.js";
8
8
  import { chartCurve } from "./curves.js";
9
- import { endLabelMarks, endLabelPlan } from "./labels.js";
9
+ import { claimLabelBoxes, endLabelMarks, endLabelPlan } from "./labels.js";
10
10
  import { drawnRows, lineMark, loneDots, markersOf, yScaleOf } from "./marks.js";
11
11
  import { rowX } from "./types.js";
12
12
  const hasValue = (r) => r.y !== null;
@@ -20,7 +20,7 @@ function lastIsPlaceable(props, s) {
20
20
  }
21
21
  const AUTO_END_LABELS = 3;
22
22
  function Lines(props) {
23
- const { thresholds, naming = "auto", ...rest } = props;
23
+ const { thresholds, naming = "auto", refLines, ...rest } = props;
24
24
  const { series } = props;
25
25
  const labelled = series.filter((s) => s.role !== "reference");
26
26
  const namedByLabels = props.y2 === void 0 && series.every((s) => s.legend === false || s.role !== "reference") && !(props.refLines ?? []).some((r) => r.legend !== void 0);
@@ -79,15 +79,22 @@ function Lines(props) {
79
79
  out.push(...markersOf(s, plot.rows(s.key), yScale));
80
80
  }
81
81
  const labelled2 = plotted.filter((s) => s.role !== "reference");
82
- out.push(...endLabelMarks(endLabelPlan(plot, labelled2, effective)));
82
+ const rules = (refLines ?? []).flatMap((r) => r.axis === "right" ? [] : [r.value]);
83
+ const plan = endLabelPlan(plot, labelled2, effective, rules);
84
+ claimLabelBoxes(
85
+ plot,
86
+ plan.map((p) => p.box)
87
+ );
88
+ out.push(...endLabelMarks(plan));
83
89
  return out;
84
90
  },
85
- [series, thresholds, effective]
91
+ [series, thresholds, effective, refLines]
86
92
  );
87
93
  return /* @__PURE__ */ jsx(
88
94
  CartesianRung,
89
95
  {
90
96
  ...rest,
97
+ ...refLines !== void 0 && { refLines },
91
98
  marks,
92
99
  ...labelsOnly && { legend: false },
93
100
  ...hideAtWide && { hideLegendAtWide: true }
@@ -32,9 +32,16 @@ export type SparklineProps = BasaltProps & {
32
32
  /** A quiet dashed hairline at a value, or at the mean of the plotted values (`'mean'`). The y
33
33
  * domain widens to include it. Not a legend item, never a status colour. */
34
34
  reference?: number | 'mean' | undefined;
35
- /** A short caption for the `reference` line (`PR`, `30 d mean`), drawn at the plot start just
36
- * above the line. */
35
+ /** A short caption for the `reference` line (`PR`, `30 d mean`), drawn at the plot end the line
36
+ * is not near, just above the reference (below when there is no room above). */
37
37
  referenceLabel?: string | undefined;
38
+ /** A productive range (`{ from: 0.6, to: 1 }`) drawn as a quiet band behind the line. The y
39
+ * domain widens to include it. Not a series: no legend item, no tooltip row. A non-finite bound or
40
+ * an empty range (`from === to`) draws nothing and leaves the domain alone. */
41
+ band?: {
42
+ from: number;
43
+ to: number;
44
+ } | undefined;
38
45
  /** Formats the readout's value. Default: the compact number format. */
39
46
  format?: ((value: number) => string) | undefined;
40
47
  /** The readout's x label per point, index-aligned with `data`: pass the point's day ("12 Oct"),
@@ -1 +1 @@
1
- {"version":3,"file":"Sparkline.d.ts","sourceRoot":"","sources":["../../src/charts/Sparkline.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAA0D,YAAY,EAAE,MAAM,OAAO,CAAA;AAEjG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAclD,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,SAAS,CAAA;AAErD,MAAM,MAAM,cAAc,GAAG,WAAW,GAAG;IACzC,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAA;IACjB;yFACqF;IACrF,IAAI,EA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