@threadlabs/looma 0.26.2 → 0.26.3

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.
@@ -16,7 +16,8 @@
16
16
  <prop name="size" type="keyword" values="xs, sm, md" default="md"
17
17
  >md is 2.5rem, for a person on their own (a profile, a comment); sm is 1.75rem with smaller initials, for a row of people in a toolbar or header; xs is
18
18
  1.25rem with small initials, for a person named inline in a line of small text.</prop>
19
- <prop name="shape" type="keyword" values="circle, square" default="circle">Circle by default; square uses the theme's medium radius.</prop>
19
+ <prop name="shape" type="keyword" values="circle, square" default="circle"
20
+ >Circle by default, with a shallow shadow; square uses the theme's medium radius.</prop>
20
21
  <prop name="decorative" type="boolean" default="false">Hides the avatar from assistive technology when adjacent text already identifies the person.</prop>
21
22
  <prop name="active" type="boolean" default="false"
22
23
  >Marks the person as active now, such as editing the same page: a fine accent ring around the avatar. The ring is not announced, so say what it means in alt
@@ -96,6 +97,10 @@
96
97
  border-color: var(--ui-avatar-border, var(--ui-border-strong));
97
98
  }
98
99
 
100
+ :host([shape="circle"]) {
101
+ box-shadow: var(--ui-shadow-sm);
102
+ }
103
+
99
104
  :host([shape="square"]) {
100
105
  border-radius: var(--ui-avatar-radius, var(--ui-radius-md));
101
106
  }
@@ -1,8 +1,9 @@
1
1
  <template component="ui-badge">
2
2
  <defs>
3
- <prop name="variant" type="keyword" values="solid, subtle, outline" default="subtle"
3
+ <prop name="variant" type="keyword" values="solid, subtle, outline, inverse" default="subtle"
4
4
  >Emphasis. subtle sets toned text over a soft wash; solid fills with the tone and uses contrasting text; outline keeps the surface with a toned edge.
5
- Neutral looks the same in solid and subtle. When space is constrained, the label truncates with an ellipsis while its full text remains available.</prop>
5
+ inverse uses a translucent contrasting surface and toned ink for a count or label on a filled control of that tone. Neutral looks the same in solid and
6
+ subtle. When space is constrained, the label truncates with an ellipsis while its full text remains available.</prop>
6
7
  <prop name="tone" type="keyword" values="neutral, accent, info, success, warning, danger" default="neutral"
7
8
  >Which colour the badge speaks in. neutral is a quiet grey for plain labels; accent draws the eye in the accent colour; info, success, warning, and danger
8
9
  mark a status, so match the tone to what the badge says. For a category rather than a status, set the --ui-badge-color hook on the badge instead: any CSS
@@ -10,10 +11,11 @@
10
11
  <prop name="shape" type="keyword" values="pill, tag, dot, square, circle" default="pill"
11
12
  >Silhouette. pill is rounded at both ends; tag is a pointed label. dot is a compact circular signal with visually hidden text: include a state label, or set
12
13
  aria-hidden when the surrounding control already names that state. square is a fixed rounded square for an icon or single glyph beside a heading; hide a
13
- decorative icon when adjacent words name it. circle frames a visible single glyph or icon in a fixed circle, centered in both directions.</prop>
14
- <prop name="size" type="keyword" values="xs, md" default="md"
15
- >Scale. xs is a compact count beside small controls; md is the usual text badge. A square is 24px at xs and 32px at md with default spacing. A circle is
16
- 16px at xs and 24px at md.</prop>
14
+ decorative icon when adjacent words name it. circle frames a visible glyph, icon or short bounded count in a fixed circle, centered in both
15
+ directions.</prop>
16
+ <prop name="size" type="keyword" values="xs, md, lg" default="md"
17
+ >Scale. xs is compact; md is the usual text badge; lg adds room to fixed marks while retaining the usual text size. A square is 24px at xs, 32px at md and
18
+ 40px at lg. A circle is 16px at xs, 24px at md and 32px at lg; use lg for short counts such as 30 or 99+.</prop>
17
19
  </defs>
18
20
  <span>
19
21
  <span class="icon" aria-hidden="true"><slot name="icon"></slot></span>
@@ -157,25 +159,26 @@
157
159
  text-box-trim: none;
158
160
  }
159
161
 
160
- /* Text-only badges retain their trimmed inline baseline. Icon content needs a flex row;
161
- trimming its label separately keeps the glyph centered without changing adjacent lines. */
162
+ /* Center the capital/baseline text box, while clipping only inline overflow for ellipsis.
163
+ Vertical ink remains visible so trimming never cuts off ascenders or descenders. */
162
164
  @supports (text-box-trim: trim-both) {
163
165
  :host {
164
166
  display: inline-block;
165
167
  min-block-size: var(--ui-badge-min-block-size, 1.5rem);
166
168
  text-align: center;
167
169
  align-content: center;
168
- text-box-trim: trim-both;
169
- text-box-edge: text;
170
+ text-box-trim: none;
170
171
  }
171
172
  :host:has(.icon:not(:empty)),
172
173
  :host:has(.label svg) {
173
174
  display: inline-flex;
174
175
  text-box-trim: none;
175
176
  }
176
- :host:has(.icon:not(:empty)) .label {
177
+ .label:not(:has(svg)) {
177
178
  text-box-trim: trim-both;
178
- text-box-edge: text;
179
+ text-box-edge: cap alphabetic;
180
+ overflow-x: clip;
181
+ overflow-y: visible;
179
182
  }
180
183
  }
181
184
 
@@ -256,6 +259,29 @@
256
259
  --_badge-color-text: color-mix(in oklab, var(--_ui-badge-color) 0%, var(--ui-surface-default));
257
260
  }
258
261
 
