@symbiote-native/navigation 1.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/README.md +159 -0
- package/package.json +14 -12
- 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
- package/build-ngc/angular/drawer.d.ts +0 -79
- package/build-ngc/angular/drawer.js +0 -475
- package/build-ngc/angular/drawer.js.map +0 -1
- package/build-ngc/angular/stack.d.ts +0 -58
- package/build-ngc/angular/stack.js +0 -402
- package/build-ngc/angular/stack.js.map +0 -1
- package/build-ngc/angular/tabs.d.ts +0 -45
- package/build-ngc/angular/tabs.js +0 -231
- package/build-ngc/angular/tabs.js.map +0 -1
- package/build-ngc/core/drawer-options.d.ts +0 -64
- package/build-ngc/core/drawer-options.js +0 -201
- package/build-ngc/core/drawer-options.js.map +0 -1
- package/build-ngc/core/drawer-router-state.d.ts +0 -21
- package/build-ngc/core/drawer-router-state.js +0 -41
- package/build-ngc/core/drawer-router-state.js.map +0 -1
- package/build-ngc/core/href.d.ts +0 -16
- package/build-ngc/core/href.js +0 -55
- package/build-ngc/core/href.js.map +0 -1
- package/build-ngc/core/linking-config.d.ts +0 -13
- package/build-ngc/core/linking-config.js +0 -172
- package/build-ngc/core/linking-config.js.map +0 -1
- package/build-ngc/core/navigation-events.d.ts +0 -16
- package/build-ngc/core/navigation-events.js +0 -58
- package/build-ngc/core/navigation-events.js.map +0 -1
- package/build-ngc/core/navigator-handles.d.ts +0 -30
- package/build-ngc/core/navigator-handles.js +0 -16
- package/build-ngc/core/navigator-handles.js.map +0 -1
- package/build-ngc/core/navigator-state.d.ts +0 -36
- package/build-ngc/core/navigator-state.js +0 -82
- package/build-ngc/core/navigator-state.js.map +0 -1
- package/build-ngc/core/search-params.d.ts +0 -9
- package/build-ngc/core/search-params.js +0 -60
- package/build-ngc/core/search-params.js.map +0 -1
- package/build-ngc/core/state-persistence.d.ts +0 -3
- package/build-ngc/core/state-persistence.js +0 -24
- package/build-ngc/core/state-persistence.js.map +0 -1
- package/build-ngc/core/tab-router-state.d.ts +0 -19
- package/build-ngc/core/tab-router-state.js +0 -52
- package/build-ngc/core/tab-router-state.js.map +0 -1
|
@@ -1,200 +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.js';
|
|
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
|
-
}
|
|
@@ -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,40 +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
|
-
}
|
package/build/core/guards.d.ts
DELETED
package/build/core/guards.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// Runtime guards shared across the navigation package's core. Centralizes what used to be ~11
|
|
2
|
-
// independent copies of the same `typeof value === 'object' && value !== null` check scattered
|
|
3
|
-
// across core and every adapter (route-param merges, persisted-JSON validation, vnode-prop
|
|
4
|
-
// narrowing, gesture-event field reads) - several of which had silently drifted on array
|
|
5
|
-
// handling, one excluding arrays, another not, for the same kind of check.
|
|
6
|
-
//
|
|
7
|
-
// Excludes arrays: every current call site (route params, persisted navigator-state JSON,
|
|
8
|
-
// touch-event objects, vnode props) only ever receives a genuine plain object, never a bare list
|
|
9
|
-
// standing in for one - so `Array.isArray` narrows out a real footgun (a malformed persisted
|
|
10
|
-
// value shaped like `[]` would otherwise pass this guard and fail confusingly deeper in, on a
|
|
11
|
-
// missing `.key`/`.name` field, instead of here) at zero cost to the realistic inputs.
|
|
12
|
-
export function isRecord(value) {
|
|
13
|
-
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
14
|
-
}
|
|
15
|
-
// Mirrors @react-navigation's CommonActions.setParams: a shallow merge onto the current params,
|
|
16
|
-
// but only when both sides are genuine plain objects - an array (or any other non-record) on
|
|
17
|
-
// either side means a clean replace instead, never a numeric-key-mangled merge. Shared by
|
|
18
|
-
// navigator-state.ts (Stack) and tab-router-state.ts (Tabs) so the two reducers can't drift on
|
|
19
|
-
// this rule independently.
|
|
20
|
-
export function mergeParams(current, incoming) {
|
|
21
|
-
return isRecord(current) && isRecord(incoming) ? { ...current, ...incoming } : incoming;
|
|
22
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ISymbioteEvent } from '@symbiote-native/engine';
|
|
2
|
-
import type { IHeaderBarButtonItem } from './navigator-props';
|
|
3
|
-
export declare function prepareHeaderBarButtonItems(items: IHeaderBarButtonItem[] | undefined, side: 'left' | 'right'): unknown[] | undefined;
|
|
4
|
-
type IHeaderBarButtonDispatch = {
|
|
5
|
-
onPressHeaderBarButtonItem?: (event: ISymbioteEvent) => void;
|
|
6
|
-
onPressHeaderBarButtonMenuItem?: (event: ISymbioteEvent) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare function buildHeaderBarButtonDispatch(leftItems: IHeaderBarButtonItem[] | undefined, rightItems: IHeaderBarButtonItem[] | undefined): IHeaderBarButtonDispatch;
|
|
9
|
-
export {};
|
|
@@ -1,163 +0,0 @@
|
|
|
1
|
-
// Header bar-button payload + dispatch: the native-shaped `headerLeftBarButtonItems`/
|
|
2
|
-
// `headerRightBarButtonItems` fold react-native-screens' own ScreenStackHeaderConfig component
|
|
3
|
-
// would send down, plus the buttonId/menuId -> onPress lookup that answers RNSScreenStackHeader-
|
|
4
|
-
// Config's `onPressHeaderBarButtonItem`/`onPressHeaderBarButtonMenuItem` events. Self-contained:
|
|
5
|
-
// only `resolveHeaderConfigView` (screen-options.ts) calls into this file, as a black box - the
|
|
6
|
-
// id-tagging scheme below is this cluster's own internal invariant, never a cross-file contract.
|
|
7
|
-
import { imageStatics } from '@symbiote-native/components';
|
|
8
|
-
import { processColor } from '@symbiote-native/engine';
|
|
9
|
-
// RNS flattens `icon` into sfSymbolName/xcassetName/imageSource/templateSource at native-payload
|
|
10
|
-
// time (both the structured `icon` field AND the flat native keys reach native - RNS's own
|
|
11
|
-
// prepareHeaderBarButtonItems keeps both), and resolves image assets through the same resolver
|
|
12
|
-
// the Image component uses.
|
|
13
|
-
function prepareIcon(icon) {
|
|
14
|
-
if (!icon)
|
|
15
|
-
return {};
|
|
16
|
-
switch (icon.type) {
|
|
17
|
-
case 'sfSymbol':
|
|
18
|
-
return { sfSymbolName: icon.name };
|
|
19
|
-
case 'xcasset':
|
|
20
|
-
return { xcassetName: icon.name };
|
|
21
|
-
case 'imageSource':
|
|
22
|
-
return { imageSource: imageStatics.resolveAssetSource(icon.imageSource) };
|
|
23
|
-
case 'templateSource':
|
|
24
|
-
return { templateSource: imageStatics.resolveAssetSource(icon.templateSource) };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
// The one id algorithm both the payload tagger (prepareMenuItems/prepareHeaderBarButtonItems)
|
|
28
|
-
// and the dispatch-lookup builder (collectMenuHandlers/collectBarButtonHandlers) call - so a
|
|
29
|
-
// change to the id scheme genuinely can't desync payload tagging from dispatch lookup.
|
|
30
|
-
function buildMenuId(path, index, side) {
|
|
31
|
-
return `${path}-${index}-${side}`;
|
|
32
|
-
}
|
|
33
|
-
function buildButtonId(index, side) {
|
|
34
|
-
return `${index}-${side}`;
|
|
35
|
-
}
|
|
36
|
-
function prepareTitleStyle(titleStyle) {
|
|
37
|
-
if (!titleStyle)
|
|
38
|
-
return undefined;
|
|
39
|
-
return {
|
|
40
|
-
...titleStyle,
|
|
41
|
-
color: titleStyle.color === undefined ? undefined : processColor(titleStyle.color),
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
function prepareBadge(badge) {
|
|
45
|
-
if (!badge)
|
|
46
|
-
return undefined;
|
|
47
|
-
return {
|
|
48
|
-
...badge,
|
|
49
|
-
style: badge.style
|
|
50
|
-
? {
|
|
51
|
-
...badge.style,
|
|
52
|
-
color: badge.style.color === undefined ? undefined : processColor(badge.style.color),
|
|
53
|
-
backgroundColor: badge.style.backgroundColor === undefined
|
|
54
|
-
? undefined
|
|
55
|
-
: processColor(badge.style.backgroundColor),
|
|
56
|
-
}
|
|
57
|
-
: undefined,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
// onPress is captured separately into the buttonId/menuId -> handler map (collectMenuHandlers/
|
|
61
|
-
// collectBarButtonHandlers below) and must never reach native: a function value fails Fabric's
|
|
62
|
-
// dynamic-value serialization, which silently drops the WHOLE headerLeftBarButtonItems/
|
|
63
|
-
// headerRightBarButtonItems array it's nested in - not just the one bad field - so bar buttons and
|
|
64
|
-
// menu actions never reached native at all, despite the buttonId/menuId dispatch wiring itself
|
|
65
|
-
// being entirely correct.
|
|
66
|
-
function excludeOnPress(item) {
|
|
67
|
-
const { onPress: _onPress, ...rest } = item;
|
|
68
|
-
return rest;
|
|
69
|
-
}
|
|
70
|
-
// Shared fields common to the 'button' and 'menu' item variants (title/icon/tint/badge/...) - the
|
|
71
|
-
// 'spacing' variant carries none of these and passes through untouched.
|
|
72
|
-
function prepareSharedFields(item) {
|
|
73
|
-
return {
|
|
74
|
-
...(item.type === 'button' ? excludeOnPress(item) : item),
|
|
75
|
-
...prepareIcon(item.icon),
|
|
76
|
-
titleStyle: prepareTitleStyle(item.titleStyle),
|
|
77
|
-
tintColor: item.tintColor === undefined ? undefined : processColor(item.tintColor),
|
|
78
|
-
badge: prepareBadge(item.badge),
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
// Recursively tags every menu action with a `menuId` derived from its tree position
|
|
82
|
-
// (`${path}-${index}-${side}`), mirroring RNS's own prepareMenu exactly - the id must match what
|
|
83
|
-
// buildHeaderBarButtonDispatch computes below, or a press silently no-ops.
|
|
84
|
-
function prepareMenuItems(menuLike, index, side, path = '') {
|
|
85
|
-
return {
|
|
86
|
-
...menuLike,
|
|
87
|
-
items: menuLike.items.map((menuItem, menuIndex) => {
|
|
88
|
-
const currentPath = path ? `${path}.${menuIndex}` : `${menuIndex}`;
|
|
89
|
-
const icon = prepareIcon(menuItem.icon);
|
|
90
|
-
if (menuItem.type === 'submenu') {
|
|
91
|
-
return { ...menuItem, ...icon, ...prepareMenuItems(menuItem, index, side, currentPath) };
|
|
92
|
-
}
|
|
93
|
-
return {
|
|
94
|
-
...excludeOnPress(menuItem),
|
|
95
|
-
...icon,
|
|
96
|
-
menuId: buildMenuId(currentPath, index, side),
|
|
97
|
-
};
|
|
98
|
-
}),
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
// Builds the native-shaped payload react-native-screens' own ScreenStackHeaderConfig component
|
|
102
|
-
// would send down (buttonId/menuId-tagged, colors processColor'd) - this is what
|
|
103
|
-
// IHeaderConfigViewProps.headerLeftBarButtonItems/headerRightBarButtonItems actually carry.
|
|
104
|
-
export function prepareHeaderBarButtonItems(items, side) {
|
|
105
|
-
if (!items)
|
|
106
|
-
return undefined;
|
|
107
|
-
return items.map((item, index) => {
|
|
108
|
-
if (item.type === 'spacing')
|
|
109
|
-
return item;
|
|
110
|
-
const prepared = prepareSharedFields(item);
|
|
111
|
-
if (item.type === 'button')
|
|
112
|
-
return { ...prepared, buttonId: buildButtonId(index, side) };
|
|
113
|
-
return { ...prepared, menu: prepareMenuItems(item.menu, index, side) };
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
function collectMenuHandlers(items, index, side, path, handlers) {
|
|
117
|
-
items.forEach((item, menuIndex) => {
|
|
118
|
-
const currentPath = path ? `${path}.${menuIndex}` : `${menuIndex}`;
|
|
119
|
-
if (item.type === 'submenu') {
|
|
120
|
-
collectMenuHandlers(item.items, index, side, currentPath, handlers);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
handlers.set(buildMenuId(currentPath, index, side), item.onPress);
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
function collectBarButtonHandlers(items, side, buttonHandlers, menuHandlers) {
|
|
127
|
-
items?.forEach((item, index) => {
|
|
128
|
-
if (item.type === 'button') {
|
|
129
|
-
buttonHandlers.set(buildButtonId(index, side), item.onPress);
|
|
130
|
-
}
|
|
131
|
-
else if (item.type === 'menu') {
|
|
132
|
-
collectMenuHandlers(item.menu.items, index, side, '', menuHandlers);
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
function readStringField(record, key) {
|
|
137
|
-
const value = record[key];
|
|
138
|
-
return typeof value === 'string' ? value : undefined;
|
|
139
|
-
}
|
|
140
|
-
// The buttonId/menuId → onPress lookup is built independently from prepareHeaderBarButtonItems'
|
|
141
|
-
// native payload (rather than re-parsing it back out of the `unknown[]` result), over the
|
|
142
|
-
// ORIGINAL typed items - but both sides call the same buildMenuId/buildButtonId, so the id
|
|
143
|
-
// scheme lives in one place and can't desync payload tagging from dispatch lookup.
|
|
144
|
-
export function buildHeaderBarButtonDispatch(leftItems, rightItems) {
|
|
145
|
-
const buttonHandlers = new Map();
|
|
146
|
-
const menuHandlers = new Map();
|
|
147
|
-
collectBarButtonHandlers(leftItems, 'left', buttonHandlers, menuHandlers);
|
|
148
|
-
collectBarButtonHandlers(rightItems, 'right', buttonHandlers, menuHandlers);
|
|
149
|
-
if (buttonHandlers.size === 0 && menuHandlers.size === 0)
|
|
150
|
-
return {};
|
|
151
|
-
return {
|
|
152
|
-
onPressHeaderBarButtonItem: event => {
|
|
153
|
-
const buttonId = readStringField(event.nativeEvent, 'buttonId');
|
|
154
|
-
if (buttonId !== undefined)
|
|
155
|
-
buttonHandlers.get(buttonId)?.();
|
|
156
|
-
},
|
|
157
|
-
onPressHeaderBarButtonMenuItem: event => {
|
|
158
|
-
const menuId = readStringField(event.nativeEvent, 'menuId');
|
|
159
|
-
if (menuId !== undefined)
|
|
160
|
-
menuHandlers.get(menuId)?.();
|
|
161
|
-
},
|
|
162
|
-
};
|
|
163
|
-
}
|
package/build/core/index.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export * from './constants';
|
|
2
|
-
export { createInitialNavigatorState, navigatorReducer, computeActivityState, isTopRoute, } from './navigator-state';
|
|
3
|
-
export type { IRoute, INavigatorState, INavigatorAction } from './navigator-state';
|
|
4
|
-
export type { IStackAnimation, IStackPresentation, IHeaderBackButtonDisplayMode, IHeaderUserInterfaceStyle, IOptionalBooleanNativeProp, ISheetAllowedDetents, ISheetLargestUndimmedDetent, ISheetInitialDetent, IHeaderBarButtonIcon, IHeaderBarButtonItemBadge, IHeaderBarButtonItemAction, IHeaderBarButtonMenuAction, IHeaderBarButtonSubmenu, IHeaderBarButtonItemMenu, IHeaderBarButtonItemSpacing, IHeaderBarButtonItem, ISearchBarAutoCapitalize, ISearchBarPlacement, ISearchBarOptions, IScreenOrientation, IScreenOptions, INavigatorPlatform, IScreenViewProps, IHeaderConfigViewProps, IStackViewProps, ISearchBarViewProps, } from './navigator-props';
|
|
5
|
-
export { resolveHeaderConfigView, resolveScreenView, resolveSearchBarView } from './screen-options';
|
|
6
|
-
export { buildSearchBarHandle } from './search-bar-commands';
|
|
7
|
-
export type { ISearchBarCommands } from './search-bar-commands';
|
|
8
|
-
export { resolveScreenProps, resolveStackProps, renderHeaderConfig, resolveSearchBarProps, resolveScreenContentWrapperStyle, resolveScreenViewName, isHeaderInModal, resolveHeaderInModalStackStyle, resolveHeaderInModalScreenStyle, buildSearchBarPassthrough, resolveScreenRenderPlan, } from './render-stack';
|
|
9
|
-
export type { IScreenRenderPlanInput, IScreenRenderPlan } from './render-stack';
|
|
10
|
-
export { serializeNavigatorState, deserializeNavigatorState } from './state-persistence';
|
|
11
|
-
export { createNavigationEmitter, diffFocusedRoute, NAVIGATION_EVENT_FOCUS, NAVIGATION_EVENT_BLUR, NAVIGATION_EVENT_STATE, NAVIGATION_EVENT_BEFORE_REMOVE, } from './navigation-events';
|
|
12
|
-
export type { INavigationEmitter, INavigationEventListener, INavigationEventName, IFocusTransition, } from './navigation-events';
|
|
13
|
-
export { isRecord } from './guards';
|
|
14
|
-
export { createInitialTabState, tabRouterReducer, isFocusedRoute } from './tab-router-state';
|
|
15
|
-
export type { ITabRouterState, ITabRouterAction } from './tab-router-state';
|
|
16
|
-
export type { ITabBarIcon, ITabOptions } from './tab-options';
|
|
17
|
-
export { renderTabBarItem, renderTabBar } from './render-tabs';
|
|
18
|
-
export type { ITabBarItemView, ITabBarViewProps } from './render-tabs';
|
|
19
|
-
export { resolveRouteFromUrl, resolveUrlFromRoute } from './linking-config';
|
|
20
|
-
export type { ILinkingConfig, IScreenLinkingConfig } from './linking-config';
|
|
21
|
-
export { createInitialDrawerRouterState, drawerRouterReducer, focusedDrawerRoute, } from './drawer-router-state';
|
|
22
|
-
export type { IDrawerRouterState, IDrawerRouterAction } from './drawer-router-state';
|
|
23
|
-
export type { IDrawerType, IDrawerPosition, IDrawerOptions, IDrawerScreenOptions, IDrawerGeometry, ISwipeIntent, } from './drawer-options';
|
|
24
|
-
export { DRAWER_DEFAULT_TYPE, DRAWER_DEFAULT_POSITION, DRAWER_DEFAULT_WIDTH, DRAWER_DEFAULT_OVERLAY_COLOR, DRAWER_DEFAULT_SWIPE_ENABLED, DRAWER_DEFAULT_SWIPE_EDGE_WIDTH, DRAWER_DEFAULT_SWIPE_MIN_DISTANCE, DRAWER_DEFAULT_SWIPE_MIN_VELOCITY, resolveDrawerType, resolveDrawerPosition, resolveDrawerWidth, isDrawerAnimated, isDrawerOverlayVisible, resolveDrawerGeometry, isSwipeStartInEdge, isHorizontalDrag, resolveSwipeIntent, clamp01, startPageXOf, resolveDragProgress, shouldClaimDrawerSwipe, resolveDrawerSlotInterpolation, } from './drawer-options';
|
|
25
|
-
export type { IDrawerInterpolationRange, IDrawerContentSlotInterpolation, IDrawerOverlaySlotInterpolation, IDrawerPanelSlotInterpolation, } from './drawer-options';
|
|
26
|
-
export { renderDrawer, drawerChildOrder } from './render-drawer';
|
|
27
|
-
export type { IDrawerSlot, IDrawerViewProps } from './render-drawer';
|
|
28
|
-
export type { INavigatorHandle, ITabNavigatorHandle, IDrawerNavigatorHandle, IDrawerDescriptorMap, IAnyNavigatorHandle, } from './navigator-handles';
|
|
29
|
-
export { isStackNavigatorHandle, isTabNavigatorHandle, isDrawerNavigatorHandle, } from './navigator-handles';
|
package/build/core/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
// @symbiote-native/navigation (core): the framework-agnostic half of the native stack navigator -
|
|
2
|
-
// a pure route-stack reducer plus the react-native-screens prop folds and native-leaf prop
|
|
3
|
-
// resolvers. symbiote ships zero runtime metadata for RNSScreen/RNSScreenStack/
|
|
4
|
-
// RNSScreenStackHeaderConfig - the engine derives their events and color processors from
|
|
5
|
-
// react-native-screens' own ViewConfig - so this layer is the pure JS every adapter reuses
|
|
6
|
-
// verbatim, supplying only its lifecycle (route-key generation, useReducer/reactive state) and
|
|
7
|
-
// the descriptor bridge.
|
|
8
|
-
export * from './constants.js';
|
|
9
|
-
export { createInitialNavigatorState, navigatorReducer, computeActivityState, isTopRoute, } from './navigator-state/index.js';
|
|
10
|
-
export { resolveHeaderConfigView, resolveScreenView, resolveSearchBarView } from './screen-options.js';
|
|
11
|
-
export { buildSearchBarHandle } from './search-bar-commands.js';
|
|
12
|
-
export { resolveScreenProps, resolveStackProps, renderHeaderConfig, resolveSearchBarProps, resolveScreenContentWrapperStyle, resolveScreenViewName, isHeaderInModal, resolveHeaderInModalStackStyle, resolveHeaderInModalScreenStyle, buildSearchBarPassthrough, resolveScreenRenderPlan, } from './render-stack.js';
|
|
13
|
-
export { serializeNavigatorState, deserializeNavigatorState } from './state-persistence/index.js';
|
|
14
|
-
export { createNavigationEmitter, diffFocusedRoute, NAVIGATION_EVENT_FOCUS, NAVIGATION_EVENT_BLUR, NAVIGATION_EVENT_STATE, NAVIGATION_EVENT_BEFORE_REMOVE, } from './navigation-events/index.js';
|
|
15
|
-
// Runtime guards shared across core (and re-exported for adapters narrowing their own untyped
|
|
16
|
-
// inputs - vnode props, gesture/event data, persisted JSON) - see guards.ts's header for which
|
|
17
|
-
// call sites this consolidates and why array-exclusion is the right default everywhere it's used.
|
|
18
|
-
export { isRecord } from './guards.js';
|
|
19
|
-
// Bottom-tabs navigator: a FOCUSED-INDEX router (not a stack - see tab-router-state.ts) driving
|
|
20
|
-
// a pure-JS tab bar render, framework-agnostic and shared verbatim by every adapter.
|
|
21
|
-
export { createInitialTabState, tabRouterReducer, isFocusedRoute } from './tab-router-state/index.js';
|
|
22
|
-
export { renderTabBarItem, renderTabBar } from './render-tabs.js';
|
|
23
|
-
// Linking config: resolves a URL to a route (and back), the piece @react-navigation's
|
|
24
|
-
// NavigationContainer `linking` prop provides on top of the framework-agnostic Linking module.
|
|
25
|
-
export { resolveRouteFromUrl, resolveUrlFromRoute } from './linking-config/index.js';
|
|
26
|
-
// Drawer navigator: an OPEN/CLOSED-flag router over a fixed route list (see
|
|
27
|
-
// drawer-router-state.ts's header for why it isn't a push/pop stack), a pure swipe/geometry math
|
|
28
|
-
// module, and a Descriptor render fn - all framework-agnostic, shared verbatim by every adapter.
|
|
29
|
-
export { createInitialDrawerRouterState, drawerRouterReducer, focusedDrawerRoute, } from './drawer-router-state/index.js';
|
|
30
|
-
export { DRAWER_DEFAULT_TYPE, DRAWER_DEFAULT_POSITION, DRAWER_DEFAULT_WIDTH, DRAWER_DEFAULT_OVERLAY_COLOR, DRAWER_DEFAULT_SWIPE_ENABLED, DRAWER_DEFAULT_SWIPE_EDGE_WIDTH, DRAWER_DEFAULT_SWIPE_MIN_DISTANCE, DRAWER_DEFAULT_SWIPE_MIN_VELOCITY, resolveDrawerType, resolveDrawerPosition, resolveDrawerWidth, isDrawerAnimated, isDrawerOverlayVisible, resolveDrawerGeometry, isSwipeStartInEdge, isHorizontalDrag, resolveSwipeIntent, clamp01, startPageXOf, resolveDragProgress, shouldClaimDrawerSwipe, resolveDrawerSlotInterpolation, } from './drawer-options/index.js';
|
|
31
|
-
export { renderDrawer, drawerChildOrder } from './render-drawer.js';
|
|
32
|
-
export { isStackNavigatorHandle, isTabNavigatorHandle, isDrawerNavigatorHandle, } from './navigator-handles/index.js';
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { IRoute } from '../navigator-state';
|
|
2
|
-
export type IScreenLinkingConfig = string | {
|
|
3
|
-
path?: string;
|
|
4
|
-
screens?: Record<string, IScreenLinkingConfig>;
|
|
5
|
-
};
|
|
6
|
-
export type ILinkingConfig = {
|
|
7
|
-
prefixes: string[];
|
|
8
|
-
config: {
|
|
9
|
-
screens: Record<string, IScreenLinkingConfig>;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export declare function resolveRouteFromUrl(config: ILinkingConfig, url: string): IRoute<unknown> | null;
|
|
13
|
-
export declare function resolveUrlFromRoute(config: ILinkingConfig, route: IRoute<unknown>): string | null;
|