@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.cjs.js CHANGED
@@ -32,7 +32,11 @@ function getAugmentedNamespace(n) {
32
32
  var f = n.default;
33
33
  if (typeof f == "function") {
34
34
  var a = function a () {
35
- if (this instanceof a) {
35
+ var isInstance = false;
36
+ try {
37
+ isInstance = this instanceof a;
38
+ } catch {}
39
+ if (isInstance) {
36
40
  return Reflect.construct(f, arguments, this.constructor);
37
41
  }
38
42
  return f.apply(this, arguments);
@@ -1697,13 +1701,14 @@ var RemoveScroll = /*#__PURE__*/React__namespace.forwardRef(function (props, par
1697
1701
  enabled = props.enabled,
1698
1702
  shards = props.shards,
1699
1703
  sideCar = props.sideCar,
1704
+ noRelative = props.noRelative,
1700
1705
  noIsolation = props.noIsolation,
1701
1706
  inert = props.inert,
1702
1707
  allowPinchZoom = props.allowPinchZoom,
1703
1708
  _b = props.as,
1704
1709
  Container = _b === void 0 ? 'div' : _b,
1705
1710
  gapMode = props.gapMode,
1706
- rest = __rest$a(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1711
+ rest = __rest$a(props, ["forwardProps", "children", "className", "removeScrollBar", "enabled", "shards", "sideCar", "noRelative", "noIsolation", "inert", "allowPinchZoom", "as", "gapMode"]);
1707
1712
  var SideCar = sideCar;
1708
1713
  var containerRef = useMergeRefs([ref, parentRef]);
1709
1714
  var containerProps = __assign$a(__assign$a({}, rest), callbacks);
@@ -1711,6 +1716,7 @@ var RemoveScroll = /*#__PURE__*/React__namespace.forwardRef(function (props, par
1711
1716
  sideCar: effectCar$1,
1712
1717
  removeScrollBar: removeScrollBar,
1713
1718
  shards: shards,
1719
+ noRelative: noRelative,
1714
1720
  noIsolation: noIsolation,
1715
1721
  inert: inert,
1716
1722
  setCallbacks: setCallbacks,
@@ -4785,6 +4791,9 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
4785
4791
  var availableScroll = 0;
4786
4792
  var availableScrollTop = 0;
4787
4793
  do {
4794
+ if (!target) {
4795
+ break;
4796
+ }
4788
4797
  var _a = getScrollVariables(axis, target),
4789
4798
  position = _a[0],
4790
4799
  scroll_1 = _a[1],
@@ -4796,11 +4805,10 @@ var handleScroll = function handleScroll(axis, endTarget, event, sourceDelta, no
4796
4805
  availableScrollTop += position;
4797
4806
  }
4798
4807
  }
4799
- if (target instanceof ShadowRoot) {
4800
- target = target.host;
4801
- } else {
4802
- target = target.parentNode;
4803
- }
4808
+ var parent_1 = target.parentNode;
4809
+ // we will "bubble" from ShadowDom in case we are, or just to the parent in normal case
4810
+ // this is the same logic used in focus-lock
4811
+ target = parent_1 && parent_1.nodeType === Node.DOCUMENT_FRAGMENT_NODE ? parent_1.host : parent_1;
4804
4812
  } while (
4805
4813
  // portaled content
4806
4814
  !targetInLock && target !== document.body ||
@@ -4975,6 +4983,7 @@ function RemoveScrollSideCar(props) {
4975
4983
  return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, inert ? /*#__PURE__*/React__namespace.createElement(Style, {
4976
4984
  styles: generateStyle(id)
4977
4985
  }) : null, removeScrollBar ? /*#__PURE__*/React__namespace.createElement(RemoveScrollBar, {
4986
+ noRelative: props.noRelative,
4978
4987
  gapMode: props.gapMode
4979
4988
  }) : null);
4980
4989
  }
@@ -6339,6 +6348,23 @@ function _filter(fn, list) {
6339
6348
  return result;
6340
6349
  }
6341
6350
 
6351
+ function _filterMap(fn, map) {
6352
+ var result = new Map();
6353
+ var iterator = map.entries();
6354
+ var current = iterator.next();
6355
+ while (!current.done) {
6356
+ if (fn(current.value[1])) {
6357
+ result.set(current.value[0], current.value[1]);
6358
+ }
6359
+ current = iterator.next();
6360
+ }
6361
+ return result;
6362
+ }
6363
+
6364
+ function _isMap(x) {
6365
+ return Object.prototype.toString.call(x) === '[object Map]';
6366
+ }
6367
+
6342
6368
  function _isObject(x) {
6343
6369
  return Object.prototype.toString.call(x) === '[object Object]';
6344
6370
  }
@@ -6364,7 +6390,7 @@ function _xfilter(f) {
6364
6390
  /**
6365
6391
  * Takes a predicate and a `Filterable`, and returns a new filterable of the
6366
6392
  * same type containing the members of the given filterable which satisfy the
6367
- * given predicate. Filterable objects include plain objects or any object
6393
+ * given predicate. Filterable objects include plain objects, Maps, or any object
6368
6394
  * that has a filter method such as `Array`.
6369
6395
  *
6370
6396
  * Dispatches to the `filter` method of the second argument, if present.
@@ -6395,7 +6421,7 @@ var filter = /*#__PURE__*/_curry2(/*#__PURE__*/_dispatchable(['fantasy-land/filt
6395
6421
  acc[key] = filterable[key];
6396
6422
  }
6397
6423
  return acc;
6398
- }, {}, keys(filterable)) :
6424
+ }, {}, keys(filterable)) : _isMap(filterable) ? _filterMap(pred, filterable) :
6399
6425
  // else
6400
6426
  _filter(pred, filterable);
6401
6427
  }));