@overdoser/react-toolkit 0.10.1 → 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.
@@ -1,13 +1,13 @@
1
- import { jsx as l, jsxs as u, Fragment as ne } from "react/jsx-runtime";
2
- import { forwardRef as st, useRef as L, useState as b, useCallback as q, useEffect as ct, useMemo as xe, useLayoutEffect as dt } from "react";
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 R, eventMatches as ut, fmtDur as D, tint as mt, fmtDate as ht, fmtClock as ke, ticks as pt, DAY as E } from "./timelineCore.js";
7
- import { computeHistoryLayout as ft } from "./historyLayout.js";
8
- import { TimelineSummary as gt, TimelineSegmented as He, TimelineZoomControls as vt, TimelineLegend as wt, HighlightText as Me, TimelineTooltip as yt } from "./TimelineShared.js";
9
- import { useNowTicker as Nt, useContainerWidth as St, useTimelinePan as bt, useWheelZoom as Tt, animateScrollTo as xt } from "./useTimeline.js";
10
- const kt = {
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
- }, Ft = st(
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: ae,
33
+ spacing: re,
34
34
  defaultSpacing: Pe = "equal",
35
35
  onSpacingChange: Oe,
36
- highlight: X,
36
+ highlight: q,
37
37
  defaultHighlight: We,
38
38
  onHighlightChange: Re,
39
- showSearch: Fe = !0,
40
- renderSearch: re,
39
+ showSearch: Ae = !0,
40
+ renderSearch: ae,
41
41
  tagColors: se,
42
42
  showControls: ce = !0,
43
- showLegend: Ae = !0,
43
+ wheelZoom: Fe = "ctrl",
44
+ showLegend: Ve = !0,
44
45
  showSummary: F = !1,
45
- summaryPlacement: H = "left",
46
- summaryDefaultPosition: Ve,
46
+ summaryPlacement: T = "left",
47
+ summaryDefaultPosition: ze,
47
48
  maxHeight: de,
48
- selectedEventId: Z,
49
- defaultSelectedEventId: ze = null,
50
- onEventSelect: Ie,
49
+ selectedEventId: X,
50
+ defaultSelectedEventId: Ie = null,
51
+ onEventSelect: Ye,
51
52
  renderCard: ue,
52
- renderTooltip: A,
53
+ renderTooltip: V,
53
54
  renderDetails: K,
54
55
  classes: h,
55
- className: Ye,
56
+ className: Ze,
56
57
  style: je
57
- } = Ce, w = L(null), [qe, Xe] = b(
58
+ } = Ce, w = L(null), [qe, Xe] = S(
58
59
  () => De ?? (typeof window < "u" && window.innerWidth < 700 ? "vertical" : "horizontal")
59
- ), V = ie ?? qe, y = V === "horizontal", [Ze, Ke] = b(Pe), U = ae ?? Ze, [Ue, me] = b(1), [he, pe] = b(!0), [S, _] = b(null), [_e, Ge] = b(ze), P = Z !== void 0 ? Z : _e, [N, Be] = b({ l: 0, t: 0, w: 0, h: 0 }), fe = L(F);
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);
60
61
  fe.current = F;
