neo.mjs 5.0.1 → 5.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 +9 -13
- package/apps/covid/view/AttributionComponent.mjs +1 -1
- package/apps/covid/view/MainContainerController.mjs +4 -6
- package/apps/covid/view/country/Gallery.mjs +1 -1
- package/apps/covid/view/country/Helix.mjs +1 -1
- package/apps/sharedcovid/view/AttributionComponent.mjs +1 -1
- package/apps/sharedcovid/view/MainContainerController.mjs +4 -6
- package/apps/sharedcovid/view/country/Gallery.mjs +34 -54
- package/apps/sharedcovid/view/country/Helix.mjs +1 -1
- package/apps/website/data/blog.json +2 -2
- package/examples/ServiceWorker.mjs +9 -13
- package/examples/component/coronaGallery/CountryGallery.mjs +1 -1
- package/examples/component/coronaHelix/CountryHelix.mjs +1 -1
- package/package.json +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/MicroLoader.mjs +1 -1
- package/src/Neo.mjs +15 -12
- package/src/core/Base.mjs +0 -1
- package/src/grid/View.mjs +28 -0
- package/src/table/View.mjs +28 -0
- package/resources/scss/src/form/field/Radio.scss +0 -3
package/apps/ServiceWorker.mjs
CHANGED
@@ -8,12 +8,6 @@ import ServiceBase from '../src/worker/ServiceBase.mjs';
|
|
8
8
|
* @singleton
|
9
9
|
*/
|
10
10
|
class ServiceWorker extends ServiceBase {
|
11
|
-
/**
|
12
|
-
* @member {String} workerId='service'
|
13
|
-
* @protected
|
14
|
-
*/
|
15
|
-
workerId = 'service'
|
16
|
-
|
17
11
|
static config = {
|
18
12
|
/**
|
19
13
|
* @member {String} className='Neo.ServiceWorker'
|
@@ -26,16 +20,18 @@ class ServiceWorker extends ServiceBase {
|
|
26
20
|
*/
|
27
21
|
singleton: true,
|
28
22
|
/**
|
29
|
-
* @member {String} version='5.0.
|
23
|
+
* @member {String} version='5.0.2'
|
30
24
|
*/
|
31
|
-
version: '5.0.
|
25
|
+
version: '5.0.2'
|
32
26
|
}
|
33
|
-
}
|
34
27
|
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
/**
|
29
|
+
* @member {String} workerId='service'
|
30
|
+
* @protected
|
31
|
+
*/
|
32
|
+
workerId = 'service'
|
33
|
+
}
|
38
34
|
|
39
|
-
Neo.
|
35
|
+
let instance = Neo.applyClassConfig(ServiceWorker);
|
40
36
|
|
41
37
|
export default instance;
|
@@ -20,7 +20,7 @@ class AttributionComponent extends Component {
|
|
20
20
|
* @member {Object} vdom
|
21
21
|
*/
|
22
22
|
vdom:
|
23
|
-
{
|
23
|
+
{style: {margin: '20px'}, cn: [
|
24
24
|
{tag: 'h2', html: 'Attribution'},
|
25
25
|
{tag: 'ul', cn: [
|
26
26
|
{tag: 'li', html: 'The logos were created by <a target="_blank" href="https://www.driefmeier.com/">Sebastian Driefmeier</a>. Thank you!'},
|
@@ -309,17 +309,15 @@ class MainContainerController extends ComponentController {
|
|
309
309
|
let table = this.getReference('table');
|
310
310
|
|
311
311
|
table.vdom.cn[0].cn[1].cn.push({
|
312
|
-
|
313
|
-
|
312
|
+
cls : ['neo-box-label', 'neo-label'],
|
313
|
+
style: {margin: '20px'},
|
314
|
+
|
314
315
|
html: [
|
315
316
|
'Summary data did not arrive after 2s.</br>',
|
316
317
|
'Please double-check if the API is offline:</br></br>',
|
317
318
|
'<a target="_blank" href="https://disease.sh/all">NovelCOVID/API all endpoint</a></br></br>',
|
318
319
|
'and if so please try again later.'
|
319
|
-
].join('')
|
320
|
-
style: {
|
321
|
-
margin: '20px'
|
322
|
-
}
|
320
|
+
].join('')
|
323
321
|
});
|
324
322
|
|
325
323
|
table.update();
|
@@ -38,7 +38,7 @@ class CountryGallery extends Gallery {
|
|
38
38
|
itemTpl:
|
39
39
|
{cls: ['neo-gallery-item', 'image-wrap', 'view', 'neo-transition-1000'], tabIndex: '-1', cn: [
|
40
40
|
{cls: ['neo-item-wrapper'], style: {}, cn: [
|
41
|
-
{
|
41
|
+
{cls: ['neo-country-gallery-item'], style: {}, cn: [
|
42
42
|
{cls: ['neo-item-header'], cn: [
|
43
43
|
{tag: 'img', cls: ['neo-flag']},
|
44
44
|
{}
|
@@ -38,7 +38,7 @@ class CountryHelix extends Helix {
|
|
38
38
|
itemTpl:
|
39
39
|
{cls: ['surface', 'neo-helix-item'], style: {}, tabIndex: '-1', cn: [
|
40
40
|
{cls: ['neo-item-wrapper'], style: {}, cn: [
|
41
|
-
{
|
41
|
+
{cls: ['neo-country-helix-item'], style: {}, cn: [
|
42
42
|
{cls: ['neo-item-header'], cn: [
|
43
43
|
{tag: 'img', cls: ['neo-flag']},
|
44
44
|
{}
|
@@ -20,7 +20,7 @@ class AttributionComponent extends Component {
|
|
20
20
|
* @member {Object} vdom
|
21
21
|
*/
|
22
22
|
vdom:
|
23
|
-
{
|
23
|
+
{style: {margin: '20px'}, cn: [
|
24
24
|
{tag: 'h2', html: 'Attribution'},
|
25
25
|
{tag: 'ul', cn: [
|
26
26
|
{tag: 'li', html: 'The logos were created by <a target="_blank" href="https://www.driefmeier.com/">Sebastian Driefmeier</a>. Thank you!'},
|
@@ -494,17 +494,15 @@ class MainContainerController extends ComponentController {
|
|
494
494
|
const table = this.getReference('table');
|
495
495
|
|
496
496
|
table.vdom.cn[0].cn[1].cn.push({
|
497
|
-
tag : 'div',
|
498
497
|
cls : ['neo-box-label', 'neo-label'],
|
499
|
-
|
498
|
+
style: {margin: '20px'},
|
499
|
+
|
500
|
+
html: [
|
500
501
|
'Summary data did not arrive after 2s.</br>',
|
501
502
|
'Please double-check if the API is offline:</br></br>',
|
502
503
|
'<a target="_blank" href="https://disease.sh/all">NovelCOVID/API all endpoint</a></br></br>',
|
503
504
|
'and if so please try again later.'
|
504
|
-
].join('')
|
505
|
-
style: {
|
506
|
-
margin: '20px'
|
507
|
-
}
|
505
|
+
].join('')
|
508
506
|
});
|
509
507
|
|
510
508
|
table.update();
|
@@ -35,60 +35,40 @@ class CountryGallery extends Gallery {
|
|
35
35
|
/**
|
36
36
|
* @member {Object} itemTpl_
|
37
37
|
*/
|
38
|
-
itemTpl:
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
cls
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
tag: '
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
{tag: 'td', html: 'Deaths'},
|
73
|
-
{tag: 'td', cls: ['neo-align-right', 'neo-content-deaths']},
|
74
|
-
{tag: 'td', style: {width: '100%'}},
|
75
|
-
{tag: 'td', html: 'Deaths today'},
|
76
|
-
{tag: 'td', cls: ['neo-align-right', 'neo-content-deaths']}
|
77
|
-
]
|
78
|
-
}, {
|
79
|
-
tag: 'tr',
|
80
|
-
cn : [
|
81
|
-
{tag: 'td', html: 'Recovered'},
|
82
|
-
{tag: 'td', cls: ['neo-align-right', 'neo-content-recovered']},
|
83
|
-
{tag: 'td', style: {width: '100%'}},
|
84
|
-
{tag: 'td', html: 'Critical'},
|
85
|
-
{tag: 'td', cls: ['neo-align-right', 'neo-content-critical']}
|
86
|
-
]
|
87
|
-
}]
|
88
|
-
}]
|
89
|
-
}]
|
90
|
-
}]
|
91
|
-
},
|
38
|
+
itemTpl:
|
39
|
+
{cls: ['neo-gallery-item', 'image-wrap', 'view', 'neo-transition-1000'], tabIndex: '-1', cn: [
|
40
|
+
{cls: ['neo-item-wrapper'], style: {}, cn: [
|
41
|
+
{cls: ['neo-country-gallery-item'], style: {}, cn: [
|
42
|
+
{cls: ['neo-item-header'], cn: [
|
43
|
+
{tag: 'img', cls: ['neo-flag']},
|
44
|
+
{}
|
45
|
+
]},
|
46
|
+
{tag: 'table', cls: ['neo-content-table'], cn: [
|
47
|
+
{tag: 'tr', cn: [
|
48
|
+
{tag: 'td', html: 'Cases'},
|
49
|
+
{tag: 'td', cls: ['neo-align-right']},
|
50
|
+
{tag: 'td', style: {width: '100%'}},
|
51
|
+
{tag: 'td', html: 'Cases today'},
|
52
|
+
{tag: 'td', cls: ['neo-align-right']}
|
53
|
+
]},
|
54
|
+
{tag: 'tr', cn: [
|
55
|
+
{tag: 'td', html: 'Deaths'},
|
56
|
+
{tag: 'td', cls: ['neo-align-right', 'neo-content-deaths']},
|
57
|
+
{tag: 'td', style: {width: '100%'}},
|
58
|
+
{tag: 'td', html: 'Deaths today'},
|
59
|
+
{tag: 'td', cls: ['neo-align-right', 'neo-content-deaths']}
|
60
|
+
]},
|
61
|
+
{tag: 'tr', cn: [
|
62
|
+
{tag: 'td', html: 'Recovered'},
|
63
|
+
{tag: 'td', cls: ['neo-align-right', 'neo-content-recovered']},
|
64
|
+
{tag: 'td', style: {width: '100%'}},
|
65
|
+
{tag: 'td', html: 'Critical'},
|
66
|
+
{tag: 'td', cls: ['neo-align-right', 'neo-content-critical']}
|
67
|
+
]}
|
68
|
+
]}
|
69
|
+
]}
|
70
|
+
]}
|
71
|
+
]},
|
92
72
|
/**
|
93
73
|
* The item width of the gallery
|
94
74
|
* @member {Number} itemWidth=320
|
@@ -38,7 +38,7 @@ class CountryHelix extends Helix {
|
|
38
38
|
itemTpl:
|
39
39
|
{cls: ['surface', 'neo-helix-item'], style: {}, tabIndex: '-1', cn: [
|
40
40
|
{cls: ['neo-item-wrapper'], style: {}, cn: [
|
41
|
-
{
|
41
|
+
{cls: ['neo-country-helix-item'], style: {}, cn: [
|
42
42
|
{cls: ['neo-item-header'], cn: [
|
43
43
|
{tag: 'img', cls: ['neo-flag']},
|
44
44
|
{}
|
@@ -7,10 +7,10 @@
|
|
7
7
|
"image" : "the-next-generation-of-front-end-development.png",
|
8
8
|
"name" : "The Next Generation of Front-end Development",
|
9
9
|
"provider" : "Medium",
|
10
|
-
"publisher" : "",
|
10
|
+
"publisher" : "ITNEXT",
|
11
11
|
"selectedInto": [],
|
12
12
|
"type" : "Blog Post",
|
13
|
-
"url" : "https://
|
13
|
+
"url" : "https://itnext.io/the-next-generation-of-front-end-development-65887c59b173?source=friends_link&sk=51654f60033120e84454791015d8d205"
|
14
14
|
},
|
15
15
|
{
|
16
16
|
"author" : "Tobias Uhlig",
|
@@ -8,12 +8,6 @@ import ServiceBase from '../src/worker/ServiceBase.mjs';
|
|
8
8
|
* @singleton
|
9
9
|
*/
|
10
10
|
class ServiceWorker extends ServiceBase {
|
11
|
-
/**
|
12
|
-
* @member {String} workerId='service'
|
13
|
-
* @protected
|
14
|
-
*/
|
15
|
-
workerId = 'service'
|
16
|
-
|
17
11
|
static config = {
|
18
12
|
/**
|
19
13
|
* @member {String} className='Neo.ServiceWorker'
|
@@ -26,16 +20,18 @@ class ServiceWorker extends ServiceBase {
|
|
26
20
|
*/
|
27
21
|
singleton: true,
|
28
22
|
/**
|
29
|
-
* @member {String} version='5.0.
|
23
|
+
* @member {String} version='5.0.2'
|
30
24
|
*/
|
31
|
-
version: '5.0.
|
25
|
+
version: '5.0.2'
|
32
26
|
}
|
33
|
-
}
|
34
27
|
|
35
|
-
|
36
|
-
|
37
|
-
|
28
|
+
/**
|
29
|
+
* @member {String} workerId='service'
|
30
|
+
* @protected
|
31
|
+
*/
|
32
|
+
workerId = 'service'
|
33
|
+
}
|
38
34
|
|
39
|
-
Neo.
|
35
|
+
let instance = Neo.applyClassConfig(ServiceWorker);
|
40
36
|
|
41
37
|
export default instance;
|
@@ -64,7 +64,7 @@ class CountryGallery extends Gallery {
|
|
64
64
|
|
65
65
|
return {cls, id: me.getItemVnodeId(record[me.keyProperty]), tabIndex: '-1', cn: [
|
66
66
|
{cls: ['neo-item-wrapper'], style: {height: me.itemHeight + 'px'}, cn: [
|
67
|
-
{
|
67
|
+
{cls: ['neo-country-gallery-item'], style, cn: [
|
68
68
|
{cls: ['neo-item-header'], cn: [
|
69
69
|
{tag: 'img', cls: ['neo-flag'], src: me.getCountryFlagUrl(record.country)},
|
70
70
|
{html: record.country}
|
@@ -35,7 +35,7 @@ class CountryHelix extends Helix {
|
|
35
35
|
itemTpl:
|
36
36
|
{cls: ['surface', 'neo-helix-item'], style: {}, tabIndex: '-1', cn: [
|
37
37
|
{cls: ['neo-item-wrapper'], style: {}, cn: [
|
38
|
-
{
|
38
|
+
{cls: ['neo-country-helix-item'], style: {}, cn: [
|
39
39
|
{cls: ['neo-item-header'], cn: [
|
40
40
|
{tag: 'img', cls: ['neo-flag']},
|
41
41
|
{}
|
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
@@ -237,12 +237,12 @@ const DefaultConfig = {
|
|
237
237
|
useVdomWorker: true,
|
238
238
|
/**
|
239
239
|
* buildScripts/injectPackageVersion.mjs will update this value
|
240
|
-
* @default '5.0.
|
240
|
+
* @default '5.0.2'
|
241
241
|
* @memberOf! module:Neo
|
242
242
|
* @name config.version
|
243
243
|
* @type String
|
244
244
|
*/
|
245
|
-
version: '5.0.
|
245
|
+
version: '5.0.2'
|
246
246
|
};
|
247
247
|
|
248
248
|
Object.assign(DefaultConfig, {
|
package/src/MicroLoader.mjs
CHANGED
package/src/Neo.mjs
CHANGED
@@ -48,15 +48,16 @@ Neo = globalThis.Neo = Object.assign({
|
|
48
48
|
* @tutorial 02_ClassSystem
|
49
49
|
*/
|
50
50
|
applyClassConfig(cls) {
|
51
|
-
let baseCfg
|
52
|
-
|
53
|
-
|
51
|
+
let baseCfg = null,
|
52
|
+
ntypeMap = Neo.ntypeMap,
|
53
|
+
proto = cls.prototype || cls,
|
54
|
+
protos = [],
|
54
55
|
config, ctor, overrides;
|
55
56
|
|
56
57
|
while (proto.__proto__) {
|
57
58
|
ctor = proto.constructor;
|
58
59
|
|
59
|
-
if (
|
60
|
+
if (Object.hasOwn(ctor, 'classConfigApplied')) {
|
60
61
|
baseCfg = Neo.clone(ctor.config, true);
|
61
62
|
break;
|
62
63
|
}
|
@@ -94,19 +95,21 @@ Neo = globalThis.Neo = Object.assign({
|
|
94
95
|
});
|
95
96
|
}
|
96
97
|
|
97
|
-
if (
|
98
|
-
|
99
|
-
|
98
|
+
if (Object.hasOwn(cfg, 'ntype')) {
|
99
|
+
if (Object.hasOwn(ntypeMap, cfg.ntype)) {
|
100
|
+
throw new Error(`ntype conflict for '${cfg.ntype}' inside the classes:\n${ntypeMap[cfg.ntype]}\n${cfg.className}`);
|
101
|
+
}
|
100
102
|
|
101
|
-
|
103
|
+
ntypeMap[cfg.ntype] = cfg.className;
|
104
|
+
}
|
102
105
|
|
103
|
-
|
106
|
+
mixins = Object.hasOwn(config, 'mixins') && config.mixins || [];
|
104
107
|
|
105
108
|
if (ctor.observable) {
|
106
109
|
mixins.push('Neo.core.Observable');
|
107
110
|
}
|
108
111
|
|
109
|
-
if (
|
112
|
+
if (Object.hasOwn(cfg, 'mixins') && Array.isArray(cfg.mixins) && cfg.mixins.length > 0) {
|
110
113
|
mixins.push(...cfg.mixins);
|
111
114
|
}
|
112
115
|
|
@@ -208,7 +211,7 @@ Neo = globalThis.Neo = Object.assign({
|
|
208
211
|
assignDefaults(target, defaults) {
|
209
212
|
if (target && Neo.typeOf(defaults) === 'Object') {
|
210
213
|
Object.entries(defaults).forEach(([key, value]) => {
|
211
|
-
if (!
|
214
|
+
if (!Object.hasOwn(target, key)) {
|
212
215
|
target[key] = value;
|
213
216
|
}
|
214
217
|
});
|
@@ -547,7 +550,7 @@ function autoGenerateGetSet(proto, key) {
|
|
547
550
|
get() {
|
548
551
|
let me = this,
|
549
552
|
beforeGet = `beforeGet${key[0].toUpperCase() + key.slice(1)}`,
|
550
|
-
hasNewKey = me[configSymbol]
|
553
|
+
hasNewKey = Object.hasOwn(me[configSymbol], key),
|
551
554
|
newKey = me[configSymbol][key],
|
552
555
|
value = hasNewKey ? newKey : me['_' + key];
|
553
556
|
|
package/src/core/Base.mjs
CHANGED
package/src/grid/View.mjs
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import Component from '../component/Base.mjs';
|
2
|
+
import VDomUtil from '../util/VDom.mjs';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* @class Neo.grid.View
|
@@ -175,6 +176,33 @@ class View extends Component {
|
|
175
176
|
return this.id + '__' + record[this.store.keyProperty] + '__' + field;
|
176
177
|
}
|
177
178
|
|
179
|
+
/**
|
180
|
+
* Get the matching record by passing a row id, a cell id or an id inside a table cell.
|
181
|
+
* @param {String} nodeId
|
182
|
+
* @returns {Object|null}
|
183
|
+
*/
|
184
|
+
getRecord(nodeId) {
|
185
|
+
let me = this,
|
186
|
+
record = me.getRecordByRowId(nodeId),
|
187
|
+
node, parentNodes;
|
188
|
+
|
189
|
+
if (record) {
|
190
|
+
return record;
|
191
|
+
}
|
192
|
+
|
193
|
+
parentNodes = VDomUtil.getParentNodes(me.vdom, nodeId);
|
194
|
+
|
195
|
+
for (node of parentNodes) {
|
196
|
+
record = me.getRecordByRowId(node.id);
|
197
|
+
|
198
|
+
if (record) {
|
199
|
+
return record;
|
200
|
+
}
|
201
|
+
}
|
202
|
+
|
203
|
+
return null;
|
204
|
+
}
|
205
|
+
|
178
206
|
/**
|
179
207
|
* @param {String} rowId
|
180
208
|
* @returns {Object}
|
package/src/table/View.mjs
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import Component from '../component/Base.mjs';
|
2
|
+
import VDomUtil from '../util/VDom.mjs';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* @class Neo.table.View
|
@@ -201,6 +202,33 @@ class View extends Component {
|
|
201
202
|
return this.id + '__' + record[this.store.keyProperty] + '__' + dataField;
|
202
203
|
}
|
203
204
|
|
205
|
+
/**
|
206
|
+
* Get the matching record by passing a row id, a cell id or an id inside a table cell.
|
207
|
+
* @param {String} nodeId
|
208
|
+
* @returns {Object|null}
|
209
|
+
*/
|
210
|
+
getRecord(nodeId) {
|
211
|
+
let me = this,
|
212
|
+
record = me.getRecordByRowId(nodeId),
|
213
|
+
node, parentNodes;
|
214
|
+
|
215
|
+
if (record) {
|
216
|
+
return record;
|
217
|
+
}
|
218
|
+
|
219
|
+
parentNodes = VDomUtil.getParentNodes(me.vdom, nodeId);
|
220
|
+
|
221
|
+
for (node of parentNodes) {
|
222
|
+
record = me.getRecordByRowId(node.id);
|
223
|
+
|
224
|
+
if (record) {
|
225
|
+
return record;
|
226
|
+
}
|
227
|
+
}
|
228
|
+
|
229
|
+
return null;
|
230
|
+
}
|
231
|
+
|
204
232
|
/**
|
205
233
|
* @param {String} rowId
|
206
234
|
* @returns {Object}
|