@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,127 +1,130 @@
1
- import { jsx as t, jsxs as f, Fragment as oe } from "react/jsx-runtime";
2
- import { forwardRef as nn, useRef as y, useState as S, useCallback as V, useEffect as tn, useMemo as ln, useLayoutEffect as an } from "react";
1
+ import { jsx as t, jsxs as f, Fragment as ce } from "react/jsx-runtime";
2
+ import { forwardRef as tn, useRef as S, useState as k, useCallback as V, useEffect as ln, useMemo as rn, useLayoutEffect as an } from "react";
3
3
  import d from "clsx";
4
- import r from "./Timeline.module.scss.js";
5
- import a from "./GanttTimeline.module.scss.js";
6
- import { ticks as rn, TIMELINE_PALETTE_VARS as b, fmtDate as ce, fmtDur as F, eventMatches as sn, fmtDateTime as Z, tint as on } from "./timelineCore.js";
7
- import { TimelineSummary as cn, TimelineZoomControls as dn, HighlightText as un, TimelineTooltip as mn } from "./TimelineShared.js";
8
- import { useNowTicker as hn, useContainerWidth as fn, useTimelinePan as wn, useWheelZoom as pn, animateScrollTo as gn } from "./useTimeline.js";
9
- const w = 230, Pe = 24, R = 400, Nn = 26, Pn = nn(
10
- function(We, De) {
4
+ import a from "./Timeline.module.scss.js";
5
+ import r from "./GanttTimeline.module.scss.js";
6
+ import { ticks as sn, TIMELINE_PALETTE_VARS as x, fmtDate as de, fmtDur as Z, eventMatches as on, fmtDateTime as F, tint as cn } from "./timelineCore.js";
7
+ import { TimelineSummary as dn, TimelineZoomControls as un, HighlightText as mn, TimelineTooltip as hn } from "./TimelineShared.js";
8
+ import { useNowTicker as fn, useContainerWidth as wn, useTimelinePan as pn, useWheelZoom as gn, animateScrollTo as Nn, wheelZoomAllowed as vn } from "./useTimeline.js";
9
+ const w = 230, We = 24, R = 400, xn = 26, Cn = tn(
10
+ function(Ce, De) {
11
11
  const {
12
12
  tasks: z,
13
13
  title: B,
14
- meta: K,
15
- highlight: U,
14
+ meta: G,
15
+ highlight: K,
16
16
  defaultHighlight: He,
17
- onHighlightChange: Ce,
18
- showSearch: Ie = !0,
19
- renderSearch: de,
20
- compactRows: Ee = !1,
21
- showGridlines: Ae = !0,
22
- showControls: ue = !0,
23
- showSummary: C = !1,
24
- summaryPlacement: k = "left",
25
- summaryDefaultPosition: Oe,
26
- maxHeight: Ve = "74vh",
17
+ onHighlightChange: Ie,
18
+ showSearch: Ee = !0,
19
+ renderSearch: ue,
20
+ compactRows: Ae = !1,
21
+ showGridlines: Oe = !0,
22
+ showControls: me = !0,
23
+ wheelZoom: U = "ctrl",
24
+ showSummary: I = !1,
25
+ summaryPlacement: T = "left",
26
+ summaryDefaultPosition: Ve,
27
+ maxHeight: Ze = "74vh",
27
28
  selectedTaskId: _,
28
29
  defaultSelectedTaskId: Fe = null,
29
- onTaskSelect: Ze,
30
- renderRowLabel: me,
30
+ onTaskSelect: ze,
31
+ renderRowLabel: he,
31
32
  renderBar: $,
32
- renderTooltip: G,
33
- renderDetails: X,
33
+ renderTooltip: X,
34
+ renderDetails: Y,
34
35
  classes: u,
35
- className: ze,
36
- style: Be
37
- } = We, p = y(null), [he, fe] = S(null), [we, pe] = S(!0), [g, Y] = S(null), [Ke, Ue] = S(Fe), P = _ !== void 0 ? _ : Ke, [x, _e] = S({ l: 0, t: 0, w: 0, h: 0 }), ge = y(C);
38
- ge.current = C;
39
- const j = y(null), q = V(() => {
36
+ className: Be,
37
+ style: Ge
38
+ } = Ce, p = S(null), [fe, we] = k(null), [pe, ge] = k(!0), [g, j] = k(null), [Ke, Ue] = k(Fe), P = _ !== void 0 ? _ : Ke, [M, _e] = k({ l: 0, t: 0, w: 0, h: 0 }), Ne = S(I);
39
+ Ne.current = I;
40
+ const q = S(null), J = V(() => {
40
41
  const e = p.current;
41
42
  e && _e(
42
43
  (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 }
43
44
  );
44
- }, []), [W, $e] = S({ l: 0, w: 2e3 }), J = y(W);
45
- J.current = W;
46
- const Q = V(() => {
45
+ }, []), [W, $e] = k({ l: 0, w: 2e3 }), Q = S(W);
46
+ Q.current = W;
47
+ const ee = V(() => {
47
48
  const e = p.current;
48
49
  if (!e) return;
49
50
  const n = Math.floor(e.scrollLeft / R) * R, l = (Math.ceil((e.clientWidth || 1600) / R) + 1) * R;
50
- (n !== J.current.l || l !== J.current.w) && $e({ l: n, w: l });
51
- }, []), Ge = V(() => {
52
- j.current == null && (j.current = requestAnimationFrame(() => {
53
- j.current = null, Q(), ge.current && q();
51
+ (n !== Q.current.l || l !== Q.current.w) && $e({ l: n, w: l });
52
+ }, []), Xe = V(() => {
53
+ q.current == null && (q.current = requestAnimationFrame(() => {
54
+ q.current = null, ee(), Ne.current && J();
54
55
  }));
55
- }, [q, Q]);
56
- tn(() => {
57
- C && q();
56
+ }, [J, ee]);
57
+ ln(() => {
58
+ I && J();
58
59
  });
59
- const Ne = z.some((e) => e.end == null), N = hn(Ne, 400), ee = fn(p), D = wn(p), [Xe, Ye] = S(He ?? ""), ne = U !== void 0 ? U : Xe, I = ne.trim(), ve = (e) => {
60
- U === void 0 && Ye(e), Ce?.(e);
61
- }, xe = de ? de({ value: ne, setValue: ve }) : Ie ? /* @__PURE__ */ t(
60
+ const ve = z.some((e) => e.end == null), N = fn(ve, 400), ne = wn(p), C = pn(p), [Ye, je] = k(He ?? ""), te = K !== void 0 ? K : Ye, E = te.trim(), xe = (e) => {
61
+ K === void 0 && je(e), Ie?.(e);
62
+ }, Me = ue ? ue({ value: te, setValue: xe }) : Ee ? /* @__PURE__ */ t(
62
63
  "input",
63
64
  {
64
- className: d(r.searchInput, u?.search),
65
+ className: d(a.searchInput, u?.search),
65
66
  placeholder: "Highlight keyword in tasks…",
66
67
  "aria-label": "Highlight keyword",
67
- value: ne,
68
- onChange: (e) => ve(e.target.value)
68
+ value: te,
69
+ onChange: (e) => xe(e.target.value)
69
70
  }
70
- ) : null, i = ln(() => z.slice().sort((e, n) => e.start - n.start), [z]);
71
- let m = i.length ? Math.min(...i.map((e) => e.start)) : N - 1, te = i.length ? Math.max(m + 1, ...i.map((e) => e.end == null ? N : e.end)) : N;
72
- const le = (te - m) * 0.03;
73
- m -= le, te += le;
74
- const ae = te - m, E = Math.max(240, ee - w - Pe) / ae, o = we || !he ? E : he, re = y(E), Me = y(o);
75
- re.current = E, Me.current = o;
76
- const A = y(null);
71
+ ) : null, o = rn(() => z.slice().sort((e, n) => e.start - n.start), [z]);
72
+ let m = o.length ? Math.min(...o.map((e) => e.start)) : N - 1, le = o.length ? Math.max(m + 1, ...o.map((e) => e.end == null ? N : e.end)) : N;
73
+ const re = (le - m) * 0.03;
74
+ m -= re, le += re;
75
+ const ae = le - m, A = Math.max(240, ne - w - We) / ae, i = pe || !fe ? A : fe, se = S(A), be = S(i);
76
+ se.current = A, be.current = i;
77
+ const O = S(null);
77
78
  an(() => {
78
- A.current != null && p.current && (p.current.scrollLeft = A.current, A.current = null), Q();
79
+ O.current != null && p.current && (p.current.scrollLeft = O.current, O.current = null), ee();
79
80
  });
80
- const se = V((e, n) => {
81
+ const oe = V((e, n) => {
81
82
  const l = p.current;
82
83
  if (!l) return;
83
- const c = Me.current || 1e-4, h = Math.max(re.current ? re.current * 0.2 : 1e-9, Math.min(1, c * e)), v = (l.scrollLeft + n - w) / c;
84
- A.current = v * h + w - n, pe(!1), fe(h);
84
+ const c = be.current || 1e-4, h = Math.max(se.current ? se.current * 0.2 : 1e-9, Math.min(1, c * e)), v = (l.scrollLeft + n - w) / c;
85
+ O.current = v * h + w - n, ge(!1), we(h);
85
86
  }, []);
86
- pn(p, (e) => {
87
+ gn(p, (e) => {
88
+ if (!vn(U, e)) return;
87
89
  e.preventDefault();
88
90
  const n = p.current;
89
- n && se(Math.exp(-e.deltaY * 18e-4), e.clientX - n.getBoundingClientRect().left);
91
+ n && oe(Math.exp(-e.deltaY * 18e-4), e.clientX - n.getBoundingClientRect().left);
90
92
  });
91
93
  const ie = (e) => {
92
- _ === void 0 && Ue(e ? e.id : null), Ze?.(e);
93
- }, je = (e) => {
94
+ _ === void 0 && Ue(e ? e.id : null), ze?.(e);
95
+ }, qe = (e) => {
94
96
  const n = window.innerWidth || 1200, l = window.innerHeight || 800, c = e.clientX < n * 0.55 ? Math.max(12, n - 340) : 16, h = Math.max(130, Math.min(e.clientY, l - 130));
95
97
  return { x: c, y: h };
96
- }, L = Ee ? 42 : 54, s = P != null && i.find((e) => e.id === P) || null, be = Math.ceil(w + ae * o + Pe + 90), qe = m + (be - w) / o, Te = Math.max(m, m + (W.l - R - w) / o), ye = Math.min(qe, m + (W.l + W.w + R - w) / o), Se = rn(Te, ye, Math.max(1, (ye - Te) * o)).list.map((e) => ({
97
- left: Math.round(w + (e.t - m) * o),
98
+ }, L = Ae ? 42 : 54, s = P != null && o.find((e) => e.id === P) || null, Te = Math.ceil(w + ae * i + We + 90), Je = m + (Te - w) / i, ye = Math.max(m, m + (W.l - R - w) / i), Se = Math.min(Je, m + (W.l + W.w + R - w) / i), ke = sn(ye, Se, Math.max(1, (Se - ye) * i)).list.map((e) => ({
99
+ left: Math.round(w + (e.t - m) * i),
98
100
  label: e.label
99
- })), Je = i.filter((e) => e.end == null).length, O = C ? /* @__PURE__ */ t(
100
- cn,
101
+ })), Qe = o.filter((e) => e.end == null).length, D = I ? /* @__PURE__ */ t(
102
+ dn,
101
103
  {
102
104
  heading: "Tasks",
103
105
  className: u?.summary,
104
- placement: k,
105
- floatingDefaultPosition: Oe,
106
- items: i.map((e, n) => {
107
- const l = e.end == null ? N : e.end, c = Math.round(w + (e.start - m) * o), h = Math.max(14, Math.round(Math.max(0, l - e.start) * o)), v = 34 + n * L, M = !x.w || c < x.l + x.w && c + h > x.l, T = !x.h || v < x.t + x.h && v + L > x.t;
106
+ placement: T,
107
+ floatingDefaultPosition: Ve,
108
+ bubbleGlyphColors: x.slice(0, 3),
109
+ items: o.map((e, n) => {
110
+ const l = e.end == null ? N : e.end, c = Math.round(w + (e.start - m) * i), h = Math.max(14, Math.round(Math.max(0, l - e.start) * i)), v = 34 + n * L, b = !M.w || c < M.l + M.w && c + h > M.l, y = !M.h || v < M.t + M.h && v + L > M.t;
108
111
  return {
109
112
  id: e.id,
110
113
  number: String(n + 1).padStart(2, "0"),
111
114
  label: e.name,
112
- color: b[n % b.length],
113
- time: ce(e.start),
114
- inView: M && T,
115
+ color: x[n % x.length],
116
+ time: de(e.start),
117
+ inView: b && y,
115
118
  selected: P === e.id
116
119
  };
117
120
  }),
118
121
  onPick: (e) => {
119
- const n = i.findIndex((H) => H.id === e), l = p.current;
122
+ const n = o.findIndex((H) => H.id === e), l = p.current;
120
123
  if (n < 0 || !l) return;
121
- const c = i[n], h = c.end == null ? N : c.end, v = Math.round(w + (c.start - m) * o), M = Math.max(14, Math.round(Math.max(0, h - c.start) * o)), T = {
122
- left: Math.max(0, v + M / 2 - l.clientWidth / 2)
124
+ const c = o[n], h = c.end == null ? N : c.end, v = Math.round(w + (c.start - m) * i), b = Math.max(14, Math.round(Math.max(0, h - c.start) * i)), y = {
125
+ left: Math.max(0, v + b / 2 - l.clientWidth / 2)
123
126
  };
124
- l.clientHeight && (T.top = Math.max(0, 34 + n * L + L / 2 - l.clientHeight / 2)), gn(l, T);
127
+ l.clientHeight && (y.top = Math.max(0, 34 + n * L + L / 2 - l.clientHeight / 2)), Nn(l, y);
125
128
  }
126
129
  }
127
130
  ) : null;
@@ -129,177 +132,180 @@ const w = 230, Pe = 24, R = 400, Nn = 26, Pn = nn(
129
132
  "div",
130
133
  {
131
134
  ref: De,
132
- className: d(r.root, u?.root, ze),
133
- style: Be,
135
+ className: d(a.root, u?.root, Be),
136
+ style: Ge,
134
137
  children: [
135
- (ue || xe || B != null || K != null) && /* @__PURE__ */ f("div", { className: d(r.toolbar, u?.toolbar), children: [
136
- /* @__PURE__ */ f("div", { className: r.toolbarText, children: [
137
- B != null && /* @__PURE__ */ t("span", { className: r.toolbarTitle, children: B }),
138
- /* @__PURE__ */ t("span", { className: r.toolbarMeta, children: K ?? (i.length ? `${i.length} tasks · ${F(ae - 2 * le)} · ${Je} running` : "No tasks") })
138
+ (me || Me || B != null || G != null) && /* @__PURE__ */ f("div", { className: d(a.toolbar, u?.toolbar), children: [
139
+ /* @__PURE__ */ f("div", { className: a.toolbarText, children: [
140
+ B != null && /* @__PURE__ */ t("span", { className: a.toolbarTitle, children: B }),
141
+ /* @__PURE__ */ t("span", { className: a.toolbarMeta, children: G ?? (o.length ? `${o.length} tasks · ${Z(ae - 2 * re)} · ${Qe} running` : "No tasks") })
139
142
  ] }),
140
- xe,
141
- ue && /* @__PURE__ */ t(
142
- dn,
143
+ Me,
144
+ me && /* @__PURE__ */ t(
145
+ un,
143
146
  {
144
- zoomPct: `${Math.round(o / E * 100)}%`,
145
- fitActive: we,
146
- onZoomIn: () => se(1.5, ee / 2),
147
- onZoomOut: () => se(1 / 1.5, ee / 2),
147
+ zoomPct: `${Math.round(i / A * 100)}%`,
148
+ fitActive: pe,
149
+ onZoomIn: () => oe(1.5, ne / 2),
150
+ onZoomOut: () => oe(1 / 1.5, ne / 2),
148
151
  onFit: () => {
149
- pe(!0), fe(null);
152
+ ge(!0), we(null);
150
153
  },
151
- hint: "scroll zooms · drag pans"
154
+ hint: U === "none" ? "drag pans" : (U === "ctrl" ? "Ctrl+scroll zooms" : "scroll zooms") + " · drag pans"
152
155
  }
153
156
  )
154
157
  ] }),
155
- k === "top" && O,
156
- /* @__PURE__ */ f("div", { className: r.layout, children: [
157
- k === "left" && O,
158
- /* @__PURE__ */ f("div", { className: r.main, children: [
159
- /* @__PURE__ */ t("div", { className: d(r.card, u?.card), children: /* @__PURE__ */ t(
160
- "div",
161
- {
162
- ref: p,
163
- className: d(r.scroller, a.scroller, u?.scroller),
164
- style: { maxHeight: Ve },
165
- onPointerDown: D.onPointerDown,
166
- onPointerMove: D.onPointerMove,
167
- onPointerUp: D.onPointerUp,
168
- onPointerLeave: D.onPointerUp,
169
- onScroll: Ge,
170
- children: /* @__PURE__ */ f("div", { className: a.inner, style: { width: be }, children: [
171
- Ae && Se.map((e, n) => /* @__PURE__ */ t("div", { className: a.gridline, style: { left: e.left } }, n)),
172
- Ne && /* @__PURE__ */ t(
173
- "div",
174
- {
175
- className: a.nowLine,
176
- style: { left: Math.round(w + (N - m) * o) }
177
- }
178
- ),
179
- /* @__PURE__ */ t("div", { className: d(a.axis, u?.axis), children: Se.map((e, n) => /* @__PURE__ */ t("div", { className: a.axisLabel, style: { left: e.left }, children: e.label }, n)) }),
180
- i.map((e, n) => {
181
- const l = e.end == null, c = l ? N : e.end, h = Math.max(0, c - e.start), v = sn(e, I), M = b[n % b.length], T = Math.round(w + (e.start - m) * o), H = Math.max(14, Math.round(h * o)), ke = F(h) + (l ? " · running" : ""), Le = H > 130, Re = { index: n, color: M, running: l, durationMs: h };
182
- return /* @__PURE__ */ f(
158
+ T === "top" && D,
159
+ /* @__PURE__ */ f("div", { className: a.layout, children: [
160
+ T === "left" && D,
161
+ /* @__PURE__ */ f("div", { className: a.main, children: [
162
+ /* @__PURE__ */ f("div", { className: a.cardWrap, children: [
163
+ /* @__PURE__ */ t("div", { className: d(a.card, u?.card), children: /* @__PURE__ */ t(
164
+ "div",
165
+ {
166
+ ref: p,
167
+ className: d(a.scroller, r.scroller, u?.scroller),
168
+ style: { maxHeight: Ze },
169
+ onPointerDown: C.onPointerDown,
170
+ onPointerMove: C.onPointerMove,
171
+ onPointerUp: C.onPointerUp,
172
+ onPointerLeave: C.onPointerUp,
173
+ onScroll: Xe,
174
+ children: /* @__PURE__ */ f("div", { className: r.inner, style: { width: Te }, children: [
175
+ Oe && ke.map((e, n) => /* @__PURE__ */ t("div", { className: r.gridline, style: { left: e.left } }, n)),
176
+ ve && /* @__PURE__ */ t(
183
177
  "div",
184
178
  {
185
- className: d(a.row, u?.row),
186
- style: { height: L, opacity: I && !v ? 0.3 : 1 },
187
- children: [
188
- /* @__PURE__ */ t("div", { className: d(a.rowLabel, u?.rowLabel), children: me ? me(e, Re) : /* @__PURE__ */ f(oe, { children: [
189
- /* @__PURE__ */ t("span", { className: a.rowName, children: /* @__PURE__ */ t(un, { text: e.name, query: I }) }),
190
- /* @__PURE__ */ t("span", { className: a.rowDates, children: ce(e.start) + (l ? " → now" : " → " + ce(c)) })
191
- ] }) }),
192
- /* @__PURE__ */ t(
193
- "div",
194
- {
195
- className: d(a.bar, l && a.barRunning, u?.bar),
196
- style: {
197
- left: T,
198
- top: Math.round((L - Nn) / 2),
199
- width: H,
200
- borderColor: M,
201
- background: l ? on(M, 72) : M,
202
- boxShadow: I && v ? "0 0 0 3px var(--crk-timeline-hl-ring, #f3d98b)" : "none"
203
- },
204
- onClick: () => {
205
- D.wasDragSuppressed() || (Y(null), ie(P === e.id ? null : e));
206
- },
207
- onMouseEnter: (Qe) => {
208
- if (P === e.id) return;
209
- const en = je(Qe);
210
- Y({
211
- ...en,
212
- id: e.id,
213
- title: e.name,
214
- time: Z(e.start) + (l ? "" : " → " + Z(c)),
215
- durLine: (l ? "running · " : "took ") + F(h) + (e.owner ? " · " + e.owner : ""),
216
- detail: e.detail || ""
217
- });
218
- },
219
- onMouseLeave: () => Y(null),
220
- children: $ ? $(e, Re) : /* @__PURE__ */ f(oe, { children: [
221
- l && /* @__PURE__ */ t("span", { className: d(r.pulseDot, a.barDot) }),
222
- Le && /* @__PURE__ */ t("span", { className: a.barTextInside, children: ke })
223
- ] })
224
- }
225
- ),
226
- !$ && !Le && /* @__PURE__ */ t("div", { className: a.barTextOutside, style: { left: T + H + 10 }, children: ke })
227
- ]
228
- },
229
- e.id
230
- );
231
- })
232
- ] })
233
- }
234
- ) }),
235
- /* @__PURE__ */ t("div", { className: d(r.footnote, u?.footnote), children: "Click a bar to open details in the side panel · dashed bars are still running and keep growing" })
179
+ className: r.nowLine,
180
+ style: { left: Math.round(w + (N - m) * i) }
181
+ }
182
+ ),
183
+ /* @__PURE__ */ t("div", { className: d(r.axis, u?.axis), children: ke.map((e, n) => /* @__PURE__ */ t("div", { className: r.axisLabel, style: { left: e.left }, children: e.label }, n)) }),
184
+ o.map((e, n) => {
185
+ const l = e.end == null, c = l ? N : e.end, h = Math.max(0, c - e.start), v = on(e, E), b = x[n % x.length], y = Math.round(w + (e.start - m) * i), H = Math.max(14, Math.round(h * i)), Le = Z(h) + (l ? " · running" : ""), Re = H > 130, Pe = { index: n, color: b, running: l, durationMs: h };
186
+ return /* @__PURE__ */ f(
187
+ "div",
188
+ {
189
+ className: d(r.row, u?.row),
190
+ style: { height: L, opacity: E && !v ? 0.3 : 1 },
191
+ children: [
192
+ /* @__PURE__ */ t("div", { className: d(r.rowLabel, u?.rowLabel), children: he ? he(e, Pe) : /* @__PURE__ */ f(ce, { children: [
193
+ /* @__PURE__ */ t("span", { className: r.rowName, children: /* @__PURE__ */ t(mn, { text: e.name, query: E }) }),
194
+ /* @__PURE__ */ t("span", { className: r.rowDates, children: de(e.start) + (l ? " → now" : " → " + de(c)) })
195
+ ] }) }),
196
+ /* @__PURE__ */ t(
197
+ "div",
198
+ {
199
+ className: d(r.bar, l && r.barRunning, u?.bar),
200
+ style: {
201
+ left: y,
202
+ top: Math.round((L - xn) / 2),
203
+ width: H,
204
+ borderColor: b,
205
+ background: l ? cn(b, 72) : b,
206
+ boxShadow: E && v ? "0 0 0 3px var(--crk-timeline-hl-ring, #f3d98b)" : "none"
207
+ },
208
+ onClick: () => {
209
+ C.wasDragSuppressed() || (j(null), ie(P === e.id ? null : e));
210
+ },
211
+ onMouseEnter: (en) => {
212
+ if (P === e.id) return;
213
+ const nn = qe(en);
214
+ j({
215
+ ...nn,
216
+ id: e.id,
217
+ title: e.name,
218
+ time: F(e.start) + (l ? "" : " → " + F(c)),
219
+ durLine: (l ? "running · " : "took ") + Z(h) + (e.owner ? " · " + e.owner : ""),
220
+ detail: e.detail || ""
221
+ });
222
+ },
223
+ onMouseLeave: () => j(null),
224
+ children: $ ? $(e, Pe) : /* @__PURE__ */ f(ce, { children: [
225
+ l && /* @__PURE__ */ t("span", { className: d(a.pulseDot, r.barDot) }),
226
+ Re && /* @__PURE__ */ t("span", { className: r.barTextInside, children: Le })
227
+ ] })
228
+ }
229
+ ),
230
+ !$ && !Re && /* @__PURE__ */ t("div", { className: r.barTextOutside, style: { left: y + H + 10 }, children: Le })
231
+ ]
232
+ },
233
+ e.id
234
+ );
235
+ })
236
+ ] })
237
+ }
238
+ ) }),
239
+ T === "bubble" && D
240
+ ] }),
241
+ /* @__PURE__ */ t("div", { className: d(a.footnote, u?.footnote), children: "Click a bar to open details in the side panel · dashed bars are still running and keep growing" })
236
242
  ] }),
237
- s && X && /* @__PURE__ */ t("aside", { className: d(r.aside, a.drawer, u?.drawer), children: X(s, {
243
+ s && Y && /* @__PURE__ */ t("aside", { className: d(a.aside, r.drawer, u?.drawer), children: Y(s, {
238
244
  close: () => ie(null),
239
245
  running: s.end == null
240
246
  }) }),
241
- s && !X && /* @__PURE__ */ f("aside", { className: d(r.aside, a.drawer, u?.drawer), children: [
242
- /* @__PURE__ */ f("div", { className: a.drawerHead, children: [
247
+ s && !Y && /* @__PURE__ */ f("aside", { className: d(a.aside, r.drawer, u?.drawer), children: [
248
+ /* @__PURE__ */ f("div", { className: r.drawerHead, children: [
243
249
  /* @__PURE__ */ t(
244
250
  "span",
245
251
  {
246
- className: a.drawerSwatch,
252
+ className: r.drawerSwatch,
247
253
  style: {
248
- background: b[i.indexOf(s) % b.length]
254
+ background: x[o.indexOf(s) % x.length]
249
255
  }
250
256
  }
251
257
  ),
252
- /* @__PURE__ */ t("span", { className: a.drawerOwner, children: s.owner || "—" }),
258
+ /* @__PURE__ */ t("span", { className: r.drawerOwner, children: s.owner || "—" }),
253
259
  /* @__PURE__ */ t(
254
260
  "span",
255
261
  {
256
262
  className: d(
257
- a.drawerState,
258
- s.end == null && a.drawerStateRunning
263
+ r.drawerState,
264
+ s.end == null && r.drawerStateRunning
259
265
  ),
260
266
  children: s.end == null ? "running" : "done"
261
267
  }
262
268
  ),
263
- /* @__PURE__ */ t("div", { className: a.drawerSpacer }),
269
+ /* @__PURE__ */ t("div", { className: r.drawerSpacer }),
264
270
  /* @__PURE__ */ t(
265
271
  "button",
266
272
  {
267
273
  type: "button",
268
- className: r.asideClose,
274
+ className: a.asideClose,
269
275
  "aria-label": "Close details",
270
276
  onClick: () => ie(null),
271
277
  children: "✕"
272
278
  }
273
279
  )
274
280
  ] }),
275
- /* @__PURE__ */ t("div", { className: a.drawerName, children: s.name }),
276
- /* @__PURE__ */ t("div", { className: a.drawerTiming, children: Z(s.start) + " → " + (s.end == null ? "now" : Z(s.end)) + " · " + F((s.end == null ? N : s.end) - s.start) }),
277
- /* @__PURE__ */ t("div", { className: a.drawerDetail, children: s.detail || "—" }),
278
- /* @__PURE__ */ t("div", { className: r.asideSection, children: "Raw event" }),
279
- /* @__PURE__ */ t("pre", { className: r.asideRaw, children: JSON.stringify(s, null, 2) })
281
+ /* @__PURE__ */ t("div", { className: r.drawerName, children: s.name }),
282
+ /* @__PURE__ */ t("div", { className: r.drawerTiming, children: F(s.start) + " → " + (s.end == null ? "now" : F(s.end)) + " · " + Z((s.end == null ? N : s.end) - s.start) }),
283
+ /* @__PURE__ */ t("div", { className: r.drawerDetail, children: s.detail || "—" }),
284
+ /* @__PURE__ */ t("div", { className: a.asideSection, children: "Raw event" }),
285
+ /* @__PURE__ */ t("pre", { className: a.asideRaw, children: JSON.stringify(s, null, 2) })
280
286
  ] }),
281
- (k === "right" || k === "floating") && O
287
+ (T === "right" || T === "floating") && D
282
288
  ] }),
283
- k === "bottom" && O,
289
+ T === "bottom" && D,
284
290
  g && (() => {
285
- const e = i.find((l) => l.id === g.id), n = e && G ? G(e, {
286
- index: i.indexOf(e),
287
- color: b[i.indexOf(e) % b.length],
291
+ const e = o.find((l) => l.id === g.id), n = e && X ? X(e, {
292
+ index: o.indexOf(e),
293
+ color: x[o.indexOf(e) % x.length],
288
294
  running: e.end == null,
289
295
  durationMs: (e.end == null ? N : e.end) - e.start
290
296
  }) : void 0;
291
- return G && n == null ? null : /* @__PURE__ */ t(mn, { x: g.x, y: g.y, className: u?.tooltip, children: n !== void 0 ? n : /* @__PURE__ */ f(oe, { children: [
292
- /* @__PURE__ */ t("div", { className: r.tooltipTitle, children: g.title }),
297
+ return X && n == null ? null : /* @__PURE__ */ t(hn, { x: g.x, y: g.y, className: u?.tooltip, children: n !== void 0 ? n : /* @__PURE__ */ f(ce, { children: [
298
+ /* @__PURE__ */ t("div", { className: a.tooltipTitle, children: g.title }),
293
299
  /* @__PURE__ */ t(
294
300
  "div",
295
301
  {
296
- className: d(r.tooltipLine, r.tooltipMono),
302
+ className: d(a.tooltipLine, a.tooltipMono),
297
303
  style: { marginTop: 4 },
298
304
  children: g.time
299
305
  }
300
306
  ),
301
- /* @__PURE__ */ t("div", { className: r.tooltipLine, children: g.durLine }),
302
- g.detail && /* @__PURE__ */ t("div", { className: r.tooltipDim, style: { marginTop: 5 }, children: g.detail })
307
+ /* @__PURE__ */ t("div", { className: a.tooltipLine, children: g.durLine }),
308
+ g.detail && /* @__PURE__ */ t("div", { className: a.tooltipDim, style: { marginTop: 5 }, children: g.detail })
303
309
  ] }) });
304
310
  })()
305
311
  ]
@@ -308,5 +314,5 @@ const w = 230, Pe = 24, R = 400, Nn = 26, Pn = nn(
308
314
  }
309
315
  );
310
316
  export {
311
- Pn as GanttTimeline
317
+ Cn as GanttTimeline
312
318
  };
@@ -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
  export type HistoryTimelineOrientation = 'horizontal' | 'vertical';
5
6
  export type HistoryTimelineSpacing = 'equal' | 'log' | 'proportional';
6
7
  /**
@@ -108,6 +109,15 @@ export interface HistoryTimelineProps {
108
109
  tagColors?: Record<string, string>;
109
110
  /** Toolbar with orientation/spacing toggles + zoom controls. @default true */
110
111
  showControls?: boolean;
112
+ /**
113
+ * How the mouse wheel / trackpad zooms the timeline: `'ctrl'` zooms only
114
+ * while Ctrl/Cmd is held (plain scrolling passes through to the page;
115
+ * trackpad pinch still zooms), `'free'` zooms on any scroll over the
116
+ * canvas, `'none'` disables wheel zoom entirely — the toolbar buttons
117
+ * still work.
118
+ * @default 'ctrl'
119
+ */
120
+ wheelZoom?: TimelineWheelZoom;
111
121
  /** Colored bullet + tag name legend. @default true */
112
122
  showLegend?: boolean;
113
123
  /**