@vanduo-oss/framework 1.3.1 → 1.3.3

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.
@@ -147,6 +147,7 @@
147
147
  loadPreferences: function () {
148
148
  this.state.theme = this.getStorageValue(this.STORAGE_KEYS.THEME, this.DEFAULTS.THEME);
149
149
  this.state.primary = this.getStorageValue(this.STORAGE_KEYS.PRIMARY, this.getDefaultPrimary(this.state.theme));
150
+ this._normalizeDefaultPrimaryIfStaleWithStoredTheme();
150
151
  this.state.neutral = this.getStorageValue(this.STORAGE_KEYS.NEUTRAL, this.DEFAULTS.NEUTRAL);
151
152
  this.state.radius = this.getStorageValue(this.STORAGE_KEYS.RADIUS, this.DEFAULTS.RADIUS);
152
153
  this.state.font = this.getStorageValue(this.STORAGE_KEYS.FONT, this.DEFAULTS.FONT);
@@ -254,15 +255,12 @@
254
255
  // Prevent circular updates
255
256
  this._isApplying = true;
256
257
 
257
- // Check if we should switch primary color (if using default)
258
- // Use the incoming mode for both old and new default checks since
259
- // ThemeSwitcher calls this with the new mode before updating its own state
260
- const currentMode = this.state.theme;
261
- const oldDefault = this.getDefaultPrimary(currentMode);
262
- if (this.state.primary === oldDefault) {
263
- const newDefault = this.getDefaultPrimary(mode);
264
- if (newDefault !== this.state.primary) {
265
- this.applyPrimary(newDefault);
258
+ // Re-align black/amber when they don't match the effective primary for the target mode.
259
+ // Covers theme toggles and stale localStorage (e.g. amber saved while theme is light).
260
+ if (this.isUsingDefaultPrimary()) {
261
+ const expected = this.getDefaultPrimary(mode);
262
+ if (this.state.primary !== expected) {
263
+ this.applyPrimary(expected);
266
264
  }
267
265
  }
268
266
 
@@ -581,6 +579,21 @@
581
579
  this.state.primary === this.DEFAULTS.PRIMARY_DARK;
582
580
  },
583
581
 
582
+ /**
583
+ * When primary is still one of the auto-default palette keys (black/amber) but
584
+ * localStorage was written under a different theme (or OS changed in system mode),
585
+ * align in-memory state before applyAllPreferences runs — avoids amber+light / black+dark drift.
586
+ */
587
+ _normalizeDefaultPrimaryIfStaleWithStoredTheme: function () {
588
+ if (!this.isUsingDefaultPrimary()) {
589
+ return;
590
+ }
591
+ const expected = this.getDefaultPrimary(this.state.theme);
592
+ if (this.state.primary !== expected) {
593
+ this.state.primary = expected;
594
+ }
595
+ },
596
+
584
597
  bindEvents: function () {
585
598
  // Trigger click - bind to any trigger button
586
599
  if (this.elements.trigger) {
@@ -103,6 +103,10 @@
103
103
  if (this.state.preference === 'system') {
104
104
  // Re-apply (effectively just to ensure consistency, though removing attribute usually suffices)
105
105
  this.applyTheme();
106
+ // Keep default primary (black/amber) aligned when OS scheme changes while in system mode
107
+ if (window.ThemeCustomizer && typeof window.ThemeCustomizer.applyTheme === 'function' && !window.ThemeCustomizer._isApplying) {
108
+ window.ThemeCustomizer.applyTheme('system');
109
+ }
106
110
  }
107
111
  };
108
112
  this._mediaQuery.addEventListener('change', this._onMediaChange);
package/js/index.js CHANGED
@@ -62,6 +62,7 @@ import './components/rating.js';
62
62
  import './components/transfer.js';
63
63
  import './components/tree.js';
64
64
  import './components/spotlight.js';
65
+ import './components/music-player.js';
65
66
 
66
67
  // Re-export for ESM / CJS consumers
67
68
  const Vanduo = window.Vanduo;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanduo-oss/framework",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Zero-dependency CSS/JS framework built on Fibonacci/Golden Ratio design system with Open Color integration",
5
5
  "keywords": [
6
6
  "css",