@tanstack/react-router 0.0.1-beta.12 → 0.0.1-beta.14

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.
@@ -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;
@@ -43,9 +44,6 @@ const _excluded = ["type", "children", "target", "activeProps", "inactiveProps",
43
44
  //
44
45
  const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
45
46
  const routerContext = /*#__PURE__*/React__namespace.createContext(null); // Detect if we're in the DOM
46
-
47
- const isDOM = Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
48
- const useLayoutEffect = isDOM ? React__namespace.useLayoutEffect : React__namespace.useEffect;
49
47
  function MatchesProvider(props) {
50
48
  return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, props);
51
49
  }
@@ -65,7 +63,7 @@ function createReactRouter(opts) {
65
63
  const resolvedRouteId = router.resolvePath(route.routeId, subRouteId);
66
64
  const resolvedRoute = router.getRoute(resolvedRouteId);
67
65
  useRouterSubscription(router);
68
- index.invariant(resolvedRoute, "Could not find a route for route \"" + resolvedRouteId + "\"! Did you forget to add it to your route config?");
66
+ index$1.invariant(resolvedRoute, "Could not find a route for route \"" + resolvedRouteId + "\"! Did you forget to add it to your route config?");
69
67
  return resolvedRoute;
70
68
  },
71
69
  linkProps: options => {
@@ -109,6 +107,12 @@ function createReactRouter(opts) {
109
107
  next
110
108
  } = linkInfo;
111
109
 
110
+ const reactHandleClick = e => {
111
+ React__namespace.startTransition(() => {
112
+ handleClick(e);
113
+ });
114
+ };
115
+
112
116
  const composeHandlers = handlers => e => {
113
117
  e.persist();
114
118
  handlers.forEach(handler => {
@@ -117,12 +121,12 @@ function createReactRouter(opts) {
117
121
  }; // Get the active props
118
122
 
119
123
 
120
- const resolvedActiveProps = isActive ? (_functionalUpdate = index.functionalUpdate(activeProps, {})) != null ? _functionalUpdate : {} : {}; // Get the inactive props
124
+ const resolvedActiveProps = isActive ? (_functionalUpdate = index$1.functionalUpdate(activeProps, {})) != null ? _functionalUpdate : {} : {}; // Get the inactive props
121
125
 
122
- const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = index.functionalUpdate(inactiveProps, {})) != null ? _functionalUpdate2 : {};
126
+ const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = index$1.functionalUpdate(inactiveProps, {})) != null ? _functionalUpdate2 : {};
123
127
  return _rollupPluginBabelHelpers["extends"]({}, resolvedActiveProps, resolvedInactiveProps, rest, {
124
128
  href: disabled ? undefined : next.href,
125
- onClick: composeHandlers([handleClick, onClick]),
129
+ onClick: composeHandlers([reactHandleClick, onClick]),
126
130
  onFocus: composeHandlers([handleFocus, onFocus]),
127
131
  onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
128
132
  onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
@@ -168,7 +172,7 @@ function createReactRouter(opts) {
168
172
  };
169
173
  };
170
174
 
171
- const coreRouter = index.createRouter(_rollupPluginBabelHelpers["extends"]({}, opts, {
175
+ const coreRouter = index$1.createRouter(_rollupPluginBabelHelpers["extends"]({}, opts, {
172
176
  createRouter: router => {
173
177
  const routerExt = {
174
178
  useState: () => {
@@ -179,13 +183,13 @@ function createReactRouter(opts) {
179
183
  var _useMatches, _opts$strict;
180
184
 
181
185
  useRouterSubscription(router);
182
- index.invariant(routeId !== index.rootRouteId, "\"" + index.rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + index.rootRouteId + "\")?");
186
+ index$1.invariant(routeId !== index$1.rootRouteId, "\"" + index$1.rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + index$1.rootRouteId + "\")?");
183
187
  const runtimeMatch = (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
184
188
  const match = router.state.matches.find(d => d.routeId === routeId);
185
189
 
186
190
  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?");
191
+ index$1.invariant(match, "Could not find an active match for \"" + routeId + "\"!");
192
+ 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
193
  }
190
194
 
191
195
  return match;
@@ -202,18 +206,12 @@ function createReactRouter(opts) {
202
206
  const routeExt = makeRouteExt(route, router);
203
207
  Object.assign(route, routeExt);
204
208
  },
205
- createElement: async element => {
206
- if (typeof element === 'function') {
207
- const res = await element(); // Support direct import() calls
208
-
209
- if (typeof res === 'object' && res.default) {
210
- return /*#__PURE__*/React__namespace.createElement(res.default);
211
- } else {
212
- return res;
213
- }
209
+ loadComponent: async component => {
210
+ if (component.preload && typeof document !== 'undefined') {
211
+ component.preload(); // return await component.preload()
214
212
  }
215
213
 
216
- return element;
214
+ return component;
217
215
  }
218
216
  }));
219
217
  return coreRouter;
@@ -227,10 +225,8 @@ function RouterProvider(_ref2) {
227
225
 
228
226
  router.update(rest);
229
227
  useRouterSubscription(router);
230
- useLayoutEffect(() => {
231
- const unsub = router.mount();
232
- router.load();
233
- return unsub;
228
+ React__namespace.useEffect(() => {
229
+ return router.mount();
234
230
  }, [router]);
235
231
  return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
236
232
  value: {
@@ -242,7 +238,7 @@ function RouterProvider(_ref2) {
242
238
  }
243
239
  function useRouter() {
244
240
  const value = React__namespace.useContext(routerContext);
245
- index.warning(!value, 'useRouter must be used inside a <Router> component!');
241
+ index$1.warning(!value, 'useRouter must be used inside a <Router> component!');
246
242
  useRouterSubscription(value.router);
247
243
  return value.router;
248
244
  }
@@ -250,64 +246,43 @@ function useMatches() {
250
246
  return React__namespace.useContext(matchesContext);
251
247
  }
252
248
  function Outlet() {
253
- var _match$options$catchE;
249
+ var _ref3, _match$__$pendingComp, _match$__$errorCompon;
254
250
 
255
251
  const router = useRouter();
256
252
  const matches = useMatches().slice(1);
257
253
  const match = matches[0];
254
+ const defaultPending = React__namespace.useCallback(() => null, []);
258
255
 
259
256
  if (!match) {
260
257
  return null;
261
258
  }
262
259
 
263
- const element = (() => {
264
- var _match$__$errorElemen, _ref4, _ref5;
265
-
266
- if (!match) {
267
- return null;
268
- }
269
-
270
- const errorElement = (_match$__$errorElemen = match.__.errorElement) != null ? _match$__$errorElemen : router.options.defaultErrorElement;
271
-
260
+ const PendingComponent = (_ref3 = (_match$__$pendingComp = match.__.pendingComponent) != null ? _match$__$pendingComp : router.options.defaultPendingComponent) != null ? _ref3 : defaultPending;
261
+ const errorComponent = (_match$__$errorCompon = match.__.errorComponent) != null ? _match$__$errorCompon : router.options.defaultErrorComponent;
262
+ return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
263
+ value: matches
264
+ }, /*#__PURE__*/React__namespace.createElement(React__namespace.Suspense, {
265
+ fallback: /*#__PURE__*/React__namespace.createElement(PendingComponent, null)
266
+ }, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
267
+ errorComponent: errorComponent
268
+ }, (() => {
272
269
  if (match.status === 'error') {
273
- if (errorElement) {
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
- });
270
+ throw match.error;
284
271
  }
285
272
 
286
- if (match.status === 'loading' || match.status === 'idle') {
287
- if (match.isPending) {
288
- var _match$__$pendingElem;
289
-
290
- const pendingElement = (_match$__$pendingElem = match.__.pendingElement) != null ? _match$__$pendingElem : router.options.defaultPendingElement;
291
-
292
- if (match.options.pendingMs || pendingElement) {
293
- var _ref3;
294
-
295
- return (_ref3 = pendingElement) != null ? _ref3 : null;
296
- }
297
- }
273
+ if (match.status === 'success') {
274
+ var _ref4, _ref5;
298
275
 
299
- return null;
276
+ return /*#__PURE__*/React__namespace.createElement((_ref4 = (_ref5 = match.__.component) != null ? _ref5 : router.options.defaultComponent) != null ? _ref4 : Outlet);
300
277
  }
301
278
 
302
- return (_ref4 = (_ref5 = match.__.element) != null ? _ref5 : router.options.defaultElement) != null ? _ref4 : /*#__PURE__*/React__namespace.createElement(Outlet, null);
303
- })();
279
+ if (match.__.loadPromise) {
280
+ console.log(match.matchId, 'suspend');
281
+ throw match.__.loadPromise;
282
+ }
304
283
 
305
- const catchElement = (_match$options$catchE = match == null ? void 0 : match.options.catchElement) != null ? _match$options$catchE : router.options.defaultCatchElement;
306
- return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
307
- value: matches
308
- }, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
309
- catchElement: catchElement
310
- }, element));
284
+ index$1.invariant(false, 'This should never happen!');
285
+ })())));
311
286
  }
312
287
 
313
288
  class CatchBoundary extends React__namespace.Component {
@@ -327,12 +302,12 @@ class CatchBoundary extends React__namespace.Component {
327
302
  }
328
303
 
329
304
  render() {
330
- var _this$props$catchElem;
305
+ var _this$props$errorComp;
331
306
 
332
- const catchElement = (_this$props$catchElem = this.props.catchElement) != null ? _this$props$catchElem : DefaultErrorBoundary;
307
+ const errorComponent = (_this$props$errorComp = this.props.errorComponent) != null ? _this$props$errorComp : DefaultErrorBoundary;
333
308
 
334
309
  if (this.state.error) {
335
- return typeof catchElement === 'function' ? catchElement(this.state) : catchElement;
310
+ return /*#__PURE__*/React__namespace.createElement(errorComponent, this.state);
336
311
  }
337
312
 
338
313
  return this.props.children;
@@ -392,36 +367,40 @@ function Prompt(_ref7) {
392
367
  return children != null ? children : null;
393
368
  }
394
369
 
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;
370
+ exports.cleanPath = index$1.cleanPath;
371
+ exports.createBrowserHistory = index$1.createBrowserHistory;
372
+ exports.createHashHistory = index$1.createHashHistory;
373
+ exports.createMemoryHistory = index$1.createMemoryHistory;
374
+ exports.createRoute = index$1.createRoute;
375
+ exports.createRouteConfig = index$1.createRouteConfig;
376
+ exports.createRouteMatch = index$1.createRouteMatch;
377
+ exports.createRouter = index$1.createRouter;
378
+ exports.decode = index$1.decode;
379
+ exports.defaultParseSearch = index$1.defaultParseSearch;
380
+ exports.defaultStringifySearch = index$1.defaultStringifySearch;
381
+ exports.encode = index$1.encode;
382
+ exports.functionalUpdate = index$1.functionalUpdate;
383
+ exports.interpolatePath = index$1.interpolatePath;
384
+ exports.invariant = index$1.invariant;
385
+ exports.joinPaths = index$1.joinPaths;
386
+ exports.last = index$1.last;
387
+ exports.matchByPath = index$1.matchByPath;
388
+ exports.matchPathname = index$1.matchPathname;
389
+ exports.parsePathname = index$1.parsePathname;
390
+ exports.parseSearchWith = index$1.parseSearchWith;
391
+ exports.pick = index$1.pick;
392
+ exports.replaceEqualDeep = index$1.replaceEqualDeep;
393
+ exports.resolvePath = index$1.resolvePath;
394
+ exports.rootRouteId = index$1.rootRouteId;
395
+ exports.stringifySearchWith = index$1.stringifySearchWith;
396
+ exports.trimPath = index$1.trimPath;
397
+ exports.trimPathLeft = index$1.trimPathLeft;
398
+ exports.trimPathRight = index$1.trimPathRight;
399
+ exports.warning = index$1.warning;
400
+ Object.defineProperty(exports, 'lazy', {
401
+ enumerable: true,
402
+ get: function () { return index.lazyWithPreload; }
403
+ });
425
404
  exports.DefaultErrorBoundary = DefaultErrorBoundary;
426
405
  exports.MatchesProvider = MatchesProvider;
427
406
  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,KAA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F,CADF,CAAA;AAoCD,CAAA;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 React.useEffect(() => {\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\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","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","Boolean","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","document","RouterProvider","_objectWithoutPropertiesLoose","update","useEffect","mount","useRouter","value","useContext","warning","Outlet","slice","defaultPending","useCallback","PendingComponent","__","pendingComponent","defaultPendingComponent","errorComponent","defaultErrorComponent","status","error","createElement","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","window","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;AAgBO,SAASE,eAAT,CAAyBC,KAAzB,EAAsD;AAC3D,EAAA,oBAAOJ,+BAAC,cAAD,CAAgB,QAAhB,EAA6BI,KAA7B,CAAP,CAAA;AACD,CAAA;;AAED,MAAMC,qBAAqB,GAAIC,MAAD,IAA8B;EAC1DC,yBAAoB,CACjBC,EAAD,IAAQF,MAAM,CAACG,SAAP,CAAiB,MAAMD,EAAE,EAAzB,CADU,EAElB,MAAMF,MAAM,CAACI,KAFK,EAGlB,MAAMJ,MAAM,CAACI,KAHK,CAApB,CAAA;AAKD,CAND,CAAA;;AAQO,SAASC,iBAAT,CAELC,IAFK,EAEoD;AACzD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