@iyulab/components 2.18.0 → 2.19.1

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.
Files changed (59) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/README.md +9 -2
  3. package/dist/components/UElement.styles.js +8 -8
  4. package/dist/components/UFloatingElement.styles.js +6 -6
  5. package/dist/components/UOverlayElement.styles.js +1 -1
  6. package/dist/components/alert/UAlert.styles.js +12 -12
  7. package/dist/components/badge/UBadge.styles.js +13 -13
  8. package/dist/components/breadcrumb-item/UBreadcrumbItem.styles.js +1 -1
  9. package/dist/components/button/UButton.styles.js +97 -97
  10. package/dist/components/button-group/UButtonGroup.styles.js +2 -2
  11. package/dist/components/calendar/UCalendar.styles.js +10 -10
  12. package/dist/components/calendar/picker.styles.js +14 -14
  13. package/dist/components/card/UCard.styles.js +3 -3
  14. package/dist/components/carousel/UCarousel.styles.js +8 -8
  15. package/dist/components/checkbox/UCheckbox.styles.js +26 -26
  16. package/dist/components/chip/UChip.styles.js +5 -5
  17. package/dist/components/copy-button/UCopyButton.styles.js +2 -2
  18. package/dist/components/date-picker/UDatePicker.styles.js +6 -6
  19. package/dist/components/date-range-picker/UDateRangePicker.styles.js +9 -9
  20. package/dist/components/dialog/UDialog.styles.js +8 -8
  21. package/dist/components/divider/UDivider.styles.js +14 -14
  22. package/dist/components/drawer/UDrawer.styles.js +19 -19
  23. package/dist/components/expander/UExpander.styles.js +13 -13
  24. package/dist/components/field/UField.styles.js +10 -10
  25. package/dist/components/file-input/UFileInput.styles.js +4 -4
  26. package/dist/components/form/UForm.styles.js +1 -1
  27. package/dist/components/icon/UIcon.styles.js +5 -5
  28. package/dist/components/icon-button/UIconButton.styles.js +1 -1
  29. package/dist/components/input/UInput.styles.js +40 -40
  30. package/dist/components/menu/UMenu.styles.js +1 -1
  31. package/dist/components/menu-item/UMenuItem.styles.js +8 -8
  32. package/dist/components/option/UOption.styles.js +5 -5
  33. package/dist/components/pagination/UPagination.styles.js +1 -1
  34. package/dist/components/panel/UPanel.styles.js +6 -6
  35. package/dist/components/progress-bar/UProgressBar.styles.js +10 -10
  36. package/dist/components/progress-ring/UProgressRing.styles.js +9 -9
  37. package/dist/components/radio/URadio.styles.js +12 -12
  38. package/dist/components/rating/URating.styles.js +6 -6
  39. package/dist/components/select/USelect.styles.js +37 -37
  40. package/dist/components/skeleton/USkeleton.styles.js +15 -15
  41. package/dist/components/slider/USlider.styles.js +17 -17
  42. package/dist/components/spinner/USpinner.styles.js +4 -4
  43. package/dist/components/split-panel/USplitPanel.styles.js +9 -9
  44. package/dist/components/steps/USteps.styles.js +5 -5
  45. package/dist/components/switch/USwitch.styles.js +13 -13
  46. package/dist/components/tab/UTab.styles.js +2 -2
  47. package/dist/components/tab-panel/UTabPanel.styles.js +4 -4
  48. package/dist/components/tag/UTag.styles.js +37 -37
  49. package/dist/components/text/UText.styles.js +18 -18
  50. package/dist/components/textarea/UTextarea.styles.js +14 -14
  51. package/dist/components/tooltip/UTooltip.styles.js +2 -2
  52. package/dist/components/tree/UTree.styles.js +3 -3
  53. package/dist/components/tree-item/UTreeItem.styles.js +18 -18
  54. package/dist/plugins/vite-plugin-strip-css-comments.d.ts +29 -0
  55. package/dist/plugins/vite-plugin-strip-css-comments.js +186 -0
  56. package/dist/utilities/Dialog.js +1 -1
  57. package/package.json +2 -2
  58. package/skills/iyulab-components/SKILL.md +2 -1
  59. package/skills/iyulab-components/references/usage.md +13 -0
