feat(ui): add type filter toggles

This commit is contained in:
2026-02-18 23:13:28 -08:00
commit a4cff9894c
14457 changed files with 2204835 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import { HandleConnection } from '../types';
/**
* @internal
*/
export declare function areConnectionMapsEqual(a?: Map<string, HandleConnection>, b?: Map<string, HandleConnection>): boolean;
/**
* We call the callback for all connections in a that are not in b
*
* @internal
*/
export declare function handleConnectionChange(a: Map<string, HandleConnection>, b: Map<string, HandleConnection>, cb?: (diff: HandleConnection[]) => void): void;
export declare function getConnectionStatus(isValid: boolean | null): "valid" | "invalid" | null;
//# sourceMappingURL=connections.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../src/utils/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,WAoB1G;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAChC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAChC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,IAAI,QAiBxC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,8BAE1D"}

21
node_modules/@xyflow/system/dist/umd/utils/dom.d.ts generated vendored Normal file
View File

@@ -0,0 +1,21 @@
import type { Transform, XYPosition, SnapGrid, Dimensions, Handle } from '../types';
export type GetPointerPositionParams = {
transform: Transform;
snapGrid?: SnapGrid;
snapToGrid?: boolean;
containerBounds: DOMRect | null;
};
export declare function getPointerPosition(event: MouseEvent | TouchEvent, { snapGrid, snapToGrid, transform, containerBounds }: GetPointerPositionParams): XYPosition & {
xSnapped: number;
ySnapped: number;
};
export declare const getDimensions: (node: HTMLDivElement) => Dimensions;
export declare const getHostForElement: (element: HTMLElement | EventTarget | null) => Document | ShadowRoot;
export declare function isInputDOMNode(event: KeyboardEvent): boolean;
export declare const isMouseEvent: (event: MouseEvent | TouchEvent) => event is MouseEvent;
export declare const getEventPosition: (event: MouseEvent | TouchEvent, bounds?: DOMRect) => {
x: number;
y: number;
};
export declare const getHandleBounds: (type: "source" | "target", nodeElement: HTMLDivElement, nodeBounds: DOMRect, zoom: number, nodeId: string) => Handle[] | null;
//# sourceMappingURL=dom.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAY,MAAM,EAAE,MAAM,UAAU,CAAC;AAG9F,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,OAAO,GAAG,IAAI,CAAC;CACjC,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,UAAU,GAAG,UAAU,EAC9B,EAAE,QAAiB,EAAE,UAAkB,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE,wBAAwB,GAC9F,UAAU,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAcrD;AAED,eAAO,MAAM,aAAa,SAAU,cAAc,KAAG,UAGnD,CAAC;AAEH,eAAO,MAAM,iBAAiB,YAAa,WAAW,GAAG,WAAW,GAAG,IAAI,KAAG,QAAQ,GAAG,UACiB,CAAC;AAI3G,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAQ5D;AAED,eAAO,MAAM,YAAY,UAAW,UAAU,GAAG,UAAU,KAAG,KAAK,IAAI,UAAgC,CAAC;AAExG,eAAO,MAAM,gBAAgB,UAAW,UAAU,GAAG,UAAU,WAAW,OAAO;;;CAShF,CAAC;AAOF,eAAO,MAAM,eAAe,SACpB,QAAQ,GAAG,QAAQ,eACZ,cAAc,cACf,OAAO,QACb,MAAM,UACJ,MAAM,KACb,MAAM,EAAE,GAAG,IAoBb,CAAC"}

View File

@@ -0,0 +1,2 @@
export declare function getEdgeToolbarTransform(x: number, y: number, zoom: number, alignX?: 'left' | 'center' | 'right', alignY?: 'top' | 'center' | 'bottom'): string;
//# sourceMappingURL=edge-toolbar.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"edge-toolbar.d.ts","sourceRoot":"","sources":["../../src/utils/edge-toolbar.ts"],"names":[],"mappings":"AAYA,wBAAgB,uBAAuB,CACrC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,MAAM,GAAG,QAAQ,GAAG,OAAkB,EAC9C,MAAM,GAAE,KAAK,GAAG,QAAQ,GAAG,QAAmB,GAC7C,MAAM,CAIR"}

View File

