@nine-lab/nine-ux 0.1.104 → 0.1.106
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/css/nine-code-block.css +169 -0
- package/dist/nine-ux.js +216 -216
- package/dist/nine-ux.umd.js +37 -37
- package/package.json +2 -2
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/* @nine-lab/nine-ux/dist/css/nine-code-block.css */
|
|
2
|
+
|
|
3
|
+
:host(nine-code-block) {
|
|
4
|
+
display: block;
|
|
5
|
+
margin: 16px 0;
|
|
6
|
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
|
|
7
|
+
|
|
8
|
+
/* [기본 테마 - Light] */
|
|
9
|
+
--ncb-bg: #ffffff;
|
|
10
|
+
--ncb-header-bg: #f6f8fa;
|
|
11
|
+
--ncb-border: #d0d7de;
|
|
12
|
+
--ncb-text: #24292f;
|
|
13
|
+
--ncb-lang: #57606a;
|
|
14
|
+
--ncb-code-bg: #f6f8fa;
|
|
15
|
+
--ncb-btn-bg: rgba(27, 31, 36, 0.05);
|
|
16
|
+
--ncb-btn-hover: rgba(27, 31, 36, 0.1);
|
|
17
|
+
|
|
18
|
+
/* Nesting: Wrapper & Structure */
|
|
19
|
+
.wrapper {
|
|
20
|
+
background: var(--ncb-bg);
|
|
21
|
+
border: 1px solid var(--ncb-border);
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
overflow: hidden;
|
|
24
|
+
transition: border-color 0.2s ease;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.header {
|
|
28
|
+
background: var(--ncb-header-bg);
|
|
29
|
+
border-bottom: 1px solid var(--ncb-border);
|
|
30
|
+
padding: 8px 16px;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
gap: 12px;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.dots {
|
|
37
|
+
display: flex;
|
|
38
|
+
gap: 6px;
|
|
39
|
+
.dot {
|
|
40
|
+
width: 12px;
|
|
41
|
+
height: 12px;
|
|
42
|
+
border-radius: 50%;
|
|
43
|
+
&.red { background: #ff5f56; }
|
|
44
|
+
&.yellow { background: #ffbd2e; }
|
|
45
|
+
&.green { background: #27c93f; }
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.lang {
|
|
50
|
+
font-size: 12px;
|
|
51
|
+
font-weight: 600;
|
|
52
|
+
color: var(--ncb-lang);
|
|
53
|
+
text-transform: uppercase;
|
|
54
|
+
letter-spacing: 0.5px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.copy-btn {
|
|
58
|
+
margin-left: auto;
|
|
59
|
+
padding: 4px 12px;
|
|
60
|
+
font-size: 12px;
|
|
61
|
+
font-weight: 500;
|
|
62
|
+
border-radius: 6px;
|
|
63
|
+
border: 1px solid var(--ncb-border);
|
|
64
|
+
background: var(--ncb-btn-bg);
|
|
65
|
+
color: var(--ncb-text);
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
transition: all 0.2s ease;
|
|
68
|
+
outline: none;
|
|
69
|
+
|
|
70
|
+
&:hover {
|
|
71
|
+
background: var(--ncb-btn-hover);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
&.copied {
|
|
75
|
+
background: #238636;
|
|
76
|
+
color: #ffffff;
|
|
77
|
+
border-color: #238636;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.content {
|
|
82
|
+
background: var(--ncb-code-bg);
|
|
83
|
+
padding: 16px;
|
|
84
|
+
overflow-x: auto;
|
|
85
|
+
pre {
|
|
86
|
+
margin: 0;
|
|
87
|
+
code {
|
|
88
|
+
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
|
|
89
|
+
font-size: 13.6px;
|
|
90
|
+
line-height: 1.5;
|
|
91
|
+
color: var(--ncb-text);
|
|
92
|
+
white-space: pre;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/* @nine-lab/nine-ux/dist/css/nine-code-block.css */
|
|
98
|
+
|
|
99
|
+
.copy-btn {
|
|
100
|
+
margin-left: auto;
|
|
101
|
+
width: 32px; /* 아이콘 전용 버튼으로 가로세로 고정 */
|
|
102
|
+
height: 32px;
|
|
103
|
+
border-radius: 6px;
|
|
104
|
+
border: 1px solid var(--ncb-border);
|
|
105
|
+
background: var(--ncb-btn-bg);
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
display: flex;
|
|
108
|
+
align-items: center;
|
|
109
|
+
justify-content: center;
|
|
110
|
+
transition: all 0.2s;
|
|
111
|
+
position: relative;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* [핵심] 복사 아이콘 클래스 */
|
|
115
|
+
.copy-btn::before {
|
|
116
|
+
content: "";
|
|
117
|
+
display: block;
|
|
118
|
+
width: 16px;
|
|
119
|
+
height: 16px;
|
|
120
|
+
background-color: var(--ncb-text); /* 아이콘 색상을 텍스트 색상과 동기화 */
|
|
121
|
+
|
|
122
|
+
/* Lucide Copy 아이콘 SVG */
|
|
123
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E");
|
|
124
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect width='14' height='14' x='8' y='8' rx='2' ry='2'/%3E%3Cpath d='M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2'/%3E%3C/svg%3E");
|
|
125
|
+
-webkit-mask-repeat: no-repeat;
|
|
126
|
+
mask-repeat: no-repeat;
|
|
127
|
+
mask-size: contain;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/* [방법] 복사 완료 시 아이콘 교체 */
|
|
131
|
+
.copy-btn.copied {
|
|
132
|
+
background: #238636;
|
|
133
|
+
border-color: #238636;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.copy-btn.copied::before {
|
|
137
|
+
background-color: #ffffff; /* 체크 아이콘은 흰색으로 */
|
|
138
|
+
/* Lucide Check 아이콘 SVG */
|
|
139
|
+
-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
|
|
140
|
+
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'/%3E%3C/svg%3E");
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/* [시스템 테마 - Dark] */
|
|
145
|
+
@media (prefers-color-scheme: dark) {
|
|
146
|
+
:host(nine-code-block) {
|
|
147
|
+
--ncb-bg: #0d1117;
|
|
148
|
+
--ncb-header-bg: #161b22;
|
|
149
|
+
--ncb-border: #30363d;
|
|
150
|
+
--ncb-text: #c9d1d9;
|
|
151
|
+
--ncb-lang: #8b949e;
|
|
152
|
+
--ncb-code-bg: #0d1117;
|
|
153
|
+
--ncb-btn-bg: rgba(240, 246, 252, 0.1);
|
|
154
|
+
--ncb-btn-hover: rgba(240, 246, 252, 0.2);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/* 수동 클래스 제어를 추가하고 싶을 때 */
|
|
159
|
+
/* [방법 A] 컴포넌트에 직접 theme="dark" 속성이 있을 때 */
|
|
160
|
+
:host(nine-code-block[theme="dark"]) {
|
|
161
|
+
--ncb-bg: #0d1117;
|
|
162
|
+
--ncb-header-bg: #161b22;
|
|
163
|
+
--ncb-border: #30363d;
|
|
164
|
+
--ncb-text: #c9d1d9;
|
|
165
|
+
--ncb-lang: #8b949e;
|
|
166
|
+
--ncb-code-bg: #0d1117;
|
|
167
|
+
--ncb-btn-bg: rgba(240, 246, 252, 0.1);
|
|
168
|
+
--ncb-btn-hover: rgba(240, 246, 252, 0.2);
|
|
169
|
+
}
|