UNPKG

@foblex/flow

Version:

Angular-native node-based UI library for building node editors, workflow builders, and interactive graph interfaces.

1,206 lines (1,108 loc) 368 kB
import * as _foblex_2d from '@foblex/2d'; import { ITransformModel, IPoint, IRect, ISize, ILine, IRoundedRect, Point, IMinMaxPoint, RoundedRect } from '@foblex/2d'; import * as i0 from '@angular/core'; import { InjectionToken, OnInit, OnChanges, SimpleChanges, AfterContentInit, OnDestroy, InputSignalWithTransform, OutputEmitterRef, Signal, ElementRef, DestroyRef, Provider, ModelSignal, InputSignal, AfterViewInit, Renderer2, ProviderToken, Injector, TemplateRef, EventEmitter, Type } from '@angular/core'; import * as _foblex_flow from '@foblex/flow'; import { IExecution, IHandler, FMediator } from '@foblex/mediator'; import { BrowserService } from '@foblex/platform'; import * as i43 from '@angular/common'; declare const F_BACKGROUND_PATTERN: InjectionToken<IFBackgroundPattern>; interface IFBackgroundPattern { hostElement: HTMLElement | SVGElement; setTransform(transform: ITransformModel): void; } declare class FRectPatternComponent implements OnInit, OnChanges, IFBackgroundPattern { private readonly _destroyRef; private readonly _elementReference; private readonly _fBrowser; private readonly _stateChanges; get hostElement(): HTMLElement; id: i0.InputSignal<string>; vColor: i0.InputSignal<string>; hColor: i0.InputSignal<string>; vSize: i0.InputSignalWithTransform<number, unknown>; hSize: i0.InputSignalWithTransform<number, unknown>; private _transform; private _position; private _size; private _pattern; private _vLine; private _hLine; constructor(); private _createPattern; ngOnInit(): void; private _listenStateChanges; ngOnChanges(changes: SimpleChanges): void; private _redraw; private _calculatePattern; private _redrawPattern; private _redrawLine; setTransform(transform: ITransformModel): void; private _refresh; static ɵfac: i0.ɵɵFactoryDeclaration<FRectPatternComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FRectPatternComponent, "f-rect-pattern", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "vColor": { "alias": "vColor"; "required": false; "isSignal": true; }; "hColor": { "alias": "hColor"; "required": false; "isSignal": true; }; "vSize": { "alias": "vSize"; "required": false; "isSignal": true; }; "hSize": { "alias": "hSize"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } declare class FCirclePatternComponent implements OnInit, OnChanges, IFBackgroundPattern { private readonly _destroyRef; private readonly _elementReference; private readonly _fBrowser; private readonly _stateChanges; get hostElement(): HTMLElement; id: i0.InputSignal<string>; color: i0.InputSignal<string>; radius: i0.InputSignalWithTransform<number, unknown>; private _scaledRadius; private _transform; private _position; private _pattern; private _circle; constructor(); private _createPattern; ngOnInit(): void; private _listenStateChanges; ngOnChanges(changes: SimpleChanges): void; private _redraw; private _calculatePattern; private _redrawPattern; private _redrawElement; setTransform(transform: ITransformModel): void; private _refresh; static ɵfac: i0.ɵɵFactoryDeclaration<FCirclePatternComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FCirclePatternComponent, "f-circle-pattern", never, { "id": { "alias": "id"; "required": false; "isSignal": true; }; "color": { "alias": "color"; "required": false; "isSignal": true; }; "radius": { "alias": "radius"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } interface IHasHostElement<T = HTMLElement | SVGElement> { hostElement: T; } declare const F_BACKGROUND: InjectionToken<FBackgroundBase>; declare abstract class FBackgroundBase implements IHasHostElement { readonly hostElement: any; abstract setTransform(transform: ITransformModel): void; static ɵfac: i0.ɵɵFactoryDeclaration<FBackgroundBase, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<FBackgroundBase, never, never, {}, {}, never, never, true, never>; } declare class FBackgroundComponent extends FBackgroundBase implements OnInit, AfterContentInit, OnDestroy { private readonly _mediator; protected readonly fBackgroundPattern: i0.Signal<_foblex_flow.IFBackgroundPattern | undefined>; ngOnInit(): void; ngAfterContentInit(): void; setTransform(transform: ITransformModel): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<FBackgroundComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FBackgroundComponent, "f-background", never, {}, {}, ["fBackgroundPattern"], ["*"], true, never>; } declare const F_BACKGROUND_PROVIDERS: (typeof FRectPatternComponent | typeof FCirclePatternComponent | typeof FBackgroundComponent)[]; declare abstract class FAutoPanBase implements IHasHostElement { readonly hostElement: any; abstract fEdgeThreshold: InputSignalWithTransform<number, unknown>; abstract fSpeed: InputSignalWithTransform<number, unknown>; abstract fAcceleration: InputSignalWithTransform<boolean, unknown>; static ɵfac: i0.ɵɵFactoryDeclaration<FAutoPanBase, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<FAutoPanBase, never, never, {}, {}, never, never, true, never>; } declare class FAutoPan extends FAutoPanBase implements OnInit, OnDestroy { private readonly _mediator; fEdgeThreshold: i0.InputSignalWithTransform<number, unknown>; fSpeed: i0.InputSignalWithTransform<number, unknown>; fAcceleration: i0.InputSignalWithTransform<boolean, unknown>; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<FAutoPan, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FAutoPan, "f-auto-pan", never, { "fEdgeThreshold": { "alias": "fEdgeThreshold"; "required": false; "isSignal": true; }; "fSpeed": { "alias": "fSpeed"; "required": false; "isSignal": true; }; "fAcceleration": { "alias": "fAcceleration"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } declare const F_AUTO_PAN_PROVIDERS: (typeof FAutoPan)[]; /** * Built-in layers rendered inside `<f-canvas>`. Each one corresponds to * a sibling container in the canvas template (groups, connections, * nodes) and gets its own z-index based on its position in the order * passed to `<f-canvas [fLayers]>` or `withFCanvas({ layers })`. * * The order of an array of `EFCanvasLayer` values is read **bottom to top**: * the first entry sits underneath, the last entry sits on top. */ declare enum EFCanvasLayer { GROUPS = "groups", CONNECTIONS = "connections", NODES = "nodes" } /** * Default rendering order, bottom to top: * groups → connections → nodes (matches every Foblex Flow release before v18.6). */ declare const F_DEFAULT_LAYER_ORDER: EFCanvasLayer[]; declare const F_CANVAS: InjectionToken<FCanvasBase>; declare abstract class FCanvasBase implements IHasHostElement { abstract fCanvasChange: OutputEmitterRef<FCanvasChangeEvent>; readonly hostElement: any; abstract fGroupsContainer: Signal<ElementRef<HTMLElement>>; abstract fNodesContainer: Signal<ElementRef<HTMLElement>>; abstract fConnectionsContainer: Signal<ElementRef<HTMLElement>>; transform: _foblex_2d.ITransformModel; abstract debounce: Signal<number>; private readonly _fCanvasChange; protected readonly destroyRef: DestroyRef; abstract redraw(): void; abstract redrawWithAnimation(): void; getPosition(): IPoint; _setPosition(position: IPoint): void; abstract setScale(scale: number, toPosition: IPoint): void; abstract resetScale(): void; emitCanvasChangeEvent(): void; protected subscribeOnCanvasChange(): void; static ɵfac: i0.ɵɵFactoryDeclaration<FCanvasBase, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<FCanvasBase, never, never, {}, {}, never, never, true, never>; } declare class FCanvasChangeEvent { readonly position: IPoint; readonly scale: number; constructor(position: IPoint, scale: number); } /** * Normalises a user-supplied layer order into a complete, de-duplicated * `EFCanvasLayer[]`. Unknown entries are dropped, duplicates collapse to the * first occurrence, and any layer the caller forgot to mention is * appended in its default position so the canvas always has every layer * to render. */ declare function resolveLayerOrder(value: EFCanvasLayer[] | undefined | null): EFCanvasLayer[]; /** * Canvas-level configuration consumed by `withFCanvas(...)`. * * Currently a single field — `layers` — but the shape leaves room * for additional canvas-scoped knobs without spawning more `with*()` * helpers (e.g. canvas zoom defaults, padding, etc.). */ interface MergeFCanvasConfig { /** * Order in which built-in layers are stacked inside `<f-canvas>`, * read bottom to top. Defaults to * `[EFCanvasLayer.GROUPS, EFCanvasLayer.CONNECTIONS, EFCanvasLayer.NODES]`. * * Missing layers are appended in their default position; unknown * values and duplicates are silently dropped. */ layers?: EFCanvasLayer[]; } /** * Fully resolved canvas configuration. The injection token always * resolves to this shape — `withFCanvas` runs the partial config * through `mergeFCanvasConfig` before binding it to the token, so * downstream consumers never have to handle `undefined` fields. */ interface IFCanvasResolvedConfig { layers: EFCanvasLayer[]; } declare const F_CANVAS_CONFIG: InjectionToken<IFCanvasResolvedConfig>; declare function mergeFCanvasConfig(partial: MergeFCanvasConfig | undefined): IFCanvasResolvedConfig; /** * Flow-level configuration passed as the first argument to `provideFFlow(...)`. * * Priority for `id`: `[fFlowId]` input on `<f-flow>` > this config > auto-generated. */ interface IFFlowConfig { id?: string; } declare const F_FLOW_CONFIG: InjectionToken<IFFlowConfig>; /** * Discriminator for `with*()` features composed by `provideFFlow`. */ declare enum EFFlowFeatureKind { REFLOW_ON_RESIZE = "reflow-on-resize", CANVAS = "canvas" } /** * Feature envelope returned by `with*()` helpers. * * Each helper returns a kind tag and the provider list that activates the feature. * `provideFFlow` flattens these into a single `Provider[]` placed in the host's * `providers` array. */ interface IFFlowFeature<K extends EFFlowFeatureKind = EFFlowFeatureKind> { readonly kind: K; readonly providers: Provider[]; } /** * Entry point for the provider-based Flow configuration surface. * * Usage: * ```typescript * providers: [ * provideFFlow( * { id: 'main' }, // optional flow-level config * withReflowOnResize({ ... }), // feature plugins * ), * ]; * ``` * * The first positional argument is an optional `IFFlowConfig`. Any argument that * carries a `kind` discriminator is treated as a feature. */ declare function provideFFlow(...features: IFFlowFeature[]): Provider[]; declare function provideFFlow(config: IFFlowConfig, ...features: IFFlowFeature[]): Provider[]; /** * Configures `<f-canvas>` inside `provideFFlow(...)`. * * ```typescript * @Component({ * providers: [ * provideFFlow( * withFCanvas({ layers: [EFLayer.GROUPS, EFLayer.NODES, EFLayer.CONNECTIONS] }), * ), * ], * }) * export class MyFlow {} * ``` * * The order is read bottom to top — the first entry sits underneath, * the last entry sits on top. Missing layers are appended in their * default position. * * The same value can also be set per-instance via * `<f-canvas [fLayers]="...">`. The component input wins when both are * present, so `withFCanvas` acts as the app-wide default and individual * canvases can opt out without re-providing the feature. * * Registering the feature twice replaces the earlier config via * Angular's last-wins provider semantics. */ declare function withFCanvas(config?: MergeFCanvasConfig): IFFlowFeature<EFFlowFeatureKind.CANVAS>; /** * Component representing a canvas in the F-Flow framework. * It handles the rendering of nodes, connections, and groups, * as well as user interactions such as zooming and panning. * It extends the FCanvasBase class and implements OnInit and OnDestroy lifecycle hooks. * It provides methods to manipulate the canvas, such as centering nodes or groups, * fitting the canvas to the screen, and resetting the scale. * It also emits events when the canvas changes, allowing other components to react to these changes. */ declare class FCanvasComponent extends FCanvasBase implements OnInit, OnDestroy { private readonly _mediator; private readonly _components; private readonly _injector; private readonly _config; private _flowId; fCanvasChange: i0.OutputEmitterRef<FCanvasChangeEvent>; readonly position: i0.InputSignalWithTransform<IPoint, IPoint | null | undefined>; readonly scale: i0.InputSignalWithTransform<number, unknown>; readonly debounceTime: i0.InputSignalWithTransform<number, unknown>; debounce: i0.Signal<number>; /** * Stacking order of the built-in layers (groups, connections, nodes), * read bottom to top. The first entry sits underneath, the last entry * sits on top. Defaults to the order shipped before v18.6: * `[GROUPS, CONNECTIONS, NODES]`. * * When `withFCanvas({ layers })` is provided in the component's * injector, this input falls back to that value; passing `fLayers` * directly always wins. Missing layers are appended in their default * position so every canvas renders all three regardless of input. */ readonly fLayers: i0.InputSignal<EFCanvasLayer[] | undefined>; /** * Final layer order rendered in the template. The three sibling * containers are emitted in this order, which (combined with * `isolation: isolate` on each of them) is what visually stacks * groups, connections, and nodes — no per-container z-index involved. */ protected readonly resolvedLayers: i0.Signal<EFCanvasLayer[]>; fGroupsContainer: i0.Signal<ElementRef<HTMLElement>>; fNodesContainer: i0.Signal<ElementRef<HTMLElement>>; fConnectionsContainer: i0.Signal<ElementRef<HTMLElement>>; get flowId(): string; ngOnInit(): void; private _positionChange; private _scaleChange; /** * Redraws the canvas by applying the current transformation. */ redraw(): void; /** * Redraws the canvas with an animation effect. * This method applies a CSS transition to the canvas element, * allowing for a smooth visual update of the canvas's transformation. */ redrawWithAnimation(): void; /** * Centers the specified group or node on the canvas. * @param groupOrNodeId - The ID of the group or node to center. * @param animated - If true, the centering will be animated; otherwise, it will be instantaneous. */ centerGroupOrNode(groupOrNodeId: string, animated?: boolean): void; /** * Fits the canvas to the screen by adjusting the scale and position. * @param padding - paddings from the bounds of the canvas * @param animated - If true, the fit will be animated; otherwise, it will be instantaneous. */ fitToScreen(padding?: IPoint, animated?: boolean): void; /** * Resets the scale and center all nodes and groups on the canvas. * This method is used to restore the canvas to its default scale and position, * allowing users to quickly return to a standard view of the canvas content. * @param animated - If true, the reset will be animated; otherwise, it will be instantaneous. * This is useful for providing a smooth user experience when resetting the view. */ resetScaleAndCenter(animated?: boolean): void; /** * Gets the current scale of the canvas. */ getScale(): number; /** * Sets the scale of the canvas to a specified value. * This method is used to zoom in or out of the canvas, * allowing users to adjust the view of the canvas content. * @param scale - The scale factor to set for the canvas. * @param toPosition - The position to which the canvas should be centered after scaling. */ setScale(scale: number, toPosition?: IPoint): void; /** * Resets the scale of the canvas to its default value. * This method is used to restore the canvas to its original scale. */ resetScale(): void; ngOnDestroy(): void; private _afterRedraw; static ɵfac: i0.ɵɵFactoryDeclaration<FCanvasComponent, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FCanvasComponent, "f-canvas", never, { "position": { "alias": "position"; "required": false; "isSignal": true; }; "scale": { "alias": "scale"; "required": false; "isSignal": true; }; "debounceTime": { "alias": "debounceTime"; "required": false; "isSignal": true; }; "fLayers": { "alias": "fLayers"; "required": false; "isSignal": true; }; }, { "fCanvasChange": "fCanvasChange"; }, never, ["[fGroup], [fGroups]", "f-snap-connection", "f-connection, [fConnections]", "f-connection-for-create", "[fNode], [fNodes]"], true, never>; } declare const F_CANVAS_PROVIDERS: (typeof FCanvasComponent)[]; declare class AddPatternToBackgroundRequest { fPattern: IFBackgroundPattern | undefined; static readonly fToken: unique symbol; constructor(fPattern: IFBackgroundPattern | undefined); } /** * Execution that adds a pattern to the background in the FComponentsStore. */ declare class AddPatternToBackground implements IExecution<AddPatternToBackgroundRequest, void> { private readonly _store; private readonly _browser; private get _backgroundElement(); handle(request: AddPatternToBackgroundRequest): void; private _getPatterns; static ɵfac: i0.ɵɵFactoryDeclaration<AddPatternToBackground, never>; static ɵprov: i0.ɵɵInjectableDeclaration<AddPatternToBackground>; } declare class SetBackgroundTransformRequest { fTransform: ITransformModel; static readonly fToken: unique symbol; constructor(fTransform: ITransformModel); } /** * Execution that sets the transform for the background when canvas is transformed. */ declare class SetBackgroundTransform implements IExecution<SetBackgroundTransformRequest, void> { private readonly _store; handle(request: SetBackgroundTransformRequest): void; static ɵfac: i0.ɵɵFactoryDeclaration<SetBackgroundTransform, never>; static ɵprov: i0.ɵɵInjectableDeclaration<SetBackgroundTransform>; } /** * This file exports all the background-related features for the F-Flow domain. * It includes executions for adding, removing, and setting the background in the FComponentsStore. */ declare const F_BACKGROUND_FEATURES: (typeof AddPatternToBackground | typeof SetBackgroundTransform)[]; declare class AddCanvasToStoreRequest { readonly instance: FCanvasBase; static readonly fToken: unique symbol; constructor(instance: FCanvasBase); } /** * Execution that adds a canvas to the FComponentsStore. */ declare class AddCanvasToStore implements IExecution<AddCanvasToStoreRequest, void> { private readonly _store; handle({ instance }: AddCanvasToStoreRequest): void; static ɵfac: i0.ɵɵFactoryDeclaration<AddCanvasToStore, never>; static ɵprov: i0.ɵɵInjectableDeclaration<AddCanvasToStore>; } declare class CenterGroupOrNodeRequest { id: string; animated: boolean; static readonly fToken: unique symbol; constructor(id: string, animated: boolean); } /** * Execution that centers a group or a node inside the flow. */ declare class CenterGroupOrNode implements IExecution<CenterGroupOrNodeRequest, void> { private readonly _store; private readonly _mediator; private get _transform(); handle({ id, animated }: CenterGroupOrNodeRequest): void; private _toCenter; private _getNodeRect; private _getFlowRect; static ɵfac: i0.ɵɵFactoryDeclaration<CenterGroupOrNode, never>; static ɵprov: i0.ɵɵInjectableDeclaration<CenterGroupOrNode>; } declare class FitToFlowRequest { readonly toCenter: IPoint; readonly animated: boolean; static readonly fToken: unique symbol; constructor(toCenter: IPoint, animated: boolean); } /** * Fits all nodes and groups to the flow by scaling and positioning them */ declare class FitToFlow implements IExecution<FitToFlowRequest, void> { private readonly _store; private get _transform(); private readonly _mediator; handle({ toCenter, animated }: FitToFlowRequest): void; fitToParent(rect: IRect, parentRect: IRect, points: IPoint[], toCenter: IPoint): void; private _getZeroPositionWithoutScale; static ɵfac: i0.ɵɵFactoryDeclaration<FitToFlow, never>; static ɵprov: i0.ɵɵInjectableDeclaration<FitToFlow>; } declare class InputCanvasPositionRequest { readonly transform: ITransformModel; readonly position: IPoint | undefined; static readonly fToken: unique symbol; constructor(transform: ITransformModel, position: IPoint | undefined); } /** * It updates the canvas position and redraws the canvas when the user set a new position using the input. */ declare class InputCanvasPosition implements IExecution<InputCanvasPositionRequest, void> { private readonly _store; handle({ transform, position }: InputCanvasPositionRequest): void; private _calculateTransformPosition; static ɵfac: i0.ɵɵFactoryDeclaration<InputCanvasPosition, never>; static ɵprov: i0.ɵɵInjectableDeclaration<InputCanvasPosition>; } declare class InputCanvasScaleRequest { transform: ITransformModel; scale: number | undefined; static readonly fToken: unique symbol; constructor(transform: ITransformModel, scale: number | undefined); } /** * Execution that handles the scaling of the input canvas. * It updates the scale of the canvas transform and redraws the canvas when the user sets a new scale using the input. */ declare class InputCanvasScale implements IExecution<InputCanvasScaleRequest, void> { private readonly _store; handle(request: InputCanvasScaleRequest): void; static ɵfac: i0.ɵɵFactoryDeclaration<InputCanvasScale, never>; static ɵprov: i0.ɵɵInjectableDeclaration<InputCanvasScale>; } declare enum ECanvasRedrawContext { VIEWPORT_ONLY = "VIEWPORT_ONLY", WITH_CONNECTION_CHANGES = "WITH_CONNECTION_CHANGES" } declare class RedrawCanvasWithAnimationRequest { readonly animated: boolean; readonly context: ECanvasRedrawContext; static readonly fToken: unique symbol; constructor(animated: boolean, context?: ECanvasRedrawContext); } /** * Execution that redraws the canvas with or without animation based on the request. * If animated, it will redraw with animation and wait for the transition end to notify data change. * If not animated, it will redraw immediately and notify data change. */ declare class RedrawCanvasWithAnimation implements IExecution<RedrawCanvasWithAnimationRequest, void> { private readonly _store; private get _canvas(); handle(request: RedrawCanvasWithAnimationRequest): void; private _redrawWithAnimation; private _redraw; static ɵfac: i0.ɵɵFactoryDeclaration<RedrawCanvasWithAnimation, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RedrawCanvasWithAnimation>; } declare class RemoveCanvasFromStoreRequest { static readonly fToken: unique symbol; } /** * Execution that removes the canvas from the FComponentsStore. */ declare class RemoveCanvasFromStore implements IExecution<RemoveCanvasFromStoreRequest, void> { private readonly _store; handle(_: RemoveCanvasFromStoreRequest): void; static ɵfac: i0.ɵɵFactoryDeclaration<RemoveCanvasFromStore, never>; static ɵprov: i0.ɵɵInjectableDeclaration<RemoveCanvasFromStore>; } declare class ResetScaleRequest { static readonly fToken: unique symbol; } /** * Execution that resets the scale of the canvas in the FComponentsStore. */ declare class ResetScale implements IExecution<ResetScaleRequest, void> { private readonly _store; private get _transform(); handle(_: ResetScaleRequest): void; static ɵfac: i0.ɵɵFactoryDeclaration<ResetScale, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ResetScale>; } declare class ResetScaleAndCenterRequest { readonly animated: boolean; static readonly fToken: unique symbol; constructor(animated: boolean); } /** * Execution that resets the scale of the canvas and centers the nodes and groups inside the flow. */ declare class ResetScaleAndCenter implements IExecution<ResetScaleAndCenterRequest, void> { private readonly _mediator; private readonly _store; private get _transform(); handle({ animated }: ResetScaleAndCenterRequest): void; _oneToOneCentering(rect: IRect, parentRect: IRect, points: IPoint[]): void; private _getZeroPositionWithoutScale; static ɵfac: i0.ɵɵFactoryDeclaration<ResetScaleAndCenter, never>; static ɵprov: i0.ɵɵInjectableDeclaration<ResetScaleAndCenter>; } declare class UpdateScaleRequest { readonly scale: number; readonly toPosition: IPoint; static readonly fToken: unique symbol; constructor(scale: number, toPosition: IPoint); } /** * Execution that updates the scale of the canvas in the FComponentsStore. * Occurs when the fZoom directive or User call the setScale method. */ declare class UpdateScale implements IExecution<UpdateScaleRequest, void> { private readonly _store; private get _transform(); handle({ scale, toPosition }: UpdateScaleRequest): void; static ɵfac: i0.ɵɵFactoryDeclaration<UpdateScale, never>; static ɵprov: i0.ɵɵInjectableDeclaration<UpdateScale>; } /** * This file exports all the canvas-related executions that can be used in the FCanvas feature. */ declare const F_CANVAS_FEATURES: (typeof AddCanvasToStore | typeof CenterGroupOrNode | typeof FitToFlow | typeof InputCanvasPosition | typeof InputCanvasScale | typeof RedrawCanvasWithAnimation | typeof RemoveCanvasFromStore | typeof ResetScale | typeof ResetScaleAndCenter | typeof UpdateScale)[]; /** Unit tangent vector. */ interface ITangent extends IPoint { } /** Result of sampling the path. */ interface ISamplerResult { /** Interpolated point on the polyline. */ point: IPoint; /** Unit tangent (segment direction) at that point. */ tangent: ITangent; /** Whether the result was clamped to the path edge (start or end). */ atEdge: boolean; } /** * Immutable polyline geometry with precomputed cumulative lengths and segment tangents. * Keep this class focused on geometry only; sampling/traversal lives in PolylineSampler. */ declare class Polyline { /** Cleaned points (with consecutive duplicates removed). */ readonly points: IPoint[]; /** Cumulative length from start to each vertex. Same length as `points`. */ readonly cumulativeLengths: number[]; /** Unit tangent per segment `i` for segment [i -> i+1]. Length = points.length - 1. */ readonly segmentTangents: ITangent[]; /** Total length of the polyline (>= 1 for the degenerate fallback). */ readonly totalLength: number; /** * Construct a polyline from raw points. * Consecutive duplicate points are removed. * If less than 2 points remain, it falls back to a unit horizontal segment [0,0] → [1,0]. */ constructor(points: IPoint[]); /** * Create a polyline by cloning points (defensive copy). * @param points Raw input points; they will be copied and cleaned. */ static from(points: IPoint[]): Polyline; /** Remove consecutive duplicate points. */ private static _removeConsecutiveDuplicates; } /** * Provides sampling (interpolation) along a {@link Polyline}. * Separates traversal logic from pure geometry stored in {@link Polyline}. */ declare class PolylineSampler { private _polyline; /** * @param points Initial points to build the underlying polyline. * You can later call {@link updatePoints} to rebuild. */ constructor(points?: IPoint[]); /** * Rebuild the underlying polyline from new points. * @returns Total length of the rebuilt polyline. */ updatePoints(points: IPoint[]): number; /** * Backward-compatible alias for older API naming. * @returns Total length of the rebuilt polyline. */ calculateTotalLength(points: IPoint[]): number; /** Total length of the current polyline. */ get totalLength(): number; /** * Sample a point by normalized progress along the whole length. * * - `progress = 0` → start vertex * - `progress = 1` → end vertex * * Uses a small edge threshold (0.5 units) to snap near-start/near-end queries to exact vertices, * mirroring the behavior in the original implementation. * * @param progress Normalized value in [0..1]. Values are clamped to this range. * @returns Interpolated point, segment tangent, and whether it was clamped to an edge. */ getPointAtProgress(progress: number): ISamplerResult; /** * Backward-compatible alias. * Equivalent to {@link getPointAtProgress}. */ getPointAtLength(progress: number): ISamplerResult; /** * Sample a point by absolute distance from the start (in the same units as your points). * This is a convenience wrapper over {@link getPointAtProgress}. * * @param distance Distance from 0 to {@link totalLength}. Values outside are clamped. * @returns Interpolated point, segment tangent, and whether it was clamped to an edge. */ getPointAtDistance(distance: number): ISamplerResult; /** Binary-search the first index where cumulativeLengths[index] >= target. */ private static _findRightIndex; /** Linear interpolation between `a` and `b`. */ private static _lerp; /** Clamp `value` into [min, max]. */ private static _clamp; /** Safe ratio `num / den` with tiny-denominator guard. */ private static _safeRatio; } declare enum PolylineContentAlign { NONE = "none", ALONG = "along" } /** Domain contract for content item to be placed along the path. */ interface IPolylineContent { position: Signal<number>; offset: Signal<number>; align: Signal<PolylineContentAlign>; hostElement: HTMLElement; /** * Returns the latest measured size of the content's host element. * * Implementations cache the size and refresh it via a * `ResizeObserver` rather than reading the DOM on every call — * placement runs in a tight loop interleaved with style writes, so * a per-call `getBoundingClientRect()` forces a synchronous layout * flush per label and turns drag into a layout-thrashing storm at * a few hundred labels (see issue #304). */ measureSize(): ISize; } /** * Encapsulates placement logic for a single content item along the path. */ declare class PolylineContentPlace { compute(sampler: PolylineSampler, content: IPolylineContent): { position: IPoint; rotationDeg: number; }; private _clamp01; private _applyEdgeGuard; private _sizeAlongDirection; private _normalize180; private _keepUpright; private _calculateContentRotation; } /** * Engine that orchestrates positioning and orientation of all * connection contents along a computed path. */ declare class ConnectionContentLayoutEngine { private readonly _placement; constructor(_placement?: PolylineContentPlace); layout(points: IPoint[], contents: Iterable<IPolylineContent>): number; private _createTransformString; } declare const F_CONNECTION_CONTENT: InjectionToken<FConnectionContentBase>; declare abstract class FConnectionContentBase implements IPolylineContent { /** * The host DOM element to which the directive is applied. * Used internally for positioning calculations. */ readonly hostElement: any; private _cachedSize; private _observer; constructor(); /** * Position along the connection. * * A normalized value in the range `0..1`: * - `0` — at the start of the connection, * - `1` — at the end of the connection, * - `0.5` — at the middle of the connection (default). */ abstract position: Signal<number>; /** * Perpendicular offset from the connection line (in pixels). * * - Positive values shift the element to the right * relative to the line direction. * - Negative values shift it to the left. * - Default: `0` (no shift). */ abstract offset: Signal<number>; /** * Controls the orientation (rotation) of the content relative to the connection. * * Possible values: * - `'none'` — no rotation (default). * - `'along'` — aligned along the path (tangent). */ abstract align: Signal<PolylineContentAlign>; measureSize(): ISize; } /** * Directive for placing custom user content (text, icons, buttons, etc.) * along a connection line. * * It allows you to specify the position along the connection, * shift the content sideways (perpendicular to the path), * apply a margin near the edges, and control orientation. * * ### Usage examples * * ```html * <!-- Text centered on the connection --> * <div fConnectionContent [position]="0.5"> * Hello * </div> * * <!-- Button near the start of the connection, shifted upward by 12px --> * <button fConnectionContent [position]="0.2" [offset]="-12"> * + * </button> * * <!-- Icon at the end of the connection, with 6px margin and rotated along the path --> * <span fConnectionContent [position]="1" [margin]="6" align="along"> * ⮕ * </span> * ``` */ declare class FConnectionContent extends FConnectionContentBase implements OnInit { private readonly _mediator; private readonly _injector; readonly position: i0.InputSignalWithTransform<number, unknown>; readonly offset: i0.InputSignalWithTransform<number, unknown>; readonly align: i0.InputSignalWithTransform<PolylineContentAlign, unknown>; ngOnInit(): void; private _listenChanges; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionContent, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<FConnectionContent, "[fConnectionContent]", never, { "position": { "alias": "position"; "required": false; "isSignal": true; }; "offset": { "alias": "offset"; "required": false; "isSignal": true; }; "align": { "alias": "align"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } declare const F_CONNECTION_WAYPOINTS: InjectionToken<FConnectionWaypointsBase>; declare abstract class FConnectionWaypointsBase { readonly hostElement: any; readonly candidates: i0.WritableSignal<IPoint[]>; abstract waypoints: ModelSignal<IPoint[]>; abstract radius: Signal<number>; abstract visibility: Signal<boolean>; private _activeIndex; private _waypoints; insert(candidate: IPoint): void; select(waypoint: IPoint): void; move(point: IPoint): void; update(): void; } declare function findWaypointCandidate(connection: { fWaypoints: Signal<FConnectionWaypointsBase | undefined>; }, position: IPoint): IPoint | undefined; type WaypointPick<T> = { connection: T; waypoint: IPoint; candidate?: never; } | { connection: T; candidate: IPoint; waypoint?: never; }; type HasWaypoints = { fWaypoints: Signal<FConnectionWaypointsBase | undefined>; }; declare function pickWaypoint<T extends HasWaypoints>(connections: readonly T[], position: IPoint): WaypointPick<T> | undefined; declare function findExistingWaypoint(connection: { fWaypoints: Signal<FConnectionWaypointsBase | undefined>; }, position: IPoint): IPoint | undefined; declare function isPointerInsidePoint(point: IPoint, circleCenter: IPoint, radius: number): boolean; declare class FConnectionWaypoints extends FConnectionWaypointsBase implements OnInit, OnDestroy { private readonly _mediator; private readonly _injector; private readonly _connection; readonly radius: i0.InputSignalWithTransform<number, unknown>; readonly waypoints: i0.ModelSignal<IPoint[]>; readonly visibility: i0.InputSignalWithTransform<boolean, unknown>; ngOnInit(): void; private _listenChanges; private _notifyDataChanged; protected remove(index: number, event: MouseEvent): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionWaypoints, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FConnectionWaypoints, "f-connection-waypoints", never, { "radius": { "alias": "radius"; "required": false; "isSignal": true; }; "waypoints": { "alias": "waypoints"; "required": false; "isSignal": true; }; "visibility": { "alias": "visibility"; "required": false; "isSignal": true; }; }, { "waypoints": "waypointsChange"; }, never, never, true, never>; } declare enum EFMarkerType { START = "f-connection-marker-start", END = "f-connection-marker-end", SELECTED_START = "f-connection-selected-marker-start", SELECTED_END = "f-connection-selected-marker-end", START_ALL_STATES = "f-connection-marker-start-all-states", END_ALL_STATES = "f-connection-marker-end-all-states" } declare const F_CONNECTION_MARKER: InjectionToken<FConnectionMarkerBase>; declare abstract class FConnectionMarkerBase { readonly fId: i0.WritableSignal<string>; readonly hostElement: any; abstract markerElement: SVGElement; abstract width: number; abstract height: number; abstract refX: number; abstract refY: number; abstract get type(): EFMarkerType; abstract orient: 'auto' | 'auto-start-reverse' | string; abstract markerUnits: 'strokeWidth' | 'userSpaceOnUse'; } declare function coerceMarkerType(value: unknown, fallbackValue?: EFMarkerType): EFMarkerType; declare class FConnectionMarkerArrow extends FConnectionMarkerBase { private readonly _markerElement; readonly _type: i0.InputSignalWithTransform<EFMarkerType, unknown>; get markerElement(): SVGSVGElement; width: number; height: number; refX: number; refY: number; get type(): EFMarkerType; orient: 'auto' | 'auto-start-reverse' | string; markerUnits: 'strokeWidth' | 'userSpaceOnUse'; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionMarkerArrow, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FConnectionMarkerArrow, "f-connection-marker-arrow", never, { "_type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } declare class FConnectionMarkerCircle extends FConnectionMarkerBase { private readonly _markerElement; readonly _type: i0.InputSignalWithTransform<EFMarkerType, unknown>; get markerElement(): SVGSVGElement; width: number; height: number; refX: number; refY: number; get type(): EFMarkerType; orient: 'auto' | 'auto-start-reverse' | string; markerUnits: 'strokeWidth' | 'userSpaceOnUse'; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionMarkerCircle, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FConnectionMarkerCircle, "f-connection-marker-circle", never, { "_type": { "alias": "type"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>; } declare class FConnectionMarker extends FConnectionMarkerBase implements OnInit, OnDestroy { private readonly _mediator; markerElement: SVGElement; width: number; height: number; refX: number; refY: number; type: EFMarkerType; orient: 'auto' | 'auto-start-reverse' | 'calculated' | string; markerUnits: 'strokeWidth' | 'userSpaceOnUse'; ngOnInit(): void; ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionMarker, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<FConnectionMarker, "svg[fMarker]", never, { "width": { "alias": "width"; "required": false; }; "height": { "alias": "height"; "required": false; }; "refX": { "alias": "refX"; "required": false; }; "refY": { "alias": "refY"; "required": false; }; "type": { "alias": "type"; "required": false; }; "orient": { "alias": "orient"; "required": false; }; "markerUnits": { "alias": "markerUnits"; "required": false; }; }, {}, never, never, false, never>; static ngAcceptInputType_type: unknown; } declare const F_CONNECTION_GRADIENT: InjectionToken<FConnectionGradientBase>; declare abstract class FConnectionGradientBase { abstract fStartColor: Signal<string>; abstract fEndColor: Signal<string>; } declare abstract class FConnectionGradientRendererBase implements OnInit { private readonly _connection; private readonly _hostElement; private readonly _injector; private readonly _hostAttributes; private _startColor?; private _endColor?; abstract gradient: InputSignal<FConnectionGradientBase>; readonly gradientId: i0.Signal<string>; ngOnInit(): void; private _listenColorChanges; get stop1Element(): SVGStopElement; get stop2Element(): SVGStopElement; redraw(line: ILine): void; private _updateGradient; private _setFromColor; private _setToColor; private _setHostAttribute; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionGradientRendererBase, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<FConnectionGradientRendererBase, never, never, {}, {}, never, never, true, never>; } declare class FConnectionGradientRenderer extends FConnectionGradientRendererBase { readonly gradient: i0.InputSignal<FConnectionGradientBase>; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionGradientRenderer, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FConnectionGradientRenderer, "linearGradient[fConnectionGradientRenderer]", never, { "gradient": { "alias": "fConnectionGradientRendererFor"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>; } declare class FConnectionGradient extends FConnectionGradientBase { readonly fStartColor: i0.InputSignal<string>; readonly fEndColor: i0.InputSignal<string>; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionGradient, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FConnectionGradient, "f-connection-gradient", never, { "fStartColor": { "alias": "fStartColor"; "required": true; "isSignal": true; }; "fEndColor": { "alias": "fEndColor"; "required": true; "isSignal": true; }; }, {}, never, never, true, never>; } declare const F_CONNECTION_PATH: InjectionToken<FConnectionPathBase>; declare abstract class FConnectionPathBase { readonly hostElement: any; abstract initialize(): void; abstract setPath(path: string): void; abstract select(): void; abstract deselect(): void; } declare class FConnectionPath extends FConnectionPathBase { private readonly _connection; readonly useGradient: i0.InputSignal<boolean>; readonly linkToGradient: i0.Signal<string | null>; get fPathId(): string; get attrConnectionId(): string; initialize(): void; setPath(path: string): void; select(): void; deselect(): void; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionPath, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FConnectionPath, "path[f-connection-path]", never, { "useGradient": { "alias": "useGradient"; "required": false; "isSignal": true; }; }, {}, never, never, false, never>; } declare const F_CONNECTION_SELECTION: InjectionToken<FConnectionSelectionBase>; declare abstract class FConnectionSelectionBase { readonly hostElement: any; abstract setPath(path: string): void; } declare class FConnectionSelection extends FConnectionSelectionBase { private readonly _connection; get connectionForSelectionId(): string; setPath(path: string): void; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionSelection, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FConnectionSelection, "path[fConnectionSelection]", never, {}, {}, never, never, false, never>; } declare const F_CONNECTION_DRAG_HANDLE_END: InjectionToken<FConnectionDragHandleBase>; declare const F_CONNECTION_DRAG_HANDLE_START: InjectionToken<FConnectionDragHandleBase>; declare abstract class FConnectionDragHandleBase { readonly hostElement: any; point: IPoint; protected readonly class = "f-connection-drag-handle"; abstract redraw(penultimatePoint: IPoint, startPoint: IPoint): void; protected calculateCircleCenter(start: IPoint, end: IPoint, radius: number): IPoint; } declare class FConnectionDragHandleStart extends FConnectionDragHandleBase { redraw(penultimatePoint: IPoint, startPoint: IPoint): void; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionDragHandleStart, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FConnectionDragHandleStart, "circle[f-connection-drag-handle-start]", never, {}, {}, never, never, false, never>; } declare class FConnectionDragHandleEnd extends FConnectionDragHandleBase { redraw(penultimatePoint: IPoint, endPoint: IPoint): void; static ɵfac: i0.ɵɵFactoryDeclaration<FConnectionDragHandleEnd, never>; static ɵcmp: i0.ɵɵComponentDeclaration<FConnectionDragHandleEnd, "circle[f-connection-drag-handle-end]", never, {}, {}, never, never, false, never>; } type Constructor<T> = new (...args: any[]) => T; type AbstractConstructor<T = object> = abstract new (...args: any[]) => T; interface ISelectable { fId: Signal<string>; fSelectionDisabled: Signal<boolean>; hostElement: HTMLElement | SVGElement; markAsSelected(): void; unmarkAsSelected(): void; isSelected(): boolean; markChildrenAsSelected?(): void; unmarkChildrenAsSelected?(): void; } declare const F_SELECTED_CLASS = "f-selected"; type CanChangeSelectionConstructor = Constructor<ISelectable> & AbstractConstructor<ISelectable>; declare function mixinChangeSelection<T extends AbstractConstructor<IHasHostElement>>(base: T): CanChangeSelectionConstructor & T; interface ICanChangeVisibility { hostElement: HTMLElement | SVGElement; show(): void; hide(): void; } type CanChangeVisibilityConstructor = Constructor<ICanChangeVisibility> & AbstractConstructor<ICanChangeVisibility>; declare function mixinChangeVisibility<T extends AbstractConstructor<IHasHostElement>>(base: T): CanChangeVisibilityConstructor & T; declare enum EFConnectionBehavior { FIXED = "fixed", FIXED_CENTER = "fixed_center", FLOATING = "floating" } declare enum EFConnectionConnectableSide { DEFAULT = "default", TOP = "top", BOTTOM = "bottom", LEFT = "left", RIGHT = "right", CALCULATE = "calculate", CALCULATE_HORIZONTAL = "calculate_horizontal", CALCULATE_VERTICAL = "calculate_vertical" } declare enum EFConnectableSide { LEFT = "left", TOP = "top", RIGHT = "right", BOTTOM = "bottom", CALCULATE = "calculate", CALCULATE_HORIZONTAL = "calculate_horizontal", CALCULATE_VERTICAL = "calculate_vertical", AUTO = "auto" } declare enum EFConnectionType { SEGMENT = "segment", STRAIGHT = "straight", BEZIER = "bezier", ADAPTIVE_CURVE = "adaptive-curve" } interface IConnectionEndpointRotationContext { rotationDeg: number; pivot: IPoint; } interface ICalculateBehaviorRequest { sourceRect: IRoundedRect; targetRect: IRoundedRect; sourceConnectableSide: EFConnectableSide; targetConnectableSide: EFConnectableSide; sourceRotationContext?: IConnectionEndpointRotationContext; targetRotationContext?: IConnectionEndpointRotationContext; } /** * Fixed center behavior calculates the connection line * It constructs a line between the gravity centers of the connector rectangles * @param payload */ declare function fixedCenterBehavior({ sourceRect, targetRect }: ICalculateBehaviorRequest): ILine; /** * Fixed outbound behavior calculates the connection line * It constructs a line between the specified sides of the output and input rectangles * @param payload */ declare function fixedOutboundBehavior({ sourceRect, sourceConnectableSide, targetRect, targetConnectableSide, }: ICalculateBehaviorRequest): ILine; /** * Floating behavior calculates the connection line * It constructs a line between the intersections of the connectors rectangles and line from the centers of the connector rectangles * @param payload */ declare function floatingBehavior({ sourceRect, targetRect, sourceRotationContext, targetRotationContext, }: ICalculateBehaviorRequest): ILine; declare const F_CONNECTION_COMPONENTS_PARENT: InjectionToken<FConnectionComponentsParent>; declare abstract class FConnectionComponentsParent { abstract fId: Signal<string>; abstract fOutputId: Signal<string>; abstract fInputId: Signal<string>; abstract fBehavior: EFConnectionBehavior; abstract _applyResolvedSidesToConnection(sourceSide: EFConnectableSide, targetSide: EFConnectableSide): void; abstract fInputSide: Signal<EFConnectionConnectableSide>; abstract fOutputSide: Signal<EFConnectionConnectableSide>; } declare class ConnectionBehaviourBuilderRequest { readonly sourceRect: IRoundedRect; readonly targetRect: IRoundedRect; readonly connection: FConnectionComponentsParent; readonly sourceConnectableSide: EFConnectableSide; readonly targetConnectableSide: EFConnectableSide; readonly sourceRotationContext?: IConnectionEndpointRotationContext | undefined; readonly targetRotationContext?: IConnectionEndpointRotationContext | undefined; constructor(sourceRect: IRoundedRect, targetRect: IRoundedRect, connection: FConnectionComponentsParent, sourceConnectableSide: EFConnectableSide, targetConnectableSide: EFConnectableSide, sourceRotationContext?: IConnectionEndpointRotationContext | undefined, targetRotationContext?: IConnectionEndpointRotationContext | undefined); } /** * Calculates connection lines based on behavior rules. * It determines which sides of the source and target should connect, * then delegates to a registered behavior handler. */ declare class ConnectionBehaviourBuil