likec4 1.28.0 → 1.29.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/react/index.d.mts CHANGED
@@ -1537,6 +1537,7 @@ type ConnectionLineComponent<NodeType extends Node$1 = Node$1> = ComponentType<C
1537
1537
  interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge = Edge> extends Omit<HTMLAttributes<HTMLDivElement>, "onError"> {
1538
1538
  /**
1539
1539
  * An array of nodes to render in a controlled flow.
1540
+ * @default []
1540
1541
  * @example
1541
1542
  * const nodes = [
1542
1543
  * {
@@ -1550,6 +1551,7 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1550
1551
  nodes?: NodeType[];
1551
1552
  /**
1552
1553
  * An array of edges to render in a controlled flow.
1554
+ * @default []
1553
1555
  * @example
1554
1556
  * const edges = [
1555
1557
  * {
@@ -1585,51 +1587,66 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1585
1587
  * }
1586
1588
  */
1587
1589
  defaultEdgeOptions?: DefaultEdgeOptions;
1588
- /** This event handler is called when a user clicks on a node */
1590
+ /** This event handler is called when a user clicks on a node. */
1589
1591
  onNodeClick?: NodeMouseHandler<NodeType>;
1590
- /** This event handler is called when a user double clicks on a node */
1592
+ /** This event handler is called when a user double-clicks on a node. */
1591
1593
  onNodeDoubleClick?: NodeMouseHandler<NodeType>;
1592
- /** This event handler is called when mouse of a user enters a node */
1594
+ /** This event handler is called when mouse of a user enters a node. */
1593
1595
  onNodeMouseEnter?: NodeMouseHandler<NodeType>;
1594
- /** This event handler is called when mouse of a user moves over a node */
1596
+ /** This event handler is called when mouse of a user moves over a node. */
1595
1597
  onNodeMouseMove?: NodeMouseHandler<NodeType>;
1596
- /** This event handler is called when mouse of a user leaves a node */
1598
+ /** This event handler is called when mouse of a user leaves a node. */
1597
1599
  onNodeMouseLeave?: NodeMouseHandler<NodeType>;
1598
- /** This event handler is called when a user right clicks on a node */
1600
+ /** This event handler is called when a user right-clicks on a node. */
1599
1601
  onNodeContextMenu?: NodeMouseHandler<NodeType>;
1600
- /** This event handler is called when a user starts to drag a node */
1602
+ /** This event handler is called when a user starts to drag a node. */
1601
1603
  onNodeDragStart?: OnNodeDrag<NodeType>;
1602
- /** This event handler is called when a user drags a node */
1604
+ /** This event handler is called when a user drags a node. */
1603
1605
  onNodeDrag?: OnNodeDrag<NodeType>;
1604
- /** This event handler is called when a user stops dragging a node */
1606
+ /** This event handler is called when a user stops dragging a node. */
1605
1607
  onNodeDragStop?: OnNodeDrag<NodeType>;
1606
- /** This event handler is called when a user clicks on an edge */
1608
+ /** This event handler is called when a user clicks on an edge. */
1607
1609
  onEdgeClick?: (event: ReactMouseEvent, edge: EdgeType) => void;
1608
- /** This event handler is called when a user right clicks on an edge */
1610
+ /** This event handler is called when a user right-clicks on an edge. */
1609
1611
  onEdgeContextMenu?: EdgeMouseHandler<EdgeType>;
1610
- /** This event handler is called when mouse of a user enters an edge */
1612
+ /** This event handler is called when mouse of a user enters an edge. */
1611
1613
  onEdgeMouseEnter?: EdgeMouseHandler<EdgeType>;
1612
- /** This event handler is called when mouse of a user moves over an edge */
1614
+ /** This event handler is called when mouse of a user moves over an edge. */
1613
1615
  onEdgeMouseMove?: EdgeMouseHandler<EdgeType>;
1614
- /** This event handler is called when mouse of a user leaves an edge */
1616
+ /** This event handler is called when mouse of a user leaves an edge. */
1615
1617
  onEdgeMouseLeave?: EdgeMouseHandler<EdgeType>;
1616
- /** This event handler is called when a user double clicks on an edge */
1618
+ /** This event handler is called when a user double-clicks on an edge. */
1617
1619
  onEdgeDoubleClick?: EdgeMouseHandler<EdgeType>;
1620
+ /**
1621
+ * This handler is called when the source or target of a reconnectable edge is dragged from the
1622
+ * current node. It will fire even if the edge's source or target do not end up changing.
1623
+ *
1624
+ * You can use the `reconnectEdge` utility to convert the connection to a new edge.
1625
+ */
1618
1626
  onReconnect?: OnReconnect<EdgeType>;
1627
+ /**
1628
+ * This event fires when the user begins dragging the source or target of an editable edge.
1629
+ */
1619
1630
  onReconnectStart?: (event: ReactMouseEvent, edge: EdgeType, handleType: HandleType) => void;
1631
+ /**
1632
+ * This event fires when the user releases the source or target of an editable edge. It is called
1633
+ * even if an edge update does not occur.
1634
+ *
1635
+ */
1620
1636
  onReconnectEnd?: (event: MouseEvent | TouchEvent, edge: EdgeType, handleType: HandleType) => void;
1621
1637
  /**
1622
- * This event handler is called when a Node is updated
1638
+ * Use this event handler to add interactivity to a controlled flow.
1639
+ * It is called on node drag, select, and move.
1623
1640
  * @example // Use NodesState hook to create edges and get onNodesChange handler
1624
1641
  * import ReactFlow, { useNodesState } from '@xyflow/react';
1625
- * const [edges, setNodes, onNodesChange] = useNodesState(initialNodes);
1642
+ * const [nodes, setNodes, onNodesChange] = useNodesState(initialNodes);
1626
1643
  *
1627
1644
  * return (<ReactFlow onNodeChange={onNodeChange} {...rest} />)
1628
- * @example // Use helper function to update edge
1645
+ * @example // Use helper function to update node
1629
1646
  * import ReactFlow, { applyNodeChanges } from '@xyflow/react';
1630
1647
  *
1631
1648
  * const onNodeChange = useCallback(
1632
- * (changes) => setNode((eds) => applyNodeChanges(changes, eds)),
1649
+ * (changes) => setNode((nds) => applyNodeChanges(changes, nds)),
1633
1650
  * [],
1634
1651
  * );
1635
1652
  *
@@ -1637,7 +1654,8 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1637
1654
  */
1638
1655
  onNodesChange?: OnNodesChange<NodeType>;
1639
1656
  /**
1640
- * This event handler is called when a Edge is updated
1657
+ * Use this event handler to add interactivity to a controlled flow. It is called on edge select
1658
+ * and remove.
1641
1659
  * @example // Use EdgesState hook to create edges and get onEdgesChange handler
1642
1660
  * import ReactFlow, { useEdgesState } from '@xyflow/react';
1643
1661
  * const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
@@ -1654,25 +1672,28 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1654
1672
  * return (<ReactFlow onEdgesChange={onEdgesChange} {...rest} />)
1655
1673
  */
1656
1674
  onEdgesChange?: OnEdgesChange<EdgeType>;
1657
- /** This event handler gets called when a Node is deleted */
1675
+ /** This event handler gets called when a node is deleted. */
1658
1676
  onNodesDelete?: OnNodesDelete<NodeType>;
1659
- /** This event handler gets called when a Edge is deleted */
1677
+ /** This event handler gets called when an edge is deleted. */
1660
1678
  onEdgesDelete?: OnEdgesDelete<EdgeType>;
1661
- /** This event handler gets called when a Node or Edge is deleted */
1679
+ /** This event handler gets called when a node or edge is deleted. */
1662
1680
  onDelete?: OnDelete<NodeType, EdgeType>;
1663
- /** This event handler gets called when a user starts to drag a selection box */
1681
+ /** This event handler gets called when a user starts to drag a selection box. */
1664
1682
  onSelectionDragStart?: SelectionDragHandler<NodeType>;
1665
- /** This event handler gets called when a user drags a selection box */
1683
+ /** This event handler gets called when a user drags a selection box. */
1666
1684
  onSelectionDrag?: SelectionDragHandler<NodeType>;
1667
- /** This event handler gets called when a user stops dragging a selection box */
1685
+ /** This event handler gets called when a user stops dragging a selection box. */
1668
1686
  onSelectionDragStop?: SelectionDragHandler<NodeType>;
1669
1687
  onSelectionStart?: (event: ReactMouseEvent) => void;
1670
1688
  onSelectionEnd?: (event: ReactMouseEvent) => void;
1689
+ /**
1690
+ * This event handler is called when a user right-clicks on a node selection.
1691
+ */
1671
1692
  onSelectionContextMenu?: (event: ReactMouseEvent, nodes: NodeType[]) => void;
1672
1693
  /**
1673
1694
  * When a connection line is completed and two nodes are connected by the user, this event fires with the new connection.
1674
1695
  *
1675
- * You can use the addEdge utility to convert the connection to a complete edge.
1696
+ * You can use the `addEdge` utility to convert the connection to a complete edge.
1676
1697
  * @example // Use helper function to update edges onConnect
1677
1698
  * import ReactFlow, { addEdge } from '@xyflow/react';
1678
1699
  *
@@ -1684,50 +1705,70 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1684
1705
  * return (<ReactFlow onConnect={onConnect} {...rest} />)
1685
1706
  */
1686
1707
  onConnect?: OnConnect;
1687
- /** This event handler gets called when a user starts to drag a connection line */
1708
+ /** This event handler gets called when a user starts to drag a connection line. */
1688
1709
  onConnectStart?: OnConnectStart;
1689
- /** This event handler gets called when a user stops dragging a connection line */
1710
+ /**
1711
+ * This callback will fire regardless of whether a valid connection could be made or not. You can
1712
+ * use the second `connectionState` parameter to have different behavior when a connection was
1713
+ * unsuccessful.
1714
+ */
1690
1715
  onConnectEnd?: OnConnectEnd;
1691
1716
  onClickConnectStart?: OnConnectStart;
1692
1717
  onClickConnectEnd?: OnConnectEnd;
1693
- /** This event handler gets called when a flow has finished initializing */
1718
+ /**
1719
+ * The `onInit` callback is called when the viewport is initialized. At this point you can use the
1720
+ * instance to call methods like `fitView` or `zoomTo`.
1721
+ */
1694
1722
  onInit?: OnInit<NodeType, EdgeType>;
1695
1723
  /** This event handler is called while the user is either panning or zooming the viewport. */
1696
1724
  onMove?: OnMove;
1697
- /** This event handler gets called when a user starts to pan or zoom the viewport */
1725
+ /** This event handler is called when the user begins to pan or zoom the viewport. */
1698
1726
  onMoveStart?: OnMoveStart;
1699
- /** This event handler gets called when a user stops panning or zooming the viewport */
1727
+ /**
1728
+ * This event handler is called when panning or zooming viewport movement stops.
1729
+ * If the movement is not user-initiated, the event parameter will be `null`.
1730
+ */
1700
1731
  onMoveEnd?: OnMoveEnd;
1701
- /** This event handler gets called when a user changes group of selected elements in the flow */
1732
+ /** This event handler gets called when a user changes group of selected elements in the flow. */
1702
1733
  onSelectionChange?: OnSelectionChangeFunc<NodeType, EdgeType>;
1703
- /** This event handler gets called when user scroll inside the pane */
1734
+ /** This event handler gets called when user scroll inside the pane. */
1704
1735
  onPaneScroll?: (event?: WheelEvent) => void;
1705
- /** This event handler gets called when user clicks inside the pane */
1736
+ /** This event handler gets called when user clicks inside the pane. */
1706
1737
  onPaneClick?: (event: ReactMouseEvent) => void;
1707
- /** This event handler gets called when user right clicks inside the pane */
1738
+ /** This event handler gets called when user right clicks inside the pane. */
1708
1739
  onPaneContextMenu?: (event: ReactMouseEvent | MouseEvent) => void;
1709
- /** This event handler gets called when mouse enters the pane */
1740
+ /** This event handler gets called when mouse enters the pane. */
1710
1741
  onPaneMouseEnter?: (event: ReactMouseEvent) => void;
1711
- /** This event handler gets called when mouse moves over the pane */
1742
+ /** This event handler gets called when mouse moves over the pane. */
1712
1743
  onPaneMouseMove?: (event: ReactMouseEvent) => void;
1713
- /** This event handler gets called when mouse leaves the pane */
1744
+ /** This event handler gets called when mouse leaves the pane. */
1714
1745
  onPaneMouseLeave?: (event: ReactMouseEvent) => void;
1715
1746
  /**
1716
- * Distance that the mouse can move between mousedown/up that will trigger a click
1747
+ * Distance that the mouse can move between mousedown/up that will trigger a click.
1717
1748
  * @default 0
1718
1749
  */
1719
1750
  paneClickDistance?: number;
1720
1751
  /**
1721
- * Distance that the mouse can move between mousedown/up that will trigger a click
1752
+ * Distance that the mouse can move between mousedown/up that will trigger a click.
1722
1753
  * @default 0
1723
1754
  */
1724
1755
  nodeClickDistance?: number;
1725
- /** This handler gets called before the user deletes nodes or edges and provides a way to abort the deletion by returning false. */
1756
+ /**
1757
+ * This handler is called before nodes or edges are deleted, allowing the deletion to be aborted
1758
+ * by returning `false` or modified by returning updated nodes and edges.
1759
+ */
1726
1760
  onBeforeDelete?: OnBeforeDelete<NodeType, EdgeType>;
1727
1761
  /**
1728
1762
  * Custom node types to be available in a flow.
1729
1763
  *
1730
- * React Flow matches a node's type to a component in the nodeTypes object.
1764
+ * React Flow matches a node's type to a component in the `nodeTypes` object.
1765
+ * @TODO check if @default is correct
1766
+ * @default {
1767
+ * input: InputNode,
1768
+ * default: DefaultNode,
1769
+ * output: OutputNode,
1770
+ * group: GroupNode
1771
+ * }
1731
1772
  * @example
1732
1773
  * import CustomNode from './CustomNode';
1733
1774
  *
@@ -1737,7 +1778,15 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1737
1778
  /**
1738
1779
  * Custom edge types to be available in a flow.
1739
1780
  *
1740
- * React Flow matches an edge's type to a component in the edgeTypes object.
1781
+ * React Flow matches an edge's type to a component in the `edgeTypes` object.
1782
+ * @TODO check if @default is correct
1783
+ * @default {
1784
+ * default: BezierEdge,
1785
+ * straight: StraightEdge,
1786
+ * step: StepEdge,
1787
+ * smoothstep: SmoothStepEdge,
1788
+ * simplebezier: SimpleBezier
1789
+ * }
1741
1790
  * @example
1742
1791
  * import CustomEdge from './CustomEdge';
1743
1792
  *
@@ -1748,91 +1797,110 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1748
1797
  * The type of edge path to use for connection lines.
1749
1798
  *
1750
1799
  * Although created edges can be of any type, React Flow needs to know what type of path to render for the connection line before the edge is created!
1800
+ * @default ConnectionLineType.Bezier
1751
1801
  */
1752
1802
  connectionLineType?: ConnectionLineType;
1753
- /** Styles to be applied to the connection line */
1803
+ /** Styles to be applied to the connection line. */
1754
1804
  connectionLineStyle?: CSSProperties;
1755
- /** React Component to be used as a connection line */
1805
+ /** React Component to be used as a connection line. */
1756
1806
  connectionLineComponent?: ConnectionLineComponent<NodeType>;
1757
- /** Styles to be applied to the container of the connection line */
1807
+ /** Styles to be applied to the container of the connection line. */
1758
1808
  connectionLineContainerStyle?: CSSProperties;
1759
1809
  /**
1760
- * 'strict' connection mode will only allow you to connect source handles to target handles.
1761
- *
1762
- * 'loose' connection mode will allow you to connect handles of any type to one another.
1810
+ * A loose connection mode will allow you to connect handles with differing types, including
1811
+ * source-to-source connections. However, it does not support target-to-target connections. Strict
1812
+ * mode allows only connections between source handles and target handles.
1763
1813
  * @default 'strict'
1764
1814
  */
1765
1815
  connectionMode?: ConnectionMode;
1766
1816
  /**
1767
- * Pressing down this key deletes all selected nodes & edges.
1817
+ * If set, pressing the key or chord will delete any selected nodes and edges. Passing an array
1818
+ * represents multiple keys that can be pressed.
1819
+ *
1820
+ * For example, `["Delete", "Backspace"]` will delete selected elements when either key is pressed.
1768
1821
  * @default 'Backspace'
1769
1822
  */
1770
1823
  deleteKeyCode?: KeyCode | null;
1771
1824
  /**
1772
- * If a key is set, you can pan the viewport while that key is held down even if panOnScroll is set to false.
1825
+ * If set, holding this key will let you click and drag to draw a selection box around multiple
1826
+ * nodes and edges. Passing an array represents multiple keys that can be pressed.
1773
1827
  *
1774
- * By setting this prop to null you can disable this functionality.
1775
- * @default 'Space'
1828
+ * For example, `["Shift", "Meta"]` will allow you to draw a selection box when either key is
1829
+ * pressed.
1830
+ * @default 'Shift'
1776
1831
  */
1777
1832
  selectionKeyCode?: KeyCode | null;
1778
- /** Select multiple elements with a selection box, without pressing down selectionKey */
1833
+ /**
1834
+ * Select multiple elements with a selection box, without pressing down `selectionKey`.
1835
+ * @default false
1836
+ */
1779
1837
  selectionOnDrag?: boolean;
1780
1838
  /**
1781
- * When set to "partial", when the user creates a selection box by click and dragging nodes that are only partially in the box are still selected.
1839
+ * When set to `"partial"`, when the user creates a selection box by click and dragging nodes that
1840
+ * are only partially in the box are still selected.
1782
1841
  * @default 'full'
1783
1842
  */
1784
1843
  selectionMode?: SelectionMode$1;
1785
1844
  /**
1786
- * If a key is set, you can pan the viewport while that key is held down even if panOnScroll is set to false.
1845
+ * If a key is set, you can pan the viewport while that key is held down even if `panOnScroll`
1846
+ * is set to `false`.
1787
1847
  *
1788
- * By setting this prop to null you can disable this functionality.
1848
+ * By setting this prop to `null` you can disable this functionality.
1789
1849
  * @default 'Space'
1790
1850
  */
1791
1851
  panActivationKeyCode?: KeyCode | null;
1792
1852
  /**
1793
1853
  * Pressing down this key you can select multiple elements by clicking.
1794
- * @default 'Meta' for macOS, "Ctrl" for other systems
1854
+ * @default "Meta" for macOS, "Control" for other systems
1795
1855
  */
1796
1856
  multiSelectionKeyCode?: KeyCode | null;
1797
1857
  /**
1798
- * If a key is set, you can zoom the viewport while that key is held down even if panOnScroll is set to false.
1858
+ * If a key is set, you can zoom the viewport while that key is held down even if `panOnScroll`
1859
+ * is set to `false`.
1799
1860
  *
1800
- * By setting this prop to null you can disable this functionality.
1801
- * @default 'Meta' for macOS, "Ctrl" for other systems
1861
+ * By setting this prop to `null` you can disable this functionality.
1862
+ * @default "Meta" for macOS, "Control" for other systems
1802
1863
  *
1803
1864
  */
1804
1865
  zoomActivationKeyCode?: KeyCode | null;
1805
- /** Set this prop to make the flow snap to the grid */
1866
+ /** When enabled, nodes will snap to the grid when dragged. */
1806
1867
  snapToGrid?: boolean;
1807
1868
  /**
1808
- * Grid all nodes will snap to
1869
+ * If `snapToGrid` is enabled, this prop configures the grid that nodes will snap to.
1809
1870
  * @example [20, 20]
1810
1871
  */
1811
1872
  snapGrid?: SnapGrid;
1812
1873
  /**
1813
- * You can enable this optimisation to instruct Svelte Flow to only render nodes and edges that would be visible in the viewport.
1874
+ * You can enable this optimisation to instruct React Flow to only render nodes and edges that would be visible in the viewport.
1814
1875
  *
1815
1876
  * This might improve performance when you have a large number of nodes and edges but also adds an overhead.
1816
1877
  * @default false
1817
1878
  */
1818
1879
  onlyRenderVisibleElements?: boolean;
1819
1880
  /**
1820
- * Controls if all nodes should be draggable
1881
+ * Controls whether all nodes should be draggable or not. Individual nodes can override this
1882
+ * setting by setting their `draggable` prop. If you want to use the mouse handlers on
1883
+ * non-draggable nodes, you need to add the `"nopan"` class to those nodes.
1821
1884
  * @default true
1822
1885
  */
1823
1886
  nodesDraggable?: boolean;
1824
1887
  /**
1825
- * Controls if all nodes should be connectable to each other
1888
+ * Controls whether all nodes should be connectable or not. Individual nodes can override this
1889
+ * setting by setting their `connectable` prop.
1826
1890
  * @default true
1827
1891
  */
1828
1892
  nodesConnectable?: boolean;
1829
1893
  /**
1830
- * Controls if all nodes should be focusable
1894
+ * When `true`, focus between nodes can be cycled with the `Tab` key and selected with the `Enter`
1895
+ * key. This option can be overridden by individual nodes by setting their `focusable` prop.
1831
1896
  * @default true
1832
1897
  */
1833
1898
  nodesFocusable?: boolean;
1834
1899
  /**
1835
- * Defines nodes relative position to its coordinates
1900
+ * The origin of the node to use when placing it in the flow or looking up its `x` and `y`
1901
+ * position. An origin of `[0, 0]` means that a node's top left corner will be placed at the `x`
1902
+ * and `y` position.
1903
+ * @default [0, 0]
1836
1904
  * @example
1837
1905
  * [0, 0] // default, top left
1838
1906
  * [0.5, 0.5] // center
@@ -1840,49 +1908,57 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1840
1908
  */
1841
1909
  nodeOrigin?: NodeOrigin;
1842
1910
  /**
1843
- * Controls if all edges should be focusable
1911
+ * When `true`, focus between edges can be cycled with the `Tab` key and selected with the `Enter`
1912
+ * key. This option can be overridden by individual edges by setting their `focusable` prop.
1844
1913
  * @default true
1845
1914
  */
1846
1915
  edgesFocusable?: boolean;
1847
1916
  /**
1848
- * Controls if all edges should be updateable
1917
+ * Whether edges can be updated once they are created. When both this prop is `true` and an
1918
+ * `onReconnect` handler is provided, the user can drag an existing edge to a new source or
1919
+ * target. Individual edges can override this value with their reconnectable property.
1849
1920
  * @default true
1850
1921
  */
1851
1922
  edgesReconnectable?: boolean;
1852
1923
  /**
1853
- * Controls if all elements should (nodes & edges) be selectable
1924
+ * When `true`, elements (nodes and edges) can be selected by clicking on them. This option can be
1925
+ * overridden by individual elements by setting their `selectable` prop.
1854
1926
  * @default true
1855
1927
  */
1856
1928
  elementsSelectable?: boolean;
1857
1929
  /**
1858
- * If true, nodes get selected on drag
1930
+ * If `true`, nodes get selected on drag.
1859
1931
  * @default true
1860
1932
  */
1861
1933
  selectNodesOnDrag?: boolean;
1862
1934
  /**
1863
- * Enableing this prop allows users to pan the viewport by clicking and dragging.
1935
+ * Enabling this prop allows users to pan the viewport by clicking and dragging.
1864
1936
  *
1865
1937
  * You can also set this prop to an array of numbers to limit which mouse buttons can activate panning.
1938
+ * @default true
1866
1939
  * @example [0, 2] // allows panning with the left and right mouse buttons
1867
1940
  * [0, 1, 2, 3, 4] // allows panning with all mouse buttons
1868
1941
  */
1869
1942
  panOnDrag?: boolean | number[];
1870
1943
  /**
1871
- * Minimum zoom level
1944
+ * Minimum zoom level.
1872
1945
  * @default 0.5
1873
1946
  */
1874
1947
  minZoom?: number;
1875
1948
  /**
1876
- * Maximum zoom level
1949
+ * Maximum zoom level.
1877
1950
  * @default 2
1878
1951
  */
1879
1952
  maxZoom?: number;
1880
- /** Controlled viewport to be used instead of internal one */
1953
+ /**
1954
+ * When you pass a `viewport` prop, it's controlled, and you also need to pass `onViewportChange`
1955
+ * to handle internal changes.
1956
+ */
1881
1957
  viewport?: Viewport;
1882
1958
  /**
1883
- * Sets the initial position and zoom of the viewport.
1884
- *
1885
- * If a default viewport is provided but fitView is enabled, the default viewport will be ignored.
1959
+ * Sets the initial position and zoom of the viewport. If a default viewport is provided but
1960
+ * `fitView` is enabled, the default viewport will be ignored.
1961
+ * @default { x: 0, y: 0, zoom: 1 }
1886
1962
  * @example
1887
1963
  * const initialViewport = {
1888
1964
  * zoom: 0.5,
@@ -1891,13 +1967,14 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1891
1967
  */
1892
1968
  defaultViewport?: Viewport;
1893
1969
  /**
1894
- * Gets called when the viewport changes.
1970
+ * Used when working with a controlled viewport for updating the user viewport state.
1895
1971
  */
1896
1972
  onViewportChange?: (viewport: Viewport) => void;
1897
1973
  /**
1898
- * By default the viewport extends infinitely. You can use this prop to set a boundary.
1974
+ * By default, the viewport extends infinitely. You can use this prop to set a boundary.
1899
1975
  *
1900
1976
  * The first pair of coordinates is the top left boundary and the second pair is the bottom right.
1977
+ * @default [[-∞, -∞], [+∞, +∞]]
1901
1978
  * @example [[-1000, -10000], [1000, 1000]]
1902
1979
  */
1903
1980
  translateExtent?: CoordinateExtent;
@@ -1907,51 +1984,86 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1907
1984
  */
1908
1985
  preventScrolling?: boolean;
1909
1986
  /**
1910
- * By default nodes can be placed on an infinite flow. You can use this prop to set a boundary.
1987
+ * By default, nodes can be placed on an infinite flow. You can use this prop to set a boundary.
1911
1988
  *
1912
1989
  * The first pair of coordinates is the top left boundary and the second pair is the bottom right.
1913
1990
  * @example [[-1000, -10000], [1000, 1000]]
1914
1991
  */
1915
1992
  nodeExtent?: CoordinateExtent;
1916
1993
  /**
1917
- * Color of edge markers
1918
- * @example "#b1b1b7"
1994
+ * Color of edge markers.
1995
+ * @default '#b1b1b7'
1919
1996
  */
1920
1997
  defaultMarkerColor?: string;
1921
- /** Controls if the viewport should zoom by scrolling inside the container */
1998
+ /**
1999
+ * Controls if the viewport should zoom by scrolling inside the container.
2000
+ * @default true
2001
+ */
1922
2002
  zoomOnScroll?: boolean;
1923
- /** Controls if the viewport should zoom by pinching on a touch screen */
2003
+ /**
2004
+ * Controls if the viewport should zoom by pinching on a touch screen.
2005
+ * @default true
2006
+ */
1924
2007
  zoomOnPinch?: boolean;
1925
2008
  /**
1926
- * Controls if the viewport should pan by scrolling inside the container
2009
+ * Controls if the viewport should pan by scrolling inside the container.
1927
2010
  *
1928
- * Can be limited to a specific direction with panOnScrollMode
2011
+ * Can be limited to a specific direction with `panOnScrollMode`.
2012
+ * @default false
1929
2013
  */
1930
2014
  panOnScroll?: boolean;
1931
2015
  /**
1932
2016
  * Controls how fast viewport should be panned on scroll.
1933
2017
  *
1934
- * Use togther with panOnScroll prop.
2018
+ * Use together with `panOnScroll` prop.
2019
+ * @default 0.5
1935
2020
  */
1936
2021
  panOnScrollSpeed?: number;
1937
2022
  /**
1938
- * This prop is used to limit the direction of panning when panOnScroll is enabled.
2023
+ * This prop is used to limit the direction of panning when `panOnScroll` is enabled.
1939
2024
  *
1940
- * The "free" option allows panning in any direction.
2025
+ * The `"free"` option allows panning in any direction.
1941
2026
  * @default "free"
1942
2027
  * @example "horizontal" | "vertical"
1943
2028
  */
1944
2029
  panOnScrollMode?: PanOnScrollMode;
1945
- /** Controls if the viewport should zoom by double clicking somewhere on the flow */
2030
+ /**
2031
+ * Controls if the viewport should zoom by double-clicking somewhere on the flow.
2032
+ * @default true
2033
+ */
1946
2034
  zoomOnDoubleClick?: boolean;
2035
+ /**
2036
+ * The radius around an edge connection that can trigger an edge reconnection.
2037
+ * @default 10
2038
+ */
1947
2039
  reconnectRadius?: number;
2040
+ /**
2041
+ * If a node is draggable, clicking and dragging that node will move it around the canvas. Adding
2042
+ * the `"nodrag"` class prevents this behavior and this prop allows you to change the name of that
2043
+ * class.
2044
+ * @default "nodrag"
2045
+ */
1948
2046
  noDragClassName?: string;
2047
+ /**
2048
+ * Typically, scrolling the mouse wheel when the mouse is over the canvas will zoom the viewport.
2049
+ * Adding the `"nowheel"` class to an element n the canvas will prevent this behavior and this prop
2050
+ * allows you to change the name of that class.
2051
+ * @default "nowheel"
2052
+ */
1949
2053
  noWheelClassName?: string;
2054
+ /**
2055
+ * If an element in the canvas does not stop mouse events from propagating, clicking and dragging
2056
+ * that element will pan the viewport. Adding the `"nopan"` class prevents this behavior and this
2057
+ * prop allows you to change the name of that class.
2058
+ * @default "nopan"
2059
+ */
1950
2060
  noPanClassName?: string;
1951
- /** If set, initial viewport will show all nodes & edges */
2061
+ /** When `true`, the flow will be zoomed and panned to fit all the nodes initially provided. */
1952
2062
  fitView?: boolean;
1953
2063
  /**
1954
- * Options to be used in combination with fitView
2064
+ * When you typically call `fitView` on a `ReactFlowInstance`, you can provide an object of
2065
+ * options to customize its behavior. This prop lets you do the same for the initial `fitView`
2066
+ * call.
1955
2067
  * @example
1956
2068
  * const fitViewOptions = {
1957
2069
  * padding: 0.1,
@@ -1964,15 +2076,18 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1964
2076
  */
1965
2077
  fitViewOptions?: FitViewOptions;
1966
2078
  /**
1967
- *The connectOnClick option lets you click or tap on a source handle to start a connection
2079
+ * The `connectOnClick` option lets you click or tap on a source handle to start a connection
1968
2080
  * and then click on a target handle to complete the connection.
1969
2081
  *
1970
- * If you set this option to false, users will need to drag the connection line to the target
2082
+ * If you set this option to `false`, users will need to drag the connection line to the target
1971
2083
  * handle to create a connection.
2084
+ * @default true
1972
2085
  */
1973
2086
  connectOnClick?: boolean;
1974
2087
  /**
1975
- * Set position of the attribution
2088
+ * By default, React Flow will render a small attribution in the bottom right corner of the flow.
2089
+ *
2090
+ * You can use this prop to change its position in case you want to place something else there.
1976
2091
  * @default 'bottom-right'
1977
2092
  * @example 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
1978
2093
  */
@@ -1992,21 +2107,23 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
1992
2107
  elevateNodesOnSelect?: boolean;
1993
2108
  /**
1994
2109
  * Enabling this option will raise the z-index of edges when they are selected.
1995
- * @default true
1996
2110
  */
1997
2111
  elevateEdgesOnSelect?: boolean;
1998
2112
  /**
1999
- * Can be set true if built-in keyboard controls should be disabled.
2113
+ * You can use this prop to disable keyboard accessibility features such as selecting nodes or
2114
+ * moving selected nodes with the arrow keys.
2000
2115
  * @default false
2001
2116
  */
2002
2117
  disableKeyboardA11y?: boolean;
2003
2118
  /**
2004
- * You can enable this prop to automatically pan the viewport while dragging a node.
2119
+ * When `true`, the viewport will pan automatically when the cursor moves to the edge of the
2120
+ * viewport while dragging a node.
2005
2121
  * @default true
2006
2122
  */
2007
2123
  autoPanOnNodeDrag?: boolean;
2008
2124
  /**
2009
- * You can enable this prop to automatically pan the viewport while dragging a node.
2125
+ * When `true`, the viewport will pan automatically when the cursor moves to the edge of the
2126
+ * viewport while creating a connection.
2010
2127
  * @default true
2011
2128
  */
2012
2129
  autoPanOnConnect?: boolean;
@@ -2016,12 +2133,12 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
2016
2133
  */
2017
2134
  autoPanSpeed?: number;
2018
2135
  /**
2019
- * You can enable this prop to automatically pan the viewport while making a new connection.
2020
- * @default true
2136
+ * The radius around a handle where you drop a connection line to create a new edge.
2137
+ * @default 20
2021
2138
  */
2022
2139
  connectionRadius?: number;
2023
2140
  /**
2024
- * Ocassionally something may happen that causes Svelte Flow to throw an error.
2141
+ * Occasionally something may happen that causes React Flow to throw an error.
2025
2142
  *
2026
2143
  * Instead of exploding your application, we log a message to the console and then call this event handler.
2027
2144
  * You might use it for additional logging or to show a message to the user.
@@ -2030,32 +2147,33 @@ interface ReactFlowProps<NodeType extends Node$1 = Node$1, EdgeType extends Edge
2030
2147
  /**
2031
2148
  * This callback can be used to validate a new connection
2032
2149
  *
2033
- * If you return false, the edge will not be added to your flow.
2034
- * If you have custom connection logic its preferred to use this callback over the isValidConnection prop on the handle component for performance reasons.
2035
- * @default (connection: Connection) => true
2150
+ * If you return `false`, the edge will not be added to your flow.
2151
+ * If you have custom connection logic its preferred to use this callback over the
2152
+ * `isValidConnection` prop on the handle component for performance reasons.
2036
2153
  */
2037
2154
  isValidConnection?: IsValidConnection<EdgeType>;
2038
2155
  /**
2039
- * With a threshold greater than zero you can control the distinction between node drag and click events.
2156
+ * With a threshold greater than zero you can delay node drag events.
2040
2157
  *
2041
2158
  * If threshold equals 1, you need to drag the node 1 pixel before a drag event is fired.
2159
+ *
2160
+ * 1 is the default value, so clicks don't trigger drag events.
2042
2161
  * @default 1
2043
2162
  */
2044
2163
  nodeDragThreshold?: number;
2045
- /** Sets a fixed width for the flow */
2164
+ /** Sets a fixed width for the flow. */
2046
2165
  width?: number;
2047
- /** Sets a fixed height for the flow */
2166
+ /** Sets a fixed height for the flow. */
2048
2167
  height?: number;
2049
2168
  /**
2050
- * Controls color scheme used for styling the flow
2051
- * @default 'system'
2169
+ * Controls color scheme used for styling the flow.
2170
+ * @default 'light'
2052
2171
  * @example 'system' | 'light' | 'dark'
2053
2172
  */
2054
2173
  colorMode?: ColorMode;
2055
2174
  /**
2056
- * If set true, some debug information will be logged to the console like which events are fired.
2057
- *
2058
- * @default undefined
2175
+ * If set `true`, some debug information will be logged to the console like which events are fired.
2176
+ * @default false
2059
2177
  */
2060
2178
  debug?: boolean;
2061
2179
  }
