@yaasl/preact 0.11.0-alpha.2 → 0.11.0-alpha.3

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,15 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useSetStateful = exports.useStatefulValue = void 0;
4
- const utils_1 = require("@yaasl/utils");
5
4
  const compat_1 = require("preact/compat");
6
5
  const hooks_1 = require("preact/hooks");
6
+ const utils_1 = require("@yaasl/utils");
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) => {
10
10
  if (!("set" in stateful) || !(stateful.set instanceof Function)) {
11
11
  throw new Error((0, utils_1.consoleMessage)("Atom does not have a set method"));
12
12
  }
13
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
13
14
  stateful.set(next);
14
15
  }, [stateful]);
15
16
  exports.useSetStateful = useSetStateful;
@@ -1,10 +1,11 @@
1
- import { consoleMessage } from "@yaasl/utils";
2
1
  import { useSyncExternalStore } from "preact/compat";
3
2
  import { useCallback } from "preact/hooks";
3
+ import { consoleMessage } from "@yaasl/utils";
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)) {
7
7
  throw new Error(consoleMessage("Atom does not have a set method"));
8
8
  }
9
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call
9
10
  stateful.set(next);
10
11
  }, [stateful]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaasl/preact",
3
- "version": "0.11.0-alpha.2",
3
+ "version": "0.11.0-alpha.3",
4
4
  "description": "yet another atomic store library (preact)",
5
5
  "author": "PrettyCoffee",
6
6
  "license": "MIT",
@@ -43,18 +43,12 @@
43
43
  "preact": ">=10"
44
44
  },
45
45
  "dependencies": {
46
- "@yaasl/core": "0.11.0-alpha.2",
47
- "@yaasl/utils": "0.11.0-alpha.2"
46
+ "@yaasl/core": "0.11.0-alpha.3",
47
+ "@yaasl/utils": "0.11.0-alpha.3"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@testing-library/preact": "^3.2.4",
51
- "preact": "^10.25.4"
52
- },
53
- "eslintConfig": {
54
- "extends": [
55
- "../../.eslintrc",
56
- "@pretty-cozy/eslint-config/react"
57
- ]
51
+ "preact": "^10.26.4"
58
52
  },
59
53
  "lint-staged": {
60
54
  "*.{ts,tsx}": [
package/tsconfig.json DELETED
@@ -1,3 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- }
@@ -1,9 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "include": ["./src"],
4
- "exclude": ["./**/*.test.ts"],
5
- "compilerOptions": {
6
- "declaration": false,
7
- "noEmit": false,
8
- }
9
- }