neo.mjs 9.11.0 → 9.12.0

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/ServiceWorker.mjs CHANGED
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='9.11.0'
23
+ * @member {String} version='9.12.0'
24
24
  */
25
- version: '9.11.0'
25
+ version: '9.12.0'
26
26
  }
27
27
 
28
28
  /**
@@ -16,7 +16,7 @@
16
16
  "@type": "Organization",
17
17
  "name": "Neo.mjs"
18
18
  },
19
- "datePublished": "2025-06-09",
19
+ "datePublished": "2025-06-11",
20
20
  "publisher": {
21
21
  "@type": "Organization",
22
22
  "name": "Neo.mjs"
@@ -107,7 +107,7 @@ class FooterContainer extends Container {
107
107
  }, {
108
108
  module: Component,
109
109
  cls : ['neo-version'],
110
- html : 'v9.11.0'
110
+ html : 'v9.12.0'
111
111
  }]
112
112
  }],
113
113
  /**
@@ -29,7 +29,17 @@ class ApiTreeList extends TreeList {
29
29
  */
30
30
  onConstructed() {
31
31
  super.onConstructed();
32
- this.store.load()
32
+
33
+ this.store.load().then(data => {
34
+ if (!data) {
35
+ this.html = [
36
+ '<div style="padding: 1em">',
37
+ 'To get the content please use:</br>',
38
+ '<code>npm run generate-docs-json</code>',
39
+ '</div>'
40
+ ].join('')
41
+ }
42
+ })
33
43
  }
34
44
  }
35
45
 
