@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.
Files changed (145) hide show
  1. package/package.json +5 -5
  2. package/dist/__test__/hooks/use-boolean.test.d.ts +0 -4
  3. package/dist/__test__/hooks/use-identity.test.d.ts +0 -4
  4. package/dist/__test__/hooks/use-mount.test.d.ts +0 -4
  5. package/dist/__test__/hooks/use-mounted.test.d.ts +0 -4
  6. package/dist/__test__/hooks/use-timeout.test.d.ts +0 -4
  7. package/dist/__test__/hooks/use-togglable.test.d.ts +0 -4
  8. package/dist/__test__/is/is-null.test.d.ts +0 -1
  9. package/dist/__test__/is/is-thenable.test.d.ts +0 -1
  10. package/dist/__test__/utils/chain.test.d.ts +0 -1
  11. package/dist/__test__/utils/clamp.test.d.ts +0 -1
  12. package/dist/__test__/utils/clone.test.d.ts +0 -1
  13. package/dist/__test__/utils/debounce.test.d.ts +0 -1
  14. package/dist/__test__/utils/effect.test.d.ts +0 -1
  15. package/dist/__test__/utils/exclude.test.d.ts +0 -1
  16. package/dist/__test__/utils/throttle.test.d.ts +0 -1
  17. package/dist/__test__/utils/to-array.test.d.ts +0 -1
  18. package/dist/__test__/utils/to-form-data.test.d.ts +0 -1
  19. package/dist/_virtual/_rollupPluginBabelHelpers.js +0 -138
  20. package/dist/dom/contains.d.ts +0 -1
  21. package/dist/dom/contains.js +0 -20
  22. package/dist/dom/index.d.ts +0 -3
  23. package/dist/dom/index.js +0 -2
  24. package/dist/dom/scroll-to.d.ts +0 -19
  25. package/dist/dom/scroll-to.js +0 -69
  26. package/dist/hooks/use-boolean.d.ts +0 -19
  27. package/dist/hooks/use-boolean.js +0 -34
  28. package/dist/hooks/use-controlled-state.d.ts +0 -17
  29. package/dist/hooks/use-controlled-state.js +0 -40
  30. package/dist/hooks/use-counter.d.ts +0 -33
  31. package/dist/hooks/use-counter.js +0 -59
  32. package/dist/hooks/use-debounce-callback.d.ts +0 -18
  33. package/dist/hooks/use-debounce-callback.js +0 -81
  34. package/dist/hooks/use-default.d.ts +0 -8
  35. package/dist/hooks/use-default.js +0 -14
  36. package/dist/hooks/use-device-pixel-ratio.d.ts +0 -6
  37. package/dist/hooks/use-device-pixel-ratio.js +0 -20
  38. package/dist/hooks/use-event.d.ts +0 -2
  39. package/dist/hooks/use-event.js +0 -12
  40. package/dist/hooks/use-focus.d.ts +0 -15
  41. package/dist/hooks/use-focus.js +0 -31
  42. package/dist/hooks/use-force-update.d.ts +0 -7
  43. package/dist/hooks/use-force-update.js +0 -21
  44. package/dist/hooks/use-hover.d.ts +0 -8
  45. package/dist/hooks/use-hover.js +0 -25
  46. package/dist/hooks/use-identity.d.ts +0 -5
  47. package/dist/hooks/use-identity.js +0 -20
  48. package/dist/hooks/use-image-loader.d.ts +0 -12
  49. package/dist/hooks/use-image-loader.js +0 -54
  50. package/dist/hooks/use-media-query.d.ts +0 -7
  51. package/dist/hooks/use-memorable.d.ts +0 -1
  52. package/dist/hooks/use-memorable.js +0 -14
  53. package/dist/hooks/use-mount.d.ts +0 -8
  54. package/dist/hooks/use-mount.js +0 -16
  55. package/dist/hooks/use-mounted.d.ts +0 -8
  56. package/dist/hooks/use-mounted.js +0 -16
  57. package/dist/hooks/use-mutate-observer.d.ts +0 -1
  58. package/dist/hooks/use-mutate-observer.js +0 -28
  59. package/dist/hooks/use-raf.d.ts +0 -7
  60. package/dist/hooks/use-raf.js +0 -26
  61. package/dist/hooks/use-reactive.d.ts +0 -6
  62. package/dist/hooks/use-refs.d.ts +0 -5
  63. package/dist/hooks/use-refs.js +0 -31
  64. package/dist/hooks/use-scroll-locker.d.ts +0 -5
  65. package/dist/hooks/use-scroll-locker.js +0 -92
  66. package/dist/hooks/use-scrollable.d.ts +0 -17
  67. package/dist/hooks/use-scrollable.js +0 -43
  68. package/dist/hooks/use-throttle-callback.d.ts +0 -18
  69. package/dist/hooks/use-throttle-callback.js +0 -83
  70. package/dist/hooks/use-timeout.d.ts +0 -10
  71. package/dist/hooks/use-timeout.js +0 -68
  72. package/dist/hooks/use-togglable.d.ts +0 -48
  73. package/dist/hooks/use-togglable.js +0 -177
  74. package/dist/hooks/use-toggleable.d.ts +0 -48
  75. package/dist/hooks/use-toggleable.js +0 -187
  76. package/dist/hooks/use-update-effect.d.ts +0 -3
  77. package/dist/hooks/use-update-effect.js +0 -19
  78. package/dist/index.d.ts +0 -61
  79. package/dist/index.js +0 -49
  80. package/dist/is/is-array.d.ts +0 -5
  81. package/dist/is/is-array.js +0 -9
  82. package/dist/is/is-complex.d.ts +0 -5
  83. package/dist/is/is-complex.js +0 -11
  84. package/dist/is/is-dom-usable.d.ts +0 -5
  85. package/dist/is/is-dom-usable.js +0 -9
  86. package/dist/is/is-empty.d.ts +0 -7
  87. package/dist/is/is-empty.js +0 -25
  88. package/dist/is/is-function.d.ts +0 -5
  89. package/dist/is/is-function.js +0 -9
  90. package/dist/is/is-mobile.d.ts +0 -5
  91. package/dist/is/is-mobile.js +0 -13
  92. package/dist/is/is-null.d.ts +0 -5
  93. package/dist/is/is-null.js +0 -9
  94. package/dist/is/is-overflow.d.ts +0 -5
  95. package/dist/is/is-overflow.js +0 -14
  96. package/dist/is/is-pointer-usable.d.ts +0 -5
  97. package/dist/is/is-primitive.d.ts +0 -5
  98. package/dist/is/is-refable.d.ts +0 -5
  99. package/dist/is/is-refable.js +0 -34
  100. package/dist/is/is-state-getter.d.ts +0 -6
  101. package/dist/is/is-state-getter.js +0 -9
  102. package/dist/is/is-style-element.d.ts +0 -5
  103. package/dist/is/is-style-element.js +0 -9
  104. package/dist/is/is-thenable.d.ts +0 -5
  105. package/dist/is/is-thenable.js +0 -9
  106. package/dist/is/is-undefined.d.ts +0 -5
  107. package/dist/is/is-undefined.js +0 -9
  108. package/dist/is/is-void.d.ts +0 -5
  109. package/dist/is/is-void.js +0 -12
  110. package/dist/types/first.d.ts +0 -1
  111. package/dist/types/index.d.ts +0 -8
  112. package/dist/types/last.d.ts +0 -1
  113. package/dist/types/nullable.d.ts +0 -5
  114. package/dist/types/partialable.d.ts +0 -5
  115. package/dist/types/required-in.d.ts +0 -5
  116. package/dist/types/state.d.ts +0 -10
  117. package/dist/types/thenable-effect-callback.d.ts +0 -6
  118. package/dist/types/voidable.d.ts +0 -7
  119. package/dist/utils/chain.d.ts +0 -2
  120. package/dist/utils/chain.js +0 -15
  121. package/dist/utils/clamp.d.ts +0 -9
  122. package/dist/utils/clamp.js +0 -13
  123. package/dist/utils/clone.d.ts +0 -6
  124. package/dist/utils/debounce.d.ts +0 -23
  125. package/dist/utils/debounce.js +0 -32
  126. package/dist/utils/effect.d.ts +0 -7
  127. package/dist/utils/effect.js +0 -16
  128. package/dist/utils/exclude.d.ts +0 -10
  129. package/dist/utils/exclude.js +0 -18
  130. package/dist/utils/range.d.ts +0 -7
  131. package/dist/utils/range.js +0 -16
  132. package/dist/utils/set-style.d.ts +0 -6
  133. package/dist/utils/set-style.js +0 -21
  134. package/dist/utils/throttle.d.ts +0 -5
  135. package/dist/utils/throttle.js +0 -32
  136. package/dist/utils/to-array.d.ts +0 -18
  137. package/dist/utils/to-array.js +0 -25
  138. package/dist/utils/to-form-data.d.ts +0 -5
  139. package/dist/utils/to-form-data.js +0 -27
  140. package/dist/utils/to-function.d.ts +0 -1
  141. package/dist/utils/to-function.js +0 -13
  142. package/dist/utils/unique.d.ts +0 -10
  143. package/dist/utils/unique.js +0 -16
  144. package/dist/utils/waitable.d.ts +0 -36
  145. 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,3 +0,0 @@
