@koine/react 2.0.0-beta.1 → 2.0.0-beta.11
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/Alert/Alert.mjs +19 -7
- package/Alert/Alert.stories.mjs +18 -0
- package/Animations/Reveal.mjs +39 -13
- package/Animations/Underline.d.ts +1 -1
- package/Animations/Underline.mjs +14 -4
- package/Animations/useReveal.mjs +42 -40
- package/Autocomplete/AutocompleteDownshift.mjs +156 -157
- package/Autocomplete/AutocompleteDownshiftMultiselect.mjs +351 -352
- package/Autocomplete/AutocompleteMui.d.ts +1 -1
- package/Autocomplete/AutocompleteMui.mjs +126 -89
- package/Autocomplete/AutocompleteReach.mjs +110 -111
- package/Autocomplete/components.d.ts +12 -16
- package/Autocomplete/components.mjs +76 -23
- package/Autocomplete/helpers.mjs +11 -5
- package/Autocomplete/index.mjs +4 -3
- package/Bg/BgColor.d.ts +2 -7
- package/Bg/BgColor.mjs +36 -15
- package/Bg/BgPhoto.mjs +66 -11
- package/Bg/BgSvg.mjs +17 -7
- package/Breadcrumbs/Breadcrumbs.d.ts +1 -1
- package/Breadcrumbs/Breadcrumbs.mjs +82 -18
- package/Buttons/Button.d.ts +1 -1
- package/Buttons/Button.mjs +73 -9
- package/Buttons/ButtonComposite.d.ts +1 -1
- package/Buttons/ButtonComposite.mjs +99 -22
- package/Buttons/ButtonFab.d.ts +1 -3
- package/Buttons/ButtonFab.mjs +6 -4
- package/Buttons/ButtonLink.d.ts +1 -1
- package/Buttons/ButtonLink.mjs +14 -7
- package/Buttons/IconButton.d.ts +1 -3
- package/Buttons/IconButton.mjs +18 -6
- package/Calendar/CalendarDaygridCell.d.ts +2 -2
- package/Calendar/CalendarDaygridCell.mjs +64 -26
- package/Calendar/CalendarDaygridNav.d.ts +1 -1
- package/Calendar/CalendarDaygridNav.mjs +41 -12
- package/Calendar/CalendarDaygridTable.d.ts +3 -3
- package/Calendar/CalendarDaygridTable.mjs +97 -30
- package/Calendar/CalendarLegend.d.ts +1 -1
- package/Calendar/CalendarLegend.mjs +20 -6
- package/Calendar/calendar-api-google.d.ts +1 -1
- package/Calendar/calendar-api-google.mjs +75 -105
- package/Calendar/types.mjs +1 -1
- package/Calendar/useCalendar.d.ts +2 -2
- package/Calendar/useCalendar.mjs +184 -142
- package/Calendar/utils.mjs +101 -94
- package/Carousel/Carousel.mjs +377 -378
- package/Carousel/CarouselCss.d.ts +3 -20
- package/Carousel/CarouselCss.mjs +38 -16
- package/Collapsable/Collapsable.mjs +1 -1
- package/Collapsable/CollapsableReach.mjs +1 -3
- package/Collapsable/index.mjs +1 -2
- package/Debug/Debug.mjs +20 -6
- package/Details/Details.d.ts +5 -5
- package/Details/Details.mjs +64 -37
- package/Details/Details.stories.mjs +21 -0
- package/Dialog/DialogMui.d.ts +10 -327
- package/Dialog/DialogMui.mjs +50 -25
- package/Dialog/DialogMui.stories.mjs +20 -0
- package/Dialog/css/bare.d.ts +9 -327
- package/Dialog/css/bare.mjs +15 -17
- package/Dialog/css/index.stories.mjs +75 -0
- package/Dialog/m/bare.d.ts +2 -398
- package/Dialog/m/bare.mjs +114 -51
- package/Dialog/m/basic.mjs +10 -10
- package/Dialog/m/index.mjs +4 -4
- package/Dialog/sc/bare.d.ts +27 -405
- package/Dialog/sc/bare.mjs +40 -29
- package/Dialog/sc/framer.d.ts +15 -422
- package/Dialog/sc/framer.mjs +9 -9
- package/Dialog/sc/framerMaterial.d.ts +15 -422
- package/Dialog/sc/framerMaterial.mjs +9 -9
- package/Dialog/sc/index.stories.mjs +48 -0
- package/Dialog/sc/material.d.ts +27 -405
- package/Dialog/sc/material.mjs +37 -17
- package/Dialog/tw/bare.d.ts +9 -327
- package/Dialog/tw/bare.mjs +15 -28
- package/Dialog/tw/elegant.d.ts +9 -327
- package/Dialog/tw/elegant.mjs +15 -17
- package/Dialog/tw/framer.d.ts +3 -354
- package/Dialog/tw/framer.mjs +9 -9
- package/Dialog/tw/framerMaterial.d.ts +3 -354
- package/Dialog/tw/framerMaterial.mjs +9 -9
- package/Dialog/tw/index.stories.mjs +83 -0
- package/Dialog/tw/material.d.ts +9 -327
- package/Dialog/tw/material.mjs +15 -17
- package/Editor/Editor--tiptap.d.ts +1 -1
- package/Editor/Editor--tiptap.mjs +45 -18
- package/Editor/components.d.ts +3 -5
- package/Editor/components.mjs +26 -8
- package/FaviconTags.mjs +64 -0
- package/Form/Form.mjs +81 -47
- package/Form/sc/bare.d.ts +11 -11
- package/Form/sc/bare.mjs +21 -12
- package/Forms/Checkbox/Checkbox.d.ts +4 -4
- package/Forms/Checkbox/Checkbox.mjs +29 -11
- package/Forms/Feedback/Feedback.mjs +11 -6
- package/Forms/Field/Field.d.ts +2 -4
- package/Forms/Field/Field.mjs +35 -16
- package/Forms/Field/FieldControl.mjs +39 -19
- package/Forms/Field/FieldHint.d.ts +1 -1
- package/Forms/Field/FieldHint.mjs +5 -3
- package/Forms/Input/Input.d.ts +5 -5
- package/Forms/Input/Input.mjs +30 -11
- package/Forms/InputGroup/InputGroup.d.ts +4 -4
- package/Forms/InputGroup/InputGroup.mjs +52 -10
- package/Forms/Label/Label.d.ts +1 -1
- package/Forms/Label/Label.mjs +23 -5
- package/Forms/Password/Password.d.ts +1 -1
- package/Forms/Password/Password.mjs +48 -12
- package/Forms/Radio/Radio.mjs +50 -18
- package/Forms/Switch/Switch.d.ts +2 -2
- package/Forms/Switch/Switch.mjs +52 -12
- package/Forms/Textarea/Textarea.d.ts +1 -1
- package/Forms/Textarea/Textarea.mjs +21 -7
- package/Forms/Textarea/TextareaRich.mjs +39 -19
- package/Forms/Toggle/Toggle-tailwind.mjs +0 -1
- package/Forms/Toggle/Toggle.d.ts +7 -7
- package/Forms/Toggle/Toggle.mjs +113 -21
- package/Forms/Toggle/useToggle-tailwind.mjs +0 -1
- package/Forms/Toggle/useToggle.mjs +86 -68
- package/Forms/antispam.mjs +19 -21
- package/Forms/helpers.mjs +25 -19
- package/Forms/styles.d.ts +3 -7
- package/Forms/styles.mjs +50 -18
- package/Gauge/Gauge.mjs +99 -100
- package/Grid/Grid.d.ts +7 -30
- package/Grid/Grid.mjs +54 -32
- package/Hamburger/Hamburger.mjs +64 -37
- package/Header/useHeader.mjs +23 -18
- package/Hidden/Hidden.d.ts +1 -1
- package/Hidden/Hidden.mjs +9 -9
- package/Img/sc/bare.d.ts +1 -1
- package/Img/sc/bare.mjs +31 -34
- package/Img/types.mjs +1 -1
- package/Link/Link.d.ts +1 -3
- package/Link/Link.mjs +1 -3
- package/Link/LinkBlank.d.ts +2 -5
- package/Link/LinkBlank.mjs +25 -10
- package/Menu/Menu.d.ts +1 -1
- package/Menu/Menu.mjs +10 -3
- package/Menu/MenuMui.mjs +1 -2
- package/MenuItem/MenuItem.d.ts +1 -4
- package/MenuItem/MenuItem.mjs +19 -3
- package/MenuItem/MenuItemMui.mjs +0 -1
- package/MenuItem/useMenuItem.mjs +45 -27
- package/Meta/Meta.mjs +5 -3
- package/NoJs/NoJs.mjs +7 -4
- package/Pagination/PaginationNav.d.ts +1 -1
- package/Pagination/PaginationNav.mjs +90 -29
- package/Pagination/PaginationResults.mjs +31 -8
- package/Pill/Pill.d.ts +4 -4
- package/Pill/Pill.mjs +36 -6
- package/Progress/ProgressCircular.mjs +48 -10
- package/Progress/ProgressLinear.mjs +39 -19
- package/Progress/ProgressOverlay.mjs +56 -16
- package/Rating/Rating.d.ts +5 -5
- package/Rating/Rating.mjs +118 -34
- package/Rating/index.mjs +37 -24
- package/Select/SelectDownshift.mjs +37 -38
- package/Select/components.d.ts +1 -1
- package/Select/components.mjs +21 -8
- package/Select/index.mjs +2 -3
- package/Sidebar/Sidebar.mjs +57 -17
- package/Spacing/Spacing.d.ts +1 -1
- package/Spacing/Spacing.mjs +27 -17
- package/Sticky/Sticky.mjs +218 -219
- package/Sticky/StickyCss.mjs +8 -4
- package/Sticky/index.mjs +1 -1
- package/Tabs/TabsMui.d.ts +9 -298
- package/Tabs/TabsMui.mjs +39 -27
- package/Tabs/TabsMui.stories.mjs +20 -0
- package/Tabs/sc/bare.mjs +1 -3
- package/Tabs/sc/index.stories.mjs +0 -0
- package/Tabs/tw/bare.d.ts +7 -296
- package/Tabs/tw/bare.mjs +11 -13
- package/Tabs/tw/index.stories.mjs +25 -0
- package/Tabs/tw/material.d.ts +7 -332
- package/Tabs/tw/material.mjs +11 -15
- package/Tabs/useTabs.mjs +24 -21
- package/Typography/CopyPasteVisible.d.ts +1 -1
- package/Typography/CopyPasteVisible.mjs +5 -3
- package/Typography/Native.d.ts +5 -5
- package/Typography/Native.mjs +45 -12
- package/Typography/ReadMore.mjs +100 -29
- package/Typography/TextLoop.mjs +75 -31
- package/Typography/TypeStairs.mjs +36 -24
- package/css/index.mjs +20 -21
- package/helpers/classed.mjs +21 -30
- package/helpers/classed.stories.mjs +121 -0
- package/helpers/createUseMediaQueryWidth.mjs +140 -140
- package/helpers/extend-component.mjs +7 -7
- package/helpers/mergeRefs.mjs +3 -4
- package/hooks/index.mjs +3 -3
- package/hooks/types.mjs +3 -1
- package/hooks/useAsyncFn.mjs +28 -26
- package/hooks/useDateLocale.mjs +22 -22
- package/hooks/useFirstMountState.mjs +2 -3
- package/hooks/useFixedOffset.mjs +23 -24
- package/hooks/useFocus.mjs +7 -5
- package/hooks/useInterval.mjs +15 -14
- package/hooks/useIsomorphicLayoutEffect.mjs +1 -4
- package/hooks/useKeyUp.mjs +9 -11
- package/hooks/useMeasure.mjs +74 -67
- package/hooks/useMountedState.mjs +5 -6
- package/hooks/useNavigateAway.mjs +26 -25
- package/hooks/usePrevious.mjs +9 -4
- package/hooks/usePreviousRef.mjs +2 -2
- package/hooks/useScrollPosition.mjs +28 -26
- package/hooks/useScrollThreshold.mjs +18 -13
- package/hooks/useScrollTo.mjs +6 -8
- package/hooks/useSmoothScroll.mjs +12 -16
- package/hooks/useSpinDelay.mjs +24 -22
- package/hooks/useTraceUpdate.mjs +8 -7
- package/hooks/useUpdateEffect.mjs +4 -5
- package/hooks/useWindowSize.mjs +13 -10
- package/index.mjs +4 -5
- package/m/MotionProvider.mjs +5 -4
- package/m/index.mjs +1 -2
- package/package.json +17 -18
- package/shared/index.mjs +35 -0
- package/styles/Body.d.ts +2 -2
- package/styles/Body.mjs +8 -5
- package/styles/Global.mjs +36 -5
- package/styles/index.mjs +5 -5
- package/styles/media.mjs +63 -68
- package/styles/spacing.mjs +26 -25
- package/styles/styled.mjs +23 -10
- package/styles/theme--vanilla.mjs +26 -19
- package/styles/theme.mjs +16 -19
- package/tw/index.mjs +20 -21
- package/twm/index.mjs +20 -21
- package/types.mjs +1 -1
- package/typings.d.ts +1 -0
- package/Alert/Alert.js +0 -14
- package/Alert/index.js +0 -4
- package/Alert/package.json +0 -6
- package/Animations/Reveal.js +0 -21
- package/Animations/Underline.js +0 -8
- package/Animations/index.js +0 -6
- package/Animations/package.json +0 -6
- package/Animations/useReveal.js +0 -75
- package/Autocomplete/AutocompleteDownshift.js +0 -161
- package/Autocomplete/AutocompleteDownshiftMultiselect.js +0 -356
- package/Autocomplete/AutocompleteMui.js +0 -180
- package/Autocomplete/AutocompleteReach.js +0 -115
- package/Autocomplete/components.js +0 -37
- package/Autocomplete/helpers.js +0 -34
- package/Autocomplete/index.js +0 -7
- package/Autocomplete/package.json +0 -6
- package/Bg/BgColor.js +0 -25
- package/Bg/BgPhoto.js +0 -20
- package/Bg/BgSvg.js +0 -16
- package/Bg/index.js +0 -6
- package/Bg/package.json +0 -6
- package/Breadcrumbs/Breadcrumbs.js +0 -31
- package/Breadcrumbs/index.js +0 -4
- package/Breadcrumbs/package.json +0 -6
- package/Buttons/Button.js +0 -17
- package/Buttons/ButtonComposite.js +0 -32
- package/Buttons/ButtonFab.js +0 -9
- package/Buttons/ButtonLink.js +0 -15
- package/Buttons/IconButton.js +0 -10
- package/Buttons/index.js +0 -8
- package/Buttons/package.json +0 -6
- package/Calendar/CalendarDaygridCell.js +0 -61
- package/Calendar/CalendarDaygridNav.js +0 -28
- package/Calendar/CalendarDaygridTable.js +0 -52
- package/Calendar/CalendarLegend.js +0 -19
- package/Calendar/calendar-api-google.js +0 -133
- package/Calendar/index.js +0 -9
- package/Calendar/package.json +0 -6
- package/Calendar/types.js +0 -2
- package/Calendar/useCalendar.js +0 -187
- package/Calendar/utils.js +0 -215
- package/Carousel/Carousel.js +0 -381
- package/Carousel/CarouselCss.js +0 -26
- package/Carousel/index.js +0 -4
- package/Carousel/package.json +0 -6
- package/Collapsable/Collapsable.js +0 -4
- package/Collapsable/CollapsableReach.js +0 -252
- package/Collapsable/index.js +0 -5
- package/Collapsable/package.json +0 -6
- package/Debug/Debug.js +0 -13
- package/Debug/index.js +0 -4
- package/Debug/package.json +0 -6
- package/Details/Details.js +0 -66
- package/Details/index.js +0 -4
- package/Details/package.json +0 -6
- package/Dialog/DialogMui.js +0 -83
- package/Dialog/css/bare.js +0 -24
- package/Dialog/index.js +0 -5
- package/Dialog/m/bare.js +0 -55
- package/Dialog/m/basic.js +0 -35
- package/Dialog/m/index.js +0 -8
- package/Dialog/m/package.json +0 -6
- package/Dialog/package.json +0 -6
- package/Dialog/sc/bare.js +0 -46
- package/Dialog/sc/framer.js +0 -19
- package/Dialog/sc/framerMaterial.js +0 -19
- package/Dialog/sc/material.js +0 -24
- package/Dialog/tw/bare.js +0 -45
- package/Dialog/tw/elegant.js +0 -23
- package/Dialog/tw/framer.js +0 -19
- package/Dialog/tw/framerMaterial.js +0 -19
- package/Dialog/tw/material.js +0 -23
- package/Editor/Editor--tiptap.js +0 -31
- package/Editor/components.js +0 -15
- package/Editor/index.js +0 -4
- package/Editor/package.json +0 -6
- package/FaviconTags/FaviconTags.js +0 -20
- package/FaviconTags/FaviconTags.mjs +0 -16
- package/FaviconTags/index.d.ts +0 -2
- package/FaviconTags/index.js +0 -7
- package/FaviconTags/index.mjs +0 -2
- package/FaviconTags/package.json +0 -6
- package/Form/Form.js +0 -65
- package/Form/index.js +0 -4
- package/Form/package.json +0 -6
- package/Form/sc/bare.js +0 -23
- package/Forms/Checkbox/Checkbox.js +0 -21
- package/Forms/Checkbox/index.js +0 -4
- package/Forms/Checkbox/package.json +0 -6
- package/Forms/Feedback/Feedback.js +0 -13
- package/Forms/Feedback/index.js +0 -4
- package/Forms/Feedback/package.json +0 -6
- package/Forms/Field/Field.js +0 -35
- package/Forms/Field/FieldControl.js +0 -51
- package/Forms/Field/FieldHint.js +0 -7
- package/Forms/Field/index.js +0 -5
- package/Forms/Field/package.json +0 -6
- package/Forms/Input/Input.js +0 -20
- package/Forms/Input/index.js +0 -4
- package/Forms/Input/package.json +0 -6
- package/Forms/InputGroup/InputGroup.js +0 -19
- package/Forms/InputGroup/index.js +0 -4
- package/Forms/InputGroup/package.json +0 -6
- package/Forms/Label/Label.js +0 -9
- package/Forms/Label/index.js +0 -4
- package/Forms/Label/package.json +0 -6
- package/Forms/Password/Password.js +0 -20
- package/Forms/Password/index.js +0 -4
- package/Forms/Password/package.json +0 -6
- package/Forms/Radio/Radio.js +0 -28
- package/Forms/Radio/index.js +0 -4
- package/Forms/Radio/package.json +0 -6
- package/Forms/Switch/Switch.js +0 -23
- package/Forms/Switch/index.js +0 -4
- package/Forms/Switch/package.json +0 -6
- package/Forms/Textarea/Textarea.js +0 -15
- package/Forms/Textarea/TextareaRich.js +0 -31
- package/Forms/Textarea/index.js +0 -5
- package/Forms/Textarea/package.json +0 -6
- package/Forms/Toggle/Toggle-tailwind.js +0 -99
- package/Forms/Toggle/Toggle.js +0 -36
- package/Forms/Toggle/index.js +0 -4
- package/Forms/Toggle/package.json +0 -6
- package/Forms/Toggle/useToggle-tailwind.js +0 -202
- package/Forms/Toggle/useToggle.js +0 -149
- package/Forms/antispam.js +0 -66
- package/Forms/helpers.js +0 -54
- package/Forms/index.js +0 -19
- package/Forms/package.json +0 -6
- package/Forms/styles.js +0 -32
- package/Gauge/Gauge.js +0 -106
- package/Grid/Grid.js +0 -56
- package/Grid/index.js +0 -4
- package/Grid/package.json +0 -6
- package/Hamburger/Hamburger.js +0 -56
- package/Hamburger/index.js +0 -4
- package/Hamburger/package.json +0 -6
- package/Header/index.js +0 -4
- package/Header/package.json +0 -6
- package/Header/useHeader.js +0 -35
- package/Hidden/Hidden.js +0 -13
- package/Hidden/index.js +0 -4
- package/Hidden/package.json +0 -6
- package/Img/index.js +0 -4
- package/Img/package.json +0 -6
- package/Img/sc/bare.js +0 -42
- package/Img/types.js +0 -2
- package/Link/Link.js +0 -7
- package/Link/LinkBlank.js +0 -21
- package/Link/index.js +0 -5
- package/Link/package.json +0 -6
- package/Menu/Menu.js +0 -7
- package/Menu/MenuMui.js +0 -165
- package/Menu/index.js +0 -4
- package/Menu/package.json +0 -6
- package/MenuItem/MenuItem.js +0 -7
- package/MenuItem/MenuItemMui.js +0 -32
- package/MenuItem/index.js +0 -4
- package/MenuItem/package.json +0 -6
- package/MenuItem/useMenuItem.js +0 -64
- package/Meta/Meta.js +0 -10
- package/Meta/index.js +0 -7
- package/Meta/package.json +0 -6
- package/NoJs/NoJs.js +0 -11
- package/NoJs/index.js +0 -7
- package/NoJs/package.json +0 -6
- package/Pagination/PaginationNav.js +0 -65
- package/Pagination/PaginationResults.js +0 -15
- package/Pagination/index.js +0 -5
- package/Pagination/package.json +0 -6
- package/Pill/Pill.js +0 -10
- package/Pill/index.js +0 -4
- package/Pill/package.json +0 -6
- package/Progress/ProgressCircular.js +0 -19
- package/Progress/ProgressLinear.js +0 -28
- package/Progress/ProgressOverlay.js +0 -28
- package/Progress/index.js +0 -6
- package/Progress/package.json +0 -6
- package/Rating/Rating.js +0 -75
- package/Rating/index.js +0 -57
- package/Rating/package.json +0 -6
- package/Select/SelectDownshift.js +0 -41
- package/Select/components.js +0 -15
- package/Select/index.js +0 -7
- package/Select/package.json +0 -6
- package/Sidebar/Sidebar.js +0 -27
- package/Sidebar/index.js +0 -4
- package/Sidebar/package.json +0 -6
- package/Spacing/Spacing.js +0 -49
- package/Spacing/index.js +0 -4
- package/Spacing/package.json +0 -6
- package/Sticky/Sticky.js +0 -222
- package/Sticky/StickyCss.js +0 -10
- package/Sticky/index.js +0 -5
- package/Sticky/package.json +0 -6
- package/Tabs/TabsMui.js +0 -52
- package/Tabs/index.js +0 -4
- package/Tabs/package.json +0 -6
- package/Tabs/sc/bare.js +0 -87
- package/Tabs/tw/bare.js +0 -20
- package/Tabs/tw/material.js +0 -21
- package/Tabs/useTabs.js +0 -47
- package/Typography/CopyPasteVisible.js +0 -7
- package/Typography/Native.js +0 -17
- package/Typography/ReadMore.js +0 -47
- package/Typography/TextLoop.js +0 -51
- package/Typography/TypeStairs.js +0 -52
- package/Typography/index.js +0 -8
- package/Typography/package.json +0 -6
- package/css/index.js +0 -36
- package/css/package.json +0 -6
- package/helpers/classed.js +0 -78
- package/helpers/createUseMediaQueryWidth.js +0 -183
- package/helpers/extend-component.js +0 -17
- package/helpers/index.js +0 -7
- package/helpers/mergeRefs.js +0 -17
- package/helpers/package.json +0 -6
- package/hooks/index.js +0 -44
- package/hooks/package.json +0 -6
- package/hooks/types.js +0 -2
- package/hooks/useAsyncFn.js +0 -41
- package/hooks/useDateLocale.js +0 -41
- package/hooks/useFirstMountState.js +0 -17
- package/hooks/useFixedOffset.js +0 -62
- package/hooks/useFocus.js +0 -16
- package/hooks/useInterval.js +0 -32
- package/hooks/useIsomorphicLayoutEffect.js +0 -13
- package/hooks/useKeyUp.js +0 -27
- package/hooks/useMeasure.js +0 -171
- package/hooks/useMountedState.js +0 -20
- package/hooks/useNavigateAway.js +0 -73
- package/hooks/usePrevious.js +0 -16
- package/hooks/usePreviousRef.js +0 -13
- package/hooks/useScrollPosition.js +0 -73
- package/hooks/useScrollThreshold.js +0 -33
- package/hooks/useScrollTo.js +0 -27
- package/hooks/useSmoothScroll.js +0 -44
- package/hooks/useSpinDelay.js +0 -54
- package/hooks/useTraceUpdate.js +0 -26
- package/hooks/useUpdateEffect.js +0 -19
- package/hooks/useWindowSize.js +0 -34
- package/index.js +0 -8
- package/m/MotionProvider.js +0 -43
- package/m/index.js +0 -9
- package/m/lite.js +0 -4
- package/m/max.js +0 -4
- package/m/package.json +0 -6
- package/sc/index.js +0 -37
- package/sc/package.json +0 -6
- package/scm/index.js +0 -36
- package/scm/package.json +0 -6
- package/shared/index.js +0 -11
- package/shared/package.json +0 -6
- package/styles/Body.js +0 -16
- package/styles/Global.js +0 -21
- package/styles/index.js +0 -41
- package/styles/media.js +0 -161
- package/styles/package.json +0 -6
- package/styles/spacing.js +0 -52
- package/styles/styled.js +0 -17
- package/styles/theme--vanilla.js +0 -64
- package/styles/theme.js +0 -45
- package/tw/index.js +0 -36
- package/tw/package.json +0 -6
- package/twm/index.js +0 -36
- package/twm/package.json +0 -6
- package/types.js +0 -2
- /package/{FaviconTags/FaviconTags.d.ts → FaviconTags.d.ts} +0 -0
package/hooks/useFocus.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useFocus = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://stackoverflow.com/a/54159564/1938970
|
|
7
|
-
*/
|
|
8
|
-
var useFocus = function () {
|
|
9
|
-
var elementRef = (0, react_1.useRef)(null);
|
|
10
|
-
var setFocus = function () {
|
|
11
|
-
elementRef.current && elementRef.current.focus();
|
|
12
|
-
};
|
|
13
|
-
return [elementRef, setFocus];
|
|
14
|
-
};
|
|
15
|
-
exports.useFocus = useFocus;
|
|
16
|
-
exports.default = exports.useFocus;
|
package/hooks/useInterval.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useInterval = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var noop_1 = tslib_1.__importDefault(require("@koine/utils/noop"));
|
|
7
|
-
/**
|
|
8
|
-
* @borrows [dan abramov](https://overreacted.io/making-setinterval-declarative-with-react-hooks/)
|
|
9
|
-
*
|
|
10
|
-
* We just add `deps` array argument and typescript support
|
|
11
|
-
*/
|
|
12
|
-
function useInterval(callback, delay, deps) {
|
|
13
|
-
if (deps === void 0) { deps = []; }
|
|
14
|
-
var savedCallback = (0, react_1.useRef)();
|
|
15
|
-
(0, react_1.useEffect)(function () {
|
|
16
|
-
savedCallback.current = callback;
|
|
17
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
18
|
-
}, tslib_1.__spreadArray([callback], deps, true));
|
|
19
|
-
(0, react_1.useEffect)(function () {
|
|
20
|
-
function tick() {
|
|
21
|
-
if (savedCallback.current)
|
|
22
|
-
savedCallback.current();
|
|
23
|
-
}
|
|
24
|
-
if (delay !== null) {
|
|
25
|
-
var id_1 = setInterval(tick, delay);
|
|
26
|
-
return function () { return clearInterval(id_1); };
|
|
27
|
-
}
|
|
28
|
-
return noop_1.default;
|
|
29
|
-
}, [delay]);
|
|
30
|
-
}
|
|
31
|
-
exports.useInterval = useInterval;
|
|
32
|
-
exports.default = useInterval;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useIsomorphicLayoutEffect = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var isBrowser_1 = tslib_1.__importDefault(require("@koine/utils/isBrowser"));
|
|
7
|
-
/**
|
|
8
|
-
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useIsomorphicLayoutEffect.ts)
|
|
9
|
-
*/
|
|
10
|
-
exports.useIsomorphicLayoutEffect = isBrowser_1.default
|
|
11
|
-
? react_1.useLayoutEffect
|
|
12
|
-
: react_1.useEffect;
|
|
13
|
-
exports.default = exports.useIsomorphicLayoutEffect;
|
package/hooks/useKeyUp.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useKeyUp = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var on_1 = tslib_1.__importDefault(require("@koine/dom/on"));
|
|
7
|
-
function useKeyUp(callback, deps) {
|
|
8
|
-
if (deps === void 0) { deps = []; }
|
|
9
|
-
(0, react_1.useEffect)(function () {
|
|
10
|
-
var listener = (0, on_1.default)(window, "keyup", function (event) {
|
|
11
|
-
// const { key } = event;
|
|
12
|
-
// be sure we do not intercept keys combinations maybe used for other
|
|
13
|
-
// actions like native browser navigation shortcuts
|
|
14
|
-
// @see https://stackoverflow.com/a/37559790/1938970
|
|
15
|
-
if (!event.ctrlKey &&
|
|
16
|
-
!event.altKey &&
|
|
17
|
-
!event.shiftKey &&
|
|
18
|
-
!event.metaKey) {
|
|
19
|
-
callback(event);
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return listener;
|
|
23
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
24
|
-
}, tslib_1.__spreadArray([callback], deps, true));
|
|
25
|
-
}
|
|
26
|
-
exports.useKeyUp = useKeyUp;
|
|
27
|
-
exports.default = useKeyUp;
|
package/hooks/useMeasure.js
DELETED
|
@@ -1,171 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMeasure = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var debounce_1 = tslib_1.__importDefault(require("@koine/utils/debounce"));
|
|
7
|
-
var noop_1 = tslib_1.__importDefault(require("@koine/utils/noop"));
|
|
8
|
-
var listenResizeDebounced_1 = tslib_1.__importDefault(require("@koine/dom/listenResizeDebounced"));
|
|
9
|
-
var listenScrollDebounced_1 = tslib_1.__importDefault(require("@koine/dom/listenScrollDebounced"));
|
|
10
|
-
var on_1 = tslib_1.__importDefault(require("@koine/dom/on"));
|
|
11
|
-
var off_1 = tslib_1.__importDefault(require("@koine/dom/off"));
|
|
12
|
-
var observer;
|
|
13
|
-
// Returns a list of scroll offsets
|
|
14
|
-
function findScrollContainers(element) {
|
|
15
|
-
var result = [];
|
|
16
|
-
if (!element || element === document.body)
|
|
17
|
-
return result;
|
|
18
|
-
var _a = window.getComputedStyle(element), overflow = _a.overflow, overflowX = _a.overflowX, overflowY = _a.overflowY;
|
|
19
|
-
if ([overflow, overflowX, overflowY].some(function (prop) { return prop === "auto" || prop === "scroll"; }))
|
|
20
|
-
result.push(element);
|
|
21
|
-
return tslib_1.__spreadArray(tslib_1.__spreadArray([], result, true), findScrollContainers(element.parentElement), true);
|
|
22
|
-
}
|
|
23
|
-
var keys = [
|
|
24
|
-
"x",
|
|
25
|
-
"y",
|
|
26
|
-
"top",
|
|
27
|
-
"bottom",
|
|
28
|
-
"left",
|
|
29
|
-
"right",
|
|
30
|
-
"width",
|
|
31
|
-
"height",
|
|
32
|
-
];
|
|
33
|
-
var areBoundsEqual = function (a, b) {
|
|
34
|
-
return keys.every(function (key) { return a[key] === b[key]; });
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Use measure hook
|
|
38
|
-
*
|
|
39
|
-
* @borrows [pmndrs/react-use-measure](https://github.com/pmndrs/react-use-measure)
|
|
40
|
-
*/
|
|
41
|
-
function useMeasure(options) {
|
|
42
|
-
var _a = (options || {}).scroll /* offsetSize = false */, scroll = _a === void 0 ? false : _a /* offsetSize = false */;
|
|
43
|
-
var _b = (0, react_1.useState)({
|
|
44
|
-
left: 0,
|
|
45
|
-
top: 0,
|
|
46
|
-
width: 0,
|
|
47
|
-
height: 0,
|
|
48
|
-
bottom: 0,
|
|
49
|
-
right: 0,
|
|
50
|
-
x: 0,
|
|
51
|
-
y: 0,
|
|
52
|
-
}), bounds = _b[0], setBounds = _b[1];
|
|
53
|
-
// keep all state in a ref
|
|
54
|
-
var state = (0, react_1.useRef)([
|
|
55
|
-
// element
|
|
56
|
-
null,
|
|
57
|
-
// scrollContainers
|
|
58
|
-
null,
|
|
59
|
-
// resizeObserver
|
|
60
|
-
null,
|
|
61
|
-
// lastBounds
|
|
62
|
-
bounds,
|
|
63
|
-
]);
|
|
64
|
-
// make sure to update state only as long as the component is truly mounted
|
|
65
|
-
var mounted = (0, react_1.useRef)(false);
|
|
66
|
-
(0, react_1.useEffect)(function () {
|
|
67
|
-
mounted.current = true;
|
|
68
|
-
return function () { return void (mounted.current = false); };
|
|
69
|
-
}, []);
|
|
70
|
-
// memoize handlers, so event-listeners know when they should update
|
|
71
|
-
var _c = (0, react_1.useMemo)(function () {
|
|
72
|
-
var callback = function () {
|
|
73
|
-
var _args = [];
|
|
74
|
-
for (var _i = 0; _i < arguments.length; _i++) {
|
|
75
|
-
_args[_i] = arguments[_i];
|
|
76
|
-
}
|
|
77
|
-
var _a = state.current, element = _a[0], lastBounds = _a[3];
|
|
78
|
-
if (!element)
|
|
79
|
-
return;
|
|
80
|
-
var size = element.getBoundingClientRect();
|
|
81
|
-
// if (element instanceof HTMLElement && offsetSize) {
|
|
82
|
-
// size.height = element.offsetHeight;
|
|
83
|
-
// size.width = element.offsetWidth;
|
|
84
|
-
// }
|
|
85
|
-
Object.freeze(size);
|
|
86
|
-
if (mounted.current && !areBoundsEqual(lastBounds, size)) {
|
|
87
|
-
state.current[3] = size;
|
|
88
|
-
setBounds(size);
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
var debouncedCallback = (0, debounce_1.default)(callback);
|
|
92
|
-
return [callback, debouncedCallback, debouncedCallback];
|
|
93
|
-
}, [setBounds /* , offsetSize */]), forceRefresh = _c[0] /* resizeChange */, scrollChange = _c[2];
|
|
94
|
-
// cleanup current scroll-listeners / observers
|
|
95
|
-
function removeListeners() {
|
|
96
|
-
var _a = state.current, scrollContainers = _a[1], resizeObserver = _a[2];
|
|
97
|
-
if (scrollContainers) {
|
|
98
|
-
scrollContainers.forEach(function (element) {
|
|
99
|
-
return (0, off_1.default)(element, "scroll", scrollChange);
|
|
100
|
-
});
|
|
101
|
-
state.current[1] = null;
|
|
102
|
-
}
|
|
103
|
-
if (resizeObserver) {
|
|
104
|
-
resizeObserver.disconnect();
|
|
105
|
-
state.current[2] = null;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
// add scroll-listeners / observers
|
|
109
|
-
function addListeners() {
|
|
110
|
-
var _a = state.current, element = _a[0], scrollContainers = _a[1];
|
|
111
|
-
if (!element)
|
|
112
|
-
return;
|
|
113
|
-
if (!observer && ResizeObserver) {
|
|
114
|
-
observer = new ResizeObserver(scrollChange);
|
|
115
|
-
state.current[2] = observer;
|
|
116
|
-
observer.observe(element);
|
|
117
|
-
if (scroll && scrollContainers) {
|
|
118
|
-
scrollContainers.forEach(function (scrollContainer) {
|
|
119
|
-
return (0, on_1.default)(scrollContainer, "scroll", scrollChange, {
|
|
120
|
-
capture: true,
|
|
121
|
-
passive: true,
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
// the ref we expose to the user
|
|
128
|
-
var ref = function (node) {
|
|
129
|
-
if (!node || node === state.current[0])
|
|
130
|
-
return;
|
|
131
|
-
removeListeners();
|
|
132
|
-
state.current[0] = node;
|
|
133
|
-
state.current[1] = findScrollContainers(node);
|
|
134
|
-
addListeners();
|
|
135
|
-
};
|
|
136
|
-
// add general event listeners
|
|
137
|
-
// useOnWindowScroll(forceRefresh, Boolean(scroll));
|
|
138
|
-
// useOnWindowResize(() => {
|
|
139
|
-
// debugger;
|
|
140
|
-
// forceRefresh();
|
|
141
|
-
// });
|
|
142
|
-
(0, react_1.useEffect)(function () {
|
|
143
|
-
if (scroll) {
|
|
144
|
-
var listener = (0, listenScrollDebounced_1.default)(0, forceRefresh, 100);
|
|
145
|
-
return listener;
|
|
146
|
-
}
|
|
147
|
-
return noop_1.default;
|
|
148
|
-
}, [scroll, forceRefresh]);
|
|
149
|
-
(0, react_1.useEffect)(function () {
|
|
150
|
-
// const listener = listenResizeDebounced(onWindowResize);
|
|
151
|
-
// return listener;
|
|
152
|
-
var listener = (0, listenResizeDebounced_1.default)(0, forceRefresh, 100);
|
|
153
|
-
return listener;
|
|
154
|
-
}, [forceRefresh]);
|
|
155
|
-
// respond to changes that are relevant for the listeners
|
|
156
|
-
(0, react_1.useEffect)(function () {
|
|
157
|
-
removeListeners();
|
|
158
|
-
addListeners();
|
|
159
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
160
|
-
}, [scroll /* , scrollChange, resizeChange */]);
|
|
161
|
-
(0, react_1.useEffect)(function () {
|
|
162
|
-
// operate on mount, @kuus on the original version there is no call on mount?
|
|
163
|
-
forceRefresh();
|
|
164
|
-
// remove all listeners when the components unmounts
|
|
165
|
-
return removeListeners;
|
|
166
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
167
|
-
}, []);
|
|
168
|
-
return [ref, bounds, forceRefresh];
|
|
169
|
-
}
|
|
170
|
-
exports.useMeasure = useMeasure;
|
|
171
|
-
exports.default = useMeasure;
|
package/hooks/useMountedState.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useMountedState = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useMountedState.ts)
|
|
7
|
-
*/
|
|
8
|
-
function useMountedState() {
|
|
9
|
-
var mountedRef = (0, react_1.useRef)(false);
|
|
10
|
-
var get = (0, react_1.useCallback)(function () { return mountedRef.current; }, []);
|
|
11
|
-
(0, react_1.useEffect)(function () {
|
|
12
|
-
mountedRef.current = true;
|
|
13
|
-
return function () {
|
|
14
|
-
mountedRef.current = false;
|
|
15
|
-
};
|
|
16
|
-
}, []);
|
|
17
|
-
return get;
|
|
18
|
-
}
|
|
19
|
-
exports.useMountedState = useMountedState;
|
|
20
|
-
exports.default = useMountedState;
|
package/hooks/useNavigateAway.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useNavigateAway = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var on_1 = tslib_1.__importDefault(require("@koine/dom/on"));
|
|
7
|
-
// type UseNavigateAwayPagehideHandler = (event: PageTransitionEvent) => unknown;
|
|
8
|
-
/**
|
|
9
|
-
* @resources
|
|
10
|
-
*
|
|
11
|
-
* About browser's specs see:
|
|
12
|
-
* - https://developer.mozilla.org/en-US/docs/Web/API/Window/pagehide_event
|
|
13
|
-
* - https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW5
|
|
14
|
-
* - https://stackoverflow.com/questions/58009424/pagehide-event-on-google-chrome
|
|
15
|
-
*
|
|
16
|
-
* About react see:
|
|
17
|
-
* - https://github.com/jacobbuck/react-beforeunload
|
|
18
|
-
* - https://github.com/dioscarey/react-beforeunload-component
|
|
19
|
-
*
|
|
20
|
-
* About next.js see:
|
|
21
|
-
* - https://github.com/vercel/next.js/issues/2476
|
|
22
|
-
* - https://github.com/vercel/next.js/issues/2694
|
|
23
|
-
*
|
|
24
|
-
* For the callback technique see:
|
|
25
|
-
* - https://stackoverflow.com/a/11835394/1938970
|
|
26
|
-
*/
|
|
27
|
-
var useNavigateAway = function (handler) {
|
|
28
|
-
var beforeUnloadHandlerRef = (0, react_1.useRef)();
|
|
29
|
-
// const pagehideHandlerRef = useRef<UseNavigateAwayPagehideHandler | undefined>();
|
|
30
|
-
(0, react_1.useEffect)(function () {
|
|
31
|
-
beforeUnloadHandlerRef.current = function (event) {
|
|
32
|
-
var customMessageOrCondition = handler(event);
|
|
33
|
-
if (customMessageOrCondition) {
|
|
34
|
-
event.preventDefault();
|
|
35
|
-
}
|
|
36
|
-
// Handle legacy `event.returnValue` property
|
|
37
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/Window/beforeunload_event
|
|
38
|
-
if (typeof customMessageOrCondition === "string") {
|
|
39
|
-
return (event.returnValue = customMessageOrCondition);
|
|
40
|
-
}
|
|
41
|
-
// Chrome doesn't support `event.preventDefault()` on `BeforeUnloadEvent`,
|
|
42
|
-
// instead it requires `event.returnValue` to be set
|
|
43
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/WindowEventHandlers/onbeforeunload#browser_compatibility
|
|
44
|
-
if (event.defaultPrevented) {
|
|
45
|
-
return (event.returnValue = "");
|
|
46
|
-
}
|
|
47
|
-
return;
|
|
48
|
-
};
|
|
49
|
-
// pagehideHandlerRef.current = (event) => {
|
|
50
|
-
// const returnValue = handler?.(event);
|
|
51
|
-
// if (event.persisted) {
|
|
52
|
-
// // If the event's persisted property is `true` the page is about
|
|
53
|
-
// // to enter the Back-Forward Cache, which is also in the frozen state.
|
|
54
|
-
// } else {
|
|
55
|
-
// // If the event's persisted property is not `true` the page is
|
|
56
|
-
// // about to be unloaded.
|
|
57
|
-
// }
|
|
58
|
-
// };
|
|
59
|
-
}, [handler]);
|
|
60
|
-
(0, react_1.useEffect)(function () {
|
|
61
|
-
var listenerBeforeunload = (0, on_1.default)(window, "beforeunload", function (event) { var _a; return (_a = beforeUnloadHandlerRef.current) === null || _a === void 0 ? void 0 : _a.call(beforeUnloadHandlerRef, event); });
|
|
62
|
-
// const listenerPagehide = on(window, "pagehide", (event) =>
|
|
63
|
-
// pagehideHandlerRef.current?.(event)
|
|
64
|
-
// );
|
|
65
|
-
return listenerBeforeunload;
|
|
66
|
-
// return () => {
|
|
67
|
-
// listenerBeforeunload();
|
|
68
|
-
// // listenerPagehide();
|
|
69
|
-
// };
|
|
70
|
-
}, []);
|
|
71
|
-
};
|
|
72
|
-
exports.useNavigateAway = useNavigateAway;
|
|
73
|
-
exports.default = exports.useNavigateAway;
|
package/hooks/usePrevious.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usePrevious = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* @borrows [samselikoff/animated-carousel](https://github.com/samselikoff/2022-06-02-animated-carousel/blob/main/pages/final.jsx)
|
|
7
|
-
*/
|
|
8
|
-
function usePrevious(state, defaulValue) {
|
|
9
|
-
var _a = (0, react_1.useState)([state, defaulValue]), tuple = _a[0], setTuple = _a[1];
|
|
10
|
-
if (tuple[1] !== state) {
|
|
11
|
-
setTuple([tuple[1], state]);
|
|
12
|
-
}
|
|
13
|
-
return tuple[0];
|
|
14
|
-
}
|
|
15
|
-
exports.usePrevious = usePrevious;
|
|
16
|
-
exports.default = usePrevious;
|
package/hooks/usePreviousRef.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.usePreviousRef = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
function usePreviousRef(value) {
|
|
6
|
-
var ref = (0, react_1.useRef)();
|
|
7
|
-
(0, react_1.useEffect)(function () {
|
|
8
|
-
ref.current = value;
|
|
9
|
-
});
|
|
10
|
-
return ref.current;
|
|
11
|
-
}
|
|
12
|
-
exports.usePreviousRef = usePreviousRef;
|
|
13
|
-
exports.default = usePreviousRef;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useScrollPosition = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var isBrowser_1 = tslib_1.__importDefault(require("@koine/utils/isBrowser"));
|
|
7
|
-
var listenScroll_1 = tslib_1.__importDefault(require("@koine/dom/listenScroll"));
|
|
8
|
-
var useIsomorphicLayoutEffect_1 = tslib_1.__importDefault(require("./useIsomorphicLayoutEffect"));
|
|
9
|
-
var zeroPosition = { x: 0, y: 0 };
|
|
10
|
-
var getClientRect = function (element) {
|
|
11
|
-
return element === null || element === void 0 ? void 0 : element.getBoundingClientRect();
|
|
12
|
-
};
|
|
13
|
-
var getScrollPosition = function (element, boundingElement) {
|
|
14
|
-
if (!isBrowser_1.default) {
|
|
15
|
-
return zeroPosition;
|
|
16
|
-
}
|
|
17
|
-
if (!boundingElement) {
|
|
18
|
-
return { x: window.scrollX, y: window.scrollY };
|
|
19
|
-
}
|
|
20
|
-
var targetPosition = getClientRect((element === null || element === void 0 ? void 0 : element.current) || document.body);
|
|
21
|
-
var containerPosition = getClientRect(boundingElement.current);
|
|
22
|
-
if (!targetPosition) {
|
|
23
|
-
return zeroPosition;
|
|
24
|
-
}
|
|
25
|
-
return containerPosition
|
|
26
|
-
? {
|
|
27
|
-
x: (containerPosition.x || 0) - (targetPosition.x || 0),
|
|
28
|
-
y: (containerPosition.y || 0) - (targetPosition.y || 0),
|
|
29
|
-
}
|
|
30
|
-
: { x: targetPosition.left, y: targetPosition.top };
|
|
31
|
-
};
|
|
32
|
-
/**
|
|
33
|
-
* @borrows [@n8tb1t/use-scroll-position@2.0.3](https://github.com/n8tb1t/use-scroll-position) by `n8tb1t <n8tb1t@gmail.com>`
|
|
34
|
-
*
|
|
35
|
-
* We've just:
|
|
36
|
-
* - reused internal helper functions
|
|
37
|
-
* - compacted object arguments in functions as plain argument list to improve compression
|
|
38
|
-
*/
|
|
39
|
-
var useScrollPosition = function (effect, deps, element, boundingElement, wait) {
|
|
40
|
-
if (deps === void 0) { deps = []; }
|
|
41
|
-
var position = (0, react_1.useRef)(getScrollPosition(null, boundingElement));
|
|
42
|
-
var throttleTimeout = null;
|
|
43
|
-
var callBack = function () {
|
|
44
|
-
var current = getScrollPosition(element, boundingElement);
|
|
45
|
-
effect(current, position.current);
|
|
46
|
-
position.current = current;
|
|
47
|
-
throttleTimeout = null;
|
|
48
|
-
};
|
|
49
|
-
(0, useIsomorphicLayoutEffect_1.default)(function () {
|
|
50
|
-
if (!isBrowser_1.default) {
|
|
51
|
-
return undefined;
|
|
52
|
-
}
|
|
53
|
-
var handleScroll = function () {
|
|
54
|
-
if (wait) {
|
|
55
|
-
if (throttleTimeout === null) {
|
|
56
|
-
throttleTimeout = window.setTimeout(callBack, wait);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
callBack();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
var listener = (0, listenScroll_1.default)(handleScroll, boundingElement === null || boundingElement === void 0 ? void 0 : boundingElement.current);
|
|
64
|
-
return function () {
|
|
65
|
-
listener();
|
|
66
|
-
if (throttleTimeout) {
|
|
67
|
-
clearTimeout(throttleTimeout);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}, deps);
|
|
71
|
-
};
|
|
72
|
-
exports.useScrollPosition = useScrollPosition;
|
|
73
|
-
exports.default = exports.useScrollPosition;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useScrollThreshold = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var noop_1 = tslib_1.__importDefault(require("@koine/utils/noop"));
|
|
7
|
-
var listenScroll_1 = tslib_1.__importDefault(require("@koine/dom/listenScroll"));
|
|
8
|
-
var useScrollThreshold = function (threshold, callback) {
|
|
9
|
-
var _a = (0, react_1.useState)(false), isBelow = _a[0], setIsBelow = _a[1];
|
|
10
|
-
var handler = (0, react_1.useCallback)(function () {
|
|
11
|
-
if (threshold) {
|
|
12
|
-
var posY = window.scrollY; // * -1;
|
|
13
|
-
var isAbove = posY < threshold;
|
|
14
|
-
var isBelow_1 = posY > threshold;
|
|
15
|
-
// console.log("useScrollThreshold setIsBelow", isBelow, posY, threshold);
|
|
16
|
-
setIsBelow(isBelow_1);
|
|
17
|
-
if (callback)
|
|
18
|
-
callback(isAbove, isBelow_1);
|
|
19
|
-
}
|
|
20
|
-
}, [threshold, callback]);
|
|
21
|
-
(0, react_1.useEffect)(function () {
|
|
22
|
-
if (threshold) {
|
|
23
|
-
// const listener = listenScrollThrottled(0, handler, 50);
|
|
24
|
-
var listener = (0, listenScroll_1.default)(handler);
|
|
25
|
-
handler();
|
|
26
|
-
return listener;
|
|
27
|
-
}
|
|
28
|
-
return noop_1.default;
|
|
29
|
-
}, [threshold, handler]);
|
|
30
|
-
return isBelow;
|
|
31
|
-
};
|
|
32
|
-
exports.useScrollThreshold = useScrollThreshold;
|
|
33
|
-
exports.default = exports.useScrollThreshold;
|
package/hooks/useScrollTo.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useScrollTo = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var isBrowser_1 = tslib_1.__importDefault(require("@koine/utils/isBrowser"));
|
|
6
|
-
var useHeader_1 = tslib_1.__importDefault(require("../Header/useHeader"));
|
|
7
|
-
function useScrollTo(id, offset) {
|
|
8
|
-
if (id === void 0) { id = ""; }
|
|
9
|
-
if (offset === void 0) { offset = 0; }
|
|
10
|
-
var _a = (0, useHeader_1.default)(), headerHeight = _a[2];
|
|
11
|
-
if (!isBrowser_1.default) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
var headerOffset = headerHeight || 0;
|
|
15
|
-
var element = document.getElementById(id);
|
|
16
|
-
var top = 0;
|
|
17
|
-
if (element && element.offsetParent) {
|
|
18
|
-
do {
|
|
19
|
-
top += element.offsetTop;
|
|
20
|
-
} while ((element = element.offsetParent));
|
|
21
|
-
}
|
|
22
|
-
top -= offset;
|
|
23
|
-
top -= headerOffset;
|
|
24
|
-
window.scroll(0, top);
|
|
25
|
-
}
|
|
26
|
-
exports.useScrollTo = useScrollTo;
|
|
27
|
-
exports.default = useScrollTo;
|
package/hooks/useSmoothScroll.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSmoothScroll = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
|
-
var react_1 = require("react");
|
|
6
|
-
var isNumber_1 = tslib_1.__importDefault(require("@koine/utils/isNumber"));
|
|
7
|
-
var getOffsetTopSlim_1 = tslib_1.__importDefault(require("@koine/dom/getOffsetTopSlim"));
|
|
8
|
-
var scrollTo_1 = tslib_1.__importDefault(require("@koine/dom/scrollTo"));
|
|
9
|
-
var useFixedOffset_1 = tslib_1.__importDefault(require("./useFixedOffset"));
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param disregardAutomaticFixedOffset When the `to` scroll argument is a DOM
|
|
13
|
-
* selector we will keep into account the _fixedOffset_ despite this option.
|
|
14
|
-
* @returns
|
|
15
|
-
*/
|
|
16
|
-
function useSmoothScroll(disregardAutomaticFixedOffset) {
|
|
17
|
-
var fixedOffset = (0, useFixedOffset_1.default)();
|
|
18
|
-
var scroll = (0, react_1.useCallback)(function (to, customOffset, callback, fallbackTimeout, behavior) {
|
|
19
|
-
var top = undefined;
|
|
20
|
-
var toIsElement = false;
|
|
21
|
-
if ((0, isNumber_1.default)(to)) {
|
|
22
|
-
top = to;
|
|
23
|
-
}
|
|
24
|
-
else if (to) {
|
|
25
|
-
var el = document.getElementById(to);
|
|
26
|
-
if (el) {
|
|
27
|
-
top = (0, getOffsetTopSlim_1.default)(el) - fixedOffset.current;
|
|
28
|
-
toIsElement = true;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if ((0, isNumber_1.default)(top)) {
|
|
32
|
-
top =
|
|
33
|
-
top +
|
|
34
|
-
(customOffset || 0) +
|
|
35
|
-
(disregardAutomaticFixedOffset || toIsElement
|
|
36
|
-
? 0
|
|
37
|
-
: fixedOffset.current);
|
|
38
|
-
(0, scrollTo_1.default)(top, callback, fallbackTimeout, behavior);
|
|
39
|
-
}
|
|
40
|
-
}, [disregardAutomaticFixedOffset, fixedOffset]);
|
|
41
|
-
return scroll;
|
|
42
|
-
}
|
|
43
|
-
exports.useSmoothScroll = useSmoothScroll;
|
|
44
|
-
exports.default = useSmoothScroll;
|
package/hooks/useSpinDelay.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useSpinDelay = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
var State;
|
|
6
|
-
(function (State) {
|
|
7
|
-
State[State["IDLE"] = 0] = "IDLE";
|
|
8
|
-
State[State["DELAY"] = 1] = "DELAY";
|
|
9
|
-
State[State["DISPLAY"] = 2] = "DISPLAY";
|
|
10
|
-
State[State["EXPIRE"] = 3] = "EXPIRE";
|
|
11
|
-
})(State || (State = {}));
|
|
12
|
-
/**
|
|
13
|
-
* Wraps your booleans only returning true after the `delay`, and for a minimum
|
|
14
|
-
* time of `minDuration`. This way you're sure that you don't show unnecessary
|
|
15
|
-
* or very short living spinners.
|
|
16
|
-
*
|
|
17
|
-
* @borrows [smeijer/spin-delay](https://github.com/smeijer/spin-delay)
|
|
18
|
-
*
|
|
19
|
-
* - Smaller footprint and options object as argument
|
|
20
|
-
*
|
|
21
|
-
* @param delay [500]
|
|
22
|
-
* @param minDuration [200]
|
|
23
|
-
*/
|
|
24
|
-
function useSpinDelay(loading, delay, minDuration) {
|
|
25
|
-
if (delay === void 0) { delay = 500; }
|
|
26
|
-
if (minDuration === void 0) { minDuration = 200; }
|
|
27
|
-
var _a = (0, react_1.useState)(State.IDLE), state = _a[0], setState = _a[1];
|
|
28
|
-
var timeout = (0, react_1.useRef)();
|
|
29
|
-
(0, react_1.useEffect)(function () {
|
|
30
|
-
if (loading && state === State.IDLE) {
|
|
31
|
-
clearTimeout(timeout.current);
|
|
32
|
-
timeout.current = setTimeout(function () {
|
|
33
|
-
if (!loading) {
|
|
34
|
-
return setState(State.IDLE);
|
|
35
|
-
}
|
|
36
|
-
timeout.current = setTimeout(function () {
|
|
37
|
-
setState(State.EXPIRE);
|
|
38
|
-
}, minDuration);
|
|
39
|
-
setState(State.DISPLAY);
|
|
40
|
-
}, delay);
|
|
41
|
-
setState(State.DELAY);
|
|
42
|
-
}
|
|
43
|
-
if (!loading && state !== State.DISPLAY) {
|
|
44
|
-
clearTimeout(timeout.current);
|
|
45
|
-
setState(State.IDLE);
|
|
46
|
-
}
|
|
47
|
-
}, [loading, state, delay, minDuration]);
|
|
48
|
-
(0, react_1.useEffect)(function () {
|
|
49
|
-
return function () { return clearTimeout(timeout.current); };
|
|
50
|
-
}, []);
|
|
51
|
-
return state === State.DISPLAY || state === State.EXPIRE;
|
|
52
|
-
}
|
|
53
|
-
exports.useSpinDelay = useSpinDelay;
|
|
54
|
-
exports.default = useSpinDelay;
|
package/hooks/useTraceUpdate.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useTraceUpdate = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
/**
|
|
6
|
-
* @see https://stackoverflow.com/a/51082563/9122820
|
|
7
|
-
*/
|
|
8
|
-
function useTraceUpdate(props) {
|
|
9
|
-
var prev = (0, react_1.useRef)(props);
|
|
10
|
-
(0, react_1.useEffect)(function () {
|
|
11
|
-
var changedProps = Object.entries(props).reduce(function (ps, _a) {
|
|
12
|
-
var k = _a[0], v = _a[1];
|
|
13
|
-
if (prev.current[k] !== v) {
|
|
14
|
-
// @ts-expect-error Does not matter here...
|
|
15
|
-
ps[k] = [prev.current[k], v];
|
|
16
|
-
}
|
|
17
|
-
return ps;
|
|
18
|
-
}, {});
|
|
19
|
-
if (Object.keys(changedProps).length > 0) {
|
|
20
|
-
console.info("[@koine/react:useTraceUpdate] changed props:", changedProps);
|
|
21
|
-
}
|
|
22
|
-
prev.current = props;
|
|
23
|
-
});
|
|
24
|
-
}
|
|
25
|
-
exports.useTraceUpdate = useTraceUpdate;
|
|
26
|
-
exports.default = useTraceUpdate;
|
package/hooks/useUpdateEffect.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useUpdateEffect = void 0;
|
|
4
|
-
var react_1 = require("react");
|
|
5
|
-
var useFirstMountState_1 = require("./useFirstMountState");
|
|
6
|
-
/**
|
|
7
|
-
* @borrows [streamich/react-use](https://github.com/streamich/react-use/blob/master/src/useUpdateEffect.ts)
|
|
8
|
-
*/
|
|
9
|
-
var useUpdateEffect = function (effect, deps) {
|
|
10
|
-
var isFirstMount = (0, useFirstMountState_1.useFirstMountState)();
|
|
11
|
-
(0, react_1.useEffect)(function () {
|
|
12
|
-
if (!isFirstMount) {
|
|
13
|
-
return effect();
|
|
14
|
-
}
|
|
15
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
16
|
-
}, deps);
|
|
17
|
-
};
|
|
18
|
-
exports.useUpdateEffect = useUpdateEffect;
|
|
19
|
-
exports.default = exports.useUpdateEffect;
|