@stnd/lab 1.5.0 → 1.5.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/CHANGELOG.md +6 -0
- package/Lab.svelte +21 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/Lab.svelte
CHANGED
|
@@ -359,7 +359,10 @@
|
|
|
359
359
|
fontHeader = readVar("--font-header", target);
|
|
360
360
|
fontInterface = readVar("--font-interface", target);
|
|
361
361
|
fontMono = readVar("--font-monospace", target);
|
|
362
|
-
fontSize =
|
|
362
|
+
fontSize =
|
|
363
|
+
parseFloat(readVar("--font-text-size", target)) ||
|
|
364
|
+
parseFloat(readVar("--font-size", target)) ||
|
|
365
|
+
1;
|
|
363
366
|
lineHeight = parseFloat(readVar("--line-height", target)) || 1.414;
|
|
364
367
|
ratio = parseFloat(readVar("--optical-ratio", target)) || 1.414;
|
|
365
368
|
|
|
@@ -399,7 +402,7 @@
|
|
|
399
402
|
"--font-header",
|
|
400
403
|
"--font-interface",
|
|
401
404
|
"--font-monospace",
|
|
402
|
-
"--font-size",
|
|
405
|
+
"--font-text-size",
|
|
403
406
|
"--line-height",
|
|
404
407
|
"--optical-ratio",
|
|
405
408
|
"--page-padding",
|
|
@@ -459,7 +462,7 @@
|
|
|
459
462
|
"--font-header",
|
|
460
463
|
"--font-interface",
|
|
461
464
|
"--font-monospace",
|
|
462
|
-
"--font-size",
|
|
465
|
+
"--font-text-size",
|
|
463
466
|
"--line-height",
|
|
464
467
|
"--optical-ratio",
|
|
465
468
|
"--page-padding",
|
|
@@ -637,6 +640,15 @@
|
|
|
637
640
|
const savedOverrides = JSON.parse(
|
|
638
641
|
sessionStorage.getItem("stnd-overrides") || "{}",
|
|
639
642
|
);
|
|
643
|
+
if (savedOverrides["--font-size"]) {
|
|
644
|
+
delete savedOverrides["--font-size"];
|
|
645
|
+
document.documentElement.style.removeProperty("--font-size");
|
|
646
|
+
try {
|
|
647
|
+
sessionStorage.setItem("stnd-overrides", JSON.stringify(savedOverrides));
|
|
648
|
+
} catch {
|
|
649
|
+
/* noop */
|
|
650
|
+
}
|
|
651
|
+
}
|
|
640
652
|
if (Object.keys(savedOverrides).length > 0) {
|
|
641
653
|
for (const [token, value] of Object.entries(savedOverrides)) {
|
|
642
654
|
document.documentElement.style.setProperty(token, value);
|
|
@@ -852,6 +864,7 @@
|
|
|
852
864
|
"--font-header",
|
|
853
865
|
"--font-interface",
|
|
854
866
|
"--font-monospace",
|
|
867
|
+
"--font-text-size",
|
|
855
868
|
"--font-size",
|
|
856
869
|
"--line-height",
|
|
857
870
|
"--optical-ratio",
|
|
@@ -996,7 +1009,11 @@
|
|
|
996
1009
|
// =========================================================================
|
|
997
1010
|
function onFontSizeInput(e) {
|
|
998
1011
|
fontSize = parseFloat(e.target.value);
|
|
999
|
-
|
|
1012
|
+
document.documentElement.style.removeProperty("--font-size");
|
|
1013
|
+
if (document.body?.hasAttribute("data-theme")) {
|
|
1014
|
+
document.body.style.removeProperty("--font-size");
|
|
1015
|
+
}
|
|
1016
|
+
writeVar("--font-text-size", `${fontSize}rem`);
|
|
1000
1017
|
}
|
|
1001
1018
|
|
|
1002
1019
|
function onLineHeightInput(e) {
|