awesome-timeline-react 0.2.0 → 0.3.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/index.mjs CHANGED
@@ -23,7 +23,7 @@ import React6, {
23
23
  forwardRef as forwardRef3,
24
24
  useEffect as useEffect6,
25
25
  useImperativeHandle as useImperativeHandle2,
26
- useMemo as useMemo4,
26
+ useMemo as useMemo3,
27
27
  useRef as useRef7,
28
28
  useState as useState4
29
29
  } from "react";
@@ -244,21 +244,6 @@ var event_prompt_default = EventPrompt;
244
244
  // src/components/canvas-time-bar.tsx
245
245
  import React3, { useEffect as useEffect3, useRef as useRef4 } from "react";
246
246
 
247
- // src/hooks/use-get-block-properties.ts
248
- import { useMemo as useMemo2 } from "react";
249
- var useGetBlockProperties = ({
250
- windowTime,
251
- contentWidth
252
- }) => {
253
- const numberOfHourBlocks = useMemo2(
254
- () => (windowTime[1] - windowTime[0]) / 3600,
255
- [windowTime]
256
- );
257
- const blockWidth = contentWidth ? contentWidth / numberOfHourBlocks : 0;
258
- return { numberOfHourBlocks, blockWidth };
259
- };
260
- var use_get_block_properties_default = useGetBlockProperties;
261
-
262
247
  // src/helpers/get-month-name.ts