@@ -2792,6 +2910,8 @@ type KeyofBase = keyof any;
2792
2910
  type Get<T, K extends KeyofBase> = Extract<T, {
2793
2911
  [K1 in K]: any;
2794
2912
  }>[K];
2913
+ type HasIndexSignature<T> = string extends keyof T ? true : false;
2914
+ type ValueWithUndefinedForIndexSignatures<Value, Key extends keyof Value> = HasIndexSignature<Value> extends true ? undefined | Value[Key] : Value[Key];
2795
2915
  type WritableStore<Value = any> = (Value extends object ? MapStore<Value> : never) | WritableAtom<Value>;
2796
2916
  type Store<Value = any> = ReadableAtom<Value> | WritableStore<Value>;
2797
2917
  type AnyStore<Value = any> = {
@@ -2850,7 +2970,7 @@ interface MapStore<Value extends object = any> extends WritableAtom<Value> {
2850
2970
  * @param key The key name.
2851
2971
  * @param value New value.
2852
2972
  */
2853
- setKey<Key extends AllKeys<Value>>(key: Key, value: Get<Value, Key> | Value[Key]): void;
2973
+ setKey<Key extends AllKeys<Value>>(key: Key, value: Get<Value, Key> | ValueWithUndefinedForIndexSignatures<Value, Key>): void;
2854
2974
  /**
2855
2975
  * Subscribe to store changes and call listener immediately.
2856
2976
  *