awesome-timeline-react 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -6
- package/dist/_tsup-dts-rollup.d.mts +55 -31
- package/dist/_tsup-dts-rollup.d.ts +55 -31
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +89 -81
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +89 -81
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -537,8 +537,9 @@ var CanvasTimeBar = ({
|
|
|
537
537
|
theme,
|
|
538
538
|
timeBar
|
|
539
539
|
}) => {
|
|
540
|
-
var _a, _b;
|
|
540
|
+
var _a, _b, _c;
|
|
541
541
|
const canvasRef = useRef4(null);
|
|
542
|
+
const header = theme != null ? theme : DEFAULT_THEME;
|
|
542
543
|
const topRow = (_a = timeBar == null ? void 0 : timeBar.topRow) != null ? _a : { unit: "day" };
|
|
543
544
|
const bottomRow = (_b = timeBar == null ? void 0 : timeBar.bottomRow) != null ? _b : { unit: "hour" };
|
|
544
545
|
useEffect3(() => {
|
|
@@ -567,24 +568,33 @@ var CanvasTimeBar = ({
|
|
|
567
568
|
}))
|
|
568
569
|
});
|
|
569
570
|
}, [windowTime, tick, contentWidth, theme, timeBar]);
|
|
570
|
-
return /* @__PURE__ */ React3.createElement(
|
|
571
|
-
"canvas",
|
|
572
|
-
{
|
|
573
|
-
ref: canvasRef,
|
|
574
|
-
className: "canvas-time-bar",
|
|
575
|
-
style: { minWidth: contentWidth ? contentWidth : 0 }
|
|
576
|
-
}
|
|
577
|
-
), scrollWidth ? /* @__PURE__ */ React3.createElement(
|
|
571
|
+
return /* @__PURE__ */ React3.createElement(
|
|
578
572
|
"div",
|
|
579
573
|
{
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
574
|
+
className: "time-bar",
|
|
575
|
+
style: { background: header.headerBackground, color: header.headerTextColor, borderColor: header.headerBorderColor }
|
|
576
|
+
},
|
|
577
|
+
/* @__PURE__ */ React3.createElement("div", { className: "empty-block", style: { borderRightColor: header.headerBorderColor } }),
|
|
578
|
+
/* @__PURE__ */ React3.createElement(
|
|
579
|
+
"canvas",
|
|
580
|
+
{
|
|
581
|
+
ref: canvasRef,
|
|
582
|
+
className: "canvas-time-bar",
|
|
583
|
+
style: { minWidth: contentWidth ? contentWidth : 0 }
|
|
585
584
|
}
|
|
586
|
-
|
|
587
|
-
|
|
585
|
+
),
|
|
586
|
+
scrollWidth ? /* @__PURE__ */ React3.createElement(
|
|
587
|
+
"div",
|
|
588
|
+
{
|
|
589
|
+
style: {
|
|
590
|
+
width: scrollWidth,
|
|
591
|
+
height: "100%",
|
|
592
|
+
boxSizing: "border-box",
|
|
593
|
+
borderLeft: `1px solid ${(_c = header.headerBorderColor) != null ? _c : "yellow"}`
|
|
594
|
+
}
|
|
595
|
+
}
|
|
596
|
+
) : null
|
|
597
|
+
);
|
|
588
598
|
};
|
|
589
599
|
var canvas_time_bar_default = CanvasTimeBar;
|
|
590
600
|
|
|
@@ -662,7 +672,6 @@ var cullToWindow = (events, windowStart, windowEnd) => {
|
|
|
662
672
|
// src/core/coords.ts
|
|
663
673
|
var timeToX = (time, windowStart, tick) => (time - windowStart) / tick;
|
|
664
674
|
var timeToWidth = (startTime, endTime, tick) => (endTime - startTime) / tick;
|
|
665
|
-
var intersectsWindow = (event, windowStart, windowEnd) => event.endTime >= windowStart && event.startTime <= windowEnd;
|
|
666
675
|
|
|
667
676
|
// src/core/geometry.ts
|
|
668
677
|
var DEFAULT_GEOMETRY = {
|
|
@@ -690,11 +699,10 @@ var geometryFromTheme = (theme) => {
|
|
|
690
699
|
var laneTop = (lane, g = DEFAULT_GEOMETRY) => g.laneTopOffset + g.laneHeight * lane;
|
|
691
700
|
var rowMinHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.rowBaseHeight + highestLane * g.laneHeight;
|
|
692
701
|
var staticEventHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.staticEventBaseHeight + highestLane * g.laneHeight;
|
|
693
|
-
var assignLanes = (rowEvents
|
|
702
|
+
var assignLanes = (rowEvents) => {
|
|
694
703
|
const laneEnd = [];
|
|
695
704
|
const laneOf = /* @__PURE__ */ new Map();
|
|
696
705
|
for (const event of rowEvents) {
|
|
697
|
-
if (!intersectsWindow(event, windowStart, windowEnd)) continue;
|
|
698
706
|
let lane = laneEnd.findIndex((end) => end <= event.startTime);
|
|
699
707
|
if (lane === -1) {
|
|
700
708
|
lane = laneEnd.length;
|
|
@@ -788,7 +796,6 @@ var roundedRect = (ctx, x, y, width, height, radius) => {
|
|
|
788
796
|
};
|
|
789
797
|
var drawGroupShading = (ctx, view, scene) => {
|
|
790
798
|
var _a;
|
|
791
|
-
const [windowStart, windowEnd] = view.windowTime;
|
|
792
799
|
const visible = scene.getVisibleRowIds();
|
|
793
800
|
const regions = [];
|
|
794
801
|
let y = 0;
|
|
@@ -800,7 +807,7 @@ var drawGroupShading = (ctx, view, scene) => {
|
|
|
800
807
|
runParent = null;
|
|
801
808
|
};
|
|
802
809
|
for (const rowId of visible) {
|
|
803
|
-
const height = scene.getRowHeight(rowId
|
|
810
|
+
const height = scene.getRowHeight(rowId);
|
|
804
811
|
const parentId = (_a = scene.getRow(rowId)) == null ? void 0 : _a.parentId;
|
|
805
812
|
if (parentId !== void 0) {
|
|
806
813
|
if (runParent === parentId) {
|
|
@@ -847,14 +854,13 @@ var drawGroupShading = (ctx, view, scene) => {
|
|
|
847
854
|
ctx.restore();
|
|
848
855
|
};
|
|
849
856
|
var drawRowDividers = (ctx, view, scene) => {
|
|
850
|
-
const [windowStart, windowEnd] = view.windowTime;
|
|
851
857
|
const rowIds = scene.getVisibleRowIds();
|
|
852
858
|
ctx.strokeStyle = view.theme.gridColor;
|
|
853
859
|
ctx.lineWidth = 1;
|
|
854
860
|
ctx.beginPath();
|
|
855
861
|
let y = 0;
|
|
856
862
|
for (let i = 0; i < rowIds.length; i++) {
|
|
857
|
-
y += scene.getRowHeight(rowIds[i]
|
|
863
|
+
y += scene.getRowHeight(rowIds[i]);
|
|
858
864
|
if (i === rowIds.length - 1) break;
|
|
859
865
|
const screenY = y - view.scrollTop;
|
|
860
866
|
if (screenY < 0) continue;
|
|
@@ -967,7 +973,7 @@ var paintOverlapStripes = (ctx, event, rect, rowStatics, windowStart, tick, colo
|
|
|
967
973
|
}
|
|
968
974
|
};
|
|
969
975
|
var drawEvents = (ctx, view, scene, font, animator) => {
|
|
970
|
-
var _a;
|
|
976
|
+
var _a, _b, _c, _d;
|
|
971
977
|
if (view.tick === null) return;
|
|
972
978
|
const [windowStart, windowEnd] = view.windowTime;
|
|
973
979
|
const tick = view.tick;
|
|
@@ -979,7 +985,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
979
985
|
const hasSelection = selectedIds.size > 0;
|
|
980
986
|
const deferred = [];
|
|
981
987
|
const paintEvent = (event, rect, state, opts, rowStatics) => {
|
|
982
|
-
var _a2,
|
|
988
|
+
var _a2, _b2, _c2, _d2, _e;
|
|
983
989
|
ctx.save();
|
|
984
990
|
ctx.globalAlpha = 1;
|
|
985
991
|
if (opts.elevate) {
|
|
@@ -990,7 +996,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
990
996
|
}
|
|
991
997
|
if (state.dragging) ctx.globalAlpha = 0.5;
|
|
992
998
|
else if (opts.dim) ctx.globalAlpha *= view.theme.dimmedOpacity;
|
|
993
|
-
const custom = (
|
|
999
|
+
const custom = (_b2 = (_a2 = event.props) == null ? void 0 : _a2.drawEvent) != null ? _b2 : view.drawEvent;
|
|
994
1000
|
const drawn = custom !== void 0 && custom(ctx, event, rect, state, view.theme) !== false;
|
|
995
1001
|
if (!drawn) {
|
|
996
1002
|
defaultDrawEvent(ctx, event, rect, view, font, geometry.barRadius);
|
|
@@ -1017,7 +1023,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1017
1023
|
ctx,
|
|
1018
1024
|
rect,
|
|
1019
1025
|
alpha,
|
|
1020
|
-
(_e = (
|
|
1026
|
+
(_e = (_d2 = (_c2 = event.props) == null ? void 0 : _c2.style) == null ? void 0 : _d2.stroke) != null ? _e : view.theme.eventStroke
|
|
1021
1027
|
);
|
|
1022
1028
|
}
|
|
1023
1029
|
}
|
|
@@ -1025,13 +1031,13 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1025
1031
|
};
|
|
1026
1032
|
let rowTop = 0;
|
|
1027
1033
|
for (const rowId of scene.getVisibleRowIds()) {
|
|
1028
|
-
const rowHeight = scene.getRowHeight(rowId
|
|
1034
|
+
const rowHeight = scene.getRowHeight(rowId);
|
|
1029
1035
|
const rowY = rowTop - view.scrollTop;
|
|
1030
1036
|
rowTop += rowHeight;
|
|
1031
1037
|
if (rowY + rowHeight < 0) continue;
|
|
1032
1038
|
if (rowY > view.height) break;
|
|
1033
|
-
const lanes = scene.getLanes(rowId
|
|
1034
|
-
const inset = scene.getLaneInset(rowId
|
|
1039
|
+
const lanes = scene.getLanes(rowId);
|
|
1040
|
+
const inset = scene.getLaneInset(rowId);
|
|
1035
1041
|
const rowStatics = cullToWindow(
|
|
1036
1042
|
scene.getRowStaticEvents(rowId),
|
|
1037
1043
|
windowStart,
|
|
@@ -1040,7 +1046,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
|
|
|
1040
1046
|
for (const event of rowStatics) {
|
|
1041
1047
|
const x = timeToX(event.startTime, windowStart, tick);
|
|
1042
1048
|
const width = timeToWidth(event.startTime, event.endTime, tick);
|
|
1043
|
-
ctx.fillStyle = view.theme.staticEventFill;
|
|
1049
|
+
ctx.fillStyle = (_d = (_c = (_b = event.props) == null ? void 0 : _b.style) == null ? void 0 : _c.fill) != null ? _d : view.theme.staticEventFill;
|
|
1044
1050
|
roundedRect(
|
|
1045
1051
|
ctx,
|
|
1046
1052
|
x,
|
|
@@ -1211,7 +1217,7 @@ var hitTest = (scene, view, x, y) => {
|
|
|
1211
1217
|
let rowTop = 0;
|
|
1212
1218
|
let rowId = null;
|
|
1213
1219
|
for (const id of scene.getVisibleRowIds()) {
|
|
1214
|
-
const height = scene.getRowHeight(id
|
|
1220
|
+
const height = scene.getRowHeight(id);
|
|
1215
1221
|
if (yContent >= rowTop && yContent < rowTop + height) {
|
|
1216
1222
|
rowId = id;
|
|
1217
1223
|
break;
|
|
@@ -1219,8 +1225,8 @@ var hitTest = (scene, view, x, y) => {
|
|
|
1219
1225
|
rowTop += height;
|
|
1220
1226
|
}
|
|
1221
1227
|
if (rowId === null) return null;
|
|
1222
|
-
const lanes = scene.getLanes(rowId
|
|
1223
|
-
const lanesY = rowTop - scrollTop + scene.getLaneInset(rowId
|
|
1228
|
+
const lanes = scene.getLanes(rowId);
|
|
1229
|
+
const lanesY = rowTop - scrollTop + scene.getLaneInset(rowId);
|
|
1224
1230
|
const events = cullToWindow(
|
|
1225
1231
|
scene.getRowEvents(rowId),
|
|
1226
1232
|
windowStart,
|
|
@@ -1640,11 +1646,7 @@ var useCanvasInteractions = ({
|
|
|
1640
1646
|
const yContent = clientY - canvas.getBoundingClientRect().top + view.scrollTop;
|
|
1641
1647
|
let rowTop = 0;
|
|
1642
1648
|
for (const id of scene.getVisibleRowIds()) {
|
|
1643
|
-
const height = scene.getRowHeight(
|
|
1644
|
-
id,
|
|
1645
|
-
view.windowTime[0],
|
|
1646
|
-
view.windowTime[1]
|
|
1647
|
-
);
|
|
1649
|
+
const height = scene.getRowHeight(id);
|
|
1648
1650
|
if (yContent >= rowTop && yContent < rowTop + height) return id;
|
|
1649
1651
|
rowTop += height;
|
|
1650
1652
|
}
|
|
@@ -1998,6 +2000,7 @@ var CanvasBoard = forwardRef2(
|
|
|
1998
2000
|
applySelection,
|
|
1999
2001
|
getSelection
|
|
2000
2002
|
}, contentRef) => {
|
|
2003
|
+
var _a;
|
|
2001
2004
|
const staticCanvasRef = useRef6(null);
|
|
2002
2005
|
const dynamicCanvasRef = useRef6(null);
|
|
2003
2006
|
const ghostRef = useRef6(null);
|
|
@@ -2020,8 +2023,8 @@ var CanvasBoard = forwardRef2(
|
|
|
2020
2023
|
};
|
|
2021
2024
|
}, [scene, rendererRef]);
|
|
2022
2025
|
useEffect5(() => {
|
|
2023
|
-
var
|
|
2024
|
-
(
|
|
2026
|
+
var _a2, _b;
|
|
2027
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.animator.setDurations(
|
|
2025
2028
|
animations.layoutMs,
|
|
2026
2029
|
animations.fadeMs
|
|
2027
2030
|
);
|
|
@@ -2046,14 +2049,14 @@ var CanvasBoard = forwardRef2(
|
|
|
2046
2049
|
rendererRef
|
|
2047
2050
|
]);
|
|
2048
2051
|
const measureViewport = useCallback2(() => {
|
|
2049
|
-
var
|
|
2052
|
+
var _a2;
|
|
2050
2053
|
const column = contentRef && "current" in contentRef ? contentRef.current : null;
|
|
2051
2054
|
const body = bodyRef.current;
|
|
2052
2055
|
if (!column || !body) return;
|
|
2053
2056
|
const cap = totalHeightRef.current > 0 ? totalHeightRef.current : Infinity;
|
|
2054
2057
|
const height = Math.min(body.clientHeight, cap, window.innerHeight);
|
|
2055
2058
|
setViewportHeight(height);
|
|
2056
|
-
(
|
|
2059
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({
|
|
2057
2060
|
width: column.getBoundingClientRect().width,
|
|
2058
2061
|
height
|
|
2059
2062
|
});
|
|
@@ -2072,8 +2075,8 @@ var CanvasBoard = forwardRef2(
|
|
|
2072
2075
|
const body = bodyRef.current;
|
|
2073
2076
|
if (!body) return;
|
|
2074
2077
|
const handleScroll = () => {
|
|
2075
|
-
var
|
|
2076
|
-
(
|
|
2078
|
+
var _a2;
|
|
2079
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({ scrollTop: body.scrollTop });
|
|
2077
2080
|
setScrollTop(body.scrollTop);
|
|
2078
2081
|
};
|
|
2079
2082
|
body.addEventListener("scroll", handleScroll, { passive: true });
|
|
@@ -2098,14 +2101,14 @@ var CanvasBoard = forwardRef2(
|
|
|
2098
2101
|
wrapper.appendChild(measurer);
|
|
2099
2102
|
let lastWidth = -1;
|
|
2100
2103
|
const measure = () => {
|
|
2101
|
-
var
|
|
2104
|
+
var _a2;
|
|
2102
2105
|
const width = wrapper.clientWidth;
|
|
2103
2106
|
if (width === 0 || width === lastWidth) return;
|
|
2104
2107
|
lastWidth = width;
|
|
2105
2108
|
measurer.style.width = `${width}px`;
|
|
2106
2109
|
const heights = /* @__PURE__ */ new Map();
|
|
2107
2110
|
for (const row of rows) {
|
|
2108
|
-
measurer.textContent = (
|
|
2111
|
+
measurer.textContent = (_a2 = row.name) != null ? _a2 : "";
|
|
2109
2112
|
heights.set(
|
|
2110
2113
|
row.id,
|
|
2111
2114
|
Math.ceil(measurer.offsetHeight) + 2 * theme.rowPaddingY
|
|
@@ -2176,15 +2179,12 @@ var CanvasBoard = forwardRef2(
|
|
|
2176
2179
|
getSelection
|
|
2177
2180
|
});
|
|
2178
2181
|
useEffect5(() => {
|
|
2179
|
-
var
|
|
2180
|
-
(
|
|
2182
|
+
var _a2;
|
|
2183
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({
|
|
2181
2184
|
selectedEventIds: new Set(getSelection())
|
|
2182
2185
|
});
|
|
2183
2186
|
}, [getSelection, rendererRef]);
|
|
2184
|
-
const { offsetOf, totalHeight } = scene.getRowOffsets(
|
|
2185
|
-
windowTime[0],
|
|
2186
|
-
windowTime[1]
|
|
2187
|
-
);
|
|
2187
|
+
const { offsetOf, totalHeight } = scene.getRowOffsets();
|
|
2188
2188
|
totalHeightRef.current = totalHeight;
|
|
2189
2189
|
useLayoutEffect(() => {
|
|
2190
2190
|
measureViewport();
|
|
@@ -2201,7 +2201,7 @@ var CanvasBoard = forwardRef2(
|
|
|
2201
2201
|
if (scene.isRowHidden(row.id)) continue;
|
|
2202
2202
|
const top = offsetOf.get(row.id);
|
|
2203
2203
|
if (top === void 0) continue;
|
|
2204
|
-
const height = scene.getRowHeight(row.id
|
|
2204
|
+
const height = scene.getRowHeight(row.id);
|
|
2205
2205
|
if (top + height < scrollTop) continue;
|
|
2206
2206
|
if (top > scrollTop + viewportHeight) break;
|
|
2207
2207
|
const isParent = scene.isRowParent(row.id);
|
|
@@ -2219,7 +2219,7 @@ var CanvasBoard = forwardRef2(
|
|
|
2219
2219
|
style: {
|
|
2220
2220
|
top,
|
|
2221
2221
|
height,
|
|
2222
|
-
borderBottom: i === rows.length - 1 ? "none" :
|
|
2222
|
+
borderBottom: i === rows.length - 1 ? "none" : `1px solid ${(_a = theme.headerBorderColor) != null ? _a : "yellow"}`,
|
|
2223
2223
|
// Row heights/positions apply instantly (no layout tween) so the
|
|
2224
2224
|
// header snaps in lockstep with its canvas row — see draw-events.
|
|
2225
2225
|
// Grouped rows left-align so the caret + tree spine line up; plain
|
|
@@ -2293,7 +2293,13 @@ var CanvasBoard = forwardRef2(
|
|
|
2293
2293
|
{
|
|
2294
2294
|
ref: headerWrapperRef,
|
|
2295
2295
|
className: headerClassNames,
|
|
2296
|
-
style: {
|
|
2296
|
+
style: {
|
|
2297
|
+
height: totalHeight,
|
|
2298
|
+
background: theme.headerBackground,
|
|
2299
|
+
color: theme.headerTextColor,
|
|
2300
|
+
borderRightColor: theme.headerBorderColor,
|
|
2301
|
+
boxShadow: theme.headerShadow
|
|
2302
|
+
}
|
|
2297
2303
|
},
|
|
2298
2304
|
visibleHeaders,
|
|
2299
2305
|
renderRowLabel && // off-screen: renders every row's custom header so its natural height can be measured
|
|
@@ -2408,9 +2414,7 @@ var SceneStore = class {
|
|
|
2408
2414
|
events: [],
|
|
2409
2415
|
staticEvents: [],
|
|
2410
2416
|
lanesDirty: true,
|
|
2411
|
-
lanes: null
|
|
2412
|
-
laneWindowStart: NaN,
|
|
2413
|
-
laneWindowEnd: NaN
|
|
2417
|
+
lanes: null
|
|
2414
2418
|
}
|
|
2415
2419
|
);
|
|
2416
2420
|
}
|
|
@@ -2592,14 +2596,15 @@ var SceneStore = class {
|
|
|
2592
2596
|
var _a, _b;
|
|
2593
2597
|
return (_b = (_a = this.rowIndexes.get(rowId)) == null ? void 0 : _a.staticEvents) != null ? _b : [];
|
|
2594
2598
|
}
|
|
2595
|
-
|
|
2599
|
+
/** Lanes over ALL the row's events, not just those in view: a lane assignment that followed the
|
|
2600
|
+
* window re-packed the row on every pan frame, so bars jumped between lanes as others scrolled in
|
|
2601
|
+
* and out. The row is as tall as its peak overlap anywhere. */
|
|
2602
|
+
getLanes(rowId) {
|
|
2596
2603
|
this.flushParentSpans(rowId);
|
|
2597
2604
|
const index = this.rowIndexes.get(rowId);
|
|
2598
2605
|
if (!index) return { laneOf: /* @__PURE__ */ new Map(), highestLane: 0 };
|
|
2599
|
-
if (index.lanesDirty || index.lanes === null
|
|
2600
|
-
index.lanes = assignLanes(index.events
|
|
2601
|
-
index.laneWindowStart = windowStart;
|
|
2602
|
-
index.laneWindowEnd = windowEnd;
|
|
2606
|
+
if (index.lanesDirty || index.lanes === null) {
|
|
2607
|
+
index.lanes = assignLanes(index.events);
|
|
2603
2608
|
index.lanesDirty = false;
|
|
2604
2609
|
}
|
|
2605
2610
|
return index.lanes;
|
|
@@ -2625,23 +2630,17 @@ var SceneStore = class {
|
|
|
2625
2630
|
this.labelMinHeights = heights;
|
|
2626
2631
|
this.bump();
|
|
2627
2632
|
}
|
|
2628
|
-
getRowHeight(rowId
|
|
2633
|
+
getRowHeight(rowId) {
|
|
2629
2634
|
var _a;
|
|
2630
|
-
const laneHeight = rowMinHeight(
|
|
2631
|
-
this.getLanes(rowId, windowStart, windowEnd).highestLane,
|
|
2632
|
-
this.geometry
|
|
2633
|
-
);
|
|
2635
|
+
const laneHeight = rowMinHeight(this.getLanes(rowId).highestLane, this.geometry);
|
|
2634
2636
|
const labelHeight = (_a = this.labelMinHeights.get(rowId)) != null ? _a : 0;
|
|
2635
2637
|
return Math.max(laneHeight, labelHeight);
|
|
2636
2638
|
}
|
|
2637
2639
|
/** Extra top offset for a row's lanes: when a tall label grows the row past what its lanes need,
|
|
2638
2640
|
* the lanes sit centred in it rather than hugging the top with the surplus all below. */
|
|
2639
|
-
getLaneInset(rowId
|
|
2641
|
+
getLaneInset(rowId) {
|
|
2640
2642
|
var _a;
|
|
2641
|
-
const laneHeight = rowMinHeight(
|
|
2642
|
-
this.getLanes(rowId, windowStart, windowEnd).highestLane,
|
|
2643
|
-
this.geometry
|
|
2644
|
-
);
|
|
2643
|
+
const laneHeight = rowMinHeight(this.getLanes(rowId).highestLane, this.geometry);
|
|
2645
2644
|
const labelHeight = (_a = this.labelMinHeights.get(rowId)) != null ? _a : 0;
|
|
2646
2645
|
return labelHeight > laneHeight ? Math.floor((labelHeight - laneHeight) / 2) : 0;
|
|
2647
2646
|
}
|
|
@@ -2649,12 +2648,12 @@ var SceneStore = class {
|
|
|
2649
2648
|
* y offset of each row's top edge (content coordinates, before scroll) plus
|
|
2650
2649
|
* the total content height — drives both drawing and the scroll spacer.
|
|
2651
2650
|
*/
|
|
2652
|
-
getRowOffsets(
|
|
2651
|
+
getRowOffsets() {
|
|
2653
2652
|
const offsetOf = /* @__PURE__ */ new Map();
|
|
2654
2653
|
let y = 0;
|
|
2655
2654
|
for (const rowId of this.getVisibleRowIds()) {
|
|
2656
2655
|
offsetOf.set(rowId, y);
|
|
2657
|
-
y += this.getRowHeight(rowId
|
|
2656
|
+
y += this.getRowHeight(rowId);
|
|
2658
2657
|
}
|
|
2659
2658
|
return { offsetOf, totalHeight: y };
|
|
2660
2659
|
}
|
|
@@ -2829,6 +2828,7 @@ var Timeline = forwardRef3(
|
|
|
2829
2828
|
showEventPrompt = true,
|
|
2830
2829
|
panZoom,
|
|
2831
2830
|
timeBar,
|
|
2831
|
+
showTimeBar = true,
|
|
2832
2832
|
animations = true
|
|
2833
2833
|
}, handleRef) => {
|
|
2834
2834
|
const [windowTime, setWindowTime] = useState4([
|
|
@@ -2932,8 +2932,7 @@ var Timeline = forwardRef3(
|
|
|
2932
2932
|
updateEvents: (patches) => scene.applyPatches(patches),
|
|
2933
2933
|
getEvent: (id) => scene.getEvent(id),
|
|
2934
2934
|
scrollToRow: (rowId) => {
|
|
2935
|
-
const
|
|
2936
|
-
const offset2 = scene.getRowOffsets(windowStart, windowEnd).offsetOf.get(rowId);
|
|
2935
|
+
const offset2 = scene.getRowOffsets().offsetOf.get(rowId);
|
|
2937
2936
|
if (offset2 !== void 0 && bodyRef.current) {
|
|
2938
2937
|
bodyRef.current.scrollTop = offset2;
|
|
2939
2938
|
}
|
|
@@ -2941,7 +2940,16 @@ var Timeline = forwardRef3(
|
|
|
2941
2940
|
scrollToTime: (time) => {
|
|
2942
2941
|
setWindowTime((prev) => [time, time + (prev[1] - prev[0])]);
|
|
2943
2942
|
},
|
|
2944
|
-
|
|
2943
|
+
// the scale follows the window, or a zoom applied from outside draws and pans at the old one
|
|
2944
|
+
setWindow: (startTime, endTime) => {
|
|
2945
|
+
var _a;
|
|
2946
|
+
setWindowTime([startTime, endTime]);
|
|
2947
|
+
const width = (_a = contentRef.current) == null ? void 0 : _a.getBoundingClientRect().width;
|
|
2948
|
+
if (width && endTime > startTime) {
|
|
2949
|
+
setTick((endTime - startTime) / width);
|
|
2950
|
+
setCellWidth(width / ((endTime - startTime) / 3600));
|
|
2951
|
+
}
|
|
2952
|
+
},
|
|
2945
2953
|
getVisibleRange: () => ({
|
|
2946
2954
|
startTime: windowTimeRef.current[0],
|
|
2947
2955
|
endTime: windowTimeRef.current[1]
|
|
@@ -3040,7 +3048,7 @@ var Timeline = forwardRef3(
|
|
|
3040
3048
|
),
|
|
3041
3049
|
[eventPromptTemplate]
|
|
3042
3050
|
);
|
|
3043
|
-
return /* @__PURE__ */ React6.createElement("div", { className: "main-wrapper", ref: mainRef }, showRTIndicator && /* @__PURE__ */ React6.createElement(rt_indicator_default, { tick, windowTime }), /* @__PURE__ */ React6.createElement(
|
|
3051
|
+
return /* @__PURE__ */ React6.createElement("div", { className: "main-wrapper", ref: mainRef }, showRTIndicator && /* @__PURE__ */ React6.createElement(rt_indicator_default, { tick, windowTime }), showTimeBar && /* @__PURE__ */ React6.createElement(
|
|
3044
3052
|
canvas_time_bar_default,
|
|
3045
3053
|
{
|
|
3046
3054
|
windowTime,
|
|
@@ -3050,7 +3058,7 @@ var Timeline = forwardRef3(
|
|
|
3050
3058
|
theme: resolvedTheme,
|
|
3051
3059
|
timeBar
|
|
3052
3060
|
}
|
|
3053
|
-
), /* @__PURE__ */ React6.createElement("div", { className: "body-wrapper", ref: bodyRef }, /* @__PURE__ */ React6.createElement(
|
|
3061
|
+
), /* @__PURE__ */ React6.createElement("div", { className: "body-wrapper", ref: bodyRef, style: { borderColor: resolvedTheme.borderColor } }, /* @__PURE__ */ React6.createElement(
|
|
3054
3062
|
canvas_board_default,
|
|
3055
3063
|
{
|
|
3056
3064
|
scene,
|