@oxyhq/bloom 0.50.2 → 0.51.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.
- package/NOTICE +89 -0
- package/README.md +12 -7
- package/lib/commonjs/avatar-group/AvatarGroup.web.js +2 -1
- package/lib/commonjs/avatar-group/AvatarGroup.web.js.map +1 -1
- package/lib/commonjs/bottom-sheet/index.web.js +2 -1
- package/lib/commonjs/bottom-sheet/index.web.js.map +1 -1
- package/lib/commonjs/context-menu/index.web.js +3 -2
- package/lib/commonjs/context-menu/index.web.js.map +1 -1
- package/lib/commonjs/dialog/Dialog.web.js +4 -3
- package/lib/commonjs/dialog/Dialog.web.js.map +1 -1
- package/lib/commonjs/index.js +90 -83
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +116 -109
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/menu/index.web.js +2 -1
- package/lib/commonjs/menu/index.web.js.map +1 -1
- package/lib/commonjs/popover/index.web.js +3 -2
- package/lib/commonjs/popover/index.web.js.map +1 -1
- package/lib/commonjs/portal/index.js +4 -1
- package/lib/commonjs/portal/index.js.map +1 -1
- package/lib/commonjs/progressive-blur/index.js +79 -0
- package/lib/commonjs/progressive-blur/index.js.map +1 -0
- package/lib/commonjs/progressive-blur/index.web.js +67 -0
- package/lib/commonjs/progressive-blur/index.web.js.map +1 -0
- package/lib/commonjs/progressive-blur/shared.js +66 -0
- package/lib/commonjs/progressive-blur/shared.js.map +1 -0
- package/lib/commonjs/progressive-blur/types.js +6 -0
- package/lib/commonjs/progressive-blur/types.js.map +1 -0
- package/lib/commonjs/select/index.web.js +2 -1
- package/lib/commonjs/select/index.web.js.map +1 -1
- package/lib/commonjs/styles/web-view-style.js +26 -0
- package/lib/commonjs/styles/web-view-style.js.map +1 -0
- package/lib/commonjs/tab-bar/TabBarBase.js +415 -0
- package/lib/commonjs/tab-bar/TabBarBase.js.map +1 -0
- package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js +83 -0
- package/lib/commonjs/tab-bar/expo-router/RouterTabBar.js.map +1 -0
- package/lib/commonjs/tab-bar/expo-router/fading-tab-screen.js +119 -0
- package/lib/commonjs/tab-bar/expo-router/fading-tab-screen.js.map +1 -0
- package/lib/commonjs/tab-bar/expo-router/index.js +26 -0
- package/lib/commonjs/tab-bar/expo-router/index.js.map +1 -0
- package/lib/commonjs/tab-bar/glyph.js +43 -0
- package/lib/commonjs/tab-bar/glyph.js.map +1 -0
- package/lib/commonjs/tab-bar/glyph.native.js +55 -0
- package/lib/commonjs/tab-bar/glyph.native.js.map +1 -0
- package/lib/commonjs/tab-bar/index.js +65 -0
- package/lib/commonjs/tab-bar/index.js.map +1 -0
- package/lib/commonjs/tab-bar/index.web.js +67 -0
- package/lib/commonjs/tab-bar/index.web.js.map +1 -0
- package/lib/commonjs/tab-bar/minimize-context.js +127 -0
- package/lib/commonjs/tab-bar/minimize-context.js.map +1 -0
- package/lib/commonjs/tab-bar/shared.js +139 -0
- package/lib/commonjs/tab-bar/shared.js.map +1 -0
- package/lib/commonjs/tab-bar/surface.js +50 -0
- package/lib/commonjs/tab-bar/surface.js.map +1 -0
- package/lib/commonjs/tab-bar/surface.native.js +56 -0
- package/lib/commonjs/tab-bar/surface.native.js.map +1 -0
- package/lib/commonjs/tab-bar/surface.web.js +59 -0
- package/lib/commonjs/tab-bar/surface.web.js.map +1 -0
- package/lib/commonjs/tab-bar/types.js +6 -0
- package/lib/commonjs/tab-bar/types.js.map +1 -0
- package/lib/commonjs/toast/Positioner.js +117 -0
- package/lib/commonjs/toast/Positioner.js.map +1 -0
- package/lib/commonjs/toast/ToastContent.js +301 -0
- package/lib/commonjs/toast/ToastContent.js.map +1 -0
- package/lib/commonjs/toast/ToastHost.js +69 -0
- package/lib/commonjs/toast/ToastHost.js.map +1 -0
- package/lib/commonjs/toast/ToastHost.native.js +44 -0
- package/lib/commonjs/toast/ToastHost.native.js.map +1 -0
- package/lib/commonjs/toast/ToastIcon.js +57 -0
- package/lib/commonjs/toast/ToastIcon.js.map +1 -0
- package/lib/commonjs/toast/ToastRow.js +411 -0
- package/lib/commonjs/toast/ToastRow.js.map +1 -0
- package/lib/commonjs/toast/ToastSwipeHandler.js +189 -0
- package/lib/commonjs/toast/ToastSwipeHandler.js.map +1 -0
- package/lib/commonjs/toast/Toaster.js +205 -0
- package/lib/commonjs/toast/Toaster.js.map +1 -0
- package/lib/commonjs/toast/animations.js +274 -0
- package/lib/commonjs/toast/animations.js.map +1 -0
- package/lib/commonjs/toast/constants.js +56 -0
- package/lib/commonjs/toast/constants.js.map +1 -0
- package/lib/commonjs/toast/context.js +42 -0
- package/lib/commonjs/toast/context.js.map +1 -0
- package/lib/commonjs/toast/index.js +32 -126
- package/lib/commonjs/toast/index.js.map +1 -1
- package/lib/commonjs/toast/position-utils.js +115 -0
- package/lib/commonjs/toast/position-utils.js.map +1 -0
- package/lib/commonjs/toast/positioner-utils.js +141 -0
- package/lib/commonjs/toast/positioner-utils.js.map +1 -0
- package/lib/commonjs/toast/toast-comparator.js +28 -0
- package/lib/commonjs/toast/toast-comparator.js.map +1 -0
- package/lib/commonjs/toast/toast-fns.js +90 -0
- package/lib/commonjs/toast/toast-fns.js.map +1 -0
- package/lib/commonjs/toast/toast-store.js +352 -0
- package/lib/commonjs/toast/toast-store.js.map +1 -0
- package/lib/commonjs/toast/toast-timers.js +110 -0
- package/lib/commonjs/toast/toast-timers.js.map +1 -0
- package/lib/commonjs/toast/types.js +42 -0
- package/lib/commonjs/toast/types.js.map +1 -1
- package/lib/commonjs/toast/use-animated-target.js +57 -0
- package/lib/commonjs/toast/use-animated-target.js.map +1 -0
- package/lib/commonjs/toast/use-app-state.js +76 -0
- package/lib/commonjs/toast/use-app-state.js.map +1 -0
- package/lib/commonjs/toast/use-toast-colors.js +114 -0
- package/lib/commonjs/toast/use-toast-colors.js.map +1 -0
- package/lib/commonjs/toast/use-toast-position.js +40 -0
- package/lib/commonjs/toast/use-toast-position.js.map +1 -0
- package/lib/commonjs/tooltip/index.web.js +2 -1
- package/lib/commonjs/tooltip/index.web.js.map +1 -1
- package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js +20 -8
- package/lib/commonjs/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
- package/lib/module/avatar-group/AvatarGroup.web.js +2 -1
- package/lib/module/avatar-group/AvatarGroup.web.js.map +1 -1
- package/lib/module/bottom-sheet/index.web.js +2 -1
- package/lib/module/bottom-sheet/index.web.js.map +1 -1
- package/lib/module/context-menu/index.web.js +3 -2
- package/lib/module/context-menu/index.web.js.map +1 -1
- package/lib/module/dialog/Dialog.web.js +4 -3
- package/lib/module/dialog/Dialog.web.js.map +1 -1
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +3 -2
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/menu/index.web.js +2 -1
- package/lib/module/menu/index.web.js.map +1 -1
- package/lib/module/popover/index.web.js +3 -2
- package/lib/module/popover/index.web.js.map +1 -1
- package/lib/module/portal/index.js +4 -1
- package/lib/module/portal/index.js.map +1 -1
- package/lib/module/progressive-blur/index.js +74 -0
- package/lib/module/progressive-blur/index.js.map +1 -0
- package/lib/module/progressive-blur/index.web.js +62 -0
- package/lib/module/progressive-blur/index.web.js.map +1 -0
- package/lib/module/progressive-blur/shared.js +60 -0
- package/lib/module/progressive-blur/shared.js.map +1 -0
- package/lib/module/progressive-blur/types.js +4 -0
- package/lib/module/progressive-blur/types.js.map +1 -0
- package/lib/module/select/index.web.js +2 -1
- package/lib/module/select/index.web.js.map +1 -1
- package/lib/module/styles/web-view-style.js +22 -0
- package/lib/module/styles/web-view-style.js.map +1 -0
- package/lib/module/tab-bar/TabBarBase.js +408 -0
- package/lib/module/tab-bar/TabBarBase.js.map +1 -0
- package/lib/module/tab-bar/expo-router/RouterTabBar.js +78 -0
- package/lib/module/tab-bar/expo-router/RouterTabBar.js.map +1 -0
- package/lib/module/tab-bar/expo-router/fading-tab-screen.js +113 -0
- package/lib/module/tab-bar/expo-router/fading-tab-screen.js.map +1 -0
- package/lib/module/tab-bar/expo-router/index.js +15 -0
- package/lib/module/tab-bar/expo-router/index.js.map +1 -0
- package/lib/module/tab-bar/glyph.js +38 -0
- package/lib/module/tab-bar/glyph.js.map +1 -0
- package/lib/module/tab-bar/glyph.native.js +50 -0
- package/lib/module/tab-bar/glyph.native.js.map +1 -0
- package/lib/module/tab-bar/index.js +24 -0
- package/lib/module/tab-bar/index.js.map +1 -0
- package/lib/module/tab-bar/index.web.js +26 -0
- package/lib/module/tab-bar/index.web.js.map +1 -0
- package/lib/module/tab-bar/minimize-context.js +118 -0
- package/lib/module/tab-bar/minimize-context.js.map +1 -0
- package/lib/module/tab-bar/shared.js +132 -0
- package/lib/module/tab-bar/shared.js.map +1 -0
- package/lib/module/tab-bar/surface.js +44 -0
- package/lib/module/tab-bar/surface.js.map +1 -0
- package/lib/module/tab-bar/surface.native.js +50 -0
- package/lib/module/tab-bar/surface.native.js.map +1 -0
- package/lib/module/tab-bar/surface.web.js +53 -0
- package/lib/module/tab-bar/surface.web.js.map +1 -0
- package/lib/module/tab-bar/types.js +4 -0
- package/lib/module/tab-bar/types.js.map +1 -0
- package/lib/module/toast/Positioner.js +110 -0
- package/lib/module/toast/Positioner.js.map +1 -0
- package/lib/module/toast/ToastContent.js +295 -0
- package/lib/module/toast/ToastContent.js.map +1 -0
- package/lib/module/toast/ToastHost.js +63 -0
- package/lib/module/toast/ToastHost.js.map +1 -0
- package/lib/module/toast/ToastHost.native.js +38 -0
- package/lib/module/toast/ToastHost.native.js.map +1 -0
- package/lib/module/toast/ToastIcon.js +52 -0
- package/lib/module/toast/ToastIcon.js.map +1 -0
- package/lib/module/toast/ToastRow.js +407 -0
- package/lib/module/toast/ToastRow.js.map +1 -0
- package/lib/module/toast/ToastSwipeHandler.js +182 -0
- package/lib/module/toast/ToastSwipeHandler.js.map +1 -0
- package/lib/module/toast/Toaster.js +198 -0
- package/lib/module/toast/Toaster.js.map +1 -0
- package/lib/module/toast/animations.js +261 -0
- package/lib/module/toast/animations.js.map +1 -0
- package/lib/module/toast/constants.js +52 -0
- package/lib/module/toast/constants.js.map +1 -0
- package/lib/module/toast/context.js +34 -0
- package/lib/module/toast/context.js.map +1 -0
- package/lib/module/toast/index.js +27 -103
- package/lib/module/toast/index.js.map +1 -1
- package/lib/module/toast/position-utils.js +107 -0
- package/lib/module/toast/position-utils.js.map +1 -0
- package/lib/module/toast/positioner-utils.js +134 -0
- package/lib/module/toast/positioner-utils.js.map +1 -0
- package/lib/module/toast/toast-comparator.js +22 -0
- package/lib/module/toast/toast-comparator.js.map +1 -0
- package/lib/module/toast/toast-fns.js +85 -0
- package/lib/module/toast/toast-fns.js.map +1 -0
- package/lib/module/toast/toast-store.js +346 -0
- package/lib/module/toast/toast-store.js.map +1 -0
- package/lib/module/toast/toast-timers.js +104 -0
- package/lib/module/toast/toast-timers.js.map +1 -0
- package/lib/module/toast/types.js +38 -0
- package/lib/module/toast/types.js.map +1 -1
- package/lib/module/toast/use-animated-target.js +52 -0
- package/lib/module/toast/use-animated-target.js.map +1 -0
- package/lib/module/toast/use-app-state.js +70 -0
- package/lib/module/toast/use-app-state.js.map +1 -0
- package/lib/module/toast/use-toast-colors.js +109 -0
- package/lib/module/toast/use-toast-colors.js.map +1 -0
- package/lib/module/toast/use-toast-position.js +35 -0
- package/lib/module/toast/use-toast-position.js.map +1 -0
- package/lib/module/tooltip/index.web.js +2 -1
- package/lib/module/tooltip/index.web.js.map +1 -1
- package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js +20 -8
- package/lib/module/zoomable-image-gallery/ZoomableImageGallery.js.map +1 -1
- package/lib/typescript/commonjs/avatar-group/AvatarGroup.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/bottom-sheet/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/context-menu/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.d.ts +2 -1
- package/lib/typescript/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/index.web.d.ts +2 -1
- package/lib/typescript/commonjs/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/menu/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/popover/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/portal/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/progressive-blur/index.d.ts +23 -0
- package/lib/typescript/commonjs/progressive-blur/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/progressive-blur/index.web.d.ts +30 -0
- package/lib/typescript/commonjs/progressive-blur/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/progressive-blur/shared.d.ts +35 -0
- package/lib/typescript/commonjs/progressive-blur/shared.d.ts.map +1 -0
- package/lib/typescript/commonjs/progressive-blur/types.d.ts +21 -0
- package/lib/typescript/commonjs/progressive-blur/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/select/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/styles/web-view-style.d.ts +21 -0
- package/lib/typescript/commonjs/styles/web-view-style.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts +36 -0
- package/lib/typescript/commonjs/tab-bar/TabBarBase.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts +59 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/fading-tab-screen.d.ts +11 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/fading-tab-screen.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/index.d.ts +14 -0
- package/lib/typescript/commonjs/tab-bar/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/glyph.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/glyph.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/glyph.native.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/glyph.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/index.d.ts +12 -0
- package/lib/typescript/commonjs/tab-bar/index.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/index.web.d.ts +12 -0
- package/lib/typescript/commonjs/tab-bar/index.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/minimize-context.d.ts +51 -0
- package/lib/typescript/commonjs/tab-bar/minimize-context.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/shared.d.ts +93 -0
- package/lib/typescript/commonjs/tab-bar/shared.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/surface.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/surface.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/surface.native.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/surface.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/surface.web.d.ts +6 -0
- package/lib/typescript/commonjs/tab-bar/surface.web.d.ts.map +1 -0
- package/lib/typescript/commonjs/tab-bar/types.d.ts +85 -0
- package/lib/typescript/commonjs/tab-bar/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/Positioner.d.ts +21 -0
- package/lib/typescript/commonjs/toast/Positioner.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastContent.d.ts +14 -0
- package/lib/typescript/commonjs/toast/ToastContent.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastHost.d.ts +6 -0
- package/lib/typescript/commonjs/toast/ToastHost.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastHost.native.d.ts +6 -0
- package/lib/typescript/commonjs/toast/ToastHost.native.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastIcon.d.ts +9 -0
- package/lib/typescript/commonjs/toast/ToastIcon.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastRow.d.ts +80 -0
- package/lib/typescript/commonjs/toast/ToastRow.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts +30 -0
- package/lib/typescript/commonjs/toast/ToastSwipeHandler.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/Toaster.d.ts +19 -0
- package/lib/typescript/commonjs/toast/Toaster.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/animations.d.ts +62 -0
- package/lib/typescript/commonjs/toast/animations.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/constants.d.ts +39 -0
- package/lib/typescript/commonjs/toast/constants.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/context.d.ts +19 -0
- package/lib/typescript/commonjs/toast/context.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/index.d.ts +23 -76
- package/lib/typescript/commonjs/toast/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/position-utils.d.ts +30 -0
- package/lib/typescript/commonjs/toast/position-utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/positioner-utils.d.ts +72 -0
- package/lib/typescript/commonjs/toast/positioner-utils.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/toast-comparator.d.ts +12 -0
- package/lib/typescript/commonjs/toast/toast-comparator.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/toast-fns.d.ts +3 -0
- package/lib/typescript/commonjs/toast/toast-fns.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/toast-store.d.ts +52 -0
- package/lib/typescript/commonjs/toast/toast-store.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/toast-timers.d.ts +24 -0
- package/lib/typescript/commonjs/toast/toast-timers.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/types.d.ts +222 -5
- package/lib/typescript/commonjs/toast/types.d.ts.map +1 -1
- package/lib/typescript/commonjs/toast/use-animated-target.d.ts +7 -0
- package/lib/typescript/commonjs/toast/use-animated-target.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/use-app-state.d.ts +18 -0
- package/lib/typescript/commonjs/toast/use-app-state.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/use-toast-colors.d.ts +22 -0
- package/lib/typescript/commonjs/toast/use-toast-colors.d.ts.map +1 -0
- package/lib/typescript/commonjs/toast/use-toast-position.d.ts +37 -0
- package/lib/typescript/commonjs/toast/use-toast-position.d.ts.map +1 -0
- package/lib/typescript/commonjs/tooltip/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
- package/lib/typescript/module/avatar-group/AvatarGroup.web.d.ts.map +1 -1
- package/lib/typescript/module/bottom-sheet/index.web.d.ts.map +1 -1
- package/lib/typescript/module/context-menu/index.web.d.ts.map +1 -1
- package/lib/typescript/module/dialog/Dialog.web.d.ts.map +1 -1
- package/lib/typescript/module/index.d.ts +2 -1
- package/lib/typescript/module/index.d.ts.map +1 -1
- package/lib/typescript/module/index.web.d.ts +2 -1
- package/lib/typescript/module/index.web.d.ts.map +1 -1
- package/lib/typescript/module/menu/index.web.d.ts.map +1 -1
- package/lib/typescript/module/popover/index.web.d.ts.map +1 -1
- package/lib/typescript/module/portal/index.d.ts.map +1 -1
- package/lib/typescript/module/progressive-blur/index.d.ts +23 -0
- package/lib/typescript/module/progressive-blur/index.d.ts.map +1 -0
- package/lib/typescript/module/progressive-blur/index.web.d.ts +30 -0
- package/lib/typescript/module/progressive-blur/index.web.d.ts.map +1 -0
- package/lib/typescript/module/progressive-blur/shared.d.ts +35 -0
- package/lib/typescript/module/progressive-blur/shared.d.ts.map +1 -0
- package/lib/typescript/module/progressive-blur/types.d.ts +21 -0
- package/lib/typescript/module/progressive-blur/types.d.ts.map +1 -0
- package/lib/typescript/module/select/index.web.d.ts.map +1 -1
- package/lib/typescript/module/styles/web-view-style.d.ts +21 -0
- package/lib/typescript/module/styles/web-view-style.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/TabBarBase.d.ts +36 -0
- package/lib/typescript/module/tab-bar/TabBarBase.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts +59 -0
- package/lib/typescript/module/tab-bar/expo-router/RouterTabBar.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/expo-router/fading-tab-screen.d.ts +11 -0
- package/lib/typescript/module/tab-bar/expo-router/fading-tab-screen.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/expo-router/index.d.ts +14 -0
- package/lib/typescript/module/tab-bar/expo-router/index.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/glyph.d.ts +6 -0
- package/lib/typescript/module/tab-bar/glyph.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/glyph.native.d.ts +6 -0
- package/lib/typescript/module/tab-bar/glyph.native.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/index.d.ts +12 -0
- package/lib/typescript/module/tab-bar/index.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/index.web.d.ts +12 -0
- package/lib/typescript/module/tab-bar/index.web.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/minimize-context.d.ts +51 -0
- package/lib/typescript/module/tab-bar/minimize-context.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/shared.d.ts +93 -0
- package/lib/typescript/module/tab-bar/shared.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/surface.d.ts +6 -0
- package/lib/typescript/module/tab-bar/surface.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/surface.native.d.ts +6 -0
- package/lib/typescript/module/tab-bar/surface.native.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/surface.web.d.ts +6 -0
- package/lib/typescript/module/tab-bar/surface.web.d.ts.map +1 -0
- package/lib/typescript/module/tab-bar/types.d.ts +85 -0
- package/lib/typescript/module/tab-bar/types.d.ts.map +1 -0
- package/lib/typescript/module/toast/Positioner.d.ts +21 -0
- package/lib/typescript/module/toast/Positioner.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastContent.d.ts +14 -0
- package/lib/typescript/module/toast/ToastContent.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastHost.d.ts +6 -0
- package/lib/typescript/module/toast/ToastHost.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastHost.native.d.ts +6 -0
- package/lib/typescript/module/toast/ToastHost.native.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastIcon.d.ts +9 -0
- package/lib/typescript/module/toast/ToastIcon.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastRow.d.ts +80 -0
- package/lib/typescript/module/toast/ToastRow.d.ts.map +1 -0
- package/lib/typescript/module/toast/ToastSwipeHandler.d.ts +30 -0
- package/lib/typescript/module/toast/ToastSwipeHandler.d.ts.map +1 -0
- package/lib/typescript/module/toast/Toaster.d.ts +19 -0
- package/lib/typescript/module/toast/Toaster.d.ts.map +1 -0
- package/lib/typescript/module/toast/animations.d.ts +62 -0
- package/lib/typescript/module/toast/animations.d.ts.map +1 -0
- package/lib/typescript/module/toast/constants.d.ts +39 -0
- package/lib/typescript/module/toast/constants.d.ts.map +1 -0
- package/lib/typescript/module/toast/context.d.ts +19 -0
- package/lib/typescript/module/toast/context.d.ts.map +1 -0
- package/lib/typescript/module/toast/index.d.ts +23 -76
- package/lib/typescript/module/toast/index.d.ts.map +1 -1
- package/lib/typescript/module/toast/position-utils.d.ts +30 -0
- package/lib/typescript/module/toast/position-utils.d.ts.map +1 -0
- package/lib/typescript/module/toast/positioner-utils.d.ts +72 -0
- package/lib/typescript/module/toast/positioner-utils.d.ts.map +1 -0
- package/lib/typescript/module/toast/toast-comparator.d.ts +12 -0
- package/lib/typescript/module/toast/toast-comparator.d.ts.map +1 -0
- package/lib/typescript/module/toast/toast-fns.d.ts +3 -0
- package/lib/typescript/module/toast/toast-fns.d.ts.map +1 -0
- package/lib/typescript/module/toast/toast-store.d.ts +52 -0
- package/lib/typescript/module/toast/toast-store.d.ts.map +1 -0
- package/lib/typescript/module/toast/toast-timers.d.ts +24 -0
- package/lib/typescript/module/toast/toast-timers.d.ts.map +1 -0
- package/lib/typescript/module/toast/types.d.ts +222 -5
- package/lib/typescript/module/toast/types.d.ts.map +1 -1
- package/lib/typescript/module/toast/use-animated-target.d.ts +7 -0
- package/lib/typescript/module/toast/use-animated-target.d.ts.map +1 -0
- package/lib/typescript/module/toast/use-app-state.d.ts +18 -0
- package/lib/typescript/module/toast/use-app-state.d.ts.map +1 -0
- package/lib/typescript/module/toast/use-toast-colors.d.ts +22 -0
- package/lib/typescript/module/toast/use-toast-colors.d.ts.map +1 -0
- package/lib/typescript/module/toast/use-toast-position.d.ts +37 -0
- package/lib/typescript/module/toast/use-toast-position.d.ts.map +1 -0
- package/lib/typescript/module/tooltip/index.web.d.ts.map +1 -1
- package/lib/typescript/module/zoomable-image-gallery/ZoomableImageGallery.d.ts.map +1 -1
- package/package.json +63 -25
- package/src/__tests__/TabBar.test.tsx +342 -0
- package/src/__tests__/TabBarReanimatedDeps.test.ts +130 -0
- package/src/__tests__/TabBarWebFork.test.ts +197 -0
- package/src/__tests__/ToastContent.test.tsx +192 -0
- package/src/__tests__/ToastHostWebFork.test.ts +155 -0
- package/src/__tests__/Toaster.test.tsx +527 -0
- package/src/__tests__/animated-style-deps.test.ts +156 -0
- package/src/__tests__/toast-animations.test.ts +98 -0
- package/src/__tests__/toast-comparator.test.ts +131 -0
- package/src/__tests__/toast-enter-driver.test.ts +147 -0
- package/src/__tests__/toast-fns.test.ts +240 -0
- package/src/__tests__/toast-position-utils.test.ts +259 -0
- package/src/__tests__/toast-positioner-utils.test.ts +214 -0
- package/src/__tests__/toast-store.test.ts +622 -0
- package/src/__tests__/toast-timers.test.ts +163 -0
- package/src/__tests__/use-animated-target.test.tsx +60 -0
- package/src/__tests__/use-app-state.test.tsx +127 -0
- package/src/__tests__/use-toast-colors.test.tsx +189 -0
- package/src/__tests__/web-position-fixed.test.ts +70 -0
- package/src/avatar-group/AvatarGroup.web.tsx +2 -1
- package/src/bottom-sheet/index.web.tsx +3 -2
- package/src/context-menu/index.web.tsx +3 -2
- package/src/dialog/Dialog.web.tsx +4 -3
- package/src/index.ts +4 -1
- package/src/index.web.ts +4 -1
- package/src/menu/index.web.tsx +2 -1
- package/src/popover/index.web.tsx +3 -2
- package/src/portal/index.tsx +4 -1
- package/src/progressive-blur/index.tsx +78 -0
- package/src/progressive-blur/index.web.tsx +65 -0
- package/src/progressive-blur/shared.ts +81 -0
- package/src/progressive-blur/types.ts +21 -0
- package/src/select/index.web.tsx +2 -1
- package/src/styles/web-view-style.ts +21 -0
- package/src/tab-bar/TabBar.stories.tsx +217 -0
- package/src/tab-bar/TabBarBase.tsx +517 -0
- package/src/tab-bar/expo-router/RouterTabBar.tsx +80 -0
- package/src/tab-bar/expo-router/fading-tab-screen.tsx +109 -0
- package/src/tab-bar/expo-router/index.ts +13 -0
- package/src/tab-bar/glyph.native.tsx +46 -0
- package/src/tab-bar/glyph.tsx +31 -0
- package/src/tab-bar/index.ts +32 -0
- package/src/tab-bar/index.web.tsx +34 -0
- package/src/tab-bar/minimize-context.tsx +117 -0
- package/src/tab-bar/shared.ts +159 -0
- package/src/tab-bar/surface.native.tsx +60 -0
- package/src/tab-bar/surface.tsx +47 -0
- package/src/tab-bar/surface.web.tsx +56 -0
- package/src/tab-bar/types.ts +88 -0
- package/src/toast/Positioner.tsx +121 -0
- package/src/toast/Toast.stories.tsx +292 -65
- package/src/toast/ToastContent.tsx +405 -0
- package/src/toast/ToastHost.native.tsx +31 -0
- package/src/toast/ToastHost.tsx +67 -0
- package/src/toast/ToastIcon.tsx +55 -0
- package/src/toast/ToastRow.tsx +485 -0
- package/src/toast/ToastSwipeHandler.tsx +222 -0
- package/src/toast/Toaster.tsx +259 -0
- package/src/toast/animations.ts +313 -0
- package/src/toast/constants.ts +76 -0
- package/src/toast/context.tsx +44 -0
- package/src/toast/index.tsx +47 -123
- package/src/toast/position-utils.ts +149 -0
- package/src/toast/positioner-utils.ts +142 -0
- package/src/toast/toast-comparator.ts +41 -0
- package/src/toast/toast-fns.ts +104 -0
- package/src/toast/toast-store.ts +432 -0
- package/src/toast/toast-timers.ts +124 -0
- package/src/toast/types.ts +301 -5
- package/src/toast/use-animated-target.ts +61 -0
- package/src/toast/use-app-state.ts +77 -0
- package/src/toast/use-toast-colors.ts +133 -0
- package/src/toast/use-toast-position.ts +46 -0
- package/src/tooltip/index.web.tsx +2 -1
- package/src/zoomable-image-gallery/ZoomableImageGallery.stories.tsx +134 -0
- package/src/zoomable-image-gallery/ZoomableImageGallery.tsx +50 -27
- package/lib/commonjs/toast/Toast.js +0 -267
- package/lib/commonjs/toast/Toast.js.map +0 -1
- package/lib/commonjs/toast/const.js +0 -8
- package/lib/commonjs/toast/const.js.map +0 -1
- package/lib/commonjs/toast/index.web.js +0 -114
- package/lib/commonjs/toast/index.web.js.map +0 -1
- package/lib/commonjs/toast/sonner/index.js +0 -9
- package/lib/commonjs/toast/sonner/index.js.map +0 -1
- package/lib/commonjs/toast/sonner/index.web.js +0 -9
- package/lib/commonjs/toast/sonner/index.web.js.map +0 -1
- package/lib/module/toast/Toast.js +0 -258
- package/lib/module/toast/Toast.js.map +0 -1
- package/lib/module/toast/const.js +0 -4
- package/lib/module/toast/const.js.map +0 -1
- package/lib/module/toast/index.web.js +0 -74
- package/lib/module/toast/index.web.js.map +0 -1
- package/lib/module/toast/sonner/index.js +0 -5
- package/lib/module/toast/sonner/index.js.map +0 -1
- package/lib/module/toast/sonner/index.web.js +0 -5
- package/lib/module/toast/sonner/index.web.js.map +0 -1
- package/lib/typescript/commonjs/toast/Toast.d.ts +0 -23
- package/lib/typescript/commonjs/toast/Toast.d.ts.map +0 -1
- package/lib/typescript/commonjs/toast/const.d.ts +0 -2
- package/lib/typescript/commonjs/toast/const.d.ts.map +0 -1
- package/lib/typescript/commonjs/toast/index.web.d.ts +0 -29
- package/lib/typescript/commonjs/toast/index.web.d.ts.map +0 -1
- package/lib/typescript/commonjs/toast/sonner/index.d.ts +0 -2
- package/lib/typescript/commonjs/toast/sonner/index.d.ts.map +0 -1
- package/lib/typescript/commonjs/toast/sonner/index.web.d.ts +0 -2
- package/lib/typescript/commonjs/toast/sonner/index.web.d.ts.map +0 -1
- package/lib/typescript/module/toast/Toast.d.ts +0 -23
- package/lib/typescript/module/toast/Toast.d.ts.map +0 -1
- package/lib/typescript/module/toast/const.d.ts +0 -2
- package/lib/typescript/module/toast/const.d.ts.map +0 -1
- package/lib/typescript/module/toast/index.web.d.ts +0 -29
- package/lib/typescript/module/toast/index.web.d.ts.map +0 -1
- package/lib/typescript/module/toast/sonner/index.d.ts +0 -2
- package/lib/typescript/module/toast/sonner/index.d.ts.map +0 -1
- package/lib/typescript/module/toast/sonner/index.web.d.ts +0 -2
- package/lib/typescript/module/toast/sonner/index.web.d.ts.map +0 -1
- package/src/toast/Toast.tsx +0 -269
- package/src/toast/const.ts +0 -1
- package/src/toast/index.web.tsx +0 -101
- package/src/toast/sonner/index.ts +0 -3
- package/src/toast/sonner/index.web.ts +0 -3
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ToastSwipeHandler = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _reactNativeGestureHandler = require("react-native-gesture-handler");
|
|
10
|
+
var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
|
|
11
|
+
var _animations = require("./animations.js");
|
|
12
|
+
var _context = require("./context.js");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
15
|
+
/**
|
|
16
|
+
* Derived from sonner-native v0.26.4 — src/gestures.tsx
|
|
17
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
18
|
+
*
|
|
19
|
+
* W2 — the animated style reads `translate`, `direction`, `position`,
|
|
20
|
+
* `windowWidth` and `isAndroid`; ALL of them are in the dependency array. On web
|
|
21
|
+
* without the worklets babel plugin reanimated re-runs the mapper on its deps
|
|
22
|
+
* rather than on auto-tracked reads, so a missing dep freezes the swipe transform
|
|
23
|
+
* at its first frame (upstream omits `position` and `isAndroid`, so a toast that
|
|
24
|
+
* changes position mid-life swipes the wrong way).
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/** Fraction of the screen a horizontal swipe must cross to dismiss. */
|
|
28
|
+
const HORIZONTAL_DISMISS_FRACTION = 0.25;
|
|
29
|
+
/** Below this the gesture reads as a tap, so the row springs back. */
|
|
30
|
+
const TAP_SLOP = 16;
|
|
31
|
+
/** Vertical travel that fades a row fully out. */
|
|
32
|
+
const VERTICAL_FADE_DISTANCE = 60;
|
|
33
|
+
const SPRING_BACK_EASING_BOUNCINESS = 0.8;
|
|
34
|
+
const WRONG_DIRECTION_SPRING_DURATION = 400;
|
|
35
|
+
const ToastSwipeHandler = ({
|
|
36
|
+
children,
|
|
37
|
+
onRemove,
|
|
38
|
+
style,
|
|
39
|
+
onBegin,
|
|
40
|
+
onFinalize,
|
|
41
|
+
enabled,
|
|
42
|
+
unstyled,
|
|
43
|
+
important,
|
|
44
|
+
position: positionProps,
|
|
45
|
+
onPress
|
|
46
|
+
}) => {
|
|
47
|
+
const {
|
|
48
|
+
width: windowWidth
|
|
49
|
+
} = (0, _reactNative.useWindowDimensions)();
|
|
50
|
+
const translate = (0, _reactNativeReanimated.useSharedValue)(0);
|
|
51
|
+
const {
|
|
52
|
+
swipeToDismissDirection: direction,
|
|
53
|
+
position: positionCtx
|
|
54
|
+
} = (0, _context.useToastContext)();
|
|
55
|
+
const position = positionProps ?? positionCtx;
|
|
56
|
+
const isAndroid = _reactNative.Platform.OS === 'android';
|
|
57
|
+
const pan = _reactNativeGestureHandler.Gesture.Pan().onBegin(() => {
|
|
58
|
+
'worklet';
|
|
59
|
+
|
|
60
|
+
if (!enabled) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
(0, _reactNativeReanimated.runOnJS)(onBegin)();
|
|
64
|
+
}).onChange(event => {
|
|
65
|
+
'worklet';
|
|
66
|
+
|
|
67
|
+
if (!enabled) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (direction === 'left' && event.translationX < 0) {
|
|
71
|
+
translate.value = event.translationX;
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
if (direction === 'up') {
|
|
75
|
+
const isBottomPosition = position === 'bottom-center';
|
|
76
|
+
const rawTranslation = event.translationY * (isBottomPosition ? -1 : 1);
|
|
77
|
+
|
|
78
|
+
// Negative is the dismissal direction; dragging the other way meets
|
|
79
|
+
// progressive resistance instead of moving freely.
|
|
80
|
+
if (rawTranslation < 0) {
|
|
81
|
+
translate.value = rawTranslation;
|
|
82
|
+
} else if (rawTranslation > 0) {
|
|
83
|
+
translate.value = elasticResistance(rawTranslation);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}).onFinalize(() => {
|
|
87
|
+
'worklet';
|
|
88
|
+
|
|
89
|
+
if (!enabled) {
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
const springBack = duration => {
|
|
93
|
+
'worklet';
|
|
94
|
+
|
|
95
|
+
translate.value = (0, _reactNativeReanimated.withTiming)(0, {
|
|
96
|
+
easing: _reactNativeReanimated.Easing.elastic(SPRING_BACK_EASING_BOUNCINESS),
|
|
97
|
+
duration
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
const dismiss = () => {
|
|
101
|
+
'worklet';
|
|
102
|
+
|
|
103
|
+
translate.value = (0, _reactNativeReanimated.withTiming)(-windowWidth, {
|
|
104
|
+
easing: _reactNativeReanimated.Easing.inOut(_reactNativeReanimated.Easing.ease)
|
|
105
|
+
}, isDone => {
|
|
106
|
+
if (isDone) {
|
|
107
|
+
(0, _reactNativeReanimated.runOnJS)(onRemove)();
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
if (direction === 'left') {
|
|
112
|
+
if (Math.abs(translate.value) < TAP_SLOP) {
|
|
113
|
+
springBack();
|
|
114
|
+
} else if (translate.value < -windowWidth * HORIZONTAL_DISMISS_FRACTION) {
|
|
115
|
+
dismiss();
|
|
116
|
+
} else {
|
|
117
|
+
springBack();
|
|
118
|
+
}
|
|
119
|
+
} else if (direction === 'up') {
|
|
120
|
+
if (translate.value > 0) {
|
|
121
|
+
// Dragged against the dismissal direction — always settle back.
|
|
122
|
+
springBack(WRONG_DIRECTION_SPRING_DURATION);
|
|
123
|
+
} else if (Math.abs(translate.value) < TAP_SLOP) {
|
|
124
|
+
springBack();
|
|
125
|
+
} else {
|
|
126
|
+
dismiss();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
(0, _reactNativeReanimated.runOnJS)(onFinalize)();
|
|
130
|
+
});
|
|
131
|
+
const tap = _reactNativeGestureHandler.Gesture.Tap().onEnd(event => {
|
|
132
|
+
'worklet';
|
|
133
|
+
|
|
134
|
+
(0, _reactNativeReanimated.runOnJS)(onPress)({
|
|
135
|
+
x: event.x,
|
|
136
|
+
y: event.y
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
|
|
140
|
+
const transform = direction === 'left' ? {
|
|
141
|
+
translateX: translate.value
|
|
142
|
+
} : {
|
|
143
|
+
translateY: translate.value * (position === 'bottom-center' ? -1 : 1)
|
|
144
|
+
};
|
|
145
|
+
return {
|
|
146
|
+
transform: [transform],
|
|
147
|
+
// Android composites the fade poorly against the elevation shadow, so the
|
|
148
|
+
// row stays opaque there and relies on the translate alone.
|
|
149
|
+
opacity: isAndroid ? 1 : (0, _reactNativeReanimated.interpolate)(translate.value, [0, direction === 'left' ? -windowWidth : -VERTICAL_FADE_DISTANCE], [1, 0])
|
|
150
|
+
};
|
|
151
|
+
}, [direction, translate, windowWidth, position, isAndroid]);
|
|
152
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeGestureHandler.GestureDetector, {
|
|
153
|
+
gesture: _reactNativeGestureHandler.Gesture.Race(tap, pan),
|
|
154
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeReanimated.default.View, {
|
|
155
|
+
style: [animatedStyle, unstyled ? undefined : styles.centered, styles.fullWidth, style]
|
|
156
|
+
// W9 — on web `LinearTransition`'s easing degrades to CSS `ease` because
|
|
157
|
+
// a `bezierFn` result carries no easing-name symbol for the CSS mapper.
|
|
158
|
+
// Accepted: the transition still runs, only its curve differs.
|
|
159
|
+
,
|
|
160
|
+
layout: _reactNativeReanimated.LinearTransition.easing(_animations.easeInOutCircFn)
|
|
161
|
+
// https://reactnative.dev/docs/accessibility#aria-live-android
|
|
162
|
+
,
|
|
163
|
+
"aria-live": important ? 'assertive' : 'polite',
|
|
164
|
+
children: children
|
|
165
|
+
})
|
|
166
|
+
});
|
|
167
|
+
};
|
|
168
|
+
exports.ToastSwipeHandler = ToastSwipeHandler;
|
|
169
|
+
const styles = _reactNative.StyleSheet.create({
|
|
170
|
+
centered: {
|
|
171
|
+
justifyContent: 'center'
|
|
172
|
+
},
|
|
173
|
+
fullWidth: {
|
|
174
|
+
width: '100%'
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Apple-style progressive resistance: the further the drag goes the less the row
|
|
180
|
+
* follows it.
|
|
181
|
+
*/
|
|
182
|
+
function elasticResistance(distance) {
|
|
183
|
+
'worklet';
|
|
184
|
+
|
|
185
|
+
const BASE_RESISTANCE = 0.4;
|
|
186
|
+
const PROGRESSIVE_DAMPENING = 0.02;
|
|
187
|
+
return distance * BASE_RESISTANCE * (1 / (1 + distance * PROGRESSIVE_DAMPENING));
|
|
188
|
+
}
|
|
189
|
+
//# sourceMappingURL=ToastSwipeHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","_reactNative","_reactNativeGestureHandler","_reactNativeReanimated","_animations","_context","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","HORIZONTAL_DISMISS_FRACTION","TAP_SLOP","VERTICAL_FADE_DISTANCE","SPRING_BACK_EASING_BOUNCINESS","WRONG_DIRECTION_SPRING_DURATION","ToastSwipeHandler","children","onRemove","style","onBegin","onFinalize","enabled","unstyled","important","position","positionProps","onPress","width","windowWidth","useWindowDimensions","translate","useSharedValue","swipeToDismissDirection","direction","positionCtx","useToastContext","isAndroid","Platform","OS","pan","Gesture","Pan","runOnJS","onChange","event","translationX","value","isBottomPosition","rawTranslation","translationY","elasticResistance","springBack","duration","withTiming","easing","Easing","elastic","dismiss","inOut","ease","isDone","Math","abs","tap","Tap","onEnd","x","y","animatedStyle","useAnimatedStyle","transform","translateX","translateY","opacity","interpolate","jsx","GestureDetector","gesture","Race","View","undefined","styles","centered","fullWidth","layout","LinearTransition","easeInOutCircFn","exports","StyleSheet","create","justifyContent","distance","BASE_RESISTANCE","PROGRESSIVE_DAMPENING"],"sourceRoot":"../../../src","sources":["toast/ToastSwipeHandler.tsx"],"mappings":";;;;;;AAWA,IAAAA,KAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,0BAAA,GAAAF,OAAA;AACA,IAAAG,sBAAA,GAAAJ,uBAAA,CAAAC,OAAA;AAUA,IAAAI,WAA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qF,GAAA,EAACzF,0BAAA,CAAA0F,eAAe;IAACC,OAAO,EAAErC,kCAAO,CAACsC,IAAI,CAACf,GAAG,EAAExB,GAAG,CAAE;IAAAvB,QAAA,eAC/C,IAAA1B,WAAA,CAAAqF,GAAA,EAACxF,sBAAA,CAAAc,OAAQ,CAAC8E,IAAI;MACZ7D,KAAK,EAAE,CACLkD,aAAa,EACb9C,QAAQ,GAAG0D,SAAS,GAAGC,MAAM,CAACC,QAAQ,EACtCD,MAAM,CAACE,SAAS,EAChBjE,KAAK;MAEP;MACA;MACA;MAAA;MACAkE,MAAM,EAAEC,uCAAgB,CAAC/B,MAAM,CAACgC,2BAAe;MAC/C;MAAA;MACA,aAAW/D,SAAS,GAAG,WAAW,GAAG,QAAS;MAAAP,QAAA,EAE7CA;IAAQ,CACI;EAAC,CACD,CAAC;AAEtB,CAAC;AAACuE,OAAA,CAAAxE,iBAAA,GAAAA,iBAAA;AAEF,MAAMkE,MAAM,GAAGO,uBAAU,CAACC,MAAM,CAAC;EAC/BP,QAAQ,EAAE;IAAEQ,cAAc,EAAE;EAAS,CAAC;EACtCP,SAAS,EAAE;IAAExD,KAAK,EAAE;EAAO;AAC7B,CAAC,CAAC;;AAEF;AACA;AACA;AACA;AACA,SAASuB,iBAAiBA,CAACyC,QAAgB,EAAE;EAC3C,SAAS;;EACT,MAAMC,eAAe,GAAG,GAAG;EAC3B,MAAMC,qBAAqB,GAAG,IAAI;EAClC,OACEF,QAAQ,GAAGC,eAAe,IAAI,CAAC,IAAI,CAAC,GAAGD,QAAQ,GAAGE,qBAAqB,CAAC,CAAC;AAE7E","ignoreList":[]}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Toaster = void 0;
|
|
7
|
+
var React = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _constants = require("./constants.js");
|
|
9
|
+
var _context = require("./context.js");
|
|
10
|
+
var _positionUtils = require("./position-utils.js");
|
|
11
|
+
var _Positioner = require("./Positioner.js");
|
|
12
|
+
var _ToastHost = require("./ToastHost");
|
|
13
|
+
var _ToastRow = require("./ToastRow.js");
|
|
14
|
+
var _toastStore = require("./toast-store.js");
|
|
15
|
+
var _useAppState = require("./use-app-state.js");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
18
|
+
/**
|
|
19
|
+
* Derived from sonner-native v0.26.4 — src/toaster.tsx
|
|
20
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
21
|
+
*
|
|
22
|
+
* Subscribes to the store, resolves the outlet configuration once, groups rows by
|
|
23
|
+
* position and renders each group through `Positioner` inside the platform
|
|
24
|
+
* `ToastHost`.
|
|
25
|
+
*
|
|
26
|
+
* W5 — ONE `AppState` subscription for the whole stack. Upstream subscribes per
|
|
27
|
+
* row, so N toasts meant N `visibilitychange` listeners all doing the same work;
|
|
28
|
+
* the store already exposes stack-wide `pauseAllTimers`/`resumeAllTimers`.
|
|
29
|
+
*
|
|
30
|
+
* `react-native-screens` is not imported here either — the platform wrapper is
|
|
31
|
+
* `ToastHost`'s concern (D6).
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
const ALL_POSITIONS = ['top-center', 'bottom-center', 'center'];
|
|
35
|
+
|
|
36
|
+
// Stable identities so the context memos below do not invalidate every render.
|
|
37
|
+
const EMPTY_TOAST_OPTIONS = {};
|
|
38
|
+
const EMPTY_ICONS = {};
|
|
39
|
+
const EMPTY_ANIMATION = {};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A top-anchored stack grows downward from the newest toast, so its rows render
|
|
43
|
+
* in reverse order.
|
|
44
|
+
*/
|
|
45
|
+
function orderToastsFromPosition(toasts, position) {
|
|
46
|
+
return position === 'top-center' ? toasts.slice().reverse() : toasts;
|
|
47
|
+
}
|
|
48
|
+
const Toaster = ({
|
|
49
|
+
ToasterOverlayWrapper,
|
|
50
|
+
ToastWrapper,
|
|
51
|
+
duration = _constants.toastDefaults.duration,
|
|
52
|
+
position = _constants.toastDefaults.position,
|
|
53
|
+
offset = _constants.toastDefaults.offset,
|
|
54
|
+
visibleToasts = _constants.toastDefaults.visibleToasts,
|
|
55
|
+
swipeToDismissDirection = _constants.toastDefaults.swipeToDismissDirection,
|
|
56
|
+
closeButton = _constants.toastDefaults.closeButton,
|
|
57
|
+
gap = _constants.toastDefaults.gap,
|
|
58
|
+
theme = _constants.toastDefaults.theme,
|
|
59
|
+
invert = _constants.toastDefaults.invert,
|
|
60
|
+
richColors = _constants.toastDefaults.richColors,
|
|
61
|
+
enableStacking = _constants.toastDefaults.enableStacking,
|
|
62
|
+
autoWiggleOnUpdate = _constants.toastDefaults.autoWiggleOnUpdate,
|
|
63
|
+
pauseWhenPageIsHidden = _constants.toastDefaults.pauseWhenPageIsHidden,
|
|
64
|
+
allowFontScaling = _constants.toastDefaults.allowFontScaling,
|
|
65
|
+
maxFontSizeMultiplier,
|
|
66
|
+
toastOptions = EMPTY_TOAST_OPTIONS,
|
|
67
|
+
icons = EMPTY_ICONS,
|
|
68
|
+
animation = EMPTY_ANIMATION,
|
|
69
|
+
unstyled,
|
|
70
|
+
positionerStyle,
|
|
71
|
+
style,
|
|
72
|
+
styles: styleOverrides
|
|
73
|
+
}) => {
|
|
74
|
+
const {
|
|
75
|
+
toasts,
|
|
76
|
+
shouldShowOverlay,
|
|
77
|
+
toastHeights,
|
|
78
|
+
isExpanded
|
|
79
|
+
} = React.useSyncExternalStore(_toastStore.toastStore.subscribe, _toastStore.toastStore.getSnapshot, _toastStore.toastStore.getSnapshot);
|
|
80
|
+
|
|
81
|
+
// Runs even while idle: the store must know the outlet's limits BEFORE the
|
|
82
|
+
// first toast arrives, or that toast is resolved against the bare defaults.
|
|
83
|
+
React.useEffect(() => {
|
|
84
|
+
_toastStore.toastStore.setConfig({
|
|
85
|
+
autoWiggleOnUpdate,
|
|
86
|
+
visibleToasts,
|
|
87
|
+
duration,
|
|
88
|
+
pauseWhenPageIsHidden
|
|
89
|
+
});
|
|
90
|
+
}, [autoWiggleOnUpdate, visibleToasts, duration, pauseWhenPageIsHidden]);
|
|
91
|
+
const onBackground = React.useCallback(() => {
|
|
92
|
+
if (pauseWhenPageIsHidden) {
|
|
93
|
+
_toastStore.toastStore.pauseAllTimers();
|
|
94
|
+
}
|
|
95
|
+
}, [pauseWhenPageIsHidden]);
|
|
96
|
+
const onForeground = React.useCallback(() => {
|
|
97
|
+
if (pauseWhenPageIsHidden) {
|
|
98
|
+
_toastStore.toastStore.resumeAllTimers();
|
|
99
|
+
}
|
|
100
|
+
}, [pauseWhenPageIsHidden]);
|
|
101
|
+
(0, _useAppState.useAppStateChange)({
|
|
102
|
+
onBackground,
|
|
103
|
+
onForeground
|
|
104
|
+
});
|
|
105
|
+
const stableValue = React.useMemo(() => ({
|
|
106
|
+
duration,
|
|
107
|
+
position,
|
|
108
|
+
offset,
|
|
109
|
+
visibleToasts,
|
|
110
|
+
swipeToDismissDirection,
|
|
111
|
+
closeButton,
|
|
112
|
+
gap,
|
|
113
|
+
theme,
|
|
114
|
+
invert,
|
|
115
|
+
richColors,
|
|
116
|
+
enableStacking,
|
|
117
|
+
autoWiggleOnUpdate,
|
|
118
|
+
pauseWhenPageIsHidden,
|
|
119
|
+
allowFontScaling,
|
|
120
|
+
maxFontSizeMultiplier,
|
|
121
|
+
toastOptions,
|
|
122
|
+
icons,
|
|
123
|
+
animation,
|
|
124
|
+
unstyled: unstyled ?? toastOptions.unstyled ?? _constants.toastDefaults.unstyled
|
|
125
|
+
}), [duration, position, offset, visibleToasts, swipeToDismissDirection, closeButton, gap, theme, invert, richColors, enableStacking, autoWiggleOnUpdate, pauseWhenPageIsHidden, allowFontScaling, maxFontSizeMultiplier, toastOptions, icons, animation, unstyled]);
|
|
126
|
+
const dynamicValue = React.useMemo(() => ({
|
|
127
|
+
toastHeights,
|
|
128
|
+
isExpanded,
|
|
129
|
+
expand: _toastStore.toastStore.expand,
|
|
130
|
+
collapse: _toastStore.toastStore.collapse,
|
|
131
|
+
toggleExpand: _toastStore.toastStore.toggleExpand
|
|
132
|
+
}), [toastHeights, isExpanded]);
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Rows grouped by their EFFECTIVE position, which for a toast with no explicit
|
|
136
|
+
* `position` is the outlet's configured one — the same resolution `ToastRow`
|
|
137
|
+
* itself does (`positionProp ?? positionCtx`).
|
|
138
|
+
*
|
|
139
|
+
* It must NOT be "whichever group happens to come first". Grouping a
|
|
140
|
+
* position-less row by index put it in the top-center group the moment any
|
|
141
|
+
* top-center toast existed, because `ALL_POSITIONS` starts with `top-center`:
|
|
142
|
+
* a plain `toast('Saved')` then rendered against the top inset (visible only as
|
|
143
|
+
* a sliver above the screen edge), and an already-placed one JUMPED there when a
|
|
144
|
+
* top-center toast arrived.
|
|
145
|
+
*
|
|
146
|
+
* The configured position is always kept, even with no rows in it, so
|
|
147
|
+
* position-less rows always have a home. Each group is ordered by its OWN
|
|
148
|
+
* position: a top-anchored stack renders in reverse, and applying the outlet's
|
|
149
|
+
* ordering to every group reversed the wrong ones.
|
|
150
|
+
*/
|
|
151
|
+
const toastsByPosition = React.useMemo(() => {
|
|
152
|
+
const groups = new Map();
|
|
153
|
+
for (const candidate of ALL_POSITIONS) {
|
|
154
|
+
const group = toasts.filter(toast => (toast.position ?? position) === candidate);
|
|
155
|
+
if (candidate === position || group.length > 0) {
|
|
156
|
+
groups.set(candidate, orderToastsFromPosition(group, candidate));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return groups;
|
|
160
|
+
}, [toasts, position]);
|
|
161
|
+
const onDismiss = React.useCallback(id => {
|
|
162
|
+
_toastStore.toastStore.dismissToast(id, 'onDismiss');
|
|
163
|
+
}, []);
|
|
164
|
+
|
|
165
|
+
// Nothing to host while idle. `shouldShowOverlay` stays true for the length of
|
|
166
|
+
// the exit animation after the last dismissal, so this never cuts one short.
|
|
167
|
+
if (!shouldShowOverlay) {
|
|
168
|
+
return null;
|
|
169
|
+
}
|
|
170
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToastHost.ToastHost, {
|
|
171
|
+
ToasterOverlayWrapper: ToasterOverlayWrapper,
|
|
172
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.ToastContext.Provider, {
|
|
173
|
+
value: stableValue,
|
|
174
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_context.DynamicToastContext.Provider, {
|
|
175
|
+
value: dynamicValue,
|
|
176
|
+
children: Array.from(toastsByPosition, ([currentPosition, toastsForPosition]) => {
|
|
177
|
+
const orderedToastIds = (0, _positionUtils.getOrderedToastIds)(toastsForPosition, currentPosition, enableStacking);
|
|
178
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Positioner.Positioner, {
|
|
179
|
+
position: currentPosition,
|
|
180
|
+
style: positionerStyle,
|
|
181
|
+
children: toastsForPosition.map((toast, index) => {
|
|
182
|
+
const row = /*#__PURE__*/(0, _jsxRuntime.jsx)(_ToastRow.ToastRow, {
|
|
183
|
+
...toast,
|
|
184
|
+
style: toast.style ?? style,
|
|
185
|
+
styles: toast.styles ?? styleOverrides,
|
|
186
|
+
index: index,
|
|
187
|
+
numberOfToasts: toastsForPosition.length,
|
|
188
|
+
orderedToastIds: orderedToastIds,
|
|
189
|
+
onDismiss: onDismiss,
|
|
190
|
+
ref: _toastStore.toastStore.getToastRef(toast.id)
|
|
191
|
+
}, toast.id);
|
|
192
|
+
return ToastWrapper ? /*#__PURE__*/(0, _jsxRuntime.jsx)(ToastWrapper, {
|
|
193
|
+
toastId: toast.id,
|
|
194
|
+
children: row
|
|
195
|
+
}, toast.id) : row;
|
|
196
|
+
})
|
|
197
|
+
}, currentPosition);
|
|
198
|
+
})
|
|
199
|
+
})
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
};
|
|
203
|
+
exports.Toaster = Toaster;
|
|
204
|
+
Toaster.displayName = 'Toaster';
|
|
205
|
+
//# sourceMappingURL=Toaster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","_interopRequireWildcard","require","_constants","_context","_positionUtils","_Positioner","_ToastHost","_ToastRow","_toastStore","_useAppState","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ALL_POSITIONS","EMPTY_TOAST_OPTIONS","EMPTY_ICONS","EMPTY_ANIMATION","orderToastsFromPosition","toasts","position","slice","reverse","Toaster","ToasterOverlayWrapper","ToastWrapper","duration","toastDefaults","offset","visibleToasts","swipeToDismissDirection","closeButton","gap","theme","invert","richColors","enableStacking","autoWiggleOnUpdate","pauseWhenPageIsHidden","allowFontScaling","maxFontSizeMultiplier","toastOptions","icons","animation","unstyled","positionerStyle","style","styles","styleOverrides","shouldShowOverlay","toastHeights","isExpanded","useSyncExternalStore","toastStore","subscribe","getSnapshot","useEffect","setConfig","onBackground","useCallback","pauseAllTimers","onForeground","resumeAllTimers","useAppStateChange","stableValue","useMemo","dynamicValue","expand","collapse","toggleExpand","toastsByPosition","groups","Map","candidate","group","filter","toast","length","onDismiss","id","dismissToast","jsx","ToastHost","children","ToastContext","Provider","value","DynamicToastContext","Array","from","currentPosition","toastsForPosition","orderedToastIds","getOrderedToastIds","Positioner","map","index","row","ToastRow","number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