neo.mjs 4.8.0 → 4.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 +1 -1
- package/src/worker/App.mjs +29 -1
package/package.json
CHANGED
package/src/worker/App.mjs
CHANGED
@@ -55,7 +55,12 @@ class App extends Base {
|
|
55
55
|
*/
|
56
56
|
construct(config) {
|
57
57
|
super.construct(config);
|
58
|
-
|
58
|
+
|
59
|
+
let me = this;
|
60
|
+
|
61
|
+
// convenience shortcuts
|
62
|
+
Neo.applyDeltas = me.applyDeltas .bind(me);
|
63
|
+
Neo.setCssVariable = me.setCssVariable.bind(me);
|
59
64
|
}
|
60
65
|
|
61
66
|
/**
|
@@ -291,6 +296,29 @@ class App extends Base {
|
|
291
296
|
|
292
297
|
me.themeFilesCache = [];
|
293
298
|
}
|
299
|
+
|
300
|
+
/**
|
301
|
+
* @param {Object} data
|
302
|
+
* @param {String} data.key
|
303
|
+
* @param {String} [data.priority] optionally pass 'important'
|
304
|
+
* @param {String} data.theme=Neo.config.themes[0]
|
305
|
+
* @param {String} data.value
|
306
|
+
* @returns {Promise<any>}
|
307
|
+
*/
|
308
|
+
setCssVariable(data) {
|
309
|
+
let addon = Neo.main?.addon?.Stylesheet,
|
310
|
+
theme = Neo.config.themes?.[0];
|
311
|
+
|
312
|
+
if (!addon) {
|
313
|
+
return Promise.reject('Neo.main.addon.Stylesheet not imported');
|
314
|
+
} else {
|
315
|
+
if (theme.startsWith('neo-')) {
|
316
|
+
theme = theme.substring(4);
|
317
|
+
}
|
318
|
+
|
319
|
+
return addon.setCssVariable({theme, ...data});
|
320
|
+
}
|
321
|
+
}
|
294
322
|
}
|
295
323
|
|
296
324
|
let instance = Neo.applyClassConfig(App);
|