@tyndall/react 0.0.1 → 0.0.3
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/README.md +4 -0
- package/dist/adapter.d.ts +10 -1
- package/dist/adapter.d.ts.map +1 -1
- package/dist/adapter.js +254 -34
- package/dist/hooks.d.ts +2 -0
- package/dist/hooks.d.ts.map +1 -0
- package/dist/hooks.js +31 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +8 -1
- package/dist/route-data.d.ts +5 -0
- package/dist/route-data.d.ts.map +1 -0
- package/dist/route-data.js +4 -0
- package/dist/router.d.ts +19 -1
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +287 -39
- package/dist/types.d.ts +15 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/router.d.ts
CHANGED
|
@@ -20,9 +20,16 @@ export interface RoutePayload {
|
|
|
20
20
|
routeId: string;
|
|
21
21
|
appHtml: string;
|
|
22
22
|
propsPayload: string;
|
|
23
|
+
routeDataPayload?: string;
|
|
23
24
|
head?: HeadDescriptor;
|
|
24
25
|
hydration?: HydrationMode;
|
|
25
26
|
}
|
|
27
|
+
export interface RouteRedirectPayload {
|
|
28
|
+
kind: "hyper-route-redirect";
|
|
29
|
+
destination: string;
|
|
30
|
+
status?: number;
|
|
31
|
+
replace?: boolean;
|
|
32
|
+
}
|
|
26
33
|
export interface ClientRouteModuleContext {
|
|
27
34
|
href: string;
|
|
28
35
|
pathname: string;
|
|
@@ -34,6 +41,8 @@ export interface ClientRouteRenderResult {
|
|
|
34
41
|
routeId?: string;
|
|
35
42
|
appHtml: string;
|
|
36
43
|
propsPayload?: string;
|
|
44
|
+
routeDataPayload?: string;
|
|
45
|
+
routeData?: Record<string, unknown>;
|
|
37
46
|
head?: HeadDescriptor;
|
|
38
47
|
hydration?: HydrationMode;
|
|
39
48
|
}
|
|
@@ -50,7 +59,7 @@ export interface ClientRouteModuleResolverContext {
|
|
|
50
59
|
export type ClientRouteModuleResolver = (ctx: ClientRouteModuleResolverContext) => Promise<ClientRouteModule | null>;
|
|
51
60
|
export type ClientRouteModuleLoader = () => Promise<unknown>;
|
|
52
61
|
export type ClientRouteModuleLoaderMap = Record<string, ClientRouteModuleLoader>;
|
|
53
|
-
export type RoutePayloadResolver = (href: string) => Promise<RoutePayload | null>;
|
|
62
|
+
export type RoutePayloadResolver = (href: string) => Promise<RoutePayload | RouteRedirectPayload | null>;
|
|
54
63
|
export type RoutePayloadApplier = (payload: RoutePayload) => void | Promise<void>;
|
|
55
64
|
export interface RouterOptions {
|
|
56
65
|
routeGraph?: RouteGraph;
|
|
@@ -65,15 +74,24 @@ export interface RouterOptions {
|
|
|
65
74
|
buildMode?: "ssg" | "ssr";
|
|
66
75
|
onWarning?: (message: string) => void;
|
|
67
76
|
fallbackPolicy?: ResolverFallbackPolicy;
|
|
77
|
+
scrollRestoration?: boolean;
|
|
68
78
|
}
|
|
69
79
|
export interface Router {
|
|
70
80
|
pathname: string;
|
|
71
81
|
query: RouterQuery;
|
|
72
82
|
push: (href: string) => Promise<void>;
|
|
73
83
|
replace: (href: string) => Promise<void>;
|
|
84
|
+
softReload: () => Promise<void>;
|
|
74
85
|
prefetch: (href: string) => Promise<void>;
|
|
75
86
|
subscribe: (listener: (router: Router) => void) => () => void;
|
|
87
|
+
block: (blocker: NavigationBlocker) => () => void;
|
|
88
|
+
}
|
|
89
|
+
export interface NavigationBlockContext {
|
|
90
|
+
href: string;
|
|
91
|
+
replace: boolean;
|
|
92
|
+
type: "push" | "replace" | "popstate" | "softReload" | "redirect";
|
|
76
93
|
}
|
|
94
|
+
export type NavigationBlocker = (ctx: NavigationBlockContext) => boolean | string | void;
|
|
77
95
|
export declare const createClientRouteModuleResolver: (loaders: ClientRouteModuleLoaderMap) => ClientRouteModuleResolver;
|
|
78
96
|
export declare const createRouter: (initialHref?: string | RouterOptions, options?: RouterOptions) => Router;
|
|
79
97
|
export declare const getRouter: () => Router;
|
package/dist/router.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../src/router.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAIvB,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC;AAE5D,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;AAC/D,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,SAAS,CAAC;AAC/C,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,QAAQ,CAAC;AAC9C,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEpD,MAAM,WAAW,qBAAqB;IACpC,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACtC,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,MAAM,uBAAuB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC;AAEhG,MAAM,MAAM,uBAAuB,GAAG,CACpC,IAAI,EAAE,OAAO,EACb,QAAQ,EAAE,uBAAuB,KAC9B,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAE1B,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,qBAAqB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AAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAChC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1C,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,KAAK,MAAM,IAAI,CAAC;IAC9D,KAAK,EAAE,CAAC,OAAO,EAAE,iBAAiB,KAAK,MAAM,IAAI,CAAC;CACnD;AAED,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,YAAY,GAAG,UAAU,CAAC;CACnE;AAED,MAAM,MAAM,iBAAiB,GAAG,CAAC,GAAG,EAAE,sBAAsB,KAAK,OAAO,GAAG,MAAM,GAAG,IAAI,CAAC;AAiWzF,eAAO,MAAM,+BAA+B,GAC1C,SAAS,0BAA0B,KAClC,yBAcF,CAAC;AASF,eAAO,MAAM,YAAY,GACvB,cAAc,MAAM,GAAG,aAAa,EACpC,UAAU,aAAa,KACtB,MA0bF,CAAC;AAIF,eAAO,MAAM,SAAS,QAAO,MAK5B,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,QAAQ,MAAM,KAAG,IAE1C,CAAC;AAEF,eAAO,MAAM,SAAS,QAAO,MAAqB,CAAC"}
|
package/dist/router.js
CHANGED
|
@@ -1,10 +1,41 @@
|
|
|
1
|
-
import { evaluateRenderPolicy, shouldForceDynamicFallback, } from "@tyndall/core";
|
|
1
|
+
import { evaluateRenderPolicy, shouldForceDynamicFallback, ROUTE_DATA_SCRIPT_ID, } from "@tyndall/core";
|
|
2
2
|
import { applyHead } from "./head-manager.js";
|
|
3
3
|
import { createReactRouterRouteMatcher } from "./react-router-bridge.js";
|
|
4
4
|
const NAVIGATION_HEADER = "x-hyper-navigation";
|
|
5
5
|
const NAVIGATION_MODE = "csr";
|
|
6
6
|
const ROUTE_PAYLOAD_EVENT = "hyper:route-payload-applied";
|
|
7
|
+
const ROUTE_DATA_EVENT = "hyper:route-data-applied";
|
|
8
|
+
const ROUTE_REDIRECT_KIND = "hyper-route-redirect";
|
|
7
9
|
const inflightPrefetchRequests = new Map();
|
|
10
|
+
const navigationBlockers = new Set();
|
|
11
|
+
const resolveBlockDecision = (result) => {
|
|
12
|
+
if (typeof result === "string") {
|
|
13
|
+
if (typeof globalThis !== "undefined" && typeof globalThis.confirm === "function") {
|
|
14
|
+
return globalThis.confirm(result);
|
|
15
|
+
}
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
if (result === false) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
};
|
|
23
|
+
const runNavigationBlockers = (ctx) => {
|
|
24
|
+
if (navigationBlockers.size === 0) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
for (const blocker of navigationBlockers) {
|
|
28
|
+
const decision = resolveBlockDecision(blocker(ctx));
|
|
29
|
+
if (!decision) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
};
|
|
35
|
+
if (typeof globalThis !== "undefined") {
|
|
36
|
+
globalThis
|
|
37
|
+
.__HYPER_NAVIGATION_GUARD__ = runNavigationBlockers;
|
|
38
|
+
}
|
|
8
39
|
const hasBrowserHistory = () => typeof globalThis !== "undefined" &&
|
|
9
40
|
"history" in globalThis &&
|
|
10
41
|
Boolean(globalThis.history);
|
|
@@ -65,6 +96,17 @@ const parseHref = (href, baseUrl) => {
|
|
|
65
96
|
return { pathname: url.pathname, query };
|
|
66
97
|
};
|
|
67
98
|
const isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
99
|
+
const parseJsonPayload = (value) => {
|
|
100
|
+
if (!value) {
|
|
101
|
+
return {};
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
return JSON.parse(value);
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
return {};
|
|
108
|
+
}
|
|
109
|
+
};
|
|
68
110
|
const isClientRouteRenderResult = (value) => {
|
|
69
111
|
if (!isRecord(value) || typeof value.appHtml !== "string") {
|
|
70
112
|
return false;
|
|
@@ -75,6 +117,12 @@ const isClientRouteRenderResult = (value) => {
|
|
|
75
117
|
if (value.propsPayload !== undefined && typeof value.propsPayload !== "string") {
|
|
76
118
|
return false;
|
|
77
119
|
}
|
|
120
|
+
if (value.routeDataPayload !== undefined && typeof value.routeDataPayload !== "string") {
|
|
121
|
+
return false;
|
|
122
|
+
}
|
|
123
|
+
if (value.routeData !== undefined && !isRecord(value.routeData)) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
78
126
|
if (value.hydration !== undefined &&
|
|
79
127
|
value.hydration !== "full" &&
|
|
80
128
|
value.hydration !== "islands") {
|
|
@@ -93,6 +141,9 @@ const isRoutePayload = (value) => {
|
|
|
93
141
|
typeof payload.propsPayload !== "string") {
|
|
94
142
|
return false;
|
|
95
143
|
}
|
|
144
|
+
if (payload.routeDataPayload !== undefined && typeof payload.routeDataPayload !== "string") {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
96
147
|
if (payload.hydration !== undefined &&
|
|
97
148
|
payload.hydration !== "full" &&
|
|
98
149
|
payload.hydration !== "islands") {
|
|
@@ -100,6 +151,19 @@ const isRoutePayload = (value) => {
|
|
|
100
151
|
}
|
|
101
152
|
return true;
|
|
102
153
|
};
|
|
154
|
+
const isRouteRedirectPayload = (value) => {
|
|
155
|
+
if (!value || typeof value !== "object") {
|
|
156
|
+
return false;
|
|
157
|
+
}
|
|
158
|
+
const payload = value;
|
|
159
|
+
if (payload.kind !== ROUTE_REDIRECT_KIND) {
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
if (typeof payload.destination !== "string") {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
return true;
|
|
166
|
+
};
|
|
103
167
|
const resolveRoutePayloadFromServer = async (href, baseUrl) => {
|
|
104
168
|
if (typeof fetch === "undefined") {
|
|
105
169
|
return null;
|
|
@@ -121,7 +185,13 @@ const resolveRoutePayloadFromServer = async (href, baseUrl) => {
|
|
|
121
185
|
return null;
|
|
122
186
|
}
|
|
123
187
|
const json = (await response.json());
|
|
124
|
-
|
|
188
|
+
if (isRoutePayload(json)) {
|
|
189
|
+
return json;
|
|
190
|
+
}
|
|
191
|
+
if (isRouteRedirectPayload(json)) {
|
|
192
|
+
return json;
|
|
193
|
+
}
|
|
194
|
+
return null;
|
|
125
195
|
}
|
|
126
196
|
catch {
|
|
127
197
|
return null;
|
|
@@ -154,6 +224,14 @@ const applyRoutePayloadToDom = (payload) => {
|
|
|
154
224
|
if (propsScript) {
|
|
155
225
|
propsScript.textContent = payload.propsPayload;
|
|
156
226
|
}
|
|
227
|
+
const routeDataPayload = typeof payload.routeDataPayload === "string" ? payload.routeDataPayload : "{}";
|
|
228
|
+
const routeDataScript = document.getElementById(ROUTE_DATA_SCRIPT_ID);
|
|
229
|
+
if (routeDataScript) {
|
|
230
|
+
routeDataScript.textContent = routeDataPayload;
|
|
231
|
+
}
|
|
232
|
+
const routeData = parseJsonPayload(routeDataPayload);
|
|
233
|
+
globalThis.__HYPER_ROUTE_DATA__ =
|
|
234
|
+
routeData;
|
|
157
235
|
if (payload.head) {
|
|
158
236
|
applyHead(payload.head);
|
|
159
237
|
}
|
|
@@ -163,19 +241,37 @@ const applyRoutePayloadToDom = (payload) => {
|
|
|
163
241
|
globalThis.dispatchEvent?.(new CustomEvent(ROUTE_PAYLOAD_EVENT, {
|
|
164
242
|
detail: { routeId: payload.routeId },
|
|
165
243
|
}));
|
|
244
|
+
globalThis.dispatchEvent?.(new CustomEvent(ROUTE_DATA_EVENT, {
|
|
245
|
+
detail: { routeId: payload.routeId, routeData },
|
|
246
|
+
}));
|
|
166
247
|
}
|
|
167
248
|
catch {
|
|
168
249
|
// Keep client navigation flow resilient if event dispatch is unavailable.
|
|
169
250
|
}
|
|
170
251
|
};
|
|
171
|
-
const toRoutePayload = (rendered) =>
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
252
|
+
const toRoutePayload = (rendered) => {
|
|
253
|
+
let routeDataPayload = "{}";
|
|
254
|
+
if (typeof rendered.routeDataPayload === "string") {
|
|
255
|
+
routeDataPayload = rendered.routeDataPayload;
|
|
256
|
+
}
|
|
257
|
+
else if (rendered.routeData && typeof rendered.routeData === "object") {
|
|
258
|
+
try {
|
|
259
|
+
routeDataPayload = JSON.stringify(rendered.routeData);
|
|
260
|
+
}
|
|
261
|
+
catch {
|
|
262
|
+
routeDataPayload = "{}";
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
kind: "hyper-route-payload",
|
|
267
|
+
routeId: rendered.routeId,
|
|
268
|
+
appHtml: rendered.appHtml,
|
|
269
|
+
propsPayload: rendered.propsPayload ?? "{}",
|
|
270
|
+
routeDataPayload,
|
|
271
|
+
head: rendered.head,
|
|
272
|
+
hydration: rendered.hydration,
|
|
273
|
+
};
|
|
274
|
+
};
|
|
179
275
|
const isMetaDefinition = (value) => {
|
|
180
276
|
if (!value || typeof value !== "object") {
|
|
181
277
|
return false;
|
|
@@ -232,20 +328,118 @@ export const createRouter = (initialHref, options) => {
|
|
|
232
328
|
const baseUrl = getBaseUrl();
|
|
233
329
|
const navigationMode = routerOptions.navigationMode ?? "client";
|
|
234
330
|
const clientRenderMode = routerOptions.clientRenderMode ?? "payload";
|
|
331
|
+
const scrollRestoration = routerOptions.scrollRestoration !== false;
|
|
235
332
|
const fallbackToUrl = routerOptions.fallbackToUrl ?? true;
|
|
236
333
|
const hasCustomRoutePayloadResolver = typeof routerOptions.resolveRoutePayload === "function";
|
|
237
334
|
const resolveRoutePayload = routerOptions.resolveRoutePayload ??
|
|
238
335
|
((href) => resolveRoutePayloadFromServer(href, baseUrl));
|
|
239
336
|
const applyRoutePayload = routerOptions.applyRoutePayload ?? applyRoutePayloadToDom;
|
|
337
|
+
const existingScrollPositions = typeof globalThis !== "undefined"
|
|
338
|
+
? globalThis.__HYPER_SCROLL_POSITIONS__
|
|
339
|
+
: undefined;
|
|
340
|
+
const scrollPositions = existingScrollPositions && typeof existingScrollPositions === "object"
|
|
341
|
+
? existingScrollPositions
|
|
342
|
+
: {};
|
|
343
|
+
if (typeof globalThis !== "undefined") {
|
|
344
|
+
globalThis.__HYPER_SCROLL_POSITIONS__ = scrollPositions;
|
|
345
|
+
}
|
|
346
|
+
if (scrollRestoration && hasBrowserHistory()) {
|
|
347
|
+
try {
|
|
348
|
+
const history = globalThis.history;
|
|
349
|
+
if (history && "scrollRestoration" in history) {
|
|
350
|
+
history.scrollRestoration = "manual";
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
catch {
|
|
354
|
+
// Ignore browsers that block scrollRestoration assignment.
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
const toScrollKey = (href) => {
|
|
358
|
+
try {
|
|
359
|
+
const url = new URL(href, baseUrl);
|
|
360
|
+
return `${url.pathname}${url.search}`;
|
|
361
|
+
}
|
|
362
|
+
catch {
|
|
363
|
+
return href;
|
|
364
|
+
}
|
|
365
|
+
};
|
|
366
|
+
const saveScrollPosition = (href) => {
|
|
367
|
+
if (!scrollRestoration) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const key = toScrollKey(href);
|
|
371
|
+
if (!key) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
if (typeof globalThis !== "undefined") {
|
|
375
|
+
const win = globalThis;
|
|
376
|
+
scrollPositions[key] = {
|
|
377
|
+
x: typeof win.scrollX === "number" ? win.scrollX : win.pageXOffset ?? 0,
|
|
378
|
+
y: typeof win.scrollY === "number" ? win.scrollY : win.pageYOffset ?? 0,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
const scrollToHash = (href) => {
|
|
383
|
+
if (typeof document === "undefined") {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
try {
|
|
387
|
+
const url = new URL(href, baseUrl);
|
|
388
|
+
if (!url.hash) {
|
|
389
|
+
return false;
|
|
390
|
+
}
|
|
391
|
+
const id = url.hash.slice(1);
|
|
392
|
+
if (!id) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
const node = document.getElementById(id);
|
|
396
|
+
if (node && typeof node.scrollIntoView === "function") {
|
|
397
|
+
node.scrollIntoView();
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
401
|
+
catch {
|
|
402
|
+
return false;
|
|
403
|
+
}
|
|
404
|
+
return false;
|
|
405
|
+
};
|
|
406
|
+
const restoreScrollPosition = (href, fromHistory) => {
|
|
407
|
+
if (!scrollRestoration || typeof globalThis === "undefined") {
|
|
408
|
+
return;
|
|
409
|
+
}
|
|
410
|
+
if (scrollToHash(href)) {
|
|
411
|
+
return;
|
|
412
|
+
}
|
|
413
|
+
const key = toScrollKey(href);
|
|
414
|
+
if (fromHistory && key && scrollPositions[key]) {
|
|
415
|
+
const position = scrollPositions[key];
|
|
416
|
+
const x = typeof position.x === "number" ? position.x : 0;
|
|
417
|
+
const y = typeof position.y === "number" ? position.y : 0;
|
|
418
|
+
globalThis.scrollTo?.(x, y);
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
globalThis.scrollTo?.(0, 0);
|
|
422
|
+
};
|
|
240
423
|
const listeners = new Set();
|
|
241
424
|
const router = {
|
|
242
425
|
pathname: "/",
|
|
243
426
|
query: {},
|
|
244
427
|
push: async (href) => {
|
|
245
|
-
await resolveAndNavigate(href, false);
|
|
428
|
+
await resolveAndNavigate(href, false, { type: "push" });
|
|
246
429
|
},
|
|
247
430
|
replace: async (href) => {
|
|
248
|
-
await resolveAndNavigate(href, true);
|
|
431
|
+
await resolveAndNavigate(href, true, { type: "replace" });
|
|
432
|
+
},
|
|
433
|
+
softReload: async () => {
|
|
434
|
+
const href = typeof globalThis !== "undefined" && "location" in globalThis
|
|
435
|
+
? globalThis.location.href
|
|
436
|
+
: currentHref || "/";
|
|
437
|
+
await resolveAndNavigate(href, true, {
|
|
438
|
+
skipHistory: true,
|
|
439
|
+
skipScrollSave: true,
|
|
440
|
+
skipScrollRestore: true,
|
|
441
|
+
type: "softReload",
|
|
442
|
+
});
|
|
249
443
|
},
|
|
250
444
|
prefetch: async (href) => {
|
|
251
445
|
await requestPrefetch(href);
|
|
@@ -271,26 +465,34 @@ export const createRouter = (initialHref, options) => {
|
|
|
271
465
|
listeners.delete(listener);
|
|
272
466
|
};
|
|
273
467
|
},
|
|
468
|
+
block: (blocker) => {
|
|
469
|
+
navigationBlockers.add(blocker);
|
|
470
|
+
return () => {
|
|
471
|
+
navigationBlockers.delete(blocker);
|
|
472
|
+
};
|
|
473
|
+
},
|
|
274
474
|
};
|
|
475
|
+
let currentHref = "";
|
|
275
476
|
const updateState = (href) => {
|
|
276
477
|
const next = parseHref(href, baseUrl);
|
|
277
478
|
router.pathname = next.pathname;
|
|
278
479
|
router.query = next.query;
|
|
480
|
+
currentHref = href;
|
|
279
481
|
for (const listener of listeners) {
|
|
280
482
|
listener(router);
|
|
281
483
|
}
|
|
282
484
|
};
|
|
283
485
|
const matchRouteGraph = (pathname) => routeMatcher?.match(pathname) ?? null;
|
|
284
|
-
const navigate = async (href, replace) => {
|
|
486
|
+
const navigate = async (href, replace, options = {}) => {
|
|
285
487
|
// Important: only touch browser history when it exists (SSR-safe).
|
|
286
|
-
if (hasBrowserHistory()) {
|
|
488
|
+
if (!options.skipHistory && hasBrowserHistory()) {
|
|
287
489
|
const history = globalThis.history;
|
|
288
490
|
const method = replace ? "replaceState" : "pushState";
|
|
289
491
|
history[method](null, "", href);
|
|
290
492
|
}
|
|
291
493
|
updateState(href);
|
|
292
494
|
};
|
|
293
|
-
const navigateWithUrl = async (href, replace) => {
|
|
495
|
+
const navigateWithUrl = async (href, replace, _options = {}) => {
|
|
294
496
|
const location = globalThis.location;
|
|
295
497
|
if (location) {
|
|
296
498
|
if (replace && typeof location.replace === "function") {
|
|
@@ -304,20 +506,34 @@ export const createRouter = (initialHref, options) => {
|
|
|
304
506
|
location.href = href;
|
|
305
507
|
return;
|
|
306
508
|
}
|
|
307
|
-
await navigate(href, replace);
|
|
509
|
+
await navigate(href, replace, _options);
|
|
308
510
|
};
|
|
309
|
-
const navigateWithPayload = async (href, replace) => {
|
|
511
|
+
const navigateWithPayload = async (href, replace, options = {}) => {
|
|
310
512
|
const payload = await resolveRoutePayload(href);
|
|
311
|
-
if (payload) {
|
|
513
|
+
if (payload && payload.kind === ROUTE_REDIRECT_KIND) {
|
|
514
|
+
const destination = payload.destination;
|
|
515
|
+
if (destination) {
|
|
516
|
+
await resolveAndNavigate(destination, Boolean(payload.replace), {
|
|
517
|
+
...options,
|
|
518
|
+
type: "redirect",
|
|
519
|
+
skipScrollSave: true,
|
|
520
|
+
});
|
|
521
|
+
return true;
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
if (payload && payload.kind === "hyper-route-payload") {
|
|
312
525
|
await applyRoutePayload(payload);
|
|
313
|
-
await navigate(href, replace);
|
|
526
|
+
await navigate(href, replace, options);
|
|
527
|
+
if (!options.skipScrollRestore) {
|
|
528
|
+
restoreScrollPosition(href, Boolean(options.fromHistory));
|
|
529
|
+
}
|
|
314
530
|
return true;
|
|
315
531
|
}
|
|
316
532
|
if (fallbackToUrl) {
|
|
317
|
-
await navigateWithUrl(href, replace);
|
|
533
|
+
await navigateWithUrl(href, replace, options);
|
|
318
534
|
return false;
|
|
319
535
|
}
|
|
320
|
-
await navigate(href, replace);
|
|
536
|
+
await navigate(href, replace, options);
|
|
321
537
|
return false;
|
|
322
538
|
};
|
|
323
539
|
const resolveClientRouteRender = async (href) => {
|
|
@@ -359,36 +575,39 @@ export const createRouter = (initialHref, options) => {
|
|
|
359
575
|
return null;
|
|
360
576
|
}
|
|
361
577
|
};
|
|
362
|
-
const navigateWithClientModule = async (href, replace) => {
|
|
578
|
+
const navigateWithClientModule = async (href, replace, options = {}) => {
|
|
363
579
|
const rendered = await resolveClientRouteRender(href);
|
|
364
580
|
if (!rendered) {
|
|
365
581
|
return false;
|
|
366
582
|
}
|
|
367
583
|
await applyRoutePayload(toRoutePayload(rendered));
|
|
368
|
-
await navigate(href, replace);
|
|
584
|
+
await navigate(href, replace, options);
|
|
585
|
+
if (!options.skipScrollRestore) {
|
|
586
|
+
restoreScrollPosition(href, Boolean(options.fromHistory));
|
|
587
|
+
}
|
|
369
588
|
return true;
|
|
370
589
|
};
|
|
371
|
-
const navigateWithClientRender = async (href, replace) => {
|
|
590
|
+
const navigateWithClientRender = async (href, replace, options = {}) => {
|
|
372
591
|
if (clientRenderMode === "module") {
|
|
373
|
-
const moduleApplied = await navigateWithClientModule(href, replace);
|
|
592
|
+
const moduleApplied = await navigateWithClientModule(href, replace, options);
|
|
374
593
|
if (moduleApplied) {
|
|
375
594
|
return;
|
|
376
595
|
}
|
|
377
596
|
}
|
|
378
|
-
await navigateWithPayload(href, replace);
|
|
597
|
+
await navigateWithPayload(href, replace, options);
|
|
379
598
|
};
|
|
380
|
-
const navigateByMode = async (href, replace) => {
|
|
599
|
+
const navigateByMode = async (href, replace, options = {}) => {
|
|
381
600
|
if (navigationMode === "url") {
|
|
382
|
-
await navigateWithUrl(href, replace);
|
|
601
|
+
await navigateWithUrl(href, replace, options);
|
|
383
602
|
return;
|
|
384
603
|
}
|
|
385
|
-
await navigateWithClientRender(href, replace);
|
|
604
|
+
await navigateWithClientRender(href, replace, options);
|
|
386
605
|
};
|
|
387
|
-
const resolveDynamicFallback = async (href, replace) => {
|
|
606
|
+
const resolveDynamicFallback = async (href, replace, options = {}) => {
|
|
388
607
|
const next = parseHref(href, baseUrl);
|
|
389
608
|
const forceDynamic = shouldForceDynamicFallback(next.pathname, routerOptions.fallbackPolicy);
|
|
390
609
|
if (routeMatcher && !forceDynamic && matchRouteGraph(next.pathname)) {
|
|
391
|
-
await navigateByMode(href, replace);
|
|
610
|
+
await navigateByMode(href, replace, options);
|
|
392
611
|
return;
|
|
393
612
|
}
|
|
394
613
|
if (routerOptions.resolveDynamicManifest) {
|
|
@@ -396,7 +615,7 @@ export const createRouter = (initialHref, options) => {
|
|
|
396
615
|
if (envelope) {
|
|
397
616
|
const policy = envelope.policy?.render ?? "auto";
|
|
398
617
|
if (policy === "redirect" && envelope.policy?.redirect) {
|
|
399
|
-
await navigateByMode(envelope.policy.redirect, replace);
|
|
618
|
+
await navigateByMode(envelope.policy.redirect, replace, options);
|
|
400
619
|
return;
|
|
401
620
|
}
|
|
402
621
|
let policyRender;
|
|
@@ -424,22 +643,30 @@ export const createRouter = (initialHref, options) => {
|
|
|
424
643
|
}
|
|
425
644
|
}
|
|
426
645
|
if (decision.mode === "ssr") {
|
|
427
|
-
await navigateWithUrl(href, replace);
|
|
646
|
+
await navigateWithUrl(href, replace, options);
|
|
428
647
|
return;
|
|
429
648
|
}
|
|
430
649
|
const meta = envelope.meta ??
|
|
431
650
|
(isMetaDefinition(envelope.definition) ? envelope.definition.root : undefined);
|
|
432
651
|
if (decision.mode === "csr" && meta !== undefined) {
|
|
433
652
|
await routerOptions.renderDynamic?.(meta, envelope);
|
|
434
|
-
await navigateByMode(href, replace);
|
|
653
|
+
await navigateByMode(href, replace, options);
|
|
435
654
|
return;
|
|
436
655
|
}
|
|
437
656
|
}
|
|
438
657
|
}
|
|
439
|
-
await navigateByMode(href, replace);
|
|
658
|
+
await navigateByMode(href, replace, options);
|
|
440
659
|
};
|
|
441
|
-
const resolveAndNavigate = async (href, replace) => {
|
|
442
|
-
|
|
660
|
+
const resolveAndNavigate = async (href, replace, options = {}) => {
|
|
661
|
+
const navType = options.type ?? (replace ? "replace" : "push");
|
|
662
|
+
const allow = runNavigationBlockers({ href, replace, type: navType });
|
|
663
|
+
if (!allow) {
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
if (!options.skipScrollSave) {
|
|
667
|
+
saveScrollPosition(currentHref || href);
|
|
668
|
+
}
|
|
669
|
+
await resolveDynamicFallback(href, replace, options);
|
|
443
670
|
};
|
|
444
671
|
const seed = resolved.initialHref ??
|
|
445
672
|
(typeof globalThis !== "undefined" && "location" in globalThis
|
|
@@ -450,9 +677,30 @@ export const createRouter = (initialHref, options) => {
|
|
|
450
677
|
// Keep router state in sync with back/forward navigation.
|
|
451
678
|
globalThis.addEventListener("popstate", () => {
|
|
452
679
|
const location = globalThis.location;
|
|
453
|
-
if (location?.href) {
|
|
454
|
-
|
|
680
|
+
if (!location?.href) {
|
|
681
|
+
return;
|
|
455
682
|
}
|
|
683
|
+
const nextHref = location.href;
|
|
684
|
+
const allow = runNavigationBlockers({ href: nextHref, replace: true, type: "popstate" });
|
|
685
|
+
if (!allow) {
|
|
686
|
+
if (hasBrowserHistory()) {
|
|
687
|
+
const history = globalThis.history;
|
|
688
|
+
try {
|
|
689
|
+
history.pushState(null, "", currentHref);
|
|
690
|
+
updateState(currentHref);
|
|
691
|
+
}
|
|
692
|
+
catch {
|
|
693
|
+
// Ignore history reversal failures.
|
|
694
|
+
}
|
|
695
|
+
}
|
|
696
|
+
return;
|
|
697
|
+
}
|
|
698
|
+
saveScrollPosition(currentHref || nextHref);
|
|
699
|
+
void resolveDynamicFallback(nextHref, true, {
|
|
700
|
+
fromHistory: true,
|
|
701
|
+
skipScrollSave: true,
|
|
702
|
+
type: "popstate",
|
|
703
|
+
});
|
|
456
704
|
});
|
|
457
705
|
}
|
|
458
706
|
return router;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GetServerProps as HyperGetServerProps, GetStaticPaths as HyperGetStaticPaths, GetStaticProps as HyperGetStaticProps, PageContextBase, PageComponent, StaticPropsContext, StaticPropsResult, StaticPathsResult, ServerPropsContext, ServerPropsResult } from "@tyndall/core";
|
|
1
|
+
import type { ErrorDescriptor, GetServerProps as HyperGetServerProps, GetStaticPaths as HyperGetStaticPaths, GetStaticProps as HyperGetStaticProps, GetRouteData as HyperGetRouteData, InitServerHook, PageContextBase, PageComponent, RedirectDescriptor, RouteDataContext as HyperRouteDataContext, RouteDataMap as HyperRouteDataMap, RouteDataResult as HyperRouteDataResult, StaticPropsContext, StaticPropsResult, StaticPathsResult, ServerPropsContext, ServerPropsResult } from "@tyndall/core";
|
|
2
2
|
export type NextPageContext = PageContextBase;
|
|
3
3
|
export type NextPage<Props = Record<string, unknown>> = PageComponent<Props>;
|
|
4
4
|
export type NextStaticPropsContext = StaticPropsContext;
|
|
@@ -14,4 +14,18 @@ export type GetStaticPaths = HyperGetStaticPaths;
|
|
|
14
14
|
export type GetServerSidePropsContext = ServerPropsContext;
|
|
15
15
|
export type GetServerSidePropsResult<Props = Record<string, unknown>> = ServerPropsResult<Props>;
|
|
16
16
|
export type GetServerSideProps<Props = Record<string, unknown>> = HyperGetServerProps<Props>;
|
|
17
|
+
export interface AppProps {
|
|
18
|
+
Component: PageComponent<Record<string, unknown>>;
|
|
19
|
+
pageProps: Record<string, unknown>;
|
|
20
|
+
routeData: HyperRouteDataMap;
|
|
21
|
+
routeId: string;
|
|
22
|
+
}
|
|
23
|
+
export type AppComponent = (props: AppProps) => unknown;
|
|
24
|
+
export type GetRouteData<Data = unknown> = HyperGetRouteData<Data>;
|
|
25
|
+
export type RouteDataResult<Data = unknown> = HyperRouteDataResult<Data>;
|
|
26
|
+
export type RouteDataContext = HyperRouteDataContext;
|
|
27
|
+
export type RouteDataMap = HyperRouteDataMap;
|
|
28
|
+
export type InitServer = InitServerHook;
|
|
29
|
+
export type RedirectResponse = RedirectDescriptor;
|
|
30
|
+
export type ErrorResponse = ErrorDescriptor;
|
|
17
31
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.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MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAC7C,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC;AACxC,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAClD,MAAM,MAAM,aAAa,GAAG,eAAe,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tyndall/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
|
-
"bun": "./
|
|
13
|
+
"bun": "./dist/index.js",
|
|
14
14
|
"default": "./dist/index.js"
|
|
15
15
|
}
|
|
16
16
|
},
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"build": "tsc -p tsconfig.json"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tyndall/core": "
|
|
25
|
-
"@tyndall/shared": "
|
|
24
|
+
"@tyndall/core": "^0.0.3",
|
|
25
|
+
"@tyndall/shared": "^0.0.3",
|
|
26
26
|
"react-router": "^7.13.0"
|
|
27
27
|
},
|
|
28
28
|
"peerDependencies": {
|