@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,69 @@
|
|
|
1
|
+
// useLinkingIntegration: wires the framework-agnostic linking config (../core's
|
|
2
|
+
// resolveRouteFromUrl) onto an existing Stack's INavigatorHandle. Deliberately NOT called from
|
|
3
|
+
// inside stack.ts - app code owns the wiring, the same top-level-prop shape @react-navigation
|
|
4
|
+
// keeps `linking` in on NavigationContainer rather than baking it into the router itself.
|
|
5
|
+
//
|
|
6
|
+
// Vue-shape difference from React: React's twin takes the RESOLVED `navigatorHandle:
|
|
7
|
+
// INavigatorHandle` directly, because a React hook is called fresh on EVERY render with the
|
|
8
|
+
// caller's current value, and useImperativeHandle's ref assignment (a layout effect) is
|
|
9
|
+
// guaranteed to run before this hook's OWN mount effect, so `handleRef.current` is already
|
|
10
|
+
// populated by the time it's read. Vue's setup() runs exactly ONCE per component instance, so
|
|
11
|
+
// there is no "fresh call every render" to re-supply a resolved value, and a template/h() `ref`
|
|
12
|
+
// only resolves to Stack's expose()d handle AFTER mount - an eagerly-resolved argument evaluated
|
|
13
|
+
// at composable-call time (during setup, before mount) would be null. This composable therefore
|
|
14
|
+
// takes the Stack's `Ref<INavigatorHandle | null>` itself (the ref object, not its resolved
|
|
15
|
+
// value) and reads `.value` lazily inside onMounted - Vue's own onMounted hooks fire bottom-up
|
|
16
|
+
// (children before parents), giving the same "already populated" guarantee React's layout-effect
|
|
17
|
+
// ordering does.
|
|
18
|
+
|
|
19
|
+
import { onMounted, onUnmounted } from '@vue/runtime-core';
|
|
20
|
+
import type { Ref } from '@vue/runtime-core';
|
|
21
|
+
import { Linking, dlog } from '@symbiote-native/engine';
|
|
22
|
+
import type { IEventSubscription, IUrlEvent } from '@symbiote-native/engine';
|
|
23
|
+
import { resolveRouteFromUrl } from '../core';
|
|
24
|
+
import type { ILinkingConfig, INavigatorHandle } from '../core';
|
|
25
|
+
|
|
26
|
+
export function useLinkingIntegration(
|
|
27
|
+
config: ILinkingConfig,
|
|
28
|
+
navigatorHandle: Ref<INavigatorHandle | null>,
|
|
29
|
+
): void {
|
|
30
|
+
let cancelled = false;
|
|
31
|
+
let subscription: IEventSubscription | undefined;
|
|
32
|
+
|
|
33
|
+
function applyRoute(url: string, dispatch: (name: string, params?: unknown) => void): void {
|
|
34
|
+
const route = resolveRouteFromUrl(config, url);
|
|
35
|
+
if (route === null) {
|
|
36
|
+
dlog(`useLinkingIntegration: no route resolved for "${url}"`);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
dispatch(route.name, route.params);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
onMounted(() => {
|
|
43
|
+
const handle = navigatorHandle.value;
|
|
44
|
+
if (handle === null) {
|
|
45
|
+
dlog('useLinkingIntegration: navigatorHandle is not yet available at mount time');
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
Linking.getInitialURL()
|
|
50
|
+
.then(url => {
|
|
51
|
+
if (cancelled || url === null) return;
|
|
52
|
+
dlog(`useLinkingIntegration: initial URL "${url}"`);
|
|
53
|
+
applyRoute(url, handle.replace);
|
|
54
|
+
})
|
|
55
|
+
.catch((error: unknown) => {
|
|
56
|
+
dlog(`useLinkingIntegration: getInitialURL failed: ${String(error)}`);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
subscription = Linking.addEventListener('url', (event: IUrlEvent) => {
|
|
60
|
+
dlog(`useLinkingIntegration: url event "${event.url}"`);
|
|
61
|
+
applyRoute(event.url, handle.push);
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
onUnmounted(() => {
|
|
66
|
+
cancelled = true;
|
|
67
|
+
subscription?.remove();
|
|
68
|
+
});
|
|
69
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// The lifecycle half of the framework-agnostic emitter (../core/navigation-events): Vue has no
|
|
2
|
+
// "Context" concept the way React does. The equivalent here is a plain provide/inject
|
|
3
|
+
// getter/setter pair over one shared InjectionKey (mirrors this codebase's own pd-widgets
|
|
4
|
+
// convention: `provideX(value)` writes, `injectX()` reads and throws if nothing was provided), so
|
|
5
|
+
// a screen's subtree can read its own route, navigator handle, and per-route emitter without
|
|
6
|
+
// prop-drilling - the Vue twin of react/navigation-context.ts's React Context, collapsed into one
|
|
7
|
+
// key the same way (a symbiote screen only ever needs its OWN route, no per-navigator
|
|
8
|
+
// param-list generics in v1 scope, see screen.ts).
|
|
9
|
+
//
|
|
10
|
+
// Vue's provide() must run once, synchronously, inside a component's OWN setup(). Unlike React,
|
|
11
|
+
// which re-creates a fresh `<Context.Provider value={...}>` element (and therefore a fresh value)
|
|
12
|
+
// on every render loop iteration, Vue's provide/inject is scoped to the component INSTANCE, not to
|
|
13
|
+
// a render-time position. Stack/Tab/Drawer keep every mounted route's screen alive as a SEPARATE
|
|
14
|
+
// sibling subtree (Stack keeps every pushed route mounted; see stack.ts), and each one needs its
|
|
15
|
+
// OWN distinct provided value (its own route/emitter) invisible to its siblings - that is an
|
|
16
|
+
// inherent property of any hierarchical dependency-injection scheme, provide/inject included, not
|
|
17
|
+
// a React artifact. NavigationScope is the small setup-boundary component that gives each route
|
|
18
|
+
// subtree its own instance to call provideNavigationScope from: stack.ts/tabs.ts/drawer.ts's
|
|
19
|
+
// render loop mounts ONE NavigationScope per route (keyed by route.key, exactly like React's
|
|
20
|
+
// per-route `<NavigationContext.Provider>`), and that instance's setup() calls the setter ONCE,
|
|
21
|
+
// refreshed from the latest `value` prop on every one of ITS OWN re-renders - consumers read
|
|
22
|
+
// `.value` off the injected ref, so a later change (e.g. setParams producing a new route object
|
|
23
|
+
// for the same key) still reaches them reactively.
|
|
24
|
+
//
|
|
25
|
+
// `parent` threads the ambient value a navigator read on ITS OWN mount (undefined at the root)
|
|
26
|
+
// into the value it provides to its own screens, forming a linked list - this is what lets a
|
|
27
|
+
// screen nested inside e.g. a Stack-screen-renders-a-Tab composition reach the enclosing Stack via
|
|
28
|
+
// useNavigation().getParent().
|
|
29
|
+
|
|
30
|
+
import { defineComponent, inject, provide, shallowRef } from '@vue/runtime-core';
|
|
31
|
+
import type { InjectionKey, ShallowRef } from '@vue/runtime-core';
|
|
32
|
+
import type { INavigationEmitter, IRoute, IAnyNavigatorHandle } from '../core';
|
|
33
|
+
export type { IAnyNavigatorHandle };
|
|
34
|
+
|
|
35
|
+
export type INavigationScopeValue = {
|
|
36
|
+
route: IRoute<unknown>;
|
|
37
|
+
navigation: IAnyNavigatorHandle;
|
|
38
|
+
emitter: INavigationEmitter;
|
|
39
|
+
parent?: INavigationScopeValue;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const NAVIGATION_SCOPE_KEY: InjectionKey<ShallowRef<INavigationScopeValue>> =
|
|
43
|
+
Symbol('navigation-scope');
|
|
44
|
+
|
|
45
|
+
// The setter half of the pair - writes the CURRENT route's scope onto the shared key. Called only
|
|
46
|
+
// from NavigationScope's own setup below (never directly by app code).
|
|
47
|
+
function provideNavigationScope(value: ShallowRef<INavigationScopeValue>): void {
|
|
48
|
+
provide(NAVIGATION_SCOPE_KEY, value);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// The getter half of the pair - every composable in ./composables and every navigator
|
|
52
|
+
// (stack.ts/tabs.ts/drawer.ts, reading the AMBIENT/parent scope on their own mount) calls this
|
|
53
|
+
// directly; undefined simply means "no ancestor NavigationScope", which is a legitimate state (the
|
|
54
|
+
// nesting root) rather than an error - callers that require one throw their own message.
|
|
55
|
+
export function injectNavigationScope(): ShallowRef<INavigationScopeValue> | undefined {
|
|
56
|
+
return inject(NAVIGATION_SCOPE_KEY, undefined);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// The "throw if missing" half every composable in ./composables needs (useNavigation, useRoute,
|
|
60
|
+
// useIsFocused, useFocusEffect, useNavigationState) - they all called injectNavigationScope() and
|
|
61
|
+
// threw the same shaped error, differing only in which hook name the message names. Centralized
|
|
62
|
+
// here so a wording change lands once instead of five times.
|
|
63
|
+
export function requireNavigationScope(hookName: string): ShallowRef<INavigationScopeValue> {
|
|
64
|
+
const scope = injectNavigationScope();
|
|
65
|
+
if (scope === undefined) {
|
|
66
|
+
throw new Error(
|
|
67
|
+
`${hookName} must be used within a screen rendered by <Stack>, <Tab>, or <Drawer>`,
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
return scope;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// The setup-boundary component described above. `props: ['value']` is a REQUIRED runtime
|
|
74
|
+
// declaration here, not stylistic - without it Vue would route the incoming `value` into `attrs`
|
|
75
|
+
// instead of a tracked reactive `props` field, and the render closure's refresh below would
|
|
76
|
+
// silently keep re-reading a stale initial snapshot.
|
|
77
|
+
export const NavigationScope = defineComponent<{ value: INavigationScopeValue }>(
|
|
78
|
+
(props, { slots }) => {
|
|
79
|
+
const current = shallowRef(props.value);
|
|
80
|
+
provideNavigationScope(current);
|
|
81
|
+
return () => {
|
|
82
|
+
current.value = props.value;
|
|
83
|
+
return slots.default?.() ?? null;
|
|
84
|
+
};
|
|
85
|
+
},
|
|
86
|
+
{ name: 'NavigationScope', props: ['value'] },
|
|
87
|
+
);
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
// Co-located Vue-driven test, the Vue twin of react/nested-navigation.test.tsx. Proves the
|
|
2
|
+
// scope "parent" chain: a navigator reads the ambient scope BEFORE establishing its own, so when
|
|
3
|
+
// one navigator's screen renders ANOTHER navigator (here, a Stack screen renders a Tab), a screen
|
|
4
|
+
// deep inside the nested Tab can call useNavigation().getParent() to reach the enclosing Stack's
|
|
5
|
+
// handle. Mirrors stack.test.ts's fixture (an injected codegen-shaped RNSScreen ViewConfig) since
|
|
6
|
+
// a real Stack is part of this composition; Tab needs no ViewConfig of its own (tabs.test.ts).
|
|
7
|
+
|
|
8
|
+
import { defineComponent, h, ref } from '@vue/runtime-core';
|
|
9
|
+
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
|
|
10
|
+
import { mount, unmount, setNativeViewConfigSource } from '@symbiote-native/vue';
|
|
11
|
+
import type { INativeViewConfig } from '@symbiote-native/engine';
|
|
12
|
+
import { installFabric, type IFakeNode } from '@symbiote-native/test-utils';
|
|
13
|
+
import { Stack } from './stack';
|
|
14
|
+
import type { INavigatorHandle } from './stack';
|
|
15
|
+
import { Tab } from './tabs';
|
|
16
|
+
import { useNavigation } from './composables';
|
|
17
|
+
import type { IAnyNavigatorHandle } from './navigation-context';
|
|
18
|
+
|
|
19
|
+
const ROOT_TAG = 4768;
|
|
20
|
+
const SCREEN_VIEW = 'RNSScreen';
|
|
21
|
+
const STACK_VIEW = 'RNSScreenStack';
|
|
22
|
+
const HEADER_CONFIG_VIEW = 'RNSScreenStackHeaderConfig';
|
|
23
|
+
|
|
24
|
+
function directEvent(registrationName: string) {
|
|
25
|
+
return { registrationName };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const VIEW_CONFIGS: Record<string, INativeViewConfig> = {
|
|
29
|
+
[SCREEN_VIEW]: {
|
|
30
|
+
directEventTypes: {
|
|
31
|
+
topAppear: directEvent('onAppear'),
|
|
32
|
+
topDisappear: directEvent('onDisappear'),
|
|
33
|
+
topWillAppear: directEvent('onWillAppear'),
|
|
34
|
+
topWillDisappear: directEvent('onWillDisappear'),
|
|
35
|
+
topDismissed: directEvent('onDismissed'),
|
|
36
|
+
topHeaderBackButtonClicked: directEvent('onHeaderBackButtonClicked'),
|
|
37
|
+
},
|
|
38
|
+
validAttributes: {
|
|
39
|
+
screenId: true,
|
|
40
|
+
activityState: true,
|
|
41
|
+
gestureEnabled: true,
|
|
42
|
+
stackAnimation: true,
|
|
43
|
+
stackPresentation: true,
|
|
44
|
+
transitionDuration: true,
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
[STACK_VIEW]: {
|
|
48
|
+
directEventTypes: { topFinishTransitioning: directEvent('onFinishTransitioning') },
|
|
49
|
+
validAttributes: {},
|
|
50
|
+
},
|
|
51
|
+
[HEADER_CONFIG_VIEW]: {
|
|
52
|
+
directEventTypes: { topPressHeaderBarButtonItem: directEvent('onPressHeaderBarButtonItem') },
|
|
53
|
+
validAttributes: { title: true, hidden: true, backTitle: true, backTitleVisible: true },
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const fabric = installFabric();
|
|
58
|
+
setNativeViewConfigSource(name => VIEW_CONFIGS[name]);
|
|
59
|
+
const tick = (): Promise<void> => new Promise(resolve => setTimeout(resolve, 0));
|
|
60
|
+
|
|
61
|
+
beforeEach(() => fabric.reset());
|
|
62
|
+
afterEach(() => unmount(ROOT_TAG));
|
|
63
|
+
|
|
64
|
+
function findAllText(nodes: readonly IFakeNode[]): string[] {
|
|
65
|
+
const found: string[] = [];
|
|
66
|
+
const collect = (list: readonly IFakeNode[]): void => {
|
|
67
|
+
for (const node of list) {
|
|
68
|
+
if (node.viewName === 'RCTRawText' && typeof node.props.text === 'string') {
|
|
69
|
+
found.push(node.props.text);
|
|
70
|
+
}
|
|
71
|
+
collect(node.children);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
collect(nodes);
|
|
75
|
+
return found;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function StackDetailsScreen() {
|
|
79
|
+
return h('symbiote-text', {}, 'stack-details');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
describe('nested navigators (scope parent chain)', () => {
|
|
83
|
+
it("a root Stack screen's useNavigation().getParent() is undefined (no ambient navigator above it)", async () => {
|
|
84
|
+
let capturedParent: IAnyNavigatorHandle | undefined;
|
|
85
|
+
let getParentCalled = false;
|
|
86
|
+
// Plain functions used as `component:` are stateless functional components - Vue calls them
|
|
87
|
+
// fresh on every render and treats their return value as vnodes directly, NOT as a "setup
|
|
88
|
+
// returns a render fn" component. A screen calling a composable needs a real setup-based
|
|
89
|
+
// component, hence defineComponent here instead of a bare function.
|
|
90
|
+
const RootScreen = defineComponent(() => {
|
|
91
|
+
const navigation = useNavigation();
|
|
92
|
+
capturedParent = navigation.value.getParent();
|
|
93
|
+
getParentCalled = true;
|
|
94
|
+
return () => h('symbiote-text', {}, 'root');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
mount(
|
|
98
|
+
ROOT_TAG,
|
|
99
|
+
defineComponent({
|
|
100
|
+
setup: () => () =>
|
|
101
|
+
h(Stack, { initialRouteName: 'Root' }, () => [
|
|
102
|
+
h(Stack.Screen, { name: 'Root', component: RootScreen }),
|
|
103
|
+
]),
|
|
104
|
+
}),
|
|
105
|
+
);
|
|
106
|
+
await tick();
|
|
107
|
+
|
|
108
|
+
expect(getParentCalled).toBe(true);
|
|
109
|
+
expect(capturedParent).toBeUndefined();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it('useNavigation().getParent() from inside a Tab screen nested in a Stack screen reaches the enclosing Stack, and pushing through it adds a Stack route', async () => {
|
|
113
|
+
let capturedParent: IAnyNavigatorHandle | undefined;
|
|
114
|
+
|
|
115
|
+
const NestedTabHomeScreen = defineComponent(() => {
|
|
116
|
+
const navigation = useNavigation();
|
|
117
|
+
capturedParent = navigation.value.getParent();
|
|
118
|
+
return () => h('symbiote-text', {}, 'tab-home');
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
// The Stack screen's own component: a Tab navigator, nested exactly the way a real app
|
|
122
|
+
// composes navigators (a Stack screen's content IS another navigator). No composable of its
|
|
123
|
+
// own, so a plain function (returning vnodes directly) is fine here.
|
|
124
|
+
function RootScreenRendersTab() {
|
|
125
|
+
return h(Tab, { initialRouteName: 'TabHome' }, () => [
|
|
126
|
+
h(Tab.Screen, { name: 'TabHome', component: NestedTabHomeScreen }),
|
|
127
|
+
]);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const handleRef = ref<INavigatorHandle | null>(null);
|
|
131
|
+
mount(
|
|
132
|
+
ROOT_TAG,
|
|
133
|
+
defineComponent({
|
|
134
|
+
setup: () => () =>
|
|
135
|
+
h(Stack, { ref: handleRef, initialRouteName: 'Root' }, () => [
|
|
136
|
+
h(Stack.Screen, { name: 'Root', component: RootScreenRendersTab }),
|
|
137
|
+
h(Stack.Screen, { name: 'Details', component: StackDetailsScreen }),
|
|
138
|
+
]),
|
|
139
|
+
}),
|
|
140
|
+
);
|
|
141
|
+
await tick();
|
|
142
|
+
|
|
143
|
+
expect(findAllText(fabric.committed)).toContain('tab-home');
|
|
144
|
+
|
|
145
|
+
if (!capturedParent) throw new Error('getParent() returned undefined');
|
|
146
|
+
if (!('push' in capturedParent)) {
|
|
147
|
+
throw new Error('parent handle is not a Stack handle (missing push)');
|
|
148
|
+
}
|
|
149
|
+
capturedParent.push('Details');
|
|
150
|
+
await tick();
|
|
151
|
+
|
|
152
|
+
expect(findAllText(fabric.committed)).toContain('stack-details');
|
|
153
|
+
expect(handleRef.value?.canGoBack()).toBe(true);
|
|
154
|
+
});
|
|
155
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Stack.Screen: a declarative marker, never rendered on its own - Stack reads its props via a
|
|
2
|
+
// default-slot scan (see stack.ts's collectRegistry) to build the static name -> {component,
|
|
3
|
+
// options} registry, then mounts the registered component itself for each pushed route. The Vue
|
|
4
|
+
// twin of react/screen.ts's Screen, using the slot-scanning pattern real Vue component libraries
|
|
5
|
+
// use for this exact declarative-marker-child shape (Element Plus's `<el-collapse-item>`, Ant
|
|
6
|
+
// Design Vue's `<a-menu-item>`): the parent inspects `vnode.type === Screen` and reads
|
|
7
|
+
// `vnode.props` directly, so Screen's own setup() never actually runs.
|
|
8
|
+
|
|
9
|
+
import { defineComponent } from '@vue/runtime-core';
|
|
10
|
+
import type { Component, Ref } from '@vue/runtime-core';
|
|
11
|
+
import type { IRoute } from '../core';
|
|
12
|
+
import type {
|
|
13
|
+
ISearchBarCommands,
|
|
14
|
+
ISearchBarOptions,
|
|
15
|
+
IScreenOptions,
|
|
16
|
+
INavigatorHandle,
|
|
17
|
+
} from '../core';
|
|
18
|
+
|
|
19
|
+
// The imperative ref (focus/blur/clearText/setText/cancelSearch/toggleCancelButton) carries a Vue
|
|
20
|
+
// ref type, so per CLAUDE.md's <prop_types_split_agnostic_vs_per_adapter> it cannot live in
|
|
21
|
+
// the shared, agnostic ISearchBarOptions (core/navigator-props.ts). This adapter-only overlay adds
|
|
22
|
+
// it on top of the agnostic field base, the Vue twin of react/screen.ts's IReactSearchBarOptions
|
|
23
|
+
// (a plain `Ref<T | null>` here instead of React's `RefObject<T | null>`).
|
|
24
|
+
export type IVueSearchBarOptions = ISearchBarOptions & {
|
|
25
|
+
ref?: Ref<ISearchBarCommands | null>;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type IVueScreenOptions = Omit<IScreenOptions, 'headerSearchBarOptions'> & {
|
|
29
|
+
headerSearchBarOptions?: IVueSearchBarOptions;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// The options resolver runs OUTSIDE render (during the options fold), so it still receives the
|
|
33
|
+
// route + navigator handle explicitly - screens read those through composables, but a resolver has
|
|
34
|
+
// no component scope to inject from.
|
|
35
|
+
export type IScreenOptionsArgs = {
|
|
36
|
+
route: IRoute<unknown>;
|
|
37
|
+
navigation: INavigatorHandle;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type IScreenOptionsResolver = (args: IScreenOptionsArgs) => IVueScreenOptions;
|
|
41
|
+
|
|
42
|
+
export type IScreenProps = {
|
|
43
|
+
name: string;
|
|
44
|
+
component: Component;
|
|
45
|
+
options?: IVueScreenOptions | IScreenOptionsResolver;
|
|
46
|
+
initialParams?: unknown;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const Screen = defineComponent<IScreenProps>(() => () => null, {
|
|
50
|
+
name: 'Screen',
|
|
51
|
+
inheritAttrs: false,
|
|
52
|
+
});
|