@voidable/theme 0.6.0 → 0.8.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.
Files changed (95) hide show
  1. package/README.md +133 -8
  2. package/package.json +66 -8
  3. package/src/app-shell/detail.css +7 -5
  4. package/src/app-shell/subtable.css +7 -6
  5. package/src/base.css +28 -0
  6. package/src/components/accordion.css +96 -19
  7. package/src/components/action-input.css +51 -61
  8. package/src/components/alert.css +63 -23
  9. package/src/components/avatar.css +0 -2
  10. package/src/components/badge.css +35 -25
  11. package/src/components/banner.css +60 -19
  12. package/src/components/bar-chart.css +75 -0
  13. package/src/components/breadcrumbs.css +20 -16
  14. package/src/components/button.css +130 -55
  15. package/src/components/calendar.css +40 -17
  16. package/src/components/card.css +122 -23
  17. package/src/components/carousel.css +85 -118
  18. package/src/components/checkbox-group.css +3 -1
  19. package/src/components/checkbox.css +18 -23
  20. package/src/components/collapsible.css +95 -29
  21. package/src/components/color-picker.css +10 -10
  22. package/src/components/combobox.css +47 -29
  23. package/src/components/compose-input.css +3 -3
  24. package/src/components/dialog.css +115 -41
  25. package/src/components/divider.css +7 -4
  26. package/src/components/donut-chart.css +105 -0
  27. package/src/components/drawer.css +135 -68
  28. package/src/components/dropdown-menu.css +21 -43
  29. package/src/components/editable.css +7 -7
  30. package/src/components/error-fallback.css +48 -27
  31. package/src/components/field.css +12 -5
  32. package/src/components/file-upload.css +2 -1
  33. package/src/components/gauge.css +194 -0
  34. package/src/components/hamburger.css +10 -10
  35. package/src/components/hover-card.css +13 -113
  36. package/src/components/indicator.css +22 -18
  37. package/src/components/input.css +15 -12
  38. package/src/components/line-chart.css +137 -0
  39. package/src/components/list.css +28 -7
  40. package/src/components/menu.css +48 -33
  41. package/src/components/multiselect.css +57 -40
  42. package/src/components/nav-bar.css +23 -14
  43. package/src/components/nav-menu.css +31 -22
  44. package/src/components/number-input.css +85 -62
  45. package/src/components/overlay.css +215 -0
  46. package/src/components/pagination.css +42 -31
  47. package/src/components/panel.css +37 -11
  48. package/src/components/pin-input.css +23 -22
  49. package/src/components/popover.css +19 -35
  50. package/src/components/progress.css +19 -10
  51. package/src/components/radio-group.css +2 -1
  52. package/src/components/radio.css +15 -20
  53. package/src/components/scroll-area.css +3 -3
  54. package/src/components/segmented-control.css +46 -29
  55. package/src/components/select.css +99 -31
  56. package/src/components/sidebar.css +8 -4
  57. package/src/components/skeleton.css +8 -3
  58. package/src/components/slider.css +4 -2
  59. package/src/components/spinner.css +5 -4
  60. package/src/components/stat.css +59 -52
  61. package/src/components/status-dot.css +0 -1
  62. package/src/components/switch.css +18 -26
  63. package/src/components/table.css +443 -16
  64. package/src/components/tabs.css +92 -29
  65. package/src/components/tag.css +44 -20
  66. package/src/components/tags-input.css +43 -55
  67. package/src/components/textarea.css +15 -12
  68. package/src/components/toast.css +84 -22
  69. package/src/components/toggle.css +35 -42
  70. package/src/components/tooltip.css +19 -38
  71. package/src/core.css +98 -0
  72. package/src/forced-colors.css +134 -0
  73. package/src/index.css +4 -71
  74. package/src/knobs.css +101 -0
  75. package/src/layers.css +38 -0
  76. package/src/media/media.css +258 -0
  77. package/src/media/surface.css +143 -0
  78. package/src/patterns/data.css +461 -0
  79. package/src/patterns/page.css +348 -0
  80. package/src/patterns/shell.css +371 -0
  81. package/src/pre-upgrade.css +202 -0
  82. package/src/primitives.css +44 -71
  83. package/src/reset.css +45 -21
  84. package/src/skins/loft.css +114 -0
  85. package/src/skins/slab.css +107 -0
  86. package/src/themes/aurora.css +16 -0
  87. package/src/themes/capsule.css +16 -0
  88. package/src/themes/console.css +16 -0
  89. package/src/themes/dune.css +16 -0
  90. package/src/themes/iris.css +16 -0
  91. package/src/themes/orbit.css +16 -0
  92. package/src/themes/paper.css +18 -0
  93. package/src/themes/void.css +16 -0
  94. package/src/tokens.css +552 -98
  95. package/src/type.css +103 -0
