neo.mjs 6.0.1 → 6.0.2
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/apps/ServiceWorker.mjs +2 -2
- package/apps/covid/view/MainContainerController.mjs +9 -22
- package/apps/sharedcovid/view/MainContainerController.mjs +11 -30
- package/docs/app/view/MainContainerController.mjs +9 -11
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +1 -1
- package/src/DefaultConfig.mjs +2 -11
- package/src/Main.mjs +23 -9
- package/src/main/DomEvents.mjs +7 -2
- package/src/main/addon/Stylesheet.mjs +6 -11
- package/src/worker/App.mjs +1 -1
- package/docs/index_no_css_vars.html +0 -17
- package/docs/neo-config-no-css-vars.json +0 -8
package/apps/ServiceWorker.mjs
CHANGED
@@ -390,31 +390,18 @@ class MainContainerController extends ComponentController {
|
|
390
390
|
logo.vdom.src = logoPath + (theme === 'neo-theme-dark' ? 'covid_logo_dark.jpg' : 'covid_logo_light.jpg');
|
391
391
|
logo.update();
|
392
392
|
|
393
|
+
cls = [...component.cls];
|
393
394
|
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
NeoArray.remove(cls, item);
|
400
|
-
}
|
401
|
-
});
|
395
|
+
component.cls.forEach(item => {
|
396
|
+
if (item.includes('neo-theme')) {
|
397
|
+
NeoArray.remove(cls, item);
|
398
|
+
}
|
399
|
+
});
|
402
400
|
|
403
|
-
|
404
|
-
|
401
|
+
NeoArray.add(cls, theme);
|
402
|
+
component.cls = cls;
|
405
403
|
|
406
|
-
|
407
|
-
iconCls,
|
408
|
-
text: buttonText
|
409
|
-
});
|
410
|
-
} else {
|
411
|
-
Neo.main.addon.Stylesheet.swapStyleSheet({
|
412
|
-
href: href,
|
413
|
-
id : 'neo-theme'
|
414
|
-
}).then(data => {
|
415
|
-
button.text = buttonText;
|
416
|
-
});
|
417
|
-
}
|
404
|
+
button.set({iconCls, text: buttonText});
|
418
405
|
|
419
406
|
if (mapView) {
|
420
407
|
mapView.mapboxStyle = mapViewStyle;
|
@@ -580,42 +580,23 @@ class MainContainerController extends ComponentController {
|
|
580
580
|
logo.vdom.src = logoPath + (theme === 'neo-theme-dark' ? 'covid_logo_dark.jpg' : 'covid_logo_light.jpg');
|
581
581
|
logo.update();
|
582
582
|
|
583
|
+
[component.appName, ...me.connectedApps].forEach(appName => {
|
584
|
+
component = me.getMainView(appName);
|
583
585
|
|
584
|
-
|
585
|
-
[component.appName, ...me.connectedApps].forEach(appName => {
|
586
|
-
component = me.getMainView(appName);
|
586
|
+
cls = [...component.cls];
|
587
587
|
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
NeoArray.remove(cls, item);
|
593
|
-
}
|
594
|
-
});
|
595
|
-
|
596
|
-
NeoArray.add(cls, theme);
|
597
|
-
component.cls = cls;
|
598
|
-
});
|
599
|
-
|
600
|
-
button.set({
|
601
|
-
iconCls,
|
602
|
-
text: buttonText
|
603
|
-
});
|
604
|
-
} else {
|
605
|
-
[component.appName, ...me.connectedApps].forEach(appName => {
|
606
|
-
Neo.main.addon.Stylesheet.swapStyleSheet({
|
607
|
-
appName,
|
608
|
-
href,
|
609
|
-
id: 'neo-theme'
|
610
|
-
});
|
588
|
+
component.cls.forEach(item => {
|
589
|
+
if (item.includes('neo-theme')) {
|
590
|
+
NeoArray.remove(cls, item)
|
591
|
+
}
|
611
592
|
});
|
612
|
-
}
|
613
593
|
|
614
|
-
|
615
|
-
|
616
|
-
text: buttonText
|
594
|
+
NeoArray.add(cls, theme);
|
595
|
+
component.cls = cls;
|
617
596
|
});
|
618
597
|
|
598
|
+
button.set({iconCls, text: buttonText});
|
599
|
+
|
619
600
|
if (mapView) {
|
620
601
|
mapView.mapboxStyle = mapViewStyle;
|
621
602
|
} else {
|
@@ -192,20 +192,18 @@ class MainContainerController extends Component {
|
|
192
192
|
theme = 'neo-theme-dark';
|
193
193
|
}
|
194
194
|
|
195
|
-
|
196
|
-
cls = [...view.cls];
|
195
|
+
cls = [...view.cls];
|
197
196
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
197
|
+
view.cls.forEach(item => {
|
198
|
+
if (item.includes('neo-theme')) {
|
199
|
+
NeoArray.remove(cls, item)
|
200
|
+
}
|
201
|
+
});
|
203
202
|
|
204
|
-
|
205
|
-
|
203
|
+
NeoArray.add(cls, theme);
|
204
|
+
view.cls = cls;
|
206
205
|
|
207
|
-
|
208
|
-
}
|
206
|
+
button.text = buttonText
|
209
207
|
}
|
210
208
|
|
211
209
|
/**
|
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -153,7 +153,6 @@ const DefaultConfig = {
|
|
153
153
|
renderCountDeltas: false,
|
154
154
|
/**
|
155
155
|
* Add themes you want to use here. The first theme will get applied.
|
156
|
-
* If config.useCssVars === true, other theme variables will get included as well
|
157
156
|
* @default ['neo-theme-light', 'neo-theme-dark']
|
158
157
|
* @memberOf! module:Neo
|
159
158
|
* @name config.themes
|
@@ -168,14 +167,6 @@ const DefaultConfig = {
|
|
168
167
|
* @type Boolean
|
169
168
|
*/
|
170
169
|
unitTestMode: false,
|
171
|
-
/**
|
172
|
-
* Flag if CSS variable based stylesheets are in use (important for switching themes)
|
173
|
-
* @default true
|
174
|
-
* @memberOf! module:Neo
|
175
|
-
* @name config.useCssVars
|
176
|
-
* @type Boolean
|
177
|
-
*/
|
178
|
-
useCssVars: true,
|
179
170
|
/**
|
180
171
|
* Experimental flag if an offscreen canvas worker should get created.
|
181
172
|
* @default false
|
@@ -245,12 +236,12 @@ const DefaultConfig = {
|
|
245
236
|
useVdomWorker: true,
|
246
237
|
/**
|
247
238
|
* buildScripts/injectPackageVersion.mjs will update this value
|
248
|
-
* @default '6.0.
|
239
|
+
* @default '6.0.2'
|
249
240
|
* @memberOf! module:Neo
|
250
241
|
* @name config.version
|
251
242
|
* @type String
|
252
243
|
*/
|
253
|
-
version: '6.0.
|
244
|
+
version: '6.0.2'
|
254
245
|
};
|
255
246
|
|
256
247
|
Object.assign(DefaultConfig, {
|
package/src/Main.mjs
CHANGED
@@ -50,6 +50,7 @@ class Main extends core.Base {
|
|
50
50
|
'editRoute',
|
51
51
|
'getByPath',
|
52
52
|
'getWindowData',
|
53
|
+
'importAddon',
|
53
54
|
'redirectTo',
|
54
55
|
'setNeoConfig',
|
55
56
|
'setRoute',
|
@@ -192,9 +193,25 @@ class Main extends core.Base {
|
|
192
193
|
};
|
193
194
|
}
|
194
195
|
|
195
|
-
|
196
|
-
|
197
|
-
|
196
|
+
/**
|
197
|
+
* Import main thread addons at run-time from within the app worker
|
198
|
+
* @param {Object} data
|
199
|
+
* @param {String} data.name
|
200
|
+
* @returns {Boolean}
|
201
|
+
*/
|
202
|
+
async importAddon(data) {
|
203
|
+
let name = data.name,
|
204
|
+
module;
|
205
|
+
|
206
|
+
if (name.startsWith('WS/')) {
|
207
|
+
module = await import(`../../../src/main/addon/${name.substring(3)}.mjs`)
|
208
|
+
} else {
|
209
|
+
module = await import(`./main/addon/${name}.mjs`)
|
210
|
+
}
|
211
|
+
|
212
|
+
this.addon[module.default.constructor.name] = module.default;
|
213
|
+
|
214
|
+
return true
|
198
215
|
}
|
199
216
|
|
200
217
|
/**
|
@@ -209,9 +226,6 @@ class Main extends core.Base {
|
|
209
226
|
|
210
227
|
DomAccess.onDomContentLoaded();
|
211
228
|
|
212
|
-
// not in use right now
|
213
|
-
// window.addEventListener('resize', me.globalResizeListener.bind(me));
|
214
|
-
|
215
229
|
// we need different publicPath values for the main thread inside the webpack based dist envs,
|
216
230
|
// depending on the hierarchy level of the app entry point
|
217
231
|
if (config.environment !== 'development') {
|
@@ -229,7 +243,7 @@ class Main extends core.Base {
|
|
229
243
|
|
230
244
|
mainThreadAddons.forEach(addon => {
|
231
245
|
if (addon.startsWith('WS/')) {
|
232
|
-
imports.push(import(`../../../src/main/addon/${addon.
|
246
|
+
imports.push(import(`../../../src/main/addon/${addon.substring(3)}.mjs`));
|
233
247
|
} else {
|
234
248
|
imports.push(import(`./main/addon/${addon}.mjs`));
|
235
249
|
}
|
@@ -245,7 +259,7 @@ class Main extends core.Base {
|
|
245
259
|
|
246
260
|
WorkerManager.onWorkerConstructed({
|
247
261
|
origin: 'main'
|
248
|
-
})
|
262
|
+
})
|
249
263
|
}
|
250
264
|
|
251
265
|
/**
|
@@ -258,7 +272,7 @@ class Main extends core.Base {
|
|
258
272
|
action : 'reply',
|
259
273
|
replyId: data.id,
|
260
274
|
success: true
|
261
|
-
})
|
275
|
+
})
|
262
276
|
}
|
263
277
|
|
264
278
|
/**
|
package/src/main/DomEvents.mjs
CHANGED
@@ -118,8 +118,8 @@ class DomEvents extends Base {
|
|
118
118
|
|
119
119
|
let me = this;
|
120
120
|
|
121
|
-
document.addEventListener('selectionchange', me.onSelectionChange .bind(me));
|
122
121
|
document.addEventListener('DOMContentLoaded', me.onDomContentLoaded.bind(me));
|
122
|
+
document.addEventListener('selectionchange', me.onSelectionChange .bind(me));
|
123
123
|
window .addEventListener('hashchange', me.onHashChange .bind(me));
|
124
124
|
|
125
125
|
if (Neo.config.useSharedWorkers) {
|
@@ -332,6 +332,11 @@ class DomEvents extends Base {
|
|
332
332
|
return path
|
333
333
|
}
|
334
334
|
|
335
|
+
/**
|
336
|
+
* @param {Object[]} path
|
337
|
+
* @param {HTMLElement} target
|
338
|
+
* @returns {Object[]}
|
339
|
+
*/
|
335
340
|
getSelectionPath(path, target) {
|
336
341
|
if (target.parentNode && target.id.split('__').length > 1) {
|
337
342
|
path = this.getSelectionPath(path, target.parentNode);
|
@@ -343,7 +348,7 @@ class DomEvents extends Base {
|
|
343
348
|
}
|
344
349
|
|
345
350
|
/**
|
346
|
-
* @param {
|
351
|
+
* @param {HTMLElement} node
|
347
352
|
* @returns {Object}
|
348
353
|
*/
|
349
354
|
getTargetData(node) {
|
@@ -72,7 +72,7 @@ class Stylesheet extends Base {
|
|
72
72
|
addGlobalCss() {
|
73
73
|
let config = Neo.config,
|
74
74
|
themes = config.themes,
|
75
|
-
folders =
|
75
|
+
folders = ['src', ...themes],
|
76
76
|
env = config.environment,
|
77
77
|
path = env.startsWith('dist/') ? '' : config.appPath.includes('docs') ? `../dist/${env}/` : `../../dist/${env}/`,
|
78
78
|
rootPath = config.basePath.substr(6);
|
@@ -87,7 +87,7 @@ class Stylesheet extends Base {
|
|
87
87
|
this.createStyleSheet(
|
88
88
|
null,
|
89
89
|
null,
|
90
|
-
`${rootPath}${path}css
|
90
|
+
`${rootPath}${path}css/${folder}/Global.css`
|
91
91
|
);
|
92
92
|
});
|
93
93
|
}
|
@@ -112,19 +112,14 @@ class Stylesheet extends Base {
|
|
112
112
|
className = className.split('.').join('/');
|
113
113
|
|
114
114
|
data.folders.forEach(folder => {
|
115
|
-
if (
|
116
|
-
folder === 'src' && config.useCssVars || folder.includes('theme-') && (
|
117
|
-
config.useCssVars && config.themes.includes(`neo-${folder}`) ||
|
118
|
-
!config.useCssVars && config.themes[0] === `neo-${folder}`
|
119
|
-
)
|
120
|
-
) {
|
115
|
+
if (folder === 'src' || folder.includes('theme-') && config.themes.includes(`neo-${folder}`)) {
|
121
116
|
this.createStyleSheet(
|
122
117
|
null,
|
123
118
|
null,
|
124
|
-
`${rootPath}${path}css
|
125
|
-
)
|
119
|
+
`${rootPath}${path}css/${folder}/${className}.css`
|
120
|
+
)
|
126
121
|
}
|
127
|
-
})
|
122
|
+
})
|
128
123
|
}
|
129
124
|
|
130
125
|
/**
|
package/src/worker/App.mjs
CHANGED
@@ -313,7 +313,7 @@ class App extends Base {
|
|
313
313
|
super.onRegisterNeoConfig(msg);
|
314
314
|
|
315
315
|
let config = Neo.config,
|
316
|
-
url =
|
316
|
+
url = 'resources/theme-map.json';
|
317
317
|
|
318
318
|
if (config.environment === 'development') {
|
319
319
|
url = `../../${url}`
|
@@ -1,17 +0,0 @@
|
|
1
|
-
<!DOCTYPE HTML>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta name="viewport" content="width=device-width, initial-scale=1">
|
5
|
-
<meta charset="UTF-8">
|
6
|
-
<title>Neo Docs NoCssVars</title>
|
7
|
-
</head>
|
8
|
-
<body>
|
9
|
-
<script type="module">
|
10
|
-
fetch('./neo-config-no-css-vars.json').then(response => response.json()).then(data => {
|
11
|
-
self.Neo = {config: {}};
|
12
|
-
Object.assign(Neo.config, data);
|
13
|
-
import(data.mainPath);
|
14
|
-
});
|
15
|
-
</script>
|
16
|
-
</body>
|
17
|
-
</html>
|