262
+ /* A translucent inverse surface picks up its filled control's tone. Deepen the tone ink
263
+ toward the theme text to retain contrast against that composed surface. */
264
+ :host([variant="inverse"]) {
265
+ --_badge-color-surface: color-mix(in srgb, color-mix(in oklab, var(--_ui-badge-color) 0%, var(--ui-surface-default)) 88%, transparent);
266
+ --_badge-color-border: var(--_badge-color-surface);
267
+ --_badge-color-text: color-mix(in srgb, var(--_badge-color-ink) 85%, var(--ui-text-primary));
268
+ --_badge-outline-surface: var(--ui-badge-surface, var(--_badge-color-surface, color-mix(in srgb, var(--_badge-text) 88%, transparent)));
269
+ border-color: var(--ui-badge-border, var(--_badge-color-border, color-mix(in srgb, var(--_badge-text) 88%, transparent)));
270
+ color: var(--ui-badge-text, var(--_badge-color-text, color-mix(in srgb, var(--_badge-surface) 85%, var(--ui-text-primary))));
271
+ /* Paint each translucent layer once, including the border, without a bright double-painted ring. */
272
+ background-clip: padding-box;
273
+ }
274
+
275
+ :host([variant="inverse"][shape="circle"]) {
276
+ box-shadow: var(--ui-shadow-sm);
277
+ }
278
+
279
+ /* Neutral reverses a subtle surface/ink pair rather than a strong tone. Keep its original
280
+ surface ink: moving it toward dark-theme primary text would reduce overlay contrast. */
281
+ :host([variant="inverse"][tone="neutral"]) {
282
+ color: var(--ui-badge-text, var(--_badge-color-text, var(--_badge-surface)));
283
+ }
284
+
259
285
  :host([variant="outline"]) {
260
286
  --_badge-surface: var(--ui-surface-default);
261
287
  --_badge-border: var(--ui-border-strong);
@@ -309,6 +335,10 @@
309
335
  --_badge-square-size: var(--ui-badge-square-size, calc(var(--ui-space-3) * 2));
310
336
  }
311
337
 
338
+ :host([shape="square"][size="lg"]) {
339
+ --_badge-square-size: var(--ui-badge-square-size, calc(var(--ui-space-4) * 2 + var(--ui-space-2)));
340
+ }
341
+
312
342
  :host([shape="square"]) .label {
313
343
  display: inline-flex;
314
344
  align-items: center;
@@ -341,6 +371,10 @@
341
371
  --_badge-circle-size: var(--ui-badge-circle-size, var(--ui-space-4));
342
372
  }
343
373
 
374
+ :host([shape="circle"][size="lg"]) {
375
+ --_badge-circle-size: var(--ui-badge-circle-size, calc(var(--ui-space-4) * 2));
376
+ }
377
+
344
378
  :host([shape="circle"]) .label {
345
379
  display: inline-flex;
346
380
  align-items: center;
@@ -357,6 +391,18 @@
357
391
  display: none;
358
392
  }
359
393
 
394
+ /* Center capital and numeral ink, rather than the font's ascent/descent line box.
395
+ Icon labels retain flex geometry; untrimmed browsers keep that fallback too. */
396
+ @supports (text-box-trim: trim-both) {
397
+ :host([shape="circle"]) .label:not(:has(svg)),
398
+ :host([shape="square"]) .label:not(:has(svg)) {
399
+ display: block;
400
+ text-box-trim: trim-both;
401
+ text-box-edge: cap alphabetic;
402
+ overflow: visible;
403
+ }
404
+ }
405
+
360
406
  /* A dot uses the badge's tone recipe; only its silhouette and visible label change. */
361
407
  :host([shape="dot"]) {
362
408
  position: relative;
@@ -404,6 +450,10 @@
404
450
  pointer-events: none;
405
451
  }
406
452
 
453
+ :host([shape="tag"][variant="inverse"]) {
454
+ background: var(--ui-badge-border, var(--_badge-color-border, var(--_badge-text)));
455
+ }
456
+
407
457
  :host([shape="tag"]):dir(rtl) {
408
458
  padding-inline-end: var(--ui-badge-padding-inline, var(--ui-space-2));
409
459
  padding-inline-start: calc(var(--ui-badge-padding-inline, var(--ui-space-2)) + var(--_badge-point));
@@ -8,6 +8,9 @@
8
8
  combining them with a leading control.</prop>
9
9
  <prop name="wrap" type="boolean" default="false"
10
10
  >Lets the title and description wrap so explanatory text stays readable on narrow screens. Omit it for the default equal-height, one-line rows.</prop>
11
+ <prop name="align" type="keyword" values="center, title" default="center"
12
+ >Where the leading and trailing regions sit vertically. center aligns them with the whole row. title aligns them with the first title line, keeping an
13
+ identifying icon beside its name when the title or description wraps. Taller controls retain their natural height.</prop>
11
14
  <prop name="current" type="boolean" default="false"
12
15
  >Marks the item as the current one, such as the site you are in: it takes the selected surface and aria-current="true", which assistive technology
13
16
  announces. Set it on one item at a time.</prop>
@@ -158,6 +161,16 @@
158
161
  line-height: var(--ui-line-height-tight);
159
162
  }
160
163
 
164
+ /* Keep identity and disclosure marks beside the first line, even with a long description. */
165
+ :host([align="title"]) {
166
+ align-items: flex-start;
167
+ }
168
+
169
+ :host([align="title"]) .leading,
170
+ :host([align="title"]) .trailing {
171
+ min-block-size: calc(var(--ui-font-size-md) * var(--ui-line-height-tight));
172
+ }
173
+
161
174
  .description {
162
175
  color: var(--ui-text-muted);
163
176
  font-size: var(--ui-font-size-sm);