@choksheak/react-utils 0.4.5 → 0.4.7
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/NoSSR.cjs +7 -33
- package/NoSSR.min.cjs +1 -1
- package/NoSSR.min.cjs.map +1 -1
- package/NoSSR.min.mjs +1 -1
- package/NoSSR.min.mjs.map +1 -1
- package/NoSSR.mjs +1 -2
- package/index.cjs +5 -979
- package/index.d.cts +1 -1
- package/index.d.ts +1 -1
- package/index.min.cjs +1 -1
- package/index.min.cjs.map +1 -1
- package/index.min.mjs +1 -1
- package/index.min.mjs.map +1 -1
- package/index.mjs +5 -934
- package/package.json +1 -1
- package/sharedQuery.cjs +59 -420
- package/sharedQuery.min.cjs +1 -1
- package/sharedQuery.min.cjs.map +1 -1
- package/sharedQuery.min.mjs +1 -1
- package/sharedQuery.min.mjs.map +1 -1
- package/sharedQuery.mjs +12 -341
- package/sharedState.cjs +31 -154
- package/sharedState.min.cjs +1 -1
- package/sharedState.min.cjs.map +1 -1
- package/sharedState.min.mjs +1 -1
- package/sharedState.min.mjs.map +1 -1
- package/sharedState.mjs +14 -107
- package/storage.cjs +15 -43
- package/storage.min.cjs +1 -1
- package/storage.min.cjs.map +1 -1
- package/storage.min.mjs +1 -1
- package/storage.min.mjs.map +1 -1
- package/storage.mjs +1 -2
- package/stringify.cjs +5 -31
- package/stringify.min.cjs +1 -1
- package/stringify.min.cjs.map +1 -1
- package/stringify.min.mjs +1 -1
- package/stringify.min.mjs.map +1 -1
- package/stringify.mjs +0 -1
- package/useDeepMemo.cjs +8 -34
- package/useDeepMemo.min.cjs +1 -1
- package/useDeepMemo.min.cjs.map +1 -1
- package/useDeepMemo.min.mjs +1 -1
- package/useDeepMemo.min.mjs.map +1 -1
- package/useDeepMemo.mjs +0 -1
package/NoSSR.cjs
CHANGED
|
@@ -1,37 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/NoSSR.tsx
|
|
21
|
-
var NoSSR_exports = {};
|
|
22
|
-
__export(NoSSR_exports, {
|
|
23
|
-
NoSSR: () => NoSSR
|
|
24
|
-
});
|
|
25
|
-
module.exports = __toCommonJS(NoSSR_exports);
|
|
26
|
-
var import_react = require("react");
|
|
27
|
-
var NoSSR = ({ children, fallback }) => {
|
|
28
|
-
const [isClient, setIsClient] = (0, import_react.useState)(false);
|
|
29
|
-
(0, import_react.useEffect)(() => {
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _react = require('react');
|
|
2
|
+
const NoSSR = ({ children, fallback }) => {
|
|
3
|
+
const [isClient, setIsClient] = _react.useState.call(void 0, false);
|
|
4
|
+
_react.useEffect.call(void 0, () => {
|
|
30
5
|
setIsClient(true);
|
|
31
6
|
}, []);
|
|
32
7
|
return isClient ? children : fallback;
|
|
33
8
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
});
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.NoSSR = NoSSR;
|
package/NoSSR.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _react = require('react');const l=({children:e,fallback:t})=>{const[o,c]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{c(!0)},[]),o?e:t};exports.NoSSR = l;
|
|
2
2
|
//# sourceMappingURL=NoSSR.min.cjs.map
|
package/NoSSR.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NoSSR.tsx"],"sourcesContent":["/**\n * @packageDocumentation\n *\n * Wraps components in <NoSSR>...</NoSSR> to make sure they only render on the\n * client side, and not on the server side.\n */\n\nimport React, { ReactNode, useEffect, useState } from \"react\";\n\n/** Props for the NoSSR component. */\nexport type NoSSRProps = {\n /** The content to render only on the client side. */\n children: ReactNode;\n\n /** A component to render during SSR or initial load. */\n fallback?: ReactNode;\n};\n\n/**\n * A component that prevents its children from being rendered during\n * Server-Side Rendering (SSR). It renders a optional fallback during SSR, and\n * only renders its children after the component has mounted on the client.\n */\nexport const NoSSR: React.FC<NoSSRProps> = ({ children, fallback }) => {\n const [isClient, setIsClient] = useState(false);\n\n // 2. useEffect runs ONLY on the client after the initial hydration is complete.\n useEffect(() => {\n // This forces the component to render a second time.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsClient(true);\n }, []);\n\n return isClient ? children : fallback;\n};\n"]
|
|
1
|
+
{"version":3,"sources":["../src/NoSSR.tsx"],"names":["NoSSR","children","fallback","isClient","setIsClient","useState","useEffect"],"mappings":"AAOA,uGAAsD,MAgBzCA,CAAAA,CAA8B,CAAC,CAAE,QAAA,CAAAC,CAAAA,CAAU,QAAA,CAAAC,CAAS,CAAA,CAAA,EAAM,CACrE,KAAM,CAACC,CAAAA,CAAUC,CAAW,CAAA,CAAIC,6BAAAA,CAAS,CAAK,CAAA,CAG9C,OAAAC,8BAAAA,CAAU,CAAA,EAAM,CAGdF,CAAAA,CAAY,CAAA,CAAI,CAClB,CAAA,CAAG,CAAC,CAAC,CAAA,CAEED,CAAAA,CAAWF,CAAAA,CAAWC,CAC/B,CAAA,CAAA,kBAAA","file":"/Users/choksheaklau/src/react-utils/dist/NoSSR.min.cjs","sourcesContent":["/**\n * @packageDocumentation\n *\n * Wraps components in <NoSSR>...</NoSSR> to make sure they only render on the\n * client side, and not on the server side.\n */\n\nimport React, { ReactNode, useEffect, useState } from \"react\";\n\n/** Props for the NoSSR component. */\nexport type NoSSRProps = {\n /** The content to render only on the client side. */\n children: ReactNode;\n\n /** A component to render during SSR or initial load. */\n fallback?: ReactNode;\n};\n\n/**\n * A component that prevents its children from being rendered during\n * Server-Side Rendering (SSR). It renders a optional fallback during SSR, and\n * only renders its children after the component has mounted on the client.\n */\nexport const NoSSR: React.FC<NoSSRProps> = ({ children, fallback }) => {\n const [isClient, setIsClient] = useState(false);\n\n // 2. useEffect runs ONLY on the client after the initial hydration is complete.\n useEffect(() => {\n // This forces the component to render a second time.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsClient(true);\n }, []);\n\n return isClient ? children : fallback;\n};\n"]}
|
package/NoSSR.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{useEffect as r,useState as s}from"react";
|
|
1
|
+
import{useEffect as r,useState as s}from"react";const l=({children:e,fallback:t})=>{const[o,c]=s(!1);return r(()=>{c(!0)},[]),o?e:t};export{l as NoSSR};
|
|
2
2
|
//# sourceMappingURL=NoSSR.min.mjs.map
|
package/NoSSR.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NoSSR.tsx"],"sourcesContent":["/**\n * @packageDocumentation\n *\n * Wraps components in <NoSSR>...</NoSSR> to make sure they only render on the\n * client side, and not on the server side.\n */\n\nimport React, { ReactNode, useEffect, useState } from \"react\";\n\n/** Props for the NoSSR component. */\nexport type NoSSRProps = {\n /** The content to render only on the client side. */\n children: ReactNode;\n\n /** A component to render during SSR or initial load. */\n fallback?: ReactNode;\n};\n\n/**\n * A component that prevents its children from being rendered during\n * Server-Side Rendering (SSR). It renders a optional fallback during SSR, and\n * only renders its children after the component has mounted on the client.\n */\nexport const NoSSR: React.FC<NoSSRProps> = ({ children, fallback }) => {\n const [isClient, setIsClient] = useState(false);\n\n // 2. useEffect runs ONLY on the client after the initial hydration is complete.\n useEffect(() => {\n // This forces the component to render a second time.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsClient(true);\n }, []);\n\n return isClient ? children : fallback;\n};\n"],"mappings":"AAOA,OAA2B,aAAAA,EAAW,YAAAC,MAAgB,QAgB/C,
|
|
1
|
+
{"version":3,"sources":["../src/NoSSR.tsx"],"sourcesContent":["/**\n * @packageDocumentation\n *\n * Wraps components in <NoSSR>...</NoSSR> to make sure they only render on the\n * client side, and not on the server side.\n */\n\nimport React, { ReactNode, useEffect, useState } from \"react\";\n\n/** Props for the NoSSR component. */\nexport type NoSSRProps = {\n /** The content to render only on the client side. */\n children: ReactNode;\n\n /** A component to render during SSR or initial load. */\n fallback?: ReactNode;\n};\n\n/**\n * A component that prevents its children from being rendered during\n * Server-Side Rendering (SSR). It renders a optional fallback during SSR, and\n * only renders its children after the component has mounted on the client.\n */\nexport const NoSSR: React.FC<NoSSRProps> = ({ children, fallback }) => {\n const [isClient, setIsClient] = useState(false);\n\n // 2. useEffect runs ONLY on the client after the initial hydration is complete.\n useEffect(() => {\n // This forces the component to render a second time.\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsClient(true);\n }, []);\n\n return isClient ? children : fallback;\n};\n"],"mappings":"AAOA,OAA2B,aAAAA,EAAW,YAAAC,MAAgB,QAgB/C,MAAMC,EAA8B,CAAC,CAAE,SAAAC,EAAU,SAAAC,CAAS,IAAM,CACrE,KAAM,CAACC,EAAUC,CAAW,EAAIL,EAAS,EAAK,EAG9C,OAAAD,EAAU,IAAM,CAGdM,EAAY,EAAI,CAClB,EAAG,CAAC,CAAC,EAEED,EAAWF,EAAWC,CAC/B","names":["useEffect","useState","NoSSR","children","fallback","isClient","setIsClient"]}
|
package/NoSSR.mjs
CHANGED