61
- const G = L(null), B = q(() => {
62
+ const G = L(null), B = j(() => {
62
63
  const e = w.current;
63
- e && Be(
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
- }, []), Je = q(() => {
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
- ct(() => {
72
+ dt(() => {
72
73
  F && B();
73
74
  });
74
- const [$e, Qe] = b(We ?? ""), J = X !== void 0 ? X : $e, T = J.trim(), ge = (e) => {
75
- X === void 0 && Qe(e), Re?.(e);
76
- }, ve = re ? re({ value: J, setValue: ge }) : Fe ? /* @__PURE__ */ l(
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, c = xe(
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
- ), et = c.some((e) => e.end == null), x = Nt(et, 500), tt = St(w), O = bt(w), M = q(
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 = { ...kt, ...se };
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 = ft(
100
- c.map((e) => ({
100
+ ), s = gt(
101
+ d.map((e) => ({
101
102
  id: e.id,
102
103
  title: String(e.title || ""),
103
104
  detail: String(e.detail || ""),
@@ -105,117 +106,118 @@ const kt = {
105
106
  end: e.end ?? null
106
107
  })),
107
108
  {
108
- orientation: V,
109
+ orientation: z,
109
110
  spacing: U,
110
- containerWidth: tt,
111
+ containerWidth: nt,
111
112
  viewportHeight: typeof window < "u" && window.innerHeight || 800,
112
- now: x,
113
- k: he ? "fit" : Ue
113
+ now: k,
114
+ k: he ? "fit" : _e
114
115
  }
115
- ), z = new Map(s.items.map((e) => [e.id, e])), we = L(s.kFit), ye = L(s.kEff);
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
- const k = L(null);
118
- dt(() => {
118
+ const H = L(null);
119
+ ut(() => {
119
120
  const e = w.current;
120
- k.current && e && (k.current.left != null && (e.scrollLeft = k.current.left), k.current.top != null && (e.scrollTop = k.current.top), k.current = null);
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 $ = q(
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, d = Math.max(o * 0.3, Math.min(Math.max(o, 1) * 40, p * e)), g = y ? t.scrollLeft : t.scrollTop, v = d / p;
127
- k.current = y ? { left: (g + n) * v - n } : { top: (g + n) * v - n }, pe(!1), me(d);
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
- Tt(
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;
137
139
  const t = n.getBoundingClientRect(), o = y ? e.clientX - t.left : e.clientY - t.top;
138
140
  $(Math.exp(-(e.deltaY || e.deltaX) * 22e-4), o);
139
141
  },
140
- V
142
+ z
141
143
  );
142
144
  const Ne = () => {
143
145
  const e = w.current;
144
146
  return e ? y ? e.clientWidth / 2 : e.clientHeight / 2 : 300;
145
147
  }, Q = (e) => {
146
- Z === void 0 && Ge(e ? e.id : null), Ie?.(e);
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
- ae === void 0 && Ke(e), Oe?.(e);
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 = c.length ? c[0].start : x, it = c.length ? Math.max(W + 1, ...c.map((e) => e.end == null ? x : Math.max(e.end, e.start))) : x + 1, I = Math.max(1, it - W), Se = (e, n) => {
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" ? ht(e) : n === "cms" ? ke(e, !0) : ke(e);
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) * I, p = pt(W, o, Math.max(200, t - n), 90), d = p.step >= 360 * E ? "y" : p.step >= 28 * E ? "my" : p.step >= E ? "d" : p.step < 1e3 ? "cms" : "c";
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: Se(g.t, d)
165
+ label: be(g.t, u)
164
166
  }));
165
167
  } else {
166
- const e = I > 550 * E ? "y" : I > 60 * E ? "my" : I > 2 * E ? "d" : "c", n = y ? 72 : 18;
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
- c.forEach((p, d) => {
169
- const g = Se(p.start, e), v = Math.round(s.posArr[d]);
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 c.forEach((n) => {
177
+ return d.forEach((n) => {
176
178
  const t = n.tag || "event";
177
179
  e.includes(t) || e.push(t);
178
180
  }), e;
179
- }, [c]), a = P != null && c.find((e) => e.id === P) || null, be = a ? a.end == null : !1, Y = F ? /* @__PURE__ */ l(
180
- gt,
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
- placement: H,
184
- floatingDefaultPosition: Ve,
185
- items: c.map((e, n) => {
186
- const t = z.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);
185
+ placement: T,
186
+ floatingDefaultPosition: ze,
187
+ items: d.map((e, n) => {
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: R(e.start),
194
+ time: A(e.start),
193
195
  inView: o,
194
196
  selected: P === e.id
195
197
  };
196
198
  }),
197
199
  onPick: (e) => {
198
- const n = z.get(e), t = w.current;
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)), xt(t, o);
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__ */ u("div", { ref: Le, className: f(r.root, h?.root, Ye), style: je, children: [
206
- (ce || ve) && /* @__PURE__ */ u("div", { className: f(r.toolbar, h?.toolbar), children: [
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__ */ u(ne, { children: [
211
+ ce && /* @__PURE__ */ c(ne, { children: [
210
212
  /* @__PURE__ */ l(
211
213
  He,
212
214
  {
213
- value: V,
215
+ value: z,
214
216
  options: [
215
217
  { value: "horizontal", label: "Horizontal" },
216
218
  { value: "vertical", label: "Vertical" }
217
219
  ],
218
- onChange: nt
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: lt
236
+ onChange: ot
235
237
  }
236
238
  ),
237
239
  /* @__PURE__ */ l(
238
- vt,
240
+ wt,
239
241
  {
240
242
  zoomPct: `${Math.round(s.kEff / s.kFit * 100)}%`,
241
243
  fitActive: he,
@@ -248,145 +250,148 @@ const kt = {
248
250
  )
249
251
  ] })
250
252
  ] }),
251
- Ae && /* @__PURE__ */ l(
252
- wt,
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
- H === "top" && Y,
259
- /* @__PURE__ */ u("div", { className: r.layout, children: [
260
- H === "left" && Y,
261
- /* @__PURE__ */ u("div", { className: r.main, children: [
262
- /* @__PURE__ */ l("div", { className: f(r.card, h?.card), children: /* @__PURE__ */ l(
263
- "div",
264
- {
265
- ref: w,
266
- className: f(
267
- r.scroller,
268
- y ? i.scrollerH : i.scrollerV,
269
- h?.scroller
270
- ),
271
- style: de != null ? { maxHeight: de } : void 0,
272
- onPointerDown: O.onPointerDown,
273
- onPointerMove: O.onPointerMove,
274
- onPointerUp: O.onPointerUp,
275
- onPointerLeave: O.onPointerUp,
276
- onScroll: Je,
277
- children: /* @__PURE__ */ u(
278
- "div",
279
- {
280
- className: i.inner,
281
- style: { width: s.innerW, height: s.innerH },
282
- children: [
283
- ee.map(
284
- (e, n) => y ? /* @__PURE__ */ u("span", { children: [
285
- /* @__PURE__ */ l("span", { className: i.gridlineH, style: { left: e.pos } }),
286
- /* @__PURE__ */ l("span", { className: i.tickLabelH, style: { left: e.pos }, children: e.label })
287
- ] }, n) : /* @__PURE__ */ u("span", { children: [
288
- /* @__PURE__ */ l("span", { className: i.gridlineV, style: { top: e.pos } }),
289
- /* @__PURE__ */ l("span", { className: i.tickLabelV, style: { top: e.pos }, children: e.label })
290
- ] }, n)
291
- ),
292
- y ? /* @__PURE__ */ l("div", { className: i.axisH, style: { top: s.axisY } }) : /* @__PURE__ */ l("div", { className: i.axisV, style: { left: s.axisX } }),
293
- c.map((e, n) => {
294
- const t = z.get(e.id);
295
- if (!t) return null;
296
- const o = e.end == null, d = (o ? x : e.end) - e.start, g = o || d > 0, v = ut(e, T), j = M(e.tag), Te = {
297
- index: n,
298
- number: String(n + 1).padStart(2, "0"),
299
- color: j,
300
- ongoing: o,
301
- condensed: t.condensed,
302
- durationMs: d
303
- };
304
- return /* @__PURE__ */ u("span", { children: [
305
- t.segs.map((C, te) => /* @__PURE__ */ l(
306
- "span",
307
- {
308
- className: i.seg,
309
- style: {
310
- left: C.l,
311
- top: C.t,
312
- width: C.w,
313
- height: C.h,
314
- background: j
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: T && !v ? 0.3 : 1,
336
- background: T && v ? "var(--crk-timeline-hl-wash-soft, #fff9e8)" : void 0,
337
- borderColor: T && v ? "var(--crk-timeline-hl-border, #e8b931)" : void 0,
338
- boxShadow: T && 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 (!A && !te && !o) return;
347
- const rt = ot(C);
348
- _({
349
- ...rt,
350
- id: e.id,
351
- title: e.title,
352
- time: R(e.start),
353
- durLine: o ? "ongoing · " + D(d) + " so far" : d > 0 ? "duration " + D(d) : "instant event",
354
- detail: e.detail || ""
355
- });
260
+ T === "top" && R,
261
+ /* @__PURE__ */ c("div", { className: r.layout, children: [
262
+ T === "left" && R,
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
- onMouseLeave: () => _(null),
358
- children: ue ? ue(e, Te) : /* @__PURE__ */ u(ne, { children: [
359
- /* @__PURE__ */ u("div", { className: i.cardTitle, children: [
360
- /* @__PURE__ */ l("span", { className: i.cardNum, children: Te.number }),
361
- " ",
362
- /* @__PURE__ */ l("span", { className: i.cardTagDot, style: { background: j } }),
363
- /* @__PURE__ */ l(Me, { text: e.title, query: T }),
364
- o && /* @__PURE__ */ l("span", { className: f(r.pulseDot, i.cardOngoingDot) })
365
- ] }),
366
- /* @__PURE__ */ l("div", { className: i.cardTime, children: R(e.start) }),
367
- !t.condensed && !!e.detail && /* @__PURE__ */ l("div", { className: i.cardDetail, children: /* @__PURE__ */ l(Me, { text: e.detail, query: T }) }),
368
- g && /* @__PURE__ */ l("div", { className: i.cardDur, children: o ? "ongoing · " + D(d) : "took " + D(d) })
369
- ] })
370
- }
371
- )
372
- ] }, e.id);
373
- })
374
- ]
375
- }
376
- )
377
- }
378
- ) }),
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
+ ] }),
379
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" })
380
385
  ] }),
381
- a && K && /* @__PURE__ */ l("aside", { className: f(r.aside, i.drawer, h?.drawer), children: K(a, { close: () => Q(null), ongoing: be }) }),
382
- a && !K && /* @__PURE__ */ u("aside", { className: f(r.aside, i.drawer, h?.drawer), children: [
383
- /* @__PURE__ */ u("div", { className: i.drawerHead, children: [
386
+ a && K && /* @__PURE__ */ l("aside", { className: f(r.aside, i.drawer, h?.drawer), children: K(a, { close: () => Q(null), ongoing: Se }) }),
387
+ a && !K && /* @__PURE__ */ c("aside", { className: f(r.aside, i.drawer, h?.drawer), children: [
388
+ /* @__PURE__ */ c("div", { className: i.drawerHead, children: [
384
389
  /* @__PURE__ */ l(
385
390
  "span",
386
391
  {
387
392
  className: i.drawerTag,
388
393
  style: {
389
- background: mt(M(a.tag), 12),
394
+ background: ht(M(a.tag), 12),
390
395
  color: M(a.tag)
391
396
  },
392
397
  children: a.tag || "event"
@@ -406,40 +411,40 @@ const kt = {
406
411
  )
407
412
  ] }),
408
413
  /* @__PURE__ */ l("div", { className: i.drawerTitle, children: a.title }),
409
- /* @__PURE__ */ l("div", { className: i.drawerTiming, children: R(a.start) + (be ? " · ongoing, " + D(x - a.start) + " so far" : a.end > a.start ? " → " + R(a.end) + " · " + D(a.end - a.start) : "") }),
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) : "") }),
410
415
  /* @__PURE__ */ l("div", { className: i.drawerDetail, children: a.detail || "—" }),
411
416
  /* @__PURE__ */ l("div", { className: r.asideSection, children: "Raw event" }),
412
417
  /* @__PURE__ */ l("pre", { className: r.asideRaw, children: JSON.stringify(a, null, 2) })
413
418
  ] }),
414
- (H === "right" || H === "floating") && Y
419
+ (T === "right" || T === "floating") && R
415
420
  ] }),
416
- H === "bottom" && Y,
417
- S && (() => {
418
- const e = c.find((o) => o.id === S.id), n = e ? c.indexOf(e) : -1, t = e && A ? A(e, {
421
+ T === "bottom" && R,
422
+ b && (() => {
423
+ const e = d.find((o) => o.id === b.id), n = e ? d.indexOf(e) : -1, t = e && V ? V(e, {
419
424
  index: n,
420
425
  number: String(n + 1).padStart(2, "0"),
421
426
  color: M(e.tag),
422
427
  ongoing: e.end == null,
423
- condensed: z.get(e.id)?.condensed ?? !1,
424
- durationMs: (e.end == null ? x : e.end) - e.start
428
+ condensed: I.get(e.id)?.condensed ?? !1,
429
+ durationMs: (e.end == null ? k : e.end) - e.start
425
430
  }) : void 0;
426
- return A && t == null ? null : /* @__PURE__ */ l(yt, { x: S.x, y: S.y, className: h?.tooltip, children: t !== void 0 ? t : /* @__PURE__ */ u(ne, { children: [
427
- /* @__PURE__ */ l("div", { className: r.tooltipTitle, children: S.title }),
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: [
432
+ /* @__PURE__ */ l("div", { className: r.tooltipTitle, children: b.title }),
428
433
  /* @__PURE__ */ l(
429
434
  "div",
430
435
  {
431
436
  className: f(r.tooltipLine, r.tooltipMono),
432
437
  style: { marginTop: 4 },
433
- children: S.time
438
+ children: b.time
434
439
  }
435
440
  ),
436
- /* @__PURE__ */ l("div", { className: r.tooltipLine, children: S.durLine }),
437
- S.detail && /* @__PURE__ */ l("div", { className: r.tooltipDim, style: { marginTop: 5 }, children: S.detail })
441
+ /* @__PURE__ */ l("div", { className: r.tooltipLine, children: b.durLine }),
442
+ b.detail && /* @__PURE__ */ l("div", { className: r.tooltipDim, style: { marginTop: 5 }, children: b.detail })
438
443
  ] }) });
439
444
  })()
440
445
  ] });
441
446
  }
442
447
  );
443
448
  export {
444
- Ft as HistoryTimeline
449
+ Vt as HistoryTimeline
445
450
  };