@yaasl/preact 0.8.0-alpha.3 → 0.8.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,3 +1,2 @@
1
1
  export { useAtom, useSetAtom, useAtomValue, useAtomDidInit } from "./useAtom";
2
- export { useDerive, useSetDerive, useDeriveValue } from "./useDerive";
3
2
  export * from "@yaasl/core";
@@ -1,4 +1,4 @@
1
- import { Atom, Stateful } from "@yaasl/core";
1
+ import { Stateful } from "@yaasl/core";
2
2
  import { SetStateAction } from "@yaasl/utils";
3
3
  /** Use an atom's value in the preact lifecycle.
4
4
  *
@@ -13,14 +13,14 @@ export declare const useAtomValue: <ValueType>(atom: Stateful<ValueType>) => Val
13
13
  *
14
14
  * @returns A setter function for the atom.
15
15
  **/
16
- export declare const useSetAtom: <ValueType>(atom: Atom<ValueType>) => (next: SetStateAction<ValueType>) => void;
16
+ export declare const useSetAtom: <ValueType>(atom: Stateful<ValueType>) => ((next: SetStateAction<ValueType>) => void);
17
17
  /** Use an atom's initialization state in the preact lifecycle.
18
18
  *
19
19
  * @param atom Atom to be used.
20
20
  *
21
21
  * @returns A boolean indicating if the atom has finished initializing yet.
22
22
  **/
23
- export declare const useAtomDidInit: <ValueType>(atom: Atom<ValueType>) => boolean;
23
+ export declare const useAtomDidInit: <ValueType>(atom: Stateful<ValueType>) => boolean;
24
24
  /** Use an atom's value and setter in the preact lifecycle.
25
25
  *
26
26
  * **Note:** Use `useAtomValue` or `useSetAtom` to use value or setter separately.
@@ -29,4 +29,4 @@ export declare const useAtomDidInit: <ValueType>(atom: Atom<ValueType>) => boole
29
29
  *
30
30
  * @returns [value, setValue, didInit]
31
31
  **/
32
- export declare const useAtom: <ValueType>(atom: Atom<ValueType>) => readonly [ValueType, (next: SetStateAction<ValueType>) => void, boolean];
32
+ export declare const useAtom: <ValueType>(atom: Stateful<ValueType>) => readonly [ValueType, (next: SetStateAction<ValueType>) => void, boolean];
package/dist/cjs/index.js CHANGED
@@ -14,14 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.useDeriveValue = exports.useSetDerive = exports.useDerive = exports.useAtomDidInit = exports.useAtomValue = exports.useSetAtom = exports.useAtom = void 0;
17
+ exports.useAtomDidInit = exports.useAtomValue = exports.useSetAtom = exports.useAtom = void 0;
18
18
  var useAtom_1 = require("./useAtom");
19
19
  Object.defineProperty(exports, "useAtom", { enumerable: true, get: function () { return useAtom_1.useAtom; } });
20
20
  Object.defineProperty(exports, "useSetAtom", { enumerable: true, get: function () { return useAtom_1.useSetAtom; } });
21
21
  Object.defineProperty(exports, "useAtomValue", { enumerable: true, get: function () { return useAtom_1.useAtomValue; } });
22
22
  Object.defineProperty(exports, "useAtomDidInit", { enumerable: true, get: function () { return useAtom_1.useAtomDidInit; } });
23
- var useDerive_1 = require("./useDerive");
24
- Object.defineProperty(exports, "useDerive", { enumerable: true, get: function () { return useDerive_1.useDerive; } });
25
- Object.defineProperty(exports, "useSetDerive", { enumerable: true, get: function () { return useDerive_1.useSetDerive; } });
26
- Object.defineProperty(exports, "useDeriveValue", { enumerable: true, get: function () { return useDerive_1.useDeriveValue; } });
27
23
  __exportStar(require("@yaasl/core"), exports);
package/dist/mjs/index.js CHANGED
@@ -1,3 +1,2 @@
1
1
  export { useAtom, useSetAtom, useAtomValue, useAtomDidInit } from "./useAtom";
2
- export { useDerive, useSetDerive, useDeriveValue } from "./useDerive";
3
2
  export * from "@yaasl/core";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yaasl/preact",
