@radioactive-labs/plutonium 0.4.11 → 0.32.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.
@@ -13153,8 +13153,19 @@
13153
13153
  var color_mode_controller_default = class extends Controller {
13154
13154
  static values = { current: String };
13155
13155
  connect() {
13156
- const mode = localStorage.theme || "light";
13156
+ const mode = localStorage.getItem("theme") || "light";
13157
13157
  this.setMode(mode);
13158
+ this.handleStorageChange = (e4) => {
13159
+ console.log("Storage event received in color-mode controller:", e4.key, e4.newValue, e4.oldValue);
13160
+ if (e4.key === "theme" && e4.newValue) {
13161
+ console.log("Updating color-mode theme to:", e4.newValue);
13162
+ this.setMode(e4.newValue);
13163
+ }
13164
+ };
13165
+ window.addEventListener("storage", this.handleStorageChange);
13166
+ }
13167
+ disconnect() {
13168
+ window.removeEventListener("storage", this.handleStorageChange);
13158
13169
  }
13159
13170
  toggleMode() {
13160
13171
  const current = this.currentValue || "light";
@@ -13164,13 +13175,12 @@
13164
13175
  setMode(mode) {
13165
13176
  if (mode === "dark") {
13166
13177
  document.documentElement.classList.add("dark");
13167
- localStorage.theme = "dark";
13168
13178
  } else {
13169
13179
  document.documentElement.classList.remove("dark");
13170
- localStorage.theme = "light";
13171
13180
  }
13172
13181
  this.currentValue = mode;
13173
13182
  this.toggleIcons(mode);
13183
+ localStorage.setItem("theme", mode);
13174
13184
  }
13175
13185
  toggleIcons(mode) {
13176
13186
  const sun = this.element.querySelector(".color-mode-icon-light");