import { CalendarEvent } from './calendar.types.js'; /** * Below this an event has no room for a line of text at the default hour height. It is drawn as a * bar of its real length with its label beneath, and packed with room for that label. */ export declare const BRIEF_EVENT_MINUTES = 15; /** `end`, clamped so an event that ends before it starts is treated as having no length. */ export declare function eventEnd(event: CalendarEvent): Date; /** `event` moved by `days` calendar days, keeping its clock times and its real length. */ export declare function moveByDays(event: CalendarEvent, days: number): { start: Date; end: Date; }; /** Drawn in the all-day row rather than the time grid. */ export declare function isAllDayLike(event: CalendarEvent): boolean; /** First and last day (both midnight, both inclusive) the event appears on. */ export declare function eventDays(event: CalendarEvent): { first: Date; last: Date; }; /** All-day events first, then by start, then the longer first, so a day reads the same everywhere. */ export declare function compareEvents(a: CalendarEvent, b: CalendarEvent): number; /** The events on each of `dates`, sorted with `compareEvents`. */ export declare function eventsByDay(events: readonly E[], dates: readonly Date[]): E[][]; export interface TimedBox { event: E; /** Wall-clock minutes from the column's midnight. */ top: number; bottom: number; /** Where the next event in its column may start: below the label of a brief event. */ reach: number; /** Left edge, as a column of `columns`. */ column: number; columns: number; /** Columns it can widen into to its right without covering another event. */ span: number; continuesBefore: boolean; continuesAfter: boolean; } /** * Lays out one day column of the time grid: events that overlap share the width in columns, and * each one widens right into columns that are free for its whole height. * * Positions are wall-clock minutes, never milliseconds from midnight. Drawing and packing have * to agree on that: on a 25-hour day two events in the repeated hour occupy the same rows, and * packing them by real time would put them in one column, drawn over each other. */ export declare function packDay(events: readonly E[], day: Date): TimedBox[]; export interface LaneBar { event: E; /** First column of the row it covers, 0-based. */ start: number; /** Columns it covers within the row. */ span: number; lane: number; /** It starts before its first column: in an earlier row, or on a hidden day. */ continuesBefore: boolean; continuesAfter: boolean; } /** * Stacks the events of one row of days into lanes, as the month view and the all-day row draw * them: longer bars first, so a multi-day event keeps one lane across the week. `dates` are the * row's columns, so a hidden day between two of them is simply not drawn. */ export declare function packLanes(events: readonly E[], dates: readonly Date[], include?: (event: E) => boolean): LaneBar[]; export interface LimitedLanes { visible: LaneBar[]; /** Lane the `+N` buttons go in, on the days that have one. */ moreLane: number; /** Events hidden on each day of the row. */ hidden: number[]; } /** * Fits the bars into `capacity` lanes. A day that needs more gives its last lane to a `+N` * button; a day that does not keeps every bar. Decided per day, so one crowded day does not * hide events on the quiet days next to it. A bar crossing into a crowded day's `+N` lane is * hidden along its whole length and counted on each day it covers. */ export declare function limitLanes(bars: LaneBar[], days: number, capacity: number): LimitedLanes;