@inditextech/weave-sdk 5.2.2 → 5.3.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/sdk.js CHANGED
@@ -1659,7 +1659,8 @@ const WEAVE_NODES_SELECTION_DEFAULT_CONFIG = {
1659
1659
  };
1660
1660
  }
1661
1661
  },
1662
- style: { dragOpacity: .75 }
1662
+ style: { dragOpacity: .75 },
1663
+ selectionMode: "intersects"
1663
1664
  };
1664
1665
  //#endregion
1665
1666
  //#region ../../node_modules/lodash/_listCacheClear.js
@@ -4873,6 +4874,13 @@ function handlePointerMove(ctx, e) {
4873
4874
  //#endregion
4874
4875
  //#region src/plugins/nodes-selection/events/pointer-up.ts
4875
4876
  /**
4877
+ * Returns true when `inner` is fully enclosed within `outer` (an AABB
4878
+ * containment test, as opposed to mere overlap/intersection).
4879
+ */
4880
+ function isBoxContained(outer, inner) {
4881
+ return inner.x >= outer.x && inner.y >= outer.y && inner.x + inner.width <= outer.x + outer.width && inner.y + inner.height <= outer.y + outer.height;
4882
+ }
4883
+ /**
4876
4884
  * Handles the stage `pointerup` event: ends any in-progress area-selection
4877
4885
  * (including the node-filtering/commit step), or delegates to the click/tap
4878
4886
  * handler for point interactions.
@@ -4937,17 +4945,17 @@ function handlePointerUp(ctx, e) {
4937
4945
  });
4938
4946
  const box = ctx.getAreaSelector().getBox();
4939
4947
  ctx.getAreaSelector().getRect().visible(false);
4948
+ const selectionMode = ctx.getConfiguration().selectionMode ?? "intersects";
4940
4949
  const selected = shapes.filter((shape) => {
4941
4950
  const shapeMutex = weave.getNodeMutexLock(shape.id());
4942
4951
  if (shapeMutex && shapeMutex.user.id !== actUser.id) return false;
4943
4952
  let parent = weave.getInstanceRecursive(shape.getParent());
4944
4953
  if (parent.getAttrs().nodeId) parent = stage.findOne(`#${parent.getAttrs().nodeId}`);
4945
- if (shape.getAttrs().nodeType && shape.getAttrs().nodeType === "frame") {
4946
- const frameBox = shape.getClientRect();
4947
- return frameBox.x >= box.x && frameBox.y >= box.y && frameBox.x + frameBox.width <= box.x + box.width && frameBox.y + frameBox.height <= box.y + box.height;
4954
+ if (shape.getAttrs().nodeType && shape.getAttrs().nodeType === "frame") return isBoxContained(box, shape.getClientRect());
4955
+ if (shape.getAttrs().nodeType && ["layer", "frame"].includes(parent?.getAttrs().nodeType)) {
4956
+ const shapeBox = shape.getClientRect();
4957
+ return selectionMode === "contains" ? isBoxContained(box, shapeBox) : Konva.Util.haveIntersection(box, shapeBox);
4948
4958
  }
4949
- if (shape.getAttrs().nodeType && shape?.getAttrs().nodeType === "group" && ["layer", "frame"].includes(parent?.getAttrs().nodeType)) return shape.getAttrs().nodeType && Konva.Util.haveIntersection(box, shape.getClientRect());
4950
- if (shape.getAttrs().nodeType && shape.getAttrs().nodeType !== "group" && ["layer", "frame"].includes(parent?.getAttrs().nodeType)) return shape.getAttrs().nodeType && Konva.Util.haveIntersection(box, shape.getClientRect());
4951
4959
  return false;
4952
4960
  });
4953
4961
  const selectedNodes = /* @__PURE__ */ new Set();
@@ -9449,7 +9457,7 @@ var WeaveRegisterManager = class {
9449
9457
  };
9450
9458
  //#endregion
9451
9459
  //#region package.json
9452
- var version = "5.2.2";
9460
+ var version = "5.3.0";
9453
9461
  //#endregion
9454
9462
  //#region src/managers/setup.ts
9455
9463
  var WeaveSetupManager = class {
package/dist/sdk.node.js CHANGED
@@ -1662,7 +1662,8 @@ const WEAVE_NODES_SELECTION_DEFAULT_CONFIG = {
1662
1662
  };
1663
1663
  }
1664
1664
  },
