extra-react-hooks 0.1.9 → 0.1.12
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/es2015/index.min.mjs +3 -17
- package/dist/es2015/index.min.mjs.map +1 -1
- package/dist/es2015/index.mjs +8916 -6402
- package/dist/es2015/index.mjs.map +1 -1
- package/dist/es2015/index.umd.js +8916 -6402
- package/dist/es2015/index.umd.js.map +1 -1
- package/dist/es2015/index.umd.min.js +3 -17
- package/dist/es2015/index.umd.min.js.map +1 -1
- package/dist/es2018/index.min.mjs +3 -17
- package/dist/es2018/index.min.mjs.map +1 -1
- package/dist/es2018/index.mjs +8916 -6402
- package/dist/es2018/index.mjs.map +1 -1
- package/dist/es2018/index.umd.js +8916 -6402
- package/dist/es2018/index.umd.js.map +1 -1
- package/dist/es2018/index.umd.min.js +3 -17
- package/dist/es2018/index.umd.min.js.map +1 -1
- package/lib/es2015/index.js +5 -1
- package/lib/es2015/index.js.map +1 -1
- package/lib/es2015/use-finite-state-machine.js +5 -2
- package/lib/es2015/use-finite-state-machine.js.map +1 -1
- package/lib/es2018/index.js +5 -1
- package/lib/es2018/index.js.map +1 -1
- package/lib/es2018/use-finite-state-machine.js +5 -2
- package/lib/es2018/use-finite-state-machine.js.map +1 -1
- package/package.json +26 -26
- package/CHANGELOG.md +0 -68
package/lib/es2015/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/es2015/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,mDAAgC;AAChC,8CAA2B;AAC3B,yDAAsC;AACtC,oDAAiC;AACjC,+CAA4B;AAC5B,wDAAqC;AACrC,6CAA0B;AAC1B,qDAAkC;AAClC,6DAA0C"}
|
|
@@ -3,14 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useFiniteStateMachine = exports.ObservableFiniteStateMachine = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const structures_1 = require("@blackglory/structures");
|
|
6
|
-
const observable_hooks_1 = require("observable-hooks");
|
|
7
6
|
const use_force_update_1 = require("./use-force-update");
|
|
8
7
|
var structures_2 = require("@blackglory/structures");
|
|
9
8
|
Object.defineProperty(exports, "ObservableFiniteStateMachine", { enumerable: true, get: function () { return structures_2.ObservableFiniteStateMachine; } });
|
|
10
9
|
function useFiniteStateMachine(schema, initialState) {
|
|
11
10
|
const forceUpdate = (0, use_force_update_1.useForceUpdate)();
|
|
12
11
|
const fsm = (0, react_1.useMemo)(() => new structures_1.ObservableFiniteStateMachine(schema, initialState), [schema]);
|
|
13
|
-
(0,
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
const observable = fsm.observeStateChanges();
|
|
14
|
+
const subscription = observable.subscribe(() => forceUpdate());
|
|
15
|
+
return () => subscription.unsubscribe();
|
|
16
|
+
}, [fsm]);
|
|
14
17
|
return fsm;
|
|
15
18
|
}
|
|
16
19
|
exports.useFiniteStateMachine = useFiniteStateMachine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-finite-state-machine.js","sourceRoot":"","sources":["../../src/use-finite-state-machine.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"use-finite-state-machine.js","sourceRoot":"","sources":["../../src/use-finite-state-machine.ts"],"names":[],"mappings":";;;AAAA,iCAA0C;AAC1C,uDAG+B;AAC/B,yDAAmD;AAEnD,qDAG+B;AAF7B,0HAAA,4BAA4B,OAAA;AAI9B,SAAgB,qBAAqB,CACnC,MAA+C,EAC/C,YAAmB;IAEnB,MAAM,WAAW,GAAG,IAAA,iCAAc,GAAE,CAAA;IACpC,MAAM,GAAG,GAAG,IAAA,eAAO,EACjB,GAAG,EAAE,CAAC,IAAI,yCAA4B,CAAC,MAAM,EAAE,YAAY,CAAC,EAC5D,CAAC,MAAM,CAAC,CACT,CAAA;IAED,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,GAAG,CAAC,mBAAmB,EAAE,CAAA;QAC5C,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;QAE9D,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAA;IACzC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;IAET,OAAO,GAAG,CAAA;AACZ,CAAC;AAlBD,sDAkBC"}
|
package/lib/es2018/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/lib/es2018/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,mDAAgC;AAChC,8CAA2B;AAC3B,yDAAsC;AACtC,oDAAiC;AACjC,+CAA4B;AAC5B,wDAAqC;AACrC,6CAA0B;AAC1B,qDAAkC;AAClC,6DAA0C"}
|
|
@@ -3,14 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useFiniteStateMachine = exports.ObservableFiniteStateMachine = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
const structures_1 = require("@blackglory/structures");
|
|
6
|
-
const observable_hooks_1 = require("observable-hooks");
|
|
7
6
|
const use_force_update_1 = require("./use-force-update");
|
|
8
7
|
var structures_2 = require("@blackglory/structures");
|
|
9
8
|
Object.defineProperty(exports, "ObservableFiniteStateMachine", { enumerable: true, get: function () { return structures_2.ObservableFiniteStateMachine; } });
|
|
10
9
|
function useFiniteStateMachine(schema, initialState) {
|
|
11
10
|
const forceUpdate = (0, use_force_update_1.useForceUpdate)();
|
|
12
11
|
const fsm = (0, react_1.useMemo)(() => new structures_1.ObservableFiniteStateMachine(schema, initialState), [schema]);
|
|
13
|
-
(0,
|
|
12
|
+
(0, react_1.useEffect)(() => {
|
|
13
|
+
const observable = fsm.observeStateChanges();
|
|
14
|
+
const subscription = observable.subscribe(() => forceUpdate());
|
|
15
|
+
return () => subscription.unsubscribe();
|
|
16
|
+
}, [fsm]);
|
|
14
17
|
return fsm;
|
|
15
18
|
}
|
|
16
19
|
exports.useFiniteStateMachine = useFiniteStateMachine;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-finite-state-machine.js","sourceRoot":"","sources":["../../src/use-finite-state-machine.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"use-finite-state-machine.js","sourceRoot":"","sources":["../../src/use-finite-state-machine.ts"],"names":[],"mappings":";;;AAAA,iCAA0C;AAC1C,uDAG+B;AAC/B,yDAAmD;AAEnD,qDAG+B;AAF7B,0HAAA,4BAA4B,OAAA;AAI9B,SAAgB,qBAAqB,CACnC,MAA+C,EAC/C,YAAmB;IAEnB,MAAM,WAAW,GAAG,IAAA,iCAAc,GAAE,CAAA;IACpC,MAAM,GAAG,GAAG,IAAA,eAAO,EACjB,GAAG,EAAE,CAAC,IAAI,yCAA4B,CAAC,MAAM,EAAE,YAAY,CAAC,EAC5D,CAAC,MAAM,CAAC,CACT,CAAA;IAED,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,GAAG,CAAC,mBAAmB,EAAE,CAAA;QAC5C,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,CAAA;QAE9D,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAA;IACzC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;IAET,OAAO,GAAG,CAAA;AACZ,CAAC;AAlBD,sDAkBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "extra-react-hooks",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"files": [
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
],
|
|
10
10
|
"main": "lib/es2018/index.js",
|
|
11
11
|
"types": "lib/es2018/index.d.ts",
|
|
12
|
+
"sideEffects": false,
|
|
12
13
|
"repository": "git@github.com:BlackGlory/extra-react-hooks.git",
|
|
13
14
|
"author": "BlackGlory <woshenmedoubuzhidao@blackglory.me>",
|
|
14
15
|
"license": "MIT",
|
|
@@ -37,24 +38,24 @@
|
|
|
37
38
|
}
|
|
38
39
|
},
|
|
39
40
|
"devDependencies": {
|
|
40
|
-
"@blackglory/wait-for": "^0.
|
|
41
|
-
"@commitlint/cli": "^
|
|
42
|
-
"@commitlint/config-conventional": "^
|
|
43
|
-
"@rollup/plugin-commonjs": "^
|
|
41
|
+
"@blackglory/wait-for": "^0.5.1",
|
|
42
|
+
"@commitlint/cli": "^17.0.2",
|
|
43
|
+
"@commitlint/config-conventional": "^17.0.2",
|
|
44
|
+
"@rollup/plugin-commonjs": "^22.0.0",
|
|
44
45
|
"@rollup/plugin-json": "^4.1.0",
|
|
45
|
-
"@rollup/plugin-node-resolve": "^13.1.
|
|
46
|
-
"@rollup/plugin-replace": "^
|
|
47
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
48
|
-
"@testing-library/react": "^12.1.
|
|
46
|
+
"@rollup/plugin-node-resolve": "^13.1.3",
|
|
47
|
+
"@rollup/plugin-replace": "^4.0.0",
|
|
48
|
+
"@rollup/plugin-typescript": "^8.3.1",
|
|
49
|
+
"@testing-library/react": "^12.1.4",
|
|
49
50
|
"@testing-library/react-hooks": "^7.0.2",
|
|
50
|
-
"@types/jasmine": "^
|
|
51
|
-
"@types/react": "^17.0.
|
|
52
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
53
|
-
"@typescript-eslint/parser": "^5.
|
|
54
|
-
"eslint": "^8.
|
|
55
|
-
"husky": "
|
|
56
|
-
"karma": "^6.3.
|
|
57
|
-
"karma-chrome-launcher": "^3.1.
|
|
51
|
+
"@types/jasmine": "^4.0.0",
|
|
52
|
+
"@types/react": "^17.0.40",
|
|
53
|
+
"@typescript-eslint/eslint-plugin": "^5.15.0",
|
|
54
|
+
"@typescript-eslint/parser": "^5.15.0",
|
|
55
|
+
"eslint": "^8.11.0",
|
|
56
|
+
"husky": "4",
|
|
57
|
+
"karma": "^6.3.17",
|
|
58
|
+
"karma-chrome-launcher": "^3.1.1",
|
|
58
59
|
"karma-jasmine": "^4.0.1",
|
|
59
60
|
"karma-webpack": "^5.0.0",
|
|
60
61
|
"npm-run-all": "^4.1.5",
|
|
@@ -62,23 +63,22 @@
|
|
|
62
63
|
"react-dom": "^17.0.2",
|
|
63
64
|
"react-test-renderer": "^17.0.2",
|
|
64
65
|
"rimraf": "^3.0.2",
|
|
65
|
-
"rollup": "^2.
|
|
66
|
+
"rollup": "^2.70.1",
|
|
66
67
|
"rollup-plugin-analyzer": "^4.0.0",
|
|
67
68
|
"rollup-plugin-terser": "^7.0.2",
|
|
68
69
|
"standard-version": "^9.3.2",
|
|
69
|
-
"ts-loader": "^9.2.
|
|
70
|
+
"ts-loader": "^9.2.8",
|
|
70
71
|
"tsconfig-paths-webpack-plugin": "^3.5.2",
|
|
71
72
|
"tscpaths": "^0.0.9",
|
|
72
73
|
"tslib": "^2.3.1",
|
|
73
|
-
"typescript": "^4.
|
|
74
|
-
"webpack": "^5.
|
|
74
|
+
"typescript": "^4.6.2",
|
|
75
|
+
"webpack": "^5.70.0"
|
|
75
76
|
},
|
|
76
77
|
"dependencies": {
|
|
77
|
-
"@blackglory/errors": "^
|
|
78
|
-
"@blackglory/structures": "^0.
|
|
79
|
-
"@blackglory/types": "^0.
|
|
80
|
-
"
|
|
81
|
-
"rxjs": "^7.4.0"
|
|
78
|
+
"@blackglory/errors": "^2.2.1",
|
|
79
|
+
"@blackglory/structures": "^0.6.0",
|
|
80
|
+
"@blackglory/types": "^1.0.0",
|
|
81
|
+
"rxjs": "^7.5.5"
|
|
82
82
|
},
|
|
83
83
|
"peerDependencies": {
|
|
84
84
|
"react": ">= 16.8"
|
package/CHANGELOG.md
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
### [0.1.9](https://github.com/BlackGlory/extra-react-hooks/compare/v0.1.8...v0.1.9) (2021-12-13)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Features
|
|
9
|
-
|
|
10
|
-
* add useFiniteStateMachine ([e6e8962](https://github.com/BlackGlory/extra-react-hooks/commit/e6e8962724774a8b217a1fd5332c13ba4ee051f7))
|
|
11
|
-
|
|
12
|
-
### [0.1.8](https://github.com/BlackGlory/extra-react-hooks/compare/v0.1.7...v0.1.8) (2021-12-13)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### Features
|
|
16
|
-
|
|
17
|
-
* add useForceUpdate ([f747227](https://github.com/BlackGlory/extra-react-hooks/commit/f747227c02c5bb2f0a0f1889de1c022bc9ca1e4d))
|
|
18
|
-
|
|
19
|
-
### [0.1.7](https://github.com/BlackGlory/extra-react-hooks/compare/v0.1.6...v0.1.7) (2021-12-10)
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
### Features
|
|
23
|
-
|
|
24
|
-
* add useStep ([f404846](https://github.com/BlackGlory/extra-react-hooks/commit/f4048462cc254499d7fd06cd51e16e98acd978ca))
|
|
25
|
-
|
|
26
|
-
### [0.1.6](https://github.com/BlackGlory/extra-react-hooks/compare/v0.1.5...v0.1.6) (2021-11-15)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
### Features
|
|
30
|
-
|
|
31
|
-
* add useResizeObserver ([8a4e317](https://github.com/BlackGlory/extra-react-hooks/commit/8a4e317921387fa26e768796e52c8fe44e9b347e))
|
|
32
|
-
|
|
33
|
-
### [0.1.5](https://github.com/BlackGlory/extra-react-hooks/compare/v0.1.4...v0.1.5) (2021-10-04)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
### Features
|
|
37
|
-
|
|
38
|
-
* add useIncrement ([e5f1fc4](https://github.com/BlackGlory/extra-react-hooks/commit/e5f1fc442a2c69aa490fed873cc21fe4ad9ff76b))
|
|
39
|
-
|
|
40
|
-
### [0.1.4](https://github.com/BlackGlory/extra-react-hooks/compare/v0.1.3...v0.1.4) (2021-08-18)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
### Features
|
|
44
|
-
|
|
45
|
-
* add useIsMounted ([32a1295](https://github.com/BlackGlory/extra-react-hooks/commit/32a12951aab92ae5734f4caddf45021e2bbed793))
|
|
46
|
-
|
|
47
|
-
### [0.1.3](https://github.com/BlackGlory/extra-react-hooks/compare/v0.1.2...v0.1.3) (2021-08-18)
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
### Features
|
|
51
|
-
|
|
52
|
-
* add useStateCycle ([a48da21](https://github.com/BlackGlory/extra-react-hooks/commit/a48da211f364688daa63a0bd5406fa2f2c61eba7))
|
|
53
|
-
|
|
54
|
-
### [0.1.2](https://github.com/BlackGlory/extra-react-hooks/compare/v0.1.1...v0.1.2) (2021-07-03)
|
|
55
|
-
|
|
56
|
-
### [0.1.1](https://github.com/BlackGlory/extra-react-hooks/compare/v0.1.0...v0.1.1) (2021-06-29)
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
### Features
|
|
60
|
-
|
|
61
|
-
* add useMount ([070045a](https://github.com/BlackGlory/extra-react-hooks/commit/070045ac0f209712eadd0f4e79c1328d20745b04))
|
|
62
|
-
|
|
63
|
-
## 0.1.0 (2021-06-04)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
### Features
|
|
67
|
-
|
|
68
|
-
* add useToggle, useSingleSelection ([0b9ee92](https://github.com/BlackGlory/extra-react-hooks/commit/0b9ee92597a230989b51b7242f529f0a36590d1f))
|