@overdoser/react-toolkit 0.8.3 → 0.9.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.
Files changed (32) hide show
  1. package/AGENTS.md +6 -0
  2. package/CHANGELOG.md +35 -0
  3. package/components/Timeline/GanttTimeline.d.ts +144 -0
  4. package/components/Timeline/GanttTimeline.js +305 -0
  5. package/components/Timeline/GanttTimeline.module.scss.js +55 -0
  6. package/components/Timeline/HistoryTimeline.d.ts +184 -0
  7. package/components/Timeline/HistoryTimeline.js +445 -0
  8. package/components/Timeline/HistoryTimeline.module.scss.js +59 -0
  9. package/components/Timeline/Timeline.module.scss.js +111 -0
  10. package/components/Timeline/TimelineShared.d.ts +79 -0
  11. package/components/Timeline/TimelineShared.js +173 -0
  12. package/components/Timeline/TraceTimeline.d.ts +180 -0
  13. package/components/Timeline/TraceTimeline.js +511 -0
  14. package/components/Timeline/TraceTimeline.module.scss.js +105 -0
  15. package/components/Timeline/demoData.d.ts +42 -0
  16. package/components/Timeline/historyLayout.d.ts +82 -0
  17. package/components/Timeline/historyLayout.js +264 -0
  18. package/components/Timeline/index.d.ts +7 -0
  19. package/components/Timeline/timelineCore.d.ts +90 -0
  20. package/components/Timeline/timelineCore.js +135 -0
  21. package/components/Timeline/traceLayout.d.ts +72 -0
  22. package/components/Timeline/traceLayout.js +92 -0
  23. package/components/Timeline/useTimeline.d.ts +39 -0
  24. package/components/Timeline/useTimeline.js +81 -0
  25. package/index.css +1 -1
  26. package/index.d.ts +2 -0
  27. package/index.js +93 -87
  28. package/index.layered.css +1 -1
  29. package/llms.txt +113 -0
  30. package/manifest.json +323 -0
  31. package/package.json +1 -1
  32. package/recipes/live-timeline-feed.tsx +147 -0
package/AGENTS.md CHANGED
@@ -101,6 +101,11 @@ For exhaustive component reference (every prop, every variant, every signature),
101
101
  - Tiny inline trend (table cell, KPI tile) → `<Sparkline>`.
102
102
  - Axis-based charts share a `config` object: `{ [dataKey]: { label, color } }`. `PieChart` uses `nameKey` + `valueKey` (+ optional `colorKey`) instead. Colors via `var(--crk-chart-1)` … `var(--crk-chart-5)`.
103
103
 
104
+ - **Need a timeline of events?** Three views, all fully controlled (you pass the pre-filtered event array; items without an `end` render live and keep growing until an update completes them), all with wheel-zoom / drag-pan / Fit, keyword highlighting (built-in toolbar search box by default — `showSearch={false}` to hide, `renderSearch` to inject your own element, or controlled `highlight` + `onHighlightChange` for an external box), tooltips, a click-to-open detail side panel, and an optional `showSummary` panel (dense numbered event list with a live viewport band and click-to-navigate smooth scrolling; `summaryPlacement` docks it left/right/top/bottom or floats it as a draggable palette). Customize via `--crk-timeline-*` tokens, `classes`, or render-prop slots (`renderChip`/`renderCard`/`renderBar`+`renderRowLabel`, `renderTooltip`, `renderDetails`) that inject custom components while the layout algorithms keep owning geometry:
105
+ - Request/response flow across services (one correlated "manifest"/saga/order) on a proportional UTC band → `<TraceTimeline events title services highlight />`.
106
+ - One subject's life story (order, incident, candidate, deploy) as cards alternating around an axis, horizontal or vertical, equal/log/proportional spacing → `<HistoryTimeline events subjectName defaultSpacing />`.
107
+ - Tasks stacked by start time with duration bars (Gantt) → `<GanttTimeline tasks title onTaskSelect />`.
108
+
104
109
  - **Multi-step / wizard form?** Use one `useForm()` per step OR a single `<Form>` wrapping all steps with conditional rendering. The toolkit doesn't ship a stepper.
105
110
 
106
111
  ## Common shapes (copy-paste)
@@ -172,6 +177,7 @@ Full copy-paste-able files live alongside this doc. Each is one self-contained f
172
177
  - [recipes/interactive-pie-chart.tsx](./recipes/interactive-pie-chart.tsx) — Metric/period filter for `PieChart`: all slices stay visible, the selector picks which metric drives the pie. Three exports: `InteractivePieChartTiles`, `InteractivePieChartNavigator`, `InteractivePieChartDropdown`.
