@ereo/client 0.1.23 → 0.1.24
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/blocker.d.ts +55 -0
- package/dist/blocker.d.ts.map +1 -0
- package/dist/client-data.d.ts +43 -0
- package/dist/client-data.d.ts.map +1 -0
- package/dist/form.d.ts +6 -1
- package/dist/form.d.ts.map +1 -1
- package/dist/hooks.d.ts +153 -1
- package/dist/hooks.d.ts.map +1 -1
- package/dist/index.d.ts +24 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +903 -80
- package/dist/lazy-route.d.ts +137 -0
- package/dist/lazy-route.d.ts.map +1 -0
- package/dist/link.d.ts +3 -0
- package/dist/link.d.ts.map +1 -1
- package/dist/matches.d.ts +93 -0
- package/dist/matches.d.ts.map +1 -0
- package/dist/navigation.d.ts +45 -0
- package/dist/navigation.d.ts.map +1 -1
- package/dist/outlet.d.ts +150 -0
- package/dist/outlet.d.ts.map +1 -0
- package/dist/revalidation.d.ts +85 -0
- package/dist/revalidation.d.ts.map +1 -0
- package/dist/route-links.d.ts +30 -0
- package/dist/route-links.d.ts.map +1 -0
- package/dist/scroll-restoration.d.ts +64 -0
- package/dist/scroll-restoration.d.ts.map +1 -0
- package/dist/use-before-unload.d.ts +25 -0
- package/dist/use-before-unload.d.ts.map +1 -0
- package/dist/use-navigation-type.d.ts +18 -0
- package/dist/use-navigation-type.d.ts.map +1 -0
- package/dist/view-transition.d.ts +136 -0
- package/dist/view-transition.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/client - Lazy Route Loading
|
|
3
|
+
*
|
|
4
|
+
* Route-level code splitting using dynamic import().
|
|
5
|
+
* Routes are lazy-loaded on navigation, reducing initial bundle size.
|
|
6
|
+
* Supports preloading for hover/intent-based prefetching.
|
|
7
|
+
*/
|
|
8
|
+
import type { RouteModule } from '@ereo/core';
|
|
9
|
+
/**
|
|
10
|
+
* A route module loader — returns a dynamic import promise.
|
|
11
|
+
*/
|
|
12
|
+
export type RouteModuleLoader = () => Promise<RouteModule>;
|
|
13
|
+
/**
|
|
14
|
+
* A lazy route definition for client-side code splitting.
|
|
15
|
+
*/
|
|
16
|
+
export interface LazyRouteDefinition {
|
|
17
|
+
/** Route identifier */
|
|
18
|
+
id: string;
|
|
19
|
+
/** Route path pattern */
|
|
20
|
+
path: string;
|
|
21
|
+
/** Dynamic import function for the route module */
|
|
22
|
+
loader: RouteModuleLoader;
|
|
23
|
+
/** Whether this route module has been loaded */
|
|
24
|
+
loaded: boolean;
|
|
25
|
+
/** The cached module after loading */
|
|
26
|
+
module?: RouteModule;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Client-side route manifest entry (generated at build time).
|
|
30
|
+
* Maps route IDs to their chunk URLs for preloading.
|
|
31
|
+
*/
|
|
32
|
+
export interface RouteManifestEntry {
|
|
33
|
+
/** Route ID */
|
|
34
|
+
id: string;
|
|
35
|
+
/** JavaScript chunk URL */
|
|
36
|
+
js: string;
|
|
37
|
+
/** CSS files associated with this route */
|
|
38
|
+
css?: string[];
|
|
39
|
+
/** Other asset files to preload */
|
|
40
|
+
assets?: string[];
|
|
41
|
+
/** Module imports (for dependency preloading) */
|
|
42
|
+
imports?: string[];
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Full route manifest mapping route IDs to chunks.
|
|
46
|
+
*/
|
|
47
|
+
export type RouteManifest = Record<string, RouteManifestEntry>;
|
|
48
|
+
/**
|
|
49
|
+
* Register a lazy route with a dynamic import loader.
|
|
50
|
+
*
|
|
51
|
+
* @param id - Route identifier
|
|
52
|
+
* @param path - Route path pattern
|
|
53
|
+
* @param loader - Dynamic import function
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```typescript
|
|
57
|
+
* registerLazyRoute('home', '/', () => import('./routes/home'));
|
|
58
|
+
* registerLazyRoute('users', '/users/[id]', () => import('./routes/users/[id]'));
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export declare function registerLazyRoute(id: string, path: string, loader: RouteModuleLoader): void;
|
|
62
|
+
/**
|
|
63
|
+
* Register multiple lazy routes at once.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```typescript
|
|
67
|
+
* registerLazyRoutes({
|
|
68
|
+
* home: { path: '/', loader: () => import('./routes/home') },
|
|
69
|
+
* about: { path: '/about', loader: () => import('./routes/about') },
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
72
|
+
*/
|
|
73
|
+
export declare function registerLazyRoutes(routes: Record<string, {
|
|
74
|
+
path: string;
|
|
75
|
+
loader: RouteModuleLoader;
|
|
76
|
+
}>): void;
|
|
77
|
+
/**
|
|
78
|
+
* Load a lazy route module. Returns the cached module if already loaded.
|
|
79
|
+
* Deduplicates concurrent loads of the same route.
|
|
80
|
+
*
|
|
81
|
+
* @param id - Route identifier
|
|
82
|
+
* @returns The loaded route module
|
|
83
|
+
* @throws Error if route is not registered
|
|
84
|
+
*/
|
|
85
|
+
export declare function loadLazyRoute(id: string): Promise<RouteModule>;
|
|
86
|
+
/**
|
|
87
|
+
* Preload a route module without executing it.
|
|
88
|
+
* Useful for hover/intent-based prefetching.
|
|
89
|
+
*
|
|
90
|
+
* @param id - Route identifier
|
|
91
|
+
* @returns Promise that resolves when the module is loaded
|
|
92
|
+
*/
|
|
93
|
+
export declare function preloadLazyRoute(id: string): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Check if a lazy route's module has been loaded.
|
|
96
|
+
*/
|
|
97
|
+
export declare function isRouteLoaded(id: string): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Get a loaded route module (returns undefined if not loaded).
|
|
100
|
+
*/
|
|
101
|
+
export declare function getLoadedModule(id: string): RouteModule | undefined;
|
|
102
|
+
/**
|
|
103
|
+
* Get all registered lazy route IDs.
|
|
104
|
+
*/
|
|
105
|
+
export declare function getLazyRouteIds(): string[];
|
|
106
|
+
/**
|
|
107
|
+
* Clear the module cache and reset all lazy routes.
|
|
108
|
+
* Useful for testing or hot module replacement.
|
|
109
|
+
*/
|
|
110
|
+
export declare function clearLazyRouteCache(): void;
|
|
111
|
+
/**
|
|
112
|
+
* Remove all registered lazy routes and clear caches.
|
|
113
|
+
*/
|
|
114
|
+
export declare function resetLazyRoutes(): void;
|
|
115
|
+
/**
|
|
116
|
+
* Set the route manifest (typically loaded from the build output).
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* // In your entry point
|
|
121
|
+
* import manifest from './__manifest.json';
|
|
122
|
+
* setRouteManifest(manifest);
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export declare function setRouteManifest(m: RouteManifest): void;
|
|
126
|
+
/**
|
|
127
|
+
* Get the route manifest entry for a route ID.
|
|
128
|
+
*/
|
|
129
|
+
export declare function getRouteManifestEntry(id: string): RouteManifestEntry | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* Preload route assets (JS chunks, CSS files) by injecting
|
|
132
|
+
* <link rel="modulepreload"> and <link rel="preload"> into <head>.
|
|
133
|
+
*
|
|
134
|
+
* @param id - Route ID to preload assets for
|
|
135
|
+
*/
|
|
136
|
+
export declare function preloadRouteAssets(id: string): void;
|
|
137
|
+
//# sourceMappingURL=lazy-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lazy-route.d.ts","sourceRoot":"","sources":["../src/lazy-route.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAM9C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,OAAO,CAAC,WAAW,CAAC,CAAC;AAE3D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,IAAI,EAAE,MA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AACH,wBAAgB,eAAe,IAAI,MAAM,EAAE,CAE1C;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAO1C;AAED;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAItC;AASD;;;;;;;;;GASG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI,CAEvD;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS,CAEhF;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAyCnD"}
|
package/dist/link.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Link and NavLink components with prefetch support for client-side navigation.
|
|
5
5
|
*/
|
|
6
6
|
import * as React from 'react';
|
|
7
|
+
import type { ViewTransitionOptions } from './view-transition';
|
|
7
8
|
/**
|
|
8
9
|
* Prefetch strategy for links.
|
|
9
10
|
*/
|
|
@@ -26,6 +27,8 @@ export interface LinkProps extends Omit<React.AnchorHTMLAttributes<HTMLAnchorEle
|
|
|
26
27
|
state?: unknown;
|
|
27
28
|
/** Reload the document instead of client navigation */
|
|
28
29
|
reloadDocument?: boolean;
|
|
30
|
+
/** Use View Transitions API for this navigation. Pass true or options object. */
|
|
31
|
+
viewTransition?: boolean | ViewTransitionOptions;
|
|
29
32
|
/** Children elements */
|
|
30
33
|
children?: React.ReactNode;
|
|
31
34
|
}
|
package/dist/link.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../src/link.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,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AK,EAAE,kBAAkB,KAAK,KAAK,CAAC,aAAa,CAAC,CAAC;IACnF,6CAA6C;IAC7C,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,OAAO,wFA0DlB,CAAC;AAEH;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAQ,GAAG,OAAO,CAqB9D"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/client - useMatches Hook
|
|
3
|
+
*
|
|
4
|
+
* Provides access to all matched route segments and their data.
|
|
5
|
+
* Enables breadcrumbs, analytics, route-based metadata, and more.
|
|
6
|
+
*/
|
|
7
|
+
import { type ReactNode, type Context } from 'react';
|
|
8
|
+
import type { RouteParams, RouteHandle } from '@ereo/core';
|
|
9
|
+
/**
|
|
10
|
+
* Data for a single matched route in the route hierarchy.
|
|
11
|
+
* Returned as part of the useMatches() array.
|
|
12
|
+
*/
|
|
13
|
+
export interface RouteMatchData {
|
|
14
|
+
/** Route identifier (e.g., '/users/[id]' or 'root-layout') */
|
|
15
|
+
id: string;
|
|
16
|
+
/** Matched pathname for this route segment */
|
|
17
|
+
pathname: string;
|
|
18
|
+
/** Route params at this level */
|
|
19
|
+
params: RouteParams;
|
|
20
|
+
/** Loader data for this route (null if no loader) */
|
|
21
|
+
data: unknown;
|
|
22
|
+
/** Route handle metadata (from `export const handle = { ... }`) */
|
|
23
|
+
handle: RouteHandle | undefined;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Context value for the matches context.
|
|
27
|
+
*/
|
|
28
|
+
export interface MatchesContextValue {
|
|
29
|
+
matches: RouteMatchData[];
|
|
30
|
+
setMatches: (matches: RouteMatchData[]) => void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Props for MatchesProvider.
|
|
34
|
+
*/
|
|
35
|
+
export interface MatchesProviderProps {
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
initialMatches?: RouteMatchData[];
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Context holding all matched routes for the current URL.
|
|
41
|
+
*/
|
|
42
|
+
export declare const MatchesContext: Context<MatchesContextValue | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Access all matched routes from root layout to current page.
|
|
45
|
+
*
|
|
46
|
+
* Returns an array of match objects, each containing the route's id,
|
|
47
|
+
* pathname, params, loader data, and handle metadata.
|
|
48
|
+
*
|
|
49
|
+
* @returns Array of RouteMatchData, ordered from outermost layout to page
|
|
50
|
+
* @throws Error if used outside of EreoProvider
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* // Build breadcrumbs from handle metadata
|
|
55
|
+
* function Breadcrumbs() {
|
|
56
|
+
* const matches = useMatches();
|
|
57
|
+
*
|
|
58
|
+
* const crumbs = matches
|
|
59
|
+
* .filter(m => m.handle?.breadcrumb)
|
|
60
|
+
* .map(m => ({
|
|
61
|
+
* label: m.handle!.breadcrumb as string,
|
|
62
|
+
* path: m.pathname,
|
|
63
|
+
* }));
|
|
64
|
+
*
|
|
65
|
+
* return (
|
|
66
|
+
* <nav>
|
|
67
|
+
* {crumbs.map((c, i) => (
|
|
68
|
+
* <span key={i}>{i > 0 && ' > '}{c.label}</span>
|
|
69
|
+
* ))}
|
|
70
|
+
* </nav>
|
|
71
|
+
* );
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```tsx
|
|
77
|
+
* // Analytics: track route data
|
|
78
|
+
* function Analytics() {
|
|
79
|
+
* const matches = useMatches();
|
|
80
|
+
* const routeIds = matches.map(m => m.id);
|
|
81
|
+
* useEffect(() => {
|
|
82
|
+
* trackPageView(routeIds);
|
|
83
|
+
* }, [routeIds.join(',')]);
|
|
84
|
+
* return null;
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*/
|
|
88
|
+
export declare function useMatches(): RouteMatchData[];
|
|
89
|
+
/**
|
|
90
|
+
* Provider for route matches context.
|
|
91
|
+
*/
|
|
92
|
+
export declare function MatchesProvider({ children, initialMatches, }: MatchesProviderProps): ReactNode;
|
|
93
|
+
//# sourceMappingURL=matches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"matches.d.ts","sourceRoot":"","sources":["../src/matches.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAML,KAAK,SAAS,EACd,KAAK,OAAO,EACb,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAM3D;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,8DAA8D;IAC9D,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,MAAM,EAAE,WAAW,CAAC;IACpB,qDAAqD;IACrD,IAAI,EAAE,OAAO,CAAC;IACd,mEAAmE;IACnE,MAAM,EAAE,WAAW,GAAG,SAAS,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,UAAU,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,IAAI,CAAC;CACjD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,SAAS,CAAC;IACpB,cAAc,CAAC,EAAE,cAAc,EAAE,CAAC;CACnC;AAMD;;GAEG;AACH,eAAO,MAAM,cAAc,EAAE,OAAO,CAAC,mBAAmB,GAAG,IAAI,CACd,CAAC;AAMlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,UAAU,IAAI,cAAc,EAAE,CAW7C;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,cAAmB,GACpB,EAAE,oBAAoB,GAAG,SAAS,CASlC"}
|
package/dist/navigation.d.ts
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* SPA-style navigation with loader data fetching.
|
|
5
5
|
*/
|
|
6
6
|
import type { RouteParams } from '@ereo/core';
|
|
7
|
+
import { type ViewTransitionOptions } from './view-transition';
|
|
7
8
|
/**
|
|
8
9
|
* Navigation state.
|
|
9
10
|
*/
|
|
@@ -25,13 +26,55 @@ export interface NavigationEvent {
|
|
|
25
26
|
* Navigation listener.
|
|
26
27
|
*/
|
|
27
28
|
export type NavigationListener = (event: NavigationEvent) => void;
|
|
29
|
+
/**
|
|
30
|
+
* Blocker function - returns true to block navigation.
|
|
31
|
+
*/
|
|
32
|
+
export type BlockerFunction = () => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Pending navigation that was blocked.
|
|
35
|
+
*/
|
|
36
|
+
export interface PendingNavigation {
|
|
37
|
+
to: string;
|
|
38
|
+
options: {
|
|
39
|
+
replace?: boolean;
|
|
40
|
+
state?: unknown;
|
|
41
|
+
viewTransition?: boolean | ViewTransitionOptions;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
28
44
|
/**
|
|
29
45
|
* Client router for SPA navigation.
|
|
30
46
|
*/
|
|
31
47
|
declare class ClientRouter {
|
|
32
48
|
private listeners;
|
|
33
49
|
private currentState;
|
|
50
|
+
private blockers;
|
|
51
|
+
private blockerListeners;
|
|
52
|
+
pendingNavigation: PendingNavigation | null;
|
|
34
53
|
constructor();
|
|
54
|
+
/**
|
|
55
|
+
* Add a blocker function. Returns a cleanup function.
|
|
56
|
+
*/
|
|
57
|
+
addBlocker(fn: BlockerFunction): () => void;
|
|
58
|
+
/**
|
|
59
|
+
* Check if any blocker wants to block navigation.
|
|
60
|
+
*/
|
|
61
|
+
isBlocked(): boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Subscribe to blocker state changes.
|
|
64
|
+
*/
|
|
65
|
+
subscribeBlocker(listener: () => void): () => void;
|
|
66
|
+
/**
|
|
67
|
+
* Notify blocker listeners.
|
|
68
|
+
*/
|
|
69
|
+
private notifyBlockers;
|
|
70
|
+
/**
|
|
71
|
+
* Proceed with a pending blocked navigation.
|
|
72
|
+
*/
|
|
73
|
+
proceedNavigation(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Reset pending navigation (user chose to stay).
|
|
76
|
+
*/
|
|
77
|
+
resetNavigation(): void;
|
|
35
78
|
/**
|
|
36
79
|
* Get current state from window.location.
|
|
37
80
|
*/
|
|
@@ -46,6 +89,7 @@ declare class ClientRouter {
|
|
|
46
89
|
navigate(to: string, options?: {
|
|
47
90
|
replace?: boolean;
|
|
48
91
|
state?: unknown;
|
|
92
|
+
viewTransition?: boolean | ViewTransitionOptions;
|
|
49
93
|
}): Promise<void>;
|
|
50
94
|
/**
|
|
51
95
|
* Go back in history.
|
|
@@ -86,6 +130,7 @@ export declare const router: ClientRouter;
|
|
|
86
130
|
export declare function navigate(to: string, options?: {
|
|
87
131
|
replace?: boolean;
|
|
88
132
|
state?: unknown;
|
|
133
|
+
viewTransition?: boolean | ViewTransitionOptions;
|
|
89
134
|
}): Promise<void>;
|
|
90
135
|
/**
|
|
91
136
|
* Go back in history.
|
package/dist/navigation.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../src/navigation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,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W,GACnB,OAAO,CAAC,CAAC,CAAC,CAwBZ;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,GAAG,OAAO,EAC5C,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAO,GAChC,OAAO,CAAC,CAAC,CAAC,CAcZ;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CA4B7C"}
|
package/dist/outlet.d.ts
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/client - Outlet Component
|
|
3
|
+
*
|
|
4
|
+
* Provides the <Outlet /> component and useOutletContext hook for
|
|
5
|
+
* nested layout rendering. Layouts render <Outlet /> where child
|
|
6
|
+
* content should appear, and can pass data to children via the
|
|
7
|
+
* context prop without prop drilling.
|
|
8
|
+
*/
|
|
9
|
+
import { type ReactNode, type Context } from 'react';
|
|
10
|
+
/**
|
|
11
|
+
* Internal context value for Outlet — carries the child element to render.
|
|
12
|
+
*/
|
|
13
|
+
export interface OutletElementContextValue {
|
|
14
|
+
/** The child route element to render */
|
|
15
|
+
element: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Internal context value for Outlet context data — carries data
|
|
19
|
+
* passed via <Outlet context={...} />.
|
|
20
|
+
*/
|
|
21
|
+
export interface OutletContextValue {
|
|
22
|
+
/** Arbitrary data passed from a layout to its children */
|
|
23
|
+
data: unknown;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Props for the Outlet component.
|
|
27
|
+
*/
|
|
28
|
+
export interface OutletProps {
|
|
29
|
+
/**
|
|
30
|
+
* Context data to pass to child routes.
|
|
31
|
+
* Accessible via useOutletContext() in child components.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // In a layout
|
|
36
|
+
* export default function DashboardLayout() {
|
|
37
|
+
* const { user } = useLoaderData<{ user: User }>();
|
|
38
|
+
* return (
|
|
39
|
+
* <div>
|
|
40
|
+
* <Sidebar user={user} />
|
|
41
|
+
* <Outlet context={{ user }} />
|
|
42
|
+
* </div>
|
|
43
|
+
* );
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
context?: unknown;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Props for OutletProvider (internal — used by the server/router to
|
|
51
|
+
* wrap layout trees).
|
|
52
|
+
*/
|
|
53
|
+
export interface OutletProviderProps {
|
|
54
|
+
children: ReactNode;
|
|
55
|
+
/** The child route element that <Outlet /> will render */
|
|
56
|
+
element: ReactNode;
|
|
57
|
+
/** Context data available via useOutletContext() */
|
|
58
|
+
context?: unknown;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Context for the child element that Outlet should render.
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
export declare const OutletElementContext: Context<OutletElementContextValue | null>;
|
|
65
|
+
/**
|
|
66
|
+
* Context for data passed via <Outlet context={...} />.
|
|
67
|
+
* This is a separate context so that useOutletContext works
|
|
68
|
+
* regardless of whether the user reads the element context.
|
|
69
|
+
*/
|
|
70
|
+
export declare const OutletDataContext: Context<OutletContextValue | null>;
|
|
71
|
+
/**
|
|
72
|
+
* Renders the child route element within a layout.
|
|
73
|
+
*
|
|
74
|
+
* Place this component in your layout where child routes should appear.
|
|
75
|
+
* Optionally pass a `context` prop to make data available to children
|
|
76
|
+
* via `useOutletContext()`.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```tsx
|
|
80
|
+
* // Basic usage in a layout
|
|
81
|
+
* export default function AppLayout() {
|
|
82
|
+
* return (
|
|
83
|
+
* <html>
|
|
84
|
+
* <body>
|
|
85
|
+
* <Header />
|
|
86
|
+
* <main>
|
|
87
|
+
* <Outlet />
|
|
88
|
+
* </main>
|
|
89
|
+
* <Footer />
|
|
90
|
+
* </body>
|
|
91
|
+
* </html>
|
|
92
|
+
* );
|
|
93
|
+
* }
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```tsx
|
|
98
|
+
* // Passing context to child routes
|
|
99
|
+
* export default function DashboardLayout() {
|
|
100
|
+
* const { user, permissions } = useLoaderData<DashboardData>();
|
|
101
|
+
* return (
|
|
102
|
+
* <div className="dashboard">
|
|
103
|
+
* <Sidebar />
|
|
104
|
+
* <Outlet context={{ user, permissions }} />
|
|
105
|
+
* </div>
|
|
106
|
+
* );
|
|
107
|
+
* }
|
|
108
|
+
*
|
|
109
|
+
* // In a child route
|
|
110
|
+
* function Settings() {
|
|
111
|
+
* const { user, permissions } = useOutletContext<{
|
|
112
|
+
* user: User;
|
|
113
|
+
* permissions: string[];
|
|
114
|
+
* }>();
|
|
115
|
+
* // ...
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
export declare function Outlet({ context }?: OutletProps): ReactNode;
|
|
120
|
+
/**
|
|
121
|
+
* Access context data passed from a parent layout's <Outlet context={...} />.
|
|
122
|
+
*
|
|
123
|
+
* @returns The context data from the nearest parent Outlet
|
|
124
|
+
* @throws Error if no parent Outlet has provided context
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```tsx
|
|
128
|
+
* interface DashboardContext {
|
|
129
|
+
* user: User;
|
|
130
|
+
* permissions: string[];
|
|
131
|
+
* }
|
|
132
|
+
*
|
|
133
|
+
* function SettingsPage() {
|
|
134
|
+
* const { user, permissions } = useOutletContext<DashboardContext>();
|
|
135
|
+
* return <div>Settings for {user.name}</div>;
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
export declare function useOutletContext<T = unknown>(): T;
|
|
140
|
+
/**
|
|
141
|
+
* Provider that sets up the outlet element context for a layout level.
|
|
142
|
+
*
|
|
143
|
+
* Used internally by the server/router when composing layout trees.
|
|
144
|
+
* Each layout level gets its own OutletProvider that tells <Outlet />
|
|
145
|
+
* what to render as its child content.
|
|
146
|
+
*
|
|
147
|
+
* @internal
|
|
148
|
+
*/
|
|
149
|
+
export declare function OutletProvider({ children, element, context, }: OutletProviderProps): ReactNode;
|
|
150
|
+
//# sourceMappingURL=outlet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"outlet.d.ts","sourceRoot":"","sources":["../src/outlet.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAIL,KAAK,SAAS,EAEd,KAAK,OAAO,EACb,MAAM,OAAO,CAAC;AAMf;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,wCAAwC;IACxC,OAAO,EAAE,SAAS,CAAC;CACpB;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC,0DAA0D;IAC1D,IAAI,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;;;;;;;;OAiBG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAC;IACpB,0DAA0D;IAC1D,OAAO,EAAE,SAAS,CAAC;IACnB,oDAAoD;IACpD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAMD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,yBAAyB,GAAG,IAAI,CACpB,CAAC;AAExD;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,OAAO,CAAC,kBAAkB,GAAG,IAAI,CACjB,CAAC;AAMjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAgB,MAAM,CAAC,EAAE,OAAO,EAAE,GAAE,WAAgB,GAAG,SAAS,CAoB/D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,CAYjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,OAAO,EACP,OAAO,GACR,EAAE,mBAAmB,GAAG,SAAS,CAsBjC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/client - Revalidation
|
|
3
|
+
*
|
|
4
|
+
* Controls which route loaders re-run after navigations and mutations.
|
|
5
|
+
* Routes can export a `shouldRevalidate` function to opt out of
|
|
6
|
+
* unnecessary data re-fetching, improving performance.
|
|
7
|
+
*/
|
|
8
|
+
import type { RouteModule, RouteParams, ShouldRevalidateArgs, ShouldRevalidateFunction } from '@ereo/core';
|
|
9
|
+
/**
|
|
10
|
+
* A matched route with its loaded module, used for revalidation decisions.
|
|
11
|
+
*/
|
|
12
|
+
export interface RevalidationRoute {
|
|
13
|
+
/** Route identifier */
|
|
14
|
+
id: string;
|
|
15
|
+
/** Route path pattern */
|
|
16
|
+
path: string;
|
|
17
|
+
/** The loaded route module */
|
|
18
|
+
module?: RouteModule;
|
|
19
|
+
/** Current params for this route */
|
|
20
|
+
params: RouteParams;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Context for a revalidation check after a navigation or mutation.
|
|
24
|
+
*/
|
|
25
|
+
export interface RevalidationContext {
|
|
26
|
+
/** The URL the user is navigating from */
|
|
27
|
+
currentUrl: URL;
|
|
28
|
+
/** The URL the user is navigating to */
|
|
29
|
+
nextUrl: URL;
|
|
30
|
+
/** If triggered by a form submission, the HTTP method */
|
|
31
|
+
formMethod?: string;
|
|
32
|
+
/** If triggered by a form submission, the action URL */
|
|
33
|
+
formAction?: string;
|
|
34
|
+
/** If triggered by a form submission, the form data */
|
|
35
|
+
formData?: FormData;
|
|
36
|
+
/** If triggered by a completed action, the action result */
|
|
37
|
+
actionResult?: unknown;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Determine which routes need their loaders re-run.
|
|
41
|
+
*
|
|
42
|
+
* For each active route, checks its `shouldRevalidate` export.
|
|
43
|
+
* If the route doesn't export one, it defaults to revalidating.
|
|
44
|
+
*
|
|
45
|
+
* @param routes - The currently matched routes (including layouts)
|
|
46
|
+
* @param nextParams - The params that will be active after navigation
|
|
47
|
+
* @param context - Information about the navigation/mutation that triggered revalidation
|
|
48
|
+
* @returns Array of route IDs that should have their loaders re-run
|
|
49
|
+
*/
|
|
50
|
+
export declare function getRoutesToRevalidate(routes: RevalidationRoute[], nextParams: RouteParams, context: RevalidationContext): string[];
|
|
51
|
+
/**
|
|
52
|
+
* Check if a single route should revalidate.
|
|
53
|
+
*
|
|
54
|
+
* Utility for checking individual routes outside of a batch.
|
|
55
|
+
*/
|
|
56
|
+
export declare function checkShouldRevalidate(shouldRevalidateFn: ShouldRevalidateFunction | undefined, args: ShouldRevalidateArgs): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* State returned by useRevalidator.
|
|
59
|
+
*/
|
|
60
|
+
export interface RevalidatorState {
|
|
61
|
+
/** Current revalidation state */
|
|
62
|
+
state: 'idle' | 'loading';
|
|
63
|
+
/** Trigger a revalidation of the current route's data */
|
|
64
|
+
revalidate: () => Promise<void>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Hook to manually revalidate the current route's loader data.
|
|
68
|
+
* Fetches fresh data from the server and updates contexts.
|
|
69
|
+
*
|
|
70
|
+
* @returns RevalidatorState with state and revalidate function
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```tsx
|
|
74
|
+
* function Dashboard() {
|
|
75
|
+
* const { state, revalidate } = useRevalidator();
|
|
76
|
+
* return (
|
|
77
|
+
* <button onClick={revalidate} disabled={state === 'loading'}>
|
|
78
|
+
* {state === 'loading' ? 'Refreshing...' : 'Refresh Data'}
|
|
79
|
+
* </button>
|
|
80
|
+
* );
|
|
81
|
+
* }
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
export declare function useRevalidator(): RevalidatorState;
|
|
85
|
+
//# sourceMappingURL=revalidation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revalidation.d.ts","sourceRoot":"","sources":["../src/revalidation.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,KAAK,EACV,WAAW,EACX,WAAW,EACX,oBAAoB,EACpB,wBAAwB,EACzB,MAAM,YAAY,CAAC;AAIpB;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,oCAAoC;IACpC,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,0CAA0C;IAC1C,UAAU,EAAE,GAAG,CAAC;IAChB,wCAAwC;IACxC,OAAO,EAAE,GAAG,CAAC;IACb,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,4DAA4D;IAC5D,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,iBAAiB,EAAE,EAC3B,UAAU,EAAE,WAAW,EACvB,OAAO,EAAE,mBAAmB,GAC3B,MAAM,EAAE,CA8CV;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,wBAAwB,GAAG,SAAS,EACxD,IAAI,EAAE,oBAAoB,GACzB,OAAO,CAUT;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,yDAAyD;IACzD,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,IAAI,gBAAgB,CAsCjD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @ereo/client - Route Links Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages per-route link elements (<link>) in the document <head>.
|
|
5
|
+
* When navigating between routes, old route links are removed and
|
|
6
|
+
* new ones are injected, ensuring each route gets its own CSS/assets.
|
|
7
|
+
*/
|
|
8
|
+
import type { LinkDescriptor } from '@ereo/core';
|
|
9
|
+
/**
|
|
10
|
+
* Render link descriptors as HTML string (for SSR).
|
|
11
|
+
* Used when the server needs to inject links into a layout component.
|
|
12
|
+
*/
|
|
13
|
+
export declare function renderLinkTags(links: LinkDescriptor[]): string;
|
|
14
|
+
/**
|
|
15
|
+
* Update the document <head> with new route link descriptors.
|
|
16
|
+
* Removes previous route links and adds new ones.
|
|
17
|
+
*
|
|
18
|
+
* This is called during client-side navigation after receiving
|
|
19
|
+
* the JSON response with link descriptors.
|
|
20
|
+
*/
|
|
21
|
+
export declare function updateRouteLinks(links: LinkDescriptor[]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Remove all Ereo-managed route links from <head>.
|
|
24
|
+
*/
|
|
25
|
+
export declare function removeRouteLinks(): void;
|
|
26
|
+
/**
|
|
27
|
+
* Get the currently active route link descriptors count.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getActiveLinksCount(): number;
|
|
30
|
+
//# sourceMappingURL=route-links.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"route-links.d.ts","sourceRoot":"","sources":["../src/route-links.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAQjD;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,MAAM,CAU9D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAyB9D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAOvC;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|