@aloudata/ink-flow 1.0.0
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/README.md +5 -0
- package/dist/base.css +6 -0
- package/dist/components/A11yDescriptions/index.d.ts +8 -0
- package/dist/components/A11yDescriptions/index.d.ts.map +1 -0
- package/dist/components/BatchProvider/index.d.ts +17 -0
- package/dist/components/BatchProvider/index.d.ts.map +1 -0
- package/dist/components/BatchProvider/types.d.ts +7 -0
- package/dist/components/BatchProvider/types.d.ts.map +1 -0
- package/dist/components/BatchProvider/useQueue.d.ts +11 -0
- package/dist/components/BatchProvider/useQueue.d.ts.map +1 -0
- package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts +17 -0
- package/dist/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -0
- package/dist/components/EdgeWrapper/index.d.ts +3 -0
- package/dist/components/EdgeWrapper/index.d.ts.map +1 -0
- package/dist/components/EdgeWrapper/utils.d.ts +11 -0
- package/dist/components/EdgeWrapper/utils.d.ts.map +1 -0
- package/dist/components/Edges/BaseEdge.d.ts +3 -0
- package/dist/components/Edges/BaseEdge.d.ts.map +1 -0
- package/dist/components/Edges/BezierEdge.d.ts +5 -0
- package/dist/components/Edges/BezierEdge.d.ts.map +1 -0
- package/dist/components/Edges/EdgeAnchor.d.ts +14 -0
- package/dist/components/Edges/EdgeAnchor.d.ts.map +1 -0
- package/dist/components/Edges/EdgeText.d.ts +8 -0
- package/dist/components/Edges/EdgeText.d.ts.map +1 -0
- package/dist/components/Edges/SimpleBezierEdge.d.ts +21 -0
- package/dist/components/Edges/SimpleBezierEdge.d.ts.map +1 -0
- package/dist/components/Edges/SmoothStepEdge.d.ts +5 -0
- package/dist/components/Edges/SmoothStepEdge.d.ts.map +1 -0
- package/dist/components/Edges/StepEdge.d.ts +5 -0
- package/dist/components/Edges/StepEdge.d.ts.map +1 -0
- package/dist/components/Edges/StraightEdge.d.ts +5 -0
- package/dist/components/Edges/StraightEdge.d.ts.map +1 -0
- package/dist/components/Edges/index.d.ts +6 -0
- package/dist/components/Edges/index.d.ts.map +1 -0
- package/dist/components/Handle/index.d.ts +9 -0
- package/dist/components/Handle/index.d.ts.map +1 -0
- package/dist/components/InkFlowProvider/index.d.ts +14 -0
- package/dist/components/InkFlowProvider/index.d.ts.map +1 -0
- package/dist/components/NodeWrapper/index.d.ts +3 -0
- package/dist/components/NodeWrapper/index.d.ts.map +1 -0
- package/dist/components/NodeWrapper/useNodeObserver.d.ts +14 -0
- package/dist/components/NodeWrapper/useNodeObserver.d.ts.map +1 -0
- package/dist/components/NodeWrapper/utils.d.ts +9 -0
- package/dist/components/NodeWrapper/utils.d.ts.map +1 -0
- package/dist/components/Nodes/DefaultNode.d.ts +3 -0
- package/dist/components/Nodes/DefaultNode.d.ts.map +1 -0
- package/dist/components/Nodes/GroupNode.d.ts +2 -0
- package/dist/components/Nodes/GroupNode.d.ts.map +1 -0
- package/dist/components/Nodes/InputNode.d.ts +4 -0
- package/dist/components/Nodes/InputNode.d.ts.map +1 -0
- package/dist/components/Nodes/OutputNode.d.ts +3 -0
- package/dist/components/Nodes/OutputNode.d.ts.map +1 -0
- package/dist/components/Nodes/utils.d.ts +13 -0
- package/dist/components/Nodes/utils.d.ts.map +1 -0
- package/dist/components/Panel/index.d.ts +11 -0
- package/dist/components/Panel/index.d.ts.map +1 -0
- package/dist/components/StoreUpdater/index.d.ts +9 -0
- package/dist/components/StoreUpdater/index.d.ts.map +1 -0
- package/dist/components/UserSelection/index.d.ts +2 -0
- package/dist/components/UserSelection/index.d.ts.map +1 -0
- package/dist/constants/errorMessages.d.ts +22 -0
- package/dist/constants/errorMessages.d.ts.map +1 -0
- package/dist/constants/index.d.ts +2 -0
- package/dist/constants/index.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts +10 -0
- package/dist/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/MarkerSymbols.d.ts +9 -0
- package/dist/container/EdgeRenderer/MarkerSymbols.d.ts.map +1 -0
- package/dist/container/EdgeRenderer/index.d.ts +13 -0
- package/dist/container/EdgeRenderer/index.d.ts.map +1 -0
- package/dist/container/FlowRenderer/index.d.ts +14 -0
- package/dist/container/FlowRenderer/index.d.ts.map +1 -0
- package/dist/container/GraphView/index.d.ts +11 -0
- package/dist/container/GraphView/index.d.ts.map +1 -0
- package/dist/container/InkFlow/Wrapper.d.ts +13 -0
- package/dist/container/InkFlow/Wrapper.d.ts.map +1 -0
- package/dist/container/InkFlow/index.d.ts +4 -0
- package/dist/container/InkFlow/index.d.ts.map +1 -0
- package/dist/container/InkFlow/init-values.d.ts +4 -0
- package/dist/container/InkFlow/init-values.d.ts.map +1 -0
- package/dist/container/NodeRenderer/index.d.ts +10 -0
- package/dist/container/NodeRenderer/index.d.ts.map +1 -0
- package/dist/container/NodeRenderer/useResizeObserver.d.ts +2 -0
- package/dist/container/NodeRenderer/useResizeObserver.d.ts.map +1 -0
- package/dist/container/Pane/index.d.ts +12 -0
- package/dist/container/Pane/index.d.ts.map +1 -0
- package/dist/container/Viewport/index.d.ts +7 -0
- package/dist/container/Viewport/index.d.ts.map +1 -0
- package/dist/container/ZoomPane/index.d.ts +7 -0
- package/dist/container/ZoomPane/index.d.ts.map +1 -0
- package/dist/contexts/NodeIdContext.d.ts +6 -0
- package/dist/contexts/NodeIdContext.d.ts.map +1 -0
- package/dist/contexts/StoreContext.d.ts +4 -0
- package/dist/contexts/StoreContext.d.ts.map +1 -0
- package/dist/hooks/index.d.ts +5 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/useDrag.d.ts +12 -0
- package/dist/hooks/useDrag.d.ts.map +1 -0
- package/dist/hooks/useEdgesState.d.ts +4 -0
- package/dist/hooks/useEdgesState.d.ts.map +1 -0
- package/dist/hooks/useGlobalKeyHandler.d.ts +11 -0
- package/dist/hooks/useGlobalKeyHandler.d.ts.map +1 -0
- package/dist/hooks/useInkFlow.d.ts +10 -0
- package/dist/hooks/useInkFlow.d.ts.map +1 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/hooks/useIsomorphicLayoutEffect.d.ts.map +1 -0
- package/dist/hooks/useKeyPress.d.ts +15 -0
- package/dist/hooks/useKeyPress.d.ts.map +1 -0
- package/dist/hooks/useMoveSelectedNodes.d.ts +12 -0
- package/dist/hooks/useMoveSelectedNodes.d.ts.map +1 -0
- package/dist/hooks/useNodesState.d.ts +4 -0
- package/dist/hooks/useNodesState.d.ts.map +1 -0
- package/dist/hooks/useResizeHandler.d.ts +8 -0
- package/dist/hooks/useResizeHandler.d.ts.map +1 -0
- package/dist/hooks/useStore.d.ts +21 -0
- package/dist/hooks/useStore.d.ts.map +1 -0
- package/dist/hooks/useViewportHelper.d.ts +10 -0
- package/dist/hooks/useViewportHelper.d.ts.map +1 -0
- package/dist/hooks/useVisibleEdgeIds.d.ts +9 -0
- package/dist/hooks/useVisibleEdgeIds.d.ts.map +1 -0
- package/dist/hooks/useVisibleNodeIds.d.ts +9 -0
- package/dist/hooks/useVisibleNodeIds.d.ts.map +1 -0
- package/dist/index.cjs.js +17 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.esm.js +17 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/plugins/Controls/ControlButton.d.ts +3 -0
- package/dist/plugins/Controls/ControlButton.d.ts.map +1 -0
- package/dist/plugins/Controls/Controls.d.ts +8 -0
- package/dist/plugins/Controls/Controls.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/FitView.d.ts +2 -0
- package/dist/plugins/Controls/Icons/FitView.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Lock.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Lock.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Minus.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Minus.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Plus.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Plus.d.ts.map +1 -0
- package/dist/plugins/Controls/Icons/Unlock.d.ts +2 -0
- package/dist/plugins/Controls/Icons/Unlock.d.ts.map +1 -0
- package/dist/plugins/Controls/index.d.ts +4 -0
- package/dist/plugins/Controls/index.d.ts.map +1 -0
- package/dist/plugins/Controls/types.d.ts +35 -0
- package/dist/plugins/Controls/types.d.ts.map +1 -0
- package/dist/plugins/index.d.ts +2 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/store/index.d.ts +12 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/initialState.d.ts +12 -0
- package/dist/store/initialState.d.ts.map +1 -0
- package/dist/style.css +817 -0
- package/dist/styles/utils.d.ts +3 -0
- package/dist/styles/utils.d.ts.map +1 -0
- package/dist/types/edges.d.ts +114 -0
- package/dist/types/edges.d.ts.map +1 -0
- package/dist/types/general.d.ts +123 -0
- package/dist/types/general.d.ts.map +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/instance.d.ts +149 -0
- package/dist/types/instance.d.ts.map +1 -0
- package/dist/types/nodes.d.ts +40 -0
- package/dist/types/nodes.d.ts.map +1 -0
- package/dist/types/props.d.ts +151 -0
- package/dist/types/props.d.ts.map +1 -0
- package/dist/types/store.d.ts +105 -0
- package/dist/types/store.d.ts.map +1 -0
- package/dist/types/system/changes.d.ts +51 -0
- package/dist/types/system/changes.d.ts.map +1 -0
- package/dist/types/system/edges.d.ts +83 -0
- package/dist/types/system/edges.d.ts.map +1 -0
- package/dist/types/system/general.d.ts +119 -0
- package/dist/types/system/general.d.ts.map +1 -0
- package/dist/types/system/handles.d.ts +51 -0
- package/dist/types/system/handles.d.ts.map +1 -0
- package/dist/types/system/index.d.ts +8 -0
- package/dist/types/system/index.d.ts.map +1 -0
- package/dist/types/system/nodes.d.ts +126 -0
- package/dist/types/system/nodes.d.ts.map +1 -0
- package/dist/types/system/panzoom.d.ts +49 -0
- package/dist/types/system/panzoom.d.ts.map +1 -0
- package/dist/types/system/utils.d.ts +25 -0
- package/dist/types/system/utils.d.ts.map +1 -0
- package/dist/types/utils/types.d.ts +8 -0
- package/dist/types/utils/types.d.ts.map +1 -0
- package/dist/utils/bezier-edge.d.ts +59 -0
- package/dist/utils/bezier-edge.d.ts.map +1 -0
- package/dist/utils/changes.d.ts +16 -0
- package/dist/utils/changes.d.ts.map +1 -0
- package/dist/utils/dom.d.ts +20 -0
- package/dist/utils/dom.d.ts.map +1 -0
- package/dist/utils/edges/bezier-edge.d.ts +59 -0
- package/dist/utils/edges/bezier-edge.d.ts.map +1 -0
- package/dist/utils/edges/general.d.ts +46 -0
- package/dist/utils/edges/general.d.ts.map +1 -0
- package/dist/utils/edges/index.d.ts +6 -0
- package/dist/utils/edges/index.d.ts.map +1 -0
- package/dist/utils/edges/positions.d.ts +12 -0
- package/dist/utils/edges/positions.d.ts.map +1 -0
- package/dist/utils/edges/smoothstep-edge.d.ts +43 -0
- package/dist/utils/edges/smoothstep-edge.d.ts.map +1 -0
- package/dist/utils/edges/straight-edge.d.ts +28 -0
- package/dist/utils/edges/straight-edge.d.ts.map +1 -0
- package/dist/utils/edges.d.ts +26 -0
- package/dist/utils/edges.d.ts.map +1 -0
- package/dist/utils/general.d.ts +61 -0
- package/dist/utils/general.d.ts.map +1 -0
- package/dist/utils/graph.d.ts +113 -0
- package/dist/utils/graph.d.ts.map +1 -0
- package/dist/utils/marker.d.ts +9 -0
- package/dist/utils/marker.d.ts.map +1 -0
- package/dist/utils/positions.d.ts +12 -0
- package/dist/utils/positions.d.ts.map +1 -0
- package/dist/utils/smoothstep-edge.d.ts +43 -0
- package/dist/utils/smoothstep-edge.d.ts.map +1 -0
- package/dist/utils/store.d.ts +30 -0
- package/dist/utils/store.d.ts.map +1 -0
- package/dist/utils/straight-edge.d.ts +34 -0
- package/dist/utils/straight-edge.d.ts.map +1 -0
- package/dist/utils/xydrag/XYDrag.d.ts +52 -0
- package/dist/utils/xydrag/XYDrag.d.ts.map +1 -0
- package/dist/utils/xydrag/index.d.ts +2 -0
- package/dist/utils/xydrag/index.d.ts.map +1 -0
- package/dist/utils/xydrag/utils.d.ts +10 -0
- package/dist/utils/xydrag/utils.d.ts.map +1 -0
- package/dist/utils/xyhandle/XYHandle.d.ts +49 -0
- package/dist/utils/xyhandle/XYHandle.d.ts.map +1 -0
- package/dist/utils/xyhandle/index.d.ts +2 -0
- package/dist/utils/xyhandle/index.d.ts.map +1 -0
- package/dist/utils/xyhandle/utils.d.ts +14 -0
- package/dist/utils/xyhandle/utils.d.ts.map +1 -0
- package/dist/utils/xypanzoom/XYPanZoom.d.ts +12 -0
- package/dist/utils/xypanzoom/XYPanZoom.d.ts.map +1 -0
- package/dist/utils/xypanzoom/eventhandler.d.ts +46 -0
- package/dist/utils/xypanzoom/eventhandler.d.ts.map +1 -0
- package/dist/utils/xypanzoom/filter.d.ts +14 -0
- package/dist/utils/xypanzoom/filter.d.ts.map +1 -0
- package/dist/utils/xypanzoom/index.d.ts +2 -0
- package/dist/utils/xypanzoom/index.d.ts.map +1 -0
- package/dist/utils/xypanzoom/utils.d.ts +10 -0
- package/dist/utils/xypanzoom/utils.d.ts.map +1 -0
- package/package.json +48 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum Position {
|
|
2
|
+
Left = "left",
|
|
3
|
+
Top = "top",
|
|
4
|
+
Right = "right",
|
|
5
|
+
Bottom = "bottom"
|
|
6
|
+
}
|
|
7
|
+
export type XYPosition = {
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
};
|
|
11
|
+
export type XYZPosition = XYPosition & {
|
|
12
|
+
z: number;
|
|
13
|
+
};
|
|
14
|
+
export type Dimensions = {
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
};
|
|
18
|
+
export type Rect = Dimensions & XYPosition;
|
|
19
|
+
export type Box = XYPosition & {
|
|
20
|
+
x2: number;
|
|
21
|
+
y2: number;
|
|
22
|
+
};
|
|
23
|
+
export type Transform = [number, number, number];
|
|
24
|
+
export type CoordinateExtent = [[number, number], [number, number]];
|
|
25
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/types/system/utils.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,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;CAAE,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG,UAAU,GAAG,UAAU,CAAC;AAE3C,MAAM,MAAM,GAAG,GAAG,UAAU,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,MAAM,QAAQ,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAE9E,MAAM,MAAM,iBAAiB,GAAG;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Position } from '../types/system';
|
|
2
|
+
export type GetBezierPathParams = {
|
|
3
|
+
sourceX: number;
|
|
4
|
+
sourceY: number;
|
|
5
|
+
sourcePosition?: Position;
|
|
6
|
+
targetX: number;
|
|
7
|
+
targetY: number;
|
|
8
|
+
targetPosition?: Position;
|
|
9
|
+
curvature?: number;
|
|
10
|
+
};
|
|
11
|
+
export type GetControlWithCurvatureParams = {
|
|
12
|
+
pos: Position;
|
|
13
|
+
x1: number;
|
|
14
|
+
y1: number;
|
|
15
|
+
x2: number;
|
|
16
|
+
y2: number;
|
|
17
|
+
c: number;
|
|
18
|
+
};
|
|
19
|
+
export declare function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY, }: {
|
|
20
|
+
sourceX: number;
|
|
21
|
+
sourceY: number;
|
|
22
|
+
targetX: number;
|
|
23
|
+
targetY: number;
|
|
24
|
+
sourceControlX: number;
|
|
25
|
+
sourceControlY: number;
|
|
26
|
+
targetControlX: number;
|
|
27
|
+
targetControlY: number;
|
|
28
|
+
}): [number, number, number, number];
|
|
29
|
+
/**
|
|
30
|
+
* Get a bezier path from source to target handle
|
|
31
|
+
* @param params.sourceX - The x position of the source handle
|
|
32
|
+
* @param params.sourceY - The y position of the source handle
|
|
33
|
+
* @param params.sourcePosition - The position of the source handle (default: Position.Bottom)
|
|
34
|
+
* @param params.targetX - The x position of the target handle
|
|
35
|
+
* @param params.targetY - The y position of the target handle
|
|
36
|
+
* @param params.targetPosition - The position of the target handle (default: Position.Top)
|
|
37
|
+
* @param params.curvature - The curvature of the bezier edge
|
|
38
|
+
* @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
|
+
* @example
|
|
40
|
+
* const source = { x: 0, y: 20 };
|
|
41
|
+
const target = { x: 150, y: 100 };
|
|
42
|
+
|
|
43
|
+
const [path, labelX, labelY, offsetX, offsetY] = getBezierPath({
|
|
44
|
+
sourceX: source.x,
|
|
45
|
+
sourceY: source.y,
|
|
46
|
+
sourcePosition: Position.Right,
|
|
47
|
+
targetX: target.x,
|
|
48
|
+
targetY: target.y,
|
|
49
|
+
targetPosition: Position.Left,
|
|
50
|
+
});
|
|
51
|
+
*/
|
|
52
|
+
export declare function getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, curvature, }: GetBezierPathParams): [
|
|
53
|
+
path: string,
|
|
54
|
+
labelX: number,
|
|
55
|
+
labelY: number,
|
|
56
|
+
offsetX: number,
|
|
57
|
+
offsetY: number
|
|
58
|
+
];
|
|
59
|
+
//# sourceMappingURL=bezier-edge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bezier-edge.d.ts","sourceRoot":"","sources":["../../src/utils/bezier-edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAE3C,MAAM,MAAM,mBAAmB,GAAG;IAChC,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,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,CAiBnC;AA8BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,SAAgB,GACjB,EAAE,mBAAmB,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;CAChB,CAmCA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Edge, InternalNode, Node } from '../types';
|
|
2
|
+
import { EdgeChange, EdgeLookup, EdgeRemoveChange, EdgeSelectionChange, NodeChange, NodeLookup, NodeRemoveChange, NodeSelectionChange } from '../types/system';
|
|
3
|
+
export declare function applyEdgeChanges<EdgeType extends Edge = Edge>(changes: EdgeChange<EdgeType>[], edges: EdgeType[]): EdgeType[];
|
|
4
|
+
export declare function applyNodeChanges<NodeType extends Node = Node>(changes: NodeChange<NodeType>[], nodes: NodeType[]): NodeType[];
|
|
5
|
+
export declare function createSelectionChange(id: string, selected: boolean): NodeSelectionChange | EdgeSelectionChange;
|
|
6
|
+
export declare function getSelectionChanges(items: Map<string, any>, selectedIds?: Set<string>, mutateItem?: boolean): NodeSelectionChange[] | EdgeSelectionChange[];
|
|
7
|
+
export declare function getElementsDiffChanges({ items, lookup, }: {
|
|
8
|
+
items: Node[] | undefined;
|
|
9
|
+
lookup: NodeLookup<InternalNode<Node>>;
|
|
10
|
+
}): NodeChange[];
|
|
11
|
+
export declare function getElementsDiffChanges({ items, lookup, }: {
|
|
12
|
+
items: Edge[] | undefined;
|
|
13
|
+
lookup: EdgeLookup;
|
|
14
|
+
}): EdgeChange[];
|
|
15
|
+
export declare function elementToRemoveChange<T extends Node | Edge>(item: T): NodeRemoveChange | EdgeRemoveChange;
|
|
16
|
+
//# sourceMappingURL=changes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/utils/changes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EACL,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAwGzB,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAC3D,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,EAC/B,KAAK,EAAE,QAAQ,EAAE,GAChB,QAAQ,EAAE,CAEZ;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAC3D,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,EAC/B,KAAK,EAAE,QAAQ,EAAE,GAChB,QAAQ,EAAE,CAEZ;AAED,wBAAgB,qBAAqB,CACnC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,OAAO,GAChB,mBAAmB,GAAG,mBAAmB,CAM3C;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,WAAW,GAAE,GAAG,CAAC,MAAM,CAAa,EACpC,UAAU,UAAQ,GACjB,mBAAmB,EAAE,GAAG,mBAAmB,EAAE,CAsB/C;AAED,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;CACxC,GAAG,UAAU,EAAE,CAAC;AACjB,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,MAAM,GACP,EAAE;IACD,KAAK,EAAE,IAAI,EAAE,GAAG,SAAS,CAAC;IAC1B,MAAM,EAAE,UAAU,CAAC;CACpB,GAAG,UAAU,EAAE,CAAC;AAqCjB,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,IAAI,GAAG,IAAI,EACzD,IAAI,EAAE,CAAC,GACN,gBAAgB,GAAG,gBAAgB,CAKrC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Transform, SnapGrid, XYPosition, Dimensions, NodeOrigin, HandleElement } from '../types/system';
|
|
2
|
+
export type GetPointerPositionParams = {
|
|
3
|
+
transform: Transform;
|
|
4
|
+
snapGrid?: SnapGrid;
|
|
5
|
+
snapToGrid?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function getPointerPosition(event: MouseEvent | TouchEvent, { snapGrid, snapToGrid, transform, }: GetPointerPositionParams): XYPosition & {
|
|
8
|
+
xSnapped: number;
|
|
9
|
+
ySnapped: number;
|
|
10
|
+
};
|
|
11
|
+
export declare const getDimensions: (node: HTMLDivElement) => Dimensions;
|
|
12
|
+
export declare const getHostForElement: (element: HTMLElement) => Document | ShadowRoot;
|
|
13
|
+
export declare function isInputDOMNode(event: KeyboardEvent): boolean;
|
|
14
|
+
export declare const isMouseEvent: (event: MouseEvent | TouchEvent) => event is MouseEvent;
|
|
15
|
+
export declare const getEventPosition: (event: MouseEvent | TouchEvent, bounds?: DOMRect) => {
|
|
16
|
+
x: number;
|
|
17
|
+
y: number;
|
|
18
|
+
};
|
|
19
|
+
export declare const getHandleBounds: (selector: string, nodeElement: HTMLDivElement, zoom: number, nodeOrigin?: NodeOrigin) => HandleElement[] | null;
|
|
20
|
+
//# sourceMappingURL=dom.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dom.d.ts","sourceRoot":"","sources":["../../src/utils/dom.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,UAAU,EACV,aAAa,EAEd,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,wBAAwB,GAAG;IACrC,SAAS,EAAE,SAAS,CAAC;IACrB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,UAAU,GAAG,UAAU,EAC9B,EACE,QAAiB,EACjB,UAAkB,EAClB,SAAS,GACV,EAAE,wBAAwB,GAC1B,UAAU,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAarD;AAED,eAAO,MAAM,aAAa,SAAU,cAAc,KAAG,UAGnD,CAAC;AAEH,eAAO,MAAM,iBAAiB,YACnB,WAAW,KACnB,QAAQ,GAAG,UAC0D,CAAC;AAIzE,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAS5D;AAED,eAAO,MAAM,YAAY,UAChB,UAAU,GAAG,UAAU,wBACY,CAAC;AAE7C,eAAO,MAAM,gBAAgB,UACpB,UAAU,GAAG,UAAU,WACrB,OAAO;;;CAUjB,CAAC;AAKF,eAAO,MAAM,eAAe,aAChB,MAAM,eACH,cAAc,QACrB,MAAM,8BAEX,aAAa,EAAE,GAAG,IA2BpB,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Position } from '../../types/system';
|
|
2
|
+
export type GetBezierPathParams = {
|
|
3
|
+
sourceX: number;
|
|
4
|
+
sourceY: number;
|
|
5
|
+
sourcePosition?: Position;
|
|
6
|
+
targetX: number;
|
|
7
|
+
targetY: number;
|
|
8
|
+
targetPosition?: Position;
|
|
9
|
+
curvature?: number;
|
|
10
|
+
};
|
|
11
|
+
export type GetControlWithCurvatureParams = {
|
|
12
|
+
pos: Position;
|
|
13
|
+
x1: number;
|
|
14
|
+
y1: number;
|
|
15
|
+
x2: number;
|
|
16
|
+
y2: number;
|
|
17
|
+
c: number;
|
|
18
|
+
};
|
|
19
|
+
export declare function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY, }: {
|
|
20
|
+
sourceX: number;
|
|
21
|
+
sourceY: number;
|
|
22
|
+
targetX: number;
|
|
23
|
+
targetY: number;
|
|
24
|
+
sourceControlX: number;
|
|
25
|
+
sourceControlY: number;
|
|
26
|
+
targetControlX: number;
|
|
27
|
+
targetControlY: number;
|
|
28
|
+
}): [number, number, number, number];
|
|
29
|
+
/**
|
|
30
|
+
* Get a bezier path from source to target handle
|
|
31
|
+
* @param params.sourceX - The x position of the source handle
|
|
32
|
+
* @param params.sourceY - The y position of the source handle
|
|
33
|
+
* @param params.sourcePosition - The position of the source handle (default: Position.Bottom)
|
|
34
|
+
* @param params.targetX - The x position of the target handle
|
|
35
|
+
* @param params.targetY - The y position of the target handle
|
|
36
|
+
* @param params.targetPosition - The position of the target handle (default: Position.Top)
|
|
37
|
+
* @param params.curvature - The curvature of the bezier edge
|
|
38
|
+
* @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
|
+
* @example
|
|
40
|
+
* const source = { x: 0, y: 20 };
|
|
41
|
+
const target = { x: 150, y: 100 };
|
|
42
|
+
|
|
43
|
+
const [path, labelX, labelY, offsetX, offsetY] = getBezierPath({
|
|
44
|
+
sourceX: source.x,
|
|
45
|
+
sourceY: source.y,
|
|
46
|
+
sourcePosition: Position.Right,
|
|
47
|
+
targetX: target.x,
|
|
48
|
+
targetY: target.y,
|
|
49
|
+
targetPosition: Position.Left,
|
|
50
|
+
});
|
|
51
|
+
*/
|
|
52
|
+
export declare function getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, curvature, }: GetBezierPathParams): [
|
|
53
|
+
path: string,
|
|
54
|
+
labelX: number,
|
|
55
|
+
labelY: number,
|
|
56
|
+
offsetX: number,
|
|
57
|
+
offsetY: number
|
|
58
|
+
];
|
|
59
|
+
//# sourceMappingURL=bezier-edge.d.ts.map
|
|
@@ -0,0 +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,oBAAoB,CAAC;AAE9C,MAAM,MAAM,mBAAmB,GAAG;IAChC,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,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,CAiBnC;AA8BD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,SAAgB,GACjB,EAAE,mBAAmB,GAAG;IACvB,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;CAChB,CAmCA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Connection, EdgeBase, InternalNodeBase, Transform } from '../../types/system';
|
|
2
|
+
export declare function getEdgeCenter({ sourceX, sourceY, targetX, targetY, }: {
|
|
3
|
+
sourceX: number;
|
|
4
|
+
sourceY: number;
|
|
5
|
+
targetX: number;
|
|
6
|
+
targetY: number;
|
|
7
|
+
}): [number, number, number, number];
|
|
8
|
+
export type GetEdgeZIndexParams = {
|
|
9
|
+
sourceNode: InternalNodeBase;
|
|
10
|
+
targetNode: InternalNodeBase;
|
|
11
|
+
selected?: boolean;
|
|
12
|
+
zIndex?: number;
|
|
13
|
+
elevateOnSelect?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare function getElevatedEdgeZIndex({ sourceNode, targetNode, selected, zIndex, elevateOnSelect, }: GetEdgeZIndexParams): number;
|
|
16
|
+
type IsEdgeVisibleParams = {
|
|
17
|
+
sourceNode: InternalNodeBase;
|
|
18
|
+
targetNode: InternalNodeBase;
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
transform: Transform;
|
|
22
|
+
};
|
|
23
|
+
export declare function isEdgeVisible({ sourceNode, targetNode, width, height, transform, }: IsEdgeVisibleParams): boolean;
|
|
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.
|
|
27
|
+
* @public
|
|
28
|
+
* @param edgeParams - Either an Edge or a Connection you want to add
|
|
29
|
+
* @param edges - The array of all current edges
|
|
30
|
+
* @returns A new array of edges with the new edge added
|
|
31
|
+
*/
|
|
32
|
+
export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[]) => EdgeType[];
|
|
33
|
+
export type UpdateEdgeOptions = {
|
|
34
|
+
shouldReplaceId?: boolean;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* A handy utility to update an existing Edge with new properties
|
|
38
|
+
* @param oldEdge - The edge you want to update
|
|
39
|
+
* @param newConnection - The new connection you want to update the edge with
|
|
40
|
+
* @param edges - The array of all current edges
|
|
41
|
+
* @param options.shouldReplaceId - should the id of the old edge be replaced with the new connection id
|
|
42
|
+
* @returns the updated edges array
|
|
43
|
+
*/
|
|
44
|
+
export declare const updateEdge: <EdgeType extends EdgeBase>(oldEdge: EdgeType, newConnection: Connection, edges: EdgeType[], options?: UpdateEdgeOptions) => EdgeType[];
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=general.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/general.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,SAAS,EACV,MAAM,oBAAoB,CAAC;AA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AAiB,KACzB,QAAQ,EA4BV,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InternalNodeBase, ConnectionMode, OnError, EdgePosition } from '../../types/system';
|
|
2
|
+
export type GetEdgePositionParams = {
|
|
3
|
+
id: string;
|
|
4
|
+
sourceNode: InternalNodeBase;
|
|
5
|
+
sourceHandle: string | null;
|
|
6
|
+
targetNode: InternalNodeBase;
|
|
7
|
+
targetHandle: string | null;
|
|
8
|
+
connectionMode: ConnectionMode;
|
|
9
|
+
onError?: OnError;
|
|
10
|
+
};
|
|
11
|
+
export declare function getEdgePosition(params: GetEdgePositionParams): EdgePosition | null;
|
|
12
|
+
//# sourceMappingURL=positions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"positions.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/positions.ts"],"names":[],"mappings":"AACA,OAAO,EACL,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,YAAY,EAIb,MAAM,oBAAoB,CAAC;AAG5B,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAUF,wBAAgB,eAAe,CAC7B,MAAM,EAAE,qBAAqB,GAC5B,YAAY,GAAG,IAAI,CA4DrB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Position } from '../../types/system';
|
|
2
|
+
export interface GetSmoothStepPathParams {
|
|
3
|
+
sourceX: number;
|
|
4
|
+
sourceY: number;
|
|
5
|
+
sourcePosition?: Position;
|
|
6
|
+
targetX: number;
|
|
7
|
+
targetY: number;
|
|
8
|
+
targetPosition?: Position;
|
|
9
|
+
borderRadius?: number;
|
|
10
|
+
centerX?: number;
|
|
11
|
+
centerY?: number;
|
|
12
|
+
offset?: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get a smooth step path from source to target handle
|
|
16
|
+
* @param params.sourceX - The x position of the source handle
|
|
17
|
+
* @param params.sourceY - The y position of the source handle
|
|
18
|
+
* @param params.sourcePosition - The position of the source handle (default: Position.Bottom)
|
|
19
|
+
* @param params.targetX - The x position of the target handle
|
|
20
|
+
* @param params.targetY - The y position of the target handle
|
|
21
|
+
* @param params.targetPosition - The position of the target handle (default: Position.Top)
|
|
22
|
+
* @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
|
+
* @example
|
|
24
|
+
* const source = { x: 0, y: 20 };
|
|
25
|
+
const target = { x: 150, y: 100 };
|
|
26
|
+
|
|
27
|
+
const [path, labelX, labelY, offsetX, offsetY] = getSmoothStepPath({
|
|
28
|
+
sourceX: source.x,
|
|
29
|
+
sourceY: source.y,
|
|
30
|
+
sourcePosition: Position.Right,
|
|
31
|
+
targetX: target.x,
|
|
32
|
+
targetY: target.y,
|
|
33
|
+
targetPosition: Position.Left,
|
|
34
|
+
});
|
|
35
|
+
*/
|
|
36
|
+
export declare function getSmoothStepPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, borderRadius, centerX, centerY, offset, }: GetSmoothStepPathParams): [
|
|
37
|
+
path: string,
|
|
38
|
+
labelX: number,
|
|
39
|
+
labelY: number,
|
|
40
|
+
offsetX: number,
|
|
41
|
+
offsetY: number
|
|
42
|
+
];
|
|
43
|
+
//# 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":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,oBAAoB,CAAC;AAG1D,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;AAkOD;;;;;;;;;;;;;;;;;;;;;GAqBG;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;IAC3B,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,MAAM;IACd,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,MAAM;CAChB,CAyBA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export type GetStraightPathParams = {
|
|
2
|
+
sourceX: number;
|
|
3
|
+
sourceY: number;
|
|
4
|
+
targetX: number;
|
|
5
|
+
targetY: number;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Get a straight path from source to target handle
|
|
9
|
+
* @param params.sourceX - The x position of the source handle
|
|
10
|
+
* @param params.sourceY - The y position of the source handle
|
|
11
|
+
* @param params.targetX - The x position of the target handle
|
|
12
|
+
* @param params.targetY - The y position of the target handle
|
|
13
|
+
* @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
|
+
* @example
|
|
15
|
+
* const source = { x: 0, y: 20 };
|
|
16
|
+
const target = { x: 150, y: 100 };
|
|
17
|
+
|
|
18
|
+
const [path, labelX, labelY, offsetX, offsetY] = getStraightPath({
|
|
19
|
+
sourceX: source.x,
|
|
20
|
+
sourceY: source.y,
|
|
21
|
+
sourcePosition: Position.Right,
|
|
22
|
+
targetX: target.x,
|
|
23
|
+
targetY: target.y,
|
|
24
|
+
targetPosition: Position.Left,
|
|
25
|
+
});
|
|
26
|
+
*/
|
|
27
|
+
export declare function getStraightPath({ sourceX, sourceY, targetX, targetY, }: GetStraightPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
|
|
28
|
+
//# 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,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;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,26 @@
|
|
|
1
|
+
import { Connection, EdgeBase, InternalNodeBase, Transform } from '../types/system';
|
|
2
|
+
type IsEdgeVisibleParams = {
|
|
3
|
+
sourceNode: InternalNodeBase;
|
|
4
|
+
targetNode: InternalNodeBase;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
transform: Transform;
|
|
8
|
+
};
|
|
9
|
+
export declare function isEdgeVisible({ sourceNode, targetNode, width, height, transform, }: IsEdgeVisibleParams): boolean;
|
|
10
|
+
export type GetEdgeZIndexParams = {
|
|
11
|
+
sourceNode: InternalNodeBase;
|
|
12
|
+
targetNode: InternalNodeBase;
|
|
13
|
+
selected?: boolean;
|
|
14
|
+
zIndex?: number;
|
|
15
|
+
elevateOnSelect?: boolean;
|
|
16
|
+
};
|
|
17
|
+
export declare function getElevatedEdgeZIndex({ sourceNode, targetNode, selected, zIndex, elevateOnSelect, }: GetEdgeZIndexParams): number;
|
|
18
|
+
export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[]) => EdgeType[];
|
|
19
|
+
export declare function getEdgeCenter({ sourceX, sourceY, targetX, targetY, }: {
|
|
20
|
+
sourceX: number;
|
|
21
|
+
sourceY: number;
|
|
22
|
+
targetX: number;
|
|
23
|
+
targetY: number;
|
|
24
|
+
}): [number, number, number, number];
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=edges.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/utils/edges.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EAEV,QAAQ,EAER,gBAAgB,EAGhB,SAAS,EACV,MAAM,iBAAiB,CAAC;AASzB,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,EAC5B,UAAU,EACV,UAAU,EACV,KAAK,EACL,MAAM,EACN,SAAS,GACV,EAAE,mBAAmB,GAAG,OAAO,CAsB/B;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,CAc9B;AAED,eAAO,MAAM,OAAO,0CACN,QAAQ,GAAG,UAAU,SAC1B,QAAQ,EAAE,KAChB,QAAQ,EA8BV,CAAC;AAsBF,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"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Ref, ReactNode, RefAttributes } from 'react';
|
|
2
|
+
import { XYPosition, Transform, SnapGrid, InternalNodeBase, NodeBase, NodeOrigin, Rect, Box, CoordinateExtent, Viewport, Dimensions, NodeLookup } from '../types/system';
|
|
3
|
+
import { Node } from '../types';
|
|
4
|
+
export declare const clamp: (val: number, min?: number, max?: number) => number;
|
|
5
|
+
export declare const clampPosition: (position: XYPosition, extent: CoordinateExtent) => {
|
|
6
|
+
x: number;
|
|
7
|
+
y: number;
|
|
8
|
+
};
|
|
9
|
+
export declare function getNodeDimensions(node: {
|
|
10
|
+
measured?: {
|
|
11
|
+
width?: number;
|
|
12
|
+
height?: number;
|
|
13
|
+
};
|
|
14
|
+
width?: number;
|
|
15
|
+
height?: number;
|
|
16
|
+
initialWidth?: number;
|
|
17
|
+
initialHeight?: number;
|
|
18
|
+
}): {
|
|
19
|
+
width: number;
|
|
20
|
+
height: number;
|
|
21
|
+
};
|
|
22
|
+
export declare const isNumeric: (n: any) => n is number;
|
|
23
|
+
export declare const snapPosition: (position: XYPosition, snapGrid?: SnapGrid) => XYPosition;
|
|
24
|
+
export declare const pointToRendererPoint: ({ x, y }: XYPosition, [tx, ty, tScale]: Transform, snapToGrid?: boolean, snapGrid?: SnapGrid) => XYPosition;
|
|
25
|
+
export declare const nodeToRect: (node: InternalNodeBase | NodeBase, nodeOrigin?: NodeOrigin) => Rect;
|
|
26
|
+
export declare const getBoundsOfBoxes: (box1: Box, box2: Box) => Box;
|
|
27
|
+
export declare const rectToBox: ({ x, y, width, height }: Rect) => Box;
|
|
28
|
+
export declare const boxToRect: ({ x, y, x2, y2 }: Box) => Rect;
|
|
29
|
+
export declare const nodeToBox: (node: InternalNodeBase | NodeBase, nodeOrigin?: NodeOrigin) => Box;
|
|
30
|
+
export declare const getBoundsOfRects: (rect1: Rect, rect2: Rect) => Rect;
|
|
31
|
+
export declare function fixedForwardRef<T, P = {}>(render: (props: P, ref: Ref<T>) => ReactNode): (props: P & RefAttributes<T>) => ReactNode;
|
|
32
|
+
export declare const getOverlappingArea: (rectA: Rect, rectB: Rect) => number;
|
|
33
|
+
export declare const getViewportForBounds: (bounds: Rect, width: number, height: number, minZoom: number, maxZoom: number, padding: number) => Viewport;
|
|
34
|
+
export declare function isCoordinateExtent(extent?: CoordinateExtent | 'parent'): extent is CoordinateExtent;
|
|
35
|
+
export declare function nodeHasDimensions<NodeType extends NodeBase = NodeBase>(node: NodeType): boolean;
|
|
36
|
+
export declare const calcAutoPan: (pos: XYPosition, bounds: Dimensions) => number[];
|
|
37
|
+
export declare const getPositionWithOrigin: ({ x, y, width, height, origin, }: {
|
|
38
|
+
x: number;
|
|
39
|
+
y: number;
|
|
40
|
+
width: number;
|
|
41
|
+
height: number;
|
|
42
|
+
origin?: NodeOrigin;
|
|
43
|
+
}) => XYPosition;
|
|
44
|
+
export declare const rendererPointToPoint: ({ x, y }: XYPosition, [tx, ty, tScale]: Transform) => XYPosition;
|
|
45
|
+
export declare const isMacOs: () => boolean;
|
|
46
|
+
export declare const isNode: <NodeType extends Node = Node>(element: unknown) => element is NodeType;
|
|
47
|
+
export declare const isNodeBase: <NodeType extends NodeBase = NodeBase>(element: any) => element is NodeType;
|
|
48
|
+
/**
|
|
49
|
+
* Convert child position to aboslute position
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
* @param position
|
|
53
|
+
* @param parentId
|
|
54
|
+
* @param nodeLookup
|
|
55
|
+
* @param nodeOrigin
|
|
56
|
+
* @returns an internal node with an absolute position
|
|
57
|
+
*/
|
|
58
|
+
export declare function evaluateAbsolutePosition(position: XYPosition, parentId: string, nodeLookup: NodeLookup, nodeOrigin?: NodeOrigin): XYPosition;
|
|
59
|
+
export declare const isRectObject: (obj: any) => obj is Rect;
|
|
60
|
+
export declare const devWarn: (id: string, message: string) => void;
|
|
61
|
+
//# 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,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAc,MAAM,OAAO,CAAC;AAClE,OAAO,EACL,UAAU,EACV,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,IAAI,EACJ,GAAG,EACH,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAGhC,eAAO,MAAM,KAAK,QAAS,MAAM,iCAAqB,MACnB,CAAC;AAEpC,eAAO,MAAM,aA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itViewOptionsBase, CoordinateExtent, NodeLookup, OnError, OnBeforeDeleteBase } from '../types/system';
|
|
2
|
+
/**
|
|
3
|
+
* Test whether an object is useable 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 useable 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
|
+
* Pass in a node, and get connected nodes where edge.source === node.id
|
|
21
|
+
* @public
|
|
22
|
+
* @param node - The node to get the connected nodes from
|
|
23
|
+
* @param nodes - The array of all nodes
|
|
24
|
+
* @param edges - The array of all edges
|
|
25
|
+
* @returns An array of nodes that are connected over eges where the source is the given node
|
|
26
|
+
*/
|
|
27
|
+
export declare const getOutgoers: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(node: NodeType | {
|
|
28
|
+
id: string;
|
|
29
|
+
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[];
|
|
30
|
+
/**
|
|
31
|
+
* Pass in a node, and get connected nodes where edge.target === node.id
|
|
32
|
+
* @public
|
|
33
|
+
* @param node - The node to get the connected nodes from
|
|
34
|
+
* @param nodes - The array of all nodes
|
|
35
|
+
* @param edges - The array of all edges
|
|
36
|
+
* @returns An array of nodes that are connected over eges where the target is the given node
|
|
37
|
+
*/
|
|
38
|
+
export declare const getIncomers: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(node: NodeType | {
|
|
39
|
+
id: string;
|
|
40
|
+
}, nodes: NodeType[], edges: EdgeType[]) => NodeType[];
|
|
41
|
+
export declare const getNodePositionWithOrigin: (node: InternalNodeBase | NodeBase, nodeOrigin?: NodeOrigin) => {
|
|
42
|
+
position: XYPosition;
|
|
43
|
+
positionAbsolute: XYPosition;
|
|
44
|
+
};
|
|
45
|
+
export type GetNodesBoundsParams = {
|
|
46
|
+
nodeOrigin?: NodeOrigin;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Determines a bounding box that contains all given nodes in an array
|
|
50
|
+
* @public
|
|
51
|
+
* @remarks Useful when combined with {@link getViewportForBounds} to calculate the correct transform to fit the given nodes in a viewport.
|
|
52
|
+
* @param nodes - Nodes to calculate the bounds for
|
|
53
|
+
* @param params.nodeOrigin - Origin of the nodes: [0, 0] - top left, [0.5, 0.5] - center
|
|
54
|
+
* @returns Bounding box enclosing all nodes
|
|
55
|
+
*/
|
|
56
|
+
export declare const getNodesBounds: (nodes: NodeBase[], params?: GetNodesBoundsParams) => Rect;
|
|
57
|
+
export type GetInternalNodesBoundsParams<NodeType> = {
|
|
58
|
+
nodeOrigin?: NodeOrigin;
|
|
59
|
+
useRelativePosition?: boolean;
|
|
60
|
+
filter?: (node: NodeType) => boolean;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Determines a bounding box that contains all given nodes in an array
|
|
64
|
+
* @internal
|
|
65
|
+
*/
|
|
66
|
+
export declare const getInternalNodesBounds: <NodeType extends InternalNodeBase | NodeDragItem>(nodeLookup: Map<string, NodeType>, params?: GetInternalNodesBoundsParams<NodeType>) => Rect;
|
|
67
|
+
export declare const getNodesInside: <NodeType extends NodeBase = NodeBase>(nodes: Map<string, InternalNodeBase<NodeType>>, rect: Rect, [tx, ty, tScale]?: Transform, partially?: boolean, excludeNonSelectableNodes?: boolean, nodeOrigin?: NodeOrigin) => InternalNodeBase<NodeType>[];
|
|
68
|
+
/**
|
|
69
|
+
* Get all connecting edges for a given set of nodes
|
|
70
|
+
* @param nodes - Nodes you want to get the connected edges for
|
|
71
|
+
* @param edges - All edges
|
|
72
|
+
* @returns Array of edges that connect any of the given nodes with each other
|
|
73
|
+
*/
|
|
74
|
+
export declare const getConnectedEdges: <NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>(nodes: NodeType[], edges: EdgeType[]) => EdgeType[];
|
|
75
|
+
export declare function fitView<Params extends FitViewParamsBase<NodeBase>, Options extends FitViewOptionsBase<NodeBase>>({ nodeLookup, width, height, panZoom, minZoom, maxZoom, nodeOrigin, }: Params, options?: Options): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* This function calculates the next position of a node, taking into account the node's extent, parent node, and origin.
|
|
78
|
+
*
|
|
79
|
+
* @internal
|
|
80
|
+
* @returns position, positionAbsolute
|
|
81
|
+
*/
|
|
82
|
+
export declare function calculateNodePosition<NodeType extends NodeBase>({ nodeId, nextPosition, nodeLookup, nodeOrigin, nodeExtent, onError, }: {
|
|
83
|
+
nodeId: string;
|
|
84
|
+
nextPosition: XYPosition;
|
|
85
|
+
nodeLookup: NodeLookup<InternalNodeBase<NodeType>>;
|
|
86
|
+
nodeOrigin?: NodeOrigin;
|
|
87
|
+
nodeExtent?: CoordinateExtent;
|
|
88
|
+
onError?: OnError;
|
|
89
|
+
}): {
|
|
90
|
+
position: XYPosition;
|
|
91
|
+
positionAbsolute: XYPosition;
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Pass in nodes & edges to delete, get arrays of nodes and edges that actually can be deleted
|
|
95
|
+
* @internal
|
|
96
|
+
* @param param.nodesToRemove - The nodes to remove
|
|
97
|
+
* @param param.edgesToRemove - The edges to remove
|
|
98
|
+
* @param param.nodes - All nodes
|
|
99
|
+
* @param param.edges - All edges
|
|
100
|
+
* @param param.onBeforeDelete - Callback to check which nodes and edges can be deleted
|
|
101
|
+
* @returns nodes: nodes that can be deleted, edges: edges that can be deleted
|
|
102
|
+
*/
|
|
103
|
+
export declare function getElementsToRemove<NodeType extends NodeBase = NodeBase, EdgeType extends EdgeBase = EdgeBase>({ nodesToRemove, edgesToRemove, nodes, edges, onBeforeDelete, }: {
|
|
104
|
+
nodesToRemove: Partial<NodeType>[];
|
|
105
|
+
edgesToRemove: Partial<EdgeType>[];
|
|
106
|
+
nodes: NodeType[];
|
|
107
|
+
edges: EdgeType[];
|
|
108
|
+
onBeforeDelete?: OnBeforeDeleteBase<NodeType, EdgeType>;
|
|
109
|
+
}): Promise<{
|
|
110
|
+
nodes: NodeType[];
|
|
111
|
+
edges: EdgeType[];
|
|
112
|
+
}>;
|
|
113
|
+
//# sourceMappingURL=graph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graph.d.ts","sourceRoot":"","sources":["../../src/utils/graph.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,gBAAgB,EAChB,UAAU,EACV,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,SAAS,EACT,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,UAAU,EACV,OAAO,EACP,kBAAkB,EACnB,MAAM,iBAAiB,CAAC;AAEzB;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,kDACZ,GAAG,wBAEiD,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,kDACZ,GAAG,wBAKU,CAAC;AAEzB,eAAO,MAAM,kBAAkB,kEAGpB,GAAG,wBAKU,CAAC;AAEzB;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,qFAIhB,QAAQ,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,SACxB,QAAQ,EAAE,SACV,QAAQ,EAAE,KAChB,QAAQ,EAaV,CAAC;AAEF;;;;;;;GAOG;AACH,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AM,EACT,OAAO,CAAC,EAAE,OAAO,WAoClB;AA0BD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,SAAS,QAAQ,EAAE,EAC/D,MAAM,EACN,YAAY,EACZ,UAAU,EACV,UAAmB,EACnB,UAAU,EACV,OAAO,GACR,EAAE;IACD,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,UAAU,CAAC;IACzB,UAAU,EAAE,UAAU,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;IACnD,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG;IAAE,QAAQ,EAAE,UAAU,CAAC;IAAC,gBAAgB,EAAE,UAAU,CAAA;CAAE,CAmDzD;AAED;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,EACpC,QAAQ,SAAS,QAAQ,GAAG,QAAQ,EACpC,EACA,aAAkB,EAClB,aAAkB,EAClB,KAAK,EACL,KAAK,EACL,cAAc,GACf,EAAE;IACD,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,aAAa,EAAE,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;IACnC,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,cAAc,CAAC,EAAE,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;CACzD,GAAG,OAAO,CAAC;IACV,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,CAAC,CAoDD"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EdgeMarkerType, EdgeBase, MarkerProps } from '../types/system';
|
|
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;
|
|
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,EACL,cAAc,EAEd,QAAQ,EACR,WAAW,EACZ,MAAM,iBAAiB,CAAC;AAEzB,wBAAgB,WAAW,CACzB,MAAM,EAAE,cAAc,GAAG,SAAS,EAClC,EAAE,CAAC,EAAE,MAAM,GAAG,IAAI,GACjB,MAAM,CAeR;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,CAAC;IACtB,kBAAkB,CAAC,EAAE,cAAc,CAAC;IACpC,gBAAgB,CAAC,EAAE,cAAc,CAAC;CACnC,iBA0BF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { InternalNodeBase, ConnectionMode, OnError, EdgePosition } from '../types/system';
|
|
2
|
+
export type GetEdgePositionParams = {
|
|
3
|
+
id: string;
|
|
4
|
+
sourceNode: InternalNodeBase;
|
|
5
|
+
sourceHandle: string | null;
|
|
6
|
+
targetNode: InternalNodeBase;
|
|
7
|
+
targetHandle: string | null;
|
|
8
|
+
connectionMode: ConnectionMode;
|
|
9
|
+
onError?: OnError;
|
|
10
|
+
};
|
|
11
|
+
export declare function getEdgePosition(params: GetEdgePositionParams): EdgePosition | null;
|
|
12
|
+
//# sourceMappingURL=positions.d.ts.map
|