@aiszlab/relax 1.2.64 → 1.2.65
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/dom/scroll-to.js +5 -2
- package/dist/hooks/use-boolean.js +1 -1
- package/dist/hooks/use-click-away.d.ts +2 -1
- package/dist/hooks/use-click-away.js +6 -1
- package/dist/hooks/use-controlled-state.js +1 -1
- package/dist/hooks/use-counter.js +1 -1
- package/dist/hooks/use-device-pixel-ratio.js +1 -1
- package/dist/hooks/use-focus.js +1 -1
- package/dist/hooks/use-force-update.js +1 -1
- package/dist/hooks/use-hover.js +1 -1
- package/dist/hooks/use-image-loader.js +1 -1
- package/dist/hooks/use-media-query.js +1 -1
- package/dist/hooks/use-network.d.ts +5 -0
- package/dist/hooks/use-scroll-locker.js +16 -11
- package/dist/hooks/use-togglable.js +25 -20
- package/dist/hooks/use-unmount.d.ts +7 -0
- package/dist/hooks/use-unmount.js +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/is/is-complex.js +1 -1
- package/dist/is/is-dom-usable.js +2 -1
- package/dist/is/is-empty.js +1 -1
- package/dist/is/is-refable.js +1 -1
- package/dist/types/arrayable.d.ts +1 -0
- package/dist/utils/replace.js +1 -1
- package/dist/utils/set-style.js +1 -1
- package/dist/utils/tagged-template-literals.js +3 -1
- package/dist/utils/to-array.js +1 -1
- package/dist/utils/to-form-data.js +1 -1
- package/dist/utils/waitable.js +23 -16
- package/package.json +5 -2
- package/dist/_virtual/_rollupPluginBabelHelpers.js +0 -133
package/dist/dom/scroll-to.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
2
|
+
import _createClass from '@babel/runtime/helpers/createClass';
|
|
3
|
+
import _classPrivateFieldInitSpec from '@babel/runtime/helpers/classPrivateFieldInitSpec';
|
|
4
|
+
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet2';
|
|
2
5
|
|
|
3
6
|
var _scrolled = /*#__PURE__*/new WeakMap();
|
|
4
7
|
var Scroller = /*#__PURE__*/function () {
|
|
@@ -11,7 +14,7 @@ var Scroller = /*#__PURE__*/function () {
|
|
|
11
14
|
return _createClass(Scroller, [{
|
|
12
15
|
key: "scrolled",
|
|
13
16
|
get: function get() {
|
|
14
|
-
return
|
|
17
|
+
return _classPrivateFieldGet(_scrolled, this);
|
|
15
18
|
}
|
|
16
19
|
}, {
|
|
17
20
|
key: "currentAt",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type MutableRefObject } from "react";
|
|
2
|
+
import type { Arrayable } from "../types/arrayable";
|
|
2
3
|
/**
|
|
3
4
|
* @description
|
|
4
5
|
* click away
|
|
5
6
|
*/
|
|
6
|
-
export declare const useClickAway: (onClickAway: (event: MouseEvent) => void, target: MutableRefObject<HTMLElement | null
|
|
7
|
+
export declare const useClickAway: (onClickAway: (event: MouseEvent) => void, target: Arrayable<MutableRefObject<HTMLElement | null>>) => void;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
2
|
import { useEvent } from './use-event.js';
|
|
3
3
|
import { contains } from '../dom/contains.js';
|
|
4
|
+
import { toArray } from '../utils/to-array.js';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* @description
|
|
@@ -8,7 +9,11 @@ import { contains } from '../dom/contains.js';
|
|
|
8
9
|
*/
|
|
9
10
|
var useClickAway = function useClickAway(onClickAway, target) {
|
|
10
11
|
var clickAway = useEvent(function (event) {
|
|
11
|
-
|
|
12
|
+
var targets = toArray(target);
|
|
13
|
+
var isContained = targets.some(function (_target) {
|
|
14
|
+
return contains(_target.current, event.target);
|
|
15
|
+
});
|
|
16
|
+
if (isContained) return;
|
|
12
17
|
onClickAway(event);
|
|
13
18
|
});
|
|
14
19
|
useEffect(function () {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { isStateGetter } from '../is/is-state-getter.js';
|
|
4
4
|
import { isUndefined } from '../is/is-undefined.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import { useState, useCallback, useMemo } from 'react';
|
|
3
3
|
import { clamp } from '../utils/clamp.js';
|
|
4
4
|
import { useDefault } from './use-default.js';
|
package/dist/hooks/use-focus.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { useBoolean } from './use-boolean.js';
|
|
4
4
|
import { chain } from '../utils/chain.js';
|
package/dist/hooks/use-hover.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import { useCallback } from 'react';
|
|
3
3
|
import { useBoolean } from './use-boolean.js';
|
|
4
4
|
import { chain } from '../utils/chain.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
2
|
import { useMemo, useState, useEffect } from 'react';
|
|
3
3
|
import { toArray } from '../utils/to-array.js';
|
|
4
4
|
import { useEvent } from './use-event.js';
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
2
|
+
import _createClass from '@babel/runtime/helpers/createClass';
|
|
3
|
+
import _classPrivateFieldInitSpec from '@babel/runtime/helpers/classPrivateFieldInitSpec';
|
|
4
|
+
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet2';
|
|
5
|
+
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet2';
|
|
2
6
|
import { useLayoutEffect } from 'react';
|
|
3
7
|
import { isOverflow } from '../is/is-overflow.js';
|
|
4
8
|
import { setStyle } from '../utils/set-style.js';
|
|
@@ -18,7 +22,7 @@ var ScrollLocker = /*#__PURE__*/function () {
|
|
|
18
22
|
return _createClass(ScrollLocker, [{
|
|
19
23
|
key: "barSize",
|
|
20
24
|
get: function get() {
|
|
21
|
-
if (
|
|
25
|
+
if (_classPrivateFieldGet(_barSize, this)) return _classPrivateFieldGet(_barSize, this);
|
|
22
26
|
// how to calculate dom scroll bar size
|
|
23
27
|
// create a backend dom element, set force scrollable
|
|
24
28
|
var _target = document.createElement("div");
|
|
@@ -30,12 +34,12 @@ var ScrollLocker = /*#__PURE__*/function () {
|
|
|
30
34
|
_target.attributeStyleMap.set("overflow", "scroll");
|
|
31
35
|
// calculate, then clear
|
|
32
36
|
document.body.appendChild(_target);
|
|
33
|
-
|
|
37
|
+
_classPrivateFieldSet(_barSize, this, {
|
|
34
38
|
width: _target.offsetWidth - _target.clientWidth,
|
|
35
39
|
height: _target.offsetHeight - _target.clientHeight
|
|
36
40
|
});
|
|
37
41
|
document.body.removeChild(_target);
|
|
38
|
-
return
|
|
42
|
+
return _classPrivateFieldGet(_barSize, this);
|
|
39
43
|
}
|
|
40
44
|
}, {
|
|
41
45
|
key: "isOverflow",
|
|
@@ -47,10 +51,10 @@ var ScrollLocker = /*#__PURE__*/function () {
|
|
|
47
51
|
value: function lock() {
|
|
48
52
|
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body;
|
|
49
53
|
// if locked, do not lock again
|
|
50
|
-
if (
|
|
54
|
+
if (_classPrivateFieldGet(_locked, this).has(element)) return;
|
|
51
55
|
// if target is not scrollable, do not lock
|
|
52
56
|
if (!isOverflow(element)) return;
|
|
53
|
-
|
|
57
|
+
_classPrivateFieldGet(_locked, this).set(element, setStyle(element, {
|
|
54
58
|
overflow: "hidden",
|
|
55
59
|
width: "calc(100% - ".concat(this.barSize.width, "px)")
|
|
56
60
|
}));
|
|
@@ -60,10 +64,10 @@ var ScrollLocker = /*#__PURE__*/function () {
|
|
|
60
64
|
value: function unlock() {
|
|
61
65
|
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body;
|
|
62
66
|
// not locked, no need to unlock
|
|
63
|
-
if (!
|
|
67
|
+
if (!_classPrivateFieldGet(_locked, this).has(element)) return;
|
|
64
68
|
// reset style, in lock, some styled are setted
|
|
65
|
-
setStyle(element,
|
|
66
|
-
|
|
69
|
+
setStyle(element, _classPrivateFieldGet(_locked, this).get(element));
|
|
70
|
+
_classPrivateFieldGet(_locked, this)["delete"](element);
|
|
67
71
|
}
|
|
68
72
|
}]);
|
|
69
73
|
}();
|
|
@@ -75,7 +79,8 @@ var ScrollLocker = /*#__PURE__*/function () {
|
|
|
75
79
|
var _scrollLocker = {
|
|
76
80
|
_: null
|
|
77
81
|
};
|
|
78
|
-
var useScrollLocker = function useScrollLocker(
|
|
82
|
+
var useScrollLocker = function useScrollLocker() {
|
|
83
|
+
var isLock = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
79
84
|
useLayoutEffect(function () {
|
|
80
85
|
var scrollLocker = new ScrollLocker();
|
|
81
86
|
if (!!isLock) {
|
|
@@ -86,7 +91,7 @@ var useScrollLocker = function useScrollLocker(isLock) {
|
|
|
86
91
|
return function () {
|
|
87
92
|
scrollLocker.unlock(document.body);
|
|
88
93
|
};
|
|
89
|
-
}, [
|
|
94
|
+
}, [isLock]);
|
|
90
95
|
};
|
|
91
96
|
|
|
92
97
|
export { useScrollLocker };
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
3
|
+
import _createClass from '@babel/runtime/helpers/createClass';
|
|
4
|
+
import _classPrivateFieldInitSpec from '@babel/runtime/helpers/classPrivateFieldInitSpec';
|
|
5
|
+
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet2';
|
|
6
|
+
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet2';
|
|
2
7
|
import { useMemo, useCallback } from 'react';
|
|
3
8
|
import { useControlledState } from './use-controlled-state.js';
|
|
4
9
|
import { useEvent } from './use-event.js';
|
|
@@ -8,12 +13,12 @@ var Tree = /*#__PURE__*/function () {
|
|
|
8
13
|
function Tree() {
|
|
9
14
|
_classCallCheck(this, Tree);
|
|
10
15
|
_classPrivateFieldInitSpec(this, _groupedLeaves, void 0);
|
|
11
|
-
|
|
16
|
+
_classPrivateFieldSet(_groupedLeaves, this, new Map());
|
|
12
17
|
}
|
|
13
18
|
return _createClass(Tree, [{
|
|
14
19
|
key: "groupedLeaves",
|
|
15
20
|
get: function get() {
|
|
16
|
-
return
|
|
21
|
+
return _classPrivateFieldGet(_groupedLeaves, this);
|
|
17
22
|
}
|
|
18
23
|
}, {
|
|
19
24
|
key: "grow",
|
|
@@ -29,7 +34,7 @@ var Tree = /*#__PURE__*/function () {
|
|
|
29
34
|
}, {
|
|
30
35
|
key: "collect",
|
|
31
36
|
value: function collect(leaf) {
|
|
32
|
-
|
|
37
|
+
_classPrivateFieldGet(_groupedLeaves, this).has(leaf.key) ? _classPrivateFieldGet(_groupedLeaves, this).get(leaf.key).add(leaf) : _classPrivateFieldGet(_groupedLeaves, this).set(leaf.key, new Set([leaf]));
|
|
33
38
|
}
|
|
34
39
|
}, {
|
|
35
40
|
key: "toggle",
|
|
@@ -41,7 +46,7 @@ var Tree = /*#__PURE__*/function () {
|
|
|
41
46
|
}, {
|
|
42
47
|
key: "toggleBy",
|
|
43
48
|
value: function toggleBy(key, isToggled, _toggledKeys) {
|
|
44
|
-
var _classPrivateFieldGet2
|
|
49
|
+
var _classPrivateFieldGet2;
|
|
45
50
|
var toggledKeys = new Set(_toggledKeys);
|
|
46
51
|
// toggle current leaf
|
|
47
52
|
if (isToggled) {
|
|
@@ -49,7 +54,7 @@ var Tree = /*#__PURE__*/function () {
|
|
|
49
54
|
} else {
|
|
50
55
|
toggledKeys["delete"](key);
|
|
51
56
|
}
|
|
52
|
-
return Array.from((_classPrivateFieldGet2
|
|
57
|
+
return Array.from((_classPrivateFieldGet2 = _classPrivateFieldGet(_groupedLeaves, this).get(key)) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : []).reduce(function (prev, leaf) {
|
|
53
58
|
// deep fall, add or remove child key
|
|
54
59
|
return leaf.rise(
|
|
55
60
|
// deep rise, add or remove parent key
|
|
@@ -69,17 +74,17 @@ var Leaf = /*#__PURE__*/function () {
|
|
|
69
74
|
_classPrivateFieldInitSpec(this, _belongTo, void 0);
|
|
70
75
|
_classPrivateFieldInitSpec(this, _parent, void 0);
|
|
71
76
|
_classPrivateFieldInitSpec(this, _children, void 0);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
77
|
+
_classPrivateFieldSet(_key, this, props.key);
|
|
78
|
+
_classPrivateFieldSet(_parent, this, props.parent);
|
|
79
|
+
_classPrivateFieldSet(_belongTo, this, props.belongTo);
|
|
80
|
+
_classPrivateFieldSet(_children, this, []);
|
|
76
81
|
// when leaf has grew, let tree collect leaf
|
|
77
|
-
|
|
82
|
+
_classPrivateFieldGet(_belongTo, this).collect(this);
|
|
78
83
|
}
|
|
79
84
|
return _createClass(Leaf, [{
|
|
80
85
|
key: "key",
|
|
81
86
|
get: function get() {
|
|
82
|
-
return
|
|
87
|
+
return _classPrivateFieldGet(_key, this);
|
|
83
88
|
}
|
|
84
89
|
}, {
|
|
85
90
|
key: "grow",
|
|
@@ -91,9 +96,9 @@ var Leaf = /*#__PURE__*/function () {
|
|
|
91
96
|
var child = new Leaf({
|
|
92
97
|
key: node.key,
|
|
93
98
|
parent: _this,
|
|
94
|
-
belongTo:
|
|
99
|
+
belongTo: _classPrivateFieldGet(_belongTo, _this)
|
|
95
100
|
}).grow(node.children);
|
|
96
|
-
|
|
101
|
+
_classPrivateFieldGet(_children, _this).push(child);
|
|
97
102
|
});
|
|
98
103
|
return this;
|
|
99
104
|
}
|
|
@@ -101,22 +106,22 @@ var Leaf = /*#__PURE__*/function () {
|
|
|
101
106
|
key: "rise",
|
|
102
107
|
value: function rise(_toggledKeys) {
|
|
103
108
|
var rised = new Set(_toggledKeys);
|
|
104
|
-
if (!
|
|
105
|
-
var isChildrenToggled =
|
|
109
|
+
if (!_classPrivateFieldGet(_parent, this)) return rised;
|
|
110
|
+
var isChildrenToggled = _classPrivateFieldGet(_children, _classPrivateFieldGet(_parent, this)).every(function (child) {
|
|
106
111
|
return rised.has(child.key);
|
|
107
112
|
});
|
|
108
113
|
if (isChildrenToggled) {
|
|
109
|
-
rised.add(
|
|
114
|
+
rised.add(_classPrivateFieldGet(_parent, this).key);
|
|
110
115
|
} else {
|
|
111
|
-
rised["delete"](
|
|
116
|
+
rised["delete"](_classPrivateFieldGet(_parent, this).key);
|
|
112
117
|
}
|
|
113
118
|
// go on parent
|
|
114
|
-
return
|
|
119
|
+
return _classPrivateFieldGet(_parent, this).rise(rised);
|
|
115
120
|
}
|
|
116
121
|
}, {
|
|
117
122
|
key: "fall",
|
|
118
123
|
value: function fall(isToggled, toggledKeys) {
|
|
119
|
-
return
|
|
124
|
+
return _classPrivateFieldGet(_children, this).reduce(function (prev, leaf) {
|
|
120
125
|
// deep loop, remove or add key
|
|
121
126
|
var fell = leaf.fall(isToggled, prev);
|
|
122
127
|
// toggle true, add current leaf key
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export { useDevicePixelRatio } from "./hooks/use-device-pixel-ratio";
|
|
|
28
28
|
export { useIdentity } from "./hooks/use-identity";
|
|
29
29
|
export { useMediaQuery } from "./hooks/use-media-query";
|
|
30
30
|
export { useClickAway } from "./hooks/use-click-away";
|
|
31
|
+
export { useUnmount } from "./hooks/use-unmount";
|
|
31
32
|
/**
|
|
32
33
|
* @description
|
|
33
34
|
* is
|
package/dist/index.js
CHANGED
|
@@ -24,6 +24,7 @@ export { useDevicePixelRatio } from './hooks/use-device-pixel-ratio.js';
|
|
|
24
24
|
export { useIdentity } from './hooks/use-identity.js';
|
|
25
25
|
export { useMediaQuery } from './hooks/use-media-query.js';
|
|
26
26
|
export { useClickAway } from './hooks/use-click-away.js';
|
|
27
|
+
export { useUnmount } from './hooks/use-unmount.js';
|
|
27
28
|
export { isRefable } from './is/is-refable.js';
|
|
28
29
|
export { isUndefined } from './is/is-undefined.js';
|
|
29
30
|
export { isStateGetter } from './is/is-state-getter.js';
|
package/dist/is/is-complex.js
CHANGED
package/dist/is/is-dom-usable.js
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* if there is dom
|
|
4
4
|
*/
|
|
5
5
|
var isDomUsable = function isDomUsable() {
|
|
6
|
-
|
|
6
|
+
var _window$document;
|
|
7
|
+
return typeof window === "undefined" || !((_window$document = window.document) !== null && _window$document !== void 0 && _window$document.createElement);
|
|
7
8
|
};
|
|
8
9
|
|
|
9
10
|
export { isDomUsable };
|
package/dist/is/is-empty.js
CHANGED
package/dist/is/is-refable.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type Arrayable<T> = T | T[];
|
package/dist/utils/replace.js
CHANGED
package/dist/utils/set-style.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _construct from '@babel/runtime/helpers/construct';
|
|
2
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
3
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
2
4
|
|
|
3
5
|
/**
|
|
4
6
|
* @description
|
package/dist/utils/to-array.js
CHANGED
package/dist/utils/waitable.js
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
|
|
2
|
+
import _classCallCheck from '@babel/runtime/helpers/classCallCheck';
|
|
3
|
+
import _createClass from '@babel/runtime/helpers/createClass';
|
|
4
|
+
import _classPrivateMethodInitSpec from '@babel/runtime/helpers/classPrivateMethodInitSpec';
|
|
5
|
+
import _classPrivateFieldInitSpec from '@babel/runtime/helpers/classPrivateFieldInitSpec';
|
|
6
|
+
import _classPrivateFieldGet from '@babel/runtime/helpers/classPrivateFieldGet2';
|
|
7
|
+
import _assertClassBrand from '@babel/runtime/helpers/assertClassBrand';
|
|
8
|
+
import _classPrivateFieldSet from '@babel/runtime/helpers/classPrivateFieldSet2';
|
|
2
9
|
import { Observable, switchMap, from, of } from 'rxjs';
|
|
3
10
|
import { isThenable } from '../is/is-thenable.js';
|
|
4
11
|
|
|
@@ -22,11 +29,11 @@ var Waitable = /*#__PURE__*/function () {
|
|
|
22
29
|
_classPrivateFieldInitSpec(this, _timer, void 0);
|
|
23
30
|
_classPrivateFieldInitSpec(this, _pipe, void 0);
|
|
24
31
|
_classPrivateFieldInitSpec(this, _callback, void 0);
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
_classPrivateFieldSet(_cook$, this, null);
|
|
33
|
+
_classPrivateFieldSet(_waiter$, this, null);
|
|
34
|
+
_classPrivateFieldSet(_pipe, this, props.pipe);
|
|
35
|
+
_classPrivateFieldSet(_timer, this, props.timer);
|
|
36
|
+
_classPrivateFieldSet(_callback, this, props.callback);
|
|
30
37
|
_assertClassBrand(_Waitable_brand, this, _use).call(this);
|
|
31
38
|
}
|
|
32
39
|
return _createClass(Waitable, [{
|
|
@@ -40,8 +47,8 @@ var Waitable = /*#__PURE__*/function () {
|
|
|
40
47
|
* so it will make some async problems, pls attention
|
|
41
48
|
*/
|
|
42
49
|
function flush() {
|
|
43
|
-
var _classPrivateFieldGet2
|
|
44
|
-
(_classPrivateFieldGet2
|
|
50
|
+
var _classPrivateFieldGet2;
|
|
51
|
+
(_classPrivateFieldGet2 = _classPrivateFieldGet(_waiter$, this)) === null || _classPrivateFieldGet2 === void 0 || _classPrivateFieldGet2.complete();
|
|
45
52
|
_assertClassBrand(_Waitable_brand, this, _use).call(this);
|
|
46
53
|
}
|
|
47
54
|
/**
|
|
@@ -54,8 +61,8 @@ var Waitable = /*#__PURE__*/function () {
|
|
|
54
61
|
key: "abort",
|
|
55
62
|
value: function abort() {
|
|
56
63
|
var _classPrivateFieldGet3, _classPrivateFieldGet4;
|
|
57
|
-
(_classPrivateFieldGet3 =
|
|
58
|
-
(_classPrivateFieldGet4 =
|
|
64
|
+
(_classPrivateFieldGet3 = _classPrivateFieldGet(_cook$, this)) === null || _classPrivateFieldGet3 === void 0 || _classPrivateFieldGet3.unsubscribe();
|
|
65
|
+
(_classPrivateFieldGet4 = _classPrivateFieldGet(_waiter$, this)) === null || _classPrivateFieldGet4 === void 0 || _classPrivateFieldGet4.error();
|
|
59
66
|
_assertClassBrand(_Waitable_brand, this, _use).call(this);
|
|
60
67
|
}
|
|
61
68
|
/**
|
|
@@ -69,21 +76,21 @@ var Waitable = /*#__PURE__*/function () {
|
|
|
69
76
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
70
77
|
args[_key] = arguments[_key];
|
|
71
78
|
}
|
|
72
|
-
(_classPrivateFieldGet5 =
|
|
79
|
+
(_classPrivateFieldGet5 = _classPrivateFieldGet(_waiter$, this)) === null || _classPrivateFieldGet5 === void 0 || _classPrivateFieldGet5.next(args);
|
|
73
80
|
}
|
|
74
81
|
}]);
|
|
75
82
|
}();
|
|
76
83
|
function _use() {
|
|
77
84
|
var _this = this;
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}).pipe(
|
|
85
|
+
_classPrivateFieldSet(_cook$, this, new Observable(function (subscriber) {
|
|
86
|
+
_classPrivateFieldSet(_waiter$, _this, subscriber);
|
|
87
|
+
}).pipe(_classPrivateFieldGet(_timer, this), switchMap(function (args) {
|
|
81
88
|
var _classPrivateFieldGet6;
|
|
82
|
-
var piped = (_classPrivateFieldGet6 =
|
|
89
|
+
var piped = (_classPrivateFieldGet6 = _classPrivateFieldGet(_pipe, _this)).call.apply(_classPrivateFieldGet6, [_this].concat(_toConsumableArray(args)));
|
|
83
90
|
return isThenable(piped) ? from(piped) : of(piped);
|
|
84
91
|
})).subscribe(function (args) {
|
|
85
92
|
var _classPrivateFieldGet7;
|
|
86
|
-
(_classPrivateFieldGet7 =
|
|
93
|
+
(_classPrivateFieldGet7 = _classPrivateFieldGet(_callback, _this)) === null || _classPrivateFieldGet7 === void 0 || _classPrivateFieldGet7.call.apply(_classPrivateFieldGet7, [_this].concat(_toConsumableArray(args)));
|
|
87
94
|
}));
|
|
88
95
|
}
|
|
89
96
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiszlab/relax",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.65",
|
|
4
4
|
"description": "react utils collection",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -22,12 +22,15 @@
|
|
|
22
22
|
"test": "jest"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
+
"@babel/runtime": "^7.24.8",
|
|
25
26
|
"react-is": "^18.2.0",
|
|
26
27
|
"rxjs": "^7.8.1"
|
|
27
28
|
},
|
|
28
29
|
"devDependencies": {
|
|
29
30
|
"@babel/core": "^7.24.9",
|
|
31
|
+
"@babel/plugin-transform-runtime": "^7.24.7",
|
|
30
32
|
"@babel/preset-env": "^7.24.8",
|
|
33
|
+
"@babel/preset-react": "^7.24.7",
|
|
31
34
|
"@babel/preset-typescript": "^7.24.7",
|
|
32
35
|
"@jest/globals": "^29.7.0",
|
|
33
36
|
"@rollup/plugin-babel": "^6.0.4",
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
"jest-environment-jsdom": "^29.7.0",
|
|
42
45
|
"react": "18",
|
|
43
46
|
"react-dom": "18",
|
|
44
|
-
"rollup": "^4.
|
|
47
|
+
"rollup": "^4.19.0",
|
|
45
48
|
"typescript": "5.5.3"
|
|
46
49
|
},
|
|
47
50
|
"peerDependencies": {
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
function _arrayLikeToArray(r, a) {
|
|
2
|
-
(null == a || a > r.length) && (a = r.length);
|
|
3
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
4
|
-
return n;
|
|
5
|
-
}
|
|
6
|
-
function _arrayWithHoles(r) {
|
|
7
|
-
if (Array.isArray(r)) return r;
|
|
8
|
-
}
|
|
9
|
-
function _arrayWithoutHoles(r) {
|
|
10
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
11
|
-
}
|
|
12
|
-
function _assertClassBrand(e, t, n) {
|
|
13
|
-
if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
|
|
14
|
-
throw new TypeError("Private element is not present on this object");
|
|
15
|
-
}
|
|
16
|
-
function _checkPrivateRedeclaration(e, t) {
|
|
17
|
-
if (t.has(e)) throw new TypeError("Cannot initialize the same private elements twice on an object");
|
|
18
|
-
}
|
|
19
|
-
function _classCallCheck(a, n) {
|
|
20
|
-
if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function");
|
|
21
|
-
}
|
|
22
|
-
function _classPrivateFieldGet2(s, a) {
|
|
23
|
-
return s.get(_assertClassBrand(s, a));
|
|
24
|
-
}
|
|
25
|
-
function _classPrivateFieldInitSpec(e, t, a) {
|
|
26
|
-
_checkPrivateRedeclaration(e, t), t.set(e, a);
|
|
27
|
-
}
|
|
28
|
-
function _classPrivateFieldSet2(s, a, r) {
|
|
29
|
-
return s.set(_assertClassBrand(s, a), r), r;
|
|
30
|
-
}
|
|
31
|
-
function _classPrivateMethodInitSpec(e, a) {
|
|
32
|
-
_checkPrivateRedeclaration(e, a), a.add(e);
|
|
33
|
-
}
|
|
34
|
-
function _construct(t, e, r) {
|
|
35
|
-
if (_isNativeReflectConstruct()) return Reflect.construct.apply(null, arguments);
|
|
36
|
-
var o = [null];
|
|
37
|
-
o.push.apply(o, e);
|
|
38
|
-
var p = new (t.bind.apply(t, o))();
|
|
39
|
-
return p;
|
|
40
|
-
}
|
|
41
|
-
function _defineProperties(e, r) {
|
|
42
|
-
for (var t = 0; t < r.length; t++) {
|
|
43
|
-
var o = r[t];
|
|
44
|
-
o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function _createClass(e, r, t) {
|
|
48
|
-
return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", {
|
|
49
|
-
writable: !1
|
|
50
|
-
}), e;
|
|
51
|
-
}
|
|
52
|
-
function _isNativeReflectConstruct() {
|
|
53
|
-
try {
|
|
54
|
-
var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
|
|
55
|
-
} catch (t) {}
|
|
56
|
-
return (_isNativeReflectConstruct = function () {
|
|
57
|
-
return !!t;
|
|
58
|
-
})();
|
|
59
|
-
}
|
|
60
|
-
function _iterableToArray(r) {
|
|
61
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
62
|
-
}
|
|
63
|
-
function _iterableToArrayLimit(r, l) {
|
|
64
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
65
|
-
if (null != t) {
|
|
66
|
-
var e,
|
|
67
|
-
n,
|
|
68
|
-
i,
|
|
69
|
-
u,
|
|
70
|
-
a = [],
|
|
71
|
-
f = !0,
|
|
72
|
-
o = !1;
|
|
73
|
-
try {
|
|
74
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
75
|
-
if (Object(t) !== t) return;
|
|
76
|
-
f = !1;
|
|
77
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
78
|
-
} catch (r) {
|
|
79
|
-
o = !0, n = r;
|
|
80
|
-
} finally {
|
|
81
|
-
try {
|
|
82
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
83
|
-
} finally {
|
|
84
|
-
if (o) throw n;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return a;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
function _nonIterableRest() {
|
|
91
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
92
|
-
}
|
|
93
|
-
function _nonIterableSpread() {
|
|
94
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
95
|
-
}
|
|
96
|
-
function _slicedToArray(r, e) {
|
|
97
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
98
|
-
}
|
|
99
|
-
function _toConsumableArray(r) {
|
|
100
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
101
|
-
}
|
|
102
|
-
function _toPrimitive(t, r) {
|
|
103
|
-
if ("object" != typeof t || !t) return t;
|
|
104
|
-
var e = t[Symbol.toPrimitive];
|
|
105
|
-
if (void 0 !== e) {
|
|
106
|
-
var i = e.call(t, r );
|
|
107
|
-
if ("object" != typeof i) return i;
|
|
108
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
109
|
-
}
|
|
110
|
-
return (String )(t);
|
|
111
|
-
}
|
|
112
|
-
function _toPropertyKey(t) {
|
|
113
|
-
var i = _toPrimitive(t, "string");
|
|
114
|
-
return "symbol" == typeof i ? i : i + "";
|
|
115
|
-
}
|
|
116
|
-
function _typeof(o) {
|
|
117
|
-
"@babel/helpers - typeof";
|
|
118
|
-
|
|
119
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
120
|
-
return typeof o;
|
|
121
|
-
} : function (o) {
|
|
122
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
123
|
-
}, _typeof(o);
|
|
124
|
-
}
|
|
125
|
-
function _unsupportedIterableToArray(r, a) {
|
|
126
|
-
if (r) {
|
|
127
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
128
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
129
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export { _arrayLikeToArray as arrayLikeToArray, _arrayWithHoles as arrayWithHoles, _arrayWithoutHoles as arrayWithoutHoles, _assertClassBrand as assertClassBrand, _checkPrivateRedeclaration as checkPrivateRedeclaration, _classCallCheck as classCallCheck, _classPrivateFieldGet2 as classPrivateFieldGet2, _classPrivateFieldInitSpec as classPrivateFieldInitSpec, _classPrivateFieldSet2 as classPrivateFieldSet2, _classPrivateMethodInitSpec as classPrivateMethodInitSpec, _construct as construct, _createClass as createClass, _isNativeReflectConstruct as isNativeReflectConstruct, _iterableToArray as iterableToArray, _iterableToArrayLimit as iterableToArrayLimit, _nonIterableRest as nonIterableRest, _nonIterableSpread as nonIterableSpread, _slicedToArray as slicedToArray, _toConsumableArray as toConsumableArray, _toPrimitive as toPrimitive, _toPropertyKey as toPropertyKey, _typeof as typeof, _unsupportedIterableToArray as unsupportedIterableToArray };
|