neo.mjs 3.0.5 → 3.1.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.
Files changed (34) hide show
  1. package/README.md +0 -2
  2. package/apps/website/data/blog.json +26 -0
  3. package/buildScripts/buildAll.mjs +136 -0
  4. package/buildScripts/buildThemes.mjs +434 -0
  5. package/buildScripts/{copyFolder.js → copyFolder.mjs} +3 -5
  6. package/buildScripts/createApp.mjs +288 -0
  7. package/buildScripts/docs/{jsdocx.js → jsdocx.mjs} +31 -32
  8. package/buildScripts/webpack/buildMyApps.mjs +125 -0
  9. package/buildScripts/webpack/buildThreads.mjs +115 -0
  10. package/buildScripts/webpack/development/{webpack.config.appworker.js → webpack.config.appworker.mjs} +20 -22
  11. package/buildScripts/webpack/development/webpack.config.main.mjs +24 -0
  12. package/buildScripts/webpack/development/{webpack.config.myapps.js → webpack.config.myapps.mjs} +15 -15
  13. package/buildScripts/webpack/development/{webpack.config.worker.js → webpack.config.worker.mjs} +12 -9
  14. package/buildScripts/webpack/production/{webpack.config.appworker.js → webpack.config.appworker.mjs} +20 -22
  15. package/buildScripts/webpack/production/webpack.config.main.mjs +23 -0
  16. package/buildScripts/webpack/production/{webpack.config.myapps.js → webpack.config.myapps.mjs} +15 -15
  17. package/buildScripts/webpack/production/{webpack.config.worker.js → webpack.config.worker.mjs} +12 -9
  18. package/buildScripts/webpack/{webpack.server.config.js → webpack.server.config.mjs} +2 -2
  19. package/docs/app/view/classdetails/MembersList.mjs +7 -13
  20. package/package.json +14 -13
  21. package/src/DefaultConfig.mjs +1 -1
  22. package/src/Neo.mjs +13 -13
  23. package/src/list/plugin/Animate.mjs +59 -11
  24. package/src/main/addon/AmCharts.mjs +2 -2
  25. package/src/manager/DomEvent.mjs +1 -1
  26. package/src/worker/Base.mjs +6 -5
  27. package/buildScripts/buildAll.js +0 -148
  28. package/buildScripts/buildThemes.js +0 -442
  29. package/buildScripts/createApp.js +0 -283
  30. package/buildScripts/webpack/buildMyApps.js +0 -125
  31. package/buildScripts/webpack/buildThreads.js +0 -112
  32. package/buildScripts/webpack/development/webpack.config.main.js +0 -21
  33. package/buildScripts/webpack/index.ejs +0 -25
  34. 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
@@ -6,6 +6,16 @@ import CssUtil from '../../util/Css.mjs';
6
6
  * @extends Neo.plugin.Base
7
7
  */
8
8
  class Animate extends Base {
9
+ static getStaticConfig() {return {
10
+ /**
11
+ * Valid values for transitionEasing
12
+ * @member {String[]} transitionEasings=['ease','ease-in','ease-out','ease-in-out','linear']
13
+ * @protected
14
+ * @static
15
+ */
16
+ transitionEasings: ['ease', 'ease-in', 'ease-out', 'ease-in-out', 'linear']
17
+ }}
18
+
9
19
  static getConfig() {return {
10
20
  /**
11
21
  * @member {String} className='Neo.list.plugin.Animate'
@@ -46,6 +56,12 @@ class Animate extends Base {
46
56
  * @member {Number} transitionDuration_=500
47
57
  */
48
58
  transitionDuration_: 500,
59
+ /**
60
+ * The easing used for fadeIn, fadeOut and position changes.
61
+ * Valid values: 'ease','ease-in','ease-out','ease-in-out','linear'
62
+ * @member {String} transitionEasing_='ease-in-out'
63
+ */
64
+ transitionEasing_: 'ease-in-out',
49
65
  /**
50
66
  * The id of the setTimeout() call which gets triggered after a transition is done.
51
67
  * @member {Number|null} transitionTimeoutId=null
@@ -70,6 +86,8 @@ class Animate extends Base {
70
86
  sort : me.onStoreSort,
71
87
  scope: me
72
88
  });
89
+
90
+ this.updateTransitionDetails(false);
73
91
  }
74
92
 
75
93
  /**
@@ -85,21 +103,32 @@ class Animate extends Base {
85
103
 
86
104
  /**
87
105
  * Triggered after the transitionDuration config got changed.
88
- *
89
- * We do not want to apply the style to each list item itself,
90
- * so we are using Neo.util.Css
91
106
  * @param {Boolean} value
92
107
  * @param {Boolean} oldValue
93
108
  * @protected
94
109
  */
95
110
  afterSetTransitionDuration(value, oldValue) {
96
- Neo.isNumber(oldValue) && CssUtil.deleteRules(`#${this.owner.id} .neo-list-item`);
111
+ this.isConstructed && this.updateTransitionDetails(Neo.isNumber(oldValue));
112
+ }
97
113
 
98
- CssUtil.insertRules([
99
- `#${this.owner.id} .neo-list-item {`,
100
- `transition: opacity ${value}ms ease-in-out, transform ${value}ms ease-in-out`,
101
- '}'
102
- ].join(''));
114
+ /**
115
+ * Triggered after the transitionEasing config got changed.
116
+ * @param {Number} value
117
+ * @param {Number} oldValue
118
+ * @protected
119
+ */
120
+ afterSetTransitionEasing(value, oldValue) {
121
+ this.isConstructed && this.updateTransitionDetails(!!oldValue);
122
+ }
123
+
124
+ /**
125
+ * Triggered before the transitionEasing config gets changed
126
+ * @param {String} value
127
+ * @param {String} oldValue
128
+ * @protected
129
+ */
130
+ beforeSetTransitionEasing(value, oldValue) {
131
+ return this.beforeSetEnumValue(value, oldValue, 'transitionEasing');
103
132
  }
104
133
 
105
134
  /**
@@ -130,7 +159,6 @@ class Animate extends Base {
130
159
  }
131
160
 
132
161
  /**
133
- *
134
162
  * @param {Object} record
135
163
  * @param {Number} index
136
164
  * @returns {{x: Number, y: Number}}
@@ -147,7 +175,6 @@ class Animate extends Base {
147
175
  }
148
176
 
149
177
  /**
150
- *
151
178
  * @param {Object} obj
152
179
  * @param {String[]} map
153
180
  * @param {Boolean} intercept
@@ -345,6 +372,27 @@ class Animate extends Base {
345
372
  me.owner.createItems();
346
373
  }, me.transitionDuration);
347
374
  }
375
+
376
+ /**
377
+ * We do not want to apply the style to each list item itself,
378
+ * so we are using Neo.util.Css
379
+ * @param {Boolean} deleteRule
380
+ * @protected
381
+ */
382
+ updateTransitionDetails(deleteRule) {
383
+ let me = this,
384
+ duration = me.transitionDuration,
385
+ easing = me.transitionEasing,
386
+ id = me.owner.id;
387
+
388
+ deleteRule && CssUtil.deleteRules(`#${id} .neo-list-item`);
389
+
390
+ CssUtil.insertRules([
391
+ `#${id} .neo-list-item {`,
392
+ `transition: opacity ${duration}ms ${easing}, transform ${duration}ms ${easing}`,
393
+ '}'
394
+ ].join(''));
395
+ }
348
396
  }
349
397
 
350
398
  Neo.applyClassConfig(Animate);
@@ -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
- });