@sigx/lynx-navigation 0.4.0 → 0.4.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.
- package/dist/components/Drawer.js +74 -0
- package/dist/components/Drawer.js.map +1 -0
- package/dist/components/EdgeBackHandle.js +144 -0
- package/dist/components/EdgeBackHandle.js.map +1 -0
- package/dist/components/EntryScope.d.ts +1 -1
- package/dist/components/EntryScope.d.ts.map +1 -1
- package/dist/components/EntryScope.js +39 -0
- package/dist/components/EntryScope.js.map +1 -0
- package/dist/components/Header.js +103 -0
- package/dist/components/Header.js.map +1 -0
- package/dist/components/Layer.d.ts +2 -2
- package/dist/components/Layer.d.ts.map +1 -1
- package/dist/components/Layer.js +66 -0
- package/dist/components/Layer.js.map +1 -0
- package/dist/components/Link.d.ts +2 -2
- package/dist/components/Link.d.ts.map +1 -1
- package/dist/components/Link.js +51 -0
- package/dist/components/Link.js.map +1 -0
- package/dist/components/NavigationRoot.d.ts +2 -2
- package/dist/components/NavigationRoot.d.ts.map +1 -1
- package/dist/components/NavigationRoot.js +67 -0
- package/dist/components/NavigationRoot.js.map +1 -0
- package/dist/components/Screen.js +98 -0
- package/dist/components/Screen.js.map +1 -0
- package/dist/components/Stack.js +257 -0
- package/dist/components/Stack.js.map +1 -0
- package/dist/components/TabBar.d.ts +1 -1
- package/dist/components/TabBar.d.ts.map +1 -1
- package/dist/components/TabBar.js +63 -0
- package/dist/components/TabBar.js.map +1 -0
- package/dist/components/Tabs.d.ts +8 -3
- package/dist/components/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs.js +168 -0
- package/dist/components/Tabs.js.map +1 -0
- package/dist/define-routes.d.ts +1 -1
- package/dist/define-routes.d.ts.map +1 -1
- package/{src/define-routes.d.ts → dist/define-routes.js} +4 -2
- package/dist/define-routes.js.map +1 -0
- package/dist/hooks/use-focus.js +87 -0
- package/dist/hooks/use-focus.js.map +1 -0
- package/dist/hooks/use-hardware-back.js +84 -0
- package/dist/hooks/use-hardware-back.js.map +1 -0
- package/dist/hooks/use-linking-nav.d.ts +3 -3
- package/dist/hooks/use-linking-nav.d.ts.map +1 -1
- package/dist/hooks/use-linking-nav.js +109 -0
- package/dist/hooks/use-linking-nav.js.map +1 -0
- package/dist/hooks/use-nav-internal.d.ts +2 -2
- package/dist/hooks/use-nav-internal.d.ts.map +1 -1
- package/dist/hooks/use-nav-internal.js +55 -0
- package/dist/hooks/use-nav-internal.js.map +1 -0
- package/dist/hooks/use-nav-serializer.d.ts +1 -1
- package/dist/hooks/use-nav-serializer.d.ts.map +1 -1
- package/dist/hooks/use-nav-serializer.js +181 -0
- package/dist/hooks/use-nav-serializer.js.map +1 -0
- package/dist/hooks/use-nav.d.ts +2 -2
- package/dist/hooks/use-nav.d.ts.map +1 -1
- package/dist/hooks/use-nav.js +11 -0
- package/dist/hooks/use-nav.js.map +1 -0
- package/dist/hooks/use-params.d.ts +1 -1
- package/dist/hooks/use-params.d.ts.map +1 -1
- package/{src/hooks/use-params.d.ts → dist/hooks/use-params.js} +6 -2
- package/dist/hooks/use-params.js.map +1 -0
- package/dist/hooks/use-screen-chrome.d.ts +1 -1
- package/dist/hooks/use-screen-chrome.d.ts.map +1 -1
- package/dist/hooks/use-screen-chrome.js +102 -0
- package/dist/hooks/use-screen-chrome.js.map +1 -0
- package/dist/hooks/use-screen-options.d.ts +1 -1
- package/dist/hooks/use-screen-options.d.ts.map +1 -1
- package/dist/hooks/use-screen-options.js +43 -0
- package/dist/hooks/use-screen-options.js.map +1 -0
- package/dist/hooks/use-search.d.ts +1 -1
- package/dist/hooks/use-search.d.ts.map +1 -1
- package/{src/hooks/use-search.d.ts → dist/hooks/use-search.js} +6 -2
- package/dist/hooks/use-search.js.map +1 -0
- package/dist/href.d.ts +2 -2
- package/dist/href.d.ts.map +1 -1
- package/dist/href.js +57 -0
- package/dist/href.js.map +1 -0
- package/dist/index.d.ts +33 -33
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -1160
- package/dist/index.js.map +1 -1
- package/dist/internal/layer-plan.d.ts +1 -1
- package/dist/internal/layer-plan.d.ts.map +1 -1
- package/dist/internal/layer-plan.js +102 -0
- package/dist/internal/layer-plan.js.map +1 -0
- package/dist/internal/screen-registry.d.ts +1 -1
- package/dist/internal/screen-registry.d.ts.map +1 -1
- package/{src/internal/screen-registry.d.ts → dist/internal/screen-registry.js} +32 -21
- package/dist/internal/screen-registry.js.map +1 -0
- package/{src/internal/screen-width.d.ts → dist/internal/screen-width.js} +17 -2
- package/dist/internal/screen-width.js.map +1 -0
- package/dist/navigator/core.d.ts +3 -3
- package/dist/navigator/core.d.ts.map +1 -1
- package/dist/navigator/core.js +394 -0
- package/dist/navigator/core.js.map +1 -0
- package/dist/register.d.ts +1 -1
- package/dist/register.d.ts.map +1 -1
- package/dist/register.js +2 -0
- package/dist/register.js.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/dist/url/build.js +30 -0
- package/dist/url/build.js.map +1 -0
- package/dist/url/compile.js +83 -0
- package/dist/url/compile.js.map +1 -0
- package/dist/url/format.js +102 -0
- package/dist/url/format.js.map +1 -0
- package/dist/url/index.d.ts +6 -6
- package/dist/url/index.d.ts.map +1 -1
- package/dist/url/index.js +13 -0
- package/dist/url/index.js.map +1 -0
- package/dist/url/parse.d.ts +1 -1
- package/dist/url/parse.d.ts.map +1 -1
- package/dist/url/parse.js +94 -0
- package/dist/url/parse.js.map +1 -0
- package/dist/url/registry.d.ts +2 -2
- package/dist/url/registry.d.ts.map +1 -1
- package/{src/url/registry.d.ts → dist/url/registry.js} +28 -12
- package/dist/url/registry.js.map +1 -0
- package/dist/url/validate.d.ts +1 -1
- package/dist/url/validate.d.ts.map +1 -1
- package/dist/url/validate.js +37 -0
- package/dist/url/validate.js.map +1 -0
- package/package.json +16 -13
- package/src/components/EdgeBackHandle.tsx +2 -2
- package/src/components/EntryScope.tsx +3 -3
- package/src/components/Header.tsx +3 -3
- package/src/components/Layer.tsx +3 -3
- package/src/components/Link.tsx +4 -4
- package/src/components/NavigationRoot.tsx +6 -6
- package/src/components/Screen.tsx +3 -3
- package/src/components/Stack.tsx +8 -8
- package/src/components/TabBar.tsx +1 -1
- package/src/components/Tabs.tsx +8 -3
- package/src/define-routes.ts +1 -1
- package/src/hooks/use-focus.ts +2 -2
- package/src/hooks/use-hardware-back.ts +1 -1
- package/src/hooks/use-linking-nav.ts +4 -4
- package/src/hooks/use-nav-internal.ts +2 -2
- package/src/hooks/use-nav-serializer.ts +3 -3
- package/src/hooks/use-nav.ts +2 -2
- package/src/hooks/use-params.ts +2 -2
- package/src/hooks/use-screen-chrome.ts +3 -3
- package/src/hooks/use-screen-options.ts +3 -3
- package/src/hooks/use-search.ts +2 -2
- package/src/href.ts +6 -6
- package/src/index.ts +33 -33
- package/src/internal/layer-plan.ts +2 -2
- package/src/internal/screen-registry.ts +1 -1
- package/src/navigator/core.ts +3 -3
- package/src/register.ts +1 -1
- package/src/url/build.ts +2 -2
- package/src/url/index.ts +6 -6
- package/src/url/parse.ts +6 -6
- package/src/url/registry.ts +3 -3
- package/src/url/validate.ts +1 -1
- package/src/components/Drawer.d.ts +0 -55
- package/src/components/EdgeBackHandle.d.ts +0 -1
- package/src/components/EntryScope.d.ts +0 -25
- package/src/components/Header.d.ts +0 -6
- package/src/components/Layer.d.ts +0 -33
- package/src/components/Link.d.ts +0 -60
- package/src/components/NavigationRoot.d.ts +0 -36
- package/src/components/Screen.d.ts +0 -97
- package/src/components/Stack.d.ts +0 -90
- package/src/components/TabBar.d.ts +0 -38
- package/src/components/Tabs.d.ts +0 -109
- package/src/hooks/use-focus.d.ts +0 -45
- package/src/hooks/use-hardware-back.d.ts +0 -37
- package/src/hooks/use-linking-nav.d.ts +0 -91
- package/src/hooks/use-nav-internal.d.ts +0 -91
- package/src/hooks/use-nav-serializer.d.ts +0 -82
- package/src/hooks/use-nav.d.ts +0 -111
- package/src/hooks/use-screen-chrome.d.ts +0 -18
- package/src/hooks/use-screen-options.d.ts +0 -2
- package/src/href.d.ts +0 -54
- package/src/index.d.ts +0 -39
- package/src/internal/layer-plan.d.ts +0 -68
- package/src/navigator/core.d.ts +0 -96
- package/src/register.d.ts +0 -37
- package/src/types.d.ts +0 -217
- package/src/url/build.d.ts +0 -15
- package/src/url/compile.d.ts +0 -34
- package/src/url/format.d.ts +0 -28
- package/src/url/parse.d.ts +0 -20
- package/src/url/validate.d.ts +0 -23
|
@@ -0,0 +1,181 @@
|
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-nav-serializer.js","sourceRoot":"","sources":["../../src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AC,CAAC,YAAY,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;IACzD,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
package/dist/hooks/use-nav.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RegisteredRoutes, RouteId, RouteParams, RouteSearch } from '../register';
|
|
2
|
-
import type { PopOptions, PushOptions, RouteRequiresParams, StackEntry, TransitionState } from '../types';
|
|
1
|
+
import type { RegisteredRoutes, RouteId, RouteParams, RouteSearch } from '../register.js';
|
|
2
|
+
import type { PopOptions, PushOptions, RouteRequiresParams, StackEntry, TransitionState } from '../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Subset of registered route names that declare a `params` schema (and so
|
|
5
5
|
* require a `params` argument when navigating).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-nav.d.ts","sourceRoot":"","sources":["../../src/hooks/use-nav.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"use-nav.d.ts","sourceRoot":"","sources":["../../src/hooks/use-nav.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC1F,OAAO,KAAK,EACR,UAAU,EACV,WAAW,EACX,mBAAmB,EACnB,UAAU,EACV,eAAe,EAClB,MAAM,aAAa,CAAC;AAErB;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,gBAAgB,GAAG;KAC1B,CAAC,IAAI,OAAO,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,GAAG,KAAK;CACpF,CAAC,OAAO,CAAC,CAAC;AAEX,mDAAmD;AACnD,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,EAAE,gBAAg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EhB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAE7B,sCAAsC;IACtC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;IAE1C,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAE5B;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,MAAM,EAAE,GAAG,GAAG,IAAI,CAAC;IAE5B;;;;;;;;;OASG;IACH,QAAQ,CAAC,gBAAgB,EAAE,OAAO,CAAC;IAEnC;;;;;;;;;OASG;IACH,QAAQ,CAAC,SAAS,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC;IAE7B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,IAAI,CAAC;CAC/C;AAED;;;;;GAKG;AACH,eAAO,MAAM,MAAM,sDAIjB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defineInjectable } from '@sigx/lynx';
|
|
2
|
+
/**
|
|
3
|
+
* 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
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-params.d.ts","sourceRoot":"","sources":["../../src/hooks/use-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"use-params.d.ts","sourceRoot":"","sources":["../../src/hooks/use-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG3D;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAGrE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useNav } from './use-nav.js';
|
|
2
2
|
/**
|
|
3
3
|
* Read the typed params for the current screen, asserted against the named
|
|
4
4
|
* route from the registry.
|
|
@@ -15,4 +15,8 @@ import type { RouteId, RouteParams } from '../register';
|
|
|
15
15
|
* update for the same mounted screen" path in v0.1, so a snapshot at setup
|
|
16
16
|
* time is correct.
|
|
17
17
|
*/
|
|
18
|
-
export
|
|
18
|
+
export function useParams(_name) {
|
|
19
|
+
const nav = useNav();
|
|
20
|
+
return nav.current.params;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=use-params.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-screen-chrome.d.ts","sourceRoot":"","sources":["../../src/hooks/use-screen-chrome.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,eAAe,EAAc,MAAM,
|
|
1
|
+
{"version":3,"file":"use-screen-chrome.d.ts","sourceRoot":"","sources":["../../src/hooks/use-screen-chrome.ts"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAE,eAAe,EAAc,MAAM,aAAa,CAAC;AAE/D,MAAM,WAAW,YAAY;IACzB,0GAA0G;IAC1G,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+GAA+G;IAC/G,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,6GAA6G;IAC7G,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,kDAAkD;IAClD,GAAG,IAAI,IAAI,CAAC;IACZ,uHAAuH;IACvH,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IACvD,6DAA6D;IAC7D,QAAQ,CAAC,UAAU,EAAE,eAAe,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC;IAC/D,wDAAwD;IACxD,QAAQ,CAAC,WAAW,EAAE,eAAe,CAAC,aAAa,CAAC,GAAG,SAAS,CAAC;CACpE;AAED,wBAAgB,eAAe,IAAI,YAAY,CAuE9C"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `useScreenChrome` — reactive read of the currently-focused screen's
|
|
3
|
+
* options + slot fills, plus navigation helpers a header would need
|
|
4
|
+
* (canGoBack, pop).
|
|
5
|
+
*
|
|
6
|
+
* The built-in `<Header />` reads this same data via internal hooks.
|
|
7
|
+
* `useScreenChrome` exposes it as a public API so theme packages
|
|
8
|
+
* (`@sigx/lynx-daisyui`, custom designs) can build their own header
|
|
9
|
+
* components without depending on internal modules.
|
|
10
|
+
*
|
|
11
|
+
* Resolution rules:
|
|
12
|
+
*
|
|
13
|
+
* - **Inside a screen body** (i.e. inside an EntryScope whose entry is
|
|
14
|
+
* on the nearest `useNav()`'s stack), bind to **this entry's**
|
|
15
|
+
* registry. Useful for modal screens that render their own
|
|
16
|
+
* NavHeader inside — the chrome slides with the sheet.
|
|
17
|
+
* - **Outside any matching EntryScope** (slot of `<Stack>`, persistent
|
|
18
|
+
* root-level Header, etc.), bind to the *destination* entry of the
|
|
19
|
+
* current nav state — what the navigator is settling on once the
|
|
20
|
+
* in-flight transition completes. Push: the new top (already at
|
|
21
|
+
* nav.current). Pop: the entry being revealed
|
|
22
|
+
* (`transition.underneathEntry`), *not* the one being animated off.
|
|
23
|
+
* Using the destination means the bar reflects what the user is
|
|
24
|
+
* navigating *to*, immediately, with no end-of-animation snap.
|
|
25
|
+
*
|
|
26
|
+
* Every property is a getter — reading inside a render / `computed`
|
|
27
|
+
* subscribes to the underlying signal, so consumers re-render when
|
|
28
|
+
* title / slots change.
|
|
29
|
+
*/
|
|
30
|
+
import { useNav } from './use-nav.js';
|
|
31
|
+
import { useCurrentEntryOptional, useNavInternals } from './use-nav-internal.js';
|
|
32
|
+
export function useScreenChrome() {
|
|
33
|
+
const nav = useNav();
|
|
34
|
+
const internals = useNavInternals();
|
|
35
|
+
// The candidate "scoped" entry, if we happen to be rendered inside
|
|
36
|
+
// an EntryScope. May belong to a DIFFERENT nav than `nav` — e.g.
|
|
37
|
+
// when NavHeader is placed in a per-tab `<Stack>`'s chrome slot,
|
|
38
|
+
// it sees the outer (root) EntryScope's entry but its `useNav()`
|
|
39
|
+
// returns the inner per-tab nav. We only honor the pin when the
|
|
40
|
+
// entry is actually on this nav's stack; otherwise we're crossing
|
|
41
|
+
// scopes and the destination-entry path is correct.
|
|
42
|
+
//
|
|
43
|
+
// `useCurrentEntryOptional` is the soft companion to
|
|
44
|
+
// `useCurrentEntry` — it returns `null` outside any EntryScope
|
|
45
|
+
// rather than throwing, which is the right semantic for a chrome
|
|
46
|
+
// consumer that *might* be a Stack slot.
|
|
47
|
+
const candidate = useCurrentEntryOptional();
|
|
48
|
+
const getDestinationEntry = () => {
|
|
49
|
+
const t = nav.transition;
|
|
50
|
+
if (t) {
|
|
51
|
+
return t.kind === 'pop' ? t.underneathEntry : t.topEntry;
|
|
52
|
+
}
|
|
53
|
+
return nav.current;
|
|
54
|
+
};
|
|
55
|
+
const getEntry = () => {
|
|
56
|
+
if (candidate) {
|
|
57
|
+
const stack = nav.stack;
|
|
58
|
+
if (stack.some((e) => e.key === candidate.key)) {
|
|
59
|
+
return candidate;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return getDestinationEntry();
|
|
63
|
+
};
|
|
64
|
+
return {
|
|
65
|
+
get title() {
|
|
66
|
+
const entry = getEntry();
|
|
67
|
+
const reg = internals.screens.get(entry.key);
|
|
68
|
+
const t = reg?.options.title;
|
|
69
|
+
if (typeof t === 'function')
|
|
70
|
+
return t();
|
|
71
|
+
if (typeof t === 'string')
|
|
72
|
+
return t;
|
|
73
|
+
return entry.route;
|
|
74
|
+
},
|
|
75
|
+
get headerShown() {
|
|
76
|
+
const reg = internals.screens.get(getEntry().key);
|
|
77
|
+
return reg?.options.headerShown !== false;
|
|
78
|
+
},
|
|
79
|
+
get canGoBack() {
|
|
80
|
+
const entry = getEntry();
|
|
81
|
+
const stack = nav.stack;
|
|
82
|
+
const idx = stack.findIndex((e) => e.key === entry.key);
|
|
83
|
+
return idx > 0;
|
|
84
|
+
},
|
|
85
|
+
pop() {
|
|
86
|
+
nav.pop();
|
|
87
|
+
},
|
|
88
|
+
get header() {
|
|
89
|
+
const reg = internals.screens.get(getEntry().key);
|
|
90
|
+
return reg?.slots.header;
|
|
91
|
+
},
|
|
92
|
+
get headerLeft() {
|
|
93
|
+
const reg = internals.screens.get(getEntry().key);
|
|
94
|
+
return reg?.slots.headerLeft;
|
|
95
|
+
},
|
|
96
|
+
get headerRight() {
|
|
97
|
+
const reg = internals.screens.get(getEntry().key);
|
|
98
|
+
return reg?.slots.headerRight;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=use-screen-chrome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-screen-chrome.js","sourceRoot":"","sources":["../../src/hooks/use-screen-chrome.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAoBjF,MAAM,UAAU,eAAe;IAC3B,MAAM,GAAG,GAAG,MAAM,EAAE,CAAC;IACrB,MAAM,SAAS,GAAG,eAAe,EAAE,CAAC;IAEpC,mEAAmE;IACnE,iEAAiE;IACjE,iEAAiE;IACjE,iEAAiE;IACjE,gEAAgE;IAChE,kEAAkE;IAClE,oDAAoD;IACpD,EAAE;IACF,qDAAqD;IACrD,+DAA+D;IAC/D,iEAAiE;IACjE,yCAAyC;IACzC,MAAM,SAAS,GAAsB,uBAAuB,EAAE,CAAC;IAE/D,MAAM,mBAAmB,GAAG,GAAe,EAAE;QACzC,MAAM,CAAC,GAAG,GAAG,CAAC,UAAU,CAAC;QACzB,IAAI,CAAC,EAAE,CAAC;YACJ,OAAO,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC;QAC7D,CAAC;QACD,OAAO,GAAG,CAAC,OAAO,CAAC;IACvB,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAG,GAAe,EAAE;QAC9B,IAAI,SAAS,EAAE,CAAC;YACZ,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;YACxB,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,KAAK,SAAU,CAAC,G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,IAAI,UAAU;YACV,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;YAClD,OAAO,GAAG,EAAE,KAAK,CAAC,UAAU,CAAC;QACjC,CAAC;QACD,IAAI,WAAW;YACX,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;YAClD,OAAO,GAAG,EAAE,KAAK,CAAC,WAAW,CAAC;QAClC,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../src/hooks/use-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"use-search.d.ts","sourceRoot":"","sources":["../../src/hooks/use-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAG3D;;;;;;;GAOG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAGrE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useNav } from './use-nav.js';
|
|
2
2
|
/**
|
|
3
3
|
* Read the typed search/query params for the current screen, asserted against
|
|
4
4
|
* the named route from the registry.
|
|
@@ -7,4 +7,8 @@ import type { RouteId, RouteSearch } from '../register';
|
|
|
7
7
|
* reactivity story — each navigation triggers a remount via the entry-keyed
|
|
8
8
|
* Stack, so a setup-time snapshot is sufficient.
|
|
9
9
|
*/
|
|
10
|
-
export
|
|
10
|
+
export function useSearch(_name) {
|
|
11
|
+
const nav = useNav();
|
|
12
|
+
return nav.current.search;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=use-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { RouteId, RouteParams, RouteSearch } from './register';
|
|
2
|
-
import type { RoutesWithoutParams, RoutesWithParams } from './hooks/use-nav';
|
|
1
|
+
import type { RouteId, RouteParams, RouteSearch } from './register.js';
|
|
2
|
+
import type { RoutesWithoutParams, RoutesWithParams } from './hooks/use-nav.js';
|
|
3
3
|
/**
|
|
4
4
|
* A typed reference to a navigation target — what `<Link to={...}>` consumes
|
|
5
5
|
* and what `hrefFor()` produces.
|
package/dist/href.d.ts.map
CHANGED
|
@@ -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,
|
|
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;AAMhF;;;;;;;GAOG;AACH,MAAM,WAAW,IAAI,CAAC,CAAC,SAAS,OAAO,GAAG,OAAO;IAC7C,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAClB,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAChC,mEAAmE;IACnE,QAAQ,CAAC,GAAG,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
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
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
ADDED
|
@@ -0,0 +1 @@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IACN,CAAC;IACD,MAAM,aAAa,GAAG,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,SAAS,IAAI,EAAE,CAAC,CAAC;IAChE,IAAI,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
|
@@ -4,37 +4,37 @@
|
|
|
4
4
|
* Phase 0.1 (current): typed registry, stack runtime, NavigationRoot + Stack.
|
|
5
5
|
* Coming next: Screen with slot-based header API, MTS transitions, Tabs.
|
|
6
6
|
*/
|
|
7
|
-
export { defineRoutes } from './define-routes';
|
|
8
|
-
export type { Register, RegisteredRoutes, RouteId, RouteParams, RouteSearch } from './register';
|
|
9
|
-
export { useNav } from './hooks/use-nav';
|
|
10
|
-
export type { Nav, RoutesWithoutParams, RoutesWithParams } from './hooks/use-nav';
|
|
11
|
-
export { useParams } from './hooks/use-params';
|
|
12
|
-
export { useSearch } from './hooks/use-search';
|
|
13
|
-
export { useHardwareBack } from './hooks/use-hardware-back';
|
|
14
|
-
export { useLinkingNav } from './hooks/use-linking-nav';
|
|
15
|
-
export type { UseLinkingNavOptions } from './hooks/use-linking-nav';
|
|
16
|
-
export { useIsFocused, useFocusEffect } from './hooks/use-focus';
|
|
17
|
-
export { useScreenOptions } from './hooks/use-screen-options';
|
|
18
|
-
export { useScreenChrome } from './hooks/use-screen-chrome';
|
|
19
|
-
export type { ScreenChrome } from './hooks/use-screen-chrome';
|
|
20
|
-
export { useNavSerializer, NAV_SNAPSHOT_VERSION, } from './hooks/use-nav-serializer';
|
|
21
|
-
export type { NavSnapshot, NavStorageAdapter, UseNavSerializerOptions, } from './hooks/use-nav-serializer';
|
|
22
|
-
export { hrefFor, parseHref } from './href';
|
|
23
|
-
export type { Href } from './href';
|
|
24
|
-
export { _setRouteRegistry, _clearRouteRegistry } from './url/registry';
|
|
25
|
-
export { compilePath } from './url/compile';
|
|
26
|
-
export type { CompiledPath } from './url/compile';
|
|
27
|
-
export { NavigationRoot } from './components/NavigationRoot';
|
|
28
|
-
export { Stack } from './components/Stack';
|
|
29
|
-
export { Screen } from './components/Screen';
|
|
30
|
-
export { Header } from './components/Header';
|
|
31
|
-
export { Tabs, useTabs } from './components/Tabs';
|
|
32
|
-
export type { TabInfo, TabsNav } from './components/Tabs';
|
|
33
|
-
export { TabBar } from './components/TabBar';
|
|
34
|
-
export type { TabRenderContext } from './components/TabBar';
|
|
35
|
-
export { Drawer, useDrawer } from './components/Drawer';
|
|
36
|
-
export type { DrawerNav } from './components/Drawer';
|
|
37
|
-
export { Link } from './components/Link';
|
|
38
|
-
export type { LinkProps } from './components/Link';
|
|
39
|
-
export type { ComponentLike, EmptyParams, InferOutput, ParamsOf, PopOptions, Presentation, PushOptions, RouteDefinition, RouteMap, RouteRequiresParams, ScreenOptions, ScreenSlotFills, SearchOf, StackEntry, StandardSchemaV1, TransitionKind, TransitionRole, TransitionState, } from './types';
|
|
7
|
+
export { defineRoutes } from './define-routes.js';
|
|
8
|
+
export type { Register, RegisteredRoutes, RouteId, RouteParams, RouteSearch } from './register.js';
|
|
9
|
+
export { useNav } from './hooks/use-nav.js';
|
|
10
|
+
export type { Nav, RoutesWithoutParams, RoutesWithParams } from './hooks/use-nav.js';
|
|
11
|
+
export { useParams } from './hooks/use-params.js';
|
|
12
|
+
export { useSearch } from './hooks/use-search.js';
|
|
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 { useScreenChrome } from './hooks/use-screen-chrome.js';
|
|
19
|
+
export type { ScreenChrome } from './hooks/use-screen-chrome.js';
|
|
20
|
+
export { useNavSerializer, NAV_SNAPSHOT_VERSION, } from './hooks/use-nav-serializer.js';
|
|
21
|
+
export type { NavSnapshot, NavStorageAdapter, UseNavSerializerOptions, } from './hooks/use-nav-serializer.js';
|
|
22
|
+
export { hrefFor, parseHref } from './href.js';
|
|
23
|
+
export type { Href } from './href.js';
|
|
24
|
+
export { _setRouteRegistry, _clearRouteRegistry } from './url/registry.js';
|
|
25
|
+
export { compilePath } from './url/compile.js';
|
|
26
|
+
export type { CompiledPath } from './url/compile.js';
|
|
27
|
+
export { NavigationRoot } from './components/NavigationRoot.js';
|
|
28
|
+
export { Stack } from './components/Stack.js';
|
|
29
|
+
export { Screen } from './components/Screen.js';
|
|
30
|
+
export { Header } from './components/Header.js';
|
|
31
|
+
export { Tabs, useTabs } from './components/Tabs.js';
|
|
32
|
+
export type { TabInfo, TabsNav } from './components/Tabs.js';
|
|
33
|
+
export { TabBar } from './components/TabBar.js';
|
|
34
|
+
export type { TabRenderContext } from './components/TabBar.js';
|
|
35
|
+
export { Drawer, useDrawer } from './components/Drawer.js';
|
|
36
|
+
export type { DrawerNav } from './components/Drawer.js';
|
|
37
|
+
export { Link } from './components/Link.js';
|
|
38
|
+
export type { LinkProps } from './components/Link.js';
|
|
39
|
+
export type { ComponentLike, EmptyParams, InferOutput, ParamsOf, PopOptions, Presentation, PushOptions, RouteDefinition, RouteMap, RouteRequiresParams, ScreenOptions, ScreenSlotFills, SearchOf, StackEntry, StandardSchemaV1, TransitionKind, TransitionRole, TransitionState, } from './types.js';
|
|
40
40
|
//# sourceMappingURL=index.d.ts.map
|