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/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 () {
@@ -8051,7 +8044,6 @@ var useItemActions = function useItemActions() {
8051
8044
  _ref19$passLocked,
8052
8045
  passLocked,
8053
8046
  foundElement,
8054
- isPassthrough,
8055
8047
  itemList,
8056
8048
  _yield$snapshot$getPr2,
8057
8049
  boardWrapper,
@@ -8078,35 +8070,40 @@ var useItemActions = function useItemActions() {
8078
8070
  foundElement = insideClass(target, "item");
8079
8071
 
8080
8072
  if (!foundElement) {
8081
- _context8.next = 27;
8073
+ _context8.next = 28;
8082
8074
  break;
8083
8075
  }
8084
8076
 
8085
- if (!(!passLocked && hasClass(foundElement, "locked"))) {
8077
+ if (!hasClass(foundElement, "selected")) {
8086
8078
  _context8.next = 8;
8087
8079
  break;
8088
8080
  }
8089
8081
 
8090
- return _context8.abrupt("return", null);
8082
+ return _context8.abrupt("return", foundElement);
8091
8083
 
8092
8084
  case 8:
8093
- // Is it a passthrough element?
8094
- isPassthrough = (hasClass(target, "passthrough") || !returnLocked && hasClass(foundElement, "locked")) && !hasClass(foundElement, "selected");
8085
+ if (!(!passLocked && hasClass(foundElement, "locked") && !hasClass(target, "passthrough"))) {
8086
+ _context8.next = 10;
8087
+ break;
8088
+ }
8095
8089
 
8096
- if (!isPassthrough) {
8097
- _context8.next = 27;
8090
+ return _context8.abrupt("return", returnLocked ? foundElement : null);
8091
+
8092
+ case 10:
8093
+ if (!hasClass(target, "passthrough")) {
8094
+ _context8.next = 28;
8098
8095
  break;
8099
8096
  }
8100
8097
 
8101
- _context8.next = 12;
8098
+ _context8.next = 13;
8102
8099
  return snapshot.getPromise(ItemListAtom);
8103
8100
 
8104
- case 12:
8101
+ case 13:
8105
8102
  itemList = _context8.sent;
8106
- _context8.next = 15;
8103
+ _context8.next = 16;
8107
8104
  return snapshot.getPromise(ConfigurationAtom);
8108
8105
 
8109
- case 15:
8106
+ case 16:
8110
8107
  _yield$snapshot$getPr2 = _context8.sent;
8111
8108
  boardWrapper = _yield$snapshot$getPr2.boardWrapper;
8112
8109
  // Found element under the cursor
@@ -8126,33 +8123,33 @@ var useItemActions = function useItemActions() {
8126
8123
 
8127
8124
  i = 0;
8128
8125
 
8129
- case 19:
8126
+ case 20:
8130
8127
  if (!(i < elems.length)) {
8131
- _context8.next = 26;
8128
+ _context8.next = 27;
8132
8129
  break;
8133
8130
  }
8134
8131
 
8135
8132
  elem = elems[i];
8136
8133
 
8137
- if (!(elem !== foundElement && (returnLocked || !hasClass(elem, "locked")))) {
8138
- _context8.next = 23;
8134
+ if (!(elem !== foundElement && (passLocked || !hasClass(elem, "locked")))) {
8135
+ _context8.next = 24;
8139
8136
  break;
8140
8137
  }
8141
8138
 
8142
8139
  return _context8.abrupt("return", elem);
8143
8140
 
8144
- case 23:
8141
+ case 24:
8145
8142
  i += 1;
8146
- _context8.next = 19;
8143
+ _context8.next = 20;
8147
8144
  break;
8148
8145
 
8149
- case 26:
8146
+ case 27:
8150
8147
  return _context8.abrupt("return", null);
8151
8148
 
8152
- case 27:
8149
+ case 28:
8153
8150
  return _context8.abrupt("return", foundElement);
8154
8151
 
8155
- case 28:
8152
+ case 29:
8156
8153
  case "end":
8157
8154
  return _context8.stop();
8158
8155
  }