@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.51.1",
3
+ "version": "0.51.2",
4
4
  "type": "module",
5
5
  "description": "HTML Next UI components, native DOM support and design tokens.",
6
6
  "license": "MIT",
@@ -18,6 +18,11 @@
18
18
  inset calc(-1 * var(--_ui-action-start)) -1px 0 light-dark(rgb(0 0 0 / 0.08), rgb(0 0 0 / 0.08))
19
19
  );
20
20
  --_ui-action-shadow: var(--_ui-action-edge), 0 1px 2px light-dark(rgb(0 0 0 / 0.10), rgb(0 0 0 / 0.20));
21
+ }
22
+
23
+ /* Explicit interaction palettes reuse the resting palette bindings, without changing geometry. */
24
+ :scope:where([data-component~="ui-button"]),
25
+ :scope:where([data-component~="ui-button"])[data-interaction-tone]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
21
26
  --_tone-border: var(--ui-accent-border, var(--ui-accent));
22
27
  --_tone-hover-border: var(--ui-accent-hover-border, var(--ui-accent-hover));
23
28
  --_tone-active-border: var(--ui-accent-active-border, var(--ui-accent-active));
@@ -39,7 +44,17 @@
39
44
  --_tone-active: var(--_hue-active);
40
45
  --_tone-text: var(--_hue-text);
41
46
  --_on-tone: var(--_on-hue);
47
+ --_interaction-solid-hover: var(--_tone-hover);
48
+ --_interaction-solid-active: var(--_tone-active);
49
+ --_interaction-solid-text: var(--_on-tone);
50
+ --_interaction-solid-shadow: var(--ui-button-solid-shadow, var(--ui-action-shadow, var(--_ui-action-shadow))), var(--_tone-glow);
51
+ --_interaction-outline-border: var(--_tone-outline-border);
52
+ --_interaction-outline-wash: var(--_tone-wash-hover);
53
+ --_interaction-outline-active: oklch(from var(--_tone) l c h / calc(18% * var(--ui-tonal-opacity, 1)));
54
+ --_interaction-card-border: var(--_tone-text);
55
+ }
42
56
 
57
+ :scope:where([data-component~="ui-button"]) {
43
58
  display: inline-flex !important;
44
59
  align-items: center !important;
45
60
  justify-content: center !important;
@@ -119,13 +134,18 @@
119
134
  min-block-size: 1lh !important;
120
135
  }
121
136
 
