goodchuck-utils 1.5.0 → 1.7.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 +196 -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 +43 -0
- package/dist/components/dev/FormDevTools/styles.d.ts.map +1 -0
- package/dist/components/dev/FormDevTools/styles.js +176 -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 +4 -2
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
export const getPositionStyles = () => ({
|
|
2
|
+
'top-left': { top: 16, left: 16 },
|
|
3
|
+
'top-right': { top: 16, right: 16 },
|
|
4
|
+
'bottom-left': { bottom: 16, left: 16 },
|
|
5
|
+
'bottom-right': { bottom: 16, right: 16 },
|
|
6
|
+
});
|
|
7
|
+
export const getContainerStyle = (position) => {
|
|
8
|
+
const positionStyles = getPositionStyles();
|
|
9
|
+
return {
|
|
10
|
+
position: 'fixed',
|
|
11
|
+
...positionStyles[position],
|
|
12
|
+
zIndex: 99999,
|
|
13
|
+
fontFamily: 'system-ui, -apple-system, sans-serif',
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export const getToggleButtonStyle = (isValid) => ({
|
|
17
|
+
width: '48px',
|
|
18
|
+
height: '48px',
|
|
19
|
+
borderRadius: '50%',
|
|
20
|
+
backgroundColor: isValid === false ? '#ef4444' : '#8b5cf6',
|
|
21
|
+
color: 'white',
|
|
22
|
+
border: 'none',
|
|
23
|
+
cursor: 'pointer',
|
|
24
|
+
fontSize: '20px',
|
|
25
|
+
boxShadow: '0 4px 6px rgba(0, 0, 0, 0.1)',
|
|
26
|
+
display: 'flex',
|
|
27
|
+
alignItems: 'center',
|
|
28
|
+
justifyContent: 'center',
|
|
29
|
+
transition: 'background-color 0.2s',
|
|
30
|
+
});
|
|
31
|
+
export const getPanelStyle = (position, panelPosition, panelSize, isDragging) => {
|
|
32
|
+
const maxHeight = typeof window !== 'undefined' ? window.innerHeight * 0.85 : 600;
|
|
33
|
+
return {
|
|
34
|
+
position: 'fixed',
|
|
35
|
+
top: panelPosition.y || (position.includes('top') ? 60 : undefined),
|
|
36
|
+
bottom: !panelPosition.y && position.includes('bottom') ? 60 : undefined,
|
|
37
|
+
left: panelPosition.x || (position.includes('left') ? 0 : undefined),
|
|
38
|
+
right: !panelPosition.x && position.includes('right') ? 0 : undefined,
|
|
39
|
+
backgroundColor: 'white',
|
|
40
|
+
borderRadius: '12px',
|
|
41
|
+
boxShadow: '0 10px 25px rgba(0, 0, 0, 0.15)',
|
|
42
|
+
border: '1px solid #e5e7eb',
|
|
43
|
+
width: `${panelSize.width}px`,
|
|
44
|
+
height: `${Math.min(panelSize.height, maxHeight)}px`,
|
|
45
|
+
maxHeight: `${maxHeight}px`,
|
|
46
|
+
overflow: 'hidden',
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'column',
|
|
49
|
+
cursor: isDragging ? 'grabbing' : 'default',
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export const headerStyle = {
|
|
53
|
+
padding: '12px 16px',
|
|
54
|
+
borderBottom: '1px solid #e5e7eb',
|
|
55
|
+
display: 'flex',
|
|
56
|
+
justifyContent: 'space-between',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
backgroundColor: '#f9fafb',
|
|
59
|
+
cursor: 'grab',
|
|
60
|
+
userSelect: 'none',
|
|
61
|
+
};
|
|
62
|
+
export const headerTitleStyle = {
|
|
63
|
+
fontWeight: 'bold',
|
|
64
|
+
fontSize: '14px',
|
|
65
|
+
color: '#111827',
|
|
66
|
+
};
|
|
67
|
+
export const getStatusBadgeStyle = (isValid) => ({
|
|
68
|
+
display: 'inline-flex',
|
|
69
|
+
alignItems: 'center',
|
|
70
|
+
gap: '4px',
|
|
71
|
+
padding: '4px 8px',
|
|
72
|
+
backgroundColor: isValid ? '#dcfce7' : '#fee2e2',
|
|
73
|
+
color: isValid ? '#166534' : '#991b1b',
|
|
74
|
+
borderRadius: '6px',
|
|
75
|
+
fontSize: '11px',
|
|
76
|
+
fontWeight: 600,
|
|
77
|
+
});
|
|
78
|
+
export const getCopyButtonStyle = (isCopied) => ({
|
|
79
|
+
padding: '4px 12px',
|
|
80
|
+
backgroundColor: isCopied ? '#10b981' : '#3b82f6',
|
|
81
|
+
color: 'white',
|
|
82
|
+
border: 'none',
|
|
83
|
+
borderRadius: '6px',
|
|
84
|
+
cursor: 'pointer',
|
|
85
|
+
fontSize: '11px',
|
|
86
|
+
fontWeight: 600,
|
|
87
|
+
transition: 'background-color 0.2s',
|
|
88
|
+
});
|
|
89
|
+
export const contentStyle = {
|
|
90
|
+
flex: 1,
|
|
91
|
+
minHeight: 0, // flexbox에서 스크롤이 제대로 작동하도록 필수
|
|
92
|
+
overflowY: 'auto',
|
|
93
|
+
overflowX: 'hidden',
|
|
94
|
+
padding: '16px',
|
|
95
|
+
};
|
|
96
|
+
export const sectionTitleStyle = {
|
|
97
|
+
fontSize: '12px',
|
|
98
|
+
fontWeight: 'bold',
|
|
99
|
+
color: '#6b7280',
|
|
100
|
+
marginBottom: '8px',
|
|
101
|
+
textTransform: 'uppercase',
|
|
102
|
+
letterSpacing: '0.5px',
|
|
103
|
+
};
|
|
104
|
+
export const codeBlockStyle = {
|
|
105
|
+
backgroundColor: '#f3f4f6',
|
|
106
|
+
borderRadius: '6px',
|
|
107
|
+
padding: '12px',
|
|
108
|
+
fontSize: '12px',
|
|
109
|
+
fontFamily: 'monospace',
|
|
110
|
+
overflow: 'auto',
|
|
111
|
+
maxHeight: '300px',
|
|
112
|
+
marginBottom: '16px',
|
|
113
|
+
color: '#111827', // 검은색 텍스트
|
|
114
|
+
};
|
|
115
|
+
export const errorItemStyle = {
|
|
116
|
+
padding: '8px 12px',
|
|
117
|
+
backgroundColor: '#fef2f2',
|
|
118
|
+
border: '1px solid #fecaca',
|
|
119
|
+
borderRadius: '6px',
|
|
120
|
+
marginBottom: '8px',
|
|
121
|
+
};
|
|
122
|
+
export const errorLabelStyle = {
|
|
123
|
+
fontSize: '12px',
|
|
124
|
+
fontWeight: 600,
|
|
125
|
+
color: '#991b1b',
|
|
126
|
+
marginBottom: '4px',
|
|
127
|
+
};
|
|
128
|
+
export const errorMessageStyle = {
|
|
129
|
+
fontSize: '11px',
|
|
130
|
+
color: '#7f1d1d',
|
|
131
|
+
};
|
|
132
|
+
export const statsContainerStyle = {
|
|
133
|
+
display: 'grid',
|
|
134
|
+
gridTemplateColumns: '1fr 1fr',
|
|
135
|
+
gap: '12px',
|
|
136
|
+
marginBottom: '16px',
|
|
137
|
+
};
|
|
138
|
+
export const statCardStyle = {
|
|
139
|
+
padding: '12px',
|
|
140
|
+
backgroundColor: '#f9fafb',
|
|
141
|
+
borderRadius: '8px',
|
|
142
|
+
border: '1px solid #e5e7eb',
|
|
143
|
+
};
|
|
144
|
+
export const statLabelStyle = {
|
|
145
|
+
fontSize: '11px',
|
|
146
|
+
color: '#6b7280',
|
|
147
|
+
marginBottom: '4px',
|
|
148
|
+
textTransform: 'uppercase',
|
|
149
|
+
letterSpacing: '0.5px',
|
|
150
|
+
};
|
|
151
|
+
export const statValueStyle = {
|
|
152
|
+
fontSize: '18px',
|
|
153
|
+
fontWeight: 'bold',
|
|
154
|
+
color: '#111827',
|
|
155
|
+
};
|
|
156
|
+
export const resizeHandleStyle = {
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
bottom: 0,
|
|
159
|
+
right: 0,
|
|
160
|
+
width: '20px',
|
|
161
|
+
height: '20px',
|
|
162
|
+
cursor: 'nwse-resize',
|
|
163
|
+
backgroundColor: 'transparent',
|
|
164
|
+
zIndex: 1,
|
|
165
|
+
};
|
|
166
|
+
export const resizeHandleIndicatorStyle = {
|
|
167
|
+
position: 'absolute',
|
|
168
|
+
bottom: 0,
|
|
169
|
+
right: 0,
|
|
170
|
+
width: '12px',
|
|
171
|
+
height: '12px',
|
|
172
|
+
cursor: 'nwse-resize',
|
|
173
|
+
borderRight: '3px solid #9ca3af',
|
|
174
|
+
borderBottom: '3px solid #9ca3af',
|
|
175
|
+
borderRadius: '0 0 12px 0',
|
|
176
|
+
};
|
|
@@ -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"}
|