@realflow/compat 0.1.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/dist/Handle.d.ts +21 -0
- package/dist/Handle.d.ts.map +1 -0
- package/dist/Handle.js +9 -0
- package/dist/Handle.js.map +1 -0
- package/dist/ReactFlow.d.ts +15 -0
- package/dist/ReactFlow.d.ts.map +1 -0
- package/dist/ReactFlow.js +231 -0
- package/dist/ReactFlow.js.map +1 -0
- package/dist/changes.d.ts +10 -0
- package/dist/changes.d.ts.map +1 -0
- package/dist/changes.js +134 -0
- package/dist/changes.js.map +1 -0
- package/dist/enums.d.ts +32 -0
- package/dist/enums.d.ts.map +1 -0
- package/dist/enums.js +29 -0
- package/dist/enums.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/style.css +642 -0
- package/dist/types.d.ts +233 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/useNodesState.d.ts +6 -0
- package/dist/useNodesState.d.ts.map +1 -0
- package/dist/useNodesState.js +15 -0
- package/dist/useNodesState.js.map +1 -0
- package/package.json +48 -0
package/dist/Handle.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { Position } from './enums.js';
|
|
3
|
+
export interface HandleProps {
|
|
4
|
+
/** React Flow uses `type`; ReFlow uses `kind`. */
|
|
5
|
+
type: 'source' | 'target';
|
|
6
|
+
/** React Flow uses `position`; ReFlow uses `side`. */
|
|
7
|
+
position: Position;
|
|
8
|
+
id?: string;
|
|
9
|
+
isConnectable?: boolean;
|
|
10
|
+
isConnectableStart?: boolean;
|
|
11
|
+
isConnectableEnd?: boolean;
|
|
12
|
+
className?: string;
|
|
13
|
+
style?: CSSProperties;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
onConnect?: unknown;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* React Flow-compatible Handle. Maps `type`→`kind` and `position`→`side`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function Handle({ type, position, id, isConnectable, className, style, children, }: HandleProps): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=Handle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Handle.d.ts","sourceRoot":"","sources":["../src/Handle.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC1B,sDAAsD;IACtD,QAAQ,EAAE,QAAQ,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,aAAa,EACb,SAAS,EACT,KAAK,EACL,QAAQ,GACT,EAAE,WAAW,+BAab"}
|
package/dist/Handle.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Handle as ReflowHandle } from '@realflow/react';
|
|
3
|
+
/**
|
|
4
|
+
* React Flow-compatible Handle. Maps `type`→`kind` and `position`→`side`.
|
|
5
|
+
*/
|
|
6
|
+
export function Handle({ type, position, id, isConnectable, className, style, children, }) {
|
|
7
|
+
return (_jsx(ReflowHandle, { kind: type, side: position, id: id, connectable: isConnectable, className: className, style: style, children: children }));
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=Handle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Handle.js","sourceRoot":"","sources":["../src/Handle.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,IAAI,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAmBzD;;GAEG;AACH,MAAM,UAAU,MAAM,CAAC,EACrB,IAAI,EACJ,QAAQ,EACR,EAAE,EACF,aAAa,EACb,SAAS,EACT,KAAK,EACL,QAAQ,GACI;IACZ,OAAO,CACL,KAAC,YAAY,IACX,IAAI,EAAE,IAAI,EACV,IAAI,EAAE,QAAQ,EACd,EAAE,EAAE,EAAE,EACN,WAAW,EAAE,aAAa,EAC1B,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,KAAK,YAEX,QAAQ,GACI,CAChB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useNodeId } from '@realflow/react';
|
|
2
|
+
import type { ReactFlowInstance, ReactFlowProps } from './types.js';
|
|
3
|
+
export declare function ReactFlowProvider({ children }: {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
6
|
+
/**
|
|
7
|
+
* React Flow-compatible `<ReactFlow>`. Supports controlled
|
|
8
|
+
* (nodes/edges + onNodesChange/onEdgesChange) and uncontrolled
|
|
9
|
+
* (defaultNodes/defaultEdges) usage, custom nodeTypes, onConnect, onInit.
|
|
10
|
+
*/
|
|
11
|
+
export declare function ReactFlow(props: ReactFlowProps): import("react").JSX.Element;
|
|
12
|
+
/** React Flow's useReactFlow hook. */
|
|
13
|
+
export declare function useReactFlow(): ReactFlowInstance;
|
|
14
|
+
export { useNodeId };
|
|
15
|
+
//# sourceMappingURL=ReactFlow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReactFlow.d.ts","sourceRoot":"","sources":["../src/ReactFlow.tsx"],"names":[],"mappings":"AACA,OAAO,EAKL,SAAS,EAMV,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAIV,iBAAiB,EACjB,cAAc,EAGf,MAAM,SAAS,CAAC;AA+GjB,wBAAgB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,+BAE5E;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAmG9C;AA8GD,sCAAsC;AACtC,wBAAgB,YAAY,IAAI,iBAAiB,CAMhD;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useContext, useEffect, useMemo, useRef } from 'react';
|
|
3
|
+
import { ReFlow, ReFlowProvider, FlowContext, useFlowStore, useNodeId, createApi, screenToFlow, flowToScreen, } from '@realflow/react';
|
|
4
|
+
const toReflowNode = (n) => ({
|
|
5
|
+
id: n.id,
|
|
6
|
+
position: n.position,
|
|
7
|
+
data: n.data ?? {},
|
|
8
|
+
type: n.type,
|
|
9
|
+
hidden: n.hidden,
|
|
10
|
+
selected: n.selected,
|
|
11
|
+
draggable: n.draggable,
|
|
12
|
+
selectable: n.selectable,
|
|
13
|
+
connectable: n.connectable,
|
|
14
|
+
deletable: n.deletable,
|
|
15
|
+
width: n.width,
|
|
16
|
+
height: n.height,
|
|
17
|
+
parentId: n.parentId,
|
|
18
|
+
extent: n.extent,
|
|
19
|
+
zIndex: n.zIndex,
|
|
20
|
+
style: n.style,
|
|
21
|
+
className: n.className,
|
|
22
|
+
});
|
|
23
|
+
const toReflowEdge = (e) => ({
|
|
24
|
+
id: e.id,
|
|
25
|
+
source: e.source,
|
|
26
|
+
target: e.target,
|
|
27
|
+
sourceHandle: e.sourceHandle ?? undefined,
|
|
28
|
+
targetHandle: e.targetHandle ?? undefined,
|
|
29
|
+
type: e.type,
|
|
30
|
+
label: e.label,
|
|
31
|
+
animated: e.animated,
|
|
32
|
+
selected: e.selected,
|
|
33
|
+
hidden: e.hidden,
|
|
34
|
+
deletable: e.deletable,
|
|
35
|
+
data: e.data,
|
|
36
|
+
markerStart: e.markerStart,
|
|
37
|
+
markerEnd: e.markerEnd,
|
|
38
|
+
style: e.style,
|
|
39
|
+
className: e.className,
|
|
40
|
+
});
|
|
41
|
+
const fromReflowNode = (n) => ({ ...n, data: n.data });
|
|
42
|
+
const fromReflowEdge = (e) => ({ ...e });
|
|
43
|
+
/** Wrap a React Flow node component so it receives RF-style NodeProps. */
|
|
44
|
+
function wrapNodeType(RFComp) {
|
|
45
|
+
return function CompatNode(reflowProps) {
|
|
46
|
+
const store = useFlowStore();
|
|
47
|
+
const abs = store.absolutePosition(reflowProps.id);
|
|
48
|
+
const size = store.nodeSize(reflowProps.id);
|
|
49
|
+
return (_jsx(RFComp, { id: reflowProps.id, data: reflowProps.data, type: reflowProps.node.type, selected: reflowProps.selected, dragging: reflowProps.dragging, isConnectable: reflowProps.node.connectable !== false, positionAbsoluteX: abs.x, positionAbsoluteY: abs.y, width: size.width, height: size.height }));
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
/** Diff two node arrays into React Flow change objects. */
|
|
53
|
+
function diffNodes(prev, next) {
|
|
54
|
+
const changes = [];
|
|
55
|
+
const nextIds = new Set();
|
|
56
|
+
for (const n of next) {
|
|
57
|
+
nextIds.add(n.id);
|
|
58
|
+
const p = prev.get(n.id);
|
|
59
|
+
if (!p) {
|
|
60
|
+
changes.push({ type: 'add', item: fromReflowNode(n) });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (p.position.x !== n.position.x || p.position.y !== n.position.y) {
|
|
64
|
+
changes.push({ type: 'position', id: n.id, position: { ...n.position }, dragging: false });
|
|
65
|
+
}
|
|
66
|
+
if (!!p.selected !== !!n.selected) {
|
|
67
|
+
changes.push({ type: 'select', id: n.id, selected: !!n.selected });
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
for (const id of prev.keys())
|
|
71
|
+
if (!nextIds.has(id))
|
|
72
|
+
changes.push({ type: 'remove', id });
|
|
73
|
+
return changes;
|
|
74
|
+
}
|
|
75
|
+
function diffEdges(prev, next) {
|
|
76
|
+
const changes = [];
|
|
77
|
+
const nextIds = new Set();
|
|
78
|
+
for (const e of next) {
|
|
79
|
+
nextIds.add(e.id);
|
|
80
|
+
const p = prev.get(e.id);
|
|
81
|
+
if (!p) {
|
|
82
|
+
changes.push({ type: 'add', item: fromReflowEdge(e) });
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (!!p.selected !== !!e.selected)
|
|
86
|
+
changes.push({ type: 'select', id: e.id, selected: !!e.selected });
|
|
87
|
+
}
|
|
88
|
+
for (const id of prev.keys())
|
|
89
|
+
if (!nextIds.has(id))
|
|
90
|
+
changes.push({ type: 'remove', id });
|
|
91
|
+
return changes;
|
|
92
|
+
}
|
|
93
|
+
export function ReactFlowProvider({ children }) {
|
|
94
|
+
return _jsx(ReFlowProvider, { children: children });
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* React Flow-compatible `<ReactFlow>`. Supports controlled
|
|
98
|
+
* (nodes/edges + onNodesChange/onEdgesChange) and uncontrolled
|
|
99
|
+
* (defaultNodes/defaultEdges) usage, custom nodeTypes, onConnect, onInit.
|
|
100
|
+
*/
|
|
101
|
+
export function ReactFlow(props) {
|
|
102
|
+
const { nodes, edges, defaultNodes, defaultEdges, onNodesChange, onEdgesChange, onConnect, onInit, onNodeClick, onEdgeClick, onPaneClick, onSelectionChange, nodeTypes, fitView, fitViewOptions, minZoom, maxZoom, defaultViewport, snapToGrid, snapGrid, panOnDrag, panOnScroll, zoomOnScroll, zoomOnDoubleClick, selectionOnDrag, connectionMode, colorMode, defaultEdgeOptions, className, style, children, } = props;
|
|
103
|
+
const reflowNodes = useMemo(() => (nodes ?? defaultNodes)?.map(toReflowNode), [nodes, defaultNodes]);
|
|
104
|
+
const reflowEdges = useMemo(() => (edges ?? defaultEdges)?.map(toReflowEdge), [edges, defaultEdges]);
|
|
105
|
+
const controlled = nodes != null;
|
|
106
|
+
const wrappedNodeTypes = useMemo(() => {
|
|
107
|
+
if (!nodeTypes)
|
|
108
|
+
return undefined;
|
|
109
|
+
const out = {};
|
|
110
|
+
for (const [k, C] of Object.entries(nodeTypes))
|
|
111
|
+
out[k] = wrapNodeType(C);
|
|
112
|
+
return out;
|
|
113
|
+
}, [nodeTypes]);
|
|
114
|
+
const cbs = useRef({ onNodesChange, onEdgesChange, onConnect, onSelectionChange });
|
|
115
|
+
cbs.current = { onNodesChange, onEdgesChange, onConnect, onSelectionChange };
|
|
116
|
+
return (_jsxs(ReFlow, { defaultNodes: controlled ? undefined : reflowNodes, defaultEdges: controlled ? undefined : reflowEdges, nodes: controlled ? reflowNodes : undefined, edges: controlled ? reflowEdges : undefined, nodeTypes: wrappedNodeTypes, fitViewOnInit: fitView, fitViewOptions: fitViewOptions, minZoom: minZoom, maxZoom: maxZoom, defaultViewport: defaultViewport, snapGrid: snapToGrid ? snapGrid?.[0] ?? 15 : 0, panOnDrag: Array.isArray(panOnDrag) ? true : panOnDrag, panOnScroll: panOnScroll, zoomOnScroll: zoomOnScroll, zoomOnDoubleClick: zoomOnDoubleClick, selectionOnDrag: selectionOnDrag, allowDuplicateEdges: connectionMode === 'loose', colorMode: colorMode === 'system' ? 'auto' : colorMode, defaultEdgeOptions: defaultEdgeOptions, className: className, style: style, onConnect: (edge) => cbs.current.onConnect?.({
|
|
117
|
+
source: edge.source,
|
|
118
|
+
target: edge.target,
|
|
119
|
+
sourceHandle: edge.sourceHandle ?? null,
|
|
120
|
+
targetHandle: edge.targetHandle ?? null,
|
|
121
|
+
}), onNodeClick: onNodeClick ? (e, n) => onNodeClick(e, fromReflowNode(n)) : undefined, onEdgeClick: onEdgeClick ? (e, edge) => onEdgeClick(e, fromReflowEdge(edge)) : undefined, onPaneClick: onPaneClick ? (e) => onPaneClick(e) : undefined, onInit: (api) => {
|
|
122
|
+
onInit?.(makeInstance(api));
|
|
123
|
+
}, children: [_jsx(ChangeBridge, { onNodesChange: (c) => cbs.current.onNodesChange?.(c), onEdgesChange: (c) => cbs.current.onEdgesChange?.(c), onSelectionChange: (s) => cbs.current.onSelectionChange?.(s) }), children] }));
|
|
124
|
+
}
|
|
125
|
+
/** Subscribes to the store and emits React Flow change objects on commits. */
|
|
126
|
+
function ChangeBridge({ onNodesChange, onEdgesChange, onSelectionChange, }) {
|
|
127
|
+
const store = useFlowStore();
|
|
128
|
+
const prevNodes = useRef(new Map());
|
|
129
|
+
const prevEdges = useRef(new Map());
|
|
130
|
+
const cb = useRef({ onNodesChange, onEdgesChange, onSelectionChange });
|
|
131
|
+
cb.current = { onNodesChange, onEdgesChange, onSelectionChange };
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
prevNodes.current = new Map(store.getNodes().map((n) => [n.id, n]));
|
|
134
|
+
prevEdges.current = new Map(store.getEdges().map((e) => [e.id, e]));
|
|
135
|
+
const unsub = store.subscribe('commit', () => {
|
|
136
|
+
const nodes = store.getNodes();
|
|
137
|
+
const nChanges = diffNodes(prevNodes.current, nodes);
|
|
138
|
+
if (nChanges.length)
|
|
139
|
+
cb.current.onNodesChange(nChanges);
|
|
140
|
+
prevNodes.current = new Map(nodes.map((n) => [n.id, n]));
|
|
141
|
+
const edges = store.getEdges();
|
|
142
|
+
const eChanges = diffEdges(prevEdges.current, edges);
|
|
143
|
+
if (eChanges.length)
|
|
144
|
+
cb.current.onEdgesChange(eChanges);
|
|
145
|
+
prevEdges.current = new Map(edges.map((e) => [e.id, e]));
|
|
146
|
+
});
|
|
147
|
+
const unsubSel = store.subscribe('selection', () => {
|
|
148
|
+
cb.current.onSelectionChange({
|
|
149
|
+
nodes: [...store.selectedNodes].map((id) => fromReflowNode(store.getNode(id))).filter(Boolean),
|
|
150
|
+
edges: [...store.selectedEdges].map((id) => fromReflowEdge(store.getEdge(id))).filter(Boolean),
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
return () => {
|
|
154
|
+
unsub();
|
|
155
|
+
unsubSel();
|
|
156
|
+
};
|
|
157
|
+
}, [store]);
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
function makeInstance(api) {
|
|
161
|
+
const store = api.store;
|
|
162
|
+
return {
|
|
163
|
+
getNode: (id) => {
|
|
164
|
+
const n = store.getNode(id);
|
|
165
|
+
return n ? fromReflowNode(n) : undefined;
|
|
166
|
+
},
|
|
167
|
+
getNodes: () => store.getNodes().map(fromReflowNode),
|
|
168
|
+
getEdge: (id) => {
|
|
169
|
+
const e = store.getEdge(id);
|
|
170
|
+
return e ? fromReflowEdge(e) : undefined;
|
|
171
|
+
},
|
|
172
|
+
getEdges: () => store.getEdges().map(fromReflowEdge),
|
|
173
|
+
setNodes: (payload) => {
|
|
174
|
+
const cur = store.getNodes().map(fromReflowNode);
|
|
175
|
+
const next = typeof payload === 'function' ? payload(cur) : payload;
|
|
176
|
+
store.setGraph(next.map(toReflowNode), store.getEdges());
|
|
177
|
+
},
|
|
178
|
+
setEdges: (payload) => {
|
|
179
|
+
const cur = store.getEdges().map(fromReflowEdge);
|
|
180
|
+
const next = typeof payload === 'function' ? payload(cur) : payload;
|
|
181
|
+
store.setGraph(store.getNodes(), next.map(toReflowEdge));
|
|
182
|
+
},
|
|
183
|
+
addNodes: (payload) => {
|
|
184
|
+
const arr = Array.isArray(payload) ? payload : [payload];
|
|
185
|
+
store.addNodes(arr.map(toReflowNode));
|
|
186
|
+
},
|
|
187
|
+
addEdges: (payload) => {
|
|
188
|
+
const arr = Array.isArray(payload) ? payload : [payload];
|
|
189
|
+
store.addEdges(arr.map(toReflowEdge));
|
|
190
|
+
},
|
|
191
|
+
deleteElements: ({ nodes: dn, edges: de }) => {
|
|
192
|
+
store.transact('delete', () => {
|
|
193
|
+
if (de)
|
|
194
|
+
store.removeEdges(de.map((e) => e.id));
|
|
195
|
+
if (dn)
|
|
196
|
+
store.removeNodes(dn.map((n) => n.id));
|
|
197
|
+
});
|
|
198
|
+
},
|
|
199
|
+
fitView: (opts) => api.fitView(opts),
|
|
200
|
+
zoomIn: () => api.zoomIn(),
|
|
201
|
+
zoomOut: () => api.zoomOut(),
|
|
202
|
+
zoomTo: (zoom, opts) => api.zoomTo(zoom, opts?.duration),
|
|
203
|
+
getZoom: () => store.viewport.zoom,
|
|
204
|
+
setViewport: (vp, opts) => store.animateViewport(vp, opts?.duration ?? 0),
|
|
205
|
+
getViewport: () => ({ ...store.viewport }),
|
|
206
|
+
setCenter: (x, y, opts) => {
|
|
207
|
+
const zoom = opts?.zoom ?? store.viewport.zoom;
|
|
208
|
+
store.animateViewport({ x: store.screen.width / 2 - x * zoom, y: store.screen.height / 2 - y * zoom, zoom }, opts?.duration ?? 0);
|
|
209
|
+
},
|
|
210
|
+
screenToFlowPosition: (p) => screenToFlow(p, store.viewport),
|
|
211
|
+
flowToScreenPosition: (p) => flowToScreen(p, store.viewport),
|
|
212
|
+
toObject: () => {
|
|
213
|
+
const snap = store.toSnapshot();
|
|
214
|
+
return {
|
|
215
|
+
nodes: snap.nodes.map(fromReflowNode),
|
|
216
|
+
edges: snap.edges.map(fromReflowEdge),
|
|
217
|
+
viewport: snap.viewport,
|
|
218
|
+
};
|
|
219
|
+
},
|
|
220
|
+
};
|
|
221
|
+
}
|
|
222
|
+
/** React Flow's useReactFlow hook. */
|
|
223
|
+
export function useReactFlow() {
|
|
224
|
+
const store = useContext(FlowContext);
|
|
225
|
+
if (!store) {
|
|
226
|
+
throw new Error('[reflow/compat] useReactFlow must be used inside <ReactFlow> or <ReactFlowProvider>');
|
|
227
|
+
}
|
|
228
|
+
return useMemo(() => makeInstance(createApi(store)), [store]);
|
|
229
|
+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EAAE,KAAK,CAAC,QAAQ,CAAC;QAC5D,oBAAoB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,QAAQ,CAAC;QAC5D,QAAQ,EAAE,GAAG,EAAE;YACb,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,EAAE,CAAC;YAChC,OAAO;gBACL,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC;gBACrC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC;gBACrC,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,sCAAsC;AACtC,MAAM,UAAU,YAAY;IAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACtC,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,qFAAqF,CAAC,CAAC;IACzG,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Connection, EdgeChange, NodeChange, RFEdge, RFNode } from './types.js';
|
|
2
|
+
/** React Flow's applyNodeChanges: fold change objects into a nodes array. */
|
|
3
|
+
export declare function applyNodeChanges<T = any>(changes: NodeChange<T>[], nodes: RFNode<T>[]): RFNode<T>[];
|
|
4
|
+
/** React Flow's applyEdgeChanges. */
|
|
5
|
+
export declare function applyEdgeChanges<T = any>(changes: EdgeChange<T>[], edges: RFEdge<T>[]): RFEdge<T>[];
|
|
6
|
+
/** React Flow's addEdge: append a connection as an edge (dedup + id). */
|
|
7
|
+
export declare function addEdge<T = any>(connection: Connection | RFEdge<T>, edges: RFEdge<T>[]): RFEdge<T>[];
|
|
8
|
+
/** React Flow's reconnectEdge: move an edge's endpoint to a new connection. */
|
|
9
|
+
export declare function reconnectEdge<T = any>(oldEdge: RFEdge<T>, newConnection: Connection, edges: RFEdge<T>[]): RFEdge<T>[];
|
|
10
|
+
//# sourceMappingURL=changes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../src/changes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAElF,6EAA6E;AAC7E,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,GAAG,EACtC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,EACxB,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,GACjB,MAAM,CAAC,CAAC,CAAC,EAAE,CAwDb;AAED,qCAAqC;AACrC,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,GAAG,EACtC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,EACxB,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,GACjB,MAAM,CAAC,CAAC,CAAC,EAAE,CAmCb;AAED,yEAAyE;AACzE,wBAAgB,OAAO,CAAC,CAAC,GAAG,GAAG,EAC7B,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,EAClC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,GACjB,MAAM,CAAC,CAAC,CAAC,EAAE,CA2Bb;AAED,+EAA+E;AAC/E,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EACnC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,EAClB,aAAa,EAAE,UAAU,EACzB,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,GACjB,MAAM,CAAC,CAAC,CAAC,EAAE,CASb"}
|
package/dist/changes.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/** React Flow's applyNodeChanges: fold change objects into a nodes array. */
|
|
2
|
+
export function applyNodeChanges(changes, nodes) {
|
|
3
|
+
let result = nodes;
|
|
4
|
+
const mutate = () => (result === nodes ? (result = [...nodes]) : result);
|
|
5
|
+
const indexById = new Map(nodes.map((n, i) => [n.id, i]));
|
|
6
|
+
const removals = new Set();
|
|
7
|
+
for (const change of changes) {
|
|
8
|
+
switch (change.type) {
|
|
9
|
+
case 'add': {
|
|
10
|
+
const arr = mutate();
|
|
11
|
+
if (change.index != null)
|
|
12
|
+
arr.splice(change.index, 0, change.item);
|
|
13
|
+
else
|
|
14
|
+
arr.push(change.item);
|
|
15
|
+
break;
|
|
16
|
+
}
|
|
17
|
+
case 'remove':
|
|
18
|
+
removals.add(change.id);
|
|
19
|
+
break;
|
|
20
|
+
case 'replace': {
|
|
21
|
+
const i = indexById.get(change.id);
|
|
22
|
+
if (i != null)
|
|
23
|
+
mutate()[i] = change.item;
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
case 'position': {
|
|
27
|
+
const i = indexById.get(change.id);
|
|
28
|
+
if (i != null) {
|
|
29
|
+
const arr = mutate();
|
|
30
|
+
arr[i] = {
|
|
31
|
+
...arr[i],
|
|
32
|
+
...(change.position ? { position: change.position } : {}),
|
|
33
|
+
dragging: change.dragging,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case 'dimensions': {
|
|
39
|
+
const i = indexById.get(change.id);
|
|
40
|
+
if (i != null && change.dimensions) {
|
|
41
|
+
const arr = mutate();
|
|
42
|
+
arr[i] = { ...arr[i], width: change.dimensions.width, height: change.dimensions.height };
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case 'select': {
|
|
47
|
+
const i = indexById.get(change.id);
|
|
48
|
+
if (i != null) {
|
|
49
|
+
const arr = mutate();
|
|
50
|
+
arr[i] = { ...arr[i], selected: change.selected };
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (removals.size > 0)
|
|
57
|
+
result = (result === nodes ? nodes : result).filter((n) => !removals.has(n.id));
|
|
58
|
+
return result;
|
|
59
|
+
}
|
|
60
|
+
/** React Flow's applyEdgeChanges. */
|
|
61
|
+
export function applyEdgeChanges(changes, edges) {
|
|
62
|
+
let result = edges;
|
|
63
|
+
const mutate = () => (result === edges ? (result = [...edges]) : result);
|
|
64
|
+
const indexById = new Map(edges.map((e, i) => [e.id, i]));
|
|
65
|
+
const removals = new Set();
|
|
66
|
+
for (const change of changes) {
|
|
67
|
+
switch (change.type) {
|
|
68
|
+
case 'add': {
|
|
69
|
+
const arr = mutate();
|
|
70
|
+
if (change.index != null)
|
|
71
|
+
arr.splice(change.index, 0, change.item);
|
|
72
|
+
else
|
|
73
|
+
arr.push(change.item);
|
|
74
|
+
break;
|
|
75
|
+
}
|
|
76
|
+
case 'remove':
|
|
77
|
+
removals.add(change.id);
|
|
78
|
+
break;
|
|
79
|
+
case 'replace': {
|
|
80
|
+
const i = indexById.get(change.id);
|
|
81
|
+
if (i != null)
|
|
82
|
+
mutate()[i] = change.item;
|
|
83
|
+
break;
|
|
84
|
+
}
|
|
85
|
+
case 'select': {
|
|
86
|
+
const i = indexById.get(change.id);
|
|
87
|
+
if (i != null) {
|
|
88
|
+
const arr = mutate();
|
|
89
|
+
arr[i] = { ...arr[i], selected: change.selected };
|
|
90
|
+
}
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (removals.size > 0)
|
|
96
|
+
result = (result === edges ? edges : result).filter((e) => !removals.has(e.id));
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
/** React Flow's addEdge: append a connection as an edge (dedup + id). */
|
|
100
|
+
export function addEdge(connection, edges) {
|
|
101
|
+
const { source, target } = connection;
|
|
102
|
+
if (source == null || target == null)
|
|
103
|
+
return edges;
|
|
104
|
+
const sourceHandle = connection.sourceHandle ?? null;
|
|
105
|
+
const targetHandle = connection.targetHandle ?? null;
|
|
106
|
+
const exists = edges.some((e) => e.source === source &&
|
|
107
|
+
e.target === target &&
|
|
108
|
+
(e.sourceHandle ?? null) === sourceHandle &&
|
|
109
|
+
(e.targetHandle ?? null) === targetHandle);
|
|
110
|
+
if (exists)
|
|
111
|
+
return edges;
|
|
112
|
+
const id = connection.id ??
|
|
113
|
+
`reactflow__edge-${source}${sourceHandle ?? ''}-${target}${targetHandle ?? ''}`;
|
|
114
|
+
const edge = {
|
|
115
|
+
...connection,
|
|
116
|
+
id,
|
|
117
|
+
source,
|
|
118
|
+
target,
|
|
119
|
+
sourceHandle,
|
|
120
|
+
targetHandle,
|
|
121
|
+
};
|
|
122
|
+
return [...edges, edge];
|
|
123
|
+
}
|
|
124
|
+
/** React Flow's reconnectEdge: move an edge's endpoint to a new connection. */
|
|
125
|
+
export function reconnectEdge(oldEdge, newConnection, edges) {
|
|
126
|
+
const { source, target, sourceHandle, targetHandle } = newConnection;
|
|
127
|
+
if (source == null || target == null)
|
|
128
|
+
return edges;
|
|
129
|
+
const id = `reactflow__edge-${source}${sourceHandle ?? ''}-${target}${targetHandle ?? ''}`;
|
|
130
|
+
return edges.map((e) => e.id === oldEdge.id
|
|
131
|
+
? { ...e, source, target, sourceHandle, targetHandle, id }
|
|
132
|
+
: e);
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changes.js","sourceRoot":"","sources":["../src/changes.ts"],"names":[],"mappings":"AAEA,6EAA6E;AAC7E,MAAM,UAAU,gBAAgB,CAC9B,OAAwB,EACxB,KAAkB;IAElB,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC,MAAM,KAAK,KAAK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 +1,32 @@
|
|
|
1
|
+
export declare const Position: {
|
|
2
|
+
readonly Left: "left";
|
|
3
|
+
readonly Top: "top";
|
|
4
|
+
readonly Right: "right";
|
|
5
|
+
readonly Bottom: "bottom";
|
|
6
|
+
};
|
|
7
|
+
export type Position = (typeof Position)[keyof typeof Position];
|
|
8
|
+
export declare const MarkerType: {
|
|
9
|
+
readonly Arrow: "arrow";
|
|
10
|
+
readonly ArrowClosed: "arrowclosed";
|
|
11
|
+
};
|
|
12
|
+
export type MarkerType = (typeof MarkerType)[keyof typeof MarkerType];
|
|
13
|
+
export declare const ConnectionMode: {
|
|
14
|
+
readonly Strict: "strict";
|
|
15
|
+
readonly Loose: "loose";
|
|
16
|
+
};
|
|
17
|
+
export type ConnectionMode = (typeof ConnectionMode)[keyof typeof ConnectionMode];
|
|
18
|
+
export declare const ConnectionLineType: {
|
|
19
|
+
readonly Bezier: "bezier";
|
|
20
|
+
readonly Straight: "straight";
|
|
21
|
+
readonly Step: "step";
|
|
22
|
+
readonly SmoothStep: "smoothstep";
|
|
23
|
+
readonly SimpleBezier: "bezier";
|
|
24
|
+
};
|
|
25
|
+
export type ConnectionLineType = (typeof ConnectionLineType)[keyof typeof ConnectionLineType];
|
|
26
|
+
export declare const PanOnScrollMode: {
|
|
27
|
+
readonly Free: "free";
|
|
28
|
+
readonly Vertical: "vertical";
|
|
29
|
+
readonly Horizontal: "horizontal";
|
|
30
|
+
};
|
|
31
|
+
export type PanOnScrollMode = (typeof PanOnScrollMode)[keyof typeof PanOnScrollMode];
|
|
32
|
+
//# sourceMappingURL=enums.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AACX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAEhE,eAAO,MAAM,UAAU;;;CAGb,CAAC;AACX,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,UAAU,CAAC,CAAC,MAAM,OAAO,UAAU,CAAC,CAAC;AAEtE,eAAO,MAAM,cAAc;;;CAGjB,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAElF,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC;AACX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC;AAE9F,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AACX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,OAAO,eAAe,CAAC,CAAC"}
|
package/dist/enums.js
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// React Flow ships these as enums; apps compare against Position.Left etc.
|
|
2
|
+
// ReFlow uses the string values directly, so the enum values ARE the strings.
|
|
3
|
+
export const Position = {
|
|
4
|
+
Left: 'left',
|
|
5
|
+
Top: 'top',
|
|
6
|
+
Right: 'right',
|
|
7
|
+
Bottom: 'bottom',
|
|
8
|
+
};
|
|
9
|
+
export const MarkerType = {
|
|
10
|
+
Arrow: 'arrow',
|
|
11
|
+
ArrowClosed: 'arrowclosed',
|
|
12
|
+
};
|
|
13
|
+
export const ConnectionMode = {
|
|
14
|
+
Strict: 'strict',
|
|
15
|
+
Loose: 'loose',
|
|
16
|
+
};
|
|
17
|
+
export const ConnectionLineType = {
|
|
18
|
+
Bezier: 'bezier',
|
|
19
|
+
Straight: 'straight',
|
|
20
|
+
Step: 'step',
|
|
21
|
+
SmoothStep: 'smoothstep',
|
|
22
|
+
SimpleBezier: 'bezier',
|
|
23
|
+
};
|
|
24
|
+
export const PanOnScrollMode = {
|
|
25
|
+
Free: 'free',
|
|
26
|
+
Vertical: 'vertical',
|
|
27
|
+
Horizontal: 'horizontal',
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=enums.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"enums.js","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,8EAA8E;AAE9E,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;CACR,CAAC;AAGX,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;CAClB,CAAC;AAGX,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;CACN,CAAC;AAGX,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;IACpB,IAAI,EAAE,MAAM;IACZ,UAAU,EAAE,YAAY;IACxB,YAAY,EAAE,QAAQ;CACd,CAAC;AAGX,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;CAChB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @realflow/compat — React Flow (xyflow) API compatibility layer.
|
|
3
|
+
*
|
|
4
|
+
* Migrate an existing React Flow app by changing the import:
|
|
5
|
+
*
|
|
6
|
+
* - import { ReactFlow, Handle, Position, useReactFlow } from '@xyflow/react';
|
|
7
|
+
* + import { ReactFlow, Handle, Position, useReactFlow } from '@realflow/compat';
|
|
8
|
+
* - import '@xyflow/react/dist/style.css';
|
|
9
|
+
* + import '@realflow/compat/style.css';
|
|
10
|
+
*
|
|
11
|
+
* The adapter maps React Flow's controlled `onNodesChange(changes)` model,
|
|
12
|
+
* `<Handle type position>`, `useReactFlow()`, `applyNodeChanges`,
|
|
13
|
+
* `useNodesState`, `addEdge`, etc. onto ReFlow's engine. Coverage targets the
|
|
14
|
+
* common migration surface — see docs/migration.md for the exact map and the
|
|
15
|
+
* few APIs that need manual attention.
|
|
16
|
+
*/
|
|
17
|
+
export { Position, MarkerType, ConnectionMode, ConnectionLineType, PanOnScrollMode, } from './enums.js';
|
|
18
|
+
export type { RFNode as Node, RFEdge as Edge, Connection, NodeChange, EdgeChange, NodeProps, EdgeProps, OnConnect, OnNodesChange, OnEdgesChange, ReactFlowInstance, XYPosition, Viewport, ReactFlowProps, } from './types.js';
|
|
19
|
+
export { applyNodeChanges, applyEdgeChanges, addEdge, reconnectEdge, } from './changes.js';
|
|
20
|
+
export { useNodesState, useEdgesState } from './useNodesState.js';
|
|
21
|
+
export { Handle } from './Handle.js';
|
|
22
|
+
export { ReactFlow, ReactFlowProvider, useReactFlow } from './ReactFlow.js';
|
|
23
|
+
export { Background, MiniMap, Controls, Panel } from '@realflow/react';
|
|
24
|
+
export { NodeResizer, NodeToolbar } from '@realflow/react';
|
|
25
|
+
export { useOnSelectionChange } from '@realflow/react';
|
|
26
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,GAChB,MAAM,SAAS,CAAC;AACjB,YAAY,EACV,MAAM,IAAI,IAAI,EACd,MAAM,IAAI,IAAI,EACd,UAAU,EACV,UAAU,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EACP,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGzE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @realflow/compat — React Flow (xyflow) API compatibility layer.
|
|
3
|
+
*
|
|
4
|
+
* Migrate an existing React Flow app by changing the import:
|
|
5
|
+
*
|
|
6
|
+
* - import { ReactFlow, Handle, Position, useReactFlow } from '@xyflow/react';
|
|
7
|
+
* + import { ReactFlow, Handle, Position, useReactFlow } from '@realflow/compat';
|
|
8
|
+
* - import '@xyflow/react/dist/style.css';
|
|
9
|
+
* + import '@realflow/compat/style.css';
|
|
10
|
+
*
|
|
11
|
+
* The adapter maps React Flow's controlled `onNodesChange(changes)` model,
|
|
12
|
+
* `<Handle type position>`, `useReactFlow()`, `applyNodeChanges`,
|
|
13
|
+
* `useNodesState`, `addEdge`, etc. onto ReFlow's engine. Coverage targets the
|
|
14
|
+
* common migration surface — see docs/migration.md for the exact map and the
|
|
15
|
+
* few APIs that need manual attention.
|
|
16
|
+
*/
|
|
17
|
+
export { Position, MarkerType, ConnectionMode, ConnectionLineType, PanOnScrollMode, } from './enums.js';
|
|
18
|
+
export { applyNodeChanges, applyEdgeChanges, addEdge, reconnectEdge, } from './changes.js';
|
|
19
|
+
export { useNodesState, useEdgesState } from './useNodesState.js';
|
|
20
|
+
export { Handle } from './Handle.js';
|
|
21
|
+
export { ReactFlow, ReactFlowProvider, useReactFlow } from './ReactFlow.js';
|
|
22
|
+
// These ReFlow components are already API-compatible with React Flow's.
|
|
23
|
+
export { Background, MiniMap, Controls, Panel } from '@realflow/react';
|
|
24
|
+
// React Flow also ships these; the ReFlow versions have equivalent behavior.
|
|
25
|
+
export { NodeResizer, NodeToolbar } from '@realflow/react';
|
|
26
|
+
// React Flow-compatible selection hook.
|
|
27
|
+
export { useOnSelectionChange } from '@realflow/react';
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EACL,QAAQ,EACR,UAAU,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,GAChB,MAAM,SAAS,CAAC;AAiBjB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,OAAO,EACP,aAAa,GACd,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,SAAS,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzE,wEAAwE;AACxE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACvE,6EAA6E;AAC7E,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC3D,wCAAwC;AACxC,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC"}
|