@once-ui-system/foundations 3.0.0-beta.1 → 3.0.0-rc.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/dist/css/styles.css +2 -1
- package/dist/css/styles.css.map +1 -1
- package/dist/css/tokens.css +2 -1
- package/dist/css/tokens.css.map +1 -1
- package/package.json +7 -2
- package/scss/styles/global.scss +7 -0
- package/scss/styles/glow.scss +28 -0
- package/scss/styles/grid.generated.scss +73 -73
- package/scss/styles/position.generated.scss +456 -456
- package/scss/styles/spacing.generated.scss +2058 -2058
- package/scss/styles/utilities.scss +86 -1
- package/scss/tokens/theme.scss +126 -42
- package/tailwind/tailwind.css +342 -0
- package/tokens/README.md +2 -1
- package/tokens/once-ui.tokens.json +63 -105
|
@@ -20,4 +20,89 @@
|
|
|
20
20
|
overflow: hidden;
|
|
21
21
|
text-overflow: ellipsis;
|
|
22
22
|
white-space: nowrap;
|
|
23
|
-
}
|
|
23
|
+
}
|
|
24
|
+
// Emphasis (`emphasis` on Flex and Grid): draws attention to an element.
|
|
25
|
+
// Every look starts from a colour edge that travels round the border (a conic
|
|
26
|
+
// gradient shown only on a thin ring, ::before); `glow` and `aura` add a halo
|
|
27
|
+
// on its own layer (::after), so it lights what is around the element and
|
|
28
|
+
// never its own face. Both sit under the content, inside the element's
|
|
29
|
+
// stacking context. Brand and accent come from the theme's function colours,
|
|
30
|
+
// so the edge stays coloured where the theme's solids are contrast.
|
|
31
|
+
//
|
|
32
|
+
// Tune it with custom properties on the element or an ancestor:
|
|
33
|
+
// --emphasis-from / --emphasis-to (colours), --emphasis-width (ring),
|
|
34
|
+
// --emphasis-duration (one turn).
|
|
35
|
+
|
|
36
|
+
@property --emphasis-angle {
|
|
37
|
+
syntax: "<angle>";
|
|
38
|
+
inherits: false;
|
|
39
|
+
initial-value: 0deg;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.fx-emphasis {
|
|
43
|
+
isolation: isolate;
|
|
44
|
+
|
|
45
|
+
&::before,
|
|
46
|
+
&::after {
|
|
47
|
+
content: "";
|
|
48
|
+
position: absolute;
|
|
49
|
+
inset: 0;
|
|
50
|
+
z-index: -1;
|
|
51
|
+
border-radius: inherit;
|
|
52
|
+
pointer-events: none;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// The edge. A whole-pixel ring: a fractional one rounds differently on
|
|
56
|
+
// opposite sides and reads thicker on top.
|
|
57
|
+
&::before {
|
|
58
|
+
padding: var(--emphasis-width, 1px);
|
|
59
|
+
background: conic-gradient(
|
|
60
|
+
from var(--emphasis-angle),
|
|
61
|
+
var(--emphasis-from, var(--function-brand-600)),
|
|
62
|
+
var(--emphasis-to, var(--function-accent-600)) 25%,
|
|
63
|
+
var(--brand-alpha-weak) 45%,
|
|
64
|
+
var(--brand-alpha-weak) 55%,
|
|
65
|
+
var(--emphasis-to, var(--function-accent-600)) 75%,
|
|
66
|
+
var(--emphasis-from, var(--function-brand-600))
|
|
67
|
+
);
|
|
68
|
+
-webkit-mask:
|
|
69
|
+
linear-gradient(#000 0 0) content-box,
|
|
70
|
+
linear-gradient(#000 0 0);
|
|
71
|
+
-webkit-mask-composite: xor;
|
|
72
|
+
mask:
|
|
73
|
+
linear-gradient(#000 0 0) content-box,
|
|
74
|
+
linear-gradient(#000 0 0);
|
|
75
|
+
mask-composite: exclude;
|
|
76
|
+
animation: emphasis-turn var(--emphasis-duration, 8s) linear infinite;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// With a border, the edge lies over it rather than just inside it.
|
|
80
|
+
&.border-1::before { inset: -1px; }
|
|
81
|
+
&.border-2::before { inset: -2px; }
|
|
82
|
+
&.border-4::before { inset: -4px; }
|
|
83
|
+
&.border-8::before { inset: -8px; }
|
|
84
|
+
|
|
85
|
+
// The halo. `edge` has none.
|
|
86
|
+
&.fx-emphasis-glow::after {
|
|
87
|
+
box-shadow: 0 0 40px -12px var(--emphasis-from, var(--function-brand-600));
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
&.fx-emphasis-aura::after {
|
|
91
|
+
box-shadow:
|
|
92
|
+
0 0 96px -24px var(--emphasis-from, var(--function-brand-600)),
|
|
93
|
+
0 48px 140px -48px var(--emphasis-to, var(--function-accent-600));
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
@media (prefers-reduced-motion: reduce) {
|
|
97
|
+
&::before {
|
|
98
|
+
animation: none;
|
|
99
|
+
--emphasis-angle: 45deg;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@keyframes emphasis-turn {
|
|
105
|
+
to {
|
|
106
|
+
--emphasis-angle: 360deg;
|
|
107
|
+
}
|
|
108
|
+
}
|
package/scss/tokens/theme.scss
CHANGED
|
@@ -29,6 +29,11 @@
|
|
|
29
29
|
--solid-inset-distance: 0;
|
|
30
30
|
--solid-inset-size: 0;
|
|
31
31
|
--solid-border-width: 0;
|
|
32
|
+
--solid-glow-near: 0rem;
|
|
33
|
+
--solid-glow-far: 0rem;
|
|
34
|
+
--solid-glow-near-mix: 0%;
|
|
35
|
+
--solid-glow-far-mix: 0%;
|
|
36
|
+
--solid-glow-rim: var(--static-transparent);
|
|
32
37
|
--backdrop-filter: none;
|
|
33
38
|
--surface-border: var(--static-transparent);
|
|
34
39
|
--surface-background: var(--neutral-background-medium);
|
|
@@ -399,9 +404,16 @@
|
|
|
399
404
|
--brand-border-medium: var(--function-brand-900);
|
|
400
405
|
--brand-border-weak: var(--function-brand-1000);
|
|
401
406
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
407
|
+
/* Alphas in light come from step 400, not 600 as in dark. Step 600 is a
|
|
408
|
+
light mid-tone: on a dark page it stands out, on #f9f9f9 or white it
|
|
409
|
+
barely shows (strong reached 1.6:1 against the page here, 2.4:1 in
|
|
410
|
+
dark). Step 400 at the same percentages gives light the weight dark
|
|
411
|
+
has: about 1.24, 1.57 and 2.23:1 for weak, medium and strong.
|
|
412
|
+
Brand, accent and the status colours use step 500 instead: step 400
|
|
413
|
+
is darker but greyer, and washed the hue out of tinted fills. */
|
|
414
|
+
--brand-alpha-strong: color-mix(in srgb, var(--function-brand-500) 50%, transparent);
|
|
415
|
+
--brand-alpha-medium: color-mix(in srgb, var(--function-brand-500) 30%, transparent);
|
|
416
|
+
--brand-alpha-weak: color-mix(in srgb, var(--function-brand-500) 15%, transparent);
|
|
405
417
|
|
|
406
418
|
/* See the dark block: the brand solids as data-solid="color" has them. */
|
|
407
419
|
--brand-color-strong: var(--function-brand-500);
|
|
@@ -429,9 +441,9 @@
|
|
|
429
441
|
--accent-border-medium: var(--function-accent-900);
|
|
430
442
|
--accent-border-weak: var(--function-accent-1000);
|
|
431
443
|
|
|
432
|
-
--accent-alpha-strong: var(--function-accent-
|
|
433
|
-
--accent-alpha-medium: var(--function-accent-
|
|
434
|
-
--accent-alpha-weak: var(--function-accent-
|
|
444
|
+
--accent-alpha-strong: color-mix(in srgb, var(--function-accent-500) 50%, transparent);
|
|
445
|
+
--accent-alpha-medium: color-mix(in srgb, var(--function-accent-500) 30%, transparent);
|
|
446
|
+
--accent-alpha-weak: color-mix(in srgb, var(--function-accent-500) 15%, transparent);
|
|
435
447
|
|
|
436
448
|
/* The page sits a step below its surfaces, as dark mode's does: an
|
|
437
449
|
off-white canvas with white cards on it, so layers read by elevation
|
|
@@ -460,9 +472,9 @@
|
|
|
460
472
|
--neutral-border-medium: var(--function-neutral-900);
|
|
461
473
|
--neutral-border-weak: var(--function-neutral-1000);
|
|
462
474
|
|
|
463
|
-
--neutral-alpha-strong: var(--function-neutral-
|
|
464
|
-
--neutral-alpha-medium: var(--function-neutral-
|
|
465
|
-
--neutral-alpha-weak: var(--function-neutral-
|
|
475
|
+
--neutral-alpha-strong: color-mix(in srgb, var(--function-neutral-400) 50%, transparent);
|
|
476
|
+
--neutral-alpha-medium: color-mix(in srgb, var(--function-neutral-400) 30%, transparent);
|
|
477
|
+
--neutral-alpha-weak: color-mix(in srgb, var(--function-neutral-400) 15%, transparent);
|
|
466
478
|
}
|
|
467
479
|
|
|
468
480
|
[data-theme="light"] {
|
|
@@ -502,9 +514,9 @@
|
|
|
502
514
|
--info-border-medium: var(--function-info-900);
|
|
503
515
|
--info-border-weak: var(--function-info-1000);
|
|
504
516
|
|
|
505
|
-
--info-alpha-strong: var(--function-info-
|
|
506
|
-
--info-alpha-medium: var(--function-info-
|
|
507
|
-
--info-alpha-weak: var(--function-info-
|
|
517
|
+
--info-alpha-strong: color-mix(in srgb, var(--function-info-400) 50%, transparent);
|
|
518
|
+
--info-alpha-medium: color-mix(in srgb, var(--function-info-400) 30%, transparent);
|
|
519
|
+
--info-alpha-weak: color-mix(in srgb, var(--function-info-400) 15%, transparent);
|
|
508
520
|
|
|
509
521
|
/* warning */
|
|
510
522
|
--warning-background-strong: var(--function-warning-800);
|
|
@@ -527,9 +539,9 @@
|
|
|
527
539
|
--warning-border-medium: var(--function-warning-900);
|
|
528
540
|
--warning-border-weak: var(--function-warning-1000);
|
|
529
541
|
|
|
530
|
-
--warning-alpha-strong: var(--function-warning-
|
|
531
|
-
--warning-alpha-medium: var(--function-warning-
|
|
532
|
-
--warning-alpha-weak: var(--function-warning-
|
|
542
|
+
--warning-alpha-strong: color-mix(in srgb, var(--function-warning-500) 50%, transparent);
|
|
543
|
+
--warning-alpha-medium: color-mix(in srgb, var(--function-warning-500) 30%, transparent);
|
|
544
|
+
--warning-alpha-weak: color-mix(in srgb, var(--function-warning-500) 15%, transparent);
|
|
533
545
|
|
|
534
546
|
/* danger */
|
|
535
547
|
--danger-background-strong: var(--function-danger-800);
|
|
@@ -552,9 +564,9 @@
|
|
|
552
564
|
--danger-border-medium: var(--function-danger-900);
|
|
553
565
|
--danger-border-weak: var(--function-danger-1000);
|
|
554
566
|
|
|
555
|
-
--danger-alpha-strong: var(--function-danger-
|
|
556
|
-
--danger-alpha-medium: var(--function-danger-
|
|
557
|
-
--danger-alpha-weak: var(--function-danger-
|
|
567
|
+
--danger-alpha-strong: color-mix(in srgb, var(--function-danger-500) 50%, transparent);
|
|
568
|
+
--danger-alpha-medium: color-mix(in srgb, var(--function-danger-500) 30%, transparent);
|
|
569
|
+
--danger-alpha-weak: color-mix(in srgb, var(--function-danger-500) 15%, transparent);
|
|
558
570
|
|
|
559
571
|
/* success */
|
|
560
572
|
--success-background-strong: var(--function-success-800);
|
|
@@ -577,9 +589,9 @@
|
|
|
577
589
|
--success-border-medium: var(--function-success-900);
|
|
578
590
|
--success-border-weak: var(--function-success-1000);
|
|
579
591
|
|
|
580
|
-
--success-alpha-strong: var(--function-success-
|
|
581
|
-
--success-alpha-medium: var(--function-success-
|
|
582
|
-
--success-alpha-weak: var(--function-success-
|
|
592
|
+
--success-alpha-strong: color-mix(in srgb, var(--function-success-500) 50%, transparent);
|
|
593
|
+
--success-alpha-medium: color-mix(in srgb, var(--function-success-500) 30%, transparent);
|
|
594
|
+
--success-alpha-weak: color-mix(in srgb, var(--function-success-500) 15%, transparent);
|
|
583
595
|
|
|
584
596
|
.dark-flex {
|
|
585
597
|
display: none;
|
|
@@ -598,12 +610,68 @@
|
|
|
598
610
|
}
|
|
599
611
|
}
|
|
600
612
|
|
|
613
|
+
/* showIn follows the nearest theme. On its own, [data-theme="light"]
|
|
614
|
+
.dark-flex hides a dark-only element inside a dark section of a light page
|
|
615
|
+
too; each ancestor theme deeper outweighs the one above, to three levels
|
|
616
|
+
(a light section on a dark page, then dark or invert inside it). */
|
|
617
|
+
[data-theme="light"] [data-theme="dark"],
|
|
618
|
+
[data-theme="dark"] [data-theme="light"] [data-theme="dark"] {
|
|
619
|
+
.dark-flex {
|
|
620
|
+
display: flex;
|
|
621
|
+
}
|
|
622
|
+
|
|
623
|
+
.dark-grid {
|
|
624
|
+
display: grid;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.light-flex,
|
|
628
|
+
.light-grid {
|
|
629
|
+
display: none;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
[data-theme="dark"] [data-theme="light"],
|
|
634
|
+
[data-theme="light"] [data-theme="dark"] [data-theme="light"] {
|
|
635
|
+
.light-flex {
|
|
636
|
+
display: flex;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
.light-grid {
|
|
640
|
+
display: grid;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.dark-flex,
|
|
644
|
+
.dark-grid {
|
|
645
|
+
display: none;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
|
|
601
649
|
[data-solid-style="plastic"] {
|
|
602
650
|
--solid-inset-distance: -1rem;
|
|
603
651
|
--solid-inset-size: 1rem;
|
|
604
652
|
--solid-border-width: 1px;
|
|
605
653
|
}
|
|
606
654
|
|
|
655
|
+
/* Glow: a solid lights its own colour into a soft halo, with a light edge
|
|
656
|
+
along the top. Static shadows only (no filter, no animation). The halo is
|
|
657
|
+
tighter and paler on light, where a wide one muddies the page. */
|
|
658
|
+
[data-solid-style="glow"] {
|
|
659
|
+
--solid-border-width: 1px;
|
|
660
|
+
--solid-glow-near: 0.625rem;
|
|
661
|
+
--solid-glow-far: 1.75rem;
|
|
662
|
+
--solid-glow-near-mix: 55%;
|
|
663
|
+
--solid-glow-far-mix: 22%;
|
|
664
|
+
--solid-glow-rim: var(--static-white-medium);
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
[data-solid-style="glow"][data-theme="light"],
|
|
668
|
+
[data-solid-style="glow"] [data-theme="light"] {
|
|
669
|
+
--solid-glow-near: 0.5rem;
|
|
670
|
+
--solid-glow-far: 1.25rem;
|
|
671
|
+
--solid-glow-near-mix: 45%;
|
|
672
|
+
--solid-glow-far-mix: 14%;
|
|
673
|
+
}
|
|
674
|
+
|
|
607
675
|
[data-transition="all"],[data-transition="micro"] {
|
|
608
676
|
--transition-eased: ease-in-out;
|
|
609
677
|
--transition-property-all: all;
|
|
@@ -662,13 +730,39 @@
|
|
|
662
730
|
--surface-border: var(--static-transparent);
|
|
663
731
|
}
|
|
664
732
|
|
|
665
|
-
/* The solids
|
|
666
|
-
|
|
667
|
-
|
|
733
|
+
/* The brand solids, from the nearest data-theme and the nearest data-solid.
|
|
734
|
+
Each is declared on every element that can change them (a theme, a
|
|
735
|
+
data-solid, a nested data-brand or data-neutral) under a condition that
|
|
736
|
+
weighs nothing and that only one theme-and-solid pair meets, so the
|
|
737
|
+
nearest ones win whatever the order of the rules: a dark StyleScope with
|
|
738
|
+
data-solid="contrast" on a light page gets dark's contrast, and a section
|
|
739
|
+
without a data-solid of its own takes the page's in its own theme. The
|
|
740
|
+
nesting is followed three levels deep (light page, dark section, light
|
|
741
|
+
card). The plain `[data-theme][data-solid]` selector names the pair for
|
|
742
|
+
the token export. */
|
|
743
|
+
@function solid-in($attr) {
|
|
744
|
+
@return "#{$attr}, #{$attr} *";
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
/* At or under `$a`, and not under an `$b` below it unless an `$a` is below
|
|
748
|
+
that again. */
|
|
749
|
+
@function solid-nearest($a, $b) {
|
|
750
|
+
@return ":where(#{solid-in($a)}):not(:where(#{solid-in('#{$a} #{$b}')}):not(:where(#{solid-in('#{$a} #{$b} #{$a}')})))";
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
@function solid-nearest-selector($theme, $solid) {
|
|
754
|
+
$other: "dark";
|
|
755
|
+
@if $theme == "dark" {
|
|
756
|
+
$other: "light";
|
|
757
|
+
}
|
|
758
|
+
$t: '[data-theme=#{$theme}]';
|
|
759
|
+
$o: '[data-theme=#{$other}]';
|
|
760
|
+
$x: '[data-solid=#{$solid}]';
|
|
761
|
+
$ox: '[data-solid]:not(#{$x})';
|
|
762
|
+
@return ':where(:root, [data-theme], [data-solid], [data-brand], [data-neutral]):where(#{solid-nearest($t, $o)}):where(#{solid-nearest($x, $ox)})';
|
|
763
|
+
}
|
|
668
764
|
[data-theme="dark"][data-solid="color"],
|
|
669
|
-
|
|
670
|
-
[data-theme="dark"][data-solid="color"] :is([data-brand], [data-neutral]):not([data-solid]),
|
|
671
|
-
[data-theme="dark"] :not(:root)[data-solid="color"] :is([data-brand], [data-neutral]):not([data-solid]) {
|
|
765
|
+
#{solid-nearest-selector("dark", "color")} {
|
|
672
766
|
--brand-solid-strong: var(--function-brand-500);
|
|
673
767
|
--brand-solid-medium: var(--function-brand-400);
|
|
674
768
|
--brand-solid-weak: var(--function-brand-300);
|
|
@@ -679,9 +773,7 @@
|
|
|
679
773
|
}
|
|
680
774
|
|
|
681
775
|
[data-theme="dark"][data-solid="contrast"],
|
|
682
|
-
|
|
683
|
-
[data-theme="dark"][data-solid="contrast"] :is([data-brand], [data-neutral]):not([data-solid]),
|
|
684
|
-
[data-theme="dark"] :not(:root)[data-solid="contrast"] :is([data-brand], [data-neutral]):not([data-solid]) {
|
|
776
|
+
#{solid-nearest-selector("dark", "contrast")} {
|
|
685
777
|
--brand-solid-strong: var(--function-neutral-1000);
|
|
686
778
|
--brand-solid-medium: var(--static-white);
|
|
687
779
|
--brand-solid-weak: var(--function-neutral-900);
|
|
@@ -692,9 +784,7 @@
|
|
|
692
784
|
}
|
|
693
785
|
|
|
694
786
|
[data-theme="dark"][data-solid="inverse"],
|
|
695
|
-
|
|
696
|
-
[data-theme="dark"][data-solid="inverse"] :is([data-brand], [data-neutral]):not([data-solid]),
|
|
697
|
-
[data-theme="dark"] :not(:root)[data-solid="inverse"] :is([data-brand], [data-neutral]):not([data-solid]) {
|
|
787
|
+
#{solid-nearest-selector("dark", "inverse")} {
|
|
698
788
|
--brand-solid-strong: var(--function-brand-800);
|
|
699
789
|
--brand-solid-medium: var(--function-brand-700);
|
|
700
790
|
--brand-solid-weak: var(--function-brand-600);
|
|
@@ -707,9 +797,7 @@
|
|
|
707
797
|
}
|
|
708
798
|
|
|
709
799
|
[data-theme="light"][data-solid="color"],
|
|
710
|
-
|
|
711
|
-
[data-theme="light"][data-solid="color"] :is([data-brand], [data-neutral]):not([data-solid]),
|
|
712
|
-
[data-theme="light"] :not(:root)[data-solid="color"] :is([data-brand], [data-neutral]):not([data-solid]) {
|
|
800
|
+
#{solid-nearest-selector("light", "color")} {
|
|
713
801
|
/* Step 500, the same as dark: white text on step 600 measures 3:1,
|
|
714
802
|
below WCAG AA for button labels. */
|
|
715
803
|
--brand-solid-strong: var(--function-brand-500);
|
|
@@ -722,9 +810,7 @@
|
|
|
722
810
|
}
|
|
723
811
|
|
|
724
812
|
[data-theme="light"][data-solid="contrast"],
|
|
725
|
-
|
|
726
|
-
[data-theme="light"][data-solid="contrast"] :is([data-brand], [data-neutral]):not([data-solid]),
|
|
727
|
-
[data-theme="light"] :not(:root)[data-solid="contrast"] :is([data-brand], [data-neutral]):not([data-solid]) {
|
|
813
|
+
#{solid-nearest-selector("light", "contrast")} {
|
|
728
814
|
--brand-solid-strong: var(--function-neutral-300);
|
|
729
815
|
--brand-solid-medium: var(--static-black);
|
|
730
816
|
--brand-solid-weak: var(--function-neutral-400);
|
|
@@ -766,9 +852,7 @@
|
|
|
766
852
|
}
|
|
767
853
|
|
|
768
854
|
[data-theme="light"][data-solid="inverse"],
|
|
769
|
-
|
|
770
|
-
[data-theme="light"][data-solid="inverse"] :is([data-brand], [data-neutral]):not([data-solid]),
|
|
771
|
-
[data-theme="light"] :not(:root)[data-solid="inverse"] :is([data-brand], [data-neutral]):not([data-solid]) {
|
|
855
|
+
#{solid-nearest-selector("light", "inverse")} {
|
|
772
856
|
--brand-solid-strong: var(--function-brand-900);
|
|
773
857
|
--brand-solid-medium: var(--function-brand-800);
|
|
774
858
|
--brand-solid-weak: var(--function-brand-700);
|