@sigx/lynx-navigation 0.2.0 → 0.4.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 (193) hide show
  1. package/README.md +128 -8
  2. package/dist/components/EntryScope.d.ts +1 -1
  3. package/dist/components/EntryScope.d.ts.map +1 -1
  4. package/dist/components/Layer.d.ts +34 -0
  5. package/dist/components/Layer.d.ts.map +1 -0
  6. package/dist/components/Link.d.ts +2 -2
  7. package/dist/components/Link.d.ts.map +1 -1
  8. package/dist/components/NavigationRoot.d.ts +2 -2
  9. package/dist/components/NavigationRoot.d.ts.map +1 -1
  10. package/dist/components/Screen.d.ts +6 -6
  11. package/dist/components/Screen.d.ts.map +1 -1
  12. package/dist/components/Stack.d.ts +41 -16
  13. package/dist/components/Stack.d.ts.map +1 -1
  14. package/dist/components/TabBar.d.ts +19 -20
  15. package/dist/components/TabBar.d.ts.map +1 -1
  16. package/dist/components/Tabs.d.ts.map +1 -1
  17. package/dist/define-routes.d.ts +1 -1
  18. package/dist/define-routes.d.ts.map +1 -1
  19. package/dist/hooks/use-linking-nav.d.ts +3 -3
  20. package/dist/hooks/use-linking-nav.d.ts.map +1 -1
  21. package/dist/hooks/use-nav-internal.d.ts +21 -3
  22. package/dist/hooks/use-nav-internal.d.ts.map +1 -1
  23. package/dist/hooks/use-nav-serializer.d.ts +1 -1
  24. package/dist/hooks/use-nav-serializer.d.ts.map +1 -1
  25. package/dist/hooks/use-nav.d.ts +2 -2
  26. package/dist/hooks/use-nav.d.ts.map +1 -1
  27. package/dist/hooks/use-params.d.ts +1 -1
  28. package/dist/hooks/use-params.d.ts.map +1 -1
  29. package/dist/hooks/use-screen-chrome.d.ts +19 -0
  30. package/dist/hooks/use-screen-chrome.d.ts.map +1 -0
  31. package/dist/hooks/use-screen-options.d.ts +1 -1
  32. package/dist/hooks/use-screen-options.d.ts.map +1 -1
  33. package/dist/hooks/use-search.d.ts +1 -1
  34. package/dist/hooks/use-search.d.ts.map +1 -1
  35. package/dist/href.d.ts +2 -2
  36. package/dist/href.d.ts.map +1 -1
  37. package/dist/index.d.ts +33 -31
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +1160 -29
  40. package/dist/index.js.map +1 -1
  41. package/dist/internal/layer-plan.d.ts +69 -0
  42. package/dist/internal/layer-plan.d.ts.map +1 -0
  43. package/dist/internal/screen-registry.d.ts +1 -1
  44. package/dist/internal/screen-registry.d.ts.map +1 -1
  45. package/dist/internal/screen-width.d.ts +9 -7
  46. package/dist/internal/screen-width.d.ts.map +1 -1
  47. package/dist/navigator/core.d.ts +5 -4
  48. package/dist/navigator/core.d.ts.map +1 -1
  49. package/dist/register.d.ts +1 -1
  50. package/dist/register.d.ts.map +1 -1
  51. package/dist/url/index.d.ts +6 -6
  52. package/dist/url/index.d.ts.map +1 -1
  53. package/dist/url/parse.d.ts +1 -1
  54. package/dist/url/parse.d.ts.map +1 -1
  55. package/dist/url/registry.d.ts +2 -2
  56. package/dist/url/registry.d.ts.map +1 -1
  57. package/dist/url/validate.d.ts +1 -1
  58. package/dist/url/validate.d.ts.map +1 -1
  59. package/package.json +11 -10
  60. package/src/components/Drawer.d.ts +55 -0
  61. package/src/components/EdgeBackHandle.d.ts +1 -0
  62. package/src/components/EdgeBackHandle.tsx +2 -2
  63. package/{dist/components/EntryScope.js → src/components/EntryScope.d.ts} +7 -15
  64. package/src/components/EntryScope.tsx +15 -4
  65. package/src/components/Header.d.ts +6 -0
  66. package/src/components/Header.tsx +3 -3
  67. package/src/components/Layer.d.ts +33 -0
  68. package/src/components/Layer.tsx +96 -0
  69. package/src/components/Link.d.ts +60 -0
  70. package/src/components/Link.tsx +4 -4
  71. package/src/components/NavigationRoot.d.ts +36 -0
  72. package/src/components/NavigationRoot.tsx +6 -6
  73. package/src/components/Screen.d.ts +97 -0
  74. package/src/components/Screen.tsx +13 -11
  75. package/src/components/Stack.d.ts +90 -0
  76. package/src/components/Stack.tsx +142 -98
  77. package/src/components/TabBar.d.ts +38 -0
  78. package/src/components/TabBar.tsx +22 -22
  79. package/src/components/Tabs.d.ts +109 -0
  80. package/src/components/Tabs.tsx +15 -1
  81. package/{dist/define-routes.js → src/define-routes.d.ts} +2 -4
  82. package/src/define-routes.ts +1 -1
  83. package/src/hooks/use-focus.d.ts +45 -0
  84. package/src/hooks/use-focus.ts +2 -2
  85. package/src/hooks/use-hardware-back.d.ts +37 -0
  86. package/src/hooks/use-hardware-back.ts +1 -1
  87. package/src/hooks/use-linking-nav.d.ts +91 -0
  88. package/src/hooks/use-linking-nav.ts +4 -4
  89. package/src/hooks/use-nav-internal.d.ts +91 -0
  90. package/src/hooks/use-nav-internal.ts +24 -3
  91. package/src/hooks/use-nav-serializer.d.ts +82 -0
  92. package/src/hooks/use-nav-serializer.ts +3 -3
  93. package/src/hooks/use-nav.d.ts +111 -0
  94. package/src/hooks/use-nav.ts +2 -2
  95. package/{dist/hooks/use-params.js → src/hooks/use-params.d.ts} +2 -6
  96. package/src/hooks/use-params.ts +2 -2
  97. package/src/hooks/use-screen-chrome.d.ts +18 -0
  98. package/src/hooks/use-screen-chrome.ts +122 -0
  99. package/src/hooks/use-screen-options.d.ts +2 -0
  100. package/src/hooks/use-screen-options.ts +3 -3
  101. package/{dist/hooks/use-search.js → src/hooks/use-search.d.ts} +2 -6
  102. package/src/hooks/use-search.ts +2 -2
  103. package/src/href.d.ts +54 -0
  104. package/src/href.ts +6 -6
  105. package/src/index.d.ts +39 -0
  106. package/src/index.ts +33 -31
  107. package/src/internal/layer-plan.d.ts +68 -0
  108. package/src/internal/layer-plan.ts +187 -0
  109. package/{dist/internal/screen-registry.js → src/internal/screen-registry.d.ts} +21 -32
  110. package/src/internal/screen-registry.ts +1 -1
  111. package/src/internal/screen-width.d.ts +17 -0
  112. package/src/internal/screen-width.ts +22 -14
  113. package/src/navigator/core.d.ts +96 -0
  114. package/src/navigator/core.ts +17 -6
  115. package/src/register.d.ts +37 -0
  116. package/src/register.ts +1 -1
  117. package/src/types.d.ts +217 -0
  118. package/src/url/build.d.ts +15 -0
  119. package/src/url/build.ts +2 -2
  120. package/src/url/compile.d.ts +34 -0
  121. package/src/url/format.d.ts +28 -0
  122. package/src/url/index.ts +6 -6
  123. package/src/url/parse.d.ts +20 -0
  124. package/src/url/parse.ts +6 -6
  125. package/{dist/url/registry.js → src/url/registry.d.ts} +12 -28
  126. package/src/url/registry.ts +3 -3
  127. package/src/url/validate.d.ts +23 -0
  128. package/src/url/validate.ts +1 -1
  129. package/dist/components/Drawer.js +0 -74
  130. package/dist/components/Drawer.js.map +0 -1
  131. package/dist/components/EdgeBackHandle.js +0 -144
  132. package/dist/components/EdgeBackHandle.js.map +0 -1
  133. package/dist/components/EntryScope.js.map +0 -1
  134. package/dist/components/Header.js +0 -103
  135. package/dist/components/Header.js.map +0 -1
  136. package/dist/components/Link.js +0 -51
  137. package/dist/components/Link.js.map +0 -1
  138. package/dist/components/NavigationRoot.js +0 -67
  139. package/dist/components/NavigationRoot.js.map +0 -1
  140. package/dist/components/Screen.js +0 -94
  141. package/dist/components/Screen.js.map +0 -1
  142. package/dist/components/ScreenContainer.d.ts +0 -18
  143. package/dist/components/ScreenContainer.d.ts.map +0 -1
  144. package/dist/components/ScreenContainer.js +0 -77
  145. package/dist/components/ScreenContainer.js.map +0 -1
  146. package/dist/components/Stack.js +0 -221
  147. package/dist/components/Stack.js.map +0 -1
  148. package/dist/components/TabBar.js +0 -63
  149. package/dist/components/TabBar.js.map +0 -1
  150. package/dist/components/Tabs.js +0 -154
  151. package/dist/components/Tabs.js.map +0 -1
  152. package/dist/define-routes.js.map +0 -1
  153. package/dist/hooks/use-focus.js +0 -87
  154. package/dist/hooks/use-focus.js.map +0 -1
  155. package/dist/hooks/use-hardware-back.js +0 -84
  156. package/dist/hooks/use-hardware-back.js.map +0 -1
  157. package/dist/hooks/use-linking-nav.js +0 -109
  158. package/dist/hooks/use-linking-nav.js.map +0 -1
  159. package/dist/hooks/use-nav-internal.js +0 -44
  160. package/dist/hooks/use-nav-internal.js.map +0 -1
  161. package/dist/hooks/use-nav-serializer.js +0 -181
  162. package/dist/hooks/use-nav-serializer.js.map +0 -1
  163. package/dist/hooks/use-nav.js +0 -11
  164. package/dist/hooks/use-nav.js.map +0 -1
  165. package/dist/hooks/use-params.js.map +0 -1
  166. package/dist/hooks/use-screen-options.js +0 -43
  167. package/dist/hooks/use-screen-options.js.map +0 -1
  168. package/dist/hooks/use-search.js.map +0 -1
  169. package/dist/href.js +0 -57
  170. package/dist/href.js.map +0 -1
  171. package/dist/internal/screen-registry.js.map +0 -1
  172. package/dist/internal/screen-width.js +0 -30
  173. package/dist/internal/screen-width.js.map +0 -1
  174. package/dist/navigator/core.js +0 -383
  175. package/dist/navigator/core.js.map +0 -1
  176. package/dist/register.js +0 -2
  177. package/dist/register.js.map +0 -1
  178. package/dist/types.js +0 -9
  179. package/dist/types.js.map +0 -1
  180. package/dist/url/build.js +0 -30
  181. package/dist/url/build.js.map +0 -1
  182. package/dist/url/compile.js +0 -83
  183. package/dist/url/compile.js.map +0 -1
  184. package/dist/url/format.js +0 -102
  185. package/dist/url/format.js.map +0 -1
  186. package/dist/url/index.js +0 -13
  187. package/dist/url/index.js.map +0 -1
  188. package/dist/url/parse.js +0 -94
  189. package/dist/url/parse.js.map +0 -1
  190. package/dist/url/registry.js.map +0 -1
  191. package/dist/url/validate.js +0 -37
  192. package/dist/url/validate.js.map +0 -1
  193. package/src/components/ScreenContainer.tsx +0 -114
