@xyflow/system 0.0.49 → 0.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/index.js +339 -133
- package/dist/esm/index.mjs +339 -133
- package/dist/esm/types/changes.d.ts +12 -1
- package/dist/esm/types/changes.d.ts.map +1 -1
- package/dist/esm/types/edges.d.ts +37 -4
- package/dist/esm/types/edges.d.ts.map +1 -1
- package/dist/esm/types/general.d.ts +63 -0
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/types/handles.d.ts +9 -5
- package/dist/esm/types/handles.d.ts.map +1 -1
- package/dist/esm/types/nodes.d.ts +29 -9
- package/dist/esm/types/nodes.d.ts.map +1 -1
- package/dist/esm/types/utils.d.ts +22 -0
- package/dist/esm/types/utils.d.ts.map +1 -1
- package/dist/esm/utils/dom.d.ts.map +1 -1
- package/dist/esm/utils/edges/bezier-edge.d.ts +18 -11
- package/dist/esm/utils/edges/bezier-edge.d.ts.map +1 -1
- package/dist/esm/utils/edges/general.d.ts +16 -3
- package/dist/esm/utils/edges/general.d.ts.map +1 -1
- package/dist/esm/utils/edges/smoothstep-edge.d.ts +17 -11
- package/dist/esm/utils/edges/smoothstep-edge.d.ts.map +1 -1
- package/dist/esm/utils/edges/straight-edge.d.ts +15 -11
- package/dist/esm/utils/edges/straight-edge.d.ts.map +1 -1
- package/dist/esm/utils/general.d.ts +2 -2
- package/dist/esm/utils/graph.d.ts +82 -4
- package/dist/esm/utils/graph.d.ts.map +1 -1
- package/dist/esm/utils/node-toolbar.d.ts.map +1 -1
- package/dist/esm/utils/store.d.ts.map +1 -1
- package/dist/esm/xydrag/XYDrag.d.ts.map +1 -1
- package/dist/esm/xydrag/utils.d.ts.map +1 -1
- package/dist/esm/xyhandle/XYHandle.d.ts.map +1 -1
- package/dist/esm/xyhandle/types.d.ts.map +1 -1
- package/dist/esm/xyhandle/utils.d.ts.map +1 -1
- package/dist/esm/xypanzoom/XYPanZoom.d.ts.map +1 -1
- package/dist/esm/xypanzoom/eventhandler.d.ts.map +1 -1
- package/dist/esm/xyresizer/XYResizer.d.ts.map +1 -1
- package/dist/esm/xyresizer/types.d.ts +15 -0
- package/dist/esm/xyresizer/types.d.ts.map +1 -1
- package/dist/umd/index.js +1 -1
- package/dist/umd/types/changes.d.ts +12 -1
- package/dist/umd/types/changes.d.ts.map +1 -1
- package/dist/umd/types/edges.d.ts +37 -4
- package/dist/umd/types/edges.d.ts.map +1 -1
- package/dist/umd/types/general.d.ts +63 -0
- package/dist/umd/types/general.d.ts.map +1 -1
- package/dist/umd/types/handles.d.ts +9 -5
- package/dist/umd/types/handles.d.ts.map +1 -1
- package/dist/umd/types/nodes.d.ts +29 -9
- package/dist/umd/types/nodes.d.ts.map +1 -1
- package/dist/umd/types/utils.d.ts +22 -0
- package/dist/umd/types/utils.d.ts.map +1 -1
- package/dist/umd/utils/dom.d.ts.map +1 -1
- package/dist/umd/utils/edges/bezier-edge.d.ts +18 -11
- package/dist/umd/utils/edges/bezier-edge.d.ts.map +1 -1
- package/dist/umd/utils/edges/general.d.ts +16 -3
- package/dist/umd/utils/edges/general.d.ts.map +1 -1
- package/dist/umd/utils/edges/smoothstep-edge.d.ts +17 -11
- package/dist/umd/utils/edges/smoothstep-edge.d.ts.map +1 -1
- package/dist/umd/utils/edges/straight-edge.d.ts +15 -11
- package/dist/umd/utils/edges/straight-edge.d.ts.map +1 -1
- package/dist/umd/utils/general.d.ts +2 -2
- package/dist/umd/utils/graph.d.ts +82 -4
- package/dist/umd/utils/graph.d.ts.map +1 -1
- package/dist/umd/utils/node-toolbar.d.ts.map +1 -1
- package/dist/umd/utils/store.d.ts.map +1 -1
- package/dist/umd/xydrag/XYDrag.d.ts.map +1 -1
- package/dist/umd/xydrag/utils.d.ts.map +1 -1
- package/dist/umd/xyhandle/XYHandle.d.ts.map +1 -1
- package/dist/umd/xyhandle/types.d.ts.map +1 -1
- package/dist/umd/xyhandle/utils.d.ts.map +1 -1
- package/dist/umd/xypanzoom/XYPanZoom.d.ts.map +1 -1
- package/dist/umd/xypanzoom/eventhandler.d.ts.map +1 -1
- package/dist/umd/xyresizer/XYResizer.d.ts.map +1 -1
- package/dist/umd/xyresizer/types.d.ts +15 -0
- package/dist/umd/xyresizer/types.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/types/edges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,MAAM,QAAQ,CAClB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,QAAQ,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IACtD;IACF,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf
|
|
1
|
+
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/types/edges.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC,MAAM,MAAM,QAAQ,CAClB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,QAAQ,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IACtD;IACF,2BAA2B;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,2CAA2C;IAC3C,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;I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,GAAG;IACvB,IAAI,EAAE,UAAU,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,UAAU,CAAC;AAEjD;;;;;GAKG;AACH,oBAAY,UAAU;IACpB,KAAK,UAAU;IACf,WAAW,gBAAgB;CAC5B;AAED,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG;IACrC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,QAAQ,CAAC;IACzB,cAAc,EAAE,QAAQ,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,IAAI,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC"}
|
|
@@ -17,18 +17,39 @@ export type GetViewport = () => Viewport;
|
|
|
17
17
|
export type SetViewport = (viewport: Viewport, options?: ViewportHelperFunctionOptions) => Promise<boolean>;
|
|
18
18
|
export type SetCenter = (x: number, y: number, options?: SetCenterOptions) => Promise<boolean>;
|
|
19
19
|
export type FitBounds = (bounds: Rect, options?: FitBoundsOptions) => Promise<boolean>;
|
|
20
|
+
/**
|
|
21
|
+
* The `Connection` type is the basic minimal description of an [`Edge`](/api-reference/types/edge)
|
|
22
|
+
* between two nodes. The [`addEdge`](/api-reference/utils/add-edge) util can be used to upgrade
|
|
23
|
+
* a `Connection` to an [`Edge`](/api-reference/types/edge).
|
|
24
|
+
*
|
|
25
|
+
* @public
|
|
26
|
+
*/
|
|
20
27
|
export type Connection = {
|
|
21
28
|
source: string;
|
|
22
29
|
target: string;
|
|
23
30
|
sourceHandle: string | null;
|
|
24
31
|
targetHandle: string | null;
|
|
25
32
|
};
|
|
33
|
+
/**
|
|
34
|
+
* The `HandleConnection` type is an extention of a basic [Connection](/api-reference/types/connection) that includes the `edgeId`.
|
|
35
|
+
*/
|
|
26
36
|
export type HandleConnection = Connection & {
|
|
27
37
|
edgeId: string;
|
|
28
38
|
};
|
|
39
|
+
/**
|
|
40
|
+
* The `NodeConnection` type is an extention of a basic [Connection](/api-reference/types/connection) that includes the `edgeId`.
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
29
43
|
export type NodeConnection = Connection & {
|
|
30
44
|
edgeId: string;
|
|
31
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* The `ConnectionMode` is used to set the mode of connection between nodes.
|
|
48
|
+
* The `Strict` mode is the default one and only allows source to target edges.
|
|
49
|
+
* `Loose` mode allows source to source and target to target edges as well.
|
|
50
|
+
*
|
|
51
|
+
* @public
|
|
52
|
+
*/
|
|
32
53
|
export declare enum ConnectionMode {
|
|
33
54
|
Strict = "strict",
|
|
34
55
|
Loose = "loose"
|
|
@@ -42,6 +63,9 @@ export type OnConnectStart = (event: MouseEvent | TouchEvent, params: OnConnectS
|
|
|
42
63
|
export type OnConnect = (connection: Connection) => void;
|
|
43
64
|
export type OnConnectEnd = (event: MouseEvent | TouchEvent, connectionState: FinalConnectionState) => void;
|
|
44
65
|
export type IsValidConnection = (edge: EdgeBase | Connection) => boolean;
|
|
66
|
+
/**
|
|
67
|
+
* @inline
|
|
68
|
+
*/
|
|
45
69
|
export type FitViewParamsBase<NodeType extends NodeBase> = {
|
|
46
70
|
nodes: Map<string, InternalNodeBase<NodeType>>;
|
|
47
71
|
width: number;
|
|
@@ -50,6 +74,9 @@ export type FitViewParamsBase<NodeType extends NodeBase> = {
|
|
|
50
74
|
minZoom: number;
|
|
51
75
|
maxZoom: number;
|
|
52
76
|
};
|
|
77
|
+
/**
|
|
78
|
+
* @inline
|
|
79
|
+
*/
|
|
53
80
|
export type FitViewOptionsBase<NodeType extends NodeBase = NodeBase> = {
|
|
54
81
|
padding?: number;
|
|
55
82
|
includeHiddenNodes?: boolean;
|
|
@@ -60,6 +87,17 @@ export type FitViewOptionsBase<NodeType extends NodeBase = NodeBase> = {
|
|
|
60
87
|
id: string;
|
|
61
88
|
})[];
|
|
62
89
|
};
|
|
90
|
+
/**
|
|
91
|
+
* Internally, React Flow maintains a coordinate system that is independent of the
|
|
92
|
+
* rest of the page. The `Viewport` type tells you where in that system your flow
|
|
93
|
+
* is currently being display at and how zoomed in or out it is.
|
|
94
|
+
*
|
|
95
|
+
* @public
|
|
96
|
+
* @remarks A `Transform` has the same properties as the viewport, but they represent
|
|
97
|
+
* different things. Make sure you don't get them muddled up or things will start
|
|
98
|
+
* to look weird!
|
|
99
|
+
*
|
|
100
|
+
*/
|
|
63
101
|
export type Viewport = {
|
|
64
102
|
x: number;
|
|
65
103
|
y: number;
|
|
@@ -67,11 +105,22 @@ export type Viewport = {
|
|
|
67
105
|
};
|
|
68
106
|
export type KeyCode = string | Array<string>;
|
|
69
107
|
export type SnapGrid = [number, number];
|
|
108
|
+
/**
|
|
109
|
+
* This enum is used to set the different modes of panning the viewport when the
|
|
110
|
+
* user scrolls. The `Free` mode allows the user to pan in any direction by scrolling
|
|
111
|
+
* with a device like a trackpad. The `Vertical` and `Horizontal` modes restrict
|
|
112
|
+
* scroll panning to only the vertical or horizontal axis, respectively.
|
|
113
|
+
*
|
|
114
|
+
* @public
|
|
115
|
+
*/
|
|
70
116
|
export declare enum PanOnScrollMode {
|
|
71
117
|
Free = "free",
|
|
72
118
|
Vertical = "vertical",
|
|
73
119
|
Horizontal = "horizontal"
|
|
74
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* @inline
|
|
123
|
+
*/
|
|
75
124
|
export type ViewportHelperFunctionOptions = {
|
|
76
125
|
duration?: number;
|
|
77
126
|
};
|
|
@@ -86,6 +135,14 @@ export type D3ZoomInstance = ZoomBehavior<Element, unknown>;
|
|
|
86
135
|
export type D3SelectionInstance = D3Selection<Element, unknown, null, undefined>;
|
|
87
136
|
export type D3ZoomHandler = (this: Element, event: any, d: unknown) => void;
|
|
88
137
|
export type UpdateNodeInternals = (nodeId: string | string[]) => void;
|
|
138
|
+
/**
|
|
139
|
+
* This type is mostly used to help position things on top of the flow viewport. For
|
|
140
|
+
* example both the [`<MiniMap />`](/api-reference/components/minimap) and
|
|
141
|
+
* [`<Controls />`](/api-reference/components/controls) components take a `position`
|
|
142
|
+
* prop of this type.
|
|
143
|
+
*
|
|
144
|
+
* @public
|
|
145
|
+
*/
|
|
89
146
|
export type PanelPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
90
147
|
export type ProOptions = {
|
|
91
148
|
account?: string;
|
|
@@ -128,6 +185,12 @@ export type ConnectionInProgress<NodeType extends InternalNodeBase = InternalNod
|
|
|
128
185
|
toPosition: Position;
|
|
129
186
|
toNode: NodeType | null;
|
|
130
187
|
};
|
|
188
|
+
/**
|
|
189
|
+
* The `ConnectionState` type bundles all information about an ongoing connection.
|
|
190
|
+
* It is returned by the [`useConnection`](/api-reference/hooks/use-connection) hook.
|
|
191
|
+
*
|
|
192
|
+
* @public
|
|
193
|
+
*/
|
|
131
194
|
export type ConnectionState<NodeType extends InternalNodeBase = InternalNodeBase> = ConnectionInProgress<NodeType> | NoConnection;
|
|
132
195
|
export type FinalConnectionState<NodeType extends InternalNodeBase = InternalNodeBase> = Omit<ConnectionState<NodeType>, 'inProgress'>;
|
|
133
196
|
export type UpdateConnection<NodeType extends InternalNodeBase = InternalNodeBase> = (params: ConnectionState<NodeType>) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/types/general.ts"],"names":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AAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,KAAK,OAAO,CAAC,OAAO,GAAG;IAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;IAAC,KAAK,EAAE,QAAQ,EAAE,CAAA;CAAE,CAAC,CAAC"}
|
|
@@ -11,11 +11,13 @@ export type Handle = {
|
|
|
11
11
|
height: number;
|
|
12
12
|
};
|
|
13
13
|
export type HandleProps = {
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* Type of the handle
|
|
15
16
|
* @example HandleType.Source, HandleType.Target
|
|
16
17
|
*/
|
|
17
18
|
type: HandleType;
|
|
18
|
-
/**
|
|
19
|
+
/**
|
|
20
|
+
* Position of the handle
|
|
19
21
|
* @example Position.TopLeft, Position.TopRight,
|
|
20
22
|
* Position.BottomLeft, Position.BottomRight
|
|
21
23
|
*/
|
|
@@ -26,13 +28,15 @@ export type HandleProps = {
|
|
|
26
28
|
isConnectableStart?: boolean;
|
|
27
29
|
/** Should you be able to connect to this handle */
|
|
28
30
|
isConnectableEnd?: boolean;
|
|
29
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Callback if connection is valid
|
|
30
33
|
* @remarks connection becomes an edge if isValidConnection returns true
|
|
31
34
|
*/
|
|
32
35
|
isValidConnection?: IsValidConnection;
|
|
33
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* Id of the handle
|
|
34
38
|
* @remarks optional if there is only one handle of this type
|
|
35
39
|
*/
|
|
36
|
-
id?: string;
|
|
40
|
+
id?: string | null;
|
|
37
41
|
};
|
|
38
42
|
//# sourceMappingURL=handles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handles.d.ts","sourceRoot":"","sources":["../../src/types/handles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,GAAG,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAA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AAC;CACpB,CAAC"}
|
|
@@ -3,13 +3,15 @@ import { Optional } from '../utils/types';
|
|
|
3
3
|
/**
|
|
4
4
|
* Framework independent node data structure.
|
|
5
5
|
*
|
|
6
|
+
* @inline
|
|
6
7
|
* @typeParam NodeData - type of the node data
|
|
7
8
|
* @typeParam NodeType - type of the node
|
|
8
9
|
*/
|
|
9
10
|
export type NodeBase<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string = string> = {
|
|
10
11
|
/** Unique id of a node */
|
|
11
12
|
id: string;
|
|
12
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Position of a node on the pane
|
|
13
15
|
* @example { x: 0, y: 0 }
|
|
14
16
|
*/
|
|
15
17
|
position: XYPosition;
|
|
@@ -17,11 +19,13 @@ export type NodeBase<NodeData extends Record<string, unknown> = Record<string, u
|
|
|
17
19
|
data: NodeData;
|
|
18
20
|
/** Type of node defined in nodeTypes */
|
|
19
21
|
type?: NodeType;
|
|
20
|
-
/**
|
|
22
|
+
/**
|
|
23
|
+
* Only relevant for default, source, target nodeType. controls source position
|
|
21
24
|
* @example 'right', 'left', 'top', 'bottom'
|
|
22
25
|
*/
|
|
23
26
|
sourcePosition?: Position;
|
|
24
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Only relevant for default, source, target nodeType. controls target position
|
|
25
29
|
* @example 'right', 'left', 'top', 'bottom'
|
|
26
30
|
*/
|
|
27
31
|
targetPosition?: Position;
|
|
@@ -41,13 +45,15 @@ export type NodeBase<NodeData extends Record<string, unknown> = Record<string, u
|
|
|
41
45
|
/** Parent node id, used for creating sub-flows */
|
|
42
46
|
parentId?: string;
|
|
43
47
|
zIndex?: number;
|
|
44
|
-
/**
|
|
48
|
+
/**
|
|
49
|
+
* Boundary a node can be moved in
|
|
45
50
|
* @example 'parent' or [[0, 0], [100, 100]]
|
|
46
51
|
*/
|
|
47
52
|
extent?: 'parent' | CoordinateExtent;
|
|
48
53
|
expandParent?: boolean;
|
|
49
54
|
ariaLabel?: string;
|
|
50
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Origin of the node relative to it's position
|
|
51
57
|
* @example
|
|
52
58
|
* [0.5, 0.5] // centers the node
|
|
53
59
|
* [0, 0] // top left
|
|
@@ -68,19 +74,21 @@ export type InternalNodeBase<NodeType extends NodeBase = NodeBase> = NodeType &
|
|
|
68
74
|
internals: {
|
|
69
75
|
positionAbsolute: XYPosition;
|
|
70
76
|
z: number;
|
|
71
|
-
/**
|
|
72
|
-
*
|
|
77
|
+
/**
|
|
78
|
+
* Holds a reference to the original node object provided by the user.
|
|
79
|
+
* Used as an optimization to avoid certain operations.
|
|
80
|
+
*/
|
|
73
81
|
userNode: NodeType;
|
|
74
82
|
handleBounds?: NodeHandleBounds;
|
|
75
83
|
bounds?: NodeBounds;
|
|
76
84
|
};
|
|
77
85
|
};
|
|
78
86
|
/**
|
|
79
|
-
* The node data structure that gets used for the nodes
|
|
87
|
+
* The node data structure that gets used for the custom nodes props.
|
|
80
88
|
*
|
|
81
89
|
* @public
|
|
82
90
|
*/
|
|
83
|
-
export type NodeProps<NodeType extends NodeBase> = Pick<NodeType, 'id' | 'data' | 'width' | 'height' | 'sourcePosition' | 'targetPosition' | '
|
|
91
|
+
export type NodeProps<NodeType extends NodeBase> = Pick<NodeType, 'id' | 'data' | 'width' | 'height' | 'sourcePosition' | 'targetPosition' | 'dragHandle' | 'parentId'> & Required<Pick<NodeType, 'type' | 'dragging' | 'zIndex' | 'selectable' | 'deletable' | 'selected' | 'draggable'>> & {
|
|
84
92
|
/** whether a node is connectable or not */
|
|
85
93
|
isConnectable: boolean;
|
|
86
94
|
/** position absolute x value */
|
|
@@ -118,8 +126,20 @@ export type NodeDragItem = {
|
|
|
118
126
|
origin?: NodeOrigin;
|
|
119
127
|
expandParent?: boolean;
|
|
120
128
|
};
|
|
129
|
+
/**
|
|
130
|
+
* The origin of a Node determines how it is placed relative to its own coordinates.
|
|
131
|
+
* `[0, 0]` places it at the top left corner, `[0.5, 0.5]` right in the center and
|
|
132
|
+
* `[1, 1]` at the bottom right of its position.
|
|
133
|
+
*
|
|
134
|
+
* @public
|
|
135
|
+
*/
|
|
121
136
|
export type NodeOrigin = [number, number];
|
|
122
137
|
export type OnSelectionDrag = (event: MouseEvent, nodes: NodeBase[]) => void;
|
|
138
|
+
/**
|
|
139
|
+
* Type for the handles of a node
|
|
140
|
+
*
|
|
141
|
+
* @public
|
|
142
|
+
*/
|
|
123
143
|
export type NodeHandle = Omit<Optional<Handle, 'width' | 'height'>, 'nodeId'>;
|
|
124
144
|
export type Align = 'center' | 'start' | 'end';
|
|
125
145
|
export type NodeLookup<NodeType extends InternalNodeBase = InternalNodeBase> = Map<string, NodeType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,GAAG,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,MAAM,QAAQ,CAClB,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,QAAQ,SAAS,MAAM,GAAG,MAAM,IAC9B;IACF,0BAA0B;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,QAAQ,EAAE,UAAU,CAAC;IACrB,sCAAsC;IACtC,IAAI,EAAE,QAAQ,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ErB,QAAQ,EAAE,UAAU,CAAC;IACrB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,SAAS,EAAE;QACT,gBAAgB,EAAE,UAAU,CAAC;KAC9B,CAAC;IACF,MAAM,CAAC,EAAE,QAAQ,GAAG,gBAAgB,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;AAE7E;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;AAE9E,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/C,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,gBAAgB,GAAG,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACrG,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,gBAAgB,GAAG,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC"}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* While [`PanelPosition`](/api-reference/types/panel-position) can be used to place a
|
|
3
|
+
* component in the corners of a container, the `Position` enum is less precise and used
|
|
4
|
+
* primarily in relation to edges and handles.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
1
8
|
export declare enum Position {
|
|
2
9
|
Left = "left",
|
|
3
10
|
Top = "top",
|
|
@@ -10,6 +17,11 @@ export declare const oppositePosition: {
|
|
|
10
17
|
top: Position;
|
|
11
18
|
bottom: Position;
|
|
12
19
|
};
|
|
20
|
+
/**
|
|
21
|
+
* All positions are stored in an object with x and y coordinates.
|
|
22
|
+
*
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
13
25
|
export type XYPosition = {
|
|
14
26
|
x: number;
|
|
15
27
|
y: number;
|
|
@@ -27,5 +39,15 @@ export type Box = XYPosition & {
|
|
|
27
39
|
y2: number;
|
|
28
40
|
};
|
|
29
41
|
export type Transform = [number, number, number];
|
|
42
|
+
/**
|
|
43
|
+
* A coordinate extent represents two points in a coordinate system: one in the top
|
|
44
|
+
* left corner and one in the bottom right corner. It is used to represent the
|
|
45
|
+
* bounds of nodes in the flow or the bounds of the viewport.
|
|
46
|
+
*
|
|
47
|
+
* @public
|
|
48
|
+
*
|
|
49
|
+
* @remarks Props that expect a `CoordinateExtent` usually default to `[[-∞, -∞], [+∞, +∞]]`
|
|
50
|
+
* to represent an unbounded extent.
|
|
51
|
+
*/
|
|
30
52
|
export type CoordinateExtent = [[number, number], [number, number]];
|
|
31
53
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/types/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,gBAAgB;;;;;CAK5B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG;IAAE,CAAC,EAAE,MAAM,CAAA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E,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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,CAS5D;AAED,eAAO,MAAM,YAAY,UAAW,UAAU,GAAG,UAAU,wBAA4C,CAAC;AAExG,eAAO,MAAM,gBAAgB,UAAW,UAAU,GAAG,UAAU,WAAW,OAAO;;;CAShF,CAAC;
|
|
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,CAS5D;AAED,eAAO,MAAM,YAAY,UAAW,UAAU,GAAG,UAAU,wBAA4C,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"}
|
|
@@ -27,7 +27,9 @@ export declare function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY
|
|
|
27
27
|
targetControlY: number;
|
|
28
28
|
}): [number, number, number, number];
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
30
|
+
* The `getBezierPath` util returns everything you need to render a bezier edge
|
|
31
|
+
*between two nodes.
|
|
32
|
+
* @public
|
|
31
33
|
* @param params.sourceX - The x position of the source handle
|
|
32
34
|
* @param params.sourceY - The y position of the source handle
|
|
33
35
|
* @param params.sourcePosition - The position of the source handle (default: Position.Bottom)
|
|
@@ -37,17 +39,22 @@ export declare function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY
|
|
|
37
39
|
* @param params.curvature - The curvature of the bezier edge
|
|
38
40
|
* @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
|
|
39
41
|
* @example
|
|
42
|
+
* ```js
|
|
40
43
|
* const source = { x: 0, y: 20 };
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
});
|
|
44
|
+
* const target = { x: 150, y: 100 };
|
|
45
|
+
*
|
|
46
|
+
* const [path, labelX, labelY, offsetX, offsetY] = getBezierPath({
|
|
47
|
+
* sourceX: source.x,
|
|
48
|
+
* sourceY: source.y,
|
|
49
|
+
* sourcePosition: Position.Right,
|
|
50
|
+
* targetX: target.x,
|
|
51
|
+
* targetY: target.y,
|
|
52
|
+
* targetPosition: Position.Left,
|
|
53
|
+
*});
|
|
54
|
+
*```
|
|
55
|
+
*
|
|
56
|
+
* @remarks This function returns a tuple (aka a fixed-size array) to make it easier to
|
|
57
|
+
*work with multiple edge paths at once.
|
|
51
58
|
*/
|
|
52
59
|
export declare function getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, curvature, }: GetBezierPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
|
|
53
60
|
//# sourceMappingURL=bezier-edge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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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,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;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"}
|
|
@@ -22,24 +22,37 @@ type IsEdgeVisibleParams = {
|
|
|
22
22
|
};
|
|
23
23
|
export declare function isEdgeVisible({ sourceNode, targetNode, width, height, transform }: IsEdgeVisibleParams): boolean;
|
|
24
24
|
/**
|
|
25
|
-
* This util is a convenience function to add a new Edge to an array of edges
|
|
26
|
-
* @remarks It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
|
|
25
|
+
* 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.
|
|
27
26
|
* @public
|
|
28
27
|
* @param edgeParams - Either an Edge or a Connection you want to add
|
|
29
28
|
* @param edges - The array of all current edges
|
|
30
29
|
* @returns A new array of edges with the new edge added
|
|
30
|
+
*
|
|
31
|
+
* @remarks If an edge with the same `target` and `source` already exists (and the same
|
|
32
|
+
*`targetHandle` and `sourceHandle` if those are set), then this util won't add
|
|
33
|
+
*a new edge even if the `id` property is different.
|
|
34
|
+
*
|
|
31
35
|
*/
|
|
32
36
|
export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[]) => EdgeType[];
|
|
33
37
|
export type ReconnectEdgeOptions = {
|
|
34
38
|
shouldReplaceId?: boolean;
|
|
35
39
|
};
|
|
36
40
|
/**
|
|
37
|
-
* A handy utility to
|
|
41
|
+
* A handy utility to update an existing [`Edge`](/api-reference/types/edge) with new properties.
|
|
42
|
+
*This searches your edge array for an edge with a matching `id` and updates its
|
|
43
|
+
*properties with the connection you provide.
|
|
44
|
+
* @public
|
|
38
45
|
* @param oldEdge - The edge you want to update
|
|
39
46
|
* @param newConnection - The new connection you want to update the edge with
|
|
40
47
|
* @param edges - The array of all current edges
|
|
41
48
|
* @param options.shouldReplaceId - should the id of the old edge be replaced with the new connection id
|
|
42
49
|
* @returns the updated edges array
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```js
|
|
53
|
+
*const onReconnect = useCallback(
|
|
54
|
+
* (oldEdge: Edge, newConnection: Connection) => setEdges((els) => reconnectEdge(oldEdge, newConnection, els)),[]);
|
|
55
|
+
*```
|
|
43
56
|
*/
|
|
44
57
|
export declare const reconnectEdge: <EdgeType extends EdgeBase>(oldEdge: EdgeType, newConnection: Connection, edges: EdgeType[], options?: ReconnectEdgeOptions) => EdgeType[];
|
|
45
58
|
export {};
|
|
@@ -1 +1 @@
|
|
|
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,MAAM,OAAO,CAAC;AAIrG,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;CAC3B,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,EACpC,UAAU,EACV,UAAU,EACV,QAAgB,EAChB,MAAU,EACV,eAAuB,GACxB,EAAE,mBAAmB,GAAG,MAAM,CAS9B;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
|
|
1
|
+
{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M,MAAM,oBAAoB,GAAG;IACjC,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,aAAa,uCACf,QAAQ,iBACF,UAAU,SAClB,QAAQ,EAAE,YACR,oBAAoB,KAC5B,QAAQ,EA4BV,CAAC"}
|
|
@@ -12,7 +12,10 @@ export interface GetSmoothStepPathParams {
|
|
|
12
12
|
offset?: number;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* The `getSmoothStepPath` util returns everything you need to render a stepped path
|
|
16
|
+
*between two nodes. The `borderRadius` property can be used to choose how rounded
|
|
17
|
+
*the corners of those steps are.
|
|
18
|
+
* @public
|
|
16
19
|
* @param params.sourceX - The x position of the source handle
|
|
17
20
|
* @param params.sourceY - The y position of the source handle
|
|
18
21
|
* @param params.sourcePosition - The position of the source handle (default: Position.Bottom)
|
|
@@ -21,17 +24,20 @@ export interface GetSmoothStepPathParams {
|
|
|
21
24
|
* @param params.targetPosition - The position of the target handle (default: Position.Top)
|
|
22
25
|
* @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
|
|
23
26
|
* @example
|
|
27
|
+
* ```js
|
|
24
28
|
* const source = { x: 0, y: 20 };
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
* const target = { x: 150, y: 100 };
|
|
30
|
+
*
|
|
31
|
+
* const [path, labelX, labelY, offsetX, offsetY] = getSmoothStepPath({
|
|
32
|
+
* sourceX: source.x,
|
|
33
|
+
* sourceY: source.y,
|
|
34
|
+
* sourcePosition: Position.Right,
|
|
35
|
+
* targetX: target.x,
|
|
36
|
+
* targetY: target.y,
|
|
37
|
+
* targetPosition: Position.Left,
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
* @remarks This function returns a tuple (aka a fixed-size array) to make it easier to work with multiple edge paths at once.
|
|
35
41
|
*/
|
|
36
42
|
export declare function getSmoothStepPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, borderRadius, centerX, centerY, offset, }: GetSmoothStepPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
|
|
37
43
|
//# sourceMappingURL=smoothstep-edge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;
|
|
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,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAwLD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,YAAgB,EAChB,OAAO,EACP,OAAO,EACP,MAAW,GACZ,EAAE,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAyB5G"}
|
|
@@ -5,24 +5,28 @@ export type GetStraightPathParams = {
|
|
|
5
5
|
targetY: number;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
-
*
|
|
8
|
+
* Calculates the straight line path between two points.
|
|
9
|
+
* @public
|
|
9
10
|
* @param params.sourceX - The x position of the source handle
|
|
10
11
|
* @param params.sourceY - The y position of the source handle
|
|
11
12
|
* @param params.targetX - The x position of the target handle
|
|
12
13
|
* @param params.targetY - The y position of the target handle
|
|
13
14
|
* @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
|
|
14
15
|
* @example
|
|
16
|
+
* ```js
|
|
15
17
|
* const source = { x: 0, y: 20 };
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
* const target = { x: 150, y: 100 };
|
|
19
|
+
*
|
|
20
|
+
* const [path, labelX, labelY, offsetX, offsetY] = getStraightPath({
|
|
21
|
+
* sourceX: source.x,
|
|
22
|
+
* sourceY: source.y,
|
|
23
|
+
* sourcePosition: Position.Right,
|
|
24
|
+
* targetX: target.x,
|
|
25
|
+
* targetY: target.y,
|
|
26
|
+
* targetPosition: Position.Left,
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
* @remarks This function returns a tuple (aka a fixed-size array) to make it easier to work with multiple edge paths at once.
|
|
26
30
|
*/
|
|
27
31
|
export declare function getStraightPath({ sourceX, sourceY, targetX, targetY, }: GetStraightPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
|
|
28
32
|
//# sourceMappingURL=straight-edge.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"straight-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/straight-edge.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"straight-edge.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/straight-edge.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAAG;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;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"}
|
|
@@ -36,8 +36,8 @@ export declare const rendererPointToPoint: ({ x, y }: XYPosition, [tx, ty, tScal
|
|
|
36
36
|
* @returns A transforned {@link Viewport} that encloses the given bounds which you can pass to e.g. {@link setViewport}
|
|
37
37
|
* @example
|
|
38
38
|
* const { x, y, zoom } = getViewportForBounds(
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
*{ x: 0, y: 0, width: 100, height: 100},
|
|
40
|
+
*1200, 800, 0.5, 2);
|
|
41
41
|
*/
|
|
42
42
|
export declare const getViewportForBounds: (bounds: Rect, width: number, height: number, minZoom: number, maxZoom: number, padding: number) => Viewport;
|
|
43
43
|
export declare const isMacOs: () => boolean;
|