awesome-timeline-react 0.12.0 → 0.13.1

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 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
@@ -283,15 +283,18 @@ export declare const drawRowDividers: (ctx: CanvasRenderingContext2D, view: Rend
283
283
  /**
284
284
  * Two-row time bar (top row over bottom row) — canvas replacement for the
285
285
  * day/hour block divs of time-bar.tsx. The two rows are unit-agnostic
286
- * (day/hour by default, configurable via TimeBarConfig). Background is left
287
- * transparent so the .time-bar container color shows through.
286
+ * (day/hour by default, configurable via TimeBarConfig). A row without its own
287
+ * background is left transparent, so the .time-bar container color shows through.
288
288
  */
289
- export declare const drawTimeBar: (ctx: CanvasRenderingContext2D, { width, height, topBlocks, bottomBlocks, font, borderColor, textColor, }: {
289
+ export declare const drawTimeBar: (ctx: CanvasRenderingContext2D, { width, height, topBlocks, bottomBlocks, font, borderColor, textColor, topBackground, bottomBackground, bottomTextColor, }: {
290
290
  width: number;
291
291
  height: number;
292
292
  font: string;
293
293
  borderColor?: string;
294
294
  textColor?: string;
295
+ topBackground?: string;
296
+ bottomBackground?: string;
297
+ bottomTextColor?: string;
295
298
  topBlocks: TimeBlock[];
296
299
  bottomBlocks: TimeBlock[];
297
300
  }) => void;
@@ -491,7 +494,7 @@ export declare type Geometry = {
491
494
  /** Derive the full Geometry from the resolved theme's geometry tokens. */
492
495
  export declare const geometryFromTheme: (theme: ResolvedTheme) => Geometry;
493
496
 
494
- declare type HeaderToken = "headerBackground" | "headerTextColor" | "headerBorderColor" | "headerShadow" | "borderColor";
497
+ declare type HeaderToken = "headerBackground" | "headerTextColor" | "headerBorderColor" | "headerShadow" | "borderColor" | "timeBarTopBackground" | "timeBarBottomBackground" | "timeBarBottomTextColor";
495
498
 
496
499
  export declare type HitTarget = {
497
500
  kind: "event" | "static";
@@ -864,6 +867,12 @@ declare type Theme = {
864
867
  gridColor?: string;
865
868
  timeBarBorder?: string;
866
869
  timeBarTextColor?: string;
870
+ /** fills of the time bar's top and bottom rows, so the two read apart; unset, both show the
871
+ * header background */
872
+ timeBarTopBackground?: string;
873
+ timeBarBottomBackground?: string;
874
+ /** the bottom row's labels; unset, `timeBarTextColor` */
875
+ timeBarBottomTextColor?: string;
867
876
  /** opacity applied to NON-selected events while a selection is active, so the
868
877
  * selection stands out (default 0.35). 1 disables dimming. */
869
878
  dimmedOpacity?: number;
@@ -980,12 +989,6 @@ declare const Timeline: React_2.ForwardRefExoticComponent<TimelineProps & React_
980
989
  export { Timeline }
981
990
  export { Timeline as Timeline_alias_1 }
982
991
 
983
- /**
984
- * `timeBar.auto`: the rows follow the zoom (day/hour → day/6 h → week/day → month/week → year/month),
985
- * and the grid follows the bottom row. Zoom with the buttons or ctrl/cmd + wheel; no block may get
986
- * narrower than 40 px. "Uneven blocks" swaps the two finest levels for a `boundaries` row: three
987
- * blocks a weekday and one over the weekend.
988
- */
989
992
  export declare const TimelineAutoTimeBar: () => React_2.JSX.Element;
990
993
 
991
994
  export declare const TimelineCanvas: () => React_2.JSX.Element;
@@ -1088,6 +1091,14 @@ export declare const TimelineLaneStacking: () => React_2.JSX.Element;
1088
1091
  */
1089
1092
  export declare const TimelineLongRowLabels: () => React_2.JSX.Element;
1090
1093
 
1094
+ /**
1095
+ * Long bars running across two months of unavailable bands (every night 22:00–06:00 and every
1096
+ * weekend), with `stripeOverlap` on. "Auto-pan" scrolls the window by a fixed step for 120 frames and
1097
+ * reports the mean frame time, so one pan can be compared across: the first long bar selected or not,
1098
+ * a long bar on every track or only the first, and a second timeline kept in step below.
1099
+ */
1100
+ export declare const TimelineLongStripedBar: () => React_2.JSX.Element;
1101
+
1091
1102
  /**
1092
1103
  * A small, sub-day window (~6h). With a window narrower than a day the time
1093
1104
  * bar must still track the hour labels to the actual time as you pan — pan the
@@ -283,15 +283,18 @@ export declare const drawRowDividers: (ctx: CanvasRenderingContext2D, view: Rend
283
283
  /**
284
284
  * Two-row time bar (top row over bottom row) — canvas replacement for the
285
285
  * day/hour block divs of time-bar.tsx. The two rows are unit-agnostic
286
- * (day/hour by default, configurable via TimeBarConfig). Background is left
287
- * transparent so the .time-bar container color shows through.
286
+ * (day/hour by default, configurable via TimeBarConfig). A row without its own
287
+ * background is left transparent, so the .time-bar container color shows through.
288
288
  */
289
- export declare const drawTimeBar: (ctx: CanvasRenderingContext2D, { width, height, topBlocks, bottomBlocks, font, borderColor, textColor, }: {
289
+ export declare const drawTimeBar: (ctx: CanvasRenderingContext2D, { width, height, topBlocks, bottomBlocks, font, borderColor, textColor, topBackground, bottomBackground, bottomTextColor, }: {
290
290
  width: number;
291
291
  height: number;
292
292
  font: string;
293
293
  borderColor?: string;
294
294
  textColor?: string;
295
+ topBackground?: string;
296
+ bottomBackground?: string;
297
+ bottomTextColor?: string;
295
298
  topBlocks: TimeBlock[];
296
299
  bottomBlocks: TimeBlock[];
297
300
  }) => void;
@@ -491,7 +494,7 @@ export declare type Geometry = {
491
494
  /** Derive the full Geometry from the resolved theme's geometry tokens. */
492
495
  export declare const geometryFromTheme: (theme: ResolvedTheme) => Geometry;
493
496
 
494
- declare type HeaderToken = "headerBackground" | "headerTextColor" | "headerBorderColor" | "headerShadow" | "borderColor";
497
+ declare type HeaderToken = "headerBackground" | "headerTextColor" | "headerBorderColor" | "headerShadow" | "borderColor" | "timeBarTopBackground" | "timeBarBottomBackground" | "timeBarBottomTextColor";
495
498
 
496
499
  export declare type HitTarget = {
497
500
  kind: "event" | "static";
@@ -864,6 +867,12 @@ declare type Theme = {
864
867
  gridColor?: string;
865
868
  timeBarBorder?: string;
866
869
  timeBarTextColor?: string;
870
+ /** fills of the time bar's top and bottom rows, so the two read apart; unset, both show the
871
+ * header background */
872
+ timeBarTopBackground?: string;
873
+ timeBarBottomBackground?: string;
874
+ /** the bottom row's labels; unset, `timeBarTextColor` */
875
+ timeBarBottomTextColor?: string;
867
876
  /** opacity applied to NON-selected events while a selection is active, so the
868
877
  * selection stands out (default 0.35). 1 disables dimming. */
869
878
  dimmedOpacity?: number;
@@ -980,12 +989,6 @@ declare const Timeline: React_2.ForwardRefExoticComponent<TimelineProps & React_
980
989
  export { Timeline }
981
990
  export { Timeline as Timeline_alias_1 }
982
991
 
983
- /**
984
- * `timeBar.auto`: the rows follow the zoom (day/hour → day/6 h → week/day → month/week → year/month),
985
- * and the grid follows the bottom row. Zoom with the buttons or ctrl/cmd + wheel; no block may get
986
- * narrower than 40 px. "Uneven blocks" swaps the two finest levels for a `boundaries` row: three
987
- * blocks a weekday and one over the weekend.
988
- */
989
992
  export declare const TimelineAutoTimeBar: () => React_2.JSX.Element;
990
993
 
991
994
  export declare const TimelineCanvas: () => React_2.JSX.Element;
@@ -1088,6 +1091,14 @@ export declare const TimelineLaneStacking: () => React_2.JSX.Element;
1088
1091
  */
1089
1092
  export declare const TimelineLongRowLabels: () => React_2.JSX.Element;
1090
1093
 
1094
+ /**
1095
+ * Long bars running across two months of unavailable bands (every night 22:00–06:00 and every
1096
+ * weekend), with `stripeOverlap` on. "Auto-pan" scrolls the window by a fixed step for 120 frames and
1097
+ * reports the mean frame time, so one pan can be compared across: the first long bar selected or not,
1098
+ * a long bar on every track or only the first, and a second timeline kept in step below.
1099
+ */
1100
+ export declare const TimelineLongStripedBar: () => React_2.JSX.Element;
1101
+
1091
1102
  /**
1092
1103
  * A small, sub-day window (~6h). With a window narrower than a day the time
1093
1104
  * bar must still track the hour labels to the actual time as you pan — pan the
package/dist/index.js CHANGED
@@ -594,9 +594,20 @@ var drawTimeBar = (ctx, {
594
594
  bottomBlocks,
595
595
  font,
596
596
  borderColor = DEFAULT_THEME.timeBarBorder,
597
- textColor = DEFAULT_THEME.timeBarTextColor
597
+ textColor = DEFAULT_THEME.timeBarTextColor,
598
+ topBackground,
599
+ bottomBackground,
600
+ bottomTextColor = textColor
598
601
  }) => {
599
602
  const mid = height / 2;
603
+ if (topBackground) {
604
+ ctx.fillStyle = topBackground;
605
+ ctx.fillRect(0, 0, width, Math.round(mid));
606
+ }
607
+ if (bottomBackground) {
608
+ ctx.fillStyle = bottomBackground;
609
+ ctx.fillRect(0, Math.round(mid), width, height - Math.round(mid));
610
+ }
600
611
  ctx.strokeStyle = borderColor;
601
612
  ctx.lineWidth = 1;
602
613
  ctx.beginPath();
@@ -628,6 +639,7 @@ var drawTimeBar = (ctx, {
628
639
  block.width - inset
629
640
  );
630
641
  }
642
+ ctx.fillStyle = bottomTextColor;
631
643
  for (const block of bottomBlocks) {
632
644
  ctx.fillText(
633
645
  block.label,
@@ -653,7 +665,7 @@ var CanvasTimeBar = ({
653
665
  const canvasRef = (0, import_react4.useRef)(null);
654
666
  const header = theme != null ? theme : DEFAULT_THEME;
655
667
  (0, import_react4.useEffect)(() => {
656
- var _a2;
668
+ var _a2, _b;
657
669
  const canvas = canvasRef.current;
658
670
  if (!canvas || !contentWidth) return;
659
671
  const ctx = sizeCanvas(
@@ -671,6 +683,9 @@ var CanvasTimeBar = ({
671
683
  font: (_a2 = theme == null ? void 0 : theme.font) != null ? _a2 : getComputedStyle(canvas).font,
672
684
  borderColor: theme == null ? void 0 : theme.timeBarBorder,
673
685
  textColor: theme == null ? void 0 : theme.timeBarTextColor,
686
+ topBackground: theme == null ? void 0 : theme.timeBarTopBackground,
687
+ bottomBackground: theme == null ? void 0 : theme.timeBarBottomBackground,
688
+ bottomTextColor: (_b = theme == null ? void 0 : theme.timeBarBottomTextColor) != null ? _b : theme == null ? void 0 : theme.timeBarTextColor,
674
689
  topBlocks: generateUnitBlocks(__spreadProps(__spreadValues({}, topRow), { windowStart, windowEnd, tick })),
675
690
  bottomBlocks: generateUnitBlocks(__spreadProps(__spreadValues({}, bottomRow), {
676
691
  windowStart,
@@ -1107,6 +1122,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
1107
1122
  defaultDrawEvent(ctx, event, rect, view, font, geometry.barRadius);
1108
1123
  }
1109
1124
  if (view.stripeOverlap && rowStatics.length > 0) {
1125
+ ctx.shadowColor = "transparent";
1110
1126
  paintOverlapStripes(
1111
1127
  ctx,
1112
1128
  event,