@choksheak/react-utils 0.4.3 → 0.4.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.
Files changed (97) hide show
  1. package/NoSSR.cjs +30 -7
  2. package/NoSSR.min.cjs +1 -1
  3. package/NoSSR.min.cjs.map +1 -1
  4. package/NoSSR.min.mjs +1 -1
  5. package/NoSSR.min.mjs.map +1 -1
  6. package/NoSSR.mjs +0 -2
  7. package/index.cjs +979 -43
  8. package/index.d.cts +2 -2
  9. package/index.d.ts +2 -2
  10. package/index.min.cjs +1 -1
  11. package/index.min.cjs.map +1 -1
  12. package/index.min.mjs +1 -1
  13. package/index.min.mjs.map +1 -1
  14. package/index.mjs +916 -25
  15. package/package.json +1 -74
  16. package/sharedQuery.cjs +938 -10
  17. package/sharedQuery.d.cts +27 -21
  18. package/sharedQuery.d.ts +27 -21
  19. package/sharedQuery.min.cjs +1 -1
  20. package/sharedQuery.min.cjs.map +1 -1
  21. package/sharedQuery.min.mjs +1 -1
  22. package/sharedQuery.min.mjs.map +1 -1
  23. package/sharedQuery.mjs +906 -10
  24. package/sharedState.cjs +326 -15
  25. package/sharedState.d.cts +1 -0
  26. package/sharedState.d.ts +1 -0
  27. package/sharedState.min.cjs +1 -1
  28. package/sharedState.min.cjs.map +1 -1
  29. package/sharedState.min.mjs +1 -1
  30. package/sharedState.min.mjs.map +1 -1
  31. package/sharedState.mjs +291 -10
  32. package/storage.cjs +129 -10
  33. package/storage.min.cjs +1 -1
  34. package/storage.min.cjs.map +1 -1
  35. package/storage.min.mjs +1 -1
  36. package/storage.min.mjs.map +1 -1
  37. package/storage.mjs +98 -6
  38. package/stringify.cjs +57 -6
  39. package/stringify.min.cjs +1 -1
  40. package/stringify.min.cjs.map +1 -1
  41. package/stringify.min.mjs +1 -1
  42. package/stringify.min.mjs.map +1 -1
  43. package/stringify.mjs +30 -4
  44. package/useDeepMemo.cjs +40 -6
  45. package/useDeepMemo.min.cjs +1 -1
  46. package/useDeepMemo.min.cjs.map +1 -1
  47. package/useDeepMemo.min.mjs +1 -1
  48. package/useDeepMemo.min.mjs.map +1 -1
  49. package/useDeepMemo.mjs +13 -4
  50. package/chunk-3FLUS3WL.mjs +0 -561
  51. package/chunk-3X25NN6X.cjs +0 -195
  52. package/chunk-4235I4VO.mjs +0 -34
  53. package/chunk-4J7TN5JN.mjs +0 -17
  54. package/chunk-5PDGU37E.cjs +0 -104
  55. package/chunk-CYTO5EZE.cjs +0 -34
  56. package/chunk-HRE7YPUJ.min.mjs +0 -2
  57. package/chunk-HRE7YPUJ.min.mjs.map +0 -1
  58. package/chunk-IS3BZTWE.cjs +0 -35
  59. package/chunk-JOHZV3FD.min.cjs +0 -2
  60. package/chunk-JOHZV3FD.min.cjs.map +0 -1
  61. package/chunk-KGN4HQPP.min.cjs +0 -2
  62. package/chunk-KGN4HQPP.min.cjs.map +0 -1
  63. package/chunk-KILGR7YA.min.mjs +0 -2
  64. package/chunk-KILGR7YA.min.mjs.map +0 -1
  65. package/chunk-KRXENFK3.mjs +0 -195
  66. package/chunk-MUWTNWAX.min.cjs +0 -2
  67. package/chunk-MUWTNWAX.min.cjs.map +0 -1
  68. package/chunk-NL4FU2MJ.min.mjs +0 -2
  69. package/chunk-NL4FU2MJ.min.mjs.map +0 -1
  70. package/chunk-NTFFK7ZH.min.cjs +0 -2
  71. package/chunk-NTFFK7ZH.min.cjs.map +0 -1
  72. package/chunk-PHLY3LR4.mjs +0 -104
  73. package/chunk-PPJZAXJA.min.mjs +0 -2
  74. package/chunk-PPJZAXJA.min.mjs.map +0 -1
  75. package/chunk-PWDJNCGJ.cjs +0 -561
  76. package/chunk-R7POPVJR.mjs +0 -35
  77. package/chunk-TI3FMEYP.min.mjs +0 -2
  78. package/chunk-TI3FMEYP.min.mjs.map +0 -1
  79. package/chunk-UFJQLQFI.min.cjs +0 -2
  80. package/chunk-UFJQLQFI.min.cjs.map +0 -1
  81. package/chunk-VHMO75EY.min.mjs +0 -2
  82. package/chunk-VHMO75EY.min.mjs.map +0 -1
  83. package/chunk-WXLUEDBO.cjs +0 -17
  84. package/chunk-ZCDXPV3A.min.cjs +0 -2
  85. package/chunk-ZCDXPV3A.min.cjs.map +0 -1
  86. package/dist-O6NNX4Y3.min.mjs +0 -2
  87. package/dist-O6NNX4Y3.min.mjs.map +0 -1
  88. package/dist-SEGTJ72R.min.cjs +0 -2
  89. package/dist-SEGTJ72R.min.cjs.map +0 -1
  90. package/dist-UKP7SPWZ.cjs +0 -545
  91. package/dist-YXYQDOH5.mjs +0 -545
  92. package/magic-string.es-5QZEPJXJ.min.mjs +0 -14
  93. package/magic-string.es-5QZEPJXJ.min.mjs.map +0 -1
  94. package/magic-string.es-EREYSDLL.mjs +0 -1308
  95. package/magic-string.es-FXUUD55Y.min.cjs +0 -14
  96. package/magic-string.es-FXUUD55Y.min.cjs.map +0 -1
  97. package/magic-string.es-HC5PDAU3.cjs +0 -1308
