@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,13 +1,13 @@
|
|
|
1
|
-
import { jsx as l, jsxs as
|
|
2
|
-
import { forwardRef as
|
|
1
|
+
import { jsx as l, jsxs as c, Fragment as ne } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as ct, useRef as L, useState as S, useCallback as j, useEffect as dt, useMemo as xe, useLayoutEffect as ut } from "react";
|
|
3
3
|
import f from "clsx";
|
|
4
4
|
import r from "./Timeline.module.scss.js";
|
|
5
5
|
import i from "./HistoryTimeline.module.scss.js";
|
|
6
|
-
import { TIMELINE_PALETTE_VARS as m, fmtDateTime as
|
|
7
|
-
import { computeHistoryLayout as
|
|
8
|
-
import { TimelineSummary as
|
|
9
|
-
import { useNowTicker as
|
|
10
|
-
const
|
|
6
|
+
import { TIMELINE_PALETTE_VARS as m, fmtDateTime as A, eventMatches as mt, fmtDur as D, tint as ht, fmtDate as pt, fmtClock as ke, ticks as ft, DAY as E } from "./timelineCore.js";
|
|
7
|
+
import { computeHistoryLayout as gt } from "./historyLayout.js";
|
|
8
|
+
import { TimelineSummary as vt, TimelineSegmented as He, TimelineZoomControls as wt, TimelineLegend as yt, HighlightText as Me, TimelineTooltip as Nt } from "./TimelineShared.js";
|
|
9
|
+
import { useNowTicker as bt, useContainerWidth as St, useTimelinePan as Tt, useWheelZoom as xt, animateScrollTo as kt, wheelZoomAllowed as Ht } from "./useTimeline.js";
|
|
10
|
+
const Mt = {
|
|
11
11
|
created: m[0],
|
|
12
12
|
done: m[0],
|
|
13
13
|
live: m[0],
|
|
@@ -22,7 +22,7 @@ const kt = {
|
|
|
22
22
|
interview: m[4],
|
|
23
23
|
exception: "var(--crk-timeline-danger, #b3372f)",
|
|
24
24
|
alert: "var(--crk-timeline-danger, #b3372f)"
|
|
25
|
-
},
|
|
25
|
+
}, Vt = ct(
|
|
26
26
|
function(Ce, Le) {
|
|
27
27
|
const {
|
|
28
28
|
events: le,
|
|
@@ -30,50 +30,51 @@ const kt = {
|
|
|
30
30
|
orientation: ie,
|
|
31
31
|
defaultOrientation: De,
|
|
32
32
|
onOrientationChange: Ee,
|
|
33
|
-
spacing:
|
|
33
|
+
spacing: re,
|
|
34
34
|
defaultSpacing: Pe = "equal",
|
|
35
35
|
onSpacingChange: Oe,
|
|
36
|
-
highlight:
|
|
36
|
+
highlight: q,
|
|
37
37
|
defaultHighlight: We,
|
|
38
38
|
onHighlightChange: Re,
|
|
39
|
-
showSearch:
|
|
40
|
-
renderSearch:
|
|
39
|
+
showSearch: Ae = !0,
|
|
40
|
+
renderSearch: ae,
|
|
41
41
|
tagColors: se,
|
|
42
42
|
showControls: ce = !0,
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
wheelZoom: Fe = "ctrl",
|
|
44
|
+
showLegend: Ve = !0,
|
|
45
|
+
showSummary: F = !1,
|
|
45
46
|
summaryPlacement: T = "left",
|
|
46
|
-
summaryDefaultPosition:
|
|
47
|
+
summaryDefaultPosition: ze,
|
|
47
48
|
maxHeight: de,
|
|
48
|
-
selectedEventId:
|
|
49
|
-
defaultSelectedEventId:
|
|
50
|
-
onEventSelect:
|
|
49
|
+
selectedEventId: X,
|
|
50
|
+
defaultSelectedEventId: Ie = null,
|
|
51
|
+
onEventSelect: Ye,
|
|
51
52
|
renderCard: ue,
|
|
52
53
|
renderTooltip: V,
|
|
53
54
|
renderDetails: K,
|
|
54
55
|
classes: h,
|
|
55
|
-
className:
|
|
56
|
+
className: Ze,
|
|
56
57
|
style: je
|
|
57
58
|
} = Ce, w = L(null), [qe, Xe] = S(
|
|
58
59
|
() => De ?? (typeof window < "u" && window.innerWidth < 700 ? "vertical" : "horizontal")
|
|
59
|
-
), z = ie ?? qe, y = z === "horizontal", [
|
|
60
|
-
fe.current =
|
|
61
|
-
const G = L(null), B =
|
|
60
|
+
), z = ie ?? qe, y = z === "horizontal", [Ke, Ue] = S(Pe), U = re ?? Ke, [_e, me] = S(1), [he, pe] = S(!0), [b, _] = S(null), [Ge, Be] = S(Ie), P = X !== void 0 ? X : Ge, [N, Je] = S({ l: 0, t: 0, w: 0, h: 0 }), fe = L(F);
|
|
61
|
+
fe.current = F;
|
|
62
|
+
const G = L(null), B = j(() => {
|
|
62
63
|
const e = w.current;
|
|
63
|
-
e &&
|
|
64
|
+
e && Je(
|
|
64
65
|
(n) => n.l === e.scrollLeft && n.t === e.scrollTop && n.w === e.clientWidth && n.h === e.clientHeight ? n : { l: e.scrollLeft, t: e.scrollTop, w: e.clientWidth, h: e.clientHeight }
|
|
65
66
|
);
|
|
66
|
-
}, []),
|
|
67
|
+
}, []), $e = j(() => {
|
|
67
68
|
!fe.current || G.current != null || (G.current = requestAnimationFrame(() => {
|
|
68
69
|
G.current = null, B();
|
|
69
70
|
}));
|
|
70
71
|
}, [B]);
|
|
71
|
-
|
|
72
|
-
|
|
72
|
+
dt(() => {
|
|
73
|
+
F && B();
|
|
73
74
|
});
|
|
74
|
-
const [
|
|
75
|
-
|
|
76
|
-
}, ve =
|
|
75
|
+
const [Qe, et] = S(We ?? ""), J = q !== void 0 ? q : Qe, x = J.trim(), ge = (e) => {
|
|
76
|
+
q === void 0 && et(e), Re?.(e);
|
|
77
|
+
}, ve = ae ? ae({ value: J, setValue: ge }) : Ae ? /* @__PURE__ */ l(
|
|
77
78
|
"input",
|
|
78
79
|
{
|
|
79
80
|
className: f(r.searchInput, h?.search),
|
|
@@ -82,22 +83,22 @@ const kt = {
|
|
|
82
83
|
value: J,
|
|
83
84
|
onChange: (e) => ge(e.target.value)
|
|
84
85
|
}
|
|
85
|
-
) : null,
|
|
86
|
+
) : null, d = xe(
|
|
86
87
|
() => le.map((e) => ({
|
|
87
88
|
...e,
|
|
88
89
|
end: e.end !== void 0 ? e.end : e.ongoing ? null : e.start
|
|
89
90
|
})).sort((e, n) => e.start - n.start),
|
|
90
91
|
[le]
|
|
91
|
-
),
|
|
92
|
+
), tt = d.some((e) => e.end == null), k = bt(tt, 500), nt = St(w), O = Tt(w), M = j(
|
|
92
93
|
(e) => {
|
|
93
|
-
const n = e || "event", t = { ...
|
|
94
|
+
const n = e || "event", t = { ...Mt, ...se };
|
|
94
95
|
if (t[n]) return t[n];
|
|
95
96
|
const o = String(n).charCodeAt(0) || 0;
|
|
96
97
|
return m[(String(n).length + o) % m.length];
|
|
97
98
|
},
|
|
98
99
|
[se]
|
|
99
|
-
), s =
|
|
100
|
-
|
|
100
|
+
), s = gt(
|
|
101
|
+
d.map((e) => ({
|
|
101
102
|
id: e.id,
|
|
102
103
|
title: String(e.title || ""),
|
|
103
104
|
detail: String(e.detail || ""),
|
|
@@ -107,30 +108,31 @@ const kt = {
|
|
|
107
108
|
{
|
|
108
109
|
orientation: z,
|
|
109
110
|
spacing: U,
|
|
110
|
-
containerWidth:
|
|
111
|
+
containerWidth: nt,
|
|
111
112
|
viewportHeight: typeof window < "u" && window.innerHeight || 800,
|
|
112
113
|
now: k,
|
|
113
|
-
k: he ? "fit" :
|
|
114
|
+
k: he ? "fit" : _e
|
|
114
115
|
}
|
|
115
116
|
), I = new Map(s.items.map((e) => [e.id, e])), we = L(s.kFit), ye = L(s.kEff);
|
|
116
117
|
we.current = s.kFit, ye.current = s.kEff;
|
|
117
118
|
const H = L(null);
|
|
118
|
-
|
|
119
|
+
ut(() => {
|
|
119
120
|
const e = w.current;
|
|
120
121
|
H.current && e && (H.current.left != null && (e.scrollLeft = H.current.left), H.current.top != null && (e.scrollTop = H.current.top), H.current = null);
|
|
121
122
|
});
|
|
122
|
-
const $ =
|
|
123
|
+
const $ = j(
|
|
123
124
|
(e, n) => {
|
|
124
125
|
const t = w.current;
|
|
125
126
|
if (!t) return;
|
|
126
|
-
const o = we.current || 1, p = ye.current || 1,
|
|
127
|
-
H.current = y ? { left: (g + n) * v - n } : { top: (g + n) * v - n }, pe(!1), me(
|
|
127
|
+
const o = we.current || 1, p = ye.current || 1, u = Math.max(o * 0.3, Math.min(Math.max(o, 1) * 40, p * e)), g = y ? t.scrollLeft : t.scrollTop, v = u / p;
|
|
128
|
+
H.current = y ? { left: (g + n) * v - n } : { top: (g + n) * v - n }, pe(!1), me(u);
|
|
128
129
|
},
|
|
129
130
|
[y]
|
|
130
131
|
);
|
|
131
|
-
|
|
132
|
+
xt(
|
|
132
133
|
w,
|
|
133
134
|
(e) => {
|
|
135
|
+
if (!Ht(Fe, e)) return;
|
|
134
136
|
e.preventDefault();
|
|
135
137
|
const n = w.current;
|
|
136
138
|
if (!n) return;
|
|
@@ -143,53 +145,53 @@ const kt = {
|
|
|
143
145
|
const e = w.current;
|
|
144
146
|
return e ? y ? e.clientWidth / 2 : e.clientHeight / 2 : 300;
|
|
145
147
|
}, Q = (e) => {
|
|
146
|
-
|
|
147
|
-
}, nt = (e) => {
|
|
148
|
-
ie === void 0 && Xe(e), Ee?.(e);
|
|
148
|
+
X === void 0 && Be(e ? e.id : null), Ye?.(e);
|
|
149
149
|
}, lt = (e) => {
|
|
150
|
-
|
|
150
|
+
ie === void 0 && Xe(e), Ee?.(e);
|
|
151
151
|
}, ot = (e) => {
|
|
152
|
+
re === void 0 && Ue(e), Oe?.(e);
|
|
153
|
+
}, it = (e) => {
|
|
152
154
|
const n = window.innerWidth || 1200, t = window.innerHeight || 800, o = e.clientX < n * 0.55 ? Math.max(12, n - 340) : 16, p = Math.max(130, Math.min(e.clientY, t - 130));
|
|
153
155
|
return { x: o, y: p };
|
|
154
|
-
}, W =
|
|
156
|
+
}, W = d.length ? d[0].start : k, rt = d.length ? Math.max(W + 1, ...d.map((e) => e.end == null ? k : Math.max(e.end, e.start))) : k + 1, Y = Math.max(1, rt - W), be = (e, n) => {
|
|
155
157
|
const t = new Date(e);
|
|
156
|
-
return n === "y" ? String(t.getFullYear()) : n === "my" ? t.toLocaleString("en", { month: "short" }) + " " + t.getFullYear() : n === "d" ?
|
|
158
|
+
return n === "y" ? String(t.getFullYear()) : n === "my" ? t.toLocaleString("en", { month: "short" }) + " " + t.getFullYear() : n === "d" ? pt(e) : n === "cms" ? ke(e, !0) : ke(e);
|
|
157
159
|
};
|
|
158
160
|
let ee = [];
|
|
159
161
|
if (U === "proportional" && s.mapT) {
|
|
160
|
-
const e = s.mapT, n = e(W), t = y ? s.innerW : s.innerH, o = W + (t - n) / Math.max(1, s.innerSpan) * Y, p =
|
|
162
|
+
const e = s.mapT, n = e(W), t = y ? s.innerW : s.innerH, o = W + (t - n) / Math.max(1, s.innerSpan) * Y, p = ft(W, o, Math.max(200, t - n), 90), u = p.step >= 360 * E ? "y" : p.step >= 28 * E ? "my" : p.step >= E ? "d" : p.step < 1e3 ? "cms" : "c";
|
|
161
163
|
ee = p.list.map((g) => ({
|
|
162
164
|
pos: Math.round(e(g.t)),
|
|
163
|
-
label: be(g.t,
|
|
165
|
+
label: be(g.t, u)
|
|
164
166
|
}));
|
|
165
167
|
} else {
|
|
166
168
|
const e = Y > 550 * E ? "y" : Y > 60 * E ? "my" : Y > 2 * E ? "d" : "c", n = y ? 72 : 18;
|
|
167
169
|
let t = null, o = -1e9;
|
|
168
|
-
|
|
169
|
-
const g = be(p.start, e), v = Math.round(s.posArr[
|
|
170
|
+
d.forEach((p, u) => {
|
|
171
|
+
const g = be(p.start, e), v = Math.round(s.posArr[u]);
|
|
170
172
|
g !== t && v - o >= n && (ee.push({ pos: v, label: g }), t = g, o = v);
|
|
171
173
|
});
|
|
172
174
|
}
|
|
173
175
|
const at = xe(() => {
|
|
174
176
|
const e = [];
|
|
175
|
-
return
|
|
177
|
+
return d.forEach((n) => {
|
|
176
178
|
const t = n.tag || "event";
|
|
177
179
|
e.includes(t) || e.push(t);
|
|
178
180
|
}), e;
|
|
179
|
-
}, [
|
|
180
|
-
|
|
181
|
+
}, [d]), a = P != null && d.find((e) => e.id === P) || null, Se = a ? a.end == null : !1, R = F ? /* @__PURE__ */ l(
|
|
182
|
+
vt,
|
|
181
183
|
{
|
|
182
184
|
className: h?.summary,
|
|
183
185
|
placement: T,
|
|
184
|
-
floatingDefaultPosition:
|
|
185
|
-
items:
|
|
186
|
+
floatingDefaultPosition: ze,
|
|
187
|
+
items: d.map((e, n) => {
|
|
186
188
|
const t = I.get(e.id), o = !t || !N.w && !N.h ? !0 : (!N.w || t.cardLeft < N.l + N.w && t.cardLeft + t.cardW > N.l) && (!N.h || t.cardTop < N.t + N.h && t.cardTop + t.cardH > N.t);
|
|
187
189
|
return {
|
|
188
190
|
id: e.id,
|
|
189
191
|
number: String(n + 1).padStart(2, "0"),
|
|
190
192
|
label: e.title,
|
|
191
193
|
color: M(e.tag),
|
|
192
|
-
time:
|
|
194
|
+
time: A(e.start),
|
|
193
195
|
inView: o,
|
|
194
196
|
selected: P === e.id
|
|
195
197
|
};
|
|
@@ -198,15 +200,15 @@ const kt = {
|
|
|
198
200
|
const n = I.get(e), t = w.current;
|
|
199
201
|
if (!n || !t) return;
|
|
200
202
|
const o = {};
|
|
201
|
-
(t.clientWidth || !t.clientHeight) && (o.left = Math.max(0, n.dotX - t.clientWidth / 2)), t.clientHeight && (o.top = Math.max(0, n.dotY - t.clientHeight / 2)),
|
|
203
|
+
(t.clientWidth || !t.clientHeight) && (o.left = Math.max(0, n.dotX - t.clientWidth / 2)), t.clientHeight && (o.top = Math.max(0, n.dotY - t.clientHeight / 2)), kt(t, o);
|
|
202
204
|
}
|
|
203
205
|
}
|
|
204
206
|
) : null;
|
|
205
|
-
return /* @__PURE__ */
|
|
206
|
-
(ce || ve) && /* @__PURE__ */
|
|
207
|
+
return /* @__PURE__ */ c("div", { ref: Le, className: f(r.root, h?.root, Ze), style: je, children: [
|
|
208
|
+
(ce || ve) && /* @__PURE__ */ c("div", { className: f(r.toolbar, h?.toolbar), children: [
|
|
207
209
|
/* @__PURE__ */ l("div", { className: r.toolbarText }),
|
|
208
210
|
ve,
|
|
209
|
-
ce && /* @__PURE__ */
|
|
211
|
+
ce && /* @__PURE__ */ c(ne, { children: [
|
|
210
212
|
/* @__PURE__ */ l(
|
|
211
213
|
He,
|
|
212
214
|
{
|
|
@@ -215,7 +217,7 @@ const kt = {
|
|
|
215
217
|
{ value: "horizontal", label: "Horizontal" },
|
|
216
218
|
{ value: "vertical", label: "Vertical" }
|
|
217
219
|
],
|
|
218
|
-
onChange:
|
|
220
|
+
onChange: lt
|
|
219
221
|
}
|
|
220
222
|
),
|
|
221
223
|
/* @__PURE__ */ l(
|
|
@@ -231,11 +233,11 @@ const kt = {
|
|
|
231
233
|
},
|
|
232
234
|
{ value: "proportional", label: "Proportional" }
|
|
233
235
|
],
|
|
234
|
-
onChange:
|
|
236
|
+
onChange: ot
|
|
235
237
|
}
|
|
236
238
|
),
|
|
237
239
|
/* @__PURE__ */ l(
|
|
238
|
-
|
|
240
|
+
wt,
|
|
239
241
|
{
|
|
240
242
|
zoomPct: `${Math.round(s.kEff / s.kFit * 100)}%`,
|
|
241
243
|
fitActive: he,
|
|
@@ -248,146 +250,148 @@ const kt = {
|
|
|
248
250
|
)
|
|
249
251
|
] })
|
|
250
252
|
] }),
|
|
251
|
-
|
|
252
|
-
|
|
253
|
+
Ve && /* @__PURE__ */ l(
|
|
254
|
+
yt,
|
|
253
255
|
{
|
|
254
256
|
className: h?.legend,
|
|
255
257
|
items: at.map((e) => ({ name: e, color: M(e) }))
|
|
256
258
|
}
|
|
257
259
|
),
|
|
258
260
|
T === "top" && R,
|
|
259
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ c("div", { className: r.layout, children: [
|
|
260
262
|
T === "left" && R,
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
263
|
-
"div",
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
(
|
|
285
|
-
/* @__PURE__ */
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
/* @__PURE__ */
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
te
|
|
318
|
-
)),
|
|
319
|
-
/* @__PURE__ */ l(
|
|
320
|
-
"span",
|
|
321
|
-
{
|
|
322
|
-
className: f(i.dot, h?.dot),
|
|
323
|
-
style: { left: t.dotX, top: t.dotY, borderColor: j }
|
|
324
|
-
}
|
|
325
|
-
),
|
|
326
|
-
/* @__PURE__ */ l(
|
|
327
|
-
"div",
|
|
328
|
-
{
|
|
329
|
-
className: f(i.eventCard, h?.eventCard),
|
|
330
|
-
style: {
|
|
331
|
-
left: t.cardLeft,
|
|
332
|
-
top: t.cardTop,
|
|
333
|
-
width: t.cardW,
|
|
334
|
-
height: t.cardH,
|
|
335
|
-
opacity: x && !v ? 0.3 : 1,
|
|
336
|
-
background: x && v ? "var(--crk-timeline-hl-wash-soft, #fff9e8)" : void 0,
|
|
337
|
-
borderColor: x && v ? "var(--crk-timeline-hl-border, #e8b931)" : void 0,
|
|
338
|
-
boxShadow: x && v ? "0 0 0 3px #f9e9b8" : "0 1px 3px rgba(35,32,28,.06)"
|
|
339
|
-
},
|
|
340
|
-
onClick: () => {
|
|
341
|
-
O.wasDragSuppressed() || (_(null), Q(P === e.id ? null : e));
|
|
342
|
-
},
|
|
343
|
-
onMouseEnter: (C) => {
|
|
344
|
-
if (P === e.id) return;
|
|
345
|
-
const te = (e.detail || "").length > 80;
|
|
346
|
-
if (!V && !te && !o) return;
|
|
347
|
-
const rt = ot(C);
|
|
348
|
-
_({
|
|
349
|
-
...rt,
|
|
350
|
-
id: e.id,
|
|
351
|
-
title: e.title,
|
|
352
|
-
time: F(e.start),
|
|
353
|
-
durLine: o ? "ongoing · " + D(d) + " so far" : d > 0 ? "duration " + D(d) : "instant event",
|
|
354
|
-
detail: e.detail || ""
|
|
355
|
-
});
|
|
263
|
+
/* @__PURE__ */ c("div", { className: r.main, children: [
|
|
264
|
+
/* @__PURE__ */ c("div", { className: r.cardWrap, children: [
|
|
265
|
+
/* @__PURE__ */ l("div", { className: f(r.card, h?.card), children: /* @__PURE__ */ l(
|
|
266
|
+
"div",
|
|
267
|
+
{
|
|
268
|
+
ref: w,
|
|
269
|
+
className: f(
|
|
270
|
+
r.scroller,
|
|
271
|
+
y ? i.scrollerH : i.scrollerV,
|
|
272
|
+
h?.scroller
|
|
273
|
+
),
|
|
274
|
+
style: de != null ? { maxHeight: de } : void 0,
|
|
275
|
+
onPointerDown: O.onPointerDown,
|
|
276
|
+
onPointerMove: O.onPointerMove,
|
|
277
|
+
onPointerUp: O.onPointerUp,
|
|
278
|
+
onPointerLeave: O.onPointerUp,
|
|
279
|
+
onScroll: $e,
|
|
280
|
+
children: /* @__PURE__ */ c(
|
|
281
|
+
"div",
|
|
282
|
+
{
|
|
283
|
+
className: i.inner,
|
|
284
|
+
style: { width: s.innerW, height: s.innerH },
|
|
285
|
+
children: [
|
|
286
|
+
ee.map(
|
|
287
|
+
(e, n) => y ? /* @__PURE__ */ c("span", { children: [
|
|
288
|
+
/* @__PURE__ */ l("span", { className: i.gridlineH, style: { left: e.pos } }),
|
|
289
|
+
/* @__PURE__ */ l("span", { className: i.tickLabelH, style: { left: e.pos }, children: e.label })
|
|
290
|
+
] }, n) : /* @__PURE__ */ c("span", { children: [
|
|
291
|
+
/* @__PURE__ */ l("span", { className: i.gridlineV, style: { top: e.pos } }),
|
|
292
|
+
/* @__PURE__ */ l("span", { className: i.tickLabelV, style: { top: e.pos }, children: e.label })
|
|
293
|
+
] }, n)
|
|
294
|
+
),
|
|
295
|
+
y ? /* @__PURE__ */ l("div", { className: i.axisH, style: { top: s.axisY } }) : /* @__PURE__ */ l("div", { className: i.axisV, style: { left: s.axisX } }),
|
|
296
|
+
d.map((e, n) => {
|
|
297
|
+
const t = I.get(e.id);
|
|
298
|
+
if (!t) return null;
|
|
299
|
+
const o = e.end == null, u = (o ? k : e.end) - e.start, g = o || u > 0, v = mt(e, x), Z = M(e.tag), Te = {
|
|
300
|
+
index: n,
|
|
301
|
+
number: String(n + 1).padStart(2, "0"),
|
|
302
|
+
color: Z,
|
|
303
|
+
ongoing: o,
|
|
304
|
+
condensed: t.condensed,
|
|
305
|
+
durationMs: u
|
|
306
|
+
};
|
|
307
|
+
return /* @__PURE__ */ c("span", { children: [
|
|
308
|
+
t.segs.map((C, te) => /* @__PURE__ */ l(
|
|
309
|
+
"span",
|
|
310
|
+
{
|
|
311
|
+
className: i.seg,
|
|
312
|
+
style: {
|
|
313
|
+
left: C.l,
|
|
314
|
+
top: C.t,
|
|
315
|
+
width: C.w,
|
|
316
|
+
height: C.h,
|
|
317
|
+
background: Z
|
|
318
|
+
}
|
|
356
319
|
},
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
320
|
+
te
|
|
321
|
+
)),
|
|
322
|
+
/* @__PURE__ */ l(
|
|
323
|
+
"span",
|
|
324
|
+
{
|
|
325
|
+
className: f(i.dot, h?.dot),
|
|
326
|
+
style: { left: t.dotX, top: t.dotY, borderColor: Z }
|
|
327
|
+
}
|
|
328
|
+
),
|
|
329
|
+
/* @__PURE__ */ l(
|
|
330
|
+
"div",
|
|
331
|
+
{
|
|
332
|
+
className: f(i.eventCard, h?.eventCard),
|
|
333
|
+
style: {
|
|
334
|
+
left: t.cardLeft,
|
|
335
|
+
top: t.cardTop,
|
|
336
|
+
width: t.cardW,
|
|
337
|
+
height: t.cardH,
|
|
338
|
+
opacity: x && !v ? 0.3 : 1,
|
|
339
|
+
background: x && v ? "var(--crk-timeline-hl-wash-soft, #fff9e8)" : void 0,
|
|
340
|
+
borderColor: x && v ? "var(--crk-timeline-hl-border, #e8b931)" : void 0,
|
|
341
|
+
boxShadow: x && v ? "0 0 0 3px #f9e9b8" : "0 1px 3px rgba(35,32,28,.06)"
|
|
342
|
+
},
|
|
343
|
+
onClick: () => {
|
|
344
|
+
O.wasDragSuppressed() || (_(null), Q(P === e.id ? null : e));
|
|
345
|
+
},
|
|
346
|
+
onMouseEnter: (C) => {
|
|
347
|
+
if (P === e.id) return;
|
|
348
|
+
const te = (e.detail || "").length > 80;
|
|
349
|
+
if (!V && !te && !o) return;
|
|
350
|
+
const st = it(C);
|
|
351
|
+
_({
|
|
352
|
+
...st,
|
|
353
|
+
id: e.id,
|
|
354
|
+
title: e.title,
|
|
355
|
+
time: A(e.start),
|
|
356
|
+
durLine: o ? "ongoing · " + D(u) + " so far" : u > 0 ? "duration " + D(u) : "instant event",
|
|
357
|
+
detail: e.detail || ""
|
|
358
|
+
});
|
|
359
|
+
},
|
|
360
|
+
onMouseLeave: () => _(null),
|
|
361
|
+
children: ue ? ue(e, Te) : /* @__PURE__ */ c(ne, { children: [
|
|
362
|
+
/* @__PURE__ */ c("div", { className: i.cardTitle, children: [
|
|
363
|
+
/* @__PURE__ */ l("span", { className: i.cardNum, children: Te.number }),
|
|
364
|
+
" ",
|
|
365
|
+
/* @__PURE__ */ l("span", { className: i.cardTagDot, style: { background: Z } }),
|
|
366
|
+
/* @__PURE__ */ l(Me, { text: e.title, query: x }),
|
|
367
|
+
o && /* @__PURE__ */ l("span", { className: f(r.pulseDot, i.cardOngoingDot) })
|
|
368
|
+
] }),
|
|
369
|
+
/* @__PURE__ */ l("div", { className: i.cardTime, children: A(e.start) }),
|
|
370
|
+
!t.condensed && !!e.detail && /* @__PURE__ */ l("div", { className: i.cardDetail, children: /* @__PURE__ */ l(Me, { text: e.detail, query: x }) }),
|
|
371
|
+
g && /* @__PURE__ */ l("div", { className: i.cardDur, children: o ? "ongoing · " + D(u) : "took " + D(u) })
|
|
372
|
+
] })
|
|
373
|
+
}
|
|
374
|
+
)
|
|
375
|
+
] }, e.id);
|
|
376
|
+
})
|
|
377
|
+
]
|
|
378
|
+
}
|
|
379
|
+
)
|
|
380
|
+
}
|
|
381
|
+
) }),
|
|
382
|
+
T === "bubble" && R
|
|
383
|
+
] }),
|
|
384
|
+
/* @__PURE__ */ l("div", { className: f(r.footnote, h?.footnote), children: "Click a card to open details in the side panel · scroll zooms · drag pans · overlapping events stack around the axis with Z-shaped leads" })
|
|
381
385
|
] }),
|
|
382
386
|
a && K && /* @__PURE__ */ l("aside", { className: f(r.aside, i.drawer, h?.drawer), children: K(a, { close: () => Q(null), ongoing: Se }) }),
|
|
383
|
-
a && !K && /* @__PURE__ */
|
|
384
|
-
/* @__PURE__ */
|
|
387
|
+
a && !K && /* @__PURE__ */ c("aside", { className: f(r.aside, i.drawer, h?.drawer), children: [
|
|
388
|
+
/* @__PURE__ */ c("div", { className: i.drawerHead, children: [
|
|
385
389
|
/* @__PURE__ */ l(
|
|
386
390
|
"span",
|
|
387
391
|
{
|
|
388
392
|
className: i.drawerTag,
|
|
389
393
|
style: {
|
|
390
|
-
background:
|
|
394
|
+
background: ht(M(a.tag), 12),
|
|
391
395
|
color: M(a.tag)
|
|
392
396
|
},
|
|
393
397
|
children: a.tag || "event"
|
|
@@ -407,7 +411,7 @@ const kt = {
|
|
|
407
411
|
)
|
|
408
412
|
] }),
|
|
409
413
|
/* @__PURE__ */ l("div", { className: i.drawerTitle, children: a.title }),
|
|
410
|
-
/* @__PURE__ */ l("div", { className: i.drawerTiming, children:
|
|
414
|
+
/* @__PURE__ */ l("div", { className: i.drawerTiming, children: A(a.start) + (Se ? " · ongoing, " + D(k - a.start) + " so far" : a.end > a.start ? " → " + A(a.end) + " · " + D(a.end - a.start) : "") }),
|
|
411
415
|
/* @__PURE__ */ l("div", { className: i.drawerDetail, children: a.detail || "—" }),
|
|
412
416
|
/* @__PURE__ */ l("div", { className: r.asideSection, children: "Raw event" }),
|
|
413
417
|
/* @__PURE__ */ l("pre", { className: r.asideRaw, children: JSON.stringify(a, null, 2) })
|
|
@@ -416,7 +420,7 @@ const kt = {
|
|
|
416
420
|
] }),
|
|
417
421
|
T === "bottom" && R,
|
|
418
422
|
b && (() => {
|
|
419
|
-
const e =
|
|
423
|
+
const e = d.find((o) => o.id === b.id), n = e ? d.indexOf(e) : -1, t = e && V ? V(e, {
|
|
420
424
|
index: n,
|
|
421
425
|
number: String(n + 1).padStart(2, "0"),
|
|
422
426
|
color: M(e.tag),
|
|
@@ -424,7 +428,7 @@ const kt = {
|
|
|
424
428
|
condensed: I.get(e.id)?.condensed ?? !1,
|
|
425
429
|
durationMs: (e.end == null ? k : e.end) - e.start
|
|
426
430
|
}) : void 0;
|
|
427
|
-
return V && t == null ? null : /* @__PURE__ */ l(
|
|
431
|
+
return V && t == null ? null : /* @__PURE__ */ l(Nt, { x: b.x, y: b.y, className: h?.tooltip, children: t !== void 0 ? t : /* @__PURE__ */ c(ne, { children: [
|
|
428
432
|
/* @__PURE__ */ l("div", { className: r.tooltipTitle, children: b.title }),
|
|
429
433
|
/* @__PURE__ */ l(
|
|
430
434
|
"div",
|
|
@@ -442,5 +446,5 @@ const kt = {
|
|
|
442
446
|
}
|
|
443
447
|
);
|
|
444
448
|
export {
|
|
445
|
-
|
|
449
|
+
Vt as HistoryTimeline
|
|
446
450
|
};
|