neo.mjs 3.1.0 → 3.1.1

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.
@@ -131,6 +131,6 @@ if (programOpts.info) {
131
131
  const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
132
132
  console.log(`\nTotal time for ${programName}: ${processTime}s`);
133
133
 
134
- process.exit();
134
+ process.exit(0);
135
135
  });
136
136
  }
@@ -114,7 +114,6 @@ if (programOpts.info) {
114
114
  let themeMap, themeMapNoVars;
115
115
 
116
116
  /**
117
- *
118
117
  * @param {Object} file
119
118
  * @param {String} target
120
119
  * @param {Boolean} useCssVars
@@ -137,16 +136,13 @@ if (programOpts.info) {
137
136
  }
138
137
 
139
138
  /**
140
- *
141
139
  * @param {String} p
142
140
  * @param {String} mode development or production
143
141
  */
144
142
  function buildEnv(p, mode) {
145
143
  if (cssVars !== 'no') {
146
144
  parseScssFiles(getAllScssFiles(path.join(p, 'src')), mode, 'src', true);
147
- }
148
145
 
149
- if (cssVars !== 'no') {
150
146
  themeFolders.forEach(themeFolder => {
151
147
  if (themes === 'all' || themes === themeFolder) {
152
148
  parseScssFiles(getAllScssFiles(path.join(p, themeFolder)), mode, themeFolder, true);
@@ -164,7 +160,6 @@ if (programOpts.info) {
164
160
  }
165
161
 
166
162
  /**
167
- *
168
163
  * @param {String} dirPath
169
164
  * @returns {Object[]}
170
165
  */
@@ -179,7 +174,6 @@ if (programOpts.info) {
179
174
  }
180
175
 
181
176
  /**
182
- *
183
177
  * @param {String} dirPath
184
178
  * @param [arrayOfFiles=[]]
185
179
  * @param [relativePath='']
@@ -210,10 +204,10 @@ if (programOpts.info) {
210
204
  }
211
205
 
212
206
  arrayOfFiles.push({
213
- className : className,
214
- name : fileInfo.name,
215
- path : filePath,
216
- relativePath: relativePath
207
+ className,
208
+ name: fileInfo.name,
209
+ path: filePath,
210
+ relativePath
217
211
  });
218
212
  }
219
213
  }
@@ -223,7 +217,6 @@ if (programOpts.info) {
223
217
  }
224
218
 
225
219
  /**
226
- *
227
220
  * @param {String} filePath
228
221
  * @returns {Object}
229
222
  */
@@ -247,10 +240,9 @@ if (programOpts.info) {
247
240
  }
248
241
 
249
242
  /**
250
- *
251
243
  * @param {Array|String} names The class name string containing dots or an Array of the string parts
252
244
  * @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 self
245
+ * @param {Object} [scope] Set a different starting point as globalThis
254
246
  * @returns {Object} reference to the toplevel namespace
255
247
  */
256
248
  function ns(names, create, scope) {
@@ -263,11 +255,10 @@ if (programOpts.info) {
263
255
  if (prev) {
264
256
  return prev[current];
265
257
  }
266
- }, scope);
258
+ }, globalThis || scope);
267
259
  }
268
260
 
269
261
  /**
270
- *
271
262
  * @param {Object[]} files
272
263
  * @param {String} mode development or production
273
264
  * @param {String} target src or a theme
@@ -400,7 +391,6 @@ if (programOpts.info) {
400
391
  }
401
392
 
402
393
  /**
403
- *
404
394
  * @param {String} content
405
395
  * @param {String} baseDir
406
396
  * @returns {String}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "3.1.0",
3
+ "version": "3.1.1",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,4 +1,4 @@
1
- const Neo = self.Neo || {};
1
+ const Neo = globalThis.Neo || {};
2
2
 
3
3
  Neo.config = Neo.config || {};
4
4
 
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
@@ -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;