@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,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getOrderedToastIds = exports.calculateToastPosition = exports.calculateStackScaleX = void 0;
|
|
7
|
+
var _constants = require("./constants.js");
|
|
8
|
+
/**
|
|
9
|
+
* Derived from sonner-native v0.26.4 — src/position-utils.ts
|
|
10
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
11
|
+
*
|
|
12
|
+
* PURE geometry, called from plain JS. Upstream runs `calculateToastPosition`
|
|
13
|
+
* inside a Reanimated mapper (hence its `'worklet'` directive); Bloom computes the
|
|
14
|
+
* target in React and drives the shared value imperatively instead, because an
|
|
15
|
+
* animation returned from a mapper never ticks on web — see `use-animated-target.ts`.
|
|
16
|
+
* That also makes every function here directly unit-testable.
|
|
17
|
+
*
|
|
18
|
+
* Upstream's non-null assertions on the ordered id lookups are replaced with real
|
|
19
|
+
* guards: an id can genuinely be missing for a frame while the store's ordering
|
|
20
|
+
* and the rendered rows converge.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
const getOrderedToastIds = (toasts, position, enableStacking) => {
|
|
24
|
+
if (enableStacking) {
|
|
25
|
+
// Already in rendering order — the Toaster reverses top-center up front.
|
|
26
|
+
return toasts.map(t => t.id);
|
|
27
|
+
}
|
|
28
|
+
return position === 'top-center' ? toasts.map(t => t.id).reverse() : toasts.map(t => t.id);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* How much a buried row is squeezed horizontally, so the stack reads as depth.
|
|
33
|
+
*
|
|
34
|
+
* Scale rather than width: changing the real width would rewrap the text. Returns
|
|
35
|
+
* 1 (no squeeze) for a single row, an expanded stack, stacking turned off, or
|
|
36
|
+
* before the window width is known.
|
|
37
|
+
*/
|
|
38
|
+
exports.getOrderedToastIds = getOrderedToastIds;
|
|
39
|
+
const calculateStackScaleX = ({
|
|
40
|
+
index,
|
|
41
|
+
numberOfToasts,
|
|
42
|
+
enableStacking,
|
|
43
|
+
position,
|
|
44
|
+
isExpanded,
|
|
45
|
+
stackGap,
|
|
46
|
+
screenWidth
|
|
47
|
+
}) => {
|
|
48
|
+
if (!enableStacking || numberOfToasts <= 1 || isExpanded || screenWidth <= 0) {
|
|
49
|
+
return 1;
|
|
50
|
+
}
|
|
51
|
+
const distanceFromFront = position === 'top-center' ? index : numberOfToasts - index - 1;
|
|
52
|
+
const narrowAmount = stackGap * distanceFromFront * 2;
|
|
53
|
+
return Math.max(_constants.MIN_STACK_SCALE_X, 1 - narrowAmount / screenWidth);
|
|
54
|
+
};
|
|
55
|
+
exports.calculateStackScaleX = calculateStackScaleX;
|
|
56
|
+
const heightOf = (allToastHeights, id) => {
|
|
57
|
+
if (id === undefined) {
|
|
58
|
+
return _constants.ESTIMATED_TOAST_HEIGHT;
|
|
59
|
+
}
|
|
60
|
+
// A measured 0 is not a real height — treat it as "not measured yet".
|
|
61
|
+
return allToastHeights[id] || _constants.ESTIMATED_TOAST_HEIGHT;
|
|
62
|
+
};
|
|
63
|
+
const calculateToastPosition = ({
|
|
64
|
+
index,
|
|
65
|
+
numberOfToasts,
|
|
66
|
+
enableStacking,
|
|
67
|
+
position,
|
|
68
|
+
allToastHeights,
|
|
69
|
+
gap,
|
|
70
|
+
orderedToastIds,
|
|
71
|
+
isExpanded,
|
|
72
|
+
stackGap
|
|
73
|
+
}) => {
|
|
74
|
+
const effectiveEnableStacking = enableStacking && !isExpanded;
|
|
75
|
+
|
|
76
|
+
// Center anchors at top:50% of the screen (top edge of toast = center line).
|
|
77
|
+
// Shift by -frontHeight/2 so the front toast is visually centered on the line.
|
|
78
|
+
const centerShift = position === 'center' ? -(heightOf(allToastHeights, orderedToastIds[numberOfToasts - 1]) / 2) : 0;
|
|
79
|
+
if (effectiveEnableStacking) {
|
|
80
|
+
const currentHeight = heightOf(allToastHeights, orderedToastIds[index]);
|
|
81
|
+
if (position === 'top-center') {
|
|
82
|
+
const frontHeight = heightOf(allToastHeights, orderedToastIds[0]);
|
|
83
|
+
return frontHeight + index * stackGap - currentHeight;
|
|
84
|
+
}
|
|
85
|
+
// bottom-center and center
|
|
86
|
+
const frontHeight = heightOf(allToastHeights, orderedToastIds[numberOfToasts - 1]);
|
|
87
|
+
const distFromFront = numberOfToasts - 1 - index;
|
|
88
|
+
return centerShift - (frontHeight + distFromFront * stackGap - currentHeight);
|
|
89
|
+
}
|
|
90
|
+
const effectiveGap = isExpanded ? stackGap : gap;
|
|
91
|
+
if (position === 'top-center') {
|
|
92
|
+
let totalOffset = 0;
|
|
93
|
+
for (let i = 0; i < index; i++) {
|
|
94
|
+
const toastId = orderedToastIds[i];
|
|
95
|
+
if (toastId === undefined) {
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
totalOffset += heightOf(allToastHeights, toastId) + effectiveGap;
|
|
99
|
+
}
|
|
100
|
+
return totalOffset;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// bottom-center and center
|
|
104
|
+
let totalOffset = 0;
|
|
105
|
+
for (let i = numberOfToasts - 1; i > index; i--) {
|
|
106
|
+
const toastId = orderedToastIds[i];
|
|
107
|
+
if (toastId === undefined) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
totalOffset += heightOf(allToastHeights, toastId) + effectiveGap;
|
|
111
|
+
}
|
|
112
|
+
return centerShift - totalOffset;
|
|
113
|
+
};
|
|
114
|
+
exports.calculateToastPosition = calculateToastPosition;
|
|
115
|
+
//# sourceMappingURL=position-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_constants","require","getOrderedToastIds","toasts","position","enableStacking","map","t","id","reverse","exports","calculateStackScaleX","index","numberOfToasts","isExpanded","stackGap","screenWidth","distanceFromFront","narrowAmount","Math","max","MIN_STACK_SCALE_X","heightOf","allToastHeights","undefined","ESTIMATED_TOAST_HEIGHT","calculateToastPosition","gap","orderedToastIds","effectiveEnableStacking","centerShift","currentHeight","frontHeight","distFromFront","effectiveGap","totalOffset","i","toastId"],"sourceRoot":"../../../src","sources":["toast/position-utils.ts"],"mappings":";;;;;;AAcA,IAAAA,UAAA,GAAAC,OAAA;AAdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIO,MAAMC,kBAAkB,GAAGA,CAChCC,MAAoB,EACpBC,QAAuB,EACvBC,cAAuB,KACI;EAC3B,IAAIA,cAAc,EAAE;IAClB;IACA,OAAOF,MAAM,CAACG,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,EAAE,CAAC;EAChC;EACA,OAAOJ,QAAQ,KAAK,YAAY,GAC5BD,MAAM,CAACG,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,EAAE,CAAC,CAACC,OAAO,CAAC,CAAC,GACjCN,MAAM,CAACG,GAAG,CAAEC,CAAC,IAAKA,CAAC,CAACC,EAAE,CAAC;AAC7B,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;A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,OAAO,CAAC,GAAGH,YAAY;EAClE;EACA,OAAOJ,WAAW,GAAGK,WAAW;AAClC,CAAC;AAACzB,OAAA,CAAAgB,sBAAA,GAAAA,sBAAA","ignoreList":[]}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getInsetValues = exports.getContainerStyle = exports.calculateOutsidePressableArea = void 0;
|
|
7
|
+
var _constants = require("./constants.js");
|
|
8
|
+
/**
|
|
9
|
+
* Derived from sonner-native v0.26.4 — src/positioner-utils.ts
|
|
10
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
11
|
+
*
|
|
12
|
+
* Pure geometry for the per-position container: `position: 'absolute'` is correct
|
|
13
|
+
* here because the toast host provides a viewport-sized containing block (see
|
|
14
|
+
* `ToastHost`), which is what keeps this module platform-agnostic.
|
|
15
|
+
*
|
|
16
|
+
* INVARIANT: a row must never be laid out outside its container's box. See
|
|
17
|
+
* `getContainerStyle`.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* ALL FOUR EDGES ARE PINNED, for every position. `Positioner` then overrides the
|
|
22
|
+
* one anchored edge with `getInsetValues`, so the container still spans the host in
|
|
23
|
+
* the other direction and always has a REAL HEIGHT.
|
|
24
|
+
*
|
|
25
|
+
* That is the whole point. This used to be `{position:'absolute', width:'100%'}`
|
|
26
|
+
* plus an inset of only `{bottom: N}` — and since every row inside is ITSELF
|
|
27
|
+
* `position:'absolute'`, the container had no in-flow content and measured ZERO
|
|
28
|
+
* HEIGHT, so every row was laid out entirely OUTSIDE its parent's box. Measured on
|
|
29
|
+
* web: a bottom-center container was a 0-height line at y=884 with its rows at
|
|
30
|
+
* y=784 and y=838, i.e. at NEGATIVE offsets (`top: -46px`) from a zero-height
|
|
31
|
+
* parent. The DOM does not clip, so web rendered it anyway; Android does not
|
|
32
|
+
* tolerate it, and `bottom-center` — the DEFAULT position — painted nothing at all.
|
|
33
|
+
*
|
|
34
|
+
* Two things that look like they would work here and do NOT:
|
|
35
|
+
* - `justifyContent` cannot place the rows. They are absolutely positioned, so it
|
|
36
|
+
* has no effect on them; the row's own anchor (`top: 0` / `bottom: 0` /
|
|
37
|
+
* `top: '50%'`) does the placing.
|
|
38
|
+
* - PADDING cannot supply the edge offset. In CSS an absolutely positioned child
|
|
39
|
+
* resolves against its ancestor's PADDING BOX, so padding does not inset it —
|
|
40
|
+
* while Yoga DOES inset it. Padding would have moved the rows on native and left
|
|
41
|
+
* them at the screen edge on web. The offset therefore stays an inset on the
|
|
42
|
+
* container itself, which behaves identically on both.
|
|
43
|
+
*/
|
|
44
|
+
const getContainerStyle = () => ({
|
|
45
|
+
position: 'absolute',
|
|
46
|
+
top: 0,
|
|
47
|
+
right: 0,
|
|
48
|
+
bottom: 0,
|
|
49
|
+
left: 0,
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
// Enter and exit animations translate a row past the container edge on purpose.
|
|
52
|
+
overflow: 'visible'
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* How far the stack sits from its screen edge. A falsy `offset` means "derive from
|
|
57
|
+
* the safe area": `inset + 8`, or 16 when there is no inset.
|
|
58
|
+
*
|
|
59
|
+
* `Positioner` applies this over ONE of `getContainerStyle`'s four pinned edges;
|
|
60
|
+
* `calculateOutsidePressableArea` reads the same numbers as a plain edge distance.
|
|
61
|
+
*/
|
|
62
|
+
exports.getContainerStyle = getContainerStyle;
|
|
63
|
+
const getInsetValues = ({
|
|
64
|
+
position,
|
|
65
|
+
offset,
|
|
66
|
+
safeAreaInsets
|
|
67
|
+
}) => {
|
|
68
|
+
const {
|
|
69
|
+
top = 0,
|
|
70
|
+
bottom = 0
|
|
71
|
+
} = safeAreaInsets || {};
|
|
72
|
+
if (position === 'bottom-center') {
|
|
73
|
+
if (offset) return {
|
|
74
|
+
bottom: offset
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
bottom: bottom > 0 ? bottom + 8 : 16
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
if (position === 'top-center') {
|
|
81
|
+
if (offset) return {
|
|
82
|
+
top: offset
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
top: top > 0 ? top + 8 : 16
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {};
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The area OUTSIDE the toast stack, used to collapse an expanded stack on press.
|
|
93
|
+
* It deliberately stops short of the stack itself so a press on a toast still
|
|
94
|
+
* reaches the toast.
|
|
95
|
+
*/
|
|
96
|
+
exports.getInsetValues = getInsetValues;
|
|
97
|
+
const calculateOutsidePressableArea = ({
|
|
98
|
+
position,
|
|
99
|
+
toastHeights,
|
|
100
|
+
gap,
|
|
101
|
+
visibleToasts,
|
|
102
|
+
insetValues
|
|
103
|
+
}) => {
|
|
104
|
+
const measuredHeights = Object.values(toastHeights);
|
|
105
|
+
const hasMeasurements = measuredHeights.length > 0;
|
|
106
|
+
|
|
107
|
+
// Upstream counts `min(measured.length, visibleToasts)` rows and only THEN
|
|
108
|
+
// falls back to the estimate — which makes the fallback multiply by zero, so
|
|
109
|
+
// an unmeasured stack reserved nothing and the press area ran underneath it.
|
|
110
|
+
// Reserve a full stack instead: this area is only rendered while the stack is
|
|
111
|
+
// expanded, so over-reserving is the safe direction.
|
|
112
|
+
const rowCount = hasMeasurements ? Math.min(measuredHeights.length, visibleToasts) : visibleToasts;
|
|
113
|
+
const totalToastHeight = hasMeasurements ? measuredHeights.slice(0, rowCount).reduce((sum, height) => sum + height, 0) : _constants.ESTIMATED_TOAST_HEIGHT * rowCount;
|
|
114
|
+
const gapHeight = gap * Math.max(0, rowCount - 1);
|
|
115
|
+
const stackHeight = totalToastHeight + gapHeight + _constants.OUTSIDE_PRESS_PADDING;
|
|
116
|
+
if (position === 'top-center') {
|
|
117
|
+
const topOffset = (insetValues.top || 40) + stackHeight;
|
|
118
|
+
return {
|
|
119
|
+
position: 'absolute',
|
|
120
|
+
top: topOffset,
|
|
121
|
+
bottom: 0,
|
|
122
|
+
left: 0,
|
|
123
|
+
right: 0
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (position === 'bottom-center') {
|
|
127
|
+
const bottomOffset = (insetValues.bottom || 40) + stackHeight;
|
|
128
|
+
return {
|
|
129
|
+
position: 'absolute',
|
|
130
|
+
top: 0,
|
|
131
|
+
bottom: bottomOffset,
|
|
132
|
+
left: 0,
|
|
133
|
+
right: 0
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
display: 'none'
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
exports.calculateOutsidePressableArea = calculateOutsidePressableArea;
|
|
141
|
+
//# sourceMappingURL=positioner-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_constants","require","getContainerStyle","position","top","right","bottom","left","alignItems","overflow","exports","getInsetValues","offset","safeAreaInsets","calculateOutsidePressableArea","toastHeights","gap","visibleToasts","insetValues","measuredHeights","Object","values","hasMeasurements","length","rowCount","Math","min","totalToastHeight","slice","reduce","sum","height","ESTIMATED_TOAST_HEIGHT","gapHeight","max","stackHeight","OUTSIDE_PRESS_PADDING","topOffset","bottomOffset","display"],"sourceRoot":"../../../src","sources":["toast/positioner-utils.ts"],"mappings":";;;;;;AAYA,IAAAA,UAAA,GAAAC,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,iBAAiB,GAAGA,CAAA,MAAkB;EACjDC,QAAQ,EAAE,UAAU;EACpBC,GAAG,EAAE,CAAC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void 0;
|
|
7
|
+
var _types = require("./types.js");
|
|
8
|
+
/**
|
|
9
|
+
* Derived from sonner-native v0.26.4 — src/toast-comparator.ts
|
|
10
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
11
|
+
*
|
|
12
|
+
* Drives `autoWiggleOnUpdate: 'toast-change'`: an update-by-id only wiggles the
|
|
13
|
+
* row when something a user can actually see changed. `description` is
|
|
14
|
+
* deliberately typed `string` (not `ReactNode`) so this stays a value compare —
|
|
15
|
+
* a ReactNode would differ on every parent re-render and wiggle forever.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
const areActionsEqual = (a, b) => {
|
|
19
|
+
if ((0, _types.isToastAction)(a) && (0, _types.isToastAction)(b)) {
|
|
20
|
+
return a.label === b.label;
|
|
21
|
+
}
|
|
22
|
+
return a === b;
|
|
23
|
+
};
|
|
24
|
+
const areToastsEqual = (a, b) => {
|
|
25
|
+
return a.id === b.id && a.title === b.title && a.variant === b.variant && a.description === b.description && a.closeButton === b.closeButton && a.invert === b.invert && a.position === b.position && a.dismissible === b.dismissible && a.icon === b.icon && a.jsx === b.jsx && a.duration === b.duration && a.style === b.style && a.styles === b.styles && a.important === b.important && a.richColors === b.richColors && a.promiseOptions === b.promiseOptions && areActionsEqual(a.action, b.action) && areActionsEqual(a.cancel, b.cancel);
|
|
26
|
+
};
|
|
27
|
+
exports.areToastsEqual = areToastsEqual;
|
|
28
|
+
//# sourceMappingURL=toast-comparator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_types","require","areActionsEqual","a","b","isToastAction","label","areToastsEqual","id","title","variant","description","closeButton","invert","position","dismissible","icon","jsx","duration","style","styles","important","richColors","promiseOptions","action","cancel","exports"],"sourceRoot":"../../../src","sources":["toast/toast-comparator.ts"],"mappings":";;;;;;AASA,IAAAA,MAAA,GAAAC,OAAA;AATA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,MAAMC,eAAe,GAA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AACC,CAAC,CAACsB,MAAM,EAAErB,CAAC,CAACqB,MAAM,CAAC;AAEvC,CAAC;AAACC,OAAA,CAAAnB,cAAA,GAAAA,cAAA","ignoreList":[]}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.toast = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _toastStore = require("./toast-store.js");
|
|
9
|
+
/**
|
|
10
|
+
* Derived from sonner-native v0.26.4 — src/toast-fns.ts
|
|
11
|
+
* (MIT © Gunnar Torfi Steinarsson). See the top-level NOTICE.
|
|
12
|
+
*
|
|
13
|
+
* This module is the ONLY translation layer between the public API and the
|
|
14
|
+
* engine:
|
|
15
|
+
* - the public option `type` becomes the internal `variant` (`'default'` →
|
|
16
|
+
* absent, so an unqualified toast renders neutral);
|
|
17
|
+
* - a `ReactNode` content becomes either `title` (string) or `jsx` (element).
|
|
18
|
+
* Nothing downstream of here knows the word `type`.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const TYPE_TO_VARIANT = {
|
|
22
|
+
default: undefined,
|
|
23
|
+
success: 'success',
|
|
24
|
+
error: 'error',
|
|
25
|
+
warning: 'warning',
|
|
26
|
+
info: 'info',
|
|
27
|
+
loading: 'loading'
|
|
28
|
+
};
|
|
29
|
+
const resolveContent = content => {
|
|
30
|
+
if (typeof content === 'string') {
|
|
31
|
+
return {
|
|
32
|
+
title: content
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
if (/*#__PURE__*/(0, _react.isValidElement)(content)) {
|
|
36
|
+
// A custom element owns the whole row, so there is no title to render.
|
|
37
|
+
return {
|
|
38
|
+
title: '',
|
|
39
|
+
jsx: content
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
throw new Error(`Toast can be a string or a React element, got ${typeof content}`);
|
|
43
|
+
};
|
|
44
|
+
const dispatch = (content, options, variant) => {
|
|
45
|
+
const {
|
|
46
|
+
type,
|
|
47
|
+
...rest
|
|
48
|
+
} = options;
|
|
49
|
+
return _toastStore.toastStore.addToast({
|
|
50
|
+
...rest,
|
|
51
|
+
...resolveContent(content),
|
|
52
|
+
variant: variant ?? (type === undefined ? undefined : TYPE_TO_VARIANT[type])
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const toast = exports.toast = Object.assign((content, options = {}) => dispatch(content, options), {
|
|
56
|
+
success: (content, options = {}) => dispatch(content, options, 'success'),
|
|
57
|
+
error: (content, options = {}) => dispatch(content, options, 'error'),
|
|
58
|
+
warning: (content, options = {}) => dispatch(content, options, 'warning'),
|
|
59
|
+
info: (content, options = {}) => dispatch(content, options, 'info'),
|
|
60
|
+
loading: (content, options = {}) => dispatch(content, options, 'loading'),
|
|
61
|
+
custom: (jsx, options = {}) => dispatch(jsx, options),
|
|
62
|
+
promise: (promise, options) => {
|
|
63
|
+
const {
|
|
64
|
+
loading,
|
|
65
|
+
success,
|
|
66
|
+
error,
|
|
67
|
+
styles,
|
|
68
|
+
...rest
|
|
69
|
+
} = options;
|
|
70
|
+
return _toastStore.toastStore.addToast({
|
|
71
|
+
...rest,
|
|
72
|
+
title: loading,
|
|
73
|
+
variant: 'loading',
|
|
74
|
+
styles: styles?.loading,
|
|
75
|
+
promiseOptions: {
|
|
76
|
+
// Mapping the result to its title here is what keeps `PromiseOptions`
|
|
77
|
+
// non-generic — the store never sees the caller's result type.
|
|
78
|
+
promise: promise.then(success),
|
|
79
|
+
loading,
|
|
80
|
+
error,
|
|
81
|
+
styles
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
dismiss: id => _toastStore.toastStore.dismissToast(id),
|
|
86
|
+
wiggle: id => {
|
|
87
|
+
_toastStore.toastStore.wiggleToast(id);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
//# sourceMappingURL=toast-fns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","require","_toastStore","TYPE_TO_VARIANT","default","undefined","success","error","warning","info","loading","resolveContent","content","title","isValidElement","jsx","Error","dispatch","options","variant","type","rest","toastStore","addToast","toast","exports","Object","assign","custom","promise","styles","promiseOptions","then","dismiss","id","dismissToast","wiggle","wiggleToast"],"sourceRoot":"../../../src","sources":["toast/toast-fns.ts"],"mappings":";;;;;;AAWA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AAZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAWA,MAAME,eAA4D,GAAG;EACnEC,OAAO,EAAEC,SAAS;EAClBC,OAAO,EAAE,SAAS;EAClBC,KAAK,EAAE,OAAO;EACdC,OAAO,EAAE,SAAS;EAClBC,IAAI,EAAE,MAAM;EACZC,OAAO,EAAE;AACX,CAAC;AAED,MAAMC,cAAc,GAClBC,OAAkB,IACqB;EACvC,IAAI,OAAOA,OAAO,KAAK,QAAQ,EAAE;IAC/B,OAAO;MAAEC,KAAK,EAAED;IAAQ,CAAC;EAC3B;EACA,iBAAI,IAAAE,qBAAc,EAACF,OAAO,CAAC,EAAE;IAC3B;IACA,OAAO;MAAEC,KAAK,EAAE,EAAE;MAAEE,GAAG,EAAEH;IAAQ,CAAC;EACpC;EACA,MAAM,IAAII,KAAK,CACb,iDAAiD,OAAOJ,OAAO,EACjE,CAAC;AACH,CAAC;AAED,MAAMK,QAAQ,GAAGA,CACfL,OAAkB,EAClBM,OAAqB,EACrBC,OAAsB,KACF;EACpB,MAAM;IAAEC,IAAI;IAAE,GAAGC;EAAK,CAAC,GAAGH,OAAO;EACjC,OAAOI,sBAAU,CAACC,QAAQ,CAAC;IACzB,GAAGF,IAAI;IACP,GAAGV,cAAc,CAACC,OAAO,CAAC;IAC1BO,OAAO,EAAEA,OAAO,KAAKC,IAAI,KAAKf,SAAS,GAAGA,SAAS,GAAGF,eAAe,CAACiB,IAAI,CAAC;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