@overdoser/react-toolkit 0.10.1 → 0.11.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 +55 -0
- package/components/Timeline/GanttTimeline.js +66 -64
- package/components/Timeline/HistoryTimeline.js +58 -57
- package/components/Timeline/Timeline.module.scss.js +112 -96
- package/components/Timeline/TimelineShared.d.ts +14 -4
- package/components/Timeline/TimelineShared.js +135 -95
- package/components/Timeline/TraceTimeline.d.ts +40 -9
- package/components/Timeline/TraceTimeline.js +598 -370
- package/components/Timeline/TraceTimeline.module.scss.js +163 -103
- package/components/Timeline/index.d.ts +1 -1
- package/index.css +1 -1
- package/index.d.ts +1 -1
- package/index.layered.css +1 -1
- package/llms.txt +12 -7
- package/manifest.json +29 -8
- package/package.json +1 -1
|
@@ -1,115 +1,132 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
1
|
+
import { jsxs as c, Fragment as B, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as D, useState as E, useEffect as L } from "react";
|
|
3
3
|
import m from "clsx";
|
|
4
4
|
import e from "./Timeline.module.scss.js";
|
|
5
|
-
import { highlightParts as
|
|
6
|
-
import { Draggable as
|
|
7
|
-
function
|
|
5
|
+
import { highlightParts as R } from "./timelineCore.js";
|
|
6
|
+
import { Draggable as w } from "../Draggable/Draggable.js";
|
|
7
|
+
function O({
|
|
8
8
|
items: l,
|
|
9
|
-
className:
|
|
9
|
+
className: r
|
|
10
10
|
}) {
|
|
11
|
-
return l.length ? /* @__PURE__ */ n("div", { className: m(e.legend,
|
|
12
|
-
/* @__PURE__ */ n("span", { className: e.legendDot, style: { background:
|
|
13
|
-
|
|
14
|
-
] },
|
|
11
|
+
return l.length ? /* @__PURE__ */ n("div", { className: m(e.legend, r), children: l.map((s) => /* @__PURE__ */ c("span", { className: e.legendItem, children: [
|
|
12
|
+
/* @__PURE__ */ n("span", { className: e.legendDot, style: { background: s.color } }),
|
|
13
|
+
s.name
|
|
14
|
+
] }, s.name)) }) : null;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function q({
|
|
17
17
|
zoomPct: l,
|
|
18
|
-
fitActive:
|
|
19
|
-
onZoomIn:
|
|
20
|
-
onZoomOut:
|
|
18
|
+
fitActive: r,
|
|
19
|
+
onZoomIn: s,
|
|
20
|
+
onZoomOut: a,
|
|
21
21
|
onFit: i,
|
|
22
|
-
hint:
|
|
23
|
-
children:
|
|
24
|
-
className:
|
|
22
|
+
hint: u,
|
|
23
|
+
children: p,
|
|
24
|
+
className: y
|
|
25
25
|
}) {
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
28
|
-
/* @__PURE__ */ n("button", { type: "button", className: e.zoomBtn, title: "Zoom out", onClick:
|
|
26
|
+
return /* @__PURE__ */ c("div", { className: m(e.controls, y), children: [
|
|
27
|
+
p,
|
|
28
|
+
/* @__PURE__ */ n("button", { type: "button", className: e.zoomBtn, title: "Zoom out", onClick: a, children: "−" }),
|
|
29
29
|
/* @__PURE__ */ n("span", { className: e.zoomPct, children: l }),
|
|
30
|
-
/* @__PURE__ */ n("button", { type: "button", className: e.zoomBtn, title: "Zoom in", onClick:
|
|
30
|
+
/* @__PURE__ */ n("button", { type: "button", className: e.zoomBtn, title: "Zoom in", onClick: s, children: "+" }),
|
|
31
31
|
/* @__PURE__ */ n(
|
|
32
32
|
"button",
|
|
33
33
|
{
|
|
34
34
|
type: "button",
|
|
35
|
-
className: m(e.fitBtn,
|
|
35
|
+
className: m(e.fitBtn, r && e.fitBtnActive),
|
|
36
36
|
onClick: i,
|
|
37
37
|
children: "Fit"
|
|
38
38
|
}
|
|
39
39
|
),
|
|
40
|
-
|
|
40
|
+
u ? /* @__PURE__ */ n("span", { className: e.controlsHint, children: u }) : null
|
|
41
41
|
] });
|
|
42
42
|
}
|
|
43
|
-
function
|
|
43
|
+
function G({
|
|
44
44
|
value: l,
|
|
45
|
-
options:
|
|
46
|
-
onChange:
|
|
45
|
+
options: r,
|
|
46
|
+
onChange: s
|
|
47
47
|
}) {
|
|
48
|
-
return /* @__PURE__ */ n("div", { className: e.segmented, children:
|
|
48
|
+
return /* @__PURE__ */ n("div", { className: e.segmented, children: r.map((a) => /* @__PURE__ */ n(
|
|
49
49
|
"button",
|
|
50
50
|
{
|
|
51
51
|
type: "button",
|
|
52
|
-
title:
|
|
53
|
-
className: m(e.segmentedBtn,
|
|
54
|
-
onClick: () =>
|
|
55
|
-
children:
|
|
52
|
+
title: a.title,
|
|
53
|
+
className: m(e.segmentedBtn, a.value === l && e.segmentedBtnActive),
|
|
54
|
+
onClick: () => s(a.value),
|
|
55
|
+
children: a.label
|
|
56
56
|
},
|
|
57
|
-
|
|
57
|
+
a.value
|
|
58
58
|
)) });
|
|
59
59
|
}
|
|
60
|
-
function
|
|
60
|
+
function K({
|
|
61
61
|
heading: l = "Events",
|
|
62
|
-
items:
|
|
63
|
-
onPick:
|
|
64
|
-
placement:
|
|
62
|
+
items: r,
|
|
63
|
+
onPick: s,
|
|
64
|
+
placement: a = "left",
|
|
65
65
|
floatingDefaultPosition: i,
|
|
66
|
-
|
|
66
|
+
bubbleGlyphColors: u,
|
|
67
|
+
className: p
|
|
67
68
|
}) {
|
|
68
|
-
const
|
|
69
|
-
let
|
|
70
|
-
|
|
71
|
-
|
|
69
|
+
const y = D(null), N = D(!1), [z, C] = E(!1), [A, T] = E({ x: 0, y: 0 }), d = a === "bubble", b = a === "floating", k = a === "top" || a === "bottom";
|
|
70
|
+
let h = -1, f = -1;
|
|
71
|
+
r.forEach((t, o) => {
|
|
72
|
+
t.inView && (h < 0 && (h = o), f = o);
|
|
72
73
|
});
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
if (!
|
|
77
|
-
const o =
|
|
78
|
-
if (!
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
}, [
|
|
82
|
-
const
|
|
83
|
-
/* @__PURE__ */
|
|
84
|
-
|
|
74
|
+
const H = h === 0 && f === r.length - 1;
|
|
75
|
+
L(() => {
|
|
76
|
+
const t = y.current;
|
|
77
|
+
if (!t || N.current || h < 0 || H) return;
|
|
78
|
+
const o = t.querySelectorAll("[data-timeline-summary-row]"), P = o[h], v = o[f];
|
|
79
|
+
if (!P || !v) return;
|
|
80
|
+
const F = (P.offsetTop + v.offsetTop + v.offsetHeight) / 2;
|
|
81
|
+
t.scrollTop = Math.max(0, F - t.clientHeight / 2);
|
|
82
|
+
}, [h, f, H]);
|
|
83
|
+
const x = /* @__PURE__ */ c(B, { children: [
|
|
84
|
+
/* @__PURE__ */ c("span", { children: [
|
|
85
|
+
(b || d) && /* @__PURE__ */ n("span", { className: e.summaryGrip, "aria-hidden": !0, children: "⠿" }),
|
|
85
86
|
l
|
|
86
87
|
] }),
|
|
87
|
-
/* @__PURE__ */
|
|
88
|
-
|
|
88
|
+
d ? /* @__PURE__ */ c("span", { className: e.summaryHeadTools, children: [
|
|
89
|
+
/* @__PURE__ */ n("span", { className: e.summaryCount, children: r.length }),
|
|
90
|
+
/* @__PURE__ */ n(
|
|
91
|
+
"button",
|
|
92
|
+
{
|
|
93
|
+
type: "button",
|
|
94
|
+
className: e.summaryCollapse,
|
|
95
|
+
"aria-label": "Collapse event summary",
|
|
96
|
+
onClick: (t) => {
|
|
97
|
+
t.stopPropagation(), C(!1), T({ x: 0, y: 0 });
|
|
98
|
+
},
|
|
99
|
+
onPointerDown: (t) => t.stopPropagation(),
|
|
100
|
+
children: "×"
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
] }) : /* @__PURE__ */ n("span", { className: e.summaryCount, children: r.length })
|
|
104
|
+
] }), g = /* @__PURE__ */ c(
|
|
89
105
|
"div",
|
|
90
106
|
{
|
|
91
107
|
className: m(
|
|
92
108
|
e.summary,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
109
|
+
k && e.summaryHorizontal,
|
|
110
|
+
a === "top" && e.summaryTop,
|
|
111
|
+
a === "bottom" && e.summaryBottom,
|
|
112
|
+
b && e.summaryFloatingCard,
|
|
113
|
+
d && e.summaryBubbleCard,
|
|
114
|
+
p
|
|
98
115
|
),
|
|
99
116
|
onMouseEnter: () => {
|
|
100
|
-
|
|
117
|
+
N.current = !0;
|
|
101
118
|
},
|
|
102
119
|
onMouseLeave: () => {
|
|
103
|
-
|
|
120
|
+
N.current = !1;
|
|
104
121
|
},
|
|
105
122
|
children: [
|
|
106
|
-
|
|
123
|
+
b || d ? /* @__PURE__ */ n(w.Handle, { className: m(e.summaryHeader, e.summaryHandle), children: x }) : /* @__PURE__ */ n("div", { className: e.summaryHeader, children: x }),
|
|
107
124
|
/* @__PURE__ */ n(
|
|
108
125
|
"div",
|
|
109
126
|
{
|
|
110
|
-
ref:
|
|
111
|
-
className: m(e.summaryList,
|
|
112
|
-
children:
|
|
127
|
+
ref: y,
|
|
128
|
+
className: m(e.summaryList, k && e.summaryListGrid),
|
|
129
|
+
children: r.map((t) => /* @__PURE__ */ c(
|
|
113
130
|
"div",
|
|
114
131
|
{
|
|
115
132
|
"data-timeline-summary-row": !0,
|
|
@@ -117,57 +134,80 @@ function M({
|
|
|
117
134
|
tabIndex: 0,
|
|
118
135
|
className: m(
|
|
119
136
|
e.summaryRow,
|
|
120
|
-
|
|
121
|
-
|
|
137
|
+
t.inView && e.summaryRowInView,
|
|
138
|
+
t.selected && e.summaryRowSelected
|
|
122
139
|
),
|
|
123
|
-
onClick: () =>
|
|
140
|
+
onClick: () => s(t.id),
|
|
124
141
|
onKeyDown: (o) => {
|
|
125
|
-
(o.key === "Enter" || o.key === " ") && (o.preventDefault(),
|
|
142
|
+
(o.key === "Enter" || o.key === " ") && (o.preventDefault(), s(t.id));
|
|
126
143
|
},
|
|
127
144
|
children: [
|
|
128
|
-
/* @__PURE__ */ n("span", { className: e.summaryNum, children:
|
|
129
|
-
/* @__PURE__ */ n("span", { className: e.summaryDot, style: { background:
|
|
130
|
-
/* @__PURE__ */ n("span", { className: e.summaryLabel, children:
|
|
131
|
-
|
|
145
|
+
/* @__PURE__ */ n("span", { className: e.summaryNum, children: t.number }),
|
|
146
|
+
/* @__PURE__ */ n("span", { className: e.summaryDot, style: { background: t.color } }),
|
|
147
|
+
/* @__PURE__ */ n("span", { className: e.summaryLabel, children: t.label }),
|
|
148
|
+
t.time && /* @__PURE__ */ n("span", { className: e.summaryTime, children: t.time })
|
|
132
149
|
]
|
|
133
150
|
},
|
|
134
|
-
|
|
151
|
+
t.id
|
|
135
152
|
))
|
|
136
153
|
}
|
|
137
|
-
)
|
|
154
|
+
),
|
|
155
|
+
d && /* @__PURE__ */ n("div", { className: e.summaryFootnote, children: "Tinted rows are in the viewport" })
|
|
138
156
|
]
|
|
139
157
|
}
|
|
140
158
|
);
|
|
141
|
-
return
|
|
142
|
-
|
|
159
|
+
return d ? z ? /* @__PURE__ */ n("div", { className: e.summaryBubbleAnchor, children: /* @__PURE__ */ n(
|
|
160
|
+
w,
|
|
161
|
+
{
|
|
162
|
+
className: e.summaryBubblePanel,
|
|
163
|
+
bounds: "viewport",
|
|
164
|
+
position: A,
|
|
165
|
+
onDrag: T,
|
|
166
|
+
children: g
|
|
167
|
+
}
|
|
168
|
+
) }) : /* @__PURE__ */ n("div", { className: e.summaryBubbleAnchor, children: /* @__PURE__ */ c(
|
|
169
|
+
"button",
|
|
170
|
+
{
|
|
171
|
+
type: "button",
|
|
172
|
+
className: m(e.summaryBubble, p),
|
|
173
|
+
title: "Event summary",
|
|
174
|
+
onClick: () => C(!0),
|
|
175
|
+
children: [
|
|
176
|
+
/* @__PURE__ */ n("span", { className: e.summaryBubbleGlyph, "aria-hidden": !0, children: (u && u.length ? u : ["var(--crk-timeline-accent)"]).slice(0, 3).map((t, o) => /* @__PURE__ */ n("span", { style: { background: t } }, o)) }),
|
|
177
|
+
l,
|
|
178
|
+
/* @__PURE__ */ n("span", { className: e.summaryCount, children: r.length })
|
|
179
|
+
]
|
|
180
|
+
}
|
|
181
|
+
) }) : b ? /* @__PURE__ */ n(
|
|
182
|
+
w,
|
|
143
183
|
{
|
|
144
184
|
className: e.summaryFloating,
|
|
145
185
|
bounds: "viewport",
|
|
146
186
|
defaultPosition: i ?? { x: 0, y: 0 },
|
|
147
|
-
children:
|
|
187
|
+
children: g
|
|
148
188
|
}
|
|
149
|
-
) :
|
|
189
|
+
) : g;
|
|
150
190
|
}
|
|
151
|
-
function
|
|
191
|
+
function J({
|
|
152
192
|
x: l,
|
|
153
|
-
y:
|
|
154
|
-
children:
|
|
155
|
-
className:
|
|
193
|
+
y: r,
|
|
194
|
+
children: s,
|
|
195
|
+
className: a,
|
|
156
196
|
style: i
|
|
157
197
|
}) {
|
|
158
|
-
return /* @__PURE__ */ n("div", { className: m(e.tooltip,
|
|
198
|
+
return /* @__PURE__ */ n("div", { className: m(e.tooltip, a), style: { left: l, top: r, ...i }, children: s });
|
|
159
199
|
}
|
|
160
|
-
function
|
|
161
|
-
const
|
|
162
|
-
return
|
|
163
|
-
(
|
|
200
|
+
function Q({ text: l, query: r }) {
|
|
201
|
+
const s = R(l, r);
|
|
202
|
+
return s.length === 1 && !s[0].hit ? /* @__PURE__ */ n(B, { children: s[0].t }) : /* @__PURE__ */ n(B, { children: s.map(
|
|
203
|
+
(a, i) => a.hit ? /* @__PURE__ */ n("span", { className: e.mark, children: a.t }, i) : /* @__PURE__ */ n("span", { children: a.t }, i)
|
|
164
204
|
) });
|
|
165
205
|
}
|
|
166
206
|
export {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
207
|
+
Q as HighlightText,
|
|
208
|
+
O as TimelineLegend,
|
|
209
|
+
G as TimelineSegmented,
|
|
210
|
+
K as TimelineSummary,
|
|
211
|
+
J as TimelineTooltip,
|
|
212
|
+
q as TimelineZoomControls
|
|
173
213
|
};
|
|
@@ -54,9 +54,13 @@ export interface TraceTimelineClasses {
|
|
|
54
54
|
summary: string;
|
|
55
55
|
search: string;
|
|
56
56
|
drawer: string;
|
|
57
|
+
log: string;
|
|
58
|
+
rail: string;
|
|
57
59
|
tooltip: string;
|
|
58
60
|
footnote: string;
|
|
59
61
|
}
|
|
62
|
+
/** Which right-side drawer is docked open (`null` = none). */
|
|
63
|
+
export type TraceTimelineDock = 'details' | 'log' | null;
|
|
60
64
|
/** Context handed to the TraceTimeline render-prop slots. */
|
|
61
65
|
export interface TraceTimelineItemContext {
|
|
62
66
|
/** Resolved service color. */
|
|
@@ -114,24 +118,46 @@ export interface TraceTimelineProps {
|
|
|
114
118
|
/** Colored dot + name legend for the services present. @default true */
|
|
115
119
|
showLegend?: boolean;
|
|
116
120
|
/**
|
|
117
|
-
* Dense one-line-per-event summary panel
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* click-to-navigate — the
|
|
121
|
-
*
|
|
122
|
-
*
|
|
121
|
+
* Dense one-line-per-event summary panel: all events numbered
|
|
122
|
+
* chronologically from `01`, a highlight band over the events currently
|
|
123
|
+
* visible in the viewport (auto-follows drag-panning), and
|
|
124
|
+
* click-to-navigate — picking a row selects the event and smooth-scrolls
|
|
125
|
+
* the timeline (~1s, decelerating) to center it (and scrolls the full-log
|
|
126
|
+
* drawer to its entry when that is open). The panel scrolls independently.
|
|
127
|
+
* @default true
|
|
123
128
|
*/
|
|
124
129
|
showSummary?: boolean;
|
|
125
130
|
/**
|
|
126
|
-
* Where the summary panel sits:
|
|
131
|
+
* Where the summary panel sits: `'bubble'` — a collapsed pill anchored
|
|
132
|
+
* bottom-left of the timeline that expands in place into a draggable panel
|
|
133
|
+
* (collapsing snaps it back to its corner) — docked `'left'`/`'right'`,
|
|
127
134
|
* full-width `'top'`/`'bottom'`, or `'floating'` — a draggable palette over
|
|
128
|
-
* the timeline, grabbed by its header. @default '
|
|
135
|
+
* the timeline, grabbed by its header. @default 'bubble'
|
|
129
136
|
*/
|
|
130
137
|
summaryPlacement?: TimelineSummaryPlacement;
|
|
131
138
|
/** Floating summary: initial offset from the component's top-left corner. */
|
|
132
139
|
summaryDefaultPosition?: DraggablePosition;
|
|
140
|
+
/**
|
|
141
|
+
* Sticky icon rail on the far right with two toggles docking a drawer
|
|
142
|
+
* beside the timeline: *Event details* (the request/response panel, with an
|
|
143
|
+
* empty state until an event is picked) and *Full log* (every event
|
|
144
|
+
* vertically with payloads and copy buttons). One drawer at a time; nothing
|
|
145
|
+
* is docked initially, but clicking an event opens the details drawer.
|
|
146
|
+
* With `false`, the rail and full log disappear and the details panel
|
|
147
|
+
* simply opens/closes with the selection. @default true
|
|
148
|
+
*/
|
|
149
|
+
showDock?: boolean;
|
|
150
|
+
/** Drawer docked open initially (uncontrolled). @default null */
|
|
151
|
+
defaultDock?: TraceTimelineDock;
|
|
133
152
|
/** Max height of the scrollable canvas. @default '80vh' */
|
|
134
153
|
maxHeight?: number | string;
|
|
154
|
+
/**
|
|
155
|
+
* Minimum height of the event band, px (the sticky axis adds its 68px on
|
|
156
|
+
* top). Sparse traces stretch to it with the bar band kept vertically
|
|
157
|
+
* centered; dense traces still grow past it when their chip rows need
|
|
158
|
+
* more room. @default 420
|
|
159
|
+
*/
|
|
160
|
+
minHeight?: number;
|
|
135
161
|
/** Controlled id of the event open in the detail panel (`null` = closed). */
|
|
136
162
|
selectedEventId?: string | null;
|
|
137
163
|
/** Initially open event (uncontrolled). */
|
|
@@ -165,7 +191,12 @@ export interface TraceTimelineProps {
|
|
|
165
191
|
* axis with cursor timestamp chip, day-change date labels and a sticky
|
|
166
192
|
* current-date marker; wheel-zoom, drag-pan, fit-to-width; keyword
|
|
167
193
|
* highlighting; in-flight events render dashed with a "now" line and grow
|
|
168
|
-
* live
|
|
194
|
+
* live. A right-side icon rail docks one drawer at a time: *Event details*
|
|
195
|
+
* (the request/response panel, opened by clicking an event) or *Full log*
|
|
196
|
+
* (every event vertically with copy-to-clipboard payloads, kept in sync with
|
|
197
|
+
* timeline clicks both ways). An events-summary bubble sits bottom-left,
|
|
198
|
+
* expanding into a draggable panel that bands the events currently in view
|
|
199
|
+
* and navigates on click.
|
|
169
200
|
*
|
|
170
201
|
* @example
|
|
171
202
|
* ```tsx
|