@@ -0,0 +1,77 @@
import { Position } from '../../types';
export type GetBezierPathParams = {
/** The `x` position of the source handle. */
sourceX: number;
/** The `y` position of the source handle. */
sourceY: number;
/**
* The position of the source handle.
* @default Position.Bottom
*/
sourcePosition?: Position;
/** The `x` position of the target handle. */
targetX: number;
/** The `y` position of the target handle. */
targetY: number;
/**
* The position of the target handle.
* @default Position.Top
*/
targetPosition?: Position;
/**
* The curvature of the bezier edge.
* @default 0.25
*/
curvature?: number;
};
export type GetControlWithCurvatureParams = {
pos: Position;
x1: number;
y1: number;
x2: number;
y2: number;
c: number;
};
export declare function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY, }: {
sourceX: number;
sourceY: number;
targetX: number;
targetY: number;
sourceControlX: number;
sourceControlY: number;
targetControlX: number;
targetControlY: number;
}): [number, number, number, number];
/**
* The `getBezierPath` util returns everything you need to render a bezier edge
*between two nodes.
* @public
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
* and `offsetX`, `offsetY` between source handle and label.
* - `path`: the path to use in an SVG `<path>` element.
* - `labelX`: the `x` position you can use to render a label for this edge.
* - `labelY`: the `y` position you can use to render a label for this edge.
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
* middle of this path.
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
* middle of this path.
* @example
* ```js
* const source = { x: 0, y: 20 };
* const target = { x: 150, y: 100 };
*
* const [path, labelX, labelY, offsetX, offsetY] = getBezierPath({
* sourceX: source.x,
* sourceY: source.y,
* sourcePosition: Position.Right,
* targetX: target.x,
* targetY: target.y,
* targetPosition: Position.Left,
*});
*```
*
* @remarks This function returns a tuple (aka a fixed-size array) to make it easier to
*work with multiple edge paths at once.
*/
export declare function getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, curvature, }: GetBezierPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
//# sourceMappingURL=bezier-edge.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"bezier-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/bezier-edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,MAAM,MAAM,mBAAmB,GAAG;IAChC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,EAAE,QAAQ,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,GACf,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAWnC;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,SAAgB,GACjB,EAAE,mBAAmB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAmCxG"}

View File