@@ -7,16 +7,16 @@ var styles = css`
7
7
  --tag-border-color: transparent;
8
8
  }
9
9
 
10
- /* ==========================================================================
11
- 역할 축 — 의미 슬롯 매핑
12
- color="danger" 는 색이 아니라 *"위험"* 을 뜻한다. 장식 축(아래)과 달리 팔레트가 아니라
13
- **역할 토큰**을 읽으므로 리브랜딩을 따라오고, 대비 계약이 지키는 짝을 물려받는다.
14
-
15
- 슬롯이 여섯인 이유는 자리마다 대비 요구가 다르기 때문이다(실측, 두 테마 전건 AA):
16
- solid 면 --u-{role}-color + 그 위 글자 --u-{role}-txt-color (4.60~15.05)
17
- soft 연한 면 --u-{role}-bg-color + 그 위 글자 --u-{role}-color-strong (4.58~7.00)
18
- outlined 바탕 위 글자 --u-{role}-color-strong (계약 검사 대상)
19
- ========================================================================== */
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
20
  :host([color="primary"]) {
21
21
  --tag-hue-solid: var(--u-primary-color, #1976D2);
22
22
  --tag-hue-on-solid: var(--u-primary-txt-color, #FFFFFF);
@@ -58,15 +58,15 @@ var styles = css`
58
58
  --tag-hue-text-outlined: var(--u-danger-color-strong, #C62828);
59
59
  }
60
60
 
