@overdoser/react-toolkit 0.8.3 → 0.9.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/AGENTS.md +6 -0
- package/CHANGELOG.md +35 -0
- package/components/Timeline/GanttTimeline.d.ts +144 -0
- package/components/Timeline/GanttTimeline.js +305 -0
- package/components/Timeline/GanttTimeline.module.scss.js +55 -0
- package/components/Timeline/HistoryTimeline.d.ts +184 -0
- package/components/Timeline/HistoryTimeline.js +445 -0
- package/components/Timeline/HistoryTimeline.module.scss.js +59 -0
- package/components/Timeline/Timeline.module.scss.js +111 -0
- package/components/Timeline/TimelineShared.d.ts +79 -0
- package/components/Timeline/TimelineShared.js +173 -0
- package/components/Timeline/TraceTimeline.d.ts +180 -0
- package/components/Timeline/TraceTimeline.js +511 -0
- package/components/Timeline/TraceTimeline.module.scss.js +105 -0
- package/components/Timeline/demoData.d.ts +42 -0
- package/components/Timeline/historyLayout.d.ts +82 -0
- package/components/Timeline/historyLayout.js +264 -0
- package/components/Timeline/index.d.ts +7 -0
- package/components/Timeline/timelineCore.d.ts +90 -0
- package/components/Timeline/timelineCore.js +135 -0
- package/components/Timeline/traceLayout.d.ts +72 -0
- package/components/Timeline/traceLayout.js +92 -0
- package/components/Timeline/useTimeline.d.ts +39 -0
- package/components/Timeline/useTimeline.js +81 -0
- package/index.css +1 -1
- package/index.d.ts +2 -0
- package/index.js +93 -87
- package/index.layered.css +1 -1
- package/llms.txt +113 -0
- package/manifest.json +323 -0
- package/package.json +1 -1
- package/recipes/live-timeline-feed.tsx +147 -0
|
@@ -0,0 +1,511 @@
|
|
|
1
|
+
import { jsx as n, jsxs as r, Fragment as R } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as Ht, useRef as M, useState as x, useCallback as le, useEffect as Et, useLayoutEffect as Pt, useMemo as Bt } from "react";
|
|
3
|
+
import c from "clsx";
|
|
4
|
+
import a from "./Timeline.module.scss.js";
|
|
5
|
+
import l from "./TraceTimeline.module.scss.js";
|
|
6
|
+
import { fmtDateISO as Re, fmtISO as I, ticks as Dt, fmtClockUTC as Je, TL_COLORS as v, fmtDur as se, eventMatches as It, tint as H, TIMELINE_PALETTE_VARS as Qe } from "./timelineCore.js";
|
|
7
|
+
import { traceChipWidth as qt, layoutTraceBand as Wt } from "./traceLayout.js";
|
|
8
|
+
import { TimelineSummary as Ot, TimelineZoomControls as At, TimelineLegend as Vt, HighlightText as Ut, TimelineTooltip as Xt } from "./TimelineShared.js";
|
|
9
|
+
import { useNowTicker as $t, useContainerWidth as Ft, useTimelinePan as Kt, useWheelZoom as jt, animateScrollTo as zt } from "./useTimeline.js";
|
|
10
|
+
const g = 84, et = 24, Zt = 51, ae = 300, an = Ht(
|
|
11
|
+
function(tt, nt) {
|
|
12
|
+
const {
|
|
13
|
+
events: d,
|
|
14
|
+
title: ie,
|
|
15
|
+
meta: re,
|
|
16
|
+
highlight: ce,
|
|
17
|
+
defaultHighlight: lt,
|
|
18
|
+
onHighlightChange: st,
|
|
19
|
+
showSearch: at = !0,
|
|
20
|
+
renderSearch: He,
|
|
21
|
+
services: Ee,
|
|
22
|
+
serviceColors: it,
|
|
23
|
+
compactRows: rt = !1,
|
|
24
|
+
showGridlines: ct = !0,
|
|
25
|
+
showControls: Pe = !0,
|
|
26
|
+
showLegend: ot = !0,
|
|
27
|
+
showSummary: K = !1,
|
|
28
|
+
summaryPlacement: E = "left",
|
|
29
|
+
summaryDefaultPosition: dt,
|
|
30
|
+
maxHeight: ut = "80vh",
|
|
31
|
+
selectedEventId: oe,
|
|
32
|
+
defaultSelectedEventId: ht = null,
|
|
33
|
+
onEventSelect: mt,
|
|
34
|
+
renderChip: Be,
|
|
35
|
+
renderTooltip: de,
|
|
36
|
+
renderDetails: ue,
|
|
37
|
+
classes: h,
|
|
38
|
+
className: pt,
|
|
39
|
+
style: ft
|
|
40
|
+
} = tt, m = M(null), [De, Ie] = x(null), [qe, We] = x(!0), [p, he] = x(null), [vt, Oe] = x(null), [T, me] = x(null), [q, Ae] = x(null), [gt, Nt] = x(null), [yt, wt] = x(ht), P = oe !== void 0 ? oe : yt, [j, xt] = x({ l: 0, w: 0 }), Ve = M(K);
|
|
41
|
+
Ve.current = K;
|
|
42
|
+
const pe = le(() => {
|
|
43
|
+
const e = m.current;
|
|
44
|
+
e && xt(
|
|
45
|
+
(t) => t.l === e.scrollLeft && t.w === e.clientWidth ? t : { l: e.scrollLeft, w: e.clientWidth }
|
|
46
|
+
);
|
|
47
|
+
}, []);
|
|
48
|
+
Et(() => {
|
|
49
|
+
K && pe();
|
|
50
|
+
});
|
|
51
|
+
const Ue = d.some((e) => e.end == null), b = $t(Ue, 400), fe = Ft(m), W = Kt(m), [bt, Mt] = x(lt ?? ""), ve = ce !== void 0 ? ce : bt, L = ve.trim(), Xe = (e) => {
|
|
52
|
+
ce === void 0 && Mt(e), st?.(e);
|
|
53
|
+
}, $e = He ? He({ value: ve, setValue: Xe }) : at ? /* @__PURE__ */ n(
|
|
54
|
+
"input",
|
|
55
|
+
{
|
|
56
|
+
className: c(a.searchInput, h?.search),
|
|
57
|
+
placeholder: "Highlight keyword in events…",
|
|
58
|
+
"aria-label": "Highlight keyword",
|
|
59
|
+
value: ve,
|
|
60
|
+
onChange: (e) => Xe(e.target.value)
|
|
61
|
+
}
|
|
62
|
+
) : null, O = (e) => e.op || e.requestId || e.reqHeaders && e.reqHeaders["x-request-id"] || e.id, z = (e) => e.source || "client";
|
|
63
|
+
let u, k;
|
|
64
|
+
d.length ? (u = Math.min(...d.map((e) => e.start)), k = Math.max(u + 1e3, ...d.map((e) => e.end ?? b))) : (u = b - 3e4, k = b + 5e3);
|
|
65
|
+
const ge = (k - u) * 0.03;
|
|
66
|
+
u -= ge, k += ge;
|
|
67
|
+
const A = k - u, Fe = Math.max(240, fe - g - et), Z = Math.max(Fe * 0.45, Fe - 210) / A, N = qe || !De ? Z : De, Ne = M(Z), B = M(N), ye = M(u), we = M(1e9);
|
|
68
|
+
Ne.current = Z, B.current = N, ye.current = u;
|
|
69
|
+
const _ = M(null);
|
|
70
|
+
Pt(() => {
|
|
71
|
+
_.current != null && m.current && (m.current.scrollLeft = _.current, _.current = null);
|
|
72
|
+
});
|
|
73
|
+
const xe = le((e, t) => {
|
|
74
|
+
const s = m.current;
|
|
75
|
+
if (!s) return;
|
|
76
|
+
const y = B.current || 1e-3, o = Math.max(Ne.current ? Ne.current * 0.2 : 1e-7, Math.min(10, y * e)), f = (s.scrollLeft + t - g) / y;
|
|
77
|
+
_.current = f * o + g - t, We(!1), Ie(o);
|
|
78
|
+
}, []);
|
|
79
|
+
jt(m, (e) => {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
const t = m.current;
|
|
82
|
+
t && xe(
|
|
83
|
+
Math.exp(-(e.deltaY || e.deltaX) * 22e-4),
|
|
84
|
+
e.clientX - t.getBoundingClientRect().left
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
const be = M(null), St = le(() => {
|
|
88
|
+
be.current == null && (be.current = requestAnimationFrame(() => {
|
|
89
|
+
be.current = null;
|
|
90
|
+
const e = m.current;
|
|
91
|
+
if (!e || !B.current) return;
|
|
92
|
+
const t = ye.current + Math.max(0, e.scrollLeft + 117 - g) / B.current;
|
|
93
|
+
Nt(Re(t)), Ve.current && pe();
|
|
94
|
+
}));
|
|
95
|
+
}, [pe]), Me = M(null), Tt = le((e) => {
|
|
96
|
+
const t = e.clientX;
|
|
97
|
+
Me.current == null && (Me.current = requestAnimationFrame(() => {
|
|
98
|
+
Me.current = null;
|
|
99
|
+
const s = m.current;
|
|
100
|
+
if (!s) return;
|
|
101
|
+
const y = s.getBoundingClientRect(), o = t - y.left + s.scrollLeft;
|
|
102
|
+
if (o < g + 5 || !B.current) {
|
|
103
|
+
me(null);
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const f = ye.current + (o - g) / B.current, w = Math.max(88, Math.min(Math.round(o), we.current - 88));
|
|
107
|
+
me({ left: Math.round(o), chipLeft: w, label: I(f, !0), t: f });
|
|
108
|
+
}));
|
|
109
|
+
}, []), Se = (e) => {
|
|
110
|
+
oe === void 0 && wt(e ? e.id : null), mt?.(e);
|
|
111
|
+
}, Ke = Bt(() => {
|
|
112
|
+
const e = [];
|
|
113
|
+
return (Ee || []).forEach((t) => {
|
|
114
|
+
d.some((s) => s.service === t) && e.push(t);
|
|
115
|
+
}), d.forEach((t) => {
|
|
116
|
+
e.includes(t.service) || e.push(t.service);
|
|
117
|
+
}), e;
|
|
118
|
+
}, [d, Ee]), S = {};
|
|
119
|
+
Ke.forEach((e, t) => {
|
|
120
|
+
S[e] = Qe[t % Qe.length];
|
|
121
|
+
}), Object.assign(S, it);
|
|
122
|
+
const je = rt, ze = je ? 20 : 26, Lt = je ? 60 : 66, kt = d.map((e) => ({
|
|
123
|
+
id: e.id,
|
|
124
|
+
left: Math.round(g + (e.start - u) * N),
|
|
125
|
+
width: Math.round(Math.max(12, ((e.end ?? b) - e.start) * N)),
|
|
126
|
+
labelW: qt(z(e), e.service, String(O(e)))
|
|
127
|
+
})), Y = Wt(kt, {
|
|
128
|
+
barH: ze,
|
|
129
|
+
rowH: Lt,
|
|
130
|
+
chipH: Zt,
|
|
131
|
+
minH: 420
|
|
132
|
+
}), G = new Map(Y.items.map((e) => [e.id, e])), Ze = Dt(u, k, A * N, 64), Te = [];
|
|
133
|
+
let _e = null;
|
|
134
|
+
Ze.list.forEach((e) => {
|
|
135
|
+
const t = Re(e.t);
|
|
136
|
+
Te.push({
|
|
137
|
+
left: Math.round(g + (e.t - u) * N),
|
|
138
|
+
label: Je(e.t),
|
|
139
|
+
dateLabel: t !== _e ? t : null
|
|
140
|
+
}), _e = t;
|
|
141
|
+
});
|
|
142
|
+
const Ye = [], J = Ze.step / 4;
|
|
143
|
+
if (A / J < 700)
|
|
144
|
+
for (let e = Math.ceil(u / J); e * J <= k; e++)
|
|
145
|
+
e % 4 !== 0 && Ye.push(Math.round(g + (e * J - u) * N));
|
|
146
|
+
const Ge = Math.ceil(Math.max(g + A * N + et + 60, Y.maxExt + 26));
|
|
147
|
+
we.current = Ge;
|
|
148
|
+
const Le = T ? T.t : null, i = P != null && d.find((e) => e.id === P) || null, Ct = (e, t) => {
|
|
149
|
+
const s = G.get(e.id);
|
|
150
|
+
if (!s) return;
|
|
151
|
+
const y = e.end == null, o = (e.end ?? b) - e.start;
|
|
152
|
+
if (Ae({
|
|
153
|
+
left: s.left,
|
|
154
|
+
chipLeft: Math.max(88, Math.min(s.left, we.current - 88)),
|
|
155
|
+
label: I(e.start, !0)
|
|
156
|
+
}), Oe(e.id), P === e.id) return;
|
|
157
|
+
const f = m.current, w = f ? f.getBoundingClientRect() : { left: 0 }, V = f ? f.scrollLeft : 0, ee = window.innerWidth || 1200, U = window.innerHeight || 800, te = s.showLabel ? s.labelW : 0, X = s.showLabel ? s.labelX : s.left, Ce = w.left - V + Math.min(s.left, X), $ = w.left - V + Math.max(s.left + s.width, X + te), F = t.currentTarget.getBoundingClientRect();
|
|
158
|
+
let C = $ + 28, ne = Math.max(95, Math.min(t.clientY, U - 120));
|
|
159
|
+
C + ae > ee - 12 && (C = Ce - ae - 28), C < 12 && (C = Math.max(12, Math.min(ee - ae - 12, t.clientX - ae / 2)), ne = F.bottom + 108, ne > U - 95 && (ne = Math.max(95, F.top - 108))), he({
|
|
160
|
+
id: e.id,
|
|
161
|
+
x: C,
|
|
162
|
+
y: ne,
|
|
163
|
+
rid: String(O(e)),
|
|
164
|
+
route: z(e) + " → " + e.service,
|
|
165
|
+
label: e.label || (e.method || "GET") + " " + (e.url ? e.url.replace(/^https?:\/\/[^/]+/, "") : e.id),
|
|
166
|
+
time: I(e.start, !0),
|
|
167
|
+
durLine: y ? "in flight · " + se(o) + " so far" : se(o) + " · status " + (e.status ?? "—"),
|
|
168
|
+
url: e.url || ""
|
|
169
|
+
});
|
|
170
|
+
}, Rt = () => {
|
|
171
|
+
he(null), Ae(null), Oe(null);
|
|
172
|
+
}, ke = (e) => Object.entries(e || {}).map(([t, s]) => ({ k: t, v: String(s) })), D = i ? i.end == null : !1, Q = K ? /* @__PURE__ */ n(
|
|
173
|
+
Ot,
|
|
174
|
+
{
|
|
175
|
+
className: h?.summary,
|
|
176
|
+
placement: E,
|
|
177
|
+
floatingDefaultPosition: dt,
|
|
178
|
+
items: d.slice().sort((e, t) => e.start - t.start).map((e, t) => {
|
|
179
|
+
const s = G.get(e.id);
|
|
180
|
+
return {
|
|
181
|
+
id: e.id,
|
|
182
|
+
number: String(t + 1).padStart(2, "0"),
|
|
183
|
+
label: String(O(e)),
|
|
184
|
+
color: S[e.service] || v.body,
|
|
185
|
+
time: Je(e.start),
|
|
186
|
+
inView: !s || !j.w ? !0 : s.left < j.l + j.w && s.left + s.width > j.l,
|
|
187
|
+
selected: P === e.id
|
|
188
|
+
};
|
|
189
|
+
}),
|
|
190
|
+
onPick: (e) => {
|
|
191
|
+
const t = G.get(e), s = m.current;
|
|
192
|
+
!t || !s || zt(s, {
|
|
193
|
+
left: Math.max(0, t.left + t.width / 2 - s.clientWidth / 2)
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
) : null;
|
|
198
|
+
return /* @__PURE__ */ r("div", { ref: nt, className: c(a.root, h?.root, pt), style: ft, children: [
|
|
199
|
+
(Pe || $e || ie != null || re != null) && /* @__PURE__ */ r("div", { className: c(a.toolbar, h?.toolbar), children: [
|
|
200
|
+
/* @__PURE__ */ r("div", { className: a.toolbarText, children: [
|
|
201
|
+
ie != null && /* @__PURE__ */ n("span", { className: a.toolbarTitle, children: ie }),
|
|
202
|
+
/* @__PURE__ */ n("span", { className: a.toolbarMeta, children: re ?? (d.length ? `${d.length} events · span ${se(A - 2 * ge)} · times in UTC` : "No events") })
|
|
203
|
+
] }),
|
|
204
|
+
$e,
|
|
205
|
+
Pe && /* @__PURE__ */ n(
|
|
206
|
+
At,
|
|
207
|
+
{
|
|
208
|
+
zoomPct: `${Math.round(N / Z * 100)}%`,
|
|
209
|
+
fitActive: qe,
|
|
210
|
+
onZoomIn: () => xe(1.5, fe / 2),
|
|
211
|
+
onZoomOut: () => xe(1 / 1.5, fe / 2),
|
|
212
|
+
onFit: () => {
|
|
213
|
+
We(!0), Ie(null);
|
|
214
|
+
},
|
|
215
|
+
hint: "scroll zooms · drag pans"
|
|
216
|
+
}
|
|
217
|
+
)
|
|
218
|
+
] }),
|
|
219
|
+
ot && /* @__PURE__ */ n(
|
|
220
|
+
Vt,
|
|
221
|
+
{
|
|
222
|
+
className: h?.legend,
|
|
223
|
+
items: Ke.map((e) => ({ name: e, color: S[e] }))
|
|
224
|
+
}
|
|
225
|
+
),
|
|
226
|
+
E === "top" && Q,
|
|
227
|
+
/* @__PURE__ */ r("div", { className: a.layout, children: [
|
|
228
|
+
E === "left" && Q,
|
|
229
|
+
/* @__PURE__ */ r("div", { className: a.main, children: [
|
|
230
|
+
/* @__PURE__ */ n("div", { className: c(a.card, h?.card), children: /* @__PURE__ */ n(
|
|
231
|
+
"div",
|
|
232
|
+
{
|
|
233
|
+
ref: m,
|
|
234
|
+
className: c(a.scroller, l.scroller, h?.scroller),
|
|
235
|
+
style: { maxHeight: ut },
|
|
236
|
+
onPointerDown: W.onPointerDown,
|
|
237
|
+
onPointerMove: W.onPointerMove,
|
|
238
|
+
onPointerUp: W.onPointerUp,
|
|
239
|
+
onPointerLeave: () => {
|
|
240
|
+
W.onPointerUp(), me(null);
|
|
241
|
+
},
|
|
242
|
+
onMouseMove: Tt,
|
|
243
|
+
onScroll: St,
|
|
244
|
+
children: /* @__PURE__ */ r("div", { className: l.inner, style: { width: Ge }, children: [
|
|
245
|
+
ct && Te.map((e, t) => /* @__PURE__ */ n("div", { className: l.gridline, style: { left: e.left } }, t)),
|
|
246
|
+
Ue && /* @__PURE__ */ n(
|
|
247
|
+
"div",
|
|
248
|
+
{
|
|
249
|
+
className: l.nowLine,
|
|
250
|
+
style: { left: Math.round(g + (b - u) * N) }
|
|
251
|
+
}
|
|
252
|
+
),
|
|
253
|
+
T && !p && /* @__PURE__ */ n("div", { className: l.cursorLine, style: { left: T.left } }),
|
|
254
|
+
q && /* @__PURE__ */ n("div", { className: l.eventLine, style: { left: q.left } }),
|
|
255
|
+
/* @__PURE__ */ r("div", { className: c(l.axis, h?.axis), children: [
|
|
256
|
+
/* @__PURE__ */ n("div", { className: l.axisDivider }),
|
|
257
|
+
/* @__PURE__ */ r("div", { className: l.axisSticky, children: [
|
|
258
|
+
/* @__PURE__ */ n("span", { className: l.axisUtc, children: "UTC" }),
|
|
259
|
+
/* @__PURE__ */ n("span", { className: l.axisViewDate, children: gt || (d.length ? Re(u) : "") })
|
|
260
|
+
] }),
|
|
261
|
+
Te.map((e, t) => /* @__PURE__ */ r("span", { children: [
|
|
262
|
+
/* @__PURE__ */ n("span", { className: l.axisTickLabel, style: { left: e.left }, children: e.label }),
|
|
263
|
+
e.dateLabel && /* @__PURE__ */ n("span", { className: l.axisDateLabel, style: { left: e.left }, children: e.dateLabel }),
|
|
264
|
+
/* @__PURE__ */ n("span", { className: l.axisTickMark, style: { left: e.left } })
|
|
265
|
+
] }, t)),
|
|
266
|
+
Ye.map((e, t) => /* @__PURE__ */ n("span", { className: l.axisMinorMark, style: { left: e } }, t)),
|
|
267
|
+
T && !p && /* @__PURE__ */ n("div", { className: l.axisChip, style: { left: T.chipLeft }, children: T.label }),
|
|
268
|
+
q && /* @__PURE__ */ r(
|
|
269
|
+
"div",
|
|
270
|
+
{
|
|
271
|
+
className: c(l.axisChip, l.axisChipEvent),
|
|
272
|
+
style: { left: q.chipLeft },
|
|
273
|
+
children: [
|
|
274
|
+
"▸ ",
|
|
275
|
+
q.label
|
|
276
|
+
]
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
] }),
|
|
280
|
+
/* @__PURE__ */ r("div", { className: l.lane, style: { height: Y.h }, children: [
|
|
281
|
+
/* @__PURE__ */ n("div", { className: l.axisLine, style: { top: Y.axisY } }),
|
|
282
|
+
d.map((e) => {
|
|
283
|
+
const t = G.get(e.id);
|
|
284
|
+
if (!t) return null;
|
|
285
|
+
const s = S[e.service] || v.body, y = e.end == null, o = It(e, L), f = Le != null && Le >= e.start && Le <= (e.end ?? b), w = vt === e.id, V = L && !o ? 0.25 : 1, ee = String(O(e)), U = z(e), te = S[U] || v.body, X = S[e.service] || v.body, Ce = w ? `0 0 0 3px ${H(s, 55)}, 0 4px 14px rgba(35,32,28,.22)` : L && o ? `0 0 0 3px ${v.hlRing}` : P === e.id ? `0 0 0 3px ${v.selectedRing}` : f ? `0 0 0 3px ${H(s, 30)}` : "none", $ = w ? s : f ? v.stemHot : v.stem, F = {
|
|
286
|
+
onClick: () => {
|
|
287
|
+
W.wasDragSuppressed() || (he(null), Se(P === e.id ? null : e));
|
|
288
|
+
},
|
|
289
|
+
onMouseEnter: (C) => Ct(e, C),
|
|
290
|
+
onMouseLeave: Rt
|
|
291
|
+
};
|
|
292
|
+
return /* @__PURE__ */ r("span", { children: [
|
|
293
|
+
t.showLabel && /* @__PURE__ */ r(R, { children: [
|
|
294
|
+
t.conn && !t.hconn && /* @__PURE__ */ n(
|
|
295
|
+
"div",
|
|
296
|
+
{
|
|
297
|
+
className: l.stem,
|
|
298
|
+
style: {
|
|
299
|
+
left: t.left,
|
|
300
|
+
top: t.connTop,
|
|
301
|
+
height: t.connH,
|
|
302
|
+
background: $
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
),
|
|
306
|
+
t.conn && t.hconn && /* @__PURE__ */ r(R, { children: [
|
|
307
|
+
/* @__PURE__ */ n(
|
|
308
|
+
"div",
|
|
309
|
+
{
|
|
310
|
+
className: l.stem,
|
|
311
|
+
style: {
|
|
312
|
+
left: t.left,
|
|
313
|
+
top: t.connTop,
|
|
314
|
+
height: t.connH,
|
|
315
|
+
background: $
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
),
|
|
319
|
+
/* @__PURE__ */ n(
|
|
320
|
+
"div",
|
|
321
|
+
{
|
|
322
|
+
className: l.elbow,
|
|
323
|
+
style: {
|
|
324
|
+
left: t.hconnLeft,
|
|
325
|
+
top: t.hconnTop,
|
|
326
|
+
width: t.hconnW,
|
|
327
|
+
background: $
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
)
|
|
331
|
+
] }),
|
|
332
|
+
/* @__PURE__ */ n(
|
|
333
|
+
"div",
|
|
334
|
+
{
|
|
335
|
+
...F,
|
|
336
|
+
className: c(l.chip, h?.chip),
|
|
337
|
+
style: {
|
|
338
|
+
left: t.labelX,
|
|
339
|
+
top: t.labelTop,
|
|
340
|
+
opacity: V,
|
|
341
|
+
background: w ? H(s, 7) : L && o ? v.hlWashSoft : void 0,
|
|
342
|
+
borderColor: w ? s : L && o ? v.hlBorder : f ? s : void 0,
|
|
343
|
+
boxShadow: w ? `0 0 0 2px ${H(s, 40)}, 0 4px 12px rgba(35,32,28,.16)` : "0 1px 2px rgba(35,32,28,.06)"
|
|
344
|
+
},
|
|
345
|
+
children: Be ? Be(e, {
|
|
346
|
+
color: s,
|
|
347
|
+
pending: y,
|
|
348
|
+
durationMs: (e.end ?? b) - e.start
|
|
349
|
+
}) : /* @__PURE__ */ r(R, { children: [
|
|
350
|
+
/* @__PURE__ */ r("div", { children: [
|
|
351
|
+
/* @__PURE__ */ n(
|
|
352
|
+
"span",
|
|
353
|
+
{
|
|
354
|
+
className: l.chipBadge,
|
|
355
|
+
style: { background: H(te, 14), color: te },
|
|
356
|
+
children: U
|
|
357
|
+
}
|
|
358
|
+
),
|
|
359
|
+
/* @__PURE__ */ n("span", { className: l.chipArrow, children: " → " }),
|
|
360
|
+
/* @__PURE__ */ n(
|
|
361
|
+
"span",
|
|
362
|
+
{
|
|
363
|
+
className: l.chipBadge,
|
|
364
|
+
style: { background: H(X, 14), color: X },
|
|
365
|
+
children: e.service
|
|
366
|
+
}
|
|
367
|
+
)
|
|
368
|
+
] }),
|
|
369
|
+
/* @__PURE__ */ n("div", { className: l.chipOp, children: /* @__PURE__ */ n(Ut, { text: ee, query: L }) }),
|
|
370
|
+
/* @__PURE__ */ n("div", { className: l.chipTime, children: I(e.start, !0) })
|
|
371
|
+
] })
|
|
372
|
+
}
|
|
373
|
+
)
|
|
374
|
+
] }),
|
|
375
|
+
/* @__PURE__ */ n(
|
|
376
|
+
"div",
|
|
377
|
+
{
|
|
378
|
+
...F,
|
|
379
|
+
className: c(l.bar, y && l.barPending, h?.bar),
|
|
380
|
+
style: {
|
|
381
|
+
left: t.left,
|
|
382
|
+
top: t.barTop,
|
|
383
|
+
width: t.width,
|
|
384
|
+
height: ze,
|
|
385
|
+
background: L && o ? v.hlBarBg : H(s, 22),
|
|
386
|
+
borderColor: s,
|
|
387
|
+
opacity: V,
|
|
388
|
+
boxShadow: Ce
|
|
389
|
+
},
|
|
390
|
+
children: y && /* @__PURE__ */ n(
|
|
391
|
+
"span",
|
|
392
|
+
{
|
|
393
|
+
className: c(a.pulseDot, l.barDot),
|
|
394
|
+
style: { background: s }
|
|
395
|
+
}
|
|
396
|
+
)
|
|
397
|
+
}
|
|
398
|
+
)
|
|
399
|
+
] }, e.id);
|
|
400
|
+
})
|
|
401
|
+
] })
|
|
402
|
+
] })
|
|
403
|
+
}
|
|
404
|
+
) }),
|
|
405
|
+
/* @__PURE__ */ n("div", { className: c(a.footnote, h?.footnote), children: "Click an event to open its details in the side panel · dashed pills are still in flight" })
|
|
406
|
+
] }),
|
|
407
|
+
i && ue && /* @__PURE__ */ n("aside", { className: c(a.aside, l.drawerCustom, h?.drawer), children: ue(i, { close: () => Se(null), pending: D }) }),
|
|
408
|
+
i && !ue && /* @__PURE__ */ r("aside", { className: c(a.aside, h?.drawer), children: [
|
|
409
|
+
/* @__PURE__ */ r("div", { className: l.drawerHead, children: [
|
|
410
|
+
/* @__PURE__ */ r("div", { className: l.drawerHeadRow, children: [
|
|
411
|
+
/* @__PURE__ */ n("span", { className: l.methodBadge, children: i.method || "—" }),
|
|
412
|
+
/* @__PURE__ */ n(
|
|
413
|
+
"span",
|
|
414
|
+
{
|
|
415
|
+
className: c(
|
|
416
|
+
l.statusBadge,
|
|
417
|
+
D && l.statusPending,
|
|
418
|
+
!D && (i.status ?? 0) >= 400 && l.statusError
|
|
419
|
+
),
|
|
420
|
+
children: D ? "pending" : String(i.status ?? "—")
|
|
421
|
+
}
|
|
422
|
+
),
|
|
423
|
+
/* @__PURE__ */ n("span", { className: l.drawerRoute, children: z(i) + " → " + i.service }),
|
|
424
|
+
/* @__PURE__ */ n("div", { className: l.drawerSpacer }),
|
|
425
|
+
/* @__PURE__ */ n(
|
|
426
|
+
"button",
|
|
427
|
+
{
|
|
428
|
+
type: "button",
|
|
429
|
+
className: a.asideClose,
|
|
430
|
+
"aria-label": "Close details",
|
|
431
|
+
onClick: () => Se(null),
|
|
432
|
+
children: "✕"
|
|
433
|
+
}
|
|
434
|
+
)
|
|
435
|
+
] }),
|
|
436
|
+
/* @__PURE__ */ n("div", { className: l.drawerUrl, children: i.url || i.label || i.id }),
|
|
437
|
+
/* @__PURE__ */ n("div", { className: l.drawerRid, children: String(O(i)) }),
|
|
438
|
+
/* @__PURE__ */ n("div", { className: l.drawerXrid, children: i.reqHeaders && i.reqHeaders["x-request-id"] || i.requestId || i.id }),
|
|
439
|
+
/* @__PURE__ */ n("div", { className: l.drawerTiming, children: I(i.start, !0) + (D ? " · in flight" : " → " + I(i.end, !0) + " · " + se(i.end - i.start)) })
|
|
440
|
+
] }),
|
|
441
|
+
/* @__PURE__ */ r("div", { className: l.drawerBody, children: [
|
|
442
|
+
/* @__PURE__ */ n("div", { className: l.drawerSection, children: "Request" }),
|
|
443
|
+
!!Object.keys(i.query || {}).length && /* @__PURE__ */ r(R, { children: [
|
|
444
|
+
/* @__PURE__ */ n("div", { className: a.asideSection, children: "Query parameters" }),
|
|
445
|
+
ke(i.query).map((e) => /* @__PURE__ */ r("div", { className: l.kvRow, children: [
|
|
446
|
+
/* @__PURE__ */ n("span", { className: c(l.kvKey, l.kvKeyQuery), children: e.k }),
|
|
447
|
+
/* @__PURE__ */ n("span", { className: l.kvVal, children: e.v })
|
|
448
|
+
] }, e.k))
|
|
449
|
+
] }),
|
|
450
|
+
/* @__PURE__ */ n("div", { className: a.asideSection, children: "Headers" }),
|
|
451
|
+
ke(i.reqHeaders).map((e) => /* @__PURE__ */ r("div", { className: l.kvRow, children: [
|
|
452
|
+
/* @__PURE__ */ n("span", { className: l.kvKey, children: e.k }),
|
|
453
|
+
/* @__PURE__ */ n("span", { className: l.kvVal, children: e.v })
|
|
454
|
+
] }, e.k)),
|
|
455
|
+
i.reqBody != null && /* @__PURE__ */ r(R, { children: [
|
|
456
|
+
/* @__PURE__ */ n("div", { className: a.asideSection, children: "Body" }),
|
|
457
|
+
/* @__PURE__ */ n("pre", { className: a.asideRaw, children: JSON.stringify(i.reqBody, null, 2) })
|
|
458
|
+
] }),
|
|
459
|
+
/* @__PURE__ */ n("div", { className: l.drawerSection, children: "Response" }),
|
|
460
|
+
D ? /* @__PURE__ */ r("div", { className: l.awaiting, children: [
|
|
461
|
+
/* @__PURE__ */ n("span", { className: c(a.pulseDot, l.awaitingDot) }),
|
|
462
|
+
"Awaiting response…"
|
|
463
|
+
] }) : /* @__PURE__ */ r(R, { children: [
|
|
464
|
+
/* @__PURE__ */ n("div", { className: a.asideSection, children: "Headers" }),
|
|
465
|
+
ke(i.resHeaders).map((e) => /* @__PURE__ */ r("div", { className: l.kvRow, children: [
|
|
466
|
+
/* @__PURE__ */ n("span", { className: l.kvKey, children: e.k }),
|
|
467
|
+
/* @__PURE__ */ n("span", { className: l.kvVal, children: e.v })
|
|
468
|
+
] }, e.k)),
|
|
469
|
+
/* @__PURE__ */ n("div", { className: a.asideSection, children: "Body" }),
|
|
470
|
+
/* @__PURE__ */ n("pre", { className: a.asideRaw, children: i.resBody != null ? JSON.stringify(i.resBody, null, 2) : "(empty)" })
|
|
471
|
+
] })
|
|
472
|
+
] })
|
|
473
|
+
] }),
|
|
474
|
+
(E === "right" || E === "floating") && Q
|
|
475
|
+
] }),
|
|
476
|
+
E === "bottom" && Q,
|
|
477
|
+
p && (() => {
|
|
478
|
+
const e = d.find((s) => s.id === p.id), t = e && de ? de(e, {
|
|
479
|
+
color: S[e.service] || v.body,
|
|
480
|
+
pending: e.end == null,
|
|
481
|
+
durationMs: (e.end ?? b) - e.start
|
|
482
|
+
}) : void 0;
|
|
483
|
+
return de && t == null ? null : /* @__PURE__ */ n(Xt, { x: p.x, y: p.y, className: h?.tooltip, children: t !== void 0 ? t : /* @__PURE__ */ r(R, { children: [
|
|
484
|
+
/* @__PURE__ */ n("div", { className: c(a.tooltipTitle, a.tooltipMono), children: p.rid }),
|
|
485
|
+
/* @__PURE__ */ n("div", { className: a.tooltipLine, style: { marginTop: 4 }, children: p.route }),
|
|
486
|
+
/* @__PURE__ */ n(
|
|
487
|
+
"div",
|
|
488
|
+
{
|
|
489
|
+
className: c(a.tooltipLine, a.tooltipMono),
|
|
490
|
+
style: { marginTop: 2 },
|
|
491
|
+
children: p.label
|
|
492
|
+
}
|
|
493
|
+
),
|
|
494
|
+
/* @__PURE__ */ n("div", { className: a.tooltipLine, style: { marginTop: 4 }, children: p.time }),
|
|
495
|
+
/* @__PURE__ */ n("div", { className: a.tooltipLine, children: p.durLine }),
|
|
496
|
+
p.url && /* @__PURE__ */ n(
|
|
497
|
+
"div",
|
|
498
|
+
{
|
|
499
|
+
className: c(a.tooltipDim, a.tooltipMono),
|
|
500
|
+
style: { marginTop: 4, wordBreak: "break-all", fontSize: "10.5px" },
|
|
501
|
+
children: p.url
|
|
502
|
+
}
|
|
503
|
+
)
|
|
504
|
+
] }) });
|
|
505
|
+
})()
|
|
506
|
+
] });
|
|
507
|
+
}
|
|
508
|
+
);
|
|
509
|
+
export {
|
|
510
|
+
an as TraceTimeline
|
|
511
|
+
};
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
const r = "crk-scroller-kwWVy", a = "crk-inner-vJ0BK", c = "crk-gridline-pcX-9", e = "crk-nowLine-05lmp", i = "crk-cursorLine-k7KZo", s = "crk-eventLine-znElH", t = "crk-axis--LqeF", n = "crk-axisDivider-gBKss", o = "crk-axisSticky-J-rsF", k = "crk-axisUtc-ySg72", d = "crk-axisViewDate-oRqHL", w = "crk-axisTickLabel-9V7QB", x = "crk-axisDateLabel-QPPf7", p = "crk-axisTickMark-HGAZI", l = "crk-axisMinorMark-LmQdS", g = "crk-axisChip-Xr9r0", h = "crk-axisChipEvent-K9r-4", u = "crk-lane-hvtL1", v = "crk-axisLine-ZRK0p", L = "crk-bar-pqjsX", b = "crk-barPending-NsYu7", m = "crk-barDot-ZtYdm", y = "crk-stem-24Ud2", D = "crk-elbow-nQxQZ", B = "crk-chip-vC8yf", R = "crk-chipArrow-pyTpt", T = "crk-chipBadge-Tz11H", S = "crk-chipOp-qkIIM", X = "crk-chipTime-IoXbi", C = "crk-drawerCustom-w5gWa", K = "crk-drawerHead-mfyc3", H = "crk-drawerHeadRow-w-lfX", M = "crk-methodBadge-lfL4x", U = "crk-statusBadge-XiUl9", E = "crk-statusPending-Yg9At", P = "crk-statusError-G7XH8", Q = "crk-drawerRoute-L-hK0", V = "crk-drawerSpacer-f6nIh", f = "crk-drawerUrl-ajRgO", O = "crk-drawerRid-UsUb1", I = "crk-drawerXrid-JEUOj", Z = "crk-drawerTiming-FCpcS", q = "crk-drawerBody-Cx5-E", A = "crk-drawerSection-Zjpm1", j = "crk-kvRow-DXfXI", F = "crk-kvKey-MmSqV", J = "crk-kvKeyQuery-0hpds", Y = "crk-kvVal-PlEQT", z = "crk-awaiting-FNO2u", G = "crk-awaitingDot-b4OtX", N = {
|
|
2
|
+
scroller: r,
|
|
3
|
+
inner: a,
|
|
4
|
+
gridline: c,
|
|
5
|
+
nowLine: e,
|
|
6
|
+
cursorLine: i,
|
|
7
|
+
eventLine: s,
|
|
8
|
+
axis: t,
|
|
9
|
+
axisDivider: n,
|
|
10
|
+
axisSticky: o,
|
|
11
|
+
axisUtc: k,
|
|
12
|
+
axisViewDate: d,
|
|
13
|
+
axisTickLabel: w,
|
|
14
|
+
axisDateLabel: x,
|
|
15
|
+
axisTickMark: p,
|
|
16
|
+
axisMinorMark: l,
|
|
17
|
+
axisChip: g,
|
|
18
|
+
axisChipEvent: h,
|
|
19
|
+
lane: u,
|
|
20
|
+
axisLine: v,
|
|
21
|
+
bar: L,
|
|
22
|
+
barPending: b,
|
|
23
|
+
barDot: m,
|
|
24
|
+
stem: y,
|
|
25
|
+
elbow: D,
|
|
26
|
+
chip: B,
|
|
27
|
+
chipArrow: R,
|
|
28
|
+
chipBadge: T,
|
|
29
|
+
chipOp: S,
|
|
30
|
+
chipTime: X,
|
|
31
|
+
drawerCustom: C,
|
|
32
|
+
drawerHead: K,
|
|
33
|
+
drawerHeadRow: H,
|
|
34
|
+
methodBadge: M,
|
|
35
|
+
statusBadge: U,
|
|
36
|
+
statusPending: E,
|
|
37
|
+
statusError: P,
|
|
38
|
+
drawerRoute: Q,
|
|
39
|
+
drawerSpacer: V,
|
|
40
|
+
drawerUrl: f,
|
|
41
|
+
drawerRid: O,
|
|
42
|
+
drawerXrid: I,
|
|
43
|
+
drawerTiming: Z,
|
|
44
|
+
drawerBody: q,
|
|
45
|
+
drawerSection: A,
|
|
46
|
+
kvRow: j,
|
|
47
|
+
kvKey: F,
|
|
48
|
+
kvKeyQuery: J,
|
|
49
|
+
kvVal: Y,
|
|
50
|
+
awaiting: z,
|
|
51
|
+
awaitingDot: G
|
|
52
|
+
};
|
|
53
|
+
export {
|
|
54
|
+
z as awaiting,
|
|
55
|
+
G as awaitingDot,
|
|
56
|
+
t as axis,
|
|
57
|
+
g as axisChip,
|
|
58
|
+
h as axisChipEvent,
|
|
59
|
+
x as axisDateLabel,
|
|
60
|
+
n as axisDivider,
|
|
61
|
+
v as axisLine,
|
|
62
|
+
l as axisMinorMark,
|
|
63
|
+
o as axisSticky,
|
|
64
|
+
w as axisTickLabel,
|
|
65
|
+
p as axisTickMark,
|
|
66
|
+
k as axisUtc,
|
|
67
|
+
d as axisViewDate,
|
|
68
|
+
L as bar,
|
|
69
|
+
m as barDot,
|
|
70
|
+
b as barPending,
|
|
71
|
+
B as chip,
|
|
72
|
+
R as chipArrow,
|
|
73
|
+
T as chipBadge,
|
|
74
|
+
S as chipOp,
|
|
75
|
+
X as chipTime,
|
|
76
|
+
i as cursorLine,
|
|
77
|
+
N as default,
|
|
78
|
+
q as drawerBody,
|
|
79
|
+
C as drawerCustom,
|
|
80
|
+
K as drawerHead,
|
|
81
|
+
H as drawerHeadRow,
|
|
82
|
+
O as drawerRid,
|
|
83
|
+
Q as drawerRoute,
|
|
84
|
+
A as drawerSection,
|
|
85
|
+
V as drawerSpacer,
|
|
86
|
+
Z as drawerTiming,
|
|
87
|
+
f as drawerUrl,
|
|
88
|
+
I as drawerXrid,
|
|
89
|
+
D as elbow,
|
|
90
|
+
s as eventLine,
|
|
91
|
+
c as gridline,
|
|
92
|
+
a as inner,
|
|
93
|
+
F as kvKey,
|
|
94
|
+
J as kvKeyQuery,
|
|
95
|
+
j as kvRow,
|
|
96
|
+
Y as kvVal,
|
|
97
|
+
u as lane,
|
|
98
|
+
M as methodBadge,
|
|
99
|
+
e as nowLine,
|
|
100
|
+
r as scroller,
|
|
101
|
+
U as statusBadge,
|
|
102
|
+
P as statusError,
|
|
103
|
+
E as statusPending,
|
|
104
|
+
y as stem
|
|
105
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { TraceTimelineEvent } from './TraceTimeline';
|
|
2
|
+
import { HistoryTimelineEvent } from './HistoryTimeline';
|
|
3
|
+
import { GanttTimelineTask } from './GanttTimeline';
|
|
4
|
+
export declare const TRACE_SERVICES: string[];
|
|
5
|
+
export declare function makeTraceEvents(mid: string, t0: number, r: () => number): TraceTimelineEvent[];
|
|
6
|
+
export interface DemoManifest {
|
|
7
|
+
id: string;
|
|
8
|
+
title: string;
|
|
9
|
+
events: TraceTimelineEvent[];
|
|
10
|
+
}
|
|
11
|
+
export declare function sampleManifests(): DemoManifest[];
|
|
12
|
+
export interface SimStep {
|
|
13
|
+
at: number;
|
|
14
|
+
ev: Record<string, unknown>;
|
|
15
|
+
}
|
|
16
|
+
export declare function manifestSimScript(): {
|
|
17
|
+
mid: string;
|
|
18
|
+
title: string;
|
|
19
|
+
script: SimStep[];
|
|
20
|
+
};
|
|
21
|
+
export interface DemoSubject {
|
|
22
|
+
id: string;
|
|
23
|
+
name: string;
|
|
24
|
+
events: HistoryTimelineEvent[];
|
|
25
|
+
}
|
|
26
|
+
export declare function sampleSubjects(): DemoSubject[];
|
|
27
|
+
export declare function subjectSimScript(subject: string): {
|
|
28
|
+
script: SimStep[];
|
|
29
|
+
};
|
|
30
|
+
export declare function sampleTasks(): GanttTimelineTask[];
|
|
31
|
+
export declare function tasksSimScript(): {
|
|
32
|
+
script: SimStep[];
|
|
33
|
+
};
|
|
34
|
+
export interface DemoSim {
|
|
35
|
+
playing(): boolean;
|
|
36
|
+
done(): boolean;
|
|
37
|
+
play(): void;
|
|
38
|
+
pause(): void;
|
|
39
|
+
}
|
|
40
|
+
export declare function makeSim(script: SimStep[], push: (ev: Record<string, unknown>) => void,
|
|
41
|
+
/** Called when the script drains on its own (keep play/pause UI in sync). */
|
|
42
|
+
onDone?: () => void): DemoSim;
|