@onepercentio/one-ui 0.19.1 → 0.19.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/.babelrc +17 -0
- package/.prod.babelrc +22 -0
- package/dist/assets/styles/variables.scss +1 -0
- package/dist/components/AdaptiveButton/AdaptiveButton.js +24 -25
- package/dist/components/AdaptiveButton/index.js +12 -8
- package/dist/components/AdaptiveContainer/AdaptiveContainer.js +95 -114
- package/dist/components/AdaptiveContainer/index.js +12 -8
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js +85 -65
- package/dist/components/AdaptiveDialog/index.js +12 -8
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +84 -76
- package/dist/components/AdaptiveSidebar/index.js +12 -8
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js +155 -160
- package/dist/components/AnchoredTooltip/index.js +12 -8
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js +172 -139
- package/dist/components/AnimatedEntrance/index.js +26 -10
- package/dist/components/AsyncWrapper/AsyncWrapper.js +33 -21
- package/dist/components/AsyncWrapper/index.js +12 -8
- package/dist/components/Avatar/Avatar.js +34 -40
- package/dist/components/Avatar/index.js +12 -8
- package/dist/components/BucketFill/BucketFill.js +47 -58
- package/dist/components/BucketFill/index.js +12 -8
- package/dist/components/Button/Button.js +32 -49
- package/dist/components/Button/README.md +8 -0
- package/dist/components/Button/index.js +12 -8
- package/dist/components/Card/Card.js +16 -11
- package/dist/components/Card/index.js +12 -8
- package/dist/components/Chart/Chart.logic.js +10 -10
- package/dist/components/Chart/Chart.types.js +4 -2
- package/dist/components/Chart/Chart.view.js +212 -131
- package/dist/components/Chart/index.js +12 -8
- package/dist/components/CheckBox/CheckBox.d.ts +3 -1
- package/dist/components/CheckBox/CheckBox.js +43 -30
- package/dist/components/CheckBox/CheckBox.module.scss +4 -0
- package/dist/components/CheckBox/index.js +12 -8
- package/dist/components/Collapsable/Collapsable.d.ts +26 -27
- package/dist/components/Collapsable/Collapsable.js +173 -143
- package/dist/components/Collapsable/index.js +12 -8
- package/dist/components/Countdown/Countdown.js +87 -100
- package/dist/components/Countdown/index.js +12 -8
- package/dist/components/Divider/Divider.js +15 -12
- package/dist/components/Divider/index.js +12 -8
- package/dist/components/EmailInput/EmailInput.d.ts +4 -3
- package/dist/components/EmailInput/EmailInput.js +45 -43
- package/dist/components/EmailInput/README.md +10 -0
- package/dist/components/EmailInput/index.js +20 -9
- package/dist/components/FadeIn/FadeIn.js +62 -69
- package/dist/components/FadeIn/index.js +12 -8
- package/dist/components/FileInput/FileInput.d.ts +25 -9
- package/dist/components/FileInput/FileInput.js +41 -70
- package/dist/components/FileInput/FileInput.module.scss +0 -21
- package/dist/components/FileInput/View/BigFactory/BigFactory.d.ts +6 -0
- package/dist/components/FileInput/View/BigFactory/BigFactory.js +46 -0
- package/dist/components/FileInput/View/BigFactory/BigFactory.module.scss +20 -0
- package/dist/components/FileInput/View/BigFactory/index.d.ts +1 -0
- package/dist/components/FileInput/View/BigFactory/index.js +13 -0
- package/dist/components/FileInput/View/Compact/Compact.d.ts +5 -0
- package/dist/components/FileInput/View/Compact/Compact.js +88 -0
- package/dist/components/FileInput/View/Compact/Compact.module.scss +59 -0
- package/dist/components/FileInput/View/Compact/index.d.ts +1 -0
- package/dist/components/FileInput/View/Compact/index.js +13 -0
- package/dist/components/FileInput/View/View.types.d.ts +8 -0
- package/dist/components/FileInput/View/View.types.js +5 -0
- package/dist/components/FileInput/index.js +12 -8
- package/dist/components/FlowController/FlowController.js +60 -29
- package/dist/components/FlowController/README.md +13 -0
- package/dist/components/FlowController/index.js +12 -8
- package/dist/components/Form/Form.js +157 -96
- package/dist/components/Form/index.js +12 -8
- package/dist/components/Freeze/Freeze.js +11 -10
- package/dist/components/Freeze/index.js +12 -8
- package/dist/components/HSForms/HSForms.js +48 -68
- package/dist/components/HSForms/index.js +12 -8
- package/dist/components/Header/Header.js +100 -69
- package/dist/components/Header/index.js +12 -8
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.js +17 -13
- package/dist/components/HeaderCloseBtn/index.js +12 -8
- package/dist/components/InfinityScroll/InfinityScroll.js +137 -117
- package/dist/components/InfinityScroll/index.js +12 -8
- package/dist/components/Input/Input.d.ts +8 -6
- package/dist/components/Input/Input.js +105 -90
- package/dist/components/Input/Input.module.scss +4 -2
- package/dist/components/Input/README.md +10 -0
- package/dist/components/Input/index.js +12 -8
- package/dist/components/InstantCounter/InstantCounter.js +61 -52
- package/dist/components/InstantCounter/index.js +12 -8
- package/dist/components/LavaLamp/LavaLamp.data.js +95 -87
- package/dist/components/LavaLamp/LavaLamp.js +107 -70
- package/dist/components/LavaLamp/index.js +12 -8
- package/dist/components/LavaLamp/v2/LavaLamp.js +200 -182
- package/dist/components/LinkToId/LinkToId.js +42 -28
- package/dist/components/LinkToId/index.js +20 -9
- package/dist/components/Loader/Loader.js +20 -26
- package/dist/components/Loader/index.js +12 -8
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.js +34 -37
- package/dist/components/LoaderDotsIndicator/index.js +12 -8
- package/dist/components/LoopableVideo/LoopableVideo.js +29 -30
- package/dist/components/LoopableVideo/index.js +12 -8
- package/dist/components/MainGrid/MainGrid.js +44 -50
- package/dist/components/MainGrid/index.js +12 -8
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js +26 -26
- package/dist/components/MutableHamburgerButton/index.js +12 -8
- package/dist/components/Notification/Notification.js +16 -12
- package/dist/components/Notification/index.js +12 -8
- package/dist/components/OrderableList/OrderableList.js +406 -372
- package/dist/components/OrderableList/index.js +12 -8
- package/dist/components/PaginationIndicator/PaginationIndicator.js +230 -196
- package/dist/components/PaginationIndicator/index.js +12 -8
- package/dist/components/Parallax/Parallax.js +164 -161
- package/dist/components/Parallax/index.js +12 -8
- package/dist/components/Parallax/math/helpers.js +128 -217
- package/dist/components/PasswordInput/PasswordInput.d.ts +4 -3
- package/dist/components/PasswordInput/PasswordInput.js +120 -97
- package/dist/components/PasswordInput/index.js +12 -8
- package/dist/components/PixelatedScan/PixelatedScan.js +140 -97
- package/dist/components/PixelatedScan/index.js +12 -8
- package/dist/components/Portal/Portal.js +54 -64
- package/dist/components/Portal/index.js +20 -9
- package/dist/components/ProgressBar/ProgressBar.js +48 -45
- package/dist/components/ProgressBar/index.js +20 -9
- package/dist/components/ProgressTexts/ProgressTexts.js +42 -34
- package/dist/components/ProgressTexts/README.md +12 -0
- package/dist/components/ProgressTexts/index.js +12 -8
- package/dist/components/Radio/Radio.d.ts +13 -0
- package/dist/components/Radio/Radio.js +47 -0
- package/dist/components/Radio/Radio.module.scss +33 -0
- package/dist/components/Radio/index.d.ts +1 -0
- package/dist/components/Radio/index.js +13 -0
- package/dist/components/SectionContainer/SectionContainer.js +35 -39
- package/dist/components/SectionContainer/index.js +12 -8
- package/dist/components/Select/Select.d.ts +2 -1
- package/dist/components/Select/Select.js +133 -82
- package/dist/components/Select/Select.module.scss +14 -2
- package/dist/components/Select/index.js +12 -8
- package/dist/components/Skeleton/Skeleton.js +21 -15
- package/dist/components/Skeleton/index.js +12 -8
- package/dist/components/Spacing/Spacing.js +14 -11
- package/dist/components/Spacing/index.js +12 -8
- package/dist/components/StaticScroller/StaticScroller.js +61 -81
- package/dist/components/StaticScroller/index.js +12 -8
- package/dist/components/Switch/Switch.js +29 -25
- package/dist/components/Switch/index.js +12 -8
- package/dist/components/Table/Table.js +111 -80
- package/dist/components/Table/index.js +12 -8
- package/dist/components/Tabs/Tabs.js +42 -52
- package/dist/components/Tabs/index.js +12 -8
- package/dist/components/Text/Text.js +31 -50
- package/dist/components/Text/index.js +12 -8
- package/dist/components/Transition/MasksFactory/DiagonalReveal.js +46 -22
- package/dist/components/Transition/MasksFactory/DiagonalSquareToBalls.js +71 -57
- package/dist/components/Transition/MasksFactory/PhysicsSquares.js +97 -80
- package/dist/components/Transition/MasksFactory/SquareToBalls.js +59 -50
- package/dist/components/Transition/MasksFactory/utils.js +25 -28
- package/dist/components/Transition/Transition.js +316 -309
- package/dist/components/Transition/index.js +20 -9
- package/dist/components/UncontrolledTransition/UncontrolledTransition.js +110 -86
- package/dist/components/UncontrolledTransition/index.js +12 -8
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js +116 -105
- package/dist/components/WalletConnectionWrapper/index.js +20 -9
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js +51 -69
- package/dist/components/utilitary/ScrollAndFocusLock/index.js +12 -8
- package/dist/context/AsyncProcess.js +77 -63
- package/dist/context/CustomBrowserRouter.js +40 -52
- package/dist/context/OneUIProvider.d.ts +8 -2
- package/dist/context/OneUIProvider.js +90 -104
- package/dist/hooks/logs/README.md +3 -0
- package/dist/hooks/logs/useDependencyChangeDetection.js +17 -17
- package/dist/hooks/logs/useIsMounting.js +10 -8
- package/dist/hooks/persistence/useLocalStorage.js +40 -30
- package/dist/hooks/shims/ObjectWatchShim.d.ts +1 -0
- package/dist/hooks/shims/ObjectWatchShim.js +49 -46
- package/dist/hooks/ui/useAdaptiveImage.js +43 -35
- package/dist/hooks/ui/useBreakpoint.js +34 -19
- package/dist/hooks/ui/useCustomScrollbar.js +26 -21
- package/dist/hooks/ui/useMouseHover.js +29 -16
- package/dist/hooks/ui/usePaginationControls.d.ts +0 -4
- package/dist/hooks/ui/usePaginationControls.e2e.d.ts +4 -0
- package/dist/hooks/ui/usePaginationControls.js +125 -153
- package/dist/hooks/ui/useTilt.js +156 -128
- package/dist/hooks/ui/useZoomable.js +114 -138
- package/dist/hooks/useAsyncControl.js +82 -47
- package/dist/hooks/useContainedRepositioning.js +75 -72
- package/dist/hooks/useCustomHistory.js +21 -13
- package/dist/hooks/useElementFit.js +42 -34
- package/dist/hooks/useFirestoreWatch.js +54 -35
- package/dist/hooks/useForm.js +47 -22
- package/dist/hooks/useFreeze.js +11 -9
- package/dist/hooks/useHero.d.ts +4 -0
- package/dist/hooks/useHero.js +171 -159
- package/dist/hooks/useIntersection.js +33 -27
- package/dist/hooks/useMergeRefs.js +26 -23
- package/dist/hooks/useObserve.js +28 -15
- package/dist/hooks/usePagination.js +151 -129
- package/dist/hooks/usePooledOperation.js +43 -58
- package/dist/hooks/usePooling.js +62 -48
- package/dist/hooks/useRebound.js +36 -22
- package/dist/hooks/useShortIntl.js +79 -51
- package/dist/hooks/utility/useEvents.js +28 -22
- package/dist/hooks/utility/useModule.js +21 -10
- package/dist/hooks/utility/useQuery.js +14 -8
- package/dist/models/DebugLogger.js +7 -6
- package/dist/models/GenericContract.js +39 -12
- package/dist/reac-app-env.d.js +1 -0
- package/dist/storybook/assets/video/txt-reversed.mp4 +0 -0
- package/dist/storybookUtils/index.js +42 -24
- package/dist/type-utils.js +4 -2
- package/dist/types.js +4 -2
- package/dist/utility.d.js +17 -0
- package/dist/utils/blockchain.js +60 -54
- package/dist/utils/flatten.js +23 -13
- package/dist/utils/html.utils.js +9 -6
- package/dist/utils/ownEvent.js +9 -8
- package/package.json +13 -8
- package/tsconfig.json +3 -2
- package/cypress/support/commands.ts +0 -49
- package/cypress/support/component-index.html +0 -30
- package/cypress/support/component.ts +0 -39
- package/cypress/support/e2e.js +0 -49
- package/dist/components/AdaptiveButton/AdaptiveButton.js.map +0 -1
- package/dist/components/AdaptiveButton/index.js.map +0 -1
- package/dist/components/AdaptiveContainer/AdaptiveContainer.js.map +0 -1
- package/dist/components/AdaptiveContainer/index.js.map +0 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.js.map +0 -1
- package/dist/components/AdaptiveDialog/index.js.map +0 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js.map +0 -1
- package/dist/components/AdaptiveSidebar/index.js.map +0 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.js.map +0 -1
- package/dist/components/AnchoredTooltip/index.js.map +0 -1
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js.map +0 -1
- package/dist/components/AnimatedEntrance/index.js.map +0 -1
- package/dist/components/AsyncWrapper/AsyncWrapper.js.map +0 -1
- package/dist/components/AsyncWrapper/index.js.map +0 -1
- package/dist/components/Avatar/Avatar.js.map +0 -1
- package/dist/components/Avatar/index.js.map +0 -1
- package/dist/components/BucketFill/BucketFill.js.map +0 -1
- package/dist/components/BucketFill/index.js.map +0 -1
- package/dist/components/Button/Button.js.map +0 -1
- package/dist/components/Button/index.js.map +0 -1
- package/dist/components/Card/Card.js.map +0 -1
- package/dist/components/Card/index.js.map +0 -1
- package/dist/components/Chart/Chart.e2e.js +0 -9
- package/dist/components/Chart/Chart.e2e.js.map +0 -1
- package/dist/components/Chart/Chart.logic.js.map +0 -1
- package/dist/components/Chart/Chart.types.js.map +0 -1
- package/dist/components/Chart/Chart.view.js.map +0 -1
- package/dist/components/Chart/index.js.map +0 -1
- package/dist/components/CheckBox/CheckBox.js.map +0 -1
- package/dist/components/CheckBox/index.js.map +0 -1
- package/dist/components/Collapsable/Collapsable.js.map +0 -1
- package/dist/components/Collapsable/index.js.map +0 -1
- package/dist/components/Countdown/Countdown.js.map +0 -1
- package/dist/components/Countdown/index.js.map +0 -1
- package/dist/components/Divider/Divider.js.map +0 -1
- package/dist/components/Divider/index.js.map +0 -1
- package/dist/components/EmailInput/EmailInput.js.map +0 -1
- package/dist/components/EmailInput/index.js.map +0 -1
- package/dist/components/FadeIn/FadeIn.js.map +0 -1
- package/dist/components/FadeIn/index.js.map +0 -1
- package/dist/components/FileInput/FileInput.js.map +0 -1
- package/dist/components/FileInput/index.js.map +0 -1
- package/dist/components/FlowController/FlowController.js.map +0 -1
- package/dist/components/FlowController/index.js.map +0 -1
- package/dist/components/Form/Form.js.map +0 -1
- package/dist/components/Form/index.js.map +0 -1
- package/dist/components/Freeze/Freeze.js.map +0 -1
- package/dist/components/Freeze/index.js.map +0 -1
- package/dist/components/HSForms/HSForms.js.map +0 -1
- package/dist/components/HSForms/index.js.map +0 -1
- package/dist/components/Header/Header.js.map +0 -1
- package/dist/components/Header/index.js.map +0 -1
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.js.map +0 -1
- package/dist/components/HeaderCloseBtn/index.js.map +0 -1
- package/dist/components/InfinityScroll/InfinityScroll.js.map +0 -1
- package/dist/components/InfinityScroll/index.js.map +0 -1
- package/dist/components/Input/Input.js.map +0 -1
- package/dist/components/Input/index.js.map +0 -1
- package/dist/components/InstantCounter/InstantCounter.js.map +0 -1
- package/dist/components/InstantCounter/index.js.map +0 -1
- package/dist/components/LavaLamp/LavaLamp.data.js.map +0 -1
- package/dist/components/LavaLamp/LavaLamp.js.map +0 -1
- package/dist/components/LavaLamp/index.js.map +0 -1
- package/dist/components/LavaLamp/v2/LavaLamp.js.map +0 -1
- package/dist/components/LinkToId/LinkToId.js.map +0 -1
- package/dist/components/LinkToId/index.js.map +0 -1
- package/dist/components/Loader/Loader.js.map +0 -1
- package/dist/components/Loader/index.js.map +0 -1
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.js.map +0 -1
- package/dist/components/LoaderDotsIndicator/index.js.map +0 -1
- package/dist/components/LoopableVideo/LoopableVideo.js.map +0 -1
- package/dist/components/LoopableVideo/index.js.map +0 -1
- package/dist/components/MainGrid/MainGrid.js.map +0 -1
- package/dist/components/MainGrid/index.js.map +0 -1
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.js.map +0 -1
- package/dist/components/MutableHamburgerButton/index.js.map +0 -1
- package/dist/components/Notification/Notification.js.map +0 -1
- package/dist/components/Notification/index.js.map +0 -1
- package/dist/components/OrderableList/OrderableList.js.map +0 -1
- package/dist/components/OrderableList/index.js.map +0 -1
- package/dist/components/PaginationIndicator/PaginationIndicator.js.map +0 -1
- package/dist/components/PaginationIndicator/index.js.map +0 -1
- package/dist/components/Parallax/Parallax.js.map +0 -1
- package/dist/components/Parallax/index.js.map +0 -1
- package/dist/components/Parallax/math/helpers.js.map +0 -1
- package/dist/components/PasswordInput/PasswordInput.js.map +0 -1
- package/dist/components/PasswordInput/index.js.map +0 -1
- package/dist/components/PixelatedScan/PixelatedScan.js.map +0 -1
- package/dist/components/PixelatedScan/index.js.map +0 -1
- package/dist/components/Portal/Portal.js.map +0 -1
- package/dist/components/Portal/index.js.map +0 -1
- package/dist/components/ProgressBar/ProgressBar.js.map +0 -1
- package/dist/components/ProgressBar/index.js.map +0 -1
- package/dist/components/ProgressTexts/ProgressTexts.js.map +0 -1
- package/dist/components/ProgressTexts/index.js.map +0 -1
- package/dist/components/SectionContainer/SectionContainer.js.map +0 -1
- package/dist/components/SectionContainer/index.js.map +0 -1
- package/dist/components/Select/Select.js.map +0 -1
- package/dist/components/Select/index.js.map +0 -1
- package/dist/components/Skeleton/Skeleton.js.map +0 -1
- package/dist/components/Skeleton/index.js.map +0 -1
- package/dist/components/Spacing/Spacing.js.map +0 -1
- package/dist/components/Spacing/index.js.map +0 -1
- package/dist/components/StaticScroller/StaticScroller.js.map +0 -1
- package/dist/components/StaticScroller/index.js.map +0 -1
- package/dist/components/Switch/Switch.js.map +0 -1
- package/dist/components/Switch/index.js.map +0 -1
- package/dist/components/Table/Table.js.map +0 -1
- package/dist/components/Table/index.js.map +0 -1
- package/dist/components/Tabs/Tabs.js.map +0 -1
- package/dist/components/Tabs/index.js.map +0 -1
- package/dist/components/Text/Text.js.map +0 -1
- package/dist/components/Text/index.js.map +0 -1
- package/dist/components/Transition/MasksFactory/DiagonalReveal.js.map +0 -1
- package/dist/components/Transition/MasksFactory/DiagonalSquareToBalls.js.map +0 -1
- package/dist/components/Transition/MasksFactory/PhysicsSquares.js.map +0 -1
- package/dist/components/Transition/MasksFactory/SquareToBalls.js.map +0 -1
- package/dist/components/Transition/MasksFactory/utils.js.map +0 -1
- package/dist/components/Transition/Transition.js.map +0 -1
- package/dist/components/Transition/index.js.map +0 -1
- package/dist/components/UncontrolledTransition/UncontrolledTransition.js.map +0 -1
- package/dist/components/UncontrolledTransition/index.js.map +0 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js.map +0 -1
- package/dist/components/WalletConnectionWrapper/index.js.map +0 -1
- package/dist/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.js.map +0 -1
- package/dist/components/utilitary/ScrollAndFocusLock/index.js.map +0 -1
- package/dist/context/AsyncProcess.js.map +0 -1
- package/dist/context/CustomBrowserRouter.js.map +0 -1
- package/dist/context/OneUIProvider.js.map +0 -1
- package/dist/hooks/logs/useDependencyChangeDetection.js.map +0 -1
- package/dist/hooks/logs/useIsMounting.js.map +0 -1
- package/dist/hooks/persistence/useLocalStorage.js.map +0 -1
- package/dist/hooks/shims/ObjectWatchShim.js.map +0 -1
- package/dist/hooks/ui/useAdaptiveImage.js.map +0 -1
- package/dist/hooks/ui/useBreakpoint.js.map +0 -1
- package/dist/hooks/ui/useCustomScrollbar.js.map +0 -1
- package/dist/hooks/ui/useMouseHover.js.map +0 -1
- package/dist/hooks/ui/usePaginationControls.js.map +0 -1
- package/dist/hooks/ui/useTilt.js.map +0 -1
- package/dist/hooks/ui/useZoomable.js.map +0 -1
- package/dist/hooks/useAsyncControl.js.map +0 -1
- package/dist/hooks/useContainedRepositioning.js.map +0 -1
- package/dist/hooks/useCustomHistory.js.map +0 -1
- package/dist/hooks/useElementFit.js.map +0 -1
- package/dist/hooks/useFirestoreWatch.js.map +0 -1
- package/dist/hooks/useForm.js.map +0 -1
- package/dist/hooks/useFreeze.js.map +0 -1
- package/dist/hooks/useHero.js.map +0 -1
- package/dist/hooks/useHero.module.scss +0 -5
- package/dist/hooks/useIntersection.js.map +0 -1
- package/dist/hooks/useMergeRefs.js.map +0 -1
- package/dist/hooks/useObserve.js.map +0 -1
- package/dist/hooks/usePagination.js.map +0 -1
- package/dist/hooks/usePooledOperation.js.map +0 -1
- package/dist/hooks/usePooling.js.map +0 -1
- package/dist/hooks/useRebound.js.map +0 -1
- package/dist/hooks/useShortIntl.js.map +0 -1
- package/dist/hooks/utility/useEvents.js.map +0 -1
- package/dist/hooks/utility/useModule.js.map +0 -1
- package/dist/hooks/utility/useQuery.js.map +0 -1
- package/dist/models/DebugLogger.js.map +0 -1
- package/dist/models/GenericContract.js.map +0 -1
- package/dist/storybookUtils/index.js.map +0 -1
- package/dist/type-utils.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/dist/utils/blockchain.js.map +0 -1
- package/dist/utils/flatten.js.map +0 -1
- package/dist/utils/html.utils.js.map +0 -1
- package/dist/utils/ownEvent.js.map +0 -1
package/dist/hooks/useHero.js
CHANGED
|
@@ -1,171 +1,183 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useHero;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _ownEvent = _interopRequireDefault(require("../utils/ownEvent"));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
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
|
+
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 _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
15
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
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 _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
18
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(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
|
+
const ID = function ID(id) {
|
|
21
|
+
return "".concat(id, "-hero");
|
|
4
22
|
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const ownEvent_1 = __importDefault(require("../utils/ownEvent"));
|
|
8
|
-
const ID = (id) => `${id}-hero`;
|
|
9
23
|
const viewport = window.visualViewport;
|
|
24
|
+
|
|
10
25
|
/**
|
|
11
26
|
* This hook implements the logic for a hero animation between 2 elements
|
|
12
27
|
*/
|
|
13
|
-
function useHero(id
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
}, 0);
|
|
28
|
+
function useHero(id) {
|
|
29
|
+
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
30
|
+
propsToTransition: []
|
|
31
|
+
};
|
|
32
|
+
let events = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
33
|
+
const _options$propsToTrans = options.propsToTransition,
|
|
34
|
+
propsToTransition = _options$propsToTrans === void 0 ? [] : _options$propsToTrans,
|
|
35
|
+
dataPreffix = options["data-preffix"],
|
|
36
|
+
repeatable = options.repeatable;
|
|
37
|
+
const _dataPreffix = dataPreffix ? "-".concat(dataPreffix) : "";
|
|
38
|
+
const dataProperty = "data".concat(_dataPreffix, "-hero");
|
|
39
|
+
const heroRef = (0, _react.useRef)(null);
|
|
40
|
+
(0, _react.useLayoutEffect)(function () {
|
|
41
|
+
heroRef.current.setAttribute(dataProperty, id);
|
|
42
|
+
}, [id]);
|
|
43
|
+
const getHerosOnScreen = (0, _react.useCallback)(function () {
|
|
44
|
+
const otherElements = Array.from(document.querySelectorAll("[".concat(dataProperty, "=\"").concat(id, "\"]"))).filter(function (el) {
|
|
45
|
+
return el !== heroRef.current;
|
|
46
|
+
});
|
|
47
|
+
return otherElements;
|
|
48
|
+
}, [id]);
|
|
49
|
+
function triggerHeroAnimation() {
|
|
50
|
+
const allPropsToTransition = ["width", "height", "top", "left"].concat(_toConsumableArray(propsToTransition));
|
|
51
|
+
const shouldHeroFn = events.onHeroDetect || function () {
|
|
52
|
+
return true;
|
|
53
|
+
};
|
|
54
|
+
const otherElements = getHerosOnScreen().filter(function (el) {
|
|
55
|
+
return shouldHeroFn(el, heroRef.current);
|
|
56
|
+
});
|
|
57
|
+
const currentElCoordinates = heroRef.current.getBoundingClientRect();
|
|
58
|
+
if (process.env.NODE_ENV === "development" && otherElements.length > 2) console.warn("There are too many elements to transition to, I will transition to the first I find", otherElements);
|
|
59
|
+
const otherElement = otherElements.find(function (el) {
|
|
60
|
+
return el !== heroRef.current;
|
|
61
|
+
});
|
|
62
|
+
if (otherElement) {
|
|
63
|
+
let willTheHeroMove = function willTheHeroMove(origin, target) {
|
|
64
|
+
return !(origin.top === target.top && origin.left === target.left && origin.width === target.width && origin.height === target.height);
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
* @param el
|
|
69
|
+
* @returns Returns if it will move
|
|
70
|
+
*/
|
|
71
|
+
let setCloneToCoordinatesOf = function setCloneToCoordinatesOf(el) {
|
|
72
|
+
const coordinates = el.getBoundingClientRect();
|
|
73
|
+
const currentCoordinates = clone.getBoundingClientRect();
|
|
74
|
+
const willMove = willTheHeroMove(coordinates, currentCoordinates);
|
|
75
|
+
clone.style.position = "fixed";
|
|
76
|
+
clone.style.top = "".concat(coordinates.top, "px");
|
|
77
|
+
clone.style.left = "".concat(coordinates.left, "px");
|
|
78
|
+
clone.style.width = "".concat(coordinates.width, "px");
|
|
79
|
+
clone.style.height = "".concat(coordinates.height, "px");
|
|
80
|
+
return willMove;
|
|
81
|
+
};
|
|
82
|
+
const _ref = events.onBeforeTransition ? events.onBeforeTransition(otherElement, heroRef.current) : [viewport, viewport],
|
|
83
|
+
_ref2 = _slicedToArray(_ref, 2),
|
|
84
|
+
originContainer = _ref2[0],
|
|
85
|
+
targetContainer = _ref2[1];
|
|
86
|
+
const shouldSkip = isElementOutsideContainer(targetContainer, currentElCoordinates) || isElementOutsideContainer(originContainer, otherElement.getBoundingClientRect()) ? (events.onHeroSkip || function () {
|
|
87
|
+
return true;
|
|
88
|
+
})(otherElement, heroRef.current) : false;
|
|
89
|
+
if (shouldSkip) {
|
|
90
|
+
var _events$onHeroSkipped;
|
|
91
|
+
(_events$onHeroSkipped = events.onHeroSkipped) === null || _events$onHeroSkipped === void 0 ? void 0 : _events$onHeroSkipped.call(events);
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const oldClone = document.querySelector("[".concat(dataProperty, "-clone=\"").concat(ID(id), "\"]"));
|
|
95
|
+
const clone = oldClone || otherElement.cloneNode(true);
|
|
96
|
+
|
|
97
|
+
// Clean up thos properties that can cause confusion since it's a clone
|
|
98
|
+
clone.style.visibility = "";
|
|
99
|
+
clone.removeAttribute(dataProperty);
|
|
100
|
+
clone.setAttribute("".concat(dataProperty, "-clone"), ID(id));
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* If it's repeatable, we should keep the flag that indicates the hero existance
|
|
104
|
+
*/
|
|
105
|
+
if (!repeatable)
|
|
106
|
+
// Since a transition is now triggering from the old element, he cannot be considered for other transitions
|
|
107
|
+
otherElement.removeAttribute(dataProperty);
|
|
108
|
+
const coordinates = otherElement.getBoundingClientRect();
|
|
109
|
+
const currentCoordinates = heroRef.current.getBoundingClientRect();
|
|
110
|
+
const itWontMove = !willTheHeroMove(coordinates, currentCoordinates);
|
|
111
|
+
if (itWontMove) return;
|
|
112
|
+
if (!oldClone) {
|
|
113
|
+
/** Set the clone over the starting element */
|
|
114
|
+
setCloneToCoordinatesOf(otherElement);
|
|
115
|
+
document.body.appendChild(clone);
|
|
116
|
+
}
|
|
117
|
+
heroRef.current.style.visibility = "hidden";
|
|
118
|
+
otherElement.style.visibility = "hidden";
|
|
119
|
+
clone.style.transition = "".concat(allPropsToTransition.map(function (prop) {
|
|
120
|
+
return "".concat(prop, " var(--animation--speed-fast, 250ms) ease-out");
|
|
121
|
+
}).join(", "));
|
|
122
|
+
setTimeout(function () {
|
|
123
|
+
const el = heroRef.current;
|
|
124
|
+
const cleanup = function cleanup() {
|
|
125
|
+
if (events.onHeroEnd) events.onHeroEnd();
|
|
126
|
+
clone.remove();
|
|
127
|
+
if (el) {
|
|
128
|
+
if (repeatable) el.setAttribute(dataProperty, id);
|
|
129
|
+
el.style.visibility = "";
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
if (events.onHeroStart) events.onHeroStart(clone, otherElement, heroRef.current);
|
|
133
|
+
if (!el) {
|
|
134
|
+
cleanup();
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
/** Set the clone over the new position */
|
|
138
|
+
const willMove = setCloneToCoordinatesOf(el);
|
|
139
|
+
if (!willMove) cleanup();else {
|
|
140
|
+
for (let propToTransition of propsToTransition) clone.style[propToTransition] = el.style[propToTransition];
|
|
141
|
+
const transitionEndCb = (0, _ownEvent.default)(function (_ref3) {
|
|
142
|
+
let target = _ref3.target,
|
|
143
|
+
currentTarget = _ref3.currentTarget;
|
|
144
|
+
if (target === currentTarget) cleanup();
|
|
145
|
+
});
|
|
146
|
+
clone.addEventListener("transitionend", transitionEndCb);
|
|
147
|
+
clone.addEventListener("transitionstart", function () {
|
|
148
|
+
const onCancelCb = (0, _ownEvent.default)(function () {
|
|
149
|
+
clone.removeEventListener("transitionend", transitionEndCb);
|
|
150
|
+
clone.removeEventListener("transitioncancel", onCancelCb);
|
|
151
|
+
});
|
|
152
|
+
clone.addEventListener("transitioncancel", onCancelCb);
|
|
153
|
+
});
|
|
141
154
|
}
|
|
155
|
+
}, 0);
|
|
142
156
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
157
|
+
}
|
|
158
|
+
(0, _react.useEffect)(function () {
|
|
159
|
+
triggerHeroAnimation();
|
|
160
|
+
}, []);
|
|
161
|
+
return {
|
|
162
|
+
heroRef: heroRef,
|
|
163
|
+
getHerosOnScreen: getHerosOnScreen,
|
|
164
|
+
trigger: triggerHeroAnimation
|
|
165
|
+
};
|
|
147
166
|
}
|
|
148
|
-
exports.default = useHero;
|
|
149
167
|
function isElementOutsideViewport(coordinates) {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return elementOverflowsViewport || elementUnderflowsViewport;
|
|
168
|
+
const elementOverflowsViewport = coordinates.left >= viewport.width || coordinates.top >= viewport.height;
|
|
169
|
+
const elementUnderflowsViewport = coordinates.left <= -coordinates.width || coordinates.top <= -coordinates.height;
|
|
170
|
+
return elementOverflowsViewport || elementUnderflowsViewport;
|
|
154
171
|
}
|
|
155
172
|
function isElementOutsideContainer(container, coordinates) {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
containerBounds.top - coordinates.top >= coordinates.height;
|
|
168
|
-
return elementUnderflowsViewport || elementOverflowsViewport;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
//# sourceMappingURL=useHero.js.map
|
|
173
|
+
if (container instanceof VisualViewport) {
|
|
174
|
+
return isElementOutsideViewport(coordinates);
|
|
175
|
+
} else {
|
|
176
|
+
const containerBounds = container.getBoundingClientRect();
|
|
177
|
+
const isContainerOutsideViewport = isElementOutsideViewport(containerBounds);
|
|
178
|
+
if (isContainerOutsideViewport) return true;
|
|
179
|
+
const elementOverflowsViewport = coordinates.left >= containerBounds.left + containerBounds.width || coordinates.top >= containerBounds.top + containerBounds.height;
|
|
180
|
+
const elementUnderflowsViewport = containerBounds.left - coordinates.left >= coordinates.width || containerBounds.top - coordinates.top >= coordinates.height;
|
|
181
|
+
return elementUnderflowsViewport || elementOverflowsViewport;
|
|
182
|
+
}
|
|
183
|
+
}
|
|
@@ -1,30 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useIntersection;
|
|
7
|
+
var _react = require("react");
|
|
4
8
|
function useIntersection() {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
const _useRef = (0, _react.useRef)([]),
|
|
10
|
+
targetMap = _useRef.current;
|
|
11
|
+
const _useRef2 = (0, _react.useRef)("IntersectionObserver" in window ? new IntersectionObserver(function (els) {
|
|
12
|
+
els.forEach(function (e) {
|
|
13
|
+
const result = targetMap.find(function (el) {
|
|
14
|
+
return el[0] === e.target;
|
|
12
15
|
});
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
16
|
+
if (result && e.isIntersecting) {
|
|
17
|
+
result[1]();
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}) : null),
|
|
21
|
+
observer = _useRef2.current;
|
|
22
|
+
return (0, _react.useMemo)(function () {
|
|
23
|
+
return {
|
|
24
|
+
observe: function observe(e, cb) {
|
|
25
|
+
targetMap.push([e, cb]);
|
|
26
|
+
if (observer) observer.observe(e);
|
|
27
|
+
},
|
|
28
|
+
unobserve: function unobserve(e) {
|
|
29
|
+
if (observer) observer.unobserve(e);
|
|
30
|
+
targetMap.splice(targetMap.findIndex(function (el) {
|
|
31
|
+
return el[0] === e;
|
|
32
|
+
}), 1);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
}
|
|
@@ -1,31 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
exports
|
|
4
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useMergeRefs;
|
|
7
|
+
exports.useMergeRefsFunc = useMergeRefsFunc;
|
|
8
|
+
var _react = require("react");
|
|
5
9
|
/**
|
|
6
10
|
* This function exists so we can work with multiple refs as a single one
|
|
7
11
|
*/
|
|
8
|
-
function useMergeRefs(mainRef
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
function useMergeRefs(mainRef) {
|
|
13
|
+
for (var _len = arguments.length, otherRefs = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
14
|
+
otherRefs[_key - 1] = arguments[_key];
|
|
15
|
+
}
|
|
16
|
+
(0, _react.useLayoutEffect)(function () {
|
|
17
|
+
for (let ref of otherRefs) ref.current = mainRef.current;
|
|
18
|
+
}, []);
|
|
19
|
+
return mainRef;
|
|
14
20
|
}
|
|
15
|
-
|
|
21
|
+
|
|
16
22
|
/**
|
|
17
23
|
* This function exists so we can work with multiple refs as a single one, almost immediatly
|
|
18
24
|
*/
|
|
19
|
-
function useMergeRefsFunc(mainRef
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
exports.useMergeRefsFunc = useMergeRefsFunc;
|
|
31
|
-
//# sourceMappingURL=useMergeRefs.js.map
|
|
25
|
+
function useMergeRefsFunc(mainRef) {
|
|
26
|
+
for (var _len2 = arguments.length, otherRefs = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
27
|
+
otherRefs[_key2 - 1] = arguments[_key2];
|
|
28
|
+
}
|
|
29
|
+
return function (providedRef) {
|
|
30
|
+
if (providedRef) for (let ref of [mainRef].concat(otherRefs)) {
|
|
31
|
+
if (typeof ref === "function") ref(providedRef);else ref.current = providedRef;
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
}
|
package/dist/hooks/useObserve.js
CHANGED
|
@@ -1,18 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useObserve;
|
|
7
|
+
var _react = require("react");
|
|
4
8
|
require("./shims/ObjectWatchShim.js");
|
|
9
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
10
|
+
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."); }
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
|
+
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; } }
|
|
14
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
5
15
|
function useObserve(toObserve, keysToObserve) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
(0, _react.useLayoutEffect)(function () {
|
|
17
|
+
const arr = Array.isArray(toObserve) ? toObserve : [toObserve];
|
|
18
|
+
const unwatchers = arr.map(function (object) {
|
|
19
|
+
return object.watch(keysToObserve, function () {
|
|
20
|
+
ss(function (p) {
|
|
21
|
+
return p + 1;
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
return function () {
|
|
26
|
+
return unwatchers.forEach(function (unwatch) {
|
|
27
|
+
return unwatch();
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
}, [toObserve]);
|
|
31
|
+
}
|