strata-react 1.0.20 → 1.0.21
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/UPGRADING.md +1 -0
- package/dist/components/line-chart.d.ts +3 -1
- package/dist/index.js +27 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/UPGRADING.md
CHANGED
|
@@ -13,6 +13,7 @@ Every PR that changes what an app sees adds a line here (see `CLAUDE.md`, "Chang
|
|
|
13
13
|
|
|
14
14
|
## After v0.1.17 (2026-11-11 to 2026-11-12)
|
|
15
15
|
|
|
16
|
+
- `LineChart` no longer marks its last point "<value> now" when `current` is set (the rule, dot and label at the end of the line are gone; `current` already says where now is). A chart that has `current` and wants the end marked passes `end="now"`; a chart without `current` that does not want it passes `end="none"`. Baselines of charts with `current` change.
|
|
16
17
|
- `SeekBar` with a `duration` of 0, `NaN` or `Infinity` (or `null`, now allowed) is drawn disabled; before it was enabled with the thumb at 0. Nothing to change unless a test seeks a bar with no duration.
|
|
17
18
|
- Arrows and macOS modifiers in `KeysLegend`, `CommandLegend`, menu shortcuts and tooltip hints are drawn as icons, each followed by a screen-reader name (`←` reads "left arrow", `⌘` "Command"), so the text no longer contains the symbol: a test that queries `"j or ↓"` queries `"j or down arrow"`, and `"⌘Z"` is `"Command Z"`. Their baselines change a little.
|
|
18
19
|
- The dim behind a `Dialog`, `AlertDialog`, `CommandMenu` and full-screen view is black at an alpha (the `scrim` utility), not `foreground`: in a dark theme it now dims the page instead of brightening it. Dark baselines of anything with an open overlay change.
|
|
@@ -34,6 +34,8 @@ export type LineChartProps = {
|
|
|
34
34
|
}[];
|
|
35
35
|
/** Says what the colours mean, shown beside the legend swatch when `colourScale` is set. */
|
|
36
36
|
colourScaleLabel?: string;
|
|
37
|
+
/** What the end of the line is. `"now"` marks the last reading with a rule, a dot and "<value> now": right for a live reading, where the last point is the present. `"none"` leaves it unmarked: right for a series whose x is not time running up to now (an elevation profile, where the last point is the finish). Default `"now"`, or `"none"` when `current` is set, since `current` already says where now is. The peak label stays either way. */
|
|
38
|
+
end?: "now" | "none";
|
|
37
39
|
/** The current x, supplied by the app and drawn as a rule with its value ("now" in a replay, a playhead). Cheap to update often. */
|
|
38
40
|
current?: number;
|
|
39
41
|
/** The value at the rule, as a sentence part. Default: `formatX` and the value read off the line. */
|
|
@@ -69,4 +71,4 @@ export declare function yScale(values: number[], pin?: {
|
|
|
69
71
|
*/
|
|
70
72
|
export declare function fitTicks(ticks: number[], scale: (x: number) => number, widthOf: (t: number) => number, gap?: number): number[];
|
|
71
73
|
/** One measured series, drawn in real pixels, with the peak and current readings labelled on the chart and every reading in a screen-reader table. Optional plan, threshold band and `colourScale`. */
|
|
72
|
-
export declare function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, formatX, xLabel, formatY, xTicks, yMin, yMax, colour, colourScale, colourScaleLabel, current, formatCurrent, readout, onPick, area, height, className, }: LineChartProps): React.JSX.Element;
|
|
74
|
+
export declare function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, formatX, xLabel, formatY, xTicks, yMin, yMax, colour, colourScale, colourScaleLabel, current, end, formatCurrent, readout, onPick, area, height, className, }: LineChartProps): React.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -5452,7 +5452,7 @@ function fitTicks(ticks, scale, widthOf, gap = 12) {
|
|
|
5452
5452
|
return sorted.slice(0, 1);
|
|
5453
5453
|
}
|
|
5454
5454
|
/** One measured series, drawn in real pixels, with the peak and current readings labelled on the chart and every reading in a screen-reader table. Optional plan, threshold band and `colourScale`. */
|
|
5455
|
-
function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, formatX, xLabel = "Time", formatY, xTicks, yMin, yMax, colour = "var(--chart-1)", colourScale, colourScaleLabel, current, formatCurrent, readout, onPick, area, height = 280, className }) {
|
|
5455
|
+
function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, formatX, xLabel = "Time", formatY, xTicks, yMin, yMax, colour = "var(--chart-1)", colourScale, colourScaleLabel, current, end, formatCurrent, readout, onPick, area, height = 280, className }) {
|
|
5456
5456
|
const [ref, width] = useWidth();
|
|
5457
5457
|
const gradientId = `heat-${React.useId().replace(/[^\w-]/g, "")}`;
|
|
5458
5458
|
const all = [...series, ...planned ?? []];
|
|
@@ -5486,6 +5486,7 @@ function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, fo
|
|
|
5486
5486
|
]);
|
|
5487
5487
|
const path = (pts) => pts.map((p, i) => `${i ? "L" : "M"}${sx(p.x).toFixed(1)},${sy(p.y).toFixed(1)}`).join("");
|
|
5488
5488
|
const last = series[series.length - 1];
|
|
5489
|
+
const showEnd = (end ?? (current === void 0 ? "now" : "none")) === "now";
|
|
5489
5490
|
const peak = series.reduce((a, b) => b.y > a.y ? b : a, series[0]);
|
|
5490
5491
|
const stops = colourScale ? [...colourScale].sort((a, b) => a.at - b.at) : [];
|
|
5491
5492
|
/** The colour a value lands on: the highest stop at or below it. Used for the labelled points. */
|
|
@@ -5571,27 +5572,29 @@ function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, fo
|
|
|
5571
5572
|
className: "fill-foreground type-caption tabular-nums",
|
|
5572
5573
|
children: [formatY(peak.y), " peak"]
|
|
5573
5574
|
}),
|
|
5574
|
-
/* @__PURE__ */
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5578
|
-
|
|
5579
|
-
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
|
|
5585
|
-
|
|
5586
|
-
|
|
5587
|
-
|
|
5588
|
-
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5575
|
+
showEnd && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
5576
|
+
/* @__PURE__ */ jsx("line", {
|
|
5577
|
+
x1: sx(last.x),
|
|
5578
|
+
x2: sx(last.x),
|
|
5579
|
+
y1: pad.top,
|
|
5580
|
+
y2: pad.top + h,
|
|
5581
|
+
stroke: "var(--foreground)",
|
|
5582
|
+
strokeWidth: 1
|
|
5583
|
+
}),
|
|
5584
|
+
/* @__PURE__ */ jsx("circle", {
|
|
5585
|
+
cx: sx(last.x),
|
|
5586
|
+
cy: sy(last.y),
|
|
5587
|
+
r: 3.5,
|
|
5588
|
+
fill: colourAt(last.y)
|
|
5589
|
+
}),
|
|
5590
|
+
/* @__PURE__ */ jsxs("text", {
|
|
5591
|
+
x: sx(last.x) - 8,
|
|
5592
|
+
y: sy(last.y) - 10,
|
|
5593
|
+
textAnchor: "end",
|
|
5594
|
+
className: "fill-foreground type-label tabular-nums",
|
|
5595
|
+
children: [formatY(last.y), " now"]
|
|
5596
|
+
})
|
|
5597
|
+
] })
|
|
5595
5598
|
] }), [
|
|
5596
5599
|
width,
|
|
5597
5600
|
height,
|
|
@@ -5605,7 +5608,8 @@ function LineChart({ label, series, seriesLabel, planned, plannedLabel, band, fo
|
|
|
5605
5608
|
colourScale,
|
|
5606
5609
|
formatX,
|
|
5607
5610
|
formatY,
|
|
5608
|
-
area
|
|
5611
|
+
area,
|
|
5612
|
+
showEnd
|
|
5609
5613
|
]);
|
|
5610
5614
|
const tableEl = React.useMemo(() => /* @__PURE__ */ jsx("div", {
|
|
5611
5615
|
className: "sr-only",
|