@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.
@@ -1,307 +1,311 @@
1
- import { jsx as t, jsxs as f, Fragment as oe } from "react/jsx-runtime";
2
- import { forwardRef as nn, useRef as S, useState as k, 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 x, 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, Ce) {
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
14
  meta: G,
15
15
  highlight: K,
16
- defaultHighlight: De,
17
- onHighlightChange: He,
18
- showSearch: Ie = !0,
19
- renderSearch: de,
20
- compactRows: Ee = !1,
21
- showGridlines: Ae = !0,
22
- showControls: ue = !0,
16
+ defaultHighlight: He,
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",
23
24
  showSummary: I = !1,
24
25
  summaryPlacement: T = "left",
25
- summaryDefaultPosition: Oe,
26
- maxHeight: Ve = "74vh",
27
- selectedTaskId: U,
26
+ summaryDefaultPosition: Ve,
27
+ maxHeight: Ze = "74vh",
28
+ selectedTaskId: _,
28
29
  defaultSelectedTaskId: Fe = null,
29
- onTaskSelect: Ze,
30
- renderRowLabel: me,
31
- renderBar: _,
32
- renderTooltip: $,
33
- renderDetails: X,
30
+ onTaskSelect: ze,
31
+ renderRowLabel: he,
32
+ renderBar: $,
33
+ renderTooltip: X,
34
+ renderDetails: Y,
34
35
  classes: u,
35
- className: ze,
36
- style: Be
37
- } = We, p = S(null), [he, fe] = k(null), [we, pe] = k(!0), [g, Y] = k(null), [Ge, Ke] = k(Fe), P = U !== void 0 ? U : Ge, [M, Ue] = k({ l: 0, t: 0, w: 0, h: 0 }), ge = S(I);
38
- ge.current = I;
39
- const j = S(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
- e && Ue(
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] = k({ l: 0, w: 2e3 }), J = S(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
- }, []), $e = 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
- I && 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), C = wn(p), [Xe, Ye] = k(De ?? ""), ne = K !== void 0 ? K : Xe, E = ne.trim(), ve = (e) => {
60
- K === void 0 && Ye(e), He?.(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, A = Math.max(240, ee - w - Pe) / ae, o = we || !he ? A : he, re = S(A), Me = S(o);
75
- re.current = A, Me.current = o;
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;
76
77
  const O = S(null);
77
78
  an(() => {
78
- O.current != null && p.current && (p.current.scrollLeft = O.current, O.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
- O.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
- U === void 0 && Ke(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, D = I ? /* @__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
106
  placement: T,
105
- floatingDefaultPosition: Oe,
107
+ floatingDefaultPosition: Ve,
106
108
  bubbleGlyphColors: x.slice(0, 3),
107
- items: i.map((e, n) => {
108
- 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, b = !M.w || c < M.l + M.w && c + h > M.l, y = !M.h || v < M.t + M.h && v + L > M.t;
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;
109
111
  return {
110
112
  id: e.id,
111
113
  number: String(n + 1).padStart(2, "0"),
112
114
  label: e.name,
113
115
  color: x[n % x.length],
114
- time: ce(e.start),
116
+ time: de(e.start),
115
117
  inView: b && y,
116
118
  selected: P === e.id
117
119
  };
118
120
  }),
119
121
  onPick: (e) => {
120
- const n = i.findIndex((H) => H.id === e), l = p.current;
122
+ const n = o.findIndex((H) => H.id === e), l = p.current;
121
123
  if (n < 0 || !l) return;
122
- const c = i[n], h = c.end == null ? N : c.end, v = Math.round(w + (c.start - m) * o), b = Math.max(14, Math.round(Math.max(0, h - c.start) * o)), y = {
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 = {
123
125
  left: Math.max(0, v + b / 2 - l.clientWidth / 2)
124
126
  };
125
- l.clientHeight && (y.top = Math.max(0, 34 + n * L + L / 2 - l.clientHeight / 2)), gn(l, y);
127
+ l.clientHeight && (y.top = Math.max(0, 34 + n * L + L / 2 - l.clientHeight / 2)), Nn(l, y);
126
128
  }
127
129
  }
128
130
  ) : null;
129
131
  return /* @__PURE__ */ f(
130
132
  "div",
131
133
  {
132
- ref: Ce,
133
- className: d(r.root, u?.root, ze),
134
- style: Be,
134
+ ref: De,
135
+ className: d(a.root, u?.root, Be),
136
+ style: Ge,
135
137
  children: [
136
- (ue || xe || B != null || G != null) && /* @__PURE__ */ f("div", { className: d(r.toolbar, u?.toolbar), children: [
137
- /* @__PURE__ */ f("div", { className: r.toolbarText, children: [
138
- B != null && /* @__PURE__ */ t("span", { className: r.toolbarTitle, children: B }),
139
- /* @__PURE__ */ t("span", { className: r.toolbarMeta, children: G ?? (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") })
140
142
  ] }),
141
- xe,
142
- ue && /* @__PURE__ */ t(
143
- dn,
143
+ Me,
144
+ me && /* @__PURE__ */ t(
145
+ un,
144
146
  {
145
- zoomPct: `${Math.round(o / A * 100)}%`,
146
- fitActive: we,
147
- onZoomIn: () => se(1.5, ee / 2),
148
- 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),
149
151
  onFit: () => {
150
- pe(!0), fe(null);
152
+ ge(!0), we(null);
151
153
  },
152
- hint: "scroll zooms · drag pans"
154
+ hint: U === "none" ? "drag pans" : (U === "ctrl" ? "Ctrl+scroll zooms" : "scroll zooms") + " · drag pans"
153
155
  }
154
156
  )
155
157
  ] }),
156
158
  T === "top" && D,
157
- /* @__PURE__ */ f("div", { className: r.layout, children: [
159
+ /* @__PURE__ */ f("div", { className: a.layout, children: [
158
160
  T === "left" && D,
159
- /* @__PURE__ */ f("div", { className: r.main, children: [
160
- /* @__PURE__ */ t("div", { className: d(r.card, u?.card), children: /* @__PURE__ */ t(
161
- "div",
162
- {
163
- ref: p,
164
- className: d(r.scroller, a.scroller, u?.scroller),
165
- style: { maxHeight: Ve },
166
- onPointerDown: C.onPointerDown,
167
- onPointerMove: C.onPointerMove,
168
- onPointerUp: C.onPointerUp,
169
- onPointerLeave: C.onPointerUp,
170
- onScroll: $e,
171
- children: /* @__PURE__ */ f("div", { className: a.inner, style: { width: be }, children: [
172
- Ae && Se.map((e, n) => /* @__PURE__ */ t("div", { className: a.gridline, style: { left: e.left } }, n)),
173
- Ne && /* @__PURE__ */ t(
174
- "div",
175
- {
176
- className: a.nowLine,
177
- style: { left: Math.round(w + (N - m) * o) }
178
- }
179
- ),
180
- /* @__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)) }),
181
- i.map((e, n) => {
182
- const l = e.end == null, c = l ? N : e.end, h = Math.max(0, c - e.start), v = sn(e, E), b = x[n % x.length], y = 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: b, running: l, durationMs: h };
183
- return /* @__PURE__ */ f(
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(
184
177
  "div",
185
178
  {
186
- className: d(a.row, u?.row),
187
- style: { height: L, opacity: E && !v ? 0.3 : 1 },
188
- children: [
189
- /* @__PURE__ */ t("div", { className: d(a.rowLabel, u?.rowLabel), children: me ? me(e, Re) : /* @__PURE__ */ f(oe, { children: [
190
- /* @__PURE__ */ t("span", { className: a.rowName, children: /* @__PURE__ */ t(un, { text: e.name, query: E }) }),
191
- /* @__PURE__ */ t("span", { className: a.rowDates, children: ce(e.start) + (l ? " → now" : " → " + ce(c)) })
192
- ] }) }),
193
- /* @__PURE__ */ t(
194
- "div",
195
- {
196
- className: d(a.bar, l && a.barRunning, u?.bar),
197
- style: {
198
- left: y,
199
- top: Math.round((L - Nn) / 2),
200
- width: H,
201
- borderColor: b,
202
- background: l ? on(b, 72) : b,
203
- boxShadow: E && v ? "0 0 0 3px var(--crk-timeline-hl-ring, #f3d98b)" : "none"
204
- },
205
- onClick: () => {
206
- C.wasDragSuppressed() || (Y(null), ie(P === e.id ? null : e));
207
- },
208
- onMouseEnter: (Qe) => {
209
- if (P === e.id) return;
210
- const en = je(Qe);
211
- Y({
212
- ...en,
213
- id: e.id,
214
- title: e.name,
215
- time: Z(e.start) + (l ? "" : " → " + Z(c)),
216
- durLine: (l ? "running · " : "took ") + F(h) + (e.owner ? " · " + e.owner : ""),
217
- detail: e.detail || ""
218
- });
219
- },
220
- onMouseLeave: () => Y(null),
221
- children: _ ? _(e, Re) : /* @__PURE__ */ f(oe, { children: [
222
- l && /* @__PURE__ */ t("span", { className: d(r.pulseDot, a.barDot) }),
223
- Le && /* @__PURE__ */ t("span", { className: a.barTextInside, children: ke })
224
- ] })
225
- }
226
- ),
227
- !_ && !Le && /* @__PURE__ */ t("div", { className: a.barTextOutside, style: { left: y + H + 10 }, children: ke })
228
- ]
229
- },
230
- e.id
231
- );
232
- })
233
- ] })
234
- }
235
- ) }),
236
- /* @__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" }),
237
- T === "bubble" && D
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" })
238
242
  ] }),
239
- 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, {
240
244
  close: () => ie(null),
241
245
  running: s.end == null
242
246
  }) }),
243
- s && !X && /* @__PURE__ */ f("aside", { className: d(r.aside, a.drawer, u?.drawer), children: [
244
- /* @__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: [
245
249
  /* @__PURE__ */ t(
246
250
  "span",
247
251
  {
248
- className: a.drawerSwatch,
252
+ className: r.drawerSwatch,
249
253
  style: {
250
- background: x[i.indexOf(s) % x.length]
254
+ background: x[o.indexOf(s) % x.length]
251
255
  }
252
256
  }
253
257
  ),
254
- /* @__PURE__ */ t("span", { className: a.drawerOwner, children: s.owner || "—" }),
258
+ /* @__PURE__ */ t("span", { className: r.drawerOwner, children: s.owner || "—" }),
255
259
  /* @__PURE__ */ t(
256
260
  "span",
257
261
  {
258
262
  className: d(
259
- a.drawerState,
260
- s.end == null && a.drawerStateRunning
263
+ r.drawerState,
264
+ s.end == null && r.drawerStateRunning
261
265
  ),
262
266
  children: s.end == null ? "running" : "done"
263
267
  }
264
268
  ),
265
- /* @__PURE__ */ t("div", { className: a.drawerSpacer }),
269
+ /* @__PURE__ */ t("div", { className: r.drawerSpacer }),
266
270
  /* @__PURE__ */ t(
267
271
  "button",
268
272
  {
269
273
  type: "button",
270
- className: r.asideClose,
274
+ className: a.asideClose,
271
275
  "aria-label": "Close details",
272
276
  onClick: () => ie(null),
273
277
  children: "✕"
274
278
  }
275
279
  )
276
280
  ] }),
277
- /* @__PURE__ */ t("div", { className: a.drawerName, children: s.name }),
278
- /* @__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) }),
279
- /* @__PURE__ */ t("div", { className: a.drawerDetail, children: s.detail || "—" }),
280
- /* @__PURE__ */ t("div", { className: r.asideSection, children: "Raw event" }),
281
- /* @__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) })
282
286
  ] }),
283
287
  (T === "right" || T === "floating") && D
284
288
  ] }),
285
289
  T === "bottom" && D,
286
290
  g && (() => {
287
- const e = i.find((l) => l.id === g.id), n = e && $ ? $(e, {
288
- index: i.indexOf(e),
289
- color: x[i.indexOf(e) % x.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],
290
294
  running: e.end == null,
291
295
  durationMs: (e.end == null ? N : e.end) - e.start
292
296
  }) : void 0;
293
- return $ && n == null ? null : /* @__PURE__ */ t(mn, { x: g.x, y: g.y, className: u?.tooltip, children: n !== void 0 ? n : /* @__PURE__ */ f(oe, { children: [
294
- /* @__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 }),
295
299
  /* @__PURE__ */ t(
296
300
  "div",
297
301
  {
298
- className: d(r.tooltipLine, r.tooltipMono),
302
+ className: d(a.tooltipLine, a.tooltipMono),
299
303
  style: { marginTop: 4 },
300
304
  children: g.time
301
305
  }
302
306
  ),
303
- /* @__PURE__ */ t("div", { className: r.tooltipLine, children: g.durLine }),
304
- 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 })
305
309
  ] }) });
306
310
  })()
307
311
  ]
@@ -310,5 +314,5 @@ const w = 230, Pe = 24, R = 400, Nn = 26, Pn = nn(
310
314
  }
311
315
  );
312
316
  export {
313
- Pn as GanttTimeline
317
+ Cn as GanttTimeline
314
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
  /**