package/NoSSR.cjs CHANGED
@@ -1,14 +1,37 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-IS3BZTWE.cjs');
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
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);
2
19
 
3
20
  // src/NoSSR.tsx
4
- var _react = require('react');
21
+ var NoSSR_exports = {};
22
+ __export(NoSSR_exports, {
23
+ NoSSR: () => NoSSR
24
+ });
25
+ module.exports = __toCommonJS(NoSSR_exports);
26
+ var import_react = require("react");
5
27
  var NoSSR = ({ children, fallback }) => {
6
- const [isClient, setIsClient] = _react.useState.call(void 0, false);
7
- _react.useEffect.call(void 0, () => {
28
+ const [isClient, setIsClient] = (0, import_react.useState)(false);
29
+ (0, import_react.useEffect)(() => {
8
30
  setIsClient(true);
9
31
  }, []);
10
32
  return isClient ? children : fallback;
11
33
  };
12
-
13
-
14
- exports.NoSSR = NoSSR;
34
+ // Annotate the CommonJS export names for ESM import in node:
35
+ 0 && (module.exports = {
36
+ NoSSR
37
+ });
package/NoSSR.min.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-ZCDXPV3A.min.cjs');var _react = require('react');var l=({children:e,fallback:t})=>{let[o,c]=_react.useState.call(void 0, !1);return _react.useEffect.call(void 0, ()=>{c(!0)},[]),o?e:t};exports.NoSSR = l;
1
+ "use strict";var a=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var l=Object.prototype.hasOwnProperty;var n=(t,e)=>{for(var o in e)a(t,o,{get:e[o],enumerable:!0})},p=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of S(e))!l.call(t,c)&&c!==o&&a(t,c,{get:()=>e[c],enumerable:!(r=R(e,c))||r.enumerable});return t};var N=t=>p(a({},"__esModule",{value:!0}),t);var i={};n(i,{NoSSR:()=>f});module.exports=N(i);var s=require("react"),f=({children:t,fallback:e})=>{let[o,r]=(0,s.useState)(!1);return(0,s.useEffect)(()=>{r(!0)},[]),o?t:e};0&&(module.exports={NoSSR});
2
2
  //# sourceMappingURL=NoSSR.min.cjs.map
package/NoSSR.min.cjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/choksheaklau/src/react-utils/dist/NoSSR.min.cjs","../src/NoSSR.tsx"],"names":["NoSSR","children","fallback","isClient","setIsClient","useState","useEffect"],"mappings":"AAAA,6GAAgC,8BCOsB,IAgBzCA,CAAAA,CAA8B,CAAC,CAAE,QAAA,CAAAC,CAAAA,CAAU,QAAA,CAAAC,CAAS,CAAA,CAAA,EAAM,CACrE,GAAM,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":[null,"/**\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"],"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":"yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,WAAAE,IAAA,eAAAC,EAAAH,GAOA,IAAAI,EAAsD,iBAgBzCF,EAA8B,CAAC,CAAE,SAAAG,EAAU,SAAAC,CAAS,IAAM,CACrE,GAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EAG9C,sBAAU,IAAM,CAGdA,EAAY,EAAI,CAClB,EAAG,CAAC,CAAC,EAEED,EAAWF,EAAWC,CAC/B","names":["NoSSR_exports","__export","NoSSR","__toCommonJS","import_react","children","fallback","isClient","setIsClient"]}
package/NoSSR.min.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import"./chunk-HRE7YPUJ.min.mjs";import{useEffect as r,useState as s}from"react";var l=({children:e,fallback:t})=>{let[o,c]=s(!1);return r(()=>{c(!0)},[]),o?e:t};export{l as NoSSR};
1
+ import{useEffect as r,useState as s}from"react";var l=({children:e,fallback:t})=>{let[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":"iCAOA,OAA2B,aAAAA,EAAW,YAAAC,MAAgB,QAgB/C,IAAMC,EAA8B,CAAC,CAAE,SAAAC,EAAU,SAAAC,CAAS,IAAM,CACrE,GAAM,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"]}
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,IAAMC,EAA8B,CAAC,CAAE,SAAAC,EAAU,SAAAC,CAAS,IAAM,CACrE,GAAM,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
@@ -1,5 +1,3 @@
1
- import "./chunk-R7POPVJR.mjs";
2
-
3
1
  // src/NoSSR.tsx
4
2
  import { useEffect, useState } from "react";
5
3
  var NoSSR = ({ children, fallback }) => {