neo.mjs 8.1.1 → 8.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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='8.1.1'
23
+ * @member {String} version='8.1.3'
24
24
  */
25
- version: '8.1.1'
25
+ version: '8.1.3'
26
26
  }
27
27
 
28
28
  /**
@@ -16,7 +16,7 @@
16
16
  "@type": "Organization",
17
17
  "name": "Neo.mjs"
18
18
  },
19
- "datePublished": "2025-01-11",
19
+ "datePublished": "2025-01-12",
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 : 'v8.1.1'
110
+ html : 'v8.1.3'
111
111
  }]
112
112
  }],
113
113
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='8.1.1'
23
+ * @member {String} version='8.1.3'
24
24
  */
25
- version: '8.1.1'
25
+ version: '8.1.3'
26
26
  }
27
27
 
28
28
  /**
@@ -20,7 +20,7 @@ class MainContainerController extends ComponentController {
20
20
  construct(config) {
21
21
  super.construct(config);
22
22
  Neo.main.addon.HighlightJS.switchTheme('dark');
23
- Neo.main.addon.HighlightJS.loadLibrary({})
23
+ Neo.main.addon.HighlightJS.loadFiles({})
24
24
  }
25
25
 
26
26
  /**
@@ -72,7 +72,9 @@ class MainContainerController extends ComponentController {
72
72
  }
73
73
  })
74
74
 
75
- values.appName = me.component.appName;
75
+ values.appName = me.component.appName;
76
+ values.windowId = me.component.windowId;
77
+
76
78
  Neo.toast(values)
77
79
  }
78
80
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "8.1.1",
3
+ "version": "8.1.3",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -1,20 +1,23 @@
1
1
  .neo-grid-wrapper {
2
- overflow-x: auto;
3
- overflow-y: hidden;
4
- position : relative;
2
+ overflow-anchor : none;
3
+ overflow-x : auto;
4
+ overflow-y : hidden;
5
+ overscroll-behavior: none;
6
+ position : relative;
5
7
  }
6
8
 
7
9
  .neo-grid-container {
8
- border : 1px solid var(--grid-container-border-color);
9
- border-spacing: 0;
10
- color : var(--grid-container-color);
11
- font-size : 13px;
12
- font-weight : 400;
13
- height : 100%;
14
- line-height : 19px;
15
- overflow-y : hidden;
16
- position : absolute;
17
- width : 100%;
10
+ border : 1px solid var(--grid-container-border-color);
11
+ border-spacing : 0;
12
+ color : var(--grid-container-color);
13
+ font-size : 13px;
14
+ font-weight : 400;
15
+ height : 100%;
16
+ line-height : 19px;
17
+ overscroll-behavior: none;
18
+ overflow-y : hidden;
19
+ position : absolute;
20
+ width : 100%;
18
21
 
19
22
  .neo-grid-row {
20
23
  display: flex;
@@ -1,8 +1,9 @@
1
1
  .neo-grid-view-wrapper {
2
- height : 100%;
3
- overflow-x: hidden;
4
- overflow-y: auto;
5
- position : relative;
2
+ height : 100%;
3
+ overflow-anchor: none;
4
+ overflow-x : hidden;
5
+ overflow-y : auto;
6
+ position : relative;
6
7
 
7
8
  .neo-grid-scrollbar {
8
9
  height : 1px;
@@ -262,12 +262,12 @@ const DefaultConfig = {
262
262
  useVdomWorker: true,
263
263
  /**
264
264
  * buildScripts/injectPackageVersion.mjs will update this value
265
- * @default '8.1.1'
265
+ * @default '8.1.3'
266
266
  * @memberOf! module:Neo
267
267
  * @name config.version
268
268
  * @type String
269
269
  */
270
- version: '8.1.1'
270
+ version: '8.1.3'
271
271
  };
272
272
 
273
273
  Object.assign(DefaultConfig, {
@@ -1,4 +1,4 @@
1
- import Base from '../component/Base.mjs';
1
+ import Component from '../component/Base.mjs';
2
2
  import NeoArray from "../util/Array.mjs";
3
3
  import ToastManager from '../manager/Toast.mjs';
4
4
 
@@ -20,7 +20,7 @@ import ToastManager from '../manager/Toast.mjs';
20
20
  title : 'Alarm Clock' // null
21
21
  })
22
22
  */
