@symbiote-native/navigation 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/README.md +159 -0
  2. package/package.json +12 -11
  3. package/build-ngc/angular/drawer.d.ts +0 -79
  4. package/build-ngc/angular/drawer.js +0 -475
  5. package/build-ngc/angular/drawer.js.map +0 -1
  6. package/build-ngc/angular/stack.d.ts +0 -58
  7. package/build-ngc/angular/stack.js +0 -402
  8. package/build-ngc/angular/stack.js.map +0 -1
  9. package/build-ngc/angular/tabs.d.ts +0 -45
  10. package/build-ngc/angular/tabs.js +0 -231
  11. package/build-ngc/angular/tabs.js.map +0 -1
  12. package/build-ngc/core/drawer-options.d.ts +0 -64
  13. package/build-ngc/core/drawer-options.js +0 -201
  14. package/build-ngc/core/drawer-options.js.map +0 -1
  15. package/build-ngc/core/drawer-router-state.d.ts +0 -21
  16. package/build-ngc/core/drawer-router-state.js +0 -41
  17. package/build-ngc/core/drawer-router-state.js.map +0 -1
  18. package/build-ngc/core/href.d.ts +0 -16
  19. package/build-ngc/core/href.js +0 -55
  20. package/build-ngc/core/href.js.map +0 -1
  21. package/build-ngc/core/linking-config.d.ts +0 -13
  22. package/build-ngc/core/linking-config.js +0 -172
  23. package/build-ngc/core/linking-config.js.map +0 -1
  24. package/build-ngc/core/navigation-events.d.ts +0 -16
  25. package/build-ngc/core/navigation-events.js +0 -58
  26. package/build-ngc/core/navigation-events.js.map +0 -1
  27. package/build-ngc/core/navigator-handles.d.ts +0 -30
  28. package/build-ngc/core/navigator-handles.js +0 -16
  29. package/build-ngc/core/navigator-handles.js.map +0 -1
  30. package/build-ngc/core/navigator-state.d.ts +0 -36
  31. package/build-ngc/core/navigator-state.js +0 -82
  32. package/build-ngc/core/navigator-state.js.map +0 -1
  33. package/build-ngc/core/search-params.d.ts +0 -9
  34. package/build-ngc/core/search-params.js +0 -60
  35. package/build-ngc/core/search-params.js.map +0 -1
  36. package/build-ngc/core/state-persistence.d.ts +0 -3
  37. package/build-ngc/core/state-persistence.js +0 -24
  38. package/build-ngc/core/state-persistence.js.map +0 -1
  39. package/build-ngc/core/tab-router-state.d.ts +0 -19
  40. package/build-ngc/core/tab-router-state.js +0 -52
  41. package/build-ngc/core/tab-router-state.js.map +0 -1
