/** * Copyright (c) 2025 Elara AI Pty Ltd * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details. */ /** * The canvas's drop cell (#1390): where a library card's drag rests over the * canvas — the point under the pointer, at the screen's resolution, for a card * that adds or places an item; the entity of the card's kind under it, found as * a tap finds it, for one that lands on an entity — and its mark, which the * painter draws and a card wears while the drop there lands (invariants 17, * 18). The canvas is the Schematic's drop target's one cell (`../use-drop.ts`); * what a drop does is `../drop.ts`'. * * The commit-phase snapshot reads the mark (`use-paint.ts`, invariant 1), and * the cell reads the snapshot: {@link useCanvasDropMark} holds the mark, and is * made before the snapshot; {@link useCanvasDrop} holds the cell, and is made * after it. * * @packageDocumentation */ import { type RefObject } from "react"; import type { SchematicValue } from "../data.js"; import { type SchematicCanvasDrop, type SchematicDropMark } from "../drop.js"; import type { SchematicRef } from "./drawn"; import type { Camera } from "./use-camera"; import type { Gestures } from "./use-gestures"; import type { Paint } from "./use-paint"; /** * Where a library card's drag rests over the canvas, marked (see the module docs). * * @returns Whether a library card is dragged, and the mark of where its drop lands, and what sets it */ export declare function useCanvasDropMark(): { dragging: boolean; dropMark: SchematicDropMark | undefined; setDropMark: import("react").Dispatch>; }; /** Where a library card's drag rests over the canvas, marked: {@link useCanvasDropMark}'s. */ export type CanvasDropMark = ReturnType; /** What {@link useCanvasDrop} reads. */ export interface CanvasDropProps { /** The payload, decoded: its kinds, by which a card's kind is an item's, a zone's or a link's. */ readonly value: SchematicValue; /** The canvas's drop cell, where a tab of the library drops (#1390); `undefined`, it takes no drop. */ readonly drop: SchematicCanvasDrop | undefined; /** The canvas's element: what a drag's point is found over. */ readonly canvasRef: RefObject; /** Each entity's reference by its id on the canvas. */ readonly refById: ReadonlyMap; /** What never selects, by any path: a locked layer's entities, and what the narrowing takes out — and takes no drop. */ readonly inertKeys: ReadonlySet; /** The canvas's size, in CSS px; `null` before it is measured, when no cell registers. */ readonly size: Camera["size"]; /** The camera's live ref (`use-camera.ts`). */ readonly cameraRef: Camera["cameraRef"]; /** The commit-phase snapshot (`use-paint.ts`). */ readonly renderSnapRef: Paint["renderSnapRef"]; /** The item of a kind under a point, as a tap finds it (`use-gestures.ts`). */ readonly itemKeyAt: Gestures["itemKeyAt"]; /** The zone of a kind under a point, as a tap finds it (`use-gestures.ts`). */ readonly zoneKeyAt: Gestures["zoneKeyAt"]; /** The link or the net of a kind under a point, as a tap finds it (`use-gestures.ts`). */ readonly linkKeyAt: Gestures["linkKeyAt"]; /** Sets the mark of where a drag's drop lands ({@link useCanvasDropMark}'s). */ readonly setDropMark: CanvasDropMark["setDropMark"]; } /** * The canvas's drop cell (see the module docs). * * @param props - The payload and the frame's drop, the canvas's element and its size, the camera, the snapshot, the * hit-tests, and what sets the mark * @returns The ref callback that registers the canvas's element as the cell */ export declare function useCanvasDrop({ value, drop, canvasRef, refById, inertKeys, size, cameraRef, renderSnapRef, itemKeyAt, zoneKeyAt, linkKeyAt, setDropMark }: CanvasDropProps): (el: HTMLElement | null) => void; //# sourceMappingURL=use-canvas-drop.d.ts.map