1665
- style: { dragOpacity: .75 }
1665
+ style: { dragOpacity: .75 },
1666
+ selectionMode: "intersects"
1666
1667
  };
1667
1668
  //#endregion
1668
1669
  //#region ../../node_modules/lodash/_listCacheClear.js
@@ -4876,6 +4877,13 @@ function handlePointerMove(ctx, e) {
4876
4877
  //#endregion
4877
4878
  //#region src/plugins/nodes-selection/events/pointer-up.ts
4878
4879
  /**
4880
+ * Returns true when `inner` is fully enclosed within `outer` (an AABB
4881
+ * containment test, as opposed to mere overlap/intersection).
4882
+ */
4883
+ function isBoxContained(outer, inner) {
4884
+ return inner.x >= outer.x && inner.y >= outer.y && inner.x + inner.width <= outer.x + outer.width && inner.y + inner.height <= outer.y + outer.height;
4885
+ }
4886
+ /**
4879
4887
  * Handles the stage `pointerup` event: ends any in-progress area-selection
4880
4888
  * (including the node-filtering/commit step), or delegates to the click/tap
4881
4889
  * handler for point interactions.
@@ -4940,17 +4948,17 @@ function handlePointerUp(ctx, e) {
4940
4948
  });
4941
4949
  const box = ctx.getAreaSelector().getBox();
4942
4950
  ctx.getAreaSelector().getRect().visible(false);
4951
+ const selectionMode = ctx.getConfiguration().selectionMode ?? "intersects";
4943
4952
  const selected = shapes.filter((shape) => {
4944
4953
  const shapeMutex = weave.getNodeMutexLock(shape.id());
4945
4954
  if (shapeMutex && shapeMutex.user.id !== actUser.id) return false;
4946
4955
  let parent = weave.getInstanceRecursive(shape.getParent());
4947
4956
  if (parent.getAttrs().nodeId) parent = stage.findOne(`#${parent.getAttrs().nodeId}`);
4948
- if (shape.getAttrs().nodeType && shape.getAttrs().nodeType === "frame") {
4949
- const frameBox = shape.getClientRect();
4950
- return frameBox.x >= box.x && frameBox.y >= box.y && frameBox.x + frameBox.width <= box.x + box.width && frameBox.y + frameBox.height <= box.y + box.height;
4957
+ if (shape.getAttrs().nodeType && shape.getAttrs().nodeType === "frame") return isBoxContained(box, shape.getClientRect());
4958
+ if (shape.getAttrs().nodeType && ["layer", "frame"].includes(parent?.getAttrs().nodeType)) {
4959
+ const shapeBox = shape.getClientRect();
4960
+ return selectionMode === "contains" ? isBoxContained(box, shapeBox) : Konva.Util.haveIntersection(box, shapeBox);
4951
4961
  }
4952
- if (shape.getAttrs().nodeType && shape?.getAttrs().nodeType === "group" && ["layer", "frame"].includes(parent?.getAttrs().nodeType)) return shape.getAttrs().nodeType && Konva.Util.haveIntersection(box, shape.getClientRect());
4953
- if (shape.getAttrs().nodeType && shape.getAttrs().nodeType !== "group" && ["layer", "frame"].includes(parent?.getAttrs().nodeType)) return shape.getAttrs().nodeType && Konva.Util.haveIntersection(box, shape.getClientRect());
4954
4962
  return false;
4955
4963
  });
4956
4964
  const selectedNodes = /* @__PURE__ */ new Set();
@@ -9452,7 +9460,7 @@ var WeaveRegisterManager = class {
9452
9460
  };
9453
9461
  //#endregion
9454
9462
  //#region package.json
9455
- var version = "5.2.2";
9463
+ var version = "5.3.0";
9456
9464
  //#endregion
9457
9465
  //#region src/managers/setup.ts
9458
9466
  var WeaveSetupManager = class {