basalt-ui 2.26.0 → 2.27.1

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 (53) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/MIGRATING.md +91 -12
  3. package/dist/charts/Bars.d.ts.map +1 -1
  4. package/dist/charts/Bars.js +37 -1
  5. package/dist/charts/ChartCard.d.ts +8 -2
  6. package/dist/charts/ChartCard.d.ts.map +1 -1
  7. package/dist/charts/ChartCard.js +2 -0
  8. package/dist/charts/Sparkline.d.ts.map +1 -1
  9. package/dist/charts/Sparkline.js +76 -15
  10. package/dist/charts/chart-box.module.css +78 -1
  11. package/dist/charts/chart-box.module.css.d.ts +1 -0
  12. package/dist/charts/chart-legend.module.css +0 -14
  13. package/dist/charts/compile.d.ts +20 -0
  14. package/dist/charts/compile.d.ts.map +1 -1
  15. package/dist/charts/compile.js +85 -12
  16. package/dist/charts/legend.d.ts.map +1 -1
  17. package/dist/charts/legend.js +37 -87
  18. package/dist/charts/sparkline.module.css +4 -0
  19. package/dist/charts/state.d.ts +7 -0
  20. package/dist/charts/state.d.ts.map +1 -1
  21. package/dist/charts/state.js +14 -3
  22. package/dist/cli/shot/capture.d.ts +32 -3
  23. package/dist/cli/shot/capture.d.ts.map +1 -1
  24. package/dist/cli/shot/capture.js +17 -7
  25. package/dist/dashboard/meter-model.d.ts +17 -3
  26. package/dist/dashboard/meter-model.d.ts.map +1 -1
  27. package/dist/dashboard/meter-model.js +69 -19
  28. package/dist/dashboard/meter-parts.d.ts.map +1 -1
  29. package/dist/dashboard/meter-parts.js +28 -12
  30. package/dist/dashboard/meter.module.css +17 -1
  31. package/dist/dashboard/stat-strip.d.ts.map +1 -1
  32. package/dist/dashboard/stat-strip.js +90 -22
  33. package/dist/dashboard/stat-strip.module.css +13 -3
  34. package/dist/dashboard/stat-strip.module.css.d.ts +1 -0
  35. package/llms.txt +3 -2
  36. package/package.json +1 -1
  37. package/src/charts/Bars.tsx +50 -2
  38. package/src/charts/ChartCard.tsx +9 -1
  39. package/src/charts/Sparkline.tsx +113 -20
  40. package/src/charts/chart-box.module.css +78 -1
  41. package/src/charts/chart-box.module.css.d.ts +1 -0
  42. package/src/charts/chart-legend.module.css +0 -14
  43. package/src/charts/compile.ts +140 -18
  44. package/src/charts/legend.tsx +10 -74
  45. package/src/charts/sparkline.module.css +4 -0
  46. package/src/charts/state.tsx +30 -5
  47. package/src/cli/shot/capture.ts +25 -9
  48. package/src/dashboard/meter-model.ts +122 -31
  49. package/src/dashboard/meter-parts.tsx +53 -19
  50. package/src/dashboard/meter.module.css +17 -1
  51. package/src/dashboard/stat-strip.module.css +13 -3
  52. package/src/dashboard/stat-strip.module.css.d.ts +1 -0
  53. package/src/dashboard/stat-strip.tsx +114 -26
@@ -4,9 +4,11 @@
4
4
  * stack diverges around the baseline (the 1.x `negativeBars`, now just a signed value). Zones,
5
5
  * reference lines, legend, cursor and tooltip are the rung's. In a visual slot (a `StatCard`
6
6
  * `sparkline`, a strip cell's `visual`) it drops both axes, the grid, the margin and the legend and
7
- * fills the slot like a `Sparkline`: a small histogram, its bins named in the tooltip below it.
7
+ * fills the slot like a `Sparkline`: a small histogram whose tooltip is the one-line chip
8
+ * (`<value> · <x label>`) in the line the host reserves above the plot.
8
9
  */
9
10
  import { barY } from '@tanstack/charts/bar'
11
+ import { dot } from '@tanstack/charts/dot'
10
12
  import { group } from '@tanstack/charts/group'
11
13
  import { stack } from '@tanstack/charts/stack'
12
14
  import { useCallback, useContext, useMemo } from 'react'
