neo.mjs 6.17.0 → 6.17.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 (37) hide show
  1. package/apps/ServiceWorker.mjs +2 -2
  2. package/apps/portal/view/HeaderToolbar.mjs +44 -27
  3. package/apps/portal/view/Viewport.mjs +12 -1
  4. package/apps/portal/view/home/MainContainer.mjs +28 -60
  5. package/apps/portal/view/home/parts/AfterMath.mjs +58 -0
  6. package/apps/portal/view/home/parts/CoolStuff.mjs +82 -0
  7. package/apps/portal/view/home/parts/Features.mjs +52 -0
  8. package/apps/portal/view/home/parts/HelloWorld.mjs +82 -0
  9. package/apps/portal/view/home/parts/MainNeo.mjs +55 -0
  10. package/apps/portal/view/home/preview/PageCodeContainer.mjs +55 -0
  11. package/apps/portal/view/learn/LivePreview.mjs +16 -14
  12. package/apps/website/data/docs.json +2 -2
  13. package/apps/website/view/blog/List.mjs +28 -30
  14. package/apps/website/view/examples/List.mjs +15 -17
  15. package/buildScripts/webpack/webpack.server.config.mjs +4 -1
  16. package/docs/app/view/classdetails/MembersList.mjs +4 -0
  17. package/examples/ServiceWorker.mjs +2 -2
  18. package/package.json +4 -4
  19. package/resources/images/Neo_Logo_Blue.svg +6 -0
  20. package/resources/images/Neo_Logo_Text.svg +5 -0
  21. package/resources/images/Neo_Logo_White.svg +6 -0
  22. package/resources/scss/src/apps/portal/HeaderToolbar.scss +189 -17
  23. package/resources/scss/src/apps/portal/home/MainContainer.scss +46 -20
  24. package/resources/scss/src/apps/portal/home/parts/Features.scss +3 -0
  25. package/resources/scss/src/apps/portal/home/preview/PageCodeContainer.scss +115 -0
  26. package/resources/scss/src/component/Base.scss +2 -0
  27. package/src/DefaultConfig.mjs +2 -2
  28. package/src/component/Base.mjs +139 -71
  29. package/src/component/wrapper/MonacoEditor.mjs +1 -6
  30. package/src/container/Base.mjs +5 -5
  31. package/src/container/Viewport.mjs +30 -1
  32. package/src/manager/DomEvent.mjs +11 -6
  33. package/src/plugin/Responsive.mjs +175 -0
  34. package/src/util/Logger.mjs +3 -3
  35. package/resources/images/Neo_Vector.svg +0 -3
  36. package/resources/images/logos/Github-logo-black.svg +0 -1
  37. package/resources/images/logos/Slack-logo-black.svg +0 -17
