@choksheak/react-utils 0.3.8 → 0.4.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/NoSSR.cjs +7 -30
- 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 +2 -0
- package/chunk-33UMQLKY.mjs +43 -0
- package/chunk-3V7WBGWQ.mjs +16 -0
- package/chunk-3X25NN6X.cjs +195 -0
- package/chunk-5DO7KC3L.cjs +43 -0
- package/chunk-5PDGU37E.cjs +104 -0
- package/chunk-6ZZ54XM5.min.mjs +2 -0
- package/chunk-6ZZ54XM5.min.mjs.map +1 -0
- package/chunk-74BS2FAO.cjs +12 -0
- package/chunk-F5L32IUC.min.cjs +2 -0
- package/chunk-F5L32IUC.min.cjs.map +1 -0
- package/chunk-GPV6JIQK.mjs +17 -0
- package/chunk-KE3RXVMS.min.cjs +2 -0
- package/chunk-KE3RXVMS.min.cjs.map +1 -0
- package/chunk-KILGR7YA.min.mjs +2 -0
- package/chunk-KILGR7YA.min.mjs.map +1 -0
- package/chunk-KRXENFK3.mjs +195 -0
- package/chunk-MWDH7YON.min.mjs +2 -0
- package/chunk-MWDH7YON.min.mjs.map +1 -0
- package/chunk-NTFFK7ZH.min.cjs +2 -0
- package/chunk-NTFFK7ZH.min.cjs.map +1 -0
- package/chunk-O3RBYG3W.min.cjs +2 -0
- package/chunk-O3RBYG3W.min.cjs.map +1 -0
- package/chunk-PHLY3LR4.mjs +104 -0
- package/chunk-RM4ZGGZ2.min.mjs +2 -0
- package/chunk-RM4ZGGZ2.min.mjs.map +1 -0
- package/chunk-TEZPF6BG.min.cjs +2 -0
- package/chunk-TEZPF6BG.min.cjs.map +1 -0
- package/chunk-UFJNJ3WV.cjs +16 -0
- package/chunk-UFJQLQFI.min.cjs +2 -0
- package/chunk-UFJQLQFI.min.cjs.map +1 -0
- package/chunk-V7L3UICC.min.mjs +2 -0
- package/chunk-V7L3UICC.min.mjs.map +1 -0
- package/chunk-VHMO75EY.min.mjs +2 -0
- package/chunk-VHMO75EY.min.mjs.map +1 -0
- package/chunk-WVLPJPWG.cjs +17 -0
- package/chunk-X6BYQHVC.mjs +12 -0
- package/fetcher.cjs +8 -50
- package/fetcher.d.mts +3 -3
- package/fetcher.d.ts +2 -2
- package/fetcher.min.cjs +1 -1
- package/fetcher.min.cjs.map +1 -1
- package/fetcher.min.mjs +1 -1
- package/fetcher.min.mjs.map +1 -1
- package/fetcher.mjs +5 -11
- package/package.json +124 -29
- package/sharedQuery.cjs +132 -392
- package/sharedQuery.d.mts +58 -13
- package/sharedQuery.d.ts +57 -12
- 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 +94 -322
- package/sharedState.cjs +15 -304
- package/sharedState.d.mts +4 -4
- package/sharedState.d.ts +4 -4
- 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 +10 -269
- package/storage.cjs +10 -123
- package/storage.d.mts +1 -0
- package/storage.d.ts +1 -0
- 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 +6 -92
- package/stringify.cjs +8 -57
- 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 +6 -30
- package/useDeepMemo.cjs +6 -50
- 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 +4 -13
package/stringify.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["/Users/choksheaklau/src/react-utils/dist/stringify.min.cjs"],"names":[],"mappings":"AAAA,wIAAyC,oCAAiC,oCAAE,CAAE,CAAC,+DAA0C","file":"/Users/choksheaklau/src/react-utils/dist/stringify.min.cjs"}
|
package/stringify.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import{a,b}from"./chunk-RM4ZGGZ2.min.mjs";import"./chunk-MWDH7YON.min.mjs";b();export{a as stringifyDeterministicForKeys};
|
|
2
2
|
//# sourceMappingURL=stringify.min.mjs.map
|
package/stringify.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/stringify.mjs
CHANGED
|
@@ -1,33 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
8
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
9
|
-
return value;
|
|
10
|
-
}
|
|
11
|
-
if (cache.has(value)) {
|
|
12
|
-
return "[Circular]";
|
|
13
|
-
}
|
|
14
|
-
cache.add(value);
|
|
15
|
-
if (value !== params) {
|
|
16
|
-
try {
|
|
17
|
-
JSON.stringify(value);
|
|
18
|
-
} catch {
|
|
19
|
-
return "[Unserializable]";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return Object.keys(value).sort().reduce(
|
|
23
|
-
(result, key) => {
|
|
24
|
-
result[key] = value[key];
|
|
25
|
-
return result;
|
|
26
|
-
},
|
|
27
|
-
{}
|
|
28
|
-
);
|
|
29
|
-
});
|
|
30
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
init_stringify,
|
|
3
|
+
stringifyDeterministicForKeys
|
|
4
|
+
} from "./chunk-33UMQLKY.mjs";
|
|
5
|
+
import "./chunk-X6BYQHVC.mjs";
|
|
6
|
+
init_stringify();
|
|
31
7
|
export {
|
|
32
8
|
stringifyDeterministicForKeys
|
|
33
9
|
};
|
package/useDeepMemo.cjs
CHANGED
|
@@ -1,51 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
29
2
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
module.exports = __toCommonJS(useDeepMemo_exports);
|
|
36
|
-
var import_isEqual = __toESM(require("lodash/isEqual"));
|
|
37
|
-
var import_react = require("react");
|
|
38
|
-
function useDeepMemo(value) {
|
|
39
|
-
const [state, setState] = (0, import_react.useState)(value);
|
|
40
|
-
return (0, import_react.useMemo)(() => {
|
|
41
|
-
if ((0, import_isEqual.default)(state, value)) {
|
|
42
|
-
return state;
|
|
43
|
-
}
|
|
44
|
-
setState(value);
|
|
45
|
-
return value;
|
|
46
|
-
}, [state, value]);
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
useDeepMemo
|
|
51
|
-
});
|
|
3
|
+
var _chunkWVLPJPWGcjs = require('./chunk-WVLPJPWG.cjs');
|
|
4
|
+
require('./chunk-74BS2FAO.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
exports.useDeepMemo = _chunkWVLPJPWGcjs.useDeepMemo;
|
package/useDeepMemo.min.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var _chunkF5L32IUCmincjs = require('./chunk-F5L32IUC.min.cjs');require('./chunk-KE3RXVMS.min.cjs');exports.useDeepMemo = _chunkF5L32IUCmincjs.a;
|
|
2
2
|
//# sourceMappingURL=useDeepMemo.min.cjs.map
|
package/useDeepMemo.min.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["
|
|
1
|
+
{"version":3,"sources":["/Users/choksheaklau/src/react-utils/dist/useDeepMemo.min.cjs"],"names":[],"mappings":"AAAA,wIAAuC,oCAAiC,6CAAyB","file":"/Users/choksheaklau/src/react-utils/dist/useDeepMemo.min.cjs"}
|
package/useDeepMemo.min.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import{a}from"./chunk-V7L3UICC.min.mjs";import"./chunk-MWDH7YON.min.mjs";export{a as useDeepMemo};
|
|
2
2
|
//# sourceMappingURL=useDeepMemo.min.mjs.map
|
package/useDeepMemo.min.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
package/useDeepMemo.mjs
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const [state, setState] = useState(value);
|
|
6
|
-
return useMemo(() => {
|
|
7
|
-
if (isEqual(state, value)) {
|
|
8
|
-
return state;
|
|
9
|
-
}
|
|
10
|
-
setState(value);
|
|
11
|
-
return value;
|
|
12
|
-
}, [state, value]);
|
|
13
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
useDeepMemo
|
|
3
|
+
} from "./chunk-GPV6JIQK.mjs";
|
|
4
|
+
import "./chunk-X6BYQHVC.mjs";
|
|
14
5
|
export {
|
|
15
6
|
useDeepMemo
|
|
16
7
|
};
|