173
178
  - [recipes/trading-chart.tsx](./recipes/trading-chart.tsx) — Full-stack `TradingChart` with a resolution selector, in-memory datafeed adapter, and the SMA/EMA/Bollinger/RSI/Volume indicator stack. Swap `createMemoryDatafeed` for your own REST/WebSocket adapter; everything else carries over.
174
179
  - [recipes/tag-input.tsx](./recipes/tag-input.tsx) — Tag-input pattern via `<Select multiple allowCreate>`: pick from existing tags or type a new one + Enter to create. `onCreate` persists the new tag back into the options list. Wired through `<FormField>` for react-hook-form integration.
180
+ - [recipes/live-timeline-feed.tsx](./recipes/live-timeline-feed.tsx) — Live event feeds into `TraceTimeline` / `HistoryTimeline` / `GanttTimeline`: consumer-side push/complete merge hooks (start appends with `end: null`, complete merges response fields + stamps `end`), optional WebSocket source, and consumer-side correlation filtering.
175
181
  - [recipes/multi-select-in-modal.tsx](./recipes/multi-select-in-modal.tsx) — `<Select multiple>` inside `<Modal size="sm">`. Default `portal={true}` lets the menu escape the modal's `overflow: hidden` and sit above the modal via `--crk-z-floating`, so the modal does NOT need to be sized to contain the menu. Pair with `closeOnBackdrop={false}` so a backdrop click closes the open menu only, not the modal.
176
182
 
177
183
  ## Anti-patterns to refuse
package/CHANGELOG.md CHANGED
@@ -4,6 +4,41 @@ All notable changes to `@overdoser/react-toolkit` are documented here.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/), and this
5
5
  project adheres to [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.9.0]
8
+
9
+ Introduces the Timeline family: three timeline views built from the
10
+ timeline-views design handoff, sharing one theming/customization surface.
11
+ Components render whatever event arrays they are given — filtering,
12
+ correlation, and live-feed sourcing stay in consumer code.
13
+
14
+ ### Added
15
+
16
+ - **`TraceTimeline`** — horizontal trace view for correlated
17
+ request/response (or custom) events, e.g. tracking one manifest across
18
+ services. Sub-row bar packing plus chip nudging keeps labels
19
+ overlap-free; events without an `end` render as live/growing; clicking
20
+ an event opens a details drawer (`renderDetails` to replace it).
21
+ - **`HistoryTimeline`** — subject history view with event circles and
22
+ description chips, horizontal or vertical, with `equal`/`proportional`/
23
+ `log` spacing. Connector segments are routed around circles and other
24
+ segments; chip heights are content-computed so chips never overlap.
25
+ - **`GanttTimeline`** — project-planning view with task bars, progress,
26
+ and row labels.
27
+ - Shared across the family: built-in hideable controls (zoom, orientation
28
+ and spacing where relevant) with controlled/uncontrolled props; a
29
+ built-in keyword-highlight search box (`showSearch`, `highlight` /
30
+ `defaultHighlight` / `onHighlightChange`, or inject your own element via
31
+ `renderSearch`); an optional summary panel (`showSummary`) listing every
32
+ event as a numbered dense row with a viewport band tracking what's
33
+ visible and ~1s smooth scroll-to-event on click, placeable
34
+ `left`/`right`/`top`/`bottom` or `floating` (draggable);
35
+ render-prop slots (`renderChip`/`renderCard`/`renderBar`/
36
+ `renderRowLabel`/`renderTooltip`/`renderDetails`); `classes` overrides;
37
+ and `--crk-timeline-*` theme tokens defaulting to the handoff palette.
38
+ - New recipe `recipes/live-timeline-feed.tsx` — push/complete merge hooks
39
+ for feeding live events into any of the three views (WebSocket example
40
+ included).
41
+
7
42
  ## [0.8.3]
8
43
 
9
44
  One more callback-ref fix, found by auditing for the 0.8.1/0.8.2
