awesome-timeline-react 0.1.15 → 0.3.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.
- package/LICENSE +21 -21
- package/README.md +240 -96
- package/dist/_tsup-dts-rollup.d.mts +872 -329
- package/dist/_tsup-dts-rollup.d.ts +872 -329
- package/dist/index.css +129 -210
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +19 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +2338 -1923
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2323 -1910
- package/dist/index.mjs.map +1 -1
- package/package.json +66 -62
- package/dist/src/index.d.mts +0 -1
- package/dist/src/index.d.ts +0 -1
|
@@ -1,329 +1,872 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
export declare const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}: {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}: {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
export declare const
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
export declare
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
export declare
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
declare
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
};
|
|
266
|
-
|
|
267
|
-
declare type
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
export
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
export
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
1
|
+
import { default as React_2 } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Layout animation configuration. `false` disables all animations;
|
|
5
|
+
* an object tunes the durations (0 disables that animation).
|
|
6
|
+
*/
|
|
7
|
+
export declare type AnimationConfig = boolean | {
|
|
8
|
+
/** event stacking / row height tween, ms (default 200) */
|
|
9
|
+
layoutMs?: number;
|
|
10
|
+
/** resize-handle fade, ms (default 120) */
|
|
11
|
+
fadeMs?: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Assigns a vertical lane (stacking order) to each window-visible event of a
|
|
16
|
+
* single row. Faithful extraction of the algorithm previously inlined in
|
|
17
|
+
* use-produce-content.tsx — including its quirks:
|
|
18
|
+
*
|
|
19
|
+
* - Events outside [windowStart, windowEnd] are skipped and do not influence
|
|
20
|
+
* lane assignment at all.
|
|
21
|
+
* - The occupancy scan for an event only covers lanes 0..eventOrder (the lane
|
|
22
|
+
* of the previously placed event), not every tracked lane.
|
|
23
|
+
* - Touching events (prev.endTime === next.startTime) do not overlap.
|
|
24
|
+
*
|
|
25
|
+
* `rowEvents` must already be filtered to one row and sorted with
|
|
26
|
+
* helpers/sort-events (startTime asc, endTime asc).
|
|
27
|
+
*/
|
|
28
|
+
export declare const assignLanes: (rowEvents: EventType[], windowStart: number, windowEnd: number) => LaneResult;
|
|
29
|
+
|
|
30
|
+
/** Eligibility: same expression as the legacy Event component's render guard. */
|
|
31
|
+
export declare const canResizeEvent: (event: EventType, eventsResize: boolean) => boolean;
|
|
32
|
+
|
|
33
|
+
declare type CanvasBoardProps = {
|
|
34
|
+
scene: SceneStore;
|
|
35
|
+
rows: RowType[];
|
|
36
|
+
windowTime: number[];
|
|
37
|
+
tick: number | null;
|
|
38
|
+
cellWidth: number;
|
|
39
|
+
theme: ResolvedTheme;
|
|
40
|
+
drawEvent?: DrawEventFn;
|
|
41
|
+
bodyRef: React_2.MutableRefObject<HTMLDivElement | null>;
|
|
42
|
+
rendererRef: React_2.MutableRefObject<TimelineRenderer | null>;
|
|
43
|
+
eventPromptRef: React_2.MutableRefObject<EventPromptActionsType | null>;
|
|
44
|
+
rowsHeaderClassName?: string;
|
|
45
|
+
setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
|
|
46
|
+
setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
|
|
47
|
+
setTick: React_2.Dispatch<React_2.SetStateAction<number | null>>;
|
|
48
|
+
onDrop?: (props: OnDropProps) => void;
|
|
49
|
+
onResize?: (props: OnResizeProps) => void;
|
|
50
|
+
onEventClick?: (props: OnEventClickProps) => void;
|
|
51
|
+
onEventHover?: (props: OnEventHoverProps) => void;
|
|
52
|
+
eventsResize: boolean;
|
|
53
|
+
panZoom?: PanZoomConfig;
|
|
54
|
+
animations: {
|
|
55
|
+
layoutMs: number;
|
|
56
|
+
fadeMs: number;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Drop: snap the dropped start to the nearest grid cell boundary. Cells are
|
|
62
|
+
* anchored to absolute time (multiples of the cell duration), matching the
|
|
63
|
+
* vertical grid lines (`drawGridLines`) — so a dropped event lands on a line
|
|
64
|
+
* regardless of how the window has been panned.
|
|
65
|
+
*/
|
|
66
|
+
export declare const computeDropTimes: ({ pointerX, cellWidth, tick, windowStart, duration, }: {
|
|
67
|
+
pointerX: number;
|
|
68
|
+
cellWidth: number;
|
|
69
|
+
tick: number;
|
|
70
|
+
windowStart: number;
|
|
71
|
+
duration: number;
|
|
72
|
+
}) => {
|
|
73
|
+
startTime: number;
|
|
74
|
+
endTime: number;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Resize: same rounding and duration-must-stay-positive guard as
|
|
79
|
+
* event.tsx handleDocumentOnMouseUp. Returns null when the resize would
|
|
80
|
+
* collapse or invert the event (legacy keeps the old value silently).
|
|
81
|
+
*/
|
|
82
|
+
export declare const computeResizeTimes: (event: Pick<EventType, "startTime" | "endTime">, deltaPx: number, // raw pointer delta (clientX - initial), sign preserved
|
|
83
|
+
tick: number, direction: "left" | "right") => {
|
|
84
|
+
startTime: number;
|
|
85
|
+
endTime: number;
|
|
86
|
+
} | null;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Time-frame zoom: returns a new visible window (+ derived tick and cellWidth)
|
|
90
|
+
* for scaling the visible duration by `factor` (newDuration = oldDuration *
|
|
91
|
+
* factor; <1 zooms in, >1 zooms out), anchored so the timestamp under
|
|
92
|
+
* `anchorX` (px from the content's left edge) stays under that pixel.
|
|
93
|
+
*
|
|
94
|
+
* `tick` is recomputed from the new (integer-rounded) window; `cellWidth` is
|
|
95
|
+
* then derived from the *actual* new tick so time-per-cell (`cellWidth * tick`)
|
|
96
|
+
* — i.e. the grid cell duration the grid lines snap to — is preserved exactly.
|
|
97
|
+
* Rescaling cellWidth by the unrounded factor instead would let rounding drift
|
|
98
|
+
* the cell duration off the hour over many zooms, so the grid lines would creep
|
|
99
|
+
* out of step with the time-bar blocks. The new duration is clamped to the
|
|
100
|
+
* limits; the anchor still holds after clamping.
|
|
101
|
+
*/
|
|
102
|
+
export declare const computeZoom: (windowTime: [number, number], tick: number, cellWidth: number, anchorX: number, factor: number, contentWidth: number, { minWindowSeconds, maxWindowSeconds }: ZoomLimits) => {
|
|
103
|
+
windowTime: [number, number];
|
|
104
|
+
tick: number;
|
|
105
|
+
cellWidth: number;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Returns the window-visible slice of a startTime-sorted event array.
|
|
110
|
+
* Binary search cuts the tail (startTime > windowEnd) in O(log n); the head
|
|
111
|
+
* is filtered linearly on endTime, which cannot be binary-searched on a
|
|
112
|
+
* startTime ordering.
|
|
113
|
+
*/
|
|
114
|
+
export declare const cullToWindow: (events: EventType[], windowStart: number, windowEnd: number) => EventType[];
|
|
115
|
+
|
|
116
|
+
export declare const default_alias: {
|
|
117
|
+
title: string;
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Canvas board: two viewport-sized canvases (grid + events) kept fixed
|
|
122
|
+
* inside the scrolling body via position:sticky, with a tall spacer div
|
|
123
|
+
* providing the native scrollbar. Drawing is translated by scrollTop, so the
|
|
124
|
+
* canvas never exceeds browser size limits regardless of row count.
|
|
125
|
+
*
|
|
126
|
+
* The forwarded ref targets the content column — the element timeline.tsx
|
|
127
|
+
* measures for tick/cellWidth.
|
|
128
|
+
*/
|
|
129
|
+
export declare const default_alias_1: React_2.ForwardRefExoticComponent<CanvasBoardProps & React_2.RefAttributes<HTMLDivElement>>;
|
|
130
|
+
|
|
131
|
+
export declare const default_alias_2: ({ windowTime, tick, contentWidth, scrollWidth, theme, timeBar, }: {
|
|
132
|
+
windowTime: number[];
|
|
133
|
+
tick: number | null;
|
|
134
|
+
contentWidth: number | null;
|
|
135
|
+
scrollWidth: number;
|
|
136
|
+
theme?: ResolvedTheme;
|
|
137
|
+
timeBar?: TimeBarConfig;
|
|
138
|
+
}) => React_2.JSX.Element;
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Hover tooltip for events. Positioned with @floating-ui/dom against the
|
|
142
|
+
* hovered event's rect (viewport coordinates): preferred above the event,
|
|
143
|
+
* flips below when there is no room, and shifts horizontally to stay
|
|
144
|
+
* on-screen.
|
|
145
|
+
*/
|
|
146
|
+
export declare const default_alias_3: React_2.ForwardRefExoticComponent<EventPromptType & React_2.RefAttributes<EventPromptActionsType>>;
|
|
147
|
+
|
|
148
|
+
export declare const default_alias_4: ({ tick, windowTime, }: {
|
|
149
|
+
tick: number | null;
|
|
150
|
+
windowTime: number[];
|
|
151
|
+
}) => React_2.JSX.Element;
|
|
152
|
+
|
|
153
|
+
export declare const default_alias_5: (monthIndex: number) => string;
|
|
154
|
+
|
|
155
|
+
export declare const default_alias_6: (dayIndex: number) => string;
|
|
156
|
+
|
|
157
|
+
export declare const default_alias_7: (eventA: EventType, eventB: EventType) => 1 | -1;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Pointer-event state machine for the canvas board: pan the time window,
|
|
161
|
+
* drag events between rows/times (DOM ghost preview), resize event edges,
|
|
162
|
+
* change grid granularity (middle-click mode or ctrl+wheel). Event mutations
|
|
163
|
+
* are applied straight to the SceneStore — no React state on the hot path.
|
|
164
|
+
*/
|
|
165
|
+
export declare const default_alias_8: ({ scene, rendererRef, dynamicCanvasRef, bodyRef, ghostRef, eventPromptRef, setWindowTime, setCellWidth, setTick, onDrop, onResize, onEventClick, onEventHover, eventsResize, panZoom, }: UseCanvasInteractionsArgs) => {
|
|
166
|
+
handlePointerDown: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
167
|
+
handlePointerMove: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
168
|
+
handlePointerUp: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
169
|
+
handlePointerLeave: () => void;
|
|
170
|
+
handlePointerCancel: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
171
|
+
handleAuxClick: (pointerEvent: React_2.MouseEvent<HTMLCanvasElement>) => void;
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
export declare const default_alias_9: ({ windowTime, setTick, setCellWidth, contentRef, }: {
|
|
175
|
+
windowTime: number[];
|
|
176
|
+
setTick: React.Dispatch<React.SetStateAction<number | null>>;
|
|
177
|
+
setCellWidth: React.Dispatch<React.SetStateAction<number>>;
|
|
178
|
+
contentRef: React.MutableRefObject<HTMLDivElement | null>;
|
|
179
|
+
}) => void;
|
|
180
|
+
|
|
181
|
+
export declare const DEFAULT_FADE_DURATION_MS = 120;
|
|
182
|
+
|
|
183
|
+
/** Defaults mirror the pre-0.2.x constants (20px bars, 22px lanes, 10px pad). */
|
|
184
|
+
export declare const DEFAULT_GEOMETRY: Geometry;
|
|
185
|
+
|
|
186
|
+
export declare const DEFAULT_LAYOUT_DURATION_MS = 200;
|
|
187
|
+
|
|
188
|
+
/** Defaults mirror the pre-0.2.0 stylesheet values. */
|
|
189
|
+
export declare const DEFAULT_THEME: ResolvedTheme;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Custom canvas renderer for an event. Return false to fall through to the
|
|
193
|
+
* library's default drawing.
|
|
194
|
+
*/
|
|
195
|
+
declare type DrawEventFn = (ctx: CanvasRenderingContext2D, event: EventType, rect: Rect, state: EventState, theme: ResolvedTheme) => void | false;
|
|
196
|
+
export { DrawEventFn }
|
|
197
|
+
export { DrawEventFn as DrawEventFn_alias_1 }
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* All window- and viewport-visible events in one pass. Rows fully outside
|
|
201
|
+
* the vertical viewport are skipped without touching their events. Custom
|
|
202
|
+
* renderers resolve per-event drawEvent -> Timeline drawEvent -> default.
|
|
203
|
+
*/
|
|
204
|
+
export declare const drawEvents: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, font: string, animator: LayoutAnimator) => void;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Vertical grid lines, one per grid cell (`cellWidth` px == `cellWidth * tick`
|
|
208
|
+
* seconds). Lines are anchored to absolute time — placed at cell boundaries
|
|
209
|
+
* (multiples of the cell duration), not at fixed screen offsets — so they pan
|
|
210
|
+
* with the content and stay aligned with the time-bar blocks. Keeps the legacy
|
|
211
|
+
* "hide-last-line" behavior: no line within 1px of either edge.
|
|
212
|
+
*/
|
|
213
|
+
export declare const drawGridLines: (ctx: CanvasRenderingContext2D, { width, height, cellWidth, windowStart, tick, color, }: {
|
|
214
|
+
width: number;
|
|
215
|
+
height: number;
|
|
216
|
+
cellWidth: number;
|
|
217
|
+
windowStart: number;
|
|
218
|
+
tick: number;
|
|
219
|
+
color?: string;
|
|
220
|
+
}) => void;
|
|
221
|
+
|
|
222
|
+
/** Horizontal row dividers — replaces .row-content border-bottom. */
|
|
223
|
+
export declare const drawRowDividers: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, animator: LayoutAnimator) => void;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Two-row time bar (top row over bottom row) — canvas replacement for the
|
|
227
|
+
* day/hour block divs of time-bar.tsx. The two rows are unit-agnostic
|
|
228
|
+
* (day/hour by default, configurable via TimeBarConfig). Background is left
|
|
229
|
+
* transparent so the .time-bar container color shows through.
|
|
230
|
+
*/
|
|
231
|
+
export declare const drawTimeBar: (ctx: CanvasRenderingContext2D, { width, height, topBlocks, bottomBlocks, font, borderColor, textColor, }: {
|
|
232
|
+
width: number;
|
|
233
|
+
height: number;
|
|
234
|
+
font: string;
|
|
235
|
+
borderColor?: string;
|
|
236
|
+
textColor?: string;
|
|
237
|
+
topBlocks: TimeBlock[];
|
|
238
|
+
bottomBlocks: TimeBlock[];
|
|
239
|
+
}) => void;
|
|
240
|
+
|
|
241
|
+
/** Imperative event mutation, applied without React re-renders. */
|
|
242
|
+
declare type EventPatch = {
|
|
243
|
+
op: "upsert";
|
|
244
|
+
event: EventType;
|
|
245
|
+
} | {
|
|
246
|
+
op: "update";
|
|
247
|
+
id: string;
|
|
248
|
+
changes: Partial<Omit<EventType, "id">>;
|
|
249
|
+
} | {
|
|
250
|
+
op: "remove";
|
|
251
|
+
id: string;
|
|
252
|
+
};
|
|
253
|
+
export { EventPatch }
|
|
254
|
+
export { EventPatch as EventPatch_alias_1 }
|
|
255
|
+
export { EventPatch as EventPatch_alias_2 }
|
|
256
|
+
|
|
257
|
+
export declare type EventPromptActionsType = {
|
|
258
|
+
/** show the prompt for an event, anchored to its rect (viewport coords) */
|
|
259
|
+
show: (event: EventType, anchorRect: Rect) => void;
|
|
260
|
+
hide: () => void;
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
declare type EventPromptType = {
|
|
264
|
+
template?: (event: EventType) => JSX.Element;
|
|
265
|
+
};
|
|
266
|
+
|
|
267
|
+
declare type EventPropsType = {
|
|
268
|
+
isLocked?: boolean;
|
|
269
|
+
isResizable?: boolean;
|
|
270
|
+
showPrompt?: boolean;
|
|
271
|
+
/** plain-text label drawn inside the bar (was `content` before 0.2.0) */
|
|
272
|
+
label?: string;
|
|
273
|
+
/** per-event appearance (was `classNames` before 0.2.0) */
|
|
274
|
+
style?: EventStyle;
|
|
275
|
+
/** per-event custom renderer; overrides the Timeline-level drawEvent */
|
|
276
|
+
drawEvent?: DrawEventFn;
|
|
277
|
+
/** arbitrary data for eventPromptTemplate */
|
|
278
|
+
metadata?: unknown;
|
|
279
|
+
};
|
|
280
|
+
export { EventPropsType }
|
|
281
|
+
export { EventPropsType as EventPropsType_alias_1 }
|
|
282
|
+
|
|
283
|
+
/** Interaction state passed to custom drawEvent renderers. */
|
|
284
|
+
declare type EventState = {
|
|
285
|
+
hovered: boolean;
|
|
286
|
+
dragging: boolean;
|
|
287
|
+
resizing: boolean;
|
|
288
|
+
selected: boolean;
|
|
289
|
+
};
|
|
290
|
+
export { EventState }
|
|
291
|
+
export { EventState as EventState_alias_1 }
|
|
292
|
+
|
|
293
|
+
/** Per-event appearance overrides, merged over the theme defaults. */
|
|
294
|
+
declare type EventStyle = {
|
|
295
|
+
fill?: string;
|
|
296
|
+
stroke?: string;
|
|
297
|
+
strokeWidth?: number;
|
|
298
|
+
textColor?: string;
|
|
299
|
+
font?: string;
|
|
300
|
+
borderRadius?: number;
|
|
301
|
+
opacity?: number;
|
|
302
|
+
};
|
|
303
|
+
export { EventStyle }
|
|
304
|
+
export { EventStyle as EventStyle_alias_1 }
|
|
305
|
+
|
|
306
|
+
declare type EventType = {
|
|
307
|
+
id: string;
|
|
308
|
+
rowId: string;
|
|
309
|
+
startTime: number;
|
|
310
|
+
endTime: number;
|
|
311
|
+
props?: EventPropsType;
|
|
312
|
+
};
|
|
313
|
+
export { EventType }
|
|
314
|
+
export { EventType as EventType_alias_1 }
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Coalesces invalidations into a single requestAnimationFrame callback.
|
|
318
|
+
* Any number of invalidate() calls within one frame produce exactly one
|
|
319
|
+
* onFrame() with the union of dirty layers — the backbone of 60fps under
|
|
320
|
+
* streaming updates.
|
|
321
|
+
*/
|
|
322
|
+
export declare class FrameScheduler {
|
|
323
|
+
private onFrame;
|
|
324
|
+
private rafId;
|
|
325
|
+
private dirty;
|
|
326
|
+
constructor(onFrame: (dirty: LayerDirty) => void);
|
|
327
|
+
invalidate(layer: Layer | "all"): void;
|
|
328
|
+
/** Runs a pending frame immediately (tests, synchronous reads). */
|
|
329
|
+
flush(): void;
|
|
330
|
+
dispose(): void;
|
|
331
|
+
private schedule;
|
|
332
|
+
private run;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* The default two-row time bar: a day row over an hour row. Thin wrapper over
|
|
337
|
+
* `generateUnitBlocks` kept for the golden tests and as the documented
|
|
338
|
+
* default; the canvas time bar resolves `TimeBarConfig` and calls
|
|
339
|
+
* `generateUnitBlocks` per row directly.
|
|
340
|
+
*/
|
|
341
|
+
export declare const generateTimeBlocks: ({ windowStart, tick, contentWidth, }: {
|
|
342
|
+
windowStart: number;
|
|
343
|
+
tick: number | null;
|
|
344
|
+
contentWidth: number | null;
|
|
345
|
+
/** @deprecated unused — block widths now derive from `tick` */
|
|
346
|
+
blockWidth?: number;
|
|
347
|
+
}) => TimeBlocks;
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* Positioned blocks for one time-bar row. Walks real calendar/step boundaries
|
|
351
|
+
* from `windowStart` to `windowEnd` and derives each block's pixel x/width
|
|
352
|
+
* from `tick` (seconds per pixel), so blocks stay aligned to the wall clock as
|
|
353
|
+
* the window pans. The first/last blocks are clipped to the window edges, so
|
|
354
|
+
* the row tiles contiguously from x=0 to the content width.
|
|
355
|
+
*/
|
|
356
|
+
export declare const generateUnitBlocks: ({ unit, format, windowStart, windowEnd, tick, }: TimeBarRowConfig & {
|
|
357
|
+
windowStart: number;
|
|
358
|
+
windowEnd: number;
|
|
359
|
+
tick: number | null;
|
|
360
|
+
}) => TimeBlock[];
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Resolved vertical layout for event bars and rows (px). Derived once from the
|
|
364
|
+
* theme (see `geometryFromTheme`) and owned by the SceneStore, which both the
|
|
365
|
+
* renderer (`draw-events`) and hit-testing read so positioning stays in sync.
|
|
366
|
+
*
|
|
367
|
+
* Only `barHeight`, `laneGap`, `rowPaddingY`, and `barRadius` are themeable;
|
|
368
|
+
* the rest are derived from them.
|
|
369
|
+
*/
|
|
370
|
+
export declare type Geometry = {
|
|
371
|
+
/** event bar height */
|
|
372
|
+
barHeight: number;
|
|
373
|
+
/** vertical stride between stacked lanes (barHeight + laneGap) */
|
|
374
|
+
laneHeight: number;
|
|
375
|
+
/** top padding before the first lane (== rowPaddingY) */
|
|
376
|
+
laneTopOffset: number;
|
|
377
|
+
/** minimum row height with no stacking (barHeight + 2*rowPaddingY) */
|
|
378
|
+
rowBaseHeight: number;
|
|
379
|
+
/** static-event height with no stacking (== barHeight) */
|
|
380
|
+
staticEventBaseHeight: number;
|
|
381
|
+
/** event bar corner radius */
|
|
382
|
+
barRadius: number;
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
/** Derive the full Geometry from the resolved theme's geometry tokens. */
|
|
386
|
+
export declare const geometryFromTheme: (theme: ResolvedTheme) => Geometry;
|
|
387
|
+
|
|
388
|
+
export declare type HitTarget = {
|
|
389
|
+
kind: "event" | "static";
|
|
390
|
+
event: EventType;
|
|
391
|
+
rowId: string;
|
|
392
|
+
/** rect in viewport (canvas CSS px) coordinates, scroll already applied */
|
|
393
|
+
rect: Rect;
|
|
394
|
+
};
|
|
395
|
+
|
|
396
|
+
/**
|
|
397
|
+
* Point query against the scene at viewport coordinates (x, y).
|
|
398
|
+
* Finds the row by accumulated heights, then scans that row's window-visible
|
|
399
|
+
* events back-to-front (interactive events sit above static ones, later
|
|
400
|
+
* events draw above earlier ones). Per-row event counts are small, so the
|
|
401
|
+
* scan after the row/window cut is cheap — no spatial index needed.
|
|
402
|
+
*/
|
|
403
|
+
export declare const hitTest: (scene: SceneStore, view: HitTestView, x: number, y: number) => HitTarget | null;
|
|
404
|
+
|
|
405
|
+
export declare type HitTestView = {
|
|
406
|
+
windowStart: number;
|
|
407
|
+
windowEnd: number;
|
|
408
|
+
tick: number;
|
|
409
|
+
scrollTop: number;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
export declare const intersectsWindow: (event: EventType, windowStart: number, windowEnd: number) => boolean;
|
|
413
|
+
|
|
414
|
+
export declare type LaneResult = {
|
|
415
|
+
laneOf: Map<string, number>;
|
|
416
|
+
highestLane: number;
|
|
417
|
+
};
|
|
418
|
+
|
|
419
|
+
export declare const laneTop: (lane: number, g?: Geometry) => number;
|
|
420
|
+
|
|
421
|
+
export declare type Layer = "static" | "dynamic";
|
|
422
|
+
|
|
423
|
+
export declare type LayerDirty = {
|
|
424
|
+
static: boolean;
|
|
425
|
+
dynamic: boolean;
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Replaces the CSS transitions the DOM renderer got for free:
|
|
430
|
+
* row heights and event tops tween when stacking changes, and resize
|
|
431
|
+
* handles fade in/out. Values are queried per frame; while any tween is
|
|
432
|
+
* live the renderer keeps scheduling frames.
|
|
433
|
+
*
|
|
434
|
+
* Durations are configurable via the Timeline `animations` prop; a duration
|
|
435
|
+
* of 0 disables that animation (values jump straight to target).
|
|
436
|
+
*
|
|
437
|
+
* Coordinate rules: row heights are content-space; event tops are
|
|
438
|
+
* ROW-LOCAL lane offsets. Tweens must never target a value that is itself
|
|
439
|
+
* animated (e.g. an absolute top including the animated row position) —
|
|
440
|
+
* a moving target retargets every frame and the tween lags behind it
|
|
441
|
+
* perpetually, desyncing the layers.
|
|
442
|
+
*/
|
|
443
|
+
export declare class LayoutAnimator {
|
|
444
|
+
private rowHeights;
|
|
445
|
+
private eventTops;
|
|
446
|
+
private handleAlphas;
|
|
447
|
+
private now;
|
|
448
|
+
private activeUntil;
|
|
449
|
+
private layoutDuration;
|
|
450
|
+
private fadeDuration;
|
|
451
|
+
setDurations(layoutMs: number, fadeMs: number): void;
|
|
452
|
+
beginFrame(now: number): void;
|
|
453
|
+
rowHeight(rowId: string, target: number): number;
|
|
454
|
+
eventTop(eventId: string, target: number): number;
|
|
455
|
+
/** 0..1 opacity of an event's resize handles; target 1 = hovered. */
|
|
456
|
+
handleAlpha(eventId: string, target: number): number;
|
|
457
|
+
isAnimating(): boolean;
|
|
458
|
+
/**
|
|
459
|
+
* Drop an event's top tween so its next draw renders at the target
|
|
460
|
+
* instantly — used on drag-drop commit, where the ghost already previewed
|
|
461
|
+
* the final position and a tween would feel like a rubber-band.
|
|
462
|
+
*/
|
|
463
|
+
snapEventTop(eventId: string): void;
|
|
464
|
+
/** Drop all state, e.g. when the scene is reset wholesale. */
|
|
465
|
+
reset(): void;
|
|
466
|
+
private value;
|
|
467
|
+
private current;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
export declare type ModifableElements = {
|
|
471
|
+
timeBar: string;
|
|
472
|
+
dayRow: string;
|
|
473
|
+
hourRow: string;
|
|
474
|
+
gridLine: string;
|
|
475
|
+
rowsHeader: string;
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
declare type OnDropProps = {
|
|
479
|
+
eventId: string;
|
|
480
|
+
oldRowId: string;
|
|
481
|
+
newRowId: string;
|
|
482
|
+
startTime: number;
|
|
483
|
+
endTime: number;
|
|
484
|
+
};
|
|
485
|
+
export { OnDropProps }
|
|
486
|
+
export { OnDropProps as OnDropProps_alias_1 }
|
|
487
|
+
|
|
488
|
+
declare type OnEventClickProps = {
|
|
489
|
+
eventId: string;
|
|
490
|
+
rowId: string;
|
|
491
|
+
nativeEvent: PointerEvent;
|
|
492
|
+
modifiers: {
|
|
493
|
+
shift: boolean;
|
|
494
|
+
ctrl: boolean;
|
|
495
|
+
meta: boolean;
|
|
496
|
+
alt: boolean;
|
|
497
|
+
};
|
|
498
|
+
};
|
|
499
|
+
export { OnEventClickProps }
|
|
500
|
+
export { OnEventClickProps as OnEventClickProps_alias_1 }
|
|
501
|
+
|
|
502
|
+
declare type OnEventHoverProps = {
|
|
503
|
+
/** null when the pointer leaves all events */
|
|
504
|
+
eventId: string | null;
|
|
505
|
+
rowId: string | null;
|
|
506
|
+
};
|
|
507
|
+
export { OnEventHoverProps }
|
|
508
|
+
export { OnEventHoverProps as OnEventHoverProps_alias_1 }
|
|
509
|
+
|
|
510
|
+
declare type OnResizeProps = {
|
|
511
|
+
eventId: string;
|
|
512
|
+
startTime: number;
|
|
513
|
+
endTime: number;
|
|
514
|
+
};
|
|
515
|
+
export { OnResizeProps }
|
|
516
|
+
export { OnResizeProps as OnResizeProps_alias_1 }
|
|
517
|
+
|
|
518
|
+
declare type PanZoomConfig = {
|
|
519
|
+
/** drag the empty background to pan the time window (default true) */
|
|
520
|
+
panOnDragBackground?: boolean;
|
|
521
|
+
/** ctrl/cmd + wheel (and trackpad pinch) zooms the visible time frame,
|
|
522
|
+
* anchored at the cursor (default true). Since 0.2.x this is time-frame
|
|
523
|
+
* zoom — grid granularity now lives on middle-click+wheel only. */
|
|
524
|
+
ctrlWheelZoom?: boolean;
|
|
525
|
+
/** two-finger pinch zooms the time frame on touch devices (default true) */
|
|
526
|
+
pinchZoom?: boolean;
|
|
527
|
+
/** ctrl/cmd + drag on the background zooms the time frame: drag right to zoom
|
|
528
|
+
* in, left to zoom out (default true) */
|
|
529
|
+
dragZoom?: boolean;
|
|
530
|
+
/** smallest visible window in seconds the zoom will go to (default 900 = 15 min) */
|
|
531
|
+
minWindowSeconds?: number;
|
|
532
|
+
/** largest visible window in seconds the zoom will go to (default 30 days) */
|
|
533
|
+
maxWindowSeconds?: number;
|
|
534
|
+
/** multiplier applied to the window per wheel notch (default 1.15) */
|
|
535
|
+
zoomWheelFactor?: number;
|
|
536
|
+
/** middle-click toggles wheel grid-granularity mode (default true) */
|
|
537
|
+
middleClickGranularity?: boolean;
|
|
538
|
+
/** seconds per grid-granularity step (default 900 = 15 min) */
|
|
539
|
+
zoomStepSeconds?: number;
|
|
540
|
+
};
|
|
541
|
+
export { PanZoomConfig }
|
|
542
|
+
export { PanZoomConfig as PanZoomConfig_alias_1 }
|
|
543
|
+
|
|
544
|
+
export declare type PartialRecord<K extends keyof any, T> = Partial<Record<K, T>>;
|
|
545
|
+
|
|
546
|
+
declare type Rect = {
|
|
547
|
+
x: number;
|
|
548
|
+
y: number;
|
|
549
|
+
width: number;
|
|
550
|
+
height: number;
|
|
551
|
+
};
|
|
552
|
+
export { Rect }
|
|
553
|
+
export { Rect as Rect_alias_1 }
|
|
554
|
+
export { Rect as Rect_alias_2 }
|
|
555
|
+
|
|
556
|
+
export declare const rectContains: (rect: Rect, x: number, y: number) => boolean;
|
|
557
|
+
|
|
558
|
+
export declare type RendererView = {
|
|
559
|
+
windowTime: [number, number];
|
|
560
|
+
tick: number | null;
|
|
561
|
+
cellWidth: number;
|
|
562
|
+
scrollTop: number;
|
|
563
|
+
width: number;
|
|
564
|
+
height: number;
|
|
565
|
+
theme: ResolvedTheme;
|
|
566
|
+
drawEvent?: DrawEventFn;
|
|
567
|
+
eventsResize: boolean;
|
|
568
|
+
hoveredEventId: string | null;
|
|
569
|
+
draggedEventId: string | null;
|
|
570
|
+
resizePreview: ResizePreview | null;
|
|
571
|
+
};
|
|
572
|
+
|
|
573
|
+
export declare type ResizePreview = {
|
|
574
|
+
eventId: string;
|
|
575
|
+
deltaPx: number;
|
|
576
|
+
direction: "left" | "right";
|
|
577
|
+
};
|
|
578
|
+
|
|
579
|
+
declare type ResolvedTheme = Required<Omit<Theme, "font">> & Pick<Theme, "font">;
|
|
580
|
+
export { ResolvedTheme }
|
|
581
|
+
export { ResolvedTheme as ResolvedTheme_alias_1 }
|
|
582
|
+
|
|
583
|
+
export declare const resolveTheme: (theme?: Theme) => ResolvedTheme;
|
|
584
|
+
|
|
585
|
+
export declare const rowMinHeight: (highestLane: number, g?: Geometry) => number;
|
|
586
|
+
|
|
587
|
+
declare type RowType = {
|
|
588
|
+
id: string;
|
|
589
|
+
name: string;
|
|
590
|
+
};
|
|
591
|
+
export { RowType }
|
|
592
|
+
export { RowType as RowType_alias_1 }
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* Imperative event store for the canvas renderer. Lives outside React state:
|
|
596
|
+
* streaming patches mutate it directly and the renderer reads from it per
|
|
597
|
+
* frame — React never reconciles individual event motion.
|
|
598
|
+
*
|
|
599
|
+
* Lane assignment (and therefore row height) is computed lazily per row, only
|
|
600
|
+
* when that row is queried for the current window. Bursts of patches against
|
|
601
|
+
* off-screen rows cost nothing beyond an index update.
|
|
602
|
+
*/
|
|
603
|
+
export declare class SceneStore {
|
|
604
|
+
private rowIndexes;
|
|
605
|
+
private rowOrder;
|
|
606
|
+
private eventRow;
|
|
607
|
+
private listeners;
|
|
608
|
+
private geometry;
|
|
609
|
+
version: number;
|
|
610
|
+
setGeometry(geometry: Geometry): void;
|
|
611
|
+
getGeometry(): Geometry;
|
|
612
|
+
setRows(rows: RowType[]): void;
|
|
613
|
+
setEvents(events: EventType[]): void;
|
|
614
|
+
setStaticEvents(events: EventType[]): void;
|
|
615
|
+
applyPatches(patches: EventPatch[]): void;
|
|
616
|
+
getEvent(id: string): EventType | undefined;
|
|
617
|
+
getRowIds(): string[];
|
|
618
|
+
getRow(rowId: string): RowType | undefined;
|
|
619
|
+
getRowEvents(rowId: string): EventType[];
|
|
620
|
+
getRowStaticEvents(rowId: string): EventType[];
|
|
621
|
+
getLanes(rowId: string, windowStart: number, windowEnd: number): LaneResult;
|
|
622
|
+
getRowHeight(rowId: string, windowStart: number, windowEnd: number): number;
|
|
623
|
+
/**
|
|
624
|
+
* y offset of each row's top edge (content coordinates, before scroll) plus
|
|
625
|
+
* the total content height — drives both drawing and the scroll spacer.
|
|
626
|
+
*/
|
|
627
|
+
getRowOffsets(windowStart: number, windowEnd: number): {
|
|
628
|
+
offsetOf: Map<string, number>;
|
|
629
|
+
totalHeight: number;
|
|
630
|
+
};
|
|
631
|
+
subscribe(listener: () => void): () => void;
|
|
632
|
+
private insert;
|
|
633
|
+
private remove;
|
|
634
|
+
private bump;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Sizes a canvas backing store for the given devicePixelRatio and resets the
|
|
639
|
+
* context transform so ALL drawing code works in CSS pixels.
|
|
640
|
+
*/
|
|
641
|
+
export declare const sizeCanvas: (canvas: HTMLCanvasElement, cssWidth: number, cssHeight: number, dpr: number) => CanvasRenderingContext2D | null;
|
|
642
|
+
|
|
643
|
+
export declare const staticEventHeight: (highestLane: number, g?: Geometry) => number;
|
|
644
|
+
|
|
645
|
+
/** Grid granularity step: same clamp as content.tsx handleOnWheel. */
|
|
646
|
+
export declare const stepCellWidth: (cellWidth: number, deltaY: number, tick: number) => number;
|
|
647
|
+
|
|
648
|
+
/**
|
|
649
|
+
* Color/font/geometry tokens for everything drawn to canvas. Defaults mirror
|
|
650
|
+
* the pre-0.2.0 stylesheet. Bar geometry (height, lane spacing, row padding,
|
|
651
|
+
* radius) is themeable since 0.2.x — see `core/geometry.ts`.
|
|
652
|
+
*/
|
|
653
|
+
declare type Theme = {
|
|
654
|
+
eventFill?: string;
|
|
655
|
+
eventStroke?: string;
|
|
656
|
+
eventTextColor?: string;
|
|
657
|
+
staticEventFill?: string;
|
|
658
|
+
gridColor?: string;
|
|
659
|
+
timeBarBorder?: string;
|
|
660
|
+
timeBarTextColor?: string;
|
|
661
|
+
/** canvas text font; defaults to the canvas element's computed font */
|
|
662
|
+
font?: string;
|
|
663
|
+
/** event bar height in px (default 20) */
|
|
664
|
+
barHeight?: number;
|
|
665
|
+
/** gap between stacked lanes in px; laneHeight = barHeight + laneGap (default 2) */
|
|
666
|
+
laneGap?: number;
|
|
667
|
+
/** vertical padding above/below the bars within a row in px (default 10) */
|
|
668
|
+
rowPaddingY?: number;
|
|
669
|
+
/** event bar corner radius in px (default 5) */
|
|
670
|
+
barRadius?: number;
|
|
671
|
+
};
|
|
672
|
+
export { Theme }
|
|
673
|
+
export { Theme as Theme_alias_1 }
|
|
674
|
+
|
|
675
|
+
/** Per-row configuration for the two-row time bar. */
|
|
676
|
+
export declare type TimeBarConfig = {
|
|
677
|
+
topRow?: TimeBarRowConfig;
|
|
678
|
+
bottomRow?: TimeBarRowConfig;
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
export declare type TimeBarRowConfig = {
|
|
682
|
+
/** the unit each block spans (default: "day" for the top row, "hour" for
|
|
683
|
+
* the bottom row), or a fixed step like `{ stepSeconds: 8 * 3600 }`. */
|
|
684
|
+
unit?: TimeBarUnit | {
|
|
685
|
+
stepSeconds: number;
|
|
686
|
+
};
|
|
687
|
+
/** label for a block; receives the block's start and end. Defaults mirror
|
|
688
|
+
* the built-in day ("Mon 1 Jan") and hour ("HH:00") labels. */
|
|
689
|
+
format?: (blockStart: Date, blockEnd: Date) => string;
|
|
690
|
+
};
|
|
691
|
+
|
|
692
|
+
/** Calendar unit for a time-bar row, or a fixed step in seconds. */
|
|
693
|
+
export declare type TimeBarUnit = "hour" | "day" | "week" | "month";
|
|
694
|
+
|
|
695
|
+
export declare type TimeBlock = {
|
|
696
|
+
label: string;
|
|
697
|
+
x: number;
|
|
698
|
+
width: number;
|
|
699
|
+
};
|
|
700
|
+
|
|
701
|
+
export declare type TimeBlocks = {
|
|
702
|
+
dayBlocks: TimeBlock[];
|
|
703
|
+
hourBlocks: TimeBlock[];
|
|
704
|
+
};
|
|
705
|
+
|
|
706
|
+
declare const Timeline: React_2.ForwardRefExoticComponent<TimelineProps & React_2.RefAttributes<TimelineHandle>>;
|
|
707
|
+
export { Timeline }
|
|
708
|
+
export { Timeline as Timeline_alias_1 }
|
|
709
|
+
|
|
710
|
+
export declare const TimelineCanvas: () => React_2.JSX.Element;
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Imperative handle for streaming/live updates: `const ref =
|
|
714
|
+
* useRef<TimelineHandle>(null); <Timeline ref={ref} ...>`.
|
|
715
|
+
*
|
|
716
|
+
* Reconciliation rule: the `events` PROP is authoritative whenever its
|
|
717
|
+
* reference changes — a new array resets the internal store and discards all
|
|
718
|
+
* imperative state. Pick one mode: declarative (swap the prop) or imperative
|
|
719
|
+
* (stable prop + handle calls).
|
|
720
|
+
*/
|
|
721
|
+
declare type TimelineHandle = {
|
|
722
|
+
/** full replace of all events (does not touch the `events` prop) */
|
|
723
|
+
setEvents(events: EventType[]): void;
|
|
724
|
+
/** batched patches, coalesced into a single redraw per animation frame */
|
|
725
|
+
updateEvents(patches: EventPatch[]): void;
|
|
726
|
+
getEvent(id: string): EventType | undefined;
|
|
727
|
+
/** scroll vertically so the row is at the top of the viewport */
|
|
728
|
+
scrollToRow(rowId: string): void;
|
|
729
|
+
/** move the visible time window, preserving its duration */
|
|
730
|
+
scrollToTime(time: number): void;
|
|
731
|
+
/** set the visible time window explicitly (unix seconds) */
|
|
732
|
+
setWindow(startTime: number, endTime: number): void;
|
|
733
|
+
getVisibleRange(): {
|
|
734
|
+
startTime: number;
|
|
735
|
+
endTime: number;
|
|
736
|
+
};
|
|
737
|
+
/** force a full redraw of both canvas layers */
|
|
738
|
+
redraw(): void;
|
|
739
|
+
};
|
|
740
|
+
export { TimelineHandle }
|
|
741
|
+
export { TimelineHandle as TimelineHandle_alias_1 }
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* A small, sub-day window (~6h). With a window narrower than a day the time
|
|
745
|
+
* bar must still track the hour labels to the actual time as you pan — pan the
|
|
746
|
+
* background and watch the hour labels advance continuously (rather than
|
|
747
|
+
* staying pinned and then jumping by a whole day near midnight).
|
|
748
|
+
*/
|
|
749
|
+
export declare const TimelineNarrowWindow: () => React_2.JSX.Element;
|
|
750
|
+
|
|
751
|
+
export declare const TimelinePrimary: () => React_2.JSX.Element;
|
|
752
|
+
|
|
753
|
+
declare type TimelineProps = {
|
|
754
|
+
rows: RowType[];
|
|
755
|
+
events: EventType[];
|
|
756
|
+
staticEvents?: EventType[];
|
|
757
|
+
startDate: Date;
|
|
758
|
+
endDate: Date;
|
|
759
|
+
onDrop?: (props: OnDropProps) => void;
|
|
760
|
+
onResize?: (props: OnResizeProps) => void;
|
|
761
|
+
onEventClick?: (props: OnEventClickProps) => void;
|
|
762
|
+
onEventHover?: (props: OnEventHoverProps) => void;
|
|
763
|
+
theme?: Theme;
|
|
764
|
+
drawEvent?: DrawEventFn;
|
|
765
|
+
/** only `rowsHeader` still applies — everything else is canvas-drawn (use `theme`) */
|
|
766
|
+
additionalClassNames?: PartialRecord<keyof ModifableElements, string>;
|
|
767
|
+
showRTIndicator?: boolean;
|
|
768
|
+
eventsResize?: boolean;
|
|
769
|
+
showEventPrompt?: boolean;
|
|
770
|
+
eventPromptTemplate?: (event: EventType) => JSX.Element;
|
|
771
|
+
panZoom?: PanZoomConfig;
|
|
772
|
+
/** configure each row's unit/label in the two-row time bar */
|
|
773
|
+
timeBar?: TimeBarConfig;
|
|
774
|
+
/** layout animations: true (default), false to disable, or durations */
|
|
775
|
+
animations?: AnimationConfig;
|
|
776
|
+
};
|
|
777
|
+
export { TimelineProps }
|
|
778
|
+
export { TimelineProps as TimelineProps_alias_1 }
|
|
779
|
+
|
|
780
|
+
/**
|
|
781
|
+
* Owns the two viewport-sized canvases and the frame loop.
|
|
782
|
+
*
|
|
783
|
+
* - static layer: grid lines, day/hour bands, time bar (Phase 2)
|
|
784
|
+
* - dynamic layer: events (Phase 3)
|
|
785
|
+
*
|
|
786
|
+
* React pushes view-state via setView(); the SceneStore pushes data changes
|
|
787
|
+
* via its subscription. Both only flip dirty flags — actual drawing happens
|
|
788
|
+
* once per animation frame.
|
|
789
|
+
*/
|
|
790
|
+
export declare class TimelineRenderer {
|
|
791
|
+
private staticCanvas;
|
|
792
|
+
private dynamicCanvas;
|
|
793
|
+
private scene;
|
|
794
|
+
private view;
|
|
795
|
+
readonly animator: LayoutAnimator;
|
|
796
|
+
private scheduler;
|
|
797
|
+
private unsubscribeScene;
|
|
798
|
+
private unwatchDpr;
|
|
799
|
+
private dpr;
|
|
800
|
+
private font;
|
|
801
|
+
constructor(staticCanvas: HTMLCanvasElement, dynamicCanvas: HTMLCanvasElement, scene: SceneStore);
|
|
802
|
+
getView(): RendererView;
|
|
803
|
+
setView(partial: Partial<RendererView>): void;
|
|
804
|
+
invalidate(layer: Layer | "all"): void;
|
|
805
|
+
/** Force a synchronous draw of anything pending (tests, screenshots). */
|
|
806
|
+
flush(): void;
|
|
807
|
+
dispose(): void;
|
|
808
|
+
private resizeCanvases;
|
|
809
|
+
private drawFrame;
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
/**
|
|
813
|
+
* Configurable time-bar rows: a day row over 8-hour "shift" blocks instead of
|
|
814
|
+
* hours. The bottom row uses `{ stepSeconds: 8 * 3600 }` with a custom
|
|
815
|
+
* `format`. Grid lines and drop snapping stay on the hour grid, independent of
|
|
816
|
+
* the time-bar rows.
|
|
817
|
+
*/
|
|
818
|
+
export declare const TimelineShiftBar: () => React_2.JSX.Element;
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
|
+
* 10k events across 500 rows with a fake websocket pushing 200 random
|
|
822
|
+
* event moves every 100ms through the imperative handle — zero React
|
|
823
|
+
* re-renders of the board on the hot path.
|
|
824
|
+
*/
|
|
825
|
+
export declare const TimelineStreaming10k: () => React_2.JSX.Element;
|
|
826
|
+
|
|
827
|
+
/**
|
|
828
|
+
* Themeable bar geometry: chunky 32px bars with a 6px lane gap, wide row
|
|
829
|
+
* padding, and a larger corner radius. Verifies stacking, hit-testing
|
|
830
|
+
* (hover/resize zones), drag-ghost height, and header alignment all follow the
|
|
831
|
+
* geometry. Compare with TimelineCanvas (default 20px bars).
|
|
832
|
+
*/
|
|
833
|
+
export declare const TimelineThemed: () => React_2.JSX.Element;
|
|
834
|
+
|
|
835
|
+
/** @deprecated renamed to TimelineProps in 0.2.0 */
|
|
836
|
+
declare type TimelineType = TimelineProps;
|
|
837
|
+
export { TimelineType }
|
|
838
|
+
export { TimelineType as TimelineType_alias_1 }
|
|
839
|
+
|
|
840
|
+
export declare const timeToWidth: (startTime: number, endTime: number, tick: number) => number;
|
|
841
|
+
|
|
842
|
+
export declare const timeToX: (time: number, windowStart: number, tick: number) => number;
|
|
843
|
+
|
|
844
|
+
declare type UseCanvasInteractionsArgs = {
|
|
845
|
+
scene: SceneStore;
|
|
846
|
+
rendererRef: React_2.MutableRefObject<TimelineRenderer | null>;
|
|
847
|
+
dynamicCanvasRef: React_2.MutableRefObject<HTMLCanvasElement | null>;
|
|
848
|
+
bodyRef: React_2.MutableRefObject<HTMLDivElement | null>;
|
|
849
|
+
ghostRef: React_2.MutableRefObject<HTMLDivElement | null>;
|
|
850
|
+
eventPromptRef: React_2.MutableRefObject<EventPromptActionsType | null>;
|
|
851
|
+
setWindowTime: React_2.Dispatch<React_2.SetStateAction<number[]>>;
|
|
852
|
+
setCellWidth: React_2.Dispatch<React_2.SetStateAction<number>>;
|
|
853
|
+
setTick: React_2.Dispatch<React_2.SetStateAction<number | null>>;
|
|
854
|
+
onDrop?: (props: OnDropProps) => void;
|
|
855
|
+
onResize?: (props: OnResizeProps) => void;
|
|
856
|
+
onEventClick?: (props: OnEventClickProps) => void;
|
|
857
|
+
onEventHover?: (props: OnEventHoverProps) => void;
|
|
858
|
+
eventsResize: boolean;
|
|
859
|
+
panZoom?: PanZoomConfig;
|
|
860
|
+
};
|
|
861
|
+
|
|
862
|
+
/** Notifies when devicePixelRatio changes (browser zoom, monitor switch). */
|
|
863
|
+
export declare const watchDpr: (onChange: (dpr: number) => void) => (() => void);
|
|
864
|
+
|
|
865
|
+
export declare const xToTime: (x: number, windowStart: number, tick: number) => number;
|
|
866
|
+
|
|
867
|
+
export declare type ZoomLimits = {
|
|
868
|
+
minWindowSeconds: number;
|
|
869
|
+
maxWindowSeconds: number;
|
|
870
|
+
};
|
|
871
|
+
|
|
872
|
+
export { }
|