@aiszlab/relax 1.5.1 → 1.5.2
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/react/using.cjs +12 -2
- package/dist/react/using.d.ts +5 -1
- package/dist/react/using.mjs +12 -2
- package/package.json +9 -9
package/dist/react/using.cjs
CHANGED
|
@@ -50,10 +50,20 @@ var using = function using(initializer) {
|
|
|
50
50
|
subscribe = _initialize.subscribe,
|
|
51
51
|
initialState = _initialize.initialState,
|
|
52
52
|
state = _initialize.state;
|
|
53
|
-
//
|
|
54
|
-
|
|
53
|
+
// create like hooks
|
|
54
|
+
var useStore = function useStore() {
|
|
55
55
|
return react.useSyncExternalStore(subscribe, state, initialState);
|
|
56
56
|
};
|
|
57
|
+
Object.defineProperty(useStore, "state", {
|
|
58
|
+
get: function get() {
|
|
59
|
+
return state();
|
|
60
|
+
},
|
|
61
|
+
set: function set() {
|
|
62
|
+
console.warn("`useStore`.`state` is readonly property!");
|
|
63
|
+
return Reflect.get(useStore, "state");
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
return useStore;
|
|
57
67
|
};
|
|
58
68
|
|
|
59
69
|
exports.using = using;
|
package/dist/react/using.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
type SetState<T> = (state: T | ((previous: T) => T)) => void;
|
|
2
2
|
type Initializer<T> = (setState: SetState<T>) => T;
|
|
3
|
-
|
|
3
|
+
type UseStore<T> = {
|
|
4
|
+
(): T;
|
|
5
|
+
get state(): T;
|
|
6
|
+
};
|
|
7
|
+
declare const using: <T>(initializer: Initializer<T>) => UseStore<T>;
|
|
4
8
|
export { using };
|
package/dist/react/using.mjs
CHANGED
|
@@ -48,10 +48,20 @@ var using = function using(initializer) {
|
|
|
48
48
|
subscribe = _initialize.subscribe,
|
|
49
49
|
initialState = _initialize.initialState,
|
|
50
50
|
state = _initialize.state;
|
|
51
|
-
//
|
|
52
|
-
|
|
51
|
+
// create like hooks
|
|
52
|
+
var useStore = function useStore() {
|
|
53
53
|
return useSyncExternalStore(subscribe, state, initialState);
|
|
54
54
|
};
|
|
55
|
+
Object.defineProperty(useStore, "state", {
|
|
56
|
+
get: function get() {
|
|
57
|
+
return state();
|
|
58
|
+
},
|
|
59
|
+
set: function set() {
|
|
60
|
+
console.warn("`useStore`.`state` is readonly property!");
|
|
61
|
+
return Reflect.get(useStore, "state");
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
return useStore;
|
|
55
65
|
};
|
|
56
66
|
|
|
57
67
|
export { using };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiszlab/relax",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.2",
|
|
4
4
|
"description": "react utils collection",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -36,24 +36,24 @@
|
|
|
36
36
|
"publish:npm": "npm publish"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@babel/runtime": "^7.25.
|
|
39
|
+
"@babel/runtime": "^7.25.7",
|
|
40
40
|
"react-is": "^18.3.1",
|
|
41
41
|
"rxjs": "^7.8.1"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@babel/core": "^7.25.
|
|
45
|
-
"@babel/plugin-transform-runtime": "^7.25.
|
|
46
|
-
"@babel/preset-env": "^7.25.
|
|
47
|
-
"@babel/preset-react": "^7.
|
|
48
|
-
"@babel/preset-typescript": "^7.
|
|
44
|
+
"@babel/core": "^7.25.8",
|
|
45
|
+
"@babel/plugin-transform-runtime": "^7.25.7",
|
|
46
|
+
"@babel/preset-env": "^7.25.8",
|
|
47
|
+
"@babel/preset-react": "^7.25.7",
|
|
48
|
+
"@babel/preset-typescript": "^7.25.7",
|
|
49
49
|
"@jest/globals": "^29.7.0",
|
|
50
50
|
"@rollup/plugin-babel": "^6.0.4",
|
|
51
51
|
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
52
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
52
|
+
"@rollup/plugin-typescript": "^12.1.1",
|
|
53
53
|
"@testing-library/react": "^16.0.1",
|
|
54
54
|
"@types/babel__core": "^7.20.5",
|
|
55
55
|
"@types/react": "^18.3.11",
|
|
56
|
-
"@types/react-dom": "^18.3.
|
|
56
|
+
"@types/react-dom": "^18.3.1",
|
|
57
57
|
"@types/react-is": "^18.3.0",
|
|
58
58
|
"jest": "^29.7.0",
|
|
59
59
|
"jest-environment-jsdom": "^29.7.0",
|