@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,203 @@
1
+ /**
2
+ * <el-breadcrumb> & <el-breadcrumb-item>
3
+ * Accessible breadcrumb navigation trail inspired by shadcn/ui.
4
+ * Emits semantic nav structure, aria-label="Breadcrumb", current page indicator,
5
+ * and customizable separators (chevron, slash, or custom icon).
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 ElBreadcrumbItem extends Elementum {
13
+ static observedAttributes = ['href', 'current', 'separator'];
14
+
15
+ href = signal('');
16
+ current = signal(false);
17
+ separator = signal('/');
18
+ isLast = signal(false);
19
+
20
+ static styles = css`
21
+ :host {
22
+ display: inline-flex;
23
+ align-items: center;
24
+ font-size: 0.875rem;
25
+ line-height: 1.25rem;
26
+ box-sizing: border-box;
27
+ }
28
+
29
+ .link {
30
+ color: var(--el-text-muted, #64748b);
31
+ text-decoration: none;
32
+ transition: color 0.15s ease;
33
+ display: inline-flex;
34
+ align-items: center;
35
+ gap: 4px;
36
+ }
37
+
38
+ .link:hover {
39
+ color: var(--el-text-primary, #0f172a);
40
+ text-decoration: underline;
41
+ }
42
+
43
+ :root[data-theme="dark"] .link {
44
+ color: #94a3b8;
45
+ }
46
+
47
+ :root[data-theme="dark"] .link:hover {
48
+ color: #f8fafc;
49
+ }
50
+
51
+ .current {
52
+ font-weight: 600;
53
+ color: var(--el-text-primary, #0f172a);
54
+ pointer-events: none;
55
+ }
56
+
57
+ :root[data-theme="dark"] .current {
58
+ color: #f8fafc;
59
+ }
60
+
61
+ .separator {
62
+ display: inline-flex;
63
+ align-items: center;
64
+ margin: 0 8px;
65
+ color: var(--el-text-muted, #94a3b8);
66
+ user-select: none;
67
+ }
68
+ `;
69
+
70
+ connected() {
71
+ this.href.value = this.getAttribute('href') || '';
72
+ this.current.value =
73
+ (this.hasAttribute('current') && this.getAttribute('current') !== 'false') ||
74
+ this.getAttribute('aria-current') === 'page';
75
+ if (this.hasAttribute('separator')) {
76
+ this.separator.value = this.getAttribute('separator') || '/';
77
+ }
78
+ }
79
+
80
+ rendered() {
81
+ this.closest('el-breadcrumb')?.syncSeparators?.();
82
+ }
83
+
84
+ attributeChanged(name, oldValue, newValue) {
85
+ if (name === 'href') this.href.value = newValue || '';
86
+ if (name === 'current') this.current.value = newValue !== null && newValue !== 'false';
87
+ if (name === 'separator') this.separator.value = newValue || '/';
88
+ return true;
89
+ }
90
+
91
+ render() {
92
+ return html`
93
+ ${() =>
94
+ this.current.value
95
+ ? html`<span class="current" aria-current="page"><slot></slot></span>`
96
+ : html`<a class="link" href=${() => this.href.value || '#'}><slot></slot></a>`
97
+ }
98
+ <span
99
+ class="separator"
100
+ aria-hidden="true"
101
+ part="separator"
102
+ style=${() => (this.isLast.value ? 'display: none;' : 'display: inline-flex;')}
103
+ >
104
+ <slot name="separator">${() => this.separator.value}</slot>
105
+ </span>
106
+ `;
107
+ }
108
+ }
109
+
110
+ export class ElBreadcrumb extends Elementum {
111
+ static observedAttributes = ['separator'];
112
+
113
+ separator = signal('/');
114
+
115
+ static styles = css`
116
+ :host {
117
+ display: block;
118
+ font-family: var(--el-font-sans, system-ui, sans-serif);
119
+ box-sizing: border-box;
120
+ }
121
+
122
+ .breadcrumb-list {
123
+ display: flex;
124
+ flex-wrap: wrap;
125
+ align-items: center;
126
+ list-style: none;
127
+ padding: 0;
128
+ margin: 0;
129
+ gap: 0;
130
+ }
131
+
132
+ ::slotted(el-breadcrumb-item:last-of-type) {
133
+ /* hide trailing separator */
134
+ }
135
+ `;
136
+
137
+ connected() {
138
+ this.separator.value = this.getAttribute('separator') || '/';
139
+ this.#updateChildrenSeparators();
140
+
141
+ const observer = new MutationObserver(() => this.#updateChildrenSeparators());
142
+ observer.observe(this, { childList: true });
143
+ this._observer = observer;
144
+ }
145
+
146
+ rendered() {
147
+ this.#updateChildrenSeparators();
148
+ queueMicrotask(() => this.#updateChildrenSeparators());
149
+ }
150
+
151
+ disconnected() {
152
+ this._observer?.disconnect();
153
+ }
154
+
155
+ syncSeparators() {
156
+ this.#updateChildrenSeparators();
157
+ }
158
+
159
+ attributeChanged(name, oldValue, newValue) {
160
+ if (name === 'separator') {
161
+ this.separator.value = newValue || '/';
162
+ this.#updateChildrenSeparators();
163
+ }
164
+ return true;
165
+ }
166
+
167
+ #updateChildrenSeparators() {
168
+ const items = Array.from(this.querySelectorAll('el-breadcrumb-item'));
169
+ items.forEach((item, index) => {
170
+ const isLast = index === items.length - 1;
171
+ if (item.separator && typeof item.separator === 'object' && 'value' in item.separator) {
172
+ item.separator.value = this.separator.value;
173
+ }
174
+ if (item.isLast && typeof item.isLast === 'object' && 'value' in item.isLast) {
175
+ item.isLast.value = isLast;
176
+ }
177
+ const sep = item.shadowRoot?.querySelector('.separator');
178
+ if (sep) {
179
+ sep.style.display = isLast ? 'none' : 'inline-flex';
180
+ sep.textContent = this.separator.value;
181
+ }
182
+ });
183
+ }
184
+
185
+ render() {
186
+ return html`
187
+ <nav aria-label="Breadcrumb" part="nav">
188
+ <ol class="breadcrumb-list" part="list">
189
+ <slot></slot>
190
+ </ol>
191
+ </nav>
192
+ `;
193
+ }
194
+ }
195
+
196
+ if (typeof customElements !== 'undefined') {
197
+ if (!customElements.get('el-breadcrumb-item')) {
198
+ customElements.define('el-breadcrumb-item', ElBreadcrumbItem);
199
+ }
200
+ if (!customElements.get('el-breadcrumb')) {
201
+ customElements.define('el-breadcrumb', ElBreadcrumb);
202
+ }
203
+ }
@@ -0,0 +1,231 @@
1
+ /**
2
+ * <el-button>
3
+ * Frameworkless, signal-driven button component with 1:1 Figma variant parity.
4
+ */
5
+
6
+ import { Elementum } from '../elementum.js';
7
+ import { html, css } from '../template.js';
8
+ import { signal } from '../signal.js';
9
+ import { createPressBehavior } from '../behaviors/index.js';
10
+
11
+ export class ElButton extends Elementum {
12
+ static formAssociated = true;
13
+ static observedAttributes = ['variant', 'size', 'disabled', 'type', 'label'];
14
+
15
+ // Figma Variant mappings as reactive signals
16
+ variant = signal('primary'); // 'primary' | 'secondary' | 'danger' | 'ghost'
17
+ size = signal('md'); // 'sm' | 'md' | 'lg'
18
+ disabled = signal(false);
19
+ type = signal('button'); // 'button' | 'submit' | 'reset'
20
+ label = signal('');
21
+
22
+ static styles = css`
23
+ :host {
24
+ display: inline-block;
25
+ vertical-align: middle;
26
+ }
27
+
28
+ :host([disabled]),
29
+ :host([aria-disabled="true"]) {
30
+ cursor: not-allowed;
31
+ }
32
+
33
+ button {
34
+ display: inline-flex;
35
+ align-items: center;
36
+ justify-content: center;
37
+ gap: var(--el-spacing-sm, 8px);
38
+ font-family: inherit;
39
+ font-weight: 500;
40
+ border: 1px solid transparent;
41
+ border-radius: var(--el-radius-md, 8px);
42
+ cursor: pointer;
43
+ user-select: none;
44
+ touch-action: manipulation;
45
+ -webkit-tap-highlight-color: transparent;
46
+ transition: background-color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
47
+ outline: none;
48
+ }
49
+
50
+ button:focus-visible {
51
+ box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.4);
52
+ }
53
+
54
+ button:not([disabled]):active {
55
+ transform: scale(0.97);
56
+ }
57
+
58
+ @media (prefers-reduced-motion: reduce) {
59
+ button {
60
+ transition: none;
61
+ }
62
+ button:not([disabled]):active {
63
+ transform: none;
64
+ }
65
+ }
66
+
67
+ /* Disabled State - distinct, washed-out, and accessible */
68
+ button[disabled],
69
+ button:disabled,
70
+ :host([disabled]) button,
71
+ :host([aria-disabled="true"]) button {
72
+ opacity: 0.45;
73
+ cursor: not-allowed !important;
74
+ pointer-events: none !important;
75
+ box-shadow: none !important;
76
+ transform: none !important;
77
+ filter: grayscale(0.2);
78
+ }
79
+
80
+ :root[data-theme="dark"] button[disabled],
81
+ :root[data-theme="dark"] button:disabled,
82
+ :root[data-theme="dark"] :host([disabled]) button,
83
+ :root[data-theme="dark"] :host([aria-disabled="true"]) button {
84
+ opacity: 0.38;
85
+ filter: grayscale(0.3);
86
+ }
87
+
88
+ /* Size Variants */
89
+ :host([size="sm"]) button {
90
+ padding: var(--el-spacing-xs, 4px) var(--el-spacing-sm, 8px);
91
+ font-size: 0.8125rem;
92
+ }
93
+
94
+ :host([size="md"]) button,
95
+ :host(:not([size])) button {
96
+ padding: var(--el-spacing-sm, 8px) var(--el-spacing-md, 16px);
97
+ font-size: 0.9375rem;
98
+ }
99
+
100
+ :host([size="lg"]) button {
101
+ padding: var(--el-spacing-md, 16px) var(--el-spacing-lg, 24px);
102
+ font-size: 1.0625rem;
103
+ }
104
+
105
+ /* Color Variants (from Figma tokens) */
106
+ :host([variant="primary"]) button,
107
+ :host(:not([variant])) button {
108
+ background-color: var(--el-color-primary, #2563eb);
109
+ color: #ffffff;
110
+ }
111
+ :host([variant="primary"]:not([disabled])) button:not([disabled]):hover,
112
+ :host(:not([variant]):not([disabled])) button:not([disabled]):hover {
113
+ background-color: var(--el-color-primary-hover, #1d4ed8);
114
+ }
115
+
116
+ :host([variant="secondary"]) button {
117
+ background-color: var(--el-surface-muted, #f3f4f6);
118
+ color: var(--el-text-primary, #0f172a);
119
+ border-color: var(--el-surface-border, #e5e7eb);
120
+ }
121
+ :host([variant="secondary"]:not([disabled])) button:not([disabled]):hover {
122
+ background-color: var(--el-step-4, var(--el-surface-border, #e2e8f0));
123
+ color: var(--el-text-primary, #0f172a);
124
+ border-color: var(--el-step-7, var(--el-surface-border, #cbd5e1));
125
+ }
126
+
127
+ :host([variant="outline"]) button {
128
+ background-color: transparent;
129
+ color: var(--el-text-primary, #0f172a);
130
+ border-color: var(--el-surface-border, #cbd5e1);
131
+ }
132
+ :host([variant="outline"]:not([disabled])) button:not([disabled]):hover {
133
+ background-color: var(--el-step-4, var(--el-surface-border, #e2e8f0));
134
+ color: var(--el-text-primary, #0f172a);
135
+ border-color: var(--el-step-7, var(--el-surface-border, #94a3b8));
136
+ }
137
+
138
+ :host([variant="danger"]) button {
139
+ background-color: var(--el-color-danger, #dc2626);
140
+ color: #ffffff;
141
+ }
142
+ :host([variant="danger"]:not([disabled])) button:not([disabled]):hover {
143
+ background-color: #b91c1c;
144
+ }
145
+
146
+ :host([variant="ghost"]) button {
147
+ background-color: transparent;
148
+ color: var(--el-color-primary, #2563eb);
149
+ }
150
+ :host([variant="ghost"]:not([disabled])) button:not([disabled]):hover {
151
+ background-color: var(--el-step-3, var(--el-surface-muted, #f1f5f9));
152
+ color: var(--el-color-primary-hover, #1d4ed8);
153
+ }
154
+ `;
155
+
156
+ connected() {
157
+ if (this.hasAttribute('disabled')) {
158
+ this.disabled.value = this.getAttribute('disabled') !== 'false';
159
+ }
160
+ if (this.disabled.value) {
161
+ this.setAttribute('aria-disabled', 'true');
162
+ }
163
+ if (this.hasAttribute('label')) {
164
+ this.label.value = this.getAttribute('label') || '';
165
+ }
166
+ }
167
+
168
+ attributeChanged(name, oldValue, newValue) {
169
+ if (name === 'disabled') {
170
+ const isDisabled = newValue !== null && newValue !== 'false';
171
+ this.disabled.value = isDisabled;
172
+ if (isDisabled) {
173
+ this.setAttribute('aria-disabled', 'true');
174
+ } else {
175
+ this.removeAttribute('aria-disabled');
176
+ }
177
+ return;
178
+ }
179
+ if (name in this) {
180
+ this[name].value = newValue !== null ? newValue : '';
181
+ }
182
+ }
183
+
184
+ rendered() {
185
+ const btn = this.root?.querySelector?.('button');
186
+ if (btn) {
187
+ createPressBehavior(this, btn, {
188
+ isDisabled: () => Boolean(this.disabled.value),
189
+ signal: this.signal,
190
+ });
191
+ }
192
+ }
193
+
194
+ render() {
195
+ return html`
196
+ <button
197
+ part="button"
198
+ ?disabled=${() => Boolean(this.disabled.value)}
199
+ aria-disabled=${() => Boolean(this.disabled.value) ? 'true' : 'false'}
200
+ @click=${(e) => {
201
+ if (this.disabled.value) {
202
+ e.preventDefault();
203
+ e.stopPropagation();
204
+ return;
205
+ }
206
+
207
+ const btnType = this.getAttribute('type') || this.type.value;
208
+ if (btnType === 'submit') {
209
+ const form = this.internals?.form || this.closest('form');
210
+ if (form) {
211
+ form.requestSubmit();
212
+ }
213
+ } else if (btnType === 'reset') {
214
+ const form = this.internals?.form || this.closest('form');
215
+ if (form) {
216
+ form.reset();
217
+ }
218
+ }
219
+ }}
220
+ >
221
+ <slot name="prefix"></slot>
222
+ <slot>${() => this.label.value || ''}</slot>
223
+ <slot name="suffix"></slot>
224
+ </button>
225
+ `;
226
+ }
227
+ }
228
+
229
+ if (typeof customElements !== 'undefined' && !customElements.get('el-button')) {
230
+ customElements.define('el-button', ElButton);
231
+ }