@tanstack/solid-router 1.114.24 → 1.114.26

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.
@@ -1,64 +1,60 @@
1
- import { Store } from '@tanstack/solid-store';
2
- import type * as Solid from 'solid-js';
1
+ import { RouterCore } from '@tanstack/router-core';
3
2
  import type { RouterHistory } from '@tanstack/history';
4
- import type { AnyRedirect, AnyRoute, AnyRouteMatch, AnyRouter, BuildLocationFn, BuildNextOptions, ClearCacheFn, CommitLocationFn, CommitLocationOptions, ControlledPromise, Router as CoreRouter, EmitFn, FullSearchSchema, GetMatchFn, GetMatchRoutesFn, InjectedHtmlEntry, InvalidateFn, LoadFn, MakeRouteMatch, Manifest, MatchRouteFn, MatchRoutesFn, NavigateFn, NotFoundError, ParseLocationFn, ParsedLocation, PickAsRequired, PreloadRouteFn, ResolvedRedirect, RouterConstructorOptions, RouterEvent, RouterListener, RouterOptions, RouterState, RoutesById, RoutesByPath, StartSerializer, StartTransitionFn, SubscribeFn, TrailingSlashOption, UpdateFn, UpdateMatchFn, ViewTransitionOptions } from '@tanstack/router-core';
3
+ import type { AnyRoute, CreateRouterFn, RouterConstructorOptions, TrailingSlashOption } from '@tanstack/router-core';
5
4
  import type { ErrorRouteComponent, NotFoundRouteComponent, RouteComponent } from './route';
