@kumix/ui 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/badge.d.ts +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts +2 -2
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts +9 -2
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +158 -3
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +1 -0
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.d.ts.map +1 -1
- package/dist/components/reui/date-selector.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +12 -4
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-content.js +1 -1
- package/dist/components/reui/event-calendar/event-calendar-content.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts +3 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-dnd.js +100 -20
- package/dist/components/reui/event-calendar/event-calendar-dnd.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-event.js +5 -4
- package/dist/components/reui/event-calendar/event-calendar-event.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts +16 -4
- package/dist/components/reui/event-calendar/event-calendar-i18n.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-i18n.js +10 -9
- package/dist/components/reui/event-calendar/event-calendar-i18n.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-lib.d.ts +13 -6
- package/dist/components/reui/event-calendar/event-calendar-lib.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-lib.js +30 -12
- package/dist/components/reui/event-calendar/event-calendar-lib.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-month-view.js +43 -6
- package/dist/components/reui/event-calendar/event-calendar-month-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-recurrence.d.ts +3 -2
- package/dist/components/reui/event-calendar/event-calendar-recurrence.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js +56 -22
- package/dist/components/reui/event-calendar/event-calendar-recurrence.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js +13 -4
- package/dist/components/reui/event-calendar/event-calendar-resource-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js +21 -5
- package/dist/components/reui/event-calendar/event-calendar-time-grid.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts +5 -0
- package/dist/components/reui/event-calendar/event-calendar-types.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.d.ts +2 -2
- package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.js +106 -10
- package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
- package/dist/components/reui/frame.d.ts +7 -8
- package/dist/components/reui/frame.d.ts.map +1 -1
- package/dist/components/reui/frame.js +13 -11
- package/dist/components/reui/frame.js.map +1 -1
- package/dist/components/reui/gantt/gantt-i18n.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-i18n.js +2 -1
- package/dist/components/reui/gantt/gantt-i18n.js.map +1 -1
- package/dist/components/reui/gantt/gantt-lib.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-lib.js +2 -1
- package/dist/components/reui/gantt/gantt-lib.js.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.d.ts +1 -1
- package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
- package/dist/components/reui/gantt/gantt-recurrence.js +18 -17
- package/dist/components/reui/gantt/gantt-recurrence.js.map +1 -1
- package/dist/components/reui/gantt/gantt-view.js +53 -6
- package/dist/components/reui/gantt/gantt-view.js.map +1 -1
- package/dist/components/reui/gantt/gantt.d.ts +8 -0
- package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt.js +2 -0
- package/dist/components/reui/gantt/gantt.js.map +1 -1
- package/dist/components/reui/icon-stack.d.ts +2 -3
- package/dist/components/reui/icon-stack.d.ts.map +1 -1
- package/dist/components/reui/icon-stack.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +37 -0
- package/dist/components/reui/icon-tile.d.ts.map +1 -0
- package/dist/components/reui/icon-tile.js +103 -0
- package/dist/components/reui/icon-tile.js.map +1 -0
- package/dist/components/reui/kanban.d.ts.map +1 -1
- package/dist/components/reui/kanban.js +23 -8
- package/dist/components/reui/kanban.js.map +1 -1
- package/dist/components/reui/number-field.d.ts +7 -8
- package/dist/components/reui/number-field.d.ts.map +1 -1
- package/dist/components/reui/number-field.js +4 -4
- package/dist/components/reui/number-field.js.map +1 -1
- package/dist/components/reui/scrollspy.d.ts.map +1 -1
- package/dist/components/reui/scrollspy.js.map +1 -1
- package/dist/components/reui/sortable.d.ts.map +1 -1
- package/dist/components/reui/sortable.js +21 -10
- package/dist/components/reui/sortable.js.map +1 -1
- package/dist/components/ui/aspect-ratio.d.ts +2 -3
- package/dist/components/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/components/ui/aspect-ratio.js.map +1 -1
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/breadcrumb.d.ts.map +1 -1
- package/dist/components/ui/breadcrumb.js +2 -0
- package/dist/components/ui/breadcrumb.js.map +1 -1
- package/dist/components/ui/button-group.d.ts +3 -4
- package/dist/components/ui/button-group.d.ts.map +1 -1
- package/dist/components/ui/button-group.js.map +1 -1
- package/dist/components/ui/button.d.ts +1 -1
- package/dist/components/ui/carousel.d.ts.map +1 -1
- package/dist/components/ui/carousel.js +1 -2
- package/dist/components/ui/carousel.js.map +1 -1
- package/dist/components/ui/empty.d.ts +6 -7
- package/dist/components/ui/empty.d.ts.map +1 -1
- package/dist/components/ui/empty.js.map +1 -1
- package/dist/components/ui/field.d.ts +14 -15
- package/dist/components/ui/field.d.ts.map +1 -1
- package/dist/components/ui/field.js.map +1 -1
- package/dist/components/ui/kbd.d.ts +2 -3
- package/dist/components/ui/kbd.d.ts.map +1 -1
- package/dist/components/ui/kbd.js +1 -1
- package/dist/components/ui/kbd.js.map +1 -1
- package/dist/components/ui/navigation-menu.d.ts +8 -9
- package/dist/components/ui/navigation-menu.d.ts.map +1 -1
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/progress.d.ts.map +1 -1
- package/dist/components/ui/progress.js +3 -3
- package/dist/components/ui/progress.js.map +1 -1
- package/dist/components/ui/skeleton.d.ts +1 -2
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/skeleton.js.map +1 -1
- package/dist/components/ui/spinner.d.ts +1 -2
- package/dist/components/ui/spinner.d.ts.map +1 -1
- package/dist/components/ui/spinner.js.map +1 -1
- package/dist/components/ui/toast.d.ts +19 -0
- package/dist/components/ui/toast.d.ts.map +1 -0
- package/dist/components/ui/toast.js +124 -0
- package/dist/components/ui/toast.js.map +1 -0
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.d.ts","names":[],"sources":["../../../src/components/reui/frame.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"frame.d.ts","names":[],"sources":["../../../src/components/reui/frame.tsx"],"mappings":";;;;;;;;;;;;;;cAkBM,gBAAa;;;;;6CAwElB;iBAEQ,QACP,WACA,SACA,SACA,SACA,UACG,SACF,MAAM,wBAAwB,oBAAoB,iCAAc,IAAA;iBAW1D,aAAa,WAAW,QAAQ,SAAS,MAAM;EAA0B;oBAAe,IAAA;iBAqBxF,cAAc,cAAc,SAAS,MAAM,2CAAwB,IAAA;iBAanE,aAAa,cAAc,SAAS,MAAM,wCAAqB,IAAA;iBAU/D,mBAAmB,cAAc,SAAS,MAAM,wCAAqB,IAAA;iBAUrE,cAAc,cAAc,SAAS,MAAM,2CAAwB,IAAA"}
|
|
@@ -17,24 +17,26 @@ import { jsx } from "react/jsx-runtime";
|
|
|
17
17
|
*/
|
|
18
18
|
const frameVariants = cva([
|
|
19
19
|
"relative flex flex-col gap-(--frame-gap) rounded-(--frame-radius) bg-muted/50 px-(--frame-px) py-(--frame-py)",
|
|
20
|
-
"[--frame-radius:var(--radius-xl)]",
|
|
21
|
-
"
|
|
22
|
-
"[--frame-panel-footer-gap:--spacing(1)] [--frame-panel-header-gap:0rem]",
|
|
20
|
+
"(--radius-xl)] [--frame-radius:var(--radius-xl)]",
|
|
21
|
+
"(--radius-none)] (--radius-2xl)] (--radius-lg)] (--radius-none)]",
|
|
22
|
+
"[--frame-gap:--spacing(0.75)] [--frame-panel-footer-gap:--spacing(1)] [--frame-panel-header-gap:0rem] [--frame-px:--spacing(0.75)] [--frame-py:--spacing(0.75)]",
|
|
23
23
|
"[--frame-panel-footer-px-adjust:0px] [--frame-panel-footer-py-adjust:0px] [--frame-panel-header-px-adjust:0px] [--frame-panel-header-py-adjust:0px] [--frame-panel-px-adjust:0px] [--frame-panel-py-adjust:0px]",
|
|
24
24
|
"[--frame-panel-footer-px:calc(var(--frame-panel-footer-px-base)_+_var(--frame-panel-footer-px-adjust))] [--frame-panel-footer-py:calc(var(--frame-panel-footer-py-base)_+_var(--frame-panel-footer-py-adjust))] [--frame-panel-header-px:calc(var(--frame-panel-header-px-base)_+_var(--frame-panel-header-px-adjust))] [--frame-panel-header-py:calc(var(--frame-panel-header-py-base)_+_var(--frame-panel-header-py-adjust))] [--frame-panel-px:calc(var(--frame-panel-px-base)_+_var(--frame-panel-px-adjust))] [--frame-panel-py:calc(var(--frame-panel-py-base)_+_var(--frame-panel-py-adjust))]",
|
|
25
|
-
"
|
|
25
|
+
"(1)] (1)] (1.25)] (1.5)] (1.5)] (0.5)] (1)] (1)]",
|
|
26
|
+
"[--frame-border-color:var(--color-border)] [--frame-panel-bg:var(--color-card)] [--frame-panel-border-color:var(--color-border)]",
|
|
27
|
+
"[--frame-panel-radius:calc(var(--frame-radius)_-_var(--frame-px)_-_1px)]"
|
|
26
28
|
], {
|
|
27
29
|
variants: {
|
|
28
30
|
variant: {
|
|
29
31
|
default: "border border-[var(--frame-border-color)] bg-clip-padding",
|
|
30
32
|
inverse: "border border-[var(--frame-border-color)] bg-background bg-clip-padding [--frame-panel-bg:color-mix(in_oklch,var(--color-muted)_40%,transparent)]",
|
|
31
|
-
ghost: ""
|
|
33
|
+
ghost: "[--frame-panel-radius:calc(var(--frame-radius)_-_var(--frame-px))]"
|
|
32
34
|
},
|
|
33
35
|
spacing: {
|
|
34
|
-
xs: "[--frame-
|
|
35
|
-
sm: "[--frame-
|
|
36
|
-
default: "[--frame-panel-footer-px-base:--spacing(4)] [--frame-panel-footer-py-base:--spacing(
|
|
37
|
-
lg: "[--frame-
|
|
36
|
+
xs: "[--frame-panel-footer-px-base:--spacing(2)] [--frame-panel-footer-py-base:--spacing(0.5)] [--frame-panel-header-px-base:--spacing(2)] [--frame-panel-header-py-base:--spacing(0.5)] [--frame-panel-px-base:--spacing(2)] [--frame-panel-py-base:--spacing(2)]",
|
|
37
|
+
sm: "[--frame-panel-footer-px-base:--spacing(3)] [--frame-panel-footer-py-base:--spacing(1.5)] [--frame-panel-header-px-base:--spacing(3)] [--frame-panel-header-py-base:--spacing(1.5)] [--frame-panel-px-base:--spacing(3)] [--frame-panel-py-base:--spacing(3.5)]",
|
|
38
|
+
default: "[--frame-panel-footer-px-base:--spacing(4)] [--frame-panel-footer-py-base:--spacing(2)] [--frame-panel-header-px-base:--spacing(4)] [--frame-panel-header-py-base:--spacing(2)] [--frame-panel-px-base:--spacing(4)] [--frame-panel-py-base:--spacing(4)]",
|
|
39
|
+
lg: "[--frame-panel-footer-px-base:--spacing(5)] [--frame-panel-footer-py-base:--spacing(2.5)] [--frame-panel-header-px-base:--spacing(5)] [--frame-panel-header-py-base:--spacing(2.5)] [--frame-panel-px-base:--spacing(5)] [--frame-panel-py-base:--spacing(5)]"
|
|
38
40
|
},
|
|
39
41
|
stacked: {
|
|
40
42
|
true: [
|
|
@@ -50,7 +52,7 @@ const frameVariants = cva([
|
|
|
50
52
|
]
|
|
51
53
|
},
|
|
52
54
|
dense: {
|
|
53
|
-
true: "gap-0 border-[var(--frame-border-color)] p-0 [&:not(:has([data-slot=frame-panel-header]))_[data-slot=frame-panel]:is(:first-child)]:-mt-px [&_[data-slot=frame-panel]:last-child]:-mb-px [&_[data-slot=frame-panel]]:-mx-px [&_[data-slot=frame-panel]]:before:hidden",
|
|
55
|
+
true: "gap-0 border-[var(--frame-border-color)] p-0 [--frame-panel-radius:var(--frame-radius)] [&:not(:has([data-slot=frame-panel-header]))_[data-slot=frame-panel]:is(:first-child)]:-mt-px [&_[data-slot=frame-panel]:last-child]:-mb-px [&_[data-slot=frame-panel]]:-mx-px [&_[data-slot=frame-panel]]:before:hidden",
|
|
54
56
|
false: ""
|
|
55
57
|
}
|
|
56
58
|
},
|
|
@@ -76,7 +78,7 @@ function Frame({ className, variant, spacing, stacked, dense, ...props }) {
|
|
|
76
78
|
}
|
|
77
79
|
function FramePanel({ className, fit, ...props }) {
|
|
78
80
|
return /* @__PURE__ */ jsx("div", {
|
|
79
|
-
className: cn("relative overflow-hidden rounded-(--frame-radius) border border-(--frame-panel-border-color) bg-(--frame-panel-bg) bg-clip-padding shadow-xs", !fit && "grow", "before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--frame-radius)-1px)] before:shadow-black/5", "dark:bg-clip-border dark:before:shadow-white/5", "px-(--frame-panel-px) py-(--frame-panel-py)", className),
|
|
81
|
+
className: cn("relative overflow-hidden rounded-(--frame-panel-radius) border border-(--frame-panel-border-color) bg-(--frame-panel-bg) bg-clip-padding shadow-xs", !fit && "grow", "before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--frame-panel-radius)-1px)] before:shadow-black/5", "dark:bg-clip-border dark:before:shadow-white/5", "px-(--frame-panel-px) py-(--frame-panel-py)", className),
|
|
80
82
|
"data-slot": "frame-panel",
|
|
81
83
|
...props
|
|
82
84
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frame.js","names":[],"sources":["../../../src/components/reui/frame.tsx"],"sourcesContent":["\"use client\";\n\nimport type * as React from \"react\";\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\n\n/**\n * CSS variable architecture for FramePanel theming:\n *\n * The Frame parent sets --frame-panel-bg and --frame-panel-border-color.\n * FramePanel consumes them directly via bg-(--frame-panel-bg) and\n * border-(--frame-panel-border-color). This means:\n *\n * - variant=\"inverse\" overrides those vars on Frame → all panels pick it up\n * - <FramePanel className=\"bg-blue-50\"> adds a direct utility on the element\n * which wins over bg-(--frame-panel-bg) by Tailwind source order — no\n * :not() or !important needed\n */\nconst frameVariants = cva(\n [\n \"relative flex flex-col gap-(--frame-gap) rounded-(--frame-radius) bg-muted/50 px-(--frame-px) py-(--frame-py)\",\n \"[--frame-radius:var(--radius-xl)]\",\n \"[--frame-gap:--spacing(0.75)] [--frame-px:--spacing(0.75)] [--frame-py:--spacing(0.75)]\",\n \"[--frame-panel-footer-gap:--spacing(1)] [--frame-panel-header-gap:0rem]\",\n \"[--frame-panel-footer-px-adjust:0px] [--frame-panel-footer-py-adjust:0px] [--frame-panel-header-px-adjust:0px] [--frame-panel-header-py-adjust:0px] [--frame-panel-px-adjust:0px] [--frame-panel-py-adjust:0px]\",\n \"[--frame-panel-footer-px:calc(var(--frame-panel-footer-px-base)_+_var(--frame-panel-footer-px-adjust))] [--frame-panel-footer-py:calc(var(--frame-panel-footer-py-base)_+_var(--frame-panel-footer-py-adjust))] [--frame-panel-header-px:calc(var(--frame-panel-header-px-base)_+_var(--frame-panel-header-px-adjust))] [--frame-panel-header-py:calc(var(--frame-panel-header-py-base)_+_var(--frame-panel-header-py-adjust))] [--frame-panel-px:calc(var(--frame-panel-px-base)_+_var(--frame-panel-px-adjust))] [--frame-panel-py:calc(var(--frame-panel-py-base)_+_var(--frame-panel-py-adjust))]\",\n \"[--frame-border-color:var(--color-border)] [--frame-panel-bg:var(--color-card)] [--frame-panel-border-color:var(--color-border)]\",\n ],\n {\n variants: {\n variant: {\n default: \"border border-[var(--frame-border-color)] bg-clip-padding\",\n inverse:\n \"border border-[var(--frame-border-color)] bg-background bg-clip-padding [--frame-panel-bg:color-mix(in_oklch,var(--color-muted)_40%,transparent)]\",\n ghost: \"\",\n },\n spacing: {\n xs: \"[--frame-gap:--spacing(0.5)] [--frame-panel-footer-px-base:--spacing(2)] [--frame-panel-footer-py-base:--spacing(1)] [--frame-panel-header-px-base:--spacing(2)] [--frame-panel-header-py-base:--spacing(1)] [--frame-panel-px-base:--spacing(2)] [--frame-panel-py-base:--spacing(2)] [--frame-px:--spacing(0.5)] [--frame-py:--spacing(0.5)]\",\n sm: \"[--frame-gap:--spacing(0.5)] [--frame-panel-footer-px-base:--spacing(3)] [--frame-panel-footer-py-base:--spacing(2.5)] [--frame-panel-header-px-base:--spacing(3)] [--frame-panel-header-py-base:--spacing(2.5)] [--frame-panel-px-base:--spacing(3)] [--frame-panel-py-base:--spacing(3.5)] [--frame-px:--spacing(0.5)] [--frame-py:--spacing(0.5)]\",\n default:\n \"[--frame-panel-footer-px-base:--spacing(4)] [--frame-panel-footer-py-base:--spacing(3)] [--frame-panel-header-px-base:--spacing(4)] [--frame-panel-header-py-base:--spacing(3)] [--frame-panel-px-base:--spacing(4)] [--frame-panel-py-base:--spacing(4)]\",\n lg: \"[--frame-gap:--spacing(1)] [--frame-panel-footer-px-base:--spacing(5)] [--frame-panel-footer-py-base:--spacing(4)] [--frame-panel-header-px-base:--spacing(5)] [--frame-panel-header-py-base:--spacing(4)] [--frame-panel-px-base:--spacing(5)] [--frame-panel-py-base:--spacing(5)] [--frame-px:--spacing(1)] [--frame-py:--spacing(1)]\",\n },\n stacked: {\n true: [\n \"gap-0 *:has-[+[data-slot=frame-panel]]:rounded-b-none\",\n \"*:has-[+[data-slot=frame-panel]]:before:hidden\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:rounded-t-none\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:border-t-0\",\n ],\n false: [\n \"data-[spacing=sm]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-0.5\",\n \"data-[spacing=default]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1\",\n \"data-[spacing=lg]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-2\",\n ],\n },\n dense: {\n true: \"gap-0 border-[var(--frame-border-color)] p-0 [&:not(:has([data-slot=frame-panel-header]))_[data-slot=frame-panel]:is(:first-child)]:-mt-px [&_[data-slot=frame-panel]:last-child]:-mb-px [&_[data-slot=frame-panel]]:-mx-px [&_[data-slot=frame-panel]]:before:hidden\",\n false: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n spacing: \"default\",\n stacked: false,\n dense: false,\n },\n },\n);\n\nfunction Frame({\n className,\n variant,\n spacing,\n stacked,\n dense,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof frameVariants>) {\n return (\n <div\n className={cn(frameVariants({ variant, spacing, stacked, dense }), className)}\n data-slot=\"frame\"\n data-spacing={spacing}\n {...props}\n />\n );\n}\n\nfunction FramePanel({ className, fit, ...props }: React.ComponentProps<\"div\"> & { fit?: boolean }) {\n return (\n <div\n className={cn(\n // bg-(--frame-panel-bg) and border-(--frame-panel-border-color) consume the\n // CSS vars set by the Frame parent. Any explicit bg-* or border-* class passed\n // via className overrides these by Tailwind source order - no ! needed.\n \"relative overflow-hidden rounded-(--frame-radius) border border-(--frame-panel-border-color) bg-(--frame-panel-bg) bg-clip-padding shadow-xs\",\n // `fit` sizes the panel to its content; otherwise it grows to fill the frame.\n !fit && \"grow\",\n \"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--frame-radius)-1px)] before:shadow-black/5\",\n \"dark:bg-clip-border dark:before:shadow-white/5\",\n \"px-(--frame-panel-px) py-(--frame-panel-py)\",\n className,\n )}\n data-slot=\"frame-panel\"\n {...props}\n />\n );\n}\n\nfunction FrameHeader({ className, ...props }: React.ComponentProps<\"header\">) {\n return (\n <header\n className={cn(\n \"flex flex-col gap-(--frame-panel-header-gap) px-(--frame-panel-header-px) py-(--frame-panel-header-py)\",\n className,\n )}\n data-slot=\"frame-panel-header\"\n {...props}\n />\n );\n}\n\nfunction FrameTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\"font-semibold text-sm\", className)}\n data-slot=\"frame-panel-title\"\n {...props}\n />\n );\n}\n\nfunction FrameDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"frame-panel-description\"\n {...props}\n />\n );\n}\n\nfunction FrameFooter({ className, ...props }: React.ComponentProps<\"footer\">) {\n return (\n <footer\n className={cn(\n \"flex flex-col gap-(--frame-panel-footer-gap) px-(--frame-panel-footer-px) py-(--frame-panel-footer-py)\",\n className,\n )}\n data-slot=\"frame-panel-footer\"\n {...props}\n />\n );\n}\n\nexport { Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, frameVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;AAmBA,MAAM,gBAAgB,IACpB;CACE;CACA;CACA;CACA;CACA;CACA;CACA;AACF,GACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,SACE;GACF,OAAO;EACT;EACA,SAAS;GACP,IAAI;GACJ,IAAI;GACJ,SACE;GACF,IAAI;EACN;EACA,SAAS;GACP,MAAM;IACJ;IACA;IACA;IACA;GACF;GACA,OAAO;IACL;IACA;IACA;GACF;EACF;EACA,OAAO;GACL,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB;EACf,SAAS;EACT,SAAS;EACT,SAAS;EACT,OAAO;CACT;AACF,CACF;AAEA,SAAS,MAAM,EACb,WACA,SACA,SACA,SACA,OACA,GAAG,SACgE;CACnE,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,cAAc;GAAE;GAAS;GAAS;GAAS;EAAM,CAAC,GAAG,SAAS;EAC5E,aAAU;EACV,gBAAc;EACd,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,KAAK,GAAG,SAA0D;CACjG,OACE,oBAAC,OAAD;EACE,WAAW,GAIT,gJAEA,CAAC,OAAO,QACR,kIACA,kDACA,+CACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyC;CAC5E,OACE,oBAAC,UAAD;EACE,WAAW,GACT,0GACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,yBAAyB,SAAS;EAChD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAsC;CAC9E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,iCAAiC,SAAS;EACxD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyC;CAC5E,OACE,oBAAC,UAAD;EACE,WAAW,GACT,0GACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL"}
|
|
1
|
+
{"version":3,"file":"frame.js","names":[],"sources":["../../../src/components/reui/frame.tsx"],"sourcesContent":["\"use client\";\n\nimport { cva, type VariantProps } from \"class-variance-authority\";\n\nimport { cn } from \"@kumix/utils\";\n\n/**\n * CSS variable architecture for FramePanel theming:\n *\n * The Frame parent sets --frame-panel-bg and --frame-panel-border-color.\n * FramePanel consumes them directly via bg-(--frame-panel-bg) and\n * border-(--frame-panel-border-color). This means:\n *\n * - variant=\"inverse\" overrides those vars on Frame → all panels pick it up\n * - <FramePanel className=\"bg-blue-50\"> adds a direct utility on the element\n * which wins over bg-(--frame-panel-bg) by Tailwind source order — no\n * :not() or !important needed\n */\nconst frameVariants = cva(\n [\n \"relative flex flex-col gap-(--frame-gap) rounded-(--frame-radius) bg-muted/50 px-(--frame-px) py-(--frame-py)\",\n \"(--radius-xl)] [--frame-radius:var(--radius-xl)]\",\n \"(--radius-none)] (--radius-2xl)] (--radius-lg)] (--radius-none)]\",\n \"[--frame-gap:--spacing(0.75)] [--frame-panel-footer-gap:--spacing(1)] [--frame-panel-header-gap:0rem] [--frame-px:--spacing(0.75)] [--frame-py:--spacing(0.75)]\",\n \"[--frame-panel-footer-px-adjust:0px] [--frame-panel-footer-py-adjust:0px] [--frame-panel-header-px-adjust:0px] [--frame-panel-header-py-adjust:0px] [--frame-panel-px-adjust:0px] [--frame-panel-py-adjust:0px]\",\n \"[--frame-panel-footer-px:calc(var(--frame-panel-footer-px-base)_+_var(--frame-panel-footer-px-adjust))] [--frame-panel-footer-py:calc(var(--frame-panel-footer-py-base)_+_var(--frame-panel-footer-py-adjust))] [--frame-panel-header-px:calc(var(--frame-panel-header-px-base)_+_var(--frame-panel-header-px-adjust))] [--frame-panel-header-py:calc(var(--frame-panel-header-py-base)_+_var(--frame-panel-header-py-adjust))] [--frame-panel-px:calc(var(--frame-panel-px-base)_+_var(--frame-panel-px-adjust))] [--frame-panel-py:calc(var(--frame-panel-py-base)_+_var(--frame-panel-py-adjust))]\",\n \"(1)] (1)] (1.25)] (1.5)] (1.5)] (0.5)] (1)] (1)]\",\n // Default panel token values — overridden per-variant below\n \"[--frame-border-color:var(--color-border)] [--frame-panel-bg:var(--color-card)] [--frame-panel-border-color:var(--color-border)]\",\n // Concentric inner radius: the panel corner nests smoothly inside the frame\n // corner instead of matching it. The panel sits inset from the frame's outer\n // edge by the frame's 1px border + --frame-px padding, so its radius is\n // reduced by that same gap (radius − gap keeps the two arcs parallel). This\n // base value assumes the bordered default/inverse frame; `ghost` drops the\n // 1px border term and `dense` pins it back to the frame radius (its panels\n // are pulled flush to the edge).\n \"[--frame-panel-radius:calc(var(--frame-radius)_-_var(--frame-px)_-_1px)]\",\n ],\n {\n variants: {\n variant: {\n default: \"border border-[var(--frame-border-color)] bg-clip-padding\",\n inverse:\n \"border border-[var(--frame-border-color)] bg-background bg-clip-padding [--frame-panel-bg:color-mix(in_oklch,var(--color-muted)_40%,transparent)]\",\n // No frame border, so the panel is inset by --frame-px padding only.\n ghost: \"[--frame-panel-radius:calc(var(--frame-radius)_-_var(--frame-px))]\",\n },\n // Header/footer vertical rhythm is tighter than the panel body's, and\n // the gap widens as the frame grows: the bars read as chrome rather than\n // as another content block. py ladder is 0.5 / 1.5 / 2 / 2.5 against a\n // body py of 2 / 3.5 / 4 / 5. These vars are style-agnostic - no\n // style-*.css overrides them - so this single ladder drives all shadcn\n // styles. `px` is deliberately left level with the body so header,\n // content and footer stay left-aligned. `xs` holds at 0.5 (2px): it is\n // the practical floor, since anything lower stops reading as padding.\n spacing: {\n xs: \"[--frame-panel-footer-px-base:--spacing(2)] [--frame-panel-footer-py-base:--spacing(0.5)] [--frame-panel-header-px-base:--spacing(2)] [--frame-panel-header-py-base:--spacing(0.5)] [--frame-panel-px-base:--spacing(2)] [--frame-panel-py-base:--spacing(2)]\",\n sm: \"[--frame-panel-footer-px-base:--spacing(3)] [--frame-panel-footer-py-base:--spacing(1.5)] [--frame-panel-header-px-base:--spacing(3)] [--frame-panel-header-py-base:--spacing(1.5)] [--frame-panel-px-base:--spacing(3)] [--frame-panel-py-base:--spacing(3.5)]\",\n default:\n \"[--frame-panel-footer-px-base:--spacing(4)] [--frame-panel-footer-py-base:--spacing(2)] [--frame-panel-header-px-base:--spacing(4)] [--frame-panel-header-py-base:--spacing(2)] [--frame-panel-px-base:--spacing(4)] [--frame-panel-py-base:--spacing(4)]\",\n lg: \"[--frame-panel-footer-px-base:--spacing(5)] [--frame-panel-footer-py-base:--spacing(2.5)] [--frame-panel-header-px-base:--spacing(5)] [--frame-panel-header-py-base:--spacing(2.5)] [--frame-panel-px-base:--spacing(5)] [--frame-panel-py-base:--spacing(5)]\",\n },\n stacked: {\n true: [\n \"gap-0 *:has-[+[data-slot=frame-panel]]:rounded-b-none\",\n \"*:has-[+[data-slot=frame-panel]]:before:hidden\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:rounded-t-none\",\n \"*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:border-t-0\",\n ],\n false: [\n \"data-[spacing=sm]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-0.5\",\n \"data-[spacing=default]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1\",\n \"data-[spacing=lg]:*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-2\",\n ],\n },\n dense: {\n // Positional rules must stay as parent selectors — cannot be expressed via CSS vars.\n // Padding is 0 and panels are pulled flush to the frame edge (-mx-px), so\n // their corners align with the frame radius rather than nesting inside it.\n true: \"gap-0 border-[var(--frame-border-color)] p-0 [--frame-panel-radius:var(--frame-radius)] [&:not(:has([data-slot=frame-panel-header]))_[data-slot=frame-panel]:is(:first-child)]:-mt-px [&_[data-slot=frame-panel]:last-child]:-mb-px [&_[data-slot=frame-panel]]:-mx-px [&_[data-slot=frame-panel]]:before:hidden\",\n false: \"\",\n },\n },\n defaultVariants: {\n variant: \"default\",\n spacing: \"default\",\n stacked: false,\n dense: false,\n },\n },\n);\n\nfunction Frame({\n className,\n variant,\n spacing,\n stacked,\n dense,\n ...props\n}: React.ComponentProps<\"div\"> & VariantProps<typeof frameVariants>) {\n return (\n <div\n className={cn(frameVariants({ variant, spacing, stacked, dense }), className)}\n data-slot=\"frame\"\n data-spacing={spacing}\n {...props}\n />\n );\n}\n\nfunction FramePanel({ className, fit, ...props }: React.ComponentProps<\"div\"> & { fit?: boolean }) {\n return (\n <div\n className={cn(\n // bg-(--frame-panel-bg) and border-(--frame-panel-border-color) consume the\n // CSS vars set by the Frame parent. Any explicit bg-* or border-* class passed\n // via className overrides these by Tailwind source order - no ! needed.\n \"relative overflow-hidden rounded-(--frame-panel-radius) border border-(--frame-panel-border-color) bg-(--frame-panel-bg) bg-clip-padding shadow-xs\",\n // `fit` sizes the panel to its content; otherwise it grows to fill the frame.\n !fit && \"grow\",\n \"before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--frame-panel-radius)-1px)] before:shadow-black/5\",\n \"dark:bg-clip-border dark:before:shadow-white/5\",\n \"px-(--frame-panel-px) py-(--frame-panel-py)\",\n className,\n )}\n data-slot=\"frame-panel\"\n {...props}\n />\n );\n}\n\nfunction FrameHeader({ className, ...props }: React.ComponentProps<\"header\">) {\n return (\n <header\n className={cn(\n \"flex flex-col gap-(--frame-panel-header-gap) px-(--frame-panel-header-px) py-(--frame-panel-header-py)\",\n className,\n )}\n data-slot=\"frame-panel-header\"\n {...props}\n />\n );\n}\n\nfunction FrameTitle({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\"font-semibold text-sm\", className)}\n data-slot=\"frame-panel-title\"\n {...props}\n />\n );\n}\n\nfunction FrameDescription({ className, ...props }: React.ComponentProps<\"div\">) {\n return (\n <div\n className={cn(\"text-muted-foreground text-sm\", className)}\n data-slot=\"frame-panel-description\"\n {...props}\n />\n );\n}\n\nfunction FrameFooter({ className, ...props }: React.ComponentProps<\"footer\">) {\n return (\n <footer\n className={cn(\n \"flex flex-col gap-(--frame-panel-footer-gap) px-(--frame-panel-footer-px) py-(--frame-panel-footer-py)\",\n className,\n )}\n data-slot=\"frame-panel-footer\"\n {...props}\n />\n );\n}\n\nexport { Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle, frameVariants };\n"],"mappings":";;;;;;;;;;;;;;;;;AAkBA,MAAM,gBAAgB,IACpB;CACE;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CAQA;AACF,GACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;GACT,SACE;GAEF,OAAO;EACT;EASA,SAAS;GACP,IAAI;GACJ,IAAI;GACJ,SACE;GACF,IAAI;EACN;EACA,SAAS;GACP,MAAM;IACJ;IACA;IACA;IACA;GACF;GACA,OAAO;IACL;IACA;IACA;GACF;EACF;EACA,OAAO;GAIL,MAAM;GACN,OAAO;EACT;CACF;CACA,iBAAiB;EACf,SAAS;EACT,SAAS;EACT,SAAS;EACT,OAAO;CACT;AACF,CACF;AAEA,SAAS,MAAM,EACb,WACA,SACA,SACA,SACA,OACA,GAAG,SACgE;CACnE,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,cAAc;GAAE;GAAS;GAAS;GAAS;EAAM,CAAC,GAAG,SAAS;EAC5E,aAAU;EACV,gBAAc;EACd,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,KAAK,GAAG,SAA0D;CACjG,OACE,oBAAC,OAAD;EACE,WAAW,GAIT,sJAEA,CAAC,OAAO,QACR,wIACA,kDACA,+CACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyC;CAC5E,OACE,oBAAC,UAAD;EACE,WAAW,GACT,0GACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,WAAW,EAAE,WAAW,GAAG,SAAsC;CACxE,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,yBAAyB,SAAS;EAChD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,iBAAiB,EAAE,WAAW,GAAG,SAAsC;CAC9E,OACE,oBAAC,OAAD;EACE,WAAW,GAAG,iCAAiC,SAAS;EACxD,aAAU;EACV,GAAI;CACL,CAAA;AAEL;AAEA,SAAS,YAAY,EAAE,WAAW,GAAG,SAAyC;CAC5E,OACE,oBAAC,UAAD;EACE,WAAW,GACT,0GACA,SACF;EACA,aAAU;EACV,GAAI;CACL,CAAA;AAEL"}
|
|
@@ -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;;;;
|
|
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"}
|
|
@@ -67,7 +67,8 @@ function makeDefaultGanttFunctions(cfg) {
|
|
|
67
67
|
return `${format(start, "MMM d, yyyy", opts)} - ${format(last, "MMM d, yyyy", opts)}`;
|
|
68
68
|
}
|
|
69
69
|
const fmt = cfg.formats.eventTime;
|
|
70
|
-
|
|
70
|
+
const lastInstant = end.getTime() - 1 >= start.getTime() ? subMilliseconds(end, 1) : start;
|
|
71
|
+
if (format(start, "yyyy-MM-dd") !== format(lastInstant, "yyyy-MM-dd")) return `${format(start, `MMM d, ${fmt}`, opts)} - ${format(end, `MMM d, ${fmt}`, opts)}`;
|
|
71
72
|
return `${format(start, fmt, opts)} - ${format(end, fmt, opts)}`;
|
|
72
73
|
},
|
|
73
74
|
formatDayRange: (range, locale) => {
|
|
@@ -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\n if (end.getTime() - start.getTime() > 24 * 60 * 60 * 1000) {\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,MAA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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 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, GanttI18n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;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"}
|
|
@@ -231,9 +231,11 @@ function buildEventIndex(events, visibleRange, opts) {
|
|
|
231
231
|
}
|
|
232
232
|
const occurrences = [];
|
|
233
233
|
for (const event of events) {
|
|
234
|
+
const replaced = overrideTimes.get(event.id);
|
|
234
235
|
const custom = opts.getOccurrences?.(event, visibleRange, { timeZone });
|
|
235
236
|
if (custom) {
|
|
236
237
|
custom.forEach((occ, i) => {
|
|
238
|
+
if (replaced?.has(occ.start.getTime())) return;
|
|
237
239
|
if (!rangesIntersect({
|
|
238
240
|
start: occ.start,
|
|
239
241
|
end: occ.end
|
|
@@ -251,7 +253,6 @@ function buildEventIndex(events, visibleRange, opts) {
|
|
|
251
253
|
});
|
|
252
254
|
continue;
|
|
253
255
|
}
|
|
254
|
-
const replaced = overrideTimes.get(event.id);
|
|
255
256
|
const expanded = expandRecurrence(event, visibleRange, { timeZone });
|
|
256
257
|
occurrences.push(...replaced ? expanded.filter((occ) => !replaced.has(occ.start.getTime())) : expanded);
|
|
257
258
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gantt-lib.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-lib.tsx"],"sourcesContent":["\"use client\";\n\nimport { TZDate } from \"@date-fns/tz\";\nimport {\n addDays,\n addMonths,\n addWeeks,\n addYears,\n differenceInMinutes,\n format,\n startOfDay,\n startOfMonth,\n startOfQuarter,\n startOfWeek,\n startOfYear,\n} from \"date-fns\";\n\nimport { expandRecurrence } from \"./gantt-recurrence\";\nimport type {\n GanttDateRange,\n GanttEvent,\n GanttOccurrence,\n GanttOffDaysConfig,\n GanttResource,\n GanttScale,\n GanttSegment,\n} from \"./gantt-types\";\n\ntype WeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Packing-effective minimum in minutes so tiny events do not stack invisibly.\n * It is a packing FOOTPRINT, not a render size: two schedules less than this\n * apart are treated as concurrent and split into separate lanes even though\n * their real ranges do not touch.\n */\nconst MIN_PACK_SLOT = 30;\n\n/** The instant re-expressed in the display time zone (TZDate extends Date). */\nfunction toZoned(date: Date, timeZone: string): TZDate {\n return new TZDate(date.getTime(), timeZone);\n}\n\n/** Zoned midnight of the day containing the instant. */\nfunction zonedStartOfDay(date: Date, timeZone: string): TZDate {\n return startOfDay(toZoned(date, timeZone));\n}\n\n/** Stable per-day key in the display time zone. */\nfunction getDayKey(date: Date, timeZone: string): string {\n return format(toZoned(date, timeZone), \"yyyy-MM-dd\");\n}\n\n/** Day length in minutes; 1380/1500 on DST transition days - never assume 1440. */\nfunction getDayTotalMinutes(dayStart: Date, timeZone: string): number {\n const next = zonedStartOfDay(addDays(toZoned(dayStart, timeZone), 1), timeZone);\n return differenceInMinutes(next, dayStart);\n}\n\nfunction snapMinutes(minutes: number, snap: number): number {\n return Math.round(minutes / snap) * snap;\n}\n\ninterface ViewRangeOptions {\n timeZone: string;\n weekStartsOn: WeekStartsOn;\n}\n\ninterface ViewDateRanges {\n visibleRange: GanttDateRange;\n activeRange: GanttDateRange;\n}\n\n/** Axis range for the anchor date at the given scale. */\nfunction getGanttDateRange(scale: GanttScale, date: Date, opts: ViewRangeOptions): ViewDateRanges {\n const { timeZone, weekStartsOn } = opts;\n const zoned = toZoned(date, timeZone);\n\n if (scale === \"week\") {\n const start = startOfWeek(zoned, { weekStartsOn });\n const range = { start, end: addWeeks(start, 1) };\n return { activeRange: range, visibleRange: range };\n }\n if (scale === \"month\") {\n // exact month: no outside days on the horizontal axis\n const start = startOfMonth(zoned);\n const range = { start, end: startOfMonth(addMonths(zoned, 1)) };\n return { activeRange: range, visibleRange: range };\n }\n if (scale === \"quarter\") {\n // week-aligned so the axis partitions into uniform week units\n const quarterStart = startOfQuarter(zoned);\n const quarterEnd = startOfQuarter(addMonths(zoned, 3));\n const start = startOfWeek(quarterStart, { weekStartsOn });\n let end = startOfWeek(quarterEnd, { weekStartsOn });\n if (end < quarterEnd) end = addWeeks(end, 1);\n return {\n activeRange: { start: quarterStart, end: quarterEnd },\n visibleRange: { start, end },\n };\n }\n if (scale === \"year\") {\n const start = startOfYear(zoned);\n const range = { start, end: startOfYear(addYears(zoned, 1)) };\n return { activeRange: range, visibleRange: range };\n }\n const start = startOfDay(zoned);\n const range = { start, end: addDays(start, 1) };\n return { activeRange: range, visibleRange: range };\n}\n\n/** The anchor date stepped one period forward or backward for the scale. */\nfunction stepGanttDate(\n scale: GanttScale,\n date: Date,\n direction: 1 | -1,\n opts: Pick<ViewRangeOptions, \"timeZone\">,\n): Date {\n const zoned = toZoned(date, opts.timeZone);\n if (scale === \"week\") return addWeeks(zoned, direction);\n if (scale === \"month\") return addMonths(zoned, direction);\n if (scale === \"quarter\") return addMonths(zoned, direction * 3);\n if (scale === \"year\") return addYears(zoned, direction);\n return addDays(zoned, direction);\n}\n\nfunction rangesIntersect(a: GanttDateRange, b: GanttDateRange): boolean {\n return a.start < b.end && a.end > b.start;\n}\n\nfunction eventsOverlap(a: { start: Date; end: Date }, b: { start: Date; end: Date }): boolean {\n return a.start < b.end && a.end > b.start;\n}\n\nfunction spansMultipleDays(occ: { start: Date; end: Date }): boolean {\n // An event ending exactly at the next midnight is still single-day\n // (exclusive end), so compare against a strictly-later instant.\n return occ.end.getTime() - occ.start.getTime() > 24 * 60 * 60 * 1000;\n}\n\n/**\n * Identity of a schedule ACROSS time edits. `occurrence.key` embeds the start\n * instant, so it changes the moment a schedule is moved or start-resized -\n * useless as lane memory. This key survives the edit: the event id plus, for a\n * recurring series, the occurrence's position in it.\n */\nfunction getLaneKey(occurrence: { eventId: string; recurrenceIndex?: number }): string {\n return `${occurrence.eventId}::${occurrence.recurrenceIndex ?? 0}`;\n}\n\n/**\n * What one schedule held on the previous layout pass. The TIMES are what make\n * this more than a lane number: they are how the packer tells the schedule the\n * user just edited apart from the ones that merely sat still.\n */\ninterface GanttLaneMemo {\n lane: number;\n startMs: number;\n endMs: number;\n}\n\ninterface PackOptions {\n /**\n * Where each schedule sat on the previous pass, by getLaneKey.\n *\n * A schedule whose times are UNCHANGED keeps its lane if that lane is still\n * free, so editing one schedule never re-indexes the ones around it. A\n * schedule whose times CHANGED - the one the user just dragged or resized -\n * deliberately forfeits its pin and re-seeks the lowest free lane. That is\n * what makes the arrangement live rather than frozen: a schedule dragged\n * onto its neighbours stacks DOWN into the first free lane, and one dragged\n * clear of them comes back UP inline. Only the edited schedule moves.\n */\n preferredLanes?: Map<string, GanttLaneMemo>;\n /** \"single\" collapses the row to one track; see GanttScheduleMode. */\n mode?: \"single\" | \"multiple\";\n}\n\n/**\n * Overlap packing for one row's timed segments.\n * Mutates column/columnCount/columnSpan on the segments, in place.\n * z resolution happens at render: event.zIndex verbatim, else 10 + column.\n */\nfunction packTimedSegments<TData>(\n segments: GanttSegment<TData>[],\n options: PackOptions = {},\n): void {\n if (segments.length === 0) return;\n\n if (options.mode === \"single\") {\n // one track: every schedule shares lane 0 and the row never grows\n for (const seg of segments) {\n seg.column = 0;\n seg.columnCount = 1;\n seg.columnSpan = 1;\n }\n return;\n }\n\n const preferredLanes = options.preferredLanes;\n\n type Working = {\n seg: GanttSegment<TData>;\n startMin: number;\n effEnd: number;\n lane: number;\n /** The occupancy entry this item added, so a settle can take it back. */\n interval?: { from: number; to: number };\n };\n\n const items: Working[] = segments\n .map((seg) => {\n const startMin = seg.startMin ?? 0;\n const endMin = seg.endMin ?? startMin;\n return {\n seg,\n startMin,\n effEnd: Math.max(endMin, startMin + MIN_PACK_SLOT),\n lane: -1,\n };\n })\n .sort(\n (a, b) =>\n a.startMin - b.startMin ||\n b.effEnd - b.startMin - (a.effEnd - a.startMin) ||\n a.seg.occurrence.key.localeCompare(b.seg.occurrence.key),\n );\n\n // Sweep into connected clusters\n const clusters: Working[][] = [];\n let current: Working[] = [];\n let clusterEnd = -Infinity;\n for (const item of items) {\n if (item.startMin >= clusterEnd) {\n current = [];\n clusters.push(current);\n clusterEnd = -Infinity;\n }\n current.push(item);\n clusterEnd = Math.max(clusterEnd, item.effEnd);\n }\n\n for (const cluster of clusters) {\n // Per-lane occupancy INTERVALS, not a single running end: pass 1 claims\n // remembered lanes out of time order, so a lane can be free before an\n // occupant and busy after it.\n const laneIntervals: Array<Array<{ from: number; to: number }>> = [];\n const isFree = (lane: number, item: Working) =>\n !(laneIntervals[lane] ?? []).some((iv) => iv.from < item.effEnd && iv.to > item.startMin);\n const claim = (lane: number, item: Working) => {\n while (laneIntervals.length <= lane) laneIntervals.push([]);\n const interval = { from: item.startMin, to: item.effEnd };\n laneIntervals[lane].push(interval);\n item.lane = lane;\n item.interval = interval;\n };\n const release = (item: Working) => {\n const occupants = laneIntervals[item.lane] ?? [];\n const at = occupants.indexOf(item.interval!);\n if (at >= 0) occupants.splice(at, 1);\n };\n\n // pass 1: schedules that did not move keep the lane they had. The one the\n // user just edited is NOT pinned - its times differ from the memo, so it\n // falls through to pass 2 and re-seeks a lane against its new span.\n const pending: Working[] = [];\n for (const item of cluster) {\n const memo = preferredLanes?.get(getLaneKey(item.seg.occurrence));\n const untouched =\n memo !== undefined &&\n memo.startMs === item.seg.occurrence.start.getTime() &&\n memo.endMs === item.seg.occurrence.end.getTime();\n if (untouched && memo.lane >= 0 && isFree(memo.lane, item)) {\n claim(memo.lane, item);\n } else {\n pending.push(item);\n }\n }\n // pass 2: the rest take the lowest free lane - overlapping goes DOWN into\n // the first lane with room, fitting comes back UP to lane 0\n for (const item of pending) {\n let lane = 0;\n while (!isFree(lane, item)) lane++;\n claim(lane, item);\n }\n\n // pass 3: nothing floats above an empty lane. A pin only survives while\n // something above it still needs the space - once the schedule that was\n // there moves away or is deleted, its neighbour settles down into the\n // gap. Without this a row keeps a permanently blank top lane and never\n // shrinks back. Settling in lane order, and only ever DOWNWARD into space\n // that is genuinely free, means two schedules can never trade places -\n // so an edit still moves at most the schedule it touched.\n const byLane = [...cluster].sort((a, b) => a.lane - b.lane || a.startMin - b.startMin);\n for (const item of byLane) {\n if (item.lane === 0) continue;\n let lane = 0;\n while (lane < item.lane && !isFree(lane, item)) lane++;\n if (lane < item.lane) {\n release(item);\n claim(lane, item);\n }\n }\n }\n\n // Lane memory can leave holes (the schedule that held lane 0 was deleted or\n // moved away). Collapse the row's USED lanes onto 0..n-1: relative stacking\n // order survives, so nothing reshuffles, but the row cannot creep taller\n // than the lanes it actually needs.\n const used = [...new Set(items.map((item) => item.lane))].sort((a, b) => a - b);\n const compacted = new Map(used.map((lane, index) => [lane, index]));\n const columnCount = used.length;\n for (const item of items) {\n item.lane = compacted.get(item.lane) ?? 0;\n item.seg.column = item.lane;\n item.seg.columnCount = columnCount;\n }\n\n // Partial-overlap expansion: widen rightward into free lanes\n for (const cluster of clusters) {\n for (const item of cluster) {\n let span = 1;\n while (item.lane + span < columnCount) {\n const blocked = cluster.some(\n (other) =>\n other !== item &&\n other.lane === item.lane + span &&\n other.startMin < item.effEnd &&\n other.effEnd > item.startMin,\n );\n if (blocked) break;\n span++;\n }\n item.seg.columnSpan = span;\n }\n }\n}\n\nfunction defaultEventOrder(a: GanttOccurrence, b: GanttOccurrence): number {\n return (\n a.start.getTime() - b.start.getTime() ||\n b.end.getTime() - b.start.getTime() - (a.end.getTime() - a.start.getTime()) ||\n a.key.localeCompare(b.key)\n );\n}\n\ninterface BuildIndexOptions<TData = unknown> {\n timeZone: string;\n /** Escape hatch for exotic recurrence: return the expanded occurrences. */\n getOccurrences?: (\n event: GanttEvent<TData>,\n range: GanttDateRange,\n ctx: { timeZone: string },\n ) => Array<{ start: Date; end: Date }> | null | undefined;\n eventOrder?: (a: GanttOccurrence<TData>, b: GanttOccurrence<TData>) => number;\n}\n\ninterface GanttIndex<TData = unknown> {\n occurrences: GanttOccurrence<TData>[];\n}\n\nfunction buildEventIndex<TData>(\n events: GanttEvent<TData>[],\n visibleRange: GanttDateRange,\n opts: BuildIndexOptions<TData>,\n): GanttIndex<TData> {\n const { timeZone } = opts;\n const order = opts.eventOrder ?? defaultEventOrder;\n\n // RECURRENCE-ID override replacement: an event carrying recurringEventId +\n // originalStart is an edited single occurrence of that series. The parent's\n // expansion drops the replaced instant; the override renders as its own\n // occurrence through the normal path below.\n const overrideTimes = new Map<string, Set<number>>();\n for (const event of events) {\n if (!event.recurringEventId || !event.originalStart) continue;\n let times = overrideTimes.get(event.recurringEventId);\n if (!times) {\n times = new Set();\n overrideTimes.set(event.recurringEventId, times);\n }\n times.add(event.originalStart.getTime());\n }\n\n const occurrences: GanttOccurrence<TData>[] = [];\n for (const event of events) {\n const custom = opts.getOccurrences?.(event, visibleRange, { timeZone });\n if (custom) {\n custom.forEach((occ, i) => {\n if (!rangesIntersect({ start: occ.start, end: occ.end }, visibleRange)) return;\n occurrences.push({\n key: `${event.id}::${occ.start.toISOString()}`,\n eventId: event.id,\n event,\n start: occ.start,\n end: occ.end,\n allDay: event.allDay ?? false,\n isRecurring: true,\n recurrenceIndex: i,\n });\n });\n continue;\n }\n const replaced = overrideTimes.get(event.id);\n const expanded = expandRecurrence(event, visibleRange, { timeZone });\n occurrences.push(\n ...(replaced ? expanded.filter((occ) => !replaced.has(occ.start.getTime())) : expanded),\n );\n }\n occurrences.sort(order);\n return { occurrences };\n}\n\n/** Cache key for index memoization; cheap string compare. */\nfunction getRangeKey(range: GanttDateRange): string {\n return `${range.start.getTime()}-${range.end.getTime()}`;\n}\n\n/** Depth-first flatten of the resource tree (parents included). */\nfunction flattenResources(\n resources: GanttResource[],\n depth = 0,\n): Array<{ resource: GanttResource; depth: number }> {\n const rows: Array<{ resource: GanttResource; depth: number }> = [];\n for (const resource of resources) {\n rows.push({ resource, depth });\n if (resource.children?.length) {\n rows.push(...flattenResources(resource.children, depth + 1));\n }\n }\n return rows;\n}\n\n/** Depth-first lookup of one node in the tree. */\nfunction findResource(resources: GanttResource[], id: string): GanttResource | null {\n for (const resource of resources) {\n if (resource.id === id) return resource;\n const found = resource.children?.length ? findResource(resource.children, id) : null;\n if (found) return found;\n }\n return null;\n}\n\n/**\n * Pure tree move: removes `resourceId` from wherever it sits and reinserts it\n * under `parentId` (null = root) at `index`. Returns a new tree; the original\n * is untouched. Returns null for impossible moves (unknown ids, or dropping a\n * node into its own subtree).\n */\nfunction reorderResources(\n resources: GanttResource[],\n resourceId: string,\n parentId: string | null,\n index: number,\n): GanttResource[] | null {\n let moved: GanttResource | null = null;\n\n const strip = (nodes: GanttResource[]): GanttResource[] =>\n nodes.flatMap((node) => {\n if (node.id === resourceId) {\n moved = node;\n return [];\n }\n if (!node.children?.length) return [node];\n return [{ ...node, children: strip(node.children) }];\n });\n\n const stripped = strip(resources);\n if (!moved) return null;\n\n const contains = (node: GanttResource, id: string): boolean =>\n node.id === id || !!node.children?.some((child) => contains(child, id));\n if (parentId !== null && contains(moved, parentId)) return null;\n\n const insert = (nodes: GanttResource[]): GanttResource[] => {\n if (parentId === null) {\n const next = [...nodes];\n next.splice(Math.min(Math.max(index, 0), next.length), 0, moved!);\n return next;\n }\n return nodes.map((node) => {\n if (node.id === parentId) {\n const children = [...(node.children ?? [])];\n children.splice(Math.min(Math.max(index, 0), children.length), 0, moved!);\n return { ...node, children };\n }\n if (!node.children?.length) return node;\n return { ...node, children: insert(node.children) };\n });\n };\n\n const next = insert(stripped);\n // unknown parentId: the node vanished - reject\n if (parentId !== null) {\n const flat = flattenResources(next);\n if (!flat.some(({ resource }) => resource.id === resourceId)) return null;\n }\n return next;\n}\n\nconst DEFAULT_WEEKEND_DAYS = [0, 6];\n\n/** Resolves whether a day is an off day (non-working) in the display zone. */\nfunction resolveOffDay(\n day: Date,\n timeZone: string,\n config: boolean | GanttOffDaysConfig | undefined,\n): boolean {\n if (!config) return false;\n const resolved: GanttOffDaysConfig = config === true ? {} : config;\n const weekendDays = resolved.weekendDays ?? DEFAULT_WEEKEND_DAYS;\n const zoned = toZoned(day, timeZone);\n if (weekendDays.includes(zoned.getDay())) return true;\n if (resolved.dates?.length) {\n const key = getDayKey(day, timeZone);\n if (resolved.dates.some((date) => getDayKey(date, timeZone) === key)) {\n return true;\n }\n }\n return resolved.isOffDay?.(day) ?? false;\n}\n\nexport type {\n BuildIndexOptions,\n GanttIndex,\n GanttLaneMemo,\n PackOptions,\n ViewDateRanges,\n ViewRangeOptions,\n WeekStartsOn,\n};\nexport {\n buildEventIndex,\n defaultEventOrder,\n eventsOverlap,\n findResource,\n flattenResources,\n getDayKey,\n getDayTotalMinutes,\n getGanttDateRange,\n getLaneKey,\n getRangeKey,\n MIN_PACK_SLOT,\n packTimedSegments,\n rangesIntersect,\n reorderResources,\n resolveOffDay,\n snapMinutes,\n spansMultipleDays,\n stepGanttDate,\n toZoned,\n zonedStartOfDay,\n};\n"],"mappings":";;;;;;;;;;;AAoCA,MAAM,gBAAgB;;AAGtB,SAAS,QAAQ,MAAY,UAA0B;CACrD,OAAO,IAAI,OAAO,KAAK,QAAQ,GAAG,QAAQ;AAC5C;;AAGA,SAAS,gBAAgB,MAAY,UAA0B;CAC7D,OAAO,WAAW,QAAQ,MAAM,QAAQ,CAAC;AAC3C;;AAGA,SAAS,UAAU,MAAY,UAA0B;CACvD,OAAO,OAAO,QAAQ,MAAM,QAAQ,GAAG,YAAY;AACrD;;AAGA,SAAS,mBAAmB,UAAgB,UAA0B;CAEpE,OAAO,oBADM,gBAAgB,QAAQ,QAAQ,UAAU,QAAQ,GAAG,CAAC,GAAG,QACxC,GAAG,QAAQ;AAC3C;AAEA,SAAS,YAAY,SAAiB,MAAsB;CAC1D,OAAO,KAAK,MAAM,UAAU,IAAI,IAAI;A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AAM;GAChE,OAAO;EACT;EACA,OAAO,MAAM,KAAK,SAAS;GACzB,IAAI,KAAK,OAAO,UAAU;IACxB,MAAM,WAAW,CAAC,GAAI,KAAK,YAAY,CAAC,CAAE;IAC1C,SAAS,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,SAAS,MAAM,GAAG,GAAG,KAAM;IACxE,OAAO;KAAE,GAAG;KAAM;IAAS;GAC7B;GACA,IAAI,CAAC,KAAK,UAAU,QAAQ,OAAO;GACnC,OAAO;IAAE,GAAG;IAAM,UAAU,OAAO,KAAK,QAAQ;GAAE;EACpD,CAAC;CACH;CAEA,MAAM,OAAO,OAAO,QAAQ;CAE5B,IAAI,aAAa,MAEX;MAAA,CADS,iBAAiB,IACtB,CAAC,CAAC,MAAM,EAAE,eAAe,SAAS,OAAO,UAAU,GAAG,OAAO;CAAA;CAEvE,OAAO;AACT;AAEA,MAAM,uBAAuB,CAAC,GAAG,CAAC;;AAGlC,SAAS,cACP,KACA,UACA,QACS;CACT,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,WAA+B,WAAW,OAAO,CAAC,IAAI;CAC5D,MAAM,cAAc,SAAS,eAAe;CAC5C,MAAM,QAAQ,QAAQ,KAAK,QAAQ;CACnC,IAAI,YAAY,SAAS,MAAM,OAAO,CAAC,GAAG,OAAO;CACjD,IAAI,SAAS,OAAO,QAAQ;EAC1B,MAAM,MAAM,UAAU,KAAK,QAAQ;EACnC,IAAI,SAAS,MAAM,MAAM,SAAS,UAAU,MAAM,QAAQ,MAAM,GAAG,GACjE,OAAO;CAEX;CACA,OAAO,SAAS,WAAW,GAAG,KAAK;AACrC"}
|
|
1
|
+
{"version":3,"file":"gantt-lib.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-lib.tsx"],"sourcesContent":["\"use client\";\n\nimport { TZDate } from \"@date-fns/tz\";\nimport {\n addDays,\n addMonths,\n addWeeks,\n addYears,\n differenceInMinutes,\n format,\n startOfDay,\n startOfMonth,\n startOfQuarter,\n startOfWeek,\n startOfYear,\n} from \"date-fns\";\n\nimport { expandRecurrence } from \"./gantt-recurrence\";\nimport type {\n GanttDateRange,\n GanttEvent,\n GanttOccurrence,\n GanttOffDaysConfig,\n GanttResource,\n GanttScale,\n GanttSegment,\n} from \"./gantt-types\";\n\ntype WeekStartsOn = 0 | 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * Packing-effective minimum in minutes so tiny events do not stack invisibly.\n * It is a packing FOOTPRINT, not a render size: two schedules less than this\n * apart are treated as concurrent and split into separate lanes even though\n * their real ranges do not touch.\n */\nconst MIN_PACK_SLOT = 30;\n\n/** The instant re-expressed in the display time zone (TZDate extends Date). */\nfunction toZoned(date: Date, timeZone: string): TZDate {\n return new TZDate(date.getTime(), timeZone);\n}\n\n/** Zoned midnight of the day containing the instant. */\nfunction zonedStartOfDay(date: Date, timeZone: string): TZDate {\n return startOfDay(toZoned(date, timeZone));\n}\n\n/** Stable per-day key in the display time zone. */\nfunction getDayKey(date: Date, timeZone: string): string {\n return format(toZoned(date, timeZone), \"yyyy-MM-dd\");\n}\n\n/** Day length in minutes; 1380/1500 on DST transition days - never assume 1440. */\nfunction getDayTotalMinutes(dayStart: Date, timeZone: string): number {\n const next = zonedStartOfDay(addDays(toZoned(dayStart, timeZone), 1), timeZone);\n return differenceInMinutes(next, dayStart);\n}\n\nfunction snapMinutes(minutes: number, snap: number): number {\n return Math.round(minutes / snap) * snap;\n}\n\ninterface ViewRangeOptions {\n timeZone: string;\n weekStartsOn: WeekStartsOn;\n}\n\ninterface ViewDateRanges {\n visibleRange: GanttDateRange;\n activeRange: GanttDateRange;\n}\n\n/** Axis range for the anchor date at the given scale. */\nfunction getGanttDateRange(scale: GanttScale, date: Date, opts: ViewRangeOptions): ViewDateRanges {\n const { timeZone, weekStartsOn } = opts;\n const zoned = toZoned(date, timeZone);\n\n if (scale === \"week\") {\n const start = startOfWeek(zoned, { weekStartsOn });\n const range = { start, end: addWeeks(start, 1) };\n return { activeRange: range, visibleRange: range };\n }\n if (scale === \"month\") {\n // exact month: no outside days on the horizontal axis\n const start = startOfMonth(zoned);\n const range = { start, end: startOfMonth(addMonths(zoned, 1)) };\n return { activeRange: range, visibleRange: range };\n }\n if (scale === \"quarter\") {\n // week-aligned so the axis partitions into uniform week units\n const quarterStart = startOfQuarter(zoned);\n const quarterEnd = startOfQuarter(addMonths(zoned, 3));\n const start = startOfWeek(quarterStart, { weekStartsOn });\n let end = startOfWeek(quarterEnd, { weekStartsOn });\n if (end < quarterEnd) end = addWeeks(end, 1);\n return {\n activeRange: { start: quarterStart, end: quarterEnd },\n visibleRange: { start, end },\n };\n }\n if (scale === \"year\") {\n const start = startOfYear(zoned);\n const range = { start, end: startOfYear(addYears(zoned, 1)) };\n return { activeRange: range, visibleRange: range };\n }\n const start = startOfDay(zoned);\n const range = { start, end: addDays(start, 1) };\n return { activeRange: range, visibleRange: range };\n}\n\n/** The anchor date stepped one period forward or backward for the scale. */\nfunction stepGanttDate(\n scale: GanttScale,\n date: Date,\n direction: 1 | -1,\n opts: Pick<ViewRangeOptions, \"timeZone\">,\n): Date {\n const zoned = toZoned(date, opts.timeZone);\n if (scale === \"week\") return addWeeks(zoned, direction);\n if (scale === \"month\") return addMonths(zoned, direction);\n if (scale === \"quarter\") return addMonths(zoned, direction * 3);\n if (scale === \"year\") return addYears(zoned, direction);\n return addDays(zoned, direction);\n}\n\nfunction rangesIntersect(a: GanttDateRange, b: GanttDateRange): boolean {\n return a.start < b.end && a.end > b.start;\n}\n\nfunction eventsOverlap(a: { start: Date; end: Date }, b: { start: Date; end: Date }): boolean {\n return a.start < b.end && a.end > b.start;\n}\n\nfunction spansMultipleDays(occ: { start: Date; end: Date }): boolean {\n // An event ending exactly at the next midnight is still single-day\n // (exclusive end), so compare against a strictly-later instant.\n return occ.end.getTime() - occ.start.getTime() > 24 * 60 * 60 * 1000;\n}\n\n/**\n * Identity of a schedule ACROSS time edits. `occurrence.key` embeds the start\n * instant, so it changes the moment a schedule is moved or start-resized -\n * useless as lane memory. This key survives the edit: the event id plus, for a\n * recurring series, the occurrence's position in it.\n */\nfunction getLaneKey(occurrence: { eventId: string; recurrenceIndex?: number }): string {\n return `${occurrence.eventId}::${occurrence.recurrenceIndex ?? 0}`;\n}\n\n/**\n * What one schedule held on the previous layout pass. The TIMES are what make\n * this more than a lane number: they are how the packer tells the schedule the\n * user just edited apart from the ones that merely sat still.\n */\ninterface GanttLaneMemo {\n lane: number;\n startMs: number;\n endMs: number;\n}\n\ninterface PackOptions {\n /**\n * Where each schedule sat on the previous pass, by getLaneKey.\n *\n * A schedule whose times are UNCHANGED keeps its lane if that lane is still\n * free, so editing one schedule never re-indexes the ones around it. A\n * schedule whose times CHANGED - the one the user just dragged or resized -\n * deliberately forfeits its pin and re-seeks the lowest free lane. That is\n * what makes the arrangement live rather than frozen: a schedule dragged\n * onto its neighbours stacks DOWN into the first free lane, and one dragged\n * clear of them comes back UP inline. Only the edited schedule moves.\n */\n preferredLanes?: Map<string, GanttLaneMemo>;\n /** \"single\" collapses the row to one track; see GanttScheduleMode. */\n mode?: \"single\" | \"multiple\";\n}\n\n/**\n * Overlap packing for one row's timed segments.\n * Mutates column/columnCount/columnSpan on the segments, in place.\n * z resolution happens at render: event.zIndex verbatim, else 10 + column.\n */\nfunction packTimedSegments<TData>(\n segments: GanttSegment<TData>[],\n options: PackOptions = {},\n): void {\n if (segments.length === 0) return;\n\n if (options.mode === \"single\") {\n // one track: every schedule shares lane 0 and the row never grows\n for (const seg of segments) {\n seg.column = 0;\n seg.columnCount = 1;\n seg.columnSpan = 1;\n }\n return;\n }\n\n const preferredLanes = options.preferredLanes;\n\n type Working = {\n seg: GanttSegment<TData>;\n startMin: number;\n effEnd: number;\n lane: number;\n /** The occupancy entry this item added, so a settle can take it back. */\n interval?: { from: number; to: number };\n };\n\n const items: Working[] = segments\n .map((seg) => {\n const startMin = seg.startMin ?? 0;\n const endMin = seg.endMin ?? startMin;\n return {\n seg,\n startMin,\n effEnd: Math.max(endMin, startMin + MIN_PACK_SLOT),\n lane: -1,\n };\n })\n .sort(\n (a, b) =>\n a.startMin - b.startMin ||\n b.effEnd - b.startMin - (a.effEnd - a.startMin) ||\n a.seg.occurrence.key.localeCompare(b.seg.occurrence.key),\n );\n\n // Sweep into connected clusters\n const clusters: Working[][] = [];\n let current: Working[] = [];\n let clusterEnd = -Infinity;\n for (const item of items) {\n if (item.startMin >= clusterEnd) {\n current = [];\n clusters.push(current);\n clusterEnd = -Infinity;\n }\n current.push(item);\n clusterEnd = Math.max(clusterEnd, item.effEnd);\n }\n\n for (const cluster of clusters) {\n // Per-lane occupancy INTERVALS, not a single running end: pass 1 claims\n // remembered lanes out of time order, so a lane can be free before an\n // occupant and busy after it.\n const laneIntervals: Array<Array<{ from: number; to: number }>> = [];\n const isFree = (lane: number, item: Working) =>\n !(laneIntervals[lane] ?? []).some((iv) => iv.from < item.effEnd && iv.to > item.startMin);\n const claim = (lane: number, item: Working) => {\n while (laneIntervals.length <= lane) laneIntervals.push([]);\n const interval = { from: item.startMin, to: item.effEnd };\n laneIntervals[lane].push(interval);\n item.lane = lane;\n item.interval = interval;\n };\n const release = (item: Working) => {\n const occupants = laneIntervals[item.lane] ?? [];\n const at = occupants.indexOf(item.interval!);\n if (at >= 0) occupants.splice(at, 1);\n };\n\n // pass 1: schedules that did not move keep the lane they had. The one the\n // user just edited is NOT pinned - its times differ from the memo, so it\n // falls through to pass 2 and re-seeks a lane against its new span.\n const pending: Working[] = [];\n for (const item of cluster) {\n const memo = preferredLanes?.get(getLaneKey(item.seg.occurrence));\n const untouched =\n memo !== undefined &&\n memo.startMs === item.seg.occurrence.start.getTime() &&\n memo.endMs === item.seg.occurrence.end.getTime();\n if (untouched && memo.lane >= 0 && isFree(memo.lane, item)) {\n claim(memo.lane, item);\n } else {\n pending.push(item);\n }\n }\n // pass 2: the rest take the lowest free lane - overlapping goes DOWN into\n // the first lane with room, fitting comes back UP to lane 0\n for (const item of pending) {\n let lane = 0;\n while (!isFree(lane, item)) lane++;\n claim(lane, item);\n }\n\n // pass 3: nothing floats above an empty lane. A pin only survives while\n // something above it still needs the space - once the schedule that was\n // there moves away or is deleted, its neighbour settles down into the\n // gap. Without this a row keeps a permanently blank top lane and never\n // shrinks back. Settling in lane order, and only ever DOWNWARD into space\n // that is genuinely free, means two schedules can never trade places -\n // so an edit still moves at most the schedule it touched.\n const byLane = [...cluster].sort((a, b) => a.lane - b.lane || a.startMin - b.startMin);\n for (const item of byLane) {\n if (item.lane === 0) continue;\n let lane = 0;\n while (lane < item.lane && !isFree(lane, item)) lane++;\n if (lane < item.lane) {\n release(item);\n claim(lane, item);\n }\n }\n }\n\n // Lane memory can leave holes (the schedule that held lane 0 was deleted or\n // moved away). Collapse the row's USED lanes onto 0..n-1: relative stacking\n // order survives, so nothing reshuffles, but the row cannot creep taller\n // than the lanes it actually needs.\n const used = [...new Set(items.map((item) => item.lane))].sort((a, b) => a - b);\n const compacted = new Map(used.map((lane, index) => [lane, index]));\n const columnCount = used.length;\n for (const item of items) {\n item.lane = compacted.get(item.lane) ?? 0;\n item.seg.column = item.lane;\n item.seg.columnCount = columnCount;\n }\n\n // Partial-overlap expansion: widen rightward into free lanes\n for (const cluster of clusters) {\n for (const item of cluster) {\n let span = 1;\n while (item.lane + span < columnCount) {\n const blocked = cluster.some(\n (other) =>\n other !== item &&\n other.lane === item.lane + span &&\n other.startMin < item.effEnd &&\n other.effEnd > item.startMin,\n );\n if (blocked) break;\n span++;\n }\n item.seg.columnSpan = span;\n }\n }\n}\n\nfunction defaultEventOrder(a: GanttOccurrence, b: GanttOccurrence): number {\n return (\n a.start.getTime() - b.start.getTime() ||\n b.end.getTime() - b.start.getTime() - (a.end.getTime() - a.start.getTime()) ||\n a.key.localeCompare(b.key)\n );\n}\n\ninterface BuildIndexOptions<TData = unknown> {\n timeZone: string;\n /** Escape hatch for exotic recurrence: return the expanded occurrences. */\n getOccurrences?: (\n event: GanttEvent<TData>,\n range: GanttDateRange,\n ctx: { timeZone: string },\n ) => Array<{ start: Date; end: Date }> | null | undefined;\n eventOrder?: (a: GanttOccurrence<TData>, b: GanttOccurrence<TData>) => number;\n}\n\ninterface GanttIndex<TData = unknown> {\n occurrences: GanttOccurrence<TData>[];\n}\n\nfunction buildEventIndex<TData>(\n events: GanttEvent<TData>[],\n visibleRange: GanttDateRange,\n opts: BuildIndexOptions<TData>,\n): GanttIndex<TData> {\n const { timeZone } = opts;\n const order = opts.eventOrder ?? defaultEventOrder;\n\n // RECURRENCE-ID override replacement: an event carrying recurringEventId +\n // originalStart is an edited single occurrence of that series. The parent's\n // expansion drops the replaced instant; the override renders as its own\n // occurrence through the normal path below.\n const overrideTimes = new Map<string, Set<number>>();\n for (const event of events) {\n if (!event.recurringEventId || !event.originalStart) continue;\n let times = overrideTimes.get(event.recurringEventId);\n if (!times) {\n times = new Set();\n overrideTimes.set(event.recurringEventId, times);\n }\n times.add(event.originalStart.getTime());\n }\n\n const occurrences: GanttOccurrence<TData>[] = [];\n for (const event of events) {\n const replaced = overrideTimes.get(event.id);\n const custom = opts.getOccurrences?.(event, visibleRange, { timeZone });\n if (custom) {\n custom.forEach((occ, i) => {\n if (replaced?.has(occ.start.getTime())) return;\n if (!rangesIntersect({ start: occ.start, end: occ.end }, visibleRange)) return;\n occurrences.push({\n key: `${event.id}::${occ.start.toISOString()}`,\n eventId: event.id,\n event,\n start: occ.start,\n end: occ.end,\n allDay: event.allDay ?? false,\n isRecurring: true,\n recurrenceIndex: i,\n });\n });\n continue;\n }\n const expanded = expandRecurrence(event, visibleRange, { timeZone });\n occurrences.push(\n ...(replaced ? expanded.filter((occ) => !replaced.has(occ.start.getTime())) : expanded),\n );\n }\n occurrences.sort(order);\n return { occurrences };\n}\n\n/** Cache key for index memoization; cheap string compare. */\nfunction getRangeKey(range: GanttDateRange): string {\n return `${range.start.getTime()}-${range.end.getTime()}`;\n}\n\n/** Depth-first flatten of the resource tree (parents included). */\nfunction flattenResources(\n resources: GanttResource[],\n depth = 0,\n): Array<{ resource: GanttResource; depth: number }> {\n const rows: Array<{ resource: GanttResource; depth: number }> = [];\n for (const resource of resources) {\n rows.push({ resource, depth });\n if (resource.children?.length) {\n rows.push(...flattenResources(resource.children, depth + 1));\n }\n }\n return rows;\n}\n\n/** Depth-first lookup of one node in the tree. */\nfunction findResource(resources: GanttResource[], id: string): GanttResource | null {\n for (const resource of resources) {\n if (resource.id === id) return resource;\n const found = resource.children?.length ? findResource(resource.children, id) : null;\n if (found) return found;\n }\n return null;\n}\n\n/**\n * Pure tree move: removes `resourceId` from wherever it sits and reinserts it\n * under `parentId` (null = root) at `index`. Returns a new tree; the original\n * is untouched. Returns null for impossible moves (unknown ids, or dropping a\n * node into its own subtree).\n */\nfunction reorderResources(\n resources: GanttResource[],\n resourceId: string,\n parentId: string | null,\n index: number,\n): GanttResource[] | null {\n let moved: GanttResource | null = null;\n\n const strip = (nodes: GanttResource[]): GanttResource[] =>\n nodes.flatMap((node) => {\n if (node.id === resourceId) {\n moved = node;\n return [];\n }\n if (!node.children?.length) return [node];\n return [{ ...node, children: strip(node.children) }];\n });\n\n const stripped = strip(resources);\n if (!moved) return null;\n\n const contains = (node: GanttResource, id: string): boolean =>\n node.id === id || !!node.children?.some((child) => contains(child, id));\n if (parentId !== null && contains(moved, parentId)) return null;\n\n const insert = (nodes: GanttResource[]): GanttResource[] => {\n if (parentId === null) {\n const next = [...nodes];\n next.splice(Math.min(Math.max(index, 0), next.length), 0, moved!);\n return next;\n }\n return nodes.map((node) => {\n if (node.id === parentId) {\n const children = [...(node.children ?? [])];\n children.splice(Math.min(Math.max(index, 0), children.length), 0, moved!);\n return { ...node, children };\n }\n if (!node.children?.length) return node;\n return { ...node, children: insert(node.children) };\n });\n };\n\n const next = insert(stripped);\n // unknown parentId: the node vanished - reject\n if (parentId !== null) {\n const flat = flattenResources(next);\n if (!flat.some(({ resource }) => resource.id === resourceId)) return null;\n }\n return next;\n}\n\nconst DEFAULT_WEEKEND_DAYS = [0, 6];\n\n/** Resolves whether a day is an off day (non-working) in the display zone. */\nfunction resolveOffDay(\n day: Date,\n timeZone: string,\n config: boolean | GanttOffDaysConfig | undefined,\n): boolean {\n if (!config) return false;\n const resolved: GanttOffDaysConfig = config === true ? {} : config;\n const weekendDays = resolved.weekendDays ?? DEFAULT_WEEKEND_DAYS;\n const zoned = toZoned(day, timeZone);\n if (weekendDays.includes(zoned.getDay())) return true;\n if (resolved.dates?.length) {\n const key = getDayKey(day, timeZone);\n if (resolved.dates.some((date) => getDayKey(date, timeZone) === key)) {\n return true;\n }\n }\n return resolved.isOffDay?.(day) ?? false;\n}\n\nexport type {\n BuildIndexOptions,\n GanttIndex,\n GanttLaneMemo,\n PackOptions,\n ViewDateRanges,\n ViewRangeOptions,\n WeekStartsOn,\n};\nexport {\n buildEventIndex,\n defaultEventOrder,\n eventsOverlap,\n findResource,\n flattenResources,\n getDayKey,\n getDayTotalMinutes,\n getGanttDateRange,\n getLaneKey,\n getRangeKey,\n MIN_PACK_SLOT,\n packTimedSegments,\n rangesIntersect,\n reorderResources,\n resolveOffDay,\n snapMinutes,\n spansMultipleDays,\n stepGanttDate,\n toZoned,\n zonedStartOfDay,\n};\n"],"mappings":";;;;;;;;;;;AAoCA,MAAM,gBAAgB;;AAGtB,SAAS,QAAQ,MAAY,UAA0B;CACrD,OAAO,IAAI,OAAO,KAAK,QAAQ,GAAG,QAAQ;AAC5C;;AAGA,SAAS,gBAAgB,MAAY,UAA0B;CAC7D,OAAO,WAAW,QAAQ,MAAM,QAAQ,CAAC;AAC3C;;AAGA,SAAS,UAAU,MAAY,UAA0B;CACvD,OAAO,OAAO,QAAQ,MAAM,QAAQ,GAAG,YAAY;AACrD;;AAGA,SAAS,mBAAmB,UAAgB,UAA0B;CAEpE,OAAO,oBADM,gBAAgB,QAAQ,QAAQ,UAAU,QAAQ,GAAG,CAAC,GAAG,QACxC,GAAG,QAAQ;AAC3C;AAEA,SAAS,YAAY,SAAiB,MAAsB;CAC1D,OAAO,KAAK,MAAM,UAAU,IA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AAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,KAAK,MAAM,GAAG,GAAG,KAAM;GAChE,OAAO;EACT;EACA,OAAO,MAAM,KAAK,SAAS;GACzB,IAAI,KAAK,OAAO,UAAU;IACxB,MAAM,WAAW,CAAC,GAAI,KAAK,YAAY,CAAC,CAAE;IAC1C,SAAS,OAAO,KAAK,IAAI,KAAK,IAAI,OAAO,CAAC,GAAG,SAAS,MAAM,GAAG,GAAG,KAAM;IACxE,OAAO;KAAE,GAAG;KAAM;IAAS;GAC7B;GACA,IAAI,CAAC,KAAK,UAAU,QAAQ,OAAO;GACnC,OAAO;IAAE,GAAG;IAAM,UAAU,OAAO,KAAK,QAAQ;GAAE;EACpD,CAAC;CACH;CAEA,MAAM,OAAO,OAAO,QAAQ;CAE5B,IAAI,aAAa,MAEX;MAAA,CADS,iBAAiB,IACtB,CAAC,CAAC,MAAM,EAAE,eAAe,SAAS,OAAO,UAAU,GAAG,OAAO;CAAA;CAEvE,OAAO;AACT;AAEA,MAAM,uBAAuB,CAAC,GAAG,CAAC;;AAGlC,SAAS,cACP,KACA,UACA,QACS;CACT,IAAI,CAAC,QAAQ,OAAO;CACpB,MAAM,WAA+B,WAAW,OAAO,CAAC,IAAI;CAC5D,MAAM,cAAc,SAAS,eAAe;CAC5C,MAAM,QAAQ,QAAQ,KAAK,QAAQ;CACnC,IAAI,YAAY,SAAS,MAAM,OAAO,CAAC,GAAG,OAAO;CACjD,IAAI,SAAS,OAAO,QAAQ;EAC1B,MAAM,MAAM,UAAU,KAAK,QAAQ;EACnC,IAAI,SAAS,MAAM,MAAM,SAAS,UAAU,MAAM,QAAQ,MAAM,GAAG,GACjE,OAAO;CAEX;CACA,OAAO,SAAS,WAAW,GAAG,KAAK;AACrC"}
|
|
@@ -48,7 +48,7 @@ declare function GanttDatePicker({ className }: GanttDatePickerProps): import("r
|
|
|
48
48
|
type GanttToolbarProps = useRender.ComponentProps<"div">;
|
|
49
49
|
/** Free slot for consumer toolbar buttons; pure layout shell. */
|
|
50
50
|
declare function GanttToolbar({ className, render, ...props }: GanttToolbarProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
51
|
-
|
|
51
|
+
type GanttNavProps = useRender.ComponentProps<"div">;
|
|
52
52
|
/**
|
|
53
53
|
* Default composed nav (event-calendar parity): Today, time-period switcher,
|
|
54
54
|
* prev/next, title, spacer. GanttDatePicker stays available for custom
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gantt-nav.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-nav.tsx"],"mappings":";;;;cAyBM,cAAc;KAgBf,iBAAiB,KAAK,UAAU;EACnC,WAAW;;;;;;;;;EASX,UAAU;;iBAoBH,gBAAgB,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;iBA4BhF,eAAe,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;iBAsB/E,eAAe,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;UAsB9E,wBAAwB,UAAU;EAC1C,UAAU;IAAO;QAAoB;;iBAG9B,aAAa,WAAW,QAAQ,QAAQ,gBAAgB,SAAS,kCAAe,+CAAA;UAe/E,gCAAgC,KAAK,UAAU;EACvD,WAAW;;;EAGX,UAAU;;EAEV,SAAS;;;;;;iBAOF,qBACP,WACA,QACA,UACA,SACA,WACG,SACF,0CAAuB,IAAA;UAqFhB;EACR;;;;;;iBAOO,kBAAkB,aAAa,uCAAoB,IAAA;KAyCvD,oBAAoB,UAAU;;iBAG1B,eAAe,WAAW,WAAW,SAAS,oCAAiB,+CAAA;
|
|
1
|
+
{"version":3,"file":"gantt-nav.d.ts","names":[],"sources":["../../../../src/components/reui/gantt/gantt-nav.tsx"],"mappings":";;;;cAyBM,cAAc;KAgBf,iBAAiB,KAAK,UAAU;EACnC,WAAW;;;;;;;;;EASX,UAAU;;iBAoBH,gBAAgB,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;iBA4BhF,eAAe,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;iBAsB/E,eAAe,WAAW,QAAQ,UAAU,YAAY,SAAS,iCAAc,IAAA;UAsB9E,wBAAwB,UAAU;EAC1C,UAAU;IAAO;QAAoB;;iBAG9B,aAAa,WAAW,QAAQ,QAAQ,gBAAgB,SAAS,kCAAe,+CAAA;UAe/E,gCAAgC,KAAK,UAAU;EACvD,WAAW;;;EAGX,UAAU;;EAEV,SAAS;;;;;;iBAOF,qBACP,WACA,QACA,UACA,SACA,WACG,SACF,0CAAuB,IAAA;UAqFhB;EACR;;;;;;iBAOO,kBAAkB,aAAa,uCAAoB,IAAA;KAyCvD,oBAAoB,UAAU;;iBAG1B,eAAe,WAAW,WAAW,SAAS,oCAAiB,+CAAA;KAcnE,gBAAgB,UAAU;;;;;;iBAOtB,WAAW,WAAW,QAAQ,aAAa,SAAS,gCAAa,+CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gantt-nav.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-nav.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useState } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { format } from \"date-fns\";\nimport { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { Calendar } from \"../../ui/calendar\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { useGanttNavigation, useGanttScale, useGanttSettings, useGanttViewConfig } from \"./gantt\";\nimport { toZoned } from \"./gantt-lib\";\nimport type { GanttScale } from \"./gantt-types\";\n\nconst GANTT_SCALES: GanttScale[] = [\"day\", \"week\", \"month\", \"quarter\", \"year\"];\n\n/** Configured nav button variant/size (viewConfig.navButtonVariant/Size). */\nfunction useNavButtonProps(): {\n variant: \"ghost\" | \"outline\" | \"secondary\" | \"default\";\n size: \"sm\" | \"default\";\n iconSize: \"icon-sm\" | \"icon\";\n} {\n const viewConfig = useGanttViewConfig();\n return {\n variant: viewConfig.navButtonVariant,\n size: viewConfig.navButtonSize,\n iconSize: viewConfig.navButtonSize === \"sm\" ? \"icon-sm\" : \"icon\",\n };\n}\n\ntype NavButtonProps = Omit<useRender.ComponentProps<\"button\">, \"children\"> & {\n children?: ReactNode;\n /**\n * Tooltip policy (the part that usually goes wrong on clickable elements):\n * tooltips appear ONLY on hover or keyboard focus-visible - a pointer click\n * never re-triggers them, and buttons that open overlays (the period\n * selector, consumer dialog buttons) get NO tooltip at all so nothing\n * flashes when focus returns. Icon-only buttons default to their accessible\n * label; Today defaults to the actual current date. Pass null to disable.\n */\n tooltip?: ReactNode | null;\n};\n\n/** Hover/focus-visible tooltip wrapper; renders the bare button when disabled. */\nfunction NavTooltip({\n content,\n children,\n}: {\n content: ReactNode | null;\n children: React.ReactElement;\n}) {\n if (content === null || content === undefined) return children;\n return (\n <Tooltip>\n <TooltipTrigger render={children} />\n <TooltipContent side=\"bottom\">{content}</TooltipContent>\n </Tooltip>\n );\n}\n\nfunction GanttNavToday({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { today, isToday } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n // zoned: a system-zone new Date() can name a different day than Today opens\n const defaultTooltip = format(\n toZoned(new Date(), settings.timeZone),\n settings.i18n.formats.dayTitle,\n { locale: settings.locale },\n );\n return (\n <NavTooltip content={tooltip === undefined ? defaultTooltip : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-nav-today\"\n data-active={isToday || undefined}\n className={cn(className)}\n onClick={today}\n render={render}\n {...props}\n >\n {children ?? settings.i18n.labels.today}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavPrev({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { prev } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.previous : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-prev\"\n aria-label={settings.i18n.labels.previous}\n className={cn(className)}\n onClick={prev}\n render={render}\n {...props}\n >\n {children ?? <ChevronLeftIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavNext({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { next } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.next : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-next\"\n aria-label={settings.i18n.labels.next}\n className={cn(className)}\n onClick={next}\n render={render}\n {...props}\n >\n {children ?? <ChevronRightIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\ninterface GanttTitleProps extends useRender.ComponentProps<\"div\"> {\n format?: (ctx: { title: string }) => ReactNode;\n}\n\nfunction GanttTitle({ className, render, format: formatTitle, ...props }: GanttTitleProps) {\n const { title } = useGanttNavigation();\n const defaultProps = {\n \"data-slot\": \"gantt-title\",\n \"aria-live\": \"polite\" as const,\n className: cn(\"min-w-0 truncate font-semibold text-sm\", className),\n children: formatTitle?.({ title }) ?? title,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface GanttScaleSwitcherProps extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: ReactNode;\n /** Hover/focus-visible hint; defaults to the \"Select view\" label. Pass\n * null to disable (overlay-opener policy). */\n tooltip?: ReactNode | null;\n /** The offered scales, in menu order. Default: all five. */\n scales?: GanttScale[];\n}\n\n/**\n * Scale switcher (\"Select view\"): Day / Week / Month / Quarter / Year, a ghost\n * dropdown button (same shape as the event-calendar view switcher).\n */\nfunction GanttScaleSwitcher({\n className,\n render,\n children,\n tooltip,\n scales = GANTT_SCALES,\n ...props\n}: GanttScaleSwitcherProps) {\n const { scale, setScale } = useGanttScale();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const labels = settings.i18n.labels;\n // Controlled open: selecting a scale swaps the whole track subtree in the\n // same click, so closing must not depend on the menu's internal handler.\n const [open, setOpen] = useState(false);\n // Hover-only tooltip: when the menu closes, Base UI focuses the trigger\n // again and a focus-opened tooltip would flash - ignore focus opens.\n const [tipOpen, setTipOpen] = useState(false);\n\n const selectScale = (next: GanttScale) => {\n setOpen(false);\n setScale(next);\n };\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(next: boolean) => {\n setOpen(next);\n if (next) setTipOpen(false);\n }}\n >\n {/* Tooltip on an overlay-opener: hover-only (focus opens ignored) and\n force-closed while the menu is up, so it never lingers or flashes\n when focus returns on close. */}\n <Tooltip\n open={tipOpen && !open}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens are hover-only; the trigger-focus open that follows a\n // menu close is ignored, closes always land\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n <DropdownMenuTrigger\n render={\n <TooltipTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-scale-switcher\"\n aria-label={labels.selectView}\n className={cn(\"gap-1\", className)}\n />\n }\n />\n }\n {...props}\n >\n {children ?? (\n <>\n {labels.scales[scale]}\n <ChevronDownIcon className=\"size-4 opacity-60\" aria-hidden=\"true\" />\n </>\n )}\n </DropdownMenuTrigger>\n {tipOpen && !open && tooltip !== null && (\n <TooltipContent side=\"bottom\">{tooltip ?? labels.selectView}</TooltipContent>\n )}\n </Tooltip>\n <DropdownMenuContent align=\"start\" className=\"min-w-36\">\n {/* Base UI contract: GroupLabel must live inside Menu.Group */}\n <DropdownMenuGroup>\n <DropdownMenuLabel className=\"font-normal text-muted-foreground\">\n {labels.selectView}\n </DropdownMenuLabel>\n {scales.map((value) => (\n <DropdownMenuItem\n key={value}\n data-active={scale === value || undefined}\n onClick={() => selectScale(value)}\n >\n {labels.scales[value]}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\ninterface GanttDatePickerProps {\n className?: string;\n}\n\n/**\n * Compact go-to-date picker (shadcn Calendar in a popover). No tooltip by\n * design: it opens an overlay (see the NavButtonProps tooltip policy).\n */\nfunction GanttDatePicker({ className }: GanttDatePickerProps) {\n const { date, goTo } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const [open, setOpen] = useState(false);\n const zoned = toZoned(date, settings.timeZone);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-date-picker\"\n aria-label={settings.i18n.labels.goToDate}\n className={cn(className)}\n />\n }\n >\n <CalendarIcon className=\"size-4\" aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-auto p-0!\">\n <Calendar\n mode=\"single\"\n selected={zoned}\n defaultMonth={zoned}\n locale={settings.locale}\n weekStartsOn={settings.weekStartsOn}\n onSelect={(next: Date | undefined) => {\n if (next) {\n goTo(next);\n setOpen(false);\n }\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\ntype GanttToolbarProps = useRender.ComponentProps<\"div\">;\n\n/** Free slot for consumer toolbar buttons; pure layout shell. */\nfunction GanttToolbar({ className, render, ...props }: GanttToolbarProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-toolbar\",\n className: cn(\"flex items-center gap-2\", viewConfig.classNames?.toolbar, className),\n children: props.children,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface GanttNavProps extends useRender.ComponentProps<\"div\"> {}\n\n/**\n * Default composed nav (event-calendar parity): Today, time-period switcher,\n * prev/next, title, spacer. GanttDatePicker stays available for custom\n * compositions. Pass children to use it as a pure layout shell instead.\n */\nfunction GanttNav({ className, render, children, ...props }: GanttNavProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-nav\",\n className: cn(\n // px so the toolbar controls do not hug the container edge; border-b\n // separates the toolbar from the column header below it\n \"flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2\",\n viewConfig.stickyNav && \"sticky top-0 z-30 bg-background\",\n viewConfig.classNames?.nav,\n className,\n ),\n children: children ?? (\n // Shared provider: first tooltip waits, moving between buttons is instant\n <TooltipProvider delay={600} closeDelay={0} timeout={300}>\n <GanttNavToday />\n <GanttScaleSwitcher />\n <div className=\"flex items-center\">\n <GanttNavPrev />\n <GanttNavNext />\n </div>\n <GanttTitle />\n <div className=\"grow\" />\n </TooltipProvider>\n ),\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\nexport type { GanttNavProps, GanttScaleSwitcherProps, GanttTitleProps, GanttToolbarProps };\nexport {\n GANTT_SCALES,\n GanttDatePicker,\n GanttNav,\n GanttNavNext,\n GanttNavPrev,\n GanttNavToday,\n GanttScaleSwitcher,\n GanttTitle,\n GanttToolbar,\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAM,eAA6B;CAAC;CAAO;CAAQ;CAAS;CAAW;AAAM;;AAG7E,SAAS,oBAIP;CACA,MAAM,aAAa,mBAAmB;CACtC,OAAO;EACL,SAAS,WAAW;EACpB,MAAM,WAAW;EACjB,UAAU,WAAW,kBAAkB,OAAO,YAAY;CAC5D;AACF;;AAgB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,CACZ;;KACL,oBAAC,YAAD,CAAa,CAAA;KACb,oBAAC,OAAD,EAAK,WAAU,OAAQ,CAAA;IACR;;EAMiB,GAAG,KAAK;CAC9C,CAAC;AACH"}
|
|
1
|
+
{"version":3,"file":"gantt-nav.js","names":[],"sources":["../../../../src/components/reui/gantt/gantt-nav.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useState } from \"react\";\nimport { mergeProps } from \"@base-ui/react/merge-props\";\nimport { useRender } from \"@base-ui/react/use-render\";\nimport { format } from \"date-fns\";\nimport { CalendarIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon } from \"lucide-react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { Button } from \"../../ui/button\";\nimport { Calendar } from \"../../ui/calendar\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuGroup,\n DropdownMenuItem,\n DropdownMenuLabel,\n DropdownMenuTrigger,\n} from \"../../ui/dropdown-menu\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../../ui/popover\";\nimport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"../../ui/tooltip\";\nimport { useGanttNavigation, useGanttScale, useGanttSettings, useGanttViewConfig } from \"./gantt\";\nimport { toZoned } from \"./gantt-lib\";\nimport type { GanttScale } from \"./gantt-types\";\n\nconst GANTT_SCALES: GanttScale[] = [\"day\", \"week\", \"month\", \"quarter\", \"year\"];\n\n/** Configured nav button variant/size (viewConfig.navButtonVariant/Size). */\nfunction useNavButtonProps(): {\n variant: \"ghost\" | \"outline\" | \"secondary\" | \"default\";\n size: \"sm\" | \"default\";\n iconSize: \"icon-sm\" | \"icon\";\n} {\n const viewConfig = useGanttViewConfig();\n return {\n variant: viewConfig.navButtonVariant,\n size: viewConfig.navButtonSize,\n iconSize: viewConfig.navButtonSize === \"sm\" ? \"icon-sm\" : \"icon\",\n };\n}\n\ntype NavButtonProps = Omit<useRender.ComponentProps<\"button\">, \"children\"> & {\n children?: ReactNode;\n /**\n * Tooltip policy (the part that usually goes wrong on clickable elements):\n * tooltips appear ONLY on hover or keyboard focus-visible - a pointer click\n * never re-triggers them, and buttons that open overlays (the period\n * selector, consumer dialog buttons) get NO tooltip at all so nothing\n * flashes when focus returns. Icon-only buttons default to their accessible\n * label; Today defaults to the actual current date. Pass null to disable.\n */\n tooltip?: ReactNode | null;\n};\n\n/** Hover/focus-visible tooltip wrapper; renders the bare button when disabled. */\nfunction NavTooltip({\n content,\n children,\n}: {\n content: ReactNode | null;\n children: React.ReactElement;\n}) {\n if (content === null || content === undefined) return children;\n return (\n <Tooltip>\n <TooltipTrigger render={children} />\n <TooltipContent side=\"bottom\">{content}</TooltipContent>\n </Tooltip>\n );\n}\n\nfunction GanttNavToday({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { today, isToday } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n // zoned: a system-zone new Date() can name a different day than Today opens\n const defaultTooltip = format(\n toZoned(new Date(), settings.timeZone),\n settings.i18n.formats.dayTitle,\n { locale: settings.locale },\n );\n return (\n <NavTooltip content={tooltip === undefined ? defaultTooltip : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-nav-today\"\n data-active={isToday || undefined}\n className={cn(className)}\n onClick={today}\n render={render}\n {...props}\n >\n {children ?? settings.i18n.labels.today}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavPrev({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { prev } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.previous : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-prev\"\n aria-label={settings.i18n.labels.previous}\n className={cn(className)}\n onClick={prev}\n render={render}\n {...props}\n >\n {children ?? <ChevronLeftIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\nfunction GanttNavNext({ className, render, children, tooltip, ...props }: NavButtonProps) {\n const { next } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n return (\n <NavTooltip content={tooltip === undefined ? settings.i18n.labels.next : tooltip}>\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-nav-next\"\n aria-label={settings.i18n.labels.next}\n className={cn(className)}\n onClick={next}\n render={render}\n {...props}\n >\n {children ?? <ChevronRightIcon className=\"size-4\" aria-hidden=\"true\" />}\n </Button>\n </NavTooltip>\n );\n}\n\ninterface GanttTitleProps extends useRender.ComponentProps<\"div\"> {\n format?: (ctx: { title: string }) => ReactNode;\n}\n\nfunction GanttTitle({ className, render, format: formatTitle, ...props }: GanttTitleProps) {\n const { title } = useGanttNavigation();\n const defaultProps = {\n \"data-slot\": \"gantt-title\",\n \"aria-live\": \"polite\" as const,\n className: cn(\"min-w-0 truncate font-semibold text-sm\", className),\n children: formatTitle?.({ title }) ?? title,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ninterface GanttScaleSwitcherProps extends Omit<useRender.ComponentProps<\"button\">, \"children\"> {\n children?: ReactNode;\n /** Hover/focus-visible hint; defaults to the \"Select view\" label. Pass\n * null to disable (overlay-opener policy). */\n tooltip?: ReactNode | null;\n /** The offered scales, in menu order. Default: all five. */\n scales?: GanttScale[];\n}\n\n/**\n * Scale switcher (\"Select view\"): Day / Week / Month / Quarter / Year, a ghost\n * dropdown button (same shape as the event-calendar view switcher).\n */\nfunction GanttScaleSwitcher({\n className,\n render,\n children,\n tooltip,\n scales = GANTT_SCALES,\n ...props\n}: GanttScaleSwitcherProps) {\n const { scale, setScale } = useGanttScale();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const labels = settings.i18n.labels;\n // Controlled open: selecting a scale swaps the whole track subtree in the\n // same click, so closing must not depend on the menu's internal handler.\n const [open, setOpen] = useState(false);\n // Hover-only tooltip: when the menu closes, Base UI focuses the trigger\n // again and a focus-opened tooltip would flash - ignore focus opens.\n const [tipOpen, setTipOpen] = useState(false);\n\n const selectScale = (next: GanttScale) => {\n setOpen(false);\n setScale(next);\n };\n\n return (\n <DropdownMenu\n open={open}\n onOpenChange={(next: boolean) => {\n setOpen(next);\n if (next) setTipOpen(false);\n }}\n >\n {/* Tooltip on an overlay-opener: hover-only (focus opens ignored) and\n force-closed while the menu is up, so it never lingers or flashes\n when focus returns on close. */}\n <Tooltip\n open={tipOpen && !open}\n onOpenChange={(next: boolean, details: { reason?: string }) => {\n // opens are hover-only; the trigger-focus open that follows a\n // menu close is ignored, closes always land\n if (next && details?.reason !== \"trigger-hover\") return;\n setTipOpen(next);\n }}\n >\n <DropdownMenuTrigger\n render={\n <TooltipTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.size}\n data-slot=\"gantt-scale-switcher\"\n aria-label={labels.selectView}\n className={cn(\"gap-1\", className)}\n />\n }\n />\n }\n {...props}\n >\n {children ?? (\n <>\n {labels.scales[scale]}\n <ChevronDownIcon className=\"size-4 opacity-60\" aria-hidden=\"true\" />\n </>\n )}\n </DropdownMenuTrigger>\n {tipOpen && !open && tooltip !== null && (\n <TooltipContent side=\"bottom\">{tooltip ?? labels.selectView}</TooltipContent>\n )}\n </Tooltip>\n <DropdownMenuContent align=\"start\" className=\"min-w-36\">\n {/* Base UI contract: GroupLabel must live inside Menu.Group */}\n <DropdownMenuGroup>\n <DropdownMenuLabel className=\"font-normal text-muted-foreground\">\n {labels.selectView}\n </DropdownMenuLabel>\n {scales.map((value) => (\n <DropdownMenuItem\n key={value}\n data-active={scale === value || undefined}\n onClick={() => selectScale(value)}\n >\n {labels.scales[value]}\n </DropdownMenuItem>\n ))}\n </DropdownMenuGroup>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\ninterface GanttDatePickerProps {\n className?: string;\n}\n\n/**\n * Compact go-to-date picker (shadcn Calendar in a popover). No tooltip by\n * design: it opens an overlay (see the NavButtonProps tooltip policy).\n */\nfunction GanttDatePicker({ className }: GanttDatePickerProps) {\n const { date, goTo } = useGanttNavigation();\n const settings = useGanttSettings();\n const nav = useNavButtonProps();\n const [open, setOpen] = useState(false);\n const zoned = toZoned(date, settings.timeZone);\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n render={\n <Button\n variant={nav.variant}\n size={nav.iconSize}\n data-slot=\"gantt-date-picker\"\n aria-label={settings.i18n.labels.goToDate}\n className={cn(className)}\n />\n }\n >\n <CalendarIcon className=\"size-4\" aria-hidden=\"true\" />\n </PopoverTrigger>\n <PopoverContent align=\"start\" className=\"w-auto p-0!\">\n <Calendar\n mode=\"single\"\n selected={zoned}\n defaultMonth={zoned}\n locale={settings.locale}\n weekStartsOn={settings.weekStartsOn}\n onSelect={(next: Date | undefined) => {\n if (next) {\n goTo(next);\n setOpen(false);\n }\n }}\n />\n </PopoverContent>\n </Popover>\n );\n}\n\ntype GanttToolbarProps = useRender.ComponentProps<\"div\">;\n\n/** Free slot for consumer toolbar buttons; pure layout shell. */\nfunction GanttToolbar({ className, render, ...props }: GanttToolbarProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-toolbar\",\n className: cn(\"flex items-center gap-2\", viewConfig.classNames?.toolbar, className),\n children: props.children,\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\ntype GanttNavProps = useRender.ComponentProps<\"div\">;\n\n/**\n * Default composed nav (event-calendar parity): Today, time-period switcher,\n * prev/next, title, spacer. GanttDatePicker stays available for custom\n * compositions. Pass children to use it as a pure layout shell instead.\n */\nfunction GanttNav({ className, render, children, ...props }: GanttNavProps) {\n const viewConfig = useGanttViewConfig();\n const defaultProps = {\n \"data-slot\": \"gantt-nav\",\n className: cn(\n // px so the toolbar controls do not hug the container edge; border-b\n // separates the toolbar from the column header below it\n \"flex min-w-0 flex-wrap items-center gap-2 border-b px-3 py-2\",\n viewConfig.stickyNav && \"sticky top-0 z-30 bg-background\",\n viewConfig.classNames?.nav,\n className,\n ),\n children: children ?? (\n // Shared provider: first tooltip waits, moving between buttons is instant\n <TooltipProvider delay={600} closeDelay={0} timeout={300}>\n <GanttNavToday />\n <GanttScaleSwitcher />\n <div className=\"flex items-center\">\n <GanttNavPrev />\n <GanttNavNext />\n </div>\n <GanttTitle />\n <div className=\"grow\" />\n </TooltipProvider>\n ),\n };\n return useRender({\n defaultTagName: \"div\",\n render,\n props: mergeProps<\"div\">(defaultProps, props),\n });\n}\n\nexport type { GanttNavProps, GanttScaleSwitcherProps, GanttTitleProps, GanttToolbarProps };\nexport {\n GANTT_SCALES,\n GanttDatePicker,\n GanttNav,\n GanttNavNext,\n GanttNavPrev,\n GanttNavToday,\n GanttScaleSwitcher,\n GanttTitle,\n GanttToolbar,\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAyBA,MAAM,eAA6B;CAAC;CAAO;CAAQ;CAAS;CAAW;AAAM;;AAG7E,SAAS,oBAIP;CACA,MAAM,aAAa,mBAAmB;CACtC,OAAO;EACL,SAAS,WAAW;EACpB,MAAM,WAAW;EACjB,UAAU,WAAW,kBAAkB,OAAO,YAAY;CAC5D;AACF;;AAgBA,SAAS,WAAW,EAClB,SACA,YAIC;CACD,IAAI,YAAY,QAAQ,YAAY,KAAA,GAAW,OAAO;CACtD,OACE,qBAAC,SAAD,EAAA,UAAA,CACE,oBAAC,gBAAD,EAAgB,QAAQ,SAAW,CAAA,GACnC,oBAAC,gBAAD;EAAgB,MAAK;EAAU,UAAA;CAAwB,CAAA,CAChD,EAAA,CAAA;AAEb;AAEA,SAAS,cAAc,EAAE,WAAW,QAAQ,UAAU,SAAS,GAAG,SAAyB;CACzF,MAAM,EAAE,OAAO,YAAY,mBAAmB;CAC9C,MAAM,WAAW,iBAAiB;CAClC,MAAM,MAAM,kBAAkB;CAE9B,MAAM,iBAAiB,OACrB,wBAAQ,IAAI,KAAK,GAAG,SAAS,QAAQ,GACrC,SAAS,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f;IACF;GACD,CAAA;EACa,CAAA,CACT;;AAEb;;AAKA,SAAS,aAAa,EAAE,WAAW,QAAQ,GAAG,SAA4B;CAOxE,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO,WAAkB;GAPzB,aAAa;GACb,WAAW,GAAG,2BAHG,mBAGiC,CAAC,CAAC,YAAY,SAAS,SAAS;GAClF,UAAU,MAAM;EAKoB,GAAG,KAAK;CAC9C,CAAC;AACH;;;;;;AASA,SAAS,SAAS,EAAE,WAAW,QAAQ,UAAU,GAAG,SAAwB;CAC1E,MAAM,aAAa,mBAAmB;CAyBtC,OAAO,UAAU;EACf,gBAAgB;EAChB;EACA,OAAO,WAAkB;GA1BzB,aAAa;GACb,WAAW,GAGT,gEACA,WAAW,aAAa,mCACxB,WAAW,YAAY,KACvB,SACF;GACA,UAAU,YAER,qBAAC,iBAAD;IAAiB,OAAO;IAAK,YAAY;IAAG,SAAS;IAArD,UAAA;KACE,oBAAC,eAAD,CAAgB,CAAA;KAChB,oBAAC,oBAAD,CAAqB,CAAA;KACrB,qBAAC,OAAD;MAAK,WAAU;MAAf,UAAA,CACE,oBAAC,cAAD,CAAe,CAAA,GACf,oBAAC,cAAD,CAAe,CAAA,CACZ;;KACL,oBAAC,YAAD,CAAa,CAAA;KACb,oBAAC,OAAD,EAAK,WAAU,OAAQ,CAAA;IACR;;EAMiB,GAAG,KAAK;CAC9C,CAAC;AACH"}
|
|
@@ -149,22 +149,22 @@ function expandRecurrence(event, range, ctx) {
|
|
|
149
149
|
let index = 0;
|
|
150
150
|
let cursor = zonedStart;
|
|
151
151
|
const advance = (from, steps) => rule.freq === "daily" ? addDays(from, steps * interval) : rule.freq === "weekly" ? addWeeks(from, steps * interval) : rule.freq === "monthly" ? addMonths(from, steps * interval) : addYears(from, steps * interval);
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
}
|
|
152
|
+
const canFastForward = rule.freq === "daily" || rule.freq === "weekly";
|
|
153
|
+
const weekSlackMs = weeklyDays ? 6 * 864e5 : 0;
|
|
154
|
+
const maxStepMs = (rule.freq === "daily" ? 24 : rule.freq === "weekly" ? 168 : rule.freq === "monthly" ? 744 : 366 * 24) * 36e5 * interval + 36e5;
|
|
155
|
+
for (let pass = 0; canFastForward && pass < 2; pass++) {
|
|
156
|
+
const gap = range.start.getTime() - durationMs - weekSlackMs - cursor.getTime();
|
|
157
|
+
const skip = Math.floor(gap / maxStepMs);
|
|
158
|
+
if (skip <= 0) break;
|
|
159
|
+
cursor = advance(cursor, skip);
|
|
160
|
+
index += skip * (weeklyDays ? weeklyDays.length : 1);
|
|
161
|
+
}
|
|
162
|
+
let guard = 0;
|
|
163
|
+
while (guard++ < 1e4 && !(rule.until && cursor.getTime() > rule.until.getTime()) && cursor.getTime() + durationMs + weekSlackMs < range.start.getTime()) {
|
|
164
|
+
cursor = advance(cursor, 1);
|
|
165
|
+
index += weeklyDays ? weeklyDays.length : 1;
|
|
167
166
|
}
|
|
167
|
+
if (weeklyDays && index > 0) index -= weeklyDays.filter((day) => day < zonedStart.getDay()).length;
|
|
168
168
|
const pushIfVisible = (rawStart) => {
|
|
169
169
|
const start = new Date(rawStart.getTime());
|
|
170
170
|
if (exTimes.has(start.getTime())) return;
|
|
@@ -182,14 +182,15 @@ function expandRecurrence(event, range, ctx) {
|
|
|
182
182
|
};
|
|
183
183
|
while (produced < MAX_OCCURRENCES) {
|
|
184
184
|
if (rule.until && cursor.getTime() > rule.until.getTime()) break;
|
|
185
|
-
if (rule.count !== void 0 &&
|
|
185
|
+
if (rule.count !== void 0 && index >= rule.count) break;
|
|
186
186
|
if ((weeklyDays ? addDays(cursor, -cursor.getDay()).getTime() : cursor.getTime()) >= range.end.getTime() && rule.count === void 0) break;
|
|
187
187
|
if (rule.freq === "weekly" && weeklyDays) for (let d = 0; d < 7; d++) {
|
|
188
188
|
const candidate = addDays(cursor, d - cursor.getDay());
|
|
189
189
|
if (!weeklyDays.includes(candidate.getDay())) continue;
|
|
190
190
|
if (candidate.getTime() < zonedStart.getTime()) continue;
|
|
191
191
|
if (rule.until && candidate.getTime() > rule.until.getTime()) continue;
|
|
192
|
-
if (
|
|
192
|
+
if (produced >= 1e3) break;
|
|
193
|
+
if (rule.count !== void 0 && index >= rule.count) break;
|
|
193
194
|
pushIfVisible(candidate);
|
|
194
195
|
produced++;
|
|
195
196
|
index++;
|