23
- class Toast extends Base {
23
+ class Toast extends Component {
24
24
  /**
25
25
  * Valid values for positions
26
26
  * @member {String[]} positions = ['tl','tc','tr','bl','bc','br']
@@ -235,6 +235,30 @@ class GridContainer extends BaseContainer {
235
235
  }
236
236
  }
237
237
 
238
+ /**
239
+ * @param {Boolean} mounted
240
+ * @protected
241
+ */
242
+ async addResizeObserver(mounted) {
243
+ let me = this,
244
+ ResizeObserver = Neo.main?.addon?.ResizeObserver,
245
+ resizeParams = {id: me.id, windowId: me.windowId};
246
+
247
+ // Check if the remotes api is ready for slow network connections & dist/prod
248
+ if (!ResizeObserver) {
249
+ await me.timeout(100);
250
+ await me.addResizeObserver(mounted)
251
+ } else {
252
+ if (mounted) {
253
+ ResizeObserver.register(resizeParams);
254
+ await me.passSizeToView()
255
+ } else {
256
+ me.initialResizeEvent = true;
257
+ ResizeObserver.unregister(resizeParams)
258
+ }
259
+ }
260
+ }
261
+
238
262
  /**
239
263
  * Triggered after the mounted config got changed
240
264
  * @param {Boolean} value
@@ -243,18 +267,7 @@ class GridContainer extends BaseContainer {
243
267
  */
244
268
  afterSetMounted(value, oldValue) {
245
269
  super.afterSetMounted(value, oldValue);
246
-
247
- let me = this,
248
- {ResizeObserver} = Neo.main.addon,
249
- resizeParams = {id: me.id, windowId: me.windowId};
250
-
251
- if (value) {
252
- ResizeObserver.register(resizeParams);
253
- me.passSizeToView()
254
- } else if (!value && oldValue) { // unmount
255
- me.initialResizeEvent = true;
256
- ResizeObserver.unregister(resizeParams)
257
- }
270
+ oldValue !== undefined && this.addResizeObserver(value)
258
271
  }
259
272
 
260
273
  /**
@@ -614,10 +627,16 @@ class GridContainer extends BaseContainer {
614
627
  let me = this,
615
628
  [containerRect, headerRect] = await me.getDomRect([me.id, me.headerToolbarId]);
616
629
 
617
- me.view[silent ? 'setSilent' : 'set']({
618
- availableHeight: containerRect.height - headerRect.height,
619
- containerWidth : containerRect.width
620
- })
630
+ // delay for slow connections, where the container-sizing is not done yet
631
+ if (containerRect.height === headerRect.height) {
632
+ await me.timeout(100);
633
+ await me.passSizeToView(silent)
634
+ } else {
635
+ me.view[silent ? 'setSilent' : 'set']({
636
+ availableHeight: containerRect.height - headerRect.height,
637
+ containerWidth : containerRect.width
638
+ })
639
+ }
621
640
  }
622
641
 
623
642
  /**
@@ -179,14 +179,32 @@ class Toolbar extends BaseToolbar {
179
179
  * @returns {Promise<void>}
180
180
  */
181
181
  async passSizeToView(silent=false) {
182
- let me = this,
183
- rects = await me.getDomRect(me.items.map(item => item.id)),
184
- lastItem = rects[rects.length - 1];
185
-
186
- me.gridContainer.view[silent ? 'setSilent' : 'set']({
187
- availableWidth : lastItem.x + lastItem.width - rects[0].x,
188
- columnPositions: rects.map(item => ({width: item.width, x: item.x - rects[0].x}))
189
- })
182
+ let me = this,
183
+ rects = await me.getDomRect(me.items.map(item => item.id)),
184
+ lastItem = rects[rects.length - 1],
185
+ columnPositions = rects.map(item => ({width: item.width, x: item.x - rects[0].x})),
186
+ i = 1,
187
+ len = columnPositions.length,
188
+ layoutFinished = true;
189
+
190
+ // If the css sizing is not done, columns after the first one can get x = 0
191
+ for (; i < len; i++) {
192
+ if (columnPositions[i].x === 0) {
193
+ layoutFinished = false;
194
+ break;
195
+ }
196
+ }
197
+
198
+ // Delay for slow connections, where the container-sizing is not done yet
199
+ if (!layoutFinished) {
200
+ await me.timeout(100);
201
+ await me.passSizeToView(silent)
202
+ } else {
203
+ me.gridContainer.view[silent ? 'setSilent' : 'set']({
204
+ availableWidth: lastItem.x + lastItem.width - rects[0].x,
205
+ columnPositions
206
+ })
207
+ }
190
208
  }
191
209
  }
192
210
 
@@ -126,8 +126,8 @@ class HighlightJS extends Base {
126
126
  */
127
127
  switchTheme(theme) {
128
128
  let definedThemes = {
129
- dark : './resources/highlightjs-custom-dark-theme.css',
130
- light: './resources/highlightjs-custom-github-theme.css'
129
+ dark : './resources/lib/highlightjs-custom-dark-theme.css',
130
+ light: './resources/lib/highlightjs-custom-github-theme.css'
131
131
  },
132
132
  switchToTheme = definedThemes[theme];
133
133
 
@@ -282,7 +282,7 @@ class App extends Base {
282
282
  insertThemeFiles(windowId, proto, className) {
283
283
  if (Neo.config.themes.length > 0) {
284
284
  className = className || proto.className;
285
- //console.log(windowId, className);
285
+
286
286
  let me = this,
287
287
  cssMap = Neo.cssMap,
288
288
  parent = proto?.__proto__,
@@ -310,7 +310,7 @@ class App extends Base {
310
310
  }
311
311
 
312
312
  themeFolders = Neo.ns(mapClassName || className, false, cssMap.fileInfo);
313
- //console.log(cssMap);
313
+
314
314
  if (themeFolders && !Neo.ns(`${windowId}.${className}`, false, cssMap)) {
315
315
  classPath = className.split('.');
316
316
  fileName = classPath.pop();