@overdoser/react-toolkit 0.8.3 → 0.10.1

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.
Files changed (33) hide show
  1. package/AGENTS.md +6 -0
  2. package/CHANGELOG.md +88 -0
  3. package/README.md +2 -0
  4. package/components/Timeline/GanttTimeline.d.ts +144 -0
  5. package/components/Timeline/GanttTimeline.js +312 -0
  6. package/components/Timeline/GanttTimeline.module.scss.js +55 -0
  7. package/components/Timeline/HistoryTimeline.d.ts +184 -0
  8. package/components/Timeline/HistoryTimeline.js +445 -0
  9. package/components/Timeline/HistoryTimeline.module.scss.js +59 -0
  10. package/components/Timeline/Timeline.module.scss.js +111 -0
  11. package/components/Timeline/TimelineShared.d.ts +79 -0
  12. package/components/Timeline/TimelineShared.js +173 -0
  13. package/components/Timeline/TraceTimeline.d.ts +180 -0
  14. package/components/Timeline/TraceTimeline.js +536 -0
  15. package/components/Timeline/TraceTimeline.module.scss.js +111 -0
  16. package/components/Timeline/demoData.d.ts +42 -0
  17. package/components/Timeline/historyLayout.d.ts +82 -0
  18. package/components/Timeline/historyLayout.js +264 -0
  19. package/components/Timeline/index.d.ts +7 -0
  20. package/components/Timeline/timelineCore.d.ts +100 -0
  21. package/components/Timeline/timelineCore.js +193 -0
  22. package/components/Timeline/traceLayout.d.ts +72 -0
  23. package/components/Timeline/traceLayout.js +92 -0
  24. package/components/Timeline/useTimeline.d.ts +39 -0
  25. package/components/Timeline/useTimeline.js +81 -0
  26. package/index.css +1 -1
  27. package/index.d.ts +2 -0
  28. package/index.js +93 -87
  29. package/index.layered.css +1 -1
  30. package/llms.txt +115 -1
  31. package/manifest.json +323 -0
  32. package/package.json +2 -1
  33. package/recipes/live-timeline-feed.tsx +147 -0