@@ -1,144 +0,0 @@
1
- import { jsx as _jsx } from "@sigx/lynx/jsx-runtime";
2
- import { component, Gesture, runOnBackground, useGestureDetector, useMainThreadRef, } from '@sigx/lynx';
3
- import { withTiming } from '@sigx/lynx-motion';
4
- import { useNavInternals } from '../hooks/use-nav-internal.js';
5
- import { SCREEN_WIDTH } from '../internal/screen-width.js';
6
- /**
7
- * Edge-pan recognizer for iOS-style swipe-back. Mounts as an absolutely-
8
- * positioned 20px-wide strip on the left edge of the active screen; only
9
- * exists when `nav.canGoBack && !transition`.
10
- *
11
- * `Gesture.Pan().minDistance(MIN_DISTANCE)` lets quick taps pass through to
12
- * whatever's behind the strip (back button, screen header, etc.). Only
13
- * horizontal drags past the threshold activate the gesture.
14
- *
15
- * MT/BG split:
16
- * - All gesture handlers run on MT. They write `progress.current.value`
17
- * directly per frame (no per-frame bridge crossing) and dispatch
18
- * `runOnBackground(...)` only at start/commit/cancel — three BG hops
19
- * per gesture max.
20
- * - The transition state machine on BG mounts the underneath
21
- * `<ScreenContainer>` once `beginBackGesture` lands; the gesture's
22
- * in-flight progress writes are picked up the moment the binding
23
- * registers (Phase 0.5 polish: pre-mount underneath when canGoBack to
24
- * eliminate the brief pre-mount latency).
25
- *
26
- * Implementation notes (matching `<Draggable>`):
27
- * - Single `useMainThreadRef` holding an object — primitive refs don't
28
- * survive worklet capture cleanly in some Lynx versions, while object
29
- * refs do (the worklet runtime resolves the ref via the
30
- * `_workletRefMap`).
31
- * - `e: any` rather than `e: unknown` — type annotations are erased, but
32
- * SWC's worklet transform has been observed to behave better with the
33
- * looser annotation. Keeps us aligned with Draggable verbatim.
34
- * - Empty `onBegin`: load-bearing on iOS — without a registered onBegin
35
- * callback, `LynxPanGestureHandler` skips the begin path and onStart/
36
- * onEnd never fire (per Draggable's notes).
37
- */
38
- /** Fraction of screen width past which a release commits the back nav. */
39
- const COMMIT_TRANSLATION = 0.33;
40
- /** px/sec horizontal speed past which a release commits, regardless of distance. */
41
- const COMMIT_VELOCITY = 300;
42
- /** Width of the touchable strip on the left edge of every screen. */
43
- const EDGE_ZONE_WIDTH = 20;
44
- /** Minimum movement before the gesture activates (lets taps pass through). */
45
- const MIN_DISTANCE = 8;
46
- const SNAP_DURATION_SEC = 0.18;
47
- /**
48
- * Pre-computed milliseconds for the BG-side `setTimeout`. Module-level so
49
- * it's in scope for both the MT worklet (`withTiming` argument) and the BG
50
- * callback wrapped by `runOnBackground` (`setTimeout` argument). Locals
51
- * declared inside an MT worklet body are MT-only — the BG callback's
52
- * closure can't see them, hence "ReferenceError: snapMs is not defined".
53
- */
54
- const SNAP_DURATION_MS = Math.round(SNAP_DURATION_SEC * 1000);
55
- export const EdgeBackHandle = component(() => {
56
- const ref = useMainThreadRef(null);
57
- // Per-gesture transient state — captured as a plain closure object
58
- // rather than a `useMainThreadRef`. Lynx's SWC worklet transform deep-
59
- // copies plain objects into `_c` once at register time; mutations on MT
60
- // persist across calls because the same `_c` is bound for the lifetime
61
- // of the gesture registration. Using a `useMainThreadRef` here was
62
- // crashing on iOS with `cannot read property 'current' of undefined`
63
- // — the resolved-ref capture path looked up an empty
64
- // `_workletRefMap` entry under a race I haven't fully tracked down.
65
- // Plain object avoids that path entirely.
66
- const state = {
67
- startPageX: 0,
68
- prevPageX: 0,
69
- prevTime: 0,
70
- velocity: 0,
71
- };
72
- const internals = useNavInternals();
73
- const progress = internals.progress;
74
- const beginBackGesture = internals.beginBackGesture;
75
- const commitBackGesture = internals.commitBackGesture;
76
- const cancelBackGesture = internals.cancelBackGesture;
77
- const pan = Gesture.Pan()
78
- .minDistance(MIN_DISTANCE)
79
- .onBegin(() => {
80
- 'main thread';
81
- })
82
- .onStart((e) => {
83
- 'main thread';
84
- const p = e && e.params;
85
- const pageX = (p && p.pageX) || 0;
86
- state.startPageX = pageX;
87
- state.prevPageX = pageX;
88
- state.prevTime = Date.now();
89
- state.velocity = 0;
90
- runOnBackground(() => {
91
- beginBackGesture();
92
- })();
93
- })
94
- .onUpdate((e) => {
95
- 'main thread';
96
- if (!progress)
97
- return;
98
- const p = e && e.params;
99
- const pageX = (p && p.pageX) || 0;
100
- const dx = pageX - state.startPageX;
101
- const prog = Math.max(0, Math.min(1, dx / SCREEN_WIDTH));
102
- progress.current.value = prog;
103
- const now = Date.now();
104
- const dt = now - state.prevTime;
105
- if (dt > 0) {
106
- state.velocity =
107
- ((pageX - state.prevPageX) / dt) * 1000;
108
- }
109
- state.prevPageX = pageX;
110
- state.prevTime = now;
111
- })
112
- .onEnd((e) => {
113
- 'main thread';
114
- if (!progress)
115
- return;
116
- const p = e && e.params;
117
- const pageX = (p && p.pageX) || 0;
118
- const dx = pageX - state.startPageX;
119
- const fraction = dx / SCREEN_WIDTH;
120
- const commit = fraction > COMMIT_TRANSLATION ||
121
- state.velocity > COMMIT_VELOCITY;
122
- if (commit) {
123
- withTiming(progress, 1, { duration: SNAP_DURATION_SEC });
124
- runOnBackground(() => {
125
- setTimeout(() => commitBackGesture(), SNAP_DURATION_MS);
126
- })();
127
- }
128
- else {
129
- withTiming(progress, 0, { duration: SNAP_DURATION_SEC });
130
- runOnBackground(() => {
131
- setTimeout(() => cancelBackGesture(), SNAP_DURATION_MS);
132
- })();
133
- }
134
- });
135
- useGestureDetector(ref, pan);
136
- return () => (_jsx("view", { "main-thread:ref": ref, style: {
137
- position: 'absolute',
138
- top: '0',
139
- left: '0',
140
- width: `${EDGE_ZONE_WIDTH}px`,
141
- bottom: '0',
142
- } }));
143
- });
144
- //# sourceMappingURL=EdgeBackHandle.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"EdgeBackHandle.js","sourceRoot":"","sources":["../../src/components/EdgeBackHandle.tsx"],"names":[],"mappings":";AAAA,OAAO,EACH,SAAS,EACT,OAAO,EACP,eAAe,EACf,kBAAkB,EAClB,gBAAgB,GAEnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,0EAA0E;AAC1E,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAChC,oFAAoF;AACpF,MAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,qEAAqE;AACrE,MAAM,eAAe,GAAG,EAAE,CAAC;AAC3B,8EAA8E;AAC9E,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,MAAM,iB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AM,YAAY,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACnG,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAOtE;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,SAAS,CAAkB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IACtE,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;IACpC,MAAM,QAAQ,GAAG,oBAAoB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IACnD,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACrC,WAAW,CAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IACH,aAAa,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAClD,aAAa,CAAC,iBAAiB,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,CAAC;IACjD,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;AACnC,CAAC,CAAC,CAAC"}
@@ -1,103 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "@sigx/lynx/jsx-runtime";
2
- /**
3
- * `<Header>` — default navigator header chrome.
4
- *
5
- * Reads from the currently-focused entry's `ScreenRegistry`:
6
- *
7
- * - If `slots.header` is set, render that (full override).
8
- * - Else render the default layout: headerLeft (back button when
9
- * `nav.canGoBack`), title (from `options.title`, or the route name as
10
- * a fallback), headerRight.
11
- *
12
- * Persistent: the Header component itself is mounted once near the root and
13
- * stays mounted across navigations — it reactively switches its content
14
- * when `nav.current` changes, rather than being remounted per screen. That
15
- * matters because mounting cost adds to perceived transition latency.
16
- *
17
- * Header chrome is opt-in. Consumers place `<Header />` inside
18
- * `<NavigationRoot>` above `<Stack />`. We don't auto-inject because:
19
- * - app shells vary (some want the header inside a `<SafeArea>`, some
20
- * want a custom toolbar, some want no header at all in tabs).
21
- * - making it opt-in keeps `<Stack>`'s contract narrow.
22
- */
23
- import { component, computed } from '@sigx/lynx';
24
- import { useNav } from '../hooks/use-nav.js';
25
- import { useNavInternals } from '../hooks/use-nav-internal.js';
26
- /**
27
- * Resolve a title (string or getter) to a plain string.
28
- *
29
- * Getter is the more general case; the `<Screen title={() => state.value}>`
30
- * call site is how reactive titles work. A plain string is wrapped in a
31
- * trivial closure so consumers always handle one shape.
32
- */
33
- function resolveTitle(t, routeName) {
34
- if (typeof t === 'function')
35
- return t();
36
- if (typeof t === 'string')
37
- return t;
38
- return routeName;
39
- }
40
- /**
41
- * Default back-button rendering. Plain `<text>` with a tap handler — apps
42
- * that want an icon or a custom design override via
43
- * `<Screen.HeaderLeft>`. Kept minimal because there's no shared icon
44
- * primitive at the navigation layer.
45
- */
46
- const DefaultBackButton = component(({ props }) => {
47
- return () => (_jsx("view", { bindtap: () => props.onPress(), "accessibility-element": true, "accessibility-label": "Back", "accessibility-trait": "button", children: _jsx("text", { children: "\u2039 Back" }) }));
48
- });
49
- const DefaultTitle = component(({ props }) => {
50
- return () => (_jsx("view", { children: _jsx("text", { children: props.text }) }));
51
- });
52
- /**
53
- * Persistent header chrome. Mount once above `<Stack>`; reactively follows
54
- * the focused entry. No props in v1 — styling is a host-app concern,
55
- * arrived at through the slot fills.
56
- */
57
- export const Header = component(() => {
58
- const nav = useNav();
59
- const internals = useNavInternals();
60
- // Snapshot computeds — each one reads only what it needs so the header
61
- // doesn't re-run wholesale on every signal touch. The slot-fill thunks
62
- // captured by `<Screen.Header>` etc. are themselves reactive (they
63
- // execute on every render of the consumer's tree), so re-running the
64
- // outer template is enough to pick up downstream updates.
65
- const currentEntry = computed(() => nav.current);
66
- const headerSlot = computed(() => {
67
- const reg = internals.screens.get(currentEntry.value.key);
68
- return reg?.slots.header;
69
- });
70
- const headerLeftSlot = computed(() => {
71
- const reg = internals.screens.get(currentEntry.value.key);
72
- return reg?.slots.headerLeft;
73
- });
74
- const headerRightSlot = computed(() => {
75
- const reg = internals.screens.get(currentEntry.value.key);
76
- return reg?.slots.headerRight;
77
- });
78
- const headerShown = computed(() => {
79
- const reg = internals.screens.get(currentEntry.value.key);
80
- // Default true — most screens want a header. Opting out is one prop
81
- // on `<Screen>`.
82
- return reg?.options.headerShown !== false;
83
- });
84
- const titleText = computed(() => {
85
- const reg = internals.screens.get(currentEntry.value.key);
86
- return resolveTitle(reg?.options.title, currentEntry.value.route);
87
- });
88
- return () => {
89
- if (!headerShown.value)
90
- return null;
91
- // Full-override path: `<Screen.Header>` supplied its own content,
92
- // we render that and skip the default layout entirely.
93
- const override = headerSlot.value;
94
- if (override)
95
- return override();
96
- return (_jsxs("view", { children: [_jsx("view", { children: headerLeftSlot.value
97
- ? headerLeftSlot.value()
98
- : nav.canGoBack
99
- ? _jsx(DefaultBackButton, { onPress: () => nav.pop() })
100
- : null }), _jsx(DefaultTitle, { text: titleText.value }), _jsx("view", { children: headerRightSlot.value ? headerRightSlot.value() : null })] }));
101
- };
102
- });
103
- //# sourceMappingURL=Header.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Header.js","sourceRoot":"","sources":["../../src/components/Header.tsx"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,CAAyB,EAAE,SAAiB;IAC9D,IAAI,OAAO,CAAC,KAAK,UAAU;QAAE,OAAO,CAAC,EAAE,CAAC;IACxC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,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,CAAC,GAAG,CAAC,GAAG,EAAE,GAAI;4BACjD,CAAC,CAAC,IAAI,GACX,EACP,KAAC,YAAY,IAAC,IAAI,EAAE,SAAS,CAAC,KAAK,GAAI,EACvC,yBACK,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,GACpD,IACJ,CACV,CAAC;IACN,CAAC,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -1,51 +0,0 @@
1
- import { jsx as _jsx } from "@sigx/lynx/jsx-runtime";
2
- import { component } from '@sigx/lynx';
3
- import { useNav } from '../hooks/use-nav.js';
4
- import { useNavRoutes } from '../hooks/use-nav-internal.js';
5
- const LinkImpl = component(({ props, slots }) => {
6
- const nav = useNav();
7
- const routes = useNavRoutes();
8
- const handlePress = () => {
9
- const route = props.to;
10
- const routeDef = routes[route];
11
- if (!routeDef) {
12
- // Defensive: prop was typed against the registry, so this shouldn't
13
- // happen at runtime — but if it does (e.g. a stale Link survived a
14
- // route removal), surface a clear error rather than crashing on
15
- // the navigator's lookup.
16
- throw new Error(`[lynx-navigation] <Link to='${route}'>: route is not registered.`);
17
- }
18
- const hasParams = !!routeDef.params;
19
- const action = props.replace ? nav.replace : nav.push;
20
- // Branch on whether the route declares a params schema so positional
21
- // args land correctly: routes-with-params shift everything one slot
22
- // (push/replace overload signatures `(name, params, search?, options?)`
23
- // vs `(name, search?, options?)`). Calling the wrong shape silently
24
- // puts `search` into the `options` slot.
25
- if (hasParams) {
26
- action(route, props.params, props.search);
27
- }
28
- else {
29
- action(route, props.search);
30
- }
31
- };
32
- return () => (_jsx("view", { bindtap: handlePress, children: slots.default?.() }));
33
- }, { name: 'Link' });
34
- /**
35
- * Declarative navigation. Same typing as `nav.push` — pass `params` only when
36
- * the route declares a schema. Wraps a `<view>` that fires `nav.push` (or
37
- * `nav.replace` if `replace` is set) on tap.
38
- *
39
- * @example
40
- * ```tsx
41
- * <Link to="home">Home</Link>
42
- * <Link to="profile" params={{ id: '42' }}>View profile</Link>
43
- * <Link to="profile" params={{ id: '42' }} search={{ tab: 'about' }}>About</Link>
44
- * <Link to="settings" replace>Settings (no back)</Link>
45
- * ```
46
- *
47
- * The cast widens the inferred prop type from the loose impl to the strict
48
- * `LinkProps` so JSX usage gets per-route discrimination. Runtime is identical.
49
- */
50
- export const Link = LinkImpl;
51
- //# sourceMappingURL=Link.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Link.js","sourceRoot":"","sources":["../../src/components/Link.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAe,MAAM,YAAY,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAqD5D,MAAM,QAAQ,GAAG,SAAS,CAAiB,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IAC5D,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,MAAM,WAAW,GAAG,GAAS,EAAE;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;YACZ,oEAAoE;YACpE,mEAAmE;YACnE,gEAAgE;YAChE,0BAA0B;YAC1B,MAAM,IAAI,KAAK,CACX,+BAA+B,KAAK,8BAA8B,CACrE,CAAC;QACN,CAAC;QACD,MAAM,SAAS,GAAG,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC;QACpC,MAAM,MAAM,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;QACtD,qEAAqE;QACrE,oEAAoE;QACpE,wEAAwE;QACxE,oEAAoE;QACpE,yCAAyC;QACzC,IAAI,SAAS,EAAE,CAAC;YACX,MAAuD,CACpD,KAAK,EACL,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,MAAM,CACf,CAAC;QACN,CAAC;aAAM,CAAC;YACH,MAA2C,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QACtE,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,GAAG,EAAE,CAAC,CAGT,eAAM,OAAO,EAAE,WAAW,YAAG,KAAK,CAAC,OAAO,EAAE,EAAE,GAAQ,CACzD,CAAC;AACN,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;AAErB;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,QAAoD,CAAC"}
@@ -1,67 +0,0 @@
1
- import { component, defineProvide, useSharedValue } from '@sigx/lynx';
2
- import { createNavigatorState } from '../navigator/core.js';
3
- import { useNav } from '../hooks/use-nav.js';
4
- import { useNavInternals, useNavRoutes } from '../hooks/use-nav-internal.js';
5
- import { _setRouteRegistry } from '../url/registry.js';
6
- /**
7
- * Root of a navigator subtree.
8
- *
9
- * Creates a fresh `NavigatorState` from `routes` and provides it via
10
- * `defineProvide`, so descendant `<Stack>` / `<Screen>` components and any
11
- * `useNav()` / `useParams()` calls resolve through this instance.
12
- *
13
- * The bottom-of-stack entry is built from `initialRoute` (defaults to the
14
- * first key in `routes`). For routes that declare a params schema, you must
15
- * pass `initialParams` matching that schema.
16
- *
17
- * Mirrors the install pattern of `@sigx/router` (see
18
- * `packages/router/src/router.ts:519-528`), but at component scope rather than
19
- * `app.use(router)` — no app-wide singleton, so multi-navigator apps and
20
- * tests get isolated state for free.
21
- */
22
- export const NavigationRoot = component(({ props, slots }) => {
23
- const routes = props.routes;
24
- const initialName = props.initialRoute ?? Object.keys(routes)[0];
25
- if (!routes[initialName]) {
26
- throw new Error(`[lynx-navigation] <NavigationRoot> initialRoute='${initialName}' is not in the routes registry.`);
27
- }
28
- // Publish the active route registry to the URL bridge so module-level
29
- // `hrefFor` / `parseHref` callers (deep-link handlers, anything outside
30
- // the component tree) resolve against this navigator's routes. Last
31
- // mount wins — multi-root apps that need isolation should call the
32
- // URL helpers with explicit context (TBD post-1.0).
33
- _setRouteRegistry(routes);
34
- const initialPresentation = routes[initialName].presentation ?? 'card';
35
- const initial = {
36
- key: 'root',
37
- route: initialName,
38
- params: props.initialParams ?? {},
39
- search: props.initialSearch ?? {},
40
- state: undefined,
41
- presentation: initialPresentation,
42
- };
43
- // SharedValue driving the slide-from-right push/pop transition. Created
44
- // unconditionally (hooks must be) but only forwarded into the navigator
45
- // when animations are enabled — `createNavigatorState` falls back to
46
- // instant swaps when `progress` is undefined.
47
- const progressSv = useSharedValue(0);
48
- const animationsEnabled = props.animated !== false;
49
- const navState = createNavigatorState({
50
- routes,
51
- initial,
52
- progress: animationsEnabled ? progressSv : undefined,
53
- });
54
- defineProvide(useNav, () => navState.nav);
55
- defineProvide(useNavRoutes, () => navState.routes);
56
- const edgeSwipeEnabled = props.edgeSwipeEnabled !== false;
57
- defineProvide(useNavInternals, () => ({
58
- progress: animationsEnabled ? progressSv : null,
59
- beginBackGesture: navState._gesture.beginBackGesture,
60
- commitBackGesture: navState._gesture.commitBackGesture,
61
- cancelBackGesture: navState._gesture.cancelBackGesture,
62
- edgeSwipeEnabled,
63
- screens: navState._screens,
64
- }));
65
- return () => slots.default?.();
66
- });
67
- //# sourceMappingURL=NavigationRoot.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"NavigationRoot.js","sourceRoot":"","sources":["../../src/components/NavigationRoot.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,cAAc,EAAe,MAAM,YAAY,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8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AAC;IAEH,aAAa,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IAC1C,aAAa,CAAC,YAAY,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnD,MAAM,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,KAAK,KAAK,CAAC;IAC1D,aAAa,CAAC,eAAe,EAAE,GAAG,EAAE,CAAC,CAAC;QAClC,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI;QAC/C,gBAAgB,EAAE,QAAQ,CAAC,QAAQ,CAAC,gBAAgB;QACpD,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB;QACtD,iBAAiB,EAAE,QAAQ,CAAC,QAAQ,CAAC,iBAAiB;QACtD,gBAAgB;QAChB,OAAO,EAAE,QAAQ,CAAC,QAAQ;KAC7B,CAAC,CAAC,CAAC;IAEJ,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;AACnC,CAAC,CAAC,CAAC"}
@@ -1,94 +0,0 @@
1
- /**
2
- * `<Screen>` — declarative per-screen options + slot fills.
3
- *
4
- * Usage:
5
- *
6
- * ```tsx
7
- * const ProfileScreen = component(() => () => (
8
- * <Screen title="Profile" headerShown gestureEnabled>
9
- * <Screen.HeaderRight>
10
- * <text bindtap={onEdit}>Edit</text>
11
- * </Screen.HeaderRight>
12
- * <view>body…</view>
13
- * </Screen>
14
- * ));
15
- * ```
16
- *
17
- * `<Screen>` itself renders its `default` slot inline — so the body lives
18
- * where you'd expect with no extra layout wrapper. The sub-components
19
- * (`Screen.Header`, `Screen.HeaderLeft`, `Screen.HeaderRight`,
20
- * `Screen.TabBarItem`) render `null` and write into the entry's
21
- * `ScreenRegistry`. The navigator's persistent chrome reads from there.
22
- *
23
- * Note: `<Screen.TabBarItem>` registers a scoped slot fill on the entry's
24
- * `ScreenRegistry`, but the built-in `<TabBar>` doesn't read it yet — the
25
- * fill is exposed for custom tab-bar renderers (pass `renderTab` and look
26
- * up the active entry's registry yourself).
27
- *
28
- * Sub-component placement inside `<Screen>` is conventional — sigx scopes
29
- * are by component tree, so they work anywhere under the same EntryScope.
30
- * Placing them as direct children of `<Screen>` keeps the call site
31
- * declarative and grep-friendly.
32
- */
33
- import { component, onUnmounted } from '@sigx/lynx';
34
- import { useScreenRegistry } from '../hooks/use-nav-internal.js';
35
- import { mergeOptions, setSlot } from '../internal/screen-registry.js';
36
- const ScreenRoot = component(({ props, slots }) => {
37
- const registry = useScreenRegistry();
38
- // Apply options whenever the component sets up. Options are reactive
39
- // through the registry's `options` signal — chrome consumers re-render
40
- // on the next merge. We don't bother diffing here: the patch is small
41
- // and writes only happen during setup + explicit prop changes upstream.
42
- mergeOptions(registry, {
43
- title: props.title,
44
- headerShown: props.headerShown,
45
- gestureEnabled: props.gestureEnabled,
46
- });
47
- return () => slots.default?.();
48
- });
49
- /**
50
- * Build a sub-component that registers its `default` slot under `name` on
51
- * the current screen's registry. Unmount removes the fill so navigating
52
- * away from a screen with a `<Screen.HeaderRight>` clears that action.
53
- */
54
- function makeSlotFiller(name) {
55
- return component(({ slots }) => {
56
- const registry = useScreenRegistry();
57
- setSlot(registry, name, () => slots.default?.());
58
- onUnmounted(() => setSlot(registry, name, undefined));
59
- return () => null;
60
- });
61
- }
62
- const Header = makeSlotFiller('header');
63
- const HeaderLeft = makeSlotFiller('headerLeft');
64
- const HeaderRight = makeSlotFiller('headerRight');
65
- const TabBarItem = component(({ slots }) => {
66
- const registry = useScreenRegistry();
67
- setSlot(registry, 'tabBarItem', (ctx) => {
68
- const out = slots.default?.();
69
- // Children may be a render function `({active}) => JSX` or plain
70
- // JSX (in which case `active` is ignored). Normalise to a value.
71
- if (typeof out === 'function')
72
- return out(ctx);
73
- if (Array.isArray(out)) {
74
- const first = out[0];
75
- if (typeof first === 'function')
76
- return first(ctx);
77
- }
78
- return out;
79
- });
80
- onUnmounted(() => setSlot(registry, 'tabBarItem', undefined));
81
- return () => null;
82
- });
83
- /**
84
- * Compound export. `Screen` is callable as a JSX element and exposes the
85
- * sub-components as properties (`Screen.Header`, etc.) for the declarative
86
- * call site shown in the file header.
87
- */
88
- export const Screen = Object.assign(ScreenRoot, {
89
- Header,
90
- HeaderLeft,
91
- HeaderRight,
92
- TabBarItem,
93
- });
94
- //# sourceMappingURL=Screen.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Screen.js","sourceRoot":"","sources":["../../src/components/Screen.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,OAAO,EAAE,SAAS,EAAE,WAAW,EAAe,MAAM,YAAY,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,gCAAgC,CAAC;AAQvE,MAAM,UAAU,GAAG,SAAS,CAAc,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3D,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;IACrC,qEAAqE;IACrE,uEAAuE;IACvE,sEAAsE;IACtE,wEAAwE;IACxE,YAAY,CAAC,QAAQ,EAAE;QACnB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,cAAc,EAAE,KAAK,CAAC,cAAc;KACvC,CAAC,CAAC;IACH,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;AACnC,CAAC,CAAC,CAAC;AAIH;;;;GAIG;AACH,SAAS,cAAc,CAAC,IAA6C;IACjE,OAAO,SAAS,CAAkB,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE;QAC5C,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;QACrC,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,GAAG,EAAE,CAA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UAAU,EAAE;IAC5C,MAAM;IACN,UAAU;IACV,WAAW;IACX,UAAU;CACb,CAAC,CAAC"}
@@ -1,18 +0,0 @@
1
- import { type ComponentFactory, type Define, type SharedValue } from '@sigx/lynx';
2
- import type { RouteMap, StackEntry, TransitionKind, TransitionRole } from '../types.js';
3
- type ScreenContainerProps = Define.Prop<'entry', StackEntry, true> & Define.Prop<'routes', RouteMap, true> & Define.Prop<'role', TransitionRole, true> & Define.Prop<'kind', TransitionKind, true> & Define.Prop<'progress', SharedValue<number>, true>;
4
- /**
5
- * Animated screen slot — absolutely positioned, MT-bound translateX driven by
6
- * the navigator's progress SharedValue. Used during transitions to render the
7
- * top + underneath entries together.
8
- *
9
- * Each instance is keyed by `${entry.key}-${role}-${kind}` in the parent so a
10
- * role/kind change forces a fresh mount with a fresh `useAnimatedStyle`
11
- * binding (the binding is set at setup and can't be re-keyed mid-life). State
12
- * loss across transition boundaries is accepted in v0.2; persistent screen
13
- * state (scroll position, input fields surviving navigations) is a polish
14
- * item for Phase 0.5+.
15
- */
16
- export declare const ScreenContainer: ComponentFactory<ScreenContainerProps, void, {}>;
17
- export {};
18
- //# sourceMappingURL=ScreenContainer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScreenContainer.d.ts","sourceRoot":"","sources":["../../src/components/ScreenContainer.tsx"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,gBAAgB,EACrB,KAAK,MAAM,EAEX,KAAK,WAAW,EACnB,MAAM,YAAY,CAAC;AAIpB,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAwCxF,KAAK,oBAAoB,GACnB,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,IAAI,CAAC,GACtC,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,CAAC,GACrC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,CAAC,GACzC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,IAAI,CAAC,GACzC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;AAEzD;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,kDA0C1B,CAAC"}
@@ -1,77 +0,0 @@
1
- import { jsx as _jsx } from "@sigx/lynx/jsx-runtime";
2
- import { component, useMainThreadRef, useAnimatedStyle, } from '@sigx/lynx';
3
- import { Suspense, isLazyComponent } from '@sigx/lynx';
4
- import { SCREEN_WIDTH } from '../internal/screen-width.js';
5
- import { EntryScope } from './EntryScope.js';
6
- /**
7
- * Slide-from-right transition geometry. `SCREEN_WIDTH` is read from
8
- * `lynx.SystemInfo` at module load so the animation lands the screen at
9
- * exactly translateX=0 (centered) at progress=1, rather than overshooting
10
- * into the parent's clip region. `<EdgeBackHandle>` reads the same
11
- * constant — they have to agree, otherwise the gesture commit threshold
12
- * and the animation geometry don't line up.
13
- */
14
- const PARALLAX_FACTOR = 0.3;
15
- /**
16
- * Compute the `translateX` range for a given (role, kind) pair. Progress
17
- * always runs 0 → 1; the role and kind decide what visual state each end of
18
- * the progress represents.
19
- *
20
- * Slide-from-right semantics:
21
- * - PUSH: new top slides in from the right; old top parallaxes left.
22
- * - POP: current top slides out to the right; underneath returns from the
23
- * parallax-left position.
24
- */
25
- function getRangeParams(role, kind) {
26
- if (kind === 'push') {
27
- if (role === 'top') {
28
- return { inputRange: [0, 1], outputRange: [SCREEN_WIDTH, 0] };
29
- }
30
- return { inputRange: [0, 1], outputRange: [0, -PARALLAX_FACTOR * SCREEN_WIDTH] };
31
- }
32
- // pop
33
- if (role === 'top') {
34
- return { inputRange: [0, 1], outputRange: [0, SCREEN_WIDTH] };
35
- }
36
- return { inputRange: [0, 1], outputRange: [-PARALLAX_FACTOR * SCREEN_WIDTH, 0] };
37
- }
38
- /**
39
- * Animated screen slot — absolutely positioned, MT-bound translateX driven by
40
- * the navigator's progress SharedValue. Used during transitions to render the
41
- * top + underneath entries together.
42
- *
43
- * Each instance is keyed by `${entry.key}-${role}-${kind}` in the parent so a
44
- * role/kind change forces a fresh mount with a fresh `useAnimatedStyle`
45
- * binding (the binding is set at setup and can't be re-keyed mid-life). State
46
- * loss across transition boundaries is accepted in v0.2; persistent screen
47
- * state (scroll position, input fields surviving navigations) is a polish
48
- * item for Phase 0.5+.
49
- */
50
- export const ScreenContainer = component(({ props }) => {
51
- const ref = useMainThreadRef(null);
52
- const params = getRangeParams(props.role, props.kind);
53
- useAnimatedStyle(ref, props.progress, 'translateX', params);
54
- return () => {
55
- const route = props.routes[props.entry.route];
56
- if (!route)
57
- return null;
58
- const Comp = route.component;
59
- if (typeof Comp !== 'function')
60
- return null;
61
- const entryParams = props.entry.params;
62
- // Wrap lazy screens that declare a fallback in Suspense — see Stack.tsx
63
- // for rationale.
64
- const body = isLazyComponent(Comp) && route.fallback
65
- ? (_jsx(Suspense, { fallback: route.fallback, children: _jsx(Comp, { ...entryParams }) }))
66
- : _jsx(Comp, { ...entryParams });
67
- return (_jsx("view", { "main-thread:ref": ref, style: {
68
- position: 'absolute',
69
- top: '0',
70
- left: '0',
71
- right: '0',
72
- bottom: '0',
73
- backgroundColor: '#0f172a',
74
- }, children: _jsx(EntryScope, { entry: props.entry, children: body }, props.entry.key) }));
75
- };
76
- });
77
- //# sourceMappingURL=ScreenContainer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ScreenContainer.js","sourceRoot":"","sources":["../../src/components/ScreenContainer.tsx"],"names":[],"mappings":";AAAA,OAAO,EACH,SAAS,EACT,gBAAgB,EAChB,gBAAgB,GAKnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAE,MAAM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