@wcomp/elementum 0.0.0-stage → 0.2.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.
Files changed (102) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +282 -2
  3. package/custom-elements.json +3613 -0
  4. package/mcp/server.js +593 -0
  5. package/package.json +77 -4
  6. package/skills/elementum-break-ui/CATALOG.md +11 -0
  7. package/skills/elementum-break-ui/SKILL.md +16 -0
  8. package/skills/elementum-mobile/SKILL.md +18 -0
  9. package/skills/elementum-motion/SKILL.md +18 -0
  10. package/skills/elementum-motion/STANDARDS.md +15 -0
  11. package/skills/elementum-penpot/SKILL.md +45 -0
  12. package/skills/elementum-ui/CATALOG.md +14 -0
  13. package/skills/elementum-ui/SKILL.md +21 -0
  14. package/src/ag-ui.js +474 -0
  15. package/src/behaviors/index.js +760 -0
  16. package/src/components/el-accordion.js +201 -0
  17. package/src/components/el-alert-dialog.js +186 -0
  18. package/src/components/el-alert.js +254 -0
  19. package/src/components/el-aspect-ratio.js +73 -0
  20. package/src/components/el-autocomplete.js +775 -0
  21. package/src/components/el-avatar.js +271 -0
  22. package/src/components/el-badge.js +131 -0
  23. package/src/components/el-border-beam.js +135 -0
  24. package/src/components/el-breadcrumb.js +203 -0
  25. package/src/components/el-button.js +231 -0
  26. package/src/components/el-calendar.js +436 -0
  27. package/src/components/el-callout.js +158 -0
  28. package/src/components/el-card.js +298 -0
  29. package/src/components/el-carousel.js +308 -0
  30. package/src/components/el-chart.js +632 -0
  31. package/src/components/el-checkbox-card.js +221 -0
  32. package/src/components/el-checkbox.js +208 -0
  33. package/src/components/el-chip.js +276 -0
  34. package/src/components/el-code-block.js +230 -0
  35. package/src/components/el-collapsible.js +124 -0
  36. package/src/components/el-command.js +556 -0
  37. package/src/components/el-context-menu.js +328 -0
  38. package/src/components/el-data-list.js +210 -0
  39. package/src/components/el-datepicker.js +192 -0
  40. package/src/components/el-dialog.js +272 -0
  41. package/src/components/el-diff-viewer.js +441 -0
  42. package/src/components/el-drawer.js +782 -0
  43. package/src/components/el-dropdown.js +182 -0
  44. package/src/components/el-dropzone.js +242 -0
  45. package/src/components/el-empty-state.js +130 -0
  46. package/src/components/el-field.js +394 -0
  47. package/src/components/el-form.js +185 -0
  48. package/src/components/el-input.js +229 -0
  49. package/src/components/el-inset.js +90 -0
  50. package/src/components/el-insight-card.js +263 -0
  51. package/src/components/el-kbd.js +151 -0
  52. package/src/components/el-menubar.js +254 -0
  53. package/src/components/el-meter.js +183 -0
  54. package/src/components/el-navbar.js +294 -0
  55. package/src/components/el-navigation-menu.js +327 -0
  56. package/src/components/el-number-field.js +510 -0
  57. package/src/components/el-number-flow.js +164 -0
  58. package/src/components/el-otp-input.js +266 -0
  59. package/src/components/el-pagination.js +231 -0
  60. package/src/components/el-popover.js +288 -0
  61. package/src/components/el-preview-card.js +202 -0
  62. package/src/components/el-progress.js +179 -0
  63. package/src/components/el-prompt-input.js +383 -0
  64. package/src/components/el-radio-card.js +360 -0
  65. package/src/components/el-radio.js +257 -0
  66. package/src/components/el-rating.js +165 -0
  67. package/src/components/el-reasoning-card.js +293 -0
  68. package/src/components/el-resizable.js +324 -0
  69. package/src/components/el-router.js +305 -0
  70. package/src/components/el-scroll-area.js +150 -0
  71. package/src/components/el-segmented-control.js +282 -0
  72. package/src/components/el-select.js +220 -0
  73. package/src/components/el-separator.js +85 -0
  74. package/src/components/el-sidebar.js +386 -0
  75. package/src/components/el-skeleton.js +156 -0
  76. package/src/components/el-slider.js +351 -0
  77. package/src/components/el-sources.js +288 -0
  78. package/src/components/el-spinner.js +159 -0
  79. package/src/components/el-streaming-text.js +199 -0
  80. package/src/components/el-switch.js +221 -0
  81. package/src/components/el-table.js +397 -0
  82. package/src/components/el-tabs.js +235 -0
  83. package/src/components/el-task-list.js +230 -0
  84. package/src/components/el-textarea.js +175 -0
  85. package/src/components/el-theme-switch.js +120 -0
  86. package/src/components/el-timeline.js +254 -0
  87. package/src/components/el-toast.js +778 -0
  88. package/src/components/el-toggle.js +311 -0
  89. package/src/components/el-tool-call.js +386 -0
  90. package/src/components/el-toolbar.js +183 -0
  91. package/src/components/el-tooltip.js +172 -0
  92. package/src/components/el-tree-view.js +261 -0
  93. package/src/components/el-visually-hidden.js +32 -0
  94. package/src/elementum.js +504 -0
  95. package/src/index.d.ts +1093 -0
  96. package/src/index.js +112 -0
  97. package/src/signal.js +215 -0
  98. package/src/ssr.js +136 -0
  99. package/src/template.js +321 -0
  100. package/src/tokens.css +416 -0
  101. package/tokens/figma-tokens.json +69 -0
  102. package/tokens/penpot-tokens.json +98 -0