3
- "version": "0.8.0-alpha.3",
3
+ "version": "0.8.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.8.0-alpha.3",
45
- "@yaasl/utils": "0.8.0-alpha.3"
44
+ "@yaasl/core": "0.8.0",
45
+ "@yaasl/utils": "0.8.0"
46
46
  },
47
47
  "devDependencies": {
48
48
  "@testing-library/preact": "^3.2.3",
49
- "preact": "^10.19.5"
49
+ "preact": "^10.21.0"
50
50
  },
51
51
  "eslintConfig": {
52
52
  "extends": [
@@ -1,24 +0,0 @@
1
- import { Derive } from "@yaasl/core";
2
- /** Use a derive atom's value in the preact lifecycle.
3
- *
4
- * @param derive Derive atom to be used.
5
- *
6
- * @returns A stateful value.
7
- **/
8
- export declare const useDeriveValue: <ValueType>(derive: Derive<ValueType>) => ValueType;
9
- /** Set a derive atom's value in the preact lifecycle.
10
- *
11
- * @param derive Derive atom to be used.
12
- *
13
- * @returns A setter function for the derive atom.
14
- **/
15
- export declare const useSetDerive: <ValueType>(derive: Derive<ValueType>) => (next: import("../../utils/dist/@types").SetStateAction<ValueType>) => void;
16
- /** Use a derive atom's value and setter in the preact lifecycle.
17
- *
18
- * **Note:** Use `useDeriveValue` or `useSetDerive` to use value or setter separately.
19
- *
20
- * @param derive Derive atom to be used.
21
- *
22
- * @returns [value, setValue]
23
- **/
24
- export declare const useDerive: <ValueType>(derive: Derive<ValueType>) => readonly [ValueType, (next: import("../../utils/dist/@types").SetStateAction<ValueType>) => void];
@@ -1,34 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useDerive = exports.useSetDerive = exports.useDeriveValue = void 0;
4
- const useStateful_1 = require("./useStateful");
5
- /** Use a derive atom's value in the preact lifecycle.
6
- *
7
- * @param derive Derive atom to be used.
8
- *
9
- * @returns A stateful value.
10
- **/
11
- const useDeriveValue = (derive) => (0, useStateful_1.useStatefulValue)(derive);
12
- exports.useDeriveValue = useDeriveValue;
13
- /** Set a derive atom's value in the preact lifecycle.
14
- *
15
- * @param derive Derive atom to be used.
16
- *
17
- * @returns A setter function for the derive atom.
18
- **/
19
- const useSetDerive = (derive) => (0, useStateful_1.useSetStateful)(derive);
20
- exports.useSetDerive = useSetDerive;
21
- /** Use a derive atom's value and setter in the preact lifecycle.
22
- *
23
- * **Note:** Use `useDeriveValue` or `useSetDerive` to use value or setter separately.
24
- *
25
- * @param derive Derive atom to be used.
26
- *
27
- * @returns [value, setValue]
28
- **/
29
- const useDerive = (derive) => {
30
- const state = (0, exports.useDeriveValue)(derive);
31
- const setState = (0, exports.useSetDerive)(derive);
32
- return [state, setState];
33
- };
34
- exports.useDerive = useDerive;
@@ -1,28 +0,0 @@
1
- import { useSetStateful, useStatefulValue } from "./useStateful";
2
- /** Use a derive atom's value in the preact lifecycle.
3
- *
4
- * @param derive Derive atom to be used.
5
- *
6
- * @returns A stateful value.
7
- **/
8
- export const useDeriveValue = (derive) => useStatefulValue(derive);
9
- /** Set a derive atom's value in the preact lifecycle.
10
- *
11
- * @param derive Derive atom to be used.
12
- *
13
- * @returns A setter function for the derive atom.
14
- **/
15
- export const useSetDerive = (derive) => useSetStateful(derive);
16
- /** Use a derive atom's value and setter in the preact lifecycle.
17
- *
18
- * **Note:** Use `useDeriveValue` or `useSetDerive` to use value or setter separately.
19
- *
20
- * @param derive Derive atom to be used.
21
- *
22
- * @returns [value, setValue]
23
- **/
24
- export const useDerive = (derive) => {
25
- const state = useDeriveValue(derive);
26
- const setState = useSetDerive(derive);
27
- return [state, setState];
28
- };