@aiszlab/relax 1.2.56 → 1.2.57
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/package.json +5 -5
- package/dist/__test__/hooks/use-boolean.test.d.ts +0 -4
- package/dist/__test__/hooks/use-identity.test.d.ts +0 -4
- package/dist/__test__/hooks/use-mount.test.d.ts +0 -4
- package/dist/__test__/hooks/use-mounted.test.d.ts +0 -4
- package/dist/__test__/hooks/use-timeout.test.d.ts +0 -4
- package/dist/__test__/hooks/use-togglable.test.d.ts +0 -4
- package/dist/__test__/is/is-null.test.d.ts +0 -1
- package/dist/__test__/is/is-thenable.test.d.ts +0 -1
- package/dist/__test__/utils/chain.test.d.ts +0 -1
- package/dist/__test__/utils/clamp.test.d.ts +0 -1
- package/dist/__test__/utils/clone.test.d.ts +0 -1
- package/dist/__test__/utils/debounce.test.d.ts +0 -1
- package/dist/__test__/utils/effect.test.d.ts +0 -1
- package/dist/__test__/utils/exclude.test.d.ts +0 -1
- package/dist/__test__/utils/throttle.test.d.ts +0 -1
- package/dist/__test__/utils/to-array.test.d.ts +0 -1
- package/dist/__test__/utils/to-form-data.test.d.ts +0 -1
- package/dist/_virtual/_rollupPluginBabelHelpers.js +0 -138
- package/dist/dom/contains.d.ts +0 -1
- package/dist/dom/contains.js +0 -20
- package/dist/dom/index.d.ts +0 -3
- package/dist/dom/index.js +0 -2
- package/dist/dom/scroll-to.d.ts +0 -19
- package/dist/dom/scroll-to.js +0 -69
- package/dist/hooks/use-boolean.d.ts +0 -19
- package/dist/hooks/use-boolean.js +0 -34
- package/dist/hooks/use-controlled-state.d.ts +0 -17
- package/dist/hooks/use-controlled-state.js +0 -40
- package/dist/hooks/use-counter.d.ts +0 -33
- package/dist/hooks/use-counter.js +0 -59
- package/dist/hooks/use-debounce-callback.d.ts +0 -18
- package/dist/hooks/use-debounce-callback.js +0 -81
- package/dist/hooks/use-default.d.ts +0 -8
- package/dist/hooks/use-default.js +0 -14
- package/dist/hooks/use-device-pixel-ratio.d.ts +0 -6
- package/dist/hooks/use-device-pixel-ratio.js +0 -20
- package/dist/hooks/use-event.d.ts +0 -2
- package/dist/hooks/use-event.js +0 -12
- package/dist/hooks/use-focus.d.ts +0 -15
- package/dist/hooks/use-focus.js +0 -31
- package/dist/hooks/use-force-update.d.ts +0 -7
- package/dist/hooks/use-force-update.js +0 -21
- package/dist/hooks/use-hover.d.ts +0 -8
- package/dist/hooks/use-hover.js +0 -25
- package/dist/hooks/use-identity.d.ts +0 -5
- package/dist/hooks/use-identity.js +0 -20
- package/dist/hooks/use-image-loader.d.ts +0 -12
- package/dist/hooks/use-image-loader.js +0 -54
- package/dist/hooks/use-media-query.d.ts +0 -7
- package/dist/hooks/use-memorable.d.ts +0 -1
- package/dist/hooks/use-memorable.js +0 -14
- package/dist/hooks/use-mount.d.ts +0 -8
- package/dist/hooks/use-mount.js +0 -16
- package/dist/hooks/use-mounted.d.ts +0 -8
- package/dist/hooks/use-mounted.js +0 -16
- package/dist/hooks/use-mutate-observer.d.ts +0 -1
- package/dist/hooks/use-mutate-observer.js +0 -28
- package/dist/hooks/use-raf.d.ts +0 -7
- package/dist/hooks/use-raf.js +0 -26
- package/dist/hooks/use-reactive.d.ts +0 -6
- package/dist/hooks/use-refs.d.ts +0 -5
- package/dist/hooks/use-refs.js +0 -31
- package/dist/hooks/use-scroll-locker.d.ts +0 -5
- package/dist/hooks/use-scroll-locker.js +0 -92
- package/dist/hooks/use-scrollable.d.ts +0 -17
- package/dist/hooks/use-scrollable.js +0 -43
- package/dist/hooks/use-throttle-callback.d.ts +0 -18
- package/dist/hooks/use-throttle-callback.js +0 -83
- package/dist/hooks/use-timeout.d.ts +0 -10
- package/dist/hooks/use-timeout.js +0 -68
- package/dist/hooks/use-togglable.d.ts +0 -48
- package/dist/hooks/use-togglable.js +0 -177
- package/dist/hooks/use-toggleable.d.ts +0 -48
- package/dist/hooks/use-toggleable.js +0 -187
- package/dist/hooks/use-update-effect.d.ts +0 -3
- package/dist/hooks/use-update-effect.js +0 -19
- package/dist/index.d.ts +0 -61
- package/dist/index.js +0 -49
- package/dist/is/is-array.d.ts +0 -5
- package/dist/is/is-array.js +0 -9
- package/dist/is/is-complex.d.ts +0 -5
- package/dist/is/is-complex.js +0 -11
- package/dist/is/is-dom-usable.d.ts +0 -5
- package/dist/is/is-dom-usable.js +0 -9
- package/dist/is/is-empty.d.ts +0 -7
- package/dist/is/is-empty.js +0 -25
- package/dist/is/is-function.d.ts +0 -5
- package/dist/is/is-function.js +0 -9
- package/dist/is/is-mobile.d.ts +0 -5
- package/dist/is/is-mobile.js +0 -13
- package/dist/is/is-null.d.ts +0 -5
- package/dist/is/is-null.js +0 -9
- package/dist/is/is-overflow.d.ts +0 -5
- package/dist/is/is-overflow.js +0 -14
- package/dist/is/is-pointer-usable.d.ts +0 -5
- package/dist/is/is-primitive.d.ts +0 -5
- package/dist/is/is-refable.d.ts +0 -5
- package/dist/is/is-refable.js +0 -34
- package/dist/is/is-state-getter.d.ts +0 -6
- package/dist/is/is-state-getter.js +0 -9
- package/dist/is/is-style-element.d.ts +0 -5
- package/dist/is/is-style-element.js +0 -9
- package/dist/is/is-thenable.d.ts +0 -5
- package/dist/is/is-thenable.js +0 -9
- package/dist/is/is-undefined.d.ts +0 -5
- package/dist/is/is-undefined.js +0 -9
- package/dist/is/is-void.d.ts +0 -5
- package/dist/is/is-void.js +0 -12
- package/dist/types/first.d.ts +0 -1
- package/dist/types/index.d.ts +0 -8
- package/dist/types/last.d.ts +0 -1
- package/dist/types/nullable.d.ts +0 -5
- package/dist/types/partialable.d.ts +0 -5
- package/dist/types/required-in.d.ts +0 -5
- package/dist/types/state.d.ts +0 -10
- package/dist/types/thenable-effect-callback.d.ts +0 -6
- package/dist/types/voidable.d.ts +0 -7
- package/dist/utils/chain.d.ts +0 -2
- package/dist/utils/chain.js +0 -15
- package/dist/utils/clamp.d.ts +0 -9
- package/dist/utils/clamp.js +0 -13
- package/dist/utils/clone.d.ts +0 -6
- package/dist/utils/debounce.d.ts +0 -23
- package/dist/utils/debounce.js +0 -32
- package/dist/utils/effect.d.ts +0 -7
- package/dist/utils/effect.js +0 -16
- package/dist/utils/exclude.d.ts +0 -10
- package/dist/utils/exclude.js +0 -18
- package/dist/utils/range.d.ts +0 -7
- package/dist/utils/range.js +0 -16
- package/dist/utils/set-style.d.ts +0 -6
- package/dist/utils/set-style.js +0 -21
- package/dist/utils/throttle.d.ts +0 -5
- package/dist/utils/throttle.js +0 -32
- package/dist/utils/to-array.d.ts +0 -18
- package/dist/utils/to-array.js +0 -25
- package/dist/utils/to-form-data.d.ts +0 -5
- package/dist/utils/to-form-data.js +0 -27
- package/dist/utils/to-function.d.ts +0 -1
- package/dist/utils/to-function.js +0 -13
- package/dist/utils/unique.d.ts +0 -10
- package/dist/utils/unique.js +0 -16
- package/dist/utils/waitable.d.ts +0 -36
- package/dist/utils/waitable.js +0 -90
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { objectWithoutProperties as _objectWithoutProperties, slicedToArray as _slicedToArray, createClass as _createClass, classPrivateFieldGet2 as _classPrivateFieldGet2, classCallCheck as _classCallCheck, classPrivateFieldInitSpec as _classPrivateFieldInitSpec, classPrivateFieldSet2 as _classPrivateFieldSet2 } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import { useMemo, useCallback } from 'react';
|
|
3
|
-
import { useControlledState } from './use-controlled-state.js';
|
|
4
|
-
import { useEvent } from './use-event.js';
|
|
5
|
-
|
|
6
|
-
var _excluded = ["onToggle"];
|
|
7
|
-
var _groupedLeaves = /*#__PURE__*/new WeakMap();
|
|
8
|
-
var Tree = /*#__PURE__*/function () {
|
|
9
|
-
function Tree() {
|
|
10
|
-
_classCallCheck(this, Tree);
|
|
11
|
-
_classPrivateFieldInitSpec(this, _groupedLeaves, void 0);
|
|
12
|
-
_classPrivateFieldSet2(_groupedLeaves, this, new Map());
|
|
13
|
-
}
|
|
14
|
-
return _createClass(Tree, [{
|
|
15
|
-
key: "groupedLeaves",
|
|
16
|
-
get: function get() {
|
|
17
|
-
return _classPrivateFieldGet2(_groupedLeaves, this);
|
|
18
|
-
}
|
|
19
|
-
}, {
|
|
20
|
-
key: "grow",
|
|
21
|
-
value: function grow(togglableKey) {
|
|
22
|
-
// create leaf, leaf will auto trigger tree collect callback
|
|
23
|
-
new Leaf({
|
|
24
|
-
key: togglableKey.key,
|
|
25
|
-
parent: null,
|
|
26
|
-
belongTo: this
|
|
27
|
-
}).grow(togglableKey.children);
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
}, {
|
|
31
|
-
key: "collect",
|
|
32
|
-
value: function collect(leaf) {
|
|
33
|
-
_classPrivateFieldGet2(_groupedLeaves, this).has(leaf.key) ? _classPrivateFieldGet2(_groupedLeaves, this).get(leaf.key).add(leaf) : _classPrivateFieldGet2(_groupedLeaves, this).set(leaf.key, new Set([leaf]));
|
|
34
|
-
}
|
|
35
|
-
}, {
|
|
36
|
-
key: "toggle",
|
|
37
|
-
value: function toggle(key, toggledKeys) {
|
|
38
|
-
var hasToggled = toggledKeys.has(key);
|
|
39
|
-
var isToggled = !hasToggled;
|
|
40
|
-
return this.toggleBy(key, isToggled, toggledKeys);
|
|
41
|
-
}
|
|
42
|
-
}, {
|
|
43
|
-
key: "toggleBy",
|
|
44
|
-
value: function toggleBy(key, isToggled, toggledKeys) {
|
|
45
|
-
var _classPrivateFieldGet2$1;
|
|
46
|
-
debugger;
|
|
47
|
-
return Array.from((_classPrivateFieldGet2$1 = _classPrivateFieldGet2(_groupedLeaves, this).get(key)) !== null && _classPrivateFieldGet2$1 !== void 0 ? _classPrivateFieldGet2$1 : []).reduce(function (prev, leaf) {
|
|
48
|
-
// deep fall, add or remove child key
|
|
49
|
-
var fell = leaf.fall(isToggled, prev);
|
|
50
|
-
// deep rise, add or remove parent key
|
|
51
|
-
var rised = leaf.rise(fell);
|
|
52
|
-
return rised;
|
|
53
|
-
}, new Set(toggledKeys));
|
|
54
|
-
}
|
|
55
|
-
}]);
|
|
56
|
-
}();
|
|
57
|
-
var _key = /*#__PURE__*/new WeakMap();
|
|
58
|
-
var _belongTo = /*#__PURE__*/new WeakMap();
|
|
59
|
-
var _parent = /*#__PURE__*/new WeakMap();
|
|
60
|
-
var _children = /*#__PURE__*/new WeakMap();
|
|
61
|
-
var Leaf = /*#__PURE__*/function () {
|
|
62
|
-
function Leaf(props) {
|
|
63
|
-
_classCallCheck(this, Leaf);
|
|
64
|
-
_classPrivateFieldInitSpec(this, _key, void 0);
|
|
65
|
-
_classPrivateFieldInitSpec(this, _belongTo, void 0);
|
|
66
|
-
_classPrivateFieldInitSpec(this, _parent, void 0);
|
|
67
|
-
_classPrivateFieldInitSpec(this, _children, void 0);
|
|
68
|
-
_classPrivateFieldSet2(_key, this, props.key);
|
|
69
|
-
_classPrivateFieldSet2(_parent, this, props.parent);
|
|
70
|
-
_classPrivateFieldSet2(_belongTo, this, props.belongTo);
|
|
71
|
-
_classPrivateFieldSet2(_children, this, []);
|
|
72
|
-
// when leaf has grew, let tree collect leaf
|
|
73
|
-
_classPrivateFieldGet2(_belongTo, this).collect(this);
|
|
74
|
-
}
|
|
75
|
-
return _createClass(Leaf, [{
|
|
76
|
-
key: "key",
|
|
77
|
-
get: function get() {
|
|
78
|
-
return _classPrivateFieldGet2(_key, this);
|
|
79
|
-
}
|
|
80
|
-
}, {
|
|
81
|
-
key: "grow",
|
|
82
|
-
value: function grow() {
|
|
83
|
-
var _this = this;
|
|
84
|
-
var children = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
85
|
-
if (children.length === 0) return this;
|
|
86
|
-
children.forEach(function (node) {
|
|
87
|
-
var child = new Leaf({
|
|
88
|
-
key: node.key,
|
|
89
|
-
parent: _this,
|
|
90
|
-
belongTo: _classPrivateFieldGet2(_belongTo, _this)
|
|
91
|
-
}).grow(node.children);
|
|
92
|
-
_classPrivateFieldGet2(_children, _this).push(child);
|
|
93
|
-
});
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
}, {
|
|
97
|
-
key: "rise",
|
|
98
|
-
value: function rise(toggledKeys) {
|
|
99
|
-
// if current key is toggled or children is all toggled
|
|
100
|
-
// just add current key into toggled keys
|
|
101
|
-
// else remove current key
|
|
102
|
-
var isToggled = toggledKeys.has(_classPrivateFieldGet2(_key, this)) || _classPrivateFieldGet2(_children, this).every(function (child) {
|
|
103
|
-
return toggledKeys.has(child.key);
|
|
104
|
-
});
|
|
105
|
-
var rised = new Set(toggledKeys);
|
|
106
|
-
if (isToggled) {
|
|
107
|
-
rised.add(_classPrivateFieldGet2(_key, this));
|
|
108
|
-
} else {
|
|
109
|
-
rised["delete"](_classPrivateFieldGet2(_key, this));
|
|
110
|
-
}
|
|
111
|
-
if (_classPrivateFieldGet2(_parent, this)) {
|
|
112
|
-
return _classPrivateFieldGet2(_parent, this).rise(rised);
|
|
113
|
-
}
|
|
114
|
-
return rised;
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
key: "fall",
|
|
118
|
-
value: function fall(isToggled, toggledKeys) {
|
|
119
|
-
var _this2 = this;
|
|
120
|
-
return _classPrivateFieldGet2(_children, this).reduce(function (prev, leaf) {
|
|
121
|
-
// deep loop, remove or add key
|
|
122
|
-
var fell = leaf.fall(isToggled, prev);
|
|
123
|
-
// toggle true, add key
|
|
124
|
-
// toggle false, remove key
|
|
125
|
-
if (isToggled) {
|
|
126
|
-
fell.add(_classPrivateFieldGet2(_key, _this2));
|
|
127
|
-
} else {
|
|
128
|
-
fell["delete"](_classPrivateFieldGet2(_key, _this2));
|
|
129
|
-
}
|
|
130
|
-
return fell;
|
|
131
|
-
}, new Set(toggledKeys));
|
|
132
|
-
}
|
|
133
|
-
}]);
|
|
134
|
-
}();
|
|
135
|
-
/**
|
|
136
|
-
* @description
|
|
137
|
-
* toggle able
|
|
138
|
-
*/
|
|
139
|
-
var useTogglable = function useTogglable(togglableKeys) {
|
|
140
|
-
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
141
|
-
onToggle = _ref.onToggle,
|
|
142
|
-
options = _objectWithoutProperties(_ref, _excluded);
|
|
143
|
-
/// re-create tree when togglable keys changed
|
|
144
|
-
var tree = useMemo(function () {
|
|
145
|
-
return togglableKeys.reduce(function (_tree, togglable) {
|
|
146
|
-
return _tree.grow(togglable);
|
|
147
|
-
}, new Tree());
|
|
148
|
-
}, [togglableKeys]);
|
|
149
|
-
/// use controlled state to record toggled keys
|
|
150
|
-
var _useControlledState = useControlledState(options.toggledKeys, {
|
|
151
|
-
defaultState: function defaultState() {
|
|
152
|
-
return options.isDefaultToggled ? Array.from(Array.from(tree.groupedLeaves.values()).reduce(function (prev, leaves) {
|
|
153
|
-
leaves.forEach(function (leaf) {
|
|
154
|
-
return prev.add(leaf.key);
|
|
155
|
-
});
|
|
156
|
-
return prev;
|
|
157
|
-
}, new Set())) : [];
|
|
158
|
-
}
|
|
159
|
-
}),
|
|
160
|
-
_useControlledState2 = _slicedToArray(_useControlledState, 2),
|
|
161
|
-
_toggledKeys = _useControlledState2[0],
|
|
162
|
-
_setToggledKeys = _useControlledState2[1];
|
|
163
|
-
/// use set for toggled keys to make it read-only
|
|
164
|
-
var readableToggledKeys = useMemo(function () {
|
|
165
|
-
return new Set(_toggledKeys);
|
|
166
|
-
}, [_toggledKeys]);
|
|
167
|
-
/// check current key is toggled
|
|
168
|
-
var isToggled = useCallback(function (key) {
|
|
169
|
-
return !readableToggledKeys || readableToggledKeys.has(key);
|
|
170
|
-
}, [readableToggledKeys]);
|
|
171
|
-
/// toggle one key
|
|
172
|
-
var toggle = useEvent(function (key) {
|
|
173
|
-
// get new toggled keys by toggle current key
|
|
174
|
-
var _toggledKeys = Array.from(tree.toggle(key, readableToggledKeys));
|
|
175
|
-
// set state
|
|
176
|
-
_setToggledKeys(_toggledKeys);
|
|
177
|
-
// trigger on toggle callback
|
|
178
|
-
onToggle === null || onToggle === void 0 || onToggle(_toggledKeys);
|
|
179
|
-
});
|
|
180
|
-
return {
|
|
181
|
-
toggledKeys: readableToggledKeys,
|
|
182
|
-
isToggled: isToggled,
|
|
183
|
-
toggle: toggle
|
|
184
|
-
};
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
export { useTogglable };
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useRef, useEffect } from 'react';
|
|
2
|
-
import { useMounted } from './use-mounted.js';
|
|
3
|
-
import { effect } from '../utils/effect.js';
|
|
4
|
-
|
|
5
|
-
var useUpdateEffect = function useUpdateEffect(callback, deps) {
|
|
6
|
-
var isMounted = useRef(false);
|
|
7
|
-
useEffect(function () {
|
|
8
|
-
if (!isMounted.current) return;
|
|
9
|
-
return effect(callback);
|
|
10
|
-
}, deps);
|
|
11
|
-
useMounted(function () {
|
|
12
|
-
isMounted.current = true;
|
|
13
|
-
return function () {
|
|
14
|
-
isMounted.current = false;
|
|
15
|
-
};
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { useUpdateEffect };
|
package/dist/index.d.ts
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* hooks
|
|
4
|
-
*/
|
|
5
|
-
export { useBoolean } from './hooks/use-boolean';
|
|
6
|
-
export { useDebounceCallback } from './hooks/use-debounce-callback';
|
|
7
|
-
export { useThrottleCallback } from './hooks/use-throttle-callback';
|
|
8
|
-
export { useImageLoader } from './hooks/use-image-loader';
|
|
9
|
-
export { useMount } from './hooks/use-mount';
|
|
10
|
-
export { useMounted } from './hooks/use-mounted';
|
|
11
|
-
export { useTimeout } from './hooks/use-timeout';
|
|
12
|
-
export { useControlledState } from './hooks/use-controlled-state';
|
|
13
|
-
export { useDefault } from './hooks/use-default';
|
|
14
|
-
export { useScrollLocker } from './hooks/use-scroll-locker';
|
|
15
|
-
export { useForceUpdate } from './hooks/use-force-update';
|
|
16
|
-
export { useScrollable } from './hooks/use-scrollable';
|
|
17
|
-
export { useRefs } from './hooks/use-refs';
|
|
18
|
-
export { useTogglable } from './hooks/use-togglable';
|
|
19
|
-
export { useEvent } from './hooks/use-event';
|
|
20
|
-
export { useUpdateEffect } from './hooks/use-update-effect';
|
|
21
|
-
export { useCounter } from './hooks/use-counter';
|
|
22
|
-
export { useHover } from './hooks/use-hover';
|
|
23
|
-
export { useFocus } from './hooks/use-focus';
|
|
24
|
-
export { useMemorable } from './hooks/use-memorable';
|
|
25
|
-
export { useMutateObserver } from './hooks/use-mutate-observer';
|
|
26
|
-
export { useRaf } from './hooks/use-raf';
|
|
27
|
-
export { useDevicePixelRatio } from './hooks/use-device-pixel-ratio';
|
|
28
|
-
export { useIdentity } from './hooks/use-identity';
|
|
29
|
-
/**
|
|
30
|
-
* @description
|
|
31
|
-
* is
|
|
32
|
-
*/
|
|
33
|
-
export { isRefable } from './is/is-refable';
|
|
34
|
-
export { isUndefined } from './is/is-undefined';
|
|
35
|
-
export { isStateGetter } from './is/is-state-getter';
|
|
36
|
-
export { isNull } from './is/is-null';
|
|
37
|
-
export { isVoid } from './is/is-void';
|
|
38
|
-
export { isArray } from './is/is-array';
|
|
39
|
-
export { isComplex } from './is/is-complex';
|
|
40
|
-
export { isEmpty } from './is/is-empty';
|
|
41
|
-
export { isDomUsable } from './is/is-dom-usable';
|
|
42
|
-
export { isMobile } from './is/is-mobile';
|
|
43
|
-
export { isOverflow } from './is/is-overflow';
|
|
44
|
-
export { isStyleElement } from './is/is-style-element';
|
|
45
|
-
export { isFunction } from './is/is-function';
|
|
46
|
-
export { isThenable } from './is/is-thenable';
|
|
47
|
-
/**
|
|
48
|
-
* @description
|
|
49
|
-
* utils
|
|
50
|
-
*/
|
|
51
|
-
export { effect } from './utils/effect';
|
|
52
|
-
export { unique, uniqueBy } from './utils/unique';
|
|
53
|
-
export { range } from './utils/range';
|
|
54
|
-
export { clamp } from './utils/clamp';
|
|
55
|
-
export { chain } from './utils/chain';
|
|
56
|
-
export { debounce } from './utils/debounce';
|
|
57
|
-
export { toArray } from './utils/to-array';
|
|
58
|
-
export { toFunction } from './utils/to-function';
|
|
59
|
-
export { exclude } from './utils/exclude';
|
|
60
|
-
export { toFormData } from './utils/to-form-data';
|
|
61
|
-
export { setStyle } from './utils/set-style';
|
package/dist/index.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export { useBoolean } from './hooks/use-boolean.js';
|
|
2
|
-
export { useDebounceCallback } from './hooks/use-debounce-callback.js';
|
|
3
|
-
export { useThrottleCallback } from './hooks/use-throttle-callback.js';
|
|
4
|
-
export { useImageLoader } from './hooks/use-image-loader.js';
|
|
5
|
-
export { useMount } from './hooks/use-mount.js';
|
|
6
|
-
export { useMounted } from './hooks/use-mounted.js';
|
|
7
|
-
export { useTimeout } from './hooks/use-timeout.js';
|
|
8
|
-
export { useControlledState } from './hooks/use-controlled-state.js';
|
|
9
|
-
export { useDefault } from './hooks/use-default.js';
|
|
10
|
-
export { useScrollLocker } from './hooks/use-scroll-locker.js';
|
|
11
|
-
export { useForceUpdate } from './hooks/use-force-update.js';
|
|
12
|
-
export { useScrollable } from './hooks/use-scrollable.js';
|
|
13
|
-
export { useRefs } from './hooks/use-refs.js';
|
|
14
|
-
export { useTogglable } from './hooks/use-togglable.js';
|
|
15
|
-
export { useEvent } from './hooks/use-event.js';
|
|
16
|
-
export { useUpdateEffect } from './hooks/use-update-effect.js';
|
|
17
|
-
export { useCounter } from './hooks/use-counter.js';
|
|
18
|
-
export { useHover } from './hooks/use-hover.js';
|
|
19
|
-
export { useFocus } from './hooks/use-focus.js';
|
|
20
|
-
export { useMemorable } from './hooks/use-memorable.js';
|
|
21
|
-
export { useMutateObserver } from './hooks/use-mutate-observer.js';
|
|
22
|
-
export { useRaf } from './hooks/use-raf.js';
|
|
23
|
-
export { useDevicePixelRatio } from './hooks/use-device-pixel-ratio.js';
|
|
24
|
-
export { useIdentity } from './hooks/use-identity.js';
|
|
25
|
-
export { isRefable } from './is/is-refable.js';
|
|
26
|
-
export { isUndefined } from './is/is-undefined.js';
|
|
27
|
-
export { isStateGetter } from './is/is-state-getter.js';
|
|
28
|
-
export { isNull } from './is/is-null.js';
|
|
29
|
-
export { isVoid } from './is/is-void.js';
|
|
30
|
-
export { isArray } from './is/is-array.js';
|
|
31
|
-
export { isComplex } from './is/is-complex.js';
|
|
32
|
-
export { isEmpty } from './is/is-empty.js';
|
|
33
|
-
export { isDomUsable } from './is/is-dom-usable.js';
|
|
34
|
-
export { isMobile } from './is/is-mobile.js';
|
|
35
|
-
export { isOverflow } from './is/is-overflow.js';
|
|
36
|
-
export { isStyleElement } from './is/is-style-element.js';
|
|
37
|
-
export { isFunction } from './is/is-function.js';
|
|
38
|
-
export { isThenable } from './is/is-thenable.js';
|
|
39
|
-
export { effect } from './utils/effect.js';
|
|
40
|
-
export { unique, uniqueBy } from './utils/unique.js';
|
|
41
|
-
export { range } from './utils/range.js';
|
|
42
|
-
export { clamp } from './utils/clamp.js';
|
|
43
|
-
export { chain } from './utils/chain.js';
|
|
44
|
-
export { debounce } from './utils/debounce.js';
|
|
45
|
-
export { toArray } from './utils/to-array.js';
|
|
46
|
-
export { toFunction } from './utils/to-function.js';
|
|
47
|
-
export { exclude } from './utils/exclude.js';
|
|
48
|
-
export { toFormData } from './utils/to-form-data.js';
|
|
49
|
-
export { setStyle } from './utils/set-style.js';
|
package/dist/is/is-array.d.ts
DELETED
package/dist/is/is-array.js
DELETED
package/dist/is/is-complex.d.ts
DELETED
package/dist/is/is-complex.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { typeof as _typeof } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @description
|
|
5
|
-
* complex
|
|
6
|
-
*/
|
|
7
|
-
var isComplex = function isComplex(value) {
|
|
8
|
-
return _typeof(value) === 'object' || typeof value === 'function';
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { isComplex };
|
package/dist/is/is-dom-usable.js
DELETED
package/dist/is/is-empty.d.ts
DELETED
package/dist/is/is-empty.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { typeof as _typeof } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
2
|
-
import { isVoid } from './is-void.js';
|
|
3
|
-
import { isArray } from './is-array.js';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* @author murukal
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* is empty
|
|
10
|
-
*/
|
|
11
|
-
var isEmpty = function isEmpty(value) {
|
|
12
|
-
// null or undefined
|
|
13
|
-
if (isVoid(value)) return true;
|
|
14
|
-
// object
|
|
15
|
-
if (_typeof(value) === 'object') {
|
|
16
|
-
return Object.keys(value).length === 0;
|
|
17
|
-
}
|
|
18
|
-
// array
|
|
19
|
-
if (isArray(value)) {
|
|
20
|
-
return value.length === 0;
|
|
21
|
-
}
|
|
22
|
-
return !!value;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { isEmpty };
|
package/dist/is/is-function.d.ts
DELETED
package/dist/is/is-function.js
DELETED
package/dist/is/is-mobile.d.ts
DELETED
package/dist/is/is-mobile.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* is mobile
|
|
4
|
-
*/
|
|
5
|
-
var isMobile = function isMobile() {
|
|
6
|
-
if (typeof navigator === 'undefined' || typeof window === 'undefined') {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
var agent = navigator.userAgent || navigator.vendor || window.opera;
|
|
10
|
-
return /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(agent) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(agent === null || agent === void 0 ? void 0 : agent.substring(0, 4));
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export { isMobile };
|
package/dist/is/is-null.d.ts
DELETED
package/dist/is/is-null.js
DELETED
package/dist/is/is-overflow.d.ts
DELETED
package/dist/is/is-overflow.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @description
|
|
3
|
-
* if is overflow
|
|
4
|
-
*/
|
|
5
|
-
function isOverflow() {
|
|
6
|
-
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body;
|
|
7
|
-
if (element === document.body) {
|
|
8
|
-
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
|
|
9
|
-
}
|
|
10
|
-
// not body
|
|
11
|
-
return element.scrollHeight > element.clientHeight;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { isOverflow };
|
package/dist/is/is-refable.d.ts
DELETED
package/dist/is/is-refable.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { isValidElement } from 'react';
|
|
2
|
-
import { isFragment, isMemo } from 'react-is';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @description
|
|
6
|
-
*/
|
|
7
|
-
var isRefable = function isRefable(node) {
|
|
8
|
-
if (!isValidElement(node)) {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
if (isFragment(node)) {
|
|
12
|
-
return false;
|
|
13
|
-
}
|
|
14
|
-
return _RefableElement(node);
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* @description
|
|
18
|
-
* refable element
|
|
19
|
-
*/
|
|
20
|
-
var _RefableElement = function _RefableElement(element) {
|
|
21
|
-
var _type$prototype, _element$prototype;
|
|
22
|
-
var type = isMemo(element) ? element.type.type : element.type;
|
|
23
|
-
// Function component node
|
|
24
|
-
if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render)) {
|
|
25
|
-
return false;
|
|
26
|
-
}
|
|
27
|
-
// Class component
|
|
28
|
-
if (typeof element === 'function' && !((_element$prototype = element.prototype) !== null && _element$prototype !== void 0 && _element$prototype.render)) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
return true;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export { isRefable };
|
package/dist/is/is-thenable.d.ts
DELETED
package/dist/is/is-thenable.js
DELETED
package/dist/is/is-undefined.js
DELETED
package/dist/is/is-void.d.ts
DELETED
package/dist/is/is-void.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { isUndefined } from './is-undefined.js';
|
|
2
|
-
import { isNull } from './is-null.js';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* @description
|
|
6
|
-
* is null or undefined
|
|
7
|
-
*/
|
|
8
|
-
var isVoid = function isVoid(value) {
|
|
9
|
-
return isNull(value) || isUndefined(value);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export { isVoid };
|
package/dist/types/first.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type First<T> = T extends [infer D, ...Array<unknown>] ? D : undefined;
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export type { Nullable } from './nullable';
|
|
2
|
-
export type { Partialable } from './partialable';
|
|
3
|
-
export type { Voidable } from './voidable';
|
|
4
|
-
export type { RequiredIn } from './required-in';
|
|
5
|
-
export type { ThenableEffectCallback } from './thenable-effect-callback';
|
|
6
|
-
export type { First } from './first';
|
|
7
|
-
export type { Last } from './last';
|
|
8
|
-
export type { State, StateGetter } from './state';
|
package/dist/types/last.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type Last<T> = T extends [...Array<unknown>, infer D] ? D : undefined;
|