@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.
@@ -1,5 +1,5 @@
1
- import { Stateful } from "@yaasl/core";
2
- import { Updater } from "@yaasl/utils";
1
+ import type { Stateful } from "@yaasl/core";
2
+ import type { Updater } from "@yaasl/utils";
3
3
  /** Use an atom's value in the preact lifecycle.
4
4
  *
5
5
  * @param atom Atom to be used.
@@ -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;
@@ -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) => {
@@ -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.10.1",
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.10.1",
45
- "@yaasl/utils": "0.10.1"
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.3",
49
- "preact": "^10.21.0"
48
+ "@testing-library/preact": "^3.2.4",
49
+ "preact": "^10.24.3"
50
50
  },
51
51
  "eslintConfig": {
52
52
  "extends": [