@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,259 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ESTIMATED_TOAST_HEIGHT,
|
|
3
|
+
MIN_STACK_SCALE_X,
|
|
4
|
+
} from '../toast/constants';
|
|
5
|
+
import {
|
|
6
|
+
calculateStackScaleX,
|
|
7
|
+
calculateToastPosition,
|
|
8
|
+
getOrderedToastIds,
|
|
9
|
+
} from '../toast/position-utils';
|
|
10
|
+
import type { ToastPosition, ToastProps } from '../toast/types';
|
|
11
|
+
|
|
12
|
+
const toastWithId = (id: string | number): ToastProps => ({
|
|
13
|
+
id,
|
|
14
|
+
index: 0,
|
|
15
|
+
title: String(id),
|
|
16
|
+
numberOfToasts: 0,
|
|
17
|
+
orderedToastIds: [],
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const HEIGHTS = { a: 50, b: 60, c: 70 };
|
|
21
|
+
const ORDERED = ['a', 'b', 'c'];
|
|
22
|
+
|
|
23
|
+
const positionAt = ({
|
|
24
|
+
index,
|
|
25
|
+
position,
|
|
26
|
+
enableStacking = false,
|
|
27
|
+
isExpanded = false,
|
|
28
|
+
gap = 8,
|
|
29
|
+
stackGap = 8,
|
|
30
|
+
allToastHeights = HEIGHTS,
|
|
31
|
+
orderedToastIds = ORDERED,
|
|
32
|
+
numberOfToasts = ORDERED.length,
|
|
33
|
+
}: {
|
|
34
|
+
index: number;
|
|
35
|
+
position: ToastPosition;
|
|
36
|
+
enableStacking?: boolean;
|
|
37
|
+
isExpanded?: boolean;
|
|
38
|
+
gap?: number;
|
|
39
|
+
stackGap?: number;
|
|
40
|
+
allToastHeights?: Record<string | number, number>;
|
|
41
|
+
orderedToastIds?: Array<string | number>;
|
|
42
|
+
numberOfToasts?: number;
|
|
43
|
+
}) =>
|
|
44
|
+
calculateToastPosition({
|
|
45
|
+
index,
|
|
46
|
+
numberOfToasts,
|
|
47
|
+
enableStacking,
|
|
48
|
+
position,
|
|
49
|
+
allToastHeights,
|
|
50
|
+
gap,
|
|
51
|
+
orderedToastIds,
|
|
52
|
+
isExpanded,
|
|
53
|
+
stackGap,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('getOrderedToastIds', () => {
|
|
57
|
+
const toasts = [toastWithId('a'), toastWithId('b'), toastWithId('c')];
|
|
58
|
+
|
|
59
|
+
it.each<[ToastPosition, Array<string | number>]>([
|
|
60
|
+
['top-center', ['c', 'b', 'a']],
|
|
61
|
+
['bottom-center', ['a', 'b', 'c']],
|
|
62
|
+
['center', ['a', 'b', 'c']],
|
|
63
|
+
])('orders %s as %j when stacking is off', (position, expected) => {
|
|
64
|
+
expect(getOrderedToastIds(toasts, position, false)).toEqual(expected);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('keeps the store order for every position when stacking is on', () => {
|
|
68
|
+
for (const position of [
|
|
69
|
+
'top-center',
|
|
70
|
+
'bottom-center',
|
|
71
|
+
'center',
|
|
72
|
+
] as ToastPosition[]) {
|
|
73
|
+
expect(getOrderedToastIds(toasts, position, true)).toEqual([
|
|
74
|
+
'a',
|
|
75
|
+
'b',
|
|
76
|
+
'c',
|
|
77
|
+
]);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
it('does not mutate the toasts it was given', () => {
|
|
82
|
+
const input = [toastWithId('a'), toastWithId('b')];
|
|
83
|
+
getOrderedToastIds(input, 'top-center', false);
|
|
84
|
+
expect(input.map((t) => t.id)).toEqual(['a', 'b']);
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
describe('calculateToastPosition', () => {
|
|
89
|
+
describe('stacking off', () => {
|
|
90
|
+
it.each([
|
|
91
|
+
[0, 0],
|
|
92
|
+
[1, 58],
|
|
93
|
+
[2, 126],
|
|
94
|
+
])('top-center index %i sits at %i', (index, expected) => {
|
|
95
|
+
expect(positionAt({ index, position: 'top-center' })).toBe(expected);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
it.each([
|
|
99
|
+
[2, 0],
|
|
100
|
+
[1, -78],
|
|
101
|
+
[0, -146],
|
|
102
|
+
])('bottom-center index %i sits at %i', (index, expected) => {
|
|
103
|
+
expect(positionAt({ index, position: 'bottom-center' })).toBe(expected);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it.each([
|
|
107
|
+
[2, -35],
|
|
108
|
+
[1, -113],
|
|
109
|
+
])('center index %i sits at %i (half the front row above the line)', (
|
|
110
|
+
index,
|
|
111
|
+
expected,
|
|
112
|
+
) => {
|
|
113
|
+
expect(positionAt({ index, position: 'center' })).toBe(expected);
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('falls back to the estimated height for unmeasured rows', () => {
|
|
117
|
+
expect(
|
|
118
|
+
positionAt({
|
|
119
|
+
index: 1,
|
|
120
|
+
position: 'top-center',
|
|
121
|
+
allToastHeights: {},
|
|
122
|
+
orderedToastIds: ['x', 'y'],
|
|
123
|
+
numberOfToasts: 2,
|
|
124
|
+
}),
|
|
125
|
+
).toBe(ESTIMATED_TOAST_HEIGHT + 8);
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('treats a measured height of 0 as unmeasured', () => {
|
|
129
|
+
expect(
|
|
130
|
+
positionAt({
|
|
131
|
+
index: 1,
|
|
132
|
+
position: 'top-center',
|
|
133
|
+
allToastHeights: { x: 0, y: 0 },
|
|
134
|
+
orderedToastIds: ['x', 'y'],
|
|
135
|
+
numberOfToasts: 2,
|
|
136
|
+
}),
|
|
137
|
+
).toBe(ESTIMATED_TOAST_HEIGHT + 8);
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('skips ids the ordering does not have yet', () => {
|
|
141
|
+
expect(
|
|
142
|
+
positionAt({
|
|
143
|
+
index: 2,
|
|
144
|
+
position: 'top-center',
|
|
145
|
+
orderedToastIds: ['a'],
|
|
146
|
+
numberOfToasts: 3,
|
|
147
|
+
}),
|
|
148
|
+
).toBe(58);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
describe('stacking on', () => {
|
|
153
|
+
it.each([
|
|
154
|
+
[0, 0],
|
|
155
|
+
[1, -2],
|
|
156
|
+
[2, -4],
|
|
157
|
+
])('top-center index %i tucks behind the front row at %i', (
|
|
158
|
+
index,
|
|
159
|
+
expected,
|
|
160
|
+
) => {
|
|
161
|
+
expect(
|
|
162
|
+
positionAt({ index, position: 'top-center', enableStacking: true }),
|
|
163
|
+
).toBe(expected);
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it.each([
|
|
167
|
+
[2, 0],
|
|
168
|
+
[1, -18],
|
|
169
|
+
[0, -36],
|
|
170
|
+
])('bottom-center index %i tucks behind the front row at %i', (
|
|
171
|
+
index,
|
|
172
|
+
expected,
|
|
173
|
+
) => {
|
|
174
|
+
expect(
|
|
175
|
+
positionAt({ index, position: 'bottom-center', enableStacking: true }),
|
|
176
|
+
).toBe(expected);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('applies the center shift to a stacked center position', () => {
|
|
180
|
+
// centerShift (-70/2) - (front 70 + 0 * stackGap - current 70)
|
|
181
|
+
expect(
|
|
182
|
+
positionAt({ index: 2, position: 'center', enableStacking: true }),
|
|
183
|
+
).toBe(-35);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('expands into a spaced list using stackGap as the gap', () => {
|
|
187
|
+
expect(
|
|
188
|
+
positionAt({
|
|
189
|
+
index: 1,
|
|
190
|
+
position: 'top-center',
|
|
191
|
+
enableStacking: true,
|
|
192
|
+
isExpanded: true,
|
|
193
|
+
gap: 20,
|
|
194
|
+
stackGap: 4,
|
|
195
|
+
}),
|
|
196
|
+
).toBe(54);
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
describe('calculateStackScaleX', () => {
|
|
202
|
+
const scaleAt = ({
|
|
203
|
+
index,
|
|
204
|
+
numberOfToasts = 3,
|
|
205
|
+
enableStacking = true,
|
|
206
|
+
position = 'bottom-center' as ToastPosition,
|
|
207
|
+
isExpanded = false,
|
|
208
|
+
stackGap = 8,
|
|
209
|
+
screenWidth = 400,
|
|
210
|
+
}: {
|
|
211
|
+
index: number;
|
|
212
|
+
numberOfToasts?: number;
|
|
213
|
+
enableStacking?: boolean;
|
|
214
|
+
position?: ToastPosition;
|
|
215
|
+
isExpanded?: boolean;
|
|
216
|
+
stackGap?: number;
|
|
217
|
+
screenWidth?: number;
|
|
218
|
+
}) =>
|
|
219
|
+
calculateStackScaleX({
|
|
220
|
+
index,
|
|
221
|
+
numberOfToasts,
|
|
222
|
+
enableStacking,
|
|
223
|
+
position,
|
|
224
|
+
isExpanded,
|
|
225
|
+
stackGap,
|
|
226
|
+
screenWidth,
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it.each([
|
|
230
|
+
['stacking is off', { index: 0, enableStacking: false }],
|
|
231
|
+
['there is only one row', { index: 0, numberOfToasts: 1 }],
|
|
232
|
+
['the stack is expanded', { index: 0, isExpanded: true }],
|
|
233
|
+
['the window has not been measured', { index: 0, screenWidth: 0 }],
|
|
234
|
+
])('does not squeeze when %s', (_label, params) => {
|
|
235
|
+
expect(scaleAt(params)).toBe(1);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it('leaves the front row at full width and squeezes the ones behind it', () => {
|
|
239
|
+
// bottom-center: the front row is the LAST index.
|
|
240
|
+
expect(scaleAt({ index: 2 })).toBe(1);
|
|
241
|
+
expect(scaleAt({ index: 1 })).toBe(1 - 16 / 400);
|
|
242
|
+
expect(scaleAt({ index: 0 })).toBe(1 - 32 / 400);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it('measures depth from index 0 for a top-anchored stack', () => {
|
|
246
|
+
expect(scaleAt({ index: 0, position: 'top-center' })).toBe(1);
|
|
247
|
+
expect(scaleAt({ index: 1, position: 'top-center' })).toBe(1 - 16 / 400);
|
|
248
|
+
});
|
|
249
|
+
|
|
250
|
+
it('never squeezes past MIN_STACK_SCALE_X', () => {
|
|
251
|
+
expect(
|
|
252
|
+
scaleAt({ index: 0, numberOfToasts: 50, stackGap: 40, screenWidth: 200 }),
|
|
253
|
+
).toBe(MIN_STACK_SCALE_X);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
it('scales the squeeze with the window width', () => {
|
|
257
|
+
expect(scaleAt({ index: 1, screenWidth: 800 })).toBe(1 - 16 / 800);
|
|
258
|
+
});
|
|
259
|
+
});
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ESTIMATED_TOAST_HEIGHT,
|
|
3
|
+
OUTSIDE_PRESS_PADDING,
|
|
4
|
+
} from '../toast/constants';
|
|
5
|
+
import {
|
|
6
|
+
calculateOutsidePressableArea,
|
|
7
|
+
getContainerStyle,
|
|
8
|
+
getInsetValues,
|
|
9
|
+
} from '../toast/positioner-utils';
|
|
10
|
+
import type { ToastPosition } from '../toast/types';
|
|
11
|
+
|
|
12
|
+
describe('getContainerStyle', () => {
|
|
13
|
+
/**
|
|
14
|
+
* The container must be FULL-BLEED, with all four insets pinned to 0. Rows are
|
|
15
|
+
* themselves absolutely positioned, so a container that sizes itself to its
|
|
16
|
+
* content has ZERO HEIGHT and every row lands outside its parent's box — which
|
|
17
|
+
* Android refuses to paint at `bottom-center`. `getInsetValues` supplies the edge
|
|
18
|
+
* offset, which `Positioner` applies as PADDING so rows stay inside.
|
|
19
|
+
*/
|
|
20
|
+
it('is full-bleed, so a row can never be laid out outside it', () => {
|
|
21
|
+
expect(getContainerStyle()).toEqual({
|
|
22
|
+
position: 'absolute',
|
|
23
|
+
top: 0,
|
|
24
|
+
right: 0,
|
|
25
|
+
bottom: 0,
|
|
26
|
+
left: 0,
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
overflow: 'visible',
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
it('never sizes itself to its content', () => {
|
|
33
|
+
const style = getContainerStyle();
|
|
34
|
+
expect(style.height).toBeUndefined();
|
|
35
|
+
expect(style.width).toBeUndefined();
|
|
36
|
+
// All four edges pinned is what gives it the host's size instead.
|
|
37
|
+
expect([style.top, style.right, style.bottom, style.left]).toEqual([
|
|
38
|
+
0, 0, 0, 0,
|
|
39
|
+
]);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Load-bearing for swipe-to-dismiss and for the exit animation: both translate a
|
|
44
|
+
* row deliberately PAST the container edge (a left swipe by up to a full screen
|
|
45
|
+
* width, an exit by up to 150px). Clipping the container would cut the row off
|
|
46
|
+
* mid-gesture.
|
|
47
|
+
*/
|
|
48
|
+
it('does not clip, because swipe and exit translate rows past its edge', () => {
|
|
49
|
+
expect(getContainerStyle().overflow).toBe('visible');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* THE #26 INVARIANT, on the composition rather than on either half. `Positioner`
|
|
54
|
+
* layers `getInsetValues` over `getContainerStyle` in a style array, so the inset
|
|
55
|
+
* overrides exactly ONE of the four pinned edges and the opposite edge stays 0 —
|
|
56
|
+
* which is what keeps the box spanning the host and gives it a real height. If a
|
|
57
|
+
* future edit made `getInsetValues` return both edges, or dropped the opposite
|
|
58
|
+
* pin, the container would collapse to zero height again and every row would be
|
|
59
|
+
* laid out out of bounds.
|
|
60
|
+
*/
|
|
61
|
+
it.each<[ToastPosition, 'top' | 'bottom' | null]>([
|
|
62
|
+
['top-center', 'top'],
|
|
63
|
+
['bottom-center', 'bottom'],
|
|
64
|
+
['center', null],
|
|
65
|
+
])('keeps a real height for %s: only the anchored edge moves', (position, anchored) => {
|
|
66
|
+
const merged = { ...getContainerStyle(), ...getInsetValues({ position }) };
|
|
67
|
+
const edges = { top: merged.top, right: merged.right, bottom: merged.bottom, left: merged.left };
|
|
68
|
+
|
|
69
|
+
// Every edge is still pinned — none became undefined.
|
|
70
|
+
expect(Object.values(edges).every((value) => value !== undefined)).toBe(true);
|
|
71
|
+
|
|
72
|
+
const moved = Object.entries(edges)
|
|
73
|
+
.filter(([, value]) => value !== 0)
|
|
74
|
+
.map(([key]) => key);
|
|
75
|
+
expect(moved).toEqual(anchored ? [anchored] : []);
|
|
76
|
+
|
|
77
|
+
// The opposite vertical edge staying 0 is what gives the box its height.
|
|
78
|
+
if (anchored) {
|
|
79
|
+
const opposite = anchored === 'top' ? 'bottom' : 'top';
|
|
80
|
+
expect(edges[opposite]).toBe(0);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe('getInsetValues', () => {
|
|
86
|
+
it.each<[ToastPosition, 'top' | 'bottom']>([
|
|
87
|
+
['top-center', 'top'],
|
|
88
|
+
['bottom-center', 'bottom'],
|
|
89
|
+
])('honours an explicit offset for %s', (position, edge) => {
|
|
90
|
+
expect(getInsetValues({ position, offset: 24 })).toEqual({ [edge]: 24 });
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it('derives the inset from the safe area when no offset is given', () => {
|
|
94
|
+
expect(
|
|
95
|
+
getInsetValues({
|
|
96
|
+
position: 'bottom-center',
|
|
97
|
+
safeAreaInsets: { top: 47, bottom: 34 },
|
|
98
|
+
}),
|
|
99
|
+
).toEqual({ bottom: 42 });
|
|
100
|
+
|
|
101
|
+
expect(
|
|
102
|
+
getInsetValues({
|
|
103
|
+
position: 'top-center',
|
|
104
|
+
safeAreaInsets: { top: 47, bottom: 34 },
|
|
105
|
+
}),
|
|
106
|
+
).toEqual({ top: 55 });
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('falls back to 16 with no safe area and no offset', () => {
|
|
110
|
+
expect(getInsetValues({ position: 'bottom-center' })).toEqual({ bottom: 16 });
|
|
111
|
+
expect(getInsetValues({ position: 'top-center' })).toEqual({ top: 16 });
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('treats offset 0 as "derive from the safe area"', () => {
|
|
115
|
+
expect(
|
|
116
|
+
getInsetValues({
|
|
117
|
+
position: 'bottom-center',
|
|
118
|
+
offset: 0,
|
|
119
|
+
safeAreaInsets: { top: 0, bottom: 34 },
|
|
120
|
+
}),
|
|
121
|
+
).toEqual({ bottom: 42 });
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('has no inset for the center position', () => {
|
|
125
|
+
expect(getInsetValues({ position: 'center', offset: 24 })).toEqual({});
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
describe('calculateOutsidePressableArea', () => {
|
|
130
|
+
it('reserves the measured stack height at the bottom', () => {
|
|
131
|
+
// 50 + 60 + one 8px gap + padding, below a 34px inset.
|
|
132
|
+
expect(
|
|
133
|
+
calculateOutsidePressableArea({
|
|
134
|
+
position: 'bottom-center',
|
|
135
|
+
toastHeights: { a: 50, b: 60 },
|
|
136
|
+
gap: 8,
|
|
137
|
+
visibleToasts: 3,
|
|
138
|
+
insetValues: { bottom: 34 },
|
|
139
|
+
}),
|
|
140
|
+
).toEqual({
|
|
141
|
+
position: 'absolute',
|
|
142
|
+
top: 0,
|
|
143
|
+
bottom: 34 + 50 + 60 + 8 + OUTSIDE_PRESS_PADDING,
|
|
144
|
+
left: 0,
|
|
145
|
+
right: 0,
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
|
|
149
|
+
it('reserves the measured stack height at the top', () => {
|
|
150
|
+
expect(
|
|
151
|
+
calculateOutsidePressableArea({
|
|
152
|
+
position: 'top-center',
|
|
153
|
+
toastHeights: { a: 50, b: 60 },
|
|
154
|
+
gap: 8,
|
|
155
|
+
visibleToasts: 3,
|
|
156
|
+
insetValues: { top: 47 },
|
|
157
|
+
}),
|
|
158
|
+
).toEqual({
|
|
159
|
+
position: 'absolute',
|
|
160
|
+
top: 47 + 50 + 60 + 8 + OUTSIDE_PRESS_PADDING,
|
|
161
|
+
bottom: 0,
|
|
162
|
+
left: 0,
|
|
163
|
+
right: 0,
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
it('counts no more rows than visibleToasts', () => {
|
|
168
|
+
const area = calculateOutsidePressableArea({
|
|
169
|
+
position: 'bottom-center',
|
|
170
|
+
toastHeights: { a: 50, b: 60, c: 70 },
|
|
171
|
+
gap: 8,
|
|
172
|
+
visibleToasts: 2,
|
|
173
|
+
insetValues: { bottom: 0 },
|
|
174
|
+
});
|
|
175
|
+
// Only a + b, one gap, and the default 40 inset fallback.
|
|
176
|
+
expect(area.bottom).toBe(40 + 50 + 60 + 8 + OUTSIDE_PRESS_PADDING);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('estimates the stack height before anything has been measured', () => {
|
|
180
|
+
const area = calculateOutsidePressableArea({
|
|
181
|
+
position: 'bottom-center',
|
|
182
|
+
toastHeights: {},
|
|
183
|
+
gap: 8,
|
|
184
|
+
visibleToasts: 3,
|
|
185
|
+
insetValues: { bottom: 16 },
|
|
186
|
+
});
|
|
187
|
+
expect(area.bottom).toBe(
|
|
188
|
+
16 + ESTIMATED_TOAST_HEIGHT * 3 + 8 * 2 + OUTSIDE_PRESS_PADDING,
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it('charges no gap for a single row', () => {
|
|
193
|
+
const area = calculateOutsidePressableArea({
|
|
194
|
+
position: 'bottom-center',
|
|
195
|
+
toastHeights: { a: 50 },
|
|
196
|
+
gap: 8,
|
|
197
|
+
visibleToasts: 3,
|
|
198
|
+
insetValues: { bottom: 16 },
|
|
199
|
+
});
|
|
200
|
+
expect(area.bottom).toBe(16 + 50 + OUTSIDE_PRESS_PADDING);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it('has no pressable area for the center position', () => {
|
|
204
|
+
expect(
|
|
205
|
+
calculateOutsidePressableArea({
|
|
206
|
+
position: 'center',
|
|
207
|
+
toastHeights: { a: 50 },
|
|
208
|
+
gap: 8,
|
|
209
|
+
visibleToasts: 3,
|
|
210
|
+
insetValues: {},
|
|
211
|
+
}),
|
|
212
|
+
).toEqual({ display: 'none' });
|
|
213
|
+
});
|
|
214
|
+
});
|