strata-react 2.2.0 → 2.2.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.
package/dist/index.js CHANGED
@@ -22947,7 +22947,7 @@ function BoxOverlay({ label, of, boxes, state, onChoose, fillLit = true }) {
22947
22947
  const lit = on || id === state.pointed;
22948
22948
  const filled = lit && fillLit;
22949
22949
  const repeat = n >= order.length;
22950
- return /* @__PURE__ */ jsx("rect", {
22950
+ return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx("rect", {
22951
22951
  "data-box-id": id,
22952
22952
  role: "button",
22953
22953
  "aria-label": b.label,
@@ -22973,7 +22973,17 @@ function BoxOverlay({ label, of, boxes, state, onChoose, fillLit = true }) {
22973
22973
  onPointerUp: (e) => e.stopPropagation(),
22974
22974
  onClick: () => choose(id),
22975
22975
  onKeyDown: (e) => move(id, e)
22976
- }, repeat ? `${id}:raised` : id);
22976
+ }), !repeat && b.points && b.points.map((pt, pi) => /* @__PURE__ */ jsx("circle", {
22977
+ "aria-hidden": "true",
22978
+ cx: pt.x,
22979
+ cy: pt.y,
22980
+ r: Math.max(2, Math.min(of.w, of.h) * .01),
22981
+ fill: STROKE[tone],
22982
+ stroke: "var(--card)",
22983
+ strokeWidth: 1,
22984
+ vectorEffect: "non-scaling-stroke",
22985
+ pointerEvents: "none"
22986
+ }, `${id}:pt:${pi}`))] }, repeat ? `${id}:raised` : id);
22977
22987
  })
22978
22988
  });
22979
22989
  }
@@ -26371,23 +26381,27 @@ const CHART_COLOURS = [
26371
26381
  function chartColour(index) {
26372
26382
  return CHART_COLOURS[(index % CHART_COLOURS.length + CHART_COLOURS.length) % CHART_COLOURS.length];
26373
26383
  }
26374
- /** Measure an element's pixel width with ResizeObserver, falling back cleanly in jsdom/SSR. */
26375
- function useContainerWidth(ref, fallback = 560) {
26384
+ /**
26385
+ * Measure a container's pixel width with ResizeObserver, falling back cleanly in jsdom/SSR.
26386
+ * Returns a callback ref so conditionally mounted containers (e.g. tab/mode switches) always
26387
+ * reattach observation when mounted and disconnect when unmounted.
26388
+ */
26389
+ function useContainerWidth(fallback = 560) {
26390
+ const [node, setNode] = React.useState(null);
26376
26391
  const [width, setWidth] = React.useState(fallback);
26377
26392
  React.useLayoutEffect(() => {
26378
- const el = ref.current;
26379
- if (!el) return;
26393
+ if (!node) return;
26380
26394
  const measure = () => {
26381
- const w = el.getBoundingClientRect().width;
26395
+ const w = node.getBoundingClientRect().width;
26382
26396
  if (w > 0) setWidth(Math.round(w));
26383
26397
  };
26384
26398
  measure();
26385
26399
  if (typeof ResizeObserver === "undefined") return;
26386
26400
  const ro = new ResizeObserver(measure);
26387
- ro.observe(el);
26401
+ ro.observe(node);
26388
26402
  return () => ro.disconnect();
26389
- }, [ref]);
26390
- return width;
26403
+ }, [node]);
26404
+ return [setNode, width];
26391
26405
  }
26392
26406
 
26393
26407
  // src/components/forest-plot.tsx
@@ -26403,8 +26417,7 @@ const VERDICT_COLOUR = {
26403
26417
  };
26404
26418
  /** Horizontal forest plot of paired effect estimates with confidence intervals, minimum-effect band, guardrails and verdicts. */