@@ -66,6 +68,8 @@ export type BarsProps<T, X extends ChartX = ChartX> = Omit<
66
68
  }
67
69
 
68
70
  const DEFAULT_BAR_OPACITY = 0.85
71
+ /** The empty-bin marker's radius, px: the plot's floor clips it to a 2px-high tick. */
72
+ const EMPTY_BIN_R = 2
69
73
  /** The faintest shade told-apart-by-shade series step down to. */
70
74
  const SHADE_FLOOR = 0.4
71
75
 
@@ -104,12 +108,55 @@ function guardLogStack(layout: string, onLog: boolean): void {
104
108
  warnedLogStack = true
105
109
  }
106
110
 
111
+ /**
112
+ * A slotted chart has no axes to name the hovered bin, and an empty bin has no bar to light: the
113
+ * readout says `0 runs · 16 Oct 02:00` and nothing in the plot would mark where. Each bin whose
114
+ * stack sums to zero gets a baseline mark (a half-dot on the plot's floor), hidden until that x is hovered (the same `focus: 'x'`
115
+ * state that takes a drawn bar to full strength).
116
+ */
117
+ function emptyBinTicks<T, X extends ChartX>(rows: readonly PlotRow<T, X>[]): ChartMarks {
118
+ // A gap (`y: null` on every series) is an absence, not a zero: only a bin with a value counts.
119
+ const sums = new Map<string, { row: PlotRow<T, X>; sum: number; values: number }>()
120
+ for (const row of rows) {
121
+ const key = String(row.x instanceof Date ? row.x.getTime() : row.x)
122
+ const entry = sums.get(key) ?? { row, sum: 0, values: 0 }
123
+ if (row.y !== null && Number.isFinite(row.y)) {
124
+ entry.sum += Math.abs(row.y)
125
+ entry.values += 1
126
+ }
127
+ sums.set(key, entry)
128
+ }
129
+ const empty = [...sums.values()].filter((e) => e.values > 0 && e.sum === 0).map((e) => e.row)
130
+ if (empty.length === 0) return []
131
+ return [
132
+ dot(empty, {
133
+ id: 'empty-bins',
134
+ x: rowX,
135
+ y: () => 0,
136
+ r: EMPTY_BIN_R,
137
+ fill: VX.muted,
138
+ fillOpacity: 0,
139
+ states: [{ when: { focus: 'x' }, style: { fillOpacity: 1 } }],
140
+ }),
141
+ ]
142
+ }
143
+
144
+ /** Whether the baseline (y = 0) is on the plot: not on a log axis, not in a domain that starts above it. */
145
+ function floorIsZero<T>(y: BarsProps<T>['y']): boolean {
146
+ if (y?.scale === 'log') return false
147
+ const domain = y?.domain
148
+ if (Array.isArray(domain)) return domain[0] <= 0 && domain[1] >= 0
149
+ if (typeof domain === 'function') return false
150
+ return (y?.autoMinCeil ?? 0) <= 0
151
+ }
152
+
107
153
  export function Bars<T, X extends ChartX = ChartX>(props: BarsProps<T, X>): ReactElement {
108
154
  const { bars: given, lines, layout = 'stacked', barOpacity, ...rest } = props
109
155
  const bars = useMemo(() => shadeSharedColors(given, barOpacity), [given, barOpacity])
110
156
  const sharedColor = bars.some((b, i) => bars.findIndex((o) => o.color === b.color) !== i)
111
157
  guardLogStack(layout, bars.length > 0 && rest.y?.scale === 'log')
112
158
  const sample = rest.data[0]
159
+ const zeroFloor = floorIsZero(rest.y)
113
160
  const bare = useContext(VisualSlotContext) !== null
114
161
  const series = useMemo<ChartSeries<T>[]>(
115
162
  () => [
@@ -165,13 +212,14 @@ export function Bars<T, X extends ChartX = ChartX>(props: BarsProps<T, X>): Reac
165
212
  : stack({ order, ...(layout === 'normalized' && { offset: 'normalize' }) }),
166
213
  }),
167
214
  )
215
+ if (bare && zeroFloor) out.push(...emptyBinTicks(rows))
168
216
  for (const s of plot.visible) {
169
217
  if (barKeys.has(s.key)) continue
170
218
  out.push(lineMark(plot, s))
171
219
  }