@@ -0,0 +1,258 @@
1
+ /* ============================================================
2
+ void-media — a media surface (CSS only, no JavaScript)
3
+ An image or video that fills its box, with content laid over it.
4
+
5
+ <void-media place="bottom" height="lg">
6
+ <img src="…" alt="">
7
+ <void-media-content>
8
+ <h1>…</h1>
9
+ <p>…</p>
10
+ </void-media-content>
11
+ </void-media>
12
+
13
+ The scrim is drawn by the content region itself, so it is at full
14
+ strength behind the whole of the text however tall the text is, and
15
+ fades out beyond it. That is what makes the contrast defensible:
16
+ the text can never sit where the scrim has already faded.
17
+ ============================================================ */
18
+
19
+ void-media {
20
+ --void-media-height: clamp(22rem, 60svh, 44rem);
21
+
22
+ position: relative;
23
+ isolation: isolate;
24
+ display: grid;
25
+ grid-template: "media" minmax(0, 1fr) / minmax(0, 1fr);
26
+ min-height: var(--void-media-height);
27
+ overflow: hidden;
28
+ overflow: clip;
29
+ /* The backing shows until the image arrives and wherever it does
30
+ not reach; it is dark, so the text is legible before loading. */
31
+ background: var(--void-color-page);
32
+ color: var(--void-color-text);
33
+ font-family: var(--void-font-sans);
34
+ }
35
+
36
+ /* ── The media: fills the box, cropped around its focal point ── */
37
+ void-media > :is(img, video, picture),
38
+ void-media > picture > img {
39
+ position: absolute;
40
+ inset: 0;
41
+ z-index: 0;
42
+ width: 100%;
43
+ height: 100%;
44
+ max-width: none;
45
+ object-fit: cover;
46
+ object-position: var(--void-media-focal);
47
+ }
48
+
49
+ /* A video is decoration: with reduced motion it is hidden, and the
50
+ <img> placed before it (its poster) shows instead. */
51
+ @media (prefers-reduced-motion: reduce) {
52
+ void-media > img ~ video {
53
+ display: none;
54
+ }
55
+ }
56
+
57
+ /* Focal point: which part of the image survives the crop. Presets
58
+ here; for an exact point set --void-media-focal: 65% 40% inline. */
59
+ void-media[focal="top"] { --void-media-focal: 50% 0%; }
60
+ void-media[focal="bottom"] { --void-media-focal: 50% 100%; }
61
+ void-media[focal="start"] { --void-media-focal: 0% 50%; }
62
+ void-media[focal="end"] { --void-media-focal: 100% 50%; }
63
+ void-media[focal="center"] { --void-media-focal: 50% 50%; }
64
+
65
+ /* Height: a share of the viewport, or an aspect ratio. */
66
+ void-media[height="sm"] { --void-media-height: clamp(14rem, 36svh, 26rem); }
67
+ void-media[height="lg"] { --void-media-height: clamp(28rem, 82svh, 60rem); }
68
+ void-media[height="screen"] { --void-media-height: 100svh; }
69
+
70
+ void-media[ratio] { --void-media-height: 0px; }
71
+ void-media[ratio="1:1"] { aspect-ratio: 1; }
72
+ void-media[ratio="4:3"] { aspect-ratio: 4 / 3; }
73
+ void-media[ratio="16:9"] { aspect-ratio: 16 / 9; }
74
+ void-media[ratio="21:9"] { aspect-ratio: 21 / 9; }
75
+ void-media[ratio="3:1"] { aspect-ratio: 3; }
76
+
77
+ /* ── The content region ──
78
+ A band or a column of the surface. Text inside it keeps a readable
79
+ measure; the region's own ::before is the scrim. */
80
+ void-media-content {
81
+ --void-media-inset: var(--void-page-inset);
82
+ --scrim-to: to bottom;
83
+
84
+ grid-area: media;
85
+ position: relative;
86
+ isolation: isolate;
87
+ z-index: 1;
88
+ display: flex;
89
+ flex-direction: column;
90
+ gap: var(--void-gap-inside);
91
+ min-width: 0;
92
+ align-self: end;
93
+ padding: var(--void-gap-group) var(--void-media-inset);
94
+ }
95
+
96
+ void-media-content::before {
97
+ content: "";
98
+ position: absolute;
99
+ z-index: -1;
100
+ inset: calc(var(--void-scrim-fade) * -1) 0 0;
101
+ pointer-events: none;
102
+ /* Eased, not linear: nine stops, so no band shows where it ends. */
103
+ background: linear-gradient(
104
+ var(--scrim-to),
105
+ oklch(0 0 0 / 0) 0,
106
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.043)) calc(var(--void-scrim-fade) * 0.125),
107
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.157)) calc(var(--void-scrim-fade) * 0.25),
108
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.318)) calc(var(--void-scrim-fade) * 0.375),
109
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.5)) calc(var(--void-scrim-fade) * 0.5),
110
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.682)) calc(var(--void-scrim-fade) * 0.625),
111
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.843)) calc(var(--void-scrim-fade) * 0.75),
112
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.957)) calc(var(--void-scrim-fade) * 0.875),
113
+ var(--void-color-scrim) var(--void-scrim-fade)
114
+ );
115
+ }
116
+
117
+ /* Text in the region: a display line, a lede, and a measure. */
118
+ :is(void-media-content, void-media-content void-stack) > :is(h1, h2, h3, p) {
119
+ max-width: var(--void-measure);
120
+ }
121
+
122
+ :is(void-media-content, void-media-content void-stack):not(void-glass *) > h1 {
123
+ font-family: var(--void-type-display-family);
124
+ font-size: var(--void-type-display-size);
125
+ line-height: var(--void-type-display-leading);
126
+ font-weight: var(--void-type-display-weight);
127
+ letter-spacing: var(--void-type-display-tracking);
128
+ color: var(--void-type-display-color);
129
+ max-width: 16em;
130
+ }
131
+
132
+ :is(void-media-content, void-media-content void-stack):not(void-glass *) > :is(h2, h3) {
133
+ font-family: var(--void-type-title-family);
134
+ font-size: var(--void-type-title-size);
135
+ line-height: var(--void-type-title-leading);
136
+ font-weight: var(--void-type-title-weight);
137
+ letter-spacing: var(--void-type-title-tracking);
138
+ color: var(--void-type-title-color);
139
+ }
140
+
141
+ :is(void-media-content, void-media-content void-stack):not(void-glass *) > p {
142
+ font-family: var(--void-type-lede-family);
143
+ font-size: var(--void-type-lede-size);
144
+ line-height: var(--void-type-lede-leading);
145
+ font-weight: var(--void-type-lede-weight);
146
+ color: var(--void-type-lede-color);
147
+ }
148
+
149
+ /* ── Placement ── bottom is the default band. */
150
+ void-media[place="top"] > void-media-content {
151
+ --scrim-to: to top;
152
+ align-self: start;
153
+ }
154
+
155
+ void-media[place="top"] > void-media-content::before {
156
+ inset: 0 0 calc(var(--void-scrim-fade) * -1);
157
+ }
158
+
159
+ void-media[place="center"] > void-media-content {
160
+ align-self: center;
161
+ justify-self: center;
162
+ align-items: center;
163
+ text-align: center;
164
+ padding-inline: var(--void-gutter);
165
+ }
166
+
167
+ /* Centred text gets a soft ellipse twice its own size: full strength
168
+ out to the corners of the text block, gone at the ellipse's edge. */
169
+ void-media[place="center"] > void-media-content::before {
170
+ inset: -50%;
171
+ background: radial-gradient(
172
+ closest-side,
173
+ var(--void-color-scrim) 72%,
174
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.843)) 76%,
175
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.5)) 84%,
176
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.157)) 93%,
177
+ oklch(0 0 0 / 0) 100%
178
+ );
179
+ }
180
+
181
+ @media (min-width: 48.0625rem) {
182
+ /* A column on one side, the image clear on the other. */
183
+ void-media:is([place="start"], [place="end"]) > void-media-content {
184
+ --scrim-to: to left;
185
+ align-self: stretch;
186
+ justify-self: start;
187
+ justify-content: center;
188
+ box-sizing: border-box;
189
+ width: min(100%, calc(var(--void-media-inset) + var(--void-measure) + var(--void-gap-group)));
190
+ padding-inline: var(--void-media-inset) var(--void-gap-group);
191
+ }
192
+
193
+ void-media:is([place="start"], [place="end"]) > void-media-content::before {
194
+ inset: 0 calc(var(--void-scrim-fade) * -1) 0 0;
195
+ }
196
+
197
+ void-media[place="end"] > void-media-content {
198
+ --scrim-to: to right;
199
+ justify-self: end;
200
+ padding-inline: var(--void-gap-group) var(--void-media-inset);
201
+ }
202
+
203
+ void-media[place="end"] > void-media-content::before {
204
+ inset: 0 0 0 calc(var(--void-scrim-fade) * -1);
205
+ }
206
+ }
207
+
208
+ /* ── Scrim variants ── gradient (above) is the default. */
209
+ void-media[scrim="flat"] > void-media-content::before {
210
+ inset: -200vmax;
211
+ background: var(--void-color-scrim);
212
+ }
213
+
214
+ /* No scrim: for imagery you know is dark, or text in a glass panel. */
215
+ void-media[scrim="none"] > void-media-content::before {
216
+ content: none;
217
+ }
218
+
219
+ /* ── Navigation over the image ── */
220
+ void-media > void-nav-bar {
221
+ position: absolute;
222
+ inset: 0 0 auto;
223
+ z-index: 2;
224
+ }
225
+
226
+ /* ── stack: below 48rem the image sits on top and the content below
227
+ it, on the surface's dark backing ── */
228
+ @media (max-width: 48rem) {
229
+ void-media[stack] {
230
+ display: flex;
231
+ flex-direction: column;
232
+ min-height: 0;
233
+ aspect-ratio: auto;
234
+ }
235
+
236
+ void-media[stack] > :is(img, video, picture) {
237
+ position: relative;
238
+ inset: auto;
239
+ height: auto;
240
+ aspect-ratio: 4 / 3;
241
+ max-height: 62svh;
242
+ -webkit-mask-image: linear-gradient(to bottom, black 62%, transparent);
243
+ mask-image: linear-gradient(to bottom, black 62%, transparent);
244
+ }
245
+
246
+ void-media[stack] > picture > img {
247
+ position: static;
248
+ aspect-ratio: 4 / 3;
249
+ }
250
+
251
+ void-media[stack] > void-media-content {
252
+ padding-top: 0;
253
+ }
254
+
255
+ void-media[stack] > void-media-content::before {
256
+ content: none;
257
+ }
258
+ }
@@ -0,0 +1,143 @@
1
+ /* ============================================================
2
+ Surfaces other than the page: on-media and glass
3
+ The page (black or white) is the first surface. These are two
4
+ more, expressed as the same derived tokens, so every component
5
+ inside them restyles itself with no rules of its own.
6
+
7
+ on-media void-media, or data-void-surface="media" on any region
8
+ that sits over an image. The foreground is off-white in
9
+ both colour schemes; what was the page colour becomes a
10
+ dark translucent shade.
11
+ glass void-glass, or data-void-surface="glass" on a component.
12
+ A translucent, blurred panel in the page's own scheme; over
13
+ a media surface it is dark in both schemes, as everything
14
+ else on the image is.
15
+
16
+ lint:contrast evaluates both over a pure white and a pure black
17
+ image, so the values below cannot drop text under 4.5:1.
18
+ ============================================================ */
19
+
20
+ /* ── On-media ── */
21
+ void-media,
22
+ [data-void-surface="media"] {
23
+ color-scheme: dark;
24
+ --void-scheme-dark: 1;
25
+
26
+ /* Greys are opacities of the foreground; over an image the steps
27
+ sit closer to it, because the backdrop is not a known black. */
28
+ --void-alpha-secondary: calc(0.84 + 0.12 * var(--void-contrast-level));
29
+ --void-alpha-muted: calc(0.82 + 0.12 * var(--void-contrast-level));
30
+ --void-alpha-control: calc(0.56 + 0.25 * var(--void-contrast-level));
31
+ --void-alpha-divider: calc(0.22 + 0.14 * var(--void-chrome-level));
32
+ --void-alpha-focus: 1;
33
+
34
+ /* What things sit on is the scrim; a control that draws no fill of
35
+ its own gets a deeper shade, so it reads off the scrim too. */
36
+ --void-color-bg: var(--void-color-scrim);
37
+ --void-color-control-fill: oklch(0 0 0 / calc(var(--void-scrim-alpha) + 0.16));
38
+ --void-status-shift: 30%;
39
+ --void-accent-shift: 50%;
40
+
41
+ color: var(--void-color-text);
42
+ }
43
+
44
+ /* A navigation bar over an image is transparent and brings its own
45
+ scrim: full strength behind the bar, fading out below it. */
46
+ void-media > void-nav-bar,
47
+ void-nav-bar[data-void-surface="media"] {
48
+ isolation: isolate;
49
+ background: transparent;
50
+ box-shadow: none;
51
+ }
52
+
53
+ void-nav-bar[data-void-surface="media"] {
54
+ position: relative;
55
+ }
56
+
57
+ void-media > void-nav-bar::before,
58
+ void-nav-bar[data-void-surface="media"]::before {
59
+ content: "";
60
+ position: absolute;
61
+ z-index: -1;
62
+ inset: 0 0 calc(var(--void-scrim-fade) * -0.5);
63
+ pointer-events: none;
64
+ background: linear-gradient(
65
+ to top,
66
+ oklch(0 0 0 / 0) 0,
67
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.157)) calc(var(--void-scrim-fade) * 0.125),
68
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.5)) calc(var(--void-scrim-fade) * 0.25),
69
+ oklch(0 0 0 / calc(var(--void-scrim-alpha) * 0.843)) calc(var(--void-scrim-fade) * 0.375),
70
+ var(--void-color-scrim) calc(var(--void-scrim-fade) * 0.5)
71
+ );
72
+ }
73
+
74
+ /* ── Glass ── */
75
+ void-glass,
76
+ [data-void-surface="glass"] {
77
+ --void-scheme-dark: var(--void-page-scheme-dark);
78
+
79
+ --void-alpha-secondary: calc(0.82 + 0.12 * var(--void-contrast-level));
80
+ --void-alpha-muted: calc(0.80 + 0.12 * var(--void-contrast-level));
81
+ --void-alpha-control: calc(0.56 + 0.25 * var(--void-contrast-level));
82
+ --void-alpha-divider: calc(0.12 + 0.14 * var(--void-chrome-level));
83
+
84
+ /* Pure black or white, not the page colour: a tinted page would
85
+ make the glass lighter (or darker) than the checks allow. */
86
+ --void-color-bg: oklch(calc(1 - var(--void-scheme-dark)) 0 0 / var(--void-glass-alpha));
87
+ --void-status-shift: 30%;
88
+ --void-accent-shift: 30%;
89
+
90
+ background: var(--void-color-bg);
91
+ -webkit-backdrop-filter: blur(var(--void-glass-blur));
92
+ backdrop-filter: blur(var(--void-glass-blur));
93
+ box-shadow: inset 0 0 0 1px var(--void-color-border), var(--void-shadow-md);
94
+ color: var(--void-color-text);
95
+ }
96
+
97
+ /* Glass over a media surface belongs to the image, not to the page. The
98
+ image is dark under its scrim and what is written on it is off-white in
99
+ both schemes; a panel in the page's light scheme there was 76% white
100
+ over a dark photograph, a flat grey block with dark text beside white
101
+ headlines and white buttons. So it takes the surface's scheme: dark
102
+ glass. data-theme on the panel itself still chooses otherwise. */
103
+ :is(void-media, [data-void-surface="media"]) :is(void-glass, [data-void-surface="glass"]):not([data-theme]) {
104
+ --void-scheme-dark: 1;
105
+ }
106
+
107
+ /* Native controls and scrollbars inside glass follow the page too. */
108
+ void-glass,
109
+ [data-void-surface="glass"],
110
+ [data-theme="dark"] :is(void-glass, [data-void-surface="glass"]) {
111
+ color-scheme: dark;
112
+ }
113
+
114
+ [data-theme="light"] :is(void-glass, [data-void-surface="glass"]) {
115
+ color-scheme: light;
116
+ }
117
+
118
+ @media (prefers-color-scheme: light) {
119
+ :root:not([data-theme]) :is(void-glass, [data-void-surface="glass"]) {
120
+ color-scheme: light;
121
+ }
122
+ }
123
+
124
+ :is(void-media, [data-void-surface="media"]) :is(void-glass, [data-void-surface="glass"]):not([data-theme]) {
125
+ color-scheme: dark;
126
+ }
127
+
128
+ /* The panel itself. */
129
+ void-glass {
130
+ display: block;
131
+ padding: var(--void-container-padding);
132
+ border-radius: var(--void-container-radius);
133
+ font-family: var(--void-font-sans);
134
+ }
135
+
136
+ /* Where the panel has to be solid there is nothing to blur. */
137
+ @media (prefers-reduced-transparency: reduce) {
138
+ void-glass,
139
+ [data-void-surface="glass"] {
140
+ -webkit-backdrop-filter: none;
141
+ backdrop-filter: none;
142
+ }
143
+ }