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