Skip to content

Commit

Permalink
feat(input_dark_mode): Consult document element for color mode first (#…
Browse files Browse the repository at this point in the history
…1119)

* feat(input_dark_mode): Consult document element for color mode first

Co-authored-by: Carson Sievert <[email protected]>
  • Loading branch information
gadenbuie and cpsievert authored Oct 1, 2024
1 parent 7ff88a1 commit e862e0b
Show file tree
Hide file tree
Showing 46 changed files with 65 additions and 41 deletions.
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion inst/components/dist/components.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion inst/components/dist/components.min.js

Large diffs are not rendered by default.

11 changes: 9 additions & 2 deletions inst/components/dist/web-components.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions inst/components/dist/web-components.js.map

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions inst/components/dist/web-components.min.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions inst/components/dist/web-components.min.js.map

Large diffs are not rendered by default.

Binary file modified inst/fonts/KFOlCnqEu92Fr1MmEU9fABc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmEU9fBBc4.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmEU9fBxc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmEU9fCBc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmEU9fCRc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmEU9fChc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmEU9fCxc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmSU5fABc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmSU5fBBc4.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmSU5fBxc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmSU5fCBc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmSU5fCRc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmSU5fChc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmSU5fCxc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmWUlfABc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmWUlfBBc4.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmWUlfBxc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmWUlfCBc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmWUlfCRc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmWUlfChc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmWUlfCxc4EsA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOmCnqEu92Fr1Mu4WxKOzY.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOmCnqEu92Fr1Mu4mxK.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOmCnqEu92Fr1Mu5mxKOzY.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOmCnqEu92Fr1Mu72xKOzY.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOmCnqEu92Fr1Mu7GxKOzY.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOmCnqEu92Fr1Mu7WxKOzY.woff2
Binary file not shown.
Binary file modified inst/fonts/KFOmCnqEu92Fr1Mu7mxKOzY.woff2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
42 changes: 21 additions & 21 deletions inst/lib/bsw5/dist/zephyr/font.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2JL7SUc.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
Expand All @@ -13,7 +13,7 @@
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa0ZL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7SUc.woff2) format('woff2');
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
Expand All @@ -22,7 +22,7 @@
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2ZL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
Expand All @@ -31,7 +31,7 @@
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1pL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2) format('woff2');
unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
Expand All @@ -40,7 +40,7 @@
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2pL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
Expand All @@ -49,7 +49,7 @@
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa25L7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2) format('woff2');
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
Expand All @@ -58,7 +58,7 @@
font-style: normal;
font-weight: 400;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
Expand All @@ -67,7 +67,7 @@
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2JL7SUc.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
Expand All @@ -76,7 +76,7 @@
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa0ZL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7SUc.woff2) format('woff2');
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
Expand All @@ -85,7 +85,7 @@
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2ZL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
Expand All @@ -94,7 +94,7 @@
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1pL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2) format('woff2');
unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
Expand All @@ -103,7 +103,7 @@
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2pL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
Expand All @@ -112,7 +112,7 @@
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa25L7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2) format('woff2');
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
Expand All @@ -121,7 +121,7 @@
font-style: normal;
font-weight: 500;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* cyrillic-ext */
Expand All @@ -130,7 +130,7 @@
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2JL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2JL7SUc.woff2) format('woff2');
unicode-range: U+0460-052F, U+1C80-1C88, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}
/* cyrillic */
Expand All @@ -139,7 +139,7 @@
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa0ZL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa0ZL7SUc.woff2) format('woff2');
unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
/* greek-ext */
Expand All @@ -148,7 +148,7 @@
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2ZL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2ZL7SUc.woff2) format('woff2');
unicode-range: U+1F00-1FFF;
}
/* greek */
Expand All @@ -157,7 +157,7 @@
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1pL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1pL7SUc.woff2) format('woff2');
unicode-range: U+0370-0377, U+037A-037F, U+0384-038A, U+038C, U+038E-03A1, U+03A3-03FF;
}
/* vietnamese */
Expand All @@ -166,7 +166,7 @@
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa2pL7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa2pL7SUc.woff2) format('woff2');
unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
/* latin-ext */
Expand All @@ -175,7 +175,7 @@
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa25L7SUc.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa25L7SUc.woff2) format('woff2');
unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* latin */
Expand All @@ -184,6 +184,6 @@
font-style: normal;
font-weight: 700;
font-display: swap;
src: url(fonts/UcC73FwrK3iLTeHuS_fvQtMwCp50KnMa1ZL7.woff2) format('woff2');
src: url(fonts/UcC73FwrK3iLTeHuS_nVMrMxCp50SjIa1ZL7.woff2) format('woff2');
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
8 changes: 6 additions & 2 deletions man/navset.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions man/page_navbar.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions srcts/src/components/webcomponents/inputDarkMode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,18 @@ export class BslibInputDarkMode extends LitElement {
this.attribute = this.getAttribute("attribute") || this.attribute;

if (typeof this.mode === "undefined") {
this.mode = window.matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light";
// If the switch doesn't have a preference about color mode, first consult
// the data attribute on `<html>` followed by OS/browser preferences
const fromDom = document.documentElement.getAttribute(this.attribute);
if (fromDom === "dark") {
this.mode = "dark";
} else if (fromDom === "light") {
this.mode == "light";
} else {
this.mode = window.matchMedia("(prefers-color-scheme: dark)").matches
? "dark"
: "light";
}
}

this.reflectPreference();
Expand Down

0 comments on commit e862e0b

Please sign in to comment.