@pdg/react-hook 1.0.25 → 1.0.27
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/clearIntervalRef.d.ts +1 -2
- package/dist/clearTimeoutRef.d.ts +1 -2
- package/dist/index.esm.js +8 -5
- package/dist/index.js +8 -5
- package/dist/useAutoForceUpdate.d.ts +1 -1
- package/dist/useAutoUpdateLayoutRefState.d.ts +4 -4
- package/dist/useAutoUpdateRef.d.ts +2 -2
- package/dist/useAutoUpdateRefState.d.ts +4 -4
- package/dist/useIntervalRef.d.ts +2 -3
- package/dist/useTimeoutRef.d.ts +1 -2
- package/package.json +20 -19
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import React from 'react';
|
|
3
|
-
export declare function clearIntervalRef(ref: React.
|
|
2
|
+
export declare function clearIntervalRef(ref: React.RefObject<NodeJS.Timeout | undefined>): void;
|
|
4
3
|
export default clearIntervalRef;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import React from 'react';
|
|
3
|
-
export declare function clearTimeoutRef(ref: React.
|
|
2
|
+
export declare function clearTimeoutRef(ref: React.RefObject<NodeJS.Timeout | undefined>): void;
|
|
4
3
|
export default clearTimeoutRef;
|
package/dist/index.esm.js
CHANGED
|
@@ -7,6 +7,7 @@ import {useRef,useEffect,useState,useCallback,useLayoutEffect}from'react';import
|
|
|
7
7
|
else {
|
|
8
8
|
effect();
|
|
9
9
|
}
|
|
10
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10
11
|
}, deps);
|
|
11
12
|
}// 구현부
|
|
12
13
|
function useAutoUpdateState(state, callback) {
|
|
@@ -39,6 +40,7 @@ function useAutoUpdateState(state, callback) {
|
|
|
39
40
|
else {
|
|
40
41
|
effect();
|
|
41
42
|
}
|
|
43
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
44
|
}, deps);
|
|
43
45
|
}// 구현부
|
|
44
46
|
function useAutoUpdateLayoutState(state, callback) {
|
|
@@ -161,12 +163,11 @@ function useAutoUpdateLayoutRefState(state, callback) {
|
|
|
161
163
|
useLayoutEffect(function () {
|
|
162
164
|
console.log('Layout Performance', '-', name, performance.now() - beginTime);
|
|
163
165
|
});
|
|
164
|
-
}function useAutoForceUpdate(
|
|
166
|
+
}function useAutoForceUpdate(interval) {
|
|
165
167
|
var _a = useState(0), setTick = _a[1];
|
|
166
168
|
useEffect(function () {
|
|
167
169
|
var tm = setInterval(function () {
|
|
168
170
|
setTick(function (old) {
|
|
169
|
-
console.log('Auto Force Update', '-', name, old + 1);
|
|
170
171
|
return old + 1;
|
|
171
172
|
});
|
|
172
173
|
}, interval);
|
|
@@ -180,7 +181,7 @@ function useAutoUpdateLayoutRefState(state, callback) {
|
|
|
180
181
|
ref.current = undefined;
|
|
181
182
|
}
|
|
182
183
|
}function useTimeoutRef() {
|
|
183
|
-
var ref = useRef();
|
|
184
|
+
var ref = useRef(undefined);
|
|
184
185
|
useEffect(function () {
|
|
185
186
|
return function () {
|
|
186
187
|
clearTimeoutRef(ref);
|
|
@@ -206,14 +207,16 @@ function useAutoUpdateLayoutRefState(state, callback) {
|
|
|
206
207
|
else {
|
|
207
208
|
setValue(function (old) { return old + 1; });
|
|
208
209
|
}
|
|
209
|
-
},
|
|
210
|
+
},
|
|
211
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
212
|
+
[delayMilliseconds]);
|
|
210
213
|
}function clearIntervalRef(ref) {
|
|
211
214
|
if (ref.current) {
|
|
212
215
|
clearInterval(ref.current);
|
|
213
216
|
ref.current = undefined;
|
|
214
217
|
}
|
|
215
218
|
}function useIntervalRef() {
|
|
216
|
-
var ref = useRef();
|
|
219
|
+
var ref = useRef(undefined);
|
|
217
220
|
useEffect(function () {
|
|
218
221
|
return function () {
|
|
219
222
|
clearIntervalRef(ref);
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
else {
|
|
8
8
|
effect();
|
|
9
9
|
}
|
|
10
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
10
11
|
}, deps);
|
|
11
12
|
}// 구현부
|
|
12
13
|
function useAutoUpdateState(state, callback) {
|
|
@@ -39,6 +40,7 @@ function useAutoUpdateState(state, callback) {
|
|
|
39
40
|
else {
|
|
40
41
|
effect();
|
|
41
42
|
}
|
|
43
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
42
44
|
}, deps);
|
|
43
45
|
}// 구현부
|
|
44
46
|
function useAutoUpdateLayoutState(state, callback) {
|
|
@@ -161,12 +163,11 @@ function useAutoUpdateLayoutRefState(state, callback) {
|
|
|
161
163
|
react.useLayoutEffect(function () {
|
|
162
164
|
console.log('Layout Performance', '-', name, performance.now() - beginTime);
|
|
163
165
|
});
|
|
164
|
-
}function useAutoForceUpdate(
|
|
166
|
+
}function useAutoForceUpdate(interval) {
|
|
165
167
|
var _a = react.useState(0), setTick = _a[1];
|
|
166
168
|
react.useEffect(function () {
|
|
167
169
|
var tm = setInterval(function () {
|
|
168
170
|
setTick(function (old) {
|
|
169
|
-
console.log('Auto Force Update', '-', name, old + 1);
|
|
170
171
|
return old + 1;
|
|
171
172
|
});
|
|
172
173
|
}, interval);
|
|
@@ -180,7 +181,7 @@ function useAutoUpdateLayoutRefState(state, callback) {
|
|
|
180
181
|
ref.current = undefined;
|
|
181
182
|
}
|
|
182
183
|
}function useTimeoutRef() {
|
|
183
|
-
var ref = react.useRef();
|
|
184
|
+
var ref = react.useRef(undefined);
|
|
184
185
|
react.useEffect(function () {
|
|
185
186
|
return function () {
|
|
186
187
|
clearTimeoutRef(ref);
|
|
@@ -206,14 +207,16 @@ function useAutoUpdateLayoutRefState(state, callback) {
|
|
|
206
207
|
else {
|
|
207
208
|
setValue(function (old) { return old + 1; });
|
|
208
209
|
}
|
|
209
|
-
},
|
|
210
|
+
},
|
|
211
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
212
|
+
[delayMilliseconds]);
|
|
210
213
|
}function clearIntervalRef(ref) {
|
|
211
214
|
if (ref.current) {
|
|
212
215
|
clearInterval(ref.current);
|
|
213
216
|
ref.current = undefined;
|
|
214
217
|
}
|
|
215
218
|
}function useIntervalRef() {
|
|
216
|
-
var ref = react.useRef();
|
|
219
|
+
var ref = react.useRef(undefined);
|
|
217
220
|
react.useEffect(function () {
|
|
218
221
|
return function () {
|
|
219
222
|
clearIntervalRef(ref);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function useAutoForceUpdate(
|
|
1
|
+
export declare function useAutoForceUpdate(interval: number): void;
|
|
2
2
|
export default useAutoForceUpdate;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useAutoUpdateLayoutRefState<T>(state: Exclude<T, (...args: any[]) => any>): [
|
|
3
|
-
export declare function useAutoUpdateLayoutRefState<T>(state: Exclude<T, (...args: any[]) => any>, callback: (state: T) => T): [
|
|
1
|
+
import { RefObject, SetStateAction } from 'react';
|
|
2
|
+
export declare function useAutoUpdateLayoutRefState<T>(state: Exclude<T, (...args: any[]) => any>): [RefObject<T>, T, (value: SetStateAction<T>) => T];
|
|
3
|
+
export declare function useAutoUpdateLayoutRefState<T>(state: Exclude<T, (...args: any[]) => any>, callback: (state: T) => T): [RefObject<T>, T, (value: SetStateAction<T>, skipCallback?: boolean) => T];
|
|
4
4
|
export declare function useAutoUpdateLayoutRefState<T = never, StateT = never>(state: Exclude<StateT, (...args: any[]) => any>, callback: (state: T | StateT) => T extends never ? StateT : T): [
|
|
5
|
-
|
|
5
|
+
RefObject<T extends never ? StateT : T>,
|
|
6
6
|
T extends never ? StateT : T,
|
|
7
7
|
(value: SetStateAction<T | StateT>, skipCallback?: boolean) => T extends never ? StateT : T
|
|
8
8
|
];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useAutoUpdateRef<T>(value: T):
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export declare function useAutoUpdateRef<T>(value: T): RefObject<T>;
|
|
3
3
|
export default useAutoUpdateRef;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function useAutoUpdateRefState<T>(state: Exclude<T, (...args: any[]) => any>): [
|
|
3
|
-
export declare function useAutoUpdateRefState<T>(state: Exclude<T, (...args: any[]) => any>, callback: (state: T) => T): [
|
|
1
|
+
import { RefObject, SetStateAction } from 'react';
|
|
2
|
+
export declare function useAutoUpdateRefState<T>(state: Exclude<T, (...args: any[]) => any>): [RefObject<T>, T, (value: SetStateAction<T>) => T];
|
|
3
|
+
export declare function useAutoUpdateRefState<T>(state: Exclude<T, (...args: any[]) => any>, callback: (state: T) => T): [RefObject<T>, T, (value: SetStateAction<T>, skipCallback?: boolean) => T];
|
|
4
4
|
export declare function useAutoUpdateRefState<T = never, StateT = never>(state: Exclude<StateT, (...args: any[]) => any>, callback: (state: T | StateT) => T extends never ? StateT : T): [
|
|
5
|
-
|
|
5
|
+
RefObject<T extends never ? StateT : T>,
|
|
6
6
|
T extends never ? StateT : T,
|
|
7
7
|
(value: SetStateAction<T | StateT>, skipCallback?: boolean) => T extends never ? StateT : T
|
|
8
8
|
];
|
package/dist/useIntervalRef.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import React from 'react';
|
|
3
2
|
export type UseIntervalReturnValue = [
|
|
4
|
-
React.
|
|
5
|
-
(callback: (ref: React.
|
|
3
|
+
React.RefObject<NodeJS.Timeout | undefined>,
|
|
4
|
+
(callback: (ref: React.RefObject<NodeJS.Timeout | undefined>) => void, ms?: number) => void
|
|
6
5
|
];
|
|
7
6
|
export declare function useIntervalRef(): UseIntervalReturnValue;
|
|
8
7
|
export default useIntervalRef;
|
package/dist/useTimeoutRef.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import React from 'react';
|
|
3
2
|
export type UseTimeoutReturnValue = [
|
|
4
|
-
React.
|
|
3
|
+
React.RefObject<NodeJS.Timeout | undefined>,
|
|
5
4
|
(callback: (args: void) => void, ms?: number) => void
|
|
6
5
|
];
|
|
7
6
|
export declare function useTimeoutRef(): UseTimeoutReturnValue;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdg/react-hook",
|
|
3
3
|
"title": "React Hook",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.27",
|
|
5
5
|
"description": "React Hook",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -38,29 +38,30 @@
|
|
|
38
38
|
"javascript"
|
|
39
39
|
],
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@pdg/util": "^1.0.
|
|
42
|
-
"@types/react": "
|
|
43
|
-
"react": "
|
|
41
|
+
"@pdg/util": "^1.0.23",
|
|
42
|
+
"@types/react": ">=17.0.0",
|
|
43
|
+
"react": ">=17.0.0"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@rollup/plugin-commonjs": "^
|
|
46
|
+
"@rollup/plugin-commonjs": "^28.0.3",
|
|
47
47
|
"@rollup/plugin-eslint": "^9.0.5",
|
|
48
|
-
"@rollup/plugin-node-resolve": "^
|
|
49
|
-
"@
|
|
50
|
-
"@typescript-eslint/
|
|
51
|
-
"eslint": "8.
|
|
52
|
-
"eslint
|
|
53
|
-
"eslint-
|
|
54
|
-
"eslint-plugin-
|
|
55
|
-
"eslint-plugin-
|
|
56
|
-
"eslint-plugin-react
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"rollup
|
|
48
|
+
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
49
|
+
"@types/node": "^22.14.0",
|
|
50
|
+
"@typescript-eslint/eslint-plugin": "^8.29.1",
|
|
51
|
+
"@typescript-eslint/parser": "^8.29.1",
|
|
52
|
+
"eslint": "8.57.1",
|
|
53
|
+
"eslint-config-prettier": "^10.1.2",
|
|
54
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
55
|
+
"eslint-plugin-prettier": "^5.2.6",
|
|
56
|
+
"eslint-plugin-react": "^7.37.5",
|
|
57
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
58
|
+
"prettier": "^3.5.3",
|
|
59
|
+
"rollup": "^4.39.0",
|
|
60
|
+
"rollup-plugin-delete": "^2.2.0",
|
|
60
61
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|
|
61
62
|
"rollup-plugin-postcss": "^4.0.2",
|
|
62
63
|
"rollup-plugin-typescript2": "^0.36.0",
|
|
63
|
-
"sass": "^1.
|
|
64
|
-
"typescript": "^5.
|
|
64
|
+
"sass": "^1.86.3",
|
|
65
|
+
"typescript": "^5.8.3"
|
|
65
66
|
}
|
|
66
67
|
}
|