263
248
  var getMonthName = (monthIndex) => {
264
249
  let monthName = null;
@@ -307,106 +292,108 @@ var getMonthName = (monthIndex) => {
307
292
  var get_month_name_default = getMonthName;
308
293
 
309
294
  // src/helpers/get-week-day-name.ts
295
+ var WEEKDAY_NAMES = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
310
296
  var getWeekDayName = (dayIndex) => {
311
- let dayName = null;
312
- switch (dayIndex) {
313
- case 0:
314
- dayName = "Mon";
315
- break;
316
- case 1:
317
- dayName = "Tue";
318
- break;
319
- case 2:
320
- dayName = "Wed";
321
- break;
322
- case 3:
323
- dayName = "Thu";
324
- break;
325
- case 4:
326
- dayName = "Fri";
327
- break;
328
- case 5:
329
- dayName = "Sat";
330
- break;
331
- case 6:
332
- dayName = "Sun";
333
- break;
334
- default:
335
- dayName = "Mon";
336
- }
337
- return dayName;
297
+ var _a;
298
+ return (_a = WEEKDAY_NAMES[dayIndex]) != null ? _a : "Sun";
338
299
  };
339
300
  var get_week_day_name_default = getWeekDayName;
340
301
 
341
302
  // src/core/time-blocks.ts
342
- var hourLabel = (hour) => hour < 10 ? `0${hour}:00` : `${hour}:00`;
303
+ var pad2 = (n) => n < 10 ? `0${n}` : `${n}`;
304
+ var hourLabel = (hour) => `${pad2(hour)}:00`;
343
305
  var dayLabel = (date) => `${get_week_day_name_default(date.getDay())} ${date.getDate()} ${get_month_name_default(
344
306
  date.getMonth()
345
307
  )}`;
346
- var generateTimeBlocks = ({
308
+ var defaultFormat = (unit) => {
309
+ if (typeof unit === "object") {
310
+ return (d) => `${pad2(d.getHours())}:${pad2(d.getMinutes())}`;
311
+ }
312
+ switch (unit) {
313
+ case "hour":
314
+ return (d) => hourLabel(d.getHours());
315
+ case "month":
316
+ return (d) => `${get_month_name_default(d.getMonth())} ${d.getFullYear()}`;
317
+ case "day":
318
+ case "week":
319
+ default:
320
+ return (d) => dayLabel(d);
321
+ }
322
+ };
323
+ var floorToUnit = (date, unit, anchorSec) => {
324
+ if (typeof unit === "object") {
325
+ const t = date.getTime() / 1e3;
326
+ const step = unit.stepSeconds;
327
+ return new Date((anchorSec + Math.floor((t - anchorSec) / step) * step) * 1e3);
328
+ }
329
+ const y = date.getFullYear();
330
+ const mo = date.getMonth();
331
+ const d = date.getDate();
332
+ switch (unit) {
333
+ case "hour":
334
+ return new Date(y, mo, d, date.getHours());
335
+ case "day":
336
+ return new Date(y, mo, d);
337
+ case "week": {
338
+ const dow = (date.getDay() + 6) % 7;
339
+ return new Date(y, mo, d - dow);
340
+ }
341
+ case "month":
342
+ return new Date(y, mo, 1);
343
+ }
344
+ };
345
+ var nextBoundary = (blockStart, unit) => {
346
+ if (typeof unit === "object") {
347
+ return new Date(blockStart.getTime() + unit.stepSeconds * 1e3);
348
+ }
349
+ const y = blockStart.getFullYear();
350
+ const mo = blockStart.getMonth();
351
+ const d = blockStart.getDate();
352
+ switch (unit) {
353
+ case "hour":
354
+ return new Date(y, mo, d, blockStart.getHours() + 1);
355
+ case "day":
356
+ return new Date(y, mo, d + 1);
357
+ case "week":
358
+ return new Date(y, mo, d + 7);
359
+ case "month":
360
+ return new Date(y, mo + 1, 1);
361
+ }
362
+ };
363
+ var generateUnitBlocks = ({
364
+ unit,
365
+ format,
347
366
  windowStart,
348
- tick,
349
- contentWidth,
350
- blockWidth
367
+ windowEnd,
368
+ tick
351
369
  }) => {
352
- const dayBlocks = [];
353
- const hourBlocks = [];
354
- if (tick === null || contentWidth === null || blockWidth <= 0) {
355
- return { dayBlocks, hourBlocks };
356
- }
357
- let timePoint = windowStart;
358
- let widthLeft = contentWidth;
359
- let prevNumBlocks = 1;
360
- while (1) {
361
- const datePoint = new Date(timePoint * 1e3);
362
- const endDatePoint = new Date(
363
- datePoint.getFullYear(),
364
- datePoint.getMonth(),
365
- datePoint.getDate(),
366
- 23,
367
- 59,
368
- 59
369
- );
370
- const dateDuration = endDatePoint.getTime() - datePoint.getTime();
371
- const dateWidth = dateDuration / 1e3 / tick;
372
- widthLeft -= dateWidth;
373
- if (Math.round(widthLeft) < 0) {
374
- const numBlocks2 = Math.round((dateWidth + widthLeft) / blockWidth);
375
- for (let i = 0; i < numBlocks2; i++) {
376
- hourBlocks.push({
377
- label: hourLabel(i),
378
- x: hourBlocks.length * blockWidth,
379
- width: blockWidth
380
- });
381
- }
382
- dayBlocks.push({
383
- label: dayLabel(datePoint),
384
- x: (prevNumBlocks - 1) * blockWidth,
385
- width: numBlocks2 * blockWidth
386
- });
387
- prevNumBlocks += numBlocks2;
388
- break;
389
- }
390
- const numBlocks = Math.round(dateWidth / blockWidth);
391
- for (let i = 24 - numBlocks; i < 24; i++) {
392
- hourBlocks.push({
393
- label: hourLabel(i),
394
- x: hourBlocks.length * blockWidth,
395
- width: blockWidth
396
- });
397
- }
398
- dayBlocks.push({
399
- label: dayLabel(datePoint),
400
- x: (prevNumBlocks - 1) * blockWidth,
401
- width: numBlocks * blockWidth
370
+ const blocks = [];
371
+ const resolvedUnit = unit != null ? unit : "hour";
372
+ if (tick === null || tick <= 0 || windowEnd <= windowStart) return blocks;
373
+ const label = format != null ? format : defaultFormat(resolvedUnit);
374
+ const anchorSec = new Date(
375
+ new Date(windowStart * 1e3).getFullYear(),
376
+ new Date(windowStart * 1e3).getMonth(),
377
+ new Date(windowStart * 1e3).getDate()
378
+ ).getTime() / 1e3;
379
+ let cursorSec = windowStart;
380
+ let guard = 0;
381
+ while (cursorSec < windowEnd && guard++ < 1e5) {
382
+ const blockStart = floorToUnit(new Date(cursorSec * 1e3), resolvedUnit, anchorSec);
383
+ const blockEnd = nextBoundary(blockStart, resolvedUnit);
384
+ const startSec = blockStart.getTime() / 1e3;
385
+ const endSec = blockEnd.getTime() / 1e3;
386
+ if (endSec <= startSec) break;
387
+ const visibleStart = Math.max(startSec, windowStart);
388
+ const visibleEnd = Math.min(endSec, windowEnd);
389
+ blocks.push({
390
+ label: label(blockStart, blockEnd),
391
+ x: (visibleStart - windowStart) / tick,
392
+ width: (visibleEnd - visibleStart) / tick
402
393
  });
403
- prevNumBlocks += numBlocks;
404
- if (Math.round(widthLeft) === 0) {
405
- break;
406
- }
407
- timePoint = (endDatePoint.getTime() + 1e3) / 1e3;
394
+ cursorSec = endSec;
408
395
  }
409
- return { dayBlocks, hourBlocks };
396
+ return blocks;
410
397
  };
411
398
 
412
399
  // src/canvas/dpr.ts
@@ -454,7 +441,11 @@ var DEFAULT_THEME = {
454
441
  gridColor: "#e4dcdc",
455
442
  timeBarBorder: "yellow",
456
443
  timeBarTextColor: "white",
457
- font: void 0
444
+ font: void 0,
445
+ barHeight: 20,
446
+ laneGap: 2,
447
+ rowPaddingY: 10,
448
+ barRadius: 5
458
449
  };
459
450
  var resolveTheme = (theme) => __spreadValues(__spreadValues({}, DEFAULT_THEME), theme);
460
451
 
@@ -463,14 +454,19 @@ var drawGridLines = (ctx, {
463
454
  width,
464
455
  height,
465
456
  cellWidth,
457
+ windowStart,
458
+ tick,
466
459
  color = DEFAULT_THEME.gridColor
467
460
  }) => {
468
- if (cellWidth <= 0) return;
461
+ if (cellWidth <= 0 || tick <= 0) return;
462
+ const cellTime = cellWidth * tick;
469
463
  ctx.strokeStyle = color;
470
464
  ctx.lineWidth = 1;
471
465
  ctx.beginPath();
472
- for (let x = cellWidth; x < width; x += cellWidth) {
473
- if (width - x < 1) break;
466
+ for (let t = Math.floor(windowStart / cellTime) * cellTime + cellTime; ; t += cellTime) {
467
+ const x = (t - windowStart) / tick;
468
+ if (x >= width || width - x < 1) break;
469
+ if (x < 1) continue;
474
470
  const crisp = Math.round(x) - 0.5;
475
471
  ctx.moveTo(crisp, 0);
476
472
  ctx.lineTo(crisp, height);
@@ -480,8 +476,8 @@ var drawGridLines = (ctx, {
480
476
  var drawTimeBar = (ctx, {
481
477
  width,
482
478
  height,
483
- dayBlocks,
484
- hourBlocks,
479
+ topBlocks,
480
+ bottomBlocks,
485
481
  font,
486
482
  borderColor = DEFAULT_THEME.timeBarBorder,
487
483
  textColor = DEFAULT_THEME.timeBarTextColor
@@ -494,13 +490,13 @@ var drawTimeBar = (ctx, {
494
490
  ctx.lineTo(width, Math.round(mid) - 0.5);
495
491
  ctx.stroke();
496
492
  ctx.beginPath();
497
- for (let i = 0; i < dayBlocks.length - 1; i++) {
498
- const edge = Math.round(dayBlocks[i].x + dayBlocks[i].width) - 0.5;
493
+ for (let i = 0; i < topBlocks.length - 1; i++) {
494
+ const edge = Math.round(topBlocks[i].x + topBlocks[i].width) - 0.5;
499
495
  ctx.moveTo(edge, 0);
500
496
  ctx.lineTo(edge, mid);
501
497
  }
502
- for (let i = 0; i < hourBlocks.length - 1; i++) {
503
- const edge = Math.round(hourBlocks[i].x + hourBlocks[i].width) - 0.5;
498
+ for (let i = 0; i < bottomBlocks.length - 1; i++) {
499
+ const edge = Math.round(bottomBlocks[i].x + bottomBlocks[i].width) - 0.5;
504
500
  ctx.moveTo(edge, mid);
505
501
  ctx.lineTo(edge, height);
506
502
  }
@@ -510,7 +506,7 @@ var drawTimeBar = (ctx, {
510
506
  ctx.textBaseline = "middle";
511
507
  ctx.textAlign = "center";
512
508
  const inset = 4;
513
- for (const block of dayBlocks) {
509
+ for (const block of topBlocks) {
514
510
  ctx.fillText(
515
511
  block.label,
516
512
  block.x + block.width / 2,
@@ -518,7 +514,7 @@ var drawTimeBar = (ctx, {
518
514
  block.width - inset
519
515
  );
520
516
  }
521
- for (const block of hourBlocks) {
517
+ for (const block of bottomBlocks) {
522
518
  ctx.fillText(
523
519
  block.label,
524
520
  block.x + block.width / 2,
@@ -535,15 +531,15 @@ var CanvasTimeBar = ({
535
531
  tick,
536
532
  contentWidth,
537
533
  scrollWidth,
538
- theme
534
+ theme,
535
+ timeBar
539
536
  }) => {
537
+ var _a, _b;
540
538
  const canvasRef = useRef4(null);
541
- const { blockWidth } = use_get_block_properties_default({
542
- windowTime,
543
- contentWidth
544
- });
539
+ const topRow = (_a = timeBar == null ? void 0 : timeBar.topRow) != null ? _a : { unit: "day" };
540
+ const bottomRow = (_b = timeBar == null ? void 0 : timeBar.bottomRow) != null ? _b : { unit: "hour" };
545
541
  useEffect3(() => {
546
- var _a;
542
+ var _a2;
547
543
  const canvas = canvasRef.current;
548
544
  if (!canvas || !contentWidth) return;
549
545
  const ctx = sizeCanvas(
@@ -552,21 +548,22 @@ var CanvasTimeBar = ({
552
548
  TIME_BAR_INNER_HEIGHT,
553
549
  window.devicePixelRatio
554
550
  );
555
- if (ctx) {
556
- drawTimeBar(ctx, __spreadValues({
557
- width: contentWidth,
558
- height: TIME_BAR_INNER_HEIGHT,
559
- font: (_a = theme == null ? void 0 : theme.font) != null ? _a : getComputedStyle(canvas).font,
560
- borderColor: theme == null ? void 0 : theme.timeBarBorder,
561
- textColor: theme == null ? void 0 : theme.timeBarTextColor
562
- }, generateTimeBlocks({
563
- windowStart: windowTime[0],
564
- tick,
565
- contentWidth,
566
- blockWidth
567
- })));
568
- }
569
- }, [windowTime, tick, contentWidth, blockWidth, theme]);
551
+ if (!ctx) return;
552
+ const [windowStart, windowEnd] = windowTime;
553
+ drawTimeBar(ctx, {
554
+ width: contentWidth,
555
+ height: TIME_BAR_INNER_HEIGHT,
556
+ font: (_a2 = theme == null ? void 0 : theme.font) != null ? _a2 : getComputedStyle(canvas).font,
557
+ borderColor: theme == null ? void 0 : theme.timeBarBorder,
558
+ textColor: theme == null ? void 0 : theme.timeBarTextColor,
559
+ topBlocks: generateUnitBlocks(__spreadProps(__spreadValues({}, topRow), { windowStart, windowEnd, tick })),
560
+ bottomBlocks: generateUnitBlocks(__spreadProps(__spreadValues({}, bottomRow), {
561
+ windowStart,
562
+ windowEnd,
563
+ tick
564
+ }))
565
+ });
566
+ }, [windowTime, tick, contentWidth, theme, timeBar]);
570
567
  return /* @__PURE__ */ React3.createElement("div", { className: "time-bar" }, /* @__PURE__ */ React3.createElement("div", { className: "empty-block" }), /* @__PURE__ */ React3.createElement(
571
568
  "canvas",
572
569
  {
@@ -663,15 +660,32 @@ var timeToX = (time, windowStart, tick) => (time - windowStart) / tick;
663
660
  var timeToWidth = (startTime, endTime, tick) => (endTime - startTime) / tick;
664
661
  var intersectsWindow = (event, windowStart, windowEnd) => event.endTime >= windowStart && event.startTime <= windowEnd;
665
662
 
663
+ // src/core/geometry.ts
664
+ var DEFAULT_GEOMETRY = {
665
+ barHeight: 20,
666
+ laneHeight: 22,
667
+ laneTopOffset: 10,
668
+ rowBaseHeight: 40,
669
+ staticEventBaseHeight: 20,
670
+ barRadius: 5
671
+ };
672
+ var geometryFromTheme = (theme) => {
673
+ const barHeight = theme.barHeight;
674
+ const rowPaddingY = theme.rowPaddingY;
675
+ return {
676
+ barHeight,
677
+ laneHeight: barHeight + theme.laneGap,
678
+ laneTopOffset: rowPaddingY,
679
+ rowBaseHeight: barHeight + 2 * rowPaddingY,
680
+ staticEventBaseHeight: barHeight,
681
+ barRadius: theme.barRadius
682
+ };
683
+ };
684
+
666
685
  // src/core/lanes.ts
667
- var LANE_HEIGHT = 22;
668
- var LANE_TOP_OFFSET = 10;
669
- var ROW_BASE_HEIGHT = 40;
670
- var STATIC_EVENT_BASE_HEIGHT = 20;
671
- var EVENT_BAR_HEIGHT = 20;
672
- var laneTop = (lane) => LANE_TOP_OFFSET + LANE_HEIGHT * lane;
673
- var rowMinHeight = (highestLane) => ROW_BASE_HEIGHT + highestLane * LANE_HEIGHT;
674
- var staticEventHeight = (highestLane) => STATIC_EVENT_BASE_HEIGHT + highestLane * LANE_HEIGHT;
686
+ var laneTop = (lane, g = DEFAULT_GEOMETRY) => g.laneTopOffset + g.laneHeight * lane;
687
+ var rowMinHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.rowBaseHeight + highestLane * g.laneHeight;
688
+ var staticEventHeight = (highestLane, g = DEFAULT_GEOMETRY) => g.staticEventBaseHeight + highestLane * g.laneHeight;
675
689
  var assignLanes = (rowEvents, windowStart, windowEnd) => {
676
690
  let eventOrder = 0;
677
691
  const prevEvent = [];
@@ -713,9 +727,9 @@ var computeDropTimes = ({
713
727
  windowStart,
714
728
  duration
715
729
  }) => {
716
- const closestCell = Math.round(pointerX / cellWidth);
717
- const newPosition = cellWidth * closestCell;
718
- const startTime = windowStart + newPosition * tick;
730
+ const cellTime = cellWidth * tick;
731
+ const pointerTime = windowStart + pointerX * tick;
732
+ const startTime = Math.round(pointerTime / cellTime) * cellTime;
719
733
  return { startTime, endTime: startTime + duration };
720
734
  };
721
735
  var computeResizeTimes = (event, deltaPx, tick, direction) => {
@@ -744,9 +758,26 @@ var stepCellWidth = (cellWidth, deltaY, tick) => {
744
758
  }
745
759
  return next;
746
760
  };
761
+ var computeZoom = (windowTime, tick, cellWidth, anchorX, factor, contentWidth, { minWindowSeconds, maxWindowSeconds }) => {
762
+ const [start, end] = windowTime;
763
+ const oldDuration = end - start;
764
+ const newDuration = Math.min(
765
+ Math.max(oldDuration * factor, minWindowSeconds),
766
+ maxWindowSeconds
767
+ );
768
+ const cellTime = cellWidth * tick;
769
+ const tAnchor = start + anchorX * tick;
770
+ const newStart = Math.round(tAnchor - anchorX / contentWidth * newDuration);
771
+ const newEnd = newStart + Math.round(newDuration);
772
+ const newTick = (newEnd - newStart) / contentWidth;
773
+ return {
774
+ windowTime: [newStart, newEnd],
775
+ tick: newTick,
776
+ cellWidth: cellTime / newTick
777
+ };
778
+ };
747
779
 
748
780
  // src/canvas/draw-events.ts
749
- var EVENT_RADIUS = 5;
750
781
  var EVENT_TEXT_INSET = 13;
751
782
  var HANDLE_INSET = 4;
752
783
  var HANDLE_BAR_WIDTH = 3;
@@ -817,7 +848,7 @@ var drawResizeHandles = (ctx, rect, alpha, strokeColor) => {
817
848
  }
818
849
  ctx.restore();
819
850
  };
820
- var defaultDrawEvent = (ctx, event, rect, view, font) => {
851
+ var defaultDrawEvent = (ctx, event, rect, view, font, barRadius) => {
821
852
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
822
853
  const theme = view.theme;
823
854
  const style = (_a = event.props) == null ? void 0 : _a.style;
@@ -831,7 +862,7 @@ var defaultDrawEvent = (ctx, event, rect, view, font) => {
831
862
  rect.y + 0.5,
832
863
  rect.width - 1,
833
864
  rect.height - 1,
834
- (_e = style == null ? void 0 : style.borderRadius) != null ? _e : EVENT_RADIUS
865
+ (_e = style == null ? void 0 : style.borderRadius) != null ? _e : barRadius
835
866
  );
836
867
  ctx.fill();
837
868
  ctx.stroke();
@@ -857,6 +888,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
857
888
  if (view.tick === null) return;
858
889
  const [windowStart, windowEnd] = view.windowTime;
859
890
  const tick = view.tick;
891
+ const geometry = scene.getGeometry();
860
892
  ctx.font = (_a = view.theme.font) != null ? _a : font;
861
893
  ctx.textBaseline = "middle";
862
894
  ctx.textAlign = "left";
@@ -882,10 +914,10 @@ var drawEvents = (ctx, view, scene, font, animator) => {
882
914
  roundedRect(
883
915
  ctx,
884
916
  x,
885
- rowY + LANE_TOP_OFFSET,
917
+ rowY + geometry.laneTopOffset,
886
918
  width,
887
- staticEventHeight(lanes.highestLane),
888
- EVENT_RADIUS
919
+ staticEventHeight(lanes.highestLane, geometry),
920
+ geometry.barRadius
889
921
  );
890
922
  ctx.fill();
891
923
  }
@@ -898,7 +930,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
898
930
  let width = timeToWidth(event.startTime, event.endTime, tick);
899
931
  const y = rowY + animator.eventTop(
900
932
  event.id,
901
- laneTop(lanes.laneOf.get(event.id))
933
+ laneTop(lanes.laneOf.get(event.id), geometry)
902
934
  );
903
935
  const resize = view.resizePreview;
904
936
  const resizing = resize !== null && resize.eventId === event.id;
@@ -910,7 +942,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
910
942
  width += resize.deltaPx;
911
943
  }
912
944
  }
913
- const rect = { x, y, width, height: EVENT_BAR_HEIGHT };
945
+ const rect = { x, y, width, height: geometry.barHeight };
914
946
  const state = {
915
947
  hovered: view.hoveredEventId === event.id,
916
948
  dragging: view.draggedEventId === event.id,
@@ -922,7 +954,7 @@ var drawEvents = (ctx, view, scene, font, animator) => {
922
954
  const custom = (_c = (_b = event.props) == null ? void 0 : _b.drawEvent) != null ? _c : view.drawEvent;
923
955
  const drawn = custom !== void 0 && custom(ctx, event, rect, state, view.theme) !== false;
924
956
  if (!drawn) {
925
- defaultDrawEvent(ctx, event, rect, view, font);
957
+ defaultDrawEvent(ctx, event, rect, view, font, geometry.barRadius);
926
958
  }
927
959
  if (canResizeEvent(event, view.eventsResize)) {
928
960
  const alpha = animator.handleAlpha(
@@ -1017,6 +1049,8 @@ var TimelineRenderer = class {
1017
1049
  width: this.view.width,
1018
1050
  height: this.view.height,
1019
1051
  cellWidth: this.view.cellWidth,
1052
+ windowStart: this.view.windowTime[0],
1053
+ tick: this.view.tick,
1020
1054
  color: this.view.theme.gridColor
1021
1055
  });
1022
1056
  drawRowDividers(ctx, this.view, this.scene, this.animator);
@@ -1036,7 +1070,7 @@ var TimelineRenderer = class {
1036
1070
  };
1037
1071
 
1038
1072
  // src/hooks/use-canvas-interactions.ts
1039
- import { useCallback, useEffect as useEffect4, useMemo as useMemo3, useRef as useRef5 } from "react";
1073
+ import { useCallback, useEffect as useEffect4, useMemo as useMemo2, useRef as useRef5 } from "react";
1040
1074
 
1041
1075
  // src/core/types.ts
1042
1076
  var rectContains = (rect, x, y) => x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height;
@@ -1044,6 +1078,7 @@ var rectContains = (rect, x, y) => x >= rect.x && x <= rect.x + rect.width && y
1044
1078
  // src/core/hit-test.ts
1045
1079
  var hitTest = (scene, view, x, y) => {
1046
1080
  const { windowStart, windowEnd, tick, scrollTop } = view;
1081
+ const geometry = scene.getGeometry();
1047
1082
  const yContent = y + scrollTop;
1048
1083
  let rowTop = 0;
1049
1084
  let rowId = null;
@@ -1067,9 +1102,9 @@ var hitTest = (scene, view, x, y) => {
1067
1102
  const event = events[i];
1068
1103
  const rect = {
1069
1104
  x: timeToX(event.startTime, windowStart, tick),
1070
- y: rowY + laneTop(lanes.laneOf.get(event.id)),
1105
+ y: rowY + laneTop(lanes.laneOf.get(event.id), geometry),
1071
1106
  width: timeToWidth(event.startTime, event.endTime, tick),
1072
- height: EVENT_BAR_HEIGHT
1107
+ height: geometry.barHeight
1073
1108
  };
1074
1109
  if (rectContains(rect, x, y)) {
1075
1110
  return { kind: "event", event, rowId, rect };
@@ -1084,9 +1119,9 @@ var hitTest = (scene, view, x, y) => {
1084
1119
  const event = statics[i];
1085
1120
  const rect = {
1086
1121
  x: timeToX(event.startTime, windowStart, tick),
1087
- y: rowY + LANE_TOP_OFFSET,
1122
+ y: rowY + geometry.laneTopOffset,
1088
1123
  width: timeToWidth(event.startTime, event.endTime, tick),
1089
- height: staticEventHeight(lanes.highestLane)
1124
+ height: staticEventHeight(lanes.highestLane, geometry)
1090
1125
  };
1091
1126
  if (rectContains(rect, x, y)) {
1092
1127
  return { kind: "static", event, rowId, rect };
@@ -1098,6 +1133,7 @@ var hitTest = (scene, view, x, y) => {
1098
1133
  // src/hooks/use-canvas-interactions.ts
1099
1134
  var DRAG_THRESHOLD_PX = 3;
1100
1135
  var RESIZE_HOT_ZONE_PX = 8;
1136
+ var DRAG_ZOOM_PX_PER_DOUBLING = 300;
1101
1137
  var lockCursor = (cursor) => {
1102
1138
  const style = document.createElement("style");
1103
1139
  style.id = "lock-cursor";
@@ -1117,6 +1153,7 @@ var useCanvasInteractions = ({
1117
1153
  eventPromptRef,
1118
1154
  setWindowTime,
1119
1155
  setCellWidth,
1156
+ setTick,
1120
1157
  onDrop,
1121
1158
  onResize,
1122
1159
  onEventClick,
@@ -1129,18 +1166,83 @@ var useCanvasInteractions = ({
1129
1166
  const panFrameRef = useRef5(null);
1130
1167
  const panPendingDxRef = useRef5(0);
1131
1168
  const hoveredRef = useRef5(null);
1132
- const config = useMemo3(
1169
+ const pointersRef = useRef5(/* @__PURE__ */ new Map());
1170
+ const zoomFrameRef = useRef5(null);
1171
+ const zoomPendingRef = useRef5(null);
1172
+ const config = useMemo2(
1133
1173
  () => {
1134
- var _a, _b, _c, _d;
1174
+ var _a, _b, _c, _d, _e, _f, _g;
1135
1175
  return {
1136
1176
  panOnDragBackground: (_a = panZoom == null ? void 0 : panZoom.panOnDragBackground) != null ? _a : true,
1137
1177
  ctrlWheelZoom: (_b = panZoom == null ? void 0 : panZoom.ctrlWheelZoom) != null ? _b : true,
1138
- middleClickGranularity: (_c = panZoom == null ? void 0 : panZoom.middleClickGranularity) != null ? _c : true,
1139
- zoomStepSeconds: (_d = panZoom == null ? void 0 : panZoom.zoomStepSeconds) != null ? _d : 900
1178
+ pinchZoom: (_c = panZoom == null ? void 0 : panZoom.pinchZoom) != null ? _c : true,
1179
+ dragZoom: (_d = panZoom == null ? void 0 : panZoom.dragZoom) != null ? _d : true,
1180
+ zoomWheelFactor: (_e = panZoom == null ? void 0 : panZoom.zoomWheelFactor) != null ? _e : 1.15,
1181
+ middleClickGranularity: (_f = panZoom == null ? void 0 : panZoom.middleClickGranularity) != null ? _f : true,
1182
+ zoomStepSeconds: (_g = panZoom == null ? void 0 : panZoom.zoomStepSeconds) != null ? _g : 900
1183
+ };
1184
+ },
1185
+ [panZoom]
1186
+ );
1187
+ const limits = useMemo2(
1188
+ () => {
1189
+ var _a, _b;
1190
+ return {
1191
+ minWindowSeconds: (_a = panZoom == null ? void 0 : panZoom.minWindowSeconds) != null ? _a : 900,
1192
+ maxWindowSeconds: (_b = panZoom == null ? void 0 : panZoom.maxWindowSeconds) != null ? _b : 30 * 24 * 3600
1140
1193
  };
1141
1194
  },
1142
1195
  [panZoom]
1143
1196
  );
1197
+ const applyZoom = useCallback(
1198
+ (base, anchorX, factor, contentWidth) => {
1199
+ var _a;
1200
+ if (contentWidth <= 0) return;
1201
+ const next = computeZoom(
1202
+ base.windowTime,
1203
+ base.tick,
1204
+ base.cellWidth,
1205
+ anchorX,
1206
+ factor,
1207
+ contentWidth,
1208
+ limits
1209
+ );
1210
+ (_a = rendererRef.current) == null ? void 0 : _a.setView({
1211
+ windowTime: next.windowTime,
1212
+ tick: next.tick,
1213
+ cellWidth: next.cellWidth
1214
+ });
1215
+ setWindowTime(next.windowTime);
1216
+ setTick(next.tick);
1217
+ setCellWidth(next.cellWidth);
1218
+ },
1219
+ [rendererRef, setWindowTime, setTick, setCellWidth, limits]
1220
+ );
1221
+ const scheduleContinuousZoom = useCallback(() => {
1222
+ if (zoomFrameRef.current !== null) return;
1223
+ zoomFrameRef.current = requestAnimationFrame(() => {
1224
+ zoomFrameRef.current = null;
1225
+ const pending = zoomPendingRef.current;
1226
+ const state = stateRef.current;
1227
+ if (!pending || state.mode !== "pinch" && state.mode !== "zoom") return;
1228
+ applyZoom(state.snapshot, pending.anchorX, pending.factor, state.contentWidth);
1229
+ });
1230
+ }, [applyZoom]);
1231
+ const snapshotView = useCallback(() => {
1232
+ const renderer = rendererRef.current;
1233
+ const canvas = dynamicCanvasRef.current;
1234
+ if (!renderer || !canvas) return null;
1235
+ const view = renderer.getView();
1236
+ if (view.tick === null) return null;
1237
+ return {
1238
+ base: {
1239
+ windowTime: [view.windowTime[0], view.windowTime[1]],
1240
+ tick: view.tick,
1241
+ cellWidth: view.cellWidth
1242
+ },
1243
+ contentWidth: canvas.getBoundingClientRect().width
1244
+ };
1245
+ }, [rendererRef, dynamicCanvasRef]);
1144
1246
  const hidePrompt = useCallback(() => {
1145
1247
  var _a;
1146
1248
  (_a = eventPromptRef.current) == null ? void 0 : _a.hide();
@@ -1210,14 +1312,61 @@ var useCanvasInteractions = ({
1210
1312
  },
1211
1313
  [ghostRef]
1212
1314
  );
1315
+ const styleGhost = useCallback(
1316
+ (event) => {
1317
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
1318
+ const ghost = ghostRef.current;
1319
+ const theme = (_a = rendererRef.current) == null ? void 0 : _a.getView().theme;
1320
+ if (!ghost || !theme) return;
1321
+ const style = (_b = event.props) == null ? void 0 : _b.style;
1322
+ ghost.style.backgroundColor = (_c = style == null ? void 0 : style.fill) != null ? _c : theme.eventFill;
1323
+ ghost.style.border = `${(_d = style == null ? void 0 : style.strokeWidth) != null ? _d : 1}px solid ${(_e = style == null ? void 0 : style.stroke) != null ? _e : theme.eventStroke}`;
1324
+ ghost.style.borderRadius = `${(_f = style == null ? void 0 : style.borderRadius) != null ? _f : theme.barRadius}px`;
1325
+ ghost.style.color = (_g = style == null ? void 0 : style.textColor) != null ? _g : theme.eventTextColor;
1326
+ ghost.style.font = (_i = (_h = style == null ? void 0 : style.font) != null ? _h : theme.font) != null ? _i : "";
1327
+ ghost.style.justifyContent = "flex-start";
1328
+ ghost.style.alignItems = "center";
1329
+ ghost.style.paddingInline = "13px";
1330
+ ghost.style.overflow = "hidden";
1331
+ ghost.style.whiteSpace = "nowrap";
1332
+ ghost.textContent = (_k = (_j = event.props) == null ? void 0 : _j.label) != null ? _k : "";
1333
+ },
1334
+ [ghostRef, rendererRef]
1335
+ );
1213
1336
  const handlePointerDown = useCallback(
1214
1337
  (pointerEvent) => {
1215
- var _a;
1216
- if (pointerEvent.button !== 0) return;
1338
+ var _a, _b;
1217
1339
  const canvas = dynamicCanvasRef.current;
1218
1340
  if (!canvas) return;
1341
+ const isTouch = pointerEvent.pointerType === "touch";
1342
+ pointersRef.current.set(pointerEvent.pointerId, {
1343
+ x: pointerEvent.clientX,
1344
+ y: pointerEvent.clientY,
1345
+ touch: isTouch
1346
+ });
1347
+ if (config.pinchZoom && isTouch && pointersRef.current.size === 2) {
1348
+ const snap = snapshotView();
1349
+ if (snap) {
1350
+ if (ghostRef.current) ghostRef.current.style.display = "none";
1351
+ (_a = rendererRef.current) == null ? void 0 : _a.setView({ draggedEventId: null });
1352
+ const pts = [...pointersRef.current.values()];
1353
+ const startDist = Math.hypot(pts[0].x - pts[1].x, pts[0].y - pts[1].y) || 1;
1354
+ const rect = canvas.getBoundingClientRect();
1355
+ stateRef.current = {
1356
+ mode: "pinch",
1357
+ startDist,
1358
+ anchorX: (pts[0].x + pts[1].x) / 2 - rect.left,
1359
+ contentWidth: snap.contentWidth,
1360
+ snapshot: snap.base
1361
+ };
1362
+ canvas.setPointerCapture(pointerEvent.pointerId);
1363
+ hidePrompt();
1364
+ }
1365
+ return;
1366
+ }
1367
+ if (pointerEvent.button !== 0) return;
1219
1368
  const hit = currentHit(pointerEvent.clientX, pointerEvent.clientY);
1220
- if ((hit == null ? void 0 : hit.kind) === "event" && !((_a = hit.event.props) == null ? void 0 : _a.isLocked)) {
1369
+ if ((hit == null ? void 0 : hit.kind) === "event" && !((_b = hit.event.props) == null ? void 0 : _b.isLocked)) {
1221
1370
  const direction = resizeDirectionAt(hit, pointerEvent.clientX);
1222
1371
  if (direction) {
1223
1372
  stateRef.current = {
@@ -1236,9 +1385,26 @@ var useCanvasInteractions = ({
1236
1385
  startClientY: pointerEvent.clientY,
1237
1386
  active: false
1238
1387
  };
1388
+ styleGhost(hit.event);
1239
1389
  }
1390
+ } else if (config.dragZoom && (pointerEvent.ctrlKey || pointerEvent.metaKey) && !isTouch) {
1391
+ const snap = snapshotView();
1392
+ if (!snap) return;
1393
+ const rect = canvas.getBoundingClientRect();
1394
+ stateRef.current = {
1395
+ mode: "zoom",
1396
+ startClientX: pointerEvent.clientX,
1397
+ anchorX: pointerEvent.clientX - rect.left,
1398
+ contentWidth: snap.contentWidth,
1399
+ snapshot: snap.base
1400
+ };
1240
1401
  } else if (config.panOnDragBackground) {
1241
- stateRef.current = { mode: "pan", lastClientX: pointerEvent.clientX };
1402
+ stateRef.current = {
1403
+ mode: "pan",
1404
+ lastClientX: pointerEvent.clientX,
1405
+ lastClientY: pointerEvent.clientY,
1406
+ touch: isTouch
1407
+ };
1242
1408
  canvas.style.cursor = "grabbing";
1243
1409
  } else {
1244
1410
  return;
@@ -1246,7 +1412,17 @@ var useCanvasInteractions = ({
1246
1412
  hidePrompt();
1247
1413
  canvas.setPointerCapture(pointerEvent.pointerId);
1248
1414
  },
1249
- [currentHit, resizeDirectionAt, dynamicCanvasRef, hidePrompt, config]
1415
+ [
1416
+ currentHit,
1417
+ resizeDirectionAt,
1418
+ dynamicCanvasRef,
1419
+ hidePrompt,
1420
+ config,
1421
+ snapshotView,
1422
+ ghostRef,
1423
+ rendererRef,
1424
+ styleGhost
1425
+ ]
1250
1426
  );
1251
1427
  const handleHover = useCallback(
1252
1428
  (pointerEvent) => {
@@ -1306,14 +1482,45 @@ var useCanvasInteractions = ({
1306
1482
  const handlePointerMove = useCallback(
1307
1483
  (pointerEvent) => {
1308
1484
  var _a, _b;
1485
+ const tracked = pointersRef.current.get(pointerEvent.pointerId);
1486
+ if (tracked) {
1487
+ tracked.x = pointerEvent.clientX;
1488
+ tracked.y = pointerEvent.clientY;
1489
+ }
1309
1490
  const state = stateRef.current;
1310
1491
  if (state.mode === "idle") {
1311
1492
  handleHover(pointerEvent);
1312
1493
  return;
1313
1494
  }
1495
+ if (state.mode === "pinch") {
1496
+ const pts = [...pointersRef.current.values()];
1497
+ if (pts.length < 2) return;
1498
+ const dist = Math.hypot(pts[0].x - pts[1].x, pts[0].y - pts[1].y) || 1;
1499
+ zoomPendingRef.current = {
1500
+ anchorX: state.anchorX,
1501
+ factor: state.startDist / dist
1502
+ // fingers apart -> factor<1 -> zoom in
1503
+ };
1504
+ scheduleContinuousZoom();
1505
+ return;
1506
+ }
1507
+ if (state.mode === "zoom") {
1508
+ const dx = pointerEvent.clientX - state.startClientX;
1509
+ zoomPendingRef.current = {
1510
+ anchorX: state.anchorX,
1511
+ factor: Math.pow(2, -dx / DRAG_ZOOM_PX_PER_DOUBLING)
1512
+ // right -> zoom in
1513
+ };
1514
+ scheduleContinuousZoom();
1515
+ return;
1516
+ }
1314
1517
  if (state.mode === "pan") {
1315
1518
  panPendingDxRef.current += pointerEvent.clientX - state.lastClientX;
1519
+ if (state.touch && bodyRef.current) {
1520
+ bodyRef.current.scrollTop -= pointerEvent.clientY - state.lastClientY;
1521
+ }
1316
1522
  state.lastClientX = pointerEvent.clientX;
1523
+ state.lastClientY = pointerEvent.clientY;
1317
1524
  schedulePan();
1318
1525
  return;
1319
1526
  }
@@ -1336,7 +1543,14 @@ var useCanvasInteractions = ({
1336
1543
  }
1337
1544
  });
1338
1545
  },
1339
- [handleHover, schedulePan, updateGhost, rendererRef]
1546
+ [
1547
+ handleHover,
1548
+ schedulePan,
1549
+ updateGhost,
1550
+ rendererRef,
1551
+ scheduleContinuousZoom,
1552
+ bodyRef
1553
+ ]
1340
1554
  );
1341
1555
  const commitDrop = useCallback(
1342
1556
  (state, clientX, clientY) => {
@@ -1426,6 +1640,7 @@ var useCanvasInteractions = ({
1426
1640
  var _a;
1427
1641
  const canvas = dynamicCanvasRef.current;
1428
1642
  const state = stateRef.current;
1643
+ pointersRef.current.delete(pointerEvent.pointerId);
1429
1644
  stateRef.current = { mode: "idle" };
1430
1645
  if (canvas == null ? void 0 : canvas.hasPointerCapture(pointerEvent.pointerId)) {
1431
1646
  canvas.releasePointerCapture(pointerEvent.pointerId);
@@ -1462,6 +1677,20 @@ var useCanvasInteractions = ({
1462
1677
  onEventClick
1463
1678
  ]
1464
1679
  );
1680
+ const handlePointerCancel = useCallback(
1681
+ (pointerEvent) => {
1682
+ var _a;
1683
+ pointersRef.current.delete(pointerEvent.pointerId);
1684
+ stateRef.current = { mode: "idle" };
1685
+ const canvas = dynamicCanvasRef.current;
1686
+ if (canvas == null ? void 0 : canvas.hasPointerCapture(pointerEvent.pointerId)) {
1687
+ canvas.releasePointerCapture(pointerEvent.pointerId);
1688
+ }
1689
+ if (ghostRef.current) ghostRef.current.style.display = "none";
1690
+ (_a = rendererRef.current) == null ? void 0 : _a.setView({ draggedEventId: null });
1691
+ },
1692
+ [dynamicCanvasRef, ghostRef, rendererRef]
1693
+ );
1465
1694
  const handlePointerLeave = useCallback(() => {
1466
1695
  var _a, _b;
1467
1696
  if (stateRef.current.mode !== "idle") return;
@@ -1492,28 +1721,47 @@ var useCanvasInteractions = ({
1492
1721
  if (!canvas) return;
1493
1722
  const handleWheel = (wheelEvent) => {
1494
1723
  var _a;
1495
- const viaCtrl = (wheelEvent.ctrlKey || wheelEvent.metaKey) && config.ctrlWheelZoom;
1496
- if (!changeGridRef.current && !viaCtrl) return;
1497
- wheelEvent.preventDefault();
1498
- const tick = (_a = rendererRef.current) == null ? void 0 : _a.getView().tick;
1499
- if (!tick) return;
1500
- setCellWidth(
1501
- (cellWidth) => stepCellWidth(
1502
- cellWidth,
1503
- wheelEvent.deltaY,
1504
- tick * 900 / config.zoomStepSeconds
1505
- )
1506
- );
1724
+ const view = (_a = rendererRef.current) == null ? void 0 : _a.getView();
1725
+ if (!view || view.tick === null) return;
1726
+ const tick = view.tick;
1727
+ if (changeGridRef.current) {
1728
+ wheelEvent.preventDefault();
1729
+ setCellWidth(
1730
+ (cellWidth) => stepCellWidth(
1731
+ cellWidth,
1732
+ wheelEvent.deltaY,
1733
+ tick * 900 / config.zoomStepSeconds
1734
+ )
1735
+ );
1736
+ return;
1737
+ }
1738
+ if ((wheelEvent.ctrlKey || wheelEvent.metaKey) && config.ctrlWheelZoom) {
1739
+ wheelEvent.preventDefault();
1740
+ const rect = canvas.getBoundingClientRect();
1741
+ const factor = wheelEvent.deltaY > 0 ? config.zoomWheelFactor : 1 / config.zoomWheelFactor;
1742
+ applyZoom(
1743
+ {
1744
+ windowTime: [view.windowTime[0], view.windowTime[1]],
1745
+ tick,
1746
+ cellWidth: view.cellWidth
1747
+ },
1748
+ wheelEvent.clientX - rect.left,
1749
+ factor,
1750
+ rect.width
1751
+ );
1752
+ return;
1753
+ }
1507
1754
  };
1508
1755
  canvas.addEventListener("wheel", handleWheel, { passive: false });
1509
1756
  return () => canvas.removeEventListener("wheel", handleWheel);
1510
- }, [dynamicCanvasRef, rendererRef, setCellWidth, config]);
1757
+ }, [dynamicCanvasRef, rendererRef, setCellWidth, applyZoom, config]);
1511
1758
  useEffect4(() => unlockCursor, []);
1512
1759
  return {
1513
1760
  handlePointerDown,
1514
1761
  handlePointerMove,
1515
1762
  handlePointerUp,
1516
1763
  handlePointerLeave,
1764
+ handlePointerCancel,
1517
1765
  handleAuxClick
1518
1766
  };
1519
1767
  };
@@ -1535,6 +1783,7 @@ var CanvasBoard = forwardRef2(
1535
1783
  rowsHeaderClassName,
1536
1784
  setWindowTime,
1537
1785
  setCellWidth,
1786
+ setTick,
1538
1787
  onDrop,
1539
1788
  onResize,
1540
1789
  onEventClick,
@@ -1624,6 +1873,7 @@ var CanvasBoard = forwardRef2(
1624
1873
  handlePointerMove,
1625
1874
  handlePointerUp,
1626
1875
  handlePointerLeave,
1876
+ handlePointerCancel,
1627
1877
  handleAuxClick
1628
1878
  } = use_canvas_interactions_default({
1629
1879
  scene,
@@ -1634,6 +1884,7 @@ var CanvasBoard = forwardRef2(
1634
1884
  eventPromptRef,
1635
1885
  setWindowTime,
1636
1886
  setCellWidth,
1887
+ setTick,
1637
1888
  onDrop,
1638
1889
  onResize,
1639
1890
  onEventClick,
@@ -1679,9 +1930,17 @@ var CanvasBoard = forwardRef2(
1679
1930
  onPointerMove: handlePointerMove,
1680
1931
  onPointerUp: handlePointerUp,
1681
1932
  onPointerLeave: handlePointerLeave,
1933
+ onPointerCancel: handlePointerCancel,
1682
1934
  onAuxClick: handleAuxClick
1683
1935
  }
1684
- ), /* @__PURE__ */ React5.createElement("div", { ref: ghostRef, className: "event canvas-drag-ghost" })), /* @__PURE__ */ React5.createElement(
1936
+ ), /* @__PURE__ */ React5.createElement(
1937
+ "div",
1938
+ {
1939
+ ref: ghostRef,
1940
+ className: "event canvas-drag-ghost",
1941
+ style: { height: scene.getGeometry().barHeight }
1942
+ }
1943
+ )), /* @__PURE__ */ React5.createElement(
1685
1944
  "div",
1686
1945
  {
1687
1946
  className: "canvas-scroll-spacer",
@@ -1712,8 +1971,19 @@ var SceneStore = class {
1712
1971
  this.rowOrder = [];
1713
1972
  this.eventRow = /* @__PURE__ */ new Map();
1714
1973
  this.listeners = /* @__PURE__ */ new Set();
1974
+ // Themeable vertical layout. Lanes are geometry-free (pure time logic), so a
1975
+ // geometry change only affects heights/offsets — the cached lanes stay valid
1976
+ // and we just bump to trigger a redraw.
1977
+ this.geometry = DEFAULT_GEOMETRY;
1715
1978
  this.version = 0;
1716
1979
  }
1980
+ setGeometry(geometry) {
1981
+ this.geometry = geometry;
1982
+ this.bump();
1983
+ }
1984
+ getGeometry() {
1985
+ return this.geometry;
1986
+ }
1717
1987
  setRows(rows) {
1718
1988
  const next = /* @__PURE__ */ new Map();
1719
1989
  for (const row of rows) {
@@ -1818,7 +2088,10 @@ var SceneStore = class {
1818
2088
  return index.lanes;
1819
2089
  }
1820
2090
  getRowHeight(rowId, windowStart, windowEnd) {
1821
- return rowMinHeight(this.getLanes(rowId, windowStart, windowEnd).highestLane);
2091
+ return rowMinHeight(
2092
+ this.getLanes(rowId, windowStart, windowEnd).highestLane,
2093
+ this.geometry
2094
+ );
1822
2095
  }
1823
2096
  /**
1824
2097
  * y offset of each row's top edge (content coordinates, before scroll) plus
@@ -1881,6 +2154,7 @@ var Timeline = forwardRef3(
1881
2154
  eventPromptTemplate,
1882
2155
  showEventPrompt = true,
1883
2156
  panZoom,
2157
+ timeBar,
1884
2158
  animations = true
1885
2159
  }, handleRef) => {
1886
2160
  const [windowTime, setWindowTime] = useState4([
@@ -1973,8 +2247,15 @@ var Timeline = forwardRef3(
1973
2247
  }
1974
2248
  }, []);
1975
2249
  use_resize_observer_default({ contentRef, setCellWidth, setTick, windowTime });
1976
- const resolvedTheme = useMemo4(() => resolveTheme(theme), [theme]);
1977
- const resolvedAnimations = useMemo4(() => {
2250
+ const resolvedTheme = useMemo3(() => resolveTheme(theme), [theme]);
2251
+ const geometry = useMemo3(
2252
+ () => geometryFromTheme(resolvedTheme),
2253
+ [resolvedTheme]
2254
+ );
2255
+ useEffect6(() => {
2256
+ scene.setGeometry(geometry);
2257
+ }, [scene, geometry]);
2258
+ const resolvedAnimations = useMemo3(() => {
1978
2259
  var _a, _b;
1979
2260
  if (animations === false) return { layoutMs: 0, fadeMs: 0 };
1980
2261
  if (animations === true) {
@@ -1988,7 +2269,7 @@ var Timeline = forwardRef3(
1988
2269
  fadeMs: (_b = animations.fadeMs) != null ? _b : DEFAULT_FADE_DURATION_MS
1989
2270
  };
1990
2271
  }, [animations]);
1991
- const eventPrompt = useMemo4(
2272
+ const eventPrompt = useMemo3(
1992
2273
  () => /* @__PURE__ */ React6.createElement(
1993
2274
  event_prompt_default,
1994
2275
  {
@@ -2005,7 +2286,8 @@ var Timeline = forwardRef3(
2005
2286
  tick,
2006
2287
  contentWidth: contentRef.current ? contentRef.current.getBoundingClientRect().width : null,
2007
2288
  scrollWidth,
2008
- theme: resolvedTheme
2289
+ theme: resolvedTheme,
2290
+ timeBar
2009
2291
  }
2010
2292
  ), /* @__PURE__ */ React6.createElement("div", { className: "body-wrapper", ref: bodyRef }, /* @__PURE__ */ React6.createElement(
2011
2293
  canvas_board_default,
@@ -2023,6 +2305,7 @@ var Timeline = forwardRef3(
2023
2305
  rowsHeaderClassName: additionalClassNames == null ? void 0 : additionalClassNames.rowsHeader,
2024
2306
  setWindowTime,
2025
2307
  setCellWidth,
2308
+ setTick,
2026
2309
  onDrop,
2027
2310
  onResize,
2028
2311
  onEventClick,