microboard-ui-temp 0.1.124 → 0.1.126

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.
Files changed (3) hide show
  1. package/dist/index.js +31 -14
  2. package/dist/spa.js +31 -14
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -274086,10 +274086,10 @@ class Select extends Tool {
274086
274086
  return false;
274087
274087
  }
274088
274088
  const draggingMbr = draggingItem.getMbr();
274089
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
274090
- frames.forEach((frame) => {
274091
- if (frame.handleNesting(draggingItem)) {
274092
- this.nestingHighlighter.add(frame, draggingItem);
274089
+ const groups = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => !!(("index" in item) && item.index));
274090
+ groups.forEach((group) => {
274091
+ if (group.handleNesting(draggingItem)) {
274092
+ this.nestingHighlighter.add(group, draggingItem);
274093
274093
  } else {
274094
274094
  this.nestingHighlighter.remove(draggingItem);
274095
274095
  }
@@ -274140,13 +274140,13 @@ class Select extends Tool {
274140
274140
  }
274141
274141
  }
274142
274142
  updateFramesNesting(selectionMbr, selection) {
274143
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
274144
- const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
274143
+ const groups = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => !!(("index" in item) && item.index)).filter((group) => !selection.items.list().includes(group));
274144
+ const draggingGroupsIds = selection.list().filter((item) => !!(("index" in item) && item.index)).map((group) => group.getId());
274145
274145
  selection.list().forEach((item) => {
274146
- if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
274147
- frames.forEach((frame) => {
274148
- if (frame.handleNesting(item)) {
274149
- this.nestingHighlighter.add(frame, item);
274146
+ if (!(("index" in item) && item.index) && !draggingGroupsIds.includes(item.parent)) {
274147
+ groups.forEach((group) => {
274148
+ if (group.handleNesting(item)) {
274149
+ this.nestingHighlighter.add(group, item);
274150
274150
  } else {
274151
274151
  this.nestingHighlighter.remove(item);
274152
274152
  }
@@ -276383,8 +276383,25 @@ class AddScreen extends ShapeTool {
276383
276383
  super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
276384
276384
  }
276385
276385
  pointerUp() {
276386
- this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
276387
- return super.pointerUp();
276386
+ let screenOwnerId = localStorage.getItem("currentUser") || localStorage.getItem("screenOwnerId");
276387
+ if (!screenOwnerId) {
276388
+ screenOwnerId = v4_default();
276389
+ localStorage.setItem("screenOwnerId", screenOwnerId);
276390
+ }
276391
+ this.item.applyOwnerId(screenOwnerId);
276392
+ const currMbr = this.item.getMbr();
276393
+ const screenChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.item.handleNesting(item));
276394
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
276395
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
276396
+ this.initTransformation(width2 / 100, height3 / 100);
276397
+ const screen = this.board.add(this.item);
276398
+ screen.emitNesting(screenChildren);
276399
+ this.isDown = false;
276400
+ this.board.selection.removeAll();
276401
+ this.board.selection.add(screen);
276402
+ this.board.tools.select();
276403
+ this.board.tools.publish();
276404
+ return true;
276388
276405
  }
276389
276406
  }
276390
276407
  var handPath = new Path2([
@@ -276513,7 +276530,7 @@ class Screen extends BaseItem {
276513
276530
  return;
276514
276531
  }
276515
276532
  this.path.render(context);
276516
- if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
276533
+ if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
276517
276534
  super.render(context);
276518
276535
  }
276519
276536
  }
@@ -279390,7 +279407,7 @@ function updateFrameChildren({
279390
279407
  }) {
279391
279408
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
279392
279409
  board.selection.items.list().forEach((item) => {
279393
- if ("getChildrenIds" in item && item.getChildrenIds()) {
279410
+ if ("index" in item && item.index) {
279394
279411
  const currMbr = item.getMbr();
279395
279412
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
279396
279413
  itemsToCheck.forEach((currItem) => {
package/dist/spa.js CHANGED
@@ -274086,10 +274086,10 @@ class Select extends Tool {
274086
274086
  return false;
274087
274087
  }
274088
274088
  const draggingMbr = draggingItem.getMbr();
274089
- const frames = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => item instanceof Frame2);
274090
- frames.forEach((frame) => {
274091
- if (frame.handleNesting(draggingItem)) {
274092
- this.nestingHighlighter.add(frame, draggingItem);
274089
+ const groups = this.board.items.getEnclosedOrCrossed(draggingMbr.left, draggingMbr.top, draggingMbr.right, draggingMbr.bottom).filter((item) => !!(("index" in item) && item.index));
274090
+ groups.forEach((group) => {
274091
+ if (group.handleNesting(draggingItem)) {
274092
+ this.nestingHighlighter.add(group, draggingItem);
274093
274093
  } else {
274094
274094
  this.nestingHighlighter.remove(draggingItem);
274095
274095
  }
@@ -274140,13 +274140,13 @@ class Select extends Tool {
274140
274140
  }
274141
274141
  }
274142
274142
  updateFramesNesting(selectionMbr, selection) {
274143
- const frames = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => item instanceof Frame2).filter((frame) => !selection.items.list().includes(frame));
274144
- const draggingFramesIds = selection.list().filter((item) => item instanceof Frame2).map((frame) => frame.getId());
274143
+ const groups = this.board.items.getEnclosedOrCrossed(selectionMbr.left, selectionMbr.top, selectionMbr.right, selectionMbr.bottom).filter((item) => !!(("index" in item) && item.index)).filter((group) => !selection.items.list().includes(group));
274144
+ const draggingGroupsIds = selection.list().filter((item) => !!(("index" in item) && item.index)).map((group) => group.getId());
274145
274145
  selection.list().forEach((item) => {
274146
- if (!(item instanceof Frame2) && !draggingFramesIds.includes(item.parent)) {
274147
- frames.forEach((frame) => {
274148
- if (frame.handleNesting(item)) {
274149
- this.nestingHighlighter.add(frame, item);
274146
+ if (!(("index" in item) && item.index) && !draggingGroupsIds.includes(item.parent)) {
274147
+ groups.forEach((group) => {
274148
+ if (group.handleNesting(item)) {
274149
+ this.nestingHighlighter.add(group, item);
274150
274150
  } else {
274151
274151
  this.nestingHighlighter.remove(item);
274152
274152
  }
@@ -276383,8 +276383,25 @@ class AddScreen extends ShapeTool {
276383
276383
  super(board, name, Screen, { cursorName: "crosshair", fixedRatio: false });
276384
276384
  }
276385
276385
  pointerUp() {
276386
- this.item.applyOwnerId(localStorage.getItem("currentUser") || "");
276387
- return super.pointerUp();
276386
+ let screenOwnerId = localStorage.getItem("currentUser") || localStorage.getItem("screenOwnerId");
276387
+ if (!screenOwnerId) {
276388
+ screenOwnerId = v4_default();
276389
+ localStorage.setItem("screenOwnerId", screenOwnerId);
276390
+ }
276391
+ this.item.applyOwnerId(screenOwnerId);
276392
+ const currMbr = this.item.getMbr();
276393
+ const screenChildren = this.board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom).filter((item) => item.parent === "Board").filter((item) => this.item.handleNesting(item));
276394
+ const width2 = this.bounds.getWidth() < 2 ? 100 : this.bounds.getWidth();
276395
+ const height3 = this.bounds.getHeight() < 2 ? 100 : this.bounds.getHeight();
276396
+ this.initTransformation(width2 / 100, height3 / 100);
276397
+ const screen = this.board.add(this.item);
276398
+ screen.emitNesting(screenChildren);
276399
+ this.isDown = false;
276400
+ this.board.selection.removeAll();
276401
+ this.board.selection.add(screen);
276402
+ this.board.tools.select();
276403
+ this.board.tools.publish();
276404
+ return true;
276388
276405
  }
276389
276406
  }
276390
276407
  var handPath = new Path2([
@@ -276513,7 +276530,7 @@ class Screen extends BaseItem {
276513
276530
  return;
276514
276531
  }
276515
276532
  this.path.render(context);
276516
- if (localStorage.getItem("currentUser") === this.ownerId || !this.ownerId) {
276533
+ if (localStorage.getItem("currentUser") === this.ownerId || localStorage.getItem("screenOwnerId") === this.ownerId || !this.ownerId) {
276517
276534
  super.render(context);
276518
276535
  }
276519
276536
  }
@@ -279390,7 +279407,7 @@ function updateFrameChildren({
279390
279407
  }) {
279391
279408
  const groups = board.items.getGroupItemsEnclosedOrCrossed(mbr.left, mbr.top, mbr.right, mbr.bottom);
279392
279409
  board.selection.items.list().forEach((item) => {
279393
- if ("getChildrenIds" in item && item.getChildrenIds()) {
279410
+ if ("index" in item && item.index) {
279394
279411
  const currMbr = item.getMbr();
279395
279412
  const itemsToCheck = board.items.getEnclosedOrCrossed(currMbr.left, currMbr.top, currMbr.right, currMbr.bottom);
279396
279413
  itemsToCheck.forEach((currItem) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microboard-ui-temp",
3
- "version": "0.1.124",
3
+ "version": "0.1.126",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.js",
6
6
  "type": "module",
@@ -66,7 +66,7 @@
66
66
  "i18next-browser-languagedetector": "^8.2.0",
67
67
  "js-cookie": "^3.0.5",
68
68
  "jwt-decode": "^4.0.0",
69
- "microboard-temp": "^0.5.51",
69
+ "microboard-temp": "^0.5.53",
70
70
  "nanoid": "^5.1.5",
71
71
  "prop-types": "^15.8.1",
72
72
  "react-hot-toast": "2.4.1",