@onepercentio/one-ui 0.20.4 → 0.21.0

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.
Files changed (124) hide show
  1. package/.babelrc +6 -0
  2. package/.prod.babelrc +8 -2
  3. package/dist/assets/styles/variables.scss +1 -0
  4. package/dist/components/AdaptiveButton/AdaptiveButton.js +2 -2
  5. package/dist/components/AdaptiveContainer/AdaptiveContainer.js +28 -26
  6. package/dist/components/AdaptiveContainer/AdaptiveContainer.module.scss +3 -1
  7. package/dist/components/AdaptiveDialog/AdaptiveDialog.js +9 -9
  8. package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +14 -14
  9. package/dist/components/AnchoredTooltip/AnchoredTooltip.js +30 -30
  10. package/dist/components/AnimatedEntrance/AnimatedEntrance.d.ts +1 -1
  11. package/dist/components/AnimatedEntrance/AnimatedEntrance.js +34 -45
  12. package/dist/components/AsyncWrapper/AsyncWrapper.js +2 -2
  13. package/dist/components/Avatar/Avatar.js +4 -4
  14. package/dist/components/BucketFill/BucketFill.js +9 -9
  15. package/dist/components/Button/Button.js +4 -4
  16. package/dist/components/Card/Card.js +1 -1
  17. package/dist/components/Chart/Chart.view.js +34 -34
  18. package/dist/components/CheckBox/CheckBox.js +3 -3
  19. package/dist/components/Collapsable/Collapsable.js +18 -18
  20. package/dist/components/Countdown/Countdown.js +16 -16
  21. package/dist/components/Divider/Divider.js +1 -1
  22. package/dist/components/EmailInput/EmailInput.d.ts +1 -1
  23. package/dist/components/EmailInput/EmailInput.js +4 -4
  24. package/dist/components/FadeIn/FadeIn.js +9 -9
  25. package/dist/components/FileInput/FileInput.js +6 -6
  26. package/dist/components/FileInput/View/BigFactory/BigFactory.js +1 -1
  27. package/dist/components/FileInput/View/Compact/Compact.js +6 -6
  28. package/dist/components/FlowController/FlowController.js +4 -4
  29. package/dist/components/Form/Form.js +17 -28
  30. package/dist/components/Freeze/Freeze.js +1 -1
  31. package/dist/components/HSForms/HSForms.js +9 -11
  32. package/dist/components/Header/Header.js +7 -7
  33. package/dist/components/HeaderCloseBtn/HeaderCloseBtn.js +1 -1
  34. package/dist/components/InfinityScroll/InfinityScroll.js +25 -25
  35. package/dist/components/Input/Input.js +13 -13
  36. package/dist/components/InstantCounter/InstantCounter.js +9 -9
  37. package/dist/components/LavaLamp/LavaLamp.data.js +25 -25
  38. package/dist/components/LavaLamp/LavaLamp.js +7 -7
  39. package/dist/components/LavaLamp/v2/LavaLamp.js +29 -45
  40. package/dist/components/LinkToId/LinkToId.js +7 -7
  41. package/dist/components/Loader/Loader.js +2 -2
  42. package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.js +6 -6
  43. package/dist/components/LoopableVideo/LoopableVideo.js +4 -4
  44. package/dist/components/MainGrid/MainGrid.js +2 -2
  45. package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js +2 -2
  46. package/dist/components/Notification/Notification.js +1 -1
  47. package/dist/components/OrderableList/OrderableList.js +113 -138
  48. package/dist/components/PaginationIndicator/PaginationIndicator.js +50 -50
  49. package/dist/components/Parallax/Parallax.js +39 -39
  50. package/dist/components/Parallax/math/helpers.js +18 -19
  51. package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
  52. package/dist/components/PasswordInput/PasswordInput.js +10 -10
  53. package/dist/components/PingPongText/PingPongText.js +15 -15
  54. package/dist/components/PixelatedScan/PixelatedScan.js +19 -19
  55. package/dist/components/Portal/Portal.js +10 -10
  56. package/dist/components/ProgressBar/ProgressBar.js +6 -6
  57. package/dist/components/ProgressTexts/ProgressTexts.js +3 -3
  58. package/dist/components/Radio/Radio.js +3 -3
  59. package/dist/components/SectionContainer/SectionContainer.js +1 -1
  60. package/dist/components/Select/Select.js +13 -13
  61. package/dist/components/Select/Select.module.scss +8 -5
  62. package/dist/components/Skeleton/Skeleton.js +1 -1
  63. package/dist/components/Spacing/Spacing.js +1 -1
  64. package/dist/components/StaticScroller/StaticScroller.js +12 -12
  65. package/dist/components/Switch/Switch.js +2 -2
  66. package/dist/components/Table/Table.js +11 -11
  67. package/dist/components/Tabs/Tabs.d.ts +6 -1
  68. package/dist/components/Tabs/Tabs.js +28 -9
  69. package/dist/components/Tabs/Tabs.module.scss +20 -2
  70. package/dist/components/Text/Text.js +5 -5
  71. package/dist/components/Transition/MasksFactory/DiagonalReveal.js +5 -5
  72. package/dist/components/Transition/MasksFactory/DiagonalSquareToBalls.js +17 -17
  73. package/dist/components/Transition/MasksFactory/PhysicsSquares.js +13 -13
  74. package/dist/components/Transition/MasksFactory/SquareToBalls.js +9 -9
  75. package/dist/components/Transition/MasksFactory/utils.js +8 -8
  76. package/dist/components/Transition/Transition.js +49 -49
  77. package/dist/components/UncontrolledTransition/UncontrolledTransition.js +7 -7
  78. package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js +44 -82
  79. package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +6 -6
  80. package/dist/context/AsyncProcess.js +19 -42
  81. package/dist/context/CustomBrowserRouter.js +6 -6
  82. package/dist/context/OneUIProvider.js +15 -15
  83. package/dist/hooks/logs/useDependencyChangeDetection.js +2 -5
  84. package/dist/hooks/persistence/useLocalStorage.js +7 -7
  85. package/dist/hooks/shims/ObjectWatchShim.js +1 -15
  86. package/dist/hooks/ui/useAdaptiveImage.js +6 -6
  87. package/dist/hooks/ui/useBreakpoint.js +5 -5
  88. package/dist/hooks/ui/useCustomScrollbar.js +2 -2
  89. package/dist/hooks/ui/useMouseHover.js +4 -4
  90. package/dist/hooks/ui/usePaginationControls.js +34 -34
  91. package/dist/hooks/ui/useSnapToViewport.js +3 -3
  92. package/dist/hooks/ui/useTilt.js +38 -38
  93. package/dist/hooks/ui/useZoomable.js +20 -20
  94. package/dist/hooks/useAsyncControl.js +21 -38
  95. package/dist/hooks/useContainedRepositioning.js +22 -22
  96. package/dist/hooks/useCustomHistory.js +2 -2
  97. package/dist/hooks/useElementFit.js +6 -6
  98. package/dist/hooks/useFirestoreWatch.js +26 -39
  99. package/dist/hooks/useForm.js +8 -8
  100. package/dist/hooks/useFreeze.js +1 -1
  101. package/dist/hooks/useHero.d.ts +1 -0
  102. package/dist/hooks/useHero.js +132 -91
  103. package/dist/hooks/useHero.module.scss +7 -0
  104. package/dist/hooks/useIntersection.js +3 -3
  105. package/dist/hooks/useMergeRefs.js +3 -7
  106. package/dist/hooks/useObserve.js +5 -5
  107. package/dist/hooks/usePagination.js +39 -59
  108. package/dist/hooks/usePooledOperation.js +8 -22
  109. package/dist/hooks/usePooling.js +17 -33
  110. package/dist/hooks/useRebound.js +5 -5
  111. package/dist/hooks/useShortIntl.js +13 -13
  112. package/dist/hooks/utility/useEvents.js +5 -5
  113. package/dist/hooks/utility/useModule.js +3 -3
  114. package/dist/hooks/utility/useQuery.js +1 -1
  115. package/dist/models/DebugLogger.js +2 -2
  116. package/dist/models/GenericContract.js +1 -1
  117. package/dist/storybookUtils/index.js +1 -1
  118. package/dist/types.d.ts +11 -4
  119. package/dist/utility.d.js +3 -3
  120. package/dist/utils/blockchain.js +29 -102
  121. package/dist/utils/flatten.js +3 -3
  122. package/dist/utils/html.utils.js +1 -1
  123. package/package.json +2 -1
  124. package/src/types.ts +155 -41
