@xeonr/platform-ui 1.12.2 → 1.13.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.
- package/dist/auth/AuthConsent.d.ts +48 -3
- package/dist/auth/AuthConsent.d.ts.map +1 -1
- package/dist/auth/AuthConsent.js +181 -8
- package/dist/auth/AuthConsent.js.map +1 -1
- package/dist/auth/AuthPanel.d.ts.map +1 -1
- package/dist/auth/AuthPanel.js +8 -0
- package/dist/auth/AuthPanel.js.map +1 -1
- package/dist/auth.d.ts +1 -1
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +1 -1
- package/dist/auth.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/kit/ChartFrame.d.ts.map +1 -1
- package/dist/kit/ChartFrame.js +96 -13
- package/dist/kit/ChartFrame.js.map +1 -1
- package/dist/kit/ChartTypes.d.ts.map +1 -1
- package/dist/kit/ChartTypes.js +73 -13
- package/dist/kit/ChartTypes.js.map +1 -1
- package/dist/kit/Charts.d.ts +9 -1
- package/dist/kit/Charts.d.ts.map +1 -1
- package/dist/kit/Charts.js +167 -22
- package/dist/kit/Charts.js.map +1 -1
- package/dist/kit/Graph.d.ts.map +1 -1
- package/dist/kit/Graph.js +103 -17
- package/dist/kit/Graph.js.map +1 -1
- package/dist/kit/Sparkline.d.ts +7 -1
- package/dist/kit/Sparkline.d.ts.map +1 -1
- package/dist/kit/Sparkline.js +6 -3
- package/dist/kit/Sparkline.js.map +1 -1
- package/dist/kit/graphCircuit.d.ts +138 -0
- package/dist/kit/graphCircuit.d.ts.map +1 -0
- package/dist/kit/graphCircuit.js +313 -0
- package/dist/kit/graphCircuit.js.map +1 -0
- package/dist/kit/graphLayout.d.ts +82 -0
- package/dist/kit/graphLayout.d.ts.map +1 -1
- package/dist/kit/graphLayout.js +314 -0
- package/dist/kit/graphLayout.js.map +1 -1
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +2 -1
- package/dist/theme/ThemeProvider.js.map +1 -1
- package/dist/theme/ThemeScope.d.ts.map +1 -1
- package/dist/theme/ThemeScope.js +2 -1
- package/dist/theme/ThemeScope.js.map +1 -1
- package/dist/theme/language.d.ts +5 -0
- package/dist/theme/language.d.ts.map +1 -0
- package/dist/theme/language.js +20 -0
- package/dist/theme/language.js.map +1 -0
- package/dist/theme/tokens.d.ts +15 -0
- package/dist/theme/tokens.d.ts.map +1 -1
- package/dist/theme/tokens.js +76 -1
- package/dist/theme/tokens.js.map +1 -1
- package/package.json +1 -1
package/dist/kit/Charts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Charts.d.ts","sourceRoot":"","sources":["../../src/kit/Charts.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4H,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Charts.d.ts","sourceRoot":"","sources":["../../src/kit/Charts.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4H,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAMjK,OAAO,EAC0E,QAAQ,EACvF,KAAK,SAAS,EAAE,KAAK,SAAS,EAC/B,MAAM,iBAAiB,CAAC;AAYzB,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,CAAC;AAMpC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CACpC;AAED,sIAAsI;AACtI,MAAM,WAAW,SAAS;IAAG,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAA;CAAE;AACtE,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM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AAC,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;IACjD,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,SAAS,CAAC;IACpC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CACvD,+BAYA"}
|
package/dist/kit/Charts.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
3
|
-
import styled from "styled-components";
|
|
3
|
+
import styled, { css, keyframes } from "styled-components";
|
|
4
4
|
import { v } from "../theme/tokens.js";
|
|
5
|
+
import { useDesignLanguage } from "../theme/language.js";
|
|
5
6
|
import { fmtCount } from "./Facet.js";
|
|
6
7
|
import { LegendChips, LegendNote } from "./ChartFrame.js";
|
|
7
8
|
import { CHART_SIZES, TONE_COLOUR, niceTicks, rampToken, spaced, stepLabel, timeDetail, timeTick, timeTicks, useChartSize } from "./chartScale.js";
|
|
@@ -60,6 +61,7 @@ function publish(key, t, from) {
|
|
|
60
61
|
// ---------------------------------------------------------------------------
|
|
61
62
|
// Styles
|
|
62
63
|
// ---------------------------------------------------------------------------
|
|
64
|
+
const pulse = keyframes`from { transform: scale(0.5); opacity: 0.75; } to { transform: scale(1.9); opacity: 0; }`;
|
|
63
65
|
const Wrap = styled.div.withConfig({ componentId: "sc-pigh48-0" })`min-width: 0;`;
|
|
64
66
|
const Plot = styled.div.withConfig({ componentId: "sc-pigh48-1" })`position: relative; min-width: 0;`;
|
|
65
67
|
const PlotSvg = styled.svg.withConfig({ componentId: "sc-pigh48-2" })`
|
|
@@ -72,6 +74,9 @@ const PlotSvg = styled.svg.withConfig({ componentId: "sc-pigh48-2" })`
|
|
|
72
74
|
&:focus { outline: none; }
|
|
73
75
|
&:focus-visible { outline: 2px solid ${v.brand55}; outline-offset: 2px; border-radius: min(4px, ${v.rCtl}); }
|
|
74
76
|
text { font-family: ${v.mono}; font-variant-numeric: tabular-nums; }
|
|
77
|
+
/* the newest sample of the series in focus, in a language that lights its charts */
|
|
78
|
+
.head-ring { transform-box: fill-box; transform-origin: center; animation: ${pulse} 2.4s ease-out infinite; }
|
|
79
|
+
@media (prefers-reduced-motion: reduce) { .head-ring { animation: none; } }
|
|
75
80
|
`;
|
|
76
81
|
const Note = styled.div.withConfig({ componentId: "sc-pigh48-3" })`
|
|
77
82
|
height: ${(p) => p.$h}px; display: grid; place-items: center;
|
|
@@ -94,6 +99,23 @@ const Tip = styled.div.withConfig({ componentId: "sc-pigh48-5" })`
|
|
|
94
99
|
z-index: ${v.zPop};
|
|
95
100
|
.t { color: ${v.faint}; margin-bottom: 4px; font-family: ${v.mono}; white-space: nowrap; }
|
|
96
101
|
.more { color: ${v.faint}; margin-top: 2px; }
|
|
102
|
+
/* A lit language's readout is a block: the instant on an inverse bar, the
|
|
103
|
+
bucket at its far end, and a bar in the tone under the rows when the
|
|
104
|
+
bucket is over a threshold that says which side is the breach. */
|
|
105
|
+
${(p) => p.$lit ? css`
|
|
106
|
+
padding: 0;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
font-family: ${v.mono};
|
|
109
|
+
.t {
|
|
110
|
+
display: flex; justify-content: space-between; gap: 14px;
|
|
111
|
+
margin: 0; padding: 1px 8px;
|
|
112
|
+
background: ${v.text}; color: ${v.surface};
|
|
113
|
+
font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
|
|
114
|
+
}
|
|
115
|
+
.rows { padding: 5px 8px 6px; }
|
|
116
|
+
.more { margin: 0; padding: 0 8px 5px; }
|
|
117
|
+
.over { padding: 1px 8px; color: ${v.surface}; font-weight: 600; letter-spacing: 0.06em; white-space: nowrap; }
|
|
118
|
+
` : ""}
|
|
97
119
|
`;
|
|
98
120
|
const TipRow = styled.div.withConfig({ componentId: "sc-pigh48-6" })`
|
|
99
121
|
display: grid;
|
|
@@ -113,6 +135,30 @@ const TipSwatch = styled.i.withConfig({ componentId: "sc-pigh48-7" })`
|
|
|
113
135
|
width: 10px; height: ${(p) => p.$dashed ? 0 : 3}px; border-radius: 2px;
|
|
114
136
|
background: ${(p) => p.$dashed ? "none" : p.$c};
|
|
115
137
|
border-top: ${(p) => p.$dashed ? `2px dashed ${p.$c}` : "0"};
|
|
138
|
+
/* a block per series; an outlined one for a compare or a reference */
|
|
139
|
+
${(p) => p.$lit ? css`
|
|
140
|
+
width: 8px; height: 8px; border-radius: 0;
|
|
141
|
+
border: ${p.$dashed ? `1px solid ${p.$c}` : "0"};
|
|
142
|
+
` : ""}
|
|
143
|
+
`;
|
|
144
|
+
// The crosshair's reading on an axis, in a lit language: the instant on the
|
|
145
|
+
// time axis, and the value of the series in focus on the value axis.
|
|
146
|
+
const AxisChip = styled.span.withConfig({ componentId: "sc-pigh48-8" })`
|
|
147
|
+
position: absolute;
|
|
148
|
+
pointer-events: none;
|
|
149
|
+
display: inline-flex;
|
|
150
|
+
align-items: center;
|
|
151
|
+
justify-content: center;
|
|
152
|
+
height: 17px;
|
|
153
|
+
padding: 0 5px;
|
|
154
|
+
font-family: ${v.mono};
|
|
155
|
+
font-size: 10px;
|
|
156
|
+
font-weight: ${(p) => p.$on ? 600 : 400};
|
|
157
|
+
font-variant-numeric: tabular-nums;
|
|
158
|
+
white-space: nowrap;
|
|
159
|
+
color: ${(p) => p.$on ? v.surface : v.text};
|
|
160
|
+
background: ${(p) => p.$on ?? v.surface3};
|
|
161
|
+
border: ${(p) => p.$on ? "0" : `1px solid ${v.line2}`};
|
|
116
162
|
`;
|
|
117
163
|
const MAX_TIP_ROWS = 12;
|
|
118
164
|
/** Splits aligned values into the unbroken runs of reported samples; a missing one ends the run. */
|
|
@@ -141,6 +187,9 @@ function TimePlot(props) {
|
|
|
141
187
|
const spec = CHART_SIZES[size];
|
|
142
188
|
const H = props.height ?? spec.height;
|
|
143
189
|
const axes = spec.yTicks > 0;
|
|
190
|
+
// A language that lights its charts draws marks classic does not have; the
|
|
191
|
+
// numbers they are drawn at are tokens (theme/tokens.ts, the chart hooks).
|
|
192
|
+
const lit = useDesignLanguage() === "signal";
|
|
144
193
|
// A sparkline has no room for annotations: it is the shape, nothing else.
|
|
145
194
|
const markers = axes ? props.markers : undefined;
|
|
146
195
|
const thresholds = axes ? props.thresholds : undefined;
|
|
@@ -540,17 +589,26 @@ function TimePlot(props) {
|
|
|
540
589
|
const flip = left > width * 0.6;
|
|
541
590
|
const cmpName = [...twins.values()].map((k) => series[k].name)[0];
|
|
542
591
|
const vs = cmpName && cmpName.includes(" · ") ? ` · vs ${cmpName.split(" · ").pop()}` : "";
|
|
543
|
-
|
|
592
|
+
const body = _jsxs(_Fragment, { children: [total && stack ? _jsxs(TipRow, { "$strong": true, children: [_jsx("span", {}), _jsx("span", { className: "n", children: "Total" }), _jsx("span", { className: "val", children: fmtTip(totals[idx] ?? 0) }), _jsx("span", {})] }) : null, shownRows.map((r) => {
|
|
544
593
|
const twin = twins.get(r.s.name);
|
|
545
594
|
const was = twin !== undefined ? cols[twin][idx] : null;
|
|
546
595
|
const delta = r.val != null && was != null ? formatDelta(r.val, was) : "";
|
|
547
596
|
const dir = delta.startsWith("+") ? "up" : delta.startsWith("−") ? "down" : "";
|
|
548
|
-
return _jsxs(TipRow, { "$focus": focus === r.k && series.length > 1, children: [_jsx(TipSwatch, { "$c": colours[r.k], "$dashed": r.s.reference || r.s.dashed || !!r.s.compareOf }), _jsx("span", { className: "n", children: r.s.name }), _jsx("span", { className: "val", children: r.val == null ? "—" : fmtTip(r.val) }), _jsx("span", { className: `delta ${dir}`, children: delta })] }, r.s.name);
|
|
549
|
-
})
|
|
597
|
+
return _jsxs(TipRow, { "$focus": focus === r.k && series.length > 1, children: [_jsx(TipSwatch, { "$c": colours[r.k], "$dashed": r.s.reference || r.s.dashed || !!r.s.compareOf, "$lit": lit }), _jsx("span", { className: "n", children: r.s.name }), _jsx("span", { className: "val", children: r.val == null ? "—" : fmtTip(r.val) }), _jsx("span", { className: `delta ${dir}`, children: delta })] }, r.s.name);
|
|
598
|
+
})] });
|
|
599
|
+
const more = rows.length > shownRows.length ? _jsxs("div", { className: "more", children: ["+", rows.length - shownRows.length, " more"] }) : null;
|
|
600
|
+
if (lit) {
|
|
601
|
+
// The first threshold this bucket is on the wrong side of, if it says which side that is.
|
|
602
|
+
const over = (thresholds ?? []).find((t) => t.breach && Number.isFinite(t.value) && rows.some((r) => !stackable(r.s) && !r.s.reference && r.val != null && (t.breach === "above" ? r.val > t.value : r.val < t.value)));
|
|
603
|
+
return _jsxs(Tip, { "$lit": true, style: flip ? { right: width - left + 12 } : { left: left + 12 }, "data-testid": testId ? `${testId}-tooltip` : undefined, children: [_jsxs("div", { className: "t", children: [_jsx("span", { children: tipTime(xs[idx]) }), _jsxs("span", { children: [step > 0 && xs.length > 1 ? stepLabel(step) : "", vs] })] }), _jsx("div", { className: "rows", children: body }), more, over ? _jsxs("div", { className: "over", style: { background: TONE_COLOUR[over.tone ?? "crit"] }, "data-testid": testId ? `${testId}-over` : undefined, children: [over.breach === "above" ? "OVER" : "UNDER", " ", thresholdWord(over).toUpperCase(), " \u00B7 ", fmtAxis(over.value)] }) : null] });
|
|
604
|
+
}
|
|
605
|
+
return _jsxs(Tip, { style: flip ? { right: width - left + 12 } : { left: left + 12 }, "data-testid": testId ? `${testId}-tooltip` : undefined, children: [_jsxs("div", { className: "t", children: [tipTime(xs[idx]), step > 0 && xs.length > 1 ? ` · ${stepLabel(step)} bucket` : "", vs] }), body, more] });
|
|
550
606
|
})();
|
|
551
607
|
// Marker labels at rest (L/XL) skip one that would touch the last kept.
|
|
552
608
|
const markerX = (markers ?? []).map((m) => x(m.at));
|
|
553
|
-
|
|
609
|
+
// A lit language's label is a tag as wide as its text; classic's is bare text.
|
|
610
|
+
const tagWidth = (text) => Math.ceil(text.length * 6.3) + 10;
|
|
611
|
+
const markerKeep = spaced(markerX, lit ? (markers ?? []).map((m) => tagWidth(m.label) + 6) : 46);
|
|
554
612
|
const hoverX = hover && !drag ? x(xs[hover.idx] + (kind === "bars" ? step / 2 : 0)) : null;
|
|
555
613
|
const barW = Math.max(1, step / tSpan * plotW);
|
|
556
614
|
const barInset = barW > 4 ? Math.min(2, barW * 0.12) : 0;
|
|
@@ -561,6 +619,33 @@ function TimePlot(props) {
|
|
|
561
619
|
return c[i];
|
|
562
620
|
return null;
|
|
563
621
|
};
|
|
622
|
+
// One series is in focus in a lit language, and only it gives off light: the
|
|
623
|
+
// one under the pointer; else the only one showing; else, among three or
|
|
624
|
+
// fewer, the one reading highest now (the tooltip's "worst first"). With more
|
|
625
|
+
// than three and no pointer nothing is: eight glowing lines are mud.
|
|
626
|
+
const lines = series.map((s, k) => ({ s, k })).filter(({ s }) => isShown(s) && !stackable(s) && !s.reference && !s.compareOf);
|
|
627
|
+
const focusK = (() => {
|
|
628
|
+
if (!lit || kind !== "line" || stack || size === "s")
|
|
629
|
+
return null;
|
|
630
|
+
if (hover?.own && !drag) {
|
|
631
|
+
const n = nearest(hover.idx, hover.py);
|
|
632
|
+
if (n !== null && lines.some((l) => l.k === n))
|
|
633
|
+
return n;
|
|
634
|
+
}
|
|
635
|
+
if (lines.length === 0 || lines.length > 3)
|
|
636
|
+
return null;
|
|
637
|
+
let best = lines[0].k;
|
|
638
|
+
let bestV = -Infinity;
|
|
639
|
+
for (const { k } of lines) {
|
|
640
|
+
const lv = lastValue(k);
|
|
641
|
+
if (lv !== null && lv > bestV) {
|
|
642
|
+
bestV = lv;
|
|
643
|
+
best = k;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
return best;
|
|
647
|
+
})();
|
|
648
|
+
const linePath = (r, xOff = 0) => r.map((p, q) => `${q === 0 ? "M" : "L"} ${f(x(p.t + xOff))} ${f(y(p.v))}`).join(" ");
|
|
564
649
|
const showLegend = (legend ?? spec.legend) && size !== "s";
|
|
565
650
|
const legendItems = series.map((s, k) => {
|
|
566
651
|
const last = lastValue(k);
|
|
@@ -574,30 +659,46 @@ function TimePlot(props) {
|
|
|
574
659
|
setHoverIdx(null);
|
|
575
660
|
setDrag(null);
|
|
576
661
|
}}, onContextMenu: onContextMenu, onDoubleClick: onReset ? (e) => {e.preventDefault();onReset();} : undefined, onKeyDown: onKey, onFocus: () => {if (!hover && size !== "s")
|
|
577
|
-
setHoverIdx({ idx: xs.length - 1, py: null, own: true });}, onBlur: () => setHoverIdx(null), children: [bands?.some((b) => b.hatch) ? _jsx("defs", { children: _jsx("pattern", { id: `hatch-${uid}`, width: "6", height: "6", patternUnits: "userSpaceOnUse", patternTransform: "rotate(45)", children: _jsx("line", { x1: "0", y1: "0", x2: "0", y2: "6", stroke: v.line2, strokeWidth: 2 }) }) }) : null, (bands ?? []).map((b, i) => {
|
|
662
|
+
setHoverIdx({ idx: xs.length - 1, py: null, own: true });}, onBlur: () => setHoverIdx(null), children: [lit && focusK !== null ? _jsx("defs", { children: _jsx("filter", { id: `glow-${uid}`, filterUnits: "userSpaceOnUse", x: 0, y: 0, width: width, height: H, children: _jsx("feGaussianBlur", { stdDeviation: "4" }) }) }) : null, bands?.some((b) => b.hatch) ? _jsx("defs", { children: _jsx("pattern", { id: `hatch-${uid}`, width: "6", height: "6", patternUnits: "userSpaceOnUse", patternTransform: "rotate(45)", children: _jsx("line", { x1: "0", y1: "0", x2: "0", y2: "6", stroke: v.line2, strokeWidth: 2 }) }) }) : null, (bands ?? []).map((b, i) => {
|
|
578
663
|
const a = Math.max(padL, x(b.from));
|
|
579
664
|
const z = Math.min(padL + plotW, x(b.to));
|
|
580
665
|
if (z <= a)
|
|
581
666
|
return null;
|
|
582
|
-
|
|
583
|
-
|
|
667
|
+
const rect = _jsx("rect", { x: a, y: padT, width: Math.max(1, z - a), height: plotH, fill: b.hatch ? `url(#hatch-${uid})` : b.colour ?? TONE_COLOUR[b.tone ?? "brand"], ...(b.hatch || b.colour ? {} : { opacity: 0.07 }), children: b.label ? _jsx("title", { children: b.label }) : null }, `b${i}`);
|
|
668
|
+
if (!lit || b.hatch || b.colour)
|
|
669
|
+
return rect;
|
|
670
|
+
// a toned window is capped in its tone, so it reads at a glance where it starts and ends
|
|
671
|
+
return _jsxs("g", { children: [rect, _jsx("rect", { x: a, y: padT, width: Math.max(1, z - a), height: 2, fill: TONE_COLOUR[b.tone ?? "brand"] })] }, `b${i}`);
|
|
672
|
+
}), axes ? yTicks.map((t, i) => _jsxs("g", { children: [Math.abs(y(t) - bottom) > 0.5 ? _jsx("line", { x1: padL, x2: padL + plotW, y1: f(y(t)), y2: f(y(t)), stroke: lit ? v.chartRule : v.line, strokeWidth: 1, ...(lit ? { strokeDasharray: "1 5" } : {}) }) : null, _jsx("text", { x: padL - 6, y: y(t) + 3.5, textAnchor: "end", fontSize: 10, fill: v.faint, children: yLabels[i] })] }, `y${t}`)) : null, axes ? _jsx("line", { x1: padL, x2: padL + plotW, y1: bottom, y2: bottom, stroke: v.line2, strokeWidth: 1 }) : null, xTickMarks.map((tk, i) => {
|
|
584
673
|
const px = x(tk.t);
|
|
585
674
|
if (px < padL - 1 || px > padL + plotW + 1)
|
|
586
675
|
return null;
|
|
587
676
|
const anchor = px - padL < 20 ? "start" : padL + plotW - px < 20 ? "end" : "middle";
|
|
588
|
-
|
|
677
|
+
const text = _jsx("text", { x: px, y: H - 5, fontSize: 10, fill: v.faint, opacity: tk.dim ? 0.6 : 1, textAnchor: anchor, children: tk.label }, `x${i}`);
|
|
678
|
+
if (!lit)
|
|
679
|
+
return text;
|
|
680
|
+
// no vertical grid, but a notch on the baseline says where the label points
|
|
681
|
+
return _jsxs("g", { children: [_jsx("line", { x1: f(px), x2: f(px), y1: bottom, y2: bottom + 4, stroke: v.line2, strokeWidth: 1 }), text] }, `x${i}`);
|
|
589
682
|
}), kind === "bars" ? _jsx("g", { children: series.map((s, k) => {
|
|
590
683
|
if (!stackable(s) || !isShown(s))
|
|
591
684
|
return null;
|
|
592
|
-
|
|
685
|
+
const bw = Math.max(0.5, barW - barInset * 2);
|
|
686
|
+
return _jsxs("g", { fill: colours[k], children: [xs.map((t, i) => {
|
|
593
687
|
const lo = lower[k][i];
|
|
594
688
|
const hi = upper[k][i];
|
|
595
689
|
if (lo == null || hi == null || hi === lo)
|
|
596
690
|
return null;
|
|
597
691
|
const top = y(hi);
|
|
598
692
|
const h = Math.max(0.5, y(lo) - top);
|
|
599
|
-
|
|
600
|
-
|
|
693
|
+
const opacity = lit ? hover && hover.own ? hover.idx === i ? 0.85 : 0.35 : 0.5 : hover && hover.idx !== i && hover.own ? 0.7 : 1;
|
|
694
|
+
return _jsx("rect", { x: f(x(t) + barInset), y: f(top), width: f(bw), height: f(h), opacity: opacity }, t);
|
|
695
|
+
}), lit ?
|
|
696
|
+
// the body is dim and the top edge is lit, so a stack reads by its caps
|
|
697
|
+
_jsx("path", { "data-cap": "", d: xs.map((t, i) => {
|
|
698
|
+
const lo = lower[k][i];
|
|
699
|
+
const hi = upper[k][i];
|
|
700
|
+
return lo == null || hi == null || hi === lo ? "" : `M ${f(x(t) + barInset)} ${f(y(hi) + 1)} h ${f(bw)}`;
|
|
701
|
+
}).join(" "), fill: "none", stroke: colours[k], strokeWidth: 2 }) : null] }, s.name);
|
|
601
702
|
}) }) : null, stack && kind === "line" ? series.map((s, k) => {
|
|
602
703
|
if (!stackable(s) || !isShown(s))
|
|
603
704
|
return null;
|
|
@@ -605,6 +706,11 @@ function TimePlot(props) {
|
|
|
605
706
|
const lo = lower[k];
|
|
606
707
|
const top = xs.map((t, i) => `${f(x(t))} ${f(y(up[i] ?? 0))}`);
|
|
607
708
|
const bot = xs.map((t, i) => `${f(x(t))} ${f(y(lo[i] ?? 0))}`).reverse();
|
|
709
|
+
if (lit) {
|
|
710
|
+
// each band fades down from its own top line; the neutral one ("Other") is flat and quiet
|
|
711
|
+
const quiet = !!neutral?.(s.name);
|
|
712
|
+
return _jsxs("g", { children: [quiet ? null : _jsx("defs", { children: _jsxs("linearGradient", { id: `band-${uid}-${k}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0", style: { stopColor: colours[k], stopOpacity: 0.42 } }), _jsx("stop", { offset: "1", style: { stopColor: colours[k], stopOpacity: 0.06 } })] }) }), _jsx("path", { d: `M ${top.join(" L ")} L ${bot.join(" L ")} Z`, fill: quiet ? colours[k] : `url(#band-${uid}-${k})`, ...(quiet ? { fillOpacity: 0.22 } : {}), stroke: "none" }), _jsx("path", { d: `M ${top.join(" L ")}`, fill: "none", stroke: colours[k], strokeWidth: quiet ? 1 : 1.5, strokeLinejoin: "round", strokeLinecap: "round" })] }, s.name);
|
|
713
|
+
}
|
|
608
714
|
return _jsxs("g", { children: [_jsx("path", { d: `M ${top.join(" L ")} L ${bot.join(" L ")} Z`, fill: colours[k], fillOpacity: bandOpacity ?? 0.35, stroke: "none" }), _jsx("path", { d: `M ${top.join(" L ")}`, fill: "none", stroke: bandOpacity && bandOpacity > 0.6 ? v.surface : colours[k], strokeWidth: bandOpacity && bandOpacity > 0.6 ? 1.2 : 1.8, strokeLinejoin: "round", strokeLinecap: "round" })] }, s.name);
|
|
609
715
|
}) : null, series.map((s, k) => {
|
|
610
716
|
if (!isShown(s) || stackable(s))
|
|
@@ -613,15 +719,36 @@ function TimePlot(props) {
|
|
|
613
719
|
const colour = colours[k];
|
|
614
720
|
const dashed = s.reference || s.dashed || !!s.compareOf;
|
|
615
721
|
const xOff = kind === "bars" ? step / 2 : 0;
|
|
616
|
-
|
|
617
|
-
|
|
722
|
+
const measuredLine = !s.reference && !s.compareOf;
|
|
723
|
+
const inFocus = focusK === k;
|
|
724
|
+
// Under the line: classic fills a single series flat; a lit language
|
|
725
|
+
// fills the series in focus (and that same single series) with an
|
|
726
|
+
// afterglow that fades to nothing at the baseline.
|
|
727
|
+
const under = measuredLine && (fillSingle || inFocus);
|
|
728
|
+
// In focus 1.8, a measured line 1.5, a compare thinner still: on white
|
|
729
|
+
// it is nearly its twin's colour and the weight is what tells them apart.
|
|
730
|
+
const weight = size === "s" ? 1.5 : !lit ? 1.8 : inFocus ? 1.8 : s.compareOf ? 1.3 : 1.5;
|
|
731
|
+
const head = runs.length ? runs[runs.length - 1][runs[runs.length - 1].length - 1] : null;
|
|
732
|
+
return _jsxs("g", { opacity: s.compareOf ? v.chartCompare : 1, children: [lit && under ? _jsx("defs", { children: _jsxs("linearGradient", { id: `after-${uid}-${k}`, x1: "0", y1: "0", x2: "0", y2: "1", children: [_jsx("stop", { offset: "0", style: { stopColor: colour, stopOpacity: v.chartAfter } }), _jsx("stop", { offset: "1", style: { stopColor: colour, stopOpacity: 0 } })] }) }) : null, under ? runs.filter((r) => r.length > 1).map((r, j) => _jsx("path", { d: `M ${f(x(r[0].t + xOff))} ${f(baseY)} ${r.map((p) => `L ${f(x(p.t + xOff))} ${f(y(p.v))}`).join(" ")} L ${f(x(r[r.length - 1].t + xOff))} ${f(baseY)} Z`, ...(lit ? { fill: `url(#after-${uid}-${k})` } : { fill: colour, fillOpacity: 0.12 }), stroke: "none" }, `a${j}`)) : null, inFocus ? runs.filter((r) => r.length > 1).map((r, j) => _jsx("path", { "data-glow": "", d: linePath(r, xOff), fill: "none", stroke: colour, strokeWidth: 3.5, opacity: v.chartGlow, filter: `url(#glow-${uid})`, strokeLinejoin: "round", strokeLinecap: "round" }, `g${j}`)) : null, runs.map((r, j) => r.length > 1 ?
|
|
733
|
+
_jsx("path", { d: r.map((p, q) => `${q === 0 ? "M" : "L"} ${f(x(p.t + xOff))} ${f(y(p.v))}`).join(" "), fill: "none", stroke: colour, strokeWidth: weight, strokeLinejoin: "round", strokeLinecap: "round", ...(dashed ? { strokeDasharray: "5 4" } : {}) }, j)
|
|
618
734
|
// a lone sample between two gaps has no line to draw; it is a dot
|
|
619
735
|
: _jsx("circle", { cx: f(x(r[0].t + xOff)), cy: f(y(r[0].v)), r: 1.8, fill: colour }, j)), size === "s" && !s.compareOf && !s.reference && runs.length ? (() => {
|
|
620
736
|
const lastRun = runs[runs.length - 1];
|
|
621
737
|
const p = lastRun[lastRun.length - 1];
|
|
622
|
-
return _jsx("circle", { cx: f(x(p.t + xOff)), cy: f(y(p.v)), r: 2.2, fill: colour });
|
|
623
|
-
})() : null] }, s.name);
|
|
624
|
-
}), (thresholds ?? []).map((t, i) => {
|
|
738
|
+
return _jsxs(_Fragment, { children: [lit ? _jsx("circle", { cx: f(x(p.t + xOff)), cy: f(y(p.v)), r: 5, fill: colour, opacity: 0.25 }) : null, _jsx("circle", { cx: f(x(p.t + xOff)), cy: f(y(p.v)), r: 2.2, fill: colour })] });
|
|
739
|
+
})() : null, lit && size !== "s" && kind === "line" && measuredLine && head ? _jsxs("g", { "data-head": inFocus ? "focus" : "", children: [inFocus ? _jsx("circle", { className: "head-ring", cx: f(x(head.t)), cy: f(y(head.v)), r: 7, fill: colour, opacity: 0.3 }) : null, _jsx("circle", { cx: f(x(head.t)), cy: f(y(head.v)), r: inFocus ? 3 : 2.2, fill: colour })] }) : null] }, s.name);
|
|
740
|
+
}), lit && kind === "line" && !stack ? (thresholds ?? []).map((t, i) => {
|
|
741
|
+
if (!t.breach || !Number.isFinite(t.value))
|
|
742
|
+
return null;
|
|
743
|
+
const ty = y(t.value);
|
|
744
|
+
const colour = TONE_COLOUR[t.tone ?? "crit"];
|
|
745
|
+
const above = t.breach === "above";
|
|
746
|
+
return _jsxs("g", { "data-breach": t.breach, children: [_jsx("clipPath", { id: `breach-${uid}-${i}`, children: _jsx("rect", { x: padL, width: plotW, y: above ? 0 : f(ty), height: f(above ? Math.max(0, ty) : Math.max(0, H - ty)) }) }), _jsx("g", { clipPath: `url(#breach-${uid}-${i})`, children: lines.map(({ s, k }) => {
|
|
747
|
+
const runs = runsOf(xs, cols[k]).filter((r) => r.length > 1);
|
|
748
|
+
const inFocus = focusK === k;
|
|
749
|
+
return _jsxs("g", { children: [inFocus ? runs.map((r, j) => _jsx("path", { d: `M ${f(x(r[0].t))} ${f(ty)} ${r.map((p) => `L ${f(x(p.t))} ${f(y(p.v))}`).join(" ")} L ${f(x(r[r.length - 1].t))} ${f(ty)} Z`, fill: colour, opacity: 0.22, stroke: "none" }, `f${j}`)) : null, inFocus ? runs.map((r, j) => _jsx("path", { d: linePath(r), fill: "none", stroke: colour, strokeWidth: 4, opacity: v.chartGlow, filter: `url(#glow-${uid})`, strokeLinejoin: "round", strokeLinecap: "round" }, `g${j}`)) : null, runs.map((r, j) => _jsx("path", { d: linePath(r), fill: "none", stroke: colour, strokeWidth: inFocus ? 2 : 1.5, strokeLinejoin: "round", strokeLinecap: "round", ...(s.dashed ? { strokeDasharray: "5 4" } : {}) }, j))] }, s.name);
|
|
750
|
+
}) })] }, `o${i}`);
|
|
751
|
+
}) : null, (thresholds ?? []).map((t, i) => {
|
|
625
752
|
if (!Number.isFinite(t.value))
|
|
626
753
|
return null;
|
|
627
754
|
const ty = y(t.value);
|
|
@@ -629,7 +756,13 @@ function TimePlot(props) {
|
|
|
629
756
|
// Two rules close together: the lower one's label goes under its line.
|
|
630
757
|
const crowded = (thresholds ?? []).some((o, j) => j !== i && Number.isFinite(o.value) && y(o.value) < ty && ty - y(o.value) < 13);
|
|
631
758
|
const labelY = crowded ? ty + 11 : ty - 4;
|
|
632
|
-
return _jsxs("g", { children: [_jsx("line", { x1: padL, x2: padL + plotW, y1: f(ty), y2: f(ty), stroke: colour, strokeWidth: 1, strokeDasharray: "4 3" }), axes
|
|
759
|
+
return _jsxs("g", { children: [_jsx("line", { x1: padL, x2: padL + plotW, y1: f(ty), y2: f(ty), stroke: colour, strokeWidth: 1, strokeDasharray: "4 3" }), axes && lit ? (() => {
|
|
760
|
+
// the word is a caption and takes capitals; the value keeps its unit as it is spelt
|
|
761
|
+
const text = `${thresholdWord(t).toUpperCase()} · ${fmtAxis(t.value)}`;
|
|
762
|
+
const tw = tagWidth(text);
|
|
763
|
+
const top = crowded ? ty + 4 : ty - 18;
|
|
764
|
+
return _jsxs("g", { "data-tag": "threshold", children: [_jsx("rect", { x: f(padL + plotW - tw), y: f(top), width: tw, height: 14, fill: colour }), _jsx("text", { x: f(padL + plotW - tw / 2), y: f(top + 10.5), textAnchor: "middle", fontSize: 9.5, fontWeight: 600, fill: v.surface, children: text })] });
|
|
765
|
+
})() : axes ? _jsx("text", { x: padL + plotW - 2, y: labelY, textAnchor: "end", fontSize: 10, fill: colour, children: `${thresholdWord(t)} · ${fmtAxis(t.value)}` }) : null, onThresholdDrag ? _jsx("rect", { x: padL, y: ty - 5, width: plotW, height: 10, fill: "transparent", style: { cursor: "ns-resize" }, role: "slider", tabIndex: 0, "aria-label": `${thresholdWord(t)} threshold`, "aria-valuenow": t.value, "aria-valuetext": fmtTip(t.value), "data-testid": testId ? `${testId}-drag-${thresholdWord(t)}` : undefined, onPointerDown: (e) => {e.stopPropagation();dragRule.current = i;(e.currentTarget.ownerSVGElement ?? e.currentTarget).setPointerCapture?.(e.pointerId);}, onKeyDown: (e) => {
|
|
633
766
|
if (e.key !== "ArrowUp" && e.key !== "ArrowDown")
|
|
634
767
|
return;
|
|
635
768
|
e.preventDefault();
|
|
@@ -644,19 +777,31 @@ function TimePlot(props) {
|
|
|
644
777
|
const colour = markerColour(m);
|
|
645
778
|
const near = hoverX !== null && Math.abs(hoverX - mx) < 8;
|
|
646
779
|
const labelled = markerLabels && markerKeep[i] || near;
|
|
647
|
-
|
|
780
|
+
// In a lit language a marker is the bucket it fell in, as a column, with
|
|
781
|
+
// its label on a tag that starts on the column; the kind's glyph stays on
|
|
782
|
+
// the axis, so a deploy and an alert differ by shape as well as colour.
|
|
783
|
+
const colW = Math.min(14, Math.max(4, barW));
|
|
784
|
+
const tw = tagWidth(m.label);
|
|
785
|
+
const tagX = Math.max(padL, mx - colW / 2 + tw > padL + plotW ? mx + colW / 2 - tw : mx - colW / 2);
|
|
786
|
+
const tagTop = Math.max(0, padT - 16);
|
|
787
|
+
return _jsxs("g", { "data-marker": m.kind ?? "deploy", children: [_jsx("title", { children: m.label }), lit ?
|
|
788
|
+
_jsx("rect", { "data-column": "", x: f(mx - colW / 2), y: padT, width: f(colW), height: plotH, fill: colour, opacity: 0.2 }) :
|
|
789
|
+
_jsx("line", { x1: f(mx), x2: f(mx), y1: padT, y2: bottom, stroke: colour, strokeWidth: 1, strokeDasharray: "2 3", opacity: 0.8 }), m.kind === "alert" ?
|
|
648
790
|
_jsx("rect", { x: mx - 1, y: bottom - 6, width: 2, height: 7, fill: colour }) :
|
|
649
791
|
m.kind === "note" ?
|
|
650
792
|
_jsx("circle", { cx: mx, cy: bottom, r: 2.6, fill: colour }) :
|
|
651
|
-
_jsx("polygon", { points: `${f(mx)},${f(bottom - 6)} ${f(mx - 4.5)},${f(bottom + 1.5)} ${f(mx + 4.5)},${f(bottom + 1.5)}`, fill: colour }), labelled && axes ? _jsx("text", { x: mx, y: padT - 5, textAnchor: mx > padL + plotW - 30 ? "end" : mx < padL + 30 ? "start" : "middle", fontSize: 10, fill: colour, children: m.label }) : null] }, `m${i}`);
|
|
793
|
+
_jsx("polygon", { points: `${f(mx)},${f(bottom - 6)} ${f(mx - 4.5)},${f(bottom + 1.5)} ${f(mx + 4.5)},${f(bottom + 1.5)}`, fill: colour }), labelled && axes && lit ? _jsxs("g", { "data-tag": "marker", children: [_jsx("rect", { x: f(tagX), y: tagTop, width: tw, height: 14, fill: colour }), _jsx("text", { x: f(tagX + tw / 2), y: tagTop + 10.5, textAnchor: "middle", fontSize: 9.5, fontWeight: 600, fill: v.surface, children: m.label })] }) : labelled && axes ? _jsx("text", { x: mx, y: padT - 5, textAnchor: mx > padL + plotW - 30 ? "end" : mx < padL + 30 ? "start" : "middle", fontSize: 10, fill: colour, children: m.label }) : null] }, `m${i}`);
|
|
652
794
|
}), drag && Math.abs(drag.to - drag.from) * plotW > 1 ? _jsx("rect", { x: padL + Math.min(drag.from, drag.to) * plotW, width: Math.abs(drag.to - drag.from) * plotW, y: padT, height: plotH, fill: v.brand12, stroke: v.brand55, strokeWidth: 1 }) : null, hoverX !== null && size !== "s" ? _jsx("line", { x1: f(hoverX), x2: f(hoverX), y1: padT, y2: bottom, stroke: v.line2, strokeWidth: 1, strokeDasharray: hover?.own ? undefined : "3 3" }) : null, hover && !drag && kind === "line" && size !== "s" ? series.map((s, k) => {
|
|
653
795
|
if (!isShown(s))
|
|
654
796
|
return null;
|
|
655
797
|
const val = stackable(s) ? upper[k][hover.idx] : cols[k][hover.idx];
|
|
656
798
|
if (val == null)
|
|
657
799
|
return null;
|
|
658
|
-
|
|
659
|
-
|
|
800
|
+
const dot = _jsx("circle", { cx: f(x(xs[hover.idx])), cy: f(y(val)), r: lit && focusK === k ? 4 : 3, fill: colours[k], stroke: v.surface, strokeWidth: 1.5, opacity: s.compareOf ? 0.6 : 1 }, `h${k}`);
|
|
801
|
+
if (!lit || focusK !== k)
|
|
802
|
+
return dot;
|
|
803
|
+
return _jsxs("g", { children: [_jsx("circle", { cx: f(x(xs[hover.idx])), cy: f(y(val)), r: 8, fill: colours[k], opacity: 0.22 }), dot] }, `h${k}`);
|
|
804
|
+
}) : null] }), lit && axes && hover?.own && !drag && hoverX !== null ? _jsxs(_Fragment, { children: [_jsx(AxisChip, { "data-chip": "time", style: { left: Math.min(width - 24, Math.max(24, hoverX)), top: bottom + 1, transform: "translateX(-50%)" }, children: (formatTime ?? timeTick(tSpan))(xs[hover.idx]) }), focusK !== null && cols[focusK][hover.idx] != null ? _jsx(AxisChip, { "data-chip": "value", "$on": colours[focusK], style: { left: 0, minWidth: Math.max(0, padL - 4), top: y(cols[focusK][hover.idx]) - 8.5 }, children: fmtAxis(cols[focusK][hover.idx]) }) : null] }) : null, tip] }), showLegend && (series.length > 1 || thresholdNotes.length > 0 || legendExtra || legend) ? _jsx(LegendChips, { items: legendItems, onToggle: toggle, notes: _jsxs(_Fragment, { children: [thresholdNotes.length ? _jsx(LegendNote, { colour: TONE_COLOUR[thresholdNotes[0].tone ?? "crit"], dashed: true, children: thresholdNotes.map((t) => `${thresholdWord(t)} ${fmtTip(t.value)}`).join(" · ") }) : null, legendExtra] }) }) : null, hint !== undefined ? hint : onZoom && size !== "s" && size !== "m" ? _jsx(ChartHint, { children: "Drag across the chart to zoom into a window." }) : null] });
|
|
660
805
|
}
|
|
661
806
|
/**
|
|
662
807
|
* LineChart: n series over a shared time axis — the default timeseries, up to
|