@angflow/system 0.0.88 → 0.0.93
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/constants.d.ts +43 -0
- package/dist/esm/constants.d.ts.map +1 -0
- package/dist/esm/index.d.ts +9 -8
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +10 -7
- package/dist/esm/index.mjs +10 -7
- package/dist/esm/types/changes.d.ts +64 -0
- package/dist/esm/types/changes.d.ts.map +1 -0
- package/dist/esm/types/edges.d.ts +140 -0
- package/dist/esm/types/edges.d.ts.map +1 -0
- package/dist/esm/types/general.d.ts +296 -0
- package/dist/esm/types/general.d.ts.map +1 -0
- package/dist/esm/types/handles.d.ts +65 -0
- package/dist/esm/types/handles.d.ts.map +1 -0
- package/dist/esm/types/index.d.ts +8 -0
- package/dist/esm/types/index.d.ts.map +1 -0
- package/dist/esm/types/nodes.d.ts +157 -0
- package/dist/esm/types/nodes.d.ts.map +1 -0
- package/dist/esm/types/panzoom.d.ts +55 -0
- package/dist/esm/types/panzoom.d.ts.map +1 -0
- package/dist/esm/types/utils.d.ts +61 -0
- package/dist/esm/types/utils.d.ts.map +1 -0
- package/dist/esm/utils/connections.d.ts +13 -0
- package/dist/esm/utils/connections.d.ts.map +1 -0
- package/dist/esm/utils/dom.d.ts +21 -0
- package/dist/esm/utils/dom.d.ts.map +1 -0
- package/dist/esm/utils/edge-toolbar.d.ts +2 -0
- package/dist/esm/utils/edge-toolbar.d.ts.map +1 -0
- package/dist/esm/utils/edges/bezier-edge.d.ts +77 -0
- package/dist/esm/utils/edges/bezier-edge.d.ts.map +1 -0
- package/dist/esm/utils/edges/floating.d.ts +32 -0
- package/dist/esm/utils/edges/floating.d.ts.map +1 -0
- package/dist/esm/utils/edges/general.d.ts +91 -0
- package/dist/esm/utils/edges/general.d.ts.map +1 -0
- package/dist/esm/utils/edges/index.d.ts +7 -0
- package/dist/esm/utils/edges/index.d.ts.map +1 -0
- package/dist/esm/utils/edges/positions.d.ts +17 -0
- package/dist/esm/utils/edges/positions.d.ts.map +1 -0
- package/dist/esm/utils/edges/smoothstep-edge.d.ts +66 -0
- package/dist/esm/utils/edges/smoothstep-edge.d.ts.map +1 -0
- package/dist/esm/utils/edges/straight-edge.d.ts +41 -0
- package/dist/esm/utils/edges/straight-edge.d.ts.map +1 -0
- package/dist/esm/utils/general.d.ts +86 -0
- package/dist/esm/utils/general.d.ts.map +1 -0
- package/dist/esm/utils/graph.d.ts +191 -0
- package/dist/esm/utils/graph.d.ts.map +1 -0
- package/dist/esm/utils/index.d.ts +12 -0
- package/dist/esm/utils/index.d.ts.map +1 -0
- package/dist/esm/utils/marker.d.ts +9 -0
- package/dist/esm/utils/marker.d.ts.map +1 -0
- package/dist/esm/utils/node-toolbar.d.ts +3 -0
- package/dist/esm/utils/node-toolbar.d.ts.map +1 -0
- package/dist/esm/utils/shallow-node-data.d.ts +5 -0
- package/dist/esm/utils/shallow-node-data.d.ts.map +1 -0
- package/dist/esm/utils/store.d.ts +34 -0
- package/dist/esm/utils/store.d.ts.map +1 -0
- package/dist/esm/utils/types.d.ts +8 -0
- package/dist/esm/utils/types.d.ts.map +1 -0
- package/dist/esm/xydrag/XYDrag.d.ts +55 -0
- package/dist/esm/xydrag/XYDrag.d.ts.map +1 -0
- package/dist/esm/xydrag/index.d.ts +2 -0
- package/dist/esm/xydrag/index.d.ts.map +1 -0
- package/dist/esm/xydrag/utils.d.ts +24 -0
- package/dist/esm/xydrag/utils.d.ts.map +1 -0
- package/dist/esm/xyhandle/XYHandle.d.ts +3 -0
- package/dist/esm/xyhandle/XYHandle.d.ts.map +1 -0
- package/dist/esm/xyhandle/index.d.ts +2 -0
- package/dist/esm/xyhandle/index.d.ts.map +1 -0
- package/dist/esm/xyhandle/types.d.ts +51 -0
- package/dist/esm/xyhandle/types.d.ts.map +1 -0
- package/dist/esm/xyhandle/utils.d.ts +29 -0
- package/dist/esm/xyhandle/utils.d.ts.map +1 -0
- package/dist/esm/xyminimap/index.d.ts +28 -0
- package/dist/esm/xyminimap/index.d.ts.map +1 -0
- package/dist/esm/xypanzoom/XYPanZoom.d.ts +12 -0
- package/dist/esm/xypanzoom/XYPanZoom.d.ts.map +1 -0
- package/dist/esm/xypanzoom/eventhandler.d.ts +46 -0
- package/dist/esm/xypanzoom/eventhandler.d.ts.map +1 -0
- package/dist/esm/xypanzoom/filter.d.ts +15 -0
- package/dist/esm/xypanzoom/filter.d.ts.map +1 -0
- package/dist/esm/xypanzoom/index.d.ts +2 -0
- package/dist/esm/xypanzoom/index.d.ts.map +1 -0
- package/dist/esm/xypanzoom/utils.d.ts +9 -0
- package/dist/esm/xypanzoom/utils.d.ts.map +1 -0
- package/dist/esm/xyresizer/XYResizer.d.ts +49 -0
- package/dist/esm/xyresizer/XYResizer.d.ts.map +1 -0
- package/dist/esm/xyresizer/index.d.ts +3 -0
- package/dist/esm/xyresizer/index.d.ts.map +1 -0
- package/dist/esm/xyresizer/types.d.ts +59 -0
- package/dist/esm/xyresizer/types.d.ts.map +1 -0
- package/dist/esm/xyresizer/utils.d.ts +76 -0
- package/dist/esm/xyresizer/utils.d.ts.map +1 -0
- package/dist/umd/constants.d.ts +43 -0
- package/dist/umd/constants.d.ts.map +1 -0
- package/dist/umd/index.d.ts +9 -0
- package/dist/umd/index.d.ts.map +1 -0
- package/dist/umd/index.js +1 -1
- package/dist/umd/types/changes.d.ts +64 -0
- package/dist/umd/types/changes.d.ts.map +1 -0
- package/dist/umd/types/edges.d.ts +140 -0
- package/dist/umd/types/edges.d.ts.map +1 -0
- package/dist/umd/types/general.d.ts +296 -0
- package/dist/umd/types/general.d.ts.map +1 -0
- package/dist/umd/types/handles.d.ts +65 -0
- package/dist/umd/types/handles.d.ts.map +1 -0
- package/dist/umd/types/index.d.ts +8 -0
- package/dist/umd/types/index.d.ts.map +1 -0
- package/dist/umd/types/nodes.d.ts +157 -0
- package/dist/umd/types/nodes.d.ts.map +1 -0
- package/dist/umd/types/panzoom.d.ts +55 -0
- package/dist/umd/types/panzoom.d.ts.map +1 -0
- package/dist/umd/types/utils.d.ts +61 -0
- package/dist/umd/types/utils.d.ts.map +1 -0
- package/dist/umd/utils/connections.d.ts +13 -0
- package/dist/umd/utils/connections.d.ts.map +1 -0
- package/dist/umd/utils/dom.d.ts +21 -0
- package/dist/umd/utils/dom.d.ts.map +1 -0
- package/dist/umd/utils/edge-toolbar.d.ts +2 -0
- package/dist/umd/utils/edge-toolbar.d.ts.map +1 -0
- package/dist/umd/utils/edges/bezier-edge.d.ts +77 -0
- package/dist/umd/utils/edges/bezier-edge.d.ts.map +1 -0
- package/dist/umd/utils/edges/floating.d.ts +32 -0
- package/dist/umd/utils/edges/floating.d.ts.map +1 -0
- package/dist/umd/utils/edges/general.d.ts +91 -0
- package/dist/umd/utils/edges/general.d.ts.map +1 -0
- package/dist/umd/utils/edges/index.d.ts +7 -0
- package/dist/umd/utils/edges/index.d.ts.map +1 -0
- package/dist/umd/utils/edges/positions.d.ts +17 -0
- package/dist/umd/utils/edges/positions.d.ts.map +1 -0
- package/dist/umd/utils/edges/smoothstep-edge.d.ts +66 -0
- package/dist/umd/utils/edges/smoothstep-edge.d.ts.map +1 -0
- package/dist/umd/utils/edges/straight-edge.d.ts +41 -0
- package/dist/umd/utils/edges/straight-edge.d.ts.map +1 -0
- package/dist/umd/utils/general.d.ts +86 -0
- package/dist/umd/utils/general.d.ts.map +1 -0
- package/dist/umd/utils/graph.d.ts +191 -0
- package/dist/umd/utils/graph.d.ts.map +1 -0
- package/dist/umd/utils/index.d.ts +12 -0
- package/dist/umd/utils/index.d.ts.map +1 -0
- package/dist/umd/utils/marker.d.ts +9 -0
- package/dist/umd/utils/marker.d.ts.map +1 -0
- package/dist/umd/utils/node-toolbar.d.ts +3 -0
- package/dist/umd/utils/node-toolbar.d.ts.map +1 -0
- package/dist/umd/utils/shallow-node-data.d.ts +5 -0
- package/dist/umd/utils/shallow-node-data.d.ts.map +1 -0
- package/dist/umd/utils/store.d.ts +34 -0
- package/dist/umd/utils/store.d.ts.map +1 -0
- package/dist/umd/utils/types.d.ts +8 -0
- package/dist/umd/utils/types.d.ts.map +1 -0
- package/dist/umd/xydrag/XYDrag.d.ts +55 -0
- package/dist/umd/xydrag/XYDrag.d.ts.map +1 -0
- package/dist/umd/xydrag/index.d.ts +2 -0
- package/dist/umd/xydrag/index.d.ts.map +1 -0
- package/dist/umd/xydrag/utils.d.ts +24 -0
- package/dist/umd/xydrag/utils.d.ts.map +1 -0
- package/dist/umd/xyhandle/XYHandle.d.ts +3 -0
- package/dist/umd/xyhandle/XYHandle.d.ts.map +1 -0
- package/dist/umd/xyhandle/index.d.ts +2 -0
- package/dist/umd/xyhandle/index.d.ts.map +1 -0
- package/dist/umd/xyhandle/types.d.ts +51 -0
- package/dist/umd/xyhandle/types.d.ts.map +1 -0
- package/dist/umd/xyhandle/utils.d.ts +29 -0
- package/dist/umd/xyhandle/utils.d.ts.map +1 -0
- package/dist/umd/xyminimap/index.d.ts +28 -0
- package/dist/umd/xyminimap/index.d.ts.map +1 -0
- package/dist/umd/xypanzoom/XYPanZoom.d.ts +12 -0
- package/dist/umd/xypanzoom/XYPanZoom.d.ts.map +1 -0
- package/dist/umd/xypanzoom/eventhandler.d.ts +46 -0
- package/dist/umd/xypanzoom/eventhandler.d.ts.map +1 -0
- package/dist/umd/xypanzoom/filter.d.ts +15 -0
- package/dist/umd/xypanzoom/filter.d.ts.map +1 -0
- package/dist/umd/xypanzoom/index.d.ts +2 -0
- package/dist/umd/xypanzoom/index.d.ts.map +1 -0
- package/dist/umd/xypanzoom/utils.d.ts +9 -0
- package/dist/umd/xypanzoom/utils.d.ts.map +1 -0
- package/dist/umd/xyresizer/XYResizer.d.ts +49 -0
- package/dist/umd/xyresizer/XYResizer.d.ts.map +1 -0
- package/dist/umd/xyresizer/index.d.ts +3 -0
- package/dist/umd/xyresizer/index.d.ts.map +1 -0
- package/dist/umd/xyresizer/types.d.ts +59 -0
- package/dist/umd/xyresizer/types.d.ts.map +1 -0
- package/dist/umd/xyresizer/utils.d.ts +76 -0
- package/dist/umd/xyresizer/utils.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Position } from '../../types';
|
|
2
|
+
export interface GetSmoothStepPathParams {
|
|
3
|
+
/** The `x` position of the source handle. */
|
|
4
|
+
sourceX: number;
|
|
5
|
+
/** The `y` position of the source handle. */
|
|
6
|
+
sourceY: number;
|
|
7
|
+
/**
|
|
8
|
+
* The position of the source handle.
|
|
9
|
+
* @default Position.Bottom
|
|
10
|
+
*/
|
|
11
|
+
sourcePosition?: Position;
|
|
12
|
+
/** The `x` position of the target handle. */
|
|
13
|
+
targetX: number;
|
|
14
|
+
/** The `y` position of the target handle. */
|
|
15
|
+
targetY: number;
|
|
16
|
+
/**
|
|
17
|
+
* The position of the target handle.
|
|
18
|
+
* @default Position.Top
|
|
19
|
+
*/
|
|
20
|
+
targetPosition?: Position;
|
|
21
|
+
/** @default 5 */
|
|
22
|
+
borderRadius?: number;
|
|
23
|
+
centerX?: number;
|
|
24
|
+
centerY?: number;
|
|
25
|
+
/** @default 20 */
|
|
26
|
+
offset?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Controls where the bend occurs along the path.
|
|
29
|
+
* 0 = at source, 1 = at target, 0.5 = midpoint
|
|
30
|
+
* @default 0.5
|
|
31
|
+
*/
|
|
32
|
+
stepPosition?: number;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The `getSmoothStepPath` util returns everything you need to render a stepped path
|
|
36
|
+
* between two nodes. The `borderRadius` property can be used to choose how rounded
|
|
37
|
+
* the corners of those steps are.
|
|
38
|
+
* @public
|
|
39
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
40
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
41
|
+
*
|
|
42
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
43
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
44
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
45
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
46
|
+
* middle of this path.
|
|
47
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
48
|
+
* middle of this path.
|
|
49
|
+
* @example
|
|
50
|
+
* ```js
|
|
51
|
+
* const source = { x: 0, y: 20 };
|
|
52
|
+
* const target = { x: 150, y: 100 };
|
|
53
|
+
*
|
|
54
|
+
* const [path, labelX, labelY, offsetX, offsetY] = getSmoothStepPath({
|
|
55
|
+
* sourceX: source.x,
|
|
56
|
+
* sourceY: source.y,
|
|
57
|
+
* sourcePosition: Position.Right,
|
|
58
|
+
* targetX: target.x,
|
|
59
|
+
* targetY: target.y,
|
|
60
|
+
* targetPosition: Position.Left,
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
63
|
+
* @remarks This function returns a tuple (aka a fixed-size array) to make it easier to work with multiple edge paths at once.
|
|
64
|
+
*/
|
|
65
|
+
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];
|
|
66
|
+
//# sourceMappingURL=smoothstep-edge.d.ts.map
|
|
@@ -0,0 +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,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;AAwMD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,CAoB5G"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type GetStraightPathParams = {
|
|
2
|
+
/** The `x` position of the source handle. */
|
|
3
|
+
sourceX: number;
|
|
4
|
+
/** The `y` position of the source handle. */
|
|
5
|
+
sourceY: number;
|
|
6
|
+
/** The `x` position of the target handle. */
|
|
7
|
+
targetX: number;
|
|
8
|
+
/** The `y` position of the target handle. */
|
|
9
|
+
targetY: number;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Calculates the straight line path between two points.
|
|
13
|
+
* @public
|
|
14
|
+
* @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
|
|
15
|
+
* and `offsetX`, `offsetY` between source handle and label.
|
|
16
|
+
*
|
|
17
|
+
* - `path`: the path to use in an SVG `<path>` element.
|
|
18
|
+
* - `labelX`: the `x` position you can use to render a label for this edge.
|
|
19
|
+
* - `labelY`: the `y` position you can use to render a label for this edge.
|
|
20
|
+
* - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
|
|
21
|
+
* middle of this path.
|
|
22
|
+
* - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
|
|
23
|
+
* middle of this path.
|
|
24
|
+
* @example
|
|
25
|
+
* ```js
|
|
26
|
+
* const source = { x: 0, y: 20 };
|
|
27
|
+
* const target = { x: 150, y: 100 };
|
|
28
|
+
*
|
|
29
|
+
* const [path, labelX, labelY, offsetX, offsetY] = getStraightPath({
|
|
30
|
+
* sourceX: source.x,
|
|
31
|
+
* sourceY: source.y,
|
|
32
|
+
* sourcePosition: Position.Right,
|
|
33
|
+
* targetX: target.x,
|
|
34
|
+
* targetY: target.y,
|
|
35
|
+
* targetPosition: Position.Left,
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
* @remarks This function returns a tuple (aka a fixed-size array) to make it easier to work with multiple edge paths at once.
|
|
39
|
+
*/
|
|
40
|
+
export declare function getStraightPath({ sourceX, sourceY, targetX, targetY, }: GetStraightPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
|
|
41
|
+
//# sourceMappingURL=straight-edge.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Dimensions, XYPosition, CoordinateExtent, Box, Rect, NodeBase, NodeOrigin, SnapGrid, Transform, InternalNodeBase, NodeLookup, Padding } from '../types';
|
|
2
|
+
import { type Viewport } from '../types';
|
|
3
|
+
import { type AriaLabelConfig } from '../constants';
|
|
4
|
+
export declare const clamp: (val: number, min?: number, max?: number) => number;
|
|
5
|
+
export declare const clampPosition: (position: XYPosition | undefined, extent: CoordinateExtent, dimensions: Partial<Dimensions>) => {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function clampPositionToParent<NodeType extends NodeBase>(childPosition: XYPosition, childDimensions: Dimensions, parent: InternalNodeBase<NodeType>): {
|
|
10
|
+
x: number;
|
|
11
|
+
y: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const calcAutoPan: (pos: XYPosition, bounds: Dimensions, speed?: number, distance?: number) => number[];
|
|
14
|
+
export declare const getBoundsOfBoxes: (box1: Box, box2: Box) => Box;
|
|
15
|
+
export declare const rectToBox: ({ x, y, width, height }: Rect) => Box;
|
|
16
|
+
export declare const boxToRect: ({ x, y, x2, y2 }: Box) => Rect;
|
|
17
|
+
export declare const nodeToRect: (node: InternalNodeBase | NodeBase, nodeOrigin?: NodeOrigin) => Rect;
|
|
18
|
+
export declare const nodeToBox: (node: InternalNodeBase | NodeBase, nodeOrigin?: NodeOrigin) => Box;
|
|
19
|
+
export declare const getBoundsOfRects: (rect1: Rect, rect2: Rect) => Rect;
|
|
20
|
+
export declare const getOverlappingArea: (rectA: Rect, rectB: Rect) => number;
|
|
21
|
+
export declare const isRectObject: (obj: any) => obj is Rect;
|
|
22
|
+
export declare const isNumeric: (n: any) => n is number;
|
|
23
|
+
export declare const isDevEnv: () => boolean;
|
|
24
|
+
export declare const devWarn: (id: string, message: string) => void;
|
|
25
|
+
export declare const snapPosition: (position: XYPosition, snapGrid?: SnapGrid) => XYPosition;
|
|
26
|
+
export declare const pointToRendererPoint: ({ x, y }: XYPosition, [tx, ty, tScale]: Transform, snapToGrid?: boolean, snapGrid?: SnapGrid) => XYPosition;
|
|
27
|
+
export declare const rendererPointToPoint: ({ x, y }: XYPosition, [tx, ty, tScale]: Transform) => XYPosition;
|
|
28
|
+
/**
|
|
29
|
+
* Returns a viewport that encloses the given bounds with padding.
|
|
30
|
+
* @public
|
|
31
|
+
* @remarks You can determine bounds of nodes with {@link getNodesBounds} and {@link getBoundsOfRects}
|
|
32
|
+
* @param bounds - Bounds to fit inside viewport.
|
|
33
|
+
* @param width - Width of the viewport.
|
|
34
|
+
* @param height - Height of the viewport.
|
|
35
|
+
* @param minZoom - Minimum zoom level of the resulting viewport.
|
|
36
|
+
* @param maxZoom - Maximum zoom level of the resulting viewport.
|
|
37
|
+
* @param padding - Padding around the bounds.
|
|
38
|
+
* @returns A transformed {@link Viewport} that encloses the given bounds which you can pass to e.g. {@link setViewport}.
|
|
39
|
+
* @example
|
|
40
|
+
* const { x, y, zoom } = getViewportForBounds(
|
|
41
|
+
* { x: 0, y: 0, width: 100, height: 100},
|
|
42
|
+
* 1200, 800, 0.5, 2);
|
|
43
|
+
*/
|
|
44
|
+
export declare const getViewportForBounds: (bounds: Rect, width: number, height: number, minZoom: number, maxZoom: number, padding: Padding) => Viewport;
|
|
45
|
+
export declare const isMacOs: () => boolean;
|
|
46
|
+
export declare function isCoordinateExtent(extent?: CoordinateExtent | 'parent' | null): extent is CoordinateExtent;
|
|
47
|
+
export declare function getNodeDimensions(node: {
|
|
48
|
+
measured?: {
|
|
49
|
+
width?: number;
|
|
50
|
+
height?: number;
|
|
51
|
+
};
|
|
52
|
+
width?: number;
|
|
53
|
+
height?: number;
|
|
54
|
+
initialWidth?: number;
|
|
55
|
+
initialHeight?: number;
|
|
56
|
+
}): {
|
|
57
|
+
width: number;
|
|
58
|
+
height: number;
|
|
59
|
+
};
|
|
60
|
+
export declare function nodeHasDimensions<NodeType extends NodeBase = NodeBase>(node: NodeType): boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Convert child position to absolute position
|
|
63
|
+
*
|
|
64
|
+
* @internal
|
|
65
|
+
* @param position
|
|
66
|
+
* @param parentId
|
|
67
|
+
* @param nodeLookup
|
|
68
|
+
* @param nodeOrigin
|
|
69
|
+
* @returns an internal node with an absolute position
|
|
70
|
+
*/
|
|
71
|
+
export declare function evaluateAbsolutePosition(position: XYPosition, dimensions: {
|
|
72
|
+
width?: number;
|
|
73
|
+
height?: number;
|
|
74
|
+
} | undefined, parentId: string, nodeLookup: NodeLookup, nodeOrigin: NodeOrigin): XYPosition;
|
|
75
|
+
export declare function areSetsEqual(a: Set<string>, b: Set<string>): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Polyfill for Promise.withResolvers until we can use it in all browsers
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
export declare function withResolvers<T>(): {
|
|
81
|
+
promise: Promise<T>;
|
|
82
|
+
resolve: (value: T | PromiseLike<T>) => void;
|
|
83
|
+
reject: (reason?: unknown) => void;
|
|
84
|
+
};
|
|
85
|
+
export declare function mergeAriaLabelConfig(partial?: Partial<AriaLabelConfig>): AriaLabelConfig;
|
|
86
|
+
//# sourceMappingURL=general.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/utils/general.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,GAAG,EACH,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,UAAU,EACV,OAAO,EAER,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGzC,OA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;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,UAAU,EACpB,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"}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
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';
|
|
2
|
+
/**
|
|
3
|
+
* Test whether an object is usable as an Edge
|
|
4
|
+
* @public
|
|
5
|
+
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Edge if it returns true
|
|
6
|
+
* @param element - The element to test
|
|
7
|
+
* @returns A boolean indicating whether the element is an Edge
|
|
8
|
+
*/
|
|
9
|
+
export declare const isEdgeBase: <EdgeType extends EdgeBase = EdgeBase>(element: any) => element is EdgeType;
|
|
10
|
+
/**
|
|
11
|
+
* Test whether an object is usable as a Node
|
|
12
|
+
* @public
|
|
13
|
+
* @remarks In TypeScript this is a type guard that will narrow the type of whatever you pass in to Node if it returns true
|
|
14
|
+
* @param element - The element to test
|
|
15
|
+
* @returns A boolean indicating whether the element is an Node
|
|
16
|
+
*/
|
|
17
|
+
export declare const isNodeBase: <NodeType extends NodeBase = NodeBase>(element: any) => element is NodeType;
|
|
18
|
+
export declare const isInternalNodeBase: <NodeType extends InternalNodeBase = InternalNodeBase>(element: any) => element is NodeType;
|
|
19
|
+
/**
|
|
20
|
+
* This util is used to tell you what nodes, if any, are connected to the given node
|
|
21
|
+
* as the _target_ of an edge.
|
|
22
|
+
* @public
|
|
23
|
+
* @param node - The node to get the connected nodes from.
|
|
24
|
+
* @param nodes - The array of all nodes.
|
|
25
|
+
* @param edges - The array of all edges.
|
|
26
|
+
* @returns An array of nodes that are connected over edges where the source is the given node.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
*import { getOutgoers } from '@xyflow/react';
|
|
31
|
+
*
|
|
32
|
+
*const nodes = [];
|
|
33
|
+
*const edges = [];
|
|
34
|
+
*
|
|
35
|
+
*const outgoers = getOutgoers(
|
|
36
|
+
* { id: '1', position: { x: 0, y: 0 }, data: { label: 'node' } },
|
|
37
|
+
* nodes,
|
|
38
|
+
* edges,
|
|
39
|
+
*);
|
|
40
|
+
*```
|
|
41
|
+
*/
|
|
42
|
+
export declare const getOutgoers: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(node: NodeType | {
|
|
43
|
+
id: string;
|
|
44
|
+
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[];
|
|
45
|
+
/**
|
|
46
|
+
* This util is used to tell you what nodes, if any, are connected to the given node
|
|
47
|
+
* as the _source_ of an edge.
|
|
48
|
+
* @public
|
|
49
|
+
* @param node - The node to get the connected nodes from.
|
|
50
|
+
* @param nodes - The array of all nodes.
|
|
51
|
+
* @param edges - The array of all edges.
|
|
52
|
+
* @returns An array of nodes that are connected over edges where the target is the given node.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
*import { getIncomers } from '@xyflow/react';
|
|
57
|
+
*
|
|
58
|
+
*const nodes = [];
|
|
59
|
+
*const edges = [];
|
|
60
|
+
*
|
|
61
|
+
*const incomers = getIncomers(
|
|
62
|
+
* { id: '1', position: { x: 0, y: 0 }, data: { label: 'node' } },
|
|
63
|
+
* nodes,
|
|
64
|
+
* edges,
|
|
65
|
+
*);
|
|
66
|
+
*```
|
|
67
|
+
*/
|
|
68
|
+
export declare const getIncomers: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(node: NodeType | {
|
|
69
|
+
id: string;
|
|
70
|
+
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[];
|
|
71
|
+
export declare const getNodePositionWithOrigin: (node: NodeBase, nodeOrigin?: NodeOrigin) => XYPosition;
|
|
72
|
+
export type GetNodesBoundsParams<NodeType extends NodeBase = NodeBase> = {
|
|
73
|
+
/**
|
|
74
|
+
* Origin of the nodes: `[0, 0]` for top-left, `[0.5, 0.5]` for center.
|
|
75
|
+
* @default [0, 0]
|
|
76
|
+
*/
|
|
77
|
+
nodeOrigin?: NodeOrigin;
|
|
78
|
+
nodeLookup?: NodeLookup<InternalNodeBase<NodeType>>;
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* Returns the bounding box that contains all the given nodes in an array. This can
|
|
82
|
+
* be useful when combined with [`getViewportForBounds`](/api-reference/utils/get-viewport-for-bounds)
|
|
83
|
+
* to calculate the correct transform to fit the given nodes in a viewport.
|
|
84
|
+
* @public
|
|
85
|
+
* @remarks Useful when combined with {@link getViewportForBounds} to calculate the correct transform to fit the given nodes in a viewport.
|
|
86
|
+
* @param nodes - Nodes to calculate the bounds for.
|
|
87
|
+
* @returns Bounding box enclosing all nodes.
|
|
88
|
+
*
|
|
89
|
+
* @remarks This function was previously called `getRectOfNodes`
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```js
|
|
93
|
+
*import { getNodesBounds } from '@xyflow/react';
|
|
94
|
+
*
|
|
95
|
+
*const nodes = [
|
|
96
|
+
* {
|
|
97
|
+
* id: 'a',
|
|
98
|
+
* position: { x: 0, y: 0 },
|
|
99
|
+
* data: { label: 'a' },
|
|
100
|
+
* width: 50,
|
|
101
|
+
* height: 25,
|
|
102
|
+
* },
|
|
103
|
+
* {
|
|
104
|
+
* id: 'b',
|
|
105
|
+
* position: { x: 100, y: 100 },
|
|
106
|
+
* data: { label: 'b' },
|
|
107
|
+
* width: 50,
|
|
108
|
+
* height: 25,
|
|
109
|
+
* },
|
|
110
|
+
*];
|
|
111
|
+
*
|
|
112
|
+
*const bounds = getNodesBounds(nodes);
|
|
113
|
+
*```
|
|
114
|
+
*/
|
|
115
|
+
export declare const getNodesBounds: <NodeType extends NodeBase = NodeBase>(nodes: (NodeType | InternalNodeBase<NodeType> | string)[], params?: GetNodesBoundsParams<NodeType>) => Rect;
|
|
116
|
+
export type GetInternalNodesBoundsParams<NodeType> = {
|
|
117
|
+
useRelativePosition?: boolean;
|
|
118
|
+
filter?: (node: NodeType) => boolean;
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Determines a bounding box that contains all given nodes in an array
|
|
122
|
+
* @internal
|
|
123
|
+
*/
|
|
124
|
+
export declare const getInternalNodesBounds: <NodeType extends InternalNodeBase | NodeDragItem>(nodeLookup: Map<string, NodeType>, params?: GetInternalNodesBoundsParams<NodeType>) => Rect;
|
|
125
|
+
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>[];
|
|
126
|
+
/**
|
|
127
|
+
* This utility filters an array of edges, keeping only those where either the source or target
|
|
128
|
+
* node is present in the given array of nodes.
|
|
129
|
+
* @public
|
|
130
|
+
* @param nodes - Nodes you want to get the connected edges for.
|
|
131
|
+
* @param edges - All edges.
|
|
132
|
+
* @returns Array of edges that connect any of the given nodes with each other.
|
|
133
|
+
*
|
|
134
|
+
* @example
|
|
135
|
+
* ```js
|
|
136
|
+
*import { getConnectedEdges } from '@xyflow/react';
|
|
137
|
+
*
|
|
138
|
+
*const nodes = [
|
|
139
|
+
* { id: 'a', position: { x: 0, y: 0 } },
|
|
140
|
+
* { id: 'b', position: { x: 100, y: 0 } },
|
|
141
|
+
*];
|
|
142
|
+
*
|
|
143
|
+
*const edges = [
|
|
144
|
+
* { id: 'a->c', source: 'a', target: 'c' },
|
|
145
|
+
* { id: 'c->d', source: 'c', target: 'd' },
|
|
146
|
+
*];
|
|
147
|
+
*
|
|
148
|
+
*const connectedEdges = getConnectedEdges(nodes, edges);
|
|
149
|
+
* // => [{ id: 'a->c', source: 'a', target: 'c' }]
|
|
150
|
+
*```
|
|
151
|
+
*/
|
|
152
|
+
export declare const getConnectedEdges: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(nodes: NodeType[], edges: EdgeType[]) => EdgeType[];
|
|
153
|
+
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>;
|
|
154
|
+
/**
|
|
155
|
+
* This function calculates the next position of a node, taking into account the node's extent, parent node, and origin.
|
|
156
|
+
*
|
|
157
|
+
* @internal
|
|
158
|
+
* @returns position, positionAbsolute
|
|
159
|
+
*/
|
|
160
|
+
export declare function calculateNodePosition<NodeType extends NodeBase>({ nodeId, nextPosition, nodeLookup, nodeOrigin, nodeExtent, onError, }: {
|
|
161
|
+
nodeId: string;
|
|
162
|
+
nextPosition: XYPosition;
|
|
163
|
+
nodeLookup: NodeLookup<InternalNodeBase<NodeType>>;
|
|
164
|
+
nodeOrigin?: NodeOrigin;
|
|
165
|
+
nodeExtent?: CoordinateExtent;
|
|
166
|
+
onError?: OnError;
|
|
167
|
+
}): {
|
|
168
|
+
position: XYPosition;
|
|
169
|
+
positionAbsolute: XYPosition;
|
|
170
|
+
};
|
|
171
|
+
/**
|
|
172
|
+
* Pass in nodes & edges to delete, get arrays of nodes and edges that actually can be deleted
|
|
173
|
+
* @internal
|
|
174
|
+
* @param param.nodesToRemove - The nodes to remove
|
|
175
|
+
* @param param.edgesToRemove - The edges to remove
|
|
176
|
+
* @param param.nodes - All nodes
|
|
177
|
+
* @param param.edges - All edges
|
|
178
|
+
* @param param.onBeforeDelete - Callback to check which nodes and edges can be deleted
|
|
179
|
+
* @returns nodes: nodes that can be deleted, edges: edges that can be deleted
|
|
180
|
+
*/
|
|
181
|
+
export declare function getElementsToRemove<NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>({ nodesToRemove, edgesToRemove, nodes, edges, onBeforeDelete, }: {
|
|
182
|
+
nodesToRemove: Partial<NodeType>[];
|
|
183
|
+
edgesToRemove: Partial<EdgeType>[];
|
|
184
|
+
nodes: NodeType[];
|
|
185
|
+
edges: EdgeType[];
|
|
186
|
+
onBeforeDelete?: OnBeforeDeleteBase<NodeType, EdgeType>;
|
|
187
|
+
}): Promise<{
|
|
188
|
+
nodes: NodeType[];
|
|
189
|
+
edges: EdgeType[];
|
|
190
|
+
}>;
|
|
191
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/utils/graph.ts"],"names":[],"mappings":"AAcA,OAAO,EACL,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,gBAAgB,EAChB,OAAO,EACP,kBAAkB,EAClB,UAAU,EACV,gBAAgB,EAChB,YAAY,EACb,MA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B,CAAC,CA+CD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from './connections';
|
|
2
|
+
export * from './dom';
|
|
3
|
+
export * from './edges';
|
|
4
|
+
export * from './graph';
|
|
5
|
+
export * from './general';
|
|
6
|
+
export * from './marker';
|
|
7
|
+
export * from './node-toolbar';
|
|
8
|
+
export * from './edge-toolbar';
|
|
9
|
+
export * from './store';
|
|
10
|
+
export * from './types';
|
|
11
|
+
export * from './shallow-node-data';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { EdgeBase, EdgeMarkerType, MarkerProps } from '../types';
|
|
2
|
+
export declare function getMarkerId(marker: EdgeMarkerType | undefined, id?: string | null): string;
|
|
3
|
+
export declare function createMarkerIds(edges: EdgeBase[], { id, defaultColor, defaultMarkerStart, defaultMarkerEnd, }: {
|
|
4
|
+
id?: string | null;
|
|
5
|
+
defaultColor?: string | null;
|
|
6
|
+
defaultMarkerStart?: EdgeMarkerType;
|
|
7
|
+
defaultMarkerEnd?: EdgeMarkerType;
|
|
8
|
+
}): MarkerProps[];
|
|
9
|
+
//# sourceMappingURL=marker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { NodeBase } from '../types';
|
|
2
|
+
type NodeData = Pick<NodeBase, 'id' | 'type' | 'data'>;
|
|
3
|
+
export declare function shallowNodeData(a: NodeData | NodeData[] | null, b: NodeData | NodeData[] | null): boolean;
|
|
4
|
+
export {};
|
|
5
|
+
//# sourceMappingURL=shallow-node-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ZIndexMode } from '..';
|
|
2
|
+
import { NodeBase, CoordinateExtent, InternalNodeUpdate, NodeOrigin, PanZoomInstance, Transform, XYPosition, ConnectionLookup, EdgeBase, EdgeLookup, InternalNodeBase, NodeLookup, NodeDimensionChange, NodePositionChange, ParentLookup } from '../types';
|
|
3
|
+
import { ParentExpandChild } from './types';
|
|
4
|
+
export declare function updateAbsolutePositions<NodeType extends NodeBase>(nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): void;
|
|
5
|
+
type UpdateNodesOptions<NodeType extends NodeBase> = {
|
|
6
|
+
nodeOrigin?: NodeOrigin;
|
|
7
|
+
nodeExtent?: CoordinateExtent;
|
|
8
|
+
elevateNodesOnSelect?: boolean;
|
|
9
|
+
defaults?: Partial<NodeType>;
|
|
10
|
+
zIndexMode?: ZIndexMode;
|
|
11
|
+
checkEquality?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export declare function isManualZIndexMode(zIndexMode?: ZIndexMode): boolean;
|
|
14
|
+
type AdoptUserNodesReturn = {
|
|
15
|
+
nodesInitialized: boolean;
|
|
16
|
+
hasSelectedNodes: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare function adoptUserNodes<NodeType extends NodeBase>(nodes: NodeType[], nodeLookup: NodeLookup<InternalNodeBase<NodeType>>, parentLookup: ParentLookup<InternalNodeBase<NodeType>>, options?: UpdateNodesOptions<NodeType>): AdoptUserNodesReturn;
|
|
19
|
+
export declare function handleExpandParent(children: ParentExpandChild[], nodeLookup: NodeLookup, parentLookup: ParentLookup, nodeOrigin?: NodeOrigin): (NodeDimensionChange | NodePositionChange)[];
|
|
20
|
+
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): {
|
|
21
|
+
changes: (NodeDimensionChange | NodePositionChange)[];
|
|
22
|
+
updatedInternals: boolean;
|
|
23
|
+
};
|
|
24
|
+
export declare function panBy({ delta, panZoom, transform, translateExtent, width, height, }: {
|
|
25
|
+
delta: XYPosition;
|
|
26
|
+
panZoom: PanZoomInstance | null;
|
|
27
|
+
transform: Transform;
|
|
28
|
+
translateExtent: CoordinateExtent;
|
|
29
|
+
width: number;
|
|
30
|
+
height: number;
|
|
31
|
+
}): Promise<boolean>;
|
|
32
|
+
export declare function updateConnectionLookup(connectionLookup: ConnectionLookup, edgeLookup: EdgeLookup, edges: EdgeBase[]): void;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/utils/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8D,UAAU,EAAE,MAAM,IAAI,CAAC;AAC5F,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,UAAU,EACV,eAAe,EACf,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,UAAU,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,YAAY,EACb,MAAM,UAAU,CAAC;AAYlB,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AA8B5C,wBAA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CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { NodeBase, NodeDragItem, EdgeBase, CoordinateExtent, NodeOrigin, OnError, SnapGrid, Transform, PanBy, OnSelectionDrag, UpdateNodePositions, InternalNodeBase } from '../types';
|
|
2
|
+
export type OnDrag = (event: MouseEvent, dragItems: Map<string, NodeDragItem>, node: NodeBase, nodes: NodeBase[]) => void;
|
|
3
|
+
type StoreItems<OnNodeDrag> = {
|
|
4
|
+
nodes: NodeBase[];
|
|
5
|
+
nodeLookup: Map<string, InternalNodeBase>;
|
|
6
|
+
edges: EdgeBase[];
|
|
7
|
+
nodeExtent: CoordinateExtent;
|
|
8
|
+
snapGrid: SnapGrid;
|
|
9
|
+
snapToGrid: boolean;
|
|
10
|
+
nodeOrigin: NodeOrigin;
|
|
11
|
+
multiSelectionActive: boolean;
|
|
12
|
+
domNode?: Element | null;
|
|
13
|
+
transform: Transform;
|
|
14
|
+
autoPanOnNodeDrag: boolean;
|
|
15
|
+
nodesDraggable: boolean;
|
|
16
|
+
selectNodesOnDrag: boolean;
|
|
17
|
+
nodeDragThreshold: number;
|
|
18
|
+
panBy: PanBy;
|
|
19
|
+
unselectNodesAndEdges: (params?: {
|
|
20
|
+
nodes?: NodeBase[];
|
|
21
|
+
edges?: EdgeBase[];
|
|
22
|
+
}) => void;
|
|
23
|
+
onError?: OnError;
|
|
24
|
+
onNodeDragStart?: OnNodeDrag;
|
|
25
|
+
onNodeDrag?: OnNodeDrag;
|
|
26
|
+
onNodeDragStop?: OnNodeDrag;
|
|
27
|
+
onSelectionDragStart?: OnSelectionDrag;
|
|
28
|
+
onSelectionDrag?: OnSelectionDrag;
|
|
29
|
+
onSelectionDragStop?: OnSelectionDrag;
|
|
30
|
+
updateNodePositions: UpdateNodePositions;
|
|
31
|
+
autoPanSpeed?: number;
|
|
32
|
+
};
|
|
33
|
+
export type XYDragParams<OnNodeDrag> = {
|
|
34
|
+
getStoreItems: () => StoreItems<OnNodeDrag>;
|
|
35
|
+
onDragStart?: OnDrag;
|
|
36
|
+
onDrag?: OnDrag;
|
|
37
|
+
onDragStop?: OnDrag;
|
|
38
|
+
onNodeMouseDown?: (id: string) => void;
|
|
39
|
+
autoPanSpeed?: number;
|
|
40
|
+
};
|
|
41
|
+
export type XYDragInstance = {
|
|
42
|
+
update: (params: DragUpdateParams) => void;
|
|
43
|
+
destroy: () => void;
|
|
44
|
+
};
|
|
45
|
+
export type DragUpdateParams = {
|
|
46
|
+
noDragClassName?: string;
|
|
47
|
+
handleSelector?: string;
|
|
48
|
+
isSelectable?: boolean;
|
|
49
|
+
nodeId?: string;
|
|
50
|
+
domNode: Element;
|
|
51
|
+
nodeClickDistance?: number;
|
|
52
|
+
};
|
|
53
|
+
export declare function XYDrag<OnNodeDrag extends (e: any, nodes: any, node: any) => void | undefined>({ onNodeMouseDown, getStoreItems, onDragStart, onDrag, onDragStop, }: XYDragParams<OnNodeDrag>): XYDragInstance;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=XYDrag.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XYDrag.d.ts","sourceRoot":"","sources":["../../src/xydrag/XYDrag.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,QAAQ,EACR,YAAY,EAGZ,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,UAAU,CAAC;AAElB,MAAM,MAAM,MAAM,GAAG,CACnB,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,EACpC,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,QAAQ,EAAE,KACd,IAAI,CAAC;AAEV,KAAK,UAAU,CAAC,UAAU,IAAI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AAM,CAAC;IACpB,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAGF,wBAAgB,MAAM,CAAC,UAAU,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,SAAS,EAAE,EAC7F,eAAe,EACf,aAAa,EACb,WAAW,EACX,MAAM,EACN,UAAU,GACX,EAAE,YAAY,CAAC,UAAU,CAAC,GAAG,cAAc,CAyT3C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/xydrag/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type NodeDragItem, type XYPosition, InternalNodeBase, NodeBase, NodeLookup, SnapGrid } from '../types';
|
|
2
|
+
export declare function isParentSelected<NodeType extends NodeBase>(node: NodeType, nodeLookup: NodeLookup): boolean;
|
|
3
|
+
export declare function hasSelector(target: Element | EventTarget | null, selector: string, domNode: Element): boolean;
|
|
4
|
+
export declare function getDragItems<NodeType extends NodeBase>(nodeLookup: Map<string, InternalNodeBase<NodeType>>, nodesDraggable: boolean, mousePos: XYPosition, nodeId?: string): Map<string, NodeDragItem>;
|
|
5
|
+
export declare function getEventHandlerParams<NodeType extends InternalNodeBase>({ nodeId, dragItems, nodeLookup, dragging, }: {
|
|
6
|
+
nodeId?: string;
|
|
7
|
+
dragItems: Map<string, NodeDragItem>;
|
|
8
|
+
nodeLookup: Map<string, NodeType>;
|
|
9
|
+
dragging?: boolean;
|
|
10
|
+
}): [NodeBase, NodeBase[]];
|
|
11
|
+
/**
|
|
12
|
+
* If a selection is being dragged we want to apply the same snap offset to all nodes in the selection.
|
|
13
|
+
* This function calculates the snap offset based on the first node in the selection.
|
|
14
|
+
*/
|
|
15
|
+
export declare function calculateSnapOffset({ dragItems, snapGrid, x, y, }: {
|
|
16
|
+
dragItems: Map<string, NodeDragItem>;
|
|
17
|
+
snapGrid: SnapGrid;
|
|
18
|
+
x: number;
|
|
19
|
+
y: number;
|
|
20
|
+
}): {
|
|
21
|
+
x: number;
|
|
22
|
+
y: number;
|
|
23
|
+
} | null;
|
|
24
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/xydrag/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAGhH,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,GAAG,OAAO,CAgB3G;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAU7G;AAGD,wBAAgB,YAAY,CAAC,QAAQ,SAAS,QAAQ,EACpD,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EACnD,cAAc,EAAE,OAAO,EACvB,QAAQ,EAAE,UAAU,EACpB,MAAM,CAAC,EAAE,MAAM,GACd,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAoC3B;AAOD,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,gBAAgB,EAAE,EACvE,MAAM,EACN,SAAS,EACT,UAAU,EACV,QAAe,GAChB,EAAE;IACD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACrC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,CAAC,CA+BzB;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,QAAQ,EACR,CAAC,EACD,CAAC,GACF,EAAE;IACD,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACrC,QAAQ,EAAE,QAAQ,CAAC;IACnB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;;;SAiBA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"XYHandle.d.ts","sourceRoot":"","sources":["../../src/xyhandle/XYHandle.ts"],"names":[],"mappings":"AAkBA,OAAO,EAA8C,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAuTvF,eAAO,MAAM,QAAQ,EAAE,gBAGtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/xyhandle/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC"}
|