@threadlabs/looma 0.51.1 → 0.51.2

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.
@@ -33,6 +33,20 @@
33
33
  tone="danger" variant="outline" is a destructive secondary action. neutral is the quiet one, for a button that should not claim a colour. The field
34
34
  variant always uses neutral field colors. Supporting brand families use accent-secondary and accent-tertiary; their usable colors derive from the theme,
35
35
  and unset families follow the primary accent.</prop>
36
+ <prop
37
+ name="interactionTone"
38
+ type="keyword"
39
+ values="inherit, accent, accent-secondary, accent-tertiary, neutral, danger, success, warning, info"
40
+ default="inherit"
41
+ >The action palette while hovered or pressed. inherit follows tone and preset. Choose a different tone for transient emphasis, such as a neutral choice that
42
+ uses accent feedback. Hover and pressed keep their distinct shared treatments; disabled and loading actions keep their resting treatment.</prop>
43
+ <prop name="interactionVariant" type="keyword" values="inherit, outline, solid, ghost" default="inherit"
44
+ >The paint while hovered or pressed. inherit follows variant and preset. outline, solid and ghost change emphasis without changing the control's layout,
45
+ size or content. The shared hover and pressed treatments remain distinct.</prop>
46
+ <computed
47
+ name="interactionAppearance"
48
+ from="{ true: null, false: { inherit: $appearance, outline: 'outline', solid: 'solid', ghost: 'ghost' }[$interactionVariant] }[concat($interactionTone = 'inherit' and $interactionVariant = 'inherit')]"
49
+ ></computed>
36
50
  <prop name="disabled" type="boolean" default="false"
37
51
  >Makes the button unavailable: it cannot be pressed, uses muted neutral colors, and loses its raised look. An unselected disabled ghost keeps its
38
52
  transparent surface; a selected ghost retains a muted selection wash. A disabled link (with href) drops its href and states aria-disabled="true" instead,
@@ -59,6 +73,8 @@
59
73
  <a
60
74
  from:data-appearance="$appearance"
61
75
  from:data-tone="$colorTone"
76
+ from:data-interaction-tone="{ true: null, false: $interactionTone }[concat($interactionTone = 'inherit')]"
77
+ from:data-interaction-appearance="$interactionAppearance"
62
78
  from:data-selected="$selected"
63
79
  $when="$appearance = 'card' and $href != null"
64
80
  from:href="{ true: null, false: $href }[concat($disabled or $loading or $pending)]"
@@ -77,6 +93,8 @@
77
93
  <button
78
94
  from:data-appearance="$appearance"
79
95
  from:data-tone="$colorTone"
96
+ from:data-interaction-tone="{ true: null, false: $interactionTone }[concat($interactionTone = 'inherit')]"
97
+ from:data-interaction-appearance="$interactionAppearance"
80
98
  from:data-selected="$selected"
81
99
  $when="$appearance = 'card'"
82
100
  from:type="$type"
@@ -93,6 +111,8 @@
93
111
  <a
94
112
  from:data-appearance="$appearance"
95
113
  from:data-tone="$colorTone"
114
+ from:data-interaction-tone="{ true: null, false: $interactionTone }[concat($interactionTone = 'inherit')]"
115
+ from:data-interaction-appearance="$interactionAppearance"
96
116
  from:data-selected="$selected"
97
117
  $when="$href != null"
98
118
  from:href="{ true: null, false: $href }[concat($disabled or $loading or $pending)]"
@@ -109,6 +129,8 @@
109
129
  <button
110
130
  from:data-appearance="$appearance"
111
131
  from:data-tone="$colorTone"
132
+ from:data-interaction-tone="{ true: null, false: $interactionTone }[concat($interactionTone = 'inherit')]"
133
+ from:data-interaction-appearance="$interactionAppearance"
112
134
  from:data-selected="$selected"
113
135
  $else
114
136
  from:type="$type"
@@ -133,6 +155,11 @@
133
155
  inset calc(-1 * var(--_ui-action-start)) -1px 0 light-dark(rgb(0 0 0 / 0.08), rgb(0 0 0 / 0.08))
