/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The Timeline's layout (`Allocation Spec.md` ยง8, A14, A20), pure: the lane * grid's rows and cards from the day's slots, which e3-ui's `Allocation.slots` * draws up, and the resource axis's window and days. The renderer places each * part by these indices; its sizes are the `allocationBuilder` recipe's. * * @packageDocumentation */ import type { Bin, Day, Slot } from "./model.js"; /** A grid row's height, the recipe's: what the resource rows are virtualised and the panes scroll by. */ export declare const ROW_H = 36; /** The lane grid's hour column, a lane's width, a card's inset in its lane and grid row, and its size: the recipe's, which a link leaves a card by. */ export declare const HOUR_W = 48; export declare const LANE_W = 96; export declare const CARD_INSET = 4; export declare const CARD_W = 88; export declare const CARD_H = 28; /** The resource plot's narrowest day, in px; under {@link SHORT_DAY} a day's tick shows its number only. */ export declare const MIN_DAY = 24; export declare const SHORT_DAY = 36; /** The resource label column's width, the recipe's: the plot starts after it. */ export declare const LABEL_W = 152; /** One bin's card in the lane grid. */ export interface LaneCard { /** The bin's id. */ id: string; bin: Bin; /** Its lane's index. */ lane: number; /** Its slot's index in the day. */ slot: number; /** Its slot's time: the lane hour a drop on it names. */ slotAt: Date; /** Its grid row: its slot's first row, and its place in the slot's batch. */ row: number; } /** One lane slot's cell: a drop target when it is free. */ export interface LaneCell { lane: number; slot: number; /** The slot's time. */ at: Date; free: boolean; } /** One slot index's band across every lane: as many rows as its largest batch, one at least. */ export interface LaneBand { slot: number; /** Its first grid row. */ row: number; /** Its rows. */ span: number; /** The first lane's slot time: what its label prints. */ at: Date; } /** A ghost's place in the lane grid (#1409): where a bin a run moved or removed stood, as a lane slot and a time. */ export interface LaneGhost { lane: string; at: Date; } /** A ghost placed in the lane grid (#1409): by its index among the ghosts given, its lane, its slot, and its row after the slot's cards. */ export interface LaneGhostPlace { ghost: number; lane: number; slot: number; row: number; } /** The lane grid. */ export interface LaneGrid { bands: LaneBand[]; cells: LaneCell[]; cards: LaneCard[]; /** Every grid row. */ rows: number; /** Each lane's bins with an arrival, and their quantity (A15). */ heads: { bins: number; quantity: number; first: Date | undefined; }[]; /** Each ghost's place (#1409): a row of its slot's band after the slot's cards. */ ghosts: LaneGhostPlace[]; } /** * The lane grid from the day's slots (A14): a band per slot index, its rows * its largest batch's; a cell per lane slot; a card per bin at its lane, its * slot's band, and its place in the batch. A bin the narrowing hides (#1339) * takes no card and no row of its batch, and its slot is still booked; each * lane's head counts every bin, hidden or not. * * A ghost of a bin a run of the optimiser moved or removed (#1409, R15) * takes a row of its slot's band after the slot's cards: the slot of its * lane whose time is the latest at or before where the bin stood. * * @param lanes - The lanes' keys, in order * @param slots - The day's slots (`Allocation.slots`), in time then lane order * @param plan - The day's plan * @param shows - Whether a bin shows; every one by default * @param ghosts - Where the bins the runs moved or removed stood, for the highlight; none by default * @returns The grid */ export declare function laneGrid(lanes: readonly string[], slots: readonly Slot[], plan: Day, shows?: (bin: Bin) => boolean, ghosts?: readonly LaneGhost[]): LaneGrid; /** The resource axis: its window around the plan day, and its days. */ export interface ResourceAxis { /** `[from, to)`: the horizon's days before and after the plan day. */ from: Date; to: Date; /** Its days, at UTC midnight. */ days: Date[]; /** The plan day's index among them. */ today: number; } /** * The resource axis around a plan day (A20): its horizon's whole days before * it, and after it from its start. * * @param day - The plan day, at UTC midnight * @param before - The horizon before it, in ms * @param after - The horizon after its start, in ms * @returns The axis */ export declare function resourceAxis(day: Date, before: number, after: number): ResourceAxis; /** * Where an instant falls along the axis, as a fraction of its window, clamped * to it. * * @param axis - The axis * @param at - The instant * @returns 0 at its start, 1 at its end */ export declare function axisFraction(axis: ResourceAxis, at: Date): number; /** A span along the axis as a CSS left and width, or `undefined` when it falls outside it. */ export declare function axisSpan(axis: ResourceAxis, from: Date, to: Date): { left: string; width: string; } | undefined; //# sourceMappingURL=timeline-layout.d.ts.map