@symbiote-native/navigation 1.0.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/LICENSE +21 -0
- package/build/angular/drawer/index.d.ts +76 -0
- package/build/angular/drawer/index.js +508 -0
- package/build/angular/drawer-screen.directive.d.ts +14 -0
- package/build/angular/drawer-screen.directive.js +87 -0
- package/build/angular/index.d.ts +23 -0
- package/build/angular/index.js +22 -0
- package/build/angular/injectors/index.d.ts +13 -0
- package/build/angular/injectors/index.js +8 -0
- package/build/angular/injectors/inject-drawer-navigation.d.ts +4 -0
- package/build/angular/injectors/inject-drawer-navigation.js +12 -0
- package/build/angular/injectors/inject-focus-effect.d.ts +2 -0
- package/build/angular/injectors/inject-focus-effect.js +29 -0
- package/build/angular/injectors/inject-is-focused.d.ts +2 -0
- package/build/angular/injectors/inject-is-focused.js +20 -0
- package/build/angular/injectors/inject-navigation-state.d.ts +3 -0
- package/build/angular/injectors/inject-navigation-state.js +35 -0
- package/build/angular/injectors/inject-navigation.d.ts +7 -0
- package/build/angular/injectors/inject-navigation.js +16 -0
- package/build/angular/injectors/inject-route.d.ts +3 -0
- package/build/angular/injectors/inject-route.js +20 -0
- package/build/angular/injectors/inject-stack-navigation.d.ts +4 -0
- package/build/angular/injectors/inject-stack-navigation.js +15 -0
- package/build/angular/injectors/inject-tab-navigation.d.ts +4 -0
- package/build/angular/injectors/inject-tab-navigation.js +11 -0
- package/build/angular/linking.d.ts +3 -0
- package/build/angular/linking.js +43 -0
- package/build/angular/navigation-context.service.d.ts +13 -0
- package/build/angular/navigation-context.service.js +105 -0
- package/build/angular/navigation-scope.directive.d.ts +10 -0
- package/build/angular/navigation-scope.directive.js +90 -0
- package/build/angular/screen.directive.d.ts +22 -0
- package/build/angular/screen.directive.js +90 -0
- package/build/angular/search-bar-ref.directive.d.ts +10 -0
- package/build/angular/search-bar-ref.directive.js +88 -0
- package/build/angular/stack/index.d.ts +55 -0
- package/build/angular/stack/index.js +386 -0
- package/build/angular/tab-screen.directive.d.ts +14 -0
- package/build/angular/tab-screen.directive.js +87 -0
- package/build/angular/tabs/index.d.ts +42 -0
- package/build/angular/tabs/index.js +263 -0
- package/build/core/constants.d.ts +27 -0
- package/build/core/constants.js +61 -0
- package/build/core/drawer-options/index.d.ts +64 -0
- package/build/core/drawer-options/index.js +200 -0
- package/build/core/drawer-router-state/index.d.ts +21 -0
- package/build/core/drawer-router-state/index.js +40 -0
- package/build/core/guards.d.ts +2 -0
- package/build/core/guards.js +22 -0
- package/build/core/header-bar-buttons.d.ts +9 -0
- package/build/core/header-bar-buttons.js +163 -0
- package/build/core/index.d.ts +29 -0
- package/build/core/index.js +32 -0
- package/build/core/linking-config/index.d.ts +13 -0
- package/build/core/linking-config/index.js +171 -0
- package/build/core/navigation-events/index.d.ts +16 -0
- package/build/core/navigation-events/index.js +57 -0
- package/build/core/navigator-handles/index.d.ts +30 -0
- package/build/core/navigator-handles/index.js +15 -0
- package/build/core/navigator-props.d.ts +216 -0
- package/build/core/navigator-props.js +7 -0
- package/build/core/navigator-state/index.d.ts +36 -0
- package/build/core/navigator-state/index.js +81 -0
- package/build/core/render-drawer.d.ts +13 -0
- package/build/core/render-drawer.js +88 -0
- package/build/core/render-stack.d.ts +35 -0
- package/build/core/render-stack.js +294 -0
- package/build/core/render-tabs.d.ts +20 -0
- package/build/core/render-tabs.js +97 -0
- package/build/core/screen-options.d.ts +4 -0
- package/build/core/screen-options.js +133 -0
- package/build/core/search-bar-commands.d.ts +10 -0
- package/build/core/search-bar-commands.js +42 -0
- package/build/core/state-persistence/index.d.ts +3 -0
- package/build/core/state-persistence/index.js +23 -0
- package/build/core/tab-options.d.ts +13 -0
- package/build/core/tab-options.js +10 -0
- package/build/core/tab-router-state/index.d.ts +19 -0
- package/build/core/tab-router-state/index.js +51 -0
- package/build/react/collect-registry.d.ts +4 -0
- package/build/react/collect-registry.js +15 -0
- package/build/react/drawer/index.d.ts +29 -0
- package/build/react/drawer/index.js +277 -0
- package/build/react/drawer-screen.d.ts +14 -0
- package/build/react/drawer-screen.js +8 -0
- package/build/react/hooks/index.d.ts +12 -0
- package/build/react/hooks/index.js +8 -0
- package/build/react/hooks/use-drawer-navigation.d.ts +4 -0
- package/build/react/hooks/use-drawer-navigation.js +12 -0
- package/build/react/hooks/use-focus-effect.d.ts +2 -0
- package/build/react/hooks/use-focus-effect.js +29 -0
- package/build/react/hooks/use-is-focused.d.ts +1 -0
- package/build/react/hooks/use-is-focused.js +22 -0
- package/build/react/hooks/use-navigation-state/index.d.ts +2 -0
- package/build/react/hooks/use-navigation-state/index.js +39 -0
- package/build/react/hooks/use-navigation.d.ts +7 -0
- package/build/react/hooks/use-navigation.js +16 -0
- package/build/react/hooks/use-route.d.ts +2 -0
- package/build/react/hooks/use-route.js +8 -0
- package/build/react/hooks/use-stack-navigation.d.ts +4 -0
- package/build/react/hooks/use-stack-navigation.js +14 -0
- package/build/react/hooks/use-tab-navigation.d.ts +4 -0
- package/build/react/hooks/use-tab-navigation.js +12 -0
- package/build/react/index.d.ts +24 -0
- package/build/react/index.js +21 -0
- package/build/react/linking.d.ts +3 -0
- package/build/react/linking.js +47 -0
- package/build/react/navigation-context.d.ts +10 -0
- package/build/react/navigation-context.js +22 -0
- package/build/react/screen.d.ts +22 -0
- package/build/react/screen.js +7 -0
- package/build/react/stack/index.d.ts +13 -0
- package/build/react/stack/index.js +202 -0
- package/build/react/tab-screen.d.ts +15 -0
- package/build/react/tab-screen.js +8 -0
- package/build/react/tabs/index.d.ts +12 -0
- package/build/react/tabs/index.js +116 -0
- package/build/register.d.ts +7 -0
- package/build/register.js +58 -0
- package/build/vue/composables/index.d.ts +12 -0
- package/build/vue/composables/index.js +8 -0
- package/build/vue/composables/use-drawer-navigation.d.ts +5 -0
- package/build/vue/composables/use-drawer-navigation.js +15 -0
- package/build/vue/composables/use-focus-effect.d.ts +1 -0
- package/build/vue/composables/use-focus-effect.js +31 -0
- package/build/vue/composables/use-is-focused.d.ts +2 -0
- package/build/vue/composables/use-is-focused.js +28 -0
- package/build/vue/composables/use-navigation-state.d.ts +3 -0
- package/build/vue/composables/use-navigation-state.js +29 -0
- package/build/vue/composables/use-navigation.d.ts +8 -0
- package/build/vue/composables/use-navigation.js +13 -0
- package/build/vue/composables/use-route.d.ts +3 -0
- package/build/vue/composables/use-route.js +9 -0
- package/build/vue/composables/use-stack-navigation.d.ts +5 -0
- package/build/vue/composables/use-stack-navigation.js +18 -0
- package/build/vue/composables/use-tab-navigation.d.ts +5 -0
- package/build/vue/composables/use-tab-navigation.js +15 -0
- package/build/vue/drawer/index.d.ts +19 -0
- package/build/vue/drawer/index.js +390 -0
- package/build/vue/drawer-screen.d.ts +14 -0
- package/build/vue/drawer-screen.js +12 -0
- package/build/vue/index.d.ts +21 -0
- package/build/vue/index.js +19 -0
- package/build/vue/linking.d.ts +3 -0
- package/build/vue/linking.js +57 -0
- package/build/vue/navigation-context.d.ts +16 -0
- package/build/vue/navigation-context.js +65 -0
- package/build/vue/screen.d.ts +21 -0
- package/build/vue/screen.js +12 -0
- package/build/vue/stack/index.d.ts +9 -0
- package/build/vue/stack/index.js +279 -0
- package/build/vue/tab-screen.d.ts +14 -0
- package/build/vue/tab-screen.js +11 -0
- package/build/vue/tabs/index.d.ts +10 -0
- package/build/vue/tabs/index.js +209 -0
- package/build-ngc/angular/drawer/index.d.ts +79 -0
- package/build-ngc/angular/drawer/index.js +479 -0
- package/build-ngc/angular/drawer/index.js.map +1 -0
- package/build-ngc/angular/drawer-screen.directive.d.ts +17 -0
- package/build-ngc/angular/drawer-screen.directive.js +32 -0
- package/build-ngc/angular/drawer-screen.directive.js.map +1 -0
- package/build-ngc/angular/drawer.d.ts +79 -0
- package/build-ngc/angular/drawer.js +475 -0
- package/build-ngc/angular/drawer.js.map +1 -0
- package/build-ngc/angular/index.d.ts +23 -0
- package/build-ngc/angular/index.js +23 -0
- package/build-ngc/angular/index.js.map +1 -0
- package/build-ngc/angular/injectors/index.d.ts +13 -0
- package/build-ngc/angular/injectors/index.js +9 -0
- package/build-ngc/angular/injectors/index.js.map +1 -0
- package/build-ngc/angular/injectors/inject-drawer-navigation.d.ts +4 -0
- package/build-ngc/angular/injectors/inject-drawer-navigation.js +13 -0
- package/build-ngc/angular/injectors/inject-drawer-navigation.js.map +1 -0
- package/build-ngc/angular/injectors/inject-focus-effect.d.ts +2 -0
- package/build-ngc/angular/injectors/inject-focus-effect.js +30 -0
- package/build-ngc/angular/injectors/inject-focus-effect.js.map +1 -0
- package/build-ngc/angular/injectors/inject-is-focused.d.ts +2 -0
- package/build-ngc/angular/injectors/inject-is-focused.js +22 -0
- package/build-ngc/angular/injectors/inject-is-focused.js.map +1 -0
- package/build-ngc/angular/injectors/inject-navigation-state.d.ts +3 -0
- package/build-ngc/angular/injectors/inject-navigation-state.js +37 -0
- package/build-ngc/angular/injectors/inject-navigation-state.js.map +1 -0
- package/build-ngc/angular/injectors/inject-navigation.d.ts +7 -0
- package/build-ngc/angular/injectors/inject-navigation.js +17 -0
- package/build-ngc/angular/injectors/inject-navigation.js.map +1 -0
- package/build-ngc/angular/injectors/inject-route.d.ts +3 -0
- package/build-ngc/angular/injectors/inject-route.js +21 -0
- package/build-ngc/angular/injectors/inject-route.js.map +1 -0
- package/build-ngc/angular/injectors/inject-stack-navigation.d.ts +4 -0
- package/build-ngc/angular/injectors/inject-stack-navigation.js +16 -0
- package/build-ngc/angular/injectors/inject-stack-navigation.js.map +1 -0
- package/build-ngc/angular/injectors/inject-tab-navigation.d.ts +4 -0
- package/build-ngc/angular/injectors/inject-tab-navigation.js +12 -0
- package/build-ngc/angular/injectors/inject-tab-navigation.js.map +1 -0
- package/build-ngc/angular/linking.d.ts +3 -0
- package/build-ngc/angular/linking.js +44 -0
- package/build-ngc/angular/linking.js.map +1 -0
- package/build-ngc/angular/navigation-context.service.d.ts +16 -0
- package/build-ngc/angular/navigation-context.service.js +63 -0
- package/build-ngc/angular/navigation-context.service.js.map +1 -0
- package/build-ngc/angular/navigation-scope.directive.d.ts +13 -0
- package/build-ngc/angular/navigation-scope.directive.js +42 -0
- package/build-ngc/angular/navigation-scope.directive.js.map +1 -0
- package/build-ngc/angular/screen.directive.d.ts +25 -0
- package/build-ngc/angular/screen.directive.js +35 -0
- package/build-ngc/angular/screen.directive.js.map +1 -0
- package/build-ngc/angular/search-bar-ref.directive.d.ts +13 -0
- package/build-ngc/angular/search-bar-ref.directive.js +44 -0
- package/build-ngc/angular/search-bar-ref.directive.js.map +1 -0
- package/build-ngc/angular/stack/index.d.ts +58 -0
- package/build-ngc/angular/stack/index.js +406 -0
- package/build-ngc/angular/stack/index.js.map +1 -0
- package/build-ngc/angular/stack.d.ts +58 -0
- package/build-ngc/angular/stack.js +402 -0
- package/build-ngc/angular/stack.js.map +1 -0
- package/build-ngc/angular/tab-screen.directive.d.ts +17 -0
- package/build-ngc/angular/tab-screen.directive.js +32 -0
- package/build-ngc/angular/tab-screen.directive.js.map +1 -0
- package/build-ngc/angular/tabs/index.d.ts +45 -0
- package/build-ngc/angular/tabs/index.js +231 -0
- package/build-ngc/angular/tabs/index.js.map +1 -0
- package/build-ngc/angular/tabs.d.ts +45 -0
- package/build-ngc/angular/tabs.js +231 -0
- package/build-ngc/angular/tabs.js.map +1 -0
- package/build-ngc/core/constants.d.ts +27 -0
- package/build-ngc/core/constants.js +62 -0
- package/build-ngc/core/constants.js.map +1 -0
- package/build-ngc/core/drawer-options/index.d.ts +64 -0
- package/build-ngc/core/drawer-options/index.js +201 -0
- package/build-ngc/core/drawer-options/index.js.map +1 -0
- package/build-ngc/core/drawer-options.d.ts +64 -0
- package/build-ngc/core/drawer-options.js +201 -0
- package/build-ngc/core/drawer-options.js.map +1 -0
- package/build-ngc/core/drawer-router-state/index.d.ts +21 -0
- package/build-ngc/core/drawer-router-state/index.js +41 -0
- package/build-ngc/core/drawer-router-state/index.js.map +1 -0
- package/build-ngc/core/drawer-router-state.d.ts +21 -0
- package/build-ngc/core/drawer-router-state.js +41 -0
- package/build-ngc/core/drawer-router-state.js.map +1 -0
- package/build-ngc/core/guards.d.ts +2 -0
- package/build-ngc/core/guards.js +23 -0
- package/build-ngc/core/guards.js.map +1 -0
- package/build-ngc/core/header-bar-buttons.d.ts +9 -0
- package/build-ngc/core/header-bar-buttons.js +164 -0
- package/build-ngc/core/header-bar-buttons.js.map +1 -0
- package/build-ngc/core/href.d.ts +16 -0
- package/build-ngc/core/href.js +55 -0
- package/build-ngc/core/href.js.map +1 -0
- package/build-ngc/core/index.d.ts +29 -0
- package/build-ngc/core/index.js +33 -0
- package/build-ngc/core/index.js.map +1 -0
- package/build-ngc/core/linking-config/index.d.ts +13 -0
- package/build-ngc/core/linking-config/index.js +172 -0
- package/build-ngc/core/linking-config/index.js.map +1 -0
- package/build-ngc/core/linking-config.d.ts +13 -0
- package/build-ngc/core/linking-config.js +172 -0
- package/build-ngc/core/linking-config.js.map +1 -0
- package/build-ngc/core/navigation-events/index.d.ts +16 -0
- package/build-ngc/core/navigation-events/index.js +58 -0
- package/build-ngc/core/navigation-events/index.js.map +1 -0
- package/build-ngc/core/navigation-events.d.ts +16 -0
- package/build-ngc/core/navigation-events.js +58 -0
- package/build-ngc/core/navigation-events.js.map +1 -0
- package/build-ngc/core/navigator-handles/index.d.ts +30 -0
- package/build-ngc/core/navigator-handles/index.js +16 -0
- package/build-ngc/core/navigator-handles/index.js.map +1 -0
- package/build-ngc/core/navigator-handles.d.ts +30 -0
- package/build-ngc/core/navigator-handles.js +16 -0
- package/build-ngc/core/navigator-handles.js.map +1 -0
- package/build-ngc/core/navigator-props.d.ts +216 -0
- package/build-ngc/core/navigator-props.js +8 -0
- package/build-ngc/core/navigator-props.js.map +1 -0
- package/build-ngc/core/navigator-state/index.d.ts +36 -0
- package/build-ngc/core/navigator-state/index.js +82 -0
- package/build-ngc/core/navigator-state/index.js.map +1 -0
- package/build-ngc/core/navigator-state.d.ts +36 -0
- package/build-ngc/core/navigator-state.js +82 -0
- package/build-ngc/core/navigator-state.js.map +1 -0
- package/build-ngc/core/render-drawer.d.ts +13 -0
- package/build-ngc/core/render-drawer.js +89 -0
- package/build-ngc/core/render-drawer.js.map +1 -0
- package/build-ngc/core/render-stack.d.ts +35 -0
- package/build-ngc/core/render-stack.js +295 -0
- package/build-ngc/core/render-stack.js.map +1 -0
- package/build-ngc/core/render-tabs.d.ts +20 -0
- package/build-ngc/core/render-tabs.js +98 -0
- package/build-ngc/core/render-tabs.js.map +1 -0
- package/build-ngc/core/screen-options.d.ts +4 -0
- package/build-ngc/core/screen-options.js +134 -0
- package/build-ngc/core/screen-options.js.map +1 -0
- package/build-ngc/core/search-bar-commands.d.ts +10 -0
- package/build-ngc/core/search-bar-commands.js +43 -0
- package/build-ngc/core/search-bar-commands.js.map +1 -0
- package/build-ngc/core/search-params.d.ts +9 -0
- package/build-ngc/core/search-params.js +60 -0
- package/build-ngc/core/search-params.js.map +1 -0
- package/build-ngc/core/state-persistence/index.d.ts +3 -0
- package/build-ngc/core/state-persistence/index.js +24 -0
- package/build-ngc/core/state-persistence/index.js.map +1 -0
- package/build-ngc/core/state-persistence.d.ts +3 -0
- package/build-ngc/core/state-persistence.js +24 -0
- package/build-ngc/core/state-persistence.js.map +1 -0
- package/build-ngc/core/tab-options.d.ts +13 -0
- package/build-ngc/core/tab-options.js +11 -0
- package/build-ngc/core/tab-options.js.map +1 -0
- package/build-ngc/core/tab-router-state/index.d.ts +19 -0
- package/build-ngc/core/tab-router-state/index.js +52 -0
- package/build-ngc/core/tab-router-state/index.js.map +1 -0
- package/build-ngc/core/tab-router-state.d.ts +19 -0
- package/build-ngc/core/tab-router-state.js +52 -0
- package/build-ngc/core/tab-router-state.js.map +1 -0
- package/build-ngc/register.d.ts +7 -0
- package/build-ngc/register.js +59 -0
- package/build-ngc/register.js.map +1 -0
- package/codegen-specs/FullWindowOverlayNativeComponent.ts +13 -0
- package/codegen-specs/ModalScreenNativeComponent.ts +129 -0
- package/codegen-specs/NativeScreensModule.ts +8 -0
- package/codegen-specs/NativeScreensModule.web.ts +1 -0
- package/codegen-specs/ScreenContainerNativeComponent.ts +8 -0
- package/codegen-specs/ScreenContentWrapperNativeComponent.ts +9 -0
- package/codegen-specs/ScreenFooterNativeComponent.ts +6 -0
- package/codegen-specs/ScreenNativeComponent.ts +133 -0
- package/codegen-specs/ScreenNavigationContainerNativeComponent.ts +11 -0
- package/codegen-specs/ScreenStackHeaderConfigNativeComponent.ts +99 -0
- package/codegen-specs/ScreenStackHeaderSubviewNativeComponent.ts +25 -0
- package/codegen-specs/ScreenStackNativeComponent.ts +17 -0
- package/codegen-specs/SearchBarNativeComponent.ts +101 -0
- package/codegen-specs/codegenUtils.ts +6 -0
- package/codegen-specs/gamma/ScrollViewMarkerNativeComponent.ts +15 -0
- package/codegen-specs/gamma/modals/form-sheet/FormSheetContentWrapperNativeComponent.ts +10 -0
- package/codegen-specs/gamma/modals/form-sheet/FormSheetHostNativeComponent.ts +47 -0
- package/codegen-specs/gamma/split/SplitHostNativeComponent.ts +124 -0
- package/codegen-specs/gamma/split/SplitScreenNativeComponent.ts +24 -0
- package/codegen-specs/gamma/stack/StackHeaderConfigAndroidNativeComponent.ts +144 -0
- package/codegen-specs/gamma/stack/StackHeaderConfigIOSNativeComponent.ts +34 -0
- package/codegen-specs/gamma/stack/StackHeaderItemIOSNativeComponent.ts +47 -0
- package/codegen-specs/gamma/stack/StackHeaderItemSpacerIOSNativeComponent.ts +20 -0
- package/codegen-specs/gamma/stack/StackHeaderSubviewAndroidNativeComponent.ts +27 -0
- package/codegen-specs/gamma/stack/StackHostNativeComponent.ts +8 -0
- package/codegen-specs/gamma/stack/StackScreenNativeComponent.ts +42 -0
- package/codegen-specs/safe-area/SafeAreaViewNativeComponent.ts +24 -0
- package/codegen-specs/tabs/TabsBottomAccessoryContentNativeComponent.ts +15 -0
- package/codegen-specs/tabs/TabsBottomAccessoryNativeComponent.ts +19 -0
- package/codegen-specs/tabs/TabsHostAndroidNativeComponent.ts +69 -0
- package/codegen-specs/tabs/TabsHostIOSNativeComponent.ts +92 -0
- package/codegen-specs/tabs/TabsScreenAndroidNativeComponent.ts +112 -0
- package/codegen-specs/tabs/TabsScreenIOSNativeComponent.ts +171 -0
- package/package.json +201 -0
- package/react-native.config.cjs +58 -0
- package/src/angular/drawer/drawer.test.ts +299 -0
- package/src/angular/drawer/index.ts +546 -0
- package/src/angular/drawer-screen.directive.ts +28 -0
- package/src/angular/index.ts +63 -0
- package/src/angular/injectors/index.ts +13 -0
- package/src/angular/injectors/inject-drawer-navigation.ts +21 -0
- package/src/angular/injectors/inject-focus-effect.ts +37 -0
- package/src/angular/injectors/inject-is-focused.ts +28 -0
- package/src/angular/injectors/inject-navigation-state.ts +46 -0
- package/src/angular/injectors/inject-navigation.ts +26 -0
- package/src/angular/injectors/inject-route.ts +25 -0
- package/src/angular/injectors/inject-stack-navigation.ts +24 -0
- package/src/angular/injectors/inject-tab-navigation.ts +20 -0
- package/src/angular/injectors/injectors.test.ts +247 -0
- package/src/angular/injectors/use-typed-navigation.test.ts +229 -0
- package/src/angular/linking.ts +55 -0
- package/src/angular/navigation-context.service.ts +68 -0
- package/src/angular/navigation-scope.directive.ts +31 -0
- package/src/angular/nested-navigation.test.ts +189 -0
- package/src/angular/screen.directive.ts +48 -0
- package/src/angular/search-bar-ref.directive.ts +38 -0
- package/src/angular/stack/index.ts +401 -0
- package/src/angular/stack/stack.test.ts +419 -0
- package/src/angular/tab-screen.directive.ts +26 -0
- package/src/angular/tabs/index.ts +254 -0
- package/src/angular/tabs/tabs.test.ts +249 -0
- package/src/core/constants.ts +68 -0
- package/src/core/drawer-options/drawer-options.test.ts +415 -0
- package/src/core/drawer-options/index.ts +331 -0
- package/src/core/drawer-router-state/drawer-router-state.test.ts +116 -0
- package/src/core/drawer-router-state/index.ts +71 -0
- package/src/core/guards.ts +23 -0
- package/src/core/header-bar-buttons.ts +212 -0
- package/src/core/index.ts +170 -0
- package/src/core/linking-config/index.ts +209 -0
- package/src/core/linking-config/linking-config.test.ts +109 -0
- package/src/core/navigation-events/index.ts +94 -0
- package/src/core/navigation-events/navigation-events.test.ts +56 -0
- package/src/core/navigator-handles/index.ts +63 -0
- package/src/core/navigator-handles/navigator-handles.test.ts +46 -0
- package/src/core/navigator-props.ts +323 -0
- package/src/core/navigator-state/index.ts +112 -0
- package/src/core/navigator-state/navigator-state.test.ts +80 -0
- package/src/core/render-drawer.ts +123 -0
- package/src/core/render-stack.ts +414 -0
- package/src/core/render-tabs.ts +138 -0
- package/src/core/screen-options.ts +181 -0
- package/src/core/search-bar-commands.ts +57 -0
- package/src/core/state-persistence/index.ts +30 -0
- package/src/core/state-persistence/state-persistence.test.ts +42 -0
- package/src/core/tab-options.ts +25 -0
- package/src/core/tab-router-state/index.ts +75 -0
- package/src/core/tab-router-state/tab-router-state.test.ts +34 -0
- package/src/globals.d.ts +4 -0
- package/src/react/collect-registry.ts +19 -0
- package/src/react/drawer/drawer.test.tsx +472 -0
- package/src/react/drawer/index.ts +451 -0
- package/src/react/drawer-screen.ts +29 -0
- package/src/react/hooks/hooks.test.tsx +199 -0
- package/src/react/hooks/index.ts +12 -0
- package/src/react/hooks/use-drawer-navigation.ts +21 -0
- package/src/react/hooks/use-focus-effect.ts +36 -0
- package/src/react/hooks/use-is-focused.ts +26 -0
- package/src/react/hooks/use-navigation-state/index.ts +47 -0
- package/src/react/hooks/use-navigation-state/use-navigation-state.test.ts +85 -0
- package/src/react/hooks/use-navigation.ts +36 -0
- package/src/react/hooks/use-route.ts +11 -0
- package/src/react/hooks/use-stack-navigation.ts +23 -0
- package/src/react/hooks/use-tab-navigation.ts +21 -0
- package/src/react/hooks/use-typed-navigation.test.tsx +187 -0
- package/src/react/index.ts +52 -0
- package/src/react/linking.ts +59 -0
- package/src/react/navigation-context.ts +40 -0
- package/src/react/nested-navigation.test.tsx +145 -0
- package/src/react/screen.ts +44 -0
- package/src/react/stack/index.ts +323 -0
- package/src/react/stack/stack.test.tsx +514 -0
- package/src/react/tab-screen.ts +30 -0
- package/src/react/tabs/index.ts +204 -0
- package/src/react/tabs/tabs.test.tsx +256 -0
- package/src/register.ts +59 -0
- package/src/vue/composables/composables.test.ts +221 -0
- package/src/vue/composables/index.ts +12 -0
- package/src/vue/composables/use-drawer-navigation.ts +25 -0
- package/src/vue/composables/use-focus-effect.ts +37 -0
- package/src/vue/composables/use-is-focused.ts +34 -0
- package/src/vue/composables/use-navigation-state.ts +38 -0
- package/src/vue/composables/use-navigation.ts +30 -0
- package/src/vue/composables/use-route.ts +13 -0
- package/src/vue/composables/use-stack-navigation.ts +28 -0
- package/src/vue/composables/use-tab-navigation.ts +25 -0
- package/src/vue/composables/use-typed-navigation.test.ts +205 -0
- package/src/vue/drawer/drawer.test.ts +451 -0
- package/src/vue/drawer/index.ts +550 -0
- package/src/vue/drawer-screen.ts +32 -0
- package/src/vue/index.ts +70 -0
- package/src/vue/linking.ts +69 -0
- package/src/vue/navigation-context.ts +87 -0
- package/src/vue/nested-navigation.test.ts +155 -0
- package/src/vue/screen.ts +52 -0
- package/src/vue/stack/index.ts +376 -0
- package/src/vue/stack/stack.test.ts +501 -0
- package/src/vue/tab-screen.ts +29 -0
- package/src/vue/tabs/index.ts +302 -0
- package/src/vue/tabs/tabs.test.ts +278 -0
- package/symbiote-navigation.podspec +84 -0
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
// Co-located unit test (ADR 0025) for the pure drawer geometry/swipe math - sibling to
|
|
2
|
+
// drawer-router-state.test.ts. Everything here is a plain predicate/fold over numbers and the
|
|
3
|
+
// IDrawerOptions surface, so the full matrix (4 drawerTypes x 2 drawerPositions for the geometry,
|
|
4
|
+
// both edges for the swipe gates) is exercised directly, without the fake-touch-event plumbing
|
|
5
|
+
// react/drawer.test.tsx needs to drive the same math through a live gesture.
|
|
6
|
+
|
|
7
|
+
import { describe, expect, it } from 'vitest';
|
|
8
|
+
import { createElement } from '@symbiote-native/engine';
|
|
9
|
+
import type { IPanResponderGestureState, ISymbioteEvent } from '@symbiote-native/engine';
|
|
10
|
+
import {
|
|
11
|
+
DRAWER_DEFAULT_WIDTH,
|
|
12
|
+
clamp01,
|
|
13
|
+
isHorizontalDrag,
|
|
14
|
+
isSwipeStartInEdge,
|
|
15
|
+
resolveDragProgress,
|
|
16
|
+
resolveDrawerGeometry,
|
|
17
|
+
resolveSwipeIntent,
|
|
18
|
+
shouldClaimDrawerSwipe,
|
|
19
|
+
startPageXOf,
|
|
20
|
+
} from './index';
|
|
21
|
+
import type { IDrawerOptions } from './index';
|
|
22
|
+
|
|
23
|
+
// A real branded RCTView node so no cast is needed (mirrors
|
|
24
|
+
// core/engine/src/pan-responder/pan-responder.test.ts's own targetNode) - the gesture math here
|
|
25
|
+
// never reads target/currentTarget, only nativeEvent.
|
|
26
|
+
const fakeTarget = createElement('RCTView');
|
|
27
|
+
|
|
28
|
+
function fakeEvent(nativeEvent: Record<string, unknown>): ISymbioteEvent {
|
|
29
|
+
return {
|
|
30
|
+
type: 'test',
|
|
31
|
+
target: fakeTarget,
|
|
32
|
+
currentTarget: fakeTarget,
|
|
33
|
+
nativeEvent,
|
|
34
|
+
stopPropagation: () => {},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function gestureState(overrides: Partial<IPanResponderGestureState>): IPanResponderGestureState {
|
|
39
|
+
return {
|
|
40
|
+
stateID: 1,
|
|
41
|
+
moveX: 0,
|
|
42
|
+
moveY: 0,
|
|
43
|
+
x0: 0,
|
|
44
|
+
y0: 0,
|
|
45
|
+
dx: 0,
|
|
46
|
+
dy: 0,
|
|
47
|
+
vx: 0,
|
|
48
|
+
vy: 0,
|
|
49
|
+
numberActiveTouches: 1,
|
|
50
|
+
_accountsForMovesUpTo: 0,
|
|
51
|
+
...overrides,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('resolveDrawerGeometry', () => {
|
|
56
|
+
const WIDTH = DRAWER_DEFAULT_WIDTH;
|
|
57
|
+
|
|
58
|
+
it('front + left: only the panel moves off/on screen, content stays put', () => {
|
|
59
|
+
expect(resolveDrawerGeometry({ drawerType: 'front', drawerPosition: 'left' })).toEqual({
|
|
60
|
+
panelTranslateXClosed: -WIDTH,
|
|
61
|
+
panelTranslateXOpen: 0,
|
|
62
|
+
contentTranslateXClosed: 0,
|
|
63
|
+
contentTranslateXOpen: 0,
|
|
64
|
+
overlayOpacityClosed: 0,
|
|
65
|
+
overlayOpacityOpen: 1,
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('front + right: the panel closes toward the opposite edge from left', () => {
|
|
70
|
+
expect(resolveDrawerGeometry({ drawerType: 'front', drawerPosition: 'right' })).toEqual({
|
|
71
|
+
panelTranslateXClosed: WIDTH,
|
|
72
|
+
panelTranslateXOpen: 0,
|
|
73
|
+
contentTranslateXClosed: 0,
|
|
74
|
+
contentTranslateXOpen: 0,
|
|
75
|
+
overlayOpacityClosed: 0,
|
|
76
|
+
overlayOpacityOpen: 1,
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
it('back + left: only the content slides away; the panel never translates', () => {
|
|
81
|
+
expect(resolveDrawerGeometry({ drawerType: 'back', drawerPosition: 'left' })).toEqual({
|
|
82
|
+
panelTranslateXClosed: 0,
|
|
83
|
+
panelTranslateXOpen: 0,
|
|
84
|
+
contentTranslateXClosed: 0,
|
|
85
|
+
contentTranslateXOpen: WIDTH,
|
|
86
|
+
overlayOpacityClosed: 0,
|
|
87
|
+
overlayOpacityOpen: 0,
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('back + right: content slides the mirrored way, still no overlay', () => {
|
|
92
|
+
expect(resolveDrawerGeometry({ drawerType: 'back', drawerPosition: 'right' })).toEqual({
|
|
93
|
+
panelTranslateXClosed: 0,
|
|
94
|
+
panelTranslateXOpen: 0,
|
|
95
|
+
contentTranslateXClosed: 0,
|
|
96
|
+
contentTranslateXOpen: -WIDTH,
|
|
97
|
+
overlayOpacityClosed: 0,
|
|
98
|
+
overlayOpacityOpen: 0,
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
it('slide + left: panel and content move together by the same delta', () => {
|
|
103
|
+
expect(resolveDrawerGeometry({ drawerType: 'slide', drawerPosition: 'left' })).toEqual({
|
|
104
|
+
panelTranslateXClosed: -WIDTH,
|
|
105
|
+
panelTranslateXOpen: 0,
|
|
106
|
+
contentTranslateXClosed: 0,
|
|
107
|
+
contentTranslateXOpen: WIDTH,
|
|
108
|
+
overlayOpacityClosed: 0,
|
|
109
|
+
overlayOpacityOpen: 1,
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
it('slide + right: both translate toward the mirrored side', () => {
|
|
114
|
+
expect(resolveDrawerGeometry({ drawerType: 'slide', drawerPosition: 'right' })).toEqual({
|
|
115
|
+
panelTranslateXClosed: WIDTH,
|
|
116
|
+
panelTranslateXOpen: 0,
|
|
117
|
+
contentTranslateXClosed: 0,
|
|
118
|
+
contentTranslateXOpen: -WIDTH,
|
|
119
|
+
overlayOpacityClosed: 0,
|
|
120
|
+
overlayOpacityOpen: 1,
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
// The file's own header comment claims "permanent: static, all zero", but the switch falls
|
|
125
|
+
// through to the SAME branch as 'front' - panelTranslateXClosed/overlayOpacityOpen are NOT
|
|
126
|
+
// zero here. Harmless at runtime only because every call site (react/drawer.ts) gates the
|
|
127
|
+
// animated interpolation behind isDrawerAnimated() and never reads these numbers for
|
|
128
|
+
// 'permanent' - but the comment is inaccurate about what this function itself returns.
|
|
129
|
+
it('permanent + left: falls through to front\'s non-zero offsets, not "all zero"', () => {
|
|
130
|
+
expect(resolveDrawerGeometry({ drawerType: 'permanent', drawerPosition: 'left' })).toEqual({
|
|
131
|
+
panelTranslateXClosed: -WIDTH,
|
|
132
|
+
panelTranslateXOpen: 0,
|
|
133
|
+
contentTranslateXClosed: 0,
|
|
134
|
+
contentTranslateXOpen: 0,
|
|
135
|
+
overlayOpacityClosed: 0,
|
|
136
|
+
overlayOpacityOpen: 1,
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('permanent + right: mirrors front + right', () => {
|
|
141
|
+
expect(resolveDrawerGeometry({ drawerType: 'permanent', drawerPosition: 'right' })).toEqual({
|
|
142
|
+
panelTranslateXClosed: WIDTH,
|
|
143
|
+
panelTranslateXOpen: 0,
|
|
144
|
+
contentTranslateXClosed: 0,
|
|
145
|
+
contentTranslateXOpen: 0,
|
|
146
|
+
overlayOpacityClosed: 0,
|
|
147
|
+
overlayOpacityOpen: 1,
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('honors an explicit drawerWidth instead of the default', () => {
|
|
152
|
+
const options: IDrawerOptions = {
|
|
153
|
+
drawerType: 'front',
|
|
154
|
+
drawerPosition: 'left',
|
|
155
|
+
drawerWidth: 200,
|
|
156
|
+
};
|
|
157
|
+
expect(resolveDrawerGeometry(options).panelTranslateXClosed).toBe(-200);
|
|
158
|
+
});
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
describe('isSwipeStartInEdge', () => {
|
|
162
|
+
const SCREEN_WIDTH = 375;
|
|
163
|
+
|
|
164
|
+
it('left position, closed: a start within the edge zone counts', () => {
|
|
165
|
+
expect(isSwipeStartInEdge(20, SCREEN_WIDTH, false, { drawerPosition: 'left' })).toBe(true);
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it('left position, closed: a start past the edge zone does not count', () => {
|
|
169
|
+
expect(isSwipeStartInEdge(40, SCREEN_WIDTH, false, { drawerPosition: 'left' })).toBe(false);
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
it('right position, closed: a start within the edge zone (measured from the right) counts', () => {
|
|
173
|
+
expect(isSwipeStartInEdge(360, SCREEN_WIDTH, false, { drawerPosition: 'right' })).toBe(true);
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
it('right position, closed: a start past the edge zone does not count', () => {
|
|
177
|
+
expect(isSwipeStartInEdge(300, SCREEN_WIDTH, false, { drawerPosition: 'right' })).toBe(false);
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
it('open: any start position counts, regardless of position or distance from the edge', () => {
|
|
181
|
+
expect(isSwipeStartInEdge(-9_999, SCREEN_WIDTH, true, { drawerPosition: 'left' })).toBe(true);
|
|
182
|
+
expect(isSwipeStartInEdge(9_999, SCREEN_WIDTH, true, { drawerPosition: 'right' })).toBe(true);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
it('honors a custom swipeEdgeWidth over the default', () => {
|
|
186
|
+
const options: IDrawerOptions = { drawerPosition: 'left', swipeEdgeWidth: 100 };
|
|
187
|
+
expect(isSwipeStartInEdge(80, SCREEN_WIDTH, false, options)).toBe(true);
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
describe('isHorizontalDrag', () => {
|
|
192
|
+
it('claims a drag once dx clears the threshold and dominates dy', () => {
|
|
193
|
+
expect(isHorizontalDrag(gestureState({ dx: 10, dy: 2 }))).toBe(true);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('does not claim a drag at the threshold boundary', () => {
|
|
197
|
+
expect(isHorizontalDrag(gestureState({ dx: 5, dy: 0 }))).toBe(false);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('claims a drag one unit past the threshold', () => {
|
|
201
|
+
expect(isHorizontalDrag(gestureState({ dx: 6, dy: 0 }))).toBe(true);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('does not claim a diagonal drag where the vertical component dominates', () => {
|
|
205
|
+
expect(isHorizontalDrag(gestureState({ dx: 10, dy: 20 }))).toBe(false);
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
describe('resolveSwipeIntent', () => {
|
|
210
|
+
it('left position: distance past the threshold opens a closed drawer', () => {
|
|
211
|
+
const intent = resolveSwipeIntent(gestureState({ dx: 100, vx: 0 }), false, {
|
|
212
|
+
drawerPosition: 'left',
|
|
213
|
+
});
|
|
214
|
+
expect(intent).toBe('open');
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
it('left position: distance past the threshold in reverse closes an open drawer', () => {
|
|
218
|
+
const intent = resolveSwipeIntent(gestureState({ dx: -100, vx: 0 }), true, {
|
|
219
|
+
drawerPosition: 'left',
|
|
220
|
+
});
|
|
221
|
+
expect(intent).toBe('close');
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('velocity past its threshold overrides a short reverse-direction drag', () => {
|
|
225
|
+
// dx alone (-10) is both too short and points the wrong way, but a fast flick (vx clears
|
|
226
|
+
// swipeMinVelocity) still opens - matches the source comment's "a fast flick can reverse a
|
|
227
|
+
// short drag".
|
|
228
|
+
const intent = resolveSwipeIntent(gestureState({ dx: -10, vx: 1 }), false, {
|
|
229
|
+
drawerPosition: 'left',
|
|
230
|
+
});
|
|
231
|
+
expect(intent).toBe('open');
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('neither threshold met snaps back to the current closed state', () => {
|
|
235
|
+
const intent = resolveSwipeIntent(gestureState({ dx: 10, vx: 0.1 }), false, {
|
|
236
|
+
drawerPosition: 'left',
|
|
237
|
+
});
|
|
238
|
+
expect(intent).toBe('close');
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
it('neither threshold met snaps back to the current open state', () => {
|
|
242
|
+
const intent = resolveSwipeIntent(gestureState({ dx: -10, vx: -0.1 }), true, {
|
|
243
|
+
drawerPosition: 'left',
|
|
244
|
+
});
|
|
245
|
+
expect(intent).toBe('open');
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
it('right position: the physical drag direction that opens is mirrored', () => {
|
|
249
|
+
const intent = resolveSwipeIntent(gestureState({ dx: -100, vx: 0 }), false, {
|
|
250
|
+
drawerPosition: 'right',
|
|
251
|
+
});
|
|
252
|
+
expect(intent).toBe('open');
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
it('right position: the physical drag direction that closes is mirrored', () => {
|
|
256
|
+
const intent = resolveSwipeIntent(gestureState({ dx: 100, vx: 0 }), true, {
|
|
257
|
+
drawerPosition: 'right',
|
|
258
|
+
});
|
|
259
|
+
expect(intent).toBe('close');
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('honors custom swipeMinDistance/swipeMinVelocity over the defaults', () => {
|
|
263
|
+
const options: IDrawerOptions = {
|
|
264
|
+
drawerPosition: 'left',
|
|
265
|
+
swipeMinDistance: 10,
|
|
266
|
+
swipeMinVelocity: 5,
|
|
267
|
+
};
|
|
268
|
+
expect(resolveSwipeIntent(gestureState({ dx: 15, vx: 0 }), false, options)).toBe('open');
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
describe('clamp01', () => {
|
|
273
|
+
it('passes a value already inside [0, 1] through unchanged', () => {
|
|
274
|
+
expect(clamp01(0.5)).toBe(0.5);
|
|
275
|
+
});
|
|
276
|
+
|
|
277
|
+
it('clamps below zero up to zero', () => {
|
|
278
|
+
expect(clamp01(-0.3)).toBe(0);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
it('clamps above one down to one', () => {
|
|
282
|
+
expect(clamp01(1.3)).toBe(1);
|
|
283
|
+
});
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
describe('startPageXOf', () => {
|
|
287
|
+
it('reads pageX directly off the event when present', () => {
|
|
288
|
+
expect(startPageXOf(fakeEvent({ pageX: 42 }))).toBe(42);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('falls back to touches[0].pageX when the event carries no direct pageX', () => {
|
|
292
|
+
expect(startPageXOf(fakeEvent({ touches: [{ pageX: 7 }] }))).toBe(7);
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
it('returns undefined when neither shape carries a usable number', () => {
|
|
296
|
+
expect(startPageXOf(fakeEvent({}))).toBeUndefined();
|
|
297
|
+
});
|
|
298
|
+
});
|
|
299
|
+
|
|
300
|
+
describe('resolveDragProgress', () => {
|
|
301
|
+
const WIDTH = DRAWER_DEFAULT_WIDTH;
|
|
302
|
+
|
|
303
|
+
it('left position: a rightward drag adds toward open', () => {
|
|
304
|
+
const progress = resolveDragProgress(gestureState({ dx: WIDTH / 2 }), 0, {
|
|
305
|
+
drawerPosition: 'left',
|
|
306
|
+
});
|
|
307
|
+
expect(progress).toBeCloseTo(0.5);
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
it('right position: the same rightward drag subtracts (mirrored sign)', () => {
|
|
311
|
+
const progress = resolveDragProgress(gestureState({ dx: WIDTH / 2 }), 1, {
|
|
312
|
+
drawerPosition: 'right',
|
|
313
|
+
});
|
|
314
|
+
expect(progress).toBeCloseTo(0.5);
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it('clamps the result to [0, 1] past either end', () => {
|
|
318
|
+
expect(
|
|
319
|
+
resolveDragProgress(gestureState({ dx: WIDTH * 2 }), 0, { drawerPosition: 'left' }),
|
|
320
|
+
).toBe(1);
|
|
321
|
+
expect(
|
|
322
|
+
resolveDragProgress(gestureState({ dx: -WIDTH * 2 }), 1, { drawerPosition: 'left' }),
|
|
323
|
+
).toBe(0);
|
|
324
|
+
});
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
describe('shouldClaimDrawerSwipe', () => {
|
|
328
|
+
const SCREEN_WIDTH = 375;
|
|
329
|
+
|
|
330
|
+
it('claims a start-phase edge swipe on a closed left drawer', () => {
|
|
331
|
+
const claimed = shouldClaimDrawerSwipe(
|
|
332
|
+
fakeEvent({ pageX: 20 }),
|
|
333
|
+
gestureState({}),
|
|
334
|
+
SCREEN_WIDTH,
|
|
335
|
+
false,
|
|
336
|
+
{ drawerPosition: 'left' },
|
|
337
|
+
'start',
|
|
338
|
+
);
|
|
339
|
+
expect(claimed).toBe(true);
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
it('rejects a start-phase swipe that begins outside the edge zone', () => {
|
|
343
|
+
const claimed = shouldClaimDrawerSwipe(
|
|
344
|
+
fakeEvent({ pageX: 200 }),
|
|
345
|
+
gestureState({}),
|
|
346
|
+
SCREEN_WIDTH,
|
|
347
|
+
false,
|
|
348
|
+
{ drawerPosition: 'left' },
|
|
349
|
+
'start',
|
|
350
|
+
);
|
|
351
|
+
expect(claimed).toBe(false);
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
it('rejects when swipeEnabled is false, regardless of edge/direction', () => {
|
|
355
|
+
const claimed = shouldClaimDrawerSwipe(
|
|
356
|
+
fakeEvent({ pageX: 20 }),
|
|
357
|
+
gestureState({}),
|
|
358
|
+
SCREEN_WIDTH,
|
|
359
|
+
false,
|
|
360
|
+
{ drawerPosition: 'left', swipeEnabled: false },
|
|
361
|
+
'start',
|
|
362
|
+
);
|
|
363
|
+
expect(claimed).toBe(false);
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('rejects a permanent drawer (never animated, never swipeable)', () => {
|
|
367
|
+
const claimed = shouldClaimDrawerSwipe(
|
|
368
|
+
fakeEvent({ pageX: 20 }),
|
|
369
|
+
gestureState({}),
|
|
370
|
+
SCREEN_WIDTH,
|
|
371
|
+
false,
|
|
372
|
+
{ drawerPosition: 'left', drawerType: 'permanent' },
|
|
373
|
+
'start',
|
|
374
|
+
);
|
|
375
|
+
expect(claimed).toBe(false);
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
it('move phase additionally requires a dominant horizontal drag', () => {
|
|
379
|
+
const verticalDrag = gestureState({ dx: 10, dy: 20 });
|
|
380
|
+
const claimed = shouldClaimDrawerSwipe(
|
|
381
|
+
fakeEvent({ pageX: 20 }),
|
|
382
|
+
verticalDrag,
|
|
383
|
+
SCREEN_WIDTH,
|
|
384
|
+
false,
|
|
385
|
+
{ drawerPosition: 'left' },
|
|
386
|
+
'move',
|
|
387
|
+
);
|
|
388
|
+
expect(claimed).toBe(false);
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
it('move phase claims once the drag is dominantly horizontal, from an edge start', () => {
|
|
392
|
+
const horizontalDrag = gestureState({ dx: 10, dy: 2 });
|
|
393
|
+
const claimed = shouldClaimDrawerSwipe(
|
|
394
|
+
fakeEvent({ pageX: 20 }),
|
|
395
|
+
horizontalDrag,
|
|
396
|
+
SCREEN_WIDTH,
|
|
397
|
+
false,
|
|
398
|
+
{ drawerPosition: 'left' },
|
|
399
|
+
'move',
|
|
400
|
+
);
|
|
401
|
+
expect(claimed).toBe(true);
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
it('an open drawer accepts a swipe-to-close start from anywhere, not just the edge', () => {
|
|
405
|
+
const claimed = shouldClaimDrawerSwipe(
|
|
406
|
+
fakeEvent({ pageX: 200 }),
|
|
407
|
+
gestureState({}),
|
|
408
|
+
SCREEN_WIDTH,
|
|
409
|
+
true,
|
|
410
|
+
{ drawerPosition: 'left' },
|
|
411
|
+
'start',
|
|
412
|
+
);
|
|
413
|
+
expect(claimed).toBe(true);
|
|
414
|
+
});
|
|
415
|
+
});
|