@aiszlab/relax 1.2.36 → 1.2.38

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 (53) hide show
  1. package/dist/dom/index.js +2 -0
  2. package/dist/hooks/{use-controlled-state.mjs → use-controlled-state.js} +3 -3
  3. package/dist/hooks/{use-counter.mjs → use-counter.js} +2 -2
  4. package/dist/hooks/{use-debounce-callback.mjs → use-debounce-callback.js} +4 -4
  5. package/dist/hooks/{use-default.mjs → use-default.js} +1 -1
  6. package/dist/hooks/{use-focus.mjs → use-focus.js} +2 -2
  7. package/dist/hooks/{use-hover.mjs → use-hover.js} +2 -2
  8. package/dist/hooks/{use-mount.mjs → use-mount.js} +1 -1
  9. package/dist/hooks/{use-mounted.mjs → use-mounted.js} +1 -1
  10. package/dist/hooks/{use-refs.mjs → use-refs.js} +1 -1
  11. package/dist/hooks/{use-scroll-locker.mjs → use-scroll-locker.js} +3 -3
  12. package/dist/hooks/{use-scrollable.mjs → use-scrollable.js} +1 -1
  13. package/dist/hooks/{use-throttle-callback.mjs → use-throttle-callback.js} +4 -4
  14. package/dist/hooks/{use-toggleable.mjs → use-toggleable.js} +1 -1
  15. package/dist/hooks/{use-update-effect.mjs → use-update-effect.js} +2 -2
  16. package/dist/index.js +42 -0
  17. package/dist/is/{is-empty.mjs → is-empty.js} +2 -2
  18. package/dist/is/is-overflow.d.ts +1 -1
  19. package/dist/is/is-overflow.js +14 -0
  20. package/dist/is/{is-void.mjs → is-void.js} +2 -2
  21. package/dist/utils/{debounce.mjs → debounce.js} +1 -1
  22. package/dist/utils/{effect.mjs → effect.js} +1 -1
  23. package/dist/utils/{throttle.mjs → throttle.js} +2 -2
  24. package/dist/utils/{to-function.mjs → to-function.js} +1 -1
  25. package/package.json +3 -3
  26. package/dist/dom/index.mjs +0 -2
  27. package/dist/index.mjs +0 -42
  28. package/dist/is/is-overflow.mjs +0 -10
  29. /package/dist/dom/{contains.mjs → contains.js} +0 -0
  30. /package/dist/dom/{scroll-to.mjs → scroll-to.js} +0 -0
  31. /package/dist/hooks/{use-boolean.mjs → use-boolean.js} +0 -0
  32. /package/dist/hooks/{use-event.mjs → use-event.js} +0 -0
  33. /package/dist/hooks/{use-force-update.mjs → use-force-update.js} +0 -0
  34. /package/dist/hooks/{use-image-loader.mjs → use-image-loader.js} +0 -0
  35. /package/dist/hooks/{use-memorable.mjs → use-memorable.js} +0 -0
  36. /package/dist/hooks/{use-timeout.mjs → use-timeout.js} +0 -0
  37. /package/dist/is/{is-array.mjs → is-array.js} +0 -0
  38. /package/dist/is/{is-complex.mjs → is-complex.js} +0 -0
  39. /package/dist/is/{is-dom-usable.mjs → is-dom-usable.js} +0 -0
  40. /package/dist/is/{is-function.mjs → is-function.js} +0 -0
  41. /package/dist/is/{is-mobile.mjs → is-mobile.js} +0 -0
  42. /package/dist/is/{is-null.mjs → is-null.js} +0 -0
  43. /package/dist/is/{is-refable.mjs → is-refable.js} +0 -0
  44. /package/dist/is/{is-state-getter.mjs → is-state-getter.js} +0 -0
  45. /package/dist/is/{is-style-element.mjs → is-style-element.js} +0 -0
  46. /package/dist/is/{is-thenable.mjs → is-thenable.js} +0 -0
  47. /package/dist/is/{is-undefined.mjs → is-undefined.js} +0 -0
  48. /package/dist/utils/{chain.mjs → chain.js} +0 -0
  49. /package/dist/utils/{clamp.mjs → clamp.js} +0 -0
  50. /package/dist/utils/{range.mjs → range.js} +0 -0
  51. /package/dist/utils/{set-style.mjs → set-style.js} +0 -0
  52. /package/dist/utils/{to-array.mjs → to-array.js} +0 -0
  53. /package/dist/utils/{unique.mjs → unique.js} +0 -0
