beercss 3.8.0 → 3.9.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.
@@ -1,7 +1,3 @@
1
- menu > li {
2
- all: unset;
3
- }
4
-
5
1
  menu {
6
2
  opacity: 0;
7
3
  visibility: hidden;
@@ -38,8 +34,8 @@ menu.no-wrap {
38
34
  menu.active,
39
35
  menu:not([data-ui]):active,
40
36
  :not(menu, [data-ui]):focus-within > menu,
41
- menu > :is(a, li, nav):hover + menu,
42
- menu > menu:hover {
37
+ menu > li:hover > menu,
38
+ menu > li > menu:hover {
43
39
  opacity: 1;
44
40
  visibility: visible;
45
41
  transform: scale(1) translateY(100%);
@@ -49,27 +45,43 @@ menu * {
49
45
  white-space: inherit !important;
50
46
  }
51
47
 
52
- menu > :is(a, nav, li > a, li > nav) {
53
- padding: 0.5rem 1rem;
48
+ menu > li,
49
+ menu > li > a:only-child {
50
+ all: unset;
51
+ box-sizing: border-box;
52
+ position: relative;
53
+ display: flex;
54
+ align-items: center;
55
+ align-self: normal;
56
+ text-align: start;
57
+ justify-content: flex-start;
58
+ white-space: nowrap;
59
+ gap: 1rem;
60
+ padding: 0 1rem;
54
61
  min-block-size: 3rem;
55
62
  flex: 1;
56
63
  margin: 0 !important;
64
+ cursor: pointer;
57
65
  }
58
66
 
59
- menu > :is(a, li > a):not(.row) {
60
- display: flex;
61
- flex-direction: column;
62
- align-items: flex-start;
67
+ menu > li:is(:hover, :focus, .active) {
68
+ background-color: var(--active);
63
69
  }
64
70
 
65
- menu > :is(a, nav, li > a, li > nav):is(:hover, :focus, .active) {
66
- background-color: var(--active);
71
+ menu > li > :is(.max, a:only-child, .field:only-child),
72
+ menu > li > a:only-child > .max,
73
+ menu > li:has(.field) {
74
+ flex: 1;
75
+ padding: 0;
76
+ margin: 0;
67
77
  }
68
78
 
69
79
  menu.min {
70
80
  inset: 0 0 auto 0;
71
81
  transform: none !important;
72
82
  border-radius: inherit;
83
+ background-color: var(--surface-variant) !important;
84
+ color: var(--on-surface-variant) !important;
73
85
  }
74
86
 
75
87
  [dir=rtl] menu.min.right,
@@ -90,6 +102,8 @@ menu.max {
90
102
  min-block-size: auto;
91
103
  z-index: 100;
92
104
  transform: none !important;
105
+ background-color: var(--surface-variant) !important;
106
+ color: var(--on-surface-variant) !important;
93
107
  }
94
108
 
95
109
  menu.no-wrap:is(.min, .max) {
@@ -106,8 +120,7 @@ menu.right {
106
120
  inset: auto auto 0 0;
107
121
  }
108
122
 
109
- menu:has(> menu),
110
- menu > menu {
123
+ menu:has(menu) {
111
124
  ---child: 1;
112
125
  ---type: 0;
113
126
 
@@ -118,94 +131,92 @@ menu > menu {
118
131
  max-block-size: none;
119
132
  }
120
133
 
121
- menu > menu,
122
- menu > menu.right,
123
- [dir=rtl] menu > menu.left {
134
+ menu > li > :is(menu, menu.right),
135
+ [dir=rtl] menu > li > menu.left {
124
136
  inset: auto auto calc(3rem * (var(---child) - var(---type))) 100%;
125
137
  }
126
138
 
127
- [dir=rtl] menu > menu,
128
- [dir=rtl] menu > menu.right,
129
- menu > menu.left {
139
+ [dir=rtl] menu > li > :is(menu, menu.right),
140
+ menu > li > menu.left {
130
141
  inset: auto 100% calc(3rem * (var(---child) - var(---type))) auto;
131
142
  }
132
143
 
133
- menu > :nth-last-child(2) {
144
+ menu > li:nth-last-child(2) {
134
145
  ---child: 2;
135
146
  }
136
147
 
137
- menu > :nth-last-child(3) {
148
+ menu > li:nth-last-child(3) {
138
149
  ---child: 3;
139
150
  }
140
151
 
141
- menu > :nth-last-child(4) {
152
+ menu > li:nth-last-child(4) {
142
153
  ---child: 4;
143
154
  }
144
155
 
145
- menu > :nth-last-child(5) {
156
+ menu > li:nth-last-child(5) {
146
157
  ---child: 5;
147
158
  }
148
159
 
149
- menu > :nth-last-child(6) {
160
+ menu > li:nth-last-child(6) {
150
161
  ---child: 6;
151
162
  }
152
163
 
153
- menu > :nth-last-child(7) {
164
+ menu > li:nth-last-child(7) {
154
165
  ---child: 7;
155
166
  }
156
167
 
157
- menu > :nth-last-child(8) {
168
+ menu > li:nth-last-child(8) {
158
169
  ---child: 8;
159
170
  }
160
171
 
161
- menu > :nth-last-child(9) {
172
+ menu > li:nth-last-child(9) {
162
173
  ---child: 9;
163
174
  }
164
175
 
165
- menu > :nth-last-child(10) {
176
+ menu > li:nth-last-child(10) {
166
177
  ---child: 10;
167
178
  }
168
179
 
169
- menu > :nth-last-child(11) {
180
+ menu > li:nth-last-child(11) {
170
181
  ---child: 11;
171
182
  }
172
183
 
173
- menu > :nth-last-of-type(2) {
184
+ menu > li:nth-last-of-type(2) {
174
185
  ---type: 1;
175
186
  }
176
187
 
177
- menu > :nth-last-of-type(3) {
188
+ menu > li:nth-last-of-type(3) {
178
189
  ---type: 2;
179
190
  }
180
191
 
181
- menu > :nth-last-of-type(4) {
192
+ menu > li:nth-last-of-type(4) {
182
193
  ---type: 3;
183
194
  }
184
195
 
185
- menu > :nth-last-of-type(5) {
196
+ menu > li:nth-last-of-type(5) {
186
197
  ---type: 4;
187
198
  }
188
199
 
189
- menu > :nth-last-of-type(6) {
200
+ menu > li:nth-last-of-type(6) {
190
201
  ---type: 5;
191
202
  }
192
203
 
193
- menu > :nth-last-of-type(7) {
204
+ menu > li:nth-last-of-type(7) {
194
205
  ---type: 6;
195
206
  }
196
207
 
197
- menu > :nth-last-of-type(8) {
208
+ menu > li:nth-last-of-type(8) {
198
209
  ---type: 7;
199
210
  }
200
211
 
201
- menu > :nth-last-of-type(9) {
212
+ menu > li:nth-last-of-type(9) {
202
213
  ---type: 8;
203
214
  }
204
215
 
205
- menu > :nth-last-of-type(10) {
216
+ menu > li:nth-last-of-type(10) {
206
217
  ---type: 9;
207
218
  }
208
219
 
209
- menu > :nth-last-of-type(11) {
220
+ menu > li:nth-last-of-type(11) {
210
221
  ---type: 10;
211
222
  }
@@ -28,7 +28,7 @@ nav > :is(ol, ul) > li > :only-child {
28
28
  margin: 0;
29
29
  }
30
30
 
31
- :is(nav, .row) > * {
31
+ :is(nav, .row) > :not(ul, ol) {
32
32
  margin: 0;
33
33
  white-space: normal;
34
34
  flex: none;
@@ -1,4 +1,6 @@
1
- .overlay {
1
+ .overlay,
2
+ dialog::backdrop {
3
+ display: block !important;
2
4
  opacity: 0;
3
5
  visibility: hidden;
4
6
  position: fixed;
@@ -9,7 +11,17 @@
9
11
  transition: all var(--speed3), 0s background-color;
10
12
  }
11
13
 
12
- .overlay.active {
14
+ .overlay.active,
15
+ dialog:popover-open::backdrop {
13
16
  opacity: 1;
14
17
  visibility: visible;
15
18
  }
19
+
20
+ .overlay + dialog::backdrop,
21
+ .snackbar::backdrop {
22
+ display: none;
23
+ }
24
+
25
+ [popover] {
26
+ border: 0;
27
+ }
@@ -10,11 +10,24 @@
10
10
  cursor: pointer;
11
11
  display: inline-flex;
12
12
  align-items: center;
13
+ ---size: 1.5rem;
14
+ }
15
+
16
+ :is(.checkbox, .radio, .switch).small {
17
+ ---size: 1rem;
18
+ }
19
+
20
+ :is(.checkbox, .radio, .switch).large {
21
+ ---size: 2rem;
22
+ }
23
+
24
+ :is(.checkbox, .radio, .switch).extra {
25
+ ---size: 2.5rem;
13
26
  }
14
27
 
15
28
  :is(.checkbox, .radio) > input {
16
- inline-size: 1.5rem;
17
- block-size: 1.5rem;
29
+ inline-size: var(---size);
30
+ block-size: var(---size);
18
31
  opacity: 0;
19
32
  }
20
33
 
@@ -36,17 +49,18 @@
36
49
  }
37
50
 
38
51
  :is(.checkbox, .radio, .switch) > span::before,
39
- .icon > span > i,
52
+ :is(.checkbox, .radio, .switch) > span > i,
40
53
  :is(.checkbox, .radio) > span::after {
54
+ ---size: inherit;
41
55
  content: '';
42
- inline-size: 1.5rem;
43
- block-size: 1.5rem;
56
+ inline-size: var(---size);
57
+ block-size: var(---size);
44
58
  box-sizing: border-box;
45
59
  margin: 0 auto;
46
60
  outline: none;
47
61
  color: var(--primary);
48
62
  position: absolute;
49
- inset: auto auto auto -1.5rem;
63
+ inset: auto auto auto calc(var(---size) * -1);
50
64
  border-radius: 50%;
51
65
  user-select: none;
52
66
  z-index: 1;
@@ -61,9 +75,10 @@
61
75
  justify-content: center;
62
76
  border-radius: 50%;
63
77
  transition: all var(--speed2);
64
- font-size: 1rem;
78
+ font-size: calc(var(---size) - 0.5rem);
65
79
  user-select: none;
66
- min-inline-size: auto;
80
+ min-inline-size: var(---size);
81
+ min-block-size: var(---size);
67
82
  content: "";
68
83
  color: var(--surface-variant);
69
84
  background-color: var(--outline);
@@ -147,11 +162,17 @@
147
162
  content: "check";
148
163
  color: var(--primary);
149
164
  background-color: var(--on-primary);
165
+ transform: translate(-1.75rem, -50%) scale(1);
150
166
  }
151
167
 
152
- .switch > input:checked + span::before,
153
- .switch.icon > input:checked + span > i {
154
- transform: translate(-1.75rem, -50%) scale(1);
168
+ .switch > input:active:not(:disabled) + span::before,
169
+ .switch.icon > input:active:not(:disabled) + span > i {
170
+ transform: translate(-3rem, -50%) scale(1.2);
171
+ }
172
+
173
+ .switch > input:active:checked:not(:disabled) + span::before,
174
+ .switch.icon > input:active:checked:not(:disabled) + span > i {
175
+ transform: translate(-1.75rem, -50%) scale(1.2);
155
176
  }
156
177
 
157
178
  :is(.checkbox, .radio, .switch) > input:disabled + span {
@@ -169,9 +190,6 @@
169
190
  inline-size: 3.25rem;
170
191
  block-size: 2rem;
171
192
  border-radius: 2rem;
172
- }
173
-
174
- .switch > span::after {
175
193
  transform: translate(-3.25rem, -50%);
176
194
  }
177
195
 
@@ -36,6 +36,13 @@ function updateAllRanges() {
36
36
  for(let i=0; i<ranges.length; i++) updateRange(ranges[i]);
37
37
  }
38
38
 
39
+ function rootSizeInPixels(): number {
40
+ const size = getComputedStyle(document.documentElement).getPropertyValue("--size") || "16px";
41
+ if (size.indexOf("%") != -1) return (parseInt(size) * 16) / 100;
42
+ if (size.indexOf("em") != -1) return parseInt(size) * 16;
43
+ return parseInt(size);
44
+ }
45
+
39
46
  function updateRange(input: HTMLInputElement) {
40
47
  on(input, "focus", onFocusRange);
41
48
  on(input, "blur", onBlurRange);
@@ -45,7 +52,7 @@ function updateRange(input: HTMLInputElement) {
45
52
  const inputs = queryAll("input", label) as NodeListOf<HTMLInputElement>;
46
53
  if (!inputs.length || !bar) return;
47
54
 
48
- const rootSize = parseInt(getComputedStyle(document.documentElement).getPropertyValue("--size")) || 16;
55
+ const rootSize = rootSizeInPixels();
49
56
  const thumb = hasClass(label, "max") ? 0 : 0.25 * rootSize * 100 / inputs[0].offsetWidth;
50
57
  const percents: Array<number> = [];
51
58
  const values: Array<number> = [];
@@ -10,7 +10,6 @@
10
10
  color: var(--inverse-on-surface);
11
11
  background-color: var(--inverse-surface);
12
12
  padding: 1rem;
13
- opacity: 1;
14
13
  cursor: pointer;
15
14
  text-align: start;
16
15
  align-items: center;
@@ -25,7 +24,7 @@
25
24
  inset: 6rem auto auto 50%;
26
25
  }
27
26
 
28
- .snackbar.active {
27
+ .snackbar:is(.active, :popover-open) {
29
28
  visibility: visible;
30
29
  transform: translate(-50%, 0);
31
30
  opacity: 1;
@@ -93,7 +93,7 @@
93
93
  border-radius: 1rem !important;
94
94
  }
95
95
 
96
- .border:not(table, .field) {
96
+ .border:not(table, .field, .list) {
97
97
  box-sizing: border-box;
98
98
  border: 0.0625rem solid var(--outline);
99
99
  background-color: transparent;
@@ -1,15 +1,15 @@
1
- .tiny-space:not(nav, ol, ul, .row, .grid, table, .tooltip) {
1
+ .tiny-space:not(nav, ol, ul, .row, .grid, table, .tooltip, .list) {
2
2
  block-size: 0.5rem;
3
3
  }
4
4
 
5
- :is(.space, .small-space):not(nav, ol, ul, .row, .grid, table, .tooltip) {
5
+ :is(.space, .small-space):not(nav, ol, ul, .row, .grid, table, .tooltip, .list) {
6
6
  block-size: 1rem;
7
7
  }
8
8
 
9
- .medium-space:not(nav, ol, ul, .row, .grid, table, .tooltip) {
9
+ .medium-space:not(nav, ol, ul, .row, .grid, table, .tooltip, .list) {
10
10
  block-size: 2rem;
11
11
  }
12
12
 
13
- .large-space:not(nav, ol, ul, .row, .grid, table, .tooltip) {
13
+ .large-space:not(nav, ol, ul, .row, .grid, table, .tooltip, .list) {
14
14
  block-size: 3rem;
15
15
  }
@@ -6,7 +6,7 @@
6
6
  font-display: block;
7
7
  src:
8
8
  url("../material-symbols-outlined.woff2") format("woff2"),
9
- url("https://cdn.jsdelivr.net/npm/beercss@3.8.0/dist/cdn/material-symbols-outlined.woff2") format("woff2");
9
+ url("https://cdn.jsdelivr.net/npm/beercss@3.9.0/dist/cdn/material-symbols-outlined.woff2") format("woff2");
10
10
  }
11
11
 
12
12
  /* rounded icons */
@@ -17,7 +17,7 @@
17
17
  font-display: block;
18
18
  src:
19
19
  url("../material-symbols-rounded.woff2") format("woff2"),
20
- url("https://cdn.jsdelivr.net/npm/beercss@3.8.0/dist/cdn/material-symbols-rounded.woff2") format("woff2");
20
+ url("https://cdn.jsdelivr.net/npm/beercss@3.9.0/dist/cdn/material-symbols-rounded.woff2") format("woff2");
21
21
  }
22
22
 
23
23
  /* sharp icons */
@@ -28,5 +28,5 @@
28
28
  font-display: block;
29
29
  src:
30
30
  url("../material-symbols-sharp.woff2") format("woff2"),
31
- url("https://cdn.jsdelivr.net/npm/beercss@3.8.0/dist/cdn/material-symbols-sharp.woff2") format("woff2");
31
+ url("https://cdn.jsdelivr.net/npm/beercss@3.9.0/dist/cdn/material-symbols-sharp.woff2") format("woff2");
32
32
  }
@@ -1,5 +1,5 @@
1
1
  :root {
2
- --size: 16px;
2
+ --size: 1rem;
3
3
  --font: Inter, Roboto, "Helvetica Neue", "Arial Nova", "Nimbus Sans", Noto Sans, Arial, sans-serif;
4
4
  --font-icon: "Material Symbols Outlined";
5
5
  --speed1: 0.1s;