goodchuck-utils 1.5.0 → 1.6.0
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/components/dev/ApiLogger.d.ts +136 -0
- package/dist/components/dev/ApiLogger.d.ts.map +1 -0
- package/dist/components/dev/ApiLogger.js +408 -0
- package/dist/components/dev/DevPanel.d.ts +32 -0
- package/dist/components/dev/DevPanel.d.ts.map +1 -0
- package/dist/components/dev/DevPanel.js +196 -0
- package/dist/components/dev/FormDevTools/FormDevTools.d.ts +75 -0
- package/dist/components/dev/FormDevTools/FormDevTools.d.ts.map +1 -0
- package/dist/components/dev/FormDevTools/FormDevTools.js +218 -0
- package/dist/components/dev/FormDevTools/index.d.ts +3 -0
- package/dist/components/dev/FormDevTools/index.d.ts.map +1 -0
- package/dist/components/dev/FormDevTools/index.js +1 -0
- package/dist/components/dev/FormDevTools/styles.d.ts +45 -0
- package/dist/components/dev/FormDevTools/styles.d.ts.map +1 -0
- package/dist/components/dev/FormDevTools/styles.js +187 -0
- package/dist/components/dev/FormDevTools.d.ts +76 -0
- package/dist/components/dev/FormDevTools.d.ts.map +1 -0
- package/dist/components/dev/FormDevTools.js +399 -0
- package/dist/components/dev/IdSelector.d.ts +10 -1
- package/dist/components/dev/IdSelector.d.ts.map +1 -1
- package/dist/components/dev/IdSelector.js +89 -12
- package/dist/components/dev/WindowSizeDisplay.d.ts +44 -0
- package/dist/components/dev/WindowSizeDisplay.d.ts.map +1 -0
- package/dist/components/dev/WindowSizeDisplay.js +74 -0
- package/dist/components/dev/ZIndexDebugger.d.ts +32 -0
- package/dist/components/dev/ZIndexDebugger.d.ts.map +1 -0
- package/dist/components/dev/ZIndexDebugger.js +184 -0
- package/dist/components/dev/index.d.ts +7 -0
- package/dist/components/dev/index.d.ts.map +1 -1
- package/dist/components/dev/index.js +5 -0
- package/package.json +2 -1
|
@@ -13,6 +13,7 @@ type Props = {
|
|
|
13
13
|
*
|
|
14
14
|
* @example
|
|
15
15
|
* ```tsx
|
|
16
|
+
* // Vite 프로젝트
|
|
16
17
|
* import { IdSelector } from 'goodchuck-utils/components/dev';
|
|
17
18
|
*
|
|
18
19
|
* function LoginPage() {
|
|
@@ -28,13 +29,21 @@ type Props = {
|
|
|
28
29
|
* return (
|
|
29
30
|
* <div>
|
|
30
31
|
* <LoginForm />
|
|
31
|
-
* {
|
|
32
|
+
* {import.meta.env.DEV && (
|
|
32
33
|
* <IdSelector onLogin={handleLogin} infos={devAccounts} />
|
|
33
34
|
* )}
|
|
34
35
|
* </div>
|
|
35
36
|
* );
|
|
36
37
|
* }
|
|
37
38
|
* ```
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```tsx
|
|
42
|
+
* // Create React App 프로젝트
|
|
43
|
+
* {process.env.NODE_ENV === 'development' && (
|
|
44
|
+
* <IdSelector onLogin={handleLogin} infos={devAccounts} />
|
|
45
|
+
* )}
|
|
46
|
+
* ```
|
|
38
47
|
*/
|
|
39
48
|
export default function IdSelector({ onLogin, infos }: Props): React.JSX.Element;
|
|
40
49
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdSelector.d.ts","sourceRoot":"","sources":["../../../src/components/dev/IdSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"IdSelector.d.ts","sourceRoot":"","sources":["../../../src/components/dev/IdSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkC,MAAM,OAAO,CAAC;AAEvD,KAAK,SAAS,GAAG;IACf,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5D,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,qBAuH3D"}
|
|
@@ -4,6 +4,7 @@ import React, { useState } from 'react';
|
|
|
4
4
|
*
|
|
5
5
|
* @example
|
|
6
6
|
* ```tsx
|
|
7
|
+
* // Vite 프로젝트
|
|
7
8
|
* import { IdSelector } from 'goodchuck-utils/components/dev';
|
|
8
9
|
*
|
|
9
10
|
* function LoginPage() {
|
|
@@ -19,16 +20,26 @@ import React, { useState } from 'react';
|
|
|
19
20
|
* return (
|
|
20
21
|
* <div>
|
|
21
22
|
* <LoginForm />
|
|
22
|
-
* {
|
|
23
|
+
* {import.meta.env.DEV && (
|
|
23
24
|
* <IdSelector onLogin={handleLogin} infos={devAccounts} />
|
|
24
25
|
* )}
|
|
25
26
|
* </div>
|
|
26
27
|
* );
|
|
27
28
|
* }
|
|
28
29
|
* ```
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```tsx
|
|
33
|
+
* // Create React App 프로젝트
|
|
34
|
+
* {process.env.NODE_ENV === 'development' && (
|
|
35
|
+
* <IdSelector onLogin={handleLogin} infos={devAccounts} />
|
|
36
|
+
* )}
|
|
37
|
+
* ```
|
|
29
38
|
*/
|
|
30
39
|
export default function IdSelector({ onLogin, infos }) {
|
|
31
40
|
const [loading, setLoading] = useState(null);
|
|
41
|
+
const [hoveredIndex, setHoveredIndex] = useState(null);
|
|
42
|
+
const [hoveredButton, setHoveredButton] = useState(null);
|
|
32
43
|
const handleQuickLogin = async (info, index) => {
|
|
33
44
|
setLoading(index);
|
|
34
45
|
try {
|
|
@@ -38,15 +49,81 @@ export default function IdSelector({ onLogin, infos }) {
|
|
|
38
49
|
setLoading(null);
|
|
39
50
|
}
|
|
40
51
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
+
const containerStyle = {
|
|
53
|
+
position: 'fixed',
|
|
54
|
+
top: '50%',
|
|
55
|
+
right: '16px',
|
|
56
|
+
transform: 'translateY(-50%)',
|
|
57
|
+
display: 'flex',
|
|
58
|
+
flexDirection: 'column',
|
|
59
|
+
gap: '12px',
|
|
60
|
+
padding: '16px',
|
|
61
|
+
backgroundColor: '#ffffff',
|
|
62
|
+
borderRadius: '12px',
|
|
63
|
+
boxShadow: '0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)',
|
|
64
|
+
border: '1px solid #e5e7eb',
|
|
65
|
+
minWidth: '280px',
|
|
66
|
+
zIndex: 9999,
|
|
67
|
+
};
|
|
68
|
+
const headerStyle = {
|
|
69
|
+
color: '#111827',
|
|
70
|
+
fontSize: '14px',
|
|
71
|
+
fontWeight: 'bold',
|
|
72
|
+
paddingBottom: '8px',
|
|
73
|
+
borderBottom: '1px solid #e5e7eb',
|
|
74
|
+
};
|
|
75
|
+
const getCardStyle = (index) => ({
|
|
76
|
+
display: 'flex',
|
|
77
|
+
flexDirection: 'column',
|
|
78
|
+
gap: '8px',
|
|
79
|
+
padding: '12px',
|
|
80
|
+
backgroundColor: '#f9fafb',
|
|
81
|
+
borderRadius: '8px',
|
|
82
|
+
border: hoveredIndex === index ? '1px solid #60a5fa' : '1px solid #e5e7eb',
|
|
83
|
+
transition: 'all 0.2s',
|
|
84
|
+
});
|
|
85
|
+
const getButtonStyle = (index) => ({
|
|
86
|
+
width: '100%',
|
|
87
|
+
padding: '8px 16px',
|
|
88
|
+
backgroundColor: loading === index ? '#9ca3af' : hoveredButton === index ? '#2563eb' : '#3b82f6',
|
|
89
|
+
color: 'white',
|
|
90
|
+
fontWeight: 600,
|
|
91
|
+
borderRadius: '8px',
|
|
92
|
+
border: 'none',
|
|
93
|
+
cursor: loading === index ? 'not-allowed' : 'pointer',
|
|
94
|
+
transition: 'background-color 0.2s',
|
|
95
|
+
});
|
|
96
|
+
const infoContainerStyle = {
|
|
97
|
+
display: 'flex',
|
|
98
|
+
flexDirection: 'column',
|
|
99
|
+
gap: '4px',
|
|
100
|
+
fontSize: '12px',
|
|
101
|
+
color: '#6b7280',
|
|
102
|
+
paddingLeft: '4px',
|
|
103
|
+
paddingRight: '4px',
|
|
104
|
+
};
|
|
105
|
+
const infoRowStyle = {
|
|
106
|
+
display: 'flex',
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
gap: '8px',
|
|
109
|
+
};
|
|
110
|
+
const labelStyle = {
|
|
111
|
+
fontWeight: 600,
|
|
112
|
+
minWidth: '24px',
|
|
113
|
+
};
|
|
114
|
+
const valueStyle = {
|
|
115
|
+
fontFamily: 'monospace',
|
|
116
|
+
color: '#374151',
|
|
117
|
+
};
|
|
118
|
+
return (React.createElement("div", { style: containerStyle },
|
|
119
|
+
React.createElement("div", { style: headerStyle }, "\uD83D\uDE80 \uAC1C\uBC1C\uC6A9 \uBE60\uB978 \uB85C\uADF8\uC778"),
|
|
120
|
+
infos.map((info, index) => (React.createElement("div", { key: index, style: getCardStyle(index), onMouseEnter: () => setHoveredIndex(index), onMouseLeave: () => setHoveredIndex(null) },
|
|
121
|
+
React.createElement("button", { onClick: () => handleQuickLogin(info, index), disabled: loading === index, style: getButtonStyle(index), onMouseEnter: () => setHoveredButton(index), onMouseLeave: () => setHoveredButton(null) }, loading === index ? '로그인 중...' : info.memo),
|
|
122
|
+
React.createElement("div", { style: infoContainerStyle },
|
|
123
|
+
React.createElement("div", { style: infoRowStyle },
|
|
124
|
+
React.createElement("span", { style: labelStyle }, "ID"),
|
|
125
|
+
React.createElement("span", { style: valueStyle }, info.id)),
|
|
126
|
+
React.createElement("div", { style: infoRowStyle },
|
|
127
|
+
React.createElement("span", { style: labelStyle }, "PW"),
|
|
128
|
+
React.createElement("span", { style: valueStyle }, info.pw))))))));
|
|
52
129
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React, { CSSProperties } from 'react';
|
|
2
|
+
type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
3
|
+
type Props = {
|
|
4
|
+
/** 표시 위치 (기본값: 'bottom-right') */
|
|
5
|
+
position?: Position;
|
|
6
|
+
/** 커스텀 스타일 */
|
|
7
|
+
style?: CSSProperties;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 현재 윈도우 크기를 화면에 표시하는 개발용 컴포넌트
|
|
11
|
+
* 반응형 디버깅에 유용합니다.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // Vite 프로젝트
|
|
16
|
+
* import { WindowSizeDisplay } from 'goodchuck-utils/components/dev';
|
|
17
|
+
*
|
|
18
|
+
* function App() {
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* {import.meta.env.DEV && <WindowSizeDisplay />}
|
|
22
|
+
* </div>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // Create React App 프로젝트
|
|
30
|
+
* {process.env.NODE_ENV === 'development' && <WindowSizeDisplay />}
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // 커스텀 스타일 및 위치
|
|
36
|
+
* <WindowSizeDisplay
|
|
37
|
+
* position="top-left"
|
|
38
|
+
* style={{ backgroundColor: 'red', color: 'white' }}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export default function WindowSizeDisplay({ position, style }: Props): React.JSX.Element;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=WindowSizeDisplay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WindowSizeDisplay.d.ts","sourceRoot":"","sources":["../../../src/components/dev/WindowSizeDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAG7C,KAAK,QAAQ,GAAG,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;AAE1E,KAAK,KAAK,GAAG;IACX,kCAAkC;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,cAAc;IACd,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB,CAAC;AASF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,OAAO,UAAU,iBAAiB,CAAC,EAAE,QAAyB,EAAE,KAAK,EAAE,EAAE,KAAK,qBAmCpF"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { useWindowSize } from '../../hooks/useWindowSize';
|
|
3
|
+
const positionStyles = {
|
|
4
|
+
'top-left': { top: 16, left: 16 },
|
|
5
|
+
'top-right': { top: 16, right: 16 },
|
|
6
|
+
'bottom-left': { bottom: 16, left: 16 },
|
|
7
|
+
'bottom-right': { bottom: 16, right: 16 },
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* 현재 윈도우 크기를 화면에 표시하는 개발용 컴포넌트
|
|
11
|
+
* 반응형 디버깅에 유용합니다.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* // Vite 프로젝트
|
|
16
|
+
* import { WindowSizeDisplay } from 'goodchuck-utils/components/dev';
|
|
17
|
+
*
|
|
18
|
+
* function App() {
|
|
19
|
+
* return (
|
|
20
|
+
* <div>
|
|
21
|
+
* {import.meta.env.DEV && <WindowSizeDisplay />}
|
|
22
|
+
* </div>
|
|
23
|
+
* );
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```tsx
|
|
29
|
+
* // Create React App 프로젝트
|
|
30
|
+
* {process.env.NODE_ENV === 'development' && <WindowSizeDisplay />}
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```tsx
|
|
35
|
+
* // 커스텀 스타일 및 위치
|
|
36
|
+
* <WindowSizeDisplay
|
|
37
|
+
* position="top-left"
|
|
38
|
+
* style={{ backgroundColor: 'red', color: 'white' }}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export default function WindowSizeDisplay({ position = 'bottom-right', style }) {
|
|
43
|
+
const { width, height } = useWindowSize();
|
|
44
|
+
const containerStyle = {
|
|
45
|
+
position: 'fixed',
|
|
46
|
+
...positionStyles[position],
|
|
47
|
+
padding: '8px 12px',
|
|
48
|
+
backgroundColor: 'rgba(0, 0, 0, 0.8)',
|
|
49
|
+
color: 'white',
|
|
50
|
+
fontSize: '14px',
|
|
51
|
+
fontFamily: 'monospace',
|
|
52
|
+
borderRadius: '8px',
|
|
53
|
+
boxShadow: '0 10px 15px -3px rgba(0, 0, 0, 0.1)',
|
|
54
|
+
zIndex: 9999,
|
|
55
|
+
backdropFilter: 'blur(4px)',
|
|
56
|
+
...style,
|
|
57
|
+
};
|
|
58
|
+
const innerStyle = {
|
|
59
|
+
display: 'flex',
|
|
60
|
+
alignItems: 'center',
|
|
61
|
+
gap: '8px',
|
|
62
|
+
};
|
|
63
|
+
return (React.createElement("div", { style: containerStyle },
|
|
64
|
+
React.createElement("div", { style: innerStyle },
|
|
65
|
+
React.createElement("span", { style: { color: '#60a5fa' } }, "W:"),
|
|
66
|
+
React.createElement("span", { style: { fontWeight: 'bold' } },
|
|
67
|
+
width,
|
|
68
|
+
"px"),
|
|
69
|
+
React.createElement("span", { style: { color: '#9ca3af' } }, "\u00D7"),
|
|
70
|
+
React.createElement("span", { style: { color: '#4ade80' } }, "H:"),
|
|
71
|
+
React.createElement("span", { style: { fontWeight: 'bold' } },
|
|
72
|
+
height,
|
|
73
|
+
"px"))));
|
|
74
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type Props = {
|
|
3
|
+
/** 표시 위치 (기본값: 'bottom-left') */
|
|
4
|
+
position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* z-index 값을 시각화하는 개발용 컴포넌트
|
|
8
|
+
* 페이지의 모든 요소의 z-index를 하이라이트하고 목록으로 표시합니다.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* // Vite 프로젝트
|
|
13
|
+
* import { ZIndexDebugger } from 'goodchuck-utils/components/dev';
|
|
14
|
+
*
|
|
15
|
+
* function App() {
|
|
16
|
+
* return (
|
|
17
|
+
* <div>
|
|
18
|
+
* {import.meta.env.DEV && <ZIndexDebugger />}
|
|
19
|
+
* </div>
|
|
20
|
+
* );
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```tsx
|
|
26
|
+
* // Create React App 프로젝트
|
|
27
|
+
* {process.env.NODE_ENV === 'development' && <ZIndexDebugger position="top-right" />}
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export default function ZIndexDebugger({ position }: Props): React.JSX.Element;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=ZIndexDebugger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ZIndexDebugger.d.ts","sourceRoot":"","sources":["../../../src/components/dev/ZIndexDebugger.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA6C,MAAM,OAAO,CAAC;AAElE,KAAK,KAAK,GAAG;IACX,iCAAiC;IACjC,QAAQ,CAAC,EAAE,UAAU,GAAG,WAAW,GAAG,aAAa,GAAG,cAAc,CAAC;CACtE,CAAC;AAUF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EAAE,QAAwB,EAAE,EAAE,KAAK,qBAsNzE"}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* z-index 값을 시각화하는 개발용 컴포넌트
|
|
4
|
+
* 페이지의 모든 요소의 z-index를 하이라이트하고 목록으로 표시합니다.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```tsx
|
|
8
|
+
* // Vite 프로젝트
|
|
9
|
+
* import { ZIndexDebugger } from 'goodchuck-utils/components/dev';
|
|
10
|
+
*
|
|
11
|
+
* function App() {
|
|
12
|
+
* return (
|
|
13
|
+
* <div>
|
|
14
|
+
* {import.meta.env.DEV && <ZIndexDebugger />}
|
|
15
|
+
* </div>
|
|
16
|
+
* );
|
|
17
|
+
* }
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* // Create React App 프로젝트
|
|
23
|
+
* {process.env.NODE_ENV === 'development' && <ZIndexDebugger position="top-right" />}
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export default function ZIndexDebugger({ position = 'bottom-left' }) {
|
|
27
|
+
const [isActive, setIsActive] = useState(false);
|
|
28
|
+
const [elements, setElements] = useState([]);
|
|
29
|
+
const [hoveredElement, setHoveredElement] = useState(null);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!isActive) {
|
|
32
|
+
setElements([]);
|
|
33
|
+
setHoveredElement(null);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const scanElements = () => {
|
|
37
|
+
const allElements = document.querySelectorAll('*');
|
|
38
|
+
const elementsWithZIndex = [];
|
|
39
|
+
allElements.forEach((el) => {
|
|
40
|
+
if (!(el instanceof HTMLElement))
|
|
41
|
+
return;
|
|
42
|
+
const computedStyle = window.getComputedStyle(el);
|
|
43
|
+
const zIndex = computedStyle.zIndex;
|
|
44
|
+
// z-index가 설정된 요소만 수집 (auto가 아닌 경우)
|
|
45
|
+
if (zIndex !== 'auto' && zIndex !== '0') {
|
|
46
|
+
elementsWithZIndex.push({
|
|
47
|
+
element: el,
|
|
48
|
+
zIndex,
|
|
49
|
+
tagName: el.tagName.toLowerCase(),
|
|
50
|
+
id: el.id || undefined,
|
|
51
|
+
className: el.className || undefined,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
// z-index 값으로 정렬 (높은 순)
|
|
56
|
+
elementsWithZIndex.sort((a, b) => {
|
|
57
|
+
const zA = parseInt(a.zIndex) || 0;
|
|
58
|
+
const zB = parseInt(b.zIndex) || 0;
|
|
59
|
+
return zB - zA;
|
|
60
|
+
});
|
|
61
|
+
setElements(elementsWithZIndex);
|
|
62
|
+
};
|
|
63
|
+
scanElements();
|
|
64
|
+
// DOM 변경 감지
|
|
65
|
+
const observer = new MutationObserver(scanElements);
|
|
66
|
+
observer.observe(document.body, {
|
|
67
|
+
childList: true,
|
|
68
|
+
subtree: true,
|
|
69
|
+
attributes: true,
|
|
70
|
+
attributeFilter: ['style', 'class'],
|
|
71
|
+
});
|
|
72
|
+
return () => observer.disconnect();
|
|
73
|
+
}, [isActive]);
|
|
74
|
+
// 호버된 요소 하이라이트
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (!hoveredElement)
|
|
77
|
+
return;
|
|
78
|
+
const originalOutline = hoveredElement.style.outline;
|
|
79
|
+
const originalOutlineOffset = hoveredElement.style.outlineOffset;
|
|
80
|
+
hoveredElement.style.outline = '3px solid #f59e0b';
|
|
81
|
+
hoveredElement.style.outlineOffset = '2px';
|
|
82
|
+
return () => {
|
|
83
|
+
hoveredElement.style.outline = originalOutline;
|
|
84
|
+
hoveredElement.style.outlineOffset = originalOutlineOffset;
|
|
85
|
+
};
|
|
86
|
+
}, [hoveredElement]);
|
|
87
|
+
const positionStyles = {
|
|
88
|
+
'top-left': { top: 16, left: 16 },
|
|
89
|
+
'top-right': { top: 16, right: 16 },
|
|
90
|
+
'bottom-left': { bottom: 16, left: 16 },
|
|
91
|
+
'bottom-right': { bottom: 16, right: 16 },
|
|
92
|
+
};
|
|
93
|
+
const containerStyle = {
|
|
94
|
+
position: 'fixed',
|
|
95
|
+
...positionStyles[position],
|
|
96
|
+
zIndex: 999999,
|
|
97
|
+
fontFamily: 'system-ui, -apple-system, sans-serif',
|
|
98
|
+
};
|
|
99
|
+
const buttonStyle = {
|
|
100
|
+
padding: '8px 16px',
|
|
101
|
+
backgroundColor: isActive ? '#ef4444' : '#3b82f6',
|
|
102
|
+
color: 'white',
|
|
103
|
+
border: 'none',
|
|
104
|
+
borderRadius: '8px',
|
|
105
|
+
cursor: 'pointer',
|
|
106
|
+
fontSize: '13px',
|
|
107
|
+
fontWeight: 600,
|
|
108
|
+
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
|
|
109
|
+
transition: 'background-color 0.2s',
|
|
110
|
+
};
|
|
111
|
+
const panelStyle = {
|
|
112
|
+
marginTop: '8px',
|
|
113
|
+
backgroundColor: 'white',
|
|
114
|
+
borderRadius: '12px',
|
|
115
|
+
boxShadow: '0 10px 25px rgba(0, 0, 0, 0.15)',
|
|
116
|
+
border: '1px solid #e5e7eb',
|
|
117
|
+
width: '320px',
|
|
118
|
+
maxHeight: '400px',
|
|
119
|
+
overflow: 'hidden',
|
|
120
|
+
display: 'flex',
|
|
121
|
+
flexDirection: 'column',
|
|
122
|
+
};
|
|
123
|
+
const headerStyle = {
|
|
124
|
+
padding: '12px 16px',
|
|
125
|
+
borderBottom: '1px solid #e5e7eb',
|
|
126
|
+
fontWeight: 'bold',
|
|
127
|
+
fontSize: '14px',
|
|
128
|
+
color: '#111827',
|
|
129
|
+
backgroundColor: '#f9fafb',
|
|
130
|
+
};
|
|
131
|
+
const listContainerStyle = {
|
|
132
|
+
overflowY: 'auto',
|
|
133
|
+
maxHeight: '350px',
|
|
134
|
+
};
|
|
135
|
+
const itemStyle = (isHovered) => ({
|
|
136
|
+
padding: '10px 16px',
|
|
137
|
+
borderBottom: '1px solid #f3f4f6',
|
|
138
|
+
cursor: 'pointer',
|
|
139
|
+
backgroundColor: isHovered ? '#fef3c7' : 'white',
|
|
140
|
+
transition: 'background-color 0.15s',
|
|
141
|
+
});
|
|
142
|
+
const zIndexBadgeStyle = {
|
|
143
|
+
display: 'inline-block',
|
|
144
|
+
padding: '2px 8px',
|
|
145
|
+
backgroundColor: '#dbeafe',
|
|
146
|
+
color: '#1e40af',
|
|
147
|
+
borderRadius: '6px',
|
|
148
|
+
fontSize: '12px',
|
|
149
|
+
fontWeight: 'bold',
|
|
150
|
+
fontFamily: 'monospace',
|
|
151
|
+
marginRight: '8px',
|
|
152
|
+
};
|
|
153
|
+
const tagStyle = {
|
|
154
|
+
fontSize: '12px',
|
|
155
|
+
color: '#6b7280',
|
|
156
|
+
fontFamily: 'monospace',
|
|
157
|
+
};
|
|
158
|
+
const getElementLabel = (info) => {
|
|
159
|
+
let label = info.tagName;
|
|
160
|
+
if (info.id)
|
|
161
|
+
label += `#${info.id}`;
|
|
162
|
+
if (info.className && typeof info.className === 'string') {
|
|
163
|
+
const classes = info.className.split(' ').filter(Boolean).slice(0, 2);
|
|
164
|
+
if (classes.length > 0) {
|
|
165
|
+
label += `.${classes.join('.')}`;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return label.length > 40 ? label.slice(0, 40) + '...' : label;
|
|
169
|
+
};
|
|
170
|
+
const handleElementClick = (element) => {
|
|
171
|
+
element.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
|
172
|
+
};
|
|
173
|
+
return (React.createElement("div", { style: containerStyle },
|
|
174
|
+
React.createElement("button", { onClick: () => setIsActive(!isActive), style: buttonStyle, onMouseEnter: (e) => (e.currentTarget.style.backgroundColor = isActive ? '#dc2626' : '#2563eb'), onMouseLeave: (e) => (e.currentTarget.style.backgroundColor = isActive ? '#ef4444' : '#3b82f6') }, isActive ? '🔴 Z-Index 디버거 종료' : '🔍 Z-Index 디버거'),
|
|
175
|
+
isActive && (React.createElement("div", { style: panelStyle },
|
|
176
|
+
React.createElement("div", { style: headerStyle },
|
|
177
|
+
"\uD83D\uDCCA Z-Index \uBAA9\uB85D (",
|
|
178
|
+
elements.length,
|
|
179
|
+
"\uAC1C)"),
|
|
180
|
+
React.createElement("div", { style: listContainerStyle }, elements.length === 0 ? (React.createElement("div", { style: { padding: '20px', textAlign: 'center', color: '#9ca3af', fontSize: '13px' } }, "z-index\uAC00 \uC124\uC815\uB41C \uC694\uC18C\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")) : (elements.map((info, index) => (React.createElement("div", { key: index, style: itemStyle(hoveredElement === info.element), onMouseEnter: () => setHoveredElement(info.element), onMouseLeave: () => setHoveredElement(null), onClick: () => handleElementClick(info.element) },
|
|
181
|
+
React.createElement("div", null,
|
|
182
|
+
React.createElement("span", { style: zIndexBadgeStyle }, info.zIndex),
|
|
183
|
+
React.createElement("span", { style: tagStyle }, getElementLabel(info))))))))))));
|
|
184
|
+
}
|
|
@@ -5,4 +5,11 @@
|
|
|
5
5
|
* production 환경에서는 제외하는 것을 권장합니다.
|
|
6
6
|
*/
|
|
7
7
|
export { default as IdSelector } from './IdSelector';
|
|
8
|
+
export { default as WindowSizeDisplay } from './WindowSizeDisplay';
|
|
9
|
+
export { default as DevPanel } from './DevPanel';
|
|
10
|
+
export { default as ZIndexDebugger } from './ZIndexDebugger';
|
|
11
|
+
export { default as ApiLogger, addApiLog, clearApiLogs } from './ApiLogger';
|
|
12
|
+
export { default as FormDevTools } from './FormDevTools';
|
|
13
|
+
export type { FormDevToolsProps, FormState as FormDevToolsFormState } from './FormDevTools';
|
|
14
|
+
export type { ApiLogEntry } from './ApiLogger';
|
|
8
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dev/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dev/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACzD,YAAY,EAAE,iBAAiB,EAAE,SAAS,IAAI,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAC5F,YAAY,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -5,3 +5,8 @@
|
|
|
5
5
|
* production 환경에서는 제외하는 것을 권장합니다.
|
|
6
6
|
*/
|
|
7
7
|
export { default as IdSelector } from './IdSelector';
|
|
8
|
+
export { default as WindowSizeDisplay } from './WindowSizeDisplay';
|
|
9
|
+
export { default as DevPanel } from './DevPanel';
|
|
10
|
+
export { default as ZIndexDebugger } from './ZIndexDebugger';
|
|
11
|
+
export { default as ApiLogger, addApiLog, clearApiLogs } from './ApiLogger';
|
|
12
|
+
export { default as FormDevTools } from './FormDevTools';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "goodchuck-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"prepublishOnly": "npm run test:run && npm run build:tsc",
|
|
13
13
|
"build": "npm run build",
|
|
14
14
|
"build:tsc": "tsc",
|
|
15
|
+
"dev": "tsc --watch",
|
|
15
16
|
"test": "vitest",
|
|
16
17
|
"test:ui": "vitest --ui",
|
|
17
18
|
"test:run": "vitest run",
|