@@ -1,231 +0,0 @@
1
- // Tab, the Angular lifecycle half. The focused-index router (tab-router-state) and the tab-bar
2
- // Descriptor builder (render-tabs) live in @symbiote-native/navigation core, shared verbatim with
3
- // the React/Vue adapters; here Angular supplies the lifecycle — a signal for the focused index, a
4
- // per-instance counter for route-key generation, `jumpTo`/`setParams` as plain public methods
5
- // directly on the class (no ref forwarding needed, see stack.ts's header, same reasoning: `Tab
6
- // implements ITabNavigatorHandle`) - plus the descriptor bridge (`symbiote-descriptor-outlet`,
7
- // `@symbiote-native/angular`) for the tab-bar leaf, exactly like Stack bridges its header config.
8
- // Unlike Stack, a bottom-tabs bar is a PURE-JS UI: it paints
9
- // ordinary `symbiote-view`/`symbiote-text` primitives via the shared render fn, so there is no
10
- // react-native-screens ViewConfig to register — Tab needs no `../register` import. Every tag this
11
- // template names (`View`, `symbiote-descriptor-outlet`) is a REAL imported Angular component (no
12
- // raw non-dashed native tag names the way stack.ts needs `NO_ERRORS_SCHEMA` for), so no loosened
13
- // schema is needed here at all.
14
- //
15
- // RESOLVED (see stack.ts's header, identical reasoning): `'Tab'` has an `ANCHOR_HOST_COMPONENTS`
16
- // entry in `adapters/angular/src/renderer.ts`, so a real device build paints `<Tab>` correctly as
17
- // a nested tag.
18
- import { ChangeDetectionStrategy, Component, ContentChildren, Input, QueryList, signal, untracked, } from '@angular/core';
19
- import { NgComponentOutlet } from '@angular/common';
20
- import { dlog } from '@symbiote-native/engine';
21
- import { DescriptorOutlet, View } from '@symbiote-native/angular';
22
- import { NAVIGATION_EVENT_BLUR, NAVIGATION_EVENT_FOCUS, createInitialTabState, createNavigationEmitter, diffFocusedRoute, isFocusedRoute, renderTabBar, tabRouterReducer, } from '../core';
23
- import { NavigationScopeDirective } from './navigation-scope.directive';
24
- import { TabScreenDirective } from './tab-screen.directive';
25
- import * as i0 from "@angular/core";
26
- const TAB_ROOT_STYLE = { flex: 1 };
27
- const TAB_CONTENT_STYLE = { flex: 1 };
28
- let tabInstanceCounter = 0;
29
- export class Tab {
30
- tabScreenChildren;
31
- initialRouteName;
32
- screenOptions;
33
- rootStyle = TAB_ROOT_STYLE;
34
- contentStyle = TAB_CONTENT_STYLE;
35
- routeIdPrefix = `tab-${(tabInstanceCounter += 1)}`;
36
- // Keyed by name -> the LIVE TabScreenDirective instance — see stack.ts's matching comment for
37
- // why a snapshot copy would go stale on an in-place `[options]`/`[component]` change.
38
- registry = new Map();
39
- tabScreenChildrenSubscription;
40
- stateSignal = signal(undefined, /* @ts-ignore */
41
- ...(ngDevMode ? [{ debugName: "stateSignal" }] : /* istanbul ignore next */ []));
42
- state = this.stateSignal.asReadonly();
43
- currentEmitterKey;
44
- currentEmitter;
45
- jumpTo = (name, params) => this.dispatch({ type: 'jumpTo', name, params });
46
- setParams = (params, key) => this.dispatch({ type: 'setParams', key, params });
47
- ngAfterContentInit() {
48
- this.rebuildRegistry();
49
- this.initializeState();
50
- this.tabScreenChildrenSubscription = this.tabScreenChildren.changes.subscribe(() => {
51
- this.rebuildRegistry();
52
- });
53
- }
54
- ngOnDestroy() {
55
- this.tabScreenChildrenSubscription?.unsubscribe();
56
- if (this.currentEmitter)
57
- this.currentEmitter.emit(NAVIGATION_EVENT_BLUR);
58
- }
59
- rebuildRegistry() {
60
- this.registry.clear();
61
- for (const screen of this.tabScreenChildren) {
62
- this.registry.set(screen.name, screen);
63
- }
64
- }
65
- routesFromRegistry() {
66
- return Array.from(this.registry.entries()).map(([name, entry]) => ({
67
- key: `${this.routeIdPrefix}-${name}`,
68
- name,
69
- params: entry.initialParams,
70
- }));
71
- }
72
- initializeState() {
73
- if (this.stateSignal() !== undefined)
74
- return;
75
- const routes = this.routesFromRegistry();
76
- if (routes.length === 0)
77
- dlog('Tab: no <ng-template symbioteTabScreen> children registered');
78
- this.stateSignal.set(createInitialTabState(routes, this.initialRouteName));
79
- }
80
- dispatch(action) {
81
- const current = this.stateSignal();
82
- if (current === undefined)
83
- return;
84
- this.stateSignal.set(tabRouterReducer(current, action));
85
- }
86
- resolveTabOptions(entry, route) {
87
- const props = { route, navigation: this };
88
- const own = typeof entry.options === 'function' ? entry.options(props) : entry.options;
89
- return { ...this.screenOptions, ...own };
90
- }
91
- focusedRoute() {
92
- const state = this.stateSignal();
93
- return state?.routes[state.index];
94
- }
95
- componentForRoute(route) {
96
- return this.registry.get(route.name)?.component ?? null;
97
- }
98
- // Lazily creates/replaces the focused route's emitter and synthesizes focus/blur — Tab paints
99
- // its own bar in pure JS (no native onAppear/onDisappear the way Stack's RNSScreen has), so
100
- // focus/blur is synthesized here exactly like react/tabs.ts's own useEffect does, just idempotent
101
- // per read (called repeatedly with the same key during one CD pass) instead of dependency-array
102
- // gated. Keyed on the route KEY, not the object, so a setParams-only change doesn't re-fire.
103
- //
104
- // Called from the template ([emitter]="focusedRouteEmitter()"), which runs inside Angular's
105
- // reactive-read tracking context for the current CD pass — unlike React's useEffect, which runs
106
- // in a separate post-commit phase. Two consequences of that, both fixed below:
107
- //
108
- // 1. Writing a signal from inside a tracked template read throws Angular's NG600 ("signal write
109
- // during a template execution") — untracked() opts this whole synthesis out of that tracking
110
- // context, matching what the post-commit useEffect phase gives React for free.
111
- // 2. The NEW route's screen component (injectIsFocused's listener source) is created by
112
- // *ngComponentOutlet AFTER this binding is evaluated, but still within the SAME synchronous
113
- // template refresh — so emitting FOCUS right here fires to zero listeners and is silently
114
- // lost forever (isFocused stays false permanently, even for the very first-focused screen).
115
- // queueMicrotask defers the FOCUS emit past the end of the current synchronous refresh
116
- // (which includes the new screen's construction), guaranteeing its injectIsFocused()
117
- // listener is already attached by the time it fires. BLUR doesn't need this: the outgoing
118
- // screen's listener was already attached on an earlier tick, so it's safe to fire now.
119
- focusedRouteEmitter() {
120
- const key = this.focusedRoute()?.key;
121
- return untracked(() => {
122
- if (key === this.currentEmitterKey && this.currentEmitter)
123
- return this.currentEmitter;
124
- const { blurKey, focusKey } = diffFocusedRoute(this.currentEmitterKey, key);
125
- if (blurKey !== undefined && this.currentEmitter) {
126
- dlog('Tab: previous route blurred');
127
- this.currentEmitter.emit(NAVIGATION_EVENT_BLUR);
128
- }
129
- const emitter = createNavigationEmitter();
130
- this.currentEmitter = emitter;
131
- this.currentEmitterKey = key;
132
- if (focusKey !== undefined) {
133
- queueMicrotask(() => {
134
- if (this.currentEmitter !== emitter)
135
- return; // superseded by a later switch
136
- dlog(`Tab: route "${this.focusedRoute()?.name}" focused`);
137
- emitter.emit(NAVIGATION_EVENT_FOCUS);
138
- });
139
- }
140
- return emitter;
141
- });
142
- }
143
- tabBarDescriptor() {
144
- const state = this.stateSignal();
145
- const routes = state?.routes ?? [];
146
- const focusedIndex = state?.index ?? 0;
147
- const items = routes.map((route, index) => {
148
- const entry = this.registry.get(route.name);
149
- const focused = isFocusedRoute(index, focusedIndex);
150
- if (!entry) {
151
- dlog(`Tab: no screen registered for route name "${route.name}"`);
152
- return { key: route.key, focused, label: route.name, passthrough: {} };
153
- }
154
- const options = this.resolveTabOptions(entry, route);
155
- return {
156
- key: route.key,
157
- focused,
158
- label: options.tabBarLabel ?? options.title ?? route.name,
159
- icon: options.tabBarIcon,
160
- badge: options.tabBarBadge,
161
- activeTintColor: options.tabBarActiveTintColor,
162
- inactiveTintColor: options.tabBarInactiveTintColor,
163
- passthrough: {
164
- onPress: () => this.jumpTo(route.name),
165
- accessibilityRole: 'tab',
166
- accessibilityState: { selected: focused },
167
- },
168
- };
169
- });
170
- const focusedRoute = this.focusedRoute();
171
- const focusedEntry = focusedRoute ? this.registry.get(focusedRoute.name) : undefined;
172
- const focusedOptions = focusedEntry && focusedRoute
173
- ? this.resolveTabOptions(focusedEntry, focusedRoute)
174
- : this.screenOptions;
175
- return renderTabBar({ items, style: focusedOptions?.tabBarStyle, passthrough: {} });
176
- }
177
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Tab, deps: [], target: i0.ɵɵFactoryTarget.Component });
178
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Tab, isStandalone: true, selector: "Tab", inputs: { initialRouteName: "initialRouteName", screenOptions: "screenOptions" }, queries: [{ propertyName: "tabScreenChildren", predicate: TabScreenDirective }], ngImport: i0, template: `
179
- <View [style]="rootStyle">
180
- <View [style]="contentStyle">
181
- @if (focusedRoute(); as route) {
182
- @if (componentForRoute(route); as component) {
183
- <ng-container
184
- [symbioteNavigationScope]="route"
185
- [navigation]="this"
186
- [emitter]="focusedRouteEmitter()"
187
- >
188
- <ng-container *ngComponentOutlet="component" />
189
- </ng-container>
190
- }
191
- }
192
- </View>
193
- <symbiote-descriptor-outlet [node]="tabBarDescriptor()" />
194
- </View>
195
- `, isInline: true, dependencies: [{ kind: "directive", type: NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInputs", "ngComponentOutletInjector", "ngComponentOutletEnvironmentInjector", "ngComponentOutletContent", "ngComponentOutletNgModule"], exportAs: ["ngComponentOutlet"] }, { kind: "directive", type: NavigationScopeDirective, selector: "[symbioteNavigationScope]", inputs: ["symbioteNavigationScope", "navigation", "emitter"] }, { kind: "component", type: DescriptorOutlet, selector: "symbiote-descriptor-outlet", inputs: ["node"] }, { kind: "component", type: View, selector: "symbiote-view, View" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
196
- }
197
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Tab, decorators: [{
198
- type: Component,
199
- args: [{
200
- selector: 'Tab',
201
- standalone: true,
202
- imports: [NgComponentOutlet, NavigationScopeDirective, DescriptorOutlet, View],
203
- changeDetection: ChangeDetectionStrategy.OnPush,
204
- template: `
205
- <View [style]="rootStyle">
206
- <View [style]="contentStyle">
207
- @if (focusedRoute(); as route) {
208
- @if (componentForRoute(route); as component) {
209
- <ng-container
210
- [symbioteNavigationScope]="route"
211
- [navigation]="this"
212
- [emitter]="focusedRouteEmitter()"
213
- >
214
- <ng-container *ngComponentOutlet="component" />
215
- </ng-container>
216
- }
217
- }
218
- </View>
219
- <symbiote-descriptor-outlet [node]="tabBarDescriptor()" />
220
- </View>
221
- `,
222
- }]
223
- }], propDecorators: { tabScreenChildren: [{
224
- type: ContentChildren,
225
- args: [TabScreenDirective]
226
- }], initialRouteName: [{
227
- type: Input
228
- }], screenOptions: [{
229
- type: Input
230
- }] } });
231
- //# sourceMappingURL=tabs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tabs.js","sourceRoot":"","sources":["../../src/angular/tabs.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,kGAAkG;AAClG,kGAAkG;AAClG,8FAA8F;AAC9F,+FAA+F;AAC/F,+FAA+F;AAC/F,kGAAkG;AAClG,6DAA6D;AAC7D,+FAA+F;AAC/F,kGAAkG;AAClG,iGAAiG;AACjG,iGAAiG;AACjG,gCAAgC;AAChC,EAAE;AACF,iGAAiG;AACjG,kGAAkG;AAClG,gBAAgB;AAEhB,OAAO,EACL,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,KAAK,EACL,SAAS,EACT,MAAM,EACN,SAAS,GAIV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,uBAAuB,EACvB,gBAAgB,EAChB,cAAc,EACd,YAAY,EACZ,gBAAgB,GACjB,MAAM,SAAS,CAAC;AAUjB,OAAO,EAAE,wBAAwB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,CAAC;QAEzB,OAAO,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC,CAAC;IACtF,CAAC;uGApKU,GAAG;2FAAH,GAAG,mLACG,kBAAkB,6BApBzB;;;;;;;;;;;;;;;;;GAiBT,4DAnBS,iBAAiB,yRAAE,wBAAwB,oIAAE,gBAAgB,yFAAE,IAAI;;2FAqBlE,GAAG;kBAxBf,SAAS;mBAAC;oBACT,QAAQ,EAAE,KAAK;oBACf,UAAU,EAAE,IAAI;oBAChB,OAAO,EAAE,CAAC,iBAAiB,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,IAAI,CAAC;oBAC9E,eAAe,EAAE,uBAAuB,CAAC,MAAM;oBAC/C,QAAQ,EAAE;;;;;;;;;;;;;;;;;GAiBT;iBACF;;sBAEE,eAAe;uBAAC,kBAAkB;;sBAGlC,KAAK;;sBACL,KAAK"}
@@ -1,64 +0,0 @@
1
- import type { IPanResponderGestureState, ISymbioteEvent } from '@symbiote-native/engine';
2
- export type IDrawerType = 'front' | 'back' | 'slide' | 'permanent';
3
- export type IDrawerPosition = 'left' | 'right';
4
- export interface IDrawerOptions {
5
- drawerType?: IDrawerType;
6
- drawerPosition?: IDrawerPosition;
7
- drawerWidth?: number;
8
- overlayColor?: string;
9
- swipeEnabled?: boolean;
10
- swipeEdgeWidth?: number;
11
- swipeMinDistance?: number;
12
- swipeMinVelocity?: number;
13
- }
14
- export interface IDrawerScreenOptions {
15
- title?: string;
16
- drawerLabel?: string;
17
- }
18
- export declare const DRAWER_DEFAULT_TYPE: IDrawerType;
19
- export declare const DRAWER_DEFAULT_POSITION: IDrawerPosition;
20
- export declare const DRAWER_DEFAULT_WIDTH = 280;
21
- export declare const DRAWER_DEFAULT_OVERLAY_COLOR = "rgba(0, 0, 0, 0.5)";
22
- export declare const DRAWER_DEFAULT_SWIPE_ENABLED = true;
23
- export declare const DRAWER_DEFAULT_SWIPE_EDGE_WIDTH = 32;
24
- export declare const DRAWER_DEFAULT_SWIPE_MIN_DISTANCE = 60;
25
- export declare const DRAWER_DEFAULT_SWIPE_MIN_VELOCITY = 0.5;
26
- export declare function resolveDrawerWidth(options: IDrawerOptions): number;
27
- export declare function resolveDrawerType(options: IDrawerOptions): IDrawerType;
28
- export declare function resolveDrawerPosition(options: IDrawerOptions): IDrawerPosition;
29
- export type IDrawerGeometry = {
30
- panelTranslateXClosed: number;
31
- panelTranslateXOpen: number;
32
- contentTranslateXClosed: number;
33
- contentTranslateXOpen: number;
34
- overlayOpacityClosed: number;
35
- overlayOpacityOpen: number;
36
- };
37
- export declare function isDrawerAnimated(options: IDrawerOptions): boolean;
38
- export declare function isDrawerOverlayVisible(options: IDrawerOptions): boolean;
39
- export declare function resolveDrawerGeometry(options: IDrawerOptions): IDrawerGeometry;
40
- export type IDrawerInterpolationRange = {
41
- inputRange: readonly [number, number];
42
- outputRange: readonly [number, number];
43
- };
44
- export type IDrawerContentSlotInterpolation = {
45
- translateX: IDrawerInterpolationRange;
46
- };
47
- export type IDrawerOverlaySlotInterpolation = {
48
- opacity: IDrawerInterpolationRange;
49
- translateX: IDrawerInterpolationRange;
50
- };
51
- export type IDrawerPanelSlotInterpolation = {
52
- translateX: IDrawerInterpolationRange;
53
- };
54
- export declare function resolveDrawerSlotInterpolation(geometry: IDrawerGeometry, slot: 'content'): IDrawerContentSlotInterpolation;
55
- export declare function resolveDrawerSlotInterpolation(geometry: IDrawerGeometry, slot: 'overlay'): IDrawerOverlaySlotInterpolation;
56
- export declare function resolveDrawerSlotInterpolation(geometry: IDrawerGeometry, slot: 'panel'): IDrawerPanelSlotInterpolation;
57
- export declare function isSwipeStartInEdge(startX: number, screenWidth: number, isOpen: boolean, options: IDrawerOptions): boolean;
58
- export declare function isHorizontalDrag(gestureState: IPanResponderGestureState): boolean;
59
- export type ISwipeIntent = 'open' | 'close';
60
- export declare function resolveSwipeIntent(gestureState: IPanResponderGestureState, isOpen: boolean, options: IDrawerOptions): ISwipeIntent;
61
- export declare function clamp01(value: number): number;
62
- export declare function startPageXOf(event: ISymbioteEvent): number | undefined;
63
- export declare function resolveDragProgress(gestureState: IPanResponderGestureState, dragStartProgress: number, options: IDrawerOptions): number;
64
- export declare function shouldClaimDrawerSwipe(event: ISymbioteEvent, gestureState: IPanResponderGestureState, screenWidth: number, isOpen: boolean, options: IDrawerOptions, phase: 'start' | 'move'): boolean;
@@ -1,201 +0,0 @@
1
- // Drawer option types + the pure swipe/geometry math. Framework-agnostic (numbers and
2
- // booleans only, per CLAUDE.md <prop_types_split_agnostic_vs_per_adapter>), shared verbatim by
3
- // every adapter. Mirrors react-navigation's Drawer prop surface (confirmed against the current
4
- // @react-navigation/drawer docs): drawerType 'front'/'back'/'slide'/'permanent', drawerPosition,
5
- // drawerWidth, overlayColor, swipeEnabled + the three swipe-tuning knobs. What is NOT ported:
6
- // `configureGestureHandler` — a react-native-gesture-handler-specific escape hatch with no
7
- // PanResponder equivalent (see packages/navigation's README / the drawer feasibility note for the
8
- // full gap list).
9
- import { isRecord } from './guards';
10
- export const DRAWER_DEFAULT_TYPE = 'front';
11
- export const DRAWER_DEFAULT_POSITION = 'left';
12
- export const DRAWER_DEFAULT_WIDTH = 280;
13
- export const DRAWER_DEFAULT_OVERLAY_COLOR = 'rgba(0, 0, 0, 0.5)';
14
- export const DRAWER_DEFAULT_SWIPE_ENABLED = true;
15
- export const DRAWER_DEFAULT_SWIPE_EDGE_WIDTH = 32;
16
- export const DRAWER_DEFAULT_SWIPE_MIN_DISTANCE = 60;
17
- // react-navigation's 500 is px/second; gestureState.vx is px/ms, so the default converts.
18
- export const DRAWER_DEFAULT_SWIPE_MIN_VELOCITY = 0.5;
19
- // Exported so render-drawer.ts and the adapter can resolve the same defaults without
20
- // re-declaring the `??` fallback (a second copy would drift the instant a default changes).
21
- export function resolveDrawerWidth(options) {
22
- return options.drawerWidth ?? DRAWER_DEFAULT_WIDTH;
23
- }
24
- export function resolveDrawerType(options) {
25
- return options.drawerType ?? DRAWER_DEFAULT_TYPE;
26
- }
27
- export function resolveDrawerPosition(options) {
28
- return options.drawerPosition ?? DRAWER_DEFAULT_POSITION;
29
- }
30
- export function isDrawerAnimated(options) {
31
- return resolveDrawerType(options) !== 'permanent';
32
- }
33
- export function isDrawerOverlayVisible(options) {
34
- const type = resolveDrawerType(options);
35
- return type === 'front' || type === 'slide';
36
- }
37
- // front: only the panel moves (-width -> 0), content stays put, overlay fades in.
38
- // back: only the content moves, away from the position edge, to reveal the stationary panel;
39
- // no overlay (the panel sits fully behind the content, nothing to dim).
40
- // slide: panel AND content move together by the same delta, overlay fades in (content still
41
- // covers the panel partially as they slide in tandem, same as front visually at rest).
42
- // permanent: static, all zero (isDrawerAnimated() gates callers off this path already).
43
- export function resolveDrawerGeometry(options) {
44
- const width = resolveDrawerWidth(options);
45
- const type = resolveDrawerType(options);
46
- const sign = resolveDrawerPosition(options) === 'left' ? 1 : -1;
47
- const closedPanelX = -sign * width;
48
- const openContentX = sign * width;
49
- switch (type) {
50
- case 'back':
51
- return {
52
- panelTranslateXClosed: 0,
53
- panelTranslateXOpen: 0,
54
- contentTranslateXClosed: 0,
55
- contentTranslateXOpen: openContentX,
56
- overlayOpacityClosed: 0,
57
- overlayOpacityOpen: 0,
58
- };
59
- case 'slide':
60
- return {
61
- panelTranslateXClosed: closedPanelX,
62
- panelTranslateXOpen: 0,
63
- contentTranslateXClosed: 0,
64
- contentTranslateXOpen: openContentX,
65
- overlayOpacityClosed: 0,
66
- overlayOpacityOpen: 1,
67
- };
68
- case 'front':
69
- case 'permanent':
70
- default:
71
- return {
72
- panelTranslateXClosed: closedPanelX,
73
- panelTranslateXOpen: 0,
74
- contentTranslateXClosed: 0,
75
- contentTranslateXOpen: 0,
76
- overlayOpacityClosed: 0,
77
- overlayOpacityOpen: 1,
78
- };
79
- }
80
- }
81
- const DRAWER_PROGRESS_INPUT_RANGE = [0, 1];
82
- export function resolveDrawerSlotInterpolation(geometry, slot) {
83
- switch (slot) {
84
- case 'content':
85
- return {
86
- translateX: {
87
- inputRange: DRAWER_PROGRESS_INPUT_RANGE,
88
- outputRange: [geometry.contentTranslateXClosed, geometry.contentTranslateXOpen],
89
- },
90
- };
91
- case 'overlay':
92
- return {
93
- opacity: {
94
- inputRange: DRAWER_PROGRESS_INPUT_RANGE,
95
- outputRange: [geometry.overlayOpacityClosed, geometry.overlayOpacityOpen],
96
- },
97
- translateX: {
98
- inputRange: DRAWER_PROGRESS_INPUT_RANGE,
99
- outputRange: [geometry.contentTranslateXClosed, geometry.contentTranslateXOpen],
100
- },
101
- };
102
- case 'panel':
103
- return {
104
- translateX: {
105
- inputRange: DRAWER_PROGRESS_INPUT_RANGE,
106
- outputRange: [geometry.panelTranslateXClosed, geometry.panelTranslateXOpen],
107
- },
108
- };
109
- }
110
- }
111
- // onStartShouldSetPanResponder gate: while closed, a swipe must START within swipeEdgeWidth of
112
- // the drawer's position edge (mirrors react-navigation's swipeEdgeWidth). While open, the whole
113
- // content + overlay area is fair game to drag-close, matching the intuitive "swipe anywhere to
114
- // dismiss an open drawer" behavior every drawer implementation (including RN's dropped native
115
- // DrawerLayoutAndroid) shares.
116
- export function isSwipeStartInEdge(startX, screenWidth, isOpen, options) {
117
- if (isOpen)
118
- return true;
119
- const edgeWidth = options.swipeEdgeWidth ?? DRAWER_DEFAULT_SWIPE_EDGE_WIDTH;
120
- return resolveDrawerPosition(options) === 'left'
121
- ? startX <= edgeWidth
122
- : startX >= screenWidth - edgeWidth;
123
- }
124
- // onMoveShouldSetPanResponder gate: only claim the gesture once it reads as a horizontal drag
125
- // (RN's own PanResponder examples use this exact dominant-axis check to stay out of a vertical
126
- // ScrollView's way).
127
- const MOVE_CLAIM_THRESHOLD = 5;
128
- export function isHorizontalDrag(gestureState) {
129
- return (Math.abs(gestureState.dx) > MOVE_CLAIM_THRESHOLD &&
130
- Math.abs(gestureState.dx) > Math.abs(gestureState.dy));
131
- }
132
- // The release-time decision, structurally the same shape as switch.ts's shouldSnapBack: a pure
133
- // predicate over the accumulated gesture plus the option thresholds, no framework. Distance OR
134
- // velocity past its threshold, in the direction that would move the drawer toward the opposite
135
- // of its current state, snaps it there; anything else snaps back to where it started.
136
- export function resolveSwipeIntent(gestureState, isOpen, options) {
137
- const sign = resolveDrawerPosition(options) === 'left' ? 1 : -1;
138
- // Positive `signedDelta` means "dragging toward open" for a left drawer's rightward drag (and
139
- // symmetrically for a right drawer's leftward drag).
140
- const signedDx = sign * gestureState.dx;
141
- const signedVx = sign * gestureState.vx;
142
- const minDistance = options.swipeMinDistance ?? DRAWER_DEFAULT_SWIPE_MIN_DISTANCE;
143
- const minVelocity = options.swipeMinVelocity ?? DRAWER_DEFAULT_SWIPE_MIN_VELOCITY;
144
- const pastDistance = Math.abs(signedDx) >= minDistance;
145
- const pastVelocity = Math.abs(signedVx) >= minVelocity;
146
- if (!pastDistance && !pastVelocity)
147
- return isOpen ? 'open' : 'close';
148
- // Velocity wins the direction call when it clears its own threshold (a fast flick can reverse
149
- // a short drag); otherwise the drag distance's sign decides.
150
- const towardOpen = pastVelocity ? signedVx > 0 : signedDx > 0;
151
- return towardOpen ? 'open' : 'close';
152
- }
153
- export function clamp01(value) {
154
- return Math.min(1, Math.max(0, value));
155
- }
156
- function toFiniteNumber(value) {
157
- return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
158
- }
159
- // The touch's real starting page-X, read off the raw event rather than gestureState.x0: the
160
- // engine's capture phase (core/engine/src/pan-responder/index.ts's
161
- // onStartShouldSetResponderCapture/onMoveShouldSetResponderCapture) resets gestureState before
162
- // the bubble-phase onStartShouldSetPanResponder/onMoveShouldSetPanResponder gates run, so x0 is
163
- // only populated later, inside onResponderGrant. Shaped like core/engine/src/events/index.ts's
164
- // readTouchPoint but not the same function: that one requires both pageX AND pageY and returns
165
- // an {x, y} pair for touch-history bookkeeping; this only needs pageX and is private to the
166
- // SET-gate below, so it stays a separate, narrower helper rather than forcing a shared contract
167
- // onto two callers with different needs.
168
- export function startPageXOf(event) {
169
- const { nativeEvent } = event;
170
- const direct = toFiniteNumber(nativeEvent.pageX);
171
- if (direct !== undefined)
172
- return direct;
173
- const touches = nativeEvent.touches;
174
- if (Array.isArray(touches) && isRecord(touches[0]))
175
- return toFiniteNumber(touches[0].pageX);
176
- return undefined;
177
- }
178
- // onPanResponderMove's drag-to-progress math: how far the touch has traveled, in progress units
179
- // (0..1), added to wherever the drag started from. Mirrors the SAME sign convention as
180
- // resolveSwipeIntent (left drawer: rightward drag is positive-toward-open).
181
- export function resolveDragProgress(gestureState, dragStartProgress, options) {
182
- const width = resolveDrawerWidth(options);
183
- const sign = resolveDrawerPosition(options) === 'right' ? -1 : 1;
184
- const delta = (sign * gestureState.dx) / width;
185
- return clamp01(dragStartProgress + delta);
186
- }
187
- // The composed onStartShouldSetPanResponder/onMoveShouldSetPanResponder gate: swipeEnabled ->
188
- // isDrawerAnimated -> isSwipeStartInEdge, then (move only) isHorizontalDrag on top. The start
189
- // gate omits the dominant-axis check on purpose (react-navigation's own edge-swipe idiom: claim
190
- // on entering the edge, confirm direction only once movement exists to measure).
191
- export function shouldClaimDrawerSwipe(event, gestureState, screenWidth, isOpen, options, phase) {
192
- if ((options.swipeEnabled ?? DRAWER_DEFAULT_SWIPE_ENABLED) === false)
193
- return false;
194
- if (!isDrawerAnimated(options))
195
- return false;
196
- const startX = startPageXOf(event) ?? gestureState.x0;
197
- if (!isSwipeStartInEdge(startX, screenWidth, isOpen, options))
198
- return false;
199
- return phase === 'start' ? true : isHorizontalDrag(gestureState);
200
- }
201
- //# sourceMappingURL=drawer-options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drawer-options.js","sourceRoot":"","sources":["../../src/core/drawer-options.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,+FAA+F;AAC/F,+FAA+F;AAC/F,iGAAiG;AACjG,8FAA8F;AAC9F,2FAA2F;AAC3F,kGAAkG;AAClG,kBAAkB;AAGlB,OAAO,EAAE,QAAQ,EAAE,MAAM,U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CAAC,iBAAiB,GAAG,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,8FAA8F;AAC9F,8FAA8F;AAC9F,gGAAgG;AAChG,iFAAiF;AACjF,MAAM,UAAU,sBAAsB,CACpC,KAAqB,EACrB,YAAuC,EACvC,WAAmB,EACnB,MAAe,EACf,OAAuB,EACvB,KAAuB;IAEvB,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,4BAA4B,CAAC,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACnF,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IAC7C,MAAM,MAAM,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,EAAE,CAAC;IACtD,IAAI,CAAC,kBAAkB,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;QAAE,OAAO,KAAK,CAAC;IAC5E,OAAO,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACnE,CAAC"}
@@ -1,21 +0,0 @@
1
- import type { IRoute } from './navigator-state';
2
- export type { IRoute } from './navigator-state';
3
- type IRouteEntry = IRoute<unknown>;
4
- export type IDrawerRouterState = Readonly<{
5
- routes: readonly IRouteEntry[];
6
- index: number;
7
- isOpen: boolean;
8
- }>;
9
- export type IDrawerRouterAction = {
10
- type: 'jumpTo';
11
- name: string;
12
- } | {
13
- type: 'openDrawer';
14
- } | {
15
- type: 'closeDrawer';
16
- } | {
17
- type: 'toggleDrawer';
18
- };
19
- export declare function createInitialDrawerRouterState(routes: readonly IRouteEntry[], initialRouteName?: string): IDrawerRouterState;
20
- export declare function drawerRouterReducer(state: IDrawerRouterState, action: IDrawerRouterAction): IDrawerRouterState;
21
- export declare function focusedDrawerRoute(state: IDrawerRouterState): IRouteEntry | undefined;
@@ -1,41 +0,0 @@
1
- // DrawerRouter: the logic half (framework-agnostic, zero render), sibling to navigator-state.ts
2
- // and tab-router-state.ts. Unlike the stack's push/pop route array, a drawer's route list is
3
- // FIXED at mount (one entry per declared <Drawer.Screen>, collected by the adapter exactly like
4
- // Stack's/Tab's collectRegistry) — the reducer only tracks which one is focused (`index`) and
5
- // whether the drawer panel is open. Route identity/shape is `IRoute`, reused verbatim from
6
- // navigator-state.ts (same convention tab-router-state.ts follows) so all three navigators share
7
- // one route shape.
8
- const INITIAL_FOCUSED_INDEX = 0;
9
- export function createInitialDrawerRouterState(routes, initialRouteName) {
10
- if (initialRouteName === undefined) {
11
- return { routes, index: INITIAL_FOCUSED_INDEX, isOpen: false };
12
- }
13
- const index = routes.findIndex(route => route.name === initialRouteName);
14
- return { routes, index: index === -1 ? INITIAL_FOCUSED_INDEX : index, isOpen: false };
15
- }
16
- // Mirrors @react-navigation/drawer's DrawerActions: jumpTo focuses a route by NAME (TabRouter's
17
- // own convention, not the stack's by-key popTo) AND closes the drawer — selecting a destination
18
- // is itself the dismissal gesture, so a plain focus without also closing would leave the panel
19
- // covering the just-selected screen.
20
- export function drawerRouterReducer(state, action) {
21
- switch (action.type) {
22
- case 'jumpTo': {
23
- const index = state.routes.findIndex(route => route.name === action.name);
24
- if (index === -1)
25
- return state;
26
- return index === state.index && !state.isOpen ? state : { ...state, index, isOpen: false };
27
- }
28
- case 'openDrawer':
29
- return state.isOpen ? state : { ...state, isOpen: true };
30
- case 'closeDrawer':
31
- return state.isOpen ? { ...state, isOpen: false } : state;
32
- case 'toggleDrawer':
33
- return { ...state, isOpen: !state.isOpen };
34
- default:
35
- return state;
36
- }
37
- }
38
- export function focusedDrawerRoute(state) {
39
- return state.routes[state.index];
40
- }
41
- //# sourceMappingURL=drawer-router-state.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"drawer-router-state.js","sourceRoot":"","sources":["../../src/core/drawer-router-state.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,6FAA6F;AAC7F,gGAAgG;AAChG,8FAA8F;AAC9F,2FAA2F;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E,GAAG,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;QAE3D,KAAK,aAAa;YAChB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAE5D,KAAK,cAAc;YACjB,OAAO,EAAE,GAAG,KAAK,EAAE,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC;QAE7C;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAyB;IAC1D,OAAO,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
@@ -1,16 +0,0 @@
1
- import type { ILinkingConfig } from './linking-config';
2
- import type { IRoute } from './navigator-state';
3
- import type { ISearchParams } from './search-params';
4
- export type IHrefParams = ISearchParams;
5
- export type IHrefObject = {
6
- pathname: string;
7
- params?: IHrefParams;
8
- };
9
- export type IHref = string | IHrefObject;
10
- export type IResolvedHref = {
11
- name: string;
12
- params: Record<string, unknown> | undefined;
13
- };
14
- export declare function resolveHref(config: ILinkingConfig, href: IHref): IResolvedHref | null;
15
- export declare function stringifyHref(href: IHref): string;
16
- export declare function hrefFromRoute(config: ILinkingConfig, route: IRoute<unknown>): string | null;