@algorisys/zen-ui-vanilla 13.10.1 → 13.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +2 -2
- package/dist/_core/index.d.ts +1 -0
- package/dist/_core/messages-all.d.ts +5 -0
- package/dist/_core/messages.d.ts +5 -0
- package/dist/_core/planning-gesture.d.ts +31 -0
- package/dist/_core/planning.d.ts +71 -9
- package/dist/components/data-table/data-table.d.ts.map +1 -1
- package/dist/components/event-calendar/event-calendar-item.d.ts.map +1 -1
- package/dist/components/event-calendar/event-calendar-model.d.ts +6 -0
- package/dist/components/event-calendar/event-calendar-model.d.ts.map +1 -1
- package/dist/components/planning-calendar/planning-calendar.d.ts +61 -3
- package/dist/components/planning-calendar/planning-calendar.d.ts.map +1 -1
- package/dist/components/rich-text/rich-text.d.ts +5 -7
- package/dist/components/rich-text/rich-text.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index108.js +12 -4
- package/dist/index108.js.map +1 -1
- package/dist/index112.js +244 -144
- package/dist/index112.js.map +1 -1
- package/dist/index113.js +6 -6
- package/dist/index114.js +1 -1
- package/dist/index115.js +1 -1
- package/dist/index116.js +1 -1
- package/dist/index118.js +2 -2
- package/dist/index120.js +2 -2
- package/dist/index168.js +1 -1
- package/dist/index175.js +1 -1
- package/dist/index187.js +1 -1
- package/dist/index191.js +1 -1
- package/dist/index194.js +2 -2
- package/dist/index199.js +1 -1
- package/dist/index211.js +5 -0
- package/dist/index211.js.map +1 -1
- package/dist/index230.js +107 -75
- package/dist/index230.js.map +1 -1
- package/dist/index231.js +95 -7
- package/dist/index231.js.map +1 -1
- package/dist/index232.js +7 -48
- package/dist/index232.js.map +1 -1
- package/dist/index233.js +45 -37
- package/dist/index233.js.map +1 -1
- package/dist/index234.js +38 -149
- package/dist/index234.js.map +1 -1
- package/dist/index235.js +138 -177
- package/dist/index235.js.map +1 -1
- package/dist/index236.js +190 -90
- package/dist/index236.js.map +1 -1
- package/dist/index237.js +90 -444
- package/dist/index237.js.map +1 -1
- package/dist/index238.js +436 -98
- package/dist/index238.js.map +1 -1
- package/dist/index239.js +106 -2
- package/dist/index239.js.map +1 -1
- package/dist/index240.js +2 -18804
- package/dist/index240.js.map +1 -1
- package/dist/index241.js +18798 -117
- package/dist/index241.js.map +1 -1
- package/dist/index242.js +122 -13
- package/dist/index242.js.map +1 -1
- package/dist/index243.js +13 -3012
- package/dist/index243.js.map +1 -1
- package/dist/index244.js +3006 -123
- package/dist/index244.js.map +1 -1
- package/dist/index245.js +125 -140
- package/dist/index245.js.map +1 -1
- package/dist/index246.js +138 -93
- package/dist/index246.js.map +1 -1
- package/dist/index247.js +91 -104
- package/dist/index247.js.map +1 -1
- package/dist/index248.js +95 -111
- package/dist/index248.js.map +1 -1
- package/dist/index249.js +127 -4
- package/dist/index249.js.map +1 -1
- package/dist/index250.js +5 -34
- package/dist/index250.js.map +1 -1
- package/dist/index251.js +34 -9
- package/dist/index251.js.map +1 -1
- package/dist/index252.js +10 -7
- package/dist/index252.js.map +1 -1
- package/dist/index253.js +6 -15
- package/dist/index253.js.map +1 -1
- package/dist/index254.js +15 -11
- package/dist/index254.js.map +1 -1
- package/dist/index255.js +11 -3
- package/dist/index255.js.map +1 -1
- package/dist/index256.js +7 -0
- package/dist/index256.js.map +1 -0
- package/dist/index99.js.map +1 -1
- package/dist/previews/analytic-chart.jpg +0 -0
- package/dist/previews/code-editor.jpg +0 -0
- package/dist/previews/countdown.jpg +0 -0
- package/dist/previews/loading.jpg +0 -0
- package/dist/previews/map.jpg +0 -0
- package/dist/previews/skeleton.jpg +0 -0
- package/dist/previews/tile.jpg +0 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/skills/zen-ui/SKILL.md +1 -1
- package/skills/zen-ui/references/api/event-calendar-event-calendar.md +1 -0
- package/skills/zen-ui/references/api/index.md +1 -1
- package/skills/zen-ui/references/api/locale.md +5 -0
- package/skills/zen-ui/references/api/planning-calendar.md +30 -1
- package/skills/zen-ui/references/api/rich-text.md +1 -1
- package/skills/zen-ui/references/api/scan-input.md +1 -1
- package/skills/zen-ui/references/catalogue.md +2 -2
package/dist/index238.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index238.js","sources":["../../core/src/virtual-window.ts"],"sourcesContent":["/**\n * Window maths for virtualized, server-paged lists.\n *\n * Framework-agnostic and, unlike the rest of the pivot, not pivot-specific:\n * page alignment, which windows are missing for a visible range, pruning what\n * has scrolled away, and picking the nearest page to fetch next. Nothing else\n * in the library does this — DataTable virtualizes rows it already has, and\n * VirtualizedItems takes a materialized array — so this is real infrastructure\n * rather than a duplicate.\n *\n * It lived in packages/solid/src/components/pivot/internal, where its own\n * doc comment said it was meant to keep \"pivot grids, filter dropdowns, and\n * future large lists consistent\" — a cross-cutting intent, filed somewhere\n * nothing could cross-cut to, and unreachable from React entirely.\n *\n * Pinned by scripts/check-virtual-window.ts.\n */\n\n/** Debounce after scroll settles before fetching the next data window. */\nexport const VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS = 200;\n\n/** Default server page size for sliding row/value windows (TM1-style segments). */\nexport const VIRTUAL_SCROLL_WINDOW_PAGE_SIZE = 50;\n\n/** Aligns an index down to the start of its page-sized window. */\nexport function alignWindowStart(minIndex: number, windowSize: number): number {\n if (windowSize <= 0) {\n return 0;\n }\n // Clamped at 0: Math.floor(-5 / 50) * 50 is -50, and a negative page start\n // becomes `offset: -50` in a fetch — which a server answers with a 400 or,\n // worse, with something. A virtualizer's overscan subtracts from the first\n // visible index, so a negative arrives here the moment anyone scrolls to the\n // top of a list without clamping first.\n if (minIndex <= 0) {\n return 0;\n }\n return Math.floor(minIndex / windowSize) * windowSize;\n}\n\n/** Page-aligned offsets that intersect `[minIndex, maxIndex]`. */\nexport function requiredWindowStarts(\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): number[] {\n // An inverted range is not a range. It used to return page 0 and fetch it for\n // nothing, because both ends aligned to the same place.\n if (maxIndex < minIndex) {\n return [];\n }\n const start = alignWindowStart(minIndex, pageSize);\n const end = alignWindowStart(maxIndex, pageSize);\n const starts: number[] = [];\n for (let offset = start; offset <= end; offset += pageSize) {\n starts.push(offset);\n }\n return starts;\n}\n\nexport type WindowLength = {\n startIndex: number;\n /** Number of loaded slots in this window (may be shorter than pageSize). */\n length: number;\n};\n\nfunction findWindowAt(\n windows: readonly WindowLength[],\n startIndex: number,\n): WindowLength | undefined {\n return windows.find((window) => window.startIndex === startIndex);\n}\n\nfunction windowCoversLocalRange(\n window: WindowLength,\n from: number,\n to: number,\n): boolean {\n const windowEnd = window.startIndex + window.length - 1;\n return from >= window.startIndex && to <= windowEnd;\n}\n\n/** Page offsets still needed to cover the visible index range. */\nexport function missingWindowStarts(\n windows: readonly WindowLength[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): number[] {\n const required = requiredWindowStarts(minIndex, maxIndex, pageSize);\n const missing: number[] = [];\n for (const pageStart of required) {\n const pageEnd = pageStart + pageSize - 1;\n const segmentStart = Math.max(minIndex, pageStart);\n const segmentEnd = Math.min(maxIndex, pageEnd);\n const window = findWindowAt(windows, pageStart);\n if (\n window &&\n window.length > 0 &&\n windowCoversLocalRange(window, segmentStart, segmentEnd)\n ) {\n continue;\n }\n missing.push(pageStart);\n }\n return missing;\n}\n\n/**\n * Drops windows outside the visible range plus one page of keep buffer\n * on each side.\n */\nexport function pruneWindowsByRange<T extends WindowLength>(\n windows: readonly T[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): T[] {\n if (pageSize <= 0 || windows.length === 0) {\n return [...windows];\n }\n const keepMin = Math.max(0, alignWindowStart(minIndex, pageSize) - pageSize);\n const keepMaxEnd =\n alignWindowStart(maxIndex, pageSize) + pageSize * 2 - 1;\n return windows.filter((window) => {\n const windowEnd = window.startIndex + Math.max(window.length, 1) - 1;\n return windowEnd >= keepMin && window.startIndex <= keepMaxEnd;\n });\n}\n\n/** Picks the missing page whose center is nearest the visible midpoint. */\nexport function pickNearestWindowStart(\n missing: readonly number[],\n mid: number,\n pageSize: number,\n): number {\n let best = missing[0];\n let bestDist = Math.abs(best + pageSize / 2 - mid);\n for (let i = 1; i < missing.length; i++) {\n const start = missing[i];\n const dist = Math.abs(start + pageSize / 2 - mid);\n if (dist < bestDist) {\n best = start;\n bestDist = dist;\n }\n }\n return best;\n}\n\nexport type PivotFilterOptionsWindow = {\n startIndex: number;\n values: string[];\n};\n\n\n/** Rows before window.startIndex that may render blank while scrolling forward. */\nexport const PIVOT_FILTER_LEADING_OVERSCAN_SLACK = 4;\n\nfunction toSpans(windows: readonly PivotFilterOptionsWindow[]) {\n return windows.map((window) => ({\n startIndex: window.startIndex,\n length: window.values.length,\n }));\n}\n\nfunction windowCoversIndexRange(\n window: PivotFilterOptionsWindow,\n from: number,\n to: number,\n): boolean {\n const windowEnd = window.startIndex + window.values.length - 1;\n if (from < window.startIndex || to > windowEnd) {\n return false;\n }\n return to - window.startIndex < window.values.length;\n}\n\n/** Returns whether cached windows already cover the visible index range. */\nexport function pivotFilterWindowCoversRange(\n windows: readonly PivotFilterOptionsWindow[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): boolean {\n return (\n pivotFilterMissingWindowStarts(windows, minIndex, maxIndex, pageSize)\n .length === 0\n );\n}\n\n/** Page offsets that still need to be fetched for the visible range. */\nexport function pivotFilterMissingWindowStarts(\n windows: readonly PivotFilterOptionsWindow[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): number[] {\n return missingWindowStarts(toSpans(windows), minIndex, maxIndex, pageSize).filter(\n (pageStart) => {\n const pageEnd = pageStart + pageSize - 1;\n return !isLeadingOverscanOnly(minIndex, pageEnd, windows, maxIndex);\n },\n );\n}\n\nfunction isLeadingOverscanOnly(\n minIndex: number,\n pageEnd: number,\n windows: readonly PivotFilterOptionsWindow[],\n maxIndex: number,\n): boolean {\n const segmentEnd = Math.min(maxIndex, pageEnd);\n if (segmentEnd < minIndex) {\n return false;\n }\n for (const window of windows) {\n if (window.values.length === 0 || maxIndex < window.startIndex) {\n continue;\n }\n if (window.startIndex - minIndex > PIVOT_FILTER_LEADING_OVERSCAN_SLACK) {\n continue;\n }\n const trailingEnd = Math.min(\n maxIndex,\n window.startIndex + window.values.length - 1,\n );\n if (\n segmentEnd < window.startIndex &&\n windowCoversIndexRange(window, window.startIndex, trailingEnd)\n ) {\n return true;\n }\n }\n return false;\n}\n\n/** Drops windows outside the visible range plus one page of keep buffer. */\nexport function prunePivotFilterWindows(\n windows: readonly PivotFilterOptionsWindow[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): PivotFilterOptionsWindow[] {\n return pruneWindowsByRange(\n windows.map((window) => ({\n startIndex: window.startIndex,\n length: window.values.length,\n window,\n })),\n minIndex,\n maxIndex,\n pageSize,\n ).map((entry) => entry.window);\n}\n\n/** Reads a value from cached windows by global index. */\nexport function pivotFilterWindowValueAt(\n windows: readonly PivotFilterOptionsWindow[],\n index: number,\n): string | undefined {\n for (const window of windows) {\n const localIndex = index - window.startIndex;\n if (localIndex >= 0 && localIndex < window.values.length) {\n return window.values[localIndex];\n }\n }\n return undefined;\n}\n\n"],"names":["VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS","VIRTUAL_SCROLL_WINDOW_PAGE_SIZE","alignWindowStart","minIndex","windowSize","requiredWindowStarts","maxIndex","pageSize","start","end","starts","offset","findWindowAt","windows","startIndex","window","windowCoversLocalRange","from","to","windowEnd","missingWindowStarts","required","missing","pageStart","pageEnd","segmentStart","segmentEnd","pruneWindowsByRange","keepMin","keepMaxEnd","pickNearestWindowStart","mid","best","bestDist","i","dist","PIVOT_FILTER_LEADING_OVERSCAN_SLACK","toSpans","windowCoversIndexRange","pivotFilterMissingWindowStarts","isLeadingOverscanOnly","trailingEnd","prunePivotFilterWindows","entry","pivotFilterWindowValueAt","index","localIndex"],"mappings":"AAmBO,MAAMA,IAAmC,KAGnCC,IAAkC;AAGxC,SAASC,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MAAIE,IAAavB;AACf,WAAO;AAET,aAAWY,KAAUF,GAAS;AAI5B,QAHIE,EAAO,OAAO,WAAW,KAAKT,IAAWS,EAAO,cAGhDA,EAAO,aAAaZ,IAAWiC;AACjC;AAEF,UAAMK,IAAc,KAAK;AAAA,MACvBnC;AAAA,MACAS,EAAO,aAAaA,EAAO,OAAO,SAAS;AAAA,IAAA;AAE7C,QACEW,IAAaX,EAAO,cACpBuB,EAAuBvB,GAAQA,EAAO,YAAY0B,CAAW;AAE7D,aAAO;AAAA,EAEX;AACA,SAAO;AACT;AAGO,SAASC,EACd7B,GACAV,GACAG,GACAC,GAC4B;AAC5B,SAAOoB;AAAA,IACLd,EAAQ,IAAI,CAACE,OAAY;AAAA,MACvB,YAAYA,EAAO;AAAA,MACnB,QAAQA,EAAO,OAAO;AAAA,MACtB,QAAAA;AAAA,IAAA,EACA;AAAA,IACFZ;AAAA,IACAG;AAAA,IACAC;AAAA,EAAA,EACA,IAAI,CAACoC,MAAUA,EAAM,MAAM;AAC/B;AAGO,SAASC,EACd/B,GACAgC,GACoB;AACpB,aAAW9B,KAAUF,GAAS;AAC5B,UAAMiC,IAAaD,IAAQ9B,EAAO;AAClC,QAAI+B,KAAc,KAAKA,IAAa/B,EAAO,OAAO;AAChD,aAAOA,EAAO,OAAO+B,CAAU;AAAA,EAEnC;AAEF;"}
|
|
1
|
+
{"version":3,"file":"index238.js","sources":["../src/components/gantt/schedule-grid.ts"],"sourcesContent":["import {\n ganttColumns,\n ganttColumnWidths,\n ganttColumnWindow,\n ganttContinuousRange,\n ganttFitHourStep,\n ganttFitUnit,\n ganttHeaderGroups,\n ganttViewUnit,\n ganttPaneColumns,\n ganttRange,\n ganttRangeColumns,\n ganttRangeLabel,\n ganttRowWindow,\n ganttSpanLabel,\n nowPct,\n shiftGanttAnchor,\n type GanttAnchoredView,\n type GanttCalendar,\n type GanttColumnUnit,\n type GanttConnector,\n type GanttDependencyStyle,\n type GanttView,\n type PlanningColumn,\n type PlanningRange,\n} from \"@algorisys/zen-ui-core\";\nimport { cn } from \"../../lib/cn\";\nimport { Button } from \"../button/button\";\nimport { Icon } from \"../icon/icon\";\nimport { type AnyZenComponent } from \"../../lib/component\";\nimport { useLocale, type MessageKey } from \"../locale/locale\";\n\n/**\n * ScheduleGrid — the chrome every schedule chart needs, and none of what any\n * particular one MEANS.\n *\n * The no-framework port of the shared renderer behind `Gantt` and\n * `ProductionSchedule`, mirroring the React and Solid bindings and verified\n * against them: `node scripts/check-schedule-dom.mjs vanilla` runs the same\n * assertions, and `check-schedule-parity.mjs vanilla` compares the rendered\n * charts against React's. Internal — not exported from the package index.\n *\n * WHAT IS GENUINELY DIFFERENT HERE, because there is no framework to hide it:\n *\n * - **There is no re-render.** React and Solid answer \"the scroll position\n * changed\" by recomputing and letting the renderer work out the difference.\n * Here the difference IS the code, so the chrome is built once and only the\n * ROW BAND is rebuilt when the window moves. Rebuilding everything on scroll\n * would throw away the scroll position it was reacting to, and the focused\n * cell with it.\n * - **The scroller node outlives an update.** `update()` swaps the grid's\n * contents, not the scroller, and saves and restores `scrollTop` around the\n * swap — a browser clamps it the moment the content is briefly shorter.\n * - **Nothing is deferred.** Solid needed a microtask before focusing a row it\n * had just scrolled into view, because its effects run before the rows are\n * written. Here the write has already happened by the time the next line\n * runs, which makes this the simplest of the three.\n * - **Handles and listeners are owned explicitly.** A Button or an Icon holds\n * real listeners on nodes this file created and there is no unmount to take\n * them away, so each render destroys the previous render's handles first.\n */\n\n/** Pixel height of a row. Fixed, and the connector routes depend on it. */\nexport const ROW_PX = 36;\nexport const HEADER_PX = 44;\n/** The optional group row above the column labels (`headerGroups`). */\nexport const GROUP_PX = 22;\n/** Indent per level of hierarchy, applied by the caller inside its first column. */\nexport const INDENT_PX = 14;\n\n/** NOMINAL column width per anchored view. One number cannot serve all five. */\nconst COLUMN_PX: Record<GanttAnchoredView, number> = {\n day: 56,\n week: 128,\n month: 44,\n quarter: 72,\n year: 80,\n};\n\n/** The narrowest each FIT unit's label survives at — \"08:00\", \"31\", \"13\", \"Sep\". */\nconst FIT_MIN_COLUMN_PX: Record<GanttColumnUnit, number> = {\n hour: 40,\n day: 20,\n week: 26,\n month: 30,\n};\n\n/**\n * The narrowest each ANCHORED view survives at, so it can SHRINK toward its\n * floor rather than scroll. It never grows past COLUMN_PX: stretching a week\n * view to the window would make \"how long is that bar\" a question about the\n * browser, while shrinking it is simply the alternative to dragging sideways.\n */\n/** A week column of a month drawn in weeks (`monthUnit: \"week\"`): wide enough\n * for a label on a bar, which is why anyone asks for it. Floor, then ceiling. */\nconst MONTH_WEEK_PX = { min: 64, max: 180 };\n\nconst MIN_COLUMN_PX: Record<GanttAnchoredView, number> = {\n day: 34,\n week: 44,\n month: 20,\n quarter: 38,\n year: 30,\n};\n\n/** A floor under what the pane will shed for. Below this it is a legend. */\nconst MIN_AXIS_PX = 280;\n/** Half-height of the connector arrowhead, in the axis's pixel space. */\nconst ARROW_PX = 5;\n/** Matches `zen-max-h-[32rem]` on the scroller. Seeds the window before measuring. */\nconst SCROLLER_MAX_PX = 512;\n\nconst CELL_FOCUS_CLASS =\n \"focus-visible:zen-outline-none focus-visible:zen-ring-2 focus-visible:zen-ring-inset focus-visible:zen-ring-zen-ring\";\n\nconst VIEW_LABEL: Record<GanttView, MessageKey> = {\n fit: \"scheduleGrid.views.fit\",\n day: \"scheduleGrid.views.day\",\n week: \"scheduleGrid.views.week\",\n month: \"scheduleGrid.views.month\",\n quarter: \"scheduleGrid.views.quarter\",\n year: \"scheduleGrid.views.year\",\n};\n\n/* Fit first: it is the default, and the one that answers \"what does this plan\n look like\" before you have decided which zoom to argue about. */\nexport const ALL_VIEWS: GanttView[] = [\"fit\", \"day\", \"week\", \"month\", \"quarter\", \"year\"];\n\n/** The minimum the chrome needs to know about a row. */\nexport interface ScheduleRowShape {\n index: number;\n depth: number;\n hasChildren: boolean;\n expanded: boolean;\n}\n\n/** One column of the frozen pane. */\nexport interface ScheduleColumn<R> {\n key: string;\n label: string;\n width: number;\n /** Its place in the FULL column set, 1-based — not among the survivors. */\n colIndex: number;\n /** Nodes for this cell. Components are kept and destroyed with the render. */\n render: (row: R) => Array<Node | AnyZenComponent>;\n ariaLabel?: (row: R) => string | undefined;\n class?: string;\n /** Inline style pairs, e.g. `[[\"padding-inline-start\", \"22px\"]]`. */\n style?: (row: R) => Array<[string, string]> | undefined;\n}\n\nexport interface ScheduleMetrics {\n top: number;\n height: number;\n width: number;\n /** Horizontal scroll, LOGICAL: from the inline start, so never negative under RTL. */\n left: number;\n}\n\nexport interface ScheduleAxisInput {\n view: GanttView;\n anchor: Date;\n /** The range when `view` is \"fit\", or null to fall back to the anchored month. */\n fitRange: PlanningRange | null;\n now: Date;\n calendar?: GanttCalendar;\n hourStep?: number;\n columnWidth?: number;\n paneColumns: readonly { key: string; width: number }[];\n /** The scroller's measured `clientWidth`, or 0 before it has been measured. */\n available: number;\n /** The header draws a group row, so columns drop the context it carries. */\n grouped?: boolean;\n /** One scrolling timeline over the whole plan: the view sets the ZOOM. Fit ignores it. */\n continuous?: boolean;\n /** The plan's span, for a continuous axis; null when nothing has dates. */\n plan?: PlanningRange | null;\n /**\n * The month view's columns: \"day\" (default) or \"week\". Anchored month only —\n * a continuous axis zooms by its own unit and Fit chooses its own.\n */\n monthUnit?: \"day\" | \"week\";\n}\n\nexport interface ScheduleAxis {\n range: PlanningRange;\n columns: PlanningColumn[];\n columnWidths: number[];\n axisWidth: number;\n paneWidth: number;\n paneKeys: string[];\n isFit: boolean;\n anchoredView: GanttAnchoredView;\n /** What one column is: hour, day, week or month. What the header groups by. */\n unit: GanttColumnUnit;\n /** A continuous axis: the whole plan at the view's zoom, scrolled, not paged. */\n continuous: boolean;\n /** A continuous range that hit the column cap and was windowed round the anchor. */\n clamped: boolean;\n /** Milliseconds worth roughly one pixel — what a split-bar gap is judged against. */\n minGapMs: number;\n}\n\n/**\n * Resolve the axis and the pane together, in the one order that works.\n *\n * The chain has a real dependency in it and it is easy to get backwards: the\n * pane sheds against what the axis WANTS at its narrowest, and a fit axis then\n * spends whatever the pane left over. Doing it the other way round — pane first\n * at a fixed minimum — is the version that left a year axis at 1292px keeping\n * all four columns and scrolling anyway.\n *\n * A plain function here rather than the other bindings' accessor bundle: with\n * no reactivity there is nothing to be fine-grained about, and the whole thing\n * is recomputed on the render that needed it.\n */\nexport function resolveScheduleAxis(input: ScheduleAxisInput): ScheduleAxis {\n const isFit = input.view === \"fit\";\n /* The one place the two view worlds meet. Every anchored function refuses\n `fit` at the TYPE level, so there is no path by which a fit view reaches\n `ganttRange` and silently gets a month — the trap `planningRange` still has,\n and the one this binding actually fell into for quarter and year. */\n const anchoredView: GanttAnchoredView = isFit ? \"month\" : (input.view as GanttAnchoredView);\n\n const fitUnit = input.fitRange\n ? ganttFitUnit(input.fitRange.end.getTime() - input.fitRange.start.getTime())\n : null;\n\n /* A fit hour axis picks its own step so 48 one-hour columns never happen. A\n stated `hourStep` still wins: it is the caller saying what resolution they\n schedule at. */\n const hourStep =\n fitUnit === \"hour\" && input.hourStep === undefined && input.fitRange\n ? ganttFitHourStep(input.fitRange.end.getTime() - input.fitRange.start.getTime())\n : input.hourStep;\n\n /* Continuous: the whole plan at this zoom. It only CHANGES when the anchor\n leaves the plan or the range is capped: Previous / Next / Today otherwise\n scroll, they do not swap the window. */\n const continuous = !!input.continuous && !isFit;\n const whole = continuous ? ganttContinuousRange(anchoredView, input.plan ?? null, input.anchor) : null;\n const range = input.fitRange ?? whole?.range ?? ganttRange(anchoredView, input.anchor);\n /** The anchored month, drawn in weeks. Sized as weeks, grouped as weeks. */\n const monthWeeks = input.monthUnit === \"week\" && !isFit && !continuous && anchoredView === \"month\";\n const options = {\n now: input.now,\n calendar: input.calendar,\n hourStep,\n grouped: input.grouped,\n monthUnit: monthWeeks ? (\"week\" as const) : undefined,\n };\n const columns = whole\n ? ganttRangeColumns(whole.range, ganttViewUnit(anchoredView), options)\n : input.fitRange && fitUnit\n ? ganttRangeColumns(input.fitRange, fitUnit, options)\n : ganttColumns(anchoredView, input.anchor, options);\n\n /* Two numbers, not one, and the pane negotiates against the SMALLER. A\n continuous axis scrolls, so its pane negotiates only against a usable\n viewport, not against the whole plan's width. */\n const floorAxis = continuous\n ? MIN_AXIS_PX\n : input.columnWidth !== undefined\n ? columns.length * input.columnWidth\n : fitUnit\n ? columns.length * FIT_MIN_COLUMN_PX[fitUnit]\n : monthWeeks\n ? columns.length * MONTH_WEEK_PX.min\n : columns.length * MIN_COLUMN_PX[anchoredView];\n const ceilingAxis =\n input.columnWidth !== undefined\n ? columns.length * input.columnWidth\n : fitUnit\n ? Number.POSITIVE_INFINITY\n : monthWeeks\n ? columns.length * MONTH_WEEK_PX.max\n : columns.length * COLUMN_PX[anchoredView];\n\n const widths: Record<string, number> = {};\n for (const column of input.paneColumns) widths[column.key] = column.width;\n const paneKeys = ganttPaneColumns(\n input.paneColumns.map((c) => c.key),\n widths,\n input.available,\n Math.max(MIN_AXIS_PX, floorAxis),\n );\n const paneWidth = paneKeys.reduce((sum, key) => sum + (widths[key] ?? 0), 0);\n\n /* UNMEASURED is not zero-width: with no measurement an anchored view takes\n its comfortable width and a fit view takes its floor. */\n // Continuous: each column at the zoom's width; a short plan still fills the viewport.\n const natural = columns.length * (input.columnWidth ?? COLUMN_PX[anchoredView]);\n const axisWidth = continuous\n ? input.available > 0\n ? Math.max(natural, input.available - paneWidth)\n : natural\n : input.available > 0\n ? Math.min(ceilingAxis, Math.max(floorAxis, input.available - paneWidth))\n : Number.isFinite(ceilingAxis)\n ? ceilingAxis\n : floorAxis;\n\n /* Per column, from its own duration — NOT axisWidth / columns.length. A year\n of 28-to-31-day months at one uniform width walks every bar off its\n gridline by up to three days, and looks entirely reasonable doing it. */\n const columnWidths = ganttColumnWidths(columns, range, axisWidth);\n const minGapMs = axisWidth > 0 ? (range.end.getTime() - range.start.getTime()) / axisWidth : 0;\n\n const unit: GanttColumnUnit = fitUnit ?? (monthWeeks ? \"week\" : ganttViewUnit(anchoredView));\n\n return {\n range,\n columns,\n columnWidths,\n axisWidth,\n paneWidth,\n paneKeys,\n isFit,\n anchoredView,\n unit,\n continuous,\n clamped: whole?.clamped ?? false,\n minGapMs,\n };\n}\n\nexport interface ScheduleGridOptions<R extends ScheduleRowShape> {\n rows: R[];\n rowId: (row: R) => string;\n columns: ScheduleColumn<R>[];\n /** How many columns the table has in total, including the timeline. */\n colCount: number;\n timelineColIndex: number;\n renderTrack: (row: R, axisWidth: number) => Array<Node | AnyZenComponent>;\n /** Uniform height for every row. See ROW_PX for why it cannot vary between them. */\n rowHeight?: number;\n /** Classes for one row (the whole strip: pane and timeline). */\n rowClass?: (row: R) => string | undefined;\n /** The scroller's maximum height (px, or any CSS length). Default 32rem. */\n maxBodyHeight?: number | string;\n /**\n * Classes for the header: the row and its frozen pane, applied after their\n * own, so a caller's background and text colour win\n * (`\"zen-bg-zen-primary-soft zen-text-zen-primary-soft-fg\"`).\n */\n headerClassName?: string;\n /**\n * A second header row above the column labels giving their date context: the\n * date above hours, the month above days or weeks, the year above months.\n * Each group's label stays in view while the axis scrolls sideways. Off by\n * default — the header is then exactly the single row it always was.\n */\n headerGroups?: boolean;\n /**\n * A strip under the rows, aligned to the axis and stuck to the bottom.\n * Rendered OUTSIDE the `treegrid` element: a div that is not a `row` inside a\n * grid is invalid ARIA, and a fake row would be counted by `aria-rowcount`.\n */\n renderFooter?: (context: ScheduleAxis) => Array<Node | AnyZenComponent>;\n\n axis: ScheduleAxis;\n view: GanttView;\n anchor: Date;\n now: Date;\n connectors?: GanttConnector[];\n connectorAccent?: (connector: GanttConnector) => boolean;\n /** The caller's colour and dash for one arrow. An accented arrow keeps the dash but not the colour. */\n connectorStyle?: (connector: GanttConnector) => GanttDependencyStyle | undefined;\n\n views?: GanttView[];\n hideToolbar?: boolean;\n /** A row of its own under the toolbar — the legend. Drawn even with the toolbar hidden. */\n legend?: Node | null;\n onViewChange: (view: GanttView) => void;\n onDateChange: (date: Date) => void;\n onToggle: (row: R) => void;\n onActivate?: (row: R) => void;\n\n /**\n * The scroller's measurements changed, so the caller must resolve the axis\n * again and `update()`.\n *\n * The other bindings do this with a signal; here it is a callback, and it is\n * the same loop: measure, recompute, redraw. It only fires when a number\n * actually moved, which is what stops the loop being one.\n */\n onMetrics?: (metrics: ScheduleMetrics) => void;\n\n ariaLabel: string;\n class?: string;\n}\n\nexport interface ScheduleGridHandle<R extends ScheduleRowShape> {\n readonly el: HTMLElement;\n update(next: Partial<ScheduleGridOptions<R>>): void;\n /** The last measured scroller box, for the caller's axis input. */\n metrics(): ScheduleMetrics;\n destroy(): void;\n}\n\nconst el = <K extends keyof HTMLElementTagNameMap>(\n tag: K,\n className?: string,\n text?: string,\n): HTMLElementTagNameMap[K] => {\n const node = document.createElement(tag);\n if (className) node.className = className;\n if (text !== undefined) node.textContent = text;\n return node;\n};\n\nconst isComponent = (v: Node | AnyZenComponent): v is AnyZenComponent =>\n typeof v === \"object\" && v !== null && \"el\" in v;\n\nexport function ScheduleGrid<R extends ScheduleRowShape>(\n options: ScheduleGridOptions<R>,\n): ScheduleGridHandle<R> {\n let current: ScheduleGridOptions<R> = { ...options };\n const loc = useLocale();\n /* The header's height, read by everything that has to clear it: the sticky\n row itself, scrolling a row into view, and the keyboard's page size. */\n const headerPx = () => HEADER_PX + (current.headerGroups ? GROUP_PX : 0);\n\n const root = el(\"div\");\n const toolbarSlot = el(\"div\");\n /* Its own row, not squeezed into the toolbar: a key of five or six entries\n beside the view switcher wrapped the switcher onto a line of its own at\n ordinary widths. Hidden when empty, or the column's gap would draw a\n blank band. */\n const legendSlot = el(\"div\");\n /* Built ONCE and never replaced. Everything else is torn down and rebuilt on\n update, but this node holds the scroll position, and replacing it would\n throw away the thing most updates are a reaction to. */\n const scroller = el(\n \"div\",\n \"zen-relative zen-max-h-[32rem] zen-overflow-auto zen-rounded-zen-md zen-border zen-border-zen-border focus-visible:zen-outline-none\",\n );\n scroller.tabIndex = -1;\n\n /* ---- the sideways scrollbar, kept to the axis ------------------------------ */\n /* One scroller means one native scrollbar, and it runs the scroller's whole\n width — under the frozen pane too, where it promises a pane that scrolls\n and then does not move it. The thumb's travel also reads against a track\n longer than the thing it scrolls.\n\n So a second scrollbar is laid exactly OVER the native one: blank under the\n pane, and a real scrollbar under the axis whose content is the axis' width.\n Both have the same scroll range (pane + axis - viewport on one side, axis -\n (viewport - pane) on the other), so `scrollLeft` copies across unscaled and\n under RTL keeps whatever sign the browser gives it.\n\n Over, not instead of: nothing is hidden or clipped, so the layout is the\n one it always was. Where scrollbars take no room (macOS, touch) the\n measured thickness is 0, nothing is shown, and the native overlay bar is\n left alone.\n\n Built once, like the scroller it sits on, and a SIBLING of it rather than\n a wrapper: the scroller stays the grid's parent and the toolbar's next\n sibling, which is how callers find it. */\n const axisBar = el(\"div\", \"zen-absolute zen-z-40 zen-flex zen-bg-zen-background\");\n /* Decoration over a scrollbar the keyboard and a screen reader already\n have: the scroller itself is what they scroll. */\n axisBar.setAttribute(\"aria-hidden\", \"true\");\n axisBar.setAttribute(\"data-schedule-scrollbar\", \"\");\n axisBar.style.display = \"none\";\n const axisBarPane = el(\"div\", \"zen-shrink-0 zen-border-e zen-border-zen-border\");\n axisBarPane.style.boxSizing = \"border-box\";\n const axisBarTrack = el(\"div\", \"zen-min-w-0 zen-flex-1 zen-overflow-x-scroll zen-overflow-y-hidden\");\n /* A scroller with nothing focusable in it is a tab stop of its own in\n Chrome, and the chart is exactly one. */\n axisBarTrack.tabIndex = -1;\n const axisBarFill = el(\"div\");\n axisBarFill.style.height = \"1px\";\n axisBarTrack.append(axisBarFill);\n axisBar.append(axisBarPane, axisBarTrack);\n /* Compared before it is written: an equal write fires no scroll event, and\n that is the whole of what stops the two from answering each other. */\n const copyScroll = (from: HTMLElement, to: HTMLElement) => {\n if (Math.abs(to.scrollLeft - from.scrollLeft) >= 1) to.scrollLeft = from.scrollLeft;\n };\n const followScroller = () => copyScroll(scroller, axisBarTrack);\n scroller.addEventListener(\"scroll\", followScroller, { passive: true });\n axisBarTrack.addEventListener(\"scroll\", () => copyScroll(axisBarTrack, scroller));\n /** Size the bar from the scrollbars the scroller actually has, or hide it. */\n const layoutAxisBar = () => {\n const edge = scroller.clientTop;\n const x = Math.max(0, scroller.offsetHeight - scroller.clientHeight - edge * 2);\n const y = Math.max(0, scroller.offsetWidth - scroller.clientWidth - edge * 2);\n const pane = current.axis.paneWidth;\n if (x === 0 || pane <= 0 || scroller.clientWidth - pane <= 0) {\n axisBar.style.display = \"none\";\n return;\n }\n axisBar.style.display = \"\";\n axisBar.style.bottom = `${edge}px`;\n axisBar.style.insetInlineStart = `${edge}px`;\n // Short of the corner the vertical scrollbar ends in.\n axisBar.style.insetInlineEnd = `${edge + y}px`;\n axisBar.style.height = `${x}px`;\n axisBarPane.style.width = `${pane}px`;\n axisBarFill.style.width = `${current.axis.axisWidth}px`;\n followScroller();\n };\n\n root.append(toolbarSlot, legendSlot, scroller, axisBar);\n\n let metrics: ScheduleMetrics = { top: 0, height: SCROLLER_MAX_PX, width: 0, left: 0 };\n\n /* ---- continuous axis: scrolled, not paged --------------------------------- */\n /** The axis viewport: the scroller minus the frozen pane that overlays it. */\n const viewportPx = () => Math.max(0, metrics.width - current.axis.paneWidth);\n const offsetOf = (t: Date) =>\n current.axis.minGapMs > 0 ? (t.getTime() - current.axis.range.start.getTime()) / current.axis.minGapMs : 0;\n /** The instant under the middle of the visible axis. What the title names. */\n const centreTime = () =>\n new Date(current.axis.range.start.getTime() + (metrics.left + viewportPx() / 2) * current.axis.minGapMs);\n /** Where Previous / Next step from: the middle of the screen when continuous. */\n const stepFrom = () => (current.axis.continuous ? centreTime() : current.anchor);\n /* Only the columns near the viewport are drawn on a continuous axis: an hourly\n zoom over six weeks is about a thousand columns, and every mounted row\n drawing all of them is tens of thousands of nodes. One viewport of overscan\n each side keeps a fast scroll from showing bare rows. */\n const columnWindow = () =>\n current.axis.continuous\n ? ganttColumnWindow(current.axis.columnWidths, metrics.left, viewportPx(), Math.max(viewportPx(), 400))\n : null;\n /** Indices to draw, and each one's offset when windowed (undefined when not). */\n const drawnColumns = (): { i: number; offset?: number }[] => {\n const win = columnWindow();\n return win\n ? win.offsets.map((offset, k) => ({ i: win.first + k, offset }))\n : current.axis.columns.map((_, i) => ({ i }));\n };\n // The toolbar's title, kept so a horizontal scroll can rename it in place.\n let titleEl: HTMLElement | null = null;\n const titleText = () =>\n current.axis.isFit\n ? ganttSpanLabel(current.axis.range)\n : ganttRangeLabel(current.axis.anchoredView, current.axis.continuous ? centreTime() : current.anchor);\n // The key the last scroll-to-anchor was for: a change of anchor, view or range.\n let scrolledFor = \"\";\n\n /* Handles built by the CURRENT render, destroyed before the next one: a\n Button or an Icon holds real listeners on nodes this file created, and\n there is no unmount here to take them away. */\n let owned: AnyZenComponent[] = [];\n let rowOwned: AnyZenComponent[] = [];\n let cleanups: Array<() => void> = [];\n const keep = <T extends AnyZenComponent>(comp: T): T => {\n owned.push(comp);\n return comp;\n };\n const on = (node: HTMLElement, type: string, handler: EventListener) => {\n node.addEventListener(type, handler);\n cleanups.push(() => node.removeEventListener(type, handler));\n };\n\n const rowHeight = () => current.rowHeight ?? ROW_PX;\n const cellCount = () => visibleColumns().length + 1;\n const visibleColumns = (): ScheduleColumn<R>[] =>\n current.axis.paneKeys\n .map((key) => current.columns.find((c) => c.key === key))\n .filter((c): c is ScheduleColumn<R> => c !== undefined);\n\n /* ---- keyboard state: one tab stop, roving tabindex ---- */\n let active = { row: 0, col: 0 };\n const activeRow = () => Math.min(Math.max(active.row, 0), Math.max(current.rows.length - 1, 0));\n const activeCol = () => Math.min(Math.max(active.col, 0), cellCount() - 1);\n let hadFocus = false;\n\n const windowOf = () =>\n ganttRowWindow(current.rows.length, rowHeight(), metrics.top, metrics.height);\n\n /* ---- the parts that persist across a row-band rebuild ---- */\n let gridEl: HTMLElement | null = null;\n let bodyEl: HTMLElement | null = null;\n let padTop: HTMLElement | null = null;\n let padBottom: HTMLElement | null = null;\n let rowsHost: HTMLElement | null = null;\n\n const attach = (parent: HTMLElement, parts: Array<Node | AnyZenComponent>, into: AnyZenComponent[]) => {\n for (const part of parts) {\n if (isComponent(part)) {\n into.push(part);\n parent.append(part.el);\n } else {\n parent.append(part);\n }\n }\n };\n\n function buildRow(row: R): HTMLElement {\n const win = windowOf();\n const tabRow = Math.min(Math.max(activeRow(), win.startIndex), Math.max(win.endIndex - 1, 0));\n const tabCol = row.index === tabRow ? activeCol() : -1;\n const columns = visibleColumns();\n\n const tint = current.rowClass?.(row);\n const node = el(\n \"div\",\n cn(\n \"zen-flex zen-border-b zen-border-zen-border last:zen-border-b-0\",\n /* The frozen pane is the row's CHILD, so it covers the row's content\n box and stops one pixel short of its bottom border. Whatever is drawn\n over the axis at that height then shows through the pane as it\n scrolls under: a dependency line routed along a row boundary crossed\n the whole pane, and the today marker left a dot on every rule. The\n pane redraws the rule itself, one pixel below its own box and at its\n own stacking level. Not on the last row, which has no rule to cover. */\n \"[&:not(:last-child)>div:first-child]:zen-shadow-[0_1px_0_0_var(--zen-color-border)]\",\n tint,\n ),\n );\n node.setAttribute(\"role\", \"row\");\n /* The row's TRUE position in the plan, +1 for the header. A windowed grid\n that numbers rows from the DOM tells a screen-reader user they are on row\n 3 of 26 when they are on row 4,812 of 10,000. */\n node.setAttribute(\"aria-rowindex\", String(row.index + 2));\n /* treegrid semantics, and the only place the tree is stated to a screen\n reader: the indent is a padding nobody can hear. */\n node.setAttribute(\"aria-level\", String(row.depth + 1));\n if (row.hasChildren) node.setAttribute(\"aria-expanded\", String(row.expanded));\n node.style.height = `${rowHeight()}px`;\n node.style.boxSizing = \"border-box\";\n\n const pane = el(\n \"div\",\n \"zen-sticky zen-z-20 zen-flex zen-shrink-0 zen-items-center zen-border-e zen-border-zen-border zen-bg-zen-background\",\n );\n pane.style.width = `${current.axis.paneWidth}px`;\n pane.style.insetInlineStart = \"0\";\n\n columns.forEach((column, col) => {\n const cell = el(\"div\", cn(\"zen-flex zen-items-center\", column.class ?? \"zen-px-2\", CELL_FOCUS_CLASS));\n cell.setAttribute(\"role\", \"gridcell\");\n cell.setAttribute(\"aria-colindex\", String(column.colIndex));\n /* How the keyboard finds a cell that may not have been in the DOM when\n the move was decided — see `focusCell`. */\n cell.setAttribute(\"data-gantt-cell\", `${row.index}:${col}`);\n cell.tabIndex = tabCol === col ? 0 : -1;\n const label = column.ariaLabel?.(row);\n if (label) cell.setAttribute(\"aria-label\", label);\n cell.style.width = `${column.width}px`;\n for (const [prop, value] of column.style?.(row) ?? []) cell.style.setProperty(prop, value);\n on(cell, \"focusin\", () => {\n active = { row: row.index, col };\n });\n attach(cell, column.render(row), rowOwned);\n pane.append(cell);\n });\n\n const track = el(\"div\", cn(\"zen-relative zen-shrink-0\", CELL_FOCUS_CLASS));\n track.setAttribute(\"role\", \"gridcell\");\n track.setAttribute(\"aria-colindex\", String(current.timelineColIndex));\n track.setAttribute(\"data-gantt-cell\", `${row.index}:${columns.length}`);\n track.tabIndex = tabCol === columns.length ? 0 : -1;\n track.style.width = `${current.axis.axisWidth}px`;\n on(track, \"focusin\", () => {\n active = { row: row.index, col: columns.length };\n });\n\n /* The column rules as a background layer rather than as parents of the bar:\n a bar spanning four days cannot live inside one day's box.\n\n On a row the caller has tinted (a rowClassName band) the shading turns\n TRANSLUCENT, so the band still shows on a weekend or on today. Only\n there: an untinted row keeps the shade it always had, because 40% of a\n pale grey over white all but disappears. color-mix rather than `/40`:\n the theme colours are bare var()s, and UnoCSS drops an alpha modifier on\n those without a word — `/40` has always come out fully opaque, which is\n the look every untinted chart has today. */\n const rules = el(\"div\", \"zen-absolute zen-inset-0 zen-flex\");\n rules.setAttribute(\"aria-hidden\", \"true\");\n for (const { i, offset } of drawnColumns()) {\n const column = current.axis.columns[i];\n const rule = el(\n \"div\",\n cn(\n \"zen-shrink-0 zen-border-e zen-border-zen-border last:zen-border-e-0\",\n offset !== undefined && \"zen-absolute zen-inset-y-0\",\n column.nonWorking &&\n (tint ? \"zen-bg-[color-mix(in_srgb,var(--zen-color-muted)_40%,transparent)]\" : \"zen-bg-zen-muted\"),\n column.today &&\n (tint ? \"zen-bg-[color-mix(in_srgb,var(--zen-color-primary-soft)_40%,transparent)]\" : \"zen-bg-zen-primary-soft\"),\n ),\n );\n rule.style.width = `${current.axis.columnWidths[i]}px`;\n if (offset !== undefined) rule.style.insetInlineStart = `${offset}px`;\n rules.append(rule);\n }\n track.append(rules);\n attach(track, current.renderTrack(row, current.axis.axisWidth), rowOwned);\n\n node.append(pane, track);\n return node;\n }\n\n /**\n * Rebuild ONLY the row band and its spacers.\n *\n * This is the whole reason the chrome and the rows are built separately. A\n * scroll changes which rows should exist and nothing else, and rebuilding the\n * toolbar, the header and the scroller to express that would discard the\n * scroll position that caused it.\n */\n function renderRows(): void {\n if (!rowsHost || !padTop || !padBottom) return;\n for (const handle of rowOwned) handle.destroy();\n rowOwned = [];\n rowsHost.replaceChildren();\n\n const win = windowOf();\n padTop.style.height = `${win.paddingTop}px`;\n padBottom.style.height = `${win.paddingBottom}px`;\n for (const row of current.rows.slice(win.startIndex, win.endIndex)) {\n rowsHost.append(buildRow(row));\n }\n }\n\n /** Move focus to a cell, scrolling it in first if it is not mounted. */\n function focusCell(rowIndex: number, col: number): void {\n active = { row: rowIndex, col };\n\n /* The header is sticky and covers the top headerPx() of the viewport, so a\n row scrolled flush to the top is a row hidden behind the column titles. */\n const rowTop = headerPx() + rowIndex * rowHeight();\n const upper = rowTop - headerPx();\n const lower = rowTop + rowHeight() - scroller.clientHeight;\n const next = Math.max(0, Math.min(Math.max(scroller.scrollTop, lower), upper));\n if (next !== scroller.scrollTop) {\n scroller.scrollTop = next;\n metrics = { ...metrics, top: next };\n }\n /* Synchronously, and this is where having no framework pays: the rows exist\n the moment the call returns, so there is nothing to defer and no second\n pass to arrange. Solid needed a microtask here and React a layout effect. */\n renderRows();\n\n const cell = scroller.querySelector<HTMLElement>(`[data-gantt-cell=\"${rowIndex}:${col}\"]`);\n if (!cell) return;\n hadFocus = true;\n /* preventScroll, then adjusted by hand. The browser's own scrolling would\n drag the timeline cell — the whole axis wide — fully into view, jumping\n the axis to a place nobody asked for. */\n cell.focus({ preventScroll: true });\n\n /* Sideways, from rects rather than offsets, so RTL needs no special case: a\n relative `scrollLeft` nudge in physical pixels means the same under either\n of the browsers' two RTL conventions. The BAR, not the cell — the cell\n spans the entire axis. */\n const bar = cell.querySelector<HTMLElement>(\"[data-gantt-bar]\");\n if (!bar) return;\n const box = bar.getBoundingClientRect();\n const viewport = scroller.getBoundingClientRect();\n const rtl = getComputedStyle(scroller).direction === \"rtl\";\n const pane = current.axis.paneWidth;\n const minX = rtl ? viewport.left : viewport.left + pane;\n const maxX = rtl ? viewport.right - pane : viewport.right;\n if (box.left < minX) scroller.scrollLeft -= minX - box.left;\n else if (box.right > maxX) scroller.scrollLeft += Math.min(box.right - maxX, box.left - minX);\n }\n\n function onGridKeyDown(event: KeyboardEvent): void {\n if (event.altKey || event.metaKey) return;\n /* Arrow keys follow the VISUAL direction, which is what APG specifies and\n what a reader expects from the key with an arrow drawn on it. */\n const rtl = getComputedStyle(scroller).direction === \"rtl\";\n const forward = rtl ? \"ArrowLeft\" : \"ArrowRight\";\n const backward = rtl ? \"ArrowRight\" : \"ArrowLeft\";\n const page = Math.max(1, Math.floor((metrics.height - headerPx()) / rowHeight()));\n const last = current.rows.length - 1;\n const row = current.rows[activeRow()];\n\n let nextRow = activeRow();\n let nextCol = activeCol();\n\n switch (event.key) {\n case \"ArrowDown\":\n nextRow = Math.min(last, activeRow() + 1);\n break;\n case \"ArrowUp\":\n nextRow = Math.max(0, activeRow() - 1);\n break;\n case forward:\n /* On the first column, forward EXPANDS a closed parent rather than\n moving — the treegrid pattern, and the only way to open a subtree\n without a pointer. */\n if (activeCol() === 0 && row?.hasChildren && !row.expanded) {\n event.preventDefault();\n current.onToggle(row);\n return;\n }\n nextCol = Math.min(cellCount() - 1, activeCol() + 1);\n break;\n case backward:\n if (activeCol() === 0 && row?.hasChildren && row.expanded) {\n event.preventDefault();\n current.onToggle(row);\n return;\n }\n nextCol = Math.max(0, activeCol() - 1);\n break;\n case \"Home\":\n nextCol = 0;\n if (event.ctrlKey) nextRow = 0;\n break;\n case \"End\":\n nextCol = cellCount() - 1;\n if (event.ctrlKey) nextRow = last;\n break;\n case \"PageDown\":\n nextRow = Math.min(last, activeRow() + page);\n break;\n case \"PageUp\":\n nextRow = Math.max(0, activeRow() - page);\n break;\n case \"Enter\":\n case \" \":\n event.preventDefault();\n if (row) current.onActivate?.(row);\n return;\n default:\n return;\n }\n\n // Swallowed even at an edge, or ArrowDown on the last row scrolls the PAGE\n // while the chart appears to ignore it.\n event.preventDefault();\n if (nextRow === activeRow() && nextCol === activeCol()) return;\n focusCell(nextRow, nextCol);\n }\n\n function buildToolbar(): HTMLElement {\n const bar = el(\"div\", \"zen-flex zen-flex-wrap zen-items-center zen-gap-2\");\n\n /* GONE under fit, not disabled and not left live. A fit axis has no anchor\n to move, so Previous, Today and Next have nothing to change — and three\n buttons that visibly do nothing are read as a broken chart. */\n if (!current.axis.isFit) {\n const prev = keep(\n Button({\n variant: \"outline\",\n size: \"sm\",\n \"aria-label\": loc.t(\"scheduleGrid.previous\"),\n // Logical, not physical: under RTL the axis runs the other way.\n children: keep(Icon({ name: \"chevron-left\", size: 14, class: \"rtl:zen-rotate-180\" })),\n /* Continuous: a period back from what is ON SCREEN, not from an anchor\n the user may have scrolled a month away from. */\n onClick: () => current.onDateChange(shiftGanttAnchor(current.axis.anchoredView, stepFrom(), -1)),\n }),\n );\n const today = keep(\n Button({\n variant: \"outline\",\n size: \"sm\",\n children: loc.t(\"scheduleGrid.today\"),\n onClick: () => current.onDateChange(current.now),\n }),\n );\n const next = keep(\n Button({\n variant: \"outline\",\n size: \"sm\",\n \"aria-label\": loc.t(\"scheduleGrid.next\"),\n children: keep(Icon({ name: \"chevron-right\", size: 14, class: \"rtl:zen-rotate-180\" })),\n onClick: () => current.onDateChange(shiftGanttAnchor(current.axis.anchoredView, stepFrom(), 1)),\n }),\n );\n bar.append(prev.el, today.el, next.el);\n }\n\n const label = el(\"span\", \"zen-mx-1 zen-text-sm zen-font-medium zen-text-zen-foreground\", titleText());\n titleEl = label;\n /* \"29 Jun – 31 Jul 2026\" opens with a number, and bidi reorders a leading\n number to the far side of an RTL run — it renders as \"Jun – 31 Jul 2026\n 29\". `auto` rather than `ltr` because the month names come from\n `toLocaleString`: under an Arabic locale the label really is RTL. */\n label.setAttribute(\"dir\", \"auto\");\n bar.append(label);\n\n const switcher = el(\"div\", \"zen-ms-auto zen-flex zen-gap-1\");\n switcher.setAttribute(\"role\", \"group\");\n switcher.setAttribute(\"aria-label\", loc.t(\"scheduleGrid.view\"));\n for (const v of current.views ?? ALL_VIEWS) {\n const button = keep(\n Button({\n variant: current.view === v ? \"solid\" : \"outline\",\n size: \"sm\",\n // A boolean would land as aria-pressed=\"\" (the helper writes\n // booleans as presence attributes), which reads as unset.\n \"aria-pressed\": String(current.view === v),\n children: loc.t(VIEW_LABEL[v]),\n onClick: () => {\n /* A continuous zoom change re-anchors to the middle of what is on\n screen first, so zooming keeps the reader's place. */\n if (current.axis.continuous && v !== \"fit\") current.onDateChange(centreTime());\n current.onViewChange(v);\n },\n }),\n );\n switcher.append(button.el);\n }\n bar.append(switcher);\n return bar;\n }\n\n function buildHeader(): HTMLElement {\n const header = el(\n \"div\",\n cn(\"zen-sticky zen-top-0 zen-z-30 zen-flex zen-border-b zen-border-zen-border zen-bg-zen-muted\", current.headerClassName),\n );\n header.setAttribute(\"role\", \"row\");\n header.setAttribute(\"aria-rowindex\", \"1\");\n header.style.height = `${headerPx()}px`;\n header.style.boxSizing = \"border-box\";\n\n const pane = el(\n \"div\",\n cn(\n \"zen-sticky zen-z-40 zen-flex zen-shrink-0 zen-items-center zen-border-e zen-border-zen-border zen-bg-zen-muted zen-text-xs zen-font-semibold zen-text-zen-muted-fg\",\n current.headerClassName,\n ),\n );\n pane.style.width = `${current.axis.paneWidth}px`;\n pane.style.insetInlineStart = \"0\";\n for (const column of visibleColumns()) {\n const cell = el(\"div\", cn(\"zen-truncate\", column.class ?? \"zen-px-2\"), column.label);\n cell.setAttribute(\"role\", \"columnheader\");\n cell.setAttribute(\"aria-colindex\", String(column.colIndex));\n cell.style.width = `${column.width}px`;\n pane.append(cell);\n }\n\n const axis = el(\"div\", current.headerGroups ? \"zen-flex zen-flex-col\" : \"zen-flex\");\n axis.setAttribute(\"role\", \"columnheader\");\n axis.setAttribute(\"aria-colindex\", String(current.timelineColIndex));\n axis.setAttribute(\"aria-label\", loc.t(\"scheduleGrid.timeline\"));\n axis.style.width = `${current.axis.axisWidth}px`;\n // The cells' parent: the header itself without groups, a marked row with.\n const parent = current.headerGroups ? el(\"div\") : axis;\n /* Windowed: positioned cells in a full-width box, so the header still spans\n the whole axis and lines up with the rows below it. */\n const windowed = current.axis.continuous;\n const cells = windowed ? el(\"div\", \"zen-relative zen-h-full zen-w-full\") : parent;\n if (windowed) {\n cells.setAttribute(\"data-schedule-windowed\", \"\");\n parent.append(cells);\n }\n for (const { i, offset } of drawnColumns()) {\n const column = current.axis.columns[i];\n const cell = el(\n \"div\",\n cn(\n \"zen-flex zen-shrink-0 zen-flex-col zen-items-center zen-justify-center zen-overflow-hidden zen-border-e zen-border-zen-border last:zen-border-e-0\",\n offset !== undefined && \"zen-absolute zen-inset-y-0\",\n column.nonWorking && \"zen-bg-zen-muted\",\n column.today && \"zen-bg-zen-primary-soft\",\n ),\n );\n cell.style.width = `${current.axis.columnWidths[i]}px`;\n if (offset !== undefined) cell.style.insetInlineStart = `${offset}px`;\n cell.append(el(\"span\", \"zen-text-xs zen-font-medium zen-text-zen-foreground\", column.label));\n if (column.sublabel) {\n cell.append(el(\"span\", \"zen-[font-size:var(--zen-schedule-label-font-size)] zen-text-zen-muted-fg\", column.sublabel));\n }\n cells.append(cell);\n }\n\n /* Without groups the cells are the header's direct children, exactly as\n before; with them, the group row sits above and the cells move into a\n marked row of their own. */\n if (current.headerGroups) {\n const widths = current.axis.columnWidths;\n const strip = el(\"div\", \"zen-flex zen-shrink-0 zen-border-b zen-border-zen-border\");\n // aria-hidden: the column labels and the toolbar's range title already say\n // the date to a screen reader.\n strip.setAttribute(\"aria-hidden\", \"true\");\n strip.setAttribute(\"data-schedule-groups\", \"\");\n strip.style.height = `${GROUP_PX}px`;\n strip.style.boxSizing = \"border-box\";\n for (const group of ganttHeaderGroups(current.axis.columns, current.axis.unit)) {\n const width = widths.slice(group.firstColumn, group.firstColumn + group.columnCount).reduce((a, b) => a + b, 0);\n // No overflow clipping on the group: a clipping ancestor becomes the\n // label's scroll container and `sticky` stops working.\n const cell = el(\"div\", \"zen-shrink-0 zen-border-e zen-border-zen-border last:zen-border-e-0\");\n cell.setAttribute(\"data-schedule-group\", \"\");\n cell.style.width = `${width}px`;\n /* \"July 2026\" where it fits, \"Jul\" where it does not: two narrow days of\n June truncated \"June 2026\" to \"Ju…\", which names no month at all.\n Estimated (about 7px a character at text-xs, plus the padding), so\n the choice is stable and costs no layout read. */\n const label = el(\n \"span\",\n \"zen-sticky zen-inline-block zen-max-w-full zen-truncate zen-px-2 zen-align-top zen-text-xs zen-font-semibold zen-text-zen-foreground\",\n width >= group.label.length * 7 + 16 ? group.label : group.shortLabel,\n );\n // Sticky just past the frozen pane, so the month or the date stays on\n // screen while its columns scroll by.\n label.style.insetInlineStart = `${current.axis.paneWidth}px`;\n label.style.lineHeight = `${GROUP_PX - 1}px`;\n cell.append(label);\n strip.append(cell);\n }\n parent.setAttribute(\"data-schedule-axis-row\", \"\");\n parent.className = \"zen-flex zen-min-h-0 zen-flex-1\";\n axis.append(strip, parent);\n }\n\n header.append(pane, axis);\n return header;\n }\n\n function buildConnectors(): SVGSVGElement | null {\n const links = current.connectors;\n if (!links || links.length === 0) return null;\n const height = current.rows.length * rowHeight();\n const svg = document.createElementNS(\"http://www.w3.org/2000/svg\", \"svg\");\n svg.setAttribute(\"aria-hidden\", \"true\");\n /* Mirrored under RTL rather than recomputed: the bars are placed with\n logical inset properties, so the axis is already flipped and the routes\n have to flip with it — arrowheads included. */\n svg.setAttribute(\n \"class\",\n \"zen-pointer-events-none zen-absolute zen-top-0 zen-z-10 rtl:-zen-scale-x-100\",\n );\n svg.setAttribute(\"width\", String(current.axis.axisWidth));\n svg.setAttribute(\"height\", String(height));\n svg.setAttribute(\"viewBox\", `0 0 ${current.axis.axisWidth} ${height}`);\n svg.style.insetInlineStart = `${current.axis.paneWidth}px`;\n\n for (const connector of links) {\n const accented = current.connectorAccent?.(connector) ?? false;\n const styled = current.connectorStyle?.(connector);\n /* zen-stroke-* / zen-fill-* generate nothing under this preset — the\n token has to be named directly. A broken link stays red whatever its\n kind; its dash survives, so it still says which kind it was. */\n const tone = accented ? \"var(--zen-color-error)\" : (styled?.color ?? \"var(--zen-color-muted-fg)\");\n const group = document.createElementNS(\"http://www.w3.org/2000/svg\", \"g\");\n const path = document.createElementNS(\"http://www.w3.org/2000/svg\", \"path\");\n path.setAttribute(\"d\", connector.d);\n path.setAttribute(\"fill\", \"none\");\n path.setAttribute(\"stroke\", tone);\n if (styled?.dash) path.setAttribute(\"stroke-dasharray\", styled.dash);\n /* Thicker as well as red: colour alone is not a signal on a chart that\n already uses red for delay. */\n path.setAttribute(\"stroke-width\", accented ? \"2.25\" : \"1.5\");\n const head = document.createElementNS(\"http://www.w3.org/2000/svg\", \"polygon\");\n head.setAttribute(\n \"points\",\n [\n `${connector.arrow.x},${connector.arrow.y}`,\n `${connector.arrow.x - connector.arrow.dir * ARROW_PX * 1.6},${connector.arrow.y - ARROW_PX}`,\n `${connector.arrow.x - connector.arrow.dir * ARROW_PX * 1.6},${connector.arrow.y + ARROW_PX}`,\n ].join(\" \"),\n );\n head.setAttribute(\"fill\", tone);\n group.append(path, head);\n svg.append(group);\n }\n return svg;\n }\n\n /** Rebuild the chrome. Everything except the scroller node itself. */\n function render(): void {\n for (const handle of owned) handle.destroy();\n for (const handle of rowOwned) handle.destroy();\n for (const off of cleanups) off();\n owned = [];\n rowOwned = [];\n cleanups = [];\n\n /* Positioned only so the axis scrollbar can be pinned to the foot of the\n scroller, which is always the last thing above it in here. */\n root.className = cn(\"zen-relative zen-flex zen-w-full zen-flex-col zen-gap-3\", current.class);\n // maxBodyHeight replaces the 32rem cap only when it is set.\n const cap = current.maxBodyHeight;\n scroller.classList.toggle(\"zen-max-h-[32rem]\", cap === undefined);\n scroller.style.maxHeight = cap === undefined ? \"\" : typeof cap === \"number\" ? `${cap}px` : cap;\n toolbarSlot.replaceChildren();\n if (!current.hideToolbar) toolbarSlot.append(buildToolbar());\n legendSlot.replaceChildren();\n legendSlot.hidden = !current.legend;\n if (current.legend) legendSlot.append(current.legend);\n\n /* Saved and restored around the swap: the content is briefly shorter while\n the grid is empty, and a browser clamps scrollTop the moment it is. */\n const savedTop = scroller.scrollTop;\n const savedLeft = scroller.scrollLeft;\n /* And the FOCUS, which is the one the other two bindings get for free.\n React keeps a row's DOM through `key`, Solid through `<Index>`; here a\n render genuinely replaces every node, so the focused cell stops existing.\n Focus then falls to <body> and the next arrow key goes to the document\n instead of the grid: collapsing a phase worked and expanding it again did\n nothing, because the keystroke never arrived. */\n const refocus = scroller.contains(document.activeElement);\n scroller.replaceChildren();\n\n gridEl = el(\"div\");\n gridEl.style.width = `${current.axis.paneWidth + current.axis.axisWidth}px`;\n /* treegrid, not grid: the rows form a tree, and that is what makes left and\n right on the first column mean collapse and expand. */\n gridEl.setAttribute(\"role\", \"treegrid\");\n /* The TRUE totals, not the windowed ones — without them a screen reader\n counts the DOM and announces \"row 3 of 26\" in a 10,000-row plan. */\n gridEl.setAttribute(\"aria-rowcount\", String(current.rows.length + 1));\n gridEl.setAttribute(\"aria-colcount\", String(current.colCount));\n gridEl.setAttribute(\"aria-label\", current.ariaLabel);\n on(gridEl, \"keydown\", onGridKeyDown as EventListener);\n\n gridEl.append(buildHeader());\n\n bodyEl = el(\"div\", \"zen-relative\");\n bodyEl.style.height = `${current.rows.length * rowHeight()}px`;\n /* Spacers stand in for the rows that are not mounted, so the scrollbar\n measures the whole plan rather than the window. Spacers rather than a\n transform on purpose: a transformed ancestor makes `position: sticky`\n resolve against IT instead of the scroll container, and the frozen pane\n would come unstuck the moment the window moved. */\n padTop = el(\"div\");\n padTop.setAttribute(\"aria-hidden\", \"true\");\n rowsHost = el(\"div\");\n padBottom = el(\"div\");\n padBottom.setAttribute(\"aria-hidden\", \"true\");\n bodyEl.append(padTop, rowsHost, padBottom);\n\n const marker = nowPct(current.axis.range, current.now);\n if (marker !== null) {\n const line = el(\"div\", \"zen-pointer-events-none zen-absolute zen-top-0 zen-z-10 zen-w-px zen-bg-zen-error\");\n line.setAttribute(\"aria-hidden\", \"true\");\n line.style.height = `${current.rows.length * rowHeight()}px`;\n line.style.insetInlineStart = `${current.axis.paneWidth + (marker / 100) * current.axis.axisWidth}px`;\n bodyEl.append(line);\n }\n\n /* The connector overlay is deliberately NOT windowed: a link between two\n off-screen tasks still routes through the visible band, and culling it\n would blink connectors in and out as their endpoints scrolled away. */\n const svg = buildConnectors();\n if (svg) bodyEl.append(svg);\n\n gridEl.append(bodyEl);\n scroller.append(gridEl);\n\n if (current.renderFooter) {\n const footer = el(\n \"div\",\n \"zen-sticky zen-bottom-0 zen-z-30 zen-flex zen-border-t zen-border-zen-border zen-bg-zen-muted\",\n );\n footer.style.width = `${current.axis.paneWidth + current.axis.axisWidth}px`;\n attach(footer, current.renderFooter(current.axis), owned);\n scroller.append(footer);\n }\n\n renderRows();\n scroller.scrollTop = savedTop;\n scroller.scrollLeft = savedLeft;\n\n /* Continuous: bring the anchor's period to the inline start whenever the\n ANCHOR, the view or the range changes (what Previous / Next / Today and a\n zoom change come down to). Keyed, so a re-render for any other reason\n keeps the user's own scroll. Waits for the first measurement. */\n if (current.axis.continuous && metrics.width > 0) {\n const key = `${current.view}|${current.anchor.getTime()}|${current.axis.range.start.getTime()}|${current.axis.range.end.getTime()}`;\n if (key !== scrolledFor) {\n scrolledFor = key;\n const x = Math.max(0, offsetOf(ganttRange(current.axis.anchoredView, current.anchor).start));\n scroller.scrollLeft = getComputedStyle(scroller).direction === \"rtl\" ? -x : x;\n // The scroll event redraws the window and renames the title.\n }\n }\n\n if (refocus) {\n const cell = scroller.querySelector<HTMLElement>(\n `[data-gantt-cell=\"${activeRow()}:${activeCol()}\"]`,\n );\n /* The scroller itself when the row is no longer mounted — still inside\n the chart, still where they left it, and Tab continues from there. */\n (cell ?? scroller).focus({ preventScroll: true });\n }\n\n layoutAxisBar();\n }\n\n /* ---- measurement, and the loop it closes with the caller ---- */\n const measure = () => {\n /* Before the bail below: a scrollbar can come and go with the rows while\n every number this function compares stays the same. */\n layoutAxisBar();\n const next = {\n top: scroller.scrollTop,\n height: scroller.clientHeight,\n width: scroller.clientWidth,\n // Chrome reports an RTL scrollLeft as negative; the axis thinks in logical px.\n left: Math.abs(scroller.scrollLeft),\n };\n const movedWindow = next.top !== metrics.top || next.height !== metrics.height;\n const movedBox = next.width !== metrics.width || next.height !== metrics.height;\n const movedSideways = next.left !== metrics.left;\n if (!movedWindow && !movedBox && !movedSideways) return;\n metrics = next;\n /* A sideways scroll of a continuous axis changes which COLUMNS are drawn\n and what the title names: redraw the header and the rows, rename the\n title in place (rebuilding the toolbar would take focus off its buttons). */\n if (movedSideways && !movedBox && current.axis.continuous && gridEl) {\n gridEl.firstElementChild?.replaceWith(buildHeader());\n if (titleEl) titleEl.textContent = titleText();\n renderRows();\n return;\n }\n /* A scroll changes which rows exist and nothing else, so it never leaves\n this file. A width change does — the axis is sized from it — so the\n caller is told and comes back through update(). */\n if (movedBox) current.onMetrics?.(metrics);\n else renderRows();\n };\n\n let frame = 0;\n const onScroll = () => {\n if (frame === 0)\n frame = requestAnimationFrame(() => {\n frame = 0;\n measure();\n /* Focus rescue. Scrolling a focused cell out of the window unmounts it\n and the browser drops focus to <body> — so the next Tab restarts from\n the top of the PAGE, stranding a keyboard user who was reading row\n 4,000. This puts focus on the scroller instead: still inside the\n chart, still scrolled where they left it. */\n if (hadFocus && document.activeElement === document.body) {\n scroller.focus({ preventScroll: true });\n }\n });\n };\n scroller.addEventListener(\"scroll\", onScroll, { passive: true });\n const observer = new ResizeObserver(onScroll);\n observer.observe(scroller);\n scroller.addEventListener(\"focusin\", () => {\n hadFocus = true;\n });\n\n render();\n // First real measurement: the seeded width is 0, which the pane reads as\n // \"unmeasured\" rather than as a zero-width container.\n queueMicrotask(measure);\n\n return {\n el: root,\n update(next) {\n current = { ...current, ...next };\n render();\n },\n metrics: () => metrics,\n destroy() {\n for (const handle of owned) handle.destroy();\n for (const handle of rowOwned) handle.destroy();\n for (const off of cleanups) off();\n owned = [];\n rowOwned = [];\n cleanups = [];\n if (frame !== 0) cancelAnimationFrame(frame);\n scroller.removeEventListener(\"scroll\", onScroll);\n scroller.removeEventListener(\"scroll\", followScroller);\n observer.disconnect();\n root.remove();\n },\n };\n}\n"],"names":["ROW_PX","HEADER_PX","GROUP_PX","INDENT_PX","COLUMN_PX","FIT_MIN_COLUMN_PX","MONTH_WEEK_PX","MIN_COLUMN_PX","MIN_AXIS_PX","ARROW_PX","SCROLLER_MAX_PX","CELL_FOCUS_CLASS","VIEW_LABEL","ALL_VIEWS","resolveScheduleAxis","input","isFit","anchoredView","fitUnit","ganttFitUnit","hourStep","ganttFitHourStep","continuous","whole","ganttContinuousRange","range","ganttRange","monthWeeks","options","columns","ganttRangeColumns","ganttViewUnit","ganttColumns","floorAxis","ceilingAxis","widths","column","paneKeys","ganttPaneColumns","c","paneWidth","sum","key","natural","axisWidth","columnWidths","ganttColumnWidths","minGapMs","unit","el","tag","className","text","node","isComponent","v","ScheduleGrid","current","loc","useLocale","headerPx","root","toolbarSlot","legendSlot","scroller","axisBar","axisBarPane","axisBarTrack","axisBarFill","copyScroll","from","to","followScroller","layoutAxisBar","edge","x","y","pane","metrics","viewportPx","offsetOf","centreTime","stepFrom","columnWindow","ganttColumnWindow","drawnColumns","win","offset","k","_","titleEl","titleText","ganttSpanLabel","ganttRangeLabel","scrolledFor","owned","rowOwned","cleanups","keep","comp","on","type","handler","rowHeight","cellCount","visibleColumns","active","activeRow","activeCol","hadFocus","windowOf","ganttRowWindow","gridEl","bodyEl","padTop","padBottom","rowsHost","attach","parent","parts","into","part","buildRow","row","tabRow","tabCol","tint","cn","col","cell","label","prop","value","track","rules","i","rule","renderRows","handle","focusCell","rowIndex","rowTop","upper","lower","next","bar","box","viewport","rtl","minX","maxX","onGridKeyDown","event","forward","backward","page","last","nextRow","nextCol","buildToolbar","prev","Button","Icon","shiftGanttAnchor","today","switcher","button","buildHeader","header","axis","windowed","cells","strip","group","ganttHeaderGroups","width","a","b","buildConnectors","links","height","svg","connector","accented","styled","tone","path","head","render","off","cap","savedTop","savedLeft","refocus","marker","nowPct","line","footer","measure","movedWindow","movedBox","movedSideways","frame","onScroll","observer"],"mappings":";;;;;;;;;AA+DO,MAAMA,KAAS,IACTC,KAAY,IAEZC,KAAW,IAEXC,KAAY,IAGnBC,KAA+C;AAAA,EACnD,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AACR,GAGMC,KAAqD;AAAA,EACzD,MAAM;AAAA,EACN,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AACT,GAUMC,KAAgB,EAAE,KAAK,IAAI,KAAK,IAAA,GAEhCC,KAAmD;AAAA,EACvD,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AACR,GAGMC,KAAc,KAEdC,KAAW,GAEXC,KAAkB,KAElBC,KACJ,wHAEIC,KAA4C;AAAA,EAChD,KAAK;AAAA,EACL,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,SAAS;AAAA,EACT,MAAM;AACR,GAIaC,KAAyB,CAAC,OAAO,OAAO,QAAQ,SAAS,WAAW,MAAM;AA0FhF,SAASC,GAAoBC,GAAwC;AAC1E,QAAMC,IAAQD,EAAM,SAAS,OAKvBE,IAAkCD,IAAQ,UAAWD,EAAM,MAE3DG,IAAUH,EAAM,WAClBI,GAAaJ,EAAM,SAAS,IAAI,QAAA,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
8
|
+
const r = c(t, e), o = c(n, e), s = [];
|
|
9
|
+
for (let a = r; a <= o; a += e)
|
|
10
|
+
s.push(a);
|
|
11
|
+
return s;
|
|
12
|
+
}
|
|
13
|
+
function h(t, n) {
|
|
14
|
+
return t.find((e) => e.startIndex === n);
|
|
15
|
+
}
|
|
16
|
+
function g(t, n, e) {
|
|
17
|
+
const r = t.startIndex + t.length - 1;
|
|
18
|
+
return n >= t.startIndex && e <= r;
|
|
19
|
+
}
|
|
20
|
+
function E(t, n, e, r) {
|
|
21
|
+
const o = d(n, e, r), s = [];
|
|
22
|
+
for (const a of o) {
|
|
23
|
+
const u = a + r - 1, i = Math.max(n, a), l = Math.min(e, u), f = h(t, a);
|
|
24
|
+
f && f.length > 0 && g(f, i, l) || s.push(a);
|
|
25
|
+
}
|
|
26
|
+
return s;
|
|
27
|
+
}
|
|
28
|
+
function I(t, n, e, r) {
|
|
29
|
+
if (r <= 0 || t.length === 0)
|
|
30
|
+
return [...t];
|
|
31
|
+
const o = Math.max(0, c(n, r) - r), s = c(e, r) + r * 2 - 1;
|
|
32
|
+
return t.filter((a) => a.startIndex + Math.max(a.length, 1) - 1 >= o && a.startIndex <= s);
|
|
33
|
+
}
|
|
34
|
+
function R(t, n, e) {
|
|
35
|
+
let r = t[0], o = Math.abs(r + e / 2 - n);
|
|
36
|
+
for (let s = 1; s < t.length; s++) {
|
|
37
|
+
const a = t[s], u = Math.abs(a + e / 2 - n);
|
|
38
|
+
u < o && (r = a, o = u);
|
|
39
|
+
}
|
|
40
|
+
return r;
|
|
41
|
+
}
|
|
42
|
+
const v = 4;
|
|
43
|
+
function M(t) {
|
|
44
|
+
return t.map((n) => ({
|
|
45
|
+
startIndex: n.startIndex,
|
|
46
|
+
length: n.values.length
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
function _(t, n, e) {
|
|
50
|
+
const r = t.startIndex + t.values.length - 1;
|
|
51
|
+
return n < t.startIndex || e > r ? !1 : e - t.startIndex < t.values.length;
|
|
52
|
+
}
|
|
53
|
+
function p(t, n, e, r) {
|
|
54
|
+
return E(M(t), n, e, r).filter(
|
|
55
|
+
(o) => {
|
|
56
|
+
const s = o + r - 1;
|
|
57
|
+
return !L(n, s, t, e);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
function L(t, n, e, r) {
|
|
62
|
+
const o = Math.min(r, n);
|
|
63
|
+
if (o < t)
|
|
64
|
+
return !1;
|
|
65
|
+
for (const s of e) {
|
|
66
|
+
if (s.values.length === 0 || r < s.startIndex || s.startIndex - t > v)
|
|
67
|
+
continue;
|
|
68
|
+
const a = Math.min(
|
|
69
|
+
r,
|
|
70
|
+
s.startIndex + s.values.length - 1
|
|
71
|
+
);
|
|
72
|
+
if (o < s.startIndex && _(s, s.startIndex, a))
|
|
73
|
+
return !0;
|
|
74
|
+
}
|
|
75
|
+
return !1;
|
|
76
|
+
}
|
|
77
|
+
function A(t, n, e, r) {
|
|
78
|
+
return I(
|
|
79
|
+
t.map((o) => ({
|
|
80
|
+
startIndex: o.startIndex,
|
|
81
|
+
length: o.values.length,
|
|
82
|
+
window: o
|
|
83
|
+
})),
|
|
84
|
+
n,
|
|
85
|
+
e,
|
|
86
|
+
r
|
|
87
|
+
).map((o) => o.window);
|
|
88
|
+
}
|
|
89
|
+
function C(t, n) {
|
|
90
|
+
for (const e of t) {
|
|
91
|
+
const r = n - e.startIndex;
|
|
92
|
+
if (r >= 0 && r < e.values.length)
|
|
93
|
+
return e.values[r];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
2
96
|
export {
|
|
3
|
-
|
|
97
|
+
v as PIVOT_FILTER_LEADING_OVERSCAN_SLACK,
|
|
98
|
+
W as VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS,
|
|
99
|
+
x as VIRTUAL_SCROLL_WINDOW_PAGE_SIZE,
|
|
100
|
+
c as alignWindowStart,
|
|
101
|
+
E as missingWindowStarts,
|
|
102
|
+
R as pickNearestWindowStart,
|
|
103
|
+
p as pivotFilterMissingWindowStarts,
|
|
104
|
+
C as pivotFilterWindowValueAt,
|
|
105
|
+
A as prunePivotFilterWindows,
|
|
106
|
+
I as pruneWindowsByRange,
|
|
107
|
+
d as requiredWindowStarts
|
|
4
108
|
};
|
|
5
109
|
//# sourceMappingURL=index239.js.map
|
package/dist/index239.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index239.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
1
|
+
{"version":3,"file":"index239.js","sources":["../../core/src/virtual-window.ts"],"sourcesContent":["/**\n * Window maths for virtualized, server-paged lists.\n *\n * Framework-agnostic and, unlike the rest of the pivot, not pivot-specific:\n * page alignment, which windows are missing for a visible range, pruning what\n * has scrolled away, and picking the nearest page to fetch next. Nothing else\n * in the library does this — DataTable virtualizes rows it already has, and\n * VirtualizedItems takes a materialized array — so this is real infrastructure\n * rather than a duplicate.\n *\n * It lived in packages/solid/src/components/pivot/internal, where its own\n * doc comment said it was meant to keep \"pivot grids, filter dropdowns, and\n * future large lists consistent\" — a cross-cutting intent, filed somewhere\n * nothing could cross-cut to, and unreachable from React entirely.\n *\n * Pinned by scripts/check-virtual-window.ts.\n */\n\n/** Debounce after scroll settles before fetching the next data window. */\nexport const VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS = 200;\n\n/** Default server page size for sliding row/value windows (TM1-style segments). */\nexport const VIRTUAL_SCROLL_WINDOW_PAGE_SIZE = 50;\n\n/** Aligns an index down to the start of its page-sized window. */\nexport function alignWindowStart(minIndex: number, windowSize: number): number {\n if (windowSize <= 0) {\n return 0;\n }\n // Clamped at 0: Math.floor(-5 / 50) * 50 is -50, and a negative page start\n // becomes `offset: -50` in a fetch — which a server answers with a 400 or,\n // worse, with something. A virtualizer's overscan subtracts from the first\n // visible index, so a negative arrives here the moment anyone scrolls to the\n // top of a list without clamping first.\n if (minIndex <= 0) {\n return 0;\n }\n return Math.floor(minIndex / windowSize) * windowSize;\n}\n\n/** Page-aligned offsets that intersect `[minIndex, maxIndex]`. */\nexport function requiredWindowStarts(\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): number[] {\n // An inverted range is not a range. It used to return page 0 and fetch it for\n // nothing, because both ends aligned to the same place.\n if (maxIndex < minIndex) {\n return [];\n }\n const start = alignWindowStart(minIndex, pageSize);\n const end = alignWindowStart(maxIndex, pageSize);\n const starts: number[] = [];\n for (let offset = start; offset <= end; offset += pageSize) {\n starts.push(offset);\n }\n return starts;\n}\n\nexport type WindowLength = {\n startIndex: number;\n /** Number of loaded slots in this window (may be shorter than pageSize). */\n length: number;\n};\n\nfunction findWindowAt(\n windows: readonly WindowLength[],\n startIndex: number,\n): WindowLength | undefined {\n return windows.find((window) => window.startIndex === startIndex);\n}\n\nfunction windowCoversLocalRange(\n window: WindowLength,\n from: number,\n to: number,\n): boolean {\n const windowEnd = window.startIndex + window.length - 1;\n return from >= window.startIndex && to <= windowEnd;\n}\n\n/** Page offsets still needed to cover the visible index range. */\nexport function missingWindowStarts(\n windows: readonly WindowLength[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): number[] {\n const required = requiredWindowStarts(minIndex, maxIndex, pageSize);\n const missing: number[] = [];\n for (const pageStart of required) {\n const pageEnd = pageStart + pageSize - 1;\n const segmentStart = Math.max(minIndex, pageStart);\n const segmentEnd = Math.min(maxIndex, pageEnd);\n const window = findWindowAt(windows, pageStart);\n if (\n window &&\n window.length > 0 &&\n windowCoversLocalRange(window, segmentStart, segmentEnd)\n ) {\n continue;\n }\n missing.push(pageStart);\n }\n return missing;\n}\n\n/**\n * Drops windows outside the visible range plus one page of keep buffer\n * on each side.\n */\nexport function pruneWindowsByRange<T extends WindowLength>(\n windows: readonly T[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): T[] {\n if (pageSize <= 0 || windows.length === 0) {\n return [...windows];\n }\n const keepMin = Math.max(0, alignWindowStart(minIndex, pageSize) - pageSize);\n const keepMaxEnd =\n alignWindowStart(maxIndex, pageSize) + pageSize * 2 - 1;\n return windows.filter((window) => {\n const windowEnd = window.startIndex + Math.max(window.length, 1) - 1;\n return windowEnd >= keepMin && window.startIndex <= keepMaxEnd;\n });\n}\n\n/** Picks the missing page whose center is nearest the visible midpoint. */\nexport function pickNearestWindowStart(\n missing: readonly number[],\n mid: number,\n pageSize: number,\n): number {\n let best = missing[0];\n let bestDist = Math.abs(best + pageSize / 2 - mid);\n for (let i = 1; i < missing.length; i++) {\n const start = missing[i];\n const dist = Math.abs(start + pageSize / 2 - mid);\n if (dist < bestDist) {\n best = start;\n bestDist = dist;\n }\n }\n return best;\n}\n\nexport type PivotFilterOptionsWindow = {\n startIndex: number;\n values: string[];\n};\n\n\n/** Rows before window.startIndex that may render blank while scrolling forward. */\nexport const PIVOT_FILTER_LEADING_OVERSCAN_SLACK = 4;\n\nfunction toSpans(windows: readonly PivotFilterOptionsWindow[]) {\n return windows.map((window) => ({\n startIndex: window.startIndex,\n length: window.values.length,\n }));\n}\n\nfunction windowCoversIndexRange(\n window: PivotFilterOptionsWindow,\n from: number,\n to: number,\n): boolean {\n const windowEnd = window.startIndex + window.values.length - 1;\n if (from < window.startIndex || to > windowEnd) {\n return false;\n }\n return to - window.startIndex < window.values.length;\n}\n\n/** Returns whether cached windows already cover the visible index range. */\nexport function pivotFilterWindowCoversRange(\n windows: readonly PivotFilterOptionsWindow[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): boolean {\n return (\n pivotFilterMissingWindowStarts(windows, minIndex, maxIndex, pageSize)\n .length === 0\n );\n}\n\n/** Page offsets that still need to be fetched for the visible range. */\nexport function pivotFilterMissingWindowStarts(\n windows: readonly PivotFilterOptionsWindow[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): number[] {\n return missingWindowStarts(toSpans(windows), minIndex, maxIndex, pageSize).filter(\n (pageStart) => {\n const pageEnd = pageStart + pageSize - 1;\n return !isLeadingOverscanOnly(minIndex, pageEnd, windows, maxIndex);\n },\n );\n}\n\nfunction isLeadingOverscanOnly(\n minIndex: number,\n pageEnd: number,\n windows: readonly PivotFilterOptionsWindow[],\n maxIndex: number,\n): boolean {\n const segmentEnd = Math.min(maxIndex, pageEnd);\n if (segmentEnd < minIndex) {\n return false;\n }\n for (const window of windows) {\n if (window.values.length === 0 || maxIndex < window.startIndex) {\n continue;\n }\n if (window.startIndex - minIndex > PIVOT_FILTER_LEADING_OVERSCAN_SLACK) {\n continue;\n }\n const trailingEnd = Math.min(\n maxIndex,\n window.startIndex + window.values.length - 1,\n );\n if (\n segmentEnd < window.startIndex &&\n windowCoversIndexRange(window, window.startIndex, trailingEnd)\n ) {\n return true;\n }\n }\n return false;\n}\n\n/** Drops windows outside the visible range plus one page of keep buffer. */\nexport function prunePivotFilterWindows(\n windows: readonly PivotFilterOptionsWindow[],\n minIndex: number,\n maxIndex: number,\n pageSize: number,\n): PivotFilterOptionsWindow[] {\n return pruneWindowsByRange(\n windows.map((window) => ({\n startIndex: window.startIndex,\n length: window.values.length,\n window,\n })),\n minIndex,\n maxIndex,\n pageSize,\n ).map((entry) => entry.window);\n}\n\n/** Reads a value from cached windows by global index. */\nexport function pivotFilterWindowValueAt(\n windows: readonly PivotFilterOptionsWindow[],\n index: number,\n): string | undefined {\n for (const window of windows) {\n const localIndex = index - window.startIndex;\n if (localIndex >= 0 && localIndex < window.values.length) {\n return window.values[localIndex];\n }\n }\n return undefined;\n}\n\n"],"names":["VIRTUAL_SCROLL_FETCH_DEBOUNCE_MS","VIRTUAL_SCROLL_WINDOW_PAGE_SIZE","alignWindowStart","minIndex","windowSize","requiredWindowStarts","maxIndex","pageSize","start","end","starts","offset","findWindowAt","windows","startIndex","window","windowCoversLocalRange","from","to","windowEnd","missingWindowStarts","required","missing","pageStart","pageEnd","segmentStart","segmentEnd","pruneWindowsByRange","keepMin","keepMaxEnd","pickNearestWindowStart","mid","best","bestDist","i","dist","PIVOT_FILTER_LEADING_OVERSCAN_SLACK","toSpans","windowCoversIndexRange","pivotFilterMissingWindowStarts","isLeadingOverscanOnly","trailingEnd","prunePivotFilterWindows","entry","pivotFilterWindowValueAt","index","localIndex"],"mappings":"AAmBO,MAAMA,IAAmC,KAGnCC,IAAkC;AAGxC,SAASC,EAAiBC,GAAkBC,GAA4B;AAS7E,SARIA,KAAc,KAQdD,KAAY,IACP,IAEF,KAAK,MAAMA,IAAWC,CAAU,IAAIA;AAC7C;AAGO,SAASC,EACdF,GACAG,GACAC,GACU;AAGV,MAAID,IAAWH;AACb,WAAO,CAAA;AAET,QAAMK,IAAQN,EAAiBC,GAAUI,CAAQ,GAC3CE,IAAMP,EAAiBI,GAAUC,CAAQ,GACzCG,IAAmB,CAAA;AACzB,WAASC,IAASH,GAAOG,KAAUF,GAAKE,KAAUJ;AAChD,IAAAG,EAAO,KAAKC,CAAM;AAEpB,SAAOD;AACT;AAQA,SAASE,EACPC,GACAC,GAC0B;AAC1B,SAAOD,EAAQ,KAAK,CAACE,MAAWA,EAAO,eAAeD,CAAU;AAClE;AAEA,SAASE,EACPD,GACAE,GACAC,GACS;AACT,QAAMC,IAAYJ,EAAO,aAAaA,EAAO,SAAS;AACtD,SAAOE,KAAQF,EAAO,cAAcG,KAAMC;AAC5C;AAGO,SAASC,EACdP,GACAV,GACAG,GACAC,GACU;AACV,QAAMc,IAAWhB,EAAqBF,GAAUG,GAAUC,CAAQ,GAC5De,IAAoB,CAAA;AAC1B,aAAWC,KAAaF,GAAU;AAChC,UAAMG,IAAUD,IAAYhB,IAAW,GACjCkB,IAAe,KAAK,IAAItB,GAAUoB,CAAS,GAC3CG,IAAa,KAAK,IAAIpB,GAAUkB,CAAO,GACvCT,IAASH,EAAaC,GAASU,CAAS;AAC9C,IACER,KACAA,EAAO,SAAS,KAChBC,EAAuBD,GAAQU,GAAcC,CAAU,KAIzDJ,EAAQ,KAAKC,CAAS;AAAA,EACxB;AACA,SAAOD;AACT;AAMO,SAASK,EACdd,GACAV,GACAG,GACAC,GACK;AACL,MAAIA,KAAY,KAAKM,EAAQ,WAAW;AAC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