@xyflow/react 12.0.0-next.6 → 12.0.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (71) hide show
  1. package/LICENSE +1 -1
  2. package/dist/esm/additional-components/Background/types.d.ts +13 -0
  3. package/dist/esm/additional-components/Background/types.d.ts.map +1 -1
  4. package/dist/esm/additional-components/Controls/types.d.ts +14 -0
  5. package/dist/esm/additional-components/Controls/types.d.ts.map +1 -1
  6. package/dist/esm/additional-components/MiniMap/types.d.ts +21 -0
  7. package/dist/esm/additional-components/MiniMap/types.d.ts.map +1 -1
  8. package/dist/esm/additional-components/NodeResizer/types.d.ts +25 -0
  9. package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
  10. package/dist/esm/additional-components/NodeToolbar/types.d.ts +10 -0
  11. package/dist/esm/additional-components/NodeToolbar/types.d.ts.map +1 -1
  12. package/dist/esm/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
  13. package/dist/esm/components/Handle/index.d.ts.map +1 -1
  14. package/dist/esm/components/Panel/index.d.ts +3 -0
  15. package/dist/esm/components/Panel/index.d.ts.map +1 -1
  16. package/dist/esm/container/ReactFlow/index.d.ts +3 -3
  17. package/dist/esm/hooks/useNodesEdgesState.d.ts +2 -2
  18. package/dist/esm/hooks/useNodesEdgesState.d.ts.map +1 -1
  19. package/dist/esm/index.d.ts +2 -2
  20. package/dist/esm/index.d.ts.map +1 -1
  21. package/dist/esm/index.js +19 -56
  22. package/dist/esm/index.mjs +19 -56
  23. package/dist/esm/types/changes.d.ts +2 -2
  24. package/dist/esm/types/changes.d.ts.map +1 -1
  25. package/dist/esm/types/component-props.d.ts +339 -1
  26. package/dist/esm/types/component-props.d.ts.map +1 -1
  27. package/dist/esm/types/edges.d.ts +11 -0
  28. package/dist/esm/types/edges.d.ts.map +1 -1
  29. package/dist/esm/types/general.d.ts +5 -3
  30. package/dist/esm/types/general.d.ts.map +1 -1
  31. package/dist/esm/types/instance.d.ts +0 -9
  32. package/dist/esm/types/instance.d.ts.map +1 -1
  33. package/dist/esm/utils/changes.d.ts +3 -3
  34. package/dist/esm/utils/changes.d.ts.map +1 -1
  35. package/dist/esm/utils/general.d.ts +2 -49
  36. package/dist/esm/utils/general.d.ts.map +1 -1
  37. package/dist/umd/additional-components/Background/types.d.ts +13 -0
  38. package/dist/umd/additional-components/Background/types.d.ts.map +1 -1
  39. package/dist/umd/additional-components/Controls/types.d.ts +14 -0
  40. package/dist/umd/additional-components/Controls/types.d.ts.map +1 -1
  41. package/dist/umd/additional-components/MiniMap/types.d.ts +21 -0
  42. package/dist/umd/additional-components/MiniMap/types.d.ts.map +1 -1
  43. package/dist/umd/additional-components/NodeResizer/types.d.ts +25 -0
  44. package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
  45. package/dist/umd/additional-components/NodeToolbar/types.d.ts +10 -0
  46. package/dist/umd/additional-components/NodeToolbar/types.d.ts.map +1 -1
  47. package/dist/umd/components/EdgeWrapper/EdgeUpdateAnchors.d.ts.map +1 -1
  48. package/dist/umd/components/Handle/index.d.ts.map +1 -1
  49. package/dist/umd/components/Panel/index.d.ts +3 -0
  50. package/dist/umd/components/Panel/index.d.ts.map +1 -1
  51. package/dist/umd/container/ReactFlow/index.d.ts +3 -3
  52. package/dist/umd/hooks/useNodesEdgesState.d.ts +2 -2
  53. package/dist/umd/hooks/useNodesEdgesState.d.ts.map +1 -1
  54. package/dist/umd/index.d.ts +2 -2
  55. package/dist/umd/index.d.ts.map +1 -1
  56. package/dist/umd/index.js +2 -2
  57. package/dist/umd/types/changes.d.ts +2 -2
  58. package/dist/umd/types/changes.d.ts.map +1 -1
  59. package/dist/umd/types/component-props.d.ts +339 -1
  60. package/dist/umd/types/component-props.d.ts.map +1 -1
  61. package/dist/umd/types/edges.d.ts +11 -0
  62. package/dist/umd/types/edges.d.ts.map +1 -1
  63. package/dist/umd/types/general.d.ts +5 -3
  64. package/dist/umd/types/general.d.ts.map +1 -1
  65. package/dist/umd/types/instance.d.ts +0 -9
  66. package/dist/umd/types/instance.d.ts.map +1 -1
  67. package/dist/umd/utils/changes.d.ts +3 -3
  68. package/dist/umd/utils/changes.d.ts.map +1 -1
  69. package/dist/umd/utils/general.d.ts +2 -49
  70. package/dist/umd/utils/general.d.ts.map +1 -1
  71. package/package.json +3 -3
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2019-2023 webkid GmbH
3
+ Copyright (c) 2019-2024 webkid GmbH
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -6,15 +6,28 @@ export declare enum BackgroundVariant {
6
6
  }
