@sigx/lynx-navigation 0.1.0 → 0.1.2

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 (139) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +355 -0
  3. package/dist/components/Drawer.d.ts +56 -0
  4. package/dist/components/Drawer.d.ts.map +1 -0
  5. package/dist/components/Drawer.js +74 -0
  6. package/dist/components/Drawer.js.map +1 -0
  7. package/dist/components/EdgeBackHandle.js +144 -0
  8. package/dist/components/EdgeBackHandle.js.map +1 -0
  9. package/dist/components/EntryScope.d.ts +26 -0
  10. package/dist/components/EntryScope.d.ts.map +1 -0
  11. package/dist/components/EntryScope.js +33 -0
  12. package/dist/components/EntryScope.js.map +1 -0
  13. package/dist/components/Header.d.ts +7 -0
  14. package/dist/components/Header.d.ts.map +1 -0
  15. package/dist/components/Header.js +103 -0
  16. package/dist/components/Header.js.map +1 -0
  17. package/dist/components/Link.js +1 -4
  18. package/dist/components/Link.js.map +1 -1
  19. package/dist/components/NavigationRoot.d.ts +1 -1
  20. package/dist/components/NavigationRoot.d.ts.map +1 -1
  21. package/dist/components/NavigationRoot.js +29 -3
  22. package/dist/components/NavigationRoot.js.map +1 -1
  23. package/dist/components/Screen.d.ts +98 -0
  24. package/dist/components/Screen.d.ts.map +1 -0
  25. package/dist/components/Screen.js +94 -0
  26. package/dist/components/Screen.js.map +1 -0
  27. package/dist/components/ScreenContainer.d.ts.map +1 -1
  28. package/dist/components/ScreenContainer.js +77 -0
  29. package/dist/components/ScreenContainer.js.map +1 -0
  30. package/dist/components/Stack.d.ts.map +1 -1
  31. package/dist/components/Stack.js +60 -24
  32. package/dist/components/Stack.js.map +1 -1
  33. package/dist/components/TabBar.d.ts +40 -0
  34. package/dist/components/TabBar.d.ts.map +1 -0
  35. package/dist/components/TabBar.js +63 -0
  36. package/dist/components/TabBar.js.map +1 -0
  37. package/dist/components/Tabs.d.ts +101 -0
  38. package/dist/components/Tabs.d.ts.map +1 -0
  39. package/dist/components/Tabs.js +140 -0
  40. package/dist/components/Tabs.js.map +1 -0
  41. package/dist/hooks/use-focus.d.ts +46 -0
  42. package/dist/hooks/use-focus.d.ts.map +1 -0
  43. package/dist/hooks/use-focus.js +81 -0
  44. package/dist/hooks/use-focus.js.map +1 -0
  45. package/dist/hooks/use-hardware-back.js +50 -0
  46. package/dist/hooks/use-hardware-back.js.map +1 -0
  47. package/dist/hooks/use-linking-nav.d.ts +92 -0
  48. package/dist/hooks/use-linking-nav.d.ts.map +1 -0
  49. package/dist/hooks/use-linking-nav.js +109 -0
  50. package/dist/hooks/use-linking-nav.js.map +1 -0
  51. package/dist/hooks/use-nav-internal.d.ts +38 -1
  52. package/dist/hooks/use-nav-internal.d.ts.map +1 -1
  53. package/dist/hooks/use-nav-internal.js +32 -0
  54. package/dist/hooks/use-nav-internal.js.map +1 -1
  55. package/dist/hooks/use-nav-serializer.d.ts +83 -0
  56. package/dist/hooks/use-nav-serializer.d.ts.map +1 -0
  57. package/dist/hooks/use-nav-serializer.js +181 -0
  58. package/dist/hooks/use-nav-serializer.js.map +1 -0
  59. package/dist/hooks/use-nav.js.map +1 -1
  60. package/dist/hooks/use-screen-options.d.ts +3 -0
  61. package/dist/hooks/use-screen-options.d.ts.map +1 -0
  62. package/dist/hooks/use-screen-options.js +43 -0
  63. package/dist/hooks/use-screen-options.js.map +1 -0
  64. package/dist/href.d.ts +16 -1
  65. package/dist/href.d.ts.map +1 -1
  66. package/dist/href.js +50 -7
  67. package/dist/href.js.map +1 -1
  68. package/dist/index.d.ts +18 -1
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.js +15 -0
  71. package/dist/index.js.map +1 -1
  72. package/dist/internal/screen-registry.d.ts +49 -0
  73. package/dist/internal/screen-registry.d.ts.map +1 -0
  74. package/dist/internal/screen-registry.js +59 -0
  75. package/dist/internal/screen-registry.js.map +1 -0
  76. package/dist/internal/screen-width.js +30 -0
  77. package/dist/internal/screen-width.js.map +1 -0
  78. package/dist/navigator/core.d.ts +20 -1
  79. package/dist/navigator/core.d.ts.map +1 -1
  80. package/dist/navigator/core.js +231 -36
  81. package/dist/navigator/core.js.map +1 -1
  82. package/dist/types.d.ts +56 -0
  83. package/dist/types.d.ts.map +1 -1
  84. package/dist/url/build.d.ts +16 -0
  85. package/dist/url/build.d.ts.map +1 -0
  86. package/dist/url/build.js +30 -0
  87. package/dist/url/build.js.map +1 -0
  88. package/dist/url/compile.d.ts +35 -0
  89. package/dist/url/compile.d.ts.map +1 -0
  90. package/dist/url/compile.js +83 -0
  91. package/dist/url/compile.js.map +1 -0
  92. package/dist/url/format.d.ts +29 -0
  93. package/dist/url/format.d.ts.map +1 -0
  94. package/dist/url/format.js +102 -0
  95. package/dist/url/format.js.map +1 -0
  96. package/dist/url/index.d.ts +13 -0
  97. package/dist/url/index.d.ts.map +1 -0
  98. package/dist/url/index.js +13 -0
  99. package/dist/url/index.js.map +1 -0
  100. package/dist/url/parse.d.ts +21 -0
  101. package/dist/url/parse.d.ts.map +1 -0
  102. package/dist/url/parse.js +94 -0
  103. package/dist/url/parse.js.map +1 -0
  104. package/dist/url/registry.d.ts +41 -0
  105. package/dist/url/registry.d.ts.map +1 -0
  106. package/dist/url/registry.js +56 -0
  107. package/dist/url/registry.js.map +1 -0
  108. package/dist/url/validate.d.ts +24 -0
  109. package/dist/url/validate.d.ts.map +1 -0
  110. package/dist/url/validate.js +37 -0
  111. package/dist/url/validate.js.map +1 -0
  112. package/package.json +44 -15
  113. package/src/components/Drawer.tsx +119 -0
  114. package/src/components/EdgeBackHandle.tsx +1 -1
  115. package/src/components/EntryScope.tsx +38 -0
  116. package/src/components/Header.tsx +129 -0
  117. package/src/components/NavigationRoot.tsx +9 -1
  118. package/src/components/Screen.tsx +116 -0
  119. package/src/components/ScreenContainer.tsx +14 -1
  120. package/src/components/Stack.tsx +21 -2
  121. package/src/components/TabBar.tsx +104 -0
  122. package/src/components/Tabs.tsx +216 -0
  123. package/src/hooks/use-focus.ts +88 -0
  124. package/src/hooks/use-linking-nav.ts +159 -0
  125. package/src/hooks/use-nav-internal.ts +48 -1
  126. package/src/hooks/use-nav-serializer.ts +239 -0
  127. package/src/hooks/use-screen-options.ts +48 -0
  128. package/src/href.ts +68 -11
  129. package/src/index.ts +29 -0
  130. package/src/internal/screen-registry.ts +89 -0
  131. package/src/navigator/core.ts +86 -4
  132. package/src/types.ts +56 -0
  133. package/src/url/build.ts +35 -0
  134. package/src/url/compile.ts +109 -0
  135. package/src/url/format.ts +95 -0
  136. package/src/url/index.ts +18 -0
  137. package/src/url/parse.ts +102 -0
  138. package/src/url/registry.ts +69 -0
  139. package/src/url/validate.ts +67 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-screen-options.d.ts","sourceRoot":"","sources":["../../src/hooks/use-screen-options.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,gBAAgB,CAC5B,WAAW,EAAE,aAAa,GAAG,CAAC,MAAM,aAAa,CAAC,GACnD,IAAI,CAiBN"}
