@ng-native/router 0.0.1 → 0.1.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.
Files changed (75) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +74 -1
  3. package/dist/bind-route-inputs.d.ts +20 -0
  4. package/dist/bind-route-inputs.js +52 -0
  5. package/dist/bind-route-inputs.js.map +1 -0
  6. package/dist/full-window-overlay.d.ts +16 -0
  7. package/dist/full-window-overlay.js +52 -0
  8. package/dist/full-window-overlay.js.map +1 -0
  9. package/dist/index.d.ts +26 -0
  10. package/dist/index.js +27 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/native-back.d.ts +38 -0
  13. package/dist/native-back.js +88 -0
  14. package/dist/native-back.js.map +1 -0
  15. package/dist/native-bar-defaults.d.ts +50 -0
  16. package/dist/native-bar-defaults.js +17 -0
  17. package/dist/native-bar-defaults.js.map +1 -0
  18. package/dist/native-header-item.d.ts +12 -0
  19. package/dist/native-header-item.js +40 -0
  20. package/dist/native-header-item.js.map +1 -0
  21. package/dist/native-header-palette.d.ts +45 -0
  22. package/dist/native-header-palette.js +42 -0
  23. package/dist/native-header-palette.js.map +1 -0
  24. package/dist/native-header.d.ts +103 -0
  25. package/dist/native-header.js +204 -0
  26. package/dist/native-header.js.map +1 -0
  27. package/dist/native-links.d.ts +30 -0
  28. package/dist/native-links.js +40 -0
  29. package/dist/native-links.js.map +1 -0
  30. package/dist/native-navigation.d.ts +84 -0
  31. package/dist/native-navigation.js +153 -0
  32. package/dist/native-navigation.js.map +1 -0
  33. package/dist/native-platform-location.d.ts +62 -0
  34. package/dist/native-platform-location.js +110 -0
  35. package/dist/native-platform-location.js.map +1 -0
  36. package/dist/native-router-link.d.ts +14 -0
  37. package/dist/native-router-link.js +51 -0
  38. package/dist/native-router-link.js.map +1 -0
  39. package/dist/native-search-bar.d.ts +44 -0
  40. package/dist/native-search-bar.js +132 -0
  41. package/dist/native-search-bar.js.map +1 -0
  42. package/dist/native-stack-outlet.d.ts +195 -0
  43. package/dist/native-stack-outlet.js +564 -0
  44. package/dist/native-stack-outlet.js.map +1 -0
  45. package/dist/native-stack-reuse-strategy.d.ts +57 -0
  46. package/dist/native-stack-reuse-strategy.js +126 -0
  47. package/dist/native-stack-reuse-strategy.js.map +1 -0
  48. package/dist/native-tab.d.ts +147 -0
  49. package/dist/native-tab.js +209 -0
  50. package/dist/native-tab.js.map +1 -0
  51. package/dist/native-tabs-outlet.d.ts +138 -0
  52. package/dist/native-tabs-outlet.js +408 -0
  53. package/dist/native-tabs-outlet.js.map +1 -0
  54. package/dist/own-host.d.ts +6 -0
  55. package/dist/own-host.js +28 -0
  56. package/dist/own-host.js.map +1 -0
  57. package/dist/provide-native-router.d.ts +41 -0
  58. package/dist/provide-native-router.js +151 -0
  59. package/dist/provide-native-router.js.map +1 -0
  60. package/dist/screen-presentation.d.ts +69 -0
  61. package/dist/screen-presentation.js +10 -0
  62. package/dist/screen-presentation.js.map +1 -0
  63. package/dist/screens.d.ts +37 -0
  64. package/dist/screens.js +108 -0
  65. package/dist/screens.js.map +1 -0
  66. package/dist/tab-routes.d.ts +16 -0
  67. package/dist/tab-routes.js +24 -0
  68. package/dist/tab-routes.js.map +1 -0
  69. package/dist/tab-safe-area-view.d.ts +15 -0
  70. package/dist/tab-safe-area-view.js +63 -0
  71. package/dist/tab-safe-area-view.js.map +1 -0
  72. package/dist/transforms.d.ts +2 -0
  73. package/dist/transforms.js +13 -0
  74. package/dist/transforms.js.map +1 -0
  75. package/package.json +59 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-stack-outlet.js","sourceRoot":"","sources":["../src/native-stack-outlet.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACL,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,UAAU,EACV,UAAU,EACV,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,eAAe,EACf,MAAM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AAE,IAAI,CAAC,QAAQ;YACrB,SAAS,EAAE;gBACT,EAAE,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,IAAI,OAAO,EAAE,CAAC,EAAE;gBAC5E,EAAE,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,KAAK,EAAE;gBAC5C;oBACE,OAAO,EAAE,sBAAsB;oBAC/B,QAAQ,EAAE,IAAI,CAAC,cAAc,CAAC,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ;iBACrE;aACF;SACF,CAAC,CAAC;IACL,CAAC;uGA/hBU,iBAAiB;2FAAjB,iBAAiB,0HAJlB,EAAE;;2FAID,iBAAiB;kBAN7B,SAAS;mBAAC;oBACT,QAAQ,EAAE,qBAAqB;oBAC/B,QAAQ,EAAE,EAAE;oBACZ,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE;iBAC5B","sourcesContent":["/**\n * A `RouterOutlet` that renders a native stack instead of swapping one view for another.\n *\n * The outlet's host element *is* the `RNSScreenStack`, and each activated route's component is\n * created directly on its own `screen` child rather than on a wrapper view inside it (ADR 0004).\n * The screens below the top stay mounted, which is what keeps a pushed-away screen's native\n * state alive: its scroll offset, its text cursor, its keyboard focus.\n *\n * Push and pop are inferred from the calls the router already makes. With a reuse strategy that\n * detaches, navigating forward is `detach()` then `activateWith()`, and navigating back is\n * `detach()` then `attach(ref)` with a ref we handed out earlier. Finding that ref in our own\n * stack is what identifies a pop, so nothing here needs to consult the URL.\n *\n * Note `activityState` is set once, to active, and never lowered. `Screen.tsx` throws on any\n * decrease while `isNativeStack`, because a native stack decides what is visible from the order\n * of its children rather than from a per-screen flag. Toggling that flag is for `ScreenContainer`\n * (tabs), where every screen is mounted at once.\n */\nimport {\n ApplicationRef,\n ChangeDetectionStrategy,\n Component,\n DestroyRef,\n ElementRef,\n ErrorHandler,\n HostAttributeToken,\n Injector,\n Renderer2,\n computed,\n createComponent,\n inject,\n signal,\n type ComponentRef,\n type EnvironmentInjector,\n type Type,\n type WritableSignal,\n} from '@angular/core';\nimport {\n ActivatedRoute,\n ChildrenOutletContexts,\n NavigationCancel,\n NavigationEnd,\n NavigationError,\n PRIMARY_OUTLET,\n Router,\n createUrlTreeFromSnapshot,\n type Data,\n type RouterOutletContract,\n} from '@angular/router';\nimport { Location, PlatformLocation } from '@angular/common';\nimport { SCREEN_IN_FRONT } from '@ng-native/device';\nimport { bindRouteInputs } from './bind-route-inputs.ts';\nimport { NativeBack, isShowing } from './native-back.ts';\nimport { intentOf, type NativeIntent } from './native-navigation.ts';\nimport { NativePlatformLocation } from './native-platform-location.ts';\nimport { markScreenRoute } from './tab-routes.ts';\nimport { ownHost } from './own-host.ts';\nimport type { ScreenPresentation } from './screen-presentation.ts';\nimport { ActivityState } from './screens.ts';\n\ninterface StackEntry {\n route: ActivatedRoute;\n ref: ComponentRef<unknown>;\n /** The `screen` element this entry's component lives inside. */\n screen: unknown;\n /** True while the router is holding this ref for a later `attach`. */\n detached: boolean;\n /** Stops feeding route params into the component's inputs. */\n unbind: () => void;\n /** How the screen was put on screen, for a push from it to follow. */\n presentation?: ScreenPresentation;\n /** The navigation that put this screen on the stack, until that navigation ends. */\n activatedIn?: number;\n /** The navigation that covered this screen, until that navigation ends. */\n detachedIn?: number;\n /** Whether this screen is the one in front, for what it holds: see `SCREEN_IN_FRONT`. */\n inFront: WritableSignal<boolean>;\n}\n\n/**\n * The last navigation, per router, whose presentation an outlet has already given a screen.\n *\n * Presenting a route that is a stack of its own activates two outlets in one navigation: the one\n * the route is presented in, and the one inside it that shows the route's first child. Only the\n * first is presented; the second is the first screen of a stack inside a presented screen, and a\n * push inside that stack must see it as a pushed screen, not one to present over.\n */\nconst presented = new WeakMap<object, number>();\n\n/** What every screen needs to fill the stack, the same five keys RNSScreen itself expects. */\nconst FILL = { position: 'absolute', left: 0, right: 0, top: 0, bottom: 0 } as const;\n\n@Component({\n selector: 'native-stack-outlet',\n template: '',\n changeDetection: ChangeDetectionStrategy.OnPush,\n host: { '[style]': 'fill' },\n})\nexport class NativeStackOutlet implements RouterOutletContract {\n /**\n * Named outlets work exactly as on the web: `<native-stack-outlet name=\"list\" />` is filled by\n * routes with `outlet: 'list'`. The default is the primary one. Read once, as the router's own\n * outlet reads it, since an outlet cannot change which contexts it is registered under.\n */\n readonly name = inject(new HostAttributeToken('name'), { optional: true }) ?? PRIMARY_OUTLET;\n\n readonly supportsBindingToComponentInputs = true;\n\n private readonly parentContexts = inject(ChildrenOutletContexts);\n private readonly renderer = inject(Renderer2);\n private readonly applicationRef = inject(ApplicationRef);\n private readonly injector = inject(Injector);\n private readonly host = inject(ElementRef);\n private readonly location = inject(Location);\n private readonly history = inject(PlatformLocation);\n /**\n * Only for the intent a navigation carries. Optional so the outlet can be exercised through\n * `RouterOutletContract` directly, which is how its own tests drive it.\n */\n private readonly router = inject(Router, { optional: true });\n\n private readonly errors = inject(ErrorHandler);\n\n private readonly entries: StackEntry[] = [];\n /**\n * The screens a replace or a reset supersedes, kept until the navigation that supersedes them\n * succeeds: one that fails leaves the stack as it was.\n */\n private superseded: { entries: StackEntry[]; navigation: number } | null = null;\n\n protected readonly fill = { flex: 1 };\n\n constructor() {\n ownHost(this.host.nativeElement);\n // Ours, not a prop of the native stack.\n delete (this.host.nativeElement as { props: Record<string, unknown> }).props['name'];\n this.parentContexts.onChildOutletCreated(this.name, this);\n\n // Android's back button, and `NativeNavigation.back()`. Declining at the bottom of the stack\n // is deliberate: the outlet this one sits in gets its turn, and when none takes it the\n // platform backgrounds the app, which is what a user expects, rather than the app swallowing\n // the press and appearing stuck.\n //\n // Not yet verified on a device: whether react-native-screens' own Android back handling\n // (`nativeBackButtonDismissalEnabled`) also pops the screen, which would make one press pop\n // twice. If a back press ever skips a screen on Android, look here first.\n const back = inject(NativeBack);\n const unsubscribeBack = back.handle(() => this.goBack());\n const unsubscribeStack = back.addStack({\n showing: () => this.isShowing(),\n popToRoot: () => (this.entries.length > 1 ? this.popToEntry(0) : null),\n popTo: (url) => {\n const index = this.entries.findIndex((entry) => this.urlOf(entry) === url);\n return index !== -1 && index < this.entries.length - 1 ? this.popToEntry(index) : null;\n },\n });\n // Optional for the same reason as the router: the outlet's own tests stand one in without it.\n const navigations = this.router?.events?.subscribe((event) => {\n if (event instanceof NavigationEnd) this.settle(event.id);\n else if (event instanceof NavigationError) this.rollBack(event.id);\n });\n\n inject(DestroyRef).onDestroy(() => {\n unsubscribeBack();\n unsubscribeStack();\n navigations?.unsubscribe();\n for (const entry of this.entries) {\n entry.unbind();\n entry.ref.destroy();\n }\n this.entries.length = 0;\n this.parentContexts.onChildOutletDestroyed(this.name);\n });\n }\n\n /** The screens currently in the stack, oldest first. Exposed for tests. */\n get depth(): number {\n return this.entries.length;\n }\n\n // --- RouterOutletContract ----------------------------------------------\n\n get isActivated(): boolean {\n return this.top !== undefined && !this.top.detached;\n }\n\n get component(): Object | null {\n return this.top && !this.top.detached ? (this.top.ref.instance as Object) : null;\n }\n\n get activatedRoute(): ActivatedRoute | null {\n return this.top && !this.top.detached ? this.top.route : null;\n }\n\n get activatedRouteData(): Data {\n return this.activatedRoute?.snapshot.data ?? {};\n }\n\n /** The input binder reads this to bind route params to component inputs. */\n get activatedComponentRef(): ComponentRef<unknown> | null {\n return this.top?.ref ?? null;\n }\n\n activateWith(route: ActivatedRoute, environmentInjector: EnvironmentInjector): void {\n const component = (route.component ?? route.snapshot.component) as Type<unknown> | null;\n if (!component) {\n throw new Error('[angular-native] route has no component to activate');\n }\n // Whatever a stack shows is a screen, children or not, and must survive being covered.\n if (route.snapshot.routeConfig) markScreenRoute(route.snapshot.routeConfig);\n\n // What kind of navigation this is, over and above which route it lands on: a replace\n // supersedes the screen below rather than stacking on it, and a reset empties the stack.\n // Everything else leaves the screens below mounted, so their native state survives the trip.\n const intent = this.currentIntent();\n const navigation = this.navigationId();\n const presentation = this.presentationFor(intent);\n //\n // The screen is the page's host element, so its props are set before the component exists\n // and the component's own host bindings land on top of them. Style bindings merge key by\n // key, so a page styling itself keeps the absolute fill the stack lays out with - except for\n // `position` and the four insets, which a page naming them writes over outright rather than\n // merging into. Those five are re-asserted below, after the page's own change detection has\n // run, so the outlet's positioning always wins whatever a page's host style says.\n const screen = this.createScreen(presentation);\n const inFront = signal(true);\n const { ref, unbind } = this.createPage(component, route, environmentInjector, screen, inFront);\n // The page's own host style, including any `position` or inset it declared, has now landed\n // on the screen: put the stack's fill back over it. Per-key, through `setStyle`, so whatever\n // else the page's style set - a background colour, say - still merges and stays.\n this.fillScreen(screen);\n\n if (intent?.stack === 'reset') this.supersede(this.entries.slice(), navigation);\n else if (intent?.stack === 'replace' && this.top) this.supersede([this.top], navigation);\n this.entries.push({\n route,\n ref,\n screen,\n detached: false,\n unbind,\n presentation,\n activatedIn: navigation,\n inFront,\n });\n }\n\n /**\n * The page's component, created on its screen and rendered once.\n *\n * A page that throws on that first render fails the navigation, and nothing of it may stay: a\n * half-made screen left on the stack is one the router does not know about, with a component\n * still running on it. So its component is destroyed, its screen taken off the stack, the\n * screen it was pushed from given back its change detection, and the error handed to the\n * app's `ErrorHandler` before the router fails the navigation with it.\n */\n private createPage(\n component: Type<unknown>,\n route: ActivatedRoute,\n environmentInjector: EnvironmentInjector,\n screen: unknown,\n inFront: WritableSignal<boolean>,\n ): { ref: ComponentRef<unknown>; unbind: () => void } {\n let ref: ComponentRef<unknown> | undefined;\n let unbind: (() => void) | undefined;\n try {\n ref = createComponent(component, {\n environmentInjector,\n elementInjector: this.outletInjector(route, inFront),\n hostElement: screen as Element,\n });\n this.applicationRef.attachView(ref.hostView);\n // Route params onto inputs before the first change detection, not after: a required input\n // read in the template throws NG0950 if it is still unset when the page first renders.\n unbind = this.bindInputs(ref, route);\n // Before anything can commit. Creating the page's nodes dirties the tree, which schedules a\n // commit of its own - and that commit would capture the page with its elements created and\n // its bindings not yet applied. On iOS the props catch up a frame later and nobody sees it;\n // on Android the flattening decision is made from the props a view is created with, so a\n // content wrapper that arrives without its `collapsable: false` is flattened for good and\n // its children end up parented to a scroll view that allows exactly one.\n ref.changeDetectorRef.detectChanges();\n return { ref, unbind };\n } catch (error) {\n unbind?.();\n ref?.destroy();\n this.removeScreen(screen);\n this.uncover();\n this.errors.handleError(error);\n throw error;\n }\n }\n\n deactivate(): void {\n const entry = this.entries.pop();\n if (!entry) return;\n this.drop(entry);\n }\n\n /**\n * Hand the live `ComponentRef` back to the router without destroying it. The screen stays\n * mounted, so the component keeps running and its native views keep their state.\n */\n detach(): ComponentRef<unknown> {\n const entry = this.top;\n if (!entry) throw new Error('[angular-native] outlet is not activated, nothing to detach');\n entry.detached = true;\n entry.detachedIn = this.navigationId();\n entry.inFront.set(false);\n // `ChangeDetectorRef.detach`, not `ApplicationRef.detachView`. The latter calls\n // `renderDetachView` and pulls the view's nodes out of the tree, which is exactly what we\n // are trying to avoid: the screen would vanish from the stack the moment we pushed past it.\n // This stops change detection for an off-screen screen while leaving it mounted.\n entry.ref.hostView.detach();\n return entry.ref;\n }\n\n /**\n * Re-attach a previously detached ref. If we still hold it, everything stacked above it is a\n * screen the user has navigated back past, so those are destroyed: that is the pop.\n */\n attach(ref: ComponentRef<unknown>, route: ActivatedRoute): void {\n const index = this.entries.findIndex((entry) => entry.ref === ref);\n\n if (index === -1) {\n // Not ours: the router is restoring a ref detached by a different outlet instance. Its\n // host element is already a screen, complete with the `dismissed` listener that outlet\n // registered, so it is re-parented rather than rebuilt.\n const screen = ref.location.nativeElement;\n this.renderer.appendChild(this.host.nativeElement, screen);\n this.entries.push({\n route,\n ref,\n screen,\n detached: false,\n unbind: this.bindInputs(ref, route),\n // What it was given is its first outlet's; this one has no say over that screen's.\n inFront: signal(true),\n });\n this.applicationRef.attachView(ref.hostView);\n } else {\n for (const above of this.entries.splice(index + 1)) this.drop(above);\n const entry = this.entries[index]!;\n entry.detached = false;\n entry.inFront.set(true);\n entry.route = route;\n // The route object is new even when the url is not, so the inputs follow the new one.\n entry.unbind();\n entry.unbind = this.bindInputs(ref, route);\n }\n\n // Resume change detection for the screen the user is coming back to.\n ref.hostView.reattach();\n }\n\n // --- native stack -------------------------------------------------------\n\n /**\n * Route params onto the page's inputs, but only in an app that asked for it with\n * `withComponentInputBinding()`, which is the only time Angular's own outlet binds them. Read\n * per screen rather than once, for a test that stands the router in.\n */\n private bindInputs(ref: ComponentRef<unknown>, route: ActivatedRoute): () => void {\n return this.router?.componentInputBindingEnabled ? bindRouteInputs(ref, route) : () => {};\n }\n\n private get top(): StackEntry | undefined {\n return this.entries[this.entries.length - 1];\n }\n\n /**\n * What the navigation asked for, if it asked for anything. Read here rather than remembered,\n * because the router is mid-navigation for exactly as long as an activation takes.\n */\n private currentIntent(): NativeIntent | null {\n return intentOf(this.router?.getCurrentNavigation()?.extras.state);\n }\n\n /**\n * How the screen a navigation activates is put on screen.\n *\n * A push on top of a presented screen is presented the same way. `RNSScreenStack` pushes a push\n * screen that follows a modal onto the navigation controller under the modal, so the router\n * would be on the new route while the modal stayed in front, and the modal's own way out would\n * first pop a screen nobody could see. A presentation the navigation names itself wins, and a\n * reset starts a stack with nothing to follow. A presented screen that is a stack of its own is\n * where a push to one of its children goes instead, inside it.\n */\n private presentationFor(intent: NativeIntent | null): ScreenPresentation | undefined {\n const own = this.claimPresentation(intent);\n const covering = this.top?.presentation?.stackPresentation;\n if (intent?.stack === 'reset' || !covering || covering === 'push' || own?.stackPresentation) {\n return own;\n }\n return { ...own, stackPresentation: covering };\n }\n\n /** The navigation's own presentation, unless an outlet further out already presented it. */\n private claimPresentation(intent: NativeIntent | null): ScreenPresentation | undefined {\n if (!intent?.presentation) return undefined;\n const id = this.router?.getCurrentNavigation()?.id;\n if (id === undefined) return intent.presentation;\n if (presented.get(this.router!) === id) return undefined;\n presented.set(this.router!, id);\n return intent.presentation;\n }\n\n /** Take a screen out for good: its bindings, its component, and its native view. */\n private drop(entry: StackEntry): void {\n entry.unbind();\n entry.ref.destroy();\n this.removeScreen(entry.screen);\n }\n\n /** Take one entry out of the stack, wherever it is, and drop it. */\n private remove(entry: StackEntry): void {\n const index = this.entries.indexOf(entry);\n if (index === -1) return;\n this.entries.splice(index, 1);\n this.drop(entry);\n }\n\n // --- a navigation's outcome ----------------------------------------------\n\n /** The id of the navigation in progress, when there is a router to say. */\n private navigationId(): number | undefined {\n return this.router?.getCurrentNavigation()?.id;\n }\n\n /**\n * Take out the screens a replace or a reset supersedes once its navigation has succeeded, or\n * at once when there is no navigation to wait for. A replaced screen has already been detached\n * by the router, and with `replaceUrl` its history entry is gone too, so nothing will attach it\n * again; the reuse strategy notices the ref is destroyed and drops its handle.\n */\n private supersede(entries: StackEntry[], navigation: number | undefined): void {\n if (navigation === undefined) {\n for (const entry of entries) this.remove(entry);\n return;\n }\n this.superseded = { entries, navigation };\n }\n\n /** A navigation succeeded: what it superseded goes, and what it did is no longer undoable. */\n private settle(navigation: number): void {\n if (this.superseded?.navigation === navigation) {\n for (const entry of this.superseded.entries) this.remove(entry);\n this.superseded = null;\n }\n for (const entry of this.entries) {\n if (entry.activatedIn === navigation) entry.activatedIn = undefined;\n if (entry.detachedIn === navigation) entry.detachedIn = undefined;\n }\n }\n\n /**\n * A navigation failed, so the router is back where it started: undo what it did here too.\n *\n * The screen that threw has already gone (`createPage`), but a screen this outlet activated for\n * the same navigation has not when the one that threw is further in, the first screen of a\n * stack inside it. That one goes, with everything in it, and the screen it covered carries on.\n */\n private rollBack(navigation: number): void {\n if (this.superseded?.navigation === navigation) this.superseded = null;\n for (const entry of this.entries.filter((candidate) => candidate.activatedIn === navigation)) {\n this.remove(entry);\n }\n this.uncover(navigation);\n }\n\n /**\n * Give the top screen back its change detection when the router covered it for a navigation\n * that is not going to happen: the one given, or the one in progress.\n */\n private uncover(navigation = this.navigationId()): void {\n const top = this.top;\n if (!top?.detached || top.detachedIn !== navigation) return;\n top.detached = false;\n top.detachedIn = undefined;\n top.inFront.set(true);\n top.ref.hostView.reattach();\n }\n\n /**\n * `position: absolute` and the four insets, through `setStyle` rather than one `setProperty`\n * so each key merges into whatever style is already on the screen instead of replacing it -\n * the same merge a page's own host style gets, just asserted last so the stack's layout wins.\n */\n private fillScreen(screen: unknown): void {\n for (const [key, value] of Object.entries(FILL)) {\n this.renderer.setStyle(screen as Element, key, value);\n }\n }\n\n private createScreen(presentation?: ScreenPresentation): unknown {\n const screen = ownHost(this.renderer.createElement('screen'));\n this.fillScreen(screen);\n // Set once and never lowered: see the note at the top of this file.\n this.renderer.setProperty(screen, 'activityState', ActivityState.Active);\n // A swipe-back or an Android back button pops the screen natively and only then tells JS.\n // Without this the native stack and the router disagree from that moment on: the screen is\n // gone but the URL still points at it, so the next navigation starts from the wrong place.\n this.renderer.listen(\n screen,\n 'dismissed',\n (event: { nativeEvent?: { dismissCount?: number } }) =>\n this.onNativeDismiss(event?.nativeEvent?.dismissCount ?? 1),\n );\n // Every key is a prop `RNSScreen` already declares, spelled the way the codegen spec spells\n // it, so this forwards rather than translates. Set before the screen joins the stack: the\n // native side reads the presentation as it mounts.\n for (const [prop, value] of Object.entries(presentation ?? {})) {\n if (value !== undefined) this.renderer.setProperty(screen, prop, value);\n }\n\n this.renderer.appendChild(this.host.nativeElement, screen);\n return screen;\n }\n\n /**\n * Follow a pop the user already made. `historyGo`, not `back()`, because iOS coalesces a long\n * swipe into a single event with a count.\n *\n * Only ever fires for a native dismissal: verified on device that a pop this outlet drives\n * itself emits `willAppear`/`appear` for the screen below but no `dismissed`, so there is no\n * double-pop to guard against.\n *\n * The gesture itself is unverified by tooling: idb cannot synthesise a `UIScreenEdgePan` that\n * UIKit accepts, so this path was reasoned from the events rather than driven end to end.\n */\n private onNativeDismiss(count: number): void {\n this.popBy(Math.max(1, count));\n }\n\n /**\n * A back, from the button or `NativeNavigation`: pop the top screen, as long as there is one\n * below it and this stack is the one the user is looking at. A stack in a tab behind, or under\n * a screen pushed over the tab bar, is still subscribed, and the newest one would otherwise\n * answer for the stack in front.\n */\n private goBack(): boolean {\n if (this.entries.length < 2 || !this.isShowing()) return false;\n this.popBy(1);\n return true;\n }\n\n /** Whether the top screen is part of what the router shows now. Assumed without a router. */\n private isShowing(): boolean {\n if (!this.router) return true;\n return this.isActivated && isShowing(this.router, this.top!.route);\n }\n\n /**\n * Take the router to the screen `steps` below the top, whether native already popped it or it\n * is about to be popped because the router arrives there.\n */\n private popBy(steps: number): void {\n const below = this.entries[this.entries.length - 1 - steps];\n const url = below && this.router ? this.urlOf(below) : null;\n // Usually the entry that far back is the screen the pop revealed, and going back through\n // history keeps it tidy. Not always: a stack inside a tab shares history with the other tabs,\n // so after a trip to one and back the entry behind the top screen is that other tab, and\n // going back would switch tab rather than pop. Then the router is sent to the revealed\n // screen instead, replacing the entry of the one that is gone.\n const behind = this.historyUrl(-steps);\n if (!url || behind === undefined || behind === url) {\n this.location.historyGo(-steps);\n return;\n }\n void this.router!.navigateByUrl(url, { replaceUrl: true });\n }\n\n /**\n * Take the router down to the screen at `index`, popping every screen above it together.\n * Through history when the entries behind are these screens, so going back from there keeps\n * working one screen at a time; otherwise by a navigation to it that replaces the entry, as\n * `popBy` does when a tab's history interleaves.\n */\n private popToEntry(index: number): Promise<boolean> {\n const url = this.urlOf(this.entries[index]!);\n const steps = this.entries.length - 1 - index;\n if (this.historyUrl(-steps) === url) {\n const arrived = this.nextNavigation();\n this.location.historyGo(-steps);\n return arrived;\n }\n return this.router!.navigateByUrl(url, { replaceUrl: true });\n }\n\n /** Whether the navigation that happens next succeeds. */\n private nextNavigation(): Promise<boolean> {\n return new Promise((resolve) => {\n const events = this.router!.events.subscribe((event) => {\n if (event instanceof NavigationEnd) resolve(true);\n else if (event instanceof NavigationError || event instanceof NavigationCancel) {\n resolve(false);\n } else return;\n events.unsubscribe();\n });\n });\n }\n\n /** The url a screen was showing when it was covered, rebuilt from its own route snapshot. */\n private urlOf(entry: StackEntry): string {\n const snapshot = entry.route.snapshot;\n const tree = createUrlTreeFromSnapshot(snapshot, [], snapshot.queryParams, snapshot.fragment);\n return this.router!.serializeUrl(tree);\n }\n\n /**\n * The url of the history entry `offset` away, normalised the way the router writes it: null past\n * the start of history, and undefined when the history is not ours to read, so the pop has to go\n * through it blind.\n */\n private historyUrl(offset: number): string | null | undefined {\n if (!(this.history instanceof NativePlatformLocation)) return undefined;\n const url = this.history.ɵurlAt(offset);\n return url === null ? null : this.router!.serializeUrl(this.router!.parseUrl(url));\n }\n\n private removeScreen(screen: unknown): void {\n this.renderer.removeChild(this.host.nativeElement, screen);\n }\n\n /**\n * What a page is created with: its route, the outlet contexts its own outlets register in, and\n * whether its screen is in front - which is this screen's own say and, for a stack inside a\n * screen of another, that screen's too.\n */\n private outletInjector(route: ActivatedRoute, inFront: WritableSignal<boolean>): Injector {\n const outer = this.injector.get(SCREEN_IN_FRONT);\n return Injector.create({\n parent: this.injector,\n providers: [\n { provide: SCREEN_IN_FRONT, useValue: computed(() => outer() && inFront()) },\n { provide: ActivatedRoute, useValue: route },\n {\n provide: ChildrenOutletContexts,\n useValue: this.parentContexts.getOrCreateContext(this.name).children,\n },\n ],\n });\n }\n}\n"]}
@@ -0,0 +1,57 @@
1
+ import { BaseRouteReuseStrategy, type ActivatedRouteSnapshot, type DetachedRouteHandle, type Route } from '@angular/router';
2
+ /**
3
+ * Keep one screen for a route whatever its parameters, updating it in place as Angular's own
4
+ * strategy does, instead of pushing a new screen for each url.
5
+ *
6
+ * `reuseScreen({ path: 'photo/:index', component: Photo })` for a route whose parameter picks
7
+ * what one screen shows - a pager, a step through a list - rather than naming another screen to
8
+ * go to. Everything else stacks: `/user/1` then `/user/2` is two screens, and back returns to the
9
+ * first.
10
+ */
11
+ export declare function reuseScreen<T extends Route>(route: T): T;
12
+ export declare class NativeStackReuseStrategy extends BaseRouteReuseStrategy {
13
+ private readonly handles;
14
+ /**
15
+ * Only leaf routes become screens; a parent with children is layout, not a destination.
16
+ *
17
+ * A tab is the exception, and has to be. Detaching only its leaf would rebuild the tab itself
18
+ * on every switch, and with it the stack outlet inside: a tab two screens deep would come back
19
+ * one screen deep, having lost the screens the user could go back to. Detaching the tab keeps
20
+ * its whole subtree, which is what makes each tab remember where it was.
21
+ *
22
+ * So is a parent a native stack put on screen, such as a root stack's tab bar: a sheet presented
23
+ * over it has to leave it standing (see `markScreenRoute`).
24
+ */
25
+ shouldDetach(route: ActivatedRouteSnapshot): boolean;
26
+ store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle | null): void;
27
+ /** Refs whose destruction already drops their handles. */
28
+ private readonly watched;
29
+ /**
30
+ * Drop a screen's handles the moment its component is destroyed.
31
+ *
32
+ * The router stores a handle for every screen it navigates away from, the one being popped
33
+ * included, and the outlet then destroys that screen. A handle outlives its component, and holds
34
+ * the component's whole view and every native node in it; `retrieve` notices only when the same
35
+ * url is asked for again, so a url never revisited kept its last screen for as long as the app
36
+ * ran.
37
+ */
38
+ private forgetOnDestroy;
39
+ /**
40
+ * Angular reuses a route whenever its config is the same, so on the web `/user/1` to `/user/2`
41
+ * keeps the one component and feeds it the new params. On a native stack that turns a push into
42
+ * an update in place: no push animation, one screen, and back skipping past `/user/1`. A screen
43
+ * a stack put on screen is reused only when its url is the same too, so a different parameter
44
+ * is a different screen, which the router detaches and stores as it does any screen pushed
45
+ * away. A query or fragment change is not part of the url that identifies a screen, and a
46
+ * parent that is only layout is reused as before, so its stack keeps what is in it.
47
+ */
48
+ shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean;
49
+ shouldAttach(route: ActivatedRouteSnapshot): boolean;
50
+ /**
51
+ * The router only ever tells the strategy about a screen it detached, never about one the
52
+ * outlet destroyed on a pop, so a handle can outlive its component. Pushing A, then B, going
53
+ * back and pushing B again would otherwise attach B's destroyed ref: a screen that renders and
54
+ * never updates. The ref knows it is dead, so ask it rather than couple the two.
55
+ */
56
+ retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null;
57
+ }
@@ -0,0 +1,126 @@
1
+ import { BaseRouteReuseStrategy, } from '@angular/router';
2
+ import { isScreenRoute, isTabRoute } from "./tab-routes.js";
3
+ /**
4
+ * Where `reuseScreen` marks a route. On the config's `data` rather than in a set of configs,
5
+ * because the router copies every route config it is given, so the object an app wrote is never
6
+ * the one a snapshot points at.
7
+ */
8
+ const REUSE_SCREEN = 'ɵreuseScreen';
9
+ /**
10
+ * Keep one screen for a route whatever its parameters, updating it in place as Angular's own
11
+ * strategy does, instead of pushing a new screen for each url.
12
+ *
13
+ * `reuseScreen({ path: 'photo/:index', component: Photo })` for a route whose parameter picks
14
+ * what one screen shows - a pager, a step through a list - rather than naming another screen to
15
+ * go to. Everything else stacks: `/user/1` then `/user/2` is two screens, and back returns to the
16
+ * first.
17
+ */
18
+ export function reuseScreen(route) {
19
+ return { ...route, data: { ...route.data, [REUSE_SCREEN]: true } };
20
+ }
21
+ /**
22
+ * Identify a screen by its resolved url rather than its route config, so `/user/1` and `/user/2`
23
+ * are two screens on the stack rather than one that gets reused.
24
+ *
25
+ * One entry per level of the route tree, empty ones included. Flattened to a url, a tab at
26
+ * `/tabs/library` and the list at path `''` beneath it are the same string, and the router, asking
27
+ * for the list, is handed the tab's whole tree and makes the tab its own child.
28
+ */
29
+ function keyOf(route) {
30
+ const levels = [];
31
+ for (let current = route; current; current = current.parent) {
32
+ levels.unshift(current.url.map((segment) => segment.toString()).join('/'));
33
+ }
34
+ return JSON.stringify(levels);
35
+ }
36
+ export class NativeStackReuseStrategy extends BaseRouteReuseStrategy {
37
+ handles = new Map();
38
+ /**
39
+ * Only leaf routes become screens; a parent with children is layout, not a destination.
40
+ *
41
+ * A tab is the exception, and has to be. Detaching only its leaf would rebuild the tab itself
42
+ * on every switch, and with it the stack outlet inside: a tab two screens deep would come back
43
+ * one screen deep, having lost the screens the user could go back to. Detaching the tab keeps
44
+ * its whole subtree, which is what makes each tab remember where it was.
45
+ *
46
+ * So is a parent a native stack put on screen, such as a root stack's tab bar: a sheet presented
47
+ * over it has to leave it standing (see `markScreenRoute`).
48
+ */
49
+ shouldDetach(route) {
50
+ if (route.component === null)
51
+ return false;
52
+ return (route.children.length === 0 ||
53
+ isTabRoute(route.routeConfig) ||
54
+ isScreenRoute(route.routeConfig));
55
+ }
56
+ store(route, handle) {
57
+ const key = keyOf(route);
58
+ // A null handle is the router telling us the screen is gone for good.
59
+ if (handle) {
60
+ this.handles.set(key, handle);
61
+ this.forgetOnDestroy(handle.componentRef);
62
+ }
63
+ else
64
+ this.handles.delete(key);
65
+ }
66
+ /** Refs whose destruction already drops their handles. */
67
+ watched = new WeakSet();
68
+ /**
69
+ * Drop a screen's handles the moment its component is destroyed.
70
+ *
71
+ * The router stores a handle for every screen it navigates away from, the one being popped
72
+ * included, and the outlet then destroys that screen. A handle outlives its component, and holds
73
+ * the component's whole view and every native node in it; `retrieve` notices only when the same
74
+ * url is asked for again, so a url never revisited kept its last screen for as long as the app
75
+ * ran.
76
+ */
77
+ forgetOnDestroy(ref) {
78
+ if (!ref || this.watched.has(ref))
79
+ return;
80
+ this.watched.add(ref);
81
+ ref.onDestroy(() => {
82
+ for (const [key, handle] of this.handles) {
83
+ if (handle.componentRef === ref)
84
+ this.handles.delete(key);
85
+ }
86
+ });
87
+ }
88
+ /**
89
+ * Angular reuses a route whenever its config is the same, so on the web `/user/1` to `/user/2`
90
+ * keeps the one component and feeds it the new params. On a native stack that turns a push into
91
+ * an update in place: no push animation, one screen, and back skipping past `/user/1`. A screen
92
+ * a stack put on screen is reused only when its url is the same too, so a different parameter
93
+ * is a different screen, which the router detaches and stores as it does any screen pushed
94
+ * away. A query or fragment change is not part of the url that identifies a screen, and a
95
+ * parent that is only layout is reused as before, so its stack keeps what is in it.
96
+ */
97
+ shouldReuseRoute(future, curr) {
98
+ if (future.routeConfig !== curr.routeConfig)
99
+ return false;
100
+ const config = curr.routeConfig;
101
+ if (!isScreenRoute(config) || config?.data?.[REUSE_SCREEN] === true)
102
+ return true;
103
+ return keyOf(future) === keyOf(curr);
104
+ }
105
+ shouldAttach(route) {
106
+ return this.retrieve(route) !== null;
107
+ }
108
+ /**
109
+ * The router only ever tells the strategy about a screen it detached, never about one the
110
+ * outlet destroyed on a pop, so a handle can outlive its component. Pushing A, then B, going
111
+ * back and pushing B again would otherwise attach B's destroyed ref: a screen that renders and
112
+ * never updates. The ref knows it is dead, so ask it rather than couple the two.
113
+ */
114
+ retrieve(route) {
115
+ const key = keyOf(route);
116
+ const handle = this.handles.get(key);
117
+ if (!handle)
118
+ return null;
119
+ if (handle.componentRef?.hostView.destroyed) {
120
+ this.handles.delete(key);
121
+ return null;
122
+ }
123
+ return handle;
124
+ }
125
+ }
126
+ //# sourceMappingURL=native-stack-reuse-strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"native-stack-reuse-strategy.js","sourceRoot":"","sources":["../src/native-stack-reuse-strategy.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,sBAAsB,GAIvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE5D;;;;GAIG;AACH,MAAM,YAAY,GAAG,cAAc,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAkB,KAAQ;IACnD,OAAO,EAAE,GAAG,KAAK,EAAE,IAAI,EAAE,EAAE,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;AACrE,CAAC;AAOD;;;;;;;GAOG;AACH,SAAS,KAAK,CAAC,KAA6B;IAC1C,MAAM,MAAM,GAAa,EAAE,CAAC;IAC5B,KAAK,IAAI,OAAO,GAAkC,KAAK,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;QAC3F,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7E,CAAC;IACD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AC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC9E,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;OAQG;IACM,gBAAgB,CAAC,MAA8B,EAAE,IAA4B;QACpF,IAAI,MAAM,CAAC,WAAW,KAAK,IAAI,CAAC,WAAW;YAAE,OAAO,KAAK,CAAC;QAC1D,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC;QAChC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,MAAM,EAAE,IAAI,EAAE,CAAC,YAAY,CAAC,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QACjF,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAEQ,YAAY,CAAC,KAA6B;QACjD,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;IACvC,CAAC;IAED;;;;;OAKG;IACM,QAAQ,CAAC,KAA6B;QAC7C,MAAM,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAA6B,CAAC;QACjE,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC;QACzB,IAAI,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;YAC5C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACzB,OAAO,IAAI,CAAC;QACd,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["/**\n * The reuse strategy that turns navigation into a stack.\n *\n * Angular's default strategy never detaches, so navigating away destroys the component and its\n * native views, and coming back rebuilds them from scratch: a list is back at the top, a form is\n * empty. Detaching instead hands the live `ComponentRef` to the outlet, which keeps its screen\n * mounted. That is the whole reason `RouterOutletContract.detach()` exists.\n *\n * No decorators, so tests can import it and so it can be provided with `useClass`.\n */\nimport type { ComponentRef } from '@angular/core';\nimport {\n BaseRouteReuseStrategy,\n type ActivatedRouteSnapshot,\n type DetachedRouteHandle,\n type Route,\n} from '@angular/router';\nimport { isScreenRoute, isTabRoute } from './tab-routes.ts';\n\n/**\n * Where `reuseScreen` marks a route. On the config's `data` rather than in a set of configs,\n * because the router copies every route config it is given, so the object an app wrote is never\n * the one a snapshot points at.\n */\nconst REUSE_SCREEN = 'ɵreuseScreen';\n\n/**\n * Keep one screen for a route whatever its parameters, updating it in place as Angular's own\n * strategy does, instead of pushing a new screen for each url.\n *\n * `reuseScreen({ path: 'photo/:index', component: Photo })` for a route whose parameter picks\n * what one screen shows - a pager, a step through a list - rather than naming another screen to\n * go to. Everything else stacks: `/user/1` then `/user/2` is two screens, and back returns to the\n * first.\n */\nexport function reuseScreen<T extends Route>(route: T): T {\n return { ...route, data: { ...route.data, [REUSE_SCREEN]: true } };\n}\n\n/** What the router actually stores: `DetachedRouteHandle` is typed as an opaque object. */\ninterface StoredHandle {\n readonly componentRef?: ComponentRef<unknown>;\n}\n\n/**\n * Identify a screen by its resolved url rather than its route config, so `/user/1` and `/user/2`\n * are two screens on the stack rather than one that gets reused.\n *\n * One entry per level of the route tree, empty ones included. Flattened to a url, a tab at\n * `/tabs/library` and the list at path `''` beneath it are the same string, and the router, asking\n * for the list, is handed the tab's whole tree and makes the tab its own child.\n */\nfunction keyOf(route: ActivatedRouteSnapshot): string {\n const levels: string[] = [];\n for (let current: ActivatedRouteSnapshot | null = route; current; current = current.parent) {\n levels.unshift(current.url.map((segment) => segment.toString()).join('/'));\n }\n return JSON.stringify(levels);\n}\n\nexport class NativeStackReuseStrategy extends BaseRouteReuseStrategy {\n private readonly handles = new Map<string, DetachedRouteHandle>();\n\n /**\n * Only leaf routes become screens; a parent with children is layout, not a destination.\n *\n * A tab is the exception, and has to be. Detaching only its leaf would rebuild the tab itself\n * on every switch, and with it the stack outlet inside: a tab two screens deep would come back\n * one screen deep, having lost the screens the user could go back to. Detaching the tab keeps\n * its whole subtree, which is what makes each tab remember where it was.\n *\n * So is a parent a native stack put on screen, such as a root stack's tab bar: a sheet presented\n * over it has to leave it standing (see `markScreenRoute`).\n */\n override shouldDetach(route: ActivatedRouteSnapshot): boolean {\n if (route.component === null) return false;\n return (\n route.children.length === 0 ||\n isTabRoute(route.routeConfig) ||\n isScreenRoute(route.routeConfig)\n );\n }\n\n override store(route: ActivatedRouteSnapshot, handle: DetachedRouteHandle | null): void {\n const key = keyOf(route);\n // A null handle is the router telling us the screen is gone for good.\n if (handle) {\n this.handles.set(key, handle);\n this.forgetOnDestroy((handle as StoredHandle).componentRef);\n } else this.handles.delete(key);\n }\n\n /** Refs whose destruction already drops their handles. */\n private readonly watched = new WeakSet<ComponentRef<unknown>>();\n\n /**\n * Drop a screen's handles the moment its component is destroyed.\n *\n * The router stores a handle for every screen it navigates away from, the one being popped\n * included, and the outlet then destroys that screen. A handle outlives its component, and holds\n * the component's whole view and every native node in it; `retrieve` notices only when the same\n * url is asked for again, so a url never revisited kept its last screen for as long as the app\n * ran.\n */\n private forgetOnDestroy(ref: ComponentRef<unknown> | undefined): void {\n if (!ref || this.watched.has(ref)) return;\n this.watched.add(ref);\n ref.onDestroy(() => {\n for (const [key, handle] of this.handles) {\n if ((handle as StoredHandle).componentRef === ref) this.handles.delete(key);\n }\n });\n }\n\n /**\n * Angular reuses a route whenever its config is the same, so on the web `/user/1` to `/user/2`\n * keeps the one component and feeds it the new params. On a native stack that turns a push into\n * an update in place: no push animation, one screen, and back skipping past `/user/1`. A screen\n * a stack put on screen is reused only when its url is the same too, so a different parameter\n * is a different screen, which the router detaches and stores as it does any screen pushed\n * away. A query or fragment change is not part of the url that identifies a screen, and a\n * parent that is only layout is reused as before, so its stack keeps what is in it.\n */\n override shouldReuseRoute(future: ActivatedRouteSnapshot, curr: ActivatedRouteSnapshot): boolean {\n if (future.routeConfig !== curr.routeConfig) return false;\n const config = curr.routeConfig;\n if (!isScreenRoute(config) || config?.data?.[REUSE_SCREEN] === true) return true;\n return keyOf(future) === keyOf(curr);\n }\n\n override shouldAttach(route: ActivatedRouteSnapshot): boolean {\n return this.retrieve(route) !== null;\n }\n\n /**\n * The router only ever tells the strategy about a screen it detached, never about one the\n * outlet destroyed on a pop, so a handle can outlive its component. Pushing A, then B, going\n * back and pushing B again would otherwise attach B's destroyed ref: a screen that renders and\n * never updates. The ref knows it is dead, so ask it rather than couple the two.\n */\n override retrieve(route: ActivatedRouteSnapshot): DetachedRouteHandle | null {\n const key = keyOf(route);\n const handle = this.handles.get(key) as StoredHandle | undefined;\n if (!handle) return null;\n if (handle.componentRef?.hostView.destroyed) {\n this.handles.delete(key);\n return null;\n }\n return handle;\n }\n}\n"]}
@@ -0,0 +1,147 @@
1
+ import { type EngineNode } from '@ng-native/fabric';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Where a tab's picture comes from.
5
+ *
6
+ * `template` is the one worth knowing about: the image is drawn as a mask and tinted to the bar's
7
+ * colour, so it follows selection the way a symbol does. `image` renders as authored, which is
8
+ * what a multi-colour logo wants and what a monochrome icon almost never does.
9
+ */
10
+ export type TabIcon = {
11
+ readonly sfSymbol: string;
12
+ }
13
+ /** An image in the iOS asset catalogue, by name. */
14
+ | {
15
+ readonly xcasset: string;
16
+ }
17
+ /** A `require()`d asset or a `{ uri }`, drawn as authored. */
18
+ | {
19
+ readonly image: unknown;
20
+ }
21
+ /** The same, drawn as a mask and tinted. */
22
+ | {
23
+ readonly template: unknown;
24
+ }
25
+ /** Android: a drawable resource name. */
26
+ | {
27
+ readonly drawable: string;
28
+ };
29
+ /** One of Apple's standard items, which brings its own icon and title. */
30
+ export type TabSystemItem = 'none' | 'bookmarks' | 'contacts' | 'downloads' | 'favorites' | 'featured' | 'history' | 'more' | 'mostRecent' | 'mostViewed' | 'recents' | 'search' | 'topRated';
31
+ export type TabBarBlurEffect = 'none' | 'systemDefault' | 'extraLight' | 'light' | 'dark' | 'regular' | 'prominent' | 'systemUltraThinMaterial' | 'systemThinMaterial' | 'systemMaterial' | 'systemThickMaterial' | 'systemChromeMaterial';
32
+ /**
33
+ * How an item looks in one state. The names are the native ones, spelled as the codegen spec
34
+ * spells them, so this forwards rather than translates and Apple's own documentation still reads
35
+ * across.
36
+ */
37
+ export interface TabStateAppearance {
38
+ tabBarItemTitleFontFamily?: string;
39
+ tabBarItemTitleFontSize?: number;
40
+ tabBarItemTitleFontWeight?: string | number;
41
+ tabBarItemTitleFontStyle?: string;
42
+ tabBarItemTitleFontColor?: string | number;
43
+ tabBarItemTitlePositionAdjustment?: {
44
+ horizontal?: number;
45
+ vertical?: number;
46
+ };
47
+ tabBarItemIconColor?: string | number;
48
+ tabBarItemBadgeBackgroundColor?: string | number;
49
+ }
50
+ /** The four states an item can be in. Anything absent falls back to the platform's own. */
51
+ export interface TabItemAppearance {
52
+ normal?: TabStateAppearance;
53
+ selected?: TabStateAppearance;
54
+ focused?: TabStateAppearance;
55
+ disabled?: TabStateAppearance;
56
+ }
57
+ /**
58
+ * How the bar looks, per layout. `stacked` is the usual icon-over-title item; `inline` and
59
+ * `compactInline` are the side-by-side layouts iPad and a compact height use.
60
+ */
61
+ export interface TabAppearance {
62
+ stacked?: TabItemAppearance;
63
+ inline?: TabItemAppearance;
64
+ compactInline?: TabItemAppearance;
65
+ tabBarBackgroundColor?: string | number;
66
+ tabBarShadowColor?: string | number;
67
+ tabBarBlurEffect?: TabBarBlurEffect;
68
+ }
69
+ /** One icon, as the props native reads it through. */
70
+ export interface TabIconProps {
71
+ iconType?: string;
72
+ iconResourceName?: string;
73
+ iconImageSource?: unknown;
74
+ drawableIconResourceName?: string;
75
+ imageIconResource?: unknown;
76
+ }
77
+ /**
78
+ * An icon and its selected counterpart, as one set of props.
79
+ *
80
+ * Native carries a single `iconType` for both states, so the two have to be the same kind of
81
+ * thing: a template image cannot become a symbol when selected. React Native Screens throws on
82
+ * that pairing and so does this, because the alternative - what happened before this checked - is
83
+ * that native quietly keeps the unselected icon and nothing anywhere says why.
84
+ */
85
+ export declare function tabIconProps(icon: TabIconProps, selectedIcon: TabIconProps): TabIconProps & {
86
+ selectedIconResourceName?: string;
87
+ selectedIconImageSource?: unknown;
88
+ selectedDrawableIconResourceName?: string;
89
+ selectedImageIconResource?: unknown;
90
+ };
91
+ export declare class NativeTab {
92
+ private readonly engine;
93
+ /** The app's `withTabDefaults`, for an appearance this tab does not bind itself. */
94
+ private readonly defaults;
95
+ /**
96
+ * The `RNSTabsScreen` this tab is. The outlet creates the activated route's component inside
97
+ * it, which is why it is public: a tab is a slot as well as a bar item.
98
+ */
99
+ readonly screen: EngineNode;
100
+ constructor();
101
+ /**
102
+ * The child route this tab selects, as a path segment: `library` for `/tabs/library`. Native
103
+ * identifies the tab by it too, so it must be unique in the bar.
104
+ */
105
+ readonly path: import("@angular/core").InputSignal<string>;
106
+ /** The label under the icon. Absent gives an icon-only item. */
107
+ readonly title: import("@angular/core").InputSignal<string | undefined>;
108
+ /** iOS: an SF Symbol name, e.g. `books.vertical.fill`. Shorthand for `[icon]`. */
109
+ readonly sfSymbol: import("@angular/core").InputSignal<string | undefined>;
110
+ /** Android: a drawable resource name. Shorthand for `[icon]`. */
111
+ readonly drawable: import("@angular/core").InputSignal<string | undefined>;
112
+ /** Anything a symbol name cannot say: an image, a template image, an asset-catalogue name. */
113
+ readonly icon: import("@angular/core").InputSignal<TabIcon | undefined>;
114
+ /** Shown while this tab is the selected one. Absent leaves the platform to tint `icon`. */
115
+ readonly selectedIcon: import("@angular/core").InputSignal<TabIcon | undefined>;
116
+ /** One of Apple's standard items, which supplies its own icon and title. */
117
+ readonly systemItem: import("@angular/core").InputSignal<TabSystemItem | undefined>;
118
+ /** The badge on the item: a count, or a single character for a dot. */
119
+ readonly badge: import("@angular/core").InputSignal<string | undefined>;
120
+ /** Announced instead of the title. */
121
+ readonly accessibilityLabel: import("@angular/core").InputSignal<string | undefined>;
122
+ /** How the item looks. Colours are processed here, because native never sees the object's keys. */
123
+ readonly standardAppearance: import("@angular/core").InputSignal<TabAppearance | undefined>;
124
+ /** The same, for when the scroll view behind the bar is at its edge. */
125
+ readonly scrollEdgeAppearance: import("@angular/core").InputSignal<TabAppearance | undefined>;
126
+ protected readonly standard: import("@angular/core").Signal<object | undefined>;
127
+ protected readonly scrollEdge: import("@angular/core").Signal<object | undefined>;
128
+ protected readonly icons: import("@angular/core").Signal<TabIconProps & {
129
+ selectedIconResourceName?: string;
130
+ selectedIconImageSource?: unknown;
131
+ selectedDrawableIconResourceName?: string;
132
+ selectedImageIconResource?: unknown;
133
+ }>;
134
+ /** `sfSymbol` and `drawable` say the same thing as `icon`, in the form most tabs want. */
135
+ private shorthand;
136
+ /**
137
+ * One icon, as the four props native reads it through. A `require()`d asset is an id until the
138
+ * host resolves it, which is the same thing an `<image src>` needs and the engine only does for
139
+ * props it knows by name.
140
+ */
141
+ private iconProps;
142
+ private processAppearance;
143
+ private processItem;
144
+ private processState;
145
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeTab, never>;
146
+ static ɵcmp: i0.ɵɵComponentDeclaration<NativeTab, "native-tab", never, { "path": { "alias": "path"; "required": true; "isSignal": true; }; "title": { "alias": "title"; "required": false; "isSignal": true; }; "sfSymbol": { "alias": "sfSymbol"; "required": false; "isSignal": true; }; "drawable": { "alias": "drawable"; "required": false; "isSignal": true; }; "icon": { "alias": "icon"; "required": false; "isSignal": true; }; "selectedIcon": { "alias": "selectedIcon"; "required": false; "isSignal": true; }; "systemItem": { "alias": "systemItem"; "required": false; "isSignal": true; }; "badge": { "alias": "badge"; "required": false; "isSignal": true; }; "accessibilityLabel": { "alias": "accessibilityLabel"; "required": false; "isSignal": true; }; "standardAppearance": { "alias": "standardAppearance"; "required": false; "isSignal": true; }; "scrollEdgeAppearance": { "alias": "scrollEdgeAppearance"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
147
+ }