@angflow/system 0.0.91 → 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.
Files changed (184) hide show
  1. package/dist/esm/constants.d.ts +43 -0
  2. package/dist/esm/constants.d.ts.map +1 -0
  3. package/dist/esm/index.d.ts +9 -8
  4. package/dist/esm/index.d.ts.map +1 -0
  5. package/dist/esm/index.js +10 -7
  6. package/dist/esm/index.mjs +10 -7
  7. package/dist/esm/types/changes.d.ts +64 -0
  8. package/dist/esm/types/changes.d.ts.map +1 -0
  9. package/dist/esm/types/edges.d.ts +140 -0
  10. package/dist/esm/types/edges.d.ts.map +1 -0
  11. package/dist/esm/types/general.d.ts +296 -0
  12. package/dist/esm/types/general.d.ts.map +1 -0
  13. package/dist/esm/types/handles.d.ts +65 -0
  14. package/dist/esm/types/handles.d.ts.map +1 -0
  15. package/dist/esm/types/index.d.ts +8 -0
  16. package/dist/esm/types/index.d.ts.map +1 -0
  17. package/dist/esm/types/nodes.d.ts +157 -0
  18. package/dist/esm/types/nodes.d.ts.map +1 -0
  19. package/dist/esm/types/panzoom.d.ts +55 -0
  20. package/dist/esm/types/panzoom.d.ts.map +1 -0
  21. package/dist/esm/types/utils.d.ts +61 -0
  22. package/dist/esm/types/utils.d.ts.map +1 -0
  23. package/dist/esm/utils/connections.d.ts +13 -0
  24. package/dist/esm/utils/connections.d.ts.map +1 -0
  25. package/dist/esm/utils/dom.d.ts +21 -0
  26. package/dist/esm/utils/dom.d.ts.map +1 -0
  27. package/dist/esm/utils/edge-toolbar.d.ts +2 -0
  28. package/dist/esm/utils/edge-toolbar.d.ts.map +1 -0
  29. package/dist/esm/utils/edges/bezier-edge.d.ts +77 -0
  30. package/dist/esm/utils/edges/bezier-edge.d.ts.map +1 -0
  31. package/dist/esm/utils/edges/floating.d.ts +32 -0
  32. package/dist/esm/utils/edges/floating.d.ts.map +1 -0
  33. package/dist/esm/utils/edges/general.d.ts +91 -0
  34. package/dist/esm/utils/edges/general.d.ts.map +1 -0
  35. package/dist/esm/utils/edges/index.d.ts +7 -0
  36. package/dist/esm/utils/edges/index.d.ts.map +1 -0
  37. package/dist/esm/utils/edges/positions.d.ts +17 -0
  38. package/dist/esm/utils/edges/positions.d.ts.map +1 -0
  39. package/dist/esm/utils/edges/smoothstep-edge.d.ts +66 -0
  40. package/dist/esm/utils/edges/smoothstep-edge.d.ts.map +1 -0
  41. package/dist/esm/utils/edges/straight-edge.d.ts +41 -0
  42. package/dist/esm/utils/edges/straight-edge.d.ts.map +1 -0
  43. package/dist/esm/utils/general.d.ts +86 -0
  44. package/dist/esm/utils/general.d.ts.map +1 -0
  45. package/dist/esm/utils/graph.d.ts +191 -0
  46. package/dist/esm/utils/graph.d.ts.map +1 -0
  47. package/dist/esm/utils/index.d.ts +12 -0
  48. package/dist/esm/utils/index.d.ts.map +1 -0
  49. package/dist/esm/utils/marker.d.ts +9 -0
  50. package/dist/esm/utils/marker.d.ts.map +1 -0
  51. package/dist/esm/utils/node-toolbar.d.ts +3 -0
  52. package/dist/esm/utils/node-toolbar.d.ts.map +1 -0
  53. package/dist/esm/utils/shallow-node-data.d.ts +5 -0
  54. package/dist/esm/utils/shallow-node-data.d.ts.map +1 -0
  55. package/dist/esm/utils/store.d.ts +34 -0
  56. package/dist/esm/utils/store.d.ts.map +1 -0
  57. package/dist/esm/utils/types.d.ts +8 -0
  58. package/dist/esm/utils/types.d.ts.map +1 -0
  59. package/dist/esm/xydrag/XYDrag.d.ts +55 -0
  60. package/dist/esm/xydrag/XYDrag.d.ts.map +1 -0
  61. package/dist/esm/xydrag/index.d.ts +2 -0
  62. package/dist/esm/xydrag/index.d.ts.map +1 -0
  63. package/dist/esm/xydrag/utils.d.ts +24 -0
  64. package/dist/esm/xydrag/utils.d.ts.map +1 -0
  65. package/dist/esm/xyhandle/XYHandle.d.ts +3 -0
  66. package/dist/esm/xyhandle/XYHandle.d.ts.map +1 -0
  67. package/dist/esm/xyhandle/index.d.ts +2 -0
  68. package/dist/esm/xyhandle/index.d.ts.map +1 -0
  69. package/dist/esm/xyhandle/types.d.ts +51 -0
  70. package/dist/esm/xyhandle/types.d.ts.map +1 -0
  71. package/dist/esm/xyhandle/utils.d.ts +29 -0
  72. package/dist/esm/xyhandle/utils.d.ts.map +1 -0
  73. package/dist/esm/xyminimap/index.d.ts +28 -0
  74. package/dist/esm/xyminimap/index.d.ts.map +1 -0
  75. package/dist/esm/xypanzoom/XYPanZoom.d.ts +12 -0
  76. package/dist/esm/xypanzoom/XYPanZoom.d.ts.map +1 -0
  77. package/dist/esm/xypanzoom/eventhandler.d.ts +46 -0
  78. package/dist/esm/xypanzoom/eventhandler.d.ts.map +1 -0
  79. package/dist/esm/xypanzoom/filter.d.ts +15 -0
  80. package/dist/esm/xypanzoom/filter.d.ts.map +1 -0
  81. package/dist/esm/xypanzoom/index.d.ts +2 -0
  82. package/dist/esm/xypanzoom/index.d.ts.map +1 -0
  83. package/dist/esm/xypanzoom/utils.d.ts +9 -0
  84. package/dist/esm/xypanzoom/utils.d.ts.map +1 -0
  85. package/dist/esm/xyresizer/XYResizer.d.ts +49 -0
  86. package/dist/esm/xyresizer/XYResizer.d.ts.map +1 -0
  87. package/dist/esm/xyresizer/index.d.ts +3 -0
  88. package/dist/esm/xyresizer/index.d.ts.map +1 -0
  89. package/dist/esm/xyresizer/types.d.ts +59 -0
  90. package/dist/esm/xyresizer/types.d.ts.map +1 -0
  91. package/dist/esm/xyresizer/utils.d.ts +76 -0
  92. package/dist/esm/xyresizer/utils.d.ts.map +1 -0
  93. package/dist/umd/constants.d.ts +43 -0
  94. package/dist/umd/constants.d.ts.map +1 -0
  95. package/dist/umd/index.d.ts +9 -0
  96. package/dist/umd/index.d.ts.map +1 -0
  97. package/dist/umd/index.js +1 -1
  98. package/dist/umd/types/changes.d.ts +64 -0
  99. package/dist/umd/types/changes.d.ts.map +1 -0
  100. package/dist/umd/types/edges.d.ts +140 -0
  101. package/dist/umd/types/edges.d.ts.map +1 -0
  102. package/dist/umd/types/general.d.ts +296 -0
  103. package/dist/umd/types/general.d.ts.map +1 -0
  104. package/dist/umd/types/handles.d.ts +65 -0
  105. package/dist/umd/types/handles.d.ts.map +1 -0
  106. package/dist/umd/types/index.d.ts +8 -0
  107. package/dist/umd/types/index.d.ts.map +1 -0
  108. package/dist/umd/types/nodes.d.ts +157 -0
  109. package/dist/umd/types/nodes.d.ts.map +1 -0
  110. package/dist/umd/types/panzoom.d.ts +55 -0
  111. package/dist/umd/types/panzoom.d.ts.map +1 -0
  112. package/dist/umd/types/utils.d.ts +61 -0
  113. package/dist/umd/types/utils.d.ts.map +1 -0
  114. package/dist/umd/utils/connections.d.ts +13 -0
  115. package/dist/umd/utils/connections.d.ts.map +1 -0
  116. package/dist/umd/utils/dom.d.ts +21 -0
  117. package/dist/umd/utils/dom.d.ts.map +1 -0
  118. package/dist/umd/utils/edge-toolbar.d.ts +2 -0
  119. package/dist/umd/utils/edge-toolbar.d.ts.map +1 -0
  120. package/dist/umd/utils/edges/bezier-edge.d.ts +77 -0
  121. package/dist/umd/utils/edges/bezier-edge.d.ts.map +1 -0
  122. package/dist/umd/utils/edges/floating.d.ts +32 -0
  123. package/dist/umd/utils/edges/floating.d.ts.map +1 -0
  124. package/dist/umd/utils/edges/general.d.ts +91 -0
  125. package/dist/umd/utils/edges/general.d.ts.map +1 -0
  126. package/dist/umd/utils/edges/index.d.ts +7 -0
  127. package/dist/umd/utils/edges/index.d.ts.map +1 -0
  128. package/dist/umd/utils/edges/positions.d.ts +17 -0
  129. package/dist/umd/utils/edges/positions.d.ts.map +1 -0
  130. package/dist/umd/utils/edges/smoothstep-edge.d.ts +66 -0
  131. package/dist/umd/utils/edges/smoothstep-edge.d.ts.map +1 -0
  132. package/dist/umd/utils/edges/straight-edge.d.ts +41 -0
  133. package/dist/umd/utils/edges/straight-edge.d.ts.map +1 -0
  134. package/dist/umd/utils/general.d.ts +86 -0
  135. package/dist/umd/utils/general.d.ts.map +1 -0
  136. package/dist/umd/utils/graph.d.ts +191 -0
  137. package/dist/umd/utils/graph.d.ts.map +1 -0
  138. package/dist/umd/utils/index.d.ts +12 -0
  139. package/dist/umd/utils/index.d.ts.map +1 -0
  140. package/dist/umd/utils/marker.d.ts +9 -0
  141. package/dist/umd/utils/marker.d.ts.map +1 -0
  142. package/dist/umd/utils/node-toolbar.d.ts +3 -0
  143. package/dist/umd/utils/node-toolbar.d.ts.map +1 -0
  144. package/dist/umd/utils/shallow-node-data.d.ts +5 -0
  145. package/dist/umd/utils/shallow-node-data.d.ts.map +1 -0
  146. package/dist/umd/utils/store.d.ts +34 -0
  147. package/dist/umd/utils/store.d.ts.map +1 -0
  148. package/dist/umd/utils/types.d.ts +8 -0
  149. package/dist/umd/utils/types.d.ts.map +1 -0
  150. package/dist/umd/xydrag/XYDrag.d.ts +55 -0
  151. package/dist/umd/xydrag/XYDrag.d.ts.map +1 -0
  152. package/dist/umd/xydrag/index.d.ts +2 -0
  153. package/dist/umd/xydrag/index.d.ts.map +1 -0
  154. package/dist/umd/xydrag/utils.d.ts +24 -0
  155. package/dist/umd/xydrag/utils.d.ts.map +1 -0
  156. package/dist/umd/xyhandle/XYHandle.d.ts +3 -0
  157. package/dist/umd/xyhandle/XYHandle.d.ts.map +1 -0
  158. package/dist/umd/xyhandle/index.d.ts +2 -0
  159. package/dist/umd/xyhandle/index.d.ts.map +1 -0
  160. package/dist/umd/xyhandle/types.d.ts +51 -0
  161. package/dist/umd/xyhandle/types.d.ts.map +1 -0
  162. package/dist/umd/xyhandle/utils.d.ts +29 -0
  163. package/dist/umd/xyhandle/utils.d.ts.map +1 -0
  164. package/dist/umd/xyminimap/index.d.ts +28 -0
  165. package/dist/umd/xyminimap/index.d.ts.map +1 -0
  166. package/dist/umd/xypanzoom/XYPanZoom.d.ts +12 -0
  167. package/dist/umd/xypanzoom/XYPanZoom.d.ts.map +1 -0
  168. package/dist/umd/xypanzoom/eventhandler.d.ts +46 -0
  169. package/dist/umd/xypanzoom/eventhandler.d.ts.map +1 -0
  170. package/dist/umd/xypanzoom/filter.d.ts +15 -0
  171. package/dist/umd/xypanzoom/filter.d.ts.map +1 -0
  172. package/dist/umd/xypanzoom/index.d.ts +2 -0
  173. package/dist/umd/xypanzoom/index.d.ts.map +1 -0
  174. package/dist/umd/xypanzoom/utils.d.ts +9 -0
  175. package/dist/umd/xypanzoom/utils.d.ts.map +1 -0
  176. package/dist/umd/xyresizer/XYResizer.d.ts +49 -0
  177. package/dist/umd/xyresizer/XYResizer.d.ts.map +1 -0
  178. package/dist/umd/xyresizer/index.d.ts +3 -0
  179. package/dist/umd/xyresizer/index.d.ts.map +1 -0
  180. package/dist/umd/xyresizer/types.d.ts +59 -0
  181. package/dist/umd/xyresizer/types.d.ts.map +1 -0
  182. package/dist/umd/xyresizer/utils.d.ts +76 -0
  183. package/dist/umd/xyresizer/utils.d.ts.map +1 -0
  184. package/package.json +1 -1