@@ -0,0 +1,184 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import { TimelineSummaryPlacement } from './TimelineShared';
3
+ import { DraggablePosition } from '../Draggable';
4
+ export type HistoryTimelineOrientation = 'horizontal' | 'vertical';
5
+ export type HistoryTimelineSpacing = 'equal' | 'log' | 'proportional';
6
+ /**
7
+ * One event in a subject's history. Instant events have `end === start` (or
8
+ * omit `end`); ongoing events set `end: null` (or `ongoing: true`) until a
9
+ * later update supplies the end time.
10
+ */
11
+ export interface HistoryTimelineEvent {
12
+ /** Stable identifier. */
13
+ id: string;
14
+ /** Card title (bold, keyword-highlightable). */
15
+ title: string;
16
+ /** Description, ≤2 lines on the card, full text in tooltip/panel. */
17
+ detail?: string;
18
+ /** Category tag — colors the dot/lead and appears in the legend. */
19
+ tag?: string;
20
+ /** Owning subject id (informational; shown in the detail panel). */
21
+ subject?: string;
22
+ /** Start time, epoch ms. */
23
+ start: number;
24
+ /** End time. Equal to `start` (or omitted) = instant; `null` = ongoing. */
25
+ end?: number | null;
26
+ /** Alternative way to mark an event ongoing when `end` is omitted. */
27
+ ongoing?: boolean;
28
+ [extra: string]: unknown;
29
+ }
30
+ export interface HistoryTimelineClasses {
31
+ root: string;
32
+ toolbar: string;
33
+ legend: string;
34
+ card: string;
35
+ scroller: string;
36
+ eventCard: string;
37
+ dot: string;
38
+ summary: string;
39
+ search: string;
40
+ drawer: string;
41
+ tooltip: string;
42
+ footnote: string;
43
+ }
44
+ /** Context handed to the HistoryTimeline render-prop slots. */
45
+ export interface HistoryTimelineItemContext {
46
+ /** Chronological index (0-based). */
47
+ index: number;
48
+ /** Zero-padded card number (`'01'`…). */
49
+ number: string;
50
+ /** Resolved tag color. */
51
+ color: string;
52
+ /** True while the event has no end. */
53
+ ongoing: boolean;
54
+ /** True for burst-group members (rendered condensed by default). */
55
+ condensed: boolean;
56
+ /** Duration so far, ms. */
57
+ durationMs: number;
58
+ }
59
+ export interface HistoryTimelineProps {
60
+ /**
61
+ * Events of one subject (an order, an incident, a candidate…). Provide the
62
+ * already filtered list — the component applies no subject filtering. Push
63
+ * updated arrays for live feeds; ongoing events (`end: null`) pulse and
64
+ * grow until completed.
65
+ */
66
+ events: HistoryTimelineEvent[];
67
+ /** Subject display name for the detail panel (e.g. `Order ORD-58291`). */
68
+ subjectName?: ReactNode;
69
+ /** Controlled orientation. */
70
+ orientation?: HistoryTimelineOrientation;
71
+ /**
72
+ * Initial orientation (uncontrolled). Defaults to `'horizontal'`, falling
73
+ * back to `'vertical'` on narrow (<700px) viewports.
74
+ */
75
+ defaultOrientation?: HistoryTimelineOrientation;
76
+ /** Fired when the built-in toggle switches orientation. */
77
+ onOrientationChange?: (o: HistoryTimelineOrientation) => void;
78
+ /** Controlled spacing mode. */
79
+ spacing?: HistoryTimelineSpacing;
80
+ /**
81
+ * Initial spacing (uncontrolled): `'equal'` index-based, `'log'`
82
+ * gap-compressed (dense bursts stay readable next to huge gaps),
83
+ * `'proportional'` linear time. @default 'equal'
84
+ */
85
+ defaultSpacing?: HistoryTimelineSpacing;
86
+ /** Fired when the built-in toggle switches spacing. */
87
+ onSpacingChange?: (s: HistoryTimelineSpacing) => void;
88
+ /**
89
+ * Controlled keyword highlight: case-insensitive AND over
90
+ * whitespace-separated tokens against each event's JSON. Matches get an
91
+ * amber wash; non-matches dim. When set, the built-in search box reflects
92
+ * it — pair with `onHighlightChange` (or use `defaultHighlight` for
93
+ * uncontrolled).
94
+ */
95
+ highlight?: string;
96
+ /** Initial keyword for the built-in search box (uncontrolled). */
97
+ defaultHighlight?: string;
98
+ /** Fired when the keyword changes via the built-in box or `renderSearch`. */
99
+ onHighlightChange?: (value: string) => void;
100
+ /** Built-in "Highlight keyword…" box in the toolbar. @default true */
101
+ showSearch?: boolean;
102
+ /** Replace the built-in search box with a custom element in the toolbar. */
103
+ renderSearch?: (api: {
104
+ value: string;
105
+ setValue: (value: string) => void;
106
+ }) => ReactNode;
107
+ /** Tag→color overrides (any CSS color). Unknown tags cycle the palette. */
108
+ tagColors?: Record<string, string>;
109
+ /** Toolbar with orientation/spacing toggles + zoom controls. @default true */
110
+ showControls?: boolean;
111
+ /** Colored bullet + tag name legend. @default true */
112
+ showLegend?: boolean;
113
+ /**
114
+ * Dense one-line-per-event summary panel beside the timeline: all events
115
+ * numbered chronologically from `01` (matching the card numbers), a
116
+ * highlight band over the events currently visible in the viewport
117
+ * (auto-follows drag-panning), and click-to-navigate — the timeline
118
+ * smooth-scrolls (~1s, decelerating) to center the picked event. The panel
119
+ * scrolls independently.
120
+ * @default false
121
+ */
122
+ showSummary?: boolean;
123
+ /**
124
+ * Where the summary panel sits: docked `'left'`/`'right'` of the timeline,
125
+ * full-width `'top'`/`'bottom'`, or `'floating'` — a draggable palette over
126
+ * the timeline, grabbed by its header. @default 'left'
127
+ */
128
+ summaryPlacement?: TimelineSummaryPlacement;
129
+ /** Floating summary: initial offset from the component's top-left corner. */
130
+ summaryDefaultPosition?: DraggablePosition;
131
+ /** Max height of the scrollable canvas. Defaults to 84vh (h) / 78vh (v). */
132
+ maxHeight?: number | string;
133
+ /** Controlled id of the event open in the detail panel (`null` = closed). */
134
+ selectedEventId?: string | null;
135
+ /** Initially open event (uncontrolled). */
136
+ defaultSelectedEventId?: string | null;
137
+ /** Fired when an event is opened (event) or closed (`null`). */
138
+ onEventSelect?: (event: HistoryTimelineEvent | null) => void;
139
+ /**
140
+ * Replace the card's inner content (default: number + tag dot + title,
141
+ * time, detail, duration badge). The card box geometry is still computed
142
+ * from the default content (title/detail lengths), so keep custom content
143
+ * roughly equivalent in size.
144
+ */
145
+ renderCard?: (event: HistoryTimelineEvent, ctx: HistoryTimelineItemContext) => ReactNode;
146
+ /**
147
+ * Replace the tooltip content. When set, the tooltip shows for every
148
+ * hovered card (not only when it adds information); return `null` to
149
+ * suppress it for that event.
150
+ */
151
+ renderTooltip?: (event: HistoryTimelineEvent, ctx: HistoryTimelineItemContext) => ReactNode;
152
+ /** Replace the detail side panel content; the sticky panel shell is kept. */
153
+ renderDetails?: (event: HistoryTimelineEvent, api: {
154
+ close: () => void;
155
+ ongoing: boolean;
156
+ }) => ReactNode;
157
+ /** Override class names on internal elements. */
158
+ classes?: Partial<HistoryTimelineClasses>;
159
+ className?: string;
160
+ style?: CSSProperties;
161
+ }
162
+ /**
163
+ * Subject history timeline: the life of one entity as numbered event cards
164
+ * alternating around a central axis (above/below horizontally, left/right
165
+ * vertically), with the handoff's collision-free reconciliation — clustered
166
+ * side split, outward-stepping circles, straight or Z-shaped leads, and
167
+ * burst groups whose members condense and stack on consecutive rows. Three
168
+ * spacing modes (equal / log-compressed / proportional), wheel-zoom with
169
+ * cross-axis fit, drag-pan, keyword highlighting, tooltips only when they
170
+ * add information, and a click-to-open detail side panel.
171
+ *
172
+ * @example
173
+ * ```tsx
174
+ * <HistoryTimeline
175
+ * subjectName="Order ORD-58291"
176
+ * events={[
177
+ * { id: '1', title: 'Order created', tag: 'created', start: t1 },
178
+ * { id: '2', title: 'Fraud review', tag: 'review', start: t2, end: t2 + 2 * HOUR },
179
+ * { id: '3', title: 'In transit', tag: 'shipping', start: t3, end: null }, // ongoing
180
+ * ]}
181
+ * />
182
+ * ```
183
+ */
184
+ export declare const HistoryTimeline: import('react').ForwardRefExoticComponent<HistoryTimelineProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,445 @@
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";
3
+ import f from "clsx";
4
+ import r from "./Timeline.module.scss.js";
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 = {
11
+ created: m[0],
12
+ done: m[0],
13
+ live: m[0],
14
+ payment: m[1],
15
+ people: m[1],
16
+ review: m[2],
17
+ action: m[2],
18
+ offer: m[2],
19
+ fulfilment: m[3],
20
+ analysis: m[3],
21
+ shipping: m[4],
22
+ interview: m[4],
23
+ exception: "var(--crk-timeline-danger, #b3372f)",
24
+ alert: "var(--crk-timeline-danger, #b3372f)"
25
+ }, Ft = st(
26
+ function(Ce, Le) {
27
+ const {
28
+ events: le,
29
+ subjectName: oe,
30
+ orientation: ie,
31
+ defaultOrientation: De,
32
+ onOrientationChange: Ee,
33
+ spacing: ae,
34
+ defaultSpacing: Pe = "equal",
35
+ onSpacingChange: Oe,
36
+ highlight: X,
37
+ defaultHighlight: We,
38
+ onHighlightChange: Re,
39
+ showSearch: Fe = !0,
40
+ renderSearch: re,
41
+ tagColors: se,
42
+ showControls: ce = !0,
43
+ showLegend: Ae = !0,
44
+ showSummary: F = !1,
45
+ summaryPlacement: H = "left",
46
+ summaryDefaultPosition: Ve,
47
+ maxHeight: de,
48
+ selectedEventId: Z,
49
+ defaultSelectedEventId: ze = null,
50
+ onEventSelect: Ie,
51
+ renderCard: ue,
52
+ renderTooltip: A,
53
+ renderDetails: K,
54
+ classes: h,
55
+ className: Ye,
56
+ style: je
57
+ } = Ce, w = L(null), [qe, Xe] = b(
58
+ () => 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
+ fe.current = F;
61
+ const G = L(null), B = q(() => {
62
+ const e = w.current;
63
+ e && Be(
64
+ (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
+ }, []), Je = q(() => {
67
+ !fe.current || G.current != null || (G.current = requestAnimationFrame(() => {
68
+ G.current = null, B();
69
+ }));
70
+ }, [B]);
71
+ ct(() => {
72
+ F && B();
73
+ });
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(
77
+ "input",
78
+ {
79
+ className: f(r.searchInput, h?.search),
80
+ placeholder: "Highlight keyword in events…",
81
+ "aria-label": "Highlight keyword",
82
+ value: J,
83
+ onChange: (e) => ge(e.target.value)
84
+ }
85
+ ) : null, c = xe(
86
+ () => le.map((e) => ({
87
+ ...e,
88
+ end: e.end !== void 0 ? e.end : e.ongoing ? null : e.start
89
+ })).sort((e, n) => e.start - n.start),
90
+ [le]
91
+ ), et = c.some((e) => e.end == null), x = Nt(et, 500), tt = St(w), O = bt(w), M = q(
92
+ (e) => {
93
+ const n = e || "event", t = { ...kt, ...se };
94
+ if (t[n]) return t[n];
95
+ const o = String(n).charCodeAt(0) || 0;
96
+ return m[(String(n).length + o) % m.length];
97
+ },
98
+ [se]
99
+ ), s = ft(
100
+ c.map((e) => ({
101
+ id: e.id,
102
+ title: String(e.title || ""),
103
+ detail: String(e.detail || ""),
104
+ start: e.start,
105
+ end: e.end ?? null
106
+ })),
107
+ {
108
+ orientation: V,
109
+ spacing: U,
110
+ containerWidth: tt,
111
+ viewportHeight: typeof window < "u" && window.innerHeight || 800,
112
+ now: x,
113
+ k: he ? "fit" : Ue
114
+ }
115
+ ), z = new Map(s.items.map((e) => [e.id, e])), we = L(s.kFit), ye = L(s.kEff);
116
+ we.current = s.kFit, ye.current = s.kEff;
117
+ const k = L(null);
118
+ dt(() => {
119
+ 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
+ });
122
+ const $ = q(
123
+ (e, n) => {
124
+ const t = w.current;
125
+ 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);
128
+ },
129
+ [y]
130
+ );
131
+ Tt(
132
+ w,
133
+ (e) => {
134
+ e.preventDefault();
135
+ const n = w.current;
136
+ if (!n) return;
137
+ const t = n.getBoundingClientRect(), o = y ? e.clientX - t.left : e.clientY - t.top;
138
+ $(Math.exp(-(e.deltaY || e.deltaX) * 22e-4), o);
139
+ },
140
+ V
141
+ );
142
+ const Ne = () => {
143
+ const e = w.current;
144
+ return e ? y ? e.clientWidth / 2 : e.clientHeight / 2 : 300;
145
+ }, Q = (e) => {
146
+ Z === void 0 && Ge(e ? e.id : null), Ie?.(e);
147
+ }, nt = (e) => {
148
+ ie === void 0 && Xe(e), Ee?.(e);
149
+ }, lt = (e) => {
150
+ ae === void 0 && Ke(e), Oe?.(e);
151
+ }, ot = (e) => {
152
+ 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
+ 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) => {
155
+ 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);
157
+ };
158
+ let ee = [];
159
+ 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";
161
+ ee = p.list.map((g) => ({
162
+ pos: Math.round(e(g.t)),
163
+ label: Se(g.t, d)
164
+ }));
165
+ } else {
166
+ const e = I > 550 * E ? "y" : I > 60 * E ? "my" : I > 2 * E ? "d" : "c", n = y ? 72 : 18;
167
+ let t = null, o = -1e9;
168
+ c.forEach((p, d) => {
169
+ const g = Se(p.start, e), v = Math.round(s.posArr[d]);
170
+ g !== t && v - o >= n && (ee.push({ pos: v, label: g }), t = g, o = v);
171
+ });
172
+ }
173
+ const at = xe(() => {
174
+ const e = [];
175
+ return c.forEach((n) => {
176
+ const t = n.tag || "event";
177
+ e.includes(t) || e.push(t);
178
+ }), 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
+ {
182
+ 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);
187
+ return {
188
+ id: e.id,
189
+ number: String(n + 1).padStart(2, "0"),
190
+ label: e.title,
191
+ color: M(e.tag),
192
+ time: R(e.start),
193
+ inView: o,
194
+ selected: P === e.id
195
+ };
196
+ }),
197
+ onPick: (e) => {
198
+ const n = z.get(e), t = w.current;
199
+ if (!n || !t) return;
200
+ 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);
202
+ }
203
+ }
204
+ ) : 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
+ /* @__PURE__ */ l("div", { className: r.toolbarText }),
208
+ ve,
209
+ ce && /* @__PURE__ */ u(ne, { children: [
210
+ /* @__PURE__ */ l(
211
+ He,
212
+ {
213
+ value: V,
214
+ options: [
215
+ { value: "horizontal", label: "Horizontal" },
216
+ { value: "vertical", label: "Vertical" }
217
+ ],
218
+ onChange: nt
219
+ }
220
+ ),
221
+ /* @__PURE__ */ l(
222
+ He,
223
+ {
224
+ value: U,
225
+ options: [
226
+ { value: "equal", label: "Equal" },
227
+ {
228
+ value: "log",
229
+ label: "Log",
230
+ title: "Logarithmic gaps — long waits compressed"
231
+ },
232
+ { value: "proportional", label: "Proportional" }
233
+ ],
234
+ onChange: lt
235
+ }
236
+ ),
237
+ /* @__PURE__ */ l(
238
+ vt,
239
+ {
240
+ zoomPct: `${Math.round(s.kEff / s.kFit * 100)}%`,
241
+ fitActive: he,
242
+ onZoomIn: () => $(1.5, Ne()),
243
+ onZoomOut: () => $(1 / 1.5, Ne()),
244
+ onFit: () => {
245
+ pe(!0), me(1);
246
+ }
247
+ }
248
+ )
249
+ ] })
250
+ ] }),
251
+ Ae && /* @__PURE__ */ l(
252
+ wt,
253
+ {
254
+ className: h?.legend,
255
+ items: at.map((e) => ({ name: e, color: M(e) }))
256
+ }
257
+ ),
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
+ });
356
+ },
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
+ ) }),
379
+ /* @__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
+ ] }),
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: [
384
+ /* @__PURE__ */ l(
385
+ "span",
386
+ {
387
+ className: i.drawerTag,
388
+ style: {
389
+ background: mt(M(a.tag), 12),
390
+ color: M(a.tag)
391
+ },
392
+ children: a.tag || "event"
393
+ }
394
+ ),
395
+ (oe ?? a.subject) != null && /* @__PURE__ */ l("span", { className: i.drawerSubject, children: oe ?? a.subject }),
396
+ /* @__PURE__ */ l("div", { className: i.drawerSpacer }),
397
+ /* @__PURE__ */ l(
398
+ "button",
399
+ {
400
+ type: "button",
401
+ className: r.asideClose,
402
+ "aria-label": "Close details",
403
+ onClick: () => Q(null),
404
+ children: "✕"
405
+ }
406
+ )
407
+ ] }),
408
+ /* @__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) : "") }),
410
+ /* @__PURE__ */ l("div", { className: i.drawerDetail, children: a.detail || "—" }),
411
+ /* @__PURE__ */ l("div", { className: r.asideSection, children: "Raw event" }),
412
+ /* @__PURE__ */ l("pre", { className: r.asideRaw, children: JSON.stringify(a, null, 2) })
413
+ ] }),
414
+ (H === "right" || H === "floating") && Y
415
+ ] }),
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, {
419
+ index: n,
420
+ number: String(n + 1).padStart(2, "0"),
421
+ color: M(e.tag),
422
+ ongoing: e.end == null,
423
+ condensed: z.get(e.id)?.condensed ?? !1,
424
+ durationMs: (e.end == null ? x : e.end) - e.start
425
+ }) : 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 }),
428
+ /* @__PURE__ */ l(
429
+ "div",
430
+ {
431
+ className: f(r.tooltipLine, r.tooltipMono),
432
+ style: { marginTop: 4 },
433
+ children: S.time
434
+ }
435
+ ),
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 })
438
+ ] }) });
439
+ })()
440
+ ] });
441
+ }
442
+ );
443
+ export {
444
+ Ft as HistoryTimeline
445
+ };
@@ -0,0 +1,59 @@
1
+ const r = "crk-scrollerH-LFjBZ", c = "crk-scrollerV-bq4-N", a = "crk-inner-UOGZr", e = "crk-gridlineH-vNcMq", t = "crk-tickLabelH-9D3Vy", d = "crk-gridlineV-3Hh4e", n = "crk-tickLabelV-J1uG2", i = "crk-axisH-glZQm", o = "crk-axisV-cnYLL", s = "crk-seg-Jy0m7", l = "crk-dot-y6jZ-", k = "crk-eventCard-bgrfd", g = "crk-cardTitle-AXpEz", w = "crk-cardNum-RwPgr", T = "crk-cardTagDot-nHFoA", H = "crk-cardOngoingDot-U7vkl", D = "crk-cardTime-YR4zJ", V = "crk-cardDetail-xXigO", b = "crk-cardDur-zvm0a", m = "crk-drawer-PNT-u", u = "crk-drawerHead-YQ7XA", L = "crk-drawerTag-nM-Vq", x = "crk-drawerSubject-AIsj3", j = "crk-drawerSpacer-7yhCb", p = "crk-drawerTitle-y-rwh", v = "crk-drawerTiming-55UzB", y = "crk-drawerDetail-pagRq", N = {
2
+ scrollerH: r,
3
+ scrollerV: c,
4
+ inner: a,
5
+ gridlineH: e,
6
+ tickLabelH: t,
7
+ gridlineV: d,
8
+ tickLabelV: n,
9
+ axisH: i,
10
+ axisV: o,
11
+ seg: s,
12
+ dot: l,
13
+ eventCard: k,
14
+ cardTitle: g,
15
+ cardNum: w,
16
+ cardTagDot: T,
17
+ cardOngoingDot: H,
18
+ cardTime: D,
19
+ cardDetail: V,
20
+ cardDur: b,
21
+ drawer: m,
22
+ drawerHead: u,
23
+ drawerTag: L,
24
+ drawerSubject: x,
25
+ drawerSpacer: j,
26
+ drawerTitle: p,
27
+ drawerTiming: v,
28
+ drawerDetail: y
29
+ };
30
+ export {
31
+ i as axisH,
32
+ o as axisV,
33
+ V as cardDetail,
34
+ b as cardDur,
35
+ w as cardNum,
36
+ H as cardOngoingDot,
37
+ T as cardTagDot,
38
+ D as cardTime,
39
+ g as cardTitle,
40
+ N as default,
41
+ l as dot,
42
+ m as drawer,
43
+ y as drawerDetail,
44
+ u as drawerHead,
45
+ j as drawerSpacer,
46
+ x as drawerSubject,
47
+ L as drawerTag,
48
+ v as drawerTiming,
49
+ p as drawerTitle,
50
+ k as eventCard,
51
+ e as gridlineH,
52
+ d as gridlineV,
53
+ a as inner,
54
+ r as scrollerH,
55
+ c as scrollerV,
56
+ s as seg,
57
+ t as tickLabelH,
58
+ n as tickLabelV
59
+ };