awesome-timeline-react 0.2.0 → 0.4.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.
@@ -27,7 +27,9 @@ export declare type AnimationConfig = boolean | {
27
27
  */
28
28
  export declare const assignLanes: (rowEvents: EventType[], windowStart: number, windowEnd: number) => LaneResult;
29
29
 
30
- /** Eligibility: same expression as the legacy Event component's render guard. */
30
+ /** Eligibility: same expression as the legacy Event component's render guard.
31
+ * A group-parent (summary) event is never resizable — its span is derived from
32
+ * its children. */
31
33
  export declare const canResizeEvent: (event: EventType, eventsResize: boolean) => boolean;
32
34
 
33
35
  declare type CanvasBoardProps = {
@@ -44,6 +46,7 @@ declare type CanvasBoardProps = {
44
46
  rowsHeaderClassName?: string;
45
47
  setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
46
48
  setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
49
+ setTick: React_2.Dispatch<React_2.SetStateAction<number | null>>;
47
50
  onDrop?: (props: OnDropProps) => void;
48
51
  onResize?: (props: OnResizeProps) => void;
49
52
  onEventClick?: (props: OnEventClickProps) => void;
@@ -54,9 +57,17 @@ declare type CanvasBoardProps = {
54
57
  layoutMs: number;
55
58
  fadeMs: number;
56
59
  };
60
+ selectable: boolean;
61
+ applySelection: (eventIds: string[]) => void;
62
+ getSelection: () => string[];
57
63
  };
58
64
 
59
- /** Drop: same cell-snap as row-content.tsx handleOnDrop. */
65
+ /**
66
+ * Drop: snap the dropped start to the nearest grid cell boundary. Cells are
67
+ * anchored to absolute time (multiples of the cell duration), matching the
68
+ * vertical grid lines (`drawGridLines`) — so a dropped event lands on a line
69
+ * regardless of how the window has been panned.
70
+ */
60
71
  export declare const computeDropTimes: ({ pointerX, cellWidth, tick, windowStart, duration, }: {
61
72
  pointerX: number;
62
73
  cellWidth: number;
@@ -79,6 +90,26 @@ tick: number, direction: "left" | "right") => {
79
90
  endTime: number;
80
91
  } | null;
81
92
 
93
+ /**
94
+ * Time-frame zoom: returns a new visible window (+ derived tick and cellWidth)
95
+ * for scaling the visible duration by `factor` (newDuration = oldDuration *
96
+ * factor; <1 zooms in, >1 zooms out), anchored so the timestamp under
97
+ * `anchorX` (px from the content's left edge) stays under that pixel.
98
+ *
99
+ * `tick` is recomputed from the new (integer-rounded) window; `cellWidth` is
100
+ * then derived from the *actual* new tick so time-per-cell (`cellWidth * tick`)
101
+ * — i.e. the grid cell duration the grid lines snap to — is preserved exactly.
102
+ * Rescaling cellWidth by the unrounded factor instead would let rounding drift
103
+ * the cell duration off the hour over many zooms, so the grid lines would creep
104
+ * out of step with the time-bar blocks. The new duration is clamped to the
105
+ * limits; the anchor still holds after clamping.
106
+ */
107
+ export declare const computeZoom: (windowTime: [number, number], tick: number, cellWidth: number, anchorX: number, factor: number, contentWidth: number, { minWindowSeconds, maxWindowSeconds }: ZoomLimits) => {
108
+ windowTime: [number, number];
109
+ tick: number;
110
+ cellWidth: number;
111
+ };
112
+
82
113
  /**
83
114
  * Returns the window-visible slice of a startTime-sorted event array.
84
115
  * Binary search cuts the tail (startTime > windowEnd) in O(log n); the head
@@ -102,19 +133,13 @@ export declare const default_alias: {
102
133
  */
103
134
  export declare const default_alias_1: React_2.ForwardRefExoticComponent<CanvasBoardProps & React_2.RefAttributes<HTMLDivElement>>;
104
135
 
105
- export declare const default_alias_10: ({ windowTime, setTick, setCellWidth, contentRef, }: {
106
- windowTime: number[];
107
- setTick: React.Dispatch<React.SetStateAction<number | null>>;
108
- setCellWidth: React.Dispatch<React.SetStateAction<number>>;
109
- contentRef: React.MutableRefObject<HTMLDivElement | null>;
110
- }) => void;
111
-
112
- export declare const default_alias_2: ({ windowTime, tick, contentWidth, scrollWidth, theme, }: {
136
+ export declare const default_alias_2: ({ windowTime, tick, contentWidth, scrollWidth, theme, timeBar, }: {
113
137
  windowTime: number[];
114
138
  tick: number | null;
115
139
  contentWidth: number | null;
116
140
  scrollWidth: number;
117
141
  theme?: ResolvedTheme;
142
+ timeBar?: TimeBarConfig;
118
143
  }) => React_2.JSX.Element;
119
144
 
120
145
  /**
@@ -142,24 +167,27 @@ export declare const default_alias_7: (eventA: EventType, eventB: EventType) =>
142
167
  * change grid granularity (middle-click mode or ctrl+wheel). Event mutations
143
168
  * are applied straight to the SceneStore — no React state on the hot path.
144
169
  */
145
- export declare const default_alias_8: ({ scene, rendererRef, dynamicCanvasRef, bodyRef, ghostRef, eventPromptRef, setWindowTime, setCellWidth, onDrop, onResize, onEventClick, onEventHover, eventsResize, panZoom, }: UseCanvasInteractionsArgs) => {
170
+ export declare const default_alias_8: ({ scene, rendererRef, dynamicCanvasRef, bodyRef, ghostRef, eventPromptRef, setWindowTime, setCellWidth, setTick, onDrop, onResize, onEventClick, onEventHover, eventsResize, panZoom, selectable, applySelection, getSelection, }: UseCanvasInteractionsArgs) => {
146
171
  handlePointerDown: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
147
172
  handlePointerMove: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
148
173
  handlePointerUp: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
149
174
  handlePointerLeave: () => void;
175
+ handlePointerCancel: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
150
176
  handleAuxClick: (pointerEvent: React_2.MouseEvent<HTMLCanvasElement>) => void;
151
177
  };
152
178
 
153
- export declare const default_alias_9: ({ windowTime, contentWidth, }: {
179
+ export declare const default_alias_9: ({ windowTime, setTick, setCellWidth, contentRef, }: {
154
180
  windowTime: number[];
155
- contentWidth: number | null;
156
- }) => {
157
- numberOfHourBlocks: number;
158
- blockWidth: number;
159
- };
181
+ setTick: React.Dispatch<React.SetStateAction<number | null>>;
182
+ setCellWidth: React.Dispatch<React.SetStateAction<number>>;
183
+ contentRef: React.MutableRefObject<HTMLDivElement | null>;
184
+ }) => void;
160
185
 
161
186
  export declare const DEFAULT_FADE_DURATION_MS = 120;
162
187
 
188
+ /** Defaults mirror the pre-0.2.x constants (20px bars, 22px lanes, 10px pad). */
189
+ export declare const DEFAULT_GEOMETRY: Geometry;
190
+
163
191
  export declare const DEFAULT_LAYOUT_DURATION_MS = 200;
164
192
 
165
193
  /** Defaults mirror the pre-0.2.0 stylesheet values. */
@@ -181,36 +209,61 @@ export { DrawEventFn as DrawEventFn_alias_1 }
181
209
  export declare const drawEvents: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, font: string, animator: LayoutAnimator) => void;
182
210
 
183
211
  /**
184
- * Vertical grid lines, one per cellWidth — canvas replacement for the ~N
185
- * line divs of lines-canvas.tsx. Matches the legacy "hide-last-line"
186
- * behavior: no line within 1px of the right edge.
212
+ * Vertical grid lines, one per grid cell (`cellWidth` px == `cellWidth * tick`
213
+ * seconds). Lines are anchored to absolute time — placed at cell boundaries
214
+ * (multiples of the cell duration), not at fixed screen offsets — so they pan
215
+ * with the content and stay aligned with the time-bar blocks. Keeps the legacy
216
+ * "hide-last-line" behavior: no line within 1px of either edge.
187
217
  */
188
- export declare const drawGridLines: (ctx: CanvasRenderingContext2D, { width, height, cellWidth, color, }: {
218
+ export declare const drawGridLines: (ctx: CanvasRenderingContext2D, { width, height, cellWidth, windowStart, tick, color, }: {
189
219
  width: number;
190
220
  height: number;
191
221
  cellWidth: number;
222
+ windowStart: number;
223
+ tick: number;
192
224
  color?: string;
193
225
  }) => void;
194
226
 
227
+ /**
228
+ * Recessed-group depth cue. For each expanded group, the contiguous block of
229
+ * its visible child rows is filled with a faint tint and given an inset shadow
230
+ * along its top (and left) edge, so the child rows read as sitting *beneath*
231
+ * their parent row. Drawn on the static layer beneath the grid lines/dividers.
232
+ */
233
+ export declare const drawGroupShading: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore) => void;
234
+
195
235
  /** Horizontal row dividers — replaces .row-content border-bottom. */
196
- export declare const drawRowDividers: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, animator: LayoutAnimator) => void;
236
+ export declare const drawRowDividers: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore) => void;
197
237
 
198
238
  /**
199
- * Day row over hour row — canvas replacement for the day/hour block divs of
200
- * time-bar.tsx. Background is left transparent so the .time-bar container
201
- * color shows through, exactly like the DOM blocks did.
239
+ * Two-row time bar (top row over bottom row) — canvas replacement for the
240
+ * day/hour block divs of time-bar.tsx. The two rows are unit-agnostic
241
+ * (day/hour by default, configurable via TimeBarConfig). Background is left
242
+ * transparent so the .time-bar container color shows through.
202
243
  */
203
- export declare const drawTimeBar: (ctx: CanvasRenderingContext2D, { width, height, dayBlocks, hourBlocks, font, borderColor, textColor, }: {
244
+ export declare const drawTimeBar: (ctx: CanvasRenderingContext2D, { width, height, topBlocks, bottomBlocks, font, borderColor, textColor, }: {
204
245
  width: number;
205
246
  height: number;
206
247
  font: string;
207
248
  borderColor?: string;
208
249
  textColor?: string;
209
- } & TimeBlocks) => void;
210
-
211
- export declare const EVENT_BAR_HEIGHT = 20;
250
+ topBlocks: TimeBlock[];
251
+ bottomBlocks: TimeBlock[];
252
+ }) => void;
212
253
 
213
- export declare const EVENT_RADIUS = 5;
254
+ /**
255
+ * Written by the library into `props.metadata.droppableError` when an event's
256
+ * current `rowId` is absent from its `droppableRowIds`. Read it off events your
257
+ * app holds (or via the handle's `getEvent`) to flag the misconfiguration.
258
+ */
259
+ declare type DroppableError = {
260
+ /** the event's current rowId, which is not among its droppableRowIds */
261
+ rowId: string;
262
+ /** the rows the event declared it may live on */
263
+ droppableRowIds: string[];
264
+ };
265
+ export { DroppableError }
266
+ export { DroppableError as DroppableError_alias_1 }
214
267
 
215
268
  /** Imperative event mutation, applied without React re-renders. */
216
269
  declare type EventPatch = {
@@ -248,7 +301,39 @@ declare type EventPropsType = {
248
301
  style?: EventStyle;
249
302
  /** per-event custom renderer; overrides the Timeline-level drawEvent */
250
303
  drawEvent?: DrawEventFn;
251
- /** arbitrary data for eventPromptTemplate */
304
+ /** connects this event to others sharing the same tag. Cmd/Ctrl+click on any
305
+ * member selects the whole connected group (requires `selectable`). */
306
+ groupId?: string;
307
+ /** opt this event out of selection while the Timeline is `selectable`
308
+ * (default: selectable). A non-selectable event can't be clicked into the
309
+ * selection, is excluded from a group selection, and is ignored by
310
+ * `setSelection`. */
311
+ isSelectable?: boolean;
312
+ /** mark this event as a group summary bar. Its `startTime`/`endTime` are
313
+ * derived by the scene from its children (earliest start → latest end) and
314
+ * ignored on input — supplied values are kept only as a fallback while the
315
+ * parent has no resolved children yet. A parent event is never resizable and
316
+ * (in v1) never draggable; it stays clickable/selectable. Selecting it also
317
+ * selects all of its children. Must live on a row that is some row's
318
+ * `parentId`. */
319
+ isGroupParent?: boolean;
320
+ /** child → parent-event link. The referenced parent event is expected to live
321
+ * on this row's `parentId` row. An unresolved link is harmless — the event
322
+ * draws as a plain event (a dev warning is logged). */
323
+ parentEventId?: string;
324
+ /** rows this event may be dragged/dropped onto. `undefined` = any row (the
325
+ * default). When set, a drag only commits if the target row is in the list —
326
+ * otherwise the event snaps back (no `onDrop`). An empty array therefore pins
327
+ * the event (every drop snaps back).
328
+ *
329
+ * If the event's own `rowId` is not in this list, the library records a
330
+ * `{ droppableError: DroppableError }` on `props.metadata` (merging, not
331
+ * clobbering, any object you already put there) so the host app can surface
332
+ * the misconfiguration. The error is cleared automatically once the event is
333
+ * on an allowed row. */
334
+ droppableRowIds?: string[];
335
+ /** arbitrary data for eventPromptTemplate. The library may merge a
336
+ * `droppableError` key here — see `droppableRowIds`. */
252
337
  metadata?: unknown;
253
338
  };
254
339
  export { EventPropsType }
@@ -307,18 +392,58 @@ export declare class FrameScheduler {
307
392
  }
308
393
 
309
394
  /**
310
- * Pure extraction of the day/hour block generation previously inlined as JSX
311
- * in use-generate-blocks.tsx. Same walk over the window, same Math.round
312
- * block counting, same labels — but returns positioned data that both the
313
- * canvas time bar and tests can consume.
395
+ * The default two-row time bar: a day row over an hour row. Thin wrapper over
396
+ * `generateUnitBlocks` kept for the golden tests and as the documented
397
+ * default; the canvas time bar resolves `TimeBarConfig` and calls
398
+ * `generateUnitBlocks` per row directly.
314
399
  */
315
- export declare const generateTimeBlocks: ({ windowStart, tick, contentWidth, blockWidth, }: {
400
+ export declare const generateTimeBlocks: ({ windowStart, tick, contentWidth, }: {
316
401
  windowStart: number;
317
402
  tick: number | null;
318
403
  contentWidth: number | null;
319
- blockWidth: number;
404
+ /** @deprecated unused — block widths now derive from `tick` */
405
+ blockWidth?: number;
320
406
  }) => TimeBlocks;
321
407
 
408
+ /**
409
+ * Positioned blocks for one time-bar row. Walks real calendar/step boundaries
410
+ * from `windowStart` to `windowEnd` and derives each block's pixel x/width
411
+ * from `tick` (seconds per pixel), so blocks stay aligned to the wall clock as
412
+ * the window pans. The first/last blocks are clipped to the window edges, so
413
+ * the row tiles contiguously from x=0 to the content width.
414
+ */
415
+ export declare const generateUnitBlocks: ({ unit, format, windowStart, windowEnd, tick, }: TimeBarRowConfig & {
416
+ windowStart: number;
417
+ windowEnd: number;
418
+ tick: number | null;
419
+ }) => TimeBlock[];
420
+
421
+ /**
422
+ * Resolved vertical layout for event bars and rows (px). Derived once from the
423
+ * theme (see `geometryFromTheme`) and owned by the SceneStore, which both the
424
+ * renderer (`draw-events`) and hit-testing read so positioning stays in sync.
425
+ *
426
+ * Only `barHeight`, `laneGap`, `rowPaddingY`, and `barRadius` are themeable;
427
+ * the rest are derived from them.
428
+ */
429
+ export declare type Geometry = {
430
+ /** event bar height */
431
+ barHeight: number;
432
+ /** vertical stride between stacked lanes (barHeight + laneGap) */
433
+ laneHeight: number;
434
+ /** top padding before the first lane (== rowPaddingY) */
435
+ laneTopOffset: number;
436
+ /** minimum row height with no stacking (barHeight + 2*rowPaddingY) */
437
+ rowBaseHeight: number;
438
+ /** static-event height with no stacking (== barHeight) */
439
+ staticEventBaseHeight: number;
440
+ /** event bar corner radius */
441
+ barRadius: number;
442
+ };
443
+
444
+ /** Derive the full Geometry from the resolved theme's geometry tokens. */
445
+ export declare const geometryFromTheme: (theme: ResolvedTheme) => Geometry;
446
+
322
447
  export declare type HitTarget = {
323
448
  kind: "event" | "static";
324
449
  event: EventType;
@@ -345,16 +470,18 @@ export declare type HitTestView = {
345
470
 
346
471
  export declare const intersectsWindow: (event: EventType, windowStart: number, windowEnd: number) => boolean;
347
472
 
348
- export declare const LANE_HEIGHT = 22;
349
-
350
- export declare const LANE_TOP_OFFSET = 10;
473
+ /**
474
+ * Whether an event may be dropped onto a row, given its `droppableRowIds`.
475
+ * `undefined` = unrestricted (any row); otherwise the target must be listed.
476
+ */
477
+ export declare const isRowDroppable: (droppableRowIds: string[] | undefined, targetRowId: string) => boolean;
351
478
 
352
479
  export declare type LaneResult = {
353
480
  laneOf: Map<string, number>;
354
481
  highestLane: number;
355
482
  };
356
483
 
357
- export declare const laneTop: (lane: number) => number;
484
+ export declare const laneTop: (lane: number, g?: Geometry) => number;
358
485
 
359
486
  export declare type Layer = "static" | "dynamic";
360
487
 
@@ -364,10 +491,11 @@ export declare type LayerDirty = {
364
491
  };
365
492
 
366
493
  /**
367
- * Replaces the CSS transitions the DOM renderer got for free:
368
- * row heights and event tops tween when stacking changes, and resize
369
- * handles fade in/out. Values are queried per frame; while any tween is
370
- * live the renderer keeps scheduling frames.
494
+ * Replaces the CSS transitions the DOM renderer got for free: event tops
495
+ * tween when stacking changes, and resize handles fade in/out. (Row heights
496
+ * apply instantly so the canvas rows stay locked to the DOM headers, which
497
+ * also snap.) Values are queried per frame; while any tween is live the
498
+ * renderer keeps scheduling frames.
371
499
  *
372
500
  * Durations are configurable via the Timeline `animations` prop; a duration
373
501
  * of 0 disables that animation (values jump straight to target).
@@ -379,7 +507,6 @@ export declare type LayerDirty = {
379
507
  * perpetually, desyncing the layers.
380
508
  */
381
509
  export declare class LayoutAnimator {
382
- private rowHeights;
383
510
  private eventTops;
384
511
  private handleAlphas;
385
512
  private now;
@@ -388,7 +515,6 @@ export declare class LayoutAnimator {
388
515
  private fadeDuration;
389
516
  setDurations(layoutMs: number, fadeMs: number): void;
390
517
  beginFrame(now: number): void;
391
- rowHeight(rowId: string, target: number): number;
392
518
  eventTop(eventId: string, target: number): number;
393
519
  /** 0..1 opacity of an event's resize handles; target 1 = hovered. */
394
520
  handleAlpha(eventId: string, target: number): number;
@@ -456,11 +582,24 @@ export { OnResizeProps as OnResizeProps_alias_1 }
456
582
  declare type PanZoomConfig = {
457
583
  /** drag the empty background to pan the time window (default true) */
458
584
  panOnDragBackground?: boolean;
459
- /** ctrl/cmd + wheel changes grid granularity (default true) */
585
+ /** ctrl/cmd + wheel (and trackpad pinch) zooms the visible time frame,
586
+ * anchored at the cursor (default true). Since 0.2.x this is time-frame
587
+ * zoom — grid granularity now lives on middle-click+wheel only. */
460
588
  ctrlWheelZoom?: boolean;
461
- /** middle-click toggles wheel-granularity mode (default true) */
589
+ /** two-finger pinch zooms the time frame on touch devices (default true) */
590
+ pinchZoom?: boolean;
591
+ /** ctrl/cmd + drag on the background zooms the time frame: drag right to zoom
592
+ * in, left to zoom out (default true) */
593
+ dragZoom?: boolean;
594
+ /** smallest visible window in seconds the zoom will go to (default 900 = 15 min) */
595
+ minWindowSeconds?: number;
596
+ /** largest visible window in seconds the zoom will go to (default 30 days) */
597
+ maxWindowSeconds?: number;
598
+ /** multiplier applied to the window per wheel notch (default 1.15) */
599
+ zoomWheelFactor?: number;
600
+ /** middle-click toggles wheel grid-granularity mode (default true) */
462
601
  middleClickGranularity?: boolean;
463
- /** seconds per granularity step (default 900 = 15 min) */
602
+ /** seconds per grid-granularity step (default 900 = 15 min) */
464
603
  zoomStepSeconds?: number;
465
604
  };
466
605
  export { PanZoomConfig }
@@ -493,6 +632,7 @@ export declare type RendererView = {
493
632
  hoveredEventId: string | null;
494
633
  draggedEventId: string | null;
495
634
  resizePreview: ResizePreview | null;
635
+ selectedEventIds: ReadonlySet<string>;
496
636
  };
497
637
 
498
638
  export declare type ResizePreview = {
@@ -507,13 +647,15 @@ export { ResolvedTheme as ResolvedTheme_alias_1 }
507
647
 
508
648
  export declare const resolveTheme: (theme?: Theme) => ResolvedTheme;
509
649
 
510
- export declare const ROW_BASE_HEIGHT = 40;
511
-
512
- export declare const rowMinHeight: (highestLane: number) => number;
650
+ export declare const rowMinHeight: (highestLane: number, g?: Geometry) => number;
513
651
 
514
652
  declare type RowType = {
515
653
  id: string;
516
654
  name: string;
655
+ /** group this row under a parent row (one level of nesting only in v1). Child
656
+ * rows are hidden when their parent row is collapsed. List child rows
657
+ * immediately after their parent row for the clearest visual nesting. */
658
+ parentId?: string;
517
659
  };
518
660
  export { RowType }
519
661
  export { RowType as RowType_alias_1 }
@@ -531,18 +673,67 @@ export declare class SceneStore {
531
673
  private rowIndexes;
532
674
  private rowOrder;
533
675
  private eventRow;
676
+ private eventGroup;
677
+ private groupMembers;
678
+ private parentOf;
679
+ private childRowsOf;
680
+ private collapsedRows;
681
+ private childrenOf;
682
+ private parentEventOf;
683
+ private parentSpanDirty;
534
684
  private listeners;
685
+ private geometry;
686
+ private labelMinHeights;
535
687
  version: number;
688
+ setGeometry(geometry: Geometry): void;
689
+ getGeometry(): Geometry;
536
690
  setRows(rows: RowType[]): void;
537
691
  setEvents(events: EventType[]): void;
538
692
  setStaticEvents(events: EventType[]): void;
539
693
  applyPatches(patches: EventPatch[]): void;
540
694
  getEvent(id: string): EventType | undefined;
695
+ /**
696
+ * Event ids "connected" to the given event via a shared `props.groupId`.
697
+ * Returns every member of the group (including the event itself), or just
698
+ * `[eventId]` when the event has no group / no other members / is unknown.
699
+ */
700
+ getConnectedEventIds(eventId: string): string[];
701
+ /**
702
+ * Whether an event may enter the selection. False only when the event is
703
+ * present and explicitly opted out (`props.isSelectable === false`); unknown
704
+ * ids are treated as selectable so a selection can be set before data loads
705
+ * and survives streaming.
706
+ */
707
+ isEventSelectable(id: string): boolean;
541
708
  getRowIds(): string[];
709
+ /**
710
+ * Row ids in display order, minus rows hidden inside a collapsed parent.
711
+ * Drives offsets, drawing and hit-testing. The header still walks
712
+ * `getRowIds()` so it can draw the carets and decide which rows to skip.
713
+ */
714
+ getVisibleRowIds(): string[];
715
+ /** whether a row is a parent (owns at least one child row) */
716
+ isRowParent(rowId: string): boolean;
717
+ /** whether a row is hidden because its parent row is collapsed */
718
+ isRowHidden(rowId: string): boolean;
719
+ isRowCollapsed(rowId: string): boolean;
720
+ getCollapsedRowIds(): string[];
721
+ setCollapsed(rowId: string, collapsed: boolean): void;
722
+ toggleCollapsed(rowId: string): void;
723
+ /** child event ids of a parent (summary) event; empty if it has none */
724
+ getChildEventIds(parentEventId: string): string[];
542
725
  getRow(rowId: string): RowType | undefined;
543
726
  getRowEvents(rowId: string): EventType[];
544
727
  getRowStaticEvents(rowId: string): EventType[];
545
728
  getLanes(rowId: string, windowStart: number, windowEnd: number): LaneResult;
729
+ /**
730
+ * Report the per-row label heights measured against the live DOM header
731
+ * (key: rowId, value: the minimum row height the wrapped label needs,
732
+ * already including vertical padding). Replaces the previous map wholesale
733
+ * and only bumps when a value actually changed, so re-measuring identical
734
+ * labels is a no-op and can't feed back into an infinite render loop.
735
+ */
736
+ setLabelMinHeights(heights: Map<string, number>): void;
546
737
  getRowHeight(rowId: string, windowStart: number, windowEnd: number): number;
547
738
  /**
548
739
  * y offset of each row's top edge (content coordinates, before scroll) plus
@@ -555,6 +746,24 @@ export declare class SceneStore {
555
746
  subscribe(listener: () => void): () => void;
556
747
  private insert;
557
748
  private remove;
749
+ private addToGroup;
750
+ private removeFromGroup;
751
+ /**
752
+ * Enforce the authoring contract for `props.droppableRowIds`: if the event's
753
+ * current row is not among its allowed rows, record a `droppableError` on
754
+ * `props.metadata` (merged non-destructively); otherwise clear any stale one.
755
+ * Cheap no-op for events without `droppableRowIds` and no prior error.
756
+ */
757
+ private validateDroppable;
758
+ private addToParentIndex;
759
+ private removeFromParentIndex;
760
+ /**
761
+ * Recompute the derived span of any dirty parent event living on `rowId`
762
+ * (earliest child start → latest child end), write it back into the parent
763
+ * event, and re-sort the row so the sorted-array invariant holds. Cheap no-op
764
+ * when nothing is dirty (the common no-groups case never touches this).
765
+ */
766
+ private flushParentSpans;
558
767
  private bump;
559
768
  }
560
769
 
@@ -564,17 +773,15 @@ export declare class SceneStore {
564
773
  */
565
774
  export declare const sizeCanvas: (canvas: HTMLCanvasElement, cssWidth: number, cssHeight: number, dpr: number) => CanvasRenderingContext2D | null;
566
775
 
567
- export declare const STATIC_EVENT_BASE_HEIGHT = 20;
568
-
569
- export declare const staticEventHeight: (highestLane: number) => number;
776
+ export declare const staticEventHeight: (highestLane: number, g?: Geometry) => number;
570
777
 
571
778
  /** Grid granularity step: same clamp as content.tsx handleOnWheel. */
572
779
  export declare const stepCellWidth: (cellWidth: number, deltaY: number, tick: number) => number;
573
780
 
574
781
  /**
575
- * Color/font tokens for everything drawn to canvas. Defaults mirror the
576
- * pre-0.2.0 stylesheet. (Bar geometry — heights, lane spacing, radius — is
577
- * not yet themeable.)
782
+ * Color/font/geometry tokens for everything drawn to canvas. Defaults mirror
783
+ * the pre-0.2.0 stylesheet. Bar geometry (height, lane spacing, row padding,
784
+ * radius) is themeable since 0.2.x — see `core/geometry.ts`.
578
785
  */
579
786
  declare type Theme = {
580
787
  eventFill?: string;
@@ -584,12 +791,60 @@ declare type Theme = {
584
791
  gridColor?: string;
585
792
  timeBarBorder?: string;
586
793
  timeBarTextColor?: string;
794
+ /** opacity applied to NON-selected events while a selection is active, so the
795
+ * selection stands out (default 0.35). 1 disables dimming. */
796
+ dimmedOpacity?: number;
797
+ /** shadow color for the "lifted" look of selected events (default
798
+ * "rgba(0,0,0,0.35)") */
799
+ selectionShadowColor?: string;
800
+ /** shadow blur in px for selected events (default 8) */
801
+ selectionShadowBlur?: number;
802
+ /** px the selected event bar is lifted (drawn offset upward) to read as
803
+ * elevated above the others (default 2) */
804
+ selectionElevation?: number;
587
805
  /** canvas text font; defaults to the canvas element's computed font */
588
806
  font?: string;
807
+ /** event bar height in px (default 20) */
808
+ barHeight?: number;
809
+ /** gap between stacked lanes in px; laneHeight = barHeight + laneGap (default 2) */
810
+ laneGap?: number;
811
+ /** vertical padding above/below the bars within a row in px (default 10) */
812
+ rowPaddingY?: number;
813
+ /** event bar corner radius in px (default 5) */
814
+ barRadius?: number;
815
+ /** faint fill laid over the child-row block of an expanded group so it reads
816
+ * as recessed beneath its parent row (default "rgba(0,0,0,0.05)"). Also used
817
+ * to tint child row headers. */
818
+ groupChildBackground?: string;
819
+ /** color of the inset shadow drawn at the top (and left) of an expanded
820
+ * group's child block — the "sitting beneath the parent" depth cue (default
821
+ * "rgba(0,0,0,0.22)"). Also tints the header tree connector lines if no
822
+ * gridColor contrast is desired. */
823
+ groupShadowColor?: string;
589
824
  };
590
825
  export { Theme }
591
826
  export { Theme as Theme_alias_1 }
592
827
 
828
+ /** Per-row configuration for the two-row time bar. */
829
+ export declare type TimeBarConfig = {
830
+ topRow?: TimeBarRowConfig;
831
+ bottomRow?: TimeBarRowConfig;
832
+ };
833
+
834
+ export declare type TimeBarRowConfig = {
835
+ /** the unit each block spans (default: "day" for the top row, "hour" for
836
+ * the bottom row), or a fixed step like `{ stepSeconds: 8 * 3600 }`. */
837
+ unit?: TimeBarUnit | {
838
+ stepSeconds: number;
839
+ };
840
+ /** label for a block; receives the block's start and end. Defaults mirror
841
+ * the built-in day ("Mon 1 Jan") and hour ("HH:00") labels. */
842
+ format?: (blockStart: Date, blockEnd: Date) => string;
843
+ };
844
+
845
+ /** Calendar unit for a time-bar row, or a fixed step in seconds. */
846
+ export declare type TimeBarUnit = "hour" | "day" | "week" | "month";
847
+
593
848
  export declare type TimeBlock = {
594
849
  label: string;
595
850
  x: number;
@@ -607,6 +862,25 @@ export { Timeline as Timeline_alias_1 }
607
862
 
608
863
  export declare const TimelineCanvas: () => React_2.JSX.Element;
609
864
 
865
+ /**
866
+ * Per-event drop-target restriction (`props.droppableRowIds`). The blue event
867
+ * can only be dropped onto Welder/CNC (drag it elsewhere → not-allowed cursor,
868
+ * snaps back). The green event is unrestricted. The red event is *misconfigured*
869
+ * — it sits on Paint but its droppableRowIds doesn't include Paint, so the
870
+ * library records `metadata.droppableError`; click "Inspect" to see it.
871
+ */
872
+ export declare const TimelineDroppableRows: () => React_2.JSX.Element;
873
+
874
+ /**
875
+ * Grouped (collapsible) rows. A parent row owns child rows (`parentId`); a
876
+ * group-parent event (`isGroupParent`) on the parent row summarizes the child
877
+ * events that point at it (`parentEventId`). The parent's span is derived
878
+ * (earliest child start → latest child end) — it is never resizable or
879
+ * draggable. Selecting a parent also selects its children. Collapsing a parent
880
+ * row hides its child rows while the summary bar stays.
881
+ */
882
+ export declare const TimelineGrouped: () => React_2.JSX.Element;
883
+
610
884
  /**
611
885
  * Imperative handle for streaming/live updates: `const ref =
612
886
  * useRef<TimelineHandle>(null); <Timeline ref={ref} ...>`.
@@ -632,12 +906,40 @@ declare type TimelineHandle = {
632
906
  startTime: number;
633
907
  endTime: number;
634
908
  };
909
+ /** replace the current selection with these event ids. No `groupId`-tag
910
+ * expansion (that's Cmd/Ctrl+click only), but a group-parent id still pulls
911
+ * in its child events (parent → children). Requires `selectable`; fires
912
+ * `onSelectionChange`. */
913
+ setSelection(eventIds: string[]): void;
914
+ /** the currently selected event ids */
915
+ getSelection(): string[];
916
+ /** toggle a parent row's collapsed state (hides/shows its child rows) */
917
+ toggleRow(rowId: string): void;
918
+ /** explicitly collapse or expand a parent row */
919
+ setCollapsed(rowId: string, collapsed: boolean): void;
635
920
  /** force a full redraw of both canvas layers */
636
921
  redraw(): void;
637
922
  };
638
923
  export { TimelineHandle }
639
924
  export { TimelineHandle as TimelineHandle_alias_1 }
640
925
 
926
+ /**
927
+ * Long row labels: names that exceed the 100px header width wrap to multiple
928
+ * lines, stay centered, and grow the row height (and its canvas dividers) to
929
+ * fit instead of overflowing into the neighbouring row. Mixes short, multi-word,
930
+ * and a single unbroken token (forced to break-word) so the per-row height
931
+ * adapts to whichever label is tallest.
932
+ */
933
+ export declare const TimelineLongRowLabels: () => React_2.JSX.Element;
934
+
935
+ /**
936
+ * A small, sub-day window (~6h). With a window narrower than a day the time
937
+ * bar must still track the hour labels to the actual time as you pan — pan the
938
+ * background and watch the hour labels advance continuously (rather than
939
+ * staying pinned and then jumping by a whole day near midnight).
940
+ */
941
+ export declare const TimelineNarrowWindow: () => React_2.JSX.Element;
942
+
641
943
  export declare const TimelinePrimary: () => React_2.JSX.Element;
642
944
 
643
945
  declare type TimelineProps = {
@@ -650,6 +952,20 @@ declare type TimelineProps = {
650
952
  onResize?: (props: OnResizeProps) => void;
651
953
  onEventClick?: (props: OnEventClickProps) => void;
652
954
  onEventHover?: (props: OnEventHoverProps) => void;
955
+ /** enable click selection: click selects one event (elevated + others dimmed),
956
+ * Cmd/Ctrl+click selects its whole connected group (`props.groupId`),
957
+ * background click / Escape clears. Default false (no selection). */
958
+ selectable?: boolean;
959
+ /** initial selection for the uncontrolled selection state */
960
+ defaultSelectedEventIds?: string[];
961
+ /** fires whenever the selection changes (click, group-click, clear, or the
962
+ * imperative handle) */
963
+ onSelectionChange?: (eventIds: string[]) => void;
964
+ /** rows collapsed initially (uncontrolled). After mount, collapse state lives
965
+ * in the scene and survives every data update — streaming patches,
966
+ * `setEvents`, and `events`-prop resets never change it; only a user caret
967
+ * click or the imperative handle (`toggleRow`/`setCollapsed`) does. */
968
+ defaultCollapsedRowIds?: string[];
653
969
  theme?: Theme;
654
970
  drawEvent?: DrawEventFn;
655
971
  /** only `rowsHeader` still applies — everything else is canvas-drawn (use `theme`) */
@@ -659,6 +975,8 @@ declare type TimelineProps = {
659
975
  showEventPrompt?: boolean;
660
976
  eventPromptTemplate?: (event: EventType) => JSX.Element;
661
977
  panZoom?: PanZoomConfig;
978
+ /** configure each row's unit/label in the two-row time bar */
979
+ timeBar?: TimeBarConfig;
662
980
  /** layout animations: true (default), false to disable, or durations */
663
981
  animations?: AnimationConfig;
664
982
  };
@@ -697,6 +1015,24 @@ export declare class TimelineRenderer {
697
1015
  private drawFrame;
698
1016
  }
699
1017
 
1018
+ /**
1019
+ * Selection: `selectable` turns on click selection. A plain click selects one
1020
+ * event (it lifts with a shadow while every other event dims); Cmd/Ctrl+click
1021
+ * selects the whole connected group (`props.groupId`). Background click or
1022
+ * Escape clears. The buttons drive the same state through the imperative
1023
+ * handle (`setSelection`/`getSelection`). Dragging/resizing still operate on a
1024
+ * single event regardless of how many are selected.
1025
+ */
1026
+ export declare const TimelineSelectable: () => React_2.JSX.Element;
1027
+
1028
+ /**
1029
+ * Configurable time-bar rows: a day row over 8-hour "shift" blocks instead of
1030
+ * hours. The bottom row uses `{ stepSeconds: 8 * 3600 }` with a custom
1031
+ * `format`. Grid lines and drop snapping stay on the hour grid, independent of
1032
+ * the time-bar rows.
1033
+ */
1034
+ export declare const TimelineShiftBar: () => React_2.JSX.Element;
1035
+
700
1036
  /**
701
1037
  * 10k events across 500 rows with a fake websocket pushing 200 random
702
1038
  * event moves every 100ms through the imperative handle — zero React
@@ -704,6 +1040,14 @@ export declare class TimelineRenderer {
704
1040
  */
705
1041
  export declare const TimelineStreaming10k: () => React_2.JSX.Element;
706
1042
 
1043
+ /**
1044
+ * Themeable bar geometry: chunky 32px bars with a 6px lane gap, wide row
1045
+ * padding, and a larger corner radius. Verifies stacking, hit-testing
1046
+ * (hover/resize zones), drag-ghost height, and header alignment all follow the
1047
+ * geometry. Compare with TimelineCanvas (default 20px bars).
1048
+ */
1049
+ export declare const TimelineThemed: () => React_2.JSX.Element;
1050
+
707
1051
  /** @deprecated renamed to TimelineProps in 0.2.0 */
708
1052
  declare type TimelineType = TimelineProps;
709
1053
  export { TimelineType }
@@ -722,12 +1066,17 @@ declare type UseCanvasInteractionsArgs = {
722
1066
  eventPromptRef: React_2.MutableRefObject<EventPromptActionsType | null>;
723
1067
  setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
724
1068
  setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
1069
+ setTick: React_2.Dispatch<React_2.SetStateAction<number | null>>;
725
1070
  onDrop?: (props: OnDropProps) => void;
726
1071
  onResize?: (props: OnResizeProps) => void;
727
1072
  onEventClick?: (props: OnEventClickProps) => void;
728
1073
  onEventHover?: (props: OnEventHoverProps) => void;
729
1074
  eventsResize: boolean;
730
1075
  panZoom?: PanZoomConfig;
1076
+ selectable: boolean;
1077
+ /** replace the selection with exactly these ids (single write path) */
1078
+ applySelection: (eventIds: string[]) => void;
1079
+ getSelection: () => string[];
731
1080
  };
732
1081
 
733
1082
  /** Notifies when devicePixelRatio changes (browser zoom, monitor switch). */
@@ -735,4 +1084,9 @@ export declare const watchDpr: (onChange: (dpr: number) => void) => (() => void)
735
1084
 
736
1085
  export declare const xToTime: (x: number, windowStart: number, tick: number) => number;
737
1086
 
1087
+ export declare type ZoomLimits = {
1088
+ minWindowSeconds: number;
1089
+ maxWindowSeconds: number;
1090
+ };
1091
+
738
1092
  export { }