@xyflow/system
Advanced tools
Comparing version 0.0.21 to 0.0.22
@@ -20,5 +20,4 @@ import { CoordinateExtent, HandleType } from './types'; | ||
}; | ||
export declare const internalsSymbol: unique symbol; | ||
export declare const infiniteExtent: CoordinateExtent; | ||
export declare const elementSelectionKeys: string[]; | ||
//# sourceMappingURL=constants.d.ts.map |
import type { D3DragEvent, Selection as D3Selection, SubjectPosition, ZoomBehavior } from 'd3'; | ||
import type { XYPosition, Rect } from './utils'; | ||
import type { NodeBase, NodeDragItem, NodeOrigin } from './nodes'; | ||
import type { InternalNodeBase, NodeBase, NodeDragItem, NodeOrigin } from './nodes'; | ||
import type { ConnectingHandle, HandleType } from './handles'; | ||
@@ -42,3 +42,3 @@ import { PanZoomInstance } from './panzoom'; | ||
export type FitViewParamsBase<NodeType extends NodeBase> = { | ||
nodes: NodeType[]; | ||
nodeLookup: Map<string, InternalNodeBase<NodeType>>; | ||
width: number; | ||
@@ -102,3 +102,3 @@ height: number; | ||
export type OnError = (id: string, message: string) => void; | ||
export type UpdateNodePositions = (dragItems: NodeDragItem[] | NodeBase[], dragging?: boolean) => void; | ||
export type UpdateNodePositions = (dragItems: NodeDragItem[] | InternalNodeBase[], dragging?: boolean) => void; | ||
export type PanBy = (delta: XYPosition) => boolean; | ||
@@ -105,0 +105,0 @@ export type UpdateConnection = (params: { |
@@ -0,1 +1,2 @@ | ||
export * from './changes'; | ||
export * from './general'; | ||
@@ -2,0 +3,0 @@ export * from './nodes'; |
@@ -1,2 +0,1 @@ | ||
import { internalsSymbol } from '../constants'; | ||
import type { XYPosition, Position, CoordinateExtent, HandleElement } from '.'; | ||
@@ -43,3 +42,3 @@ import { Optional } from '../utils/types'; | ||
/** Parent node id, used for creating sub-flows */ | ||
parentNode?: string; | ||
parentId?: string; | ||
zIndex?: number; | ||
@@ -60,15 +59,20 @@ /** Boundary a node can be moved in | ||
handles?: NodeHandle[]; | ||
computed?: { | ||
measured?: { | ||
width?: number; | ||
height?: number; | ||
positionAbsolute?: XYPosition; | ||
}; | ||
[internalsSymbol]?: { | ||
z?: number; | ||
}; | ||
export type InternalNodeBase<NodeType extends NodeBase = NodeBase> = NodeType & { | ||
measured: { | ||
width?: number; | ||
height?: number; | ||
}; | ||
internals: { | ||
positionAbsolute: XYPosition; | ||
z: number; | ||
isParent: boolean; | ||
/** Holds a reference to the original node object provided by the user. | ||
* Used as an optimization to avoid certain operations. */ | ||
userNode: NodeType; | ||
handleBounds?: NodeHandleBounds; | ||
isParent?: boolean; | ||
/** Holds a reference to the original node object provided by the user | ||
* (which may lack some fields, like `computed` or `[internalSymbol]`. Used | ||
* as an optimization to avoid certain operations. */ | ||
userProvidedNode: NodeBase<NodeData, NodeType>; | ||
}; | ||
@@ -96,3 +100,3 @@ }; | ||
nodeElement: HTMLDivElement; | ||
forceUpdate?: boolean; | ||
force?: boolean; | ||
}; | ||
@@ -107,9 +111,11 @@ export type NodeBounds = XYPosition & { | ||
distance: XYPosition; | ||
computed: { | ||
measured: { | ||
width: number | null; | ||
height: number | null; | ||
}; | ||
internals: { | ||
positionAbsolute: XYPosition; | ||
}; | ||
extent?: 'parent' | CoordinateExtent; | ||
parentNode?: string; | ||
parentId?: string; | ||
dragging?: boolean; | ||
@@ -123,3 +129,3 @@ origin?: NodeOrigin; | ||
export type Align = 'center' | 'start' | 'end'; | ||
export type NodeLookup<NodeType extends NodeBase = NodeBase> = Map<string, NodeType>; | ||
export type NodeLookup<NodeType extends InternalNodeBase = InternalNodeBase> = Map<string, NodeType>; | ||
//# sourceMappingURL=nodes.d.ts.map |
@@ -1,3 +0,2 @@ | ||
import { Connection, Transform } from '../..'; | ||
import { EdgeBase, NodeBase } from '../../types'; | ||
import { Connection, InternalNodeBase, Transform, EdgeBase } from '../..'; | ||
export declare function getEdgeCenter({ sourceX, sourceY, targetX, targetY, }: { | ||
@@ -10,4 +9,4 @@ sourceX: number; | ||
export type GetEdgeZIndexParams = { | ||
sourceNode: NodeBase; | ||
targetNode: NodeBase; | ||
sourceNode: InternalNodeBase; | ||
targetNode: InternalNodeBase; | ||
selected?: boolean; | ||
@@ -19,4 +18,4 @@ zIndex?: number; | ||
type IsEdgeVisibleParams = { | ||
sourceNode: NodeBase; | ||
targetNode: NodeBase; | ||
sourceNode: InternalNodeBase; | ||
targetNode: InternalNodeBase; | ||
width: number; | ||
@@ -23,0 +22,0 @@ height: number; |
import { EdgePosition } from '../../types/edges'; | ||
import { ConnectionMode, OnError } from '../../types/general'; | ||
import { NodeBase } from '../../types/nodes'; | ||
import { InternalNodeBase } from '../../types/nodes'; | ||
export type GetEdgePositionParams = { | ||
id: string; | ||
sourceNode: NodeBase; | ||
sourceNode: InternalNodeBase; | ||
sourceHandle: string | null; | ||
targetNode: NodeBase; | ||
targetNode: InternalNodeBase; | ||
targetHandle: string | null; | ||
@@ -10,0 +10,0 @@ connectionMode: ConnectionMode; |
@@ -1,2 +0,2 @@ | ||
import type { Dimensions, XYPosition, CoordinateExtent, Box, Rect, NodeBase, NodeOrigin, SnapGrid, Transform } from '../types'; | ||
import type { Dimensions, XYPosition, CoordinateExtent, Box, Rect, NodeBase, NodeOrigin, SnapGrid, Transform, InternalNodeBase } from '../types'; | ||
import { type Viewport } from '../types'; | ||
@@ -12,4 +12,4 @@ export declare const clamp: (val: number, min?: number, max?: number) => number; | ||
export declare const boxToRect: ({ x, y, x2, y2 }: Box) => Rect; | ||
export declare const nodeToRect: (node: NodeBase, nodeOrigin?: NodeOrigin) => Rect; | ||
export declare const nodeToBox: (node: NodeBase, nodeOrigin?: NodeOrigin) => Box; | ||
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; | ||
@@ -16,0 +16,0 @@ export declare const getOverlappingArea: (rectA: Rect, rectB: Rect) => number; |
@@ -1,2 +0,2 @@ | ||
import { type Transform, type XYPosition, type Rect, type NodeOrigin, type NodeBase, type EdgeBase, type FitViewParamsBase, type FitViewOptionsBase, CoordinateExtent, OnError, OnBeforeDeleteBase, NodeLookup } from '../types'; | ||
import { type Transform, type XYPosition, type Rect, type NodeOrigin, type NodeBase, type EdgeBase, type FitViewParamsBase, type FitViewOptionsBase, CoordinateExtent, OnError, OnBeforeDeleteBase, NodeLookup, InternalNodeBase } from '../types'; | ||
/** | ||
@@ -18,2 +18,3 @@ * Test whether an object is useable as an Edge | ||
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; | ||
/** | ||
@@ -41,3 +42,3 @@ * Pass in a node, and get connected nodes where edge.source === node.id | ||
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[]; | ||
export declare const getNodePositionWithOrigin: (node: NodeBase | undefined, nodeOrigin?: NodeOrigin) => { | ||
export declare const getNodePositionWithOrigin: (node: InternalNodeBase | NodeBase | undefined, nodeOrigin?: NodeOrigin) => { | ||
position: XYPosition; | ||
@@ -60,4 +61,14 @@ positionAbsolute: XYPosition; | ||
export declare const getNodesBounds: (nodes: NodeBase[], params?: GetNodesBoundsParams) => Rect; | ||
export declare const getNodesInside: <NodeType extends NodeBase>(nodes: NodeType[], rect: Rect, [tx, ty, tScale]?: Transform, partially?: boolean, excludeNonSelectableNodes?: boolean, nodeOrigin?: NodeOrigin) => NodeType[]; | ||
export type GetInternalNodesBoundsParams = { | ||
nodeOrigin?: NodeOrigin; | ||
useRelativePosition?: boolean; | ||
filter?: (node: NodeBase) => boolean; | ||
}; | ||
/** | ||
* Determines a bounding box that contains all given nodes in an array | ||
* @internal | ||
*/ | ||
export declare const getInternalNodesBounds: (nodeLookup: NodeLookup, params?: GetInternalNodesBoundsParams) => Rect; | ||
export declare const getNodesInside: <NodeType extends NodeBase = NodeBase>(nodeLookup: Map<string, InternalNodeBase<NodeType>>, rect: Rect, [tx, ty, tScale]?: Transform, partially?: boolean, excludeNonSelectableNodes?: boolean, nodeOrigin?: NodeOrigin) => NodeType[]; | ||
/** | ||
* Get all connecting edges for a given set of nodes | ||
@@ -69,3 +80,3 @@ * @param nodes - Nodes you want to get the connected edges for | ||
export declare const getConnectedEdges: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(nodes: NodeType[], edges: EdgeType[]) => EdgeType[]; | ||
export declare function fitView<Params extends FitViewParamsBase<NodeBase>, Options extends FitViewOptionsBase<NodeBase>>({ nodes, width, height, panZoom, minZoom, maxZoom, nodeOrigin }: Params, options?: Options): boolean; | ||
export declare function fitView<Params extends FitViewParamsBase<NodeBase>, Options extends FitViewOptionsBase<NodeBase>>({ nodeLookup, width, height, panZoom, minZoom, maxZoom, nodeOrigin }: Params, options?: Options): boolean; | ||
/** | ||
@@ -80,3 +91,3 @@ * This function calculates the next position of a node, taking into account the node's extent, parent node, and origin. | ||
nextPosition: XYPosition; | ||
nodeLookup: NodeLookup<NodeType>; | ||
nodeLookup: NodeLookup<InternalNodeBase<NodeType>>; | ||
nodeOrigin?: NodeOrigin; | ||
@@ -83,0 +94,0 @@ nodeExtent?: CoordinateExtent; |
@@ -1,4 +0,3 @@ | ||
import { NodeBase, CoordinateExtent, Dimensions, NodeDimensionUpdate, NodeOrigin, PanZoomInstance, Transform, XYPosition, ConnectionLookup, EdgeBase, EdgeLookup } from '../types'; | ||
type ParentNodes = Record<string, boolean>; | ||
export declare function updateAbsolutePositions<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: Map<string, NodeType>, nodeOrigin?: NodeOrigin, parentNodes?: ParentNodes): NodeType[]; | ||
import { NodeBase, CoordinateExtent, NodeDimensionUpdate, NodeOrigin, PanZoomInstance, Transform, XYPosition, ConnectionLookup, EdgeBase, EdgeLookup, InternalNodeBase, NodeChange, NodeLookup } from '../types'; | ||
export declare function updateAbsolutePositions<NodeType extends NodeBase>(nodeLookup: Map<string, InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>, parentNodeIds?: Set<string>): void; | ||
type UpdateNodesOptions<NodeType extends NodeBase> = { | ||
@@ -9,4 +8,5 @@ nodeOrigin?: NodeOrigin; | ||
}; | ||
export declare function adoptUserProvidedNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: Map<string, NodeType>, options?: UpdateNodesOptions<NodeType>): NodeType[]; | ||
export declare function updateNodeDimensions<NodeType extends NodeBase>(updates: Map<string, NodeDimensionUpdate>, nodes: NodeType[], nodeLookup: Map<string, NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin, onUpdate?: (id: string, dimensions: Dimensions) => void): NodeType[] | null; | ||
export declare function adoptUserNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: Map<string, InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): void; | ||
export declare function handleParentExpand(nodes: InternalNodeBase[], nodeLookup: NodeLookup): NodeChange[]; | ||
export declare function updateNodeDimensions<NodeType extends InternalNodeBase>(updates: Map<string, NodeDimensionUpdate>, nodeLookup: Map<string, NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin): NodeChange[]; | ||
export declare function panBy({ delta, panZoom, transform, translateExtent, width, height, }: { | ||
@@ -13,0 +13,0 @@ delta: XYPosition; |
@@ -1,6 +0,6 @@ | ||
import { type NodeDragItem, type XYPosition, NodeBase } from '../types'; | ||
import { type NodeDragItem, type XYPosition, InternalNodeBase, NodeBase, NodeLookup } from '../types'; | ||
export declare function wrapSelectionDragFunc(selectionFunc?: (event: MouseEvent, nodes: NodeBase[]) => void): (event: MouseEvent, _: NodeBase, nodes: NodeBase[]) => void | undefined; | ||
export declare function isParentSelected<NodeType extends NodeBase>(node: NodeType, nodes: NodeType[]): boolean; | ||
export declare function isParentSelected<NodeType extends NodeBase>(node: NodeType, nodeLookup: NodeLookup): boolean; | ||
export declare function hasSelector(target: Element, selector: string, domNode: Element): boolean; | ||
export declare function getDragItems<NodeType extends NodeBase>(nodes: NodeType[], nodesDraggable: boolean, mousePos: XYPosition, nodeId?: string): NodeDragItem[]; | ||
export declare function getDragItems<NodeType extends NodeBase>(nodeLookup: Map<string, InternalNodeBase<NodeType>>, nodesDraggable: boolean, mousePos: XYPosition, nodeId?: string): NodeDragItem[]; | ||
export declare function getEventHandlerParams<NodeType extends NodeBase>({ nodeId, dragItems, nodeLookup, }: { | ||
@@ -7,0 +7,0 @@ nodeId?: string; |
@@ -1,6 +0,6 @@ | ||
import type { NodeBase, NodeDragItem, EdgeBase, CoordinateExtent, NodeOrigin, OnError, SnapGrid, Transform, PanBy, OnSelectionDrag, UpdateNodePositions } from '../types'; | ||
import type { NodeBase, NodeDragItem, EdgeBase, CoordinateExtent, NodeOrigin, OnError, SnapGrid, Transform, PanBy, OnSelectionDrag, UpdateNodePositions, InternalNodeBase } from '../types'; | ||
export type OnDrag = (event: MouseEvent, dragItems: NodeDragItem[], node: NodeBase, nodes: NodeBase[]) => void; | ||
type StoreItems<OnNodeDrag> = { | ||
nodes: NodeBase[]; | ||
nodeLookup: Map<string, NodeBase>; | ||
nodeLookup: Map<string, InternalNodeBase>; | ||
edges: EdgeBase[]; | ||
@@ -7,0 +7,0 @@ nodeExtent: CoordinateExtent; |
@@ -1,6 +0,6 @@ | ||
import { ConnectionStatus, type HandleType, type NodeHandleBounds, type XYPosition, type NodeBase, type ConnectionHandle } from '../types'; | ||
export declare function getHandles(node: NodeBase, handleBounds: NodeHandleBounds, type: HandleType, currentHandle: string): ConnectionHandle[]; | ||
import { ConnectionStatus, type HandleType, type NodeHandleBounds, type XYPosition, type ConnectionHandle, InternalNodeBase, NodeLookup } from '../types'; | ||
export declare function getHandles(node: InternalNodeBase, handleBounds: NodeHandleBounds, type: HandleType, currentHandle: string): ConnectionHandle[]; | ||
export declare function getClosestHandle(pos: XYPosition, connectionRadius: number, handles: ConnectionHandle[]): ConnectionHandle | null; | ||
type GetHandleLookupParams = { | ||
nodes: NodeBase[]; | ||
nodeLookup: NodeLookup; | ||
nodeId: string; | ||
@@ -10,3 +10,3 @@ handleId: string | null; | ||
}; | ||
export declare function getHandleLookup({ nodes, nodeId, handleId, handleType }: GetHandleLookupParams): ConnectionHandle[]; | ||
export declare function getHandleLookup({ nodeLookup, nodeId, handleId, handleType, }: GetHandleLookupParams): ConnectionHandle[]; | ||
export declare function getHandleType(edgeUpdaterType: HandleType | undefined, handleDomNode: Element | null): HandleType | null; | ||
@@ -13,0 +13,0 @@ export declare function getConnectionStatus(isInsideConnectionRadius: boolean, isHandleValid: boolean): ConnectionStatus; |
@@ -1,2 +0,2 @@ | ||
import { ConnectionMode, type OnConnect, type OnConnectStart, type HandleType, type Connection, type PanBy, type NodeBase, type Transform, type ConnectingHandle, type OnConnectEnd, type UpdateConnection, type IsValidConnection, type ConnectionHandle } from '../types'; | ||
import { ConnectionMode, type OnConnect, type OnConnectStart, type HandleType, type Connection, type PanBy, type Transform, type ConnectingHandle, type OnConnectEnd, type UpdateConnection, type IsValidConnection, type ConnectionHandle, NodeLookup } from '../types'; | ||
export type OnPointerDownParams = { | ||
@@ -10,3 +10,3 @@ autoPanOnConnect: boolean; | ||
isTarget: boolean; | ||
nodes: NodeBase[]; | ||
nodeLookup: NodeLookup; | ||
lib: string; | ||
@@ -13,0 +13,0 @@ flowId: string | null; |
@@ -20,5 +20,4 @@ import { CoordinateExtent, HandleType } from './types'; | ||
}; | ||
export declare const internalsSymbol: unique symbol; | ||
export declare const infiniteExtent: CoordinateExtent; | ||
export declare const elementSelectionKeys: string[]; | ||
//# sourceMappingURL=constants.d.ts.map |
import type { D3DragEvent, Selection as D3Selection, SubjectPosition, ZoomBehavior } from 'd3'; | ||
import type { XYPosition, Rect } from './utils'; | ||
import type { NodeBase, NodeDragItem, NodeOrigin } from './nodes'; | ||
import type { InternalNodeBase, NodeBase, NodeDragItem, NodeOrigin } from './nodes'; | ||
import type { ConnectingHandle, HandleType } from './handles'; | ||
@@ -42,3 +42,3 @@ import { PanZoomInstance } from './panzoom'; | ||
export type FitViewParamsBase<NodeType extends NodeBase> = { | ||
nodes: NodeType[]; | ||
nodeLookup: Map<string, InternalNodeBase<NodeType>>; | ||
width: number; | ||
@@ -102,3 +102,3 @@ height: number; | ||
export type OnError = (id: string, message: string) => void; | ||
export type UpdateNodePositions = (dragItems: NodeDragItem[] | NodeBase[], dragging?: boolean) => void; | ||
export type UpdateNodePositions = (dragItems: NodeDragItem[] | InternalNodeBase[], dragging?: boolean) => void; | ||
export type PanBy = (delta: XYPosition) => boolean; | ||
@@ -105,0 +105,0 @@ export type UpdateConnection = (params: { |
@@ -0,1 +1,2 @@ | ||
export * from './changes'; | ||
export * from './general'; | ||
@@ -2,0 +3,0 @@ export * from './nodes'; |
@@ -1,2 +0,1 @@ | ||
import { internalsSymbol } from '../constants'; | ||
import type { XYPosition, Position, CoordinateExtent, HandleElement } from '.'; | ||
@@ -43,3 +42,3 @@ import { Optional } from '../utils/types'; | ||
/** Parent node id, used for creating sub-flows */ | ||
parentNode?: string; | ||
parentId?: string; | ||
zIndex?: number; | ||
@@ -60,15 +59,20 @@ /** Boundary a node can be moved in | ||
handles?: NodeHandle[]; | ||
computed?: { | ||
measured?: { | ||
width?: number; | ||
height?: number; | ||
positionAbsolute?: XYPosition; | ||
}; | ||
[internalsSymbol]?: { | ||
z?: number; | ||
}; | ||
export type InternalNodeBase<NodeType extends NodeBase = NodeBase> = NodeType & { | ||
measured: { | ||
width?: number; | ||
height?: number; | ||
}; | ||
internals: { | ||
positionAbsolute: XYPosition; | ||
z: number; | ||
isParent: boolean; | ||
/** Holds a reference to the original node object provided by the user. | ||
* Used as an optimization to avoid certain operations. */ | ||
userNode: NodeType; | ||
handleBounds?: NodeHandleBounds; | ||
isParent?: boolean; | ||
/** Holds a reference to the original node object provided by the user | ||
* (which may lack some fields, like `computed` or `[internalSymbol]`. Used | ||
* as an optimization to avoid certain operations. */ | ||
userProvidedNode: NodeBase<NodeData, NodeType>; | ||
}; | ||
@@ -96,3 +100,3 @@ }; | ||
nodeElement: HTMLDivElement; | ||
forceUpdate?: boolean; | ||
force?: boolean; | ||
}; | ||
@@ -107,9 +111,11 @@ export type NodeBounds = XYPosition & { | ||
distance: XYPosition; | ||
computed: { | ||
measured: { | ||
width: number | null; | ||
height: number | null; | ||
}; | ||
internals: { | ||
positionAbsolute: XYPosition; | ||
}; | ||
extent?: 'parent' | CoordinateExtent; | ||
parentNode?: string; | ||
parentId?: string; | ||
dragging?: boolean; | ||
@@ -123,3 +129,3 @@ origin?: NodeOrigin; | ||
export type Align = 'center' | 'start' | 'end'; | ||
export type NodeLookup<NodeType extends NodeBase = NodeBase> = Map<string, NodeType>; | ||
export type NodeLookup<NodeType extends InternalNodeBase = InternalNodeBase> = Map<string, NodeType>; | ||
//# sourceMappingURL=nodes.d.ts.map |
@@ -1,3 +0,2 @@ | ||
import { Connection, Transform } from '../..'; | ||
import { EdgeBase, NodeBase } from '../../types'; | ||
import { Connection, InternalNodeBase, Transform, EdgeBase } from '../..'; | ||
export declare function getEdgeCenter({ sourceX, sourceY, targetX, targetY, }: { | ||
@@ -10,4 +9,4 @@ sourceX: number; | ||
export type GetEdgeZIndexParams = { | ||
sourceNode: NodeBase; | ||
targetNode: NodeBase; | ||
sourceNode: InternalNodeBase; | ||
targetNode: InternalNodeBase; | ||
selected?: boolean; | ||
@@ -19,4 +18,4 @@ zIndex?: number; | ||
type IsEdgeVisibleParams = { | ||
sourceNode: NodeBase; | ||
targetNode: NodeBase; | ||
sourceNode: InternalNodeBase; | ||
targetNode: InternalNodeBase; | ||
width: number; | ||
@@ -23,0 +22,0 @@ height: number; |
import { EdgePosition } from '../../types/edges'; | ||
import { ConnectionMode, OnError } from '../../types/general'; | ||
import { NodeBase } from '../../types/nodes'; | ||
import { InternalNodeBase } from '../../types/nodes'; | ||
export type GetEdgePositionParams = { | ||
id: string; | ||
sourceNode: NodeBase; | ||
sourceNode: InternalNodeBase; | ||
sourceHandle: string | null; | ||
targetNode: NodeBase; | ||
targetNode: InternalNodeBase; | ||
targetHandle: string | null; | ||
@@ -10,0 +10,0 @@ connectionMode: ConnectionMode; |
@@ -1,2 +0,2 @@ | ||
import type { Dimensions, XYPosition, CoordinateExtent, Box, Rect, NodeBase, NodeOrigin, SnapGrid, Transform } from '../types'; | ||
import type { Dimensions, XYPosition, CoordinateExtent, Box, Rect, NodeBase, NodeOrigin, SnapGrid, Transform, InternalNodeBase } from '../types'; | ||
import { type Viewport } from '../types'; | ||
@@ -12,4 +12,4 @@ export declare const clamp: (val: number, min?: number, max?: number) => number; | ||
export declare const boxToRect: ({ x, y, x2, y2 }: Box) => Rect; | ||
export declare const nodeToRect: (node: NodeBase, nodeOrigin?: NodeOrigin) => Rect; | ||
export declare const nodeToBox: (node: NodeBase, nodeOrigin?: NodeOrigin) => Box; | ||
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; | ||
@@ -16,0 +16,0 @@ export declare const getOverlappingArea: (rectA: Rect, rectB: Rect) => number; |
@@ -1,2 +0,2 @@ | ||
import { type Transform, type XYPosition, type Rect, type NodeOrigin, type NodeBase, type EdgeBase, type FitViewParamsBase, type FitViewOptionsBase, CoordinateExtent, OnError, OnBeforeDeleteBase, NodeLookup } from '../types'; | ||
import { type Transform, type XYPosition, type Rect, type NodeOrigin, type NodeBase, type EdgeBase, type FitViewParamsBase, type FitViewOptionsBase, CoordinateExtent, OnError, OnBeforeDeleteBase, NodeLookup, InternalNodeBase } from '../types'; | ||
/** | ||
@@ -18,2 +18,3 @@ * Test whether an object is useable as an Edge | ||
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; | ||
/** | ||
@@ -41,3 +42,3 @@ * Pass in a node, and get connected nodes where edge.source === node.id | ||
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[]; | ||
export declare const getNodePositionWithOrigin: (node: NodeBase | undefined, nodeOrigin?: NodeOrigin) => { | ||
export declare const getNodePositionWithOrigin: (node: InternalNodeBase | NodeBase | undefined, nodeOrigin?: NodeOrigin) => { | ||
position: XYPosition; | ||
@@ -60,4 +61,14 @@ positionAbsolute: XYPosition; | ||
export declare const getNodesBounds: (nodes: NodeBase[], params?: GetNodesBoundsParams) => Rect; | ||
export declare const getNodesInside: <NodeType extends NodeBase>(nodes: NodeType[], rect: Rect, [tx, ty, tScale]?: Transform, partially?: boolean, excludeNonSelectableNodes?: boolean, nodeOrigin?: NodeOrigin) => NodeType[]; | ||
export type GetInternalNodesBoundsParams = { | ||
nodeOrigin?: NodeOrigin; | ||
useRelativePosition?: boolean; | ||
filter?: (node: NodeBase) => boolean; | ||
}; | ||
/** | ||
* Determines a bounding box that contains all given nodes in an array | ||
* @internal | ||
*/ | ||
export declare const getInternalNodesBounds: (nodeLookup: NodeLookup, params?: GetInternalNodesBoundsParams) => Rect; | ||
export declare const getNodesInside: <NodeType extends NodeBase = NodeBase>(nodeLookup: Map<string, InternalNodeBase<NodeType>>, rect: Rect, [tx, ty, tScale]?: Transform, partially?: boolean, excludeNonSelectableNodes?: boolean, nodeOrigin?: NodeOrigin) => NodeType[]; | ||
/** | ||
* Get all connecting edges for a given set of nodes | ||
@@ -69,3 +80,3 @@ * @param nodes - Nodes you want to get the connected edges for | ||
export declare const getConnectedEdges: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(nodes: NodeType[], edges: EdgeType[]) => EdgeType[]; | ||
export declare function fitView<Params extends FitViewParamsBase<NodeBase>, Options extends FitViewOptionsBase<NodeBase>>({ nodes, width, height, panZoom, minZoom, maxZoom, nodeOrigin }: Params, options?: Options): boolean; | ||
export declare function fitView<Params extends FitViewParamsBase<NodeBase>, Options extends FitViewOptionsBase<NodeBase>>({ nodeLookup, width, height, panZoom, minZoom, maxZoom, nodeOrigin }: Params, options?: Options): boolean; | ||
/** | ||
@@ -80,3 +91,3 @@ * This function calculates the next position of a node, taking into account the node's extent, parent node, and origin. | ||
nextPosition: XYPosition; | ||
nodeLookup: NodeLookup<NodeType>; | ||
nodeLookup: NodeLookup<InternalNodeBase<NodeType>>; | ||
nodeOrigin?: NodeOrigin; | ||
@@ -83,0 +94,0 @@ nodeExtent?: CoordinateExtent; |
@@ -1,4 +0,3 @@ | ||
import { NodeBase, CoordinateExtent, Dimensions, NodeDimensionUpdate, NodeOrigin, PanZoomInstance, Transform, XYPosition, ConnectionLookup, EdgeBase, EdgeLookup } from '../types'; | ||
type ParentNodes = Record<string, boolean>; | ||
export declare function updateAbsolutePositions<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: Map<string, NodeType>, nodeOrigin?: NodeOrigin, parentNodes?: ParentNodes): NodeType[]; | ||
import { NodeBase, CoordinateExtent, NodeDimensionUpdate, NodeOrigin, PanZoomInstance, Transform, XYPosition, ConnectionLookup, EdgeBase, EdgeLookup, InternalNodeBase, NodeChange, NodeLookup } from '../types'; | ||
export declare function updateAbsolutePositions<NodeType extends NodeBase>(nodeLookup: Map<string, InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>, parentNodeIds?: Set<string>): void; | ||
type UpdateNodesOptions<NodeType extends NodeBase> = { | ||
@@ -9,4 +8,5 @@ nodeOrigin?: NodeOrigin; | ||
}; | ||
export declare function adoptUserProvidedNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: Map<string, NodeType>, options?: UpdateNodesOptions<NodeType>): NodeType[]; | ||
export declare function updateNodeDimensions<NodeType extends NodeBase>(updates: Map<string, NodeDimensionUpdate>, nodes: NodeType[], nodeLookup: Map<string, NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin, onUpdate?: (id: string, dimensions: Dimensions) => void): NodeType[] | null; | ||
export declare function adoptUserNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: Map<string, InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): void; | ||
export declare function handleParentExpand(nodes: InternalNodeBase[], nodeLookup: NodeLookup): NodeChange[]; | ||
export declare function updateNodeDimensions<NodeType extends InternalNodeBase>(updates: Map<string, NodeDimensionUpdate>, nodeLookup: Map<string, NodeType>, domNode: HTMLElement | null, nodeOrigin?: NodeOrigin): NodeChange[]; | ||
export declare function panBy({ delta, panZoom, transform, translateExtent, width, height, }: { | ||
@@ -13,0 +13,0 @@ delta: XYPosition; |
@@ -1,6 +0,6 @@ | ||
import { type NodeDragItem, type XYPosition, NodeBase } from '../types'; | ||
import { type NodeDragItem, type XYPosition, InternalNodeBase, NodeBase, NodeLookup } from '../types'; | ||
export declare function wrapSelectionDragFunc(selectionFunc?: (event: MouseEvent, nodes: NodeBase[]) => void): (event: MouseEvent, _: NodeBase, nodes: NodeBase[]) => void | undefined; | ||
export declare function isParentSelected<NodeType extends NodeBase>(node: NodeType, nodes: NodeType[]): boolean; | ||
export declare function isParentSelected<NodeType extends NodeBase>(node: NodeType, nodeLookup: NodeLookup): boolean; | ||
export declare function hasSelector(target: Element, selector: string, domNode: Element): boolean; | ||
export declare function getDragItems<NodeType extends NodeBase>(nodes: NodeType[], nodesDraggable: boolean, mousePos: XYPosition, nodeId?: string): NodeDragItem[]; | ||
export declare function getDragItems<NodeType extends NodeBase>(nodeLookup: Map<string, InternalNodeBase<NodeType>>, nodesDraggable: boolean, mousePos: XYPosition, nodeId?: string): NodeDragItem[]; | ||
export declare function getEventHandlerParams<NodeType extends NodeBase>({ nodeId, dragItems, nodeLookup, }: { | ||
@@ -7,0 +7,0 @@ nodeId?: string; |
@@ -1,6 +0,6 @@ | ||
import type { NodeBase, NodeDragItem, EdgeBase, CoordinateExtent, NodeOrigin, OnError, SnapGrid, Transform, PanBy, OnSelectionDrag, UpdateNodePositions } from '../types'; | ||
import type { NodeBase, NodeDragItem, EdgeBase, CoordinateExtent, NodeOrigin, OnError, SnapGrid, Transform, PanBy, OnSelectionDrag, UpdateNodePositions, InternalNodeBase } from '../types'; | ||
export type OnDrag = (event: MouseEvent, dragItems: NodeDragItem[], node: NodeBase, nodes: NodeBase[]) => void; | ||
type StoreItems<OnNodeDrag> = { | ||
nodes: NodeBase[]; | ||
nodeLookup: Map<string, NodeBase>; | ||
nodeLookup: Map<string, InternalNodeBase>; | ||
edges: EdgeBase[]; | ||
@@ -7,0 +7,0 @@ nodeExtent: CoordinateExtent; |
@@ -1,6 +0,6 @@ | ||
import { ConnectionStatus, type HandleType, type NodeHandleBounds, type XYPosition, type NodeBase, type ConnectionHandle } from '../types'; | ||
export declare function getHandles(node: NodeBase, handleBounds: NodeHandleBounds, type: HandleType, currentHandle: string): ConnectionHandle[]; | ||
import { ConnectionStatus, type HandleType, type NodeHandleBounds, type XYPosition, type ConnectionHandle, InternalNodeBase, NodeLookup } from '../types'; | ||
export declare function getHandles(node: InternalNodeBase, handleBounds: NodeHandleBounds, type: HandleType, currentHandle: string): ConnectionHandle[]; | ||
export declare function getClosestHandle(pos: XYPosition, connectionRadius: number, handles: ConnectionHandle[]): ConnectionHandle | null; | ||
type GetHandleLookupParams = { | ||
nodes: NodeBase[]; | ||
nodeLookup: NodeLookup; | ||
nodeId: string; | ||
@@ -10,3 +10,3 @@ handleId: string | null; | ||
}; | ||
export declare function getHandleLookup({ nodes, nodeId, handleId, handleType }: GetHandleLookupParams): ConnectionHandle[]; | ||
export declare function getHandleLookup({ nodeLookup, nodeId, handleId, handleType, }: GetHandleLookupParams): ConnectionHandle[]; | ||
export declare function getHandleType(edgeUpdaterType: HandleType | undefined, handleDomNode: Element | null): HandleType | null; | ||
@@ -13,0 +13,0 @@ export declare function getConnectionStatus(isInsideConnectionRadius: boolean, isHandleValid: boolean): ConnectionStatus; |
@@ -1,2 +0,2 @@ | ||
import { ConnectionMode, type OnConnect, type OnConnectStart, type HandleType, type Connection, type PanBy, type NodeBase, type Transform, type ConnectingHandle, type OnConnectEnd, type UpdateConnection, type IsValidConnection, type ConnectionHandle } from '../types'; | ||
import { ConnectionMode, type OnConnect, type OnConnectStart, type HandleType, type Connection, type PanBy, type Transform, type ConnectingHandle, type OnConnectEnd, type UpdateConnection, type IsValidConnection, type ConnectionHandle, NodeLookup } from '../types'; | ||
export type OnPointerDownParams = { | ||
@@ -10,3 +10,3 @@ autoPanOnConnect: boolean; | ||
isTarget: boolean; | ||
nodes: NodeBase[]; | ||
nodeLookup: NodeLookup; | ||
lib: string; | ||
@@ -13,0 +13,0 @@ flowId: string | null; |
{ | ||
"name": "@xyflow/system", | ||
"version": "0.0.21", | ||
"version": "0.0.22", | ||
"description": "xyflow core system that powers React Flow and Svelte Flow.", | ||
@@ -51,4 +51,4 @@ "keywords": [ | ||
"@xyflow/rollup-config": "0.0.0", | ||
"@xyflow/eslint-config": "0.0.0", | ||
"@xyflow/tsconfig": "0.0.0" | ||
"@xyflow/tsconfig": "0.0.0", | ||
"@xyflow/eslint-config": "0.0.0" | ||
}, | ||
@@ -55,0 +55,0 @@ "rollup": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
532365
174
8421