@symbiote-native/navigation 2.0.0 → 2.0.1
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/package.json +11 -10
- package/build/angular/drawer/index.d.ts +0 -76
- package/build/angular/drawer/index.js +0 -508
- package/build/angular/drawer-screen.directive.d.ts +0 -14
- package/build/angular/drawer-screen.directive.js +0 -87
- package/build/angular/index.d.ts +0 -23
- package/build/angular/index.js +0 -22
- package/build/angular/injectors/index.d.ts +0 -13
- package/build/angular/injectors/index.js +0 -8
- package/build/angular/injectors/inject-drawer-navigation.d.ts +0 -4
- package/build/angular/injectors/inject-drawer-navigation.js +0 -12
- package/build/angular/injectors/inject-focus-effect.d.ts +0 -2
- package/build/angular/injectors/inject-focus-effect.js +0 -29
- package/build/angular/injectors/inject-is-focused.d.ts +0 -2
- package/build/angular/injectors/inject-is-focused.js +0 -20
- package/build/angular/injectors/inject-navigation-state.d.ts +0 -3
- package/build/angular/injectors/inject-navigation-state.js +0 -35
- package/build/angular/injectors/inject-navigation.d.ts +0 -7
- package/build/angular/injectors/inject-navigation.js +0 -16
- package/build/angular/injectors/inject-route.d.ts +0 -3
- package/build/angular/injectors/inject-route.js +0 -20
- package/build/angular/injectors/inject-stack-navigation.d.ts +0 -4
- package/build/angular/injectors/inject-stack-navigation.js +0 -15
- package/build/angular/injectors/inject-tab-navigation.d.ts +0 -4
- package/build/angular/injectors/inject-tab-navigation.js +0 -11
- package/build/angular/linking.d.ts +0 -3
- package/build/angular/linking.js +0 -43
- package/build/angular/navigation-context.service.d.ts +0 -13
- package/build/angular/navigation-context.service.js +0 -105
- package/build/angular/navigation-scope.directive.d.ts +0 -10
- package/build/angular/navigation-scope.directive.js +0 -90
- package/build/angular/screen.directive.d.ts +0 -22
- package/build/angular/screen.directive.js +0 -90
- package/build/angular/search-bar-ref.directive.d.ts +0 -10
- package/build/angular/search-bar-ref.directive.js +0 -88
- package/build/angular/stack/index.d.ts +0 -55
- package/build/angular/stack/index.js +0 -386
- package/build/angular/tab-screen.directive.d.ts +0 -14
- package/build/angular/tab-screen.directive.js +0 -87
- package/build/angular/tabs/index.d.ts +0 -42
- package/build/angular/tabs/index.js +0 -263
- package/build/core/constants.d.ts +0 -27
- package/build/core/constants.js +0 -61
- package/build/core/drawer-options/index.d.ts +0 -64
- package/build/core/drawer-options/index.js +0 -200
- package/build/core/drawer-router-state/index.d.ts +0 -21
- package/build/core/drawer-router-state/index.js +0 -40
- package/build/core/guards.d.ts +0 -2
- package/build/core/guards.js +0 -22
- package/build/core/header-bar-buttons.d.ts +0 -9
- package/build/core/header-bar-buttons.js +0 -163
- package/build/core/index.d.ts +0 -29
- package/build/core/index.js +0 -32
- package/build/core/linking-config/index.d.ts +0 -13
- package/build/core/linking-config/index.js +0 -171
- package/build/core/navigation-events/index.d.ts +0 -16
- package/build/core/navigation-events/index.js +0 -57
- package/build/core/navigator-handles/index.d.ts +0 -30
- package/build/core/navigator-handles/index.js +0 -15
- package/build/core/navigator-props.d.ts +0 -216
- package/build/core/navigator-props.js +0 -7
- package/build/core/navigator-state/index.d.ts +0 -36
- package/build/core/navigator-state/index.js +0 -81
- package/build/core/render-drawer.d.ts +0 -13
- package/build/core/render-drawer.js +0 -88
- package/build/core/render-stack.d.ts +0 -35
- package/build/core/render-stack.js +0 -294
- package/build/core/render-tabs.d.ts +0 -20
- package/build/core/render-tabs.js +0 -97
- package/build/core/screen-options.d.ts +0 -4
- package/build/core/screen-options.js +0 -133
- package/build/core/search-bar-commands.d.ts +0 -10
- package/build/core/search-bar-commands.js +0 -42
- package/build/core/state-persistence/index.d.ts +0 -3
- package/build/core/state-persistence/index.js +0 -23
- package/build/core/tab-options.d.ts +0 -13
- package/build/core/tab-options.js +0 -10
- package/build/core/tab-router-state/index.d.ts +0 -19
- package/build/core/tab-router-state/index.js +0 -51
- package/build/react/collect-registry.d.ts +0 -4
- package/build/react/collect-registry.js +0 -15
- package/build/react/drawer/index.d.ts +0 -29
- package/build/react/drawer/index.js +0 -277
- package/build/react/drawer-screen.d.ts +0 -14
- package/build/react/drawer-screen.js +0 -8
- package/build/react/hooks/index.d.ts +0 -12
- package/build/react/hooks/index.js +0 -8
- package/build/react/hooks/use-drawer-navigation.d.ts +0 -4
- package/build/react/hooks/use-drawer-navigation.js +0 -12
- package/build/react/hooks/use-focus-effect.d.ts +0 -2
- package/build/react/hooks/use-focus-effect.js +0 -29
- package/build/react/hooks/use-is-focused.d.ts +0 -1
- package/build/react/hooks/use-is-focused.js +0 -22
- package/build/react/hooks/use-navigation-state/index.d.ts +0 -2
- package/build/react/hooks/use-navigation-state/index.js +0 -39
- package/build/react/hooks/use-navigation.d.ts +0 -7
- package/build/react/hooks/use-navigation.js +0 -16
- package/build/react/hooks/use-route.d.ts +0 -2
- package/build/react/hooks/use-route.js +0 -8
- package/build/react/hooks/use-stack-navigation.d.ts +0 -4
- package/build/react/hooks/use-stack-navigation.js +0 -14
- package/build/react/hooks/use-tab-navigation.d.ts +0 -4
- package/build/react/hooks/use-tab-navigation.js +0 -12
- package/build/react/index.d.ts +0 -24
- package/build/react/index.js +0 -21
- package/build/react/linking.d.ts +0 -3
- package/build/react/linking.js +0 -47
- package/build/react/navigation-context.d.ts +0 -10
- package/build/react/navigation-context.js +0 -22
- package/build/react/screen.d.ts +0 -22
- package/build/react/screen.js +0 -7
- package/build/react/stack/index.d.ts +0 -13
- package/build/react/stack/index.js +0 -202
- package/build/react/tab-screen.d.ts +0 -15
- package/build/react/tab-screen.js +0 -8
- package/build/react/tabs/index.d.ts +0 -12
- package/build/react/tabs/index.js +0 -116
- package/build/register.d.ts +0 -7
- package/build/register.js +0 -58
- package/build/vue/composables/index.d.ts +0 -12
- package/build/vue/composables/index.js +0 -8
- package/build/vue/composables/use-drawer-navigation.d.ts +0 -5
- package/build/vue/composables/use-drawer-navigation.js +0 -15
- package/build/vue/composables/use-focus-effect.d.ts +0 -1
- package/build/vue/composables/use-focus-effect.js +0 -31
- package/build/vue/composables/use-is-focused.d.ts +0 -2
- package/build/vue/composables/use-is-focused.js +0 -28
- package/build/vue/composables/use-navigation-state.d.ts +0 -3
- package/build/vue/composables/use-navigation-state.js +0 -29
- package/build/vue/composables/use-navigation.d.ts +0 -8
- package/build/vue/composables/use-navigation.js +0 -13
- package/build/vue/composables/use-route.d.ts +0 -3
- package/build/vue/composables/use-route.js +0 -9
- package/build/vue/composables/use-stack-navigation.d.ts +0 -5
- package/build/vue/composables/use-stack-navigation.js +0 -18
- package/build/vue/composables/use-tab-navigation.d.ts +0 -5
- package/build/vue/composables/use-tab-navigation.js +0 -15
- package/build/vue/drawer/index.d.ts +0 -19
- package/build/vue/drawer/index.js +0 -390
- package/build/vue/drawer-screen.d.ts +0 -14
- package/build/vue/drawer-screen.js +0 -12
- package/build/vue/index.d.ts +0 -21
- package/build/vue/index.js +0 -19
- package/build/vue/linking.d.ts +0 -3
- package/build/vue/linking.js +0 -57
- package/build/vue/navigation-context.d.ts +0 -16
- package/build/vue/navigation-context.js +0 -65
- package/build/vue/screen.d.ts +0 -21
- package/build/vue/screen.js +0 -12
- package/build/vue/stack/index.d.ts +0 -9
- package/build/vue/stack/index.js +0 -279
- package/build/vue/tab-screen.d.ts +0 -14
- package/build/vue/tab-screen.js +0 -11
- package/build/vue/tabs/index.d.ts +0 -10
- package/build/vue/tabs/index.js +0 -209
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
// Stack, the Angular lifecycle half. The route-stack transitions (navigator-state) and the
|
|
2
|
-
// options/props folds (screen-options, render-stack) live in @symbiote-native/navigation core,
|
|
3
|
-
// shared verbatim with the React/Vue adapters; here Angular supplies the lifecycle - a signal for
|
|
4
|
-
// the pushed-route stack, a per-instance counter for route-key generation, push/pop/replace/... as
|
|
5
|
-
// plain public methods directly on the class (no `useImperativeHandle`/forwardRef equivalent
|
|
6
|
-
// needed: an Angular component instance IS its own "ref", same shape as MatDrawer.open(), reached
|
|
7
|
-
// via a template reference variable, e.g. `<Stack #nav>` then `nav.push(...)`; `Stack implements
|
|
8
|
-
// INavigatorHandle` so the instance itself is what NavigationScopeDirective hands to
|
|
9
|
-
// NavigationContextService - the DI scope every mounted screen reads its navigation/route from via
|
|
10
|
-
// injectStackNavigation()/injectRoute(), never a component input) - plus the descriptor bridge for
|
|
11
|
-
// the header config leaf via the raw
|
|
12
|
-
// native-view element tags below. Pushing/popping a route is an ordinary child render/removal:
|
|
13
|
-
// RNSScreenStack diffs its RNSScreen children natively, so no imperative native command is needed
|
|
14
|
-
// here at all. Neither this nor ScreenDirective imports react-native-screens' own React components
|
|
15
|
-
// (hooks, crashes a non-React adapter); the native views are driven directly through the
|
|
16
|
-
// ViewConfig ../register registers. See CLAUDE.md <third_party_rn_packages_are_react_only>.
|
|
17
|
-
//
|
|
18
|
-
// RAW NATIVE TAGS + NO_ERRORS_SCHEMA: RNSScreenStack/RNSScreen/RNSModalScreen/
|
|
19
|
-
// RNSScreenContentWrapper/RNSScreenStackHeaderConfig/RNSScreenStackHeaderSubview/RNSSearchBar are
|
|
20
|
-
// react-native-screens' native Fabric views, not Angular components - core's render-stack.ts
|
|
21
|
-
// deliberately hands back PLAIN PROPS OBJECTS for the leaves this adapter builds itself with real
|
|
22
|
-
// framework children (see its header comment), the same split react/stack.ts's `createElement`
|
|
23
|
-
// calls implement. A non-dashed raw tag name only satisfies Angular's DOM element schema check
|
|
24
|
-
// under `NO_ERRORS_SCHEMA` (`CUSTOM_ELEMENTS_SCHEMA` only relaxes tags containing a "-", confirmed
|
|
25
|
-
// against `.vendors/angular/packages/compiler/src/schema/dom_element_schema_registry.ts`'s
|
|
26
|
-
// `hasElement`) - every other Angular component in this codebase only ever names dashed
|
|
27
|
-
// `symbiote-*` primitives or real `@Component` selectors, so this is the first legitimate need for
|
|
28
|
-
// the looser schema in this codebase; every prop still routes through the real, declared
|
|
29
|
-
// `[symbioteHostProps]` input (primitives/shared.ts, `@symbiote-native/angular`), never a bare
|
|
30
|
-
// unknown-property binding.
|
|
31
|
-
//
|
|
32
|
-
// RESOLVED: `Stack` itself (like `Tab`/`Drawer`) is a composed Angular `@Component` used as a
|
|
33
|
-
// plain `<Stack>` tag by consuming app code. It is NOT hardcoded into `adapters/angular/src/
|
|
34
|
-
// renderer/index.ts`'s `ANCHOR_HOST_COMPONENTS` Set - as an app/package-owned selector it
|
|
35
|
-
// self-registers instead: `adapters/angular/babel-register-composed.cjs` (a Metro babel preset
|
|
36
|
-
// applied bundle-wide, not scoped to adapters/angular) scans this package's own AOT-compiled
|
|
37
|
-
// (`ngc`) `ɵɵngDeclareComponent({selector: 'Stack', ...})` output and auto-calls
|
|
38
|
-
// `registerComposedComponent('Stack')` at bundle time - same mechanism `.examples/angular`
|
|
39
|
-
// navigation-demo screens and `@symbiote-native/slider`'s `Slider` rely on for their own composed
|
|
40
|
-
// components mounted statically or via `NgComponentOutlet`. Unregistered, `createElement('Stack')`
|
|
41
|
-
// falls through to a real `createNode` call and RN paints its own "Unimplemented component"
|
|
42
|
-
// fallback instead. vitest never runs that Metro/babel pipeline, so `stack.test.ts` calls
|
|
43
|
-
// `registerComposedComponent('Stack')` itself. Every raw react-native-screens tag above is
|
|
44
|
-
// correctly EXEMPT from this mechanism (they must fall through to a real `createNode` to paint at
|
|
45
|
-
// all).
|
|
46
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
47
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
48
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
49
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
50
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
51
|
-
var _, done = false;
|
|
52
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
53
|
-
var context = {};
|
|
54
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
55
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
56
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
57
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
58
|
-
if (kind === "accessor") {
|
|
59
|
-
if (result === void 0) continue;
|
|
60
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
61
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
62
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
63
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
64
|
-
}
|
|
65
|
-
else if (_ = accept(result)) {
|
|
66
|
-
if (kind === "field") initializers.unshift(_);
|
|
67
|
-
else descriptor[key] = _;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
71
|
-
done = true;
|
|
72
|
-
};
|
|
73
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
74
|
-
var useValue = arguments.length > 2;
|
|
75
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
76
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
77
|
-
}
|
|
78
|
-
return useValue ? value : void 0;
|
|
79
|
-
};
|
|
80
|
-
import { ChangeDetectionStrategy, Component, ContentChildren, Input, NO_ERRORS_SCHEMA, QueryList, signal, } from '@angular/core';
|
|
81
|
-
import { NgComponentOutlet, NgTemplateOutlet } from '@angular/common';
|
|
82
|
-
import { SymbioteHostPropsDirective } from '@symbiote-native/angular';
|
|
83
|
-
import { Platform, dlog } from '@symbiote-native/engine';
|
|
84
|
-
import { NAVIGATION_EVENT_BLUR, NAVIGATION_EVENT_FOCUS, NAVIGATION_EVENT_STATE, RNS_MODAL_SCREEN_VIEW_NAME, SCREEN_ON_APPEAR, SCREEN_ON_DISAPPEAR, SCREEN_ON_DISMISSED, SCREEN_ON_HEADER_BACK_BUTTON_CLICKED, STACK_ON_FINISH_TRANSITIONING, buildSearchBarPassthrough, createInitialNavigatorState, createNavigationEmitter, navigatorReducer, resolveHeaderInModalStackStyle, resolveScreenRenderPlan, resolveStackProps, } from '../../core/index.js';
|
|
85
|
-
import { NavigationScopeDirective } from '../navigation-scope.directive.js';
|
|
86
|
-
import { SearchBarRefDirective } from '../search-bar-ref.directive.js';
|
|
87
|
-
import { ScreenDirective } from '../screen.directive.js';
|
|
88
|
-
// backTitleVisible defaults to `true` on both platforms per the codegen spec's own default - no
|
|
89
|
-
// ios/android divergence in v1 scope (mirrors react/stack.ts's own constant exactly).
|
|
90
|
-
const NAVIGATOR_PLATFORM = { defaultHeaderBackTitleVisible: true };
|
|
91
|
-
let stackInstanceCounter = 0;
|
|
92
|
-
let Stack = (() => {
|
|
93
|
-
let _classDecorators = [Component({
|
|
94
|
-
selector: 'Stack',
|
|
95
|
-
standalone: true,
|
|
96
|
-
schemas: [NO_ERRORS_SCHEMA],
|
|
97
|
-
imports: [
|
|
98
|
-
NgTemplateOutlet,
|
|
99
|
-
NgComponentOutlet,
|
|
100
|
-
NavigationScopeDirective,
|
|
101
|
-
SearchBarRefDirective,
|
|
102
|
-
SymbioteHostPropsDirective,
|
|
103
|
-
],
|
|
104
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
105
|
-
template: `
|
|
106
|
-
@if (state(); as currentState) {
|
|
107
|
-
<RNSScreenStack [symbioteHostProps]="stackHostProps()">
|
|
108
|
-
@for (route of currentState.routes; track route.key; let idx = $index) {
|
|
109
|
-
<ng-container
|
|
110
|
-
[ngTemplateOutlet]="screenTpl"
|
|
111
|
-
[ngTemplateOutletContext]="{ $implicit: route, index: idx }"
|
|
112
|
-
/>
|
|
113
|
-
}
|
|
114
|
-
</RNSScreenStack>
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
<ng-template #screenTpl let-route let-index="index">
|
|
118
|
-
@if (outerScreenIsModal(route, index)) {
|
|
119
|
-
<RNSModalScreen [symbioteHostProps]="screenHostProps(route, index)">
|
|
120
|
-
<ng-container
|
|
121
|
-
[ngTemplateOutlet]="innerTpl"
|
|
122
|
-
[ngTemplateOutletContext]="{ $implicit: route, index: index }"
|
|
123
|
-
/>
|
|
124
|
-
</RNSModalScreen>
|
|
125
|
-
} @else {
|
|
126
|
-
<RNSScreen [symbioteHostProps]="screenHostProps(route, index)">
|
|
127
|
-
<ng-container
|
|
128
|
-
[ngTemplateOutlet]="innerTpl"
|
|
129
|
-
[ngTemplateOutletContext]="{ $implicit: route, index: index }"
|
|
130
|
-
/>
|
|
131
|
-
</RNSScreen>
|
|
132
|
-
}
|
|
133
|
-
</ng-template>
|
|
134
|
-
|
|
135
|
-
<ng-template #innerTpl let-route let-index="index">
|
|
136
|
-
@if (isInModal(route, index)) {
|
|
137
|
-
<RNSScreenStack [symbioteHostProps]="innerStackProps()">
|
|
138
|
-
<RNSScreen [symbioteHostProps]="innerScreenProps(route, index)">
|
|
139
|
-
<ng-container
|
|
140
|
-
[ngTemplateOutlet]="headerAndContentTpl"
|
|
141
|
-
[ngTemplateOutletContext]="{ $implicit: route, index: index }"
|
|
142
|
-
/>
|
|
143
|
-
</RNSScreen>
|
|
144
|
-
</RNSScreenStack>
|
|
145
|
-
} @else {
|
|
146
|
-
<ng-container
|
|
147
|
-
[ngTemplateOutlet]="headerAndContentTpl"
|
|
148
|
-
[ngTemplateOutletContext]="{ $implicit: route, index: index }"
|
|
149
|
-
/>
|
|
150
|
-
}
|
|
151
|
-
</ng-template>
|
|
152
|
-
|
|
153
|
-
<ng-template #headerAndContentTpl let-route let-index="index">
|
|
154
|
-
<RNSScreenStackHeaderConfig [symbioteHostProps]="headerConfigProps(route, index)">
|
|
155
|
-
@if (hasSearchBar(route)) {
|
|
156
|
-
<RNSScreenStackHeaderSubview [symbioteHostProps]="headerSubviewProps">
|
|
157
|
-
<RNSSearchBar
|
|
158
|
-
[symbioteSearchBarRef]="searchBarRef(route)"
|
|
159
|
-
[symbioteHostProps]="searchBarProps(route, index)"
|
|
160
|
-
/>
|
|
161
|
-
</RNSScreenStackHeaderSubview>
|
|
162
|
-
}
|
|
163
|
-
</RNSScreenStackHeaderConfig>
|
|
164
|
-
<RNSScreenContentWrapper [symbioteHostProps]="contentWrapperProps(route, index)">
|
|
165
|
-
<ng-container
|
|
166
|
-
[symbioteNavigationScope]="route"
|
|
167
|
-
[navigation]="this"
|
|
168
|
-
[emitter]="emitterFor(route.key)"
|
|
169
|
-
>
|
|
170
|
-
<ng-container *ngComponentOutlet="componentFor(route)" />
|
|
171
|
-
</ng-container>
|
|
172
|
-
</RNSScreenContentWrapper>
|
|
173
|
-
</ng-template>
|
|
174
|
-
`,
|
|
175
|
-
})];
|
|
176
|
-
let _classDescriptor;
|
|
177
|
-
let _classExtraInitializers = [];
|
|
178
|
-
let _classThis;
|
|
179
|
-
let _screenChildren_decorators;
|
|
180
|
-
let _screenChildren_initializers = [];
|
|
181
|
-
let _screenChildren_extraInitializers = [];
|
|
182
|
-
let _initialRouteName_decorators;
|
|
183
|
-
let _initialRouteName_initializers = [];
|
|
184
|
-
let _initialRouteName_extraInitializers = [];
|
|
185
|
-
let _screenOptions_decorators;
|
|
186
|
-
let _screenOptions_initializers = [];
|
|
187
|
-
let _screenOptions_extraInitializers = [];
|
|
188
|
-
var Stack = class {
|
|
189
|
-
static { _classThis = this; }
|
|
190
|
-
static {
|
|
191
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
192
|
-
_screenChildren_decorators = [ContentChildren(ScreenDirective)];
|
|
193
|
-
_initialRouteName_decorators = [Input()];
|
|
194
|
-
_screenOptions_decorators = [Input()];
|
|
195
|
-
__esDecorate(null, null, _screenChildren_decorators, { kind: "field", name: "screenChildren", static: false, private: false, access: { has: obj => "screenChildren" in obj, get: obj => obj.screenChildren, set: (obj, value) => { obj.screenChildren = value; } }, metadata: _metadata }, _screenChildren_initializers, _screenChildren_extraInitializers);
|
|
196
|
-
__esDecorate(null, null, _initialRouteName_decorators, { kind: "field", name: "initialRouteName", static: false, private: false, access: { has: obj => "initialRouteName" in obj, get: obj => obj.initialRouteName, set: (obj, value) => { obj.initialRouteName = value; } }, metadata: _metadata }, _initialRouteName_initializers, _initialRouteName_extraInitializers);
|
|
197
|
-
__esDecorate(null, null, _screenOptions_decorators, { kind: "field", name: "screenOptions", static: false, private: false, access: { has: obj => "screenOptions" in obj, get: obj => obj.screenOptions, set: (obj, value) => { obj.screenOptions = value; } }, metadata: _metadata }, _screenOptions_initializers, _screenOptions_extraInitializers);
|
|
198
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
199
|
-
Stack = _classThis = _classDescriptor.value;
|
|
200
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
201
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
202
|
-
}
|
|
203
|
-
screenChildren = __runInitializers(this, _screenChildren_initializers, void 0);
|
|
204
|
-
initialRouteName = (__runInitializers(this, _screenChildren_extraInitializers), __runInitializers(this, _initialRouteName_initializers, void 0));
|
|
205
|
-
screenOptions = (__runInitializers(this, _initialRouteName_extraInitializers), __runInitializers(this, _screenOptions_initializers, void 0));
|
|
206
|
-
headerSubviewProps = (__runInitializers(this, _screenOptions_extraInitializers), { type: 'searchBar' });
|
|
207
|
-
routeIdPrefix = `stack-${(stackInstanceCounter += 1)}`;
|
|
208
|
-
// Keyed by name -> the LIVE ScreenDirective instance, not a snapshot copy of its fields:
|
|
209
|
-
// @ContentChildren's `changes` Observable only fires on a STRUCTURAL change to the query
|
|
210
|
-
// results (screens added/removed/reordered), never when an already-matched instance's own
|
|
211
|
-
// `[options]`/`[component]` binding is merely reassigned a new value - a snapshot copy taken at
|
|
212
|
-
// rebuild time would go stale the instant an app changes e.g. `[options]` on an existing
|
|
213
|
-
// `<ng-template symbioteScreen>` without also adding/removing one. Reading straight off the
|
|
214
|
-
// directive instance means Angular's own ordinary Input binding keeps every field live for free.
|
|
215
|
-
registry = new Map();
|
|
216
|
-
emitters = new Map();
|
|
217
|
-
// Keyed by `${route.key}:${index}`, cleared on every dispatch: the ~7 template-bound
|
|
218
|
-
// accessors below (outerScreenIsModal/isInModal/screenHostProps/...) all resolve the SAME
|
|
219
|
-
// route+index through planFor per change-detection cycle, so caching here turns ~7 runs of
|
|
220
|
-
// the 14-step resolveScreenRenderPlan chain into 1 per actual state change.
|
|
221
|
-
planCache = new Map();
|
|
222
|
-
routeSequence = 0;
|
|
223
|
-
screenChildrenSubscription;
|
|
224
|
-
stateSignal = signal(undefined);
|
|
225
|
-
state = this.stateSignal.asReadonly();
|
|
226
|
-
push = (name, params) => this.dispatch({ type: 'push', route: this.createRoute(name, params) });
|
|
227
|
-
pop = (count) => this.dispatch({ type: 'pop', count });
|
|
228
|
-
popToTop = () => this.dispatch({ type: 'popToTop' });
|
|
229
|
-
popTo = (key) => this.dispatch({ type: 'popTo', key });
|
|
230
|
-
replace = (name, params) => this.dispatch({ type: 'replace', route: this.createRoute(name, params) });
|
|
231
|
-
setParams = (params, key) => this.dispatch({ type: 'setParams', key, params });
|
|
232
|
-
reset = (nextState) => this.dispatch({ type: 'reset', state: nextState });
|
|
233
|
-
canGoBack = () => (this.stateSignal()?.routes.length ?? 0) > 1;
|
|
234
|
-
ngAfterContentInit() {
|
|
235
|
-
this.rebuildRegistry();
|
|
236
|
-
this.initializeState();
|
|
237
|
-
this.screenChildrenSubscription = this.screenChildren.changes.subscribe(() => {
|
|
238
|
-
this.rebuildRegistry();
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
ngOnDestroy() {
|
|
242
|
-
this.screenChildrenSubscription?.unsubscribe();
|
|
243
|
-
}
|
|
244
|
-
rebuildRegistry() {
|
|
245
|
-
this.registry.clear();
|
|
246
|
-
for (const screen of this.screenChildren) {
|
|
247
|
-
this.registry.set(screen.name, screen);
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
initializeState() {
|
|
251
|
-
if (this.stateSignal() !== undefined)
|
|
252
|
-
return;
|
|
253
|
-
const initialRouteName = this.initialRouteName ?? this.registry.keys().next().value;
|
|
254
|
-
if (initialRouteName === undefined) {
|
|
255
|
-
dlog('Stack: no <ng-template symbioteScreen> children registered');
|
|
256
|
-
this.stateSignal.set(createInitialNavigatorState({ key: this.routeIdPrefix, name: '', params: undefined }));
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
this.stateSignal.set(createInitialNavigatorState(this.createRoute(initialRouteName, this.registry.get(initialRouteName)?.initialParams)));
|
|
260
|
-
}
|
|
261
|
-
createRoute(name, params) {
|
|
262
|
-
this.routeSequence += 1;
|
|
263
|
-
return { key: `${this.routeIdPrefix}-${name}-${this.routeSequence}`, name, params };
|
|
264
|
-
}
|
|
265
|
-
dispatch(action) {
|
|
266
|
-
const current = this.stateSignal();
|
|
267
|
-
if (current === undefined)
|
|
268
|
-
return;
|
|
269
|
-
const next = navigatorReducer(current, action);
|
|
270
|
-
this.planCache.clear();
|
|
271
|
-
this.stateSignal.set(next);
|
|
272
|
-
const liveRouteKeys = new Set(next.routes.map(route => route.key));
|
|
273
|
-
for (const route of next.routes) {
|
|
274
|
-
this.emitterFor(route.key).emit(NAVIGATION_EVENT_STATE, next);
|
|
275
|
-
}
|
|
276
|
-
for (const routeKey of this.emitters.keys()) {
|
|
277
|
-
if (!liveRouteKeys.has(routeKey))
|
|
278
|
-
this.emitters.delete(routeKey);
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
emitterFor(routeKey) {
|
|
282
|
-
let emitter = this.emitters.get(routeKey);
|
|
283
|
-
if (!emitter) {
|
|
284
|
-
emitter = createNavigationEmitter();
|
|
285
|
-
this.emitters.set(routeKey, emitter);
|
|
286
|
-
}
|
|
287
|
-
return emitter;
|
|
288
|
-
}
|
|
289
|
-
mergedOptionsFor(route) {
|
|
290
|
-
const entry = this.registry.get(route.name);
|
|
291
|
-
const optionsArgs = { route, navigation: this };
|
|
292
|
-
const own = entry === undefined
|
|
293
|
-
? undefined
|
|
294
|
-
: typeof entry.options === 'function'
|
|
295
|
-
? entry.options(optionsArgs)
|
|
296
|
-
: entry.options;
|
|
297
|
-
return { ...this.screenOptions, ...own };
|
|
298
|
-
}
|
|
299
|
-
componentFor(route) {
|
|
300
|
-
return this.registry.get(route.name)?.component ?? null;
|
|
301
|
-
}
|
|
302
|
-
stackHostProps() {
|
|
303
|
-
return resolveStackProps({
|
|
304
|
-
passthrough: {
|
|
305
|
-
[STACK_ON_FINISH_TRANSITIONING]: () => dlog(`Stack: onFinishTransitioning at t=${Date.now()}`),
|
|
306
|
-
},
|
|
307
|
-
});
|
|
308
|
-
}
|
|
309
|
-
// Threads a route's merged options through the shared ~14-call resolver sequence (see
|
|
310
|
-
// core/render-stack.ts's resolveScreenRenderPlan) every per-route template method below picks
|
|
311
|
-
// its one field from. Angular has no per-route closure scope the way React's `.map`/Vue's render
|
|
312
|
-
// loop do, so each template-bound method calls this per change-detection cycle - cached below
|
|
313
|
-
// by `${route.key}:${index}` so the ~7 accessors that share a route+index resolve the plan once
|
|
314
|
-
// per actual state change instead of once per template read; `dispatch` clears the cache before
|
|
315
|
-
// recomputing so no stale entry survives a state transition. Screen appear/disappear stay
|
|
316
|
-
// adapter-owned (close over `this.dispatch`/`this.emitterFor`); the search bar passthrough
|
|
317
|
-
// carries no dlog wrapper, unlike React/Vue (see this file's own review notes) - its imperative
|
|
318
|
-
// ref rides a separate directive (searchBarRef/[symbioteSearchBarRef]), not this passthrough map.
|
|
319
|
-
planFor(route, index) {
|
|
320
|
-
const cacheKey = `${route.key}:${index}`;
|
|
321
|
-
const cached = this.planCache.get(cacheKey);
|
|
322
|
-
if (cached)
|
|
323
|
-
return cached;
|
|
324
|
-
const mergedOptions = this.mergedOptionsFor(route);
|
|
325
|
-
const searchBarOptions = mergedOptions.headerSearchBarOptions;
|
|
326
|
-
const plan = resolveScreenRenderPlan({
|
|
327
|
-
screenId: route.key,
|
|
328
|
-
index,
|
|
329
|
-
routeCount: this.stateSignal()?.routes.length ?? 1,
|
|
330
|
-
options: mergedOptions,
|
|
331
|
-
platform: NAVIGATOR_PLATFORM,
|
|
332
|
-
isAndroid: Platform.OS === 'android',
|
|
333
|
-
screenPassthrough: {
|
|
334
|
-
[SCREEN_ON_DISMISSED]: () => this.dispatch({ type: 'pop', count: 1 }),
|
|
335
|
-
[SCREEN_ON_HEADER_BACK_BUTTON_CLICKED]: () => this.dispatch({ type: 'pop', count: 1 }),
|
|
336
|
-
[SCREEN_ON_APPEAR]: () => {
|
|
337
|
-
dlog(`Stack: route "${route.name}" appeared (focus)`);
|
|
338
|
-
this.emitterFor(route.key).emit(NAVIGATION_EVENT_FOCUS);
|
|
339
|
-
},
|
|
340
|
-
[SCREEN_ON_DISAPPEAR]: () => {
|
|
341
|
-
dlog(`Stack: route "${route.name}" disappeared (blur)`);
|
|
342
|
-
this.emitterFor(route.key).emit(NAVIGATION_EVENT_BLUR);
|
|
343
|
-
},
|
|
344
|
-
},
|
|
345
|
-
searchBarPassthrough: searchBarOptions
|
|
346
|
-
? buildSearchBarPassthrough(searchBarOptions)
|
|
347
|
-
: undefined,
|
|
348
|
-
});
|
|
349
|
-
this.planCache.set(cacheKey, plan);
|
|
350
|
-
return plan;
|
|
351
|
-
}
|
|
352
|
-
outerScreenIsModal(route, index) {
|
|
353
|
-
return this.planFor(route, index).screenViewName === RNS_MODAL_SCREEN_VIEW_NAME;
|
|
354
|
-
}
|
|
355
|
-
isInModal(route, index) {
|
|
356
|
-
return this.planFor(route, index).inModal;
|
|
357
|
-
}
|
|
358
|
-
screenHostProps(route, index) {
|
|
359
|
-
return this.planFor(route, index).screenProps;
|
|
360
|
-
}
|
|
361
|
-
innerStackProps() {
|
|
362
|
-
return { style: resolveHeaderInModalStackStyle() };
|
|
363
|
-
}
|
|
364
|
-
innerScreenProps(route, index) {
|
|
365
|
-
const plan = this.planFor(route, index);
|
|
366
|
-
return { style: plan.innerScreenStyle, activityState: plan.activityState };
|
|
367
|
-
}
|
|
368
|
-
contentWrapperProps(route, index) {
|
|
369
|
-
return this.planFor(route, index).contentWrapperProps;
|
|
370
|
-
}
|
|
371
|
-
headerConfigProps(route, index) {
|
|
372
|
-
return this.planFor(route, index).headerConfig.props;
|
|
373
|
-
}
|
|
374
|
-
hasSearchBar(route) {
|
|
375
|
-
return this.mergedOptionsFor(route).headerSearchBarOptions !== undefined;
|
|
376
|
-
}
|
|
377
|
-
searchBarRef(route) {
|
|
378
|
-
return this.mergedOptionsFor(route).headerSearchBarOptions?.ref;
|
|
379
|
-
}
|
|
380
|
-
searchBarProps(route, index) {
|
|
381
|
-
return this.planFor(route, index).searchBarProps ?? {};
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
return Stack = _classThis;
|
|
385
|
-
})();
|
|
386
|
-
export { Stack };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type Type } from '@angular/core';
|
|
2
|
-
import type { IRoute, ITabOptions } from '../core';
|
|
3
|
-
import type { ITabNavigatorHandle } from '../core';
|
|
4
|
-
export type ITabScreenOptionsArgs = {
|
|
5
|
-
route: IRoute<unknown>;
|
|
6
|
-
navigation: ITabNavigatorHandle;
|
|
7
|
-
};
|
|
8
|
-
export type ITabScreenOptionsResolver = (props: ITabScreenOptionsArgs) => ITabOptions;
|
|
9
|
-
export declare class TabScreenDirective {
|
|
10
|
-
name: string;
|
|
11
|
-
component: Type<unknown>;
|
|
12
|
-
options?: ITabOptions | ITabScreenOptionsResolver;
|
|
13
|
-
initialParams?: unknown;
|
|
14
|
-
}
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
// [symbioteTabScreen]: Tab's twin of screen.directive.ts's ScreenDirective - a declarative marker
|
|
2
|
-
// read via @ContentChildren to build the static name -> {component, options} registry, then Tab
|
|
3
|
-
// mounts the FOCUSED route's component itself. Mirrors react/tab-screen.ts's TabScreen minus the
|
|
4
|
-
// stack-only concepts (no push/pop lifecycle events to wire).
|
|
5
|
-
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
6
|
-
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
7
|
-
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
8
|
-
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
9
|
-
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
10
|
-
var _, done = false;
|
|
11
|
-
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
12
|
-
var context = {};
|
|
13
|
-
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
14
|
-
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
15
|
-
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
16
|
-
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
17
|
-
if (kind === "accessor") {
|
|
18
|
-
if (result === void 0) continue;
|
|
19
|
-
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
20
|
-
if (_ = accept(result.get)) descriptor.get = _;
|
|
21
|
-
if (_ = accept(result.set)) descriptor.set = _;
|
|
22
|
-
if (_ = accept(result.init)) initializers.unshift(_);
|
|
23
|
-
}
|
|
24
|
-
else if (_ = accept(result)) {
|
|
25
|
-
if (kind === "field") initializers.unshift(_);
|
|
26
|
-
else descriptor[key] = _;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
30
|
-
done = true;
|
|
31
|
-
};
|
|
32
|
-
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
33
|
-
var useValue = arguments.length > 2;
|
|
34
|
-
for (var i = 0; i < initializers.length; i++) {
|
|
35
|
-
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
36
|
-
}
|
|
37
|
-
return useValue ? value : void 0;
|
|
38
|
-
};
|
|
39
|
-
import { Directive, Input } from '@angular/core';
|
|
40
|
-
let TabScreenDirective = (() => {
|
|
41
|
-
let _classDecorators = [Directive({
|
|
42
|
-
selector: 'ng-template[symbioteTabScreen]',
|
|
43
|
-
standalone: true,
|
|
44
|
-
})];
|
|
45
|
-
let _classDescriptor;
|
|
46
|
-
let _classExtraInitializers = [];
|
|
47
|
-
let _classThis;
|
|
48
|
-
let _name_decorators;
|
|
49
|
-
let _name_initializers = [];
|
|
50
|
-
let _name_extraInitializers = [];
|
|
51
|
-
let _component_decorators;
|
|
52
|
-
let _component_initializers = [];
|
|
53
|
-
let _component_extraInitializers = [];
|
|
54
|
-
let _options_decorators;
|
|
55
|
-
let _options_initializers = [];
|
|
56
|
-
let _options_extraInitializers = [];
|
|
57
|
-
let _initialParams_decorators;
|
|
58
|
-
let _initialParams_initializers = [];
|
|
59
|
-
let _initialParams_extraInitializers = [];
|
|
60
|
-
var TabScreenDirective = class {
|
|
61
|
-
static { _classThis = this; }
|
|
62
|
-
static {
|
|
63
|
-
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0;
|
|
64
|
-
_name_decorators = [Input({ required: true })];
|
|
65
|
-
_component_decorators = [Input({ required: true })];
|
|
66
|
-
_options_decorators = [Input()];
|
|
67
|
-
_initialParams_decorators = [Input()];
|
|
68
|
-
__esDecorate(null, null, _name_decorators, { kind: "field", name: "name", static: false, private: false, access: { has: obj => "name" in obj, get: obj => obj.name, set: (obj, value) => { obj.name = value; } }, metadata: _metadata }, _name_initializers, _name_extraInitializers);
|
|
69
|
-
__esDecorate(null, null, _component_decorators, { kind: "field", name: "component", static: false, private: false, access: { has: obj => "component" in obj, get: obj => obj.component, set: (obj, value) => { obj.component = value; } }, metadata: _metadata }, _component_initializers, _component_extraInitializers);
|
|
70
|
-
__esDecorate(null, null, _options_decorators, { kind: "field", name: "options", static: false, private: false, access: { has: obj => "options" in obj, get: obj => obj.options, set: (obj, value) => { obj.options = value; } }, metadata: _metadata }, _options_initializers, _options_extraInitializers);
|
|
71
|
-
__esDecorate(null, null, _initialParams_decorators, { kind: "field", name: "initialParams", static: false, private: false, access: { has: obj => "initialParams" in obj, get: obj => obj.initialParams, set: (obj, value) => { obj.initialParams = value; } }, metadata: _metadata }, _initialParams_initializers, _initialParams_extraInitializers);
|
|
72
|
-
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
73
|
-
TabScreenDirective = _classThis = _classDescriptor.value;
|
|
74
|
-
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
75
|
-
__runInitializers(_classThis, _classExtraInitializers);
|
|
76
|
-
}
|
|
77
|
-
name = __runInitializers(this, _name_initializers, void 0);
|
|
78
|
-
component = (__runInitializers(this, _name_extraInitializers), __runInitializers(this, _component_initializers, void 0));
|
|
79
|
-
options = (__runInitializers(this, _component_extraInitializers), __runInitializers(this, _options_initializers, void 0));
|
|
80
|
-
initialParams = (__runInitializers(this, _options_extraInitializers), __runInitializers(this, _initialParams_initializers, void 0));
|
|
81
|
-
constructor() {
|
|
82
|
-
__runInitializers(this, _initialParams_extraInitializers);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
return TabScreenDirective = _classThis;
|
|
86
|
-
})();
|
|
87
|
-
export { TabScreenDirective };
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type AfterContentInit, type OnDestroy, type Type } from '@angular/core';
|
|
2
|
-
import type { IDescriptor } from '@symbiote-native/components';
|
|
3
|
-
import type { INavigationEmitter, IRoute, ITabNavigatorHandle, ITabOptions } from '../../core';
|
|
4
|
-
export type { ITabNavigatorHandle } from '../../core';
|
|
5
|
-
export declare class Tab implements AfterContentInit, OnDestroy, ITabNavigatorHandle {
|
|
6
|
-
private readonly tabScreenChildren;
|
|
7
|
-
initialRouteName?: string;
|
|
8
|
-
screenOptions?: ITabOptions;
|
|
9
|
-
readonly rootStyle: {
|
|
10
|
-
flex: number;
|
|
11
|
-
};
|
|
12
|
-
readonly contentStyle: {
|
|
13
|
-
flex: number;
|
|
14
|
-
};
|
|
15
|
-
private readonly routeIdPrefix;
|
|
16
|
-
private readonly registry;
|
|
17
|
-
private tabScreenChildrenSubscription;
|
|
18
|
-
private readonly stateSignal;
|
|
19
|
-
readonly state: import("@angular/core").Signal<Readonly<{
|
|
20
|
-
routes: readonly Readonly<{
|
|
21
|
-
key: string;
|
|
22
|
-
name: string;
|
|
23
|
-
params: unknown;
|
|
24
|
-
}>[];
|
|
25
|
-
index: number;
|
|
26
|
-
}> | undefined>;
|
|
27
|
-
private currentEmitterKey;
|
|
28
|
-
private currentEmitter;
|
|
29
|
-
readonly jumpTo: (name: string, params?: unknown) => void;
|
|
30
|
-
readonly setParams: (params: unknown, key: string) => void;
|
|
31
|
-
ngAfterContentInit(): void;
|
|
32
|
-
ngOnDestroy(): void;
|
|
33
|
-
private rebuildRegistry;
|
|
34
|
-
private routesFromRegistry;
|
|
35
|
-
private initializeState;
|
|
36
|
-
private dispatch;
|
|
37
|
-
private resolveTabOptions;
|
|
38
|
-
focusedRoute(): IRoute<unknown> | undefined;
|
|
39
|
-
componentForRoute(route: IRoute<unknown>): Type<unknown> | null;
|
|
40
|
-
focusedRouteEmitter(): INavigationEmitter;
|
|
41
|
-
tabBarDescriptor(): IDescriptor;
|
|
42
|
-
}
|