@@ -10,25 +10,25 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
10
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
11
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
12
12
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
13
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
13
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
14
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
  /**
17
17
  * A hook to trigger changes when the screen resizes
18
18
  * @returns If the current resolution is lower than the specified width
19
19
  */
20
20
  function useBreakpoint(breakInto) {
21
- var _useState = (0, _react.useState)(function () {
21
+ const _useState = (0, _react.useState)(function () {
22
22
  return window.visualViewport.width < breakInto;
23
23
  }),
24
24
  _useState2 = _slicedToArray(_useState, 2),
25
25
  lowerThanBreakpoint = _useState2[0],
26
26
  setIsLowerThanBreakpoint = _useState2[1];
27
27
  (0, _react.useEffect)(function () {
28
- var onResizeThrottle = (0, _throttle.default)(function () {
28
+ const onResizeThrottle = (0, _throttle.default)(function () {
29
29
  setIsLowerThanBreakpoint(window.visualViewport.width < breakInto);
30
30
  }, 1000 / 4);
31
- var onResize = function onResize() {
31
+ const onResize = function onResize() {
32
32
  return onResizeThrottle();
33
33
  };
34
34
  window.addEventListener("resize", onResize);
@@ -8,12 +8,12 @@ var _react = require("react");
8
8
  var _useCustomScrollbarModule = _interopRequireDefault(require("./useCustomScrollbar.module.scss"));
9
9
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
10
  function useCustomScrollBar() {
11
- var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
11
+ let _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
12
12
  _ref$color = _ref.color,
13
13
  color = _ref$color === void 0 ? "" : _ref$color,
14
14
  _ref$propagate = _ref.propagate,
15
15
  propagate = _ref$propagate === void 0 ? false : _ref$propagate;
16
- var elRef = (0, _react.useRef)(null);
16
+ const elRef = (0, _react.useRef)(null);
17
17
  (0, _react.useLayoutEffect)(function () {
18
18
  elRef.current.style.setProperty("--scrollbar-color", color);
19
19
  elRef.current.classList.add(_useCustomScrollbarModule.default.scrollBarRoot);
@@ -8,19 +8,19 @@ var _react = require("react");
8
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
9
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
10
10
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
12
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
11
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
13
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
14
  /**
15
15
  * A small hook for binding the hover control over some HTML element
16
16
  * @returns uiEvents: The events to spread to the html element hovering: the hover state
17
17
  */
18
18
  function useMouseHover() {
19
- var _useState = (0, _react.useState)(false),
19
+ const _useState = (0, _react.useState)(false),
20
20
  _useState2 = _slicedToArray(_useState, 2),
21
21
  hovering = _useState2[0],
22
22
  setHovering = _useState2[1];
23
- var uiEvents = (0, _react.useMemo)(function () {
23
+ const uiEvents = (0, _react.useMemo)(function () {
24
24
  return {
25
25
  onMouseEnter: function onMouseEnter() {
26
26
  setHovering(true);
@@ -11,7 +11,7 @@ var _FadeIn = _interopRequireDefault(require("../../components/FadeIn"));
11
11
  var _OneUIProvider = require("../../context/OneUIProvider");
12
12
  var _usePaginationControlsModule = _interopRequireDefault(require("./usePaginationControls.module.scss"));
13
13
  var _html = require("../../utils/html.utils");
14
- var _excluded = ["snapToPage", "baseWidth", "snapToCutElement"],
14
+ const _excluded = ["snapToPage", "baseWidth", "snapToCutElement"],
15
15
  _excluded2 = ["touches"],
16
16
  _excluded3 = ["touches"];
17
17
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -20,8 +20,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
21
21
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
22
22
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
23
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
24
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
23
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
24
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
25
25
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
26
26
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
27
27
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
@@ -29,38 +29,38 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
29
29
  * This hook handles the display of pagination controls for the user to move to another page
30
30
  */
31
31
  function usePaginationControls(containerRef) {
32
- var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
32
+ let _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
33
33
  snapToPage = _ref.snapToPage,
34
34
  baseWidth = _ref.baseWidth,
35
35
  _snapToCutElement = _ref.snapToCutElement,
36
36
  props = _objectWithoutProperties(_ref, _excluded);
37
- var _useState = (0, _react.useState)([false, false]),
37
+ const _useState = (0, _react.useState)([false, false]),
38
38
  _useState2 = _slicedToArray(_useState, 2),
39
39
  _useState2$ = _slicedToArray(_useState2[0], 2),
40
40
  leftControl = _useState2$[0],
41
41
  rightControl = _useState2$[1],
42
42
  setControls = _useState2[1];
43
- var LeftControl = (0, _OneUIProvider.useOneUIConfig)("hook.ui.usePaginationControls.LeftControl");
44
- var RightControl = (0, _OneUIProvider.useOneUIConfig)("hook.ui.usePaginationControls.RightControl");
45
- var className = (0, _OneUIProvider.useOneUIConfig)("hook.ui.usePaginationControls.className", "");
43
+ const LeftControl = (0, _OneUIProvider.useOneUIConfig)("hook.ui.usePaginationControls.LeftControl");
44
+ const RightControl = (0, _OneUIProvider.useOneUIConfig)("hook.ui.usePaginationControls.RightControl");
45
+ const className = (0, _OneUIProvider.useOneUIConfig)("hook.ui.usePaginationControls.className", "");
46
46
  function move(direction) {
47
- var snapToCutElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _snapToCutElement;
47
+ let snapToCutElement = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _snapToCutElement;
48
48
  return function () {
49
49
  if (snapToCutElement !== null && snapToCutElement !== void 0 ? snapToCutElement : false) {
50
- var childBaseWidth = baseWidth || containerRef.current.firstElementChild.clientWidth;
51
- var howMuchDoesTheScrollAddsUpTo = containerRef.current.scrollLeft / childBaseWidth - Math.floor((containerRef.current.scrollLeft + (direction === "l" ? -1 : 0)) / childBaseWidth);
52
- var howMuchElementsFitOnAPage = containerRef.current.clientWidth / childBaseWidth;
53
- var howMuchElementsFullyFitOnAPage = Math.floor(howMuchElementsFitOnAPage) || 1;
54
- var directionScale = direction === "l" ? 1 - howMuchDoesTheScrollAddsUpTo : howMuchDoesTheScrollAddsUpTo;
55
- var howMuchOfTheRemainingElementIsShown = howMuchElementsFitOnAPage + directionScale - howMuchElementsFullyFitOnAPage;
56
- var howMuchToScroll = (containerRef.current.clientWidth - childBaseWidth * howMuchOfTheRemainingElementIsShown) * (direction === "l" ? -1 : 1);
50
+ const childBaseWidth = baseWidth || containerRef.current.firstElementChild.clientWidth;
51
+ const howMuchDoesTheScrollAddsUpTo = containerRef.current.scrollLeft / childBaseWidth - Math.floor((containerRef.current.scrollLeft + (direction === "l" ? -1 : 0)) / childBaseWidth);
52
+ const howMuchElementsFitOnAPage = containerRef.current.clientWidth / childBaseWidth;
53
+ const howMuchElementsFullyFitOnAPage = Math.floor(howMuchElementsFitOnAPage) || 1;
54
+ const directionScale = direction === "l" ? 1 - howMuchDoesTheScrollAddsUpTo : howMuchDoesTheScrollAddsUpTo;
55
+ const howMuchOfTheRemainingElementIsShown = howMuchElementsFitOnAPage + directionScale - howMuchElementsFullyFitOnAPage;
56
+ const howMuchToScroll = (containerRef.current.clientWidth - childBaseWidth * howMuchOfTheRemainingElementIsShown) * (direction === "l" ? -1 : 1);
57
57
  containerRef.current.scrollBy({
58
58
  left: howMuchToScroll,
59
59
  behavior: "smooth"
60
60
  });
61
61
  } else {
62
- var rest = containerRef.current.scrollLeft % containerRef.current.clientWidth;
63
- var snapOffset = snapToPage ? direction === "l" ? rest ? containerRef.current.clientWidth - rest : 0 : rest : 0;
62
+ const rest = containerRef.current.scrollLeft % containerRef.current.clientWidth;
63
+ const snapOffset = snapToPage ? direction === "l" ? rest ? containerRef.current.clientWidth - rest : 0 : rest : 0;
64
64
  containerRef.current.scrollBy({
65
65
  left: (containerRef.current.clientWidth - snapOffset) * (direction === "l" ? -1 : 1),
66
66
  behavior: "smooth"
@@ -69,38 +69,38 @@ function usePaginationControls(containerRef) {
69
69
  };
70
70
  }
71
71
  function checkControlsRequirement() {
72
- var el = containerRef.current;
73
- var shouldHaveAnyControl = el.scrollWidth > el.clientWidth;
72
+ const el = containerRef.current;
73
+ const shouldHaveAnyControl = el.scrollWidth > el.clientWidth;
74
74
  if (!shouldHaveAnyControl) setControls([false, false]);else {
75
- var shouldHaveRightControl = el.scrollLeft < el.scrollWidth - el.clientWidth;
76
- var shouldHaveLeftControl = el.scrollLeft > 0;
75
+ const shouldHaveRightControl = el.scrollLeft < el.scrollWidth - el.clientWidth;
76
+ const shouldHaveLeftControl = el.scrollLeft > 0;
77
77
  setControls([shouldHaveLeftControl, shouldHaveRightControl]);
78
78
  }
79
79
  }
80
80
  (0, _react.useEffect)(function () {
81
- var el = containerRef.current;
82
- var throttledCheck = (0, _throttle.default)(checkControlsRequirement, 1000 / 4);
81
+ const el = containerRef.current;
82
+ const throttledCheck = (0, _throttle.default)(checkControlsRequirement, 1000 / 4);
83
83
  checkControlsRequirement();
84
- var startingX;
85
- var lastX;
86
- var onTouchStart = function onTouchStart(_ref2) {
87
- var touches = _ref2.touches,
84
+ let startingX;
85
+ let lastX;
86
+ const onTouchStart = function onTouchStart(_ref2) {
87
+ let touches = _ref2.touches,
88
88
  e = _objectWithoutProperties(_ref2, _excluded2);
89
89
  if (!(0, _html.isSameTarget)(e)) return;
90
- var _ref3 = touches.item(0),
90
+ const _ref3 = touches.item(0),
91
91
  pageX = _ref3.pageX;
92
92
  startingX = pageX;
93
93
  };
94
- var onTouchMove = function onTouchMove(_ref4) {
95
- var touches = _ref4.touches,
94
+ const onTouchMove = function onTouchMove(_ref4) {
95
+ let touches = _ref4.touches,
96
96
  e = _objectWithoutProperties(_ref4, _excluded3);
97
97
  if (!(0, _html.isSameTarget)(e)) return;
98
- var touch = touches.item(0);
98
+ const touch = touches.item(0);
99
99
  lastX = touch.pageX;
100
100
  };
101
- var onTouchEnd = function onTouchEnd(e) {
101
+ const onTouchEnd = function onTouchEnd(e) {
102
102
  if (!lastX) return;
103
- var dir = lastX > startingX ? "l" : "r";
103
+ const dir = lastX > startingX ? "l" : "r";
104
104
  move(dir, true)();
105
105
  startingX = undefined;
106
106
  };
@@ -11,10 +11,10 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
11
11
  * This takes a container and applies padding and margin so the content overflow container and goes until it hits the viewport border
12
12
  */
13
13
  function useSnapToViewport(defaultPadding) {
14
- var elRef = (0, _react.useRef)(null);
14
+ const elRef = (0, _react.useRef)(null);
15
15
  (0, _react.useLayoutEffect)(function () {
16
- var diff = window.visualViewport.width - elRef.current.clientWidth;
17
- var margin = diff / 2;
16
+ const diff = window.visualViewport.width - elRef.current.clientWidth;
17
+ const margin = diff / 2;
18
18
  elRef.current.style.setProperty("--overflow-padding", "".concat(margin, "px"));
19
19
  elRef.current.style.setProperty("--overflow-margin", "".concat(-margin, "px"));
20
20
  elRef.current.style.setProperty("--default-padding", "".concat(defaultPadding, "px"));
@@ -14,29 +14,29 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
14
14
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
15
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
16
16
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
17
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
18
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
17
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
18
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
19
19
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
- var MAX_TILT = {
20
+ const MAX_TILT = {
21
21
  x: 100,
22
22
  y: 100
23
23
  };
24
24
  function useTiltUpdates(active, relativeToEl, onTilt, onInverseMatrix) {
25
- var sensorScale = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
26
- var tiltLimit = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : MAX_TILT;
27
- var options = arguments.length > 6 ? arguments[6] : undefined;
25
+ let sensorScale = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 1;
26
+ let tiltLimit = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : MAX_TILT;
27
+ let options = arguments.length > 6 ? arguments[6] : undefined;
28
28
  (0, _react.useEffect)(function () {
29
29
  if (active) {
30
30
  var _options$gyroEnabled;
31
- var removeListeners = function removeListeners() {
31
+ let removeListeners = function removeListeners() {
32
32
  window.removeEventListener("mousemove", handler);
33
33
  window.removeEventListener("touchmove", touchHandler);
34
34
  };
35
- var updatePositions = function updatePositions(relativeToX, relativeToY) {
35
+ const updatePositions = function updatePositions(relativeToX, relativeToY) {
36
36
  var _options$round, _options$round2;
37
- var el = relativeToEl.current;
38
- var rect = el.getBoundingClientRect();
39
- var _width$height = {
37
+ const el = relativeToEl.current;
38
+ const rect = el.getBoundingClientRect();
39
+ const _width$height = {
40
40
  width: [rect.left, el.clientWidth],
41
41
  height: [rect.top, el.clientHeight]
42
42
  },
@@ -46,48 +46,48 @@ function useTiltUpdates(active, relativeToEl, onTilt, onInverseMatrix) {
46
46
  _width$height$height = _slicedToArray(_width$height.height, 2),
47
47
  y0 = _width$height$height[0],
48
48
  yH = _width$height$height[1];
49
- var distanceOffRight = calculateDistanceRelativeToBounds(relativeToX, x0, xW, (_options$round = options === null || options === void 0 ? void 0 : options.round) !== null && _options$round !== void 0 ? _options$round : true);
50
- var distanceOffBottom = calculateDistanceRelativeToBounds(relativeToY, y0, yH, (_options$round2 = options === null || options === void 0 ? void 0 : options.round) !== null && _options$round2 !== void 0 ? _options$round2 : true);
51
- var howMuchToRotateY = givenTheRelativePositionHowMuchToRotate(distanceOffRight, tiltLimit.y);
52
- var howMuchToRotateX = givenTheRelativePositionHowMuchToRotate(distanceOffBottom, tiltLimit.x);
49
+ const distanceOffRight = calculateDistanceRelativeToBounds(relativeToX, x0, xW, (_options$round = options === null || options === void 0 ? void 0 : options.round) !== null && _options$round !== void 0 ? _options$round : true);
50
+ const distanceOffBottom = calculateDistanceRelativeToBounds(relativeToY, y0, yH, (_options$round2 = options === null || options === void 0 ? void 0 : options.round) !== null && _options$round2 !== void 0 ? _options$round2 : true);
51
+ const howMuchToRotateY = givenTheRelativePositionHowMuchToRotate(distanceOffRight, tiltLimit.y);
52
+ const howMuchToRotateX = givenTheRelativePositionHowMuchToRotate(distanceOffBottom, tiltLimit.x);
53
53
  onTilt({
54
54
  y: howMuchToRotateX * 2,
55
55
  x: howMuchToRotateY * 2
56
56
  });
57
57
  };
58
- var handler = (0, _throttle.default)(function (_ref) {
59
- var x = _ref.x,
58
+ const handler = (0, _throttle.default)(function (_ref) {
59
+ let x = _ref.x,
60
60
  y = _ref.y;
61
61
  updatePositions(x, y);
62
62
  }, 1000 / 30);
63
- var touchHandler = (0, _throttle.default)(function (_ref2) {
64
- var touches = _ref2.touches;
65
- var _touches$ = touches[0],
63
+ const touchHandler = (0, _throttle.default)(function (_ref2) {
64
+ let touches = _ref2.touches;
65
+ const _touches$ = touches[0],
66
66
  pageX = _touches$.pageX,
67
67
  pageY = _touches$.pageY;
68
68
  updatePositions(pageX, pageY);
69
69
  }, 1000 / 30);
70
70
  window.addEventListener("mousemove", handler);
71
71
  window.addEventListener("touchmove", touchHandler);
72
- var _inverseMatrix;
73
- var _limits = {
72
+ let _inverseMatrix;
73
+ const _limits = {
74
74
  beta: undefined,
75
75
  gamma: undefined
76
76
  };
77
- var orientationListener = function orientationListener(_ref3) {
78
- var beta = _ref3.beta,
77
+ const orientationListener = function orientationListener(_ref3) {
78
+ let beta = _ref3.beta,
79
79
  gamma = _ref3.gamma;
80
80
  beta = beta * 0.5;
81
81
  gamma = gamma * 0.5;
82
82
  if (!_inverseMatrix) {
83
83
  window.removeEventListener("mousemove", handler);
84
84
  window.removeEventListener("touchmove", touchHandler);
85
- var offset = 12.5;
85
+ const offset = 12.5;
86
86
  _limits.beta = [beta - offset, beta + offset];
87
87
  _limits.gamma = [gamma - offset, gamma + offset];
88
88
  }
89
- var _beta = Math.min(_limits.beta[1], Math.max(_limits.beta[0], beta));
90
- var _gamma = Math.min(_limits.gamma[1], Math.max(_limits.gamma[0], gamma));
89
+ const _beta = Math.min(_limits.beta[1], Math.max(_limits.beta[0], beta));
90
+ const _gamma = Math.min(_limits.gamma[1], Math.max(_limits.gamma[0], gamma));
91
91
  if (!_inverseMatrix && onInverseMatrix) {
92
92
  onInverseMatrix(function () {
93
93
  return _inverseMatrix = (0, _helpers.flattenMatrix)((0, _helpers.invertMatrix)((0, _helpers.generateMatrixFromOperations)({
@@ -126,23 +126,23 @@ function useTiltUpdates(active, relativeToEl, onTilt, onInverseMatrix) {
126
126
  * When on desktop: The mouse position relative to a ref
127
127
  */
128
128
  function useTilt(active) {
129
- var sensorScale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
130
- var maxTilt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : MAX_TILT;
131
- var options = arguments.length > 3 ? arguments[3] : undefined;
132
- var _useState = (0, _react.useState)({
129
+ let sensorScale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
130
+ let maxTilt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : MAX_TILT;
131
+ let options = arguments.length > 3 ? arguments[3] : undefined;
132
+ const _useState = (0, _react.useState)({
133
133
  x: 0,
134
134
  y: 0
135
135
  }),
136
136
  _useState2 = _slicedToArray(_useState, 2),
137
137
  tilt = _useState2[0],
138
138
  setTilt = _useState2[1];
139
- var _useState3 = (0, _react.useState)(function () {
139
+ const _useState3 = (0, _react.useState)(function () {
140
140
  return (0, _helpers.flattenMatrix)((0, _helpers.IDENTITY_MATRIX)());
141
141
  }),
142
142
  _useState4 = _slicedToArray(_useState3, 2),
143
143
  tiltResetMatrix = _useState4[0],
144
144
  setTiltResetMatrix = _useState4[1];
145
- var relativeTo = (0, _react.useRef)(null);
145
+ const relativeTo = (0, _react.useRef)(null);
146
146
  useTiltUpdates(active, relativeTo, setTilt, setTiltResetMatrix, sensorScale, maxTilt, options);
147
147
  return {
148
148
  /** The element to monitor mouse hover relative to */
@@ -159,11 +159,11 @@ function useTilt(active) {
159
159
  };
160
160
  }
161
161
  function calculateDistanceRelativeToBounds(mousePosition, elementInitialPosition, elementSizeDimension, shouldRound) {
162
- var normalizeInitialPosition = mousePosition - elementInitialPosition;
163
- var doNotAllowGoingBeyondLowerLimit = Math.max(normalizeInitialPosition, 0);
164
- var doNotAllowHoingBeyondHigherLimit = Math.min(doNotAllowGoingBeyondLowerLimit, elementSizeDimension);
165
- var threeRule = doNotAllowHoingBeyondHigherLimit * 100 / elementSizeDimension;
166
- var result = (shouldRound ? Math.round(threeRule) : threeRule) / 100;
162
+ const normalizeInitialPosition = mousePosition - elementInitialPosition;
163
+ const doNotAllowGoingBeyondLowerLimit = Math.max(normalizeInitialPosition, 0);
164
+ const doNotAllowHoingBeyondHigherLimit = Math.min(doNotAllowGoingBeyondLowerLimit, elementSizeDimension);
165
+ const threeRule = doNotAllowHoingBeyondHigherLimit * 100 / elementSizeDimension;
166
+ const result = (shouldRound ? Math.round(threeRule) : threeRule) / 100;
167
167
  return result;
168
168
  }
169
169
  function givenTheRelativePositionHowMuchToRotate(relativePosition, maxRotation) {
@@ -19,20 +19,20 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
19
19
  * Allows an element to be zoomable for fullscreen
20
20
  */
21
21
  function useZoomable(id) {
22
- var zoomableID = (0, _react.useMemo)(function () {
22
+ const zoomableID = (0, _react.useMemo)(function () {
23
23
  return "zoomable-".concat(id);
24
24
  }, []);
25
- var getBackdrop = function getBackdrop() {
25
+ const getBackdrop = function getBackdrop() {
26
26
  return document.querySelector("[data-zoomable=\"".concat(zoomableID, "\"]"));
27
27
  };
28
- var _useHero = (0, _useHero3.default)(zoomableID, {
28
+ const _useHero = (0, _useHero3.default)(zoomableID, {
29
29
  "data-preffix": "zoomable",
30
30
  repeatable: true
31
31
  }, {
32
32
  onHeroStart: function onHeroStart(clone) {
33
- var bd = getBackdrop();
34
- var removeCb = function removeCb(_ref) {
35
- var currentTarget = _ref.currentTarget,
33
+ const bd = getBackdrop();
34
+ const removeCb = function removeCb(_ref) {
35
+ let currentTarget = _ref.currentTarget,
36
36
  target = _ref.target;
37
37
  if (target === currentTarget) {
38
38
  _reactDom.default.unmountComponentAtNode(bd);
@@ -40,7 +40,7 @@ function useZoomable(id) {
40
40
  }
41
41
  };
42
42
  bd.style.opacity = "0";
43
- var middlewayClick = function middlewayClick() {
43
+ const middlewayClick = function middlewayClick() {
44
44
  bd.removeEventListener("transitionend", removeCb);
45
45
  clone.removeEventListener("click", middlewayClick);
46
46
  _zoom();
@@ -56,22 +56,22 @@ function useZoomable(id) {
56
56
  }),
57
57
  heroRef = _useHero.heroRef,
58
58
  trigger = _useHero.trigger;
59
- var zoomableEl = (0, _react.useRef)(null);
59
+ const zoomableEl = (0, _react.useRef)(null);
60
60
  function _unzoom() {
61
61
  trigger();
62
62
  }
63
63
  function _zoom() {
64
- var el = zoomableEl.current;
65
- var elClone = el.cloneNode(true);
64
+ const el = zoomableEl.current;
65
+ const elClone = el.cloneNode(true);
66
66
  elClone.style.visibility = "hidden";
67
67
  function HeroMount() {
68
- var _useHero2 = (0, _useHero3.default)(zoomableID, {
68
+ const _useHero2 = (0, _useHero3.default)(zoomableID, {
69
69
  "data-preffix": "zoomable",
70
70
  repeatable: true
71
71
  }, {
72
72
  onHeroStart: function onHeroStart(clone) {
73
73
  getBackdrop().style.opacity = "1";
74
- var unzoomCb = function unzoomCb() {
74
+ const unzoomCb = function unzoomCb() {
75
75
  _unzoom();
76
76
  clone.removeEventListener("click", unzoomCb);
77
77
  };
@@ -87,10 +87,10 @@ function useZoomable(id) {
87
87
  if (_ref2) {
88
88
  _ref2.appendChild(elClone);
89
89
  heroRef.current = elClone;
90
- var verticalProportion = el.clientWidth / el.clientHeight;
91
- var targetWidth = _ref2.clientHeight * verticalProportion;
90
+ const verticalProportion = el.clientWidth / el.clientHeight;
91
+ const targetWidth = _ref2.clientHeight * verticalProportion;
92
92
  if (targetWidth > _ref2.clientWidth) {
93
- var horizontalProportion = el.clientHeight / el.clientWidth;
93
+ const horizontalProportion = el.clientHeight / el.clientWidth;
94
94
  elClone.style.width = _ref2.clientWidth + "px";
95
95
  elClone.style.height = _ref2.clientWidth * horizontalProportion + "px";
96
96
  } else {
@@ -101,9 +101,9 @@ function useZoomable(id) {
101
101
  }
102
102
  });
103
103
  }
104
- var existingBackdrop = getBackdrop();
104
+ const existingBackdrop = getBackdrop();
105
105
  if (!existingBackdrop) {
106
- var backdrop = document.createElement("div");
106
+ const backdrop = document.createElement("div");
107
107
  backdrop.classList.add(_useZoomableModule.default.backdrop);
108
108
  backdrop.addEventListener("click", _unzoom);
109
109
  backdrop.setAttribute("data-zoomable", zoomableID);
@@ -114,12 +114,12 @@ function useZoomable(id) {
114
114
  }
115
115
  }
116
116
  (0, _react.useEffect)(function () {
117
- var el = zoomableEl.current;
117
+ const el = zoomableEl.current;
118
118
  el.classList.add(_useZoomableModule.default.zoomableIndicator);
119
119
  el.addEventListener("click", _zoom);
120
120
  return function () {
121
121
  el.classList.remove(_useZoomableModule.default.zoomableIndicator);
122
- var bd = getBackdrop();
122
+ const bd = getBackdrop();
123
123
  if (bd) {
124
124
  bd.style.opacity = "0";
125
125
  bd.addEventListener("transitionend", function () {
@@ -128,7 +128,7 @@ function useZoomable(id) {
128
128
  }
129
129
  };
130
130
  }, []);
131
- var mergedRefs = (0, _useMergeRefs.useMergeRefsFunc)(heroRef, zoomableEl);
131
+ const mergedRefs = (0, _useMergeRefs.useMergeRefsFunc)(heroRef, zoomableEl);
132
132
  return {
133
133
  zoomableEl: mergedRefs
134
134
  };
@@ -11,60 +11,43 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
11
11
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
12
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
13
13
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
14
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
15
14
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
16
15
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
17
16
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
18
17
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
19
18
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
20
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
21
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0) { ; } } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
19
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
20
+ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
22
21
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
23
22
  function useAsyncControl(functionsToWrap) {
24
- var _useState = (0, _react.useState)(),
23
+ const _useState = (0, _react.useState)(),
25
24
  _useState2 = _slicedToArray(_useState, 2),
26
25
  error = _useState2[0],
27
26
  setError = _useState2[1];
28
- var _useState3 = (0, _react.useState)(false),
27
+ const _useState3 = (0, _react.useState)(false),
29
28
  _useState4 = _slicedToArray(_useState3, 2),
30
29
  loading = _useState4[0],
31
30
  setLoading = _useState4[1];
32
- var _process = (0, _react.useCallback)( /*#__PURE__*/function () {
33
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(asyncFn) {
34
- return _regeneratorRuntime().wrap(function _callee$(_context) {
35
- while (1) {
36
- switch (_context.prev = _context.next) {
37
- case 0:
38
- _context.prev = 0;
39
- setLoading(true);
40
- setError(undefined);
41
- _context.next = 5;
42
- return asyncFn();
43
- case 5:
44
- return _context.abrupt("return", _context.sent);
45
- case 8:
46
- _context.prev = 8;
47
- _context.t0 = _context["catch"](0);
48
- if (process.env.NODE_ENV === "development") console.error(_context.t0);
49
- setError(_context.t0);
50
- throw _context.t0;
51
- case 13:
52
- _context.prev = 13;
53
- setLoading(false);
54
- return _context.finish(13);
55
- case 16:
56
- case "end":
57
- return _context.stop();
58
- }
59
- }
60
- }, _callee, null, [[0, 8, 13, 16]]);
61
- }));
31
+ const _process = (0, _react.useCallback)( /*#__PURE__*/function () {
32
+ var _ref = _asyncToGenerator(function* (asyncFn) {
33
+ try {
34
+ setLoading(true);
35
+ setError(undefined);
36
+ return yield asyncFn();
37
+ } catch (e) {
38
+ if (process.env.NODE_ENV === "development") console.error(e);
39
+ setError(e);
40
+ throw e;
41
+ } finally {
42
+ setLoading(false);
43
+ }
44
+ });
62
45
  return function (_x2) {
63
46
  return _ref.apply(this, arguments);
64
47
  };
65
48
  }(), []);
66
- var _Object$entries$reduc = Object.entries(functionsToWrap || {}).reduce(function (r, _ref2) {
67
- var _ref3 = _slicedToArray(_ref2, 2),
49
+ const _Object$entries$reduc = Object.entries(functionsToWrap || {}).reduce(function (r, _ref2) {
50
+ let _ref3 = _slicedToArray(_ref2, 2),
68
51
  k = _ref3[0],
69
52
  func = _ref3[1];
70
53
  return _objectSpread(_objectSpread({}, r), typeof func === "function" ? {
@@ -85,7 +68,7 @@ function useAsyncControl(functionsToWrap) {
85
68
  setError: setError,
86
69
  setLoading: setLoading
87
70
  }, other), Object.entries(functionsToMemoize).reduce(function (r, _ref4) {
88
- var _ref5 = _slicedToArray(_ref4, 2),
71
+ let _ref5 = _slicedToArray(_ref4, 2),
89
72
  k = _ref5[0],
90
73
  v = _ref5[1];
91
74
  return _objectSpread(_objectSpread({}, r), {}, _defineProperty({}, k, (0, _react.useMemo)(function () {