/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ import type { schematicKeys } from "@elaraai/e3-ui/internal"; import type { BacklogEntry } from "./backlog.js"; import { type SchematicRef } from "./canvas/drawn.js"; import type { SchematicValue } from "./data.js"; import type { SchematicNewKey } from "./editing.js"; import { type SchematicCanvasDrop, type SchematicDropCard, type SchematicDropContext, type SchematicDropPoint } from "./drop.js"; import type { SchematicEdit, SchematicKeyRefusal } from "./edits.js"; import type { SchematicWords } from "./messages.js"; /** The names a Schematic keeps its viewer's state under. */ type SchematicKeys = ReturnType; /** What the frame hands its drop target. */ export interface SchematicDropProps { /** The payload: its library's tabs, and its item, link and net kinds' templates. */ readonly value: SchematicValue; /** The Backlog's rows in hand: what its cards place. */ readonly backlog: readonly BacklogEntry[]; /** What a card of the paged Backlog places, by its id (#1393); `undefined` while the Backlog lists only rows in hand. */ readonly pagedBacklog?: ((key: string) => SchematicDropCard | undefined) | undefined; /** The names the Schematic keeps its state under: its library's id, and its drop target. */ readonly keys: SchematicKeys; /** The Schematic as it stands now — never a render's copy: what a drop plans over. */ readonly context: () => SchematicDropContext; /** Records a drop's edits as one step of the history, under its name; whether anything was recorded. */ readonly record: (edits: readonly SchematicEdit[], label: string) => boolean; /** A new row's key, as its kind makes one from the edit making it (`editing.ts`' `newKey`, #1549). */ readonly newKey: (made: SchematicEdit) => SchematicNewKey | undefined; /** Says why a drop records nothing, its new item's key refused (#1549), in the footer. */ readonly keyRefused: (refusal: SchematicKeyRefusal) => void; /** What the canvas has selected now, each entity by its reference. */ readonly selection: () => readonly SchematicRef[]; /** The view's centre, at the screen's resolution; `undefined` while the canvas has no size. */ readonly centre: () => SchematicDropPoint | undefined; /** Selects the item a drop added or placed, by its id. */ readonly select: (id: string) => void; /** Says why a card's ⏎ was refused, in the footer; `undefined` clears it. */ readonly notice: (text: string | undefined) => void; /** The Schematic's words. */ readonly words: SchematicWords; /** The drawing's scale unit, if it has one: what the words measure a drop's point in. */ readonly unit: string | undefined; /** Whether a card drags onto the canvas: `false` below 480px of main (#1394, D15), where no target registers and the canvas has no drop cell. */ readonly drags?: boolean | undefined; } /** What the drop target hands the canvas and the library. */ export interface SchematicDropState { /** The canvas's drop cell; `undefined` while no tab of the library drops, or no card drags. */ readonly canvas: SchematicCanvasDrop | undefined; /** A card's ⏎ (SC13): the card, by its library and its key, dropped on the selection or at the view's centre. */ readonly enter: (library: string, key: string) => void; } /** * The Schematic's drop target — see the module docs. * * @param props - The payload and its backlog, the Schematic's keys, how a drop reads the Schematic and records itself, the * canvas's selection and centre, what a drop selects, the footer's line, and the words * @returns The canvas's drop cell, and a card's ⏎ */ export declare function useSchematicDrop(props: SchematicDropProps): SchematicDropState; export {}; //# sourceMappingURL=use-drop.d.ts.map