134
156
  );
135
157
  --_ui-action-shadow: var(--_ui-action-edge), 0 1px 2px light-dark(rgb(0 0 0 / 0.10), rgb(0 0 0 / 0.20));
158
+ }
159
+
160
+ /* Explicit interaction palettes reuse the resting palette bindings, without changing geometry. */
161
+ :host,
162
+ :host[data-interaction-tone]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
136
163
  --_tone-border: var(--ui-accent-border, var(--ui-accent));
137
164
  --_tone-hover-border: var(--ui-accent-hover-border, var(--ui-accent-hover));
138
165
  --_tone-active-border: var(--ui-accent-active-border, var(--ui-accent-active));
@@ -154,7 +181,17 @@
154
181
  --_tone-active: var(--_hue-active);
155
182
  --_tone-text: var(--_hue-text);
156
183
  --_on-tone: var(--_on-hue);
184
+ --_interaction-solid-hover: var(--_tone-hover);
185
+ --_interaction-solid-active: var(--_tone-active);
186
+ --_interaction-solid-text: var(--_on-tone);
187
+ --_interaction-solid-shadow: var(--ui-button-solid-shadow, var(--ui-action-shadow, var(--_ui-action-shadow))), var(--_tone-glow);
188
+ --_interaction-outline-border: var(--_tone-outline-border);
189
+ --_interaction-outline-wash: var(--_tone-wash-hover);
190
+ --_interaction-outline-active: oklch(from var(--_tone) l c h / calc(18% * var(--ui-tonal-opacity, 1)));
191
+ --_interaction-card-border: var(--_tone-text);
192
+ }
157
193
 
194
+ :host {
158
195
  display: inline-flex !important;
159
196
  align-items: center !important;
160
197
  justify-content: center !important;
@@ -234,13 +271,18 @@
234
271
  min-block-size: 1lh !important;
235
272
  }
236
273
 