@@ -0,0 +1,2 @@
1
+ export { scrollTo } from './scroll-to.js';
2
+ export { contains } from './contains.js';
@@ -1,7 +1,7 @@
1
1
  import { useState } from 'react';
2
- import { isStateGetter } from '../is/is-state-getter.mjs';
3
- import { isUndefined } from '../is/is-undefined.mjs';
4
- import { useUpdateEffect } from './use-update-effect.mjs';
2
+ import { isStateGetter } from '../is/is-state-getter.js';
3
+ import { isUndefined } from '../is/is-undefined.js';
4
+ import { useUpdateEffect } from './use-update-effect.js';
5
5
 
6
6
  /**
7
7
  * @author murukal
@@ -1,6 +1,6 @@
1
1
  import { useState, useCallback, useMemo } from 'react';
2
- import { clamp } from '../utils/clamp.mjs';
3
- import { useDefault } from './use-default.mjs';
2
+ import { clamp } from '../utils/clamp.js';
3
+ import { useDefault } from './use-default.js';
4
4
 
5
5
  /**
6
6
  * @author murukal
@@ -1,8 +1,8 @@
1
1
  import { useRef, useEffect, useMemo } from 'react';
2
- import { debounce } from '../utils/debounce.mjs';
3
- import { useEvent } from './use-event.mjs';
4
- import { isFunction } from '../is/is-function.mjs';
5
- import { useDefault } from './use-default.mjs';
2
+ import { debounce } from '../utils/debounce.js';
3
+ import { useEvent } from './use-event.js';
4
+ import { isFunction } from '../is/is-function.js';
5
+ import { useDefault } from './use-default.js';
6
6
 
7
7
  const useDebouncer = (debouncer) => {
8
8
  const _debouncer = useMemo(() => {
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- import { toFunction } from '../utils/to-function.mjs';
2
+ import { toFunction } from '../utils/to-function.js';
3
3
 
4
4
  /**
5
5
  * @author murukal
@@ -1,6 +1,6 @@
1
1
  import { useCallback } from 'react';
2
- import { useBoolean } from './use-boolean.mjs';
3
- import { chain } from '../utils/chain.mjs';
2
+ import { useBoolean } from './use-boolean.js';
3
+ import { chain } from '../utils/chain.js';
4
4
 
5
5
  const useFocus = (props) => {
6
6
  const [isFocused, { turnOn, turnOff }] = useBoolean(false);
@@ -1,6 +1,6 @@
1
1
  import { useCallback } from 'react';
2
- import { useBoolean } from './use-boolean.mjs';
3
- import { chain } from '../utils/chain.mjs';
2
+ import { useBoolean } from './use-boolean.js';
3
+ import { chain } from '../utils/chain.js';
4
4
 
5
5
  const useHover = (props) => {
6
6
  const [isHovered, { turnOn, turnOff }] = useBoolean(false);
@@ -1,5 +1,5 @@
1
1
  import { useLayoutEffect } from 'react';
2
- import { effect } from '../utils/effect.mjs';
2
+ import { effect } from '../utils/effect.js';
3
3
 
4
4
  /**
5
5
  * @author murukal
@@ -1,5 +1,5 @@
1
1
  import { useEffect } from 'react';
2
- import { effect } from '../utils/effect.mjs';
2
+ import { effect } from '../utils/effect.js';
3
3
 
4
4
  /**
5
5
  * @author murukal
@@ -1,5 +1,5 @@
1
1
  import { useMemo } from 'react';
2
- import { isFunction } from '../is/is-function.mjs';
2
+ import { isFunction } from '../is/is-function.js';
3
3
 
4
4
  const mount = (ref, trigger) => {
5
5
  if (isFunction(ref)) {
@@ -1,6 +1,6 @@
1
1
  import { useLayoutEffect } from 'react';
2
- import { isOverflow } from '../is/is-overflow.mjs';
3
- import { setStyle } from '../utils/set-style.mjs';
2
+ import { isOverflow } from '../is/is-overflow.js';
3
+ import { setStyle } from '../utils/set-style.js';
4
4
 
5
5
  class ScrollLocker {
6
6
  // singleton mode
@@ -41,7 +41,7 @@ class ScrollLocker {
41
41
  if (this.#locked.has(element))
42
42
  return;
43
43
  // if target is not scrollable, do not lock
44
- if (element.scrollHeight <= element.clientHeight)
44
+ if (!isOverflow(element))
45
45
  return;
46
46
  this.#locked.set(element, setStyle(element, {
47
47
  overflow: 'hidden',
@@ -1,5 +1,5 @@
1
1
  import { useRef, useCallback } from 'react';
2
- import { scrollTo } from '../dom/scroll-to.mjs';
2
+ import { scrollTo } from '../dom/scroll-to.js';
3
3
 
4
4
  /**
5
5
  * @description
@@ -1,8 +1,8 @@
1
1
  import { useRef, useEffect, useMemo } from 'react';
2
- import { throttle } from '../utils/throttle.mjs';
3
- import { useEvent } from './use-event.mjs';
4
- import { isFunction } from '../is/is-function.mjs';
5
- import { useDefault } from './use-default.mjs';
2
+ import { throttle } from '../utils/throttle.js';
3
+ import { useEvent } from './use-event.js';
4
+ import { isFunction } from '../is/is-function.js';
5
+ import { useDefault } from './use-default.js';
6
6
 
7
7
  const useThrottler = (debouncer) => {
8
8
  const _debouncer = useMemo(() => {
@@ -1,5 +1,5 @@
1
1
  import { useMemo, useCallback } from 'react';
2
- import { useControlledState } from './use-controlled-state.mjs';
2
+ import { useControlledState } from './use-controlled-state.js';
3
3
 
4
4
  class Tree {
5
5
  #groupedLeaves;
@@ -1,6 +1,6 @@
1
1
  import { useRef, useEffect } from 'react';
2
- import { useMounted } from './use-mounted.mjs';
3
- import { effect } from '../utils/effect.mjs';
2
+ import { useMounted } from './use-mounted.js';
3
+ import { effect } from '../utils/effect.js';
4
4
 
5
5
  const useUpdateEffect = (callback, deps) => {
6
6
  const isMounted = useRef(false);
package/dist/index.js ADDED
@@ -0,0 +1,42 @@
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 { useToggleable } from './hooks/use-toggleable.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 { isRefable } from './is/is-refable.js';
22
+ export { isUndefined } from './is/is-undefined.js';
23
+ export { isStateGetter } from './is/is-state-getter.js';
24
+ export { isNull } from './is/is-null.js';
25
+ export { isVoid } from './is/is-void.js';
26
+ export { isArray } from './is/is-array.js';
27
+ export { isComplex } from './is/is-complex.js';
28
+ export { isEmpty } from './is/is-empty.js';
29
+ export { isDomUsable } from './is/is-dom-usable.js';
30
+ export { isMobile } from './is/is-mobile.js';
31
+ export { isOverflow } from './is/is-overflow.js';
32
+ export { isStyleElement } from './is/is-style-element.js';
33
+ export { isFunction } from './is/is-function.js';
34
+ export { isThenable } from './is/is-thenable.js';
35
+ export { effect } from './utils/effect.js';
36
+ export { unique, uniqueBy } from './utils/unique.js';
37
+ export { range } from './utils/range.js';
38
+ export { clamp } from './utils/clamp.js';
39
+ export { chain } from './utils/chain.js';
40
+ export { debounce } from './utils/debounce.js';
41
+ export { toArray } from './utils/to-array.js';
42
+ export { toFunction } from './utils/to-function.js';
@@ -1,5 +1,5 @@
1
- import { isVoid } from './is-void.mjs';
2
- import { isArray } from './is-array.mjs';
1
+ import { isVoid } from './is-void.js';
2
+ import { isArray } from './is-array.js';
3
3
 
4
4
  /**
5
5
  * @author murukal
@@ -2,4 +2,4 @@
2
2
  * @description
3
3
  * if is overflow
4
4
  */
