beercss 3.12.13 → 3.13.1
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/README.md +9 -9
- package/dist/cdn/beer.css +127 -147
- package/dist/cdn/beer.custom-element.js +2 -2
- package/dist/cdn/beer.custom-element.min.js +1 -1
- package/dist/cdn/beer.js +87 -50
- package/dist/cdn/beer.min.css +1 -1
- package/dist/cdn/beer.min.js +1 -1
- package/dist/cdn/beer.scoped.css +127 -147
- package/dist/cdn/beer.scoped.min.css +1 -1
- package/dist/cdn/wavy-circle.svg +4 -0
- package/dist/cdn/wavy.svg +4 -22
- package/package.json +1 -1
- package/src/cdn/beer.ts +5 -3
- package/src/cdn/customElement.js +2 -2
- package/src/cdn/elements/dialogs.ts +2 -2
- package/src/cdn/elements/fields.css +66 -96
- package/src/cdn/elements/fields.ts +30 -23
- package/src/cdn/elements/progress.css +40 -61
- package/src/cdn/elements/progress.ts +34 -0
- package/src/cdn/elements/selections.css +26 -1
- package/src/cdn/elements/sliders.css +4 -0
- package/src/cdn/elements/sliders.ts +9 -28
- package/src/cdn/elements/snackbars.ts +2 -2
- package/src/cdn/helpers/ripples.ts +2 -2
- package/src/cdn/settings/fonts.css +4 -4
- package/src/cdn/shapes/wavy-circle.svg +4 -0
- package/src/cdn/shapes/wavy.svg +4 -22
- package/src/cdn/utils.ts +33 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { query, queryAll, hasClass, on, off, parent, hasTag,
|
|
1
|
+
import { query, queryAll, hasClass, on, off, parent, hasTag, onWeak, rootSizeInPixels } from "../utils";
|
|
2
2
|
|
|
3
3
|
function onInputDocument(e: Event) {
|
|
4
4
|
const input = e.target as HTMLInputElement;
|
|
@@ -12,20 +12,9 @@ function onInputDocument(e: Event) {
|
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
function
|
|
16
|
-
if (!isTouchable()) return;
|
|
17
|
-
|
|
15
|
+
function onChangeInput(e: Event) {
|
|
18
16
|
const input = e.target as HTMLInputElement;
|
|
19
|
-
|
|
20
|
-
if (hasClass(label, "vertical")) document.body.classList.add("no-scroll");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function onBlurRange(e: Event) {
|
|
24
|
-
if (!isTouchable()) return;
|
|
25
|
-
|
|
26
|
-
const input = e.target as HTMLInputElement;
|
|
27
|
-
const label = parent(input) as HTMLLabelElement;
|
|
28
|
-
if (hasClass(label, "vertical")) document.body.classList.remove("no-scroll");
|
|
17
|
+
requestAnimationFrame(() => input.blur());
|
|
29
18
|
}
|
|
30
19
|
|
|
31
20
|
function updateAllRanges() {
|
|
@@ -33,19 +22,11 @@ function updateAllRanges() {
|
|
|
33
22
|
const ranges = queryAll(".slider > input[type=range]") as NodeListOf<HTMLInputElement>;
|
|
34
23
|
if (!ranges.length) off(body, "input", onInputDocument, false);
|
|
35
24
|
else on(body, "input", onInputDocument, false);
|
|
36
|
-
for(let i=0; i<ranges.length; i++) updateRange(ranges[i]);
|
|
25
|
+
for (let i = 0; i < ranges.length; i++) updateRange(ranges[i]);
|
|
37
26
|
}
|
|
38
27
|
|
|
39
|
-
function rootSizeInPixels(): number {
|
|
40
|
-
const size = getComputedStyle(document.documentElement).getPropertyValue("--size") || "16px";
|
|
41
|
-
if (size.includes("%")) return (parseInt(size) * 16) / 100;
|
|
42
|
-
if (size.includes("em")) return parseInt(size) * 16;
|
|
43
|
-
return parseInt(size);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
28
|
function updateRange(input: HTMLInputElement) {
|
|
47
|
-
|
|
48
|
-
on(input, "blur", onBlurRange);
|
|
29
|
+
onWeak(input, "change", onChangeInput);
|
|
49
30
|
|
|
50
31
|
const label = parent(input) as HTMLElement;
|
|
51
32
|
const bar = query("span", label) as HTMLElement;
|
|
@@ -53,15 +34,15 @@ function updateRange(input: HTMLInputElement) {
|
|
|
53
34
|
if (!inputs.length || !bar) return;
|
|
54
35
|
|
|
55
36
|
const rootSize = rootSizeInPixels();
|
|
56
|
-
const thumb = hasClass(label, "max") ? 0 : 0.25 * rootSize * 100 / inputs[0].offsetWidth;
|
|
37
|
+
const thumb = hasClass(label, "max") ? 0 : (0.25 * rootSize * 100) / inputs[0].offsetWidth;
|
|
57
38
|
const percents: Array<number> = [];
|
|
58
39
|
const values: Array<number> = [];
|
|
59
40
|
for (let i = 0, n = inputs.length; i < n; i++) {
|
|
60
41
|
const min = parseFloat(inputs[i].min) || 0;
|
|
61
42
|
const max = parseFloat(inputs[i].max) || 100;
|
|
62
43
|
const value = parseFloat(inputs[i].value) || 0;
|
|
63
|
-
const percent = (value - min) * 100 / (max - min);
|
|
64
|
-
const fix = thumb / 2 - thumb * percent / 100;
|
|
44
|
+
const percent = ((value - min) * 100) / (max - min);
|
|
45
|
+
const fix = thumb / 2 - (thumb * percent) / 100;
|
|
65
46
|
percents.push(percent + fix);
|
|
66
47
|
values.push(value);
|
|
67
48
|
}
|
|
@@ -90,4 +71,4 @@ function updateRange(input: HTMLInputElement) {
|
|
|
90
71
|
|
|
91
72
|
export function updateAllSliders() {
|
|
92
73
|
updateAllRanges();
|
|
93
|
-
}
|
|
74
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { queryAll, addClass,
|
|
1
|
+
import { queryAll, addClass, removeClass, blurActiveElement, onWeak } from "../utils";
|
|
2
2
|
|
|
3
3
|
let _timeoutSnackbar: ReturnType<typeof setTimeout>;
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ export function updateSnackbar(snackbar: Element, milliseconds?: number) {
|
|
|
15
15
|
const activeSnackbars = queryAll(".snackbar.active");
|
|
16
16
|
for(let i=0; i<activeSnackbars.length; i++) removeClass(activeSnackbars[i], "active");
|
|
17
17
|
addClass(snackbar, "active");
|
|
18
|
-
|
|
18
|
+
onWeak(snackbar, "click", onClickSnackbar);
|
|
19
19
|
|
|
20
20
|
if (_timeoutSnackbar) clearTimeout(_timeoutSnackbar);
|
|
21
21
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { queryAll,
|
|
1
|
+
import { queryAll, onWeak } from "../utils";
|
|
2
2
|
|
|
3
3
|
function onPointerDownRipple(e: PointerEvent) {
|
|
4
4
|
updateRipple(e);
|
|
@@ -27,5 +27,5 @@ function updateRipple(e: PointerEvent) {
|
|
|
27
27
|
|
|
28
28
|
export function updateAllRipples() {
|
|
29
29
|
const ripples = queryAll(".slow-ripple, .ripple, .fast-ripple");
|
|
30
|
-
for(let i=0; i<ripples.length; i++)
|
|
30
|
+
for(let i=0; i<ripples.length; i++) onWeak(ripples[i], "pointerdown", onPointerDownRipple);
|
|
31
31
|
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
font-style: normal;
|
|
5
5
|
font-weight: 400;
|
|
6
6
|
font-display: block;
|
|
7
|
-
src: url(../fonts/material-symbols-outlined.woff2) format("woff2"), url(https://cdn.jsdelivr.net/npm/beercss@3.
|
|
7
|
+
src: url(../fonts/material-symbols-outlined.woff2) format("woff2"), url(https://cdn.jsdelivr.net/npm/beercss@3.13.1/dist/cdn/material-symbols-outlined.woff2) format("woff2");
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
/* rounded icons */
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
font-style: normal;
|
|
14
14
|
font-weight: 400;
|
|
15
15
|
font-display: block;
|
|
16
|
-
src: url(../fonts/material-symbols-rounded.woff2) format("woff2"), url(https://cdn.jsdelivr.net/npm/beercss@3.
|
|
16
|
+
src: url(../fonts/material-symbols-rounded.woff2) format("woff2"), url(https://cdn.jsdelivr.net/npm/beercss@3.13.1/dist/cdn/material-symbols-rounded.woff2) format("woff2");
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
/* sharp icons */
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
font-style: normal;
|
|
23
23
|
font-weight: 400;
|
|
24
24
|
font-display: block;
|
|
25
|
-
src: url(../fonts/material-symbols-sharp.woff2) format("woff2"), url(https://cdn.jsdelivr.net/npm/beercss@3.
|
|
25
|
+
src: url(../fonts/material-symbols-sharp.woff2) format("woff2"), url(https://cdn.jsdelivr.net/npm/beercss@3.13.1/dist/cdn/material-symbols-sharp.woff2) format("woff2");
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
/* subset of only required icons */
|
|
@@ -31,5 +31,5 @@
|
|
|
31
31
|
font-style: normal;
|
|
32
32
|
font-weight: 400;
|
|
33
33
|
font-display: block;
|
|
34
|
-
src: url(../fonts/material-symbols-subset.woff2) format("woff2"), url(https://cdn.jsdelivr.net/npm/beercss@3.
|
|
34
|
+
src: url(../fonts/material-symbols-subset.woff2) format("woff2"), url(https://cdn.jsdelivr.net/npm/beercss@3.13.1/dist/cdn/material-symbols-subset.woff2) format("woff2");
|
|
35
35
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="480" height="480" fill="none">
|
|
2
|
+
<path fill="#D0BCFF" d="M295.84 18.168c4.163 3.594 7.898 7.636 11.723 11.582 8.982 9.199 15.965 13.623 29.054 14.21 3.442.04 6.879.016 10.32-.023 24.023-.106 46.223 8.762 63.445 25.426 15.466 15.648 25.276 37.002 25.662 59.176-.023 3.55-.086 7.096-.171 10.645-.133 10.66 1.763 19.84 9.074 27.985 2.227 2.22 4.504 4.374 6.803 6.518 7.48 7.24 13.335 14.117 18.25 23.313l1.723 3.156c9.935 19.724 11.982 44.682 5.664 65.89-5.617 16.737-14.542 29.311-27.137 41.517-8.844 8.627-13.592 15.6-14.21 28.21-.044 3.536-.014 7.067.022 10.602.1 24.28-8.555 46.572-25.425 64.007-15.648 15.466-37.002 25.276-59.176 25.662-3.55-.023-7.096-.086-10.645-.171-10.66-.133-19.84 1.763-27.985 9.074-2.22 2.227-4.374 4.504-6.519 6.803-7.238 7.48-14.116 13.335-23.312 18.25l-3.156 1.723c-19.724 9.935-44.682 11.982-65.89 5.664-16.738-5.617-29.31-14.543-41.517-27.137-8.982-9.199-15.965-13.623-29.054-14.21-3.442-.04-6.879-.016-10.32.022-24.023.107-46.223-8.761-63.445-25.425-15.466-15.648-25.276-37.002-25.662-59.176.023-3.55.086-7.096.171-10.645.133-10.66-1.763-19.84-9.074-27.985-2.227-2.22-4.504-4.374-6.803-6.519C20.77 299.075 14.915 292.197 10 283l-1.723-3.156c-9.935-19.724-11.982-44.682-5.664-65.89 5.617-16.737 14.542-29.311 27.137-41.517 8.844-8.627 13.592-15.6 14.21-28.21.044-3.536.014-7.067-.023-10.602-.098-24.28 8.556-46.572 25.426-64.007 15.648-15.466 37.002-25.276 59.176-25.662 3.55.023 7.096.086 10.645.171 10.66.133 19.84-1.763 27.985-9.074 2.22-2.227 4.374-4.504 6.518-6.803C180.928 20.77 187.804 14.915 197 10l3.156-1.723c30.418-15.321 69.005-11.063 95.684 9.891ZM196 50a153.61 153.61 0 0 0-2.875 3.5c-9.82 11.895-25.259 19.027-40.367 20.902-5.61.465-11.153.617-16.782.508-16.253-.278-30.131 4.27-42.66 14.828-10.325 10.081-17.964 24.122-18.388 38.735-.002 2.78.027 5.56.072 8.34.309 19.165-3.59 37.379-17.352 51.62a812.786 812.786 0 0 1-5.515 5.294c-11.667 11.161-20.677 23.997-21.371 40.68-.409 18.723 3.98 33.495 17.015 47.402a70.934 70.934 0 0 0 5.723 5.066c11.895 9.82 19.027 25.259 20.902 40.367.465 5.61.617 11.153.508 16.782-.278 16.253 4.27 30.131 14.828 42.66 10.081 10.325 24.122 17.964 38.735 18.388 2.78.002 5.56-.027 8.34-.072 19.165-.309 37.379 3.59 51.62 17.352 1.774 1.83 3.538 3.669 5.294 5.515 11.161 11.667 23.997 20.677 40.68 21.371 18.723.409 33.495-3.98 47.402-17.015a70.934 70.934 0 0 0 5.066-5.723c9.82-11.895 25.259-19.027 40.367-20.902 5.61-.465 11.153-.617 16.782-.508 16.253.278 30.131-4.27 42.66-14.828 10.325-10.081 17.964-24.122 18.388-38.735a487.11 487.11 0 0 0-.072-8.34c-.309-19.165 3.59-37.379 17.352-51.62 1.83-1.774 3.669-3.538 5.515-5.294 11.667-11.161 20.677-23.997 21.371-40.68.409-18.723-3.98-33.495-17.015-47.402a70.934 70.934 0 0 0-5.723-5.066c-11.895-9.82-19.027-25.259-20.902-40.367a163.923 163.923 0 0 1-.508-16.782c.278-16.253-4.27-30.131-14.828-42.66-10.081-10.325-24.122-17.964-38.735-18.388a487.11 487.11 0 0 0-8.34.072c-19.165.309-37.379-3.59-51.62-17.352a812.786 812.786 0 0 1-5.294-5.515c-11.161-11.667-23.997-20.677-40.68-21.371C225.65 30.327 210.23 35.567 196 50Z"/>
|
|
3
|
+
<animateTransform attributeName="transform" calcMode="linear" dur="8s" from="360" repeatCount="indefinite" to="0" type="rotate"/>
|
|
4
|
+
</svg>
|
package/src/cdn/shapes/wavy.svg
CHANGED
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="610 1101 1220 75">
|
|
2
|
-
<path fill="#D0BCFF" d="M1870.425
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
c-43.572-23.863-95.596-23.862-139.164-0.001c-0.028,0.016-0.057,0.031-0.085,0.046c-25.809,14.117-55.001,21.581-84.418,21.581
|
|
7
|
-
c-0.002,0,0,0-0.001,0c-29.45-0.001-58.669-7.479-84.498-21.625c-43.534-23.845-95.513-23.863-139.063-0.058
|
|
8
|
-
c-0.036,0.021-0.072,0.04-0.108,0.06c-25.829,14.146-55.047,21.623-84.496,21.623c-29.398,0-58.566-7.451-84.362-21.551
|
|
9
|
-
c-0.048-0.024-0.095-0.05-0.142-0.075c-43.568-23.863-95.593-23.863-139.163,0c-0.027,0.015-0.054,0.028-0.081,0.043
|
|
10
|
-
c-25.811,14.12-55.001,21.583-84.421,21.583c-29.45,0-58.668-7.478-84.497-21.624c-7.521-4.118-10.278-13.554-6.159-21.074
|
|
11
|
-
s13.554-10.277,21.074-6.158c43.57,23.862,95.593,23.864,139.163,0c0.033-0.018,0.065-0.035,0.098-0.053
|
|
12
|
-
c25.807-14.114,54.991-21.573,84.406-21.573c29.398,0,58.567,7.451,84.364,21.55c0.047,0.025,0.093,0.051,0.14,0.076
|
|
13
|
-
c43.534,23.843,95.508,23.864,139.056,0.059c0.038-0.021,0.075-0.042,0.113-0.063c25.828-14.145,55.049-21.622,84.496-21.622
|
|
14
|
-
c0.002,0,0,0,0.002,0c29.449,0,58.668,7.478,84.497,21.625c43.57,23.863,95.595,23.862,139.165,0.001
|
|
15
|
-
c0.021-0.013,0.043-0.024,0.065-0.036c25.813-14.124,55.011-21.591,84.438-21.591c29.42,0,58.61,7.463,84.421,21.582
|
|
16
|
-
c0.027,0.015,0.055,0.03,0.082,0.045c43.539,23.847,95.521,23.862,139.074,0.049c0.032-0.018,0.064-0.035,0.096-0.053
|
|
17
|
-
c25.829-14.146,55.047-21.623,84.496-21.623s58.667,7.477,84.496,21.623c43.58,23.867,95.604,23.866,139.172,0.005
|
|
18
|
-
c0.039-0.021,0.079-0.043,0.118-0.064c25.803-14.108,54.98-21.564,84.389-21.564c29.448-0.001,58.666,7.476,84.494,21.62
|
|
19
|
-
c0.038,0.021,0.076,0.042,0.114,0.063c43.549,23.807,95.528,23.791,139.063-0.051c7.52-4.121,16.955-1.361,21.073,6.159
|
|
20
|
-
c4.119,7.521,1.361,16.955-6.159,21.073C1929.089,1166.27,1899.872,1173.746,1870.425,1173.746z">
|
|
21
|
-
<animateTransform attributeName="transform" type="translate" from="0 0" to="312.5 0" dur="1s" calcMode="linear" repeatCount="indefinite" />
|
|
22
|
-
</path>
|
|
23
|
-
</svg>
|
|
2
|
+
<path fill="#D0BCFF" d="M1870.425 1173.746c-29.448 0-58.665-7.477-84.493-21.622-.03-.016-.061-.032-.09-.049-43.555-23.82-95.546-23.809-139.091.039a4.079 4.079 0 0 1-.113.062c-25.803 14.109-54.984 21.567-84.394 21.568-29.449 0-58.667-7.478-84.495-21.623-43.554-23.852-95.539-23.865-139.089-.052-.03.018-.062.034-.092.051-25.83 14.146-55.048 21.623-84.497 21.623-29.423 0-58.613-7.463-84.425-21.584l-.077-.042c-43.572-23.863-95.596-23.862-139.164-.001l-.085.046c-25.809 14.117-55.001 21.581-84.418 21.581h-.001c-29.45-.001-58.669-7.479-84.498-21.625-43.534-23.845-95.513-23.863-139.063-.058l-.108.06c-25.829 14.146-55.047 21.623-84.496 21.623-29.398 0-58.566-7.451-84.362-21.551-.048-.024-.095-.05-.142-.075-43.568-23.863-95.593-23.863-139.163 0l-.081.043c-25.811 14.12-55.001 21.583-84.421 21.583-29.45 0-58.668-7.478-84.497-21.624-7.521-4.118-10.278-13.554-6.159-21.074s13.554-10.277 21.074-6.158c43.57 23.862 95.593 23.864 139.163 0l.098-.053c25.807-14.114 54.991-21.573 84.406-21.573 29.398 0 58.567 7.451 84.364 21.55l.14.076c43.534 23.843 95.508 23.864 139.056.059l.113-.063c25.828-14.145 55.049-21.622 84.496-21.622h.002c29.449 0 58.668 7.478 84.497 21.625 43.57 23.863 95.595 23.862 139.165.001.021-.013.043-.024.065-.036 25.813-14.124 55.011-21.591 84.438-21.591 29.42 0 58.61 7.463 84.421 21.582l.082.045c43.539 23.847 95.521 23.862 139.074.049l.096-.053c25.829-14.146 55.047-21.623 84.496-21.623s58.667 7.477 84.496 21.623c43.58 23.867 95.604 23.866 139.172.005l.118-.064c25.803-14.108 54.98-21.564 84.389-21.564 29.448-.001 58.666 7.476 84.494 21.62l.114.063c43.549 23.807 95.528 23.791 139.063-.051 7.52-4.121 16.955-1.361 21.073 6.159 4.119 7.521 1.361 16.955-6.159 21.073-25.828 14.146-55.045 21.622-84.492 21.622z">
|
|
3
|
+
<animateTransform attributeName="transform" calcMode="linear" dur="1s" from="0 0" repeatCount="indefinite" to="312.5 0" type="translate"/>
|
|
4
|
+
</path>
|
|
5
|
+
</svg>
|
package/src/cdn/utils.ts
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
const _emptyNodeList = [] as unknown as NodeListOf<Element>;
|
|
2
|
+
const _weakElements = new WeakSet<HTMLElement>();
|
|
3
|
+
|
|
4
|
+
export const isChrome = navigator.userAgent.includes("Chrome");
|
|
5
|
+
|
|
6
|
+
export const isFirefox = navigator.userAgent.includes("Firefox") && !isChrome;
|
|
7
|
+
|
|
8
|
+
export const isSafari = navigator.userAgent.includes("Safari") && !isChrome;
|
|
9
|
+
|
|
10
|
+
export const isWindows = navigator.userAgent.includes("Windows");
|
|
11
|
+
|
|
12
|
+
export const isMac = navigator.userAgent.includes("Macintosh");
|
|
13
|
+
|
|
14
|
+
export const isLinux = navigator.userAgent.includes("Linux");
|
|
15
|
+
|
|
16
|
+
export const isAndroid = navigator.userAgent.includes("Android");
|
|
17
|
+
|
|
18
|
+
export const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent);
|
|
2
19
|
|
|
3
20
|
export function isTouchable(): boolean {
|
|
4
21
|
return window?.matchMedia("(pointer: coarse)").matches;
|
|
@@ -66,6 +83,11 @@ export function on(element: Element | null, name: string, callback: any, useCapt
|
|
|
66
83
|
if (element?.addEventListener) element.addEventListener(name, callback, useCapture);
|
|
67
84
|
}
|
|
68
85
|
|
|
86
|
+
export function onWeak(element: Element | null, name: string, callback: any, useCapture: boolean = true) {
|
|
87
|
+
addWeakElement(element as HTMLElement);
|
|
88
|
+
on(element, name, callback, useCapture);
|
|
89
|
+
}
|
|
90
|
+
|
|
69
91
|
export function off(element: Element | null, name: string, callback: any, useCapture: boolean = true) {
|
|
70
92
|
if (element?.removeEventListener) element.removeEventListener(name, callback, useCapture);
|
|
71
93
|
}
|
|
@@ -119,3 +141,14 @@ export function updateAllClickable(element: Element) {
|
|
|
119
141
|
if (!hasTag(element, "button") && !hasClass(element, "button") && !hasClass(element, "chip")) addClass(element, "active");
|
|
120
142
|
}
|
|
121
143
|
|
|
144
|
+
export function addWeakElement(element: HTMLElement) {
|
|
145
|
+
if (_weakElements.has(element)) return;
|
|
146
|
+
_weakElements.add(element);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export function rootSizeInPixels(): number {
|
|
150
|
+
const size = getComputedStyle(document.documentElement).getPropertyValue("--size") || "16px";
|
|
151
|
+
if (size.includes("%")) return (parseInt(size) * 16) / 100;
|
|
152
|
+
if (size.includes("em")) return parseInt(size) * 16;
|
|
153
|
+
return parseInt(size);
|
|
154
|
+
}
|