@overdoser/react-toolkit 0.11.0 → 0.12.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 +53 -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/TraceTimeline.d.ts +10 -0
- package/components/Timeline/TraceTimeline.js +646 -590
- package/components/Timeline/TraceTimeline.module.scss.js +118 -114
- package/components/Timeline/index.d.ts +1 -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 +1 -1
- package/index.layered.css +1 -1
- package/llms.txt +6 -3
- package/manifest.json +604 -165
- package/package.json +1 -1
|
@@ -1,213 +1,286 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useRef as
|
|
3
|
-
import
|
|
1
|
+
import { jsxs as h, Fragment as L, jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { useRef as T, useState as D, useEffect as S } from "react";
|
|
3
|
+
import c from "clsx";
|
|
4
4
|
import e from "./Timeline.module.scss.js";
|
|
5
|
-
import { highlightParts as
|
|
6
|
-
import { Draggable as
|
|
7
|
-
function
|
|
8
|
-
items:
|
|
9
|
-
className:
|
|
5
|
+
import { highlightParts as Z } from "./timelineCore.js";
|
|
6
|
+
import { Draggable as E } from "../Draggable/Draggable.js";
|
|
7
|
+
function G({
|
|
8
|
+
items: o,
|
|
9
|
+
className: s
|
|
10
10
|
}) {
|
|
11
|
-
return
|
|
12
|
-
/* @__PURE__ */
|
|
13
|
-
|
|
14
|
-
] },
|
|
11
|
+
return o.length ? /* @__PURE__ */ t("div", { className: c(e.legend, s), children: o.map((a) => /* @__PURE__ */ h("span", { className: e.legendItem, children: [
|
|
12
|
+
/* @__PURE__ */ t("span", { className: e.legendDot, style: { background: a.color } }),
|
|
13
|
+
a.name
|
|
14
|
+
] }, a.name)) }) : null;
|
|
15
15
|
}
|
|
16
|
-
function
|
|
17
|
-
zoomPct:
|
|
18
|
-
fitActive:
|
|
19
|
-
onZoomIn:
|
|
20
|
-
onZoomOut:
|
|
16
|
+
function J({
|
|
17
|
+
zoomPct: o,
|
|
18
|
+
fitActive: s,
|
|
19
|
+
onZoomIn: a,
|
|
20
|
+
onZoomOut: r,
|
|
21
21
|
onFit: i,
|
|
22
|
-
hint:
|
|
23
|
-
children:
|
|
24
|
-
className:
|
|
22
|
+
hint: p,
|
|
23
|
+
children: b,
|
|
24
|
+
className: f
|
|
25
25
|
}) {
|
|
26
|
-
return /* @__PURE__ */
|
|
27
|
-
|
|
28
|
-
/* @__PURE__ */
|
|
29
|
-
/* @__PURE__ */
|
|
30
|
-
/* @__PURE__ */
|
|
31
|
-
/* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ h("div", { className: c(e.controls, f), children: [
|
|
27
|
+
b,
|
|
28
|
+
/* @__PURE__ */ t("button", { type: "button", className: e.zoomBtn, title: "Zoom out", onClick: r, children: "−" }),
|
|
29
|
+
/* @__PURE__ */ t("span", { className: e.zoomPct, children: o }),
|
|
30
|
+
/* @__PURE__ */ t("button", { type: "button", className: e.zoomBtn, title: "Zoom in", onClick: a, children: "+" }),
|
|
31
|
+
/* @__PURE__ */ t(
|
|
32
32
|
"button",
|
|
33
33
|
{
|
|
34
34
|
type: "button",
|
|
35
|
-
className:
|
|
35
|
+
className: c(e.fitBtn, s && e.fitBtnActive),
|
|
36
36
|
onClick: i,
|
|
37
37
|
children: "Fit"
|
|
38
38
|
}
|
|
39
39
|
),
|
|
40
|
-
|
|
40
|
+
p ? /* @__PURE__ */ t("span", { className: e.controlsHint, children: p }) : null
|
|
41
41
|
] });
|
|
42
42
|
}
|
|
43
|
-
function
|
|
44
|
-
value:
|
|
45
|
-
options:
|
|
46
|
-
onChange:
|
|
43
|
+
function Q({
|
|
44
|
+
value: o,
|
|
45
|
+
options: s,
|
|
46
|
+
onChange: a
|
|
47
47
|
}) {
|
|
48
|
-
return /* @__PURE__ */
|
|
48
|
+
return /* @__PURE__ */ t("div", { className: e.segmented, children: s.map((r) => /* @__PURE__ */ t(
|
|
49
49
|
"button",
|
|
50
50
|
{
|
|
51
51
|
type: "button",
|
|
52
|
-
title:
|
|
53
|
-
className:
|
|
54
|
-
onClick: () =>
|
|
55
|
-
children:
|
|
52
|
+
title: r.title,
|
|
53
|
+
className: c(e.segmentedBtn, r.value === o && e.segmentedBtnActive),
|
|
54
|
+
onClick: () => a(r.value),
|
|
55
|
+
children: r.label
|
|
56
56
|
},
|
|
57
|
-
|
|
57
|
+
r.value
|
|
58
58
|
)) });
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
function j({
|
|
61
|
+
panel: o,
|
|
62
|
+
width: s,
|
|
63
|
+
min: a,
|
|
64
|
+
max: r,
|
|
65
|
+
onResize: i,
|
|
66
|
+
label: p,
|
|
67
|
+
className: b
|
|
68
|
+
}) {
|
|
69
|
+
const f = T(null), [y, B] = D(!1), g = T(s);
|
|
70
|
+
g.current = s;
|
|
71
|
+
const u = (l) => Math.min(r, Math.max(a, l));
|
|
72
|
+
return S(() => {
|
|
73
|
+
if (!y) return;
|
|
74
|
+
const l = (P) => {
|
|
75
|
+
const k = f.current;
|
|
76
|
+
if (!k) return;
|
|
77
|
+
const v = P.clientX - k.x;
|
|
78
|
+
i(Math.min(r, Math.max(a, k.w + (o === "left" ? v : -v))));
|
|
79
|
+
}, d = () => {
|
|
80
|
+
f.current = null, B(!1);
|
|
81
|
+
};
|
|
82
|
+
return window.addEventListener("pointermove", l), window.addEventListener("pointerup", d), () => {
|
|
83
|
+
window.removeEventListener("pointermove", l), window.removeEventListener("pointerup", d);
|
|
84
|
+
};
|
|
85
|
+
}, [y, o, a, r, i]), /* @__PURE__ */ t(
|
|
86
|
+
"div",
|
|
87
|
+
{
|
|
88
|
+
className: c(e.dockResizer, y && e.dockResizerActive, b),
|
|
89
|
+
role: "separator",
|
|
90
|
+
"aria-orientation": "vertical",
|
|
91
|
+
"aria-label": p,
|
|
92
|
+
tabIndex: 0,
|
|
93
|
+
onPointerDown: (l) => {
|
|
94
|
+
l.button > 0 || (l.preventDefault(), f.current = { x: l.clientX, w: g.current }, B(!0));
|
|
95
|
+
},
|
|
96
|
+
onKeyDown: (l) => {
|
|
97
|
+
const d = l.key === "ArrowLeft" ? -16 : l.key === "ArrowRight" ? 16 : 0;
|
|
98
|
+
d && (l.preventDefault(), i(u(g.current + (o === "left" ? d : -d))));
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
function Y({
|
|
104
|
+
heading: o = "Events",
|
|
105
|
+
items: s,
|
|
106
|
+
onPick: a,
|
|
107
|
+
placement: r = "left",
|
|
65
108
|
floatingDefaultPosition: i,
|
|
66
|
-
bubbleGlyphColors:
|
|
67
|
-
className:
|
|
109
|
+
bubbleGlyphColors: p,
|
|
110
|
+
className: b
|
|
68
111
|
}) {
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
|
|
72
|
-
|
|
112
|
+
const f = T(null), y = T(!1), [B, g] = D(!1), [u, l] = D(!1), [d, P] = D(262), [k, v] = D({ x: 0, y: 0 }), N = r === "bubble", H = r === "floating", z = H || N && !u, A = r === "top" || r === "bottom";
|
|
113
|
+
let w = -1, C = -1;
|
|
114
|
+
s.forEach((n, m) => {
|
|
115
|
+
n.inView && (w < 0 && (w = m), C = m);
|
|
73
116
|
});
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
const
|
|
77
|
-
if (!
|
|
78
|
-
const
|
|
79
|
-
if (!
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
}, [
|
|
83
|
-
const
|
|
84
|
-
/* @__PURE__ */
|
|
85
|
-
|
|
86
|
-
|
|
117
|
+
const M = w === 0 && C === s.length - 1;
|
|
118
|
+
S(() => {
|
|
119
|
+
const n = f.current;
|
|
120
|
+
if (!n || y.current || w < 0 || M) return;
|
|
121
|
+
const m = n.querySelectorAll("[data-timeline-summary-row]"), I = m[w], R = m[C];
|
|
122
|
+
if (!I || !R) return;
|
|
123
|
+
const V = (I.offsetTop + R.offsetTop + R.offsetHeight) / 2;
|
|
124
|
+
n.scrollTop = Math.max(0, V - n.clientHeight / 2);
|
|
125
|
+
}, [w, C, M]);
|
|
126
|
+
const F = /* @__PURE__ */ h(L, { children: [
|
|
127
|
+
/* @__PURE__ */ h("span", { children: [
|
|
128
|
+
z && /* @__PURE__ */ t("span", { className: e.summaryGrip, "aria-hidden": !0, children: "⠿" }),
|
|
129
|
+
o
|
|
87
130
|
] }),
|
|
88
|
-
|
|
89
|
-
/* @__PURE__ */
|
|
90
|
-
/* @__PURE__ */
|
|
131
|
+
N ? /* @__PURE__ */ h("span", { className: e.summaryHeadTools, children: [
|
|
132
|
+
/* @__PURE__ */ t("span", { className: e.summaryCount, children: s.length }),
|
|
133
|
+
/* @__PURE__ */ t(
|
|
134
|
+
"button",
|
|
135
|
+
{
|
|
136
|
+
type: "button",
|
|
137
|
+
className: e.summaryDockBtn,
|
|
138
|
+
"aria-label": u ? "Undock event summary" : "Dock event summary",
|
|
139
|
+
title: u ? "Float the panel" : "Dock to the left edge",
|
|
140
|
+
onClick: (n) => {
|
|
141
|
+
n.stopPropagation(), l(!u), v({ x: 0, y: 0 });
|
|
142
|
+
},
|
|
143
|
+
onPointerDown: (n) => n.stopPropagation(),
|
|
144
|
+
children: u ? "⇱" : "⇤"
|
|
145
|
+
}
|
|
146
|
+
),
|
|
147
|
+
/* @__PURE__ */ t(
|
|
91
148
|
"button",
|
|
92
149
|
{
|
|
93
150
|
type: "button",
|
|
94
151
|
className: e.summaryCollapse,
|
|
95
152
|
"aria-label": "Collapse event summary",
|
|
96
|
-
onClick: (
|
|
97
|
-
|
|
153
|
+
onClick: (n) => {
|
|
154
|
+
n.stopPropagation(), g(!1), v({ x: 0, y: 0 });
|
|
98
155
|
},
|
|
99
|
-
onPointerDown: (
|
|
156
|
+
onPointerDown: (n) => n.stopPropagation(),
|
|
100
157
|
children: "×"
|
|
101
158
|
}
|
|
102
159
|
)
|
|
103
|
-
] }) : /* @__PURE__ */
|
|
104
|
-
] }),
|
|
160
|
+
] }) : /* @__PURE__ */ t("span", { className: e.summaryCount, children: s.length })
|
|
161
|
+
] }), x = /* @__PURE__ */ h(
|
|
105
162
|
"div",
|
|
106
163
|
{
|
|
107
|
-
className:
|
|
164
|
+
className: c(
|
|
108
165
|
e.summary,
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
166
|
+
A && e.summaryHorizontal,
|
|
167
|
+
r === "top" && e.summaryTop,
|
|
168
|
+
r === "bottom" && e.summaryBottom,
|
|
169
|
+
H && e.summaryFloatingCard,
|
|
170
|
+
N && e.summaryBubbleCard,
|
|
171
|
+
N && u && e.summaryDockCard,
|
|
172
|
+
b
|
|
115
173
|
),
|
|
116
174
|
onMouseEnter: () => {
|
|
117
|
-
|
|
175
|
+
y.current = !0;
|
|
118
176
|
},
|
|
119
177
|
onMouseLeave: () => {
|
|
120
|
-
|
|
178
|
+
y.current = !1;
|
|
121
179
|
},
|
|
122
180
|
children: [
|
|
123
|
-
|
|
124
|
-
/* @__PURE__ */
|
|
181
|
+
z ? /* @__PURE__ */ t(E.Handle, { className: c(e.summaryHeader, e.summaryHandle), children: F }) : /* @__PURE__ */ t("div", { className: e.summaryHeader, children: F }),
|
|
182
|
+
/* @__PURE__ */ t(
|
|
125
183
|
"div",
|
|
126
184
|
{
|
|
127
|
-
ref:
|
|
128
|
-
className:
|
|
129
|
-
children:
|
|
185
|
+
ref: f,
|
|
186
|
+
className: c(e.summaryList, A && e.summaryListGrid),
|
|
187
|
+
children: s.map((n) => /* @__PURE__ */ h(
|
|
130
188
|
"div",
|
|
131
189
|
{
|
|
132
190
|
"data-timeline-summary-row": !0,
|
|
133
191
|
role: "button",
|
|
134
192
|
tabIndex: 0,
|
|
135
|
-
className:
|
|
193
|
+
className: c(
|
|
136
194
|
e.summaryRow,
|
|
137
|
-
|
|
138
|
-
|
|
195
|
+
n.inView && e.summaryRowInView,
|
|
196
|
+
n.selected && e.summaryRowSelected
|
|
139
197
|
),
|
|
140
|
-
onClick: () =>
|
|
141
|
-
onKeyDown: (
|
|
142
|
-
(
|
|
198
|
+
onClick: () => a(n.id),
|
|
199
|
+
onKeyDown: (m) => {
|
|
200
|
+
(m.key === "Enter" || m.key === " ") && (m.preventDefault(), a(n.id));
|
|
143
201
|
},
|
|
144
202
|
children: [
|
|
145
|
-
/* @__PURE__ */
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */
|
|
148
|
-
|
|
203
|
+
/* @__PURE__ */ t("span", { className: e.summaryNum, children: n.number }),
|
|
204
|
+
/* @__PURE__ */ t("span", { className: e.summaryDot, style: { background: n.color } }),
|
|
205
|
+
/* @__PURE__ */ t("span", { className: e.summaryLabel, children: n.label }),
|
|
206
|
+
n.time && /* @__PURE__ */ t("span", { className: e.summaryTime, children: n.time })
|
|
149
207
|
]
|
|
150
208
|
},
|
|
151
|
-
|
|
209
|
+
n.id
|
|
152
210
|
))
|
|
153
211
|
}
|
|
154
212
|
),
|
|
155
|
-
|
|
213
|
+
N && /* @__PURE__ */ t("div", { className: e.summaryFootnote, children: "Tinted rows are in the viewport" })
|
|
156
214
|
]
|
|
157
215
|
}
|
|
158
216
|
);
|
|
159
|
-
return
|
|
160
|
-
|
|
217
|
+
return N ? B ? u ? /* @__PURE__ */ h("div", { className: e.summaryDock, style: { flexBasis: d }, children: [
|
|
218
|
+
x,
|
|
219
|
+
/* @__PURE__ */ t(
|
|
220
|
+
j,
|
|
221
|
+
{
|
|
222
|
+
panel: "left",
|
|
223
|
+
width: d,
|
|
224
|
+
min: 200,
|
|
225
|
+
max: 520,
|
|
226
|
+
onResize: P,
|
|
227
|
+
label: "Resize event summary",
|
|
228
|
+
className: e.summaryDockResizer
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] }) : /* @__PURE__ */ t("div", { className: e.summaryBubbleAnchor, children: /* @__PURE__ */ t(
|
|
232
|
+
E,
|
|
161
233
|
{
|
|
162
234
|
className: e.summaryBubblePanel,
|
|
163
235
|
bounds: "viewport",
|
|
164
|
-
position:
|
|
165
|
-
onDrag:
|
|
166
|
-
children:
|
|
236
|
+
position: k,
|
|
237
|
+
onDrag: v,
|
|
238
|
+
children: x
|
|
167
239
|
}
|
|
168
|
-
) }) : /* @__PURE__ */
|
|
240
|
+
) }) : /* @__PURE__ */ t("div", { className: e.summaryBubbleAnchor, children: /* @__PURE__ */ h(
|
|
169
241
|
"button",
|
|
170
242
|
{
|
|
171
243
|
type: "button",
|
|
172
|
-
className:
|
|
244
|
+
className: c(e.summaryBubble, b),
|
|
173
245
|
title: "Event summary",
|
|
174
|
-
onClick: () =>
|
|
246
|
+
onClick: () => g(!0),
|
|
175
247
|
children: [
|
|
176
|
-
/* @__PURE__ */
|
|
177
|
-
|
|
178
|
-
/* @__PURE__ */
|
|
248
|
+
/* @__PURE__ */ t("span", { className: e.summaryBubbleGlyph, "aria-hidden": !0, children: (p && p.length ? p : ["var(--crk-timeline-accent)"]).slice(0, 3).map((n, m) => /* @__PURE__ */ t("span", { style: { background: n } }, m)) }),
|
|
249
|
+
o,
|
|
250
|
+
/* @__PURE__ */ t("span", { className: e.summaryCount, children: s.length })
|
|
179
251
|
]
|
|
180
252
|
}
|
|
181
|
-
) }) :
|
|
182
|
-
|
|
253
|
+
) }) : H ? /* @__PURE__ */ t(
|
|
254
|
+
E,
|
|
183
255
|
{
|
|
184
256
|
className: e.summaryFloating,
|
|
185
257
|
bounds: "viewport",
|
|
186
258
|
defaultPosition: i ?? { x: 0, y: 0 },
|
|
187
|
-
children:
|
|
259
|
+
children: x
|
|
188
260
|
}
|
|
189
|
-
) :
|
|
261
|
+
) : x;
|
|
190
262
|
}
|
|
191
|
-
function
|
|
192
|
-
x:
|
|
193
|
-
y:
|
|
194
|
-
children:
|
|
195
|
-
className:
|
|
263
|
+
function _({
|
|
264
|
+
x: o,
|
|
265
|
+
y: s,
|
|
266
|
+
children: a,
|
|
267
|
+
className: r,
|
|
196
268
|
style: i
|
|
197
269
|
}) {
|
|
198
|
-
return /* @__PURE__ */
|
|
270
|
+
return /* @__PURE__ */ t("div", { className: c(e.tooltip, r), style: { left: o, top: s, ...i }, children: a });
|
|
199
271
|
}
|
|
200
|
-
function
|
|
201
|
-
const
|
|
202
|
-
return
|
|
203
|
-
(
|
|
272
|
+
function $({ text: o, query: s }) {
|
|
273
|
+
const a = Z(o, s);
|
|
274
|
+
return a.length === 1 && !a[0].hit ? /* @__PURE__ */ t(L, { children: a[0].t }) : /* @__PURE__ */ t(L, { children: a.map(
|
|
275
|
+
(r, i) => r.hit ? /* @__PURE__ */ t("span", { className: e.mark, children: r.t }, i) : /* @__PURE__ */ t("span", { children: r.t }, i)
|
|
204
276
|
) });
|
|
205
277
|
}
|
|
206
278
|
export {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
279
|
+
$ as HighlightText,
|
|
280
|
+
G as TimelineLegend,
|
|
281
|
+
j as TimelineResizer,
|
|
282
|
+
Q as TimelineSegmented,
|
|
283
|
+
Y as TimelineSummary,
|
|
284
|
+
_ as TimelineTooltip,
|
|
285
|
+
J as TimelineZoomControls
|
|
213
286
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import { TimelineSummaryPlacement } from './TimelineShared';
|
|
3
3
|
import { DraggablePosition } from '../Draggable';
|
|
4
|
+
import { TimelineWheelZoom } from './useTimeline';
|
|
4
5
|
/**
|
|
5
6
|
* One request/response (or custom) event on the trace. Only `id`, `service`
|
|
6
7
|
* and `start` are required — everything else enriches the chip, tooltip and
|
|
@@ -115,6 +116,15 @@ export interface TraceTimelineProps {
|
|
|
115
116
|
showGridlines?: boolean;
|
|
116
117
|
/** Toolbar row with the zoom −/%/+/Fit controls. @default true */
|
|
117
118
|
showControls?: boolean;
|
|
119
|
+
/**
|
|
120
|
+
* How the mouse wheel / trackpad zooms the timeline: `'ctrl'` zooms only
|
|
121
|
+
* while Ctrl/Cmd is held (plain scrolling passes through to the page;
|
|
122
|
+
* trackpad pinch still zooms), `'free'` zooms on any scroll over the
|
|
123
|
+
* canvas, `'none'` disables wheel zoom entirely — the toolbar buttons
|
|
124
|
+
* still work.
|
|
125
|
+
* @default 'ctrl'
|
|
126
|
+
*/
|
|
127
|
+
wheelZoom?: TimelineWheelZoom;
|
|
118
128
|
/** Colored dot + name legend for the services present. @default true */
|
|
119
129
|
showLegend?: boolean;
|
|
120
130
|
/**
|