172
220
  return out
173
221
  },
174
- [bars, layout, barOpacity, sharedColor],
222
+ [bars, layout, barOpacity, sharedColor, bare, zeroFloor],
175
223
  )
176
224
 
177
225
  return (
@@ -139,7 +139,10 @@ type ChartCardBaseProps = BasaltProps &
139
139
  /** Right-aligned controls. A `<Text size="xs">` caption here renders at 11 (the chart-text step,
140
140
  * beside the plot's ticks); wrap it in a `span` or give it your own class to opt out. */
141
141
  actions?: ReactNode
142
- /** A resolved state replaces `children` with its placeholder; the header stays. */
142
+ /** A resolved state replaces `children` with its placeholder; the header stays. The card learns
143
+ * a state only from here: a body that draws its own loading or empty line (`Meter loading`,
144
+ * `BarList emptyText`) must ALSO be reported here (`{ pending: true }`, `{ empty }`), or the
145
+ * `facts` above it render over a state they contradict. */
143
146
  state?: ChartState | undefined
144
147
  /** Body height while a placeholder shows. Default: the chart height law, i.e. exactly the box an
145
148
  * unsized chart takes — pass the chart's own `height` when it states one, so a `<Suspense
@@ -149,6 +152,9 @@ type ChartCardBaseProps = BasaltProps &
149
152
  * its own loading (`BarList loading`, a loading `Meter`); a children-less `<Suspense
150
153
  * fallback>` should pass a numeric height instead. */
151
154
  placeholderHeight?: number | ResponsiveChartHeight | 'content' | undefined
155
+ /** The pending plot's ghost: `'bars'` (default), `'line'` for a line or area chart, or the bar
156
+ * count when the loaded chart's data length is known. */
157
+ ghost?: 'bars' | 'line' | number | undefined
152
158
  /** Placeholder data is showing: the facts row dims with the plot (a strip cell's `stale`). */
153
159
  stale?: boolean | undefined
154
160
  /** What an errored `state` names: "Could not load {stateNoun}". Default: no noun. */
@@ -253,6 +259,7 @@ export function ChartCard({
253
259
  stateAction,
254
260
  stale,
255
261
  stateNoun,
262
+ ghost,
256
263
  onRetry,
257
264
  retrying,
258
265
  className,
@@ -310,6 +317,7 @@ export function ChartCard({
310
317
  state={state}
311
318
  {...(placeholderHeight !== undefined && { height: placeholderHeight })}
312
319
  {...(stateNoun !== undefined && { noun: stateNoun })}
320
+ {...(ghost !== undefined && { ghost })}
313
321
  {...(onRetry !== undefined && { onRetry })}
314
322
  {...(retrying !== undefined && { retrying })}
315
323
  action={stateAction}
@@ -80,6 +80,9 @@ const READOUT_GAP = 8
80
80
  /** Air round a line's plot, px (the engine's plot margin): the end marker stays inside the svg box,
81
81
  * so it clears the 2px focus outline round it. A bar plot is flush. */
82
82
  const LINE_INSET = 3
83
+ /** A bare line sparkline shorter than this has no room for a two-line readout (about 34px with its
84
+ * padding and border): it keeps the one-line form, in the in-box band farthest from the line. */
85
+ const SHORT_BOX = 36
83
86
  /** The muted tone's line: the same alpha the consumers hand-built (`alpha(VX.muted, .35)`). */
84
87
  const MUTED_LINE = alpha(VX.muted, 0.35)
85
88
  /** Air between the plot's start and the reference label, so the focus outline never covers it. */
@@ -423,16 +426,17 @@ function lineHits(
423
426
  * A hosted line's stacked chip is two lines tall, more than the host's one reserved line, so it sits
424
427
  * in the plot, and never on the plotted line: first at the cursor (slid with it) at the plot's top,
425
428
  * then its bottom, then to the right and to the left of the cursor at either edge, the first of
426
- * those the line misses. A plot too short for the chip (a 22px strip cell) has no such spot: the
427
- * chip then hangs from the plot's bottom edge, over the host's footer or card padding: a hover
428
- * covers the figure's secondary text before it covers the data or the figure's delta above.
429
+ * those the line misses. A plot too short for the chip has no such spot: it returns false and the
430
+ * chip hangs from the plot's bottom edge, over the host's footer or card padding: a hover covers the
431
+ * figure's secondary text before it covers the data or the figure's delta above. Not for a strip
432
+ * row (`fitReadout` never stacks there: a chip hung below the plot lands on the next row).
429
433
  * Offsets go on `margin-left` and `top`, which React's `left` / `translate` do not own.
430
434
  */
431
- function placeStacked(node: HTMLElement, line: () => readonly LinePoint[], fx: number): void {
435
+ function placeStacked(node: HTMLElement, line: () => readonly LinePoint[], fx: number): boolean {
432
436
  const layer = node.parentElement
433
- if (!layer) return
437
+ if (!layer) return true
434
438
  const [W, H, w, h] = [layer.clientWidth, layer.clientHeight, node.offsetWidth, node.offsetHeight]
435
- if (W <= 0 || H <= 0) return
439
+ if (W <= 0 || H <= 0) return true
436
440
  const pts = line().map(([x, y]): [number, number] => [x * W, y * H])
437
441
  const slid = fx * (W - w)
438
442
  const room = (left: number): number => Math.min(Math.max(left, 0), Math.max(W - w, 0))
@@ -441,38 +445,126 @@ function placeStacked(node: HTMLElement, line: () => readonly LinePoint[], fx: n
441
445
  const fit = lefts
442
446
  .flatMap((left) => tops.map((top) => ({ left, top, w, h })))
443
447
  .find((box) => !lineHits(pts, box))
444
- if (!fit) {
445
- node.style.top = `${H + CLEAR}px`
446
- return
448
+ if (!fit) return false
449
+ node.style.top = `${fit.top}px`
450
+ node.style.marginLeft = `${fit.left - slid}px`
451
+ return true
452
+ }
453
+
454
+ /** The plotted line's y (fraction of the box) at x, interpolated along the polyline; null outside it. */
455
+ function lineYAt(pts: readonly (readonly [number, number])[], x: number): number | null {
456
+ for (let i = 0; i + 1 < pts.length; i += 1) {
457
+ const [ax, ay] = pts[i] as readonly [number, number]
458
+ const [bx, by] = pts[i + 1] as readonly [number, number]
459
+ if (x >= Math.min(ax, bx) && x <= Math.max(ax, bx))
460
+ return bx === ax ? ay : ay + ((by - ay) * (x - ax)) / (bx - ax)
447
461
  }
462
+ return null
463
+ }
464
+
465
+ /**
466
+ * A short bare line's one-line chip stays inside its box (it can never reach a sibling above or
467
+ * below). It slides with the point and takes the band, top or bottom, farthest from the plotted line
468
+ * under it; a box so short that the chip fills it moves beside the point instead, so the chip never
469
+ * covers the dot. Offsets go on `margin-left` and `top`, which React's `left` / `translate` do not own.
470
+ */
471
+ function placeInBand(node: HTMLElement, line: () => readonly LinePoint[], fx: number): void {
472
+ const layer = node.parentElement
473
+ if (!layer) return
474
+ const [W, H, w, h] = [layer.clientWidth, layer.clientHeight, node.offsetWidth, node.offsetHeight]
475
+ if (W <= 0 || H <= 0) return
476
+ const pts = line().map(([x, y]): [number, number] => [x * W, y * H])
477
+ const slid = fx * (W - w)
478
+ const room = (left: number): number => Math.min(Math.max(left, 0), Math.max(W - w, 0))
479
+ const lefts = [slid, room(fx * W + CLEAR * 2), room(fx * W - CLEAR * 2 - w)]
480
+ const bands = [0, Math.max(H - h, 0)]
481
+ const dotY = lineYAt(pts, fx * W)
482
+ const score = (left: number, top: number): number => {
483
+ const covers =
484
+ dotY !== null &&
485
+ fx * W + CLEAR > left &&
486
+ fx * W - CLEAR < left + w &&
487
+ dotY + CLEAR > top &&
488
+ dotY - CLEAR < top + h
489
+ let nearest = Number.POSITIVE_INFINITY
490
+ for (let x = left; x <= left + w; x += 2) {
491
+ const y = lineYAt(pts, x)
492
+ if (y === null) continue
493
+ nearest = Math.min(nearest, y < top ? top - y : y > top + h ? y - (top + h) : 0)
494
+ }
495
+ return (covers ? -1000 : 0) + Math.min(nearest, 999)
496
+ }
497
+ const fit = lefts
498
+ .flatMap((left) => bands.map((top) => ({ left, top, s: score(left, top) })))
499
+ .reduce((a, b) => (b.s > a.s ? b : a))
448
500
  node.style.top = `${fit.top}px`
449
501
  node.style.marginLeft = `${fit.left - slid}px`
450
502
  }
451
503
 
504
+ /**
505
+ * A hosted chip in a strip row measures against the row, not the narrow visual column it is drawn
506
+ * in: it stays on the reserved line above the plot and slides over the label column, up to the row's
507
+ * own value. Returns that `[left, right]` in viewport px; null outside a strip row.
508
+ */
509
+ function rowSpan(node: HTMLElement): readonly [number, number] | null {
510
+ const row = node.closest('[data-strip-row]')
511
+ if (row === null) return null
512
+ const box = row.getBoundingClientRect()
513
+ const value = row.querySelector('[data-strip-row-value]')
514
+ const end = value === null ? box.right : value.getBoundingClientRect().left
515
+ return [box.left, Math.max(box.left, end - CLEAR)]
516
+ }
517
+
452
518
  /**
453
519
  * A readout never loses its separator or its date to an ellipsis: when the one-line chip overflows
454
520
  * its box it first tightens (`data-tight`: less padding, the separator's air stays), then stacks
455
- * (`data-stacked`: the date on its own line, placed off the plotted line when `line` is given). Set
456
- * on the node, so a measure never re-renders.
521
+ * (`data-stacked`: the date on its own line, placed off the plotted line when `line` is given). A
522
+ * chip in a strip row never stacks (a second line, or a hang below the plot, lands on the next row):
523
+ * it measures against the row, tightens, then drops its date (`data-short`). Set on the node, so a
524
+ * measure never re-renders.
457
525
  */
458
526
  function fitReadout(
459
527
  node: HTMLElement,
460
528
  line: (() => readonly LinePoint[]) | null,
461
529
  fx: number,
530
+ band: boolean,
462
531
  ): void {
463
532
  const overflows = (): boolean => node.scrollWidth > node.clientWidth
464
533
  node.removeAttribute('data-tight')
465
534
  node.removeAttribute('data-stacked')
535
+ node.removeAttribute('data-short')
466
536
  // `top` is React's on a bare chip; a hosted line's chip is the only one `placeStacked` writes to.
467
537
  if (line !== null) {
468
538
  node.style.removeProperty('top')
469
539
  node.style.removeProperty('margin-left')
470
540
  }
471
- if (!overflows()) return
472
- node.setAttribute('data-tight', '')
473
- if (!overflows()) return
474
- node.setAttribute('data-stacked', '')
475
- if (line !== null) placeStacked(node, line, fx)
541
+ // `max-width` is React's on every chip; a strip row's chip is the only one widened past it.
542
+ const span = line !== null && !band ? rowSpan(node) : null
543
+ if (line !== null && !band) node.style.maxWidth = '100%'
544
+ if (span !== null && span[1] > span[0]) node.style.maxWidth = `${span[1] - span[0]}px`
545
+ if (overflows()) {
546
+ node.setAttribute('data-tight', '')
547
+ if (overflows()) {
548
+ // A short bare box has no room for two lines: it stays one line, tight.
549
+ if (span !== null) node.setAttribute('data-short', '')
550
+ else if (!band) node.setAttribute('data-stacked', '')
551
+ }
552
+ }
553
+ if (line === null) return
554
+ if (band) {
555
+ placeInBand(node, line, fx)
556
+ return
557
+ }
558
+ if (span === null) {
559
+ // Not in a strip row: the chip hangs from the plot's bottom edge, over the host's footer.
560
+ if (node.hasAttribute('data-stacked') && !placeStacked(node, line, fx))
561
+ node.style.top = `${(node.parentElement?.clientHeight ?? 0) + CLEAR}px`
562
+ return
563
+ }
564
+ // Slide the one-line chip back inside the row (`margin-left` on top of the point's own slide).
565
+ const { left, width } = node.getBoundingClientRect()
566
+ const inside = Math.min(Math.max(left, span[0]), Math.max(span[1] - width, span[0]))
567
+ if (inside !== left) node.style.marginLeft = `${inside - left}px`
476
568
  }
477
569
 
478
570
  export function Sparkline(props: SparklineProps): ReactElement {
@@ -583,6 +675,7 @@ export function Sparkline(props: SparklineProps): ReactElement {
583
675
  // `translate` take one fraction), inside the box at either edge whatever its width, and the
584
676
  // stylesheet lifts it above the plot. Bare: beside the point, on the roomier side and on the half of
585
677
  // the box away from it, so the chip covers neither the dot nor anything the host draws round it.
678
+ const short = !hosted && mark === 'line' && height < SHORT_BOX
586
679
  const beside = at === null ? null : at.fx > 0.5 ? 'left' : 'right'
587
680
  // The chip's fit depends on its text and (bare) its side, not on the pointer's every tick.
588
681
  const shown = at !== null
@@ -596,7 +689,7 @@ export function Sparkline(props: SparklineProps): ReactElement {
596
689
  // A hosted line's stacked chip clears the plotted line, built only when the chip stacks; a bar
597
690
  // or a bare chip keeps its place.
598
691
  const line =
599
- hosted && mark === 'line' && model !== null
692
+ (hosted || short) && mark === 'line' && model !== null
600
693
  ? (): LinePoint[] =>
601
694
  model.rows.flatMap((r, i): LinePoint[] =>
602
695
  r.v === null
@@ -610,10 +703,10 @@ export function Sparkline(props: SparklineProps): ReactElement {
610
703
  )
611
704
  : null
612
705
  fitRef.current = () => {
613
- if (readoutRef.current !== null) fitReadout(readoutRef.current, line, fxRef.current)
706
+ if (readoutRef.current !== null) fitReadout(readoutRef.current, line, fxRef.current, short)
614
707
  }
615
708
  fitRef.current()
616
- }, [active, at?.label, at?.value, beside, hosted, mark, model])
709
+ }, [active, at?.label, at?.value, beside, hosted, short, mark, model])
617
710
  // ...and on the box, which a container resize changes without a hover.
618
711
  useEffect(() => {
619
712
  const layer = readoutRef.current?.parentElement
@@ -625,7 +718,7 @@ export function Sparkline(props: SparklineProps): ReactElement {
625
718
  const readoutStyle: CSSProperties | undefined =
626
719
  at === null
627
720
  ? undefined
628
- : hosted
721
+ : hosted || short
629
722
  ? { left: `${at.fx * 100}%`, translate: `${-at.fx * 100}% 0`, maxWidth: '100%' }
630
723
  : {
631
724
  ...(beside === 'right'
@@ -115,6 +115,16 @@
115
115
  bottom / 100% 1px no-repeat;
116
116
  }
117
117
 
118
+ .ghostLine {
119
+ width: 100%;
120
+ height: 100%;
121
+ fill: none;
122
+ stroke: color-mix(in srgb, var(--vx-ink) 24%, var(--vx-surface-panel));
123
+ stroke-width: 2px;
124
+ stroke-linecap: round;
125
+ stroke-linejoin: round;
126
+ }
127
+
118
128
  .ghostBar {
119
129
  flex: 1 1 0;
120
130
  min-width: 0;
@@ -135,7 +145,9 @@
135
145
  }
136
146
 
137
147
  :global(.ts-chart-tooltip__row > span:nth-child(2)) {
138
- overflow-wrap: break-word;
148
+ /* Words wrap, tokens do not: the engine's `anywhere` on the card would split `Load (7)` as
149
+ * `Load` / `7)` and `TE 2.1/0.4` mid-figure. A single token wider than the card overflows it. */
150
+ overflow-wrap: normal;
139
151
  white-space: normal;
140
152
  }
141
153
 
@@ -154,3 +166,68 @@
154
166
  )
155
167
  var(--vx-surface-elevated) !important;
156
168
  }
169
+
170
+ /*
171
+ * A slotted `Bars` (`data-basalt-slot`, set by `compile.ts`) is a micro-visual: its tooltip is the
172
+ * Sparkline's one-line chip, `<value> · <x label>` in the line the host reserves above the plot. The
173
+ * first row's figure leads, the header follows it, further rows are hidden (a chart that needs rows
174
+ * lives in a `ChartCard`); an overlong header ends in an ellipsis. Type and edge are the
175
+ * chip's (`sparkline.module.css`), its height that less the focus ring's clearance; the tooltip is portalled out of the host, so its fallbacks stand.
176
+ */
177
+ :global(.ts-chart-tooltip[data-basalt-slot]) {
178
+ display: flex !important;
179
+ align-items: center;
180
+ box-sizing: border-box;
181
+ width: max-content;
182
+ /* The line the cell reserves (1.125rem) less the focus ring's clearance (2px outline + 0.125rem offset), so
183
+ * the chip sits clear of the ring and still inside the reserve. */
184
+ block-size: calc(1.125rem - 0.25rem);
185
+ padding: 0 4px !important;
186
+ overflow: hidden;
187
+ font-family: var(--basalt-font-numeral, var(--basalt-font-sans));
188
+ font-variant-numeric: lining-nums;
189
+ font-size: var(--vx-text-xs);
190
+ line-height: calc(1.125rem - 0.25rem - 2px);
191
+ white-space: nowrap !important;
192
+ border-radius: var(--vx-radius-ctrl) !important;
193
+ /* theme-allow css-raw-surface — the chip is flat, like the Sparkline's, not a floating panel */
194
+ box-shadow: none !important;
195
+ }
196
+
197
+ :global(.ts-chart-tooltip[data-basalt-slot]:is([hidden], [popover]:not(:popover-open))) {
198
+ /* The flex above must not beat the engine's own hide. */
199
+ display: none !important;
200
+ }
201
+
202
+ :global(.ts-chart-tooltip[data-basalt-slot] .ts-chart-tooltip__rows) {
203
+ flex: none;
204
+ order: 0;
205
+ }
206
+
207
+ :global(.ts-chart-tooltip[data-basalt-slot] .ts-chart-tooltip__row) {
208
+ display: block !important;
209
+ }
210
+
211
+ :global(.ts-chart-tooltip[data-basalt-slot] .ts-chart-tooltip__row:not(:first-child)),
212
+ :global(.ts-chart-tooltip[data-basalt-slot] .ts-chart-tooltip__row > span:not(:last-child)) {
213
+ display: none;
214
+ }
215
+
216
+ :global(.ts-chart-tooltip[data-basalt-slot] .ts-chart-tooltip__title) {
217
+ display: block !important;
218
+ flex: 0 1 auto;
219
+ min-width: 0;
220
+ order: 1;
221
+ margin: 0 !important;
222
+ overflow: hidden;
223
+ font-weight: inherit !important;
224
+ text-overflow: ellipsis;
225
+ white-space: nowrap;
226
+ overflow-wrap: normal;
227
+ opacity: 0.7;
228
+ }
229
+
230
+ :global(.ts-chart-tooltip[data-basalt-slot] .ts-chart-tooltip__title::before) {
231
+ content: ' · ';
232
+ white-space: pre;
233
+ }
@@ -10,6 +10,7 @@ declare const classes: {
10
10
  readonly state: string
11
11
  readonly grow: string
12
12
  readonly ghost: string
13
+ readonly ghostLine: string
13
14
  readonly ghostBar: string
14
15
  }
15
16
  export default classes
@@ -15,9 +15,7 @@
15
15
  }
16
16
 
17
17
  @container (min-width: 240px) {
18
- /* `foldLegend` (legend.tsx) folds the zones / references that wrap the row into `+N`; series never fold. */
19
18
  .auto {
20
- --bc-fold: 1;
21
19
  flex-wrap: wrap;
22
20
  display: flex;
23
21
  column-gap: var(--bc-dots-gap);
@@ -27,7 +25,6 @@
27
25
 
28
26
  @container (min-width: 480px) {
29
27
  .auto {
30
- --bc-fold: 0;
31
28
  column-gap: var(--bc-legend-gap);
32
29
  --vx-hit-gap: var(--bc-legend-gap);
33
30
  }
@@ -47,14 +44,3 @@
47
44
  display: none;
48
45
  }
49
46
  }
50
-
51
- /* The compact fold (`foldLegend`, which only folds while `--bc-fold` is 1); wide keeps every entry.
52
- * `!important`: an entry's inline `all: unset` (legend.tsx) would otherwise reset `display`. */
53
- .auto [data-legend-folded] {
54
- display: none !important;
55
- }
56
-
57
- .auto [data-legend-more] {
58
- order: 1;
59
- flex: none;
60
- }