/** * Lane assignment for overlapping events within one resource row. * * When two events on the same resource overlap in time they cannot share a * horizontal band, so the row is split into *lanes* and each event is given one. * Pure and DOM-free — the `row-drag-preview.ts` precedent — so it is fully * testable in the `node` environment where real geometry is unavailable. */ /** The minimum an event must expose to be laid out. */ export interface LaneInput { /** Opaque handle, echoed back on the placement. */ readonly id: number; /** Inclusive start. */ readonly start: number; /** Exclusive end. */ readonly end: number; } /** Where one event sits within its row. */ export interface LanePlacement { readonly id: number; /** Zero-based lane index, top to bottom. */ readonly lane: number; /** * Lanes in this event's *cluster* — the divisor for its height. * * Cluster-wide rather than row-wide so a row with one busy morning and a quiet * afternoon does not render every afternoon event at one-third height. Every * event in a cluster shares this value, which is what keeps their tops and * heights aligned. */ readonly laneCount: number; } /** * Assigns lanes to a resource's events. * * Sorted by start ascending, ties broken by end **descending**, so a long event * takes a lower lane than a short one starting at the same instant. That is what * keeps the layout visually stable while scrolling: the long bar stays put * instead of being displaced whenever a shorter neighbour enters the window. * * Intervals are half-open, so an event ending exactly when another starts does * **not** overlap it — adjacent shifts share a lane rather than stacking. * * Complexity is O(n log n) for the sort plus O(n·L) for the sweep, where L is * the number of concurrent lanes. A min-heap would make the sweep O(n log L), * but real rows run to a handful of concurrent events and a linear scan over a * short `Float64Array` beats a heap on constants. The signature is the contract; * swapping the internals later changes nothing for callers. * * @param events - Any order; not mutated. * @returns One placement per input, in input order. */ export declare function layoutLanes(events: readonly LaneInput[]): LanePlacement[]; //# sourceMappingURL=lane-layout.d.ts.map