1
- import { type DependencyList } from 'react';
2
- import type { ThenableEffectCallback } from '../types';
3
- export declare const useUpdateEffect: (callback: ThenableEffectCallback, deps?: DependencyList) => void;
@@ -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';
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * is array
4
- */
5
- export declare const isArray: <T>(value: T | T[] | readonly T[]) => value is T[];
@@ -1,9 +0,0 @@
1
- /**
2
- * @description
3
- * is array
4
- */
5
- var isArray = function isArray(value) {
6
- return Array.isArray(value);
7
- };
8
-
9
- export { isArray };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * complex
4
- */
5
- export declare const isComplex: (value: unknown) => value is Object;
@@ -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 };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * if there is dom
4
- */
5
- export declare const isDomUsable: () => boolean;
@@ -1,9 +0,0 @@
1
- /**
2
- * @description
3
- * if there is dom
4
- */
5
- var isDomUsable = function isDomUsable() {
6
- return !!(typeof window !== 'undefined' && window.document && window.document.createElement);
7
- };
8
-
9
- export { isDomUsable };
@@ -1,7 +0,0 @@
1
- /**
2
- * @author murukal
3
- *
4
- * @description
5
- * is empty
6
- */
7
- export declare const isEmpty: (value?: Object | unknown[] | string | number | boolean | null) => boolean;
@@ -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 };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * if is function
4
- */
5
- export declare const isFunction: (value: unknown) => value is Function;
@@ -1,9 +0,0 @@
1
- /**
2
- * @description
3
- * if is function
4
- */
5
- var isFunction = function isFunction(value) {
6
- return typeof value === 'function';
7
- };
8
-
9
- export { isFunction };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * is mobile
4
- */
5
- export declare const isMobile: () => boolean;
@@ -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 };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * is null
4
- */
5
- export declare const isNull: (value: unknown) => value is null;
@@ -1,9 +0,0 @@
1
- /**
2
- * @description
3
- * is null
4
- */
5
- var isNull = function isNull(value) {
6
- return value === null;
7
- };
8
-
9
- export { isNull };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * if is overflow
4
- */
5
- export declare function isOverflow(element?: HTMLElement): boolean;
@@ -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 };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * if pointer event is usable
4
- */
5
- export declare const isPointerUsable: () => boolean;
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * string/number/... is primitive type
4
- */
5
- export declare const isPrimitive: (value: unknown) => boolean;
@@ -1,5 +0,0 @@
1
- import { type ReactNode } from 'react';
2
- /**
3
- * @description
4
- */
5
- export declare const isRefable: (node: ReactNode) => boolean;
@@ -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 };
@@ -1,6 +0,0 @@
1
- import type { State, StateGetter } from "../types";
2
- /**
3
- * @description
4
- * is state getter
5
- */
6
- export declare const isStateGetter: <T>(state: State<T>) => state is StateGetter<T>;
@@ -1,9 +0,0 @@
1
- /**
2
- * @description
3
- * is state getter
4
- */
5
- var isStateGetter = function isStateGetter(state) {
6
- return typeof state === 'function';
7
- };
8
-
9
- export { isStateGetter };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * style element
4
- */
5
- export declare const isStyleElement: (element: Element) => element is HTMLStyleElement;
@@ -1,9 +0,0 @@
1
- /**
2
- * @description
3
- * style element
4
- */
5
- var isStyleElement = function isStyleElement(element) {
6
- return element.tagName === 'STYLE';
7
- };
8
-
9
- export { isStyleElement };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * is thenable
4
- */
5
- export declare const isThenable: <T>(value: T | PromiseLike<T>) => value is PromiseLike<T>;
@@ -1,9 +0,0 @@
1
- /**
2
- * @description
3
- * is thenable
4
- */
5
- var isThenable = function isThenable(value) {
6
- return value instanceof Promise || !!(value !== null && value !== void 0 && value.then);
7
- };
8
-
9
- export { isThenable };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * is undefined
4
- */
5
- export declare const isUndefined: (value: unknown) => value is undefined;
@@ -1,9 +0,0 @@
1
- /**
2
- * @description
3
- * is undefined
4
- */
5
- var isUndefined = function isUndefined(value) {
6
- return value === void 0;
7
- };
8
-
9
- export { isUndefined };
@@ -1,5 +0,0 @@
1
- /**
2
- * @description
3
- * is null or undefined
4
- */
5
- export declare const isVoid: (value: unknown) => value is null | undefined;
@@ -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 };
@@ -1 +0,0 @@
1
- export type First<T> = T extends [infer D, ...Array<unknown>] ? D : undefined;
@@ -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';
@@ -1 +0,0 @@
1
- export type Last<T> = T extends [...Array<unknown>, infer D] ? D : undefined;