@mywallpaper/addon-sdk 2.8.0 → 2.8.1

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mywallpaper/addon-sdk",
3
- "version": "2.8.0",
3
+ "version": "2.8.1",
4
4
  "description": "SDK for building MyWallpaper addons - TypeScript types, manifest validation, and utilities",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -55,7 +55,28 @@
55
55
  case 'SETTINGS_UPDATE':
56
56
  var p = d.payload || d
57
57
  config = p.settings || p
58
- var keys = p.changedKeys || Object.keys(config)
58
+ // changedKeys may be in p.payload (nested structure from host)
59
+ var keys = p.changedKeys || (p.payload && p.payload.changedKeys) || Object.keys(config)
60
+
61
+ // AUTO-UPDATE CSS VARIABLES (DX v2.3+)
62
+ // Only update primitive values (string, number, boolean) to avoid [object Object]
63
+ try {
64
+ var root = document.documentElement
65
+ for (var i = 0; i < keys.length; i++) {
66
+ var key = keys[i]
67
+ var value = config[key]
68
+ if (value !== undefined && value !== null) {
69
+ var valueType = typeof value
70
+ // Only set CSS variables for primitive types
71
+ if (valueType === 'string' || valueType === 'number' || valueType === 'boolean') {
72
+ root.style.setProperty('--mw-config-' + key, String(value))
73
+ }
74
+ }
75
+ }
76
+ } catch (cssErr) {
77
+ // Silent fail - CSS variable updates are a DX convenience, not critical
78
+ }
79
+
59
80
  settingsCallbacks.forEach(function (cb) {
60
81
  try { cb(config, keys) } catch (err) { console.error('[MyWallpaper]', err) }
61
82
  })