@taskctrl/canvas-timeline 0.6.0 → 0.7.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.
@@ -1,6 +1,6 @@
1
- import { jsx as le, jsxs as Ve, Fragment as Qt } from "react/jsx-runtime";
2
- import me, { useRef as U, useMemo as ee, useCallback as oe, useEffect as ce, forwardRef as Ci, useState as Ze, useImperativeHandle as Ei } from "react";
3
- import { flushSync as Hi } from "react-dom";
1
+ import { jsx as le, jsxs as Ve, Fragment as ei } from "react/jsx-runtime";
2
+ import me, { useRef as U, useMemo as ee, useCallback as oe, useEffect as ce, forwardRef as Ei, useState as Ze, useImperativeHandle as Hi } from "react";
3
+ import { flushSync as Di } from "react-dom";
4
4
  import We from "dayjs";
5
5
  const He = {
6
6
  primary: "#269bf7",
@@ -143,7 +143,7 @@ class yt {
143
143
  return this.groupYOffsets[this.groupCount] ?? 0;
144
144
  }
145
145
  }
146
- class Di {
146
+ class Ii {
147
147
  constructor() {
148
148
  Object.defineProperty(this, "root", {
149
149
  enumerable: !0,
@@ -188,7 +188,7 @@ class Di {
188
188
  }
189
189
  }
190
190
  }
191
- class Ii {
191
+ class Ri {
192
192
  constructor(e, t) {
193
193
  Object.defineProperty(this, "lineHeight", {
194
194
  enumerable: !0,
@@ -281,7 +281,7 @@ class Ii {
281
281
  return ((this.groupMaxStack.get(e) ?? 0) + 1) * this.lineHeight;
282
282
  }
283
283
  }
284
- class Ri {
284
+ class Oi {
285
285
  constructor() {
286
286
  Object.defineProperty(this, "parentToChildren", {
287
287
  enumerable: !0,
@@ -405,7 +405,7 @@ class Ri {
405
405
  }
406
406
  }
407
407
  }
408
- function Oi(i, e, t, n, o, d) {
408
+ function Pi(i, e, t, n, o, d) {
409
409
  const { x: s, y: c, width: a, height: b } = t, H = d.primary;
410
410
  i.globalAlpha = 0.15, i.fillStyle = H, i.fillRect(s, c, a, b), i.globalAlpha = 1, i.strokeStyle = H, i.lineWidth = 1.5, i.strokeRect(s, c, a, b);
411
411
  const p = Math.min(b * 0.5, 6), f = c + b / 2;
@@ -450,6 +450,9 @@ function Gt(i, e, t, n = 6) {
450
450
  const o = t.timeToX(e.start_time), d = t.timeToX(e.end_time);
451
451
  return i - o <= n ? "left" : d - i <= n ? "right" : "body";
452
452
  }
453
+ function Nt(i, e) {
454
+ return i.canResize ?? e;
455
+ }
453
456
  function St(i, e, t) {
454
457
  const n = window.devicePixelRatio || 1, o = Math.round(e * n), d = Math.round(t * n);
455
458
  (i.width !== o || i.height !== d) && (i.width = o, i.height = d, i.style.width = `${e}px`, i.style.height = `${t}px`);
@@ -460,7 +463,7 @@ function Mt(i, e) {
460
463
  const t = window.devicePixelRatio || 1;
461
464
  i.clearRect(0, 0, e.width / t, e.height / t);
462
465
  }
463
- class Pi {
466
+ class Xi {
464
467
  constructor(e) {
465
468
  Object.defineProperty(this, "dirty", {
466
469
  enumerable: !0,
@@ -500,7 +503,7 @@ var lt = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
500
503
  function at(i) {
501
504
  return i && i.__esModule && Object.prototype.hasOwnProperty.call(i, "default") ? i.default : i;
502
505
  }
503
- var ei = { exports: {} };
506
+ var ti = { exports: {} };
504
507
  (function(i, e) {
505
508
  (function(t, n) {
506
509
  i.exports = n();
@@ -572,10 +575,10 @@ var ei = { exports: {} };
572
575
  };
573
576
  };
574
577
  });
575
- })(ei);
576
- var Xi = ei.exports;
577
- const $i = /* @__PURE__ */ at(Xi);
578
- var ti = { exports: {} };
578
+ })(ti);
579
+ var $i = ti.exports;
580
+ const Fi = /* @__PURE__ */ at($i);
581
+ var ii = { exports: {} };
579
582
  (function(i, e) {
580
583
  (function(t, n) {
581
584
  i.exports = n();
@@ -635,15 +638,15 @@ var ti = { exports: {} };
635
638
  };
636
639
  };
637
640
  });
638
- })(ti);
639
- var Fi = ti.exports;
640
- const Yi = /* @__PURE__ */ at(Fi);
641
- We.extend($i);
642
- We.extend(Yi);
641
+ })(ii);
642
+ var Yi = ii.exports;
643
+ const _i = /* @__PURE__ */ at(Yi);
644
+ We.extend(Fi);
645
+ We.extend(_i);
643
646
  function Te(i, e) {
644
647
  return e ? We(i).tz(e) : We(i);
645
648
  }
646
- class _i {
649
+ class Wi {
647
650
  draw(e, t, n, o, d, s, c, a) {
648
651
  const { firstVisible: b, lastVisible: H } = t.getVisibleGroupRange();
649
652
  for (let y = b; y <= H; y++) {
@@ -705,8 +708,8 @@ class _i {
705
708
  }
706
709
  }
707
710
  }
708
- const Nt = '500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
709
- function ii(i, e) {
711
+ const Zt = '500 12px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif';
712
+ function ni(i, e) {
710
713
  return {
711
714
  /**
712
715
  * Draws a filled rounded rectangle.
@@ -721,7 +724,7 @@ function ii(i, e) {
721
724
  * and appends '...' so it fits within maxWidth.
722
725
  */
723
726
  fillText(t, n, o, d) {
724
- if (i.font = Nt, d !== void 0 && i.measureText(t).width > d) {
727
+ if (i.font = Zt, d !== void 0 && i.measureText(t).width > d) {
725
728
  let s = 0, c = t.length;
726
729
  for (; s < c; ) {
727
730
  const a = Math.ceil((s + c) / 2), b = t.slice(0, a) + "...";
@@ -770,13 +773,13 @@ function ii(i, e) {
770
773
  * Draws a pill-shaped badge with centered white text on a colored background.
771
774
  */
772
775
  badge(t, n, o, d) {
773
- i.save(), i.font = Nt;
776
+ i.save(), i.font = Zt;
774
777
  const c = i.measureText(t).width, a = 8, H = 12 + 3 * 2, p = c + a * 2, f = H / 2;
775
778
  i.fillStyle = d, i.beginPath(), i.roundRect(n, o, p, H, f), i.fill(), i.fillStyle = "#ffffff", i.textAlign = "center", i.textBaseline = "middle", i.fillText(t, n + p / 2, o + H / 2), i.restore();
776
779
  }
777
780
  };
778
781
  }
779
- class Wi {
782
+ class Bi {
780
783
  draw(e, t, n, o, d, s, c, a, b, H, p, f, M, T) {
781
784
  const h = (t.visibleTimeEnd - t.visibleTimeStart) * 0.1, E = t.visibleTimeStart - h, P = t.visibleTimeEnd + h, W = d.query(E, P), y = /* @__PURE__ */ new Map();
782
785
  for (let I = 0; I < n.length; I++)
@@ -801,7 +804,7 @@ class Wi {
801
804
  filtered: I.filtered !== !1
802
805
  };
803
806
  e.save();
804
- const qe = ii(e, Me);
807
+ const qe = ni(e, Me);
805
808
  let De;
806
809
  M && (T != null && T.isParent(I.id)) ? De = M : a && (I.type === "control_area_group" || I.type === "construction_train") ? De = a : De = c, De(e, I, Me, Xe, qe), e.restore();
807
810
  }
@@ -841,7 +844,7 @@ class Wi {
841
844
  }
842
845
  }
843
846
  }
844
- class Bi {
847
+ class Li {
845
848
  draw(e, t, n, o) {
846
849
  const { cursorX: d, snapX: s, markers: c, interaction: a } = o;
847
850
  if (c)
@@ -857,17 +860,17 @@ class Bi {
857
860
  }
858
861
  if (d != null && (e.strokeStyle = n.marker.cursor, e.lineWidth = 1, e.beginPath(), e.moveTo(d, 0), e.lineTo(d, t.canvasHeight), e.stroke()), s != null && (e.strokeStyle = n.primary, e.lineWidth = 1, e.setLineDash([4, 4]), e.beginPath(), e.moveTo(s, 0), e.lineTo(s, t.canvasHeight), e.stroke(), e.setLineDash([])), a) {
859
862
  a.groupChanged && a.targetGroupY !== void 0 && (e.fillStyle = "rgba(59, 130, 246, 0.08)", e.fillRect(0, a.targetGroupY, t.canvasWidth, t.lineHeight)), e.save(), e.globalAlpha = 0.5;
860
- const b = ii(e, a.bounds);
863
+ const b = ni(e, a.bounds);
861
864
  a.renderer(e, a.item, a.bounds, { selected: !1, hovered: !1, dragging: !0, filtered: !0 }, b), e.restore();
862
865
  }
863
866
  }
864
867
  }
865
- const Zt = 120;
866
- function Li(i) {
868
+ const Ut = 120;
869
+ function zi(i) {
867
870
  let e = i.deltaY || i.deltaX;
868
- return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-Zt, Math.min(Zt, e));
871
+ return i.deltaMode === 1 ? e *= 15 : i.deltaMode === 2 && (e *= 800), Math.max(-Ut, Math.min(Ut, e));
869
872
  }
870
- class zi {
873
+ class xi {
871
874
  constructor(e, t, n, o, d) {
872
875
  Object.defineProperty(this, "onZoom", {
873
876
  enumerable: !0,
@@ -900,15 +903,15 @@ class zi {
900
903
  this.visibleTimeStart = e, this.visibleTimeEnd = t;
901
904
  }
902
905
  handleWheelZoom(e, t) {
903
- const n = Li(e), o = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, d = n > 0 ? 1 + o * n / 500 : 1 / (1 + o * -n / 500), s = this.visibleTimeEnd - this.visibleTimeStart;
906
+ const n = zi(e), o = e.ctrlKey ? 10 : e.metaKey ? 3 : 1, d = n > 0 ? 1 + o * n / 500 : 1 / (1 + o * -n / 500), s = this.visibleTimeEnd - this.visibleTimeStart;
904
907
  let c = Math.round(s * d);
905
908
  c = Math.max(this.minZoom, Math.min(this.maxZoom, c));
906
909
  const a = Math.round(this.visibleTimeStart + (s - c) * t), b = a + c;
907
910
  this.onZoom(a, b);
908
911
  }
909
912
  }
910
- const xi = 4;
911
- class Ai {
913
+ const Ai = 4;
914
+ class ji {
912
915
  constructor(e) {
913
916
  Object.defineProperty(this, "state", {
914
917
  enumerable: !0,
@@ -941,7 +944,7 @@ class Ai {
941
944
  }, this.activated = !1;
942
945
  }
943
946
  update(e, t) {
944
- this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= xi && (this.activated = !0));
947
+ this.state && (this.state.currentX = e, this.state.currentY = t, this.state.deltaX = e - this.state.startX, !this.activated && Math.abs(this.state.deltaX) >= Ai && (this.activated = !0));
945
948
  }
946
949
  setCurrentGroup(e) {
947
950
  this.state && (this.state.currentGroup = e);
@@ -991,7 +994,7 @@ function st(i, e, t, n, o) {
991
994
  }
992
995
  return s <= t ? d : null;
993
996
  }
994
- var ni = { exports: {} };
997
+ var ri = { exports: {} };
995
998
  (function(i, e) {
996
999
  (function(t, n) {
997
1000
  i.exports = n();
@@ -1017,10 +1020,10 @@ var ni = { exports: {} };
1017
1020
  };
1018
1021
  };
1019
1022
  });
1020
- })(ni);
1021
- var ji = ni.exports;
1022
- const Gi = /* @__PURE__ */ at(ji), Ut = 200;
1023
- function Vt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o, canvasHeight: d, theme: s, groupRenderer: c, onScroll: a }) {
1023
+ })(ri);
1024
+ var Gi = ri.exports;
1025
+ const Ni = /* @__PURE__ */ at(Gi), Vt = 200;
1026
+ function qt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o, canvasHeight: d, theme: s, groupRenderer: c, onScroll: a }) {
1024
1027
  var y;
1025
1028
  const b = U(null), H = U(!1), p = ee(() => {
1026
1029
  const D = new Array(i.length + 1);
@@ -1039,7 +1042,7 @@ function Vt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o,
1039
1042
  p[B + 1] > D ? $ = B : w = B + 1;
1040
1043
  }
1041
1044
  return w;
1042
- }, [i.length, p, f]), h = T(o - Ut), E = T(o + d + Ut), P = oe((D) => {
1045
+ }, [i.length, p, f]), h = T(o - Vt), E = T(o + d + Vt), P = oe((D) => {
1043
1046
  H.current || a(D.currentTarget.scrollTop);
1044
1047
  }, [a]);
1045
1048
  ce(() => {
@@ -1075,21 +1078,21 @@ function Vt({ groups: i, width: e, lineHeight: t, groupHeights: n, scrollTop: o,
1075
1078
  backgroundColor: s.sidebar.bg
1076
1079
  }, children: le("div", { style: { height: f, position: "relative" }, children: W }) });
1077
1080
  }
1078
- function Ni(i) {
1081
+ function Zi(i) {
1079
1082
  return null;
1080
1083
  }
1081
- Ni.displayName = "TodayMarker";
1082
- function qt(i) {
1084
+ Zi.displayName = "TodayMarker";
1085
+ function Kt(i) {
1083
1086
  return { date: Math.floor(Date.now() / 6e4) * 6e4, color: i.color ?? "#FD7171", width: i.width ?? 6, label: i.label };
1084
1087
  }
1085
- function Zi(i) {
1088
+ function Ui(i) {
1086
1089
  return i.interval ?? 1e4;
1087
1090
  }
1088
- function Ui(i) {
1091
+ function Vi(i) {
1089
1092
  return null;
1090
1093
  }
1091
- Ui.displayName = "CustomMarker";
1092
- function Kt(i) {
1094
+ Vi.displayName = "CustomMarker";
1095
+ function Jt(i) {
1093
1096
  return {
1094
1097
  date: i.date,
1095
1098
  color: i.color ?? "#3B82F6",
@@ -1097,8 +1100,8 @@ function Kt(i) {
1097
1100
  label: i.label
1098
1101
  };
1099
1102
  }
1100
- We.extend(Gi);
1101
- function Vi(i) {
1103
+ We.extend(Ni);
1104
+ function qi(i) {
1102
1105
  return i ? {
1103
1106
  ...He,
1104
1107
  ...i,
@@ -1110,20 +1113,20 @@ function Vi(i) {
1110
1113
  header: { ...He.header, ...i.header }
1111
1114
  } : He;
1112
1115
  }
1113
- const Jt = 32, cn = me.memo(Ci(function(e, t) {
1114
- const { groups: n, items: o, defaultTimeStart: d, defaultTimeEnd: s, sidebarWidth: c, lineHeight: a, itemHeightRatio: b, stackItems: H, canMove: p, canChangeGroup: f, canResize: M, dragSnap: T, minZoom: h, maxZoom: E, theme: P, dayStyle: W, rowStyle: y, showCursorLine: D, itemRenderer: w, groupRenderer: $, sidebarGroupRenderer: B, dependencies: I, highlights: A, onItemClick: F, onItemDoubleClick: se, onItemContextMenu: K, onItemMove: te, onItemResize: be, moveResizeValidator: Se, onItemHover: Me, onCanvasDoubleClick: Xe, onCanvasContextMenu: qe, onTimeChange: De, onZoom: kt, selected: Ct = [], rightSidebarWidth: ut, rightSidebarGroupRenderer: Et, onReady: Ke, maxHeight: Be, timezone: Je, devBadge: oi, children: ke } = e, we = ee(() => Vi(P), [P]), Ht = oe((r, l) => {
1116
+ const Qt = 32, dn = me.memo(Ei(function(e, t) {
1117
+ const { groups: n, items: o, defaultTimeStart: d, defaultTimeEnd: s, sidebarWidth: c, lineHeight: a, itemHeightRatio: b, stackItems: H, canMove: p, canChangeGroup: f, canResize: M, dragSnap: T, minZoom: h, maxZoom: E, theme: P, dayStyle: W, rowStyle: y, showCursorLine: D, itemRenderer: w, groupRenderer: $, sidebarGroupRenderer: B, dependencies: I, highlights: A, onItemClick: F, onItemDoubleClick: se, onItemContextMenu: K, onItemMove: te, onItemResize: be, moveResizeValidator: Se, onItemHover: Me, onCanvasDoubleClick: Xe, onCanvasContextMenu: qe, onTimeChange: De, onZoom: kt, selected: Ct = [], rightSidebarWidth: ut, rightSidebarGroupRenderer: Et, onReady: Ke, maxHeight: Be, timezone: Je, devBadge: si, children: ke } = e, we = ee(() => qi(P), [P]), Ht = oe((r, l) => {
1115
1118
  for (let m = 0; m < l.length; m++)
1116
1119
  if (l[m].id === r)
1117
1120
  return m;
1118
1121
  return 0;
1119
- }, []), si = Ct.join(","), ct = ee(() => Ct, [si]), Dt = U(null), It = U(null), Rt = U(null), Le = U(null), Ot = U(null), Pt = U(null), [li, ai] = Ze(800), [ui, ci] = Ze(null);
1122
+ }, []), li = Ct.join(","), ct = ee(() => Ct, [li]), Dt = U(null), It = U(null), Rt = U(null), Le = U(null), Ot = U(null), Pt = U(null), [ai, ui] = Ze(800), [ci, di] = Ze(null);
1120
1123
  ce(() => {
1121
1124
  const r = Ot.current;
1122
1125
  if (!r)
1123
1126
  return;
1124
1127
  const l = new ResizeObserver((m) => {
1125
1128
  const g = m[0];
1126
- g && ai(g.contentRect.width);
1129
+ g && ui(g.contentRect.width);
1127
1130
  });
1128
1131
  return l.observe(r), () => l.disconnect();
1129
1132
  }, []), ce(() => {
@@ -1132,20 +1135,20 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1132
1135
  return;
1133
1136
  const l = new ResizeObserver((m) => {
1134
1137
  const g = m[0];
1135
- g && ci(g.contentRect.height);
1138
+ g && di(g.contentRect.height);
1136
1139
  });
1137
1140
  return l.observe(r), () => l.disconnect();
1138
1141
  }, [Be]);
1139
- const Ce = Math.max(0, li - c - (ut ?? 0)), Ie = ee(() => {
1140
- const r = new Ri();
1142
+ const Ce = Math.max(0, ai - c - (ut ?? 0)), Ie = ee(() => {
1143
+ const r = new Oi();
1141
1144
  return r.rebuild(o), r;
1142
1145
  }, [o]), dt = ee(() => {
1143
- const r = new Di();
1146
+ const r = new Ii();
1144
1147
  return r.buildFromItems(o, (l) => Ie.getEffectiveSpan(l.id).start, (l) => Ie.getEffectiveSpan(l.id).end), r;
1145
1148
  }, [o, Ie]), ze = ee(() => {
1146
- const r = new Ii(a, b);
1149
+ const r = new Ri(a, b);
1147
1150
  return r.computeLayout(o, H, Ie), r;
1148
- }, [o, a, b, H, Ie]), Re = ee(() => n.map((r) => ze.getGroupHeight(r.id)), [n, ze]), Qe = ee(() => Re.reduce((r, l) => r + l, 0), [Re]), Xt = typeof Be == "number" ? Be : ui, ye = Xt ? Math.min(Qe, Xt) : Qe, L = U(new yt({
1151
+ }, [o, a, b, H, Ie]), Re = ee(() => n.map((r) => ze.getGroupHeight(r.id)), [n, ze]), Qe = ee(() => Re.reduce((r, l) => r + l, 0), [Re]), Xt = typeof Be == "number" ? Be : ci, ye = Xt ? Math.min(Qe, Xt) : Qe, L = U(new yt({
1149
1152
  visibleTimeStart: e.visibleTimeStart ?? d,
1150
1153
  visibleTimeEnd: e.visibleTimeEnd ?? s,
1151
1154
  canvasWidth: Ce,
@@ -1156,25 +1159,25 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1156
1159
  buffer: e.buffer ?? 3,
1157
1160
  scrollTop: 0,
1158
1161
  groupHeights: Re
1159
- })), ft = U(null), xe = U(void 0), ve = U(null), Oe = U(!1), $t = 4, [Ft, di] = Ze(e.visibleTimeStart ?? d), [Yt, fi] = Ze(e.visibleTimeEnd ?? s), [_t, et] = Ze(0), Ae = U(null), $e = oe(() => {
1162
+ })), ft = U(null), xe = U(void 0), ve = U(null), Oe = U(!1), $t = 4, [Ft, fi] = Ze(e.visibleTimeStart ?? d), [Yt, hi] = Ze(e.visibleTimeEnd ?? s), [_t, et] = Ze(0), Ae = U(null), $e = oe(() => {
1160
1163
  const r = L.current;
1161
- di(r.visibleTimeStart), fi(r.visibleTimeEnd), et(r.scrollTop), Ae.current = null;
1164
+ fi(r.visibleTimeStart), hi(r.visibleTimeEnd), et(r.scrollTop), Ae.current = null;
1162
1165
  }, []), ht = oe(() => {
1163
- Ae.current === null && (Ae.current = setTimeout($e, Jt));
1166
+ Ae.current === null && (Ae.current = setTimeout($e, Qt));
1164
1167
  }, [$e]);
1165
1168
  ce(() => () => {
1166
1169
  Ae.current !== null && clearTimeout(Ae.current);
1167
1170
  }, []);
1168
1171
  const Wt = ee(() => e.summaryRenderer ? e.summaryRenderer : (r, l, m, g, u) => {
1169
- Oi(r, l, m, g, u, we);
1170
- }, [e.summaryRenderer, we]), Fe = ee(() => new _i(), []), Ye = ee(() => new Wi(), []), _e = ee(() => new Bi(), []), ie = ee(() => new Ai(T), [T]), tt = ee(() => {
1172
+ Pi(r, l, m, g, u, we);
1173
+ }, [e.summaryRenderer, we]), Fe = ee(() => new Wi(), []), Ye = ee(() => new Bi(), []), _e = ee(() => new Li(), []), ie = ee(() => new ji(T), [T]), tt = ee(() => {
1171
1174
  const r = [];
1172
1175
  return me.Children.forEach(ke, (l) => {
1173
1176
  var g;
1174
1177
  if (!me.isValidElement(l))
1175
1178
  return;
1176
1179
  const m = (g = l.type) == null ? void 0 : g.displayName;
1177
- m === "TodayMarker" ? r.push(qt(l.props)) : m === "CustomMarker" && r.push(Kt(l.props));
1180
+ m === "TodayMarker" ? r.push(Kt(l.props)) : m === "CustomMarker" && r.push(Jt(l.props));
1178
1181
  }), r;
1179
1182
  }, [ke]), it = ee(() => tt.map((r) => `${r.date}|${r.color}|${r.width}|${r.label ?? ""}`).join(";"), [tt]), je = U(tt);
1180
1183
  je.current = tt;
@@ -1184,7 +1187,7 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1184
1187
  var g;
1185
1188
  if (!me.isValidElement(l))
1186
1189
  return;
1187
- ((g = l.type) == null ? void 0 : g.displayName) === "TodayMarker" && (r = Zi(l.props));
1190
+ ((g = l.type) == null ? void 0 : g.displayName) === "TodayMarker" && (r = Ui(l.props));
1188
1191
  }), r;
1189
1192
  }, [ke]), x = U({
1190
1193
  groups: n,
@@ -1262,13 +1265,13 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1262
1265
  hierarchyEngine: Ie,
1263
1266
  timezone: Je
1264
1267
  };
1265
- const hi = oe(() => {
1268
+ const mi = oe(() => {
1266
1269
  const r = Dt.current;
1267
1270
  if (!r)
1268
1271
  return;
1269
1272
  const l = x.current, m = St(r, l.canvasWidth, l.canvasHeight);
1270
1273
  Mt(m, r), Fe.draw(m, L.current, l.groups, l.theme, l.dayStyle, l.rowStyle, l.highlights, l.timezone);
1271
- }, [Fe]), mi = oe(() => {
1274
+ }, [Fe]), gi = oe(() => {
1272
1275
  const r = It.current;
1273
1276
  if (!r)
1274
1277
  return;
@@ -1285,7 +1288,7 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1285
1288
  }
1286
1289
  const ne = m === "resize-right" ? r.end_time + k : r.start_time + k, z = Math.round(ne / u.dragSnap) * u.dragSnap;
1287
1290
  return g.timeToX(z);
1288
- }, []), gi = oe(() => {
1291
+ }, []), pi = oe(() => {
1289
1292
  const r = Rt.current;
1290
1293
  if (!r)
1291
1294
  return;
@@ -1314,8 +1317,8 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1314
1317
  interaction: v
1315
1318
  });
1316
1319
  }, [_e, ie, Bt, Ht]), gt = U(null);
1317
- gt.current || (gt.current = new Pi((r) => {
1318
- r.grid && hi(), r.items && mi(), r.overlay && gi();
1320
+ gt.current || (gt.current = new Xi((r) => {
1321
+ r.grid && mi(), r.items && gi(), r.overlay && pi();
1319
1322
  }));
1320
1323
  const O = gt.current;
1321
1324
  ce(() => () => O.dispose(), [O]), ce(() => {
@@ -1328,7 +1331,7 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1328
1331
  if (!me.isValidElement(m))
1329
1332
  return;
1330
1333
  const g = (u = m.type) == null ? void 0 : u.displayName;
1331
- g === "TodayMarker" ? l.push(qt(m.props)) : g === "CustomMarker" && l.push(Kt(m.props));
1334
+ g === "TodayMarker" ? l.push(Kt(m.props)) : g === "CustomMarker" && l.push(Jt(m.props));
1332
1335
  }), je.current = l, O.markDirty("overlay");
1333
1336
  }, mt);
1334
1337
  return () => clearInterval(r);
@@ -1363,12 +1366,12 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1363
1366
  Ge.current = null;
1364
1367
  const l = L.current, m = x.current;
1365
1368
  r === "zoom" ? (g = m.onZoom) == null || g.call(m, l.visibleTimeStart, l.visibleTimeEnd) : (u = m.onTimeChange) == null || u.call(m, l.visibleTimeStart, l.visibleTimeEnd);
1366
- }, Jt));
1369
+ }, Qt));
1367
1370
  }, []);
1368
1371
  ce(() => () => {
1369
1372
  Ge.current !== null && clearTimeout(Ge.current);
1370
1373
  }, []);
1371
- const rt = U(null), vt = ee(() => new zi((r, l) => {
1374
+ const rt = U(null), vt = ee(() => new xi((r, l) => {
1372
1375
  var m;
1373
1376
  L.current.update({ visibleTimeStart: r, visibleTimeEnd: l }), (m = rt.current) == null || m.updateBounds(r, l), O.markAllDirty(), ht(), pt("zoom");
1374
1377
  }, d, s, h, E), []);
@@ -1379,7 +1382,7 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1379
1382
  }, [O]), Ne = oe((r) => {
1380
1383
  var k, R, X;
1381
1384
  const l = L.current, m = l.canvasWidth / (l.visibleTimeEnd - l.visibleTimeStart), g = r / m, u = l.visibleTimeStart + g, v = l.visibleTimeEnd + g;
1382
- l.update({ visibleTimeStart: u, visibleTimeEnd: v }), (k = rt.current) == null || k.updateBounds(u, v), O.markAllDirty(), Hi(() => $e()), (X = (R = x.current).onTimeChange) == null || X.call(R, u, v);
1385
+ l.update({ visibleTimeStart: u, visibleTimeEnd: v }), (k = rt.current) == null || k.updateBounds(u, v), O.markAllDirty(), Di(() => $e()), (X = (R = x.current).onTimeChange) == null || X.call(R, u, v);
1383
1386
  }, [O, $e]);
1384
1387
  ce(() => {
1385
1388
  const r = Le.current;
@@ -1427,7 +1430,7 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1427
1430
  r.removeEventListener("touchstart", g), r.removeEventListener("touchmove", u), r.removeEventListener("touchend", v);
1428
1431
  };
1429
1432
  }, [O, ht, pt]);
1430
- const pi = oe((r) => {
1433
+ const vi = oe((r) => {
1431
1434
  var X;
1432
1435
  const l = r.currentTarget, m = l.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top;
1433
1436
  if (ft.current = g, ve.current) {
@@ -1452,19 +1455,19 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1452
1455
  x.current.showCursorLine && O.markDirty("overlay");
1453
1456
  const v = x.current, k = Ue(g, u, L.current, v.intervalTree, v.layoutEngine, v.groups), R = k == null ? void 0 : k.id;
1454
1457
  if (R !== xe.current && (xe.current = R, O.markDirty("items"), (X = v.onItemHover) == null || X.call(v, R ?? null, r.nativeEvent)), k) {
1455
- const Y = Gt(g, k, L.current), N = v.canResize;
1458
+ const Y = Gt(g, k, L.current), N = Nt(k, v.canResize);
1456
1459
  Y === "left" && (N === "left" || N === "both") || Y === "right" && (N === "right" || N === "both") ? l.style.cursor = "col-resize" : v.canMove ? l.style.cursor = "grab" : l.style.cursor = "default";
1457
1460
  } else
1458
1461
  l.style.cursor = "default";
1459
- }, [ie, O, Ne, ot]), vi = oe((r) => {
1462
+ }, [ie, O, Ne, ot]), bi = oe((r) => {
1460
1463
  const l = x.current, m = r.currentTarget.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top, v = Ue(g, u, L.current, l.intervalTree, l.layoutEngine, l.groups);
1461
1464
  if (!v) {
1462
1465
  ve.current = { startX: r.clientX, startY: r.clientY, lastX: r.clientX, lastY: r.clientY }, Oe.current = !1;
1463
1466
  return;
1464
1467
  }
1465
- const k = Gt(g, v, L.current), R = l.canResize;
1468
+ const k = Gt(g, v, L.current), R = Nt(v, l.canResize);
1466
1469
  k === "left" && (R === "left" || R === "both") ? ie.startInteraction(v, "resize-left", g, u) : k === "right" && (R === "right" || R === "both") ? ie.startInteraction(v, "resize-right", g, u) : l.canMove && ie.startInteraction(v, "move", g, u);
1467
- }, [ie]), bi = oe((r) => {
1470
+ }, [ie]), yi = oe((r) => {
1468
1471
  var k, R, X, Y, N, ne;
1469
1472
  const l = r.currentTarget;
1470
1473
  if (ve.current) {
@@ -1512,7 +1515,7 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1512
1515
  ie.isPending() && ie.cancel();
1513
1516
  const m = l.getBoundingClientRect(), g = r.clientX - m.left, u = r.clientY - m.top, v = Ue(g, u, L.current, x.current.intervalTree, x.current.layoutEngine, x.current.groups);
1514
1517
  v && ((ne = (N = x.current).onItemClick) == null || ne.call(N, v.id, r.nativeEvent));
1515
- }, [ie, O]), yi = oe((r) => {
1518
+ }, [ie, O]), Ti = oe((r) => {
1516
1519
  var k, R;
1517
1520
  const l = r.currentTarget.getBoundingClientRect(), m = r.clientX - l.left, g = r.clientY - l.top, u = x.current, v = Ue(m, g, L.current, u.intervalTree, u.layoutEngine, u.groups);
1518
1521
  if (v)
@@ -1521,7 +1524,7 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1521
1524
  const X = Tt(g, L.current, u.groups), Y = L.current.xToTime(m);
1522
1525
  X && ((R = u.onCanvasDoubleClick) == null || R.call(u, X.id, Y));
1523
1526
  }
1524
- }, []), Ti = oe((r) => {
1527
+ }, []), Si = oe((r) => {
1525
1528
  var k, R;
1526
1529
  r.preventDefault();
1527
1530
  const l = r.currentTarget.getBoundingClientRect(), m = r.clientX - l.left, g = r.clientY - l.top, u = x.current, v = Ue(m, g, L.current, u.intervalTree, u.layoutEngine, u.groups);
@@ -1531,10 +1534,10 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1531
1534
  const X = Tt(g, L.current, u.groups), Y = L.current.xToTime(m);
1532
1535
  X && ((R = u.onCanvasContextMenu) == null || R.call(u, X.id, Y, r.nativeEvent));
1533
1536
  }
1534
- }, []), Si = oe(() => {
1537
+ }, []), Mi = oe(() => {
1535
1538
  var r, l;
1536
1539
  ve.current = null, Oe.current = !1, ft.current = null, Le.current && (Le.current.style.cursor = "default"), xe.current !== void 0 && (xe.current = void 0, O.markDirty("items"), (l = (r = x.current).onItemHover) == null || l.call(r, null, new PointerEvent("pointerleave"))), x.current.showCursorLine && O.markDirty("overlay");
1537
- }, [O]), Mi = ee(() => {
1540
+ }, [O]), wi = ee(() => {
1538
1541
  const r = [];
1539
1542
  return me.Children.forEach(ke, (l) => {
1540
1543
  var g;
@@ -1559,7 +1562,7 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1559
1562
  }, [ke, Ft, Yt, Ce, c, we, Je, O, $e]), jt = U(!1);
1560
1563
  ce(() => {
1561
1564
  jt.current || (jt.current = !0, O.markAllDirty());
1562
- }, [O]), Ei(t, () => ({
1565
+ }, [O]), Hi(t, () => ({
1563
1566
  captureToCanvas({ timeStart: r, timeEnd: l, scale: m, sidebarWidth: g }) {
1564
1567
  const u = x.current, v = 28, k = v * 3, R = u.groups.map((j) => u.layoutEngine.getGroupHeight(j.id)), X = [0];
1565
1568
  for (let j = 0; j < R.length; j++)
@@ -1627,8 +1630,8 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1627
1630
  const ae = re.type ?? "";
1628
1631
  let fe = 8, pe = "400", Pe = 11;
1629
1632
  ae === "project" ? (pe = "700", Pe = 12) : ae === "control_area_group" ? pe = "600" : ae === "control_area" && (fe = 24), S.fillStyle = "#374151", S.font = `${pe} ${Pe}px -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif`, S.textBaseline = "middle";
1630
- const ki = typeof re.title == "string" ? re.title : String(re.title);
1631
- S.fillText(ki, fe, G + V / 2, u - fe - 8);
1633
+ const Ci = typeof re.title == "string" ? re.title : String(re.title);
1634
+ S.fillText(Ci, fe, G + V / 2, u - fe - 8);
1632
1635
  }
1633
1636
  S.strokeStyle = "#E5E7EB", S.lineWidth = 1, S.beginPath(), S.moveTo(u, 0), S.lineTo(u, Z), S.stroke(), S.restore(), S.save(), S.beginPath(), S.rect(u, 0, q, R), S.clip();
1634
1637
  const ge = m - l, j = [
@@ -1666,14 +1669,14 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1666
1669
  };
1667
1670
  Ke == null || Ke(r);
1668
1671
  }, [Ke, Fe, Ye, _e]);
1669
- const wi = {
1672
+ const ki = {
1670
1673
  position: "relative",
1671
1674
  width: Ce,
1672
1675
  height: ye,
1673
1676
  overflow: "hidden",
1674
1677
  cursor: "default"
1675
1678
  }, bt = { position: "absolute", top: 0, left: 0 };
1676
- return Ve("div", { ref: Ot, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [oi ? Ve("div", { style: {
1679
+ return Ve("div", { ref: Ot, style: { display: "flex", flexDirection: "column", width: "100%", position: "relative" }, children: [si ? Ve("div", { style: {
1677
1680
  position: "absolute",
1678
1681
  top: 0,
1679
1682
  left: 0,
@@ -1687,13 +1690,13 @@ const Jt = 32, cn = me.memo(Ci(function(e, t) {
1687
1690
  borderBottomRightRadius: 4,
1688
1691
  pointerEvents: "none",
1689
1692
  userSelect: "none"
1690
- }, children: ["v", "0.6.0", " · ", "06:59:26"] }) : null, Mi, Ve("div", { ref: Pt, style: { display: "flex", overflow: "hidden", maxHeight: Be ?? void 0 }, children: [le(Vt, { groups: n, width: c, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: B, onScroll: (r) => {
1693
+ }, children: ["v", "0.7.0", " · ", "07:45:36"] }) : null, wi, Ve("div", { ref: Pt, style: { display: "flex", overflow: "hidden", maxHeight: Be ?? void 0 }, children: [le(qt, { groups: n, width: c, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: B, onScroll: (r) => {
1691
1694
  L.current.update({ scrollTop: r }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(r);
1692
- } }), Ve("div", { ref: Le, style: wi, onPointerMove: pi, onPointerDown: vi, onPointerUp: bi, onDoubleClick: yi, onContextMenu: Ti, onPointerLeave: Si, children: [le("canvas", { ref: Dt, style: { ...bt, zIndex: 0 } }), le("canvas", { ref: It, style: { ...bt, zIndex: 1 } }), le("canvas", { ref: Rt, style: { ...bt, zIndex: 2 } })] }), ut && Et ? le(Vt, { groups: n, width: ut, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: Et, onScroll: (r) => {
1695
+ } }), Ve("div", { ref: Le, style: ki, onPointerMove: vi, onPointerDown: bi, onPointerUp: yi, onDoubleClick: Ti, onContextMenu: Si, onPointerLeave: Mi, children: [le("canvas", { ref: Dt, style: { ...bt, zIndex: 0 } }), le("canvas", { ref: It, style: { ...bt, zIndex: 1 } }), le("canvas", { ref: Rt, style: { ...bt, zIndex: 2 } })] }), ut && Et ? le(qt, { groups: n, width: ut, lineHeight: a, groupHeights: Re, scrollTop: _t, canvasHeight: ye, theme: we, groupRenderer: Et, onScroll: (r) => {
1693
1696
  L.current.update({ scrollTop: r }), O.markDirty("grid"), O.markDirty("items"), O.markDirty("overlay"), et(r);
1694
1697
  } }) : null] })] });
1695
1698
  }));
1696
- function qi({ children: i, theme: e, className: t, classNames: n, style: o, visibleTimeStart: d, visibleTimeEnd: s, canvasWidth: c, sidebarWidth: a = 0, onZoomToInterval: b, timezone: H }) {
1699
+ function Ki({ children: i, theme: e, className: t, classNames: n, style: o, visibleTimeStart: d, visibleTimeEnd: s, canvasWidth: c, sidebarWidth: a = 0, onZoomToInterval: b, timezone: H }) {
1697
1700
  const p = me.Children.map(i, (f) => {
1698
1701
  var T;
1699
1702
  if (!me.isValidElement(f))
@@ -1723,8 +1726,8 @@ function qi({ children: i, theme: e, className: t, classNames: n, style: o, visi
1723
1726
  ...o
1724
1727
  }, children: p });
1725
1728
  }
1726
- qi.displayName = "TimelineHeaders";
1727
- var ri = { exports: {} };
1729
+ Ki.displayName = "TimelineHeaders";
1730
+ var oi = { exports: {} };
1728
1731
  (function(i, e) {
1729
1732
  (function(t, n) {
1730
1733
  i.exports = n();
@@ -1746,22 +1749,22 @@ var ri = { exports: {} };
1746
1749
  };
1747
1750
  };
1748
1751
  });
1749
- })(ri);
1750
- var Ki = ri.exports;
1751
- const Ji = /* @__PURE__ */ at(Ki);
1752
- We.extend(Ji);
1753
- const Qi = {
1752
+ })(oi);
1753
+ var Ji = oi.exports;
1754
+ const Qi = /* @__PURE__ */ at(Ji);
1755
+ We.extend(Qi);
1756
+ const en = {
1754
1757
  year: 30,
1755
1758
  month: 30,
1756
1759
  week: 20,
1757
1760
  day: 15,
1758
1761
  hour: 30
1759
1762
  };
1760
- function en({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWidth: n = 0, theme: o, height: d = 28, className: s, labelFormat: c, onIntervalClick: a, minCellWidth: b, onZoomToInterval: H, timezone: p }) {
1763
+ function tn({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWidth: n = 0, theme: o, height: d = 28, className: s, labelFormat: c, onIntervalClick: a, minCellWidth: b, onZoomToInterval: H, timezone: p }) {
1761
1764
  const f = ee(() => {
1762
1765
  if (!e || !t || !n)
1763
1766
  return [];
1764
- const T = t - e, h = b ?? Qi[i];
1767
+ const T = t - e, h = b ?? en[i];
1765
1768
  if (h > 0) {
1766
1769
  const y = Te(e, p).startOf(i);
1767
1770
  if ((y.add(1, i).valueOf() - y.valueOf()) / T * n < h)
@@ -1771,7 +1774,7 @@ function en({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWid
1771
1774
  let P = Te(e, p).startOf(i).subtract(1, i);
1772
1775
  const W = Te(t, p).add(2, i).valueOf();
1773
1776
  for (; P.valueOf() < W; ) {
1774
- const y = P.add(1, i), D = P.valueOf(), w = y.valueOf(), $ = (D - e) / T * n, B = (w - D) / T * n, I = tn(P, y, i, c);
1777
+ const y = P.add(1, i), D = P.valueOf(), w = y.valueOf(), $ = (D - e) / T * n, B = (w - D) / T * n, I = nn(P, y, i, c);
1775
1778
  E.push({ start: D, end: w, label: I, left: $, width: B }), P = y;
1776
1779
  }
1777
1780
  return E;
@@ -1799,11 +1802,11 @@ function en({ unit: i, visibleTimeStart: e = 0, visibleTimeEnd: t = 0, canvasWid
1799
1802
  boxSizing: "border-box"
1800
1803
  }, children: le("span", { children: T.label }) }, T.start)) });
1801
1804
  }
1802
- en.displayName = "DateHeader";
1803
- function tn(i, e, t, n, o) {
1804
- return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) : nn(i, t);
1805
+ tn.displayName = "DateHeader";
1806
+ function nn(i, e, t, n, o) {
1807
+ return typeof n == "function" ? n(i.toDate(), e.toDate(), t) : typeof n == "string" ? i.format(n) : rn(i, t);
1805
1808
  }
1806
- function nn(i, e) {
1809
+ function rn(i, e) {
1807
1810
  switch (e) {
1808
1811
  case "year":
1809
1812
  return i.format("YYYY");
@@ -1817,24 +1820,24 @@ function nn(i, e) {
1817
1820
  return i.format("HH:mm");
1818
1821
  }
1819
1822
  }
1820
- function rn({ width: i, children: e, style: t }) {
1823
+ function on({ width: i, children: e, style: t }) {
1821
1824
  const n = () => ({ style: { width: i, ...t } });
1822
- return e ? le(Qt, { children: e({ getRootProps: n }) }) : le("div", { style: { width: i } });
1825
+ return e ? le(ei, { children: e({ getRootProps: n }) }) : le("div", { style: { width: i } });
1823
1826
  }
1824
- rn.displayName = "SidebarHeader";
1825
- function on({ children: i }) {
1826
- return le(Qt, { children: i });
1827
+ on.displayName = "SidebarHeader";
1828
+ function sn({ children: i }) {
1829
+ return le(ei, { children: i });
1827
1830
  }
1828
- on.displayName = "CustomHeader";
1831
+ sn.displayName = "CustomHeader";
1829
1832
  export {
1830
- cn as CanvasTimeline,
1831
- on as CustomHeader,
1832
- Ui as CustomMarker,
1833
+ dn as CanvasTimeline,
1834
+ sn as CustomHeader,
1835
+ Vi as CustomMarker,
1833
1836
  He as DEFAULT_THEME,
1834
- en as DateHeader,
1835
- Ri as HierarchyEngine,
1836
- rn as SidebarHeader,
1837
- qi as TimelineHeaders,
1838
- Ni as TodayMarker
1837
+ tn as DateHeader,
1838
+ Oi as HierarchyEngine,
1839
+ on as SidebarHeader,
1840
+ Ki as TimelineHeaders,
1841
+ Zi as TodayMarker
1839
1842
  };
1840
1843
  //# sourceMappingURL=canvas-timeline.es.js.map