/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import type { Origin } from "@elaraai/east-ui-components"; import type { ScheduleEditing } from "../shared/schedule/editing.js"; import { type CalendarItem, type CalendarKind, type CalendarRef, type CalendarRow, type CalendarTemplate, type CalendarValue } from "./model.js"; /** A placement proposed by a form, a drop or a draw gesture. */ export interface CalendarPlacement { start: Date; end: Date; resource: CalendarItem["resource"]; } /** A source to create from or to schedule/move. */ export type CalendarSource = { kind: CalendarKind; template: CalendarTemplate; } | { kind: CalendarKind; item: CalendarItem; }; /** The editor used by views, library and inspector. */ export interface CalendarCommands { editing: ScheduleEditing; place(source: CalendarSource, placement: CalendarPlacement, origin?: Origin, checkOnly?: boolean): string | undefined; move(items: readonly CalendarItem[], delta: number, resource?: CalendarItem["resource"], checkOnly?: boolean): string | undefined; remove(items: readonly CalendarItem[]): void; unschedule(items: readonly CalendarItem[], checkOnly?: boolean): string | undefined; duplicate(items: readonly CalendarItem[]): string | undefined; status(items: readonly CalendarItem[], name: string): string | undefined; field(item: CalendarItem, path: readonly string[], value: unknown): void; patch(items: readonly CalendarItem[], fields: readonly { path: readonly string[]; value: Uint8Array; }[]): void; } /** Default placement used by both the library's form and whole-day drops. */ export declare function initialPlacement(source: CalendarSource, day: Date): CalendarPlacement; /** * The paged resource kind's resources the frame holds (#1424), as a creation with no resource may land on one: the rows * of the windows held, in the kind's order, and the resources among them whose events are read, by their slot and key * (`scheduleCellId`), which alone can be said to be free — every one where the kind's events are read over the window * (`known` undefined). */ export interface CalendarPagedRows { readonly rows: readonly CalendarRow[]; readonly known: ReadonlySet | undefined; } /** * Commands write through the shared Schedule seams and one EditHistory. Their checks read every resource, whatever * the rail hides; a creation with no resource lands on one the rail shows (`shown`, #1343) — of a paged kind, one of the * windows the frame holds (`paged`, #1424). */ export declare function calendarCommands(value: CalendarValue, editing: ScheduleEditing, select: (refs: CalendarRef[]) => void, scheduled?: readonly CalendarItem[], shown?: CalendarValue["resources"], paged?: CalendarPagedRows): CalendarCommands; /** * A creation without a resource uses the first compatible free row, then the first compatible row — of a paged kind * (#1424), whose rows come a window at a time, those of the windows the frame holds, free only where their events are * read. * * @param value - The payload, each kind's rows those a creation may land on * @param kind - The event kind created * @param at - When the event is * @param items - The events read: what makes a row busy then * @param paged - The paged kind's rows the frame holds, and those whose events are read * @returns The resource it lands on; none where no row is compatible */ export declare function firstResource(value: CalendarValue, kind: CalendarKind, at: Pick, items: readonly CalendarItem[], paged?: CalendarPagedRows): CalendarItem["resource"]; //# sourceMappingURL=actions.d.ts.map