237
- .label:has(svg) {
274
+ /* Projected marks may be images or composed elements, including block-level image resets. */
275
+ .label:has(> *) {
238
276
  display: inline-flex !important;
239
277
  align-items: center !important;
240
278
  gap: var(--ui-space-2) !important;
241
279
  text-box-trim: none;
242
280
  }
243
281
 
282
+ :host([align="start"]) .label {
283
+ flex: 1;
284
+ }
285
+
244
286
  .badge {
245
287
  display: inline-flex !important;
246
288
  align-items: center !important;
@@ -252,7 +294,7 @@
252
294
  }
253
295
 
254
296
  @supports (text-box-trim: trim-both) {
255
- .label:not(:has(svg)) {
297
+ .label:not(:has(> *)) {
256
298
  text-box-trim: trim-both;
257
299
  text-box-edge: cap alphabetic;
258
300
  }
@@ -361,9 +403,9 @@
361
403
  color: var(--ui-selection-text);
362
404
  }
363
405
 
364
- /* Pressed reads as pressed in: the highlight goes, and the shadow moves inside. */
406
+ /* Pressed outranks tone-specific outline paint: the highlight goes, and the shadow moves inside. */
365
407
  :host:active:not(:disabled, [aria-disabled="true"]),
366
- :host[data-appearance="outline"]:active:not(:disabled, [aria-disabled="true"]) {
408
+ :host[data-appearance="outline"][data-tone]:active:not(:disabled, [aria-disabled="true"]) {
367
409
  scale: var(--ui-press-scale, 1);
368
410
  background-color: var(--ui-button-active-surface, oklch(from var(--_tone) l c h / calc(18% * var(--ui-tonal-opacity, 1))));
369
411
  background-image: none;
@@ -396,7 +438,8 @@
396
438
 
397
439
  /* Tone is the colour, variant is the volume. Every pairing works: a danger outline is a
398
440
  destructive secondary action, not a special case. */
399
- :host[data-tone="accent-secondary"] {
441
+ :host[data-tone="accent-secondary"],
442
+ :host[data-interaction-tone="accent-secondary"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
400
443
  --_tone-border: var(--ui-accent-secondary-border, var(--ui-accent-secondary));
401
444
  --_tone-hover-border: var(--ui-accent-secondary-hover-border, var(--ui-accent-secondary-hover));
402
445
  --_tone-active-border: var(--ui-accent-secondary-active-border, var(--ui-accent-secondary-active));
@@ -414,7 +457,8 @@
414
457
  --_on-hue: var(--ui-accent-secondary-on-strong);
415
458
  }
416
459
 
417
- :host[data-tone="accent-tertiary"] {
460
+ :host[data-tone="accent-tertiary"],
461
+ :host[data-interaction-tone="accent-tertiary"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
418
462
  --_tone-border: var(--ui-accent-tertiary-border, var(--ui-accent-tertiary));
419
463
  --_tone-hover-border: var(--ui-accent-tertiary-hover-border, var(--ui-accent-tertiary-hover));
420
464
  --_tone-active-border: var(--ui-accent-tertiary-active-border, var(--ui-accent-tertiary-active));
@@ -432,7 +476,8 @@
432
476
  --_on-hue: var(--ui-accent-tertiary-on-strong);
433
477
  }
434
478
 
435
- :host[data-tone="neutral"] {
479
+ :host[data-tone="neutral"],
480
+ :host[data-interaction-tone="neutral"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
436
481
  --_tone-border: var(--ui-control-border, var(--ui-neutral-surface));
437
482
  --_tone-hover-border: var(--ui-control-border-hover, var(--ui-neutral-hover));
438
483
  --_tone-active-border: var(--ui-control-border-hover, var(--ui-neutral-active));
@@ -446,6 +491,14 @@
446
491
  --_hue-active: var(--ui-text);
447
492
  --_hue-text: var(--ui-text);
448
493
  --_on-hue: var(--ui-surface);
494
+ --_interaction-solid-hover: var(--ui-neutral-hover);
495
+ --_interaction-solid-active: var(--ui-neutral-active);
496
+ --_interaction-solid-text: var(--ui-button-text, var(--ui-text));
497
+ --_interaction-solid-shadow: var(--ui-button-solid-shadow, var(--ui-button-shadow, var(--ui-neutral-shadow)));
498
+ --_interaction-outline-border: var(--ui-control-border-hover);
499
+ --_interaction-outline-wash: var(--ui-neutral-wash-hover);
500
+ --_interaction-outline-active: var(--ui-neutral-active);
501
+ --_interaction-card-border: var(--ui-border-strong);
449
502
  }
450
503
 
451
504
  :host[data-tone="neutral"][data-appearance="solid"] {
@@ -480,7 +533,9 @@
480
533
  background-color: var(--ui-button-active-surface, var(--ui-neutral-active));
481
534
  }
482
535
 
483
- :host[data-tone="danger"], :host[data-appearance="danger"] {
536
+ :host[data-tone="danger"],
537
+ :host[data-appearance="danger"],
538
+ :host[data-interaction-tone="danger"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
484
539
  --_tone-border: var(--ui-danger-border, var(--ui-danger));
485
540
  --_tone-hover-border: var(--ui-danger-hover-border, var(--ui-danger-hover));
486
541
  --_tone-active-border: var(--ui-danger-active-border, var(--ui-danger-active));
@@ -498,7 +553,8 @@
498
553
  --_on-hue: var(--ui-on-danger);
499
554
  }
500
555
 
501
- :host[data-tone="success"] {
556
+ :host[data-tone="success"],
557
+ :host[data-interaction-tone="success"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
502
558
  --_tone-border: var(--ui-success-border, var(--ui-success));
503
559
  --_tone-hover-border: var(--ui-success-hover-border, var(--ui-success-hover));
504
560
  --_tone-active-border: var(--ui-success-active-border, var(--ui-success-active));
@@ -516,7 +572,8 @@
516
572
  --_on-hue: var(--ui-success-on-strong);
517
573
  }
518
574
 
519
- :host[data-tone="warning"] {
575
+ :host[data-tone="warning"],
576
+ :host[data-interaction-tone="warning"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
520
577
  --_tone-border: var(--ui-warning-border, var(--ui-warning));
521
578
  --_tone-hover-border: var(--ui-warning-hover-border, var(--ui-warning-hover));
522
579
  --_tone-active-border: var(--ui-warning-active-border, var(--ui-warning-active));
@@ -534,7 +591,8 @@
534
591
  --_on-hue: var(--ui-warning-on-strong);
535
592
  }
536
593
 
537
- :host[data-tone="info"] {
594
+ :host[data-tone="info"],
595
+ :host[data-interaction-tone="info"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
538
596
  --_tone-border: var(--ui-info-border, var(--ui-info));
539
597
  --_tone-hover-border: var(--ui-info-hover-border, var(--ui-info-hover));
540
598
  --_tone-active-border: var(--ui-info-active-border, var(--ui-info-active));
@@ -605,6 +663,93 @@
605
663
  box-shadow: inset 0 0 0 1px var(--ui-selection-border);
606
664
  }
607
665
 
666
+ /* Interaction settings choose paint only. Pressed keeps its stronger fill and inset shadow. */
667
+ :host[data-tone][data-interaction-appearance="outline"]:hover:not(:disabled, [aria-disabled="true"]) {
668
+ --_interaction-shadow: var(--ui-button-shadow, var(--ui-neutral-shadow));
669
+ border-color: var(--ui-button-hover-border, var(--_interaction-outline-border));
670
+ background-color: var(--ui-button-hover-surface, transparent);
671
+ background-image: linear-gradient(var(--_interaction-outline-wash), var(--_interaction-outline-wash));
672
+ color: var(--ui-button-text, var(--_tone-text));
673
+ box-shadow: var(--_interaction-shadow);
674
+ }
675
+
676
+ :host[data-tone][data-interaction-appearance="outline"]:active:not(:disabled, [aria-disabled="true"]) {
677
+ --_interaction-shadow: var(--ui-pressed);
678
+ border-color: var(--ui-button-hover-border, var(--_interaction-outline-border));
679
+ background-color: var(--ui-button-active-surface, var(--_interaction-outline-active));
680
+ background-image: none;
681
+ color: var(--ui-button-text, var(--_tone-text));
682
+ box-shadow: var(--_interaction-shadow);
683
+ }
684
+
685
+ :host[data-tone]:is([data-interaction-appearance="solid"], [data-interaction-appearance="danger"]):hover:not(:disabled, [aria-disabled="true"]) {
686
+ --_interaction-shadow: var(--_interaction-solid-shadow);
687
+ border-color: var(--ui-button-hover-border, var(--_tone-hover-border));
688
+ background-color: var(--ui-button-hover-surface, var(--_interaction-solid-hover));
689
+ background-image: var(--_tone-hover-highlight);
690
+ color: var(--_interaction-solid-text);
691
+ box-shadow: var(--_interaction-shadow);
692
+ }
693
+
694
+ :host[data-tone]:is([data-interaction-appearance="solid"], [data-interaction-appearance="danger"]):active:not(:disabled, [aria-disabled="true"]) {
695
+ --_interaction-shadow: var(--ui-pressed);
696
+ border-color: var(--_tone-active-border);
697
+ background-color: var(--ui-button-active-surface, var(--_interaction-solid-active));
698
+ background-image: none;
699
+ color: var(--_interaction-solid-text);
700
+ box-shadow: var(--_interaction-shadow);
701
+ }
702
+
703
+ :host[data-tone][data-interaction-appearance="ghost"]:hover:not(:disabled, [aria-disabled="true"]) {
704
+ --_interaction-shadow: 0 0 transparent;
705
+ border-color: transparent;
706
+ background-color: var(--ui-button-ghost-hover-surface, var(--_tone-ghost-hover));
707
+ background-image: none;
708
+ color: var(--ui-button-ghost-text, var(--_tone-text));
709
+ box-shadow: none;
710
+ }
711
+
712
+ :host[data-tone][data-interaction-appearance="ghost"]:active:not(:disabled, [aria-disabled="true"]) {
713
+ --_interaction-shadow: inset 0 0 0 1px oklch(from var(--_tone) l c h / 10%), inset 0 1px 2px oklch(from var(--_tone) l c h / 8%);
714
+ border-color: transparent;
715
+ background-color: var(--ui-button-ghost-active-surface, oklch(from var(--_tone) l c h / 18%));
716
+ background-image: none;
717
+ color: var(--ui-button-ghost-text, var(--_tone-text));
718
+ box-shadow: var(--_interaction-shadow);
719
+ }
720
+
721
+ :host[data-tone][data-interaction-appearance="card"]:hover:not(:disabled, [aria-disabled="true"]) {
722
+ --_interaction-shadow: 0 0 transparent;
723
+ border-color: var(--ui-button-hover-border, var(--_interaction-card-border));
724
+ background-color: var(--ui-button-hover-surface, oklch(from var(--_tone-text) l c h / calc(12% * var(--ui-tonal-opacity, 1))));
725
+ background-image: none;
726
+ color: var(--ui-button-text, var(--_tone-text));
727
+ box-shadow: none;
728
+ }
729
+
730
+ :host[data-tone][data-interaction-appearance="card"]:active:not(:disabled, [aria-disabled="true"]) {
731
+ --_interaction-shadow: var(--ui-pressed);
732
+ border-color: var(--ui-button-hover-border, var(--_interaction-card-border));
733
+ background-color: var(--ui-button-active-surface, oklch(from var(--_tone) l c h / calc(18% * var(--ui-tonal-opacity, 1))));
734
+ background-image: none;
735
+ color: var(--ui-button-text, var(--_tone-text));
736
+ box-shadow: var(--_interaction-shadow);
737
+ }
738
+
739
+ :host[data-tone][data-interaction-appearance="link"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
740
+ color: var(--ui-button-link-hover-text, var(--_tone-text));
741
+ }
742
+
743
+ :host[data-tone][data-interaction-appearance="link"]:active:not(:disabled, [aria-disabled="true"]) {
744
+ text-decoration-thickness: 0.125em;
745
+ }
746
+
747
+ :host[data-tone][data-interaction-appearance]:is(:hover, :active):focus-visible:not(:disabled, [aria-disabled="true"]) {
748
+ box-shadow:
749
+ var(--_interaction-shadow, 0 0 transparent),
750
+ var(--ui-focus-halo);
751
+ }
752
+
608
753
  /* A soft halo that transitions in with the other box-shadow changes, layered on the raised shadow. */
609
754
  :host:focus-visible,
610
755
  :host[data-appearance="ghost"][data-selected]:focus-visible {
@@ -620,6 +765,12 @@
620
765
  var(--ui-focus-halo);
621
766
  }
622
767
 
768
+ :host[data-appearance="outline"]:not([data-interaction-appearance]):active:focus-visible:not(:disabled, [aria-disabled="true"]) {
769
+ box-shadow:
770
+ var(--ui-pressed),
771
+ var(--ui-focus-halo);
772
+ }
773
+
623
774
  :host[data-appearance="solid"]:focus-visible {
624
775
  box-shadow:
625
776
  var(--ui-button-solid-shadow, var(--ui-action-shadow, var(--_ui-action-shadow))),
@@ -697,11 +848,15 @@
697
848
  transition: color var(--ui-motion-fast) var(--ui-motion-ease), text-decoration-color var(--ui-motion-fast) var(--ui-motion-ease);
698
849
  }
699
850
 
700
- :host[data-appearance="link"] .label {
851
+ :host[data-appearance="link"] .label:not(:has(> *)) {
701
852
  display: inline !important;
702
853
  text-box-trim: none;
703
854
  }
704
855
 
856
+ :host[data-appearance="link"] .label:has(> *) {
857
+ text-decoration: inherit;
858
+ }
859
+
705
860
  :host[data-appearance="link"]:hover:not(:disabled, [aria-disabled="true"]) {
706
861
  color: var(--ui-button-link-hover-text, var(--ui-text-primary));
707
862
  text-decoration-color: currentColor;