@arclux/arc-ui 1.0.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.
- package/LICENSE +21 -0
- package/README.md +64 -0
- package/package.json +186 -0
- package/src/content/accordion-item.js +27 -0
- package/src/content/accordion.js +151 -0
- package/src/content/animated-number.js +160 -0
- package/src/content/aspect-ratio.js +78 -0
- package/src/content/avatar-group.js +101 -0
- package/src/content/avatar.js +92 -0
- package/src/content/badge.js +98 -0
- package/src/content/callout.js +141 -0
- package/src/content/card.js +75 -0
- package/src/content/carousel.js +300 -0
- package/src/content/code-block.js +152 -0
- package/src/content/collapsible.js +142 -0
- package/src/content/color-swatch.js +86 -0
- package/src/content/column.js +28 -0
- package/src/content/data-table.js +332 -0
- package/src/content/divider.js +153 -0
- package/src/content/empty-state.js +78 -0
- package/src/content/feature-card.js +142 -0
- package/src/content/highlight.js +63 -0
- package/src/content/icon-library.js +30 -0
- package/src/content/icon-registry.js +39 -0
- package/src/content/icon.js +95 -0
- package/src/content/index.js +44 -0
- package/src/content/infinite-scroll.js +144 -0
- package/src/content/kbd.js +40 -0
- package/src/content/markdown.js +294 -0
- package/src/content/marquee.js +166 -0
- package/src/content/meter.js +167 -0
- package/src/content/scroll-area.js +107 -0
- package/src/content/skeleton.js +85 -0
- package/src/content/spinner.js +77 -0
- package/src/content/stack.js +68 -0
- package/src/content/stat.js +72 -0
- package/src/content/step.js +22 -0
- package/src/content/stepper.js +202 -0
- package/src/content/table.js +134 -0
- package/src/content/tag.js +156 -0
- package/src/content/text.js +111 -0
- package/src/content/timeline-item.js +29 -0
- package/src/content/timeline.js +170 -0
- package/src/content/truncate.js +161 -0
- package/src/content/value-card.js +94 -0
- package/src/feedback/alert.js +187 -0
- package/src/feedback/command-item.js +28 -0
- package/src/feedback/command-palette.js +346 -0
- package/src/feedback/context-menu.js +299 -0
- package/src/feedback/dialog.js +298 -0
- package/src/feedback/dropdown-menu.js +259 -0
- package/src/feedback/hover-card.js +186 -0
- package/src/feedback/index.js +17 -0
- package/src/feedback/modal.js +226 -0
- package/src/feedback/notification-panel.js +196 -0
- package/src/feedback/popover.js +184 -0
- package/src/feedback/progress.js +169 -0
- package/src/feedback/sheet.js +249 -0
- package/src/feedback/toast.js +207 -0
- package/src/feedback/tooltip.js +189 -0
- package/src/icons/lucide.d.ts +1915 -0
- package/src/icons/lucide.js +1915 -0
- package/src/icons/phosphor.d.ts +1517 -0
- package/src/icons/phosphor.js +1517 -0
- package/src/icons/types.d.ts +8 -0
- package/src/index.js +9 -0
- package/src/input/button.js +127 -0
- package/src/input/calendar.js +340 -0
- package/src/input/checkbox.js +159 -0
- package/src/input/chip.js +120 -0
- package/src/input/color-picker.js +461 -0
- package/src/input/combobox.js +295 -0
- package/src/input/copy-button.js +144 -0
- package/src/input/date-picker.js +534 -0
- package/src/input/file-upload.js +333 -0
- package/src/input/form.js +179 -0
- package/src/input/icon-button.js +179 -0
- package/src/input/index.js +31 -0
- package/src/input/input.js +158 -0
- package/src/input/multi-select.js +392 -0
- package/src/input/number-input.js +239 -0
- package/src/input/otp-input.js +221 -0
- package/src/input/pin-input.js +294 -0
- package/src/input/radio-group.js +177 -0
- package/src/input/radio.js +28 -0
- package/src/input/rating.js +195 -0
- package/src/input/search.js +371 -0
- package/src/input/segmented-control.js +174 -0
- package/src/input/select.js +267 -0
- package/src/input/slider.js +217 -0
- package/src/input/sortable-list.js +345 -0
- package/src/input/suggestion.js +26 -0
- package/src/input/textarea.js +203 -0
- package/src/input/theme-toggle.js +196 -0
- package/src/input/toggle.js +166 -0
- package/src/layout/app-shell.js +266 -0
- package/src/layout/auth-shell.js +153 -0
- package/src/layout/container.js +37 -0
- package/src/layout/dashboard-grid.js +62 -0
- package/src/layout/index.js +15 -0
- package/src/layout/page-header.js +100 -0
- package/src/layout/page-layout.js +112 -0
- package/src/layout/resizable.js +221 -0
- package/src/layout/section.js +54 -0
- package/src/layout/settings-layout.js +91 -0
- package/src/layout/split-pane.js +172 -0
- package/src/layout/status-bar.js +84 -0
- package/src/layout/toolbar.js +92 -0
- package/src/navigation/breadcrumb-item.js +26 -0
- package/src/navigation/breadcrumb.js +129 -0
- package/src/navigation/drawer.js +183 -0
- package/src/navigation/footer.js +99 -0
- package/src/navigation/index.js +22 -0
- package/src/navigation/link.js +120 -0
- package/src/navigation/nav-item.js +46 -0
- package/src/navigation/navigation-menu.js +687 -0
- package/src/navigation/pagination.js +186 -0
- package/src/navigation/scroll-spy.js +198 -0
- package/src/navigation/scroll-to-top.js +163 -0
- package/src/navigation/sidebar-link.js +28 -0
- package/src/navigation/sidebar-section.js +45 -0
- package/src/navigation/sidebar.js +336 -0
- package/src/navigation/spy-link.js +26 -0
- package/src/navigation/tab.js +26 -0
- package/src/navigation/tabs.js +202 -0
- package/src/navigation/top-bar.js +263 -0
- package/src/navigation/tree-item.js +38 -0
- package/src/navigation/tree-view.js +255 -0
- package/src/shared/index.js +6 -0
- package/src/shared/menu-divider.js +9 -0
- package/src/shared/menu-item.js +30 -0
- package/src/shared/option.js +31 -0
- package/src/shared-styles.js +81 -0
- package/src/tokens.js +445 -0
- package/types/index.d.ts +973 -0
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
|
|
4
|
+
export class ArcCarousel extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
autoPlay: { type: Boolean, attribute: 'auto-play', reflect: true },
|
|
7
|
+
interval: { type: Number },
|
|
8
|
+
loop: { type: Boolean, reflect: true },
|
|
9
|
+
showDots: { type: Boolean, attribute: 'show-dots', reflect: true },
|
|
10
|
+
showArrows: { type: Boolean, attribute: 'show-arrows', reflect: true },
|
|
11
|
+
_current: { state: true },
|
|
12
|
+
_total: { state: true },
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
static styles = [
|
|
16
|
+
tokenStyles,
|
|
17
|
+
css`
|
|
18
|
+
:host { display: block; position: relative; }
|
|
19
|
+
|
|
20
|
+
.carousel {
|
|
21
|
+
position: relative;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
border-radius: var(--radius-md);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.carousel__viewport {
|
|
27
|
+
display: flex;
|
|
28
|
+
overflow-x: auto;
|
|
29
|
+
scroll-snap-type: x mandatory;
|
|
30
|
+
scroll-behavior: smooth;
|
|
31
|
+
-webkit-overflow-scrolling: touch;
|
|
32
|
+
scrollbar-width: none;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.carousel__viewport::-webkit-scrollbar { display: none; }
|
|
36
|
+
|
|
37
|
+
::slotted(*) {
|
|
38
|
+
flex: 0 0 100%;
|
|
39
|
+
width: 100%;
|
|
40
|
+
scroll-snap-align: start;
|
|
41
|
+
scroll-snap-stop: always;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Arrows */
|
|
45
|
+
.carousel__arrow {
|
|
46
|
+
position: absolute;
|
|
47
|
+
top: 50%;
|
|
48
|
+
transform: translateY(-50%);
|
|
49
|
+
z-index: 2;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
width: 40px;
|
|
54
|
+
height: 40px;
|
|
55
|
+
border-radius: var(--radius-full);
|
|
56
|
+
border: 1px solid var(--border-default);
|
|
57
|
+
background: var(--bg-surface);
|
|
58
|
+
color: var(--text-primary);
|
|
59
|
+
cursor: pointer;
|
|
60
|
+
transition: background var(--transition-fast),
|
|
61
|
+
border-color var(--transition-fast),
|
|
62
|
+
box-shadow var(--transition-fast),
|
|
63
|
+
opacity var(--transition-fast);
|
|
64
|
+
opacity: 0.85;
|
|
65
|
+
font-size: var(--text-md);
|
|
66
|
+
line-height: 1;
|
|
67
|
+
padding: 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.carousel__arrow:hover {
|
|
71
|
+
background: var(--bg-elevated);
|
|
72
|
+
border-color: var(--border-bright);
|
|
73
|
+
opacity: 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.carousel__arrow:focus-visible {
|
|
77
|
+
outline: none;
|
|
78
|
+
box-shadow: var(--focus-ring);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.carousel__arrow--prev { left: var(--space-sm); }
|
|
82
|
+
.carousel__arrow--next { right: var(--space-sm); }
|
|
83
|
+
|
|
84
|
+
.carousel__arrow[disabled] {
|
|
85
|
+
opacity: 0.3;
|
|
86
|
+
pointer-events: none;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/* Dots */
|
|
90
|
+
.carousel__dots {
|
|
91
|
+
display: flex;
|
|
92
|
+
justify-content: center;
|
|
93
|
+
gap: var(--space-sm);
|
|
94
|
+
padding: var(--space-sm) 0;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.carousel__dot {
|
|
98
|
+
width: 8px;
|
|
99
|
+
height: 8px;
|
|
100
|
+
border-radius: var(--radius-full);
|
|
101
|
+
border: none;
|
|
102
|
+
background: var(--border-default);
|
|
103
|
+
cursor: pointer;
|
|
104
|
+
padding: 0;
|
|
105
|
+
transition: background var(--transition-fast), transform var(--transition-fast);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.carousel__dot:hover {
|
|
109
|
+
background: var(--text-muted);
|
|
110
|
+
transform: scale(1.25);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.carousel__dot--active {
|
|
114
|
+
background: var(--accent-primary);
|
|
115
|
+
transform: scale(1.25);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.carousel__dot:focus-visible {
|
|
119
|
+
outline: none;
|
|
120
|
+
box-shadow: var(--focus-glow);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/* Reduced motion */
|
|
124
|
+
@media (prefers-reduced-motion: reduce) {
|
|
125
|
+
.carousel__viewport { scroll-behavior: auto; }
|
|
126
|
+
}
|
|
127
|
+
`,
|
|
128
|
+
];
|
|
129
|
+
|
|
130
|
+
constructor() {
|
|
131
|
+
super();
|
|
132
|
+
this.autoPlay = false;
|
|
133
|
+
this.interval = 5000;
|
|
134
|
+
this.loop = true;
|
|
135
|
+
this.showDots = true;
|
|
136
|
+
this.showArrows = true;
|
|
137
|
+
this._current = 0;
|
|
138
|
+
this._total = 0;
|
|
139
|
+
this._autoPlayTimer = null;
|
|
140
|
+
this._paused = false;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
connectedCallback() {
|
|
144
|
+
super.connectedCallback();
|
|
145
|
+
this._startAutoPlay();
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
disconnectedCallback() {
|
|
149
|
+
super.disconnectedCallback();
|
|
150
|
+
this._stopAutoPlay();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/* ---- Slide management ---- */
|
|
154
|
+
|
|
155
|
+
_onSlotChange(e) {
|
|
156
|
+
const slides = e.target.assignedElements({ flatten: true });
|
|
157
|
+
this._total = slides.length;
|
|
158
|
+
// Ensure current is still valid
|
|
159
|
+
if (this._current >= this._total) {
|
|
160
|
+
this._current = Math.max(0, this._total - 1);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
_slides() {
|
|
165
|
+
const slot = this.shadowRoot?.querySelector('slot');
|
|
166
|
+
return slot ? slot.assignedElements({ flatten: true }) : [];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
_goTo(index) {
|
|
170
|
+
const slides = this._slides();
|
|
171
|
+
if (slides.length === 0) return;
|
|
172
|
+
|
|
173
|
+
let next = index;
|
|
174
|
+
if (this.loop) {
|
|
175
|
+
next = (index + slides.length) % slides.length;
|
|
176
|
+
} else {
|
|
177
|
+
next = Math.max(0, Math.min(index, slides.length - 1));
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (next === this._current && index === next) return;
|
|
181
|
+
this._current = next;
|
|
182
|
+
|
|
183
|
+
const viewport = this.shadowRoot.querySelector('.carousel__viewport');
|
|
184
|
+
if (viewport && slides[next]) {
|
|
185
|
+
slides[next].scrollIntoView({ block: 'nearest', inline: 'start', behavior: 'smooth' });
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
this.dispatchEvent(new CustomEvent('arc-change', {
|
|
189
|
+
detail: { index: this._current },
|
|
190
|
+
bubbles: true,
|
|
191
|
+
composed: true,
|
|
192
|
+
}));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
_prev() { this._goTo(this._current - 1); }
|
|
196
|
+
_next() { this._goTo(this._current + 1); }
|
|
197
|
+
|
|
198
|
+
/* ---- Auto-play ---- */
|
|
199
|
+
|
|
200
|
+
_startAutoPlay() {
|
|
201
|
+
this._stopAutoPlay();
|
|
202
|
+
if (!this.autoPlay) return;
|
|
203
|
+
// Respect prefers-reduced-motion
|
|
204
|
+
if (typeof window !== 'undefined' && window.matchMedia?.('(prefers-reduced-motion: reduce)').matches) return;
|
|
205
|
+
this._autoPlayTimer = setInterval(() => {
|
|
206
|
+
if (!this._paused) this._next();
|
|
207
|
+
}, this.interval);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
_stopAutoPlay() {
|
|
211
|
+
if (this._autoPlayTimer) {
|
|
212
|
+
clearInterval(this._autoPlayTimer);
|
|
213
|
+
this._autoPlayTimer = null;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
_onMouseEnter() { this._paused = true; }
|
|
218
|
+
_onMouseLeave() { this._paused = false; }
|
|
219
|
+
_onFocusIn() { this._paused = true; }
|
|
220
|
+
_onFocusOut() { this._paused = false; }
|
|
221
|
+
|
|
222
|
+
updated(changed) {
|
|
223
|
+
if (changed.has('autoPlay') || changed.has('interval')) {
|
|
224
|
+
this._startAutoPlay();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* ---- Keyboard ---- */
|
|
229
|
+
|
|
230
|
+
_onKeydown(e) {
|
|
231
|
+
if (e.key === 'ArrowLeft') {
|
|
232
|
+
e.preventDefault();
|
|
233
|
+
this._prev();
|
|
234
|
+
} else if (e.key === 'ArrowRight') {
|
|
235
|
+
e.preventDefault();
|
|
236
|
+
this._next();
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/* ---- Render ---- */
|
|
241
|
+
|
|
242
|
+
render() {
|
|
243
|
+
const canPrev = this.loop || this._current > 0;
|
|
244
|
+
const canNext = this.loop || this._current < this._total - 1;
|
|
245
|
+
const dots = Array.from({ length: this._total }, (_, i) => i);
|
|
246
|
+
|
|
247
|
+
return html`
|
|
248
|
+
<div
|
|
249
|
+
class="carousel"
|
|
250
|
+
part="carousel"
|
|
251
|
+
role="region"
|
|
252
|
+
aria-roledescription="carousel"
|
|
253
|
+
aria-label="Carousel"
|
|
254
|
+
@keydown=${this._onKeydown}
|
|
255
|
+
@mouseenter=${this._onMouseEnter}
|
|
256
|
+
@mouseleave=${this._onMouseLeave}
|
|
257
|
+
@focusin=${this._onFocusIn}
|
|
258
|
+
@focusout=${this._onFocusOut}
|
|
259
|
+
>
|
|
260
|
+
<div class="carousel__viewport" part="viewport" tabindex="0">
|
|
261
|
+
<slot @slotchange=${this._onSlotChange}></slot>
|
|
262
|
+
</div>
|
|
263
|
+
|
|
264
|
+
${this.showArrows ? html`
|
|
265
|
+
<button
|
|
266
|
+
class="carousel__arrow carousel__arrow--prev"
|
|
267
|
+
part="arrow-prev"
|
|
268
|
+
aria-label="Previous slide"
|
|
269
|
+
?disabled=${!canPrev}
|
|
270
|
+
@click=${this._prev}
|
|
271
|
+
>‹</button>
|
|
272
|
+
<button
|
|
273
|
+
class="carousel__arrow carousel__arrow--next"
|
|
274
|
+
part="arrow-next"
|
|
275
|
+
aria-label="Next slide"
|
|
276
|
+
?disabled=${!canNext}
|
|
277
|
+
@click=${this._next}
|
|
278
|
+
>›</button>
|
|
279
|
+
` : ''}
|
|
280
|
+
|
|
281
|
+
${this.showDots && this._total > 1 ? html`
|
|
282
|
+
<div class="carousel__dots" part="dots" role="tablist" aria-label="Slide controls">
|
|
283
|
+
${dots.map(i => html`
|
|
284
|
+
<button
|
|
285
|
+
class="carousel__dot ${i === this._current ? 'carousel__dot--active' : ''}"
|
|
286
|
+
part="dot"
|
|
287
|
+
role="tab"
|
|
288
|
+
aria-selected=${i === this._current ? 'true' : 'false'}
|
|
289
|
+
aria-label="Go to slide ${i + 1}"
|
|
290
|
+
@click=${() => this._goTo(i)}
|
|
291
|
+
></button>
|
|
292
|
+
`)}
|
|
293
|
+
</div>
|
|
294
|
+
` : ''}
|
|
295
|
+
</div>
|
|
296
|
+
`;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
customElements.define('arc-carousel', ArcCarousel);
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @arc-prism hybrid — display works without JS; copy-to-clipboard requires JS
|
|
6
|
+
*/
|
|
7
|
+
export class ArcCodeBlock extends LitElement {
|
|
8
|
+
static properties = {
|
|
9
|
+
language: { type: String, reflect: true },
|
|
10
|
+
filename: { type: String },
|
|
11
|
+
code: { type: String },
|
|
12
|
+
_copied: { state: true },
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
static styles = [
|
|
16
|
+
tokenStyles,
|
|
17
|
+
css`
|
|
18
|
+
:host { display: block; }
|
|
19
|
+
|
|
20
|
+
.code-block {
|
|
21
|
+
background: var(--bg-surface);
|
|
22
|
+
border: 1px solid var(--border-default);
|
|
23
|
+
border-radius: var(--radius-lg);
|
|
24
|
+
overflow: hidden;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.code-block__header {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
padding: var(--space-xs) var(--space-md);
|
|
32
|
+
border-bottom: 1px solid var(--border-subtle);
|
|
33
|
+
background: var(--bg-card);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.code-block__filename {
|
|
37
|
+
font-family: var(--font-mono);
|
|
38
|
+
font-size: var(--text-sm);
|
|
39
|
+
color: var(--text-muted);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.code-block__lang {
|
|
43
|
+
font-family: var(--font-accent);
|
|
44
|
+
font-size: var(--text-xs);
|
|
45
|
+
letter-spacing: 2px;
|
|
46
|
+
text-transform: uppercase;
|
|
47
|
+
color: var(--text-ghost);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.code-block__copy {
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
gap: var(--space-xs);
|
|
54
|
+
background: none;
|
|
55
|
+
border: 1px solid var(--border-default);
|
|
56
|
+
border-radius: var(--radius-sm);
|
|
57
|
+
color: var(--text-muted);
|
|
58
|
+
font-family: var(--font-accent);
|
|
59
|
+
font-size: var(--text-xs);
|
|
60
|
+
letter-spacing: 1px;
|
|
61
|
+
text-transform: uppercase;
|
|
62
|
+
padding: var(--space-xs) var(--space-sm);
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
transition: color var(--transition-fast), border-color var(--transition-fast);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.code-block__copy:hover {
|
|
68
|
+
color: var(--text-primary);
|
|
69
|
+
border-color: var(--border-bright);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.code-block__copy[data-copied] {
|
|
73
|
+
color: var(--color-success);
|
|
74
|
+
border-color: var(--color-success);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.code-block__body {
|
|
78
|
+
padding: var(--space-md);
|
|
79
|
+
overflow-x: auto;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.code-block__pre {
|
|
83
|
+
margin: 0;
|
|
84
|
+
font-family: var(--font-mono);
|
|
85
|
+
font-size: var(--code-size);
|
|
86
|
+
line-height: var(--code-lh);
|
|
87
|
+
color: var(--text-primary);
|
|
88
|
+
white-space: pre;
|
|
89
|
+
tab-size: 2;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
@media (prefers-reduced-motion: reduce) {
|
|
93
|
+
:host *,
|
|
94
|
+
:host *::before,
|
|
95
|
+
:host *::after {
|
|
96
|
+
animation-duration: 0.01ms !important;
|
|
97
|
+
animation-iteration-count: 1 !important;
|
|
98
|
+
transition-duration: 0.01ms !important;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
`,
|
|
102
|
+
];
|
|
103
|
+
|
|
104
|
+
constructor() {
|
|
105
|
+
super();
|
|
106
|
+
this.language = '';
|
|
107
|
+
this.filename = '';
|
|
108
|
+
this.code = '';
|
|
109
|
+
this._copied = false;
|
|
110
|
+
this._copyTimer = null;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
disconnectedCallback() {
|
|
114
|
+
super.disconnectedCallback();
|
|
115
|
+
if (this._copyTimer) clearTimeout(this._copyTimer);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
async _copy() {
|
|
119
|
+
const text = this.code || '';
|
|
120
|
+
try {
|
|
121
|
+
await navigator.clipboard.writeText(text);
|
|
122
|
+
this._copied = true;
|
|
123
|
+
if (this._copyTimer) clearTimeout(this._copyTimer);
|
|
124
|
+
this._copyTimer = setTimeout(() => { this._copied = false; this._copyTimer = null; }, 2000);
|
|
125
|
+
} catch {
|
|
126
|
+
// Copy failed — requires secure context (HTTPS) or user gesture
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
render() {
|
|
131
|
+
return html`
|
|
132
|
+
<div class="code-block" part="code-block">
|
|
133
|
+
<div class="code-block__header" part="header">
|
|
134
|
+
<span class="code-block__filename" part="filename">${this.filename || ''}</span>
|
|
135
|
+
<span class="code-block__lang" part="lang">${this.language}</span>
|
|
136
|
+
<button
|
|
137
|
+
class="code-block__copy"
|
|
138
|
+
?data-copied=${this._copied}
|
|
139
|
+
@click=${this._copy}
|
|
140
|
+
aria-label=${this._copied ? 'Copied to clipboard' : 'Copy code'}
|
|
141
|
+
part="copy"
|
|
142
|
+
>${this._copied ? 'Copied' : 'Copy'}</button>
|
|
143
|
+
</div>
|
|
144
|
+
<div class="code-block__body" part="body">
|
|
145
|
+
<pre class="code-block__pre" part="pre"><code part="code"><slot>${this.code}</slot></code></pre>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
customElements.define('arc-code-block', ArcCodeBlock);
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
|
|
4
|
+
export class ArcCollapsible extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
open: { type: Boolean, reflect: true },
|
|
7
|
+
heading: { type: String },
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
static styles = [
|
|
11
|
+
tokenStyles,
|
|
12
|
+
css`
|
|
13
|
+
:host { display: block; }
|
|
14
|
+
|
|
15
|
+
.collapsible {
|
|
16
|
+
border: 1px solid var(--border-subtle);
|
|
17
|
+
border-radius: var(--radius-lg);
|
|
18
|
+
background: var(--bg-card);
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.collapsible__trigger {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
gap: var(--space-md);
|
|
27
|
+
width: 100%;
|
|
28
|
+
padding: var(--space-md) var(--space-lg);
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
font-family: var(--font-body);
|
|
31
|
+
font-size: var(--body-size);
|
|
32
|
+
font-weight: 600;
|
|
33
|
+
color: var(--text-primary);
|
|
34
|
+
background: none;
|
|
35
|
+
border: none;
|
|
36
|
+
text-align: left;
|
|
37
|
+
transition: background var(--transition-fast);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.collapsible__trigger:hover {
|
|
41
|
+
background: var(--bg-elevated);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.collapsible__trigger:focus-visible {
|
|
45
|
+
outline: none;
|
|
46
|
+
box-shadow: inset 0 0 0 2px var(--accent-primary);
|
|
47
|
+
background: var(--bg-elevated);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.collapsible__chevron {
|
|
51
|
+
display: inline-flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
color: var(--text-muted);
|
|
55
|
+
font-size: var(--text-xs);
|
|
56
|
+
flex-shrink: 0;
|
|
57
|
+
transition: transform 300ms ease;
|
|
58
|
+
transform: rotate(0deg);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
:host([open]) .collapsible__chevron {
|
|
62
|
+
transform: rotate(90deg);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.collapsible__content {
|
|
66
|
+
display: grid;
|
|
67
|
+
grid-template-rows: 0fr;
|
|
68
|
+
transition: grid-template-rows 300ms ease;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
:host([open]) .collapsible__content {
|
|
72
|
+
grid-template-rows: 1fr;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.collapsible__body {
|
|
76
|
+
overflow: hidden;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.collapsible__inner {
|
|
80
|
+
padding: 0 var(--space-lg) var(--space-lg);
|
|
81
|
+
color: var(--text-secondary);
|
|
82
|
+
font-family: var(--font-body);
|
|
83
|
+
font-size: var(--body-size);
|
|
84
|
+
line-height: var(--body-lh);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@media (prefers-reduced-motion: reduce) {
|
|
88
|
+
.collapsible__chevron,
|
|
89
|
+
.collapsible__content { transition: none; }
|
|
90
|
+
}
|
|
91
|
+
`,
|
|
92
|
+
];
|
|
93
|
+
|
|
94
|
+
constructor() {
|
|
95
|
+
super();
|
|
96
|
+
this.open = false;
|
|
97
|
+
this.heading = '';
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
_toggle() {
|
|
101
|
+
this.open = !this.open;
|
|
102
|
+
this.dispatchEvent(new CustomEvent('arc-toggle', {
|
|
103
|
+
detail: { open: this.open },
|
|
104
|
+
bubbles: true,
|
|
105
|
+
composed: true,
|
|
106
|
+
}));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
_handleKeydown(e) {
|
|
110
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
111
|
+
e.preventDefault();
|
|
112
|
+
this._toggle();
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
render() {
|
|
117
|
+
return html`
|
|
118
|
+
<div class="collapsible" part="collapsible">
|
|
119
|
+
<button
|
|
120
|
+
class="collapsible__trigger"
|
|
121
|
+
aria-expanded=${this.open ? 'true' : 'false'}
|
|
122
|
+
aria-controls="content"
|
|
123
|
+
@click=${this._toggle}
|
|
124
|
+
@keydown=${this._handleKeydown}
|
|
125
|
+
part="trigger"
|
|
126
|
+
>
|
|
127
|
+
<span part="heading">${this.heading}</span>
|
|
128
|
+
<span class="collapsible__chevron" aria-hidden="true">▸</span>
|
|
129
|
+
</button>
|
|
130
|
+
<div class="collapsible__content" id="content" role="region" aria-label=${this.heading || 'Collapsible content'}>
|
|
131
|
+
<div class="collapsible__body">
|
|
132
|
+
<div class="collapsible__inner" part="body">
|
|
133
|
+
<slot></slot>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
</div>
|
|
138
|
+
`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
customElements.define('arc-collapsible', ArcCollapsible);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
import { tokenStyles } from '../shared-styles.js';
|
|
3
|
+
|
|
4
|
+
export class ArcColorSwatch extends LitElement {
|
|
5
|
+
static properties = {
|
|
6
|
+
color: { type: String },
|
|
7
|
+
label: { type: String },
|
|
8
|
+
size: { type: String, reflect: true },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
static styles = [
|
|
12
|
+
tokenStyles,
|
|
13
|
+
css`
|
|
14
|
+
:host { display: inline-flex; }
|
|
15
|
+
|
|
16
|
+
.swatch {
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: var(--space-sm);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.swatch__color {
|
|
24
|
+
border-radius: var(--radius-md);
|
|
25
|
+
border: 1px solid var(--border-default);
|
|
26
|
+
transition: border-color var(--transition-base), box-shadow var(--transition-base);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.swatch__color:hover {
|
|
30
|
+
border-color: var(--border-bright);
|
|
31
|
+
box-shadow: 0 0 12px rgba(var(--accent-primary-rgb), 0.1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:host([size="sm"]) .swatch__color { width: 32px; height: 32px; border-radius: var(--radius-sm); }
|
|
35
|
+
:host([size="md"]) .swatch__color { width: 48px; height: 48px; }
|
|
36
|
+
:host([size="lg"]) .swatch__color { width: 64px; height: 64px; border-radius: var(--radius-lg); }
|
|
37
|
+
|
|
38
|
+
.swatch__label {
|
|
39
|
+
font-family: var(--font-mono);
|
|
40
|
+
font-size: var(--text-sm);
|
|
41
|
+
color: var(--text-muted);
|
|
42
|
+
text-align: center;
|
|
43
|
+
max-width: 80px;
|
|
44
|
+
overflow: hidden;
|
|
45
|
+
text-overflow: ellipsis;
|
|
46
|
+
white-space: nowrap;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@media (prefers-reduced-motion: reduce) {
|
|
50
|
+
:host *,
|
|
51
|
+
:host *::before,
|
|
52
|
+
:host *::after {
|
|
53
|
+
animation-duration: 0.01ms !important;
|
|
54
|
+
animation-iteration-count: 1 !important;
|
|
55
|
+
transition-duration: 0.01ms !important;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`,
|
|
59
|
+
];
|
|
60
|
+
|
|
61
|
+
constructor() {
|
|
62
|
+
super();
|
|
63
|
+
this.color = '#4d7ef7';
|
|
64
|
+
this.label = '';
|
|
65
|
+
this.size = 'md';
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
render() {
|
|
69
|
+
const displayLabel = this.label || this.color;
|
|
70
|
+
|
|
71
|
+
return html`
|
|
72
|
+
<div class="swatch" part="swatch">
|
|
73
|
+
<div
|
|
74
|
+
class="swatch__color"
|
|
75
|
+
part="color"
|
|
76
|
+
style="background-color:${this.color}"
|
|
77
|
+
role="img"
|
|
78
|
+
aria-label=${`Color: ${displayLabel}`}
|
|
79
|
+
></div>
|
|
80
|
+
<span class="swatch__label" part="label">${displayLabel}</span>
|
|
81
|
+
</div>
|
|
82
|
+
`;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
customElements.define('arc-color-swatch', ArcColorSwatch);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { LitElement, html, css } from 'lit';
|
|
2
|
+
|
|
3
|
+
export class ArcColumn extends LitElement {
|
|
4
|
+
static properties = {
|
|
5
|
+
key: { type: String, reflect: true },
|
|
6
|
+
label: { type: String, reflect: true },
|
|
7
|
+
sortable: { type: Boolean, reflect: true },
|
|
8
|
+
width: { type: String },
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
static styles = css`
|
|
12
|
+
:host { display: none; }
|
|
13
|
+
`;
|
|
14
|
+
|
|
15
|
+
constructor() {
|
|
16
|
+
super();
|
|
17
|
+
this.key = '';
|
|
18
|
+
this.label = '';
|
|
19
|
+
this.sortable = false;
|
|
20
|
+
this.width = '';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return html`<slot></slot>`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
customElements.define('arc-column', ArcColumn);
|