@tanstack/react-router 0.0.1-alpha.0

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.
@@ -0,0 +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 warning,\n RouterInstance,\n RouterOptions,\n RouteMatch,\n RouteParams,\n NavigateOptions,\n MatchLocation,\n MatchRouteOptions,\n LinkOptions,\n} from '@tanstack/location-core'\n\nexport * from '@tanstack/location-core'\n\ndeclare module '@tanstack/location-core' {\n interface FrameworkGenerics<TData = unknown> {\n Element: React.ReactNode\n AsyncElement: (opts: {\n params: Record<string, string>\n }) => Promise<React.ReactNode>\n SyncOrAsyncElement:\n | React.ReactNode\n | FrameworkGenerics<TData>['AsyncElement']\n LinkProps: React.HTMLAttributes<unknown>\n }\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<unknown>[]>(null!)\nconst routerContext = React.createContext<{ router: RouterInstance }>(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<unknown>[]\n children: React.ReactNode\n}\n\nexport function MatchesProvider(props: MatchesProviderProps) {\n return <matchesContext.Provider {...props} />\n}\n\nexport type RouterProps = RouterOptions & {\n // Children will default to `<Outlet />` if not provided\n children?: React.ReactNode\n}\n\nexport function Router({ children, ...rest }: RouterProps) {\n const [router] = React.useState(() => {\n return new RouterInstance(rest)\n })\n\n router.update(rest)\n\n useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n\n useLayoutEffect(() => {\n router.mount()\n }, [])\n\n return (\n <routerContext.Provider value={{ router }}>\n <MatchesProvider\n value={[\n router.rootMatch as RouteMatch<unknown>,\n ...router.state.matches,\n ]}\n >\n {children ?? <Outlet />}\n </MatchesProvider>\n </routerContext.Provider>\n )\n}\n\nexport function useRouter(): RouterInstance {\n const value = React.useContext(routerContext)\n warning(value, 'useRouter must be used inside a <Router> component!')\n\n useSyncExternalStore(\n (cb) => value.router.subscribe(() => cb()),\n () => value.router.state,\n )\n\n return value.router as RouterInstance\n}\n\nfunction useLatestCallback<TCallback extends (...args: any[]) => any>(\n cb: TCallback,\n) {\n const cbRef = React.useRef<TCallback>(cb)\n cbRef.current = cb\n return React.useCallback(\n (...args: Parameters<TCallback>): ReturnType<TCallback> =>\n cbRef.current(...args),\n [],\n )\n}\n\nexport function useMatches(): RouteMatch<unknown>[] {\n return React.useContext(matchesContext)\n}\n\nexport function useParentMatches(): RouteMatch<unknown>[] {\n const router = useRouter()\n const match = useMatch()\n const matches = router.state.matches\n return matches.slice(0, matches.findIndex((d) => d.id === match.id) - 1)\n}\n\nexport function useMatch<T>(): RouteMatch<T> {\n return useMatches()?.[0] as RouteMatch<T>\n}\n\nexport function useLoaderData() {\n const router = useRouter()\n return router.state.loaderData\n}\n\nexport function useAction<\n TPayload = unknown,\n TResponse = unknown,\n TError = unknown,\n>(opts?: Pick<NavigateOptions, 'to' | 'from'>) {\n const match = useMatch()\n const router = useRouter()\n return router.getAction<TPayload, TResponse, TError>(\n { from: match.pathname, to: '.', ...opts },\n { isActive: !opts?.to },\n )\n}\n\nexport function useMatchRoute() {\n const router = useRouter()\n const match = useMatch()\n\n return useLatestCallback(\n (matchLocation: MatchLocation, opts?: MatchRouteOptions) => {\n return router.matchRoute(\n {\n ...matchLocation,\n from: match.pathname,\n },\n opts,\n )\n },\n )\n}\n\nexport type MatchRouteProps = MatchLocation &\n MatchRouteOptions & {\n children: React.ReactNode | ((routeParams?: RouteParams) => React.ReactNode)\n }\n\nexport function MatchRoute({\n children,\n pending,\n caseSensitive,\n ...rest\n}: MatchRouteProps): JSX.Element {\n const matchRoute = useMatchRoute()\n const match = matchRoute(rest, { pending, caseSensitive })\n\n if (typeof children === 'function') {\n return children(match as any) as JSX.Element\n }\n\n return (match ? children : null) as JSX.Element\n}\n\nexport function useLoadRoute() {\n const match = useMatch()\n const router = useRouter()\n\n return useLatestCallback(\n async (navigateOpts: NavigateOptions, loaderOpts: { maxAge: number }) =>\n router.loadRoute({ ...navigateOpts, from: match.pathname }, loaderOpts),\n )\n}\n\nexport function useInvalidateRoute() {\n const match = useMatch()\n const router = useRouter()\n\n return useLatestCallback(async (navigateOpts: MatchLocation = { to: '.' }) =>\n router.invalidateRoute({ ...navigateOpts, from: match.pathname }),\n )\n}\n\nexport function useNavigate() {\n const router = useRouter()\n const match = useMatch()\n\n return useLatestCallback((options: NavigateOptions) =>\n router.navigate({ ...options, from: match.pathname }),\n )\n}\n\nexport function Navigate(options: NavigateOptions) {\n let navigate = useNavigate()\n\n useLayoutEffect(() => {\n navigate(options)\n }, [navigate])\n\n return null\n}\n\nexport function Outlet() {\n const router = useRouter()\n const [_, ...matches] = useMatches()\n\n if (!matches.length) return null\n\n let element = router.getOutletElement(matches) ?? <Outlet />\n return <MatchesProvider value={matches}>{element}</MatchesProvider>\n}\n\nexport function useResolvePath() {\n const router = useRouter()\n const match = useMatch()\n return useLatestCallback((path: string) =>\n router.resolvePath(match.pathname, path),\n )\n}\n\nexport function useSearch() {\n const router = useRouter()\n return router.location.search\n}\n\nexport type LinkProps = LinkOptions &\n Omit<\n React.AnchorHTMLAttributes<HTMLAnchorElement>,\n 'href' | 'children' | keyof LinkOptions\n > & {\n // A custom ref prop because of this: https://stackoverflow.com/questions/58469229/react-with-typescript-generics-while-using-react-forwardref/58473012\n _ref?: React.Ref<HTMLAnchorElement>\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\nexport function useLink(opts: LinkOptions) {\n const router = useRouter()\n const match = useMatch()\n const ref = React.useRef({}).current\n return router.buildLinkInfo({ ...opts, from: match.pathname, ref })\n}\n\nexport function Link(props: LinkProps) {\n const linkUtils = useLink(props)\n\n const {\n to,\n children,\n _ref,\n disabled,\n target,\n search,\n hash,\n replace,\n getActiveProps,\n getInactiveProps,\n activeOptions,\n preload,\n preloadMaxAge,\n style,\n className,\n onClick,\n onFocus,\n onMouseEnter,\n onMouseLeave,\n onTouchStart,\n onTouchEnd,\n ...rest\n } = props\n\n if (!linkUtils) {\n return (\n <a href={to as string} {...rest}>\n {typeof children === 'function'\n ? children({ isActive: false })\n : children}\n </a>\n )\n }\n\n const {\n next,\n activeProps,\n handleFocus,\n handleClick,\n handleEnter,\n handleLeave,\n inactiveProps,\n isActive,\n } = linkUtils\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 return (\n <a\n {...{\n ...activeProps,\n ...inactiveProps,\n ...rest,\n ref: _ref,\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 ...activeProps.style,\n ...inactiveProps.style,\n },\n className:\n [className, activeProps.className, inactiveProps.className]\n .filter(Boolean)\n .join(' ') || undefined,\n ...(disabled\n ? {\n role: 'link',\n 'aria-disabled': true,\n }\n : undefined),\n children:\n typeof children === 'function' ? children({ isActive }) : children,\n }}\n />\n )\n}\n"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","Router","children","rest","_objectWithoutPropertiesLoose","router","useState","RouterInstance","update","useSyncExternalStore","cb","subscribe","state","mount","rootMatch","matches","useRouter","value","useContext","warning","useLatestCallback","cbRef","useRef","current","useCallback","useMatches","useParentMatches","match","useMatch","slice","findIndex","d","id","useLoaderData","loaderData","useAction","opts","getAction","_extends","from","pathname","to","isActive","useMatchRoute","matchLocation","matchRoute","MatchRoute","pending","caseSensitive","useLoadRoute","navigateOpts","loaderOpts","loadRoute","useInvalidateRoute","invalidateRoute","useNavigate","options","navigate","Navigate","Outlet","_","length","element","getOutletElement","useResolvePath","path","resolvePath","useSearch","location","search","useLink","ref","buildLinkInfo","Link","linkUtils","_ref","disabled","target","style","className","onClick","onFocus","onMouseEnter","onMouseLeave","next","activeProps","handleFocus","handleClick","handleEnter","handleLeave","inactiveProps","composeHandlers","handlers","e","persist","forEach","handler","href","undefined","filter","join","role"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAA2C,IAA3C,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAgD,IAAhD,CAAtB;;AAGA,MAAME,KAAK,GAAGC,OAAO,CACnB,OAAOC,MAAP,KAAkB,WAAlB,IACEA,MAAM,CAACC,QADT,IAEED,MAAM,CAACC,QAAP,CAAgBC,aAHC,CAArB,CAAA;AAMA,MAAMC,eAAe,GAAGL,KAAK,GAAGH,gBAAK,CAACQ,eAAT,GAA2BR,gBAAK,CAACS,SAA9D,CAAA;AAOO,SAASC,eAAT,CAAyBC,KAAzB,EAAsD;AAC3D,EAAA,oBAAOX,+BAAC,cAAD,CAAgB,QAAhB,EAA6BW,KAA7B,CAAP,CAAA;AACD,CAAA;AAOM,SAASC,MAAT,CAAoD,KAAA,EAAA;EAAA,IAApC;AAAEC,IAAAA,QAAAA;GAAkC,GAAA,KAAA;AAAA,MAArBC,IAAqB,GAAAC,sDAAA,CAAA,KAAA,EAAA,SAAA,CAAA,CAAA;;AACzD,EAAA,MAAM,CAACC,MAAD,CAAA,GAAWhB,gBAAK,CAACiB,QAAN,CAAe,MAAM;AACpC,IA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1,413 @@
1
+ /**
2
+ * react-router
3
+ *
4
+ * Copyright (c) TanStack
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE.md file in the root directory of this source tree.
8
+ *
9
+ * @license MIT
10
+ */
11
+ 'use strict';
12
+
13
+ Object.defineProperty(exports, '__esModule', { value: true });
14
+
15
+ var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
16
+ var React = require('react');
17
+ var shim = require('use-sync-external-store/shim');
18
+ var index = require('../../router-core/build/esm/index.js');
19
+
20
+ function _interopNamespace(e) {
21
+ if (e && e.__esModule) return e;
22
+ var n = Object.create(null);
23
+ if (e) {
24
+ Object.keys(e).forEach(function (k) {
25
+ if (k !== 'default') {
26
+ var d = Object.getOwnPropertyDescriptor(e, k);
27
+ Object.defineProperty(n, k, d.get ? d : {
28
+ enumerable: true,
29
+ get: function () { return e[k]; }
30
+ });
31
+ }
32
+ });
33
+ }
34
+ n["default"] = e;
35
+ return Object.freeze(n);
36
+ }
37
+
38
+ var React__namespace = /*#__PURE__*/_interopNamespace(React);
39
+
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
+ _excluded2 = ["pending", "caseSensitive", "children"],
42
+ _excluded3 = ["children", "router"];
43
+ //
44
+ const matchesContext = /*#__PURE__*/React__namespace.createContext(null);
45
+ 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
+ function MatchesProvider(props) {
50
+ return /*#__PURE__*/React__namespace.createElement(matchesContext.Provider, props);
51
+ }
52
+
53
+ const useRouterSubscription = router => {
54
+ shim.useSyncExternalStore(cb => router.subscribe(() => cb()), () => router.state);
55
+ };
56
+
57
+ function createReactRouter(opts) {
58
+ const coreRouter = index.createRouter(_rollupPluginBabelHelpers["extends"]({}, opts, {
59
+ createRouter: router => {
60
+ const routerExt = {
61
+ useRoute: routeId => {
62
+ const route = router.getRoute(routeId);
63
+ useRouterSubscription(router);
64
+
65
+ if (!route) {
66
+ throw new Error("Could not find a route for route \"" + routeId + "\"! Did you forget to add it to your route config?");
67
+ }
68
+
69
+ return route;
70
+ },
71
+ useMatch: routeId => {
72
+ if (routeId === index.rootRouteId) {
73
+ throw new Error("\"" + index.rootRouteId + "\" cannot be used with useMatch! Did you mean to useRoute(\"" + index.rootRouteId + "\")?");
74
+ }
75
+
76
+ const runtimeMatch = _useMatch();
77
+
78
+ const match = router.state.matches.find(d => d.routeId === routeId);
79
+
80
+ if (!match) {
81
+ throw new Error("Could not find a match for route \"" + routeId + "\" being rendered in this component!");
82
+ }
83
+
84
+ if (runtimeMatch.routeId !== (match == null ? void 0 : match.routeId)) {
85
+ throw new Error("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?");
86
+ }
87
+
88
+ useRouterSubscription(router);
89
+
90
+ if (!match) {
91
+ throw new Error('Match not found!');
92
+ }
93
+
94
+ return match;
95
+ }
96
+ };
97
+ Object.assign(router, routerExt);
98
+ },
99
+ createRoute: _ref => {
100
+ let {
101
+ router,
102
+ route
103
+ } = _ref;
104
+ const routeExt = {
105
+ linkProps: options => {
106
+ var _functionalUpdate, _functionalUpdate2;
107
+
108
+ const {
109
+ // custom props
110
+ target,
111
+ activeProps = () => ({
112
+ className: 'active'
113
+ }),
114
+ inactiveProps = () => ({}),
115
+ disabled,
116
+ // element props
117
+ style,
118
+ className,
119
+ onClick,
120
+ onFocus,
121
+ onMouseEnter,
122
+ onMouseLeave
123
+ } = options,
124
+ rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(options, _excluded);
125
+
126
+ const linkInfo = route.buildLink(options);
127
+
128
+ if (linkInfo.type === 'external') {
129
+ const {
130
+ href
131
+ } = linkInfo;
132
+ return {
133
+ href
134
+ };
135
+ }
136
+
137
+ const {
138
+ handleClick,
139
+ handleFocus,
140
+ handleEnter,
141
+ handleLeave,
142
+ isActive,
143
+ next
144
+ } = linkInfo;
145
+
146
+ const composeHandlers = handlers => e => {
147
+ e.persist();
148
+ handlers.forEach(handler => {
149
+ if (handler) handler(e);
150
+ });
151
+ }; // Get the active props
152
+
153
+
154
+ const resolvedActiveProps = isActive ? (_functionalUpdate = index.functionalUpdate(activeProps)) != null ? _functionalUpdate : {} : {}; // Get the inactive props
155
+
156
+ const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = index.functionalUpdate(inactiveProps)) != null ? _functionalUpdate2 : {};
157
+ return _rollupPluginBabelHelpers["extends"]({}, resolvedActiveProps, resolvedInactiveProps, rest, {
158
+ href: disabled ? undefined : next.href,
159
+ onClick: composeHandlers([handleClick, onClick]),
160
+ onFocus: composeHandlers([handleFocus, onFocus]),
161
+ onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
162
+ onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
163
+ target,
164
+ style: _rollupPluginBabelHelpers["extends"]({}, style, resolvedActiveProps.style, resolvedInactiveProps.style),
165
+ className: [className, resolvedActiveProps.className, resolvedInactiveProps.className].filter(Boolean).join(' ') || undefined
166
+ }, disabled ? {
167
+ role: 'link',
168
+ 'aria-disabled': true
169
+ } : undefined, {
170
+ ['data-status']: isActive ? 'active' : undefined
171
+ });
172
+ },
173
+ Link: /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
174
+ const linkProps = route.linkProps(props);
175
+ useRouterSubscription(router);
176
+ return /*#__PURE__*/React__namespace.createElement("a", _rollupPluginBabelHelpers["extends"]({
177
+ ref: ref
178
+ }, linkProps, {
179
+ children: typeof props.children === 'function' ? props.children({
180
+ isActive: linkProps['data-status'] === 'active'
181
+ }) : props.children
182
+ }));
183
+ }),
184
+ MatchRoute: opts => {
185
+ const {
186
+ pending,
187
+ caseSensitive
188
+ } = opts,
189
+ rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(opts, _excluded2);
190
+
191
+ const params = route.matchRoute(rest, {
192
+ pending,
193
+ caseSensitive
194
+ }); // useRouterSubscription(router)
195
+
196
+ if (!params) {
197
+ return null;
198
+ }
199
+
200
+ return typeof opts.children === 'function' ? opts.children(params) : opts.children;
201
+ }
202
+ };
203
+ Object.assign(route, routeExt);
204
+ }
205
+ }));
206
+ return coreRouter;
207
+ }
208
+ function RouterProvider(_ref2) {
209
+ let {
210
+ children,
211
+ router
212
+ } = _ref2,
213
+ rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(_ref2, _excluded3);
214
+
215
+ router.update(rest);
216
+ shim.useSyncExternalStore(cb => router.subscribe(() => cb()), () => router.state);
217
+ useLayoutEffect(() => {
218
+ router.mount();
219
+ }, []);
220
+ return /*#__PURE__*/React__namespace.createElement(routerContext.Provider, {
221
+ value: {
222
+ router
223
+ }
224
+ }, /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
225
+ value: router.state.matches
226
+ }, children != null ? children : /*#__PURE__*/React__namespace.createElement(Outlet, null)));
227
+ }
228
+ function useRouter() {
229
+ const value = React__namespace.useContext(routerContext);
230
+ index.warning(!value, 'useRouter must be used inside a <Router> component!');
231
+ useRouterSubscription(value.router);
232
+ return value.router;
233
+ }
234
+ function useMatches() {
235
+ return React__namespace.useContext(matchesContext);
236
+ }
237
+ function useParentMatches() {
238
+ const router = useRouter();
239
+
240
+ const match = _useMatch();
241
+
242
+ const matches = router.state.matches;
243
+ return matches.slice(0, matches.findIndex(d => d.matchId === match.matchId) - 1);
244
+ }
245
+
246
+ function _useMatch() {
247
+ var _useMatches;
248
+
249
+ return (_useMatches = useMatches()) == null ? void 0 : _useMatches[0];
250
+ }
251
+ function Outlet() {
252
+ var _ref3, _childMatch$options$c;
253
+
254
+ const router = useRouter();
255
+ const [, ...matches] = useMatches();
256
+ const childMatch = matches[0];
257
+ if (!childMatch) return null;
258
+ const element = (_ref3 = (() => {
259
+ var _childMatch$__$errorE, _ref5;
260
+
261
+ if (!childMatch) {
262
+ return null;
263
+ }
264
+
265
+ const errorElement = (_childMatch$__$errorE = childMatch.__.errorElement) != null ? _childMatch$__$errorE : router.options.defaultErrorElement;
266
+
267
+ if (childMatch.status === 'error') {
268
+ if (errorElement) {
269
+ return errorElement;
270
+ }
271
+
272
+ if (childMatch.options.useErrorBoundary || router.options.useErrorBoundary) {
273
+ throw childMatch.error;
274
+ }
275
+
276
+ return /*#__PURE__*/React__namespace.createElement(DefaultCatchBoundary, {
277
+ error: childMatch.error
278
+ });
279
+ }
280
+
281
+ if (childMatch.status === 'loading' || childMatch.status === 'idle') {
282
+ if (childMatch.isPending) {
283
+ var _childMatch$__$pendin;
284
+
285
+ const pendingElement = (_childMatch$__$pendin = childMatch.__.pendingElement) != null ? _childMatch$__$pendin : router.options.defaultPendingElement;
286
+
287
+ if (childMatch.options.pendingMs || pendingElement) {
288
+ var _ref4;
289
+
290
+ return (_ref4 = pendingElement) != null ? _ref4 : null;
291
+ }
292
+ }
293
+
294
+ return null;
295
+ }
296
+
297
+ return (_ref5 = childMatch.__.element) != null ? _ref5 : router.options.defaultElement;
298
+ })()) != null ? _ref3 : /*#__PURE__*/React__namespace.createElement(Outlet, null);
299
+ const catchElement = (_childMatch$options$c = childMatch == null ? void 0 : childMatch.options.catchElement) != null ? _childMatch$options$c : router.options.defaultCatchElement;
300
+ return /*#__PURE__*/React__namespace.createElement(MatchesProvider, {
301
+ value: matches,
302
+ key: childMatch.matchId
303
+ }, /*#__PURE__*/React__namespace.createElement(CatchBoundary, {
304
+ catchElement: catchElement
305
+ }, element));
306
+ }
307
+
308
+ class CatchBoundary extends React__namespace.Component {
309
+ constructor() {
310
+ super(...arguments);
311
+ this.state = {
312
+ error: false
313
+ };
314
+
315
+ this.reset = () => {
316
+ this.setState({
317
+ error: false,
318
+ info: false
319
+ });
320
+ };
321
+ }
322
+
323
+ componentDidCatch(error, info) {
324
+ console.error(error);
325
+ this.setState({
326
+ error,
327
+ info
328
+ });
329
+ }
330
+
331
+ render() {
332
+ var _this$props$catchElem;
333
+
334
+ const catchElement = (_this$props$catchElem = this.props.catchElement) != null ? _this$props$catchElem : DefaultCatchBoundary;
335
+
336
+ if (this.state.error) {
337
+ return typeof catchElement === 'function' ? catchElement(this.state) : catchElement;
338
+ }
339
+
340
+ return this.props.children;
341
+ }
342
+
343
+ }
344
+
345
+ function DefaultCatchBoundary(_ref6) {
346
+ let {
347
+ error
348
+ } = _ref6;
349
+ return /*#__PURE__*/React__namespace.createElement("div", {
350
+ style: {
351
+ padding: '.5rem',
352
+ maxWidth: '100%'
353
+ }
354
+ }, /*#__PURE__*/React__namespace.createElement("strong", {
355
+ style: {
356
+ fontSize: '1.2rem'
357
+ }
358
+ }, "Something went wrong!"), /*#__PURE__*/React__namespace.createElement("div", {
359
+ style: {
360
+ height: '.5rem'
361
+ }
362
+ }), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("pre", null, error.message ? /*#__PURE__*/React__namespace.createElement("code", {
363
+ style: {
364
+ fontSize: '.7em',
365
+ border: '1px solid red',
366
+ borderRadius: '.25rem',
367
+ padding: '.5rem',
368
+ color: 'red'
369
+ }
370
+ }, error.message) : null)), /*#__PURE__*/React__namespace.createElement("div", {
371
+ style: {
372
+ height: '1rem'
373
+ }
374
+ }), /*#__PURE__*/React__namespace.createElement("div", {
375
+ style: {
376
+ fontSize: '.8em',
377
+ borderLeft: '3px solid rgba(127, 127, 127, 1)',
378
+ paddingLeft: '.5rem',
379
+ opacity: 0.5
380
+ }
381
+ }, "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."));
382
+ }
383
+
384
+ exports.createBrowserHistory = index.createBrowserHistory;
385
+ exports.createHashHistory = index.createHashHistory;
386
+ exports.createMemoryHistory = index.createMemoryHistory;
387
+ exports.createRoute = index.createRoute;
388
+ exports.createRouteConfig = index.createRouteConfig;
389
+ exports.createRouteMatch = index.createRouteMatch;
390
+ exports.createRouter = index.createRouter;
391
+ exports.defaultParseSearch = index.defaultParseSearch;
392
+ exports.defaultStringifySearch = index.defaultStringifySearch;
393
+ exports.functionalUpdate = index.functionalUpdate;
394
+ exports.last = index.last;
395
+ exports.matchByPath = index.matchByPath;
396
+ exports.matchPathname = index.matchPathname;
397
+ exports.parsePathname = index.parsePathname;
398
+ exports.parseSearchWith = index.parseSearchWith;
399
+ exports.replaceEqualDeep = index.replaceEqualDeep;
400
+ exports.resolvePath = index.resolvePath;
401
+ exports.rootRouteId = index.rootRouteId;
402
+ exports.stringifySearchWith = index.stringifySearchWith;
403
+ exports.warning = index.warning;
404
+ exports.DefaultCatchBoundary = DefaultCatchBoundary;
405
+ exports.MatchesProvider = MatchesProvider;
406
+ exports.Outlet = Outlet;
407
+ exports.RouterProvider = RouterProvider;
408
+ exports.createReactRouter = createReactRouter;
409
+ exports.useMatch = _useMatch;
410
+ exports.useMatches = useMatches;
411
+ exports.useParentMatches = useParentMatches;
412
+ exports.useRouter = useRouter;
413
+ //# sourceMappingURL=index.js.map
@@ -0,0 +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 RootRouteId,\n rootRouteId,\n Route,\n Router,\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} from '@tanstack/router-core'\n\nexport * from '@tanstack/router-core'\n\ndeclare module '@tanstack/router-core' {\n interface FrameworkGenerics {\n Element: React.ReactNode\n AsyncElement: (opts: {\n params: Record<string, string>\n }) => Promise<React.ReactNode>\n SyncOrAsyncElement: React.ReactNode | FrameworkGenerics['AsyncElement']\n }\n\n interface Router<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n TAllRouteInfo extends AnyAllRouteInfo = AllRouteInfo<TRouteConfig>,\n > extends Pick<\n Route<TAllRouteInfo, TAllRouteInfo['routeInfoById'][RootRouteId]>,\n 'linkProps' | 'Link' | 'MatchRoute'\n > {\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 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 )\n}\n\nexport function createReactRouter<\n TRouteConfig extends AnyRouteConfig = RouteConfig,\n>(opts: RouterOptions<TRouteConfig>): Router<TRouteConfig> {\n const coreRouter = createRouter<TRouteConfig>({\n ...opts,\n createRouter: (router) => {\n const routerExt: Pick<Router<any, any>, 'useRoute' | 'useMatch'> = {\n useRoute: (routeId) => {\n const route = router.getRoute(routeId)\n useRouterSubscription(router)\n if (!route) {\n throw new Error(\n `Could not find a route for route \"${\n routeId as string\n }\"! Did you forget to add it to your route config?`,\n )\n }\n return route\n },\n useMatch: (routeId) => {\n if (routeId === rootRouteId) {\n throw new Error(\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 if (!match) {\n throw new Error(\n `Could not find a match for route \"${\n routeId as string\n }\" being rendered in this component!`,\n )\n }\n\n if (runtimeMatch.routeId !== match?.routeId) {\n throw new Error(\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\n useRouterSubscription(router)\n\n if (!match) {\n throw new Error('Match not found!')\n }\n\n return match\n },\n }\n\n Object.assign(router, routerExt)\n },\n createRoute: ({ router, route }) => {\n const routeExt: Pick<AnyRoute, 'linkProps' | 'Link' | 'MatchRoute'> = {\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:\n (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 // useRouterSubscription(router)\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 Object.assign(route, routeExt)\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 useSyncExternalStore(\n (cb) => router.subscribe(() => cb()),\n () => router.state,\n )\n\n useLayoutEffect(() => {\n router.mount()\n }, [])\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 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\nexport function 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 <DefaultCatchBoundary 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) ?? <Outlet />\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 ?? DefaultCatchBoundary\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 DefaultCatchBoundary({ 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"],"names":["matchesContext","React","createContext","routerContext","isDOM","Boolean","window","document","createElement","useLayoutEffect","useEffect","MatchesProvider","props","useRouterSubscription","router","useSyncExternalStore","cb","subscribe","state","createReactRouter","opts","coreRouter","createRouter","_extends","routerExt","useRoute","routeId","route","getRoute","Error","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","Object","assign","createRoute","routeExt","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","undefined","filter","join","role","Link","forwardRef","ref","children","MatchRoute","pending","caseSensitive","params","matchRoute","RouterProvider","_objectWithoutPropertiesLoose","update","mount","useRouter","value","useContext","warning","useMatches","useParentMatches","slice","findIndex","matchId","Outlet","childMatch","element","errorElement","__","defaultErrorElement","status","useErrorBoundary","error","isPending","pendingElement","defaultPendingElement","pendingMs","defaultElement","catchElement","defaultCatchElement","CatchBoundary","Component","reset","setState","info","componentDidCatch","console","render","DefaultCatchBoundary","padding","maxWidth","fontSize","height","message","border","borderRadius","color","borderLeft","paddingLeft","opacity"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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