neo.mjs 3.0.6 → 3.1.3

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.
Files changed (37) hide show
  1. package/README.md +0 -2
  2. package/apps/covid/Util.mjs +3 -3
  3. package/apps/sharedcovid/Util.mjs +3 -3
  4. package/apps/sharedcovid/view/MainContainerController.mjs +1 -1
  5. package/apps/website/data/blog.json +26 -0
  6. package/buildScripts/buildAll.mjs +137 -0
  7. package/buildScripts/buildThemes.mjs +436 -0
  8. package/buildScripts/{copyFolder.js → copyFolder.mjs} +3 -5
  9. package/buildScripts/createApp.mjs +289 -0
  10. package/buildScripts/docs/{jsdocx.js → jsdocx.mjs} +32 -32
  11. package/buildScripts/webpack/buildMyApps.mjs +126 -0
  12. package/buildScripts/webpack/buildThreads.mjs +116 -0
  13. package/buildScripts/webpack/development/{webpack.config.appworker.js → webpack.config.appworker.mjs} +20 -22
  14. package/buildScripts/webpack/development/webpack.config.main.mjs +24 -0
  15. package/buildScripts/webpack/development/{webpack.config.myapps.js → webpack.config.myapps.mjs} +15 -15
  16. package/buildScripts/webpack/development/{webpack.config.worker.js → webpack.config.worker.mjs} +12 -9
  17. package/buildScripts/webpack/production/{webpack.config.appworker.js → webpack.config.appworker.mjs} +20 -22
  18. package/buildScripts/webpack/production/webpack.config.main.mjs +23 -0
  19. package/buildScripts/webpack/production/{webpack.config.myapps.js → webpack.config.myapps.mjs} +15 -15
  20. package/buildScripts/webpack/production/{webpack.config.worker.js → webpack.config.worker.mjs} +12 -9
  21. package/buildScripts/webpack/{webpack.server.config.js → webpack.server.config.mjs} +2 -2
  22. package/docs/app/view/classdetails/MembersList.mjs +7 -13
  23. package/package.json +14 -13
  24. package/src/DefaultConfig.mjs +1 -1
  25. package/src/Neo.mjs +13 -13
  26. package/src/core/Base.mjs +8 -6
  27. package/src/main/addon/AmCharts.mjs +2 -2
  28. package/src/manager/DomEvent.mjs +1 -1
  29. package/src/worker/Base.mjs +6 -5
  30. package/buildScripts/buildAll.js +0 -148
  31. package/buildScripts/buildThemes.js +0 -442
  32. package/buildScripts/createApp.js +0 -283
  33. package/buildScripts/webpack/buildMyApps.js +0 -125
  34. package/buildScripts/webpack/buildThreads.js +0 -112
  35. package/buildScripts/webpack/development/webpack.config.main.js +0 -21
  36. package/buildScripts/webpack/index.ejs +0 -25
  37. package/buildScripts/webpack/production/webpack.config.main.js +0 -20
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 = self.Neo || {};
25
+ let Neo = globalThis.Neo || {};
26
26
 
27
- Neo = self.Neo = Object.assign({
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 : 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
- * // self.Neo = self.Neo || {};
401
- * // self.Neo.component = self.Neo.component || {};
402
- * // self.Neo.button.Base = self.Neo.button.Base || {};
403
- * // return self.Neo.button.Base;
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 self
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 || self);
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
- }, self);
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 = this;
124
+ let me = this,
125
+ hasManager = Base.instanceManagerAvailable === true;
125
126
 
126
127
  if (oldValue) {
127
- if (Base.instanceManagerAvailable === true) {
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 (Base.instanceManagerAvailable === true) {
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 configNames = this.constructor.config;
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(this, key)) {
407
- this[key] = value;
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 self[data.package] exists, if not load it and call create afterwards
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, self[data.package][data.type || 'XYChart']);
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]);
@@ -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 || self, [data]);
110
+ listener.fn.apply(listener.scope || globalThis, [data]);
111
111
 
112
112
  if (!listener.bubble) {
113
113
  bubble = false;
@@ -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: self.toString() === '[object SharedWorkerGlobalScope]',
63
+ isSharedWorker: gt.toString() === '[object SharedWorkerGlobalScope]',
63
64
  ports : [],
64
65
  promises : {}
65
66
  });
66
67
 
