@tanstack/react-router 0.0.1-beta.12 → 0.0.1-beta.13
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/build/cjs/react-router/src/index.js +79 -95
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/cjs/router-core/build/esm/index.js +76 -111
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +112 -167
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +43 -29
- package/build/types/index.d.ts +10 -3
- package/build/umd/index.development.js +119 -171
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +2 -2
- package/build/umd/index.production.js.map +1 -1
- package/package.json +3 -2
- package/src/index.tsx +58 -72
|
@@ -15,7 +15,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
15
15
|
var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
|
|
16
16
|
var React = require('react');
|
|
17
17
|
var shim = require('use-sync-external-store/shim');
|
|
18
|
-
var index = require('../../router-core/build/esm/index.js');
|
|
18
|
+
var index$1 = require('../../router-core/build/esm/index.js');
|
|
19
|
+
var index = require('react-lazy-with-preload/lib/index');
|
|
19
20
|
|
|
20
21
|
function _interopNamespace(e) {
|
|
21
22
|
if (e && e.__esModule) return e;
|
|
@@ -65,7 +66,7 @@ function createReactRouter(opts) {
|
|
|
65
66
|
const resolvedRouteId = router.resolvePath(route.routeId, subRouteId);
|
|
66
67
|
const resolvedRoute = router.getRoute(resolvedRouteId);
|
|
67
68
|
useRouterSubscription(router);
|
|
68
|
-
index.invariant(resolvedRoute, "Could not find a route for route \"" + resolvedRouteId + "\"! Did you forget to add it to your route config?");
|
|
69
|
+
index$1.invariant(resolvedRoute, "Could not find a route for route \"" + resolvedRouteId + "\"! Did you forget to add it to your route config?");
|
|
69
70
|
return resolvedRoute;
|
|
70
71
|
},
|
|
71
72
|
linkProps: options => {
|
|
@@ -109,6 +110,12 @@ function createReactRouter(opts) {
|
|
|
109
110
|
next
|
|
110
111
|
} = linkInfo;
|
|
111
112
|
|
|
113
|
+
const reactHandleClick = e => {
|
|
114
|
+
React__namespace.startTransition(() => {
|
|
115
|
+
handleClick(e);
|
|
116
|
+
});
|
|
117
|
+
};
|
|
118
|
+
|
|
112
119
|
const composeHandlers = handlers => e => {
|
|
113
120
|
e.persist();
|
|
114
121
|
handlers.forEach(handler => {
|
|
@@ -117,12 +124,12 @@ function createReactRouter(opts) {
|
|
|
117
124
|
}; // Get the active props
|
|
118
125
|
|
|
119
126
|
|
|
120
|
-
const resolvedActiveProps = isActive ? (_functionalUpdate = index.functionalUpdate(activeProps, {})) != null ? _functionalUpdate : {} : {}; // Get the inactive props
|
|
127
|
+
const resolvedActiveProps = isActive ? (_functionalUpdate = index$1.functionalUpdate(activeProps, {})) != null ? _functionalUpdate : {} : {}; // Get the inactive props
|
|
121
128
|
|
|
122
|
-
const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = index.functionalUpdate(inactiveProps, {})) != null ? _functionalUpdate2 : {};
|
|
129
|
+
const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = index$1.functionalUpdate(inactiveProps, {})) != null ? _functionalUpdate2 : {};
|
|
123
130
|
return _rollupPluginBabelHelpers["extends"]({}, resolvedActiveProps, resolvedInactiveProps, rest, {
|
|
124
131
|
href: disabled ? undefined : next.href,
|
|
125
|
-
onClick: composeHandlers([
|
|
132
|
+
onClick: composeHandlers([reactHandleClick, onClick]),
|
|
126
133
|
onFocus: composeHandlers([handleFocus, onFocus]),
|
|
127
134
|
onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
|
|
128
135
|
onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
|
|
@@ -168,7 +175,7 @@ function createReactRouter(opts) {
|
|
|
168
175
|
};
|
|
169
176
|
};
|
|
170
177
|
|
|
171
|
-
const coreRouter = index.createRouter(_rollupPluginBabelHelpers["extends"]({}, opts, {
|
|
178
|
+
const coreRouter = index$1.createRouter(_rollupPluginBabelHelpers["extends"]({}, opts, {
|
|
172
179
|
createRouter: router => {
|
|
173
180
|
const routerExt = {
|
|
174
181
|
useState: () => {
|
|
@@ -179,13 +186,13 @@ function createReactRouter(opts) {
|
|
|
179
186
|
var _useMatches, _opts$strict;
|
|
180
187
|
|
|
181
188
|
useRouterSubscription(router);
|
|
182
|
-
index.invariant(routeId !== index.rootRouteId, "\"" + index.rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + index.rootRouteId + "\")?");
|
|
189
|
+
index$1.invariant(routeId !== index$1.rootRouteId, "\"" + index$1.rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + index$1.rootRouteId + "\")?");
|
|
183
190
|
const runtimeMatch = (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
|
|
184
191
|
const match = router.state.matches.find(d => d.routeId === routeId);
|
|
185
192
|
|
|
186
193
|
if ((_opts$strict = opts == null ? void 0 : opts.strict) != null ? _opts$strict : true) {
|
|
187
|
-
index.invariant(match, "Could not find an active match for \"" + routeId + "\"!");
|
|
188
|
-
index.invariant(runtimeMatch.routeId == (match == null ? void 0 : match.routeId), "useMatch('" + (match == null ? void 0 : match.routeId) + "') is being called in a component that is meant to render the '" + runtimeMatch.routeId + "' route. Did you mean to 'useMatch(" + (match == null ? void 0 : match.routeId) + ", { strict: false })' or 'useRoute(" + (match == null ? void 0 : match.routeId) + ")' instead?");
|
|
194
|
+
index$1.invariant(match, "Could not find an active match for \"" + routeId + "\"!");
|
|
195
|
+
index$1.invariant(runtimeMatch.routeId == (match == null ? void 0 : match.routeId), "useMatch('" + (match == null ? void 0 : match.routeId) + "') is being called in a component that is meant to render the '" + runtimeMatch.routeId + "' route. Did you mean to 'useMatch(" + (match == null ? void 0 : match.routeId) + ", { strict: false })' or 'useRoute(" + (match == null ? void 0 : match.routeId) + ")' instead?");
|
|
189
196
|
}
|
|
190
197
|
|
|
191
198
|
return match;
|
|
@@ -202,18 +209,12 @@ function createReactRouter(opts) {
|
|
|
202
209
|
const routeExt = makeRouteExt(route, router);
|
|
203
210
|
Object.assign(route, routeExt);
|
|
204
211
|
},
|
|
205
|
-
|
|
206
|
-
if (typeof
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
if (typeof res === 'object' && res.default) {
|
|
210
|
-
return /*#__PURE__*/React__namespace.createElement(res.default);
|
|
211
|
-
} else {
|
|
212
|
-
return res;
|
|
213
|
-
}
|
|
212
|
+
loadComponent: async component => {
|
|
213
|
+
if (component.preload && typeof document !== 'undefined') {
|
|
214
|
+
component.preload(); // return await component.preload()
|
|
214
215
|
}
|
|
215
216
|
|
|
216
|
-
return
|
|
217
|
+
return component;
|
|
217
218
|
}
|
|
218
219
|
}));
|
|
219
220
|
return coreRouter;
|
|
@@ -242,7 +243,7 @@ function RouterProvider(_ref2) {
|
|
|
242
243
|
}
|
|
243
244
|
function useRouter() {
|
|
244
245
|
const value = React__namespace.useContext(routerContext);
|
|
245
|
-
index.warning(!value, 'useRouter must be used inside a <Router> component!');
|
|
246
|
+
index$1.warning(!value, 'useRouter must be used inside a <Router> component!');
|
|
246
247
|
useRouterSubscription(value.router);
|
|
247
248
|
return value.router;
|
|
248
249
|
}
|
|
@@ -250,64 +251,43 @@ function useMatches() {
|
|
|
250
251
|
return React__namespace.useContext(matchesContext);
|
|
251
252
|
}
|
|
252
253
|
function Outlet() {
|
|
253
|
-
var _match$
|
|
254
|
+
var _ref3, _match$__$pendingComp, _match$__$errorCompon;
|
|
254
255
|
|
|
255
256
|
const router = useRouter();
|
|
256
257
|
const matches = useMatches().slice(1);
|
|
257
258
|
const match = matches[0];
|
|
259
|
+
const defaultPending = React__namespace.useCallback(() => null, []);
|
|
258
260
|
|
|
259
261
|
if (!match) {
|
|
260
262
|
return null;
|
|
261
263
|
}
|
|
262
264
|
|
|
263
|
-
const
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
265
|
+
const PendingComponent = (_ref3 = (_match$__$pendingComp = match.__.pendingComponent) != null ? _match$__$pendingComp : router.options.defaultPendingComponent) != null ? _ref3 : defaultPending;
|
|
266
|
+
const errorComponent = (_match$__$errorCompon = match.__.errorComponent) != null ? _match$__$errorCompon : router.options.defaultErrorComponent;
|
|
267
|
+
return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
|
|
268
|
+
value: matches
|
|
269
|
+
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
270
|
+
fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, null)
|
|
271
|
+
}, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
|
|
272
|
+
errorComponent: errorComponent
|
|
273
|
+
}, (() => {
|
|
272
274
|
if (match.status === 'error') {
|
|
273
|
-
|
|
274
|
-
return errorElement;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (match.options.useErrorBoundary || router.options.useErrorBoundary) {
|
|
278
|
-
throw match.error;
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
return /*#__PURE__*/React__namespace.createElement(DefaultErrorBoundary, {
|
|
282
|
-
error: match.error
|
|
283
|
-
});
|
|
275
|
+
throw match.error;
|
|
284
276
|
}
|
|
285
277
|
|
|
286
|
-
if (match.status === '
|
|
287
|
-
|
|
288
|
-
var _match$__$pendingElem;
|
|
289
|
-
|
|
290
|
-
const pendingElement = (_match$__$pendingElem = match.__.pendingElement) != null ? _match$__$pendingElem : router.options.defaultPendingElement;
|
|
278
|
+
if (match.status === 'success') {
|
|
279
|
+
var _ref4, _ref5;
|
|
291
280
|
|
|
292
|
-
|
|
293
|
-
var _ref3;
|
|
294
|
-
|
|
295
|
-
return (_ref3 = pendingElement) != null ? _ref3 : null;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
return null;
|
|
281
|
+
return /*#__PURE__*/React__namespace.createElement((_ref4 = (_ref5 = match.__.component) != null ? _ref5 : router.options.defaultComponent) != null ? _ref4 : Outlet);
|
|
300
282
|
}
|
|
301
283
|
|
|
302
|
-
|
|
303
|
-
|
|
284
|
+
if (match.__.loadPromise) {
|
|
285
|
+
console.log(match.matchId, 'suspend');
|
|
286
|
+
throw match.__.loadPromise;
|
|
287
|
+
}
|
|
304
288
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
value: matches
|
|
308
|
-
}, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
|
|
309
|
-
catchElement: catchElement
|
|
310
|
-
}, element));
|
|
289
|
+
index$1.invariant(false, 'This should never happen!');
|
|
290
|
+
})())));
|
|
311
291
|
}
|
|
312
292
|
|
|
313
293
|
class CatchBoundary extends React__namespace.Component {
|
|
@@ -327,12 +307,12 @@ class CatchBoundary extends React__namespace.Component {
|
|
|
327
307
|
}
|
|
328
308
|
|
|
329
309
|
render() {
|
|
330
|
-
var _this$props$
|
|
310
|
+
var _this$props$errorComp;
|
|
331
311
|
|
|
332
|
-
const
|
|
312
|
+
const errorComponent = (_this$props$errorComp = this.props.errorComponent) != null ? _this$props$errorComp : DefaultErrorBoundary;
|
|
333
313
|
|
|
334
314
|
if (this.state.error) {
|
|
335
|
-
return
|
|
315
|
+
return /*#__PURE__*/React__namespace.createElement(errorComponent, this.state);
|
|
336
316
|
}
|
|
337
317
|
|
|
338
318
|
return this.props.children;
|
|
@@ -392,36 +372,40 @@ function Prompt(_ref7) {
|
|
|
392
372
|
return children != null ? children : null;
|
|
393
373
|
}
|
|
394
374
|
|
|
395
|
-
exports.cleanPath = index.cleanPath;
|
|
396
|
-
exports.createBrowserHistory = index.createBrowserHistory;
|
|
397
|
-
exports.createHashHistory = index.createHashHistory;
|
|
398
|
-
exports.createMemoryHistory = index.createMemoryHistory;
|
|
399
|
-
exports.createRoute = index.createRoute;
|
|
400
|
-
exports.createRouteConfig = index.createRouteConfig;
|
|
401
|
-
exports.createRouteMatch = index.createRouteMatch;
|
|
402
|
-
exports.createRouter = index.createRouter;
|
|
403
|
-
exports.decode = index.decode;
|
|
404
|
-
exports.defaultParseSearch = index.defaultParseSearch;
|
|
405
|
-
exports.defaultStringifySearch = index.defaultStringifySearch;
|
|
406
|
-
exports.encode = index.encode;
|
|
407
|
-
exports.functionalUpdate = index.functionalUpdate;
|
|
408
|
-
exports.interpolatePath = index.interpolatePath;
|
|
409
|
-
exports.invariant = index.invariant;
|
|
410
|
-
exports.joinPaths = index.joinPaths;
|
|
411
|
-
exports.last = index.last;
|
|
412
|
-
exports.matchByPath = index.matchByPath;
|
|
413
|
-
exports.matchPathname = index.matchPathname;
|
|
414
|
-
exports.parsePathname = index.parsePathname;
|
|
415
|
-
exports.parseSearchWith = index.parseSearchWith;
|
|
416
|
-
exports.pick = index.pick;
|
|
417
|
-
exports.replaceEqualDeep = index.replaceEqualDeep;
|
|
418
|
-
exports.resolvePath = index.resolvePath;
|
|
419
|
-
exports.rootRouteId = index.rootRouteId;
|
|
420
|
-
exports.stringifySearchWith = index.stringifySearchWith;
|
|
421
|
-
exports.trimPath = index.trimPath;
|
|
422
|
-
exports.trimPathLeft = index.trimPathLeft;
|
|
423
|
-
exports.trimPathRight = index.trimPathRight;
|
|
424
|
-
exports.warning = index.warning;
|
|
375
|
+
exports.cleanPath = index$1.cleanPath;
|
|
376
|
+
exports.createBrowserHistory = index$1.createBrowserHistory;
|
|
377
|
+
exports.createHashHistory = index$1.createHashHistory;
|
|
378
|
+
exports.createMemoryHistory = index$1.createMemoryHistory;
|
|
379
|
+
exports.createRoute = index$1.createRoute;
|
|
380
|
+
exports.createRouteConfig = index$1.createRouteConfig;
|
|
381
|
+
exports.createRouteMatch = index$1.createRouteMatch;
|
|
382
|
+
exports.createRouter = index$1.createRouter;
|
|
383
|
+
exports.decode = index$1.decode;
|
|
384
|
+
exports.defaultParseSearch = index$1.defaultParseSearch;
|
|
385
|
+
exports.defaultStringifySearch = index$1.defaultStringifySearch;
|
|
386
|
+
exports.encode = index$1.encode;
|
|
387
|
+
exports.functionalUpdate = index$1.functionalUpdate;
|
|
388
|
+
exports.interpolatePath = index$1.interpolatePath;
|
|
389
|
+
exports.invariant = index$1.invariant;
|
|
390
|
+
exports.joinPaths = index$1.joinPaths;
|
|
391
|
+
exports.last = index$1.last;
|
|
392
|
+
exports.matchByPath = index$1.matchByPath;
|
|
393
|
+
exports.matchPathname = index$1.matchPathname;
|
|
394
|
+
exports.parsePathname = index$1.parsePathname;
|
|
395
|
+
exports.parseSearchWith = index$1.parseSearchWith;
|
|
396
|
+
exports.pick = index$1.pick;
|
|
397
|
+
exports.replaceEqualDeep = index$1.replaceEqualDeep;
|
|
398
|
+
exports.resolvePath = index$1.resolvePath;
|
|
399
|
+
exports.rootRouteId = index$1.rootRouteId;
|
|
400
|
+
exports.stringifySearchWith = index$1.stringifySearchWith;
|
|
401
|
+
exports.trimPath = index$1.trimPath;
|
|
402
|
+
exports.trimPathLeft = index$1.trimPathLeft;
|
|
403
|
+
exports.trimPathRight = index$1.trimPathRight;
|
|
404
|
+
exports.warning = index$1.warning;
|
|
405
|
+
Object.defineProperty(exports, 'lazy', {
|
|
406
|
+
enumerable: true,
|
|
407
|
+
get: function () { return index.lazyWithPreload; }
|
|
408
|
+
});
|
|
425
409
|
exports.DefaultErrorBoundary = DefaultErrorBoundary;
|
|
426
410
|
exports.MatchesProvider = MatchesProvider;
|
|
427
411
|
exports.Outlet = Outlet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n\nimport {\n AnyRoute,\n CheckId,\n rootRouteId,\n Router,\n RouterState,\n ToIdOption,\n} from '@tanstack/router-core'\nimport {\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AnyRouteInfo,\n AllRouteInfo,\n RouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n // Any is required here so import() will work without having to do import().then(d => d.default)\n SyncOrAsyncElement: React.ReactNode | (() => Promise<any>)\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > {\n useState: () => RouterState\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useMatch: <\n TId extends keyof TAllRouteInfo['routeInfoById'],\n TStrict extends true | false = true,\n >(\n routeId: TId,\n opts?: { strict?: TStrict },\n ) => TStrict extends true\n ? RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n :\n | RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n | undefined\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, '/', TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<'/', NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n useRoute: <\n TTo extends string = '.',\n TResolved extends string = ResolveRelativePath<\n TRouteInfo['id'],\n NoInfer<TTo>\n >,\n >(\n routeId: CheckId<\n TAllRouteInfo,\n TResolved,\n ToIdOption<TAllRouteInfo, TRouteInfo['id'], TTo>\n >,\n opts?: { strict?: boolean },\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TResolved]>\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<TRouteInfo['fullPath'], NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo> = '/',\n TTo extends string = '.',\n> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nconst matchesContext = React.createContext<RouteMatch[]>(null!)\nconst routerContext = React.createContext<{ router: Router<any, any> }>(null!)\n\n// Detect if we're in the DOM\nconst isDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement,\n)\n\nconst useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect\n\nexport type MatchesProviderProps = {\n value: RouteMatch[]\n children: React.ReactNode\n}\n\nexport function MatchesProvider(props: MatchesProviderProps) {\n return <matchesContext.Provider {...props} />\n}\n\nconst useRouterSubscription = (router: Router<any, any>) => {\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n () => router.state,\n )\n}\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig> {\n const makeRouteExt = (\n route: AnyRoute,\n router: Router<any, any>,\n ): Pick<AnyRoute, 'useRoute' | 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\n useRoute: (subRouteId = '.' as any) => {\n const resolvedRouteId = router.resolvePath(\n route.routeId,\n subRouteId as string,\n )\n const resolvedRoute = router.getRoute(resolvedRouteId)\n useRouterSubscription(router)\n invariant(\n resolvedRoute,\n `Could not find a route for route \"${\n resolvedRouteId as string\n }\"! Did you forget to add it to your route config?`,\n )\n return resolvedRoute\n },\n linkProps: (options) => {\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = route.buildLink(options)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const {\n handleClick,\n handleFocus,\n handleEnter,\n handleLeave,\n isActive,\n next,\n } = linkInfo\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n e.persist()\n handlers.forEach((handler) => {\n if (handler) handler(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? functionalUpdate(activeProps, {}) ?? {} : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps, {}) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled ? undefined : next.href,\n onClick: composeHandlers([handleClick, onClick]),\n onFocus: composeHandlers([handleFocus, onFocus]),\n onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),\n onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n },\n Link: React.forwardRef((props: any, ref) => {\n const linkProps = route.linkProps(props)\n\n useRouterSubscription(router)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n }) as any,\n MatchRoute: (opts) => {\n const { pending, caseSensitive, children, ...rest } = opts\n\n const params = route.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n\n if (!params) {\n return null\n }\n\n return typeof opts.children === 'function'\n ? opts.children(params as any)\n : (opts.children as any)\n },\n }\n }\n\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n createRouter: (router) => {\n const routerExt: Pick<Router<any, any>, 'useMatch' | 'useState'> = {\n useState: () => {\n useRouterSubscription(router)\n return router.state\n },\n useMatch: (routeId, opts) => {\n useRouterSubscription(router)\n\n invariant(\n routeId !== rootRouteId,\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n\n const runtimeMatch = useMatches()?.[0]!\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n if (opts?.strict ?? true) {\n invariant(\n match,\n `Could not find an active match for \"${routeId as string}\"!`,\n )\n\n invariant(\n runtimeMatch.routeId == match?.routeId,\n `useMatch('${\n match?.routeId as string\n }') is being called in a component that is meant to render the '${\n runtimeMatch.routeId\n }' route. Did you mean to 'useMatch(${\n match?.routeId as string\n }, { strict: false })' or 'useRoute(${\n match?.routeId as string\n })' instead?`,\n )\n }\n\n return match as any\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute('/'), router)\n\n Object.assign(router, routerExt, routeExt)\n },\n createRoute: ({ router, route }) => {\n const routeExt = makeRouteExt(route, router)\n\n Object.assign(route, routeExt)\n },\n createElement: async (element) => {\n if (typeof element === 'function') {\n const res = (await element()) as any\n\n // Support direct import() calls\n if (typeof res === 'object' && res.default) {\n return React.createElement(res.default)\n } else {\n return res\n }\n }\n\n return element\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n> = RouterOptions<TRouteConfig> & {\n router: Router<TRouteConfig, TAllRouteInfo>\n // Children will default to `<Outlet />` if not provided\n children?: React.ReactNode\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>) {\n router.update(rest)\n\n useRouterSubscription(router)\n useLayoutEffect(() => {\n const unsub = router.mount()\n router.load()\n return unsub\n }, [router])\n\n return (\n <routerContext.Provider value={{ router }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): Router {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n\n useRouterSubscription(value.router)\n\n return value.router as Router\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function Outlet() {\n const router = useRouter()\n const matches = useMatches().slice(1)\n const match = matches[0]\n\n if (!match) {\n return null\n }\n\n const element = ((): React.ReactNode => {\n if (!match) {\n return null\n }\n\n const errorElement =\n match.__.errorElement ?? router.options.defaultErrorElement\n\n if (match.status === 'error') {\n if (errorElement) {\n return errorElement as any\n }\n\n if (match.options.useErrorBoundary || router.options.useErrorBoundary) {\n throw match.error\n }\n\n return <DefaultErrorBoundary error={match.error} />\n }\n\n if (match.status === 'loading' || match.status === 'idle') {\n if (match.isPending) {\n const pendingElement =\n match.__.pendingElement ?? router.options.defaultPendingElement\n\n if (match.options.pendingMs || pendingElement) {\n return (pendingElement as any) ?? null\n }\n }\n\n return null\n }\n\n return (\n (match.__.element as any) ?? router.options.defaultElement ?? <Outlet />\n )\n })() as JSX.Element\n\n const catchElement =\n match?.options.catchElement ?? router.options.defaultCatchElement\n\n return (\n <MatchesProvider value={matches}>\n <CatchBoundary catchElement={catchElement}>{element}</CatchBoundary>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n catchElement: any\n}> {\n state = {\n error: false,\n }\n componentDidCatch(error: any, info: any) {\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n render() {\n const catchElement = this.props.catchElement ?? DefaultErrorBoundary\n\n if (this.state.error) {\n return typeof catchElement === 'function'\n ? catchElement(this.state)\n : catchElement\n }\n\n return this.props.children\n }\n}\n\nexport function DefaultErrorBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n {/* <div style={{ height: '1rem' }} />\n <div\n style={{\n fontSize: '.8em',\n borderLeft: '3px solid rgba(127, 127, 127, 1)',\n paddingLeft: '.5rem',\n opacity: 0.5,\n }}\n >\n If you are the owner of this website, it's highly recommended that you\n configure your own custom Catch/Error boundaries for the router. You can\n optionally configure a boundary for each route.\n </div> */}\n </div>\n )\n}\n\nexport function usePrompt(message: string, when: boolean | any): void {\n const router = useRouter()\n\n React.useEffect(() => {\n if (!when) return\n\n let unblock = router.history.block((transition) => {\n if (window.confirm(message)) {\n unblock()\n transition.retry()\n } else {\n router.location.pathname = window.location.pathname\n }\n })\n\n return unblock\n }, [when, location, message])\n}\n\nexport function Prompt({ message, when, children }: PromptProps) {\n usePrompt(message, when ?? true)\n return (children ?? null) as React.ReactNode\n}\n"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","useRoute","subRouteId","resolvedRouteId","resolvePath","routeId","resolvedRoute","getRoute","invariant","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","composeHandlers","handlers","e","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","join","role","Link","forwardRef","ref","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useState","useMatch","rootRouteId","runtimeMatch","useMatches","match","matches","find","d","strict","routeExt","Object","assign","createRoute","element","res","default","RouterProvider","_objectWithoutPropertiesLoose","update","unsub","mount","load","useRouter","value","useContext","warning","Outlet","slice","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","CatchBoundary","Component","componentDidCatch","info","console","setState","render","DefaultErrorBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","usePrompt","when","unblock","history","block","transition","confirm","retry","location","pathname","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmKA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAkD,IAAlD,CAAtB;;AAGA,MAAME,KAAK,GAAGC,OAAO,CACnB,OAAOC,MAAP,KAAkB,WAAlB,IACEA,MAAM,CAACC,QADT,IAEED,MAAM,CAACC,QAAP,CAAgBC,aAHC,CAArB,CAAA;AAMA,MAAMC,eAAe,GAAGL,KAAK,GAAGH,gBAAK,CAACQ,eAAT,GAA2BR,gBAAK,CAACS,SAA9D,CAAA;AAOO,SAASC,eAAT,CAAyBC,KAAzB,EAAsD;AAC3D,EAAA,oBAAOX,+BAAC,cAAD,CAAgB,QAAhB,EAA6BW,KAA7B,CAAP,CAAA;AACD,CAAA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;AAEM,SAASI,SAAT,CAAmBJ,OAAnB,EAAoCK,IAApC,EAA+D;EACpE,MAAM7H,MAAM,GAAGyF,SAAS,EAAxB,CAAA;EAEAtG,gBAAK,CAACS,SAAN,CAAgB,MAAM;IACpB,IAAI,CAACiI,IAAL,EAAW,OAAA;IAEX,IAAIC,OAAO,GAAG9H,MAAM,CAAC+H,OAAP,CAAeC,KAAf,CAAsBC,UAAD,IAAgB;AACjD,MAAA,IAAIzI,MAAM,CAAC0I,OAAP,CAAeV,OAAf,CAAJ,EAA6B;QAC3BM,OAAO,EAAA,CAAA;AACPG,QAAAA,UAAU,CAACE,KAAX,EAAA,CAAA;AACD,OAHD,MAGO;QACLnI,MAAM,CAACoI,QAAP,CAAgBC,QAAhB,GAA2B7I,MAAM,CAAC4I,QAAP,CAAgBC,QAA3C,CAAA;AACD,OAAA;AACF,KAPa,CAAd,CAAA;AASA,IAAA,OAAOP,OAAP,CAAA;AACD,GAbD,EAaG,CAACD,IAAD,EAAOO,QAAP,EAAiBZ,OAAjB,CAbH,CAAA,CAAA;AAcD,CAAA;AAEM,SAASc,MAAT,CAA0D,KAAA,EAAA;EAAA,IAA1C;IAAEd,OAAF;IAAWK,IAAX;AAAiBpE,IAAAA,QAAAA;GAAyB,GAAA,KAAA,CAAA;EAC/DmE,SAAS,CAACJ,OAAD,EAAUK,IAAV,WAAUA,IAAV,GAAkB,IAAlB,CAAT,CAAA;AACA,EAAA,OAAQpE,QAAR,IAAA,IAAA,GAAQA,QAAR,GAAoB,IAApB,CAAA;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/index.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport { useSyncExternalStore } from 'use-sync-external-store/shim'\n\nimport {\n AnyRoute,\n CheckId,\n rootRouteId,\n Router,\n RouterState,\n ToIdOption,\n} from '@tanstack/router-core'\nimport {\n warning,\n RouterOptions,\n RouteMatch,\n MatchRouteOptions,\n RouteConfig,\n AnyRouteConfig,\n AnyAllRouteInfo,\n DefaultAllRouteInfo,\n functionalUpdate,\n createRouter,\n AnyRouteInfo,\n AllRouteInfo,\n RouteInfo,\n ValidFromPath,\n LinkOptions,\n RouteInfoByPath,\n ResolveRelativePath,\n NoInfer,\n ToOptions,\n invariant,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\nexport { lazyWithPreload as lazy } from 'react-lazy-with-preload/lib/index'\nexport type { PreloadableComponent as LazyComponent } from 'react-lazy-with-preload'\n\ntype SyncRouteComponent = (props?: {}) => React.ReactNode\nexport type RouteComponent = SyncRouteComponent & {\n preload?: () => Promise<{\n default: SyncRouteComponent\n }>\n}\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Component: RouteComponent\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > {\n useState: () => RouterState\n useRoute: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n useMatch: <\n TId extends keyof TAllRouteInfo['routeInfoById'],\n TStrict extends true | false = true,\n >(\n routeId: TId,\n opts?: { strict?: TStrict },\n ) => TStrict extends true\n ? RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n :\n | RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\n | undefined\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, '/', TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<'/', NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n\n interface Route<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TRouteInfo extends AnyRouteInfo = RouteInfo,\n > {\n useRoute: <\n TTo extends string = '.',\n TResolved extends string = ResolveRelativePath<\n TRouteInfo['id'],\n NoInfer<TTo>\n >,\n >(\n routeId: CheckId<\n TAllRouteInfo,\n TResolved,\n ToIdOption<TAllRouteInfo, TRouteInfo['id'], TTo>\n >,\n opts?: { strict?: boolean },\n ) => Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TResolved]>\n linkProps: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n ) => React.AnchorHTMLAttributes<HTMLAnchorElement>\n Link: <TTo extends string = '.'>(\n props: LinkPropsOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n ) => JSX.Element\n MatchRoute: <TTo extends string = '.'>(\n props: ToOptions<TAllRouteInfo, TRouteInfo['fullPath'], TTo> &\n MatchRouteOptions & {\n // If a function is passed as a child, it will be given the `isActive` boolean to aid in further styling on the element it returns\n children?:\n | React.ReactNode\n | ((\n params: RouteInfoByPath<\n TAllRouteInfo,\n ResolveRelativePath<TRouteInfo['fullPath'], NoInfer<TTo>>\n >['allParams'],\n ) => React.ReactNode)\n },\n ) => JSX.Element\n }\n}\n\ntype LinkPropsOptions<\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n TFrom extends ValidFromPath<TAllRouteInfo> = '/',\n TTo extends string = '.',\n> = LinkOptions<TAllRouteInfo, TFrom, TTo> & {\n // A function that returns additional props for the `active` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n activeProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n // A function that returns additional props for the `inactive` state of this link. These props override other props passed to the link (`style`'s are merged, `className`'s are concatenated)\n inactiveProps?:\n | React.AnchorHTMLAttributes<HTMLAnchorElement>\n | (() => React.AnchorHTMLAttributes<HTMLAnchorElement>)\n}\n\nexport type PromptProps = {\n message: string\n when?: boolean | any\n children?: React.ReactNode\n}\n\n//\n\nconst matchesContext = React.createContext<RouteMatch[]>(null!)\nconst routerContext = React.createContext<{ router: Router<any, any> }>(null!)\n\n// Detect if we're in the DOM\nconst isDOM = Boolean(\n typeof window !== 'undefined' &&\n window.document &&\n window.document.createElement,\n)\n\nconst useLayoutEffect = isDOM ? React.useLayoutEffect : React.useEffect\n\nexport type MatchesProviderProps = {\n value: RouteMatch[]\n children: React.ReactNode\n}\n\nexport function MatchesProvider(props: MatchesProviderProps) {\n return <matchesContext.Provider {...props} />\n}\n\nconst useRouterSubscription = (router: Router<any, any>) => {\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n () => router.state,\n )\n}\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig> {\n const makeRouteExt = (\n route: AnyRoute,\n router: Router<any, any>,\n ): Pick<AnyRoute, 'useRoute' | 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\n useRoute: (subRouteId = '.' as any) => {\n const resolvedRouteId = router.resolvePath(\n route.routeId,\n subRouteId as string,\n )\n const resolvedRoute = router.getRoute(resolvedRouteId)\n useRouterSubscription(router)\n invariant(\n resolvedRoute,\n `Could not find a route for route \"${\n resolvedRouteId as string\n }\"! Did you forget to add it to your route config?`,\n )\n return resolvedRoute\n },\n linkProps: (options) => {\n const {\n // custom props\n type,\n children,\n target,\n activeProps = () => ({ className: 'active' }),\n inactiveProps = () => ({}),\n activeOptions,\n disabled,\n // fromCurrent,\n hash,\n search,\n params,\n to,\n preload,\n preloadDelay,\n preloadMaxAge,\n replace,\n // element props\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = options\n\n const linkInfo = route.buildLink(options)\n\n if (linkInfo.type === 'external') {\n const { href } = linkInfo\n return { href }\n }\n\n const {\n handleClick,\n handleFocus,\n handleEnter,\n handleLeave,\n isActive,\n next,\n } = linkInfo\n\n const reactHandleClick = (e: Event) => {\n React.startTransition(() => {\n handleClick(e)\n })\n }\n\n const composeHandlers =\n (handlers: (undefined | ((e: any) => void))[]) =>\n (e: React.SyntheticEvent) => {\n e.persist()\n handlers.forEach((handler) => {\n if (handler) handler(e)\n })\n }\n\n // Get the active props\n const resolvedActiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? functionalUpdate(activeProps, {}) ?? {} : {}\n\n // Get the inactive props\n const resolvedInactiveProps: React.HTMLAttributes<HTMLAnchorElement> =\n isActive ? {} : functionalUpdate(inactiveProps, {}) ?? {}\n\n return {\n ...resolvedActiveProps,\n ...resolvedInactiveProps,\n ...rest,\n href: disabled ? undefined : next.href,\n onClick: composeHandlers([reactHandleClick, onClick]),\n onFocus: composeHandlers([handleFocus, onFocus]),\n onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),\n onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),\n target,\n style: {\n ...style,\n ...resolvedActiveProps.style,\n ...resolvedInactiveProps.style,\n },\n className:\n [\n className,\n resolvedActiveProps.className,\n resolvedInactiveProps.className,\n ]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n ['data-status']: isActive ? 'active' : undefined,\n }\n },\n Link: React.forwardRef((props: any, ref) => {\n const linkProps = route.linkProps(props)\n\n useRouterSubscription(router)\n\n return (\n <a\n {...{\n ref: ref as any,\n ...linkProps,\n children:\n typeof props.children === 'function'\n ? props.children({\n isActive: (linkProps as any)['data-status'] === 'active',\n })\n : props.children,\n }}\n />\n )\n }) as any,\n MatchRoute: (opts) => {\n const { pending, caseSensitive, children, ...rest } = opts\n\n const params = route.matchRoute(rest as any, {\n pending,\n caseSensitive,\n })\n\n if (!params) {\n return null\n }\n\n return typeof opts.children === 'function'\n ? opts.children(params as any)\n : (opts.children as any)\n },\n }\n }\n\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n createRouter: (router) => {\n const routerExt: Pick<Router<any, any>, 'useMatch' | 'useState'> = {\n useState: () => {\n useRouterSubscription(router)\n return router.state\n },\n useMatch: (routeId, opts) => {\n useRouterSubscription(router)\n\n invariant(\n routeId !== rootRouteId,\n `\"${rootRouteId}\" cannot be used with useMatch! Did you mean to useRoute(\"${rootRouteId}\")?`,\n )\n\n const runtimeMatch = useMatches()?.[0]!\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n if (opts?.strict ?? true) {\n invariant(\n match,\n `Could not find an active match for \"${routeId as string}\"!`,\n )\n\n invariant(\n runtimeMatch.routeId == match?.routeId,\n `useMatch('${\n match?.routeId as string\n }') is being called in a component that is meant to render the '${\n runtimeMatch.routeId\n }' route. Did you mean to 'useMatch(${\n match?.routeId as string\n }, { strict: false })' or 'useRoute(${\n match?.routeId as string\n })' instead?`,\n )\n }\n\n return match as any\n },\n }\n\n const routeExt = makeRouteExt(router.getRoute('/'), router)\n\n Object.assign(router, routerExt, routeExt)\n },\n createRoute: ({ router, route }) => {\n const routeExt = makeRouteExt(route, router)\n\n Object.assign(route, routeExt)\n },\n loadComponent: async (component) => {\n if (component.preload && typeof document !== 'undefined') {\n component.preload()\n // return await component.preload()\n }\n\n return component as any\n },\n })\n\n return coreRouter as any\n}\n\nexport type RouterProps<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n> = RouterOptions<TRouteConfig> & {\n router: Router<TRouteConfig, TAllRouteInfo>\n // Children will default to `<Outlet />` if not provided\n children?: React.ReactNode\n}\n\nexport function RouterProvider<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = DefaultAllRouteInfo,\n>({ children, router, ...rest }: RouterProps<TRouteConfig, TAllRouteInfo>) {\n router.update(rest)\n\n useRouterSubscription(router)\n useLayoutEffect(() => {\n const unsub = router.mount()\n router.load()\n return unsub\n }, [router])\n\n return (\n <routerContext.Provider value={{ router }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): Router {\n const value = React.useContext(routerContext)\n warning(!value, 'useRouter must be used inside a <Router> component!')\n\n useRouterSubscription(value.router)\n\n return value.router as Router\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function Outlet() {\n const router = useRouter()\n const matches = useMatches().slice(1)\n const match = matches[0]\n\n const defaultPending = React.useCallback(() => null, [])\n\n if (!match) {\n return null\n }\n\n const PendingComponent = (match.__.pendingComponent ??\n router.options.defaultPendingComponent ??\n defaultPending) as any\n\n const errorComponent =\n match.__.errorComponent ?? router.options.defaultErrorComponent\n\n return (\n <MatchesProvider value={matches}>\n <React.Suspense fallback={<PendingComponent />}>\n <CatchBoundary errorComponent={errorComponent}>\n {\n ((): React.ReactNode => {\n if (match.status === 'error') {\n throw match.error\n }\n\n if (match.status === 'success') {\n return React.createElement(\n (match.__.component as any) ??\n router.options.defaultComponent ??\n Outlet,\n )\n }\n\n if (match.__.loadPromise) {\n console.log(match.matchId, 'suspend')\n throw match.__.loadPromise\n }\n\n invariant(false, 'This should never happen!')\n })() as JSX.Element\n }\n </CatchBoundary>\n </React.Suspense>\n </MatchesProvider>\n )\n}\n\nclass CatchBoundary extends React.Component<{\n children: any\n errorComponent: any\n}> {\n state = {\n error: false,\n }\n componentDidCatch(error: any, info: any) {\n console.error(error)\n\n this.setState({\n error,\n info,\n })\n }\n render() {\n const errorComponent = this.props.errorComponent ?? DefaultErrorBoundary\n\n if (this.state.error) {\n return React.createElement(errorComponent, this.state)\n }\n\n return this.props.children\n }\n}\n\nexport function DefaultErrorBoundary({ error }: { error: any }) {\n return (\n <div style={{ padding: '.5rem', maxWidth: '100%' }}>\n <strong style={{ fontSize: '1.2rem' }}>Something went wrong!</strong>\n <div style={{ height: '.5rem' }} />\n <div>\n <pre>\n {error.message ? (\n <code\n style={{\n fontSize: '.7em',\n border: '1px solid red',\n borderRadius: '.25rem',\n padding: '.5rem',\n color: 'red',\n }}\n >\n {error.message}\n </code>\n ) : null}\n </pre>\n </div>\n </div>\n )\n}\n\nexport function usePrompt(message: string, when: boolean | any): void {\n const router = useRouter()\n\n React.useEffect(() => {\n if (!when) return\n\n let unblock = router.history.block((transition) => {\n if (window.confirm(message)) {\n unblock()\n transition.retry()\n } else {\n router.location.pathname = window.location.pathname\n }\n })\n\n return unblock\n }, [when, location, message])\n}\n\nexport function Prompt({ message, when, children }: PromptProps) {\n usePrompt(message, when ?? true)\n return (children ?? null) as React.ReactNode\n}\n"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","makeRouteExt","route","useRoute","subRouteId","resolvedRouteId","resolvePath","routeId","resolvedRoute","getRoute","invariant","linkProps","options","target","activeProps","className","inactiveProps","disabled","style","onClick","onFocus","onMouseEnter","onMouseLeave","rest","linkInfo","buildLink","type","href","handleClick","handleFocus","handleEnter","handleLeave","isActive","next","reactHandleClick","e","startTransition","composeHandlers","handlers","persist","forEach","handler","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","_extends","undefined","filter","join","role","Link","forwardRef","ref","children","MatchRoute","pending","caseSensitive","params","matchRoute","coreRouter","createRouter","routerExt","useState","useMatch","rootRouteId","runtimeMatch","useMatches","match","matches","find","d","strict","routeExt","Object","assign","createRoute","loadComponent","component","preload","RouterProvider","_objectWithoutPropertiesLoose","update","unsub","mount","load","useRouter","value","useContext","warning","Outlet","slice","defaultPending","useCallback","PendingComponent","__","pendingComponent","defaultPendingComponent","errorComponent","defaultErrorComponent","status","error","defaultComponent","loadPromise","console","log","matchId","CatchBoundary","Component","componentDidCatch","info","setState","render","DefaultErrorBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","usePrompt","when","unblock","history","block","transition","confirm","retry","location","pathname","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2KA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAkD,IAAlD,CAAtB;;AAGA,MAAME,KAAK,GAAGC,OAAO,CACnB,OAAOC,MAAP,KAAkB,WAAlB,IACEA,MAAM,CAACC,QADT,IAEED,MAAM,CAACC,QAAP,CAAgBC,aAHC,CAArB,CAAA;AAMA,MAAMC,eAAe,GAAGL,KAAK,GAAGH,gBAAK,CAACQ,eAAT,GAA2BR,gBAAK,CAACS,SAA9D,CAAA;AAOO,SAASC,eAAT,CAAyBC,KAAzB,EAAsD;AAC3D,EAAA,oBAAOX,+BAAC,cAAD,CAAgB,QAAhB,EAA6BW,KAA7B,CAAP,CAAA;AACD,CAAA;;AAED,MA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