@@ -0,0 +1,115 @@
1
+ .page-code-container {
2
+ position: relative;
3
+ padding: 20px;
4
+
5
+ &::before {
6
+ position:absolute;
7
+ inset: 0;
8
+ opacity: .4;
9
+ content: "";
10
+ background: {
11
+ image : url("../../../../../../../../resources/images/Neo_Logo_Blue.svg");
12
+ size: auto 90%;
13
+ repeat: no-repeat;
14
+ position: center;
15
+ }
16
+ }
17
+
18
+ .live-preview {
19
+ opacity: 0.9;
20
+
21
+ .live-preview-container {
22
+ & > .neo-tab-header-toolbar {
23
+ background: var(--sem-color-surface-primary-background);
24
+ border-radius: 15px 15px 0 0;
25
+ padding-right: 10px;
26
+ padding-left: 14px;
27
+
28
+ .neo-button-text {
29
+ color: slategrey!important;
30
+ }
31
+
32
+ .pressed {
33
+ border-bottom-right-radius: 0;
34
+ border-bottom-left-radius: 0;
35
+
36
+ .neo-button-text {
37
+ color: darkslategrey !important;
38
+ }
39
+
40
+ .neo-tab-button-indicator {
41
+ background-color: darkslategrey;
42
+ }
43
+ }
44
+
45
+ }
46
+
47
+ & > .neo-tab-content-container {
48
+ .monaco-editor {
49
+ .margin, .sticky-widget-line-numbers, .active-line-number {
50
+ background: #263238;
51
+ color: #cdd3de;
52
+ }
53
+
54
+ .monaco-editor-background, .sticky-widget-lines-scrollable {
55
+ background: #1B2225;
56
+ color: #cdd3de;
57
+
58
+ // keys
59
+ .mtk1 {
60
+ color: #CDFF8E;
61
+ }
62
+
63
+ // class, extends, static
64
+ .mtk6 {
65
+ color: #8EDCF5;
66
+ }
67
+
68
+ // numbers
69
+ .mtk7 {
70
+ color: #D6FF00
71
+ }
72
+
73
+ // Comment
74
+ .mtk8 {
75
+ color: #98A8B5;
76
+ }
77
+
78
+ // strings
79
+ .mtk20 {
80
+ color: #D6FF00
81
+ }
82
+
83
+ // Classname: MainView, Container
84
+ .mtk22 {
85
+ color: #cccccc;
86
+ }
87
+
88
+ /**
89
+ * Cursor
90
+ * not used
91
+ * - .monaco-mouse-cursor-text
92
+ * - .cursors-layer
93
+ * - .cursor-line-style
94
+ */
95
+ .cursor,
96
+ .cursor-solid {
97
+ background-color: #ffffff;
98
+ }
99
+
100
+ // not in use
101
+ .important {
102
+ color: #FFA9A9;
103
+ font-style: italic;
104
+ }
105
+
106
+ // not in use
107
+ .id {
108
+ color: #F3A5F7;
109
+ }
110
+ }
111
+ }
112
+ }
113
+ }
114
+ }
115
+ }
@@ -1,3 +1,5 @@
1
+ .neo-scrollable {}
2
+
1
3
  // Shadow at the bottom
