@overdoser/react-toolkit 0.11.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -2
- package/CHANGELOG.md +94 -0
- package/components/Draggable/Draggable.d.ts +1 -1
- package/components/Draggable/Draggable.js +94 -84
- package/components/Timeline/GanttTimeline.d.ts +10 -0
- package/components/Timeline/GanttTimeline.js +193 -189
- package/components/Timeline/HistoryTimeline.d.ts +10 -0
- package/components/Timeline/HistoryTimeline.js +197 -193
- package/components/Timeline/Timeline.module.scss.js +114 -100
- package/components/Timeline/TimelineShared.d.ts +23 -2
- package/components/Timeline/TimelineShared.js +200 -127
- package/components/Timeline/TraceEventDetails.d.ts +92 -0
- package/components/Timeline/TraceEventDetails.js +181 -0
- package/components/Timeline/TraceTimeline.d.ts +34 -47
- package/components/Timeline/TraceTimeline.js +631 -612
- package/components/Timeline/TraceTimeline.module.scss.js +162 -144
- package/components/Timeline/demoData.d.ts +14 -0
- package/components/Timeline/index.d.ts +6 -1
- package/components/Timeline/timelineCore.d.ts +3 -2
- package/components/Timeline/timelineCore.js +41 -36
- package/components/Timeline/traceEvent.d.ts +128 -0
- package/components/Timeline/traceEvent.js +64 -0
- package/components/Timeline/useTimeline.d.ts +11 -0
- package/components/Timeline/useTimeline.js +36 -32
- package/index.css +1 -1
- package/index.d.ts +2 -2
- package/index.js +61 -55
- package/index.layered.css +1 -1
- package/llms.txt +36 -5
- package/manifest.json +653 -166
- package/package.json +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
scroller:
|
|
1
|
+
const o = "crk-scroller-kwWVy", c = "crk-inner-vJ0BK", r = "crk-gridline-pcX-9", e = "crk-nowLine-05lmp", a = "crk-cursorLine-k7KZo", t = "crk-eventLine-znElH", s = "crk-axis--LqeF", i = "crk-axisDivider-gBKss", n = "crk-axisSticky-J-rsF", l = "crk-axisUtc-ySg72", d = "crk-axisViewDate-oRqHL", k = "crk-axisViewTime-bL50a", g = "crk-axisTickLabel-9V7QB", p = "crk-axisDateLabel-QPPf7", y = "crk-axisTickMark-HGAZI", w = "crk-axisSubLabel-mmUpt", h = "crk-axisMinorMark-LmQdS", x = "crk-axisMinorMedium-yyNB-", b = "crk-axisChip-Xr9r0", u = "crk-axisChipEvent-K9r-4", L = "crk-lane-hvtL1", m = "crk-axisLine-ZRK0p", P = "crk-bar-pqjsX", v = "crk-barPending-NsYu7", f = "crk-barDot-ZtYdm", S = "crk-stem-24Ud2", C = "crk-elbow-nQxQZ", T = "crk-chip-vC8yf", B = "crk-chipArrow-pyTpt", E = "crk-chipBadge-Tz11H", H = "crk-chipOp-qkIIM", M = "crk-chipTime-IoXbi", D = "crk-drawerCustom-w5gWa", F = "crk-drawerHead-mfyc3", V = "crk-drawerHeadRow-w-lfX", R = "crk-methodBadge-lfL4x", A = "crk-statusBadge-XiUl9", K = "crk-statusPending-Yg9At", I = "crk-statusError-G7XH8", Q = "crk-statusWarn-iYFhY", G = "crk-drawerRoute-L-hK0", N = "crk-drawerSpacer-f6nIh", X = "crk-fieldList-AvAgH", O = "crk-field-4QFFP", U = "crk-headFields-eHFIf", Z = "crk-bodyHead-IAsVD", q = "crk-fieldLabel-GVRma", J = "crk-fieldValue-OzPQ8", W = "crk-fieldMono-pdJaC", z = "crk-fieldPre-2nolU", Y = "crk-emptyNote-VTNmM", j = "crk-drawerBody-Cx5-E", _ = "crk-drawerSection-Zjpm1", $ = "crk-kvRow-DXfXI", oo = "crk-kvKey-MmSqV", co = "crk-kvKeyQuery-0hpds", ro = "crk-kvVal-PlEQT", eo = "crk-awaiting-FNO2u", ao = "crk-awaitingDot-b4OtX", to = "crk-dockCol-4dgEp", so = "crk-dockColResizer-qUAce", io = "crk-cardFlushRight-QGTEx", no = "crk-dockAside-Q-I1l", lo = "crk-dockHead-kyJbl", ko = "crk-dockTitle-aZfap", go = "crk-dockCount-sTZG3", po = "crk-dockScroll-EbMO5", yo = "crk-dockEmpty-4I13b", wo = "crk-bodyLabel-QeGYK", ho = "crk-payloadCopy-5FM-J", xo = "crk-logEntry-eASJr", bo = "crk-copyStop-aE-Th", uo = "crk-logBody-X2Ftb", Lo = "crk-logEntrySelected-AdHlH", mo = "crk-logEntryFlash-26ElD", Po = "crk-logTop-48t09", vo = "crk-logNum-1-eb7", fo = "crk-badgeSm-vw04n", So = "crk-logPair-i-P-t", Co = "crk-logClock-mrTdy", To = "crk-logOp-qfkTp", Bo = "crk-logPath-eHd2Z", Eo = "crk-logMessage-t7B7v", Ho = "crk-logFields-newk5", Mo = "crk-logPayloadHead-jKUKx", Do = "crk-logPayloadLabel-wteWa", Fo = "crk-logPre-8h-ke", Vo = "crk-rail-IIJaP", Ro = "crk-railBtn-WNtG7", Ao = "crk-railBtnActive-HnV74", Ko = "crk-railGlyphDetails-h8Ip-", Io = "crk-railGlyphLog-auInm", Qo = {
|
|
2
|
+
scroller: o,
|
|
3
3
|
inner: c,
|
|
4
|
-
gridline:
|
|
5
|
-
nowLine:
|
|
6
|
-
cursorLine:
|
|
4
|
+
gridline: r,
|
|
5
|
+
nowLine: e,
|
|
6
|
+
cursorLine: a,
|
|
7
7
|
eventLine: t,
|
|
8
|
-
axis:
|
|
9
|
-
axisDivider:
|
|
8
|
+
axis: s,
|
|
9
|
+
axisDivider: i,
|
|
10
10
|
axisSticky: n,
|
|
11
11
|
axisUtc: l,
|
|
12
12
|
axisViewDate: d,
|
|
@@ -15,85 +15,94 @@ const r = "crk-scroller-kwWVy", c = "crk-inner-vJ0BK", o = "crk-gridline-pcX-9",
|
|
|
15
15
|
axisDateLabel: p,
|
|
16
16
|
axisTickMark: y,
|
|
17
17
|
axisSubLabel: w,
|
|
18
|
-
axisMinorMark:
|
|
19
|
-
axisMinorMedium:
|
|
20
|
-
axisChip:
|
|
21
|
-
axisChipEvent:
|
|
22
|
-
lane:
|
|
23
|
-
axisLine:
|
|
24
|
-
bar:
|
|
25
|
-
barPending:
|
|
26
|
-
barDot:
|
|
27
|
-
stem:
|
|
28
|
-
elbow:
|
|
29
|
-
chip:
|
|
30
|
-
chipArrow:
|
|
31
|
-
chipBadge:
|
|
32
|
-
chipOp:
|
|
18
|
+
axisMinorMark: h,
|
|
19
|
+
axisMinorMedium: x,
|
|
20
|
+
axisChip: b,
|
|
21
|
+
axisChipEvent: u,
|
|
22
|
+
lane: L,
|
|
23
|
+
axisLine: m,
|
|
24
|
+
bar: P,
|
|
25
|
+
barPending: v,
|
|
26
|
+
barDot: f,
|
|
27
|
+
stem: S,
|
|
28
|
+
elbow: C,
|
|
29
|
+
chip: T,
|
|
30
|
+
chipArrow: B,
|
|
31
|
+
chipBadge: E,
|
|
32
|
+
chipOp: H,
|
|
33
33
|
chipTime: M,
|
|
34
|
-
drawerCustom:
|
|
35
|
-
drawerHead:
|
|
36
|
-
drawerHeadRow:
|
|
37
|
-
methodBadge:
|
|
38
|
-
statusBadge:
|
|
39
|
-
statusPending:
|
|
40
|
-
statusError:
|
|
34
|
+
drawerCustom: D,
|
|
35
|
+
drawerHead: F,
|
|
36
|
+
drawerHeadRow: V,
|
|
37
|
+
methodBadge: R,
|
|
38
|
+
statusBadge: A,
|
|
39
|
+
statusPending: K,
|
|
40
|
+
statusError: I,
|
|
41
|
+
statusWarn: Q,
|
|
41
42
|
drawerRoute: G,
|
|
42
|
-
drawerSpacer:
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
43
|
+
drawerSpacer: N,
|
|
44
|
+
fieldList: X,
|
|
45
|
+
field: O,
|
|
46
|
+
headFields: U,
|
|
47
|
+
bodyHead: Z,
|
|
48
|
+
fieldLabel: q,
|
|
49
|
+
fieldValue: J,
|
|
50
|
+
fieldMono: W,
|
|
51
|
+
fieldPre: z,
|
|
52
|
+
emptyNote: Y,
|
|
53
|
+
drawerBody: j,
|
|
54
|
+
drawerSection: _,
|
|
55
|
+
kvRow: $,
|
|
56
|
+
kvKey: oo,
|
|
57
|
+
kvKeyQuery: co,
|
|
58
|
+
kvVal: ro,
|
|
59
|
+
awaiting: eo,
|
|
60
|
+
awaitingDot: ao,
|
|
61
|
+
dockCol: to,
|
|
62
|
+
dockColResizer: so,
|
|
63
|
+
cardFlushRight: io,
|
|
64
|
+
dockAside: no,
|
|
65
|
+
dockHead: lo,
|
|
66
|
+
dockTitle: ko,
|
|
67
|
+
dockCount: go,
|
|
68
|
+
dockScroll: po,
|
|
69
|
+
dockEmpty: yo,
|
|
70
|
+
bodyLabel: wo,
|
|
71
|
+
payloadCopy: ho,
|
|
72
|
+
logEntry: xo,
|
|
73
|
+
copyStop: bo,
|
|
74
|
+
logBody: uo,
|
|
75
|
+
logEntrySelected: Lo,
|
|
76
|
+
logEntryFlash: mo,
|
|
77
|
+
logTop: Po,
|
|
78
|
+
logNum: vo,
|
|
79
|
+
badgeSm: fo,
|
|
80
|
+
logPair: So,
|
|
81
|
+
logClock: Co,
|
|
82
|
+
logOp: To,
|
|
83
|
+
logPath: Bo,
|
|
84
|
+
logMessage: Eo,
|
|
85
|
+
logFields: Ho,
|
|
86
|
+
logPayloadHead: Mo,
|
|
87
|
+
logPayloadLabel: Do,
|
|
88
|
+
logPre: Fo,
|
|
89
|
+
rail: Vo,
|
|
90
|
+
railBtn: Ro,
|
|
91
|
+
railBtnActive: Ao,
|
|
92
|
+
railGlyphDetails: Ko,
|
|
93
|
+
railGlyphLog: Io
|
|
85
94
|
};
|
|
86
95
|
export {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
eo as awaiting,
|
|
97
|
+
ao as awaitingDot,
|
|
98
|
+
s as axis,
|
|
99
|
+
b as axisChip,
|
|
100
|
+
u as axisChipEvent,
|
|
92
101
|
p as axisDateLabel,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
102
|
+
i as axisDivider,
|
|
103
|
+
m as axisLine,
|
|
104
|
+
h as axisMinorMark,
|
|
105
|
+
x as axisMinorMedium,
|
|
97
106
|
n as axisSticky,
|
|
98
107
|
w as axisSubLabel,
|
|
99
108
|
g as axisTickLabel,
|
|
@@ -101,71 +110,80 @@ export {
|
|
|
101
110
|
l as axisUtc,
|
|
102
111
|
d as axisViewDate,
|
|
103
112
|
k as axisViewTime,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
113
|
+
fo as badgeSm,
|
|
114
|
+
P as bar,
|
|
115
|
+
f as barDot,
|
|
116
|
+
v as barPending,
|
|
117
|
+
Z as bodyHead,
|
|
118
|
+
wo as bodyLabel,
|
|
119
|
+
io as cardFlushRight,
|
|
120
|
+
T as chip,
|
|
121
|
+
B as chipArrow,
|
|
122
|
+
E as chipBadge,
|
|
123
|
+
H as chipOp,
|
|
114
124
|
M as chipTime,
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
125
|
+
bo as copyStop,
|
|
126
|
+
a as cursorLine,
|
|
127
|
+
Qo as default,
|
|
128
|
+
no as dockAside,
|
|
129
|
+
to as dockCol,
|
|
130
|
+
so as dockColResizer,
|
|
131
|
+
go as dockCount,
|
|
132
|
+
yo as dockEmpty,
|
|
133
|
+
lo as dockHead,
|
|
134
|
+
po as dockScroll,
|
|
135
|
+
ko as dockTitle,
|
|
136
|
+
j as drawerBody,
|
|
137
|
+
D as drawerCustom,
|
|
138
|
+
F as drawerHead,
|
|
139
|
+
V as drawerHeadRow,
|
|
129
140
|
G as drawerRoute,
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
F as drawerXrid,
|
|
135
|
-
B as elbow,
|
|
141
|
+
_ as drawerSection,
|
|
142
|
+
N as drawerSpacer,
|
|
143
|
+
C as elbow,
|
|
144
|
+
Y as emptyNote,
|
|
136
145
|
t as eventLine,
|
|
137
|
-
|
|
146
|
+
O as field,
|
|
147
|
+
q as fieldLabel,
|
|
148
|
+
X as fieldList,
|
|
149
|
+
W as fieldMono,
|
|
150
|
+
z as fieldPre,
|
|
151
|
+
J as fieldValue,
|
|
152
|
+
r as gridline,
|
|
153
|
+
U as headFields,
|
|
138
154
|
c as inner,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
I as
|
|
170
|
-
|
|
155
|
+
oo as kvKey,
|
|
156
|
+
co as kvKeyQuery,
|
|
157
|
+
$ as kvRow,
|
|
158
|
+
ro as kvVal,
|
|
159
|
+
L as lane,
|
|
160
|
+
uo as logBody,
|
|
161
|
+
Co as logClock,
|
|
162
|
+
xo as logEntry,
|
|
163
|
+
mo as logEntryFlash,
|
|
164
|
+
Lo as logEntrySelected,
|
|
165
|
+
Ho as logFields,
|
|
166
|
+
Eo as logMessage,
|
|
167
|
+
vo as logNum,
|
|
168
|
+
To as logOp,
|
|
169
|
+
So as logPair,
|
|
170
|
+
Bo as logPath,
|
|
171
|
+
Mo as logPayloadHead,
|
|
172
|
+
Do as logPayloadLabel,
|
|
173
|
+
Fo as logPre,
|
|
174
|
+
Po as logTop,
|
|
175
|
+
R as methodBadge,
|
|
176
|
+
e as nowLine,
|
|
177
|
+
ho as payloadCopy,
|
|
178
|
+
Vo as rail,
|
|
179
|
+
Ro as railBtn,
|
|
180
|
+
Ao as railBtnActive,
|
|
181
|
+
Ko as railGlyphDetails,
|
|
182
|
+
Io as railGlyphLog,
|
|
183
|
+
o as scroller,
|
|
184
|
+
A as statusBadge,
|
|
185
|
+
I as statusError,
|
|
186
|
+
K as statusPending,
|
|
187
|
+
Q as statusWarn,
|
|
188
|
+
S as stem
|
|
171
189
|
};
|
|
@@ -9,6 +9,20 @@ export interface DemoManifest {
|
|
|
9
9
|
events: TraceTimelineEvent[];
|
|
10
10
|
}
|
|
11
11
|
export declare function sampleManifests(): DemoManifest[];
|
|
12
|
+
export interface DemoTrace {
|
|
13
|
+
title: string;
|
|
14
|
+
services: string[];
|
|
15
|
+
events: TraceTimelineEvent[];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Order lifecycle: no HTTP anywhere — every entry is a domain event carrying
|
|
19
|
+
* a message, and some a payload, a level or extra labeled fields.
|
|
20
|
+
*/
|
|
21
|
+
export declare function plainEventTrace(): DemoTrace;
|
|
22
|
+
/** The minimal case: events that carry nothing but a `payload`. */
|
|
23
|
+
export declare function payloadOnlyTrace(): DemoTrace;
|
|
24
|
+
/** Requests and domain events on the same band. */
|
|
25
|
+
export declare function mixedTrace(): DemoTrace;
|
|
12
26
|
export interface SimStep {
|
|
13
27
|
at: number;
|
|
14
28
|
ev: Record<string, unknown>;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export type { TimelineSummaryPlacement } from './TimelineShared';
|
|
2
|
+
export type { TimelineWheelZoom } from './useTimeline';
|
|
2
3
|
export { TraceTimeline } from './TraceTimeline';
|
|
3
|
-
export type { TraceTimelineProps, TraceTimelineEvent, TraceTimelineClasses, TraceTimelineDock, TraceTimelineItemContext, } from './TraceTimeline';
|
|
4
|
+
export type { TraceTimelineProps, TraceTimelineEvent, TraceTimelineField, TraceTimelineLevel, TraceTimelineClasses, TraceTimelineDock, TraceTimelineItemContext, } from './TraceTimeline';
|
|
5
|
+
export { TraceEventDetails } from './TraceEventDetails';
|
|
6
|
+
export type { TraceEventDetailsProps, TraceEventDetailsClasses } from './TraceEventDetails';
|
|
7
|
+
export { isRequestEvent, badgeOf, extraFieldsOf } from './traceEvent';
|
|
8
|
+
export type { TraceBadgeTone } from './traceEvent';
|
|
4
9
|
export { HistoryTimeline } from './HistoryTimeline';
|
|
5
10
|
export type { HistoryTimelineProps, HistoryTimelineEvent, HistoryTimelineClasses, HistoryTimelineOrientation, HistoryTimelineSpacing, HistoryTimelineItemContext, } from './HistoryTimeline';
|
|
6
11
|
export { GanttTimeline } from './GanttTimeline';
|
|
@@ -62,9 +62,10 @@ export interface HighlightPart {
|
|
|
62
62
|
export declare function highlightParts(text: unknown, q: string | undefined): HighlightPart[];
|
|
63
63
|
/**
|
|
64
64
|
* Keyword match: case-insensitive AND over whitespace-separated tokens against
|
|
65
|
-
* the JSON serialization of the event.
|
|
65
|
+
* the JSON serialization of the event. Top-level keys in `omit` are excluded
|
|
66
|
+
* from the haystack (hidden plumbing fields shouldn't attract highlights).
|
|
66
67
|
*/
|
|
67
|
-
export declare function eventMatches(ev: unknown, q: string | undefined): boolean;
|
|
68
|
+
export declare function eventMatches(ev: unknown, q: string | undefined, omit?: readonly string[]): boolean;
|
|
68
69
|
/**
|
|
69
70
|
* Fuzzy score for pickers: each token scores by substring position (best) or
|
|
70
71
|
* character subsequence (weak); a token that matches neither zeroes the score.
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
const O = 1e3, U = 6e4, N = 36e5, S = 864e5,
|
|
1
|
+
const O = 1e3, U = 6e4, N = 36e5, S = 864e5, l = (t) => String(t).padStart(2, "0"), A = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
2
2
|
function u(t, e) {
|
|
3
3
|
const n = new Date(t);
|
|
4
|
-
return
|
|
4
|
+
return l(n.getHours()) + ":" + l(n.getMinutes()) + ":" + l(n.getSeconds()) + (e ? "." + String(n.getMilliseconds()).padStart(3, "0") : "");
|
|
5
5
|
}
|
|
6
6
|
function s(t) {
|
|
7
7
|
const e = new Date(t);
|
|
8
8
|
return A[e.getMonth()] + " " + e.getDate();
|
|
9
9
|
}
|
|
10
|
-
function
|
|
10
|
+
function d(t) {
|
|
11
11
|
const e = new Date(t).getFullYear(), n = e !== (/* @__PURE__ */ new Date()).getFullYear();
|
|
12
12
|
return n && Date.now() - t > 2 * 365 * 864e5 ? s(t) + " " + e : s(t) + (n ? " " + e : "") + " · " + u(t);
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function h(t, e) {
|
|
15
15
|
const n = new Date(t);
|
|
16
|
-
return
|
|
16
|
+
return l(n.getUTCHours()) + ":" + l(n.getUTCMinutes()) + ":" + l(n.getUTCSeconds()) + (e ? "." + String(n.getUTCMilliseconds()).padStart(3, "0") : "");
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function Y(t) {
|
|
19
19
|
const e = new Date(t);
|
|
20
|
-
return e.getUTCFullYear() + "-" +
|
|
20
|
+
return e.getUTCFullYear() + "-" + l(e.getUTCMonth() + 1) + "-" + l(e.getUTCDate());
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
return
|
|
22
|
+
function g(t, e) {
|
|
23
|
+
return Y(t) + "T" + h(t, e) + "Z";
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function C(t) {
|
|
26
26
|
return t == null ? "" : t < 1e3 ? Math.round(t) + "ms" : t < 6e4 ? (t / 1e3).toFixed(t < 10 * 1e3 ? 1 : 0) + "s" : t < 36e5 ? Math.floor(t / 6e4) + "m " + Math.round(t % 6e4 / 1e3) + "s" : t < 2 * 864e5 ? Math.floor(t / 36e5) + "h " + Math.round(t % 36e5 / 6e4) + "m" : t < 365 * 864e5 ? (t / 864e5).toFixed(1) + "d" : (t / (365.25 * 864e5)).toFixed(t < 3650 * 864e5 ? 1 : 0) + "y";
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const D = [
|
|
29
29
|
1,
|
|
30
30
|
2,
|
|
31
31
|
5,
|
|
@@ -112,42 +112,47 @@ const l = [
|
|
|
112
112
|
[91311 * 864e5, [5, 0]],
|
|
113
113
|
[182625 * 864e5, [5, 0]]
|
|
114
114
|
]);
|
|
115
|
-
function
|
|
115
|
+
function M(t) {
|
|
116
116
|
const e = E.get(t) || [4, 0];
|
|
117
117
|
return { parts: e[0], medium: e[1] };
|
|
118
118
|
}
|
|
119
|
-
function T(t, e, n,
|
|
120
|
-
|
|
121
|
-
const
|
|
119
|
+
function T(t, e, n, o) {
|
|
120
|
+
o = o || 88;
|
|
121
|
+
const a = Math.max(1, e - t), r = D.find((f) => f / a * n >= o) || D[D.length - 1], c = [];
|
|
122
122
|
let i = Math.ceil(t / r) * r;
|
|
123
123
|
for (; i <= e; i += r)
|
|
124
|
-
|
|
125
|
-
return { step: r, list:
|
|
124
|
+
c.push({ t: i, label: r >= 864e5 ? s(i) : u(i, r < 1e3) });
|
|
125
|
+
return { step: r, list: c };
|
|
126
126
|
}
|
|
127
127
|
function I(t, e) {
|
|
128
128
|
const n = String(t ?? "");
|
|
129
129
|
if (e = (e || "").trim(), !e) return [{ t: n, hit: !1 }];
|
|
130
|
-
const
|
|
131
|
-
let
|
|
130
|
+
const o = e.toLowerCase(), a = n.toLowerCase(), r = [];
|
|
131
|
+
let c = 0;
|
|
132
132
|
for (; ; ) {
|
|
133
|
-
const i =
|
|
133
|
+
const i = a.indexOf(o, c);
|
|
134
134
|
if (i < 0) {
|
|
135
|
-
|
|
135
|
+
c < n.length && r.push({ t: n.slice(c), hit: !1 });
|
|
136
136
|
break;
|
|
137
137
|
}
|
|
138
|
-
i >
|
|
138
|
+
i > c && r.push({ t: n.slice(c, i), hit: !1 }), r.push({ t: n.slice(i, i + e.length), hit: !0 }), c = i + e.length;
|
|
139
139
|
}
|
|
140
140
|
return r.length ? r : [{ t: n, hit: !1 }];
|
|
141
141
|
}
|
|
142
|
-
function k(t, e) {
|
|
142
|
+
function k(t, e, n) {
|
|
143
143
|
if (e = (e || "").trim(), !e) return !0;
|
|
144
|
-
|
|
144
|
+
if (n?.length && t !== null && typeof t == "object" && !Array.isArray(t)) {
|
|
145
|
+
const a = { ...t };
|
|
146
|
+
for (const r of n) delete a[r];
|
|
147
|
+
t = a;
|
|
148
|
+
}
|
|
149
|
+
let o;
|
|
145
150
|
try {
|
|
146
|
-
|
|
151
|
+
o = JSON.stringify(t).toLowerCase();
|
|
147
152
|
} catch {
|
|
148
|
-
|
|
153
|
+
o = String(t).toLowerCase();
|
|
149
154
|
}
|
|
150
|
-
return e.toLowerCase().split(/\s+/).filter(Boolean).every((a) =>
|
|
155
|
+
return e.toLowerCase().split(/\s+/).filter(Boolean).every((a) => o.includes(a));
|
|
151
156
|
}
|
|
152
157
|
const H = [
|
|
153
158
|
"var(--crk-timeline-1, #0e7568)",
|
|
@@ -160,7 +165,7 @@ const H = [
|
|
|
160
165
|
function R(t, e) {
|
|
161
166
|
return `color-mix(in srgb, ${t} ${e}%, white)`;
|
|
162
167
|
}
|
|
163
|
-
const
|
|
168
|
+
const b = {
|
|
164
169
|
body: "var(--crk-timeline-body, #3b352f)",
|
|
165
170
|
stem: "var(--crk-timeline-stem, #c9c1b5)",
|
|
166
171
|
stemHot: "var(--crk-timeline-stem-hot, #8a8175)",
|
|
@@ -175,19 +180,19 @@ export {
|
|
|
175
180
|
N as HOUR,
|
|
176
181
|
U as MINUTE,
|
|
177
182
|
O as SECOND,
|
|
178
|
-
|
|
183
|
+
D as TICK_STEPS,
|
|
179
184
|
H as TIMELINE_PALETTE_VARS,
|
|
180
|
-
|
|
185
|
+
b as TL_COLORS,
|
|
181
186
|
k as eventMatches,
|
|
182
187
|
u as fmtClock,
|
|
183
|
-
|
|
188
|
+
h as fmtClockUTC,
|
|
184
189
|
s as fmtDate,
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
190
|
+
Y as fmtDateISO,
|
|
191
|
+
d as fmtDateTime,
|
|
192
|
+
C as fmtDur,
|
|
193
|
+
g as fmtISO,
|
|
189
194
|
I as highlightParts,
|
|
190
|
-
|
|
195
|
+
M as tickSubdiv,
|
|
191
196
|
T as ticks,
|
|
192
197
|
R as tint
|
|
193
198
|
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trace event model shared by TraceTimeline and TraceEventDetails, plus
|
|
3
|
+
* the pure helpers that decide how much of an event is renderable. Kept apart
|
|
4
|
+
* from both components so neither has to import the other.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Severity/outcome of a non-request event. Colors the detail-panel and
|
|
8
|
+
* full-log badge the way `status` does for requests.
|
|
9
|
+
*/
|
|
10
|
+
export type TraceTimelineLevel = 'debug' | 'info' | 'success' | 'warning' | 'error';
|
|
11
|
+
/**
|
|
12
|
+
* One labeled value in the detail panel — the label is rendered above the
|
|
13
|
+
* value, and values stack vertically (never side by side).
|
|
14
|
+
*/
|
|
15
|
+
export interface TraceTimelineField {
|
|
16
|
+
/** Uppercase micro-label rendered above the value. */
|
|
17
|
+
label: string;
|
|
18
|
+
/**
|
|
19
|
+
* The value. Strings/numbers/booleans render inline (keyword-highlighted),
|
|
20
|
+
* React elements render as-is, anything else is pretty-printed as JSON in a
|
|
21
|
+
* copyable block.
|
|
22
|
+
*/
|
|
23
|
+
value: unknown;
|
|
24
|
+
/** Monospace the value. @default true */
|
|
25
|
+
mono?: boolean;
|
|
26
|
+
/** Add a copy button beside the label (always on for JSON blocks). */
|
|
27
|
+
copy?: boolean;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* One event on the trace. Only `id`, `service` and `start` are required —
|
|
31
|
+
* everything else enriches the chip, tooltip and detail panel *when present*,
|
|
32
|
+
* so a plain lifecycle/audit event (no method, no status, no bodies) renders
|
|
33
|
+
* as cleanly as a full HTTP call: sections with nothing behind them are
|
|
34
|
+
* skipped rather than shown empty. Extra fields are allowed, participate in
|
|
35
|
+
* keyword matching and are listed under *Other fields* in the detail panel.
|
|
36
|
+
*/
|
|
37
|
+
export interface TraceTimelineEvent {
|
|
38
|
+
/** Stable identifier. */
|
|
39
|
+
id: string;
|
|
40
|
+
/** Target component/service the event belongs to (colors the bar). */
|
|
41
|
+
service: string;
|
|
42
|
+
/**
|
|
43
|
+
* Caller shown as the chip's origin badge. Defaults to `'client'` for
|
|
44
|
+
* request-like events and to nothing for plain events (the chip then shows
|
|
45
|
+
* the service alone).
|
|
46
|
+
*/
|
|
47
|
+
source?: string;
|
|
48
|
+
/** Friendly operation id, bold in the chip (e.g. `create_manifest`). */
|
|
49
|
+
op?: string;
|
|
50
|
+
/**
|
|
51
|
+
* How the event is rendered. Inferred when omitted: `'request'` as soon as
|
|
52
|
+
* any of `method`/`url`/`status`/`query`/`reqHeaders`/`reqBody`/
|
|
53
|
+
* `resHeaders`/`resBody` is set, `'event'` otherwise. Request events get
|
|
54
|
+
* the Request/Response sections and the in-flight "Awaiting response…"
|
|
55
|
+
* state; plain events get Message/Payload/Details instead.
|
|
56
|
+
*/
|
|
57
|
+
kind?: 'request' | 'event';
|
|
58
|
+
/** Severity badge for plain events (requests use `status` instead). */
|
|
59
|
+
level?: TraceTimelineLevel;
|
|
60
|
+
/** One-line human description (detail panel + full log). */
|
|
61
|
+
message?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Generic body for events that aren't requests — pretty-printed as JSON
|
|
64
|
+
* (strings render verbatim) under a *Payload* heading with a copy button.
|
|
65
|
+
* Requests should use `reqBody`/`resBody`; an event may use `payload`
|
|
66
|
+
* alone and nothing else.
|
|
67
|
+
*/
|
|
68
|
+
payload?: unknown;
|
|
69
|
+
/**
|
|
70
|
+
* Extra labeled values for the detail panel and full log, in order. Each
|
|
71
|
+
* renders label-above-value; object values become copyable JSON blocks.
|
|
72
|
+
*/
|
|
73
|
+
details?: TraceTimelineField[];
|
|
74
|
+
/** Technical request id (fallback chip label; shown in the detail panel). */
|
|
75
|
+
requestId?: string;
|
|
76
|
+
/** HTTP method for the detail panel badge. */
|
|
77
|
+
method?: string;
|
|
78
|
+
/** Full URL (detail panel + tooltip). */
|
|
79
|
+
url?: string;
|
|
80
|
+
/** Short label for the tooltip. Defaults to `method + path`. */
|
|
81
|
+
label?: string;
|
|
82
|
+
/** Query parameters (detail panel). */
|
|
83
|
+
query?: Record<string, string>;
|
|
84
|
+
/** Request headers (detail panel; `x-request-id` is surfaced). */
|
|
85
|
+
reqHeaders?: Record<string, string>;
|
|
86
|
+
/** Request body, pretty-printed as JSON in the detail panel. */
|
|
87
|
+
reqBody?: unknown;
|
|
88
|
+
/** Response status; `>= 400` renders as an error badge. */
|
|
89
|
+
status?: number;
|
|
90
|
+
/** Response headers (detail panel). */
|
|
91
|
+
resHeaders?: Record<string, string>;
|
|
92
|
+
/** Response body, pretty-printed as JSON in the detail panel. */
|
|
93
|
+
resBody?: unknown;
|
|
94
|
+
/** Start time, epoch ms (UTC display). */
|
|
95
|
+
start: number;
|
|
96
|
+
/** End time, epoch ms. `null`/`undefined` while in flight (bar grows live). */
|
|
97
|
+
end?: number | null;
|
|
98
|
+
[extra: string]: unknown;
|
|
99
|
+
}
|
|
100
|
+
/** Fields the panel renders itself — everything else lands in *Other fields*. */
|
|
101
|
+
export declare const KNOWN_KEYS: Set<string>;
|
|
102
|
+
/** Whether the event should render the Request/Response sections. */
|
|
103
|
+
export declare const isRequestEvent: (e: TraceTimelineEvent) => boolean;
|
|
104
|
+
/** Chip/log headline: operation id, falling back to request ids, then `id`. */
|
|
105
|
+
export declare const ridOf: (e: TraceTimelineEvent) => string;
|
|
106
|
+
/**
|
|
107
|
+
* Origin badge. Requests keep the implicit `client` caller; plain events show
|
|
108
|
+
* no origin at all unless one was given.
|
|
109
|
+
*/
|
|
110
|
+
export declare const srcOf: (e: TraceTimelineEvent) => string;
|
|
111
|
+
/** `origin → target`, or the target alone when there is no origin. */
|
|
112
|
+
export declare const routeOf: (e: TraceTimelineEvent) => string;
|
|
113
|
+
/** Values rendered inline rather than as a JSON block. */
|
|
114
|
+
export declare const isInline: (v: unknown) => v is string | number | boolean;
|
|
115
|
+
/** Pretty-print for payload blocks; strings are shown verbatim. */
|
|
116
|
+
export declare const toText: (v: unknown) => string;
|
|
117
|
+
export type TraceBadgeTone = 'ok' | 'pending' | 'warn' | 'error';
|
|
118
|
+
/** Badge shown beside the method: status for requests, level for events. */
|
|
119
|
+
export declare function badgeOf(e: TraceTimelineEvent, pending: boolean): {
|
|
120
|
+
text: string;
|
|
121
|
+
tone: TraceBadgeTone;
|
|
122
|
+
} | null;
|
|
123
|
+
/**
|
|
124
|
+
* Extra (unknown) event keys as labeled fields, in insertion order. Keys in
|
|
125
|
+
* `hidden` are skipped — for plumbing values that ride along on the event but
|
|
126
|
+
* shouldn't be displayed.
|
|
127
|
+
*/
|
|
128
|
+
export declare function extraFieldsOf(e: TraceTimelineEvent, hidden?: readonly string[]): TraceTimelineField[];
|