neo.mjs 3.1.0 → 3.1.4
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/covid/Util.mjs +3 -3
- package/apps/sharedcovid/Util.mjs +3 -3
- package/apps/sharedcovid/view/MainContainerController.mjs +1 -1
- package/buildScripts/buildAll.mjs +1 -1
- package/buildScripts/buildThemes.mjs +10 -19
- package/buildScripts/docs/jsdocx.mjs +5 -5
- package/buildScripts/webpack/buildMyApps.mjs +1 -1
- package/package.json +1 -1
- package/src/DefaultConfig.mjs +1 -1
- package/src/Neo.mjs +13 -13
- package/src/core/Base.mjs +8 -6
- package/src/main/addon/AmCharts.mjs +2 -2
- package/src/manager/DomEvent.mjs +1 -1
- package/src/worker/Base.mjs +6 -5
package/apps/covid/Util.mjs
CHANGED
|
@@ -135,16 +135,16 @@ class Util extends Base {
|
|
|
135
135
|
imageName = map[imageName] || imageName;
|
|
136
136
|
|
|
137
137
|
if (Neo.config.isGitHubPages) {
|
|
138
|
-
let path =
|
|
138
|
+
let path = `../../../../resources/images/flaticon/country_flags/png/${imageName}.png`;
|
|
139
139
|
|
|
140
140
|
if (Neo.config.environment !== 'development') {
|
|
141
|
-
path =
|
|
141
|
+
path = `../../${path}`;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
return path;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
return
|
|
147
|
+
return `https://raw.githubusercontent.com/neomjs/pages/master/resources/images/flaticon/country_flags/png/${imageName}.png`;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/**
|
|
@@ -135,16 +135,16 @@ class Util extends Base {
|
|
|
135
135
|
imageName = map[imageName] || imageName;
|
|
136
136
|
|
|
137
137
|
if (Neo.config.isGitHubPages) {
|
|
138
|
-
let path =
|
|
138
|
+
let path = `../../../../resources/images/flaticon/country_flags/png/${imageName}.png`;
|
|
139
139
|
|
|
140
140
|
if (Neo.config.environment !== 'development') {
|
|
141
|
-
path =
|
|
141
|
+
path = `../../${path}`;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
144
|
return path;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
return
|
|
147
|
+
return `https://raw.githubusercontent.com/neomjs/pages/master/resources/images/flaticon/country_flags/png/${imageName}.png`;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
/**
|
|
@@ -167,7 +167,7 @@ class MainContainerController extends ComponentController {
|
|
|
167
167
|
|
|
168
168
|
Neo.Main.getWindowData().then(winData => {
|
|
169
169
|
me.component.getDomRect(me.getReference(containerReference).id).then(data => {
|
|
170
|
-
let {height, left, top, width} = data
|
|
170
|
+
let {height, left, top, width} = data;
|
|
171
171
|
|
|
172
172
|
height -= 50; // popup header in Chrome
|
|
173
173
|
left += winData.screenLeft;
|
|
@@ -9,7 +9,8 @@ import path from 'path';
|
|
|
9
9
|
import postcss from 'postcss';
|
|
10
10
|
import sass from 'sass';
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const __dirname = path.resolve(),
|
|
13
|
+
cwd = process.cwd(),
|
|
13
14
|
requireJson = path => JSON.parse(fs.readFileSync((path))),
|
|
14
15
|
packageJson = requireJson(path.resolve(cwd, 'package.json')),
|
|
15
16
|
neoPath = packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/',
|
|
@@ -114,7 +115,6 @@ if (programOpts.info) {
|
|
|
114
115
|
let themeMap, themeMapNoVars;
|
|
115
116
|
|
|
116
117
|
/**
|
|
117
|
-
*
|
|
118
118
|
* @param {Object} file
|
|
119
119
|
* @param {String} target
|
|
120
120
|
* @param {Boolean} useCssVars
|
|
@@ -137,16 +137,13 @@ if (programOpts.info) {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
|
-
*
|
|
141
140
|
* @param {String} p
|
|
142
141
|
* @param {String} mode development or production
|
|
143
142
|
*/
|
|
144
143
|
function buildEnv(p, mode) {
|
|
145
144
|
if (cssVars !== 'no') {
|
|
146
145
|
parseScssFiles(getAllScssFiles(path.join(p, 'src')), mode, 'src', true);
|
|
147
|
-
}
|
|
148
146
|
|
|
149
|
-
if (cssVars !== 'no') {
|
|
150
147
|
themeFolders.forEach(themeFolder => {
|
|
151
148
|
if (themes === 'all' || themes === themeFolder) {
|
|
152
149
|
parseScssFiles(getAllScssFiles(path.join(p, themeFolder)), mode, themeFolder, true);
|
|
@@ -164,7 +161,6 @@ if (programOpts.info) {
|
|
|
164
161
|
}
|
|
165
162
|
|
|
166
163
|
/**
|
|
167
|
-
*
|
|
168
164
|
* @param {String} dirPath
|
|
169
165
|
* @returns {Object[]}
|
|
170
166
|
*/
|
|
@@ -179,7 +175,6 @@ if (programOpts.info) {
|
|
|
179
175
|
}
|
|
180
176
|
|
|
181
177
|
/**
|
|
182
|
-
*
|
|
183
178
|
* @param {String} dirPath
|
|
184
179
|
* @param [arrayOfFiles=[]]
|
|
185
180
|
* @param [relativePath='']
|
|
@@ -210,10 +205,10 @@ if (programOpts.info) {
|
|
|
210
205
|
}
|
|
211
206
|
|
|
212
207
|
arrayOfFiles.push({
|
|
213
|
-
className
|
|
214
|
-
name
|
|
215
|
-
path
|
|
216
|
-
relativePath
|
|
208
|
+
className,
|
|
209
|
+
name: fileInfo.name,
|
|
210
|
+
path: filePath,
|
|
211
|
+
relativePath
|
|
217
212
|
});
|
|
218
213
|
}
|
|
219
214
|
}
|
|
@@ -223,7 +218,6 @@ if (programOpts.info) {
|
|
|
223
218
|
}
|
|
224
219
|
|
|
225
220
|
/**
|
|
226
|
-
*
|
|
227
221
|
* @param {String} filePath
|
|
228
222
|
* @returns {Object}
|
|
229
223
|
*/
|
|
@@ -247,10 +241,9 @@ if (programOpts.info) {
|
|
|
247
241
|
}
|
|
248
242
|
|
|
249
243
|
/**
|
|
250
|
-
*
|
|
251
244
|
* @param {Array|String} names The class name string containing dots or an Array of the string parts
|
|
252
245
|
* @param {Boolean} [create] Set create to true to create empty objects for non existing parts
|
|
253
|
-
* @param {Object} [scope] Set a different starting point as
|
|
246
|
+
* @param {Object} [scope] Set a different starting point as globalThis
|
|
254
247
|
* @returns {Object} reference to the toplevel namespace
|
|
255
248
|
*/
|
|
256
249
|
function ns(names, create, scope) {
|
|
@@ -263,11 +256,10 @@ if (programOpts.info) {
|
|
|
263
256
|
if (prev) {
|
|
264
257
|
return prev[current];
|
|
265
258
|
}
|
|
266
|
-
}, scope);
|
|
259
|
+
}, scope || globalThis);
|
|
267
260
|
}
|
|
268
261
|
|
|
269
262
|
/**
|
|
270
|
-
*
|
|
271
263
|
* @param {Object[]} files
|
|
272
264
|
* @param {String} mode development or production
|
|
273
265
|
* @param {String} target src or a theme
|
|
@@ -400,7 +392,6 @@ if (programOpts.info) {
|
|
|
400
392
|
}
|
|
401
393
|
|
|
402
394
|
/**
|
|
403
|
-
*
|
|
404
395
|
* @param {String} content
|
|
405
396
|
* @param {String} baseDir
|
|
406
397
|
* @returns {String}
|
|
@@ -432,13 +423,13 @@ if (programOpts.info) {
|
|
|
432
423
|
// dist/development
|
|
433
424
|
if (env === 'all' || env === 'dev') {
|
|
434
425
|
console.log(chalk.blue(`${programName} starting dist/development`));
|
|
435
|
-
buildEnv(
|
|
426
|
+
buildEnv(scssPath, 'development');
|
|
436
427
|
}
|
|
437
428
|
|
|
438
429
|
// dist/production
|
|
439
430
|
if (env === 'all' || env === 'prod') {
|
|
440
431
|
console.log(chalk.blue(`${programName} starting dist/production`));
|
|
441
|
-
buildEnv(
|
|
432
|
+
buildEnv(scssPath, 'production');
|
|
442
433
|
}
|
|
443
434
|
});
|
|
444
435
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import fs
|
|
2
|
-
import helper
|
|
3
|
-
import jsdocx
|
|
4
|
-
import path
|
|
1
|
+
import fs from 'fs-extra';
|
|
2
|
+
import helper from 'neo-jsdoc-x/src/lib/helper.js';
|
|
3
|
+
import jsdocx from 'neo-jsdoc-x';
|
|
4
|
+
import path from 'path';
|
|
5
5
|
|
|
6
6
|
const __dirname = path.resolve(),
|
|
7
7
|
cwd = process.cwd(),
|
|
@@ -51,7 +51,7 @@ function ns(names, create) {
|
|
|
51
51
|
if (prev) {
|
|
52
52
|
return prev[current];
|
|
53
53
|
}
|
|
54
|
-
},
|
|
54
|
+
}, globalThis);
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
const neoStructure = [{
|
|
@@ -7,7 +7,7 @@ import inquirer from 'inquirer';
|
|
|
7
7
|
import os from 'os';
|
|
8
8
|
import path from 'path';
|
|
9
9
|
|
|
10
|
-
const __dirname
|
|
10
|
+
const __dirname = path.resolve(),
|
|
11
11
|
cwd = process.cwd(),
|
|
12
12
|
cpOpts = {env: process.env, cwd: cwd, stdio: 'inherit', shell: true},
|
|
13
13
|
requireJson = path => JSON.parse(fs.readFileSync((path))),
|
package/package.json
CHANGED
package/src/DefaultConfig.mjs
CHANGED
package/src/Neo.mjs
CHANGED
|
@@ -22,9 +22,9 @@ const configSymbol = Symbol.for('configSymbol'),
|
|
|
22
22
|
* @borrows Neo.core.Util.toArray as toArray
|
|
23
23
|
* @tutorial 01_Concept
|
|
24
24
|
*/
|
|
25
|
-
let Neo =
|
|
25
|
+
let Neo = globalThis.Neo || {};
|
|
26
26
|
|
|
27
|
-
Neo =
|
|
27
|
+
Neo = globalThis.Neo = Object.assign({
|
|
28
28
|
/**
|
|
29
29
|
* A map containing ntypes as key and Neo classes or singletons as values
|
|
30
30
|
* @memberOf! module:Neo
|
|
@@ -90,7 +90,7 @@ Neo = self.Neo = Object.assign({
|
|
|
90
90
|
else if (!Neo.hasPropertySetter(element, key)) {
|
|
91
91
|
Object.defineProperty(element, key, {
|
|
92
92
|
enumerable: true,
|
|
93
|
-
value
|
|
93
|
+
value,
|
|
94
94
|
writable : true
|
|
95
95
|
});
|
|
96
96
|
}
|
|
@@ -343,6 +343,9 @@ Neo = self.Neo = Object.assign({
|
|
|
343
343
|
return instance;
|
|
344
344
|
},
|
|
345
345
|
|
|
346
|
+
/**
|
|
347
|
+
*
|
|
348
|
+
*/
|
|
346
349
|
emptyFn() {},
|
|
347
350
|
|
|
348
351
|
/**
|
|
@@ -397,15 +400,15 @@ Neo = self.Neo = Object.assign({
|
|
|
397
400
|
* @example
|
|
398
401
|
* Neo.ns('Neo.button.Base', true);
|
|
399
402
|
* // =>
|
|
400
|
-
* //
|
|
401
|
-
* //
|
|
402
|
-
* //
|
|
403
|
-
* // return
|
|
403
|
+
* // globalThis.Neo = globalThis.Neo || {};
|
|
404
|
+
* // globalThis.Neo.button = globalThis.Neo.button || {};
|
|
405
|
+
* // globalThis.Neo.button.Base = globalThis.Neo.button.Base || {};
|
|
406
|
+
* // return globalThis.Neo.button.Base;
|
|
404
407
|
*
|
|
405
408
|
* @memberOf module:Neo
|
|
406
409
|
* @param {Array|String} names The class name string containing dots or an Array of the string parts
|
|
407
410
|
* @param {Boolean} [create] Set create to true to create empty objects for non existing parts
|
|
408
|
-
* @param {Object} [scope] Set a different starting point as
|
|
411
|
+
* @param {Object} [scope] Set a different starting point as globalThis
|
|
409
412
|
* @returns {Object} reference to the toplevel namespace
|
|
410
413
|
*/
|
|
411
414
|
ns(names, create, scope) {
|
|
@@ -418,7 +421,7 @@ Neo = self.Neo = Object.assign({
|
|
|
418
421
|
if (prev) {
|
|
419
422
|
return prev[current];
|
|
420
423
|
}
|
|
421
|
-
}, scope ||
|
|
424
|
+
}, scope || globalThis);
|
|
422
425
|
},
|
|
423
426
|
|
|
424
427
|
/**
|
|
@@ -504,7 +507,6 @@ const ignoreMixin = [
|
|
|
504
507
|
];
|
|
505
508
|
|
|
506
509
|
/**
|
|
507
|
-
*
|
|
508
510
|
* @param {Neo.core.Base} cls
|
|
509
511
|
* @param {Array} mixins
|
|
510
512
|
* @private
|
|
@@ -639,14 +641,13 @@ function exists(className) {
|
|
|
639
641
|
try {
|
|
640
642
|
return !!className.split('.').reduce((prev, current) => {
|
|
641
643
|
return prev[current];
|
|
642
|
-
},
|
|
644
|
+
}, globalThis);
|
|
643
645
|
} catch(e) {
|
|
644
646
|
return false;
|
|
645
647
|
}
|
|
646
648
|
}
|
|
647
649
|
|
|
648
650
|
/**
|
|
649
|
-
*
|
|
650
651
|
* @param {Neo.core.Base} proto
|
|
651
652
|
* @param {Neo.core.Base} mixinProto
|
|
652
653
|
* @returns {Function}
|
|
@@ -678,7 +679,6 @@ function mixinProperty(proto, mixinProto) {
|
|
|
678
679
|
}
|
|
679
680
|
|
|
680
681
|
/**
|
|
681
|
-
*
|
|
682
682
|
* @param mixinCls
|
|
683
683
|
* @returns {Function}
|
|
684
684
|
* @private
|
package/src/core/Base.mjs
CHANGED
|
@@ -121,17 +121,18 @@ class Base {
|
|
|
121
121
|
* @protected
|
|
122
122
|
*/
|
|
123
123
|
afterSetId(value, oldValue) {
|
|
124
|
-
let me
|
|
124
|
+
let me = this,
|
|
125
|
+
hasManager = Base.instanceManagerAvailable === true;
|
|
125
126
|
|
|
126
127
|
if (oldValue) {
|
|
127
|
-
if (
|
|
128
|
+
if (hasManager) {
|
|
128
129
|
Neo.manager.Instance.unregister(oldValue);
|
|
129
130
|
} else {
|
|
130
131
|
delete Neo.idMap[oldValue];
|
|
131
132
|
}
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
if (
|
|
135
|
+
if (hasManager) {
|
|
135
136
|
Neo.manager.Instance.register(me);
|
|
136
137
|
} else {
|
|
137
138
|
Neo.idMap = Neo.idMap || {};
|
|
@@ -400,11 +401,12 @@ class Base {
|
|
|
400
401
|
* @returns {Object}
|
|
401
402
|
*/
|
|
402
403
|
setFields(config) {
|
|
403
|
-
let
|
|
404
|
+
let me = this,
|
|
405
|
+
configNames = me.constructor.config;
|
|
404
406
|
|
|
405
407
|
Object.entries(config).forEach(([key, value]) => {
|
|
406
|
-
if (!configNames.hasOwnProperty(key) && !Neo.hasPropertySetter(
|
|
407
|
-
|
|
408
|
+
if (!configNames.hasOwnProperty(key) && !Neo.hasPropertySetter(me, key)) {
|
|
409
|
+
me[key] = value;
|
|
408
410
|
delete config[key];
|
|
409
411
|
}
|
|
410
412
|
});
|
|
@@ -158,9 +158,9 @@ class AmCharts extends Base {
|
|
|
158
158
|
if (!me.scriptsLoaded) {
|
|
159
159
|
me.chartsToCreate.push(data);
|
|
160
160
|
} else {
|
|
161
|
-
// todo: check if
|
|
161
|
+
// todo: check if globalThis[data.package] exists, if not load it and call create afterwards
|
|
162
162
|
|
|
163
|
-
me.charts[data.id] = am4core.createFromConfig(data.config, data.id,
|
|
163
|
+
me.charts[data.id] = am4core.createFromConfig(data.config, data.id, globalThis[data.package][data.type || 'XYChart']);
|
|
164
164
|
|
|
165
165
|
if (data.combineSeriesTooltip) {
|
|
166
166
|
me.combineSeriesTooltip(me.charts[data.id]);
|
package/src/manager/DomEvent.mjs
CHANGED
|
@@ -107,7 +107,7 @@ class DomEvent extends Base {
|
|
|
107
107
|
if (!preventFire) {
|
|
108
108
|
// console.log(Neo.get(id));
|
|
109
109
|
data.component = component;
|
|
110
|
-
listener.fn.apply(listener.scope ||
|
|
110
|
+
listener.fn.apply(listener.scope || globalThis, [data]);
|
|
111
111
|
|
|
112
112
|
if (!listener.bubble) {
|
|
113
113
|
bubble = false;
|
package/src/worker/Base.mjs
CHANGED
|
@@ -55,19 +55,20 @@ class Base extends CoreBase {
|
|
|
55
55
|
construct(config) {
|
|
56
56
|
super.construct(config);
|
|
57
57
|
|
|
58
|
-
let me = this
|
|
58
|
+
let me = this,
|
|
59
|
+
gt = globalThis;
|
|
59
60
|
|
|
60
61
|
Object.assign(me, {
|
|
61
62
|
channelPorts : {},
|
|
62
|
-
isSharedWorker:
|
|
63
|
+
isSharedWorker: gt.toString() === '[object SharedWorkerGlobalScope]',
|
|
63
64
|
ports : [],
|
|
64
65
|
promises : {}
|
|
65
66
|
});
|
|
66
67
|
|
|
67
68
|
if (me.isSharedWorker) {
|
|
68
|
-
|
|
69
|
+
gt.onconnect = me.onConnected.bind(me);
|
|
69
70
|
} else {
|
|
70
|
-
|
|
71
|
+
gt.onmessage = me.onMessage.bind(me);
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
Neo.workerId = me.workerId;
|
|
@@ -251,7 +252,7 @@ class Base extends CoreBase {
|
|
|
251
252
|
if (me.channelPorts[dest]) {
|
|
252
253
|
port = me.channelPorts[dest];
|
|
253
254
|
} else if (!me.isSharedWorker) {
|
|
254
|
-
port =
|
|
255
|
+
port = globalThis;
|
|
255
256
|
} else {
|
|
256
257
|
if (opts.port) {
|
|
257
258
|
port = me.getPort({id: opts.port}).port;
|