@f-ewald/components 1.39.0 → 1.40.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/README.md +48 -0
- package/custom-elements.json +1046 -131
- package/dist/address-autocomplete.js +2 -2
- package/dist/address-autocomplete.js.map +1 -1
- package/dist/app-shell.js +4 -4
- package/dist/app-shell.js.map +1 -1
- package/dist/app-sidebar.js +2 -2
- package/dist/app-sidebar.js.map +1 -1
- package/dist/audio-player.js +1 -1
- package/dist/audio-player.js.map +1 -1
- package/dist/autocomplete-input.js +2 -2
- package/dist/autocomplete-input.js.map +1 -1
- package/dist/breadcrumb-nav.d.ts +69 -0
- package/dist/breadcrumb-nav.d.ts.map +1 -0
- package/dist/breadcrumb-nav.js +235 -0
- package/dist/breadcrumb-nav.js.map +1 -0
- package/dist/button-group.js +2 -2
- package/dist/button-group.js.map +1 -1
- package/dist/calendar-day.js +3 -3
- package/dist/calendar-day.js.map +1 -1
- package/dist/calendar-month.d.ts.map +1 -1
- package/dist/calendar-month.js +4 -1
- package/dist/calendar-month.js.map +1 -1
- package/dist/calendar-week.js +4 -4
- package/dist/calendar-week.js.map +1 -1
- package/dist/chat-message.js +1 -1
- package/dist/chat-message.js.map +1 -1
- package/dist/comment-composer.js +1 -1
- package/dist/comment-composer.js.map +1 -1
- package/dist/confirm-dialog.d.ts.map +1 -1
- package/dist/confirm-dialog.js +5 -2
- package/dist/confirm-dialog.js.map +1 -1
- package/dist/content-divider.js +1 -1
- package/dist/content-divider.js.map +1 -1
- package/dist/cron-schedule.d.ts.map +1 -1
- package/dist/cron-schedule.js +6 -5
- package/dist/cron-schedule.js.map +1 -1
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +3 -2
- package/dist/data-table.js.map +1 -1
- package/dist/dropdown-button.d.ts.map +1 -1
- package/dist/dropdown-button.js +4 -2
- package/dist/dropdown-button.js.map +1 -1
- package/dist/editable-text.js +1 -1
- package/dist/editable-text.js.map +1 -1
- package/dist/empty-state.d.ts +42 -0
- package/dist/empty-state.d.ts.map +1 -0
- package/dist/empty-state.js +172 -0
- package/dist/empty-state.js.map +1 -0
- package/dist/form-field.js +1 -1
- package/dist/form-field.js.map +1 -1
- package/dist/form-select.js +3 -3
- package/dist/form-select.js.map +1 -1
- package/dist/frame-box.js +1 -1
- package/dist/frame-box.js.map +1 -1
- package/dist/fullscreen-button.js +1 -1
- package/dist/fullscreen-button.js.map +1 -1
- package/dist/icons.d.ts +2 -0
- package/dist/icons.d.ts.map +1 -1
- package/dist/icons.js +2 -0
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/kanban-card.js +1 -1
- package/dist/kanban-card.js.map +1 -1
- package/dist/kanban-column.js +3 -3
- package/dist/kanban-column.js.map +1 -1
- package/dist/kbd-hint.d.ts.map +1 -1
- package/dist/kbd-hint.js +2 -1
- package/dist/kbd-hint.js.map +1 -1
- package/dist/link-card.js +1 -1
- package/dist/link-card.js.map +1 -1
- package/dist/markdown-view.js +3 -3
- package/dist/markdown-view.js.map +1 -1
- package/dist/modal-dialog.js +1 -1
- package/dist/modal-dialog.js.map +1 -1
- package/dist/multi-select.js +5 -5
- package/dist/multi-select.js.map +1 -1
- package/dist/pagination-nav.d.ts.map +1 -1
- package/dist/pagination-nav.js +5 -1
- package/dist/pagination-nav.js.map +1 -1
- package/dist/photo-gallery.js +1 -1
- package/dist/photo-gallery.js.map +1 -1
- package/dist/popover-panel.d.ts.map +1 -1
- package/dist/popover-panel.js +4 -2
- package/dist/popover-panel.js.map +1 -1
- package/dist/progress-bar.d.ts.map +1 -1
- package/dist/progress-bar.js +1 -0
- package/dist/progress-bar.js.map +1 -1
- package/dist/radio-cards.js +1 -1
- package/dist/radio-cards.js.map +1 -1
- package/dist/radio-pills.js +1 -1
- package/dist/radio-pills.js.map +1 -1
- package/dist/reveal-button.js +1 -1
- package/dist/reveal-button.js.map +1 -1
- package/dist/scroll-to-bottom.js +1 -1
- package/dist/scroll-to-bottom.js.map +1 -1
- package/dist/scroll-to-top.js +1 -1
- package/dist/scroll-to-top.js.map +1 -1
- package/dist/skip-link.d.ts +30 -0
- package/dist/skip-link.d.ts.map +1 -0
- package/dist/skip-link.js +136 -0
- package/dist/skip-link.js.map +1 -0
- package/dist/slide-panel.js +1 -1
- package/dist/slide-panel.js.map +1 -1
- package/dist/spec-list.d.ts +49 -0
- package/dist/spec-list.d.ts.map +1 -0
- package/dist/spec-list.js +168 -0
- package/dist/spec-list.js.map +1 -0
- package/dist/stat-meter.d.ts.map +1 -1
- package/dist/stat-meter.js +1 -0
- package/dist/stat-meter.js.map +1 -1
- package/dist/tab-bar.js +1 -1
- package/dist/tab-bar.js.map +1 -1
- package/dist/text-area.js +1 -1
- package/dist/text-area.js.map +1 -1
- package/dist/tile-grid.js +1 -1
- package/dist/tile-grid.js.map +1 -1
- package/dist/tokens.css +42 -1
- package/dist/tokens.d.ts +50 -0
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +132 -0
- package/dist/tokens.js.map +1 -1
- package/dist/tree-view.js +2 -2
- package/dist/tree-view.js.map +1 -1
- package/dist/ui-admonition.js +1 -1
- package/dist/ui-admonition.js.map +1 -1
- package/dist/ui-button.js +1 -1
- package/dist/ui-button.js.map +1 -1
- package/dist/video-player.js +1 -1
- package/dist/video-player.js.map +1 -1
- package/dist/vote-control.d.ts +40 -0
- package/dist/vote-control.d.ts.map +1 -0
- package/dist/vote-control.js +311 -0
- package/dist/vote-control.js.map +1 -0
- package/docs/address-autocomplete.md +1 -0
- package/docs/app-shell.md +1 -0
- package/docs/app-sidebar.md +1 -0
- package/docs/audio-player.md +1 -0
- package/docs/autocomplete-input.md +1 -0
- package/docs/breadcrumb-nav.md +70 -0
- package/docs/button-group.md +1 -0
- package/docs/calendar-day.md +1 -0
- package/docs/calendar-month.md +1 -0
- package/docs/calendar-week.md +1 -0
- package/docs/chat-message.md +1 -0
- package/docs/comment-composer.md +1 -0
- package/docs/confirm-dialog.md +1 -0
- package/docs/content-divider.md +1 -0
- package/docs/cron-schedule.md +2 -0
- package/docs/data-table.md +2 -0
- package/docs/design-language.md +57 -5
- package/docs/dropdown-button.md +1 -0
- package/docs/editable-text.md +1 -0
- package/docs/empty-state.md +55 -0
- package/docs/form-field.md +1 -0
- package/docs/form-select.md +1 -0
- package/docs/frame-box.md +1 -0
- package/docs/fullscreen-button.md +1 -0
- package/docs/icons.md +1 -0
- package/docs/kanban-card.md +1 -0
- package/docs/kanban-column.md +1 -0
- package/docs/kbd-hint.md +1 -0
- package/docs/link-card.md +1 -0
- package/docs/markdown-view.md +1 -0
- package/docs/modal-dialog.md +1 -0
- package/docs/multi-select.md +1 -0
- package/docs/pagination-nav.md +2 -0
- package/docs/photo-gallery.md +1 -0
- package/docs/popover-panel.md +1 -0
- package/docs/progress-bar.md +1 -0
- package/docs/radio-cards.md +1 -0
- package/docs/radio-pills.md +1 -0
- package/docs/reveal-button.md +1 -0
- package/docs/scroll-to-bottom.md +1 -0
- package/docs/scroll-to-top.md +1 -0
- package/docs/skip-link.md +54 -0
- package/docs/slide-panel.md +1 -0
- package/docs/spec-list.md +71 -0
- package/docs/stat-meter.md +1 -0
- package/docs/tab-bar.md +1 -0
- package/docs/text-area.md +1 -0
- package/docs/tile-grid.md +1 -0
- package/docs/tree-view.md +1 -0
- package/docs/ui-admonition.md +1 -0
- package/docs/ui-button.md +1 -0
- package/docs/video-player.md +1 -0
- package/docs/vote-control.md +73 -0
- package/llms.txt +201 -49
- package/package.json +1 -1
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, css, html, nothing } from "lit";
|
|
8
|
+
import { customElement, property } from "lit/decorators.js";
|
|
9
|
+
import { iconChevronDown, iconChevronUp } from "./icons.js";
|
|
10
|
+
import { tokens } from "./tokens.js";
|
|
11
|
+
/**
|
|
12
|
+
* An up/down vote widget with a live score readout — the "vote an entry up or
|
|
13
|
+
* down toward a promotion threshold" pattern from a public register site,
|
|
14
|
+
* where one member casts a single vote that can be changed or withdrawn at any
|
|
15
|
+
* time. Two native `<button>`s flank a score; the button matching the user's
|
|
16
|
+
* own cast `vote` reads as pressed (`aria-pressed`), and clicking it again
|
|
17
|
+
* withdraws the vote. Set an optional `target` to render a thin progress meter
|
|
18
|
+
* toward the promotion threshold beneath (vertical) or beside (horizontal) the
|
|
19
|
+
* buttons.
|
|
20
|
+
*
|
|
21
|
+
* @element vote-control
|
|
22
|
+
* @fires vote-change - The user cast, switched, or withdrew their vote;
|
|
23
|
+
* detail: { vote: "up" | "down" | null, value: number }.
|
|
24
|
+
*/
|
|
25
|
+
let VoteControl = class VoteControl extends LitElement {
|
|
26
|
+
constructor() {
|
|
27
|
+
super(...arguments);
|
|
28
|
+
/** The current net score shown between the buttons. */
|
|
29
|
+
this.value = 0;
|
|
30
|
+
/** This user's own cast vote, or `null` if they have not voted. Reflected so CSS can style the pressed button. */
|
|
31
|
+
this.vote = null;
|
|
32
|
+
/** Disables both buttons and dims the control. */
|
|
33
|
+
this.disabled = false;
|
|
34
|
+
/** Layout — `vertical` is the compact stacked box (default); `horizontal` is the wide inline variant. */
|
|
35
|
+
this.orientation = "vertical";
|
|
36
|
+
/** Promotion threshold. When > 0, a thin progress meter toward it renders; when 0 (default) no meter renders and no space is reserved for it. */
|
|
37
|
+
this.target = 0;
|
|
38
|
+
/** Accessible label naming the vote group. */
|
|
39
|
+
this.label = "Vote";
|
|
40
|
+
}
|
|
41
|
+
static { this.styles = [
|
|
42
|
+
tokens,
|
|
43
|
+
css `
|
|
44
|
+
:host {
|
|
45
|
+
display: inline-block;
|
|
46
|
+
font-family: var(
|
|
47
|
+
--ui-font,
|
|
48
|
+
ui-sans-serif,
|
|
49
|
+
system-ui,
|
|
50
|
+
sans-serif,
|
|
51
|
+
"Apple Color Emoji",
|
|
52
|
+
"Segoe UI Emoji",
|
|
53
|
+
"Segoe UI Symbol",
|
|
54
|
+
"Noto Color Emoji"
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
.control {
|
|
58
|
+
display: inline-flex;
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);
|
|
61
|
+
border-radius: var(--ui-radius, 0.5rem);
|
|
62
|
+
background: var(--ui-surface, #ffffff);
|
|
63
|
+
}
|
|
64
|
+
/* Vertical (default): stacked box — up, score, down, optional meter. */
|
|
65
|
+
:host([orientation="vertical"]) .control {
|
|
66
|
+
flex-direction: column;
|
|
67
|
+
align-items: stretch;
|
|
68
|
+
padding: 0.25rem;
|
|
69
|
+
gap: 0.25rem;
|
|
70
|
+
}
|
|
71
|
+
/* Horizontal: wide inline row — up, score, down, optional meter beside. */
|
|
72
|
+
:host([orientation="horizontal"]) .control {
|
|
73
|
+
flex-direction: row;
|
|
74
|
+
align-items: center;
|
|
75
|
+
padding: 0.25rem 0.5rem;
|
|
76
|
+
gap: 0.5rem;
|
|
77
|
+
}
|
|
78
|
+
.buttons {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
justify-content: center;
|
|
82
|
+
gap: 0.25rem;
|
|
83
|
+
}
|
|
84
|
+
:host([orientation="vertical"]) .buttons {
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
}
|
|
87
|
+
:host([orientation="horizontal"]) .buttons {
|
|
88
|
+
flex-direction: row;
|
|
89
|
+
}
|
|
90
|
+
.vote-btn {
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
align-items: center;
|
|
93
|
+
justify-content: center;
|
|
94
|
+
width: 2rem;
|
|
95
|
+
height: 2rem;
|
|
96
|
+
padding: 0;
|
|
97
|
+
box-sizing: border-box;
|
|
98
|
+
border: none;
|
|
99
|
+
border-radius: var(--ui-radius-sm, 0.25rem);
|
|
100
|
+
background: none;
|
|
101
|
+
color: var(--ui-text-muted, #64748b);
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
.vote-btn:hover:not(:disabled) {
|
|
105
|
+
background: var(--ui-surface-muted, #f8fafc);
|
|
106
|
+
color: var(--ui-text, #0f172a);
|
|
107
|
+
}
|
|
108
|
+
.vote-btn.up[aria-pressed="true"] {
|
|
109
|
+
color: var(--ui-success, #16a34a);
|
|
110
|
+
background: var(--ui-surface-muted, #f8fafc);
|
|
111
|
+
}
|
|
112
|
+
.vote-btn.down[aria-pressed="true"] {
|
|
113
|
+
color: var(--ui-danger, #dc2626);
|
|
114
|
+
background: var(--ui-surface-muted, #f8fafc);
|
|
115
|
+
}
|
|
116
|
+
.vote-btn:disabled {
|
|
117
|
+
cursor: not-allowed;
|
|
118
|
+
opacity: 0.5;
|
|
119
|
+
}
|
|
120
|
+
.vote-btn:focus-visible {
|
|
121
|
+
outline: none;
|
|
122
|
+
box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));
|
|
123
|
+
}
|
|
124
|
+
.score {
|
|
125
|
+
min-width: 2rem;
|
|
126
|
+
text-align: center;
|
|
127
|
+
font-size: var(--ui-font-size-lg, 1rem);
|
|
128
|
+
font-weight: var(--ui-font-weight-semibold, 600);
|
|
129
|
+
line-height: var(--ui-line-height-tight, 1.25);
|
|
130
|
+
color: var(--ui-text, #0f172a);
|
|
131
|
+
font-variant-numeric: var(--ui-numeric, normal);
|
|
132
|
+
}
|
|
133
|
+
.meter {
|
|
134
|
+
display: flex;
|
|
135
|
+
flex-direction: column;
|
|
136
|
+
gap: 0.25rem;
|
|
137
|
+
}
|
|
138
|
+
:host([orientation="horizontal"]) .meter {
|
|
139
|
+
min-width: 4rem;
|
|
140
|
+
}
|
|
141
|
+
.track {
|
|
142
|
+
display: block;
|
|
143
|
+
width: 100%;
|
|
144
|
+
height: 0.25rem;
|
|
145
|
+
border-radius: var(--ui-radius-pill, 9999px);
|
|
146
|
+
background: var(--ui-surface-muted, #f8fafc);
|
|
147
|
+
overflow: hidden;
|
|
148
|
+
}
|
|
149
|
+
.fill {
|
|
150
|
+
display: block;
|
|
151
|
+
height: 100%;
|
|
152
|
+
background: var(--ui-button-accent, var(--ui-primary, #4f46e5));
|
|
153
|
+
transition: width 200ms ease;
|
|
154
|
+
}
|
|
155
|
+
.caption {
|
|
156
|
+
font-size: var(--ui-font-size-xs, 0.6875rem);
|
|
157
|
+
font-weight: var(--ui-font-weight-medium, 500);
|
|
158
|
+
letter-spacing: var(--ui-tracking-wide, 0.04em);
|
|
159
|
+
line-height: var(--ui-line-height-tight, 1.25);
|
|
160
|
+
text-transform: var(--ui-label-transform, none);
|
|
161
|
+
color: var(--ui-text-muted, #64748b);
|
|
162
|
+
font-variant-numeric: var(--ui-numeric, normal);
|
|
163
|
+
text-align: center;
|
|
164
|
+
white-space: nowrap;
|
|
165
|
+
}
|
|
166
|
+
@media (prefers-reduced-motion: no-preference) {
|
|
167
|
+
.score.bump {
|
|
168
|
+
animation: vote-bump 220ms ease;
|
|
169
|
+
}
|
|
170
|
+
@keyframes vote-bump {
|
|
171
|
+
0% {
|
|
172
|
+
transform: scale(1);
|
|
173
|
+
}
|
|
174
|
+
40% {
|
|
175
|
+
transform: scale(1.25);
|
|
176
|
+
}
|
|
177
|
+
100% {
|
|
178
|
+
transform: scale(1);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
@media (prefers-reduced-motion: reduce) {
|
|
183
|
+
.fill {
|
|
184
|
+
transition: none;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
@media (forced-colors: active) {
|
|
188
|
+
.control {
|
|
189
|
+
border: 1px solid CanvasText;
|
|
190
|
+
}
|
|
191
|
+
.vote-btn:focus-visible {
|
|
192
|
+
outline: 2px solid CanvasText;
|
|
193
|
+
outline-offset: 2px;
|
|
194
|
+
box-shadow: none;
|
|
195
|
+
}
|
|
196
|
+
.vote-btn[aria-pressed="true"] {
|
|
197
|
+
outline: 2px solid Highlight;
|
|
198
|
+
}
|
|
199
|
+
.vote-btn:disabled {
|
|
200
|
+
color: GrayText;
|
|
201
|
+
opacity: 1;
|
|
202
|
+
}
|
|
203
|
+
.track {
|
|
204
|
+
border: 1px solid CanvasText;
|
|
205
|
+
}
|
|
206
|
+
.fill {
|
|
207
|
+
background: Highlight;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
`,
|
|
211
|
+
]; }
|
|
212
|
+
updated(changed) {
|
|
213
|
+
if (changed.has("value") && changed.get("value") !== undefined) {
|
|
214
|
+
this.#restartBump();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
#restartBump() {
|
|
218
|
+
const score = this.renderRoot?.querySelector(".score");
|
|
219
|
+
if (!score)
|
|
220
|
+
return;
|
|
221
|
+
score.classList.remove("bump");
|
|
222
|
+
// Force a reflow so removing/re-adding the class restarts the animation.
|
|
223
|
+
void score.offsetWidth;
|
|
224
|
+
score.classList.add("bump");
|
|
225
|
+
}
|
|
226
|
+
#cast(dir) {
|
|
227
|
+
if (this.disabled)
|
|
228
|
+
return;
|
|
229
|
+
const previous = this.vote;
|
|
230
|
+
const nextVote = previous === dir ? null : dir;
|
|
231
|
+
const contribution = (v) => (v === "up" ? 1 : v === "down" ? -1 : 0);
|
|
232
|
+
const delta = contribution(nextVote) - contribution(previous);
|
|
233
|
+
this.vote = nextVote;
|
|
234
|
+
this.value += delta;
|
|
235
|
+
this.dispatchEvent(new CustomEvent("vote-change", {
|
|
236
|
+
detail: { vote: this.vote, value: this.value },
|
|
237
|
+
bubbles: true,
|
|
238
|
+
composed: true,
|
|
239
|
+
}));
|
|
240
|
+
}
|
|
241
|
+
render() {
|
|
242
|
+
const showMeter = this.target > 0;
|
|
243
|
+
const progress = showMeter ? Math.min(100, Math.max(0, (this.value / this.target) * 100)) : 0;
|
|
244
|
+
return html `
|
|
245
|
+
<div class="control" role="group" aria-label=${this.label}>
|
|
246
|
+
<div class="buttons">
|
|
247
|
+
<button
|
|
248
|
+
type="button"
|
|
249
|
+
class="vote-btn up"
|
|
250
|
+
aria-label="Vote up"
|
|
251
|
+
aria-pressed=${this.vote === "up" ? "true" : "false"}
|
|
252
|
+
?disabled=${this.disabled}
|
|
253
|
+
@click=${() => this.#cast("up")}
|
|
254
|
+
>
|
|
255
|
+
${iconChevronUp(18)}
|
|
256
|
+
</button>
|
|
257
|
+
<span class="score" aria-live="polite" aria-atomic="true">${this.value}</span>
|
|
258
|
+
<button
|
|
259
|
+
type="button"
|
|
260
|
+
class="vote-btn down"
|
|
261
|
+
aria-label="Vote down"
|
|
262
|
+
aria-pressed=${this.vote === "down" ? "true" : "false"}
|
|
263
|
+
?disabled=${this.disabled}
|
|
264
|
+
@click=${() => this.#cast("down")}
|
|
265
|
+
>
|
|
266
|
+
${iconChevronDown(18)}
|
|
267
|
+
</button>
|
|
268
|
+
</div>
|
|
269
|
+
${showMeter
|
|
270
|
+
? html `
|
|
271
|
+
<div class="meter">
|
|
272
|
+
<span
|
|
273
|
+
class="track"
|
|
274
|
+
role="progressbar"
|
|
275
|
+
aria-valuenow=${this.value}
|
|
276
|
+
aria-valuemin="0"
|
|
277
|
+
aria-valuemax=${this.target}
|
|
278
|
+
>
|
|
279
|
+
<span class="fill" style=${`width: ${progress}%`}></span>
|
|
280
|
+
</span>
|
|
281
|
+
<span class="caption">${this.value} / ${this.target}</span>
|
|
282
|
+
</div>
|
|
283
|
+
`
|
|
284
|
+
: nothing}
|
|
285
|
+
</div>
|
|
286
|
+
`;
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
__decorate([
|
|
290
|
+
property({ type: Number, reflect: true })
|
|
291
|
+
], VoteControl.prototype, "value", void 0);
|
|
292
|
+
__decorate([
|
|
293
|
+
property({ reflect: true })
|
|
294
|
+
], VoteControl.prototype, "vote", void 0);
|
|
295
|
+
__decorate([
|
|
296
|
+
property({ type: Boolean, reflect: true })
|
|
297
|
+
], VoteControl.prototype, "disabled", void 0);
|
|
298
|
+
__decorate([
|
|
299
|
+
property({ reflect: true })
|
|
300
|
+
], VoteControl.prototype, "orientation", void 0);
|
|
301
|
+
__decorate([
|
|
302
|
+
property({ type: Number })
|
|
303
|
+
], VoteControl.prototype, "target", void 0);
|
|
304
|
+
__decorate([
|
|
305
|
+
property()
|
|
306
|
+
], VoteControl.prototype, "label", void 0);
|
|
307
|
+
VoteControl = __decorate([
|
|
308
|
+
customElement("vote-control")
|
|
309
|
+
], VoteControl);
|
|
310
|
+
export { VoteControl };
|
|
311
|
+
//# sourceMappingURL=vote-control.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vote-control.js","sourceRoot":"","sources":["../src/vote-control.ts"],"names":[],"mappings":"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","sourcesContent":["import { LitElement, css, html, nothing } from \"lit\";\nimport type { PropertyValues } from \"lit\";\nimport { customElement, property } from \"lit/decorators.js\";\nimport { iconChevronDown, iconChevronUp } from \"./icons.js\";\nimport { tokens } from \"./tokens.js\";\n\n/**\n * An up/down vote widget with a live score readout — the \"vote an entry up or\n * down toward a promotion threshold\" pattern from a public register site,\n * where one member casts a single vote that can be changed or withdrawn at any\n * time. Two native `<button>`s flank a score; the button matching the user's\n * own cast `vote` reads as pressed (`aria-pressed`), and clicking it again\n * withdraws the vote. Set an optional `target` to render a thin progress meter\n * toward the promotion threshold beneath (vertical) or beside (horizontal) the\n * buttons.\n *\n * @element vote-control\n * @fires vote-change - The user cast, switched, or withdrew their vote;\n * detail: { vote: \"up\" | \"down\" | null, value: number }.\n */\n@customElement(\"vote-control\")\nexport class VoteControl extends LitElement {\n static override styles = [\n tokens,\n css`\n :host {\n display: inline-block;\n font-family: var(\n --ui-font,\n ui-sans-serif,\n system-ui,\n sans-serif,\n \"Apple Color Emoji\",\n \"Segoe UI Emoji\",\n \"Segoe UI Symbol\",\n \"Noto Color Emoji\"\n );\n }\n .control {\n display: inline-flex;\n box-sizing: border-box;\n border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);\n border-radius: var(--ui-radius, 0.5rem);\n background: var(--ui-surface, #ffffff);\n }\n /* Vertical (default): stacked box — up, score, down, optional meter. */\n :host([orientation=\"vertical\"]) .control {\n flex-direction: column;\n align-items: stretch;\n padding: 0.25rem;\n gap: 0.25rem;\n }\n /* Horizontal: wide inline row — up, score, down, optional meter beside. */\n :host([orientation=\"horizontal\"]) .control {\n flex-direction: row;\n align-items: center;\n padding: 0.25rem 0.5rem;\n gap: 0.5rem;\n }\n .buttons {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 0.25rem;\n }\n :host([orientation=\"vertical\"]) .buttons {\n flex-direction: column;\n }\n :host([orientation=\"horizontal\"]) .buttons {\n flex-direction: row;\n }\n .vote-btn {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 2rem;\n height: 2rem;\n padding: 0;\n box-sizing: border-box;\n border: none;\n border-radius: var(--ui-radius-sm, 0.25rem);\n background: none;\n color: var(--ui-text-muted, #64748b);\n cursor: pointer;\n }\n .vote-btn:hover:not(:disabled) {\n background: var(--ui-surface-muted, #f8fafc);\n color: var(--ui-text, #0f172a);\n }\n .vote-btn.up[aria-pressed=\"true\"] {\n color: var(--ui-success, #16a34a);\n background: var(--ui-surface-muted, #f8fafc);\n }\n .vote-btn.down[aria-pressed=\"true\"] {\n color: var(--ui-danger, #dc2626);\n background: var(--ui-surface-muted, #f8fafc);\n }\n .vote-btn:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n .vote-btn:focus-visible {\n outline: none;\n box-shadow: var(--ui-focus-ring, 0 0 0 3px rgb(79 70 229 / 0.35));\n }\n .score {\n min-width: 2rem;\n text-align: center;\n font-size: var(--ui-font-size-lg, 1rem);\n font-weight: var(--ui-font-weight-semibold, 600);\n line-height: var(--ui-line-height-tight, 1.25);\n color: var(--ui-text, #0f172a);\n font-variant-numeric: var(--ui-numeric, normal);\n }\n .meter {\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n }\n :host([orientation=\"horizontal\"]) .meter {\n min-width: 4rem;\n }\n .track {\n display: block;\n width: 100%;\n height: 0.25rem;\n border-radius: var(--ui-radius-pill, 9999px);\n background: var(--ui-surface-muted, #f8fafc);\n overflow: hidden;\n }\n .fill {\n display: block;\n height: 100%;\n background: var(--ui-button-accent, var(--ui-primary, #4f46e5));\n transition: width 200ms ease;\n }\n .caption {\n font-size: var(--ui-font-size-xs, 0.6875rem);\n font-weight: var(--ui-font-weight-medium, 500);\n letter-spacing: var(--ui-tracking-wide, 0.04em);\n line-height: var(--ui-line-height-tight, 1.25);\n text-transform: var(--ui-label-transform, none);\n color: var(--ui-text-muted, #64748b);\n font-variant-numeric: var(--ui-numeric, normal);\n text-align: center;\n white-space: nowrap;\n }\n @media (prefers-reduced-motion: no-preference) {\n .score.bump {\n animation: vote-bump 220ms ease;\n }\n @keyframes vote-bump {\n 0% {\n transform: scale(1);\n }\n 40% {\n transform: scale(1.25);\n }\n 100% {\n transform: scale(1);\n }\n }\n }\n @media (prefers-reduced-motion: reduce) {\n .fill {\n transition: none;\n }\n }\n @media (forced-colors: active) {\n .control {\n border: 1px solid CanvasText;\n }\n .vote-btn:focus-visible {\n outline: 2px solid CanvasText;\n outline-offset: 2px;\n box-shadow: none;\n }\n .vote-btn[aria-pressed=\"true\"] {\n outline: 2px solid Highlight;\n }\n .vote-btn:disabled {\n color: GrayText;\n opacity: 1;\n }\n .track {\n border: 1px solid CanvasText;\n }\n .fill {\n background: Highlight;\n }\n }\n `,\n ];\n\n /** The current net score shown between the buttons. */\n @property({ type: Number, reflect: true }) value = 0;\n\n /** This user's own cast vote, or `null` if they have not voted. Reflected so CSS can style the pressed button. */\n @property({ reflect: true }) vote: \"up\" | \"down\" | null = null;\n\n /** Disables both buttons and dims the control. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Layout — `vertical` is the compact stacked box (default); `horizontal` is the wide inline variant. */\n @property({ reflect: true }) orientation: \"vertical\" | \"horizontal\" = \"vertical\";\n\n /** Promotion threshold. When > 0, a thin progress meter toward it renders; when 0 (default) no meter renders and no space is reserved for it. */\n @property({ type: Number }) target = 0;\n\n /** Accessible label naming the vote group. */\n @property() label = \"Vote\";\n\n override updated(changed: PropertyValues<this>) {\n if (changed.has(\"value\") && changed.get(\"value\") !== undefined) {\n this.#restartBump();\n }\n }\n\n #restartBump() {\n const score = this.renderRoot?.querySelector<HTMLElement>(\".score\");\n if (!score) return;\n score.classList.remove(\"bump\");\n // Force a reflow so removing/re-adding the class restarts the animation.\n void score.offsetWidth;\n score.classList.add(\"bump\");\n }\n\n #cast(dir: \"up\" | \"down\") {\n if (this.disabled) return;\n const previous = this.vote;\n const nextVote = previous === dir ? null : dir;\n const contribution = (v: \"up\" | \"down\" | null) => (v === \"up\" ? 1 : v === \"down\" ? -1 : 0);\n const delta = contribution(nextVote) - contribution(previous);\n this.vote = nextVote;\n this.value += delta;\n this.dispatchEvent(\n new CustomEvent(\"vote-change\", {\n detail: { vote: this.vote, value: this.value },\n bubbles: true,\n composed: true,\n }),\n );\n }\n\n override render() {\n const showMeter = this.target > 0;\n const progress = showMeter ? Math.min(100, Math.max(0, (this.value / this.target) * 100)) : 0;\n return html`\n <div class=\"control\" role=\"group\" aria-label=${this.label}>\n <div class=\"buttons\">\n <button\n type=\"button\"\n class=\"vote-btn up\"\n aria-label=\"Vote up\"\n aria-pressed=${this.vote === \"up\" ? \"true\" : \"false\"}\n ?disabled=${this.disabled}\n @click=${() => this.#cast(\"up\")}\n >\n ${iconChevronUp(18)}\n </button>\n <span class=\"score\" aria-live=\"polite\" aria-atomic=\"true\">${this.value}</span>\n <button\n type=\"button\"\n class=\"vote-btn down\"\n aria-label=\"Vote down\"\n aria-pressed=${this.vote === \"down\" ? \"true\" : \"false\"}\n ?disabled=${this.disabled}\n @click=${() => this.#cast(\"down\")}\n >\n ${iconChevronDown(18)}\n </button>\n </div>\n ${showMeter\n ? html`\n <div class=\"meter\">\n <span\n class=\"track\"\n role=\"progressbar\"\n aria-valuenow=${this.value}\n aria-valuemin=\"0\"\n aria-valuemax=${this.target}\n >\n <span class=\"fill\" style=${`width: ${progress}%`}></span>\n </span>\n <span class=\"caption\">${this.value} / ${this.target}</span>\n </div>\n `\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"vote-control\": VoteControl;\n }\n}\n"]}
|
package/docs/app-shell.md
CHANGED
package/docs/app-sidebar.md
CHANGED
package/docs/audio-player.md
CHANGED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# `<breadcrumb-nav>`
|
|
2
|
+
|
|
3
|
+
A breadcrumb trail: a `<nav aria-label="Breadcrumb">` wrapping an ordered
|
|
4
|
+
list, with chevron separators and the current page rendered as plain,
|
|
5
|
+
non-interactive text. Designed to drop into `page-header`'s `breadcrumb`
|
|
6
|
+
slot, but usable on its own anywhere a trail is needed.
|
|
7
|
+
|
|
8
|
+
The last `items` entry is always treated as the current page: it renders as
|
|
9
|
+
text with `aria-current="page"` even if it carries an `href`. Middle entries
|
|
10
|
+
without an `href` render as plain text too; only middle entries with an
|
|
11
|
+
`href` are real anchors.
|
|
12
|
+
|
|
13
|
+
When `max-visible` is greater than zero and the trail is longer than that,
|
|
14
|
+
the middle collapses behind an overflow button that always keeps the first
|
|
15
|
+
and current crumbs visible; activating it toggles `expanded` to reveal the
|
|
16
|
+
hidden crumbs in place.
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
import "@f-ewald/components/breadcrumb-nav.js";
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```html
|
|
27
|
+
<breadcrumb-nav></breadcrumb-nav>
|
|
28
|
+
<script type="module">
|
|
29
|
+
const trail = document.querySelector("breadcrumb-nav");
|
|
30
|
+
trail.items = [
|
|
31
|
+
{ label: "Home", href: "/" },
|
|
32
|
+
{ label: "Settings", href: "/settings" },
|
|
33
|
+
{ label: "Members" },
|
|
34
|
+
];
|
|
35
|
+
trail.addEventListener("breadcrumb-navigate", (e) => console.log(e.detail.item.label, e.detail.index));
|
|
36
|
+
</script>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Attributes / properties
|
|
40
|
+
|
|
41
|
+
| Property | Attribute | Type | Default | Description |
|
|
42
|
+
| --- | --- | --- | --- | --- |
|
|
43
|
+
| `items` | `items` | `BreadcrumbItem[]` | `[]` | The crumbs, root first. The last entry is the current page and is rendered as non-interactive text with `aria-current="page"`. |
|
|
44
|
+
| `maxVisible` | `max-visible` | `number` | `0` | When greater than zero and the trail has more items than this, collapse the middle of the trail behind an overflow button (the first and current crumbs always stay visible). `0` (the default) never collapses. |
|
|
45
|
+
| `expanded` | `expanded` | `boolean` | `false` | Whether a collapsed trail is currently expanded to show its hidden crumbs. |
|
|
46
|
+
|
|
47
|
+
## Events
|
|
48
|
+
|
|
49
|
+
| Event | Description |
|
|
50
|
+
| --- | --- |
|
|
51
|
+
| `breadcrumb-navigate` | A crumb link was activated; `detail` is `{ item: BreadcrumbItem; index: number }`. This is an additional notification hook only — the anchor's native navigation is never prevented, so crumbs stay real, middle-clickable, right-clickable links. |
|
|
52
|
+
|
|
53
|
+
## Slots
|
|
54
|
+
|
|
55
|
+
_None._
|
|
56
|
+
|
|
57
|
+
## CSS custom properties
|
|
58
|
+
|
|
59
|
+
| Custom property |
|
|
60
|
+
| --- |
|
|
61
|
+
| `--ui-focus-ring` |
|
|
62
|
+
| `--ui-font` |
|
|
63
|
+
| `--ui-font-size-sm` |
|
|
64
|
+
| `--ui-font-weight-medium` |
|
|
65
|
+
| `--ui-font-weight-regular` |
|
|
66
|
+
| `--ui-line-height-glyph` |
|
|
67
|
+
| `--ui-line-height-tight` |
|
|
68
|
+
| `--ui-radius-sm` |
|
|
69
|
+
| `--ui-text` |
|
|
70
|
+
| `--ui-text-muted` |
|
package/docs/button-group.md
CHANGED
package/docs/calendar-day.md
CHANGED
package/docs/calendar-month.md
CHANGED
package/docs/calendar-week.md
CHANGED
package/docs/chat-message.md
CHANGED
package/docs/comment-composer.md
CHANGED
package/docs/confirm-dialog.md
CHANGED
package/docs/content-divider.md
CHANGED
package/docs/cron-schedule.md
CHANGED
|
@@ -64,12 +64,14 @@ _None._
|
|
|
64
64
|
| Custom property |
|
|
65
65
|
| --- |
|
|
66
66
|
| `--ui-border` |
|
|
67
|
+
| `--ui-border-width` |
|
|
67
68
|
| `--ui-focus-ring` |
|
|
68
69
|
| `--ui-font` |
|
|
69
70
|
| `--ui-font-mono` |
|
|
70
71
|
| `--ui-font-size-sm` |
|
|
71
72
|
| `--ui-font-size-xs` |
|
|
72
73
|
| `--ui-font-weight-medium` |
|
|
74
|
+
| `--ui-label-transform` |
|
|
73
75
|
| `--ui-line-height-tight` |
|
|
74
76
|
| `--ui-primary` |
|
|
75
77
|
| `--ui-radius` |
|
package/docs/data-table.md
CHANGED
|
@@ -57,10 +57,12 @@ _None._
|
|
|
57
57
|
| Custom property |
|
|
58
58
|
| --- |
|
|
59
59
|
| `--ui-border` |
|
|
60
|
+
| `--ui-border-width` |
|
|
60
61
|
| `--ui-focus-ring` |
|
|
61
62
|
| `--ui-font` |
|
|
62
63
|
| `--ui-font-size-sm` |
|
|
63
64
|
| `--ui-font-weight-semibold` |
|
|
65
|
+
| `--ui-label-transform` |
|
|
64
66
|
| `--ui-surface-muted` |
|
|
65
67
|
| `--ui-text` |
|
|
66
68
|
| `--ui-text-muted` |
|
package/docs/design-language.md
CHANGED
|
@@ -23,15 +23,32 @@ defines the details used when creating or reviewing components.
|
|
|
23
23
|
fallback, and any newly introduced `--ui-*` usage must add/carry one too.
|
|
24
24
|
- Themes are single-valued and mutually exclusive, selected by `data-theme` on
|
|
25
25
|
`<html>`: `dark` and `light` force one of the two flat palettes, `gradient`
|
|
26
|
-
glosses buttons and toasts,
|
|
27
|
-
|
|
26
|
+
glosses buttons and toasts, `metro` squares corners and flattens shadows over
|
|
27
|
+
a blue accent, and `blueprint` restyles the palette as a monospace technical
|
|
28
|
+
spec sheet — ink on paper, one pure-blue accent, square corners, and
|
|
29
|
+
structure carried by 1.5px hairline rules instead of shadows. `dark` aside,
|
|
30
|
+
each is layered on the light palette and
|
|
28
31
|
must be excluded from `tokens.css`'s `prefers-color-scheme: dark` media query
|
|
29
32
|
— that selector outranks a bare `[data-theme]`, so a missing exclusion yields
|
|
30
33
|
a half-dark hybrid rather than an outright failure. Adding a theme therefore
|
|
31
34
|
means adding it to `lightThemes` in `generate-tokens-css.mjs`, which derives
|
|
32
35
|
both the block and the exclusion from that one list.
|
|
33
|
-
- Colors are the normal subject of a theme
|
|
34
|
-
|
|
36
|
+
- Colors are the normal subject of a theme. Three other axes are themeable, each
|
|
37
|
+
introduced by exactly one theme and each defaulting to the behavior that
|
|
38
|
+
predates it:
|
|
39
|
+
- **Shape** — `metro` and `blueprint` set every `--ui-radius*` to `0`.
|
|
40
|
+
- **Border weight** — `--ui-border-width` (`1px`), which `blueprint` takes to
|
|
41
|
+
`1.5px`. Every genuine surface or control border reads it; see "Borders"
|
|
42
|
+
below for what is deliberately excluded.
|
|
43
|
+
- **Label case** — `--ui-label-transform` (`none`), which `blueprint` takes to
|
|
44
|
+
`uppercase`, and `--ui-numeric` (`normal`), which it takes to
|
|
45
|
+
`tabular-nums`.
|
|
46
|
+
- **Type family** — `--ui-font` only. `blueprint` retargets it to a monospace
|
|
47
|
+
stack led by "Space Mono", which falls through to the system mono stack when
|
|
48
|
+
no webfont is loaded, so the theme still renders correctly with zero
|
|
49
|
+
external CSS.
|
|
50
|
+
Type *metrics* — size, weight, line height, tracking — are never themed in any
|
|
51
|
+
theme: they encode hierarchy rather than style.
|
|
35
52
|
- Semantic states use `primary`, `info`, `success`, `warning`, and `danger`.
|
|
36
53
|
- Foregrounds on solid semantic fills use `--ui-on-accent`.
|
|
37
54
|
- Elevated dark tooltips use `--ui-tooltip`; modal backdrops use
|
|
@@ -86,6 +103,20 @@ literal values are migrated onto them.
|
|
|
86
103
|
labels, and `--ui-line-height-normal` (1.5) for running body text.
|
|
87
104
|
- **Tracking:** `--ui-tracking-normal` (0) is the default; `--ui-tracking-wide`
|
|
88
105
|
(0.04em) is the single widened step for uppercase micro-labels.
|
|
106
|
+
- **Label case:** chrome micro-labels — the small, wide-tracked text that names
|
|
107
|
+
a region, a field, or a column (`spec-list` keys, `data-table` headers,
|
|
108
|
+
`stat-meter` and `cron-schedule` group labels) — carry
|
|
109
|
+
`text-transform: var(--ui-label-transform, none)` so a theme can set them in
|
|
110
|
+
caps. Never apply it to user-supplied content: shouting someone's data is not
|
|
111
|
+
a theme's decision, and `text-transform` is presentational, so the text still
|
|
112
|
+
copies out in its original casing. Components that are uppercase by design in
|
|
113
|
+
every theme (`frame-box`'s legend, `app-sidebar`'s section heading) keep a
|
|
114
|
+
literal `uppercase` — the token exists to *add* caps, not to remove them.
|
|
115
|
+
- **Numerals:** figures that change in place or stack into a column
|
|
116
|
+
(`pagination-nav`'s status, `progress-bar`'s value, `vote-control`'s score)
|
|
117
|
+
use `font-variant-numeric: var(--ui-numeric, normal)`. Readouts that must be
|
|
118
|
+
tabular in every theme — a ticking clock, a calendar grid — keep a literal
|
|
119
|
+
`tabular-nums` instead, since the token's default would undo them.
|
|
89
120
|
- **Exemptions:** SVG presentation attributes (`font-size="…"`,
|
|
90
121
|
`font-weight="…"`) can't take `var()` and stay literal at the token's
|
|
91
122
|
fallback value; `line-height: 0` used purely to collapse an inline
|
|
@@ -95,9 +126,30 @@ literal values are migrated onto them.
|
|
|
95
126
|
|
|
96
127
|
- `padding`, `margin`, and `gap` use literal multiples of `0.25rem`; spacing is
|
|
97
128
|
not tokenized. Convert CSS layout pixels to rems.
|
|
98
|
-
- Documented spacing exceptions:
|
|
129
|
+
- Documented spacing exceptions: SVG/canvas geometry, percentages,
|
|
99
130
|
aspect ratios, animation timing, proportional calculations derived from a
|
|
100
131
|
public size, `0.125rem` optical alignment nudges, and domain geometry.
|
|
132
|
+
|
|
133
|
+
### Borders
|
|
134
|
+
|
|
135
|
+
- A surface or control border goes through `--ui-border-width` (`1px`):
|
|
136
|
+
`border: var(--ui-border-width, 1px) solid var(--ui-border, #e2e8f0);`. A
|
|
137
|
+
border is chrome, not layout, which is why it is tokenized while spacing is
|
|
138
|
+
not — under `blueprint` these rules do the work a shadow does elsewhere, and
|
|
139
|
+
at 1px they read as a faint table rather than as drawn structure.
|
|
140
|
+
- Three kinds of 1px border stay literal, by design:
|
|
141
|
+
- `@media (forced-colors: active)` borders (`1px solid CanvasText`), which
|
|
142
|
+
answer to the user's palette rather than to a theme.
|
|
143
|
+
- Data-mark geometry — `calendar-month`'s entry-footer rule is drawn in the
|
|
144
|
+
entry's own color and divides one mark's content.
|
|
145
|
+
- Decorative edges whose width is the effect: `range-slider`'s white thumb
|
|
146
|
+
ring, `tab-bar`'s 2px active underline.
|
|
147
|
+
- Anything with a fixed height or width *and* a themeable border must also set
|
|
148
|
+
`box-sizing: border-box`, or a heavier border pushes it past the shared `2rem`
|
|
149
|
+
control target.
|
|
150
|
+
|
|
151
|
+
### Radius
|
|
152
|
+
|
|
101
153
|
- Use `--ui-radius-sm` (`0.25rem` ≈ 4px) for controls, `--ui-radius`
|
|
102
154
|
(`0.5rem` ≈ 8px) for cards/dialogs/surfaces, and `--ui-radius-pill`
|
|
103
155
|
(`9999px`) / `--ui-radius-circle` (`50%`) for intentional pill and circle
|
package/docs/dropdown-button.md
CHANGED