@@ -0,0 +1,91 @@
import { Connection, InternalNodeBase, Transform, EdgeBase, ZIndexMode } from '../..';
export declare function getEdgeCenter({ sourceX, sourceY, targetX, targetY, }: {
sourceX: number;
sourceY: number;
targetX: number;
targetY: number;
}): [number, number, number, number];
export type GetEdgeZIndexParams = {
sourceNode: InternalNodeBase;
targetNode: InternalNodeBase;
selected?: boolean;
zIndex?: number;
elevateOnSelect?: boolean;
zIndexMode?: ZIndexMode;
};
/**
* Returns the z-index for an edge based on the node it connects and whether it is selected.
* By default, edges are rendered below nodes. This behaviour is different for edges that are
* connected to nodes with a parent, as they are rendered above the parent node.
*/
export declare function getElevatedEdgeZIndex({ sourceNode, targetNode, selected, zIndex, elevateOnSelect, zIndexMode, }: GetEdgeZIndexParams): number;
type IsEdgeVisibleParams = {
sourceNode: InternalNodeBase;
targetNode: InternalNodeBase;
width: number;
height: number;
transform: Transform;
};
export declare function isEdgeVisible({ sourceNode, targetNode, width, height, transform }: IsEdgeVisibleParams): boolean;
/**
* Type for a custom edge ID generator function.
* @public
*/
export type GetEdgeId = (params: Connection | EdgeBase) => string;
/**
* The default edge ID generator function. Generates an ID based on the source, target, and handles.
* @public
* @param params - The connection or edge to generate an ID for.
* @returns The generated edge ID.
*/
export declare const getEdgeId: ({ source, sourceHandle, target, targetHandle }: Connection | EdgeBase) => string;
export type AddEdgeOptions = {
/**
* Custom function to generate edge IDs. If not provided, the default `getEdgeId` function is used.
*/
getEdgeId?: GetEdgeId;
};
/**
* This util is a convenience function to add a new Edge to an array of edges. It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
* @public
* @param edgeParams - Either an `Edge` or a `Connection` you want to add.
* @param edges - The array of all current edges.
* @param options - Optional configuration object.
* @returns A new array of edges with the new edge added.
*
* @remarks If an edge with the same `target` and `source` already exists (and the same
*`targetHandle` and `sourceHandle` if those are set), then this util won't add
*a new edge even if the `id` property is different.
*
*/
export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[], options?: AddEdgeOptions) => EdgeType[];
export type ReconnectEdgeOptions = {
/**
* Should the id of the old edge be replaced with the new connection id.
* @default true
*/
shouldReplaceId?: boolean;
/**
* Custom function to generate edge IDs. If not provided, the default `getEdgeId` function is used.
*/
getEdgeId?: GetEdgeId;
};
/**
* A handy utility to update an existing [`Edge`](/api-reference/types/edge) with new properties.
*This searches your edge array for an edge with a matching `id` and updates its
*properties with the connection you provide.
* @public
* @param oldEdge - The edge you want to update.
* @param newConnection - The new connection you want to update the edge with.
* @param edges - The array of all current edges.
* @returns The updated edges array.
*
* @example
* ```js
*const onReconnect = useCallback(
* (oldEdge: Edge, newConnection: Connection) => setEdges((els) => reconnectEdge(oldEdge, newConnection, els)),[]);
*```
*/
export declare const reconnectEdge: <EdgeType extends EdgeBase>(oldEdge: EdgeType, newConnection: Connection, edges: EdgeType[], options?: ReconnectEdgeOptions) => EdgeType[];
export {};
//# sourceMappingURL=general.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/general.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAA6B,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAIjH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,GACR,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAQnC;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACV,UAAU,EACV,QAAgB,EAChB,MAAU,EACV,eAAuB,EACvB,UAAoB,GACrB,EAAE,mBAAmB,GAAG,MAAM,CAY9B;AAED,KAAK,mBAAmB,GAAG;IACzB,UAAU,EAAE,gBAAgB,CAAC;IAC7B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,mBAAmB,GAAG,OAAO,CAmBhH;AAED;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,UAAU,GAAG,QAAQ,KAAK,MAAM,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,SAAS,mDAAoD,UAAU,GAAG,QAAQ,KAAG,MACxB,CAAC;AAY3E,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,SAAS,QAAQ,cACnC,QAAQ,GAAG,UAAU,SAC1B,QAAQ,EAAE,YACR,cAAc,KACtB,QAAQ,EAgCV,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,QAAQ,WAC5C,QAAQ,iBACF,UAAU,SAClB,QAAQ,EAAE,YACR,oBAAoB,KAC5B,QAAQ,EA8BV,CAAC"}

View File

@@ -0,0 +1,6 @@
export * from './bezier-edge';
export * from './straight-edge';
export * from './smoothstep-edge';
export * from './general';
export * from './positions';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}

View File

@@ -0,0 +1,17 @@
import { EdgePosition } from '../../types/edges';
import { ConnectionMode, OnError } from '../../types/general';
import { InternalNodeBase } from '../../types/nodes';
import { Position, XYPosition } from '../../types/utils';
import { Handle } from '../../types';
export type GetEdgePositionParams = {
id: string;
sourceNode: InternalNodeBase;
sourceHandle: string | null;
targetNode: InternalNodeBase;
targetHandle: string | null;
connectionMode: ConnectionMode;
onError?: OnError;
};
export declare function getEdgePosition(params: GetEdgePositionParams): EdgePosition | null;
export declare function getHandlePosition(node: InternalNodeBase, handle: Handle | null, fallbackPosition?: Position, center?: boolean): XYPosition;
//# sourceMappingURL=positions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"positions.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/positions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAc,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAUF,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,YAAY,GAAG,IAAI,CA6ClF;AA2BD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,gBAAgB,GAAE,QAAwB,EAC1C,MAAM,UAAQ,GACb,UAAU,CAqBZ"}

View File

