@labpane/ui 1.4.2 → 1.5.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/README.md +1 -1
- package/dist/index.js +807 -35
- package/dist/index.js.map +4 -4
- package/dist/styles.css +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/theme.d.ts +1 -1
- package/dist/ui/timeline-chart.d.ts +25 -0
- package/dist/ui/timeline-model.d.ts +92 -0
- package/package.json +9 -9
- package/styles.css +9 -0
package/dist/index.js
CHANGED
|
@@ -5532,6 +5532,9 @@ var themeColors = [
|
|
|
5532
5532
|
"chart-3",
|
|
5533
5533
|
"chart-4",
|
|
5534
5534
|
"chart-5",
|
|
5535
|
+
"chart-step-1",
|
|
5536
|
+
"chart-step-2",
|
|
5537
|
+
"chart-step-3",
|
|
5535
5538
|
"sidebar",
|
|
5536
5539
|
"sidebar-foreground",
|
|
5537
5540
|
"sidebar-primary",
|
|
@@ -6754,14 +6757,766 @@ function TimeSeriesPlot({
|
|
|
6754
6757
|
);
|
|
6755
6758
|
}
|
|
6756
6759
|
|
|
6757
|
-
//
|
|
6760
|
+
// timeline-chart.tsx
|
|
6758
6761
|
import * as React51 from "react";
|
|
6762
|
+
|
|
6763
|
+
// timeline-model.ts
|
|
6764
|
+
var MINUTE = 6e4;
|
|
6765
|
+
var HOUR = 36e5;
|
|
6766
|
+
var RATE_WINDOW = 5e3;
|
|
6767
|
+
var fieldIndex = (series) => Object.fromEntries(series.fields.map((field, i) => [field, i]));
|
|
6768
|
+
function niceStep(span, count) {
|
|
6769
|
+
if (span <= 0 || count <= 0) return 1;
|
|
6770
|
+
const rough = span / count;
|
|
6771
|
+
const power = 10 ** Math.floor(Math.log10(rough));
|
|
6772
|
+
const unit = rough / power;
|
|
6773
|
+
const factor = unit >= Math.sqrt(50) ? 10 : unit >= Math.sqrt(10) ? 5 : unit >= Math.sqrt(2) ? 2 : 1;
|
|
6774
|
+
return factor * power;
|
|
6775
|
+
}
|
|
6776
|
+
function valueTicks(max, count = 4) {
|
|
6777
|
+
if (!(max > 0)) return [0, 1];
|
|
6778
|
+
const step = niceStep(max, count);
|
|
6779
|
+
const ticks = [];
|
|
6780
|
+
for (let value = 0; value < max + step / 2; value += step)
|
|
6781
|
+
ticks.push(Number(value.toFixed(10)));
|
|
6782
|
+
if (ticks.at(-1) < max)
|
|
6783
|
+
ticks.push(Number((ticks.at(-1) + step).toFixed(10)));
|
|
6784
|
+
return ticks;
|
|
6785
|
+
}
|
|
6786
|
+
var timeSteps = [
|
|
6787
|
+
1e3,
|
|
6788
|
+
2e3,
|
|
6789
|
+
5e3,
|
|
6790
|
+
1e4,
|
|
6791
|
+
15e3,
|
|
6792
|
+
3e4,
|
|
6793
|
+
MINUTE,
|
|
6794
|
+
2 * MINUTE,
|
|
6795
|
+
5 * MINUTE,
|
|
6796
|
+
10 * MINUTE,
|
|
6797
|
+
15 * MINUTE,
|
|
6798
|
+
30 * MINUTE,
|
|
6799
|
+
HOUR,
|
|
6800
|
+
2 * HOUR,
|
|
6801
|
+
3 * HOUR,
|
|
6802
|
+
6 * HOUR,
|
|
6803
|
+
12 * HOUR,
|
|
6804
|
+
24 * HOUR
|
|
6805
|
+
];
|
|
6806
|
+
function timeTicks(span, count = 6) {
|
|
6807
|
+
const step = timeSteps.find((s) => span / s <= count) ?? timeSteps.at(-1);
|
|
6808
|
+
const ticks = [];
|
|
6809
|
+
for (let t = 0; t <= span; t += step) ticks.push(t);
|
|
6810
|
+
return ticks;
|
|
6811
|
+
}
|
|
6812
|
+
function elapsedLabel(ms) {
|
|
6813
|
+
const s = Math.max(0, Math.round(ms / 1e3));
|
|
6814
|
+
const hh = Math.floor(s / 3600);
|
|
6815
|
+
const mm = Math.floor(s % 3600 / 60);
|
|
6816
|
+
const ss = s % 60;
|
|
6817
|
+
const pad = (v) => String(v).padStart(2, "0");
|
|
6818
|
+
return hh ? `${hh}:${pad(mm)}:${pad(ss)}` : `${mm}:${pad(ss)}`;
|
|
6819
|
+
}
|
|
6820
|
+
var clockLabel = (t) => new Date(t).toLocaleTimeString(void 0, { hour12: false });
|
|
6821
|
+
function compactNumber(value, digits = 1) {
|
|
6822
|
+
if (!Number.isFinite(value)) return "";
|
|
6823
|
+
const abs = Math.abs(value);
|
|
6824
|
+
const fixed = (v) => Number(v.toFixed(digits)).toLocaleString(void 0, {
|
|
6825
|
+
maximumFractionDigits: digits
|
|
6826
|
+
});
|
|
6827
|
+
if (abs >= 1e6) return `${fixed(value / 1e6)}M`;
|
|
6828
|
+
if (abs >= 1e4) return `${fixed(value / 1e3)}K`;
|
|
6829
|
+
return fixed(value);
|
|
6830
|
+
}
|
|
6831
|
+
function bytesLabel(bytes) {
|
|
6832
|
+
const units = ["B", "KB", "MB", "GB", "TB"];
|
|
6833
|
+
let value = Math.max(0, bytes);
|
|
6834
|
+
let unit = 0;
|
|
6835
|
+
while (value >= 1e3 && unit < units.length - 1) {
|
|
6836
|
+
value /= 1e3;
|
|
6837
|
+
unit++;
|
|
6838
|
+
}
|
|
6839
|
+
return `${compactNumber(value, unit ? 1 : 0)} ${units[unit]}`;
|
|
6840
|
+
}
|
|
6841
|
+
function linePath(xs, ys) {
|
|
6842
|
+
let path = "";
|
|
6843
|
+
for (let i = 0; i < xs.length; i++)
|
|
6844
|
+
path += `${i ? "L" : "M"}${xs[i].toFixed(1)} ${ys[i].toFixed(1)}`;
|
|
6845
|
+
return path;
|
|
6846
|
+
}
|
|
6847
|
+
function areaPath(xs, highs, lows) {
|
|
6848
|
+
if (xs.length < 2) return "";
|
|
6849
|
+
let path = linePath(xs, highs);
|
|
6850
|
+
for (let i = xs.length - 1; i >= 0; i--)
|
|
6851
|
+
path += `L${xs[i].toFixed(1)} ${lows[i].toFixed(1)}`;
|
|
6852
|
+
return path + "Z";
|
|
6853
|
+
}
|
|
6854
|
+
function nearestIndex(times, t) {
|
|
6855
|
+
if (!times.length) return -1;
|
|
6856
|
+
let low = 0;
|
|
6857
|
+
let high = times.length - 1;
|
|
6858
|
+
while (low < high) {
|
|
6859
|
+
const mid = low + high >> 1;
|
|
6860
|
+
if (times[mid] < t) low = mid + 1;
|
|
6861
|
+
else high = mid;
|
|
6862
|
+
}
|
|
6863
|
+
if (low > 0 && t - times[low - 1] <= times[low] - t) return low - 1;
|
|
6864
|
+
return low;
|
|
6865
|
+
}
|
|
6866
|
+
function rates(points, index, timeIndex = 0, window2 = RATE_WINDOW) {
|
|
6867
|
+
return points.map((p, i) => {
|
|
6868
|
+
if (!i) return 0;
|
|
6869
|
+
let j = i - 1;
|
|
6870
|
+
while (j > 0 && p[timeIndex] - points[j][timeIndex] < window2) j--;
|
|
6871
|
+
const previous = points[j];
|
|
6872
|
+
const seconds = (p[timeIndex] - previous[timeIndex]) / 1e3;
|
|
6873
|
+
return seconds > 0 ? Math.max(0, (p[index] - previous[index]) / seconds) : 0;
|
|
6874
|
+
});
|
|
6875
|
+
}
|
|
6876
|
+
function summarize(values, busy, summary) {
|
|
6877
|
+
const active = values.filter((_, i) => busy[i]);
|
|
6878
|
+
if (!active.length) return void 0;
|
|
6879
|
+
return summary === "peak" ? Math.max(...active) : active.reduce((sum, v) => sum + v, 0) / active.length;
|
|
6880
|
+
}
|
|
6881
|
+
function timelineValues(series, metric) {
|
|
6882
|
+
const index = fieldIndex(series);
|
|
6883
|
+
const field = (name) => {
|
|
6884
|
+
const i = name === void 0 ? void 0 : index[name];
|
|
6885
|
+
if (i === void 0) return void 0;
|
|
6886
|
+
const raw = metric.rate ? rates(series.points, i) : series.points.map((p) => p[i] ?? 0);
|
|
6887
|
+
return metric.scale ? raw.map((v) => v * metric.scale) : raw;
|
|
6888
|
+
};
|
|
6889
|
+
return {
|
|
6890
|
+
times: series.points.map((p) => p[index.t ?? 0] ?? 0),
|
|
6891
|
+
line: field(metric.line) ?? [],
|
|
6892
|
+
low: metric.band ? field(metric.band[0]) : void 0,
|
|
6893
|
+
high: metric.band ? field(metric.band[1]) : void 0,
|
|
6894
|
+
context: field(metric.context),
|
|
6895
|
+
status: field(metric.status),
|
|
6896
|
+
stack: metric.stack?.map((layer) => field(layer.field) ?? []),
|
|
6897
|
+
threshold: metric.threshold !== void 0 && metric.threshold > 0 ? metric.threshold : void 0,
|
|
6898
|
+
busy: series.points.map(
|
|
6899
|
+
(p) => index.active === void 0 ? true : (p[index.active] ?? 0) > 0
|
|
6900
|
+
)
|
|
6901
|
+
};
|
|
6902
|
+
}
|
|
6903
|
+
function hasTimelineData(series, metric) {
|
|
6904
|
+
if (!metric.optional) return true;
|
|
6905
|
+
const { line: line2, stack } = timelineValues(series, metric);
|
|
6906
|
+
return line2.some((v) => v > 0) || !!stack?.some((s) => s.some((v) => v > 0));
|
|
6907
|
+
}
|
|
6908
|
+
var formatMetric = (metric, value) => value === void 0 || !Number.isFinite(value) ? "\u2013" : `${compactNumber(value, metric.digits ?? 1)}${metric.unit ? ` ${metric.unit}` : ""}`;
|
|
6909
|
+
function timelineCSV(series) {
|
|
6910
|
+
const t = series.fields.indexOf("t");
|
|
6911
|
+
const fields = series.fields.filter((_, i) => i !== t);
|
|
6912
|
+
const header = ["time", "elapsed_s", ...fields].join(",");
|
|
6913
|
+
const rows = series.points.map((p) => {
|
|
6914
|
+
const time = t >= 0 ? p[t] : 0;
|
|
6915
|
+
const values = p.filter((_, i) => i !== t);
|
|
6916
|
+
return [
|
|
6917
|
+
new Date(time).toISOString(),
|
|
6918
|
+
((time - series.start) / 1e3).toFixed(3),
|
|
6919
|
+
...values
|
|
6920
|
+
].join(",");
|
|
6921
|
+
});
|
|
6922
|
+
return [header, ...rows].join("\n") + "\n";
|
|
6923
|
+
}
|
|
6924
|
+
var MIN_SPAN2 = MINUTE;
|
|
6925
|
+
function timelineModel(series, metric, width, height, start = series.start) {
|
|
6926
|
+
const values = timelineValues(series, metric);
|
|
6927
|
+
const { times, line: line2, low, high, context, status, stack, threshold } = values;
|
|
6928
|
+
const x0 = start;
|
|
6929
|
+
const x1 = Math.max(times.at(-1) ?? x0, x0 + MIN_SPAN2);
|
|
6930
|
+
const totals = stack?.length ? times.map((_, i) => stack.reduce((sum, s) => sum + (s[i] ?? 0), 0)) : [];
|
|
6931
|
+
const max = Math.max(
|
|
6932
|
+
0,
|
|
6933
|
+
...line2,
|
|
6934
|
+
...high ?? [],
|
|
6935
|
+
...context ?? [],
|
|
6936
|
+
...status ?? [],
|
|
6937
|
+
...totals,
|
|
6938
|
+
threshold ?? 0
|
|
6939
|
+
);
|
|
6940
|
+
const yTicks = valueTicks(max);
|
|
6941
|
+
const yMax = yTicks.at(-1);
|
|
6942
|
+
const labels = yTicks.map((v) => compactNumber(v, metric.digits ?? 1));
|
|
6943
|
+
const left = 10 + Math.max(...labels.map((l) => l.length)) * 6.5;
|
|
6944
|
+
const right = 14;
|
|
6945
|
+
const top = 10;
|
|
6946
|
+
const bottom = 24;
|
|
6947
|
+
const x = (t) => left + (t - x0) / (x1 - x0) * (width - left - right);
|
|
6948
|
+
const y = (v) => top + (1 - v / yMax) * (height - top - bottom);
|
|
6949
|
+
const xs = times.map(x);
|
|
6950
|
+
const cumulative = [];
|
|
6951
|
+
stack?.forEach((layer, k) => {
|
|
6952
|
+
const below = cumulative[k - 1];
|
|
6953
|
+
cumulative.push(layer.map((v, i) => v + (below?.[i] ?? 0)));
|
|
6954
|
+
});
|
|
6955
|
+
return {
|
|
6956
|
+
...values,
|
|
6957
|
+
x0,
|
|
6958
|
+
x1,
|
|
6959
|
+
left,
|
|
6960
|
+
right,
|
|
6961
|
+
top,
|
|
6962
|
+
bottom,
|
|
6963
|
+
x,
|
|
6964
|
+
y,
|
|
6965
|
+
xs,
|
|
6966
|
+
yTicks,
|
|
6967
|
+
labels,
|
|
6968
|
+
totals,
|
|
6969
|
+
linePath: stack ? "" : linePath(xs, line2.map(y)),
|
|
6970
|
+
bandPath: low && high ? areaPath(xs, high.map(y), low.map(y)) : "",
|
|
6971
|
+
contextPath: context ? linePath(xs, context.map(y)) : "",
|
|
6972
|
+
statusPath: status ? linePath(xs, status.map(y)) : "",
|
|
6973
|
+
stackPaths: cumulative.map(
|
|
6974
|
+
(upper, k) => areaPath(
|
|
6975
|
+
xs,
|
|
6976
|
+
upper.map(y),
|
|
6977
|
+
(cumulative[k - 1] ?? upper.map(() => 0)).map(y)
|
|
6978
|
+
)
|
|
6979
|
+
),
|
|
6980
|
+
separatorPaths: cumulative.slice(0, -1).map((upper) => linePath(xs, upper.map(y))),
|
|
6981
|
+
xTicks: timeTicks(x1 - x0)
|
|
6982
|
+
};
|
|
6983
|
+
}
|
|
6984
|
+
|
|
6985
|
+
// timeline-chart.tsx
|
|
6759
6986
|
import { Fragment as Fragment8, jsx as jsx49, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
6987
|
+
var lineColor = "var(--labui-chart-2)";
|
|
6988
|
+
var contextColor = "var(--labui-muted-foreground)";
|
|
6989
|
+
var statusColor = "var(--labui-destructive)";
|
|
6990
|
+
var thresholdColor = "var(--labui-warning)";
|
|
6991
|
+
var surfaceColor = "var(--labui-card)";
|
|
6992
|
+
var stackColors = [
|
|
6993
|
+
"var(--labui-chart-step-1)",
|
|
6994
|
+
"var(--labui-chart-step-2)",
|
|
6995
|
+
"var(--labui-chart-step-3)"
|
|
6996
|
+
];
|
|
6997
|
+
var HANDLED_KEYS2 = ["ArrowLeft", "ArrowRight", "Home", "End", "Escape"];
|
|
6998
|
+
function Key({ color, label }) {
|
|
6999
|
+
return /* @__PURE__ */ jsxs28("span", { className: "labui:inline-flex labui:items-center labui:gap-1", children: [
|
|
7000
|
+
/* @__PURE__ */ jsx49(
|
|
7001
|
+
"span",
|
|
7002
|
+
{
|
|
7003
|
+
"aria-hidden": "true",
|
|
7004
|
+
className: "labui:inline-block labui:h-0.5 labui:w-3 labui:rounded",
|
|
7005
|
+
style: { background: color }
|
|
7006
|
+
}
|
|
7007
|
+
),
|
|
7008
|
+
label
|
|
7009
|
+
] });
|
|
7010
|
+
}
|
|
7011
|
+
function Row({
|
|
7012
|
+
color,
|
|
7013
|
+
swatch,
|
|
7014
|
+
value,
|
|
7015
|
+
label
|
|
7016
|
+
}) {
|
|
7017
|
+
return /* @__PURE__ */ jsxs28("div", { className: "labui:flex labui:items-center labui:gap-1.5", children: [
|
|
7018
|
+
/* @__PURE__ */ jsx49(
|
|
7019
|
+
"span",
|
|
7020
|
+
{
|
|
7021
|
+
"aria-hidden": "true",
|
|
7022
|
+
className: cn(
|
|
7023
|
+
"labui:inline-block labui:rounded",
|
|
7024
|
+
swatch ? "labui:size-2.5 labui:rounded-sm" : "labui:h-0.5 labui:w-3"
|
|
7025
|
+
),
|
|
7026
|
+
style: { background: color }
|
|
7027
|
+
}
|
|
7028
|
+
),
|
|
7029
|
+
/* @__PURE__ */ jsx49("strong", { className: "labui:tabular-nums", children: value }),
|
|
7030
|
+
/* @__PURE__ */ jsx49("span", { className: "labui:text-muted-foreground", children: label })
|
|
7031
|
+
] });
|
|
7032
|
+
}
|
|
7033
|
+
var TimelineChart = React51.forwardRef(
|
|
7034
|
+
function TimelineChart2({
|
|
7035
|
+
series,
|
|
7036
|
+
metric,
|
|
7037
|
+
start,
|
|
7038
|
+
live = false,
|
|
7039
|
+
height = 190,
|
|
7040
|
+
hover,
|
|
7041
|
+
onHover,
|
|
7042
|
+
colors = stackColors,
|
|
7043
|
+
label,
|
|
7044
|
+
className
|
|
7045
|
+
}, ref) {
|
|
7046
|
+
const { container, width } = useChartWidth();
|
|
7047
|
+
const id = React51.useId();
|
|
7048
|
+
const [local, setLocal] = React51.useState(null);
|
|
7049
|
+
const [focused, setFocused] = React51.useState(false);
|
|
7050
|
+
const shared = onHover !== void 0;
|
|
7051
|
+
const hoverTime = shared ? hover ?? null : local;
|
|
7052
|
+
const setHover = (time) => {
|
|
7053
|
+
if (shared) onHover(time);
|
|
7054
|
+
else setLocal(time);
|
|
7055
|
+
};
|
|
7056
|
+
const model = React51.useMemo(
|
|
7057
|
+
() => timelineModel(series, metric, width, height, start),
|
|
7058
|
+
[series, metric, width, height, start]
|
|
7059
|
+
);
|
|
7060
|
+
const digits = metric.digits ?? 1;
|
|
7061
|
+
const thresholdDigits = Math.max(
|
|
7062
|
+
digits,
|
|
7063
|
+
Math.min(2, (String(model.threshold ?? 0).split(".")[1] ?? "").length)
|
|
7064
|
+
);
|
|
7065
|
+
const lineLabel = metric.lineLabel ?? metric.title.toLowerCase();
|
|
7066
|
+
const last = model.times.length - 1;
|
|
7067
|
+
const index = hoverTime === null || last < 0 ? null : nearestIndex(model.times, hoverTime);
|
|
7068
|
+
const at = index ?? last;
|
|
7069
|
+
const stackShare = (i) => {
|
|
7070
|
+
const total = model.totals[i] ?? 0;
|
|
7071
|
+
const top = model.stack?.at(-1)?.[i] ?? 0;
|
|
7072
|
+
return total ? top / total * 100 : void 0;
|
|
7073
|
+
};
|
|
7074
|
+
const readout = (i) => metric.stack ? stackShare(i) : model.line[i];
|
|
7075
|
+
const summary = metric.stack ? "mean" : metric.summary ?? "peak";
|
|
7076
|
+
const headline = index !== null ? readout(index) : live ? at >= 0 ? readout(at) : void 0 : summarize(
|
|
7077
|
+
metric.stack ? model.times.map((_, i) => stackShare(i) ?? 0) : model.line,
|
|
7078
|
+
model.busy,
|
|
7079
|
+
summary
|
|
7080
|
+
);
|
|
7081
|
+
const headlineText = metric.stack ? headline === void 0 ? "\u2013" : `${compactNumber(headline, 0)}% on ${metric.stack.at(-1)?.label}` : formatMetric(metric, headline);
|
|
7082
|
+
const point = at >= 0 ? {
|
|
7083
|
+
t: model.times[at],
|
|
7084
|
+
value: model.line[at],
|
|
7085
|
+
low: model.low?.[at],
|
|
7086
|
+
high: model.high?.[at],
|
|
7087
|
+
context: model.context?.[at],
|
|
7088
|
+
status: model.status?.[at],
|
|
7089
|
+
stack: model.stack?.map((s) => s[at] ?? 0)
|
|
7090
|
+
} : void 0;
|
|
7091
|
+
const describe = () => {
|
|
7092
|
+
if (!point) return "";
|
|
7093
|
+
const parts = [
|
|
7094
|
+
`${elapsedLabel(point.t - model.x0)}, ${clockLabel(point.t)}.`
|
|
7095
|
+
];
|
|
7096
|
+
if (metric.stack)
|
|
7097
|
+
metric.stack.forEach(
|
|
7098
|
+
(layer, k) => parts.push(
|
|
7099
|
+
`${layer.label} ${compactNumber(point.stack?.[k] ?? 0, 0)}.`
|
|
7100
|
+
)
|
|
7101
|
+
);
|
|
7102
|
+
else parts.push(`${lineLabel} ${formatMetric(metric, point.value)}.`);
|
|
7103
|
+
if (point.low !== void 0 && point.high !== void 0)
|
|
7104
|
+
parts.push(
|
|
7105
|
+
`${metric.bandLabel ?? "p10\u2013p90"} ${compactNumber(point.low, digits)} to ${compactNumber(point.high, digits)}.`
|
|
7106
|
+
);
|
|
7107
|
+
if (point.context !== void 0)
|
|
7108
|
+
parts.push(
|
|
7109
|
+
`${metric.contextLabel ?? metric.context} ${compactNumber(point.context, digits)}.`
|
|
7110
|
+
);
|
|
7111
|
+
if (point.status !== void 0)
|
|
7112
|
+
parts.push(
|
|
7113
|
+
`${metric.statusLabel ?? metric.status} ${compactNumber(point.status, digits)}.`
|
|
7114
|
+
);
|
|
7115
|
+
return parts.join(" ");
|
|
7116
|
+
};
|
|
7117
|
+
const move = (event) => {
|
|
7118
|
+
if (last < 0) return;
|
|
7119
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
7120
|
+
const scale = rect.width ? width / rect.width : 1;
|
|
7121
|
+
const px = (event.clientX - rect.left) * scale;
|
|
7122
|
+
const t = model.x0 + (px - model.left) / (width - model.left - model.right) * (model.x1 - model.x0);
|
|
7123
|
+
setFocused(true);
|
|
7124
|
+
setHover(model.times[nearestIndex(model.times, t)]);
|
|
7125
|
+
};
|
|
7126
|
+
const key2 = (event) => {
|
|
7127
|
+
if (last < 0 || !HANDLED_KEYS2.includes(event.key)) return;
|
|
7128
|
+
event.preventDefault();
|
|
7129
|
+
const current = index ?? last;
|
|
7130
|
+
const next = event.key === "ArrowLeft" ? Math.max(0, current - 1) : event.key === "ArrowRight" ? Math.min(last, current + 1) : event.key === "Home" ? 0 : event.key === "End" ? last : null;
|
|
7131
|
+
setFocused(next !== null);
|
|
7132
|
+
setHover(next === null ? null : model.times[next]);
|
|
7133
|
+
};
|
|
7134
|
+
const leave = () => {
|
|
7135
|
+
setFocused(false);
|
|
7136
|
+
setHover(null);
|
|
7137
|
+
};
|
|
7138
|
+
const crosshair2 = index !== null && point;
|
|
7139
|
+
const tooltipLeft = point ? model.x(point.t) : 0;
|
|
7140
|
+
const flip = tooltipLeft > width - 190;
|
|
7141
|
+
const legend = metric.stack ? metric.stack.map((layer, k) => /* @__PURE__ */ jsx49(
|
|
7142
|
+
Key,
|
|
7143
|
+
{
|
|
7144
|
+
color: colors[k] ?? lineColor,
|
|
7145
|
+
label: layer.label
|
|
7146
|
+
},
|
|
7147
|
+
layer.field
|
|
7148
|
+
)) : [
|
|
7149
|
+
(metric.context || model.status) && /* @__PURE__ */ jsx49(Key, { color: lineColor, label: lineLabel }, "line"),
|
|
7150
|
+
metric.context && /* @__PURE__ */ jsx49(
|
|
7151
|
+
Key,
|
|
7152
|
+
{
|
|
7153
|
+
color: contextColor,
|
|
7154
|
+
label: metric.contextLabel ?? metric.context
|
|
7155
|
+
},
|
|
7156
|
+
"context"
|
|
7157
|
+
),
|
|
7158
|
+
model.status && /* @__PURE__ */ jsx49(
|
|
7159
|
+
Key,
|
|
7160
|
+
{
|
|
7161
|
+
color: statusColor,
|
|
7162
|
+
label: metric.statusLabel ?? metric.status
|
|
7163
|
+
},
|
|
7164
|
+
"status"
|
|
7165
|
+
),
|
|
7166
|
+
model.threshold !== void 0 && /* @__PURE__ */ jsx49(
|
|
7167
|
+
Key,
|
|
7168
|
+
{
|
|
7169
|
+
color: thresholdColor,
|
|
7170
|
+
label: metric.thresholdLabel ?? "limit"
|
|
7171
|
+
},
|
|
7172
|
+
"threshold"
|
|
7173
|
+
)
|
|
7174
|
+
].filter(Boolean);
|
|
7175
|
+
const name = label ?? `${metric.title} over time`;
|
|
7176
|
+
return /* @__PURE__ */ jsxs28(
|
|
7177
|
+
ChartFrame,
|
|
7178
|
+
{
|
|
7179
|
+
ref,
|
|
7180
|
+
"data-slot": "timeline-chart",
|
|
7181
|
+
"aria-label": name,
|
|
7182
|
+
className: cn("labui:gap-2 labui:px-4 labui:py-3", className),
|
|
7183
|
+
children: [
|
|
7184
|
+
/* @__PURE__ */ jsxs28("div", { className: "labui:flex labui:flex-wrap labui:items-baseline labui:justify-between labui:gap-x-3 labui:gap-y-1", children: [
|
|
7185
|
+
/* @__PURE__ */ jsxs28("span", { className: "labui:flex labui:flex-wrap labui:items-baseline labui:gap-x-3 labui:gap-y-1", children: [
|
|
7186
|
+
/* @__PURE__ */ jsx49("span", { className: "labui:text-sm labui:font-medium", children: metric.title }),
|
|
7187
|
+
legend.length > 0 && /* @__PURE__ */ jsx49("span", { className: "labui:inline-flex labui:flex-wrap labui:items-center labui:gap-x-3 labui:gap-y-1 labui:text-xs labui:text-muted-foreground", children: legend })
|
|
7188
|
+
] }),
|
|
7189
|
+
/* @__PURE__ */ jsxs28("span", { className: "labui:text-base labui:font-semibold labui:tabular-nums", children: [
|
|
7190
|
+
headlineText,
|
|
7191
|
+
index !== null && point ? /* @__PURE__ */ jsxs28("span", { className: "labui:ml-2 labui:text-xs labui:font-normal labui:text-muted-foreground", children: [
|
|
7192
|
+
"at ",
|
|
7193
|
+
elapsedLabel(point.t - model.x0)
|
|
7194
|
+
] }) : !live && headline !== void 0 && /* @__PURE__ */ jsx49("span", { className: "labui:ml-2 labui:text-xs labui:font-normal labui:text-muted-foreground", children: summary })
|
|
7195
|
+
] })
|
|
7196
|
+
] }),
|
|
7197
|
+
/* @__PURE__ */ jsxs28("div", { ref: container, className: "labui:relative labui:w-full", children: [
|
|
7198
|
+
last < 0 ? /* @__PURE__ */ jsx49(
|
|
7199
|
+
"p",
|
|
7200
|
+
{
|
|
7201
|
+
className: "labui:flex labui:items-center labui:justify-center labui:text-sm labui:text-muted-foreground",
|
|
7202
|
+
style: { height },
|
|
7203
|
+
children: "No data to display"
|
|
7204
|
+
}
|
|
7205
|
+
) : /* @__PURE__ */ jsxs28(
|
|
7206
|
+
"svg",
|
|
7207
|
+
{
|
|
7208
|
+
width,
|
|
7209
|
+
height,
|
|
7210
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
7211
|
+
role: "slider",
|
|
7212
|
+
"aria-label": `${name}, interactive timeline`,
|
|
7213
|
+
"aria-orientation": "horizontal",
|
|
7214
|
+
"aria-valuemin": 0,
|
|
7215
|
+
"aria-valuemax": last,
|
|
7216
|
+
"aria-valuenow": at,
|
|
7217
|
+
"aria-valuetext": describe(),
|
|
7218
|
+
"aria-describedby": `${id}-help`,
|
|
7219
|
+
tabIndex: 0,
|
|
7220
|
+
className: "labui:block labui:w-full labui:touch-none labui:rounded labui:outline-none labui:focus-visible:ring-2 labui:focus-visible:ring-ring labui:focus-visible:ring-inset",
|
|
7221
|
+
onPointerMove: move,
|
|
7222
|
+
onPointerLeave: leave,
|
|
7223
|
+
onKeyDown: key2,
|
|
7224
|
+
onBlur: leave,
|
|
7225
|
+
children: [
|
|
7226
|
+
model.yTicks.map((tick, i) => /* @__PURE__ */ jsxs28("g", { "aria-hidden": "true", children: [
|
|
7227
|
+
/* @__PURE__ */ jsx49(
|
|
7228
|
+
"line",
|
|
7229
|
+
{
|
|
7230
|
+
x1: model.left,
|
|
7231
|
+
x2: width - model.right,
|
|
7232
|
+
y1: model.y(tick),
|
|
7233
|
+
y2: model.y(tick),
|
|
7234
|
+
stroke: "var(--labui-border)",
|
|
7235
|
+
strokeWidth: 1
|
|
7236
|
+
}
|
|
7237
|
+
),
|
|
7238
|
+
/* @__PURE__ */ jsx49(
|
|
7239
|
+
"text",
|
|
7240
|
+
{
|
|
7241
|
+
x: model.left - 6,
|
|
7242
|
+
y: model.y(tick) + 3,
|
|
7243
|
+
textAnchor: "end",
|
|
7244
|
+
fontSize: 10,
|
|
7245
|
+
fill: contextColor,
|
|
7246
|
+
children: model.labels[i]
|
|
7247
|
+
}
|
|
7248
|
+
)
|
|
7249
|
+
] }, tick)),
|
|
7250
|
+
model.xTicks.map((offset) => /* @__PURE__ */ jsx49(
|
|
7251
|
+
"text",
|
|
7252
|
+
{
|
|
7253
|
+
"aria-hidden": "true",
|
|
7254
|
+
x: model.x(model.x0 + offset),
|
|
7255
|
+
y: height - 8,
|
|
7256
|
+
textAnchor: offset === 0 ? "start" : "middle",
|
|
7257
|
+
fontSize: 10,
|
|
7258
|
+
fill: contextColor,
|
|
7259
|
+
children: elapsedLabel(offset)
|
|
7260
|
+
},
|
|
7261
|
+
offset
|
|
7262
|
+
)),
|
|
7263
|
+
model.stackPaths.map((path, k) => /* @__PURE__ */ jsx49("path", { d: path, fill: colors[k] ?? lineColor }, k)),
|
|
7264
|
+
model.separatorPaths.map((path, k) => /* @__PURE__ */ jsx49(
|
|
7265
|
+
"path",
|
|
7266
|
+
{
|
|
7267
|
+
d: path,
|
|
7268
|
+
fill: "none",
|
|
7269
|
+
stroke: surfaceColor,
|
|
7270
|
+
strokeWidth: 2,
|
|
7271
|
+
strokeLinejoin: "round"
|
|
7272
|
+
},
|
|
7273
|
+
k
|
|
7274
|
+
)),
|
|
7275
|
+
model.bandPath && /* @__PURE__ */ jsx49("path", { d: model.bandPath, fill: lineColor, fillOpacity: 0.15 }),
|
|
7276
|
+
model.contextPath && /* @__PURE__ */ jsx49(
|
|
7277
|
+
"path",
|
|
7278
|
+
{
|
|
7279
|
+
d: model.contextPath,
|
|
7280
|
+
fill: "none",
|
|
7281
|
+
stroke: contextColor,
|
|
7282
|
+
strokeWidth: 1.5,
|
|
7283
|
+
strokeLinejoin: "round",
|
|
7284
|
+
strokeLinecap: "round",
|
|
7285
|
+
strokeOpacity: 0.7
|
|
7286
|
+
}
|
|
7287
|
+
),
|
|
7288
|
+
model.linePath && /* @__PURE__ */ jsx49(
|
|
7289
|
+
"path",
|
|
7290
|
+
{
|
|
7291
|
+
d: model.linePath,
|
|
7292
|
+
fill: "none",
|
|
7293
|
+
stroke: lineColor,
|
|
7294
|
+
strokeWidth: 2,
|
|
7295
|
+
strokeLinejoin: "round",
|
|
7296
|
+
strokeLinecap: "round"
|
|
7297
|
+
}
|
|
7298
|
+
),
|
|
7299
|
+
model.statusPath && /* @__PURE__ */ jsx49(
|
|
7300
|
+
"path",
|
|
7301
|
+
{
|
|
7302
|
+
d: model.statusPath,
|
|
7303
|
+
fill: "none",
|
|
7304
|
+
stroke: statusColor,
|
|
7305
|
+
strokeWidth: 2,
|
|
7306
|
+
strokeLinejoin: "round",
|
|
7307
|
+
strokeLinecap: "round"
|
|
7308
|
+
}
|
|
7309
|
+
),
|
|
7310
|
+
model.threshold !== void 0 && /* @__PURE__ */ jsxs28("g", { "aria-hidden": "true", children: [
|
|
7311
|
+
/* @__PURE__ */ jsx49(
|
|
7312
|
+
"line",
|
|
7313
|
+
{
|
|
7314
|
+
x1: model.left,
|
|
7315
|
+
x2: width - model.right,
|
|
7316
|
+
y1: model.y(model.threshold),
|
|
7317
|
+
y2: model.y(model.threshold),
|
|
7318
|
+
stroke: thresholdColor,
|
|
7319
|
+
strokeWidth: 1.5,
|
|
7320
|
+
strokeDasharray: "4 3"
|
|
7321
|
+
}
|
|
7322
|
+
),
|
|
7323
|
+
/* @__PURE__ */ jsxs28(
|
|
7324
|
+
"text",
|
|
7325
|
+
{
|
|
7326
|
+
x: width - model.right,
|
|
7327
|
+
y: model.y(model.threshold) - 4,
|
|
7328
|
+
textAnchor: "end",
|
|
7329
|
+
fontSize: 10,
|
|
7330
|
+
fill: contextColor,
|
|
7331
|
+
children: [
|
|
7332
|
+
metric.thresholdLabel ?? "limit",
|
|
7333
|
+
" ",
|
|
7334
|
+
compactNumber(model.threshold, thresholdDigits)
|
|
7335
|
+
]
|
|
7336
|
+
}
|
|
7337
|
+
)
|
|
7338
|
+
] }),
|
|
7339
|
+
live && point && index === null && !metric.stack && /* @__PURE__ */ jsx49(
|
|
7340
|
+
"circle",
|
|
7341
|
+
{
|
|
7342
|
+
cx: model.x(point.t),
|
|
7343
|
+
cy: model.y(point.value ?? 0),
|
|
7344
|
+
r: 4,
|
|
7345
|
+
fill: lineColor,
|
|
7346
|
+
stroke: surfaceColor,
|
|
7347
|
+
strokeWidth: 2
|
|
7348
|
+
}
|
|
7349
|
+
),
|
|
7350
|
+
crosshair2 && /* @__PURE__ */ jsxs28("g", { "aria-hidden": "true", children: [
|
|
7351
|
+
/* @__PURE__ */ jsx49(
|
|
7352
|
+
"line",
|
|
7353
|
+
{
|
|
7354
|
+
x1: model.x(point.t),
|
|
7355
|
+
x2: model.x(point.t),
|
|
7356
|
+
y1: model.top,
|
|
7357
|
+
y2: height - model.bottom,
|
|
7358
|
+
stroke: contextColor,
|
|
7359
|
+
strokeWidth: 1
|
|
7360
|
+
}
|
|
7361
|
+
),
|
|
7362
|
+
!metric.stack && /* @__PURE__ */ jsx49(
|
|
7363
|
+
"circle",
|
|
7364
|
+
{
|
|
7365
|
+
cx: model.x(point.t),
|
|
7366
|
+
cy: model.y(point.value ?? 0),
|
|
7367
|
+
r: 4,
|
|
7368
|
+
fill: lineColor,
|
|
7369
|
+
stroke: surfaceColor,
|
|
7370
|
+
strokeWidth: 2
|
|
7371
|
+
}
|
|
7372
|
+
)
|
|
7373
|
+
] })
|
|
7374
|
+
]
|
|
7375
|
+
}
|
|
7376
|
+
),
|
|
7377
|
+
crosshair2 && focused && /* @__PURE__ */ jsxs28(
|
|
7378
|
+
"div",
|
|
7379
|
+
{
|
|
7380
|
+
className: "labui:pointer-events-none labui:absolute labui:top-2 labui:z-10 labui:rounded-md labui:border labui:bg-popover labui:px-2.5 labui:py-1.5 labui:text-xs labui:text-popover-foreground labui:shadow-md",
|
|
7381
|
+
style: flip ? { right: width - tooltipLeft + 10 } : { left: tooltipLeft + 10 },
|
|
7382
|
+
children: [
|
|
7383
|
+
/* @__PURE__ */ jsxs28("div", { className: "labui:text-muted-foreground labui:tabular-nums", children: [
|
|
7384
|
+
elapsedLabel(point.t - model.x0),
|
|
7385
|
+
" \xB7 ",
|
|
7386
|
+
clockLabel(point.t)
|
|
7387
|
+
] }),
|
|
7388
|
+
metric.stack ? [...metric.stack].reverse().map((layer, r) => {
|
|
7389
|
+
const k = metric.stack.length - 1 - r;
|
|
7390
|
+
return /* @__PURE__ */ jsx49(
|
|
7391
|
+
Row,
|
|
7392
|
+
{
|
|
7393
|
+
swatch: true,
|
|
7394
|
+
color: colors[k] ?? lineColor,
|
|
7395
|
+
value: compactNumber(point.stack?.[k] ?? 0, 0),
|
|
7396
|
+
label: layer.label
|
|
7397
|
+
},
|
|
7398
|
+
layer.field
|
|
7399
|
+
);
|
|
7400
|
+
}) : /* @__PURE__ */ jsx49(
|
|
7401
|
+
Row,
|
|
7402
|
+
{
|
|
7403
|
+
color: lineColor,
|
|
7404
|
+
value: formatMetric(metric, point.value),
|
|
7405
|
+
label: lineLabel
|
|
7406
|
+
}
|
|
7407
|
+
),
|
|
7408
|
+
point.low !== void 0 && point.high !== void 0 && /* @__PURE__ */ jsxs28("div", { className: "labui:text-muted-foreground labui:tabular-nums", children: [
|
|
7409
|
+
metric.bandLabel ?? "p10\u2013p90",
|
|
7410
|
+
" ",
|
|
7411
|
+
compactNumber(point.low, digits),
|
|
7412
|
+
"\u2013",
|
|
7413
|
+
compactNumber(point.high, digits)
|
|
7414
|
+
] }),
|
|
7415
|
+
point.context !== void 0 && /* @__PURE__ */ jsx49(
|
|
7416
|
+
Row,
|
|
7417
|
+
{
|
|
7418
|
+
color: contextColor,
|
|
7419
|
+
value: compactNumber(point.context, digits),
|
|
7420
|
+
label: metric.contextLabel ?? metric.context
|
|
7421
|
+
}
|
|
7422
|
+
),
|
|
7423
|
+
point.status !== void 0 && /* @__PURE__ */ jsx49(
|
|
7424
|
+
Row,
|
|
7425
|
+
{
|
|
7426
|
+
color: statusColor,
|
|
7427
|
+
value: compactNumber(point.status, digits),
|
|
7428
|
+
label: metric.statusLabel ?? metric.status
|
|
7429
|
+
}
|
|
7430
|
+
)
|
|
7431
|
+
]
|
|
7432
|
+
}
|
|
7433
|
+
)
|
|
7434
|
+
] }),
|
|
7435
|
+
/* @__PURE__ */ jsx49("p", { id: `${id}-help`, className: "labui:sr-only", children: "Hover or use the arrow keys to inspect a moment. Home and End jump to the ends, Escape clears." })
|
|
7436
|
+
]
|
|
7437
|
+
}
|
|
7438
|
+
);
|
|
7439
|
+
}
|
|
7440
|
+
);
|
|
7441
|
+
var Sparkline = React51.forwardRef(
|
|
7442
|
+
function Sparkline2({ values, label, width = 96, height = 24, className }, ref) {
|
|
7443
|
+
const path = React51.useMemo(() => {
|
|
7444
|
+
if (values.length < 2) return void 0;
|
|
7445
|
+
let min = Math.min(...values);
|
|
7446
|
+
let max = Math.max(...values);
|
|
7447
|
+
if (max === min) {
|
|
7448
|
+
min -= 1;
|
|
7449
|
+
max += 1;
|
|
7450
|
+
}
|
|
7451
|
+
const pad = 3;
|
|
7452
|
+
const xs = values.map(
|
|
7453
|
+
(_, i) => pad + i / (values.length - 1) * (width - 2 * pad)
|
|
7454
|
+
);
|
|
7455
|
+
const ys = values.map(
|
|
7456
|
+
(v) => pad + (1 - (v - min) / (max - min)) * (height - 2 * pad)
|
|
7457
|
+
);
|
|
7458
|
+
return { d: linePath(xs, ys), x: xs.at(-1), y: ys.at(-1) };
|
|
7459
|
+
}, [values, width, height]);
|
|
7460
|
+
return /* @__PURE__ */ jsxs28(
|
|
7461
|
+
"svg",
|
|
7462
|
+
{
|
|
7463
|
+
ref,
|
|
7464
|
+
role: "img",
|
|
7465
|
+
"aria-label": label,
|
|
7466
|
+
viewBox: `0 0 ${width} ${height}`,
|
|
7467
|
+
width,
|
|
7468
|
+
height,
|
|
7469
|
+
className: cn("labui:shrink-0", className),
|
|
7470
|
+
children: [
|
|
7471
|
+
/* @__PURE__ */ jsx49("title", { children: label }),
|
|
7472
|
+
path ? /* @__PURE__ */ jsxs28(Fragment8, { children: [
|
|
7473
|
+
/* @__PURE__ */ jsx49(
|
|
7474
|
+
"path",
|
|
7475
|
+
{
|
|
7476
|
+
d: path.d,
|
|
7477
|
+
fill: "none",
|
|
7478
|
+
stroke: lineColor,
|
|
7479
|
+
strokeWidth: 1.5,
|
|
7480
|
+
strokeLinejoin: "round",
|
|
7481
|
+
strokeLinecap: "round"
|
|
7482
|
+
}
|
|
7483
|
+
),
|
|
7484
|
+
/* @__PURE__ */ jsx49(
|
|
7485
|
+
"circle",
|
|
7486
|
+
{
|
|
7487
|
+
cx: path.x,
|
|
7488
|
+
cy: path.y,
|
|
7489
|
+
r: 2.5,
|
|
7490
|
+
fill: lineColor,
|
|
7491
|
+
stroke: surfaceColor,
|
|
7492
|
+
strokeWidth: 1.5
|
|
7493
|
+
}
|
|
7494
|
+
)
|
|
7495
|
+
] }) : /* @__PURE__ */ jsx49(
|
|
7496
|
+
"line",
|
|
7497
|
+
{
|
|
7498
|
+
x1: 3,
|
|
7499
|
+
x2: width - 3,
|
|
7500
|
+
y1: height / 2,
|
|
7501
|
+
y2: height / 2,
|
|
7502
|
+
stroke: "var(--labui-border)",
|
|
7503
|
+
strokeWidth: 1
|
|
7504
|
+
}
|
|
7505
|
+
)
|
|
7506
|
+
]
|
|
7507
|
+
}
|
|
7508
|
+
);
|
|
7509
|
+
}
|
|
7510
|
+
);
|
|
7511
|
+
|
|
7512
|
+
// timing-tracks.tsx
|
|
7513
|
+
import * as React52 from "react";
|
|
7514
|
+
import { Fragment as Fragment9, jsx as jsx50, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
6760
7515
|
var TICKS = 5;
|
|
6761
7516
|
var formatValue2 = (value) => value.toLocaleString(void 0, { maximumFractionDigits: 3 });
|
|
6762
|
-
var TimingTracks =
|
|
7517
|
+
var TimingTracks = React52.forwardRef(
|
|
6763
7518
|
function TimingTracks2({ tracks, from, to, label = "Timeline", unit = "ms", onSelect }, ref) {
|
|
6764
|
-
const [active, setActive] =
|
|
7519
|
+
const [active, setActive] = React52.useState(null);
|
|
6765
7520
|
const range = Math.max(1e-3, to - from);
|
|
6766
7521
|
const visible = (span) => span.end >= from && span.start <= to;
|
|
6767
7522
|
const placement = (span) => {
|
|
@@ -6773,26 +7528,26 @@ var TimingTracks = React51.forwardRef(
|
|
|
6773
7528
|
};
|
|
6774
7529
|
};
|
|
6775
7530
|
const duration = (span) => `${formatValue2(span.end - span.start)} ${unit}`;
|
|
6776
|
-
return /* @__PURE__ */
|
|
6777
|
-
/* @__PURE__ */
|
|
6778
|
-
/* @__PURE__ */
|
|
6779
|
-
/* @__PURE__ */
|
|
7531
|
+
return /* @__PURE__ */ jsxs29(ChartFrame, { "data-slot": "timing-tracks", "aria-label": label, ref, children: [
|
|
7532
|
+
/* @__PURE__ */ jsx50("div", { className: "labui:border-b labui:px-4 labui:py-3 labui:text-sm labui:font-semibold", children: label }),
|
|
7533
|
+
/* @__PURE__ */ jsx50("div", { className: "labui:overflow-x-auto labui:p-4", children: /* @__PURE__ */ jsxs29("div", { className: "labui:min-w-[560px]", children: [
|
|
7534
|
+
/* @__PURE__ */ jsx50("div", { className: "labui:mb-2 labui:ml-36 labui:flex labui:justify-between labui:text-xs labui:text-muted-foreground labui:tabular-nums", children: Array.from({ length: TICKS }, (_, i) => /* @__PURE__ */ jsxs29("span", { children: [
|
|
6780
7535
|
formatValue2(from + range * i / (TICKS - 1)),
|
|
6781
7536
|
" ",
|
|
6782
7537
|
unit
|
|
6783
7538
|
] }, i)) }),
|
|
6784
|
-
tracks.map((track) => /* @__PURE__ */
|
|
7539
|
+
tracks.map((track) => /* @__PURE__ */ jsxs29(
|
|
6785
7540
|
"div",
|
|
6786
7541
|
{
|
|
6787
7542
|
className: "labui:mb-2 labui:flex labui:items-center labui:gap-3",
|
|
6788
7543
|
children: [
|
|
6789
|
-
/* @__PURE__ */
|
|
6790
|
-
/* @__PURE__ */
|
|
7544
|
+
/* @__PURE__ */ jsx50("span", { className: "labui:w-32 labui:shrink-0 labui:text-xs labui:font-medium", children: track.label }),
|
|
7545
|
+
/* @__PURE__ */ jsx50(
|
|
6791
7546
|
"div",
|
|
6792
7547
|
{
|
|
6793
7548
|
className: "labui:relative labui:h-9 labui:flex-1 labui:rounded labui:border labui:bg-muted/30",
|
|
6794
7549
|
"aria-label": track.label,
|
|
6795
|
-
children: track.spans.filter(visible).map((span) => /* @__PURE__ */
|
|
7550
|
+
children: track.spans.filter(visible).map((span) => /* @__PURE__ */ jsx50(
|
|
6796
7551
|
"button",
|
|
6797
7552
|
{
|
|
6798
7553
|
type: "button",
|
|
@@ -6822,17 +7577,17 @@ var TimingTracks = React51.forwardRef(
|
|
|
6822
7577
|
track.id
|
|
6823
7578
|
))
|
|
6824
7579
|
] }) }),
|
|
6825
|
-
/* @__PURE__ */
|
|
7580
|
+
/* @__PURE__ */ jsx50(
|
|
6826
7581
|
"div",
|
|
6827
7582
|
{
|
|
6828
7583
|
className: "labui:min-h-14 labui:border-t labui:bg-muted/20 labui:px-4 labui:py-3 labui:text-xs",
|
|
6829
7584
|
"aria-live": "polite",
|
|
6830
|
-
children: active ? /* @__PURE__ */
|
|
6831
|
-
/* @__PURE__ */
|
|
7585
|
+
children: active ? /* @__PURE__ */ jsxs29(Fragment9, { children: [
|
|
7586
|
+
/* @__PURE__ */ jsx50("strong", { children: active.label }),
|
|
6832
7587
|
", ",
|
|
6833
7588
|
duration(active),
|
|
6834
|
-
/* @__PURE__ */
|
|
6835
|
-
] }) : /* @__PURE__ */
|
|
7589
|
+
/* @__PURE__ */ jsx50("span", { className: "labui:ml-2 labui:text-muted-foreground", children: active.detail })
|
|
7590
|
+
] }) : /* @__PURE__ */ jsx50("span", { className: "labui:text-muted-foreground", children: "Hover or focus a span for its timing. Dashed spans indicate observation windows." })
|
|
6836
7591
|
}
|
|
6837
7592
|
)
|
|
6838
7593
|
] });
|
|
@@ -6840,10 +7595,10 @@ var TimingTracks = React51.forwardRef(
|
|
|
6840
7595
|
);
|
|
6841
7596
|
|
|
6842
7597
|
// toggle.tsx
|
|
6843
|
-
import * as
|
|
7598
|
+
import * as React53 from "react";
|
|
6844
7599
|
import * as TogglePrimitive from "@radix-ui/react-toggle";
|
|
6845
7600
|
import * as ToggleGroupPrimitive from "@radix-ui/react-toggle-group";
|
|
6846
|
-
import { jsx as
|
|
7601
|
+
import { jsx as jsx51 } from "react/jsx-runtime";
|
|
6847
7602
|
var toggleVariants = {
|
|
6848
7603
|
default: "labui:bg-transparent",
|
|
6849
7604
|
outline: "labui:border labui:border-input labui:bg-transparent labui:shadow-xs labui:hover:bg-accent labui:hover:text-accent-foreground"
|
|
@@ -6862,8 +7617,8 @@ function toggleClasses({ variant = "default", size = "default" }) {
|
|
|
6862
7617
|
toggleSizes[size]
|
|
6863
7618
|
);
|
|
6864
7619
|
}
|
|
6865
|
-
var Toggle =
|
|
6866
|
-
return /* @__PURE__ */
|
|
7620
|
+
var Toggle = React53.forwardRef(function Toggle2({ className, variant, size, ...props }, ref) {
|
|
7621
|
+
return /* @__PURE__ */ jsx51(
|
|
6867
7622
|
TogglePrimitive.Root,
|
|
6868
7623
|
{
|
|
6869
7624
|
ref,
|
|
@@ -6873,13 +7628,13 @@ var Toggle = React52.forwardRef(function Toggle2({ className, variant, size, ...
|
|
|
6873
7628
|
}
|
|
6874
7629
|
);
|
|
6875
7630
|
});
|
|
6876
|
-
var ToggleGroupContext =
|
|
6877
|
-
var ToggleGroup =
|
|
6878
|
-
const style =
|
|
7631
|
+
var ToggleGroupContext = React53.createContext({ spacing: 0 });
|
|
7632
|
+
var ToggleGroup = React53.forwardRef(function ToggleGroup2({ className, variant, size, spacing = 0, children, ...props }, ref) {
|
|
7633
|
+
const style = React53.useMemo(
|
|
6879
7634
|
() => ({ variant, size, spacing }),
|
|
6880
7635
|
[variant, size, spacing]
|
|
6881
7636
|
);
|
|
6882
|
-
return /* @__PURE__ */
|
|
7637
|
+
return /* @__PURE__ */ jsx51(
|
|
6883
7638
|
ToggleGroupPrimitive.Root,
|
|
6884
7639
|
{
|
|
6885
7640
|
ref,
|
|
@@ -6893,17 +7648,17 @@ var ToggleGroup = React52.forwardRef(function ToggleGroup2({ className, variant,
|
|
|
6893
7648
|
className
|
|
6894
7649
|
),
|
|
6895
7650
|
...props,
|
|
6896
|
-
children: /* @__PURE__ */
|
|
7651
|
+
children: /* @__PURE__ */ jsx51(ToggleGroupContext.Provider, { value: style, children })
|
|
6897
7652
|
}
|
|
6898
7653
|
);
|
|
6899
7654
|
});
|
|
6900
|
-
var ToggleGroupItem =
|
|
6901
|
-
const group =
|
|
7655
|
+
var ToggleGroupItem = React53.forwardRef(function ToggleGroupItem2({ className, variant, size, ...props }, ref) {
|
|
7656
|
+
const group = React53.useContext(ToggleGroupContext);
|
|
6902
7657
|
const style = {
|
|
6903
7658
|
variant: group.variant ?? variant,
|
|
6904
7659
|
size: group.size ?? size
|
|
6905
7660
|
};
|
|
6906
|
-
return /* @__PURE__ */
|
|
7661
|
+
return /* @__PURE__ */ jsx51(
|
|
6907
7662
|
ToggleGroupPrimitive.Item,
|
|
6908
7663
|
{
|
|
6909
7664
|
ref,
|
|
@@ -6923,10 +7678,10 @@ var ToggleGroupItem = React52.forwardRef(function ToggleGroupItem2({ className,
|
|
|
6923
7678
|
});
|
|
6924
7679
|
|
|
6925
7680
|
// topbar.tsx
|
|
6926
|
-
import * as
|
|
6927
|
-
import { jsx as
|
|
6928
|
-
var Topbar =
|
|
6929
|
-
return /* @__PURE__ */
|
|
7681
|
+
import * as React54 from "react";
|
|
7682
|
+
import { jsx as jsx52 } from "react/jsx-runtime";
|
|
7683
|
+
var Topbar = React54.forwardRef(function Topbar2({ className, ...props }, ref) {
|
|
7684
|
+
return /* @__PURE__ */ jsx52(
|
|
6930
7685
|
"header",
|
|
6931
7686
|
{
|
|
6932
7687
|
ref,
|
|
@@ -6939,8 +7694,8 @@ var Topbar = React53.forwardRef(function Topbar2({ className, ...props }, ref) {
|
|
|
6939
7694
|
}
|
|
6940
7695
|
);
|
|
6941
7696
|
});
|
|
6942
|
-
var TopbarActions =
|
|
6943
|
-
return /* @__PURE__ */
|
|
7697
|
+
var TopbarActions = React54.forwardRef(function TopbarActions2({ className, ...props }, ref) {
|
|
7698
|
+
return /* @__PURE__ */ jsx52(
|
|
6944
7699
|
"div",
|
|
6945
7700
|
{
|
|
6946
7701
|
ref,
|
|
@@ -7121,6 +7876,7 @@ export {
|
|
|
7121
7876
|
SidebarSeparator,
|
|
7122
7877
|
SidebarTrigger,
|
|
7123
7878
|
Skeleton,
|
|
7879
|
+
Sparkline,
|
|
7124
7880
|
Spinner,
|
|
7125
7881
|
Stat,
|
|
7126
7882
|
StatDetail,
|
|
@@ -7142,6 +7898,7 @@ export {
|
|
|
7142
7898
|
Textarea,
|
|
7143
7899
|
ThemeStyle,
|
|
7144
7900
|
TimeSeriesChart,
|
|
7901
|
+
TimelineChart,
|
|
7145
7902
|
TimingTracks,
|
|
7146
7903
|
Toggle,
|
|
7147
7904
|
ToggleGroup,
|
|
@@ -7152,20 +7909,35 @@ export {
|
|
|
7152
7909
|
TooltipTrigger,
|
|
7153
7910
|
Topbar,
|
|
7154
7911
|
TopbarActions,
|
|
7912
|
+
bytesLabel,
|
|
7913
|
+
clockLabel,
|
|
7155
7914
|
cn,
|
|
7156
7915
|
column,
|
|
7916
|
+
compactNumber,
|
|
7917
|
+
elapsedLabel,
|
|
7918
|
+
fieldIndex,
|
|
7919
|
+
formatMetric,
|
|
7920
|
+
hasTimelineData,
|
|
7157
7921
|
matchesConfirmation,
|
|
7158
7922
|
mono,
|
|
7923
|
+
nearestIndex,
|
|
7159
7924
|
num,
|
|
7925
|
+
rates,
|
|
7160
7926
|
resolveDrag,
|
|
7161
7927
|
sidePanelLimits,
|
|
7928
|
+
summarize,
|
|
7162
7929
|
themeColors,
|
|
7163
7930
|
themeCss,
|
|
7931
|
+
timeTicks,
|
|
7932
|
+
timelineCSV,
|
|
7933
|
+
timelineModel,
|
|
7934
|
+
timelineValues,
|
|
7164
7935
|
useBrowserLayout,
|
|
7165
7936
|
useChartWidth,
|
|
7166
7937
|
useIsMobile,
|
|
7167
7938
|
useSidebar,
|
|
7168
7939
|
useTabActive,
|
|
7169
|
-
useTabVisible
|
|
7940
|
+
useTabVisible,
|
|
7941
|
+
valueTicks
|
|
7170
7942
|
};
|
|
7171
7943
|
//# sourceMappingURL=index.js.map
|