@moda/om 21.2.0 → 21.2.1

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/index.esm.js CHANGED
@@ -12,7 +12,11 @@ function getAugmentedNamespace(n) {
12
12
  var f = n.default;
13
13
  if (typeof f == "function") {
14
14
  var a = function a () {
15
- if (this instanceof a) {
15
+ var isInstance = false;
16
+ try {
17
+ isInstance = this instanceof a;
18
+ } catch {}
19
+ if (isInstance) {
16
20
  return Reflect.construct(f, arguments, this.constructor);
17
21
  }
18
22
  return f.apply(this, arguments);
@@ -1677,13 +1681,14 @@ var RemoveScroll = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
1677
1681
  enabled = props.enabled,
1678
1682
  shards = props.shards,
1679
1683
  sideCar = props.sideCar,
1684
+ noRelative = props.noRelative,
1680
1685
  noIsolation = props.noIsolation,
1681
1686
  inert = props.inert,
1682
1687
  allowPinchZoom = props.allowPinchZoom,
1683
1688
  _b = props.as,
1684
1689
  Container = _b === void 0 ? 'div' : _b,
1685
1690
  gapMode = props.gapMode,
1686
- rest = __rest$a(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1691
+ rest = __rest$a(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1687
1692
  var SideCar = sideCar;
1688
1693
  var containerRef = useMergeRefs([ref, parentRef]);
1689
1694
  var containerProps = __assign$a(__assign$a({}, rest), callbacks);
@@ -1691,6 +1696,7 @@ var RemoveScroll = /*#__PURE__*/React.forwardRef(function (props, parentRef) {
1691
1696
  sideCar: effectCar$1,
1692
1697
  removeScrollBar: removeScrollBar,
1693
1698
  shards: shards,
1699
+ noRelative: noRelative,
1694
1700
  noIsolation: noIsolation,
1695
1701
  inert: inert,
1696
1702
  setCallbacks: setCallbacks,
@@ -4765,6 +4771,9 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
4765
4771
  var availableScroll = 0;
4766
4772
  var availableScrollTop = 0;
4767
4773
  do {
4774
+ if (!target) {
4775
+ break;
4776
+ }
4768
4777
  var _a = getScrollVariables(axis, target),
4769
4778
  position = _a[0],
4770
4779
  scroll_1 = _a[1],
@@ -4776,11 +4785,10 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
4776
4785
  availableScrollTop += position;
4777
4786
  }
4778
4787
  }
4779
- if (target instanceof ShadowRoot) {
4780
- target = target.host;
4781
- } else {
4782
- target = target.parentNode;
4783
- }
4788
+ var parent_1 = target.parentNode;
4789
+ // we will "bubble" from ShadowDom in case we are, or just to the parent in normal case
4790
+ // this is the same logic used in focus-lock
4791
+ target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
4784
4792
  } while (
4785
4793
  // portaled content
4786
4794
  !targetInLock && target !== document.body ||
@@ -4955,6 +4963,7 @@ function RemoveScrollSideCar(props) {
4955
4963
  return /*#__PURE__*/React.createElement(React.Fragment, null, inert ? /*#__PURE__*/React.createElement(Style, {
4956
4964
  styles: generateStyle(id)
4957
4965
  }) : null, removeScrollBar ? /*#__PURE__*/React.createElement(RemoveScrollBar, {
4966
+ noRelative: props.noRelative,
4958
4967
  gapMode: props.gapMode
4959
4968
  }) : null);
4960
4969
  }
@@ -6319,6 +6328,23 @@ function _filter(fn, list) {
6319
6328
  return result;
6320
6329
  }
6321
6330
 
6331
+ function _filterMap(fn, map) {
6332
+ var result = new Map();
6333
+ var iterator = map.entries();
6334
+ var current = iterator.next();
6335
+ while (!current.done) {
6336
+ if (fn(current.value[1])) {
6337
+ result.set(current.value[0], current.value[1]);
6338
+ }
6339
+ current = iterator.next();
6340
+ }
6341
+ return result;
6342
+ }
6343
+
6344
+ function _isMap(x) {
6345
+ return Object.prototype.toString.call(x) === '[object Map]';
6346
+ }
6347
+
6322
6348
  function _isObject(x) {
6323
6349
  return Object.prototype.toString.call(x) === '[object Object]';
6324
6350
  }
@@ -6344,7 +6370,7 @@ function _xfilter(f) {
6344
6370
  /**
6345
6371
  * Takes a predicate and a `Filterable`, and returns a new filterable of the
6346
6372
  * same type containing the members of the given filterable which satisfy the
6347
- * given predicate. Filterable objects include plain objects or any object
6373
+ * given predicate. Filterable objects include plain objects, Maps, or any object
6348
6374
  * that has a filter method such as `Array`.
6349
6375
  *
6350
6376
  * Dispatches to the `filter` method of the second argument, if present.
@@ -6375,7 +6401,7 @@ var filter = /*#__PURE__*/_curry2(/*#__PURE__*/_dispatchable(['fantasy-land/filt
6375
6401
  acc[key] = filterable[key];
6376
6402
  }
6377
6403
  return acc;
6378
- }, {}, keys(filterable)) :
6404
+ }, {}, keys(filterable)) : _isMap(filterable) ? _filterMap(pred, filterable) :
6379
6405
  // else
6380
6406
  _filter(pred, filterable);
6381
6407
  }));