2
4
  .neo-aligned-bottom {
3
5
  box-shadow: var(--aligned-bottom-box-shadow);
@@ -260,12 +260,12 @@ const DefaultConfig = {
260
260
  useVdomWorker: true,
261
261
  /**
262
262
  * buildScripts/injectPackageVersion.mjs will update this value
263
- * @default '6.15.11'
263
+ * @default '6.17.2'
264
264
  * @memberOf! module:Neo
265
265
  * @name config.version
266
266
  * @type String
267
267
  */
268
- version: '6.15.11'
268
+ version: '6.17.2'
269
269
  };
270
270
 
271
271
  Object.assign(DefaultConfig, {
@@ -52,8 +52,8 @@ class Base extends CoreBase {
52
52
  * @member {Object|String} align_={edgeAlign:'t-b',constrainTo:'document.body'}
53
53
  */
54
54
  align_: {
55
- edgeAlign : 't-b',
56
- constrainTo : 'document.body'
55
+ edgeAlign : 't-b',
56
+ constrainTo: 'document.body'
57
57
  },
58
58
  /**
59
59
  * The name of the App this component belongs to
@@ -288,6 +288,13 @@ class Base extends CoreBase {
288
288
  * @protected
289
289
  */
290
290
  reference_: null,
291
+ /**
292
+ * Make the view Responsive by adding alternative configs.
293
+ * The definition happens via responsiveCfg
294
+ * @member {Object} responsive=null
295
+ * @protected
296
+ */
297
+ responsive_: null,
291
298
  /**
292
299
  * True in case the component is rendering the vnode
293
300
  * @member {Boolean} rendering_=false
@@ -300,6 +307,13 @@ class Base extends CoreBase {
300
307
  * @member {String|null} role_=null
301
308
  */
302
309
  role_: null,
310
+ /**
311
+ * Set this to true for style 'overflow:auto'.
312
+ * Set this to 'x' or 'y' to add style 'overflow-x' or 'overflow-y' to 'auto'
313
+ * Other than false this will add cls 'neo-scrollable'.
314
+ * @member {Boolean|"x"|"y"} scrollable_=false
315
+ */
316
+ scrollable_: false,
303
317
  /**
304
318
  * Set this to true for bulk updates. Ensure to set it back to false afterwards.
305
319
  * Internally the value will get saved as a number to ensure that child methods won't stop the silent mode too early.
@@ -694,8 +708,8 @@ class Base extends CoreBase {
694
708
  */
695
709
  afterSetIsLoading(value, oldValue) {
696
710
  if (!(value === false && oldValue === undefined)) {
697
- let me = this,
698
- { cls, vdom } = me,
711
+ let me = this,
712
+ {cls, vdom} = me,
699
713
  maskIndex;
700
714
 
701
715
  if (oldValue !== undefined && vdom.cn) {
@@ -780,7 +794,8 @@ class Base extends CoreBase {
780
794
  */
781
795
  afterSetMounted(value, oldValue) {
782
796
  if (oldValue !== undefined) {
783
- let me = this;
797
+ let me = this,
798
+ {id, windowId} = me;
784
799
 
785
800
  if (value) {
786
801
  me.hasBeenMounted = true;
@@ -789,7 +804,7 @@ class Base extends CoreBase {
789
804
  // todo: the main thread reply of mount arrives after pushing the task into the queue which does not ensure the dom is mounted
790
805
  setTimeout(() => {
791
806
  DomEventManager.mountDomListeners(me)
792
- }, 100)
807
+ }, 150)
793
808
  }
794
809
 
795
810
  me.doResolveUpdateCache();
@@ -798,16 +813,12 @@ class Base extends CoreBase {
798
813
  me.alignTo();
799
814
 
800
815
  // Focus will be pushed into the first input field or other focusable item
801
- Neo.main.DomAccess.focus({
802
- id : this.id,
803
- children : true
804
- });
816
+ Neo.main.DomAccess.focus({id, children: true, windowId})
805
817
  }
806
818
 
807
819
  me.fire('mounted', me.id)
808
- }
809
- else {
810
- me.revertFocus();
820
+ } else {
821
+ me.revertFocus()
811
822
  }
812
823
  }
813
824
  }
@@ -822,6 +833,31 @@ class Base extends CoreBase {
822
833
  value && this.changeVdomRootKey('data-ref', value)
823
834
  }
824
835
 
836
+ /**
837
+ * Triggered after the responsive config got changed
838
+ * @param {Object} value
839
+ * @param {Object} oldValue
840
+ * @protected
841
+ */
842
+ async afterSetResponsive(value, oldValue) {
843
+ if (!value) {
844
+ return
845
+ }
846
+
847
+ let me = this,
848
+ module = await import(`../../src/plugin/Responsive.mjs`),
849
+ plugins = me.plugins || [];
850
+
851
+ plugins.push({
852
+ module : module.default,
853
+ appName: me.appName,
854
+ id : 'responsive',
855
+ value
856
+ });
857
+
858
+ me.plugins = plugins
859
+ }
860
+
825
861
  /**
826
862
  * Triggered after the role config got changed
827
863
  * @param {String|null} value
@@ -832,6 +868,45 @@ class Base extends CoreBase {
832
868
  this.changeVdomRootKey('role', value)
833
869
  }
834
870
 
871
+ /**
872
+ * Triggered after the scrollable config got changed
873
+ * @param {String|Boolean} value
874
+ * @param {String|Boolean|null} oldValue
875
+ * @protected
876
+ */
877
+ afterSetScrollable(value, oldValue) {
878
+ if (oldValue === undefined && !value) {
879
+ return
880
+ }
881
+
882
+ let me = this;
883
+
884
+ if (oldValue) {
885
+ let oldOverflowKey = 'overflow';
886
+
887
+ if (!Neo.isBoolean(oldValue)) {
888
+ oldOverflowKey += Neo.capitalize(oldValue)
889
+ }
890
+
891
+ me.removeStyle([oldOverflowKey])
892
+ }
893
+
894
+ if (!Neo.isEmpty(value)) {
895
+ let overflowKey = 'overflow';
896
+
897
+ if (value && !Neo.isBoolean(value)) {
898
+ overflowKey += Neo.capitalize(value)
899
+ }
900
+
901
+ if (value) {
902
+ me.addStyle(overflowKey + ':auto');
903
+ me.addCls('neo-scrollable')
904
+ } else {
905
+ me.removeCls('neo-scrollable')
906
+ }
907
+ }
908
+ }
909
+
835
910
  /**
836
911
  * Triggered after the style config got changed
837
912
  * @param {Object} value
@@ -1022,18 +1097,18 @@ class Base extends CoreBase {
1022
1097
  align = {
1023
1098
  ...me.align,
1024
1099
  ...spec,
1025
- id : me.id,
1026
- configuredFlex : me.configuredFlex,
1027
- configuredWidth : me.configuredWidth,
1028
- configuredHeight : me.configuredHeight,
1029
- configuredMinWidth : me.configuredMinWidth,
1030
- configuredMinHeight : me.configuredMinHeight,
1031
- configuredMaxWidth : me.configuredMaxWidth,
1032
- configuredMaxHeight : me.configuredMaxHeight
1100
+ id : me.id,
1101
+ configuredFlex : me.configuredFlex,
1102
+ configuredWidth : me.configuredWidth,
1103
+ configuredHeight : me.configuredHeight,
1104
+ configuredMinWidth : me.configuredMinWidth,
1105
+ configuredMinHeight: me.configuredMinHeight,
1106
+ configuredMaxWidth : me.configuredMaxWidth,
1107
+ configuredMaxHeight: me.configuredMaxHeight
1033
1108
  };
1034
1109
 
1035
1110
  if (align.target) {
1036
- await Neo.main.DomAccess.align(align);
1111
+ await Neo.main.DomAccess.align(align)
1037
1112
  }
1038
1113
  }
1039
1114
 
@@ -1081,7 +1156,7 @@ class Base extends CoreBase {
1081
1156
  * @protected
1082
1157
  */
1083
1158
  beforeGetWrapperCls(value) {
1084
- return value ? [...value]: []
1159
+ return value ? [...value] : []
1085
1160
  }
1086
1161
 
1087
1162
  /**
@@ -1168,7 +1243,7 @@ class Base extends CoreBase {
1168
1243
  * @returns {String}
1169
1244
  * @protected
1170
1245
  */
1171
- beforeSetHideMode(value, oldValue) {
1246
+ beforeSetHideMode(value, oldValue) {
1172
1247
  return this.beforeSetEnumValue(value, oldValue, 'hideMode')
1173
1248
  }
1174
1249
 
@@ -1185,8 +1260,8 @@ class Base extends CoreBase {
1185
1260
 
1186
1261
  if (value) {
1187
1262
  value = ClassSystemUtil.beforeSetInstance(value, KeyNavigation, {
1188
- keyDownEventBubble : true,
1189
- keys: value
1263
+ keyDownEventBubble: true,
1264
+ keys : value
1190
1265
  })
1191
1266
  }
1192
1267
 
@@ -1306,10 +1381,9 @@ class Base extends CoreBase {
1306
1381
  * todo: unregister events
1307
1382
  */
1308
1383
  destroy(updateParentVdom=false, silent=false) {
1309
- let me = this,
1310
- parentId = me.parentId,
1311
- parent = Neo.getComponent(parentId),
1312
- parentModel = parent?.getModel(),
1384
+ let me = this,
1385
+ {parent, parentId} = me,
1386
+ parentModel = parent?.getModel(),
1313
1387
  parentVdom;
1314
1388
 
1315
1389
  me.revertFocus();
@@ -1426,7 +1500,8 @@ class Base extends CoreBase {
1426
1500
  */
1427
1501
  focus(id=this.id) {
1428
1502
  Neo.main.DomAccess.focus({
1429
- id
1503
+ id,
1504
+ windowId: this.id
1430
1505
  }).catch(err => {
1431
1506
  console.log('Error attempting to receive focus for component', err, this)
1432
1507
  })
@@ -1490,7 +1565,7 @@ class Base extends CoreBase {
1490
1565
  * @returns {Promise<Neo.util.Rectangle>}
1491
1566
  */
1492
1567
  async getDomRect(id=this.id, appName=this.appName) {
1493
- const result = await Neo.main.DomAccess.getBoundingClientRect({appName, id});
1568
+ const result = await Neo.main.DomAccess.getBoundingClientRect({appName, id, windowId: this.windowId});
1494
1569
 
1495
1570
  if (Array.isArray(result)) {
1496
1571
  return result.map(rect => Rectangle.clone(rect))
@@ -1666,8 +1741,8 @@ class Base extends CoreBase {
1666
1741
  let me = this;
1667
1742
 
1668
1743
  if (me.hideMode !== 'visibility') {
1669
- let removeFn = function() {
1670
- if(me.parentId !== 'document.body') {
1744
+ let removeFn = function () {
1745
+ if (me.parentId !== 'document.body') {
1671
1746
  me.vdom.removeDom = true;
1672
1747
  me.parent.update()
1673
1748
  } else {
@@ -1750,13 +1825,12 @@ class Base extends CoreBase {
1750
1825
  async measure(value) {
1751
1826
  if (value != null) {
1752
1827
  if (value.endsWith('px')) {
1753
- value = parseFloat(value);
1754
- }
1755
- else if (lengthRE.test(value)) {
1756
- value = await Neo.main.DomAccess.measure({ value, id : this.id });
1757
- }
1758
- else if (!isNaN(value)) {
1759
- value = parseFloat(value);
1828
+ value = parseFloat(value)
1829
+ } else if (lengthRE.test(value)) {
1830
+ let {id, windowId} = this;
1831
+ value = await Neo.main.DomAccess.measure({id, value, windowId})
1832
+ } else if (!isNaN(value)) {
1833
+ value = parseFloat(value)
1760
1834
  }
1761
1835
  }
1762
1836
 
@@ -1783,7 +1857,7 @@ class Base extends CoreBase {
1783
1857
 
1784
1858
  if (config.style) {
1785
1859
  // If we are passed an object, merge it with the class's own style
1786
- me.style = Neo.typeOf(config.style) === 'Object' ? { ...config.style, ...me.constructor.config.style } : config.style;
1860
+ me.style = Neo.typeOf(config.style) === 'Object' ? {...config.style, ...me.constructor.config.style} : config.style
1787
1861
  }
1788
1862
 
1789
1863
  me.wrapperStyle = Neo.clone(config.wrapperStyle, false);
@@ -1924,8 +1998,8 @@ class Base extends CoreBase {
1924
1998
  * @protected
1925
1999
  */
1926
2000
  onRender(data, autoMount) {
1927
- let me = this,
1928
- app = me.app;
2001
+ let me = this,
2002
+ {app} = me;
1929
2003
 
1930
2004
  me.rendering = false;
1931
2005
 
@@ -1933,15 +2007,15 @@ class Base extends CoreBase {
1933
2007
  if (app) {
1934
2008
  if (!app.rendered) {
1935
2009
  app.rendering = false;
1936
- app.rendered = true;
2010
+ app.rendered = true;
1937
2011
  app.fire('render')
1938
2012
  }
1939
2013
 
1940
2014
  me.vnode = data;
1941
2015
 
1942
- let childIds = ComponentManager.getChildIds(data),
1943
- i = 0,
1944
- len = childIds.length,
2016
+ let childIds = ComponentManager.getChildIds(data),
2017
+ i = 0,
2018
+ len = childIds.length,
1945
2019
  child;
1946
2020
 
1947
2021
  for (; i < len; i++) {
@@ -1974,7 +2048,7 @@ class Base extends CoreBase {
1974
2048
  * @param {Neo.vdom.VNode} vnode= this.vnode
1975
2049
  * @returns {Promise<any>}
1976
2050
  */
1977
- promiseUpdate(vdom=this.vdom, vnode=this.vnode) {
2051
+ promiseUpdate(vdom = this.vdom, vnode = this.vnode) {
1978
2052
  return new Promise((resolve, reject) => {
1979
2053
  this.updateVdom(vdom, vnode, resolve, reject)
1980
2054
  })
@@ -1999,8 +2073,8 @@ class Base extends CoreBase {
1999
2073
  value = [value];
2000
2074
  }
2001
2075
 
2002
- let me = this,
2003
- domListeners = me.domListeners,
2076
+ let me = this,
2077
+ {domListeners} = me,
2004
2078
  i, len;
2005
2079
 
2006
2080
  value.forEach(item => {
@@ -2024,14 +2098,14 @@ class Base extends CoreBase {
2024
2098
  * @returns {Object} all styles of this.el
2025
2099
  */
2026
2100
  removeStyle(value) {
2027
- if (typeof value === 'string') {
2028
- value = [value];
2101
+ if (!Array.isArray(value)) {
2102
+ value = [value]
2029
2103
  }
2030
2104
 
2031
- let style = this.style,
2105
+ let {style} = this,
2032
2106
  doUpdate = false;
2033
2107
 
2034
- Object.entries(style).forEach(key => {
2108
+ Object.keys(style).forEach(key => {
2035
2109
  if (value.indexOf(key) > -1) {
2036
2110
  delete style[key];
2037
2111
  doUpdate = true
@@ -2157,7 +2231,7 @@ class Base extends CoreBase {
2157
2231
  * Convenience shortcut calling set() with the silent flag
2158
2232
  * @param {Object} values={}
2159
2233
  */
2160
- setSilent(values={}) {
2234
+ setSilent(values = {}) {
2161
2235
  return this.set(values, true)
2162
2236
  }
2163
2237
 
@@ -2174,7 +2248,7 @@ class Base extends CoreBase {
2174
2248
 
2175
2249
  if (me.silentVdomUpdate) {
2176
2250
  me.needsVdomUpdate = true
2177
- } else if(me.parentId !== 'document.body') {
2251
+ } else if (me.parentId !== 'document.body') {
2178
2252
  me.parent.update()
2179
2253
  } else {
2180
2254
  !me.mounted && me.render(true)
@@ -2194,7 +2268,7 @@ class Base extends CoreBase {
2194
2268
  * @param {Object} [vdom=this.vdom]
2195
2269
  * @param {Boolean} force=false
2196
2270
  */
2197
- syncVdomIds(vnode=this.vnode, vdom=this.vdom, force=false) {
2271
+ syncVdomIds(vnode = this.vnode, vdom = this.vdom, force = false) {
2198
2272
  VDomUtil.syncVdomIds(vnode, vdom, force)
2199
2273
  }
2200
2274
 
@@ -2250,19 +2324,14 @@ class Base extends CoreBase {
2250
2324
  else if (index === 0 && me.vnode.outerHTML) {
2251
2325
  // console.log('dyn item', me.vnode, me.parentIndex);
2252
2326
  component.vnode.childNodes.splice(me.parentIndex || 0, 0, me.vnode)
2253
- }
2254
-
2255
- else if (!VNodeUtil.replaceChildVnode(component.vnode, me.vnode.id, me.vnode)) {
2327
+ } else if (!VNodeUtil.replaceChildVnode(component.vnode, me.vnode.id, me.vnode)) {
2256
2328
  // todo: can happen for dynamically inserted container items
2257
2329
  // console.warn('syncVnodeTree: Could not replace the parent vnode for', me.vnode.id, component);
2258
2330
  }
2259
2331
  }
2260
2332
  });
2261
2333
 
2262
- if (debug) {
2263
- let end = performance.now();
2264
- console.log('syncVnodeTree', me.id, end - start)
2265
- }
2334
+ debug && console.log('syncVnodeTree', me.id, performance.now() - start)
2266
2335
  }
2267
2336
 
2268
2337
  /**
@@ -2316,7 +2385,7 @@ class Base extends CoreBase {
2316
2385
  */
2317
2386
  updateCls(cls, oldCls, id=this.id) {
2318
2387
  let me = this,
2319
- vnode = me.vnode,
2388
+ {vnode} = me,
2320
2389
  vnodeTarget = vnode && VNodeUtil.findChildVnode(me.vnode, {id})?.vnode;
2321
2390
 
2322
2391
  if (vnode && !Neo.isEqual(cls, oldCls)) {
@@ -2396,9 +2465,8 @@ class Base extends CoreBase {
2396
2465
  * @protected
2397
2466
  */
2398
2467
  updateVdom(vdom=this.vdom, vnode=this.vnode, resolve, reject) {
2399
- let me = this,
2400
- app = me.app,
2401
- mounted = me.mounted,
2468
+ let me = this,
2469
+ {app, mounted, parentId} = me,
2402
2470
  listenerId;
2403
2471
 
2404
2472
  // It is important to keep the vdom tree stable to ensure that containers do not lose the references to their
@@ -2437,8 +2505,8 @@ class Base extends CoreBase {
2437
2505
  }
2438
2506
 
2439
2507
  if (
2440
- !me.needsParentUpdate(me.parentId, resolve)
2441
- && !me.isParentVdomUpdating(me.parentId, resolve)
2508
+ !me.needsParentUpdate(parentId, resolve)
2509
+ && !me.isParentVdomUpdating(parentId, resolve)
2442
2510
  && mounted
2443
2511
  && vnode
2444
2512
  ) {
@@ -163,15 +163,10 @@ class MonacoEditor extends Base {
163
163
  let me = this;
164
164
 
165
165
  Neo.main.addon.MonacoEditor.createInstance(me.getInitialOptions()).then(() => {
166
- Neo.main.addon.ResizeObserver.register({
167
- id : me.id,
168
- windowId: me.windowId
169
- });
170
-
171
166
  // use this custom method as needed inside your class extensions
172
167
  me.onEditorMounted?.()
173
168
  })
174
- }, 50)
169
+ }, 150)
175
170
  }
176
171
 
177
172
  /**
@@ -136,18 +136,18 @@ class Base extends Component {
136
136
 
137
137
  /**
138
138
  * @param {Neo.layout.Base} value
139
- * @param {Neo.layout.Base} oldValue
139
+ * @param {Neo.layout.Base|null} oldValue
140
140
  * @protected
141
141
  */
142
142
  afterSetLayout(value, oldValue) {
143
143
  let me = this;
144
144
 
145
145
  if (me.rendered) {
146
- oldValue.removeRenderAttributes();
146
+ oldValue?.removeRenderAttributes();
147
147
  value.applyRenderAttributes();
148
148
 
149
149
  me.items.forEach((item, index) => {
150
- oldValue.removeChildAttributes(item, index);
150
+ oldValue?.removeChildAttributes(item, index);
151
151
  value.applyChildAttributes(item, index)
152
152
  })
153
153
  }
@@ -377,7 +377,7 @@ class Base extends Component {
377
377
  items[index] = item = me.createItem(item, index);
378
378
 
379
379
  if (item instanceof Neo.core.Base) {
380
- layout.applyChildAttributes(item, index)
380
+ layout?.applyChildAttributes(item, index)
381
381
  }
382
382
 
383
383
  itemsRoot.cn.push(item.vdom)
@@ -581,7 +581,7 @@ class Base extends Component {
581
581
 
582
582
  // in case the Container does not have a layout config, the setter won't trigger
583
583
  me._layout = me.createLayout(me.layout);
584
- me._layout.applyRenderAttributes();
584
+ me._layout?.applyRenderAttributes();
585
585
 
586
586
  super.onConstructed();
587
587
 
@@ -30,7 +30,29 @@ class Viewport extends Container {
30
30
  /**
31
31
  * @member {String[]} baseCls=['neo-viewport']
32
32
  */
33
- baseCls: ['neo-viewport']
33
+ baseCls: ['neo-viewport'],
34
+ /**
35
+ * true applies a main.addon.ResizeObserver and fires a custom resize event
36
+ * which other instances can subscribe to.
37
+ * @member {Boolean} monitorSize_=false
38
+ */
39
+ monitorSize_: false
40
+ }
41
+
42
+ /**
43
+ * Triggered after the mounted config got changed
44
+ * @param {Boolean} value
45
+ * @param {Boolean} oldValue
46
+ * @protected
47
+ */
48
+ afterSetMounted(value, oldValue) {
49
+ super.afterSetMounted(value, oldValue);
50
+
51
+ let me = this;
52
+
53
+ if (value && me.monitorSize) {
54
+ me.addDomListeners([{resize: me.onDomResize, scope: me}])
55
+ }
34
56
  }
35
57
 
36
58
  /**
@@ -47,6 +69,13 @@ class Viewport extends Container {
47
69
  windowId
48
70
  })
49
71
  }
72
+
73
+ /**
74
+ * @param {Object} data
75
+ */
76
+ onDomResize(data) {
77
+ this.fire('resize', data)
78
+ }
50
79
  }
51
80
 
52
81
  Neo.setupClass(Viewport);