@wcomp/elementum 0.0.0-stage → 0.1.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 (101) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +266 -2
  3. package/custom-elements.json +3613 -0
  4. package/mcp/server.js +408 -0
  5. package/package.json +72 -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/components/el-accordion.js +201 -0
  16. package/src/components/el-alert-dialog.js +186 -0
  17. package/src/components/el-alert.js +254 -0
  18. package/src/components/el-aspect-ratio.js +73 -0
  19. package/src/components/el-autocomplete.js +775 -0
  20. package/src/components/el-avatar.js +271 -0
  21. package/src/components/el-badge.js +131 -0
  22. package/src/components/el-border-beam.js +135 -0
  23. package/src/components/el-breadcrumb.js +203 -0
  24. package/src/components/el-button.js +220 -0
  25. package/src/components/el-calendar.js +413 -0
  26. package/src/components/el-callout.js +158 -0
  27. package/src/components/el-card.js +298 -0
  28. package/src/components/el-carousel.js +308 -0
  29. package/src/components/el-chart.js +632 -0
  30. package/src/components/el-checkbox-card.js +221 -0
  31. package/src/components/el-checkbox.js +208 -0
  32. package/src/components/el-chip.js +276 -0
  33. package/src/components/el-code-block.js +228 -0
  34. package/src/components/el-collapsible.js +124 -0
  35. package/src/components/el-command.js +556 -0
  36. package/src/components/el-context-menu.js +328 -0
  37. package/src/components/el-data-list.js +210 -0
  38. package/src/components/el-datepicker.js +192 -0
  39. package/src/components/el-dialog.js +272 -0
  40. package/src/components/el-diff-viewer.js +441 -0
  41. package/src/components/el-drawer.js +782 -0
  42. package/src/components/el-dropdown.js +182 -0
  43. package/src/components/el-dropzone.js +242 -0
  44. package/src/components/el-empty-state.js +130 -0
  45. package/src/components/el-field.js +394 -0
  46. package/src/components/el-form.js +185 -0
  47. package/src/components/el-input.js +212 -0
  48. package/src/components/el-inset.js +90 -0
  49. package/src/components/el-insight-card.js +263 -0
  50. package/src/components/el-kbd.js +151 -0
  51. package/src/components/el-menubar.js +254 -0
  52. package/src/components/el-meter.js +182 -0
  53. package/src/components/el-navbar.js +294 -0
  54. package/src/components/el-navigation-menu.js +327 -0
  55. package/src/components/el-number-field.js +510 -0
  56. package/src/components/el-number-flow.js +153 -0
  57. package/src/components/el-otp-input.js +266 -0
  58. package/src/components/el-pagination.js +229 -0
  59. package/src/components/el-popover.js +288 -0
  60. package/src/components/el-preview-card.js +202 -0
  61. package/src/components/el-progress.js +179 -0
  62. package/src/components/el-prompt-input.js +383 -0
  63. package/src/components/el-radio-card.js +360 -0
  64. package/src/components/el-radio.js +257 -0
  65. package/src/components/el-rating.js +165 -0
  66. package/src/components/el-reasoning-card.js +293 -0
  67. package/src/components/el-resizable.js +324 -0
  68. package/src/components/el-router.js +305 -0
  69. package/src/components/el-scroll-area.js +150 -0
  70. package/src/components/el-segmented-control.js +282 -0
  71. package/src/components/el-select.js +219 -0
  72. package/src/components/el-separator.js +85 -0
  73. package/src/components/el-sidebar.js +386 -0
  74. package/src/components/el-skeleton.js +156 -0
  75. package/src/components/el-slider.js +351 -0
  76. package/src/components/el-sources.js +288 -0
  77. package/src/components/el-spinner.js +159 -0
  78. package/src/components/el-streaming-text.js +199 -0
  79. package/src/components/el-switch.js +221 -0
  80. package/src/components/el-table.js +397 -0
  81. package/src/components/el-tabs.js +235 -0
  82. package/src/components/el-task-list.js +230 -0
  83. package/src/components/el-textarea.js +175 -0
  84. package/src/components/el-theme-switch.js +120 -0
  85. package/src/components/el-timeline.js +254 -0
  86. package/src/components/el-toast.js +778 -0
  87. package/src/components/el-toggle.js +311 -0
  88. package/src/components/el-tool-call.js +386 -0
  89. package/src/components/el-toolbar.js +183 -0
  90. package/src/components/el-tooltip.js +172 -0
  91. package/src/components/el-tree-view.js +261 -0
  92. package/src/components/el-visually-hidden.js +32 -0
  93. package/src/elementum.js +485 -0
  94. package/src/index.d.ts +1007 -0
  95. package/src/index.js +99 -0
  96. package/src/signal.js +194 -0
  97. package/src/ssr.js +136 -0
  98. package/src/template.js +321 -0
  99. package/src/tokens.css +416 -0
  100. package/tokens/figma-tokens.json +69 -0
  101. package/tokens/penpot-tokens.json +98 -0
