@kumix/ui 0.3.8 → 0.3.10

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.
Files changed (102) hide show
  1. package/README.md +16 -15
  2. package/dist/components/agents/ai-sidebar.js +3 -5
  3. package/dist/components/agents/ai-sidebar.js.map +1 -1
  4. package/dist/components/motion/animated-sidebar.d.ts.map +1 -1
  5. package/dist/components/motion/animated-sidebar.js.map +1 -1
  6. package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
  7. package/dist/components/motion/availability-scheduler/day-row.d.ts.map +1 -1
  8. package/dist/components/motion/availability-scheduler/day-row.js +15 -7
  9. package/dist/components/motion/availability-scheduler/day-row.js.map +1 -1
  10. package/dist/components/motion/availability-scheduler/index.js +1 -1
  11. package/dist/components/motion/button/index.d.ts +2 -1
  12. package/dist/components/motion/button/index.js +2 -1
  13. package/dist/components/motion/button/metallic.d.ts +10 -0
  14. package/dist/components/motion/button/metallic.d.ts.map +1 -0
  15. package/dist/components/motion/button/metallic.js +71 -0
  16. package/dist/components/motion/button/metallic.js.map +1 -0
  17. package/dist/components/motion/combobox/content.js +1 -1
  18. package/dist/components/motion/combobox/context.d.ts +6 -0
  19. package/dist/components/motion/combobox/context.d.ts.map +1 -1
  20. package/dist/components/motion/combobox/context.js +1 -233
  21. package/dist/components/motion/combobox/list.js +1 -1
  22. package/dist/components/motion/combobox/trigger.js +7 -8
  23. package/dist/components/motion/combobox/trigger.js.map +1 -1
  24. package/dist/components/motion/combobox.js +1 -1
  25. package/dist/components/motion/command-palette.d.ts.map +1 -1
  26. package/dist/components/motion/command-palette.js +21 -26
  27. package/dist/components/motion/command-palette.js.map +1 -1
  28. package/dist/components/motion/expandable-control.d.ts +28 -0
  29. package/dist/components/motion/expandable-control.d.ts.map +1 -0
  30. package/dist/components/motion/expandable-control.js +149 -0
  31. package/dist/components/motion/expandable-control.js.map +1 -0
  32. package/dist/components/motion/expanding-arrow-button.d.ts +12 -0
  33. package/dist/components/motion/expanding-arrow-button.d.ts.map +1 -0
  34. package/dist/components/motion/expanding-arrow-button.js +142 -0
  35. package/dist/components/motion/expanding-arrow-button.js.map +1 -0
  36. package/dist/components/motion/file-tree.d.ts +42 -0
  37. package/dist/components/motion/file-tree.d.ts.map +1 -0
  38. package/dist/components/motion/file-tree.js +272 -0
  39. package/dist/components/motion/file-tree.js.map +1 -0
  40. package/dist/components/motion/morphing-search.d.ts.map +1 -1
  41. package/dist/components/motion/morphing-search.js +27 -23
  42. package/dist/components/motion/morphing-search.js.map +1 -1
  43. package/dist/components/reui/alert.d.ts +1 -1
  44. package/dist/components/reui/badge.d.ts +1 -1
  45. package/dist/components/reui/code-block/code-block-highlight.d.ts +216 -0
  46. package/dist/components/reui/code-block/code-block-highlight.d.ts.map +1 -0
  47. package/dist/components/reui/code-block/code-block-highlight.js +792 -0
  48. package/dist/components/reui/code-block/code-block-highlight.js.map +1 -0
  49. package/dist/components/reui/code-block/code-block.d.ts +197 -0
  50. package/dist/components/reui/code-block/code-block.d.ts.map +1 -0
  51. package/dist/components/reui/code-block/code-block.js +1150 -0
  52. package/dist/components/reui/code-block/code-block.js.map +1 -0
  53. package/dist/components/reui/filters/filters-builder.js +1 -1
  54. package/dist/components/reui/filters/filters-chip.js.map +1 -1
  55. package/dist/components/reui/filters/filters-editors.js +2 -2
  56. package/dist/components/reui/filters/filters-editors.js.map +1 -1
  57. package/dist/components/reui/gantt/gantt-bar.js +42 -12
  58. package/dist/components/reui/gantt/gantt-bar.js.map +1 -1
  59. package/dist/components/reui/gantt/gantt-dnd.d.ts.map +1 -1
  60. package/dist/components/reui/gantt/gantt-dnd.js +22 -7
  61. package/dist/components/reui/gantt/gantt-dnd.js.map +1 -1
  62. package/dist/components/reui/gantt/gantt-i18n.d.ts +8 -0
  63. package/dist/components/reui/gantt/gantt-i18n.d.ts.map +1 -1
  64. package/dist/components/reui/gantt/gantt-i18n.js +6 -1
  65. package/dist/components/reui/gantt/gantt-i18n.js.map +1 -1
  66. package/dist/components/reui/gantt/gantt-lib.d.ts +59 -2
  67. package/dist/components/reui/gantt/gantt-lib.d.ts.map +1 -1
  68. package/dist/components/reui/gantt/gantt-lib.js +67 -2
  69. package/dist/components/reui/gantt/gantt-lib.js.map +1 -1
  70. package/dist/components/reui/gantt/gantt-recurrence.js +3 -3
  71. package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -1
  72. package/dist/components/reui/gantt/gantt-types.d.ts +32 -1
  73. package/dist/components/reui/gantt/gantt-types.d.ts.map +1 -1
  74. package/dist/components/reui/gantt/gantt-view.d.ts.map +1 -1
  75. package/dist/components/reui/gantt/gantt-view.js +324 -35
  76. package/dist/components/reui/gantt/gantt-view.js.map +1 -1
  77. package/dist/components/reui/gantt/gantt.d.ts +71 -2
  78. package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
  79. package/dist/components/reui/gantt/gantt.js +8 -0
  80. package/dist/components/reui/gantt/gantt.js.map +1 -1
  81. package/dist/components/ui/badge.d.ts +1 -1
  82. package/dist/components/ui/bubble.d.ts +1 -1
  83. package/dist/components/ui/button.d.ts +1 -1
  84. package/dist/components/ui/item.d.ts +1 -1
  85. package/dist/components/ui/marker.d.ts +1 -1
  86. package/dist/components/ui/tabs.d.ts +1 -1
  87. package/dist/context-BizvUNZv.js +298 -0
  88. package/dist/context-BizvUNZv.js.map +1 -0
  89. package/dist/{copy-menu-1FKoMc9o.js → copy-menu-C5GaT4Z-.js} +67 -2
  90. package/dist/copy-menu-C5GaT4Z-.js.map +1 -0
  91. package/dist/hooks/use-on-open.d.ts +18 -0
  92. package/dist/hooks/use-on-open.d.ts.map +1 -0
  93. package/dist/hooks/use-on-open.js +27 -0
  94. package/dist/hooks/use-on-open.js.map +1 -0
  95. package/dist/hooks/use-row-cursor.d.ts +39 -0
  96. package/dist/hooks/use-row-cursor.d.ts.map +1 -0
  97. package/dist/hooks/use-row-cursor.js +77 -0
  98. package/dist/hooks/use-row-cursor.js.map +1 -0
  99. package/dist/types-smkWN_7x.d.ts.map +1 -1
  100. package/package.json +7 -13
  101. package/dist/components/motion/combobox/context.js.map +0 -1
  102. package/dist/copy-menu-1FKoMc9o.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"gantt-dnd.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-dnd.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect } from \"react\";\nimport { addDays, differenceInCalendarDays } from \"date-fns\";\n\nimport { type GanttInstance, resolveScheduleMode, useGantt, useGanttViewConfig } from \"./gantt\";\nimport { findResource, snapMinutes, toZoned, zonedStartOfDay } from \"./gantt-lib\";\nimport type { GanttProposedUpdate, GanttScheduleMode, GanttSegment } from \"./gantt-types\";\n\n/**\n * Activation policy (dnd-kit parity where proven):\n * mouse move 5px before a drag starts (below = click), create 4px;\n * touch long-press 250ms with 5px tolerance (movement past tolerance\n * before the delay cancels the drag so taps stay taps).\n */\nconst GANTT_ACTIVATION = {\n moveDistancePx: 5,\n createDistancePx: 4,\n touchDelayMs: 250,\n touchTolerancePx: 5,\n} as const;\n\ntype GestureKind = \"move\" | \"resize-start\" | \"resize-end\" | \"create\";\n\ninterface GanttSurface {\n rect: DOMRect;\n rangeStart: number;\n rangeEnd: number;\n snapMin: number;\n /** Mirrored axis: in RTL the range START sits at the rect's RIGHT edge. */\n isRtl: boolean;\n rows: Array<{ resourceId: string; rect: DOMRect }>;\n}\n\n/**\n * Pointer x (viewport px) to minutes from the range start, clamped to the\n * track. The single place the horizontal axis direction is resolved: every\n * gesture mapping (move, both resizes, create, grab offset) goes through it.\n */\nfunction surfaceMinutesAt(tl: GanttSurface, x: number): number {\n const clamped = Math.min(Math.max(x, tl.rect.left), tl.rect.right);\n const traveled = tl.isRtl ? tl.rect.right - clamped : clamped - tl.rect.left;\n return (traveled / tl.rect.width) * ((tl.rangeEnd - tl.rangeStart) / 60000);\n}\n\n/** Module flag so bar onClick can ignore the click that ends a drag. */\nlet lastGestureEndedAt = 0;\nfunction wasRecentDrag(): boolean {\n return performance.now() - lastGestureEndedAt < 250;\n}\n\n/** Mark a non-dnd gesture (e.g. a timeline pan) so the click it ends is ignored. */\nfunction markGestureEnd(): void {\n lastGestureEndedAt = performance.now();\n}\n\n/**\n * Registry of in-flight gesture cancels. A gesture measures its surface\n * (axis + row rects) once at activation, so the VIEW - not the bar, bars\n * legitimately unmount mid-gesture - must be able to abort gestures when it\n * unmounts or when the measured geometry changes under them (zoom, scale,\n * range growth, splitter). Cancel fully reverts: listeners, overlays and the\n * body drag state all clear, and no update is committed.\n */\nconst activeGestureCancels = new Set<() => void>();\n\n/** Cancel (and fully revert) every in-flight gantt pointer gesture. */\nfunction cancelActiveGanttGestures(): void {\n for (const cancel of [...activeGestureCancels]) cancel();\n}\n\n/**\n * View-level teardown, mounted once by GanttView: aborts any in-flight\n * gesture on unmount so window listeners, body-appended overlays and the\n * gantt-dragging body class never outlive the gantt.\n */\nfunction useGanttGestureTeardown(): void {\n useEffect(() => cancelActiveGanttGestures, []);\n}\n\n/**\n * Snap a translate offset to the device pixel grid. The cursor-following\n * overlays (the move clone and the resize indicator) are their own\n * `will-change: transform` compositing layers: the GPU rasterizes their text\n * once and repositions that texture each frame, so a subpixel translate\n * (getBoundingClientRect and raw clientX/Y are routinely fractional) resamples\n * the texture and blurs the text. Rounding each offset to a whole device pixel\n * lands the layer on the grid so glyphs stay crisp, without giving up the\n * per-frame GPU transform.\n */\nfunction snapToPixel(value: number): number {\n const dpr = typeof window !== \"undefined\" ? window.devicePixelRatio || 1 : 1;\n return Math.round(value * dpr) / dpr;\n}\n\nfunction collectSurface(root: HTMLElement | null): GanttSurface | null {\n if (!root) return null;\n const axis = root.querySelector<HTMLElement>(\"[data-gantt-axis]\");\n if (!axis) return null;\n return {\n rect: axis.getBoundingClientRect(),\n rangeStart: Number(axis.dataset.ganttRangeStart),\n rangeEnd: Number(axis.dataset.ganttRangeEnd),\n snapMin: Number(axis.dataset.ganttSnap) || 15,\n isRtl: getComputedStyle(axis).direction === \"rtl\",\n rows: [...root.querySelectorAll<HTMLElement>(\"[data-gantt-row]\")]\n // static rows (parents that aggregate their subtree) take no drops\n .filter((row) => row.dataset.ganttRowStatic === undefined)\n .map((row) => ({\n resourceId: row.dataset.ganttResource ?? \"\",\n rect: row.getBoundingClientRect(),\n })),\n };\n}\n\ninterface BeginGestureConfig<TData> {\n instance: GanttInstance<TData>;\n kind: GestureKind;\n origin: HTMLElement;\n startEvent: PointerEvent;\n segment?: GanttSegment<TData>;\n /** Consumer renders the move preview (renderDragPreview); the engine only positions it. */\n customMoveOverlay?: boolean;\n /** Consumer renders the resize indicator; the engine only positions it. */\n customResizeOverlay?: boolean;\n /** View-level cardinality default; a node's own scheduleMode wins. */\n scheduleMode?: GanttScheduleMode;\n}\n\nfunction beginGesture<TData>(config: BeginGestureConfig<TData>) {\n const { instance, kind, origin, startEvent, segment, customMoveOverlay, customResizeOverlay } =\n config;\n const { settings, internals, api } = instance;\n const activation = { ...GANTT_ACTIVATION, ...settings.activation };\n const startX = startEvent.clientX;\n const startY = startEvent.clientY;\n const pointerId = startEvent.pointerId;\n // stable ancestors: bar nodes may be replaced by re-renders mid-gesture\n const viewRoot = origin.closest<HTMLElement>(\"[data-slot=gantt-view]\");\n const ganttRoot = origin.closest<HTMLElement>(\"[data-slot=gantt]\");\n const announcer = ganttRoot?.querySelector<HTMLElement>(\"[data-slot=gantt-announcer]\");\n\n /**\n * The cursor-following overlays are appended to document.body so no ancestor\n * transform or overflow can clip them - which also cuts them off from the\n * gantt root, and the root is what OWNS the type scale (its `text-xs` is\n * what every resting label inherits). Without this the clone's label jumps\n * to the document default and reads visibly bigger than the bar it left.\n * Copying the ROOT's resolved metrics - rather than hardcoding a size -\n * keeps the documented contract that one class on the root (e.g.\n * className=\"text-sm\") rescales the whole gantt, drag clone included.\n */\n const adoptRootTypography = (el: HTMLElement) => {\n if (!ganttRoot) return;\n const rootStyle = getComputedStyle(ganttRoot);\n el.style.fontSize = rootStyle.fontSize;\n el.style.lineHeight = rootStyle.lineHeight;\n el.style.fontFamily = rootStyle.fontFamily;\n el.style.letterSpacing = rootStyle.letterSpacing;\n // physical positioning, logical content: the flex row mirrors so the\n // label lands on the same side of the bar as the resting one in RTL\n el.style.direction = rootStyle.direction;\n };\n\n const isTouch = startEvent.pointerType === \"touch\";\n // resize activates immediately on precise pointers; on touch it waits for\n // the same long-press as a move, so a stray brush over a bar edge can\n // never start an accidental resize\n let active = kind.startsWith(\"resize\") && !isTouch;\n let surface: GanttSurface | null = active ? collectSurface(viewRoot) : null;\n let lastProposalKey = \"\";\n let touchTimer: ReturnType<typeof setTimeout> | null = null;\n let lastPointer: PointerEvent = startEvent;\n\n const occurrence = segment?.occurrence;\n\n // ----- neighbour awareness: the other schedules in the SAME node -----\n // A node in \"single\" mode rejects any concurrency regardless of the\n // overlap option; otherwise the option decides. \"allow\" short-circuits\n // everything below, so the default gesture path is untouched.\n const nodeId = occurrence?.event.resourceId;\n const nodeMode = resolveScheduleMode(\n nodeId === undefined ? null : findResource(settings.resources, nodeId),\n config.scheduleMode,\n );\n const overlapPolicy = nodeMode === \"single\" ? (\"reject\" as const) : settings.overlap;\n // Read once per gesture: the gantt never mutates events mid-drag, so the\n // neighbours cannot move under us.\n let neighbourCache: Array<{ start: number; end: number }> | null = null;\n const getNeighbours = () => {\n if (neighbourCache) return neighbourCache;\n neighbourCache =\n !occurrence || nodeId === undefined || overlapPolicy === \"allow\"\n ? []\n : api\n .getOccurrences()\n .filter((other) => other.event.resourceId === nodeId && other.key !== occurrence.key)\n .map((other) => ({\n start: other.start.getTime(),\n end: other.end.getTime(),\n }));\n return neighbourCache;\n };\n const overlapsNeighbour = (start: Date, end: Date) =>\n getNeighbours().some((other) => other.start < end.getTime() && other.end > start.getTime());\n /**\n * Stop the gesture at the neighbour's edge. Runs AFTER snapping so the\n * clamp always wins, and only against neighbours that sit clear of the\n * bar's CURRENT span - a pre-existing overlap has no edge to stop at.\n */\n const clampToNeighbours = (start: Date, end: Date): { start: Date; end: Date } => {\n if (overlapPolicy !== \"clamp\" || !occurrence) return { start, end };\n const anchorStart = occurrence.start.getTime();\n const anchorEnd = occurrence.end.getTime();\n let floor = -Infinity;\n let ceiling = Infinity;\n for (const other of getNeighbours()) {\n if (other.end <= anchorStart) floor = Math.max(floor, other.end);\n else if (other.start >= anchorEnd) ceiling = Math.min(ceiling, other.start);\n }\n if (floor === -Infinity && ceiling === Infinity) return { start, end };\n let from = start.getTime();\n let to = end.getTime();\n if (kind === \"resize-start\") {\n from = Math.min(Math.max(from, floor), to);\n } else if (kind === \"resize-end\") {\n to = Math.max(Math.min(to, ceiling), from);\n } else {\n // a move keeps its duration and parks against whichever edge it meets\n const duration = to - from;\n if (from < floor) {\n from = floor;\n to = from + duration;\n }\n if (to > ceiling) {\n to = ceiling;\n from = to - duration;\n }\n // window narrower than the bar itself: park at the earlier edge\n if (from < floor) {\n from = floor;\n to = from + duration;\n }\n }\n return { start: new Date(from), end: new Date(to) };\n };\n // Set by applyProposal when a \"reject\" policy refuses the current proposal;\n // read on pointerup so the commit is actually blocked, not merely styled.\n let overlapRejected = false;\n\n // Preserve the grab offset so the bar does not jump to the pointer\n let grabOffsetMin = 0;\n // Smooth cursor-following clone for a move: a real-looking bar that tracks\n // the pointer's x via transform (no per-frame React), lifted with a shadow.\n let overlay: HTMLDivElement | null = null;\n let grabOffsetPx = 0;\n let barTop = 0;\n let barWidth = 0;\n let barHeight = 0;\n\n const createMoveOverlay = () => {\n if (kind !== \"move\" || !occurrence || overlay || barWidth === 0) return;\n // consumer-rendered preview (renderDragPreview): the view mounts it from\n // drag state; positionOverlay adopts it lazily and only writes transforms\n if (customMoveOverlay) return;\n const color = occurrence.event.color ?? \"var(--color-primary)\";\n overlay = document.createElement(\"div\");\n overlay.setAttribute(\"data-slot\", \"gantt-drag-overlay\");\n // container: the bar + its label ride together; the label stays OUTSIDE\n // the bar (to the right), matching the resting look - no in-bar text\n overlay.className =\n // physical left-0 anchor: the clone is positioned by translate3d from\n // raw clientX, which is physical - a logical start-0 anchor would pin\n // it to the RIGHT edge in RTL and fling the clone off screen\n \"pointer-events-none fixed top-0 left-0 z-100 flex items-center gap-2 will-change-transform\";\n adoptRootTypography(overlay);\n overlay.style.height = `${barHeight}px`;\n const barEl = document.createElement(\"div\");\n barEl.className = \"shrink-0 rounded-sm shadow-lg\";\n barEl.style.width = `${barWidth}px`;\n barEl.style.height = \"100%\";\n barEl.style.background = `color-mix(in oklab, ${color} 22%, var(--color-background))`;\n barEl.style.outline = `1px solid color-mix(in oklab, ${color} 55%, transparent)`;\n overlay.appendChild(barEl);\n const label = document.createElement(\"span\");\n label.className = \"text-foreground truncate font-medium whitespace-nowrap\";\n label.textContent = occurrence.event.title;\n overlay.appendChild(label);\n document.body.appendChild(overlay);\n positionOverlay(lastPointer);\n };\n\n const positionOverlay = (e: PointerEvent) => {\n if (!overlay && customMoveOverlay && active && kind === \"move\") {\n overlay = document.querySelector<HTMLDivElement>(\n \"[data-slot=gantt-drag-overlay][data-custom]\",\n );\n if (overlay) overlay.style.visibility = \"visible\";\n }\n if (!overlay) return;\n // x follows the pointer freely (smooth); y stays on the bar's own row\n overlay.style.transform = `translate3d(${snapToPixel(e.clientX - grabOffsetPx)}px, ${snapToPixel(barTop)}px, 0)`;\n };\n\n // Resize status indicator: a smooth cursor-following edge line plus a live\n // range + duration chip. The dashed ghost still shows the SNAPPED landing;\n // this overlay is the continuous feedback between snap steps.\n let resizeOverlay: HTMLDivElement | null = null;\n let resizeLine: HTMLDivElement | null = null;\n let resizeRange: HTMLSpanElement | null = null;\n let resizeDot: HTMLSpanElement | null = null;\n let resizeDuration: HTMLSpanElement | null = null;\n\n const positionResizeOverlay = (e: PointerEvent) => {\n if (!resizeOverlay && customResizeOverlay && kind.startsWith(\"resize\")) {\n resizeOverlay = document.querySelector<HTMLDivElement>(\n \"[data-slot=gantt-resize-indicator][data-custom]\",\n );\n if (resizeOverlay) resizeOverlay.style.visibility = \"visible\";\n }\n if (!resizeOverlay || !surface) return;\n // x follows the pointer freely (clamped to the track); y stays on the bar\n const x = Math.min(Math.max(e.clientX, surface.rect.left), surface.rect.right);\n resizeOverlay.style.transform = `translate3d(${snapToPixel(x)}px, ${snapToPixel(barTop)}px, 0)`;\n };\n\n const createResizeOverlay = () => {\n if (!kind.startsWith(\"resize\") || !occurrence || resizeOverlay) return;\n const barEl = origin.closest<HTMLElement>(\"[data-slot=gantt-bar]\");\n const rect = (barEl ?? origin).getBoundingClientRect();\n barTop = rect.top;\n barHeight = rect.height;\n // consumer-rendered indicator: rect capture above still runs (the engine\n // positions the consumer's wrapper), only the default DOM is skipped\n if (customResizeOverlay) return;\n const color = occurrence.event.color ?? \"var(--color-primary)\";\n resizeOverlay = document.createElement(\"div\");\n resizeOverlay.setAttribute(\"data-slot\", \"gantt-resize-indicator\");\n resizeOverlay.className =\n // physical left-0 anchor, same reason as the move clone above\n \"pointer-events-none fixed top-0 left-0 z-100 will-change-transform\";\n adoptRootTypography(resizeOverlay);\n resizeOverlay.style.height = `${barHeight}px`;\n resizeLine = document.createElement(\"div\");\n resizeLine.className = \"h-full w-0.5 -translate-x-1/2 rounded-full\";\n resizeLine.style.background = color;\n resizeOverlay.appendChild(resizeLine);\n const chip = document.createElement(\"div\");\n chip.className =\n // physical left-0: centered with a physical translate on a physical anchor\n // no text size of its own: it inherits the root scale adopted above, so\n // the chip tracks a consumer rescale instead of pinning itself to 12px\n \"bg-foreground text-background absolute bottom-full left-0 mb-1.5 flex -translate-x-1/2 items-center gap-1.5 rounded-md px-2 py-1 font-medium whitespace-nowrap\";\n resizeRange = document.createElement(\"span\");\n chip.appendChild(resizeRange);\n resizeDot = document.createElement(\"span\");\n resizeDot.className = \"bg-background/40 size-1 shrink-0 rounded-full\";\n resizeDot.setAttribute(\"aria-hidden\", \"true\");\n chip.appendChild(resizeDot);\n resizeDuration = document.createElement(\"span\");\n chip.appendChild(resizeDuration);\n // The arrow. Every other bubble in the gantt has one pointing at what it\n // describes; this chip had none, so a resize looked like a different\n // component from the hover hint. Physical left-1/2 to match the chip's own\n // physical anchor, and out of flow so the chip's flex gap ignores it.\n const chipArrow = document.createElement(\"span\");\n chipArrow.setAttribute(\"aria-hidden\", \"true\");\n chipArrow.className =\n \"bg-foreground absolute -bottom-1 left-1/2 size-2.5 -translate-x-1/2 rotate-45 rounded-[2px]\";\n chip.appendChild(chipArrow);\n resizeOverlay.appendChild(chip);\n document.body.appendChild(resizeOverlay);\n // seed the chip with the CURRENT range so it never flashes empty;\n // zoned so the label names the same day the grid shows\n resizeRange.textContent = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay ?? false,\n settings.locale,\n );\n const days = Math.round((occurrence.end.getTime() - occurrence.start.getTime()) / 86_400_000);\n if (days >= 1) {\n resizeDuration.textContent = settings.i18n.labels.durationDays(days);\n } else {\n resizeDot.style.display = \"none\";\n resizeDuration.style.display = \"none\";\n }\n positionResizeOverlay(startEvent);\n };\n\n // resize activates immediately, so its indicator mounts with the gesture\n if (active) createResizeOverlay();\n\n const activationDistance =\n kind === \"create\" ? activation.createDistancePx : activation.moveDistancePx;\n\n // Each gesture keeps its own cursor: a resize must stay ew-resize for the\n // whole drag (flipping to grabbing reads as a move), a move grabs.\n const gestureCursor = kind.startsWith(\"resize\") ? \"ew-resize\" : \"grabbing\";\n const setBodyDragging = (on: boolean, invalid = false) => {\n document.body.classList.toggle(\"gantt-dragging\", on);\n document.body.style.cursor = on ? (invalid ? \"not-allowed\" : gestureCursor) : \"\";\n document.body.style.userSelect = on ? \"none\" : \"\";\n if (!on) document.body.style.removeProperty(\"-webkit-user-select\");\n };\n\n const activate = () => {\n if (active) return;\n active = true;\n surface = collectSurface(viewRoot);\n // touch resize activates here (long-press) instead of at gesture start,\n // so its indicator mounts now; the guard inside makes this a no-op for\n // every other path\n createResizeOverlay();\n if (kind === \"move\" && occurrence && surface) {\n const pointerMin = surfaceMinutesAt(surface, startX);\n // TRUE start, never clamped to the range: a bar that begins before the\n // visible window (negative minutes) must keep its real grab offset, or\n // the first snapped proposal teleports its start to the range edge\n const occStartMin = (occurrence.start.getTime() - surface.rangeStart) / 60000;\n grabOffsetMin = pointerMin - occStartMin;\n const rect = origin.getBoundingClientRect();\n barTop = rect.top;\n barWidth = rect.width;\n barHeight = rect.height;\n grabOffsetPx = startX - rect.left;\n createMoveOverlay();\n }\n setBodyDragging(true);\n };\n\n const computeProposal = (\n e: PointerEvent,\n ): {\n start: Date;\n end: Date;\n allDay: boolean;\n resourceId?: string;\n } | null => {\n if (!surface) return null;\n const tl = surface;\n const rangeMinutes = (tl.rangeEnd - tl.rangeStart) / 60000;\n const minutesAt = (x: number) => surfaceMinutesAt(tl, x);\n // Day-grid scales snap to real zoned midnights, not 1440-minute\n // multiples from the range start - those drift by an hour across DST\n const snapMin = (minutes: number) => {\n if (tl.snapMin < 24 * 60) return snapMinutes(minutes, tl.snapMin);\n const ms = tl.rangeStart + minutes * 60000;\n const dayStart = zonedStartOfDay(new Date(ms), settings.timeZone);\n const dayEnd = zonedStartOfDay(\n addDays(toZoned(new Date(ms), settings.timeZone), 1),\n settings.timeZone,\n );\n const snapped = ms - dayStart.getTime() < dayEnd.getTime() - ms ? dayStart : dayEnd;\n return (snapped.getTime() - tl.rangeStart) / 60000;\n };\n const rowAt = (y: number) => {\n let best = tl.rows[0];\n for (const row of tl.rows) {\n if (y >= row.rect.top && y < row.rect.bottom) return row;\n if (\n best &&\n Math.abs(y - (row.rect.top + row.rect.height / 2)) <\n Math.abs(y - (best.rect.top + best.rect.height / 2))\n ) {\n best = row;\n }\n }\n return best;\n };\n const at = (minutes: number) => new Date(tl.rangeStart + minutes * 60000);\n\n if (kind === \"create\") {\n const anchorMin = snapMin(minutesAt(startX));\n const curMin = snapMin(minutesAt(e.clientX));\n const lo = Math.min(anchorMin, curMin);\n // a bare click still yields a usable slot: at least slotDuration long\n const hi = Math.max(anchorMin, curMin, lo + Math.max(tl.snapMin, settings.slotDuration));\n return {\n start: at(lo),\n end: at(hi),\n allDay: false,\n resourceId: rowAt(startY)?.resourceId,\n };\n }\n if (!occurrence) return null;\n const midnightAligned = (d: Date) =>\n zonedStartOfDay(d, settings.timeZone).getTime() === d.getTime();\n if (kind === \"move\") {\n // x-axis only: the bar slides along its OWN row, never across rows.\n // The proposal preserves the pointer DELTA - no clamping to the visible\n // range, or bars crossing the window edge would teleport to it.\n const start = at(snapMin(minutesAt(e.clientX) - grabOffsetMin));\n // Day-snapped scales preserve the CALENDAR span for day-aligned bars:\n // a 3-day bar dragged across a DST change stays midnight-to-midnight\n // (72h +/- 1h), never drifting to a 23:00 end. Sub-day events keep\n // their exact ms duration.\n let end: Date;\n if (\n tl.snapMin >= 24 * 60 &&\n (occurrence.allDay ||\n (midnightAligned(occurrence.start) && midnightAligned(occurrence.end)))\n ) {\n const daySpan = Math.max(\n differenceInCalendarDays(\n toZoned(occurrence.end, settings.timeZone),\n toZoned(occurrence.start, settings.timeZone),\n ),\n 1,\n );\n end = zonedStartOfDay(\n addDays(toZoned(start, settings.timeZone), daySpan),\n settings.timeZone,\n );\n } else {\n end = new Date(start.getTime() + (occurrence.end.getTime() - occurrence.start.getTime()));\n }\n const bounded = clampToNeighbours(start, end);\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n }\n const min = snapMin(minutesAt(e.clientX));\n if (kind === \"resize-start\") {\n const endMin = (occurrence.end.getTime() - tl.rangeStart) / 60000;\n // Minimum length = one snap unit; on day grids that unit is the LAST\n // zoned midnight before the end (raw 1440-minute arithmetic lands off\n // the midnight grid across DST changes).\n const maxStartMin =\n tl.snapMin >= 24 * 60\n ? (zonedStartOfDay(\n midnightAligned(occurrence.end)\n ? addDays(toZoned(occurrence.end, settings.timeZone), -1)\n : occurrence.end,\n settings.timeZone,\n ).getTime() -\n tl.rangeStart) /\n 60000\n : endMin - tl.snapMin;\n const clamped = Math.min(Math.max(min, 0), maxStartMin);\n const bounded = clampToNeighbours(at(clamped), occurrence.end);\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n }\n const startMin = (occurrence.start.getTime() - tl.rangeStart) / 60000;\n // Mirror of the resize-start bound: the FIRST zoned midnight after the\n // start on day grids, plain snap arithmetic otherwise.\n const minEndMin =\n tl.snapMin >= 24 * 60\n ? (zonedStartOfDay(\n addDays(toZoned(occurrence.start, settings.timeZone), 1),\n settings.timeZone,\n ).getTime() -\n tl.rangeStart) /\n 60000\n : startMin + tl.snapMin;\n const clamped = Math.max(Math.min(min, rangeMinutes), minEndMin);\n const bounded = clampToNeighbours(occurrence.start, at(clamped));\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n };\n\n const applyProposal = (e: PointerEvent) => {\n const proposal = computeProposal(e);\n if (!proposal) return;\n const key = `${proposal.start.getTime()}-${proposal.end.getTime()}-${proposal.allDay}-${proposal.resourceId ?? \"\"}`;\n if (key === lastProposalKey) return;\n lastProposalKey = key;\n\n if (kind === \"create\") {\n const draft = { ...proposal };\n if (settings.canSelectSlot && !settings.canSelectSlot(draft)) return;\n internals.setSlotDraft(draft);\n return;\n }\n const update: GanttProposedUpdate<TData> = {\n event: occurrence!.event,\n occurrence: occurrence!,\n ...proposal,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n };\n // \"reject\" is the one veto the engine owns: it both styles the ghost AND\n // blocks the commit below. canDropEvent stays advisory, as documented.\n overlapRejected = overlapPolicy === \"reject\" && overlapsNeighbour(proposal.start, proposal.end);\n const valid =\n !overlapRejected && (settings.canDropEvent ? settings.canDropEvent(update) : true);\n // live status: the indicator chip always names the CURRENT proposed\n // range; the edge line flips to destructive on an invalid drop\n if (resizeRange && resizeDot && resizeDuration) {\n resizeRange.textContent = settings.i18n.functions.formatEventTime(\n toZoned(proposal.start, settings.timeZone),\n toZoned(proposal.end, settings.timeZone),\n proposal.allDay,\n settings.locale,\n );\n const days = Math.round((proposal.end.getTime() - proposal.start.getTime()) / 86_400_000);\n const showDays = days >= 1;\n resizeDot.style.display = showDays ? \"\" : \"none\";\n resizeDuration.style.display = showDays ? \"\" : \"none\";\n if (showDays) {\n resizeDuration.textContent = settings.i18n.labels.durationDays(days);\n }\n }\n if (resizeLine) {\n resizeLine.style.background = valid\n ? (occurrence!.event.color ?? \"var(--color-primary)\")\n : \"var(--color-destructive)\";\n }\n setBodyDragging(true, !valid);\n internals.setDrag({\n kind: kind === \"move\" ? \"move\" : (kind as \"resize-start\" | \"resize-end\"),\n occurrence: occurrence!,\n proposedStart: proposal.start,\n proposedEnd: proposal.end,\n proposedAllDay: proposal.allDay,\n proposedResourceId: proposal.resourceId,\n valid,\n });\n };\n\n // ----- edge auto-scroll: pan the timeline while dragging near its edge -----\n // The pointer is clamped to the visible track, so without this a bar can\n // never travel past the window. Holding the pointer inside the edge zone\n // scrolls the viewport (speed eased by proximity), refreshes the track rect\n // (the axis moved under the pointer) and re-derives the proposal from the\n // same pointer position. Programmatic scrolls never mark user intent, so\n // this can never trigger infinite-range growth mid-gesture.\n const AUTO_SCROLL_EDGE_PX = 24;\n const AUTO_SCROLL_MAX_SPEED = 14;\n let autoScrollRaf = 0;\n const timelineViewport = viewRoot?.querySelector<HTMLElement>(\n \"[data-slot=gantt-timeline-pane] [data-slot=scroll-area-viewport]\",\n );\n const autoScrollTick = () => {\n autoScrollRaf = 0;\n if (finished || !active || !surface || !timelineViewport) return;\n const paneRect = timelineViewport.getBoundingClientRect();\n const x = lastPointer.clientX;\n let speed = 0;\n if (x < paneRect.left + AUTO_SCROLL_EDGE_PX) {\n speed =\n -((paneRect.left + AUTO_SCROLL_EDGE_PX - x) / AUTO_SCROLL_EDGE_PX) * AUTO_SCROLL_MAX_SPEED;\n } else if (x > paneRect.right - AUTO_SCROLL_EDGE_PX) {\n speed =\n ((x - (paneRect.right - AUTO_SCROLL_EDGE_PX)) / AUTO_SCROLL_EDGE_PX) *\n AUTO_SCROLL_MAX_SPEED;\n }\n if (speed === 0) return;\n const before = timelineViewport.scrollLeft;\n timelineViewport.scrollLeft = before + speed;\n if (timelineViewport.scrollLeft === before) return; // parked on the end\n const axis = viewRoot?.querySelector<HTMLElement>(\"[data-gantt-axis]\");\n if (axis) surface.rect = axis.getBoundingClientRect();\n applyProposal(lastPointer);\n positionResizeOverlay(lastPointer);\n scheduleAutoScroll();\n };\n const scheduleAutoScroll = () => {\n if (!autoScrollRaf) autoScrollRaf = requestAnimationFrame(autoScrollTick);\n };\n\n // idempotent: pointerup, pointercancel, Escape, blur and the view-level\n // teardown can race; whichever lands first wins and the rest no-op\n let finished = false;\n const cleanup = () => {\n if (finished) return;\n finished = true;\n activeGestureCancels.delete(cancel);\n if (autoScrollRaf) cancelAnimationFrame(autoScrollRaf);\n try {\n origin.releasePointerCapture(pointerId);\n } catch {\n // capture already released (pointer gone or origin detached)\n }\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onCancel);\n window.removeEventListener(\"blur\", onWindowBlur);\n window.removeEventListener(\"keydown\", onKeyDown, true);\n if (touchTimer) clearTimeout(touchTimer);\n // consumer-rendered overlays are React-owned: they unmount when the drag\n // state clears, so the engine must never removeChild them itself\n if (!customMoveOverlay) overlay?.remove();\n overlay = null;\n if (!customResizeOverlay) resizeOverlay?.remove();\n resizeOverlay = null;\n setBodyDragging(false);\n };\n\n const cancel = () => {\n cleanup();\n if (active) {\n lastGestureEndedAt = performance.now();\n internals.setDrag(null);\n internals.setSlotDraft(null);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n e.stopPropagation();\n cancel();\n }\n };\n\n // focus loss mid-gesture (alt-tab, OS dialogs) means the release may never\n // be delivered; treat it as a cancel so the gesture cannot get stuck\n const onWindowBlur = () => cancel();\n\n const onPointerMove = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n lastPointer = e;\n if (!active) {\n const distance = Math.hypot(e.clientX - startX, e.clientY - startY);\n if (isTouch) {\n // Long-press pending: moving past tolerance means scroll, not drag\n if (distance > activation.touchTolerancePx) cancel();\n return;\n }\n if (distance < activationDistance) return;\n activate();\n }\n applyProposal(e);\n positionOverlay(e);\n positionResizeOverlay(e);\n scheduleAutoScroll();\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cleanup();\n if (!active) return;\n lastGestureEndedAt = performance.now();\n\n const state = instance.getState();\n if (kind === \"create\") {\n const draft = state.slotDraft;\n internals.setSlotDraft(null);\n if (draft) {\n api.select({\n slot: { start: draft.start, end: draft.end, allDay: draft.allDay },\n });\n settings.onSelectSlot?.(draft);\n }\n return;\n }\n const drag = state.drag;\n internals.setDrag(null);\n if (!drag || !occurrence) return;\n // the node refuses concurrency: revert instead of committing an overlap\n if (overlapRejected) return;\n const unchanged =\n drag.proposedStart.getTime() === occurrence.start.getTime() &&\n drag.proposedEnd.getTime() === occurrence.end.getTime() &&\n (drag.proposedResourceId === undefined ||\n drag.proposedResourceId === occurrence.event.resourceId);\n if (unchanged) return;\n // Commit through the one validation funnel; consumer reject = automatic\n // revert because the gantt never mutated during the gesture.\n const accepted = internals.applyProposedUpdate({\n event: occurrence.event,\n occurrence,\n start: drag.proposedStart,\n end: drag.proposedEnd,\n allDay: drag.proposedAllDay,\n resourceId: drag.proposedResourceId,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n });\n if (accepted && announcer) {\n announcer.textContent = `${occurrence.event.title}, ${settings.i18n.functions.formatEventTime(\n toZoned(drag.proposedStart, settings.timeZone),\n toZoned(drag.proposedEnd, settings.timeZone),\n drag.proposedAllDay,\n settings.locale,\n )}`;\n }\n };\n\n const onCancel = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cancel();\n };\n\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onCancel);\n window.addEventListener(\"blur\", onWindowBlur);\n window.addEventListener(\"keydown\", onKeyDown, true);\n activeGestureCancels.add(cancel);\n\n // Capture the pointer so a release OUTSIDE the OS window still delivers\n // pointerup here instead of leaving the gesture stuck. Captured events keep\n // bubbling to the window listeners above, and if the origin node is removed\n // mid-gesture the capture auto-releases - behavior then degrades to plain\n // window listeners, never worse than before. Guarded: the pointer can\n // already be gone by now (fast flicks, synthetic events).\n try {\n origin.setPointerCapture(pointerId);\n } catch {\n // capture is an enhancement, never a requirement\n }\n\n // Touch: long-press activation (movement past tolerance cancels above)\n if (isTouch && !active) {\n touchTimer = setTimeout(() => {\n activate();\n applyProposal(lastPointer);\n }, activation.touchDelayMs);\n }\n}\n\n/** Per-bar / per-row pointer gesture wiring. */\nfunction useGanttGestures<TData = unknown>() {\n const instance = useGantt<TData>();\n const viewConfig = useGanttViewConfig<TData>();\n // presence flags only: the engine skips its default overlay DOM and\n // positions the consumer-rendered node instead\n const customMoveOverlay = !!viewConfig.renderDragPreview;\n const customResizeOverlay = !!viewConfig.renderResizeIndicator;\n\n const canDrag = useCallback(\n (segment: GanttSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.drag && !event.readOnly && event.draggable !== false;\n },\n [instance],\n );\n\n const beginMove = useCallback(\n (e: React.PointerEvent, segment: GanttSegment<TData>) => {\n if (e.button !== 0 || !canDrag(segment)) return;\n beginGesture({\n instance,\n kind: \"move\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n customMoveOverlay,\n scheduleMode: viewConfig.scheduleMode,\n });\n },\n [instance, canDrag, customMoveOverlay, viewConfig.scheduleMode],\n );\n\n const canResize = useCallback(\n (segment: GanttSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.resize && !event.readOnly && event.resizable !== false;\n },\n [instance],\n );\n\n const beginResize = useCallback(\n (e: React.PointerEvent, segment: GanttSegment<TData>, edge: \"start\" | \"end\") => {\n if (e.button !== 0 || !canResize(segment)) return;\n e.stopPropagation();\n e.preventDefault();\n beginGesture({\n instance,\n kind: edge === \"start\" ? \"resize-start\" : \"resize-end\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n customResizeOverlay,\n scheduleMode: viewConfig.scheduleMode,\n });\n },\n [instance, canResize, customResizeOverlay, viewConfig.scheduleMode],\n );\n\n const beginCreate = useCallback(\n (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n if (!instance.getState().interactions.selectSlot) return;\n beginGesture({\n instance,\n kind: \"create\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n });\n },\n [instance],\n );\n\n return { beginMove, beginResize, beginCreate, canDrag, canResize };\n}\n\nexport {\n cancelActiveGanttGestures,\n GANTT_ACTIVATION,\n markGestureEnd,\n useGanttGestures,\n useGanttGestureTeardown,\n wasRecentDrag,\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,mBAAmB;CACvB,gBAAgB;CAChB,kBAAkB;CAClB,cAAc;CACd,kBAAkB;AACpB;;;;;;AAmBA,SAAS,iBAAiB,IAAkB,GAAmB;CAC7D,MAAM,UAAU,KAAK,IAAI,KAAK,IAAI,GAAG,GAAG,KAAK,IAAI,GAAG,GAAG,KAAK,KAAK;CAEjE,QADiB,GAAG,QAAQ,GAAG,KAAK,QAAQ,UAAU,UAAU,GAAG,KAAK,QACrD,GAAG,KAAK,UAAW,GAAG,WAAW,GAAG,cAAc;AACvE;;AAGA,IAAI,qBAAqB;AACzB,SAAS,gBAAyB;CAChC,OAAO,YAAY,IAAI,IAAI,qBAAqB;AAClD;;AAGA,SAAS,iBAAuB;CAC9B,qBAAqB,YAAY,IAAI;AACvC;;;;;;;;;AAUA,MAAM,uCAAuB,IAAI,IAAgB;;AAGjD,SAAS,4BAAkC;CACzC,KAAK,MAAM,UAAU,CAAC,GAAG,oBAAoB,GAAG,OAAO;AACzD;;;;;;A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Aa,QAAQ,CAAC,MAAM,YAAY,MAAM,cAAc;CACrE,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,YAAY,aACf,GAAuB,YAAiC;EACvD,IAAI,EAAE,WAAW,KAAK,CAAC,QAAQ,OAAO,GAAG;EACzC,aAAa;GACX;GACA,MAAM;GACN,QAAQ,EAAE;GACV,YAAY,EAAE;GACd;GACA;GACA,cAAc,WAAW;EAC3B,CAAC;CACH,GACA;EAAC;EAAU;EAAS;EAAmB,WAAW;CAAY,CAChE;CAEA,MAAM,YAAY,aACf,YAAiC;EAChC,MAAM,EAAE,iBAAiB,SAAS,SAAS;EAC3C,MAAM,QAAQ,QAAQ,WAAW;EACjC,OAAO,aAAa,UAAU,CAAC,MAAM,YAAY,MAAM,cAAc;CACvE,GACA,CAAC,QAAQ,CACX;CAkCA,OAAO;EAAE;EAAW,aAhCA,aACjB,GAAuB,SAA8B,SAA0B;GAC9E,IAAI,EAAE,WAAW,KAAK,CAAC,UAAU,OAAO,GAAG;GAC3C,EAAE,gBAAgB;GAClB,EAAE,eAAe;GACjB,aAAa;IACX;IACA,MAAM,SAAS,UAAU,iBAAiB;IAC1C,QAAQ,EAAE;IACV,YAAY,EAAE;IACd;IACA;IACA,cAAc,WAAW;GAC3B,CAAC;EACH,GACA;GAAC;GAAU;GAAW;GAAqB,WAAW;EAAY,CAiBtC;EAAG,aAdb,aACjB,MAA0B;GACzB,IAAI,EAAE,WAAW,GAAG;GACpB,IAAI,CAAC,SAAS,SAAS,CAAC,CAAC,aAAa,YAAY;GAClD,aAAa;IACX;IACA,MAAM;IACN,QAAQ,EAAE;IACV,YAAY,EAAE;GAChB,CAAC;EACH,GACA,CAAC,QAAQ,CAGgC;EAAG;EAAS;CAAU;AACnE"}
