@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,109 +0,0 @@
1
- import { onMounted } from '@sigx/lynx';
2
- import { Linking } from '@sigx/lynx-linking';
3
- import { parseHref } from '../href.js';
4
- import { useNav } from './use-nav.js';
5
- import { useNavRoutes } from './use-nav-internal.js';
6
- /**
7
- * Bridge `@sigx/lynx-linking` URL events into a `@sigx/lynx-navigation`
8
- * navigator. Call once inside a `<NavigationRoot>` subtree.
9
- *
10
- * Handles both delivery modes:
11
- * - **cold start** — `Linking.getInitialURL()` is read on mount and, if
12
- * present, dispatched (replacing the initial route by default).
13
- * - **warm start** — `Linking.addEventListener('url', ...)` subscribes for
14
- * URLs delivered while the app is already running; each one is pushed.
15
- *
16
- * URL → route dispatch goes through `parseHref`, which matches the URL's
17
- * pathname against the route registry seeded by `<NavigationRoot>`. Routes
18
- * without a `path` template are never matched by deep links — only typed
19
- * `<Link>` / `nav.push` calls reach them.
20
- *
21
- * @example
22
- * ```tsx
23
- * import { useLinkingNav } from '@sigx/lynx-navigation';
24
- *
25
- * const DeepLinks = component(() => {
26
- * useLinkingNav({
27
- * prefixes: ['myapp://', 'https://myapp.com'],
28
- * onUnmatched: (url) => console.warn('Unknown deep link:', url),
29
- * });
30
- * return () => null;
31
- * });
32
- *
33
- * <NavigationRoot routes={routes}>
34
- * <DeepLinks />
35
- * <Stack />
36
- * </NavigationRoot>
37
- * ```
38
- */
39
- export function useLinkingNav(opts = {}) {
40
- const nav = useNav();
41
- const routes = useNavRoutes();
42
- const dispatch = (url, kind) => {
43
- if (opts.onURL) {
44
- opts.onURL(url, nav);
45
- return;
46
- }
47
- const stripped = _stripPrefix(url, opts.prefixes);
48
- const href = parseHref(stripped);
49
- if (!href) {
50
- opts.onUnmatched?.(url);
51
- return;
52
- }
53
- _navigateToHref(nav, routes, href, kind);
54
- };
55
- onMounted(() => {
56
- const initial = Linking.getInitialURL();
57
- if (initial) {
58
- dispatch(initial, opts.replaceInitial === false ? 'push' : 'replace');
59
- }
60
- const sub = Linking.addEventListener('url', (e) => dispatch(e.url, 'push'));
61
- return () => sub.remove();
62
- });
63
- }
64
- /**
65
- * Strip the first matching prefix from `url`, returning a pathname-like
66
- * string. If no prefixes are provided, or none match, the original URL is
67
- * returned unchanged so `parseHref` can still handle scheme-prefixed forms
68
- * via `@sigx/lynx-linking`'s `parse`.
69
- *
70
- * Exported for unit testing — not part of the package public API.
71
- */
72
- export function _stripPrefix(url, prefixes) {
73
- if (!prefixes || prefixes.length === 0)
74
- return url;
75
- for (const prefix of prefixes) {
76
- if (url.startsWith(prefix)) {
77
- const rest = url.slice(prefix.length);
78
- return rest.startsWith('/') ? rest : `/${rest}`;
79
- }
80
- }
81
- return url;
82
- }
83
- /**
84
- * Call the right `nav.push` / `nav.replace` overload for `href`. The
85
- * overloads differ in positional layout: routes with a params schema take
86
- * `(name, params, search?, options?)`; routes without take `(name, search?,
87
- * options?)`. Calling the wrong shape silently shifts `search` into the
88
- * `options` slot, so we look the route up in the registry and branch.
89
- *
90
- * Exported for unit testing — not part of the package public API.
91
- */
92
- export function _navigateToHref(nav, routes, href, kind) {
93
- const def = routes[href.route];
94
- // Defensive: `parseHref` already validated against the registry, so this
95
- // really shouldn't happen — but if the registry was cleared between
96
- // parse and dispatch (multi-NavigationRoot scenarios), bail rather than
97
- // throw.
98
- if (!def)
99
- return;
100
- const hasParams = !!def.params;
101
- const action = kind === 'replace' ? nav.replace : nav.push;
102
- if (hasParams) {
103
- action(href.route, href.params, href.search);
104
- }
105
- else {
106
- action(href.route, href.search);
107
- }
108
- }
109
- //# sourceMappingURL=use-linking-nav.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-linking-nav.js","sourceRoot":"","sources":["../../src/hooks/use-linking-nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAClD,OAAO,EAAE,MAAM,EAAY,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA0CrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,aAAa,CAAC,OAA6B,EAAE;IACzD,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAE9B,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAE,IAAwB,EAAQ,EAAE;QAC7D,IAAI,IA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AAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;QACpD,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAC3B,GAAQ,EACR,MAAgB,EAChB,IAAU,EACV,IAAwB;IAExB,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,yEAAyE;IACzE,oEAAoE;IACpE,wEAAwE;IACxE,SAAS;IACT,IAAI,CAAC,GAAG;QAAE,OAAO;IACjB,MAAM,SAAS,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAC/B,MAAM,MAAM,GAAG,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IAC3D,IAAI,SAAS,EAAE,CAAC;QACX,MAAuD,CACpD,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,MAAM,CACd,CAAC;IACN,CAAC;SAAM,CAAC;QACH,MAA2C,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1E,CAAC;AACL,CAAC"}
@@ -1,44 +0,0 @@
1
- import { defineInjectable } from '@sigx/lynx';
2
- /**
3
- * Internal injectable: the `StackEntry` the calling screen was rendered for.
4
- *
5
- * Provided by `<EntryScope>` which `<Stack>` and `<ScreenContainer>` wrap
6
- * around each screen component mount. Screens use this to derive their own
7
- * focus state (`useIsFocused`, `useFocusEffect`) without having to track
8
- * `entry.key` themselves.
9
- *
10
- * Default throws so calling `useIsFocused()` outside a screen mounted by a
11
- * navigator surfaces a clear error rather than silently returning `false`.
12
- */
13
- export const useCurrentEntry = defineInjectable(() => {
14
- throw new Error('[lynx-navigation] No screen entry in scope. `useIsFocused` / `useFocusEffect` must be called from a component rendered as a route by <Stack>.');
15
- });
16
- /**
17
- * Internal injectable: the route registry passed into `<NavigationRoot>`.
18
- * Components (Stack, Screen) read this to look up route definitions by name.
19
- *
20
- * Not exported from the package barrel — use `useNav()` for navigation, and
21
- * the registry is implicit from `<NavigationRoot routes={...}>`.
22
- */
23
- export const useNavRoutes = defineInjectable(() => {
24
- throw new Error('[lynx-navigation] No <NavigationRoot> found in the component tree.');
25
- });
26
- export const useNavInternals = defineInjectable(() => {
27
- throw new Error('[lynx-navigation] No <NavigationRoot> found in the component tree.');
28
- });
29
- /**
30
- * Internal injectable: the calling screen's `ScreenRegistry`.
31
- *
32
- * Provided by `<EntryScope>` alongside `useCurrentEntry`. The `<Screen>`
33
- * component and its slot-filling sub-components write options and slot
34
- * fills here; the navigator's persistent chrome (HeaderBar, TabBar — later
35
- * slices) reads from this registry via `getScreenRegistry(key)` on the
36
- * navigator state, which keys into a cross-entry map.
37
- *
38
- * Throws when used outside an EntryScope so calling `<Screen>` at the app
39
- * root surfaces a clear error rather than silently no-op'ing.
40
- */
41
- export const useScreenRegistry = defineInjectable(() => {
42
- throw new Error('[lynx-navigation] No screen registry in scope. `<Screen>` (and `<Screen.Header>`, etc.) must be used inside a route component rendered by `<Stack>`.');
43
- });
44
- //# sourceMappingURL=use-nav-internal.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-nav-internal.js","sourceRoot":"","sources":["../../src/hooks/use-nav-internal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAoB,MAAM,YAAY,CAAC;AAIhE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAa,GAAG,EAAE;IAC7D,MAAM,IAAI,KAAK,CACX,+IAA+I,CAClJ,CAAC;AACN,CAAC,CAAC,CAAC;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAW,GAAG,EAAE;IACxD,MAAM,IAAI,KAAK,CACX,oEAAoE,CACvE,CAAC;AACN,CAAC,CAAC,CAAC;AAuCH,MAAM,CAAC,MAAM,eAAe,GAAG,gBAAgB,CAAe,GAAG,EAAE;IAC/D,MAAM,IAAI,KAAK,CACX,oEAAoE,CACvE,CAAC;AACN,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,gBAAgB,CAAiB,GAAG,EAAE;IACnE,MAAM,IAAI,KAAK,CACX,sJAAsJ,CACzJ,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -1,181 +0,0 @@
1
- import { effect, onMounted, onUnmounted } from '@sigx/lynx';
2
- import { useNav } from './use-nav.js';
3
- import { useNavRoutes } from './use-nav-internal.js';
4
- export const NAV_SNAPSHOT_VERSION = 1;
5
- /**
6
- * Wire a navigator's stack to a storage adapter.
7
- *
8
- * On mount:
9
- * 1. Call `storage.load()`.
10
- * 2. Validate the snapshot (version match, every entry's route still
11
- * registered).
12
- * 3. On success, `nav.reset({ stack })` to apply.
13
- * 4. On any failure, leave the stack alone (initial route remains).
14
- *
15
- * Then subscribe to `nav.stack` and call `storage.save(snapshot)` debounced.
16
- *
17
- * Why we don't validate `params` / `search` against schemas here: schemas
18
- * are part of the route definition, and re-running them across all entries
19
- * on every launch costs more than it's worth. The contract is "entries were
20
- * validated when they were pushed; if the schema has since changed in a
21
- * breaking way, bump `version` to reject old snapshots wholesale." Callers
22
- * who want a stricter check can run their own validation in
23
- * `storage.load()` and return `null` on mismatch.
24
- */
25
- export function useNavSerializer(options) {
26
- const nav = useNav();
27
- const routes = useNavRoutes();
28
- const debounceMs = options.debounceMs ?? 250;
29
- const onRestored = options.onRestored;
30
- const onErr = options.onRestoreError;
31
- // Mutable mount/state flags. Plain closure vars (no signals) — we don't
32
- // want any of this driving a render and we don't want it tracked by the
33
- // save-effect below.
34
- let mounted = true;
35
- let restoreDone = false;
36
- let pendingTimer = null;
37
- let stopEffect = null;
38
- onMounted(() => {
39
- // Kick off the load synchronously — adapters that return a value
40
- // immediately (sync stores, test doubles) hit the resolve branch on
41
- // the same tick. Promise adapters resolve on the microtask queue;
42
- // the `mounted` guard catches teardown races.
43
- Promise.resolve()
44
- .then(() => options.storage.load())
45
- .then((snap) => {
46
- if (!mounted)
47
- return;
48
- if (snap == null) {
49
- restoreDone = true;
50
- startSaveEffect();
51
- return;
52
- }
53
- if (!isValidShape(snap)) {
54
- onErr?.('shape');
55
- restoreDone = true;
56
- startSaveEffect();
57
- return;
58
- }
59
- if (snap.version !== NAV_SNAPSHOT_VERSION) {
60
- onErr?.('version');
61
- restoreDone = true;
62
- startSaveEffect();
63
- return;
64
- }
65
- // Drop the snapshot if any entry references a route the app
66
- // no longer knows about — partial restoration is worse than
67
- // no restoration (could leave the user stranded on a screen
68
- // whose params won't validate when read by `useParams`).
69
- for (const entry of snap.stack) {
70
- if (!routes[entry.route]) {
71
- onErr?.('unknown-route');
72
- restoreDone = true;
73
- startSaveEffect();
74
- return;
75
- }
76
- }
77
- if (snap.stack.length === 0) {
78
- onErr?.('shape');
79
- restoreDone = true;
80
- startSaveEffect();
81
- return;
82
- }
83
- nav.reset({ stack: snap.stack });
84
- onRestored?.(snap);
85
- restoreDone = true;
86
- startSaveEffect();
87
- })
88
- .catch((err) => {
89
- if (!mounted)
90
- return;
91
- onErr?.('load-threw', err);
92
- restoreDone = true;
93
- startSaveEffect();
94
- });
95
- });
96
- function startSaveEffect() {
97
- if (!mounted || stopEffect)
98
- return;
99
- // The first effect run is just the initial subscription read — it
100
- // happens immediately when `effect()` is called, before any user
101
- // navigation, and represents the stack-as-restored (or the initial
102
- // route when there was nothing to restore). Either way, we don't
103
- // want to persist it: in the restore case it would race with the
104
- // adapter that just supplied this state, and in the fresh case
105
- // it's redundant.
106
- let firstRun = true;
107
- const runner = effect(() => {
108
- const stack = nav.stack;
109
- const snapshot = {
110
- version: NAV_SNAPSHOT_VERSION,
111
- stack: stack.map((e) => ({
112
- key: e.key,
113
- route: e.route,
114
- params: e.params,
115
- search: e.search,
116
- state: e.state,
117
- presentation: e.presentation,
118
- })),
119
- };
120
- if (firstRun) {
121
- firstRun = false;
122
- return;
123
- }
124
- schedule(snapshot);
125
- });
126
- stopEffect = () => runner.stop();
127
- }
128
- function schedule(snapshot) {
129
- if (pendingTimer != null)
130
- clearTimeout(pendingTimer);
131
- pendingTimer = setTimeout(() => {
132
- pendingTimer = null;
133
- try {
134
- const r = options.storage.save(snapshot);
135
- if (r && typeof r.catch === 'function') {
136
- r.catch(() => {
137
- // Save errors are intentionally swallowed — see the
138
- // hook doc-comment. Hosts that need visibility can
139
- // wrap their adapter.
140
- });
141
- }
142
- }
143
- catch {
144
- // Same rationale.
145
- }
146
- }, debounceMs);
147
- }
148
- onUnmounted(() => {
149
- mounted = false;
150
- if (pendingTimer != null) {
151
- clearTimeout(pendingTimer);
152
- pendingTimer = null;
153
- }
154
- if (stopEffect) {
155
- stopEffect();
156
- stopEffect = null;
157
- }
158
- });
159
- }
160
- function isValidShape(s) {
161
- if (!s || typeof s !== 'object')
162
- return false;
163
- const obj = s;
164
- if (typeof obj.version !== 'number')
165
- return false;
166
- if (!Array.isArray(obj.stack))
167
- return false;
168
- for (const entry of obj.stack) {
169
- if (!entry || typeof entry !== 'object')
170
- return false;
171
- const e = entry;
172
- if (typeof e.key !== 'string')
173
- return false;
174
- if (typeof e.route !== 'string')
175
- return false;
176
- if (typeof e.presentation !== 'string')
177
- return false;
178
- }
179
- return true;
180
- }
181
- //# sourceMappingURL=use-nav-serializer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-nav-serializer.js","sourceRoot":"","sources":["../../src/hooks/use-nav-serializer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,O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access the innermost navigator. Provided by `<NavigationRoot>` via
4
- * `defineProvide`. Throws when called outside a NavigationRoot subtree.
5
- *
6
- * Mirrors `@sigx/router`'s `useRouter` pattern (`packages/router/src/router.ts:30`).
7
- */
8
- export const useNav = defineInjectable(() => {
9
- throw new Error('[lynx-navigation] useNav() called but no <NavigationRoot> is mounted in the component tree.');
10
- });
11
- //# sourceMappingURL=use-nav.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-nav.js","sourceRoot":"","sources":["../../src/hooks/use-nav.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAgJ9C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAM,GAAG,EAAE;IAC7C,MAAM,IAAI,KAAK,CACX,6FAA6F,CAChG,CAAC;AACN,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-params.js","sourceRoot":"","sources":["../../src/hooks/use-params.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,SAAS,CAAoB,KAAQ;IACjD,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,OAAO,GAAG,CAAC,OAAO,CAAC,MAAwB,CAAC;AAChD,CAAC"}
@@ -1,43 +0,0 @@
1
- /**
2
- * `useScreenOptions` — imperative merge into the current entry's options.
3
- *
4
- * Use this when options need to be set from an effect rather than declared
5
- * statically via `<Screen title=…>`. The canonical case is "title becomes
6
- * known after a fetch":
7
- *
8
- * ```ts
9
- * const user = useFetchUser(id);
10
- * useScreenOptions(() => ({
11
- * title: user.value?.displayName ?? 'Loading…',
12
- * }));
13
- * ```
14
- *
15
- * The callback runs in a tracked `effect` — any signals it reads cause it
16
- * to re-run and re-merge. This is strictly additive: returning a partial
17
- * options object only touches the keys it sets, and returning `undefined`
18
- * for a key clears it.
19
- *
20
- * Static usage where the options never change can pass a plain object and
21
- * skip the effect — internally we detect that and merge once. Hosts that
22
- * pass a getter pay for the subscription; hosts that pass an object don't.
23
- */
24
- import { effect, onUnmounted } from '@sigx/lynx';
25
- import { useScreenRegistry } from './use-nav-internal.js';
26
- import { mergeOptions } from '../internal/screen-registry.js';
27
- export function useScreenOptions(optionsOrFn) {
28
- const registry = useScreenRegistry();
29
- if (typeof optionsOrFn !== 'function') {
30
- mergeOptions(registry, optionsOrFn);
31
- return;
32
- }
33
- // Reactive path: every signal touched inside the getter is tracked, so
34
- // the merge re-runs when any of them change. `mergeOptions` does per-key
35
- // writes on a deeply-reactive proxy, so consumers (HeaderBar) only
36
- // re-render the parts they actually read.
37
- const runner = effect(() => {
38
- const next = optionsOrFn();
39
- mergeOptions(registry, next);
40
- });
41
- onUnmounted(() => runner.stop());
42
- }
43
- //# sourceMappingURL=use-screen-options.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-screen-options.js","sourceRoot":"","sources":["../../src/hooks/use-screen-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAG9D,MAAM,UAAU,gBAAgB,CAC5B,WAAkD;IAElD,MAAM,QAAQ,GAAG,iBAAiB,EAAE,CAAC;IAErC,IAAI,OAAO,WAAW,KAAK,UAAU,EAAE,CAAC;QACpC,YAAY,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;QACpC,OAAO;IACX,CAAC;IAED,uEAAuE;IACvE,yEAAyE;IACzE,mEAAmE;IACnE,0CAA0C;IAC1C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,EAAE;QACvB,MAAM,IAAI,GAAG,WAAW,EAAE,CAAC;QAC3B,YAAY,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;IACH,WAAW,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AACrC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-search.js","sourceRoot":"","sources":["../../src/hooks/use-search.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC;;;;;;;GAOG;AACH,MAAM,UAAU,SAAS,CAAoB,KAAQ;IACjD,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,OAAO,GAAG,CAAC,OAAO,CAAC,MAAwB,CAAC;AAChD,CAAC"}
package/dist/href.js DELETED
@@ -1,57 +0,0 @@
1
- import { buildUrl } from './url/build.js';
2
- import { parseHrefImpl } from './url/parse.js';
3
- import { getRouteRegistry } from './url/registry.js';
4
- import { validateSync } from './url/validate.js';
5
- export function hrefFor(name, ...args) {
6
- const registry = getRouteRegistry();
7
- const def = registry.routes[name];
8
- if (!def) {
9
- throw new Error(`[lynx-navigation] hrefFor('${name}'): route is not in the active registry.`);
10
- }
11
- // Disambiguate the overloads: routes with a params schema get
12
- // (name, params, search?); routes without get (name, search?). The
13
- // typed overloads enforce this at compile time, but at runtime we need
14
- // to peek at the schema presence to know how to interpret `args`.
15
- const hasParamsSchema = !!def.params;
16
- let rawParams;
17
- let rawSearch;
18
- if (hasParamsSchema) {
19
- rawParams = args[0];
20
- rawSearch = args[1];
21
- }
22
- else {
23
- rawParams = undefined;
24
- rawSearch = args[0];
25
- }
26
- const paramsOutcome = validateSync(def.params, rawParams ?? {});
27
- if (!paramsOutcome.ok) {
28
- throw new Error(`[lynx-navigation] hrefFor('${name}'): params validation failed — ${paramsOutcome.issues.join('; ')}`);
29
- }
30
- const searchOutcome = validateSync(def.search, rawSearch ?? {});
31
- if (!searchOutcome.ok) {
32
- throw new Error(`[lynx-navigation] hrefFor('${name}'): search validation failed — ${searchOutcome.issues.join('; ')}`);
33
- }
34
- const params = paramsOutcome.value;
35
- const search = searchOutcome.value;
36
- const url = buildUrl(name, params, search);
37
- return {
38
- route: name,
39
- params: params,
40
- search: search,
41
- url,
42
- };
43
- }
44
- /**
45
- * Parse a URL string into a typed Href against the registered routes.
46
- * Returns `null` if no route's `path` template matches the URL or if the
47
- * extracted params/search fail the route's schema validation.
48
- *
49
- * Accepts both absolute (`myapp://host/path?q`) and pathname-only
50
- * (`/path?q`) forms — the pathname is matched against each route's
51
- * compiled template. Iteration order is the registration order; first match
52
- * wins.
53
- */
54
- export function parseHref(url) {
55
- return parseHrefImpl(url);
56
- }
57
- //# sourceMappingURL=href.js.map
package/dist/href.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"href.js","sourceRoot":"","sources":["../src/href.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAgDjD,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,GAAG,IAAe;IACpD,MAAM,QAAQ,GAAG,gBAAgB,EAAE,CAAC;IACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,CAAC,GAAG,EAAE,CAAC;QACP,MAAM,IAAI,KAAK,CACX,8BAA8B,IAAI,0CAA0C,CAC/E,CAAC;IACN,CAAC;IAED,8DAA8D;IAC9D,mEAAmE;IACnE,uEAAuE;IACvE,kEAAkE;IAClE,MAAM,eAAe,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IACrC,IAAI,SAA8C,CAAC;IACnD,IAAI,SAA8C,CAAC;IACnD,IAAI,eAAe,EAAE,CAAC;QAClB,SAAS,GAAG,IAAI,CAAC,CA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;;;;;;;;GAgBG;AACH,OAAO,EAAE,MAAM,EAAe,MAAM,YAAY,CAAC;AAwBjD,2EAA2E;AAC3E,MAAM,UAAU,oBAAoB,CAAC,KAAiB;IAClD,OAAO;QACH,KAAK;QACL,OAAO,EAAE,MAAM,CAAgB,EAAE,CAAC;QAClC,KAAK,EAAE,MAAM,CAAkB,EAAE,CAAC;KACrC,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO,CACnB,QAAwB,EACxB,IAAO,EACP,IAAoC;IAEpC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACrB,kEAAkE;QAClE,4DAA4D;QAC5D,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC5B,OAAO;IACX,CAAC;IACA,QAAQ,CAAC,KAAyB,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;AACrD,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,YAAY,CACxB,QAAwB,EACxB,KAAoB;IAEpB,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAA4B,EAAE,CAAC;QAC9D,MAAM,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAClB,OAAO,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,CAAC;aAAM,CAAC;YACJ,iEAAiE;YACjE,+DAA+D;YAC/D,+DAA+D;YAC9D,QAAQ,CAAC,OAA8C,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACtE,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -1,30 +0,0 @@
1
- /**
2
- * Logical screen width (in dp) read from `lynx.SystemInfo` at module load.
3
- * Falls back to 400 (typical phone) if SystemInfo isn't available — module
4
- * load happens BG-side after the bundle initializes, by which time
5
- * `lynx.SystemInfo` is populated, so the fallback only fires in tests / SSR /
6
- * non-Lynx hosts.
7
- *
8
- * Used by:
9
- * - `<ScreenContainer>` for the slide-from-right transform output range.
10
- * - `<EdgeBackHandle>` for the gesture commit threshold (`dx / width`).
11
- *
12
- * Both must agree, otherwise the commit threshold and the animation
13
- * geometry won't line up. Single shared constant avoids drift.
14
- */
15
- function readScreenWidth() {
16
- try {
17
- const info = typeof lynx !== 'undefined' ? lynx?.SystemInfo : undefined;
18
- const pw = info?.pixelWidth;
19
- const pr = info?.pixelRatio || 1;
20
- if (typeof pw === 'number' && pw > 0) {
21
- return Math.round(pw / pr);
22
- }
23
- }
24
- catch {
25
- // Lynx globals not present (test env / SSR) — use fallback.
26
- }
27
- return 400;
28
- }
29
- export const SCREEN_WIDTH = readScreenWidth();
30
- //# sourceMappingURL=screen-width.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"screen-width.js","sourceRoot":"","sources":["../../src/internal/screen-width.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAMH,SAAS,eAAe;IACpB,IAAI,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,IAAI,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,SAAS,CAAC;QACxE,MAAM,EAAE,GAAG,IAAI,EAAE,UAAU,CAAC;QAC5B,MAAM,EAAE,GAAG,IAAI,EAAE,UAAU,IAAI,CAAC,CAAC;QACjC,IAAI,OAAO,EAAE,KAAK,QAAQ,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,4DAA4D;IAChE,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,EAAE,CAAC"}