@brett_lamy/ui 5.13.0 → 5.15.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/components/call-stack.d.ts +26 -0
- package/dist/components/call-stack.d.ts.map +1 -0
- package/dist/components/call-stack.js +236 -0
- package/dist/components/code-editor-window.d.ts +191 -0
- package/dist/components/code-editor-window.d.ts.map +1 -0
- package/dist/components/code-editor-window.js +1474 -0
- package/dist/components/code-editor.d.ts +213 -0
- package/dist/components/code-editor.d.ts.map +1 -0
- package/dist/components/code-editor.js +484 -0
- package/dist/components/file-upload.d.ts +1 -1
- package/dist/components/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload.js +1 -1
- package/dist/components/filter-input.d.ts +1 -1
- package/dist/components/filter-input.d.ts.map +1 -1
- package/dist/components/filter-input.js +1 -1
- package/dist/components/filter.d.ts +1 -1
- package/dist/components/filter.d.ts.map +1 -1
- package/dist/components/filter.js +1 -1
- package/dist/components/log-list.d.ts +95 -0
- package/dist/components/log-list.d.ts.map +1 -0
- package/dist/components/log-list.js +549 -0
- package/dist/components/object-tree.d.ts +30 -0
- package/dist/components/object-tree.d.ts.map +1 -0
- package/dist/components/object-tree.js +415 -0
- package/dist/components/object-value.d.ts +13 -0
- package/dist/components/object-value.d.ts.map +1 -0
- package/dist/components/object-value.js +69 -0
- package/dist/components/request-table.d.ts +78 -0
- package/dist/components/request-table.d.ts.map +1 -0
- package/dist/components/request-table.js +697 -0
- package/dist/components/spreadsheet.d.ts +1 -1
- package/dist/components/spreadsheet.d.ts.map +1 -1
- package/dist/components/spreadsheet.js +1 -1
- package/dist/components/syntax-highlighting.d.ts +45 -77
- package/dist/components/syntax-highlighting.d.ts.map +1 -1
- package/dist/components/syntax-highlighting.js +36 -275
- package/dist/components/terminal.d.ts +62 -0
- package/dist/components/terminal.d.ts.map +1 -0
- package/dist/components/terminal.js +172 -0
- package/dist/components/trace-timeline.d.ts +97 -0
- package/dist/components/trace-timeline.d.ts.map +1 -0
- package/dist/components/trace-timeline.js +850 -0
- package/dist/components/tree.d.ts.map +1 -1
- package/dist/components/tree.js +99 -91
- package/dist/components/video-preview.d.ts +1 -1
- package/dist/components/video-preview.d.ts.map +1 -1
- package/dist/components/video-preview.js +1 -1
- package/dist/components/video-timeline.d.ts +1 -1
- package/dist/components/video-timeline.d.ts.map +1 -1
- package/dist/components/video-timeline.js +1 -1
- package/dist/components/workspace.d.ts.map +1 -1
- package/dist/components/workspace.js +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +45 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +119 -100
- package/dist/lib/call-stack-model.d.ts +75 -0
- package/dist/lib/call-stack-model.d.ts.map +1 -0
- package/dist/lib/call-stack-model.js +114 -0
- package/dist/lib/code-document.d.ts +229 -0
- package/dist/lib/code-document.d.ts.map +1 -0
- package/dist/lib/code-document.js +727 -0
- package/dist/lib/code-editor-gpu.d.ts +9 -0
- package/dist/lib/code-editor-gpu.d.ts.map +1 -0
- package/dist/lib/code-editor-gpu.js +23 -0
- package/dist/lib/code-editor-model.d.ts +371 -0
- package/dist/lib/code-editor-model.d.ts.map +1 -0
- package/dist/lib/code-editor-model.js +1105 -0
- package/dist/lib/{file-upload.d.ts → file-upload-model.d.ts} +1 -1
- package/dist/lib/file-upload-model.d.ts.map +1 -0
- package/dist/lib/{file-upload.js → file-upload-model.js} +1 -1
- package/dist/lib/{filter.d.ts → filter-model.d.ts} +1 -1
- package/dist/lib/filter-model.d.ts.map +1 -0
- package/dist/lib/{filter.js → filter-model.js} +1 -1
- package/dist/lib/filter-query.d.ts +1 -1
- package/dist/lib/filter-query.d.ts.map +1 -1
- package/dist/lib/filter-query.js +1 -1
- package/dist/lib/log-list-model.d.ts +132 -0
- package/dist/lib/log-list-model.d.ts.map +1 -0
- package/dist/lib/log-list-model.js +214 -0
- package/dist/lib/log-list-window.d.ts +121 -0
- package/dist/lib/log-list-window.d.ts.map +1 -0
- package/dist/lib/log-list-window.js +245 -0
- package/dist/lib/object-tree-model.d.ts +162 -0
- package/dist/lib/object-tree-model.d.ts.map +1 -0
- package/dist/lib/object-tree-model.js +347 -0
- package/dist/lib/object-tree-value.d.ts +139 -0
- package/dist/lib/object-tree-value.d.ts.map +1 -0
- package/dist/lib/object-tree-value.js +410 -0
- package/dist/lib/request-table-model.d.ts +85 -0
- package/dist/lib/request-table-model.d.ts.map +1 -0
- package/dist/lib/request-table-model.js +105 -0
- package/dist/lib/{spreadsheet.d.ts → spreadsheet-model.d.ts} +1 -1
- package/dist/lib/spreadsheet-model.d.ts.map +1 -0
- package/dist/lib/{spreadsheet.js → spreadsheet-model.js} +1 -1
- package/dist/lib/syntax.d.ts +19 -7
- package/dist/lib/syntax.d.ts.map +1 -1
- package/dist/lib/syntax.js +54 -50
- package/dist/lib/terminal-line.d.ts +155 -0
- package/dist/lib/terminal-line.d.ts.map +1 -0
- package/dist/lib/terminal-line.js +463 -0
- package/dist/lib/trace-timeline-draw.d.ts +109 -0
- package/dist/lib/trace-timeline-draw.d.ts.map +1 -0
- package/dist/lib/trace-timeline-draw.js +252 -0
- package/dist/lib/trace-timeline-model.d.ts +324 -0
- package/dist/lib/trace-timeline-model.d.ts.map +1 -0
- package/dist/lib/trace-timeline-model.js +510 -0
- package/dist/lib/video-render.d.ts +1 -1
- package/dist/lib/video-render.d.ts.map +1 -1
- package/dist/lib/video-render.js +1 -1
- package/dist/lib/{video-timeline.d.ts → video-timeline-model.d.ts} +1 -1
- package/dist/lib/video-timeline-model.d.ts.map +1 -0
- package/dist/lib/{video-timeline.js → video-timeline-model.js} +1 -1
- package/package.json +7 -1
- package/dist/lib/file-upload.d.ts.map +0 -1
- package/dist/lib/filter.d.ts.map +0 -1
- package/dist/lib/spreadsheet.d.ts.map +0 -1
- package/dist/lib/video-timeline.d.ts.map +0 -1
|
@@ -0,0 +1,850 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../lib/utils.js";
|
|
3
|
+
import { useControllableState as t } from "../lib/controllable-state.js";
|
|
4
|
+
import { TRACE_MIN_SPAN as n, TRACE_SCRUB_SPEEDS as r, adjacentStop as i, chooseTicks as a, clampView as o, formatTraceTime as s, layoutRail as c, layoutStrip as l, linearAxis as ee, moveScrub as te, nearestMark as ne, panWindow as re, pinchWindow as ie, pixelEdges as ae, placeRailCard as oe, placeStripCard as se, railDashInset as ce, requestAt as le, rescaleScrub as ue, resolutionAt as de, rowAt as fe, sameLanes as pe, scrubPosition as me, selectStops as he, startScrub as ge, stopsByTime as _e, stripHeight as ve, traceSwell as ye, viewWindow as be, windowView as xe, zoomWindow as Se } from "../lib/trace-timeline-model.js";
|
|
5
|
+
import { TraceBuffers as Ce, drawTraceData as we, drawTraceOverlay as Te, groupRequests as Ee, toneColor as De } from "../lib/trace-timeline-draw.js";
|
|
6
|
+
import { useEffect as u, useImperativeHandle as Oe, useLayoutEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
7
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
8
|
+
import { cva as _ } from "class-variance-authority";
|
|
9
|
+
//#region src/components/trace-timeline.tsx
|
|
10
|
+
var ke = _("font-sans touch-none select-none", {
|
|
11
|
+
variants: {
|
|
12
|
+
orientation: {
|
|
13
|
+
horizontal: "relative block h-(--tt-height) w-full cursor-crosshair bg-background -outline-offset-2 [outline:2px_solid_transparent] focus-visible:[outline:2px_solid_var(--primary)]",
|
|
14
|
+
vertical: "absolute top-(--tt-top) bottom-(--tt-bottom) z-80 w-(--tt-width) cursor-pointer rounded-lg -outline-offset-2 [outline:2px_solid_transparent] focus-visible:[outline:2px_solid_var(--primary)]"
|
|
15
|
+
},
|
|
16
|
+
side: {
|
|
17
|
+
right: "",
|
|
18
|
+
left: ""
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
compoundVariants: [{
|
|
22
|
+
orientation: "vertical",
|
|
23
|
+
side: "right",
|
|
24
|
+
className: "right-0"
|
|
25
|
+
}, {
|
|
26
|
+
orientation: "vertical",
|
|
27
|
+
side: "left",
|
|
28
|
+
className: "left-0"
|
|
29
|
+
}],
|
|
30
|
+
defaultVariants: {
|
|
31
|
+
orientation: "horizontal",
|
|
32
|
+
side: "right"
|
|
33
|
+
}
|
|
34
|
+
}), Ae = [], je = [], Me = [], Ne = [], Pe = {
|
|
35
|
+
foreground: "text-foreground",
|
|
36
|
+
muted: "text-muted-foreground",
|
|
37
|
+
faint: "text-tertiary-foreground",
|
|
38
|
+
border: "text-border",
|
|
39
|
+
primary: "text-primary",
|
|
40
|
+
background: "text-background",
|
|
41
|
+
surface: "text-muted",
|
|
42
|
+
ruler: "text-secondary",
|
|
43
|
+
card: "text-card",
|
|
44
|
+
warning: "text-warning",
|
|
45
|
+
success: "text-success",
|
|
46
|
+
error: "text-destructive",
|
|
47
|
+
chart1: "text-chart-1",
|
|
48
|
+
chart2: "text-chart-2",
|
|
49
|
+
chart3: "text-chart-3",
|
|
50
|
+
chart4: "text-chart-4",
|
|
51
|
+
chart5: "text-chart-5"
|
|
52
|
+
}, Fe = Object.keys(Pe), Ie = {
|
|
53
|
+
info: "bg-primary",
|
|
54
|
+
success: "bg-success",
|
|
55
|
+
warning: "bg-warning",
|
|
56
|
+
error: "bg-destructive"
|
|
57
|
+
};
|
|
58
|
+
function Le(e) {
|
|
59
|
+
let t = {};
|
|
60
|
+
for (let n of Array.from(e.children)) {
|
|
61
|
+
let e = n.dataset.token;
|
|
62
|
+
e && (t[e] = getComputedStyle(n).color);
|
|
63
|
+
}
|
|
64
|
+
return t;
|
|
65
|
+
}
|
|
66
|
+
function Re(e) {
|
|
67
|
+
return {
|
|
68
|
+
foreground: e.foreground,
|
|
69
|
+
muted: e.muted,
|
|
70
|
+
faint: e.faint,
|
|
71
|
+
border: e.border,
|
|
72
|
+
primary: e.primary,
|
|
73
|
+
background: e.background,
|
|
74
|
+
surface: e.surface,
|
|
75
|
+
ruler: e.ruler,
|
|
76
|
+
card: e.card,
|
|
77
|
+
warning: e.warning,
|
|
78
|
+
success: e.success,
|
|
79
|
+
error: e.error,
|
|
80
|
+
chart: [
|
|
81
|
+
e.chart1,
|
|
82
|
+
e.chart2,
|
|
83
|
+
e.chart3,
|
|
84
|
+
e.chart4,
|
|
85
|
+
e.chart5
|
|
86
|
+
]
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function ze(e, t) {
|
|
90
|
+
let [n, r] = m(null);
|
|
91
|
+
return d(() => {
|
|
92
|
+
let n = e.current, i = t.current;
|
|
93
|
+
if (!n || !i || typeof getComputedStyle > "u") return;
|
|
94
|
+
let a = () => {
|
|
95
|
+
let e = Le(i), t = `11px ${getComputedStyle(n).fontFamily || "sans-serif"}`, a = JSON.stringify(e) + t;
|
|
96
|
+
r((n) => n?.signature === a ? n : {
|
|
97
|
+
colors: Re(e),
|
|
98
|
+
font: t,
|
|
99
|
+
signature: a
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
a();
|
|
103
|
+
let o = 0, s = () => {
|
|
104
|
+
o ||= requestAnimationFrame(() => {
|
|
105
|
+
o = 0, a();
|
|
106
|
+
});
|
|
107
|
+
}, c = null;
|
|
108
|
+
if (typeof MutationObserver < "u") {
|
|
109
|
+
c = new MutationObserver(s);
|
|
110
|
+
for (let e = n.parentElement; e; e = e.parentElement) c.observe(e, {
|
|
111
|
+
attributes: !0,
|
|
112
|
+
attributeFilter: [
|
|
113
|
+
"class",
|
|
114
|
+
"style",
|
|
115
|
+
"data-theme",
|
|
116
|
+
"data-theme-scope"
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
let l = typeof matchMedia > "u" ? null : matchMedia("(prefers-color-scheme: dark)");
|
|
121
|
+
l?.addEventListener?.("change", s);
|
|
122
|
+
let ee = typeof document > "u" ? void 0 : document.fonts, te = () => r((e) => e && { ...e });
|
|
123
|
+
return ee?.addEventListener?.("loadingdone", te), () => {
|
|
124
|
+
cancelAnimationFrame(o), c?.disconnect(), l?.removeEventListener?.("change", s), ee?.removeEventListener?.("loadingdone", te);
|
|
125
|
+
};
|
|
126
|
+
}, [e, t]), n;
|
|
127
|
+
}
|
|
128
|
+
var Be = (e) => typeof e == "number" ? e + "px" : e, Ve = 1500, He = 350, Ue = 12, We = 2, Ge = 2;
|
|
129
|
+
function Ke({ range: _, axis: Le, lanes: Re = Ae, requests: Ke = je, stops: qe = Me, value: Je, defaultValue: Ye, onValueChange: Xe, view: Ze, defaultView: Qe, onViewChange: $e, orientation: v = "horizontal", side: y = "right", top: et, bottom: tt, railWidth: b = 44, insetContent: nt = !0, focusedLane: rt, onFocusLane: it, selectedThread: at = null, onSelectThread: ot, selectedRequest: st = null, onSelectRequest: ct, fetchActivity: lt, activityDebounce: ut = 60, step: dt, minSpan: ft = n, formatTime: x = s, renderPreview: pt, previewLines: mt = 2, previewWidth: ht = 260, gutter: gt = 64, requestsLabel: _t = "requests", stopsLabel: vt = "stops", label: yt = "Timeline", onDraw: bt, ref: xt, className: St, style: Ct, onKeyDown: wt, onBlur: Tt, onPointerDown: Et, onPointerMove: Dt, onPointerUp: Ot, onPointerCancel: kt, onPointerLeave: At, onLostPointerCapture: jt, ...Mt }) {
|
|
130
|
+
let S = v === "vertical", C = p(null), Nt = p(null), Pt = p(null), Ft = p(null), It = p(null), Lt = p(null), w = f(() => ({
|
|
131
|
+
start: _.start,
|
|
132
|
+
end: _.end
|
|
133
|
+
}), [_.start, _.end]), T = f(() => Le ?? ee(w), [Le, w]), Rt = p(Re);
|
|
134
|
+
pe(Rt.current, Re) || (Rt.current = Re);
|
|
135
|
+
let E = Rt.current, [zt, Bt] = t(Ze, Qe ?? w), D = f(() => o({
|
|
136
|
+
start: zt.start,
|
|
137
|
+
end: zt.end
|
|
138
|
+
}, w, ft), [
|
|
139
|
+
zt.start,
|
|
140
|
+
zt.end,
|
|
141
|
+
w,
|
|
142
|
+
ft
|
|
143
|
+
]), O = f(() => be(T, D), [T, D]), [Vt, Ht] = t(Je, Ye ?? _.start), k = Math.max(_.start, Math.min(_.end, Vt)), [A, Ut] = m({
|
|
144
|
+
width: 0,
|
|
145
|
+
height: 0,
|
|
146
|
+
hostWidth: 0,
|
|
147
|
+
hostHeight: 0,
|
|
148
|
+
top: 0
|
|
149
|
+
}), j = S ? 0 : gt, M = Math.max(0, (S ? A.height : A.width) - j), Wt = Ke.length > 0, Gt = qe.length > 0, N = f(() => S ? c(E) : l(E, A.height, {
|
|
150
|
+
requests: Wt,
|
|
151
|
+
stops: Gt
|
|
152
|
+
}), [
|
|
153
|
+
S,
|
|
154
|
+
E,
|
|
155
|
+
Wt,
|
|
156
|
+
Gt,
|
|
157
|
+
A.height
|
|
158
|
+
]), P = f(() => he(qe, {
|
|
159
|
+
axis: T,
|
|
160
|
+
win: O,
|
|
161
|
+
length: M
|
|
162
|
+
}), [
|
|
163
|
+
qe,
|
|
164
|
+
T,
|
|
165
|
+
O,
|
|
166
|
+
M
|
|
167
|
+
]), Kt = f(() => _e(qe), [qe]), qt = rt ?? (E.length === 1 ? E[0].key : null), F = ze(C, Ft), Jt = p(/* @__PURE__ */ new Map()), Yt = p(F);
|
|
168
|
+
Yt.current !== F && (Jt.current.clear(), Yt.current = F);
|
|
169
|
+
let Xt = (e) => {
|
|
170
|
+
let t = Jt.current.get(e);
|
|
171
|
+
if (t === void 0) {
|
|
172
|
+
let n = It.current;
|
|
173
|
+
if (!n) return e;
|
|
174
|
+
n.style.color = e, t = getComputedStyle(n).color || e, Jt.current.set(e, t);
|
|
175
|
+
}
|
|
176
|
+
return t;
|
|
177
|
+
}, Zt = f(() => F ? Ee(Ke, T, (e) => e.color ? Xt(e.color) : e.tone ? De(F.colors, e.tone) : F.colors.chart[0]) : [], [
|
|
178
|
+
Ke,
|
|
179
|
+
T,
|
|
180
|
+
F
|
|
181
|
+
]), [I, L] = m(null), [Qt, $t] = m(null), [R, z] = m(null), [en, tn] = m(0), nn = p(/* @__PURE__ */ new Map()), B = f(() => {
|
|
182
|
+
if (!I || I.along < 0 || I.along > M) return null;
|
|
183
|
+
let e = fe(N, I.across), t = S || e?.type === "stops" ? ne(P, I.along, 6) : null;
|
|
184
|
+
return {
|
|
185
|
+
along: I.along,
|
|
186
|
+
pull: 0,
|
|
187
|
+
time: T.timeAt(O.from + I.along / M * (O.to - O.from)),
|
|
188
|
+
mark: t,
|
|
189
|
+
lane: S ? e?.lane?.title : void 0
|
|
190
|
+
};
|
|
191
|
+
}, [
|
|
192
|
+
I,
|
|
193
|
+
M,
|
|
194
|
+
N,
|
|
195
|
+
S,
|
|
196
|
+
P,
|
|
197
|
+
T,
|
|
198
|
+
O
|
|
199
|
+
]), rn = p({
|
|
200
|
+
axis: T,
|
|
201
|
+
win: O,
|
|
202
|
+
length: M
|
|
203
|
+
});
|
|
204
|
+
rn.current = {
|
|
205
|
+
axis: T,
|
|
206
|
+
win: O,
|
|
207
|
+
length: M
|
|
208
|
+
};
|
|
209
|
+
let V = p(O);
|
|
210
|
+
V.current = O;
|
|
211
|
+
let an = (e, t, n) => {
|
|
212
|
+
Ht(e), Xe?.(e, {
|
|
213
|
+
phase: t,
|
|
214
|
+
stop: n
|
|
215
|
+
});
|
|
216
|
+
}, on = (e) => {
|
|
217
|
+
let t = o(e, w, ft);
|
|
218
|
+
(t.start !== D.start || t.end !== D.end) && (Bt(t), $e?.(t));
|
|
219
|
+
}, H = (e) => {
|
|
220
|
+
let t = xe(T, e);
|
|
221
|
+
t.end - t.start < ft || (V.current = e, on(t));
|
|
222
|
+
}, sn = () => on(w);
|
|
223
|
+
d(() => {
|
|
224
|
+
let e = C.current;
|
|
225
|
+
if (!e) return;
|
|
226
|
+
let t = (S ? e.offsetParent : null) ?? e.parentElement, n = () => Ut((n) => {
|
|
227
|
+
let r = {
|
|
228
|
+
width: e.clientWidth,
|
|
229
|
+
height: e.clientHeight,
|
|
230
|
+
hostWidth: t?.clientWidth ?? e.clientWidth,
|
|
231
|
+
hostHeight: t?.clientHeight ?? e.clientHeight,
|
|
232
|
+
top: e.offsetTop
|
|
233
|
+
};
|
|
234
|
+
return n.width === r.width && n.height === r.height && n.hostWidth === r.hostWidth && n.hostHeight === r.hostHeight && n.top === r.top ? n : r;
|
|
235
|
+
});
|
|
236
|
+
if (n(), typeof ResizeObserver > "u") return;
|
|
237
|
+
let r = new ResizeObserver(n);
|
|
238
|
+
return r.observe(e), t && r.observe(t), () => r.disconnect();
|
|
239
|
+
}, [S]), d(() => {
|
|
240
|
+
let e = C.current, t = e?.parentElement;
|
|
241
|
+
if (!e || !t || !S || !nt || y !== "right") return;
|
|
242
|
+
let n = 0, r = () => {
|
|
243
|
+
n = 0;
|
|
244
|
+
let r = t.querySelector("[data-slot=\"list-row-content\"]"), i = r ? Math.max(0, r.getBoundingClientRect().right - e.getBoundingClientRect().left) : b, a = `${Math.round(i)}px`;
|
|
245
|
+
t.style.getPropertyValue("--bl-index-bar-inset") !== a && t.style.setProperty("--bl-index-bar-inset", a);
|
|
246
|
+
};
|
|
247
|
+
r();
|
|
248
|
+
let i = () => {
|
|
249
|
+
n ||= requestAnimationFrame(r);
|
|
250
|
+
}, a = typeof ResizeObserver > "u" ? null : new ResizeObserver(i);
|
|
251
|
+
a?.observe(t);
|
|
252
|
+
let o = typeof MutationObserver > "u" ? null : new MutationObserver((t) => {
|
|
253
|
+
t.some((t) => !e.contains(t.target)) && i();
|
|
254
|
+
});
|
|
255
|
+
return o?.observe(t, {
|
|
256
|
+
childList: !0,
|
|
257
|
+
subtree: !0
|
|
258
|
+
}), () => {
|
|
259
|
+
cancelAnimationFrame(n), a?.disconnect(), o?.disconnect(), t.style.removeProperty("--bl-index-bar-inset");
|
|
260
|
+
};
|
|
261
|
+
}, [
|
|
262
|
+
S,
|
|
263
|
+
nt,
|
|
264
|
+
y,
|
|
265
|
+
b
|
|
266
|
+
]);
|
|
267
|
+
let cn = p(lt);
|
|
268
|
+
cn.current = lt;
|
|
269
|
+
let ln = p(0), un = p(null), dn = !!lt && M > 0;
|
|
270
|
+
u(() => {
|
|
271
|
+
if (!dn) return;
|
|
272
|
+
let e = setTimeout(() => {
|
|
273
|
+
let e = cn.current;
|
|
274
|
+
if (!e) return;
|
|
275
|
+
let t = ++ln.current;
|
|
276
|
+
un.current?.abort();
|
|
277
|
+
let n = typeof AbortController > "u" ? null : new AbortController();
|
|
278
|
+
un.current = n;
|
|
279
|
+
let r = Math.max(10, Math.floor(M / Ge)), i = ae(T, O, r), a = E.filter((e) => e.threads?.length && !(S && (e.density || e.marks?.length)));
|
|
280
|
+
a.length && Promise.all(a.map(async (a) => {
|
|
281
|
+
let o = a.offset ?? 0, s = i.map((e) => e - o);
|
|
282
|
+
try {
|
|
283
|
+
let i = await e(a.key, s, n?.signal ?? void 0);
|
|
284
|
+
if (t !== ln.current) return;
|
|
285
|
+
let o = /* @__PURE__ */ new Map(), c = new Float64Array(r), l = 0;
|
|
286
|
+
for (let { id: e, counts: t } of i) {
|
|
287
|
+
let n = 0;
|
|
288
|
+
for (let e = 0; e < t.length; e++) t[e] > n && (n = t[e]), e < r && (c[e] += t[e], c[e] > l && (l = c[e]));
|
|
289
|
+
o.set(e, {
|
|
290
|
+
counts: t,
|
|
291
|
+
max: n
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
nn.current.set(a.key, {
|
|
295
|
+
edges: s,
|
|
296
|
+
threads: o,
|
|
297
|
+
total: {
|
|
298
|
+
counts: c,
|
|
299
|
+
max: l
|
|
300
|
+
}
|
|
301
|
+
});
|
|
302
|
+
} catch {}
|
|
303
|
+
})).then(() => {
|
|
304
|
+
t === ln.current && tn((e) => e + 1);
|
|
305
|
+
});
|
|
306
|
+
}, ut);
|
|
307
|
+
return () => clearTimeout(e);
|
|
308
|
+
}, [
|
|
309
|
+
dn,
|
|
310
|
+
E,
|
|
311
|
+
T,
|
|
312
|
+
O,
|
|
313
|
+
M,
|
|
314
|
+
S,
|
|
315
|
+
ut
|
|
316
|
+
]), u(() => () => {
|
|
317
|
+
ln.current++, un.current?.abort();
|
|
318
|
+
}, []);
|
|
319
|
+
let fn = p(null), pn = p(x);
|
|
320
|
+
pn.current = x;
|
|
321
|
+
let mn = (e) => {
|
|
322
|
+
let t = e?.getContext?.("2d");
|
|
323
|
+
if (!e || !t || !F || !A.width || !A.height || !(M > 0)) return null;
|
|
324
|
+
let n = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, r = Math.round(A.width * n), i = Math.round(A.height * n);
|
|
325
|
+
return e.width !== r && (e.width = r), e.height !== i && (e.height = i), {
|
|
326
|
+
ctx: t,
|
|
327
|
+
dpr: n,
|
|
328
|
+
vertical: S,
|
|
329
|
+
side: y,
|
|
330
|
+
width: A.width,
|
|
331
|
+
height: A.height,
|
|
332
|
+
start: j,
|
|
333
|
+
length: M,
|
|
334
|
+
columns: Math.max(1, Math.round(M * n)),
|
|
335
|
+
axis: T,
|
|
336
|
+
win: O,
|
|
337
|
+
colors: F.colors,
|
|
338
|
+
font: F.font
|
|
339
|
+
};
|
|
340
|
+
}, hn = () => {
|
|
341
|
+
let e = mn(Nt.current);
|
|
342
|
+
if (!e) return;
|
|
343
|
+
let t = performance.now(), n = fn.current ??= new Ce();
|
|
344
|
+
n.resize(e.columns), ae(T, O, e.columns, n.edges), we(e, {
|
|
345
|
+
rows: N,
|
|
346
|
+
lanes: E,
|
|
347
|
+
ticks: S ? [] : a(T, O, D, M),
|
|
348
|
+
format: (e, t) => pn.current(e, t),
|
|
349
|
+
activity: nn.current,
|
|
350
|
+
focusedLane: qt,
|
|
351
|
+
selectedThread: at,
|
|
352
|
+
selectedRequest: st,
|
|
353
|
+
requests: Zt,
|
|
354
|
+
requestsLabel: _t,
|
|
355
|
+
stopsLabel: vt,
|
|
356
|
+
stopMarks: P,
|
|
357
|
+
color: Xt
|
|
358
|
+
}, n), bt?.({
|
|
359
|
+
layer: "data",
|
|
360
|
+
ms: performance.now() - t,
|
|
361
|
+
columns: e.columns
|
|
362
|
+
});
|
|
363
|
+
}, gn = () => {
|
|
364
|
+
let e = mn(Pt.current);
|
|
365
|
+
if (!e) return;
|
|
366
|
+
let t = performance.now(), n = N[N.length - 1];
|
|
367
|
+
Te(e, {
|
|
368
|
+
playhead: j + (T.fraction(k) - O.from) / (O.to - O.from) * M,
|
|
369
|
+
hover: B ? {
|
|
370
|
+
along: j + B.along,
|
|
371
|
+
label: S ? void 0 : pn.current(B.time, de(T, O, M, B.along))
|
|
372
|
+
} : null,
|
|
373
|
+
from: S ? N[0]?.at ?? 0 : 22,
|
|
374
|
+
to: S ? n ? n.at + n.size : 0 : A.height,
|
|
375
|
+
thumb: S && O.to - O.from < 1 ? O : null
|
|
376
|
+
}), bt?.({
|
|
377
|
+
layer: "overlay",
|
|
378
|
+
ms: performance.now() - t,
|
|
379
|
+
columns: e.columns
|
|
380
|
+
});
|
|
381
|
+
}, U = p({
|
|
382
|
+
paintData: hn,
|
|
383
|
+
paintOverlay: gn
|
|
384
|
+
});
|
|
385
|
+
U.current = {
|
|
386
|
+
paintData: hn,
|
|
387
|
+
paintOverlay: gn
|
|
388
|
+
}, d(() => {
|
|
389
|
+
U.current.paintData();
|
|
390
|
+
}, [
|
|
391
|
+
F,
|
|
392
|
+
A,
|
|
393
|
+
S,
|
|
394
|
+
y,
|
|
395
|
+
j,
|
|
396
|
+
M,
|
|
397
|
+
T,
|
|
398
|
+
O,
|
|
399
|
+
N,
|
|
400
|
+
E,
|
|
401
|
+
Zt,
|
|
402
|
+
P,
|
|
403
|
+
qt,
|
|
404
|
+
at,
|
|
405
|
+
st,
|
|
406
|
+
en,
|
|
407
|
+
_t,
|
|
408
|
+
vt
|
|
409
|
+
]), d(() => {
|
|
410
|
+
U.current.paintOverlay();
|
|
411
|
+
}, [
|
|
412
|
+
F,
|
|
413
|
+
A,
|
|
414
|
+
S,
|
|
415
|
+
y,
|
|
416
|
+
j,
|
|
417
|
+
M,
|
|
418
|
+
T,
|
|
419
|
+
O,
|
|
420
|
+
N,
|
|
421
|
+
k,
|
|
422
|
+
B
|
|
423
|
+
]);
|
|
424
|
+
let W = p({ kind: "idle" }), _n = p(k);
|
|
425
|
+
d(() => {
|
|
426
|
+
if (_n.current !== k && (_n.current = k, W.current.kind === "idle" && (k < D.start || k > D.end))) {
|
|
427
|
+
let e = T.fraction(k), t = (O.to - O.from) / 2;
|
|
428
|
+
H(re({
|
|
429
|
+
from: e - t,
|
|
430
|
+
to: e + t
|
|
431
|
+
}, 0));
|
|
432
|
+
}
|
|
433
|
+
}, [k]);
|
|
434
|
+
let vn = p(w);
|
|
435
|
+
u(() => {
|
|
436
|
+
vn.current !== w && (vn.current = w, nn.current.clear(), Ze === void 0 && (Bt(w), $e?.(w)));
|
|
437
|
+
}, [w]);
|
|
438
|
+
let G = p(/* @__PURE__ */ new Map()), K = p({
|
|
439
|
+
scrub: !1,
|
|
440
|
+
pinch: !1,
|
|
441
|
+
hover: null
|
|
442
|
+
}), yn = p(0), q = p(null), J = () => C.current.getBoundingClientRect(), Y = (e, t, n) => S ? n - e.top : t - e.left - j, bn = (e, t, n) => S ? y === "right" ? e.right - t : t - e.left : n - e.top, xn = (e, t, n) => S ? Math.max(0, bn(e, t, n) - b) : 0, Sn = (e) => ({
|
|
443
|
+
axis: T,
|
|
444
|
+
win: V.current,
|
|
445
|
+
length: M,
|
|
446
|
+
marks: e ? P : Ne
|
|
447
|
+
}), Cn = (e) => (e - V.current.from) / (V.current.to - V.current.from) * M, wn = (e, t, n, r) => {
|
|
448
|
+
let i = Y(t, n, r), a = xn(t, n, r), o = V.current, s = (o.to - o.from) / M;
|
|
449
|
+
s !== e.s.scale && (e.s = ue(e.s, e.along, T.fraction(e.last), s)), e.s = te(e.s, i, a, Sn(e.snap)), e.along = i, e.pull = a;
|
|
450
|
+
}, Tn = (e, t) => {
|
|
451
|
+
let { fraction: n, mark: r } = me(e.s, e.along, Sn(e.snap)), i = V.current;
|
|
452
|
+
n < i.from ? H(re(i, n - i.from)) : n > i.to && H(re(i, n - i.to));
|
|
453
|
+
let a = r ? r.stop.time : T.timeAt(n);
|
|
454
|
+
(a !== e.last || t !== "move") && an(a, t, r?.stop ?? null), e.last = a, $t({
|
|
455
|
+
along: S ? e.along : Math.max(0, Math.min(M, Cn(n))),
|
|
456
|
+
pull: e.pull,
|
|
457
|
+
time: a,
|
|
458
|
+
mark: r,
|
|
459
|
+
tier: e.s.tier
|
|
460
|
+
});
|
|
461
|
+
}, En = () => {
|
|
462
|
+
yn.current = 0;
|
|
463
|
+
let e = W.current, t = K.current;
|
|
464
|
+
if (e.kind === "scrub" && t.scrub) t.scrub = !1, Tn(e, "move");
|
|
465
|
+
else if (e.kind === "pinch" && t.pinch) {
|
|
466
|
+
t.pinch = !1;
|
|
467
|
+
let [n, r] = [...G.current.values()];
|
|
468
|
+
if (n && r) {
|
|
469
|
+
let t = J();
|
|
470
|
+
H(ie(e.win, e.separation, e.mid, Math.hypot(n.x - r.x, n.y - r.y), Y(t, (n.x + r.x) / 2, (n.y + r.y) / 2), M));
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
t.hover &&= (L(e.kind === "idle" ? t.hover : null), null);
|
|
474
|
+
}, Dn = () => {
|
|
475
|
+
yn.current ||= requestAnimationFrame(() => On.current());
|
|
476
|
+
}, On = p(En);
|
|
477
|
+
On.current = En, u(() => () => cancelAnimationFrame(yn.current), []);
|
|
478
|
+
let kn = (e, t) => {
|
|
479
|
+
K.current.scrub = !1, W.current = { kind: "idle" }, t === null ? Tn(e, "end") : an(t, "end", null), $t(null);
|
|
480
|
+
}, An = (e) => {
|
|
481
|
+
if (e.pointerType === "mouse" && e.button !== 0 || !(M > 0)) return;
|
|
482
|
+
try {
|
|
483
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
484
|
+
} catch {}
|
|
485
|
+
G.current.set(e.pointerId, {
|
|
486
|
+
x: e.clientX,
|
|
487
|
+
y: e.clientY
|
|
488
|
+
}), z(null);
|
|
489
|
+
let t = G.current.size, n = J();
|
|
490
|
+
if (t === 2) {
|
|
491
|
+
let e = W.current;
|
|
492
|
+
e.kind === "scrub" && kn(e, e.before);
|
|
493
|
+
let [t, r] = [...G.current.values()];
|
|
494
|
+
W.current = {
|
|
495
|
+
kind: "pinch",
|
|
496
|
+
win: V.current,
|
|
497
|
+
separation: Math.hypot(t.x - r.x, t.y - r.y),
|
|
498
|
+
mid: Y(n, (t.x + r.x) / 2, (t.y + r.y) / 2)
|
|
499
|
+
}, L(null);
|
|
500
|
+
return;
|
|
501
|
+
}
|
|
502
|
+
if (t > 2 || W.current.kind !== "idle") return;
|
|
503
|
+
let r = Y(n, e.clientX, e.clientY), i = bn(n, e.clientX, e.clientY), a = fe(N, i);
|
|
504
|
+
if (a?.lane && a.lane.key !== qt && !(S && e.pointerType === "touch") && it?.(a.lane.key), a?.type === "requests") {
|
|
505
|
+
let e = le(Ke, (e) => Cn(T.fraction(e)), r);
|
|
506
|
+
e && ct?.(e.id);
|
|
507
|
+
}
|
|
508
|
+
if (a?.type === "thread" && a.thread && a.lane && a.thread.id !== at && ot?.(a.thread.id, a.lane.key), r < 0) return;
|
|
509
|
+
let o = V.current, s = (o.to - o.from) / M, c = {
|
|
510
|
+
kind: "scrub",
|
|
511
|
+
id: e.pointerId,
|
|
512
|
+
pointerType: e.pointerType,
|
|
513
|
+
s: ge(r, o.from + r * s, s),
|
|
514
|
+
along: r,
|
|
515
|
+
pull: 0,
|
|
516
|
+
before: k,
|
|
517
|
+
last: NaN,
|
|
518
|
+
snap: S || a?.type === "stops",
|
|
519
|
+
travel: 0,
|
|
520
|
+
pressAlong: r,
|
|
521
|
+
pressAcross: i
|
|
522
|
+
};
|
|
523
|
+
W.current = c, L(null), Tn(c, "start");
|
|
524
|
+
}, jn = (e) => {
|
|
525
|
+
let t = G.current.get(e.pointerId);
|
|
526
|
+
t && (t.x = e.clientX, t.y = e.clientY);
|
|
527
|
+
let n = W.current, r = J();
|
|
528
|
+
n.kind === "scrub" && n.id === e.pointerId ? (wn(n, r, e.clientX, e.clientY), n.travel = Math.max(n.travel, Math.abs(n.along - n.pressAlong) + Math.abs(bn(r, e.clientX, e.clientY) - n.pressAcross)), K.current.scrub = !0, Dn()) : n.kind === "pinch" ? (K.current.pinch = !0, Dn()) : n.kind === "idle" && e.pointerType !== "touch" && (K.current.hover = {
|
|
529
|
+
along: Y(r, e.clientX, e.clientY),
|
|
530
|
+
across: bn(r, e.clientX, e.clientY)
|
|
531
|
+
}, Dn());
|
|
532
|
+
}, Mn = (e, t) => {
|
|
533
|
+
if (!G.current.delete(e.pointerId)) return;
|
|
534
|
+
let n = W.current;
|
|
535
|
+
if (n.kind === "scrub" && n.id === e.pointerId) {
|
|
536
|
+
let r = J();
|
|
537
|
+
if (t || wn(n, r, e.clientX, e.clientY), kn(n, null), S && !t && n.travel < Ue / 2) {
|
|
538
|
+
let t = q.current;
|
|
539
|
+
t && e.timeStamp - t.at < He && Math.abs(t.along - n.pressAlong) < Ue && Math.abs(t.across - n.pressAcross) < Ue ? (q.current = null, sn()) : q.current = {
|
|
540
|
+
at: e.timeStamp,
|
|
541
|
+
along: n.pressAlong,
|
|
542
|
+
across: n.pressAcross
|
|
543
|
+
};
|
|
544
|
+
} else q.current = null;
|
|
545
|
+
if (e.pointerType !== "touch" && !t) {
|
|
546
|
+
let t = bn(r, e.clientX, e.clientY);
|
|
547
|
+
t >= 0 && t <= (S ? b : A.height) && (K.current.hover = {
|
|
548
|
+
along: Y(r, e.clientX, e.clientY),
|
|
549
|
+
across: t
|
|
550
|
+
}, Dn());
|
|
551
|
+
}
|
|
552
|
+
} else n.kind === "pinch" && G.current.size < 2 ? (W.current = G.current.size ? { kind: "spent" } : { kind: "idle" }, q.current = null) : n.kind === "spent" && !G.current.size && (W.current = { kind: "idle" });
|
|
553
|
+
}, Nn = p({ wheel: (e) => {} });
|
|
554
|
+
Nn.current.wheel = (e) => {
|
|
555
|
+
if (!(M > 0)) return;
|
|
556
|
+
let t = V.current, n = t.to - t.from, r = e.deltaMode === 1 ? 16 : e.deltaMode === 2 ? M : 1, i = e.deltaY * r, a = e.deltaX * r, o = J(), s = Math.max(0, Math.min(1, Y(o, e.clientX, e.clientY) / M));
|
|
557
|
+
if (e.ctrlKey || e.metaKey) e.preventDefault(), H(Se(t, s, Math.exp(Math.max(-50, Math.min(50, i)) * .01)));
|
|
558
|
+
else if (S) {
|
|
559
|
+
if (n >= 1) return;
|
|
560
|
+
e.preventDefault(), H(re(t, (i || a) / M * n));
|
|
561
|
+
} else e.shiftKey || Math.abs(a) > Math.abs(i) ? (e.preventDefault(), H(re(t, (e.shiftKey && i || a) / M * n))) : (e.preventDefault(), H(Se(t, s, Math.exp(i * .002))));
|
|
562
|
+
}, u(() => {
|
|
563
|
+
let e = C.current;
|
|
564
|
+
if (!e) return;
|
|
565
|
+
let t = (e) => Nn.current.wheel(e);
|
|
566
|
+
return e.addEventListener("wheel", t, { passive: !1 }), () => e.removeEventListener("wheel", t);
|
|
567
|
+
}, []);
|
|
568
|
+
let Pn = p(v);
|
|
569
|
+
u(() => {
|
|
570
|
+
if (Pn.current === v) return;
|
|
571
|
+
Pn.current = v;
|
|
572
|
+
let e = W.current;
|
|
573
|
+
e.kind === "scrub" ? kn(e, null) : W.current = { kind: "idle" }, G.current.clear(), L(null), $t(null), z(null);
|
|
574
|
+
}, [v]);
|
|
575
|
+
let Fn = p(void 0);
|
|
576
|
+
u(() => () => clearTimeout(Fn.current), []);
|
|
577
|
+
let In = (e) => {
|
|
578
|
+
S && (z({ stop: e }), clearTimeout(Fn.current), Fn.current = setTimeout(() => z(null), Ve));
|
|
579
|
+
}, Ln = (e, t) => {
|
|
580
|
+
an(Math.max(_.start, Math.min(_.end, e)), "end", t), In(t);
|
|
581
|
+
}, X = (T.fraction(k) - O.from) / (O.to - O.from) * M, Rn = (e) => {
|
|
582
|
+
if (wt?.(e), e.defaultPrevented || !(M > 0) || e.metaKey || e.ctrlKey || e.altKey) return;
|
|
583
|
+
let t = (t) => {
|
|
584
|
+
let n = e.shiftKey ? 10 : 1;
|
|
585
|
+
if (dt != null) return Ln(k + t * dt * n, null);
|
|
586
|
+
let r = T.fraction(k) + t * n * ((O.to - O.from) / M);
|
|
587
|
+
Ln(T.timeAt(r), null);
|
|
588
|
+
}, n = (e) => {
|
|
589
|
+
H(Se(O, X >= 0 && X <= M ? X / M : .5, e));
|
|
590
|
+
};
|
|
591
|
+
switch (e.key) {
|
|
592
|
+
case "ArrowRight":
|
|
593
|
+
t(1);
|
|
594
|
+
break;
|
|
595
|
+
case "ArrowLeft":
|
|
596
|
+
t(-1);
|
|
597
|
+
break;
|
|
598
|
+
case "ArrowDown":
|
|
599
|
+
t(S ? 1 : -1);
|
|
600
|
+
break;
|
|
601
|
+
case "ArrowUp":
|
|
602
|
+
t(S ? -1 : 1);
|
|
603
|
+
break;
|
|
604
|
+
case "PageUp":
|
|
605
|
+
case "PageDown": {
|
|
606
|
+
let t = e.key === "PageDown" ? 1 : -1, n = i(Kt, k, t, Math.max(1e-9, Math.abs(k) * 1e-12));
|
|
607
|
+
n && Ln(n.time, n);
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
case "Home":
|
|
611
|
+
Ln(_.start, null);
|
|
612
|
+
break;
|
|
613
|
+
case "End":
|
|
614
|
+
Ln(_.end, null);
|
|
615
|
+
break;
|
|
616
|
+
case "+":
|
|
617
|
+
case "=":
|
|
618
|
+
n(1 / We);
|
|
619
|
+
break;
|
|
620
|
+
case "-":
|
|
621
|
+
case "_":
|
|
622
|
+
n(We);
|
|
623
|
+
break;
|
|
624
|
+
case "0":
|
|
625
|
+
sn();
|
|
626
|
+
break;
|
|
627
|
+
default: return;
|
|
628
|
+
}
|
|
629
|
+
e.preventDefault(), e.stopPropagation();
|
|
630
|
+
}, zn = (e) => {
|
|
631
|
+
Tt?.(e), z(null);
|
|
632
|
+
}, Bn = p({
|
|
633
|
+
fit: sn,
|
|
634
|
+
applyView: on
|
|
635
|
+
});
|
|
636
|
+
Bn.current = {
|
|
637
|
+
fit: sn,
|
|
638
|
+
applyView: on
|
|
639
|
+
}, Oe(xt, () => ({
|
|
640
|
+
fit: () => Bn.current.fit(),
|
|
641
|
+
setView: (e) => Bn.current.applyView(e),
|
|
642
|
+
pixelTimes: () => {
|
|
643
|
+
let { axis: e, win: t, length: n } = rn.current, r = [];
|
|
644
|
+
for (let i = 0; i < n; i++) r.push(e.timeAt(t.from + i / n * (t.to - t.from)));
|
|
645
|
+
return r;
|
|
646
|
+
},
|
|
647
|
+
redraw: () => {
|
|
648
|
+
U.current.paintData(), U.current.paintOverlay();
|
|
649
|
+
},
|
|
650
|
+
focus: () => C.current?.focus()
|
|
651
|
+
}), []);
|
|
652
|
+
let Z = Qt ?? B ?? (R && S ? {
|
|
653
|
+
along: X,
|
|
654
|
+
pull: 0,
|
|
655
|
+
time: k,
|
|
656
|
+
mark: R.stop ? {
|
|
657
|
+
stop: R.stop,
|
|
658
|
+
along: X,
|
|
659
|
+
count: 1,
|
|
660
|
+
tone: R.stop.tone ?? "default",
|
|
661
|
+
first: R.stop.time,
|
|
662
|
+
last: R.stop.time,
|
|
663
|
+
dim: !1
|
|
664
|
+
} : null
|
|
665
|
+
} : null), Vn = !!Z && (S || !!pt || !!Z.mark), Q = Z?.mark?.stop ?? null, [$, Hn] = m({
|
|
666
|
+
width: 200,
|
|
667
|
+
height: 56
|
|
668
|
+
});
|
|
669
|
+
d(() => {
|
|
670
|
+
let e = Lt.current;
|
|
671
|
+
if (!e) return;
|
|
672
|
+
let t = () => Hn((t) => t.width === e.offsetWidth && t.height === e.offsetHeight ? t : {
|
|
673
|
+
width: e.offsetWidth,
|
|
674
|
+
height: e.offsetHeight
|
|
675
|
+
});
|
|
676
|
+
if (t(), typeof ResizeObserver > "u") return;
|
|
677
|
+
let n = new ResizeObserver(t);
|
|
678
|
+
return n.observe(e), () => n.disconnect();
|
|
679
|
+
}, [Vn]);
|
|
680
|
+
let Un;
|
|
681
|
+
if (Vn && Z) {
|
|
682
|
+
if (S) {
|
|
683
|
+
let e = oe({
|
|
684
|
+
along: Z.along,
|
|
685
|
+
pull: Z.pull,
|
|
686
|
+
railWidth: b,
|
|
687
|
+
railTop: A.top,
|
|
688
|
+
hostWidth: A.hostWidth,
|
|
689
|
+
hostHeight: A.hostHeight,
|
|
690
|
+
cardWidth: $.width,
|
|
691
|
+
cardHeight: $.height
|
|
692
|
+
});
|
|
693
|
+
Un = {
|
|
694
|
+
"--tt-card-x": `${e.inset}px`,
|
|
695
|
+
"--tt-card-y": `${e.top}px`
|
|
696
|
+
};
|
|
697
|
+
} else {
|
|
698
|
+
let e = C.current?.getBoundingClientRect(), t = C.current?.parentElement?.getBoundingClientRect(), n = se({
|
|
699
|
+
along: j + Z.along,
|
|
700
|
+
width: A.width,
|
|
701
|
+
height: A.height,
|
|
702
|
+
above: e && t ? e.top - t.top : 0,
|
|
703
|
+
below: e && t ? t.bottom - e.bottom : 0,
|
|
704
|
+
cardWidth: $.width,
|
|
705
|
+
cardHeight: $.height
|
|
706
|
+
});
|
|
707
|
+
Un = {
|
|
708
|
+
"--tt-card-x": `${n.left}px`,
|
|
709
|
+
"--tt-card-y": `${n.top}px`
|
|
710
|
+
};
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
let Wn = S ? Qt?.tier ?? null : null, Gn = M > 0 ? de(T, O, M, Math.max(0, Math.min(M, Z?.along ?? X))) : 1, Kn = Q ? Q.caption || Q.label || x(Q.time, Gn) : Z ? x(Z.time, Gn) : "", qn = S ? Qt ? X : B ? B.along : R ? X : null : null, Jn = S ? ne(P, X, 2) : null, Yn = B?.mark ?? Qt?.mark ?? null, Xn = Math.max(9, Math.min(M - 9, X)), Zn = x(k, M > 0 ? de(T, O, M, Math.max(0, Math.min(M, X))) : 1), Qn = Jn && Jn.stop.time === k ? Jn.stop : null, $n = ce(N), er = Vn && !!Z && Math.abs(Z.along - X) < $.height / 2 + 12 && Z.pull < 40;
|
|
714
|
+
return /* @__PURE__ */ g("div", {
|
|
715
|
+
role: "slider",
|
|
716
|
+
tabIndex: 0,
|
|
717
|
+
"aria-label": yt,
|
|
718
|
+
"aria-orientation": v,
|
|
719
|
+
"aria-valuemin": _.start,
|
|
720
|
+
"aria-valuemax": _.end,
|
|
721
|
+
"aria-valuenow": k,
|
|
722
|
+
"aria-valuetext": Qn?.caption ? `${Zn}, ${Qn.caption}` : Zn,
|
|
723
|
+
...Mt,
|
|
724
|
+
ref: C,
|
|
725
|
+
"data-slot": "trace-timeline",
|
|
726
|
+
"data-orientation": v,
|
|
727
|
+
"data-side": S ? y : void 0,
|
|
728
|
+
onPointerDown: (e) => {
|
|
729
|
+
Et?.(e), An(e);
|
|
730
|
+
},
|
|
731
|
+
onPointerMove: (e) => {
|
|
732
|
+
Dt?.(e), jn(e);
|
|
733
|
+
},
|
|
734
|
+
onPointerUp: (e) => {
|
|
735
|
+
Ot?.(e), Mn(e, !1);
|
|
736
|
+
},
|
|
737
|
+
onPointerCancel: (e) => {
|
|
738
|
+
kt?.(e), Mn(e, !0);
|
|
739
|
+
},
|
|
740
|
+
onLostPointerCapture: (e) => {
|
|
741
|
+
jt?.(e), Mn(e, !0);
|
|
742
|
+
},
|
|
743
|
+
onPointerLeave: (e) => {
|
|
744
|
+
At?.(e), K.current.hover = null, L(null);
|
|
745
|
+
},
|
|
746
|
+
onKeyDown: Rn,
|
|
747
|
+
onBlur: zn,
|
|
748
|
+
className: e(ke({
|
|
749
|
+
orientation: v,
|
|
750
|
+
side: y
|
|
751
|
+
}), St),
|
|
752
|
+
style: {
|
|
753
|
+
"--tt-width": b + "px",
|
|
754
|
+
"--tt-height": ve(E, {
|
|
755
|
+
requests: Wt,
|
|
756
|
+
stops: Gt
|
|
757
|
+
}) + "px",
|
|
758
|
+
"--tt-top": Be(et ?? 0),
|
|
759
|
+
"--tt-bottom": Be(tt ?? 0),
|
|
760
|
+
"--tt-dash": $n + "px",
|
|
761
|
+
"--tt-lines": mt,
|
|
762
|
+
"--tt-card-w": Math.min(ht, Math.max(160, A.hostWidth - b - 16)) + "px",
|
|
763
|
+
...Ct
|
|
764
|
+
},
|
|
765
|
+
children: [
|
|
766
|
+
/* @__PURE__ */ h("canvas", {
|
|
767
|
+
ref: Nt,
|
|
768
|
+
"aria-hidden": !0,
|
|
769
|
+
"data-slot": "trace-timeline-canvas",
|
|
770
|
+
className: "pointer-events-none absolute inset-0 size-full"
|
|
771
|
+
}),
|
|
772
|
+
/* @__PURE__ */ h("canvas", {
|
|
773
|
+
ref: Pt,
|
|
774
|
+
"aria-hidden": !0,
|
|
775
|
+
"data-slot": "trace-timeline-overlay",
|
|
776
|
+
className: "pointer-events-none absolute inset-0 size-full"
|
|
777
|
+
}),
|
|
778
|
+
/* @__PURE__ */ g("span", {
|
|
779
|
+
ref: Ft,
|
|
780
|
+
hidden: !0,
|
|
781
|
+
children: [Fe.map((e) => /* @__PURE__ */ h("i", {
|
|
782
|
+
"data-token": e,
|
|
783
|
+
className: Pe[e]
|
|
784
|
+
}, e)), /* @__PURE__ */ h("i", { ref: It })]
|
|
785
|
+
}),
|
|
786
|
+
S && P.map((t) => {
|
|
787
|
+
let n = Yn === t, r = Jn === t, i = n || r ? 1 : qn == null ? 0 : ye(t.along - qn), a = (t.stop.level ?? 1) > 1 ? 6 : 9;
|
|
788
|
+
return /* @__PURE__ */ h("span", {
|
|
789
|
+
"data-slot": "trace-timeline-stop",
|
|
790
|
+
"data-tone": t.tone,
|
|
791
|
+
"data-count": t.count,
|
|
792
|
+
style: {
|
|
793
|
+
"--y": `${t.along - 1}px`,
|
|
794
|
+
"--len": `${a + (28 - a) * i}px`,
|
|
795
|
+
"--f": i
|
|
796
|
+
},
|
|
797
|
+
className: e("pointer-events-none absolute top-(--y) h-[2px] w-(--len) rounded-full transition-[width,background-color] duration-spring-snappy ease-spring-snappy motion-reduce:transition-none", y === "left" ? "left-(--tt-dash)" : "right-(--tt-dash)", t.tone === "default" ? n ? "bg-foreground" : r ? "bg-primary" : "bg-[color:color-mix(in_oklab,var(--foreground)_calc(var(--f)*75%),var(--tertiary-foreground,color-mix(in_oklab,var(--muted-foreground)_60%,transparent)))]" : Ie[t.tone], t.dim && !n && "opacity-55")
|
|
798
|
+
}, String(t.stop.key ?? t.stop.time));
|
|
799
|
+
}),
|
|
800
|
+
S && /* @__PURE__ */ h("span", {
|
|
801
|
+
"data-slot": "trace-timeline-pill",
|
|
802
|
+
"aria-hidden": !0,
|
|
803
|
+
"data-hidden": er || void 0,
|
|
804
|
+
style: { "--y": `${Xn}px` },
|
|
805
|
+
className: e("pointer-events-none absolute top-(--y) -translate-y-1/2 rounded-full bg-primary px-1.5 text-caption2 leading-[17px] font-semibold whitespace-nowrap text-primary-foreground tabular-nums shadow-[0_1px_4px_--alpha(black/24%)]", "transition-opacity duration-100 motion-reduce:transition-none data-hidden:opacity-0", y === "left" ? "left-[calc(var(--tt-width)+3px)]" : "right-[calc(var(--tt-width)+3px)]"),
|
|
806
|
+
children: Zn
|
|
807
|
+
}),
|
|
808
|
+
Vn && Z ? /* @__PURE__ */ g("div", {
|
|
809
|
+
ref: Lt,
|
|
810
|
+
"data-slot": "trace-timeline-card",
|
|
811
|
+
"data-speed": Wn ?? void 0,
|
|
812
|
+
style: Un,
|
|
813
|
+
className: e("pointer-events-none absolute top-(--tt-card-y) z-10 box-border w-max max-w-(--tt-card-w) min-w-[160px] rounded-card bg-card px-[13px] py-[9px]", "shadow-[0_8px_28px_--alpha(black/28%),0_0_0_1px_var(--border)] motion-reduce:transition-none", "animate-[blWaveCard_var(--duration-spring-snappy)_var(--ease-spring-snappy)] motion-reduce:animate-none", S ? e("transition-[top,left,right] duration-spring-snappy ease-spring-snappy", y === "left" ? "left-(--tt-card-x) origin-left" : "right-(--tt-card-x) origin-right") : "left-(--tt-card-x) origin-bottom"),
|
|
814
|
+
children: [
|
|
815
|
+
pt ? /* @__PURE__ */ h("div", {
|
|
816
|
+
"data-slot": "trace-timeline-preview",
|
|
817
|
+
className: "mb-[6px] empty:hidden",
|
|
818
|
+
children: pt(Z.time, Q)
|
|
819
|
+
}) : null,
|
|
820
|
+
/* @__PURE__ */ g("div", {
|
|
821
|
+
className: "flex items-start gap-2",
|
|
822
|
+
children: [/* @__PURE__ */ h("div", {
|
|
823
|
+
className: "min-w-0 flex-1 truncate text-footnote leading-[18px] font-semibold text-foreground",
|
|
824
|
+
children: Kn
|
|
825
|
+
}), Q?.trailing]
|
|
826
|
+
}),
|
|
827
|
+
Q ? /* @__PURE__ */ g("div", {
|
|
828
|
+
className: "text-caption leading-[16px] text-muted-foreground tabular-nums",
|
|
829
|
+
children: [x(Q.time, Gn), Z.mark && Z.mark.count > 1 ? ` · ${Z.mark.count - 1} more here` : ""]
|
|
830
|
+
}) : null,
|
|
831
|
+
Q?.preview == null ? null : /* @__PURE__ */ h("div", {
|
|
832
|
+
className: "mt-[2px] line-clamp-(--tt-lines) text-caption leading-[16px] text-pretty text-muted-foreground",
|
|
833
|
+
children: Q.preview
|
|
834
|
+
}),
|
|
835
|
+
Z.lane ? /* @__PURE__ */ h("div", {
|
|
836
|
+
className: "text-caption leading-[16px] text-muted-foreground",
|
|
837
|
+
children: Z.lane
|
|
838
|
+
}) : null,
|
|
839
|
+
Wn == null ? null : /* @__PURE__ */ g("div", {
|
|
840
|
+
"data-slot": "trace-timeline-speed",
|
|
841
|
+
className: "mt-[3px] text-caption leading-[16px] font-medium text-primary",
|
|
842
|
+
children: [r[Wn].label, Wn === 0 ? " · pull away to slow" : ""]
|
|
843
|
+
})
|
|
844
|
+
]
|
|
845
|
+
}) : null
|
|
846
|
+
]
|
|
847
|
+
});
|
|
848
|
+
}
|
|
849
|
+
//#endregion
|
|
850
|
+
export { Ke as TraceTimeline, ke as traceTimelineVariants };
|