1
+ {"version":3,"file":"gantt-dnd.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-dnd.tsx"],"sourcesContent":["\"use client\";\n\nimport { useCallback, useEffect } from \"react\";\nimport { addDays, differenceInCalendarDays } from \"date-fns\";\n\nimport { type GanttInstance, resolveScheduleMode, useGantt, useGanttViewConfig } from \"./gantt\";\nimport { findResource, snapMinutes, toZoned, zonedStartOfDay } from \"./gantt-lib\";\nimport type { GanttProposedUpdate, GanttScheduleMode, GanttSegment } from \"./gantt-types\";\n\n/**\n * Activation policy (dnd-kit parity where proven):\n * mouse move 5px before a drag starts (below = click), create 4px;\n * touch long-press 250ms with 5px tolerance (movement past tolerance\n * before the delay cancels the drag so taps stay taps).\n */\nconst GANTT_ACTIVATION = {\n moveDistancePx: 5,\n createDistancePx: 4,\n touchDelayMs: 250,\n touchTolerancePx: 5,\n} as const;\n\ntype GestureKind = \"move\" | \"resize-start\" | \"resize-end\" | \"create\";\n\ninterface GanttSurface {\n rect: DOMRect;\n rangeStart: number;\n rangeEnd: number;\n snapMin: number;\n /** Mirrored axis: in RTL the range START sits at the rect's RIGHT edge. */\n isRtl: boolean;\n rows: Array<{ resourceId: string; rect: DOMRect }>;\n}\n\n/**\n * Pointer x (viewport px) to minutes from the range start, clamped to the\n * track. The single place the horizontal axis direction is resolved: every\n * gesture mapping (move, both resizes, create, grab offset) goes through it.\n */\nfunction surfaceMinutesAt(tl: GanttSurface, x: number): number {\n const clamped = Math.min(Math.max(x, tl.rect.left), tl.rect.right);\n const traveled = tl.isRtl ? tl.rect.right - clamped : clamped - tl.rect.left;\n return (traveled / tl.rect.width) * ((tl.rangeEnd - tl.rangeStart) / 60000);\n}\n\n/** Module flag so bar onClick can ignore the click that ends a drag. */\nlet lastGestureEndedAt = 0;\nfunction wasRecentDrag(): boolean {\n return performance.now() - lastGestureEndedAt < 250;\n}\n\n/** Mark a non-dnd gesture (e.g. a timeline pan) so the click it ends is ignored. */\nfunction markGestureEnd(): void {\n lastGestureEndedAt = performance.now();\n}\n\n/**\n * Registry of in-flight gesture cancels. A gesture measures its surface\n * (axis + row rects) once at activation, so the VIEW - not the bar, bars\n * legitimately unmount mid-gesture - must be able to abort gestures when it\n * unmounts or when the measured geometry changes under them (zoom, scale,\n * range growth, splitter). Cancel fully reverts: listeners, overlays and the\n * body drag state all clear, and no update is committed.\n */\nconst activeGestureCancels = new Set<() => void>();\n\n/** Cancel (and fully revert) every in-flight gantt pointer gesture. */\nfunction cancelActiveGanttGestures(): void {\n for (const cancel of [...activeGestureCancels]) cancel();\n}\n\n/**\n * View-level teardown, mounted once by GanttView: aborts any in-flight\n * gesture on unmount so window listeners, body-appended overlays and the\n * gantt-dragging body class never outlive the gantt.\n */\nfunction useGanttGestureTeardown(): void {\n useEffect(() => cancelActiveGanttGestures, []);\n}\n\n/**\n * Snap a translate offset to the device pixel grid. The cursor-following\n * overlays (the move clone and the resize indicator) are their own\n * `will-change: transform` compositing layers: the GPU rasterizes their text\n * once and repositions that texture each frame, so a subpixel translate\n * (getBoundingClientRect and raw clientX/Y are routinely fractional) resamples\n * the texture and blurs the text. Rounding each offset to a whole device pixel\n * lands the layer on the grid so glyphs stay crisp, without giving up the\n * per-frame GPU transform.\n */\nfunction snapToPixel(value: number): number {\n const dpr = typeof window !== \"undefined\" ? window.devicePixelRatio || 1 : 1;\n return Math.round(value * dpr) / dpr;\n}\n\nfunction collectSurface(root: HTMLElement | null): GanttSurface | null {\n if (!root) return null;\n const axis = root.querySelector<HTMLElement>(\"[data-gantt-axis]\");\n if (!axis) return null;\n return {\n rect: axis.getBoundingClientRect(),\n rangeStart: Number(axis.dataset.ganttRangeStart),\n rangeEnd: Number(axis.dataset.ganttRangeEnd),\n snapMin: Number(axis.dataset.ganttSnap) || 15,\n isRtl: getComputedStyle(axis).direction === \"rtl\",\n rows: [...root.querySelectorAll<HTMLElement>(\"[data-gantt-row]\")]\n // static rows (parents that aggregate their subtree) take no drops\n .filter((row) => row.dataset.ganttRowStatic === undefined)\n .map((row) => ({\n resourceId: row.dataset.ganttResource ?? \"\",\n rect: row.getBoundingClientRect(),\n })),\n };\n}\n\ninterface BeginGestureConfig<TData> {\n instance: GanttInstance<TData>;\n kind: GestureKind;\n origin: HTMLElement;\n startEvent: PointerEvent;\n segment?: GanttSegment<TData>;\n /** Consumer renders the move preview (renderDragPreview); the engine only positions it. */\n customMoveOverlay?: boolean;\n /** Consumer renders the resize indicator; the engine only positions it. */\n customResizeOverlay?: boolean;\n /** View-level cardinality default; a node's own scheduleMode wins. */\n scheduleMode?: GanttScheduleMode;\n}\n\nfunction beginGesture<TData>(config: BeginGestureConfig<TData>) {\n const { instance, kind, origin, startEvent, segment, customMoveOverlay, customResizeOverlay } =\n config;\n const { settings, internals, api } = instance;\n const activation = { ...GANTT_ACTIVATION, ...settings.activation };\n const startX = startEvent.clientX;\n const startY = startEvent.clientY;\n const pointerId = startEvent.pointerId;\n // stable ancestors: bar nodes may be replaced by re-renders mid-gesture\n const viewRoot = origin.closest<HTMLElement>(\"[data-slot=gantt-view]\");\n const ganttRoot = origin.closest<HTMLElement>(\"[data-slot=gantt]\");\n const announcer = ganttRoot?.querySelector<HTMLElement>(\"[data-slot=gantt-announcer]\");\n\n /**\n * The cursor-following overlays are appended to document.body so no ancestor\n * transform or overflow can clip them - which also cuts them off from the\n * gantt root, and the root is what OWNS the type scale (its `text-xs` is\n * what every resting label inherits). Without this the clone's label jumps\n * to the document default and reads visibly bigger than the bar it left.\n * Copying the ROOT's resolved metrics - rather than hardcoding a size -\n * keeps the documented contract that one class on the root (e.g.\n * className=\"text-sm\") rescales the whole gantt, drag clone included.\n */\n const adoptRootTypography = (el: HTMLElement) => {\n if (!ganttRoot) return;\n const rootStyle = getComputedStyle(ganttRoot);\n el.style.fontSize = rootStyle.fontSize;\n el.style.lineHeight = rootStyle.lineHeight;\n el.style.fontFamily = rootStyle.fontFamily;\n el.style.letterSpacing = rootStyle.letterSpacing;\n // physical positioning, logical content: the flex row mirrors so the\n // label lands on the same side of the bar as the resting one in RTL\n el.style.direction = rootStyle.direction;\n };\n\n const isTouch = startEvent.pointerType === \"touch\";\n // resize activates immediately on precise pointers; on touch it waits for\n // the same long-press as a move, so a stray brush over a bar edge can\n // never start an accidental resize\n let active = kind.startsWith(\"resize\") && !isTouch;\n let surface: GanttSurface | null = active ? collectSurface(viewRoot) : null;\n let lastProposalKey = \"\";\n let touchTimer: ReturnType<typeof setTimeout> | null = null;\n let lastPointer: PointerEvent = startEvent;\n\n const occurrence = segment?.occurrence;\n\n // ----- neighbour awareness: the other schedules in the SAME node -----\n // A node in \"single\" mode rejects any concurrency regardless of the\n // overlap option; otherwise the option decides. \"allow\" short-circuits\n // everything below, so the default gesture path is untouched.\n const nodeId = occurrence?.event.resourceId;\n const nodeMode = resolveScheduleMode(\n nodeId === undefined ? null : findResource(settings.resources, nodeId),\n config.scheduleMode,\n );\n const overlapPolicy = nodeMode === \"single\" ? (\"reject\" as const) : settings.overlap;\n // Read once per gesture: the gantt never mutates events mid-drag, so the\n // neighbours cannot move under us.\n let neighbourCache: Array<{ start: number; end: number }> | null = null;\n const getNeighbours = () => {\n if (neighbourCache) return neighbourCache;\n neighbourCache =\n !occurrence || nodeId === undefined || overlapPolicy === \"allow\"\n ? []\n : api\n .getOccurrences()\n .filter((other) => other.event.resourceId === nodeId && other.key !== occurrence.key)\n .map((other) => ({\n start: other.start.getTime(),\n end: other.end.getTime(),\n }));\n return neighbourCache;\n };\n const overlapsNeighbour = (start: Date, end: Date) =>\n getNeighbours().some((other) => other.start < end.getTime() && other.end > start.getTime());\n /**\n * Stop the gesture at the neighbour's edge. Runs AFTER snapping so the\n * clamp always wins, and only against neighbours that sit clear of the\n * bar's CURRENT span - a pre-existing overlap has no edge to stop at.\n */\n const clampToNeighbours = (start: Date, end: Date): { start: Date; end: Date } => {\n if (overlapPolicy !== \"clamp\" || !occurrence) return { start, end };\n const anchorStart = occurrence.start.getTime();\n const anchorEnd = occurrence.end.getTime();\n let floor = -Infinity;\n let ceiling = Infinity;\n for (const other of getNeighbours()) {\n if (other.end <= anchorStart) floor = Math.max(floor, other.end);\n else if (other.start >= anchorEnd) ceiling = Math.min(ceiling, other.start);\n }\n if (floor === -Infinity && ceiling === Infinity) return { start, end };\n let from = start.getTime();\n let to = end.getTime();\n if (kind === \"resize-start\") {\n from = Math.min(Math.max(from, floor), to);\n } else if (kind === \"resize-end\") {\n to = Math.max(Math.min(to, ceiling), from);\n } else {\n // a move keeps its duration and parks against whichever edge it meets\n const duration = to - from;\n if (from < floor) {\n from = floor;\n to = from + duration;\n }\n if (to > ceiling) {\n to = ceiling;\n from = to - duration;\n }\n // window narrower than the bar itself: park at the earlier edge\n if (from < floor) {\n from = floor;\n to = from + duration;\n }\n }\n return { start: new Date(from), end: new Date(to) };\n };\n // Set by applyProposal when a \"reject\" policy refuses the current proposal;\n // read on pointerup so the commit is actually blocked, not merely styled.\n let overlapRejected = false;\n\n // Preserve the grab offset so the bar does not jump to the pointer\n let grabOffsetMin = 0;\n // Smooth cursor-following clone for a move: a real-looking bar that tracks\n // the pointer's x via transform (no per-frame React), lifted with a shadow.\n let overlay: HTMLDivElement | null = null;\n let grabOffsetPx = 0;\n let barTop = 0;\n let barWidth = 0;\n let barHeight = 0;\n\n const createMoveOverlay = () => {\n if (kind !== \"move\" || !occurrence || overlay || barWidth === 0) return;\n // consumer-rendered preview (renderDragPreview): the view mounts it from\n // drag state; positionOverlay adopts it lazily and only writes transforms\n if (customMoveOverlay) return;\n const color = occurrence.event.color ?? \"var(--color-primary)\";\n overlay = document.createElement(\"div\");\n overlay.setAttribute(\"data-slot\", \"gantt-drag-overlay\");\n // container: the bar + its label ride together; the label stays OUTSIDE\n // the bar (to the right), matching the resting look - no in-bar text\n overlay.className =\n // physical left-0 anchor: the clone is positioned by translate3d from\n // raw clientX, which is physical - a logical start-0 anchor would pin\n // it to the RIGHT edge in RTL and fling the clone off screen\n \"pointer-events-none fixed top-0 left-0 z-100 flex items-center gap-2 will-change-transform\";\n adoptRootTypography(overlay);\n overlay.style.height = `${barHeight}px`;\n const barEl = document.createElement(\"div\");\n if (occurrence.end.getTime() === occurrence.start.getTime()) {\n // a MILESTONE stays a diamond while it travels: the resting glyph,\n // lifted with a shadow - a rectangle here reads as a different object\n barEl.className = \"flex shrink-0 items-center justify-center\";\n barEl.style.width = `${barWidth}px`;\n barEl.style.height = \"100%\";\n const diamond = document.createElement(\"span\");\n diamond.className = \"rotate-45 rounded-[2px] shadow-lg\";\n diamond.style.width = \"10px\";\n diamond.style.height = \"10px\";\n diamond.style.background = `color-mix(in oklab, ${color} 80%, var(--color-background))`;\n diamond.style.border = `1px solid ${color}`;\n barEl.appendChild(diamond);\n } else {\n barEl.className = \"shrink-0 rounded-sm shadow-lg\";\n barEl.style.width = `${barWidth}px`;\n barEl.style.height = \"100%\";\n barEl.style.background = `color-mix(in oklab, ${color} 22%, var(--color-background))`;\n barEl.style.outline = `1px solid color-mix(in oklab, ${color} 55%, transparent)`;\n }\n overlay.appendChild(barEl);\n const label = document.createElement(\"span\");\n label.className = \"text-foreground truncate font-medium whitespace-nowrap\";\n label.textContent = occurrence.event.title;\n overlay.appendChild(label);\n document.body.appendChild(overlay);\n positionOverlay(lastPointer);\n };\n\n const positionOverlay = (e: PointerEvent) => {\n if (!overlay && customMoveOverlay && active && kind === \"move\") {\n overlay = document.querySelector<HTMLDivElement>(\n \"[data-slot=gantt-drag-overlay][data-custom]\",\n );\n if (overlay) overlay.style.visibility = \"visible\";\n }\n if (!overlay) return;\n // x follows the pointer freely (smooth); y stays on the bar's own row\n overlay.style.transform = `translate3d(${snapToPixel(e.clientX - grabOffsetPx)}px, ${snapToPixel(barTop)}px, 0)`;\n };\n\n // Resize status indicator: a smooth cursor-following edge line plus a live\n // range + duration chip. The dashed ghost still shows the SNAPPED landing;\n // this overlay is the continuous feedback between snap steps.\n let resizeOverlay: HTMLDivElement | null = null;\n let resizeLine: HTMLDivElement | null = null;\n let resizeRange: HTMLSpanElement | null = null;\n let resizeDot: HTMLSpanElement | null = null;\n let resizeDuration: HTMLSpanElement | null = null;\n\n const positionResizeOverlay = (e: PointerEvent) => {\n if (!resizeOverlay && customResizeOverlay && kind.startsWith(\"resize\")) {\n resizeOverlay = document.querySelector<HTMLDivElement>(\n \"[data-slot=gantt-resize-indicator][data-custom]\",\n );\n if (resizeOverlay) resizeOverlay.style.visibility = \"visible\";\n }\n if (!resizeOverlay || !surface) return;\n // x follows the pointer freely (clamped to the track); y stays on the bar\n const x = Math.min(Math.max(e.clientX, surface.rect.left), surface.rect.right);\n resizeOverlay.style.transform = `translate3d(${snapToPixel(x)}px, ${snapToPixel(barTop)}px, 0)`;\n };\n\n const createResizeOverlay = () => {\n if (!kind.startsWith(\"resize\") || !occurrence || resizeOverlay) return;\n const barEl = origin.closest<HTMLElement>(\"[data-slot=gantt-bar]\");\n const rect = (barEl ?? origin).getBoundingClientRect();\n barTop = rect.top;\n barHeight = rect.height;\n // consumer-rendered indicator: rect capture above still runs (the engine\n // positions the consumer's wrapper), only the default DOM is skipped\n if (customResizeOverlay) return;\n const color = occurrence.event.color ?? \"var(--color-primary)\";\n resizeOverlay = document.createElement(\"div\");\n resizeOverlay.setAttribute(\"data-slot\", \"gantt-resize-indicator\");\n resizeOverlay.className =\n // physical left-0 anchor, same reason as the move clone above\n \"pointer-events-none fixed top-0 left-0 z-100 will-change-transform\";\n adoptRootTypography(resizeOverlay);\n resizeOverlay.style.height = `${barHeight}px`;\n resizeLine = document.createElement(\"div\");\n resizeLine.className = \"h-full w-0.5 -translate-x-1/2 rounded-full\";\n resizeLine.style.background = color;\n resizeOverlay.appendChild(resizeLine);\n const chip = document.createElement(\"div\");\n chip.className =\n // physical left-0: centered with a physical translate on a physical anchor\n // no text size of its own: it inherits the root scale adopted above, so\n // the chip tracks a consumer rescale instead of pinning itself to 12px\n \"bg-foreground text-background absolute bottom-full left-0 mb-1.5 flex -translate-x-1/2 items-center gap-1.5 rounded-md px-2 py-1 font-medium whitespace-nowrap\";\n resizeRange = document.createElement(\"span\");\n chip.appendChild(resizeRange);\n resizeDot = document.createElement(\"span\");\n resizeDot.className = \"bg-background/40 size-1 shrink-0 rounded-full\";\n resizeDot.setAttribute(\"aria-hidden\", \"true\");\n chip.appendChild(resizeDot);\n resizeDuration = document.createElement(\"span\");\n chip.appendChild(resizeDuration);\n // The arrow. Every other bubble in the gantt has one pointing at what it\n // describes; this chip had none, so a resize looked like a different\n // component from the hover hint. Physical left-1/2 to match the chip's own\n // physical anchor, and out of flow so the chip's flex gap ignores it.\n const chipArrow = document.createElement(\"span\");\n chipArrow.setAttribute(\"aria-hidden\", \"true\");\n chipArrow.className =\n \"bg-foreground absolute -bottom-1 left-1/2 size-2.5 -translate-x-1/2 rotate-45 rounded-[2px]\";\n chip.appendChild(chipArrow);\n resizeOverlay.appendChild(chip);\n document.body.appendChild(resizeOverlay);\n // seed the chip with the CURRENT range so it never flashes empty;\n // zoned so the label names the same day the grid shows\n resizeRange.textContent = settings.i18n.functions.formatEventTime(\n toZoned(occurrence.start, settings.timeZone),\n toZoned(occurrence.end, settings.timeZone),\n occurrence.allDay ?? false,\n settings.locale,\n );\n const days = Math.round((occurrence.end.getTime() - occurrence.start.getTime()) / 86_400_000);\n if (days >= 1) {\n resizeDuration.textContent = settings.i18n.labels.durationDays(days);\n } else {\n resizeDot.style.display = \"none\";\n resizeDuration.style.display = \"none\";\n }\n positionResizeOverlay(startEvent);\n };\n\n // resize activates immediately, so its indicator mounts with the gesture\n if (active) createResizeOverlay();\n\n const activationDistance =\n kind === \"create\" ? activation.createDistancePx : activation.moveDistancePx;\n\n // Each gesture keeps its own cursor: a resize must stay ew-resize for the\n // whole drag (flipping to grabbing reads as a move), a move grabs.\n const gestureCursor = kind.startsWith(\"resize\") ? \"ew-resize\" : \"grabbing\";\n const setBodyDragging = (on: boolean, invalid = false) => {\n document.body.classList.toggle(\"gantt-dragging\", on);\n document.body.style.cursor = on ? (invalid ? \"not-allowed\" : gestureCursor) : \"\";\n document.body.style.userSelect = on ? \"none\" : \"\";\n if (!on) document.body.style.removeProperty(\"-webkit-user-select\");\n };\n\n const activate = () => {\n if (active) return;\n active = true;\n surface = collectSurface(viewRoot);\n // touch resize activates here (long-press) instead of at gesture start,\n // so its indicator mounts now; the guard inside makes this a no-op for\n // every other path\n createResizeOverlay();\n if (kind === \"move\" && occurrence && surface) {\n const pointerMin = surfaceMinutesAt(surface, startX);\n // TRUE start, never clamped to the range: a bar that begins before the\n // visible window (negative minutes) must keep its real grab offset, or\n // the first snapped proposal teleports its start to the range edge\n const occStartMin = (occurrence.start.getTime() - surface.rangeStart) / 60000;\n grabOffsetMin = pointerMin - occStartMin;\n const rect = origin.getBoundingClientRect();\n barTop = rect.top;\n barWidth = rect.width;\n barHeight = rect.height;\n grabOffsetPx = startX - rect.left;\n createMoveOverlay();\n }\n setBodyDragging(true);\n };\n\n const computeProposal = (\n e: PointerEvent,\n ): {\n start: Date;\n end: Date;\n allDay: boolean;\n resourceId?: string;\n } | null => {\n if (!surface) return null;\n const tl = surface;\n const rangeMinutes = (tl.rangeEnd - tl.rangeStart) / 60000;\n const minutesAt = (x: number) => surfaceMinutesAt(tl, x);\n // Day-grid scales snap to real zoned midnights, not 1440-minute\n // multiples from the range start - those drift by an hour across DST\n const snapMin = (minutes: number) => {\n if (tl.snapMin < 24 * 60) return snapMinutes(minutes, tl.snapMin);\n const ms = tl.rangeStart + minutes * 60000;\n const dayStart = zonedStartOfDay(new Date(ms), settings.timeZone);\n const dayEnd = zonedStartOfDay(\n addDays(toZoned(new Date(ms), settings.timeZone), 1),\n settings.timeZone,\n );\n const snapped = ms - dayStart.getTime() < dayEnd.getTime() - ms ? dayStart : dayEnd;\n return (snapped.getTime() - tl.rangeStart) / 60000;\n };\n const rowAt = (y: number) => {\n let best = tl.rows[0];\n for (const row of tl.rows) {\n if (y >= row.rect.top && y < row.rect.bottom) return row;\n if (\n best &&\n Math.abs(y - (row.rect.top + row.rect.height / 2)) <\n Math.abs(y - (best.rect.top + best.rect.height / 2))\n ) {\n best = row;\n }\n }\n return best;\n };\n const at = (minutes: number) => new Date(tl.rangeStart + minutes * 60000);\n\n if (kind === \"create\") {\n const anchorMin = snapMin(minutesAt(startX));\n const curMin = snapMin(minutesAt(e.clientX));\n const lo = Math.min(anchorMin, curMin);\n // a bare click still yields a usable slot: at least slotDuration long\n const hi = Math.max(anchorMin, curMin, lo + Math.max(tl.snapMin, settings.slotDuration));\n return {\n start: at(lo),\n end: at(hi),\n allDay: false,\n resourceId: rowAt(startY)?.resourceId,\n };\n }\n if (!occurrence) return null;\n const midnightAligned = (d: Date) =>\n zonedStartOfDay(d, settings.timeZone).getTime() === d.getTime();\n if (kind === \"move\") {\n // x-axis only: the bar slides along its OWN row, never across rows.\n // The proposal preserves the pointer DELTA - no clamping to the visible\n // range, or bars crossing the window edge would teleport to it.\n const start = at(snapMin(minutesAt(e.clientX) - grabOffsetMin));\n // Day-snapped scales preserve the CALENDAR span for day-aligned bars:\n // a 3-day bar dragged across a DST change stays midnight-to-midnight\n // (72h +/- 1h), never drifting to a 23:00 end. Sub-day events keep\n // their exact ms duration.\n let end: Date;\n if (occurrence.end.getTime() === occurrence.start.getTime()) {\n // a milestone is an instant: moving it moves the point - the\n // day-span branch below would silently stretch it to a full day\n end = start;\n } else if (\n tl.snapMin >= 24 * 60 &&\n (occurrence.allDay ||\n (midnightAligned(occurrence.start) && midnightAligned(occurrence.end)))\n ) {\n const daySpan = Math.max(\n differenceInCalendarDays(\n toZoned(occurrence.end, settings.timeZone),\n toZoned(occurrence.start, settings.timeZone),\n ),\n 1,\n );\n end = zonedStartOfDay(\n addDays(toZoned(start, settings.timeZone), daySpan),\n settings.timeZone,\n );\n } else {\n end = new Date(start.getTime() + (occurrence.end.getTime() - occurrence.start.getTime()));\n }\n const bounded = clampToNeighbours(start, end);\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n }\n const min = snapMin(minutesAt(e.clientX));\n if (kind === \"resize-start\") {\n const endMin = (occurrence.end.getTime() - tl.rangeStart) / 60000;\n // Minimum length = one snap unit; on day grids that unit is the LAST\n // zoned midnight before the end (raw 1440-minute arithmetic lands off\n // the midnight grid across DST changes).\n const maxStartMin =\n tl.snapMin >= 24 * 60\n ? (zonedStartOfDay(\n midnightAligned(occurrence.end)\n ? addDays(toZoned(occurrence.end, settings.timeZone), -1)\n : occurrence.end,\n settings.timeZone,\n ).getTime() -\n tl.rangeStart) /\n 60000\n : endMin - tl.snapMin;\n const clamped = Math.min(Math.max(min, 0), maxStartMin);\n const bounded = clampToNeighbours(at(clamped), occurrence.end);\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n }\n const startMin = (occurrence.start.getTime() - tl.rangeStart) / 60000;\n // Mirror of the resize-start bound: the FIRST zoned midnight after the\n // start on day grids, plain snap arithmetic otherwise.\n const minEndMin =\n tl.snapMin >= 24 * 60\n ? (zonedStartOfDay(\n addDays(toZoned(occurrence.start, settings.timeZone), 1),\n settings.timeZone,\n ).getTime() -\n tl.rangeStart) /\n 60000\n : startMin + tl.snapMin;\n const clamped = Math.max(Math.min(min, rangeMinutes), minEndMin);\n const bounded = clampToNeighbours(occurrence.start, at(clamped));\n return {\n start: bounded.start,\n end: bounded.end,\n allDay: occurrence.allDay,\n resourceId: occurrence.event.resourceId,\n };\n };\n\n const applyProposal = (e: PointerEvent) => {\n const proposal = computeProposal(e);\n if (!proposal) return;\n const key = `${proposal.start.getTime()}-${proposal.end.getTime()}-${proposal.allDay}-${proposal.resourceId ?? \"\"}`;\n if (key === lastProposalKey) return;\n lastProposalKey = key;\n\n if (kind === \"create\") {\n const draft = { ...proposal };\n if (settings.canSelectSlot && !settings.canSelectSlot(draft)) return;\n internals.setSlotDraft(draft);\n return;\n }\n const update: GanttProposedUpdate<TData> = {\n event: occurrence!.event,\n occurrence: occurrence!,\n ...proposal,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n };\n // \"reject\" is the one veto the engine owns: it both styles the ghost AND\n // blocks the commit below. canDropEvent stays advisory unless the\n // consumer opts into enforceCanDrop, which is checked at release.\n overlapRejected = overlapPolicy === \"reject\" && overlapsNeighbour(proposal.start, proposal.end);\n const valid =\n !overlapRejected && (settings.canDropEvent ? settings.canDropEvent(update) : true);\n // live status: the indicator chip always names the CURRENT proposed\n // range; the edge line flips to destructive on an invalid drop\n if (resizeRange && resizeDot && resizeDuration) {\n resizeRange.textContent = settings.i18n.functions.formatEventTime(\n toZoned(proposal.start, settings.timeZone),\n toZoned(proposal.end, settings.timeZone),\n proposal.allDay,\n settings.locale,\n );\n const days = Math.round((proposal.end.getTime() - proposal.start.getTime()) / 86_400_000);\n const showDays = days >= 1;\n resizeDot.style.display = showDays ? \"\" : \"none\";\n resizeDuration.style.display = showDays ? \"\" : \"none\";\n if (showDays) {\n resizeDuration.textContent = settings.i18n.labels.durationDays(days);\n }\n }\n if (resizeLine) {\n resizeLine.style.background = valid\n ? (occurrence!.event.color ?? \"var(--color-primary)\")\n : \"var(--color-destructive)\";\n }\n setBodyDragging(true, !valid);\n internals.setDrag({\n kind: kind === \"move\" ? \"move\" : (kind as \"resize-start\" | \"resize-end\"),\n occurrence: occurrence!,\n proposedStart: proposal.start,\n proposedEnd: proposal.end,\n proposedAllDay: proposal.allDay,\n proposedResourceId: proposal.resourceId,\n valid,\n });\n };\n\n // ----- edge auto-scroll: pan the timeline while dragging near its edge -----\n // The pointer is clamped to the visible track, so without this a bar can\n // never travel past the window. Holding the pointer inside the edge zone\n // scrolls the viewport (speed eased by proximity), refreshes the track rect\n // (the axis moved under the pointer) and re-derives the proposal from the\n // same pointer position. Programmatic scrolls never mark user intent, so\n // this can never trigger infinite-range growth mid-gesture.\n const AUTO_SCROLL_EDGE_PX = 24;\n const AUTO_SCROLL_MAX_SPEED = 14;\n let autoScrollRaf = 0;\n const timelineViewport = viewRoot?.querySelector<HTMLElement>(\n \"[data-slot=gantt-timeline-pane] [data-slot=scroll-area-viewport]\",\n );\n const autoScrollTick = () => {\n autoScrollRaf = 0;\n if (finished || !active || !surface || !timelineViewport) return;\n const paneRect = timelineViewport.getBoundingClientRect();\n const x = lastPointer.clientX;\n let speed = 0;\n if (x < paneRect.left + AUTO_SCROLL_EDGE_PX) {\n speed =\n -((paneRect.left + AUTO_SCROLL_EDGE_PX - x) / AUTO_SCROLL_EDGE_PX) * AUTO_SCROLL_MAX_SPEED;\n } else if (x > paneRect.right - AUTO_SCROLL_EDGE_PX) {\n speed =\n ((x - (paneRect.right - AUTO_SCROLL_EDGE_PX)) / AUTO_SCROLL_EDGE_PX) *\n AUTO_SCROLL_MAX_SPEED;\n }\n if (speed === 0) return;\n const before = timelineViewport.scrollLeft;\n timelineViewport.scrollLeft = before + speed;\n if (timelineViewport.scrollLeft === before) return; // parked on the end\n const axis = viewRoot?.querySelector<HTMLElement>(\"[data-gantt-axis]\");\n if (axis) surface.rect = axis.getBoundingClientRect();\n applyProposal(lastPointer);\n positionResizeOverlay(lastPointer);\n scheduleAutoScroll();\n };\n const scheduleAutoScroll = () => {\n if (!autoScrollRaf) autoScrollRaf = requestAnimationFrame(autoScrollTick);\n };\n\n // idempotent: pointerup, pointercancel, Escape, blur and the view-level\n // teardown can race; whichever lands first wins and the rest no-op\n let finished = false;\n const cleanup = () => {\n if (finished) return;\n finished = true;\n activeGestureCancels.delete(cancel);\n if (autoScrollRaf) cancelAnimationFrame(autoScrollRaf);\n try {\n origin.releasePointerCapture(pointerId);\n } catch {\n // capture already released (pointer gone or origin detached)\n }\n window.removeEventListener(\"pointermove\", onPointerMove);\n window.removeEventListener(\"pointerup\", onPointerUp);\n window.removeEventListener(\"pointercancel\", onCancel);\n window.removeEventListener(\"blur\", onWindowBlur);\n window.removeEventListener(\"keydown\", onKeyDown, true);\n if (touchTimer) clearTimeout(touchTimer);\n // consumer-rendered overlays are React-owned: they unmount when the drag\n // state clears, so the engine must never removeChild them itself\n if (!customMoveOverlay) overlay?.remove();\n overlay = null;\n if (!customResizeOverlay) resizeOverlay?.remove();\n resizeOverlay = null;\n setBodyDragging(false);\n };\n\n const cancel = () => {\n cleanup();\n if (active) {\n lastGestureEndedAt = performance.now();\n internals.setDrag(null);\n internals.setSlotDraft(null);\n }\n };\n\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") {\n e.stopPropagation();\n cancel();\n }\n };\n\n // focus loss mid-gesture (alt-tab, OS dialogs) means the release may never\n // be delivered; treat it as a cancel so the gesture cannot get stuck\n const onWindowBlur = () => cancel();\n\n const onPointerMove = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n lastPointer = e;\n if (!active) {\n const distance = Math.hypot(e.clientX - startX, e.clientY - startY);\n if (isTouch) {\n // Long-press pending: moving past tolerance means scroll, not drag\n if (distance > activation.touchTolerancePx) cancel();\n return;\n }\n if (distance < activationDistance) return;\n activate();\n }\n applyProposal(e);\n positionOverlay(e);\n positionResizeOverlay(e);\n scheduleAutoScroll();\n };\n\n const onPointerUp = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cleanup();\n if (!active) return;\n lastGestureEndedAt = performance.now();\n\n const state = instance.getState();\n if (kind === \"create\") {\n const draft = state.slotDraft;\n internals.setSlotDraft(null);\n if (draft) {\n api.select({\n slot: { start: draft.start, end: draft.end, allDay: draft.allDay },\n });\n settings.onSelectSlot?.(draft);\n }\n return;\n }\n const drag = state.drag;\n internals.setDrag(null);\n if (!drag || !occurrence) return;\n // the node refuses concurrency: revert instead of committing an overlap\n if (overlapRejected) return;\n // enforceCanDrop makes the advisory verdict binding: a release whose\n // last canDropEvent answer was false reverts exactly like \"reject\" -\n // the red ghost becomes a promise instead of a suggestion\n if (settings.enforceCanDrop && !drag.valid) return;\n const unchanged =\n drag.proposedStart.getTime() === occurrence.start.getTime() &&\n drag.proposedEnd.getTime() === occurrence.end.getTime() &&\n (drag.proposedResourceId === undefined ||\n drag.proposedResourceId === occurrence.event.resourceId);\n if (unchanged) return;\n // Commit through the one validation funnel; consumer reject = automatic\n // revert because the gantt never mutated during the gesture.\n const accepted = internals.applyProposedUpdate({\n event: occurrence.event,\n occurrence,\n start: drag.proposedStart,\n end: drag.proposedEnd,\n allDay: drag.proposedAllDay,\n resourceId: drag.proposedResourceId,\n source: kind === \"move\" ? \"drag\" : (kind as \"resize-start\" | \"resize-end\"),\n });\n if (accepted && announcer) {\n announcer.textContent = `${occurrence.event.title}, ${settings.i18n.functions.formatEventTime(\n toZoned(drag.proposedStart, settings.timeZone),\n toZoned(drag.proposedEnd, settings.timeZone),\n drag.proposedAllDay,\n settings.locale,\n )}`;\n }\n };\n\n const onCancel = (e: PointerEvent) => {\n if (e.pointerId !== pointerId) return;\n cancel();\n };\n\n window.addEventListener(\"pointermove\", onPointerMove);\n window.addEventListener(\"pointerup\", onPointerUp);\n window.addEventListener(\"pointercancel\", onCancel);\n window.addEventListener(\"blur\", onWindowBlur);\n window.addEventListener(\"keydown\", onKeyDown, true);\n activeGestureCancels.add(cancel);\n\n // Capture the pointer so a release OUTSIDE the OS window still delivers\n // pointerup here instead of leaving the gesture stuck. Captured events keep\n // bubbling to the window listeners above, and if the origin node is removed\n // mid-gesture the capture auto-releases - behavior then degrades to plain\n // window listeners, never worse than before. Guarded: the pointer can\n // already be gone by now (fast flicks, synthetic events).\n try {\n origin.setPointerCapture(pointerId);\n } catch {\n // capture is an enhancement, never a requirement\n }\n\n // Touch: long-press activation (movement past tolerance cancels above)\n if (isTouch && !active) {\n touchTimer = setTimeout(() => {\n activate();\n applyProposal(lastPointer);\n }, activation.touchDelayMs);\n }\n}\n\n/** Per-bar / per-row pointer gesture wiring. */\nfunction useGanttGestures<TData = unknown>() {\n const instance = useGantt<TData>();\n const viewConfig = useGanttViewConfig<TData>();\n // presence flags only: the engine skips its default overlay DOM and\n // positions the consumer-rendered node instead\n const customMoveOverlay = !!viewConfig.renderDragPreview;\n const customResizeOverlay = !!viewConfig.renderResizeIndicator;\n\n const canDrag = useCallback(\n (segment: GanttSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return interactions.drag && !event.readOnly && event.draggable !== false;\n },\n [instance],\n );\n\n const beginMove = useCallback(\n (e: React.PointerEvent, segment: GanttSegment<TData>) => {\n if (e.button !== 0 || !canDrag(segment)) return;\n beginGesture({\n instance,\n kind: \"move\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n customMoveOverlay,\n scheduleMode: viewConfig.scheduleMode,\n });\n },\n [instance, canDrag, customMoveOverlay, viewConfig.scheduleMode],\n );\n\n const canResize = useCallback(\n (segment: GanttSegment<TData>) => {\n const { interactions } = instance.getState();\n const event = segment.occurrence.event;\n return (\n interactions.resize &&\n !event.readOnly &&\n event.resizable !== false &&\n // a milestone is an instant: it has no edges to resize\n segment.occurrence.end.getTime() > segment.occurrence.start.getTime()\n );\n },\n [instance],\n );\n\n const beginResize = useCallback(\n (e: React.PointerEvent, segment: GanttSegment<TData>, edge: \"start\" | \"end\") => {\n if (e.button !== 0 || !canResize(segment)) return;\n e.stopPropagation();\n e.preventDefault();\n beginGesture({\n instance,\n kind: edge === \"start\" ? \"resize-start\" : \"resize-end\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n segment,\n customResizeOverlay,\n scheduleMode: viewConfig.scheduleMode,\n });\n },\n [instance, canResize, customResizeOverlay, viewConfig.scheduleMode],\n );\n\n const beginCreate = useCallback(\n (e: React.PointerEvent) => {\n if (e.button !== 0) return;\n if (!instance.getState().interactions.selectSlot) return;\n beginGesture({\n instance,\n kind: \"create\",\n origin: e.currentTarget as HTMLElement,\n startEvent: e.nativeEvent,\n });\n },\n [instance],\n );\n\n return { beginMove, beginResize, beginCreate, canDrag, canResize };\n}\n\nexport {\n cancelActiveGanttGestures,\n GANTT_ACTIVATION,\n markGestureEnd,\n useGanttGestures,\n useGanttGestureTeardown,\n wasRecentDrag,\n};\n"],"mappings":";;;;;;;;;;;;AAeA,MAAM,mBAAmB;CACvB,gBAAgB;CAChB,kBAAkB;CAClB,cAAc;CACd,kBAAkB;AACpB;;;;;;AAmBA,SAAS,iBAAiB,IAAkB,GAAmB;CAC7D,MAAM,UAAU,KAAK,IAAI,KAAK,IAAI,GAAG,GAAG,KAAK,IAAI,GAAG,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,aACf,YAAiC;EAChC,MAAM,EAAE,iBAAiB,SAAS,SAAS;EAC3C,MAAM,QAAQ,QAAQ,WAAW;EACjC,OACE,aAAa,UACb,CAAC,MAAM,YACP,MAAM,cAAc,SAEpB,QAAQ,WAAW,IAAI,QAAQ,IAAI,QAAQ,WAAW,MAAM,QAAQ;CAExE,GACA,CAAC,QAAQ,CACX;CAkCA,OAAO;EAAE;EAAW,aAhCA,aACjB,GAAuB,SAA8B,SAA0B;GAC9E,IAAI,EAAE,WAAW,KAAK,CAAC,UAAU,OAAO,GAAG;GAC3C,EAAE,gBAAgB;GAClB,EAAE,eAAe;GACjB,aAAa;IACX;IACA,MAAM,SAAS,UAAU,iBAAiB;IAC1C,QAAQ,EAAE;IACV,YAAY,EAAE;IACd;IACA;IACA,cAAc,WAAW;GAC3B,CAAC;EACH,GACA;GAAC;GAAU;GAAW;GAAqB,WAAW;EAAY,CAiBtC;EAAG,aAdb,aACjB,MAA0B;GACzB,IAAI,EAAE,WAAW,GAAG;GACpB,IAAI,CAAC,SAAS,SAAS,CAAC,CAAC,aAAa,YAAY;GAClD,aAAa;IACX;IACA,MAAM;IACN,QAAQ,EAAE;IACV,YAAY,EAAE;GAChB,CAAC;EACH,GACA,CAAC,QAAQ,CAGgC;EAAG;EAAS;CAAU;AACnE"}
@@ -35,6 +35,10 @@ interface GanttI18nConfig {
35
35
  durationDays: (days: number) => string;
36
36
  /** Appended to the bar aria-label when its segment is clipped by the range. */
37
37
  continues: string;
38
+ /** Names the planned (baseline) range in the bar tooltip and aria-label. */
39
+ planned: (rangeLabel: string) => string;
40
+ /** Read to screen readers on a zero-duration (milestone) bar. */
41
+ milestone: string;
38
42
  scales: {
39
43
  day: string;
40
44
  week: string;
@@ -63,8 +67,12 @@ interface GanttI18nConfig {
63
67
  formatEventAriaLabel: (parts: {
64
68
  title: string;
65
69
  timeLabel: string;
70
+ /** Localized milestone clause, from `labels.milestone`. */
71
+ milestoneLabel?: string;
66
72
  rowTitle?: string;
67
73
  progressLabel?: string;
74
+ /** Localized planned-range clause, from `labels.planned`. */
75
+ plannedLabel?: string;
68
76
  continues: boolean;
69
77
  }) => string;
70
78
  };
@@ -1 +1 @@
1
- {"version":3,"file":"gantt-i18n.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-i18n.tsx"],"mappings":";;;UAMU;EACR;IACE;IACA;IACA;IACA;;IAEA;IACA;IACA;IACA;IACA,SAAS;IACT,OAAO;IACP;IACA;;IAEA;;IAEA;IACA;;IAEA;IACA;IACA;;IAEA;;IAEA,YAAY;;IAEZ,WAAW;;IAEX,eAAe;;IAEf;IACA;MACE;MACA;MACA;MACA;MACA;;;;EAIJ;IACE;IACA;IACA;IACA;;EAEF;IACE,cACE,OAAO,YACP;MACE,MAAM;MACN,aAAa;MACb,cAAc;MACd,SAAS;;IAGb,kBAAkB,OAAO,MAAM,KAAK,MAAM,iBAAiB,SAAS;IACpE,iBAAiB,OAAO,gBAAgB,SAAS;;IAEjD,uBAAuB;MACrB;MACA;MACA;MACA;MACA;;;;cAsHA,oBAAoB;;UAUhB;EACR,SAAS,QAAQ,KAAK;IACpB,SAAS,QAAQ;;EAEnB,UAAU,QAAQ;EAClB,YAAY,QAAQ;;;;;;;;;iBAUb,eAAe,YAAY,qBAAqB"}
1
+ {"version":3,"file":"gantt-i18n.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-i18n.tsx"],"mappings":";;;UAMU;EACR;IACE;IACA;IACA;IACA;;IAEA;IACA;IACA;IACA;IACA,SAAS;IACT,OAAO;IACP;IACA;;IAEA;;IAEA;IACA;;IAEA;IACA;IACA;;IAEA;;IAEA,YAAY;;IAEZ,WAAW;;IAEX,eAAe;;IAEf;;IAEA,UAAU;;IAEV;IACA;MACE;MACA;MACA;MACA;MACA;;;;EAIJ;IACE;IACA;IACA;IACA;;EAEF;IACE,cACE,OAAO,YACP;MACE,MAAM;MACN,aAAa;MACb,cAAc;MACd,SAAS;;IAGb,kBAAkB,OAAO,MAAM,KAAK,MAAM,iBAAiB,SAAS;IACpE,iBAAiB,OAAO,gBAAgB,SAAS;;IAEjD,uBAAuB;MACrB;MACA;;MAEA;MACA;MACA;;MAEA;MACA;;;;cA+IA,oBAAoB;;UAUhB;EACR,SAAS,QAAQ,KAAK;IACpB,SAAS,QAAQ;;EAEnB,UAAU,QAAQ;EAClB,YAAY,QAAQ;;;;;;;;;iBAUb,eAAe,YAAY,qBAAqB"}
@@ -25,6 +25,8 @@ const DEFAULT_LABELS = {
25
25
  progress: (percent) => `${percent}% complete`,
26
26
  durationDays: (days) => days === 1 ? "1 day" : `${days} days`,
27
27
  continues: "continues",
28
+ planned: (rangeLabel) => `Planned ${rangeLabel}`,
29
+ milestone: "milestone",
28
30
  scales: {
29
31
  day: "Day",
30
32
  week: "Week",
@@ -60,6 +62,7 @@ function makeDefaultGanttFunctions(cfg) {
60
62
  },
61
63
  formatEventTime: (start, end, allDay, locale) => {
62
64
  const opts = { locale };
65
+ if (end.getTime() === start.getTime()) return allDay ? format(start, "MMM d, yyyy", opts) : format(start, `MMM d, ${cfg.formats.eventTime}`, opts);
63
66
  if (allDay) {
64
67
  const last = end.getTime() - 1 >= start.getTime() ? subMilliseconds(end, 1) : start;
65
68
  if (format(start, "yyyy-MM-dd") === format(last, "yyyy-MM-dd")) return format(start, "MMM d, yyyy", opts);
@@ -76,11 +79,13 @@ function makeDefaultGanttFunctions(cfg) {
76
79
  const rangeEnd = subMilliseconds(range.end, 1);
77
80
  return `${format(range.start, "MMM d", opts)} - ${format(rangeEnd, "MMM d", opts)}`;
78
81
  },
79
- formatEventAriaLabel: ({ title, timeLabel, rowTitle, progressLabel, continues }) => [
82
+ formatEventAriaLabel: ({ title, timeLabel, milestoneLabel, rowTitle, progressLabel, plannedLabel, continues }) => [
80
83
  title,
81
84
  timeLabel,
85
+ milestoneLabel,
82
86
  rowTitle,
83
87
  progressLabel,
88
+ plannedLabel,
84
89
  continues ? cfg.labels.continues : void 0
85
90
  ].filter(Boolean).join(", ")
86
91
  };
@@ -1 +1 @@
1
- {"version":3,"file":"gantt-i18n.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-i18n.tsx"],"sourcesContent":["\"use client\";\n\nimport { format, isSameMonth, isSameYear, type Locale, subMilliseconds } from \"date-fns\";\n\nimport type { GanttDateRange, GanttScale } from \"./gantt-types\";\n\ninterface GanttI18nConfig {\n labels: {\n today: string;\n previous: string;\n next: string;\n addEvent: string;\n /** \"Add task\" hint at the foot of the tree. */\n addTask: string;\n allDay: string;\n loading: string;\n event: string;\n events: (count: number) => string;\n week: (weekNumber: number) => string;\n resources: string;\n goToDate: string;\n /** Hover hint over empty row space, click-only create. */\n scheduleHint: string;\n /** Same hint where dragCreate is on and a drag paints a range. */\n scheduleHintDrag: string;\n reorder: string;\n /** Scale switcher label (\"Timeline scale\"). */\n selectView: string;\n zoomIn: string;\n zoomOut: string;\n /** Aria-label of the tree/timeline splitter. */\n resizePanel: string;\n /** Aria-label of the off-screen bar chips. */\n jumpToBar: (title: string) => string;\n /** Read to screen readers as part of the bar label. */\n progress: (percent: number) => string;\n /** Live duration readout on the resize indicator. */\n durationDays: (days: number) => string;\n /** Appended to the bar aria-label when its segment is clipped by the range. */\n continues: string;\n scales: {\n day: string;\n week: string;\n month: string;\n quarter: string;\n year: string;\n };\n };\n /** date-fns format strings, applied with the gantt `locale`. */\n formats: {\n monthTitle: string;\n dayTitle: string;\n timeGutter: string;\n eventTime: string;\n };\n functions: {\n formatTitle: (\n scale: GanttScale,\n ctx: {\n date: Date;\n activeRange: GanttDateRange;\n visibleRange: GanttDateRange;\n locale?: Locale;\n },\n ) => string;\n formatEventTime: (start: Date, end: Date, allDay: boolean, locale?: Locale) => string;\n formatDayRange: (range: GanttDateRange, locale?: Locale) => string;\n /** Composes the bar's screen-reader label from its localized parts. */\n formatEventAriaLabel: (parts: {\n title: string;\n timeLabel: string;\n rowTitle?: string;\n progressLabel?: string;\n continues: boolean;\n }) => string;\n };\n}\n\nconst DEFAULT_LABELS: GanttI18nConfig[\"labels\"] = {\n today: \"Today\",\n previous: \"Previous\",\n next: \"Next\",\n addEvent: \"Add event\",\n addTask: \"Add task\",\n allDay: \"All day\",\n loading: \"Loading events\",\n event: \"event\",\n events: (count) => (count === 1 ? \"1 event\" : `${count} events`),\n week: (weekNumber) => `W${weekNumber}`,\n resources: \"Resources\",\n goToDate: \"Go to date\",\n scheduleHint: \"Click to add a schedule\",\n scheduleHintDrag: \"Click or drag to add a schedule\",\n reorder: \"Reorder\",\n selectView: \"Select view\",\n zoomIn: \"Zoom in\",\n zoomOut: \"Zoom out\",\n resizePanel: \"Resize panel\",\n jumpToBar: (title) => `Scroll to \"${title}\"`,\n progress: (percent) => `${percent}% complete`,\n durationDays: (days) => (days === 1 ? \"1 day\" : `${days} days`),\n continues: \"continues\",\n scales: {\n day: \"Day\",\n week: \"Week\",\n month: \"Month\",\n quarter: \"Quarter\",\n year: \"Year\",\n },\n};\n\nconst DEFAULT_FORMATS: GanttI18nConfig[\"formats\"] = {\n monthTitle: \"MMMM yyyy\",\n dayTitle: \"EEEE, MMMM d, yyyy\",\n timeGutter: \"h a\",\n eventTime: \"h:mm a\",\n};\n\n/**\n * Default formatting functions BOUND to a config's labels/formats, so that\n * `formats` overrides flow into the default renderers (a consumer overriding\n * formats.eventTime without replacing formatEventTime still sees it applied).\n */\nfunction makeDefaultGanttFunctions(\n cfg: Pick<GanttI18nConfig, \"labels\" | \"formats\">,\n): GanttI18nConfig[\"functions\"] {\n return {\n formatTitle: (scale, { date, activeRange, locale }) => {\n const opts = { locale };\n if (scale === \"day\") {\n return format(date, cfg.formats.dayTitle, opts);\n }\n if (scale === \"month\") {\n return format(date, cfg.formats.monthTitle, opts);\n }\n if (scale === \"quarter\") {\n return format(date, \"QQQ yyyy\", opts);\n }\n if (scale === \"year\") {\n return format(date, \"yyyy\", opts);\n }\n // week: smart range label, last day is activeRange.end - 1ms.\n // subMilliseconds keeps the zoned date type (a plain new Date(ms)\n // would flip the label to the machine zone near midnight)\n const rangeEnd = subMilliseconds(activeRange.end, 1);\n const start = activeRange.start;\n if (isSameMonth(start, rangeEnd)) {\n return `${format(start, \"MMMM d\", opts)} - ${format(rangeEnd, \"d, yyyy\", opts)}`;\n }\n if (isSameYear(start, rangeEnd)) {\n return `${format(start, \"MMM d\", opts)} - ${format(rangeEnd, \"MMM d, yyyy\", opts)}`;\n }\n return `${format(start, \"MMM d, yyyy\", opts)} - ${format(rangeEnd, \"MMM d, yyyy\", opts)}`;\n },\n formatEventTime: (start, end, allDay, locale) => {\n const opts = { locale };\n if (allDay) {\n // a gantt bar is a DATE RANGE: show it, never a bare \"All day\".\n // Ends are exclusive midnights, so the last shown day is end - 1ms;\n // subMilliseconds keeps the caller's zoned date type intact.\n const last = end.getTime() - 1 >= start.getTime() ? subMilliseconds(end, 1) : start;\n const sameDay = format(start, \"yyyy-MM-dd\") === format(last, \"yyyy-MM-dd\");\n if (sameDay) return format(start, \"MMM d, yyyy\", opts);\n if (isSameYear(start, last)) {\n return `${format(start, \"MMM d\", opts)} - ${format(last, \"MMM d, yyyy\", opts)}`;\n }\n return `${format(start, \"MMM d, yyyy\", opts)} - ${format(last, \"MMM d, yyyy\", opts)}`;\n }\n const fmt = cfg.formats.eventTime;\n // Multi-day timed events carry the date on both sides. Compare calendar\n // days off the last rendered instant (end is exclusive, so a 14:00 to\n // midnight bar still ends on the start day). Elapsed ms would miss an\n // exactly-24h bar and a DST day that only runs 23 hours.\n const lastInstant = end.getTime() - 1 >= start.getTime() ? subMilliseconds(end, 1) : start;\n if (format(start, \"yyyy-MM-dd\") !== format(lastInstant, \"yyyy-MM-dd\")) {\n return `${format(start, `MMM d, ${fmt}`, opts)} - ${format(end, `MMM d, ${fmt}`, opts)}`;\n }\n return `${format(start, fmt, opts)} - ${format(end, fmt, opts)}`;\n },\n formatDayRange: (range, locale) => {\n const opts = { locale };\n const rangeEnd = subMilliseconds(range.end, 1);\n return `${format(range.start, \"MMM d\", opts)} - ${format(rangeEnd, \"MMM d\", opts)}`;\n },\n formatEventAriaLabel: ({ title, timeLabel, rowTitle, progressLabel, continues }) =>\n [title, timeLabel, rowTitle, progressLabel, continues ? cfg.labels.continues : undefined]\n .filter(Boolean)\n .join(\", \"),\n };\n}\n\nconst DEFAULT_GANTT_I18N: GanttI18nConfig = {\n labels: DEFAULT_LABELS,\n formats: DEFAULT_FORMATS,\n functions: makeDefaultGanttFunctions({\n labels: DEFAULT_LABELS,\n formats: DEFAULT_FORMATS,\n }),\n};\n\n/** Deep-partial override shape: replace individual keys, never sections. */\ninterface GanttI18nOverrides {\n labels?: Partial<Omit<GanttI18nConfig[\"labels\"], \"scales\">> & {\n scales?: Partial<GanttI18nConfig[\"labels\"][\"scales\"]>;\n };\n formats?: Partial<GanttI18nConfig[\"formats\"]>;\n functions?: Partial<GanttI18nConfig[\"functions\"]>;\n}\n\n/**\n * Shallow merge per nested object, matching the filters.tsx i18n contract:\n * a partial override replaces individual keys, never whole sections. Default\n * functions are re-bound to the MERGED labels/formats so a `formats` (or\n * `labels.continues`) override reaches the default renderers; explicit\n * `functions` overrides still win.\n */\nfunction mergeGanttI18n(overrides?: GanttI18nOverrides): GanttI18nConfig {\n if (!overrides) return DEFAULT_GANTT_I18N;\n const labels = {\n ...DEFAULT_LABELS,\n ...overrides.labels,\n // nested section: replace individual scale names, never the whole set\n scales: {\n ...DEFAULT_LABELS.scales,\n ...overrides.labels?.scales,\n },\n };\n const formats = { ...DEFAULT_FORMATS, ...overrides.formats };\n return {\n labels,\n formats,\n functions: {\n ...makeDefaultGanttFunctions({ labels, formats }),\n ...overrides.functions,\n },\n };\n}\n\nexport type { GanttI18nConfig, GanttI18nOverrides };\nexport { DEFAULT_GANTT_I18N, mergeGanttI18n };\n"],"mappings":";;;AA8EA,MAAM,iBAA4C;CAChD,OAAO;CACP,UAAU;CACV,MAAM;CACN,UAAU;CACV,SAAS;CACT,QAAQ;CACR,SAAS;CACT,OAAO;CACP,SAAS,UAAW,UAAU,IAAI,YAAY,GAAG,MAAM;CACv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IAAI,CAAC,WAAW,OAAO;CACvB,MAAM,SAAS;EACb,GAAG;EACH,GAAG,UAAU;EAEb,QAAQ;GACN,GAAG,eAAe;GAClB,GAAG,UAAU,QAAQ;EACvB;CACF;CACA,MAAM,UAAU;EAAE,GAAG;EAAiB,GAAG,UAAU;CAAQ;CAC3D,OAAO;EACL;EACA;EACA,WAAW;GACT,GAAG,0BAA0B;IAAE;IAAQ;GAAQ,CAAC;GAChD,GAAG,UAAU;EACf;CACF;AACF"}
1
+ {"version":3,"file":"gantt-i18n.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-i18n.tsx"],"sourcesContent":["\"use client\";\n\nimport { format, isSameMonth, isSameYear, type Locale, subMilliseconds } from \"date-fns\";\n\nimport type { GanttDateRange, GanttScale } from \"./gantt-types\";\n\ninterface GanttI18nConfig {\n labels: {\n today: string;\n previous: string;\n next: string;\n addEvent: string;\n /** \"Add task\" hint at the foot of the tree. */\n addTask: string;\n allDay: string;\n loading: string;\n event: string;\n events: (count: number) => string;\n week: (weekNumber: number) => string;\n resources: string;\n goToDate: string;\n /** Hover hint over empty row space, click-only create. */\n scheduleHint: string;\n /** Same hint where dragCreate is on and a drag paints a range. */\n scheduleHintDrag: string;\n reorder: string;\n /** Scale switcher label (\"Timeline scale\"). */\n selectView: string;\n zoomIn: string;\n zoomOut: string;\n /** Aria-label of the tree/timeline splitter. */\n resizePanel: string;\n /** Aria-label of the off-screen bar chips. */\n jumpToBar: (title: string) => string;\n /** Read to screen readers as part of the bar label. */\n progress: (percent: number) => string;\n /** Live duration readout on the resize indicator. */\n durationDays: (days: number) => string;\n /** Appended to the bar aria-label when its segment is clipped by the range. */\n continues: string;\n /** Names the planned (baseline) range in the bar tooltip and aria-label. */\n planned: (rangeLabel: string) => string;\n /** Read to screen readers on a zero-duration (milestone) bar. */\n milestone: string;\n scales: {\n day: string;\n week: string;\n month: string;\n quarter: string;\n year: string;\n };\n };\n /** date-fns format strings, applied with the gantt `locale`. */\n formats: {\n monthTitle: string;\n dayTitle: string;\n timeGutter: string;\n eventTime: string;\n };\n functions: {\n formatTitle: (\n scale: GanttScale,\n ctx: {\n date: Date;\n activeRange: GanttDateRange;\n visibleRange: GanttDateRange;\n locale?: Locale;\n },\n ) => string;\n formatEventTime: (start: Date, end: Date, allDay: boolean, locale?: Locale) => string;\n formatDayRange: (range: GanttDateRange, locale?: Locale) => string;\n /** Composes the bar's screen-reader label from its localized parts. */\n formatEventAriaLabel: (parts: {\n title: string;\n timeLabel: string;\n /** Localized milestone clause, from `labels.milestone`. */\n milestoneLabel?: string;\n rowTitle?: string;\n progressLabel?: string;\n /** Localized planned-range clause, from `labels.planned`. */\n plannedLabel?: string;\n continues: boolean;\n }) => string;\n };\n}\n\nconst DEFAULT_LABELS: GanttI18nConfig[\"labels\"] = {\n today: \"Today\",\n previous: \"Previous\",\n next: \"Next\",\n addEvent: \"Add event\",\n addTask: \"Add task\",\n allDay: \"All day\",\n loading: \"Loading events\",\n event: \"event\",\n events: (count) => (count === 1 ? \"1 event\" : `${count} events`),\n week: (weekNumber) => `W${weekNumber}`,\n resources: \"Resources\",\n goToDate: \"Go to date\",\n scheduleHint: \"Click to add a schedule\",\n scheduleHintDrag: \"Click or drag to add a schedule\",\n reorder: \"Reorder\",\n selectView: \"Select view\",\n zoomIn: \"Zoom in\",\n zoomOut: \"Zoom out\",\n resizePanel: \"Resize panel\",\n jumpToBar: (title) => `Scroll to \"${title}\"`,\n progress: (percent) => `${percent}% complete`,\n durationDays: (days) => (days === 1 ? \"1 day\" : `${days} days`),\n continues: \"continues\",\n planned: (rangeLabel) => `Planned ${rangeLabel}`,\n milestone: \"milestone\",\n scales: {\n day: \"Day\",\n week: \"Week\",\n month: \"Month\",\n quarter: \"Quarter\",\n year: \"Year\",\n },\n};\n\nconst DEFAULT_FORMATS: GanttI18nConfig[\"formats\"] = {\n monthTitle: \"MMMM yyyy\",\n dayTitle: \"EEEE, MMMM d, yyyy\",\n timeGutter: \"h a\",\n eventTime: \"h:mm a\",\n};\n\n/**\n * Default formatting functions BOUND to a config's labels/formats, so that\n * `formats` overrides flow into the default renderers (a consumer overriding\n * formats.eventTime without replacing formatEventTime still sees it applied).\n */\nfunction makeDefaultGanttFunctions(\n cfg: Pick<GanttI18nConfig, \"labels\" | \"formats\">,\n): GanttI18nConfig[\"functions\"] {\n return {\n formatTitle: (scale, { date, activeRange, locale }) => {\n const opts = { locale };\n if (scale === \"day\") {\n return format(date, cfg.formats.dayTitle, opts);\n }\n if (scale === \"month\") {\n return format(date, cfg.formats.monthTitle, opts);\n }\n if (scale === \"quarter\") {\n return format(date, \"QQQ yyyy\", opts);\n }\n if (scale === \"year\") {\n return format(date, \"yyyy\", opts);\n }\n // week: smart range label, last day is activeRange.end - 1ms.\n // subMilliseconds keeps the zoned date type (a plain new Date(ms)\n // would flip the label to the machine zone near midnight)\n const rangeEnd = subMilliseconds(activeRange.end, 1);\n const start = activeRange.start;\n if (isSameMonth(start, rangeEnd)) {\n return `${format(start, \"MMMM d\", opts)} - ${format(rangeEnd, \"d, yyyy\", opts)}`;\n }\n if (isSameYear(start, rangeEnd)) {\n return `${format(start, \"MMM d\", opts)} - ${format(rangeEnd, \"MMM d, yyyy\", opts)}`;\n }\n return `${format(start, \"MMM d, yyyy\", opts)} - ${format(rangeEnd, \"MMM d, yyyy\", opts)}`;\n },\n formatEventTime: (start, end, allDay, locale) => {\n const opts = { locale };\n if (end.getTime() === start.getTime()) {\n // a milestone is an instant, not a range - \"9:00 AM - 9:00 AM\" reads\n // like a data bug\n return allDay\n ? format(start, \"MMM d, yyyy\", opts)\n : format(start, `MMM d, ${cfg.formats.eventTime}`, opts);\n }\n if (allDay) {\n // a gantt bar is a DATE RANGE: show it, never a bare \"All day\".\n // Ends are exclusive midnights, so the last shown day is end - 1ms;\n // subMilliseconds keeps the caller's zoned date type intact.\n const last = end.getTime() - 1 >= start.getTime() ? subMilliseconds(end, 1) : start;\n const sameDay = format(start, \"yyyy-MM-dd\") === format(last, \"yyyy-MM-dd\");\n if (sameDay) return format(start, \"MMM d, yyyy\", opts);\n if (isSameYear(start, last)) {\n return `${format(start, \"MMM d\", opts)} - ${format(last, \"MMM d, yyyy\", opts)}`;\n }\n return `${format(start, \"MMM d, yyyy\", opts)} - ${format(last, \"MMM d, yyyy\", opts)}`;\n }\n const fmt = cfg.formats.eventTime;\n // Multi-day timed events carry the date on both sides. Compare calendar\n // days off the last rendered instant (end is exclusive, so a 14:00 to\n // midnight bar still ends on the start day). Elapsed ms would miss an\n // exactly-24h bar and a DST day that only runs 23 hours.\n const lastInstant = end.getTime() - 1 >= start.getTime() ? subMilliseconds(end, 1) : start;\n if (format(start, \"yyyy-MM-dd\") !== format(lastInstant, \"yyyy-MM-dd\")) {\n return `${format(start, `MMM d, ${fmt}`, opts)} - ${format(end, `MMM d, ${fmt}`, opts)}`;\n }\n return `${format(start, fmt, opts)} - ${format(end, fmt, opts)}`;\n },\n formatDayRange: (range, locale) => {\n const opts = { locale };\n const rangeEnd = subMilliseconds(range.end, 1);\n return `${format(range.start, \"MMM d\", opts)} - ${format(rangeEnd, \"MMM d\", opts)}`;\n },\n formatEventAriaLabel: ({\n title,\n timeLabel,\n milestoneLabel,\n rowTitle,\n progressLabel,\n plannedLabel,\n continues,\n }) =>\n [\n title,\n timeLabel,\n milestoneLabel,\n rowTitle,\n progressLabel,\n plannedLabel,\n continues ? cfg.labels.continues : undefined,\n ]\n .filter(Boolean)\n .join(\", \"),\n };\n}\n\nconst DEFAULT_GANTT_I18N: GanttI18nConfig = {\n labels: DEFAULT_LABELS,\n formats: DEFAULT_FORMATS,\n functions: makeDefaultGanttFunctions({\n labels: DEFAULT_LABELS,\n formats: DEFAULT_FORMATS,\n }),\n};\n\n/** Deep-partial override shape: replace individual keys, never sections. */\ninterface GanttI18nOverrides {\n labels?: Partial<Omit<GanttI18nConfig[\"labels\"], \"scales\">> & {\n scales?: Partial<GanttI18nConfig[\"labels\"][\"scales\"]>;\n };\n formats?: Partial<GanttI18nConfig[\"formats\"]>;\n functions?: Partial<GanttI18nConfig[\"functions\"]>;\n}\n\n/**\n * Shallow merge per nested object, matching the filters.tsx i18n contract:\n * a partial override replaces individual keys, never whole sections. Default\n * functions are re-bound to the MERGED labels/formats so a `formats` (or\n * `labels.continues`) override reaches the default renderers; explicit\n * `functions` overrides still win.\n */\nfunction mergeGanttI18n(overrides?: GanttI18nOverrides): GanttI18nConfig {\n if (!overrides) return DEFAULT_GANTT_I18N;\n const labels = {\n ...DEFAULT_LABELS,\n ...overrides.labels,\n // nested section: replace individual scale names, never the whole set\n scales: {\n ...DEFAULT_LABELS.scales,\n ...overrides.labels?.scales,\n },\n };\n const formats = { ...DEFAULT_FORMATS, ...overrides.formats };\n return {\n labels,\n formats,\n functions: {\n ...makeDefaultGanttFunctions({ labels, formats }),\n ...overrides.functions,\n },\n };\n}\n\nexport type { GanttI18nConfig, GanttI18nOverrides };\nexport { DEFAULT_GANTT_I18N, mergeGanttI18n };\n"],"mappings":";;;AAsFA,MAAM,iBAA4C;CAChD,OAAO;CACP,UAAU;CACV,MAAM;CACN,UAAU;CACV,SAAS;CACT,QAAQ;CACR,SAAS;CACT,OAAO;CACP,SAAS,UAAW,UAAU,IAAI,YAAY,GAAG,MAAM;CACvD,OAAO,eAAe,IAAI;CAC1B,WAAW;CACX,UAAU;CACV,cAAc;CACd,kBAAkB;CAClB,SAAS;CACT,YAAY;CACZ,QAAQ;CACR,SAAS;CACT,aAAa;CACb,YAAY,UAAU,cAAc,MAAM;CAC1C,WAAW,YAAY,GAAG,QAAQ;CAClC,eAAe,SAAU,SAAS,IAAI,UAAU,GAAG,KAAK;CACxD,WAAW;CACX,UAAU,eAAe,WAAW;CACpC,WAAW;CACX,QAAQ;EACN,KAAK;EACL,MAAM;EACN,OAAO;EACP,SAAS;EACT,MAAM;CACR;AACF;AAEA,MAAM,kBAA8C;CAClD,YAAY;CACZ,UAAU;CACV,YAAY;CACZ,WAAW;AACb;;;;;;AAOA,SAAS,0BACP,KAC8B;CAC9B,OAAO;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ACF;AACF"}
@@ -1,4 +1,4 @@
1
- import { GanttDateRange, GanttEvent, GanttOccurrence, GanttOffDaysConfig, GanttResource, GanttScale, GanttSegment } from "./gantt-types.js";
1
+ import { GanttBaseline, GanttBaselineVariance, GanttDateRange, GanttEvent, GanttOccurrence, GanttOffDaysConfig, GanttRecurrenceRule, GanttResource, GanttScale, GanttSegment } from "./gantt-types.js";
2
2
  import { TZDate } from "@date-fns/tz";
3
3
  //#region src/components/reui/gantt/gantt-lib.d.ts
4
4
  type WeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;
@@ -38,10 +38,67 @@ declare function eventsOverlap(a: {
38
38
  start: Date;
39
39
  end: Date;
40
40
  }): boolean;
41
+ /**
42
+ * Range visibility for an occurrence: half-open like rangesIntersect, except
43
+ * a zero-length occurrence (a milestone). The plain test can never admit an
44
+ * instant sitting exactly on the range start, so milestones compare the
45
+ * start closed; the end stays exclusive - an instant on the range end
46
+ * belongs to the next period. gantt-recurrence inlines this same rule
47
+ * (importing it back here would cycle the modules).
48
+ */
49
+ declare function occurrenceIntersects(occ: {
50
+ start: Date;
51
+ end: Date;
52
+ }, range: GanttDateRange): boolean;
41
53
  declare function spansMultipleDays(occ: {
42
54
  start: Date;
43
55
  end: Date;
44
56
  }): boolean;
57
+ /**
58
+ * The subject's validated planned window, or null: both instants present,
59
+ * end not before start, and (for events) non-recurring - a series has no
60
+ * single planned window. An edited single occurrence (recurringEventId
61
+ * without its own rule) is a plain event here and keeps its baseline.
62
+ * Structural on purpose: a GanttResource node's own baseline pair resolves
63
+ * through the same rule.
64
+ */
65
+ declare function resolveEventBaseline(subject: {
66
+ baselineStart?: Date;
67
+ baselineEnd?: Date;
68
+ recurrence?: GanttRecurrenceRule | string;
69
+ }): GanttBaseline | null;
70
+ interface GanttDependencyGeometry {
71
+ /** Orthogonal elbow path for the connector line, in the caller's units. */
72
+ line: string;
73
+ /** Filled arrowhead at the target anchor, pointing along +x. */
74
+ arrow: string;
75
+ }
76
+ /**
77
+ * Finish-to-start connector geometry from a predecessor's END anchor to a
78
+ * successor's START anchor, in whatever units the caller works in (the view
79
+ * passes rem). A target with room ahead takes the classic Z route: out by
80
+ * `clearance`, across to the target lane, in. A target at or behind the
81
+ * source's exit loops instead: out, hop `laneStep` toward the target's side
82
+ * (down when level - below reads as "later"), back past the target, in.
83
+ * The line stops `arrowSize` short of the anchor so it never pokes through
84
+ * the head. The exit stub can sit under an outside-after bar label; a
85
+ * consumer that shows those widens the label's start margin instead of the
86
+ * routing changing shape (a drop-first exit was tried and read worse
87
+ * everywhere else).
88
+ */
89
+ declare function buildDependencyPath(from: {
90
+ x: number;
91
+ y: number;
92
+ }, to: {
93
+ x: number;
94
+ y: number;
95
+ }, opts: {
96
+ clearance: number;
97
+ laneStep: number;
98
+ arrowSize: number;
99
+ }): GanttDependencyGeometry;
100
+ /** Actual end against the planned end; null when no valid baseline exists. */
101
+ declare function getBaselineVariance<TData>(event: GanttEvent<TData>): GanttBaselineVariance | null;
45
102
  /**
46
103
  * Identity of a schedule ACROSS time edits. `occurrence.key` embeds the start
47
104
  * instant, so it changes the moment a schedule is moved or start-resized -
@@ -119,5 +176,5 @@ declare function reorderResources(resources: GanttResource[], resourceId: string
119
176
  /** Resolves whether a day is an off day (non-working) in the display zone. */
120
177
  declare function resolveOffDay(day: Date, timeZone: string, config: boolean | GanttOffDaysConfig | undefined): boolean;
121
178
  //#endregion
122
- export { type BuildIndexOptions, type GanttIndex, type GanttLaneMemo, MIN_PACK_SLOT, type PackOptions, type ViewDateRanges, type ViewRangeOptions, type WeekStartsOn, buildEventIndex, defaultEventOrder, eventsOverlap, findResource, flattenResources, getDayKey, getDayTotalMinutes, getGanttDateRange, getLaneKey, getRangeKey, packTimedSegments, rangesIntersect, reorderResources, resolveOffDay, snapMinutes, spansMultipleDays, stepGanttDate, toZoned, zonedStartOfDay };
179
+ export { type BuildIndexOptions, type GanttDependencyGeometry, type GanttIndex, type GanttLaneMemo, MIN_PACK_SLOT, type PackOptions, type ViewDateRanges, type ViewRangeOptions, type WeekStartsOn, buildDependencyPath, buildEventIndex, defaultEventOrder, eventsOverlap, findResource, flattenResources, getBaselineVariance, getDayKey, getDayTotalMinutes, getGanttDateRange, getLaneKey, getRangeKey, occurrenceIntersects, packTimedSegments, rangesIntersect, reorderResources, resolveEventBaseline, resolveOffDay, snapMinutes, spansMultipleDays, stepGanttDate, toZoned, zonedStartOfDay };
123
180
  //# sourceMappingURL=gantt-lib.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gantt-lib.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-lib.tsx"],"mappings":";;;KA4BK;;;;;;;cAQC;;iBAGG,QAAQ,MAAM,MAAM,mBAAmB;;iBAKvC,gBAAgB,MAAM,MAAM,mBAAmB;;iBAK/C,UAAU,MAAM,MAAM;;iBAKtB,mBAAmB,UAAU,MAAM;iBAKnC,YAAY,iBAAiB;UAI5B;EACR;EACA,cAAc;;UAGN;EACR,cAAc;EACd,aAAa;;;iBAIN,kBAAkB,OAAO,YAAY,MAAM,MAAM,MAAM,mBAAmB;;iBAsC1E,cACP,OAAO,YACP,MAAM,MACN,mBACA,MAAM,KAAK,gCACV;iBASM,gBAAgB,GAAG,gBAAgB,GAAG;iBAItC,cAAc;EAAK,OAAO;EAAM,KAAK;GAAQ;EAAK,OAAO;EAAM,KAAK;;iBAIpE,kBAAkB;EAAO,OAAO;EAAM,KAAK;;;;;;;;iBAY3C,WAAW;EAAc;EAAiB;;;;;;;UASzC;EACR;EACA;EACA;;UAGQ;;;;;;;;;;;;EAYR,iBAAiB,YAAY;;EAE7B;;;;;;;iBAQO,kBAAkB,OACzB,UAAU,aAAa,UACvB,UAAS;iBAyJF,kBAAkB,GAAG,iBAAiB,GAAG;UAQxC,kBAAkB;EAC1B;;EAEA,kBACE,OAAO,WAAW,QAClB,OAAO,gBACP;IAAO;QACJ;IAAQ,OAAO;IAAM,KAAK;;EAC/B,cAAc,GAAG,gBAAgB,QAAQ,GAAG,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;;;;;;UASzC;EACR;EACA;EACA;;UAGQ;;;;;;;;;;;;EAYR,iBAAiB,YAAY;;EAE7B;;;;;;;iBAQO,kBAAkB,OACzB,UAAU,aAAa,UACvB,UAAS;iBAyJF,kBAAkB,GAAG,iBAAiB,GAAG;UAQxC,kBAAkB;EAC1B;;EAEA,kBACE,OAAO,WAAW,QAClB,OAAO,gBACP;IAAO;QACJ;IAAQ,OAAO;IAAM,KAAK;;EAC/B,cAAc,GAAG,gBAAgB,QAAQ,GAAG,gBAAgB;;UAGpD,WAAW;EACnB,aAAa,gBAAgB;;iBAGtB,gBAAgB,OACvB,QAAQ,WAAW,UACnB,cAAc,gBACd,MAAM,kBAAkB,SACvB,WAAW;;iBAkDL,YAAY,OAAO;;iBAKnB,iBACP,WAAW,iBACX,iBACC;EAAQ,UAAU;EAAe;;;iBAY3B,aAAa,WAAW,iBAAiB,aAAa;;;;;;;iBAetD,iBACP,WAAW,iBACX,oBACA,yBACA,gBACC;;iBAiDM,cACP,KAAK,MACL,kBACA,kBAAkB"}
@@ -107,10 +107,75 @@ function rangesIntersect(a, b) {
107
107
  function eventsOverlap(a, b) {
108
108
  return a.start < b.end && a.end > b.start;
109
109
  }
110
+ /**
111
+ * Range visibility for an occurrence: half-open like rangesIntersect, except
112
+ * a zero-length occurrence (a milestone). The plain test can never admit an
113
+ * instant sitting exactly on the range start, so milestones compare the
114
+ * start closed; the end stays exclusive - an instant on the range end
115
+ * belongs to the next period. gantt-recurrence inlines this same rule
116
+ * (importing it back here would cycle the modules).
117
+ */
118
+ function occurrenceIntersects(occ, range) {
119
+ if (occ.end.getTime() === occ.start.getTime()) return occ.start >= range.start && occ.start < range.end;
120
+ return rangesIntersect(occ, range);
121
+ }
110
122
  function spansMultipleDays(occ) {
111
123
  return occ.end.getTime() - occ.start.getTime() > 864e5;
112
124
  }
113
125
  /**
126
+ * The subject's validated planned window, or null: both instants present,
127
+ * end not before start, and (for events) non-recurring - a series has no
128
+ * single planned window. An edited single occurrence (recurringEventId
129
+ * without its own rule) is a plain event here and keeps its baseline.
130
+ * Structural on purpose: a GanttResource node's own baseline pair resolves
131
+ * through the same rule.
132
+ */
133
+ function resolveEventBaseline(subject) {
134
+ if (!subject.baselineStart || !subject.baselineEnd || subject.recurrence) return null;
135
+ const startMs = subject.baselineStart.getTime();
136
+ const endMs = subject.baselineEnd.getTime();
137
+ if (endMs < startMs) return null;
138
+ return {
139
+ start: subject.baselineStart,
140
+ end: subject.baselineEnd,
141
+ milestone: endMs === startMs
142
+ };
143
+ }
144
+ /**
145
+ * Finish-to-start connector geometry from a predecessor's END anchor to a
146
+ * successor's START anchor, in whatever units the caller works in (the view
147
+ * passes rem). A target with room ahead takes the classic Z route: out by
148
+ * `clearance`, across to the target lane, in. A target at or behind the
149
+ * source's exit loops instead: out, hop `laneStep` toward the target's side
150
+ * (down when level - below reads as "later"), back past the target, in.
151
+ * The line stops `arrowSize` short of the anchor so it never pokes through
152
+ * the head. The exit stub can sit under an outside-after bar label; a
153
+ * consumer that shows those widens the label's start margin instead of the
154
+ * routing changing shape (a drop-first exit was tried and read worse
155
+ * everywhere else).
156
+ */
157
+ function buildDependencyPath(from, to, opts) {
158
+ const { clearance, laneStep, arrowSize } = opts;
159
+ const lineEndX = to.x - arrowSize;
160
+ const arrow = `M ${to.x} ${to.y} L ${lineEndX} ${to.y - arrowSize * .6} L ${lineEndX} ${to.y + arrowSize * .6} Z`;
161
+ if (lineEndX >= from.x + clearance) return {
162
+ line: `M ${from.x} ${from.y} H ${from.x + clearance} V ${to.y} H ${lineEndX}`,
163
+ arrow
164
+ };
165
+ const midY = to.y >= from.y ? from.y + laneStep : from.y - laneStep;
166
+ return {
167
+ line: `M ${from.x} ${from.y} H ${from.x + clearance} V ${midY} H ${to.x - clearance} V ${to.y} H ${lineEndX}`,
168
+ arrow
169
+ };
170
+ }
171
+ /** Actual end against the planned end; null when no valid baseline exists. */
172
+ function getBaselineVariance(event) {
173
+ const baseline = resolveEventBaseline(event);
174
+ if (!baseline) return null;
175
+ const deltaMs = event.end.getTime() - baseline.end.getTime();
176
+ return deltaMs > 0 ? "late" : deltaMs < 0 ? "early" : "on-time";
177
+ }
178
+ /**
114
179
  * Identity of a schedule ACROSS time edits. `occurrence.key` embeds the start
115
180
  * instant, so it changes the moment a schedule is moved or start-resized -
116
181
  * useless as lane memory. This key survives the edit: the event id plus, for a
@@ -237,7 +302,7 @@ function buildEventIndex(events, visibleRange, opts) {
237
302
  if (custom) {
238
303
  custom.forEach((occ, i) => {
239
304
  if (replaced?.has(occ.start.getTime())) return;
240
- if (!rangesIntersect({
305
+ if (!occurrenceIntersects({
241
306
  start: occ.start,
242
307
  end: occ.end
243
308
  }, visibleRange)) return;
@@ -351,6 +416,6 @@ function resolveOffDay(day, timeZone, config) {
351
416
  return resolved.isOffDay?.(day) ?? false;
352
417
  }
353
418
  //#endregion
354
- export { MIN_PACK_SLOT, buildEventIndex, defaultEventOrder, eventsOverlap, findResource, flattenResources, getDayKey, getDayTotalMinutes, getGanttDateRange, getLaneKey, getRangeKey, packTimedSegments, rangesIntersect, reorderResources, resolveOffDay, snapMinutes, spansMultipleDays, stepGanttDate, toZoned, zonedStartOfDay };
419
+ export { MIN_PACK_SLOT, buildDependencyPath, buildEventIndex, defaultEventOrder, eventsOverlap, findResource, flattenResources, getBaselineVariance, getDayKey, getDayTotalMinutes, getGanttDateRange, getLaneKey, getRangeKey, occurrenceIntersects, packTimedSegments, rangesIntersect, reorderResources, resolveEventBaseline, resolveOffDay, snapMinutes, spansMultipleDays, stepGanttDate, toZoned, zonedStartOfDay };
355
420
 
356
421
  //# sourceMappingURL=gantt-lib.js.map