@xyflow/react 12.6.4 → 12.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.css +3 -3
- package/dist/esm/additional-components/Controls/Controls.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/esm/additional-components/MiniMap/types.d.ts +1 -1
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts +1 -1
- package/dist/esm/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/NodeResizer.d.ts +1 -1
- package/dist/esm/additional-components/NodeResizer/NodeResizer.d.ts.map +1 -1
- package/dist/esm/additional-components/NodeResizer/types.d.ts +6 -1
- package/dist/esm/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/esm/components/A11yDescriptions/index.d.ts.map +1 -1
- package/dist/esm/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/esm/components/NodeWrapper/index.d.ts.map +1 -1
- package/dist/esm/components/StoreUpdater/index.d.ts +1 -1
- package/dist/esm/components/StoreUpdater/index.d.ts.map +1 -1
- package/dist/esm/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/esm/hooks/useViewportHelper.d.ts.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +85 -40
- package/dist/esm/index.mjs +85 -40
- package/dist/esm/store/index.d.ts.map +1 -1
- package/dist/esm/store/initialState.d.ts.map +1 -1
- package/dist/esm/types/component-props.d.ts +11 -1
- package/dist/esm/types/component-props.d.ts.map +1 -1
- package/dist/esm/types/edges.d.ts +10 -1
- package/dist/esm/types/edges.d.ts.map +1 -1
- package/dist/esm/types/general.d.ts +5 -0
- package/dist/esm/types/general.d.ts.map +1 -1
- package/dist/esm/types/nodes.d.ts +11 -2
- package/dist/esm/types/nodes.d.ts.map +1 -1
- package/dist/esm/types/store.d.ts +4 -1
- package/dist/esm/types/store.d.ts.map +1 -1
- package/dist/style.css +3 -3
- package/dist/umd/additional-components/Controls/Controls.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/MiniMap.d.ts.map +1 -1
- package/dist/umd/additional-components/MiniMap/types.d.ts +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizeControl.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizer.d.ts +1 -1
- package/dist/umd/additional-components/NodeResizer/NodeResizer.d.ts.map +1 -1
- package/dist/umd/additional-components/NodeResizer/types.d.ts +6 -1
- package/dist/umd/additional-components/NodeResizer/types.d.ts.map +1 -1
- package/dist/umd/components/A11yDescriptions/index.d.ts.map +1 -1
- package/dist/umd/components/EdgeWrapper/index.d.ts.map +1 -1
- package/dist/umd/components/NodeWrapper/index.d.ts.map +1 -1
- package/dist/umd/components/StoreUpdater/index.d.ts +1 -1
- package/dist/umd/components/StoreUpdater/index.d.ts.map +1 -1
- package/dist/umd/container/ReactFlow/index.d.ts.map +1 -1
- package/dist/umd/hooks/useViewportHelper.d.ts.map +1 -1
- package/dist/umd/index.d.ts +1 -1
- package/dist/umd/index.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/store/initialState.d.ts.map +1 -1
- package/dist/umd/types/component-props.d.ts +11 -1
- package/dist/umd/types/component-props.d.ts.map +1 -1
- package/dist/umd/types/edges.d.ts +10 -1
- package/dist/umd/types/edges.d.ts.map +1 -1
- package/dist/umd/types/general.d.ts +5 -0
- package/dist/umd/types/general.d.ts.map +1 -1
- package/dist/umd/types/nodes.d.ts +11 -2
- package/dist/umd/types/nodes.d.ts.map +1 -1
- package/dist/umd/types/store.d.ts +4 -1
- package/dist/umd/types/store.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/esm/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { createContext, useContext, useMemo, forwardRef, useEffect, useRef, useState, useLayoutEffect, useCallback, memo } from 'react';
|
|
4
4
|
import cc from 'classcat';
|
|
5
|
-
import { errorMessages, infiniteExtent, isInputDOMNode, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getNodesBounds, withResolvers, evaluateAbsolutePosition, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, areSetsEqual, XYDrag, snapPosition, calculateNodePosition, Position, ConnectionMode, isMouseEvent, XYHandle, getHostForElement, addEdge, getInternalNodesBounds, isNumeric, nodeHasDimensions, getNodeDimensions, elementSelectionKeys, isEdgeVisible, MarkerType, createMarkerIds, getBezierEdgeCenter, getSmoothStepPath, getStraightPath, getBezierPath, getEdgePosition, getElevatedEdgeZIndex, getMarkerId, getConnectionStatus, ConnectionLineType, updateConnectionLookup, adoptUserNodes, initialConnection, devWarn, updateNodeInternals, updateAbsolutePositions, handleExpandParent, panBy, fitViewport, isMacOs, areConnectionMapsEqual, handleConnectionChange, shallowNodeData, XYMinimap, getBoundsOfRects, ResizeControlVariant, XYResizer, XY_RESIZER_LINE_POSITIONS, XY_RESIZER_HANDLE_POSITIONS, getNodeToolbarTransform } from '@xyflow/system';
|
|
5
|
+
import { errorMessages, mergeAriaLabelConfig, infiniteExtent, isInputDOMNode, getViewportForBounds, pointToRendererPoint, rendererPointToPoint, isNodeBase, isEdgeBase, getElementsToRemove, isRectObject, nodeToRect, getOverlappingArea, getNodesBounds, withResolvers, evaluateAbsolutePosition, getDimensions, XYPanZoom, PanOnScrollMode, SelectionMode, getEventPosition, getNodesInside, areSetsEqual, XYDrag, snapPosition, calculateNodePosition, Position, ConnectionMode, isMouseEvent, XYHandle, getHostForElement, addEdge, getInternalNodesBounds, isNumeric, nodeHasDimensions, getNodeDimensions, elementSelectionKeys, isEdgeVisible, MarkerType, createMarkerIds, getBezierEdgeCenter, getSmoothStepPath, getStraightPath, getBezierPath, getEdgePosition, getElevatedEdgeZIndex, getMarkerId, getConnectionStatus, ConnectionLineType, updateConnectionLookup, adoptUserNodes, initialConnection, devWarn, defaultAriaLabelConfig, updateNodeInternals, updateAbsolutePositions, handleExpandParent, panBy, fitViewport, isMacOs, areConnectionMapsEqual, handleConnectionChange, shallowNodeData, XYMinimap, getBoundsOfRects, ResizeControlVariant, XYResizer, XY_RESIZER_LINE_POSITIONS, XY_RESIZER_HANDLE_POSITIONS, getNodeToolbarTransform } from '@xyflow/system';
|
|
6
6
|
export { ConnectionLineType, ConnectionMode, MarkerType, PanOnScrollMode, Position, ResizeControlVariant, SelectionMode, addEdge, getBezierEdgeCenter, getBezierPath, getConnectedEdges, getEdgeCenter, getIncomers, getNodesBounds, getOutgoers, getSmoothStepPath, getStraightPath, getViewportForBounds, reconnectEdge } from '@xyflow/system';
|
|
7
7
|
import { useStoreWithEqualityFn, createWithEqualityFn } from 'zustand/traditional';
|
|
8
8
|
import { shallow } from 'zustand/shallow';
|
|
@@ -82,13 +82,17 @@ const ariaLiveStyle = {
|
|
|
82
82
|
const ARIA_NODE_DESC_KEY = 'react-flow__node-desc';
|
|
83
83
|
const ARIA_EDGE_DESC_KEY = 'react-flow__edge-desc';
|
|
84
84
|
const ARIA_LIVE_MESSAGE = 'react-flow__aria-live';
|
|
85
|
-
const
|
|
85
|
+
const ariaLiveSelector = (s) => s.ariaLiveMessage;
|
|
86
|
+
const ariaLabelConfigSelector = (s) => s.ariaLabelConfig;
|
|
86
87
|
function AriaLiveMessage({ rfId }) {
|
|
87
|
-
const ariaLiveMessage = useStore(
|
|
88
|
+
const ariaLiveMessage = useStore(ariaLiveSelector);
|
|
88
89
|
return (jsx("div", { id: `${ARIA_LIVE_MESSAGE}-${rfId}`, "aria-live": "assertive", "aria-atomic": "true", style: ariaLiveStyle, children: ariaLiveMessage }));
|
|
89
90
|
}
|
|
90
91
|
function A11yDescriptions({ rfId, disableKeyboardA11y }) {
|
|
91
|
-
|
|
92
|
+
const ariaLabelConfig = useStore(ariaLabelConfigSelector);
|
|
93
|
+
return (jsxs(Fragment, { children: [jsx("div", { id: `${ARIA_NODE_DESC_KEY}-${rfId}`, style: style, children: disableKeyboardA11y
|
|
94
|
+
? ariaLabelConfig['node.a11yDescription.default']
|
|
95
|
+
: ariaLabelConfig['node.a11yDescription.keyboardDisabled'] }), jsx("div", { id: `${ARIA_EDGE_DESC_KEY}-${rfId}`, style: style, children: ariaLabelConfig['edge.a11yDescription.default'] }), !disableKeyboardA11y && jsx(AriaLiveMessage, { rfId: rfId })] }));
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
const selector$n = (s) => (s.userSelectionActive ? 'none' : 'all');
|
|
@@ -190,6 +194,7 @@ const reactFlowFieldsToTrack = [
|
|
|
190
194
|
'onClickConnectStart',
|
|
191
195
|
'onClickConnectEnd',
|
|
192
196
|
'nodesDraggable',
|
|
197
|
+
'autoPanOnNodeFocus',
|
|
193
198
|
'nodesConnectable',
|
|
194
199
|
'nodesFocusable',
|
|
195
200
|
'edgesFocusable',
|
|
@@ -235,6 +240,7 @@ const reactFlowFieldsToTrack = [
|
|
|
235
240
|
'debug',
|
|
236
241
|
'autoPanSpeed',
|
|
237
242
|
'paneClickDistance',
|
|
243
|
+
'ariaLabelConfig',
|
|
238
244
|
];
|
|
239
245
|
// rfId doesn't exist in ReactFlowProps, but it's one of the fields we want to update
|
|
240
246
|
const fieldsToTrack = [...reactFlowFieldsToTrack, 'rfId'];
|
|
@@ -304,6 +310,9 @@ function StoreUpdater(props) {
|
|
|
304
310
|
store.setState({ fitViewQueued: fieldValue });
|
|
305
311
|
else if (fieldName === 'fitViewOptions')
|
|
306
312
|
store.setState({ fitViewOptions: fieldValue });
|
|
313
|
+
if (fieldName === 'ariaLabelConfig') {
|
|
314
|
+
store.setState({ ariaLabelConfig: mergeAriaLabelConfig(fieldValue) });
|
|
315
|
+
}
|
|
307
316
|
// General case
|
|
308
317
|
else
|
|
309
318
|
store.setState({ [fieldName]: fieldValue });
|
|
@@ -519,7 +528,7 @@ const useViewportHelper = () => {
|
|
|
519
528
|
x: viewport.x ?? tX,
|
|
520
529
|
y: viewport.y ?? tY,
|
|
521
530
|
zoom: viewport.zoom ?? tZoom,
|
|
522
|
-
},
|
|
531
|
+
}, options);
|
|
523
532
|
return Promise.resolve(true);
|
|
524
533
|
},
|
|
525
534
|
getViewport: () => {
|
|
@@ -527,19 +536,7 @@ const useViewportHelper = () => {
|
|
|
527
536
|
return { x, y, zoom };
|
|
528
537
|
},
|
|
529
538
|
setCenter: async (x, y, options) => {
|
|
530
|
-
|
|
531
|
-
const nextZoom = typeof options?.zoom !== 'undefined' ? options.zoom : maxZoom;
|
|
532
|
-
const centerX = width / 2 - x * nextZoom;
|
|
533
|
-
const centerY = height / 2 - y * nextZoom;
|
|
534
|
-
if (!panZoom) {
|
|
535
|
-
return Promise.resolve(false);
|
|
536
|
-
}
|
|
537
|
-
await panZoom.setViewport({
|
|
538
|
-
x: centerX,
|
|
539
|
-
y: centerY,
|
|
540
|
-
zoom: nextZoom,
|
|
541
|
-
}, { duration: options?.duration });
|
|
542
|
-
return Promise.resolve(true);
|
|
539
|
+
return store.getState().setCenter(x, y, options);
|
|
543
540
|
},
|
|
544
541
|
fitBounds: async (bounds, options) => {
|
|
545
542
|
const { width, height, minZoom, maxZoom, panZoom } = store.getState();
|
|
@@ -547,7 +544,11 @@ const useViewportHelper = () => {
|
|
|
547
544
|
if (!panZoom) {
|
|
548
545
|
return Promise.resolve(false);
|
|
549
546
|
}
|
|
550
|
-
await panZoom.setViewport(viewport, {
|
|
547
|
+
await panZoom.setViewport(viewport, {
|
|
548
|
+
duration: options?.duration,
|
|
549
|
+
ease: options?.ease,
|
|
550
|
+
interpolate: options?.interpolate,
|
|
551
|
+
});
|
|
551
552
|
return Promise.resolve(true);
|
|
552
553
|
},
|
|
553
554
|
screenToFlowPosition: (clientPosition, options = {}) => {
|
|
@@ -2152,10 +2153,13 @@ function NodeWrapper({ id, onClick, onMouseEnter, onMouseMove, onMouseLeave, onC
|
|
|
2152
2153
|
else if (isDraggable && node.selected && Object.prototype.hasOwnProperty.call(arrowKeyDiffs, event.key)) {
|
|
2153
2154
|
// prevent default scrolling behavior on arrow key press when node is moved
|
|
2154
2155
|
event.preventDefault();
|
|
2156
|
+
const { ariaLabelConfig } = store.getState();
|
|
2155
2157
|
store.setState({
|
|
2156
|
-
ariaLiveMessage:
|
|
2157
|
-
.replace('Arrow', '')
|
|
2158
|
-
|
|
2158
|
+
ariaLiveMessage: ariaLabelConfig['node.a11yDescription.ariaLiveMessage']({
|
|
2159
|
+
direction: event.key.replace('Arrow', '').toLowerCase(),
|
|
2160
|
+
x: ~~internals.positionAbsolute.x,
|
|
2161
|
+
y: ~~internals.positionAbsolute.y,
|
|
2162
|
+
}),
|
|
2159
2163
|
});
|
|
2160
2164
|
moveSelectedNodes({
|
|
2161
2165
|
direction: arrowKeyDiffs[event.key],
|
|
@@ -2163,6 +2167,21 @@ function NodeWrapper({ id, onClick, onMouseEnter, onMouseMove, onMouseLeave, onC
|
|
|
2163
2167
|
});
|
|
2164
2168
|
}
|
|
2165
2169
|
};
|
|
2170
|
+
const onFocus = () => {
|
|
2171
|
+
if (disableKeyboardA11y || !nodeRef.current?.matches(':focus-visible')) {
|
|
2172
|
+
return;
|
|
2173
|
+
}
|
|
2174
|
+
const { transform, width, height, autoPanOnNodeFocus, setCenter } = store.getState();
|
|
2175
|
+
if (!autoPanOnNodeFocus) {
|
|
2176
|
+
return;
|
|
2177
|
+
}
|
|
2178
|
+
const withinViewport = getNodesInside(new Map([[id, node]]), { x: 0, y: 0, width, height }, transform, true).length > 0;
|
|
2179
|
+
if (!withinViewport) {
|
|
2180
|
+
setCenter(node.position.x + nodeDimensions.width / 2, node.position.y + nodeDimensions.height / 2, {
|
|
2181
|
+
zoom: transform[2],
|
|
2182
|
+
});
|
|
2183
|
+
}
|
|
2184
|
+
};
|
|
2166
2185
|
return (jsx("div", { className: cc([
|
|
2167
2186
|
'react-flow__node',
|
|
2168
2187
|
`react-flow__node-${nodeType}`,
|
|
@@ -2185,7 +2204,7 @@ function NodeWrapper({ id, onClick, onMouseEnter, onMouseMove, onMouseLeave, onC
|
|
|
2185
2204
|
visibility: hasDimensions ? 'visible' : 'hidden',
|
|
2186
2205
|
...node.style,
|
|
2187
2206
|
...inlineDimensions,
|
|
2188
|
-
}, "data-id": id, "data-testid": `rf__node-${id}`, onMouseEnter: onMouseEnterHandler, onMouseMove: onMouseMoveHandler, onMouseLeave: onMouseLeaveHandler, onContextMenu: onContextMenuHandler, onClick: onSelectNodeHandler, onDoubleClick: onDoubleClickHandler, onKeyDown: isFocusable ? onKeyDown : undefined, tabIndex: isFocusable ? 0 : undefined, role: isFocusable ? '
|
|
2207
|
+
}, "data-id": id, "data-testid": `rf__node-${id}`, onMouseEnter: onMouseEnterHandler, onMouseMove: onMouseMoveHandler, onMouseLeave: onMouseLeaveHandler, onContextMenu: onContextMenuHandler, onClick: onSelectNodeHandler, onDoubleClick: onDoubleClickHandler, onKeyDown: isFocusable ? onKeyDown : undefined, tabIndex: isFocusable ? 0 : undefined, onFocus: isFocusable ? onFocus : undefined, role: node.ariaRole ?? (isFocusable ? 'group' : undefined), "aria-roledescription": "node", "aria-describedby": disableKeyboardA11y ? undefined : `${ARIA_NODE_DESC_KEY}-${rfId}`, "aria-label": node.ariaLabel, ...node.domAttributes, children: jsx(Provider, { value: id, children: jsx(NodeComponent, { id: id, data: node.data, type: nodeType, positionAbsoluteX: internals.positionAbsolute.x, positionAbsoluteY: internals.positionAbsolute.y, selected: node.selected ?? false, selectable: isSelectable, draggable: isDraggable, deletable: node.deletable ?? true, isConnectable: isConnectable, sourcePosition: node.sourcePosition, targetPosition: node.targetPosition, dragging: dragging, dragHandle: node.dragHandle, zIndex: internals.z, parentId: node.parentId, ...nodeDimensions }) }) }));
|
|
2189
2208
|
}
|
|
2190
2209
|
|
|
2191
2210
|
const selector$b = (s) => ({
|
|
@@ -2856,7 +2875,7 @@ function EdgeWrapper({ id, edgesFocusable, edgesReconnectable, elementsSelectabl
|
|
|
2856
2875
|
updating: updateHover,
|
|
2857
2876
|
selectable: isSelectable,
|
|
2858
2877
|
},
|
|
2859
|
-
]), onClick: onEdgeClick, onDoubleClick: onEdgeDoubleClick, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onKeyDown: isFocusable ? onKeyDown : undefined, tabIndex: isFocusable ? 0 : undefined, role: isFocusable ? '
|
|
2878
|
+
]), onClick: onEdgeClick, onDoubleClick: onEdgeDoubleClick, onContextMenu: onEdgeContextMenu, onMouseEnter: onEdgeMouseEnter, onMouseMove: onEdgeMouseMove, onMouseLeave: onEdgeMouseLeave, onKeyDown: isFocusable ? onKeyDown : undefined, tabIndex: isFocusable ? 0 : undefined, role: edge.ariaRole ?? (isFocusable ? 'group' : 'img'), "aria-roledescription": "edge", "data-id": id, "data-testid": `rf__edge-${id}`, "aria-label": edge.ariaLabel === null ? undefined : edge.ariaLabel || `Edge from ${edge.source} to ${edge.target}`, "aria-describedby": isFocusable ? `${ARIA_EDGE_DESC_KEY}-${rfId}` : undefined, ref: edgeRef, ...edge.domAttributes, children: [!reconnecting && (jsx(EdgeComponent, { id: id, source: edge.source, target: edge.target, type: edge.type, selected: edge.selected, animated: edge.animated, selectable: isSelectable, deletable: edge.deletable ?? true, label: edge.label, labelStyle: edge.labelStyle, labelShowBg: edge.labelShowBg, labelBgStyle: edge.labelBgStyle, labelBgPadding: edge.labelBgPadding, labelBgBorderRadius: edge.labelBgBorderRadius, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, data: edge.data, style: edge.style, sourceHandleId: edge.sourceHandle, targetHandleId: edge.targetHandle, markerStart: markerStartUrl, markerEnd: markerEndUrl, pathOptions: 'pathOptions' in edge ? edge.pathOptions : undefined, interactionWidth: edge.interactionWidth })), isReconnectable && (jsx(EdgeUpdateAnchors, { edge: edge, isReconnectable: isReconnectable, reconnectRadius: reconnectRadius, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, sourceX: sourceX, sourceY: sourceY, targetX: targetX, targetY: targetY, sourcePosition: sourcePosition, targetPosition: targetPosition, setUpdateHover: setUpdateHover, setReconnecting: setReconnecting }))] }) }));
|
|
2860
2879
|
}
|
|
2861
2880
|
|
|
2862
2881
|
const selector$a = (s) => ({
|
|
@@ -3141,6 +3160,7 @@ const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, heig
|
|
|
3141
3160
|
ariaLiveMessage: '',
|
|
3142
3161
|
autoPanOnConnect: true,
|
|
3143
3162
|
autoPanOnNodeDrag: true,
|
|
3163
|
+
autoPanOnNodeFocus: true,
|
|
3144
3164
|
autoPanSpeed: 15,
|
|
3145
3165
|
connectionRadius: 20,
|
|
3146
3166
|
onError: devWarn,
|
|
@@ -3148,6 +3168,7 @@ const getInitialState = ({ nodes, edges, defaultNodes, defaultEdges, width, heig
|
|
|
3148
3168
|
onSelectionChangeHandlers: [],
|
|
3149
3169
|
lib: 'react',
|
|
3150
3170
|
debug: false,
|
|
3171
|
+
ariaLabelConfig: defaultAriaLabelConfig,
|
|
3151
3172
|
};
|
|
3152
3173
|
};
|
|
3153
3174
|
|
|
@@ -3406,6 +3427,19 @@ const createStore = ({ nodes, edges, defaultNodes, defaultEdges, width, height,
|
|
|
3406
3427
|
const { transform, width, height, panZoom, translateExtent } = get();
|
|
3407
3428
|
return panBy({ delta, panZoom, transform, translateExtent, width, height });
|
|
3408
3429
|
},
|
|
3430
|
+
setCenter: async (x, y, options) => {
|
|
3431
|
+
const { width, height, maxZoom, panZoom } = get();
|
|
3432
|
+
if (!panZoom) {
|
|
3433
|
+
return Promise.resolve(false);
|
|
3434
|
+
}
|
|
3435
|
+
const nextZoom = typeof options?.zoom !== 'undefined' ? options.zoom : maxZoom;
|
|
3436
|
+
await panZoom.setViewport({
|
|
3437
|
+
x: width / 2 - x * nextZoom,
|
|
3438
|
+
y: height / 2 - y * nextZoom,
|
|
3439
|
+
zoom: nextZoom,
|
|
3440
|
+
}, { duration: options?.duration, ease: options?.ease, interpolate: options?.interpolate });
|
|
3441
|
+
return Promise.resolve(true);
|
|
3442
|
+
},
|
|
3409
3443
|
cancelConnection: () => {
|
|
3410
3444
|
set({
|
|
3411
3445
|
connection: { ...initialConnection },
|
|
@@ -3489,7 +3523,7 @@ const wrapperStyle = {
|
|
|
3489
3523
|
position: 'relative',
|
|
3490
3524
|
zIndex: 0,
|
|
3491
3525
|
};
|
|
3492
|
-
function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes, edgeTypes, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = 'Backspace', selectionKeyCode = 'Shift', selectionOnDrag = false, selectionMode = SelectionMode.Full, panActivationKeyCode = 'Space', multiSelectionKeyCode = isMacOs() ? 'Meta' : 'Control', zoomActivationKeyCode = isMacOs() ? 'Meta' : 'Control', snapToGrid, snapGrid, onlyRenderVisibleElements = false, selectNodesOnDrag, nodesDraggable, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = true, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = true, nodeExtent, defaultMarkerColor = '#b1b1b7', zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 0, nodeClickDistance = 0, children, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = 'nodrag', noWheelClassName = 'nowheel', noPanClassName = 'nopan', fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = false, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, connectionRadius, isValidConnection, onError, style, id, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = 'light', debug, onScroll, ...rest }, ref) {
|
|
3526
|
+
function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTypes, edgeTypes, onNodeClick, onEdgeClick, onInit, onMove, onMoveStart, onMoveEnd, onConnect, onConnectStart, onConnectEnd, onClickConnectStart, onClickConnectEnd, onNodeMouseEnter, onNodeMouseMove, onNodeMouseLeave, onNodeContextMenu, onNodeDoubleClick, onNodeDragStart, onNodeDrag, onNodeDragStop, onNodesDelete, onEdgesDelete, onDelete, onSelectionChange, onSelectionDragStart, onSelectionDrag, onSelectionDragStop, onSelectionContextMenu, onSelectionStart, onSelectionEnd, onBeforeDelete, connectionMode, connectionLineType = ConnectionLineType.Bezier, connectionLineStyle, connectionLineComponent, connectionLineContainerStyle, deleteKeyCode = 'Backspace', selectionKeyCode = 'Shift', selectionOnDrag = false, selectionMode = SelectionMode.Full, panActivationKeyCode = 'Space', multiSelectionKeyCode = isMacOs() ? 'Meta' : 'Control', zoomActivationKeyCode = isMacOs() ? 'Meta' : 'Control', snapToGrid, snapGrid, onlyRenderVisibleElements = false, selectNodesOnDrag, nodesDraggable, autoPanOnNodeFocus, nodesConnectable, nodesFocusable, nodeOrigin = defaultNodeOrigin, edgesFocusable, edgesReconnectable, elementsSelectable = true, defaultViewport: defaultViewport$1 = defaultViewport, minZoom = 0.5, maxZoom = 2, translateExtent = infiniteExtent, preventScrolling = true, nodeExtent, defaultMarkerColor = '#b1b1b7', zoomOnScroll = true, zoomOnPinch = true, panOnScroll = false, panOnScrollSpeed = 0.5, panOnScrollMode = PanOnScrollMode.Free, zoomOnDoubleClick = true, panOnDrag = true, onPaneClick, onPaneMouseEnter, onPaneMouseMove, onPaneMouseLeave, onPaneScroll, onPaneContextMenu, paneClickDistance = 0, nodeClickDistance = 0, children, onReconnect, onReconnectStart, onReconnectEnd, onEdgeContextMenu, onEdgeDoubleClick, onEdgeMouseEnter, onEdgeMouseMove, onEdgeMouseLeave, reconnectRadius = 10, onNodesChange, onEdgesChange, noDragClassName = 'nodrag', noWheelClassName = 'nowheel', noPanClassName = 'nopan', fitView, fitViewOptions, connectOnClick, attributionPosition, proOptions, defaultEdgeOptions, elevateNodesOnSelect, elevateEdgesOnSelect, disableKeyboardA11y = false, autoPanOnConnect, autoPanOnNodeDrag, autoPanSpeed, connectionRadius, isValidConnection, onError, style, id, nodeDragThreshold, viewport, onViewportChange, width, height, colorMode = 'light', debug, onScroll, ariaLabelConfig, ...rest }, ref) {
|
|
3493
3527
|
const rfId = id || '1';
|
|
3494
3528
|
const colorModeClassName = useColorModeClass(colorMode);
|
|
3495
3529
|
// Undo scroll events, preventing viewport from shifting when nodes outside of it are focused
|
|
@@ -3497,7 +3531,7 @@ function ReactFlow({ nodes, edges, defaultNodes, defaultEdges, className, nodeTy
|
|
|
3497
3531
|
e.currentTarget.scrollTo({ top: 0, left: 0, behavior: 'instant' });
|
|
3498
3532
|
onScroll?.(e);
|
|
3499
3533
|
}, [onScroll]);
|
|
3500
|
-
return (jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), id: id, children: jsxs(Wrapper, { nodes: nodes, edges: edges, width: width, height: height, fitView: fitView, fitViewOptions: fitViewOptions, minZoom: minZoom, maxZoom: maxZoom, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, children: [jsx(GraphView, { onInit: onInit, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, onNodeDoubleClick: onNodeDoubleClick, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionLineType: connectionLineType, connectionLineStyle: connectionLineStyle, connectionLineComponent: connectionLineComponent, connectionLineContainerStyle: connectionLineContainerStyle, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, deleteKeyCode: deleteKeyCode, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, onlyRenderVisibleElements: onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, preventScrolling: preventScrolling, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneScroll: onPaneScroll, onPaneContextMenu: onPaneContextMenu, paneClickDistance: paneClickDistance, nodeClickDistance: nodeClickDistance, onSelectionContextMenu: onSelectionContextMenu, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, onEdgeContextMenu: onEdgeContextMenu, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, reconnectRadius: reconnectRadius, defaultMarkerColor: defaultMarkerColor, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, rfId: rfId, disableKeyboardA11y: disableKeyboardA11y, nodeExtent: nodeExtent, viewport: viewport, onViewportChange: onViewportChange }), jsx(StoreUpdater, { nodes: nodes, edges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onClickConnectStart: onClickConnectStart, onClickConnectEnd: onClickConnectEnd, nodesDraggable: nodesDraggable, nodesConnectable: nodesConnectable, nodesFocusable: nodesFocusable, edgesFocusable: edgesFocusable, edgesReconnectable: edgesReconnectable, elementsSelectable: elementsSelectable, elevateNodesOnSelect: elevateNodesOnSelect, elevateEdgesOnSelect: elevateEdgesOnSelect, minZoom: minZoom, maxZoom: maxZoom, nodeExtent: nodeExtent, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, snapToGrid: snapToGrid, snapGrid: snapGrid, connectionMode: connectionMode, translateExtent: translateExtent, connectOnClick: connectOnClick, defaultEdgeOptions: defaultEdgeOptions, fitView: fitView, fitViewOptions: fitViewOptions, onNodesDelete: onNodesDelete, onEdgesDelete: onEdgesDelete, onDelete: onDelete, onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionDrag: onSelectionDrag, onSelectionDragStart: onSelectionDragStart, onSelectionDragStop: onSelectionDragStop, onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, noPanClassName: noPanClassName, nodeOrigin: nodeOrigin, rfId: rfId, autoPanOnConnect: autoPanOnConnect, autoPanOnNodeDrag: autoPanOnNodeDrag, autoPanSpeed: autoPanSpeed, onError: onError, connectionRadius: connectionRadius, isValidConnection: isValidConnection, selectNodesOnDrag: selectNodesOnDrag, nodeDragThreshold: nodeDragThreshold, onBeforeDelete: onBeforeDelete, paneClickDistance: paneClickDistance, debug: debug }), jsx(SelectionListener, { onSelectionChange: onSelectionChange }), children, jsx(Attribution, { proOptions: proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId: rfId, disableKeyboardA11y: disableKeyboardA11y })] }) }));
|
|
3534
|
+
return (jsx("div", { "data-testid": "rf__wrapper", ...rest, onScroll: wrapperOnScroll, style: { ...style, ...wrapperStyle }, ref: ref, className: cc(['react-flow', className, colorModeClassName]), id: id, role: "application", children: jsxs(Wrapper, { nodes: nodes, edges: edges, width: width, height: height, fitView: fitView, fitViewOptions: fitViewOptions, minZoom: minZoom, maxZoom: maxZoom, nodeOrigin: nodeOrigin, nodeExtent: nodeExtent, children: [jsx(GraphView, { onInit: onInit, onNodeClick: onNodeClick, onEdgeClick: onEdgeClick, onNodeMouseEnter: onNodeMouseEnter, onNodeMouseMove: onNodeMouseMove, onNodeMouseLeave: onNodeMouseLeave, onNodeContextMenu: onNodeContextMenu, onNodeDoubleClick: onNodeDoubleClick, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionLineType: connectionLineType, connectionLineStyle: connectionLineStyle, connectionLineComponent: connectionLineComponent, connectionLineContainerStyle: connectionLineContainerStyle, selectionKeyCode: selectionKeyCode, selectionOnDrag: selectionOnDrag, selectionMode: selectionMode, deleteKeyCode: deleteKeyCode, multiSelectionKeyCode: multiSelectionKeyCode, panActivationKeyCode: panActivationKeyCode, zoomActivationKeyCode: zoomActivationKeyCode, onlyRenderVisibleElements: onlyRenderVisibleElements, defaultViewport: defaultViewport$1, translateExtent: translateExtent, minZoom: minZoom, maxZoom: maxZoom, preventScrolling: preventScrolling, zoomOnScroll: zoomOnScroll, zoomOnPinch: zoomOnPinch, zoomOnDoubleClick: zoomOnDoubleClick, panOnScroll: panOnScroll, panOnScrollSpeed: panOnScrollSpeed, panOnScrollMode: panOnScrollMode, panOnDrag: panOnDrag, onPaneClick: onPaneClick, onPaneMouseEnter: onPaneMouseEnter, onPaneMouseMove: onPaneMouseMove, onPaneMouseLeave: onPaneMouseLeave, onPaneScroll: onPaneScroll, onPaneContextMenu: onPaneContextMenu, paneClickDistance: paneClickDistance, nodeClickDistance: nodeClickDistance, onSelectionContextMenu: onSelectionContextMenu, onSelectionStart: onSelectionStart, onSelectionEnd: onSelectionEnd, onReconnect: onReconnect, onReconnectStart: onReconnectStart, onReconnectEnd: onReconnectEnd, onEdgeContextMenu: onEdgeContextMenu, onEdgeDoubleClick: onEdgeDoubleClick, onEdgeMouseEnter: onEdgeMouseEnter, onEdgeMouseMove: onEdgeMouseMove, onEdgeMouseLeave: onEdgeMouseLeave, reconnectRadius: reconnectRadius, defaultMarkerColor: defaultMarkerColor, noDragClassName: noDragClassName, noWheelClassName: noWheelClassName, noPanClassName: noPanClassName, rfId: rfId, disableKeyboardA11y: disableKeyboardA11y, nodeExtent: nodeExtent, viewport: viewport, onViewportChange: onViewportChange }), jsx(StoreUpdater, { nodes: nodes, edges: edges, defaultNodes: defaultNodes, defaultEdges: defaultEdges, onConnect: onConnect, onConnectStart: onConnectStart, onConnectEnd: onConnectEnd, onClickConnectStart: onClickConnectStart, onClickConnectEnd: onClickConnectEnd, nodesDraggable: nodesDraggable, autoPanOnNodeFocus: autoPanOnNodeFocus, nodesConnectable: nodesConnectable, nodesFocusable: nodesFocusable, edgesFocusable: edgesFocusable, edgesReconnectable: edgesReconnectable, elementsSelectable: elementsSelectable, elevateNodesOnSelect: elevateNodesOnSelect, elevateEdgesOnSelect: elevateEdgesOnSelect, minZoom: minZoom, maxZoom: maxZoom, nodeExtent: nodeExtent, onNodesChange: onNodesChange, onEdgesChange: onEdgesChange, snapToGrid: snapToGrid, snapGrid: snapGrid, connectionMode: connectionMode, translateExtent: translateExtent, connectOnClick: connectOnClick, defaultEdgeOptions: defaultEdgeOptions, fitView: fitView, fitViewOptions: fitViewOptions, onNodesDelete: onNodesDelete, onEdgesDelete: onEdgesDelete, onDelete: onDelete, onNodeDragStart: onNodeDragStart, onNodeDrag: onNodeDrag, onNodeDragStop: onNodeDragStop, onSelectionDrag: onSelectionDrag, onSelectionDragStart: onSelectionDragStart, onSelectionDragStop: onSelectionDragStop, onMove: onMove, onMoveStart: onMoveStart, onMoveEnd: onMoveEnd, noPanClassName: noPanClassName, nodeOrigin: nodeOrigin, rfId: rfId, autoPanOnConnect: autoPanOnConnect, autoPanOnNodeDrag: autoPanOnNodeDrag, autoPanSpeed: autoPanSpeed, onError: onError, connectionRadius: connectionRadius, isValidConnection: isValidConnection, selectNodesOnDrag: selectNodesOnDrag, nodeDragThreshold: nodeDragThreshold, onBeforeDelete: onBeforeDelete, paneClickDistance: paneClickDistance, debug: debug, ariaLabelConfig: ariaLabelConfig }), jsx(SelectionListener, { onSelectionChange: onSelectionChange }), children, jsx(Attribution, { proOptions: proOptions, position: attributionPosition }), jsx(A11yDescriptions, { rfId: rfId, disableKeyboardA11y: disableKeyboardA11y })] }) }));
|
|
3501
3535
|
}
|
|
3502
3536
|
/**
|
|
3503
3537
|
* The `<ReactFlow />` component is the heart of your React Flow application.
|
|
@@ -4275,10 +4309,11 @@ const selector$2 = (s) => ({
|
|
|
4275
4309
|
isInteractive: s.nodesDraggable || s.nodesConnectable || s.elementsSelectable,
|
|
4276
4310
|
minZoomReached: s.transform[2] <= s.minZoom,
|
|
4277
4311
|
maxZoomReached: s.transform[2] >= s.maxZoom,
|
|
4312
|
+
ariaLabelConfig: s.ariaLabelConfig,
|
|
4278
4313
|
});
|
|
4279
|
-
function ControlsComponent({ style, showZoom = true, showFitView = true, showInteractive = true, fitViewOptions, onZoomIn, onZoomOut, onFitView, onInteractiveChange, className, children, position = 'bottom-left', orientation = 'vertical', 'aria-label': ariaLabel
|
|
4314
|
+
function ControlsComponent({ style, showZoom = true, showFitView = true, showInteractive = true, fitViewOptions, onZoomIn, onZoomOut, onFitView, onInteractiveChange, className, children, position = 'bottom-left', orientation = 'vertical', 'aria-label': ariaLabel, }) {
|
|
4280
4315
|
const store = useStoreApi();
|
|
4281
|
-
const { isInteractive, minZoomReached, maxZoomReached } = useStore(selector$2, shallow);
|
|
4316
|
+
const { isInteractive, minZoomReached, maxZoomReached, ariaLabelConfig } = useStore(selector$2, shallow);
|
|
4282
4317
|
const { zoomIn, zoomOut, fitView } = useReactFlow();
|
|
4283
4318
|
const onZoomInHandler = () => {
|
|
4284
4319
|
zoomIn();
|
|
@@ -4301,7 +4336,7 @@ function ControlsComponent({ style, showZoom = true, showFitView = true, showInt
|
|
|
4301
4336
|
onInteractiveChange?.(!isInteractive);
|
|
4302
4337
|
};
|
|
4303
4338
|
const orientationClass = orientation === 'horizontal' ? 'horizontal' : 'vertical';
|
|
4304
|
-
return (jsxs(Panel, { className: cc(['react-flow__controls', orientationClass, className]), position: position, style: style, "data-testid": "rf__controls", "aria-label": ariaLabel, children: [showZoom && (jsxs(Fragment, { children: [jsx(ControlButton, { onClick: onZoomInHandler, className: "react-flow__controls-zoomin", title:
|
|
4339
|
+
return (jsxs(Panel, { className: cc(['react-flow__controls', orientationClass, className]), position: position, style: style, "data-testid": "rf__controls", "aria-label": ariaLabel ?? ariaLabelConfig['controls.ariaLabel'], children: [showZoom && (jsxs(Fragment, { children: [jsx(ControlButton, { onClick: onZoomInHandler, className: "react-flow__controls-zoomin", title: ariaLabelConfig['controls.zoomIn.ariaLabel'], "aria-label": ariaLabelConfig['controls.zoomIn.ariaLabel'], disabled: maxZoomReached, children: jsx(PlusIcon, {}) }), jsx(ControlButton, { onClick: onZoomOutHandler, className: "react-flow__controls-zoomout", title: ariaLabelConfig['controls.zoomOut.ariaLabel'], "aria-label": ariaLabelConfig['controls.zoomOut.ariaLabel'], disabled: minZoomReached, children: jsx(MinusIcon, {}) })] })), showFitView && (jsx(ControlButton, { className: "react-flow__controls-fitview", onClick: onFitViewHandler, title: ariaLabelConfig['controls.fitView.ariaLabel'], "aria-label": ariaLabelConfig['controls.fitView.ariaLabel'], children: jsx(FitViewIcon, {}) })), showInteractive && (jsx(ControlButton, { className: "react-flow__controls-interactive", onClick: onToggleInteractivity, title: ariaLabelConfig['controls.interactive.ariaLabel'], "aria-label": ariaLabelConfig['controls.interactive.ariaLabel'], children: isInteractive ? jsx(UnlockIcon, {}) : jsx(LockIcon, {}) })), children] }));
|
|
4305
4340
|
}
|
|
4306
4341
|
ControlsComponent.displayName = 'Controls';
|
|
4307
4342
|
/**
|
|
@@ -4403,6 +4438,7 @@ const selector$1 = (s) => {
|
|
|
4403
4438
|
translateExtent: s.translateExtent,
|
|
4404
4439
|
flowWidth: s.width,
|
|
4405
4440
|
flowHeight: s.height,
|
|
4441
|
+
ariaLabelConfig: s.ariaLabelConfig,
|
|
4406
4442
|
};
|
|
4407
4443
|
};
|
|
4408
4444
|
const ARIA_LABEL_KEY = 'react-flow__minimap-desc';
|
|
@@ -4411,10 +4447,10 @@ function MiniMapComponent({ style, className, nodeStrokeColor, nodeColor, nodeCl
|
|
|
4411
4447
|
* We need to rename the prop to be `CapitalCase` so that JSX will render it as
|
|
4412
4448
|
* a component properly.
|
|
4413
4449
|
*/
|
|
4414
|
-
nodeComponent, bgColor, maskColor, maskStrokeColor, maskStrokeWidth, position = 'bottom-right', onClick, onNodeClick, pannable = false, zoomable = false, ariaLabel
|
|
4450
|
+
nodeComponent, bgColor, maskColor, maskStrokeColor, maskStrokeWidth, position = 'bottom-right', onClick, onNodeClick, pannable = false, zoomable = false, ariaLabel, inversePan, zoomStep = 10, offsetScale = 5, }) {
|
|
4415
4451
|
const store = useStoreApi();
|
|
4416
4452
|
const svg = useRef(null);
|
|
4417
|
-
const { boundingRect, viewBB, rfId, panZoom, translateExtent, flowWidth, flowHeight } = useStore(selector$1, shallow);
|
|
4453
|
+
const { boundingRect, viewBB, rfId, panZoom, translateExtent, flowWidth, flowHeight, ariaLabelConfig } = useStore(selector$1, shallow);
|
|
4418
4454
|
const elementWidth = style?.width ?? defaultWidth;
|
|
4419
4455
|
const elementHeight = style?.height ?? defaultHeight;
|
|
4420
4456
|
const scaledWidth = boundingRect.width / elementWidth;
|
|
@@ -4467,6 +4503,7 @@ nodeComponent, bgColor, maskColor, maskStrokeColor, maskStrokeWidth, position =
|
|
|
4467
4503
|
onNodeClick(event, node);
|
|
4468
4504
|
}, [])
|
|
4469
4505
|
: undefined;
|
|
4506
|
+
const _ariaLabel = ariaLabel ?? ariaLabelConfig['minimap.ariaLabel'];
|
|
4470
4507
|
return (jsx(Panel, { position: position, style: {
|
|
4471
4508
|
...style,
|
|
4472
4509
|
'--xy-minimap-background-color-props': typeof bgColor === 'string' ? bgColor : undefined,
|
|
@@ -4476,7 +4513,7 @@ nodeComponent, bgColor, maskColor, maskStrokeColor, maskStrokeWidth, position =
|
|
|
4476
4513
|
'--xy-minimap-node-background-color-props': typeof nodeColor === 'string' ? nodeColor : undefined,
|
|
4477
4514
|
'--xy-minimap-node-stroke-color-props': typeof nodeStrokeColor === 'string' ? nodeStrokeColor : undefined,
|
|
4478
4515
|
'--xy-minimap-node-stroke-width-props': typeof nodeStrokeWidth === 'number' ? nodeStrokeWidth : undefined,
|
|
4479
|
-
}, className: cc(['react-flow__minimap', className]), "data-testid": "rf__minimap", children: jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${x} ${y} ${width} ${height}`, className: "react-flow__minimap-svg", role: "img", "aria-labelledby": labelledBy, ref: svg, onClick: onSvgClick, children: [
|
|
4516
|
+
}, className: cc(['react-flow__minimap', className]), "data-testid": "rf__minimap", children: jsxs("svg", { width: elementWidth, height: elementHeight, viewBox: `${x} ${y} ${width} ${height}`, className: "react-flow__minimap-svg", role: "img", "aria-labelledby": labelledBy, ref: svg, onClick: onSvgClick, children: [_ariaLabel && jsx("title", { id: labelledBy, children: _ariaLabel }), jsx(MiniMapNodes$1, { onClick: onSvgNodeClick, nodeColor: nodeColor, nodeStrokeColor: nodeStrokeColor, nodeBorderRadius: nodeBorderRadius, nodeClassName: nodeClassName, nodeStrokeWidth: nodeStrokeWidth, nodeComponent: nodeComponent }), jsx("path", { className: "react-flow__minimap-mask", d: `M${x - offset},${y - offset}h${width + offset * 2}v${height + offset * 2}h${-width - offset * 2}z
|
|
4480
4517
|
M${viewBB.x},${viewBB.y}h${viewBB.width}v${viewBB.height}h${-viewBB.width}z`, fillRule: "evenodd", pointerEvents: "none" })] }) }));
|
|
4481
4518
|
}
|
|
4482
4519
|
MiniMapComponent.displayName = 'MiniMap';
|
|
@@ -4502,14 +4539,20 @@ MiniMapComponent.displayName = 'MiniMap';
|
|
|
4502
4539
|
*/
|
|
4503
4540
|
const MiniMap = memo(MiniMapComponent);
|
|
4504
4541
|
|
|
4505
|
-
|
|
4542
|
+
const scaleSelector = (calculateScale) => (store) => calculateScale ? `${Math.max(1 / store.transform[2], 1)}` : undefined;
|
|
4543
|
+
const defaultPositions = {
|
|
4544
|
+
[ResizeControlVariant.Line]: 'right',
|
|
4545
|
+
[ResizeControlVariant.Handle]: 'bottom-right',
|
|
4546
|
+
};
|
|
4547
|
+
function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle, className, style = undefined, children, color, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = false, resizeDirection, autoScale = true, shouldResize, onResizeStart, onResize, onResizeEnd, }) {
|
|
4506
4548
|
const contextNodeId = useNodeId();
|
|
4507
4549
|
const id = typeof nodeId === 'string' ? nodeId : contextNodeId;
|
|
4508
4550
|
const store = useStoreApi();
|
|
4509
4551
|
const resizeControlRef = useRef(null);
|
|
4510
|
-
const
|
|
4511
|
-
const
|
|
4552
|
+
const isHandleControl = variant === ResizeControlVariant.Handle;
|
|
4553
|
+
const scale = useStore(useCallback(scaleSelector(isHandleControl && autoScale), [isHandleControl, autoScale]), shallow);
|
|
4512
4554
|
const resizer = useRef(null);
|
|
4555
|
+
const controlPosition = position ?? defaultPositions[variant];
|
|
4513
4556
|
useEffect(() => {
|
|
4514
4557
|
if (!resizeControlRef.current || !id) {
|
|
4515
4558
|
return;
|
|
@@ -4635,9 +4678,11 @@ function ResizeControl({ nodeId, position, variant = ResizeControlVariant.Handle
|
|
|
4635
4678
|
shouldResize,
|
|
4636
4679
|
]);
|
|
4637
4680
|
const positionClassNames = controlPosition.split('-');
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4681
|
+
return (jsx("div", { className: cc(['react-flow__resize-control', 'nodrag', ...positionClassNames, variant, className]), ref: resizeControlRef, style: {
|
|
4682
|
+
...style,
|
|
4683
|
+
scale,
|
|
4684
|
+
...(color && { [isHandleControl ? 'backgroundColor' : 'borderColor']: color }),
|
|
4685
|
+
}, children: children }));
|
|
4641
4686
|
}
|
|
4642
4687
|
/**
|
|
4643
4688
|
* To create your own resizing UI, you can use the `NodeResizeControl` component where you can pass children (such as icons).
|
|
@@ -4670,11 +4715,11 @@ const NodeResizeControl = memo(ResizeControl);
|
|
|
4670
4715
|
*export default memo(ResizableNode);
|
|
4671
4716
|
*```
|
|
4672
4717
|
*/
|
|
4673
|
-
function NodeResizer({ nodeId, isVisible = true, handleClassName, handleStyle, lineClassName, lineStyle, color, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = false, shouldResize, onResizeStart, onResize, onResizeEnd, }) {
|
|
4718
|
+
function NodeResizer({ nodeId, isVisible = true, handleClassName, handleStyle, lineClassName, lineStyle, color, minWidth = 10, minHeight = 10, maxWidth = Number.MAX_VALUE, maxHeight = Number.MAX_VALUE, keepAspectRatio = false, autoScale = true, shouldResize, onResizeStart, onResize, onResizeEnd, }) {
|
|
4674
4719
|
if (!isVisible) {
|
|
4675
4720
|
return null;
|
|
4676
4721
|
}
|
|
4677
|
-
return (jsxs(Fragment, { children: [XY_RESIZER_LINE_POSITIONS.map((position) => (jsx(NodeResizeControl, { className: lineClassName, style: lineStyle, nodeId: nodeId, position: position, variant: ResizeControlVariant.Line, color: color, minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight, onResizeStart: onResizeStart, keepAspectRatio: keepAspectRatio, shouldResize: shouldResize, onResize: onResize, onResizeEnd: onResizeEnd }, position))), XY_RESIZER_HANDLE_POSITIONS.map((position) => (jsx(NodeResizeControl, { className: handleClassName, style: handleStyle, nodeId: nodeId, position: position, color: color, minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight, onResizeStart: onResizeStart, keepAspectRatio: keepAspectRatio, shouldResize: shouldResize, onResize: onResize, onResizeEnd: onResizeEnd }, position)))] }));
|
|
4722
|
+
return (jsxs(Fragment, { children: [XY_RESIZER_LINE_POSITIONS.map((position) => (jsx(NodeResizeControl, { className: lineClassName, style: lineStyle, nodeId: nodeId, position: position, variant: ResizeControlVariant.Line, color: color, minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight, onResizeStart: onResizeStart, keepAspectRatio: keepAspectRatio, autoScale: autoScale, shouldResize: shouldResize, onResize: onResize, onResizeEnd: onResizeEnd }, position))), XY_RESIZER_HANDLE_POSITIONS.map((position) => (jsx(NodeResizeControl, { className: handleClassName, style: handleStyle, nodeId: nodeId, position: position, color: color, minWidth: minWidth, minHeight: minHeight, maxWidth: maxWidth, maxHeight: maxHeight, onResizeStart: onResizeStart, keepAspectRatio: keepAspectRatio, autoScale: autoScale, shouldResize: shouldResize, onResize: onResize, onResizeEnd: onResizeEnd }, position)))] }));
|
|
4678
4723
|
}
|
|
4679
4724
|
|
|
4680
4725
|
const selector = (state) => state.domNode?.querySelector('.react-flow__renderer');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AACA,OAAO,EAYL,UAAU,EACV,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AAIxB,OAAO,KAAK,EAAE,cAAc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C;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,0GAyVc,CAAC;AAEhB,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initialState.d.ts","sourceRoot":"","sources":["../../src/store/initialState.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,UAAU,EAEV,gBAAgB,
|
|
1
|
+
{"version":3,"file":"initialState.d.ts","sourceRoot":"","sources":["../../src/store/initialState.ts"],"names":[],"mappings":"AAAA,OAAO,EASL,UAAU,EAEV,gBAAgB,EAEjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAE,cAAc,EAAgB,IAAI,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAEzF,QAAA,MAAM,eAAe,qIAalB;IACD,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,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,UAAU,CAAC,EAAE,gBAAgB,CAAC;CAC/B,KAAQ,cAyGR,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSSProperties, HTMLAttributes, MouseEvent as ReactMouseEvent, WheelEvent } from 'react';
|
|
2
|
-
import type { ConnectionMode, ConnectionLineType, OnConnect, OnConnectStart, OnConnectEnd, CoordinateExtent, KeyCode, PanOnScrollMode, ProOptions, PanelPosition, OnMove, OnMoveStart, OnMoveEnd, Viewport, NodeOrigin, HandleType, SelectionMode, OnError, ColorMode, SnapGrid, OnReconnect } from '@xyflow/system';
|
|
2
|
+
import type { ConnectionMode, ConnectionLineType, OnConnect, OnConnectStart, OnConnectEnd, CoordinateExtent, KeyCode, PanOnScrollMode, ProOptions, PanelPosition, OnMove, OnMoveStart, OnMoveEnd, Viewport, NodeOrigin, HandleType, SelectionMode, OnError, ColorMode, SnapGrid, OnReconnect, AriaLabelConfig } from '@xyflow/system';
|
|
3
3
|
import type { OnSelectionChangeFunc, NodeTypes, EdgeTypes, Node, Edge, ConnectionLineComponent, OnInit, DefaultEdgeOptions, FitViewOptions, OnNodesDelete, OnEdgesDelete, OnDelete, OnNodesChange, OnEdgesChange, NodeMouseHandler, SelectionDragHandler, EdgeMouseHandler, OnNodeDrag, OnBeforeDelete, IsValidConnection } from '.';
|
|
4
4
|
/**
|
|
5
5
|
* ReactFlow component props.
|
|
@@ -336,6 +336,11 @@ export interface ReactFlowProps<NodeType extends Node = Node, EdgeType extends E
|
|
|
336
336
|
* @default true
|
|
337
337
|
*/
|
|
338
338
|
nodesDraggable?: boolean;
|
|
339
|
+
/**
|
|
340
|
+
* When `true`, the viewport will pan when a node is focused.
|
|
341
|
+
* @default true
|
|
342
|
+
*/
|
|
343
|
+
autoPanOnNodeFocus?: boolean;
|
|
339
344
|
/**
|
|
340
345
|
* Controls whether all nodes should be connectable or not. Individual nodes can override this
|
|
341
346
|
* setting by setting their `connectable` prop.
|
|
@@ -620,5 +625,10 @@ export interface ReactFlowProps<NodeType extends Node = Node, EdgeType extends E
|
|
|
620
625
|
* @default false
|
|
621
626
|
*/
|
|
622
627
|
debug?: boolean;
|
|
628
|
+
/**
|
|
629
|
+
* Configuration for customizable labels, descriptions, and UI text. Provided keys will override the corresponding defaults.
|
|
630
|
+
* Allows localization, customization of ARIA descriptions, control labels, minimap labels, and other UI strings.
|
|
631
|
+
*/
|
|
632
|
+
ariaLabelConfig?: Partial<AriaLabelConfig>;
|
|
623
633
|
}
|
|
624
634
|
//# sourceMappingURL=component-props.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"component-props.d.ts","sourceRoot":"","sources":["../../src/types/component-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,IAAI,eAAe,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtG,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,eAAe,EACf,UAAU,EACV,aAAa,EACb,MAAM,EACN,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,aAAa,EACb,OAAO,EACP,SAAS,EACT,QAAQ,EACR,WAAW,
|
|
1
|
+
{"version":3,"file":"component-props.d.ts","sourceRoot":"","sources":["../../src/types/component-props.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,UAAU,IAAI,eAAe,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACtG,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,SAAS,EACT,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,eAAe,EACf,UAAU,EACV,aAAa,EACb,MAAM,EACN,WAAW,EACX,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,aAAa,EACb,OAAO,EACP,SAAS,EACT,QAAQ,EACR,WAAW,EACX,eAAe,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EACT,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,uBAAuB,EACvB,MAAM,EACN,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,aAAa,EACb,QAAQ,EACR,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,oBAAoB,EACpB,gBAAgB,EAChB,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AC1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IAChD;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wCAAwC;IACxC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CAC5C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties, SVGAttributes, ReactNode, MouseEvent as ReactMouseEvent, ComponentType } from 'react';
|
|
1
|
+
import type { CSSProperties, SVGAttributes, ReactNode, MouseEvent as ReactMouseEvent, ComponentType, AriaRole } from 'react';
|
|
2
2
|
import type { EdgeBase, BezierPathOptions, Position, SmoothStepPathOptions, DefaultEdgeOptionsBase, HandleType, ConnectionLineType, Handle, EdgePosition, StepPathOptions, OnError, OnReconnect, FinalConnectionState } from '@xyflow/system';
|
|
3
3
|
import { EdgeTypes, InternalNode, Node } from '.';
|
|
4
4
|
/**
|
|
@@ -34,6 +34,15 @@ export type Edge<EdgeData extends Record<string, unknown> = Record<string, unkno
|
|
|
34
34
|
*/
|
|
35
35
|
reconnectable?: boolean | HandleType;
|
|
36
36
|
focusable?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* The ARIA role attribute for the edge, used for accessibility.
|
|
39
|
+
* @default "group"
|
|
40
|
+
*/
|
|
41
|
+
ariaRole?: AriaRole;
|
|
42
|
+
/**
|
|
43
|
+
* General escape hatch for adding custom attributes to the edge's DOM element.
|
|
44
|
+
*/
|
|
45
|
+
domAttributes?: Omit<SVGAttributes<SVGGElement>, 'id' | 'style' | 'className' | 'role' | 'aria-label'>;
|
|
37
46
|
};
|
|
38
47
|
type SmoothStepEdge<EdgeData extends Record<string, unknown> = Record<string, unknown>> = Edge<EdgeData, 'smoothstep'> & {
|
|
39
48
|
pathOptions?: SmoothStepPathOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/types/edges.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"edges.d.ts","sourceRoot":"","sources":["../../src/types/edges.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,aAAa,EACb,aAAa,EACb,SAAS,EACT,UAAU,IAAI,eAAe,EAC7B,aAAa,EACb,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EACV,QAAQ,EACR,iBAAiB,EACjB,QAAQ,EACR,qBAAqB,EACrB,sBAAsB,EACtB,UAAU,EACV,kBAAkB,EAClB,MAAM,EACN,YAAY,EACZ,eAAe,EACf,OAAO,EACP,WAAW,EACX,oBAAoB,EACrB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;AAElD;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,CAAC,EAAE,aAAa,CAAC;IAC7B,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,IAAI,CACd,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE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AACH,MAAM,MAAM,4BAA4B,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI;IACvE,mBAAmB,CAAC,EAAE,aAAa,CAAC;IACpC,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,oDAAoD;IACpD,QAAQ,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;IACjC,6EAA6E;IAC7E,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,QAAQ,CAAC;IACvB,UAAU,EAAE,QAAQ,CAAC;IACrB;;;OAGG;IACH,gBAAgB,EAAE,OAAO,GAAG,SAAS,GAAG,IAAI,CAAC;IAC7C,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAC;IACtC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,aAAa,CAC/E,4BAA4B,CAAC,QAAQ,CAAC,CACvC,CAAC"}
|
|
@@ -103,6 +103,7 @@ export type ViewportHelperFunctions = {
|
|
|
103
103
|
*
|
|
104
104
|
* @param viewport - the viewport to set
|
|
105
105
|
* @param options.duration - optional duration. If set, a transition will be applied
|
|
106
|
+
* @param options.ease - optional ease function.
|
|
106
107
|
*/
|
|
107
108
|
setViewport: SetViewport;
|
|
108
109
|
/**
|
|
@@ -118,6 +119,8 @@ export type ViewportHelperFunctions = {
|
|
|
118
119
|
* @param x - x position
|
|
119
120
|
* @param y - y position
|
|
120
121
|
* @param options.zoom - optional zoom
|
|
122
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
123
|
+
* @param options.ease - optional ease function.
|
|
121
124
|
*/
|
|
122
125
|
setCenter: SetCenter;
|
|
123
126
|
/**
|
|
@@ -127,6 +130,8 @@ export type ViewportHelperFunctions = {
|
|
|
127
130
|
*
|
|
128
131
|
* @param bounds - the bounds ({ x: number, y: number, width: number, height: number }) to fit the view to
|
|
129
132
|
* @param options.padding - optional padding
|
|
133
|
+
* @param options.duration - optional duration. If set, a transition will be applied
|
|
134
|
+
* @param options.ease - optional ease function.
|
|
130
135
|
*/
|
|
131
136
|
fitBounds: FitBounds;
|
|
132
137
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.d.ts","sourceRoot":"","sources":["../../src/types/general.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,MAAM,EACN,WAAW,EACX,OAAO,EACP,WAAW,EACX,SAAS,EACT,SAAS,EACT,UAAU,EACV,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,UAAU,EACX,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,CAAC;AAE7E;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC;AAEpG;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,OAAO,EAAE,UAAU,CAAC,QAAQ,CAAC,EAAE,KAAK,IAAI,CAAC;AAEpG,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,CAAC;AACtF,MAAM,MAAM,aAAa,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,KAAK,EAAE,QAA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AAW,EAAE,WAAW,CAAC;IACzB;;;;;;;;;OASG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;;;;;OASG;IACH,SAAS,EAAE,SAAS,CAAC;IACrB;;;;;;;;;;OAUG;IACH,oBAAoB,EAAE,CAAC,cAAc,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,KAAK,UAAU,CAAC;IACpG;;;;;;;;OAQG;IACH,oBAAoB,EAAE,CAAC,YAAY,EAAE,UAAU,KAAK,UAAU,CAAC;CAChE,CAAC;AAEF,MAAM,MAAM,cAAc,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,EAAE,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,kBAAkB,CACzG,QAAQ,EACR,QAAQ,CACT,CAAC;AAEF,MAAM,MAAM,iBAAiB,CAAC,QAAQ,SAAS,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,EAAE,QAAQ,GAAG,UAAU,KAAK,OAAO,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSSProperties, MouseEvent as ReactMouseEvent } from 'react';
|
|
1
|
+
import type { CSSProperties, MouseEvent as ReactMouseEvent, AriaRole, HTMLAttributes, DOMAttributes } from 'react';
|
|
2
2
|
import type { CoordinateExtent, NodeBase, OnError, NodeProps as NodePropsBase, InternalNodeBase } from '@xyflow/system';
|
|
3
3
|
import { NodeTypes } from './general';
|
|
4
4
|
/**
|
|
@@ -8,11 +8,20 @@ import { NodeTypes } from './general';
|
|
|
8
8
|
*
|
|
9
9
|
* @public
|
|
10
10
|
*/
|
|
11
|
-
export type Node<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string = string> = NodeBase<NodeData, NodeType> & {
|
|
11
|
+
export type Node<NodeData extends Record<string, unknown> = Record<string, unknown>, NodeType extends string | undefined = string | undefined> = NodeBase<NodeData, NodeType> & {
|
|
12
12
|
style?: CSSProperties;
|
|
13
13
|
className?: string;
|
|
14
14
|
resizing?: boolean;
|
|
15
15
|
focusable?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* The ARIA role attribute for the node element, used for accessibility.
|
|
18
|
+
* @default "group"
|
|
19
|
+
*/
|
|
20
|
+
ariaRole?: AriaRole;
|
|
21
|
+
/**
|
|
22
|
+
* General escape hatch for adding custom attributes to the node's DOM element.
|
|
23
|
+
*/
|
|
24
|
+
domAttributes?: Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'style' | 'className' | 'draggable' | 'role' | 'aria-label' | keyof DOMAttributes<HTMLDivElement>>;
|
|
16
25
|
};
|
|
17
26
|
/**
|
|
18
27
|
* The `InternalNode` type is identical to the base [`Node`](/api-references/types/node)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,IAAI,eAAe,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"nodes.d.ts","sourceRoot":"","sources":["../../src/types/nodes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,IAAI,eAAe,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACnH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,IAAI,aAAa,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAExH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC;;;;;;GAMG;AACH,MAAM,MAAM,IAAI,CACd,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClE,QAAQ,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IACtD,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CA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