@@ -127,12 +127,15 @@ class MainContainer extends Viewport {
127
127
  onConstructed() {
128
128
  super.onConstructed();
129
129
 
130
- let me = this;
130
+ let me = this,
131
+ url = '../../docs/output/all.json';
131
132
 
132
- Neo.Xhr.promiseJson({
133
- url: '../../docs/output/all.json'
133
+ Neo.Xhr.promiseJson({url}).catch(err => {
134
+ console.error('Error for Neo.Xhr.request', {id: me.store.id, error: err, url})
134
135
  }).then(data => {
135
- me.store.items = data.json;
136
+ if (data) {
137
+ me.store.items = data.json
138
+ }
136
139
  })
137
140
  }
138
141
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name" : "neo.mjs",
3
- "version" : "9.11.0",
3
+ "version" : "9.12.0",
4
4
  "description" : "The webworkers driven UI framework",
5
5
  "type" : "module",
6
6
  "repository" : {
@@ -64,9 +64,9 @@
64
64
  "neo-jsdoc" : "1.0.1",
65
65
  "neo-jsdoc-x" : "1.0.5",
66
66
  "postcss" : "^8.5.4",
67
- "sass" : "^1.89.1",
67
+ "sass" : "^1.89.2",
68
68
  "siesta-lite" : "5.5.2",
69
- "terser" : "^5.41.0",
69
+ "terser" : "^5.42.0",
70
70
  "url" : "^0.11.4",
71
71
  "webpack" : "^5.99.9",
72
72
  "webpack-cli" : "^6.0.1",
@@ -264,12 +264,12 @@ const DefaultConfig = {
264
264
  useVdomWorker: true,
265
265
  /**
266
266
  * buildScripts/injectPackageVersion.mjs will update this value
267
- * @default '9.11.0'
267
+ * @default '9.12.0'
268
268
  * @memberOf! module:Neo
269
269
  * @name config.version
270
270
  * @type String
271
271
  */
272
- version: '9.11.0'
272
+ version: '9.12.0'
273
273
  };
274
274
 
275
275
  Object.assign(DefaultConfig, {
@@ -223,9 +223,8 @@ class LivePreview extends Container {
223
223
  }
224
224
 
225
225
  let me = this,
226
- {config} = Neo,
226
+ {environment} = Neo.config,
227
227
  container = me.getPreviewContainer(),
228
- hasJsModules = config.environment === 'development' || config.environment === 'dist/esm',
229
228
  source = me.editorValue || me.value,
230
229
  className = me.findLastClassName(source),
231
230
  cleanLines = [],
@@ -242,13 +241,25 @@ class LivePreview extends Container {
242
241
  path = importMatch[2],
243
242
  index;
244
243
 
245
- if (!hasJsModules) {
244
+ // We want the non-minified version for code which can not get bundled.
245
+ if (environment === 'dist/development') {
246
246
  index = path.lastIndexOf('../');
247
247
 
248
248
  if (index === 0) {
249
- path = '../../../../src/' + path.slice(index + 3);
249
+ path = '../../../../src/' + path.slice(index + 3)
250
250
  } else {
251
- path = path.slice(0, index) + '../../../' + path.slice(index + 3);
251
+ path = path.slice(0, index) + '../../../' + path.slice(index + 3)
252
+ }
253
+ }
254
+
255
+ // We want the minified version of the code which can not get bundled.
256
+ else if (environment === 'dist/production') {
257
+ index = path.lastIndexOf('../');
258
+
259
+ if (index === 0) {
260
+ path = '../../../esm/src/' + path.slice(index + 3)
261
+ } else {
262
+ path = path.slice(0, index) + '../../esm/' + path.slice(index + 3)
252
263
  }
253
264
  }
254
265
 
@@ -261,9 +272,9 @@ class LivePreview extends Container {
261
272
  });
262
273
 
263
274
  // Figure out the parts of the source we'll be running.
264
- // o The promises/import() corresponding to the user's import statements
265
- // o The vars holding the name of the imported module based on the module name for each import
266
- // o The rest of the user-provided source
275
+ // * The promises/import() corresponding to the user's import statements
276
+ // * The vars holding the name of the imported module based on the module name for each import
277
+ // * The rest of the user-provided source
267
278
  // It'll end up looking like this:
268
279
  // Promise.all([
269
280
  // import('../../../node_modules/neo.mjs/src/container/Base.mjs'),
@@ -351,9 +351,10 @@ class Store extends Base {
351
351
  * @param {String} opts.responseType
352
352
  * @param {Object} opts.scope
353
353
  * @param {String} opts.url
354
+ * @returns {Promise<Object|Object[]>}
354
355
  * @protected
355
356
  */
356
- load(opts={}) {
357
+ async load(opts={}) {
357
358
  let me = this,
358
359
  params = {page: me.currentPage, pageSize: me.pageSize, ...opts.params};
359
360
 
@@ -371,26 +372,34 @@ class Store extends Base {
371
372
  service = Neo.ns(apiArray.join('.'));
372
373
 
373
374
  if (!service) {
374
- console.log('Api is not defined', this)
375
+ console.error('Api is not defined', this)
375
376
  } else {
376
- service[fn](params).then(response => {
377
- response = Neo.ns(me.responseRoot, false, response);
378
-
379
- if (response.success) {
380
- me.totalCount = response.totalCount;
381
- me.data = Neo.ns(me.responseRoot, false, response); // fires the load event
382
- }
383
- })
377
+ const response = await service[fn](params);
378
+
379
+ if (response.success) {
380
+ me.totalCount = response.totalCount;
381
+ me.data = Neo.ns(me.responseRoot, false, response); // fires the load event
382
+
383
+ return me.data
384
+ }
385
+
386
+ return null
384
387
  }
385
388
  } else {
386
389
  opts.url ??= me.url;
387
390
 
388
- Neo.Xhr.promiseJson(opts).catch(err => {
389
- console.log('Error for Neo.Xhr.request', err, me.id)
390
- }).then(data => {
391
- me.data = Neo.ns(me.responseRoot, false, data.json) || data.json
392
- // we do not need to fire a load event => onCollectionMutate()
393
- })
391
+ try {
392
+ const data = await Neo.Xhr.promiseJson(opts);
393
+
394
+ if (data) {
395
+ me.data = Neo.ns(me.responseRoot, false, data.json) || data.json // fires the load event
396
+ }
397
+
398
+ return data?.json || null
399
+ } catch(err) {
400
+ console.error('Error for Neo.Xhr.request', {id: me.id, error: err, url: opts.url});
401
+ return null
402
+ }
394
403
  }
395
404
  }
396
405
 
package/src/tab/Strip.mjs CHANGED
@@ -57,15 +57,22 @@ class Strip extends Component {
57
57
  getActiveTabRectThenMove(opts) {
58
58
  let me = this,
59
59
  ids = [me.id],
60
- tabContainer = me.getTabContainer();
60
+ tabContainer = me.getTabContainer(),
61
+ oldTab;
61
62
 
62
63
  // We do not need a movement, in case there is no oldValue
63
64
  if (me.useActiveTabIndicator && me.vnode && Neo.isNumber(opts?.oldValue)) {
64
- ids.push(tabContainer.getTabAtIndex(opts.value).id, tabContainer.getTabAtIndex(opts.oldValue).id);
65
+ oldTab = tabContainer.getTabAtIndex(opts.oldValue);
65
66
 
66
- me.getDomRect(ids).then(data => {
67
- me.moveActiveIndicator(data)
68
- })
67
+ // The activeIndexChange event can get triggered when removing the currently active tab,
68
+ // In this case, we can no longer access the related DOMRect and need to opt out.
69
+ if (oldTab) {
70
+ ids.push(tabContainer.getTabAtIndex(opts.value).id, oldTab.id);
71
+
72
+ me.getDomRect(ids).then(data => {
73
+ me.moveActiveIndicator(data)
74
+ })
75
+ }
69
76
  }
70
77
  }
71
78