@@ -0,0 +1,436 @@
1
+ /**
2
+ * <el-calendar>
3
+ * Standalone accessible calendar month-grid component.
4
+ */
5
+
6
+ import { Elementum } from '../elementum.js';
7
+ import { html, css } from '../template.js';
8
+ import { signal, computed } from '../signal.js';
9
+ import { formatLocaleDate } from '../behaviors/index.js';
10
+
11
+ const MONTH_NAMES = [
12
+ 'January', 'February', 'March', 'April', 'May', 'June',
13
+ 'July', 'August', 'September', 'October', 'November', 'December'
14
+ ];
15
+
16
+ const WEEKDAYS = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
17
+
18
+ function getLocalizedMonths(locale) {
19
+ if (!locale || locale === 'en-US') return MONTH_NAMES;
20
+ return Array.from({ length: 12 }, (_, m) =>
21
+ formatLocaleDate(new Date(2026, m, 15), locale, { month: 'long' })
22
+ );
23
+ }
24
+
25
+ function getLocalizedWeekdays(locale) {
26
+ if (!locale || locale === 'en-US') return WEEKDAYS;
27
+ // 2026-01-04 is a Sunday
28
+ return Array.from({ length: 7 }, (_, d) =>
29
+ formatLocaleDate(new Date(2026, 0, 4 + d), locale, { weekday: 'short' }).slice(0, 2)
30
+ );
31
+ }
32
+
33
+ function padZero(n) {
34
+ return n < 10 ? '0' + n : String(n);
35
+ }
36
+
37
+ function formatDateString(year, month, day) {
38
+ return `${year}-${padZero(month + 1)}-${padZero(day)}`;
39
+ }
40
+
41
+ export class ElCalendar extends Elementum {
42
+ static observedAttributes = ['value', 'min-year', 'max-year', 'locale'];
43
+
44
+ value = signal(''); // 'YYYY-MM-DD'
45
+ viewYear = signal(new Date().getFullYear());
46
+ viewMonth = signal(new Date().getMonth()); // 0 - 11
47
+ minYear = signal(new Date().getFullYear() - 50);
48
+ maxYear = signal(new Date().getFullYear() + 20);
49
+ locale = signal('en-US');
50
+
51
+ monthTitle = computed(() => {
52
+ const months = getLocalizedMonths(this.locale.value);
53
+ return `${months[this.viewMonth.value]} ${this.viewYear.value}`;
54
+ });
55
+
56
+ static styles = css`
57
+ :host {
58
+ display: inline-block;
59
+ user-select: none;
60
+ font-family: inherit;
61
+ width: 280px;
62
+ }
63
+
64
+ .calendar {
65
+ display: flex;
66
+ flex-direction: column;
67
+ gap: var(--el-spacing-sm, 8px);
68
+ }
69
+
70
+ .header {
71
+ display: flex;
72
+ align-items: center;
73
+ justify-content: space-between;
74
+ padding: 0 var(--el-spacing-xs, 4px);
75
+ }
76
+
77
+ .header-controls {
78
+ display: flex;
79
+ align-items: center;
80
+ gap: 4px;
81
+ }
82
+
83
+ .header-select {
84
+ appearance: none;
85
+ -webkit-appearance: none;
86
+ background: transparent;
87
+ border: 1px solid transparent;
88
+ border-radius: var(--el-radius-sm, 4px);
89
+ color: var(--el-text-base, #111827);
90
+ font-size: 0.875rem;
91
+ font-weight: 600;
92
+ font-family: inherit;
93
+ padding: 3px 6px;
94
+ cursor: pointer;
95
+ outline: none;
96
+ transition: background-color 0.15s ease, border-color 0.15s ease;
97
+ text-align: center;
98
+ }
99
+
100
+ .header-select:hover {
101
+ background: var(--el-surface-muted, #f3f4f6);
102
+ border-color: var(--el-surface-border, #e5e7eb);
103
+ }
104
+
105
+ .header-select:focus-visible {
106
+ border-color: var(--el-color-primary, #2563eb);
107
+ box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
108
+ }
109
+
110
+ .header-select option {
111
+ background: var(--el-surface-base, #ffffff);
112
+ color: var(--el-text-base, #111827);
113
+ font-weight: 500;
114
+ }
115
+
116
+ :root[data-theme="dark"] .header-select option {
117
+ background: #1e293b;
118
+ color: #f8fafc;
119
+ }
120
+
121
+ .header-title {
122
+ font-weight: 600;
123
+ font-size: 0.9375rem;
124
+ color: var(--el-text-base, #111827);
125
+ }
126
+
127
+ .nav-btn {
128
+ display: inline-flex;
129
+ align-items: center;
130
+ justify-content: center;
131
+ width: 28px;
132
+ height: 28px;
133
+ border: 1px solid var(--el-surface-border, #e5e7eb);
134
+ background: var(--el-surface-base, #ffffff);
135
+ border-radius: var(--el-radius-sm, 4px);
136
+ cursor: pointer;
137
+ color: var(--el-text-base, #111827);
138
+ font-size: 0.75rem;
139
+ transition: background-color 0.15s ease;
140
+ }
141
+
142
+ .nav-btn:hover {
143
+ background: var(--el-surface-muted, #f3f4f6);
144
+ }
145
+
146
+ .weekdays {
147
+ display: grid;
148
+ grid-template-columns: repeat(7, 1fr);
149
+ text-align: center;
150
+ font-size: 0.75rem;
151
+ font-weight: 600;
152
+ color: var(--el-text-muted, #6b7280);
153
+ margin-bottom: var(--el-spacing-xs, 4px);
154
+ }
155
+
156
+ .grid {
157
+ display: grid;
158
+ grid-template-columns: repeat(7, 1fr);
159
+ gap: 2px;
160
+ }
161
+
162
+ .day {
163
+ display: flex;
164
+ align-items: center;
165
+ justify-content: center;
166
+ height: 32px;
167
+ font-size: 0.8125rem;
168
+ border: 1px solid transparent;
169
+ border-radius: var(--el-radius-sm, 4px);
170
+ background: transparent;
171
+ cursor: pointer;
172
+ color: var(--el-text-base, #111827);
173
+ transition: background-color 0.12s ease;
174
+ outline: none;
175
+ }
176
+
177
+ .day:hover:not(.disabled) {
178
+ background: var(--el-surface-muted, #f3f4f6);
179
+ }
180
+
181
+ .day.other-month {
182
+ color: var(--el-text-muted, #9ca3af);
183
+ opacity: 0.5;
184
+ }
185
+
186
+ .day.today {
187
+ font-weight: 700;
188
+ border-color: var(--el-color-primary, #2563eb);
189
+ }
190
+
191
+ .day.selected {
192
+ background: var(--el-color-primary, #2563eb) !important;
193
+ color: var(--el-text-inverse, #ffffff) !important;
194
+ font-weight: 600;
195
+ }
196
+ `;
197
+
198
+ connected() {
199
+ // If an initial value was provided, sync the initial view to it
200
+ if (this.hasAttribute('min-year')) {
201
+ const parsed = Number(this.getAttribute('min-year'));
202
+ if (!isNaN(parsed)) this.minYear.value = parsed;
203
+ }
204
+ if (this.hasAttribute('max-year')) {
205
+ const parsed = Number(this.getAttribute('max-year'));
206
+ if (!isNaN(parsed)) this.maxYear.value = parsed;
207
+ }
208
+ if (this.hasAttribute('locale')) {
209
+ this.locale.value = this.getAttribute('locale') || 'en-US';
210
+ }
211
+ if (this.value.value) {
212
+ const parts = this.value.value.split('-').map(Number);
213
+ if (parts.length === 3) {
214
+ this.viewYear.value = parts[0];
215
+ this.viewMonth.value = parts[1] - 1;
216
+ }
217
+ }
218
+ }
219
+
220
+ attributeChanged(name, oldValue, newValue) {
221
+ if (name === 'value' && newValue) {
222
+ this.value.value = newValue;
223
+ const parts = newValue.split('-').map(Number);
224
+ if (parts.length === 3) {
225
+ this.viewYear.value = parts[0];
226
+ this.viewMonth.value = parts[1] - 1;
227
+ }
228
+ } else if (name === 'min-year' && newValue) {
229
+ const parsed = Number(newValue);
230
+ if (!isNaN(parsed)) this.minYear.value = parsed;
231
+ } else if (name === 'max-year' && newValue) {
232
+ const parsed = Number(newValue);
233
+ if (!isNaN(parsed)) this.maxYear.value = parsed;
234
+ } else if (name === 'locale') {
235
+ this.locale.value = newValue || 'en-US';
236
+ }
237
+ return true;
238
+ }
239
+
240
+ setMonth(m) {
241
+ const month = Number(m);
242
+ if (!isNaN(month) && month >= 0 && month <= 11) {
243
+ this.viewMonth.value = month;
244
+ }
245
+ }
246
+
247
+ setYear(y) {
248
+ const year = Number(y);
249
+ if (!isNaN(year)) {
250
+ this.viewYear.value = year;
251
+ }
252
+ }
253
+
254
+ #onMonthSelect = (e) => {
255
+ this.setMonth(e.target.value);
256
+ };
257
+
258
+ #onYearSelect = (e) => {
259
+ this.setYear(e.target.value);
260
+ };
261
+
262
+ #generateYears() {
263
+ const currentYear = new Date().getFullYear();
264
+ const min = Number(this.minYear.value) || (currentYear - 50);
265
+ const max = Number(this.maxYear.value) || (currentYear + 20);
266
+ const years = [];
267
+ for (let y = min; y <= max; y++) {
268
+ years.push(y);
269
+ }
270
+ return years;
271
+ }
272
+
273
+ prevMonth = () => {
274
+ let m = this.viewMonth.value - 1;
275
+ let y = this.viewYear.value;
276
+ if (m < 0) {
277
+ m = 11;
278
+ y -= 1;
279
+ }
280
+ this.viewMonth.value = m;
281
+ this.viewYear.value = y;
282
+ };
283
+
284
+ nextMonth = () => {
285
+ let m = this.viewMonth.value + 1;
286
+ let y = this.viewYear.value;
287
+ if (m > 11) {
288
+ m = 0;
289
+ y += 1;
290
+ }
291
+ this.viewMonth.value = m;
292
+ this.viewYear.value = y;
293
+ };
294
+
295
+ #selectDate = (dateStr) => {
296
+ this.value.value = dateStr;
297
+ this.emit('select', { date: dateStr });
298
+ };
299
+
300
+ #generateDays() {
301
+ const year = this.viewYear.value;
302
+ const month = this.viewMonth.value;
303
+
304
+ const firstDayIndex = new Date(year, month, 1).getDay();
305
+ const daysInCurrentMonth = new Date(year, month + 1, 0).getDate();
306
+ const daysInPrevMonth = new Date(year, month, 0).getDate();
307
+
308
+ const todayStr = formatDateString(
309
+ new Date().getFullYear(),
310
+ new Date().getMonth(),
311
+ new Date().getDate()
312
+ );
313
+
314
+ const cells = [];
315
+
316
+ // Previous month spillover days
317
+ for (let i = firstDayIndex - 1; i >= 0; i--) {
318
+ const day = daysInPrevMonth - i;
319
+ const prevM = month === 0 ? 11 : month - 1;
320
+ const prevY = month === 0 ? year - 1 : year;
321
+ const dateStr = formatDateString(prevY, prevM, day);
322
+
323
+ cells.push({
324
+ day,
325
+ dateStr,
326
+ isOtherMonth: true,
327
+ isToday: dateStr === todayStr,
328
+ isSelected: dateStr === this.value.value,
329
+ });
330
+ }
331
+
332
+ // Current month days
333
+ for (let day = 1; day <= daysInCurrentMonth; day++) {
334
+ const dateStr = formatDateString(year, month, day);
335
+ cells.push({
336
+ day,
337
+ dateStr,
338
+ isOtherMonth: false,
339
+ isToday: dateStr === todayStr,
340
+ isSelected: dateStr === this.value.value,
341
+ });
342
+ }
343
+
344
+ // Next month spillover days to reach 42 cells (6 rows x 7 columns)
345
+ const remaining = 42 - cells.length;
346
+ for (let day = 1; day <= remaining; day++) {
347
+ const nextM = month === 11 ? 0 : month + 1;
348
+ const nextY = month === 11 ? year + 1 : year;
349
+ const dateStr = formatDateString(nextY, nextM, day);
350
+
351
+ cells.push({
352
+ day,
353
+ dateStr,
354
+ isOtherMonth: true,
355
+ isToday: dateStr === todayStr,
356
+ isSelected: dateStr === this.value.value,
357
+ });
358
+ }
359
+
360
+ return cells;
361
+ }
362
+
363
+ render() {
364
+ return html`
365
+ <div class="calendar" part="calendar">
366
+ <div class="header">
367
+ <button type="button" class="nav-btn" @click=${this.prevMonth} aria-label="Previous Month">◀</button>
368
+ <div class="header-controls">
369
+ <select
370
+ class="header-select month-select"
371
+ aria-label="Select month"
372
+ @change=${this.#onMonthSelect}
373
+ >
374
+ ${() =>
375
+ getLocalizedMonths(this.locale.value).map(
376
+ (name, idx) => html`
377
+ <option
378
+ value="${idx}"
379
+ ?selected=${() => this.viewMonth.value === idx}
380
+ >
381
+ ${name}
382
+ </option>
383
+ `
384
+ )}
385
+ </select>
386
+ <select
387
+ class="header-select year-select"
388
+ aria-label="Select year"
389
+ @change=${this.#onYearSelect}
390
+ >
391
+ ${() =>
392
+ this.#generateYears().map(
393
+ (y) => html`
394
+ <option
395
+ value="${y}"
396
+ ?selected=${() => this.viewYear.value === y}
397
+ >
398
+ ${y}
399
+ </option>
400
+ `
401
+ )}
402
+ </select>
403
+ </div>
404
+ <button type="button" class="nav-btn" @click=${this.nextMonth} aria-label="Next Month">▶</button>
405
+ </div>
406
+
407
+ <div class="weekdays">
408
+ ${() => getLocalizedWeekdays(this.locale.value).map((w) => html`<div>${w}</div>`)}
409
+ </div>
410
+
411
+ <div class="grid" role="grid">
412
+ ${() =>
413
+ this.#generateDays().map(
414
+ (cell) => html`
415
+ <button
416
+ type="button"
417
+ class=${() =>
418
+ `day ${cell.isOtherMonth ? 'other-month' : ''} ${cell.isToday ? 'today' : ''} ${
419
+ cell.isSelected ? 'selected' : ''
420
+ }`}
421
+ aria-selected=${() => (cell.isSelected ? 'true' : 'false')}
422
+ @click=${() => this.#selectDate(cell.dateStr)}
423
+ >
424
+ ${cell.day}
425
+ </button>
426
+ `
427
+ )}
428
+ </div>
429
+ </div>
430
+ `;
431
+ }
432
+ }
433
+
434
+ if (typeof customElements !== 'undefined' && !customElements.get('el-calendar')) {
435
+ customElements.define('el-calendar', ElCalendar);
436
+ }
@@ -0,0 +1,158 @@
1
+ import { Elementum } from '../elementum.js';
2
+ import { html, css } from '../template.js';
3
+ import { signal } from '../signal.js';
4
+
5
+ /**
6
+ * <el-callout>
7
+ * Inline callout banner inspired by Radix Themes.
8
+ * Supports variants (info, success, warning, danger) and slots for icon, title, and body.
9
+ */
10
+ export class ElCallout extends Elementum {
11
+ static observedAttributes = ['variant', 'size'];
12
+
13
+ variant = signal('info');
14
+ size = signal('md');
15
+
16
+ static styles = css`
17
+ :host {
18
+ display: flex;
19
+ align-items: flex-start;
20
+ gap: 12px;
21
+ padding: 12px 16px;
22
+ border-radius: var(--el-radius-md, 8px);
23
+ border: 1px solid transparent;
24
+ font-family: inherit;
25
+ font-size: var(--el-text-sm, 0.875rem);
26
+ line-height: 1.5;
27
+ box-sizing: border-box;
28
+ transition: background-color 0.2s ease, border-color 0.2s ease;
29
+ }
30
+
31
+ :host([size="sm"]) {
32
+ padding: 8px 12px;
33
+ font-size: 0.8125rem;
34
+ gap: 8px;
35
+ }
36
+
37
+ :host([size="lg"]) {
38
+ padding: 16px 20px;
39
+ font-size: 1rem;
40
+ gap: 16px;
41
+ }
42
+
43
+ /* Info & Primary */
44
+ :host, :host([variant="info"]), :host([variant="primary"]) {
45
+ background-color: rgba(37, 99, 235, 0.08);
46
+ border-color: rgba(37, 99, 235, 0.2);
47
+ color: #1e40af;
48
+ }
49
+ :host-context([data-theme="dark"]), :host-context([data-theme="dark"])[variant="info"], :host-context([data-theme="dark"])[variant="primary"] {
50
+ background-color: rgba(59, 130, 246, 0.12);
51
+ border-color: rgba(59, 130, 246, 0.25);
52
+ color: #93c5fd;
53
+ }
54
+
55
+ /* Secondary */
56
+ :host([variant="secondary"]) {
57
+ background-color: var(--el-surface-muted, #f1f5f9);
58
+ border-color: var(--el-surface-border, #e2e8f0);
59
+ color: var(--el-text-secondary, #475569);
60
+ }
61
+ :host-context([data-theme="dark"])[variant="secondary"] {
62
+ background-color: rgba(30, 41, 59, 0.7);
63
+ border-color: #334155;
64
+ color: #cbd5e1;
65
+ }
66
+
67
+ /* Success */
68
+ :host([variant="success"]) {
69
+ background-color: rgba(16, 185, 129, 0.08);
70
+ border-color: rgba(16, 185, 129, 0.25);
71
+ color: #065f46;
72
+ }
73
+ :host-context([data-theme="dark"])[variant="success"] {
74
+ background-color: rgba(16, 185, 129, 0.12);
75
+ border-color: rgba(16, 185, 129, 0.25);
76
+ color: #6ee7b7;
77
+ }
78
+
79
+ /* Warning */
80
+ :host([variant="warning"]) {
81
+ background-color: rgba(245, 158, 11, 0.08);
82
+ border-color: rgba(245, 158, 11, 0.25);
83
+ color: #92400e;
84
+ }
85
+ :host-context([data-theme="dark"])[variant="warning"] {
86
+ background-color: rgba(245, 158, 11, 0.12);
87
+ border-color: rgba(245, 158, 11, 0.25);
88
+ color: #fcd34d;
89
+ }
90
+
91
+ /* Danger */
92
+ :host([variant="danger"]) {
93
+ background-color: rgba(239, 68, 68, 0.08);
94
+ border-color: rgba(239, 68, 68, 0.25);
95
+ color: #991b1b;
96
+ }
97
+ :host-context([data-theme="dark"])[variant="danger"] {
98
+ background-color: rgba(239, 68, 68, 0.12);
99
+ border-color: rgba(239, 68, 68, 0.25);
100
+ color: #fca5a5;
101
+ }
102
+
103
+ .icon-wrapper {
104
+ display: flex;
105
+ align-items: center;
106
+ justify-content: center;
107
+ flex-shrink: 0;
108
+ margin-top: 2px;
109
+ font-size: 1.15em;
110
+ }
111
+
112
+ .content-wrapper {
113
+ flex: 1;
114
+ min-width: 0;
115
+ }
116
+
117
+ ::slotted([slot="title"]) {
118
+ font-weight: 600;
119
+ margin-bottom: 2px;
120
+ display: block;
121
+ color: inherit;
122
+ }
123
+ `;
124
+
125
+ connected() {
126
+ this.variant.value = this.getAttribute('variant') || 'info';
127
+ this.size.value = this.getAttribute('size') || 'md';
128
+ }
129
+
130
+ attributeChanged(name, oldValue, newValue) {
131
+ if (name === 'variant') this.variant.value = newValue || 'info';
132
+ if (name === 'size') this.size.value = newValue || 'md';
133
+ }
134
+
135
+ #getDefaultIcon() {
136
+ const v = this.variant.value;
137
+ if (v === 'success') return '✓';
138
+ if (v === 'warning') return '⚠';
139
+ if (v === 'danger') return '✕';
140
+ return 'ℹ';
141
+ }
142
+
143
+ render() {
144
+ return html`
145
+ <div class="icon-wrapper" aria-hidden="true">
146
+ <slot name="icon">${() => this.#getDefaultIcon()}</slot>
147
+ </div>
148
+ <div class="content-wrapper">
149
+ <slot name="title"></slot>
150
+ <slot></slot>
151
+ </div>
152
+ `;
153
+ }
154
+ }
155
+
156
+ if (typeof customElements !== 'undefined' && !customElements.get('el-callout')) {
157
+ customElements.define('el-callout', ElCallout);
158
+ }