@aiszlab/relax 2.0.2 → 2.0.3

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.
@@ -3,9 +3,11 @@
3
3
  var scrollTo = require('./scroll-to.cjs');
4
4
  var contains = require('./contains.cjs');
5
5
  var clipboard = require('./clipboard.cjs');
6
+ var stopPropagation = require('./stop-propagation.cjs');
6
7
 
7
8
 
8
9
 
9
10
  exports.scrollTo = scrollTo.scrollTo;
10
11
  exports.contains = contains.contains;
11
12
  exports.clipboard = clipboard.clipboard;
13
+ exports.stopPropagation = stopPropagation.stopPropagation;
@@ -1,6 +1,8 @@
1
1
  import { scrollTo, type Orientation } from "./scroll-to";
2
2
  import { contains, type Containable } from "./contains";
3
3
  import { clipboard } from "./clipboard";
4
+ import { stopPropagation } from "./stop-propagation";
4
5
  export { clipboard };
5
6
  export { scrollTo, contains };
7
+ export { stopPropagation };
6
8
  export type { Containable, Orientation };
@@ -1,3 +1,4 @@
1
1
  export { scrollTo } from './scroll-to.mjs';
2
2
  export { contains } from './contains.mjs';
3
3
  export { clipboard } from './clipboard.mjs';
4
+ export { stopPropagation } from './stop-propagation.mjs';
@@ -0,0 +1,10 @@
1
+ 'use strict';
2
+
3
+ /**
4
+ * @description same as e.stopPropagation()
5
+ */
6
+ function stopPropagation(e) {
7
+ e.stopPropagation();
8
+ }
9
+
10
+ exports.stopPropagation = stopPropagation;
@@ -0,0 +1,8 @@
1
+ interface _Event {
2
+ stopPropagation(): void;
3
+ }
4
+ /**
5
+ * @description same as e.stopPropagation()
6
+ */
7
+ export declare function stopPropagation<E extends _Event>(e: E): void;
8
+ export {};
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @description same as e.stopPropagation()
3
+ */
4
+ function stopPropagation(e) {
5
+ e.stopPropagation();
6
+ }
7
+
8
+ export { stopPropagation };
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ var react = require('react');
4
+
5
+ var useAsyncEffect = function useAsyncEffect(effect, deps) {
6
+ react.useEffect(function () {
7
+ effect();
8
+ }, deps);
9
+ };
10
+
11
+ exports.useAsyncEffect = useAsyncEffect;
@@ -0,0 +1 @@
1
+ export declare const useAsyncEffect: (effect: () => Promise<void>, deps?: unknown[]) => void;
@@ -0,0 +1,9 @@
1
+ import { useEffect } from 'react';
2
+
3
+ var useAsyncEffect = function useAsyncEffect(effect, deps) {
4
+ useEffect(function () {
5
+ effect();
6
+ }, deps);
7
+ };
8
+
9
+ export { useAsyncEffect };
@@ -1,17 +1,18 @@
1
1
  import { type Key } from "react";
2
2
  import { type Orientation } from "../dom";
3
- interface UseScrollableProps {
3
+ import type { Nullable } from "../types";
4
+ interface UsingScrollable {
4
5
  orientation?: Orientation;
5
6
  }
6
7
  /**
7
8
  * @description
8
9
  * scrollable hook
9
10
  */
10
- export declare const useScrollable: <P extends HTMLElement, C extends HTMLElement>({ orientation, }?: UseScrollableProps) => {
11
+ export declare const useScrollable: <P extends HTMLElement, C extends HTMLElement>({ orientation, }?: UsingScrollable) => {
11
12
  targetRef: import("react").RefObject<P | null>;
12
- triggerRefs: import("react").RefObject<Map<Key, C | null>>;
13
+ triggerRefs: import("react").RefObject<Map<Key, Nullable<C>>>;
13
14
  scrollTo: (to: number, duration?: number) => void;
14
15
  to: (key: Key) => number;
15
- setTrigger: (key: Key, trigger: C) => void;
16
+ setTrigger: (key: Key, trigger: Nullable<C>) => void;
16
17
  };
17
18
  export {};
package/dist/index.cjs CHANGED
@@ -39,6 +39,7 @@ var useDrag = require('./hooks/use-drag.cjs');
39
39
  var useEventSource = require('./hooks/use-event-source.cjs');
40
40
  var useResize = require('./hooks/use-resize.cjs');
41
41
  var useDraggable = require('./hooks/use-draggable.cjs');
42
+ var useAsyncEffect = require('./hooks/use-async-effect.cjs');
42
43
  var isRefable = require('./is/is-refable.cjs');
43
44
  var isUndefined = require('./is/is-undefined.cjs');
44
45
  var isNull = require('./is/is-null.cjs');
@@ -77,6 +78,7 @@ var merge = require('./utils/merge.cjs');
77
78
  var max = require('./utils/max.cjs');
78
79
  var min = require('./utils/min.cjs');
79
80
  var load = require('./utils/load.cjs');
81
+ var at = require('./utils/at.cjs');
80
82
 
81
83
 
82
84
 
@@ -119,6 +121,7 @@ exports.useDrag = useDrag.useDrag;
119
121
  exports.useEventSource = useEventSource.useEventSource;
120
122
  exports.useResize = useResize.useResize;
121
123
  exports.useDraggable = useDraggable.useDraggable;
124
+ exports.useAsyncEffect = useAsyncEffect.useAsyncEffect;
122
125
  exports.isRefable = isRefable.isRefable;
123
126
  exports.isUndefined = isUndefined.isUndefined;
124
127
  exports.isNull = isNull.isNull;
@@ -157,3 +160,4 @@ exports.merge = merge.merge;
157
160
  exports.max = max.max;
158
161
  exports.min = min.min;
159
162
  exports.load = load.load;
163
+ exports.at = at.at;
package/dist/index.d.ts CHANGED
@@ -41,6 +41,7 @@ export { useDrag } from "./hooks/use-drag";
41
41
  export { useEventSource } from "./hooks/use-event-source";
42
42
  export { useResize } from "./hooks/use-resize";
43
43
  export { useDraggable } from "./hooks/use-draggable";
44
+ export { useAsyncEffect } from "./hooks/use-async-effect";
44
45
  /**
45
46
  * @description
46
47
  * is
@@ -87,3 +88,4 @@ export { merge } from "./utils/merge";
87
88
  export { max } from "./utils/max";
88
89
  export { min } from "./utils/min";
89
90
  export { load } from "./utils/load";
91
+ export { at } from "./utils/at";
package/dist/index.mjs CHANGED
@@ -37,6 +37,7 @@ export { useDrag } from './hooks/use-drag.mjs';
37
37
  export { useEventSource } from './hooks/use-event-source.mjs';
38
38
  export { useResize } from './hooks/use-resize.mjs';
39
39
  export { useDraggable } from './hooks/use-draggable.mjs';
40
+ export { useAsyncEffect } from './hooks/use-async-effect.mjs';
40
41
  export { isRefable } from './is/is-refable.mjs';
41
42
  export { isUndefined } from './is/is-undefined.mjs';
42
43
  export { isNull } from './is/is-null.mjs';
@@ -75,3 +76,4 @@ export { merge } from './utils/merge.mjs';
75
76
  export { max } from './utils/max.mjs';
76
77
  export { min } from './utils/min.mjs';
77
78
  export { load } from './utils/load.mjs';
79
+ export { at } from './utils/at.mjs';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiszlab/relax",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "react utils collection",
5
5
  "exports": {
6
6
  ".": {