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