@@ -0,0 +1,66 @@
import { Position } from '../../types';
export interface GetSmoothStepPathParams {
/** The `x` position of the source handle. */
sourceX: number;
/** The `y` position of the source handle. */
sourceY: number;
/**
* The position of the source handle.
* @default Position.Bottom
*/
sourcePosition?: Position;
/** The `x` position of the target handle. */
targetX: number;
/** The `y` position of the target handle. */
targetY: number;
/**
* The position of the target handle.
* @default Position.Top
*/
targetPosition?: Position;
/** @default 5 */
borderRadius?: number;
centerX?: number;
centerY?: number;
/** @default 20 */
offset?: number;
/**
* Controls where the bend occurs along the path.
* 0 = at source, 1 = at target, 0.5 = midpoint
* @default 0.5
*/
stepPosition?: number;
}
/**
* The `getSmoothStepPath` util returns everything you need to render a stepped path
* between two nodes. The `borderRadius` property can be used to choose how rounded
* the corners of those steps are.
* @public
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
* and `offsetX`, `offsetY` between source handle and label.
*
* - `path`: the path to use in an SVG `<path>` element.
* - `labelX`: the `x` position you can use to render a label for this edge.
* - `labelY`: the `y` position you can use to render a label for this edge.
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
* middle of this path.
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
* middle of this path.
* @example
* ```js
* const source = { x: 0, y: 20 };
* const target = { x: 150, y: 100 };
*
* const [path, labelX, labelY, offsetX, offsetY] = getSmoothStepPath({
* sourceX: source.x,
* sourceY: source.y,
* sourcePosition: Position.Right,
* targetX: target.x,
* targetY: target.y,
* targetPosition: Position.Left,
* });
* ```
* @remarks This function returns a tuple (aka a fixed-size array) to make it easier to work with multiple edge paths at once.
*/
export declare function getSmoothStepPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, borderRadius, centerX, centerY, offset, stepPosition, }: GetSmoothStepPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
//# sourceMappingURL=smoothstep-edge.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"smoothstep-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/smoothstep-edge.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAmB,MAAM,aAAa,CAAC;AAExD,MAAM,WAAW,uBAAuB;IACtC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,iBAAiB;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAkMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,YAAgB,EAChB,OAAO,EACP,OAAO,EACP,MAAW,EACX,YAAkB,GACnB,EAAE,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CA0B5G"}

View File

