/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. * * The Calendar's event kinds as the shared schedule reader reads them * (#1424): the Calendar's adapter to `shared/schedule/cells.ts`, as the Plan's * `plan/root/cells.ts` is. Every kind is counted before one of its events is * read — through its source's interval index, the count its window's read * asks first; through its day index, by the days its events run on, an upper * bound (`countExact` false); or in memory, its record read whole — and past * `SCHEDULE_EVENT_CAP` over the window the view reads none is read or drawn. * Where the view lays its resources out — the timeline's rows, the Resources * view's columns — each resource of a kind such a kind is placed on shades * from its source's summary, the share of each period booked, or is hatched * where it has none to shade at the view's period; and the frame's banner * says how many events there are and to zoom in or narrow. A view with no * resource axis — a time grid, the month, the agenda — has no row to shade: * the banner alone says so. * * The adapter gives the reader what is the Calendar's, in the reader's terms: * each event kind — its slot, its name, its resource kinds, its cells' type, * its series key and its count — whose rows book their buckets, an event * drawn over its time; its source of the slice; the resource kinds the view * lays out, each its rows the rail shows, shaded by the kind's slot; and the * window the view reads, cut into its periods — the timeline's days, weeks or * months by its period, the Resources view's day — each whole, as e3 tiles * them, so a summary's tiles fold into a period whole. * * A kind placed on the paged resource kind (`pages.ts`) is read a cell at a * time where the view lays that kind's resources out — the timeline's rows, * the Resources view's columns: the blocks of fifty of its resources around * those the view shows, by the tiles the window touches, every cell's * searches in one request and the missing cells' entries in one more — the * Plan's reading, through the payload's paged seam, its keys a window at a time * ({@link calendarCellsPaged}). The places the view shows come from where the * views report them, as their scroll rests: the first and the last held row * among them ({@link calendarCellSpan}), the span standing while the view shows * only places not read yet. A view that lays no resource out — a time grid, the * month, the agenda — reads such a kind as it reads any other: counted over the * window first. A Save's confirmation reads its events by their keys, never the * cells: what it landed of such a kind draws as the Save left it over cells read * before the commit, until they are read again — the editing keeps it for the * kinds {@link calendarCellKinds} names (the shared reader's "What a Save * landed"). * * A kind read a window at a time — through its source's interval index, or a * day index, one event by its key — gives the reader its window's own stored * rows (`stored`, #1599), which the reader keeps as it keeps a kind's cells: the * window's read draws the kind from them, so they stand while they are read * again — after a Save, after another session's write — a draft made meanwhile * draws at once, and a gesture finds its event's row among them. Its range is a * period (`period`): a step draws none of the last period's rows. * * A kind with a backlog narrowed through its source reads its window's rows * alone (#1424): the Backlog tab pages its backlog through the source itself * (`backlog-pages.ts`), so nothing reads it whole, and every draft the kind's * seams are given draws where it places its event. The reader asks the * narrowing — but the window — of the stored rows of its drafted events its * window does not hold (`windowField`), and leaves out the drafts of those the * narrowing does not hold either, as it leaves out a cells kind's: a backlog * event a gesture scheduled draws where it is placed, and a draft of an event * another narrowing holds draws nowhere. A narrowed kind with no backlog draws a * draft only of an event its window holds, or of a new one (`isNew`, #1343), as * its window's own read drew them. * * @packageDocumentation */ import { type ScheduleCellBucket, type ScheduleCellPaged, type ScheduleCellResources, type ScheduleCellSpan, type ScheduleCellsRead } from "../shared/schedule/cells.js"; import type { ScheduleEditing, ScheduleEventDraftsValue } from "../shared/schedule/editing.js"; import type { CalendarKind, CalendarRange } from "./model.js"; import { type CalendarPagedValue, type CalendarPagedView, type CalendarPages } from "./pages.js"; import type { CalendarEventPart } from "./window.js"; /** The periods a resource's shading is cut into: the timeline's day, week or month, the Resources view's day. */ export type CalendarBucket = "day" | "week" | "month"; /** * The periods a window is cut into, each whole as e3 tiles it — a day, an ISO * week from Monday, a calendar month, in UTC — from the one holding the * window's start to the one holding its last instant: what a summary's tiles * fold into whole. * * @param range - The window * @param bucket - The period * @returns The periods, in order; the first may start before the window, and the last end after it */ export declare function calendarBuckets(range: { readonly from: Date; readonly to: Date; }, bucket: CalendarBucket): ScheduleCellBucket[]; /** * The paged resource kind as the shared reader reads it: its keys a window at a * time — {@link CALENDAR_PAGE_SIZE} to a window, as its rows are paged — its * count, and the narrowing its windows serve. * * @param paged - The paged kind, as the payload carries it * @returns The reader's seam */ export declare function calendarCellsPaged(paged: CalendarPagedValue): ScheduleCellPaged; /** * The paged kind's rows the view shows, as the reader takes them: the first * and the last held row among the places the views last reported, each by its * window and its key, under the narrowing their windows serve. A view that * shows only places not read yet leaves the span standing — never the opening's * first block, a view away — and the rows there report their own once they are * held. * * @param view - The places the views last reported * @param pages - What the frame holds of the paged kind * @param standing - The span made last * @returns The span; `standing` while the view shows no held row, or the same rows under the same narrowing */ export declare function calendarCellSpan(view: CalendarPagedView | undefined, pages: CalendarPages | undefined, standing: ScheduleCellSpan | undefined): ScheduleCellSpan | undefined; /** What {@link useCalendarCells} reads over. */ export interface CalendarCellsArgs { /** The event kinds, as the payload carries them. */ readonly kinds: readonly CalendarKind[]; /** Each event kind narrowed through its source of the slice: what it is counted and read through. */ readonly parts: readonly CalendarEventPart[]; /** * The resource kinds the view lays out, each its resources the rail shows: what a kind past the cap shades, or * hatches; none in a view with no resource axis. */ readonly resources: readonly ScheduleCellResources[]; /** The window the view reads. */ readonly range: CalendarRange; /** The periods a resource's shading is cut into; `undefined` in a view with no resource axis, which shades none. */ readonly bucket: CalendarBucket | undefined; /** Every kind's drafts — the same object while they hold. */ readonly drafts: ScheduleEventDraftsValue; /** * The paged resource kind, where the view lays its resources out: a kind placed on it is read a cell at a time; * `undefined` with none paged, or in a view that lays no resource out. */ readonly paged: ScheduleCellPaged | undefined; /** The paged kind's rows the view shows ({@link calendarCellSpan}); `undefined` before any is held in view. */ readonly span: ScheduleCellSpan | undefined; /** * The editing's say of what confirmed Saves landed of the kinds it names ({@link calendarCellKinds}), and how it is * let go: drawn over a kind's cells read before the commit until they are read again — and the row each drafted * event's session began from, which tells a new event from one the record holds; `undefined` for a Calendar read * only. */ readonly editing?: Pick | undefined; } /** * The kinds the reader may give cells (see the module docs): every kind read a window at a time, one event by its key — * by its series index's cells, or its window's own rows — whose cells stand at the revision they were read at, so the * editing keeps what each Save lands of them for the reader to draw until they are read again. * * @param kinds - The event kinds, as the payload carries them * @returns Their slots */ export declare function calendarCellKinds(kinds: readonly CalendarKind[]): ReadonlySet; /** * The kinds' counts and, past the cap, their shading and their notices — and * a kind placed on the paged resource kind, its cells (see the module docs) — * read in the component that reads the window: what the window's read takes * each kind's decision from, and what the frame shades a resource's row or * column by and says in its banner. * * @param args - What it reads over * @returns What the shared reader read */ export declare function useCalendarCells(args: CalendarCellsArgs): ScheduleCellsRead; //# sourceMappingURL=cells.d.ts.map