7
7
  export type BackgroundProps = {
8
8
  id?: string;
9
+ /** Color of the pattern */
9
10
  color?: string;
11
+ /** Color of the background */
10
12
  bgColor?: string;
13
+ /** Class applied to the container */
11
14
  className?: string;
15
+ /** Class applied to the pattern */
12
16
  patternClassName?: string;
17
+ /** Gap between repetitions of the pattern */
13
18
  gap?: number | [number, number];
19
+ /** Size of a single pattern element */
14
20
  size?: number;
21
+ /** Offset of the pattern */
15
22
  offset?: number;
23
+ /** Line width of the Line pattern */
16
24
  lineWidth?: number;
25
+ /** Variant of the pattern
26
+ * @example BackgroundVariant.Lines, BackgroundVariant.Dots, BackgroundVariant.Cross
27
+ * 'lines', 'dots', 'cross'
28
+ */
17
29
  variant?: BackgroundVariant;
30
+ /** Style applied to the container */
18
31
  style?: CSSProperties;
19
32
  };
20
33
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/Background/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/Background/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,oBAAY,iBAAiB;IAC3B,KAAK,UAAU;IACf,IAAI,SAAS;IACb,KAAK,UAAU;CAChB;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B,qCAAqC;IACrC,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC"}
@@ -2,17 +2,31 @@ import type { ButtonHTMLAttributes, ReactNode } from 'react';
2
2
  import type { PanelPosition } from '@xyflow/system';
3
3
  import type { FitViewOptions } from '../../types';
4
4
  export type ControlProps = {
5
+ /** Show button for zoom in/out */
5
6
  showZoom?: boolean;
7
+ /** Show button for fit view */
6
8
  showFitView?: boolean;
9
+ /** Show button for toggling interactivity */
7
10
  showInteractive?: boolean;
11
+ /** Options being used when fit view button is clicked */
8
12
  fitViewOptions?: FitViewOptions;
13
+ /** Callback when zoom in button is clicked */
9
14
  onZoomIn?: () => void;
15
+ /** Callback when zoom out button is clicked */
10
16
  onZoomOut?: () => void;
17
+ /** Callback when fit view button is clicked */
11
18
  onFitView?: () => void;
19
+ /** Callback when interactivity is toggled */
12
20
  onInteractiveChange?: (interactiveStatus: boolean) => void;
21
+ /** Position of the controls on the pane
22
+ * @example PanelPosition.TopLeft, PanelPosition.TopRight,
23
+ * PanelPosition.BottomLeft, PanelPosition.BottomRight
24
+ */
13
25
  position?: PanelPosition;
14
26
  children?: ReactNode;
27
+ /** Style applied to container */
15
28
  style?: React.CSSProperties;
29
+ /** ClassName applied to container */
16
30
  className?: string;
17
31
  'aria-label'?: string;
18
32
  };
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/Controls/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,mBAAmB,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/Controls/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,MAAM,YAAY,GAAG;IACzB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,6CAA6C;IAC7C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yDAAyD;IACzD,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,8CAA8C;IAC9C,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,+CAA+C;IAC/C,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,6CAA6C;IAC7C,mBAAmB,CAAC,EAAE,CAAC,iBAAiB,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3D;;;OAGG;IACH,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,iCAAiC;IACjC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,qCAAqC;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC"}
@@ -3,23 +3,44 @@ import type { PanelPosition, XYPosition } from '@xyflow/system';
3
3
  import type { Node } from '../../types';
4
4
  export type GetMiniMapNodeAttribute<NodeType extends Node = Node> = (node: NodeType) => string;
5
5
  export type MiniMapProps<NodeType extends Node = Node> = Omit<HTMLAttributes<SVGSVGElement>, 'onClick'> & {
6
+ /** Color of nodes on minimap */
6
7
  nodeColor?: string | GetMiniMapNodeAttribute<NodeType>;
8
+ /** Stroke color of nodes on minimap */
7
9
  nodeStrokeColor?: string | GetMiniMapNodeAttribute<NodeType>;
10
+ /** ClassName applied to nodes on minimap */
8
11
  nodeClassName?: string | GetMiniMapNodeAttribute<NodeType>;
12
+ /** Border radius of nodes on minimap */
9
13
  nodeBorderRadius?: number;
14
+ /** Stroke width of nodes on minimap */
10
15
  nodeStrokeWidth?: number;
16
+ /** Component used to render nodes on minimap */
11
17
  nodeComponent?: ComponentType<MiniMapNodeProps>;
18
+ /** Color of mask representing viewport */
12
19
  maskColor?: string;
20
+ /** Stroke color of mask representing viewport */
13
21
  maskStrokeColor?: string;
22
+ /** Stroke width of mask representing viewport */
14
23
  maskStrokeWidth?: number;
24
+ /** Position of minimap on pane
25
+ * @example PanelPosition.TopLeft, PanelPosition.TopRight,
26
+ * PanelPosition.BottomLeft, PanelPosition.BottomRight
27
+ */
15
28
  position?: PanelPosition;
29
+ /** Callback caled when minimap is clicked*/
16
30
  onClick?: (event: MouseEvent, position: XYPosition) => void;
31
+ /** Callback called when node on minimap is clicked */
17
32
  onNodeClick?: (event: MouseEvent, node: NodeType) => void;
33
+ /** If true, viewport is pannable via mini map component */
18
34
  pannable?: boolean;
35
+ /** If true, viewport is zoomable via mini map component */
19
36
  zoomable?: boolean;
37
+ /** The aria-label attribute */
20
38
  ariaLabel?: string | null;
39
+ /** Invert direction when panning the minimap viewport */
21
40
  inversePan?: boolean;
41
+ /** Step size for zooming in/out on minimap */
22
42
  zoomStep?: number;
43
+ /** Offset the viewport on the minmap, acts like a padding */
23
44
  offsetScale?: number;
24
45
  };