@@ -0,0 +1,157 @@
1
+ import type { XYPosition, Position, CoordinateExtent, Handle } from '.';
2
+ import { Optional } from '../utils/types';
3
+ /**
4
+ * Framework independent node data structure.
5
+ *
6
+ * @inline
7
+ * @typeParam NodeData - type of the node data
8
+ * @typeParam NodeType - type of the node
9
+ */
10
+ export type NodeBase<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string | undefined = string | undefined> = {
11
+ /** Unique id of a node. */
12
+ id: string;
13
+ /**
14
+ * Position of a node on the pane.
15
+ * @example { x: 0, y: 0 }
16
+ */
17
+ position: XYPosition;
18
+ /** Arbitrary data passed to a node. */
19
+ data: NodeData;
20
+ /**
21
+ * Only relevant for default, source, target nodeType. Controls source position.
22
+ * @example 'right', 'left', 'top', 'bottom'
23
+ */
24
+ sourcePosition?: Position;
25
+ /**
26
+ * Only relevant for default, source, target nodeType. Controls target position.
27
+ * @example 'right', 'left', 'top', 'bottom'
28
+ */
29
+ targetPosition?: Position;
30
+ /** Whether or not the node should be visible on the canvas. */
31
+ hidden?: boolean;
32
+ selected?: boolean;
33
+ /** Whether or not the node is currently being dragged. */
34
+ dragging?: boolean;
35
+ /** Whether or not the node is able to be dragged. */
36
+ draggable?: boolean;
37
+ selectable?: boolean;
38
+ connectable?: boolean;
39
+ deletable?: boolean;
40
+ /**
41
+ * A class name that can be applied to elements inside the node that allows those elements to act
42
+ * as drag handles, letting the user drag the node by clicking and dragging on those elements.
43
+ */
44
+ dragHandle?: string;
45
+ width?: number;
46
+ height?: number;
47
+ initialWidth?: number;
48
+ initialHeight?: number;
49
+ /** Parent node id, used for creating sub-flows. */
50
+ parentId?: string;
51
+ zIndex?: number;
52
+ /**
53
+ * Boundary a node can be moved in.
54
+ * @example 'parent' or [[0, 0], [100, 100]]
55
+ */
56
+ extent?: 'parent' | CoordinateExtent | null;
57
+ /**
58
+ * When `true`, the parent node will automatically expand if this node is dragged to the edge of
59
+ * the parent node's bounds.
60
+ */
61
+ expandParent?: boolean;
62
+ ariaLabel?: string;
63
+ /**
64
+ * Origin of the node relative to its position.
65
+ * @example
66
+ * [0.5, 0.5] // centers the node
67
+ * [0, 0] // top left
68
+ * [1, 1] // bottom right
69
+ */
70
+ origin?: NodeOrigin;
71
+ handles?: NodeHandle[];
72
+ measured?: {
73
+ width?: number;
74
+ height?: number;
75
+ };
76
+ } & (undefined extends NodeType ? {
77
+ /** Type of node defined in nodeTypes */
78
+ type?: string | undefined;
79
+ } : {
80
+ /** Type of node defined in nodeTypes */
81
+ type: NodeType;
82
+ });
83
+ export type InternalNodeBase<NodeType extends NodeBase = NodeBase> = Omit<NodeType, 'measured'> & {
84
+ measured: {
85
+ width?: number;
86
+ height?: number;
87
+ };
88
+ internals: {
89
+ positionAbsolute: XYPosition;
90
+ z: number;
91
+ rootParentIndex?: number;
92
+ /**
93
+ * Holds a reference to the original node object provided by the user.
94
+ * Used as an optimization to avoid certain operations.
95
+ */
96
+ userNode: NodeType;
97
+ handleBounds?: NodeHandleBounds;
98
+ bounds?: NodeBounds;
99
+ };
100
+ };
101
+ /**
102
+ * The node data structure that gets used for the custom nodes props.
103
+ *
104
+ * @public
105
+ */
106
+ export type NodeProps<NodeType extends NodeBase> = Pick<NodeType, 'id' | 'data' | 'width' | 'height' | 'sourcePosition' | 'targetPosition' | 'dragHandle' | 'parentId'> & Required<Pick<NodeType, 'type' | 'dragging' | 'zIndex' | 'selectable' | 'deletable' | 'selected' | 'draggable'>> & {
107
+ /** Whether a node is connectable or not. */
108
+ isConnectable: boolean;
109
+ /** Position absolute x value. */
110
+ positionAbsoluteX: number;
111
+ /** Position absolute y value. */
112
+ positionAbsoluteY: number;
113
+ };
114
+ export type NodeHandleBounds = {
115
+ source: Handle[] | null;
116
+ target: Handle[] | null;
117
+ };
118
+ export type InternalNodeUpdate = {
119
+ id: string;
120
+ nodeElement: HTMLDivElement;
121
+ force?: boolean;
122
+ };
123
+ export type NodeBounds = XYPosition & {
124
+ width: number | null;
125
+ height: number | null;
126
+ };
127
+ export type NodeDragItem = {
128
+ id: string;
129
+ position: XYPosition;
130
+ distance: XYPosition;
131
+ measured: {
132
+ width: number;
133
+ height: number;
134
+ };
135
+ internals: {
136
+ positionAbsolute: XYPosition;
137
+ };
138
+ } & Pick<InternalNodeBase, 'extent' | 'parentId' | 'origin' | 'expandParent' | 'dragging'>;
139
+ /**
140
+ * The origin of a Node determines how it is placed relative to its own coordinates.
141
+ * `[0, 0]` places it at the top left corner, `[0.5, 0.5]` right in the center and
142
+ * `[1, 1]` at the bottom right of its position.
143
+ *
144
+ * @public
145
+ */
146
+ export type NodeOrigin = [number, number];
147
+ export type OnSelectionDrag = (event: MouseEvent, nodes: NodeBase[]) => void;
148
+ /**
149
+ * Type for the handles of a node
150
+ *
151
+ * @public
152
+ */
153
+ export type NodeHandle = Omit<Optional<Handle, 'width' | 'height'>, 'nodeId'>;
154
+ export type Align = 'center' | 'start' | 'end';
155
+ export type NodeLookup<NodeType extends InternalNodeBase = InternalNodeBase> = Map<string, NodeType>;
156
+ export type ParentLookup<NodeType extends InternalNodeBase = InternalNodeBase> = Map<string, Map<string, NodeType>>;
157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AAM,MAAM,eAAe,GAAG,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;AAE7E;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,OAAO,GAAG,QAAQ,CAAC,EAAE,QAAQ,CAAC,CAAC;AAE9E,MAAM,MAAM,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;AAE/C,MAAM,MAAM,UAAU,CAAC,QAAQ,SAAS,gBAAgB,GAAG,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AACrG,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,gBAAgB,GAAG,gBAAgB,IAAI,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type { ZoomTransform } from 'd3-zoom';
2
+ import { PanOnScrollMode, type CoordinateExtent, type Transform, type Viewport } from './';
3
+ export type OnDraggingChange = (dragging: boolean) => void;
4
+ export type OnTransformChange = (transform: Transform) => void;
5
+ export type PanZoomParams = {
6
+ domNode: Element;
7
+ minZoom: number;
8
+ maxZoom: number;
9
+ viewport: Viewport;
10
+ translateExtent: CoordinateExtent;
11
+ onDraggingChange: OnDraggingChange;
12
+ onPanZoomStart?: OnPanZoom;
13
+ onPanZoom?: OnPanZoom;
14
+ onPanZoomEnd?: OnPanZoom;
15
+ };
16
+ export type PanZoomTransformOptions = {
17
+ duration?: number;
18
+ ease?: (t: number) => number;
19
+ interpolate?: 'smooth' | 'linear';
20
+ };
21
+ export type OnPanZoom = (event: MouseEvent | TouchEvent | null, viewport: Viewport) => void;
22
+ export type PanZoomUpdateOptions = {
23
+ noWheelClassName: string;
24
+ noPanClassName: string;
25
+ onPaneContextMenu?: (event: MouseEvent) => void;
26
+ preventScrolling: boolean;
27
+ panOnScroll: boolean;
28
+ panOnDrag: boolean | number[];
29
+ panOnScrollMode: PanOnScrollMode;
30
+ panOnScrollSpeed: number;
31
+ userSelectionActive: boolean;
32
+ zoomOnPinch: boolean;
33
+ zoomOnScroll: boolean;
34
+ zoomOnDoubleClick: boolean;
35
+ zoomActivationKeyPressed: boolean;
36
+ lib: string;
37
+ onTransformChange: OnTransformChange;
38
+ connectionInProgress: boolean;
39
+ paneClickDistance: number;
40
+ selectionOnDrag?: boolean;
41
+ };
42
+ export type PanZoomInstance = {
43
+ update: (params: PanZoomUpdateOptions) => void;
44
+ destroy: () => void;
45
+ getViewport: () => Viewport;
46
+ setViewport: (viewport: Viewport, options?: PanZoomTransformOptions) => Promise<ZoomTransform | undefined>;
47
+ setViewportConstrained: (viewport: Viewport, extent: CoordinateExtent, translateExtent: CoordinateExtent) => Promise<ZoomTransform | undefined>;
48
+ setScaleExtent: (scaleExtent: [number, number]) => void;
49
+ setTranslateExtent: (translateExtent: CoordinateExtent) => void;
50
+ scaleTo: (scale: number, options?: PanZoomTransformOptions) => Promise<boolean>;
51
+ scaleBy: (factor: number, options?: PanZoomTransformOptions) => Promise<boolean>;
52
+ syncViewport: (viewport: Viewport) => void;
53
+ setClickDistance: (distance: number) => void;
54
+ };
55
+ //# sourceMappingURL=panzoom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"panzoom.d.ts","sourceRoot":"","sources":["../../src/types/panzoom.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,OAAO,EAAE,eAAe,EAAE,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,IAAI,CAAC;AAE3F,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;AAC3D,MAAM,MAAM,iBAAiB,GAAG,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;AAE/D,MAAM,MAAM,aAAa,GAA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AAC;IAC9B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,MAAM,EAAE,CAAC,MAAM,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC/C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,WAAW,EAAE,MAAM,QAAQ,CAAC;IAC5B,WAAW,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IAC3G,sBAAsB,EAAE,CACtB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,gBAAgB,EACxB,eAAe,EAAE,gBAAgB,KAC9B,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC,CAAC;IACxC,cAAc,EAAE,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,CAAC;IACxD,kBAAkB,EAAE,CAAC,eAAe,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAChE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAChF,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,uBAAuB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACjF,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC3C,gBAAgB,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9C,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * While [`PanelPosition`](/api-reference/types/panel-position) can be used to place a
3
+ * component in the corners of a container, the `Position` enum is less precise and used
4
+ * primarily in relation to edges and handles.
5
+ *
6
+ * @public
7
+ */
8
+ export declare enum Position {
9
+ Left = "left",
10
+ Top = "top",
11
+ Right = "right",
12
+ Bottom = "bottom"
13
+ }
14
+ export declare const oppositePosition: {
15
+ left: Position;
16
+ right: Position;
17
+ top: Position;
18
+ bottom: Position;
19
+ };
20
+ /**
21
+ * All positions are stored in an object with x and y coordinates.
22
+ *
23
+ * @public
24
+ */
25
+ export type XYPosition = {
26
+ x: number;
27
+ y: number;
28
+ };
29
+ export type XYZPosition = XYPosition & {
30
+ z: number;
31
+ };
32
+ export type Dimensions = {
33
+ width: number;
34
+ height: number;
35
+ };
36
+ export type Rect = Dimensions & XYPosition;
37
+ export type Box = XYPosition & {
38
+ x2: number;
39
+ y2: number;
40
+ };
41
+ export type Transform = [number, number, number];
42
+ /**
43
+ * A coordinate extent represents two points in a coordinate system: one in the top
44
+ * left corner and one in the bottom right corner. It is used to represent the
45
+ * bounds of nodes in the flow or the bounds of the viewport.
46
+ *
47
+ * @public
48
+ *
49
+ * @remarks Props that expect a `CoordinateExtent` usually default to `[[-∞, -∞], [+∞, +∞]]`
50
+ * to represent an unbounded extent.
51
+ */
52
+ export type CoordinateExtent = [[number, number], [number, number]];
53
+ /**
54
+ * Using Pick with a union type (e.g. `NodeType`) will merge every property type along all union members.
55
+ * See https://github.com/microsoft/TypeScript/issues/28339#issuecomment-463577347
56
+ * Note: Currently you are able to Pick properties that are not in the type without error.
57
+ */
58
+ export type DistributivePick<T, K extends string> = T extends unknown ? {
59
+ [P in Extract<keyof T, K>]: T[P];
60
+ } : never;
61
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/types/utils.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,oBAAY,QAAQ;IAClB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,MAAM,WAAW;CAClB;AAED,eAAO,MAAM,gBAAgB;;;;;CAK5B,CAAC;AAEF;;;;GAIG;AACH,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;;;;;;;;;GASG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEpE;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,IAAI,CAAC,SAAS,OAAO,GAAG;KAAG,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAE,GAAG,KAAK,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { HandleConnection } from '../types';
2
+ /**
3
+ * @internal
4
+ */
5
+ export declare function areConnectionMapsEqual(a?: Map<string, HandleConnection>, b?: Map<string, HandleConnection>): boolean;
6
+ /**
7
+ * We call the callback for all connections in a that are not in b
8
+ *
9
+ * @internal
10
+ */
11
+ export declare function handleConnectionChange(a: Map<string, HandleConnection>, b: Map<string, HandleConnection>, cb?: (diff: HandleConnection[]) => void): void;
12
+ export declare function getConnectionStatus(isValid: boolean | null): "valid" | "invalid" | null;
13
+ //# sourceMappingURL=connections.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connections.d.ts","sourceRoot":"","sources":["../../src/utils/connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,WAoB1G;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAChC,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAChC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,IAAI,QAiBxC;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,8BAE1D"}
@@ -0,0 +1,21 @@
1
+ import type { Transform, XYPosition, SnapGrid, Dimensions, Handle } from '../types';
2
+ export type GetPointerPositionParams = {
3
+ transform: Transform;
4
+ snapGrid?: SnapGrid;
5
+ snapToGrid?: boolean;
6
+ containerBounds: DOMRect | null;
7
+ };
8
+ export declare function getPointerPosition(event: MouseEvent | TouchEvent, { snapGrid, snapToGrid, transform, containerBounds }: GetPointerPositionParams): XYPosition & {
9
+ xSnapped: number;
10
+ ySnapped: number;
11
+ };
12
+ export declare const getDimensions: (node: HTMLDivElement) => Dimensions;
13
+ export declare const getHostForElement: (element: HTMLElement | EventTarget | null) => Document | ShadowRoot;
14
+ export declare function isInputDOMNode(event: KeyboardEvent): boolean;
15
+ export declare const isMouseEvent: (event: MouseEvent | TouchEvent) => event is MouseEvent;
16
+ export declare const getEventPosition: (event: MouseEvent | TouchEvent, bounds?: DOMRect) => {
17
+ x: number;
18
+ y: number;
19
+ };
20
+ export declare const getHandleBounds: (type: "source" | "target", nodeElement: HTMLDivElement, nodeBounds: DOMRect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AqBb,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function getEdgeToolbarTransform(x: number, y: number, zoom: number, alignX?: 'left' | 'center' | 'right', alignY?: 'top' | 'center' | 'bottom'): string;
2
+ //# sourceMappingURL=edge-toolbar.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edge-toolbar.d.ts","sourceRoot":"","sources":["../../src/utils/edge-toolbar.ts"],"names":[],"mappings":"AAYA,wBAAgB,uBAAuB,CACrC,CAAC,EAAE,MAAM,EACT,CAAC,EAAE,MAAM,EACT,IAAI,EAAE,MAAM,EACZ,MAAM,GAAE,MAAM,GAAG,QAAQ,GAAG,OAAkB,EAC9C,MAAM,GAAE,KAAK,GAAG,QAAQ,GAAG,QAAmB,GAC7C,MAAM,CAIR"}
@@ -0,0 +1,77 @@
1
+ import { Position } from '../../types';
2
+ export type GetBezierPathParams = {
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
+ /**
22
+ * The curvature of the bezier edge.
23
+ * @default 0.25
24
+ */
25
+ curvature?: number;
26
+ };
27
+ export type GetControlWithCurvatureParams = {
28
+ pos: Position;
29
+ x1: number;
30
+ y1: number;
31
+ x2: number;
32
+ y2: number;
33
+ c: number;
34
+ };
35
+ export declare function getBezierEdgeCenter({ sourceX, sourceY, targetX, targetY, sourceControlX, sourceControlY, targetControlX, targetControlY, }: {
36
+ sourceX: number;
37
+ sourceY: number;
38
+ targetX: number;
39
+ targetY: number;
40
+ sourceControlX: number;
41
+ sourceControlY: number;
42
+ targetControlX: number;
43
+ targetControlY: number;
44
+ }): [number, number, number, number];
45
+ /**
46
+ * The `getBezierPath` util returns everything you need to render a bezier edge
47
+ *between two nodes.
48
+ * @public
49
+ * @returns A path string you can use in an SVG, the `labelX` and `labelY` position (center of path)
50
+ * and `offsetX`, `offsetY` between source handle and label.
51
+ * - `path`: the path to use in an SVG `<path>` element.
52
+ * - `labelX`: the `x` position you can use to render a label for this edge.
53
+ * - `labelY`: the `y` position you can use to render a label for this edge.
54
+ * - `offsetX`: the absolute difference between the source `x` position and the `x` position of the
55
+ * middle of this path.
56
+ * - `offsetY`: the absolute difference between the source `y` position and the `y` position of the
57
+ * middle of this path.
58
+ * @example
59
+ * ```js
60
+ * const source = { x: 0, y: 20 };
61
+ * const target = { x: 150, y: 100 };
62
+ *
63
+ * const [path, labelX, labelY, offsetX, offsetY] = getBezierPath({
64
+ * sourceX: source.x,
65
+ * sourceY: source.y,
66
+ * sourcePosition: Position.Right,
67
+ * targetX: target.x,
68
+ * targetY: target.y,
69
+ * targetPosition: Position.Left,
70
+ *});
71
+ *```
72
+ *
73
+ * @remarks This function returns a tuple (aka a fixed-size array) to make it easier to
74
+ *work with multiple edge paths at once.
75
+ */
76
+ export declare function getBezierPath({ sourceX, sourceY, sourcePosition, targetX, targetY, targetPosition, curvature, }: GetBezierPathParams): [path: string, labelX: number, labelY: number, offsetX: number, offsetY: number];
77
+ //# 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,aAAa,CAAC;AAEvC,MAAM,MAAM,mBAAmB,GAAG;IAChC,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,cAAc,CAAC,EAAE,QAAQ,CAAC;IAC1B;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,GAAG,EAAE,QAAQ,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;CACX,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAClC,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,GACf,EAAE;IACD,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;CACxB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAWnC;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,cAAgC,EAChC,OAAO,EACP,OAAO,EACP,cAA6B,EAC7B,SAAgB,GACjB,EAAE,mBAAmB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAmCxG"}
@@ -0,0 +1,32 @@
1
+ import { Position } from '../../types/utils';
2
+ export interface NodeRect {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ }
8
+ export interface Point {
9
+ x: number;
10
+ y: number;
11
+ }
12
+ /**
13
+ * Compute a ray-rect intersection point.
14
+ *
15
+ * Given a node rectangle and a reference point outside (or inside) the rectangle,
16
+ * casts a ray from the rectangle's center toward the reference point and returns
17
+ * the point at which that ray exits the rectangle's border.
18
+ *
19
+ * Used to position floating-edge endpoints dynamically on the border of a node.
20
+ */
21
+ export declare function getFloatingEndpoint(nodeRect: NodeRect, referencePoint: Point): Point;
22
+ /**
23
+ * Infer which side of the node a given intersection point lies on.
24
+ *
25
+ * Used to choose sourcePosition/targetPosition for path-shape helpers (bezier, step)
26
+ * when the endpoint is floating rather than anchored to a handle with a declared position.
27
+ *
28
+ * Tiebreak: at exact corners (normalized |dx| === |dy|), the Y axis wins via strict `>`,
29
+ * so the function returns Top or Bottom rather than Left or Right.
30
+ */
31
+ export declare function inferSide(intersection: Point, nodeRect: NodeRect): Position;
32
+ //# sourceMappingURL=floating.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floating.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/floating.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,KAAK;IACpB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,EAAE,cAAc,EAAE,KAAK,GAAG,KAAK,CAiBpF;AAED;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,YAAY,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAY3E"}
@@ -0,0 +1,91 @@
1
+ import { Connection, InternalNodeBase, Transform, EdgeBase, ZIndexMode } from '../..';
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
+ zIndexMode?: ZIndexMode;
15
+ };
16
+ /**
17
+ * Returns the z-index for an edge based on the node it connects and whether it is selected.
18
+ * By default, edges are rendered below nodes. This behaviour is different for edges that are
19
+ * connected to nodes with a parent, as they are rendered above the parent node.
20
+ */
21
+ export declare function getElevatedEdgeZIndex({ sourceNode, targetNode, selected, zIndex, elevateOnSelect, zIndexMode, }: GetEdgeZIndexParams): number;
22
+ type IsEdgeVisibleParams = {
23
+ sourceNode: InternalNodeBase;
24
+ targetNode: InternalNodeBase;
25
+ width: number;
26
+ height: number;
27
+ transform: Transform;
28
+ };
29
+ export declare function isEdgeVisible({ sourceNode, targetNode, width, height, transform }: IsEdgeVisibleParams): boolean;
30
+ /**
31
+ * Type for a custom edge ID generator function.
32
+ * @public
33
+ */
34
+ export type GetEdgeId = (params: Connection | EdgeBase) => string;
35
+ /**
36
+ * The default edge ID generator function. Generates an ID based on the source, target, and handles.
37
+ * @public
38
+ * @param params - The connection or edge to generate an ID for.
39
+ * @returns The generated edge ID.
40
+ */
41
+ export declare const getEdgeId: ({ source, sourceHandle, target, targetHandle }: Connection | EdgeBase) => string;
42
+ export type AddEdgeOptions = {
43
+ /**
44
+ * Custom function to generate edge IDs. If not provided, the default `getEdgeId` function is used.
45
+ */
46
+ getEdgeId?: GetEdgeId;
47
+ };
48
+ /**
49
+ * This util is a convenience function to add a new Edge to an array of edges. It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
50
+ * @public
51
+ * @param edgeParams - Either an `Edge` or a `Connection` you want to add.
52
+ * @param edges - The array of all current edges.
53
+ * @param options - Optional configuration object.
54
+ * @returns A new array of edges with the new edge added.
55
+ *
56
+ * @remarks If an edge with the same `target` and `source` already exists (and the same
57
+ *`targetHandle` and `sourceHandle` if those are set), then this util won't add
58
+ *a new edge even if the `id` property is different.
59
+ *
60
+ */
61
+ export declare const addEdge: <EdgeType extends EdgeBase>(edgeParams: EdgeType | Connection, edges: EdgeType[], options?: AddEdgeOptions) => EdgeType[];
62
+ export type ReconnectEdgeOptions = {
63
+ /**
64
+ * Should the id of the old edge be replaced with the new connection id.
65
+ * @default true
66
+ */
67
+ shouldReplaceId?: boolean;
68
+ /**
69
+ * Custom function to generate edge IDs. If not provided, the default `getEdgeId` function is used.
70
+ */
71
+ getEdgeId?: GetEdgeId;
72
+ };
73
+ /**
74
+ * A handy utility to update an existing [`Edge`](/api-reference/types/edge) with new properties.
75
+ *This searches your edge array for an edge with a matching `id` and updates its
76
+ *properties with the connection you provide.
77
+ * @public
78
+ * @param oldEdge - The edge you want to update.
79
+ * @param newConnection - The new connection you want to update the edge with.
80
+ * @param edges - The array of all current edges.
81
+ * @returns The updated edges array.
82
+ *
83
+ * @example
84
+ * ```js
85
+ *const onReconnect = useCallback(
86
+ * (oldEdge: Edge, newConnection: Connection) => setEdges((els) => reconnectEdge(oldEdge, newConnection, els)),[]);
87
+ *```
88
+ */
89
+ export declare const reconnectEdge: <EdgeType extends EdgeBase>(oldEdge: EdgeType, newConnection: Connection, edges: EdgeType[], options?: ReconnectEdgeOptions) => EdgeType[];
90
+ export {};
91
+ //# sourceMappingURL=general.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/general.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAA6B,QAAQ,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAIjH,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,O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;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,OAAO,GAAI,QAAQ,SAAS,QAAQ,EAC/C,YAAY,QAAQ,GAAG,UAAU,EACjC,OAAO,QAAQ,EAAE,EACjB,UAAS,cAAmB,KAC3B,QAAQ,EAgCV,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa,GAAI,QAAQ,SAAS,QAAQ,EACrD,SAAS,QAAQ,EACjB,eAAe,UAAU,EACzB,OAAO,QAAQ,EAAE,EACjB,UAAS,oBAAgD,KACxD,QAAQ,EA8BV,CAAC"}
@@ -0,0 +1,7 @@
1
+ export * from './bezier-edge';
2
+ export * from './straight-edge';
3
+ export * from './smoothstep-edge';
4
+ export * from './general';
5
+ export * from './positions';
6
+ export * from './floating';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -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;AAC5B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { EdgePosition } from '../../types/edges';
2
+ import { ConnectionMode, OnError } from '../../types/general';
3
+ import { InternalNodeBase } from '../../types/nodes';
4
+ import { Position, XYPosition } from '../../types/utils';
5
+ import { Handle } from '../../types';
6
+ export type GetEdgePositionParams = {
7
+ id: string;
8
+ sourceNode: InternalNodeBase;
9
+ sourceHandle: string | null;
10
+ targetNode: InternalNodeBase;
11
+ targetHandle: string | null;
12
+ connectionMode: ConnectionMode;
13
+ onError?: OnError;
14
+ };
15
+ export declare function getEdgePosition(params: GetEdgePositionParams): EdgePosition | null;
16
+ export declare function getHandlePosition(node: InternalNodeBase, handle: Handle | null, fallbackPosition?: Position, center?: boolean): XYPosition;
17
+ //# sourceMappingURL=positions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"positions.d.ts","sourceRoot":"","sources":["../../../src/utils/edges/positions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAc,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,cAAc,EAAE,cAAc,CAAC;IAC/B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAUF,wBAAgB,eAAe,CAAC,MAAM,EAAE,qBAAqB,GAAG,YAAY,GAAG,IAAI,CA6ClF;AA2BD,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,gBAAgB,EACtB,MAAM,EAAE,MAAM,GAAG,IAAI,EACrB,gBAAgB,GAAE,QAAwB,EAC1C,MAAM,UAAQ,GACb,UAAU,CAqBZ"}