neo.mjs 4.0.60 → 4.0.63

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.
@@ -27,7 +27,7 @@ const
27
27
  * folder (parent of cwd, child of sourceRootDirs[n]) will then be used as the
28
28
  * namespace for this created class.
29
29
  * Can be overwritten with the -s option.
30
- * @type {string[]}
30
+ * @type {String[]}
31
31
  */
32
32
  sourceRootDirs = ['apps'];
33
33
 
@@ -229,6 +229,20 @@ if (programOpts.info) {
229
229
  return contentArray;
230
230
  }
231
231
 
232
+ function addConfig(contentArray, index, className, isLastConfig) {
233
+ const config = [
234
+ ' /**',
235
+ ` * @member {Neo.controller.Component} controller=${className}`,
236
+ ' */',
237
+ ` controller: ${className}`
238
+ ];
239
+
240
+ !isLastConfig && addComma(config);
241
+
242
+ contentArray.splice(index, 0, config.join(os.EOL));
243
+ return contentArray;
244
+ }
245
+
232
246
  /**
233
247
  * Adjusts the views related to controller.Component or model.Component
234
248
  * @param {Object} opts
@@ -242,7 +256,7 @@ if (programOpts.info) {
242
256
  fromMaxPosition = 0,
243
257
  i = 0,
244
258
  len = content.length,
245
- adjustSpaces, codeLine, fromPosition, importLength, importName, j, spaces;
259
+ adjustSpaces, className, codeLine, fromPosition, importLength, importName, j, nextLine, spaces;
246
260
 
247
261
  // find the index where we want to insert our import statement
248
262
  for (; i < len; i++) {
@@ -296,10 +310,45 @@ if (programOpts.info) {
296
310
  }
297
311
  }
298
312
 
299
- fs.writeFileSync(viewFile, content.join(os.EOL));
313
+ i = 0;
314
+ len = content.length;
315
+
316
+ // find the starting point
317
+ for (; i < len; i++) {
318
+ if (content[i].includes('static getConfig')) {
319
+ break;
320
+ }
321
+ }
322
+
323
+ for (; i < len; i++) {
324
+ codeLine = content[i];
325
+
326
+ if (codeLine.includes('}}')) {
327
+ addConfig(content, i, file, true);
328
+ break;
329
+ }
330
+
331
+ if (codeLine.includes('*/')) {
332
+ nextLine = content[i + 1]
333
+ className = nextLine.substring(0, nextLine.indexOf(':')).trim();
334
+
335
+ if (className === 'className' || className === 'ntype') {
336
+ continue;
337
+ }
300
338
 
301
- console.log(i, opts.file);
302
- console.log(content);
339
+ if (className > 'controller') {
340
+ for (j=i; j > 0; j--) {
341
+ if (content[j].includes('/**')) {
342
+ addConfig(content, j, file, false);
343
+ break;
344
+ }
345
+ }
346
+ break;
347
+ }
348
+ }
349
+ }
350
+
351
+ fs.writeFileSync(viewFile, content.join(os.EOL));
303
352
  }
304
353
 
305
354
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "4.0.60",
3
+ "version": "4.0.63",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -57,7 +57,7 @@
57
57
  "sass": "^1.53.0",
58
58
  "webpack": "^5.73.0",
59
59
  "webpack-cli": "^4.10.0",
60
- "webpack-dev-server": "4.9.2",
60
+ "webpack-dev-server": "4.9.3",
61
61
  "webpack-hook-plugin": "^1.0.7",
62
62
  "webpack-node-externals": "^3.0.0"
63
63
  },
@@ -98,7 +98,10 @@ const DefaultConfig = {
98
98
  /**
99
99
  * Add addons for the main thread
100
100
  * Possible values: AmCharts, AnalyticsByGoogle, DragDrop, HighlightJS, LocalStorage, MapboxGL, Markdown, Siesta, Stylesheet, WindowPosition
101
- * (src/main/addon)
101
+ * (src/main/addon) contains all framework related options.
102
+ * You can also create your own addons within your workspace scope. Make sure to put them inside 'src/main/addon/'
103
+ * and prefix them with 'WS/' inside your neo-config.json file.
104
+ * Example: ['DragDrop', 'Stylesheet', 'WS/MyAddon']
102
105
  * @default ['DragDrop','Stylesheet']
103
106
  * @memberOf! module:Neo
104
107
  * @name config.mainThreadAddons
package/src/Main.mjs CHANGED
@@ -215,7 +215,11 @@ class Main extends core.Base {
215
215
  }
216
216
 
217
217
  mainThreadAddons.forEach(addon => {
218
- imports.push(import(`./main/addon/${addon}.mjs`));
218
+ if (addon.startsWith('WS/')) {
219
+ imports.push(import(`../../../src/main/addon/${addon.substr(3)}.mjs`));
220
+ } else {
221
+ imports.push(import(`./main/addon/${addon}.mjs`));
222
+ }
219
223
  });
220
224
 
221
225
  modules = await Promise.all(imports);
@@ -112,7 +112,7 @@ class Base extends Panel {
112
112
  /**
113
113
  * @member {String} title='Dialog Title'
114
114
  */
115
- title: 'Dialog Title',
115
+ title_: 'Dialog Title',
116
116
  /**
117
117
  * @member {Object} _vdom
118
118
  */
@@ -270,6 +270,18 @@ class Base extends Panel {
270
270
  });
271
271
  }
272
272
 
273
+ /**
274
+ * Triggered after the title config got changed
275
+ * @param {String} value
276
+ * @param {String} oldValue
277
+ * @protected
278
+ */
279
+ afterSetTitle(value, oldValue) {
280
+ if (oldValue) {
281
+ this.down({flag: 'title-label'}).text = value;
282
+ }
283
+ }
284
+
273
285
  /**
274
286
  *
275
287
  */
@@ -399,6 +411,7 @@ class Base extends Panel {
399
411
  id : me.getHeaderToolbarId(),
400
412
  items: [{
401
413
  ntype: 'label',
414
+ flag : 'title-label',
402
415
  text : me.title
403
416
  }, '->', {
404
417
  iconCls: 'far fa-window-maximize',