@@ -0,0 +1,41 @@
export type GetStraightPathParams = {
/** The `x` position of the source handle. */
sourceX: number;
/** The `y` position of the source handle. */
sourceY: number;
/** The `x` position of the target handle. */
targetX: number;
/** The `y` position of the target handle. */
targetY: number;
};
/**
* Calculates the straight line path between two points.
* @public
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
* and `offsetX`, `offsetY` between source handle and label.
*
* - `path`: the path to use in an SVG `<path>` element.
* - `labelX`: the `x` position you can use to render a label for this edge.
* - `labelY`: the `y` position you can use to render a label for this edge.
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
* middle of this path.
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
* middle of this path.
* @example
* ```js
* const source = { x: 0, y: 20 };
* const target = { x: 150, y: 100 };
*
* const [path, labelX, labelY, offsetX, offsetY] = getStraightPath({
* sourceX: source.x,
* sourceY: source.y,
* sourcePosition: Position.Right,
* targetX: target.x,
* targetY: target.y,
* targetPosition: Position.Left,
* });
* ```
* @remarks This function returns a tuple (aka a fixed-size array) to make it easier to work with multiple edge paths at once.
*/
export declare function getStraightPath({ sourceX, sourceY, targetX, targetY, }: GetStraightPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
//# sourceMappingURL=straight-edge.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"straight-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/straight-edge.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAAG;IAClC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,eAAe,CAAC,EAC9B,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,GACR,EAAE,qBAAqB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAS1G"}

View File

@@ -0,0 +1,85 @@
import type { Dimensions, XYPosition, CoordinateExtent, Box, Rect, NodeBase, NodeOrigin, SnapGrid, Transform, InternalNodeBase, NodeLookup, Padding } from '../types';
import { type Viewport } from '../types';
import { type AriaLabelConfig } from '../constants';
export declare const clamp: (val: number, min?: number, max?: number) => number;
export declare const clampPosition: (position: XYPosition | undefined, extent: CoordinateExtent, dimensions: Partial<Dimensions>) => {
x: number;
y: number;
};
export declare function clampPositionToParent<NodeType extends NodeBase>(childPosition: XYPosition, childDimensions: Dimensions, parent: InternalNodeBase<NodeType>): {
x: number;
y: number;
};
export declare const calcAutoPan: (pos: XYPosition, bounds: Dimensions, speed?: number, distance?: number) => number[];
export declare const getBoundsOfBoxes: (box1: Box, box2: Box) => Box;
export declare const rectToBox: ({ x, y, width, height }: Rect) => Box;
export declare const boxToRect: ({ x, y, x2, y2 }: Box) => Rect;
export declare const nodeToRect: (node: InternalNodeBase | NodeBase, nodeOrigin?: NodeOrigin) => Rect;
export declare const nodeToBox: (node: InternalNodeBase | NodeBase, nodeOrigin?: NodeOrigin) => Box;
export declare const getBoundsOfRects: (rect1: Rect, rect2: Rect) => Rect;
export declare const getOverlappingArea: (rectA: Rect, rectB: Rect) => number;
export declare const isRectObject: (obj: any) => obj is Rect;
export declare const isNumeric: (n: any) => n is number;
export declare const devWarn: (id: string, message: string) => void;
export declare const snapPosition: (position: XYPosition, snapGrid?: SnapGrid) => XYPosition;
export declare const pointToRendererPoint: ({ x, y }: XYPosition, [tx, ty, tScale]: Transform, snapToGrid?: boolean, snapGrid?: SnapGrid) => XYPosition;
export declare const rendererPointToPoint: ({ x, y }: XYPosition, [tx, ty, tScale]: Transform) => XYPosition;
/**
* Returns a viewport that encloses the given bounds with padding.
* @public
* @remarks You can determine bounds of nodes with {@link getNodesBounds} and {@link getBoundsOfRects}
* @param bounds - Bounds to fit inside viewport.
* @param width - Width of the viewport.
* @param height - Height of the viewport.
* @param minZoom - Minimum zoom level of the resulting viewport.
* @param maxZoom - Maximum zoom level of the resulting viewport.
* @param padding - Padding around the bounds.
* @returns A transformed {@link Viewport} that encloses the given bounds which you can pass to e.g. {@link setViewport}.
* @example
* const { x, y, zoom } = getViewportForBounds(
* { x: 0, y: 0, width: 100, height: 100},
* 1200, 800, 0.5, 2);
*/
export declare const getViewportForBounds: (bounds: Rect, width: number, height: number, minZoom: number, maxZoom: number, padding: Padding) => Viewport;
export declare const isMacOs: () => boolean;
export declare function isCoordinateExtent(extent?: CoordinateExtent | 'parent' | null): extent is CoordinateExtent;
export declare function getNodeDimensions(node: {
measured?: {
width?: number;
height?: number;
};
width?: number;
height?: number;
initialWidth?: number;
initialHeight?: number;
}): {
width: number;
height: number;
};
export declare function nodeHasDimensions<NodeType extends NodeBase = NodeBase>(node: NodeType): boolean;
/**
* Convert child position to aboslute position
*
* @internal
* @param position
* @param parentId
* @param nodeLookup
* @param nodeOrigin
* @returns an internal node with an absolute position
*/
export declare function evaluateAbsolutePosition(position: XYPosition, dimensions: {
width?: number;
height?: number;
} | undefined, parentId: string, nodeLookup: NodeLookup, nodeOrigin: NodeOrigin): XYPosition;
export declare function areSetsEqual(a: Set<string>, b: Set<string>): boolean;
/**
* Polyfill for Promise.withResolvers until we can use it in all browsers
* @internal
*/
export declare function withResolvers<T>(): {
promise: Promise<T>;
resolve: (value: T | PromiseLike<T>) => void;
reject: (reason?: unknown) => void;
};
export declare function mergeAriaLabelConfig(partial?: Partial<AriaLabelConfig>): AriaLabelConfig;
//# sourceMappingURL=general.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/utils/general.ts"],"names":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pB,UAAU,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,YAA0B,EACzE,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,UAAU,GACrB,UAAU,CAWZ;AAED,wBAAgB,YAAY,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,WAY1D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,KAAK;IAClC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IAC7C,MAAM,EAAE,CAAC,MAAM,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC,CASA;AAED,wBAAgB,oBAAoB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,eAAe,CAExF"}

191
node_modules/@xyflow/system/dist/umd/utils/graph.d.ts generated vendored Normal file
View File

@@ -0,0 +1,191 @@
import { type Transform, type XYPosition, type Rect, type NodeOrigin, type NodeBase, type EdgeBase, type FitViewParamsBase, type FitViewOptionsBase, CoordinateExtent, OnError, OnBeforeDeleteBase, NodeLookup, InternalNodeBase, NodeDragItem } from '../types';
/**
* Test whether an object is usable as an Edge
* @public
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Edge if it returns true
* @param element - The element to test
* @returns A boolean indicating whether the element is an Edge
*/
export declare const isEdgeBase: <EdgeType extends EdgeBase = EdgeBase>(element: any) => element is EdgeType;
/**
* Test whether an object is usable as a Node
* @public
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true
* @param element - The element to test
* @returns A boolean indicating whether the element is an Node
*/
export declare const isNodeBase: <NodeType extends NodeBase = NodeBase>(element: any) => element is NodeType;
export declare const isInternalNodeBase: <NodeType extends InternalNodeBase = InternalNodeBase>(element: any) => element is NodeType;
/**
* This util is used to tell you what nodes, if any, are connected to the given node
* as the _target_ of an edge.
* @public
* @param node - The node to get the connected nodes from.
* @param nodes - The array of all nodes.
* @param edges - The array of all edges.
* @returns An array of nodes that are connected over edges where the source is the given node.
*
* @example
* ```ts
*import { getOutgoers } from '@xyflow/react';
*
*const nodes = [];
*const edges = [];
*
*const outgoers = getOutgoers(
* { id: '1', position: { x: 0, y: 0 }, data: { label: 'node' } },
* nodes,
* edges,
*);
*```
*/
export declare const getOutgoers: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(node: NodeType | {
id: string;
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[];
/**
* This util is used to tell you what nodes, if any, are connected to the given node
* as the _source_ of an edge.
* @public
* @param node - The node to get the connected nodes from.
* @param nodes - The array of all nodes.
* @param edges - The array of all edges.
* @returns An array of nodes that are connected over edges where the target is the given node.
*
* @example
* ```ts
*import { getIncomers } from '@xyflow/react';
*
*const nodes = [];
*const edges = [];
*
*const incomers = getIncomers(
* { id: '1', position: { x: 0, y: 0 }, data: { label: 'node' } },
* nodes,
* edges,
*);
*```
*/
export declare const getIncomers: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(node: NodeType | {
id: string;
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[];
export declare const getNodePositionWithOrigin: (node: NodeBase, nodeOrigin?: NodeOrigin) => XYPosition;
export type GetNodesBoundsParams<NodeType extends NodeBase = NodeBase> = {
/**
* Origin of the nodes: `[0, 0]` for top-left, `[0.5, 0.5]` for center.
* @default [0, 0]
*/
nodeOrigin?: NodeOrigin;
nodeLookup?: NodeLookup<InternalNodeBase<NodeType>>;
};
/**
* Returns the bounding box that contains all the given nodes in an array. This can
* be useful when combined with [`getViewportForBounds`](/api-reference/utils/get-viewport-for-bounds)
* to calculate the correct transform to fit the given nodes in a viewport.
* @public
* @remarks Useful when combined with {@link getViewportForBounds} to calculate the correct transform to fit the given nodes in a viewport.
* @param nodes - Nodes to calculate the bounds for.
* @returns Bounding box enclosing all nodes.
*
* @remarks This function was previously called `getRectOfNodes`
*
* @example
* ```js
*import { getNodesBounds } from '@xyflow/react';
*
*const nodes = [
* {
* id: 'a',
* position: { x: 0, y: 0 },
* data: { label: 'a' },
* width: 50,
* height: 25,
* },
* {
* id: 'b',
* position: { x: 100, y: 100 },
* data: { label: 'b' },
* width: 50,
* height: 25,
* },
*];
*
*const bounds = getNodesBounds(nodes);
*```
*/
export declare const getNodesBounds: <NodeType extends NodeBase = NodeBase>(nodes: (NodeType | InternalNodeBase<NodeType> | string)[], params?: GetNodesBoundsParams<NodeType>) => Rect;
export type GetInternalNodesBoundsParams<NodeType> = {
useRelativePosition?: boolean;
filter?: (node: NodeType) => boolean;
};
/**
* Determines a bounding box that contains all given nodes in an array
* @internal
*/
export declare const getInternalNodesBounds: <NodeType extends InternalNodeBase | NodeDragItem>(nodeLookup: Map<string, NodeType>, params?: GetInternalNodesBoundsParams<NodeType>) => Rect;
export declare const getNodesInside: <NodeType extends NodeBase = NodeBase>(nodes: Map<string, InternalNodeBase<NodeType>>, rect: Rect, [tx, ty, tScale]?: Transform, partially?: boolean, excludeNonSelectableNodes?: boolean) => InternalNodeBase<NodeType>[];
/**
* This utility filters an array of edges, keeping only those where either the source or target
* node is present in the given array of nodes.
* @public
* @param nodes - Nodes you want to get the connected edges for.
* @param edges - All edges.
* @returns Array of edges that connect any of the given nodes with each other.
*
* @example
* ```js
*import { getConnectedEdges } from '@xyflow/react';
*
*const nodes = [
* { id: 'a', position: { x: 0, y: 0 } },
* { id: 'b', position: { x: 100, y: 0 } },
*];
*
*const edges = [
* { id: 'a->c', source: 'a', target: 'c' },
* { id: 'c->d', source: 'c', target: 'd' },
*];
*
*const connectedEdges = getConnectedEdges(nodes, edges);
* // => [{ id: 'a->c', source: 'a', target: 'c' }]
*```
*/
export declare const getConnectedEdges: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(nodes: NodeType[], edges: EdgeType[]) => EdgeType[];
export declare function fitViewport<Params extends FitViewParamsBase<NodeBase>, Options extends FitViewOptionsBase<NodeBase>>({ nodes, width, height, panZoom, minZoom, maxZoom }: Params, options?: Omit<Options, 'nodes' | 'includeHiddenNodes'>): Promise<boolean>;
/**
* This function calculates the next position of a node, taking into account the node's extent, parent node, and origin.
*
* @internal
* @returns position, positionAbsolute
*/
export declare function calculateNodePosition<NodeType extends NodeBase>({ nodeId, nextPosition, nodeLookup, nodeOrigin, nodeExtent, onError, }: {
nodeId: string;
nextPosition: XYPosition;
nodeLookup: NodeLookup<InternalNodeBase<NodeType>>;
nodeOrigin?: NodeOrigin;
nodeExtent?: CoordinateExtent;
onError?: OnError;
}): {
position: XYPosition;
positionAbsolute: XYPosition;
};
/**
* Pass in nodes & edges to delete, get arrays of nodes and edges that actually can be deleted
* @internal
* @param param.nodesToRemove - The nodes to remove
* @param param.edgesToRemove - The edges to remove
* @param param.nodes - All nodes
* @param param.edges - All edges
* @param param.onBeforeDelete - Callback to check which nodes and edges can be deleted
* @returns nodes: nodes that can be deleted, edges: edges that can be deleted
*/
export declare function getElementsToRemove<NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>({ nodesToRemove, edgesToRemove, nodes, edges, onBeforeDelete, }: {
nodesToRemove: Partial<NodeType>[];
edgesToRemove: Partial<EdgeType>[];
nodes: NodeType[];
edges: EdgeType[];
onBeforeDelete?: OnBeforeDeleteBase<NodeType, EdgeType>;
}): Promise<{
nodes: NodeType[];
edges: EdgeType[];
}>;
//# sourceMappingURL=graph.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/utils/graph.ts"],"names":[],"mappings":"AAaA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,QAAQ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O,CAAC,OAAO,CAAC,CAyBlB;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,QAAQ,EAAE,EAC/D,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAmB,EACnB,UAAU,EACV,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,UAAU,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG;IAAE,QAAQ,EAAE,UAAU,CAAC;IAAC,gBAAgB,EAAE,UAAU,CAAA;CAAE,CA4CzD;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,EAAE,QAAQ,SAAS,QAAQ,GAAG,QAAQ,EAAE,EACpH,aAAkB,EAClB,aAAkB,EAClB,KAAK,EACL,KAAK,EACL,cAAc,GACf,EAAE;IACD,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,cAAc,CAAC,EAAE,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;CACzD,GAAG,OAAO,CAAC;IACV,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC,CA+CD"}

12
node_modules/@xyflow/system/dist/umd/utils/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,12 @@
export * from './connections';
export * from './dom';
export * from './edges';
export * from './graph';
export * from './general';
export * from './marker';
export * from './node-toolbar';
export * from './edge-toolbar';
export * from './store';
export * from './types';
export * from './shallow-node-data';
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC"}

View File

@@ -0,0 +1,9 @@
import type { EdgeBase, EdgeMarkerType, MarkerProps } from '../types';
export declare function getMarkerId(marker: EdgeMarkerType | undefined, id?: string | null): string;
export declare function createMarkerIds(edges: EdgeBase[], { id, defaultColor, defaultMarkerStart, defaultMarkerEnd, }: {
id?: string | null;
defaultColor?: string | null;
defaultMarkerStart?: EdgeMarkerType;
defaultMarkerEnd?: EdgeMarkerType;
}): MarkerProps[];
//# sourceMappingURL=marker.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"marker.d.ts","sourceRoot":"","sources":["../../src/utils/marker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAc,cAAc,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAElF,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,SAAS,EAAE,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAe1F;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,QAAQ,EAAE,EACjB,EACE,EAAE,EACF,YAAY,EACZ,kBAAkB,EAClB,gBAAgB,GACjB,EAAE;IACD,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACnC,iBAmBF"}

View File

@@ -0,0 +1,3 @@
import { Position, type Rect, type Viewport, type Align } from '../';
export declare function getNodeToolbarTransform(nodeRect: Rect, viewport: Viewport, position: Position, offset: number, align: Align): string;
//# sourceMappingURL=node-toolbar.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"node-toolbar.d.ts","sourceRoot":"","sources":["../../src/utils/node-toolbar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,IAAI,EAAE,KAAK,QAAQ,EAAE,KAAK,KAAK,EAAE,MAAM,KAAK,CAAC;AAErE,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,IAAI,EACd,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,GACX,MAAM,CA0CR"}

View File

@@ -0,0 +1,5 @@
import { NodeBase } from '../types';
type NodeData = Pick<NodeBase, 'id' | 'type' | 'data'>;
export declare function shallowNodeData(a: NodeData | NodeData[] | null, b: NodeData | NodeData[] | null): boolean;
export {};
//# sourceMappingURL=shallow-node-data.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"shallow-node-data.d.ts","sourceRoot":"","sources":["../../src/utils/shallow-node-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,KAAK,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,CAAC;AAEvD,wBAAgB,eAAe,CAAC,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE,QAAQ,GAAG,QAAQ,EAAE,GAAG,IAAI,WAmB/F"}

30
node_modules/@xyflow/system/dist/umd/utils/store.d.ts generated vendored Normal file
View File

@@ -0,0 +1,30 @@
import { ZIndexMode } from '..';
import { NodeBase, CoordinateExtent, InternalNodeUpdate, NodeOrigin, PanZoomInstance, Transform, XYPosition, ConnectionLookup, EdgeBase, EdgeLookup, InternalNodeBase, NodeLookup, NodeDimensionChange, NodePositionChange, ParentLookup } from '../types';
import { ParentExpandChild } from './types';
export declare function updateAbsolutePositions<NodeType extends NodeBase>(nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): void;
type UpdateNodesOptions<NodeType extends NodeBase> = {
nodeOrigin?: NodeOrigin;
nodeExtent?: CoordinateExtent;
elevateNodesOnSelect?: boolean;
defaults?: Partial<NodeType>;
zIndexMode?: ZIndexMode;
checkEquality?: boolean;
};
export declare function isManualZIndexMode(zIndexMode?: ZIndexMode): boolean;
export declare function adoptUserNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): boolean;
export declare function handleExpandParent(children: ParentExpandChild[], nodeLookup: NodeLookup, parentLookup: ParentLookup, nodeOrigin?: NodeOrigin): (NodeDimensionChange | NodePositionChange)[];
export declare function updateNodeInternals<NodeType extends InternalNodeBase>(updates: Map<string, InternalNodeUpdate>, nodeLookup: NodeLookup<NodeType>, parentLookup: ParentLookup<NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin, nodeExtent?: CoordinateExtent, zIndexMode?: ZIndexMode): {
changes: (NodeDimensionChange | NodePositionChange)[];
updatedInternals: boolean;
};
export declare function panBy({ delta, panZoom, transform, translateExtent, width, height, }: {
delta: XYPosition;
panZoom: PanZoomInstance | null;
transform: Transform;
translateExtent: CoordinateExtent;
width: number;
height: number;
}): Promise<boolean>;
export declare function updateConnectionLookup(connectionLookup: ConnectionLookup, edgeLookup: EdgeLookup, edges: EdgeBase[]): void;
export {};
//# sourceMappingURL=store.d.ts.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>, K> & Omit<T, K>;
export type ParentExpandChild = {
id: string;
parentId: string;
rect: Rect;
};
//# sourceMappingURL=types.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE9E,MAAM,MAAM,iBAAiB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC"}