26405
26419
  function ForestPlot({ label, rows, formatValue, reference = 0, referenceLabel = "No change", minEffect, minEffectLabel, worseLabel = "Worse", betterLabel = "Better", note, selectedId, onSelect, className }) {
26406
- const plotRef = React.useRef(null);
26407
- const plotWidth = useContainerWidth(plotRef, 360);
26420
+ const [plotRef, plotWidth] = useContainerWidth(360);
26408
26421
  const scale = React.useMemo(() => {
26409
26422
  const vals = [reference];
26410
26423
  if (minEffect !== void 0 && Number.isFinite(minEffect)) vals.push(minEffect);
@@ -26454,7 +26467,7 @@ function ForestPlot({ label, rows, formatValue, reference = 0, referenceLabel =
26454
26467
  /* @__PURE__ */ jsx("div", {
26455
26468
  className: "overflow-x-auto",
26456
26469
  children: /* @__PURE__ */ jsxs("div", {
26457
- className: "min-w-[640px]",
26470
+ className: "min-w-160",
26458
26471
  children: [
26459
26472
  /* @__PURE__ */ jsxs("div", {
26460
26473
  className: "grid items-end gap-3 border-b border-border bg-surface-sunken px-4 py-1.5 type-caption text-muted-foreground",
@@ -26522,7 +26535,7 @@ function ForestPlot({ label, rows, formatValue, reference = 0, referenceLabel =
26522
26535
  })]
26523
26536
  }),
26524
26537
  /* @__PURE__ */ jsx("div", {
26525
- className: "h-[44px] w-full",
26538
+ className: "h-11 w-full",
26526
26539
  children: /* @__PURE__ */ jsxs("svg", {
26527
26540
  width: plotWidth,
26528
26541
  height: ROW_H$1,
@@ -26661,12 +26674,11 @@ function ForestPlot({ label, rows, formatValue, reference = 0, referenceLabel =
26661
26674
  ] });
26662
26675
  if (interactive) return /* @__PURE__ */ jsx("div", {
26663
26676
  role: "listitem",
26664
- children: /* @__PURE__ */ jsx("button", {
26665
- type: "button",
26666
- onClick: () => onSelect?.(row),
26677
+ children: /* @__PURE__ */ jsx(Button$1, {
26678
+ onPress: () => onSelect?.(row),
26667
26679
  "aria-pressed": isSelected,
26668
26680
  style: { gridTemplateColumns: gridCols },
26669
- className: cn("grid w-full items-center gap-3 px-4 py-1 text-left transition-state focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring", isSelected ? "bg-accent" : "hover:bg-muted/60"),
26681
+ className: cn("grid w-full cursor-pointer items-center gap-3 px-4 py-1 text-left transition-state focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring", isSelected ? "bg-accent" : "hover:bg-muted/60"),
26670
26682
  children: content
26671
26683
  })
26672
26684
  }, row.id);
@@ -26795,7 +26807,7 @@ function renderShape(shape, cx, cy, r, fill, stroke, strokeWidth) {
26795
26807
  }
26796
26808
  }
26797
26809
  /** Interactive 2D scatter plot with automatic Pareto frontier, switchable axes, category shapes and detail readout. */
26798
- function ScatterFrontier({ label, points, xAxis, yAxis, showFrontier = true, showIntervals = false, height = 300, caveat, selectedId: controlledSelectedId, onSelect, className }) {
26810
+ function ScatterFrontier({ label, points, xAxis, yAxis, showFrontier = true, quadrants, showIntervals = false, height = 300, caveat, selectedId: controlledSelectedId, onSelect, className }) {
26799
26811
  const xAxes = Array.isArray(xAxis) ? xAxis : [xAxis];
26800
26812
  const yAxes = Array.isArray(yAxis) ? yAxis : [yAxis];
26801
26813
  const [xAxisId, setXAxisId] = React.useState(xAxes[0].id);
@@ -26805,8 +26817,7 @@ function ScatterFrontier({ label, points, xAxis, yAxis, showFrontier = true, sho
26805
26817
  const activeX = xAxes.find((a) => a.id === xAxisId) ?? xAxes[0];
26806
26818
  const activeY = yAxes.find((a) => a.id === yAxisId) ?? yAxes[0];
26807
26819
  const selectedId = controlledSelectedId !== void 0 ? controlledSelectedId : internalSelected;
26808
- const containerRef = React.useRef(null);
26809
- const width = useContainerWidth(containerRef, 560);
26820
+ const [containerRef, width] = useContainerWidth(560);
26810
26821
  const resolved = React.useMemo(() => {
26811
26822
  return points.map((p) => {
26812
26823
  const xv = p.values ? p.values[activeX.id] : p.x;
@@ -27010,7 +27021,98 @@ function ScatterFrontier({ label, points, xAxis, yAxis, showFrontier = true, sho
27010
27021
  activeY.direction === "higher" ? "(higher is better)" : "(lower is better)"
27011
27022
  ]
27012
27023
  }),
27013
- /* @__PURE__ */ jsx("text", {
27024
+ quadrants && (() => {
27025
+ const sx = Math.max(PAD.left, Math.min(PAD.left + innerW, px(quadrants.xSplit)));
27026
+ const sy = Math.max(PAD.top, Math.min(PAD.top + innerH, py(quadrants.ySplit)));
27027
+ const hl = quadrants.highlight;
27028
+ const hlRect = hl === "topRight" ? {
27029
+ x: sx,
27030
+ y: PAD.top,
27031
+ w: PAD.left + innerW - sx,
27032
+ h: sy - PAD.top
27033
+ } : hl === "topLeft" ? {
27034
+ x: PAD.left,
27035
+ y: PAD.top,
27036
+ w: sx - PAD.left,
27037
+ h: sy - PAD.top
27038
+ } : hl === "bottomRight" ? {
27039
+ x: sx,
27040
+ y: sy,
27041
+ w: PAD.left + innerW - sx,
27042
+ h: PAD.top + innerH - sy
27043
+ } : hl === "bottomLeft" ? {
27044
+ x: PAD.left,
27045
+ y: sy,
27046
+ w: sx - PAD.left,
27047
+ h: PAD.top + innerH - sy
27048
+ } : null;
27049
+ return /* @__PURE__ */ jsxs("g", {
27050
+ "aria-hidden": "true",
27051
+ children: [
27052
+ hlRect && hlRect.w > 0 && hlRect.h > 0 && /* @__PURE__ */ jsx("rect", {
27053
+ x: hlRect.x,
27054
+ y: hlRect.y,
27055
+ width: hlRect.w,
27056
+ height: hlRect.h,
27057
+ fill: "var(--primary)",
27058
+ fillOpacity: .07
27059
+ }),
27060
+ /* @__PURE__ */ jsx("line", {
27061
+ x1: sx,
27062
+ x2: sx,
27063
+ y1: PAD.top,
27064
+ y2: PAD.top + innerH,
27065
+ stroke: "var(--muted-foreground)",
27066
+ strokeOpacity: .5,
27067
+ strokeDasharray: "4 4",
27068
+ strokeWidth: 1.2
27069
+ }),
27070
+ /* @__PURE__ */ jsx("line", {
27071
+ x1: PAD.left,
27072
+ x2: PAD.left + innerW,
27073
+ y1: sy,
27074
+ y2: sy,
27075
+ stroke: "var(--muted-foreground)",
27076
+ strokeOpacity: .5,
27077
+ strokeDasharray: "4 4",
27078
+ strokeWidth: 1.2
27079
+ }),
27080
+ quadrants.labels?.topLeft && /* @__PURE__ */ jsx("text", {
27081
+ x: PAD.left + 8,
27082
+ y: PAD.top + 14,
27083
+ fill: "var(--muted-foreground)",
27084
+ fontSize: 10,
27085
+ fontWeight: 600,
27086
+ children: quadrants.labels.topLeft
27087
+ }),
27088
+ quadrants.labels?.topRight && /* @__PURE__ */ jsx("text", {
27089
+ x: PAD.left + innerW - 8,
27090
+ y: PAD.top + 14,
27091
+ textAnchor: "end",
27092
+ fill: hl === "topRight" ? "var(--primary)" : "var(--muted-foreground)",
27093
+ fontSize: 10,
27094
+ fontWeight: 600,
27095
+ children: quadrants.labels.topRight
27096
+ }),
27097
+ quadrants.labels?.bottomLeft && /* @__PURE__ */ jsx("text", {
27098
+ x: PAD.left + 8,
27099
+ y: PAD.top + innerH - 8,
27100
+ fill: "var(--muted-foreground)",
27101
+ fontSize: 10,
27102
+ children: quadrants.labels.bottomLeft
27103
+ }),
27104
+ quadrants.labels?.bottomRight && /* @__PURE__ */ jsx("text", {
27105
+ x: PAD.left + innerW - 8,
27106
+ y: PAD.top + innerH - 8,
27107
+ textAnchor: "end",
27108
+ fill: "var(--muted-foreground)",
27109
+ fontSize: 10,
27110
+ children: quadrants.labels.bottomRight
27111
+ })
27112
+ ]
27113
+ });
27114
+ })(),
27115
+ !quadrants && /* @__PURE__ */ jsx("text", {
27014
27116
  x: betterCornerX,
27015
27117
  y: betterCornerY,
27016
27118
  textAnchor: betterAnchor,
@@ -27179,6 +27281,127 @@ function ScatterFrontier({ label, points, xAxis, yAxis, showFrontier = true, sho
27179
27281
  });
27180
27282
  }
27181
27283
 
27284
+ // src/components/specimen-deck.tsx
27285
+ /** Interactive specimen / A/B showcase deck with pill tabs, prev/next controls and optional auto-advance. */
27286
+ function SpecimenDeck({ label, title, slides, activeId: controlledId, defaultActiveId, onActiveChange, autoAdvanceMs, defaultPlaying = false, className }) {
27287
+ const [internalId, setInternalId] = React.useState(defaultActiveId ?? slides[0]?.id ?? "");
27288
+ const playBtnRef = React.useRef(null);
27289
+ const [playing, setPlaying] = React.useState(() => {
27290
+ if (!defaultPlaying || !autoAdvanceMs) return false;
27291
+ if (typeof window !== "undefined" && window.matchMedia?.("(prefers-reduced-motion: reduce)").matches) return false;
27292
+ return true;
27293
+ });
27294
+ const activeId = controlledId ?? internalId;
27295
+ const currentIdx = Math.max(0, slides.findIndex((s) => s.id === activeId));
27296
+ const current = slides[currentIdx] ?? slides[0];
27297
+ const selectByIndex = React.useCallback((nextIdx) => {
27298
+ if (slides.length === 0) return;
27299
+ const nextId = slides[(nextIdx % slides.length + slides.length) % slides.length].id;
27300
+ if (controlledId === void 0) setInternalId(nextId);
27301
+ onActiveChange?.(nextId);
27302
+ }, [
27303
+ slides,
27304
+ controlledId,
27305
+ onActiveChange
27306
+ ]);
27307
+ React.useEffect(() => {
27308
+ if (!playing || !autoAdvanceMs || slides.length <= 1) return;
27309
+ const timer = window.setInterval(() => {
27310
+ selectByIndex(currentIdx + 1);
27311
+ }, autoAdvanceMs);
27312
+ return () => window.clearInterval(timer);
27313
+ }, [
27314
+ playing,
27315
+ autoAdvanceMs,
27316
+ slides.length,
27317
+ currentIdx,
27318
+ selectByIndex
27319
+ ]);
27320
+ if (!current) return null;
27321
+ return /* @__PURE__ */ jsxs("section", {
27322
+ "aria-roledescription": "carousel",
27323
+ "aria-label": label,
27324
+ onFocusCapture: (e) => {
27325
+ if (playing && e.target !== playBtnRef.current) setPlaying(false);
27326
+ },
27327
+ className: cn("overflow-hidden rounded-surface border border-border bg-card text-card-foreground", className),
27328
+ children: [/* @__PURE__ */ jsxs("div", {
27329
+ className: "flex flex-wrap items-center justify-between gap-2 border-b border-border bg-surface-sunken px-4 py-2.5",
27330
+ children: [
27331
+ /* @__PURE__ */ jsx("span", {
27332
+ className: "type-label text-foreground",
27333
+ children: title ?? label
27334
+ }),
27335
+ /* @__PURE__ */ jsx("div", {
27336
+ role: "group",
27337
+ "aria-label": `${label} slides`,
27338
+ className: "flex flex-wrap items-center gap-1",
27339
+ children: slides.map((s, i) => {
27340
+ const isSelected = i === currentIdx;
27341
+ return /* @__PURE__ */ jsx(Button$1, {
27342
+ "aria-pressed": isSelected,
27343
+ onPress: () => {
27344
+ setPlaying(false);
27345
+ selectByIndex(i);
27346
+ },
27347
+ className: cn("cursor-pointer rounded-pill px-2.5 py-1 type-caption transition-state focus-visible:outline-2 focus-visible:outline-ring", isSelected ? "bg-primary font-medium text-primary-foreground" : "text-muted-foreground hover:bg-muted hover:text-foreground"),
27348
+ children: s.label
27349
+ }, s.id);
27350
+ })
27351
+ }),
27352
+ /* @__PURE__ */ jsxs("div", {
27353
+ className: "flex items-center gap-1",
27354
+ children: [
27355
+ autoAdvanceMs && slides.length > 1 && /* @__PURE__ */ jsx(Button$1, {
27356
+ ref: playBtnRef,
27357
+ "aria-label": playing ? "Pause slideshow" : "Play slideshow",
27358
+ "aria-pressed": playing,
27359
+ onPress: () => setPlaying((p) => !p),
27360
+ className: "cursor-pointer rounded-control border border-border bg-card p-1 text-muted-foreground transition-state hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring",
27361
+ children: playing ? /* @__PURE__ */ jsx(Pause, {
27362
+ "aria-hidden": true,
27363
+ className: "size-3.5"
27364
+ }) : /* @__PURE__ */ jsx(Play, {
27365
+ "aria-hidden": true,
27366
+ className: "size-3.5"
27367
+ })
27368
+ }),
27369
+ /* @__PURE__ */ jsx(Button$1, {
27370
+ "aria-label": "Previous slide",
27371
+ onPress: () => {
27372
+ setPlaying(false);
27373
+ selectByIndex(currentIdx - 1);
27374
+ },
27375
+ className: "cursor-pointer rounded-control border border-border bg-card p-1 text-muted-foreground transition-state hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring",
27376
+ children: /* @__PURE__ */ jsx(ChevronLeft, {
27377
+ "aria-hidden": true,
27378
+ className: "size-4"
27379
+ })
27380
+ }),
27381
+ /* @__PURE__ */ jsx(Button$1, {
27382
+ "aria-label": "Next slide",
27383
+ onPress: () => {
27384
+ setPlaying(false);
27385
+ selectByIndex(currentIdx + 1);
27386
+ },
27387
+ className: "cursor-pointer rounded-control border border-border bg-card p-1 text-muted-foreground transition-state hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring",
27388
+ children: /* @__PURE__ */ jsx(ChevronRight, {
27389
+ "aria-hidden": true,
27390
+ className: "size-4"
27391
+ })
27392
+ })
27393
+ ]
27394
+ })
27395
+ ]
27396
+ }), /* @__PURE__ */ jsx("div", {
27397
+ role: "tabpanel",
27398
+ "aria-label": current.label,
27399
+ className: "p-5",
27400
+ children: current.content
27401
+ }, current.id)]
27402
+ });
27403
+ }
27404
+
27182
27405
  // src/components/metric-distribution.tsx
27183
27406
  const PAD_X = 14;
27184
27407
  const ROW_H = 44;
@@ -27193,10 +27416,8 @@ const ECDF_PAD = {
27193
27416
  function MetricDistribution({ label, series, formatValue, metricLabel, defaultMode = "strip", allowModeSwitch = true, onItemSelect, className }) {
27194
27417
  const [mode, setMode] = React.useState(defaultMode);
27195
27418
  const [hoveredItem, setHoveredItem] = React.useState(null);
27196
- const trackRef = React.useRef(null);
27197
- const trackWidth = useContainerWidth(trackRef, 360);
27198
- const ecdfRef = React.useRef(null);
27199
- const ecdfWidth = useContainerWidth(ecdfRef, 560);
27419
+ const [trackRef, trackWidth] = useContainerWidth(360);
27420
+ const [ecdfRef, ecdfWidth] = useContainerWidth(560);
27200
27421
  const summaries = React.useMemo(() => series.map((s) => ({
27201
27422
  series: s,
27202
27423
  summary: summarizeDistribution(s.items.map((i) => i.value))
@@ -27231,17 +27452,15 @@ function MetricDistribution({ label, series, formatValue, metricLabel, defaultMo
27231
27452
  role: "group",
27232
27453
  "aria-label": "Distribution view",
27233
27454
  className: "inline-flex rounded-control border border-border bg-surface-sunken p-0.5",
27234
- children: [/* @__PURE__ */ jsx("button", {
27235
- type: "button",
27455
+ children: [/* @__PURE__ */ jsx(Button$1, {
27236
27456
  "aria-pressed": mode === "strip",
27237
- onClick: () => setMode("strip"),
27238
- className: cn("rounded-control px-2 py-0.5 type-caption transition-state focus-visible:outline-2 focus-visible:outline-ring", mode === "strip" ? "bg-card font-medium text-foreground" : "text-muted-foreground hover:text-foreground"),
27457
+ onPress: () => setMode("strip"),
27458
+ className: cn("cursor-pointer rounded-control px-2 py-0.5 type-caption transition-state focus-visible:outline-2 focus-visible:outline-ring", mode === "strip" ? "bg-card font-medium text-foreground" : "text-muted-foreground hover:text-foreground"),
27239
27459
  children: "Strip + IQR"
27240
- }), /* @__PURE__ */ jsx("button", {
27241
- type: "button",
27460
+ }), /* @__PURE__ */ jsx(Button$1, {
27242
27461
  "aria-pressed": mode === "ecdf",
27243
- onClick: () => setMode("ecdf"),
27244
- className: cn("rounded-control px-2 py-0.5 type-caption transition-state focus-visible:outline-2 focus-visible:outline-ring", mode === "ecdf" ? "bg-card font-medium text-foreground" : "text-muted-foreground hover:text-foreground"),
27462
+ onPress: () => setMode("ecdf"),
27463
+ className: cn("cursor-pointer rounded-control px-2 py-0.5 type-caption transition-state focus-visible:outline-2 focus-visible:outline-ring", mode === "ecdf" ? "bg-card font-medium text-foreground" : "text-muted-foreground hover:text-foreground"),
27245
27464
  children: "ECDF"
27246
27465
  })]
27247
27466
  })]
@@ -27249,7 +27468,7 @@ function MetricDistribution({ label, series, formatValue, metricLabel, defaultMo
27249
27468
  mode === "strip" ? /* @__PURE__ */ jsx("div", {
27250
27469
  className: "overflow-x-auto",
27251
27470
  children: /* @__PURE__ */ jsxs("div", {
27252
- className: "min-w-[580px]",
27471
+ className: "min-w-145",
27253
27472
  children: [
27254
27473
  /* @__PURE__ */ jsxs("div", {
27255
27474
  className: "grid items-center gap-3 border-b border-border bg-surface-sunken px-4 py-1.5 type-caption text-muted-foreground",
@@ -27288,9 +27507,9 @@ function MetricDistribution({ label, series, formatValue, metricLabel, defaultMo
27288
27507
  children: s.subtitle
27289
27508
  })]
27290
27509
  }),
27291
- /* @__PURE__ */ jsx("div", {
27292
- className: "h-[44px] w-full",
27293
- children: /* @__PURE__ */ jsxs("svg", {
27510
+ /* @__PURE__ */ jsxs("div", {
27511
+ className: "relative h-11 w-full",
27512
+ children: [/* @__PURE__ */ jsxs("svg", {
27294
27513
  width: trackWidth,
27295
27514
  height: ROW_H,
27296
27515
  className: "block h-full w-full overflow-visible",
@@ -27347,17 +27566,41 @@ function MetricDistribution({ label, series, formatValue, metricLabel, defaultMo
27347
27566
  fillOpacity: .78,
27348
27567
  stroke: "var(--card)",
27349
27568
  strokeWidth: .75,
27350
- className: onItemSelect ? "cursor-pointer" : void 0,
27351
- onMouseEnter: () => setHoveredItem({
27569
+ onMouseEnter: !onItemSelect ? () => setHoveredItem({
27352
27570
  seriesLabel: s.label,
27353
27571
  item
27354
- }),
27355
- onMouseLeave: () => setHoveredItem(null),
27356
- onClick: () => onItemSelect?.(s, item)
27572
+ }) : void 0,
27573
+ onMouseLeave: !onItemSelect ? () => setHoveredItem(null) : void 0
27357
27574
  }, item.id);
27358
27575
  })
27359
27576
  ]
27360
- })
27577
+ }), onItemSelect && s.items.map((item) => {
27578
+ if (!Number.isFinite(item.value)) return null;
27579
+ const cx = xStrip(item.value);
27580
+ const cy = ROW_H / 2 + deterministicJitter(`${s.id}:${item.id}`) * 11;
27581
+ const leftPct = cx / Math.max(1, trackWidth) * 100;
27582
+ const topPct = cy / ROW_H * 100;
27583
+ const itemName = item.label ?? item.id;
27584
+ return /* @__PURE__ */ jsx(Button$1, {
27585
+ "aria-label": `${s.label}, ${itemName}: ${formatValue(item.value)}`,
27586
+ onPress: () => onItemSelect(s, item),
27587
+ onHoverStart: () => setHoveredItem({
27588
+ seriesLabel: s.label,
27589
+ item
27590
+ }),
27591
+ onHoverEnd: () => setHoveredItem((prev) => prev?.item.id === item.id ? null : prev),
27592
+ onFocus: () => setHoveredItem({
27593
+ seriesLabel: s.label,
27594
+ item
27595
+ }),
27596
+ onBlur: () => setHoveredItem((prev) => prev?.item.id === item.id ? null : prev),
27597
+ style: {
27598
+ left: `${leftPct}%`,
27599
+ top: `${topPct}%`
27600
+ },
27601
+ className: "absolute size-3 -translate-x-1/2 -translate-y-1/2 cursor-pointer rounded-pill bg-transparent p-0 focus-visible:outline-2 focus-visible:outline-ring"
27602
+ }, item.id);
27603
+ })]
27361
27604
  }),
27362
27605
  /* @__PURE__ */ jsx("div", {
27363
27606
  className: "text-right font-mono type-caption tabular-nums",
@@ -27655,11 +27898,10 @@ function SliceMatrix({ label, columns, rows, formatValue, formatDelta, direction
27655
27898
  return /* @__PURE__ */ jsx("td", {
27656
27899
  style: cellTint(cell?.value, isLowN),
27657
27900
  className: cn("border-l border-border/60 p-0 text-right align-middle", isSelected && "ring-2 ring-inset ring-ring"),
27658
- children: onCellSelect ? /* @__PURE__ */ jsx("button", {
27659
- type: "button",
27660
- onClick: () => onCellSelect(row, col, cell),
27901
+ children: onCellSelect ? /* @__PURE__ */ jsx(Button$1, {
27902
+ onPress: () => onCellSelect(row, col, cell),
27661
27903
  "aria-pressed": isSelected,
27662
- className: "block h-full w-full px-3 py-2 text-right transition-state hover:bg-accent/50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring",
27904
+ className: "block h-full w-full cursor-pointer px-3 py-2 text-right transition-state hover:bg-accent/50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring",
27663
27905
  children: inner
27664
27906
  }) : /* @__PURE__ */ jsx("div", {
27665
27907
  className: "px-3 py-2",
@@ -27754,15 +27996,14 @@ function ConfusionMatrix({ label, rowLabels, colLabels = rowLabels, counts, rowA
27754
27996
  children: count
27755
27997
  }), showPercent && /* @__PURE__ */ jsx("span", {
27756
27998
  className: "type-caption text-muted-foreground",
27757
- children: count === 0 ? "0%" : `${Math.round(share * 100)}%`
27999
+ children: count === 0 ? "0%" : format.share(share)
27758
28000
  })]
27759
28001
  });
27760
28002
  return /* @__PURE__ */ jsx("td", {
27761
28003
  style: cellStyle(rIdx, cIdx, count, rTotal),
27762
28004
  className: cn("border-l border-border/60 p-0 text-right align-middle", isSelected && "ring-2 ring-inset ring-ring"),
27763
- children: onCellSelect ? /* @__PURE__ */ jsx("button", {
27764
- type: "button",
27765
- onClick: () => onCellSelect({
28005
+ children: onCellSelect ? /* @__PURE__ */ jsx(Button$1, {
28006
+ onPress: () => onCellSelect({
27766
28007
  row: rIdx,
27767
28008
  col: cIdx,
27768
28009
  rowLabel: rLabel,
@@ -27771,7 +28012,7 @@ function ConfusionMatrix({ label, rowLabels, colLabels = rowLabels, counts, rowA
27771
28012
  }),
27772
28013
  "aria-pressed": isSelected,
27773
28014
  "aria-label": `${rowAxisLabel} ${rLabel}, ${colAxisLabel} ${cLabel}: ${count}`,
27774
- className: "block h-full w-full px-3 py-2 text-right transition-state hover:bg-accent/50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring",
28015
+ className: "block h-full w-full cursor-pointer px-3 py-2 text-right transition-state hover:bg-accent/50 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring",
27775
28016
  children: inner
27776
28017
  }) : /* @__PURE__ */ jsx("div", {
27777
28018
  className: "px-3 py-2",
@@ -27847,9 +28088,8 @@ function StageCard({ stage, selected, onSelect }) {
27847
28088
  })
27848
28089
  ] });
27849
28090
  const baseClass = cn("w-full rounded-surface border bg-card p-3 text-left transition-state", selected ? "border-primary bg-accent ring-1 ring-ring" : "border-border");
27850
- if (onSelect) return /* @__PURE__ */ jsx("button", {
27851
- type: "button",
27852
- onClick: () => onSelect(stage),
28091
+ if (onSelect) return /* @__PURE__ */ jsx(Button$1, {
28092
+ onPress: () => onSelect(stage),
27853
28093
  "aria-pressed": selected,
27854
28094
  className: cn(baseClass, "cursor-pointer hover:border-primary/60 hover:bg-muted/40 focus-visible:outline-2 focus-visible:outline-ring"),
27855
28095
  children: inner
@@ -27883,7 +28123,7 @@ function PipelineDiagram({ label, steps, note, summary, selectedId, onSelect, cl
27883
28123
  const isLast = idx === steps.length - 1;
27884
28124
  const edgeLabel = step.edgeLabel;
27885
28125
  return /* @__PURE__ */ jsxs(React.Fragment, { children: [/* @__PURE__ */ jsx("li", {
27886
- className: "min-w-[190px] flex-1",
28126
+ className: "min-w-48 flex-1",
27887
28127
  children: isParallelStep(step) ? /* @__PURE__ */ jsxs("div", {
27888
28128
  className: "rounded-surface border border-dashed border-border bg-surface-sunken/60 p-2.5",
27889
28129
  children: [step.groupLabel && /* @__PURE__ */ jsx("div", {
@@ -27909,7 +28149,7 @@ function PipelineDiagram({ label, steps, note, summary, selectedId, onSelect, cl
27909
28149
  /* @__PURE__ */ jsx(ArrowRight, { className: "hidden size-4 md:block" }),
27910
28150
  /* @__PURE__ */ jsx(ArrowDown, { className: "block size-4 md:hidden" }),
27911
28151
  edgeLabel && /* @__PURE__ */ jsx("span", {
27912
- className: "max-w-[96px] text-center font-mono type-caption",
28152
+ className: "max-w-24 text-center font-mono type-caption",
27913
28153
  children: edgeLabel
27914
28154
  })
27915
28155
  ]
@@ -27934,5 +28174,5 @@ function PipelineDiagram({ label, steps, note, summary, selectedId, onSelect, cl
27934
28174
  });
27935
28175
  }
27936
28176
 
27937
- export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, Balance, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, CHART_COLOURS, CLOCK_FACE_STYLES, CLOCK_STYLES, COINS, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, Clock, ClockFace, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, ConfusionMatrix, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DIGITAL_CLOCK_STYLES, DataTable, DataView$1 as DataView, Density, Dialog, DigitalClock, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, EventLog, FACINGS, FIT, FRACTION_OUTLINES, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FillLevel, FilmStrip, FolderPicker, ForestPlot, FractionShape, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, JsonView, KeysLegend, LEVEL_FLOOR_DB, LengthBar, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricDistribution, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, Money, NBSP, NOTES, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PartialDateField, PauseButton, PipelineDiagram, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RangeSlider, RateChoice, ReadAlong, RegionEditor, RichText, RowAction, SOLID_SHAPES, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, ScatterFrontier, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SetClock, ShortcutEditor, SideNav, Skeleton, SliceMatrix, Slider, Solid, SortableList, SpanActions, SpanStrip, SpeakerTimeline, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelinePlayer, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, TurnArrow, UNCLEAR, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, applyOp, assignTurns, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, chartColour, checkKey, clampToRoom, clampViewport, clipsQueryKey, clockParts, clockWords, cn, coinOutline, colorSchemeScript, commandShortcut, continues, copyTurns, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, dayPart, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, deterministicJitter, diffWords, differences, digitalTime, diskThresholds, drawRect, drawingToSvg, ease, ecdfPoints, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, fillWords, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, formatPartialDate, fractionParts, fractionWords, frameAt, freshId, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, hourAt, inkMatch, inputLevelThresholds, invertOp, isDigitalStyle, isDoubtful, isRefusal, isReservedChord, isSpeaking, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, jsonBranchPaths, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, mergeWithNext, minutesAt, moneyWords, moveGutter, moveMinuteHand, movePoints, moveRect, newStrokeId, newVoiceName, nextBreak, niceScale, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, paretoFrontier, parseChord, parseInline, parsePartialDate, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, pointsBox, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, removeTurns, renameVoice, replay, resample, resamplePeaks, rescaleDrawing, resizeRect, rgbaToBlob, rmsDb, romanHour, safeHref, sayPosition, serialiseSort, setEdge, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, solidWords, sortRows, speak, speechLevel, splitRect, splitTurn, staleOf, stepId, stepMinuteHand, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, summariseWorkflow, summarizeDistribution, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnWords, turned, turnedSize, turnsAt, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useCountdown, useDifference, useDrawing, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useReadAloud, useRebindableShortcuts, useRecorder, useReserve, useRevealed, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeaking, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, voicesOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
28177
+ export { ActiveList, Alert, AlertDialog, AppShell, AsyncButton, BRUSHES, Balance, BookViewer, BoxList, BoxOverlay, BoxedPicture, Breadcrumb, BulkBar, Button, ButtonLink, ByteView, CHART_COLOURS, CLOCK_FACE_STYLES, CLOCK_STYLES, COINS, COLOR_SCHEME_STORAGE_KEY, Checkbox, ChoiceGrid, ChoiceGridSkeleton, ChoiceGroup, ClipsProvider, Clock, ClockFace, ColorField, ColorSchemeChoice, CommandLegend, CommandMenu, Compare, CompareAudio, CompareGrid, CompareText, CompareVideo, CompareVideoGrid, Composer, CompositionBar, Concealed, ConfusionMatrix, Console, ContextMenu, Conversation, CursorScope, DEFAULT_PALETTE, DEFAULT_TOLERANCE, DIGITAL_CLOCK_STYLES, DataTable, DataView$1 as DataView, Density, Dialog, DigitalClock, Disclosure, Done, DragSource, DrawingLayer, DrawingToolbar, EditListPlayer, EmptyState, EventLog, FACINGS, FIT, FRACTION_OUTLINES, Field, FileButton, FileDropOverlay, FileDropZone, FileOutcomes, FillLevel, FilmStrip, FolderPicker, ForestPlot, FractionShape, FullscreenFrame, Glimpse, HttpError, INK_COLOURS, IconButton, InfiniteList, Input, InputLevel, Inspector, InspectorSection, JobStatus, JobsTable, JsonView, KeysLegend, LEVEL_FLOOR_DB, LengthBar, Lightbox, LineChart, LineChartGroup, LinkCard, LinkCardList, ListeningLevel, LoadError, LoadMore, MAX_SCALE, MAX_SIDE, MIN_SCALE, MISSING, Mark, MarkSummary, MarkableText, MediaContents, MediaGroup, MediaPlayer, MediaStage, Menu, Meter, Metric, MetricDistribution, MetricStrip, MicrophoneContext, MicrophoneError, MissingFile, Money, NBSP, NOTES, NativeSelect, NumberField, OutboxStatus, PALETTE_STORAGE_KEY, PageHeader, PairJudge, PairVote, PaletteChoice, Pane, PartialDateField, PauseButton, PipelineDiagram, PixelImage, PlaceBoard, PlayWindowButton, PlayerNotice, Popover, PropertyList, PropertyRow, RangeSlider, RateChoice, ReadAlong, RegionEditor, RichText, RowAction, SOLID_SHAPES, SPEECH_RATES, STRATA_DRAG_TYPE, SaveStatus, SayAgain, SayPicture, ScatterFrontier, ScheduleTable, SecretField, SeekBar, SelectableGrid, SelectableGridSkeleton, SequenceTimeline, SetClock, ShortcutEditor, SideNav, Skeleton, SliceMatrix, Slider, Solid, SortableList, SpanActions, SpanStrip, SpeakerTimeline, SpecimenDeck, Split, StageGuides, StaleNotice, Status, StrataQueryProvider, StrataToastRegion, Switch, SystemPanel, TableSkeleton, Tabs, TakeLevel, TextLink, Textarea, ThemeProvider, Thumbnail, ThumbnailSkeleton, TileGrid, TileGridSkeleton, TimeReadout, Timeline, TimelinePlayer, TimelineZoomControls, Toggle, ToggleGroup, Toolbar, ToolbarSeparator, Tooltip, TranscriptView, Transport, Tree, TurnArrow, UNCLEAR, UndoBar, ViewOptions, ViewportFrame, VirtualList, VolumeControl, Waveform, WorkflowSteps, WorkflowSummary, Workspace, WorkspaceBar, actualPixelsScale, ancestorsOf, apiPage, appBase, applyOp, assignTurns, boxViewport, browserMicrophone, buttonVariants, canFullscreen, canPlayClips, canSay, canSpeak, chartColour, checkKey, clampToRoom, clampViewport, clipsQueryKey, clockParts, clockWords, cn, coinOutline, colorSchemeScript, commandShortcut, continues, copyTurns, countMarks, createApi, createFormat, createOutbox, createQueryClient, createReserve, createSegmenter, createTypedApi, crossedThreshold, currentItem, currentOf, curvePoints, dayPart, describeActionError, describeHttpError, describeRegion, describeWorkflowSummary, detectPlatform, deterministicJitter, diffWords, differences, digitalTime, diskThresholds, drawRect, drawingToSvg, ease, ecdfPoints, editTimeOf, editTimes, emptyDrawing, encodeWav, errorPayload, explainMicrophoneError, feedbackMarker, fetchJson, fieldErrorsOf, fillWords, filterMarkup, findPage, fitPoints, fitRect, followAim, format, formatChord, formatPartialDate, fractionParts, fractionWords, frameAt, freshId, gainToVolume, geo, gridPoints, gutterOf, hitsStroke, hourAt, inkMatch, inputLevelThresholds, invertOp, isDigitalStyle, isDoubtful, isRefusal, isReservedChord, isSpeaking, isTaskRunning, isTypingTarget, isWorkflowRunning, jobProgressText, joinMediaGroup, joinRects, joinSamples, jsonBranchPaths, keyName, labelOf, lerpRect, locateInEdit, logScale, loudnessOf, marksFor, matchEntities, matchGains, matchesAccept, matchesChord, measureLoudness, mediaStatRows, mergeWithNext, minutesAt, moneyWords, moveGutter, moveMinuteHand, movePoints, moveRect, newStrokeId, newVoiceName, nextBreak, niceScale, noOverlap, normaliseAngle, pageName, paletteScript, palettes, parentOf, paretoFrontier, parseChord, parseInline, parsePartialDate, parseRichText, parseSort, peakDb, peakGain, peaksFromAudio, phraseAt, phraseDoubtful, phraseOfWordId, pickEvenly, pickVoice, pixelZoom, plainText, pointsBox, rangeBetween, readErrorBody, readPixels, readingOrder, regionShares, regionStyle, removeTurns, renameVoice, replay, resample, resamplePeaks, rescaleDrawing, resizeRect, rgbaToBlob, rmsDb, romanHour, safeHref, sayPosition, serialiseSort, setEdge, settleCut, simplifyPoints, skipAction, smoothPath, snapToGrid, solidWords, sortRows, speak, speechLevel, splitRect, splitTurn, staleOf, stepId, stepMinuteHand, stepOnGrid, stopSpeaking, strokeAt, strokeBox, strokeShape, summariseWorkflow, summarizeDistribution, textOf, tickLabel, tickStep, ticksBetween, toDate, toLoad, toPeakPair, toast, toastTimeout, transportShortcuts, turnRect, turnWords, turned, turnedSize, turnsAt, typeSteps, useActiveItem, useAsyncAction, useAttachedSource, useAutoRecorder, useAutoSave, useBookUrl, useBoxes, useChoices, useClientWork, useClips, useColorScheme, useCommands, useCountdown, useDifference, useDrawing, useEditList, useExpanded, useFileIntake, useHistory, useHistoryState, useHotkeys, useInView, useInfiniteLoad, useInkMatch, useJob, useJobAction, useLeaveGuard, useLightboxUrl, useLoad, useMediaElement, useMediaSpans, useMediaStats, useMicrophone, useObjectUrl, useOutbox, useOutboxStarted, usePalette, usePlayerWarnings, usePoll, useReadAloud, useRebindableShortcuts, useRecorder, useReserve, useRevealed, useSayOnShow, useSearchParam, useSelection, useSettledStatus, useSharedCursor, useSpeaking, useSpeech, useSystemColorScheme, useSystemInfo, useTimeline, useTimelineZoom, useUndoable, useViewOptions, useViewPointers, useViewport, useWheelZoom, useWorkflowRun, useWorkspaceState, valueAt, viewOf, viewsOf, voicesOf, widthsOf, withBase, wordAt, wordId, zoomAt, zoomToBox };
27938
28178
  //# sourceMappingURL=index.js.map