@tanstack/solid-router 1.162.2 → 1.162.5
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/dist/cjs/RouterProvider.cjs +1 -2
- package/dist/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/index.cjs +0 -26
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -5
- package/dist/cjs/index.dev.cjs +0 -26
- package/dist/cjs/index.dev.cjs.map +1 -1
- package/dist/cjs/routerContext.cjs +1 -11
- package/dist/cjs/routerContext.cjs.map +1 -1
- package/dist/cjs/routerContext.d.cts +1 -6
- package/dist/cjs/useRouter.cjs +1 -1
- package/dist/cjs/useRouter.cjs.map +1 -1
- package/dist/cjs/utils.cjs +0 -2
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/cjs/utils.d.cts +0 -1
- package/dist/esm/RouterProvider.js +1 -2
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/index.d.ts +2 -5
- package/dist/esm/index.dev.js +1 -12
- package/dist/esm/index.dev.js.map +1 -1
- package/dist/esm/index.js +1 -12
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/routerContext.d.ts +1 -6
- package/dist/esm/routerContext.js +1 -11
- package/dist/esm/routerContext.js.map +1 -1
- package/dist/esm/useRouter.js +2 -2
- package/dist/esm/useRouter.js.map +1 -1
- package/dist/esm/utils.d.ts +0 -1
- package/dist/esm/utils.js +0 -2
- package/dist/esm/utils.js.map +1 -1
- package/dist/source/RouterProvider.jsx +1 -2
- package/dist/source/RouterProvider.jsx.map +1 -1
- package/dist/source/index.d.ts +2 -5
- package/dist/source/index.jsx +2 -6
- package/dist/source/index.jsx.map +1 -1
- package/dist/source/routerContext.d.ts +1 -6
- package/dist/source/routerContext.jsx +1 -11
- package/dist/source/routerContext.jsx.map +1 -1
- package/dist/source/useRouter.jsx +2 -2
- package/dist/source/useRouter.jsx.map +1 -1
- package/dist/source/utils.d.ts +0 -1
- package/dist/source/utils.js +0 -1
- package/dist/source/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/RouterProvider.tsx +1 -3
- package/src/index.tsx +1 -16
- package/src/routerContext.tsx +1 -21
- package/src/useRouter.tsx +2 -2
- package/src/utils.ts +0 -3
|
@@ -17,11 +17,10 @@ function RouterContextProvider({
|
|
|
17
17
|
...rest.context
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
|
-
const routerContext$1 = routerContext.getRouterContext();
|
|
21
20
|
const OptionalWrapper = router.options.Wrap || SafeFragment.SafeFragment;
|
|
22
21
|
return Solid.createComponent(OptionalWrapper, {
|
|
23
22
|
get children() {
|
|
24
|
-
return Solid.createComponent(routerContext
|
|
23
|
+
return Solid.createComponent(routerContext.routerContext.Provider, {
|
|
25
24
|
value: router,
|
|
26
25
|
get children() {
|
|
27
26
|
return children();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterProvider.cjs","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"RouterProvider.cjs","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import { routerContext } from './routerContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Matches } from './Matches'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterOptions,\n} from '@tanstack/router-core'\nimport type * as Solid from 'solid-js'\n\nexport function RouterContextProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n router,\n children,\n ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n children: () => Solid.JSX.Element\n}) {\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...rest,\n context: {\n ...router.options.context,\n ...rest.context,\n },\n })\n\n const OptionalWrapper = router.options.Wrap || SafeFragment\n\n return (\n <OptionalWrapper>\n <routerContext.Provider value={router as AnyRouter}>\n {children()}\n </routerContext.Provider>\n </OptionalWrapper>\n )\n}\n\nexport function RouterProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n return (\n <RouterContextProvider router={router} {...rest}>\n {() => <Matches />}\n </RouterContextProvider>\n )\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >,\n 'context'\n> & {\n router: TRouter\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >['context']\n >\n}\n"],"names":["RouterContextProvider","router","children","rest","update","options","context","OptionalWrapper","Wrap","SafeFragment","_$createComponent","routerContext","Provider","value","RouterProvider","_$mergeProps","Matches"],"mappings":";;;;;;AAUO,SAASA,sBAGd;AAAA,EACAC;AAAAA,EACAC;AAAAA,EACA,GAAGC;AAGL,GAAG;AAEDF,SAAOG,OAAO;AAAA,IACZ,GAAGH,OAAOI;AAAAA,IACV,GAAGF;AAAAA,IACHG,SAAS;AAAA,MACP,GAAGL,OAAOI,QAAQC;AAAAA,MAClB,GAAGH,KAAKG;AAAAA,IAAAA;AAAAA,EACV,CACD;AAED,QAAMC,kBAAkBN,OAAOI,QAAQG,QAAQC,aAAAA;AAE/C,SAAAC,MAAAA,gBACGH,iBAAe;AAAA,IAAA,IAAAL,WAAA;AAAA,aAAAQ,MAAAA,gBACbC,cAAAA,cAAcC,UAAQ;AAAA,QAACC,OAAOZ;AAAAA,QAAmB,IAAAC,WAAA;AAAA,iBAC/CA,SAAAA;AAAAA,QAAU;AAAA,MAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA;AAInB;AAEO,SAASY,eAGd;AAAA,EAAEb;AAAAA,EAAQ,GAAGE;AAAwC,GAAG;AACxD,SAAAO,MAAAA,gBACGV,uBAAqBe,iBAAA;AAAA,IAACd;AAAAA,EAAAA,GAAoBE,MAAI;AAAA,IAAAD,UAC5CA,MAAAQ,sBAAOM,QAAAA,SAAO,CAAA,CAAA;AAAA,EAAA,CAAG,CAAA;AAGxB;;;"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -9,7 +9,6 @@ const fileRoute = require("./fileRoute.cjs");
|
|
|
9
9
|
const lazyRouteComponent = require("./lazyRouteComponent.cjs");
|
|
10
10
|
const link = require("./link.cjs");
|
|
11
11
|
const Matches = require("./Matches.cjs");
|
|
12
|
-
const matchContext = require("./matchContext.cjs");
|
|
13
12
|
const Match = require("./Match.cjs");
|
|
14
13
|
const useMatch = require("./useMatch.cjs");
|
|
15
14
|
const useLoaderDeps = require("./useLoaderDeps.cjs");
|
|
@@ -22,13 +21,11 @@ const useBlocker = require("./useBlocker.cjs");
|
|
|
22
21
|
const useNavigate = require("./useNavigate.cjs");
|
|
23
22
|
const useParams = require("./useParams.cjs");
|
|
24
23
|
const useSearch = require("./useSearch.cjs");
|
|
25
|
-
const routerContext = require("./routerContext.cjs");
|
|
26
24
|
const useRouteContext = require("./useRouteContext.cjs");
|
|
27
25
|
const useRouter = require("./useRouter.cjs");
|
|
28
26
|
const useRouterState = require("./useRouterState.cjs");
|
|
29
27
|
const useLocation = require("./useLocation.cjs");
|
|
30
28
|
const useCanGoBack = require("./useCanGoBack.cjs");
|
|
31
|
-
const utils = require("./utils.cjs");
|
|
32
29
|
const notFound = require("./not-found.cjs");
|
|
33
30
|
const ScriptOnce = require("./ScriptOnce.cjs");
|
|
34
31
|
const Asset = require("./Asset.cjs");
|
|
@@ -39,26 +36,14 @@ Object.defineProperty(exports, "DEFAULT_PROTOCOL_ALLOWLIST", {
|
|
|
39
36
|
enumerable: true,
|
|
40
37
|
get: () => routerCore.DEFAULT_PROTOCOL_ALLOWLIST
|
|
41
38
|
});
|
|
42
|
-
Object.defineProperty(exports, "PathParamError", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: () => routerCore.PathParamError
|
|
45
|
-
});
|
|
46
39
|
Object.defineProperty(exports, "SearchParamError", {
|
|
47
40
|
enumerable: true,
|
|
48
41
|
get: () => routerCore.SearchParamError
|
|
49
42
|
});
|
|
50
|
-
Object.defineProperty(exports, "TSR_DEFERRED_PROMISE", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: () => routerCore.TSR_DEFERRED_PROMISE
|
|
53
|
-
});
|
|
54
43
|
Object.defineProperty(exports, "cleanPath", {
|
|
55
44
|
enumerable: true,
|
|
56
45
|
get: () => routerCore.cleanPath
|
|
57
46
|
});
|
|
58
|
-
Object.defineProperty(exports, "componentTypes", {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: () => routerCore.componentTypes
|
|
61
|
-
});
|
|
62
47
|
Object.defineProperty(exports, "composeRewrites", {
|
|
63
48
|
enumerable: true,
|
|
64
49
|
get: () => routerCore.composeRewrites
|
|
@@ -79,10 +64,6 @@ Object.defineProperty(exports, "defaultParseSearch", {
|
|
|
79
64
|
enumerable: true,
|
|
80
65
|
get: () => routerCore.defaultParseSearch
|
|
81
66
|
});
|
|
82
|
-
Object.defineProperty(exports, "defaultSerializeError", {
|
|
83
|
-
enumerable: true,
|
|
84
|
-
get: () => routerCore.defaultSerializeError
|
|
85
|
-
});
|
|
86
67
|
Object.defineProperty(exports, "defaultStringifySearch", {
|
|
87
68
|
enumerable: true,
|
|
88
69
|
get: () => routerCore.defaultStringifySearch
|
|
@@ -95,10 +76,6 @@ Object.defineProperty(exports, "functionalUpdate", {
|
|
|
95
76
|
enumerable: true,
|
|
96
77
|
get: () => routerCore.functionalUpdate
|
|
97
78
|
});
|
|
98
|
-
Object.defineProperty(exports, "getInitialRouterState", {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: () => routerCore.getInitialRouterState
|
|
101
|
-
});
|
|
102
79
|
Object.defineProperty(exports, "interpolatePath", {
|
|
103
80
|
enumerable: true,
|
|
104
81
|
get: () => routerCore.interpolatePath
|
|
@@ -218,7 +195,6 @@ exports.useChildMatches = Matches.useChildMatches;
|
|
|
218
195
|
exports.useMatchRoute = Matches.useMatchRoute;
|
|
219
196
|
exports.useMatches = Matches.useMatches;
|
|
220
197
|
exports.useParentMatches = Matches.useParentMatches;
|
|
221
|
-
exports.matchContext = matchContext.matchContext;
|
|
222
198
|
exports.Match = Match.Match;
|
|
223
199
|
exports.Outlet = Match.Outlet;
|
|
224
200
|
exports.useMatch = useMatch.useMatch;
|
|
@@ -246,13 +222,11 @@ exports.Navigate = useNavigate.Navigate;
|
|
|
246
222
|
exports.useNavigate = useNavigate.useNavigate;
|
|
247
223
|
exports.useParams = useParams.useParams;
|
|
248
224
|
exports.useSearch = useSearch.useSearch;
|
|
249
|
-
exports.getRouterContext = routerContext.getRouterContext;
|
|
250
225
|
exports.useRouteContext = useRouteContext.useRouteContext;
|
|
251
226
|
exports.useRouter = useRouter.useRouter;
|
|
252
227
|
exports.useRouterState = useRouterState.useRouterState;
|
|
253
228
|
exports.useLocation = useLocation.useLocation;
|
|
254
229
|
exports.useCanGoBack = useCanGoBack.useCanGoBack;
|
|
255
|
-
exports.useLayoutEffect = utils.useLayoutEffect;
|
|
256
230
|
exports.CatchNotFound = notFound.CatchNotFound;
|
|
257
231
|
exports.DefaultGlobalNotFound = notFound.DefaultGlobalNotFound;
|
|
258
232
|
exports.ScriptOnce = ScriptOnce.ScriptOnce;
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defer,
|
|
1
|
+
export { defer, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, interpolatePath, rootRouteId, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, createControlledPromise, retainSearchParams, stripSearchParams, createSerializationAdapter, } from '@tanstack/router-core';
|
|
2
2
|
export type { DeferredPromiseState, DeferredPromise, ParsedLocation, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, ResolveOptionalParams, ResolveRequiredParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, NavigateFn, BuildLocationFn, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, Register, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, AnyRouterWithContext, ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, AllLoaderData, FullSearchSchemaInput, AllContext, CommitLocationOptions, MatchLocation, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllParamsFromParent, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, FullSearchSchemaOption, MakeRemountDepsOptionsUnion, RemountDepsOptions, FileRouteTypes, FileRoutesByPath, UseNavigateResult, AnyRedirect, Redirect, RedirectOptions, ResolvedRedirect, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, RouteContextFn, RouteContextOptions, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, AnyRouteWithContext, LazyRouteOptions, AnyRoute, ResolveFullPath, RouteConstraints, RouterState, ListenerFn, BuildNextOptions, AnyRouter, RegisteredRouter, RouterEvents, RouterEvent, RouterListener, MatchRouteOptions, RouteMask, RouterContextOptions, RouterOptions, RouterConstructorOptions, ControllablePromise, InjectedHtmlEntry, CreateFileRoute, CreateLazyFileRoute, AnySerializationAdapter, SerializationAdapter, SerializableExtensions, } from '@tanstack/router-core';
|
|
3
3
|
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
|
|
4
4
|
export type { BlockerFn, HistoryLocation, RouterHistory, ParsedPath, HistoryState, } from '@tanstack/history';
|
|
@@ -13,7 +13,6 @@ export { useLinkProps, createLink, Link, linkOptions } from './link.cjs';
|
|
|
13
13
|
export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentProps, CreateLinkProps, } from './link.cjs';
|
|
14
14
|
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches.cjs';
|
|
15
15
|
export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches.cjs';
|
|
16
|
-
export { matchContext } from './matchContext.cjs';
|
|
17
16
|
export { Match, Outlet } from './Match.cjs';
|
|
18
17
|
export { useMatch } from './useMatch.cjs';
|
|
19
18
|
export { useLoaderDeps } from './useLoaderDeps.cjs';
|
|
@@ -22,7 +21,7 @@ export { redirect, isRedirect, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/rou
|
|
|
22
21
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route.cjs';
|
|
23
22
|
export type { AnyRootRoute, SolidNode, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, } from './route.cjs';
|
|
24
23
|
export { createRouter, Router } from './router.cjs';
|
|
25
|
-
export {
|
|
24
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core';
|
|
26
25
|
export { RouterProvider, RouterContextProvider } from './RouterProvider.cjs';
|
|
27
26
|
export type { RouterProps } from './RouterProvider.cjs';
|
|
28
27
|
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration.cjs';
|
|
@@ -31,13 +30,11 @@ export { useBlocker, Block } from './useBlocker.cjs';
|
|
|
31
30
|
export { useNavigate, Navigate } from './useNavigate.cjs';
|
|
32
31
|
export { useParams } from './useParams.cjs';
|
|
33
32
|
export { useSearch } from './useSearch.cjs';
|
|
34
|
-
export { getRouterContext, } from './routerContext.cjs';
|
|
35
33
|
export { useRouteContext } from './useRouteContext.cjs';
|
|
36
34
|
export { useRouter } from './useRouter.cjs';
|
|
37
35
|
export { useRouterState } from './useRouterState.cjs';
|
|
38
36
|
export { useLocation } from './useLocation.cjs';
|
|
39
37
|
export { useCanGoBack } from './useCanGoBack.cjs';
|
|
40
|
-
export { useLayoutEffect } from './utils.cjs';
|
|
41
38
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found.cjs';
|
|
42
39
|
export { notFound, isNotFound } from '@tanstack/router-core';
|
|
43
40
|
export type { NotFoundError } from '@tanstack/router-core';
|
package/dist/cjs/index.dev.cjs
CHANGED
|
@@ -9,7 +9,6 @@ const fileRoute = require("./fileRoute.cjs");
|
|
|
9
9
|
const lazyRouteComponent = require("./lazyRouteComponent.cjs");
|
|
10
10
|
const link = require("./link.cjs");
|
|
11
11
|
const Matches = require("./Matches.cjs");
|
|
12
|
-
const matchContext = require("./matchContext.cjs");
|
|
13
12
|
const Match = require("./Match.cjs");
|
|
14
13
|
const useMatch = require("./useMatch.cjs");
|
|
15
14
|
const useLoaderDeps = require("./useLoaderDeps.cjs");
|
|
@@ -22,13 +21,11 @@ const useBlocker = require("./useBlocker.cjs");
|
|
|
22
21
|
const useNavigate = require("./useNavigate.cjs");
|
|
23
22
|
const useParams = require("./useParams.cjs");
|
|
24
23
|
const useSearch = require("./useSearch.cjs");
|
|
25
|
-
const routerContext = require("./routerContext.cjs");
|
|
26
24
|
const useRouteContext = require("./useRouteContext.cjs");
|
|
27
25
|
const useRouter = require("./useRouter.cjs");
|
|
28
26
|
const useRouterState = require("./useRouterState.cjs");
|
|
29
27
|
const useLocation = require("./useLocation.cjs");
|
|
30
28
|
const useCanGoBack = require("./useCanGoBack.cjs");
|
|
31
|
-
const utils = require("./utils.cjs");
|
|
32
29
|
const notFound = require("./not-found.cjs");
|
|
33
30
|
const ScriptOnce = require("./ScriptOnce.cjs");
|
|
34
31
|
const Asset = require("./Asset.cjs");
|
|
@@ -39,26 +36,14 @@ Object.defineProperty(exports, "DEFAULT_PROTOCOL_ALLOWLIST", {
|
|
|
39
36
|
enumerable: true,
|
|
40
37
|
get: () => routerCore.DEFAULT_PROTOCOL_ALLOWLIST
|
|
41
38
|
});
|
|
42
|
-
Object.defineProperty(exports, "PathParamError", {
|
|
43
|
-
enumerable: true,
|
|
44
|
-
get: () => routerCore.PathParamError
|
|
45
|
-
});
|
|
46
39
|
Object.defineProperty(exports, "SearchParamError", {
|
|
47
40
|
enumerable: true,
|
|
48
41
|
get: () => routerCore.SearchParamError
|
|
49
42
|
});
|
|
50
|
-
Object.defineProperty(exports, "TSR_DEFERRED_PROMISE", {
|
|
51
|
-
enumerable: true,
|
|
52
|
-
get: () => routerCore.TSR_DEFERRED_PROMISE
|
|
53
|
-
});
|
|
54
43
|
Object.defineProperty(exports, "cleanPath", {
|
|
55
44
|
enumerable: true,
|
|
56
45
|
get: () => routerCore.cleanPath
|
|
57
46
|
});
|
|
58
|
-
Object.defineProperty(exports, "componentTypes", {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: () => routerCore.componentTypes
|
|
61
|
-
});
|
|
62
47
|
Object.defineProperty(exports, "composeRewrites", {
|
|
63
48
|
enumerable: true,
|
|
64
49
|
get: () => routerCore.composeRewrites
|
|
@@ -79,10 +64,6 @@ Object.defineProperty(exports, "defaultParseSearch", {
|
|
|
79
64
|
enumerable: true,
|
|
80
65
|
get: () => routerCore.defaultParseSearch
|
|
81
66
|
});
|
|
82
|
-
Object.defineProperty(exports, "defaultSerializeError", {
|
|
83
|
-
enumerable: true,
|
|
84
|
-
get: () => routerCore.defaultSerializeError
|
|
85
|
-
});
|
|
86
67
|
Object.defineProperty(exports, "defaultStringifySearch", {
|
|
87
68
|
enumerable: true,
|
|
88
69
|
get: () => routerCore.defaultStringifySearch
|
|
@@ -95,10 +76,6 @@ Object.defineProperty(exports, "functionalUpdate", {
|
|
|
95
76
|
enumerable: true,
|
|
96
77
|
get: () => routerCore.functionalUpdate
|
|
97
78
|
});
|
|
98
|
-
Object.defineProperty(exports, "getInitialRouterState", {
|
|
99
|
-
enumerable: true,
|
|
100
|
-
get: () => routerCore.getInitialRouterState
|
|
101
|
-
});
|
|
102
79
|
Object.defineProperty(exports, "interpolatePath", {
|
|
103
80
|
enumerable: true,
|
|
104
81
|
get: () => routerCore.interpolatePath
|
|
@@ -218,7 +195,6 @@ exports.useChildMatches = Matches.useChildMatches;
|
|
|
218
195
|
exports.useMatchRoute = Matches.useMatchRoute;
|
|
219
196
|
exports.useMatches = Matches.useMatches;
|
|
220
197
|
exports.useParentMatches = Matches.useParentMatches;
|
|
221
|
-
exports.matchContext = matchContext.matchContext;
|
|
222
198
|
exports.Match = Match.Match;
|
|
223
199
|
exports.Outlet = Match.Outlet;
|
|
224
200
|
exports.useMatch = useMatch.useMatch;
|
|
@@ -246,13 +222,11 @@ exports.Navigate = useNavigate.Navigate;
|
|
|
246
222
|
exports.useNavigate = useNavigate.useNavigate;
|
|
247
223
|
exports.useParams = useParams.useParams;
|
|
248
224
|
exports.useSearch = useSearch.useSearch;
|
|
249
|
-
exports.getRouterContext = routerContext.getRouterContext;
|
|
250
225
|
exports.useRouteContext = useRouteContext.useRouteContext;
|
|
251
226
|
exports.useRouter = useRouter.useRouter;
|
|
252
227
|
exports.useRouterState = useRouterState.useRouterState;
|
|
253
228
|
exports.useLocation = useLocation.useLocation;
|
|
254
229
|
exports.useCanGoBack = useCanGoBack.useCanGoBack;
|
|
255
|
-
exports.useLayoutEffect = utils.useLayoutEffect;
|
|
256
230
|
exports.CatchNotFound = notFound.CatchNotFound;
|
|
257
231
|
exports.DefaultGlobalNotFound = notFound.DefaultGlobalNotFound;
|
|
258
232
|
exports.ScriptOnce = ScriptOnce.ScriptOnce;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.dev.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.dev.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -19,15 +19,5 @@ function _interopNamespaceDefault(e) {
|
|
|
19
19
|
}
|
|
20
20
|
const Solid__namespace = /* @__PURE__ */ _interopNamespaceDefault(Solid);
|
|
21
21
|
const routerContext = Solid__namespace.createContext(null);
|
|
22
|
-
|
|
23
|
-
if (typeof document === "undefined") {
|
|
24
|
-
return routerContext;
|
|
25
|
-
}
|
|
26
|
-
if (window.__TSR_ROUTER_CONTEXT__) {
|
|
27
|
-
return window.__TSR_ROUTER_CONTEXT__;
|
|
28
|
-
}
|
|
29
|
-
window.__TSR_ROUTER_CONTEXT__ = routerContext;
|
|
30
|
-
return routerContext;
|
|
31
|
-
}
|
|
32
|
-
exports.getRouterContext = getRouterContext;
|
|
22
|
+
exports.routerContext = routerContext;
|
|
33
23
|
//# sourceMappingURL=routerContext.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerContext.cjs","sources":["../../src/routerContext.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport type { AnyRouter } from '@tanstack/router-core'\n\
|
|
1
|
+
{"version":3,"file":"routerContext.cjs","sources":["../../src/routerContext.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport const routerContext = Solid.createContext<AnyRouter>(\n null as unknown as AnyRouter,\n)\n"],"names":["routerContext","Solid","createContext"],"mappings":";;;;;;;;;;;;;;;;;;;;AAGO,MAAMA,gBAAgBC,iBAAMC,cACjC,IACF;;"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { AnyRouter } from '@tanstack/router-core';
|
|
2
2
|
import * as Solid from 'solid-js';
|
|
3
|
-
declare
|
|
4
|
-
interface Window {
|
|
5
|
-
__TSR_ROUTER_CONTEXT__?: Solid.Context<AnyRouter>;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export declare function getRouterContext(): Solid.Context<AnyRouter>;
|
|
3
|
+
export declare const routerContext: Solid.Context<AnyRouter>;
|
package/dist/cjs/useRouter.cjs
CHANGED
|
@@ -21,7 +21,7 @@ function _interopNamespaceDefault(e) {
|
|
|
21
21
|
}
|
|
22
22
|
const Solid__namespace = /* @__PURE__ */ _interopNamespaceDefault(Solid);
|
|
23
23
|
function useRouter(opts) {
|
|
24
|
-
const value = Solid__namespace.useContext(routerContext.
|
|
24
|
+
const value = Solid__namespace.useContext(routerContext.routerContext);
|
|
25
25
|
warning(!((opts?.warn ?? true) && !value), "useRouter must be used inside a <RouterProvider> component!");
|
|
26
26
|
return value;
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRouter.cjs","sources":["../../src/useRouter.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport {
|
|
1
|
+
{"version":3,"file":"useRouter.cjs","sources":["../../src/useRouter.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { routerContext } from './routerContext'\nimport type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'\n\nexport function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {\n warn?: boolean\n}): TRouter {\n const value = Solid.useContext(routerContext as any)\n warning(\n !((opts?.warn ?? true) && !value),\n 'useRouter must be used inside a <RouterProvider> component!',\n )\n return value as any\n}\n"],"names":["useRouter","opts","value","Solid","useContext","routerContext","warning","warn"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAKO,SAASA,UAAwDC,MAE5D;AACV,QAAMC,QAAQC,iBAAMC,WAAWC,2BAAoB;AACnDC,UACE,GAAGL,MAAMM,QAAQ,SAAS,CAACL,QAC3B,6DACF;AACA,SAAOA;AACT;;"}
|
package/dist/cjs/utils.cjs
CHANGED
|
@@ -18,7 +18,6 @@ function _interopNamespaceDefault(e) {
|
|
|
18
18
|
return Object.freeze(n);
|
|
19
19
|
}
|
|
20
20
|
const Solid__namespace = /* @__PURE__ */ _interopNamespaceDefault(Solid);
|
|
21
|
-
const useLayoutEffect = typeof window !== "undefined" ? Solid__namespace.createRenderEffect : Solid__namespace.createEffect;
|
|
22
21
|
const usePrevious = (fn) => {
|
|
23
22
|
return Solid__namespace.createMemo(
|
|
24
23
|
(prev = {
|
|
@@ -53,6 +52,5 @@ function useIntersectionObserver(ref, callback, intersectionObserverOptions = {}
|
|
|
53
52
|
return () => observerRef;
|
|
54
53
|
}
|
|
55
54
|
exports.useIntersectionObserver = useIntersectionObserver;
|
|
56
|
-
exports.useLayoutEffect = useLayoutEffect;
|
|
57
55
|
exports.usePrevious = usePrevious;
|
|
58
56
|
//# sourceMappingURL=utils.cjs.map
|
package/dist/cjs/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport const
|
|
1
|
+
{"version":3,"file":"utils.cjs","sources":["../../src/utils.ts"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport const usePrevious = (fn: () => boolean) => {\n return Solid.createMemo(\n (\n prev: { current: boolean | null; previous: boolean | null } = {\n current: null,\n previous: null,\n },\n ) => {\n const current = fn()\n\n if (prev.current !== current) {\n prev.previous = prev.current\n prev.current = current\n }\n\n return prev\n },\n )\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param options - The options to pass to the hook\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * { rootMargin: '10px' },\n * { disabled: false }\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: Solid.Accessor<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n options: { disabled?: boolean } = {},\n): Solid.Accessor<IntersectionObserver | null> {\n const isIntersectionObserverAvailable =\n typeof IntersectionObserver === 'function'\n let observerRef: IntersectionObserver | null = null\n\n Solid.createEffect(() => {\n const r = ref()\n if (!r || !isIntersectionObserverAvailable || options.disabled) {\n return\n }\n\n observerRef = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observerRef.observe(r)\n\n Solid.onCleanup(() => {\n observerRef?.disconnect()\n })\n })\n\n return () => observerRef\n}\n"],"names":["Solid"],"mappings":";;;;;;;;;;;;;;;;;;;;AAEO,MAAM,cAAc,CAAC,OAAsB;AAChD,SAAOA,iBAAM;AAAA,IACX,CACE,OAA8D;AAAA,MAC5D,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,MAET;AACH,YAAM,UAAU,GAAA;AAEhB,UAAI,KAAK,YAAY,SAAS;AAC5B,aAAK,WAAW,KAAK;AACrB,aAAK,UAAU;AAAA,MACjB;AAEA,aAAO;AAAA,IACT;AAAA,EAAA;AAEJ;AA2BO,SAAS,wBACd,KACA,UACA,8BAAwD,CAAA,GACxD,UAAkC,IACW;AAC7C,QAAM,kCACJ,OAAO,yBAAyB;AAClC,MAAI,cAA2C;AAE/CA,mBAAM,aAAa,MAAM;AACvB,UAAM,IAAI,IAAA;AACV,QAAI,CAAC,KAAK,CAAC,mCAAmC,QAAQ,UAAU;AAC9D;AAAA,IACF;AAEA,kBAAc,IAAI,qBAAqB,CAAC,CAAC,KAAK,MAAM;AAClD,eAAS,KAAK;AAAA,IAChB,GAAG,2BAA2B;AAE9B,gBAAY,QAAQ,CAAC;AAErBA,qBAAM,UAAU,MAAM;AACpB,mBAAa,WAAA;AAAA,IACf,CAAC;AAAA,EACH,CAAC;AAED,SAAO,MAAM;AACf;;;"}
|
package/dist/cjs/utils.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createComponent, mergeProps } from "solid-js/web";
|
|
2
|
-
import {
|
|
2
|
+
import { routerContext } from "./routerContext.js";
|
|
3
3
|
import { SafeFragment } from "./SafeFragment.js";
|
|
4
4
|
import { Matches } from "./Matches.js";
|
|
5
5
|
function RouterContextProvider({
|
|
@@ -15,7 +15,6 @@ function RouterContextProvider({
|
|
|
15
15
|
...rest.context
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
-
const routerContext = getRouterContext();
|
|
19
18
|
const OptionalWrapper = router.options.Wrap || SafeFragment;
|
|
20
19
|
return createComponent(OptionalWrapper, {
|
|
21
20
|
get children() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterProvider.js","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"RouterProvider.js","sources":["../../src/RouterProvider.tsx"],"sourcesContent":["import { routerContext } from './routerContext'\nimport { SafeFragment } from './SafeFragment'\nimport { Matches } from './Matches'\nimport type {\n AnyRouter,\n RegisteredRouter,\n RouterOptions,\n} from '@tanstack/router-core'\nimport type * as Solid from 'solid-js'\n\nexport function RouterContextProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({\n router,\n children,\n ...rest\n}: RouterProps<TRouter, TDehydrated> & {\n children: () => Solid.JSX.Element\n}) {\n // Allow the router to update options on the router instance\n router.update({\n ...router.options,\n ...rest,\n context: {\n ...router.options.context,\n ...rest.context,\n },\n })\n\n const OptionalWrapper = router.options.Wrap || SafeFragment\n\n return (\n <OptionalWrapper>\n <routerContext.Provider value={router as AnyRouter}>\n {children()}\n </routerContext.Provider>\n </OptionalWrapper>\n )\n}\n\nexport function RouterProvider<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n>({ router, ...rest }: RouterProps<TRouter, TDehydrated>) {\n return (\n <RouterContextProvider router={router} {...rest}>\n {() => <Matches />}\n </RouterContextProvider>\n )\n}\n\nexport type RouterProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TDehydrated extends Record<string, any> = Record<string, any>,\n> = Omit<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >,\n 'context'\n> & {\n router: TRouter\n context?: Partial<\n RouterOptions<\n TRouter['routeTree'],\n NonNullable<TRouter['options']['trailingSlash']>,\n false,\n TRouter['history'],\n TDehydrated\n >['context']\n >\n}\n"],"names":["RouterContextProvider","router","children","rest","update","options","context","OptionalWrapper","Wrap","SafeFragment","_$createComponent","routerContext","Provider","value","RouterProvider","_$mergeProps","Matches"],"mappings":";;;;AAUO,SAASA,sBAGd;AAAA,EACAC;AAAAA,EACAC;AAAAA,EACA,GAAGC;AAGL,GAAG;AAEDF,SAAOG,OAAO;AAAA,IACZ,GAAGH,OAAOI;AAAAA,IACV,GAAGF;AAAAA,IACHG,SAAS;AAAA,MACP,GAAGL,OAAOI,QAAQC;AAAAA,MAClB,GAAGH,KAAKG;AAAAA,IAAAA;AAAAA,EACV,CACD;AAED,QAAMC,kBAAkBN,OAAOI,QAAQG,QAAQC;AAE/C,SAAAC,gBACGH,iBAAe;AAAA,IAAA,IAAAL,WAAA;AAAA,aAAAQ,gBACbC,cAAcC,UAAQ;AAAA,QAACC,OAAOZ;AAAAA,QAAmB,IAAAC,WAAA;AAAA,iBAC/CA,SAAAA;AAAAA,QAAU;AAAA,MAAA,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA;AAInB;AAEO,SAASY,eAGd;AAAA,EAAEb;AAAAA,EAAQ,GAAGE;AAAwC,GAAG;AACxD,SAAAO,gBACGV,uBAAqBe,WAAA;AAAA,IAACd;AAAAA,EAAAA,GAAoBE,MAAI;AAAA,IAAAD,UAC5CA,MAAAQ,gBAAOM,SAAO,CAAA,CAAA;AAAA,EAAA,CAAG,CAAA;AAGxB;"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defer,
|
|
1
|
+
export { defer, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, interpolatePath, rootRouteId, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, createControlledPromise, retainSearchParams, stripSearchParams, createSerializationAdapter, } from '@tanstack/router-core';
|
|
2
2
|
export type { DeferredPromiseState, DeferredPromise, ParsedLocation, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, ResolveOptionalParams, ResolveRequiredParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, NavigateFn, BuildLocationFn, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, Register, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, AnyRouterWithContext, ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, AllLoaderData, FullSearchSchemaInput, AllContext, CommitLocationOptions, MatchLocation, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllParamsFromParent, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, FullSearchSchemaOption, MakeRemountDepsOptionsUnion, RemountDepsOptions, FileRouteTypes, FileRoutesByPath, UseNavigateResult, AnyRedirect, Redirect, RedirectOptions, ResolvedRedirect, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, RouteContextFn, RouteContextOptions, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, AnyRouteWithContext, LazyRouteOptions, AnyRoute, ResolveFullPath, RouteConstraints, RouterState, ListenerFn, BuildNextOptions, AnyRouter, RegisteredRouter, RouterEvents, RouterEvent, RouterListener, MatchRouteOptions, RouteMask, RouterContextOptions, RouterOptions, RouterConstructorOptions, ControllablePromise, InjectedHtmlEntry, CreateFileRoute, CreateLazyFileRoute, AnySerializationAdapter, SerializationAdapter, SerializableExtensions, } from '@tanstack/router-core';
|
|
3
3
|
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
|
|
4
4
|
export type { BlockerFn, HistoryLocation, RouterHistory, ParsedPath, HistoryState, } from '@tanstack/history';
|
|
@@ -13,7 +13,6 @@ export { useLinkProps, createLink, Link, linkOptions } from './link.js';
|
|
|
13
13
|
export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentProps, CreateLinkProps, } from './link.js';
|
|
14
14
|
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches.js';
|
|
15
15
|
export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches.js';
|
|
16
|
-
export { matchContext } from './matchContext.js';
|
|
17
16
|
export { Match, Outlet } from './Match.js';
|
|
18
17
|
export { useMatch } from './useMatch.js';
|
|
19
18
|
export { useLoaderDeps } from './useLoaderDeps.js';
|
|
@@ -22,7 +21,7 @@ export { redirect, isRedirect, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/rou
|
|
|
22
21
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route.js';
|
|
23
22
|
export type { AnyRootRoute, SolidNode, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, } from './route.js';
|
|
24
23
|
export { createRouter, Router } from './router.js';
|
|
25
|
-
export {
|
|
24
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core';
|
|
26
25
|
export { RouterProvider, RouterContextProvider } from './RouterProvider.js';
|
|
27
26
|
export type { RouterProps } from './RouterProvider.js';
|
|
28
27
|
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration.js';
|
|
@@ -31,13 +30,11 @@ export { useBlocker, Block } from './useBlocker.js';
|
|
|
31
30
|
export { useNavigate, Navigate } from './useNavigate.js';
|
|
32
31
|
export { useParams } from './useParams.js';
|
|
33
32
|
export { useSearch } from './useSearch.js';
|
|
34
|
-
export { getRouterContext, } from './routerContext.js';
|
|
35
33
|
export { useRouteContext } from './useRouteContext.js';
|
|
36
34
|
export { useRouter } from './useRouter.js';
|
|
37
35
|
export { useRouterState } from './useRouterState.js';
|
|
38
36
|
export { useLocation } from './useLocation.js';
|
|
39
37
|
export { useCanGoBack } from './useCanGoBack.js';
|
|
40
|
-
export { useLayoutEffect } from './utils.js';
|
|
41
38
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found.js';
|
|
42
39
|
export { notFound, isNotFound } from '@tanstack/router-core';
|
|
43
40
|
export type { NotFoundError } from '@tanstack/router-core';
|
package/dist/esm/index.dev.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PROTOCOL_ALLOWLIST,
|
|
1
|
+
import { DEFAULT_PROTOCOL_ALLOWLIST, SearchParamError, cleanPath, composeRewrites, createControlledPromise, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight } from "@tanstack/router-core";
|
|
2
2
|
import { createBrowserHistory, createHashHistory, createHistory, createMemoryHistory } from "@tanstack/history";
|
|
3
3
|
import { Await, useAwaited } from "./awaited.js";
|
|
4
4
|
import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
|
|
@@ -7,7 +7,6 @@ import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileR
|
|
|
7
7
|
import { lazyRouteComponent } from "./lazyRouteComponent.js";
|
|
8
8
|
import { Link, createLink, linkOptions, useLinkProps } from "./link.js";
|
|
9
9
|
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
10
|
-
import { matchContext } from "./matchContext.js";
|
|
11
10
|
import { Match, Outlet } from "./Match.js";
|
|
12
11
|
import { useMatch } from "./useMatch.js";
|
|
13
12
|
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
@@ -20,13 +19,11 @@ import { Block, useBlocker } from "./useBlocker.js";
|
|
|
20
19
|
import { Navigate, useNavigate } from "./useNavigate.js";
|
|
21
20
|
import { useParams } from "./useParams.js";
|
|
22
21
|
import { useSearch } from "./useSearch.js";
|
|
23
|
-
import { getRouterContext } from "./routerContext.js";
|
|
24
22
|
import { useRouteContext } from "./useRouteContext.js";
|
|
25
23
|
import { useRouter } from "./useRouter.js";
|
|
26
24
|
import { useRouterState } from "./useRouterState.js";
|
|
27
25
|
import { useLocation } from "./useLocation.js";
|
|
28
26
|
import { useCanGoBack } from "./useCanGoBack.js";
|
|
29
|
-
import { useLayoutEffect } from "./utils.js";
|
|
30
27
|
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
31
28
|
import { ScriptOnce } from "./ScriptOnce.js";
|
|
32
29
|
import { Asset } from "./Asset.js";
|
|
@@ -54,7 +51,6 @@ export {
|
|
|
54
51
|
Navigate,
|
|
55
52
|
NotFoundRoute,
|
|
56
53
|
Outlet,
|
|
57
|
-
PathParamError,
|
|
58
54
|
RootRoute,
|
|
59
55
|
Route,
|
|
60
56
|
RouteApi,
|
|
@@ -65,9 +61,7 @@ export {
|
|
|
65
61
|
Scripts,
|
|
66
62
|
ScrollRestoration,
|
|
67
63
|
SearchParamError,
|
|
68
|
-
TSR_DEFERRED_PROMISE,
|
|
69
64
|
cleanPath,
|
|
70
|
-
componentTypes,
|
|
71
65
|
composeRewrites,
|
|
72
66
|
createBrowserHistory,
|
|
73
67
|
createControlledPromise,
|
|
@@ -86,13 +80,10 @@ export {
|
|
|
86
80
|
createSerializationAdapter,
|
|
87
81
|
deepEqual,
|
|
88
82
|
defaultParseSearch,
|
|
89
|
-
defaultSerializeError,
|
|
90
83
|
defaultStringifySearch,
|
|
91
84
|
defer,
|
|
92
85
|
functionalUpdate,
|
|
93
|
-
getInitialRouterState,
|
|
94
86
|
getRouteApi,
|
|
95
|
-
getRouterContext,
|
|
96
87
|
interpolatePath,
|
|
97
88
|
isMatch,
|
|
98
89
|
isNotFound,
|
|
@@ -103,7 +94,6 @@ export {
|
|
|
103
94
|
lazyFn,
|
|
104
95
|
lazyRouteComponent,
|
|
105
96
|
linkOptions,
|
|
106
|
-
matchContext,
|
|
107
97
|
notFound,
|
|
108
98
|
parseSearchWith,
|
|
109
99
|
redirect,
|
|
@@ -123,7 +113,6 @@ export {
|
|
|
123
113
|
useChildMatches,
|
|
124
114
|
useElementScrollRestoration,
|
|
125
115
|
useHydrated,
|
|
126
|
-
useLayoutEffect,
|
|
127
116
|
useLinkProps,
|
|
128
117
|
useLoaderData,
|
|
129
118
|
useLoaderDeps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.dev.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.dev.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_PROTOCOL_ALLOWLIST,
|
|
1
|
+
import { DEFAULT_PROTOCOL_ALLOWLIST, SearchParamError, cleanPath, composeRewrites, createControlledPromise, createSerializationAdapter, deepEqual, defaultParseSearch, defaultStringifySearch, defer, functionalUpdate, interpolatePath, isMatch, isNotFound, isPlainArray, isPlainObject, isRedirect, joinPaths, lazyFn, notFound, parseSearchWith, redirect, replaceEqualDeep, resolvePath, retainSearchParams, rootRouteId, stringifySearchWith, stripSearchParams, trimPath, trimPathLeft, trimPathRight } from "@tanstack/router-core";
|
|
2
2
|
import { createBrowserHistory, createHashHistory, createHistory, createMemoryHistory } from "@tanstack/history";
|
|
3
3
|
import { Await, useAwaited } from "./awaited.js";
|
|
4
4
|
import { CatchBoundary, ErrorComponent } from "./CatchBoundary.js";
|
|
@@ -7,7 +7,6 @@ import { FileRoute, FileRouteLoader, LazyRoute, createFileRoute, createLazyFileR
|
|
|
7
7
|
import { lazyRouteComponent } from "./lazyRouteComponent.js";
|
|
8
8
|
import { Link, createLink, linkOptions, useLinkProps } from "./link.js";
|
|
9
9
|
import { MatchRoute, Matches, useChildMatches, useMatchRoute, useMatches, useParentMatches } from "./Matches.js";
|
|
10
|
-
import { matchContext } from "./matchContext.js";
|
|
11
10
|
import { Match, Outlet } from "./Match.js";
|
|
12
11
|
import { useMatch } from "./useMatch.js";
|
|
13
12
|
import { useLoaderDeps } from "./useLoaderDeps.js";
|
|
@@ -20,13 +19,11 @@ import { Block, useBlocker } from "./useBlocker.js";
|
|
|
20
19
|
import { Navigate, useNavigate } from "./useNavigate.js";
|
|
21
20
|
import { useParams } from "./useParams.js";
|
|
22
21
|
import { useSearch } from "./useSearch.js";
|
|
23
|
-
import { getRouterContext } from "./routerContext.js";
|
|
24
22
|
import { useRouteContext } from "./useRouteContext.js";
|
|
25
23
|
import { useRouter } from "./useRouter.js";
|
|
26
24
|
import { useRouterState } from "./useRouterState.js";
|
|
27
25
|
import { useLocation } from "./useLocation.js";
|
|
28
26
|
import { useCanGoBack } from "./useCanGoBack.js";
|
|
29
|
-
import { useLayoutEffect } from "./utils.js";
|
|
30
27
|
import { CatchNotFound, DefaultGlobalNotFound } from "./not-found.js";
|
|
31
28
|
import { ScriptOnce } from "./ScriptOnce.js";
|
|
32
29
|
import { Asset } from "./Asset.js";
|
|
@@ -54,7 +51,6 @@ export {
|
|
|
54
51
|
Navigate,
|
|
55
52
|
NotFoundRoute,
|
|
56
53
|
Outlet,
|
|
57
|
-
PathParamError,
|
|
58
54
|
RootRoute,
|
|
59
55
|
Route,
|
|
60
56
|
RouteApi,
|
|
@@ -65,9 +61,7 @@ export {
|
|
|
65
61
|
Scripts,
|
|
66
62
|
ScrollRestoration,
|
|
67
63
|
SearchParamError,
|
|
68
|
-
TSR_DEFERRED_PROMISE,
|
|
69
64
|
cleanPath,
|
|
70
|
-
componentTypes,
|
|
71
65
|
composeRewrites,
|
|
72
66
|
createBrowserHistory,
|
|
73
67
|
createControlledPromise,
|
|
@@ -86,13 +80,10 @@ export {
|
|
|
86
80
|
createSerializationAdapter,
|
|
87
81
|
deepEqual,
|
|
88
82
|
defaultParseSearch,
|
|
89
|
-
defaultSerializeError,
|
|
90
83
|
defaultStringifySearch,
|
|
91
84
|
defer,
|
|
92
85
|
functionalUpdate,
|
|
93
|
-
getInitialRouterState,
|
|
94
86
|
getRouteApi,
|
|
95
|
-
getRouterContext,
|
|
96
87
|
interpolatePath,
|
|
97
88
|
isMatch,
|
|
98
89
|
isNotFound,
|
|
@@ -103,7 +94,6 @@ export {
|
|
|
103
94
|
lazyFn,
|
|
104
95
|
lazyRouteComponent,
|
|
105
96
|
linkOptions,
|
|
106
|
-
matchContext,
|
|
107
97
|
notFound,
|
|
108
98
|
parseSearchWith,
|
|
109
99
|
redirect,
|
|
@@ -123,7 +113,6 @@ export {
|
|
|
123
113
|
useChildMatches,
|
|
124
114
|
useElementScrollRestoration,
|
|
125
115
|
useHydrated,
|
|
126
|
-
useLayoutEffect,
|
|
127
116
|
useLinkProps,
|
|
128
117
|
useLoaderData,
|
|
129
118
|
useLoaderDeps,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import { AnyRouter } from '@tanstack/router-core';
|
|
2
2
|
import * as Solid from 'solid-js';
|
|
3
|
-
declare
|
|
4
|
-
interface Window {
|
|
5
|
-
__TSR_ROUTER_CONTEXT__?: Solid.Context<AnyRouter>;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export declare function getRouterContext(): Solid.Context<AnyRouter>;
|
|
3
|
+
export declare const routerContext: Solid.Context<AnyRouter>;
|
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import * as Solid from "solid-js";
|
|
2
2
|
const routerContext = Solid.createContext(null);
|
|
3
|
-
function getRouterContext() {
|
|
4
|
-
if (typeof document === "undefined") {
|
|
5
|
-
return routerContext;
|
|
6
|
-
}
|
|
7
|
-
if (window.__TSR_ROUTER_CONTEXT__) {
|
|
8
|
-
return window.__TSR_ROUTER_CONTEXT__;
|
|
9
|
-
}
|
|
10
|
-
window.__TSR_ROUTER_CONTEXT__ = routerContext;
|
|
11
|
-
return routerContext;
|
|
12
|
-
}
|
|
13
3
|
export {
|
|
14
|
-
|
|
4
|
+
routerContext
|
|
15
5
|
};
|
|
16
6
|
//# sourceMappingURL=routerContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerContext.js","sources":["../../src/routerContext.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport type { AnyRouter } from '@tanstack/router-core'\n\
|
|
1
|
+
{"version":3,"file":"routerContext.js","sources":["../../src/routerContext.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport const routerContext = Solid.createContext<AnyRouter>(\n null as unknown as AnyRouter,\n)\n"],"names":["routerContext","Solid","createContext"],"mappings":";AAGO,MAAMA,gBAAgBC,MAAMC,cACjC,IACF;"}
|
package/dist/esm/useRouter.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Solid from "solid-js";
|
|
2
2
|
import warning from "tiny-warning";
|
|
3
|
-
import {
|
|
3
|
+
import { routerContext } from "./routerContext.js";
|
|
4
4
|
function useRouter(opts) {
|
|
5
|
-
const value = Solid.useContext(
|
|
5
|
+
const value = Solid.useContext(routerContext);
|
|
6
6
|
warning(!((opts?.warn ?? true) && !value), "useRouter must be used inside a <RouterProvider> component!");
|
|
7
7
|
return value;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRouter.js","sources":["../../src/useRouter.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport {
|
|
1
|
+
{"version":3,"file":"useRouter.js","sources":["../../src/useRouter.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport warning from 'tiny-warning'\nimport { routerContext } from './routerContext'\nimport type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'\n\nexport function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {\n warn?: boolean\n}): TRouter {\n const value = Solid.useContext(routerContext as any)\n warning(\n !((opts?.warn ?? true) && !value),\n 'useRouter must be used inside a <RouterProvider> component!',\n )\n return value as any\n}\n"],"names":["useRouter","opts","value","Solid","useContext","routerContext","warning","warn"],"mappings":";;;AAKO,SAASA,UAAwDC,MAE5D;AACV,QAAMC,QAAQC,MAAMC,WAAWC,aAAoB;AACnDC,UACE,GAAGL,MAAMM,QAAQ,SAAS,CAACL,QAC3B,6DACF;AACA,SAAOA;AACT;"}
|
package/dist/esm/utils.d.ts
CHANGED
package/dist/esm/utils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as Solid from "solid-js";
|
|
2
|
-
const useLayoutEffect = typeof window !== "undefined" ? Solid.createRenderEffect : Solid.createEffect;
|
|
3
2
|
const usePrevious = (fn) => {
|
|
4
3
|
return Solid.createMemo(
|
|
5
4
|
(prev = {
|
|
@@ -35,7 +34,6 @@ function useIntersectionObserver(ref, callback, intersectionObserverOptions = {}
|
|
|
35
34
|
}
|
|
36
35
|
export {
|
|
37
36
|
useIntersectionObserver,
|
|
38
|
-
useLayoutEffect,
|
|
39
37
|
usePrevious
|
|
40
38
|
};
|
|
41
39
|
//# sourceMappingURL=utils.js.map
|
package/dist/esm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport const
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../src/utils.ts"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport const usePrevious = (fn: () => boolean) => {\n return Solid.createMemo(\n (\n prev: { current: boolean | null; previous: boolean | null } = {\n current: null,\n previous: null,\n },\n ) => {\n const current = fn()\n\n if (prev.current !== current) {\n prev.previous = prev.current\n prev.current = current\n }\n\n return prev\n },\n )\n}\n\n/**\n * React hook to wrap `IntersectionObserver`.\n *\n * This hook will create an `IntersectionObserver` and observe the ref passed to it.\n *\n * When the intersection changes, the callback will be called with the `IntersectionObserverEntry`.\n *\n * @param ref - The ref to observe\n * @param intersectionObserverOptions - The options to pass to the IntersectionObserver\n * @param options - The options to pass to the hook\n * @param callback - The callback to call when the intersection changes\n * @returns The IntersectionObserver instance\n * @example\n * ```tsx\n * const MyComponent = () => {\n * const ref = React.useRef<HTMLDivElement>(null)\n * useIntersectionObserver(\n * ref,\n * (entry) => { doSomething(entry) },\n * { rootMargin: '10px' },\n * { disabled: false }\n * )\n * return <div ref={ref} />\n * ```\n */\nexport function useIntersectionObserver<T extends Element>(\n ref: Solid.Accessor<T | null>,\n callback: (entry: IntersectionObserverEntry | undefined) => void,\n intersectionObserverOptions: IntersectionObserverInit = {},\n options: { disabled?: boolean } = {},\n): Solid.Accessor<IntersectionObserver | null> {\n const isIntersectionObserverAvailable =\n typeof IntersectionObserver === 'function'\n let observerRef: IntersectionObserver | null = null\n\n Solid.createEffect(() => {\n const r = ref()\n if (!r || !isIntersectionObserverAvailable || options.disabled) {\n return\n }\n\n observerRef = new IntersectionObserver(([entry]) => {\n callback(entry)\n }, intersectionObserverOptions)\n\n observerRef.observe(r)\n\n Solid.onCleanup(() => {\n observerRef?.disconnect()\n })\n })\n\n return () => observerRef\n}\n"],"names":[],"mappings":";AAEO,MAAM,cAAc,CAAC,OAAsB;AAChD,SAAO,MAAM;AAAA,IACX,CACE,OAA8D;AAAA,MAC5D,SAAS;AAAA,MACT,UAAU;AAAA,IAAA,MAET;AACH,YAAM,UAAU,GAAA;AAEhB,UAAI,KAAK,YAAY,SAAS;AAC5B,aAAK,WAAW,KAAK;AACrB,aAAK,UAAU;AAAA,MACjB;AAEA,aAAO;AAAA,IACT;AAAA,EAAA;AAEJ;AA2BO,SAAS,wBACd,KACA,UACA,8BAAwD,CAAA,GACxD,UAAkC,IACW;AAC7C,QAAM,kCACJ,OAAO,yBAAyB;AAClC,MAAI,cAA2C;AAE/C,QAAM,aAAa,MAAM;AACvB,UAAM,IAAI,IAAA;AACV,QAAI,CAAC,KAAK,CAAC,mCAAmC,QAAQ,UAAU;AAC9D;AAAA,IACF;AAEA,kBAAc,IAAI,qBAAqB,CAAC,CAAC,KAAK,MAAM;AAClD,eAAS,KAAK;AAAA,IAChB,GAAG,2BAA2B;AAE9B,gBAAY,QAAQ,CAAC;AAErB,UAAM,UAAU,MAAM;AACpB,mBAAa,WAAA;AAAA,IACf,CAAC;AAAA,EACH,CAAC;AAED,SAAO,MAAM;AACf;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { routerContext } from './routerContext';
|
|
2
2
|
import { SafeFragment } from './SafeFragment';
|
|
3
3
|
import { Matches } from './Matches';
|
|
4
4
|
export function RouterContextProvider({ router, children, ...rest }) {
|
|
@@ -11,7 +11,6 @@ export function RouterContextProvider({ router, children, ...rest }) {
|
|
|
11
11
|
...rest.context,
|
|
12
12
|
},
|
|
13
13
|
});
|
|
14
|
-
const routerContext = getRouterContext();
|
|
15
14
|
const OptionalWrapper = router.options.Wrap || SafeFragment;
|
|
16
15
|
return (<OptionalWrapper>
|
|
17
16
|
<routerContext.Provider value={router}>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterProvider.jsx","sourceRoot":"","sources":["../../src/RouterProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"RouterProvider.jsx","sourceRoot":"","sources":["../../src/RouterProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC,MAAM,UAAU,qBAAqB,CAGnC,EACA,MAAM,EACN,QAAQ,EACR,GAAG,IAAI,EAGR;IACC,4DAA4D;IAC5D,MAAM,CAAC,MAAM,CAAC;QACZ,GAAG,MAAM,CAAC,OAAO;QACjB,GAAG,IAAI;QACP,OAAO,EAAE;YACP,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO;YACzB,GAAG,IAAI,CAAC,OAAO;SAChB;KACF,CAAC,CAAA;IAEF,MAAM,eAAe,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,YAAY,CAAA;IAE3D,OAAO,CACL,CAAC,eAAe,CACd;MAAA,CAAC,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,MAAmB,CAAC,CACjD;QAAA,CAAC,QAAQ,EAAE,CACb;MAAA,EAAE,aAAa,CAAC,QAAQ,CAC1B;IAAA,EAAE,eAAe,CAAC,CACnB,CAAA;AACH,CAAC;AAED,MAAM,UAAU,cAAc,CAG5B,EAAE,MAAM,EAAE,GAAG,IAAI,EAAqC;IACtD,OAAO,CACL,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,CAC9C;MAAA,CAAC,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,AAAD,EAAG,CACpB;IAAA,EAAE,qBAAqB,CAAC,CACzB,CAAA;AACH,CAAC"}
|
package/dist/source/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defer,
|
|
1
|
+
export { defer, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, interpolatePath, rootRouteId, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, createControlledPromise, retainSearchParams, stripSearchParams, createSerializationAdapter, } from '@tanstack/router-core';
|
|
2
2
|
export type { DeferredPromiseState, DeferredPromise, ParsedLocation, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, ResolveRelativePath, RootRouteId, AnyPathParams, ResolveParams, ResolveOptionalParams, ResolveRequiredParams, SearchSchemaInput, AnyContext, RouteContext, PreloadableObj, RoutePathOptions, StaticDataRouteOption, RoutePathOptionsIntersection, UpdatableStaticRouteOption, MetaDescriptor, RouteLinkEntry, ParseParamsFn, SearchFilter, ResolveId, InferFullSearchSchema, InferFullSearchSchemaInput, ErrorRouteProps, ErrorComponentProps, NotFoundRouteProps, TrimPath, TrimPathLeft, TrimPathRight, StringifyParamsFn, ParamsOptions, InferAllParams, InferAllContext, LooseReturnType, LooseAsyncReturnType, ContextReturnType, ContextAsyncReturnType, ResolveLoaderData, ResolveRouteContext, SearchSerializer, SearchParser, TrailingSlashOption, Manifest, RouterManagedTag, ControlledPromise, Constrain, Expand, MergeAll, Assign, IntersectAssign, ResolveValidatorInput, ResolveValidatorOutput, AnyValidator, DefaultValidator, ValidatorFn, AnySchema, AnyValidatorAdapter, AnyValidatorFn, AnyValidatorObj, ResolveValidatorInputFn, ResolveValidatorOutputFn, ResolveSearchValidatorInput, ResolveSearchValidatorInputFn, Validator, ValidatorAdapter, ValidatorObj, NavigateFn, BuildLocationFn, InferDescendantToPaths, RelativeToPath, RelativeToParentPath, RelativeToCurrentPath, Register, AbsoluteToPath, RelativeToPathAutoComplete, NavigateOptions, ToOptions, ToMaskOptions, ToSubOptions, ResolveRoute, SearchParamOptions, PathParamOptions, ToPathOption, LinkOptions, MakeOptionalPathParams, AnyRouterWithContext, ParseRoute, RoutesById, RouteById, RouteIds, RoutesByPath, RouteByPath, RoutePaths, FullSearchSchema, AllParams, AllLoaderData, FullSearchSchemaInput, AllContext, CommitLocationOptions, MatchLocation, ResolveFullSearchSchema, ResolveFullSearchSchemaInput, ResolveAllParamsFromParent, RouteContextParameter, BeforeLoadContextParameter, ResolveAllContext, FullSearchSchemaOption, MakeRemountDepsOptionsUnion, RemountDepsOptions, FileRouteTypes, FileRoutesByPath, UseNavigateResult, AnyRedirect, Redirect, RedirectOptions, ResolvedRedirect, RouteOptions, FileBaseRouteOptions, BaseRouteOptions, UpdatableRouteOptions, RouteLoaderFn, LoaderFnContext, MakeRouteMatch, MakeRouteMatchUnion, RouteMatch, AnyRouteMatch, RouteContextFn, RouteContextOptions, BeforeLoadContextOptions, ContextOptions, RootRouteOptions, AnyRouteWithContext, LazyRouteOptions, AnyRoute, ResolveFullPath, RouteConstraints, RouterState, ListenerFn, BuildNextOptions, AnyRouter, RegisteredRouter, RouterEvents, RouterEvent, RouterListener, MatchRouteOptions, RouteMask, RouterContextOptions, RouterOptions, RouterConstructorOptions, ControllablePromise, InjectedHtmlEntry, CreateFileRoute, CreateLazyFileRoute, AnySerializationAdapter, SerializationAdapter, SerializableExtensions, } from '@tanstack/router-core';
|
|
3
3
|
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
|
|
4
4
|
export type { BlockerFn, HistoryLocation, RouterHistory, ParsedPath, HistoryState, } from '@tanstack/history';
|
|
@@ -13,7 +13,6 @@ export { useLinkProps, createLink, Link, linkOptions } from './link';
|
|
|
13
13
|
export type { UseLinkPropsOptions, ActiveLinkOptions, LinkProps, LinkComponent, LinkComponentProps, CreateLinkProps, } from './link';
|
|
14
14
|
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches';
|
|
15
15
|
export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches';
|
|
16
|
-
export { matchContext } from './matchContext';
|
|
17
16
|
export { Match, Outlet } from './Match';
|
|
18
17
|
export { useMatch } from './useMatch';
|
|
19
18
|
export { useLoaderDeps } from './useLoaderDeps';
|
|
@@ -22,7 +21,7 @@ export { redirect, isRedirect, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/rou
|
|
|
22
21
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route';
|
|
23
22
|
export type { AnyRootRoute, SolidNode, AsyncRouteComponent, RouteComponent, ErrorRouteComponent, NotFoundRouteComponent, } from './route';
|
|
24
23
|
export { createRouter, Router } from './router';
|
|
25
|
-
export {
|
|
24
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core';
|
|
26
25
|
export { RouterProvider, RouterContextProvider } from './RouterProvider';
|
|
27
26
|
export type { RouterProps } from './RouterProvider';
|
|
28
27
|
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration';
|
|
@@ -31,13 +30,11 @@ export { useBlocker, Block } from './useBlocker';
|
|
|
31
30
|
export { useNavigate, Navigate } from './useNavigate';
|
|
32
31
|
export { useParams } from './useParams';
|
|
33
32
|
export { useSearch } from './useSearch';
|
|
34
|
-
export { getRouterContext, } from './routerContext';
|
|
35
33
|
export { useRouteContext } from './useRouteContext';
|
|
36
34
|
export { useRouter } from './useRouter';
|
|
37
35
|
export { useRouterState } from './useRouterState';
|
|
38
36
|
export { useLocation } from './useLocation';
|
|
39
37
|
export { useCanGoBack } from './useCanGoBack';
|
|
40
|
-
export { useLayoutEffect } from './utils';
|
|
41
38
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found';
|
|
42
39
|
export { notFound, isNotFound } from '@tanstack/router-core';
|
|
43
40
|
export type { NotFoundError } from '@tanstack/router-core';
|
package/dist/source/index.jsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { defer,
|
|
1
|
+
export { defer, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, interpolatePath, rootRouteId, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, createControlledPromise, retainSearchParams, stripSearchParams, createSerializationAdapter, } from '@tanstack/router-core';
|
|
2
2
|
export { createHistory, createBrowserHistory, createHashHistory, createMemoryHistory, } from '@tanstack/history';
|
|
3
3
|
export { useAwaited, Await } from './awaited';
|
|
4
4
|
export { CatchBoundary, ErrorComponent } from './CatchBoundary';
|
|
@@ -8,7 +8,6 @@ export * from './history';
|
|
|
8
8
|
export { lazyRouteComponent } from './lazyRouteComponent';
|
|
9
9
|
export { useLinkProps, createLink, Link, linkOptions } from './link';
|
|
10
10
|
export { Matches, useMatchRoute, MatchRoute, useMatches, useParentMatches, useChildMatches, } from './Matches';
|
|
11
|
-
export { matchContext } from './matchContext';
|
|
12
11
|
export { Match, Outlet } from './Match';
|
|
13
12
|
export { useMatch } from './useMatch';
|
|
14
13
|
export { useLoaderDeps } from './useLoaderDeps';
|
|
@@ -16,21 +15,18 @@ export { useLoaderData } from './useLoaderData';
|
|
|
16
15
|
export { redirect, isRedirect, DEFAULT_PROTOCOL_ALLOWLIST, } from '@tanstack/router-core';
|
|
17
16
|
export { RouteApi, getRouteApi, Route, createRoute, RootRoute, rootRouteWithContext, createRootRoute, createRootRouteWithContext, createRouteMask, NotFoundRoute, } from './route';
|
|
18
17
|
export { createRouter, Router } from './router';
|
|
19
|
-
export {
|
|
18
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core';
|
|
20
19
|
export { RouterProvider, RouterContextProvider } from './RouterProvider';
|
|
21
20
|
export { useElementScrollRestoration, ScrollRestoration, } from './ScrollRestoration';
|
|
22
21
|
export { useBlocker, Block } from './useBlocker';
|
|
23
22
|
export { useNavigate, Navigate } from './useNavigate';
|
|
24
23
|
export { useParams } from './useParams';
|
|
25
24
|
export { useSearch } from './useSearch';
|
|
26
|
-
export { getRouterContext, // SSR
|
|
27
|
-
} from './routerContext';
|
|
28
25
|
export { useRouteContext } from './useRouteContext';
|
|
29
26
|
export { useRouter } from './useRouter';
|
|
30
27
|
export { useRouterState } from './useRouterState';
|
|
31
28
|
export { useLocation } from './useLocation';
|
|
32
29
|
export { useCanGoBack } from './useCanGoBack';
|
|
33
|
-
export { useLayoutEffect } from './utils';
|
|
34
30
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found';
|
|
35
31
|
export { notFound, isNotFound } from '@tanstack/router-core';
|
|
36
32
|
export { ScriptOnce } from './ScriptOnce';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,
|
|
1
|
+
{"version":3,"file":"index.jsx","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,OAAO,EACP,SAAS,EACT,SAAS,EACT,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,WAAW,EACX,eAAe,EACf,WAAW,EACX,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,SAAS,EACT,uBAAuB,EACvB,kBAAkB,EAClB,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAA;AAqK9B,OAAO,EACL,aAAa,EACb,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,mBAAmB,CAAA;AAU1B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,WAAW,CAAA;AAG7C,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAC/D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAEtD,OAAO,EACL,SAAS,EACT,eAAe,EACf,eAAe,EACf,SAAS,EACT,eAAe,EACf,mBAAmB,GACpB,MAAM,aAAa,CAAA;AAEpB,cAAc,WAAW,CAAA;AAEzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;AAEzD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAUpE,OAAO,EACL,OAAO,EACP,aAAa,EACb,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,eAAe,GAChB,MAAM,WAAW,CAAA;AAIlB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEvC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAE/C,OAAO,EACL,QAAQ,EACR,UAAU,EACV,0BAA0B,GAC3B,MAAM,uBAAuB,CAAA;AAE9B,OAAO,EACL,QAAQ,EACR,WAAW,EACX,KAAK,EACL,WAAW,EACX,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,0BAA0B,EAC1B,eAAe,EACf,aAAa,GACd,MAAM,SAAS,CAAA;AAUhB,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAE/C,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAEhE,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAA;AAGxE,OAAO,EACL,2BAA2B,EAC3B,iBAAiB,GAClB,MAAM,qBAAqB,CAAA;AAG5B,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAEhD,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AAClE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAA;AA+B5D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAEzC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import * as Solid from 'solid-js';
|
|
2
2
|
import type { AnyRouter } from '@tanstack/router-core';
|
|
3
|
-
declare
|
|
4
|
-
interface Window {
|
|
5
|
-
__TSR_ROUTER_CONTEXT__?: Solid.Context<AnyRouter>;
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
export declare function getRouterContext(): Solid.Context<AnyRouter>;
|
|
3
|
+
export declare const routerContext: Solid.Context<AnyRouter>;
|
|
@@ -1,13 +1,3 @@
|
|
|
1
1
|
import * as Solid from 'solid-js';
|
|
2
|
-
const routerContext = Solid.createContext(null);
|
|
3
|
-
export function getRouterContext() {
|
|
4
|
-
if (typeof document === 'undefined') {
|
|
5
|
-
return routerContext;
|
|
6
|
-
}
|
|
7
|
-
if (window.__TSR_ROUTER_CONTEXT__) {
|
|
8
|
-
return window.__TSR_ROUTER_CONTEXT__;
|
|
9
|
-
}
|
|
10
|
-
window.__TSR_ROUTER_CONTEXT__ = routerContext;
|
|
11
|
-
return routerContext;
|
|
12
|
-
}
|
|
2
|
+
export const routerContext = Solid.createContext(null);
|
|
13
3
|
//# sourceMappingURL=routerContext.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerContext.jsx","sourceRoot":"","sources":["../../src/routerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;
|
|
1
|
+
{"version":3,"file":"routerContext.jsx","sourceRoot":"","sources":["../../src/routerContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAGjC,MAAM,CAAC,MAAM,aAAa,GAAG,KAAK,CAAC,aAAa,CAC9C,IAA4B,CAC7B,CAAA"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as Solid from 'solid-js';
|
|
2
2
|
import warning from 'tiny-warning';
|
|
3
|
-
import {
|
|
3
|
+
import { routerContext } from './routerContext';
|
|
4
4
|
export function useRouter(opts) {
|
|
5
|
-
const value = Solid.useContext(
|
|
5
|
+
const value = Solid.useContext(routerContext);
|
|
6
6
|
warning(!((opts?.warn ?? true) && !value), 'useRouter must be used inside a <RouterProvider> component!');
|
|
7
7
|
return value;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useRouter.jsx","sourceRoot":"","sources":["../../src/useRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AACjC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"useRouter.jsx","sourceRoot":"","sources":["../../src/useRouter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AACjC,OAAO,OAAO,MAAM,cAAc,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/C,MAAM,UAAU,SAAS,CAA+C,IAEvE;IACC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,aAAoB,CAAC,CAAA;IACpD,OAAO,CACL,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,EACjC,6DAA6D,CAC9D,CAAA;IACD,OAAO,KAAY,CAAA;AACrB,CAAC"}
|
package/dist/source/utils.d.ts
CHANGED
package/dist/source/utils.js
CHANGED
package/dist/source/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAEjC,MAAM,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAEjC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAAiB,EAAE,EAAE;IAC/C,OAAO,KAAK,CAAC,UAAU,CACrB,CACE,OAA8D;QAC5D,OAAO,EAAE,IAAI;QACb,QAAQ,EAAE,IAAI;KACf,EACD,EAAE;QACF,MAAM,OAAO,GAAG,EAAE,EAAE,CAAA;QAEpB,IAAI,IAAI,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;YAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAA;YAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACxB,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC,CACF,CAAA;AACH,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,UAAU,uBAAuB,CACrC,GAA6B,EAC7B,QAAgE,EAChE,8BAAwD,EAAE,EAC1D,UAAkC,EAAE;IAEpC,MAAM,+BAA+B,GACnC,OAAO,oBAAoB,KAAK,UAAU,CAAA;IAC5C,IAAI,WAAW,GAAgC,IAAI,CAAA;IAEnD,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE;QACtB,MAAM,CAAC,GAAG,GAAG,EAAE,CAAA;QACf,IAAI,CAAC,CAAC,IAAI,CAAC,+BAA+B,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YAC/D,OAAM;QACR,CAAC;QAED,WAAW,GAAG,IAAI,oBAAoB,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,EAAE;YACjD,QAAQ,CAAC,KAAK,CAAC,CAAA;QACjB,CAAC,EAAE,2BAA2B,CAAC,CAAA;QAE/B,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QAEtB,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;YACnB,WAAW,EAAE,UAAU,EAAE,CAAA;QAC3B,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,OAAO,GAAG,EAAE,CAAC,WAAW,CAAA;AAC1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-router",
|
|
3
|
-
"version": "1.162.
|
|
3
|
+
"version": "1.162.5",
|
|
4
4
|
"description": "Modern and scalable routing for Solid applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"tiny-invariant": "^1.3.3",
|
|
93
93
|
"tiny-warning": "^1.0.3",
|
|
94
94
|
"@tanstack/history": "1.161.4",
|
|
95
|
-
"@tanstack/router-core": "1.162.
|
|
95
|
+
"@tanstack/router-core": "1.162.5"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@solidjs/testing-library": "^0.8.10",
|
package/src/RouterProvider.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { routerContext } from './routerContext'
|
|
2
2
|
import { SafeFragment } from './SafeFragment'
|
|
3
3
|
import { Matches } from './Matches'
|
|
4
4
|
import type {
|
|
@@ -28,8 +28,6 @@ export function RouterContextProvider<
|
|
|
28
28
|
},
|
|
29
29
|
})
|
|
30
30
|
|
|
31
|
-
const routerContext = getRouterContext()
|
|
32
|
-
|
|
33
31
|
const OptionalWrapper = router.options.Wrap || SafeFragment
|
|
34
32
|
|
|
35
33
|
return (
|
package/src/index.tsx
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export {
|
|
2
2
|
defer,
|
|
3
|
-
TSR_DEFERRED_PROMISE,
|
|
4
3
|
isMatch,
|
|
5
4
|
joinPaths,
|
|
6
5
|
cleanPath,
|
|
@@ -10,7 +9,6 @@ export {
|
|
|
10
9
|
resolvePath,
|
|
11
10
|
interpolatePath,
|
|
12
11
|
rootRouteId,
|
|
13
|
-
defaultSerializeError,
|
|
14
12
|
defaultParseSearch,
|
|
15
13
|
defaultStringifySearch,
|
|
16
14
|
parseSearchWith,
|
|
@@ -244,7 +242,6 @@ export {
|
|
|
244
242
|
|
|
245
243
|
export type { UseMatchRouteOptions, MakeMatchRouteOptions } from './Matches'
|
|
246
244
|
|
|
247
|
-
export { matchContext } from './matchContext'
|
|
248
245
|
export { Match, Outlet } from './Match'
|
|
249
246
|
|
|
250
247
|
export { useMatch } from './useMatch'
|
|
@@ -280,13 +277,7 @@ export type {
|
|
|
280
277
|
|
|
281
278
|
export { createRouter, Router } from './router'
|
|
282
279
|
|
|
283
|
-
export {
|
|
284
|
-
componentTypes,
|
|
285
|
-
lazyFn,
|
|
286
|
-
SearchParamError,
|
|
287
|
-
PathParamError,
|
|
288
|
-
getInitialRouterState,
|
|
289
|
-
} from '@tanstack/router-core'
|
|
280
|
+
export { lazyFn, SearchParamError } from '@tanstack/router-core'
|
|
290
281
|
|
|
291
282
|
export { RouterProvider, RouterContextProvider } from './RouterProvider'
|
|
292
283
|
export type { RouterProps } from './RouterProvider'
|
|
@@ -304,18 +295,12 @@ export { useNavigate, Navigate } from './useNavigate'
|
|
|
304
295
|
export { useParams } from './useParams'
|
|
305
296
|
export { useSearch } from './useSearch'
|
|
306
297
|
|
|
307
|
-
export {
|
|
308
|
-
getRouterContext, // SSR
|
|
309
|
-
} from './routerContext'
|
|
310
|
-
|
|
311
298
|
export { useRouteContext } from './useRouteContext'
|
|
312
299
|
export { useRouter } from './useRouter'
|
|
313
300
|
export { useRouterState } from './useRouterState'
|
|
314
301
|
export { useLocation } from './useLocation'
|
|
315
302
|
export { useCanGoBack } from './useCanGoBack'
|
|
316
303
|
|
|
317
|
-
export { useLayoutEffect } from './utils'
|
|
318
|
-
|
|
319
304
|
export { CatchNotFound, DefaultGlobalNotFound } from './not-found'
|
|
320
305
|
export { notFound, isNotFound } from '@tanstack/router-core'
|
|
321
306
|
export type { NotFoundError } from '@tanstack/router-core'
|
package/src/routerContext.tsx
CHANGED
|
@@ -1,26 +1,6 @@
|
|
|
1
1
|
import * as Solid from 'solid-js'
|
|
2
2
|
import type { AnyRouter } from '@tanstack/router-core'
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
interface Window {
|
|
6
|
-
__TSR_ROUTER_CONTEXT__?: Solid.Context<AnyRouter>
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const routerContext = Solid.createContext<AnyRouter>(
|
|
4
|
+
export const routerContext = Solid.createContext<AnyRouter>(
|
|
11
5
|
null as unknown as AnyRouter,
|
|
12
6
|
)
|
|
13
|
-
|
|
14
|
-
export function getRouterContext() {
|
|
15
|
-
if (typeof document === 'undefined') {
|
|
16
|
-
return routerContext
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (window.__TSR_ROUTER_CONTEXT__) {
|
|
20
|
-
return window.__TSR_ROUTER_CONTEXT__
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
window.__TSR_ROUTER_CONTEXT__ = routerContext as any
|
|
24
|
-
|
|
25
|
-
return routerContext
|
|
26
|
-
}
|
package/src/useRouter.tsx
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import * as Solid from 'solid-js'
|
|
2
2
|
import warning from 'tiny-warning'
|
|
3
|
-
import {
|
|
3
|
+
import { routerContext } from './routerContext'
|
|
4
4
|
import type { AnyRouter, RegisteredRouter } from '@tanstack/router-core'
|
|
5
5
|
|
|
6
6
|
export function useRouter<TRouter extends AnyRouter = RegisteredRouter>(opts?: {
|
|
7
7
|
warn?: boolean
|
|
8
8
|
}): TRouter {
|
|
9
|
-
const value = Solid.useContext(
|
|
9
|
+
const value = Solid.useContext(routerContext as any)
|
|
10
10
|
warning(
|
|
11
11
|
!((opts?.warn ?? true) && !value),
|
|
12
12
|
'useRouter must be used inside a <RouterProvider> component!',
|