@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.
- package/README.md +22 -14
- package/css/components/draggable.css +3 -1
- package/css/components/music-player.css +578 -0
- package/css/vanduo.css +1 -0
- package/dist/build-info.json +3 -3
- package/dist/vanduo.cjs.js +773 -18
- package/dist/vanduo.cjs.js.map +3 -3
- package/dist/vanduo.cjs.min.js +5 -5
- package/dist/vanduo.cjs.min.js.map +4 -4
- package/dist/vanduo.css +511 -2
- package/dist/vanduo.css.map +1 -1
- package/dist/vanduo.esm.js +773 -18
- package/dist/vanduo.esm.js.map +3 -3
- package/dist/vanduo.esm.min.js +5 -5
- package/dist/vanduo.esm.min.js.map +4 -4
- package/dist/vanduo.js +773 -18
- package/dist/vanduo.js.map +3 -3
- package/dist/vanduo.min.css +2 -2
- package/dist/vanduo.min.css.map +1 -1
- package/dist/vanduo.min.js +5 -5
- package/dist/vanduo.min.js.map +4 -4
- package/js/components/draggable.js +103 -12
- package/js/components/music-player.js +848 -0
- package/js/components/theme-customizer.js +22 -9
- package/js/components/theme-switcher.js +4 -0
- package/js/index.js +1 -0
- package/package.json +1 -1
|
@@ -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
|
-
//
|
|
258
|
-
//
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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