@radix-ui/react-use-is-hydrated 0.1.1 → 0.1.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/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
9
|
var __export = (target, all) => {
|
|
9
10
|
for (var name in all)
|
|
10
11
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -50,6 +51,7 @@ function useIsHydrated() {
|
|
|
50
51
|
}, []);
|
|
51
52
|
return isHydrated;
|
|
52
53
|
}
|
|
54
|
+
__name(useIsHydrated, "useIsHydrated");
|
|
53
55
|
|
|
54
56
|
// src/use-is-hydrated.tsx
|
|
55
57
|
var useReactSyncExternalStore = React2[" useSyncExternalStore ".trim().toString()];
|
|
@@ -57,6 +59,7 @@ function subscribe() {
|
|
|
57
59
|
return () => {
|
|
58
60
|
};
|
|
59
61
|
}
|
|
62
|
+
__name(subscribe, "subscribe");
|
|
60
63
|
function useIsHydratedModern() {
|
|
61
64
|
return useReactSyncExternalStore(
|
|
62
65
|
subscribe,
|
|
@@ -64,5 +67,6 @@ function useIsHydratedModern() {
|
|
|
64
67
|
() => false
|
|
65
68
|
);
|
|
66
69
|
}
|
|
70
|
+
__name(useIsHydratedModern, "useIsHydratedModern");
|
|
67
71
|
var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
|
|
68
72
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/index.ts", "../src/use-is-hydrated.tsx", "../src/use-is-hydrated-legacy.ts"],
|
|
4
4
|
"sourcesContent": ["export { useIsHydrated } from './use-is-hydrated';\n", "import * as React from 'react';\nimport { useIsHydrated as useIsHydratedLegacy } from './use-is-hydrated-legacy';\n\nconst useReactSyncExternalStore: typeof React.useSyncExternalStore | undefined = (React as any)[\n ' useSyncExternalStore '.trim().toString()\n];\n\nfunction subscribe() {\n return () => {};\n}\n\n/**\n * Determines whether or not the component tree has been hydrated.\n */\nfunction useIsHydratedModern() {\n return useReactSyncExternalStore!(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport const useIsHydrated =\n typeof useReactSyncExternalStore === 'function' ? useIsHydratedModern : useIsHydratedLegacy;\n", "import * as React from 'react';\n\nlet _isHydrated = false;\n\nexport function useIsHydrated() {\n const [isHydrated, setIsHydrated] = React.useState(_isHydrated);\n React.useEffect(() => {\n if (!_isHydrated) {\n _isHydrated = true;\n setIsHydrated(true);\n }\n }, []);\n return isHydrated;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uBAAAA;AAAA;AAAA;;;ACAA,IAAAC,SAAuB;;;ACAvB,YAAuB;AAEvB,IAAI,cAAc;AAEX,SAAS,gBAAgB;AAC9B,QAAM,CAAC,YAAY,aAAa,IAAU,eAAS,WAAW;AAC9D,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,aAAa;AAChB,oBAAc;AACd,oBAAc,IAAI;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,CAAC;AACL,SAAO;AACT;AATgB;;;ADDhB,IAAM,4BAA4EC,OAChF,yBAAyB,KAAK,EAAE,SAAS,CAC3C;AAEA,SAAS,YAAY;AACnB,SAAO,MAAM;AAAA,EAAC;AAChB;AAFS;AAOT,SAAS,sBAAsB;AAC7B,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AANS;AAQF,IAAMC,iBACX,OAAO,8BAA8B,aAAa,sBAAsB;",
|
|
6
6
|
"names": ["useIsHydrated", "React", "React", "useIsHydrated"]
|
|
7
7
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
+
|
|
1
4
|
// src/use-is-hydrated.tsx
|
|
2
5
|
import * as React2 from "react";
|
|
3
6
|
|
|
@@ -14,6 +17,7 @@ function useIsHydrated() {
|
|
|
14
17
|
}, []);
|
|
15
18
|
return isHydrated;
|
|
16
19
|
}
|
|
20
|
+
__name(useIsHydrated, "useIsHydrated");
|
|
17
21
|
|
|
18
22
|
// src/use-is-hydrated.tsx
|
|
19
23
|
var useReactSyncExternalStore = React2[" useSyncExternalStore ".trim().toString()];
|
|
@@ -21,6 +25,7 @@ function subscribe() {
|
|
|
21
25
|
return () => {
|
|
22
26
|
};
|
|
23
27
|
}
|
|
28
|
+
__name(subscribe, "subscribe");
|
|
24
29
|
function useIsHydratedModern() {
|
|
25
30
|
return useReactSyncExternalStore(
|
|
26
31
|
subscribe,
|
|
@@ -28,6 +33,7 @@ function useIsHydratedModern() {
|
|
|
28
33
|
() => false
|
|
29
34
|
);
|
|
30
35
|
}
|
|
36
|
+
__name(useIsHydratedModern, "useIsHydratedModern");
|
|
31
37
|
var useIsHydrated2 = typeof useReactSyncExternalStore === "function" ? useIsHydratedModern : useIsHydrated;
|
|
32
38
|
export {
|
|
33
39
|
useIsHydrated2 as useIsHydrated
|
package/dist/index.mjs.map
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/use-is-hydrated.tsx", "../src/use-is-hydrated-legacy.ts"],
|
|
4
4
|
"sourcesContent": ["import * as React from 'react';\nimport { useIsHydrated as useIsHydratedLegacy } from './use-is-hydrated-legacy';\n\nconst useReactSyncExternalStore: typeof React.useSyncExternalStore | undefined = (React as any)[\n ' useSyncExternalStore '.trim().toString()\n];\n\nfunction subscribe() {\n return () => {};\n}\n\n/**\n * Determines whether or not the component tree has been hydrated.\n */\nfunction useIsHydratedModern() {\n return useReactSyncExternalStore!(\n subscribe,\n () => true,\n () => false,\n );\n}\n\nexport const useIsHydrated =\n typeof useReactSyncExternalStore === 'function' ? useIsHydratedModern : useIsHydratedLegacy;\n", "import * as React from 'react';\n\nlet _isHydrated = false;\n\nexport function useIsHydrated() {\n const [isHydrated, setIsHydrated] = React.useState(_isHydrated);\n React.useEffect(() => {\n if (!_isHydrated) {\n _isHydrated = true;\n setIsHydrated(true);\n }\n }, []);\n return isHydrated;\n}\n"],
|
|
5
|
-
"mappings": "
|
|
5
|
+
"mappings": ";;;;AAAA,YAAYA,YAAW;;;ACAvB,YAAY,WAAW;AAEvB,IAAI,cAAc;AAEX,SAAS,gBAAgB;AAC9B,QAAM,CAAC,YAAY,aAAa,IAAU,eAAS,WAAW;AAC9D,EAAM,gBAAU,MAAM;AACpB,QAAI,CAAC,aAAa;AAChB,oBAAc;AACd,oBAAc,IAAI;AAAA,IACpB;AAAA,EACF,GAAG,CAAC,CAAC;AACL,SAAO;AACT;AATgB;;;ADDhB,IAAM,4BAA4EC,OAChF,yBAAyB,KAAK,EAAE,SAAS,CAC3C;AAEA,SAAS,YAAY;AACnB,SAAO,MAAM;AAAA,EAAC;AAChB;AAFS;AAOT,SAAS,sBAAsB;AAC7B,SAAO;AAAA,IACL;AAAA,IACA,MAAM;AAAA,IACN,MAAM;AAAA,EACR;AACF;AANS;AAQF,IAAMC,iBACX,OAAO,8BAA8B,aAAa,sBAAsB;",
|
|
6
6
|
"names": ["React", "React", "useIsHydrated"]
|
|
7
7
|
}
|