/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * An element that moves (#825) — what a run bar, a chip, a tile or a mark * spreads to be picked up: its drag handle on the drag layer (#608), its two * end handles when it has two ends, and the ghost that follows the pointer. * * The pointer picks it up through the drag layer, which carries the drag — * the edge scroller, the veto on the event the drop would deliver, the * announcements. The press is recorded first (`PlanEditStore.arm`): what the * drag moves and where it was grabbed, which is how a row says where it lands. * The keyboard is the canvas's own (`use-carry.ts`): an element takes no key * from the layer, since its moves need keys the layer's arrows cannot carry — * an end moved with Shift or Alt, a row found by its item type. * * @packageDocumentation */ import { type PointerEvent as ReactPointerEvent } from "react"; import type { PlanScale } from "../scale.js"; import type { PlanWords } from "../words.js"; import { type PlanMovable, type PlanSpan } from "./store.js"; /** What an element spreads to be picked up by the pointer, and described to the keyboard. */ export interface PlanElementHandle { ref: (el: HTMLElement | null) => void; onPointerDown: (e: ReactPointerEvent) => void; "data-draggable": ""; "aria-describedby": string; } /** What an end handle spreads. */ export interface PlanEdgeHandle { ref: (el: HTMLElement | null) => void; onPointerDown: (e: ReactPointerEvent) => void; "data-plan-edge": "start" | "end"; } /** What {@link usePlanMovable} gives an element. */ export interface PlanMovableProps { /** Spread onto the element — `undefined` when it does not move. */ handle: PlanElementHandle | undefined; /** Its end handles, when it has two ends — spread each onto its handle. */ edges: { start: PlanEdgeHandle; end: PlanEdgeHandle; } | undefined; /** Whether the keyboard carries it now. */ carried: boolean; } /** * Where an element is, in words — a run's or a chip's span, a tile's or a * mark's instant. * * @param scale - The shared scale * @param movable - The element * @param span - Its extent * @param w - The canvas's words * @returns `Jul 13, 2026 – Aug 3, 2026`, or `Jul 13, 2026` */ export declare function spanWords(scale: PlanScale, movable: Pick, span: PlanSpan, w: PlanWords): string; /** * An element's moves — its drag handle, its end handles and whether the * keyboard carries it (see the module docs). * * @param movable - The element, or `undefined` when its row takes no move * @returns What it spreads */ export declare function usePlanMovable(movable: PlanMovable | undefined): PlanMovableProps; //# sourceMappingURL=movable.d.ts.map