@xyflow/vue 2.0.0-next.0 → 2.0.0-next.1
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 +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +26 -33
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +26 -33
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2565,18 +2565,6 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
2565
2565
|
"data-nodeid": nodeId,
|
|
2566
2566
|
"data-handlepos": __props.position
|
|
2567
2567
|
}));
|
|
2568
|
-
const isConnectableStart = toRef(() => typeof __props.connectableStart !== "undefined" ? __props.connectableStart : true);
|
|
2569
|
-
const isConnectableEnd = toRef(() => typeof __props.connectableEnd !== "undefined" ? __props.connectableEnd : true);
|
|
2570
|
-
const connectionInProcess = toRef(() => store.connectionStartHandle !== null);
|
|
2571
|
-
const clickConnectionInProcess = toRef(() => store.connectionClickStartHandle !== null);
|
|
2572
|
-
const isPossibleEndHandle = toRef(() => {
|
|
2573
|
-
const fromHandle = store.connectionStartHandle;
|
|
2574
|
-
return store.connectionMode === ConnectionMode$1.Strict ? fromHandle?.type !== type.value : nodeId !== fromHandle?.nodeId || __props.id !== fromHandle?.id;
|
|
2575
|
-
});
|
|
2576
|
-
const isClickConnecting = toRef(() => store.connectionClickStartHandle?.nodeId === nodeId && store.connectionClickStartHandle?.id === __props.id && store.connectionClickStartHandle?.type === type.value);
|
|
2577
|
-
const connectingFrom = toRef(() => store.connectionStartHandle?.nodeId === nodeId && store.connectionStartHandle?.id === __props.id && store.connectionStartHandle?.type === type.value);
|
|
2578
|
-
const connectingTo = toRef(() => store.connectionEndHandle?.nodeId === nodeId && store.connectionEndHandle?.id === __props.id && store.connectionEndHandle?.type === type.value);
|
|
2579
|
-
const valid = toRef(() => connectingTo.value && store.connectionStatus === "valid");
|
|
2580
2568
|
const { handlePointerDown, handleClick } = useHandle({
|
|
2581
2569
|
nodeId,
|
|
2582
2570
|
handleId: __props.id,
|
|
@@ -2597,6 +2585,28 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
2597
2585
|
if (typeof __props.isConnectable === "function") return nodeRef.value ? __props.isConnectable(nodeRef.value, connectedEdges.value) : false;
|
|
2598
2586
|
return isDef(__props.isConnectable) ? __props.isConnectable : store.nodesConnectable;
|
|
2599
2587
|
});
|
|
2588
|
+
const connectionClasses = computed((prev) => {
|
|
2589
|
+
const fromHandle = store.connectionStartHandle;
|
|
2590
|
+
const clickFromHandle = store.connectionClickStartHandle;
|
|
2591
|
+
const toHandle = store.connectionEndHandle;
|
|
2592
|
+
const handleType = type.value;
|
|
2593
|
+
const connectionInProcess = fromHandle !== null;
|
|
2594
|
+
const clickConnectionInProcess = clickFromHandle !== null;
|
|
2595
|
+
const isPossibleEndHandle = store.connectionMode === ConnectionMode$1.Strict ? fromHandle?.type !== handleType : nodeId !== fromHandle?.nodeId || __props.id !== fromHandle?.id;
|
|
2596
|
+
const connectingto = toHandle?.nodeId === nodeId && toHandle?.id === __props.id && toHandle?.type === handleType;
|
|
2597
|
+
const next = {
|
|
2598
|
+
connectable: isHandleConnectable.value,
|
|
2599
|
+
connecting: clickFromHandle?.nodeId === nodeId && clickFromHandle?.id === __props.id && clickFromHandle?.type === handleType,
|
|
2600
|
+
connectablestart: __props.connectableStart,
|
|
2601
|
+
connectableend: __props.connectableEnd,
|
|
2602
|
+
connectingfrom: fromHandle?.nodeId === nodeId && fromHandle?.id === __props.id && fromHandle?.type === handleType,
|
|
2603
|
+
connectingto,
|
|
2604
|
+
valid: connectingto && store.connectionStatus === "valid",
|
|
2605
|
+
connectionindicator: isHandleConnectable.value && (!connectionInProcess || isPossibleEndHandle) && (connectionInProcess || clickConnectionInProcess ? __props.connectableEnd : __props.connectableStart)
|
|
2606
|
+
};
|
|
2607
|
+
if (prev && prev.connectable === next.connectable && prev.connecting === next.connecting && prev.connectablestart === next.connectablestart && prev.connectableend === next.connectableend && prev.connectingfrom === next.connectingfrom && prev.connectingto === next.connectingto && prev.valid === next.valid && prev.connectionindicator === next.connectionindicator) return prev;
|
|
2608
|
+
return next;
|
|
2609
|
+
});
|
|
2600
2610
|
onMounted(() => {
|
|
2601
2611
|
const node = nodeRef.value;
|
|
2602
2612
|
if (!node || !nodeHasDimensions(node)) return;
|
|
@@ -2626,10 +2636,10 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
2626
2636
|
});
|
|
2627
2637
|
function onPointerDown(event) {
|
|
2628
2638
|
const isMouseTriggered = isMouseEvent(event);
|
|
2629
|
-
if (isHandleConnectable.value &&
|
|
2639
|
+
if (isHandleConnectable.value && __props.connectableStart && (isMouseTriggered && event.button === 0 || !isMouseTriggered)) handlePointerDown(event);
|
|
2630
2640
|
}
|
|
2631
2641
|
function onClick(event) {
|
|
2632
|
-
if (!nodeId || !store.connectionClickStartHandle && !
|
|
2642
|
+
if (!nodeId || !store.connectionClickStartHandle && !__props.connectableStart) return;
|
|
2633
2643
|
if (isHandleConnectable.value) handleClick(event);
|
|
2634
2644
|
}
|
|
2635
2645
|
__expose({
|
|
@@ -2650,18 +2660,10 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
|
|
|
2650
2660
|
connectedEdges,
|
|
2651
2661
|
handle,
|
|
2652
2662
|
handleDataIds,
|
|
2653
|
-
isConnectableStart,
|
|
2654
|
-
isConnectableEnd,
|
|
2655
|
-
connectionInProcess,
|
|
2656
|
-
clickConnectionInProcess,
|
|
2657
|
-
isPossibleEndHandle,
|
|
2658
|
-
isClickConnecting,
|
|
2659
|
-
connectingFrom,
|
|
2660
|
-
connectingTo,
|
|
2661
|
-
valid,
|
|
2662
2663
|
handlePointerDown,
|
|
2663
2664
|
handleClick,
|
|
2664
2665
|
isHandleConnectable,
|
|
2666
|
+
connectionClasses,
|
|
2665
2667
|
onPointerDown,
|
|
2666
2668
|
onClick
|
|
2667
2669
|
};
|
|
@@ -2682,16 +2684,7 @@ function _sfc_render$17(_ctx, _cache, $props, $setup, $data, $options) {
|
|
|
2682
2684
|
$setup.store.noDragClassName,
|
|
2683
2685
|
$setup.store.noPanClassName,
|
|
2684
2686
|
$setup.type,
|
|
2685
|
-
|
|
2686
|
-
connectable: $setup.isHandleConnectable,
|
|
2687
|
-
connecting: $setup.isClickConnecting,
|
|
2688
|
-
connectablestart: $setup.isConnectableStart,
|
|
2689
|
-
connectableend: $setup.isConnectableEnd,
|
|
2690
|
-
connectingfrom: $setup.connectingFrom,
|
|
2691
|
-
connectingto: $setup.connectingTo,
|
|
2692
|
-
valid: $setup.valid,
|
|
2693
|
-
connectionindicator: $setup.isHandleConnectable && (!$setup.connectionInProcess || $setup.isPossibleEndHandle) && ($setup.connectionInProcess || $setup.clickConnectionInProcess ? $setup.isConnectableEnd : $setup.isConnectableStart)
|
|
2694
|
-
}
|
|
2687
|
+
$setup.connectionClasses
|
|
2695
2688
|
]],
|
|
2696
2689
|
onMousedown: $setup.onPointerDown,
|
|
2697
2690
|
onTouchstartPassive: $setup.onPointerDown,
|