67
68
  if (me.isSharedWorker) {
68
- self.onconnect = me.onConnected.bind(me);
69
+ gt.onconnect = me.onConnected.bind(me);
69
70
  } else {
70
- self.onmessage = me.onMessage.bind(me);
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 = self;
255
+ port = globalThis;
255
256
  } else {
256
257
  if (opts.port) {
257
258
  port = me.getPort({id: opts.port}).port;
@@ -1,148 +0,0 @@
1
- 'use strict';
2
-
3
- const chalk = require('chalk'),
4
- { program } = require('commander'),
5
- cp = require('child_process'),
6
- cwd = process.cwd(),
7
- cpOpts = {env: process.env, cwd: cwd, stdio: 'inherit', shell: true},
8
- envinfo = require('envinfo'),
9
- inquirer = require('inquirer'),
10
- os = require('os'),
11
- npmCmd = os.platform().startsWith('win') ? 'npm.cmd' : 'npm', // npm binary based on OS
12
- path = require('path'),
13
- packageJson = require(path.resolve(cwd, 'package.json')),
14
- neoPath = path.resolve(packageJson.name === 'neo.mjs' ? './' : './node_modules/neo.mjs/'),
15
- webpackPath = path.resolve(neoPath, 'buildScripts/webpack'),
16
- programName = `${packageJson.name} buildAll`,
17
- questions = [];
18
-
19
- program
20
- .name(programName)
21
- .version(packageJson.version)
22
- .option('-i, --info', 'print environment debug info')
23
- .option('-e, --env <value>', '"all", "dev", "prod"')
24
- .option('-l, --npminstall <value>', '"yes", "no"')
25
- .option('-f, --framework')
26
- .option('-n, --noquestions')
27
- .option('-p, --parsedocs <value>', '"yes", "no"')
28
- .option('-t, --themes <value>', '"yes", "no"')
29
- .option('-w, --threads <value>', '"yes", "no"')
30
- .allowUnknownOption()
31
- .on('--help', () => {
32
- console.log('\nIn case you have any issues, please create a ticket here:');
33
- console.log(chalk.cyan(packageJson.bugs.url));
34
- })
35
- .parse(process.argv);
36
-
37
- const programOpts = program.opts();
38
-
39
- if (programOpts.info) {
40
- console.log(chalk.bold('\nEnvironment Info:'));
41
- console.log(`\n current version of ${packageJson.name}: ${packageJson.version}`);
42
- console.log(` running from ${__dirname}`);
43
- return envinfo
44
- .run({
45
- System : ['OS', 'CPU'],
46
- Binaries : ['Node', 'npm', 'Yarn'],
47
- Browsers : ['Chrome', 'Edge', 'Firefox', 'Safari'],
48
- npmPackages: ['neo.mjs']
49
- }, {
50
- duplicates : true,
51
- showNotFound: true
52
- })
53
- .then(console.log);
54
- }
55
-
56
- console.log(chalk.green(programName));
57
-
58
- if (!programOpts.noquestions) {
59
- if (!programOpts.npminstall) {
60
- questions.push({
61
- type : 'list',
62
- name : 'npminstall',
63
- message: 'Run npm install?:',
64
- choices: ['yes', 'no'],
65
- default: 'all'
66
- });
67
- }
68
-
69
- if (!programOpts.env) {
70
- questions.push({
71
- type : 'list',
72
- name : 'env',
73
- message: 'Please choose the environment:',
74
- choices: ['all', 'dev', 'prod'],
75
- default: 'all'
76
- });
77
- }
78
-
79
- if (!programOpts.npminstall) {
80
- questions.push({
81
- type : 'list',
82
- name : 'themes',
83
- message: 'Build the themes?',
84
- choices: ['yes', 'no'],
85
- default: 'yes'
86
- });
87
- }
88
-
89
- if (!programOpts.threads) {
90
- questions.push({
91
- type : 'list',
92
- name : 'threads',
93
- message: 'Build the threads?',
94
- choices: ['yes', 'no'],
95
- default: 'yes'
96
- });
97
- }
98
-
99
- if (!programOpts.parsedocs) {
100
- questions.push({
101
- type : 'list',
102
- name : 'parsedocs',
103
- message: 'Trigger the jsdocx parsing?',
104
- choices: ['yes', 'no'],
105
- default: 'yes'
106
- });
107
- }
108
- }
109
-
110
- inquirer.prompt(questions).then(answers => {
111
- const env = answers.env || programOpts.env || 'all',
112
- npminstall = answers.npminstall || programOpts.npminstall || 'yes',
113
- parsedocs = answers.parsedocs || programOpts.parsedocs || 'yes',
114
- themes = answers.themes || programOpts.themes || 'yes',
115
- threads = answers.threads || programOpts.threads || 'yes',
116
- insideNeo = !!programOpts.framework || false,
117
- cpArgs = ['-e', env],
118
- startDate = new Date();
119
-
120
- if (programOpts.noquestions) {
121
- cpArgs.push('-n');
122
- }
123
-
124
- if (insideNeo) {
125
- cpArgs.push('-f');
126
- }
127
-
128
- if (npminstall === 'yes') {
129
- cp.spawnSync(npmCmd, ['i'], cpOpts);
130
- }
131
-
132
- if (themes === 'yes') {
133
- cp.spawnSync('node', [`${neoPath}/buildScripts/buildThemes.js`].concat(cpArgs), cpOpts);
134
- }
135
-
136
- if (threads === 'yes') {
137
- cp.spawnSync('node', [`${webpackPath}/buildThreads.js`].concat(cpArgs), cpOpts);
138
- }
139
-
140
- if (parsedocs === 'yes') {
141
- cp.spawnSync(npmCmd, ['run', 'generate-docs-json'], cpOpts);
142
- }
143
-
144
- const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
145
- console.log(`\nTotal time for ${programName}: ${processTime}s`);
146
-
147
- process.exit();
148
- });