awesome-timeline-react 0.10.0 → 0.11.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 +7 -1
- package/dist/_tsup-dts-rollup.d.mts +57 -12
- package/dist/_tsup-dts-rollup.d.ts +57 -12
- package/dist/index.css +22 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +183 -62
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +185 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -19,12 +19,12 @@ var __spreadValues = (a, b) => {
|
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
20
|
|
|
21
21
|
// src/timeline.tsx
|
|
22
|
-
import
|
|
23
|
-
forwardRef as
|
|
22
|
+
import React7, {
|
|
23
|
+
forwardRef as forwardRef4,
|
|
24
24
|
useCallback as useCallback3,
|
|
25
25
|
useEffect as useEffect6,
|
|
26
|
-
useImperativeHandle as
|
|
27
|
-
useMemo as
|
|
26
|
+
useImperativeHandle as useImperativeHandle3,
|
|
27
|
+
useMemo as useMemo2,
|
|
28
28
|
useRef as useRef7,
|
|
29
29
|
useState as useState4
|
|
30
30
|
} from "react";
|
|
@@ -103,35 +103,41 @@ var LayoutAnimator = class {
|
|
|
103
103
|
};
|
|
104
104
|
|
|
105
105
|
// src/hooks/use-resize-observer.ts
|
|
106
|
-
import { useEffect
|
|
106
|
+
import { useEffect } from "react";
|
|
107
|
+
var createWidthObserver = (getWindow, onScale) => {
|
|
108
|
+
let prevWidth = 0;
|
|
109
|
+
return new ResizeObserver((entries) => {
|
|
110
|
+
var _a;
|
|
111
|
+
for (const entry of entries) {
|
|
112
|
+
const width = (_a = entry.borderBoxSize) == null ? void 0 : _a[0].inlineSize;
|
|
113
|
+
if (typeof width === "number" && width !== prevWidth) {
|
|
114
|
+
prevWidth = width;
|
|
115
|
+
const [start, end] = getWindow();
|
|
116
|
+
const windowDuration = end - start;
|
|
117
|
+
onScale(
|
|
118
|
+
windowDuration / entry.contentRect.width,
|
|
119
|
+
entry.contentRect.width / (windowDuration / 3600)
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
};
|
|
107
125
|
var useResizeObserver = ({
|
|
108
|
-
|
|
126
|
+
windowTimeRef,
|
|
109
127
|
setTick,
|
|
110
128
|
setCellWidth,
|
|
111
129
|
contentRef
|
|
112
130
|
}) => {
|
|
113
|
-
const prevWidthRef = useRef(0);
|
|
114
|
-
const resizeObserver = useMemo(() => {
|
|
115
|
-
return new ResizeObserver((entries) => {
|
|
116
|
-
var _a;
|
|
117
|
-
for (const entry of entries) {
|
|
118
|
-
const width = (_a = entry.borderBoxSize) == null ? void 0 : _a[0].inlineSize;
|
|
119
|
-
if (typeof width === "number" && width !== prevWidthRef.current) {
|
|
120
|
-
prevWidthRef.current = width;
|
|
121
|
-
const windowDuration = windowTime[1] - windowTime[0];
|
|
122
|
-
const numberOfHourBlocks = windowDuration / 3600;
|
|
123
|
-
setTick(windowDuration / entry.contentRect.width);
|
|
124
|
-
setCellWidth(entry.contentRect.width / numberOfHourBlocks);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
}, [windowTime]);
|
|
129
131
|
useEffect(() => {
|
|
132
|
+
const observer = createWidthObserver(() => windowTimeRef.current, (tick, cellWidth) => {
|
|
133
|
+
setTick(tick);
|
|
134
|
+
setCellWidth(cellWidth);
|
|
135
|
+
});
|
|
130
136
|
if (contentRef.current) {
|
|
131
|
-
|
|
137
|
+
observer.observe(contentRef.current, { box: "border-box" });
|
|
132
138
|
}
|
|
133
|
-
return () =>
|
|
134
|
-
}, [
|
|
139
|
+
return () => observer.disconnect();
|
|
140
|
+
}, [windowTimeRef, setTick, setCellWidth, contentRef]);
|
|
135
141
|
};
|
|
136
142
|
var use_resize_observer_default = useResizeObserver;
|
|
137
143
|
|
|
@@ -151,14 +157,14 @@ var sortEvents = (eventA, eventB) => {
|
|
|
151
157
|
var sort_events_default = sortEvents;
|
|
152
158
|
|
|
153
159
|
// src/components/rt-indicator.tsx
|
|
154
|
-
import React, { useEffect as useEffect2, useRef
|
|
160
|
+
import React, { useEffect as useEffect2, useRef, useState } from "react";
|
|
155
161
|
var RTIndicator = ({
|
|
156
162
|
tick,
|
|
157
163
|
windowTime
|
|
158
164
|
}) => {
|
|
159
165
|
const [currentTime, setCurrentTime] = useState((/* @__PURE__ */ new Date()).getTime() / 1e3);
|
|
160
166
|
const [leftOffset, setLeftOffset] = useState(0);
|
|
161
|
-
const intervalIdRef =
|
|
167
|
+
const intervalIdRef = useRef(null);
|
|
162
168
|
useEffect2(() => {
|
|
163
169
|
if (tick) {
|
|
164
170
|
const leftOffsetTime = currentTime - windowTime[0];
|
|
@@ -180,15 +186,15 @@ var rt_indicator_default = RTIndicator;
|
|
|
180
186
|
import React2, {
|
|
181
187
|
forwardRef,
|
|
182
188
|
useImperativeHandle,
|
|
183
|
-
useRef as
|
|
189
|
+
useRef as useRef2,
|
|
184
190
|
useState as useState2
|
|
185
191
|
} from "react";
|
|
186
192
|
import { computePosition, flip, offset, shift } from "@floating-ui/dom";
|
|
187
193
|
var EventPrompt = forwardRef(
|
|
188
194
|
({ template }, ref) => {
|
|
189
|
-
const promptRef =
|
|
195
|
+
const promptRef = useRef2(null);
|
|
190
196
|
const [hoveredEvent, setHoveredEvent] = useState2();
|
|
191
|
-
const showSeqRef =
|
|
197
|
+
const showSeqRef = useRef2(0);
|
|
192
198
|
useImperativeHandle(ref, () => {
|
|
193
199
|
return {
|
|
194
200
|
show(event, anchorRect) {
|
|
@@ -238,7 +244,7 @@ var EventPrompt = forwardRef(
|
|
|
238
244
|
var event_prompt_default = EventPrompt;
|
|
239
245
|
|
|
240
246
|
// src/components/canvas-time-bar.tsx
|
|
241
|
-
import React3, { useEffect as useEffect3, useRef as
|
|
247
|
+
import React3, { useEffect as useEffect3, useRef as useRef3 } from "react";
|
|
242
248
|
|
|
243
249
|
// src/helpers/get-month-name.ts
|
|
244
250
|
var getMonthName = (monthIndex) => {
|
|
@@ -449,7 +455,9 @@ var DEFAULT_THEME = {
|
|
|
449
455
|
barRadius: 5,
|
|
450
456
|
minHitWidth: 0,
|
|
451
457
|
groupChildBackground: "rgba(0,0,0,0.05)",
|
|
452
|
-
groupShadowColor: "rgba(0,0,0,0.22)"
|
|
458
|
+
groupShadowColor: "rgba(0,0,0,0.22)",
|
|
459
|
+
pointerLineColor: "rgba(15,23,42,0.7)",
|
|
460
|
+
pointerLabelColor: "#ffffff"
|
|
453
461
|
};
|
|
454
462
|
var resolveTheme = (theme) => __spreadValues(__spreadValues({}, DEFAULT_THEME), theme);
|
|
455
463
|
|
|
@@ -529,7 +537,8 @@ var drawTimeBar = (ctx, {
|
|
|
529
537
|
};
|
|
530
538
|
|
|
531
539
|
// src/components/canvas-time-bar.tsx
|
|
532
|
-
var
|
|
540
|
+
var TIME_BAR_HEIGHT = 50;
|
|
541
|
+
var TIME_BAR_INNER_HEIGHT = TIME_BAR_HEIGHT - 2;
|
|
533
542
|
var CanvasTimeBar = ({
|
|
534
543
|
windowTime,
|
|
535
544
|
tick,
|
|
@@ -539,7 +548,7 @@ var CanvasTimeBar = ({
|
|
|
539
548
|
timeBar
|
|
540
549
|
}) => {
|
|
541
550
|
var _a, _b, _c;
|
|
542
|
-
const canvasRef =
|
|
551
|
+
const canvasRef = useRef3(null);
|
|
543
552
|
const header = theme != null ? theme : DEFAULT_THEME;
|
|
544
553
|
const topRow = (_a = timeBar == null ? void 0 : timeBar.topRow) != null ? _a : { unit: "day" };
|
|
545
554
|
const bottomRow = (_b = timeBar == null ? void 0 : timeBar.bottomRow) != null ? _b : { unit: "hour" };
|
|
@@ -605,7 +614,7 @@ import React5, {
|
|
|
605
614
|
useCallback as useCallback2,
|
|
606
615
|
useEffect as useEffect5,
|
|
607
616
|
useLayoutEffect,
|
|
608
|
-
useRef as
|
|
617
|
+
useRef as useRef5,
|
|
609
618
|
useState as useState3,
|
|
610
619
|
useSyncExternalStore
|
|
611
620
|
} from "react";
|
|
@@ -1207,7 +1216,7 @@ var TimelineRenderer = class {
|
|
|
1207
1216
|
};
|
|
1208
1217
|
|
|
1209
1218
|
// src/hooks/use-canvas-interactions.ts
|
|
1210
|
-
import { useCallback, useEffect as useEffect4, useMemo
|
|
1219
|
+
import { useCallback, useEffect as useEffect4, useMemo, useRef as useRef4 } from "react";
|
|
1211
1220
|
|
|
1212
1221
|
// src/core/types.ts
|
|
1213
1222
|
var rectContains = (rect, x, y) => x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height;
|
|
@@ -1302,15 +1311,15 @@ var useCanvasInteractions = ({
|
|
|
1302
1311
|
applySelection,
|
|
1303
1312
|
getSelection
|
|
1304
1313
|
}) => {
|
|
1305
|
-
const stateRef =
|
|
1306
|
-
const changeGridRef =
|
|
1307
|
-
const panFrameRef =
|
|
1308
|
-
const panPendingDxRef =
|
|
1309
|
-
const hoveredRef =
|
|
1310
|
-
const pointersRef =
|
|
1311
|
-
const zoomFrameRef =
|
|
1312
|
-
const zoomPendingRef =
|
|
1313
|
-
const config =
|
|
1314
|
+
const stateRef = useRef4({ mode: "idle" });
|
|
1315
|
+
const changeGridRef = useRef4(false);
|
|
1316
|
+
const panFrameRef = useRef4(null);
|
|
1317
|
+
const panPendingDxRef = useRef4(0);
|
|
1318
|
+
const hoveredRef = useRef4(null);
|
|
1319
|
+
const pointersRef = useRef4(/* @__PURE__ */ new Map());
|
|
1320
|
+
const zoomFrameRef = useRef4(null);
|
|
1321
|
+
const zoomPendingRef = useRef4(null);
|
|
1322
|
+
const config = useMemo(
|
|
1314
1323
|
() => {
|
|
1315
1324
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
1316
1325
|
return {
|
|
@@ -1325,7 +1334,7 @@ var useCanvasInteractions = ({
|
|
|
1325
1334
|
},
|
|
1326
1335
|
[panZoom]
|
|
1327
1336
|
);
|
|
1328
|
-
const limits =
|
|
1337
|
+
const limits = useMemo(
|
|
1329
1338
|
() => {
|
|
1330
1339
|
var _a, _b;
|
|
1331
1340
|
return {
|
|
@@ -2005,12 +2014,12 @@ var CanvasBoard = forwardRef2(
|
|
|
2005
2014
|
getSelection
|
|
2006
2015
|
}, contentRef) => {
|
|
2007
2016
|
var _a;
|
|
2008
|
-
const staticCanvasRef =
|
|
2009
|
-
const dynamicCanvasRef =
|
|
2010
|
-
const ghostRef =
|
|
2011
|
-
const headerWrapperRef =
|
|
2012
|
-
const measureLayerRef =
|
|
2013
|
-
const totalHeightRef =
|
|
2017
|
+
const staticCanvasRef = useRef5(null);
|
|
2018
|
+
const dynamicCanvasRef = useRef5(null);
|
|
2019
|
+
const ghostRef = useRef5(null);
|
|
2020
|
+
const headerWrapperRef = useRef5(null);
|
|
2021
|
+
const measureLayerRef = useRef5(null);
|
|
2022
|
+
const totalHeightRef = useRef5(0);
|
|
2014
2023
|
const [scrollTop, setScrollTop] = useState3(0);
|
|
2015
2024
|
const [viewportHeight, setViewportHeight] = useState3(0);
|
|
2016
2025
|
useEffect5(() => {
|
|
@@ -2346,6 +2355,43 @@ var CanvasBoard = forwardRef2(
|
|
|
2346
2355
|
);
|
|
2347
2356
|
var canvas_board_default = CanvasBoard;
|
|
2348
2357
|
|
|
2358
|
+
// src/components/pointer-line.tsx
|
|
2359
|
+
import React6, { forwardRef as forwardRef3, useImperativeHandle as useImperativeHandle2, useRef as useRef6 } from "react";
|
|
2360
|
+
var PointerLine = forwardRef3(({ contentRef, mainRef, top, color, labelColor, font }, ref) => {
|
|
2361
|
+
const lineRef = useRef6(null);
|
|
2362
|
+
const labelRef = useRef6(null);
|
|
2363
|
+
useImperativeHandle2(ref, () => ({
|
|
2364
|
+
show: (x, label) => {
|
|
2365
|
+
var _a, _b;
|
|
2366
|
+
const line = lineRef.current, tag = labelRef.current;
|
|
2367
|
+
const content = contentRef.current, main = mainRef.current;
|
|
2368
|
+
if (!line || !tag || !content || !main) return;
|
|
2369
|
+
const box = content.getBoundingClientRect();
|
|
2370
|
+
const frame = main.getBoundingClientRect();
|
|
2371
|
+
const left = box.left - frame.left;
|
|
2372
|
+
const bottom = Math.min(box.bottom, (_b = (_a = content.parentElement) == null ? void 0 : _a.getBoundingClientRect().bottom) != null ? _b : box.bottom);
|
|
2373
|
+
line.style.height = `${Math.max(bottom - frame.top - top, 0)}px`;
|
|
2374
|
+
line.style.display = "block";
|
|
2375
|
+
line.style.transform = `translateX(${Math.round(left + x)}px)`;
|
|
2376
|
+
if (label === null) {
|
|
2377
|
+
tag.style.display = "none";
|
|
2378
|
+
return;
|
|
2379
|
+
}
|
|
2380
|
+
tag.textContent = label;
|
|
2381
|
+
tag.style.display = "block";
|
|
2382
|
+
const w = tag.offsetWidth;
|
|
2383
|
+
const at = Math.min(Math.max(x - w / 2, 0), Math.max(box.width - w, 0));
|
|
2384
|
+
tag.style.transform = `translateX(${Math.round(left + at)}px)`;
|
|
2385
|
+
},
|
|
2386
|
+
hide: () => {
|
|
2387
|
+
if (lineRef.current) lineRef.current.style.display = "none";
|
|
2388
|
+
if (labelRef.current) labelRef.current.style.display = "none";
|
|
2389
|
+
}
|
|
2390
|
+
}), [contentRef, mainRef, top]);
|
|
2391
|
+
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement("div", { ref: lineRef, className: "pointer-line", style: { top, borderLeftColor: color } }), /* @__PURE__ */ React6.createElement("div", { ref: labelRef, className: "pointer-label", style: { background: color, color: labelColor, font } }));
|
|
2392
|
+
});
|
|
2393
|
+
var pointer_line_default = PointerLine;
|
|
2394
|
+
|
|
2349
2395
|
// src/core/scene.ts
|
|
2350
2396
|
var binaryInsertIndex = (events, event) => {
|
|
2351
2397
|
let lo = 0;
|
|
@@ -2805,7 +2851,8 @@ var SceneStore = class {
|
|
|
2805
2851
|
};
|
|
2806
2852
|
|
|
2807
2853
|
// src/timeline.tsx
|
|
2808
|
-
var
|
|
2854
|
+
var defaultPointerFormat = (time) => new Date(time * 1e3).toLocaleString();
|
|
2855
|
+
var Timeline = forwardRef4(
|
|
2809
2856
|
({
|
|
2810
2857
|
rows,
|
|
2811
2858
|
events,
|
|
@@ -2833,6 +2880,9 @@ var Timeline = forwardRef3(
|
|
|
2833
2880
|
panZoom,
|
|
2834
2881
|
timeBar,
|
|
2835
2882
|
showTimeBar = true,
|
|
2883
|
+
showPointerLine = false,
|
|
2884
|
+
formatPointerTime,
|
|
2885
|
+
onPointerTime,
|
|
2836
2886
|
animations = true
|
|
2837
2887
|
}, handleRef) => {
|
|
2838
2888
|
const [windowTime, setWindowTime] = useState4([
|
|
@@ -2929,7 +2979,62 @@ var Timeline = forwardRef3(
|
|
|
2929
2979
|
var _a;
|
|
2930
2980
|
(_a = onWindowChangeRef.current) == null ? void 0 : _a.call(onWindowChangeRef, { startTime: windowTime[0], endTime: windowTime[1] });
|
|
2931
2981
|
}, [windowTime[0], windowTime[1]]);
|
|
2932
|
-
|
|
2982
|
+
const tickRef = useRef7(tick);
|
|
2983
|
+
tickRef.current = tick;
|
|
2984
|
+
const pointerLineRef = useRef7(null);
|
|
2985
|
+
const pointerRef = useRef7(null);
|
|
2986
|
+
const pointerOpts = useRef7({ showPointerLine, showTimeBar, formatPointerTime, onPointerTime });
|
|
2987
|
+
pointerOpts.current = { showPointerLine, showTimeBar, formatPointerTime, onPointerTime };
|
|
2988
|
+
const drawPointer = useCallback3(() => {
|
|
2989
|
+
var _a, _b;
|
|
2990
|
+
const line = pointerLineRef.current;
|
|
2991
|
+
const p = pointerRef.current;
|
|
2992
|
+
const t = tickRef.current;
|
|
2993
|
+
if (!line) return;
|
|
2994
|
+
if (!p || !t) return line.hide();
|
|
2995
|
+
const start = windowTimeRef.current[0];
|
|
2996
|
+
const time = "x" in p ? start + p.x * t : p.time;
|
|
2997
|
+
const x = "x" in p ? p.x : (p.time - start) / t;
|
|
2998
|
+
const width = (_b = (_a = contentRef.current) == null ? void 0 : _a.getBoundingClientRect().width) != null ? _b : 0;
|
|
2999
|
+
if (x < 0 || x > width) return line.hide();
|
|
3000
|
+
const { showTimeBar: labelled, formatPointerTime: format } = pointerOpts.current;
|
|
3001
|
+
line.show(x, labelled ? (format != null ? format : defaultPointerFormat)(time) : null);
|
|
3002
|
+
}, []);
|
|
3003
|
+
useEffect6(() => {
|
|
3004
|
+
const column = contentRef.current;
|
|
3005
|
+
if (!column) return;
|
|
3006
|
+
const move = (e) => {
|
|
3007
|
+
var _a, _b;
|
|
3008
|
+
const t = tickRef.current;
|
|
3009
|
+
if (!t) return;
|
|
3010
|
+
const x = e.clientX - column.getBoundingClientRect().left;
|
|
3011
|
+
(_b = (_a = pointerOpts.current).onPointerTime) == null ? void 0 : _b.call(_a, windowTimeRef.current[0] + x * t);
|
|
3012
|
+
if (!pointerOpts.current.showPointerLine) return;
|
|
3013
|
+
pointerRef.current = { x };
|
|
3014
|
+
drawPointer();
|
|
3015
|
+
};
|
|
3016
|
+
const leave = () => {
|
|
3017
|
+
var _a, _b;
|
|
3018
|
+
(_b = (_a = pointerOpts.current).onPointerTime) == null ? void 0 : _b.call(_a, null);
|
|
3019
|
+
if (pointerRef.current && "x" in pointerRef.current) {
|
|
3020
|
+
pointerRef.current = null;
|
|
3021
|
+
drawPointer();
|
|
3022
|
+
}
|
|
3023
|
+
};
|
|
3024
|
+
column.addEventListener("pointermove", move);
|
|
3025
|
+
column.addEventListener("pointerleave", leave);
|
|
3026
|
+
return () => {
|
|
3027
|
+
column.removeEventListener("pointermove", move);
|
|
3028
|
+
column.removeEventListener("pointerleave", leave);
|
|
3029
|
+
};
|
|
3030
|
+
}, [drawPointer]);
|
|
3031
|
+
useEffect6(() => {
|
|
3032
|
+
var _a, _b;
|
|
3033
|
+
const p = pointerRef.current;
|
|
3034
|
+
if (p && "x" in p && tick) (_b = (_a = pointerOpts.current).onPointerTime) == null ? void 0 : _b.call(_a, windowTime[0] + p.x * tick);
|
|
3035
|
+
drawPointer();
|
|
3036
|
+
}, [windowTime[0], windowTime[1], tick, drawPointer]);
|
|
3037
|
+
useImperativeHandle3(
|
|
2933
3038
|
handleRef,
|
|
2934
3039
|
() => ({
|
|
2935
3040
|
setEvents: (next) => scene.setEvents([...next].sort(sort_events_default)),
|
|
@@ -2947,6 +3052,7 @@ var Timeline = forwardRef3(
|
|
|
2947
3052
|
// the scale follows the window, or a zoom applied from outside draws and pans at the old one
|
|
2948
3053
|
setWindow: (startTime, endTime) => {
|
|
2949
3054
|
var _a;
|
|
3055
|
+
windowTimeRef.current = [startTime, endTime];
|
|
2950
3056
|
setWindowTime([startTime, endTime]);
|
|
2951
3057
|
const width = (_a = contentRef.current) == null ? void 0 : _a.getBoundingClientRect().width;
|
|
2952
3058
|
if (width && endTime > startTime) {
|
|
@@ -2958,6 +3064,10 @@ var Timeline = forwardRef3(
|
|
|
2958
3064
|
startTime: windowTimeRef.current[0],
|
|
2959
3065
|
endTime: windowTimeRef.current[1]
|
|
2960
3066
|
}),
|
|
3067
|
+
setPointerTime: (time) => {
|
|
3068
|
+
pointerRef.current = time === null ? null : { time };
|
|
3069
|
+
drawPointer();
|
|
3070
|
+
},
|
|
2961
3071
|
setSelection: (ids) => applySelection(ids),
|
|
2962
3072
|
getSelection,
|
|
2963
3073
|
toggleRow: (rowId) => scene.toggleCollapsed(rowId),
|
|
@@ -2967,7 +3077,7 @@ var Timeline = forwardRef3(
|
|
|
2967
3077
|
return (_a = rendererRef.current) == null ? void 0 : _a.invalidate("all");
|
|
2968
3078
|
}
|
|
2969
3079
|
}),
|
|
2970
|
-
[scene, applySelection, getSelection]
|
|
3080
|
+
[scene, applySelection, getSelection, drawPointer]
|
|
2971
3081
|
);
|
|
2972
3082
|
useEffect6(() => {
|
|
2973
3083
|
if (contentRef.current) {
|
|
@@ -3019,16 +3129,16 @@ var Timeline = forwardRef3(
|
|
|
3019
3129
|
);
|
|
3020
3130
|
}
|
|
3021
3131
|
}, []);
|
|
3022
|
-
use_resize_observer_default({ contentRef, setCellWidth, setTick,
|
|
3023
|
-
const resolvedTheme =
|
|
3024
|
-
const geometry =
|
|
3132
|
+
use_resize_observer_default({ contentRef, setCellWidth, setTick, windowTimeRef });
|
|
3133
|
+
const resolvedTheme = useMemo2(() => resolveTheme(theme), [theme]);
|
|
3134
|
+
const geometry = useMemo2(
|
|
3025
3135
|
() => geometryFromTheme(resolvedTheme),
|
|
3026
3136
|
[resolvedTheme]
|
|
3027
3137
|
);
|
|
3028
3138
|
useEffect6(() => {
|
|
3029
3139
|
scene.setGeometry(geometry);
|
|
3030
3140
|
}, [scene, geometry]);
|
|
3031
|
-
const resolvedAnimations =
|
|
3141
|
+
const resolvedAnimations = useMemo2(() => {
|
|
3032
3142
|
var _a, _b;
|
|
3033
3143
|
if (animations === false) return { layoutMs: 0, fadeMs: 0 };
|
|
3034
3144
|
if (animations === true) {
|
|
@@ -3042,8 +3152,8 @@ var Timeline = forwardRef3(
|
|
|
3042
3152
|
fadeMs: (_b = animations.fadeMs) != null ? _b : DEFAULT_FADE_DURATION_MS
|
|
3043
3153
|
};
|
|
3044
3154
|
}, [animations]);
|
|
3045
|
-
const eventPrompt =
|
|
3046
|
-
() => /* @__PURE__ */
|
|
3155
|
+
const eventPrompt = useMemo2(
|
|
3156
|
+
() => /* @__PURE__ */ React7.createElement(
|
|
3047
3157
|
event_prompt_default,
|
|
3048
3158
|
{
|
|
3049
3159
|
ref: eventPromptRef,
|
|
@@ -3052,7 +3162,7 @@ var Timeline = forwardRef3(
|
|
|
3052
3162
|
),
|
|
3053
3163
|
[eventPromptTemplate]
|
|
3054
3164
|
);
|
|
3055
|
-
return /* @__PURE__ */
|
|
3165
|
+
return /* @__PURE__ */ React7.createElement("div", { className: "main-wrapper", ref: mainRef }, showRTIndicator && /* @__PURE__ */ React7.createElement(rt_indicator_default, { tick, windowTime }), showTimeBar && /* @__PURE__ */ React7.createElement(
|
|
3056
3166
|
canvas_time_bar_default,
|
|
3057
3167
|
{
|
|
3058
3168
|
windowTime,
|
|
@@ -3062,7 +3172,7 @@ var Timeline = forwardRef3(
|
|
|
3062
3172
|
theme: resolvedTheme,
|
|
3063
3173
|
timeBar
|
|
3064
3174
|
}
|
|
3065
|
-
), /* @__PURE__ */
|
|
3175
|
+
), /* @__PURE__ */ React7.createElement("div", { className: "body-wrapper", ref: bodyRef, style: { borderColor: resolvedTheme.borderColor } }, /* @__PURE__ */ React7.createElement(
|
|
3066
3176
|
canvas_board_default,
|
|
3067
3177
|
{
|
|
3068
3178
|
scene,
|
|
@@ -3093,7 +3203,18 @@ var Timeline = forwardRef3(
|
|
|
3093
3203
|
getSelection,
|
|
3094
3204
|
ref: contentRef
|
|
3095
3205
|
}
|
|
3096
|
-
), showEventPrompt && eventPrompt)
|
|
3206
|
+
), showEventPrompt && eventPrompt), /* @__PURE__ */ React7.createElement(
|
|
3207
|
+
pointer_line_default,
|
|
3208
|
+
{
|
|
3209
|
+
ref: pointerLineRef,
|
|
3210
|
+
contentRef,
|
|
3211
|
+
mainRef,
|
|
3212
|
+
top: showTimeBar ? TIME_BAR_HEIGHT : 0,
|
|
3213
|
+
color: resolvedTheme.pointerLineColor,
|
|
3214
|
+
labelColor: resolvedTheme.pointerLabelColor,
|
|
3215
|
+
font: resolvedTheme.font
|
|
3216
|
+
}
|
|
3217
|
+
));
|
|
3097
3218
|
}
|
|
3098
3219
|
);
|
|
3099
3220
|
export {
|