@fragiola/flow-angular 0.0.0-stage → 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fragiola-flow-angular.mjs","names":["SVG","ATTRIBUTES","SVG","ATTRIBUTES","SVG","ATTRIBUTES","ATTRIBUTES"],"sources":["../../src/lib/context.ts","../../src/lib/utils/flow-store.ts","../../src/lib/utils/helpers.ts","../../src/lib/utils/shallow-equal.ts","../../src/lib/inject/internal.ts","../../src/lib/directives/background.directive.ts","../../src/lib/inject/inject-connection.ts","../../src/lib/utils/presence.ts","../../src/lib/utils/default-content.ts","../../src/lib/directives/connection-line.directive.ts","../../src/lib/directives/controls.directive.ts","../../src/lib/inject/inject-edge.ts","../../src/lib/inject/bind-edge-path.ts","../../src/lib/directives/edge.directive.ts","../../src/lib/directives/edge-label.directive.ts","../../src/lib/directives/edge-path.directive.ts","../../src/lib/directives/edge-toolbar.directive.ts","../../src/lib/utils/views.ts","../../src/lib/directives/edges.directive.ts","../../src/lib/inject/control-button.ts","../../src/lib/directives/fit-view.directive.ts","../../src/lib/inject/inject-handle.ts","../../src/lib/directives/handle.directive.ts","../../src/lib/inject/inject-node.ts","../../src/lib/directives/node.directive.ts","../../src/lib/directives/node-toolbar.directive.ts","../../src/lib/directives/nodes.directive.ts","../../src/lib/directives/nodes-selection.directive.ts","../../src/lib/directives/reconnect-anchor.directive.ts","../../src/lib/inject/create-flow-ref.ts","../../src/lib/utils/engine-facade.ts","../../src/lib/directives/root.directive.ts","../../src/lib/directives/selection-box.directive.ts","../../src/lib/directives/toggle-interactive.directive.ts","../../src/lib/inject/inject-viewport.ts","../../src/lib/directives/viewport.directive.ts","../../src/lib/directives/zoom-in.directive.ts","../../src/lib/directives/zoom-out.directive.ts","../../src/lib/flow.ts","../../src/lib/inject/inject-edges.ts","../../src/lib/inject/inject-flow.ts","../../src/lib/inject/inject-flow-ref.ts","../../src/lib/inject/inject-flow-store.ts","../../src/lib/inject/inject-internal-node.ts","../../src/lib/inject/inject-key-press.ts","../../src/lib/inject/inject-node-connections.ts","../../src/lib/inject/inject-node-id.ts","../../src/lib/inject/inject-nodes.ts","../../src/lib/inject/inject-nodes-data.ts","../../src/lib/inject/inject-on-viewport-change.ts","../../src/lib/inject/inject-selection.ts"],"sourcesContent":["// What a `[flowRoot]` shares with its parts, and a `[flowNode]` / `[flowEdge]` with the parts\n// inside it. The root's model and engine have the registry erased (`AnyTypes`, any features): a\n// child cannot infer the root's `T` through injection, so the typed surface is each part's inputs\n// and the template directives' contexts (`injectFlow<Types, typeof features>()`).\nimport { InjectionToken, inject, type Signal } from \"@angular/core\";\nimport type {\n AnyTypes,\n FlowEngine,\n FlowFeatures,\n FlowModel,\n FlowTypes,\n RenderLayer,\n StaticGeometry,\n} from \"@fragiola/flow\";\nimport type { FlowStore } from \"./utils/flow-store\";\n\n/** The model as the parts see it: any registry, any features. */\nexport type AnyFlowModel = FlowModel<AnyTypes, FlowFeatures>;\n\n/** The engine as the parts see it: any registry, every feature's keys. */\nexport type AnyFlowEngine = FlowEngine<AnyTypes, FlowFeatures>;\n\n/** The context of a `[flowRoot]`. */\nexport interface FlowContext {\n /** the root's model: its `model` input, or the one it created */\n readonly model: Signal<AnyFlowModel>;\n /** the engine, once the root is rendered in a browser (`null` before, and after it is destroyed) */\n readonly engine: Signal<AnyFlowEngine | null>;\n /** the engine as apps see it: always there, forwarding to the engine once it exists */\n readonly publicEngine: AnyFlowEngine;\n /** the root's element: what renders outside the zoom (a toolbar) goes into it */\n readonly rootElement: HTMLElement;\n /**\n * a number that changes on every commit of the model and every view change of the engine\n * (`engine.adapter.subscribe`): every part reads the model and the engine through it, so it\n * follows them (the model's state is never made reactive)\n */\n readonly revision: Signal<number>;\n /**\n * the counters behind `revision`, by scope (`flowValue`'s `entity` readers: a node's or an\n * edge's own view, told no viewport-only step and only the measurements that changed it)\n */\n readonly store: FlowStore;\n /**\n * the root culls (`onlyRenderVisible`): before the engine exists (the first render) the\n * layers render no node and no edge, where they would draw every one's static geometry\n */\n readonly culled: Signal<boolean>;\n /**\n * the flow's geometry from its document alone (`staticGeometry`, with the root's options)\n * while there is no engine (the first render), `null` once there is: the parts draw the\n * edges and place the nodes from it, as the engine will before it measures anything\n */\n readonly geometry: Signal<StaticGeometry | null>;\n /** the levels the flow is drawn in (`render-layers`, or the static geometry's) */\n readonly layers: Signal<readonly RenderLayer[]>;\n}\n\nexport const FLOW_CONTEXT = new InjectionToken<FlowContext>(\"Flow\");\n\n/** The node of a `[flowNode]` (or a host bound with `injectNode`), for the parts inside it. */\nexport interface NodeContext {\n /** its node's id (`undefined` before its input is set) */\n readonly nodeId: Signal<string | undefined>;\n}\n\nexport const FLOW_NODE = new InjectionToken<NodeContext>(\"FlowNode\");\n\n/** The edge of a `[flowEdge]`, for the parts inside it (its path, label, reconnect anchors). */\nexport interface EdgeContext {\n /** its edge's id (`undefined` before its input is set) */\n readonly edgeId: Signal<string | undefined>;\n}\n\nexport const FLOW_EDGE = new InjectionToken<EdgeContext>(\"FlowEdge\");\n\n/** The HTML layers of a `[flowEdges]`, which edge labels go into (SVG holds no HTML). */\nexport interface EdgeLabelLayers {\n /** the HTML layer of the edge's level: the app's element with one level, its level's wrapper with several */\n of(edgeId: string): HTMLElement;\n}\n\nexport const FLOW_EDGE_LABEL_LAYER = new InjectionToken<EdgeLabelLayers>(\n \"FlowEdgeLabelLayer\",\n);\n\n/** The enclosing root's context, or a clear error outside one. */\nexport function injectFlowContext(part: string): FlowContext {\n const context = inject(FLOW_CONTEXT, { optional: true });\n if (!context) {\n throw new Error(`${part} must be used inside [flowRoot]`);\n }\n return context;\n}\n\n/** The enclosing node's context, if any (a part given its own `nodeId` needs none). */\nexport function injectNodeContext(): NodeContext | null {\n return inject(FLOW_NODE, { optional: true });\n}\n\n/** The enclosing edge's context, if any (a part given its own `edgeId` needs none). */\nexport function injectEdgeContext(): EdgeContext | null {\n return inject(FLOW_EDGE, { optional: true });\n}\n\n/** A model of any registry and features, seen erased. */\nexport function eraseModel<T extends FlowTypes, F extends FlowFeatures>(\n model: FlowModel<T, F>,\n): AnyFlowModel {\n return model as unknown as AnyFlowModel;\n}\n\n/** The erased model seen with the registry and features the caller declares. */\nexport function typedModel<T extends FlowTypes, F extends FlowFeatures>(\n model: AnyFlowModel,\n): FlowModel<T, F> {\n return model as unknown as FlowModel<T, F>;\n}\n\n/** The erased engine seen with the registry and features the caller declares. */\nexport function typedEngine<T extends FlowTypes, F extends FlowFeatures>(\n engine: AnyFlowEngine | FlowEngine,\n): FlowEngine<T, F> {\n return engine as unknown as FlowEngine<T, F>;\n}\n","// What a root's readers hear (packages/react's `utils/flow-store.ts`, Vue's and Svelte's counters\n// as Angular signals): counters the root bumps on each change of the model and of the engine, told\n// only to the readers it may concern. A `flowValue` computed reads the counter of its scope (and\n// of its node or edge), so a viewport step reads no node or edge again, and a measurement only\n// those it changed.\nimport {\n type Signal,\n signal,\n untracked,\n type WritableSignal,\n} from \"@angular/core\";\nimport type { ViewChange } from \"@fragiola/flow\";\nimport type { AnyFlowEngine, AnyFlowModel } from \"../context\";\n\n/**\n * What a reader depends on:\n * - `view`: anything, the viewport included (the layers' lists, the background, toolbars);\n * - `entity`: one node's or edge's own view (its place, path, attributes, `z-index`), which a\n * viewport step leaves alone, so a pan or a zoom never reads it again. A viewport step does\n * change the nodes' `z-index` while there are several render levels (`node-z-index-by`, the\n * levels follow the drawn edges): then it counts as an entity change too.\n */\nexport type FlowValueScope = \"view\" | \"entity\";\n\n/**\n * The node or the edge an `entity` reader shows: a change that is only a measurement\n * (nodes mounted, a node resized) tells it only when the measurement changed it (its node's box or\n * measured state, its edge's path), not every node and edge on screen\n */\nexport interface FlowEntity {\n readonly kind: \"node\" | \"edge\";\n readonly id: string;\n}\n\n/** One node's or edge's readers, and what a measurement may change of it. */\ninterface EntityRecord {\n readonly entity: FlowEntity;\n /** bumped when a measurement changed it */\n readonly counter: WritableSignal<number>;\n /** its readers (`acquire`): dropped at none */\n readers: number;\n /**\n * its node's box and measured state, or its edge's path (frozen, the same until changed), as\n * of the last measurement; none after any other change (read again at the next measurement,\n * which then tells it)\n */\n token: readonly unknown[] | undefined;\n}\n\n/** The counters of one root, read by its `flowValue` computeds */\nexport interface FlowStore {\n /** every change: a commit of the model, every engine notification (the context's `revision`) */\n readonly view: Signal<number>;\n /**\n * a change of every node and edge: a commit that changed the lists (or another model), a\n * gesture, a notification while there are (or were) several render levels, a measurement\n * with a viewport change\n */\n readonly entity: Signal<number>;\n /** a notification that was only a measurement: what an `entity` reader without one hears */\n readonly measure: Signal<number>;\n /**\n * the counter of a node's or an edge's measurements while it has a reader (`acquire`), else\n * `measure` (every measurement)\n */\n counterOf(entity: FlowEntity): Signal<number>;\n /** a reader of a node or an edge: its record is kept until released */\n acquire(entity: FlowEntity): () => void;\n /** a commit of `model` (another model than the last one: everything changed) */\n commit(model: AnyFlowModel): void;\n /** the engine, once created: its notifications are told from then on; returns the remover */\n attach(engine: AnyFlowEngine, notified: () => void): () => void;\n}\n\n/** @internal the key of a node's or an edge's record */\nexport const entityKey = (entity: FlowEntity): string =>\n `${entity.kind}\\u0000${entity.id}`;\n\n/** @internal the store of a root (its model and its engine, once attached) */\nexport function createFlowStore(): FlowStore {\n const view = signal(0);\n const entity = signal(0);\n const measure = signal(0);\n const records = new Map<string, EntityRecord>();\n let engine: AnyFlowEngine | null = null;\n\n const tokenOf = ({ kind, id }: FlowEntity): readonly unknown[] =>\n untracked(() =>\n !engine\n ? []\n : kind === \"node\"\n ? [\n engine.get(\"node-rect-by\", { nodeId: id }),\n engine.is(\"node-measured\", { nodeId: id }),\n ]\n : [engine.get(\"edge-path-by\", { edgeId: id })],\n );\n\n const bump = (counter: WritableSignal<number>) =>\n counter.update((value) => value + 1);\n\n /** A change: of the view only, only a measurement, or of everything. */\n const tell = (kind: \"view\" | \"measured\" | \"entity\") => {\n bump(view);\n if (kind === \"view\") return;\n if (kind === \"entity\") {\n for (const record of records.values()) record.token = undefined;\n bump(entity);\n return;\n }\n bump(measure);\n for (const record of records.values()) {\n const token = tokenOf(record.entity);\n const was = record.token;\n const same =\n was !== undefined &&\n token.length === was.length &&\n token.every((value, i) => Object.is(value, was[i]));\n if (same) continue;\n record.token = token;\n bump(record.counter);\n }\n };\n\n // a commit that keeps both lists changes no node's or edge's own view\n let last: { model: unknown; nodes: unknown; edges: unknown } = {\n model: undefined,\n nodes: undefined,\n edges: undefined,\n };\n\n const measured = measure.asReadonly();\n return {\n view: view.asReadonly(),\n entity: entity.asReadonly(),\n measure: measured,\n counterOf: (of) => records.get(entityKey(of))?.counter ?? measured,\n acquire(of) {\n const key = entityKey(of);\n let record = records.get(key);\n if (!record) {\n record = {\n entity: { kind: of.kind, id: of.id },\n counter: signal(0),\n readers: 0,\n token: tokenOf(of),\n };\n records.set(key, record);\n }\n const held = record;\n held.readers += 1;\n let released = false;\n return () => {\n if (released) return;\n released = true;\n held.readers -= 1;\n if (held.readers <= 0 && records.get(key) === held) {\n records.delete(key);\n }\n };\n },\n commit(model) {\n const next = untracked(() => ({\n model,\n nodes: model.get(\"all-nodes\"),\n edges: model.get(\"all-edges\"),\n }));\n const changed =\n next.model !== last.model ||\n next.nodes !== last.nodes ||\n next.edges !== last.edges;\n last = next;\n tell(changed ? \"entity\" : \"view\");\n },\n attach(created, notified) {\n engine = created;\n // the measurements before the engine counted nothing: read again at the next one\n for (const record of records.values()) record.token = undefined;\n // several render levels give the nodes ranks that follow the drawn edges, so the view\n const layered = () =>\n untracked(() => created.get(\"render-layers\").length > 1);\n let wasLayered = layered();\n const stop = created.adapter.subscribe((change: ViewChange) => {\n const isLayered = layered();\n const levels = isLayered || wasLayered;\n wasLayered = isLayered;\n if (change.gesture || levels) tell(\"entity\");\n else if (change.measured)\n tell(change.viewport ? \"entity\" : \"measured\");\n else tell(\"view\");\n notified();\n });\n // (the readers follow the engine itself through the context's `engine` signal)\n return () => {\n stop();\n if (engine === created) engine = null;\n };\n },\n };\n}\n","// From Splitter (fragiola/splitter, packages/angular/src/lib/utils/helpers.ts) and Tree\n// (fragiola/tree, packages/angular/src/lib/utils/helpers.ts), same author and licence: the host\n// element, the boolean and number inputs, the structural style written onto the host. Flow adds\n// the defaults a consumer overrides (a handle's place on its side, an SVG part's presentation\n// attributes) and the attributes record the engine gives each part.\nimport {\n afterEveryRender,\n DestroyRef,\n ElementRef,\n effect,\n inject,\n untracked,\n} from \"@angular/core\";\n\n/** The host element of the directive (or component) being created. */\nexport function injectHost<E extends Element = HTMLElement>(): E {\n return inject<ElementRef<E>>(ElementRef).nativeElement;\n}\n\n/** Runs `teardown` when the directive (or component) being created is destroyed. */\nexport function onDestroy(teardown: () => void): void {\n inject(DestroyRef).onDestroy(teardown);\n}\n\n/** `true` for a bare attribute (`<div flowRoot panOnScroll>`), else the value as a boolean. */\nexport function booleanInput(value: unknown): boolean {\n return value === \"\" || (value !== \"false\" && Boolean(value));\n}\n\n/** Like {@link booleanInput}, keeping `undefined` (the core's default). */\nexport function optionalBoolean(value: unknown): boolean | undefined {\n return value === undefined || value === null\n ? undefined\n : booleanInput(value);\n}\n\n/** A number input that also takes its attribute's text (`minZoom=\"0.5\"`), keeping `undefined`. */\nexport function optionalNumber(value: unknown): number | undefined {\n if (value === undefined || value === null || value === \"\") return undefined;\n const number = typeof value === \"number\" ? value : Number(value);\n return Number.isNaN(number) ? undefined : number;\n}\n\n/**\n * What `read` returns, or `fallback` while a required input it reads is not set yet. A part's\n * `state()` may be read by bindings on its own element (`[class.selected]=\"n.state().selected\"`),\n * and Angular may read a binding before it sets the inputs of its element's directives: the input\n * then throws (NG0950). The read still tracks the input, so the computed that calls this runs\n * again once the input is set.\n */\nexport function beforeInputs<V>(fallback: V, read: () => V): V {\n try {\n return read();\n } catch (error) {\n if ((error as { code?: unknown } | null)?.code === -950)\n return fallback;\n throw error;\n }\n}\n\n/** Structural inline style, camelCase keys (`pointerEvents`): an undefined value leaves the key alone. */\nexport type StructuralStyle = Readonly<\n Record<string, string | number | undefined>\n>;\n\nconst kebab = (key: string) =>\n key.startsWith(\"--\")\n ? key\n : key.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);\n\n/** A style's keys as CSS properties, with their values as text (`0` is `\"0\"`). */\nfunction cssEntries(style: StructuralStyle): Map<string, string> {\n const entries = new Map<string, string>();\n for (const [key, value] of Object.entries(style)) {\n if (value !== undefined) entries.set(kebab(key), String(value));\n }\n return entries;\n}\n\n/** A length in pixels for an inline style. */\nexport function px(value: number | undefined): string | undefined {\n return value === undefined ? undefined : `${value}px`;\n}\n\n/**\n * Applies a part's structural style to its element, and keeps it applied as it changes: the keys\n * it sets win over the consumer's static `style` (the directive writes them after the element is\n * created; a host style binding would lose to it) and over the consumer's style bindings\n * (`[style.position]`, `[style]`), which Angular writes when they change: every render ends by\n * writing the structural keys back where a binding replaced them. A key it stops setting gets\n * the consumer's value back (the last one a binding wrote). Every other key of the consumer's\n * style is untouched, and so is what the engine writes itself (the viewport's transform, the\n * root's `touch-action`).\n */\nexport function bindStructuralStyle(\n element: HTMLElement | SVGElement,\n style: () => StructuralStyle,\n): void {\n /**\n * the keys set now: their value, as written and as the element reads it back (`0` reads\n * `0px`), and the consumer's value they replaced\n */\n const owned = new Map<\n string,\n { value: string; written: string; previous: string }\n >();\n /**\n * the element's `style` attribute as it was left last: while it reads the same, no binding\n * replaced a key (one read after each render instead of one per key; a large flow has\n * hundreds of such elements)\n */\n let left: string | null | undefined;\n const write = (name: string, entry: { value: string; written: string }) => {\n element.style.setProperty(name, entry.value);\n entry.written = element.style.getPropertyValue(name);\n };\n /** writes the structural keys back where the consumer's style replaced them */\n const assert = () => {\n const now = element.getAttribute(\"style\");\n if (left !== undefined && now === left) return;\n for (const [name, entry] of owned) {\n const current = element.style.getPropertyValue(name);\n if (current !== entry.written) {\n entry.previous = current;\n write(name, entry);\n }\n }\n left = element.getAttribute(\"style\");\n };\n effect(() => {\n const next = cssEntries(style());\n untracked(() => {\n assert();\n for (const [name, { previous }] of owned) {\n if (!next.has(name)) {\n if (previous === \"\") {\n element.style.removeProperty(name);\n } else {\n element.style.setProperty(name, previous);\n }\n owned.delete(name);\n }\n }\n for (const [name, value] of next) {\n const entry = owned.get(name);\n if (!entry) {\n const previous = element.style.getPropertyValue(name);\n const created = { value, written: \"\", previous };\n owned.set(name, created);\n write(name, created);\n } else if (entry.value !== value) {\n entry.value = value;\n write(name, entry);\n }\n }\n left = element.getAttribute(\"style\");\n });\n });\n afterEveryRender({ write: assert });\n}\n\n/**\n * Applies a default style the consumer's overrides (a handle's place on its node's side): a key is\n * written only while the element has no value of its own for it (none, or the one written here\n * last), so the consumer's static `style` and style bindings win, and a key the consumer stops\n * setting gets the default back at the next change of the defaults.\n */\nexport function bindBaseStyle(\n element: HTMLElement | SVGElement,\n style: () => StructuralStyle,\n): void {\n const written = new Map<string, string>();\n effect(() => {\n const next = cssEntries(style());\n untracked(() => {\n for (const [name, last] of written) {\n if (next.has(name)) continue;\n if (element.style.getPropertyValue(name) === last) {\n element.style.removeProperty(name);\n }\n written.delete(name);\n }\n for (const [name, value] of next) {\n const current = element.style.getPropertyValue(name);\n if (current !== \"\" && current !== written.get(name)) continue;\n element.style.setProperty(name, value);\n written.set(name, element.style.getPropertyValue(name));\n }\n });\n });\n}\n\n/** An element's attributes, by name: `undefined` (or absent) removes one. */\nexport type AttributeRecord = Readonly<Record<string, string | undefined>>;\n\n/**\n * Keeps a part's attributes on its element: the engine's record for the part (`data-flow-part`,\n * `data-flow-id`, its state as `\"\"` or absent) and the part's own (`tabindex`, `d`): sets the ones\n * given, removes the ones no longer given. A host binding is static; these follow the engine\n * (a state attribute comes and goes with a gesture). Never writes `\"false\"`.\n */\nexport function bindAttributes(\n element: Element,\n attributes: () => AttributeRecord,\n): void {\n let applied = new Set<string>();\n effect(() => {\n const next = attributes();\n untracked(() => {\n const now = new Set<string>();\n for (const [name, value] of Object.entries(next)) {\n if (value === undefined) continue;\n if (element.getAttribute(name) !== value)\n element.setAttribute(name, value);\n now.add(name);\n }\n for (const name of applied) {\n if (!now.has(name)) element.removeAttribute(name);\n }\n applied = now;\n });\n });\n}\n\n/**\n * Applies attributes the consumer overrides (an SVG part's `fill`, an edge path's `d`, a button's\n * `type`): an attribute is written only while the element has none of its own (none, or the value\n * written here last), so the consumer's static attribute or `[attr.*]` binding wins.\n */\nexport function bindBaseAttributes(\n element: Element,\n attributes: () => AttributeRecord,\n): void {\n const written = new Map<string, string>();\n effect(() => {\n const next = attributes();\n untracked(() => {\n for (const [name, value] of Object.entries(next)) {\n const current = element.getAttribute(name);\n if (current !== null && current !== written.get(name)) {\n written.delete(name);\n continue;\n }\n if (value === undefined) {\n if (current !== null) element.removeAttribute(name);\n written.delete(name);\n continue;\n }\n if (current !== value) element.setAttribute(name, value);\n written.set(name, value);\n }\n });\n });\n}\n","// From packages/react/src/utils/shallow-equal.ts (Splitter's, nested records compared one level\n// down: a part's attributes, its rect).\n\nfunction same(a: unknown, b: unknown): boolean {\n if (Object.is(a, b)) return true;\n if (\n typeof a !== \"object\" ||\n typeof b !== \"object\" ||\n a === null ||\n b === null ||\n Array.isArray(a) !== Array.isArray(b)\n ) {\n return false;\n }\n const aRecord = a as Readonly<Record<string, unknown>>;\n const bRecord = b as Readonly<Record<string, unknown>>;\n const keys = Object.keys(aRecord);\n return (\n keys.length === Object.keys(bRecord).length &&\n keys.every(\n (key) =>\n Object.hasOwn(bRecord, key) &&\n Object.is(aRecord[key], bRecord[key]),\n )\n );\n}\n\n/**\n * Whether two records (a part's state) hold the same values, a nested record or array compared by\n * its own entries: what decides that a part does not re-render.\n */\nexport function shallowEqual(\n a: Readonly<Record<string, unknown>> | undefined,\n b: Readonly<Record<string, unknown>> | undefined,\n): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n const keys = Object.keys(a);\n return (\n keys.length === Object.keys(b).length &&\n keys.every((key) => Object.hasOwn(b, key) && same(a[key], b[key]))\n );\n}\n","// What the directives and the injection functions share: a value read from the model and the\n// engine (packages/react's `useFlowValue`, as a computed signal), the inputs a part reads before\n// Angular sets them, and the node or edge a part belongs to.\nimport {\n afterNextRender,\n computed,\n DestroyRef,\n inject,\n isSignal,\n type Signal,\n untracked,\n} from \"@angular/core\";\nimport type { EdgeContext, FlowContext, NodeContext } from \"../context\";\nimport {\n entityKey,\n type FlowEntity,\n type FlowValueScope,\n} from \"../utils/flow-store\";\nimport { beforeInputs } from \"../utils/helpers\";\nimport { shallowEqual } from \"../utils/shallow-equal\";\n\n/** Two values the same for re-rendering: records compared by their entries, arrays by their items. */\nexport function sameValue<S>(a: S, b: S): boolean {\n if (Object.is(a, b)) return true;\n if (\n typeof a === \"object\" &&\n typeof b === \"object\" &&\n a !== null &&\n b !== null &&\n !Array.isArray(a) &&\n !Array.isArray(b)\n ) {\n return shallowEqual(\n a as Readonly<Record<string, unknown>>,\n b as Readonly<Record<string, unknown>>,\n );\n }\n if (Array.isArray(a) && Array.isArray(b)) {\n return (\n a.length === b.length &&\n a.every((value, i) => Object.is(value, b[i]))\n );\n }\n return false;\n}\n\n/** What a `flowValue` depends on: its scope, and the node or edge it shows */\nexport interface FlowValueOptions {\n /** `view` (the default): every change; `entity`: a node's or an edge's own view */\n readonly scope?: FlowValueScope;\n /**\n * the node or edge an `entity` reader shows (`undefined` while its input is not set): a\n * measurement tells it only when it changed that node's box or that edge's path. Given, the\n * value is made in an injection context (its record is released on destroy)\n */\n readonly entity?: () => FlowEntity | undefined;\n}\n\n/**\n * A value read from the model and the engine, as a signal that changes only when the value does\n * (`equal`; records by their entries by default): it is read again on every commit of the model,\n * every view change of the engine (measurements, the viewport, a gesture) and every change of a\n * signal `read` reads (an input), and a value equal to the last one keeps the last object, so\n * nothing that reads it updates. An `entity` reader (a node's or an edge's own view) is not read\n * again on a viewport-only step, nor on a measurement that did not change its node or edge.\n */\nexport function flowValue<S>(\n context: FlowContext,\n read: () => S,\n equal: (a: S, b: S) => boolean = sameValue,\n options: FlowValueOptions = {},\n): Signal<S> {\n const { store } = context;\n const { scope = \"view\", entity } = options;\n if (scope === \"view\") {\n return computed(\n () => {\n store.view();\n return read();\n },\n { equal },\n );\n }\n // the record of the node or edge it reads, held while it reads it (released on destroy)\n let held: { key: string; release: () => void } | undefined;\n // a read after destroy must not acquire a record nothing would release\n let destroyed = false;\n if (entity) {\n inject(DestroyRef).onDestroy(() => {\n destroyed = true;\n held?.release();\n held = undefined;\n });\n }\n return computed(\n () => {\n store.entity();\n const of = entity?.();\n if (of && !destroyed) {\n const key = entityKey(of);\n if (held?.key !== key) {\n held?.release();\n held = { key, release: untracked(() => store.acquire(of)) };\n }\n store.counterOf(of)();\n } else {\n // no entity (or no longer one): let go of the old record\n held?.release();\n held = undefined;\n store.measure();\n }\n return read();\n },\n { equal },\n );\n}\n\n/** @internal an `entity` reader's node or edge, from its id (`undefined` while not known) */\nexport function entityOf(\n kind: FlowEntity[\"kind\"],\n id: () => string | undefined,\n): () => FlowEntity | undefined {\n return () => {\n const current = id();\n return current === undefined ? undefined : { kind, id: current };\n };\n}\n\n/** A value an injection function takes: a signal (an input), a getter, or the value itself. */\nexport type ValueOrSignal<T> = T | Signal<T> | (() => T);\n\n/**\n * The value now, read in a reactive context (a signal or a getter is followed); `undefined` while\n * it is a required input Angular has not set yet.\n */\nexport function valueNow<T>(value: ValueOrSignal<T>): T | undefined {\n return isSignal(value) || typeof value === \"function\"\n ? beforeInputs(undefined, value as () => T)\n : value;\n}\n\n/**\n * The id of the node (or edge) a part belongs to: its own input, else the enclosing one's. A part\n * with neither is reported once rendered (React's \"must be rendered inside Flow.Node\"), unless\n * `needed` answers false then (a toolbar of several nodes needs no node).\n */\nexport function partOwnerId(\n part: string,\n own: () => string | undefined,\n around: NodeContext | EdgeContext | null,\n kind: \"node\" | \"edge\",\n needed: () => boolean = () => true,\n): Signal<string | undefined> {\n const id = computed(() => {\n const given = beforeInputs(undefined, own);\n if (given !== undefined) return given;\n if (!around) return undefined;\n return \"nodeId\" in around ? around.nodeId() : around.edgeId();\n });\n afterNextRender(() => {\n if (id() === undefined && needed()) {\n const where = kind === \"node\" ? \"[flowNode]\" : \"[flowEdge]\";\n const input = kind === \"node\" ? \"nodeId\" : \"edgeId\";\n throw new Error(\n `${part} must be used inside ${where} (or be given a ${input})`,\n );\n }\n });\n return id;\n}\n","import {\n computed,\n Directive,\n effect,\n input,\n type Signal,\n untracked,\n} from \"@angular/core\";\nimport {\n type BackgroundPattern,\n type BackgroundVariant,\n partAttributes,\n} from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"../inject/internal\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n onDestroy,\n optionalNumber,\n} from \"../utils/helpers\";\n\nexport interface BackgroundState {\n /** the pattern's tile on the screen, at the current viewport */\n readonly pattern: BackgroundPattern;\n}\n\nconst SVG = \"http://www.w3.org/2000/svg\";\nconst ATTRIBUTES = partAttributes(\"background\");\n\nconst EMPTY_PATTERN: BackgroundPattern = Object.freeze({\n variant: \"dots\",\n x: 0,\n y: 0,\n width: 0,\n height: 0,\n dot: undefined,\n path: undefined,\n strokeWidth: 0,\n});\n\nlet nextId = 0;\n\n/** Sets an element's attributes, as text. */\nfunction set(\n element: Element,\n attributes: Readonly<Record<string, string | number>>,\n): void {\n for (const [name, value] of Object.entries(attributes)) {\n const text = String(value);\n if (element.getAttribute(name) !== text)\n element.setAttribute(name, text);\n }\n}\n\n/**\n * The flow's background (`data-flow-part=\"background\"`), on the app's `<svg flowBackground>`\n * inside `[flowRoot]`, before `[flowViewport]`: an SVG pattern of dots, lines or crosses that\n * pans and zooms with the viewport (`background-pattern`), drawn by the directive inside it (a\n * `pattern` `background-pattern`, its `background-mark`, a `rect` `background-fill`). The marks are\n * drawn in `currentColor`: set the `color` (and the background itself) in your style.\n */\n@Directive({ selector: \"[flowBackground]\", exportAs: \"flowBackground\" })\nexport class FlowBackgroundDirective {\n /** the marks: `dots` (default), `lines` or `cross` */\n readonly variant = input<BackgroundVariant | undefined>(undefined);\n /** the distance between two marks, in flow units; default 20 (`[x, y]` for two) */\n readonly gap = input<number | readonly [number, number] | undefined>(\n undefined,\n );\n /** dots: a dot's diameter (flow units); lines: the stroke width (screen pixels); cross: a bar's length */\n readonly size = input(undefined, { transform: optionalNumber });\n /** the pattern's shift from the flow's origin, in flow units */\n readonly offset = input<number | readonly [number, number] | undefined>(\n undefined,\n );\n\n private readonly context = injectFlowContext(\"[flowBackground]\");\n private readonly pattern = flowValue(this.context, () =>\n this.context.engine()?.get(\"background-pattern\", {\n variant: this.variant(),\n gap: this.gap(),\n size: this.size(),\n offset: this.offset(),\n }),\n );\n\n /** what it draws (`#bg=\"flowBackground\"`, then `bg.state().pattern`) */\n readonly state: Signal<BackgroundState> = computed(() => ({\n pattern: this.pattern() ?? EMPTY_PATTERN,\n }));\n\n constructor() {\n const host = injectHost<SVGSVGElement>();\n bindAttributes(host, () => ATTRIBUTES);\n bindStructuralStyle(host, () => ({\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n pointerEvents: \"none\",\n }));\n // the tile, drawn once the engine is there\n const document = host.ownerDocument;\n const id = `flow-background-${nextId++}`;\n const pattern = document.createElementNS(SVG, \"pattern\");\n set(pattern, {\n \"data-flow-part\": \"background-pattern\",\n id,\n patternUnits: \"userSpaceOnUse\",\n });\n const fill = document.createElementNS(SVG, \"rect\");\n set(fill, {\n \"data-flow-part\": \"background-fill\",\n width: \"100%\",\n height: \"100%\",\n fill: `url(#${id})`,\n });\n let mark: SVGElement | undefined;\n effect(() => {\n const tile = this.pattern();\n untracked(() => {\n if (!tile) {\n pattern.remove();\n fill.remove();\n return;\n }\n set(pattern, {\n x: tile.x,\n y: tile.y,\n width: tile.width,\n height: tile.height,\n });\n const tag = tile.dot ? \"circle\" : \"path\";\n if (mark?.tagName !== tag) {\n mark?.remove();\n mark = document.createElementNS(SVG, tag);\n mark.setAttribute(\"data-flow-part\", \"background-mark\");\n pattern.append(mark);\n }\n if (tile.dot) {\n set(mark, {\n cx: tile.dot.cx,\n cy: tile.dot.cy,\n r: tile.dot.r,\n fill: \"currentColor\",\n });\n } else {\n set(mark, {\n d: tile.path ?? \"\",\n fill: \"none\",\n stroke: \"currentColor\",\n \"stroke-width\": tile.strokeWidth,\n });\n }\n if (!pattern.parentNode) host.append(pattern, fill);\n });\n });\n onDestroy(() => {\n pattern.remove();\n fill.remove();\n });\n }\n}\n","import type { Signal } from \"@angular/core\";\nimport type { Connection } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"./internal\";\n\n/** Two connections that draw and report the same. */\nexport function sameConnection(\n a: Connection | null,\n b: Connection | null,\n): boolean {\n return (\n a === b ||\n (a !== null &&\n b !== null &&\n a.path === b.path &&\n a.status === b.status &&\n a.to === b.to &&\n a.from === b.from &&\n a.toSide === b.toSide)\n );\n}\n\n/**\n * The connection being drawn from a handle (`connection()`), or null, as a signal that changes\n * with it: where it starts and ends, the handle it would end at and whether the drop would be\n * accepted (`status`). Call it in an injection context.\n */\nexport function injectConnection(): Signal<Connection | null> {\n const context = injectFlowContext(\"injectConnection\");\n return flowValue(\n context,\n () => context.engine()?.get(\"connection\") ?? null,\n sameConnection,\n );\n}\n","// Where a part's element is: React renders a part conditionally (`null`) or into a portal; an\n// Angular attribute directive is on the app's own element, so the directive moves that element\n// instead: out of the document while the part is not shown (a connection line between\n// connections), into another element while it is (an edge label into the edges' HTML layer, a\n// toolbar into the root), back to its place otherwise. A comment keeps its place meanwhile.\nimport { effect, untracked } from \"@angular/core\";\nimport { onDestroy } from \"./helpers\";\n\n/** The text of the comment that keeps a moved element's place (`defaultContent` counts it as content). */\nexport const PLACEHOLDER = \"flow-part\";\n\n/** Where an element goes: its own place (`\"here\"`), into another element, or nowhere (`null`). */\nexport type Presence = \"here\" | Element | null;\n\n/**\n * Keeps `element` where `where()` says, as it changes; on destroy, its place's comment goes, and\n * an element moved elsewhere goes too (its view no longer holds it).\n */\nexport function bindPresence(element: Element, where: () => Presence): void {\n let placeholder: Comment | undefined;\n /** the element leaves its place: a comment takes it */\n const leave = () => {\n if (placeholder?.parentNode) return;\n placeholder ??= element.ownerDocument.createComment(PLACEHOLDER);\n element.before(placeholder);\n };\n effect(() => {\n const next = where();\n untracked(() => {\n if (next === \"here\") {\n if (placeholder?.parentNode) placeholder.replaceWith(element);\n return;\n }\n if (!placeholder?.parentNode && element.parentNode) leave();\n if (next === null) {\n element.remove();\n } else if (element.parentNode !== next) {\n next.append(element);\n }\n });\n });\n onDestroy(() => {\n if (placeholder?.parentNode) {\n placeholder.remove();\n element.remove();\n }\n });\n}\n","// What a primitive renders when given no children in React (`Flow.Edge`'s `Flow.EdgePath`, a\n// `NodeResizer`'s eight handles, the minimap's nodes and mask, the connection line's path): an\n// attribute directive renders nothing, so it adds those elements to the app's element itself when\n// the app wrote no element inside it, once rendered.\nimport {\n afterNextRender,\n Injector,\n inject,\n runInInjectionContext,\n} from \"@angular/core\";\nimport { onDestroy } from \"./helpers\";\nimport { PLACEHOLDER } from \"./presence\";\n\n/**\n * Once rendered, when `element` holds no element of the app's (nor one moved away), `create(document)` gives the\n * elements to add (run in the directive's injection context: their bindings live with it); they\n * go with the directive.\n */\nexport function defaultContent(\n element: Element,\n create: (document: Document) => readonly Element[],\n): void {\n const injector = inject(Injector);\n let added: readonly Element[] = [];\n afterNextRender(() => {\n // an element of the app's, or one moved away (a label, a toolbar): content\n const written = [...element.childNodes].some(\n (node) =>\n node.nodeType === node.ELEMENT_NODE ||\n (node.nodeType === node.COMMENT_NODE &&\n node.nodeValue === PLACEHOLDER),\n );\n if (written) return;\n added = runInInjectionContext(injector, () =>\n create(element.ownerDocument),\n );\n element.append(...added);\n });\n onDestroy(() => {\n for (const child of added) child.remove();\n });\n}\n","import { computed, Directive, type Signal } from \"@angular/core\";\nimport type { Connection } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { injectConnection } from \"../inject/inject-connection\";\nimport { flowValue } from \"../inject/internal\";\nimport { defaultContent } from \"../utils/default-content\";\nimport {\n bindAttributes,\n bindBaseAttributes,\n bindStructuralStyle,\n injectHost,\n} from \"../utils/helpers\";\nimport { bindPresence } from \"../utils/presence\";\n\nexport interface ConnectionLineState {\n /** the connection being drawn */\n readonly connection: Connection;\n /** the drop would add the edge: `data-valid` */\n readonly valid: boolean;\n /** the drop would be refused (`model.can(\"edge.add\")`, a middleware's veto): `data-invalid` */\n readonly invalid: boolean;\n}\n\nconst SVG = \"http://www.w3.org/2000/svg\";\n\n/**\n * The connection being drawn (`data-flow-part=\"connection-line\"`, `data-valid` / `data-invalid`,\n * `connection()`), on the app's `<svg flowConnectionLine>` inside `[flowViewport]`: in the\n * document only while a connection is under way. It draws what the app writes inside it in flow\n * coordinates (`#line=\"flowConnectionLine\"`, then `line.state()?.connection.path`), or, when the\n * app writes no element, an unfilled path of the connection (`data-flow-part=\"connection-path\"`).\n */\n@Directive({\n selector: \"[flowConnectionLine]\",\n exportAs: \"flowConnectionLine\",\n})\nexport class FlowConnectionLineDirective {\n private readonly context = injectFlowContext(\"[flowConnectionLine]\");\n private readonly connection = injectConnection();\n private readonly attributes = flowValue(\n this.context,\n () =>\n this.context.engine()?.adapter.attributes(\"connection-line\") ?? {},\n );\n\n /** the line's state (`null` while no connection is drawn) */\n readonly state: Signal<ConnectionLineState | null> = computed(() => {\n const connection = this.connection();\n if (!connection) return null;\n const attributes = this.attributes();\n return {\n connection,\n valid: attributes[\"data-valid\"] !== undefined,\n invalid: attributes[\"data-invalid\"] !== undefined,\n };\n });\n\n constructor() {\n const host = injectHost<SVGSVGElement>();\n bindAttributes(host, () => ({\n ...this.attributes(),\n \"data-flow-part\": \"connection-line\",\n }));\n bindStructuralStyle(host, () => ({\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n overflow: \"visible\",\n pointerEvents: \"none\",\n }));\n bindPresence(host, () => (this.connection() ? \"here\" : null));\n // React's default child: the connection's path\n defaultContent(host, (document) => {\n const path = document.createElementNS(SVG, \"path\");\n path.setAttribute(\"data-flow-part\", \"connection-path\");\n bindBaseAttributes(path, () => ({\n d: this.connection()?.path,\n fill: \"none\",\n }));\n return [path];\n });\n }\n}\n","import { Directive, type Signal, signal } from \"@angular/core\";\nimport { partAttributes } from \"@fragiola/flow\";\nimport { bindAttributes, injectHost } from \"../utils/helpers\";\n\n/** The state of `[flowControls]` (none: its buttons have their own). */\nexport type ControlsState = Record<never, never>;\n\nconst ATTRIBUTES = partAttributes(\"controls\");\n\n/**\n * A group of the viewport's buttons (`data-flow-part=\"controls\"`), on the app's element:\n * `<div flowControls>` holding `[flowZoomIn]`, `[flowZoomOut]`, `[flowFitView]`,\n * `[flowToggleInteractive]` or the app's own. Inside `[flowRoot]`, outside `[flowViewport]`;\n * presses and the wheel over it are left to it. Place it with your style.\n */\n@Directive({ selector: \"[flowControls]\", exportAs: \"flowControls\" })\nexport class FlowControlsDirective {\n /** its state: none (its buttons have their own) */\n readonly state: Signal<ControlsState> = signal({}).asReadonly();\n\n constructor() {\n bindAttributes(injectHost(), () => ATTRIBUTES);\n }\n}\n","import { computed, type Signal } from \"@angular/core\";\nimport {\n type AnyTypes,\n type EdgePath,\n type FlowEdge,\n type FlowTypes,\n flag,\n type PartAttributes,\n partAttributes,\n} from \"@fragiola/flow\";\nimport { type FlowContext, injectFlowContext } from \"../context\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n} from \"../utils/helpers\";\nimport { shallowEqual } from \"../utils/shallow-equal\";\nimport { entityOf, flowValue, type ValueOrSignal, valueNow } from \"./internal\";\n\n/** What an edge shows: its state on screen. */\nexport interface EdgeState<T extends FlowTypes = AnyTypes> {\n readonly edgeId: string;\n /** the edge, as the model holds it */\n readonly edge: FlowEdge<T>;\n /**\n * its path, label point and ends (`edge-path-by`), once both its nodes have a size; an app\n * type gets the bezier path, and its ends to draw its own\n */\n readonly path: EdgePath | undefined;\n /** `data-selected` (`selection()`) */\n readonly selected: boolean;\n /** one of its ends is being moved (`reconnection()`) */\n readonly reconnecting: boolean;\n /** it takes DOM focus (`keyboard()`): `tabindex=\"0\"` */\n readonly focusable: boolean;\n readonly attributes: PartAttributes;\n}\n\nexport interface InjectEdgeResult<T extends FlowTypes = AnyTypes> {\n /** the edge's state (`undefined` while its edge input is not set yet) */\n readonly state: Signal<EdgeState<T> | undefined>;\n}\n\n/** Two edge paths that draw the same (`edge-path-by` builds a new one at every read). */\nexport function sameEdgePath(\n a: EdgePath | undefined,\n b: EdgePath | undefined,\n): boolean {\n if (a === b) return true;\n if (!a || !b) return false;\n return (\n a.path === b.path &&\n a.sourceSide === b.sourceSide &&\n a.targetSide === b.targetSide &&\n a.label.x === b.label.x &&\n a.label.y === b.label.y &&\n a.source.x === b.source.x &&\n a.source.y === b.source.y &&\n a.target.x === b.target.x &&\n a.target.y === b.target.y\n );\n}\n\ninterface EdgeView {\n attributes: PartAttributes;\n path: EdgePath | undefined;\n reconnecting: boolean;\n focusable: boolean;\n}\n\n/**\n * An edge's state, and its element bound (React's `useEdge`), for an edge drawn by hand: call it\n * in the constructor (or a field) of the component or directive whose host element is the edge\n * (an SVG group inside `[flowEdges]`; `[flowEdge]` uses it). The element gets the edge's\n * attributes, its `tabindex` and `pointer-events: visibleStroke`.\n */\nexport function injectEdge<T extends FlowTypes = AnyTypes>(\n edge: ValueOrSignal<FlowEdge<T>>,\n): InjectEdgeResult<T> {\n return bindEdge<T>(\n injectFlowContext(\"injectEdge\"),\n injectHost<SVGElement>(),\n () => valueNow(edge),\n );\n}\n\n/** @internal `injectEdge` over a context and an element */\nexport function bindEdge<T extends FlowTypes>(\n context: FlowContext,\n element: SVGElement | HTMLElement,\n edge: () => FlowEdge<T> | undefined,\n): InjectEdgeResult<T> {\n const view = flowValue(\n context,\n (): EdgeView | undefined => {\n const edgeId = edge()?.id;\n if (edgeId === undefined) return undefined;\n const engine = context.engine();\n return engine\n ? {\n attributes: engine.adapter.attributes(\"edge\", { edgeId }),\n path: engine.get(\"edge-path-by\", { edgeId }),\n reconnecting: engine.is(\"edge-reconnecting\", { edgeId }),\n focusable: engine.is(\"edge-focusable\", { edgeId }),\n }\n : {\n attributes: staticEdgeAttributes(context, \"edge\", edgeId),\n path: context.geometry()?.edgePaths[edgeId],\n reconnecting: false,\n focusable: false,\n };\n },\n (a, b) =>\n a === b ||\n (a !== undefined &&\n b !== undefined &&\n a.reconnecting === b.reconnecting &&\n a.focusable === b.focusable &&\n sameEdgePath(a.path, b.path) &&\n shallowEqual(a.attributes, b.attributes)),\n {\n scope: \"entity\",\n entity: entityOf(\"edge\", () => edge()?.id),\n },\n );\n const state = computed((): EdgeState<T> | undefined => {\n const current = edge();\n const shown = view();\n if (!current || !shown) return undefined;\n return {\n edgeId: current.id,\n edge: current,\n path: shown.path,\n selected: shown.attributes[\"data-selected\"] !== undefined,\n reconnecting: shown.reconnecting,\n focusable: shown.focusable,\n attributes: shown.attributes,\n };\n });\n bindAttributes(element, () => {\n const shown = view();\n return shown\n ? {\n ...shown.attributes,\n tabindex: shown.focusable ? \"0\" : undefined,\n }\n : {};\n });\n bindStructuralStyle(element, () => ({ pointerEvents: \"visibleStroke\" }));\n return { state };\n}\n\n/**\n * @internal an edge part's attributes before the engine exists (the first render): the engine's\n * own for an edge, from the model (`data-selected`, `data-animated`), so nothing changes when it\n * comes\n */\nexport function staticEdgeAttributes(\n context: FlowContext,\n part: \"edge\" | \"edge-path\" | \"edge-label\",\n edgeId: string,\n): PartAttributes {\n const edge = context.model().get(\"edge-by\", { id: edgeId });\n return {\n ...partAttributes(part, edgeId),\n \"data-selected\": flag(edge?.selected === true),\n \"data-animated\": flag(edge?.animated === true),\n };\n}\n\n/** @internal an edge's path, as a signal that changes when it does (the static one before the engine) */\nexport function edgePathOf(\n context: FlowContext,\n edgeId: () => string | undefined,\n): Signal<EdgePath | undefined> {\n return flowValue(\n context,\n () => {\n const id = edgeId();\n if (id === undefined) return undefined;\n const engine = context.engine();\n return engine\n ? engine.get(\"edge-path-by\", { edgeId: id })\n : context.geometry()?.edgePaths[id];\n },\n sameEdgePath,\n {\n scope: \"entity\",\n entity: entityOf(\"edge\", () => edgeId()),\n },\n );\n}\n","// The path of an edge (`[flowEdgePath]`, and the one `[flowEdge]` draws when the app writes none):\n// its `d` from the engine (`edge-path-by`, D9), or the static geometry's before the engine exists,\n// unfilled, on an SVG `<path>`.\nimport { computed, type Signal } from \"@angular/core\";\nimport type { EdgePath } from \"@fragiola/flow\";\nimport type { FlowContext } from \"../context\";\nimport { bindAttributes, bindBaseAttributes } from \"../utils/helpers\";\nimport { edgePathOf, staticEdgeAttributes } from \"./inject-edge\";\nimport { entityOf, flowValue } from \"./internal\";\n\nexport interface EdgePathState {\n readonly edgeId: string;\n /** the edge's path, label point and ends */\n readonly path: EdgePath;\n /** `data-selected` (`selection()`) */\n readonly selected: boolean;\n}\n\n/** @internal binds an edge's path onto `element`; returns its state */\nexport function bindEdgePath(\n context: FlowContext,\n element: SVGElement,\n edgeId: Signal<string | undefined>,\n): Signal<EdgePathState | undefined> {\n const path = edgePathOf(context, edgeId);\n const attributes = flowValue(\n context,\n () => {\n const id = edgeId();\n if (id === undefined) return undefined;\n const engine = context.engine();\n return engine\n ? engine.adapter.attributes(\"edge-path\", { edgeId: id })\n : staticEdgeAttributes(context, \"edge-path\", id);\n },\n undefined,\n {\n scope: \"entity\",\n entity: entityOf(\"edge\", () => edgeId()),\n },\n );\n bindAttributes(element, () => attributes() ?? {});\n // the app's own `d` (an app type drawn from `state.path`'s ends) and `fill` win\n bindBaseAttributes(element, () => ({\n d: path()?.path,\n fill: \"none\",\n }));\n return computed(() => {\n const id = edgeId();\n const current = path();\n const own = attributes();\n if (id === undefined || !current || !own) return undefined;\n return {\n edgeId: id,\n path: current,\n selected: own[\"data-selected\"] !== undefined,\n };\n });\n}\n","import {\n afterRenderEffect,\n computed,\n Directive,\n inject,\n input,\n type Signal,\n untracked,\n} from \"@angular/core\";\nimport type { AnyTypes, FlowEdge, FlowTypes } from \"@fragiola/flow\";\nimport { type EdgeContext, FLOW_EDGE, injectFlowContext } from \"../context\";\nimport { bindEdgePath } from \"../inject/bind-edge-path\";\nimport { bindEdge, type EdgeState } from \"../inject/inject-edge\";\nimport { defaultContent } from \"../utils/default-content\";\nimport { beforeInputs, injectHost } from \"../utils/helpers\";\n\nconst SVG = \"http://www.w3.org/2000/svg\";\n\n/**\n * One edge (`data-flow-part=\"edge\"`, `data-flow-id`), on the app's SVG group inside\n * `<ng-template flowEdgesItem let-edge>`: `<svg:g [flowEdge]=\"edge\">`, drawn once both its nodes\n * have a size. It renders what the app writes inside it (`[flowEdgePath]`, `[flowEdgeLabel]`,\n * `[flowReconnectAnchor]`), and an edge path when the app writes no element; a press on its stroke\n * selects it (`selection()`). Its state is in its `data-*` and in `#e=\"flowEdge\"`.\n */\n@Directive({\n selector: \"[flowEdge]\",\n exportAs: \"flowEdge\",\n providers: [\n {\n provide: FLOW_EDGE,\n useFactory: (): EdgeContext => inject(FlowEdgeDirective).context,\n },\n ],\n})\nexport class FlowEdgeDirective<T extends FlowTypes = AnyTypes> {\n /** the edge it draws: the one `flowEdgesItem` gives its template */\n readonly flowEdge = input.required<FlowEdge<T>>();\n\n private readonly edge = computed(\n () =>\n // (read as unknown: TypeScript does not relate `FlowEdge<T>` to itself here)\n beforeInputs<unknown>(undefined, this.flowEdge) as\n | FlowEdge<T>\n | undefined,\n );\n\n /** @internal what the parts inside it inject */\n readonly context: EdgeContext = {\n edgeId: computed(() => this.edge()?.id),\n };\n\n /** the edge's state (`undefined` on a binding's first read, before its input is set) */\n readonly state: Signal<EdgeState<T> | undefined>;\n\n constructor() {\n const flow = injectFlowContext(\"[flowEdge]\");\n const host = injectHost<SVGElement>();\n this.state = bindEdge<T>(flow, host, this.edge).state;\n // a new edge element (another level's SVG, another template) that had focus takes it back\n afterRenderEffect(() => {\n const engine = flow.engine();\n if (engine) untracked(() => engine.adapter.refocus(host));\n });\n // React's default child: an edge path\n defaultContent(host, (document) => {\n const path = document.createElementNS(SVG, \"path\");\n bindEdgePath(flow, path, this.context.edgeId);\n return [path];\n });\n }\n}\n","import { computed, Directive, inject, input, type Signal } from \"@angular/core\";\nimport type { EdgePath } from \"@fragiola/flow\";\nimport {\n FLOW_EDGE_LABEL_LAYER,\n injectEdgeContext,\n injectFlowContext,\n} from \"../context\";\nimport { edgePathOf, staticEdgeAttributes } from \"../inject/inject-edge\";\nimport { entityOf, flowValue, partOwnerId } from \"../inject/internal\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n} from \"../utils/helpers\";\nimport { bindPresence } from \"../utils/presence\";\n\nexport interface EdgeLabelState {\n readonly edgeId: string;\n /** the edge's path, label point and ends */\n readonly path: EdgePath;\n /** `data-selected` (`selection()`) */\n readonly selected: boolean;\n}\n\n/**\n * An edge's label (`data-flow-part=\"edge-label\"`): the app's HTML element, written inside\n * `[flowEdge]` with the `xhtml:` prefix (`<xhtml:div flowEdgeLabel>`: the edge is SVG, the label\n * HTML) and moved into the HTML layer of `[flowEdges]` (SVG holds no HTML; with several render\n * levels, its edge's level wrapper), centred on the path's\n * label point in flow coordinates. It holds only what the app writes; a press on it selects its\n * edge. It is out of the document while its edge has no path.\n */\n@Directive({ selector: \"[flowEdgeLabel]\", exportAs: \"flowEdgeLabel\" })\nexport class FlowEdgeLabelDirective {\n /** the edge; default the enclosing `[flowEdge]`'s */\n readonly edgeId = input<string | undefined>(undefined);\n\n private readonly context = injectFlowContext(\"[flowEdgeLabel]\");\n private readonly id = partOwnerId(\n \"[flowEdgeLabel]\",\n this.edgeId,\n injectEdgeContext(),\n \"edge\",\n );\n private readonly path = edgePathOf(this.context, this.id);\n private readonly attributes = flowValue(\n this.context,\n () => {\n const edgeId = this.id();\n if (edgeId === undefined) return undefined;\n const engine = this.context.engine();\n return engine\n ? engine.adapter.attributes(\"edge-label\", { edgeId })\n : staticEdgeAttributes(this.context, \"edge-label\", edgeId);\n },\n undefined,\n {\n scope: \"entity\",\n entity: entityOf(\"edge\", () => this.id()),\n },\n );\n\n /** the label's state (`undefined` while its edge has no path) */\n readonly state: Signal<EdgeLabelState | undefined> = computed(() => {\n const edgeId = this.id();\n const path = this.path();\n const attributes = this.attributes();\n if (edgeId === undefined || !path || !attributes) return undefined;\n return {\n edgeId,\n path,\n selected: attributes[\"data-selected\"] !== undefined,\n };\n });\n\n constructor() {\n const host = injectHost();\n const layers = inject(FLOW_EDGE_LABEL_LAYER, { optional: true });\n bindAttributes(host, () => this.attributes() ?? {});\n bindStructuralStyle(host, () => {\n const label = this.path()?.label;\n return {\n position: \"absolute\",\n top: 0,\n left: 0,\n transform: label\n ? `translate(${label.x}px, ${label.y}px) translate(-50%, -50%)`\n : undefined,\n pointerEvents: \"all\",\n };\n });\n // into the HTML layer of its edge's level\n bindPresence(host, () => {\n const state = this.state();\n return state && layers ? layers.of(state.edgeId) : null;\n });\n }\n}\n","import { Directive, input, type Signal } from \"@angular/core\";\nimport { injectEdgeContext, injectFlowContext } from \"../context\";\nimport { bindEdgePath, type EdgePathState } from \"../inject/bind-edge-path\";\nimport { partOwnerId } from \"../inject/internal\";\nimport { injectHost } from \"../utils/helpers\";\n\nexport type { EdgePathState } from \"../inject/bind-edge-path\";\n\n/**\n * An edge's path (`data-flow-part=\"edge-path\"`), on the app's SVG `<path>` inside `[flowEdge]`:\n * `<svg:path flowEdgePath />`. Its `d` is the engine's (`edge-path-by`, D9) and it is unfilled;\n * a `d` (or a `fill`) of the app's own wins: an app type is drawn from `state().path`'s ends.\n * Several may share an edge: a wide transparent one is a bigger press target.\n */\n@Directive({ selector: \"[flowEdgePath]\", exportAs: \"flowEdgePath\" })\nexport class FlowEdgePathDirective {\n /** the edge; default the enclosing `[flowEdge]`'s */\n readonly edgeId = input<string | undefined>(undefined);\n\n /** the path's state (`undefined` until the edge has a path) */\n readonly state: Signal<EdgePathState | undefined> = bindEdgePath(\n injectFlowContext(\"[flowEdgePath]\"),\n injectHost<SVGElement>(),\n partOwnerId(\"[flowEdgePath]\", this.edgeId, injectEdgeContext(), \"edge\"),\n );\n}\n","import { computed, Directive, input, type Signal } from \"@angular/core\";\nimport type { EdgeToolbarPosition, PartAttributes, XY } from \"@fragiola/flow\";\nimport { injectEdgeContext, injectFlowContext } from \"../context\";\nimport { flowValue, partOwnerId } from \"../inject/internal\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n optionalBoolean,\n} from \"../utils/helpers\";\nimport { bindPresence } from \"../utils/presence\";\n\nexport interface EdgeToolbarState {\n readonly edgeId: string;\n /** the point of the edge it stands at */\n readonly position: \"label\" | \"source\" | \"target\";\n /** where it is anchored (its `alignX` / `alignY` point), in pixels relative to the root */\n readonly anchor: EdgeToolbarPosition;\n}\n\ninterface ToolbarView {\n anchor: EdgeToolbarPosition;\n attributes: PartAttributes;\n}\n\n/**\n * A toolbar on an edge (`data-flow-part=\"toolbar\"`, `data-flow-id` its edge's id), on the app's\n * HTML element, written inside `[flowEdge]` with the `xhtml:` prefix (`<xhtml:div\n * flowEdgeToolbar>`: the edge is SVG, the toolbar HTML) and moved into `[flowRoot]` (outside the\n * zoom), at the point `edge-toolbar-by` gives (the edge's label point, one of its ends or its\n * `point`; centred unless `alignX` / `alignY` say otherwise), so it keeps its size at any zoom. It\n * is in the document only while it is shown (`open`; by default while its edge is selected).\n * Presses and the wheel over it are left to it. It holds only what the app writes (its buttons).\n */\n@Directive({ selector: \"[flowEdgeToolbar]\", exportAs: \"flowEdgeToolbar\" })\nexport class FlowEdgeToolbarDirective {\n /** its edge; default the enclosing `[flowEdge]`'s */\n readonly edgeId = input<string | undefined>(undefined);\n /** the point of the edge it stands at: its label point, its source or its target end; default `\"label\"` */\n readonly position = input<\"label\" | \"source\" | \"target\" | undefined>(\n undefined,\n );\n /** a flow point it stands at instead (absolute flow coordinates); wins over `position` */\n readonly point = input<XY | undefined>(undefined);\n /** a screen offset from that point, in pixels; default `{ x: 0, y: 0 }` */\n readonly offset = input<XY | undefined>(undefined);\n /** which of its edges goes at the point across: its left (`\"start\"`), centre (default) or right */\n readonly alignX = input<\"start\" | \"center\" | \"end\" | undefined>(undefined);\n /** which of its edges goes at the point down: its top (`\"start\"`), centre (default) or bottom */\n readonly alignY = input<\"start\" | \"center\" | \"end\" | undefined>(undefined);\n /** whether it is shown; default while its edge is selected (`selection()`) */\n readonly open = input(undefined, { transform: optionalBoolean });\n\n private readonly context = injectFlowContext(\"[flowEdgeToolbar]\");\n private readonly id = partOwnerId(\n \"[flowEdgeToolbar]\",\n this.edgeId,\n injectEdgeContext(),\n \"edge\",\n );\n private readonly view = flowValue(\n this.context,\n (): ToolbarView | undefined => {\n const engine = this.context.engine();\n const edgeId = this.id();\n if (!engine || edgeId === undefined) return undefined;\n // hidden, it reads nothing of the view: a pan or a zoom gives the same value (nothing\n // is checked again); shown, an equal anchor keeps the last value\n const shown =\n this.open() ??\n this.context.model().is(\"edge-selected\", { edgeId });\n if (!shown) return undefined;\n const anchor = engine.get(\"edge-toolbar-by\", {\n edgeId,\n position: this.position() ?? \"label\",\n point: this.point(),\n offset: this.offset(),\n alignX: this.alignX(),\n alignY: this.alignY(),\n });\n return anchor\n ? {\n anchor,\n attributes: engine.adapter.attributes(\"toolbar\", {\n edgeId,\n }),\n }\n : undefined;\n },\n );\n\n /** the toolbar's state (`null` while it is not shown) */\n readonly state: Signal<EdgeToolbarState | null> = computed(() => {\n const view = this.view();\n const edgeId = this.id();\n if (!view || edgeId === undefined) return null;\n return {\n edgeId,\n position: this.position() ?? \"label\",\n anchor: view.anchor,\n };\n });\n\n constructor() {\n const host = injectHost();\n bindAttributes(host, () => this.view()?.attributes ?? {});\n bindStructuralStyle(host, () => {\n const anchor = this.view()?.anchor;\n return {\n position: \"absolute\",\n top: 0,\n left: 0,\n transform: anchor\n ? `translate(${anchor.x}px, ${anchor.y}px) translate(${-anchor.anchorX * 100}%, ${-anchor.anchorY * 100}%)`\n : undefined,\n };\n });\n bindPresence(host, () =>\n this.state() ? this.context.rootElement : null,\n );\n }\n}\n","// The views of a collection part (`flowNodesItem`, `flowEdgesItem`): one per entity, keyed by its\n// id, each in a root view of its own. Angular refreshes a template's embedded views with their\n// component (a signal read in one marks the component), so a node's view in the app's component\n// would be checked again on every drag step of any node; in a view of its own (a `FlowSlot`\n// attached to the application), only the view whose node changed is. The views are still checked\n// whenever the app's component is (`markForCheck` from the directive's `ngDoCheck`), as embedded\n// views are. Their elements are placed by the part, in order, before its template's anchor (or\n// the anchor an item names: an edge's render level).\n// `SignalContext` is from Dockable (fragiola/dockable, packages/angular/src/lib/utils/views.ts),\n// same author and licence.\nimport {\n ApplicationRef,\n ChangeDetectionStrategy,\n Component,\n type ComponentRef,\n createComponent,\n type EmbeddedViewRef,\n EnvironmentInjector,\n Injector,\n inject,\n signal,\n type TemplateRef,\n untracked,\n ViewContainerRef,\n type WritableSignal,\n} from \"@angular/core\";\n\n/**\n * A template context whose fields are signals behind getters: a view reads them while it renders,\n * so setting a field renders that view again, and nothing else.\n */\nexport class SignalContext<V extends object> {\n private readonly fields: { [K in keyof V]: WritableSignal<V[K]> };\n\n constructor(initial: V) {\n const fields = {} as { [K in keyof V]: WritableSignal<V[K]> };\n for (const key of Object.keys(initial) as (keyof V)[]) {\n fields[key] = signal(initial[key]);\n Object.defineProperty(this, key, {\n enumerable: true,\n get: () => fields[key](),\n });\n }\n this.fields = fields;\n }\n\n /** Sets the fields that changed. */\n update(next: V): void {\n for (const key of Object.keys(next) as (keyof V)[]) {\n const field = this.fields[key];\n if (!Object.is(untracked(field), next[key])) {\n field.set(next[key]);\n }\n }\n }\n}\n\n/** A {@link SignalContext}, seen as the context type its template declares. */\nexport function signalContext<V extends object>(\n initial: V,\n): SignalContext<V> & V {\n return new SignalContext(initial) as SignalContext<V> & V;\n}\n\n/**\n * The root view an entity's view lives in: a component with no template whose host stays out of\n * the document; its container (next to its host) holds the entity's view, whose elements are\n * moved to their place.\n */\n@Component({\n selector: \"flow-slot\",\n template: \"\",\n changeDetection: ChangeDetectionStrategy.OnPush,\n})\nexport class FlowSlot {\n /** @internal where the entity's view is created */\n readonly container = inject(ViewContainerRef);\n}\n\ninterface Slot<C extends object> {\n readonly ref: ComponentRef<FlowSlot>;\n /** where its view's elements are made, out of the document */\n readonly box: HTMLElement;\n readonly view: EmbeddedViewRef<SignalContext<C> & C>;\n /** where its elements were placed last (the parent of their anchor) */\n place: Node | null;\n}\n\n/** An entity's view to show: its key, its template context, and the anchor it goes before. */\nexport interface SlotItem<C extends object> {\n readonly key: string;\n readonly context: C;\n /** the node its elements go before; default the template's anchor */\n readonly anchor?: Node | undefined;\n}\n\n/** The views of a template, one per key, each in a root view of its own, placed before `anchor`. */\nexport class SlotViews<C extends object> {\n private readonly slots = new Map<string, Slot<C>>();\n private readonly app = inject(ApplicationRef);\n private readonly environmentInjector = inject(EnvironmentInjector);\n private readonly elementInjector = inject(Injector);\n\n constructor(\n private readonly anchor: Comment,\n private readonly template: TemplateRef<C>,\n ) {}\n\n /**\n * Brings the views to `items`, in their order before each one's anchor: a key that stays keeps\n * its view and its elements, moved when its anchor is elsewhere now (`moved` is told the root\n * elements that changed parent, and the one put back in its parent that had focus: either\n * lost it).\n */\n sync(\n items: readonly SlotItem<C>[],\n moved?: (elements: readonly Element[]) => void,\n ): void {\n untracked(() => {\n const keep = new Set(items.map((item) => item.key));\n for (const [key, slot] of this.slots) {\n if (!keep.has(key)) {\n slot.ref.destroy();\n this.slots.delete(key);\n }\n }\n // the slots by anchor, each list in order\n const byAnchor = new Map<Node, Slot<C>[]>();\n for (const { key, context, anchor } of items) {\n let slot = this.slots.get(key);\n if (slot) {\n slot.view.context.update(context);\n } else {\n slot = this.create(context);\n this.slots.set(key, slot);\n }\n const at = anchor ?? this.anchor;\n const list = byAnchor.get(at) ?? [];\n list.push(slot);\n byAnchor.set(at, list);\n }\n const changed: Element[] = [];\n const active = this.anchor.ownerDocument.activeElement;\n for (const [anchor, ordered] of byAnchor) {\n // in order, from the last: each view's elements before the next one's\n let next: Node = anchor;\n const parent = anchor.parentNode;\n for (let i = ordered.length - 1; i >= 0; i--) {\n const slot = ordered[i];\n if (!slot) continue;\n // a root element a part moved elsewhere (a label into the edges' HTML layer,\n // a toolbar into the root) stays there: its comment keeps its place here\n const from = slot.place;\n const nodes = (slot.view.rootNodes as Node[]).filter(\n (node) =>\n node.parentNode === parent ||\n node.parentNode === slot.box ||\n (from !== null && node.parentNode === from),\n );\n const last = nodes.at(-1);\n if (last && last.nextSibling !== next) {\n for (const node of nodes) {\n const before = node.parentNode;\n next.parentNode?.insertBefore(node, next);\n if (\n before !== slot.box &&\n node.nodeType === 1 &&\n (before !== node.parentNode ||\n (active !== null && node.contains(active)))\n ) {\n changed.push(node as Element);\n }\n }\n }\n slot.place = parent;\n next = nodes[0] ?? next;\n }\n }\n if (changed.length > 0) moved?.(changed);\n });\n }\n\n /** Has every view checked with the next render (its component was). */\n markForCheck(): void {\n for (const slot of this.slots.values()) {\n slot.ref.changeDetectorRef.markForCheck();\n }\n }\n\n clear(): void {\n for (const slot of this.slots.values()) slot.ref.destroy();\n this.slots.clear();\n }\n\n private create(context: C): Slot<C> {\n const document = this.anchor.ownerDocument;\n // the slot's host, and the view next to it, stay out of the document\n const box = document.createElement(\"div\");\n const host = document.createElement(\"flow-slot\");\n box.append(host);\n const ref = createComponent(FlowSlot, {\n environmentInjector: this.environmentInjector,\n elementInjector: this.elementInjector,\n hostElement: host,\n });\n this.app.attachView(ref.hostView);\n const view = ref.instance.container.createEmbeddedView(\n this.template as unknown as TemplateRef<SignalContext<C> & C>,\n signalContext(context),\n );\n ref.changeDetectorRef.markForCheck();\n return { ref, box, view, place: null };\n }\n}\n","import {\n computed,\n Directive,\n type DoCheck,\n effect,\n Injector,\n inject,\n input,\n runInInjectionContext,\n type Signal,\n TemplateRef,\n untracked,\n ViewContainerRef,\n} from \"@angular/core\";\nimport {\n type AnyTypes,\n edgesLayerAttributes,\n type FlowEdge,\n type FlowTypes,\n partAttributes,\n} from \"@fragiola/flow\";\nimport {\n type EdgeLabelLayers,\n FLOW_EDGE_LABEL_LAYER,\n injectFlowContext,\n} from \"../context\";\nimport { flowValue } from \"../inject/internal\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n onDestroy,\n type StructuralStyle,\n} from \"../utils/helpers\";\nimport { SlotViews } from \"../utils/views\";\nimport type { TypedBy } from \"./nodes.directive\";\n\nexport interface EdgesState {\n /** how many edges are drawn */\n count: number;\n}\n\n/** The context of the `flowEdgesItem` template: the edge (`let-edge`). */\nexport interface EdgesItemContext<T extends FlowTypes = AnyTypes> {\n $implicit: FlowEdge<T>;\n edge: FlowEdge<T>;\n}\n\nconst SVG = \"http://www.w3.org/2000/svg\";\nconst ATTRIBUTES = partAttributes(\"edges\");\n\nconst LAYER_STYLE: StructuralStyle = {\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n overflow: \"visible\",\n pointerEvents: \"none\",\n};\n\n/** One render level's elements, with several levels: its wrapper (`edges-layer`) and its SVG. */\ninterface LevelLayer {\n readonly wrapper: HTMLElement;\n readonly svg: SVGSVGElement;\n}\n\n/**\n * The layer of the edges (`data-flow-part=\"edges\"`), on the app's element inside `[flowViewport]`,\n * before `[flowNodes]`: `<div flowEdges>`. It holds an SVG of its own (`data-flow-part=\"edges\"`\n * too) where its `<ng-template flowEdgesItem let-edge>` draws each edge, once both its nodes have\n * a size (before the engine exists, from the document's sizes: the static geometry), in the\n * core's drawing order (`drawn-edges`: by stack value), and it is the HTML layer edge labels go\n * to. When an edge stands above some node (`render-layers` has several levels), each level gets a\n * wrapper (`data-flow-part=\"edges-layer\"`, `data-level`, the level's `z-index`) holding its own\n * SVG and its edges' labels, and the nodes interleave with them; the nodes never move. It lets\n * presses through to the pane; the edges' own parts take them.\n */\n@Directive({\n selector: \"[flowEdges]\",\n exportAs: \"flowEdges\",\n providers: [\n {\n provide: FLOW_EDGE_LABEL_LAYER,\n // the directive is the labels' layers by its `of` (internal, so out of the published\n // types: an `implements` there would name a member the .d.ts does not have)\n useFactory: (): EdgeLabelLayers => inject(FlowEdgesDirective),\n },\n ],\n})\nexport class FlowEdgesDirective {\n private readonly context = injectFlowContext(\"[flowEdges]\");\n /** @internal the HTML layer: the app's element */\n readonly host = injectHost();\n /** @internal the SVG the edges are drawn in */\n readonly svg: SVGSVGElement = this.host.ownerDocument.createElementNS(\n SVG,\n \"svg\",\n );\n\n /** each level's wrapper and SVG, made when first needed (level 0's SVG is {@link svg}) */\n private readonly levels: LevelLayer[] = [];\n private readonly injector = inject(Injector);\n\n /** @internal the edges it draws now */\n readonly list: Signal<readonly FlowEdge[]> = flowValue(this.context, () => {\n const engine = this.context.engine();\n // the core's drawing order: shown, measured, in view with `onlyRenderVisible`, by z-order\n if (engine) return engine.get(\"drawn-edges\");\n // before the engine: none in a culled flow (the view is not known yet: React's, so no\n // edge mounts to be torn down at once), else the static geometry's (the edges whose nodes\n // have a declared size); its levels are kept, empty\n if (this.context.culled()) return [];\n const geometry = this.context.geometry();\n if (!geometry) return [];\n const model = this.context.model();\n return geometry.drawnEdges.flatMap((id) => {\n const edge = model.get(\"edge-by\", { id });\n return edge ? [edge] : [];\n });\n });\n\n /** @internal several render levels: each one in its own wrapper */\n readonly layered = computed(() => this.context.layers().length > 1);\n\n /** @internal each drawn edge's level, with several levels */\n readonly levelOf = computed((): ReadonlyMap<string, number> => {\n const levels = new Map<string, number>();\n for (const layer of this.context.layers()) {\n for (const id of layer.edgeIds) levels.set(id, layer.level);\n }\n return levels;\n });\n\n /** what it shows (`#edges=\"flowEdges\"`, then `edges.state().count`) */\n readonly state: Signal<EdgesState> = flowValue(this.context, () => ({\n count: this.list().length,\n }));\n\n constructor() {\n bindAttributes(this.host, () => ATTRIBUTES);\n bindStructuralStyle(this.host, () => LAYER_STYLE);\n for (const [name, value] of Object.entries(ATTRIBUTES)) {\n if (value !== undefined) this.svg.setAttribute(name, value);\n }\n bindStructuralStyle(this.svg, () => LAYER_STYLE);\n this.host.prepend(this.svg);\n // one level: the SVG in the app's element (the DOM before levels); several: a wrapper each\n effect(() => {\n const count = this.context.layers().length;\n untracked(() => this.arrange(count));\n });\n onDestroy(() => {\n this.svg.remove();\n for (const { wrapper } of this.levels) wrapper.remove();\n });\n }\n\n /** @internal the SVG a level's edges are drawn in */\n svgOf(level: number): SVGSVGElement {\n return level === 0 ? this.svg : this.level(level).svg;\n }\n\n /** @internal the HTML layer of an edge's level: where its labels go */\n of(edgeId: string): HTMLElement {\n if (!this.layered()) return this.host;\n const level = this.levelOf().get(edgeId) ?? 0;\n return untracked(() => this.level(level).wrapper);\n }\n\n /** a level's wrapper and SVG, made once (they stay out of the document while not drawn) */\n private level(level: number): LevelLayer {\n for (let i = this.levels.length; i <= level; i++) {\n untracked(() =>\n runInInjectionContext(this.injector, () =>\n this.levels.push(this.createLevel(i)),\n ),\n );\n }\n return this.levels[level] as LevelLayer;\n }\n\n private createLevel(level: number): LevelLayer {\n const document = this.host.ownerDocument;\n const wrapper = document.createElement(\"div\");\n bindAttributes(wrapper, () => {\n const engine = this.context.engine();\n return engine\n ? engine.adapter.attributes(\"edges-layer\", { level })\n : edgesLayerAttributes(level);\n });\n bindStructuralStyle(wrapper, () => ({\n ...LAYER_STYLE,\n zIndex: this.context.layers()[level]?.zIndex,\n }));\n let svg = this.svg;\n if (level > 0) {\n svg = document.createElementNS(SVG, \"svg\");\n for (const [name, value] of Object.entries(ATTRIBUTES)) {\n if (value !== undefined) svg.setAttribute(name, value);\n }\n bindStructuralStyle(svg, () => LAYER_STYLE);\n wrapper.append(svg);\n }\n return { wrapper, svg };\n }\n\n /**\n * brings the elements to `count` levels; level 0's SVG moving into or out of its wrapper\n * takes the focus from an edge in it, given back after the move\n */\n private arrange(count: number): void {\n const active = this.host.ownerDocument.activeElement;\n const focused =\n active && active !== this.svg && this.svg.contains(active)\n ? active\n : undefined;\n this.place(count);\n if (focused) this.context.engine()?.adapter.refocus(focused);\n }\n\n private place(count: number): void {\n if (count <= 1) {\n for (const { wrapper } of this.levels) wrapper.remove();\n if (this.svg.parentNode !== this.host) this.host.prepend(this.svg);\n return;\n }\n const shown = Array.from(\n { length: count },\n (_, level) => this.level(level).wrapper,\n );\n for (const { wrapper } of this.levels.slice(count)) wrapper.remove();\n const first = shown[0] as HTMLElement;\n if (this.svg.parentNode !== first) first.prepend(this.svg);\n const inPlace = shown.every(\n (wrapper, i) => this.host.children[i] === wrapper,\n );\n if (!inPlace) this.host.prepend(...shown);\n }\n}\n\n/**\n * Draws one edge, inside `[flowEdges]`: `<ng-template flowEdgesItem let-edge>`, usually a\n * `<svg:g [flowEdge]=\"edge\">` with its path and label (the `svg:` prefix: the template is written\n * in the HTML layer, its views go into the SVG). `[flowEdgesItem]=\"model\"` types the edge by the\n * model's registry. An edge's view is rendered again only when its edge changes; its path follows\n * the engine by itself.\n */\n@Directive({ selector: \"ng-template[flowEdgesItem]\" })\nexport class FlowEdgesItemDirective<T extends FlowTypes = AnyTypes>\n implements DoCheck\n{\n /** what types the template's edge (optional): the model */\n readonly flowEdgesItem = input<TypedBy<T>>(undefined);\n\n static ngTemplateContextGuard<T extends FlowTypes>(\n _directive: FlowEdgesItemDirective<T>,\n _context: unknown,\n ): _context is EdgesItemContext<T> {\n return true;\n }\n\n private readonly views: SlotViews<EdgesItemContext<T>>;\n\n constructor() {\n const edges = inject(FlowEdgesDirective, { optional: true });\n if (!edges) {\n throw new Error(\"flowEdgesItem must be used inside [flowEdges]\");\n }\n // the views go where the template's anchor is: in the SVG (level 0's), and with several\n // render levels before an anchor of their own in each other level's SVG\n const anchor = inject(ViewContainerRef).element\n .nativeElement as Comment;\n edges.svg.append(anchor);\n const anchors: Comment[] = [anchor];\n const anchorOf = (level: number): Comment => {\n let at = anchors[level];\n if (!at) {\n at = anchor.ownerDocument.createComment(\"\");\n edges.svgOf(level).append(at);\n anchors[level] = at;\n }\n return at;\n };\n const views = new SlotViews(\n anchor,\n inject<TemplateRef<EdgesItemContext<T>>>(TemplateRef),\n );\n this.views = views;\n const context = injectFlowContext(\"flowEdgesItem\");\n effect(() => {\n const list = edges.list() as readonly FlowEdge<T>[];\n const layered = edges.layered();\n const levels = edges.levelOf();\n untracked(() =>\n views.sync(\n list.map((edge) => ({\n key: edge.id,\n context: { $implicit: edge, edge },\n anchor: layered\n ? anchorOf(levels.get(edge.id) ?? 0)\n : anchor,\n })),\n // an edge moved to another level's SVG gets back the focus the move took\n (moved) => {\n const engine = context.engine();\n for (const element of moved) {\n engine?.adapter.refocus(element);\n }\n },\n ),\n );\n });\n onDestroy(() => {\n views.clear();\n for (const at of anchors) at?.remove();\n });\n }\n\n /** its views are checked whenever the template it is in is (Angular's embedded views are) */\n ngDoCheck(): void {\n this.views.markForCheck();\n }\n}\n","// The buttons of `[flowControls]`: each runs one engine action on its own click (before the app's\n// `(click)`: a directive's host listener comes first), and is disabled while the engine refuses\n// it (`engine.can`), updating when the view changes: the root renders the change of its click\n// before the next task (`renderSoon`), so a button its click took to a limit never looks enabled\n// meanwhile (a second click would do nothing).\nimport { computed, type Signal } from \"@angular/core\";\nimport type { EngineActionKey } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport {\n bindAttributes,\n bindBaseAttributes,\n injectHost,\n} from \"../utils/helpers\";\nimport { flowValue } from \"./internal\";\n\n/** What a control button shows. */\nexport interface ControlButtonState {\n /** the engine refuses its action now (a zoom at its limit, `fit-view` before a size) */\n readonly disabled: boolean;\n}\n\n/** @internal a control button: its state, bound onto its element, and its click */\nexport function controlButton(\n part: string,\n action: EngineActionKey,\n disabledInput: () => boolean | undefined,\n payload: () => object = () => ({}),\n): { state: Signal<ControlButtonState>; click: () => void } {\n const context = injectFlowContext(`[flow${pascal(part)}]`);\n const host = injectHost<HTMLButtonElement>();\n const allowed = flowValue(context, () => {\n const engine = context.engine();\n return engine ? engine.can(action, payload() as never) : false;\n });\n const state = computed(() => ({\n disabled: disabledInput() === true || !allowed(),\n }));\n bindAttributes(host, () => ({\n \"data-flow-part\": part,\n \"data-disabled\": state().disabled ? \"\" : undefined,\n disabled: state().disabled ? \"\" : undefined,\n }));\n bindBaseAttributes(host, () => ({ type: \"button\" }));\n return {\n state,\n click: () => {\n const engine = context.engine();\n if (!engine) return;\n engine.run(action, payload() as never);\n },\n };\n}\n\n/** @internal a control's payload: the fields its inputs give (an absent one is the engine's default) */\nexport function givenPayload<P extends object>(fields: P): Partial<P> {\n return Object.fromEntries(\n Object.entries(fields).filter(([, value]) => value !== undefined),\n ) as Partial<P>;\n}\n\n/** `zoom-in` → `ZoomIn`. */\nfunction pascal(part: string): string {\n return part.replace(/(^|-)(\\w)/g, (_match, _dash, letter: string) =>\n letter.toUpperCase(),\n );\n}\n","import { Directive, input, type Signal } from \"@angular/core\";\nimport type { FitPadding } from \"@fragiola/flow\";\nimport {\n type ControlButtonState,\n controlButton,\n givenPayload,\n} from \"../inject/control-button\";\nimport { optionalBoolean, optionalNumber } from \"../utils/helpers\";\n\n/**\n * A button (`data-flow-part=\"fit-view\"`), on the app's `<button flowFitView>`: fits every node in\n * the root, or its `nodeIds` (`fit-view`, with its inputs as the payload), disabled before a node\n * is measured. It holds only what the app writes (an icon, a label); `type=\"button\"` unless the\n * app sets one.\n */\n@Directive({\n selector: \"[flowFitView]\",\n exportAs: \"flowFitView\",\n host: { \"(click)\": \"click()\" },\n})\nexport class FlowFitViewDirective {\n /** disabled whatever the engine says */\n readonly disabled = input(undefined, { transform: optionalBoolean });\n /** how long its viewport change animates, in milliseconds (the root's `easing`); default 0: at once */\n readonly duration = input(undefined, { transform: optionalNumber });\n /**\n * the room kept free on every side: a share of the root's size, `\"<n>px\"`, or each side's\n * (`{ top, right, bottom, left }`); default the engine's 0.1\n */\n readonly padding = input<FitPadding | undefined>(undefined);\n /** only these nodes; default every node that is not hidden */\n readonly nodeIds = input<string[] | undefined>(undefined);\n /** without `nodeIds`, the hidden nodes of known size too; default false */\n readonly includeHidden = input(undefined, { transform: optionalBoolean });\n /** the least zoom it may pick (within the root's limits); default the root's `minZoom` */\n readonly minZoom = input(undefined, { transform: optionalNumber });\n /** the greatest zoom it may pick (within the root's limits); default the root's `maxZoom` */\n readonly maxZoom = input(undefined, { transform: optionalNumber });\n\n private readonly button = controlButton(\n \"fit-view\",\n \"fit-view\",\n this.disabled,\n () =>\n givenPayload({\n duration: this.duration(),\n padding: this.padding(),\n nodeIds: this.nodeIds(),\n includeHidden: this.includeHidden(),\n minZoom: this.minZoom(),\n maxZoom: this.maxZoom(),\n }),\n );\n\n /** the button's state (`#b=\"flowFitView\"`, then `b.state().disabled`) */\n readonly state: Signal<ControlButtonState> = this.button.state;\n\n /** @internal its action, before the app's `(click)` */\n protected click(): void {\n if (!this.state().disabled) this.button.click();\n }\n}\n","import {\n afterRenderEffect,\n computed,\n type Signal,\n untracked,\n} from \"@angular/core\";\nimport {\n type HandleRegistration,\n type HandleSide,\n type HandleType,\n type PartAttributes,\n partAttributes,\n} from \"@fragiola/flow\";\nimport {\n type FlowContext,\n injectFlowContext,\n injectNodeContext,\n} from \"../context\";\nimport {\n bindAttributes,\n bindBaseStyle,\n bindStructuralStyle,\n injectHost,\n type StructuralStyle,\n} from \"../utils/helpers\";\nimport {\n flowValue,\n partOwnerId,\n type ValueOrSignal,\n valueNow,\n} from \"./internal\";\n\nexport interface InjectHandleOptions {\n /** whether edges start (`source`) or end (`target`) here */\n type: HandleType;\n /** the side of the node it sits on: the direction its edges leave or enter by */\n side: HandleSide;\n /** its id among the node's handles of its type (none: the node's default handle) */\n handleId?: string | undefined;\n /** whether a connection may start or end here; default true */\n connectable?: boolean | undefined;\n /** whether a connection may start here (a drag, a tap, a key); default true */\n connectableStart?: boolean | undefined;\n /** whether a connection may end here (be its target); default true */\n connectableEnd?: boolean | undefined;\n /** its node; default the enclosing `[flowNode]`'s */\n nodeId?: string | undefined;\n}\n\n/** What a handle shows. */\nexport interface HandleState {\n readonly nodeId: string;\n readonly handleId: string | undefined;\n readonly type: HandleType;\n readonly side: HandleSide;\n /** a connection may start or end here (its flag and its node's): `data-connectable` */\n readonly connectable: boolean;\n /** a connection may start here: `data-connectable-start` */\n readonly connectableStart: boolean;\n /** a connection may end here: `data-connectable-end` */\n readonly connectableEnd: boolean;\n /** the connection under way starts here (`connection()`): `data-connecting` */\n readonly connecting: boolean;\n /** the connection under way would end here and be accepted: `data-valid` */\n readonly valid: boolean;\n /** the connection under way would end here and be refused: `data-invalid` */\n readonly invalid: boolean;\n readonly attributes: PartAttributes;\n}\n\nexport interface InjectHandleResult {\n /** the handle's state (`undefined` until its node and its inputs are known) */\n readonly state: Signal<HandleState | undefined>;\n}\n\n/** Where a handle sits by default: centred on its side of the node (a style may move it). */\nconst SIDE_STYLE: Record<HandleSide, StructuralStyle> = {\n top: { top: 0, left: \"50%\", transform: \"translate(-50%, -50%)\" },\n right: { top: \"50%\", left: \"100%\", transform: \"translate(-50%, -50%)\" },\n bottom: { top: \"100%\", left: \"50%\", transform: \"translate(-50%, -50%)\" },\n left: { top: \"50%\", left: 0, transform: \"translate(-50%, -50%)\" },\n};\n\n/** Two registrations of the same handle. */\nfunction sameRegistration(\n a: HandleRegistration | undefined,\n b: HandleRegistration | undefined,\n): boolean {\n return (\n a === b ||\n (a !== undefined &&\n b !== undefined &&\n a.nodeId === b.nodeId &&\n a.handleId === b.handleId &&\n a.type === b.type &&\n a.side === b.side &&\n a.connectable === b.connectable &&\n a.connectableStart === b.connectableStart &&\n a.connectableEnd === b.connectableEnd)\n );\n}\n\n/**\n * A handle's state, and its element bound (React's `useHandle`), for a handle rendered by hand:\n * call it in the constructor (or a field) of the component or directive whose host element is the\n * handle, inside a `[flowNode]` (`[flowHandle]` uses it). The element gets the handle's attributes\n * and its place (absolute, centred on its side by default: a style may move it), and is registered\n * with the engine (D8), which measures its centre.\n */\nexport function injectHandle(\n options: ValueOrSignal<InjectHandleOptions>,\n): InjectHandleResult {\n const context = injectFlowContext(\"injectHandle\");\n const nodeId = partOwnerId(\n \"injectHandle\",\n () => valueNow(options)?.nodeId,\n injectNodeContext(),\n \"node\",\n );\n return bindHandle(context, injectHost(), () => {\n const given = valueNow(options);\n const id = nodeId();\n return given && id !== undefined ? { ...given, nodeId: id } : undefined;\n });\n}\n\n/** @internal `injectHandle` over a context, an element and its registration */\nexport function bindHandle(\n context: FlowContext,\n element: HTMLElement,\n options: () => InjectHandleOptions | undefined,\n): InjectHandleResult {\n const registration = computed(\n (): HandleRegistration | undefined => {\n const given = options();\n if (!given || given.nodeId === undefined) return undefined;\n return {\n nodeId: given.nodeId,\n handleId: given.handleId,\n type: given.type,\n side: given.side,\n connectable: given.connectable,\n connectableStart: given.connectableStart,\n connectableEnd: given.connectableEnd,\n };\n },\n { equal: sameRegistration },\n );\n const attributes = flowValue(\n context,\n (): PartAttributes | undefined => {\n const handle = registration();\n if (!handle) return undefined;\n const engine = context.engine();\n return engine\n ? engine.adapter.attributes(\"handle\", handle)\n : {\n ...partAttributes(\"handle\", handle.handleId),\n \"data-handle-type\": handle.type,\n \"data-side\": handle.side,\n };\n },\n undefined,\n { scope: \"entity\" },\n );\n const state = computed((): HandleState | undefined => {\n const handle = registration();\n const current = attributes();\n if (!handle || !current) return undefined;\n return {\n nodeId: handle.nodeId,\n handleId: handle.handleId,\n type: handle.type,\n side: handle.side,\n connectable: current[\"data-connectable\"] !== undefined,\n connectableStart: current[\"data-connectable-start\"] !== undefined,\n connectableEnd: current[\"data-connectable-end\"] !== undefined,\n connecting: current[\"data-connecting\"] !== undefined,\n valid: current[\"data-valid\"] !== undefined,\n invalid: current[\"data-invalid\"] !== undefined,\n attributes: current,\n };\n });\n bindAttributes(element, () => attributes() ?? {});\n bindStructuralStyle(element, () => ({ position: \"absolute\" }));\n bindBaseStyle(element, () => {\n const side = registration()?.side;\n return side ? SIDE_STYLE[side] : {};\n });\n // registered after the render in the first phase, as its node (`bindNode`): after it, and\n // before the app's own after-render hooks of the other phases\n afterRenderEffect({\n earlyRead: (onCleanup) => {\n const engine = context.engine();\n const handle = registration();\n if (!engine || !handle) return;\n untracked(() => {\n engine.adapter.registerHandle(handle, element);\n onCleanup(() => engine.adapter.registerHandle(handle, null));\n });\n },\n });\n return { state };\n}\n","import { Directive, input, type Signal } from \"@angular/core\";\nimport type { HandleSide, HandleType } from \"@fragiola/flow\";\nimport { injectFlowContext, injectNodeContext } from \"../context\";\nimport { bindHandle, type HandleState } from \"../inject/inject-handle\";\nimport { partOwnerId } from \"../inject/internal\";\nimport { beforeInputs, injectHost, optionalBoolean } from \"../utils/helpers\";\n\n/**\n * A node's connection point (`data-flow-part=\"handle\"`, `data-handle-type`, `data-side`), on the\n * app's element inside `[flowNode]`: `<div flowHandle type=\"source\" side=\"bottom\">`. It is\n * registered with the engine (D8), which measures its centre; with `connection()`, a press on it\n * draws a connection. Absolutely positioned at the middle of its `side` by default: the app's\n * style may place it elsewhere on the node. Give it its size and look.\n */\n@Directive({ selector: \"[flowHandle]\", exportAs: \"flowHandle\" })\nexport class FlowHandleDirective {\n /** whether edges start (`source`) or end (`target`) here */\n readonly type = input.required<HandleType>();\n /** the side of the node it sits on: the direction its edges leave or enter by */\n readonly side = input.required<HandleSide>();\n /** its id among the node's handles of its type (none: the node's default handle) */\n readonly handleId = input<string | undefined>(undefined);\n /** whether a connection may start or end here; default true */\n readonly connectable = input(undefined, { transform: optionalBoolean });\n /** whether a connection may start here (a drag, a tap, a key); default true */\n readonly connectableStart = input(undefined, {\n transform: optionalBoolean,\n });\n /** whether a connection may end here (be its target); default true */\n readonly connectableEnd = input(undefined, { transform: optionalBoolean });\n /** its node; default the enclosing `[flowNode]`'s */\n readonly nodeId = input<string | undefined>(undefined);\n\n /** the handle's state (`#h=\"flowHandle\"`, then `h.state()?.valid`) */\n readonly state: Signal<HandleState | undefined>;\n\n constructor() {\n const nodeId = partOwnerId(\n \"[flowHandle]\",\n this.nodeId,\n injectNodeContext(),\n \"node\",\n );\n this.state = bindHandle(\n injectFlowContext(\"[flowHandle]\"),\n injectHost(),\n () =>\n beforeInputs(undefined, () => ({\n type: this.type(),\n side: this.side(),\n handleId: this.handleId(),\n connectable: this.connectable(),\n connectableStart: this.connectableStart(),\n connectableEnd: this.connectableEnd(),\n nodeId: nodeId(),\n })),\n ).state;\n }\n}\n","import {\n afterRenderEffect,\n computed,\n type Signal,\n untracked,\n} from \"@angular/core\";\nimport {\n type AnyTypes,\n type FlowNode,\n type FlowTypes,\n flag,\n type PartAttributes,\n partAttributes,\n} from \"@fragiola/flow\";\nimport { type FlowContext, injectFlowContext } from \"../context\";\nimport {\n type AttributeRecord,\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n px,\n type StructuralStyle,\n} from \"../utils/helpers\";\nimport { entityOf, flowValue, type ValueOrSignal, valueNow } from \"./internal\";\n\n/** What a node shows: its state on screen. */\nexport interface NodeState<T extends FlowTypes = AnyTypes> {\n readonly nodeId: string;\n /** the node, as the model holds it */\n readonly node: FlowNode<T>;\n /** its top-left corner in absolute flow coordinates (its parents' positions added) */\n readonly x: number;\n readonly y: number;\n /** `data-selected` (`selection()`) */\n readonly selected: boolean;\n /** `data-dragging` (`drag()`) */\n readonly dragging: boolean;\n /** `data-resizing` (`resize()`) */\n readonly resizing: boolean;\n /** its size is known (measured or given): `data-measured` */\n readonly measured: boolean;\n /** it takes DOM focus (`keyboard()`): `tabindex=\"0\"` */\n readonly focusable: boolean;\n /** the attributes its element carries (`data-flow-part`, `data-flow-id`, the state) */\n readonly attributes: PartAttributes;\n}\n\n/** What a node's element gets: its attributes (`tabindex` too) and its structural style. */\nexport interface NodeElementProps {\n readonly attributes: AttributeRecord;\n readonly style: StructuralStyle;\n}\n\nexport interface InjectNodeResult<T extends FlowTypes = AnyTypes> {\n /** the node's state (`undefined` while its node input is not set yet) */\n readonly state: Signal<NodeState<T> | undefined>;\n /** what the element is given (applied already) */\n readonly props: Signal<NodeElementProps>;\n}\n\ninterface NodeView {\n attributes: PartAttributes;\n x: number;\n y: number;\n /** its structural `z-index` (`node-z-index-by`, or the static geometry's) */\n zIndex: number | undefined;\n focusable: boolean;\n}\n\n/**\n * A node's state, and its element bound (React's `useNode`), for a node rendered by hand: call it\n * in the constructor (or a field) of the component or directive whose host element is the node\n * (`[flowNode]` uses it). That element gets the node's attributes, its `tabindex`, its structural\n * style (absolute, at its place, its `z-index` among the nodes, with the document's size when given) and is registered with the\n * engine, which measures it and resolves presses on it.\n *\n * ```ts\n * @Component({ selector: \"article[appNode]\", template: \"…\" })\n * class AppNode {\n * readonly node = input.required<FlowNode<Types>>({ alias: \"appNode\" });\n * readonly own = injectNode(this.node);\n * }\n * ```\n */\nexport function injectNode<T extends FlowTypes = AnyTypes>(\n node: ValueOrSignal<FlowNode<T>>,\n): InjectNodeResult<T> {\n return bindNode<T>(injectFlowContext(\"injectNode\"), injectHost(), () =>\n valueNow(node),\n );\n}\n\n/** @internal `injectNode` over a context and an element */\nexport function bindNode<T extends FlowTypes>(\n context: FlowContext,\n element: HTMLElement,\n node: () => FlowNode<T> | undefined,\n): InjectNodeResult<T> {\n const nodeId = computed(() => node()?.id);\n const view = flowValue(\n context,\n (): NodeView | undefined => {\n const current = node() as FlowNode | undefined;\n if (!current) return undefined;\n const id = current.id;\n const engine = context.engine();\n if (!engine) {\n // the first render: the static geometry's place (the node's origin applied) and stack\n const geometry = context.geometry();\n const rect = geometry?.nodeRects[id];\n return {\n attributes: {\n ...partAttributes(\"node\", id),\n \"data-selected\": flag(current.selected === true),\n },\n x: rect?.x ?? current.position.x,\n y: rect?.y ?? current.position.y,\n zIndex: geometry?.nodeZIndexes[id],\n focusable: false,\n };\n }\n const rect = engine.get(\"node-rect-by\", { nodeId: id });\n return {\n attributes: engine.adapter.attributes(\"node\", { nodeId: id }),\n x: rect?.x ?? current.position.x,\n y: rect?.y ?? current.position.y,\n zIndex: engine.get(\"node-z-index-by\", { nodeId: id }),\n focusable: engine.is(\"node-focusable\", { nodeId: id }),\n };\n },\n undefined,\n {\n scope: \"entity\",\n entity: entityOf(\"node\", () => node()?.id),\n },\n );\n const state = computed((): NodeState<T> | undefined => {\n const current = node();\n const shown = view();\n if (!current || !shown) return undefined;\n const { attributes } = shown;\n return {\n nodeId: current.id,\n node: current,\n x: shown.x,\n y: shown.y,\n selected: attributes[\"data-selected\"] !== undefined,\n dragging: attributes[\"data-dragging\"] !== undefined,\n resizing: attributes[\"data-resizing\"] !== undefined,\n measured: attributes[\"data-measured\"] !== undefined,\n focusable: shown.focusable,\n attributes,\n };\n });\n const props = computed((): NodeElementProps => {\n const current = node();\n const shown = view();\n if (!current || !shown) return { attributes: {}, style: {} };\n return {\n attributes: {\n ...shown.attributes,\n tabindex: shown.focusable ? \"0\" : undefined,\n },\n style: {\n position: \"absolute\",\n top: 0,\n left: 0,\n transform: `translate(${shown.x}px, ${shown.y}px)`,\n zIndex: shown.zIndex,\n width: px(current.width),\n height: px(current.height),\n },\n };\n });\n bindAttributes(element, () => props().attributes);\n bindStructuralStyle(element, () => props().style);\n // registered once per engine and node id: a move or a selection registers nothing again.\n // After the render (every node of it inserted, so the first measurement lays the page out\n // once), in the first phase (`earlyRead`: the engine measures the node, reading the DOM), so\n // a node the app added is registered before the app's own after-render hooks of the other\n // phases run (`afterNextRender`'s default, `mixedReadWrite`), and its content's. Each node's\n // is its own hook: one that throws goes to the app's `ErrorHandler`, the others still run\n afterRenderEffect({\n earlyRead: (onCleanup) => {\n const engine = context.engine();\n const id = nodeId();\n if (!engine || id === undefined) return;\n untracked(() => {\n engine.adapter.registerNode(id, element);\n onCleanup(() => engine.adapter.registerNode(id, null));\n });\n },\n });\n return { state, props };\n}\n","import { computed, Directive, inject, input, type Signal } from \"@angular/core\";\nimport type { AnyTypes, FlowNode, FlowTypes } from \"@fragiola/flow\";\nimport { FLOW_NODE, injectFlowContext, type NodeContext } from \"../context\";\nimport { bindNode, type NodeState } from \"../inject/inject-node\";\nimport { beforeInputs, injectHost } from \"../utils/helpers\";\n\n/**\n * One node (`data-flow-part=\"node\"`, `data-flow-id`), on the app's element:\n * `<div [flowNode]=\"node\">`, inside `<ng-template flowNodesItem let-node>`. It is absolutely\n * positioned at its place in the viewport (a structural `transform`), registered with the engine,\n * which measures it and resolves presses on it (drag, select, connect from its handles). It renders\n * only what the app writes: the content, `[flowHandle]`s, a resizer, a toolbar, which belong to it.\n * Its state is in its `data-*` and in `#n=\"flowNode\"` (`n.state()?.selected`).\n */\n@Directive({\n selector: \"[flowNode]\",\n exportAs: \"flowNode\",\n providers: [\n {\n provide: FLOW_NODE,\n useFactory: (): NodeContext => inject(FlowNodeDirective).context,\n },\n ],\n})\nexport class FlowNodeDirective<T extends FlowTypes = AnyTypes> {\n /** the node it renders: the one `flowNodesItem` gives its template */\n readonly flowNode = input.required<FlowNode<T>>();\n\n private readonly node = computed(() =>\n beforeInputs(undefined, () => this.flowNode()),\n );\n\n /** @internal what the parts inside it inject */\n readonly context: NodeContext = {\n nodeId: computed(() => this.node()?.id),\n };\n\n /** the node's state (`undefined` on a binding's first read, before its input is set) */\n readonly state: Signal<NodeState<T> | undefined> = bindNode<T>(\n injectFlowContext(\"[flowNode]\"),\n injectHost(),\n this.node,\n ).state;\n}\n","import { computed, Directive, input, type Signal } from \"@angular/core\";\nimport type {\n HandleSide,\n NodeToolbarPosition,\n PartAttributes,\n} from \"@fragiola/flow\";\nimport { injectFlowContext, injectNodeContext } from \"../context\";\nimport { flowValue, partOwnerId } from \"../inject/internal\";\nimport {\n beforeInputs,\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n optionalBoolean,\n optionalNumber,\n} from \"../utils/helpers\";\nimport { bindPresence } from \"../utils/presence\";\n\nexport interface NodeToolbarState {\n /** its node (undefined for several nodes' toolbar) */\n readonly nodeId: string | undefined;\n /** the nodes it stands beside: `nodeIds`, or its one node */\n readonly nodeIds: readonly string[];\n /** where it is anchored, in pixels relative to the root */\n readonly position: NodeToolbarPosition;\n readonly side: HandleSide;\n}\n\ninterface ToolbarView {\n position: NodeToolbarPosition;\n nodeId: string | undefined;\n nodeIds: readonly string[];\n attributes: PartAttributes;\n}\n\n/**\n * A toolbar next to a node (`data-flow-part=\"toolbar\"`), on the app's element inside `[flowNode]`:\n * `<div flowNodeToolbar>`, or anywhere in `[flowRoot]` beside several nodes' bounds\n * (`[nodeIds]`), moved into `[flowRoot]` (outside the zoom) at the anchor `node-toolbar-by` gives,\n * so it keeps its size at any zoom. It is in the document only while it is shown (`open`; by\n * default while its node, or every node of `nodeIds`, is selected). Presses and the wheel over it are left\n * to it. It holds only what the app writes (its buttons).\n */\n@Directive({ selector: \"[flowNodeToolbar]\", exportAs: \"flowNodeToolbar\" })\nexport class FlowNodeToolbarDirective {\n /** its node; default the enclosing `[flowNode]`'s */\n readonly nodeId = input<string | undefined>(undefined);\n /**\n * several nodes it stands beside (their bounds), instead of one; when not empty it wins over\n * `nodeId`, and the toolbar is shown by default while every one of them is selected\n */\n readonly nodeIds = input<readonly string[] | undefined>(undefined);\n /** the node's side it stands on; default `\"top\"` */\n readonly side = input<HandleSide | undefined>(undefined);\n /** where along that side; default `\"center\"` */\n readonly align = input<\"start\" | \"center\" | \"end\" | undefined>(undefined);\n /** the gap between the node and the toolbar, in pixels; default 10 */\n readonly offset = input(undefined, { transform: optionalNumber });\n /** whether it is shown; default while its node (every node of `nodeIds`) is selected (`selection()`) */\n readonly open = input(undefined, { transform: optionalBoolean });\n\n private readonly context = injectFlowContext(\"[flowNodeToolbar]\");\n // several nodes (`nodeIds` not empty), or one: the given one or the enclosing node's\n private readonly many = computed(\n () => (beforeInputs(undefined, this.nodeIds)?.length ?? 0) > 0,\n );\n private readonly id = partOwnerId(\n \"[flowNodeToolbar]\",\n this.nodeId,\n injectNodeContext(),\n \"node\",\n () => !this.many(),\n );\n private readonly view = flowValue(\n this.context,\n (): ToolbarView | undefined => {\n const engine = this.context.engine();\n const many = this.many();\n const nodeId = many ? undefined : this.id();\n if (!engine || (!many && nodeId === undefined)) return undefined;\n const nodeIds =\n nodeId === undefined ? [...(this.nodeIds() ?? [])] : [nodeId];\n // hidden, it reads nothing of the view: a pan or a zoom gives the same value (nothing\n // is checked again); shown, an equal anchor keeps the last value\n const model = this.context.model();\n const shown =\n this.open() ??\n nodeIds.every((id) =>\n model.is(\"node-selected\", { nodeId: id }),\n );\n if (!shown) return undefined;\n const position = engine.get(\"node-toolbar-by\", {\n ...(nodeId === undefined ? { nodeIds } : { nodeId }),\n side: this.side() ?? \"top\",\n align: this.align(),\n offset: this.offset(),\n });\n return position\n ? {\n position,\n nodeId,\n nodeIds,\n attributes: engine.adapter.attributes(\n \"toolbar\",\n nodeId === undefined ? {} : { nodeId },\n ),\n }\n : undefined;\n },\n );\n\n /** the toolbar's state (`null` while it is not shown) */\n readonly state: Signal<NodeToolbarState | null> = computed(() => {\n const view = this.view();\n if (!view) return null;\n return {\n nodeId: view.nodeId,\n nodeIds: view.nodeIds,\n position: view.position,\n side: this.side() ?? \"top\",\n };\n });\n\n constructor() {\n const host = injectHost();\n bindAttributes(host, () => this.view()?.attributes ?? {});\n bindStructuralStyle(host, () => {\n const position = this.view()?.position;\n return {\n position: \"absolute\",\n top: 0,\n left: 0,\n transform: position\n ? `translate(${position.x}px, ${position.y}px) translate(${-position.anchorX * 100}%, ${-position.anchorY * 100}%)`\n : undefined,\n };\n });\n bindPresence(host, () =>\n this.state() ? this.context.rootElement : null,\n );\n }\n}\n","import {\n Directive,\n type DoCheck,\n effect,\n inject,\n input,\n type Signal,\n TemplateRef,\n ViewContainerRef,\n} from \"@angular/core\";\nimport {\n type AnyTypes,\n type FlowFeatures,\n type FlowModel,\n type FlowNode,\n type FlowTypes,\n partAttributes,\n} from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"../inject/internal\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n onDestroy,\n} from \"../utils/helpers\";\nimport { SlotViews } from \"../utils/views\";\n\nexport interface NodesState {\n /** how many nodes are rendered */\n count: number;\n}\n\n/** The context of the `flowNodesItem` template: the node (`let-node`). */\nexport interface NodesItemContext<T extends FlowTypes = AnyTypes> {\n $implicit: FlowNode<T>;\n node: FlowNode<T>;\n}\n\n/** What types a template's entities by a registry: the model (`[flowNodesItem]=\"model\"`), or nothing. */\nexport type TypedBy<T extends FlowTypes> =\n | FlowModel<T, FlowFeatures>\n | \"\"\n | null\n | undefined;\n\nconst ATTRIBUTES = partAttributes(\"nodes\");\n\n/**\n * The layer of the nodes (`data-flow-part=\"nodes\"`), on the app's element inside `[flowViewport]`:\n * `<div flowNodes>`. Its `<ng-template flowNodesItem let-node>` renders each node that is not\n * hidden (with `onlyRenderVisible`, each one in view, `visible-nodes`, and none before the engine\n * exists), in drawing order, keyed by its id (a node keeps its view and its element when it moves).\n */\n@Directive({ selector: \"[flowNodes]\", exportAs: \"flowNodes\" })\nexport class FlowNodesDirective {\n private readonly context = injectFlowContext(\"[flowNodes]\");\n\n /** @internal the nodes it renders now */\n readonly list: Signal<readonly FlowNode[]> = flowValue(this.context, () => {\n const engine = this.context.engine();\n if (engine?.adapter.settings.onlyRenderVisible) {\n return engine.get(\"visible-nodes\");\n }\n // a culled flow renders no node before the engine (React's): every node's static\n // geometry mounted for one render, then torn down, took most of a large flow's open\n if (!engine && this.context.culled()) return [];\n return this.context\n .model()\n .get(\"all-nodes\")\n .filter((node) => node.hidden !== true);\n });\n\n /** what it shows (`#nodes=\"flowNodes\"`, then `nodes.state().count`) */\n readonly state: Signal<NodesState> = flowValue(this.context, () => ({\n count: this.list().length,\n }));\n\n constructor() {\n const host = injectHost();\n bindAttributes(host, () => ATTRIBUTES);\n // its own stacking context with one render level: the nodes' z-index (a selected one\n // raised) orders them among themselves, never above what follows the layer (the\n // connection line). With several, none: their (negative) z-indexes interleave with the\n // edges' level layers in the viewport's stacking context\n bindStructuralStyle(host, () => ({\n position: \"absolute\",\n top: 0,\n left: 0,\n isolation: this.context.layers().length > 1 ? undefined : \"isolate\",\n }));\n }\n}\n\n/**\n * Renders one node, inside `[flowNodes]`: `<ng-template flowNodesItem let-node>` (or\n * `<div *flowNodesItem=\"let node\" [flowNode]=\"node\">`), usually a `[flowNode]` with its content\n * and handles. `[flowNodesItem]=\"model\"` types the node by the model's registry. A node's view is\n * rendered again only when its node changes (the model shares the nodes it did not change): a drag\n * step renders the moved nodes only. Another template (an `@if` around two) renders every node\n * again with it.\n */\n@Directive({ selector: \"ng-template[flowNodesItem]\" })\nexport class FlowNodesItemDirective<T extends FlowTypes = AnyTypes>\n implements DoCheck\n{\n /** what types the template's node (optional): the model */\n readonly flowNodesItem = input<TypedBy<T>>(undefined);\n\n static ngTemplateContextGuard<T extends FlowTypes>(\n _directive: FlowNodesItemDirective<T>,\n _context: unknown,\n ): _context is NodesItemContext<T> {\n return true;\n }\n\n private readonly views: SlotViews<NodesItemContext<T>>;\n\n constructor() {\n const nodes = inject(FlowNodesDirective, { optional: true });\n if (!nodes) {\n throw new Error(\"flowNodesItem must be used inside [flowNodes]\");\n }\n const anchor = inject(ViewContainerRef).element\n .nativeElement as Comment;\n const views = new SlotViews(\n anchor,\n inject<TemplateRef<NodesItemContext<T>>>(TemplateRef),\n );\n this.views = views;\n effect(() => {\n const list = nodes.list() as readonly FlowNode<T>[];\n views.sync(\n list.map((node) => ({\n key: node.id,\n context: { $implicit: node, node },\n })),\n );\n });\n onDestroy(() => views.clear());\n }\n\n /** its views are checked whenever the template it is in is (Angular's embedded views are) */\n ngDoCheck(): void {\n this.views.markForCheck();\n }\n}\n","import { computed, Directive, type Signal } from \"@angular/core\";\nimport type { Rect } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"../inject/internal\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n px,\n} from \"../utils/helpers\";\nimport { bindPresence } from \"../utils/presence\";\n\nexport interface NodesSelectionState {\n /** the rectangle around the selected nodes, in flow coordinates */\n readonly rect: Rect;\n /** the selection is being dragged by it: `data-dragging` */\n readonly dragging: boolean;\n}\n\n/**\n * The rectangle around the selected nodes (`data-flow-part=\"nodes-selection\"`, `selection()`), on\n * the app's element: `<div flowNodesSelection>` inside `[flowViewport]`, after `[flowNodes]` (it\n * is in flow coordinates). It is in the document only at `selection-rect`: while two or more nodes\n * are selected by a box (or always, with `selection({ rect: \"always\" })`). A press on it drags the\n * selection (`drag()`), its context menu is the selection's. With `keyboard()` it takes focus\n * (`tabindex`), and its keys are a focused selected node's: the arrows move the selection, the\n * delete keys remove it, Escape clears it. Give it its look.\n */\n@Directive({ selector: \"[flowNodesSelection]\", exportAs: \"flowNodesSelection\" })\nexport class FlowNodesSelectionDirective {\n private readonly context = injectFlowContext(\"[flowNodesSelection]\");\n private readonly rect = flowValue(\n this.context,\n () => this.context.engine()?.get(\"selection-rect\") ?? null,\n );\n private readonly attributes = flowValue(\n this.context,\n () =>\n this.context.engine()?.adapter.attributes(\"nodes-selection\") ?? {},\n );\n\n /** the rectangle's state (`null` while it is not shown) */\n readonly state: Signal<NodesSelectionState | null> = computed(() => {\n const rect = this.rect();\n return rect\n ? {\n rect,\n dragging: this.attributes()[\"data-dragging\"] !== undefined,\n }\n : null;\n });\n\n constructor() {\n const host = injectHost();\n bindAttributes(host, () => ({\n ...this.attributes(),\n \"data-flow-part\": \"nodes-selection\",\n }));\n bindStructuralStyle(host, () => {\n const rect = this.rect();\n return {\n position: \"absolute\",\n top: 0,\n left: 0,\n transform: rect\n ? `translate(${rect.x}px, ${rect.y}px)`\n : undefined,\n width: px(rect?.width),\n height: px(rect?.height),\n };\n });\n bindPresence(host, () => (this.rect() ? \"here\" : null));\n }\n}\n","import { computed, Directive, input, type Signal } from \"@angular/core\";\nimport type { EdgePath } from \"@fragiola/flow\";\nimport { injectEdgeContext, injectFlowContext } from \"../context\";\nimport { edgePathOf } from \"../inject/inject-edge\";\nimport { entityOf, flowValue, partOwnerId } from \"../inject/internal\";\nimport {\n beforeInputs,\n bindAttributes,\n bindBaseAttributes,\n bindStructuralStyle,\n injectHost,\n} from \"../utils/helpers\";\nimport { bindPresence } from \"../utils/presence\";\n\nexport interface ReconnectAnchorState {\n readonly edgeId: string;\n /** which end of the edge it moves */\n readonly end: \"source\" | \"target\";\n /** the edge's path and ends */\n readonly path: EdgePath;\n /** this edge's end is being moved */\n readonly reconnecting: boolean;\n}\n\n/**\n * An edge end's grab area (`data-flow-part=\"reconnect-anchor\"`, `data-end`), on the app's SVG\n * circle inside `[flowEdge]`: `<svg:circle flowReconnectAnchor end=\"target\" />`, at that end.\n * With `reconnection()`, a press on it moves that end to another handle; an end its edge's\n * `reconnectable` keeps fixed (`false`, or the other end's name) has none: the element leaves the\n * document meanwhile. Transparent by default; give it its radius (`r`, default 10) and look.\n */\n@Directive({\n selector: \"[flowReconnectAnchor]\",\n exportAs: \"flowReconnectAnchor\",\n})\nexport class FlowReconnectAnchorDirective {\n /** which end of the edge it moves */\n readonly end = input.required<\"source\" | \"target\">();\n /** the edge; default the enclosing `[flowEdge]`'s */\n readonly edgeId = input<string | undefined>(undefined);\n\n private readonly context = injectFlowContext(\"[flowReconnectAnchor]\");\n private readonly id = partOwnerId(\n \"[flowReconnectAnchor]\",\n this.edgeId,\n injectEdgeContext(),\n \"edge\",\n );\n private readonly path = edgePathOf(this.context, this.id);\n /**\n * this end may move (`edge-reconnectable`): `reconnectable: \"source\"` (or `\"target\"`, or\n * false) keeps the other end fixed, which draws no anchor\n */\n private readonly movable = flowValue(\n this.context,\n () => {\n const edgeId = this.id();\n const end = beforeInputs(undefined, this.end);\n if (edgeId === undefined || !end) return true;\n return this.context\n .model()\n .is(\"edge-reconnectable\", { edgeId, end });\n },\n undefined,\n {\n scope: \"entity\",\n entity: entityOf(\"edge\", () => this.id()),\n },\n );\n private readonly view = flowValue(\n this.context,\n () => {\n const edgeId = this.id();\n const engine = this.context.engine();\n const end = beforeInputs(undefined, this.end);\n if (edgeId === undefined || !engine || !end) return undefined;\n return {\n end,\n attributes: engine.adapter.attributes(\"reconnect-anchor\", {\n edgeId,\n end,\n }),\n reconnecting: engine.is(\"edge-reconnecting\", { edgeId }),\n };\n },\n undefined,\n {\n scope: \"entity\",\n entity: entityOf(\"edge\", () => this.id()),\n },\n );\n\n /** the anchor's state (`undefined` while its edge has no path, or its end may not move) */\n readonly state: Signal<ReconnectAnchorState | undefined> = computed(() => {\n const edgeId = this.id();\n const path = this.path();\n const view = this.view();\n if (edgeId === undefined || !path || !view || !this.movable()) {\n return undefined;\n }\n return {\n edgeId,\n end: view.end,\n path,\n reconnecting: view.reconnecting,\n };\n });\n\n constructor() {\n const host = injectHost<SVGElement>();\n bindAttributes(host, () => this.view()?.attributes ?? {});\n bindBaseAttributes(host, () => {\n const state = this.state();\n const point = state ? state.path[state.end] : undefined;\n return {\n cx: point === undefined ? undefined : String(point.x),\n cy: point === undefined ? undefined : String(point.y),\n r: \"10\",\n fill: \"transparent\",\n };\n });\n bindStructuralStyle(host, () => ({ pointerEvents: \"all\" }));\n bindPresence(host, () => (this.movable() ? \"here\" : null));\n }\n}\n","// From packages/react/src/hooks/create-flow-ref.ts (Tree's), with the value in a signal: a\n// template or a computed that reads `flow.current` follows the root as it attaches and detaches,\n// so Angular needs no `useFlowRef` re-render (`injectFlowRef` is the same ref, made in a field).\nimport { signal, untracked, type WritableSignal } from \"@angular/core\";\nimport type {\n AnyTypes,\n FlowEngine,\n FlowFeatures,\n FlowModel,\n FlowTypes,\n} from \"@fragiola/flow\";\n\n/** What a flow ref gives once its `[flowRoot]` is rendered: the root's model and engine. */\nexport interface FlowRefValue<\n T extends FlowTypes = AnyTypes,\n F extends FlowFeatures = readonly [],\n> {\n readonly model: FlowModel<T, F>;\n readonly engine: FlowEngine<T, F>;\n}\n\n/**\n * Access to a `[flowRoot]` from outside it (a toolbar, a menu, a test): pass it as the root's\n * `flowRef`; `current` is the root's model and engine while it lives, `null` otherwise. Reading\n * `current` in a template, a `computed` or an `effect` follows it.\n */\nexport interface FlowRef<\n T extends FlowTypes = AnyTypes,\n F extends FlowFeatures = readonly [],\n> {\n readonly current: FlowRefValue<T, F> | null;\n}\n\nconst slots = new WeakMap<object, WritableSignal<FlowRefValue | null>>();\n\nfunction slotOf(ref: object): WritableSignal<FlowRefValue | null> {\n const slot = slots.get(ref);\n if (!slot) throw new Error(\"not a flow ref: create it with createFlowRef\");\n return slot;\n}\n\n/**\n * Creates a flow ref, anywhere (a module, a service, a test, a component's field).\n *\n * ```ts\n * readonly flow = createFlowRef<Types, typeof features>();\n * // <div flowRoot [flowRef]=\"flow\" [features]=\"features\" [defaultNodes]=\"nodes\">…</div>\n * fit() { this.flow.current?.engine.run(\"fit-view\"); }\n * ```\n */\nexport function createFlowRef<\n T extends FlowTypes = AnyTypes,\n F extends FlowFeatures = readonly [],\n>(): FlowRef<T, F> {\n const slot = signal<FlowRefValue | null>(null);\n const ref: FlowRef<T, F> = Object.freeze({\n get current() {\n return slot() as unknown as FlowRefValue<T, F> | null;\n },\n });\n slots.set(ref, slot);\n return ref;\n}\n\n/** @internal what `[flowRoot]` calls: attaches (or, with `null`, detaches) its model and engine */\nexport function setFlowRef(\n ref: FlowRef<FlowTypes, FlowFeatures>,\n value: FlowRefValue<FlowTypes, FlowFeatures> | null,\n): void {\n const slot = slotOf(ref);\n if ((untracked(slot) as unknown) === value) return;\n slot.set(value as unknown as FlowRefValue | null);\n}\n","// From packages/react/src/utils/engine-facade.ts (as packages/vue's and packages/svelte's): the same\n// facade, framework-free. The engine an app sees through `injectFlow()`, the root\n// (`#flow=\"flowRoot\"`) and a flow ref: always there, even before the root created its engine (the\n// first render), and the same object when the root replaces it (another model). It forwards every\n// verb to the root's current engine; with none, an action is refused and a read gives the empty\n// answer.\nimport type {\n CommandResult,\n FlowEngine,\n FlowEngineAdapter,\n FlowEngineEvent,\n Viewport,\n} from \"@fragiola/flow\";\n\n/** The facade, and how the root points it at its current engine. */\nexport interface EngineFacade {\n readonly engine: FlowEngine;\n /** the root's current engine (null: not mounted) */\n readonly current: FlowEngine | null;\n /** points the facade at `engine` (null: the root unmounted) */\n set(engine: FlowEngine | null): void;\n}\n\nconst NOT_MOUNTED: CommandResult<never> = Object.freeze({\n ok: false,\n error: Object.freeze({\n code: \"refused\",\n message: \"the flow is not mounted\",\n }),\n});\n\ntype Verb = (key: string, payload?: unknown) => unknown;\n\n/**\n * A facade whose reads before the mount answer `viewport` with `initial()` (Angular reads it when\n * asked: the root's inputs are set after the facade is made).\n */\nexport function createEngineFacade(initial: () => Viewport): EngineFacade {\n let current: FlowEngine | null = null;\n const listeners = new Set<(event: FlowEngineEvent) => void>();\n let unsubscribe: () => void = () => {};\n const empty: Readonly<Record<string, unknown>> = {\n get viewport() {\n return Object.freeze({ ...initial() });\n },\n \"root-size\": Object.freeze({ width: 0, height: 0 }),\n \"handles-by\": Object.freeze([]),\n \"dragging-node-ids\": Object.freeze([]),\n \"selection-box\": null,\n connection: null,\n };\n const forward =\n (verb: \"run\" | \"can\" | \"check\" | \"get\" | \"is\", fallback: Verb) =>\n (key: string, payload?: unknown) =>\n current\n ? (current[verb] as unknown as Verb)(key, payload)\n : fallback(key, payload);\n const engine = Object.freeze({\n run: forward(\"run\", () => NOT_MOUNTED),\n can: forward(\"can\", () => false),\n check: forward(\"check\", () => NOT_MOUNTED),\n get: forward(\"get\", (key) =>\n Object.hasOwn(empty, key) ? empty[key] : undefined,\n ),\n is: forward(\"is\", () => false),\n // listens across engines: a listener added before the mount hears the mounted engine\n subscribe(listener: (event: FlowEngineEvent) => void) {\n const wrapper = (event: FlowEngineEvent) => listener(event);\n listeners.add(wrapper);\n return () => {\n listeners.delete(wrapper);\n };\n },\n // the root owns its engine and destroys it when it unmounts\n destroy() {},\n get adapter(): FlowEngineAdapter {\n if (!current) throw new Error(\"the flow is not mounted\");\n return current.adapter;\n },\n }) as unknown as FlowEngine;\n return {\n engine,\n get current() {\n return current;\n },\n set(next) {\n if (next === current) return;\n unsubscribe();\n current = next;\n unsubscribe = next\n ? next.subscribe((event) => {\n for (const listener of [...listeners]) listener(event);\n })\n : () => {};\n },\n };\n}\n","import {\n ApplicationRef,\n afterNextRender,\n computed,\n Directive,\n ErrorHandler,\n effect,\n inject,\n input,\n type OnInit,\n type OutputEmitterRef,\n output,\n type Signal,\n signal,\n untracked,\n} from \"@angular/core\";\nimport {\n type AnyTypes,\n type AutoPanOptions,\n type CommandEvent,\n type CreateId,\n createFlowEngine,\n createFlowModel,\n type DefaultEdgeOptions,\n ENGINE_EVENT_CALLBACKS,\n type FitViewPayload,\n type FlowEdge,\n type FlowEdgeInput,\n type FlowEngine,\n type FlowEngineEvent,\n type FlowEngineEventOf,\n type FlowEngineOptions,\n type FlowFeatures,\n type FlowModel,\n type FlowNode,\n type FlowNodeInput,\n type FlowTypes,\n partAttributes,\n type RenderLayer,\n type StaticGeometry,\n staticGeometry,\n type Viewport,\n type ZIndexMode,\n} from \"@fragiola/flow\";\nimport {\n type AnyFlowEngine,\n type AnyFlowModel,\n eraseModel,\n FLOW_CONTEXT,\n type FlowContext,\n typedEngine,\n} from \"../context\";\nimport { type FlowRef, setFlowRef } from \"../inject/create-flow-ref\";\nimport { flowValue } from \"../inject/internal\";\nimport { createEngineFacade } from \"../utils/engine-facade\";\nimport { createFlowStore } from \"../utils/flow-store\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n onDestroy,\n optionalBoolean,\n optionalNumber,\n} from \"../utils/helpers\";\n\nexport interface RootState {\n /** the gestures and keys may change the flow (`set-interactive`, `data-interactive`) */\n interactive: boolean;\n /** the viewport is being panned (`data-panning`) */\n panning: boolean;\n /** nodes are being dragged (`drag()`, `data-dragging`) */\n dragging: boolean;\n /** a connection is being drawn (`connection()`, `data-connecting`) */\n connecting: boolean;\n /** a box selection is being drawn (`selection()`, `data-selecting`) */\n selecting: boolean;\n}\n\n/** The engine's options a root takes as inputs: each one that changes applies at once. */\nexport type RootEngineProps = Pick<\n FlowEngineOptions,\n | \"minZoom\"\n | \"maxZoom\"\n | \"translateExtent\"\n | \"panOnDrag\"\n | \"panOnScroll\"\n | \"zoomOnScroll\"\n | \"zoomOnPinch\"\n | \"zoomOnDoubleClick\"\n | \"zoomStep\"\n | \"interactive\"\n | \"onlyRenderVisible\"\n | \"pathOptions\"\n | \"autoPan\"\n | \"panActivationKey\"\n | \"panOnScrollMode\"\n | \"panOnScrollSpeed\"\n | \"zoomActivationKey\"\n | \"easing\"\n | \"nodeOrigin\"\n | \"nodeExtent\"\n | \"elevateNodesOnSelect\"\n | \"elevateEdgesOnSelect\"\n | \"zIndexMode\"\n | \"paneClickDistance\"\n | \"nodeClickDistance\"\n | \"preventScrolling\"\n | \"nodesFocusable\"\n | \"edgesFocusable\"\n>;\n\n/** A viewport change, as `(viewportMove)` tells it (React's `onViewportChange(viewport, gesture)`). */\nexport interface ViewportMoveEvent {\n readonly viewport: Viewport;\n /** a gesture moved it (a pan, the wheel, a pinch), not an action */\n readonly gesture: boolean;\n}\n\n/** `NodeClick` → `nodeClick`: an engine event's output, from the core's callback name. */\nfunction outputName(name: string): string {\n return name.charAt(0).toLowerCase() + name.slice(1);\n}\n\n/** The `meta` of the commands that bring the model to the controlled inputs. */\nconst CONTROLLED_META = Object.freeze({ source: \"controlled\" });\n\n/** The error of a model read before the root's inputs are set: Angular's NG0950, as an input's. */\nfunction notInitialized(): Error {\n return Object.assign(\n new Error(\n \"[flowRoot]: its model is read before its inputs are set (read it from ngOnInit on, or in a template, a computed or an effect)\",\n ),\n { code: -950 },\n );\n}\n\nconst DEFAULT_VIEWPORT: Viewport = Object.freeze({ x: 0, y: 0, zoom: 1 });\n\n/**\n * Two lists of render layers that draw the same (`render-layers` builds new ones as the flow\n * changes): their levels, `z-index` and edges, what the parts read of them. Not their nodes: no\n * part reads a level's `nodeIds` (a node's own `z-index` is `node-z-index-by`), and comparing them\n * walked every node of a large flow on each viewport step.\n */\nfunction sameLayers(\n a: readonly RenderLayer[],\n b: readonly RenderLayer[],\n): boolean {\n const sameIds = (x: readonly string[], y: readonly string[]) =>\n x.length === y.length && x.every((id, i) => id === y[i]);\n return (\n a === b ||\n (a.length === b.length &&\n a.every((layer, i) => {\n const other = b[i];\n return (\n other !== undefined &&\n layer.level === other.level &&\n layer.zIndex === other.zIndex &&\n sameIds(layer.edgeIds, other.edgeIds)\n );\n }))\n );\n}\n\n/** A list of features by their names, in order: an equal new list (`[features]=\"[drag()]\"`) is the same. */\nfunction featureNames(features: FlowFeatures | undefined): string {\n return (features ?? []).map((feature) => feature.name).join(\",\");\n}\n\n/**\n * Each engine option's value as a key: a new equal object (`pathOptions`) is the same, a function\n * (`easing`) is itself, and `null` (`[panActivationKey]=\"null\"`: none) is not `undefined` (the\n * default).\n */\nfunction optionKeys(options: RootEngineProps): Record<string, unknown> {\n return Object.fromEntries(\n Object.entries(options).map(([key, value]) => [\n key,\n typeof value === \"function\" || value === undefined\n ? value\n : JSON.stringify(value),\n ]),\n );\n}\n\n/** `panOnDrag`'s input: a bare attribute is `true`, mouse buttons (`[panOnDrag]=\"[1, 2]\"`) stay a list. */\nfunction panOnDragInput(\n value: boolean | readonly number[] | \"\" | null | undefined,\n): boolean | readonly number[] | undefined {\n return Array.isArray(value) ? value : optionalBoolean(value);\n}\n\n/** `autoPan`'s input: a bare attribute is `true`, its options (`{ speed, margin }`) stay an object. */\nfunction autoPanInput(\n value: boolean | AutoPanOptions | \"\" | null | undefined,\n): boolean | AutoPanOptions | undefined {\n return value !== null && typeof value === \"object\"\n ? value\n : optionalBoolean(value);\n}\n\n/** `fitView`'s input: a bare attribute is `true`, a payload stays one. */\nfunction fitViewInput(\n value: boolean | FitViewPayload | \"\" | null | undefined,\n): boolean | FitViewPayload | undefined {\n if (value === \"\") return true;\n return value ?? undefined;\n}\n\n/**\n * The flow (`data-flow-part=\"root\"`), on the element the flow renders in:\n * `<div flowRoot [features]=\"features\" [defaultNodes]=\"nodes\">`. It owns the model (unless given\n * one) and the engine, attaches the engine to its element (the engine listens to it: pointer,\n * wheel, keys, focus) and provides the flow to the parts inside. Give it a size (the flow fills\n * it). `#flow=\"flowRoot\"` gives the rest of the template its `model()`, its `engine` and its\n * `state()`.\n *\n * The engine is created once the root is rendered in a browser (`afterNextRender`), one per model\n * (another `model` destroys it and creates one at the last viewport), and destroyed with the root.\n */\n@Directive({\n selector: \"[flowRoot]\",\n exportAs: \"flowRoot\",\n providers: [\n {\n provide: FLOW_CONTEXT,\n useFactory: (): FlowContext => inject(FlowRootDirective).context,\n },\n ],\n})\nexport class FlowRootDirective<\n T extends FlowTypes = AnyTypes,\n F extends FlowFeatures = readonly [],\n> implements OnInit\n{\n /**\n * the flow model. Its middleware (`model.use`) sees every command the flow runs, and its\n * listeners (`model.subscribe`) every change. Give it, or let the root create one from\n * `nodes` / `defaultNodes` and `edges` / `defaultEdges`. Another model gets another engine\n */\n readonly modelInput = input<FlowModel<T, F> | undefined>(undefined, {\n alias: \"model\",\n });\n /** the nodes of the model the root creates (read once, when it creates it) */\n readonly defaultNodes = input<readonly FlowNodeInput<T>[] | undefined>(\n undefined,\n );\n /** the edges of the model the root creates (read once, when it creates it) */\n readonly defaultEdges = input<readonly FlowEdgeInput<T>[] | undefined>(\n undefined,\n );\n /**\n * controlled nodes (`[(nodes)]`): each new list brings the model to it with the commands a\n * user would run (`model.get(\"commands-to\")`, one `batch`); every change of the model's nodes\n * emits `nodesChange`. Give every node its id\n */\n readonly nodes = input<readonly FlowNode<T>[] | undefined>(undefined);\n /** controlled edges (`[(edges)]`), as `nodes` */\n readonly edges = input<readonly FlowEdge<T>[] | undefined>(undefined);\n /**\n * the opt-in features of the model the root creates (read once, when it creates it):\n * `[selection(), drag(), connection()]`, each from its entry (`@fragiola/flow-angular/drag`).\n * A `model` has its own\n */\n readonly features = input<F | undefined>(undefined);\n /** the id generator of the model the root creates (read once, when it creates it) */\n readonly createId = input<CreateId | undefined>(undefined);\n /**\n * the fields every `edge.add` of the model the root creates fills in where it leaves them out\n * (read once, when it creates it: the model option `defaultEdgeOptions`)\n */\n readonly defaultEdgeOptions = input<DefaultEdgeOptions<T> | undefined>(\n undefined,\n );\n /** controlled viewport (`[(viewport)]`): a new value is set on the engine (`set-viewport`) */\n readonly viewport = input<Viewport | undefined>(undefined);\n /** the viewport the flow starts at (read once); default `{ x: 0, y: 0, zoom: 1 }` */\n readonly defaultViewport = input<Viewport | undefined>(undefined);\n /**\n * fits the nodes once their sizes are known, again once measured (read once): a bare\n * `fitView`, or a payload\n */\n readonly fitView = input(undefined, { transform: fitViewInput });\n /** access to the model and the engine from outside the root (`createFlowRef`) */\n readonly flowRef = input<FlowRef<T, F> | undefined>(undefined);\n /** the engine's options (React's root props): each one that changes applies at once */\n readonly minZoom = input(undefined, { transform: optionalNumber });\n readonly maxZoom = input(undefined, { transform: optionalNumber });\n readonly translateExtent = input<\n FlowEngineOptions[\"translateExtent\"] | undefined\n >(undefined);\n readonly panOnDrag = input(undefined, { transform: panOnDragInput });\n readonly panOnScroll = input(undefined, { transform: optionalBoolean });\n readonly zoomOnScroll = input(undefined, { transform: optionalBoolean });\n readonly zoomOnPinch = input(undefined, { transform: optionalBoolean });\n readonly zoomOnDoubleClick = input(undefined, {\n transform: optionalBoolean,\n });\n readonly zoomStep = input(undefined, { transform: optionalNumber });\n readonly interactive = input(undefined, { transform: optionalBoolean });\n readonly onlyRenderVisible = input(undefined, {\n transform: optionalBoolean,\n });\n readonly pathOptions = input<FlowEngineOptions[\"pathOptions\"] | undefined>(\n undefined,\n );\n readonly autoPan = input(undefined, { transform: autoPanInput });\n readonly panActivationKey = input<\n FlowEngineOptions[\"panActivationKey\"] | undefined\n >(undefined);\n readonly panOnScrollMode = input<\n FlowEngineOptions[\"panOnScrollMode\"] | undefined\n >(undefined);\n readonly panOnScrollSpeed = input(undefined, {\n transform: optionalNumber,\n });\n readonly zoomActivationKey = input<\n FlowEngineOptions[\"zoomActivationKey\"] | undefined\n >(undefined);\n readonly easing = input<FlowEngineOptions[\"easing\"] | undefined>(undefined);\n readonly nodeOrigin = input<FlowEngineOptions[\"nodeOrigin\"] | undefined>(\n undefined,\n );\n readonly nodeExtent = input<FlowEngineOptions[\"nodeExtent\"] | undefined>(\n undefined,\n );\n readonly elevateNodesOnSelect = input(undefined, {\n transform: optionalBoolean,\n });\n readonly elevateEdgesOnSelect = input(undefined, {\n transform: optionalBoolean,\n });\n /** how nodes and edges stack (`\"basic\"`, `\"auto\"`: the default, `\"manual\"`) */\n readonly zIndexMode = input<ZIndexMode | undefined>(undefined);\n readonly paneClickDistance = input(undefined, {\n transform: optionalNumber,\n });\n readonly nodeClickDistance = input(undefined, {\n transform: optionalNumber,\n });\n readonly preventScrolling = input(undefined, {\n transform: optionalBoolean,\n });\n readonly nodesFocusable = input(undefined, { transform: optionalBoolean });\n readonly edgesFocusable = input(undefined, { transform: optionalBoolean });\n\n /** the model's nodes after every command that changes them (a drag step too), but the controlled ones' */\n readonly nodesChange = output<readonly FlowNode<T>[]>();\n /** the model's edges after every command that changes them, but the controlled ones' */\n readonly edgesChange = output<readonly FlowEdge<T>[]>();\n /** the viewport after every change, by a gesture or an action (`[(viewport)]`) */\n readonly viewportChange = output<Viewport>();\n /** every viewport change with what made it (`gesture: true` for a pan, the wheel, a pinch) */\n readonly viewportMove = output<ViewportMoveEvent>();\n\n // One output per engine event, named from the core's table (`ENGINE_EVENT_CALLBACKS`: React's\n // `onNodeClick` is `(nodeClick)`), each emitted with the event. Angular needs them declared;\n // `tests/interaction.test.ts` keeps this list equal to the table.\n // (the viewport events' types written out: inferred, they would name the core's unexported\n // `ViewportMove` in the bundled declarations)\n readonly moveStart: OutputEmitterRef<\n FlowEngineEventOf<\"viewport-change-start\">\n > = output();\n readonly moveEnd: OutputEmitterRef<\n FlowEngineEventOf<\"viewport-change-end\">\n > = output();\n readonly init = output<FlowEngineEventOf<\"ready\">>();\n readonly nodeClick = output<FlowEngineEventOf<\"node-click\">>();\n readonly nodeDoubleClick = output<FlowEngineEventOf<\"node-double-click\">>();\n readonly nodeContextMenu = output<FlowEngineEventOf<\"node-context-menu\">>();\n readonly edgeClick = output<FlowEngineEventOf<\"edge-click\">>();\n readonly edgeDoubleClick = output<FlowEngineEventOf<\"edge-double-click\">>();\n readonly edgeContextMenu = output<FlowEngineEventOf<\"edge-context-menu\">>();\n readonly paneClick = output<FlowEngineEventOf<\"pane-click\">>();\n readonly paneDoubleClick = output<FlowEngineEventOf<\"pane-double-click\">>();\n readonly paneContextMenu = output<FlowEngineEventOf<\"pane-context-menu\">>();\n readonly selectionContextMenu =\n output<FlowEngineEventOf<\"selection-context-menu\">>();\n readonly selectionStart = output<FlowEngineEventOf<\"box-select-start\">>();\n readonly selectionEnd = output<FlowEngineEventOf<\"box-select\">>();\n readonly nodeDragStart = output<FlowEngineEventOf<\"drag-start\">>();\n readonly nodesMove = output<FlowEngineEventOf<\"nodes-move\">>();\n readonly nodeDragCancel = output<FlowEngineEventOf<\"drag-cancel\">>();\n readonly selectionDragStart =\n output<FlowEngineEventOf<\"selection-drag-start\">>();\n readonly selectionDrag = output<FlowEngineEventOf<\"selection-drag\">>();\n readonly selectionDragStop =\n output<FlowEngineEventOf<\"selection-drag-end\">>();\n readonly connectStart = output<FlowEngineEventOf<\"connect-start\">>();\n readonly connectTarget = output<FlowEngineEventOf<\"connect-target\">>();\n readonly connect = output<FlowEngineEventOf<\"connect\">>();\n readonly connectCancel = output<FlowEngineEventOf<\"connect-cancel\">>();\n readonly reconnectStart = output<FlowEngineEventOf<\"reconnect-start\">>();\n readonly reconnect = output<FlowEngineEventOf<\"reconnect\">>();\n readonly reconnectCancel = output<FlowEngineEventOf<\"reconnect-cancel\">>();\n readonly resizeStart = output<FlowEngineEventOf<\"resize-start\">>();\n readonly resizeEnd = output<FlowEngineEventOf<\"resize\">>();\n readonly resizeCancel = output<FlowEngineEventOf<\"resize-cancel\">>();\n readonly delete = output<FlowEngineEventOf<\"remove\">>();\n\n /** each engine event's output, by the event's type */\n private readonly eventOutputs: ReadonlyMap<\n string,\n OutputEmitterRef<FlowEngineEvent>\n > = new Map(\n Object.entries(ENGINE_EVENT_CALLBACKS).map(([type, name]) => [\n type,\n (\n this as unknown as Record<\n string,\n OutputEmitterRef<FlowEngineEvent>\n >\n )[outputName(name)] as OutputEmitterRef<FlowEngineEvent>,\n ]),\n );\n\n private readonly host = injectHost();\n /** its inputs are set (`ngOnInit`) */\n private readonly initialized = signal(false);\n /** the model the root created, once it needs one */\n private own: FlowModel<T, F> | undefined;\n /** the names of the features the root's own model was created with */\n private createdWith: string | undefined;\n\n /** the root's model: its `model` input, or the one it created from its inputs */\n readonly model: Signal<FlowModel<T, F>> = computed(() => {\n // before its inputs are set (a child's constructor, a binding read early), the model is\n // not known yet: Angular's error for an input read too early (NG0950, which the parts'\n // early reads expect), rather than a model made from inputs not given yet\n if (!this.initialized()) throw notInitialized();\n const given = this.modelInput();\n if (given) return given;\n this.own ??= untracked(() => {\n const features = this.features();\n this.createdWith = featureNames(features);\n return createFlowModel<T, F>(\n {\n version: 1,\n nodes: [...(this.nodes() ?? this.defaultNodes() ?? [])],\n edges: [...(this.edges() ?? this.defaultEdges() ?? [])],\n } as never,\n {\n features,\n createId: this.createId(),\n defaultEdgeOptions: this.defaultEdgeOptions(),\n },\n );\n });\n return this.own;\n });\n private readonly erased = computed(() => eraseModel(this.model()));\n\n /** the viewport a new engine starts at: the last one's (another model), else the inputs' */\n private start: Viewport | undefined;\n private readonly facade = createEngineFacade(\n () =>\n this.start ??\n this.viewport() ??\n this.defaultViewport() ??\n DEFAULT_VIEWPORT,\n );\n /**\n * the engine of the flow on screen, as apps see it: screen actions (`engine.run(\"fit-view\")`),\n * screen facts (`engine.get(\"viewport\")`) and its events (`engine.subscribe`). It is there\n * from the start; before the root created its engine an action is refused and a read is empty\n */\n readonly engine: FlowEngine<T, F> = typedEngine<T, F>(this.facade.engine);\n\n private readonly current = signal<AnyFlowEngine | null>(null);\n /**\n * the root's one store (React's `flow-store`): its counters are bumped once per commit of the\n * model and engine notification, each told to the readers it may concern; its listeners are\n * the root's effects, gone with it\n */\n private readonly store = createFlowStore();\n private readonly revision = this.store.view;\n /** a commit of the model: told to the readers, then rendered before the next task */\n private readonly committed = (model: AnyFlowModel) => {\n this.store.commit(model);\n this.renderSoon();\n };\n private readonly application = inject(ApplicationRef);\n private readonly errorHandler = inject(ErrorHandler);\n private renderQueued = false;\n\n /**\n * Renders a change of the flow before the next task (a microtask), as Vue and Svelte flush\n * theirs: zoneless Angular would render it in a later task (a timeout or a frame), so a key\n * press or a click that moved a node or reached a zoom limit would still show the old view to\n * whatever reads the page right after it (an assistive technology, a test). One render per\n * root and task, however many commits and view changes it had; none once the application is\n * destroyed. An error of that render goes to the app's `ErrorHandler`, as one of Angular's\n * own scheduled renders does (thrown from a microtask, it would reach no handler).\n */\n private renderSoon(): void {\n if (this.renderQueued) return;\n this.renderQueued = true;\n queueMicrotask(() => {\n this.renderQueued = false;\n if (this.application.destroyed) return;\n try {\n this.application.tick();\n } catch (error) {\n this.errorHandler.handleError(error);\n }\n });\n }\n\n /** the static geometry last computed, and what it was computed from */\n private staticFrom:\n | {\n nodes: unknown;\n edges: unknown;\n options: string;\n geometry: StaticGeometry;\n }\n | undefined;\n\n /**\n * The flow's geometry from its document while there is no engine (the first render): one\n * object per document and options (every part reads the same), `null` once the engine exists.\n */\n private readonly geometry = computed((): StaticGeometry | null => {\n if (this.current()) return null;\n this.store.entity();\n const model = this.erased();\n const props = this.engineProps();\n const options = {\n nodeOrigin: props.nodeOrigin,\n pathOptions: props.pathOptions,\n zIndexMode: props.zIndexMode,\n elevateNodesOnSelect: props.elevateNodesOnSelect,\n elevateEdgesOnSelect: props.elevateEdgesOnSelect,\n };\n return untracked(() => {\n const nodes = model.get(\"all-nodes\");\n const edges = model.get(\"all-edges\");\n const key = JSON.stringify(options);\n const last = this.staticFrom;\n if (\n last?.nodes === nodes &&\n last.edges === edges &&\n last.options === key\n ) {\n return last.geometry;\n }\n const geometry = staticGeometry({ nodes, edges }, options);\n this.staticFrom = { nodes, edges, options: key, geometry };\n return geometry;\n });\n });\n\n /** the levels the flow is drawn in: the engine's, else the static geometry's */\n private readonly layers = computed(\n (): readonly RenderLayer[] => {\n this.revision();\n const live = this.current();\n return live\n ? live.get(\"render-layers\")\n : (this.geometry()?.layers ?? []);\n },\n { equal: sameLayers },\n );\n\n /** @internal what the parts inject */\n readonly context: FlowContext = {\n model: this.erased,\n engine: this.current.asReadonly(),\n publicEngine: this.facade.engine as unknown as AnyFlowEngine,\n rootElement: this.host,\n revision: this.revision,\n store: this.store,\n culled: computed(() => this.onlyRenderVisible() === true),\n geometry: this.geometry,\n layers: this.layers,\n };\n\n private readonly attributes = flowValue(this.context, () => {\n const live = this.current();\n return live ? live.adapter.attributes(\"root\") : partAttributes(\"root\");\n });\n\n /** what the root shows as `data-*` (`#flow=\"flowRoot\"`, then `flow.state().connecting`) */\n readonly state: Signal<RootState> = computed(() => {\n const attributes = this.attributes();\n return {\n interactive: this.current()\n ? attributes[\"data-interactive\"] !== undefined\n : true,\n panning: attributes[\"data-panning\"] !== undefined,\n dragging: attributes[\"data-dragging\"] !== undefined,\n connecting: attributes[\"data-connecting\"] !== undefined,\n selecting: attributes[\"data-selecting\"] !== undefined,\n };\n });\n\n /** the engine's options as the inputs give them */\n private readonly engineProps = computed(\n (): RootEngineProps => ({\n minZoom: this.minZoom(),\n maxZoom: this.maxZoom(),\n translateExtent: this.translateExtent(),\n panOnDrag: this.panOnDrag(),\n panOnScroll: this.panOnScroll(),\n zoomOnScroll: this.zoomOnScroll(),\n zoomOnPinch: this.zoomOnPinch(),\n zoomOnDoubleClick: this.zoomOnDoubleClick(),\n zoomStep: this.zoomStep(),\n interactive: this.interactive(),\n onlyRenderVisible: this.onlyRenderVisible(),\n pathOptions: this.pathOptions(),\n autoPan: this.autoPan(),\n panActivationKey: this.panActivationKey(),\n panOnScrollMode: this.panOnScrollMode(),\n panOnScrollSpeed: this.panOnScrollSpeed(),\n zoomActivationKey: this.zoomActivationKey(),\n easing: this.easing(),\n nodeOrigin: this.nodeOrigin(),\n nodeExtent: this.nodeExtent(),\n elevateNodesOnSelect: this.elevateNodesOnSelect(),\n elevateEdgesOnSelect: this.elevateEdgesOnSelect(),\n zIndexMode: this.zIndexMode(),\n paneClickDistance: this.paneClickDistance(),\n nodeClickDistance: this.nodeClickDistance(),\n preventScrolling: this.preventScrolling(),\n nodesFocusable: this.nodesFocusable(),\n edgesFocusable: this.edgesFocusable(),\n }),\n );\n\n /** the controlled lists the model was last brought to (a model the root created starts at them) */\n private sent: { model: unknown; nodes: unknown; edges: unknown } = {\n model: undefined,\n nodes: undefined,\n edges: undefined,\n };\n\n constructor() {\n bindStructuralStyle(this.host, () => ({\n position: \"relative\",\n overflow: \"hidden\",\n }));\n bindAttributes(this.host, this.attributes);\n\n // misuse the root ignores, once each\n const warned = new Set<string>();\n const warn = (message: string) => {\n if (warned.has(message)) return;\n warned.add(message);\n console.warn(`[@fragiola/flow-angular] ${message}`);\n };\n // the features are the model's, fixed when it is created: a later change is ignored\n effect(() => {\n const names = featureNames(this.features());\n this.model();\n untracked(() => {\n if (\n !this.modelInput() &&\n this.createdWith !== undefined &&\n names !== this.createdWith\n ) {\n warn(\n \"the features input changed after the root created its model: the change is ignored (the features are fixed when the model is created)\",\n );\n }\n });\n });\n\n // the model's commits: every part reads them through `revision`; the app hears them\n // through the outputs, but the controlled inputs' own commands\n effect((onCleanup) => {\n const model = this.erased();\n onCleanup(\n model.subscribe((event: CommandEvent) => {\n this.committed(model);\n if (event.meta?.source === CONTROLLED_META.source) return;\n if (event.before.nodes !== event.after.nodes) {\n this.nodesChange.emit(\n event.after.nodes as readonly FlowNode<T>[],\n );\n }\n if (event.before.edges !== event.after.edges) {\n this.edgesChange.emit(\n event.after.edges as readonly FlowEdge<T>[],\n );\n }\n }),\n );\n // a commit between the first read and the subscription is read again\n untracked(() => this.committed(model));\n });\n\n // the controlled lists, on every new list (a model the app gives starts at them)\n effect(() => {\n const model = this.erased();\n const nodes = this.nodes();\n const edges = this.edges();\n untracked(() => this.syncControlled(model, nodes, edges, warn));\n });\n\n // the engine options last sent, by key: a change sends only the keys that changed (an\n // `interactive` that stays must not undo the lock of `[flowToggleInteractive]`)\n let sentOptions: Record<string, unknown> = {};\n // the engine, once rendered in a browser (a server render never attaches nor observes\n // anything), one per model\n const rendered = signal(false);\n afterNextRender(() => rendered.set(true));\n effect((onCleanup) => {\n if (!rendered()) return;\n const model = this.erased();\n untracked(() => {\n const options = this.engineProps();\n const created = createFlowEngine(model, {\n ...options,\n defaultViewport: {\n ...(this.start ??\n this.viewport() ??\n this.defaultViewport() ??\n DEFAULT_VIEWPORT),\n },\n fitView: this.fitView(),\n }) as unknown as AnyFlowEngine;\n sentOptions = optionKeys(options);\n const stops = [\n this.store.attach(created, () => this.renderSoon()),\n created.subscribe((event) => {\n if (event.type !== \"viewport-change\") {\n // the event's output (`nodeClick`, `moveStart`, …)\n this.eventOutputs.get(event.type)?.emit(event);\n return;\n }\n this.start = event.viewport;\n this.viewportChange.emit(event.viewport);\n this.viewportMove.emit({\n viewport: event.viewport,\n gesture: event.gesture,\n });\n }),\n ];\n this.facade.set(created as unknown as FlowEngine);\n created.adapter.attachRoot(this.host);\n this.current.set(created);\n onCleanup(() => {\n for (const stop of stops) stop();\n this.start = created.get(\"viewport\");\n this.current.set(null);\n this.facade.set(null);\n created.adapter.detachRoot();\n created.destroy();\n });\n });\n });\n\n // the engine options that changed since they were sent\n effect(() => {\n const live = this.current();\n const options = this.engineProps();\n if (!live) return;\n untracked(() => {\n const next = optionKeys(options);\n const changed = Object.keys(next).filter(\n (key) => next[key] !== sentOptions[key],\n );\n sentOptions = next;\n if (changed.length === 0) return;\n const values = options as Record<string, unknown>;\n live.adapter.setOptions(\n Object.fromEntries(\n changed.map((key) => [key, values[key]]),\n ),\n );\n });\n });\n\n // a controlled viewport that differs from the engine's is set on it\n effect(() => {\n const live = this.current();\n const viewport = this.viewport();\n if (!live || !viewport) return;\n const { x, y, zoom } = viewport;\n untracked(() => {\n const current = live.get(\"viewport\");\n if (\n current.x !== x ||\n current.y !== y ||\n current.zoom !== zoom\n ) {\n live.run(\"set-viewport\", { x, y, zoom });\n }\n });\n });\n\n // the flow ref: the model and the facade (the same object across engines)\n effect((onCleanup) => {\n const ref = this.flowRef() as unknown as\n | FlowRef<FlowTypes, FlowFeatures>\n | undefined;\n const model = this.model();\n if (!ref) return;\n untracked(() =>\n setFlowRef(ref, {\n model: model as unknown as FlowModel<\n FlowTypes,\n FlowFeatures\n >,\n engine: this.facade.engine as unknown as FlowEngine<\n FlowTypes,\n FlowFeatures\n >,\n }),\n );\n onCleanup(() => setFlowRef(ref, null));\n });\n\n onDestroy(() => this.facade.set(null));\n }\n\n ngOnInit(): void {\n this.initialized.set(true);\n }\n\n /**\n * Brings the model to the controlled lists that changed (packages/react's algorithm): one\n * `batch` with `meta: { source: \"controlled\" }`, step by step after a veto, and the model's\n * lists emitted when they differ from the inputs (a veto, a rule that kept a node in its\n * parent, a middleware that rewrote a payload): the app's state follows the model.\n */\n private syncControlled(\n model: AnyFlowModel,\n nodes: readonly FlowNode<T>[] | undefined,\n edges: readonly FlowEdge<T>[] | undefined,\n warn: (message: string) => void,\n ): void {\n const previous = this.sent;\n const sameModel = previous.model === model;\n // a model the root created starts at the lists it was created from\n const created =\n !sameModel && this.own !== undefined && !this.modelInput();\n // only a list that changed is diffed (an edge list that stays is not walked on each step),\n // and the model's own list given back (`[(nodes)]` after a drag step) needs nothing\n const target = {\n nodes: (created ||\n (sameModel && previous.nodes === nodes) ||\n nodes === model.get(\"all-nodes\")\n ? undefined\n : nodes) as readonly FlowNode[] | undefined,\n edges: (created ||\n (sameModel && previous.edges === edges) ||\n edges === model.get(\"all-edges\")\n ? undefined\n : edges) as readonly FlowEdge[] | undefined,\n };\n this.sent = { model, nodes, edges };\n if (target.nodes === undefined && target.edges === undefined) return;\n const commands = model.get(\"commands-to\", target);\n if (commands.length === 0) return;\n const options = { meta: CONTROLLED_META };\n if (!model.run(\"batch\", { commands: [...commands] }, options).ok) {\n // refused as a whole (a middleware's veto): each change that may be made is, and the\n // app hears what the model holds instead\n const refused: string[] = [];\n for (const entry of commands) {\n const result = model.run(\n \"batch\",\n { commands: [entry] },\n options,\n );\n if (!result.ok) {\n refused.push(`${entry.command}: ${result.error.message}`);\n }\n }\n warn(\n `the controlled nodes / edges were not all applied (the model's are reported back):\\n${refused.join(\"\\n\")}`,\n );\n }\n if (\n target.nodes !== undefined &&\n model.get(\"commands-to\", { nodes: target.nodes }).length > 0\n ) {\n const held = model.get(\"all-nodes\") as readonly FlowNode<T>[];\n this.sent = { ...this.sent, nodes: held };\n this.nodesChange.emit(held);\n }\n if (\n target.edges !== undefined &&\n model.get(\"commands-to\", { edges: target.edges }).length > 0\n ) {\n const held = model.get(\"all-edges\") as readonly FlowEdge<T>[];\n this.sent = { ...this.sent, edges: held };\n this.edgesChange.emit(held);\n }\n }\n}\n","import { computed, Directive, type Signal } from \"@angular/core\";\nimport type { Rect } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"../inject/internal\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n px,\n} from \"../utils/helpers\";\nimport { bindPresence } from \"../utils/presence\";\n\nexport interface SelectionBoxState {\n /** the box, in pixels relative to the root */\n readonly box: Rect;\n}\n\n/**\n * The box selection being drawn (`data-flow-part=\"selection-box\"`, `selection()`), on the app's\n * element: `<div flowSelectionBox>`, absolutely positioned in `[flowRoot]` (outside\n * `[flowViewport]`: it is in screen pixels). It is in the document only while a box is drawn.\n * Give it its look.\n */\n@Directive({ selector: \"[flowSelectionBox]\", exportAs: \"flowSelectionBox\" })\nexport class FlowSelectionBoxDirective {\n private readonly context = injectFlowContext(\"[flowSelectionBox]\");\n private readonly box = flowValue(\n this.context,\n () => this.context.engine()?.get(\"selection-box\") ?? null,\n );\n private readonly attributes = flowValue(\n this.context,\n () => this.context.engine()?.adapter.attributes(\"selection-box\") ?? {},\n );\n\n /** the box's state (`null` while no box is drawn) */\n readonly state: Signal<SelectionBoxState | null> = computed(() => {\n const box = this.box();\n return box ? { box } : null;\n });\n\n constructor() {\n const host = injectHost();\n bindAttributes(host, () => ({\n ...this.attributes(),\n \"data-flow-part\": \"selection-box\",\n }));\n bindStructuralStyle(host, () => {\n const box = this.box();\n return {\n position: \"absolute\",\n left: px(box?.x),\n top: px(box?.y),\n width: px(box?.width),\n height: px(box?.height),\n pointerEvents: \"none\",\n };\n });\n bindPresence(host, () => (this.box() ? \"here\" : null));\n }\n}\n","import { computed, Directive, type Signal } from \"@angular/core\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"../inject/internal\";\nimport {\n bindAttributes,\n bindBaseAttributes,\n injectHost,\n} from \"../utils/helpers\";\n\n/** The switches the lock turns off and on (React Flow's: dragging, connecting, selecting). */\nconst LOCKED_KINDS = [\"drag\", \"connect\", \"select\"] as const;\n\nexport interface ToggleInteractiveState {\n /**\n * the flow is not locked: it is interactive and one of dragging, connecting and selecting at\n * least is on (`interactive-by`)\n */\n readonly interactive: boolean;\n}\n\n/**\n * A toggle button (`data-flow-part=\"toggle-interactive\"`, `aria-pressed` while the flow is locked,\n * `data-interactive`), on the app's `<button flowToggleInteractive>`: locks and unlocks the flow,\n * React Flow's interactive button: locking turns dragging, connecting and selecting off\n * (`set-interactive { drag, connect, select }`), unlocking turns them and `interactive` on; pan\n * and zoom stay. It holds only what the app writes; `type=\"button\"` unless the app sets one.\n */\n@Directive({\n selector: \"[flowToggleInteractive]\",\n exportAs: \"flowToggleInteractive\",\n host: { \"(click)\": \"toggle()\" },\n})\nexport class FlowToggleInteractiveDirective {\n private readonly context = injectFlowContext(\"[flowToggleInteractive]\");\n private readonly interactive = flowValue(this.context, () => {\n const engine = this.context.engine();\n return engine\n ? LOCKED_KINDS.some((kind) => engine.is(\"interactive-by\", { kind }))\n : true;\n });\n\n /** the toggle's state (`#t=\"flowToggleInteractive\"`, then `t.state().interactive`) */\n readonly state: Signal<ToggleInteractiveState> = computed(() => ({\n interactive: this.interactive(),\n }));\n\n constructor() {\n bindAttributes(injectHost(), () => {\n const interactive = this.interactive();\n return {\n \"data-flow-part\": \"toggle-interactive\",\n \"data-interactive\": interactive ? \"\" : undefined,\n \"aria-pressed\": String(!interactive),\n disabled: this.context.engine() ? undefined : \"\",\n };\n });\n bindBaseAttributes(injectHost(), () => ({ type: \"button\" }));\n }\n\n /** @internal locks or unlocks the flow, before the app's `(click)` */\n protected toggle(): void {\n this.context.engine()?.run(\n \"set-interactive\",\n this.interactive()\n ? { drag: false, connect: false, select: false }\n : {\n interactive: true,\n drag: true,\n connect: true,\n select: true,\n },\n );\n }\n}\n","import type { Signal } from \"@angular/core\";\nimport type { Viewport } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"./internal\";\n\n/**\n * The viewport of the enclosing `[flowRoot]` (`{ x, y, zoom }`), as a signal that changes with it:\n * a zoom level readout, a control's state. Change it with `engine.run(\"set-viewport\")`. Call it in\n * an injection context (a constructor or a field initializer).\n */\nexport function injectViewport(): Signal<Viewport> {\n const context = injectFlowContext(\"injectViewport\");\n return flowValue(context, () => context.publicEngine.get(\"viewport\"));\n}\n","import { computed, Directive, effect, type Signal } from \"@angular/core\";\nimport { partAttributes, type Viewport } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { injectViewport } from \"../inject/inject-viewport\";\nimport {\n bindAttributes,\n bindStructuralStyle,\n injectHost,\n} from \"../utils/helpers\";\n\nexport interface ViewportState {\n /** the viewport: the pan (`x`, `y`, pixels) and the zoom */\n viewport: Viewport;\n}\n\nconst ATTRIBUTES = partAttributes(\"viewport\");\n\n/**\n * The pannable, zoomable layer (`data-flow-part=\"viewport\"`), on the app's element inside\n * `[flowRoot]`: `<div flowViewport>`. What is inside is in flow coordinates (`[flowEdges]`,\n * `[flowNodes]`, `[flowConnectionLine]`). The engine writes its `transform` itself (D4), never\n * Angular: a pan or a zoom renders nothing inside it again.\n */\n@Directive({ selector: \"[flowViewport]\", exportAs: \"flowViewport\" })\nexport class FlowViewportDirective {\n private readonly context = injectFlowContext(\"[flowViewport]\");\n private readonly viewport = injectViewport();\n\n /** what it shows (`#v=\"flowViewport\"`, then `v.state().viewport.zoom`) */\n readonly state: Signal<ViewportState> = computed(() => ({\n viewport: this.viewport(),\n }));\n\n constructor() {\n const host = injectHost();\n bindAttributes(host, () => ATTRIBUTES);\n bindStructuralStyle(host, () => ({\n position: \"absolute\",\n top: 0,\n left: 0,\n width: \"100%\",\n height: \"100%\",\n // a stacking context of its own before the engine writes its transform (the\n // server's HTML): with several render levels the nodes and edge layers have\n // negative z-indexes\n isolation: \"isolate\",\n }));\n // the engine writes its transform on it\n effect((onCleanup) => {\n const engine = this.context.engine();\n if (!engine) return;\n engine.adapter.attachViewport(host);\n onCleanup(() => engine.adapter.attachViewport(null));\n });\n }\n}\n","import { Directive, input, type Signal } from \"@angular/core\";\nimport {\n type ControlButtonState,\n controlButton,\n givenPayload,\n} from \"../inject/control-button\";\nimport { optionalBoolean, optionalNumber } from \"../utils/helpers\";\n\n/**\n * A button (`data-flow-part=\"zoom-in\"`), on the app's `<button flowZoomIn>`: zooms in by a step\n * around the root's centre (`zoom-in`), disabled at the greatest zoom. It holds only what the app\n * writes (an icon, a label); `type=\"button\"` unless the app sets one.\n */\n@Directive({\n selector: \"[flowZoomIn]\",\n exportAs: \"flowZoomIn\",\n host: { \"(click)\": \"click()\" },\n})\nexport class FlowZoomInDirective {\n /** disabled whatever the engine says */\n readonly disabled = input(undefined, { transform: optionalBoolean });\n /** how long its viewport change animates, in milliseconds (the root's `easing`); default 0: at once */\n readonly duration = input(undefined, { transform: optionalNumber });\n\n private readonly button = controlButton(\n \"zoom-in\",\n \"zoom-in\",\n this.disabled,\n () => givenPayload({ duration: this.duration() }),\n );\n\n /** the button's state (`#b=\"flowZoomIn\"`, then `b.state().disabled`) */\n readonly state: Signal<ControlButtonState> = this.button.state;\n\n /** @internal its action, before the app's `(click)` */\n protected click(): void {\n if (!this.state().disabled) this.button.click();\n }\n}\n","import { Directive, input, type Signal } from \"@angular/core\";\nimport {\n type ControlButtonState,\n controlButton,\n givenPayload,\n} from \"../inject/control-button\";\nimport { optionalBoolean, optionalNumber } from \"../utils/helpers\";\n\n/**\n * A button (`data-flow-part=\"zoom-out\"`), on the app's `<button flowZoomOut>`: zooms out by a step\n * around the root's centre (`zoom-out`), disabled at the least zoom. It holds only what the app\n * writes (an icon, a label); `type=\"button\"` unless the app sets one.\n */\n@Directive({\n selector: \"[flowZoomOut]\",\n exportAs: \"flowZoomOut\",\n host: { \"(click)\": \"click()\" },\n})\nexport class FlowZoomOutDirective {\n /** disabled whatever the engine says */\n readonly disabled = input(undefined, { transform: optionalBoolean });\n /** how long its viewport change animates, in milliseconds (the root's `easing`); default 0: at once */\n readonly duration = input(undefined, { transform: optionalNumber });\n\n private readonly button = controlButton(\n \"zoom-out\",\n \"zoom-out\",\n this.disabled,\n () => givenPayload({ duration: this.duration() }),\n );\n\n /** the button's state (`#b=\"flowZoomOut\"`, then `b.state().disabled`) */\n readonly state: Signal<ControlButtonState> = this.button.state;\n\n /** @internal its action, before the app's `(click)` */\n protected click(): void {\n if (!this.state().disabled) this.button.click();\n }\n}\n","import { FlowBackgroundDirective } from \"./directives/background.directive\";\nimport { FlowConnectionLineDirective } from \"./directives/connection-line.directive\";\nimport { FlowControlsDirective } from \"./directives/controls.directive\";\nimport { FlowEdgeDirective } from \"./directives/edge.directive\";\nimport { FlowEdgeLabelDirective } from \"./directives/edge-label.directive\";\nimport { FlowEdgePathDirective } from \"./directives/edge-path.directive\";\nimport { FlowEdgeToolbarDirective } from \"./directives/edge-toolbar.directive\";\nimport {\n FlowEdgesDirective,\n FlowEdgesItemDirective,\n} from \"./directives/edges.directive\";\nimport { FlowFitViewDirective } from \"./directives/fit-view.directive\";\nimport { FlowHandleDirective } from \"./directives/handle.directive\";\nimport { FlowNodeDirective } from \"./directives/node.directive\";\nimport { FlowNodeToolbarDirective } from \"./directives/node-toolbar.directive\";\nimport {\n FlowNodesDirective,\n FlowNodesItemDirective,\n} from \"./directives/nodes.directive\";\nimport { FlowNodesSelectionDirective } from \"./directives/nodes-selection.directive\";\nimport { FlowReconnectAnchorDirective } from \"./directives/reconnect-anchor.directive\";\nimport { FlowRootDirective } from \"./directives/root.directive\";\nimport { FlowSelectionBoxDirective } from \"./directives/selection-box.directive\";\nimport { FlowToggleInteractiveDirective } from \"./directives/toggle-interactive.directive\";\nimport { FlowViewportDirective } from \"./directives/viewport.directive\";\nimport { FlowZoomInDirective } from \"./directives/zoom-in.directive\";\nimport { FlowZoomOutDirective } from \"./directives/zoom-out.directive\";\n\n/**\n * Every Flow directive of the main entry, for a standalone component's `imports`:\n * `@Component({ imports: [FLOW], … })` (React's `Flow` namespace). The features' directives are\n * on their entries (`FLOW_MINIMAP` on `@fragiola/flow-angular/minimap`, `FLOW_RESIZE` on\n * `/resize`).\n */\nexport const FLOW = [\n FlowRootDirective,\n FlowViewportDirective,\n FlowNodesDirective,\n FlowNodesItemDirective,\n FlowNodeDirective,\n FlowHandleDirective,\n FlowEdgesDirective,\n FlowEdgesItemDirective,\n FlowEdgeDirective,\n FlowEdgePathDirective,\n FlowEdgeLabelDirective,\n FlowReconnectAnchorDirective,\n FlowConnectionLineDirective,\n FlowNodesSelectionDirective,\n FlowSelectionBoxDirective,\n FlowBackgroundDirective,\n FlowControlsDirective,\n FlowZoomInDirective,\n FlowZoomOutDirective,\n FlowFitViewDirective,\n FlowToggleInteractiveDirective,\n FlowNodeToolbarDirective,\n FlowEdgeToolbarDirective,\n] as const;\n","import type { Signal } from \"@angular/core\";\nimport type { AnyTypes, FlowEdge, FlowTypes } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"./internal\";\n\n/**\n * Every edge of the enclosing `[flowRoot]`, in drawing order, as a signal that changes on every\n * change of one. Call it in an injection context.\n */\nexport function injectEdges<T extends FlowTypes = AnyTypes>(): Signal<\n readonly FlowEdge<T>[]\n> {\n const context = injectFlowContext(\"injectEdges\");\n return flowValue(\n context,\n () => context.model().get(\"all-edges\") as readonly FlowEdge<T>[],\n Object.is,\n );\n}\n","import { computed, type Signal } from \"@angular/core\";\nimport type {\n AnyTypes,\n FlowEngine,\n FlowFeatures,\n FlowModel,\n FlowTypes,\n} from \"@fragiola/flow\";\nimport { injectFlowContext, typedEngine, typedModel } from \"../context\";\n\nexport interface InjectFlowResult<\n T extends FlowTypes = AnyTypes,\n F extends FlowFeatures = readonly [],\n> {\n /**\n * the model of the enclosing `[flowRoot]`: the flow's document and its rules. Change it with\n * `model().run(\"node.move\", { nodeId, position })`, read it with `model().get` / `model().is`\n */\n readonly model: Signal<FlowModel<T, F>>;\n /**\n * the engine of the flow on screen: screen actions (`engine.run(\"fit-view\")`), screen facts\n * (`engine.get(\"viewport\")`) and its events (`engine.subscribe`). It is there from the start;\n * before the root created its engine an action is refused and a read is empty\n */\n readonly engine: FlowEngine<T, F>;\n}\n\n/**\n * The model and the engine of the enclosing `[flowRoot]` (React's `useFlow`). Pass the registry\n * and the features as the type arguments (`injectFlow<Types, typeof features>()`): a child cannot\n * infer them through injection. Call it in an injection context (a constructor or a field).\n */\nexport function injectFlow<\n T extends FlowTypes = AnyTypes,\n F extends FlowFeatures = readonly [],\n>(): InjectFlowResult<T, F> {\n const context = injectFlowContext(\"injectFlow\");\n return {\n model: computed(() => typedModel<T, F>(context.model())),\n engine: typedEngine<T, F>(context.publicEngine),\n };\n}\n","import type { AnyTypes, FlowFeatures, FlowTypes } from \"@fragiola/flow\";\nimport { createFlowRef, type FlowRef } from \"./create-flow-ref\";\n\n/**\n * A flow ref kept by the component that makes it (React's `useFlowRef`): give it to a\n * `[flowRoot]` and read `flow.current` in the template (a toolbar next to the flow) or in\n * handlers. Its `current` is a signal's value, so the template follows the root as it attaches\n * and detaches; it is `createFlowRef()`, named for a field next to the other injection functions.\n *\n * ```ts\n * readonly flow = injectFlowRef<Types>();\n * // <button type=\"button\" (click)=\"flow.current?.engine.run('fit-view')\">Fit</button>\n * // <div flowRoot [flowRef]=\"flow\" [defaultNodes]=\"nodes\">…</div>\n * ```\n */\nexport function injectFlowRef<\n T extends FlowTypes = AnyTypes,\n F extends FlowFeatures = readonly [],\n>(): FlowRef<T, F> {\n return createFlowRef<T, F>();\n}\n","import type { Signal } from \"@angular/core\";\nimport type { AnyTypes, FlowFeatures, FlowTypes } from \"@fragiola/flow\";\nimport { injectFlowContext, typedEngine, typedModel } from \"../context\";\nimport type { FlowRefValue } from \"./create-flow-ref\";\nimport { flowValue } from \"./internal\";\n\n/**\n * A value selected from the model and the engine of the enclosing `[flowRoot]` (React's\n * `useFlowStore`), as a signal that changes only when the value does (`equal`, default\n * `Object.is`): `selector` runs again on every change of the model, every view change of the\n * engine (a measurement, the viewport, a gesture) and every change of a signal it reads. Pass the\n * registry and the features as the type arguments after the selected value's\n * (`injectFlowStore<number, Types, typeof features>(…)`). Keep a selector that builds an object or\n * an array with an `equal` that compares it (`sameFlowValue`), or it changes on every change. Call\n * it in an injection context (a constructor or a field).\n */\nexport function injectFlowStore<\n S,\n T extends FlowTypes = AnyTypes,\n F extends FlowFeatures = readonly [],\n>(\n selector: (flow: FlowRefValue<T, F>) => S,\n equal: (a: S, b: S) => boolean = Object.is,\n): Signal<S> {\n const context = injectFlowContext(\"injectFlowStore\");\n return flowValue(\n context,\n () =>\n selector({\n model: typedModel<T, F>(context.model()),\n engine: typedEngine<T, F>(context.publicEngine),\n }),\n equal,\n );\n}\n","import type { Signal } from \"@angular/core\";\nimport {\n type AnyTypes,\n type FlowTypes,\n type InternalNode,\n sameFlowValue,\n} from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue, type ValueOrSignal, valueNow } from \"./internal\";\n\n/**\n * A node as the engine knows it on screen (`internal-node-by`, React's `useInternalNode`): the\n * document's node, its absolute position and box (`nodeOrigin` applied), whether its size is\n * known, its z-index and its handles with their centres; undefined while it does not exist or\n * before the root created its engine. The signal changes only when one of them does (compared by\n * value): a pan does not. The id is a value, a signal or a getter. Call it in an injection context\n * (a constructor or a field).\n */\nexport function injectInternalNode<T extends FlowTypes = AnyTypes>(\n nodeId: ValueOrSignal<string>,\n): Signal<InternalNode<T> | undefined> {\n const context = injectFlowContext(\"injectInternalNode\");\n return flowValue(\n context,\n () => {\n const engine = context.engine();\n const id = valueNow(nodeId);\n if (!engine || id === undefined) return undefined;\n return engine.get(\"internal-node-by\", { nodeId: id }) as\n | InternalNode<T>\n | undefined;\n },\n sameFlowValue,\n );\n}\n","import {\n computed,\n effect,\n inject,\n type Signal,\n signal,\n untracked,\n} from \"@angular/core\";\nimport {\n type KeyPressKeys,\n type KeyPressTarget,\n watchKeyPress,\n} from \"@fragiola/flow\";\nimport { FLOW_CONTEXT } from \"../context\";\nimport { type ValueOrSignal, valueNow } from \"./internal\";\n\nexport interface InjectKeyPressOptions {\n /**\n * where the keys are read: a window, a document or an element (`null`: nowhere); default the\n * root's window\n */\n target?: ValueOrSignal<KeyPressTarget | null | undefined>;\n}\n\n/**\n * Whether a key, or a combo of keys, is held (React's `useKeyPress`), as a signal. `keys` is a\n * combo or several (any of them): key names joined by `+`, held at once (`\"Shift\"`, `\"Meta+s\"`,\n * `[\"Meta+z\", \"Control+z\"]`); a name is a `KeyboardEvent.key` or `.code`, without case\n * (`watchKeyPress`). The keys are read on `target`, by default the window of the enclosing\n * `[flowRoot]`'s element (never the global one): false outside a root without a `target`. The\n * keys and the target are values, signals or getters. Call it in an injection context (a\n * constructor or a field).\n */\nexport function injectKeyPress(\n keys: ValueOrSignal<KeyPressKeys>,\n options: InjectKeyPressOptions = {},\n): Signal<boolean> {\n const root = inject(FLOW_CONTEXT, { optional: true })?.rootElement ?? null;\n const target = computed((): KeyPressTarget | null => {\n const given =\n options.target === undefined ? undefined : valueNow(options.target);\n if (given !== undefined) return given;\n return root?.ownerDocument.defaultView ?? null;\n });\n // an equal list of keys keeps the listener (and what it holds)\n const combos = computed(\n (): readonly string[] => {\n const now = valueNow(keys);\n return now === undefined\n ? []\n : typeof now === \"string\"\n ? [now]\n : now;\n },\n {\n equal: (a, b) =>\n a.length === b.length && a.every((combo, i) => combo === b[i]),\n },\n );\n const pressed = signal(false);\n effect((onCleanup) => {\n const on = target();\n const list = combos();\n if (!on) return;\n untracked(() => {\n const stop = watchKeyPress(on, list, (now) => pressed.set(now));\n onCleanup(() => {\n stop();\n pressed.set(false);\n });\n });\n });\n return pressed.asReadonly();\n}\n","import { computed, isSignal, type Signal } from \"@angular/core\";\nimport {\n type HandleType,\n type NodeConnection,\n sameFlowValue,\n} from \"@fragiola/flow\";\nimport { injectFlowContext, injectNodeContext } from \"../context\";\nimport {\n flowValue,\n partOwnerId,\n type ValueOrSignal,\n valueNow,\n} from \"./internal\";\n\nexport interface InjectNodeConnectionsOptions {\n /** the node; default the enclosing `[flowNode]`'s */\n id?: string | undefined;\n /** only the connections at this handle of it */\n handleId?: string | undefined;\n /** only those that start (`\"source\"`) or end (`\"target\"`) at it */\n type?: HandleType | undefined;\n}\n\n/**\n * The connections at a node (`node-connections-by`, React's `useNodeConnections`): each edge that\n * starts or ends at it, as its `edgeId`, `source`, `sourceHandle`, `target` and `targetHandle`, in\n * the document's order. The signal changes only when they do (an edge added, removed or\n * reconnected there), not when a node moves or an edge's data changes. The options are a value, a\n * signal or a getter; outside `[flowNode]` they need an `id` (reported once rendered). Call it in\n * an injection context (a constructor or a field).\n */\nexport function injectNodeConnections(\n options: ValueOrSignal<InjectNodeConnectionsOptions> = {},\n): Signal<readonly NodeConnection[]> {\n const context = injectFlowContext(\"injectNodeConnections\");\n const around = injectNodeContext();\n // options given as a value are known now (React's error); a signal's once rendered\n if (\n !around &&\n !isSignal(options) &&\n typeof options !== \"function\" &&\n options.id === undefined\n ) {\n throw new Error(\n \"injectNodeConnections must be called inside [flowNode] (or be given an id)\",\n );\n }\n const given = computed(() => valueNow(options));\n const nodeId = partOwnerId(\n \"injectNodeConnections\",\n () => given()?.id,\n around,\n \"node\",\n );\n return flowValue(\n context,\n () => {\n const id = nodeId();\n if (id === undefined) return [];\n const { handleId, type } = given() ?? {};\n return context.model().get(\"node-connections-by\", {\n nodeId: id,\n handleId,\n handleType: type,\n });\n },\n sameFlowValue,\n );\n}\n","import { computed, type Signal } from \"@angular/core\";\nimport { injectNodeContext } from \"../context\";\n\n/**\n * The id of the node the component or directive is inside (`[flowNode]`), or null outside one\n * (React's `useNodeId`): a custom node's piece reads its own node without being given its id. Call\n * it in an injection context (a constructor or a field).\n */\nexport function injectNodeId(): Signal<string | null> {\n const around = injectNodeContext();\n return computed(() => around?.nodeId() ?? null);\n}\n","import type { Signal } from \"@angular/core\";\nimport type { AnyTypes, FlowNode, FlowTypes } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"./internal\";\n\n/**\n * Every node of the enclosing `[flowRoot]`, in drawing order, as a signal that changes on every\n * change of one. Call it in an injection context.\n */\nexport function injectNodes<T extends FlowTypes = AnyTypes>(): Signal<\n readonly FlowNode<T>[]\n> {\n const context = injectFlowContext(\"injectNodes\");\n return flowValue(\n context,\n () => context.model().get(\"all-nodes\") as readonly FlowNode<T>[],\n Object.is,\n );\n}\n","import { computed, type Signal } from \"@angular/core\";\nimport {\n type AnyTypes,\n type FlowTypes,\n type NodeData,\n sameFlowValue,\n} from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue, type ValueOrSignal, valueNow } from \"./internal\";\n\n/**\n * A node's id, type and data (`nodes-data-by`), or null while it does not exist; given several\n * ids, each existing one's in the order given (React's `useNodesData`). The signal changes only\n * when one of them does (its type or its data, compared by value), not when a node moves or another\n * changes. The ids are a value, a signal or a getter (an input is followed); an id not set yet (an\n * input still `undefined`) gives null, as a single id does: only a list gives a list. Call it in an\n * injection context (a constructor or a field).\n */\nexport function injectNodesData<T extends FlowTypes = AnyTypes>(\n nodeId: ValueOrSignal<string | undefined>,\n): Signal<NodeData<T> | null>;\nexport function injectNodesData<T extends FlowTypes = AnyTypes>(\n nodeIds: ValueOrSignal<readonly string[]>,\n): Signal<readonly NodeData<T>[]>;\nexport function injectNodesData<T extends FlowTypes = AnyTypes>(\n ids: ValueOrSignal<string | readonly string[] | undefined>,\n): Signal<NodeData<T> | null | readonly NodeData<T>[]> {\n const context = injectFlowContext(\"injectNodesData\");\n const asked = computed(() => valueNow(ids));\n const list = flowValue(\n context,\n () => {\n const now = asked();\n if (now === undefined) return [];\n return context.model().get(\"nodes-data-by\", {\n nodeIds: typeof now === \"string\" ? [now] : now,\n }) as readonly NodeData<T>[];\n },\n sameFlowValue,\n );\n // a list gives a list; a single id, or none yet, its node or null\n return computed(() =>\n Array.isArray(asked()) ? list() : (list()[0] ?? null),\n );\n}\n","import { effect, untracked } from \"@angular/core\";\nimport type { Viewport } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { type ValueOrSignal, valueNow } from \"./internal\";\n\nexport interface InjectOnViewportChangeOptions {\n /** the viewport starts changing (`viewport-change-start`): a pan, a zoom, an animation */\n onStart?: ((viewport: Viewport, gesture: boolean) => void) | undefined;\n /** each change of the viewport (`viewport-change`) */\n onChange?: ((viewport: Viewport, gesture: boolean) => void) | undefined;\n /** the viewport stopped changing (`viewport-change-end`) */\n onEnd?: ((viewport: Viewport, gesture: boolean) => void) | undefined;\n}\n\n/**\n * Calls back on the viewport's changes of the enclosing `[flowRoot]` (the engine's events, React's\n * `useOnViewportChange`), marking nothing for a check: `gesture` is true for a pan, the wheel, a\n * pinch or auto-pan, false for an action. The options are a value, a signal or a getter, read at\n * each event (the latest callbacks are called). Call it in an injection context (a constructor or\n * a field).\n */\nexport function injectOnViewportChange(\n options: ValueOrSignal<InjectOnViewportChangeOptions>,\n): void {\n const context = injectFlowContext(\"injectOnViewportChange\");\n effect((onCleanup) => {\n const engine = context.engine();\n if (!engine) return;\n const stop = untracked(() =>\n engine.subscribe((event) => {\n if (\n event.type !== \"viewport-change-start\" &&\n event.type !== \"viewport-change\" &&\n event.type !== \"viewport-change-end\"\n ) {\n return;\n }\n const { onStart, onChange, onEnd } =\n untracked(() => valueNow(options)) ?? {};\n const call =\n event.type === \"viewport-change-start\"\n ? onStart\n : event.type === \"viewport-change\"\n ? onChange\n : onEnd;\n call?.(event.viewport, event.gesture);\n }),\n );\n onCleanup(stop);\n });\n}\n","import type { Signal } from \"@angular/core\";\nimport type { AnyTypes, FlowEdge, FlowNode, FlowTypes } from \"@fragiola/flow\";\nimport { injectFlowContext } from \"../context\";\nimport { flowValue } from \"./internal\";\n\n/** What is selected. */\nexport interface FlowSelection<T extends FlowTypes = AnyTypes> {\n readonly nodes: readonly FlowNode<T>[];\n readonly edges: readonly FlowEdge<T>[];\n}\n\nconst NONE: readonly never[] = Object.freeze([]);\n\n/**\n * The selected nodes and edges of the enclosing `[flowRoot]` (`selection()`; none without it), as\n * a signal that changes with them: a panel showing the selection, a Delete button. Call it in an\n * injection context.\n */\nexport function injectSelection<T extends FlowTypes = AnyTypes>(): Signal<\n FlowSelection<T>\n> {\n const context = injectFlowContext(\"injectSelection\");\n return flowValue(\n context,\n () => {\n const model = context.model();\n return {\n nodes: (model.get(\"selected-nodes\") ??\n NONE) as readonly FlowNode<T>[],\n edges: (model.get(\"selected-edges\") ??\n NONE) as readonly FlowEdge<T>[],\n };\n },\n (a, b) =>\n a.nodes.length === b.nodes.length &&\n a.edges.length === b.edges.length &&\n a.nodes.every((node, i) => node === b.nodes[i]) &&\n a.edges.every((edge, i) => edge === b.edges[i]),\n );\n}\n"],"mappings":";;;;AA0DA,MAAa,eAAe,IAAI,eAA4B,MAAM;AAQlE,MAAa,YAAY,IAAI,eAA4B,UAAU;AAQnE,MAAa,YAAY,IAAI,eAA4B,UAAU;AAQnE,MAAa,wBAAwB,IAAI,eACrC,oBAAoB;AAIxB,SAAgB,kBAAkB,MAAY;CAC1C,MAAM,UAAU,OAAO,cAAc,EAAE,UAAU,KAAI,CAAE;CACvD,IAAI,CAAC,SACD,MAAM,IAAI,MAAM,GAAG,KAAI,gCAAiC;CAE5D,OAAO;AACX;AAGA,SAAgB,oBAAiB;CAC7B,OAAO,OAAO,WAAW,EAAE,UAAU,KAAI,CAAE;AAC/C;AAGA,SAAgB,oBAAiB;CAC7B,OAAO,OAAO,WAAW,EAAE,UAAU,KAAI,CAAE;AAC/C;AAGA,SAAgB,WACZ,OAAsB;CAEtB,OAAO;AACX;AAGA,SAAgB,WACZ,OAAmB;CAEnB,OAAO;AACX;AAGA,SAAgB,YACZ,QAAkC;CAElC,OAAO;AACX;ACjDA,MAAa,aAAa,WACtB,GAAG,OAAO,KAAI,QAAS,OAAO;AAGlC,SAAgB,kB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