@vanduo-oss/framework 1.2.7 → 1.2.9

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.
@@ -251,8 +251,14 @@
251
251
  mode = this.DEFAULTS.THEME;
252
252
  }
253
253
 
254
+ // Prevent circular updates
255
+ this._isApplying = true;
256
+
254
257
  // Check if we should switch primary color (if using default)
255
- const oldDefault = this.getDefaultPrimary(this.state.theme);
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);
256
262
  if (this.state.primary === oldDefault) {
257
263
  const newDefault = this.getDefaultPrimary(mode);
258
264
  if (newDefault !== this.state.primary) {
@@ -271,13 +277,21 @@
271
277
  this.savePreference(this.STORAGE_KEYS.THEME, mode);
272
278
 
273
279
  // Also update the existing ThemeSwitcher if available
280
+ // Only update state, don't call setPreference to avoid circular calls
274
281
  if (window.Vanduo && window.Vanduo.components.themeSwitcher) {
275
282
  const themeSwitcher = window.Vanduo.components.themeSwitcher;
276
- if (themeSwitcher.state) {
283
+ if (themeSwitcher.state && themeSwitcher.state.preference !== mode) {
277
284
  themeSwitcher.state.preference = mode;
285
+ if (typeof themeSwitcher.setStorageValue === 'function') {
286
+ themeSwitcher.setStorageValue(themeSwitcher.STORAGE_KEY, mode);
287
+ }
288
+ if (typeof themeSwitcher.updateUI === 'function') {
289
+ themeSwitcher.updateUI();
290
+ }
278
291
  }
279
292
  }
280
293
 
294
+ this._isApplying = false;
281
295
  this.dispatchEvent('mode-change', { mode: mode });
282
296
  },
283
297
 
@@ -41,6 +41,13 @@
41
41
  this.state.preference = pref;
42
42
  this.setStorageValue(this.STORAGE_KEY, pref);
43
43
  this.applyTheme();
44
+
45
+ // Coordinate with ThemeCustomizer for primary color swap if available
46
+ // Check _isApplying flag to prevent circular updates
47
+ if (window.ThemeCustomizer && window.ThemeCustomizer.applyTheme && !window.ThemeCustomizer._isApplying) {
48
+ window.ThemeCustomizer.applyTheme(pref);
49
+ }
50
+
44
51
  this.updateUI();
45
52
  },
46
53
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanduo-oss/framework",
3
- "version": "1.2.7",
3
+ "version": "1.2.9",
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",
@@ -41,10 +41,10 @@
41
41
  "devDependencies": {
42
42
  "@eslint/js": "^10.0.1",
43
43
  "@playwright/test": "^1.58.2",
44
- "esbuild": "^0.27.3",
45
- "eslint": "^10.0.2",
44
+ "esbuild": "^0.27.4",
45
+ "eslint": "^10.0.3",
46
46
  "husky": "^9.1.7",
47
- "lightningcss": "^1.31.1",
47
+ "lightningcss": "^1.32.0",
48
48
  "stylelint": "^17.4.0",
49
49
  "stylelint-config-standard": "^40.0.0"
50
50
  },