61
- /* ==========================================================================
62
- 장식 축 — 색 슬롯 매핑
63
- color="purple" 에는 역할 의미가 없다(장식이다). 그래서 역할 토큰이 아니라
64
- 팔레트를 직접 읽으며, 브랜드 오버라이드에 의도적으로 면역이다.
65
- 아래 규칙이 hue 슬롯을 채우고, appearance 규칙이 그것을 소비한다.
66
- ========================================================================== */
67
- /* neutral — 무채색(기본). 2.0 전에는 neutral 이 «브랜드 경로»였고 회색 레이블은 장식 축 gray 로만
68
- 낼 수 있었다 — 같은 낱말이 배지·체크박스에서는 회색이라 뜻이 정반대였다. 중립 램프를 읽되 명도 때문에
69
- 두 자리를 한 단 진하게 쓴다: solid 면은 흰 글자 대비로 700, 연한 면은 흰 바탕·올림면과 구별되게 200. */
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
70
  :host([color="neutral"]) {
71
71
  --tag-hue-solid: var(--u-neutral-700, #616161);
72
72
  --tag-hue-line: var(--u-neutral-300, #E0E0E0);
@@ -88,7 +88,7 @@ var styles = css`
88
88
  --tag-hue-text: var(--u-green-800, #2E7D32);
89
89
  --tag-hue-text-outlined: var(--u-green-600, #43A047);
90
90
  }
91
- /* yellow 는 명도가 높아 solid·outlined 텍스트를 한 단 진하게 쓴다 */
91
+
92
92
  :host([color="yellow"]) {
93
93
  --tag-hue-solid: var(--u-yellow-600, #FDD835);
94
94
  --tag-hue-line: var(--u-yellow-300, #FFF176);
@@ -139,30 +139,30 @@ var styles = css`
139
139
  --tag-hue-text-outlined: var(--u-pink-600, #D81B60);
140
140
  }
141
141
 
142
- /* solid — 강한 채움 */
142
+
143
143
  :host([appearance="solid"]) {
144
- /* 면 위의 글자. 장식 축은 슬롯이 비어 흰색으로 떨어진다(현행 보존) — 역할 축에서만
145
- 갈린다. warning 이 그 이유다: 노란 면 위의 흰 글자는 읽히지 않는다. */
144
+
145
+
146
146
  --tag-color: var(--tag-hue-on-solid, var(--u-neutral-0, #FFFFFF));
147
147
  --tag-bg-color: var(--tag-hue-solid);
148
148
  --tag-border-color: var(--tag-hue-solid);
149
149
  }
150
150
 
151
- /* soft — 옅은 틴트, 테두리 없음 (기본) */
151
+
152
152
  :host([appearance="soft"]) {
153
153
  --tag-color: var(--tag-hue-text);
154
154
  --tag-bg-color: var(--tag-hue-surface);
155
155
  --tag-border-color: transparent;
156
156
  }
157
157
 
158
- /* outlined — 테두리만 */
158
+
159
159
  :host([appearance="outlined"]) {
160
160
  --tag-color: var(--tag-hue-text-outlined);
161
161
  --tag-bg-color: transparent;
162
162
  --tag-border-color: var(--tag-hue-line);
163
163
  }
164
164
 
165
- /* plain — 외형 없음: 색 글자만 */
165
+
166
166
  :host([appearance="plain"]) {
167
167
  --tag-color: var(--tag-hue-text-outlined);
168
168
  --tag-bg-color: transparent;
@@ -186,7 +186,7 @@ var styles = css`
186
186
  box-sizing: border-box;
187
187
  }
188
188
 
189
- /* 여백/테두리는 내부 요소가 진다 — :host 에 두면 소비 앱 CSS 리셋에 지워진다. */
189
+
190
190
  .base {
191
191
  box-sizing: border-box;
192
192
  width: 100%;
@@ -197,7 +197,7 @@ var styles = css`
197
197
  border: 1px solid var(--tag-border-color);
198
198
  border-radius: inherit;
199
199
  }
200
- /* 상태 아이콘 — .base 의 gap 이 간격을 정한다. */
200
+
201
201
  .icon {
202
202
  flex-shrink: 0;
203
203
  }
@@ -205,15 +205,15 @@ var styles = css`
205
205
  border-radius: var(--u-radius-pill, 9999px);
206
206
  }
207
207
 
208
- /*
209
- * === Slots ===
210
- * 간격은 .base 의 gap 하나가 진다.
211
- * 종전에는 gap 과 슬롯 margin(0.15em, 약 1.8px)이 **같은 자리에 겹쳐** 있어,
212
- * 소비자가 --tag-gap 을 0 으로 줘도 1.8px 이 남았고 그 값에는 훅이 없었다.
213
- * --tag-gap 기본값을 합계(4 + 1.8 = 약 6px)로 올려 흡수했다 — 렌더 간격은 사실상 그대로다.
214
- */
208
+
209
+
210
+
211
+
212
+
213
+
214
+
215
215
 
216
- /* === Content === */
216
+
217
217
  .content {
218
218
  display: inline-block;
219
219
  min-width: 0;
@@ -222,7 +222,7 @@ var styles = css`
222
222
  text-overflow: ellipsis;
223
223
  }
224
224
 
225
- /* 앞머리 점 — 글자색을 따른다(역할·장식 축 어느 쪽이든 글자와 같은 색). */
225
+
226
226
  .dot {
227
227
  flex: none;
228
228
  width: var(--tag-dot-size, 6px);
@@ -6,11 +6,11 @@ var styles = css`
6
6
  color: var(--u-txt-color, #212121);
7
7
  }
8
8
 
9
- /*
10
- * 기본은 body 다. :host([variant="body"]) 규칙을 따로 두지 않는 이유는
11
- * 값이 같기 때문이며, 부수 효과로 **알 수 없는 variant 가 body 로 흐른다**
12
- * (조용히 폰트가 사라지는 것보다 낫다).
13
- */
9
+
10
+
11
+
12
+
13
+
14
14
  .text {
15
15
  margin: 0;
16
16
  font-family: inherit;
@@ -55,14 +55,14 @@ var styles = css`
55
55
  letter-spacing: var(--u-text-caption-tracking, 0);
56
56
  }
57
57
 
58
- /*
59
- * ⚠ overline 에 text-transform: uppercase 를 붙이지 않는다.
60
- *
61
- * 눈썹 텍스트의 관습이긴 하나 ⑴시트가 정의하는 것은 네 속성뿐이라 다섯 번째를 여기서
62
- * 정하면 이 컴포넌트가 «두 번째 정의처»가 되고 ⑵소비자가 쓴 글자를 조용히 바꾸며
63
- * ⑶CJK 에는 아무 효과가 없어 **같은 단이 언어에 따라 다르게 보인다.**
64
- * 대문자가 필요한 자리는 그 자리가 정한다.
65
- */
58
+
59
+
60
+
61
+
62
+
63
+
64
+
65
+
66
66
  :host([variant="overline"]) .text {
67
67
  font-size: var(--u-text-overline-size, 11px);
68
68
  font-weight: var(--u-text-overline-weight, 700);
@@ -70,11 +70,11 @@ var styles = css`
70
70
  letter-spacing: var(--u-text-overline-tracking, 0.06em);
71
71
  }
72
72
 
73
- /*
74
- * tone 은 **중립 강조 축**이다 — 역할색(info/success/danger…)이 아니다.
75
- * 소비앱 실측에서 나온 색 다섯 중 셋이 이 축이었고, 나머지 둘은 링크와
76
- * 콜아웃 박스라 u-text 의 문제가 아니었다.
77
- */
73
+
74
+
75
+
76
+
77
+
78
78
  :host([tone="weak"]) {
79
79
  color: var(--u-txt-color-weak, #616161);
80
80
  }
@@ -2,19 +2,19 @@ import { css } from "lit";
2
2
  //#region src/components/textarea/UTextarea.styles.ts
3
3
  var styles = css`
4
4
  :host {
5
- /* 폼/그리드 셀에서 컨테이너 폭을 채우려면 소비자가 --u-textarea-display: block 을 준다.
6
- flex 컨테이너처럼 block 만으로 늘어나지 않는 맥락을 위해 width 경로도 함께 연다. */
5
+
6
+
7
7
  display: var(--u-textarea-display, inline-block);
8
8
  width: var(--u-textarea-width, auto);
9
9
  color: var(--u-txt-color, #212121);
10
10
  font-family: var(--u-font-base);
11
11
  }
12
12
 
13
- /* ===== 컨테이너 (outlined 기본) ===== */
13
+
14
14
  .container {
15
15
  display: flex;
16
16
  padding: var(--u-field-padding-block, 0.3em) var(--u-field-padding-inline, 0.6em);
17
- /* 호스트 하한(--u-target-size, 미설정 = 0) — 글자와 독립된 터치 하한. */
17
+
18
18
  box-sizing: border-box;
19
19
  min-height: var(--u-target-size, 0px);
20
20
  border: 1px solid var(--u-input-border-color, #E0E0E0);
@@ -37,7 +37,7 @@ var styles = css`
37
37
  box-shadow: 0 0 0 1px var(--u-input-border-color-invalid, #C62828);
38
38
  }
39
39
 
40
- /* ===== Appearance: soft (중립 틴트 면) ===== */
40
+
41
41
  :host([appearance="soft"]) .container {
42
42
  border-color: transparent;
43
43
  background-color: var(--u-neutral-200, #EEEEEE);
@@ -63,7 +63,7 @@ var styles = css`
63
63
  border-bottom-color: var(--u-input-border-color-invalid, #C62828);
64
64
  }
65
65
 
66
- /* ===== Appearance: underlined ===== */
66
+
67
67
  :host([appearance="underlined"]) .container {
68
68
  border: none;
69
69
  border-radius: var(--u-radius-none, 0);
@@ -91,7 +91,7 @@ var styles = css`
91
91
  border-bottom-color: var(--u-input-border-color-invalid, #C62828);
92
92
  }
93
93
 
94
- /* ===== Appearance: plain (외형 없음) ===== */
94
+
95
95
  :host([appearance="plain"]) .container {
96
96
  border: none;
97
97
  border-radius: var(--u-radius-none, 0);
@@ -103,14 +103,14 @@ var styles = css`
103
103
  :host([appearance="plain"]:not([readonly]):not(:disabled)) .container:focus-within {
104
104
  box-shadow: none;
105
105
  }
106
- /* 외형이 없어도 포커스는 보여야 한다(WCAG 2.4.7) — 쉬는 동안은 아무것도 그리지 않고, 포커스가
107
- 들어오면 링을 그린다. 깜박이는 캐럿만으로는 «어디에 포커스가 있는가» 를 알리기 어렵다. */
106
+
107
+
108
108
  :host([appearance="plain"]:not(:disabled)) .container:focus-within {
109
109
  outline: 2px solid var(--u-focus-ring-color, #1565C0);
110
110
  outline-offset: 2px;
111
111
  }
112
112
 
113
- /* ===== Textarea 요소 ===== */
113
+
114
114
  textarea {
115
115
  display: block;
116
116
  border: none;
@@ -162,7 +162,7 @@ var styles = css`
162
162
  resize: none;
163
163
  }
164
164
 
165
- /* ===== 카운터 ===== */
165
+
166
166
  .counter {
167
167
  margin-top: 0.25em;
168
168
  text-align: right;
@@ -171,16 +171,16 @@ var styles = css`
171
171
  line-height: 1.2;
172
172
  }
173
173
 
174
- /* === Size — 버튼과 같은 세 단. md 는 주변 글자 크기를 상속하지 않는다(버튼과 높이가 갈렸다). === */
174
+
175
175
  :host {
176
176
  font-size: var(--u-density, 14px);
177
177
  }
178
178
  :host([size="sm"]) {
179
- /* 밀도 단에 비례 — 기본 밀도 14px 에서 12px. */
179
+
180
180
  font-size: calc(var(--u-density, 14px) * 6 / 7);
181
181
  }
182
182
  :host([size="lg"]) {
183
- /* 밀도 단에 비례 — 기본 밀도 14px 에서 16px. */
183
+
184
184
  font-size: calc(var(--u-density, 14px) * 8 / 7);
185
185
  }
186
186
  `;
@@ -20,7 +20,7 @@ var styles = css`
20
20
  --tooltip-padding-inline: var(--u-space-sm, 8px);
21
21
  }
22
22
 
23
- /* 여백은 내부 요소가 진다 — :host 에 두면 소비 앱 CSS 리셋에 지워진다. */
23
+
24
24
  .base {
25
25
  box-sizing: border-box;
26
26
  width: 100%;
@@ -31,7 +31,7 @@ var styles = css`
31
31
  transform: scale(1);
32
32
  }
33
33
 
34
- /* 툴팁을 offset만큼 감싸는 보이지 않는 영역 */
34
+
35
35
  :host([interactive])::before {
36
36
  content: '';
37
37
  position: absolute;
@@ -11,9 +11,9 @@ var styles = css`
11
11
 
12
12
  :host {
13
13
  display: block;
14
- /* rem 이 아니라 em 이다 — 루트 기준이면 소비자가 컨테이너 타이포를 키워도
15
- 트리만 따라오지 않는다. 기본 상황(루트 16px)에서는 두 단위가 같은 14px 이므로
16
- 시각은 바뀌지 않고, 상속 컨텍스트에서만 동작이 달라진다. */
14
+
15
+
16
+
17
17
  font-size: 0.875em;
18
18
  color: var(--u-txt-color, #212121);
19
19
  }
@@ -17,7 +17,7 @@ var styles = css`
17
17
  pointer-events: none;
18
18
  }
19
19
 
20
- /* ── header ── */
20
+
21
21
  .header {
22
22
  display: flex;
23
23
  flex-direction: row;
@@ -26,7 +26,7 @@ var styles = css`
26
26
  padding-left: calc(
27
27
  var(--tree-indent-size) * var(--tree-item-depth)
28
28
  + var(--tree-indent-guide-offset)
29
- );\n /* 호스트 하한(--u-target-size, 미설정 = 0). */\n box-sizing: border-box;\n min-height: var(--u-target-size, 0px);
29
+ );\n \n box-sizing: border-box;\n min-height: var(--u-target-size, 0px);
30
30
  transition: background-color var(--u-duration-fast, 140ms) var(--u-ease-standard, cubic-bezier(0.2, 0, 0, 1)), color var(--u-duration-fast, 140ms) var(--u-ease-standard, cubic-bezier(0.2, 0, 0, 1));
31
31
  user-select: none;
32
32
  cursor: pointer;
@@ -48,7 +48,7 @@ var styles = css`
48
48
  margin-left: 0.2em;
49
49
  }
50
50
 
51
- /* ── content ── */
51
+
52
52
  .content {
53
53
  flex: 1;
54
54
  min-width: 0;
@@ -58,12 +58,12 @@ var styles = css`
58
58
  white-space: nowrap;
59
59
  }
60
60
 
61
- /* ── toggler ──
62
- The box that takes the pointer is 24x24 (WCAG 2.2 SC 2.5.8); the square you see is still
63
- 18x18, drawn by the pseudo-element. The negative margins give the extra 3px on each side
64
- back, so the glyph, the label and the row height sit exactly where they did — the extra
65
- area lands on the header's own padding and the gap before the label, never on another
66
- target. */
61
+
62
+
63
+
64
+
65
+
66
+
67
67
  .prefix-toggler {
68
68
  position: relative;
69
69
  box-sizing: border-box;
@@ -72,7 +72,7 @@ var styles = css`
72
72
  display: inline-flex;
73
73
  align-items: center;
74
74
  justify-content: center;
75
- /* 호스트 하한(--u-target-size)이 있으면 그 값 — 미설정이면 24px 그대로. */
75
+
76
76
  width: max(24px, var(--u-target-size, 0px));
77
77
  height: max(24px, var(--u-target-size, 0px));
78
78
  }
@@ -94,9 +94,9 @@ var styles = css`
94
94
  :host(:not([disabled])[trigger="icon"]:focus-visible) .prefix-toggler::before {
95
95
  background-color: var(--u-bg-color-hover, #F5F5F5);
96
96
  }
97
- /* A checkable row puts the checkbox 4px after the toggle. Centred 24px areas for both would
98
- overlap by 3px, so here the toggle takes its extra width entirely on the left (header
99
- padding), and the padding keeps the glyph centred on its visible square. */
97
+
98
+
99
+
100
100
  :host([checkable]) .prefix-toggler {
101
101
  margin: -3px 4px -3px -6px;
102
102
  padding-left: 6px;
@@ -105,9 +105,9 @@ var styles = css`
105
105
  inset: 3px 0 3px 6px;
106
106
  }
107
107
 
108
- /* ── checkbox ──
109
- Same split as the toggle: a 24x24 box takes the pointer, the 16x16 box you see is the
110
- pseudo-element, and the negative margins keep every visible edge where it was. */
108
+
109
+
110
+
111
111
  .prefix-checkbox {
112
112
  position: relative;
113
113
  box-sizing: border-box;
@@ -116,7 +116,7 @@ var styles = css`
116
116
  display: inline-flex;
117
117
  align-items: center;
118
118
  justify-content: center;
119
- /* 호스트 하한(--u-target-size)이 있으면 그 값 — 미설정이면 24px 그대로. */
119
+
120
120
  width: max(24px, var(--u-target-size, 0px));
121
121
  height: max(24px, var(--u-target-size, 0px));
122
122
  cursor: pointer;
@@ -148,7 +148,7 @@ var styles = css`
148
148
  visibility: visible;
149
149
  }
150
150
 
151
- /* ── children ── */
151
+
152
152
  .subtree {
153
153
  display: block;
154
154
  position: relative;
@@ -0,0 +1,29 @@
1
+ import type { Plugin } from 'vite';
2
+ /**
3
+ * Strips block comments (`/* … *\/`) from inside `css\`…\`` tagged templates.
4
+ *
5
+ * Why this exists: esbuild minifies JavaScript, but the body of a tagged template is a string
6
+ * literal, so a CSS comment written inside `css\`…\`` is shipped verbatim to every consumer. The
7
+ * design notes that explain a style rule belong in the source, not in the bundle — they cost
8
+ * gzip bytes against the size budget and leak internal context into a public artifact.
9
+ *
10
+ * Deliberately narrow: only `css\`` templates (not `html\``, whose whitespace is significant to
11
+ * rendering), only block comments, and never a comment that contains `${` — inside a template
12
+ * literal that is still an expression, not comment text, and rewriting it would change behavior.
13
+ * Each removed comment is replaced by the newlines it contained, so line numbers in the source
14
+ * map stay aligned.
15
+ */
16
+ export declare function stripCssTemplateComments(source: string): string;
17
+ /**
18
+ * Vite plugin: strips block comments from `css` tagged templates in the package's own sources before esbuild
19
+ * sees them (see `stripCssTemplateComments`).
20
+ *
21
+ * Only the package's `src/**` TypeScript that is not a test is touched — the transform's own fixtures live in
22
+ * tests, and a dependency's code is not ours to rewrite. Use it in every package that ships Lit styles:
23
+ *
24
+ * ```ts
25
+ * import stripCssComments from '@iyulab/components/plugins/vite-plugin-strip-css-comments.js';
26
+ * export default defineConfig({ plugins: [stripCssComments()] });
27
+ * ```
28
+ */
29
+ export default function stripCssComments(): Plugin;
@@ -0,0 +1,186 @@
1
+ import { resolve } from 'path';
2
+ /**
3
+ * Strips block comments (`/* … *\/`) from inside `css\`…\`` tagged templates.
4
+ *
5
+ * Why this exists: esbuild minifies JavaScript, but the body of a tagged template is a string
6
+ * literal, so a CSS comment written inside `css\`…\`` is shipped verbatim to every consumer. The
7
+ * design notes that explain a style rule belong in the source, not in the bundle — they cost
8
+ * gzip bytes against the size budget and leak internal context into a public artifact.
9
+ *
10
+ * Deliberately narrow: only `css\`` templates (not `html\``, whose whitespace is significant to
11
+ * rendering), only block comments, and never a comment that contains `${` — inside a template
12
+ * literal that is still an expression, not comment text, and rewriting it would change behavior.
13
+ * Each removed comment is replaced by the newlines it contained, so line numbers in the source
14
+ * map stay aligned.
15
+ */
16
+ export function stripCssTemplateComments(source) {
17
+ let out = '';
18
+ let cursor = 0;
19
+ while (cursor < source.length) {
20
+ const start = findCssTemplateStart(source, cursor);
21
+ if (start === -1) {
22
+ out += source.slice(cursor);
23
+ break;
24
+ }
25
+ const bodyStart = start + 'css`'.length;
26
+ out += source.slice(cursor, bodyStart);
27
+ const { text, end } = stripTemplateBody(source, bodyStart);
28
+ out += text;
29
+ cursor = end;
30
+ }
31
+ return out;
32
+ }
33
+ /** Index of the next `css\`` whose `css` is a whole identifier (so `unsafeCSS\`` is not matched). */
34
+ function findCssTemplateStart(source, from) {
35
+ let i = source.indexOf('css`', from);
36
+ while (i !== -1) {
37
+ const before = i === 0 ? '' : source[i - 1];
38
+ if (!/[\w$]/.test(before))
39
+ return i;
40
+ i = source.indexOf('css`', i + 1);
41
+ }
42
+ return -1;
43
+ }
44
+ /**
45
+ * Walks one template body starting just after the opening backtick. Returns the rewritten body
46
+ * (including the closing backtick) and the index just past it. `${…}` expressions are copied
47
+ * through untouched, including nested template literals inside them.
48
+ */
49
+ function stripTemplateBody(source, from) {
50
+ let text = '';
51
+ let i = from;
52
+ while (i < source.length) {
53
+ const ch = source[i];
54
+ if (ch === '\\') {
55
+ text += source.slice(i, i + 2);
56
+ i += 2;
57
+ continue;
58
+ }
59
+ if (ch === '`') {
60
+ return { text: text + '`', end: i + 1 };
61
+ }
62
+ if (ch === '$' && source[i + 1] === '{') {
63
+ const exprEnd = skipExpression(source, i + 2);
64
+ text += source.slice(i, exprEnd);
65
+ i = exprEnd;
66
+ continue;
67
+ }
68
+ if (ch === '/' && source[i + 1] === '*') {
69
+ const close = source.indexOf('*/', i + 2);
70
+ const templateEnd = source.indexOf('`', i + 2);
71
+ // A `*/` that lies beyond this template's closing backtick belongs to something else —
72
+ // the comment is unterminated within the template. Leave it (and a comment holding an
73
+ // expression) exactly as written rather than swallowing source past the template.
74
+ const unterminated = close === -1 || (templateEnd !== -1 && templateEnd < close);
75
+ if (unterminated) {
76
+ text += source.slice(i, i + 2);
77
+ i += 2;
78
+ continue;
79
+ }
80
+ const commentEnd = close + 2;
81
+ const comment = source.slice(i, commentEnd);
82
+ text += comment.includes('${') ? comment : comment.replace(/[^\n]/g, '');
83
+ i = commentEnd;
84
+ continue;
85
+ }
86
+ text += ch;
87
+ i++;
88
+ }
89
+ return { text, end: i };
90
+ }
91
+ /**
92
+ * Given the index just after `${`, returns the index just after the matching `}`. Tracks brace
93
+ * depth and skips string and template literals (recursing into nested templates so a `}` inside
94
+ * them is not miscounted).
95
+ */
96
+ function skipExpression(source, from) {
97
+ let depth = 1;
98
+ let i = from;
99
+ while (i < source.length) {
100
+ const ch = source[i];
101
+ if (ch === '\\') {
102
+ i += 2;
103
+ continue;
104
+ }
105
+ if (ch === '\'' || ch === '"') {
106
+ i = skipQuoted(source, i + 1, ch);
107
+ continue;
108
+ }
109
+ if (ch === '`') {
110
+ i = skipTemplate(source, i + 1);
111
+ continue;
112
+ }
113
+ if (ch === '{')
114
+ depth++;
115
+ if (ch === '}') {
116
+ depth--;
117
+ if (depth === 0)
118
+ return i + 1;
119
+ }
120
+ i++;
121
+ }
122
+ return i;
123
+ }
124
+ function skipQuoted(source, from, quote) {
125
+ let i = from;
126
+ while (i < source.length) {
127
+ if (source[i] === '\\') {
128
+ i += 2;
129
+ continue;
130
+ }
131
+ if (source[i] === quote)
132
+ return i + 1;
133
+ i++;
134
+ }
135
+ return i;
136
+ }
137
+ /** Index just past the closing backtick of a nested template literal (its `${…}` handled too). */
138
+ function skipTemplate(source, from) {
139
+ let i = from;
140
+ while (i < source.length) {
141
+ const ch = source[i];
142
+ if (ch === '\\') {
143
+ i += 2;
144
+ continue;
145
+ }
146
+ if (ch === '`')
147
+ return i + 1;
148
+ if (ch === '$' && source[i + 1] === '{') {
149
+ i = skipExpression(source, i + 2);
150
+ continue;
151
+ }
152
+ i++;
153
+ }
154
+ return i;
155
+ }
156
+ /**
157
+ * Vite plugin: strips block comments from `css` tagged templates in the package's own sources before esbuild
158
+ * sees them (see `stripCssTemplateComments`).
159
+ *
160
+ * Only the package's `src/**` TypeScript that is not a test is touched — the transform's own fixtures live in
161
+ * tests, and a dependency's code is not ours to rewrite. Use it in every package that ships Lit styles:
162
+ *
163
+ * ```ts
164
+ * import stripCssComments from '@iyulab/components/plugins/vite-plugin-strip-css-comments.js';
165
+ * export default defineConfig({ plugins: [stripCssComments()] });
166
+ * ```
167
+ */
168
+ export default function stripCssComments() {
169
+ let srcDir = '';
170
+ return {
171
+ name: 'iyulab:strip-css-comments',
172
+ enforce: 'pre',
173
+ configResolved(config) {
174
+ srcDir = resolve(config.root, 'src').replace(/\\/g, '/') + '/';
175
+ },
176
+ transform(code, id) {
177
+ const file = id.split('?')[0].replace(/\\/g, '/');
178
+ if (!file.startsWith(srcDir) || !file.endsWith('.ts') || /\.(test|spec)\.ts$/.test(file))
179
+ return null;
180
+ if (!code.includes('css`'))
181
+ return null;
182
+ const out = stripCssTemplateComments(code);
183
+ return out === code ? null : { code: out, map: null };
184
+ },
185
+ };
186
+ }
@@ -2,7 +2,6 @@ import { Locale } from "./Locale.js";
2
2
  import { isImeComposing } from "./keyboard.js";
3
3
  import "../components/button/UButton.js";
4
4
  import { UDialog } from "../components/dialog/UDialog.js";
5
- import "../components/input/UInput.js";
6
5
  import { html, nothing, render } from "lit";
7
6
  import { ifDefined } from "lit/directives/if-defined.js";
8
7
  import { unsafeHTML } from "lit/directives/unsafe-html.js";
@@ -77,6 +76,7 @@ var Dialog = class {
77
76
  * @returns 입력값 또는 취소 시 null
78
77
  */
79
78
  static async prompt(message, options) {
79
+ await import("../components/input/UInput.js");
80
80
  let inputValue = options?.defaultValue || "";
81
81
  const messageId = nextMessageId();
82
82
  return await this.present({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@iyulab/components",
3
3
  "description": "web-components library based on lit-element made by iyulab",
4
- "version": "2.18.0",
4
+ "version": "2.19.1",
5
5
  "keywords": [
6
6
  "iyulab",
7
7
  "components",
@@ -88,7 +88,7 @@
88
88
  "devDependencies": {
89
89
  "@eslint/js": "^10.0.1",
90
90
  "@types/node": "^26.1.1",
91
- "@types/react": "^19.2.14",
91
+ "@types/react": "^19.3.0",
92
92
  "@vitest/browser-playwright": "^5.0.0",
93
93
  "eslint": "^10.1.0",
94
94
  "eslint-plugin-lit": "^2.3.1",