@tanstack/solid-router 1.147.1 → 1.149.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/HeadContent.cjs +5 -196
- package/dist/cjs/HeadContent.cjs.map +1 -1
- package/dist/cjs/HeadContent.d.cts +1 -4
- package/dist/cjs/HeadContent.dev.cjs +36 -0
- package/dist/cjs/HeadContent.dev.cjs.map +1 -0
- package/dist/cjs/HeadContent.dev.d.cts +10 -0
- package/dist/cjs/headContentUtils.cjs +174 -0
- package/dist/cjs/headContentUtils.cjs.map +1 -0
- package/dist/cjs/headContentUtils.d.cts +7 -0
- package/dist/cjs/index.cjs +2 -1
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -1
- package/dist/cjs/index.dev.cjs +259 -0
- package/dist/cjs/index.dev.cjs.map +1 -0
- package/dist/cjs/index.dev.d.cts +2 -0
- package/dist/cjs/ssr/RouterServer.cjs +2 -2
- package/dist/cjs/ssr/RouterServer.cjs.map +1 -1
- package/dist/esm/HeadContent.d.ts +1 -4
- package/dist/esm/HeadContent.dev.d.ts +10 -0
- package/dist/esm/HeadContent.dev.js +36 -0
- package/dist/esm/HeadContent.dev.js.map +1 -0
- package/dist/esm/HeadContent.js +6 -181
- package/dist/esm/HeadContent.js.map +1 -1
- package/dist/esm/headContentUtils.d.ts +7 -0
- package/dist/esm/headContentUtils.js +157 -0
- package/dist/esm/headContentUtils.js.map +1 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.dev.d.ts +2 -0
- package/dist/esm/index.dev.js +142 -0
- package/dist/esm/index.dev.js.map +1 -0
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/ssr/RouterServer.js +1 -1
- package/dist/esm/ssr/RouterServer.js.map +1 -1
- package/dist/source/HeadContent.d.ts +1 -4
- package/dist/source/HeadContent.dev.d.ts +10 -0
- package/dist/source/HeadContent.dev.jsx +39 -0
- package/dist/source/HeadContent.dev.jsx.map +1 -0
- package/dist/source/HeadContent.jsx +2 -202
- package/dist/source/HeadContent.jsx.map +1 -1
- package/dist/source/headContentUtils.d.ts +7 -0
- package/dist/source/headContentUtils.jsx +181 -0
- package/dist/source/headContentUtils.jsx.map +1 -0
- package/dist/source/index.d.ts +2 -1
- package/dist/source/index.dev.d.ts +2 -0
- package/dist/source/index.dev.jsx +6 -0
- package/dist/source/index.dev.jsx.map +1 -0
- package/dist/source/index.jsx +2 -1
- package/dist/source/index.jsx.map +1 -1
- package/dist/source/ssr/RouterServer.jsx +1 -1
- package/dist/source/ssr/RouterServer.jsx.map +1 -1
- package/package.json +5 -2
- package/src/HeadContent.dev.tsx +45 -0
- package/src/HeadContent.tsx +2 -235
- package/src/headContentUtils.tsx +209 -0
- package/src/index.dev.tsx +6 -0
- package/src/index.tsx +2 -1
- package/src/ssr/RouterServer.tsx +1 -1
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const routerCore = require("@tanstack/router-core");
|
|
4
|
+
const history = require("@tanstack/history");
|
|
5
|
+
const awaited = require("./awaited.cjs");
|
|
6
|
+
const CatchBoundary = require("./CatchBoundary.cjs");
|
|
7
|
+
const ClientOnly = require("./ClientOnly.cjs");
|
|
8
|
+
const fileRoute = require("./fileRoute.cjs");
|
|
9
|
+
const lazyRouteComponent = require("./lazyRouteComponent.cjs");
|
|
10
|
+
const link = require("./link.cjs");
|
|
11
|
+
const Matches = require("./Matches.cjs");
|
|
12
|
+
const matchContext = require("./matchContext.cjs");
|
|
13
|
+
const Match = require("./Match.cjs");
|
|
14
|
+
const useMatch = require("./useMatch.cjs");
|
|
15
|
+
const useLoaderDeps = require("./useLoaderDeps.cjs");
|
|
16
|
+
const useLoaderData = require("./useLoaderData.cjs");
|
|
17
|
+
const route = require("./route.cjs");
|
|
18
|
+
const router = require("./router.cjs");
|
|
19
|
+
const RouterProvider = require("./RouterProvider.cjs");
|
|
20
|
+
const ScrollRestoration = require("./ScrollRestoration.cjs");
|
|
21
|
+
const useBlocker = require("./useBlocker.cjs");
|
|
22
|
+
const useNavigate = require("./useNavigate.cjs");
|
|
23
|
+
const useParams = require("./useParams.cjs");
|
|
24
|
+
const useSearch = require("./useSearch.cjs");
|
|
25
|
+
const routerContext = require("./routerContext.cjs");
|
|
26
|
+
const useRouteContext = require("./useRouteContext.cjs");
|
|
27
|
+
const useRouter = require("./useRouter.cjs");
|
|
28
|
+
const useRouterState = require("./useRouterState.cjs");
|
|
29
|
+
const useLocation = require("./useLocation.cjs");
|
|
30
|
+
const useCanGoBack = require("./useCanGoBack.cjs");
|
|
31
|
+
const utils = require("./utils.cjs");
|
|
32
|
+
const notFound = require("./not-found.cjs");
|
|
33
|
+
const ScriptOnce = require("./ScriptOnce.cjs");
|
|
34
|
+
const Asset = require("./Asset.cjs");
|
|
35
|
+
const headContentUtils = require("./headContentUtils.cjs");
|
|
36
|
+
const Scripts = require("./Scripts.cjs");
|
|
37
|
+
const HeadContent_dev = require("./HeadContent.dev.cjs");
|
|
38
|
+
Object.defineProperty(exports, "PathParamError", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: () => routerCore.PathParamError
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "SearchParamError", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: () => routerCore.SearchParamError
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "TSR_DEFERRED_PROMISE", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: () => routerCore.TSR_DEFERRED_PROMISE
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "cleanPath", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: () => routerCore.cleanPath
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "componentTypes", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: () => routerCore.componentTypes
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "composeRewrites", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: () => routerCore.composeRewrites
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "createControlledPromise", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: () => routerCore.createControlledPromise
|
|
65
|
+
});
|
|
66
|
+
Object.defineProperty(exports, "createSerializationAdapter", {
|
|
67
|
+
enumerable: true,
|
|
68
|
+
get: () => routerCore.createSerializationAdapter
|
|
69
|
+
});
|
|
70
|
+
Object.defineProperty(exports, "deepEqual", {
|
|
71
|
+
enumerable: true,
|
|
72
|
+
get: () => routerCore.deepEqual
|
|
73
|
+
});
|
|
74
|
+
Object.defineProperty(exports, "defaultParseSearch", {
|
|
75
|
+
enumerable: true,
|
|
76
|
+
get: () => routerCore.defaultParseSearch
|
|
77
|
+
});
|
|
78
|
+
Object.defineProperty(exports, "defaultSerializeError", {
|
|
79
|
+
enumerable: true,
|
|
80
|
+
get: () => routerCore.defaultSerializeError
|
|
81
|
+
});
|
|
82
|
+
Object.defineProperty(exports, "defaultStringifySearch", {
|
|
83
|
+
enumerable: true,
|
|
84
|
+
get: () => routerCore.defaultStringifySearch
|
|
85
|
+
});
|
|
86
|
+
Object.defineProperty(exports, "defer", {
|
|
87
|
+
enumerable: true,
|
|
88
|
+
get: () => routerCore.defer
|
|
89
|
+
});
|
|
90
|
+
Object.defineProperty(exports, "functionalUpdate", {
|
|
91
|
+
enumerable: true,
|
|
92
|
+
get: () => routerCore.functionalUpdate
|
|
93
|
+
});
|
|
94
|
+
Object.defineProperty(exports, "getInitialRouterState", {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: () => routerCore.getInitialRouterState
|
|
97
|
+
});
|
|
98
|
+
Object.defineProperty(exports, "interpolatePath", {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: () => routerCore.interpolatePath
|
|
101
|
+
});
|
|
102
|
+
Object.defineProperty(exports, "isMatch", {
|
|
103
|
+
enumerable: true,
|
|
104
|
+
get: () => routerCore.isMatch
|
|
105
|
+
});
|
|
106
|
+
Object.defineProperty(exports, "isNotFound", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
get: () => routerCore.isNotFound
|
|
109
|
+
});
|
|
110
|
+
Object.defineProperty(exports, "isPlainArray", {
|
|
111
|
+
enumerable: true,
|
|
112
|
+
get: () => routerCore.isPlainArray
|
|
113
|
+
});
|
|
114
|
+
Object.defineProperty(exports, "isPlainObject", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: () => routerCore.isPlainObject
|
|
117
|
+
});
|
|
118
|
+
Object.defineProperty(exports, "isRedirect", {
|
|
119
|
+
enumerable: true,
|
|
120
|
+
get: () => routerCore.isRedirect
|
|
121
|
+
});
|
|
122
|
+
Object.defineProperty(exports, "joinPaths", {
|
|
123
|
+
enumerable: true,
|
|
124
|
+
get: () => routerCore.joinPaths
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "lazyFn", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: () => routerCore.lazyFn
|
|
129
|
+
});
|
|
130
|
+
Object.defineProperty(exports, "notFound", {
|
|
131
|
+
enumerable: true,
|
|
132
|
+
get: () => routerCore.notFound
|
|
133
|
+
});
|
|
134
|
+
Object.defineProperty(exports, "parseSearchWith", {
|
|
135
|
+
enumerable: true,
|
|
136
|
+
get: () => routerCore.parseSearchWith
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "redirect", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: () => routerCore.redirect
|
|
141
|
+
});
|
|
142
|
+
Object.defineProperty(exports, "replaceEqualDeep", {
|
|
143
|
+
enumerable: true,
|
|
144
|
+
get: () => routerCore.replaceEqualDeep
|
|
145
|
+
});
|
|
146
|
+
Object.defineProperty(exports, "resolvePath", {
|
|
147
|
+
enumerable: true,
|
|
148
|
+
get: () => routerCore.resolvePath
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "retainSearchParams", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: () => routerCore.retainSearchParams
|
|
153
|
+
});
|
|
154
|
+
Object.defineProperty(exports, "rootRouteId", {
|
|
155
|
+
enumerable: true,
|
|
156
|
+
get: () => routerCore.rootRouteId
|
|
157
|
+
});
|
|
158
|
+
Object.defineProperty(exports, "stringifySearchWith", {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: () => routerCore.stringifySearchWith
|
|
161
|
+
});
|
|
162
|
+
Object.defineProperty(exports, "stripSearchParams", {
|
|
163
|
+
enumerable: true,
|
|
164
|
+
get: () => routerCore.stripSearchParams
|
|
165
|
+
});
|
|
166
|
+
Object.defineProperty(exports, "trimPath", {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: () => routerCore.trimPath
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(exports, "trimPathLeft", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: () => routerCore.trimPathLeft
|
|
173
|
+
});
|
|
174
|
+
Object.defineProperty(exports, "trimPathRight", {
|
|
175
|
+
enumerable: true,
|
|
176
|
+
get: () => routerCore.trimPathRight
|
|
177
|
+
});
|
|
178
|
+
Object.defineProperty(exports, "createBrowserHistory", {
|
|
179
|
+
enumerable: true,
|
|
180
|
+
get: () => history.createBrowserHistory
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(exports, "createHashHistory", {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: () => history.createHashHistory
|
|
185
|
+
});
|
|
186
|
+
Object.defineProperty(exports, "createHistory", {
|
|
187
|
+
enumerable: true,
|
|
188
|
+
get: () => history.createHistory
|
|
189
|
+
});
|
|
190
|
+
Object.defineProperty(exports, "createMemoryHistory", {
|
|
191
|
+
enumerable: true,
|
|
192
|
+
get: () => history.createMemoryHistory
|
|
193
|
+
});
|
|
194
|
+
exports.Await = awaited.Await;
|
|
195
|
+
exports.useAwaited = awaited.useAwaited;
|
|
196
|
+
exports.CatchBoundary = CatchBoundary.CatchBoundary;
|
|
197
|
+
exports.ErrorComponent = CatchBoundary.ErrorComponent;
|
|
198
|
+
exports.ClientOnly = ClientOnly.ClientOnly;
|
|
199
|
+
exports.useHydrated = ClientOnly.useHydrated;
|
|
200
|
+
exports.FileRoute = fileRoute.FileRoute;
|
|
201
|
+
exports.FileRouteLoader = fileRoute.FileRouteLoader;
|
|
202
|
+
exports.LazyRoute = fileRoute.LazyRoute;
|
|
203
|
+
exports.createFileRoute = fileRoute.createFileRoute;
|
|
204
|
+
exports.createLazyFileRoute = fileRoute.createLazyFileRoute;
|
|
205
|
+
exports.createLazyRoute = fileRoute.createLazyRoute;
|
|
206
|
+
exports.lazyRouteComponent = lazyRouteComponent.lazyRouteComponent;
|
|
207
|
+
exports.Link = link.Link;
|
|
208
|
+
exports.createLink = link.createLink;
|
|
209
|
+
exports.linkOptions = link.linkOptions;
|
|
210
|
+
exports.useLinkProps = link.useLinkProps;
|
|
211
|
+
exports.MatchRoute = Matches.MatchRoute;
|
|
212
|
+
exports.Matches = Matches.Matches;
|
|
213
|
+
exports.useChildMatches = Matches.useChildMatches;
|
|
214
|
+
exports.useMatchRoute = Matches.useMatchRoute;
|
|
215
|
+
exports.useMatches = Matches.useMatches;
|
|
216
|
+
exports.useParentMatches = Matches.useParentMatches;
|
|
217
|
+
exports.matchContext = matchContext.matchContext;
|
|
218
|
+
exports.Match = Match.Match;
|
|
219
|
+
exports.Outlet = Match.Outlet;
|
|
220
|
+
exports.useMatch = useMatch.useMatch;
|
|
221
|
+
exports.useLoaderDeps = useLoaderDeps.useLoaderDeps;
|
|
222
|
+
exports.useLoaderData = useLoaderData.useLoaderData;
|
|
223
|
+
exports.NotFoundRoute = route.NotFoundRoute;
|
|
224
|
+
exports.RootRoute = route.RootRoute;
|
|
225
|
+
exports.Route = route.Route;
|
|
226
|
+
exports.RouteApi = route.RouteApi;
|
|
227
|
+
exports.createRootRoute = route.createRootRoute;
|
|
228
|
+
exports.createRootRouteWithContext = route.createRootRouteWithContext;
|
|
229
|
+
exports.createRoute = route.createRoute;
|
|
230
|
+
exports.createRouteMask = route.createRouteMask;
|
|
231
|
+
exports.getRouteApi = route.getRouteApi;
|
|
232
|
+
exports.rootRouteWithContext = route.rootRouteWithContext;
|
|
233
|
+
exports.Router = router.Router;
|
|
234
|
+
exports.createRouter = router.createRouter;
|
|
235
|
+
exports.RouterContextProvider = RouterProvider.RouterContextProvider;
|
|
236
|
+
exports.RouterProvider = RouterProvider.RouterProvider;
|
|
237
|
+
exports.ScrollRestoration = ScrollRestoration.ScrollRestoration;
|
|
238
|
+
exports.useElementScrollRestoration = ScrollRestoration.useElementScrollRestoration;
|
|
239
|
+
exports.Block = useBlocker.Block;
|
|
240
|
+
exports.useBlocker = useBlocker.useBlocker;
|
|
241
|
+
exports.Navigate = useNavigate.Navigate;
|
|
242
|
+
exports.useNavigate = useNavigate.useNavigate;
|
|
243
|
+
exports.useParams = useParams.useParams;
|
|
244
|
+
exports.useSearch = useSearch.useSearch;
|
|
245
|
+
exports.getRouterContext = routerContext.getRouterContext;
|
|
246
|
+
exports.useRouteContext = useRouteContext.useRouteContext;
|
|
247
|
+
exports.useRouter = useRouter.useRouter;
|
|
248
|
+
exports.useRouterState = useRouterState.useRouterState;
|
|
249
|
+
exports.useLocation = useLocation.useLocation;
|
|
250
|
+
exports.useCanGoBack = useCanGoBack.useCanGoBack;
|
|
251
|
+
exports.useLayoutEffect = utils.useLayoutEffect;
|
|
252
|
+
exports.CatchNotFound = notFound.CatchNotFound;
|
|
253
|
+
exports.DefaultGlobalNotFound = notFound.DefaultGlobalNotFound;
|
|
254
|
+
exports.ScriptOnce = ScriptOnce.ScriptOnce;
|
|
255
|
+
exports.Asset = Asset.Asset;
|
|
256
|
+
exports.useTags = headContentUtils.useTags;
|
|
257
|
+
exports.Scripts = Scripts.Scripts;
|
|
258
|
+
exports.HeadContent = HeadContent_dev.HeadContent;
|
|
259
|
+
//# sourceMappingURL=index.dev.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.dev.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const Solid = require("solid-js/web");
|
|
4
4
|
const meta = require("@solidjs/meta");
|
|
5
5
|
const Asset = require("../Asset.cjs");
|
|
6
|
-
const
|
|
6
|
+
const headContentUtils = require("../headContentUtils.cjs");
|
|
7
7
|
const RouterProvider = require("../RouterProvider.cjs");
|
|
8
8
|
const Scripts = require("../Scripts.cjs");
|
|
9
9
|
var _tmpl$ = /* @__PURE__ */ Solid.template(`<html><head></head><body>`);
|
|
10
10
|
function ServerHeadContent() {
|
|
11
|
-
const tags =
|
|
11
|
+
const tags = headContentUtils.useTags();
|
|
12
12
|
Solid.useAssets(() => {
|
|
13
13
|
return Solid.createComponent(meta.MetaProvider, {
|
|
14
14
|
get children() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RouterServer.cjs","sources":["../../../src/ssr/RouterServer.tsx"],"sourcesContent":["import {\n Hydration,\n HydrationScript,\n NoHydration,\n ssr,\n useAssets,\n} from 'solid-js/web'\nimport { MetaProvider } from '@solidjs/meta'\nimport { Asset } from '../Asset'\nimport { useTags } from '../
|
|
1
|
+
{"version":3,"file":"RouterServer.cjs","sources":["../../../src/ssr/RouterServer.tsx"],"sourcesContent":["import {\n Hydration,\n HydrationScript,\n NoHydration,\n ssr,\n useAssets,\n} from 'solid-js/web'\nimport { MetaProvider } from '@solidjs/meta'\nimport { Asset } from '../Asset'\nimport { useTags } from '../headContentUtils'\nimport { RouterProvider } from '../RouterProvider'\nimport { Scripts } from '../Scripts'\nimport type { AnyRouter } from '@tanstack/router-core'\n\nexport function ServerHeadContent() {\n const tags = useTags()\n useAssets(() => {\n return (\n <MetaProvider>\n {tags().map((tag) => (\n <Asset {...tag} />\n ))}\n </MetaProvider>\n )\n })\n return null\n}\n\nconst docType = ssr('<!DOCTYPE html>')\n\nexport function RouterServer<TRouter extends AnyRouter>(props: {\n router: TRouter\n}) {\n return (\n <NoHydration>\n {docType as any}\n <html>\n <head>\n <HydrationScript />\n </head>\n <body>\n <Hydration>\n <RouterProvider\n router={props.router}\n InnerWrap={(props) => (\n <NoHydration>\n <MetaProvider>\n <ServerHeadContent />\n <Hydration>{props.children}</Hydration>\n <Scripts />\n </MetaProvider>\n </NoHydration>\n )}\n />\n </Hydration>\n </body>\n </html>\n </NoHydration>\n )\n}\n"],"names":["ServerHeadContent","tags","useTags","useAssets","_$createComponent","MetaProvider","children","map","tag","Asset","docType","ssr","RouterServer","props","NoHydration","_el$","_tmpl$","_el$3","firstChild","_$insert","Hydration","RouterProvider","router","InnerWrap","Scripts"],"mappings":";;;;;;;;;AAcO,SAASA,oBAAoB;AAClC,QAAMC,OAAOC,iBAAAA,QAAAA;AACbC,QAAAA,UAAU,MAAM;AACd,WAAAC,MAAAA,gBACGC,KAAAA,cAAY;AAAA,MAAA,IAAAC,WAAA;AAAA,eACVL,OAAOM,IAAKC,SAAGJ,sBACbK,MAAAA,OAAUD,GAAG,CACf;AAAA,MAAC;AAAA,IAAA,CAAA;AAAA,EAGR,CAAC;AACD,SAAO;AACT;AAEA,MAAME,UAAUC,MAAAA,IAAI,iBAAiB;AAE9B,SAASC,aAAwCC,OAErD;AACD,SAAAT,MAAAA,gBACGU,MAAAA,aAAW;AAAA,IAAA,IAAAR,WAAA;AAAA,aAAA,CACTI,UAAc,MAAA;AAAA,YAAAK,OAAAC,OAAAA,GAAAC,QAAAF,KAAAG;AAAAC,qBAAAF,OAAAb,MAAAA,gBAMVgB,iBAAS;AAAA,UAAA,IAAAd,WAAA;AAAA,mBAAAF,MAAAA,gBACPiB,eAAAA,gBAAc;AAAA,cAAA,IACbC,SAAM;AAAA,uBAAET,MAAMS;AAAAA,cAAM;AAAA,cACpBC,WAAYV,CAAAA,WAAKT,MAAAA,gBACdU,mBAAW;AAAA,gBAAA,IAAAR,WAAA;AAAA,yBAAAF,MAAAA,gBACTC,KAAAA,cAAY;AAAA,oBAAA,IAAAC,WAAA;AAAA,6BAAA,CAAAF,MAAAA,gBACVJ,mBAAiB,CAAA,CAAA,GAAAI,MAAAA,gBACjBgB,MAAAA,WAAS;AAAA,wBAAA,IAAAd,WAAA;AAAA,iCAAEO,OAAMP;AAAAA,wBAAQ;AAAA,sBAAA,CAAA,GAAAF,MAAAA,gBACzBoB,iBAAO,CAAA,CAAA,CAAA;AAAA,oBAAA;AAAA,kBAAA,CAAA;AAAA,gBAAA;AAAA,cAAA,CAAA;AAAA,YAAA,CAGb;AAAA,UAAA;AAAA,QAAA,CAAA,CAAA;AAAA,eAAAT;AAAAA,MAAA,IAAA;AAAA,IAAA;AAAA,EAAA,CAAA;AAOf;;;"}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import { RouterManagedTag } from '@tanstack/router-core';
|
|
2
|
-
import * as Solid from 'solid-js';
|
|
3
|
-
export declare const useTags: () => () => RouterManagedTag[];
|
|
4
1
|
/**
|
|
5
2
|
* @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.
|
|
6
3
|
* When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`
|
|
7
4
|
* to ensure it's part of the reactive tree and updates correctly during client-side navigation.
|
|
8
5
|
* The component uses portals internally to render content into the `<head>` element.
|
|
9
6
|
*/
|
|
10
|
-
export declare function HeadContent():
|
|
7
|
+
export declare function HeadContent(): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.
|
|
3
|
+
* When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`
|
|
4
|
+
* to ensure it's part of the reactive tree and updates correctly during client-side navigation.
|
|
5
|
+
* The component uses portals internally to render content into the `<head>` element.
|
|
6
|
+
*
|
|
7
|
+
* Development version: filters out dev styles link after hydration and
|
|
8
|
+
* includes a fallback cleanup effect for hydration mismatch cases.
|
|
9
|
+
*/
|
|
10
|
+
export declare function HeadContent(): import("solid-js").JSX.Element;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { createComponent } from "solid-js/web";
|
|
2
|
+
import { MetaProvider } from "@solidjs/meta";
|
|
3
|
+
import { createEffect, createMemo, For } from "solid-js";
|
|
4
|
+
import { Asset } from "./Asset.js";
|
|
5
|
+
import { useHydrated } from "./ClientOnly.js";
|
|
6
|
+
import { useTags } from "./headContentUtils.js";
|
|
7
|
+
const DEV_STYLES_ATTR = "data-tanstack-router-dev-styles";
|
|
8
|
+
function HeadContent() {
|
|
9
|
+
const tags = useTags();
|
|
10
|
+
const hydrated = useHydrated();
|
|
11
|
+
createEffect(() => {
|
|
12
|
+
if (hydrated()) {
|
|
13
|
+
document.querySelectorAll(`link[${DEV_STYLES_ATTR}]`).forEach((el) => el.remove());
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const filteredTags = createMemo(() => {
|
|
17
|
+
if (hydrated()) {
|
|
18
|
+
return tags().filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR]);
|
|
19
|
+
}
|
|
20
|
+
return tags();
|
|
21
|
+
});
|
|
22
|
+
return createComponent(MetaProvider, {
|
|
23
|
+
get children() {
|
|
24
|
+
return createComponent(For, {
|
|
25
|
+
get each() {
|
|
26
|
+
return filteredTags();
|
|
27
|
+
},
|
|
28
|
+
children: (tag) => createComponent(Asset, tag)
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export {
|
|
34
|
+
HeadContent
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=HeadContent.dev.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeadContent.dev.js","sources":["../../src/HeadContent.dev.tsx"],"sourcesContent":["import { MetaProvider } from '@solidjs/meta'\nimport { For, createEffect, createMemo } from 'solid-js'\nimport { Asset } from './Asset'\nimport { useHydrated } from './ClientOnly'\nimport { useTags } from './headContentUtils'\n\nconst DEV_STYLES_ATTR = 'data-tanstack-router-dev-styles'\n\n/**\n * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.\n * When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`\n * to ensure it's part of the reactive tree and updates correctly during client-side navigation.\n * The component uses portals internally to render content into the `<head>` element.\n *\n * Development version: filters out dev styles link after hydration and\n * includes a fallback cleanup effect for hydration mismatch cases.\n */\nexport function HeadContent() {\n const tags = useTags()\n const hydrated = useHydrated()\n\n // Fallback cleanup for hydration mismatch cases\n // Runs when hydration completes to remove any orphaned dev styles links from DOM\n createEffect(() => {\n if (hydrated()) {\n document\n .querySelectorAll(`link[${DEV_STYLES_ATTR}]`)\n .forEach((el) => el.remove())\n }\n })\n\n // Filter out dev styles after hydration\n const filteredTags = createMemo(() => {\n if (hydrated()) {\n return tags().filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR])\n }\n return tags()\n })\n\n return (\n <MetaProvider>\n <For each={filteredTags()}>{(tag) => <Asset {...tag} />}</For>\n </MetaProvider>\n )\n}\n"],"names":["DEV_STYLES_ATTR","HeadContent","tags","useTags","hydrated","useHydrated","createEffect","document","querySelectorAll","forEach","el","remove","filteredTags","createMemo","filter","tag","attrs","_$createComponent","MetaProvider","children","For","each","Asset"],"mappings":";;;;;;AAMA,MAAMA,kBAAkB;AAWjB,SAASC,cAAc;AAC5B,QAAMC,OAAOC,QAAAA;AACb,QAAMC,WAAWC,YAAAA;AAIjBC,eAAa,MAAM;AACjB,QAAIF,YAAY;AACdG,eACGC,iBAAiB,QAAQR,eAAe,GAAG,EAC3CS,QAASC,CAAAA,OAAOA,GAAGC,OAAAA,CAAQ;AAAA,IAChC;AAAA,EACF,CAAC;AAGD,QAAMC,eAAeC,WAAW,MAAM;AACpC,QAAIT,YAAY;AACd,aAAOF,KAAAA,EAAOY,OAAQC,CAAAA,QAAQ,CAACA,IAAIC,QAAQhB,eAAe,CAAC;AAAA,IAC7D;AACA,WAAOE,KAAAA;AAAAA,EACT,CAAC;AAED,SAAAe,gBACGC,cAAY;AAAA,IAAA,IAAAC,WAAA;AAAA,aAAAF,gBACVG,KAAG;AAAA,QAAA,IAACC,OAAI;AAAA,iBAAET,aAAAA;AAAAA,QAAc;AAAA,QAAAO,UAAIJ,CAAAA,QAAGE,gBAAMK,OAAUP,GAAG;AAAA,MAAA,CAAI;AAAA,IAAA;AAAA,EAAA,CAAA;AAG7D;"}
|
package/dist/esm/HeadContent.js
CHANGED
|
@@ -1,197 +1,22 @@
|
|
|
1
|
-
import { createComponent
|
|
2
|
-
import * as Solid from "solid-js";
|
|
3
|
-
import { Show, For, onMount } from "solid-js";
|
|
1
|
+
import { createComponent } from "solid-js/web";
|
|
4
2
|
import { MetaProvider } from "@solidjs/meta";
|
|
5
|
-
import {
|
|
3
|
+
import { For } from "solid-js";
|
|
6
4
|
import { Asset } from "./Asset.js";
|
|
7
|
-
import {
|
|
8
|
-
import { useRouterState } from "./useRouterState.js";
|
|
9
|
-
var _tmpl$ = /* @__PURE__ */ template(`<link rel=stylesheet data-tanstack-start-dev-styles>`);
|
|
10
|
-
const useTags = () => {
|
|
11
|
-
const router = useRouter();
|
|
12
|
-
const nonce = router.options.ssr?.nonce;
|
|
13
|
-
const routeMeta = useRouterState({
|
|
14
|
-
select: (state) => {
|
|
15
|
-
return state.matches.map((match) => match.meta).filter(Boolean);
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
const meta = Solid.createMemo(() => {
|
|
19
|
-
const resultMeta = [];
|
|
20
|
-
const metaByAttribute = {};
|
|
21
|
-
let title;
|
|
22
|
-
const routeMetasArray = routeMeta();
|
|
23
|
-
for (let i = routeMetasArray.length - 1; i >= 0; i--) {
|
|
24
|
-
const metas = routeMetasArray[i];
|
|
25
|
-
for (let j = metas.length - 1; j >= 0; j--) {
|
|
26
|
-
const m = metas[j];
|
|
27
|
-
if (!m) continue;
|
|
28
|
-
if (m.title) {
|
|
29
|
-
if (!title) {
|
|
30
|
-
title = {
|
|
31
|
-
tag: "title",
|
|
32
|
-
children: m.title
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
} else if ("script:ld+json" in m) {
|
|
36
|
-
try {
|
|
37
|
-
const json = JSON.stringify(m["script:ld+json"]);
|
|
38
|
-
resultMeta.push({
|
|
39
|
-
tag: "script",
|
|
40
|
-
attrs: {
|
|
41
|
-
type: "application/ld+json"
|
|
42
|
-
},
|
|
43
|
-
children: escapeHtml(json)
|
|
44
|
-
});
|
|
45
|
-
} catch {
|
|
46
|
-
}
|
|
47
|
-
} else {
|
|
48
|
-
const attribute = m.name ?? m.property;
|
|
49
|
-
if (attribute) {
|
|
50
|
-
if (metaByAttribute[attribute]) {
|
|
51
|
-
continue;
|
|
52
|
-
} else {
|
|
53
|
-
metaByAttribute[attribute] = true;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
resultMeta.push({
|
|
57
|
-
tag: "meta",
|
|
58
|
-
attrs: {
|
|
59
|
-
...m,
|
|
60
|
-
nonce
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (title) {
|
|
67
|
-
resultMeta.push(title);
|
|
68
|
-
}
|
|
69
|
-
if (router.options.ssr?.nonce) {
|
|
70
|
-
resultMeta.push({
|
|
71
|
-
tag: "meta",
|
|
72
|
-
attrs: {
|
|
73
|
-
property: "csp-nonce",
|
|
74
|
-
content: router.options.ssr.nonce
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
resultMeta.reverse();
|
|
79
|
-
return resultMeta;
|
|
80
|
-
});
|
|
81
|
-
const links = useRouterState({
|
|
82
|
-
select: (state) => {
|
|
83
|
-
const constructed = state.matches.map((match) => match.links).filter(Boolean).flat(1).map((link) => ({
|
|
84
|
-
tag: "link",
|
|
85
|
-
attrs: {
|
|
86
|
-
...link,
|
|
87
|
-
nonce
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
const manifest = router.ssr?.manifest;
|
|
91
|
-
const assets = state.matches.map((match) => manifest?.routes[match.routeId]?.assets ?? []).filter(Boolean).flat(1).filter((asset) => asset.tag === "link").map((asset) => ({
|
|
92
|
-
tag: "link",
|
|
93
|
-
attrs: {
|
|
94
|
-
...asset.attrs,
|
|
95
|
-
nonce
|
|
96
|
-
}
|
|
97
|
-
}));
|
|
98
|
-
return [...constructed, ...assets];
|
|
99
|
-
}
|
|
100
|
-
});
|
|
101
|
-
const preloadLinks = useRouterState({
|
|
102
|
-
select: (state) => {
|
|
103
|
-
const preloadLinks2 = [];
|
|
104
|
-
state.matches.map((match) => router.looseRoutesById[match.routeId]).forEach((route) => router.ssr?.manifest?.routes[route.id]?.preloads?.filter(Boolean).forEach((preload) => {
|
|
105
|
-
preloadLinks2.push({
|
|
106
|
-
tag: "link",
|
|
107
|
-
attrs: {
|
|
108
|
-
rel: "modulepreload",
|
|
109
|
-
href: preload,
|
|
110
|
-
nonce
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
}));
|
|
114
|
-
return preloadLinks2;
|
|
115
|
-
}
|
|
116
|
-
});
|
|
117
|
-
const styles = useRouterState({
|
|
118
|
-
select: (state) => state.matches.map((match) => match.styles).flat(1).filter(Boolean).map(({
|
|
119
|
-
children,
|
|
120
|
-
...style
|
|
121
|
-
}) => ({
|
|
122
|
-
tag: "style",
|
|
123
|
-
attrs: {
|
|
124
|
-
...style,
|
|
125
|
-
nonce
|
|
126
|
-
},
|
|
127
|
-
children
|
|
128
|
-
}))
|
|
129
|
-
});
|
|
130
|
-
const headScripts = useRouterState({
|
|
131
|
-
select: (state) => state.matches.map((match) => match.headScripts).flat(1).filter(Boolean).map(({
|
|
132
|
-
children,
|
|
133
|
-
...script
|
|
134
|
-
}) => ({
|
|
135
|
-
tag: "script",
|
|
136
|
-
attrs: {
|
|
137
|
-
...script,
|
|
138
|
-
nonce
|
|
139
|
-
},
|
|
140
|
-
children
|
|
141
|
-
}))
|
|
142
|
-
});
|
|
143
|
-
return () => uniqBy([...meta(), ...preloadLinks(), ...links(), ...styles(), ...headScripts()], (d) => {
|
|
144
|
-
return JSON.stringify(d);
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
|
-
function DevStylesLink() {
|
|
148
|
-
const router = useRouter();
|
|
149
|
-
const routeIds = useRouterState({
|
|
150
|
-
select: (state) => state.matches.map((match) => match.routeId)
|
|
151
|
-
});
|
|
152
|
-
onMount(() => {
|
|
153
|
-
document.querySelectorAll("[data-tanstack-start-dev-styles]").forEach((el) => el.remove());
|
|
154
|
-
});
|
|
155
|
-
const href = () => buildDevStylesUrl(router.basepath, routeIds());
|
|
156
|
-
return (() => {
|
|
157
|
-
var _el$ = _tmpl$();
|
|
158
|
-
effect(() => setAttribute(_el$, "href", href()));
|
|
159
|
-
return _el$;
|
|
160
|
-
})();
|
|
161
|
-
}
|
|
5
|
+
import { useTags } from "./headContentUtils.js";
|
|
162
6
|
function HeadContent() {
|
|
163
7
|
const tags = useTags();
|
|
164
8
|
return createComponent(MetaProvider, {
|
|
165
9
|
get children() {
|
|
166
|
-
return
|
|
167
|
-
get when() {
|
|
168
|
-
return process.env.NODE_ENV !== "production";
|
|
169
|
-
},
|
|
170
|
-
get children() {
|
|
171
|
-
return createComponent(DevStylesLink, {});
|
|
172
|
-
}
|
|
173
|
-
}), createComponent(For, {
|
|
10
|
+
return createComponent(For, {
|
|
174
11
|
get each() {
|
|
175
12
|
return tags();
|
|
176
13
|
},
|
|
177
14
|
children: (tag) => createComponent(Asset, tag)
|
|
178
|
-
})
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
}
|
|
182
|
-
function uniqBy(arr, fn) {
|
|
183
|
-
const seen = /* @__PURE__ */ new Set();
|
|
184
|
-
return arr.filter((item) => {
|
|
185
|
-
const key = fn(item);
|
|
186
|
-
if (seen.has(key)) {
|
|
187
|
-
return false;
|
|
15
|
+
});
|
|
188
16
|
}
|
|
189
|
-
seen.add(key);
|
|
190
|
-
return true;
|
|
191
17
|
});
|
|
192
18
|
}
|
|
193
19
|
export {
|
|
194
|
-
HeadContent
|
|
195
|
-
useTags
|
|
20
|
+
HeadContent
|
|
196
21
|
};
|
|
197
22
|
//# sourceMappingURL=HeadContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadContent.js","sources":["../../src/HeadContent.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\nimport { MetaProvider } from '@solidjs/meta'\nimport { For, Show, onMount } from 'solid-js'\nimport { buildDevStylesUrl, escapeHtml } from '@tanstack/router-core'\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 const nonce = router.options.ssr?.nonce\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 if ('script:ld+json' in m) {\n // Handle JSON-LD structured data\n // Content is HTML-escaped to prevent XSS when injected via innerHTML\n try {\n const json = JSON.stringify(m['script:ld+json'])\n resultMeta.push({\n tag: 'script',\n attrs: {\n type: 'application/ld+json',\n },\n children: escapeHtml(json),\n })\n } catch {\n // Skip invalid JSON-LD objects\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 nonce,\n },\n })\n }\n }\n }\n\n if (title) {\n resultMeta.push(title)\n }\n\n if (router.options.ssr?.nonce) {\n resultMeta.push({\n tag: 'meta',\n attrs: {\n property: 'csp-nonce',\n content: router.options.ssr.nonce,\n },\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 nonce,\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, nonce },\n }) satisfies RouterManagedTag,\n )\n\n return [...constructed, ...assets]\n },\n })\n\n const preloadLinks = useRouterState({\n select: (state) => {\n const preloadLinks: 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 preloadLinks.push({\n tag: 'link',\n attrs: {\n rel: 'modulepreload',\n href: preload,\n nonce,\n },\n })\n }),\n )\n\n return preloadLinks\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 nonce,\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 nonce,\n },\n children,\n })),\n })\n\n return () =>\n uniqBy(\n [\n ...meta(),\n ...preloadLinks(),\n ...links(),\n ...styles(),\n ...headScripts(),\n ] as Array<RouterManagedTag>,\n (d) => {\n return JSON.stringify(d)\n },\n )\n}\n\n/**\n * Renders a stylesheet link for dev mode CSS collection.\n * On the server, renders the full link with route-scoped CSS URL.\n * On the client, renders the same link to avoid hydration mismatch,\n * then removes it after hydration since Vite's HMR handles CSS updates.\n */\nfunction DevStylesLink() {\n const router = useRouter()\n const routeIds = useRouterState({\n select: (state) => state.matches.map((match) => match.routeId),\n })\n\n onMount(() => {\n // After hydration, remove the SSR-rendered dev styles link\n document\n .querySelectorAll('[data-tanstack-start-dev-styles]')\n .forEach((el) => el.remove())\n })\n\n const href = () => buildDevStylesUrl(router.basepath, routeIds())\n\n return <link rel=\"stylesheet\" href={href()} data-tanstack-start-dev-styles />\n}\n\n/**\n * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.\n * When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`\n * to ensure it's part of the reactive tree and updates correctly during client-side navigation.\n * The component uses portals internally to render content into the `<head>` element.\n */\nexport function HeadContent() {\n const tags = useTags()\n\n return (\n <MetaProvider>\n <Show when={process.env.NODE_ENV !== 'production'}>\n <DevStylesLink />\n </Show>\n <For each={tags()}>{(tag) => <Asset {...tag} />}</For>\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","nonce","options","ssr","routeMeta","useRouterState","select","state","matches","map","match","meta","filter","Boolean","Solid","createMemo","resultMeta","metaByAttribute","title","routeMetasArray","i","length","metas","j","m","tag","children","json","JSON","stringify","push","attrs","type","escapeHtml","attribute","name","property","content","reverse","links","constructed","flat","link","manifest","assets","routes","routeId","asset","preloadLinks","looseRoutesById","forEach","route","id","preloads","preload","rel","href","styles","style","headScripts","script","uniqBy","d","DevStylesLink","routeIds","onMount","document","querySelectorAll","el","remove","buildDevStylesUrl","basepath","_el$","_tmpl$","_$effect","_$setAttribute","HeadContent","tags","_$createComponent","MetaProvider","Show","when","process","env","NODE_ENV","For","each","Asset","arr","fn","seen","Set","item","key","has","add"],"mappings":";;;;;;;;;AASO,MAAMA,UAAUA,MAAM;AAC3B,QAAMC,SAASC,UAAAA;AACf,QAAMC,QAAQF,OAAOG,QAAQC,KAAKF;AAClC,QAAMG,YAAYC,eAAe;AAAA,IAC/BC,QAASC,CAAAA,UAAU;AACjB,aAAOA,MAAMC,QAAQC,IAAKC,CAAAA,UAAUA,MAAMC,IAAK,EAAEC,OAAOC,OAAO;AAAA,IACjE;AAAA,EAAA,CACD;AAED,QAAMF,OAAgDG,MAAMC,WAAW,MAAM;AAC3E,UAAMC,aAAsC,CAAA;AAC5C,UAAMC,kBAAwC,CAAA;AAC9C,QAAIC;AACJ,UAAMC,kBAAkBf,UAAAA;AACxB,aAASgB,IAAID,gBAAgBE,SAAS,GAAGD,KAAK,GAAGA,KAAK;AACpD,YAAME,QAAQH,gBAAgBC,CAAC;AAC/B,eAASG,IAAID,MAAMD,SAAS,GAAGE,KAAK,GAAGA,KAAK;AAC1C,cAAMC,IAAIF,MAAMC,CAAC;AACjB,YAAI,CAACC,EAAG;AAER,YAAIA,EAAEN,OAAO;AACX,cAAI,CAACA,OAAO;AACVA,oBAAQ;AAAA,cACNO,KAA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O,SAASI,cAAc;AAC5B,QAAMC,OAAO/E,QAAAA;AAEb,SAAAgF,gBACGC,cAAY;AAAA,IAAA,IAAArD,WAAA;AAAA,aAAA,CAAAoD,gBACVE,MAAI;AAAA,QAAA,IAACC,OAAI;AAAA,iBAAEC,QAAQC,IAAIC,aAAa;AAAA,QAAY;AAAA,QAAA,IAAA1D,WAAA;AAAA,iBAAAoD,gBAC9Cf,eAAa,EAAA;AAAA,QAAA;AAAA,MAAA,CAAA,GAAAe,gBAEfO,KAAG;AAAA,QAAA,IAACC,OAAI;AAAA,iBAAET,KAAAA;AAAAA,QAAM;AAAA,QAAAnD,UAAID,CAAAA,QAAGqD,gBAAMS,OAAU9D,GAAG;AAAA,MAAA,CAAI,CAAA;AAAA,IAAA;AAAA,EAAA,CAAA;AAGrD;AAEA,SAASoC,OAAU2B,KAAeC,IAAyB;AACzD,QAAMC,2BAAWC,IAAAA;AACjB,SAAOH,IAAI5E,OAAQgF,CAAAA,SAAS;AAC1B,UAAMC,MAAMJ,GAAGG,IAAI;AACnB,QAAIF,KAAKI,IAAID,GAAG,GAAG;AACjB,aAAO;AAAA,IACT;AACAH,SAAKK,IAAIF,GAAG;AACZ,WAAO;AAAA,EACT,CAAC;AACH;"}
|
|
1
|
+
{"version":3,"file":"HeadContent.js","sources":["../../src/HeadContent.tsx"],"sourcesContent":["import { MetaProvider } from '@solidjs/meta'\nimport { For } from 'solid-js'\nimport { Asset } from './Asset'\nimport { useTags } from './headContentUtils'\n\n/**\n * @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.\n * When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`\n * to ensure it's part of the reactive tree and updates correctly during client-side navigation.\n * The component uses portals internally to render content into the `<head>` element.\n */\nexport function HeadContent() {\n const tags = useTags()\n\n return (\n <MetaProvider>\n <For each={tags()}>{(tag) => <Asset {...tag} />}</For>\n </MetaProvider>\n )\n}\n"],"names":["HeadContent","tags","useTags","_$createComponent","MetaProvider","children","For","each","tag","Asset"],"mappings":";;;;;AAWO,SAASA,cAAc;AAC5B,QAAMC,OAAOC,QAAAA;AAEb,SAAAC,gBACGC,cAAY;AAAA,IAAA,IAAAC,WAAA;AAAA,aAAAF,gBACVG,KAAG;AAAA,QAAA,IAACC,OAAI;AAAA,iBAAEN,KAAAA;AAAAA,QAAM;AAAA,QAAAI,UAAIG,CAAAA,QAAGL,gBAAMM,OAAUD,GAAG;AAAA,MAAA,CAAI;AAAA,IAAA;AAAA,EAAA,CAAA;AAGrD;"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { RouterManagedTag } from '@tanstack/router-core';
|
|
2
|
+
/**
|
|
3
|
+
* Build the list of head/link/meta/script tags to render for active matches.
|
|
4
|
+
* Used internally by `HeadContent`.
|
|
5
|
+
*/
|
|
6
|
+
export declare const useTags: () => () => RouterManagedTag[];
|
|
7
|
+
export declare function uniqBy<T>(arr: Array<T>, fn: (item: T) => string): T[];
|