@tanstack/solid-router 1.170.3 → 1.170.5
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/ClientOnly.cjs +3 -1
- package/dist/cjs/ClientOnly.cjs.map +1 -1
- package/dist/cjs/ClientOnly.d.cts +0 -19
- package/dist/esm/ClientOnly.d.ts +0 -19
- package/dist/esm/ClientOnly.js +3 -1
- package/dist/esm/ClientOnly.js.map +1 -1
- package/dist/source/ClientOnly.d.ts +0 -19
- package/dist/source/ClientOnly.jsx +3 -1
- package/dist/source/ClientOnly.jsx.map +1 -1
- package/package.json +4 -4
- package/src/ClientOnly.tsx +6 -1
package/dist/cjs/ClientOnly.cjs
CHANGED
|
@@ -53,9 +53,11 @@ function ClientOnly(props) {
|
|
|
53
53
|
* ```
|
|
54
54
|
* @returns True if the JS has been hydrated already, false otherwise.
|
|
55
55
|
*/
|
|
56
|
+
var globalHydrated = false;
|
|
56
57
|
function useHydrated() {
|
|
57
|
-
const [hydrated, setHydrated] = solid_js.createSignal(
|
|
58
|
+
const [hydrated, setHydrated] = solid_js.createSignal(globalHydrated);
|
|
58
59
|
solid_js.onMount(() => {
|
|
60
|
+
globalHydrated = true;
|
|
59
61
|
setHydrated(true);
|
|
60
62
|
});
|
|
61
63
|
return hydrated;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientOnly.cjs","names":["Solid","ClientOnlyProps","children","JSX","Element","fallback","ClientOnly","props","hydrated","useHydrated","_$createComponent","Show","when","_$memo","Accessor","setHydrated","createSignal","onMount"],"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(
|
|
1
|
+
{"version":3,"file":"ClientOnly.cjs","names":["Solid","ClientOnlyProps","children","JSX","Element","fallback","ClientOnly","props","hydrated","useHydrated","_$createComponent","Show","when","_$memo","globalHydrated","Accessor","setHydrated","createSignal","onMount"],"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 */\nlet globalHydrated = false\n\nexport function useHydrated(): Solid.Accessor<boolean> {\n const [hydrated, setHydrated] = Solid.createSignal(globalHydrated)\n\n Solid.onMount(() => {\n globalHydrated = true\n setHydrated(true)\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,IAAIY,iBAAiB;AAErB,SAAgBL,cAAuC;CACrD,MAAM,CAACD,UAAUQ,eAAehB,SAAMiB,aAAaH,eAAe;AAElEd,UAAMkB,cAAc;AAClBJ,mBAAiB;AACjBE,cAAY,KAAK;GACjB;AAEF,QAAOR"}
|
|
@@ -27,23 +27,4 @@ export interface ClientOnlyProps {
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
export declare function ClientOnly(props: ClientOnlyProps): Solid.JSX.Element;
|
|
30
|
-
/**
|
|
31
|
-
* Return a boolean indicating if the JS has been hydrated already.
|
|
32
|
-
* When doing Server-Side Rendering, the result will always be false.
|
|
33
|
-
* When doing Client-Side Rendering, the result will always be false on the
|
|
34
|
-
* first render and true from then on. Even if a new component renders it will
|
|
35
|
-
* always start with true.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```tsx
|
|
39
|
-
* // Disable a button that needs JS to work.
|
|
40
|
-
* const hydrated = useHydrated()
|
|
41
|
-
* return (
|
|
42
|
-
* <button type="button" disabled={!hydrated()} onClick={doSomethingCustom}>
|
|
43
|
-
* Click me
|
|
44
|
-
* </button>
|
|
45
|
-
* )
|
|
46
|
-
* ```
|
|
47
|
-
* @returns True if the JS has been hydrated already, false otherwise.
|
|
48
|
-
*/
|
|
49
30
|
export declare function useHydrated(): Solid.Accessor<boolean>;
|
package/dist/esm/ClientOnly.d.ts
CHANGED
|
@@ -27,23 +27,4 @@ export interface ClientOnlyProps {
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
export declare function ClientOnly(props: ClientOnlyProps): Solid.JSX.Element;
|
|
30
|
-
/**
|
|
31
|
-
* Return a boolean indicating if the JS has been hydrated already.
|
|
32
|
-
* When doing Server-Side Rendering, the result will always be false.
|
|
33
|
-
* When doing Client-Side Rendering, the result will always be false on the
|
|
34
|
-
* first render and true from then on. Even if a new component renders it will
|
|
35
|
-
* always start with true.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```tsx
|
|
39
|
-
* // Disable a button that needs JS to work.
|
|
40
|
-
* const hydrated = useHydrated()
|
|
41
|
-
* return (
|
|
42
|
-
* <button type="button" disabled={!hydrated()} onClick={doSomethingCustom}>
|
|
43
|
-
* Click me
|
|
44
|
-
* </button>
|
|
45
|
-
* )
|
|
46
|
-
* ```
|
|
47
|
-
* @returns True if the JS has been hydrated already, false otherwise.
|
|
48
|
-
*/
|
|
49
30
|
export declare function useHydrated(): Solid.Accessor<boolean>;
|
package/dist/esm/ClientOnly.js
CHANGED
|
@@ -51,9 +51,11 @@ function ClientOnly(props) {
|
|
|
51
51
|
* ```
|
|
52
52
|
* @returns True if the JS has been hydrated already, false otherwise.
|
|
53
53
|
*/
|
|
54
|
+
var globalHydrated = false;
|
|
54
55
|
function useHydrated() {
|
|
55
|
-
const [hydrated, setHydrated] = Solid.createSignal(
|
|
56
|
+
const [hydrated, setHydrated] = Solid.createSignal(globalHydrated);
|
|
56
57
|
Solid.onMount(() => {
|
|
58
|
+
globalHydrated = true;
|
|
57
59
|
setHydrated(true);
|
|
58
60
|
});
|
|
59
61
|
return hydrated;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientOnly.js","names":["Solid","ClientOnlyProps","children","JSX","Element","fallback","ClientOnly","props","hydrated","useHydrated","_$createComponent","Show","when","_$memo","Accessor","setHydrated","createSignal","onMount"],"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(
|
|
1
|
+
{"version":3,"file":"ClientOnly.js","names":["Solid","ClientOnlyProps","children","JSX","Element","fallback","ClientOnly","props","hydrated","useHydrated","_$createComponent","Show","when","_$memo","globalHydrated","Accessor","setHydrated","createSignal","onMount"],"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 */\nlet globalHydrated = false\n\nexport function useHydrated(): Solid.Accessor<boolean> {\n const [hydrated, setHydrated] = Solid.createSignal(globalHydrated)\n\n Solid.onMount(() => {\n globalHydrated = true\n setHydrated(true)\n })\n\n return hydrated\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA8BA,SAAgBM,WAAWC,OAAwB;CACjD,MAAMC,WAAWC,aAAa;AAC9B,QAAAC,gBACGV,MAAMW,MAAI;EAAA,IAACC,OAAI;AAAA,UAAEJ,UAAU;;EAAA,IAAEH,WAAQ;AAAA,UAAEE,MAAMF,YAAY;;EAAI,IAAAH,WAAA;AAAA,UAAAW,WACzDN,MAAML,SAAQ;;EAAA,CAAA;;;;;;;;;;;;;;;;;;;;;AAwBvB,IAAIY,iBAAiB;AAErB,SAAgBL,cAAuC;CACrD,MAAM,CAACD,UAAUQ,eAAehB,MAAMiB,aAAaH,eAAe;AAElEd,OAAMkB,cAAc;AAClBJ,mBAAiB;AACjBE,cAAY,KAAK;GACjB;AAEF,QAAOR"}
|
|
@@ -27,23 +27,4 @@ export interface ClientOnlyProps {
|
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
29
|
export declare function ClientOnly(props: ClientOnlyProps): Solid.JSX.Element;
|
|
30
|
-
/**
|
|
31
|
-
* Return a boolean indicating if the JS has been hydrated already.
|
|
32
|
-
* When doing Server-Side Rendering, the result will always be false.
|
|
33
|
-
* When doing Client-Side Rendering, the result will always be false on the
|
|
34
|
-
* first render and true from then on. Even if a new component renders it will
|
|
35
|
-
* always start with true.
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```tsx
|
|
39
|
-
* // Disable a button that needs JS to work.
|
|
40
|
-
* const hydrated = useHydrated()
|
|
41
|
-
* return (
|
|
42
|
-
* <button type="button" disabled={!hydrated()} onClick={doSomethingCustom}>
|
|
43
|
-
* Click me
|
|
44
|
-
* </button>
|
|
45
|
-
* )
|
|
46
|
-
* ```
|
|
47
|
-
* @returns True if the JS has been hydrated already, false otherwise.
|
|
48
|
-
*/
|
|
49
30
|
export declare function useHydrated(): Solid.Accessor<boolean>;
|
|
@@ -41,9 +41,11 @@ export function ClientOnly(props) {
|
|
|
41
41
|
* ```
|
|
42
42
|
* @returns True if the JS has been hydrated already, false otherwise.
|
|
43
43
|
*/
|
|
44
|
+
let globalHydrated = false;
|
|
44
45
|
export function useHydrated() {
|
|
45
|
-
const [hydrated, setHydrated] = Solid.createSignal(
|
|
46
|
+
const [hydrated, setHydrated] = Solid.createSignal(globalHydrated);
|
|
46
47
|
Solid.onMount(() => {
|
|
48
|
+
globalHydrated = true;
|
|
47
49
|
setHydrated(true);
|
|
48
50
|
});
|
|
49
51
|
return hydrated;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientOnly.jsx","sourceRoot":"","sources":["../../src/ClientOnly.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAajC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,CAC7D;MAAA,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GACpB;IAAA,EAAE,KAAK,CAAC,IAAI,CAAC,CACd,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,WAAW;IACzB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"ClientOnly.jsx","sourceRoot":"","sources":["../../src/ClientOnly.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,UAAU,CAAA;AAajC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,OAAO,CACL,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,KAAK,CAAC,QAAQ,IAAI,IAAI,CAAC,CAC7D;MAAA,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,GACpB;IAAA,EAAE,KAAK,CAAC,IAAI,CAAC,CACd,CAAA;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,IAAI,cAAc,GAAG,KAAK,CAAA;AAE1B,MAAM,UAAU,WAAW;IACzB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,cAAc,CAAC,CAAA;IAElE,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QACjB,cAAc,GAAG,IAAI,CAAA;QACrB,WAAW,CAAC,IAAI,CAAC,CAAA;IACnB,CAAC,CAAC,CAAA;IAEF,OAAO,QAAQ,CAAA;AACjB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/solid-router",
|
|
3
|
-
"version": "1.170.
|
|
3
|
+
"version": "1.170.5",
|
|
4
4
|
"description": "Modern and scalable routing for Solid applications",
|
|
5
5
|
"author": "Tanner Linsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -92,18 +92,18 @@
|
|
|
92
92
|
"@solidjs/meta": "^0.29.4",
|
|
93
93
|
"isbot": "^5.1.22",
|
|
94
94
|
"@tanstack/history": "1.162.0",
|
|
95
|
-
"@tanstack/router-core": "1.171.
|
|
95
|
+
"@tanstack/router-core": "1.171.3"
|
|
96
96
|
},
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@solidjs/testing-library": "^0.8.10",
|
|
99
99
|
"@testing-library/jest-dom": "^6.6.3",
|
|
100
|
+
"@types/node": ">=20",
|
|
100
101
|
"combinate": "^1.1.11",
|
|
101
102
|
"eslint-plugin-solid": "^0.14.5",
|
|
102
103
|
"solid-js": "^1.9.10",
|
|
103
104
|
"vite": "*",
|
|
104
105
|
"vite-plugin-solid": "^2.11.10",
|
|
105
|
-
"zod": "^
|
|
106
|
-
"@types/node": ">=20"
|
|
106
|
+
"zod": "^4.4.3"
|
|
107
107
|
},
|
|
108
108
|
"peerDependencies": {
|
|
109
109
|
"solid-js": "^1.9.10"
|
package/src/ClientOnly.tsx
CHANGED
|
@@ -56,10 +56,15 @@ export function ClientOnly(props: ClientOnlyProps) {
|
|
|
56
56
|
* ```
|
|
57
57
|
* @returns True if the JS has been hydrated already, false otherwise.
|
|
58
58
|
*/
|
|
59
|
+
let globalHydrated = false
|
|
60
|
+
|
|
59
61
|
export function useHydrated(): Solid.Accessor<boolean> {
|
|
60
|
-
const [hydrated, setHydrated] = Solid.createSignal(
|
|
62
|
+
const [hydrated, setHydrated] = Solid.createSignal(globalHydrated)
|
|
63
|
+
|
|
61
64
|
Solid.onMount(() => {
|
|
65
|
+
globalHydrated = true
|
|
62
66
|
setHydrated(true)
|
|
63
67
|
})
|
|
68
|
+
|
|
64
69
|
return hydrated
|
|
65
70
|
}
|