@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,165 @@
1
+ /**
2
+ * <el-rating>
3
+ * Accessible 1-5 star rating component inspired by shadcn/ui.
4
+ * Implements Form Associated Custom Element (FACE), keyboard arrows navigation,
5
+ * hover preview, read-only/disabled states, and clean SVG stars.
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 ElRating extends Elementum {
13
+ static formAssociated = true;
14
+ static observedAttributes = ['value', 'max', 'readonly', 'disabled', 'name'];
15
+
16
+ value = signal(0);
17
+ hoverValue = signal(0);
18
+ max = signal(5);
19
+ readonly = signal(false);
20
+ disabled = signal(false);
21
+
22
+ static styles = css`
23
+ :host {
24
+ display: inline-flex;
25
+ align-items: center;
26
+ gap: 4px;
27
+ font-family: var(--el-font-sans, system-ui, sans-serif);
28
+ box-sizing: border-box;
29
+ outline: none;
30
+ }
31
+
32
+ .star-btn {
33
+ background: transparent;
34
+ border: none;
35
+ padding: 2px;
36
+ cursor: pointer;
37
+ display: inline-flex;
38
+ align-items: center;
39
+ justify-content: center;
40
+ color: var(--el-surface-border, #cbd5e1);
41
+ transition: color 0.15s ease, transform 0.1s ease;
42
+ outline: none;
43
+ border-radius: var(--el-radius-sm, 4px);
44
+ }
45
+
46
+ :root[data-theme="dark"] .star-btn {
47
+ color: #475569;
48
+ }
49
+
50
+ .star-btn:hover:not(:disabled) {
51
+ transform: scale(1.15);
52
+ }
53
+
54
+ .star-btn.filled {
55
+ color: #f59e0b; /* Amber 500 */
56
+ }
57
+
58
+ :host([readonly]) .star-btn {
59
+ cursor: default;
60
+ }
61
+
62
+ :host([disabled]) {
63
+ opacity: 0.6;
64
+ cursor: not-allowed;
65
+ }
66
+
67
+ :host([disabled]) .star-btn {
68
+ cursor: not-allowed;
69
+ }
70
+ `;
71
+
72
+ connected() {
73
+ this.#syncAttrs();
74
+ this.setAttribute('role', 'slider');
75
+ this.setAttribute('tabindex', this.disabled.value ? '-1' : '0');
76
+ this.setAttribute('aria-valuemin', '0');
77
+ this.setAttribute('aria-valuemax', String(this.max.value));
78
+ this.setAttribute('aria-valuenow', String(this.value.value));
79
+
80
+ this.addEventListener('keydown', this.#onKeyDown);
81
+ this.addEventListener('mouseleave', () => {
82
+ this.hoverValue.value = 0;
83
+ });
84
+
85
+ this.setFormValue(String(this.value.value));
86
+ }
87
+
88
+ disconnected() {
89
+ this.removeEventListener('keydown', this.#onKeyDown);
90
+ }
91
+
92
+ attributeChanged(name, oldValue, newValue) {
93
+ this.#syncAttrs();
94
+ return true;
95
+ }
96
+
97
+ #syncAttrs() {
98
+ this.value.value = parseFloat(this.getAttribute('value') || '0');
99
+ this.max.value = parseInt(this.getAttribute('max') || '5', 10);
100
+ this.readonly.value = this.hasAttribute('readonly');
101
+ this.disabled.value = this.hasAttribute('disabled');
102
+ }
103
+
104
+ formReset() {
105
+ this.value.value = parseFloat(this.getAttribute('value') || '0');
106
+ this.setFormValue(String(this.value.value));
107
+ }
108
+
109
+ setValue(val) {
110
+ if (this.readonly.value || this.disabled.value) return;
111
+ const clamped = Math.max(0, Math.min(val, this.max.value));
112
+ this.value.value = clamped;
113
+ this.setAttribute('aria-valuenow', String(clamped));
114
+ this.setFormValue(String(clamped));
115
+ this.emit('change', { value: clamped });
116
+ }
117
+
118
+ #onKeyDown = (e) => {
119
+ if (this.readonly.value || this.disabled.value) return;
120
+ if (e.key === 'ArrowRight' || e.key === 'ArrowUp') {
121
+ e.preventDefault();
122
+ this.setValue(this.value.value + 1);
123
+ } else if (e.key === 'ArrowLeft' || e.key === 'ArrowDown') {
124
+ e.preventDefault();
125
+ this.setValue(this.value.value - 1);
126
+ }
127
+ };
128
+
129
+ render() {
130
+ const starList = () => {
131
+ const count = this.max.value;
132
+ const activeVal = this.hoverValue.value || this.value.value;
133
+
134
+ return Array.from({ length: count }).map((_, i) => {
135
+ const starNum = i + 1;
136
+ const isFilled = starNum <= activeVal;
137
+
138
+ return html`
139
+ <button
140
+ type="button"
141
+ class=${() => `star-btn ${isFilled ? 'filled' : ''}`}
142
+ aria-label=${() => `${starNum} star${starNum > 1 ? 's' : ''}`}
143
+ ?disabled=${() => this.disabled.value || this.readonly.value}
144
+ onmouseenter=${() => {
145
+ if (!this.readonly.value && !this.disabled.value) {
146
+ this.hoverValue.value = starNum;
147
+ }
148
+ }}
149
+ onclick=${() => this.setValue(starNum)}
150
+ >
151
+ <svg width="20" height="20" viewBox="0 0 24 24" fill=${isFilled ? 'currentColor' : 'none'} stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
152
+ <polygon points="12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"/>
153
+ </svg>
154
+ </button>
155
+ `;
156
+ });
157
+ };
158
+
159
+ return html`${starList}`;
160
+ }
161
+ }
162
+
163
+ if (typeof customElements !== 'undefined' && !customElements.get('el-rating')) {
164
+ customElements.define('el-rating', ElRating);
165
+ }
@@ -0,0 +1,293 @@
1
+ import { Elementum } from '../elementum.js';
2
+ import { html, css } from '../template.js';
3
+ import { signal, effect } from '../signal.js';
4
+
5
+ /**
6
+ * <el-reasoning-card>
7
+ * Modern collapsible AI thought disclosure card (inspired by Beautiful UI, Claude 3.7 & DeepSeek-R1).
8
+ * Features breathing active pulse indicator, elapsed duration counter,
9
+ * and smooth grid-based expand/collapse accordion animation.
10
+ *
11
+ * @element el-reasoning-card
12
+ * @fires toggle - Dispatched when expanded state toggles with { detail: { open } }
13
+ * @slot default - The reasoning thought process content or steps
14
+ * @slot summary - Custom summary or status header
15
+ * @csspart container - The card wrapper
16
+ * @csspart header - The interactive clickable header
17
+ * @csspart indicator - The pulsing thinking status dot
18
+ * @csspart title - The title/duration label
19
+ * @csspart chevron - The expand/collapse chevron
20
+ * @csspart body - The collapsible body container
21
+ */
22
+ export class ElReasoningCard extends Elementum {
23
+ static observedAttributes = ['open', 'thinking', 'duration', 'summary'];
24
+
25
+ open = signal(false);
26
+ thinking = signal(false);
27
+ duration = signal('');
28
+ summary = signal('Thinking process');
29
+
30
+ connected() {
31
+ this.open.value = this.hasAttribute('open');
32
+ this.thinking.value = this.hasAttribute('thinking');
33
+ if (this.hasAttribute('duration')) {
34
+ this.duration.value = this.getAttribute('duration');
35
+ }
36
+ if (this.hasAttribute('summary')) {
37
+ this.summary.value = this.getAttribute('summary');
38
+ }
39
+ }
40
+
41
+ attributeChangedCallback(name, oldValue, newValue) {
42
+ if (oldValue === newValue) return;
43
+ switch (name) {
44
+ case 'open':
45
+ this.open.value = newValue !== null;
46
+ break;
47
+ case 'thinking':
48
+ this.thinking.value = newValue !== null;
49
+ break;
50
+ case 'duration':
51
+ this.duration.value = newValue || '';
52
+ break;
53
+ case 'summary':
54
+ this.summary.value = newValue || 'Thinking process';
55
+ break;
56
+ }
57
+ }
58
+
59
+ toggle() {
60
+ this.open.value = !this.open.value;
61
+ if (this.open.value) {
62
+ this.setAttribute('open', '');
63
+ } else {
64
+ this.removeAttribute('open');
65
+ }
66
+
67
+ this.dispatchEvent(
68
+ new CustomEvent('toggle', {
69
+ bubbles: true,
70
+ composed: true,
71
+ detail: { open: this.open.value }
72
+ })
73
+ );
74
+ }
75
+
76
+ static styles = css`
77
+ :host {
78
+ display: block;
79
+ box-sizing: border-box;
80
+ width: 100%;
81
+ font-family: var(--el-font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
82
+ margin: 8px 0;
83
+ }
84
+
85
+ .card {
86
+ border: 1px solid var(--el-border-translucent, rgba(15, 23, 42, 0.08));
87
+ border-radius: var(--el-radius-lg, 12px);
88
+ background: var(--el-surface-muted, #f8fafc);
89
+ overflow: hidden;
90
+ transition: border-color var(--el-transition-fluid, 280ms cubic-bezier(0.16, 1, 0.3, 1)),
91
+ background-color var(--el-transition-fluid, 280ms cubic-bezier(0.16, 1, 0.3, 1));
92
+ }
93
+
94
+ :host([open]) .card {
95
+ background: var(--el-surface-elevated, #ffffff);
96
+ border-color: var(--el-border-translucent, rgba(15, 23, 42, 0.12));
97
+ box-shadow: var(--el-shadow-subtle, 0 1px 2px 0 rgba(0, 0, 0, 0.05));
98
+ }
99
+
100
+ .header-btn {
101
+ width: 100%;
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: space-between;
105
+ gap: 12px;
106
+ padding: 10px 14px;
107
+ background: transparent;
108
+ border: none;
109
+ text-align: left;
110
+ font-family: inherit;
111
+ font-size: 0.8125rem;
112
+ font-weight: 500;
113
+ color: var(--el-text-secondary, #475569);
114
+ cursor: pointer;
115
+ user-select: none;
116
+ outline: none;
117
+ border-radius: var(--el-radius-lg, 12px);
118
+ transition: color 0.15s ease, background-color 0.15s ease;
119
+ }
120
+
121
+ .header-btn:hover {
122
+ color: var(--el-text-primary, #0f172a);
123
+ background-color: rgba(0, 0, 0, 0.02);
124
+ }
125
+
126
+ .header-btn:focus-visible {
127
+ box-shadow: inset 0 0 0 2px var(--el-color-primary, #2563eb);
128
+ }
129
+
130
+ .header-left {
131
+ display: inline-flex;
132
+ align-items: center;
133
+ gap: 9px;
134
+ }
135
+
136
+ /* Pulsing breathing dot for active thinking */
137
+ .indicator-wrapper {
138
+ position: relative;
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: center;
142
+ width: 14px;
143
+ height: 14px;
144
+ }
145
+
146
+ .indicator-dot {
147
+ width: 8px;
148
+ height: 8px;
149
+ border-radius: 50%;
150
+ background: var(--el-color-primary, #2563eb);
151
+ transition: background-color 0.2s ease;
152
+ }
153
+
154
+ .indicator-ping {
155
+ position: absolute;
156
+ width: 100%;
157
+ height: 100%;
158
+ border-radius: 50%;
159
+ background: var(--el-color-primary, #2563eb);
160
+ opacity: 0.6;
161
+ animation: ping 1.8s cubic-bezier(0, 0, 0.2, 1) infinite;
162
+ }
163
+
164
+ :host(:not([thinking])) .indicator-dot {
165
+ background: var(--el-text-muted, #94a3b8);
166
+ }
167
+
168
+ :host(:not([thinking])) .indicator-ping {
169
+ display: none;
170
+ }
171
+
172
+ @keyframes ping {
173
+ 75%, 100% {
174
+ transform: scale(2);
175
+ opacity: 0;
176
+ }
177
+ }
178
+
179
+ .title {
180
+ display: inline-flex;
181
+ align-items: center;
182
+ gap: 6px;
183
+ }
184
+
185
+ .duration-badge {
186
+ display: inline-flex;
187
+ align-items: center;
188
+ font-family: var(--el-font-mono, monospace);
189
+ font-size: 0.75rem;
190
+ padding: 1px 6px;
191
+ border-radius: var(--el-radius-full, 9999px);
192
+ background: rgba(15, 23, 42, 0.06);
193
+ color: var(--el-text-muted, #64748b);
194
+ }
195
+
196
+ .chevron {
197
+ display: inline-flex;
198
+ align-items: center;
199
+ justify-content: center;
200
+ transition: transform var(--el-transition-fluid, 280ms cubic-bezier(0.16, 1, 0.3, 1));
201
+ color: var(--el-text-muted, #94a3b8);
202
+ }
203
+
204
+ :host([open]) .chevron {
205
+ transform: rotate(180deg);
206
+ }
207
+
208
+ /* Grid accordion expansion for buttery smooth layout transition without fixed max-height */
209
+ .content-wrapper {
210
+ display: grid;
211
+ grid-template-rows: 0fr;
212
+ transition: grid-template-rows var(--el-transition-fluid, 280ms cubic-bezier(0.16, 1, 0.3, 1));
213
+ }
214
+
215
+ :host([open]) .content-wrapper {
216
+ grid-template-rows: 1fr;
217
+ }
218
+
219
+ .content-inner {
220
+ overflow: hidden;
221
+ }
222
+
223
+ .content-body {
224
+ padding: 4px 16px 14px 37px;
225
+ font-size: 0.875rem;
226
+ line-height: 1.6;
227
+ color: var(--el-text-secondary, #334155);
228
+ border-top: 1px solid var(--el-border-translucent, rgba(15, 23, 42, 0.05));
229
+ }
230
+
231
+ ::slotted(*) {
232
+ margin-top: 6px;
233
+ margin-bottom: 6px;
234
+ }
235
+
236
+ @media (prefers-reduced-motion: reduce) {
237
+ .card, .chevron, .content-wrapper {
238
+ transition: none;
239
+ }
240
+ .indicator-ping {
241
+ animation: none;
242
+ }
243
+ }
244
+ `;
245
+
246
+ render() {
247
+ const summaryText = () => this.summary.value || (this.thinking.value ? 'Thinking...' : 'Reasoning process');
248
+
249
+ return html`
250
+ <div class="card" part="container">
251
+ <button
252
+ type="button"
253
+ class="header-btn"
254
+ part="header"
255
+ aria-expanded=${() => String(this.open.value)}
256
+ @click=${() => this.toggle()}
257
+ >
258
+ <div class="header-left">
259
+ <div class="indicator-wrapper" part="indicator">
260
+ <div class="indicator-ping"></div>
261
+ <div class="indicator-dot"></div>
262
+ </div>
263
+ <div class="title" part="title">
264
+ <slot name="summary">
265
+ <span>${summaryText}</span>
266
+ </slot>
267
+ ${() => (this.duration.value
268
+ ? html`<span class="duration-badge">${this.duration.value}</span>`
269
+ : null)}
270
+ </div>
271
+ </div>
272
+ <div class="chevron" part="chevron">
273
+ <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
274
+ <path d="m6 9 6 6 6-6"/>
275
+ </svg>
276
+ </div>
277
+ </button>
278
+
279
+ <div class="content-wrapper" part="body">
280
+ <div class="content-inner">
281
+ <div class="content-body">
282
+ <slot></slot>
283
+ </div>
284
+ </div>
285
+ </div>
286
+ </div>
287
+ `;
288
+ }
289
+ }
290
+
291
+ if (typeof customElements !== 'undefined' && !customElements.get('el-reasoning-card')) {
292
+ customElements.define('el-reasoning-card', ElReasoningCard);
293
+ }