keystone_ui 0.46.0 → 0.47.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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 20f1ebc15a9b1a15a854e634286e510b9b224167f3f56181ab756744afaa3f44
|
|
4
|
+
data.tar.gz: a53452a7e08710ca4659937d39bb6d7384f84daa768f6d8afda29c330677a4a3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 96a47743d927612dbc8cbed5b0ab0f12c8c34ae1df1555377613b1b33962b5a8ab15732e72983879724f03c18d79da3aec22d9973bc3b8a8396b9306b8f671dc
|
|
7
|
+
data.tar.gz: 7a0a0e1d2910d253f1f424e65082cd63c3bd40e4b3dbf83cdc67186bfbff72e9116c4c8d4b548bfddf5c59a5ee8b6ceb18051f0a8489e3592a12bb95f2460db5
|
|
@@ -59,6 +59,8 @@ const LIGHT_THEMES = ["light", "custom"]
|
|
|
59
59
|
|
|
60
60
|
export const isDarkMode = (theme, prefersDark) => theme === "dark" || (prefersDark && !LIGHT_THEMES.includes(theme))
|
|
61
61
|
|
|
62
|
+
export const drawnDark = (element, prefersDark) => isDarkMode(element.closest("[data-theme]")?.dataset.theme, prefersDark)
|
|
63
|
+
|
|
62
64
|
const CHART_COLOR_COUNT = 5
|
|
63
65
|
|
|
64
66
|
const INHERITED_FONTS = ["", "inherit"]
|
|
@@ -86,7 +88,7 @@ export const styleDatasets = (datasets, theme, resolve) => {
|
|
|
86
88
|
|
|
87
89
|
export const watchTheme = ({ document, matchMedia, MutationObserver }, onChange) => {
|
|
88
90
|
const observer = new MutationObserver(onChange)
|
|
89
|
-
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme", "data-look"] })
|
|
91
|
+
observer.observe(document.documentElement, { attributes: true, attributeFilter: ["data-theme", "data-look", "style"] })
|
|
90
92
|
observer.observe(document.head, { childList: true, subtree: true, characterData: true })
|
|
91
93
|
const darkPreference = matchMedia("(prefers-color-scheme: dark)")
|
|
92
94
|
darkPreference.addEventListener("change", onChange)
|
|
@@ -136,7 +138,7 @@ export default class extends Controller {
|
|
|
136
138
|
return match ? read(match[1]) || color : color
|
|
137
139
|
}
|
|
138
140
|
|
|
139
|
-
const dark =
|
|
141
|
+
const dark = drawnDark(this.element, matchMedia("(prefers-color-scheme: dark)").matches)
|
|
140
142
|
return { theme: themeColors(read, dark, styles.fontFamily), resolve }
|
|
141
143
|
}
|
|
142
144
|
}
|
data/lib/keystone_ui/version.rb
CHANGED