@tanstack/solid-router 2.0.0-beta.14 → 2.0.0-beta.16
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 +4 -4
- package/dist/cjs/HeadContent.cjs.map +1 -1
- package/dist/esm/HeadContent.js +5 -5
- package/dist/esm/HeadContent.js.map +1 -1
- package/dist/source/HeadContent.jsx +11 -5
- package/dist/source/HeadContent.jsx.map +1 -1
- package/package.json +4 -4
- package/src/HeadContent.tsx +14 -8
package/dist/cjs/HeadContent.cjs
CHANGED
|
@@ -14,7 +14,7 @@ let solid_js = require("solid-js");
|
|
|
14
14
|
function HeadContent(props) {
|
|
15
15
|
const tags = require_headContentUtils.useTags(props.assetCrossOrigin);
|
|
16
16
|
const router = require_useRouter.useRouter();
|
|
17
|
-
const content = () => (0, _solidjs_web.createComponent)(solid_js.For, {
|
|
17
|
+
const content = () => [(0, _solidjs_web.createComponent)(_solidjs_web.HydrationScript, {}), (0, _solidjs_web.createComponent)(solid_js.For, {
|
|
18
18
|
get each() {
|
|
19
19
|
return tags();
|
|
20
20
|
},
|
|
@@ -32,15 +32,15 @@ function HeadContent(props) {
|
|
|
32
32
|
}
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
});
|
|
36
|
-
return _solidjs_web.isServer ?? router.isServer ? content() : (0, _solidjs_web.createComponent)(_solidjs_web.Portal, {
|
|
35
|
+
})];
|
|
36
|
+
return _solidjs_web.isServer ?? router.isServer ? content() : [(0, _solidjs_web.createComponent)(_solidjs_web.HydrationScript, {}), (0, _solidjs_web.createComponent)(_solidjs_web.Portal, {
|
|
37
37
|
get mount() {
|
|
38
38
|
return document.head;
|
|
39
39
|
},
|
|
40
40
|
get children() {
|
|
41
41
|
return content();
|
|
42
42
|
}
|
|
43
|
-
});
|
|
43
|
+
})];
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
exports.HeadContent = HeadContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadContent.cjs","names":["For","Portal","isServer","Asset","useRouter","useTags","AssetCrossOriginConfig","HeadContentProps","assetCrossOrigin","HeadContent","props","tags","router","content","_$createComponent","each","children","tag","t","attrs","mount","document","head"],"sources":["../../src/HeadContent.tsx"],"sourcesContent":["import { For } from 'solid-js'\nimport { Portal, isServer } from '@solidjs/web'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useTags } from './headContentUtils'\nimport type { AssetCrossOriginConfig } from '@tanstack/router-core'\n\nexport interface HeadContentProps {\n assetCrossOrigin?: AssetCrossOriginConfig\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(props: HeadContentProps) {\n const tags = useTags(props.assetCrossOrigin)\n const router = useRouter()\n\n const content = () => (\n <For each={tags()}>\n
|
|
1
|
+
{"version":3,"file":"HeadContent.cjs","names":["For","HydrationScript","Portal","isServer","Asset","useRouter","useTags","AssetCrossOriginConfig","HeadContentProps","assetCrossOrigin","HeadContent","props","tags","router","content","_$createComponent","each","children","tag","t","attrs","mount","document","head"],"sources":["../../src/HeadContent.tsx"],"sourcesContent":["import { For } from 'solid-js'\nimport { HydrationScript, Portal, isServer } from '@solidjs/web'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useTags } from './headContentUtils'\nimport type { AssetCrossOriginConfig } from '@tanstack/router-core'\n\nexport interface HeadContentProps {\n assetCrossOrigin?: AssetCrossOriginConfig\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(props: HeadContentProps) {\n const tags = useTags(props.assetCrossOrigin)\n const router = useRouter()\n\n const content = () => (\n <>\n <HydrationScript />\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\n return (isServer ?? router.isServer) ? (\n content()\n ) : (\n <>\n <HydrationScript />\n <Portal mount={document.head}>{content()}</Portal>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;;AAiBA,SAAgBU,YAAYC,OAAyB;CACnD,MAAMC,OAAON,yBAAAA,QAAQK,MAAMF,iBAAiB;CAC5C,MAAMI,SAASR,kBAAAA,WAAW;CAE1B,MAAMS,gBAAU,EAAA,GAAA,aAAA,iBAEXb,aAAAA,iBAAe,EAAA,CAAA,GAAA,GAAA,aAAA,iBACfD,SAAAA,KAAG;EAAA,IAACgB,OAAI;AAAA,UAAEJ,MAAM;;EAAAK,WACbC,QAAQ;GACR,MAAMC,IAAID,KAAK;AACf,WAAA,GAAA,aAAA,iBAAQd,cAAAA,OAAK;IAAA,IAACc,MAAG;AAAA,YAAEC,EAAED;;IAAG,IAAEE,QAAK;AAAA,YAAED,EAAEC;;IAAK,IAAEH,WAAQ;AAAA,YAAEE,EAAEF;;IAAQ,CAAA;;EAC/D,CAAA,CAGN;AAED,QAAQd,aAAAA,YAAYU,OAAOV,WACzBW,SAAS,GAAA,EAAA,GAAA,aAAA,iBAGNb,aAAAA,iBAAe,EAAA,CAAA,GAAA,GAAA,aAAA,iBACfC,aAAAA,QAAM;EAAA,IAACmB,QAAK;AAAA,UAAEC,SAASC;;EAAI,IAAAN,WAAA;AAAA,UAAGH,SAAS;;EAAA,CAAA,CAE3C"}
|
package/dist/esm/HeadContent.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useRouter } from "./useRouter.js";
|
|
2
2
|
import { Asset } from "./Asset.js";
|
|
3
3
|
import { useTags } from "./headContentUtils.js";
|
|
4
|
-
import { Portal, createComponent, isServer } from "@solidjs/web";
|
|
4
|
+
import { HydrationScript, Portal, createComponent, isServer } from "@solidjs/web";
|
|
5
5
|
import { For } from "solid-js";
|
|
6
6
|
//#region src/HeadContent.tsx
|
|
7
7
|
/**
|
|
@@ -13,7 +13,7 @@ import { For } from "solid-js";
|
|
|
13
13
|
function HeadContent(props) {
|
|
14
14
|
const tags = useTags(props.assetCrossOrigin);
|
|
15
15
|
const router = useRouter();
|
|
16
|
-
const content = () => createComponent(For, {
|
|
16
|
+
const content = () => [createComponent(HydrationScript, {}), createComponent(For, {
|
|
17
17
|
get each() {
|
|
18
18
|
return tags();
|
|
19
19
|
},
|
|
@@ -31,15 +31,15 @@ function HeadContent(props) {
|
|
|
31
31
|
}
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
});
|
|
35
|
-
return isServer ?? router.isServer ? content() : createComponent(Portal, {
|
|
34
|
+
})];
|
|
35
|
+
return isServer ?? router.isServer ? content() : [createComponent(HydrationScript, {}), createComponent(Portal, {
|
|
36
36
|
get mount() {
|
|
37
37
|
return document.head;
|
|
38
38
|
},
|
|
39
39
|
get children() {
|
|
40
40
|
return content();
|
|
41
41
|
}
|
|
42
|
-
});
|
|
42
|
+
})];
|
|
43
43
|
}
|
|
44
44
|
//#endregion
|
|
45
45
|
export { HeadContent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadContent.js","names":["For","Portal","isServer","Asset","useRouter","useTags","AssetCrossOriginConfig","HeadContentProps","assetCrossOrigin","HeadContent","props","tags","router","content","_$createComponent","each","children","tag","t","attrs","mount","document","head"],"sources":["../../src/HeadContent.tsx"],"sourcesContent":["import { For } from 'solid-js'\nimport { Portal, isServer } from '@solidjs/web'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useTags } from './headContentUtils'\nimport type { AssetCrossOriginConfig } from '@tanstack/router-core'\n\nexport interface HeadContentProps {\n assetCrossOrigin?: AssetCrossOriginConfig\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(props: HeadContentProps) {\n const tags = useTags(props.assetCrossOrigin)\n const router = useRouter()\n\n const content = () => (\n <For each={tags()}>\n
|
|
1
|
+
{"version":3,"file":"HeadContent.js","names":["For","HydrationScript","Portal","isServer","Asset","useRouter","useTags","AssetCrossOriginConfig","HeadContentProps","assetCrossOrigin","HeadContent","props","tags","router","content","_$createComponent","each","children","tag","t","attrs","mount","document","head"],"sources":["../../src/HeadContent.tsx"],"sourcesContent":["import { For } from 'solid-js'\nimport { HydrationScript, Portal, isServer } from '@solidjs/web'\nimport { Asset } from './Asset'\nimport { useRouter } from './useRouter'\nimport { useTags } from './headContentUtils'\nimport type { AssetCrossOriginConfig } from '@tanstack/router-core'\n\nexport interface HeadContentProps {\n assetCrossOrigin?: AssetCrossOriginConfig\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(props: HeadContentProps) {\n const tags = useTags(props.assetCrossOrigin)\n const router = useRouter()\n\n const content = () => (\n <>\n <HydrationScript />\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\n return (isServer ?? router.isServer) ? (\n content()\n ) : (\n <>\n <HydrationScript />\n <Portal mount={document.head}>{content()}</Portal>\n </>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,SAAgBU,YAAYC,OAAyB;CACnD,MAAMC,OAAON,QAAQK,MAAMF,iBAAiB;CAC5C,MAAMI,SAASR,WAAW;CAE1B,MAAMS,gBAAU,CAAAC,gBAEXd,iBAAe,EAAA,CAAA,EAAAc,gBACff,KAAG;EAAA,IAACgB,OAAI;AAAA,UAAEJ,MAAM;;EAAAK,WACbC,QAAQ;GACR,MAAMC,IAAID,KAAK;AACf,UAAAH,gBAAQX,OAAK;IAAA,IAACc,MAAG;AAAA,YAAEC,EAAED;;IAAG,IAAEE,QAAK;AAAA,YAAED,EAAEC;;IAAK,IAAEH,WAAQ;AAAA,YAAEE,EAAEF;;IAAQ,CAAA;;EAC/D,CAAA,CAGN;AAED,QAAQd,YAAYU,OAAOV,WACzBW,SAAS,GAAA,CAAAC,gBAGNd,iBAAe,EAAA,CAAA,EAAAc,gBACfb,QAAM;EAAA,IAACmB,QAAK;AAAA,UAAEC,SAASC;;EAAI,IAAAN,WAAA;AAAA,UAAGH,SAAS;;EAAA,CAAA,CAE3C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { For } from 'solid-js';
|
|
2
|
-
import { Portal, isServer } from '@solidjs/web';
|
|
2
|
+
import { HydrationScript, Portal, isServer } from '@solidjs/web';
|
|
3
3
|
import { Asset } from './Asset';
|
|
4
4
|
import { useRouter } from './useRouter';
|
|
5
5
|
import { useTags } from './headContentUtils';
|
|
@@ -12,12 +12,18 @@ import { useTags } from './headContentUtils';
|
|
|
12
12
|
export function HeadContent(props) {
|
|
13
13
|
const tags = useTags(props.assetCrossOrigin);
|
|
14
14
|
const router = useRouter();
|
|
15
|
-
const content = () => (
|
|
16
|
-
|
|
15
|
+
const content = () => (<>
|
|
16
|
+
<HydrationScript />
|
|
17
|
+
<For each={tags()}>
|
|
18
|
+
{(tag) => {
|
|
17
19
|
const t = tag();
|
|
18
20
|
return <Asset tag={t.tag} attrs={t.attrs} children={t.children}/>;
|
|
19
21
|
}}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
+
</For>
|
|
23
|
+
</>);
|
|
24
|
+
return (isServer ?? router.isServer) ? (content()) : (<>
|
|
25
|
+
<HydrationScript />
|
|
26
|
+
<Portal mount={document.head}>{content()}</Portal>
|
|
27
|
+
</>);
|
|
22
28
|
}
|
|
23
29
|
//# sourceMappingURL=HeadContent.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadContent.jsx","sourceRoot":"","sources":["../../src/HeadContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"HeadContent.jsx","sourceRoot":"","sources":["../../src/HeadContent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAA;AAC9B,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAChE,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAO5C;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,KAAuB;IACjD,MAAM,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;IAC5C,MAAM,MAAM,GAAG,SAAS,EAAE,CAAA;IAE1B,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,CACpB,EACE;MAAA,CAAC,eAAe,CAAC,AAAD,EAChB;MAAA,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC,CAChB;QAAA,CAAC,CAAC,GAAG,EAAE,EAAE;YACP,MAAM,CAAC,GAAG,GAAG,EAAS,CAAA;YACtB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAG,CAAA;QACpE,CAAC,CACH;MAAA,EAAE,GAAG,CACP;IAAA,GAAG,CACJ,CAAA;IAED,OAAO,CAAC,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CACrC,OAAO,EAAE,CACV,CAAC,CAAC,CAAC,CACF,EACE;MAAA,CAAC,eAAe,CAAC,AAAD,EAChB;MAAA,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,MAAM,CACnD;IAAA,GAAG,CACJ,CAAA;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-router",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.16",
|
|
4
4
|
"description": "Modern and scalable routing for Solid applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@solid-devtools/logger": "^0.9.4",
|
|
91
91
|
"@solidjs/meta": "^0.29.4",
|
|
92
|
-
"@solidjs/web": "2.0.0-beta.
|
|
92
|
+
"@solidjs/web": "2.0.0-beta.8",
|
|
93
93
|
"isbot": "^5.1.22",
|
|
94
94
|
"@tanstack/history": "1.161.6",
|
|
95
95
|
"@tanstack/router-core": "1.168.9"
|
|
@@ -100,8 +100,8 @@
|
|
|
100
100
|
"@testing-library/jest-dom": "^6.6.3",
|
|
101
101
|
"combinate": "^1.1.11",
|
|
102
102
|
"eslint-plugin-solid": "^0.14.5",
|
|
103
|
-
"solid-js": "2.0.0-beta.
|
|
104
|
-
"@solidjs/web": "2.0.0-beta.
|
|
103
|
+
"solid-js": "2.0.0-beta.8",
|
|
104
|
+
"@solidjs/web": "2.0.0-beta.8",
|
|
105
105
|
"vite": "*",
|
|
106
106
|
"vite-plugin-solid": "^3.0.0-next.5",
|
|
107
107
|
"zod": "^3.23.8",
|
package/src/HeadContent.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { For } from 'solid-js'
|
|
2
|
-
import { Portal, isServer } from '@solidjs/web'
|
|
2
|
+
import { HydrationScript, Portal, isServer } from '@solidjs/web'
|
|
3
3
|
import { Asset } from './Asset'
|
|
4
4
|
import { useRouter } from './useRouter'
|
|
5
5
|
import { useTags } from './headContentUtils'
|
|
@@ -20,17 +20,23 @@ export function HeadContent(props: HeadContentProps) {
|
|
|
20
20
|
const router = useRouter()
|
|
21
21
|
|
|
22
22
|
const content = () => (
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
<>
|
|
24
|
+
<HydrationScript />
|
|
25
|
+
<For each={tags()}>
|
|
26
|
+
{(tag) => {
|
|
27
|
+
const t = tag() as any
|
|
28
|
+
return <Asset tag={t.tag} attrs={t.attrs} children={t.children} />
|
|
29
|
+
}}
|
|
30
|
+
</For>
|
|
31
|
+
</>
|
|
29
32
|
)
|
|
30
33
|
|
|
31
34
|
return (isServer ?? router.isServer) ? (
|
|
32
35
|
content()
|
|
33
36
|
) : (
|
|
34
|
-
|
|
37
|
+
<>
|
|
38
|
+
<HydrationScript />
|
|
39
|
+
<Portal mount={document.head}>{content()}</Portal>
|
|
40
|
+
</>
|
|
35
41
|
)
|
|
36
42
|
}
|