awesome-timeline-react 0.13.0 → 0.14.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/README.md +26 -0
- package/dist/_tsup-dts-rollup.d.mts +93 -2
- package/dist/_tsup-dts-rollup.d.ts +93 -2
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +259 -70
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +259 -70
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -130,6 +130,10 @@ CSS classes cannot style canvas pixels, so canvas-drawn elements are themed with
|
|
|
130
130
|
gridColor: "#e4dcdc",
|
|
131
131
|
timeBarBorder: "yellow",
|
|
132
132
|
timeBarTextColor: "white",
|
|
133
|
+
// since 0.13.0, unset by default: fill the time bar's two rows apart
|
|
134
|
+
timeBarTopBackground: "#272424",
|
|
135
|
+
timeBarBottomBackground: "#3b3737",
|
|
136
|
+
timeBarBottomTextColor: "#d6d0d0", // unset, timeBarTextColor
|
|
133
137
|
// selection visuals (see Selection)
|
|
134
138
|
dimmedOpacity: 0.35, // opacity of non-selected events while a selection is active
|
|
135
139
|
selectionShadowColor: "rgba(0,0,0,0.35)", // lift shadow of selected events
|
|
@@ -184,6 +188,28 @@ always operate on the single grabbed event, regardless of how many are selected.
|
|
|
184
188
|
> Follow-ups not yet implemented: rubber-band rectangle selection, group-drag
|
|
185
189
|
> (moving a whole selection together), and a controlled `selectedEventIds` prop.
|
|
186
190
|
|
|
191
|
+
## Links
|
|
192
|
+
|
|
193
|
+
`links` draws a line from the end of one event to the start of another, with an
|
|
194
|
+
arrowhead, above the bars and under the selected ones. A target that starts
|
|
195
|
+
before its source ends is reached around the corner.
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
const links: LinkType[] = [
|
|
199
|
+
{ id: "a1-a2", fromEventId: "a1", toEventId: "a2" },
|
|
200
|
+
{ id: "a2-a3", fromEventId: "a2", toEventId: "a3", style: { stroke: "#e65100", dash: [4, 3] } },
|
|
201
|
+
];
|
|
202
|
+
|
|
203
|
+
<Timeline links={links} onLinkReveal={(eventId) => …} … />
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
When one end of a link is scrolled above or below the view while the other is
|
|
207
|
+
in it, a marker at that edge names it (its `props.label`). Clicking the marker
|
|
208
|
+
scrolls its row into view, pans the window when the event is off it, and fires
|
|
209
|
+
`onLinkReveal(eventId)`. Colours come from `theme.linkColor`, `theme.linkWidth`
|
|
210
|
+
and `theme.linkMarkerTextColor`. Pass only the links you want shown, e.g. those
|
|
211
|
+
of the selected group.
|
|
212
|
+
|
|
187
213
|
## Grouped (collapsible) rows
|
|
188
214
|
|
|
189
215
|
Rows can be nested one level: give a row a `parentId` to make it a **child** of a
|
|
@@ -65,6 +65,8 @@ declare type CanvasBoardProps = {
|
|
|
65
65
|
onEventHover?: (props: OnEventHoverProps) => void;
|
|
66
66
|
eventsResize: boolean;
|
|
67
67
|
stripeOverlap: boolean;
|
|
68
|
+
links: LinkType[];
|
|
69
|
+
onLinkReveal?: (eventId: string) => void;
|
|
68
70
|
timeBar?: TimeBarConfig;
|
|
69
71
|
panZoom?: PanZoomConfig;
|
|
70
72
|
animations: {
|
|
@@ -204,7 +206,7 @@ export declare const default_alias_8: (eventA: EventType, eventB: EventType) =>
|
|
|
204
206
|
* change grid granularity (middle-click mode or ctrl+wheel). Event mutations
|
|
205
207
|
* are applied straight to the SceneStore — no React state on the hot path.
|
|
206
208
|
*/
|
|
207
|
-
export declare const default_alias_9: ({ scene, rendererRef, dynamicCanvasRef, bodyRef, ghostRef, eventPromptRef, setWindowTime, setCellWidth, setTick, onDrop, onResize, onEventClick, onEventHover, eventsResize, panZoom, selectable, applySelection, getSelection, }: UseCanvasInteractionsArgs) => {
|
|
209
|
+
export declare const default_alias_9: ({ scene, rendererRef, dynamicCanvasRef, bodyRef, ghostRef, eventPromptRef, setWindowTime, setCellWidth, setTick, onDrop, onResize, onEventClick, onEventHover, onLinkReveal, eventsResize, panZoom, selectable, applySelection, getSelection, }: UseCanvasInteractionsArgs) => {
|
|
208
210
|
handlePointerDown: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
209
211
|
handlePointerMove: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
210
212
|
handlePointerUp: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
@@ -251,7 +253,7 @@ export { DrawEventFn as DrawEventFn_alias_1 }
|
|
|
251
253
|
* the vertical viewport are skipped without touching their events. Custom
|
|
252
254
|
* renderers resolve per-event drawEvent -> Timeline drawEvent -> default.
|
|
253
255
|
*/
|
|
254
|
-
export declare const drawEvents: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, font: string, animator: LayoutAnimator) => void;
|
|
256
|
+
export declare const drawEvents: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, font: string, animator: LayoutAnimator, beforeSelected?: () => void) => void;
|
|
255
257
|
|
|
256
258
|
/**
|
|
257
259
|
* Vertical grid lines, one per grid cell (`cellWidth` px == `cellWidth * tick`
|
|
@@ -277,6 +279,9 @@ export declare const drawGridLines: (ctx: CanvasRenderingContext2D, { width, hei
|
|
|
277
279
|
*/
|
|
278
280
|
export declare const drawGroupShading: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore) => void;
|
|
279
281
|
|
|
282
|
+
/** The view's links and their edge markers; returns the markers so a click can find them. */
|
|
283
|
+
export declare const drawLinks: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, font: string) => LinkMarker[];
|
|
284
|
+
|
|
280
285
|
/** Horizontal row dividers — replaces .row-content border-bottom. */
|
|
281
286
|
export declare const drawRowDividers: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore) => void;
|
|
282
287
|
|
|
@@ -387,6 +392,9 @@ declare type EventPropsType = {
|
|
|
387
392
|
export { EventPropsType }
|
|
388
393
|
export { EventPropsType as EventPropsType_alias_1 }
|
|
389
394
|
|
|
395
|
+
/** An event's bar in viewport px, scroll applied; null when the event is unknown or its row is hidden. */
|
|
396
|
+
export declare const eventRect: (scene: SceneStore, offsetOf: Map<string, number>, eventId: string, view: Pick<LinkView, "windowStart" | "tick" | "scrollTop">) => Rect | null;
|
|
397
|
+
|
|
390
398
|
/** Interaction state passed to custom drawEvent renderers. */
|
|
391
399
|
declare type EventState = {
|
|
392
400
|
hovered: boolean;
|
|
@@ -586,6 +594,54 @@ export declare class LayoutAnimator {
|
|
|
586
594
|
private current;
|
|
587
595
|
}
|
|
588
596
|
|
|
597
|
+
/** A marker at the top or bottom edge naming a linked event that is scrolled out of view. */
|
|
598
|
+
export declare type LinkMarker = {
|
|
599
|
+
eventId: string;
|
|
600
|
+
up: boolean;
|
|
601
|
+
label: string;
|
|
602
|
+
rect: Rect;
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Edge markers for the linked events that are scrolled above or below the view while the event they
|
|
607
|
+
* link to is in it, one per event, laid left to right along each edge without overlapping.
|
|
608
|
+
*/
|
|
609
|
+
export declare const linkMarkers: (scene: SceneStore, links: LinkType[], rectOf: (id: string) => Rect | null, view: Pick<LinkView, "width" | "height">, measure: (text: string) => number) => LinkMarker[];
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* The line from the end of `from` to the start of `to`, as the corners of an orthogonal path: out of
|
|
613
|
+
* the source's end, up or down to the target's row, into the target's start. A target that starts
|
|
614
|
+
* before the source ends (an overlap) is reached around the corner, through the gap between them.
|
|
615
|
+
*/
|
|
616
|
+
export declare const linkRoute: (from: Rect, to: Rect, stub?: number) => [number, number][];
|
|
617
|
+
|
|
618
|
+
/** A line from the end of one event to the start of another (a step that follows another). When one
|
|
619
|
+
* end is scrolled out of view, a marker at the edge names it; clicking the marker reveals it. */
|
|
620
|
+
declare type LinkType = {
|
|
621
|
+
id: string;
|
|
622
|
+
fromEventId: string;
|
|
623
|
+
toEventId: string;
|
|
624
|
+
style?: {
|
|
625
|
+
stroke?: string;
|
|
626
|
+
strokeWidth?: number;
|
|
627
|
+
dash?: number[];
|
|
628
|
+
};
|
|
629
|
+
};
|
|
630
|
+
export { LinkType }
|
|
631
|
+
export { LinkType as LinkType_alias_1 }
|
|
632
|
+
|
|
633
|
+
export declare type LinkView = {
|
|
634
|
+
windowStart: number;
|
|
635
|
+
tick: number;
|
|
636
|
+
scrollTop: number;
|
|
637
|
+
width: number;
|
|
638
|
+
height: number;
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
export declare const MARKER_HEIGHT = 20;
|
|
642
|
+
|
|
643
|
+
export declare const markerAt: (markers: LinkMarker[], x: number, y: number) => LinkMarker | null;
|
|
644
|
+
|
|
589
645
|
export declare type ModifableElements = {
|
|
590
646
|
timeBar: string;
|
|
591
647
|
dayRow: string;
|
|
@@ -696,6 +752,7 @@ export declare type RendererView = {
|
|
|
696
752
|
draggedEventId: string | null;
|
|
697
753
|
resizePreview: ResizePreview | null;
|
|
698
754
|
selectedEventIds: ReadonlySet<string>;
|
|
755
|
+
links: LinkType[];
|
|
699
756
|
};
|
|
700
757
|
|
|
701
758
|
export declare type ResizePreview = {
|
|
@@ -713,6 +770,8 @@ export declare const resolveTheme: (theme?: Theme) => ResolvedTheme;
|
|
|
713
770
|
/** The two rows `timeBar` draws at this zoom. */
|
|
714
771
|
export declare const resolveTimeBar: (timeBar: TimeBarConfig | undefined, windowStart: number, windowEnd: number, tick: number | null) => TimeBarLevel;
|
|
715
772
|
|
|
773
|
+
export declare const roundedRect: (ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number) => void;
|
|
774
|
+
|
|
716
775
|
export declare const rowMinHeight: (highestLane: number, g?: Geometry) => number;
|
|
717
776
|
|
|
718
777
|
declare type RowType = {
|
|
@@ -920,6 +979,12 @@ declare type Theme = {
|
|
|
920
979
|
pointerLineColor?: string;
|
|
921
980
|
/** the pointer time label's text (default "#ffffff") */
|
|
922
981
|
pointerLabelColor?: string;
|
|
982
|
+
/** a link's line, arrowhead and edge marker (default "#2563eb") */
|
|
983
|
+
linkColor?: string;
|
|
984
|
+
/** a link's line width in px (default 2) */
|
|
985
|
+
linkWidth?: number;
|
|
986
|
+
/** the text on a link's edge marker (default "#ffffff") */
|
|
987
|
+
linkMarkerTextColor?: string;
|
|
923
988
|
};
|
|
924
989
|
export { Theme }
|
|
925
990
|
export { Theme as Theme_alias_1 }
|
|
@@ -1082,6 +1147,16 @@ export { TimelineHandle as TimelineHandle_alias_1 }
|
|
|
1082
1147
|
*/
|
|
1083
1148
|
export declare const TimelineLaneStacking: () => React_2.JSX.Element;
|
|
1084
1149
|
|
|
1150
|
+
/**
|
|
1151
|
+
* Links: `links` draws a line from the end of one event to the start of another, above the bars and
|
|
1152
|
+
* under the selected ones. Here each chain is a group (`props.groupId`) of steps on tracks far apart;
|
|
1153
|
+
* Cmd/Ctrl+click a step to select its chain, and the chain's links are drawn. Scroll a chain's other
|
|
1154
|
+
* steps out of view: a marker at the top or bottom edge names each one, and clicking it scrolls there
|
|
1155
|
+
* (and pans the window when the step is off it). Chain C's second step starts before its first ends,
|
|
1156
|
+
* so its line goes around the corner.
|
|
1157
|
+
*/
|
|
1158
|
+
export declare const TimelineLinks: () => React_2.JSX.Element;
|
|
1159
|
+
|
|
1085
1160
|
/**
|
|
1086
1161
|
* Long row labels: names that exceed the 100px header width wrap to multiple
|
|
1087
1162
|
* lines, stay centered, and grow the row height (and its canvas dividers) to
|
|
@@ -1091,6 +1166,14 @@ export declare const TimelineLaneStacking: () => React_2.JSX.Element;
|
|
|
1091
1166
|
*/
|
|
1092
1167
|
export declare const TimelineLongRowLabels: () => React_2.JSX.Element;
|
|
1093
1168
|
|
|
1169
|
+
/**
|
|
1170
|
+
* Long bars running across two months of unavailable bands (every night 22:00–06:00 and every
|
|
1171
|
+
* weekend), with `stripeOverlap` on. "Auto-pan" scrolls the window by a fixed step for 120 frames and
|
|
1172
|
+
* reports the mean frame time, so one pan can be compared across: the first long bar selected or not,
|
|
1173
|
+
* a long bar on every track or only the first, and a second timeline kept in step below.
|
|
1174
|
+
*/
|
|
1175
|
+
export declare const TimelineLongStripedBar: () => React_2.JSX.Element;
|
|
1176
|
+
|
|
1094
1177
|
/**
|
|
1095
1178
|
* A small, sub-day window (~6h). With a window narrower than a day the time
|
|
1096
1179
|
* bar must still track the hour labels to the actual time as you pan — pan the
|
|
@@ -1171,6 +1254,10 @@ declare type TimelineProps = {
|
|
|
1171
1254
|
onPointerTime?: (time: number | null) => void;
|
|
1172
1255
|
/** layout animations: true (default), false to disable, or durations */
|
|
1173
1256
|
animations?: AnimationConfig;
|
|
1257
|
+
/** lines between events, drawn above the bars and under the selected ones */
|
|
1258
|
+
links?: LinkType[];
|
|
1259
|
+
/** fires when a link's edge marker is clicked, after the timeline has scrolled to that event */
|
|
1260
|
+
onLinkReveal?: (eventId: string) => void;
|
|
1174
1261
|
};
|
|
1175
1262
|
export { TimelineProps }
|
|
1176
1263
|
export { TimelineProps as TimelineProps_alias_1 }
|
|
@@ -1190,6 +1277,7 @@ export declare class TimelineRenderer {
|
|
|
1190
1277
|
private dynamicCanvas;
|
|
1191
1278
|
private scene;
|
|
1192
1279
|
private view;
|
|
1280
|
+
private linkMarkers;
|
|
1193
1281
|
readonly animator: LayoutAnimator;
|
|
1194
1282
|
private scheduler;
|
|
1195
1283
|
private unsubscribeScene;
|
|
@@ -1198,6 +1286,8 @@ export declare class TimelineRenderer {
|
|
|
1198
1286
|
private font;
|
|
1199
1287
|
constructor(staticCanvas: HTMLCanvasElement, dynamicCanvas: HTMLCanvasElement, scene: SceneStore);
|
|
1200
1288
|
getView(): RendererView;
|
|
1289
|
+
/** the link edge markers as last drawn, in viewport px */
|
|
1290
|
+
getLinkMarkers(): LinkMarker[];
|
|
1201
1291
|
setView(partial: Partial<RendererView>): void;
|
|
1202
1292
|
invalidate(layer: Layer | "all"): void;
|
|
1203
1293
|
/** Force a synchronous draw of anything pending (tests, screenshots). */
|
|
@@ -1294,6 +1384,7 @@ declare type UseCanvasInteractionsArgs = {
|
|
|
1294
1384
|
onResize?: (props: OnResizeProps) => void;
|
|
1295
1385
|
onEventClick?: (props: OnEventClickProps) => void;
|
|
1296
1386
|
onEventHover?: (props: OnEventHoverProps) => void;
|
|
1387
|
+
onLinkReveal?: (eventId: string) => void;
|
|
1297
1388
|
eventsResize: boolean;
|
|
1298
1389
|
panZoom?: PanZoomConfig;
|
|
1299
1390
|
selectable: boolean;
|
|
@@ -65,6 +65,8 @@ declare type CanvasBoardProps = {
|
|
|
65
65
|
onEventHover?: (props: OnEventHoverProps) => void;
|
|
66
66
|
eventsResize: boolean;
|
|
67
67
|
stripeOverlap: boolean;
|
|
68
|
+
links: LinkType[];
|
|
69
|
+
onLinkReveal?: (eventId: string) => void;
|
|
68
70
|
timeBar?: TimeBarConfig;
|
|
69
71
|
panZoom?: PanZoomConfig;
|
|
70
72
|
animations: {
|
|
@@ -204,7 +206,7 @@ export declare const default_alias_8: (eventA: EventType, eventB: EventType) =>
|
|
|
204
206
|
* change grid granularity (middle-click mode or ctrl+wheel). Event mutations
|
|
205
207
|
* are applied straight to the SceneStore — no React state on the hot path.
|
|
206
208
|
*/
|
|
207
|
-
export declare const default_alias_9: ({ scene, rendererRef, dynamicCanvasRef, bodyRef, ghostRef, eventPromptRef, setWindowTime, setCellWidth, setTick, onDrop, onResize, onEventClick, onEventHover, eventsResize, panZoom, selectable, applySelection, getSelection, }: UseCanvasInteractionsArgs) => {
|
|
209
|
+
export declare const default_alias_9: ({ scene, rendererRef, dynamicCanvasRef, bodyRef, ghostRef, eventPromptRef, setWindowTime, setCellWidth, setTick, onDrop, onResize, onEventClick, onEventHover, onLinkReveal, eventsResize, panZoom, selectable, applySelection, getSelection, }: UseCanvasInteractionsArgs) => {
|
|
208
210
|
handlePointerDown: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
209
211
|
handlePointerMove: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
210
212
|
handlePointerUp: (pointerEvent: React_2.PointerEvent<HTMLCanvasElement>) => void;
|
|
@@ -251,7 +253,7 @@ export { DrawEventFn as DrawEventFn_alias_1 }
|
|
|
251
253
|
* the vertical viewport are skipped without touching their events. Custom
|
|
252
254
|
* renderers resolve per-event drawEvent -> Timeline drawEvent -> default.
|
|
253
255
|
*/
|
|
254
|
-
export declare const drawEvents: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, font: string, animator: LayoutAnimator) => void;
|
|
256
|
+
export declare const drawEvents: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, font: string, animator: LayoutAnimator, beforeSelected?: () => void) => void;
|
|
255
257
|
|
|
256
258
|
/**
|
|
257
259
|
* Vertical grid lines, one per grid cell (`cellWidth` px == `cellWidth * tick`
|
|
@@ -277,6 +279,9 @@ export declare const drawGridLines: (ctx: CanvasRenderingContext2D, { width, hei
|
|
|
277
279
|
*/
|
|
278
280
|
export declare const drawGroupShading: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore) => void;
|
|
279
281
|
|
|
282
|
+
/** The view's links and their edge markers; returns the markers so a click can find them. */
|
|
283
|
+
export declare const drawLinks: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore, font: string) => LinkMarker[];
|
|
284
|
+
|
|
280
285
|
/** Horizontal row dividers — replaces .row-content border-bottom. */
|
|
281
286
|
export declare const drawRowDividers: (ctx: CanvasRenderingContext2D, view: RendererView, scene: SceneStore) => void;
|
|
282
287
|
|
|
@@ -387,6 +392,9 @@ declare type EventPropsType = {
|
|
|
387
392
|
export { EventPropsType }
|
|
388
393
|
export { EventPropsType as EventPropsType_alias_1 }
|
|
389
394
|
|
|
395
|
+
/** An event's bar in viewport px, scroll applied; null when the event is unknown or its row is hidden. */
|
|
396
|
+
export declare const eventRect: (scene: SceneStore, offsetOf: Map<string, number>, eventId: string, view: Pick<LinkView, "windowStart" | "tick" | "scrollTop">) => Rect | null;
|
|
397
|
+
|
|
390
398
|
/** Interaction state passed to custom drawEvent renderers. */
|
|
391
399
|
declare type EventState = {
|
|
392
400
|
hovered: boolean;
|
|
@@ -586,6 +594,54 @@ export declare class LayoutAnimator {
|
|
|
586
594
|
private current;
|
|
587
595
|
}
|
|
588
596
|
|
|
597
|
+
/** A marker at the top or bottom edge naming a linked event that is scrolled out of view. */
|
|
598
|
+
export declare type LinkMarker = {
|
|
599
|
+
eventId: string;
|
|
600
|
+
up: boolean;
|
|
601
|
+
label: string;
|
|
602
|
+
rect: Rect;
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Edge markers for the linked events that are scrolled above or below the view while the event they
|
|
607
|
+
* link to is in it, one per event, laid left to right along each edge without overlapping.
|
|
608
|
+
*/
|
|
609
|
+
export declare const linkMarkers: (scene: SceneStore, links: LinkType[], rectOf: (id: string) => Rect | null, view: Pick<LinkView, "width" | "height">, measure: (text: string) => number) => LinkMarker[];
|
|
610
|
+
|
|
611
|
+
/**
|
|
612
|
+
* The line from the end of `from` to the start of `to`, as the corners of an orthogonal path: out of
|
|
613
|
+
* the source's end, up or down to the target's row, into the target's start. A target that starts
|
|
614
|
+
* before the source ends (an overlap) is reached around the corner, through the gap between them.
|
|
615
|
+
*/
|
|
616
|
+
export declare const linkRoute: (from: Rect, to: Rect, stub?: number) => [number, number][];
|
|
617
|
+
|
|
618
|
+
/** A line from the end of one event to the start of another (a step that follows another). When one
|
|
619
|
+
* end is scrolled out of view, a marker at the edge names it; clicking the marker reveals it. */
|
|
620
|
+
declare type LinkType = {
|
|
621
|
+
id: string;
|
|
622
|
+
fromEventId: string;
|
|
623
|
+
toEventId: string;
|
|
624
|
+
style?: {
|
|
625
|
+
stroke?: string;
|
|
626
|
+
strokeWidth?: number;
|
|
627
|
+
dash?: number[];
|
|
628
|
+
};
|
|
629
|
+
};
|
|
630
|
+
export { LinkType }
|
|
631
|
+
export { LinkType as LinkType_alias_1 }
|
|
632
|
+
|
|
633
|
+
export declare type LinkView = {
|
|
634
|
+
windowStart: number;
|
|
635
|
+
tick: number;
|
|
636
|
+
scrollTop: number;
|
|
637
|
+
width: number;
|
|
638
|
+
height: number;
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
export declare const MARKER_HEIGHT = 20;
|
|
642
|
+
|
|
643
|
+
export declare const markerAt: (markers: LinkMarker[], x: number, y: number) => LinkMarker | null;
|
|
644
|
+
|
|
589
645
|
export declare type ModifableElements = {
|
|
590
646
|
timeBar: string;
|
|
591
647
|
dayRow: string;
|
|
@@ -696,6 +752,7 @@ export declare type RendererView = {
|
|
|
696
752
|
draggedEventId: string | null;
|
|
697
753
|
resizePreview: ResizePreview | null;
|
|
698
754
|
selectedEventIds: ReadonlySet<string>;
|
|
755
|
+
links: LinkType[];
|
|
699
756
|
};
|
|
700
757
|
|
|
701
758
|
export declare type ResizePreview = {
|
|
@@ -713,6 +770,8 @@ export declare const resolveTheme: (theme?: Theme) => ResolvedTheme;
|
|
|
713
770
|
/** The two rows `timeBar` draws at this zoom. */
|
|
714
771
|
export declare const resolveTimeBar: (timeBar: TimeBarConfig | undefined, windowStart: number, windowEnd: number, tick: number | null) => TimeBarLevel;
|
|
715
772
|
|
|
773
|
+
export declare const roundedRect: (ctx: CanvasRenderingContext2D, x: number, y: number, width: number, height: number, radius: number) => void;
|
|
774
|
+
|
|
716
775
|
export declare const rowMinHeight: (highestLane: number, g?: Geometry) => number;
|
|
717
776
|
|
|
718
777
|
declare type RowType = {
|
|
@@ -920,6 +979,12 @@ declare type Theme = {
|
|
|
920
979
|
pointerLineColor?: string;
|
|
921
980
|
/** the pointer time label's text (default "#ffffff") */
|
|
922
981
|
pointerLabelColor?: string;
|
|
982
|
+
/** a link's line, arrowhead and edge marker (default "#2563eb") */
|
|
983
|
+
linkColor?: string;
|
|
984
|
+
/** a link's line width in px (default 2) */
|
|
985
|
+
linkWidth?: number;
|
|
986
|
+
/** the text on a link's edge marker (default "#ffffff") */
|
|
987
|
+
linkMarkerTextColor?: string;
|
|
923
988
|
};
|
|
924
989
|
export { Theme }
|
|
925
990
|
export { Theme as Theme_alias_1 }
|
|
@@ -1082,6 +1147,16 @@ export { TimelineHandle as TimelineHandle_alias_1 }
|
|
|
1082
1147
|
*/
|
|
1083
1148
|
export declare const TimelineLaneStacking: () => React_2.JSX.Element;
|
|
1084
1149
|
|
|
1150
|
+
/**
|
|
1151
|
+
* Links: `links` draws a line from the end of one event to the start of another, above the bars and
|
|
1152
|
+
* under the selected ones. Here each chain is a group (`props.groupId`) of steps on tracks far apart;
|
|
1153
|
+
* Cmd/Ctrl+click a step to select its chain, and the chain's links are drawn. Scroll a chain's other
|
|
1154
|
+
* steps out of view: a marker at the top or bottom edge names each one, and clicking it scrolls there
|
|
1155
|
+
* (and pans the window when the step is off it). Chain C's second step starts before its first ends,
|
|
1156
|
+
* so its line goes around the corner.
|
|
1157
|
+
*/
|
|
1158
|
+
export declare const TimelineLinks: () => React_2.JSX.Element;
|
|
1159
|
+
|
|
1085
1160
|
/**
|
|
1086
1161
|
* Long row labels: names that exceed the 100px header width wrap to multiple
|
|
1087
1162
|
* lines, stay centered, and grow the row height (and its canvas dividers) to
|
|
@@ -1091,6 +1166,14 @@ export declare const TimelineLaneStacking: () => React_2.JSX.Element;
|
|
|
1091
1166
|
*/
|
|
1092
1167
|
export declare const TimelineLongRowLabels: () => React_2.JSX.Element;
|
|
1093
1168
|
|
|
1169
|
+
/**
|
|
1170
|
+
* Long bars running across two months of unavailable bands (every night 22:00–06:00 and every
|
|
1171
|
+
* weekend), with `stripeOverlap` on. "Auto-pan" scrolls the window by a fixed step for 120 frames and
|
|
1172
|
+
* reports the mean frame time, so one pan can be compared across: the first long bar selected or not,
|
|
1173
|
+
* a long bar on every track or only the first, and a second timeline kept in step below.
|
|
1174
|
+
*/
|
|
1175
|
+
export declare const TimelineLongStripedBar: () => React_2.JSX.Element;
|
|
1176
|
+
|
|
1094
1177
|
/**
|
|
1095
1178
|
* A small, sub-day window (~6h). With a window narrower than a day the time
|
|
1096
1179
|
* bar must still track the hour labels to the actual time as you pan — pan the
|
|
@@ -1171,6 +1254,10 @@ declare type TimelineProps = {
|
|
|
1171
1254
|
onPointerTime?: (time: number | null) => void;
|
|
1172
1255
|
/** layout animations: true (default), false to disable, or durations */
|
|
1173
1256
|
animations?: AnimationConfig;
|
|
1257
|
+
/** lines between events, drawn above the bars and under the selected ones */
|
|
1258
|
+
links?: LinkType[];
|
|
1259
|
+
/** fires when a link's edge marker is clicked, after the timeline has scrolled to that event */
|
|
1260
|
+
onLinkReveal?: (eventId: string) => void;
|
|
1174
1261
|
};
|
|
1175
1262
|
export { TimelineProps }
|
|
1176
1263
|
export { TimelineProps as TimelineProps_alias_1 }
|
|
@@ -1190,6 +1277,7 @@ export declare class TimelineRenderer {
|
|
|
1190
1277
|
private dynamicCanvas;
|
|
1191
1278
|
private scene;
|
|
1192
1279
|
private view;
|
|
1280
|
+
private linkMarkers;
|
|
1193
1281
|
readonly animator: LayoutAnimator;
|
|
1194
1282
|
private scheduler;
|
|
1195
1283
|
private unsubscribeScene;
|
|
@@ -1198,6 +1286,8 @@ export declare class TimelineRenderer {
|
|
|
1198
1286
|
private font;
|
|
1199
1287
|
constructor(staticCanvas: HTMLCanvasElement, dynamicCanvas: HTMLCanvasElement, scene: SceneStore);
|
|
1200
1288
|
getView(): RendererView;
|
|
1289
|
+
/** the link edge markers as last drawn, in viewport px */
|
|
1290
|
+
getLinkMarkers(): LinkMarker[];
|
|
1201
1291
|
setView(partial: Partial<RendererView>): void;
|
|
1202
1292
|
invalidate(layer: Layer | "all"): void;
|
|
1203
1293
|
/** Force a synchronous draw of anything pending (tests, screenshots). */
|
|
@@ -1294,6 +1384,7 @@ declare type UseCanvasInteractionsArgs = {
|
|
|
1294
1384
|
onResize?: (props: OnResizeProps) => void;
|
|
1295
1385
|
onEventClick?: (props: OnEventClickProps) => void;
|
|
1296
1386
|
onEventHover?: (props: OnEventHoverProps) => void;
|
|
1387
|
+
onLinkReveal?: (eventId: string) => void;
|
|
1297
1388
|
eventsResize: boolean;
|
|
1298
1389
|
panZoom?: PanZoomConfig;
|
|
1299
1390
|
selectable: boolean;
|
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,7 @@ export { TimeBarLevel } from './_tsup-dts-rollup.mjs';
|
|
|
19
19
|
export { TimeBarRowConfig } from './_tsup-dts-rollup.mjs';
|
|
20
20
|
export { TimeBarUnit } from './_tsup-dts-rollup.mjs';
|
|
21
21
|
export { EventPatch } from './_tsup-dts-rollup.mjs';
|
|
22
|
+
export { LinkType } from './_tsup-dts-rollup.mjs';
|
|
22
23
|
export { TimelineHandle } from './_tsup-dts-rollup.mjs';
|
|
23
24
|
export { TimelineProps } from './_tsup-dts-rollup.mjs';
|
|
24
25
|
export { TimelineType } from './_tsup-dts-rollup.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export { TimeBarLevel } from './_tsup-dts-rollup.js';
|
|
|
19
19
|
export { TimeBarRowConfig } from './_tsup-dts-rollup.js';
|
|
20
20
|
export { TimeBarUnit } from './_tsup-dts-rollup.js';
|
|
21
21
|
export { EventPatch } from './_tsup-dts-rollup.js';
|
|
22
|
+
export { LinkType } from './_tsup-dts-rollup.js';
|
|
22
23
|
export { TimelineHandle } from './_tsup-dts-rollup.js';
|
|
23
24
|
export { TimelineProps } from './_tsup-dts-rollup.js';
|
|
24
25
|
export { TimelineType } from './_tsup-dts-rollup.js';
|