use-wc 1.0.0-pre.70 → 1.0.0-pre.71
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/custom-elements.json +70 -70
- package/dist/design-system.css +95 -2
- package/dist/tokens.css +19 -0
- package/package.json +1 -1
- package/vscode.html-custom-data.json +12 -12
package/custom-elements.json
CHANGED
|
@@ -89,6 +89,76 @@
|
|
|
89
89
|
}
|
|
90
90
|
]
|
|
91
91
|
},
|
|
92
|
+
{
|
|
93
|
+
"kind": "javascript-module",
|
|
94
|
+
"path": "src/elements/use-avatar/use-avatar.ts",
|
|
95
|
+
"declarations": [
|
|
96
|
+
{
|
|
97
|
+
"kind": "class",
|
|
98
|
+
"description": "`use-avatar` renders a small, fixed-size, clipped container for a person or entity's\nlikeness. Slot in an `<img>` (or `<picture>`) for a photo, an inline `<svg>` for a\ngenerated or stylized mark, or arbitrary markup (a `<div>` of initials, a calendar badge);\nwhatever is slotted is centered and clipped to the avatar's shape. With nothing slotted,\n`use-avatar` falls back to initials derived from the `name` attribute.\n\n```html\n<use-avatar><img src=\"ada.jpg\" alt=\"\" /></use-avatar>\n<use-avatar name=\"Riley Quinn\"></use-avatar>\n<use-avatar><svg viewBox=\"0 0 32 32\">…</svg></use-avatar>\n```\n\nSize it with plain CSS — `inline-size` for the size and `aspect-ratio` for the proportions —\nfrom a stylesheet, a style attribute, or the design system's theme layer. The element takes no\ncustom properties of its own: it is a query container, so the initials scale from whatever box\nit ends up with. A non-square `aspect-ratio` suits a wide thumbnail or poster.\n\nThe element clips its content but gives it no shape of its own — that is the theme's, through\nthe affordance classes it defines: `.circle` (the themed default), `.square`, `.squircle` in\n`theme/avatar.css`. A circle only reads right at a `1` ratio, so a wide avatar wants one of the\nothers.\n\nThe element takes no ARIA role of its own. A slotted `<img>` carries its own `alt`, and the\ninitials fallback is plain text in the accessibility tree — an avatar is decorative beside a\nname far more often than it is the name itself, so labelling it here would mean announcing\nthat name twice.",
|
|
99
|
+
"name": "UseAvatar",
|
|
100
|
+
"cssParts": [
|
|
101
|
+
{
|
|
102
|
+
"description": "The span that renders the `name` fallback.",
|
|
103
|
+
"name": "initials"
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"slots": [
|
|
107
|
+
{
|
|
108
|
+
"description": "The avatar's content: an `<img>`/`<picture>`, an `<svg>`, or arbitrary markup. Left empty, the `name` attribute's initials are shown instead, as the slot's own fallback. A photo fills the frame and crops; anything else keeps its own size, capped at the frame. Give an `<svg>` a `width`/`height` — without one it defaults to filling the box, and a rounded shape will clip its corners.",
|
|
109
|
+
"name": ""
|
|
110
|
+
}
|
|
111
|
+
],
|
|
112
|
+
"members": [
|
|
113
|
+
{
|
|
114
|
+
"kind": "field",
|
|
115
|
+
"name": "name",
|
|
116
|
+
"type": {
|
|
117
|
+
"text": "string"
|
|
118
|
+
},
|
|
119
|
+
"default": "\"\"",
|
|
120
|
+
"attribute": "name",
|
|
121
|
+
"reflects": true
|
|
122
|
+
}
|
|
123
|
+
],
|
|
124
|
+
"attributes": [
|
|
125
|
+
{
|
|
126
|
+
"description": "The full name, used for the initials fallback (first + last whitespace-separated token, uppercased) when the slot is empty.",
|
|
127
|
+
"name": "name",
|
|
128
|
+
"type": {
|
|
129
|
+
"text": "string"
|
|
130
|
+
},
|
|
131
|
+
"default": "\"\"",
|
|
132
|
+
"fieldName": "name"
|
|
133
|
+
}
|
|
134
|
+
],
|
|
135
|
+
"superclass": {
|
|
136
|
+
"name": "LitElement",
|
|
137
|
+
"package": "lit"
|
|
138
|
+
},
|
|
139
|
+
"tagName": "use-avatar",
|
|
140
|
+
"customElement": true
|
|
141
|
+
}
|
|
142
|
+
],
|
|
143
|
+
"exports": [
|
|
144
|
+
{
|
|
145
|
+
"kind": "js",
|
|
146
|
+
"name": "UseAvatar",
|
|
147
|
+
"declaration": {
|
|
148
|
+
"name": "UseAvatar",
|
|
149
|
+
"module": "src/elements/use-avatar/use-avatar.ts"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"kind": "custom-element-definition",
|
|
154
|
+
"name": "use-avatar",
|
|
155
|
+
"declaration": {
|
|
156
|
+
"name": "UseAvatar",
|
|
157
|
+
"module": "src/elements/use-avatar/use-avatar.ts"
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
]
|
|
161
|
+
},
|
|
92
162
|
{
|
|
93
163
|
"kind": "javascript-module",
|
|
94
164
|
"path": "src/elements/use-badge/use-badge.ts",
|
|
@@ -232,76 +302,6 @@
|
|
|
232
302
|
}
|
|
233
303
|
]
|
|
234
304
|
},
|
|
235
|
-
{
|
|
236
|
-
"kind": "javascript-module",
|
|
237
|
-
"path": "src/elements/use-avatar/use-avatar.ts",
|
|
238
|
-
"declarations": [
|
|
239
|
-
{
|
|
240
|
-
"kind": "class",
|
|
241
|
-
"description": "`use-avatar` renders a small, fixed-size, clipped container for a person or entity's\nlikeness. Slot in an `<img>` (or `<picture>`) for a photo, an inline `<svg>` for a\ngenerated or stylized mark, or arbitrary markup (a `<div>` of initials, a calendar badge);\nwhatever is slotted is centered and clipped to the avatar's shape. With nothing slotted,\n`use-avatar` falls back to initials derived from the `name` attribute.\n\n```html\n<use-avatar><img src=\"ada.jpg\" alt=\"\" /></use-avatar>\n<use-avatar name=\"Riley Quinn\"></use-avatar>\n<use-avatar><svg viewBox=\"0 0 32 32\">…</svg></use-avatar>\n```\n\nSize it with plain CSS — `inline-size` for the size and `aspect-ratio` for the proportions —\nfrom a stylesheet, a style attribute, or the design system's theme layer. The element takes no\ncustom properties of its own: it is a query container, so the initials scale from whatever box\nit ends up with. A non-square `aspect-ratio` suits a wide thumbnail or poster.\n\nThe element clips its content but gives it no shape of its own — that is the theme's, through\nthe affordance classes it defines: `.circle` (the themed default), `.square`, `.squircle` in\n`theme/avatar.css`. A circle only reads right at a `1` ratio, so a wide avatar wants one of the\nothers.\n\nThe element takes no ARIA role of its own. A slotted `<img>` carries its own `alt`, and the\ninitials fallback is plain text in the accessibility tree — an avatar is decorative beside a\nname far more often than it is the name itself, so labelling it here would mean announcing\nthat name twice.",
|
|
242
|
-
"name": "UseAvatar",
|
|
243
|
-
"cssParts": [
|
|
244
|
-
{
|
|
245
|
-
"description": "The span that renders the `name` fallback.",
|
|
246
|
-
"name": "initials"
|
|
247
|
-
}
|
|
248
|
-
],
|
|
249
|
-
"slots": [
|
|
250
|
-
{
|
|
251
|
-
"description": "The avatar's content: an `<img>`/`<picture>`, an `<svg>`, or arbitrary markup. Left empty, the `name` attribute's initials are shown instead, as the slot's own fallback. A photo fills the frame and crops; anything else keeps its own size, capped at the frame. Give an `<svg>` a `width`/`height` — without one it defaults to filling the box, and a rounded shape will clip its corners.",
|
|
252
|
-
"name": ""
|
|
253
|
-
}
|
|
254
|
-
],
|
|
255
|
-
"members": [
|
|
256
|
-
{
|
|
257
|
-
"kind": "field",
|
|
258
|
-
"name": "name",
|
|
259
|
-
"type": {
|
|
260
|
-
"text": "string"
|
|
261
|
-
},
|
|
262
|
-
"default": "\"\"",
|
|
263
|
-
"attribute": "name",
|
|
264
|
-
"reflects": true
|
|
265
|
-
}
|
|
266
|
-
],
|
|
267
|
-
"attributes": [
|
|
268
|
-
{
|
|
269
|
-
"description": "The full name, used for the initials fallback (first + last whitespace-separated token, uppercased) when the slot is empty.",
|
|
270
|
-
"name": "name",
|
|
271
|
-
"type": {
|
|
272
|
-
"text": "string"
|
|
273
|
-
},
|
|
274
|
-
"default": "\"\"",
|
|
275
|
-
"fieldName": "name"
|
|
276
|
-
}
|
|
277
|
-
],
|
|
278
|
-
"superclass": {
|
|
279
|
-
"name": "LitElement",
|
|
280
|
-
"package": "lit"
|
|
281
|
-
},
|
|
282
|
-
"tagName": "use-avatar",
|
|
283
|
-
"customElement": true
|
|
284
|
-
}
|
|
285
|
-
],
|
|
286
|
-
"exports": [
|
|
287
|
-
{
|
|
288
|
-
"kind": "js",
|
|
289
|
-
"name": "UseAvatar",
|
|
290
|
-
"declaration": {
|
|
291
|
-
"name": "UseAvatar",
|
|
292
|
-
"module": "src/elements/use-avatar/use-avatar.ts"
|
|
293
|
-
}
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
"kind": "custom-element-definition",
|
|
297
|
-
"name": "use-avatar",
|
|
298
|
-
"declaration": {
|
|
299
|
-
"name": "UseAvatar",
|
|
300
|
-
"module": "src/elements/use-avatar/use-avatar.ts"
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
]
|
|
304
|
-
},
|
|
305
305
|
{
|
|
306
306
|
"kind": "javascript-module",
|
|
307
307
|
"path": "src/elements/use-calendar-base/use-calendar-base.ts",
|
package/dist/design-system.css
CHANGED
|
@@ -312,6 +312,10 @@
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
@layer use-theme.link {
|
|
315
|
+
:is(nav, header, footer, [role="navigation"], [role="menubar"], [role="tablist"], [role="toolbar"]) {
|
|
316
|
+
--usewc-effect-link-decoration: var(--usewc-effect-link-chrome-text-decoration);
|
|
317
|
+
}
|
|
318
|
+
|
|
315
319
|
:is(a:not([class*="appearance-"]), .appearance-a) {
|
|
316
320
|
&:where(:not(a)) {
|
|
317
321
|
all: unset;
|
|
@@ -321,7 +325,7 @@
|
|
|
321
325
|
--usewc-effect-outline-width: 0;
|
|
322
326
|
|
|
323
327
|
color: var(--usewc-color-link-text);
|
|
324
|
-
text-decoration: var(--usewc-effect-link-text-decoration);
|
|
328
|
+
text-decoration: var(--usewc-effect-link-decoration, var(--usewc-effect-link-text-decoration));
|
|
325
329
|
cursor: pointer;
|
|
326
330
|
outline: var(--usewc-effect-outline-width) var(--usewc-effect-outline-style) var(--usewc-color-outline);
|
|
327
331
|
outline-offset: var(--usewc-effect-outline-offset);
|
|
@@ -342,6 +346,23 @@
|
|
|
342
346
|
&:active {
|
|
343
347
|
--usewc-color-link-text: var(--usewc-color-link-text-active);
|
|
344
348
|
}
|
|
349
|
+
|
|
350
|
+
nav.sidebar > & {
|
|
351
|
+
display: block;
|
|
352
|
+
/* Swapping these source tokens, rather than the resolved `--usewc-color-link-text` slot
|
|
353
|
+
itself, means the existing `:hover`/`:active` rules above keep working unmodified — they
|
|
354
|
+
already read through `-hover`/`-active`, so overriding what those resolve to here is
|
|
355
|
+
enough to recolor every state at once. */
|
|
356
|
+
--usewc-color-link-text-static: var(--usewc-color-sidebar-item-text-static);
|
|
357
|
+
--usewc-color-link-text-hover: var(--usewc-color-sidebar-item-text-hover);
|
|
358
|
+
--usewc-color-link-text-active: var(--usewc-color-sidebar-item-text-active);
|
|
359
|
+
padding: var(--usewc-layout-sidebar-item-padding-block) var(--usewc-layout-sidebar-item-padding-inline);
|
|
360
|
+
border-radius: var(--usewc-effect-sidebar-item-border-radius);
|
|
361
|
+
|
|
362
|
+
&:is(:hover, :focus-visible) {
|
|
363
|
+
background-color: var(--usewc-color-sidebar-item-background-hover);
|
|
364
|
+
}
|
|
365
|
+
}
|
|
345
366
|
}
|
|
346
367
|
}
|
|
347
368
|
|
|
@@ -1421,8 +1442,14 @@
|
|
|
1421
1442
|
|
|
1422
1443
|
/* Inline padding is the breathing room between the row edge (band edge) and the text. Header
|
|
1423
1444
|
rows take the same inline padding, plus the head's own `--grid-body-inset`, so a header cell
|
|
1424
|
-
lines up with the body cell below it. No block padding — cell padding sets the row height.
|
|
1445
|
+
lines up with the body cell below it. No block padding — cell padding sets the row height.
|
|
1446
|
+
|
|
1447
|
+
`align-items: center` (unset in use-gridrow's own shadow styles, so there's nothing to
|
|
1448
|
+
fight here) sizes each cell to its own content height instead of stretching it to the
|
|
1449
|
+
row's — a cell shorter than its tallest sibling centers within the row rather than
|
|
1450
|
+
stretching past its own content and centering internally. */
|
|
1425
1451
|
use-gridrow {
|
|
1452
|
+
align-items: center;
|
|
1426
1453
|
padding-inline: var(--usewc-layout-grid-row-padding-inline);
|
|
1427
1454
|
|
|
1428
1455
|
use-theme-escape & {
|
|
@@ -2025,6 +2052,18 @@
|
|
|
2025
2052
|
isn't first instead, so the padding alone (never the gap) is what holds the line clear of its
|
|
2026
2053
|
neighbour — the two mechanisms are never both in play at once.
|
|
2027
2054
|
|
|
2055
|
+
`.entry` also takes `.compact`, which steps its own density down for a tighter repetition of
|
|
2056
|
+
the same shape — a nav item rather than a list row. Each variant that supports it declares its
|
|
2057
|
+
own smaller values rather than a shared multiplier, the same way `.message` sits on top of
|
|
2058
|
+
`.entry`'s shape instead of moving `.entry` itself.
|
|
2059
|
+
|
|
2060
|
+
Every variant takes `.flush`, which drops a use-layout's own outer inset so it can sit
|
|
2061
|
+
directly inside a container that already pads itself — an `<a>` in a nav, a dialog's own
|
|
2062
|
+
padded surface — without doubling up. Inline padding goes everywhere it's set, since every
|
|
2063
|
+
region shares one left/right inset; block padding only comes off the two true outer edges —
|
|
2064
|
+
the first region's own top and the last region's own bottom — so the row-gap between regions,
|
|
2065
|
+
and every other region's own padding, are untouched.
|
|
2066
|
+
|
|
2028
2067
|
Every selector stays compound (`use-layout.page`, never a bare `.page`) so none of these
|
|
2029
2068
|
common words can collide with an author's own class of the same name.
|
|
2030
2069
|
|
|
@@ -2243,6 +2282,17 @@
|
|
|
2243
2282
|
}
|
|
2244
2283
|
}
|
|
2245
2284
|
|
|
2285
|
+
use-layout.entry.compact {
|
|
2286
|
+
--usewc-layout-region-padding: var(--usewc-layout-entry-compact-padding);
|
|
2287
|
+
--usewc-layout-region-gap: var(--usewc-layout-entry-compact-gap);
|
|
2288
|
+
--usewc-layout-region-avatar-size: var(--usewc-layout-entry-compact-avatar-size);
|
|
2289
|
+
--usewc-layout-region-row-gap: var(--usewc-layout-entry-compact-gap);
|
|
2290
|
+
|
|
2291
|
+
use-theme-escape & {
|
|
2292
|
+
all: revert-layer;
|
|
2293
|
+
}
|
|
2294
|
+
}
|
|
2295
|
+
|
|
2246
2296
|
/* Chat density on top of `.entry`'s layout — tighter, since a message repeats down a feed. */
|
|
2247
2297
|
use-layout.message {
|
|
2248
2298
|
--usewc-layout-region-padding: var(--usewc-layout-message-padding);
|
|
@@ -2316,6 +2366,49 @@
|
|
|
2316
2366
|
}
|
|
2317
2367
|
}
|
|
2318
2368
|
|
|
2369
|
+
/* `.flush` zeroes a use-layout's own outer inset. Inline padding is one token consumed
|
|
2370
|
+
everywhere it's set (every region, and the container itself for `.entry`/`.message`/`.media`),
|
|
2371
|
+
so overriding it here reaches all of them at once regardless of variant. Block padding is
|
|
2372
|
+
narrower on purpose — only the true outer edges come off, not every region's own padding, so
|
|
2373
|
+
the row-gap between regions and a middle region's spacing are untouched. `.page`/`.card` pad
|
|
2374
|
+
each region individually, so that's a first-child/last-child position match; `.entry`,
|
|
2375
|
+
`.message` and `.media` pad the container itself instead, so that's zeroed directly.
|
|
2376
|
+
|
|
2377
|
+
The selector matches the variant list rather than a bare `.flush` so this out-ranks a
|
|
2378
|
+
two-class modifier like `.entry.compact` on specificity — `.entry.compact.flush` needs
|
|
2379
|
+
`.flush` to win regardless of which order the three classes are combined in. */
|
|
2380
|
+
use-layout:is(.page, .entry, .message, .card, .media).flush {
|
|
2381
|
+
--usewc-layout-region-padding: 0;
|
|
2382
|
+
|
|
2383
|
+
use-theme-escape & {
|
|
2384
|
+
all: revert-layer;
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
use-layout:is(.entry, .message, .media).flush {
|
|
2389
|
+
padding-block: 0;
|
|
2390
|
+
|
|
2391
|
+
use-theme-escape & {
|
|
2392
|
+
all: revert-layer;
|
|
2393
|
+
}
|
|
2394
|
+
}
|
|
2395
|
+
|
|
2396
|
+
use-layout.flush > :first-child {
|
|
2397
|
+
padding-block-start: 0;
|
|
2398
|
+
|
|
2399
|
+
use-theme-escape & {
|
|
2400
|
+
all: revert-layer;
|
|
2401
|
+
}
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2404
|
+
use-layout.flush > :last-child {
|
|
2405
|
+
padding-block-end: 0;
|
|
2406
|
+
|
|
2407
|
+
use-theme-escape & {
|
|
2408
|
+
all: revert-layer;
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2319
2412
|
/* ── Generic regions ────────────────────────────────────────────────────────────────────────
|
|
2320
2413
|
One ruleset for every variant, reading the properties above. Nested under the shared variant
|
|
2321
2414
|
list rather than repeating it on every selector, so it stays in one place as variants are
|
package/dist/tokens.css
CHANGED
|
@@ -203,6 +203,18 @@
|
|
|
203
203
|
--usewc-color-link-text-visited-hover: var(--usewc-color-indigo-600);
|
|
204
204
|
--usewc-color-link-text-visited-active: var(--usewc-color-indigo-700);
|
|
205
205
|
--usewc-effect-link-text-decoration: underline;
|
|
206
|
+
--usewc-effect-link-chrome-text-decoration: none;
|
|
207
|
+
/* - Sidebar nav item */
|
|
208
|
+
/* A sidebar item reads as chrome, not a hyperlink, so its text stays the document's own ink
|
|
209
|
+
rather than link blue — closer to how `use-menu` colors its items than to `link.css`'s own
|
|
210
|
+
defaults. */
|
|
211
|
+
--usewc-color-sidebar-item-text-static: var(--usewc-color-document-text);
|
|
212
|
+
--usewc-color-sidebar-item-text-hover: var(--usewc-color-document-text);
|
|
213
|
+
--usewc-color-sidebar-item-text-active: var(--usewc-color-brand-primary);
|
|
214
|
+
--usewc-color-sidebar-item-background-hover: var(--usewc-color-selector-background-hover);
|
|
215
|
+
--usewc-effect-sidebar-item-border-radius: var(--usewc-effect-border-radius-6);
|
|
216
|
+
--usewc-layout-sidebar-item-padding-block: var(--usewc-space-8);
|
|
217
|
+
--usewc-layout-sidebar-item-padding-inline: var(--usewc-space-12);
|
|
206
218
|
|
|
207
219
|
/* Form */
|
|
208
220
|
/* - Color */
|
|
@@ -750,6 +762,13 @@
|
|
|
750
762
|
--usewc-layout-entry-gap: var(--usewc-space-12);
|
|
751
763
|
--usewc-layout-entry-avatar-size: var(--usewc-layout-region-title-block-size);
|
|
752
764
|
|
|
765
|
+
/* `.compact` steps an entry's own density down for a tighter repetition of the same shape —
|
|
766
|
+
a nav item, not a list row. The rail shrinks with it, since a nav icon reads smaller than a
|
|
767
|
+
person's likeness. */
|
|
768
|
+
--usewc-layout-entry-compact-padding: var(--usewc-space-8);
|
|
769
|
+
--usewc-layout-entry-compact-gap: var(--usewc-space-8);
|
|
770
|
+
--usewc-layout-entry-compact-avatar-size: var(--usewc-space-24);
|
|
771
|
+
|
|
753
772
|
--usewc-layout-message-padding: var(--usewc-space-12);
|
|
754
773
|
--usewc-layout-message-gap: var(--usewc-space-12);
|
|
755
774
|
--usewc-layout-message-rail: var(--usewc-layout-region-title-block-size);
|
package/package.json
CHANGED
|
@@ -19,6 +19,18 @@
|
|
|
19
19
|
],
|
|
20
20
|
"references": []
|
|
21
21
|
},
|
|
22
|
+
{
|
|
23
|
+
"name": "use-avatar",
|
|
24
|
+
"description": "`use-avatar` renders a small, fixed-size, clipped container for a person or entity's\nlikeness. Slot in an `<img>` (or `<picture>`) for a photo, an inline `<svg>` for a\ngenerated or stylized mark, or arbitrary markup (a `<div>` of initials, a calendar badge);\nwhatever is slotted is centered and clipped to the avatar's shape. With nothing slotted,\n`use-avatar` falls back to initials derived from the `name` attribute.\n\n```html\n<use-avatar><img src=\"ada.jpg\" alt=\"\" /></use-avatar>\n<use-avatar name=\"Riley Quinn\"></use-avatar>\n<use-avatar><svg viewBox=\"0 0 32 32\">…</svg></use-avatar>\n```\n\nSize it with plain CSS — `inline-size` for the size and `aspect-ratio` for the proportions —\nfrom a stylesheet, a style attribute, or the design system's theme layer. The element takes no\ncustom properties of its own: it is a query container, so the initials scale from whatever box\nit ends up with. A non-square `aspect-ratio` suits a wide thumbnail or poster.\n\nThe element clips its content but gives it no shape of its own — that is the theme's, through\nthe affordance classes it defines: `.circle` (the themed default), `.square`, `.squircle` in\n`theme/avatar.css`. A circle only reads right at a `1` ratio, so a wide avatar wants one of the\nothers.\n\nThe element takes no ARIA role of its own. A slotted `<img>` carries its own `alt`, and the\ninitials fallback is plain text in the accessibility tree — an avatar is decorative beside a\nname far more often than it is the name itself, so labelling it here would mean announcing\nthat name twice.\n---\n\n\n### **Slots:**\n - _default_ - The avatar's content: an `<img>`/`<picture>`, an `<svg>`, or arbitrary markup. Left empty, the `name` attribute's initials are shown instead, as the slot's own fallback. A photo fills the frame and crops; anything else keeps its own size, capped at the frame. Give an `<svg>` a `width`/`height` — without one it defaults to filling the box, and a rounded shape will clip its corners.\n\n### **CSS Parts:**\n - **initials** - The span that renders the `name` fallback.",
|
|
25
|
+
"attributes": [
|
|
26
|
+
{
|
|
27
|
+
"name": "name",
|
|
28
|
+
"description": "The full name, used for the initials fallback (first + last whitespace-separated token, uppercased) when the slot is empty.",
|
|
29
|
+
"values": []
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"references": []
|
|
33
|
+
},
|
|
22
34
|
{
|
|
23
35
|
"name": "use-badge",
|
|
24
36
|
"description": "`use-badge` renders a small indicator anchored to another element's corner, using\n[CSS anchor positioning](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_anchor_positioning)\ninstead of the classic `position: absolute` + negative-offset trick. This lets the badge live\nanywhere in the DOM rather than being a child of the element it decorates. A badge's shape,\ncolor, and positioning ship built in — reading from the design system's tokens when\n`tokens.css` is loaded, and falling back to sensible defaults otherwise — so no theme is\nrequired to get a working, visible badge.\n\nPoint a badge at its target with the `anchortarget` attribute, set to the target's `id`\n(named to avoid colliding with the `anchor` content attribute HTML is gaining natively):\n\n```html\n<button type=\"button\" id=\"inbox\">Inbox</button>\n<use-badge anchortarget=\"inbox\">99+</use-badge>\n```\n\nThe badge and its anchor must live in the same DOM tree — a badge cannot reach an anchor\ninside another component's shadow root, and an anchor's `anchor-name` set inside a shadow\ntree's stylesheet is not visible here. No positioned ancestor or shared containing block is\nrequired: anchor positioning resolves the badge's location straight from the anchor's own\ngeometry, so the badge can sit anywhere else in the DOM tree.\n\nWithout a resolved anchor — `anchortarget` unset, pointing at a missing id, or `anchorElement`\nnever assigned — the badge has no `:state(anchored)` and renders as a plain inline chip in\nnormal document flow, still using the same color/shape styling.\n\nSome components render their host as `display: contents`, which has no box of its own for CSS\nanchor positioning to resolve against. If the anchor computes a non-empty `--usewc-anchor-name`\ncustom property, the badge uses that dashed-ident as its `position-anchor` directly instead of\ngenerating and writing its own onto the anchor — letting a component publish the name of a\nreal, box-generating part of itself (already established for its own purposes) for badges to\ntarget instead of its host, even though that part lives inside the component's own shadow root.\nThis mechanism is shared with `use-menu`/`use-anchored` via `AnchorController`; components\nwithout a `display: contents` host don't need to publish anything.\n\n**Known Firefox limitation:** anchoring across a shadow root boundary this way — the case\n`--usewc-anchor-name` exists for — is mispositioned in Firefox as of this writing. Verified\ndirectly: `anchor()`'s logical `start`/`end` keywords resolve backwards on both axes\nspecifically for a cross-shadow-root anchor reference, in Firefox only — the same anchor()\ncalls resolve correctly for a same-tree anchor in Firefox, and cross-shadow anchoring resolves\ncorrectly in Chromium and Safari. A badge anchored to a plain element (button, input, anything\nthat isn't itself relying on this escape hatch) is unaffected in every engine, including\nFirefox.\n\n## Side effects\n\nThe badge is a sibling of its anchor rather than a child, so **as a side effect, a badge\nmutates its anchor element**: it appends its own id to the anchor's `aria-describedby`\n(preserving any ids already there, the same way `anchor-name` is appended rather than\nreplaced) to keep its content connected to the anchor for assistive technology. This means a\nbadge's content, or its `aria-label` when set, is announced as part of interacting with the\nanchor, e.g. \"Inbox button, 3\". A `dot` badge has no content of its own, so set `aria-label`\ndirectly on `<use-badge>` for a meaningful description (e.g. `aria-label=\"3 unread messages\"`);\nwithout one, the description contributes nothing and the anchor announces as before.\n\nAvoid adding `aria-hidden` to `<use-badge>` if you rely on this: while the description\ncomputation is specified to still read a hidden node when it's the direct target of\n`aria-describedby`, support for that specific case is inconsistent across browsers and screen\nreaders.\n\nSet `options=\"noaria\"` to opt a badge out of this and leave the anchor's `aria-describedby`\nuntouched, e.g. when the anchor already documents the badge's meaning some other way.\n---\n\n\n### **Slots:**\n - _default_ - Badge content, e.g. a count or short label. Ignored when `dot` is set.",
|
|
@@ -51,18 +63,6 @@
|
|
|
51
63
|
],
|
|
52
64
|
"references": []
|
|
53
65
|
},
|
|
54
|
-
{
|
|
55
|
-
"name": "use-avatar",
|
|
56
|
-
"description": "`use-avatar` renders a small, fixed-size, clipped container for a person or entity's\nlikeness. Slot in an `<img>` (or `<picture>`) for a photo, an inline `<svg>` for a\ngenerated or stylized mark, or arbitrary markup (a `<div>` of initials, a calendar badge);\nwhatever is slotted is centered and clipped to the avatar's shape. With nothing slotted,\n`use-avatar` falls back to initials derived from the `name` attribute.\n\n```html\n<use-avatar><img src=\"ada.jpg\" alt=\"\" /></use-avatar>\n<use-avatar name=\"Riley Quinn\"></use-avatar>\n<use-avatar><svg viewBox=\"0 0 32 32\">…</svg></use-avatar>\n```\n\nSize it with plain CSS — `inline-size` for the size and `aspect-ratio` for the proportions —\nfrom a stylesheet, a style attribute, or the design system's theme layer. The element takes no\ncustom properties of its own: it is a query container, so the initials scale from whatever box\nit ends up with. A non-square `aspect-ratio` suits a wide thumbnail or poster.\n\nThe element clips its content but gives it no shape of its own — that is the theme's, through\nthe affordance classes it defines: `.circle` (the themed default), `.square`, `.squircle` in\n`theme/avatar.css`. A circle only reads right at a `1` ratio, so a wide avatar wants one of the\nothers.\n\nThe element takes no ARIA role of its own. A slotted `<img>` carries its own `alt`, and the\ninitials fallback is plain text in the accessibility tree — an avatar is decorative beside a\nname far more often than it is the name itself, so labelling it here would mean announcing\nthat name twice.\n---\n\n\n### **Slots:**\n - _default_ - The avatar's content: an `<img>`/`<picture>`, an `<svg>`, or arbitrary markup. Left empty, the `name` attribute's initials are shown instead, as the slot's own fallback. A photo fills the frame and crops; anything else keeps its own size, capped at the frame. Give an `<svg>` a `width`/`height` — without one it defaults to filling the box, and a rounded shape will clip its corners.\n\n### **CSS Parts:**\n - **initials** - The span that renders the `name` fallback.",
|
|
57
|
-
"attributes": [
|
|
58
|
-
{
|
|
59
|
-
"name": "name",
|
|
60
|
-
"description": "The full name, used for the initials fallback (first + last whitespace-separated token, uppercased) when the slot is empty.",
|
|
61
|
-
"values": []
|
|
62
|
-
}
|
|
63
|
-
],
|
|
64
|
-
"references": []
|
|
65
|
-
},
|
|
66
66
|
{
|
|
67
67
|
"name": "use-calendarday",
|
|
68
68
|
"description": "A helper component for customizing specific days within `use-calendar`.\nContent placed inside this element will replace the default day number display.\n---\n\n\n### **Slots:**\n - **default** - slot for custom day content (replaces the day number)",
|