@tamagui/use-did-finish-ssr 1.99.0 → 1.100.0
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/index.js +18 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +54 -4
- package/dist/cjs/index.native.js.map +2 -2
- package/dist/esm/index.js +19 -8
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +13 -4
- package/dist/esm/index.native.js +51 -3
- package/dist/esm/index.native.js.map +2 -2
- package/package.json +3 -3
- package/src/index.ts +29 -7
- package/types/index.d.ts +4 -1
- package/types/index.d.ts.map +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -15,18 +15,29 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0
|
|
|
15
15
|
var src_exports = {};
|
|
16
16
|
__export(src_exports, {
|
|
17
17
|
useClientValue: () => useClientValue,
|
|
18
|
-
useDidFinishSSR: () => useDidFinishSSR
|
|
18
|
+
useDidFinishSSR: () => useDidFinishSSR,
|
|
19
|
+
useDidFinishSSRSync: () => useDidFinishSSRSync
|
|
19
20
|
});
|
|
20
21
|
module.exports = __toCommonJS(src_exports);
|
|
21
22
|
var import_react = require("react");
|
|
22
23
|
const emptyFn = () => {
|
|
23
24
|
}, emptyFnFn = () => emptyFn;
|
|
24
|
-
function useDidFinishSSR(value) {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
function useDidFinishSSR(value, options) {
|
|
26
|
+
if (options?.sync)
|
|
27
|
+
return (0, import_react.useSyncExternalStore)(
|
|
28
|
+
emptyFnFn,
|
|
29
|
+
() => value ?? !0,
|
|
30
|
+
() => !1
|
|
31
|
+
);
|
|
32
|
+
const [cur, setCur] = (0, import_react.useState)(value);
|
|
33
|
+
return (0, import_react.useEffect)(() => {
|
|
34
|
+
setCur(value ?? !0);
|
|
35
|
+
}, []), cur ?? !1;
|
|
36
|
+
}
|
|
37
|
+
function useDidFinishSSRSync(value) {
|
|
38
|
+
return useDidFinishSSR(value, {
|
|
39
|
+
sync: !0
|
|
40
|
+
});
|
|
30
41
|
}
|
|
31
42
|
function useClientValue(value) {
|
|
32
43
|
return useDidFinishSSR() ? typeof value == "function" ? value() : value : void 0;
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA0D;AAE1D,MAAM,UAAU,MAAM;AAAC,GACjB,YAAY,MAAM;AAEjB,SAAS,gBACd,OACA,SAGW;AAMX,MAAI,SAAS;AACX,eAAO;AAAA,MACL;AAAA,MACA,MAAO,SAAqB;AAAA,MAC5B,MAAM;AAAA,IACR;AAGF,QAAM,CAAC,KAAK,MAAM,QAAI,uBAAc,KAAK;AACzC,qCAAU,MAAM;AACd,WAAO,SAAS,EAAI;AAAA,EACtB,GAAG,CAAC,CAAC,GACE,OAAO;AAChB;AAKO,SAAS,oBAAiC,OAAsB;AACrE,SAAO,gBAAgB,OAAO;AAAA,IAC5B,MAAM;AAAA,EACR,CAAC;AACH;AAIO,SAAS,eAAsB,OAAmD;AAEvF,SADa,gBAAgB,IACF,OAAO,SAAU,aAAa,MAAM,IAAI,QAApD;AACjB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -16,15 +16,64 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0
|
|
|
16
16
|
var src_exports = {};
|
|
17
17
|
__export(src_exports, {
|
|
18
18
|
useClientValue: () => useClientValue,
|
|
19
|
-
useDidFinishSSR: () => useDidFinishSSR
|
|
19
|
+
useDidFinishSSR: () => useDidFinishSSR,
|
|
20
|
+
useDidFinishSSRSync: () => useDidFinishSSRSync
|
|
20
21
|
});
|
|
21
22
|
module.exports = __toCommonJS(src_exports);
|
|
22
|
-
var import_react = require("react")
|
|
23
|
+
var import_react = require("react");
|
|
24
|
+
function _array_like_to_array(arr, len) {
|
|
25
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
26
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
27
|
+
return arr2;
|
|
28
|
+
}
|
|
29
|
+
function _array_with_holes(arr) {
|
|
30
|
+
if (Array.isArray(arr)) return arr;
|
|
31
|
+
}
|
|
32
|
+
function _iterable_to_array_limit(arr, i) {
|
|
33
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
34
|
+
if (_i != null) {
|
|
35
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
36
|
+
try {
|
|
37
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
38
|
+
;
|
|
39
|
+
} catch (err) {
|
|
40
|
+
_d = !0, _e = err;
|
|
41
|
+
} finally {
|
|
42
|
+
try {
|
|
43
|
+
!_n && _i.return != null && _i.return();
|
|
44
|
+
} finally {
|
|
45
|
+
if (_d) throw _e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return _arr;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function _non_iterable_rest() {
|
|
52
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
53
|
+
}
|
|
54
|
+
function _sliced_to_array(arr, i) {
|
|
55
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
56
|
+
}
|
|
57
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
58
|
+
if (o) {
|
|
59
|
+
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
60
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
61
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
62
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
var emptyFn = function() {
|
|
23
66
|
}, emptyFnFn = function() {
|
|
24
67
|
return emptyFn;
|
|
25
68
|
};
|
|
26
|
-
function useDidFinishSSR(value) {
|
|
69
|
+
function useDidFinishSSR(value, options) {
|
|
27
70
|
return value ?? !0;
|
|
71
|
+
var _useState, cur, setCur;
|
|
72
|
+
}
|
|
73
|
+
function useDidFinishSSRSync(value) {
|
|
74
|
+
return useDidFinishSSR(value, {
|
|
75
|
+
sync: !0
|
|
76
|
+
});
|
|
28
77
|
}
|
|
29
78
|
function useClientValue(value) {
|
|
30
79
|
var done = useDidFinishSSR();
|
|
@@ -33,6 +82,7 @@ function useClientValue(value) {
|
|
|
33
82
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
83
|
0 && (module.exports = {
|
|
35
84
|
useClientValue,
|
|
36
|
-
useDidFinishSSR
|
|
85
|
+
useDidFinishSSR,
|
|
86
|
+
useDidFinishSSRSync
|
|
37
87
|
});
|
|
38
88
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/packages/use-did-finish-ssr/src/index.ts"],
|
|
4
|
-
"mappings": "
|
|
5
|
-
"names": ["emptyFn", "emptyFnFn", "useDidFinishSSR", "value", "useClientValue", "done", "undefined"]
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;AAAA,mBAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1D,IAAMA,UAAU,WAAA;AAAO,GACjBC,YAAY,WAAA;SAAMD;;AAEjB,SAASE,gBACdC,OACAC,SAEC;AAIC,SAAOD,SAAS;AAWlB,MAAsBE,WAAfC,KAAKC;AAKd;AAKO,SAASC,oBAAiCL,OAAS;AACxD,SAAOD,gBAAgBC,OAAO;IAC5BM,MAAM;EACR,CAAA;AACF;AAIO,SAASC,eAAsBP,OAAa;AACjD,MAAMQ,OAAOT,gBAAAA;AACb,SAAQS,OAAmB,OAAOR,SAAU,aAAaA,MAAAA,IAAUA,QAApDS;AACjB;",
|
|
5
|
+
"names": ["emptyFn", "emptyFnFn", "useDidFinishSSR", "value", "options", "useState", "cur", "setCur", "useDidFinishSSRSync", "sync", "useClientValue", "done", "undefined"]
|
|
6
6
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
|
-
import { useSyncExternalStore } from "react";
|
|
1
|
+
import { useEffect, useState, useSyncExternalStore } from "react";
|
|
2
2
|
const emptyFn = () => {
|
|
3
3
|
}, emptyFnFn = () => emptyFn;
|
|
4
|
-
function useDidFinishSSR(value) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
function useDidFinishSSR(value, options) {
|
|
5
|
+
if (options?.sync)
|
|
6
|
+
return useSyncExternalStore(
|
|
7
|
+
emptyFnFn,
|
|
8
|
+
() => value ?? !0,
|
|
9
|
+
() => !1
|
|
10
|
+
);
|
|
11
|
+
const [cur, setCur] = useState(value);
|
|
12
|
+
return useEffect(() => {
|
|
13
|
+
setCur(value ?? !0);
|
|
14
|
+
}, []), cur ?? !1;
|
|
15
|
+
}
|
|
16
|
+
function useDidFinishSSRSync(value) {
|
|
17
|
+
return useDidFinishSSR(value, {
|
|
18
|
+
sync: !0
|
|
19
|
+
});
|
|
10
20
|
}
|
|
11
21
|
function useClientValue(value) {
|
|
12
22
|
return useDidFinishSSR() ? typeof value == "function" ? value() : value : void 0;
|
|
13
23
|
}
|
|
14
24
|
export {
|
|
15
25
|
useClientValue,
|
|
16
|
-
useDidFinishSSR
|
|
26
|
+
useDidFinishSSR,
|
|
27
|
+
useDidFinishSSRSync
|
|
17
28
|
};
|
|
18
29
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.ts"],
|
|
4
|
-
"mappings": "AAAA,SAAS,4BAA4B;
|
|
4
|
+
"mappings": "AAAA,SAAS,WAAW,UAAU,4BAA4B;AAE1D,MAAM,UAAU,MAAM;AAAC,GACjB,YAAY,MAAM;AAEjB,SAAS,gBACd,OACA,SAGW;AAMX,MAAI,SAAS;AACX,WAAO;AAAA,MACL;AAAA,MACA,MAAO,SAAqB;AAAA,MAC5B,MAAM;AAAA,IACR;AAGF,QAAM,CAAC,KAAK,MAAM,IAAI,SAAc,KAAK;AACzC,mBAAU,MAAM;AACd,WAAO,SAAS,EAAI;AAAA,EACtB,GAAG,CAAC,CAAC,GACE,OAAO;AAChB;AAKO,SAAS,oBAAiC,OAAsB;AACrE,SAAO,gBAAgB,OAAO;AAAA,IAC5B,MAAM;AAAA,EACR,CAAC;AACH;AAIO,SAAS,eAAsB,OAAmD;AAEvF,SADa,gBAAgB,IACF,OAAO,SAAU,aAAa,MAAM,IAAI,QAApD;AACjB;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
import { useSyncExternalStore } from "react";
|
|
1
|
+
import { useEffect, useState, useSyncExternalStore } from "react";
|
|
2
2
|
const emptyFn = () => {},
|
|
3
3
|
emptyFnFn = () => emptyFn;
|
|
4
|
-
function useDidFinishSSR(value) {
|
|
5
|
-
return useSyncExternalStore(emptyFnFn, () => value ?? !0, () => !1);
|
|
4
|
+
function useDidFinishSSR(value, options) {
|
|
5
|
+
if (options?.sync) return useSyncExternalStore(emptyFnFn, () => value ?? !0, () => !1);
|
|
6
|
+
const [cur, setCur] = useState(value);
|
|
7
|
+
return useEffect(() => {
|
|
8
|
+
setCur(value ?? !0);
|
|
9
|
+
}, []), cur ?? !1;
|
|
10
|
+
}
|
|
11
|
+
function useDidFinishSSRSync(value) {
|
|
12
|
+
return useDidFinishSSR(value, {
|
|
13
|
+
sync: !0
|
|
14
|
+
});
|
|
6
15
|
}
|
|
7
16
|
function useClientValue(value) {
|
|
8
17
|
return useDidFinishSSR() ? typeof value == "function" ? value() : value : void 0;
|
|
9
18
|
}
|
|
10
|
-
export { useClientValue, useDidFinishSSR };
|
|
19
|
+
export { useClientValue, useDidFinishSSR, useDidFinishSSRSync };
|
package/dist/esm/index.native.js
CHANGED
|
@@ -1,10 +1,57 @@
|
|
|
1
|
-
import { useSyncExternalStore } from "react";
|
|
1
|
+
import { useEffect, useState, useSyncExternalStore } from "react";
|
|
2
|
+
function _array_like_to_array(arr, len) {
|
|
3
|
+
(len == null || len > arr.length) && (len = arr.length);
|
|
4
|
+
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
5
|
+
return arr2;
|
|
6
|
+
}
|
|
7
|
+
function _array_with_holes(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return arr;
|
|
9
|
+
}
|
|
10
|
+
function _iterable_to_array_limit(arr, i) {
|
|
11
|
+
var _i = arr == null ? null : typeof Symbol < "u" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
12
|
+
if (_i != null) {
|
|
13
|
+
var _arr = [], _n = !0, _d = !1, _s, _e;
|
|
14
|
+
try {
|
|
15
|
+
for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0)
|
|
16
|
+
;
|
|
17
|
+
} catch (err) {
|
|
18
|
+
_d = !0, _e = err;
|
|
19
|
+
} finally {
|
|
20
|
+
try {
|
|
21
|
+
!_n && _i.return != null && _i.return();
|
|
22
|
+
} finally {
|
|
23
|
+
if (_d) throw _e;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return _arr;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function _non_iterable_rest() {
|
|
30
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
31
|
+
}
|
|
32
|
+
function _sliced_to_array(arr, i) {
|
|
33
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
34
|
+
}
|
|
35
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
36
|
+
if (o) {
|
|
37
|
+
if (typeof o == "string") return _array_like_to_array(o, minLen);
|
|
38
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
39
|
+
if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
|
|
40
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
2
43
|
var emptyFn = function() {
|
|
3
44
|
}, emptyFnFn = function() {
|
|
4
45
|
return emptyFn;
|
|
5
46
|
};
|
|
6
|
-
function useDidFinishSSR(value) {
|
|
47
|
+
function useDidFinishSSR(value, options) {
|
|
7
48
|
return value ?? !0;
|
|
49
|
+
var _useState, cur, setCur;
|
|
50
|
+
}
|
|
51
|
+
function useDidFinishSSRSync(value) {
|
|
52
|
+
return useDidFinishSSR(value, {
|
|
53
|
+
sync: !0
|
|
54
|
+
});
|
|
8
55
|
}
|
|
9
56
|
function useClientValue(value) {
|
|
10
57
|
var done = useDidFinishSSR();
|
|
@@ -12,6 +59,7 @@ function useClientValue(value) {
|
|
|
12
59
|
}
|
|
13
60
|
export {
|
|
14
61
|
useClientValue,
|
|
15
|
-
useDidFinishSSR
|
|
62
|
+
useDidFinishSSR,
|
|
63
|
+
useDidFinishSSRSync
|
|
16
64
|
};
|
|
17
65
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/Users/n8/tamagui/packages/use-did-finish-ssr/src/index.ts"],
|
|
4
|
-
"mappings": "AAAA,SAASA,4BAA4B
|
|
5
|
-
"names": ["useSyncExternalStore", "emptyFn", "emptyFnFn", "useDidFinishSSR", "value", "useClientValue", "done", "undefined"]
|
|
4
|
+
"mappings": "AAAA,SAASA,WAAWC,UAAUC,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1D,IAAMC,UAAU,WAAA;AAAO,GACjBC,YAAY,WAAA;SAAMD;;AAEjB,SAASE,gBACdC,OACAC,SAEC;AAIC,SAAOD,SAAS;AAWlB,MAAsBL,WAAfO,KAAKC;AAKd;AAKO,SAASC,oBAAiCJ,OAAS;AACxD,SAAOD,gBAAgBC,OAAO;IAC5BK,MAAM;EACR,CAAA;AACF;AAIO,SAASC,eAAsBN,OAAa;AACjD,MAAMO,OAAOR,gBAAAA;AACb,SAAQQ,OAAmB,OAAOP,SAAU,aAAaA,MAAAA,IAAUA,QAApDQ;AACjB;",
|
|
5
|
+
"names": ["useEffect", "useState", "useSyncExternalStore", "emptyFn", "emptyFnFn", "useDidFinishSSR", "value", "options", "cur", "setCur", "useDidFinishSSRSync", "sync", "useClientValue", "done", "undefined"]
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/use-did-finish-ssr",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.100.0",
|
|
4
4
|
"types": "./types/index.d.ts",
|
|
5
5
|
"main": "dist/cjs",
|
|
6
6
|
"module": "dist/esm",
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
}
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@tamagui/constants": "1.
|
|
30
|
+
"@tamagui/constants": "1.100.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@tamagui/build": "1.
|
|
33
|
+
"@tamagui/build": "1.100.0",
|
|
34
34
|
"react": "^18.2.0"
|
|
35
35
|
},
|
|
36
36
|
"publishConfig": {
|
package/src/index.ts
CHANGED
|
@@ -1,19 +1,41 @@
|
|
|
1
|
-
import { useSyncExternalStore } from 'react'
|
|
1
|
+
import { useEffect, useState, useSyncExternalStore } from 'react'
|
|
2
2
|
|
|
3
3
|
const emptyFn = () => {}
|
|
4
4
|
const emptyFnFn = () => emptyFn
|
|
5
5
|
|
|
6
|
-
export function useDidFinishSSR<A = boolean>(
|
|
6
|
+
export function useDidFinishSSR<A = boolean>(
|
|
7
|
+
value?: A,
|
|
8
|
+
options?: {
|
|
9
|
+
sync?: boolean
|
|
10
|
+
}
|
|
11
|
+
): A | false {
|
|
7
12
|
if (process.env.TAMAGUI_TARGET === 'native') {
|
|
8
13
|
// @ts-expect-error
|
|
9
14
|
return value ?? true
|
|
10
15
|
}
|
|
11
16
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
if (options?.sync) {
|
|
18
|
+
return useSyncExternalStore(
|
|
19
|
+
emptyFnFn,
|
|
20
|
+
() => (value == undefined ? true : value),
|
|
21
|
+
() => false as any
|
|
22
|
+
)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const [cur, setCur] = useState<any>(value)
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
setCur(value ?? true)
|
|
28
|
+
}, [])
|
|
29
|
+
return cur ?? false
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// const useIsomorphicLayoutEffect =
|
|
33
|
+
// typeof window === 'undefined' ? useEffect : useLayoutEffect
|
|
34
|
+
|
|
35
|
+
export function useDidFinishSSRSync<A = boolean>(value?: A): A | false {
|
|
36
|
+
return useDidFinishSSR(value, {
|
|
37
|
+
sync: true,
|
|
38
|
+
})
|
|
17
39
|
}
|
|
18
40
|
|
|
19
41
|
type FunctionOrValue<Value> = Value extends () => infer X ? X : Value
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export declare function useDidFinishSSR<A = boolean>(value?: A
|
|
1
|
+
export declare function useDidFinishSSR<A = boolean>(value?: A, options?: {
|
|
2
|
+
sync?: boolean;
|
|
3
|
+
}): A | false;
|
|
4
|
+
export declare function useDidFinishSSRSync<A = boolean>(value?: A): A | false;
|
|
2
5
|
type FunctionOrValue<Value> = Value extends () => infer X ? X : Value;
|
|
3
6
|
export declare function useClientValue<Value>(value?: Value): FunctionOrValue<Value> | undefined;
|
|
4
7
|
export {};
|
package/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,wBAAgB,eAAe,CAAC,CAAC,GAAG,OAAO,EACzC,KAAK,CAAC,EAAE,CAAC,EACT,OAAO,CAAC,EAAE;IACR,IAAI,CAAC,EAAE,OAAO,CAAA;CACf,GACA,CAAC,GAAG,KAAK,CAmBX;AAKD,wBAAgB,mBAAmB,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,KAAK,CAIrE;AAED,KAAK,eAAe,CAAC,KAAK,IAAI,KAAK,SAAS,MAAM,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAA;AAErE,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CAGvF"}
|