5
+ import type { JSX } from 'solid-js';
6
6
  declare module '@tanstack/router-core' {
7
7
  interface RouterOptionsExtensions {
8
- /**
9
- * A component that will be used to wrap the entire router.
10
- *
11
- * This is useful for providing a context to the entire router.
12
- *
13
- * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
14
- *
15
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#wrap-property)
16
- */
17
- Wrap?: (props: {
18
- children: any;
19
- }) => Solid.JSX.Element;
20
- /**
21
- * A component that will be used to wrap the inner contents of the router.
22
- *
23
- * This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.
24
- *
25
- * Only non-DOM-rendering components like providers should be used, anything else will cause a hydration error.
26
- *
27
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#innerwrap-property)
28
- */
29
- InnerWrap?: (props: {
30
- children: any;
31
- }) => Solid.JSX.Element;
32
8
  /**
33
9
  * The default `component` a route should use if no component is provided.
34
10
  *
35
11
  * @default Outlet
36
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultcomponent-property)
12
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultcomponent-property)
37
13
  */
38
14
  defaultComponent?: RouteComponent;
39
15
  /**
40
16
  * The default `errorComponent` a route should use if no error component is provided.
41
17
  *
42
18
  * @default ErrorComponent
43
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaulterrorcomponent-property)
44
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)
19
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaulterrorcomponent-property)
20
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/data-loading#handling-errors-with-routeoptionserrorcomponent)
45
21
  */
46
22
  defaultErrorComponent?: ErrorRouteComponent;
47
23
  /**
48
24
  * The default `pendingComponent` a route should use if no pending component is provided.
49
25
  *
50
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultpendingcomponent-property)
51
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#showing-a-pending-component)
26
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultpendingcomponent-property)
27
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/data-loading#showing-a-pending-component)
52
28
  */
53
29
  defaultPendingComponent?: RouteComponent;
54
30
  /**
55
31
  * The default `notFoundComponent` a route should use if no notFound component is provided.
56
32
  *
57
33
  * @default NotFound
58
- * @link [API Docs](https://tanstack.com/router/latest/docs/framework/react/api/router/RouterOptionsType#defaultnotfoundcomponent-property)
59
- * @link [Guide](https://tanstack.com/router/latest/docs/framework/react/guide/not-found-errors#default-router-wide-not-found-handling)
34
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#defaultnotfoundcomponent-property)
35
+ * @link [Guide](https://tanstack.com/router/latest/docs/framework/solid/guide/not-found-errors#default-router-wide-not-found-handling)
60
36
  */
61
37
  defaultNotFoundComponent?: NotFoundRouteComponent;
38
+ /**
39
+ * A component that will be used to wrap the entire router.
40
+ *
41
+ * This is useful for providing a context to the entire router.
42
+ *
43
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#wrap-property)
44
+ */
45
+ Wrap?: (props: {
46
+ children: any;
47
+ }) => JSX.Element;
48
+ /**
49
+ * A component that will be used to wrap the inner contents of the router.
50
+ *
51
+ * This is useful for providing a context to the inner contents of the router where you also need access to the router context and hooks.
52
+ *
53
+ * @link [API Docs](https://tanstack.com/router/latest/docs/framework/solid/api/router/RouterOptionsType#innerwrap-property)
54
+ */
55
+ InnerWrap?: (props: {
56
+ children: any;
57
+ }) => JSX.Element;
62
58
  /**
63
59
  * The default `onCatch` handler for errors caught by the Router ErrorBoundary
64
60
  *
@@ -68,109 +64,7 @@ declare module '@tanstack/router-core' {
68
64
  defaultOnCatch?: (error: Error) => void;
69
65
  }
70
66
  }
71
- export declare const componentTypes: readonly ["component", "errorComponent", "pendingComponent", "notFoundComponent"];
72
- export declare function createRouter<TRouteTree extends AnyRoute, TTrailingSlashOption extends TrailingSlashOption, TRouterHistory extends RouterHistory = RouterHistory, TDehydrated extends Record<string, any> = Record<string, any>>(options: undefined extends number ? 'strictNullChecks must be enabled in tsconfig.json' : RouterConstructorOptions<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>): CoreRouter<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>;
73
- export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> implements CoreRouter<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated> {
74
- tempLocationKey: string | undefined;
75
- resetNextScroll: boolean;
76
- shouldViewTransition?: boolean | ViewTransitionOptions;
77
- isViewTransitionTypesSupported?: boolean;
78
- subscribers: Set<RouterListener<RouterEvent>>;
79
- viewTransitionPromise?: ControlledPromise<true>;
80
- isScrollRestoring: boolean;
81
- isScrollRestorationSetup: boolean;
82
- __store: Store<RouterState<TRouteTree>>;
83
- options: PickAsRequired<RouterOptions<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>, 'stringifySearch' | 'parseSearch' | 'context'>;
84
- history: TRouterHistory;
85
- latestLocation: ParsedLocation<FullSearchSchema<TRouteTree>>;
86
- basepath: string;
87
- routeTree: TRouteTree;
88
- routesById: RoutesById<TRouteTree>;
89
- routesByPath: RoutesByPath<TRouteTree>;
90
- flatRoutes: Array<AnyRoute>;
91
- isServer: boolean;
92
- pathParamsDecodeCharMap?: Map<string, string>;
93
- /**
94
- * @deprecated Use the `createRouter` function instead
95
- */
96
- constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>);
97
- startTransition: StartTransitionFn;
98
- update: UpdateFn<TRouteTree, TTrailingSlashOption, false, TRouterHistory, TDehydrated>;
99
- get state(): RouterState<TRouteTree, import("@tanstack/router-core").RouteMatch<any, any, any, any, any, any, any>>;
100
- buildRouteTree: () => void;
101
- subscribe: SubscribeFn;
102
- emit: EmitFn;
103
- parseLocation: ParseLocationFn<TRouteTree>;
104
- resolvePathWithBase: (from: string, path: string) => string;
105
- get looseRoutesById(): Record<string, AnyRoute>;
106
- /**
107
- @deprecated use the following signature instead
108
- ```ts
109
- matchRoutes (
110
- next: ParsedLocation,
111
- opts?: { preload?: boolean; throwOnError?: boolean },
112
- ): Array<AnyRouteMatch>;
113
- ```
114
- */
115
- matchRoutes: MatchRoutesFn;
116
- private matchRoutesInternal;
117
- getMatchedRoutes: GetMatchRoutesFn;
118
- cancelMatch: (id: string) => void;
119
- cancelMatches: () => void;
120
- buildLocation: BuildLocationFn;
121
- commitLocationPromise: undefined | ControlledPromise<void>;
122
- commitLocation: CommitLocationFn;
123
- buildAndCommitLocation: ({ replace, resetScroll, hashScrollIntoView, viewTransition, ignoreBlocker, href, ...rest }?: BuildNextOptions & CommitLocationOptions) => Promise<void>;
124
- navigate: NavigateFn;
125
- latestLoadPromise: undefined | Promise<void>;
126
- load: LoadFn;
127
- startViewTransition: (fn: () => Promise<void>) => void;
128
- updateMatch: UpdateMatchFn;
129
- getMatch: GetMatchFn;
130
- loadMatches: ({ location, matches, preload: allPreload, onReady, updateMatch, sync, }: {
131
- location: ParsedLocation;
132
- matches: Array<AnyRouteMatch>;
133
- preload?: boolean;
134
- onReady?: () => Promise<void>;
135
- updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
136
- getMatch?: (matchId: string) => AnyRouteMatch | undefined;
137
- sync?: boolean;
138
- }) => Promise<Array<MakeRouteMatch>>;
139
- invalidate: InvalidateFn<this>;
140
- resolveRedirect: (err: AnyRedirect) => ResolvedRedirect;
141
- clearCache: ClearCacheFn<this>;
142
- clearExpiredCache: () => void;
143
- loadRouteChunk: (route: AnyRoute) => Promise<void[]>;
144
- preloadRoute: PreloadRouteFn<TRouteTree, TTrailingSlashOption, false, TRouterHistory>;
145
- matchRoute: MatchRouteFn<TRouteTree, TTrailingSlashOption, false, TRouterHistory>;
146
- ssr?: {
147
- manifest: Manifest | undefined;
148
- serializer: StartSerializer;
149
- };
150
- serverSsr?: {
151
- injectedHtml: Array<InjectedHtmlEntry>;
152
- injectHtml: (getHtml: () => string | Promise<string>) => Promise<void>;
153
- injectScript: (getScript: () => string | Promise<string>, opts?: {
154
- logScript?: boolean;
155
- }) => Promise<void>;
156
- streamValue: (key: string, value: any) => void;
157
- streamedKeys: Set<string>;
158
- onMatchSettled: (opts: {
159
- router: AnyRouter;
160
- match: AnyRouteMatch;
161
- }) => any;
162
- };
163
- clientSsr?: {
164
- getStreamedValue: <T>(key: string) => T | undefined;
165
- };
166
- _handleNotFound: (matches: Array<AnyRouteMatch>, err: NotFoundError, { updateMatch, }?: {
167
- updateMatch?: (id: string, updater: (match: AnyRouteMatch) => AnyRouteMatch) => void;
168
- }) => void;
169
- hasNotFoundMatch: () => boolean;
170
- }
171
- export declare function lazyFn<T extends Record<string, (...args: Array<any>) => any>, TKey extends keyof T = 'default'>(fn: () => Promise<T>, key?: TKey): (...args: Parameters<T[TKey]>) => Promise<Awaited<ReturnType<T[TKey]>>>;
172
- export declare class SearchParamError extends Error {
173
- }
174
- export declare class PathParamError extends Error {
67
+ export declare const createRouter: CreateRouterFn;
68
+ export declare class Router<in out TRouteTree extends AnyRoute, in out TTrailingSlashOption extends TrailingSlashOption = 'never', in out TDefaultStructuralSharingOption extends boolean = false, in out TRouterHistory extends RouterHistory = RouterHistory, in out TDehydrated extends Record<string, any> = Record<string, any>> extends RouterCore<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated> {
69
+ constructor(options: RouterConstructorOptions<TRouteTree, TTrailingSlashOption, TDefaultStructuralSharingOption, TRouterHistory, TDehydrated>);
175
70
  }
176
- export declare function getInitialRouterState(location: ParsedLocation): RouterState<any>;