@xyflow/react 12.4.2 → 12.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/additional-components/Background/Background.d.ts +53 -0
- package/dist/esm/additional-components/Background/Background.d.ts.map +1 -1
- package/dist/esm/additional-components/Background/types.d.ts +11 -1
- package/dist/esm/additional-components/Background/types.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/ControlButton.d.ts +23 -0
- package/dist/esm/additional-components/Controls/ControlButton.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/Controls.d.ts +21 -0
- package/dist/esm/additional-components/Controls/Controls.d.ts.map +1 -1
- package/dist/esm/additional-components/Controls/types.d.ts +8 -1
- package/dist/esm/additional-components/Controls/types.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/MiniMap.d.ts +20 -0
- package/dist/esm/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/MiniMapNodes.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/types.d.ts +11 -1
- package/dist/esm/additional-components/MiniMap/types.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts +5 -0
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/NodeResizer.d.ts +24 -0
- package/dist/esm/additional-components/NodeResizer/NodeResizer.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/types.d.ts +15 -3
- package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeToolbar/NodeToolbar.d.ts +35 -0
- package/dist/esm/additional-components/NodeToolbar/NodeToolbar.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeToolbar/types.d.ts +7 -2
- package/dist/esm/additional-components/NodeToolbar/types.d.ts.map +1 -1
- package/dist/esm/components/BatchProvider/index.d.ts.map +1 -1
- package/dist/esm/components/BatchProvider/useQueue.d.ts.map +1 -1
- package/dist/esm/components/ConnectionLine/index.d.ts +4 -4
- package/dist/esm/components/ConnectionLine/index.d.ts.map +1 -1
- package/dist/esm/components/EdgeLabelRenderer/index.d.ts +40 -0
- package/dist/esm/components/EdgeLabelRenderer/index.d.ts.map +1 -1
- package/dist/esm/components/EdgeWrapper/index.d.ts +1 -1
- package/dist/esm/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/esm/components/Edges/BaseEdge.d.ts +27 -0
- package/dist/esm/components/Edges/BaseEdge.d.ts.map +1 -1
- package/dist/esm/components/Edges/EdgeText.d.ts +26 -0
- package/dist/esm/components/Edges/EdgeText.d.ts.map +1 -1
- package/dist/esm/components/Edges/SimpleBezierEdge.d.ts +5 -0
- package/dist/esm/components/Edges/SimpleBezierEdge.d.ts.map +1 -1
- package/dist/esm/components/Edges/index.d.ts.map +1 -1
- package/dist/esm/components/Handle/index.d.ts +32 -4
- package/dist/esm/components/Handle/index.d.ts.map +1 -1
- package/dist/esm/components/NodeWrapper/index.d.ts +1 -1
- package/dist/esm/components/NodeWrapper/index.d.ts.map +1 -1
- package/dist/esm/components/NodeWrapper/useNodeObserver.d.ts.map +1 -1
- package/dist/esm/components/NodeWrapper/utils.d.ts.map +1 -1
- package/dist/esm/components/Nodes/utils.d.ts.map +1 -1
- package/dist/esm/components/Panel/index.d.ts +32 -4
- package/dist/esm/components/Panel/index.d.ts.map +1 -1
- package/dist/esm/components/ReactFlowProvider/index.d.ts +34 -0
- package/dist/esm/components/ReactFlowProvider/index.d.ts.map +1 -1
- package/dist/esm/components/SelectionListener/index.d.ts +4 -4
- package/dist/esm/components/SelectionListener/index.d.ts.map +1 -1
- package/dist/esm/components/StoreUpdater/index.d.ts.map +1 -1
- package/dist/esm/components/ViewportPortal/index.d.ts +25 -0
- package/dist/esm/components/ViewportPortal/index.d.ts.map +1 -1
- package/dist/esm/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
- package/dist/esm/container/NodeRenderer/index.d.ts.map +1 -1
- package/dist/esm/container/Pane/index.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/Wrapper.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts +21 -1
- package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/esm/contexts/NodeIdContext.d.ts +28 -0
- package/dist/esm/contexts/NodeIdContext.d.ts.map +1 -1
- package/dist/esm/hooks/useConnection.d.ts +20 -1
- package/dist/esm/hooks/useConnection.d.ts.map +1 -1
- package/dist/esm/hooks/useEdges.d.ts +13 -1
- package/dist/esm/hooks/useEdges.d.ts.map +1 -1
- package/dist/esm/hooks/useInternalNode.d.ts +21 -1
- package/dist/esm/hooks/useInternalNode.d.ts.map +1 -1
- package/dist/esm/hooks/useKeyPress.d.ts +19 -1
- package/dist/esm/hooks/useKeyPress.d.ts.map +1 -1
- package/dist/esm/hooks/useMoveSelectedNodes.d.ts.map +1 -1
- package/dist/esm/hooks/useNodeConnections.d.ts +17 -1
- package/dist/esm/hooks/useNodeConnections.d.ts.map +1 -1
- package/dist/esm/hooks/useNodes.d.ts +14 -1
- package/dist/esm/hooks/useNodes.d.ts.map +1 -1
- package/dist/esm/hooks/useNodesData.d.ts +14 -2
- package/dist/esm/hooks/useNodesData.d.ts.map +1 -1
- package/dist/esm/hooks/useNodesEdgesState.d.ts +62 -2
- package/dist/esm/hooks/useNodesEdgesState.d.ts.map +1 -1
- package/dist/esm/hooks/useNodesInitialized.d.ts +27 -1
- package/dist/esm/hooks/useNodesInitialized.d.ts.map +1 -1
- package/dist/esm/hooks/useOnSelectionChange.d.ts +37 -5
- package/dist/esm/hooks/useOnSelectionChange.d.ts.map +1 -1
- package/dist/esm/hooks/useOnViewportChange.d.ts +19 -1
- package/dist/esm/hooks/useOnViewportChange.d.ts.map +1 -1
- package/dist/esm/hooks/useReactFlow.d.ts +24 -1
- package/dist/esm/hooks/useReactFlow.d.ts.map +1 -1
- package/dist/esm/hooks/useStore.d.ts +23 -2
- package/dist/esm/hooks/useStore.d.ts.map +1 -1
- package/dist/esm/hooks/useUpdateNodeInternals.d.ts +39 -1
- package/dist/esm/hooks/useUpdateNodeInternals.d.ts.map +1 -1
- package/dist/esm/hooks/useViewport.d.ts +24 -1
- package/dist/esm/hooks/useViewport.d.ts.map +1 -1
- package/dist/esm/hooks/useViewportHelper.d.ts.map +1 -1
- package/dist/esm/index.js +1107 -198
- package/dist/esm/index.mjs +1107 -198
- package/dist/esm/store/index.d.ts.map +1 -1
- package/dist/esm/types/component-props.d.ts +112 -57
- package/dist/esm/types/component-props.d.ts.map +1 -1
- package/dist/esm/types/edges.d.ts +27 -2
- package/dist/esm/types/edges.d.ts.map +1 -1
- package/dist/esm/types/general.d.ts +48 -7
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/types/instance.d.ts +11 -1
- package/dist/esm/types/instance.d.ts.map +1 -1
- package/dist/esm/types/nodes.d.ts +46 -4
- package/dist/esm/types/nodes.d.ts.map +1 -1
- package/dist/esm/types/store.d.ts +2 -2
- package/dist/esm/types/store.d.ts.map +1 -1
- package/dist/esm/utils/changes.d.ts +45 -23
- package/dist/esm/utils/changes.d.ts.map +1 -1
- package/dist/esm/utils/general.d.ts +27 -3
- package/dist/esm/utils/general.d.ts.map +1 -1
- package/dist/umd/additional-components/Background/Background.d.ts +53 -0
- package/dist/umd/additional-components/Background/Background.d.ts.map +1 -1
- package/dist/umd/additional-components/Background/types.d.ts +11 -1
- package/dist/umd/additional-components/Background/types.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/ControlButton.d.ts +23 -0
- package/dist/umd/additional-components/Controls/ControlButton.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/Controls.d.ts +21 -0
- package/dist/umd/additional-components/Controls/Controls.d.ts.map +1 -1
- package/dist/umd/additional-components/Controls/types.d.ts +8 -1
- package/dist/umd/additional-components/Controls/types.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/MiniMap.d.ts +20 -0
- package/dist/umd/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/MiniMapNodes.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/types.d.ts +11 -1
- package/dist/umd/additional-components/MiniMap/types.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts +5 -0
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizer.d.ts +24 -0
- package/dist/umd/additional-components/NodeResizer/NodeResizer.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/types.d.ts +15 -3
- package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeToolbar/NodeToolbar.d.ts +35 -0
- package/dist/umd/additional-components/NodeToolbar/NodeToolbar.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeToolbar/types.d.ts +7 -2
- package/dist/umd/additional-components/NodeToolbar/types.d.ts.map +1 -1
- package/dist/umd/components/BatchProvider/index.d.ts.map +1 -1
- package/dist/umd/components/BatchProvider/useQueue.d.ts.map +1 -1
- package/dist/umd/components/ConnectionLine/index.d.ts +4 -4
- package/dist/umd/components/ConnectionLine/index.d.ts.map +1 -1
- package/dist/umd/components/EdgeLabelRenderer/index.d.ts +40 -0
- package/dist/umd/components/EdgeLabelRenderer/index.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/index.d.ts +1 -1
- package/dist/umd/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/umd/components/Edges/BaseEdge.d.ts +27 -0
- package/dist/umd/components/Edges/BaseEdge.d.ts.map +1 -1
- package/dist/umd/components/Edges/EdgeText.d.ts +26 -0
- package/dist/umd/components/Edges/EdgeText.d.ts.map +1 -1
- package/dist/umd/components/Edges/SimpleBezierEdge.d.ts +5 -0
- package/dist/umd/components/Edges/SimpleBezierEdge.d.ts.map +1 -1
- package/dist/umd/components/Edges/index.d.ts.map +1 -1
- package/dist/umd/components/Handle/index.d.ts +32 -4
- package/dist/umd/components/Handle/index.d.ts.map +1 -1
- package/dist/umd/components/NodeWrapper/index.d.ts +1 -1
- package/dist/umd/components/NodeWrapper/index.d.ts.map +1 -1
- package/dist/umd/components/NodeWrapper/useNodeObserver.d.ts.map +1 -1
- package/dist/umd/components/NodeWrapper/utils.d.ts.map +1 -1
- package/dist/umd/components/Nodes/utils.d.ts.map +1 -1
- package/dist/umd/components/Panel/index.d.ts +32 -4
- package/dist/umd/components/Panel/index.d.ts.map +1 -1
- package/dist/umd/components/ReactFlowProvider/index.d.ts +34 -0
- package/dist/umd/components/ReactFlowProvider/index.d.ts.map +1 -1
- package/dist/umd/components/SelectionListener/index.d.ts +4 -4
- package/dist/umd/components/SelectionListener/index.d.ts.map +1 -1
- package/dist/umd/components/StoreUpdater/index.d.ts.map +1 -1
- package/dist/umd/components/ViewportPortal/index.d.ts +25 -0
- package/dist/umd/components/ViewportPortal/index.d.ts.map +1 -1
- package/dist/umd/container/EdgeRenderer/MarkerDefinitions.d.ts.map +1 -1
- package/dist/umd/container/NodeRenderer/index.d.ts.map +1 -1
- package/dist/umd/container/Pane/index.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/Wrapper.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts +21 -1
- package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/umd/contexts/NodeIdContext.d.ts +28 -0
- package/dist/umd/contexts/NodeIdContext.d.ts.map +1 -1
- package/dist/umd/hooks/useConnection.d.ts +20 -1
- package/dist/umd/hooks/useConnection.d.ts.map +1 -1
- package/dist/umd/hooks/useEdges.d.ts +13 -1
- package/dist/umd/hooks/useEdges.d.ts.map +1 -1
- package/dist/umd/hooks/useInternalNode.d.ts +21 -1
- package/dist/umd/hooks/useInternalNode.d.ts.map +1 -1
- package/dist/umd/hooks/useKeyPress.d.ts +19 -1
- package/dist/umd/hooks/useKeyPress.d.ts.map +1 -1
- package/dist/umd/hooks/useMoveSelectedNodes.d.ts.map +1 -1
- package/dist/umd/hooks/useNodeConnections.d.ts +17 -1
- package/dist/umd/hooks/useNodeConnections.d.ts.map +1 -1
- package/dist/umd/hooks/useNodes.d.ts +14 -1
- package/dist/umd/hooks/useNodes.d.ts.map +1 -1
- package/dist/umd/hooks/useNodesData.d.ts +14 -2
- package/dist/umd/hooks/useNodesData.d.ts.map +1 -1
- package/dist/umd/hooks/useNodesEdgesState.d.ts +62 -2
- package/dist/umd/hooks/useNodesEdgesState.d.ts.map +1 -1
- package/dist/umd/hooks/useNodesInitialized.d.ts +27 -1
- package/dist/umd/hooks/useNodesInitialized.d.ts.map +1 -1
- package/dist/umd/hooks/useOnSelectionChange.d.ts +37 -5
- package/dist/umd/hooks/useOnSelectionChange.d.ts.map +1 -1
- package/dist/umd/hooks/useOnViewportChange.d.ts +19 -1
- package/dist/umd/hooks/useOnViewportChange.d.ts.map +1 -1
- package/dist/umd/hooks/useReactFlow.d.ts +24 -1
- package/dist/umd/hooks/useReactFlow.d.ts.map +1 -1
- package/dist/umd/hooks/useStore.d.ts +23 -2
- package/dist/umd/hooks/useStore.d.ts.map +1 -1
- package/dist/umd/hooks/useUpdateNodeInternals.d.ts +39 -1
- package/dist/umd/hooks/useUpdateNodeInternals.d.ts.map +1 -1
- package/dist/umd/hooks/useViewport.d.ts +24 -1
- package/dist/umd/hooks/useViewport.d.ts.map +1 -1
- package/dist/umd/hooks/useViewportHelper.d.ts.map +1 -1
- package/dist/umd/index.js +2 -2
- package/dist/umd/store/index.d.ts.map +1 -1
- package/dist/umd/types/component-props.d.ts +112 -57
- package/dist/umd/types/component-props.d.ts.map +1 -1
- package/dist/umd/types/edges.d.ts +27 -2
- package/dist/umd/types/edges.d.ts.map +1 -1
- package/dist/umd/types/general.d.ts +48 -7
- package/dist/umd/types/general.d.ts.map +1 -1
- package/dist/umd/types/instance.d.ts +11 -1
- package/dist/umd/types/instance.d.ts.map +1 -1
- package/dist/umd/types/nodes.d.ts +46 -4
- package/dist/umd/types/nodes.d.ts.map +1 -1
- package/dist/umd/types/store.d.ts +2 -2
- package/dist/umd/types/store.d.ts.map +1 -1
- package/dist/umd/utils/changes.d.ts +45 -23
- package/dist/umd/utils/changes.d.ts.map +1 -1
- package/dist/umd/utils/general.d.ts +27 -3
- package/dist/umd/utils/general.d.ts.map +1 -1
- package/package.json +4 -3
|
@@ -1,15 +1,43 @@
|
|
|
1
1
|
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
2
2
|
import type { PanelPosition } from '@xyflow/system';
|
|
3
|
+
/**
|
|
4
|
+
* @expand
|
|
5
|
+
*/
|
|
3
6
|
export type PanelProps = HTMLAttributes<HTMLDivElement> & {
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
7
|
+
/**
|
|
8
|
+
* The position of the panel
|
|
6
9
|
*/
|
|
7
10
|
position?: PanelPosition;
|
|
8
11
|
children: ReactNode;
|
|
9
12
|
};
|
|
13
|
+
/**
|
|
14
|
+
* The `<Panel />` component helps you position content above the viewport.
|
|
15
|
+
* It is used internally by the [`<MiniMap />`](/api-reference/components/minimap)
|
|
16
|
+
* and [`<Controls />`](/api-reference/components/controls) components.
|
|
17
|
+
*
|
|
18
|
+
* @public
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```jsx
|
|
22
|
+
*import { ReactFlow, Background, Panel } from '@xyflow/react';
|
|
23
|
+
*
|
|
24
|
+
*export default function Flow() {
|
|
25
|
+
* return (
|
|
26
|
+
* <ReactFlow nodes={[]} fitView>
|
|
27
|
+
* <Panel position="top-left">top-left</Panel>
|
|
28
|
+
* <Panel position="top-center">top-center</Panel>
|
|
29
|
+
* <Panel position="top-right">top-right</Panel>
|
|
30
|
+
* <Panel position="bottom-left">bottom-left</Panel>
|
|
31
|
+
* <Panel position="bottom-center">bottom-center</Panel>
|
|
32
|
+
* <Panel position="bottom-right">bottom-right</Panel>
|
|
33
|
+
* </ReactFlow>
|
|
34
|
+
* );
|
|
35
|
+
*}
|
|
36
|
+
*```
|
|
37
|
+
*/
|
|
10
38
|
export declare const Panel: import("react").ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
11
|
-
/**
|
|
12
|
-
*
|
|
39
|
+
/**
|
|
40
|
+
* The position of the panel
|
|
13
41
|
*/
|
|
14
42
|
position?: PanelPosition | undefined;
|
|
15
43
|
children: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKpD,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACxD;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAIF,eAAO,MAAM,KAAK;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Panel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKpD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACxD;;OAEG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,KAAK;IAlChB;;OAEG;;cAEO,SAAS;kDA8CpB,CAAC"}
|
|
@@ -13,5 +13,39 @@ export type ReactFlowProviderProps = {
|
|
|
13
13
|
nodeExtent?: CoordinateExtent;
|
|
14
14
|
children: ReactNode;
|
|
15
15
|
};
|
|
16
|
+
/**
|
|
17
|
+
* The `<ReactFlowProvider />` component is a [context provider](https://react.dev/learn/passing-data-deeply-with-context#)
|
|
18
|
+
* that makes it possible to access a flow's internal state outside of the
|
|
19
|
+
* [`<ReactFlow />`](/api-reference/react-flow) component. Many of the hooks we
|
|
20
|
+
* provide rely on this component to work.
|
|
21
|
+
* @public
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```tsx
|
|
25
|
+
*import { ReactFlow, ReactFlowProvider, useNodes } from '@xyflow/react'
|
|
26
|
+
*
|
|
27
|
+
*export default function Flow() {
|
|
28
|
+
* return (
|
|
29
|
+
* <ReactFlowProvider>
|
|
30
|
+
* <ReactFlow nodes={...} edges={...} />
|
|
31
|
+
* <Sidebar />
|
|
32
|
+
* </ReactFlowProvider>
|
|
33
|
+
* );
|
|
34
|
+
*}
|
|
35
|
+
*
|
|
36
|
+
*function Sidebar() {
|
|
37
|
+
* // This hook will only work if the component it's used in is a child of a
|
|
38
|
+
* // <ReactFlowProvider />.
|
|
39
|
+
* const nodes = useNodes()
|
|
40
|
+
*
|
|
41
|
+
* return <aside>do something with nodes</aside>;
|
|
42
|
+
*}
|
|
43
|
+
*```
|
|
44
|
+
*
|
|
45
|
+
* @remarks If you're using a router and want your flow's state to persist across routes,
|
|
46
|
+
* it's vital that you place the `<ReactFlowProvider />` component _outside_ of
|
|
47
|
+
* your router. If you have multiple flows on the same page you will need to use a separate
|
|
48
|
+
* `<ReactFlowProvider />` for each flow.
|
|
49
|
+
*/
|
|
16
50
|
export declare function ReactFlowProvider({ initialNodes: nodes, initialEdges: edges, defaultNodes, defaultEdges, initialWidth: width, initialHeight: height, fitView, nodeOrigin, nodeExtent, children, }: ReactFlowProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
17
51
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ReactFlowProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,EAChC,YAAY,EAAE,KAAK,EACnB,YAAY,EAAE,KAAK,EACnB,YAAY,EACZ,YAAY,EACZ,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,MAAM,EACrB,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,GACT,EAAE,sBAAsB,2CAoBxB"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ReactFlowProvider/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAKjD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG;IACnC,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,YAAY,EAAE,KAAK,EACnB,YAAY,EAAE,KAAK,EACnB,YAAY,EACZ,YAAY,EACZ,YAAY,EAAE,KAAK,EACnB,aAAa,EAAE,MAAM,EACrB,OAAO,EACP,UAAU,EACV,UAAU,EACV,QAAQ,GACT,EAAE,sBAAsB,2CAoBxB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { OnSelectionChangeFunc } from '../../types';
|
|
2
|
-
type SelectionListenerProps = {
|
|
3
|
-
onSelectionChange?: OnSelectionChangeFunc
|
|
1
|
+
import type { OnSelectionChangeFunc, Node, Edge } from '../../types';
|
|
2
|
+
type SelectionListenerProps<NodeType extends Node = Node, EdgeType extends Edge = Edge> = {
|
|
3
|
+
onSelectionChange?: OnSelectionChangeFunc<NodeType, EdgeType>;
|
|
4
4
|
};
|
|
5
|
-
export declare function SelectionListener({ onSelectionChange }: SelectionListenerProps): import("react/jsx-runtime").JSX.Element | null;
|
|
5
|
+
export declare function SelectionListener<NodeType extends Node = Node, EdgeType extends Edge = Edge>({ onSelectionChange, }: SelectionListenerProps<NodeType, EdgeType>): import("react/jsx-runtime").JSX.Element | null;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SelectionListener/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAkB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SelectionListener/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAkB,qBAAqB,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAErF,KAAK,sBAAsB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IACxF,iBAAiB,CAAC,EAAE,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;CAC/D,CAAC;AAkDF,wBAAgB,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAC5F,iBAAiB,GAClB,EAAE,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,CAAC,kDAQ5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StoreUpdater/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAkB,cAAc,EAAkB,MAAM,aAAa,CAAC;AAI9F,QAAA,MAAM,sBAAsB,w7BAwDlB,CAAC;AAEX,KAAK,sBAAsB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AACtE,KAAK,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,IAAI,CACvF,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAClC,sBAAsB,CACvB,GAAG;IACF,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/StoreUpdater/index.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAkB,cAAc,EAAkB,MAAM,aAAa,CAAC;AAI9F,QAAA,MAAM,sBAAsB,w7BAwDlB,CAAC;AAEX,KAAK,sBAAsB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,CAAC;AACtE,KAAK,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,IAAI,CACvF,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAClC,sBAAsB,CACvB,GAAG;IACF,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAiCF,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,EACrF,KAAK,EAAE,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAyD7C"}
|
|
@@ -1,4 +1,29 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The `<ViewportPortal />` component can be used to add components to the same viewport
|
|
4
|
+
* of the flow where nodes and edges are rendered. This is useful when you want to render
|
|
5
|
+
* your own components that are adhere to the same coordinate system as the nodes & edges
|
|
6
|
+
* and are also affected by zooming and panning
|
|
7
|
+
* @public
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```jsx
|
|
11
|
+
*import React from 'react';
|
|
12
|
+
*import { ViewportPortal } from '@xyflow/react';
|
|
13
|
+
*
|
|
14
|
+
*export default function () {
|
|
15
|
+
* return (
|
|
16
|
+
* <ViewportPortal>
|
|
17
|
+
* <div
|
|
18
|
+
* style={{ transform: 'translate(100px, 100px)', position: 'absolute' }}
|
|
19
|
+
* >
|
|
20
|
+
* This div is positioned at [100, 100] on the flow.
|
|
21
|
+
* </div>
|
|
22
|
+
* </ViewportPortal>
|
|
23
|
+
* );
|
|
24
|
+
*}
|
|
25
|
+
*```
|
|
26
|
+
*/
|
|
2
27
|
export declare function ViewportPortal({ children }: {
|
|
3
28
|
children: ReactNode;
|
|
4
29
|
}): import("react").ReactPortal | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ViewportPortal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,sCAQnE"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ViewportPortal/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAQvC;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,cAAc,CAAC,EAAE,QAAQ,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,sCAQnE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkerDefinitions.d.ts","sourceRoot":"","sources":["../../../src/container/EdgeRenderer/MarkerDefinitions.tsx"],"names":[],"mappings":";AAMA,KAAK,sBAAsB,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;;;;;
|
|
1
|
+
{"version":3,"file":"MarkerDefinitions.d.ts","sourceRoot":"","sources":["../../../src/container/EdgeRenderer/MarkerDefinitions.tsx"],"names":[],"mappings":";AAMA,KAAK,sBAAsB,GAAG;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;;;;;AAkFF,wBAAuC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/NodeRenderer/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,IAAI,IAAI,CACzD,cAAc,CAAC,QAAQ,CAAC,EACtB,aAAa,GACb,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,2BAA2B,GAC3B,gBAAgB,GAChB,iBAAiB,GACjB,MAAM,GACN,qBAAqB,GACrB,YAAY,GACZ,WAAW,GACX,mBAAmB,CACtB,CAAC;AAUF,iBAAS,qBAAqB,CAAC,QAAQ,SAAS,IAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/NodeRenderer/index.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,aAAa,CAAC;AAExD,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,IAAI,IAAI,CACzD,cAAc,CAAC,QAAQ,CAAC,EACtB,aAAa,GACb,mBAAmB,GACnB,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,mBAAmB,GACnB,2BAA2B,GAC3B,gBAAgB,GAChB,iBAAiB,GACjB,MAAM,GACN,qBAAqB,GACrB,YAAY,GACZ,WAAW,GACX,mBAAmB,CACtB,CAAC;AAUF,iBAAS,qBAAqB,CAAC,QAAQ,SAAS,IAAI,EAAE,KAAK,EAAE,iBAAiB,CAAC,QAAQ,CAAC,2CA6DvF;kBA7DQ,qBAAqB;;;AAiE9B,eAAO,MAAM,YAAY,8BAA8D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/Pane/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAgBf,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAElE,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,OAAO,CACT,IAAI,CACF,cAAc,EACZ,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,gBAAgB,GAChB,aAAa,GACb,mBAAmB,GACnB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,CACpB,CACF,CAAC;AAoBF,wBAAgB,IAAI,CAAC,EACnB,WAAW,EACX,mBAAmB,EACnB,aAAkC,EAClC,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACT,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/Pane/index.tsx"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAIL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAgBf,OAAO,KAAK,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAElE,KAAK,SAAS,GAAG;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,QAAQ,EAAE,SAAS,CAAC;CACrB,GAAG,OAAO,CACT,IAAI,CACF,cAAc,EACZ,eAAe,GACf,WAAW,GACX,kBAAkB,GAClB,gBAAgB,GAChB,aAAa,GACb,mBAAmB,GACnB,cAAc,GACd,kBAAkB,GAClB,iBAAiB,GACjB,kBAAkB,GAClB,iBAAiB,CACpB,CACF,CAAC;AAoBF,wBAAgB,IAAI,CAAC,EACnB,WAAW,EACX,mBAAmB,EACnB,aAAkC,EAClC,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,QAAQ,GACT,EAAE,SAAS,2CAwMX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/Wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,
|
|
1
|
+
{"version":3,"file":"Wrapper.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/Wrapper.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAInD,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAE9D,wBAAgB,OAAO,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,MAAM,EACN,OAAO,EACP,UAAU,EACV,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,EAAE,CAAC;IACf,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,EAAE,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,2CA0BA"}
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import type { Edge, Node, ReactFlowProps } from '../../types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* The `<ReactFlow />` component is the heart of your React Flow application.
|
|
5
|
+
* It renders your nodes and edges and handles user interaction
|
|
6
|
+
*
|
|
7
|
+
* @public
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
*import { ReactFlow } from '@xyflow/react'
|
|
12
|
+
*
|
|
13
|
+
*export default function Flow() {
|
|
14
|
+
* return (<ReactFlow
|
|
15
|
+
* nodes={...}
|
|
16
|
+
* edges={...}
|
|
17
|
+
* onNodesChange={...}
|
|
18
|
+
* ...
|
|
19
|
+
* />);
|
|
20
|
+
*}
|
|
21
|
+
*```
|
|
22
|
+
*/
|
|
23
|
+
declare const _default: <NodeType extends Node = Node, EdgeType extends Edge = Edge>(props: ReactFlowProps<NodeType, EdgeType> & import("react").RefAttributes<HTMLDivElement>) => import("react").JSX.Element;
|
|
4
24
|
export default _default;
|
|
5
25
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/index.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/container/ReactFlow/index.tsx"],"names":[],"mappings":";AAWA,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AA+S9D;;;;;;;;;;;;;;;;;;;GAmBG;;AACH,wBAA0C"}
|
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
export declare const NodeIdContext: import("react").Context<string | null>;
|
|
3
3
|
export declare const Provider: import("react").Provider<string | null>;
|
|
4
4
|
export declare const Consumer: import("react").Consumer<string | null>;
|
|
5
|
+
/**
|
|
6
|
+
* You can use this hook to get the id of the node it is used inside. It is useful
|
|
7
|
+
* if you need the node's id deeper in the render tree but don't want to manually
|
|
8
|
+
* drill down the id as a prop.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @returns id of the node
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
*```jsx
|
|
15
|
+
*import { useNodeId } from '@xyflow/react';
|
|
16
|
+
*
|
|
17
|
+
*export default function CustomNode() {
|
|
18
|
+
* return (
|
|
19
|
+
* <div>
|
|
20
|
+
* <span>This node has an id of </span>
|
|
21
|
+
* <NodeIdDisplay />
|
|
22
|
+
* </div>
|
|
23
|
+
* );
|
|
24
|
+
*}
|
|
25
|
+
*
|
|
26
|
+
*function NodeIdDisplay() {
|
|
27
|
+
* const nodeId = useNodeId();
|
|
28
|
+
*
|
|
29
|
+
* return <span>{nodeId}</span>;
|
|
30
|
+
*}
|
|
31
|
+
*```
|
|
32
|
+
*/
|
|
5
33
|
export declare const useNodeId: () => string | null;
|
|
6
34
|
export default NodeIdContext;
|
|
7
35
|
//# sourceMappingURL=NodeIdContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NodeIdContext.d.ts","sourceRoot":"","sources":["../../src/contexts/NodeIdContext.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,aAAa,wCAAqC,CAAC;AAChE,eAAO,MAAM,QAAQ,yCAAyB,CAAC;AAC/C,eAAO,MAAM,QAAQ,yCAAyB,CAAC;AAE/C,eAAO,MAAM,SAAS,QAAO,MAAM,GAAG,IAGrC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"NodeIdContext.d.ts","sourceRoot":"","sources":["../../src/contexts/NodeIdContext.ts"],"names":[],"mappings":";AAEA,eAAO,MAAM,aAAa,wCAAqC,CAAC;AAChE,eAAO,MAAM,QAAQ,yCAAyB,CAAC;AAC/C,eAAO,MAAM,QAAQ,yCAAyB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,SAAS,QAAO,MAAM,GAAG,IAGrC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,9 +1,28 @@
|
|
|
1
1
|
import { ConnectionState } from '@xyflow/system';
|
|
2
2
|
import type { InternalNode, Node } from '../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* The `useConnection` hook returns the current connection when there is an active
|
|
5
|
+
* connection interaction. If no connection interaction is active, it returns null
|
|
6
|
+
* for every property. A typical use case for this hook is to colorize handles
|
|
7
|
+
* based on a certain condition (e.g. if the connection is valid or not).
|
|
5
8
|
*
|
|
6
9
|
* @public
|
|
10
|
+
* @example
|
|
11
|
+
*
|
|
12
|
+
* ```tsx
|
|
13
|
+
*import { useConnection } from '@xyflow/react';
|
|
14
|
+
*
|
|
15
|
+
*function App() {
|
|
16
|
+
* const connection = useConnection();
|
|
17
|
+
*
|
|
18
|
+
* return (
|
|
19
|
+
* <div> {connection ? `Someone is trying to make a connection from ${connection.fromNode} to this one.` : 'There are currently no incoming connections!'}
|
|
20
|
+
*
|
|
21
|
+
* </div>
|
|
22
|
+
* );
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
7
26
|
* @returns ConnectionState
|
|
8
27
|
*/
|
|
9
28
|
export declare function useConnection<NodeType extends Node = Node, SelectorReturn = ConnectionState<InternalNode<NodeType>>>(connectionSelector?: (connection: ConnectionState<InternalNode<NodeType>>) => SelectorReturn): SelectorReturn;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAwB,MAAM,gBAAgB,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAqBnE
|
|
1
|
+
{"version":3,"file":"useConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useConnection.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAwB,MAAM,gBAAgB,CAAC;AAGvE,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAqBnE;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,cAAc,GAAG,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,EAClH,kBAAkB,CAAC,EAAE,CAAC,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,KAAK,cAAc,GAC3F,cAAc,CAGhB"}
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import type { Edge } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* This hook returns an array of the current edges. Components that use this hook
|
|
4
|
+
* will re-render **whenever any edge changes**.
|
|
4
5
|
*
|
|
5
6
|
* @public
|
|
6
7
|
* @returns An array of edges
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
*import { useEdges } from '@xyflow/react';
|
|
12
|
+
*
|
|
13
|
+
*export default function () {
|
|
14
|
+
* const edges = useEdges();
|
|
15
|
+
*
|
|
16
|
+
* return <div>There are currently {edges.length} edges!</div>;
|
|
17
|
+
*}
|
|
18
|
+
*```
|
|
7
19
|
*/
|
|
8
20
|
export declare function useEdges<EdgeType extends Edge = Edge>(): EdgeType[];
|
|
9
21
|
//# sourceMappingURL=useEdges.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEdges.d.ts","sourceRoot":"","sources":["../../src/hooks/useEdges.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIrD
|
|
1
|
+
{"version":3,"file":"useEdges.d.ts","sourceRoot":"","sources":["../../src/hooks/useEdges.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIrD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,EAAE,CAInE"}
|
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
import type { InternalNode, Node } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* This hook returns the internal representation of a specific node.
|
|
4
|
+
* Components that use this hook will re-render **whenever the node changes**,
|
|
5
|
+
* including when a node is selected or moved.
|
|
4
6
|
*
|
|
5
7
|
* @public
|
|
6
8
|
* @param id - id of the node
|
|
7
9
|
* @returns array with visible node ids
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
*import { useInternalNode } from '@xyflow/react';
|
|
14
|
+
*
|
|
15
|
+
*export default function () {
|
|
16
|
+
* const internalNode = useInternalNode('node-1');
|
|
17
|
+
* const absolutePosition = internalNode.internals.positionAbsolute;
|
|
18
|
+
*
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* The absolute position of the node is at:
|
|
22
|
+
* <p>x: {absolutePosition.x}</p>
|
|
23
|
+
* <p>y: {absolutePosition.y}</p>
|
|
24
|
+
* </div>
|
|
25
|
+
* );
|
|
26
|
+
*}
|
|
27
|
+
*```
|
|
8
28
|
*/
|
|
9
29
|
export declare function useInternalNode<NodeType extends Node = Node>(id: string): InternalNode<NodeType> | undefined;
|
|
10
30
|
//# sourceMappingURL=useInternalNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInternalNode.d.ts","sourceRoot":"","sources":["../../src/hooks/useInternalNode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEnD
|
|
1
|
+
{"version":3,"file":"useInternalNode.d.ts","sourceRoot":"","sources":["../../src/hooks/useInternalNode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,eAAe,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,EAAE,EAAE,MAAM,GAAG,YAAY,CAAC,QAAQ,CAAC,GAAG,SAAS,CAO5G"}
|
|
@@ -4,12 +4,30 @@ export type UseKeyPressOptions = {
|
|
|
4
4
|
actInsideInputWithModifier?: boolean;
|
|
5
5
|
};
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* This hook lets you listen for specific key codes and tells you whether they are
|
|
8
|
+
* currently pressed or not.
|
|
8
9
|
*
|
|
9
10
|
* @public
|
|
10
11
|
* @param param.keyCode - The key code (string or array of strings) to use
|
|
11
12
|
* @param param.options - Options
|
|
12
13
|
* @returns boolean
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```tsx
|
|
17
|
+
*import { useKeyPress } from '@xyflow/react';
|
|
18
|
+
*
|
|
19
|
+
*export default function () {
|
|
20
|
+
* const spacePressed = useKeyPress('Space');
|
|
21
|
+
* const cmdAndSPressed = useKeyPress(['Meta+s', 'Strg+s']);
|
|
22
|
+
*
|
|
23
|
+
* return (
|
|
24
|
+
* <div>
|
|
25
|
+
* {spacePressed && <p>Space pressed!</p>}
|
|
26
|
+
* {cmdAndSPressed && <p>Cmd + S pressed!</p>}
|
|
27
|
+
* </div>
|
|
28
|
+
* );
|
|
29
|
+
*}
|
|
30
|
+
*```
|
|
13
31
|
*/
|
|
14
32
|
export declare function useKeyPress(keyCode?: KeyCode | null, options?: UseKeyPressOptions): boolean;
|
|
15
33
|
//# sourceMappingURL=useKeyPress.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useKeyPress.d.ts","sourceRoot":"","sources":["../../src/hooks/useKeyPress.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IAC7D,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAIF
|
|
1
|
+
{"version":3,"file":"useKeyPress.d.ts","sourceRoot":"","sources":["../../src/hooks/useKeyPress.ts"],"names":[],"mappings":"AACA,OAAO,EAAkB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM9D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,GAAG,IAAI,CAAC;IAC7D,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,CAAC;AAIF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,WAAW,CAOzB,OAAO,GAAE,OAAO,GAAG,IAAW,EAC9B,OAAO,GAAE,kBAA6E,GACrF,OAAO,CAuGT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMoveSelectedNodes.d.ts","sourceRoot":"","sources":["../../src/hooks/useMoveSelectedNodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQtF;;;;;GAKG;AACH,wBAAgB,oBAAoB,aAGa;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"useMoveSelectedNodes.d.ts","sourceRoot":"","sources":["../../src/hooks/useMoveSelectedNodes.ts"],"names":[],"mappings":"AACA,OAAO,EAAuC,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAQtF;;;;;GAKG;AACH,wBAAgB,oBAAoB,aAGa;IAAE,SAAS,EAAE,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,UAiDzF"}
|
|
@@ -7,7 +7,7 @@ type UseNodeConnectionsParams = {
|
|
|
7
7
|
onDisconnect?: (connections: Connection[]) => void;
|
|
8
8
|
};
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* This hook returns an array of connections on a specific node, handle type ('source', 'target') or handle ID.
|
|
11
11
|
*
|
|
12
12
|
* @public
|
|
13
13
|
* @param param.id - node id - optional if called inside a custom node
|
|
@@ -16,6 +16,22 @@ type UseNodeConnectionsParams = {
|
|
|
16
16
|
* @param param.onConnect - gets called when a connection is established
|
|
17
17
|
* @param param.onDisconnect - gets called when a connection is removed
|
|
18
18
|
* @returns an array with connections
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```jsx
|
|
22
|
+
*import { useNodeConnections } from '@xyflow/react';
|
|
23
|
+
*
|
|
24
|
+
*export default function () {
|
|
25
|
+
* const connections = useNodeConnections({
|
|
26
|
+
* handleType: 'target',
|
|
27
|
+
* handleId: 'my-handle',
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* return (
|
|
31
|
+
* <div>There are currently {connections.length} incoming connections!</div>
|
|
32
|
+
* );
|
|
33
|
+
*}
|
|
34
|
+
*```
|
|
19
35
|
*/
|
|
20
36
|
export declare function useNodeConnections({ id, handleType, handleId, onConnect, onDisconnect, }?: UseNodeConnectionsParams): NodeConnection[];
|
|
21
37
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNodeConnections.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodeConnections.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,cAAc,EACd,UAAU,EAIX,MAAM,gBAAgB,CAAC;AAOxB,KAAK,wBAAwB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"useNodeConnections.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodeConnections.ts"],"names":[],"mappings":"AACA,OAAO,EACL,UAAU,EACV,cAAc,EACd,UAAU,EAIX,MAAM,gBAAgB,CAAC;AAOxB,KAAK,wBAAwB,GAAG;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;IAChD,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,EAAE,EACF,UAAU,EACV,QAAQ,EACR,SAAS,EACT,YAAY,GACb,GAAE,wBAA6B,GAAG,cAAc,EAAE,CA8BlD"}
|
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import type { Node } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* This hook returns an array of the current nodes. Components that use this hook
|
|
4
|
+
* will re-render **whenever any node changes**, including when a node is selected
|
|
5
|
+
* or moved.
|
|
4
6
|
*
|
|
5
7
|
* @public
|
|
6
8
|
* @returns An array of nodes
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```jsx
|
|
12
|
+
*import { useNodes } from '@xyflow/react';
|
|
13
|
+
*
|
|
14
|
+
*export default function() {
|
|
15
|
+
* const nodes = useNodes();
|
|
16
|
+
*
|
|
17
|
+
* return <div>There are currently {nodes.length} nodes!</div>;
|
|
18
|
+
*}
|
|
19
|
+
*```
|
|
7
20
|
*/
|
|
8
21
|
export declare function useNodes<NodeType extends Node = Node>(): NodeType[];
|
|
9
22
|
//# sourceMappingURL=useNodes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNodes.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIrD
|
|
1
|
+
{"version":3,"file":"useNodes.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,IAAI,EAAkB,MAAM,UAAU,CAAC;AAIrD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,KAAK,QAAQ,EAAE,CAInE"}
|
|
@@ -1,11 +1,23 @@
|
|
|
1
1
|
import type { Node } from '../types';
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* This hook lets you subscribe to changes of a specific nodes `data` object.
|
|
4
4
|
*
|
|
5
5
|
* @public
|
|
6
6
|
* @param nodeId - The id (or ids) of the node to get the data from
|
|
7
|
-
* @param guard - Optional guard function to narrow down the node type
|
|
8
7
|
* @returns An object (or array of object) with {id, type, data} representing each node
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
*
|
|
11
|
+
*```jsx
|
|
12
|
+
*import { useNodesData } from '@xyflow/react';
|
|
13
|
+
*
|
|
14
|
+
*export default function() {
|
|
15
|
+
* const nodeData = useNodesData('nodeId-1');
|
|
16
|
+
* const nodesData = useNodesData(['nodeId-1', 'nodeId-2']);
|
|
17
|
+
*
|
|
18
|
+
* return null;
|
|
19
|
+
*}
|
|
20
|
+
*```
|
|
9
21
|
*/
|
|
10
22
|
export declare function useNodesData<NodeType extends Node = Node>(nodeId: string): Pick<NodeType, 'id' | 'type' | 'data'> | null;
|
|
11
23
|
export declare function useNodesData<NodeType extends Node = Node>(nodeIds: string[]): Pick<NodeType, 'id' | 'type' | 'data'>[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNodesData.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesData.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC
|
|
1
|
+
{"version":3,"file":"useNodesData.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesData.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAErC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EACvD,MAAM,EAAE,MAAM,GACb,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,GAAG,IAAI,CAAC;AACjD,wBAAgB,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,QAAQ,EAAE,IAAI,GAAG,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC"}
|
|
@@ -1,19 +1,79 @@
|
|
|
1
1
|
import { type Dispatch, type SetStateAction } from 'react';
|
|
2
2
|
import type { Node, Edge, OnNodesChange, OnEdgesChange } from '../types';
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* This hook makes it easy to prototype a controlled flow where you manage the
|
|
5
|
+
* state of nodes and edges outside the `ReactFlowInstance`. You can think of it
|
|
6
|
+
* like React's `useState` hook with an additional helper callback.
|
|
5
7
|
*
|
|
6
8
|
* @public
|
|
7
9
|
* @param initialNodes
|
|
8
10
|
* @returns an array [nodes, setNodes, onNodesChange]
|
|
11
|
+
* @example
|
|
12
|
+
*
|
|
13
|
+
*```tsx
|
|
14
|
+
*import { ReactFlow, useNodesState, useEdgesState } from '@xyflow/react';
|
|
15
|
+
*
|
|
16
|
+
*const initialNodes = [];
|
|
17
|
+
*const initialEdges = [];
|
|
18
|
+
*
|
|
19
|
+
*export default function () {
|
|
20
|
+
* const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
|
|
21
|
+
* const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
|
|
22
|
+
*
|
|
23
|
+
* return (
|
|
24
|
+
* <ReactFlow
|
|
25
|
+
* nodes={nodes}
|
|
26
|
+
* edges={edges}
|
|
27
|
+
* onNodesChange={onNodesChange}
|
|
28
|
+
* onEdgesChange={onEdgesChange}
|
|
29
|
+
* />
|
|
30
|
+
* );
|
|
31
|
+
*}
|
|
32
|
+
*```
|
|
33
|
+
*
|
|
34
|
+
* @remarks This hook was created to make prototyping easier and our documentation
|
|
35
|
+
* examples clearer. Although it is OK to use this hook in production, in
|
|
36
|
+
* practice you may want to use a more sophisticated state management solution
|
|
37
|
+
* like Zustand {@link https://reactflow.dev/docs/guides/state-management/} instead.
|
|
38
|
+
*
|
|
9
39
|
*/
|
|
10
40
|
export declare function useNodesState<NodeType extends Node>(initialNodes: NodeType[]): [NodeType[], Dispatch<SetStateAction<NodeType[]>>, OnNodesChange<NodeType>];
|
|
11
41
|
/**
|
|
12
|
-
*
|
|
42
|
+
* This hook makes it easy to prototype a controlled flow where you manage the
|
|
43
|
+
* state of nodes and edges outside the `ReactFlowInstance`. You can think of it
|
|
44
|
+
* like React's `useState` hook with an additional helper callback.
|
|
13
45
|
*
|
|
14
46
|
* @public
|
|
15
47
|
* @param initialEdges
|
|
16
48
|
* @returns an array [edges, setEdges, onEdgesChange]
|
|
49
|
+
* @example
|
|
50
|
+
*
|
|
51
|
+
*```tsx
|
|
52
|
+
*import { ReactFlow, useNodesState, useEdgesState } from '@xyflow/react';
|
|
53
|
+
*
|
|
54
|
+
*const initialNodes = [];
|
|
55
|
+
*const initialEdges = [];
|
|
56
|
+
*
|
|
57
|
+
*export default function () {
|
|
58
|
+
* const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
|
|
59
|
+
* const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
|
|
60
|
+
*
|
|
61
|
+
* return (
|
|
62
|
+
* <ReactFlow
|
|
63
|
+
* nodes={nodes}
|
|
64
|
+
* edges={edges}
|
|
65
|
+
* onNodesChange={onNodesChange}
|
|
66
|
+
* onEdgesChange={onEdgesChange}
|
|
67
|
+
* />
|
|
68
|
+
* );
|
|
69
|
+
*}
|
|
70
|
+
*```
|
|
71
|
+
*
|
|
72
|
+
* @remarks This hook was created to make prototyping easier and our documentation
|
|
73
|
+
* examples clearer. Although it is OK to use this hook in production, in
|
|
74
|
+
* practice you may want to use a more sophisticated state management solution
|
|
75
|
+
* like Zustand {@link https://reactflow.dev/docs/guides/state-management/} instead.
|
|
76
|
+
*
|
|
17
77
|
*/
|
|
18
78
|
export declare function useEdgesState<EdgeType extends Edge = Edge>(initialEdges: EdgeType[]): [EdgeType[], Dispatch<SetStateAction<EdgeType[]>>, OnEdgesChange<EdgeType>];
|
|
19
79
|
//# sourceMappingURL=useNodesEdgesState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNodesEdgesState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesEdgesState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGlF,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzE
|
|
1
|
+
{"version":3,"file":"useNodesEdgesState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNodesEdgesState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGlF,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,EACjD,YAAY,EAAE,QAAQ,EAAE,GACvB,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAQ7E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EACxD,YAAY,EAAE,QAAQ,EAAE,GACvB,CAAC,QAAQ,EAAE,EAAE,QAAQ,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAQ7E"}
|