react-sync-board 0.5.1 → 0.5.4

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/esm/index.js CHANGED
@@ -7391,14 +7391,7 @@ var useItemInteraction = function useItemInteraction(interaction) {
7391
7391
  var setInteractions = useSetRecoilState(ItemInteractionsAtom);
7392
7392
  var register = React.useCallback(function (callback) {
7393
7393
  setInteractions(function (prev) {
7394
- if (!prev[interaction]) {
7395
- // eslint-disable-next-line no-param-reassign
7396
- prev[interaction] = [];
7397
- }
7398
-
7399
- var newInter = _toConsumableArray(prev[interaction]);
7400
-
7401
- newInter.push(callback);
7394
+ var newInter = Array.isArray(prev[interaction]) ? [].concat(_toConsumableArray(prev[interaction]), [callback]) : [callback];
7402
7395
  return _objectSpread2(_objectSpread2({}, prev), {}, _defineProperty({}, interaction, newInter));
7403
7396
  });
7404
7397
  return function () {
@@ -7638,8 +7631,14 @@ var useItemActions = function useItemActions() {
7638
7631
 
7639
7632
  var _ref7 = item.grid || {},
7640
7633
  itemType = _ref7.type,
7641
- itemSize = _ref7.size;
7642
-
7634
+ itemSize = _ref7.size,
7635
+ _ref7$offset = _ref7.offset;
7636
+
7637
+ _ref7$offset = _ref7$offset === void 0 ? {} : _ref7$offset;
7638
+ var _ref7$offset$x = _ref7$offset.x,
7639
+ offsetX = _ref7$offset$x === void 0 ? 0 : _ref7$offset$x,
7640
+ _ref7$offset$y = _ref7$offset.y,
7641
+ offsetY = _ref7$offset$y === void 0 ? 0 : _ref7$offset$y;
7643
7642
  var type = globalType;
7644
7643
  var size = globalSize || 1; // If item specific
7645
7644
 
@@ -7714,8 +7713,8 @@ var useItemActions = function useItemActions() {
7714
7713
  }
7715
7714
 
7716
7715
  result[id] = _objectSpread2(_objectSpread2({}, item), {}, {
7717
- x: newX - elem.clientWidth / 2,
7718
- y: newY - elem.clientHeight / 2
7716
+ x: newX + offsetX - elem.clientWidth / 2,
7717
+ y: newY + offsetY - elem.clientHeight / 2
7719
7718
  });
7720
7719
  updatedItems[id] = result[id];
7721
7720
  });
@@ -8051,7 +8050,6 @@ var useItemActions = function useItemActions() {
8051
8050
  _ref19$passLocked,
8052
8051
  passLocked,
8053
8052
  foundElement,
8054
- isPassthrough,
8055
8053
  itemList,
8056
8054
  _yield$snapshot$getPr2,
8057
8055
  boardWrapper,
@@ -8078,35 +8076,40 @@ var useItemActions = function useItemActions() {
8078
8076
  foundElement = insideClass(target, "item");
8079
8077
 
8080
8078
  if (!foundElement) {
8081
- _context8.next = 27;
8079
+ _context8.next = 28;
8082
8080
  break;
8083
8081
  }
8084
8082
 
8085
- if (!(!passLocked && hasClass(foundElement, "locked") && !hasClass(foundElement, "selected"))) {
8083
+ if (!hasClass(foundElement, "selected")) {
8086
8084
  _context8.next = 8;
8087
8085
  break;
8088
8086
  }
8089
8087
 
8090
- return _context8.abrupt("return", null);
8088
+ return _context8.abrupt("return", foundElement);
8091
8089
 
8092
8090
  case 8:
8093
- // Is it a passthrough element?
8094
- isPassthrough = (hasClass(target, "passthrough") || !returnLocked && hasClass(foundElement, "locked")) && !hasClass(foundElement, "selected");
8091
+ if (!(!passLocked && hasClass(foundElement, "locked") && !hasClass(target, "passthrough"))) {
8092
+ _context8.next = 10;
8093
+ break;
8094
+ }
8095
8095
 
8096
- if (!isPassthrough) {
8097
- _context8.next = 27;
8096
+ return _context8.abrupt("return", returnLocked ? foundElement : null);
8097
+
8098
+ case 10:
8099
+ if (!hasClass(target, "passthrough")) {
8100
+ _context8.next = 28;
8098
8101
  break;
8099
8102
  }
8100
8103
 
8101
- _context8.next = 12;
8104
+ _context8.next = 13;
8102
8105
  return snapshot.getPromise(ItemListAtom);
8103
8106
 
8104
- case 12:
8107
+ case 13:
8105
8108
  itemList = _context8.sent;
8106
- _context8.next = 15;
8109
+ _context8.next = 16;
8107
8110
  return snapshot.getPromise(ConfigurationAtom);
8108
8111
 
8109
- case 15:
8112
+ case 16:
8110
8113
  _yield$snapshot$getPr2 = _context8.sent;
8111
8114
  boardWrapper = _yield$snapshot$getPr2.boardWrapper;
8112
8115
  // Found element under the cursor
@@ -8126,33 +8129,33 @@ var useItemActions = function useItemActions() {
8126
8129
 
8127
8130
  i = 0;
8128
8131
 
8129
- case 19:
8132
+ case 20:
8130
8133
  if (!(i < elems.length)) {
8131
- _context8.next = 26;
8134
+ _context8.next = 27;
8132
8135
  break;
8133
8136
  }
8134
8137
 
8135
8138
  elem = elems[i];
8136
8139
 
8137
- if (!(elem !== foundElement && (returnLocked || !hasClass(elem, "locked")))) {
8138
- _context8.next = 23;
8140
+ if (!(elem !== foundElement && (passLocked || !hasClass(elem, "locked")))) {
8141
+ _context8.next = 24;
8139
8142
  break;
8140
8143
  }
8141
8144
 
8142
8145
  return _context8.abrupt("return", elem);
8143
8146
 
8144
- case 23:
8147
+ case 24:
8145
8148
  i += 1;
8146
- _context8.next = 19;
8149
+ _context8.next = 20;
8147
8150
  break;
8148
8151
 
8149
- case 26:
8152
+ case 27:
8150
8153
  return _context8.abrupt("return", null);
8151
8154
 
8152
- case 27:
8155
+ case 28:
8153
8156
  return _context8.abrupt("return", foundElement);
8154
8157
 
8155
- case 28:
8158
+ case 29:
8156
8159
  case "end":
8157
8160
  return _context8.stop();
8158
8161
  }