@xyflow/vue 2.0.0-next.4 → 2.0.0-next.6
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/index.d.mts +105 -31
- package/dist/index.d.ts +105 -31
- package/dist/index.js +251 -103
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +249 -105
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fragment, Teleport, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createPropsRestProxy, createTextVNode, createVNode, defineComponent, effectScope, getCurrentInstance, h, inject, isMemoSame, isRef, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onScopeDispose, onUnmounted, openBlock, provide, reactive, renderList, renderSlot, resolveComponent, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, toRefs, toValue, unref, useAttrs, useId, useModel, useSlots, watch, watchEffect, withCtx } from "vue";
|
|
2
|
-
import { ConnectionLineType, ConnectionLineType as ConnectionLineType$1, ConnectionMode, ConnectionMode as ConnectionMode$1, PanOnScrollMode, PanOnScrollMode as PanOnScrollMode$1, Position, Position as Position$1, ResizeControlVariant, ResizeControlVariant as ResizeControlVariant$2, SelectionMode, SelectionMode as SelectionMode$1, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, adoptUserNodes, areConnectionMapsEqual, areSetsEqual, calcAutoPan, calculateNodePosition, clamp, clampPosition, clampPositionToParent, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierEdgeCenter as getBezierEdgeCenter$1, getBezierPath, getBezierPath as getBezierPath$1, getBoundsOfBoxes, getBoundsOfRects, getBoundsOfRects as getBoundsOfRects$1, getConnectedEdges, getConnectedEdges as getConnectedEdges$1, getConnectionStatus, getDimensions, getEdgeId, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHandlePosition, getHostForElement, getIncomers, getMarkerId, getMarkerId as getMarkerId$1, getNodeDimensions, getNodeToolbarTransform, getNodesBounds, getNodesBounds as getNodesBounds$1, getNodesInside, getNodesInside as getNodesInside$1, getOutgoers, getOverlappingArea, getSmoothStepPath, getSmoothStepPath as getSmoothStepPath$1, getStraightPath, getStraightPath as getStraightPath$1, getViewportForBounds, getViewportForBounds as getViewportForBounds$1, handleConnectionChange, handleExpandParent, infiniteExtent, isCoordinateExtent, isEdgeBase, isEdgeBase as isEdgeBase$1, isEdgeVisible, isInternalNodeBase, isInternalNodeBase as isInternalNodeBase$1, isMacOs, isMacOs as isMacOs$1, isMouseEvent, isNodeBase, isNodeBase as isNodeBase$1, isRectObject, mergeAriaLabelConfig, nodeHasDimensions, nodeToRect, oppositePosition, panBy, pointToRendererPoint, pointToRendererPoint as pointToRendererPoint$1, rendererPointToPoint, rendererPointToPoint as rendererPointToPoint$1, snapPosition, updateAbsolutePositions } from "@xyflow/system";
|
|
2
|
+
import { ConnectionLineType, ConnectionLineType as ConnectionLineType$1, ConnectionMode, ConnectionMode as ConnectionMode$1, PanOnScrollMode, PanOnScrollMode as PanOnScrollMode$1, Position, Position as Position$1, ResizeControlVariant, ResizeControlVariant as ResizeControlVariant$2, SelectionMode, SelectionMode as SelectionMode$1, XYDrag, XYHandle, XYMinimap, XYPanZoom, XYResizer, addEdge as addEdge$1, adoptUserNodes, areConnectionMapsEqual, areSetsEqual, calcAutoPan, calculateNodePosition, clamp, clampPosition, clampPositionToParent, createDevWarn, evaluateAbsolutePosition, fitViewport, getBezierEdgeCenter, getBezierEdgeCenter as getBezierEdgeCenter$1, getBezierPath, getBezierPath as getBezierPath$1, getBoundsOfBoxes, getBoundsOfRects, getBoundsOfRects as getBoundsOfRects$1, getConnectedEdges, getConnectedEdges as getConnectedEdges$1, getConnectionStatus, getDimensions, getEdgeId, getEdgeToolbarTransform, getElementsToRemove, getElevatedEdgeZIndex, getEventPosition, getHandleBounds, getHandlePosition, getHostForElement, getIncomers, getMarkerId, getMarkerId as getMarkerId$1, getNodeDimensions, getNodeToolbarTransform, getNodesBounds, getNodesBounds as getNodesBounds$1, getNodesInside, getNodesInside as getNodesInside$1, getOutgoers, getOverlappingArea, getSmoothStepPath, getSmoothStepPath as getSmoothStepPath$1, getStraightPath, getStraightPath as getStraightPath$1, getViewportForBounds, getViewportForBounds as getViewportForBounds$1, handleConnectionChange, handleExpandParent, infiniteExtent, isCoordinateExtent, isEdgeBase, isEdgeBase as isEdgeBase$1, isEdgeVisible, isInternalNodeBase, isInternalNodeBase as isInternalNodeBase$1, isMacOs, isMacOs as isMacOs$1, isMouseEvent, isNodeBase, isNodeBase as isNodeBase$1, isRectObject, mergeAriaLabelConfig, nodeHasDimensions, nodeToRect, oppositePosition, panBy, pointToRendererPoint, pointToRendererPoint as pointToRendererPoint$1, reconnectEdge as reconnectEdge$1, rendererPointToPoint, rendererPointToPoint as rendererPointToPoint$1, snapPosition, updateAbsolutePositions } from "@xyflow/system";
|
|
3
3
|
import { onKeyStroke, until, useEventListener } from "@vueuse/core";
|
|
4
4
|
//#region src/context/index.ts
|
|
5
5
|
/** the curated instance (`useVueFlow()`) */
|
|
@@ -114,7 +114,7 @@ var export_helper_default = (sfc, props) => {
|
|
|
114
114
|
};
|
|
115
115
|
//#endregion
|
|
116
116
|
//#region src/components/Background/Background.vue
|
|
117
|
-
const _sfc_main$
|
|
117
|
+
const _sfc_main$25 = /* @__PURE__ */ defineComponent({
|
|
118
118
|
name: "Background",
|
|
119
119
|
compatConfig: { MODE: 3 },
|
|
120
120
|
props: {
|
|
@@ -199,7 +199,7 @@ const _sfc_main$24 = /* @__PURE__ */ defineComponent({
|
|
|
199
199
|
return __returned__;
|
|
200
200
|
}
|
|
201
201
|
});
|
|
202
|
-
const _hoisted_1$
|
|
202
|
+
const _hoisted_1$15 = { class: "vue-flow__background vue-flow__container" };
|
|
203
203
|
const _hoisted_2$4 = [
|
|
204
204
|
"id",
|
|
205
205
|
"x",
|
|
@@ -213,8 +213,8 @@ const _hoisted_3$3 = [
|
|
|
213
213
|
"y",
|
|
214
214
|
"fill"
|
|
215
215
|
];
|
|
216
|
-
function _sfc_render$
|
|
217
|
-
return openBlock(), createElementBlock("svg", _hoisted_1$
|
|
216
|
+
function _sfc_render$25(_ctx, _cache, $props, $setup, $data, $options) {
|
|
217
|
+
return openBlock(), createElementBlock("svg", _hoisted_1$15, [
|
|
218
218
|
renderSlot(_ctx.$slots, "pattern-container", { id: $setup.patternId }, () => [createElementVNode("pattern", {
|
|
219
219
|
id: $setup.patternId,
|
|
220
220
|
x: $setup.viewport.x % $setup.background.scaledGap[0],
|
|
@@ -247,10 +247,10 @@ function _sfc_render$24(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
247
247
|
renderSlot(_ctx.$slots, "default", { id: $setup.patternId })
|
|
248
248
|
]);
|
|
249
249
|
}
|
|
250
|
-
var Background_default = /* @__PURE__ */ export_helper_default(_sfc_main$
|
|
250
|
+
var Background_default = /* @__PURE__ */ export_helper_default(_sfc_main$25, [["render", _sfc_render$25], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/Background/Background.vue"]]);
|
|
251
251
|
//#endregion
|
|
252
252
|
//#region src/components/Controls/ControlButton.vue
|
|
253
|
-
const _sfc_main$
|
|
253
|
+
const _sfc_main$24 = /* @__PURE__ */ defineComponent({
|
|
254
254
|
name: "ControlButton",
|
|
255
255
|
compatConfig: { MODE: 3 },
|
|
256
256
|
props: {
|
|
@@ -274,12 +274,12 @@ const _sfc_main$23 = /* @__PURE__ */ defineComponent({
|
|
|
274
274
|
return __returned__;
|
|
275
275
|
}
|
|
276
276
|
});
|
|
277
|
-
const _hoisted_1$
|
|
277
|
+
const _hoisted_1$14 = [
|
|
278
278
|
"disabled",
|
|
279
279
|
"aria-label",
|
|
280
280
|
"title"
|
|
281
281
|
];
|
|
282
|
-
function _sfc_render$
|
|
282
|
+
function _sfc_render$24(_ctx, _cache, $props, $setup, $data, $options) {
|
|
283
283
|
return openBlock(), createElementBlock("button", {
|
|
284
284
|
type: "button",
|
|
285
285
|
class: "vue-flow__controls-button",
|
|
@@ -287,9 +287,9 @@ function _sfc_render$23(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
287
287
|
"aria-label": $props.label,
|
|
288
288
|
title: $props.label,
|
|
289
289
|
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("click", $event))
|
|
290
|
-
}, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$
|
|
290
|
+
}, [renderSlot(_ctx.$slots, "default")], 8, _hoisted_1$14);
|
|
291
291
|
}
|
|
292
|
-
var ControlButton_default = /* @__PURE__ */ export_helper_default(_sfc_main$
|
|
292
|
+
var ControlButton_default = /* @__PURE__ */ export_helper_default(_sfc_main$24, [["render", _sfc_render$24], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/Controls/ControlButton.vue"]]);
|
|
293
293
|
//#endregion
|
|
294
294
|
//#region src/composables/storeToRefs.ts
|
|
295
295
|
/**
|
|
@@ -318,7 +318,7 @@ function storeToRefs(store) {
|
|
|
318
318
|
* @param params
|
|
319
319
|
*/
|
|
320
320
|
function useDrag(params) {
|
|
321
|
-
const { panBy, getInternalNode, removeSelectedNodes, removeSelectedEdges, updateNodePositions, getNodes, getEdges } = useVueFlow();
|
|
321
|
+
const { panBy, getInternalNode, addSelectedNodes, removeSelectedNodes, removeSelectedEdges, updateNodePositions, getNodes, getEdges } = useVueFlow();
|
|
322
322
|
const store = useStore();
|
|
323
323
|
const { nodeLookup } = store;
|
|
324
324
|
const { onStart, onDrag, onStop, onClick, el, disabled, id, selectable, dragHandle } = params;
|
|
@@ -390,6 +390,13 @@ function useDrag(params) {
|
|
|
390
390
|
},
|
|
391
391
|
autoPanSpeed: store.autoPanSpeed
|
|
392
392
|
}),
|
|
393
|
+
onNodeMouseDown: (nodeId) => {
|
|
394
|
+
const node = getInternalNode(nodeId);
|
|
395
|
+
if (!node) return;
|
|
396
|
+
store.nodesSelectionActive = false;
|
|
397
|
+
if (!node.selected) addSelectedNodes([node]);
|
|
398
|
+
else if (store.multiSelectionActive) removeSelectedNodes([node]);
|
|
399
|
+
},
|
|
393
400
|
onDragStart: (event, _dragItems, node, nodes) => {
|
|
394
401
|
dragFired = true;
|
|
395
402
|
dragging.value = true;
|
|
@@ -1719,7 +1726,7 @@ function useWatchProps(models, props, handle) {
|
|
|
1719
1726
|
}
|
|
1720
1727
|
//#endregion
|
|
1721
1728
|
//#region src/components/Panel/Panel.vue
|
|
1722
|
-
const _sfc_main$
|
|
1729
|
+
const _sfc_main$23 = /* @__PURE__ */ defineComponent({
|
|
1723
1730
|
name: "Panel",
|
|
1724
1731
|
compatConfig: { MODE: 3 },
|
|
1725
1732
|
props: {
|
|
@@ -1749,15 +1756,15 @@ const _sfc_main$22 = /* @__PURE__ */ defineComponent({
|
|
|
1749
1756
|
return __returned__;
|
|
1750
1757
|
}
|
|
1751
1758
|
});
|
|
1752
|
-
const _hoisted_1$
|
|
1753
|
-
function _sfc_render$
|
|
1759
|
+
const _hoisted_1$13 = ["aria-label"];
|
|
1760
|
+
function _sfc_render$23(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1754
1761
|
return openBlock(), createElementBlock("div", {
|
|
1755
1762
|
class: normalizeClass(["vue-flow__panel", $setup.positionClasses]),
|
|
1756
1763
|
"aria-label": $props.label ?? void 0,
|
|
1757
1764
|
style: normalizeStyle({ pointerEvents: $setup.userSelectionActive ? "none" : "all" })
|
|
1758
|
-
}, [renderSlot(_ctx.$slots, "default")], 14, _hoisted_1$
|
|
1765
|
+
}, [renderSlot(_ctx.$slots, "default")], 14, _hoisted_1$13);
|
|
1759
1766
|
}
|
|
1760
|
-
var Panel_default = /* @__PURE__ */ export_helper_default(_sfc_main$
|
|
1767
|
+
var Panel_default = /* @__PURE__ */ export_helper_default(_sfc_main$23, [["render", _sfc_render$23], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/Panel/Panel.vue"]]);
|
|
1761
1768
|
//#endregion
|
|
1762
1769
|
//#region src/components/Controls/icons.ts
|
|
1763
1770
|
function icon(viewBox, d) {
|
|
@@ -1774,7 +1781,7 @@ const Lock = icon("0 0 25 32", "M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 1
|
|
|
1774
1781
|
const Unlock = icon("0 0 25 32", "M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z");
|
|
1775
1782
|
//#endregion
|
|
1776
1783
|
//#region src/components/Controls/Controls.vue
|
|
1777
|
-
const _sfc_main$
|
|
1784
|
+
const _sfc_main$22 = /* @__PURE__ */ defineComponent({
|
|
1778
1785
|
name: "Controls",
|
|
1779
1786
|
compatConfig: { MODE: 3 },
|
|
1780
1787
|
props: {
|
|
@@ -1884,7 +1891,7 @@ const _sfc_main$21 = /* @__PURE__ */ defineComponent({
|
|
|
1884
1891
|
return __returned__;
|
|
1885
1892
|
}
|
|
1886
1893
|
});
|
|
1887
|
-
function _sfc_render$
|
|
1894
|
+
function _sfc_render$22(_ctx, _cache, $props, $setup, $data, $options) {
|
|
1888
1895
|
return openBlock(), createBlock($setup["Panel"], {
|
|
1889
1896
|
class: "vue-flow__controls",
|
|
1890
1897
|
position: $props.position,
|
|
@@ -1931,10 +1938,10 @@ function _sfc_render$21(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
1931
1938
|
_: 3
|
|
1932
1939
|
}, 8, ["position", "label"]);
|
|
1933
1940
|
}
|
|
1934
|
-
var Controls_default = /* @__PURE__ */ export_helper_default(_sfc_main$
|
|
1941
|
+
var Controls_default = /* @__PURE__ */ export_helper_default(_sfc_main$22, [["render", _sfc_render$22], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/Controls/Controls.vue"]]);
|
|
1935
1942
|
//#endregion
|
|
1936
1943
|
//#region src/components/Edges/EdgeText.vue
|
|
1937
|
-
const _sfc_main$
|
|
1944
|
+
const _sfc_main$21 = /* @__PURE__ */ defineComponent({
|
|
1938
1945
|
name: "EdgeText",
|
|
1939
1946
|
compatConfig: { MODE: 3 },
|
|
1940
1947
|
props: {
|
|
@@ -2014,7 +2021,7 @@ const _sfc_main$20 = /* @__PURE__ */ defineComponent({
|
|
|
2014
2021
|
return __returned__;
|
|
2015
2022
|
}
|
|
2016
2023
|
});
|
|
2017
|
-
const _hoisted_1$
|
|
2024
|
+
const _hoisted_1$12 = ["transform", "visibility"];
|
|
2018
2025
|
const _hoisted_2$3 = [
|
|
2019
2026
|
"width",
|
|
2020
2027
|
"height",
|
|
@@ -2024,7 +2031,7 @@ const _hoisted_2$3 = [
|
|
|
2024
2031
|
"ry"
|
|
2025
2032
|
];
|
|
2026
2033
|
const _hoisted_3$2 = ["y"];
|
|
2027
|
-
function _sfc_render$
|
|
2034
|
+
function _sfc_render$21(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2028
2035
|
return openBlock(), createElementBlock("g", {
|
|
2029
2036
|
transform: $setup.transform,
|
|
2030
2037
|
visibility: $setup.box.width ? "visible" : "hidden",
|
|
@@ -2045,12 +2052,12 @@ function _sfc_render$20(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2045
2052
|
y: $setup.box.height / 2,
|
|
2046
2053
|
dy: "0.3em",
|
|
2047
2054
|
style: $props.labelStyle
|
|
2048
|
-
}), [renderSlot(_ctx.$slots, "default", {}, () => [typeof $props.label !== "string" ? (openBlock(), createBlock(resolveDynamicComponent($props.label), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString($props.label), 1)], 64))])], 16, _hoisted_3$2)], 8, _hoisted_1$
|
|
2055
|
+
}), [renderSlot(_ctx.$slots, "default", {}, () => [typeof $props.label !== "string" ? (openBlock(), createBlock(resolveDynamicComponent($props.label), { key: 0 })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString($props.label), 1)], 64))])], 16, _hoisted_3$2)], 8, _hoisted_1$12);
|
|
2049
2056
|
}
|
|
2050
|
-
var EdgeText_default = /* @__PURE__ */ export_helper_default(_sfc_main$
|
|
2057
|
+
var EdgeText_default = /* @__PURE__ */ export_helper_default(_sfc_main$21, [["render", _sfc_render$21], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/Edges/EdgeText.vue"]]);
|
|
2051
2058
|
//#endregion
|
|
2052
2059
|
//#region src/components/Edges/BaseEdge.vue
|
|
2053
|
-
const _sfc_main$
|
|
2060
|
+
const _sfc_main$20 = /* @__PURE__ */ defineComponent({
|
|
2054
2061
|
name: "BaseEdge",
|
|
2055
2062
|
inheritAttrs: false,
|
|
2056
2063
|
compatConfig: { MODE: 3 },
|
|
@@ -2133,14 +2140,14 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
|
2133
2140
|
return __returned__;
|
|
2134
2141
|
}
|
|
2135
2142
|
});
|
|
2136
|
-
const _hoisted_1$
|
|
2143
|
+
const _hoisted_1$11 = [
|
|
2137
2144
|
"id",
|
|
2138
2145
|
"d",
|
|
2139
2146
|
"marker-end",
|
|
2140
2147
|
"marker-start"
|
|
2141
2148
|
];
|
|
2142
2149
|
const _hoisted_2$2 = ["d", "stroke-width"];
|
|
2143
|
-
function _sfc_render$
|
|
2150
|
+
function _sfc_render$20(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2144
2151
|
return openBlock(), createElementBlock(Fragment, null, [
|
|
2145
2152
|
createElementVNode("path", mergeProps($setup.attrs, {
|
|
2146
2153
|
id: $props.id,
|
|
@@ -2149,7 +2156,7 @@ function _sfc_render$19(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2149
2156
|
class: "vue-flow__edge-path",
|
|
2150
2157
|
"marker-end": $props.markerEnd,
|
|
2151
2158
|
"marker-start": $props.markerStart
|
|
2152
|
-
}), null, 16, _hoisted_1$
|
|
2159
|
+
}), null, 16, _hoisted_1$11),
|
|
2153
2160
|
$props.interactionWidth ? (openBlock(), createElementBlock("path", {
|
|
2154
2161
|
key: 0,
|
|
2155
2162
|
ref: "interactionEl",
|
|
@@ -2182,7 +2189,7 @@ function _sfc_render$19(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2182
2189
|
])) : createCommentVNode("v-if", true)
|
|
2183
2190
|
], 64);
|
|
2184
2191
|
}
|
|
2185
|
-
var BaseEdge_default = /* @__PURE__ */ export_helper_default(_sfc_main$
|
|
2192
|
+
var BaseEdge_default = /* @__PURE__ */ export_helper_default(_sfc_main$20, [["render", _sfc_render$20], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/Edges/BaseEdge.vue"]]);
|
|
2186
2193
|
//#endregion
|
|
2187
2194
|
//#region src/components/Edges/utils.ts
|
|
2188
2195
|
/**
|
|
@@ -2250,7 +2257,7 @@ const BezierEdge = defineComponent({
|
|
|
2250
2257
|
});
|
|
2251
2258
|
//#endregion
|
|
2252
2259
|
//#region src/components/Edges/EdgeLabelRenderer.vue
|
|
2253
|
-
const _sfc_main$
|
|
2260
|
+
const _sfc_main$19 = /* @__PURE__ */ defineComponent({
|
|
2254
2261
|
name: "EdgeLabelRenderer",
|
|
2255
2262
|
compatConfig: { MODE: 3 },
|
|
2256
2263
|
setup(__props, { expose: __expose }) {
|
|
@@ -2267,17 +2274,17 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
2267
2274
|
return __returned__;
|
|
2268
2275
|
}
|
|
2269
2276
|
});
|
|
2270
|
-
const _hoisted_1$
|
|
2277
|
+
const _hoisted_1$10 = {
|
|
2271
2278
|
height: "0",
|
|
2272
2279
|
width: "0"
|
|
2273
2280
|
};
|
|
2274
|
-
function _sfc_render$
|
|
2275
|
-
return openBlock(), createElementBlock("svg", null, [(openBlock(), createElementBlock("foreignObject", _hoisted_1$
|
|
2281
|
+
function _sfc_render$19(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2282
|
+
return openBlock(), createElementBlock("svg", null, [(openBlock(), createElementBlock("foreignObject", _hoisted_1$10, [(openBlock(), createBlock(Teleport, {
|
|
2276
2283
|
to: $setup.teleportTarget,
|
|
2277
2284
|
disabled: !$setup.teleportTarget
|
|
2278
2285
|
}, [renderSlot(_ctx.$slots, "default")], 8, ["to", "disabled"]))]))]);
|
|
2279
2286
|
}
|
|
2280
|
-
var EdgeLabelRenderer_default = /* @__PURE__ */ export_helper_default(_sfc_main$
|
|
2287
|
+
var EdgeLabelRenderer_default = /* @__PURE__ */ export_helper_default(_sfc_main$19, [["render", _sfc_render$19], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/Edges/EdgeLabelRenderer.vue"]]);
|
|
2281
2288
|
//#endregion
|
|
2282
2289
|
//#region src/components/Edges/SimpleBezierEdge.ts
|
|
2283
2290
|
function getControl({ pos, x1, y1, x2, y2 }) {
|
|
@@ -2486,7 +2493,7 @@ const StraightEdge = defineComponent({
|
|
|
2486
2493
|
});
|
|
2487
2494
|
//#endregion
|
|
2488
2495
|
//#region src/components/Handle/Handle.vue
|
|
2489
|
-
const _sfc_main$
|
|
2496
|
+
const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
2490
2497
|
name: "Handle",
|
|
2491
2498
|
compatConfig: { MODE: 3 },
|
|
2492
2499
|
props: {
|
|
@@ -2658,8 +2665,8 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
2658
2665
|
return __returned__;
|
|
2659
2666
|
}
|
|
2660
2667
|
});
|
|
2661
|
-
const _hoisted_1$
|
|
2662
|
-
function _sfc_render$
|
|
2668
|
+
const _hoisted_1$9 = ["aria-label"];
|
|
2669
|
+
function _sfc_render$18(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2663
2670
|
return openBlock(), createElementBlock("div", mergeProps({ ref: "handle" }, $setup.handleDataIds, {
|
|
2664
2671
|
"aria-label": $setup.store.ariaLabelConfig["handle.ariaLabel"],
|
|
2665
2672
|
class: ["vue-flow__handle", [
|
|
@@ -2673,9 +2680,84 @@ function _sfc_render$17(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2673
2680
|
onMousedown: $setup.onPointerDown,
|
|
2674
2681
|
onTouchstartPassive: $setup.onPointerDown,
|
|
2675
2682
|
onClick: $setup.onClick
|
|
2676
|
-
}), [renderSlot(_ctx.$slots, "default", { id: $props.id })], 16, _hoisted_1$
|
|
2683
|
+
}), [renderSlot(_ctx.$slots, "default", { id: $props.id })], 16, _hoisted_1$9);
|
|
2677
2684
|
}
|
|
2678
|
-
var Handle_default = /* @__PURE__ */ export_helper_default(_sfc_main$
|
|
2685
|
+
var Handle_default = /* @__PURE__ */ export_helper_default(_sfc_main$18, [["render", _sfc_render$18], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/Handle/Handle.vue"]]);
|
|
2686
|
+
//#endregion
|
|
2687
|
+
//#region src/components/EdgeToolbar/EdgeToolbar.vue
|
|
2688
|
+
const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
2689
|
+
name: "EdgeToolbar",
|
|
2690
|
+
compatConfig: { MODE: 3 },
|
|
2691
|
+
inheritAttrs: false,
|
|
2692
|
+
props: {
|
|
2693
|
+
edgeId: {
|
|
2694
|
+
type: String,
|
|
2695
|
+
required: true
|
|
2696
|
+
},
|
|
2697
|
+
x: {
|
|
2698
|
+
type: Number,
|
|
2699
|
+
required: true
|
|
2700
|
+
},
|
|
2701
|
+
y: {
|
|
2702
|
+
type: Number,
|
|
2703
|
+
required: true
|
|
2704
|
+
},
|
|
2705
|
+
isVisible: {
|
|
2706
|
+
type: Boolean,
|
|
2707
|
+
required: false,
|
|
2708
|
+
default: void 0
|
|
2709
|
+
},
|
|
2710
|
+
alignX: {
|
|
2711
|
+
type: String,
|
|
2712
|
+
required: false,
|
|
2713
|
+
default: "center"
|
|
2714
|
+
},
|
|
2715
|
+
alignY: {
|
|
2716
|
+
type: String,
|
|
2717
|
+
required: false,
|
|
2718
|
+
default: "center"
|
|
2719
|
+
}
|
|
2720
|
+
},
|
|
2721
|
+
setup(__props, { expose: __expose }) {
|
|
2722
|
+
__expose();
|
|
2723
|
+
const props = __props;
|
|
2724
|
+
const { viewport } = useVueFlow();
|
|
2725
|
+
const { edgeLookup } = useStore();
|
|
2726
|
+
const edge = computed(() => edgeLookup.get(props.edgeId));
|
|
2727
|
+
const __returned__ = {
|
|
2728
|
+
props,
|
|
2729
|
+
viewport,
|
|
2730
|
+
edgeLookup,
|
|
2731
|
+
edge,
|
|
2732
|
+
isActive: computed(() => typeof props.isVisible === "boolean" ? props.isVisible : edge.value?.selected),
|
|
2733
|
+
wrapperStyle: computed(() => ({
|
|
2734
|
+
position: "absolute",
|
|
2735
|
+
transform: getEdgeToolbarTransform(props.x, props.y, viewport.value.zoom, props.alignX, props.alignY),
|
|
2736
|
+
zIndex: (edge.value?.zIndex ?? 0) + 1,
|
|
2737
|
+
pointerEvents: "all",
|
|
2738
|
+
transformOrigin: "0 0"
|
|
2739
|
+
})),
|
|
2740
|
+
EdgeLabelRenderer: EdgeLabelRenderer_default
|
|
2741
|
+
};
|
|
2742
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
2743
|
+
enumerable: false,
|
|
2744
|
+
value: true
|
|
2745
|
+
});
|
|
2746
|
+
return __returned__;
|
|
2747
|
+
}
|
|
2748
|
+
});
|
|
2749
|
+
const _hoisted_1$8 = ["data-id"];
|
|
2750
|
+
function _sfc_render$17(_ctx, _cache, $props, $setup, $data, $options) {
|
|
2751
|
+
return $setup.isActive ? (openBlock(), createBlock($setup["EdgeLabelRenderer"], { key: 0 }, {
|
|
2752
|
+
default: withCtx(() => [createElementVNode("div", mergeProps(_ctx.$attrs, {
|
|
2753
|
+
style: $setup.wrapperStyle,
|
|
2754
|
+
"data-id": $setup.edge?.id ?? "",
|
|
2755
|
+
class: "vue-flow__edge-toolbar"
|
|
2756
|
+
}), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1$8)]),
|
|
2757
|
+
_: 3
|
|
2758
|
+
})) : createCommentVNode("v-if", true);
|
|
2759
|
+
}
|
|
2760
|
+
var EdgeToolbar_default = /* @__PURE__ */ export_helper_default(_sfc_main$17, [["render", _sfc_render$17], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/EdgeToolbar/EdgeToolbar.vue"]]);
|
|
2679
2761
|
//#endregion
|
|
2680
2762
|
//#region src/components/MiniMap/types.ts
|
|
2681
2763
|
const Slots = Symbol("MiniMapSlots");
|
|
@@ -3957,70 +4039,6 @@ function useNodesInitialized(options = { includeHiddenNodes: false }) {
|
|
|
3957
4039
|
return computed(() => areNodesInitialized(nodeLookup, options.includeHiddenNodes));
|
|
3958
4040
|
}
|
|
3959
4041
|
//#endregion
|
|
3960
|
-
//#region src/components/A11y/A11yDescriptions.vue
|
|
3961
|
-
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
3962
|
-
name: "A11yDescriptions",
|
|
3963
|
-
compatConfig: { MODE: 3 },
|
|
3964
|
-
setup(__props, { expose: __expose }) {
|
|
3965
|
-
__expose();
|
|
3966
|
-
const { id } = useVueFlow();
|
|
3967
|
-
const { disableKeyboardA11y, ariaLiveMessage, ariaLabelConfig } = storeToRefs(useStore());
|
|
3968
|
-
const __returned__ = {
|
|
3969
|
-
id,
|
|
3970
|
-
disableKeyboardA11y,
|
|
3971
|
-
ariaLiveMessage,
|
|
3972
|
-
ariaLabelConfig,
|
|
3973
|
-
get ARIA_EDGE_DESC_KEY() {
|
|
3974
|
-
return ARIA_EDGE_DESC_KEY;
|
|
3975
|
-
},
|
|
3976
|
-
get ARIA_LIVE_MESSAGE() {
|
|
3977
|
-
return ARIA_LIVE_MESSAGE;
|
|
3978
|
-
},
|
|
3979
|
-
get ARIA_NODE_DESC_KEY() {
|
|
3980
|
-
return ARIA_NODE_DESC_KEY;
|
|
3981
|
-
}
|
|
3982
|
-
};
|
|
3983
|
-
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
3984
|
-
enumerable: false,
|
|
3985
|
-
value: true
|
|
3986
|
-
});
|
|
3987
|
-
return __returned__;
|
|
3988
|
-
}
|
|
3989
|
-
});
|
|
3990
|
-
const _hoisted_1$5 = ["id"];
|
|
3991
|
-
const _hoisted_2 = ["id"];
|
|
3992
|
-
const _hoisted_3 = ["id"];
|
|
3993
|
-
function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
3994
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
3995
|
-
createElementVNode("div", {
|
|
3996
|
-
id: `${$setup.ARIA_NODE_DESC_KEY}-${$setup.id}`,
|
|
3997
|
-
style: { "display": "none" }
|
|
3998
|
-
}, toDisplayString($setup.disableKeyboardA11y ? $setup.ariaLabelConfig["node.a11yDescription.default"] : $setup.ariaLabelConfig["node.a11yDescription.keyboardDisabled"]), 9, _hoisted_1$5),
|
|
3999
|
-
createElementVNode("div", {
|
|
4000
|
-
id: `${$setup.ARIA_EDGE_DESC_KEY}-${$setup.id}`,
|
|
4001
|
-
style: { "display": "none" }
|
|
4002
|
-
}, toDisplayString($setup.ariaLabelConfig["edge.a11yDescription.default"]), 9, _hoisted_2),
|
|
4003
|
-
!$setup.disableKeyboardA11y ? (openBlock(), createElementBlock("div", {
|
|
4004
|
-
key: 0,
|
|
4005
|
-
id: `${$setup.ARIA_LIVE_MESSAGE}-${$setup.id}`,
|
|
4006
|
-
"aria-live": "assertive",
|
|
4007
|
-
"aria-atomic": "true",
|
|
4008
|
-
style: {
|
|
4009
|
-
"position": "absolute",
|
|
4010
|
-
"width": "1px",
|
|
4011
|
-
"height": "1px",
|
|
4012
|
-
"margin": "-1px",
|
|
4013
|
-
"border": "0",
|
|
4014
|
-
"padding": "0",
|
|
4015
|
-
"overflow": "hidden",
|
|
4016
|
-
"clip": "rect(0px, 0px, 0px, 0px)",
|
|
4017
|
-
"clip-path": "inset(100%)"
|
|
4018
|
-
}
|
|
4019
|
-
}, toDisplayString($setup.ariaLiveMessage), 9, _hoisted_3)) : createCommentVNode("v-if", true)
|
|
4020
|
-
], 64);
|
|
4021
|
-
}
|
|
4022
|
-
var A11yDescriptions_default = /* @__PURE__ */ export_helper_default(_sfc_main$11, [["render", _sfc_render$11], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/A11y/A11yDescriptions.vue"]]);
|
|
4023
|
-
//#endregion
|
|
4024
4042
|
//#region src/store/hooks.ts
|
|
4025
4043
|
function createHooks() {
|
|
4026
4044
|
return {
|
|
@@ -5074,6 +5092,101 @@ function useCreateVueFlow(options, signals) {
|
|
|
5074
5092
|
return handle;
|
|
5075
5093
|
}
|
|
5076
5094
|
//#endregion
|
|
5095
|
+
//#region src/composables/setupVueFlow.ts
|
|
5096
|
+
/**
|
|
5097
|
+
* Create a VueFlow store, `provide` it to the current component's subtree, and return the instance — the
|
|
5098
|
+
* same API as {@link useVueFlow}. The Vue-native alternative to wrapping in `<VueFlowProvider>`: call it
|
|
5099
|
+
* in the component that renders `<VueFlow>` and you get the store's actions/getters/hooks in that same
|
|
5100
|
+
* `setup`, while the rendered `<VueFlow>` (and any `useVueFlow()`/`useStore()` below it) reuse the provided
|
|
5101
|
+
* store instead of creating their own.
|
|
5102
|
+
*
|
|
5103
|
+
* Must run in a component `setup` (it calls `provide`). Delegates to the same store factory as
|
|
5104
|
+
* `<VueFlowProvider>`, so one call scopes one store — host a single `<VueFlow>` per setup.
|
|
5105
|
+
*
|
|
5106
|
+
* @public
|
|
5107
|
+
* @param options - initial flow options (`id`, initial nodes/edges, defaults, …)
|
|
5108
|
+
* @returns the VueFlow instance (same shape `useVueFlow()` returns)
|
|
5109
|
+
* @example
|
|
5110
|
+
* ```vue
|
|
5111
|
+
* <script setup lang="ts">
|
|
5112
|
+
* import { setupVueFlow, VueFlow } from '@xyflow/vue'
|
|
5113
|
+
*
|
|
5114
|
+
* const { addEdges, fitView } = setupVueFlow()
|
|
5115
|
+
* <\/script>
|
|
5116
|
+
*
|
|
5117
|
+
* <template>
|
|
5118
|
+
* <VueFlow v-model:nodes="nodes" v-model:edges="edges" />
|
|
5119
|
+
* </template>
|
|
5120
|
+
* ```
|
|
5121
|
+
*/
|
|
5122
|
+
function setupVueFlow(options) {
|
|
5123
|
+
return useCreateVueFlow(options).instance;
|
|
5124
|
+
}
|
|
5125
|
+
//#endregion
|
|
5126
|
+
//#region src/components/A11y/A11yDescriptions.vue
|
|
5127
|
+
const _sfc_main$11 = /* @__PURE__ */ defineComponent({
|
|
5128
|
+
name: "A11yDescriptions",
|
|
5129
|
+
compatConfig: { MODE: 3 },
|
|
5130
|
+
setup(__props, { expose: __expose }) {
|
|
5131
|
+
__expose();
|
|
5132
|
+
const { id } = useVueFlow();
|
|
5133
|
+
const { disableKeyboardA11y, ariaLiveMessage, ariaLabelConfig } = storeToRefs(useStore());
|
|
5134
|
+
const __returned__ = {
|
|
5135
|
+
id,
|
|
5136
|
+
disableKeyboardA11y,
|
|
5137
|
+
ariaLiveMessage,
|
|
5138
|
+
ariaLabelConfig,
|
|
5139
|
+
get ARIA_EDGE_DESC_KEY() {
|
|
5140
|
+
return ARIA_EDGE_DESC_KEY;
|
|
5141
|
+
},
|
|
5142
|
+
get ARIA_LIVE_MESSAGE() {
|
|
5143
|
+
return ARIA_LIVE_MESSAGE;
|
|
5144
|
+
},
|
|
5145
|
+
get ARIA_NODE_DESC_KEY() {
|
|
5146
|
+
return ARIA_NODE_DESC_KEY;
|
|
5147
|
+
}
|
|
5148
|
+
};
|
|
5149
|
+
Object.defineProperty(__returned__, "__isScriptSetup", {
|
|
5150
|
+
enumerable: false,
|
|
5151
|
+
value: true
|
|
5152
|
+
});
|
|
5153
|
+
return __returned__;
|
|
5154
|
+
}
|
|
5155
|
+
});
|
|
5156
|
+
const _hoisted_1$5 = ["id"];
|
|
5157
|
+
const _hoisted_2 = ["id"];
|
|
5158
|
+
const _hoisted_3 = ["id"];
|
|
5159
|
+
function _sfc_render$11(_ctx, _cache, $props, $setup, $data, $options) {
|
|
5160
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
5161
|
+
createElementVNode("div", {
|
|
5162
|
+
id: `${$setup.ARIA_NODE_DESC_KEY}-${$setup.id}`,
|
|
5163
|
+
style: { "display": "none" }
|
|
5164
|
+
}, toDisplayString($setup.disableKeyboardA11y ? $setup.ariaLabelConfig["node.a11yDescription.default"] : $setup.ariaLabelConfig["node.a11yDescription.keyboardDisabled"]), 9, _hoisted_1$5),
|
|
5165
|
+
createElementVNode("div", {
|
|
5166
|
+
id: `${$setup.ARIA_EDGE_DESC_KEY}-${$setup.id}`,
|
|
5167
|
+
style: { "display": "none" }
|
|
5168
|
+
}, toDisplayString($setup.ariaLabelConfig["edge.a11yDescription.default"]), 9, _hoisted_2),
|
|
5169
|
+
!$setup.disableKeyboardA11y ? (openBlock(), createElementBlock("div", {
|
|
5170
|
+
key: 0,
|
|
5171
|
+
id: `${$setup.ARIA_LIVE_MESSAGE}-${$setup.id}`,
|
|
5172
|
+
"aria-live": "assertive",
|
|
5173
|
+
"aria-atomic": "true",
|
|
5174
|
+
style: {
|
|
5175
|
+
"position": "absolute",
|
|
5176
|
+
"width": "1px",
|
|
5177
|
+
"height": "1px",
|
|
5178
|
+
"margin": "-1px",
|
|
5179
|
+
"border": "0",
|
|
5180
|
+
"padding": "0",
|
|
5181
|
+
"overflow": "hidden",
|
|
5182
|
+
"clip": "rect(0px, 0px, 0px, 0px)",
|
|
5183
|
+
"clip-path": "inset(100%)"
|
|
5184
|
+
}
|
|
5185
|
+
}, toDisplayString($setup.ariaLiveMessage), 9, _hoisted_3)) : createCommentVNode("v-if", true)
|
|
5186
|
+
], 64);
|
|
5187
|
+
}
|
|
5188
|
+
var A11yDescriptions_default = /* @__PURE__ */ export_helper_default(_sfc_main$11, [["render", _sfc_render$11], ["__file", "/Users/moritz/xyflow/xyflow/packages/vue/src/components/A11y/A11yDescriptions.vue"]]);
|
|
5189
|
+
//#endregion
|
|
5077
5190
|
//#region src/composables/useOnInitHandler.ts
|
|
5078
5191
|
/**
|
|
5079
5192
|
* Composable that handles the initialization of the viewport.
|
|
@@ -7474,6 +7587,37 @@ function connectionLineProps() {
|
|
|
7474
7587
|
};
|
|
7475
7588
|
}
|
|
7476
7589
|
//#endregion
|
|
7477
|
-
|
|
7590
|
+
//#region src/utils/edges.ts
|
|
7591
|
+
const defaultOnError = createDevWarn("Vue Flow", "https://vueflow.dev/");
|
|
7592
|
+
/**
|
|
7593
|
+
* Adds a `Connection` (or a full `Edge`) to an edges array and returns a new array — generating the
|
|
7594
|
+
* edge id and skipping the add when an equivalent connection already exists. The pure helper to use
|
|
7595
|
+
* in an `@connect` handler against a `v-model:edges` array, e.g.
|
|
7596
|
+
* `edges.value = addEdge(connection, edges.value)`, with no store/instance access.
|
|
7597
|
+
*
|
|
7598
|
+
* Mirrors xyflow/react's + xyflow/svelte's `addEdge`.
|
|
7599
|
+
*/
|
|
7600
|
+
function addEdge(edgeParams, edges, options = {}) {
|
|
7601
|
+
return addEdge$1(edgeParams, edges, {
|
|
7602
|
+
...options,
|
|
7603
|
+
onError: options.onError ?? defaultOnError
|
|
7604
|
+
});
|
|
7605
|
+
}
|
|
7606
|
+
/**
|
|
7607
|
+
* Reconnects an existing edge to a new `Connection`, returning a new edges array. The pure,
|
|
7608
|
+
* controlled counterpart to the store action `useVueFlow().reconnectEdge` — use it in an
|
|
7609
|
+
* `@reconnect` handler against a `v-model:edges` array, e.g.
|
|
7610
|
+
* `edges.value = reconnectEdge(oldEdge, newConnection, edges.value)`.
|
|
7611
|
+
*
|
|
7612
|
+
* Mirrors xyflow/react's `reconnectEdge`.
|
|
7613
|
+
*/
|
|
7614
|
+
function reconnectEdge(oldEdge, newConnection, edges, options = { shouldReplaceId: true }) {
|
|
7615
|
+
return reconnectEdge$1(oldEdge, newConnection, edges, {
|
|
7616
|
+
...options,
|
|
7617
|
+
onError: options.onError ?? defaultOnError
|
|
7618
|
+
});
|
|
7619
|
+
}
|
|
7620
|
+
//#endregion
|
|
7621
|
+
export { Background_default as Background, BaseEdge_default as BaseEdge, BezierEdge, ConnectionLineType, ConnectionMode, ControlButton_default as ControlButton, Controls_default as Controls, EdgeLabelRenderer_default as EdgeLabelRenderer, EdgeText_default as EdgeText, EdgeToolbar_default as EdgeToolbar, ErrorCode, Handle_default as Handle, MarkerType, MiniMap_default as MiniMap, MiniMapNode_default as MiniMapNode, NodeId as NodeIdInjection, ResizeControl_default as NodeResizeControl, NodeResizer_default as NodeResizer, NodeToolbar_default as NodeToolbar, PanOnScrollMode, Panel_default as Panel, Position, ResizeControlVariant, SelectionMode, SimpleBezierEdge, Slots, SmoothStepEdge, StepEdge, StraightEdge, VueFlow_default as VueFlow, VueFlowError, VueFlow as VueFlowInjection, VueFlowProvider_default as VueFlowProvider, addEdge, applyChanges, applyEdgeChanges, applyNodeChanges, clamp, connectionExists, connectionLineProps, defaultEdgeTypes, defaultNodeTypes, edgeProps, getBezierEdgeCenter, getBezierPath, getBoundsOfBoxes, getBoundsOfRects, getConnectedEdges, getConnectionStatus, getIncomers, getMarkerId, getNodesBounds, getNodesInside, getOutgoers, getSimpleBezierPath, getSmoothStepPath, getStraightPath, getViewportForBounds, isEdge, isEdgeBase, isErrorOfType, isInternalNode, isInternalNodeBase, isMacOs, isNode, isNodeBase, nodeProps, pointToRendererPoint, reconnectEdge, rendererPointToPoint, setupVueFlow, storeToRefs, useConnection, useEdge, useEdgesData, useHandle, useInternalNode, useKeyPress, useNode, useNodeConnections, useNodeId, useNodesData, useNodesInitialized, useStore, useVueFlow };
|
|
7478
7622
|
|
|
7479
7623
|
//# sourceMappingURL=index.mjs.map
|