neo.mjs 2.3.16 → 3.0.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.
Files changed (265) hide show
  1. package/README.md +9 -0
  2. package/apps/covid/Util.mjs +1 -3
  3. package/apps/covid/view/GalleryContainer.mjs +2 -3
  4. package/apps/covid/view/GalleryContainerController.mjs +1 -5
  5. package/apps/covid/view/HelixContainer.mjs +2 -3
  6. package/apps/covid/view/HelixContainerController.mjs +1 -4
  7. package/apps/covid/view/MainContainerController.mjs +0 -7
  8. package/apps/covid/view/MainContainerModel.mjs +0 -1
  9. package/apps/covid/view/TableContainer.mjs +2 -3
  10. package/apps/covid/view/TableContainerController.mjs +0 -3
  11. package/apps/covid/view/WorldMapComponent.mjs +1 -2
  12. package/apps/covid/view/WorldMapContainerController.mjs +0 -2
  13. package/apps/covid/view/country/Gallery.mjs +0 -2
  14. package/apps/covid/view/country/Helix.mjs +0 -3
  15. package/apps/covid/view/mapboxGl/Container.mjs +1 -1
  16. package/apps/covid/view/mapboxGl/ContainerController.mjs +1 -6
  17. package/apps/krausest/TableCollection.mjs +0 -1
  18. package/apps/krausest/view/MainComponent.mjs +2 -3
  19. package/apps/krausest/view/MainComponentController.mjs +0 -1
  20. package/apps/krausest/view/TableComponent.mjs +2 -4
  21. package/apps/realworld/api/Article.mjs +1 -4
  22. package/apps/realworld/api/Base.mjs +0 -5
  23. package/apps/realworld/api/Favorite.mjs +1 -3
  24. package/apps/realworld/api/Profile.mjs +1 -3
  25. package/apps/realworld/api/config.mjs +2 -2
  26. package/apps/realworld/view/HeaderComponent.mjs +1 -2
  27. package/apps/realworld/view/HomeComponent.mjs +2 -11
  28. package/apps/realworld/view/MainContainerController.mjs +0 -13
  29. package/apps/realworld/view/article/CommentComponent.mjs +3 -5
  30. package/apps/realworld/view/article/Component.mjs +2 -7
  31. package/apps/realworld/view/article/CreateCommentComponent.mjs +3 -7
  32. package/apps/realworld/view/article/CreateComponent.mjs +3 -3
  33. package/apps/realworld/view/article/PreviewComponent.mjs +3 -5
  34. package/apps/realworld/view/article/TagListComponent.mjs +3 -7
  35. package/apps/realworld/view/user/ProfileComponent.mjs +2 -8
  36. package/apps/realworld/view/user/SettingsComponent.mjs +3 -7
  37. package/apps/realworld/view/user/SignUpComponent.mjs +2 -3
  38. package/apps/realworld2/api/Article.mjs +1 -4
  39. package/apps/realworld2/api/Base.mjs +0 -5
  40. package/apps/realworld2/api/Favorite.mjs +1 -3
  41. package/apps/realworld2/api/Profile.mjs +1 -3
  42. package/apps/realworld2/view/HeaderToolbarController.mjs +1 -2
  43. package/apps/realworld2/view/HomeContainer.mjs +1 -2
  44. package/apps/realworld2/view/MainContainerController.mjs +1 -14
  45. package/apps/realworld2/view/article/Gallery.mjs +1 -3
  46. package/apps/realworld2/view/article/GalleryContainer.mjs +1 -2
  47. package/apps/realworld2/view/article/Helix.mjs +1 -3
  48. package/apps/realworld2/view/article/HelixContainer.mjs +3 -5
  49. package/apps/realworld2/view/article/PreviewComponent.mjs +3 -5
  50. package/apps/realworld2/view/article/TagListComponent.mjs +3 -7
  51. package/apps/realworld2/view/user/LoginFormContainer.mjs +3 -4
  52. package/apps/sharedcovid/Util.mjs +1 -3
  53. package/apps/sharedcovid/view/GalleryContainer.mjs +2 -3
  54. package/apps/sharedcovid/view/GalleryContainerController.mjs +1 -5
  55. package/apps/sharedcovid/view/HelixContainer.mjs +2 -3
  56. package/apps/sharedcovid/view/HelixContainerController.mjs +1 -4
  57. package/apps/sharedcovid/view/MainContainerModel.mjs +0 -1
  58. package/apps/sharedcovid/view/TableContainer.mjs +2 -3
  59. package/apps/sharedcovid/view/TableContainerController.mjs +0 -3
  60. package/apps/sharedcovid/view/WorldMapComponent.mjs +1 -2
  61. package/apps/sharedcovid/view/WorldMapContainerController.mjs +0 -2
  62. package/apps/sharedcovid/view/country/Gallery.mjs +0 -2
  63. package/apps/sharedcovid/view/country/Helix.mjs +0 -3
  64. package/apps/sharedcovid/view/mapboxGl/Container.mjs +2 -3
  65. package/apps/sharedcovid/view/mapboxGl/ContainerController.mjs +1 -5
  66. package/apps/shareddialog/view/MainContainerController.mjs +0 -18
  67. package/apps/shareddialog2/view/MainContainerController.mjs +1 -2
  68. package/apps/website/view/MainContainerController.mjs +0 -4
  69. package/buildScripts/webpack/development/webpack.config.main.js +2 -1
  70. package/buildScripts/webpack/production/webpack.config.main.js +2 -1
  71. package/docs/app/view/ContentTabContainer.mjs +2 -2
  72. package/docs/app/view/MainContainer.mjs +2 -2
  73. package/docs/app/view/classdetails/SourceViewComponent.mjs +2 -2
  74. package/docs/app/view/classdetails/TutorialComponent.mjs +2 -2
  75. package/docs/tutorials/02_ClassSystem.html +3 -3
  76. package/docs/tutorials/02_ClassSystem.md +2 -2
  77. package/docs/tutorials/09_TodoList_version1.html +8 -8
  78. package/examples/ConfigurationViewport.mjs +0 -4
  79. package/examples/calendar/basic/MainContainerController.mjs +0 -1
  80. package/examples/calendar/weekview/MainContainer.mjs +2 -2
  81. package/examples/component/coronaGallery/CountryGallery.mjs +1 -4
  82. package/examples/component/coronaGallery/MainContainer.mjs +2 -4
  83. package/examples/component/coronaHelix/CountryHelix.mjs +0 -4
  84. package/examples/component/coronaHelix/MainContainer.mjs +2 -4
  85. package/examples/component/gallery/MainContainer.mjs +2 -4
  86. package/examples/component/helix/MainContainer.mjs +2 -4
  87. package/examples/component/splitter/MainContainer.mjs +0 -2
  88. package/examples/core/config/MainContainer.mjs +3 -5
  89. package/examples/dialog/MainContainer.mjs +3 -7
  90. package/examples/list/animate/MainContainer.mjs +2 -2
  91. package/examples/model/advanced/MainContainerController.mjs +0 -12
  92. package/examples/model/dialog/EditUserDialogController.mjs +1 -3
  93. package/examples/model/dialog/MainContainerController.mjs +1 -2
  94. package/examples/model/extendedClass/MainContainerController.mjs +0 -7
  95. package/examples/model/inline/MainContainerController.mjs +0 -7
  96. package/examples/model/inlineNoModel/MainContainerController.mjs +1 -6
  97. package/examples/model/multiWindow/EditUserDialogController.mjs +1 -3
  98. package/examples/model/multiWindow/MainContainerController.mjs +1 -3
  99. package/examples/model/multiWindow/ViewportController.mjs +3 -5
  100. package/examples/model/nestedData/MainContainerController.mjs +1 -8
  101. package/examples/tab/container/MainContainer.mjs +1 -6
  102. package/examples/todoList/version1/MainComponent.mjs +3 -3
  103. package/examples/todoList/version2/MainContainer.mjs +3 -3
  104. package/examples/todoList/version2/TodoList.mjs +1 -1
  105. package/examples/tree/MainContainer.mjs +0 -2
  106. package/package.json +7 -7
  107. package/src/Main.mjs +9 -18
  108. package/src/Neo.mjs +26 -26
  109. package/src/button/Menu.mjs +0 -1
  110. package/src/button/Split.mjs +2 -6
  111. package/src/calendar/store/Events.mjs +0 -1
  112. package/src/calendar/view/DayComponent.mjs +0 -1
  113. package/src/calendar/view/EditEventContainer.mjs +2 -9
  114. package/src/calendar/view/MainContainer.mjs +2 -17
  115. package/src/calendar/view/MainContainerModel.mjs +2 -4
  116. package/src/calendar/view/SettingsContainer.mjs +2 -6
  117. package/src/calendar/view/YearComponent.mjs +2 -11
  118. package/src/calendar/view/calendars/Container.mjs +0 -1
  119. package/src/calendar/view/calendars/EditContainer.mjs +2 -7
  120. package/src/calendar/view/calendars/List.mjs +0 -5
  121. package/src/calendar/view/month/Component.mjs +2 -14
  122. package/src/calendar/view/settings/GeneralContainer.mjs +0 -3
  123. package/src/calendar/view/settings/MonthContainer.mjs +0 -3
  124. package/src/calendar/view/settings/WeekContainer.mjs +0 -5
  125. package/src/calendar/view/settings/YearContainer.mjs +0 -3
  126. package/src/calendar/view/week/Component.mjs +2 -18
  127. package/src/calendar/view/week/EventDragZone.mjs +0 -3
  128. package/src/calendar/view/week/TimeAxisComponent.mjs +2 -3
  129. package/src/calendar/view/week/plugin/DragDrop.mjs +2 -12
  130. package/src/calendar/view/week/plugin/EventResizable.mjs +0 -3
  131. package/src/collection/Base.mjs +3 -22
  132. package/src/collection/Filter.mjs +0 -1
  133. package/src/collection/Sorter.mjs +0 -3
  134. package/src/component/Base.mjs +1 -3
  135. package/src/component/Chip.mjs +2 -4
  136. package/src/component/Circle.mjs +2 -20
  137. package/src/component/DateSelector.mjs +2 -15
  138. package/src/component/Gallery.mjs +2 -14
  139. package/src/component/Helix.mjs +2 -16
  140. package/src/component/Splitter.mjs +2 -5
  141. package/src/component/mwc/Button.mjs +2 -2
  142. package/src/component/mwc/TextField.mjs +2 -3
  143. package/src/component/wrapper/AmChart.mjs +1 -1
  144. package/src/component/wrapper/MapboxGL.mjs +0 -5
  145. package/src/container/Base.mjs +1 -7
  146. package/src/container/Panel.mjs +2 -5
  147. package/src/controller/Application.mjs +2 -3
  148. package/src/controller/Base.mjs +2 -3
  149. package/src/controller/Component.mjs +3 -6
  150. package/src/core/Base.mjs +26 -3
  151. package/src/core/Compare.mjs +0 -1
  152. package/src/core/IdGenerator.mjs +2 -4
  153. package/src/core/Observable.mjs +0 -3
  154. package/src/core/Util.mjs +0 -1
  155. package/src/core/_export.mjs +1 -2
  156. package/src/data/RecordFactory.mjs +1 -6
  157. package/src/data/Store.mjs +2 -12
  158. package/src/data/connection/Xhr.mjs +0 -6
  159. package/src/dialog/Base.mjs +2 -12
  160. package/src/draggable/DragProxyComponent.mjs +3 -5
  161. package/src/draggable/DragZone.mjs +2 -8
  162. package/src/draggable/DropZone.mjs +3 -9
  163. package/src/draggable/list/DragZone.mjs +3 -9
  164. package/src/draggable/tab/header/toolbar/SortZone.mjs +1 -3
  165. package/src/draggable/toolbar/DragZone.mjs +3 -7
  166. package/src/draggable/toolbar/SortZone.mjs +0 -5
  167. package/src/draggable/tree/DragZone.mjs +1 -4
  168. package/src/filter/BooleanContainer.mjs +0 -1
  169. package/src/filter/NumberContainer.mjs +0 -2
  170. package/src/filter/ToggleOperatorsButton.mjs +3 -5
  171. package/src/form/Container.mjs +0 -2
  172. package/src/form/Fieldset.mjs +0 -1
  173. package/src/form/field/Base.mjs +0 -2
  174. package/src/form/field/CheckBox.mjs +2 -7
  175. package/src/form/field/Color.mjs +2 -5
  176. package/src/form/field/Date.mjs +2 -6
  177. package/src/form/field/Display.mjs +2 -3
  178. package/src/form/field/Picker.mjs +0 -9
  179. package/src/form/field/Range.mjs +2 -3
  180. package/src/form/field/Select.mjs +24 -22
  181. package/src/form/field/Text.mjs +2 -17
  182. package/src/form/field/Time.mjs +2 -9
  183. package/src/form/field/trigger/Base.mjs +2 -4
  184. package/src/form/field/trigger/Clear.mjs +0 -3
  185. package/src/form/field/trigger/CopyToClipboard.mjs +0 -3
  186. package/src/form/field/trigger/Picker.mjs +0 -1
  187. package/src/form/field/trigger/SpinDown.mjs +0 -1
  188. package/src/form/field/trigger/SpinUp.mjs +0 -1
  189. package/src/form/field/trigger/SpinUpDown.mjs +0 -1
  190. package/src/form/field/trigger/Time.mjs +2 -3
  191. package/src/grid/Container.mjs +3 -6
  192. package/src/grid/header/Toolbar.mjs +1 -5
  193. package/src/list/Base.mjs +2 -2
  194. package/src/list/Color.mjs +0 -3
  195. package/src/list/Component.mjs +0 -3
  196. package/src/list/plugin/Animate.mjs +2 -3
  197. package/src/main/DomAccess.mjs +9 -24
  198. package/src/main/DomEvents.mjs +44 -77
  199. package/src/main/addon/AmCharts.mjs +3 -12
  200. package/src/main/addon/AnalyticsByGoogle.mjs +3 -4
  201. package/src/main/addon/CloneNode.mjs +0 -2
  202. package/src/main/addon/Cookie.mjs +0 -3
  203. package/src/main/addon/DragDrop.mjs +2 -11
  204. package/src/main/addon/HighlightJS.mjs +3 -7
  205. package/src/main/addon/MapboxGL.mjs +4 -16
  206. package/src/main/addon/Markdown.mjs +3 -3
  207. package/src/main/addon/Mwc.mjs +0 -2
  208. package/src/main/addon/Siesta.mjs +2 -3
  209. package/src/main/addon/Stylesheet.mjs +2 -6
  210. package/src/main/addon/WindowPosition.mjs +3 -8
  211. package/src/main/draggable/sensor/Mouse.mjs +2 -6
  212. package/src/main/draggable/sensor/Touch.mjs +2 -6
  213. package/src/main/mixin/DeltaUpdates.mjs +0 -8
  214. package/src/main/mixin/TouchDomEvents.mjs +1 -7
  215. package/src/manager/Base.mjs +0 -2
  216. package/src/manager/Component.mjs +2 -5
  217. package/src/manager/DomEvent.mjs +1 -6
  218. package/src/manager/Focus.mjs +0 -7
  219. package/src/manager/Instance.mjs +2 -3
  220. package/src/manager/Store.mjs +0 -4
  221. package/src/menu/List.mjs +0 -6
  222. package/src/model/Component.mjs +2 -3
  223. package/src/plugin/Base.mjs +2 -3
  224. package/src/plugin/Resizable.mjs +2 -10
  225. package/src/selection/CircleModel.mjs +1 -5
  226. package/src/selection/DateSelectorModel.mjs +1 -9
  227. package/src/selection/GalleryModel.mjs +0 -9
  228. package/src/selection/HelixModel.mjs +0 -9
  229. package/src/selection/ListModel.mjs +0 -8
  230. package/src/selection/Model.mjs +0 -8
  231. package/src/selection/menu/ListModel.mjs +0 -2
  232. package/src/selection/table/CellColumnModel.mjs +2 -6
  233. package/src/selection/table/CellColumnRowModel.mjs +2 -6
  234. package/src/selection/table/CellModel.mjs +0 -8
  235. package/src/selection/table/CellRowModel.mjs +2 -8
  236. package/src/selection/table/ColumnModel.mjs +0 -6
  237. package/src/selection/table/RowModel.mjs +0 -5
  238. package/src/tab/Container.mjs +0 -6
  239. package/src/tab/header/Button.mjs +1 -2
  240. package/src/tab/header/Toolbar.mjs +0 -1
  241. package/src/table/Container.mjs +2 -10
  242. package/src/table/View.mjs +0 -4
  243. package/src/table/header/Button.mjs +2 -8
  244. package/src/table/header/Toolbar.mjs +1 -2
  245. package/src/tree/List.mjs +0 -4
  246. package/src/util/Css.mjs +0 -1
  247. package/src/util/Date.mjs +0 -2
  248. package/src/util/Function.mjs +0 -2
  249. package/src/util/HashHistory.mjs +0 -3
  250. package/src/util/KeyNavigation.mjs +0 -5
  251. package/src/{core → util}/Logger.mjs +7 -19
  252. package/src/util/Matrix.mjs +0 -3
  253. package/src/util/VDom.mjs +0 -5
  254. package/src/util/_export.mjs +2 -1
  255. package/src/vdom/Helper.mjs +0 -3
  256. package/src/vdom/VNode.mjs +0 -1
  257. package/src/worker/App.mjs +2 -9
  258. package/src/worker/Base.mjs +2 -8
  259. package/src/worker/Canvas.mjs +0 -2
  260. package/src/worker/Manager.mjs +3 -5
  261. package/src/worker/Message.mjs +0 -1
  262. package/src/worker/mixin/RemoteMethodAccess.mjs +0 -3
  263. package/test/siesta/siesta.js +2 -1
  264. package/test/siesta/tests/ClassConfigsAndFields.mjs +307 -0
  265. package/test/siesta/tests/ClassSystem.mjs +1 -1