@@ -0,0 +1,43 @@
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
@@ -0,0 +1 @@
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"}
package/dist/href.d.ts CHANGED
@@ -23,6 +23,15 @@ export interface Href<K extends RouteId = RouteId> {
23
23
  * params schema, one for routes that require params. See `RoutesWithParams`
24
24
  * in `./hooks/use-nav.js` for why this isn't expressed as a single conditional.
25
25
  *
26
+ * Requires a `<NavigationRoot>` (or an explicit `_setRouteRegistry` call) to
27
+ * have run — the URL form is built against the active route registry. The
28
+ * typed pieces (`route`, `params`, `search`) are returned regardless; `url`
29
+ * is `null` when the route declares no `path` template.
30
+ *
31
+ * Schema validation errors throw — pass already-validated values from
32
+ * `useParams` / `useSearch` to round-trip safely, or wrap in try/catch when
33
+ * building hrefs from external input.
34
+ *
26
35
  * @example
27
36
  * ```ts
28
37
  * hrefFor('profile', { id: '42' }); // → { route, params, search: {}, url: '/users/42' }
@@ -34,7 +43,13 @@ export declare function hrefFor<K extends RoutesWithoutParams>(name: K, search?:
34
43
  export declare function hrefFor<K extends RoutesWithParams>(name: K, params: RouteParams<K>, search?: RouteSearch<K>): Href<K>;
35
44
  /**
36
45
  * Parse a URL string into a typed Href against the registered routes.
37
- * Returns `null` if no route's `path` template matches.
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.
38
53
  */
39
54
  export declare function parseHref(url: string): Href | null;
40
55
  //# sourceMappingURL=href.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"href.d.ts","sourceRoot":"","sources":["../src/href.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACvE,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEhF;;;;;;;GAOG;AACH,MAAM,WAAW,IAAI,CAAC,CAAC,SAAS,O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EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,mBAAmB,EAAE,IAAI,EAAE,CAAC,EAAE,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;AAClG,wBAAgB,OAAO,CAAC,CAAC,SAAS,gBAAgB,EAC9C,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,MAAM,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,GACxB,IAAI,CAAC,CAAC,CAAC,CAAC;AAkDX;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAElD"}
package/dist/href.js CHANGED
@@ -1,14 +1,57 @@
1
- export function hrefFor(name, ..._args) {
2
- void name;
3
- void _args;
4
- throw new Error('hrefFor() runtime is not implemented yet — this is the type spike.');
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
+ };
5
43
  }
6
44
  /**
7
45
  * Parse a URL string into a typed Href against the registered routes.
8
- * Returns `null` if no route's `path` template matches.
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.
9
53
  */
10
54
  export function parseHref(url) {
11
- void url;
12
- throw new Error('parseHref() runtime is not implemented yet — this is the type spike.');
55
+ return parseHrefImpl(url);
13
56
  }
14
57
  //# sourceMappingURL=href.js.map
package/dist/href.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"href.js","sourceRoot":"","sources":["../src/href.ts"],"names":[],"mappings":"AAwCA,MAAM,UAAU,OAAO,CAAC,IAAY,EAAE,GAAG,KAAgB;IACrD,KAAK,IAAI,CAAC;IACV,KAAK,KAAK,CAAC;IACX,MAAM,IAAI,KAAK,CACX,oEAAoE,CACvE,CAAC;AACN,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACjC,KAAK,GAAG,CAAC;IACT,MAAM,IAAI,KAAK,CACX,sEAAsE,CACzE,CAAC;AACN,CAAC"}
1
+ {"version":3,"file":"href.js","sourceRoot":"","sources":["../src/href.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,g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,CAAC,aAAa,CAAC,EAAE,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACX,8BAA8B,IAAI,kCAAkC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxG,CAAC;IACN,CAAC;IAED,MAAM,MAAM,GAAG,aAAa,CAAC,KAAgC,CAAC;IAC9D,MAAM,MAAM,GAAG,aAAa,CAAC,KAAgC,CAAC;IAC9D,MAAM,GAAG,GAAG,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAE3C,OAAO;QACH,KAAK,EAAE,IAAe;QACtB,MAAM,EAAE,MAAe;QACvB,MAAM,EAAE,MAAe;QACvB,GAAG;KACN,CAAC;AACN,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACjC,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -11,11 +11,28 @@ export type { Nav, RoutesWithoutParams, RoutesWithParams } from './hooks/use-nav
11
11
  export { useParams } from './hooks/use-params.js';
12
12
  export { useSearch } from './hooks/use-search.js';
13
13
  export { useHardwareBack } from './hooks/use-hardware-back.js';
14
+ export { useLinkingNav } from './hooks/use-linking-nav.js';
15
+ export type { UseLinkingNavOptions } from './hooks/use-linking-nav.js';
16
+ export { useIsFocused, useFocusEffect } from './hooks/use-focus.js';
17
+ export { useScreenOptions } from './hooks/use-screen-options.js';
18
+ export { useNavSerializer, NAV_SNAPSHOT_VERSION, } from './hooks/use-nav-serializer.js';
19
+ export type { NavSnapshot, NavStorageAdapter, UseNavSerializerOptions, } from './hooks/use-nav-serializer.js';
14
20
  export { hrefFor, parseHref } from './href.js';
15
21
  export type { Href } from './href.js';
22
+ export { _setRouteRegistry, _clearRouteRegistry } from './url/registry.js';
23
+ export { compilePath } from './url/compile.js';
24
+ export type { CompiledPath } from './url/compile.js';
16
25
  export { NavigationRoot } from './components/NavigationRoot.js';
17
26
  export { Stack } from './components/Stack.js';
27
+ export { Screen } from './components/Screen.js';
28
+ export { Header } from './components/Header.js';
29
+ export { Tabs, useTabs } from './components/Tabs.js';
30
+ export type { TabInfo, TabsNav } from './components/Tabs.js';
31
+ export { TabBar } from './components/TabBar.js';
32
+ export type { TabRenderContext } from './components/TabBar.js';
33
+ export { Drawer, useDrawer } from './components/Drawer.js';
34
+ export type { DrawerNav } from './components/Drawer.js';
18
35
  export { Link } from './components/Link.js';
19
36
  export type { LinkProps } from './components/Link.js';
20
- export type { ComponentLike, EmptyParams, InferOutput, ParamsOf, PopOptions, Presentation, PushOptions, RouteDefinition, RouteMap, RouteRequiresParams, SearchOf, StackEntry, StandardSchemaV1, TransitionKind, TransitionRole, TransitionState, } from './types.js';
37
+ export type { ComponentLike, EmptyParams, InferOutput, ParamsOf, PopOptions, Presentation, PushOptions, RouteDefinition, RouteMap, RouteRequiresParams, ScreenOptions, ScreenSlotFills, SearchOf, StackEntry, StandardSchemaV1, TransitionKind, TransitionRole, TransitionState, } from './types.js';
21
38
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,QAAQ,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACnG,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,YAAY,EAAE,GAAG,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,OAAO,EA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b,eAAe,EACf,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,cAAc,EACd,eAAe,GAClB,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -8,8 +8,23 @@ export { defineRoutes } from './define-routes.js';
8
8
  export { useNav } from './hooks/use-nav.js';
9
9
  export { useParams } from './hooks/use-params.js';
10
10
  export { useSearch } from './hooks/use-search.js';
11
+ export { useHardwareBack } from './hooks/use-hardware-back.js';
12
+ export { useLinkingNav } from './hooks/use-linking-nav.js';
13
+ export { useIsFocused, useFocusEffect } from './hooks/use-focus.js';
14
+ export { useScreenOptions } from './hooks/use-screen-options.js';
15
+ export { useNavSerializer, NAV_SNAPSHOT_VERSION, } from './hooks/use-nav-serializer.js';
11
16
  export { hrefFor, parseHref } from './href.js';
17
+ // URL bridge internals: `_setRouteRegistry` is a leading-underscore export —
18
+ // intended for tests, deep-link bootstrap before a NavigationRoot mounts, and
19
+ // any other integration that needs to seed the registry imperatively.
20
+ export { _setRouteRegistry, _clearRouteRegistry } from './url/registry.js';
21
+ export { compilePath } from './url/compile.js';
12
22
  export { NavigationRoot } from './components/NavigationRoot.js';
13
23
  export { Stack } from './components/Stack.js';
24
+ export { Screen } from './components/Screen.js';
25
+ export { Header } from './components/Header.js';
26
+ export { Tabs, useTabs } from './components/Tabs.js';
27
+ export { TabBar } from './components/TabBar.js';
28
+ export { Drawer, useDrawer } from './components/Drawer.js';
14
29
  export { Link } from './components/Link.js';
15
30
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,M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C;AAChD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC"}
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Per-entry registry of `<Screen>` options + slot fills.
3
+ *
4
+ * Each `<EntryScope>` allocates one of these on mount and provides it to
5
+ * descendants via `defineProvide(useScreenRegistry, ...)`. The Screen
6
+ * component and its sub-components (`<Screen.Header>`, `<Screen.HeaderLeft>`,
7
+ * `<Screen.HeaderRight>`, `<Screen.TabBarItem>`) write into the registry as
8
+ * they mount.
9
+ *
10
+ * Reads track because options/slots are stored in signals — when a child
11
+ * re-renders and registers a new slot fill, the navigator-side consumer
12
+ * (HeaderBar / TabBar, shipped in later slices) reactively updates.
13
+ *
14
+ * Cross-entry lookup is exposed via the navigator's `getScreenRegistry(key)`
15
+ * so a persistent HeaderBar can read slots from the currently-focused entry
16
+ * without needing to be itself remounted on each navigation.
17
+ */
18
+ import { type Signal } from '@sigx/lynx';
19
+ import type { ScreenOptions, ScreenSlotFills, StackEntry } from '../types.js';
20
+ /**
21
+ * Reactive container for one screen's options and slot fills.
22
+ *
23
+ * `options` and `slots` are deeply-reactive object signals (sigx's `signal()`
24
+ * of an object returns a Proxy that tracks per-key reads and notifies
25
+ * per-key writes). Writers assign individual keys; readers subscribe to the
26
+ * keys they actually use — no whole-object reads, no read/write cycles in
27
+ * setup.
28
+ */
29
+ export interface ScreenRegistry {
30
+ readonly entry: StackEntry;
31
+ /** Reactive ScreenOptions — written per-key by `<Screen>`. */
32
+ readonly options: Signal<ScreenOptions>;
33
+ /** Reactive ScreenSlotFills — written per-key by `<Screen.Header>` et al. */
34
+ readonly slots: Signal<ScreenSlotFills>;
35
+ }
36
+ /** Create a fresh registry for an entry. Options and slots start empty. */
37
+ export declare function createScreenRegistry(entry: StackEntry): ScreenRegistry;
38
+ /**
39
+ * Set a single slot fill on a registry. Pass `undefined` to clear.
40
+ * Per-key write on the proxy — does not read other keys, so it can't loop
41
+ * with effects that read different slot keys.
42
+ */
43
+ export declare function setSlot<K extends keyof ScreenSlotFills>(registry: ScreenRegistry, name: K, fill: ScreenSlotFills[K] | undefined): void;
44
+ /**
45
+ * Merge partial options into a registry. Each option key is written
46
+ * independently on the proxy — `undefined` keys clear that option.
47
+ */
48
+ export declare function mergeOptions(registry: ScreenRegistry, patch: ScreenOptions): void;
49
+ //# sourceMappingURL=screen-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen-registry.d.ts","sourceRoot":"","sources":["../../src/internal/screen-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAU,KAAK,MAAM,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EACR,aAAa,EACb,eAAe,EACf,UAAU,EACb,MAAM,aAAa,CAAC;AAErB;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAC3B,8DAA8D;IAC9D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,aAAa,CAAC,CAAC;IACxC,6EAA6E;IAC7E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,eAAe,CAAC,CAAC;CAC3C;AAED,2EAA2E;AAC3E,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,UAAU,GAAG,cAAc,CAMtE;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,eAAe,EACnD,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAE,CAAC,EACP,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC,GAAG,SAAS,GACrC,IAAI,CAQN;AAED;;;GAGG;AACH,wBAAgB,YAAY,CACxB,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,aAAa,GACrB,IAAI,CAYN"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Per-entry registry of `<Screen>` options + slot fills.
3
+ *
4
+ * Each `<EntryScope>` allocates one of these on mount and provides it to
5
+ * descendants via `defineProvide(useScreenRegistry, ...)`. The Screen
6
+ * component and its sub-components (`<Screen.Header>`, `<Screen.HeaderLeft>`,
7
+ * `<Screen.HeaderRight>`, `<Screen.TabBarItem>`) write into the registry as
8
+ * they mount.
9
+ *
10
+ * Reads track because options/slots are stored in signals — when a child
11
+ * re-renders and registers a new slot fill, the navigator-side consumer
12
+ * (HeaderBar / TabBar, shipped in later slices) reactively updates.
13
+ *
14
+ * Cross-entry lookup is exposed via the navigator's `getScreenRegistry(key)`
15
+ * so a persistent HeaderBar can read slots from the currently-focused entry
16
+ * without needing to be itself remounted on each navigation.
17
+ */
18
+ import { signal } from '@sigx/lynx';
19
+ /** Create a fresh registry for an entry. Options and slots start empty. */
20
+ export function createScreenRegistry(entry) {
21
+ return {
22
+ entry,
23
+ options: signal({}),
24
+ slots: signal({}),
25
+ };
26
+ }
27
+ /**
28
+ * Set a single slot fill on a registry. Pass `undefined` to clear.
29
+ * Per-key write on the proxy — does not read other keys, so it can't loop
30
+ * with effects that read different slot keys.
31
+ */
32
+ export function setSlot(registry, name, fill) {
33
+ if (fill === undefined) {
34
+ // Assigning undefined keeps the key around in the proxy; explicit
35
+ // delete is what consumers checking `name in slots` expect.
36
+ delete registry.slots[name];
37
+ return;
38
+ }
39
+ registry.slots[name] = fill;
40
+ }
41
+ /**
42
+ * Merge partial options into a registry. Each option key is written
43
+ * independently on the proxy — `undefined` keys clear that option.
44
+ */
45
+ export function mergeOptions(registry, patch) {
46
+ for (const key of Object.keys(patch)) {
47
+ const v = patch[key];
48
+ if (v === undefined) {
49
+ delete registry.options[key];
50
+ }
51
+ else {
52
+ // Property-level assignment on a deeply-reactive proxy: notifies
53
+ // only subscribers of this specific key, never reads the whole
54
+ // options object, so it can't trigger the setup that wrote it.
55
+ registry.options[key] = v;
56
+ }
57
+ }
58
+ }
59
+ //# sourceMappingURL=screen-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"screen-registry.js","sourceRoot":"","sources":["../../src/internal/screen-registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;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"}
@@ -0,0 +1,30 @@
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
@@ -0,0 +1 @@
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"}
@@ -1,5 +1,6 @@
1
1
  import { type SharedValue } from '@sigx/lynx';
2
2
  import type { Nav } from '../hooks/use-nav.js';
3
+ import type { ScreenRegistry } from '../internal/screen-registry.js';
3
4
  import type { RouteMap, StackEntry } from '../types.js';
4
5
  /**
5
6
  * The reactive backing state for one navigator instance.
@@ -29,6 +30,24 @@ export interface NavigatorState {
29
30
  commitBackGesture(): void;
30
31
  cancelBackGesture(): void;
31
32
  };
33
+ /**
34
+ * Internal: cross-entry `<Screen>` registry lookup.
35
+ *
36
+ * Each `<EntryScope>` registers its `ScreenRegistry` here on mount and
37
+ * removes it on unmount. The navigator's persistent chrome (HeaderBar /
38
+ * TabBar, shipped in later slices) calls `getScreenRegistry(entry.key)`
39
+ * to read the currently-focused screen's options/slot fills without
40
+ * being itself remounted on each navigation.
41
+ *
42
+ * Returns `undefined` when no screen for that key has mounted yet (or
43
+ * after it has unmounted) — consumers must tolerate this and render
44
+ * defaults.
45
+ */
46
+ readonly _screens: {
47
+ register(registry: ScreenRegistry): void;
48
+ unregister(entryKey: string): void;
49
+ get(entryKey: string): ScreenRegistry | undefined;
50
+ };
32
51
  }
33
52
  export interface CreateNavigatorOptions {
34
53
  routes: RouteMap;
@@ -37,7 +56,7 @@ export interface CreateNavigatorOptions {
37
56
  * SharedValue driving push/pop transition progress. Created in
38
57
  * `<NavigationRoot>` setup via `useSharedValue(0)` so the bridge
39
58
  * plumbing is wired (SharedValue is an MT-bridged ref). When undefined,
40
- * navigations are instant — used by tests against `@sigx/testing-lynx`
59
+ * navigations are instant — used by tests against `@sigx/lynx-testing`
41
60
  * that don't have an MT runtime.
42
61
  */
43
62
  progress?: SharedValue<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../src/navigator/core.ts"],"names":[],"mappings":"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