@tanstack/react-router 0.0.1-alpha.1 → 0.0.1-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/react-router/src/index.js +105 -100
- package/build/cjs/react-router/src/index.js.map +1 -1
- package/build/esm/index.js +105 -100
- package/build/esm/index.js.map +1 -1
- package/build/stats-html.html +1 -1
- package/build/stats-react.json +129 -0
- package/build/types/index.d.ts +77 -0
- package/build/umd/index.development.js +105 -100
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +3 -3
- package/src/index.tsx +174 -166
|
@@ -55,6 +55,108 @@ const useRouterSubscription = router => {
|
|
|
55
55
|
};
|
|
56
56
|
|
|
57
57
|
function createReactRouter(opts) {
|
|
58
|
+
const makeRouteExt = (route, router) => {
|
|
59
|
+
return {
|
|
60
|
+
linkProps: options => {
|
|
61
|
+
var _functionalUpdate, _functionalUpdate2;
|
|
62
|
+
|
|
63
|
+
const {
|
|
64
|
+
// custom props
|
|
65
|
+
target,
|
|
66
|
+
activeProps = () => ({
|
|
67
|
+
className: 'active'
|
|
68
|
+
}),
|
|
69
|
+
inactiveProps = () => ({}),
|
|
70
|
+
disabled,
|
|
71
|
+
// element props
|
|
72
|
+
style,
|
|
73
|
+
className,
|
|
74
|
+
onClick,
|
|
75
|
+
onFocus,
|
|
76
|
+
onMouseEnter,
|
|
77
|
+
onMouseLeave
|
|
78
|
+
} = options,
|
|
79
|
+
rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(options, _excluded);
|
|
80
|
+
|
|
81
|
+
const linkInfo = route.buildLink(options);
|
|
82
|
+
|
|
83
|
+
if (linkInfo.type === 'external') {
|
|
84
|
+
const {
|
|
85
|
+
href
|
|
86
|
+
} = linkInfo;
|
|
87
|
+
return {
|
|
88
|
+
href
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const {
|
|
93
|
+
handleClick,
|
|
94
|
+
handleFocus,
|
|
95
|
+
handleEnter,
|
|
96
|
+
handleLeave,
|
|
97
|
+
isActive,
|
|
98
|
+
next
|
|
99
|
+
} = linkInfo;
|
|
100
|
+
|
|
101
|
+
const composeHandlers = handlers => e => {
|
|
102
|
+
e.persist();
|
|
103
|
+
handlers.forEach(handler => {
|
|
104
|
+
if (handler) handler(e);
|
|
105
|
+
});
|
|
106
|
+
}; // Get the active props
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
const resolvedActiveProps = isActive ? (_functionalUpdate = index.functionalUpdate(activeProps)) != null ? _functionalUpdate : {} : {}; // Get the inactive props
|
|
110
|
+
|
|
111
|
+
const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = index.functionalUpdate(inactiveProps)) != null ? _functionalUpdate2 : {};
|
|
112
|
+
return _rollupPluginBabelHelpers["extends"]({}, resolvedActiveProps, resolvedInactiveProps, rest, {
|
|
113
|
+
href: disabled ? undefined : next.href,
|
|
114
|
+
onClick: composeHandlers([handleClick, onClick]),
|
|
115
|
+
onFocus: composeHandlers([handleFocus, onFocus]),
|
|
116
|
+
onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
|
|
117
|
+
onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
|
|
118
|
+
target,
|
|
119
|
+
style: _rollupPluginBabelHelpers["extends"]({}, style, resolvedActiveProps.style, resolvedInactiveProps.style),
|
|
120
|
+
className: [className, resolvedActiveProps.className, resolvedInactiveProps.className].filter(Boolean).join(' ') || undefined
|
|
121
|
+
}, disabled ? {
|
|
122
|
+
role: 'link',
|
|
123
|
+
'aria-disabled': true
|
|
124
|
+
} : undefined, {
|
|
125
|
+
['data-status']: isActive ? 'active' : undefined
|
|
126
|
+
});
|
|
127
|
+
},
|
|
128
|
+
Link: /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
|
|
129
|
+
const linkProps = route.linkProps(props);
|
|
130
|
+
useRouterSubscription(router);
|
|
131
|
+
return /*#__PURE__*/React__namespace.createElement("a", _rollupPluginBabelHelpers["extends"]({
|
|
132
|
+
ref: ref
|
|
133
|
+
}, linkProps, {
|
|
134
|
+
children: typeof props.children === 'function' ? props.children({
|
|
135
|
+
isActive: linkProps['data-status'] === 'active'
|
|
136
|
+
}) : props.children
|
|
137
|
+
}));
|
|
138
|
+
}),
|
|
139
|
+
MatchRoute: opts => {
|
|
140
|
+
const {
|
|
141
|
+
pending,
|
|
142
|
+
caseSensitive
|
|
143
|
+
} = opts,
|
|
144
|
+
rest = _rollupPluginBabelHelpers.objectWithoutPropertiesLoose(opts, _excluded2);
|
|
145
|
+
|
|
146
|
+
const params = route.matchRoute(rest, {
|
|
147
|
+
pending,
|
|
148
|
+
caseSensitive
|
|
149
|
+
}); // useRouterSubscription(router)
|
|
150
|
+
|
|
151
|
+
if (!params) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return typeof opts.children === 'function' ? opts.children(params) : opts.children;
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
};
|
|
159
|
+
|
|
58
160
|
const coreRouter = index.createRouter(_rollupPluginBabelHelpers["extends"]({}, opts, {
|
|
59
161
|
createRouter: router => {
|
|
60
162
|
const routerExt = {
|
|
@@ -94,112 +196,15 @@ function createReactRouter(opts) {
|
|
|
94
196
|
return match;
|
|
95
197
|
}
|
|
96
198
|
};
|
|
97
|
-
|
|
199
|
+
const routeExt = makeRouteExt(router.getRoute('/'), router);
|
|
200
|
+
Object.assign(router, routerExt, routeExt);
|
|
98
201
|
},
|
|
99
202
|
createRoute: _ref => {
|
|
100
203
|
let {
|
|
101
204
|
router,
|
|
102
205
|
route
|
|
103
206
|
} = _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
|
-
};
|
|
207
|
+
const routeExt = makeRouteExt(route, router);
|
|
203
208
|
Object.assign(route, routeExt);
|
|
204
209
|
}
|
|
205
210
|
}));
|
|
@@ -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 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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAkD,IAAlD,CAAtB;;AAGA,MAAME,KAAK,GAAGC,OAAO,CACnB,OAAOC,MAAP,KAAkB,WAAlB,IACEA,MAAM,CAACC,QADT,IAEED,MAAM,CAACC,QAAP,CAAgBC,aAHC,CAArB,CAAA;AAMA,MAAMC,eAAe,GAAGL,KAAK,GAAGH,gBAAK,CAACQ,eAAT,GAA2BR,gBAAK,CAACS,SAA9D,CAAA;AAOO,SAASC,eAAT,CAAyBC,KAAzB,EAAsD;AAC3D,EAAA,oBAAOX,+BAAC,cAAD,CAAgB,QAAhB,EAA6BW,KAA7B,CAAP,CAAA;AACD,CAAA;;AAED,MAAMC,qBAAqB,GAAIC,MAAD,IAA8B;AAC1DC,EAAAA,yBAAoB,CACjBC,EAAD,IAAQF,MAAM,CAACG,SAAP,CAAiB,MAAMD,EAAE,EAAzB,CADU,EAElB,MAAMF,MAAM,CAACI,KAFK,CAApB,CAAA;AAID,CALD,CAAA;;AAOO,SAASC,iBAAT,CAELC,IAFK,EAEoD;AAC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GAAA,CAFF,eAGE9H,gBACE,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,eAAAA,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EACG0G,KAAK,CAACqB,OAAN,gBACC/H,gBAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AACE,IAAA,KAAK,EAAE;AACL6H,MAAAA,QAAQ,EAAE,MADL;AAELG,MAAAA,MAAM,EAAE,eAFH;AAGLC,MAAAA,YAAY,EAAE,QAHT;AAILN,MAAAA,OAAO,EAAE,OAJJ;AAKLO,MAAAA,KAAK,EAAE,KAAA;AALF,KAAA;GAQNxB,EAAAA,KAAK,CAACqB,OATT,CADD,GAYG,IAbN,CADF,CAHF,eAoBE/H,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,KAAK,EAAE;AAAE8H,MAAAA,MAAM,EAAE,MAAA;AAAV,KAAA;AAAZ,GAAA,CApBF,eAqBE9H,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AACE,IAAA,KAAK,EAAE;AACL6H,MAAAA,QAAQ,EAAE,MADL;AAELM,MAAAA,UAAU,EAAE,kCAFP;AAGLC,MAAAA,WAAW,EAAE,OAHR;AAILC,MAAAA,OAAO,EAAE,GAAA;AAJJ,KAAA;AADT,GAAA,EAAA,iMAAA,CArBF,CADF,CAAA;AAoCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
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 makeRouteExt = (\n route: AnyRoute,\n router: Router<any, any>,\n ): Pick<AnyRoute, 'linkProps' | 'Link' | 'MatchRoute'> => {\n return {\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 // 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\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 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 })\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","makeRouteExt","route","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","useRoute","routeId","getRoute","Error","useMatch","rootRouteId","runtimeMatch","match","matches","find","d","routeExt","Object","assign","createRoute","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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+IA;AAEA,MAAMA,cAAc,gBAAGC,gBAAK,CAACC,aAAN,CAAkC,IAAlC,CAAvB,CAAA;AACA,MAAMC,aAAa,gBAAGF,gBAAK,CAACC,aAAN,CAAkD,IAAlD,CAAtB;;AAGA,MAAME,KAAK,GAAGC,OAAO,CACnB,OAAOC,MAAP,KAAkB,WAAlB,IACEA,MAAM,CAACC,QADT,IAEED,MAAM,CAACC,QAAP,CAAgBC,aAHC,CAArB,CAAA;AAMA,MAAMC,eAAe,GAAGL,KAAK,GAAGH,gBAAK,CAACQ,eAAT,GAA2BR,gBAAK,CAACS,SAA9D,CAAA;AAOO,SAASC,eAAT,CAAyBC,KAAzB,EAAsD;AAC3D,EAAA,oBAAOX,+BAAC,cAAD,CAAgB,QAAhB,EAA6BW,KAA7B,CAAP,CAAA;AACD,CAAA;;AAED,MAAMC,qBAAqB,GAAIC,MAAD,IAA8B;AAC1DC,EAAAA,yBAAoB,CACjBC,EAAD,IAAQF,MAAM,CAACG,SAAP,CAAiB,MAAMD,EAAE,EAAzB,CADU,EAElB,MAAMF,MAAM,CAACI,KAFK,CAApB,CAAA;AAID,CALD,CAAA;;AAOO,SAASC,iBAAT,CAELC,IAFK,EAEoD;AACzD,EAAA,MAAMC,YAAY,GAAG,CACnBC,KADmB,EAEnBR,MAFmB,KAGqC;IACxD,OAAO;MACLS,SAAS,EAAGC,OAAD,IAAa;AAAA,QAAA,IAAA,iBAAA,EAAA,kBAAA,CAAA;;QACtB,MAAM;AACJ;UAGAC,MAJI;AAKJC,UAAAA,WAAW,GAAG,OAAO;AAAEC,YAAAA,SAAS,EAAE,QAAA;AAAb,WAAP,CALV;UAMJC,aAAa,GAAG,OAAO,EAAP,CANZ;UAQ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AA,IAAA,eAAAA,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA,IAAA,EACG2G,KAAK,CAACqB,OAAN,gBACChI,gBAAA,CAAA,aAAA,CAAA,MAAA,EAAA;AACE,IAAA,KAAK,EAAE;AACL8H,MAAAA,QAAQ,EAAE,MADL;AAELG,MAAAA,MAAM,EAAE,eAFH;AAGLC,MAAAA,YAAY,EAAE,QAHT;AAILN,MAAAA,OAAO,EAAE,OAJJ;AAKLO,MAAAA,KAAK,EAAE,KAAA;AALF,KAAA;GAQNxB,EAAAA,KAAK,CAACqB,OATT,CADD,GAYG,IAbN,CADF,CAHF,eAoBEhI,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AAAK,IAAA,KAAK,EAAE;AAAE+H,MAAAA,MAAM,EAAE,MAAA;AAAV,KAAA;AAAZ,GAAA,CApBF,eAqBE/H,gBAAA,CAAA,aAAA,CAAA,KAAA,EAAA;AACE,IAAA,KAAK,EAAE;AACL8H,MAAAA,QAAQ,EAAE,MADL;AAELM,MAAAA,UAAU,EAAE,kCAFP;AAGLC,MAAAA,WAAW,EAAE,OAHR;AAILC,MAAAA,OAAO,EAAE,GAAA;AAJJ,KAAA;AADT,GAAA,EAAA,iMAAA,CArBF,CADF,CAAA;AAoCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/build/esm/index.js
CHANGED
|
@@ -2356,6 +2356,108 @@ const useRouterSubscription = router => {
|
|
|
2356
2356
|
};
|
|
2357
2357
|
|
|
2358
2358
|
function createReactRouter(opts) {
|
|
2359
|
+
const makeRouteExt = (route, router) => {
|
|
2360
|
+
return {
|
|
2361
|
+
linkProps: options => {
|
|
2362
|
+
var _functionalUpdate, _functionalUpdate2;
|
|
2363
|
+
|
|
2364
|
+
const {
|
|
2365
|
+
// custom props
|
|
2366
|
+
target,
|
|
2367
|
+
activeProps = () => ({
|
|
2368
|
+
className: 'active'
|
|
2369
|
+
}),
|
|
2370
|
+
inactiveProps = () => ({}),
|
|
2371
|
+
disabled,
|
|
2372
|
+
// element props
|
|
2373
|
+
style,
|
|
2374
|
+
className,
|
|
2375
|
+
onClick,
|
|
2376
|
+
onFocus,
|
|
2377
|
+
onMouseEnter,
|
|
2378
|
+
onMouseLeave
|
|
2379
|
+
} = options,
|
|
2380
|
+
rest = _objectWithoutPropertiesLoose(options, _excluded);
|
|
2381
|
+
|
|
2382
|
+
const linkInfo = route.buildLink(options);
|
|
2383
|
+
|
|
2384
|
+
if (linkInfo.type === 'external') {
|
|
2385
|
+
const {
|
|
2386
|
+
href
|
|
2387
|
+
} = linkInfo;
|
|
2388
|
+
return {
|
|
2389
|
+
href
|
|
2390
|
+
};
|
|
2391
|
+
}
|
|
2392
|
+
|
|
2393
|
+
const {
|
|
2394
|
+
handleClick,
|
|
2395
|
+
handleFocus,
|
|
2396
|
+
handleEnter,
|
|
2397
|
+
handleLeave,
|
|
2398
|
+
isActive,
|
|
2399
|
+
next
|
|
2400
|
+
} = linkInfo;
|
|
2401
|
+
|
|
2402
|
+
const composeHandlers = handlers => e => {
|
|
2403
|
+
e.persist();
|
|
2404
|
+
handlers.forEach(handler => {
|
|
2405
|
+
if (handler) handler(e);
|
|
2406
|
+
});
|
|
2407
|
+
}; // Get the active props
|
|
2408
|
+
|
|
2409
|
+
|
|
2410
|
+
const resolvedActiveProps = isActive ? (_functionalUpdate = functionalUpdate(activeProps)) != null ? _functionalUpdate : {} : {}; // Get the inactive props
|
|
2411
|
+
|
|
2412
|
+
const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = functionalUpdate(inactiveProps)) != null ? _functionalUpdate2 : {};
|
|
2413
|
+
return _extends$2({}, resolvedActiveProps, resolvedInactiveProps, rest, {
|
|
2414
|
+
href: disabled ? undefined : next.href,
|
|
2415
|
+
onClick: composeHandlers([handleClick, onClick]),
|
|
2416
|
+
onFocus: composeHandlers([handleFocus, onFocus]),
|
|
2417
|
+
onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
|
|
2418
|
+
onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
|
|
2419
|
+
target,
|
|
2420
|
+
style: _extends$2({}, style, resolvedActiveProps.style, resolvedInactiveProps.style),
|
|
2421
|
+
className: [className, resolvedActiveProps.className, resolvedInactiveProps.className].filter(Boolean).join(' ') || undefined
|
|
2422
|
+
}, disabled ? {
|
|
2423
|
+
role: 'link',
|
|
2424
|
+
'aria-disabled': true
|
|
2425
|
+
} : undefined, {
|
|
2426
|
+
['data-status']: isActive ? 'active' : undefined
|
|
2427
|
+
});
|
|
2428
|
+
},
|
|
2429
|
+
Link: /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
2430
|
+
const linkProps = route.linkProps(props);
|
|
2431
|
+
useRouterSubscription(router);
|
|
2432
|
+
return /*#__PURE__*/React.createElement("a", _extends$2({
|
|
2433
|
+
ref: ref
|
|
2434
|
+
}, linkProps, {
|
|
2435
|
+
children: typeof props.children === 'function' ? props.children({
|
|
2436
|
+
isActive: linkProps['data-status'] === 'active'
|
|
2437
|
+
}) : props.children
|
|
2438
|
+
}));
|
|
2439
|
+
}),
|
|
2440
|
+
MatchRoute: opts => {
|
|
2441
|
+
const {
|
|
2442
|
+
pending,
|
|
2443
|
+
caseSensitive
|
|
2444
|
+
} = opts,
|
|
2445
|
+
rest = _objectWithoutPropertiesLoose(opts, _excluded2);
|
|
2446
|
+
|
|
2447
|
+
const params = route.matchRoute(rest, {
|
|
2448
|
+
pending,
|
|
2449
|
+
caseSensitive
|
|
2450
|
+
}); // useRouterSubscription(router)
|
|
2451
|
+
|
|
2452
|
+
if (!params) {
|
|
2453
|
+
return null;
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
return typeof opts.children === 'function' ? opts.children(params) : opts.children;
|
|
2457
|
+
}
|
|
2458
|
+
};
|
|
2459
|
+
};
|
|
2460
|
+
|
|
2359
2461
|
const coreRouter = createRouter(_extends$2({}, opts, {
|
|
2360
2462
|
createRouter: router => {
|
|
2361
2463
|
const routerExt = {
|
|
@@ -2395,112 +2497,15 @@ function createReactRouter(opts) {
|
|
|
2395
2497
|
return match;
|
|
2396
2498
|
}
|
|
2397
2499
|
};
|
|
2398
|
-
|
|
2500
|
+
const routeExt = makeRouteExt(router.getRoute('/'), router);
|
|
2501
|
+
Object.assign(router, routerExt, routeExt);
|
|
2399
2502
|
},
|
|
2400
2503
|
createRoute: _ref => {
|
|
2401
2504
|
let {
|
|
2402
2505
|
router,
|
|
2403
2506
|
route
|
|
2404
2507
|
} = _ref;
|
|
2405
|
-
const routeExt =
|
|
2406
|
-
linkProps: options => {
|
|
2407
|
-
var _functionalUpdate, _functionalUpdate2;
|
|
2408
|
-
|
|
2409
|
-
const {
|
|
2410
|
-
// custom props
|
|
2411
|
-
target,
|
|
2412
|
-
activeProps = () => ({
|
|
2413
|
-
className: 'active'
|
|
2414
|
-
}),
|
|
2415
|
-
inactiveProps = () => ({}),
|
|
2416
|
-
disabled,
|
|
2417
|
-
// element props
|
|
2418
|
-
style,
|
|
2419
|
-
className,
|
|
2420
|
-
onClick,
|
|
2421
|
-
onFocus,
|
|
2422
|
-
onMouseEnter,
|
|
2423
|
-
onMouseLeave
|
|
2424
|
-
} = options,
|
|
2425
|
-
rest = _objectWithoutPropertiesLoose(options, _excluded);
|
|
2426
|
-
|
|
2427
|
-
const linkInfo = route.buildLink(options);
|
|
2428
|
-
|
|
2429
|
-
if (linkInfo.type === 'external') {
|
|
2430
|
-
const {
|
|
2431
|
-
href
|
|
2432
|
-
} = linkInfo;
|
|
2433
|
-
return {
|
|
2434
|
-
href
|
|
2435
|
-
};
|
|
2436
|
-
}
|
|
2437
|
-
|
|
2438
|
-
const {
|
|
2439
|
-
handleClick,
|
|
2440
|
-
handleFocus,
|
|
2441
|
-
handleEnter,
|
|
2442
|
-
handleLeave,
|
|
2443
|
-
isActive,
|
|
2444
|
-
next
|
|
2445
|
-
} = linkInfo;
|
|
2446
|
-
|
|
2447
|
-
const composeHandlers = handlers => e => {
|
|
2448
|
-
e.persist();
|
|
2449
|
-
handlers.forEach(handler => {
|
|
2450
|
-
if (handler) handler(e);
|
|
2451
|
-
});
|
|
2452
|
-
}; // Get the active props
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
const resolvedActiveProps = isActive ? (_functionalUpdate = functionalUpdate(activeProps)) != null ? _functionalUpdate : {} : {}; // Get the inactive props
|
|
2456
|
-
|
|
2457
|
-
const resolvedInactiveProps = isActive ? {} : (_functionalUpdate2 = functionalUpdate(inactiveProps)) != null ? _functionalUpdate2 : {};
|
|
2458
|
-
return _extends$2({}, resolvedActiveProps, resolvedInactiveProps, rest, {
|
|
2459
|
-
href: disabled ? undefined : next.href,
|
|
2460
|
-
onClick: composeHandlers([handleClick, onClick]),
|
|
2461
|
-
onFocus: composeHandlers([handleFocus, onFocus]),
|
|
2462
|
-
onMouseEnter: composeHandlers([handleEnter, onMouseEnter]),
|
|
2463
|
-
onMouseLeave: composeHandlers([handleLeave, onMouseLeave]),
|
|
2464
|
-
target,
|
|
2465
|
-
style: _extends$2({}, style, resolvedActiveProps.style, resolvedInactiveProps.style),
|
|
2466
|
-
className: [className, resolvedActiveProps.className, resolvedInactiveProps.className].filter(Boolean).join(' ') || undefined
|
|
2467
|
-
}, disabled ? {
|
|
2468
|
-
role: 'link',
|
|
2469
|
-
'aria-disabled': true
|
|
2470
|
-
} : undefined, {
|
|
2471
|
-
['data-status']: isActive ? 'active' : undefined
|
|
2472
|
-
});
|
|
2473
|
-
},
|
|
2474
|
-
Link: /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
2475
|
-
const linkProps = route.linkProps(props);
|
|
2476
|
-
useRouterSubscription(router);
|
|
2477
|
-
return /*#__PURE__*/React.createElement("a", _extends$2({
|
|
2478
|
-
ref: ref
|
|
2479
|
-
}, linkProps, {
|
|
2480
|
-
children: typeof props.children === 'function' ? props.children({
|
|
2481
|
-
isActive: linkProps['data-status'] === 'active'
|
|
2482
|
-
}) : props.children
|
|
2483
|
-
}));
|
|
2484
|
-
}),
|
|
2485
|
-
MatchRoute: opts => {
|
|
2486
|
-
const {
|
|
2487
|
-
pending,
|
|
2488
|
-
caseSensitive
|
|
2489
|
-
} = opts,
|
|
2490
|
-
rest = _objectWithoutPropertiesLoose(opts, _excluded2);
|
|
2491
|
-
|
|
2492
|
-
const params = route.matchRoute(rest, {
|
|
2493
|
-
pending,
|
|
2494
|
-
caseSensitive
|
|
2495
|
-
}); // useRouterSubscription(router)
|
|
2496
|
-
|
|
2497
|
-
if (!params) {
|
|
2498
|
-
return null;
|
|
2499
|
-
}
|
|
2500
|
-
|
|
2501
|
-
return typeof opts.children === 'function' ? opts.children(params) : opts.children;
|
|
2502
|
-
}
|
|
2503
|
-
};
|
|
2508
|
+
const routeExt = makeRouteExt(route, router);
|
|
2504
2509
|
Object.assign(route, routeExt);
|
|
2505
2510
|
}
|
|
2506
2511
|
}));
|