@radioactive-labs/plutonium 0.4.11 → 0.31.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/package.json +1 -1
- package/src/css/core.css +2 -2
- package/src/css/easymde.css +8 -8
- package/src/css/intl_tel_input.css +7 -7
- package/src/css/slim_select.css +5 -5
- package/src/dist/css/plutonium.css +2 -2
- package/src/dist/js/plutonium.js +13 -3
- package/src/dist/js/plutonium.js.map +3 -3
- package/src/dist/js/plutonium.min.js +1 -1
- package/src/dist/js/plutonium.min.js.map +2 -2
- package/src/js/controllers/color_mode_controller.js +19 -3
|
@@ -6,8 +6,23 @@ export default class extends Controller {
|
|
|
6
6
|
|
|
7
7
|
connect() {
|
|
8
8
|
// Set initial mode from localStorage or default
|
|
9
|
-
const mode = localStorage.theme || "light";
|
|
9
|
+
const mode = localStorage.getItem('theme') || "light";
|
|
10
10
|
this.setMode(mode);
|
|
11
|
+
|
|
12
|
+
// Listen for cross-tab theme changes
|
|
13
|
+
this.handleStorageChange = (e) => {
|
|
14
|
+
console.log('Storage event received in color-mode controller:', e.key, e.newValue, e.oldValue)
|
|
15
|
+
if (e.key === 'theme' && e.newValue) {
|
|
16
|
+
console.log('Updating color-mode theme to:', e.newValue)
|
|
17
|
+
this.setMode(e.newValue);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
window.addEventListener('storage', this.handleStorageChange);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
disconnect() {
|
|
24
|
+
// Clean up event listener
|
|
25
|
+
window.removeEventListener('storage', this.handleStorageChange);
|
|
11
26
|
}
|
|
12
27
|
|
|
13
28
|
toggleMode() {
|
|
@@ -20,10 +35,8 @@ export default class extends Controller {
|
|
|
20
35
|
// Update html class
|
|
21
36
|
if (mode === "dark") {
|
|
22
37
|
document.documentElement.classList.add("dark");
|
|
23
|
-
localStorage.theme = "dark";
|
|
24
38
|
} else {
|
|
25
39
|
document.documentElement.classList.remove("dark");
|
|
26
|
-
localStorage.theme = "light";
|
|
27
40
|
}
|
|
28
41
|
|
|
29
42
|
// Update button state
|
|
@@ -31,6 +44,9 @@ export default class extends Controller {
|
|
|
31
44
|
|
|
32
45
|
// Show/hide icons
|
|
33
46
|
this.toggleIcons(mode);
|
|
47
|
+
|
|
48
|
+
// Store in localStorage to trigger storage events in other tabs
|
|
49
|
+
localStorage.setItem('theme', mode);
|
|
34
50
|
}
|
|
35
51
|
|
|
36
52
|
toggleIcons(mode) {
|