122
- .label:has(svg) {
137
+ /* Projected marks may be images or composed elements, including block-level image resets. */
138
+ .label:has(> *) {
123
139
  display: inline-flex !important;
124
140
  align-items: center !important;
125
141
  gap: var(--ui-space-2) !important;
126
142
  text-box-trim: none;
127
143
  }
128
144
 
145
+ :scope:where([data-component~="ui-button"])[data-ui-button-state~="align=start"] .label {
146
+ flex: 1;
147
+ }
148
+
129
149
  .badge {
130
150
  display: inline-flex !important;
131
151
  align-items: center !important;
@@ -137,7 +157,7 @@
137
157
  }
138
158
 
139
159
  @supports (text-box-trim: trim-both) {
140
- .label:not(:has(svg)) {
160
+ .label:not(:has(> *)) {
141
161
  text-box-trim: trim-both;
142
162
  text-box-edge: cap alphabetic;
143
163
  }
@@ -246,9 +266,9 @@
246
266
  color: var(--ui-selection-text);
247
267
  }
248
268
 
249
- /* Pressed reads as pressed in: the highlight goes, and the shadow moves inside. */
269
+ /* Pressed outranks tone-specific outline paint: the highlight goes, and the shadow moves inside. */
250
270
  :scope:where([data-component~="ui-button"]):active:not(:disabled, [aria-disabled="true"]),
251
- :scope:where([data-component~="ui-button"])[data-appearance="outline"]:active:not(:disabled, [aria-disabled="true"]) {
271
+ :scope:where([data-component~="ui-button"])[data-appearance="outline"][data-tone]:active:not(:disabled, [aria-disabled="true"]) {
252
272
  scale: var(--ui-press-scale, 1);
253
273
  background-color: var(--ui-button-active-surface, oklch(from var(--_tone) l c h / calc(18% * var(--ui-tonal-opacity, 1))));
254
274
  background-image: none;
@@ -281,7 +301,8 @@
281
301
 
282
302
  /* Tone is the colour, variant is the volume. Every pairing works: a danger outline is a
283
303
  destructive secondary action, not a special case. */
284
- :scope:where([data-component~="ui-button"])[data-tone="accent-secondary"] {
304
+ :scope:where([data-component~="ui-button"])[data-tone="accent-secondary"],
305
+ :scope:where([data-component~="ui-button"])[data-interaction-tone="accent-secondary"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
285
306
  --_tone-border: var(--ui-accent-secondary-border, var(--ui-accent-secondary));
286
307
  --_tone-hover-border: var(--ui-accent-secondary-hover-border, var(--ui-accent-secondary-hover));
287
308
  --_tone-active-border: var(--ui-accent-secondary-active-border, var(--ui-accent-secondary-active));
@@ -299,7 +320,8 @@
299
320
  --_on-hue: var(--ui-accent-secondary-on-strong);
300
321
  }
301
322
 
302
- :scope:where([data-component~="ui-button"])[data-tone="accent-tertiary"] {
323
+ :scope:where([data-component~="ui-button"])[data-tone="accent-tertiary"],
324
+ :scope:where([data-component~="ui-button"])[data-interaction-tone="accent-tertiary"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
303
325
  --_tone-border: var(--ui-accent-tertiary-border, var(--ui-accent-tertiary));
304
326
  --_tone-hover-border: var(--ui-accent-tertiary-hover-border, var(--ui-accent-tertiary-hover));
305
327
  --_tone-active-border: var(--ui-accent-tertiary-active-border, var(--ui-accent-tertiary-active));
@@ -317,7 +339,8 @@
317
339
  --_on-hue: var(--ui-accent-tertiary-on-strong);
318
340
  }
319
341
 
320
- :scope:where([data-component~="ui-button"])[data-tone="neutral"] {
342
+ :scope:where([data-component~="ui-button"])[data-tone="neutral"],
343
+ :scope:where([data-component~="ui-button"])[data-interaction-tone="neutral"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
321
344
  --_tone-border: var(--ui-control-border, var(--ui-neutral-surface));
322
345
  --_tone-hover-border: var(--ui-control-border-hover, var(--ui-neutral-hover));
323
346
  --_tone-active-border: var(--ui-control-border-hover, var(--ui-neutral-active));
@@ -331,6 +354,14 @@
331
354
  --_hue-active: var(--ui-text);
332
355
  --_hue-text: var(--ui-text);
333
356
  --_on-hue: var(--ui-surface);
357
+ --_interaction-solid-hover: var(--ui-neutral-hover);
358
+ --_interaction-solid-active: var(--ui-neutral-active);
359
+ --_interaction-solid-text: var(--ui-button-text, var(--ui-text));
360
+ --_interaction-solid-shadow: var(--ui-button-solid-shadow, var(--ui-button-shadow, var(--ui-neutral-shadow)));
361
+ --_interaction-outline-border: var(--ui-control-border-hover);
362
+ --_interaction-outline-wash: var(--ui-neutral-wash-hover);
363
+ --_interaction-outline-active: var(--ui-neutral-active);
364
+ --_interaction-card-border: var(--ui-border-strong);
334
365
  }
335
366
 
336
367
  :scope:where([data-component~="ui-button"])[data-tone="neutral"][data-appearance="solid"] {
@@ -365,7 +396,9 @@
365
396
  background-color: var(--ui-button-active-surface, var(--ui-neutral-active));
366
397
  }
367
398
 
368
- :scope:where([data-component~="ui-button"])[data-tone="danger"], :scope:where([data-component~="ui-button"])[data-appearance="danger"] {
399
+ :scope:where([data-component~="ui-button"])[data-tone="danger"],
400
+ :scope:where([data-component~="ui-button"])[data-appearance="danger"],
401
+ :scope:where([data-component~="ui-button"])[data-interaction-tone="danger"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
369
402
  --_tone-border: var(--ui-danger-border, var(--ui-danger));
370
403
  --_tone-hover-border: var(--ui-danger-hover-border, var(--ui-danger-hover));
371
404
  --_tone-active-border: var(--ui-danger-active-border, var(--ui-danger-active));
@@ -383,7 +416,8 @@
383
416
  --_on-hue: var(--ui-on-danger);
384
417
  }
385
418
 
386
- :scope:where([data-component~="ui-button"])[data-tone="success"] {
419
+ :scope:where([data-component~="ui-button"])[data-tone="success"],
420
+ :scope:where([data-component~="ui-button"])[data-interaction-tone="success"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
387
421
  --_tone-border: var(--ui-success-border, var(--ui-success));
388
422
  --_tone-hover-border: var(--ui-success-hover-border, var(--ui-success-hover));
389
423
  --_tone-active-border: var(--ui-success-active-border, var(--ui-success-active));
@@ -401,7 +435,8 @@
401
435
  --_on-hue: var(--ui-success-on-strong);
402
436
  }
403
437
 
404
- :scope:where([data-component~="ui-button"])[data-tone="warning"] {
438
+ :scope:where([data-component~="ui-button"])[data-tone="warning"],
439
+ :scope:where([data-component~="ui-button"])[data-interaction-tone="warning"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
405
440
  --_tone-border: var(--ui-warning-border, var(--ui-warning));
406
441
  --_tone-hover-border: var(--ui-warning-hover-border, var(--ui-warning-hover));
407
442
  --_tone-active-border: var(--ui-warning-active-border, var(--ui-warning-active));
@@ -419,7 +454,8 @@
419
454
  --_on-hue: var(--ui-warning-on-strong);
420
455
  }
421
456
 
422
- :scope:where([data-component~="ui-button"])[data-tone="info"] {
457
+ :scope:where([data-component~="ui-button"])[data-tone="info"],
458
+ :scope:where([data-component~="ui-button"])[data-interaction-tone="info"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
423
459
  --_tone-border: var(--ui-info-border, var(--ui-info));
424
460
  --_tone-hover-border: var(--ui-info-hover-border, var(--ui-info-hover));
425
461
  --_tone-active-border: var(--ui-info-active-border, var(--ui-info-active));
@@ -490,6 +526,93 @@
490
526
  box-shadow: inset 0 0 0 1px var(--ui-selection-border);
491
527
  }
492
528
 
529
+ /* Interaction settings choose paint only. Pressed keeps its stronger fill and inset shadow. */
530
+ :scope:where([data-component~="ui-button"])[data-tone][data-interaction-appearance="outline"]:hover:not(:disabled, [aria-disabled="true"]) {
531
+ --_interaction-shadow: var(--ui-button-shadow, var(--ui-neutral-shadow));
532
+ border-color: var(--ui-button-hover-border, var(--_interaction-outline-border));
533
+ background-color: var(--ui-button-hover-surface, transparent);
534
+ background-image: linear-gradient(var(--_interaction-outline-wash), var(--_interaction-outline-wash));
535
+ color: var(--ui-button-text, var(--_tone-text));
536
+ box-shadow: var(--_interaction-shadow);
537
+ }
538
+
539
+ :scope:where([data-component~="ui-button"])[data-tone][data-interaction-appearance="outline"]:active:not(:disabled, [aria-disabled="true"]) {
540
+ --_interaction-shadow: var(--ui-pressed);
541
+ border-color: var(--ui-button-hover-border, var(--_interaction-outline-border));
542
+ background-color: var(--ui-button-active-surface, var(--_interaction-outline-active));
543
+ background-image: none;
544
+ color: var(--ui-button-text, var(--_tone-text));
545
+ box-shadow: var(--_interaction-shadow);
546
+ }
547
+
548
+ :scope:where([data-component~="ui-button"])[data-tone]:is([data-interaction-appearance="solid"], [data-interaction-appearance="danger"]):hover:not(:disabled, [aria-disabled="true"]) {
549
+ --_interaction-shadow: var(--_interaction-solid-shadow);
550
+ border-color: var(--ui-button-hover-border, var(--_tone-hover-border));
551
+ background-color: var(--ui-button-hover-surface, var(--_interaction-solid-hover));
552
+ background-image: var(--_tone-hover-highlight);
553
+ color: var(--_interaction-solid-text);
554
+ box-shadow: var(--_interaction-shadow);
555
+ }
556
+
557
+ :scope:where([data-component~="ui-button"])[data-tone]:is([data-interaction-appearance="solid"], [data-interaction-appearance="danger"]):active:not(:disabled, [aria-disabled="true"]) {
558
+ --_interaction-shadow: var(--ui-pressed);
559
+ border-color: var(--_tone-active-border);
560
+ background-color: var(--ui-button-active-surface, var(--_interaction-solid-active));
561
+ background-image: none;
562
+ color: var(--_interaction-solid-text);
563
+ box-shadow: var(--_interaction-shadow);
564
+ }
565
+
566
+ :scope:where([data-component~="ui-button"])[data-tone][data-interaction-appearance="ghost"]:hover:not(:disabled, [aria-disabled="true"]) {
567
+ --_interaction-shadow: 0 0 transparent;
568
+ border-color: transparent;
569
+ background-color: var(--ui-button-ghost-hover-surface, var(--_tone-ghost-hover));
570
+ background-image: none;
571
+ color: var(--ui-button-ghost-text, var(--_tone-text));
572
+ box-shadow: none;
573
+ }
574
+
575
+ :scope:where([data-component~="ui-button"])[data-tone][data-interaction-appearance="ghost"]:active:not(:disabled, [aria-disabled="true"]) {
576
+ --_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%);
577
+ border-color: transparent;
578
+ background-color: var(--ui-button-ghost-active-surface, oklch(from var(--_tone) l c h / 18%));
579
+ background-image: none;
580
+ color: var(--ui-button-ghost-text, var(--_tone-text));
581
+ box-shadow: var(--_interaction-shadow);
582
+ }
583
+
584
+ :scope:where([data-component~="ui-button"])[data-tone][data-interaction-appearance="card"]:hover:not(:disabled, [aria-disabled="true"]) {
585
+ --_interaction-shadow: 0 0 transparent;
586
+ border-color: var(--ui-button-hover-border, var(--_interaction-card-border));
587
+ background-color: var(--ui-button-hover-surface, oklch(from var(--_tone-text) l c h / calc(12% * var(--ui-tonal-opacity, 1))));
588
+ background-image: none;
589
+ color: var(--ui-button-text, var(--_tone-text));
590
+ box-shadow: none;
591
+ }
592
+
593
+ :scope:where([data-component~="ui-button"])[data-tone][data-interaction-appearance="card"]:active:not(:disabled, [aria-disabled="true"]) {
594
+ --_interaction-shadow: var(--ui-pressed);
595
+ border-color: var(--ui-button-hover-border, var(--_interaction-card-border));
596
+ background-color: var(--ui-button-active-surface, oklch(from var(--_tone) l c h / calc(18% * var(--ui-tonal-opacity, 1))));
597
+ background-image: none;
598
+ color: var(--ui-button-text, var(--_tone-text));
599
+ box-shadow: var(--_interaction-shadow);
600
+ }
601
+
602
+ :scope:where([data-component~="ui-button"])[data-tone][data-interaction-appearance="link"]:is(:hover, :active):not(:disabled, [aria-disabled="true"]) {
603
+ color: var(--ui-button-link-hover-text, var(--_tone-text));
604
+ }
605
+
606
+ :scope:where([data-component~="ui-button"])[data-tone][data-interaction-appearance="link"]:active:not(:disabled, [aria-disabled="true"]) {
607
+ text-decoration-thickness: 0.125em;
608
+ }
609
+
610
+ :scope:where([data-component~="ui-button"])[data-tone][data-interaction-appearance]:is(:hover, :active):focus-visible:not(:disabled, [aria-disabled="true"]) {
611
+ box-shadow:
612
+ var(--_interaction-shadow, 0 0 transparent),
613
+ var(--ui-focus-halo);
614
+ }
615
+
493
616
  /* A soft halo that transitions in with the other box-shadow changes, layered on the raised shadow. */
494
617
  :scope:where([data-component~="ui-button"]):focus-visible,
495
618
  :scope:where([data-component~="ui-button"])[data-appearance="ghost"][data-selected]:focus-visible {
@@ -505,6 +628,12 @@
505
628
  var(--ui-focus-halo);
506
629
  }
507
630
 
631
+ :scope:where([data-component~="ui-button"])[data-appearance="outline"]:not([data-interaction-appearance]):active:focus-visible:not(:disabled, [aria-disabled="true"]) {
632
+ box-shadow:
633
+ var(--ui-pressed),
634
+ var(--ui-focus-halo);
635
+ }
636
+
508
637
  :scope:where([data-component~="ui-button"])[data-appearance="solid"]:focus-visible {
509
638
  box-shadow:
510
639
  var(--ui-button-solid-shadow, var(--ui-action-shadow, var(--_ui-action-shadow))),
@@ -582,11 +711,15 @@
582
711
  transition: color var(--ui-motion-fast) var(--ui-motion-ease), text-decoration-color var(--ui-motion-fast) var(--ui-motion-ease);
583
712
  }
584
713
 
585
- :scope:where([data-component~="ui-button"])[data-appearance="link"] .label {
714
+ :scope:where([data-component~="ui-button"])[data-appearance="link"] .label:not(:has(> *)) {
586
715
  display: inline !important;
587
716
  text-box-trim: none;
588
717
  }
589
718
 
719
+ :scope:where([data-component~="ui-button"])[data-appearance="link"] .label:has(> *) {
720
+ text-decoration: inherit;
721
+ }
722
+
590
723
  :scope:where([data-component~="ui-button"])[data-appearance="link"]:hover:not(:disabled, [aria-disabled="true"]) {
591
724
  color: var(--ui-button-link-hover-text, var(--ui-text-primary));
592
725
  text-decoration-color: currentColor;
@@ -617,13 +750,17 @@
617
750
  }
618
751
  }
619
752
  @scope ([data-component~="ui-button"]) to ([data-component]) {
620
- /* An anchor keeps the boxed button look even when an app styles ordinary links. */
753
+ /* Explicit interaction palettes reuse the resting palette bindings, without changing geometry. */
754
+
755
+ /* An anchor keeps the boxed button look even when an app styles ordinary links. */
621
756
 
622
757
  /* A count is an adornment, not another line of label text. Keep the standard control height
623
758
  with enough inset for a 24px mark; large content can still grow the button naturally. */
624
759
 
625
760
  /* Trim the text line itself: an anonymous flex item retains font-metric space in some fonts. */
626
761
 
762
+ /* Projected marks may be images or composed elements, including block-level image resets. */
763
+
627
764
  @supports (text-box-trim: trim-both) {
628
765
  }
629
766
 
@@ -635,7 +772,7 @@
635
772
  /* A link is never :enabled, so interactive states test "not unavailable" instead: for a button that
636
773
  is exactly :enabled, at the same specificity, and it also matches a link that can be followed. */
637
774
 
638
- /* Pressed reads as pressed in: the highlight goes, and the shadow moves inside. */
775
+ /* Pressed outranks tone-specific outline paint: the highlight goes, and the shadow moves inside. */
639
776
 
640
777
  /* Tone is the colour, variant is the volume. Every pairing works: a danger outline is a
641
778
  destructive secondary action, not a special case. */
@@ -644,6 +781,8 @@
644
781
 
645
782
  /* Shared translucent paint keeps text and icon action feedback coordinated. */
646
783
 
784
+ /* Interaction settings choose paint only. Pressed keeps its stronger fill and inset shadow. */
785
+
647
786
  /* A soft halo that transitions in with the other box-shadow changes, layered on the raised shadow. */
648
787
 
649
788
  /* A loading action stays visually active; only an explicitly disabled action takes the
@@ -13,6 +13,8 @@ export interface UiButtonProps {
13
13
  align?: "center" | "start" | null;
14
14
  disabled?: boolean | null;
15
15
  href?: string | null;
16
+ interactionTone?: "inherit" | "accent" | "accent-secondary" | "accent-tertiary" | "neutral" | "danger" | "success" | "warning" | "info" | null;
17
+ interactionVariant?: "inherit" | "outline" | "solid" | "ghost" | null;
16
18
  loading?: boolean | null;
17
19
  pending?: boolean | null;
18
20
  preset?: "none" | "primary" | "standard" | "quiet" | "destructive" | null;