/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * Selecting events on the canvas (#1197, the Calendar's B15): what a run bar, * a tile, a chip or a mark of an event kind's rows does with its click. It * selects its event and its row, Shift, ⌘ or Ctrl adding the event to the * selection or taking it out, and it draws selected while it is — the * inspector shows what is selected. An element of anything else — a series * over `data`, a row of the Plan's own — selects its row, as it always has. * * An event's element is keyed by its event as East prints a * `Schedule.Types.EventRef` (#1192): a key that reads back as one, of a kind * the Plan has, is an event's. * * @packageDocumentation */ import { type MouseEvent } from "react"; import { type PlanElementRefValue } from "../context.js"; import type { PlanRowValue } from "../model.js"; /** The elements that may be an event's: a bar, a tile, a chip, a mark — never a cell, which is a bucket's. */ export declare const PLAN_EVENT_ELEMENT_SELECTOR = "[data-run],[data-event],[data-chip],[data-mark]"; /** * Whether a row draws the element of a key — a run, a chip, a tile or a mark: * the row an event selected from outside the canvas is shown on (#1198). * * @param row - The row * @param key - The element's key * @returns Whether one of its elements has that key */ export declare function holdsElement(row: PlanRowValue, key: string): boolean; /** * An element ref's own key — what its element is keyed by on its row. * * @param ref - The element's ref * @returns Its key; `undefined` for a cell or a link, which no event is */ export declare function elementKeyOf(ref: PlanElementRefValue): string | undefined; /** Whether an element's key names an event the canvas selects. */ export type PlanSelectable = (key: string) => boolean; /** * What the canvas's elements select by: an element's key that reads back as a * `Schedule.Types.EventRef` of one of `kinds`. * * @param kinds - The Plan's event kinds, by slot * @returns Whether a key is an event's — each key read once */ export declare function selectableOf(kinds: readonly string[] | undefined): PlanSelectable; /** What the canvas's elements select by — none outside a Plan of event kinds. */ export declare const PlanSelectableContext: import("react").Context; /** An element's selection: whether its event selects, whether it is selected, and its click. */ export interface PlanElementSelect { /** Its event can be selected: an event kind's element. */ selectable: boolean; /** It is selected. */ selected: boolean; /** Its click — its event selected, or its row; and the author's `onElementClick`. */ onClick: (e: MouseEvent) => void; } /** * An element's selection — see the module docs. * * @param rowKey - Its row's key * @param key - Its own key * @param ref - Its element ref, for the author's `onElementClick` * @returns Whether it selects and is selected, and its click */ export declare function usePlanElementSelect(rowKey: string, key: string, ref: PlanElementRefValue): PlanElementSelect; //# sourceMappingURL=element-select.d.ts.map