@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
package/dist/url/index.js DELETED
@@ -1,13 +0,0 @@
1
- /**
2
- * URL bridge — internal barrel.
3
- *
4
- * Not re-exported from the package root. Public surface is `hrefFor` /
5
- * `parseHref` in ../href.ts plus `_setRouteRegistry` for tests/bootstrap.
6
- */
7
- export { compilePath } from './compile.js';
8
- export { buildUrl } from './build.js';
9
- export { parseHrefImpl } from './parse.js';
10
- export { formatSearch, parseSearch } from './format.js';
11
- export { _setRouteRegistry, _clearRouteRegistry, getRouteRegistry, getCompiledPath, } from './registry.js';
12
- export { validateSync } from './validate.js';
13
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/url/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAqB,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACxD,OAAO,EACH,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,eAAe,GAClB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAwB,MAAM,eAAe,CAAC"}
package/dist/url/parse.js DELETED
@@ -1,94 +0,0 @@
1
- /**
2
- * URL → typed Href parser.
3
- *
4
- * Walks every registered route with a `path`, tries to match its compiled
5
- * regex against the URL's pathname, and on a hit validates the extracted
6
- * params + search through the route's Standard Schema. First match wins;
7
- * iteration order follows `Object.keys` of the registered routes map.
8
- *
9
- * Validation failures return `null` rather than throwing — deep-link handlers
10
- * fall back to the initial route on a bad URL instead of crashing the app.
11
- */
12
- import { parse as parseUrl } from '@sigx/lynx-linking';
13
- import { parseSearch } from './format.js';
14
- import { getCompiledPath, getRouteRegistry } from './registry.js';
15
- import { validateSync } from './validate.js';
16
- /**
17
- * Parse a URL string against the active route registry.
18
- *
19
- * Accepts both absolute URLs (`myapp://host/users/42?tab=about`) and
20
- * pathname-only forms (`/users/42?tab=about`). Returns `null` if no route's
21
- * `path` matches the URL or if schema validation rejects the extracted bits.
22
- */
23
- export function parseHrefImpl(url) {
24
- if (typeof url !== 'string' || url.length === 0)
25
- return null;
26
- // Use lynx-linking's parser for the scheme/host split — but accept paths
27
- // that don't have a scheme too (raw `/users/42` is the common case from
28
- // in-app routing).
29
- const { pathname, query } = splitPathAndQuery(url);
30
- if (!pathname)
31
- return null;
32
- const registry = getRouteRegistry();
33
- const rawSearch = parseSearch(query);
34
- for (const name of Object.keys(registry.routes)) {
35
- const compiled = getCompiledPath(registry, name);
36
- if (!compiled)
37
- continue;
38
- const match = compiled.regex.exec(pathname);
39
- if (!match)
40
- continue;
41
- const rawParams = extractParams(compiled, match);
42
- const def = registry.routes[name];
43
- const paramsOutcome = validateSync(def.params, rawParams);
44
- if (!paramsOutcome.ok)
45
- continue;
46
- const searchOutcome = validateSync(def.search, rawSearch);
47
- if (!searchOutcome.ok)
48
- continue;
49
- return {
50
- route: name,
51
- params: paramsOutcome.value,
52
- search: searchOutcome.value,
53
- url,
54
- };
55
- }
56
- return null;
57
- }
58
- function extractParams(compiled, match) {
59
- const out = {};
60
- for (let i = 0; i < compiled.paramNames.length; i++) {
61
- const raw = match[i + 1];
62
- try {
63
- out[compiled.paramNames[i]] = decodeURIComponent(raw);
64
- }
65
- catch {
66
- out[compiled.paramNames[i]] = raw;
67
- }
68
- }
69
- return out;
70
- }
71
- function splitPathAndQuery(url) {
72
- // Drop the fragment before any path/query work — `#…` is a client-side
73
- // anchor that must not leak into the route pathname or query values.
74
- const hashIdx = url.indexOf('#');
75
- const noHash = hashIdx >= 0 ? url.slice(0, hashIdx) : url;
76
- // If the URL has a scheme, defer to lynx-linking's parser — handles
77
- // `myapp://host/path?q` correctly. Otherwise treat the whole thing as
78
- // pathname+query.
79
- const hasScheme = /^[a-zA-Z][a-zA-Z0-9+.\-]*:/.test(noHash);
80
- if (hasScheme) {
81
- const parsed = parseUrl(noHash);
82
- // Reconstruct the query string from the already-parsed bag. We have
83
- // to do this because parseUrl decoded keys/values, but parseSearch
84
- // expects encoded form. Simpler: split the original ourselves.
85
- const qIdx = noHash.indexOf('?');
86
- const query = qIdx >= 0 ? noHash.slice(qIdx + 1) : '';
87
- return { pathname: parsed.path, query };
88
- }
89
- const qIdx = noHash.indexOf('?');
90
- if (qIdx === -1)
91
- return { pathname: noHash, query: '' };
92
- return { pathname: noHash.slice(0, qId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AAE,IAAI,GAAG,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,mBAAmB;IAC/B,OAAO,GAAG,IAAI,CAAC;AACnB,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,gBAAgB;IAC5B,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CACX,mHAAmH,CACtH,CAAC;IACN,CAAC;IACD,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,QAAuB,EAAE,IAAY;IACjE,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC,GAAG;QAAE,OAAO,IAAI,CAAC;IACtB,IAAI,CAAC,GAAG,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IAC3B,IAAI,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,QAAQ,GAAG,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACjC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC"}
@@ -1,37 +0,0 @@
1
- /**
2
- * Standard Schema validation helper (sync only).
3
- *
4
- * `hrefFor` and `parseHref` run on hot paths (link rendering, deep-link
5
- * resolution) so we restrict to sync validators. Zod/Valibot/ArkType are all
6
- * sync, which covers the common case. Async validators throw a clear error.
7
- */
8
- /**
9
- * Run a Standard Schema's `validate` synchronously. When the schema lacks a
10
- * `validate` function (e.g. our test `fakeSchema`), passthrough — assume the
11
- * input is already in the correct shape. This is a deliberate ergonomic
12
- * choice so the type-spike fixtures stay terse.
13
- */
14
- export function validateSync(schema, input) {
15
- if (!schema)
16
- return { ok: true, value: input };
17
- const validate = schema['~standard']?.validate;
18
- if (!validate)
19
- return { ok: true, value: input };
20
- const result = validate(input);
21
- if (isPromiseLike(result)) {
22
- throw new Error('[lynx-navigation] Async schema validation is not supported on the URL bridge — use a sync validator (Zod/Valibot/ArkType are all sync).');
23
- }
24
- if (result.issues !== undefined && result.issues.length > 0) {
25
- return {
26
- ok: false,
27
- issues: result.issues.map((i) => i.message),
28
- };
29
- }
30
- return { ok: true, value: result.value };
31
- }
32
- function isPromiseLike(v) {
33
- return (v !== null
34
- && typeof v === 'object'
35
- && typeof v.then === 'function');
36
- }
37
- //# sourceMappingURL=validate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../src/url/validate.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA0BH;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CACxB,MAAoC,EACpC,KAAc;IAEd,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IAC/C,MAAM,QAAQ,GAAI,MAAgC,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC;IAC1E,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACjD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CACX,yIAAyI,CAC5I,CAAC;IACN,CAAC;IACD,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1D,OAAO;YACH,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;SAC9C,CAAC;IACN,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAG,MAA6B,CAAC,KAAK,EAAE,CAAC;AACrE,CAAC;AAED,SAAS,aAAa,CAAI,CAAU;IAChC,OAAO,CACH,CAAC,KAAK,IAAI;WACP,OAAO,CAAC,KAAK,QAAQ;WACrB,OAAQ,CAAwB,CAAC,IAAI,KAAK,UAAU,CAC1D,CAAC;AACN,CAAC"}
@@ -1,114 +0,0 @@
1
- import {
2
- component,
3
- useMainThreadRef,
4
- useAnimatedStyle,
5
- type ComponentFactory,
6
- type Define,
7
- type MainThread,
8
- type SharedValue,
9
- } from '@sigx/lynx';
10
- import { Suspense, isLazyComponent } from '@sigx/lynx';
11
- import type { MapperParams } from '@sigx/lynx';
12
- import { SCREEN_WIDTH } from '../internal/screen-width.js';
13
- import type { RouteMap, StackEntry, TransitionKind, TransitionRole } from '../types.js';
14
- import { EntryScope } from './EntryScope.js';
15
-
16
- /**
17
- * Slide-from-right transition geometry. `SCREEN_WIDTH` is read from
18
- * `lynx.SystemInfo` at module load so the animation lands the screen at
19
- * exactly translateX=0 (centered) at progress=1, rather than overshooting
20
- * into the parent's clip region. `<EdgeBackHandle>` reads the same
21
- * constant — they have to agree, otherwise the gesture commit threshold
22
- * and the animation geometry don't line up.
23
- */
24
- const PARALLAX_FACTOR = 0.3;
25
-
26
- /**
27
- * Compute the `translateX` range for a given (role, kind) pair. Progress
28
- * always runs 0 → 1; the role and kind decide what visual state each end of
29
- * the progress represents.
30
- *
31
- * Slide-from-right semantics:
32
- * - PUSH: new top slides in from the right; old top parallaxes left.
33
- * - POP: current top slides out to the right; underneath returns from the
34
- * parallax-left position.
35
- */
36
- function getRangeParams(
37
- role: TransitionRole,
38
- kind: TransitionKind,
39
- ): MapperParams['translateX'] {
40
- if (kind === 'push') {
41
- if (role === 'top') {
42
- return { inputRange: [0, 1], outputRange: [SCREEN_WIDTH, 0] };
43
- }
44
- return { inputRange: [0, 1], outputRange: [0, -PARALLAX_FACTOR * SCREEN_WIDTH] };
45
- }
46
- // pop
47
- if (role === 'top') {
48
- return { inputRange: [0, 1], outputRange: [0, SCREEN_WIDTH] };
49
- }
50
- return { inputRange: [0, 1], outputRange: [-PARALLAX_FACTOR * SCREEN_WIDTH, 0] };
51
- }
52
-
53
- type ScreenContainerProps =
54
- & Define.Prop<'entry', StackEntry, true>
55
- & Define.Prop<'routes', RouteMap, true>
56
- & Define.Prop<'role', TransitionRole, true>
57
- & Define.Prop<'kind', TransitionKind, true>
58
- & Define.Prop<'progress', SharedValue<number>, true>;
59
-
60
- /**
61
- * Animated screen slot — absolutely positioned, MT-bound translateX driven by
62
- * the navigator's progress SharedValue. Used during transitions to render the
63
- * top + underneath entries together.
64
- *
65
- * Each instance is keyed by `${entry.key}-${role}-${kind}` in the parent so a
66
- * role/kind change forces a fresh mount with a fresh `useAnimatedStyle`
67
- * binding (the binding is set at setup and can't be re-keyed mid-life). State
68
- * loss across transition boundaries is accepted in v0.2; persistent screen
69
- * state (scroll position, input fields surviving navigations) is a polish
70
- * item for Phase 0.5+.
71
- */
72
- export const ScreenContainer = component<ScreenContainerProps>(({ props }) => {
73
- const ref = useMainThreadRef<MainThread.Element | null>(null);
74
- const params = getRangeParams(props.role, props.kind);
75
- useAnimatedStyle(ref, props.progress, 'translateX', params);
76
-
77
- return () => {
78
- const route = props.routes[props.entry.route];
79
- if (!route) return null;
80
- const Comp = route.component as unknown as ComponentFactory<
81
- Record<string, unknown>,
82
- unknown,
83
- unknown
84
- >;
85
- if (typeof Comp !== 'function') return null;
86
- const entryParams = props.entry.params as Record<string, unknown>;
87
- // Wrap lazy screens that declare a fallback in Suspense — see Stack.tsx
88
- // for rationale.
89
- const body = isLazyComponent(Comp) && route.fallback
90
- ? (
91
- <Suspense fallback={route.fallback as never}>
92
- <Comp {...entryParams} />
93
- </Suspense>
94
- )
95
- : <Comp {...entryParams} />;
96
- return (
97
- <view
98
- main-thread:ref={ref}
99
- style={{
100
- position: 'absolute',
101
- top: '0',
102
- left: '0',
103
- right: '0',
104
- bottom: '0',
105
- backgroundColor: '#0f172a',
106
- }}
107
- >
108
- <EntryScope key={props.entry.key} entry={props.entry}>
109
- {body}
110
- </EntryScope>
111
- </view>
112
- );
113
- };
114
- });