import{type TemplateResult,type PropertyValues}from'lit';import{LyraElement}from'../../../internal/lyra-element.js';import type{LyraOrientation}from'../../../internal/shared-unions.js';import{type FlowEdge,type FlowLayoutChangeDetail,type FlowNode,type FlowRunDecorations,type FlowStructureSnapshot}from'./flow-types.js';export*from'./flow-types.js';export interface LyraFlowCanvasEventMap{'lr-node-activate':CustomEvent>;'lr-edge-activate':CustomEvent>;'lr-selection-change':CustomEvent>;'lr-node-move':CustomEvent;readonly previous:Readonly<{x:number;y:number;}>;}>>;'lr-connect':CustomEvent>;'lr-node-add':CustomEvent;}>>;'lr-selection-delete':CustomEvent>;'lr-viewport-change':CustomEvent>;'lr-layout-change':CustomEvent;} /** * `` — a pannable/zoomable DAG workflow canvas: positions HTML node cards, draws * SVG edges between their handles, runs a shared layered auto-layout for unpositioned nodes, and owns * all selection/drag/connect interaction. Readonly (viewer) by default; opt into editor gestures * individually via `nodes-draggable`, `connectable`, `droppable`. `nodes` and `edges` remain * controlled and are never mutated internally. Selection is an internally applied interaction * state: `selectedNodeIds`/`selectedEdgeIds` can seed or replace it, and node/edge activation * updates those arrays before emitting `lr-selection-change`. Interaction announcements are * flushed to the document's shared light-DOM polite sink; mount is silent and repeated identical * messages remain separate announcements. `[part="live-region"]` is only an aria-hidden mirror. * Turning on `locked` is a live safety boundary: active pan, node-drag, connect, and palette-drop * previews are canceled and their window listeners are retired before later pointer events can * commit. Viewport-mutating imperative methods, including `focusNode()`, are inert while locked. * Replacing the controlled `nodes` model similarly retires node-drag and connect gestures before * their captured ids can outlive that model; background pan remains independent. Node and edge * collections reject blank ids and later duplicates at assignment, so the first valid occurrence * owns layout, focus, selection, gestures, companion snapshots, and emitted identity. * * A `FlowNode` may also set `disabled`, marking it non-actionable: it keeps its position and card * content but cannot be selected or activated by click or keyboard, roving-tabindex navigation * (arrow keys, Home/End) steps past it instead of landing on it, it cannot be dragged even while * `nodes-draggable`, and it is excluded from starting or receiving a new connection while * `connectable` -- an edge that already touches a since-disabled node is left alone. Omitted or * `false` renders the node exactly as before this field existed. * * @customElement lr-flow-canvas * @slot - Consumer-authored node cards matched by `node-id`. Each matching card is assigned to the * generated `node-{id}` slot; a declarative `lr-flow-node` fallback remains in shadow DOM and no * light-DOM nodes are created or removed. Non-matching children are ignored with a warning. * @slot top-start - Floating start-side content in the wrapping top overlay rail (e.g. `lr-flow-run-status`). * @slot top-end - Floating end-side content in the wrapping top overlay rail. * @slot bottom-start - Floating start-side content in the wrapping bottom overlay rail (e.g. `lr-flow-controls`). * @slot bottom-end - Floating end-side content in the wrapping bottom overlay rail (e.g. `lr-flow-minimap`). * @event lr-node-activate - `detail: { nodeId }`. * @event lr-edge-activate - `detail: { edgeId, source, target }`. * @event lr-selection-change - `detail: { nodeIds, edgeIds }`. * @event lr-node-move - `detail: { nodeId, position, previous }`. * @event lr-connect - `detail: { source, target, sourceHandle, targetHandle }`. * @event lr-node-add - `detail: { type, position }`. * @event lr-selection-delete - `detail: { nodeIds, edgeIds }`. * @event lr-viewport-change - `detail: { x, y, zoom }`. * @event lr-layout-change - `detail: { positions, truncated }`. * @csspart base - The root wrapper. * @csspart viewport - The focusable pan/zoom surface. * @csspart background - The dotted background grid. * @csspart edges - The edges SVG. * @csspart edge - A single edge path. * @csspart edge-label - An edge's drawn label. * @csspart arrowhead - A tone-matched directed-edge arrowhead marker. * @csspart stub - A dangling-edge stub line. * @csspart connection-line - The in-progress connect-gesture path. * @csspart node - A node's positioned wrapper. Carries `data-selected` while selected, and * `aria-disabled="true"` while its `FlowNode.disabled` is set. * @csspart node-control - The visually hidden, roving selection button for a node. Renders a * genuine `disabled` `