/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * Lane packing (#1148, the Calendar's B9): how events that overlap share the * room one column (or one row) has for them. * * A CLUSTER is a run of events each overlapping another of the run, directly * or through others. A cluster takes as many lanes as it needs: each event, in * order of start (the longer first where two start together), takes the first * lane free at its start. Then each event stretches over every lane to its * right that is free for the whole of it, up to the first that is not, so an * event beside a short one widens once the short one ends. A lane's events are * in order of start, so whether a lane is free for an event is a search of * that lane's events, never a sweep of the cluster, which a cluster of * hundreds — a year-long reservation over a press's jobs — made a sweep of * hundreds for every lane each event stretched over. * * Spans are half-open, `[start, end)`: two events that only meet, one ending * as the other starts, do not overlap. The numbers are any domain's (epoch ms, * minutes of the day), so the packing knows nothing of time. * * @packageDocumentation */ /** An event to pack: its start and its exclusive end, on any numeric domain. */ export interface LaneSpan { readonly start: number; readonly end: number; } /** Where a packed event sits. */ export interface LanePlace { /** Its lane, from 0. */ readonly lane: number; /** The lanes its cluster takes: the room is cut into this many. */ readonly lanes: number; /** How many lanes it spans, its own and the free ones to its right: 1 at least. */ readonly span: number; } /** * Install (or clear) the lanes probe. Test use only. * * @param fn - Called for each event a stretch examines; `undefined` clears it */ export declare function setLanesProbe(fn: (() => void) | undefined): void; /** * Pack events into lanes (see the module docs). * * @param spans - The events * @returns Each event's place, in the order the events were given */ export declare function packLanes(spans: readonly LaneSpan[]): LanePlace[]; //# sourceMappingURL=lanes.d.ts.map