@@ -0,0 +1,144 @@
1
+ import { CSSProperties, ReactNode } from 'react';
2
+ import { TimelineSummaryPlacement } from './TimelineShared';
3
+ import { DraggablePosition } from '../Draggable';
4
+ /** One task row. A task with no `end` is running and keeps growing. */
5
+ export interface GanttTimelineTask {
6
+ /** Stable identifier (selection, completion). */
7
+ id: string;
8
+ /** Task name shown in the sticky label column. */
9
+ name: string;
10
+ /** Longer description shown in the tooltip and detail panel. */
11
+ detail?: string;
12
+ /** Owner shown in the tooltip and detail panel. */
13
+ owner?: string;
14
+ /** Start time, epoch ms. */
15
+ start: number;
16
+ /** End time, epoch ms. `null`/`undefined` while the task is still running. */
17
+ end?: number | null;
18
+ /** Extra fields are allowed and participate in keyword matching. */
19
+ [extra: string]: unknown;
20
+ }
21
+ export interface GanttTimelineClasses {
22
+ root: string;
23
+ toolbar: string;
24
+ card: string;
25
+ scroller: string;
26
+ axis: string;
27
+ row: string;
28
+ rowLabel: string;
29
+ bar: string;
30
+ summary: string;
31
+ search: string;
32
+ drawer: string;
33
+ tooltip: string;
34
+ footnote: string;
35
+ }
36
+ /** Context handed to the GanttTimeline render-prop slots. */
37
+ export interface GanttTimelineItemContext {
38
+ /** Row index after sorting by start time. */
39
+ index: number;
40
+ /** Resolved row color. */
41
+ color: string;
42
+ /** True while the task has no `end`. */
43
+ running: boolean;
44
+ /** Duration so far, ms. */
45
+ durationMs: number;
46
+ }
47
+ export interface GanttTimelineProps {
48
+ /**
49
+ * Tasks to render, one row each, sorted by start time. Provide the already
50
+ * filtered/pre-processed list — the component applies no filtering. Push
51
+ * updated arrays to animate a live feed; a task whose `end` is unset renders
52
+ * as running (dashed, pulsing) and grows until an update supplies its `end`.
53
+ */
54
+ tasks: GanttTimelineTask[];
55
+ /** Title shown in the toolbar above the chart. */
56
+ title?: ReactNode;
57
+ /** Meta text next to the title. Defaults to `N tasks · span · K running`. */
58
+ meta?: ReactNode;
59
+ /**
60
+ * Controlled keyword highlight: case-insensitive AND over
61
+ * whitespace-separated tokens, matched against each task's JSON. Matching
62
+ * rows get highlighted bars and marked substrings; non-matching rows dim.
63
+ * When set, the built-in search box reflects it — pair with
64
+ * `onHighlightChange` (or use `defaultHighlight` for uncontrolled).
65
+ */
66
+ highlight?: string;
67
+ /** Initial keyword for the built-in search box (uncontrolled). */
68
+ defaultHighlight?: string;
69
+ /** Fired when the keyword changes via the built-in box or `renderSearch`. */
70
+ onHighlightChange?: (value: string) => void;
71
+ /** Built-in "Highlight keyword…" box in the toolbar. @default true */
72
+ showSearch?: boolean;
73
+ /** Replace the built-in search box with a custom element in the toolbar. */
74
+ renderSearch?: (api: {
75
+ value: string;
76
+ setValue: (value: string) => void;
77
+ }) => ReactNode;
78
+ /** Tighter 42px rows instead of 54px. @default false */
79
+ compactRows?: boolean;
80
+ /** Vertical gridlines under each axis tick. @default true */
81
+ showGridlines?: boolean;
82
+ /** Toolbar row with the zoom −/%/+/Fit controls. @default true */
83
+ showControls?: boolean;
84
+ /**
85
+ * Dense one-line-per-task summary panel beside the chart: all tasks
86
+ * numbered chronologically from `01`, a highlight band over the tasks
87
+ * currently visible in the viewport (auto-follows drag-panning), and
88
+ * click-to-navigate — the chart smooth-scrolls (~1s, decelerating) to
89
+ * center the picked task. The panel scrolls independently.
90
+ * @default false
91
+ */
92
+ showSummary?: boolean;
93
+ /**
94
+ * Where the summary panel sits: docked `'left'`/`'right'` of the chart,
95
+ * full-width `'top'`/`'bottom'`, or `'floating'` — a draggable palette over
96
+ * the chart, grabbed by its header. @default 'left'
97
+ */
98
+ summaryPlacement?: TimelineSummaryPlacement;
99
+ /** Floating summary: initial offset from the component's top-left corner. */
100
+ summaryDefaultPosition?: DraggablePosition;
101
+ /** Max height of the scrollable chart area. @default '74vh' */
102
+ maxHeight?: number | string;
103
+ /** Controlled id of the task open in the detail panel (`null` = closed). */
104
+ selectedTaskId?: string | null;
105
+ /** Initially open task (uncontrolled). */
106
+ defaultSelectedTaskId?: string | null;
107
+ /** Fired when a task is opened (task) or closed (`null`). */
108
+ onTaskSelect?: (task: GanttTimelineTask | null) => void;
109
+ /** Replace the sticky label-column content (default: name + date range). */
110
+ renderRowLabel?: (task: GanttTimelineTask, ctx: GanttTimelineItemContext) => ReactNode;
111
+ /** Replace the content inside the bar pill (default: pulse dot + duration text; also suppresses the outside duration text). Geometry stays component-owned. */
112
+ renderBar?: (task: GanttTimelineTask, ctx: GanttTimelineItemContext) => ReactNode;
113
+ /** Replace the tooltip content. Return `null` to suppress the tooltip for that task. */
114
+ renderTooltip?: (task: GanttTimelineTask, ctx: GanttTimelineItemContext) => ReactNode;
115
+ /** Replace the detail side panel content; the sticky panel shell is kept. */
116
+ renderDetails?: (task: GanttTimelineTask, api: {
117
+ close: () => void;
118
+ running: boolean;
119
+ }) => ReactNode;
120
+ /** Override class names on internal elements. */
121
+ classes?: Partial<GanttTimelineClasses>;
122
+ className?: string;
123
+ style?: CSSProperties;
124
+ }
125
+ /**
126
+ * Gantt-style task timeline: rows stacked by start time, horizontal bars
127
+ * proportional to duration, a sticky label column and time axis. Running
128
+ * tasks (no `end`) grow live with a pulsing dashed bar and a "now" line.
129
+ * Wheel-zoom (cursor-anchored), drag-to-pan, fit-to-width, keyword
130
+ * highlighting, hover tooltips, and a click-to-open detail side panel.
131
+ *
132
+ * @example
133
+ * ```tsx
134
+ * <GanttTimeline
135
+ * title="Platform Relaunch — Q3"
136
+ * tasks={[
137
+ * { id: 't1', name: 'Kickoff', owner: 'P. Marsh', start: t0, end: t0 + 2 * DAY },
138
+ * { id: 't2', name: 'Pilot rollout', owner: 'QA', start: t0 + 5 * DAY }, // running
139
+ * ]}
140
+ * highlight={keyword}
141
+ * />
142
+ * ```
143
+ */
144
+ export declare const GanttTimeline: import('react').ForwardRefExoticComponent<GanttTimelineProps & import('react').RefAttributes<HTMLDivElement>>;
@@ -0,0 +1,305 @@
1
+ import { jsx as n, jsxs as h, Fragment as le } from "react/jsx-runtime";
2
+ import { forwardRef as Xe, useRef as k, useState as L, useCallback as ae, useEffect as Ye, useMemo as _e, useLayoutEffect as je } from "react";
3
+ import c from "clsx";
4
+ import r from "./Timeline.module.scss.js";
5
+ import l from "./GanttTimeline.module.scss.js";
6
+ import { ticks as qe, TIMELINE_PALETTE_VARS as b, fmtDate as re, fmtDur as V, eventMatches as Je, fmtDateTime as F, tint as Qe } from "./timelineCore.js";
7
+ import { TimelineSummary as en, TimelineZoomControls as nn, HighlightText as tn, TimelineTooltip as ln } from "./TimelineShared.js";
8
+ import { useNowTicker as an, useContainerWidth as rn, useTimelinePan as sn, useWheelZoom as on, animateScrollTo as cn } from "./useTimeline.js";
9
+ const v = 230, be = 24, dn = 26, Mn = Xe(
10
+ function(ye, Te) {
11
+ const {
12
+ tasks: Z,
13
+ title: z,
14
+ meta: B,
15
+ highlight: $,
16
+ defaultHighlight: Se,
17
+ onHighlightChange: ke,
18
+ showSearch: Le = !0,
19
+ renderSearch: se,
20
+ compactRows: Re = !1,
21
+ showGridlines: Pe = !0,
22
+ showControls: ie = !0,
23
+ showSummary: H = !1,
24
+ summaryPlacement: T = "left",
25
+ summaryDefaultPosition: De,
26
+ maxHeight: He = "74vh",
27
+ selectedTaskId: G,
28
+ defaultSelectedTaskId: Ce = null,
29
+ onTaskSelect: We,
30
+ renderRowLabel: oe,
31
+ renderBar: K,
32
+ renderTooltip: U,
33
+ renderDetails: X,
34
+ classes: d,
35
+ className: Ie,
36
+ style: Ee
37
+ } = ye, f = k(null), [ce, de] = L(null), [ue, me] = L(!0), [w, Y] = L(null), [Ae, Oe] = L(Ce), R = G !== void 0 ? G : Ae, [x, Ve] = L({ l: 0, t: 0, w: 0, h: 0 }), he = k(H);
38
+ he.current = H;
39
+ const _ = k(null), j = ae(() => {
40
+ const e = f.current;
41
+ e && Ve(
42
+ (t) => t.l === e.scrollLeft && t.t === e.scrollTop && t.w === e.clientWidth && t.h === e.clientHeight ? t : { l: e.scrollLeft, t: e.scrollTop, w: e.clientWidth, h: e.clientHeight }
43
+ );
44
+ }, []), Fe = ae(() => {
45
+ !he.current || _.current != null || (_.current = requestAnimationFrame(() => {
46
+ _.current = null, j();
47
+ }));
48
+ }, [j]);
49
+ Ye(() => {
50
+ H && j();
51
+ });
52
+ const fe = Z.some((e) => e.end == null), g = an(fe, 400), q = rn(f), P = sn(f), [Ze, ze] = L(Se ?? ""), J = $ !== void 0 ? $ : Ze, C = J.trim(), pe = (e) => {
53
+ $ === void 0 && ze(e), ke?.(e);
54
+ }, we = se ? se({ value: J, setValue: pe }) : Le ? /* @__PURE__ */ n(
55
+ "input",
56
+ {
57
+ className: c(r.searchInput, d?.search),
58
+ placeholder: "Highlight keyword in tasks…",
59
+ "aria-label": "Highlight keyword",
60
+ value: J,
61
+ onChange: (e) => pe(e.target.value)
62
+ }
63
+ ) : null, i = _e(() => Z.slice().sort((e, t) => e.start - t.start), [Z]);
64
+ let p = i.length ? Math.min(...i.map((e) => e.start)) : g - 1, W = i.length ? Math.max(p + 1, ...i.map((e) => e.end == null ? g : e.end)) : g;
65
+ const Q = (W - p) * 0.03;
66
+ p -= Q, W += Q;
67
+ const I = W - p, E = Math.max(240, q - v - be) / I, u = ue || !ce ? E : ce, ee = k(E), ge = k(u);
68
+ ee.current = E, ge.current = u;
69
+ const A = k(null);
70
+ je(() => {
71
+ A.current != null && f.current && (f.current.scrollLeft = A.current, A.current = null);
72
+ });
73
+ const ne = ae((e, t) => {
74
+ const a = f.current;
75
+ if (!a) return;
76
+ const o = ge.current || 1e-4, m = Math.max(ee.current ? ee.current * 0.2 : 1e-9, Math.min(1, o * e)), N = (a.scrollLeft + t - v) / o;
77
+ A.current = N * m + v - t, me(!1), de(m);
78
+ }, []);
79
+ on(f, (e) => {
80
+ e.preventDefault();
81
+ const t = f.current;
82
+ t && ne(Math.exp(-e.deltaY * 18e-4), e.clientX - t.getBoundingClientRect().left);
83
+ });
84
+ const te = (e) => {
85
+ G === void 0 && Oe(e ? e.id : null), We?.(e);
86
+ }, Be = (e) => {
87
+ const t = window.innerWidth || 1200, a = window.innerHeight || 800, o = e.clientX < t * 0.55 ? Math.max(12, t - 340) : 16, m = Math.max(130, Math.min(e.clientY, a - 130));
88
+ return { x: o, y: m };
89
+ }, S = Re ? 42 : 54, s = R != null && i.find((e) => e.id === R) || null, Ne = qe(p, W, I * u).list.map((e) => ({
90
+ left: Math.round(v + (e.t - p) * u),
91
+ label: e.label
92
+ })), $e = Math.ceil(v + I * u + be + 90), Ge = i.filter((e) => e.end == null).length, O = H ? /* @__PURE__ */ n(
93
+ en,
94
+ {
95
+ heading: "Tasks",
96
+ className: d?.summary,
97
+ placement: T,
98
+ floatingDefaultPosition: De,
99
+ items: i.map((e, t) => {
100
+ const a = e.end == null ? g : e.end, o = Math.round(v + (e.start - p) * u), m = Math.max(14, Math.round(Math.max(0, a - e.start) * u)), N = 34 + t * S, M = !x.w || o < x.l + x.w && o + m > x.l, y = !x.h || N < x.t + x.h && N + S > x.t;
101
+ return {
102
+ id: e.id,
103
+ number: String(t + 1).padStart(2, "0"),
104
+ label: e.name,
105
+ color: b[t % b.length],
106
+ time: re(e.start),
107
+ inView: M && y,
108
+ selected: R === e.id
109
+ };
110
+ }),
111
+ onPick: (e) => {
112
+ const t = i.findIndex((D) => D.id === e), a = f.current;
113
+ if (t < 0 || !a) return;
114
+ const o = i[t], m = o.end == null ? g : o.end, N = Math.round(v + (o.start - p) * u), M = Math.max(14, Math.round(Math.max(0, m - o.start) * u)), y = {
115
+ left: Math.max(0, N + M / 2 - a.clientWidth / 2)
116
+ };
117
+ a.clientHeight && (y.top = Math.max(0, 34 + t * S + S / 2 - a.clientHeight / 2)), cn(a, y);
118
+ }
119
+ }
120
+ ) : null;
121
+ return /* @__PURE__ */ h(
122
+ "div",
123
+ {
124
+ ref: Te,
125
+ className: c(r.root, d?.root, Ie),
126
+ style: Ee,
127
+ children: [
128
+ (ie || we || z != null || B != null) && /* @__PURE__ */ h("div", { className: c(r.toolbar, d?.toolbar), children: [
129
+ /* @__PURE__ */ h("div", { className: r.toolbarText, children: [
130
+ z != null && /* @__PURE__ */ n("span", { className: r.toolbarTitle, children: z }),
131
+ /* @__PURE__ */ n("span", { className: r.toolbarMeta, children: B ?? (i.length ? `${i.length} tasks · ${V(I - 2 * Q)} · ${Ge} running` : "No tasks") })
132
+ ] }),
133
+ we,
134
+ ie && /* @__PURE__ */ n(
135
+ nn,
136
+ {
137
+ zoomPct: `${Math.round(u / E * 100)}%`,
138
+ fitActive: ue,
139
+ onZoomIn: () => ne(1.5, q / 2),
140
+ onZoomOut: () => ne(1 / 1.5, q / 2),
141
+ onFit: () => {
142
+ me(!0), de(null);
143
+ },
144
+ hint: "scroll zooms · drag pans"
145
+ }
146
+ )
147
+ ] }),
148
+ T === "top" && O,
149
+ /* @__PURE__ */ h("div", { className: r.layout, children: [
150
+ T === "left" && O,
151
+ /* @__PURE__ */ h("div", { className: r.main, children: [
152
+ /* @__PURE__ */ n("div", { className: c(r.card, d?.card), children: /* @__PURE__ */ n(
153
+ "div",
154
+ {
155
+ ref: f,
156
+ className: c(r.scroller, l.scroller, d?.scroller),
157
+ style: { maxHeight: He },
158
+ onPointerDown: P.onPointerDown,
159
+ onPointerMove: P.onPointerMove,
160
+ onPointerUp: P.onPointerUp,
161
+ onPointerLeave: P.onPointerUp,
162
+ onScroll: Fe,
163
+ children: /* @__PURE__ */ h("div", { className: l.inner, style: { width: $e }, children: [
164
+ Pe && Ne.map((e, t) => /* @__PURE__ */ n("div", { className: l.gridline, style: { left: e.left } }, t)),
165
+ fe && /* @__PURE__ */ n(
166
+ "div",
167
+ {
168
+ className: l.nowLine,
169
+ style: { left: Math.round(v + (g - p) * u) }
170
+ }
171
+ ),
172
+ /* @__PURE__ */ n("div", { className: c(l.axis, d?.axis), children: Ne.map((e, t) => /* @__PURE__ */ n("div", { className: l.axisLabel, style: { left: e.left }, children: e.label }, t)) }),
173
+ i.map((e, t) => {
174
+ const a = e.end == null, o = a ? g : e.end, m = Math.max(0, o - e.start), N = Je(e, C), M = b[t % b.length], y = Math.round(v + (e.start - p) * u), D = Math.max(14, Math.round(m * u)), ve = V(m) + (a ? " · running" : ""), xe = D > 130, Me = { index: t, color: M, running: a, durationMs: m };
175
+ return /* @__PURE__ */ h(
176
+ "div",
177
+ {
178
+ className: c(l.row, d?.row),
179
+ style: { height: S, opacity: C && !N ? 0.3 : 1 },
180
+ children: [
181
+ /* @__PURE__ */ n("div", { className: c(l.rowLabel, d?.rowLabel), children: oe ? oe(e, Me) : /* @__PURE__ */ h(le, { children: [
182
+ /* @__PURE__ */ n("span", { className: l.rowName, children: /* @__PURE__ */ n(tn, { text: e.name, query: C }) }),
183
+ /* @__PURE__ */ n("span", { className: l.rowDates, children: re(e.start) + (a ? " → now" : " → " + re(o)) })
184
+ ] }) }),
185
+ /* @__PURE__ */ n(
186
+ "div",
187
+ {
188
+ className: c(l.bar, a && l.barRunning, d?.bar),
189
+ style: {
190
+ left: y,
191
+ top: Math.round((S - dn) / 2),
192
+ width: D,
193
+ borderColor: M,
194
+ background: a ? Qe(M, 72) : M,
195
+ boxShadow: C && N ? "0 0 0 3px var(--crk-timeline-hl-ring, #f3d98b)" : "none"
196
+ },
197
+ onClick: () => {
198
+ P.wasDragSuppressed() || (Y(null), te(R === e.id ? null : e));
199
+ },
200
+ onMouseEnter: (Ke) => {
201
+ if (R === e.id) return;
202
+ const Ue = Be(Ke);
203
+ Y({
204
+ ...Ue,
205
+ id: e.id,
206
+ title: e.name,
207
+ time: F(e.start) + (a ? "" : " → " + F(o)),
208
+ durLine: (a ? "running · " : "took ") + V(m) + (e.owner ? " · " + e.owner : ""),
209
+ detail: e.detail || ""
210
+ });
211
+ },
212
+ onMouseLeave: () => Y(null),
213
+ children: K ? K(e, Me) : /* @__PURE__ */ h(le, { children: [
214
+ a && /* @__PURE__ */ n("span", { className: c(r.pulseDot, l.barDot) }),
215
+ xe && /* @__PURE__ */ n("span", { className: l.barTextInside, children: ve })
216
+ ] })
217
+ }
218
+ ),
219
+ !K && !xe && /* @__PURE__ */ n("div", { className: l.barTextOutside, style: { left: y + D + 10 }, children: ve })
220
+ ]
221
+ },
222
+ e.id
223
+ );
224
+ })
225
+ ] })
226
+ }
227
+ ) }),
228
+ /* @__PURE__ */ n("div", { className: c(r.footnote, d?.footnote), children: "Click a bar to open details in the side panel · dashed bars are still running and keep growing" })
229
+ ] }),
230
+ s && X && /* @__PURE__ */ n("aside", { className: c(r.aside, l.drawer, d?.drawer), children: X(s, {
231
+ close: () => te(null),
232
+ running: s.end == null
233
+ }) }),
234
+ s && !X && /* @__PURE__ */ h("aside", { className: c(r.aside, l.drawer, d?.drawer), children: [
235
+ /* @__PURE__ */ h("div", { className: l.drawerHead, children: [
236
+ /* @__PURE__ */ n(
237
+ "span",
238
+ {
239
+ className: l.drawerSwatch,
240
+ style: {
241
+ background: b[i.indexOf(s) % b.length]
242
+ }
243
+ }
244
+ ),
245
+ /* @__PURE__ */ n("span", { className: l.drawerOwner, children: s.owner || "—" }),
246
+ /* @__PURE__ */ n(
247
+ "span",
248
+ {
249
+ className: c(
250
+ l.drawerState,
251
+ s.end == null && l.drawerStateRunning
252
+ ),
253
+ children: s.end == null ? "running" : "done"
254
+ }
255
+ ),
256
+ /* @__PURE__ */ n("div", { className: l.drawerSpacer }),
257
+ /* @__PURE__ */ n(
258
+ "button",
259
+ {
260
+ type: "button",
261
+ className: r.asideClose,
262
+ "aria-label": "Close details",
263
+ onClick: () => te(null),
264
+ children: "✕"
265
+ }
266
+ )
267
+ ] }),
268
+ /* @__PURE__ */ n("div", { className: l.drawerName, children: s.name }),
269
+ /* @__PURE__ */ n("div", { className: l.drawerTiming, children: F(s.start) + " → " + (s.end == null ? "now" : F(s.end)) + " · " + V((s.end == null ? g : s.end) - s.start) }),
270
+ /* @__PURE__ */ n("div", { className: l.drawerDetail, children: s.detail || "—" }),
271
+ /* @__PURE__ */ n("div", { className: r.asideSection, children: "Raw event" }),
272
+ /* @__PURE__ */ n("pre", { className: r.asideRaw, children: JSON.stringify(s, null, 2) })
273
+ ] }),
274
+ (T === "right" || T === "floating") && O
275
+ ] }),
276
+ T === "bottom" && O,
277
+ w && (() => {
278
+ const e = i.find((a) => a.id === w.id), t = e && U ? U(e, {
279
+ index: i.indexOf(e),
280
+ color: b[i.indexOf(e) % b.length],
281
+ running: e.end == null,
282
+ durationMs: (e.end == null ? g : e.end) - e.start
283
+ }) : void 0;
284
+ return U && t == null ? null : /* @__PURE__ */ n(ln, { x: w.x, y: w.y, className: d?.tooltip, children: t !== void 0 ? t : /* @__PURE__ */ h(le, { children: [
285
+ /* @__PURE__ */ n("div", { className: r.tooltipTitle, children: w.title }),
286
+ /* @__PURE__ */ n(
287
+ "div",
288
+ {
289
+ className: c(r.tooltipLine, r.tooltipMono),
290
+ style: { marginTop: 4 },
291
+ children: w.time
292
+ }
293
+ ),
294
+ /* @__PURE__ */ n("div", { className: r.tooltipLine, children: w.durLine }),
295
+ w.detail && /* @__PURE__ */ n("div", { className: r.tooltipDim, style: { marginTop: 5 }, children: w.detail })
296
+ ] }) });
297
+ })()
298
+ ]
299
+ }
300
+ );
301
+ }
302
+ );
303
+ export {
304
+ Mn as GanttTimeline
305
+ };
@@ -0,0 +1,55 @@
1
+ const r = "crk-scroller-y2AA7", e = "crk-inner--tSR-", a = "crk-gridline-a9CAe", n = "crk-nowLine-AtaNz", t = "crk-axis-r1FXP", c = "crk-axisLabel-yACMU", w = "crk-row-g4FCC", o = "crk-rowLabel-qOMvT", s = "crk-rowName-g7WMP", d = "crk-rowDates-tEtH6", i = "crk-bar-MKoAK", k = "crk-barRunning-2eR5o", b = "crk-barDot-kqgBw", l = "crk-barTextInside-j0xJc", g = "crk-barTextOutside-cOAGq", x = "crk-drawer-7II9B", S = "crk-drawerHead-VZyLW", T = "crk-drawerSwatch-YTo8T", L = "crk-drawerOwner-jUXtE", u = "crk-drawerState-PIrtX", m = "crk-drawerStateRunning-JYeCs", D = "crk-drawerSpacer-NxNLE", N = "crk-drawerName-VWwMl", R = "crk-drawerTiming-wPByH", O = "crk-drawerDetail-R0Gr2", A = {
2
+ scroller: r,
3
+ inner: e,
4
+ gridline: a,
5
+ nowLine: n,
6
+ axis: t,
7
+ axisLabel: c,
8
+ row: w,
9
+ rowLabel: o,
10
+ rowName: s,
11
+ rowDates: d,
12
+ bar: i,
13
+ barRunning: k,
14
+ barDot: b,
15
+ barTextInside: l,
16
+ barTextOutside: g,
17
+ drawer: x,
18
+ drawerHead: S,
19
+ drawerSwatch: T,
20
+ drawerOwner: L,
21
+ drawerState: u,
22
+ drawerStateRunning: m,
23
+ drawerSpacer: D,
24
+ drawerName: N,
25
+ drawerTiming: R,
26
+ drawerDetail: O
27
+ };
28
+ export {
29
+ t as axis,
30
+ c as axisLabel,
31
+ i as bar,
32
+ b as barDot,
33
+ k as barRunning,
34
+ l as barTextInside,
35
+ g as barTextOutside,
36
+ A as default,
37
+ x as drawer,
38
+ O as drawerDetail,
39
+ S as drawerHead,
40
+ N as drawerName,
41
+ L as drawerOwner,
42
+ D as drawerSpacer,
43
+ u as drawerState,
44
+ m as drawerStateRunning,
45
+ T as drawerSwatch,
46
+ R as drawerTiming,
47
+ a as gridline,
48
+ e as inner,
49
+ n as nowLine,
50
+ w as row,
51
+ d as rowDates,
52
+ o as rowLabel,
53
+ s as rowName,
54
+ r as scroller
55
+ };