package/src/util/VDom.mjs CHANGED
@@ -14,7 +14,6 @@ class VDom extends Base {
14
14
  }}
15
15
 
16
16
  /**
17
- *
18
17
  * @param {Object} vdom
19
18
  * @param {Boolean} [removeIds=true]
20
19
  * @returns {Object} cloned vdom
@@ -160,7 +159,6 @@ class VDom extends Base {
160
159
  }
161
160
 
162
161
  /**
163
- *
164
162
  * @param {Object} vdom
165
163
  * @param {Number} index
166
164
  * @returns {Array}
@@ -180,7 +178,6 @@ class VDom extends Base {
180
178
  }
181
179
 
182
180
  /**
183
- *
184
181
  * @param {Object} vdom
185
182
  * @param {Number} index
186
183
  * @returns {Array}
@@ -190,7 +187,6 @@ class VDom extends Base {
190
187
  }
191
188
 
192
189
  /**
193
- *
194
190
  * @param {Object} vdom
195
191
  * @param {String} flag
196
192
  * @param {Array} [matchArray]
@@ -217,7 +213,6 @@ class VDom extends Base {
217
213
  }
218
214
 
219
215
  /**
220
- *
221
216
  * @param {Object} vdom
222
217
  * @param {String} id
223
218
  * @param {Boolean} topLevel=true Internal flag, do not use it
@@ -5,10 +5,11 @@ import Date from './Date.mjs';
5
5
  import Function from './Function.mjs';
6
6
  import HashHistory from './HashHistory.mjs';
7
7
  import KeyNavigation from './KeyNavigation.mjs';
8
+ import Logger from './Logger.mjs';
8
9
  import Matrix from './Matrix.mjs';
9
10
  import Rectangle from './Rectangle.mjs';
10
11
  import Style from './Style.mjs';
11
12
  import VDom from './VDom.mjs';
12
13
  import VNode from './VNode.mjs';
13
14
 
14
- export {NeoArray, ClassSystem, Css, Date, Function, HashHistory, KeyNavigation, Matrix, Rectangle, Style, VDom, VNode};
15
+ export {NeoArray, ClassSystem, Css, Date, Function, HashHistory, KeyNavigation, Logger, Matrix, Rectangle, Style, VDom, VNode};
@@ -579,7 +579,6 @@ class Helper extends Base {
579
579
  }
580
580
 
581
581
  /**
582
- *
583
582
  * @param {Object} vnode
584
583
  */
