@aiszlab/relax 1.3.10 → 1.3.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/dom/clipboard.d.ts +1 -0
- package/dist/dom/contains.cjs +22 -0
- package/dist/dom/index.cjs +9 -0
- package/dist/dom/index.mjs +2 -0
- package/dist/dom/scroll-to.cjs +74 -0
- package/dist/hooks/use-boolean.cjs +36 -0
- package/dist/hooks/use-click-away.cjs +29 -0
- package/dist/hooks/{use-click-away.js → use-click-away.mjs} +3 -3
- package/dist/hooks/use-controlled-state.cjs +39 -0
- package/dist/hooks/{use-controlled-state.js → use-controlled-state.mjs} +3 -3
- package/dist/hooks/use-counter.cjs +61 -0
- package/dist/hooks/{use-counter.js → use-counter.mjs} +2 -2
- package/dist/hooks/use-debounce-callback.cjs +83 -0
- package/dist/hooks/{use-debounce-callback.js → use-debounce-callback.mjs} +4 -4
- package/dist/hooks/use-default.cjs +16 -0
- package/dist/hooks/{use-default.js → use-default.mjs} +1 -1
- package/dist/hooks/use-device-pixel-ratio.cjs +22 -0
- package/dist/hooks/{use-device-pixel-ratio.js → use-device-pixel-ratio.mjs} +1 -1
- package/dist/hooks/use-event.cjs +16 -0
- package/dist/hooks/use-focus.cjs +33 -0
- package/dist/hooks/{use-focus.js → use-focus.mjs} +2 -2
- package/dist/hooks/use-force-update.cjs +23 -0
- package/dist/hooks/use-hover.cjs +27 -0
- package/dist/hooks/{use-hover.js → use-hover.mjs} +3 -3
- package/dist/hooks/use-identity.cjs +22 -0
- package/dist/hooks/use-image-loader.cjs +65 -0
- package/dist/hooks/use-infinite-scroll.cjs +64 -0
- package/dist/hooks/{use-infinite-scroll.js → use-infinite-scroll.mjs} +2 -2
- package/dist/hooks/use-is-mounted.cjs +35 -0
- package/dist/hooks/{use-is-mounted.js → use-is-mounted.mjs} +1 -1
- package/dist/hooks/use-local-storage-state.cjs +9 -0
- package/dist/hooks/{use-local-storage-state.js → use-local-storage-state.mjs} +1 -1
- package/dist/hooks/use-media-query.cjs +55 -0
- package/dist/hooks/{use-media-query.js → use-media-query.mjs} +3 -3
- package/dist/hooks/use-memorable.cjs +16 -0
- package/dist/hooks/use-memorable.mjs +14 -0
- package/dist/hooks/use-mount.cjs +18 -0
- package/dist/hooks/{use-mount.js → use-mount.mjs} +1 -1
- package/dist/hooks/use-mounted.cjs +18 -0
- package/dist/hooks/{use-mounted.js → use-mounted.mjs} +1 -1
- package/dist/hooks/use-mutate-observer.cjs +30 -0
- package/dist/hooks/{use-mutate-observer.js → use-mutate-observer.mjs} +3 -3
- package/dist/hooks/use-raf.cjs +28 -0
- package/dist/hooks/{use-raf.js → use-raf.mjs} +1 -1
- package/dist/hooks/use-reactive.cjs +32 -0
- package/dist/hooks/use-reactive.d.ts +4 -1
- package/dist/hooks/use-reactive.mjs +30 -0
- package/dist/hooks/use-refs.cjs +33 -0
- package/dist/hooks/{use-refs.js → use-refs.mjs} +1 -1
- package/dist/hooks/use-scroll-locker.cjs +99 -0
- package/dist/hooks/{use-scroll-locker.js → use-scroll-locker.mjs} +2 -2
- package/dist/hooks/use-scrollable.cjs +45 -0
- package/dist/hooks/{use-scrollable.js → use-scrollable.mjs} +1 -1
- package/dist/hooks/use-session-storage-state.cjs +9 -0
- package/dist/hooks/{use-session-storage-state.js → use-session-storage-state.mjs} +1 -1
- package/dist/hooks/use-storage-state.cjs +49 -0
- package/dist/hooks/{use-storage-state.js → use-storage-state.mjs} +1 -1
- package/dist/hooks/use-throttle-callback.cjs +85 -0
- package/dist/hooks/{use-throttle-callback.js → use-throttle-callback.mjs} +4 -4
- package/dist/hooks/use-timeout.cjs +70 -0
- package/dist/hooks/{use-timeout.js → use-timeout.mjs} +2 -2
- package/dist/hooks/use-timer.cjs +34 -0
- package/dist/hooks/{use-timer.js → use-timer.mjs} +1 -1
- package/dist/hooks/use-togglable.cjs +191 -0
- package/dist/hooks/{use-togglable.js → use-togglable.mjs} +2 -2
- package/dist/hooks/use-unmount.cjs +17 -0
- package/dist/hooks/use-update-effect.cjs +15 -0
- package/dist/hooks/{use-update-effect.js → use-update-effect.mjs} +2 -2
- package/dist/index.cjs +136 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +65 -0
- package/dist/is/is-array.cjs +11 -0
- package/dist/is/is-dom-usable.cjs +12 -0
- package/dist/is/is-empty.cjs +27 -0
- package/dist/is/{is-empty.js → is-empty.mjs} +7 -7
- package/dist/is/is-function.cjs +11 -0
- package/dist/is/is-function.d.ts +2 -1
- package/dist/is/is-html-element.cjs +13 -0
- package/dist/is/is-html-input-element.cjs +13 -0
- package/dist/is/is-html-input-element.d.ts +1 -1
- package/dist/is/{is-html-input-element.js → is-html-input-element.mjs} +1 -1
- package/dist/is/is-mobile.cjs +15 -0
- package/dist/is/is-null.cjs +11 -0
- package/dist/is/is-number.cjs +7 -0
- package/dist/is/is-object.cjs +13 -0
- package/dist/is/is-object.d.ts +6 -0
- package/dist/is/is-object.mjs +11 -0
- package/dist/is/is-overflow.cjs +16 -0
- package/dist/is/is-primitive.cjs +11 -0
- package/dist/is/is-refable.cjs +36 -0
- package/dist/is/is-set.cjs +11 -0
- package/dist/is/is-string.cjs +7 -0
- package/dist/is/is-style-element.cjs +11 -0
- package/dist/is/is-thenable.cjs +11 -0
- package/dist/is/is-undefined.cjs +11 -0
- package/dist/is/is-void.cjs +14 -0
- package/dist/is/{is-void.js → is-void.mjs} +2 -2
- package/dist/utils/chain.cjs +17 -0
- package/dist/utils/clamp.cjs +15 -0
- package/dist/utils/clone.cjs +19 -0
- package/dist/utils/{clone.js → clone.mjs} +2 -2
- package/dist/utils/clsx.cjs +34 -0
- package/dist/utils/{clsx.js → clsx.mjs} +4 -4
- package/dist/utils/debounce.cjs +34 -0
- package/dist/utils/{debounce.js → debounce.mjs} +2 -2
- package/dist/utils/effect.cjs +18 -0
- package/dist/utils/{effect.js → effect.mjs} +1 -1
- package/dist/utils/exclude.cjs +20 -0
- package/dist/utils/range.cjs +18 -0
- package/dist/utils/replace.cjs +22 -0
- package/dist/utils/{replace.js → replace.mjs} +1 -1
- package/dist/utils/set-style.cjs +23 -0
- package/dist/utils/tagged-template-literals.cjs +34 -0
- package/dist/utils/throttle.cjs +34 -0
- package/dist/utils/{throttle.js → throttle.mjs} +2 -2
- package/dist/utils/to-array.cjs +27 -0
- package/dist/utils/{to-array.js → to-array.mjs} +1 -1
- package/dist/utils/to-form-data.cjs +29 -0
- package/dist/utils/{to-form-data.js → to-form-data.mjs} +1 -1
- package/dist/utils/to-function.cjs +15 -0
- package/dist/utils/{to-function.js → to-function.mjs} +1 -1
- package/dist/utils/toggle.cjs +32 -0
- package/dist/utils/{toggle.js → toggle.mjs} +1 -1
- package/dist/utils/unique.cjs +19 -0
- package/dist/utils/waitable.cjs +99 -0
- package/dist/utils/{waitable.js → waitable.mjs} +1 -1
- package/package.json +9 -4
- package/dist/dom/index.js +0 -2
- package/dist/hooks/use-memorable.js +0 -25
- package/dist/index.js +0 -64
- package/dist/is/is-complex.d.ts +0 -5
- package/dist/is/is-complex.js +0 -11
- /package/dist/dom/{contains.js → contains.mjs} +0 -0
- /package/dist/dom/{scroll-to.js → scroll-to.mjs} +0 -0
- /package/dist/hooks/{use-boolean.js → use-boolean.mjs} +0 -0
- /package/dist/hooks/{use-event.js → use-event.mjs} +0 -0
- /package/dist/hooks/{use-force-update.js → use-force-update.mjs} +0 -0
- /package/dist/hooks/{use-identity.js → use-identity.mjs} +0 -0
- /package/dist/hooks/{use-image-loader.js → use-image-loader.mjs} +0 -0
- /package/dist/hooks/{use-unmount.js → use-unmount.mjs} +0 -0
- /package/dist/is/{is-array.js → is-array.mjs} +0 -0
- /package/dist/is/{is-dom-usable.js → is-dom-usable.mjs} +0 -0
- /package/dist/is/{is-function.js → is-function.mjs} +0 -0
- /package/dist/is/{is-html-element.js → is-html-element.mjs} +0 -0
- /package/dist/is/{is-mobile.js → is-mobile.mjs} +0 -0
- /package/dist/is/{is-null.js → is-null.mjs} +0 -0
- /package/dist/is/{is-number.js → is-number.mjs} +0 -0
- /package/dist/is/{is-overflow.js → is-overflow.mjs} +0 -0
- /package/dist/is/{is-primitive.js → is-primitive.mjs} +0 -0
- /package/dist/is/{is-refable.js → is-refable.mjs} +0 -0
- /package/dist/is/{is-set.js → is-set.mjs} +0 -0
- /package/dist/is/{is-string.js → is-string.mjs} +0 -0
- /package/dist/is/{is-style-element.js → is-style-element.mjs} +0 -0
- /package/dist/is/{is-thenable.js → is-thenable.mjs} +0 -0
- /package/dist/is/{is-undefined.js → is-undefined.mjs} +0 -0
- /package/dist/utils/{chain.js → chain.mjs} +0 -0
- /package/dist/utils/{clamp.js → clamp.mjs} +0 -0
- /package/dist/utils/{exclude.js → exclude.mjs} +0 -0
- /package/dist/utils/{range.js → range.mjs} +0 -0
- /package/dist/utils/{set-style.js → set-style.mjs} +0 -0
- /package/dist/utils/{tagged-template-literals.js → tagged-template-literals.mjs} +0 -0
- /package/dist/utils/{unique.js → unique.mjs} +0 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var useBoolean = require('./hooks/use-boolean.cjs');
|
|
4
|
+
var useDebounceCallback = require('./hooks/use-debounce-callback.cjs');
|
|
5
|
+
var useThrottleCallback = require('./hooks/use-throttle-callback.cjs');
|
|
6
|
+
var useImageLoader = require('./hooks/use-image-loader.cjs');
|
|
7
|
+
var useMount = require('./hooks/use-mount.cjs');
|
|
8
|
+
var useMounted = require('./hooks/use-mounted.cjs');
|
|
9
|
+
var useTimeout = require('./hooks/use-timeout.cjs');
|
|
10
|
+
var useControlledState = require('./hooks/use-controlled-state.cjs');
|
|
11
|
+
var useDefault = require('./hooks/use-default.cjs');
|
|
12
|
+
var useScrollLocker = require('./hooks/use-scroll-locker.cjs');
|
|
13
|
+
var useForceUpdate = require('./hooks/use-force-update.cjs');
|
|
14
|
+
var useScrollable = require('./hooks/use-scrollable.cjs');
|
|
15
|
+
var useRefs = require('./hooks/use-refs.cjs');
|
|
16
|
+
var useTogglable = require('./hooks/use-togglable.cjs');
|
|
17
|
+
var useEvent = require('./hooks/use-event.cjs');
|
|
18
|
+
var useUpdateEffect = require('./hooks/use-update-effect.cjs');
|
|
19
|
+
var useCounter = require('./hooks/use-counter.cjs');
|
|
20
|
+
var useHover = require('./hooks/use-hover.cjs');
|
|
21
|
+
var useFocus = require('./hooks/use-focus.cjs');
|
|
22
|
+
var useMemorable = require('./hooks/use-memorable.cjs');
|
|
23
|
+
var useMutateObserver = require('./hooks/use-mutate-observer.cjs');
|
|
24
|
+
var useRaf = require('./hooks/use-raf.cjs');
|
|
25
|
+
var useDevicePixelRatio = require('./hooks/use-device-pixel-ratio.cjs');
|
|
26
|
+
var useIdentity = require('./hooks/use-identity.cjs');
|
|
27
|
+
var useMediaQuery = require('./hooks/use-media-query.cjs');
|
|
28
|
+
var useClickAway = require('./hooks/use-click-away.cjs');
|
|
29
|
+
var useUnmount = require('./hooks/use-unmount.cjs');
|
|
30
|
+
var useTimer = require('./hooks/use-timer.cjs');
|
|
31
|
+
var useLocalStorageState = require('./hooks/use-local-storage-state.cjs');
|
|
32
|
+
var useSessionStorageState = require('./hooks/use-session-storage-state.cjs');
|
|
33
|
+
var useIsMounted = require('./hooks/use-is-mounted.cjs');
|
|
34
|
+
var useInfiniteScroll = require('./hooks/use-infinite-scroll.cjs');
|
|
35
|
+
var useReactive = require('./hooks/use-reactive.cjs');
|
|
36
|
+
var isRefable = require('./is/is-refable.cjs');
|
|
37
|
+
var isUndefined = require('./is/is-undefined.cjs');
|
|
38
|
+
var isNull = require('./is/is-null.cjs');
|
|
39
|
+
var isVoid = require('./is/is-void.cjs');
|
|
40
|
+
var isArray = require('./is/is-array.cjs');
|
|
41
|
+
var isEmpty = require('./is/is-empty.cjs');
|
|
42
|
+
var isDomUsable = require('./is/is-dom-usable.cjs');
|
|
43
|
+
var isMobile = require('./is/is-mobile.cjs');
|
|
44
|
+
var isOverflow = require('./is/is-overflow.cjs');
|
|
45
|
+
var isStyleElement = require('./is/is-style-element.cjs');
|
|
46
|
+
var isFunction = require('./is/is-function.cjs');
|
|
47
|
+
var isThenable = require('./is/is-thenable.cjs');
|
|
48
|
+
var isHtmlElement = require('./is/is-html-element.cjs');
|
|
49
|
+
var isHtmlInputElement = require('./is/is-html-input-element.cjs');
|
|
50
|
+
var isObject = require('./is/is-object.cjs');
|
|
51
|
+
var effect = require('./utils/effect.cjs');
|
|
52
|
+
var unique = require('./utils/unique.cjs');
|
|
53
|
+
var range = require('./utils/range.cjs');
|
|
54
|
+
var clamp = require('./utils/clamp.cjs');
|
|
55
|
+
var chain = require('./utils/chain.cjs');
|
|
56
|
+
var debounce = require('./utils/debounce.cjs');
|
|
57
|
+
var toArray = require('./utils/to-array.cjs');
|
|
58
|
+
var toFunction = require('./utils/to-function.cjs');
|
|
59
|
+
var exclude = require('./utils/exclude.cjs');
|
|
60
|
+
var toFormData = require('./utils/to-form-data.cjs');
|
|
61
|
+
var setStyle = require('./utils/set-style.cjs');
|
|
62
|
+
var throttle = require('./utils/throttle.cjs');
|
|
63
|
+
var clone = require('./utils/clone.cjs');
|
|
64
|
+
var toggle = require('./utils/toggle.cjs');
|
|
65
|
+
var taggedTemplateLiterals = require('./utils/tagged-template-literals.cjs');
|
|
66
|
+
var replace = require('./utils/replace.cjs');
|
|
67
|
+
var clsx = require('./utils/clsx.cjs');
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
exports.useBoolean = useBoolean.useBoolean;
|
|
72
|
+
exports.useDebounceCallback = useDebounceCallback.useDebounceCallback;
|
|
73
|
+
exports.useThrottleCallback = useThrottleCallback.useThrottleCallback;
|
|
74
|
+
exports.useImageLoader = useImageLoader.useImageLoader;
|
|
75
|
+
exports.useMount = useMount.useMount;
|
|
76
|
+
exports.useMounted = useMounted.useMounted;
|
|
77
|
+
exports.useTimeout = useTimeout.useTimeout;
|
|
78
|
+
exports.useControlledState = useControlledState.useControlledState;
|
|
79
|
+
exports.useDefault = useDefault.useDefault;
|
|
80
|
+
exports.useScrollLocker = useScrollLocker.useScrollLocker;
|
|
81
|
+
exports.useForceUpdate = useForceUpdate.useForceUpdate;
|
|
82
|
+
exports.useScrollable = useScrollable.useScrollable;
|
|
83
|
+
exports.useRefs = useRefs.useRefs;
|
|
84
|
+
exports.useTogglable = useTogglable.useTogglable;
|
|
85
|
+
exports.useEvent = useEvent.useEvent;
|
|
86
|
+
exports.useUpdateEffect = useUpdateEffect.useUpdateEffect;
|
|
87
|
+
exports.useCounter = useCounter.useCounter;
|
|
88
|
+
exports.useHover = useHover.useHover;
|
|
89
|
+
exports.useFocus = useFocus.useFocus;
|
|
90
|
+
exports.useMemorable = useMemorable.useMemorable;
|
|
91
|
+
exports.useMutateObserver = useMutateObserver.useMutateObserver;
|
|
92
|
+
exports.useRaf = useRaf.useRaf;
|
|
93
|
+
exports.useDevicePixelRatio = useDevicePixelRatio.useDevicePixelRatio;
|
|
94
|
+
exports.useIdentity = useIdentity.useIdentity;
|
|
95
|
+
exports.useMediaQuery = useMediaQuery.useMediaQuery;
|
|
96
|
+
exports.useClickAway = useClickAway.useClickAway;
|
|
97
|
+
exports.useUnmount = useUnmount.useUnmount;
|
|
98
|
+
exports.useTimer = useTimer.useTimer;
|
|
99
|
+
exports.useLocalStorageState = useLocalStorageState.useLocalStorageState;
|
|
100
|
+
exports.useSessionStorageState = useSessionStorageState.useSessionStorageState;
|
|
101
|
+
exports.useIsMounted = useIsMounted.useIsMounted;
|
|
102
|
+
exports.useInfiniteScroll = useInfiniteScroll.useInfiniteScroll;
|
|
103
|
+
exports.useReactive = useReactive.useReactive;
|
|
104
|
+
exports.isRefable = isRefable.isRefable;
|
|
105
|
+
exports.isUndefined = isUndefined.isUndefined;
|
|
106
|
+
exports.isNull = isNull.isNull;
|
|
107
|
+
exports.isVoid = isVoid.isVoid;
|
|
108
|
+
exports.isArray = isArray.isArray;
|
|
109
|
+
exports.isEmpty = isEmpty.isEmpty;
|
|
110
|
+
exports.isDomUsable = isDomUsable.isDomUsable;
|
|
111
|
+
exports.isMobile = isMobile.isMobile;
|
|
112
|
+
exports.isOverflow = isOverflow.isOverflow;
|
|
113
|
+
exports.isStyleElement = isStyleElement.isStyleElement;
|
|
114
|
+
exports.isFunction = isFunction.isFunction;
|
|
115
|
+
exports.isThenable = isThenable.isThenable;
|
|
116
|
+
exports.isHTMLElement = isHtmlElement.isHTMLElement;
|
|
117
|
+
exports.isHTMLInputElement = isHtmlInputElement.isHTMLInputElement;
|
|
118
|
+
exports.isObject = isObject.isObject;
|
|
119
|
+
exports.effect = effect.effect;
|
|
120
|
+
exports.unique = unique.unique;
|
|
121
|
+
exports.uniqueBy = unique.uniqueBy;
|
|
122
|
+
exports.range = range.range;
|
|
123
|
+
exports.clamp = clamp.clamp;
|
|
124
|
+
exports.chain = chain.chain;
|
|
125
|
+
exports.debounce = debounce.debounce;
|
|
126
|
+
exports.toArray = toArray.toArray;
|
|
127
|
+
exports.toFunction = toFunction.toFunction;
|
|
128
|
+
exports.exclude = exclude.exclude;
|
|
129
|
+
exports.toFormData = toFormData.toFormData;
|
|
130
|
+
exports.setStyle = setStyle.setStyle;
|
|
131
|
+
exports.throttle = throttle.throttle;
|
|
132
|
+
exports.clone = clone.clone;
|
|
133
|
+
exports.toggle = toggle.toggle;
|
|
134
|
+
exports.taggedTemplateLiterals = taggedTemplateLiterals.taggedTemplateLiterals;
|
|
135
|
+
exports.replace = replace.replace;
|
|
136
|
+
exports.clsx = clsx.clsx;
|
package/dist/index.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ export { useLocalStorageState } from "./hooks/use-local-storage-state";
|
|
|
34
34
|
export { useSessionStorageState } from "./hooks/use-session-storage-state";
|
|
35
35
|
export { useIsMounted } from "./hooks/use-is-mounted";
|
|
36
36
|
export { useInfiniteScroll } from "./hooks/use-infinite-scroll";
|
|
37
|
+
export { useReactive } from "./hooks/use-reactive";
|
|
37
38
|
/**
|
|
38
39
|
* @description
|
|
39
40
|
* is
|
|
@@ -43,7 +44,6 @@ export { isUndefined } from "./is/is-undefined";
|
|
|
43
44
|
export { isNull } from "./is/is-null";
|
|
44
45
|
export { isVoid } from "./is/is-void";
|
|
45
46
|
export { isArray } from "./is/is-array";
|
|
46
|
-
export { isComplex } from "./is/is-complex";
|
|
47
47
|
export { isEmpty } from "./is/is-empty";
|
|
48
48
|
export { isDomUsable } from "./is/is-dom-usable";
|
|
49
49
|
export { isMobile } from "./is/is-mobile";
|
|
@@ -53,6 +53,7 @@ export { isFunction } from "./is/is-function";
|
|
|
53
53
|
export { isThenable } from "./is/is-thenable";
|
|
54
54
|
export { isHTMLElement } from "./is/is-html-element";
|
|
55
55
|
export { isHTMLInputElement } from "./is/is-html-input-element";
|
|
56
|
+
export { isObject } from "./is/is-object";
|
|
56
57
|
/**
|
|
57
58
|
* @description
|
|
58
59
|
* utils
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export { useBoolean } from './hooks/use-boolean.mjs';
|
|
2
|
+
export { useDebounceCallback } from './hooks/use-debounce-callback.mjs';
|
|
3
|
+
export { useThrottleCallback } from './hooks/use-throttle-callback.mjs';
|
|
4
|
+
export { useImageLoader } from './hooks/use-image-loader.mjs';
|
|
5
|
+
export { useMount } from './hooks/use-mount.mjs';
|
|
6
|
+
export { useMounted } from './hooks/use-mounted.mjs';
|
|
7
|
+
export { useTimeout } from './hooks/use-timeout.mjs';
|
|
8
|
+
export { useControlledState } from './hooks/use-controlled-state.mjs';
|
|
9
|
+
export { useDefault } from './hooks/use-default.mjs';
|
|
10
|
+
export { useScrollLocker } from './hooks/use-scroll-locker.mjs';
|
|
11
|
+
export { useForceUpdate } from './hooks/use-force-update.mjs';
|
|
12
|
+
export { useScrollable } from './hooks/use-scrollable.mjs';
|
|
13
|
+
export { useRefs } from './hooks/use-refs.mjs';
|
|
14
|
+
export { useTogglable } from './hooks/use-togglable.mjs';
|
|
15
|
+
export { useEvent } from './hooks/use-event.mjs';
|
|
16
|
+
export { useUpdateEffect } from './hooks/use-update-effect.mjs';
|
|
17
|
+
export { useCounter } from './hooks/use-counter.mjs';
|
|
18
|
+
export { useHover } from './hooks/use-hover.mjs';
|
|
19
|
+
export { useFocus } from './hooks/use-focus.mjs';
|
|
20
|
+
export { useMemorable } from './hooks/use-memorable.mjs';
|
|
21
|
+
export { useMutateObserver } from './hooks/use-mutate-observer.mjs';
|
|
22
|
+
export { useRaf } from './hooks/use-raf.mjs';
|
|
23
|
+
export { useDevicePixelRatio } from './hooks/use-device-pixel-ratio.mjs';
|
|
24
|
+
export { useIdentity } from './hooks/use-identity.mjs';
|
|
25
|
+
export { useMediaQuery } from './hooks/use-media-query.mjs';
|
|
26
|
+
export { useClickAway } from './hooks/use-click-away.mjs';
|
|
27
|
+
export { useUnmount } from './hooks/use-unmount.mjs';
|
|
28
|
+
export { useTimer } from './hooks/use-timer.mjs';
|
|
29
|
+
export { useLocalStorageState } from './hooks/use-local-storage-state.mjs';
|
|
30
|
+
export { useSessionStorageState } from './hooks/use-session-storage-state.mjs';
|
|
31
|
+
export { useIsMounted } from './hooks/use-is-mounted.mjs';
|
|
32
|
+
export { useInfiniteScroll } from './hooks/use-infinite-scroll.mjs';
|
|
33
|
+
export { useReactive } from './hooks/use-reactive.mjs';
|
|
34
|
+
export { isRefable } from './is/is-refable.mjs';
|
|
35
|
+
export { isUndefined } from './is/is-undefined.mjs';
|
|
36
|
+
export { isNull } from './is/is-null.mjs';
|
|
37
|
+
export { isVoid } from './is/is-void.mjs';
|
|
38
|
+
export { isArray } from './is/is-array.mjs';
|
|
39
|
+
export { isEmpty } from './is/is-empty.mjs';
|
|
40
|
+
export { isDomUsable } from './is/is-dom-usable.mjs';
|
|
41
|
+
export { isMobile } from './is/is-mobile.mjs';
|
|
42
|
+
export { isOverflow } from './is/is-overflow.mjs';
|
|
43
|
+
export { isStyleElement } from './is/is-style-element.mjs';
|
|
44
|
+
export { isFunction } from './is/is-function.mjs';
|
|
45
|
+
export { isThenable } from './is/is-thenable.mjs';
|
|
46
|
+
export { isHTMLElement } from './is/is-html-element.mjs';
|
|
47
|
+
export { isHTMLInputElement } from './is/is-html-input-element.mjs';
|
|
48
|
+
export { isObject } from './is/is-object.mjs';
|
|
49
|
+
export { effect } from './utils/effect.mjs';
|
|
50
|
+
export { unique, uniqueBy } from './utils/unique.mjs';
|
|
51
|
+
export { range } from './utils/range.mjs';
|
|
52
|
+
export { clamp } from './utils/clamp.mjs';
|
|
53
|
+
export { chain } from './utils/chain.mjs';
|
|
54
|
+
export { debounce } from './utils/debounce.mjs';
|
|
55
|
+
export { toArray } from './utils/to-array.mjs';
|
|
56
|
+
export { toFunction } from './utils/to-function.mjs';
|
|
57
|
+
export { exclude } from './utils/exclude.mjs';
|
|
58
|
+
export { toFormData } from './utils/to-form-data.mjs';
|
|
59
|
+
export { setStyle } from './utils/set-style.mjs';
|
|
60
|
+
export { throttle } from './utils/throttle.mjs';
|
|
61
|
+
export { clone } from './utils/clone.mjs';
|
|
62
|
+
export { toggle } from './utils/toggle.mjs';
|
|
63
|
+
export { taggedTemplateLiterals } from './utils/tagged-template-literals.mjs';
|
|
64
|
+
export { replace } from './utils/replace.mjs';
|
|
65
|
+
export { clsx } from './utils/clsx.mjs';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* if there is dom
|
|
6
|
+
*/
|
|
7
|
+
var isDomUsable = function isDomUsable() {
|
|
8
|
+
var _window$document;
|
|
9
|
+
return typeof window !== "undefined" && !!((_window$document = window.document) !== null && _window$document !== void 0 && _window$document.createElement);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
exports.isDomUsable = isDomUsable;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var isVoid = require('./is-void.cjs');
|
|
4
|
+
var isArray = require('./is-array.cjs');
|
|
5
|
+
var isObject = require('./is-object.cjs');
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @author murukal
|
|
9
|
+
*
|
|
10
|
+
* @description
|
|
11
|
+
* is empty
|
|
12
|
+
*/
|
|
13
|
+
var isEmpty = function isEmpty(value) {
|
|
14
|
+
// null or undefined
|
|
15
|
+
if (isVoid.isVoid(value)) return true;
|
|
16
|
+
// array
|
|
17
|
+
if (isArray.isArray(value)) {
|
|
18
|
+
return value.length === 0;
|
|
19
|
+
}
|
|
20
|
+
// object
|
|
21
|
+
if (isObject.isObject(value)) {
|
|
22
|
+
return Object.keys(value).length === 0;
|
|
23
|
+
}
|
|
24
|
+
return !!value;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
exports.isEmpty = isEmpty;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { isVoid } from './is-void.mjs';
|
|
2
|
+
import { isArray } from './is-array.mjs';
|
|
3
|
+
import { isObject } from './is-object.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* @author murukal
|
|
@@ -11,14 +11,14 @@ import { isArray } from './is-array.js';
|
|
|
11
11
|
var isEmpty = function isEmpty(value) {
|
|
12
12
|
// null or undefined
|
|
13
13
|
if (isVoid(value)) return true;
|
|
14
|
-
// object
|
|
15
|
-
if (_typeof(value) === "object") {
|
|
16
|
-
return Object.keys(value).length === 0;
|
|
17
|
-
}
|
|
18
14
|
// array
|
|
19
15
|
if (isArray(value)) {
|
|
20
16
|
return value.length === 0;
|
|
21
17
|
}
|
|
18
|
+
// object
|
|
19
|
+
if (isObject(value)) {
|
|
20
|
+
return Object.keys(value).length === 0;
|
|
21
|
+
}
|
|
22
22
|
return !!value;
|
|
23
23
|
};
|
|
24
24
|
|
package/dist/is/is-function.d.ts
CHANGED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var isHtmlElement = require('./is-html-element.cjs');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @param value - The element being tested
|
|
7
|
+
* @returns Returns true if x is an HTML input tag, false otherwise
|
|
8
|
+
*/
|
|
9
|
+
var isHTMLInputElement = function isHTMLInputElement(value) {
|
|
10
|
+
return isHtmlElement.isHTMLElement(value) && value.tagName === "INPUT";
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.isHTMLInputElement = isHTMLInputElement;
|
|
@@ -3,4 +3,4 @@ import type { Voidable } from "../types";
|
|
|
3
3
|
* @param value - The element being tested
|
|
4
4
|
* @returns Returns true if x is an HTML input tag, false otherwise
|
|
5
5
|
*/
|
|
6
|
-
export declare const isHTMLInputElement: (value: Voidable<EventTarget>) => value is HTMLInputElement;
|
|
6
|
+
export declare const isHTMLInputElement: (value: Voidable<EventTarget> | unknown) => value is HTMLInputElement;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* is mobile
|
|
6
|
+
*/
|
|
7
|
+
var isMobile = function isMobile() {
|
|
8
|
+
if (typeof navigator === "undefined" || typeof window === "undefined") {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
var agent = navigator.userAgent || navigator.vendor || window.opera;
|
|
12
|
+
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));
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.isMobile = isMobile;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* if is overflow
|
|
6
|
+
*/
|
|
7
|
+
function isOverflow() {
|
|
8
|
+
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document.body;
|
|
9
|
+
if (element === document.body) {
|
|
10
|
+
return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;
|
|
11
|
+
}
|
|
12
|
+
// not body
|
|
13
|
+
return element.scrollHeight > element.clientHeight;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
exports.isOverflow = isOverflow;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var reactIs = require('react-is');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
*/
|
|
9
|
+
var isRefable = function isRefable(node) {
|
|
10
|
+
if (! /*#__PURE__*/react.isValidElement(node)) {
|
|
11
|
+
return false;
|
|
12
|
+
}
|
|
13
|
+
if (reactIs.isFragment(node)) {
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return _RefableElement(node);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* @description
|
|
20
|
+
* refable element
|
|
21
|
+
*/
|
|
22
|
+
var _RefableElement = function _RefableElement(element) {
|
|
23
|
+
var _type$prototype, _element$prototype;
|
|
24
|
+
var type = reactIs.isMemo(element) ? element.type.type : element.type;
|
|
25
|
+
// Function component node
|
|
26
|
+
if (typeof type === "function" && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render)) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// Class component
|
|
30
|
+
if (typeof element === "function" && !((_element$prototype = element.prototype) !== null && _element$prototype !== void 0 && _element$prototype.render)) {
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
return true;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
exports.isRefable = isRefable;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var isUndefined = require('./is-undefined.cjs');
|
|
4
|
+
var isNull = require('./is-null.cjs');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* is null or undefined
|
|
9
|
+
*/
|
|
10
|
+
var isVoid = function isVoid(value) {
|
|
11
|
+
return isNull.isNull(value) || isUndefined.isUndefined(value);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.isVoid = isVoid;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chain = function chain() {
|
|
4
|
+
for (var _len = arguments.length, callbacks = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
5
|
+
callbacks[_key] = arguments[_key];
|
|
6
|
+
}
|
|
7
|
+
return function () {
|
|
8
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
9
|
+
args[_key2] = arguments[_key2];
|
|
10
|
+
}
|
|
11
|
+
callbacks.forEach(function (callback) {
|
|
12
|
+
callback === null || callback === void 0 || callback.apply(void 0, args);
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.chain = chain;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description
|
|
5
|
+
* get mid value
|
|
6
|
+
* @param value number
|
|
7
|
+
* @param min number
|
|
8
|
+
* @param max number
|
|
9
|
+
* @returns number
|
|
10
|
+
*/
|
|
11
|
+
var clamp = function clamp(value, min, max) {
|
|
12
|
+
return Math.min(Math.max(value, min), max);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
exports.clamp = clamp;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var isArray = require('../is/is-array.cjs');
|
|
4
|
+
var isPrimitive = require('../is/is-primitive.cjs');
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description
|
|
8
|
+
* in develop, there are many cases to clone a string/number/object/array
|
|
9
|
+
* this util is planning to resolve it
|
|
10
|
+
*/
|
|
11
|
+
var clone = function clone(value) {
|
|
12
|
+
if (isPrimitive.isPrimitive(value)) return value;
|
|
13
|
+
if (value instanceof Map) return new Map(value);
|
|
14
|
+
if (value instanceof Set) return new Set(value);
|
|
15
|
+
if (isArray.isArray(value)) return Array.from(value);
|
|
16
|
+
return Object(value);
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
exports.clone = clone;
|