/** * Pure lane layout for the ResourceTimeline — the headless core of layer 2c. * * Computes the visible day window, parses each item's `[start, end]` day range, * clips it to the window, and stacks the survivors per lane through the shared * first-fit packer in `internal/date-grid/pack-spans`. Svelte-free and * side-effect-free apart from DEV warnings, so it unit-tests without a DOM. * * Two contracts are load-bearing and easy to get wrong from the outside: * * 1. **`[start, end]` is inclusive.** `end` is a day the bar covers, not an * exclusive bound. A hotel stay's last night is `checkOut − 1`. * 2. **Date strings are read verbatim as local days.** The parser is * `Planner`'s `toDateKey` — the one place in the package that decides how a * `'2026-06-16'` becomes a calendar day — piped through the strict * `isoToDate`. Growing a second parser here is how two components end up * disagreeing about a timezone boundary. */ import type { DateCategory, ResourceTimelineView, TimelineGroup, TimelineLaneContext, TimelineRange, TimelineResource } from './resource-timeline.types.js'; /** An inclusive day window (both ends are days the timeline renders). */ export interface TimelineWindow { start: Date; end: Date; } /** * The window a reference date opens. * * `week` snaps to the ISO week containing `reference`; `days` starts **at** * `reference` and runs `days` columns forward, so "the next 14 nights" needs no * separate anchor prop. Derived here rather than read off * `DateGridController.rangeStart/rangeEnd`: those come from `cells`, which pads * a range to whole weeks — exact for a Monday-anchored 14-day window, two days * too wide for a mid-week one. */ export declare function getTimelineWindow(reference: Date, view: ResourceTimelineView, days: number, weekStartsOn: number): TimelineWindow; /** Every day of the window, in column order. */ export declare function getTimelineDays(win: TimelineWindow): Date[]; /** * Resolve one end of a {@link TimelineRange} to a local midnight `Date`. * * Returns `null` for a value no calendar day can be read out of (an invalid * date string, an `Invalid Date`) — read tolerant: the caller drops the item and * warns once, rather than throwing on consumer data. */ export declare function parseTimelineDate(raw: Date | string): Date | null; /** Options for {@link layoutTimeline}. */ export interface TimelineLayoutOptions { /** The lanes, in the order they were declared. */ resources: readonly TimelineResource[]; /** Group headings; lanes are re-ordered to follow this list when given. */ groups?: readonly TimelineGroup[]; /** The items to place. */ items?: readonly T[]; /** Which lane an item belongs to. */ getResourceId: (item: T) => string; /** The item's inclusive day range. */ getRange: (item: T) => TimelineRange; /** Stable key for an item; falls back to `resourceId@startDay#index`. */ getId?: (item: T) => string; /** The item's category id; falls back to `resource.categoryId`. */ getCategoryId?: (item: T) => string | undefined; /** Colour buckets, looked up by id. */ categories?: readonly DateCategory[]; /** The visible window. */ window: TimelineWindow; /** Bar rows to keep per lane; the rest are counted as overflow. */ maxRows?: number; } /** Ordered lanes with their packed, window-clipped spans. */ export declare function layoutTimeline(options: TimelineLayoutOptions): TimelineLaneContext[];