@tanstack/solid-router 2.0.0-alpha.2 → 2.0.0-alpha.4
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/Asset.cjs +124 -167
- package/dist/cjs/Asset.cjs.map +1 -1
- package/dist/cjs/CatchBoundary.cjs +52 -68
- package/dist/cjs/CatchBoundary.cjs.map +1 -1
- package/dist/cjs/ClientOnly.cjs +61 -39
- package/dist/cjs/ClientOnly.cjs.map +1 -1
- package/dist/cjs/HeadContent.cjs +35 -27
- package/dist/cjs/HeadContent.cjs.map +1 -1
- package/dist/cjs/HeadContent.dev.cjs +48 -41
- package/dist/cjs/HeadContent.dev.cjs.map +1 -1
- package/dist/cjs/Match.cjs +367 -442
- package/dist/cjs/Match.cjs.map +1 -1
- package/dist/cjs/Matches.cjs +114 -158
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/RouterProvider.cjs +29 -41
- package/dist/cjs/RouterProvider.cjs.map +1 -1
- package/dist/cjs/SafeFragment.cjs +7 -5
- package/dist/cjs/SafeFragment.cjs.map +1 -1
- package/dist/cjs/ScriptOnce.cjs +20 -22
- package/dist/cjs/ScriptOnce.cjs.map +1 -1
- package/dist/cjs/Scripts.cjs +43 -58
- package/dist/cjs/Scripts.cjs.map +1 -1
- package/dist/cjs/ScrollRestoration.cjs +26 -28
- package/dist/cjs/ScrollRestoration.cjs.map +1 -1
- package/dist/cjs/Transitioner.cjs +91 -124
- package/dist/cjs/Transitioner.cjs.map +1 -1
- package/dist/cjs/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/cjs/awaited.cjs +31 -53
- package/dist/cjs/awaited.cjs.map +1 -1
- package/dist/cjs/fileRoute.cjs +96 -91
- package/dist/cjs/fileRoute.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +2 -2
- package/dist/cjs/headContentUtils.cjs +132 -170
- package/dist/cjs/headContentUtils.cjs.map +1 -1
- package/dist/cjs/index.cjs +245 -176
- package/dist/cjs/index.dev.cjs +245 -176
- package/dist/cjs/lazyRouteComponent.cjs +48 -54
- package/dist/cjs/lazyRouteComponent.cjs.map +1 -1
- package/dist/cjs/link.cjs +310 -345
- package/dist/cjs/link.cjs.map +1 -1
- package/dist/cjs/matchContext.cjs +9 -23
- package/dist/cjs/matchContext.cjs.map +1 -1
- package/dist/cjs/not-found.cjs +26 -34
- package/dist/cjs/not-found.cjs.map +1 -1
- package/dist/cjs/renderRouteNotFound.cjs +23 -16
- package/dist/cjs/renderRouteNotFound.cjs.map +1 -1
- package/dist/cjs/route.cjs +200 -215
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/router.cjs +18 -16
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/routerContext.cjs +8 -22
- package/dist/cjs/routerContext.cjs.map +1 -1
- package/dist/cjs/scroll-restoration.cjs +25 -35
- package/dist/cjs/scroll-restoration.cjs.map +1 -1
- package/dist/cjs/ssr/RouterClient.cjs +18 -23
- package/dist/cjs/ssr/RouterClient.cjs.map +1 -1
- package/dist/cjs/ssr/RouterServer.cjs +10 -10
- package/dist/cjs/ssr/RouterServer.cjs.map +1 -1
- package/dist/cjs/ssr/client.cjs +2 -4
- package/dist/cjs/ssr/defaultRenderHandler.cjs +12 -16
- package/dist/cjs/ssr/defaultRenderHandler.cjs.map +1 -1
- package/dist/cjs/ssr/defaultStreamHandler.cjs +13 -18
- package/dist/cjs/ssr/defaultStreamHandler.cjs.map +1 -1
- package/dist/cjs/ssr/renderRouterToStream.cjs +26 -54
- package/dist/cjs/ssr/renderRouterToStream.cjs.map +1 -1
- package/dist/cjs/ssr/renderRouterToString.cjs +33 -57
- package/dist/cjs/ssr/renderRouterToString.cjs.map +1 -1
- package/dist/cjs/ssr/server.cjs +18 -18
- package/dist/cjs/useBlocker.cjs +140 -177
- package/dist/cjs/useBlocker.cjs.map +1 -1
- package/dist/cjs/useBlocker.d.cts +8 -5
- package/dist/cjs/useCanGoBack.cjs +6 -5
- package/dist/cjs/useCanGoBack.cjs.map +1 -1
- package/dist/cjs/useLoaderData.cjs +12 -11
- package/dist/cjs/useLoaderData.cjs.map +1 -1
- package/dist/cjs/useLoaderDeps.cjs +12 -14
- package/dist/cjs/useLoaderDeps.cjs.map +1 -1
- package/dist/cjs/useLocation.cjs +6 -7
- package/dist/cjs/useLocation.cjs.map +1 -1
- package/dist/cjs/useMatch.cjs +25 -46
- package/dist/cjs/useMatch.cjs.map +1 -1
- package/dist/cjs/useNavigate.cjs +20 -38
- package/dist/cjs/useNavigate.cjs.map +1 -1
- package/dist/cjs/useParams.cjs +14 -13
- package/dist/cjs/useParams.cjs.map +1 -1
- package/dist/cjs/useRouteContext.cjs +9 -8
- package/dist/cjs/useRouteContext.cjs.map +1 -1
- package/dist/cjs/useRouter.cjs +13 -26
- package/dist/cjs/useRouter.cjs.map +1 -1
- package/dist/cjs/useRouterState.cjs +38 -45
- package/dist/cjs/useRouterState.cjs.map +1 -1
- package/dist/cjs/useSearch.cjs +13 -12
- package/dist/cjs/useSearch.cjs.map +1 -1
- package/dist/cjs/utils.cjs +57 -49
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/esm/Asset.js +122 -166
- package/dist/esm/Asset.js.map +1 -1
- package/dist/esm/CatchBoundary.js +48 -50
- package/dist/esm/CatchBoundary.js.map +1 -1
- package/dist/esm/ClientOnly.js +58 -22
- package/dist/esm/ClientOnly.js.map +1 -1
- package/dist/esm/HeadContent.dev.js +46 -40
- package/dist/esm/HeadContent.dev.js.map +1 -1
- package/dist/esm/HeadContent.js +33 -26
- package/dist/esm/HeadContent.js.map +1 -1
- package/dist/esm/Match.js +359 -422
- package/dist/esm/Match.js.map +1 -1
- package/dist/esm/Matches.js +107 -142
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/RouterProvider.js +26 -40
- package/dist/esm/RouterProvider.js.map +1 -1
- package/dist/esm/SafeFragment.js +6 -5
- package/dist/esm/SafeFragment.js.map +1 -1
- package/dist/esm/ScriptOnce.js +18 -21
- package/dist/esm/ScriptOnce.js.map +1 -1
- package/dist/esm/Scripts.js +42 -58
- package/dist/esm/Scripts.js.map +1 -1
- package/dist/esm/ScrollRestoration.js +25 -29
- package/dist/esm/ScrollRestoration.js.map +1 -1
- package/dist/esm/Transitioner.js +87 -105
- package/dist/esm/Transitioner.js.map +1 -1
- package/dist/esm/awaited.js +28 -36
- package/dist/esm/awaited.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +2 -2
- package/dist/esm/fileRoute.js +90 -92
- package/dist/esm/fileRoute.js.map +1 -1
- package/dist/esm/headContentUtils.js +129 -152
- package/dist/esm/headContentUtils.js.map +1 -1
- package/dist/esm/index.dev.js +15 -115
- package/dist/esm/index.js +17 -116
- package/dist/esm/lazyRouteComponent.js +46 -53
- package/dist/esm/lazyRouteComponent.js.map +1 -1
- package/dist/esm/link.js +306 -329
- package/dist/esm/link.js.map +1 -1
- package/dist/esm/matchContext.js +7 -7
- package/dist/esm/matchContext.js.map +1 -1
- package/dist/esm/not-found.js +23 -33
- package/dist/esm/not-found.js.map +1 -1
- package/dist/esm/renderRouteNotFound.js +20 -15
- package/dist/esm/renderRouteNotFound.js.map +1 -1
- package/dist/esm/route.js +193 -218
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.js +17 -17
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/routerContext.js +6 -5
- package/dist/esm/routerContext.js.map +1 -1
- package/dist/esm/scroll-restoration.js +23 -34
- package/dist/esm/scroll-restoration.js.map +1 -1
- package/dist/esm/ssr/RouterClient.js +16 -22
- package/dist/esm/ssr/RouterClient.js.map +1 -1
- package/dist/esm/ssr/RouterServer.js +9 -10
- package/dist/esm/ssr/RouterServer.js.map +1 -1
- package/dist/esm/ssr/client.js +1 -4
- package/dist/esm/ssr/defaultRenderHandler.js +11 -15
- package/dist/esm/ssr/defaultRenderHandler.js.map +1 -1
- package/dist/esm/ssr/defaultStreamHandler.js +12 -17
- package/dist/esm/ssr/defaultStreamHandler.js.map +1 -1
- package/dist/esm/ssr/renderRouterToStream.js +23 -36
- package/dist/esm/ssr/renderRouterToStream.js.map +1 -1
- package/dist/esm/ssr/renderRouterToString.js +31 -40
- package/dist/esm/ssr/renderRouterToString.js.map +1 -1
- package/dist/esm/ssr/server.js +3 -10
- package/dist/esm/useBlocker.d.ts +8 -5
- package/dist/esm/useBlocker.js +136 -159
- package/dist/esm/useBlocker.js.map +1 -1
- package/dist/esm/useCanGoBack.js +6 -5
- package/dist/esm/useCanGoBack.js.map +1 -1
- package/dist/esm/useLoaderData.js +12 -11
- package/dist/esm/useLoaderData.js.map +1 -1
- package/dist/esm/useLoaderDeps.js +12 -14
- package/dist/esm/useLoaderDeps.js.map +1 -1
- package/dist/esm/useLocation.js +6 -7
- package/dist/esm/useLocation.js.map +1 -1
- package/dist/esm/useMatch.js +21 -28
- package/dist/esm/useMatch.js.map +1 -1
- package/dist/esm/useNavigate.js +18 -22
- package/dist/esm/useNavigate.js.map +1 -1
- package/dist/esm/useParams.js +14 -13
- package/dist/esm/useParams.js.map +1 -1
- package/dist/esm/useRouteContext.js +9 -8
- package/dist/esm/useRouteContext.js.map +1 -1
- package/dist/esm/useRouter.js +9 -8
- package/dist/esm/useRouter.js.map +1 -1
- package/dist/esm/useRouterState.js +36 -44
- package/dist/esm/useRouterState.js.map +1 -1
- package/dist/esm/useSearch.js +13 -12
- package/dist/esm/useSearch.js.map +1 -1
- package/dist/esm/utils.js +55 -33
- package/dist/esm/utils.js.map +1 -1
- package/dist/source/fileRoute.d.ts +2 -2
- package/dist/source/useBlocker.d.ts +8 -5
- package/dist/source/useBlocker.jsx +2 -2
- package/dist/source/useBlocker.jsx.map +1 -1
- package/package.json +8 -8
- package/src/fileRoute.ts +2 -2
- package/src/useBlocker.tsx +15 -10
- package/dist/cjs/index.cjs.map +0 -1
- package/dist/cjs/index.dev.cjs.map +0 -1
- package/dist/cjs/ssr/client.cjs.map +0 -1
- package/dist/cjs/ssr/server.cjs.map +0 -1
- package/dist/esm/index.dev.js.map +0 -1
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/ssr/client.js.map +0 -1
- package/dist/esm/ssr/server.js.map +0 -1
package/dist/cjs/ClientOnly.cjs
CHANGED
|
@@ -1,45 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
1
|
+
const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
let _solidjs_web = require("@solidjs/web");
|
|
3
|
+
let solid_js = require("solid-js");
|
|
4
|
+
solid_js = require_runtime.__toESM(solid_js);
|
|
5
|
+
//#region src/ClientOnly.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Render the children only after the JS has loaded client-side. Use an optional
|
|
8
|
+
* fallback component if the JS is not yet loaded.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* Render a Chart component if JS loads, renders a simple FakeChart
|
|
12
|
+
* component server-side or if there is no JS. The FakeChart can have only the
|
|
13
|
+
* UI without the behavior or be a loading spinner or skeleton.
|
|
14
|
+
*
|
|
15
|
+
* ```tsx
|
|
16
|
+
* return (
|
|
17
|
+
* <ClientOnly fallback={<FakeChart />}>
|
|
18
|
+
* <Chart />
|
|
19
|
+
* </ClientOnly>
|
|
20
|
+
* )
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
22
23
|
function ClientOnly(props) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
const hydrated = useHydrated();
|
|
25
|
+
return (0, _solidjs_web.createComponent)(solid_js.Show, {
|
|
26
|
+
get when() {
|
|
27
|
+
return hydrated();
|
|
28
|
+
},
|
|
29
|
+
get fallback() {
|
|
30
|
+
return props.fallback ?? null;
|
|
31
|
+
},
|
|
32
|
+
get children() {
|
|
33
|
+
return (0, _solidjs_web.memo)(() => props.children);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Return a boolean indicating if the JS has been hydrated already.
|
|
39
|
+
* When doing Server-Side Rendering, the result will always be false.
|
|
40
|
+
* When doing Client-Side Rendering, the result will always be false on the
|
|
41
|
+
* first render and true from then on. Even if a new component renders it will
|
|
42
|
+
* always start with true.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```tsx
|
|
46
|
+
* // Disable a button that needs JS to work.
|
|
47
|
+
* const hydrated = useHydrated()
|
|
48
|
+
* return (
|
|
49
|
+
* <button type="button" disabled={!hydrated()} onClick={doSomethingCustom}>
|
|
50
|
+
* Click me
|
|
51
|
+
* </button>
|
|
52
|
+
* )
|
|
53
|
+
* ```
|
|
54
|
+
* @returns True if the JS has been hydrated already, false otherwise.
|
|
55
|
+
*/
|
|
36
56
|
function useHydrated() {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
57
|
+
const [hydrated, setHydrated] = solid_js.createSignal(false);
|
|
58
|
+
solid_js.createEffect(() => true, () => {
|
|
59
|
+
setHydrated(true);
|
|
60
|
+
});
|
|
61
|
+
return hydrated;
|
|
42
62
|
}
|
|
63
|
+
//#endregion
|
|
43
64
|
exports.ClientOnly = ClientOnly;
|
|
44
65
|
exports.useHydrated = useHydrated;
|
|
45
|
-
|
|
66
|
+
|
|
67
|
+
//# sourceMappingURL=ClientOnly.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientOnly.cjs","sources":["../../src/ClientOnly.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport interface ClientOnlyProps {\n /**\n * The children to render when the JS is loaded.\n */\n children: Solid.JSX.Element\n /**\n * The fallback component to render if the JS is not yet loaded.\n */\n fallback?: Solid.JSX.Element\n}\n\n/**\n * Render the children only after the JS has loaded client-side. Use an optional\n * fallback component if the JS is not yet loaded.\n *\n * @example\n * Render a Chart component if JS loads, renders a simple FakeChart\n * component server-side or if there is no JS. The FakeChart can have only the\n * UI without the behavior or be a loading spinner or skeleton.\n *\n * ```tsx\n * return (\n * <ClientOnly fallback={<FakeChart />}>\n * <Chart />\n * </ClientOnly>\n * )\n * ```\n */\nexport function ClientOnly(props: ClientOnlyProps) {\n const hydrated = useHydrated()\n return (\n <Solid.Show when={hydrated()} fallback={props.fallback ?? null}>\n <>{props.children}</>\n </Solid.Show>\n )\n}\n\n/**\n * Return a boolean indicating if the JS has been hydrated already.\n * When doing Server-Side Rendering, the result will always be false.\n * When doing Client-Side Rendering, the result will always be false on the\n * first render and true from then on. Even if a new component renders it will\n * always start with true.\n *\n * @example\n * ```tsx\n * // Disable a button that needs JS to work.\n * const hydrated = useHydrated()\n * return (\n * <button type=\"button\" disabled={!hydrated()} onClick={doSomethingCustom}>\n * Click me\n * </button>\n * )\n * ```\n * @returns True if the JS has been hydrated already, false otherwise.\n */\nexport function useHydrated(): Solid.Accessor<boolean> {\n const [hydrated, setHydrated] = Solid.createSignal(false)\n\n Solid.createEffect(\n () => true,\n () => {\n setHydrated(true)\n },\n )\n\n return hydrated\n}\n"],"
|
|
1
|
+
{"version":3,"file":"ClientOnly.cjs","names":["Solid","ClientOnlyProps","children","JSX","Element","fallback","ClientOnly","props","hydrated","useHydrated","_$createComponent","Show","when","_$memo","Accessor","setHydrated","createSignal","createEffect"],"sources":["../../src/ClientOnly.tsx"],"sourcesContent":["import * as Solid from 'solid-js'\n\nexport interface ClientOnlyProps {\n /**\n * The children to render when the JS is loaded.\n */\n children: Solid.JSX.Element\n /**\n * The fallback component to render if the JS is not yet loaded.\n */\n fallback?: Solid.JSX.Element\n}\n\n/**\n * Render the children only after the JS has loaded client-side. Use an optional\n * fallback component if the JS is not yet loaded.\n *\n * @example\n * Render a Chart component if JS loads, renders a simple FakeChart\n * component server-side or if there is no JS. The FakeChart can have only the\n * UI without the behavior or be a loading spinner or skeleton.\n *\n * ```tsx\n * return (\n * <ClientOnly fallback={<FakeChart />}>\n * <Chart />\n * </ClientOnly>\n * )\n * ```\n */\nexport function ClientOnly(props: ClientOnlyProps) {\n const hydrated = useHydrated()\n return (\n <Solid.Show when={hydrated()} fallback={props.fallback ?? null}>\n <>{props.children}</>\n </Solid.Show>\n )\n}\n\n/**\n * Return a boolean indicating if the JS has been hydrated already.\n * When doing Server-Side Rendering, the result will always be false.\n * When doing Client-Side Rendering, the result will always be false on the\n * first render and true from then on. Even if a new component renders it will\n * always start with true.\n *\n * @example\n * ```tsx\n * // Disable a button that needs JS to work.\n * const hydrated = useHydrated()\n * return (\n * <button type=\"button\" disabled={!hydrated()} onClick={doSomethingCustom}>\n * Click me\n * </button>\n * )\n * ```\n * @returns True if the JS has been hydrated already, false otherwise.\n */\nexport function useHydrated(): Solid.Accessor<boolean> {\n const [hydrated, setHydrated] = Solid.createSignal(false)\n\n Solid.createEffect(\n () => true,\n () => {\n setHydrated(true)\n },\n )\n\n return hydrated\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,SAAgBM,WAAWC,OAAwB;CACjD,MAAMC,WAAWC,aAAa;AAC9B,SAAA,GAAA,aAAA,iBACGT,SAAMW,MAAI;EAAA,IAACC,OAAI;AAAA,UAAEJ,UAAU;;EAAA,IAAEH,WAAQ;AAAA,UAAEE,MAAMF,YAAY;;EAAI,IAAAH,WAAA;AAAA,WAAA,GAAA,aAAA,YACzDK,MAAML,SAAQ;;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;AAwBvB,SAAgBO,cAAuC;CACrD,MAAM,CAACD,UAAUO,eAAef,SAAMgB,aAAa,MAAM;AAEzDhB,UAAMiB,mBACE,YACA;AACJF,cAAY,KAAK;GAEpB;AAED,QAAOP"}
|
package/dist/cjs/HeadContent.cjs
CHANGED
|
@@ -1,30 +1,38 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_Asset = require("./Asset.cjs");
|
|
3
|
+
const require_headContentUtils = require("./headContentUtils.cjs");
|
|
4
|
+
let _solidjs_web = require("@solidjs/web");
|
|
5
|
+
let solid_js = require("solid-js");
|
|
6
|
+
//#region src/HeadContent.tsx
|
|
7
|
+
/**
|
|
8
|
+
* @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.
|
|
9
|
+
* When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`
|
|
10
|
+
* to ensure it's part of the reactive tree and updates correctly during client-side navigation.
|
|
11
|
+
* The component uses portals internally to render content into the `<head>` element.
|
|
12
|
+
*/
|
|
7
13
|
function HeadContent() {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
14
|
+
const tags = require_headContentUtils.useTags();
|
|
15
|
+
return (0, _solidjs_web.createComponent)(solid_js.For, {
|
|
16
|
+
get each() {
|
|
17
|
+
return tags();
|
|
18
|
+
},
|
|
19
|
+
children: (tag) => {
|
|
20
|
+
const t = tag();
|
|
21
|
+
return (0, _solidjs_web.createComponent)(require_Asset.Asset, {
|
|
22
|
+
get tag() {
|
|
23
|
+
return t.tag;
|
|
24
|
+
},
|
|
25
|
+
get attrs() {
|
|
26
|
+
return t.attrs;
|
|
27
|
+
},
|
|
28
|
+
get children() {
|
|
29
|
+
return t.children;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
});
|
|
28
34
|
}
|
|
35
|
+
//#endregion
|
|
29
36
|
exports.HeadContent = HeadContent;
|
|
30
|
-
|
|
37
|
+
|
|
38
|
+
//# sourceMappingURL=HeadContent.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadContent.cjs","sources":["../../src/HeadContent.tsx"],"sourcesContent":["import { 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 <For each={tags()}>\n {(tag) => {\n const t = tag() as any\n return <Asset tag={t.tag} attrs={t.attrs} children={t.children} />\n }}\n </For>\n )\n}\n"],"
|
|
1
|
+
{"version":3,"file":"HeadContent.cjs","names":["For","Asset","useTags","HeadContent","tags","_$createComponent","each","children","tag","t","attrs"],"sources":["../../src/HeadContent.tsx"],"sourcesContent":["import { 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 <For each={tags()}>\n {(tag) => {\n const t = tag() as any\n return <Asset tag={t.tag} attrs={t.attrs} children={t.children} />\n }}\n </For>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAUA,SAAgBG,cAAc;CAC5B,MAAMC,OAAOF,yBAAAA,SAAS;AAEtB,SAAA,GAAA,aAAA,iBACGF,SAAAA,KAAG;EAAA,IAACM,OAAI;AAAA,UAAEF,MAAM;;EAAAG,WACbC,QAAQ;GACR,MAAMC,IAAID,KAAK;AACf,WAAA,GAAA,aAAA,iBAAQP,cAAAA,OAAK;IAAA,IAACO,MAAG;AAAA,YAAEC,EAAED;;IAAG,IAAEE,QAAK;AAAA,YAAED,EAAEC;;IAAK,IAAEH,WAAQ;AAAA,YAAEE,EAAEF;;IAAQ,CAAA;;EAC/D,CAAA"}
|
|
@@ -1,44 +1,51 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
require("./_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_ClientOnly = require("./ClientOnly.cjs");
|
|
3
|
+
const require_Asset = require("./Asset.cjs");
|
|
4
|
+
const require_headContentUtils = require("./headContentUtils.cjs");
|
|
5
|
+
let _solidjs_web = require("@solidjs/web");
|
|
6
|
+
let solid_js = require("solid-js");
|
|
7
|
+
//#region src/HeadContent.dev.tsx
|
|
8
|
+
var DEV_STYLES_ATTR = "data-tanstack-router-dev-styles";
|
|
9
|
+
/**
|
|
10
|
+
* @description The `HeadContent` component is used to render meta tags, links, and scripts for the current route.
|
|
11
|
+
* When using full document hydration (hydrating from `<html>`), this component should be rendered in the `<body>`
|
|
12
|
+
* to ensure it's part of the reactive tree and updates correctly during client-side navigation.
|
|
13
|
+
* The component uses portals internally to render content into the `<head>` element.
|
|
14
|
+
*
|
|
15
|
+
* Development version: filters out dev styles link after hydration and
|
|
16
|
+
* includes a fallback cleanup effect for hydration mismatch cases.
|
|
17
|
+
*/
|
|
9
18
|
function HeadContent() {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
});
|
|
19
|
+
const tags = require_headContentUtils.useTags();
|
|
20
|
+
const hydrated = require_ClientOnly.useHydrated();
|
|
21
|
+
(0, solid_js.createEffect)(() => [hydrated()], ([hydrated]) => {
|
|
22
|
+
if (hydrated) document.querySelectorAll(`link[${DEV_STYLES_ATTR}]`).forEach((el) => el.remove());
|
|
23
|
+
});
|
|
24
|
+
const filteredTags = (0, solid_js.createMemo)(() => {
|
|
25
|
+
if (hydrated()) return tags().filter((tag) => !tag.attrs?.[DEV_STYLES_ATTR]);
|
|
26
|
+
return tags();
|
|
27
|
+
});
|
|
28
|
+
return (0, _solidjs_web.createComponent)(solid_js.For, {
|
|
29
|
+
get each() {
|
|
30
|
+
return filteredTags();
|
|
31
|
+
},
|
|
32
|
+
children: (tag) => {
|
|
33
|
+
const t = tag();
|
|
34
|
+
return (0, _solidjs_web.createComponent)(require_Asset.Asset, {
|
|
35
|
+
get tag() {
|
|
36
|
+
return t.tag;
|
|
37
|
+
},
|
|
38
|
+
get attrs() {
|
|
39
|
+
return t.attrs;
|
|
40
|
+
},
|
|
41
|
+
get children() {
|
|
42
|
+
return t.children;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
42
47
|
}
|
|
48
|
+
//#endregion
|
|
43
49
|
exports.HeadContent = HeadContent;
|
|
44
|
-
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=HeadContent.dev.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadContent.dev.cjs","sources":["../../src/HeadContent.dev.tsx"],"sourcesContent":["import { 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 () => [hydrated()] as const,\n ([hydrated]) => {\n if (hydrated) {\n document\n .querySelectorAll(`link[${DEV_STYLES_ATTR}]`)\n .forEach((el) => el.remove())\n }\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 <For each={filteredTags()}>\n {(tag) => {\n const t = tag() as any\n return <Asset tag={t.tag} attrs={t.attrs} children={t.children} />\n }}\n </For>\n )\n}\n"],"
|
|
1
|
+
{"version":3,"file":"HeadContent.dev.cjs","names":["For","createEffect","createMemo","Asset","useHydrated","useTags","DEV_STYLES_ATTR","HeadContent","tags","hydrated","const","document","querySelectorAll","forEach","el","remove","filteredTags","filter","tag","attrs","_$createComponent","each","children","t"],"sources":["../../src/HeadContent.dev.tsx"],"sourcesContent":["import { 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 () => [hydrated()] as const,\n ([hydrated]) => {\n if (hydrated) {\n document\n .querySelectorAll(`link[${DEV_STYLES_ATTR}]`)\n .forEach((el) => el.remove())\n }\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 <For each={filteredTags()}>\n {(tag) => {\n const t = tag() as any\n return <Asset tag={t.tag} attrs={t.attrs} children={t.children} />\n }}\n </For>\n )\n}\n"],"mappings":";;;;;;;AAKA,IAAMM,kBAAkB;;;;;;;;;;AAWxB,SAAgBC,cAAc;CAC5B,MAAMC,OAAOH,yBAAAA,SAAS;CACtB,MAAMI,WAAWL,mBAAAA,aAAa;AAI9BH,EAAAA,GAAAA,SAAAA,oBACQ,CAACQ,UAAU,CAAC,GACjB,CAACA,cAAc;AACd,MAAIA,SACFE,UACGC,iBAAiB,QAAQN,gBAAe,GAAI,CAC5CO,SAASC,OAAOA,GAAGC,QAAQ,CAAC;GAGpC;CAGD,MAAMC,gBAAAA,GAAAA,SAAAA,kBAAgC;AACpC,MAAIP,UAAU,CACZ,QAAOD,MAAM,CAACS,QAAQC,QAAQ,CAACA,IAAIC,QAAQb,iBAAiB;AAE9D,SAAOE,MAAM;GACb;AAEF,SAAA,GAAA,aAAA,iBACGR,SAAAA,KAAG;EAAA,IAACqB,OAAI;AAAA,UAAEL,cAAc;;EAAAM,WACrBJ,QAAQ;GACR,MAAMK,IAAIL,KAAK;AACf,WAAA,GAAA,aAAA,iBAAQf,cAAAA,OAAK;IAAA,IAACe,MAAG;AAAA,YAAEK,EAAEL;;IAAG,IAAEC,QAAK;AAAA,YAAEI,EAAEJ;;IAAK,IAAEG,WAAQ;AAAA,YAAEC,EAAED;;IAAQ,CAAA;;EAC/D,CAAA"}
|