585
584
  createStringFromVnode(vnode) {
@@ -629,7 +628,6 @@ class Helper extends Base {
629
628
  }
630
629
 
631
630
  /**
632
- *
633
631
  * @param {Neo.vdom.VNode} vnode
634
632
  * @param {String} id
635
633
  * @param {Neo.vdom.VNode} parentNode
@@ -672,7 +670,6 @@ class Helper extends Base {
672
670
  }
673
671
 
674
672
  /**
675
- *
676
673
  * @param {Object} opts
677
674
  * @returns {Object|Neo.vdom.VNode|null}
678
675
  */
@@ -4,7 +4,6 @@
4
4
  */
5
5
  class VNode {
6
6
  /**
7
- *
8
7
  * @param config
9
8
  */
10
9
  constructor(config) {
@@ -51,16 +51,14 @@ class App extends Base {
51
51
  }}
52
52
 
53
53
  /**
54
- *
55
54
  * @param {Object} config
56
55
  */
57
- constructor(config) {
58
- super(config);
56
+ construct(config) {
57
+ super.construct(config);
59
58
  Neo.applyDeltas = this.applyDeltas.bind(this); // convenience shortcut
60
59
  }
61
60
 
62
61
  /**
63
- *
64
62
  * @param {String} appName
65
63
  * @param {Array|Object} deltas
66
64
  * @returns {Promise<*>}
@@ -74,7 +72,6 @@ class App extends Base {
74
72
  }
75
73
 
76
74
  /**
77
- *
78
75
  * @param {JSON} data
79
76
  */
80
77
  createThemeMap(data) {
@@ -95,7 +92,6 @@ class App extends Base {
95
92
  }
96
93
 
97
94
  /**
98
- *
99
95
  * @param {String} path
100
96
  * @returns {Promise}
101
97
  */
@@ -216,7 +212,6 @@ class App extends Base {
216
212
  }
217
213
 
218
214
  /**
219
- *
220
215
  * @param {Object} msg
221
216
  */
222
217
  onRegisterNeoConfig(msg) {
@@ -247,7 +242,6 @@ class App extends Base {
247
242
  }
248
243
 
249
244
  /**
250
- *
251
245
  * @param {Object} msg
252
246
  */
253
247
  onRegisterPort(msg) {
@@ -260,7 +254,6 @@ class App extends Base {
260
254
  }
261
255
 
262
256
  /**
263
- *
264
257
  * @param {Object} data
265
258
  */
266
259
  onWindowPositionChange(data) {
@@ -50,11 +50,10 @@ class Base extends CoreBase {
50
50
  }}
51
51
 
52
52
  /**
53
- *
54
53
  * @param {Object} config
55
54
  */
56
- constructor(config) {
57
- super(config);
55
+ construct(config) {
56
+ super.construct(config);
58
57
 
59
58
  let me = this;
60
59
 
@@ -81,7 +80,6 @@ class Base extends CoreBase {
81
80
  afterConnect() {}
82
81
 
83
82
  /**
84
- *
85
83
  * @param {Object} opts
86
84
  * @returns {Object|null}
87
85
  */
@@ -170,7 +168,6 @@ class Base extends CoreBase {
170
168
  }
171
169
 
172
170
  /**
173
- *
174
171
  * @param {Object} e
175
172
  */
176
173
  onMessage(e) {
@@ -198,7 +195,6 @@ class Base extends CoreBase {
198
195
  }
199
196
 
200
197
  /**
201
- *
202
198
  * @param {Object} msg
203
199
  */
204
200
  onPing(msg) {
@@ -208,7 +204,6 @@ class Base extends CoreBase {
208
204
  }
209
205
 
210
206
  /**
211
- *
212
207
  * @param {Object} msg
213
208
  */
214
209
  onRegisterNeoConfig(msg) {
@@ -217,7 +212,6 @@ class Base extends CoreBase {
217
212
  }
218
213
 
219
214
  /**
220
- *
221
215
  * @param {String} dest app, data, main or vdom (excluding the current worker)
222
216
  * @param {Object} opts configs for Neo.worker.Message
223
217
  * @param {Array} [transfer] An optional array of Transferable objects to transfer ownership of.
@@ -49,7 +49,6 @@ class Canvas extends Base {
49
49
  }
50
50
 
51
51
  /**
52
- *
53
52
  * @param {Object} data
54
53
  */
55
54
  onRegisterCanvas(data) {
@@ -63,7 +62,6 @@ class Canvas extends Base {
63
62
  }
64
63
 
65
64
  /**
66
- *
67
65
  * @param {Object} msg
68
66
  */
69
67
  onRegisterNeoConfig(msg) {
@@ -95,16 +95,14 @@ class Manager extends Base {
95
95
  /**
96
96
  * @param {Object} config
97
97
  */
98
- constructor(config) {
99
- super(config);
98
+ construct(config) {
99
+ super.construct(config);
100
100
 
101
101
  let me = this;
102
102
 
103
103
  me.detectFeatures();
104
104
 
105
- if (!Neo.insideWorker) {
106
- me.createWorkers();
107
- }
105
+ !Neo.insideWorker && me.createWorkers();
108
106
 
109
107
  Neo.workerId = 'main';
110
108
 
@@ -7,7 +7,6 @@ import IdGenerator from '../core/IdGenerator.mjs';
7
7
  */
8
8
  class Message {
9
9
  /**
10
- *
11
10
  * @param {Object} config
12
11
  */
13
12
  constructor(config) {
@@ -19,7 +19,6 @@ class RemoteMethodAccess extends Base {
19
19
  }}
20
20
 
21
21
  /**
22
- *
23
22
  * @param {Object} remote
24
23
  * @param method
25
24
  * @returns {function(*=, *=): Promise<any>}
@@ -47,7 +46,6 @@ class RemoteMethodAccess extends Base {
47
46
  }
48
47
 
49
48
  /**
50
- *
51
49
  * @param {Object} remote
52
50
  */
53
51
  onRegisterRemote(remote) {
@@ -78,7 +76,6 @@ class RemoteMethodAccess extends Base {
78
76
  }
79
77
 
80
78
  /**
81
- *
82
79
  * @param {Object} msg
83
80
  */
84
81
  onRemoteMethod(msg) {
@@ -17,10 +17,11 @@ project.configure({
17
17
  });
18
18
 
19
19
  project.plan(
20
+ 'tests/ClassConfigsAndFields.mjs',
20
21
  'tests/ClassSystem.mjs',
21
22
  'tests/CollectionBase.mjs',
22
23
  'tests/VdomHelper.mjs',
23
24
  'tests/VdomCalendar.mjs'
24
25
  );
25
26
 
26
- project.start();
27
+ project.start();
@@ -0,0 +1,307 @@
1
+ import Neo from '../../../src/Neo.mjs';
2
+ import * as core from '../../../src/core/_export.mjs';
3
+
4
+ class TestClass extends core.Base {
5
+ fieldA = 1;
6
+ fieldB = 2;
7
+
8
+ static getConfig() {return {
9
+ className: 'Neo.TestClass',
10
+ configA_ : 3,
11
+ configB_ : 4
12
+ }}
13
+
14
+ beforeSetConfigA(value) {
15
+ return this.fieldA + value;
16
+ }
17
+
18
+ beforeSetConfigB(value) {
19
+ return this.fieldB + value;
20
+ }
21
+ }
22
+
23
+ Neo.applyClassConfig(TestClass);
24
+
25
+ StartTest(t => {
26
+ t.it('Default class fields inside constructors', t => {
27
+ t.diag("Default class");
28
+
29
+ class CtorTest {
30
+ fieldA = 1;
31
+ fieldB = 2;
32
+
33
+ constructor() {
34
+ t.isStrict(this.fieldA, 1, 'fieldA equals ' + 1);
35
+ t.isStrict(this.fieldB, 2, 'fieldB equals ' + 2);
36
+ }
37
+ }
38
+
39
+ new CtorTest();
40
+
41
+ t.diag("Default class extension");
42
+
43
+ class CtorTestExtension extends CtorTest {
44
+ fieldA = 3;
45
+ fieldB = 4;
46
+
47
+ constructor() {
48
+ super();
49
+
50
+ t.isStrict(this.fieldA, 3, 'fieldA equals ' + 3);
51
+ t.isStrict(this.fieldB, 4, 'fieldB equals ' + 4);
52
+ }
53
+ }
54
+
55
+ new CtorTestExtension();
56
+ });
57
+
58
+ t.it('Neo default class fields inside constructors', t => {
59
+ t.diag("Neo default class");
60
+
61
+ class NeoCtorTest extends core.Base {
62
+ fieldA = 1;
63
+ fieldB = 2;
64
+
65
+ construct(config) {
66
+ super.construct(config);
67
+
68
+ let me = this,
69
+ extension = me.extension;
70
+
71
+ t.isStrict(me.fieldA, extension ? 3 : 1, 'fieldA equals ' + (extension ? 3 : 1));
72
+ t.isStrict(me.fieldB, extension ? 4 : 2, 'fieldB equals ' + (extension ? 4 : 2));
73
+ }
74
+ }
75
+
76
+ Neo.applyClassConfig(NeoCtorTest);
77
+
78
+ Neo.create(NeoCtorTest);
79
+
80
+ t.diag("Neo default class extension");
81
+
82
+ class NeoCtorTestExtension extends NeoCtorTest {
83
+ extension = true; // flag for the base ctor tests
84
+ fieldA = 3;
85
+ fieldB = 4;
86
+
87
+ construct(config) {
88
+ super.construct(config);
89
+
90
+ t.isStrict(this.fieldA, 3, 'fieldA equals ' + 3);
91
+ t.isStrict(this.fieldB, 4, 'fieldB equals ' + 4);
92
+ }
93
+ }
94
+
95
+ Neo.create(NeoCtorTestExtension);
96
+ });
97
+
98
+ t.it('Default class fields', t => {
99
+ t.diag("Testing class fields");
100
+
101
+ class DefaultTestClass {
102
+ fieldA = 1;
103
+ fieldB = 2;
104
+ _configA = 3;
105
+ _configB = 4;
106
+
107
+ get configA() {
108
+ return this._configA;
109
+ }
110
+
111
+ set configA(value) {
112
+ this._configA = this.fieldA + value;
113
+ }
114
+
115
+ get configB() {
116
+ return this._configB;
117
+ }
118
+
119
+ set configB(value) {
120
+ this._configB = this.fieldB + value;
121
+ }
122
+
123
+ constructor(config) {
124
+ Object.assign(this, config);
125
+ }
126
+ }
127
+
128
+ const instance = new DefaultTestClass({
129
+ fieldA : 5,
130
+ configA: 6,
131
+ configB: 7,
132
+ fieldB : 8
133
+ });
134
+
135
+ // not consistent
136
+ t.isStrict(instance.configA, 11, 'configA equals 11'); // 5 + 6 => new value of fieldA + new value of configA
137
+ t.isStrict(instance.configB, 9, 'configB equals 9'); // 7 + 2 => old value of fieldB + new value of configB
138
+ t.isStrict(instance.fieldA, 5, 'fieldA equals 5');
139
+ t.isStrict(instance.fieldB, 8, 'fieldB equals 8');
140
+
141
+ t.diag('Reversed order');
142
+
143
+ const instance2 = new DefaultTestClass({
144
+ fieldB : 8, // reversed order
145
+ configB: 7,
146
+ configA: 6,
147
+ fieldA : 5
148
+ });
149
+
150
+ // not consistent
151
+ t.isStrict(instance2.configA, 7, 'configA equals 7'); // 5 + 6 => old value of fieldA + new value of configA
152
+ t.isStrict(instance2.configB, 15, 'configB equals 15'); // 8 + 7 => new value of fieldB + new value of configB
153
+ t.isStrict(instance2.fieldA, 5, 'fieldA equals 5');
154
+ t.isStrict(instance2.fieldB, 8, 'fieldB equals 8');
155
+ });
156
+
157
+ t.it('Class based class configs and fields', t => {
158
+ t.diag("Testing class based values");
159
+
160
+ const instance = Neo.create({
161
+ className: 'Neo.TestClass'
162
+ });
163
+
164
+ t.isStrict(instance.configA, 4, 'configA equals 4'); // 1 + 3
165
+ t.isStrict(instance.configB, 6, 'configB equals 6'); // 2 + 4
166
+ t.isStrict(instance.fieldA, 1, 'fieldA equals 1');
167
+ t.isStrict(instance.fieldB, 2, 'fieldB equals 2');
168
+ });
169
+
170
+ t.it('Instance based class configs and fields', t => {
171
+ t.diag("Testing values which got set on instance level");
172
+
173
+ const instance = Neo.create({
174
+ className: 'Neo.TestClass',
175
+ fieldA : 5,
176
+ configA : 6,
177
+ configB : 7,
178
+ fieldB : 8
179
+ });
180
+
181
+ t.isStrict(instance.configA, 11, 'configA equals 11'); // 5 + 6
182
+ t.isStrict(instance.configB, 15, 'configB equals 15'); // 8 + 7
183
+ t.isStrict(instance.fieldA, 5, 'fieldA equals 5');
184
+ t.isStrict(instance.fieldB, 8, 'fieldB equals 8');
185
+
186
+ t.diag('Reversed order');
187
+
188
+ const instance2 = Neo.create({
189
+ className: 'Neo.TestClass',
190
+ fieldB : 8, // reversed order
191
+ configB : 7,
192
+ configA : 6,
193
+ fieldA : 5
194
+ });
195
+
196
+ t.isStrict(instance2.configA, 11, 'configA equals 11'); // 5 + 6
197
+ t.isStrict(instance2.configB, 15, 'configB equals 15'); // 8 + 7
198
+ t.isStrict(instance2.fieldA, 5, 'fieldA equals 5');
199
+ t.isStrict(instance2.fieldB, 8, 'fieldB equals 8');
200
+ });
201
+
202
+ t.it('Dynamically changed class configs and fields', t => {
203
+ t.diag("Testing instance.set()");
204
+
205
+ const instance = Neo.create({
206
+ className: 'Neo.TestClass'
207
+ });
208
+
209
+ instance.set({
210
+ fieldA : 5,
211
+ configA: 6,
212
+ configB: 7,
213
+ fieldB : 8
214
+ });
215
+
216
+ t.isStrict(instance.configA, 11, 'configA equals 11'); // 5 + 6
217
+ t.isStrict(instance.configB, 15, 'configB equals 15'); // 8 + 7
218
+ t.isStrict(instance.fieldA, 5, 'fieldA equals 5');
219
+ t.isStrict(instance.fieldB, 8, 'fieldB equals 8');
220
+
221
+ t.diag('Reversed order');
222
+
223
+ const instance2 = Neo.create({
224
+ className: 'Neo.TestClass'
225
+ });
226
+
227
+ instance2.set({
228
+ fieldB : 8, // reversed order
229
+ configB: 7,
230
+ configA: 6,
231
+ fieldA : 5
232
+ });
233
+
234
+ t.isStrict(instance2.configA, 11, 'configA equals 11'); // 5 + 6
235
+ t.isStrict(instance2.configB, 15, 'configB equals 15'); // 8 + 7
236
+ t.isStrict(instance2.fieldA, 5, 'fieldA equals 5');
237
+ t.isStrict(instance2.fieldB, 8, 'fieldB equals 8');
238
+ });
239
+
240
+ t.it('Advanced configs and fields example', t => {
241
+ class AdvancedClass extends core.Base {
242
+ fieldA = 2;
243
+ fieldB = 1;
244
+
245
+ static getConfig() {return {
246
+ configA_: 0,
247
+ configB_: 0,
248
+ configC_: 0
249
+ }}
250
+
251
+ afterSetConfigA(value, oldValue) {
252
+ let me = this,
253
+ sum = me.fieldA === 1 ? 21 : 6;
254
+
255
+ t.isStrict(me.configA + me.configB + me.configC + me.fieldA + me.fieldB, sum, `sum equals ${sum}`);
256
+ }
257
+
258
+ afterSetConfigC(value, oldValue) {
259
+ let me = this,
260
+ sum = me.fieldA === 1 ? 21 : 6;
261
+
262
+ t.isStrict(me.configA + me.configB + me.configC + me.fieldA + me.fieldB, sum, `sum equals ${sum}`);
263
+ }
264
+
265
+ beforeSetConfigA(value) {
266
+ return this.fieldA + value;
267
+ }
268
+
269
+ beforeSetConfigB(value) {
270
+ let me = this,
271
+ sum = me.fieldA === 1 ? 21 : 6;
272
+
273
+ t.isStrict(me.configA + me.configB + me.configC + me.fieldA + me.fieldB, sum, `sum equals ${sum}`);
274
+
275
+ return value;
276
+ }
277
+
278
+ beforeSetConfigC(value) {
279
+ return this.fieldB + value;
280
+ }
281
+ }
282
+
283
+ Neo.applyClassConfig(AdvancedClass);
284
+
285
+ let instance = Neo.create(AdvancedClass);
286
+
287
+ instance.set({
288
+ fieldA : 1,
289
+ configA: 2,
290
+ configB: 3,
291
+ configC: 4,
292
+ fieldB : 5
293
+ });
294
+
295
+ t.diag('Reversed order');
296
+
297
+ let instance2 = Neo.create(AdvancedClass);
298
+
299
+ instance2.set({
300
+ fieldB : 5,
301
+ configC: 4,
302
+ configB: 3,
303
+ configA: 2,
304
+ fieldA : 1
305
+ });
306
+ });
307
+ });
@@ -67,4 +67,4 @@ StartTest(t => {
67
67
  b: valueB
68
68
  });
69
69
  });
70
- });
70
+ });