@mechane-ai/elements 0.59.0 → 0.60.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 +54 -53
- package/dist/catalog.json +33 -1
- package/dist/chart-range-Du1gDxCY.js +163 -0
- package/dist/charts/cartesian.js +1 -1
- package/dist/charts/figure.js +2 -2
- package/dist/charts/timeline.js +3 -1
- package/dist/kits/operations.js +2 -2
- package/dist/kits/research.js +1 -1
- package/dist/packages/charts/src/timeline/index.d.ts +5 -1
- package/dist/packages/charts/src/timeline/trace-timeline-layout.d.ts +85 -0
- package/dist/packages/charts/src/timeline/trace-timeline.d.ts +37 -0
- package/dist/packages/charts/src/timeline/waterfall.d.ts +23 -7
- package/dist/styles2.css +47 -7
- package/dist/{time-series-CoAtNizi.js → time-series-BbUBF3IE.js} +521 -679
- package/dist/timeline-C1d9YJlJ.js +620 -0
- package/dist/waterfall-Dre6i02Z.js +684 -0
- package/package.json +1 -1
- package/dist/waterfall-BjUXqaWu.js +0 -615
|
@@ -0,0 +1,620 @@
|
|
|
1
|
+
import { A as e, E as t, M as n, S as r, h as i, j as a, l as o, s } from "./plot-layout-B-b6tioh.js";
|
|
2
|
+
import { T as c, c as l, m as u, t as d } from "./src-9EJskqB_.js";
|
|
3
|
+
import { t as f } from "./chart-tones-ei3BC2AL.js";
|
|
4
|
+
import { t as p } from "./chart-cursor-1mFd48Jc.js";
|
|
5
|
+
import { i as ee, l as te, n as ne, r as re, t as ie } from "./figure-frame-ClYRIRAq.js";
|
|
6
|
+
import { i as ae } from "./chart-link-AE_xuxiP.js";
|
|
7
|
+
import { t as oe } from "./chart-range-Du1gDxCY.js";
|
|
8
|
+
import { n as se } from "./plot-width-D3hTycYX.js";
|
|
9
|
+
import { r as ce } from "./figure-format-B8kRZMlo.js";
|
|
10
|
+
import { a as le } from "./tone-scope-DKiSw-JR.js";
|
|
11
|
+
import { t as ue } from "./plot-axes-D5S9BnBa.js";
|
|
12
|
+
import { r as de } from "./plot-marks-FVsbFkUs.js";
|
|
13
|
+
import { n as fe, r as pe, t as me } from "./plot-surface-BlR44uTL.js";
|
|
14
|
+
import { r as he } from "./scale-C2xgZyZN.js";
|
|
15
|
+
import * as m from "@stylexjs/stylex";
|
|
16
|
+
import { useId as ge, useRef as _e, useState as h } from "react";
|
|
17
|
+
import { stackSpans as g } from "@ui-sdk/core";
|
|
18
|
+
import { jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
19
|
+
// packages/charts/src/timeline/trace-timeline-layout.ts
|
|
20
|
+
var y = {
|
|
21
|
+
lanes: 24,
|
|
22
|
+
spans: 2e3
|
|
23
|
+
}, b = .5, x = .005, S = .5, ve = .2, C = .15, w = 6.2, T = 10, E = 36, D = 3;
|
|
24
|
+
function ye({ lanes: e, spans: t, domain: r }) {
|
|
25
|
+
let [i, a] = r;
|
|
26
|
+
if (!Number.isFinite(i) || !Number.isFinite(a) || a < i) return "The trace domain must have finite, ordered endpoints.";
|
|
27
|
+
if (e.length === 0) return "A trace timeline needs at least one lane.";
|
|
28
|
+
if (e.length > y.lanes) return `This chart draws at most ${y.lanes} lanes.`;
|
|
29
|
+
if (t.length > y.spans) return `This chart draws at most ${y.spans} spans.`;
|
|
30
|
+
if (!n(e)) return "Trace lanes must have unique identifiers.";
|
|
31
|
+
if (!n(t)) return "Trace spans must have unique identifiers.";
|
|
32
|
+
let o = new Set(e.map((e) => e.id));
|
|
33
|
+
for (let e of t) {
|
|
34
|
+
if (!o.has(e.laneId)) return `Span "${e.id}" references an unknown lane "${e.laneId}".`;
|
|
35
|
+
if (!Number.isFinite(e.start) || !Number.isFinite(e.end) || e.end < e.start) return `Span "${e.id}" must have finite, ordered endpoints.`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function O(e, t) {
|
|
39
|
+
let [n, r] = t, i = Math.max(r - n, 0);
|
|
40
|
+
if (i === 0) return [n, r];
|
|
41
|
+
let a = i * x, o = Math.max(n, Math.min(r, e[0])), s = Math.max(n, Math.min(r, e[1]));
|
|
42
|
+
if (s < o && ([o, s] = [s, o]), s - o < a) {
|
|
43
|
+
let e = (o + s) * b;
|
|
44
|
+
o = Math.max(n, e - a * b), s = Math.min(r, o + a), o = Math.max(n, s - a);
|
|
45
|
+
}
|
|
46
|
+
return [o, s];
|
|
47
|
+
}
|
|
48
|
+
function k({ visible: e, domain: t, direction: n, anchorRatio: r = b }) {
|
|
49
|
+
let [i, a] = t, o = e[1] - e[0], s = a - i;
|
|
50
|
+
if (s <= 0) return t;
|
|
51
|
+
let c = n === "in" ? S : 1 / S, l = Math.min(s, Math.max(s * x, o * c)), u = e[0] + o * r - l * r, d = u + l;
|
|
52
|
+
return u < i && (u = i, d = Math.min(a, i + l)), d > a && (d = a, u = Math.max(i, a - l)), [u, d];
|
|
53
|
+
}
|
|
54
|
+
function be({ visible: e, domain: t, direction: n }) {
|
|
55
|
+
return A({
|
|
56
|
+
visible: e,
|
|
57
|
+
domain: t,
|
|
58
|
+
delta: (e[1] - e[0]) * ve * (n === "left" ? -1 : 1)
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function A({ visible: e, domain: t, delta: n }) {
|
|
62
|
+
let [r, i] = t, a = e[1] - e[0], o = e[0] + n, s = o + a;
|
|
63
|
+
return o < r && (o = r, s = Math.min(i, r + a)), s > i && (s = i, o = Math.max(r, i - a)), [o, s];
|
|
64
|
+
}
|
|
65
|
+
function xe(e, t) {
|
|
66
|
+
let [n, r] = t, i = r - n, a = Math.max(e.end - e.start, i * x) * C;
|
|
67
|
+
return O([e.start - a, e.end + a], t);
|
|
68
|
+
}
|
|
69
|
+
var Se = 32;
|
|
70
|
+
function j(e, t) {
|
|
71
|
+
let n = t.get(e)?.parentId;
|
|
72
|
+
return Array.from({ length: Se }, () => {
|
|
73
|
+
if (n === void 0) return null;
|
|
74
|
+
let e = n;
|
|
75
|
+
return n = t.get(e)?.parentId, e;
|
|
76
|
+
}).filter((e) => e !== null);
|
|
77
|
+
}
|
|
78
|
+
function Ce(e, t) {
|
|
79
|
+
if (e == null) return;
|
|
80
|
+
let n = new Map(t.map((e) => [e.id, e])), r = n.get(e);
|
|
81
|
+
if (r === void 0) return;
|
|
82
|
+
let i = j(r.id, n), a = r.relatedIds ?? [], o = t.filter((e) => e.relatedIds?.includes(r.id) === !0 || j(e.id, n).includes(r.id)).map((e) => e.id);
|
|
83
|
+
return /* @__PURE__ */ new Set([
|
|
84
|
+
r.id,
|
|
85
|
+
...i,
|
|
86
|
+
...a,
|
|
87
|
+
...o
|
|
88
|
+
]);
|
|
89
|
+
}
|
|
90
|
+
function we({ lane: e, spans: t, minExtent: n }) {
|
|
91
|
+
let r = t.filter((t) => t.laneId === e.id).map((t) => ({
|
|
92
|
+
id: t.id,
|
|
93
|
+
track: e.id,
|
|
94
|
+
start: t.start,
|
|
95
|
+
end: Math.max(t.end, t.start + n)
|
|
96
|
+
})), i = [...g(r).entries()].map(([e, t]) => [e, t.lane]), a = Math.max(0, ...i.map(([, e]) => e));
|
|
97
|
+
return {
|
|
98
|
+
entries: i,
|
|
99
|
+
rowCount: r.length === 0 ? 1 : a + 1
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function Te({ lanes: e, spans: t, minExtent: n }) {
|
|
103
|
+
let r = e.map((e) => we({
|
|
104
|
+
lane: e,
|
|
105
|
+
spans: t,
|
|
106
|
+
minExtent: n
|
|
107
|
+
}));
|
|
108
|
+
return {
|
|
109
|
+
rowBySpanId: new Map(r.flatMap((e) => e.entries)),
|
|
110
|
+
rowCountByLane: r.map((e) => e.rowCount)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
function Ee(e, t, n) {
|
|
114
|
+
let r = n - T;
|
|
115
|
+
if (r < E) return;
|
|
116
|
+
let i = Math.floor(r / w), a = `${e} · ${t}`;
|
|
117
|
+
if (a.length <= i) return a;
|
|
118
|
+
if (e.length <= i) return e;
|
|
119
|
+
if (!(i <= D)) return `${e.slice(0, i - 1)}…`;
|
|
120
|
+
}
|
|
121
|
+
// packages/charts/src/timeline/trace-timeline.tsx
|
|
122
|
+
var De = 42, Oe = 4, ke = 6, M = .5, Ae = 4, je = 10, Me = 96, Ne = 3, Pe = 5, Fe = 200, Ie = {
|
|
123
|
+
k1xSpc: "x1rg5ohu",
|
|
124
|
+
kzqmXN: "x1xc55vz",
|
|
125
|
+
kZKoxP: "xdk7pt",
|
|
126
|
+
kaIpWk: "x1ok0vyi",
|
|
127
|
+
kmuXW: "x2lah0s",
|
|
128
|
+
$$css: !0
|
|
129
|
+
}, Le = {
|
|
130
|
+
kVYP8I: "xsn0423",
|
|
131
|
+
$$css: !0
|
|
132
|
+
}, N = {
|
|
133
|
+
swatch: (e) => [
|
|
134
|
+
Ie,
|
|
135
|
+
{
|
|
136
|
+
kWkggS: e == null ? e : "xl8spv7",
|
|
137
|
+
$$css: !0
|
|
138
|
+
},
|
|
139
|
+
{ "--x-backgroundColor": e ?? void 0 }
|
|
140
|
+
],
|
|
141
|
+
minimapBar: (e) => [
|
|
142
|
+
Le,
|
|
143
|
+
{
|
|
144
|
+
kDwRjp: e == null ? e : "x19zyb68",
|
|
145
|
+
$$css: !0
|
|
146
|
+
},
|
|
147
|
+
{ "--x-fill": e ?? void 0 }
|
|
148
|
+
],
|
|
149
|
+
separator: {
|
|
150
|
+
kfzvcC: "x47corl",
|
|
151
|
+
$$css: !0
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
function P({ lanes: n, spans: g, domain: y, categories: b, visibleRange: x, onVisibleRangeChange: S, offsetFormat: ve, selected: C, onSelectedChange: w, highlightedIds: T, onActivateSpan: E, spanActions: D, isMinimapVisible: Se = !0, xTitle: j = "Elapsed", ...we }) {
|
|
155
|
+
let { emptyLabel: Ie = "No spans were recorded.", actions: Le, ...P } = we, { title: F, locale: Re } = P, I = pe("regular"), ze = ge(), Be = le(), Ve = ae(), [He, Ue] = h(y), [L, We] = h(null), [Ge, Ke] = h(!1), R = _e(null);
|
|
156
|
+
if (P.status === "loading") return /* @__PURE__ */ _(ee, {
|
|
157
|
+
...P,
|
|
158
|
+
height: "regular"
|
|
159
|
+
});
|
|
160
|
+
let qe = ye({
|
|
161
|
+
lanes: n,
|
|
162
|
+
spans: g,
|
|
163
|
+
domain: y
|
|
164
|
+
});
|
|
165
|
+
if (qe !== void 0) return /* @__PURE__ */ _(re, {
|
|
166
|
+
...P,
|
|
167
|
+
message: qe
|
|
168
|
+
});
|
|
169
|
+
let z = O(x ?? He, y), B = Math.max(y[1] - y[0], 0), V = Math.max(z[1] - z[0], 0), H = B > 0 && V < B * .999;
|
|
170
|
+
function U(e) {
|
|
171
|
+
let t = O(e, y);
|
|
172
|
+
x === void 0 && Ue(t), S?.(t);
|
|
173
|
+
}
|
|
174
|
+
let Je = new Map((b ?? []).map((e) => [e.id, e])), W = o({
|
|
175
|
+
width: I.width,
|
|
176
|
+
valueLabels: n.map((e) => e.label),
|
|
177
|
+
hasXTitle: !0,
|
|
178
|
+
hasYTitle: !1
|
|
179
|
+
}), Ye = Math.max(1, I.width - W.left - W.right), { rowBySpanId: Xe, rowCountByLane: Ze } = Te({
|
|
180
|
+
lanes: n,
|
|
181
|
+
spans: g,
|
|
182
|
+
minExtent: V > 0 ? V / Ye * 6 : 0
|
|
183
|
+
}), Qe = 0;
|
|
184
|
+
for (let e of Ze) Qe += e;
|
|
185
|
+
let $e = W.top + Qe * 26 + n.length * 6 * 2 + W.bottom, G = s({
|
|
186
|
+
width: I.width,
|
|
187
|
+
height: $e,
|
|
188
|
+
margins: W
|
|
189
|
+
}), K = he({
|
|
190
|
+
domain: z,
|
|
191
|
+
range: [G.left, G.right]
|
|
192
|
+
}), et = he({
|
|
193
|
+
domain: y,
|
|
194
|
+
range: [G.left, G.right]
|
|
195
|
+
}), q = [], J = G.top;
|
|
196
|
+
for (let [e, t] of n.entries()) {
|
|
197
|
+
let n = (Ze[e] ?? 1) * 26 + 12;
|
|
198
|
+
q.push({
|
|
199
|
+
lane: t,
|
|
200
|
+
index: e,
|
|
201
|
+
start: J,
|
|
202
|
+
end: J + n
|
|
203
|
+
}), J += n;
|
|
204
|
+
}
|
|
205
|
+
let tt = new Map(q.map((e) => [e.lane.id, e])), nt = q.map((e) => ({
|
|
206
|
+
key: e.lane.id,
|
|
207
|
+
position: (e.start + e.end) * M,
|
|
208
|
+
label: e.lane.label
|
|
209
|
+
}));
|
|
210
|
+
function Y(e) {
|
|
211
|
+
return ce({
|
|
212
|
+
value: e,
|
|
213
|
+
locale: Re,
|
|
214
|
+
format: ve
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
let rt = Math.max(Ne, Math.floor(G.innerWidth / Me)), it = i(z, rt), at = (it.length > 0 ? it : [z[0]]).map((e) => ({
|
|
218
|
+
key: String(e),
|
|
219
|
+
position: K.position(e),
|
|
220
|
+
label: Y(e - y[0])
|
|
221
|
+
})), ot = T !== void 0 && T.length > 0 ? new Set(T) : null, st = Ce(C, g), X = ot ?? st ?? null;
|
|
222
|
+
function ct(e, t) {
|
|
223
|
+
if (e.tone !== void 0) return e.tone;
|
|
224
|
+
let r = e.category === void 0 ? void 0 : Je.get(e.category);
|
|
225
|
+
return r === void 0 ? Be({
|
|
226
|
+
id: e.laneId,
|
|
227
|
+
tone: n[t]?.tone,
|
|
228
|
+
index: t
|
|
229
|
+
}) : r.tone;
|
|
230
|
+
}
|
|
231
|
+
let Z = g.map((e, t) => ({
|
|
232
|
+
span: e,
|
|
233
|
+
index: t
|
|
234
|
+
})).toSorted((e, t) => e.span.start === t.span.start ? e.index - t.index : e.span.start - t.span.start).map((e) => e.span).map((e, t) => {
|
|
235
|
+
let n = tt.get(e.laneId), r = n?.index ?? 0, i = Xe.get(e.id) ?? 0, a = (n?.start ?? G.top) + 6 + (i + M) * 26, o = K.position(e.start), s = K.position(e.end), c = Math.max(G.left, o), l = Math.min(G.right, Math.max(o + 4, s)), u = s >= G.left - 4 && o <= G.right + 4, d = ct(e, r), f = Y(e.end - e.start), p = Y(e.start - y[0]), ee = L === null || e.category === L, te = X === null || X.has(e.id), ne = ee && te;
|
|
236
|
+
return {
|
|
237
|
+
span: e,
|
|
238
|
+
rank: t,
|
|
239
|
+
laneIndex: r,
|
|
240
|
+
laneLabel: n?.lane.label ?? e.laneId,
|
|
241
|
+
x1: c,
|
|
242
|
+
x2: l,
|
|
243
|
+
y: a,
|
|
244
|
+
isVisible: u,
|
|
245
|
+
tone: d,
|
|
246
|
+
duration: f,
|
|
247
|
+
offset: p,
|
|
248
|
+
isEmphasized: ne
|
|
249
|
+
};
|
|
250
|
+
}), Q = Z.map(({ span: e, laneLabel: t, duration: n, offset: r }) => ({
|
|
251
|
+
id: e.id,
|
|
252
|
+
label: [
|
|
253
|
+
t,
|
|
254
|
+
e.label,
|
|
255
|
+
n,
|
|
256
|
+
`at +${r}`,
|
|
257
|
+
e.badge,
|
|
258
|
+
e.detail
|
|
259
|
+
].filter((e) => e !== void 0 && e !== "").join(" · ")
|
|
260
|
+
})), $ = Z.find((e) => e.span.id === C), lt = 1 / (n.length * 2 + 1);
|
|
261
|
+
function ut(e) {
|
|
262
|
+
let t = e.x / e.width * G.width, n = e.y / e.height * G.height, r, i = Infinity;
|
|
263
|
+
for (let e of Z) {
|
|
264
|
+
let a = t >= e.x1 - Ae && t <= e.x2 + Ae, o = Math.abs(n - e.y) <= 26 * M;
|
|
265
|
+
if (e.isVisible && a && o) {
|
|
266
|
+
let a = Math.max(e.x1, Math.min(e.x2, t)), o = Math.hypot(t - a, n - e.y);
|
|
267
|
+
o <= i && (i = o, r = e.span.id);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
return r;
|
|
271
|
+
}
|
|
272
|
+
function dt(e) {
|
|
273
|
+
if (B <= 0) return;
|
|
274
|
+
let t = e.currentTarget.getBoundingClientRect(), n = e.clientX - t.left, r = Math.max(0, Math.min(1, (n - G.left) / Math.max(1, G.innerWidth)));
|
|
275
|
+
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
276
|
+
e.preventDefault();
|
|
277
|
+
let t = e.deltaY < 0 ? "in" : "out";
|
|
278
|
+
U(k({
|
|
279
|
+
visible: z,
|
|
280
|
+
domain: y,
|
|
281
|
+
direction: t,
|
|
282
|
+
anchorRatio: r
|
|
283
|
+
}));
|
|
284
|
+
} else if (H && Math.abs(e.deltaX) > Math.abs(e.deltaY)) {
|
|
285
|
+
e.preventDefault();
|
|
286
|
+
let t = e.deltaX / Math.max(1, G.innerWidth) * V;
|
|
287
|
+
U(A({
|
|
288
|
+
visible: z,
|
|
289
|
+
domain: y,
|
|
290
|
+
delta: t
|
|
291
|
+
}));
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
function ft(e) {
|
|
295
|
+
if (!H || e.button !== 0 || e.pointerType === "touch") return;
|
|
296
|
+
let t = e.currentTarget.getBoundingClientRect();
|
|
297
|
+
ut({
|
|
298
|
+
x: e.clientX - t.left,
|
|
299
|
+
y: e.clientY - t.top,
|
|
300
|
+
width: t.width,
|
|
301
|
+
height: t.height
|
|
302
|
+
}) === void 0 && (R.current = {
|
|
303
|
+
clientX: e.clientX,
|
|
304
|
+
range: z
|
|
305
|
+
}, Ke(!0), e.currentTarget.setPointerCapture(e.pointerId));
|
|
306
|
+
}
|
|
307
|
+
function pt(e) {
|
|
308
|
+
let t = R.current;
|
|
309
|
+
if (t === null) return;
|
|
310
|
+
let n = e.clientX - t.clientX, r = t.range[1] - t.range[0], i = -(n / Math.max(1, G.innerWidth)) * r;
|
|
311
|
+
U(A({
|
|
312
|
+
visible: t.range,
|
|
313
|
+
domain: y,
|
|
314
|
+
delta: i
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
function mt() {
|
|
318
|
+
R.current = null, Ke(!1);
|
|
319
|
+
}
|
|
320
|
+
function ht(e) {
|
|
321
|
+
switch (e.key) {
|
|
322
|
+
case "+":
|
|
323
|
+
case "=":
|
|
324
|
+
e.preventDefault(), U(k({
|
|
325
|
+
visible: z,
|
|
326
|
+
domain: y,
|
|
327
|
+
direction: "in"
|
|
328
|
+
}));
|
|
329
|
+
break;
|
|
330
|
+
case "-":
|
|
331
|
+
e.preventDefault(), U(k({
|
|
332
|
+
visible: z,
|
|
333
|
+
domain: y,
|
|
334
|
+
direction: "out"
|
|
335
|
+
}));
|
|
336
|
+
break;
|
|
337
|
+
case "0":
|
|
338
|
+
e.preventDefault(), U(y);
|
|
339
|
+
break;
|
|
340
|
+
case "[":
|
|
341
|
+
H && (e.preventDefault(), U(be({
|
|
342
|
+
visible: z,
|
|
343
|
+
domain: y,
|
|
344
|
+
direction: "left"
|
|
345
|
+
})));
|
|
346
|
+
break;
|
|
347
|
+
case "]":
|
|
348
|
+
H && (e.preventDefault(), U(be({
|
|
349
|
+
visible: z,
|
|
350
|
+
domain: y,
|
|
351
|
+
direction: "right"
|
|
352
|
+
})));
|
|
353
|
+
break;
|
|
354
|
+
case "Enter": $ !== void 0 && E !== void 0 && (e.preventDefault(), E($.span));
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
let gt = `${Y(z[0] - y[0])} – ${Y(z[1] - y[0])}`, _t = /* @__PURE__ */ v(u, { children: [
|
|
358
|
+
/* @__PURE__ */ _("span", {
|
|
359
|
+
className: "xy8obcc x153jb6y xss6m8b xuxw1ft",
|
|
360
|
+
children: gt
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ _(c, {
|
|
363
|
+
variant: "outline",
|
|
364
|
+
onClick: () => U(k({
|
|
365
|
+
visible: z,
|
|
366
|
+
domain: y,
|
|
367
|
+
direction: "out"
|
|
368
|
+
})),
|
|
369
|
+
disabled: !H,
|
|
370
|
+
"aria-label": "Zoom out",
|
|
371
|
+
children: "−"
|
|
372
|
+
}),
|
|
373
|
+
/* @__PURE__ */ _(c, {
|
|
374
|
+
variant: "outline",
|
|
375
|
+
onClick: () => U(k({
|
|
376
|
+
visible: z,
|
|
377
|
+
domain: y,
|
|
378
|
+
direction: "in"
|
|
379
|
+
})),
|
|
380
|
+
disabled: B <= 0,
|
|
381
|
+
"aria-label": "Zoom in",
|
|
382
|
+
children: "+"
|
|
383
|
+
}),
|
|
384
|
+
$ !== void 0 && /* @__PURE__ */ _(c, {
|
|
385
|
+
variant: "outline",
|
|
386
|
+
onClick: () => U(xe($.span, y)),
|
|
387
|
+
"aria-label": "Zoom to selected span",
|
|
388
|
+
children: "Fit span"
|
|
389
|
+
}),
|
|
390
|
+
H && /* @__PURE__ */ _(c, {
|
|
391
|
+
variant: "ghost",
|
|
392
|
+
onClick: () => U(y),
|
|
393
|
+
"aria-label": "Reset zoom",
|
|
394
|
+
children: "Reset"
|
|
395
|
+
}),
|
|
396
|
+
Le
|
|
397
|
+
] }), vt = $ !== void 0 && D !== void 0 ? D($.span) : [], yt = b ?? [], bt = yt.length > 0, xt = E !== void 0 && vt.length === 0, St = $ === void 0 ? null : /* @__PURE__ */ v("div", {
|
|
398
|
+
role: "region",
|
|
399
|
+
"aria-label": "Selected span actions",
|
|
400
|
+
className: "x78zum5 x1a02dak x6s0dn4 x1qughib x1hnptsi xn9t2bk x1doqdfy xmkeg23 x1y0btm7 x1ey3b81 xy32g2j x1r7kqkb xeuugli",
|
|
401
|
+
children: [/* @__PURE__ */ v("div", {
|
|
402
|
+
className: "x78zum5 x1a02dak x6s0dn4 x1hnptsi xeuugli xk30mkq",
|
|
403
|
+
children: [
|
|
404
|
+
/* @__PURE__ */ _("span", { ...m.props(N.swatch(f[$.tone])) }),
|
|
405
|
+
/* @__PURE__ */ _("span", {
|
|
406
|
+
title: $.span.label,
|
|
407
|
+
className: "xb3r6kr xlyipyv xuxw1ft xyq1l15",
|
|
408
|
+
children: /* @__PURE__ */ _(l, { children: $.span.label })
|
|
409
|
+
}),
|
|
410
|
+
/* @__PURE__ */ _("span", {
|
|
411
|
+
className: "xy8obcc x153jb6y xss6m8b xuxw1ft",
|
|
412
|
+
children: `${$.duration} (+${$.offset})`
|
|
413
|
+
}),
|
|
414
|
+
$.span.badge !== void 0 && /* @__PURE__ */ _(d, { children: $.span.badge }),
|
|
415
|
+
$.span.detail !== void 0 && /* @__PURE__ */ _("span", {
|
|
416
|
+
title: $.span.detail,
|
|
417
|
+
className: "xy8obcc x153jb6y xb3r6kr xlyipyv xuxw1ft xxc7z9f",
|
|
418
|
+
children: $.span.detail
|
|
419
|
+
})
|
|
420
|
+
]
|
|
421
|
+
}), /* @__PURE__ */ v(u, { children: [vt.map((e) => e.href === void 0 ? /* @__PURE__ */ _(c, {
|
|
422
|
+
variant: "outline",
|
|
423
|
+
onClick: e.onSelect,
|
|
424
|
+
children: e.label
|
|
425
|
+
}, e.id) : /* @__PURE__ */ _("a", {
|
|
426
|
+
href: e.href,
|
|
427
|
+
target: e.isExternal === !0 ? "_blank" : void 0,
|
|
428
|
+
rel: e.isExternal === !0 ? "noreferrer" : void 0,
|
|
429
|
+
className: "x3nfvp2 x6s0dn4 xunmzkg x1fgtraw x5g2kb4 xy32g2j xmkeg23 x1y0btm7 x1ey3b81 xpvm0e4 xbixft x1hz01jw xy8obcc x1hl2dhg x1ypdohk x1mkwuse",
|
|
430
|
+
children: e.label
|
|
431
|
+
}, e.id)), xt && /* @__PURE__ */ _(c, {
|
|
432
|
+
variant: "solid",
|
|
433
|
+
onClick: () => E($.span),
|
|
434
|
+
children: "Inspect span"
|
|
435
|
+
})] })]
|
|
436
|
+
}), Ct = B > 0 ? B / Fe : 1;
|
|
437
|
+
return /* @__PURE__ */ _(t, {
|
|
438
|
+
...Ve,
|
|
439
|
+
items: Q,
|
|
440
|
+
place: (e) => {
|
|
441
|
+
let t = Z.find((t) => t.span.id === e), n = t?.rank ?? 0, r = (t?.laneIndex ?? 0) * lt;
|
|
442
|
+
return t === void 0 ? void 0 : {
|
|
443
|
+
left: n,
|
|
444
|
+
right: n,
|
|
445
|
+
top: r,
|
|
446
|
+
bottom: r
|
|
447
|
+
};
|
|
448
|
+
},
|
|
449
|
+
locate: ut,
|
|
450
|
+
selected: C ?? null,
|
|
451
|
+
onSelect: w,
|
|
452
|
+
render: (t, { inspected: i, cursor: o }) => {
|
|
453
|
+
let s = Z.find((e) => e.span.id === o);
|
|
454
|
+
return /* @__PURE__ */ _(ne, {
|
|
455
|
+
...P,
|
|
456
|
+
actions: _t,
|
|
457
|
+
figure: t,
|
|
458
|
+
footer: g.length === 0 ? void 0 : /* @__PURE__ */ _(r, {
|
|
459
|
+
id: ze,
|
|
460
|
+
children: e(Q, i)
|
|
461
|
+
}),
|
|
462
|
+
children: g.length === 0 ? /* @__PURE__ */ _(ie, { children: Ie }) : /* @__PURE__ */ v("div", {
|
|
463
|
+
className: "xrvj5dj xunmzkg xeuugli",
|
|
464
|
+
children: [
|
|
465
|
+
bt && /* @__PURE__ */ v("div", {
|
|
466
|
+
role: "group",
|
|
467
|
+
"aria-label": "Filter by span category",
|
|
468
|
+
className: "x78zum5 x1a02dak x6s0dn4 xunmzkg x14w6jbu",
|
|
469
|
+
children: [yt.map((e) => {
|
|
470
|
+
let t = L === e.id;
|
|
471
|
+
return /* @__PURE__ */ v("button", {
|
|
472
|
+
type: "button",
|
|
473
|
+
"aria-pressed": t,
|
|
474
|
+
onClick: () => We((t) => t === e.id ? null : e.id),
|
|
475
|
+
...{
|
|
476
|
+
0: { className: "x3nfvp2 x6s0dn4 xunmzkg xd7y6wv x5g2kb4 xy32g2j xmkeg23 x1y0btm7 x1ey3b81 xpvm0e4 xbixft x1hz01jw xy8obcc x1ypdohk x1t137rt xif5pkx x19rmrnh x9v5kkp x13qnu6 x13iak60" },
|
|
477
|
+
2: { className: "x3nfvp2 x6s0dn4 xunmzkg xd7y6wv x5g2kb4 xy32g2j xmkeg23 x1y0btm7 xbixft x1hz01jw xy8obcc x1ypdohk x1t137rt xif5pkx x19rmrnh x9v5kkp x13qnu6 x13iak60 x159tnba x1r7kqkb" },
|
|
478
|
+
1: { className: "x3nfvp2 x6s0dn4 xunmzkg xd7y6wv x5g2kb4 xy32g2j xmkeg23 x1y0btm7 x1ey3b81 xpvm0e4 xbixft x1hz01jw xy8obcc x1ypdohk x1t137rt xif5pkx x19rmrnh x9v5kkp x13qnu6 x13iak60 xyd83as" },
|
|
479
|
+
3: { className: "x3nfvp2 x6s0dn4 xunmzkg xd7y6wv x5g2kb4 xy32g2j xmkeg23 x1y0btm7 xbixft x1hz01jw xy8obcc x1ypdohk x1t137rt xif5pkx x19rmrnh x9v5kkp x13qnu6 x13iak60 x159tnba x1r7kqkb xyd83as" }
|
|
480
|
+
}[!!t << 1 | !(L === null || t)],
|
|
481
|
+
children: [/* @__PURE__ */ _("span", { ...m.props(N.swatch(f[e.tone])) }), /* @__PURE__ */ _("span", { children: e.label })]
|
|
482
|
+
}, e.id);
|
|
483
|
+
}), L !== null && /* @__PURE__ */ _(c, {
|
|
484
|
+
variant: "ghost",
|
|
485
|
+
onClick: () => We(null),
|
|
486
|
+
children: "Show all"
|
|
487
|
+
})]
|
|
488
|
+
}),
|
|
489
|
+
Se && B > 0 && /* @__PURE__ */ _("div", {
|
|
490
|
+
className: "x1n2onr6 xmkeg23 x1y0btm7 x1ey3b81 xy32g2j x1r7kqkb xb3r6kr",
|
|
491
|
+
children: /* @__PURE__ */ _(oe, {
|
|
492
|
+
value: H ? z : null,
|
|
493
|
+
onValueChange: (e) => U(e ?? y),
|
|
494
|
+
min: y[0],
|
|
495
|
+
max: y[1],
|
|
496
|
+
step: Ct,
|
|
497
|
+
describe: (e) => `${Y(e[0] - y[0])} to ${Y(e[1] - y[0])}`,
|
|
498
|
+
label: `${F} zoom minimap`,
|
|
499
|
+
left: G.left,
|
|
500
|
+
width: G.innerWidth,
|
|
501
|
+
height: De,
|
|
502
|
+
children: /* @__PURE__ */ _("svg", {
|
|
503
|
+
"aria-hidden": !0,
|
|
504
|
+
viewBox: `0 0 ${G.width} ${De}`,
|
|
505
|
+
className: "x1lliihq xh8yej3 x5kalc8 x87ps6o",
|
|
506
|
+
children: Z.map((e) => {
|
|
507
|
+
let t = et.position(e.span.start), r = Math.max(t + 2, et.position(e.span.end)), i = ke + (n.length > 1 ? e.laneIndex / (n.length - 1) : .5) * 26;
|
|
508
|
+
return /* @__PURE__ */ _("rect", {
|
|
509
|
+
x: t,
|
|
510
|
+
y: i,
|
|
511
|
+
width: Math.max(2, r - t),
|
|
512
|
+
height: Oe,
|
|
513
|
+
rx: 1.5,
|
|
514
|
+
...m.props(N.minimapBar(f[e.tone]))
|
|
515
|
+
}, `mini-${e.span.id}`);
|
|
516
|
+
})
|
|
517
|
+
})
|
|
518
|
+
})
|
|
519
|
+
}),
|
|
520
|
+
/* @__PURE__ */ _("div", {
|
|
521
|
+
onWheel: dt,
|
|
522
|
+
onPointerDown: ft,
|
|
523
|
+
onPointerMove: pt,
|
|
524
|
+
onPointerUp: mt,
|
|
525
|
+
onPointerCancel: mt,
|
|
526
|
+
onKeyDown: ht,
|
|
527
|
+
onDoubleClick: () => {
|
|
528
|
+
$ !== void 0 && E !== void 0 && E($.span);
|
|
529
|
+
},
|
|
530
|
+
...{
|
|
531
|
+
0: { className: "x1n2onr6 xeuugli x1t137rt" },
|
|
532
|
+
2: { className: "x1n2onr6 xeuugli x1t137rt x1jm3nie" },
|
|
533
|
+
1: { className: "x1n2onr6 xeuugli x1t137rt xi9pz9s x87ps6o" },
|
|
534
|
+
3: { className: "x1n2onr6 xeuugli x1t137rt xi9pz9s x87ps6o" }
|
|
535
|
+
}[!!H << 1 | !!Ge],
|
|
536
|
+
children: /* @__PURE__ */ v(fe, {
|
|
537
|
+
plotRef: I.ref,
|
|
538
|
+
box: G,
|
|
539
|
+
label: a({
|
|
540
|
+
title: F,
|
|
541
|
+
marks: "spans",
|
|
542
|
+
isSelectable: w !== void 0
|
|
543
|
+
}),
|
|
544
|
+
readoutId: ze,
|
|
545
|
+
children: [
|
|
546
|
+
q.map((e, t) => t % 2 == 1 ? /* @__PURE__ */ _("rect", {
|
|
547
|
+
x: G.left,
|
|
548
|
+
y: e.start,
|
|
549
|
+
width: G.innerWidth,
|
|
550
|
+
height: e.end - e.start,
|
|
551
|
+
className: "x2wnxhi x6b6j1m x47corl"
|
|
552
|
+
}, `band-${e.lane.id}`) : null),
|
|
553
|
+
/* @__PURE__ */ _(ue, {
|
|
554
|
+
box: G,
|
|
555
|
+
xTicks: at,
|
|
556
|
+
yTicks: nt,
|
|
557
|
+
xTitle: j,
|
|
558
|
+
grid: "x"
|
|
559
|
+
}),
|
|
560
|
+
q.slice(1).map((e) => /* @__PURE__ */ _("line", {
|
|
561
|
+
x1: G.left,
|
|
562
|
+
x2: G.right,
|
|
563
|
+
y1: e.start,
|
|
564
|
+
y2: e.start,
|
|
565
|
+
...m.props(se.grid, N.separator)
|
|
566
|
+
}, e.lane.id)),
|
|
567
|
+
/* @__PURE__ */ _(me, {
|
|
568
|
+
box: G,
|
|
569
|
+
children: Z.map((e) => {
|
|
570
|
+
if (!e.isVisible) return null;
|
|
571
|
+
let t = Math.max(4, e.x2 - e.x1), n = Ee(e.span.label, e.duration, t);
|
|
572
|
+
return /* @__PURE__ */ v("g", { children: [/* @__PURE__ */ _(de, {
|
|
573
|
+
mark: e.span.id,
|
|
574
|
+
x: e.x1,
|
|
575
|
+
y: e.y - 18 * M,
|
|
576
|
+
width: t,
|
|
577
|
+
height: 18,
|
|
578
|
+
tone: e.tone,
|
|
579
|
+
emphasis: e.isEmphasized ? "normal" : "receded",
|
|
580
|
+
isInspected: i === e.span.id,
|
|
581
|
+
isSelected: C === e.span.id
|
|
582
|
+
}), n !== void 0 && /* @__PURE__ */ _("text", {
|
|
583
|
+
x: e.x1 + Pe,
|
|
584
|
+
y: e.y + 4,
|
|
585
|
+
...{
|
|
586
|
+
0: { className: "xtefokc x1hz01jw xy8obcc xss6m8b x47corl x87ps6o" },
|
|
587
|
+
1: { className: "xtefokc x1hz01jw xy8obcc xss6m8b x47corl x87ps6o xyd83as" }
|
|
588
|
+
}[!e.isEmphasized | 0],
|
|
589
|
+
children: n
|
|
590
|
+
})] }, e.span.id);
|
|
591
|
+
})
|
|
592
|
+
}),
|
|
593
|
+
s !== void 0 && s.isVisible && /* @__PURE__ */ _(p, {
|
|
594
|
+
x: (s.x1 + s.x2) * M,
|
|
595
|
+
top: G.top,
|
|
596
|
+
bottom: G.bottom,
|
|
597
|
+
width: je
|
|
598
|
+
})
|
|
599
|
+
]
|
|
600
|
+
})
|
|
601
|
+
}),
|
|
602
|
+
St,
|
|
603
|
+
/* @__PURE__ */ _(te, {
|
|
604
|
+
label: `${F} spans`,
|
|
605
|
+
columns: [{
|
|
606
|
+
id: "span",
|
|
607
|
+
label: "Span"
|
|
608
|
+
}],
|
|
609
|
+
rows: Q.map((e) => ({
|
|
610
|
+
id: e.id,
|
|
611
|
+
values: [e.label]
|
|
612
|
+
}))
|
|
613
|
+
})
|
|
614
|
+
]
|
|
615
|
+
})
|
|
616
|
+
});
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
}
|
|
620
|
+
export { y as n, P as t };
|