@codingsteve01/ember 1.6.0 → 1.7.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.
- package/js/theme.js +4 -2
- package/package.json +1 -2
package/js/theme.js
CHANGED
|
@@ -15,14 +15,16 @@ export function applyTheme(theme, doc = document) {
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Wires a toggle button. `onChange(theme)` runs after every switch, for whatever paints resolved colours
|
|
18
|
-
* (charts: call applyChartTheme and redraw). The button gets aria-pressed and a label for the next state
|
|
18
|
+
* (charts: call applyChartTheme and redraw). The button gets aria-pressed and a label for the next state, in English
|
|
19
|
+
* unless it carries its own words as data-label-dark and data-label-light.
|
|
19
20
|
*/
|
|
20
21
|
export function initThemeToggle(button, onChange = () => {}, doc = document, win = window) {
|
|
21
22
|
const sync = () => {
|
|
22
23
|
const theme = effectiveTheme(doc, win);
|
|
23
24
|
if (button) {
|
|
24
25
|
button.setAttribute('aria-pressed', String(theme === 'dark'));
|
|
25
|
-
|
|
26
|
+
const { labelDark = 'Show dark', labelLight = 'Show light' } = button.dataset;
|
|
27
|
+
button.title = theme === 'light' ? labelDark : labelLight;
|
|
26
28
|
button.dataset.theme = theme;
|
|
27
29
|
}
|
|
28
30
|
onChange(theme);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingsteve01/ember",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "Ember: design tokens, base CSS, components, theme toggle and chart theme for calm dashboards",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
"url": "git+https://github.com/CodingSteve01/design-ember.git"
|
|
10
10
|
},
|
|
11
11
|
"publishConfig": {
|
|
12
|
-
"registry": "https://registry.npmjs.org",
|
|
13
12
|
"access": "public"
|
|
14
13
|
},
|
|
15
14
|
"files": [
|