25
46
  export type MiniMapNodes<NodeType extends Node = Node> = Pick<MiniMapProps<NodeType>, 'nodeColor' | 'nodeStrokeColor' | 'nodeClassName' | 'nodeBorderRadius' | 'nodeStrokeWidth' | 'nodeComponent'> & {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/MiniMap/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEhE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,uBAAuB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,QAAQ,KAAK,MAAM,CAAC;AAE/F,MAAM,MAAM,YAAY,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,SAAS,CAAC,GAAG;IACxG,SAAS,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IACvD,eAAe,CAAC,EAAE,MAAM,GAAG,uBAAuB,CAAC,QAAQ,CAAC,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G;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACnD,CAAC"}
@@ -1,25 +1,50 @@
1
1
  import type { CSSProperties, ReactNode } from 'react';
2
2
  import type { ControlPosition, ControlLinePosition, ResizeControlVariant, ShouldResize, OnResizeStart, OnResize, OnResizeEnd } from '@xyflow/system';
3
3
  export type NodeResizerProps = {
4
+ /** Id of the node it is resizing
5
+ * @remarks optional if used inside custom node
6
+ */
4
7
  nodeId?: string;
8
+ /** Color of the resize handle */
5
9
  color?: string;
10
+ /** ClassName applied to handle */
6
11
  handleClassName?: string;
12
+ /** Style applied to handle */
7
13
  handleStyle?: CSSProperties;
14
+ /** ClassName applied to line */
8
15
  lineClassName?: string;
16
+ /** Style applied to line */
9
17
  lineStyle?: CSSProperties;
18
+ /** Are the controls visible */
10
19
  isVisible?: boolean;
20
+ /** Minimum width of node */
11
21
  minWidth?: number;
22
+ /** Minimum height of node */
12
23
  minHeight?: number;
24
+ /** Maximum width of node */
13
25
  maxWidth?: number;
26
+ /** Maximum height of node */
14
27
  maxHeight?: number;
28
+ /** Keep aspect ratio when resizing */
15
29
  keepAspectRatio?: boolean;
30
+ /** Callback to determine if node should resize */
16
31
  shouldResize?: ShouldResize;
32
+ /** Callback called when resizing starts */
17
33
  onResizeStart?: OnResizeStart;
34
+ /** Callback called when resizing */
18
35
  onResize?: OnResize;
36
+ /** Callback called when resizing ends */
19
37
  onResizeEnd?: OnResizeEnd;
20
38
  };
21
39
  export type ResizeControlProps = Pick<NodeResizerProps, 'nodeId' | 'color' | 'minWidth' | 'minHeight' | 'maxWidth' | 'maxHeight' | 'keepAspectRatio' | 'shouldResize' | 'onResizeStart' | 'onResize' | 'onResizeEnd'> & {
40
+ /** Position of the control
41
+ * @example ControlPosition.TopLeft, ControlPosition.TopRight,
42
+ * ControlPosition.BottomLeft, ControlPosition.BottomRight
43
+ */
22
44
  position?: ControlPosition;
45
+ /** Variant of the control
46
+ * @example ResizeControlVariant.Handle, ResizeControlVariant.Line
47
+ */
23
48
  variant?: ResizeControlVariant;
24
49
  className?: string;
25
50
  style?: CSSProperties;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/NodeResizer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,IAAI,CACnC,gBAAgB,EACd,QAAQ,GACR,OAAO,GACP,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,iBAAiB,GACjB,cAAc,GACd,eAAe,GACf,UAAU,GACV,aAAa,CAChB,GAAG;IACF,QAAQ,CAAC,EAAE,eAAe,CAAC;IAC3B,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,kBAAkB,GAAG;IACxD,QAAQ,CAAC,EAAE,mBAAmB,CAAC;CAChC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/NodeResizer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EACV,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,8BAA8B;IAC9B,WAAW,CAAC,EAAE,aAAa,CAAC;I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
  export type NodeToolbarProps = HTMLAttributes<HTMLDivElement> & {
4
+ /** Id of the node, or array of ids the toolbar should be displayed at */
4
5
  nodeId?: string | string[];
6
+ /** If true, node toolbar is visible even if node is not selected */
5
7
  isVisible?: boolean;
8
+ /** Position of the toolbar relative to the node
9
+ * @example Position.TopLeft, Position.TopRight,
10
+ * Position.BottomLeft, Position.BottomRight
11
+ */
6
12
  position?: Position;
13
+ /** Offset the toolbar from the node */
7
14
  offset?: number;
15
+ /** Align the toolbar relative to the node
16
+ * @example Align.Start, Align.Center, Align.End
17
+ */
8
18
  align?: Align;
9
19
  };
10
20
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/NodeToolbar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/additional-components/NodeToolbar/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC9D,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC3B,oEAAoE;IACpE,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC;CACf,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EdgeUpdateAnchors.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/EdgeWrapper/EdgeUpdateAnchors.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGhE,KAAK,sBAAsB,GAAG;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC3C,iBAAiB,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACzD,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,YAAY,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC/C,iBAAiB,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACzD,eAAe,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IACrD,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,GAAG,YAAY,CAAC;AAEjB,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,iBAAiB,EACjB,IAAI,EACJ,cAAc,EACd,cAAc,EACd,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,cAAc,GACf,EAAE,sBAAsB,2CAiGxB"}
1
+ {"version":3,"file":"EdgeUpdateAnchors.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/EdgeWrapper/EdgeUpdateAnchors.tsx"],"names":[],"mappings":"AACA,OAAO,EAA6B,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAGhE,KAAK,sBAAsB,GAAG;IAC5B,IAAI,EAAE,IAAI,CAAC;IACX,WAAW,EAAE,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAC3C,iBAAiB,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACzD,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,cAAc,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,YAAY,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAC;IAC/C,iBAAiB,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,CAAC;IACzD,eAAe,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAC;IACrD,cAAc,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,WAAW,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,GAAG,YAAY,CAAC;AAEjB,wBAAgB,iBAAiB,CAAC,EAChC,WAAW,EACX,iBAAiB,EACjB,IAAI,EACJ,cAAc,EACd,cAAc,EACd,OAAO,EACP,OAAO,EACP,OAAO,EACP,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,cAAc,GACf,EAAE,sBAAsB,2CAmGxB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/Handle/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAQ,cAAc,EAA4E,MAAM,OAAO,CAAC;AAGvH,OAAO,EAML,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAOxB,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC;AAoM5F,eAAO,MAAM,MAAM,0LAAwB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/Handle/index.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAQ,cAAc,EAA4E,MAAM,OAAO,CAAC;AAGvH,OAAO,EAOL,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,MAAM,oBAAoB,GAAG,WAAW,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,CAAC;AAuM5F,eAAO,MAAM,MAAM,0LAAwB,CAAC"}
@@ -1,6 +1,9 @@
1
1
  import type { HTMLAttributes, ReactNode } from 'react';
2
2
  import type { PanelPosition } from '@xyflow/system';
3
3
  export type PanelProps = HTMLAttributes<HTMLDivElement> & {
4
+ /** Set position of the panel
5
+ * @example 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'
6
+ */
4
7
  position?: PanelPosition;
5
8
  children: ReactNode;
6
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/Panel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAKpD,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IACxD,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAIF,wBAAgB,KAAK,CAAC,EAAE,QAAqB,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,2CAa/F"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/components/Panel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvD,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,wBAAgB,KAAK,CAAC,EAAE,QAAqB,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,UAAU,2CAa/F"}
@@ -17,7 +17,6 @@ declare const ReactFlow: import("react").ForwardRefExoticComponent<Omit<import("
17
17
  onNodeDrag?: import("../../types").NodeDragHandler | undefined;
18
18
  onNodeDragStop?: import("../../types").NodeDragHandler | undefined;
19
19
  onEdgeClick?: ((event: import("react").MouseEvent<Element, MouseEvent>, edge: import("../../types").Edge<any>) => void) | undefined;
20
- onEdgeUpdate?: import("../../types").OnEdgeUpdateFunc<any> | undefined;
21
20
  onEdgeContextMenu?: import("../../types").EdgeMouseHandler | undefined;
22
21
  onEdgeMouseEnter?: import("../../types").EdgeMouseHandler | undefined;
23
22
  onEdgeMouseMove?: import("../../types").EdgeMouseHandler | undefined;
@@ -25,8 +24,9 @@ declare const ReactFlow: import("react").ForwardRefExoticComponent<Omit<import("
25
24
  onEdgeDoubleClick?: import("../../types").EdgeMouseHandler | undefined;
26
25
  onEdgeUpdateStart?: ((event: import("react").MouseEvent<Element, MouseEvent>, edge: import("../../types").Edge<any>, handleType: import("@xyflow/system").HandleType) => void) | undefined;
27
26
  onEdgeUpdateEnd?: ((event: MouseEvent | TouchEvent, edge: import("../../types").Edge<any>, handleType: import("@xyflow/system").HandleType) => void) | undefined;
28
- onNodesChange?: import("../../types").OnNodesChange | undefined;
29
- onEdgesChange?: import("../../types").OnEdgesChange | undefined;
27
+ onEdgeUpdate?: import("../../types").OnEdgeUpdateFunc<any> | undefined;
28
+ onNodesChange?: import("../../types").OnNodesChange<import("../../types").Node<any, string | undefined>> | undefined;
29
+ onEdgesChange?: import("../../types").OnEdgesChange<import("../../types").Edge<any>> | undefined;
30
30
  onNodesDelete?: import("../../types").OnNodesDelete | undefined;
31
31
  onEdgesDelete?: import("../../types").OnEdgesDelete | undefined;
32
32
  onDelete?: import("../../types").OnDelete | undefined;
@@ -7,7 +7,7 @@ import type { Node, NodeChange, Edge, EdgeChange } from '../types';
7
7
  * @param initialNodes
8
8
  * @returns an array [nodes, setNodes, onNodesChange]
9
9
  */
10
- export declare function useNodesState<NodeType extends Node = Node>(initialNodes: NodeType[]): [NodeType[], Dispatch<SetStateAction<NodeType[]>>, (changes: NodeChange[]) => void];
10
+ export declare function useNodesState<NodeType extends Node = Node>(initialNodes: NodeType[]): [NodeType[], Dispatch<SetStateAction<NodeType[]>>, (changes: NodeChange<NodeType>[]) => void];
11
11
  /**
12
12
  * Hook for managing the state of edges - should only be used for prototyping / simple use cases.
13
13
  *
@@ -15,5 +15,5 @@ export declare function useNodesState<NodeType extends Node = Node>(initialNodes
15
15
  * @param initialEdges
16
16
  * @returns an array [edges, setEdges, onEdgesChange]
17
17
  */
18
- export declare function useEdgesState<EdgeType extends Edge = Edge>(initialEdges: EdgeType[]): [EdgeType[], Dispatch<SetStateAction<EdgeType[]>>, (changes: EdgeChange[]) => void];
18
+ export declare function useEdgesState<EdgeType extends Edge = Edge>(initialEdges: EdgeType[]): [EdgeType[], Dispatch<SetStateAction<EdgeType[]>>, (changes: EdgeChange<EdgeType>[]) => void];
19
19
  //# sourceMappingURL=useNodesEdgesState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useNodesEdgesState.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useNodesEdgesState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGlF,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;;;GAMG;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,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC,CAKrF;AAED;;;;;;GAMG;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,CAAC,OAAO,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC,CAKrF"}
1
+ {"version":3,"file":"useNodesEdgesState.d.ts","sourceRoot":"","sources":["../../../../packages/react/src/hooks/useNodesEdgesState.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAGlF,OAAO,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEnE;;;;;;GAMG;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,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,CAQ/F;AAED;;;;;;GAMG;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,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC,CAQ/F"}
@@ -27,9 +27,9 @@ export { useNodesData } from './hooks/useNodesData';
27
27
  export { useConnection } from './hooks/useConnection';
28
28
  export { useNodeId } from './contexts/NodeIdContext';
29
29
  export { applyNodeChanges, applyEdgeChanges, handleParentExpand } from './utils/changes';
30
- export { isNode, isEdge, getIncomers, getOutgoers, addEdge, updateEdge, getConnectedEdges } from './utils/general';
30
+ export { isNode, isEdge } from './utils/general';
31
31
  export * from './additional-components';
32
32
  export * from './types';
33
33
  export { type SmoothStepPathOptions, type BezierPathOptions, ConnectionLineType, type EdgeMarker, type EdgeMarkerType, MarkerType, type OnMove, type OnMoveStart, type OnMoveEnd, type Connection, type ConnectionStatus, ConnectionMode, type OnConnectStartParams, type OnConnectStart, type OnConnect, type OnConnectEnd, type IsValidConnection, type Viewport, type SnapGrid, PanOnScrollMode, type ViewportHelperFunctionOptions, type SetCenterOptions, type FitBoundsOptions, type PanelPosition, type ProOptions, SelectionMode, type SelectionRect, type OnError, type NodeProps, type NodeOrigin, type OnNodeDrag, type OnSelectionDrag, Position, type XYPosition, type XYZPosition, type Dimensions, type Rect, type Box, type Transform, type CoordinateExtent, type ColorMode, type ColorModeClass, type HandleType, type OnBeforeDelete, type ShouldResize, type OnResizeStart, type OnResize, type OnResizeEnd, type ControlPosition, type ControlLinePosition, type ResizeControlVariant, } from '@xyflow/system';
34
- export { type GetBezierPathParams, getBezierEdgeCenter, getBezierPath, getEdgeCenter, type GetSmoothStepPathParams, getSmoothStepPath, type GetStraightPathParams, getStraightPath, getViewportForBounds, getNodesBounds, internalsSymbol, } from '@xyflow/system';
34
+ export { type GetBezierPathParams, getBezierEdgeCenter, getBezierPath, getEdgeCenter, type GetSmoothStepPathParams, getSmoothStepPath, type GetStraightPathParams, getStraightPath, getViewportForBounds, getNodesBounds, getIncomers, getOutgoers, addEdge, updateEdge, getConnectedEdges, internalsSymbol, } from '@xyflow/system';
35
35
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/react/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC5F,OAAO,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,KAAK,EAAE,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM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AgB,EACrB,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,eAAe,EACf,KAAK,6BAA6B,EAClC,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,UAAU,EACf,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,QAAQ,EACR,KAAK,UAAU,EACf,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,IAAI,EACT,KAAK,GAAG,EACR,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../packages/react/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,MAAM,EAAE,KAAK,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,i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AAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,KAAK,mBAAmB,EACxB,mBAAmB,EACnB,aAAa,EACb,aAAa,EACb,KAAK,uBAAuB,EAC5B,iBAAiB,EACjB,KAAK,qBAAqB,EAC1B,eAAe,EACf,oBAAoB,EACpB,cAAc,EACd,WAAW,EACX,WAAW,EACX,OAAO,EACP,UAAU,EACV,iBAAiB,EACjB,eAAe,GAChB,MAAM,gBAAgB,CAAC"}
package/dist/esm/index.js CHANGED
@@ -2,8 +2,8 @@
2
2
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
3
3
  import { createContext, useContext, useMemo, useEffect, useRef, useState, useCallback, forwardRef, memo } from 'react';
4
4
  import cc from 'classcat';
5
- import { errorMessages, infiniteExtent, isInputDOMNode, fitView, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getOutgoersBase, getIncomersBase, addEdgeBase, updateEdgeBase, getConnectedEdgesBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, XYDrag, snapPosition, calcNextPosition, Position, isMouseEvent, XYHandle, getHostForElement, getNodesBounds, clampPosition, internalsSymbol, getPositionWithOrigin, elementSelectionKeys, isEdgeVisible, MarkerType, createMarkerIds, isNumeric, getBezierEdgeCenter, getSmoothStepPath, getStraightPath, getBezierPath, getEdgePosition, getElevatedEdgeZIndex, getMarkerId, ConnectionMode, ConnectionLineType, updateConnectionLookup, adoptUserProvidedNodes, updateNodeDimensions, updateAbsolutePositions, panBy, isMacOs, areConnectionMapsEqual, handleConnectionChange, getNodePositionWithOrigin, XYMinimap, getBoundsOfRects, ResizeControlVariant, XYResizer, XY_RESIZER_LINE_POSITIONS, XY_RESIZER_HANDLE_POSITIONS, getNodeToolbarTransform } from '@xyflow/system';
6
- export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, SelectionMode, getBezierEdgeCenter, getBezierPath, getEdgeCenter, getNodesBounds, getSmoothStepPath, getStraightPath, getViewportForBounds, internalsSymbol } from '@xyflow/system';
5
+ import { errorMessages, infiniteExtent, isInputDOMNode, fitView, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, XYDrag, snapPosition, calcNextPosition, Position, isMouseEvent, XYHandle, getHostForElement, addEdge, getNodesBounds, clampPosition, internalsSymbol, getPositionWithOrigin, elementSelectionKeys, isEdgeVisible, MarkerType, createMarkerIds, isNumeric, getBezierEdgeCenter, getSmoothStepPath, getStraightPath, getBezierPath, getEdgePosition, getElevatedEdgeZIndex, getMarkerId, ConnectionMode, ConnectionLineType, updateConnectionLookup, adoptUserProvidedNodes, updateNodeDimensions, updateAbsolutePositions, panBy, isMacOs, areConnectionMapsEqual, handleConnectionChange, getNodePositionWithOrigin, XYMinimap, getBoundsOfRects, ResizeControlVariant, XYResizer, XY_RESIZER_LINE_POSITIONS, XY_RESIZER_HANDLE_POSITIONS, getNodeToolbarTransform } from '@xyflow/system';
6
+ export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, SelectionMode, addEdge, getBezierEdgeCenter, getBezierPath, getConnectedEdges, getEdgeCenter, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds, internalsSymbol, updateEdge } from '@xyflow/system';
7
7
  import { useStoreWithEqualityFn, createWithEqualityFn } from 'zustand/traditional';
8
8
  import { shallow } from 'zustand/shallow';
9
9
  import { createPortal } from 'react-dom';
@@ -424,8 +424,8 @@ const useViewportHelper = () => {
424
424
  const viewport = getViewportForBounds(bounds, width, height, minZoom, maxZoom, options?.padding ?? 0.1);
425
425
  panZoom?.setViewport(viewport, { duration: options?.duration });
426
426
  },
427
- screenToFlowPosition: (position) => {
428
- const { transform, snapToGrid, snapGrid, domNode } = store.getState();
427
+ screenToFlowPosition: (position, options = { snapToGrid: true }) => {
428
+ const { transform, snapGrid, domNode } = store.getState();
429
429
  if (!domNode) {
430
430
  return position;
431
431
  }
@@ -434,7 +434,7 @@ const useViewportHelper = () => {
434
434
  x: position.x - domX,
435
435
  y: position.y - domY,
436
436
  };
437
- return pointToRendererPoint(correctedPosition, transform, snapToGrid, snapGrid || [1, 1]);
437
+ return pointToRendererPoint(correctedPosition, transform, options.snapToGrid, snapGrid);
438
438
  },
439
439
  flowToScreenPosition: (position) => {
440
440
  const { transform, domNode } = store.getState();
@@ -688,7 +688,7 @@ function getElementsDiffChanges({ items = [], lookup, }) {
688
688
  * @param element - The element to test
689
689
  * @returns A boolean indicating whether the element is an Node
690
690
  */
691
- const isNode = (isNodeBase);
691
+ const isNode = (element) => isNodeBase(element);
692
692
  /**
693
693
  * Test whether an object is useable as an Edge
694
694
  * @public
@@ -696,50 +696,7 @@ const isNode = (isNodeBase);
696
696
  * @param element - The element to test
697
697
  * @returns A boolean indicating whether the element is an Edge
698
698
  */
699
- const isEdge = (isEdgeBase);
700
- /**
701
- * Pass in a node, and get connected nodes where edge.source === node.id
702
- * @public
703
- * @param node - The node to get the connected nodes from
704
- * @param nodes - The array of all nodes
705
- * @param edges - The array of all edges
706
- * @returns An array of nodes that are connected over eges where the source is the given node
707
- */
708
- const getOutgoers = (getOutgoersBase);
709
- /**
710
- * Pass in a node, and get connected nodes where edge.target === node.id
711
- * @public
712
- * @param node - The node to get the connected nodes from
713
- * @param nodes - The array of all nodes
714
- * @param edges - The array of all edges
715
- * @returns An array of nodes that are connected over eges where the target is the given node
716
- */
717
- const getIncomers = (getIncomersBase);
718
- /**
719
- * This util is a convenience function to add a new Edge to an array of edges
720
- * @remarks It also performs some validation to make sure you don't add an invalid edge or duplicate an existing one.
721
- * @public
722
- * @param edgeParams - Either an Edge or a Connection you want to add
723
- * @param edges - The array of all current edges
724
- * @returns A new array of edges with the new edge added
725
- */
726
- const addEdge = (addEdgeBase);
727
- /**
728
- * A handy utility to update an existing Edge with new properties
729
- * @param oldEdge - The edge you want to update
730
- * @param newConnection - The new connection you want to update the edge with
731
- * @param edges - The array of all current edges
732
- * @param options.shouldReplaceId - should the id of the old edge be replaced with the new connection id
733
- * @returns the updated edges array
734
- */
735
- const updateEdge = (updateEdgeBase);
736
- /**
737
- * Get all connecting edges for a given set of nodes
738
- * @param nodes - Nodes you want to get the connected edges for
739
- * @param edges - All edges
740
- * @returns Array of edges that connect any of the given nodes with each other
741
- */
742
- const getConnectedEdges = (getConnectedEdgesBase);
699
+ const isEdge = (element) => isEdgeBase(element);
743
700
 
744
701
  /**
745
702
  * Hook for accessing the ReactFlow instance.
@@ -883,6 +840,9 @@ function useReactFlow() {
883
840
  const getNodeRect = useCallback((nodeOrRect) => {
884
841
  const isRect = isRectObject(nodeOrRect);
885
842
  const node = isRect ? null : store.getState().nodeLookup.get(nodeOrRect.id);
843
+ if (!isRect && !node) {
844
+ return [null, null, isRect];
845
+ }
886
846
  const nodeRect = isRect ? nodeOrRect : nodeToRect(node);
887
847
  return [nodeRect, node, isRect];
888
848
  }, []);
@@ -1387,9 +1347,9 @@ const useNodeId = () => {
1387
1347
  };
1388
1348
 
1389
1349
  const selector$i = (s) => ({
1390
- connectionStartHandle: s.connectionStartHandle,
1391
1350
  connectOnClick: s.connectOnClick,
1392
1351
  noPanClassName: s.noPanClassName,
1352
+ rfId: s.rfId,
1393
1353
  });
1394
1354
  const connectingSelector = (nodeId, handleId, type) => (state) => {
1395
1355
  const { connectionStartHandle: startHandle, connectionEndHandle: endHandle, connectionClickStartHandle: clickHandle, } = state;
@@ -1404,7 +1364,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
1404
1364
  const isTarget = type === 'target';
1405
1365
  const store = useStoreApi();
1406
1366
  const nodeId = useNodeId();
1407
- const { connectOnClick, noPanClassName } = useStore(selector$i, shallow);
1367
+ const { connectOnClick, noPanClassName, rfId } = useStore(selector$i, shallow);
1408
1368
  const { connecting, clickConnecting } = useStore(connectingSelector(nodeId, handleId, type), shallow);
1409
1369
  if (!nodeId) {
1410
1370
  store.getState().onError?.('010', errorMessages['error010']());
@@ -1440,6 +1400,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
1440
1400
  isTarget,
1441
1401
  handleId,
1442
1402
  nodeId,
1403
+ flowId: currentStore.rfId,
1443
1404
  panBy: currentStore.panBy,
1444
1405
  cancelConnection: currentStore.cancelConnection,
1445
1406
  onConnectStart: currentStore.onConnectStart,
@@ -1458,7 +1419,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
1458
1419
  }
1459
1420
  };
1460
1421
  const onClick = (event) => {
1461
- const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, connectionMode, isValidConnection: isValidConnectionStore, lib, } = store.getState();
1422
+ const { onClickConnectStart, onClickConnectEnd, connectionClickStartHandle, connectionMode, isValidConnection: isValidConnectionStore, lib, rfId: flowId, } = store.getState();
1462
1423
  if (!nodeId || (!connectionClickStartHandle && !isConnectableStart)) {
1463
1424
  return;
1464
1425
  }
@@ -1480,6 +1441,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
1480
1441
  fromHandleId: connectionClickStartHandle.handleId || null,
1481
1442
  fromType: connectionClickStartHandle.type,
1482
1443
  isValidConnection: isValidConnectionHandler,
1444
+ flowId,
1483
1445
  doc,
1484
1446
  lib,
1485
1447
  });
@@ -1489,7 +1451,7 @@ const HandleComponent = forwardRef(({ type = 'source', position = Position.Top,
1489
1451
  onClickConnectEnd?.(event);
1490
1452
  store.setState({ connectionClickStartHandle: null });
1491
1453
  };
1492
- return (jsx("div", { "data-handleid": handleId, "data-nodeid": nodeId, "data-handlepos": position, "data-id": `${nodeId}-${handleId}-${type}`, className: cc([
1454
+ return (jsx("div", { "data-handleid": handleId, "data-nodeid": nodeId, "data-handlepos": position, "data-id": `${rfId}-${nodeId}-${handleId}-${type}`, className: cc([
1493
1455
  'react-flow__handle',
1494
1456
  `react-flow__handle-${position}`,
1495
1457
  'nodrag',
@@ -2137,7 +2099,7 @@ function EdgeUpdateAnchors({ isUpdatable, edgeUpdaterRadius, edge, targetHandleI
2137
2099
  if (event.button !== 0) {
2138
2100
  return;
2139
2101
  }
2140
- const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib, onConnectStart, onConnectEnd, cancelConnection, nodes, panBy, updateConnection, } = store.getState();
2102
+ const { autoPanOnConnect, domNode, isValidConnection, connectionMode, connectionRadius, lib, onConnectStart, onConnectEnd, cancelConnection, nodes, rfId: flowId, panBy, updateConnection, } = store.getState();
2141
2103
  const nodeId = isSourceHandle ? edge.target : edge.source;
2142
2104
  const handleId = (isSourceHandle ? targetHandleId : sourceHandleId) || null;
2143
2105
  const handleType = isSourceHandle ? 'target' : 'source';
@@ -2160,6 +2122,7 @@ function EdgeUpdateAnchors({ isUpdatable, edgeUpdaterRadius, edge, targetHandleI
2160
2122
  isTarget,
2161
2123
  edgeUpdaterType: handleType,
2162
2124
  lib,
2125
+ flowId,
2163
2126
  cancelConnection,
2164
2127
  panBy,
2165
2128
  isValidConnection,
@@ -3498,4 +3461,4 @@ function NodeToolbar({ nodeId, children, className, style, isVisible, position =
3498
3461
  return (jsx(NodeToolbarPortal, { children: jsx("div", { style: wrapperStyle, className: cc(['react-flow__node-toolbar', className]), ...rest, "data-id": nodes.reduce((acc, node) => `${acc}${node.id} `, '').trim(), children: children }) }));
3499
3462
  }
3500
3463
 
3501
- export { Background, BackgroundVariant, BaseEdge, BezierEdge, ControlButton, Controls, EdgeLabelRenderer, EdgeText, Handle, MiniMap, NodeResizeControl, NodeResizer, NodeToolbar, Panel, ReactFlow, ReactFlowProvider, SimpleBezierEdge, SmoothStepEdge, StepEdge, StraightEdge, ViewportPortal, addEdge, applyEdgeChanges, applyNodeChanges, getConnectedEdges, getIncomers, getOutgoers, getSimpleBezierPath, handleParentExpand, isEdge, isNode, updateEdge, useConnection, useEdges, useEdgesState, useHandleConnections, useKeyPress, useNodeId, useNodes, useNodesData, useNodesInitialized, useNodesState, useOnSelectionChange, useOnViewportChange, useReactFlow, useStore, useStoreApi, useUpdateNodeInternals, useViewport };
3464
+ export { Background, BackgroundVariant, BaseEdge, BezierEdge, ControlButton, Controls, EdgeLabelRenderer, EdgeText, Handle, MiniMap, NodeResizeControl, NodeResizer, NodeToolbar, Panel, ReactFlow, ReactFlowProvider, SimpleBezierEdge, SmoothStepEdge, StepEdge, StraightEdge, ViewportPortal, applyEdgeChanges, applyNodeChanges, getSimpleBezierPath, handleParentExpand, isEdge, isNode, useConnection, useEdges, useEdgesState, useHandleConnections, useKeyPress, useNodeId, useNodes, useNodesData, useNodesInitialized, useNodesState, useOnSelectionChange, useOnViewportChange, useReactFlow, useStore, useStoreApi, useUpdateNodeInternals, useViewport };