awesome-timeline-react 0.8.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/dist/_tsup-dts-rollup.d.mts +12 -1
- package/dist/_tsup-dts-rollup.d.ts +12 -1
- package/dist/index.js +46 -29
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -29
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -457,6 +457,8 @@ export declare type Geometry = {
|
|
|
457
457
|
/** Derive the full Geometry from the resolved theme's geometry tokens. */
|
|
458
458
|
export declare const geometryFromTheme: (theme: ResolvedTheme) => Geometry;
|
|
459
459
|
|
|
460
|
+
declare type HeaderToken = "headerBackground" | "headerTextColor" | "headerBorderColor" | "headerShadow" | "borderColor";
|
|
461
|
+
|
|
460
462
|
export declare type HitTarget = {
|
|
461
463
|
kind: "event" | "static";
|
|
462
464
|
event: EventType;
|
|
@@ -655,7 +657,7 @@ export declare type ResizePreview = {
|
|
|
655
657
|
direction: "left" | "right";
|
|
656
658
|
};
|
|
657
659
|
|
|
658
|
-
declare type ResolvedTheme = Required<Omit<Theme, "font">> & Pick<Theme, "font">;
|
|
660
|
+
declare type ResolvedTheme = Required<Omit<Theme, "font" | HeaderToken>> & Pick<Theme, "font" | HeaderToken>;
|
|
659
661
|
export { ResolvedTheme }
|
|
660
662
|
export { ResolvedTheme as ResolvedTheme_alias_1 }
|
|
661
663
|
|
|
@@ -845,6 +847,15 @@ declare type Theme = {
|
|
|
845
847
|
* "rgba(0,0,0,0.22)"). Also tints the header tree connector lines if no
|
|
846
848
|
* gridColor contrast is desired. */
|
|
847
849
|
groupShadowColor?: string;
|
|
850
|
+
/** the row-header column and the time bar: background, text, their borders and the column's row
|
|
851
|
+
* dividers, and the column's shadow onto the rows ("none" for none). Unset, the stylesheet's
|
|
852
|
+
* dark header with yellow borders applies. */
|
|
853
|
+
headerBackground?: string;
|
|
854
|
+
headerTextColor?: string;
|
|
855
|
+
headerBorderColor?: string;
|
|
856
|
+
headerShadow?: string;
|
|
857
|
+
/** the frame around the rows; unset, the stylesheet's black applies */
|
|
858
|
+
borderColor?: string;
|
|
848
859
|
};
|
|
849
860
|
export { Theme }
|
|
850
861
|
export { Theme as Theme_alias_1 }
|
|
@@ -457,6 +457,8 @@ export declare type Geometry = {
|
|
|
457
457
|
/** Derive the full Geometry from the resolved theme's geometry tokens. */
|
|
458
458
|
export declare const geometryFromTheme: (theme: ResolvedTheme) => Geometry;
|
|
459
459
|
|
|
460
|
+
declare type HeaderToken = "headerBackground" | "headerTextColor" | "headerBorderColor" | "headerShadow" | "borderColor";
|
|
461
|
+
|
|
460
462
|
export declare type HitTarget = {
|
|
461
463
|
kind: "event" | "static";
|
|
462
464
|
event: EventType;
|
|
@@ -655,7 +657,7 @@ export declare type ResizePreview = {
|
|
|
655
657
|
direction: "left" | "right";
|
|
656
658
|
};
|
|
657
659
|
|
|
658
|
-
declare type ResolvedTheme = Required<Omit<Theme, "font">> & Pick<Theme, "font">;
|
|
660
|
+
declare type ResolvedTheme = Required<Omit<Theme, "font" | HeaderToken>> & Pick<Theme, "font" | HeaderToken>;
|
|
659
661
|
export { ResolvedTheme }
|
|
660
662
|
export { ResolvedTheme as ResolvedTheme_alias_1 }
|
|
661
663
|
|
|
@@ -845,6 +847,15 @@ declare type Theme = {
|
|
|
845
847
|
* "rgba(0,0,0,0.22)"). Also tints the header tree connector lines if no
|
|
846
848
|
* gridColor contrast is desired. */
|
|
847
849
|
groupShadowColor?: string;
|
|
850
|
+
/** the row-header column and the time bar: background, text, their borders and the column's row
|
|
851
|
+
* dividers, and the column's shadow onto the rows ("none" for none). Unset, the stylesheet's
|
|
852
|
+
* dark header with yellow borders applies. */
|
|
853
|
+
headerBackground?: string;
|
|
854
|
+
headerTextColor?: string;
|
|
855
|
+
headerBorderColor?: string;
|
|
856
|
+
headerShadow?: string;
|
|
857
|
+
/** the frame around the rows; unset, the stylesheet's black applies */
|
|
858
|
+
borderColor?: string;
|
|
848
859
|
};
|
|
849
860
|
export { Theme }
|
|
850
861
|
export { Theme as Theme_alias_1 }
|
package/dist/index.js
CHANGED
|
@@ -557,8 +557,9 @@ var CanvasTimeBar = ({
|
|
|
557
557
|
theme,
|
|
558
558
|
timeBar
|
|
559
559
|
}) => {
|
|
560
|
-
var _a, _b;
|
|
560
|
+
var _a, _b, _c;
|
|
561
561
|
const canvasRef = (0, import_react4.useRef)(null);
|
|
562
|
+
const header = theme != null ? theme : DEFAULT_THEME;
|
|
562
563
|
const topRow = (_a = timeBar == null ? void 0 : timeBar.topRow) != null ? _a : { unit: "day" };
|
|
563
564
|
const bottomRow = (_b = timeBar == null ? void 0 : timeBar.bottomRow) != null ? _b : { unit: "hour" };
|
|
564
565
|
(0, import_react4.useEffect)(() => {
|
|
@@ -587,24 +588,33 @@ var CanvasTimeBar = ({
|
|
|
587
588
|
}))
|
|
588
589
|
});
|
|
589
590
|
}, [windowTime, tick, contentWidth, theme, timeBar]);
|
|
590
|
-
return /* @__PURE__ */ import_react4.default.createElement(
|
|
591
|
-
"canvas",
|
|
592
|
-
{
|
|
593
|
-
ref: canvasRef,
|
|
594
|
-
className: "canvas-time-bar",
|
|
595
|
-
style: { minWidth: contentWidth ? contentWidth : 0 }
|
|
596
|
-
}
|
|
597
|
-
), scrollWidth ? /* @__PURE__ */ import_react4.default.createElement(
|
|
591
|
+
return /* @__PURE__ */ import_react4.default.createElement(
|
|
598
592
|
"div",
|
|
599
593
|
{
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
594
|
+
className: "time-bar",
|
|
595
|
+
style: { background: header.headerBackground, color: header.headerTextColor, borderColor: header.headerBorderColor }
|
|
596
|
+
},
|
|
597
|
+
/* @__PURE__ */ import_react4.default.createElement("div", { className: "empty-block", style: { borderRightColor: header.headerBorderColor } }),
|
|
598
|
+
/* @__PURE__ */ import_react4.default.createElement(
|
|
599
|
+
"canvas",
|
|
600
|
+
{
|
|
601
|
+
ref: canvasRef,
|
|
602
|
+
className: "canvas-time-bar",
|
|
603
|
+
style: { minWidth: contentWidth ? contentWidth : 0 }
|
|
605
604
|
}
|
|
606
|
-
|
|
607
|
-
|
|
605
|
+
),
|
|
606
|
+
scrollWidth ? /* @__PURE__ */ import_react4.default.createElement(
|
|
607
|
+
"div",
|
|
608
|
+
{
|
|
609
|
+
style: {
|
|
610
|
+
width: scrollWidth,
|
|
611
|
+
height: "100%",
|
|
612
|
+
boxSizing: "border-box",
|
|
613
|
+
borderLeft: `1px solid ${(_c = header.headerBorderColor) != null ? _c : "yellow"}`
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
) : null
|
|
617
|
+
);
|
|
608
618
|
};
|
|
609
619
|
var canvas_time_bar_default = CanvasTimeBar;
|
|
610
620
|
|
|
@@ -2002,6 +2012,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2002
2012
|
applySelection,
|
|
2003
2013
|
getSelection
|
|
2004
2014
|
}, contentRef) => {
|
|
2015
|
+
var _a;
|
|
2005
2016
|
const staticCanvasRef = (0, import_react6.useRef)(null);
|
|
2006
2017
|
const dynamicCanvasRef = (0, import_react6.useRef)(null);
|
|
2007
2018
|
const ghostRef = (0, import_react6.useRef)(null);
|
|
@@ -2024,8 +2035,8 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2024
2035
|
};
|
|
2025
2036
|
}, [scene, rendererRef]);
|
|
2026
2037
|
(0, import_react6.useEffect)(() => {
|
|
2027
|
-
var
|
|
2028
|
-
(
|
|
2038
|
+
var _a2, _b;
|
|
2039
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.animator.setDurations(
|
|
2029
2040
|
animations.layoutMs,
|
|
2030
2041
|
animations.fadeMs
|
|
2031
2042
|
);
|
|
@@ -2050,14 +2061,14 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2050
2061
|
rendererRef
|
|
2051
2062
|
]);
|
|
2052
2063
|
const measureViewport = (0, import_react6.useCallback)(() => {
|
|
2053
|
-
var
|
|
2064
|
+
var _a2;
|
|
2054
2065
|
const column = contentRef && "current" in contentRef ? contentRef.current : null;
|
|
2055
2066
|
const body = bodyRef.current;
|
|
2056
2067
|
if (!column || !body) return;
|
|
2057
2068
|
const cap = totalHeightRef.current > 0 ? totalHeightRef.current : Infinity;
|
|
2058
2069
|
const height = Math.min(body.clientHeight, cap, window.innerHeight);
|
|
2059
2070
|
setViewportHeight(height);
|
|
2060
|
-
(
|
|
2071
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({
|
|
2061
2072
|
width: column.getBoundingClientRect().width,
|
|
2062
2073
|
height
|
|
2063
2074
|
});
|
|
@@ -2076,8 +2087,8 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2076
2087
|
const body = bodyRef.current;
|
|
2077
2088
|
if (!body) return;
|
|
2078
2089
|
const handleScroll = () => {
|
|
2079
|
-
var
|
|
2080
|
-
(
|
|
2090
|
+
var _a2;
|
|
2091
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({ scrollTop: body.scrollTop });
|
|
2081
2092
|
setScrollTop(body.scrollTop);
|
|
2082
2093
|
};
|
|
2083
2094
|
body.addEventListener("scroll", handleScroll, { passive: true });
|
|
@@ -2102,14 +2113,14 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2102
2113
|
wrapper.appendChild(measurer);
|
|
2103
2114
|
let lastWidth = -1;
|
|
2104
2115
|
const measure = () => {
|
|
2105
|
-
var
|
|
2116
|
+
var _a2;
|
|
2106
2117
|
const width = wrapper.clientWidth;
|
|
2107
2118
|
if (width === 0 || width === lastWidth) return;
|
|
2108
2119
|
lastWidth = width;
|
|
2109
2120
|
measurer.style.width = `${width}px`;
|
|
2110
2121
|
const heights = /* @__PURE__ */ new Map();
|
|
2111
2122
|
for (const row of rows) {
|
|
2112
|
-
measurer.textContent = (
|
|
2123
|
+
measurer.textContent = (_a2 = row.name) != null ? _a2 : "";
|
|
2113
2124
|
heights.set(
|
|
2114
2125
|
row.id,
|
|
2115
2126
|
Math.ceil(measurer.offsetHeight) + 2 * theme.rowPaddingY
|
|
@@ -2180,8 +2191,8 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2180
2191
|
getSelection
|
|
2181
2192
|
});
|
|
2182
2193
|
(0, import_react6.useEffect)(() => {
|
|
2183
|
-
var
|
|
2184
|
-
(
|
|
2194
|
+
var _a2;
|
|
2195
|
+
(_a2 = rendererRef.current) == null ? void 0 : _a2.setView({
|
|
2185
2196
|
selectedEventIds: new Set(getSelection())
|
|
2186
2197
|
});
|
|
2187
2198
|
}, [getSelection, rendererRef]);
|
|
@@ -2220,7 +2231,7 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2220
2231
|
style: {
|
|
2221
2232
|
top,
|
|
2222
2233
|
height,
|
|
2223
|
-
borderBottom: i === rows.length - 1 ? "none" :
|
|
2234
|
+
borderBottom: i === rows.length - 1 ? "none" : `1px solid ${(_a = theme.headerBorderColor) != null ? _a : "yellow"}`,
|
|
2224
2235
|
// Row heights/positions apply instantly (no layout tween) so the
|
|
2225
2236
|
// header snaps in lockstep with its canvas row — see draw-events.
|
|
2226
2237
|
// Grouped rows left-align so the caret + tree spine line up; plain
|
|
@@ -2294,7 +2305,13 @@ var CanvasBoard = (0, import_react6.forwardRef)(
|
|
|
2294
2305
|
{
|
|
2295
2306
|
ref: headerWrapperRef,
|
|
2296
2307
|
className: headerClassNames,
|
|
2297
|
-
style: {
|
|
2308
|
+
style: {
|
|
2309
|
+
height: totalHeight,
|
|
2310
|
+
background: theme.headerBackground,
|
|
2311
|
+
color: theme.headerTextColor,
|
|
2312
|
+
borderRightColor: theme.headerBorderColor,
|
|
2313
|
+
boxShadow: theme.headerShadow
|
|
2314
|
+
}
|
|
2298
2315
|
},
|
|
2299
2316
|
visibleHeaders,
|
|
2300
2317
|
renderRowLabel && // off-screen: renders every row's custom header so its natural height can be measured
|
|
@@ -3053,7 +3070,7 @@ var Timeline = (0, import_react7.forwardRef)(
|
|
|
3053
3070
|
theme: resolvedTheme,
|
|
3054
3071
|
timeBar
|
|
3055
3072
|
}
|
|
3056
|
-
), /* @__PURE__ */ import_react7.default.createElement("div", { className: "body-wrapper", ref: bodyRef }, /* @__PURE__ */ import_react7.default.createElement(
|
|
3073
|
+
), /* @__PURE__ */ import_react7.default.createElement("div", { className: "body-wrapper", ref: bodyRef, style: { borderColor: resolvedTheme.borderColor } }, /* @__PURE__ */ import_react7.default.createElement(
|
|
3057
3074
|
canvas_board_default,
|
|
3058
3075
|
{
|
|
3059
3076
|
scene,
|