5
- export declare function isOverflow(): boolean;
5
+ export declare function isOverflow(element?: HTMLElement): boolean;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @description
3
+ * if is overflow
4
+ */
5
+ function isOverflow(element = document.body) {
6
+ if (element === document.body) {
7
+ return (document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) &&
8
+ window.innerWidth > document.body.offsetWidth);
9
+ }
10
+ // not body
11
+ return element.scrollHeight > element.clientHeight;
12
+ }
13
+
14
+ export { isOverflow };
@@ -1,5 +1,5 @@
1
- import { isUndefined } from './is-undefined.mjs';
2
- import { isNull } from './is-null.mjs';
1
+ import { isUndefined } from './is-undefined.js';
2
+ import { isNull } from './is-null.js';
3
3
 
4
4
  /**
5
5
  * @description
@@ -1,5 +1,5 @@
1
1
  import { Observable, debounceTime, throttleTime, concatMap, from } from 'rxjs';
2
- import { isFunction } from '../is/is-function.mjs';
2
+ import { isFunction } from '../is/is-function.js';
3
3
 
4
4
  class Trigger {
5
5
  #subscriber;
@@ -1,4 +1,4 @@
1
- import { isThenable } from '../is/is-thenable.mjs';
1
+ import { isThenable } from '../is/is-thenable.js';
2
2
 
3
3
  /**
4
4
  * @description
@@ -1,5 +1,5 @@
1
- import { Trigger } from './debounce.mjs';
2
- import { isFunction } from '../is/is-function.mjs';
1
+ import { Trigger } from './debounce.js';
2
+ import { isFunction } from '../is/is-function.js';
3
3
 
4
4
  const throttle = (throttler, duration) => {
5
5
  const _isFunction = isFunction(throttler);
@@ -1,4 +1,4 @@
1
- import { isFunction } from '../is/is-function.mjs';
1
+ import { isFunction } from '../is/is-function.js';
2
2
 
3
3
  const toFunction = (value) => {
4
4
  const _isFunction = isFunction(value);
package/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@aiszlab/relax",
3
- "version": "1.2.36",
3
+ "version": "1.2.38",
4
4
  "description": "react utils collection",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {
8
8
  "types": "./dist/index.d.ts",
9
- "default": "./dist/index.mjs"
9
+ "default": "./dist/index.js"
10
10
  },
11
11
  "./dom": {
12
12
  "types": "./dist/dom/index.d.ts",
13
- "default": "./dist/dom/index.mjs"
13
+ "default": "./dist/dom/index.js"
14
14
  },
15
15
  "./types": "./dist/types/index.d.ts"
16
16
  },
@@ -1,2 +0,0 @@
1
- export { scrollTo } from './scroll-to.mjs';
2
- export { contains } from './contains.mjs';
package/dist/index.mjs DELETED
@@ -1,42 +0,0 @@
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 { useToggleable } from './hooks/use-toggleable.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 { isRefable } from './is/is-refable.mjs';
22
- export { isUndefined } from './is/is-undefined.mjs';
23
- export { isStateGetter } from './is/is-state-getter.mjs';
24
- export { isNull } from './is/is-null.mjs';
25
- export { isVoid } from './is/is-void.mjs';
26
- export { isArray } from './is/is-array.mjs';
27
- export { isComplex } from './is/is-complex.mjs';
28
- export { isEmpty } from './is/is-empty.mjs';
29
- export { isDomUsable } from './is/is-dom-usable.mjs';
30
- export { isMobile } from './is/is-mobile.mjs';
31
- export { isOverflow } from './is/is-overflow.mjs';
32
- export { isStyleElement } from './is/is-style-element.mjs';
33
- export { isFunction } from './is/is-function.mjs';
34
- export { isThenable } from './is/is-thenable.mjs';
35
- export { effect } from './utils/effect.mjs';
36
- export { unique, uniqueBy } from './utils/unique.mjs';
37
- export { range } from './utils/range.mjs';
38
- export { clamp } from './utils/clamp.mjs';
39
- export { chain } from './utils/chain.mjs';
40
- export { debounce } from './utils/debounce.mjs';
41
- export { toArray } from './utils/to-array.mjs';
42
- export { toFunction } from './utils/to-function.mjs';
@@ -1,10 +0,0 @@
1
- /**
2
- * @description
3
- * if is overflow
4
- */
5
- function isOverflow() {
6
- return (document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) &&
7
- window.innerWidth > document.body.offsetWidth);
8
- }
9
-
10
- export { isOverflow };
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes