react-sync-board 0.5.0 → 0.5.3

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/cjs/index.js CHANGED
@@ -7399,14 +7399,7 @@ var useItemInteraction = function useItemInteraction(interaction) {
7399
7399
  var setInteractions = recoil.useSetRecoilState(ItemInteractionsAtom);
7400
7400
  var register = React__default['default'].useCallback(function (callback) {
7401
7401
  setInteractions(function (prev) {
7402
- if (!prev[interaction]) {
7403
- // eslint-disable-next-line no-param-reassign
7404
- prev[interaction] = [];
7405
- }
7406
-
7407
- var newInter = _toConsumableArray(prev[interaction]);
7408
-
7409
- newInter.push(callback);
7402
+ var newInter = Array.isArray(prev[interaction]) ? [].concat(_toConsumableArray(prev[interaction]), [callback]) : [callback];
7410
7403
  return _objectSpread2(_objectSpread2({}, prev), {}, _defineProperty({}, interaction, newInter));
7411
7404
  });
7412
7405
  return function () {
@@ -8059,7 +8052,6 @@ var useItemActions = function useItemActions() {
8059
8052
  _ref19$passLocked,
8060
8053
  passLocked,
8061
8054
  foundElement,
8062
- isPassthrough,
8063
8055
  itemList,
8064
8056
  _yield$snapshot$getPr2,
8065
8057
  boardWrapper,
@@ -8086,35 +8078,40 @@ var useItemActions = function useItemActions() {
8086
8078
  foundElement = insideClass(target, "item");
8087
8079
 
8088
8080
  if (!foundElement) {
8089
- _context8.next = 27;
8081
+ _context8.next = 28;
8090
8082
  break;
8091
8083
  }
8092
8084
 
8093
- if (!(!passLocked && hasClass(foundElement, "locked"))) {
8085
+ if (!hasClass(foundElement, "selected")) {
8094
8086
  _context8.next = 8;
8095
8087
  break;
8096
8088
  }
8097
8089
 
8098
- return _context8.abrupt("return", null);
8090
+ return _context8.abrupt("return", foundElement);
8099
8091
 
8100
8092
  case 8:
8101
- // Is it a passthrough element?
8102
- isPassthrough = (hasClass(target, "passthrough") || !returnLocked && hasClass(foundElement, "locked")) && !hasClass(foundElement, "selected");
8093
+ if (!(!passLocked && hasClass(foundElement, "locked") && !hasClass(target, "passthrough"))) {
8094
+ _context8.next = 10;
8095
+ break;
8096
+ }
8103
8097
 
8104
- if (!isPassthrough) {
8105
- _context8.next = 27;
8098
+ return _context8.abrupt("return", returnLocked ? foundElement : null);
8099
+
8100
+ case 10:
8101
+ if (!hasClass(target, "passthrough")) {
8102
+ _context8.next = 28;
8106
8103
  break;
8107
8104
  }
8108
8105
 
8109
- _context8.next = 12;
8106
+ _context8.next = 13;
8110
8107
  return snapshot.getPromise(ItemListAtom);
8111
8108
 
8112
- case 12:
8109
+ case 13:
8113
8110
  itemList = _context8.sent;
8114
- _context8.next = 15;
8111
+ _context8.next = 16;
8115
8112
  return snapshot.getPromise(ConfigurationAtom);
8116
8113
 
8117
- case 15:
8114
+ case 16:
8118
8115
  _yield$snapshot$getPr2 = _context8.sent;
8119
8116
  boardWrapper = _yield$snapshot$getPr2.boardWrapper;
8120
8117
  // Found element under the cursor
@@ -8134,33 +8131,33 @@ var useItemActions = function useItemActions() {
8134
8131
 
8135
8132
  i = 0;
8136
8133
 
8137
- case 19:
8134
+ case 20:
8138
8135
  if (!(i < elems.length)) {
8139
- _context8.next = 26;
8136
+ _context8.next = 27;
8140
8137
  break;
8141
8138
  }
8142
8139
 
8143
8140
  elem = elems[i];
8144
8141
 
8145
- if (!(elem !== foundElement && (returnLocked || !hasClass(elem, "locked")))) {
8146
- _context8.next = 23;
8142
+ if (!(elem !== foundElement && (passLocked || !hasClass(elem, "locked")))) {
8143
+ _context8.next = 24;
8147
8144
  break;
8148
8145
  }
8149
8146
 
8150
8147
  return _context8.abrupt("return", elem);
8151
8148
 
8152
- case 23:
8149
+ case 24:
8153
8150
  i += 1;
8154
- _context8.next = 19;
8151
+ _context8.next = 20;
8155
8152
  break;
8156
8153
 
8157
- case 26:
8154
+ case 27:
8158
8155
  return _context8.abrupt("return", null);
8159
8156
 
8160
- case 27:
8157
+ case 28:
8161
8158
  return _context8.abrupt("return", foundElement);
8162
8159
 
8163
- case 28:
8160
+ case 29:
8164
8161
  case "end":
8165
8162
  return _context8.stop();
8166
8163
  }