@yaasl/preact 0.10.1 → 0.11.0-alpha.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/dist/@types/useAtom.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Stateful } from "@yaasl/core";
|
|
1
|
+
import type { Stateful } from "@yaasl/core";
|
|
2
2
|
import { Updater } from "@yaasl/utils";
|
|
3
3
|
export declare const useStatefulValue: <ValueType>(stateful: Stateful<ValueType>) => ValueType;
|
|
4
4
|
export declare const useSetStateful: <State>(stateful: Stateful<State>) => (next: Updater<State>) => void;
|
package/dist/cjs/useStateful.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useSetStateful = exports.useStatefulValue = void 0;
|
|
4
4
|
const utils_1 = require("@yaasl/utils");
|
|
5
|
-
const hooks_1 = require("preact/hooks");
|
|
6
5
|
const compat_1 = require("preact/compat");
|
|
6
|
+
const hooks_1 = require("preact/hooks");
|
|
7
7
|
const useStatefulValue = (stateful) => (0, compat_1.useSyncExternalStore)(set => stateful.subscribe(set), () => stateful.get());
|
|
8
8
|
exports.useStatefulValue = useStatefulValue;
|
|
9
9
|
const useSetStateful = (stateful) => (0, hooks_1.useCallback)((next) => {
|
package/dist/mjs/useStateful.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { consoleMessage } from "@yaasl/utils";
|
|
2
|
-
import { useCallback } from "preact/hooks";
|
|
3
2
|
import { useSyncExternalStore } from "preact/compat";
|
|
3
|
+
import { useCallback } from "preact/hooks";
|
|
4
4
|
export const useStatefulValue = (stateful) => useSyncExternalStore(set => stateful.subscribe(set), () => stateful.get());
|
|
5
5
|
export const useSetStateful = (stateful) => useCallback((next) => {
|
|
6
6
|
if (!("set" in stateful) || !(stateful.set instanceof Function)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yaasl/preact",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0-alpha.0",
|
|
4
4
|
"description": "yet another atomic store library (preact)",
|
|
5
5
|
"author": "PrettyCoffee",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"preact": ">=10"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@yaasl/core": "0.
|
|
45
|
-
"@yaasl/utils": "0.
|
|
44
|
+
"@yaasl/core": "0.11.0-alpha.0",
|
|
45
|
+
"@yaasl/utils": "0.11.0-alpha.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@testing-library/preact": "^3.2.
|
|
49
|
-
"preact": "^10.
|
|
48
|
+
"@testing-library/preact": "^3.2.4",
|
|
49
|
+
"preact": "^10.24.3"
|
|
50
50
|
},
|
|
51
51
|
"eslintConfig": {
|
|
52
52
|
"extends": [
|