@tanstack/solid-router 1.132.0-alpha.2 → 1.132.0-alpha.20
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/HeadContent.cjs +9 -6
- package/dist/cjs/HeadContent.cjs.map +1 -1
- package/dist/cjs/ScriptOnce.cjs +2 -2
- package/dist/cjs/ScriptOnce.cjs.map +1 -1
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +2 -2
- package/dist/cjs/index.cjs +10 -14
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +4 -2
- package/dist/cjs/link.cjs +48 -31
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +11 -11
- package/dist/cjs/router.cjs +1 -1
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/scroll-restoration.cjs +11 -3
- package/dist/cjs/scroll-restoration.cjs.map +1 -1
- package/dist/cjs/useBlocker.cjs +1 -1
- package/dist/cjs/useBlocker.cjs.map +1 -1
- package/dist/cjs/useNavigate.cjs +3 -11
- package/dist/cjs/useNavigate.cjs.map +1 -1
- package/dist/cjs/useParams.cjs +3 -2
- package/dist/cjs/useParams.cjs.map +1 -1
- package/dist/esm/HeadContent.js +9 -6
- package/dist/esm/HeadContent.js.map +1 -1
- package/dist/esm/ScriptOnce.js +2 -2
- package/dist/esm/ScriptOnce.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +2 -2
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +4 -5
- package/dist/esm/link.js +48 -31
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/route.d.ts +11 -11
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.js +1 -1
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/scroll-restoration.js +11 -3
- package/dist/esm/scroll-restoration.js.map +1 -1
- package/dist/esm/useBlocker.js +1 -1
- package/dist/esm/useBlocker.js.map +1 -1
- package/dist/esm/useNavigate.js +3 -11
- package/dist/esm/useNavigate.js.map +1 -1
- package/dist/esm/useParams.js +3 -2
- package/dist/esm/useParams.js.map +1 -1
- package/dist/source/HeadContent.jsx +9 -7
- package/dist/source/HeadContent.jsx.map +1 -1
- package/dist/source/ScriptOnce.jsx +1 -1
- package/dist/source/ScriptOnce.jsx.map +1 -1
- package/dist/source/fileRoute.d.ts +2 -2
- package/dist/source/fileRoute.js.map +1 -1
- package/dist/source/index.d.ts +4 -2
- package/dist/source/index.jsx +2 -1
- package/dist/source/index.jsx.map +1 -1
- package/dist/source/link.jsx +48 -41
- package/dist/source/link.jsx.map +1 -1
- package/dist/source/route.d.ts +11 -11
- package/dist/source/route.jsx.map +1 -1
- package/dist/source/router.js +1 -1
- package/dist/source/router.js.map +1 -1
- package/dist/source/scroll-restoration.jsx +11 -3
- package/dist/source/scroll-restoration.jsx.map +1 -1
- package/dist/source/useBlocker.jsx +1 -1
- package/dist/source/useBlocker.jsx.map +1 -1
- package/dist/source/useNavigate.jsx +3 -10
- package/dist/source/useNavigate.jsx.map +1 -1
- package/dist/source/useParams.jsx +3 -2
- package/dist/source/useParams.jsx.map +1 -1
- package/package.json +3 -3
- package/src/HeadContent.tsx +9 -6
- package/src/ScriptOnce.tsx +2 -2
- package/src/fileRoute.ts +10 -2
- package/src/index.tsx +8 -4
- package/src/link.tsx +46 -45
- package/src/route.tsx +75 -17
- package/src/router.ts +1 -1
- package/src/scroll-restoration.tsx +11 -4
- package/src/useBlocker.tsx +1 -1
- package/src/useNavigate.tsx +3 -12
- package/src/useParams.tsx +6 -4
package/dist/cjs/HeadContent.cjs
CHANGED
|
@@ -34,9 +34,12 @@ const useTags = () => {
|
|
|
34
34
|
const resultMeta = [];
|
|
35
35
|
const metaByAttribute = {};
|
|
36
36
|
let title;
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
const routeMetasArray = routeMeta();
|
|
38
|
+
for (let i = routeMetasArray.length - 1; i >= 0; i--) {
|
|
39
|
+
const metas = routeMetasArray[i];
|
|
40
|
+
for (let j = metas.length - 1; j >= 0; j--) {
|
|
41
|
+
const m = metas[j];
|
|
42
|
+
if (!m) continue;
|
|
40
43
|
if (m.title) {
|
|
41
44
|
if (!title) {
|
|
42
45
|
title = {
|
|
@@ -48,7 +51,7 @@ const useTags = () => {
|
|
|
48
51
|
const attribute = m.name ?? m.property;
|
|
49
52
|
if (attribute) {
|
|
50
53
|
if (metaByAttribute[attribute]) {
|
|
51
|
-
|
|
54
|
+
continue;
|
|
52
55
|
} else {
|
|
53
56
|
metaByAttribute[attribute] = true;
|
|
54
57
|
}
|
|
@@ -60,8 +63,8 @@ const useTags = () => {
|
|
|
60
63
|
}
|
|
61
64
|
});
|
|
62
65
|
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
65
68
|
if (title) {
|
|
66
69
|
resultMeta.push(title);
|
|
67
70
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadContent.cjs","sources":["../../src/HeadContent.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport { MetaProvider } from '@solidjs/meta'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\nexport const useTags = () => {\n const router = useRouter()\n\n const routeMeta = useRouterState({\n select: (state) => {\n return state.matches.map((match) => match.meta!).filter(Boolean)\n },\n })\n\n const meta: Solid.Accessor<Array<RouterManagedTag>> = Solid.createMemo(() => {\n const resultMeta: Array<RouterManagedTag> = []\n const metaByAttribute: Record<string, true> = {}\n let title: RouterManagedTag | undefined\n
|
|
1
|
+
{"version":3,"file":"HeadContent.cjs","sources":["../../src/HeadContent.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport { MetaProvider } from '@solidjs/meta'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useRouterState } from './useRouterState'\nimport type { RouterManagedTag } from '@tanstack/router-core'\n\nexport const useTags = () => {\n const router = useRouter()\n\n const routeMeta = useRouterState({\n select: (state) => {\n return state.matches.map((match) => match.meta!).filter(Boolean)\n },\n })\n\n const meta: Solid.Accessor<Array<RouterManagedTag>> = Solid.createMemo(() => {\n const resultMeta: Array<RouterManagedTag> = []\n const metaByAttribute: Record<string, true> = {}\n let title: RouterManagedTag | undefined\n const routeMetasArray = routeMeta()\n for (let i = routeMetasArray.length - 1; i >= 0; i--) {\n const metas = routeMetasArray[i]!\n for (let j = metas.length - 1; j >= 0; j--) {\n const m = metas[j]\n if (!m) continue\n\n if (m.title) {\n if (!title) {\n title = {\n tag: 'title',\n children: m.title,\n }\n }\n } else {\n const attribute = m.name ?? m.property\n if (attribute) {\n if (metaByAttribute[attribute]) {\n continue\n } else {\n metaByAttribute[attribute] = true\n }\n }\n\n resultMeta.push({\n tag: 'meta',\n attrs: {\n ...m,\n },\n })\n }\n }\n }\n\n if (title) {\n resultMeta.push(title)\n }\n\n resultMeta.reverse()\n\n return resultMeta\n })\n\n const links = useRouterState({\n select: (state) => {\n const constructed = state.matches\n .map((match) => match.links!)\n .filter(Boolean)\n .flat(1)\n .map((link) => ({\n tag: 'link',\n attrs: {\n ...link,\n },\n })) satisfies Array<RouterManagedTag>\n\n const manifest = router.ssr?.manifest\n\n // These are the assets extracted from the ViteManifest\n // using the `startManifestPlugin`\n const assets = state.matches\n .map((match) => manifest?.routes[match.routeId]?.assets ?? [])\n .filter(Boolean)\n .flat(1)\n .filter((asset) => asset.tag === 'link')\n .map(\n (asset) =>\n ({\n tag: 'link',\n attrs: asset.attrs,\n }) satisfies RouterManagedTag,\n )\n\n return [...constructed, ...assets]\n },\n })\n\n const preloadMeta = useRouterState({\n select: (state) => {\n const preloadMeta: Array<RouterManagedTag> = []\n\n state.matches\n .map((match) => router.looseRoutesById[match.routeId]!)\n .forEach((route) =>\n router.ssr?.manifest?.routes[route.id]?.preloads\n ?.filter(Boolean)\n .forEach((preload) => {\n preloadMeta.push({\n tag: 'link',\n attrs: {\n rel: 'modulepreload',\n href: preload,\n },\n })\n }),\n )\n\n return preloadMeta\n },\n })\n\n const styles = useRouterState({\n select: (state) =>\n (\n state.matches\n .map((match) => match.styles!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...style }) => ({\n tag: 'style',\n attrs: {\n ...style,\n },\n children,\n })),\n })\n\n const headScripts = useRouterState({\n select: (state) =>\n (\n state.matches\n .map((match) => match.headScripts!)\n .flat(1)\n .filter(Boolean) as Array<RouterManagedTag>\n ).map(({ children, ...script }) => ({\n tag: 'script',\n attrs: {\n ...script,\n },\n children,\n })),\n })\n\n return () =>\n uniqBy(\n [\n ...meta(),\n ...preloadMeta(),\n ...links(),\n ...styles(),\n ...headScripts(),\n ] as Array<RouterManagedTag>,\n (d) => {\n return JSON.stringify(d)\n },\n )\n}\n\n/**\n * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.\n * It should be rendered in the `<head>` of your document.\n */\nexport function HeadContent() {\n const tags = useTags()\n return (\n <MetaProvider>\n {tags().map((tag) => (\n <Asset {...tag} />\n ))}\n </MetaProvider>\n )\n}\n\nfunction uniqBy<T>(arr: Array<T>, fn: (item: T) => string) {\n const seen = new Set<string>()\n return arr.filter((item) => {\n const key = fn(item)\n if (seen.has(key)) {\n return false\n }\n seen.add(key)\n return true\n })\n}\n"],"names":["useTags","router","useRouter","routeMeta","useRouterState","select","state","matches","map","match","meta","filter","Boolean","Solid","createMemo","resultMeta","metaByAttribute","title","routeMetasArray","i","length","metas","j","m","tag","children","attribute","name","property","push","attrs","reverse","links","constructed","flat","link","manifest","ssr","assets","routes","routeId","asset","preloadMeta","looseRoutesById","forEach","route","id","preloads","preload","rel","href","styles","style","headScripts","script","uniqBy","d","JSON","stringify","HeadContent","tags","_$createComponent","MetaProvider","Asset","arr","fn","seen","Set","item","key","has","add"],"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AAIF,KAAKI,IAAID,GAAG,GAAG;AACjB,aAAO;AAAA,IACT;AACAH,SAAKK,IAAIF,GAAG;AACZ,WAAO;AAAA,EACT,CAAC;AACH;;;"}
|
package/dist/cjs/ScriptOnce.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const Solid = require("solid-js/web");
|
|
4
|
-
var _tmpl$ = /* @__PURE__ */ Solid.template(`<script class
|
|
4
|
+
var _tmpl$ = /* @__PURE__ */ Solid.template(`<script class=$tsr>`);
|
|
5
5
|
function ScriptOnce({
|
|
6
6
|
children
|
|
7
7
|
}) {
|
|
@@ -10,7 +10,7 @@ function ScriptOnce({
|
|
|
10
10
|
}
|
|
11
11
|
return (() => {
|
|
12
12
|
var _el$ = _tmpl$();
|
|
13
|
-
Solid.effect(() => _el$.innerHTML = [children].filter(Boolean).join("\n"));
|
|
13
|
+
Solid.effect(() => _el$.innerHTML = [children].filter(Boolean).join("\n") + ";$_TSR.c()");
|
|
14
14
|
return _el$;
|
|
15
15
|
})();
|
|
16
16
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScriptOnce.cjs","sources":["../../src/ScriptOnce.tsx"],"sourcesContent":["export function ScriptOnce({\n children,\n}: {\n children: string\n log?: boolean\n sync?: boolean\n}) {\n if (typeof document !== 'undefined') {\n return null\n }\n\n return (\n <script\n class=\"tsr
|
|
1
|
+
{"version":3,"file":"ScriptOnce.cjs","sources":["../../src/ScriptOnce.tsx"],"sourcesContent":["export function ScriptOnce({\n children,\n}: {\n children: string\n log?: boolean\n sync?: boolean\n}) {\n if (typeof document !== 'undefined') {\n return null\n }\n\n return (\n <script\n class=\"$tsr\"\n innerHTML={[children].filter(Boolean).join('\\n') + ';$_TSR.c()'}\n />\n )\n}\n"],"names":["ScriptOnce","children","document","_el$","_tmpl$","_$effect","innerHTML","filter","Boolean","join"],"mappings":";;;;AAAO,SAASA,WAAW;AAAA,EACzBC;AAKF,GAAG;AACD,MAAI,OAAOC,aAAa,aAAa;AACnC,WAAO;AAAA,EACT;AAEA,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAAA;AAAAC,UAAAA,aAAAF,KAAAG,YAGe,CAACL,QAAQ,EAAEM,OAAOC,OAAO,EAAEC,KAAK,IAAI,IAAI,YAAY;AAAA,WAAAN;AAAAA,EAAA,GAAA;AAGrE;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n if (typeof path === 'object') {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute(path) as any\n }\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path?: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n >(\n options?: FileBaseRouteOptions<\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n TRoute['parentRoute'],\n TRoute['types']['id'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\ndeclare module '@tanstack/router-core' {\n export interface LazyRoute<in out TRoute extends AnyRoute> {\n useMatch: UseMatchRoute<TRoute['id']>\n useRouteContext: UseRouteContextRoute<TRoute['id']>\n useSearch: UseSearchRoute<TRoute['id']>\n useParams: UseParamsRoute<TRoute['id']>\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>\n useLoaderData: UseLoaderDataRoute<TRoute['id']>\n useNavigate: () => UseNavigateResult<TRoute['fullPath']>\n }\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n }\n\n useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n const router = useRouter()\n return useNavigate({ from: router.routesById[this.options.id].fullPath })\n }\n}\n\nexport function createLazyRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n TId extends string = string,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({\n id: id,\n ...opts,\n })\n }\n}\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n if (typeof id === 'object') {\n return new LazyRoute<TRoute>(id) as any\n }\n\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useRouter","useNavigate"],"mappings":";;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"fileRoute.cjs","sources":["../../src/fileRoute.ts"],"sourcesContent":["import warning from 'tiny-warning'\nimport { createRoute } from './route'\n\nimport { useMatch } from './useMatch'\nimport { useLoaderDeps } from './useLoaderDeps'\nimport { useLoaderData } from './useLoaderData'\nimport { useSearch } from './useSearch'\nimport { useParams } from './useParams'\nimport { useNavigate } from './useNavigate'\nimport { useRouter } from './useRouter'\nimport type { UseParamsRoute } from './useParams'\nimport type { UseMatchRoute } from './useMatch'\nimport type { UseSearchRoute } from './useSearch'\nimport type {\n AnyContext,\n AnyRoute,\n AnyRouter,\n Constrain,\n ConstrainLiteral,\n FileBaseRouteOptions,\n FileRoutesByPath,\n LazyRouteOptions,\n Register,\n RegisteredRouter,\n ResolveParams,\n Route,\n RouteById,\n RouteConstraints,\n RouteIds,\n RouteLoaderFn,\n UpdatableRouteOptions,\n UseNavigateResult,\n} from '@tanstack/router-core'\nimport type { UseLoaderDepsRoute } from './useLoaderDeps'\nimport type { UseLoaderDataRoute } from './useLoaderData'\nimport type { UseRouteContextRoute } from './useRouteContext'\n\nexport function createFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n>(\n path?: TFilePath,\n): FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>['createRoute'] {\n if (typeof path === 'object') {\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute(path) as any\n }\n return new FileRoute<TFilePath, TParentRoute, TId, TPath, TFullPath>(path, {\n silent: true,\n }).createRoute\n}\n\n/** \n @deprecated It's no longer recommended to use the `FileRoute` class directly.\n Instead, use `createFileRoute('/path/to/file')(options)` to create a file route.\n*/\nexport class FileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TParentRoute extends AnyRoute = FileRoutesByPath[TFilePath]['parentRoute'],\n TId extends RouteConstraints['TId'] = FileRoutesByPath[TFilePath]['id'],\n TPath extends RouteConstraints['TPath'] = FileRoutesByPath[TFilePath]['path'],\n TFullPath extends\n RouteConstraints['TFullPath'] = FileRoutesByPath[TFilePath]['fullPath'],\n> {\n silent?: boolean\n\n constructor(\n public path?: TFilePath,\n _opts?: { silent: boolean },\n ) {\n this.silent = _opts?.silent\n }\n\n createRoute = <\n TRegister extends Register = Register,\n TSearchValidator = undefined,\n TParams = ResolveParams<TPath>,\n TRouteContextFn = AnyContext,\n TBeforeLoadFn = AnyContext,\n TLoaderDeps extends Record<string, any> = {},\n TLoaderFn = undefined,\n TChildren = unknown,\n TSSR = unknown,\n >(\n options?: FileBaseRouteOptions<\n TRegister,\n TParentRoute,\n TId,\n TPath,\n TSearchValidator,\n TParams,\n TLoaderDeps,\n TLoaderFn,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n AnyContext,\n TSSR\n > &\n UpdatableRouteOptions<\n TParentRoute,\n TId,\n TFullPath,\n TParams,\n TSearchValidator,\n TLoaderFn,\n TLoaderDeps,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn\n >,\n ): Route<\n TRegister,\n TParentRoute,\n TPath,\n TFullPath,\n TFilePath,\n TId,\n TSearchValidator,\n TParams,\n AnyContext,\n TRouteContextFn,\n TBeforeLoadFn,\n TLoaderDeps,\n TLoaderFn,\n TChildren,\n unknown,\n TSSR\n > => {\n warning(\n this.silent,\n 'FileRoute is deprecated and will be removed in the next major version. Use the createFileRoute(path)(options) function instead.',\n )\n const route = createRoute(options as any)\n ;(route as any).isRoot = false\n return route as any\n }\n}\n\n/** \n @deprecated It's recommended not to split loaders into separate files.\n Instead, place the loader function in the the main route file, inside the\n `createFileRoute('/path/to/file)(options)` options.\n*/\nexport function FileRouteLoader<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(\n _path: TFilePath,\n): <TLoaderFn>(\n loaderFn: Constrain<\n TLoaderFn,\n RouteLoaderFn<\n TRoute['parentRoute'],\n TRoute['types']['id'],\n TRoute['types']['params'],\n TRoute['types']['loaderDeps'],\n TRoute['types']['routerContext'],\n TRoute['types']['routeContextFn'],\n TRoute['types']['beforeLoadFn']\n >\n >,\n) => TLoaderFn {\n warning(\n false,\n `FileRouteLoader is deprecated and will be removed in the next major version. Please place the loader function in the the main route file, inside the \\`createFileRoute('/path/to/file')(options)\\` options`,\n )\n return (loaderFn) => loaderFn as any\n}\n\ndeclare module '@tanstack/router-core' {\n export interface LazyRoute<in out TRoute extends AnyRoute> {\n useMatch: UseMatchRoute<TRoute['id']>\n useRouteContext: UseRouteContextRoute<TRoute['id']>\n useSearch: UseSearchRoute<TRoute['id']>\n useParams: UseParamsRoute<TRoute['id']>\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']>\n useLoaderData: UseLoaderDataRoute<TRoute['id']>\n useNavigate: () => UseNavigateResult<TRoute['fullPath']>\n }\n}\n\nexport class LazyRoute<TRoute extends AnyRoute> {\n options: {\n id: string\n } & LazyRouteOptions\n\n constructor(\n opts: {\n id: string\n } & LazyRouteOptions,\n ) {\n this.options = opts\n }\n\n useMatch: UseMatchRoute<TRoute['id']> = (opts) => {\n return useMatch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useRouteContext: UseRouteContextRoute<TRoute['id']> = (opts) => {\n return useMatch({\n from: this.options.id,\n select: (d: any) => (opts?.select ? opts.select(d.context) : d.context),\n }) as any\n }\n\n useSearch: UseSearchRoute<TRoute['id']> = (opts) => {\n return useSearch({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useParams: UseParamsRoute<TRoute['id']> = (opts) => {\n return useParams({\n select: opts?.select,\n from: this.options.id,\n } as any) as any\n }\n\n useLoaderDeps: UseLoaderDepsRoute<TRoute['id']> = (opts) => {\n return useLoaderDeps({ ...opts, from: this.options.id } as any)\n }\n\n useLoaderData: UseLoaderDataRoute<TRoute['id']> = (opts) => {\n return useLoaderData({ ...opts, from: this.options.id } as any)\n }\n\n useNavigate = (): UseNavigateResult<TRoute['fullPath']> => {\n const router = useRouter()\n return useNavigate({ from: router.routesById[this.options.id].fullPath })\n }\n}\n\nexport function createLazyRoute<\n TRouter extends AnyRouter = RegisteredRouter,\n TId extends string = string,\n TRoute extends AnyRoute = RouteById<TRouter['routeTree'], TId>,\n>(id: ConstrainLiteral<TId, RouteIds<TRouter['routeTree']>>) {\n return (opts: LazyRouteOptions) => {\n return new LazyRoute<TRoute>({\n id: id,\n ...opts,\n })\n }\n}\nexport function createLazyFileRoute<\n TFilePath extends keyof FileRoutesByPath,\n TRoute extends FileRoutesByPath[TFilePath]['preLoaderRoute'],\n>(id: TFilePath): (opts: LazyRouteOptions) => LazyRoute<TRoute> {\n if (typeof id === 'object') {\n return new LazyRoute<TRoute>(id) as any\n }\n\n return (opts: LazyRouteOptions) => new LazyRoute<TRoute>({ id, ...opts })\n}\n"],"names":["route","createRoute","opts","useMatch","useSearch","useParams","useLoaderDeps","useLoaderData","useRouter","useNavigate"],"mappings":";;;;;;;;;;;AAqCO,SAAS,gBAQd,MAC0E;AAC1E,MAAI,OAAO,SAAS,UAAU;AAC5B,WAAO,IAAI,UAA0D,MAAM;AAAA,MACzE,QAAQ;AAAA,IAAA,CACT,EAAE,YAAY,IAAI;AAAA,EACrB;AACA,SAAO,IAAI,UAA0D,MAAM;AAAA,IACzE,QAAQ;AAAA,EAAA,CACT,EAAE;AACL;AAMO,MAAM,UAOX;AAAA,EAGA,YACS,MACP,OACA;AAFO,SAAA,OAAA;AAMT,SAAA,cAAc,CAWZ,YA4CG;AACH;AAAA,QACE,KAAK;AAAA,QACL;AAAA,MAAA;AAEF,YAAMA,UAAQC,MAAAA,YAAY,OAAc;AACtCD,cAAc,SAAS;AACzB,aAAOA;AAAAA,IACT;AAlEE,SAAK,SAAS,OAAO;AAAA,EACvB;AAkEF;AAOO,SAAS,gBAId,OAca;AACb;AAAA,IACE;AAAA,IACA;AAAA,EAAA;AAEF,SAAO,CAAC,aAAa;AACvB;AAcO,MAAM,UAAmC;AAAA,EAK9C,YACE,MAGA;AAIF,SAAA,WAAwC,CAACE,UAAS;AAChD,aAAOC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C,SAA2B,IAAI,UAAkB,EAAE,IAAI,GAAG,MAAM;AAC1E;;;;;;;"}
|
package/dist/cjs/fileRoute.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { UseParamsRoute } from './useParams.cjs';
|
|
2
2
|
import { UseMatchRoute } from './useMatch.cjs';
|
|
3
3
|
import { UseSearchRoute } from './useSearch.cjs';
|
|
4
|
-
import { AnyContext, AnyRoute, AnyRouter, Constrain, ConstrainLiteral, FileBaseRouteOptions, FileRoutesByPath, LazyRouteOptions, RegisteredRouter, ResolveParams, Route, RouteById, RouteConstraints, RouteIds, RouteLoaderFn, UpdatableRouteOptions, UseNavigateResult } from '@tanstack/router-core';
|
|
4
|
+
import { AnyContext, AnyRoute, AnyRouter, Constrain, ConstrainLiteral, FileBaseRouteOptions, FileRoutesByPath, LazyRouteOptions, Register, RegisteredRouter, ResolveParams, Route, RouteById, RouteConstraints, RouteIds, RouteLoaderFn, UpdatableRouteOptions, UseNavigateResult } from '@tanstack/router-core';
|
|
5
5
|
import { UseLoaderDepsRoute } from './useLoaderDeps.cjs';
|
|
6
6
|
import { UseLoaderDataRoute } from './useLoaderData.cjs';
|
|
7
7
|
import { UseRouteContextRoute } from './useRouteContext.cjs';
|
|
@@ -16,7 +16,7 @@ export declare class FileRoute<TFilePath extends keyof FileRoutesByPath, TParent
|
|
|
16
16
|
constructor(path?: TFilePath | undefined, _opts?: {
|
|
17
17
|
silent: boolean;
|
|
18
18
|
});
|
|
19
|
-
createRoute: <TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown>(options?: FileBaseRouteOptions<TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn> & UpdatableRouteOptions<TParentRoute, TId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, AnyContext, TRouteContextFn, TBeforeLoadFn>) => Route<TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown>;
|
|
19
|
+
createRoute: <TRegister extends Register = Register, TSearchValidator = undefined, TParams = ResolveParams<TPath>, TRouteContextFn = AnyContext, TBeforeLoadFn = AnyContext, TLoaderDeps extends Record<string, any> = {}, TLoaderFn = undefined, TChildren = unknown, TSSR = unknown>(options?: FileBaseRouteOptions<TRegister, TParentRoute, TId, TPath, TSearchValidator, TParams, TLoaderDeps, TLoaderFn, AnyContext, TRouteContextFn, TBeforeLoadFn, AnyContext, TSSR> & UpdatableRouteOptions<TParentRoute, TId, TFullPath, TParams, TSearchValidator, TLoaderFn, TLoaderDeps, AnyContext, TRouteContextFn, TBeforeLoadFn>) => Route<TRegister, TParentRoute, TPath, TFullPath, TFilePath, TId, TSearchValidator, TParams, AnyContext, TRouteContextFn, TBeforeLoadFn, TLoaderDeps, TLoaderFn, TChildren, unknown, TSSR>;
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
@deprecated It's recommended not to split loaders into separate files.
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -54,13 +54,17 @@ Object.defineProperty(exports, "componentTypes", {
|
|
|
54
54
|
enumerable: true,
|
|
55
55
|
get: () => routerCore.componentTypes
|
|
56
56
|
});
|
|
57
|
+
Object.defineProperty(exports, "composeRewrites", {
|
|
58
|
+
enumerable: true,
|
|
59
|
+
get: () => routerCore.composeRewrites
|
|
60
|
+
});
|
|
57
61
|
Object.defineProperty(exports, "createControlledPromise", {
|
|
58
62
|
enumerable: true,
|
|
59
63
|
get: () => routerCore.createControlledPromise
|
|
60
64
|
});
|
|
61
|
-
Object.defineProperty(exports, "
|
|
65
|
+
Object.defineProperty(exports, "createSerializationAdapter", {
|
|
62
66
|
enumerable: true,
|
|
63
|
-
get: () => routerCore.
|
|
67
|
+
get: () => routerCore.createSerializationAdapter
|
|
64
68
|
});
|
|
65
69
|
Object.defineProperty(exports, "deepEqual", {
|
|
66
70
|
enumerable: true,
|
|
@@ -82,10 +86,6 @@ Object.defineProperty(exports, "defer", {
|
|
|
82
86
|
enumerable: true,
|
|
83
87
|
get: () => routerCore.defer
|
|
84
88
|
});
|
|
85
|
-
Object.defineProperty(exports, "encode", {
|
|
86
|
-
enumerable: true,
|
|
87
|
-
get: () => routerCore.encode
|
|
88
|
-
});
|
|
89
89
|
Object.defineProperty(exports, "functionalUpdate", {
|
|
90
90
|
enumerable: true,
|
|
91
91
|
get: () => routerCore.functionalUpdate
|
|
@@ -146,18 +146,10 @@ Object.defineProperty(exports, "parseSearchWith", {
|
|
|
146
146
|
enumerable: true,
|
|
147
147
|
get: () => routerCore.parseSearchWith
|
|
148
148
|
});
|
|
149
|
-
Object.defineProperty(exports, "pick", {
|
|
150
|
-
enumerable: true,
|
|
151
|
-
get: () => routerCore.pick
|
|
152
|
-
});
|
|
153
149
|
Object.defineProperty(exports, "redirect", {
|
|
154
150
|
enumerable: true,
|
|
155
151
|
get: () => routerCore.redirect
|
|
156
152
|
});
|
|
157
|
-
Object.defineProperty(exports, "removeBasepath", {
|
|
158
|
-
enumerable: true,
|
|
159
|
-
get: () => routerCore.removeBasepath
|
|
160
|
-
});
|
|
161
153
|
Object.defineProperty(exports, "replaceEqualDeep", {
|
|
162
154
|
enumerable: true,
|
|
163
155
|
get: () => routerCore.replaceEqualDeep
|
|
@@ -170,6 +162,10 @@ Object.defineProperty(exports, "retainSearchParams", {
|
|
|
170
162
|
enumerable: true,
|
|
171
163
|
get: () => routerCore.retainSearchParams
|
|
172
164
|
});
|
|
165
|
+
Object.defineProperty(exports, "rewriteBasepath", {
|
|
166
|
+
enumerable: true,
|
|
167
|
+
get: () => routerCore.rewriteBasepath
|
|
168
|
+
});
|
|
173
169
|
Object.defineProperty(exports, "rootRouteId", {
|
|
174
170
|
enumerable: true,
|
|
175
171
|
get: () => routerCore.rootRouteId
|
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,5 +1,5 @@
|
|
|
1
|
-
export { defer, TSR_DEFERRED_PROMISE, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, parsePathname, interpolatePath, matchPathname,
|
|
2
|
-
export type { DeferredPromiseState, DeferredPromise, ParsedLocation, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, Segment, 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, BeforeLoadFn, 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, } from '@tanstack/router-core';
|
|
1
|
+
export { defer, TSR_DEFERRED_PROMISE, isMatch, joinPaths, cleanPath, trimPathLeft, trimPathRight, trimPath, resolvePath, parsePathname, interpolatePath, matchPathname, matchByPath, rootRouteId, defaultSerializeError, defaultParseSearch, defaultStringifySearch, parseSearchWith, stringifySearchWith, functionalUpdate, replaceEqualDeep, isPlainObject, isPlainArray, deepEqual, createControlledPromise, retainSearchParams, stripSearchParams, createSerializationAdapter, } from '@tanstack/router-core';
|
|
2
|
+
export type { DeferredPromiseState, DeferredPromise, ParsedLocation, RemoveTrailingSlashes, RemoveLeadingSlashes, ActiveOptions, Segment, 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, BeforeLoadFn, 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, } 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';
|
|
5
5
|
export { useAwaited, Await } from './awaited.cjs';
|
|
@@ -47,3 +47,5 @@ export { ScriptOnce } from './ScriptOnce.cjs';
|
|
|
47
47
|
export { Asset } from './Asset.cjs';
|
|
48
48
|
export { HeadContent, useTags } from './HeadContent.cjs';
|
|
49
49
|
export { Scripts } from './Scripts.cjs';
|
|
50
|
+
export { rewriteBasepath, composeRewrites } from '@tanstack/router-core';
|
|
51
|
+
export type { LocationRewrite, LocationRewriteFunction, } from '@tanstack/router-core';
|
package/dist/cjs/link.cjs
CHANGED
|
@@ -7,7 +7,6 @@ const routerCore = require("@tanstack/router-core");
|
|
|
7
7
|
const useRouterState = require("./useRouterState.cjs");
|
|
8
8
|
const useRouter = require("./useRouter.cjs");
|
|
9
9
|
const utils = require("./utils.cjs");
|
|
10
|
-
const useMatch = require("./useMatch.cjs");
|
|
11
10
|
function _interopNamespaceDefault(e) {
|
|
12
11
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
13
12
|
if (e) {
|
|
@@ -36,31 +35,58 @@ function useLinkProps(options) {
|
|
|
36
35
|
inactiveProps: () => ({})
|
|
37
36
|
}, options), ["activeProps", "inactiveProps", "activeOptions", "to", "preload", "preloadDelay", "hashScrollIntoView", "replace", "startTransition", "resetScroll", "viewTransition", "target", "disabled", "style", "class", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "onMouseOver", "onMouseOut", "onTouchStart", "ignoreBlocker"]);
|
|
38
37
|
const [_, propsSafeToSpread] = Solid__namespace.splitProps(rest, ["params", "search", "hash", "state", "mask", "reloadDocument", "unsafeRelative"]);
|
|
39
|
-
const type = () => {
|
|
40
|
-
try {
|
|
41
|
-
new URL(`${local.to}`);
|
|
42
|
-
return "external";
|
|
43
|
-
} catch {
|
|
44
|
-
}
|
|
45
|
-
return "internal";
|
|
46
|
-
};
|
|
47
38
|
const currentSearch = useRouterState.useRouterState({
|
|
48
39
|
select: (s) => s.location.searchStr
|
|
49
40
|
});
|
|
50
|
-
const from =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
41
|
+
const from = options.from;
|
|
42
|
+
const _options = () => {
|
|
43
|
+
return {
|
|
44
|
+
...options,
|
|
45
|
+
from
|
|
46
|
+
};
|
|
47
|
+
};
|
|
58
48
|
const next = Solid__namespace.createMemo(() => {
|
|
59
49
|
currentSearch();
|
|
60
50
|
return router.buildLocation(_options());
|
|
61
51
|
});
|
|
52
|
+
const hrefOption = Solid__namespace.createMemo(() => {
|
|
53
|
+
if (_options().disabled) {
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
56
|
+
let href;
|
|
57
|
+
const maskedLocation = next().maskedLocation;
|
|
58
|
+
if (maskedLocation) {
|
|
59
|
+
href = maskedLocation.url;
|
|
60
|
+
} else {
|
|
61
|
+
href = next().url;
|
|
62
|
+
}
|
|
63
|
+
let external = false;
|
|
64
|
+
if (router.origin) {
|
|
65
|
+
if (href.startsWith(router.origin)) {
|
|
66
|
+
href = href.replace(router.origin, "");
|
|
67
|
+
} else {
|
|
68
|
+
external = true;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
href,
|
|
73
|
+
external
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
const externalLink = Solid__namespace.createMemo(() => {
|
|
77
|
+
const _href = hrefOption();
|
|
78
|
+
if (_href?.external) {
|
|
79
|
+
return _href.href;
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
new URL(_options().to);
|
|
83
|
+
return _options().to;
|
|
84
|
+
} catch {
|
|
85
|
+
}
|
|
86
|
+
return void 0;
|
|
87
|
+
});
|
|
62
88
|
const preload = Solid__namespace.createMemo(() => {
|
|
63
|
-
if (_options().reloadDocument) {
|
|
89
|
+
if (_options().reloadDocument || externalLink()) {
|
|
64
90
|
return false;
|
|
65
91
|
}
|
|
66
92
|
return local.preload ?? router.options.defaultPreload;
|
|
@@ -68,6 +94,7 @@ function useLinkProps(options) {
|
|
|
68
94
|
const preloadDelay = () => local.preloadDelay ?? router.options.defaultPreloadDelay ?? 0;
|
|
69
95
|
const isActive = useRouterState.useRouterState({
|
|
70
96
|
select: (s) => {
|
|
97
|
+
if (externalLink()) return false;
|
|
71
98
|
if (local.activeOptions?.exact) {
|
|
72
99
|
const testExact = routerCore.exactPathTest(s.location.pathname, next().pathname, router.basepath);
|
|
73
100
|
if (!testExact) {
|
|
@@ -120,15 +147,10 @@ function useLinkProps(options) {
|
|
|
120
147
|
hasRenderFetched = true;
|
|
121
148
|
}
|
|
122
149
|
});
|
|
123
|
-
if (
|
|
150
|
+
if (externalLink()) {
|
|
124
151
|
return Solid__namespace.mergeProps(propsSafeToSpread, {
|
|
125
152
|
ref,
|
|
126
|
-
|
|
127
|
-
return type();
|
|
128
|
-
},
|
|
129
|
-
get href() {
|
|
130
|
-
return local.to;
|
|
131
|
-
}
|
|
153
|
+
href: externalLink
|
|
132
154
|
}, Solid__namespace.splitProps(local, ["target", "disabled", "style", "class", "onClick", "onFocus", "onMouseEnter", "onMouseLeave", "onMouseOut", "onMouseOver", "onTouchStart"])[0]);
|
|
133
155
|
}
|
|
134
156
|
const handleClick = (e) => {
|
|
@@ -203,14 +225,9 @@ function useLinkProps(options) {
|
|
|
203
225
|
...resolvedActiveProps().style,
|
|
204
226
|
...resolvedInactiveProps().style
|
|
205
227
|
});
|
|
206
|
-
const href = Solid__namespace.createMemo(() => {
|
|
207
|
-
const nextLocation = next();
|
|
208
|
-
const maskedLocation = nextLocation?.maskedLocation;
|
|
209
|
-
return _options().disabled ? void 0 : maskedLocation ? router.history.createHref(maskedLocation.href) : router.history.createHref(nextLocation?.href);
|
|
210
|
-
});
|
|
211
228
|
return Solid__namespace.mergeProps(propsSafeToSpread, resolvedActiveProps, resolvedInactiveProps, () => {
|
|
212
229
|
return {
|
|
213
|
-
href:
|
|
230
|
+
href: hrefOption()?.href,
|
|
214
231
|
ref: refs.mergeRefs(setRef, _options().ref),
|
|
215
232
|
onClick: composeEventHandlers([local.onClick, handleClick]),
|
|
216
233
|
onFocus: composeEventHandlers([local.onFocus, handleFocus]),
|
package/dist/cjs/link.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link.cjs","sources":["../../src/link.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\n\nimport { mergeRefs } from '@solid-primitives/refs'\n\nimport {\n deepEqual,\n exactPathTest,\n functionalUpdate,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { Dynamic } from 'solid-js/web'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\n\nimport { useIntersectionObserver } from './utils'\n\nimport { useMatch } from './useMatch'\nimport type {\n AnyRouter,\n Constrain,\n LinkCurrentTargetElement,\n LinkOptions,\n RegisteredRouter,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Solid.ComponentProps<'a'> {\n const router = useRouter()\n const [isTransitioning, setIsTransitioning] = Solid.createSignal(false)\n let hasRenderFetched = false\n\n const [local, rest] = Solid.splitProps(\n Solid.mergeProps(\n {\n activeProps: () => ({ class: 'active' }),\n inactiveProps: () => ({}),\n },\n options,\n ),\n [\n 'activeProps',\n 'inactiveProps',\n 'activeOptions',\n 'to',\n 'preload',\n 'preloadDelay',\n 'hashScrollIntoView',\n 'replace',\n 'startTransition',\n 'resetScroll',\n 'viewTransition',\n 'target',\n 'disabled',\n 'style',\n 'class',\n 'onClick',\n 'onFocus',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseOver',\n 'onMouseOut',\n 'onTouchStart',\n 'ignoreBlocker',\n ],\n )\n\n // const {\n // // custom props\n // activeProps = () => ({ class: 'active' }),\n // inactiveProps = () => ({}),\n // activeOptions,\n // to,\n // preload: userPreload,\n // preloadDelay: userPreloadDelay,\n // hashScrollIntoView,\n // replace,\n // startTransition,\n // resetScroll,\n // viewTransition,\n // // element props\n // children,\n // target,\n // disabled,\n // style,\n // class,\n // onClick,\n // onFocus,\n // onMouseEnter,\n // onMouseLeave,\n // onTouchStart,\n // ignoreBlocker,\n // ...rest\n // } = options\n\n const [_, propsSafeToSpread] = Solid.splitProps(rest, [\n 'params',\n 'search',\n 'hash',\n 'state',\n 'mask',\n 'reloadDocument',\n 'unsafeRelative',\n ])\n\n // If this link simply reloads the current route,\n // make sure it has a new key so it will trigger a data refresh\n\n // If this `to` is a valid external URL, return\n // null for LinkUtils\n\n const type: Solid.Accessor<'internal' | 'external'> = () => {\n try {\n new URL(`${local.to}`)\n return 'external'\n } catch {}\n return 'internal'\n }\n\n const currentSearch = useRouterState({\n select: (s) => s.location.searchStr,\n })\n\n // when `from` is not supplied, use the route of the current match as the `from` location\n // so relative routing works as expected\n const from = useMatch({\n strict: false,\n select: (match) => options.from ?? match.fullPath,\n })\n\n const _options = () => ({\n ...options,\n from: from(),\n })\n\n const next = Solid.createMemo(() => {\n currentSearch()\n return router.buildLocation(_options() as any)\n })\n\n const preload = Solid.createMemo(() => {\n if (_options().reloadDocument) {\n return false\n }\n return local.preload ?? router.options.defaultPreload\n })\n const preloadDelay = () =>\n local.preloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n const isActive = useRouterState({\n select: (s) => {\n if (local.activeOptions?.exact) {\n const testExact = exactPathTest(\n s.location.pathname,\n next().pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(\n s.location.pathname,\n router.basepath,\n ).split('/')\n const nextPathSplit = removeTrailingSlash(\n next()?.pathname,\n router.basepath,\n )?.split('/')\n\n const pathIsFuzzyEqual = nextPathSplit?.every(\n (d, i) => d === currentPathSplit[i],\n )\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (local.activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(s.location.search, next().search, {\n partial: !local.activeOptions?.exact,\n ignoreUndefined: !local.activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (local.activeOptions?.includeHash) {\n return s.location.hash === next().hash\n }\n return true\n },\n })\n\n const doPreload = () =>\n router.preloadRoute(_options() as any).catch((err: any) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n\n const preloadViewportIoCallback = (\n entry: IntersectionObserverEntry | undefined,\n ) => {\n if (entry?.isIntersecting) {\n doPreload()\n }\n }\n\n const [ref, setRef] = Solid.createSignal<Element | null>(null)\n\n useIntersectionObserver(\n ref,\n preloadViewportIoCallback,\n { rootMargin: '100px' },\n { disabled: !!local.disabled || !(preload() === 'viewport') },\n )\n\n Solid.createEffect(() => {\n if (hasRenderFetched) {\n return\n }\n if (!local.disabled && preload() === 'render') {\n doPreload()\n hasRenderFetched = true\n }\n })\n\n if (type() === 'external') {\n return Solid.mergeProps(\n propsSafeToSpread,\n {\n ref,\n get type() {\n return type()\n },\n get href() {\n return local.to\n },\n },\n Solid.splitProps(local, [\n 'target',\n 'disabled',\n 'style',\n 'class',\n 'onClick',\n 'onFocus',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseOut',\n 'onMouseOver',\n 'onTouchStart',\n ])[0],\n ) as any\n }\n\n // The click handler\n const handleClick = (e: MouseEvent) => {\n if (\n !local.disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!local.target || local.target === '_self') &&\n e.button === 0\n ) {\n e.preventDefault()\n\n setIsTransitioning(true)\n\n const unsub = router.subscribe('onResolved', () => {\n unsub()\n setIsTransitioning(false)\n })\n\n // All is well? Navigate!\n // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n router.navigate({\n ..._options(),\n replace: local.replace,\n resetScroll: local.resetScroll,\n hashScrollIntoView: local.hashScrollIntoView,\n startTransition: local.startTransition,\n viewTransition: local.viewTransition,\n ignoreBlocker: local.ignoreBlocker,\n })\n }\n }\n\n // The click handler\n const handleFocus = (_: MouseEvent) => {\n if (local.disabled) return\n if (preload()) {\n doPreload()\n }\n }\n\n const handleTouchStart = handleFocus\n\n const handleEnter = (e: MouseEvent) => {\n if (local.disabled) return\n const eventTarget = (e.target || {}) as LinkCurrentTargetElement\n\n if (preload()) {\n if (eventTarget.preloadTimeout) {\n return\n }\n\n eventTarget.preloadTimeout = setTimeout(() => {\n eventTarget.preloadTimeout = null\n doPreload()\n }, preloadDelay())\n }\n }\n\n const handleLeave = (e: MouseEvent) => {\n if (local.disabled) return\n const eventTarget = (e.target || {}) as LinkCurrentTargetElement\n\n if (eventTarget.preloadTimeout) {\n clearTimeout(eventTarget.preloadTimeout)\n eventTarget.preloadTimeout = null\n }\n }\n\n /** Call a JSX.EventHandlerUnion with the event. */\n function callHandler<T, TEvent extends Event>(\n event: TEvent & { currentTarget: T; target: Element },\n handler: Solid.JSX.EventHandlerUnion<T, TEvent> | undefined,\n ) {\n if (handler) {\n if (typeof handler === 'function') {\n handler(event)\n } else {\n handler[0](handler[1], event)\n }\n }\n\n return event.defaultPrevented\n }\n\n function composeEventHandlers<T>(\n handlers: Array<Solid.JSX.EventHandlerUnion<T, any> | undefined>,\n ) {\n return (event: any) => {\n for (const handler of handlers) {\n callHandler(event, handler)\n }\n }\n }\n\n // Get the active props\n const resolvedActiveProps: () => Omit<Solid.ComponentProps<'a'>, 'style'> & {\n style?: Solid.JSX.CSSProperties\n } = () =>\n isActive() ? (functionalUpdate(local.activeProps as any, {}) ?? {}) : {}\n\n // Get the inactive props\n const resolvedInactiveProps: () => Omit<\n Solid.ComponentProps<'a'>,\n 'style'\n > & { style?: Solid.JSX.CSSProperties } = () =>\n isActive() ? {} : functionalUpdate(local.inactiveProps, {})\n\n const resolvedClassName = () =>\n [local.class, resolvedActiveProps().class, resolvedInactiveProps().class]\n .filter(Boolean)\n .join(' ')\n\n const resolvedStyle = () => ({\n ...local.style,\n ...resolvedActiveProps().style,\n ...resolvedInactiveProps().style,\n })\n\n const href = Solid.createMemo(() => {\n const nextLocation = next()\n const maskedLocation = nextLocation?.maskedLocation\n\n return _options().disabled\n ? undefined\n : maskedLocation\n ? router.history.createHref(maskedLocation.href)\n : router.history.createHref(nextLocation?.href)\n })\n\n return Solid.mergeProps(\n propsSafeToSpread,\n resolvedActiveProps,\n resolvedInactiveProps,\n () => {\n return {\n href: href(),\n ref: mergeRefs(setRef, _options().ref),\n onClick: composeEventHandlers([local.onClick, handleClick]),\n onFocus: composeEventHandlers([local.onFocus, handleFocus]),\n onMouseEnter: composeEventHandlers([local.onMouseEnter, handleEnter]),\n onMouseOver: composeEventHandlers([local.onMouseOver, handleEnter]),\n onMouseLeave: composeEventHandlers([local.onMouseLeave, handleLeave]),\n onMouseOut: composeEventHandlers([local.onMouseOut, handleLeave]),\n onTouchStart: composeEventHandlers([\n local.onTouchStart,\n handleTouchStart,\n ]),\n disabled: !!local.disabled,\n target: local.target,\n ...(Object.keys(resolvedStyle).length && { style: resolvedStyle }),\n ...(resolvedClassName() && { class: resolvedClassName() }),\n ...(local.disabled && {\n role: 'link',\n 'aria-disabled': true,\n }),\n ...(isActive() && { 'data-status': 'active', 'aria-current': 'page' }),\n ...(isTransitioning() && { 'data-transitioning': 'transitioning' }),\n }\n },\n ) as any\n}\n\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n Omit<Solid.ComponentProps<'a'>, 'style'> & { style?: Solid.JSX.CSSProperties }\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n LinkComponentSolidProps<TComp> & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\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 | Solid.JSX.Element\n | ((state: {\n isActive: boolean\n isTransitioning: boolean\n }) => Solid.JSX.Element)\n}\n\ntype LinkComponentSolidProps<TComp> = TComp extends Solid.ValidComponent\n ? Omit<Solid.ComponentProps<TComp>, keyof CreateLinkProps>\n : never\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentSolidProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<\n in out TComp,\n in out TDefaultFrom extends string = string,\n> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = TDefaultFrom,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Solid.JSX.Element\n\nexport interface LinkComponentRoute<\n in out TDefaultFrom extends string = string,\n> {\n defaultFrom: TDefaultFrom\n <\n TRouter extends AnyRouter = RegisteredRouter,\n const TTo extends string | undefined = undefined,\n const TMaskTo extends string = '',\n >(\n props: LinkComponentProps<\n 'a',\n TRouter,\n this['defaultFrom'],\n TTo,\n this['defaultFrom'],\n TMaskTo\n >,\n ): Solid.JSX.Element\n}\n\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => Solid.JSX.Element>,\n): LinkComponent<TComp> {\n return (props) => <Link {...props} _asChild={Comp} />\n}\n\nexport const Link: LinkComponent<'a'> = (props) => {\n const [local, rest] = Solid.splitProps(\n props as typeof props & { _asChild: any },\n ['_asChild', 'children'],\n )\n\n const [_, linkProps] = Solid.splitProps(\n useLinkProps(rest as unknown as any),\n ['type'],\n )\n\n const children = Solid.createMemo(() => {\n const ch = local.children\n if (typeof ch === 'function') {\n return ch({\n get isActive() {\n return (linkProps as any)['data-status'] === 'active'\n },\n isTransitioning: false,\n })\n }\n\n return ch satisfies Solid.JSX.Element\n })\n\n return (\n <Dynamic component={local._asChild ? local._asChild : 'a'} {...linkProps}>\n {children()}\n </Dynamic>\n )\n}\n\nfunction isCtrlEvent(e: MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n"],"names":["useLinkProps","options","router","useRouter","isTransitioning","setIsTransitioning","Solid","createSignal","hasRenderFetched","local","rest","splitProps","mergeProps","activeProps","class","inactiveProps","_","propsSafeToSpread","type","URL","to","currentSearch","useRouterState","select","s","location","searchStr","from","useMatch","strict","match","fullPath","_options","next","createMemo","buildLocation","preload","reloadDocument","defaultPreload","preloadDelay","defaultPreloadDelay","isActive","activeOptions","exact","testExact","exactPathTest","pathname","basepath","currentPathSplit","removeTrailingSlash","split","nextPathSplit","pathIsFuzzyEqual","every","d","i","includeSearch","searchTest","deepEqual","search","partial","ignoreUndefined","explicitUndefined","includeHash","hash","doPreload","preloadRoute","catch","err","console","warn","preloadWarning","preloadViewportIoCallback","entry","isIntersecting","ref","setRef","useIntersectionObserver","rootMargin","disabled","createEffect","href","handleClick","e","isCtrlEvent","defaultPrevented","target","button","preventDefault","unsub","subscribe","navigate","replace","resetScroll","hashScrollIntoView","startTransition","viewTransition","ignoreBlocker","handleFocus","handleTouchStart","handleEnter","eventTarget","preloadTimeout","setTimeout","handleLeave","clearTimeout","callHandler","event","handler","composeEventHandlers","handlers","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","resolvedClassName","filter","Boolean","join","resolvedStyle","style","nextLocation","maskedLocation","undefined","history","createHref","mergeRefs","onClick","onFocus","onMouseEnter","onMouseOver","onMouseLeave","onMouseOut","onTouchStart","Object","keys","length","role","createLink","Comp","props","_$createComponent","Link","_$mergeProps","_asChild","linkProps","children","ch","Dynamic","component","metaKey","altKey","ctrlKey","shiftKey","linkOptions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BO,SAASA,aAOdC,SAC2B;AAC3B,QAAMC,SAASC,UAAAA,UAAAA;AACf,QAAM,CAACC,iBAAiBC,kBAAkB,IAAIC,iBAAMC,aAAa,KAAK;AACtE,MAAIC,mBAAmB;AAEvB,QAAM,CAACC,OAAOC,IAAI,IAAIJ,iBAAMK,WAC1BL,iBAAMM,WACJ;AAAA,IACEC,aAAaA,OAAO;AAAA,MAAEC,OAAO;AAAA,IAAA;AAA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WAAW;AAAA,IAAG;AAAA,EAAA,GAAMC,WAAS;AAAA,IAAA,IAAAC,WAAA;AAAA,aACrEA,SAAAA;AAAAA,IAAU;AAAA,EAAA,CAAA,CAAA;AAGjB;AAEA,SAAS7D,YAAYD,GAAe;AAClC,SAAO,CAAC,EAAEA,EAAEkE,WAAWlE,EAAEmE,UAAUnE,EAAEoE,WAAWpE,EAAEqE;AACpD;AAkBO,MAAMC,cAAmCxJ,CAAAA,YAAY;AAC1D,SAAOA;AACT;;;;;"}
|
|
1
|
+
{"version":3,"file":"link.cjs","sources":["../../src/link.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\n\nimport { mergeRefs } from '@solid-primitives/refs'\n\nimport {\n deepEqual,\n exactPathTest,\n functionalUpdate,\n preloadWarning,\n removeTrailingSlash,\n} from '@tanstack/router-core'\nimport { Dynamic } from 'solid-js/web'\nimport { useRouterState } from './useRouterState'\nimport { useRouter } from './useRouter'\n\nimport { useIntersectionObserver } from './utils'\n\nimport type {\n AnyRouter,\n Constrain,\n LinkCurrentTargetElement,\n LinkOptions,\n RegisteredRouter,\n RoutePaths,\n} from '@tanstack/router-core'\nimport type {\n ValidateLinkOptions,\n ValidateLinkOptionsArray,\n} from './typePrimitives'\n\nexport function useLinkProps<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string = '',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '',\n>(\n options: UseLinkPropsOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n): Solid.ComponentProps<'a'> {\n const router = useRouter()\n const [isTransitioning, setIsTransitioning] = Solid.createSignal(false)\n let hasRenderFetched = false\n\n const [local, rest] = Solid.splitProps(\n Solid.mergeProps(\n {\n activeProps: () => ({ class: 'active' }),\n inactiveProps: () => ({}),\n },\n options,\n ),\n [\n 'activeProps',\n 'inactiveProps',\n 'activeOptions',\n 'to',\n 'preload',\n 'preloadDelay',\n 'hashScrollIntoView',\n 'replace',\n 'startTransition',\n 'resetScroll',\n 'viewTransition',\n 'target',\n 'disabled',\n 'style',\n 'class',\n 'onClick',\n 'onFocus',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseOver',\n 'onMouseOut',\n 'onTouchStart',\n 'ignoreBlocker',\n ],\n )\n\n // const {\n // // custom props\n // activeProps = () => ({ class: 'active' }),\n // inactiveProps = () => ({}),\n // activeOptions,\n // to,\n // preload: userPreload,\n // preloadDelay: userPreloadDelay,\n // hashScrollIntoView,\n // replace,\n // startTransition,\n // resetScroll,\n // viewTransition,\n // // element props\n // children,\n // target,\n // disabled,\n // style,\n // class,\n // onClick,\n // onFocus,\n // onMouseEnter,\n // onMouseLeave,\n // onTouchStart,\n // ignoreBlocker,\n // ...rest\n // } = options\n\n const [_, propsSafeToSpread] = Solid.splitProps(rest, [\n 'params',\n 'search',\n 'hash',\n 'state',\n 'mask',\n 'reloadDocument',\n 'unsafeRelative',\n ])\n\n const currentSearch = useRouterState({\n select: (s) => s.location.searchStr,\n })\n\n const from = options.from\n\n const _options = () => {\n return {\n ...options,\n from,\n }\n }\n\n const next = Solid.createMemo(() => {\n currentSearch()\n return router.buildLocation(_options() as any)\n })\n\n const hrefOption = Solid.createMemo(() => {\n if (_options().disabled) {\n return undefined\n }\n let href\n const maskedLocation = next().maskedLocation\n if (maskedLocation) {\n href = maskedLocation.url\n } else {\n href = next().url\n }\n let external = false\n if (router.origin) {\n if (href.startsWith(router.origin)) {\n href = href.replace(router.origin, '')\n } else {\n external = true\n }\n }\n return { href, external }\n })\n\n const externalLink = Solid.createMemo(() => {\n const _href = hrefOption()\n if (_href?.external) {\n return _href.href\n }\n try {\n new URL(_options().to as any)\n return _options().to\n } catch {}\n return undefined\n })\n\n const preload = Solid.createMemo(() => {\n if (_options().reloadDocument || externalLink()) {\n return false\n }\n return local.preload ?? router.options.defaultPreload\n })\n const preloadDelay = () =>\n local.preloadDelay ?? router.options.defaultPreloadDelay ?? 0\n\n const isActive = useRouterState({\n select: (s) => {\n if (externalLink()) return false\n if (local.activeOptions?.exact) {\n const testExact = exactPathTest(\n s.location.pathname,\n next().pathname,\n router.basepath,\n )\n if (!testExact) {\n return false\n }\n } else {\n const currentPathSplit = removeTrailingSlash(\n s.location.pathname,\n router.basepath,\n ).split('/')\n const nextPathSplit = removeTrailingSlash(\n next()?.pathname,\n router.basepath,\n )?.split('/')\n\n const pathIsFuzzyEqual = nextPathSplit?.every(\n (d, i) => d === currentPathSplit[i],\n )\n if (!pathIsFuzzyEqual) {\n return false\n }\n }\n\n if (local.activeOptions?.includeSearch ?? true) {\n const searchTest = deepEqual(s.location.search, next().search, {\n partial: !local.activeOptions?.exact,\n ignoreUndefined: !local.activeOptions?.explicitUndefined,\n })\n if (!searchTest) {\n return false\n }\n }\n\n if (local.activeOptions?.includeHash) {\n return s.location.hash === next().hash\n }\n return true\n },\n })\n\n const doPreload = () =>\n router.preloadRoute(_options() as any).catch((err: any) => {\n console.warn(err)\n console.warn(preloadWarning)\n })\n\n const preloadViewportIoCallback = (\n entry: IntersectionObserverEntry | undefined,\n ) => {\n if (entry?.isIntersecting) {\n doPreload()\n }\n }\n\n const [ref, setRef] = Solid.createSignal<Element | null>(null)\n\n useIntersectionObserver(\n ref,\n preloadViewportIoCallback,\n { rootMargin: '100px' },\n { disabled: !!local.disabled || !(preload() === 'viewport') },\n )\n\n Solid.createEffect(() => {\n if (hasRenderFetched) {\n return\n }\n if (!local.disabled && preload() === 'render') {\n doPreload()\n hasRenderFetched = true\n }\n })\n\n if (externalLink()) {\n return Solid.mergeProps(\n propsSafeToSpread,\n {\n ref,\n href: externalLink,\n },\n Solid.splitProps(local, [\n 'target',\n 'disabled',\n 'style',\n 'class',\n 'onClick',\n 'onFocus',\n 'onMouseEnter',\n 'onMouseLeave',\n 'onMouseOut',\n 'onMouseOver',\n 'onTouchStart',\n ])[0],\n ) as any\n }\n\n // The click handler\n const handleClick = (e: MouseEvent) => {\n if (\n !local.disabled &&\n !isCtrlEvent(e) &&\n !e.defaultPrevented &&\n (!local.target || local.target === '_self') &&\n e.button === 0\n ) {\n e.preventDefault()\n\n setIsTransitioning(true)\n\n const unsub = router.subscribe('onResolved', () => {\n unsub()\n setIsTransitioning(false)\n })\n\n // All is well? Navigate!\n // N.B. we don't call `router.commitLocation(next) here because we want to run `validateSearch` before committing\n router.navigate({\n ..._options(),\n replace: local.replace,\n resetScroll: local.resetScroll,\n hashScrollIntoView: local.hashScrollIntoView,\n startTransition: local.startTransition,\n viewTransition: local.viewTransition,\n ignoreBlocker: local.ignoreBlocker,\n })\n }\n }\n\n // The click handler\n const handleFocus = (_: MouseEvent) => {\n if (local.disabled) return\n if (preload()) {\n doPreload()\n }\n }\n\n const handleTouchStart = handleFocus\n\n const handleEnter = (e: MouseEvent) => {\n if (local.disabled) return\n const eventTarget = (e.target || {}) as LinkCurrentTargetElement\n\n if (preload()) {\n if (eventTarget.preloadTimeout) {\n return\n }\n\n eventTarget.preloadTimeout = setTimeout(() => {\n eventTarget.preloadTimeout = null\n doPreload()\n }, preloadDelay())\n }\n }\n\n const handleLeave = (e: MouseEvent) => {\n if (local.disabled) return\n const eventTarget = (e.target || {}) as LinkCurrentTargetElement\n\n if (eventTarget.preloadTimeout) {\n clearTimeout(eventTarget.preloadTimeout)\n eventTarget.preloadTimeout = null\n }\n }\n\n /** Call a JSX.EventHandlerUnion with the event. */\n function callHandler<T, TEvent extends Event>(\n event: TEvent & { currentTarget: T; target: Element },\n handler: Solid.JSX.EventHandlerUnion<T, TEvent> | undefined,\n ) {\n if (handler) {\n if (typeof handler === 'function') {\n handler(event)\n } else {\n handler[0](handler[1], event)\n }\n }\n\n return event.defaultPrevented\n }\n\n function composeEventHandlers<T>(\n handlers: Array<Solid.JSX.EventHandlerUnion<T, any> | undefined>,\n ) {\n return (event: any) => {\n for (const handler of handlers) {\n callHandler(event, handler)\n }\n }\n }\n\n // Get the active props\n const resolvedActiveProps: () => Omit<Solid.ComponentProps<'a'>, 'style'> & {\n style?: Solid.JSX.CSSProperties\n } = () =>\n isActive() ? (functionalUpdate(local.activeProps as any, {}) ?? {}) : {}\n\n // Get the inactive props\n const resolvedInactiveProps: () => Omit<\n Solid.ComponentProps<'a'>,\n 'style'\n > & { style?: Solid.JSX.CSSProperties } = () =>\n isActive() ? {} : functionalUpdate(local.inactiveProps, {})\n\n const resolvedClassName = () =>\n [local.class, resolvedActiveProps().class, resolvedInactiveProps().class]\n .filter(Boolean)\n .join(' ')\n\n const resolvedStyle = () => ({\n ...local.style,\n ...resolvedActiveProps().style,\n ...resolvedInactiveProps().style,\n })\n\n return Solid.mergeProps(\n propsSafeToSpread,\n resolvedActiveProps,\n resolvedInactiveProps,\n () => {\n return {\n href: hrefOption()?.href,\n ref: mergeRefs(setRef, _options().ref),\n onClick: composeEventHandlers([local.onClick, handleClick]),\n onFocus: composeEventHandlers([local.onFocus, handleFocus]),\n onMouseEnter: composeEventHandlers([local.onMouseEnter, handleEnter]),\n onMouseOver: composeEventHandlers([local.onMouseOver, handleEnter]),\n onMouseLeave: composeEventHandlers([local.onMouseLeave, handleLeave]),\n onMouseOut: composeEventHandlers([local.onMouseOut, handleLeave]),\n onTouchStart: composeEventHandlers([\n local.onTouchStart,\n handleTouchStart,\n ]),\n disabled: !!local.disabled,\n target: local.target,\n ...(Object.keys(resolvedStyle).length && { style: resolvedStyle }),\n ...(resolvedClassName() && { class: resolvedClassName() }),\n ...(local.disabled && {\n role: 'link',\n 'aria-disabled': true,\n }),\n ...(isActive() && { 'data-status': 'active', 'aria-current': 'page' }),\n ...(isTransitioning() && { 'data-transitioning': 'transitioning' }),\n }\n },\n ) as any\n}\n\nexport type UseLinkPropsOptions<\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends RoutePaths<TRouter['routeTree']> | string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends RoutePaths<TRouter['routeTree']> | string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<'a', TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n Omit<Solid.ComponentProps<'a'>, 'style'> & { style?: Solid.JSX.CSSProperties }\n\nexport type ActiveLinkOptions<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkOptions<TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n ActiveLinkOptionProps<TComp>\n\ntype ActiveLinkProps<TComp> = Partial<\n LinkComponentSolidProps<TComp> & {\n [key: `data-${string}`]: unknown\n }\n>\n\nexport interface ActiveLinkOptionProps<TComp = 'a'> {\n /**\n * A function that returns additional props for the `active` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n activeProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n /**\n * A function that returns additional props for the `inactive` state of this link.\n * These props override other props passed to the link (`style`'s are merged, `class`'s are concatenated)\n */\n inactiveProps?: ActiveLinkProps<TComp> | (() => ActiveLinkProps<TComp>)\n}\n\nexport type LinkProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = ActiveLinkOptions<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo> &\n LinkPropsChildren\n\nexport interface LinkPropsChildren {\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 | Solid.JSX.Element\n | ((state: {\n isActive: boolean\n isTransitioning: boolean\n }) => Solid.JSX.Element)\n}\n\ntype LinkComponentSolidProps<TComp> = TComp extends Solid.ValidComponent\n ? Omit<Solid.ComponentProps<TComp>, keyof CreateLinkProps>\n : never\n\nexport type LinkComponentProps<\n TComp = 'a',\n TRouter extends AnyRouter = RegisteredRouter,\n TFrom extends string = string,\n TTo extends string | undefined = '.',\n TMaskFrom extends string = TFrom,\n TMaskTo extends string = '.',\n> = LinkComponentSolidProps<TComp> &\n LinkProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>\n\nexport type CreateLinkProps = LinkProps<\n any,\n any,\n string,\n string,\n string,\n string\n>\n\nexport type LinkComponent<\n in out TComp,\n in out TDefaultFrom extends string = string,\n> = <\n TRouter extends AnyRouter = RegisteredRouter,\n const TFrom extends string = TDefaultFrom,\n const TTo extends string | undefined = undefined,\n const TMaskFrom extends string = TFrom,\n const TMaskTo extends string = '',\n>(\n props: LinkComponentProps<TComp, TRouter, TFrom, TTo, TMaskFrom, TMaskTo>,\n) => Solid.JSX.Element\n\nexport interface LinkComponentRoute<\n in out TDefaultFrom extends string = string,\n> {\n defaultFrom: TDefaultFrom\n <\n TRouter extends AnyRouter = RegisteredRouter,\n const TTo extends string | undefined = undefined,\n const TMaskTo extends string = '',\n >(\n props: LinkComponentProps<\n 'a',\n TRouter,\n this['defaultFrom'],\n TTo,\n this['defaultFrom'],\n TMaskTo\n >,\n ): Solid.JSX.Element\n}\n\nexport function createLink<const TComp>(\n Comp: Constrain<TComp, any, (props: CreateLinkProps) => Solid.JSX.Element>,\n): LinkComponent<TComp> {\n return (props) => <Link {...props} _asChild={Comp} />\n}\n\nexport const Link: LinkComponent<'a'> = (props) => {\n const [local, rest] = Solid.splitProps(\n props as typeof props & { _asChild: any },\n ['_asChild', 'children'],\n )\n\n const [_, linkProps] = Solid.splitProps(\n useLinkProps(rest as unknown as any),\n ['type'],\n )\n\n const children = Solid.createMemo(() => {\n const ch = local.children\n if (typeof ch === 'function') {\n return ch({\n get isActive() {\n return (linkProps as any)['data-status'] === 'active'\n },\n isTransitioning: false,\n })\n }\n\n return ch satisfies Solid.JSX.Element\n })\n\n return (\n <Dynamic component={local._asChild ? local._asChild : 'a'} {...linkProps}>\n {children()}\n </Dynamic>\n )\n}\n\nfunction isCtrlEvent(e: MouseEvent) {\n return !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey)\n}\n\nexport type LinkOptionsFnOptions<\n TOptions,\n TComp,\n TRouter extends AnyRouter = RegisteredRouter,\n> =\n TOptions extends ReadonlyArray<any>\n ? ValidateLinkOptionsArray<TRouter, TOptions, string, TComp>\n : ValidateLinkOptions<TRouter, TOptions, string, TComp>\n\nexport type LinkOptionsFn<TComp> = <\n const TOptions,\n TRouter extends AnyRouter = RegisteredRouter,\n>(\n options: LinkOptionsFnOptions<TOptions, TComp, TRouter>,\n) => TOptions\n\nexport const linkOptions: LinkOptionsFn<'a'> = (options) => {\n return options as any\n}\n"],"names":["useLinkProps","options","router","useRouter","isTransitioning","setIsTransitioning","Solid","createSignal","hasRenderFetched","local","rest","splitProps","mergeProps","activeProps","class","inactiveProps","_","propsSafeToSpread","currentSearch","useRouterState","select","s","location","searchStr","from","_options","next","createMemo","buildLocation","hrefOption","disabled","undefined","href","maskedLocation","url","external","origin","startsWith","replace","externalLink","_href","URL","to","preload","reloadDocument","defaultPreload","preloadDelay","defaultPreloadDelay","isActive","activeOptions","exact","testExact","exactPathTest","pathname","basepath","currentPathSplit","removeTrailingSlash","split","nextPathSplit","pathIsFuzzyEqual","every","d","i","includeSearch","searchTest","deepEqual","search","partial","ignoreUndefined","explicitUndefined","includeHash","hash","doPreload","preloadRoute","catch","err","console","warn","preloadWarning","preloadViewportIoCallback","entry","isIntersecting","ref","setRef","useIntersectionObserver","rootMargin","createEffect","handleClick","e","isCtrlEvent","defaultPrevented","target","button","preventDefault","unsub","subscribe","navigate","resetScroll","hashScrollIntoView","startTransition","viewTransition","ignoreBlocker","handleFocus","handleTouchStart","handleEnter","eventTarget","preloadTimeout","setTimeout","handleLeave","clearTimeout","callHandler","event","handler","composeEventHandlers","handlers","resolvedActiveProps","functionalUpdate","resolvedInactiveProps","resolvedClassName","filter","Boolean","join","resolvedStyle","style","mergeRefs","onClick","onFocus","onMouseEnter","onMouseOver","onMouseLeave","onMouseOut","onTouchStart","Object","keys","length","role","createLink","Comp","props","_$createComponent","Link","_$mergeProps","_asChild","linkProps","children","ch","Dynamic","component","metaKey","altKey","ctrlKey","shiftKey","linkOptions"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA8BO,SAASA,aAOdC,SAC2B;AAC3B,QAAMC,SAASC,UAAAA,UAAAA;AACf,QAAM,CAACC,iBAAiBC,kBAAkB,IAAIC,iBAAMC,aAAa,KAAK;AACtE,MAAIC,mBAAmB;AAEvB,QAAM,CAACC,OAAOC,IAAI,IAAIJ,iBAAMK,WAC1BL,iBAAMM,WACJ;AAAA,IACEC,aAAaA,OAAO;AAAA,MAAEC,OAAO;AAAA,IAAA;AAAA,IAC7BC,eAAeA,OAAO,CAAA;AAAA,EAAC,GAEzBd,OACF,GACA,CACE,eACA,iBACA,iBACA,MACA,WACA,gBACA,sBACA,WACA,mBACA,eACA,kBACA,UACA,YACA,SACA,SACA,WACA,WACA,gBACA,gBACA,eACA,cACA,gBACA,eAAe,CAEnB;AA8BA,QAAM,CAACe,GAAGC,iBAAiB,IAAIX,iBAAMK,WAAWD,MAAM,CACpD,UACA,UACA,QACA,SACA,QACA,kBACA,gBAAgB,CACjB;AAED,QAAMQ,gBAAgBC,eAAAA,eAAe;AAAA,IACnCC,QAASC,CAAAA,MAAMA,EAAEC,SAASC;AAAAA,EAAAA,CAC3B;AAED,QAAMC,OAAOvB,QAAQuB;AAErB,QAAMC,WAAWA,MAAM;AACrB,WAAO;AAAA,MACL,GAAGxB;AAAAA,MACHuB;AAAAA,IAAAA;AAAAA,EAEJ;AAEA,QAAME,OAAOpB,iBAAMqB,WAAW,MAAM;AAClCT,kBAAAA;AACA,WAAOhB,OAAO0B,cAAcH,UAAiB;AAAA,EAC/C,CAAC;AAED,QAAMI,aAAavB,iBAAMqB,WAAW,MAAM;AACxC,QAAIF,SAAAA,EAAWK,UAAU;AACvB,aAAOC;AAAAA,IACT;AACA,QAAIC;AACJ,UAAMC,iBAAiBP,OAAOO;AAC9B,QAAIA,gBAAgB;AAClBD,aAAOC,eAAeC;AAAAA,IACxB,OAAO;AACLF,a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