@tanstack/react-router 0.0.1-beta.2 → 0.0.1-beta.20
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 +95 -117
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/cjs/router-core/build/esm/index.js +257 -227
- package/build/cjs/router-core/build/esm/index.js.map +1 -1
- package/build/esm/index.js +344 -343
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +29 -29
- package/build/types/index.d.ts +42 -10
- package/build/umd/index.development.js +351 -343
- 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 +172 -136
|
@@ -40,12 +40,38 @@ var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
|
40
40
|
const _excluded = ["type", "children", "target", "activeProps", "inactiveProps", "activeOptions", "disabled", "hash", "search", "params", "to", "preload", "preloadDelay", "preloadMaxAge", "replace", "style", "className", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "onTouchStart", "onTouchEnd"],
|
|
41
41
|
_excluded2 = ["pending", "caseSensitive", "children"],
|
|
42
42
|
_excluded3 = ["children", "router"];
|
|
43
|
+
function lazy(importer) {
|
|
44
|
+
const lazyComp = /*#__PURE__*/React__namespace.lazy(importer);
|
|
45
|
+
let promise;
|
|
46
|
+
let resolvedComp;
|
|
47
|
+
const forwardedComp = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
|
|
48
|
+
const resolvedCompRef = React__namespace.useRef(resolvedComp || lazyComp);
|
|
49
|
+
return /*#__PURE__*/React__namespace.createElement(resolvedCompRef.current, _rollupPluginBabelHelpers["extends"]({}, ref ? {
|
|
50
|
+
ref
|
|
51
|
+
} : {}, props));
|
|
52
|
+
});
|
|
53
|
+
const finalComp = forwardedComp;
|
|
54
|
+
|
|
55
|
+
finalComp.preload = () => {
|
|
56
|
+
if (!promise) {
|
|
57
|
+
promise = importer().then(module => {
|
|
58
|
+
resolvedComp = module.default;
|
|
59
|
+
return resolvedComp;
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return promise;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
return finalComp;
|
|
67
|
+
}
|
|
43
68
|
//
|
|
69
|
+
function Link(props) {
|
|
70
|
+
const router = useRouter();
|
|
71
|
+
return /*#__PURE__*/React__namespace.createElement(router.Link, props);
|
|
72
|
+
}
|
|
44
73
|
const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
45
|
-
const routerContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
46
|
-
|
|
47
|
-
const isDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
48
|
-
const useLayoutEffect = isDOM ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
74
|
+
const routerContext = /*#__PURE__*/React__namespace.createContext(null);
|
|
49
75
|
function MatchesProvider(props) {
|
|
50
76
|
return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, props);
|
|
51
77
|
}
|
|
@@ -109,6 +135,12 @@ function createReactRouter(opts) {
|
|
|
109
135
|
next
|
|
110
136
|
} = linkInfo;
|
|
111
137
|
|
|
138
|
+
const reactHandleClick = e => {
|
|
139
|
+
React__namespace.startTransition(() => {
|
|
140
|
+
handleClick(e);
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
|
|
112
144
|
const composeHandlers = handlers => e => {
|
|
113
145
|
e.persist();
|
|
114
146
|
handlers.forEach(handler => {
|
|
@@ -122,7 +154,7 @@ function createReactRouter(opts) {
|
|
|
122
154
|
const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = index.functionalUpdate(inactiveProps, {})) != null ? _functionalUpdate2 : {};
|
|
123
155
|
return _rollupPluginBabelHelpers["extends"]({}, resolvedActiveProps, resolvedInactiveProps, rest, {
|
|
124
156
|
href: disabled ? undefined : next.href,
|
|
125
|
-
onClick: composeHandlers([
|
|
157
|
+
onClick: composeHandlers([reactHandleClick, onClick]),
|
|
126
158
|
onFocus: composeHandlers([handleFocus, onFocus]),
|
|
127
159
|
onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
|
|
128
160
|
onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
|
|
@@ -175,18 +207,17 @@ function createReactRouter(opts) {
|
|
|
175
207
|
useRouterSubscription(router);
|
|
176
208
|
return router.state;
|
|
177
209
|
},
|
|
178
|
-
useMatch: routeId => {
|
|
210
|
+
useMatch: (routeId, opts) => {
|
|
211
|
+
var _useMatches, _opts$strict;
|
|
212
|
+
|
|
179
213
|
useRouterSubscription(router);
|
|
180
214
|
index.invariant(routeId !== index.rootRouteId, "\"" + index.rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + index.rootRouteId + "\")?");
|
|
181
|
-
|
|
182
|
-
const runtimeMatch = _useMatch();
|
|
183
|
-
|
|
215
|
+
const runtimeMatch = (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
|
|
184
216
|
const match = router.state.matches.find(d => d.routeId === routeId);
|
|
185
|
-
index.invariant(match, "Could not find a match for route \"" + routeId + "\" being rendered in this component!");
|
|
186
|
-
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 'useRoute(" + (match == null ? void 0 : match.routeId) + ")' instead?");
|
|
187
217
|
|
|
188
|
-
if (
|
|
189
|
-
index.invariant(
|
|
218
|
+
if ((_opts$strict = opts == null ? void 0 : opts.strict) != null ? _opts$strict : true) {
|
|
219
|
+
index.invariant(match, "Could not find an active match for \"" + routeId + "\"!");
|
|
220
|
+
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?");
|
|
190
221
|
}
|
|
191
222
|
|
|
192
223
|
return match;
|
|
@@ -203,18 +234,12 @@ function createReactRouter(opts) {
|
|
|
203
234
|
const routeExt = makeRouteExt(route, router);
|
|
204
235
|
Object.assign(route, routeExt);
|
|
205
236
|
},
|
|
206
|
-
|
|
207
|
-
if (typeof
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
if (typeof res === 'object' && res.default) {
|
|
211
|
-
return /*#__PURE__*/React__namespace.createElement(res.default);
|
|
212
|
-
} else {
|
|
213
|
-
return res;
|
|
214
|
-
}
|
|
237
|
+
loadComponent: async component => {
|
|
238
|
+
if (component.preload && typeof document !== 'undefined') {
|
|
239
|
+
component.preload(); // return await component.preload()
|
|
215
240
|
}
|
|
216
241
|
|
|
217
|
-
return
|
|
242
|
+
return component;
|
|
218
243
|
}
|
|
219
244
|
}));
|
|
220
245
|
return coreRouter;
|
|
@@ -228,101 +253,65 @@ function RouterProvider(_ref2) {
|
|
|
228
253
|
|
|
229
254
|
router.update(rest);
|
|
230
255
|
useRouterSubscription(router);
|
|
231
|
-
|
|
256
|
+
React__namespace.useEffect(() => {
|
|
257
|
+
console.log('hello');
|
|
232
258
|
return router.mount();
|
|
233
259
|
}, [router]);
|
|
234
260
|
return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
|
|
235
261
|
value: {
|
|
236
|
-
router
|
|
262
|
+
router: router
|
|
237
263
|
}
|
|
238
264
|
}, /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
|
|
239
265
|
value: router.state.matches
|
|
240
266
|
}, children != null ? children : /*#__PURE__*/React__namespace.createElement(Outlet, null)));
|
|
241
267
|
}
|
|
242
|
-
|
|
243
268
|
function useRouter() {
|
|
244
269
|
const value = React__namespace.useContext(routerContext);
|
|
245
270
|
index.warning(!value, 'useRouter must be used inside a <Router> component!');
|
|
246
271
|
useRouterSubscription(value.router);
|
|
247
272
|
return value.router;
|
|
248
273
|
}
|
|
249
|
-
|
|
250
274
|
function useMatches() {
|
|
251
275
|
return React__namespace.useContext(matchesContext);
|
|
252
|
-
} // function useParentMatches(): RouteMatch[] {
|
|
253
|
-
// const router = useRouter()
|
|
254
|
-
// const match = useMatch()
|
|
255
|
-
// const matches = router.state.matches
|
|
256
|
-
// return matches.slice(
|
|
257
|
-
// 0,
|
|
258
|
-
// matches.findIndex((d) => d.matchId === match.matchId) - 1,
|
|
259
|
-
// )
|
|
260
|
-
// }
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
function _useMatch() {
|
|
264
|
-
var _useMatches;
|
|
265
|
-
|
|
266
|
-
return (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
|
|
267
276
|
}
|
|
268
|
-
|
|
277
|
+
function useMatch(routeId, opts) {
|
|
278
|
+
const router = useRouter();
|
|
279
|
+
return router.useMatch(routeId, opts);
|
|
280
|
+
}
|
|
269
281
|
function Outlet() {
|
|
270
|
-
var
|
|
282
|
+
var _ref3, _match$__$pendingComp, _match$__$errorCompon;
|
|
271
283
|
|
|
272
284
|
const router = useRouter();
|
|
273
|
-
const
|
|
274
|
-
const
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
const element = (() => {
|
|
278
|
-
var _childMatch$__$errorE, _ref4;
|
|
279
|
-
|
|
280
|
-
if (!childMatch) {
|
|
281
|
-
return null;
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const errorElement = (_childMatch$__$errorE = childMatch.__.errorElement) != null ? _childMatch$__$errorE : router.options.defaultErrorElement;
|
|
285
|
-
|
|
286
|
-
if (childMatch.status === 'error') {
|
|
287
|
-
if (errorElement) {
|
|
288
|
-
return errorElement;
|
|
289
|
-
}
|
|
285
|
+
const matches = useMatches().slice(1);
|
|
286
|
+
const match = matches[0];
|
|
287
|
+
const defaultPending = React__namespace.useCallback(() => null, []);
|
|
290
288
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
289
|
+
if (!match) {
|
|
290
|
+
return null;
|
|
291
|
+
}
|
|
294
292
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
293
|
+
const PendingComponent = (_ref3 = (_match$__$pendingComp = match.__.pendingComponent) != null ? _match$__$pendingComp : router.options.defaultPendingComponent) != null ? _ref3 : defaultPending;
|
|
294
|
+
const errorComponent = (_match$__$errorCompon = match.__.errorComponent) != null ? _match$__$errorCompon : router.options.defaultErrorComponent;
|
|
295
|
+
return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
|
|
296
|
+
value: matches
|
|
297
|
+
}, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
|
|
298
|
+
fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, null)
|
|
299
|
+
}, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
|
|
300
|
+
errorComponent: errorComponent
|
|
301
|
+
}, (() => {
|
|
302
|
+
if (match.status === 'error') {
|
|
303
|
+
throw match.error;
|
|
298
304
|
}
|
|
299
305
|
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
var _childMatch$__$pendin;
|
|
303
|
-
|
|
304
|
-
const pendingElement = (_childMatch$__$pendin = childMatch.__.pendingElement) != null ? _childMatch$__$pendin : router.options.defaultPendingElement;
|
|
305
|
-
|
|
306
|
-
if (childMatch.options.pendingMs || pendingElement) {
|
|
307
|
-
var _ref3;
|
|
308
|
-
|
|
309
|
-
return (_ref3 = pendingElement) != null ? _ref3 : null;
|
|
310
|
-
}
|
|
311
|
-
}
|
|
306
|
+
if (match.status === 'success') {
|
|
307
|
+
var _ref4, _ref5;
|
|
312
308
|
|
|
313
|
-
return null;
|
|
309
|
+
return /*#__PURE__*/React__namespace.createElement((_ref4 = (_ref5 = match.__.component) != null ? _ref5 : router.options.defaultComponent) != null ? _ref4 : Outlet);
|
|
314
310
|
}
|
|
315
311
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
const catchElement = (_childMatch$options$c = childMatch == null ? void 0 : childMatch.options.catchElement) != null ? _childMatch$options$c : router.options.defaultCatchElement;
|
|
320
|
-
return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
|
|
321
|
-
value: matches,
|
|
322
|
-
key: childMatch.matchId
|
|
323
|
-
}, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
|
|
324
|
-
catchElement: catchElement
|
|
325
|
-
}, element));
|
|
312
|
+
console.log(match.matchId, 'suspend');
|
|
313
|
+
throw match.__.loadPromise;
|
|
314
|
+
})())));
|
|
326
315
|
}
|
|
327
316
|
|
|
328
317
|
class CatchBoundary extends React__namespace.Component {
|
|
@@ -331,13 +320,6 @@ class CatchBoundary extends React__namespace.Component {
|
|
|
331
320
|
this.state = {
|
|
332
321
|
error: false
|
|
333
322
|
};
|
|
334
|
-
|
|
335
|
-
this.reset = () => {
|
|
336
|
-
this.setState({
|
|
337
|
-
error: false,
|
|
338
|
-
info: false
|
|
339
|
-
});
|
|
340
|
-
};
|
|
341
323
|
}
|
|
342
324
|
|
|
343
325
|
componentDidCatch(error, info) {
|
|
@@ -349,12 +331,12 @@ class CatchBoundary extends React__namespace.Component {
|
|
|
349
331
|
}
|
|
350
332
|
|
|
351
333
|
render() {
|
|
352
|
-
var _this$props$
|
|
334
|
+
var _this$props$errorComp;
|
|
353
335
|
|
|
354
|
-
const
|
|
336
|
+
const errorComponent = (_this$props$errorComp = this.props.errorComponent) != null ? _this$props$errorComp : DefaultErrorBoundary;
|
|
355
337
|
|
|
356
338
|
if (this.state.error) {
|
|
357
|
-
return
|
|
339
|
+
return /*#__PURE__*/React__namespace.createElement(errorComponent, this.state);
|
|
358
340
|
}
|
|
359
341
|
|
|
360
342
|
return this.props.children;
|
|
@@ -362,10 +344,10 @@ class CatchBoundary extends React__namespace.Component {
|
|
|
362
344
|
|
|
363
345
|
}
|
|
364
346
|
|
|
365
|
-
function DefaultErrorBoundary(
|
|
347
|
+
function DefaultErrorBoundary(_ref6) {
|
|
366
348
|
let {
|
|
367
349
|
error
|
|
368
|
-
} =
|
|
350
|
+
} = _ref6;
|
|
369
351
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
370
352
|
style: {
|
|
371
353
|
padding: '.5rem',
|
|
@@ -387,18 +369,7 @@ function DefaultErrorBoundary(_ref5) {
|
|
|
387
369
|
padding: '.5rem',
|
|
388
370
|
color: 'red'
|
|
389
371
|
}
|
|
390
|
-
}, error.message) : null))
|
|
391
|
-
style: {
|
|
392
|
-
height: '1rem'
|
|
393
|
-
}
|
|
394
|
-
}), /*#__PURE__*/React__namespace.createElement("div", {
|
|
395
|
-
style: {
|
|
396
|
-
fontSize: '.8em',
|
|
397
|
-
borderLeft: '3px solid rgba(127, 127, 127, 1)',
|
|
398
|
-
paddingLeft: '.5rem',
|
|
399
|
-
opacity: 0.5
|
|
400
|
-
}
|
|
401
|
-
}, "If you are the owner of this website, it's highly recommended that you configure your own custom Catch/Error boundaries for the router. You can optionally configure a boundary for each route."));
|
|
372
|
+
}, error.message) : null)));
|
|
402
373
|
}
|
|
403
374
|
function usePrompt(message, when) {
|
|
404
375
|
const router = useRouter();
|
|
@@ -415,17 +386,16 @@ function usePrompt(message, when) {
|
|
|
415
386
|
return unblock;
|
|
416
387
|
}, [when, location, message]);
|
|
417
388
|
}
|
|
418
|
-
function Prompt(
|
|
389
|
+
function Prompt(_ref7) {
|
|
419
390
|
let {
|
|
420
391
|
message,
|
|
421
392
|
when,
|
|
422
393
|
children
|
|
423
|
-
} =
|
|
394
|
+
} = _ref7;
|
|
424
395
|
usePrompt(message, when != null ? when : true);
|
|
425
396
|
return children != null ? children : null;
|
|
426
397
|
}
|
|
427
398
|
|
|
428
|
-
exports.cascadeLoaderData = index.cascadeLoaderData;
|
|
429
399
|
exports.cleanPath = index.cleanPath;
|
|
430
400
|
exports.createBrowserHistory = index.createBrowserHistory;
|
|
431
401
|
exports.createHashHistory = index.createHashHistory;
|
|
@@ -447,6 +417,7 @@ exports.matchByPath = index.matchByPath;
|
|
|
447
417
|
exports.matchPathname = index.matchPathname;
|
|
448
418
|
exports.parsePathname = index.parsePathname;
|
|
449
419
|
exports.parseSearchWith = index.parseSearchWith;
|
|
420
|
+
exports.pick = index.pick;
|
|
450
421
|
exports.replaceEqualDeep = index.replaceEqualDeep;
|
|
451
422
|
exports.resolvePath = index.resolvePath;
|
|
452
423
|
exports.rootRouteId = index.rootRouteId;
|
|
@@ -456,10 +427,17 @@ exports.trimPathLeft = index.trimPathLeft;
|
|
|
456
427
|
exports.trimPathRight = index.trimPathRight;
|
|
457
428
|
exports.warning = index.warning;
|
|
458
429
|
exports.DefaultErrorBoundary = DefaultErrorBoundary;
|
|
430
|
+
exports.Link = Link;
|
|
459
431
|
exports.MatchesProvider = MatchesProvider;
|
|
460
432
|
exports.Outlet = Outlet;
|
|
461
433
|
exports.Prompt = Prompt;
|
|
462
434
|
exports.RouterProvider = RouterProvider;
|
|
463
435
|
exports.createReactRouter = createReactRouter;
|
|
436
|
+
exports.lazy = lazy;
|
|
437
|
+
exports.matchesContext = matchesContext;
|
|
438
|
+
exports.routerContext = routerContext;
|
|
439
|
+
exports.useMatch = useMatch;
|
|
440
|
+
exports.useMatches = useMatches;
|
|
464
441
|
exports.usePrompt = usePrompt;
|
|
442
|
+
exports.useRouter = useRouter;
|
|
465
443
|
//# sourceMappingURL=index.js.map
|
|
@@ -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: <TId extends keyof TAllRouteInfo['routeInfoById']>(\n routeId: TId,\n ) => RouteMatch<TAllRouteInfo, TAllRouteInfo['routeInfoById'][TId]>\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 ) => 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) => {\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 = useMatch()\n const match = router.state.matches.find((d) => d.routeId === routeId)\n\n invariant(\n match,\n `Could not find a match for route \"${\n routeId as string\n }\" being rendered in this component!`,\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 'useRoute(${\n match?.routeId as string\n })' instead?`,\n )\n\n if (!match) {\n invariant('Match not found!')\n }\n\n return match\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\n useLayoutEffect(() => {\n return router.mount()\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\nfunction 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\nfunction useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\n// function useParentMatches(): RouteMatch[] {\n// const router = useRouter()\n// const match = useMatch()\n// const matches = router.state.matches\n// return matches.slice(\n// 0,\n// matches.findIndex((d) => d.matchId === match.matchId) - 1,\n// )\n// }\n\nfunction useMatch<T>(): RouteMatch {\n return useMatches()?.[0] as RouteMatch\n}\n\nexport function Outlet() {\n const router = useRouter()\n const [, ...matches] = useMatches()\n\n const childMatch = matches[0]\n\n if (!childMatch) return null\n\n const element = ((): React.ReactNode => {\n if (!childMatch) {\n return null\n }\n\n const errorElement =\n childMatch.__.errorElement ?? router.options.defaultErrorElement\n\n if (childMatch.status === 'error') {\n if (errorElement) {\n return errorElement as any\n }\n\n if (\n childMatch.options.useErrorBoundary ||\n router.options.useErrorBoundary\n ) {\n throw childMatch.error\n }\n\n return <DefaultErrorBoundary error={childMatch.error} />\n }\n\n if (childMatch.status === 'loading' || childMatch.status === 'idle') {\n if (childMatch.isPending) {\n const pendingElement =\n childMatch.__.pendingElement ?? router.options.defaultPendingElement\n\n if (childMatch.options.pendingMs || pendingElement) {\n return (pendingElement as any) ?? null\n }\n }\n\n return null\n }\n\n return (childMatch.__.element as any) ?? router.options.defaultElement\n })() as JSX.Element\n\n const catchElement =\n childMatch?.options.catchElement ?? router.options.defaultCatchElement\n\n return (\n <MatchesProvider value={matches} key={childMatch.matchId}>\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 reset = () => {\n this.setState({\n error: false,\n info: false,\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","match","matches","find","d","routeExt","Object","assign","createRoute","element","res","default","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","Outlet","childMatch","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","matchId","CatchBoundary","Component","reset","setState","info","componentDidCatch","console","render","DefaultErrorBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity","usePrompt","when","unblock","history","block","transition","confirm","retry","location","pathname","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0JA;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;AAC3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AAA,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 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 Router,\n} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\nexport interface RegisterRouter {\n // router: Router\n}\n\nexport type ResolvedRouter = RegisterRouter extends {\n router: Router<infer TRouteConfig, infer TAllRouteInfo>\n}\n ? Router<TRouteConfig, TAllRouteInfo>\n : Router\n\nexport type ResolvedAllRouteInfo = RegisterRouter extends {\n router: Router<infer TRouteConfig, infer TAllRouteInfo>\n}\n ? TAllRouteInfo\n : AnyAllRouteInfo\n\nexport type SyncRouteComponent = (props?: {}) => JSX.Element | React.ReactNode\n\nexport type RouteComponent = SyncRouteComponent & {\n preload?: () => Promise<SyncRouteComponent>\n}\n\nexport function lazy(\n importer: () => Promise<{ default: SyncRouteComponent }>,\n): RouteComponent {\n const lazyComp = React.lazy(importer as any)\n let promise: Promise<SyncRouteComponent>\n let resolvedComp: SyncRouteComponent\n\n const forwardedComp = React.forwardRef((props, ref) => {\n const resolvedCompRef = React.useRef(resolvedComp || lazyComp)\n return React.createElement(\n resolvedCompRef.current as any,\n { ...(ref ? { ref } : {}), ...props } as any,\n )\n })\n\n const finalComp = forwardedComp as unknown as RouteComponent\n\n finalComp.preload = () => {\n if (!promise) {\n promise = importer().then((module) => {\n resolvedComp = module.default\n return resolvedComp\n })\n }\n\n return promise\n }\n\n return finalComp\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\nexport function Link<TTo extends string = '.'>(\n props: LinkPropsOptions<ResolvedAllRouteInfo, '/', TTo> &\n React.AnchorHTMLAttributes<HTMLAnchorElement> &\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, 'children'> & {\n children?:\n | React.ReactNode\n | ((state: { isActive: boolean }) => React.ReactNode)\n },\n): JSX.Element {\n const router = useRouter()\n return <router.Link {...(props as any)} />\n}\n\nexport const matchesContext = React.createContext<RouteMatch[]>(null!)\nexport const routerContext = React.createContext<{ router: ResolvedRouter }>(\n null!,\n)\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 React.useEffect(() => {\n console.log('hello')\n return router.mount()\n }, [router])\n\n return (\n <routerContext.Provider value={{ router: router as any }}>\n <MatchesProvider value={router.state.matches}>\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): ResolvedRouter {\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\n}\n\nexport function useMatches(): RouteMatch[] {\n return React.useContext(matchesContext)\n}\n\nexport function useMatch<\n TId extends keyof ResolvedAllRouteInfo['routeInfoById'],\n TStrict extends true | false = true,\n>(\n routeId: TId,\n opts?: { strict?: TStrict },\n): TStrict extends true\n ? RouteMatch<ResolvedAllRouteInfo, ResolvedAllRouteInfo['routeInfoById'][TId]>\n :\n | RouteMatch<\n ResolvedAllRouteInfo,\n ResolvedAllRouteInfo['routeInfoById'][TId]\n >\n | undefined {\n const router = useRouter()\n return router.useMatch(routeId as any, opts) as any\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 console.log(match.matchId, 'suspend')\n throw match.__.loadPromise\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":["lazy","importer","lazyComp","React","promise","resolvedComp","forwardedComp","forwardRef","props","ref","resolvedCompRef","useRef","createElement","current","finalComp","preload","then","module","default","Link","router","useRouter","matchesContext","createContext","routerContext","MatchesProvider","useRouterSubscription","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","Boolean","join","role","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","document","RouterProvider","_objectWithoutPropertiesLoose","update","useEffect","console","log","mount","value","useContext","warning","Outlet","slice","defaultPending","useCallback","PendingComponent","__","pendingComponent","defaultPendingComponent","errorComponent","defaultErrorComponent","status","error","defaultComponent","matchId","loadPromise","CatchBoundary","Component","componentDidCatch","info","setState","render","DefaultErrorBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","usePrompt","when","unblock","history","block","transition","window","confirm","retry","location","pathname","Prompt"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DO,SAASA,IAAT,CACLC,QADK,EAEW;AAChB,EAAA,MAAMC,QAAQ,gBAAGC,gBAAK,CAACH,IAAN,CAAWC,QAAX,CAAjB,CAAA;AACA,EAAA,IAAIG,OAAJ,CAAA;AACA,EAAA,IAAIC,YAAJ,CAAA;EAEA,MAAMC,aAAa,gBAAGH,gBAAK,CAACI,UAAN,CAAiB,CAACC,KAAD,EAAQC,GAAR,KAAgB;IACrD,MAAMC,eAAe,GAAGP,gBAAK,CAACQ,MAAN,CAAaN,YAAY,IAAIH,QAA7B,CAAxB,CAAA;IACA,oBAAOC,gBAAK,CAACS,aAAN,CACLF,eAAe,CAACG,OADX,EAECJ,oCAAAA,CAAAA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