@@ -0,0 +1,85 @@
1
+ /**
2
+ * <el-separator>
3
+ * Accessible, zero-dependency divider primitive inspired by Base UI.
4
+ * Renders semantic horizontal or vertical rules with responsive token theming.
5
+ */
6
+
7
+ import { Elementum } from '../elementum.js';
8
+ import { html, css } from '../template.js';
9
+ import { signal } from '../signal.js';
10
+
11
+ export class ElSeparator extends Elementum {
12
+ static observedAttributes = ['orientation', 'decorative'];
13
+
14
+ orientation = signal('horizontal');
15
+ decorative = signal(false);
16
+
17
+ static styles = css`
18
+ :host {
19
+ display: block;
20
+ box-sizing: border-box;
21
+ }
22
+
23
+ :host([orientation="horizontal"]),
24
+ .separator.horizontal {
25
+ width: 100%;
26
+ height: 1px;
27
+ background: var(--el-surface-border, #e2e8f0);
28
+ margin: var(--el-spacing-sm, 8px) 0;
29
+ }
30
+
31
+ :host([orientation="vertical"]),
32
+ .separator.vertical {
33
+ width: 1px;
34
+ height: 100%;
35
+ min-height: 20px;
36
+ background: var(--el-surface-border, #e2e8f0);
37
+ margin: 0 var(--el-spacing-sm, 8px);
38
+ display: inline-block;
39
+ }
40
+
41
+ :root[data-theme="dark"] .separator,
42
+ :root[data-theme="dark"]:host([orientation="horizontal"]),
43
+ :root[data-theme="dark"]:host([orientation="vertical"]) {
44
+ background: #334155;
45
+ }
46
+ `;
47
+
48
+ connected() {
49
+ if (this.hasAttribute('orientation')) this.orientation.value = this.getAttribute('orientation');
50
+ this.decorative.value = this.getAttribute('decorative') === 'true';
51
+
52
+ if (this.decorative.value) {
53
+ this.setAttribute('role', 'none');
54
+ } else {
55
+ this.setAttribute('role', 'separator');
56
+ this.setAttribute('aria-orientation', this.orientation.value);
57
+ }
58
+ }
59
+
60
+ attributeChanged(name, oldValue, newValue) {
61
+ if (name === 'orientation') {
62
+ this.orientation.value = newValue === 'vertical' ? 'vertical' : 'horizontal';
63
+ if (!this.decorative.value) {
64
+ this.setAttribute('aria-orientation', this.orientation.value);
65
+ }
66
+ } else if (name === 'decorative') {
67
+ this.decorative.value = newValue === 'true';
68
+ this.setAttribute('role', this.decorative.value ? 'none' : 'separator');
69
+ }
70
+ return true;
71
+ }
72
+
73
+ render() {
74
+ return html`
75
+ <div
76
+ class=${() => `separator ${this.orientation.value}`}
77
+ part="separator"
78
+ ></div>
79
+ `;
80
+ }
81
+ }
82
+
83
+ if (typeof customElements !== 'undefined' && !customElements.get('el-separator')) {
84
+ customElements.define('el-separator', ElSeparator);
85
+ }
@@ -0,0 +1,386 @@
1
+ /**
2
+ * <el-sidebar> family
3
+ * Accessible collapsible application sidebar inspired by shadcn/ui.
4
+ * Includes <el-sidebar-header>, <el-sidebar-content>, <el-sidebar-footer>,
5
+ * and <el-sidebar-trigger> with smooth width transitions and responsive mobile drawers.
6
+ */
7
+
8
+ import { Elementum } from '../elementum.js';
9
+ import { html, css } from '../template.js';
10
+ import { signal } from '../signal.js';
11
+
12
+ export class ElSidebarTrigger extends Elementum {
13
+ static styles = css`
14
+ :host {
15
+ display: inline-flex;
16
+ align-items: center;
17
+ justify-content: center;
18
+ box-sizing: border-box;
19
+ flex-shrink: 0;
20
+ z-index: 20;
21
+ }
22
+
23
+ button {
24
+ display: inline-flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ min-width: 32px;
28
+ min-height: 32px;
29
+ width: auto;
30
+ height: auto;
31
+ padding: 6px;
32
+ border-radius: var(--el-radius-md, 8px);
33
+ border: 1px solid var(--el-surface-border, #e2e8f0);
34
+ background: var(--el-surface-elevated, #ffffff);
35
+ color: var(--el-text-primary, #0f172a);
36
+ cursor: pointer;
37
+ outline: none;
38
+ transition: background-color 0.15s ease, transform 0.15s ease;
39
+ }
40
+
41
+ :root[data-theme="dark"] button {
42
+ background: #1e293b;
43
+ border-color: #334155;
44
+ color: #f8fafc;
45
+ }
46
+
47
+ button:hover {
48
+ background: var(--el-surface-muted, #f1f5f9);
49
+ transform: scale(1.05);
50
+ }
51
+
52
+ :root[data-theme="dark"] button:hover {
53
+ background: #334155;
54
+ }
55
+ `;
56
+
57
+ #onClick = (e) => {
58
+ e.stopPropagation();
59
+ const forId = this.getAttribute('for');
60
+ const sidebar =
61
+ (forId ? document.getElementById(forId) : null) ||
62
+ this.closest('el-sidebar') ||
63
+ this.parentElement?.querySelector('el-sidebar') ||
64
+ document.querySelector('el-sidebar');
65
+ sidebar?.toggle();
66
+ };
67
+
68
+ render() {
69
+ return html`
70
+ <button type="button" aria-label="Toggle Sidebar" @click=${this.#onClick}>
71
+ <slot>
72
+ <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect width="18" height="18" x="3" y="3" rx="2"/><path d="M9 3v18"/></svg>
73
+ </slot>
74
+ </button>
75
+ `;
76
+ }
77
+ }
78
+
79
+ export class ElSidebarHeader extends Elementum {
80
+ static observedAttributes = ['collapsed'];
81
+ static styles = css`
82
+ :host {
83
+ display: flex;
84
+ align-items: center;
85
+ justify-content: space-between;
86
+ gap: 8px;
87
+ padding: 12px 16px;
88
+ border-bottom: 1px solid var(--el-surface-border, #e2e8f0);
89
+ box-sizing: border-box;
90
+ flex-shrink: 0;
91
+ color: var(--el-text-primary, #0f172a);
92
+ transition: padding 0.2s ease;
93
+ }
94
+
95
+ :host([collapsed]) {
96
+ padding: 8px 4px !important;
97
+ justify-content: center !important;
98
+ }
99
+
100
+ :host([collapsed]) ::slotted(.collapsible-text),
101
+ :host([collapsed]) .collapsible-text {
102
+ display: none !important;
103
+ }
104
+
105
+ :host([collapsed]) ::slotted(div),
106
+ :host([collapsed]) ::slotted(*) {
107
+ justify-content: center !important;
108
+ }
109
+ `;
110
+
111
+ connected() {
112
+ this.#syncCollapsed(this.hasAttribute('collapsed') && this.getAttribute('collapsed') !== 'false');
113
+ }
114
+
115
+ attributeChanged(name, oldValue, newValue) {
116
+ if (name === 'collapsed') {
117
+ this.#syncCollapsed(newValue !== null && newValue !== 'false');
118
+ }
119
+ }
120
+
121
+ #syncCollapsed(isCol) {
122
+ this.querySelectorAll('.collapsible-text').forEach((el) => {
123
+ el.style.display = isCol ? 'none' : '';
124
+ });
125
+ }
126
+
127
+ render() {
128
+ return html`<slot></slot>`;
129
+ }
130
+ }
131
+
132
+ export class ElSidebarContent extends Elementum {
133
+ static observedAttributes = ['collapsed'];
134
+ static styles = css`
135
+ :host {
136
+ display: flex;
137
+ flex-direction: column;
138
+ flex: 1;
139
+ overflow-y: auto;
140
+ overflow-x: hidden;
141
+ padding: 12px;
142
+ gap: 4px;
143
+ box-sizing: border-box;
144
+ color: var(--el-text-primary, #0f172a);
145
+ transition: padding 0.2s ease;
146
+ }
147
+
148
+ :host([collapsed]) {
149
+ padding: 8px 4px !important;
150
+ align-items: center !important;
151
+ overflow-x: hidden !important;
152
+ overflow-y: hidden !important;
153
+ }
154
+
155
+ :host([collapsed]) ::slotted(.collapsible-text),
156
+ :host([collapsed]) .collapsible-text {
157
+ display: none !important;
158
+ }
159
+
160
+ :host([collapsed]) ::slotted(el-button),
161
+ :host([collapsed]) ::slotted(button),
162
+ :host([collapsed]) ::slotted(a),
163
+ :host([collapsed]) ::slotted(.sidebar-nav-item) {
164
+ width: 38px !important;
165
+ min-width: 38px !important;
166
+ max-width: 38px !important;
167
+ height: 38px !important;
168
+ padding: 0 !important;
169
+ justify-content: center !important;
170
+ text-align: center !important;
171
+ overflow: hidden !important;
172
+ margin: 0 auto 6px auto !important;
173
+ }
174
+ `;
175
+ render() {
176
+ return html`<slot></slot>`;
177
+ }
178
+ }
179
+
180
+ export class ElSidebarFooter extends Elementum {
181
+ static observedAttributes = ['collapsed'];
182
+ static styles = css`
183
+ :host {
184
+ display: flex;
185
+ align-items: center;
186
+ padding: 12px 16px;
187
+ border-top: 1px solid var(--el-surface-border, #e2e8f0);
188
+ box-sizing: border-box;
189
+ flex-shrink: 0;
190
+ color: var(--el-text-primary, #0f172a);
191
+ transition: padding 0.2s ease;
192
+ }
193
+
194
+ :host([collapsed]) {
195
+ padding: 8px 4px !important;
196
+ justify-content: center !important;
197
+ }
198
+
199
+ :host([collapsed]) ::slotted(.collapsible-text),
200
+ :host([collapsed]) .collapsible-text {
201
+ display: none !important;
202
+ }
203
+ `;
204
+ render() {
205
+ return html`<slot></slot>`;
206
+ }
207
+ }
208
+
209
+ export class ElSidebar extends Elementum {
210
+ static observedAttributes = ['collapsed', 'variant'];
211
+
212
+ collapsed = signal(false);
213
+ variant = signal('sidebar'); // 'sidebar' | 'floating' | 'inset'
214
+
215
+ static styles = css`
216
+ :host {
217
+ display: flex;
218
+ flex-direction: column;
219
+ width: 240px;
220
+ min-width: 240px;
221
+ height: 100%;
222
+ min-height: 120px;
223
+ background: var(--el-surface-card, #ffffff);
224
+ border: 1px solid var(--el-surface-border, #e2e8f0);
225
+ border-radius: var(--el-radius-lg, 12px);
226
+ box-sizing: border-box;
227
+ transition: width 0.25s cubic-bezier(0.16, 1, 0.3, 1), min-width 0.25s cubic-bezier(0.16, 1, 0.3, 1);
228
+ position: relative;
229
+ font-family: var(--el-font-sans, system-ui, sans-serif);
230
+ color: var(--el-text-primary, #0f172a);
231
+ overflow: hidden;
232
+ }
233
+
234
+ :host([collapsed]) {
235
+ width: 56px !important;
236
+ min-width: 56px !important;
237
+ max-width: 56px !important;
238
+ }
239
+
240
+ :host([collapsed]) .collapsible-text,
241
+ :host([collapsed]) ::slotted(.collapsible-text) {
242
+ display: none !important;
243
+ }
244
+
245
+ /* Variant: default / sidebar */
246
+ :host([variant="default"]),
247
+ :host([variant="sidebar"]) {
248
+ border-radius: 0;
249
+ }
250
+
251
+ /* Variant: floating */
252
+ :host([variant="floating"]) {
253
+ border: 1px solid var(--el-surface-border, #e2e8f0) !important;
254
+ border-radius: var(--el-radius-lg, 12px) !important;
255
+ margin: 8px;
256
+ height: calc(100% - 16px);
257
+ min-height: auto;
258
+ box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08);
259
+ }
260
+
261
+ :root[data-theme="dark"] :host([variant="floating"]) {
262
+ border-color: #334155 !important;
263
+ }
264
+
265
+ /* Variant: inset */
266
+ :host([variant="inset"]) {
267
+ background: var(--el-surface-muted, #f8fafc);
268
+ border-right: 1px dashed var(--el-surface-border, #cbd5e1) !important;
269
+ }
270
+
271
+ :root[data-theme="dark"] :host([variant="inset"]) {
272
+ background: #0f172a;
273
+ border-right-color: #334155 !important;
274
+ }
275
+
276
+ ::slotted(a),
277
+ ::slotted(button) {
278
+ display: flex;
279
+ align-items: center;
280
+ gap: 12px;
281
+ padding: 8px 12px;
282
+ border-radius: var(--el-radius-sm, 6px);
283
+ color: var(--el-text-secondary, #475569);
284
+ text-decoration: none;
285
+ font-size: 0.875rem;
286
+ font-weight: 500;
287
+ transition: background-color 0.15s ease, color 0.15s ease;
288
+ white-space: nowrap;
289
+ border: none;
290
+ background: transparent;
291
+ cursor: pointer;
292
+ width: 100%;
293
+ text-align: left;
294
+ box-sizing: border-box;
295
+ }
296
+
297
+ ::slotted(a:hover),
298
+ ::slotted(button:hover) {
299
+ background: var(--el-surface-muted, #f1f5f9);
300
+ color: var(--el-text-primary, #0f172a);
301
+ }
302
+
303
+ :root[data-theme="dark"] ::slotted(a),
304
+ :root[data-theme="dark"] ::slotted(button) {
305
+ color: #94a3b8;
306
+ }
307
+
308
+ :root[data-theme="dark"] ::slotted(a:hover),
309
+ :root[data-theme="dark"] ::slotted(button:hover) {
310
+ background: #1e293b;
311
+ color: #f8fafc;
312
+ }
313
+ `;
314
+
315
+ connected() {
316
+ this.collapsed.value = this.hasAttribute('collapsed') && this.getAttribute('collapsed') !== 'false';
317
+ this.variant.value = this.getAttribute('variant') || 'sidebar';
318
+ if (this.collapsed.value) this.#propagateCollapsed(true);
319
+ }
320
+
321
+ rendered() {
322
+ if (this.collapsed.value) {
323
+ this.#propagateCollapsed(true);
324
+ }
325
+ }
326
+
327
+ attributeChanged(name, oldValue, newValue) {
328
+ if (name === 'collapsed') {
329
+ const isCol = newValue !== null && newValue !== 'false';
330
+ this.collapsed.value = isCol;
331
+ this.#propagateCollapsed(isCol);
332
+ }
333
+ if (name === 'variant') this.variant.value = newValue || 'sidebar';
334
+ return true;
335
+ }
336
+
337
+ toggle() {
338
+ if (this.collapsed.value) {
339
+ this.expand();
340
+ } else {
341
+ this.collapse();
342
+ }
343
+ }
344
+
345
+ collapse() {
346
+ this.collapsed.value = true;
347
+ this.setAttribute('collapsed', '');
348
+ this.#propagateCollapsed(true);
349
+ this.emit('collapse');
350
+ this.emit('toggle', { collapsed: true });
351
+ }
352
+
353
+ expand() {
354
+ this.collapsed.value = false;
355
+ this.removeAttribute('collapsed');
356
+ this.#propagateCollapsed(false);
357
+ this.emit('expand');
358
+ this.emit('toggle', { collapsed: false });
359
+ }
360
+
361
+ #propagateCollapsed(val) {
362
+ this.querySelectorAll('el-sidebar-header, el-sidebar-content, el-sidebar-footer').forEach(el => {
363
+ if (val) el.setAttribute('collapsed', '');
364
+ else el.removeAttribute('collapsed');
365
+ });
366
+ this.querySelectorAll('.collapsible-text').forEach(el => {
367
+ el.style.display = val ? 'none' : '';
368
+ });
369
+ const headerInner = this.querySelector('el-sidebar-header > div');
370
+ if (headerInner) {
371
+ headerInner.style.justifyContent = val ? 'center' : 'space-between';
372
+ }
373
+ }
374
+
375
+ render() {
376
+ return html`<slot></slot>`;
377
+ }
378
+ }
379
+
380
+ if (typeof customElements !== 'undefined') {
381
+ if (!customElements.get('el-sidebar-trigger')) customElements.define('el-sidebar-trigger', ElSidebarTrigger);
382
+ if (!customElements.get('el-sidebar-header')) customElements.define('el-sidebar-header', ElSidebarHeader);
383
+ if (!customElements.get('el-sidebar-content')) customElements.define('el-sidebar-content', ElSidebarContent);
384
+ if (!customElements.get('el-sidebar-footer')) customElements.define('el-sidebar-footer', ElSidebarFooter);
385
+ if (!customElements.get('el-sidebar')) customElements.define('el-sidebar', ElSidebar);
386
+ }
@@ -0,0 +1,156 @@
1
+ /**
2
+ * <el-skeleton>
3
+ * Accessible shimmer loading placeholder primitive inspired by shadcn/ui.
4
+ * Supports text, circular, rectangular, and custom rounded variants
5
+ * with wave or pulse animation and custom dimensions.
6
+ */
7
+
8
+ import { Elementum } from '../elementum.js';
9
+ import { html, css } from '../template.js';
10
+ import { signal } from '../signal.js';
11
+
12
+ export class ElSkeleton extends Elementum {
13
+ static observedAttributes = ['variant', 'width', 'height', 'animation'];
14
+
15
+ variant = signal('text'); // 'text' | 'circular' | 'rectangular'
16
+ width = signal('');
17
+ height = signal('');
18
+ animation = signal('wave'); // 'wave' | 'pulse' | 'none'
19
+
20
+ static styles = css`
21
+ :host {
22
+ display: inline-block;
23
+ box-sizing: border-box;
24
+ line-height: 1;
25
+ width: 100%;
26
+ }
27
+
28
+ :host([variant="circular"]) {
29
+ width: auto;
30
+ display: inline-block;
31
+ }
32
+
33
+ .skeleton {
34
+ display: block;
35
+ width: 100%;
36
+ height: 100%;
37
+ min-height: 16px;
38
+ border-radius: var(--el-radius-sm, 6px);
39
+ background: var(--el-skeleton-bg, #e2e8f0);
40
+ position: relative;
41
+ overflow: hidden;
42
+ box-sizing: border-box;
43
+ }
44
+
45
+ /* Variants */
46
+ :host([variant="text"]) .skeleton {
47
+ height: 16px;
48
+ border-radius: var(--el-radius-sm, 4px);
49
+ margin: 4px 0;
50
+ }
51
+
52
+ :host([variant="circular"]) .skeleton {
53
+ border-radius: 9999px;
54
+ width: 40px;
55
+ height: 40px;
56
+ min-height: 40px;
57
+ }
58
+
59
+ :host([variant="rectangular"]) .skeleton {
60
+ border-radius: var(--el-radius-md, 8px);
61
+ min-height: 36px;
62
+ }
63
+
64
+ /* Wave Animation */
65
+ :host([animation="wave"]) .skeleton::after {
66
+ content: '';
67
+ position: absolute;
68
+ top: 0;
69
+ right: 0;
70
+ bottom: 0;
71
+ left: 0;
72
+ transform: translateX(-100%);
73
+ background: linear-gradient(
74
+ 90deg,
75
+ transparent 0%,
76
+ var(--el-skeleton-shimmer, rgba(255, 255, 255, 0.5)) 50%,
77
+ transparent 100%
78
+ );
79
+ animation: el-skeleton-wave 1.6s infinite ease-in-out;
80
+ }
81
+
82
+ /* Pulse Animation */
83
+ :host([animation="pulse"]) .skeleton {
84
+ animation: el-skeleton-pulse 1.8s infinite ease-in-out;
85
+ }
86
+
87
+ @keyframes el-skeleton-wave {
88
+ 0% {
89
+ transform: translateX(-100%);
90
+ }
91
+ 100% {
92
+ transform: translateX(100%);
93
+ }
94
+ }
95
+
96
+ @keyframes el-skeleton-pulse {
97
+ 0%, 100% {
98
+ opacity: 1;
99
+ }
100
+ 50% {
101
+ opacity: 0.35;
102
+ }
103
+ }
104
+
105
+ @media (prefers-reduced-motion: reduce) {
106
+ *, *::before, *::after {
107
+ animation: none !important;
108
+ transition: none !important;
109
+ }
110
+ }
111
+ `;
112
+
113
+ connected() {
114
+ this.#syncAttrs();
115
+ }
116
+
117
+ attributeChanged(name, oldValue, newValue) {
118
+ this.#syncAttrs();
119
+ return true;
120
+ }
121
+
122
+ #syncAttrs() {
123
+ this.variant.value = this.getAttribute('variant') || 'text';
124
+ this.width.value = this.getAttribute('width') || '';
125
+ this.height.value = this.getAttribute('height') || '';
126
+ this.animation.value = this.getAttribute('animation') || 'wave';
127
+
128
+ if (!this.hasAttribute('variant')) this.setAttribute('variant', 'text');
129
+ if (!this.hasAttribute('animation')) this.setAttribute('animation', 'wave');
130
+ }
131
+
132
+ render() {
133
+ const customStyle = () => {
134
+ const styles = [];
135
+ if (this.width.value) styles.push(`width: ${this.width.value};`);
136
+ if (this.height.value) styles.push(`height: ${this.height.value};`);
137
+ return styles.join(' ');
138
+ };
139
+
140
+ return html`
141
+ <div
142
+ class="skeleton"
143
+ part="skeleton"
144
+ role="status"
145
+ aria-label="Loading..."
146
+ style=${customStyle}
147
+ >
148
+ <slot></slot>
149
+ </div>
150
+ `;
151
+ }
152
+ }
153
+
154
+ if (typeof customElements !== 'undefined' && !customElements.get('el-skeleton')) {
155
+ customElements.define('el-skeleton', ElSkeleton);
156
+ }