neo.mjs 6.22.1 → 6.24.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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='6.22.1'
23
+ * @member {String} version='6.24.0'
24
24
  */
25
- version: '6.22.1'
25
+ version: '6.24.0'
26
26
  }
27
27
 
28
28
  /**
@@ -42,13 +42,9 @@ class HeaderToolbar extends Base {
42
42
  text : 'Services',
43
43
  route: '/services'
44
44
  }, {
45
- ntype : 'container',
46
- layout: 'hbox',
47
-
48
- responsive: {
49
- medium: { cls: ['separate-bar'], layout: 'vbox' },
50
- large : { cls: ['inline'], layout: 'hbox' }
51
- },
45
+ ntype : 'container',
46
+ layout : 'hbox',
47
+ reference: 'header-social-icons',
52
48
 
53
49
  itemDefaults: {
54
50
  ntype: 'button',
@@ -95,7 +95,9 @@ class Viewport extends BaseViewport {
95
95
  NeoArray.add( cls, 'portal-size-' + value);
96
96
  me.cls = cls;
97
97
 
98
- me.model.setData({size: value})
98
+ me.model.setData({size: value});
99
+
100
+ me.controller.size = value
99
101
  }
100
102
  }
101
103
 
@@ -1,5 +1,6 @@
1
1
  import Controller from '../../../src/controller/Component.mjs';
2
2
  import CubeLayout from '../../../src/layout/Cube.mjs';
3
+ import NeoArray from '../../../src/util/Array.mjs';
3
4
  import {getSearchParams} from '../Util.mjs';
4
5
 
5
6
  /**
@@ -49,7 +50,12 @@ class ViewportController extends Controller {
49
50
  '/learn' : 'onLearnRoute',
50
51
  '/learn/{itemId}': 'onLearnRoute',
51
52
  '/services' : 'onServicesRoute',
52
- }
53
+ },
54
+ /**
55
+ * Values are: large, medium, small, xSmall
56
+ * @member {String|null} size_=null
57
+ */
58
+ size_: null
53
59
  }
54
60
 
55
61
  /**
@@ -63,6 +69,16 @@ class ViewportController extends Controller {
63
69
  */
64
70
  #transitionId = 0
65
71
 
72
+ /**
73
+ * Triggered after the size activeIndex got changed
74
+ * @param {Number|null} value
75
+ * @param {Number|null} oldValue
76
+ * @protected
77
+ */
78
+ afterSetActiveIndex(value, oldValue) {
79
+ value !== null && this.updateHeaderToolbar()
80
+ }
81
+
66
82
  /**
67
83
  * Triggered after the mainContentLayout config got changed
68
84
  * @param {String} value
@@ -80,6 +96,16 @@ class ViewportController extends Controller {
80
96
  }
81
97
  }
82
98
 
99
+ /**
100
+ * Triggered after the size config got changed
101
+ * @param {String|null} value
102
+ * @param {String|null} oldValue
103
+ * @protected
104
+ */
105
+ afterSetSize(value, oldValue) {
106
+ value && this.updateHeaderToolbar()
107
+ }
108
+
83
109
  /**
84
110
  * Triggered before the mainContentLayout config gets changed
85
111
  * @param {String} value
@@ -275,6 +301,29 @@ class ViewportController extends Controller {
275
301
  }
276
302
  }
277
303
  }
304
+
305
+ /**
306
+ *
307
+ */
308
+ updateHeaderToolbar() {
309
+ let me = this,
310
+ {activeIndex, size} = me;
311
+
312
+ if (Neo.isNumber(activeIndex) && size) {
313
+ let headerSocialIcons = me.getReference('header-social-icons'),
314
+ {cls} = headerSocialIcons,
315
+ vertical = size === 'x-small',
316
+ hidden = activeIndex !== 0 && vertical;
317
+
318
+ headerSocialIcons.hidden = hidden;
319
+
320
+ if (!hidden) {
321
+ NeoArray.toggle(cls, 'separate-bar', vertical);
322
+
323
+ headerSocialIcons.cls = cls
324
+ }
325
+ }
326
+ }
278
327
  }
279
328
 
280
329
  Neo.setupClass(ViewportController);
@@ -36,20 +36,7 @@ class Container extends BaseContainer {
36
36
  }, {
37
37
  module : List,
38
38
  flex : 1,
39
- reference: 'blog-list',
40
- /**
41
- * @member {Object[]} domListeners
42
- */
43
- domListeners: [{
44
- scroll(event) {
45
- const isHomeContainer = event.target.cls.includes('portal-blog-list'),
46
- beyondEighty = event.scrollTop > 80;
47
-
48
- if (isHomeContainer) {
49
- this.toggleCls('hide-sidebar', beyondEighty);
50
- }
51
- }
52
- }]
39
+ reference: 'blog-list'
53
40
  }],
54
41
  /**
55
42
  * @member {Object} layout={ntype:'vbox',align:'stretch'}
@@ -32,11 +32,8 @@ class MainContainer extends Container {
32
32
  Neo.getComponent(data.targetId)?.activate?.()
33
33
  },
34
34
  scroll(event) {
35
- const isHomeContainer = event.target.cls.includes('portal-home-maincontainer'),
36
- beyondEighty = event.scrollTop > 80;
37
-
38
- if (isHomeContainer) {
39
- this.toggleCls('hide-sidebar', beyondEighty);
35
+ if (event.target.cls.includes('portal-home-maincontainer')) {
36
+ this.toggleCls('hide-sidebar', event.scrollTop > 80)
40
37
  }
41
38
  }
42
39
  }],
@@ -16,14 +16,7 @@ class BaseContainer extends Container {
16
16
  /**
17
17
  * @member {String[]} cls=['portal-home-content-view','neo-container']
18
18
  */
19
- baseCls: ['portal-home-content-view', 'neo-container'],
20
- /**
21
- * @member {Object} responsiveConfig
22
- */
23
- responsiveConfig: {
24
- medium: {maxWidth: 840},
25
- large : {minWidth: 841}
26
- }
19
+ baseCls: ['portal-home-content-view', 'neo-container']
27
20
  }
28
21
 
29
22
  /**
@@ -13,12 +13,13 @@ class Colors extends BaseContainer {
13
13
  */
14
14
  className: 'Portal.view.home.parts.Colors',
15
15
  /**
16
- * @member {Object} responsive
16
+ * @member {String[]} cls=['portal-home-parts-colors']
17
17
  */
18
- responsive: {
19
- medium: {layout: {ntype: 'vbox', align: 'stretch', pack: 'center'}},
20
- large : {layout: {ntype: 'hbox', align: 'stretch', pack: 'center'}}
21
- },
18
+ cls: ['portal-home-parts-colors'],
19
+ /**
20
+ * @member {Object} layout={ntype:'hbox',align:'stretch',pack:'center'}
21
+ */
22
+ layout: {ntype: 'hbox', align: 'stretch', pack: 'center'},
22
23
  /**
23
24
  * @member {Object[]} items
24
25
  */
@@ -32,15 +33,16 @@ class Colors extends BaseContainer {
32
33
  cls : ['neo-h1'],
33
34
  flex: 'none',
34
35
  html: 'Amazing Potential',
35
- vdom: {tag: 'h1'}
36
+ tag : 'h1'
36
37
  }, {
37
38
  cls : ['neo-h2'],
38
39
  flex: 'none',
39
40
  html: 'Socket Data',
40
- vdom: {tag: 'h2'}
41
+ tag : 'h2'
41
42
  }, {
42
43
  flex: 'none',
43
- vdom: {tag: 'p'},
44
+ tag : 'p',
45
+
44
46
  html: [
45
47
  'This is similar to the Helix demo — it\'s an extremely fast multi-window app. Click the start button ',
46
48
  'to see the view reflect changes in the data. And the app is multi-window: the table and charts can be ',
@@ -49,10 +51,11 @@ class Colors extends BaseContainer {
49
51
  }, {
50
52
  flex: 'none',
51
53
  html: 'But the demo differs from the helix example because the data is provided via a <i>socket</i>.',
52
- vdom: {tag: 'p'}
54
+ tag : 'p'
53
55
  }, {
54
56
  flex: 'none',
55
- vdom: {tag: 'p'},
57
+ tag : 'p',
58
+
56
59
  html: [
57
60
  'Neo.mjs uniquely fits the bill for applications that need real-time visualizations of real-time data, such as ',
58
61
  'stock market trading data and medical or scientific telemetry.'
@@ -13,12 +13,13 @@ class Helix extends BaseContainer {
13
13
  */
14
14
  className: 'Portal.view.home.parts.Helix',
15
15
  /**
16
- * @member {Object} responsive
16
+ * @member {String[]} cls=['portal-home-parts-helix']
17
17
  */
18
- responsive: {
19
- medium: {layout: {ntype: 'vbox', align: 'stretch', pack: 'center'}},
20
- large : {layout: {ntype: 'hbox', align: 'stretch', pack: 'center'}}
21
- },
18
+ cls: ['portal-home-parts-helix'],
19
+ /**
20
+ * @member {Object} layout={ntype:'hbox',align:'stretch',pack:'center'}
21
+ */
22
+ layout: {ntype: 'hbox', align: 'stretch', pack: 'center'},
22
23
  /**
23
24
  * @member {Object[]} items
24
25
  */
@@ -32,16 +33,16 @@ class Helix extends BaseContainer {
32
33
  cls : 'neo-h1',
33
34
  flex: 'none',
34
35
  html: 'Extreme Speed',
35
- vdom: {tag: 'h1'}
36
+ tag : 'h1'
36
37
  }, {
37
38
  cls : 'neo-h2',
38
39
  flex: 'none',
39
40
  html: '40,000 Updates /s',
40
- vdom: {tag: 'h2'}
41
+ tag : 'h2'
41
42
  }, {
42
43
  cls : 'neo-h3',
43
44
  flex: 'none',
44
- vdom: {tag: 'p'},
45
+ tag : 'p',
45
46
 
46
47
  html: [
47
48
  'This demo shows the Neo.mjs helix component, along with a "Helix Controls" panel. ',
@@ -53,16 +54,16 @@ class Helix extends BaseContainer {
53
54
  cls : 'neo-h1',
54
55
  flex: 'none',
55
56
  html: 'Multi-Window',
56
- vdom: {tag: 'h1'}
57
+ tag : 'h1'
57
58
  }, {
58
59
  cls : 'neo-h2',
59
60
  flex: 'none',
60
61
  html: 'Seamless and Simple',
61
- vdom: {tag: 'h2'}
62
+ tag : 'h2'
62
63
  }, {
63
64
  cls : 'neo-h3',
64
65
  flex: 'none',
65
- vdom: {tag: 'p'},
66
+ tag : 'p',
66
67
 
67
68
  html: [
68
69
  'Click on the small window icon in the Helix Controls title bar and the controls open in their own window ',
@@ -12,12 +12,13 @@ class How extends BaseContainer {
12
12
  */
13
13
  className: 'Portal.view.home.parts.How',
14
14
  /**
15
- * @member {Object} responsive
15
+ * @member {String[]} cls=['portal-home-parts-how']
16
16
  */
17
- responsive: {
18
- medium: {layout: {ntype: 'vbox', align: 'stretch', pack: 'center'}},
19
- large : {layout: {ntype: 'hbox', align: 'stretch', pack: 'center'}}
20
- },
17
+ cls: ['portal-home-parts-how'],
18
+ /**
19
+ * @member {Object} layout={ntype:'hbox',align:'stretch',pack:'center'}
20
+ */
21
+ layout: {ntype: 'hbox', align: 'stretch', pack: 'center'},
21
22
  /**
22
23
  * @member {Object[]} items
23
24
  */
@@ -31,16 +32,17 @@ class How extends BaseContainer {
31
32
  cls : ['neo-h1'],
32
33
  flex: 'none',
33
34
  html: 'How?',
34
- vdom: {tag: 'h1'}
35
+ tag : 'h1'
35
36
  }, {
36
37
  cls : ['neo-h2'],
37
38
  flex: 'none',
38
39
  html: 'How Does Neo.mjs Do It?',
39
- vdom: {tag: 'h2'}
40
+ tag : 'h2'
40
41
  }, {
41
42
  cls : ['neo-h3'],
42
43
  flex: 'none',
43
- vdom: {tag: 'p'},
44
+ tag : 'p',
45
+
44
46
  html: [
45
47
  'When a Neo.mjs app launches three webworkers are spawned: one that holds app logic, one for tracking delta DOM updates, ',
46
48
  'and one for backend calls. Each webworker runs in its own thread, and thus, in its own processor core. ',
@@ -30,12 +30,12 @@ class References extends BaseContainer {
30
30
  cls : 'neo-h1',
31
31
  flex: 'none',
32
32
  html: 'References',
33
- vdom: {tag: 'h1'}
33
+ tag : 'h1'
34
34
  }, {
35
35
  cls : 'neo-h2',
36
36
  flex: 'none',
37
37
  html: 'What people think about Neo',
38
- vdom: {tag: 'h2'}
38
+ tag : 'h2'
39
39
  }, {
40
40
  module: Carousel,
41
41
  // will automatically change to the next extry every 5500 ms
@@ -25,19 +25,6 @@ class PageContainer extends Container {
25
25
  nextPageRecord : data => data.nextPageRecord,
26
26
  previousPageRecord: data => data.previousPageRecord
27
27
  },
28
- /**
29
- * @member {Object[]} domListeners
30
- */
31
- domListeners: [{
32
- scroll(event) {
33
- const isHomeContainer = event.target.cls.includes('portal-learn-page-container'),
34
- beyondEighty = event.scrollTop > 80;
35
-
36
- if (isHomeContainer) {
37
- this.toggleCls('hide-sidebar', beyondEighty);
38
- }
39
- }
40
- }],
41
28
  /**
42
29
  * @member {Object[]} items
43
30
  */
@@ -15,19 +15,6 @@ class Component extends BaseComponent {
15
15
  * @member {String[]} cls=['portal-services-component']
16
16
  */
17
17
  cls: ['portal-services-component'],
18
- /**
19
- * @member {Object[]} domListeners
20
- */
21
- domListeners: [{
22
- scroll(event) {
23
- const isHomeContainer = event.target.cls.includes('portal-services-component'),
24
- beyondEighty = event.scrollTop > 80;
25
-
26
- if (isHomeContainer) {
27
- this.toggleCls('hide-sidebar', beyondEighty);
28
- }
29
- }
30
- }],
31
18
  /**
32
19
  * @member {Object} vdom
33
20
  */
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='6.22.1'
23
+ * @member {String} version='6.24.0'
24
24
  */
25
- version: '6.22.1'
25
+ version: '6.24.0'
26
26
  }
27
27
 
28
28
  /**
@@ -1,16 +1,15 @@
1
- import Viewport from '../../../src/container/Viewport.mjs';
2
- import Video from '../../../src/component/Video.mjs';
3
- import Panel from '../../../src/container/Panel.mjs';
4
1
  import MainContainerController from "./MainContainerController.mjs";
2
+ import Panel from '../../../src/container/Panel.mjs';
3
+ import Video from '../../../src/component/Video.mjs';
4
+ import Viewport from '../../../src/container/Viewport.mjs';
5
5
 
6
6
  /**
7
- * @class Neo.examples.component.timer.MainContainer
7
+ * @class Neo.examples.component.video.MainContainer
8
8
  * @extends Neo.examples.Viewport
9
9
  */
10
10
  class MainContainer extends Viewport {
11
11
  static config = {
12
- className: 'Neo.examples.component.timer.MainContainer',
13
-
12
+ className : 'Neo.examples.component.timer.MainContainer',
14
13
  controller: MainContainerController,
15
14
 
16
15
  items : [{
@@ -35,7 +34,7 @@ class MainContainer extends Viewport {
35
34
  module : Video,
36
35
  url : 'https://video-ssl.itunes.apple.com/itunes-assets/Video125/v4/a0/57/54/a0575426-dd8e-2d25-bdf3-139702870b50/mzvf_786190431362224858.640x464.h264lc.U.p.m4v',
37
36
  flag : 'video-component',
38
- minHeight: 400,
37
+ minHeight: 400
39
38
  }]
40
39
  }]
41
40
  }
@@ -0,0 +1,77 @@
1
+ import Button from '../../src/button/Base.mjs';
2
+ import Video from '../../src/component/Video.mjs';
3
+ import Viewport from '../../src/container/Viewport.mjs';
4
+
5
+ /**
6
+ * @class Neo.examples.videoMove.MainContainer
7
+ * @extends Neo.container.Viewport
8
+ */
9
+ class MainContainer extends Viewport {
10
+ static config = {
11
+ className: 'Neo.examples.videoMove.MainContainer',
12
+ layout : {ntype: 'vbox', align: 'stretch'},
13
+ style : {padding: '50px'},
14
+
15
+ items: [{
16
+ ntype : 'container',
17
+ layout: {ntype: 'hbox', align: 'stretch'},
18
+
19
+ itemDefaults: {
20
+ ntype : 'container',
21
+ layout: 'fit'
22
+ },
23
+
24
+ items: [{
25
+ reference: 'container-1',
26
+ style : {backgroundColor: 'rgb(139,166,255)', padding: '50px'},
27
+
28
+ items: [{
29
+ module : Video,
30
+ playing: true,
31
+ url : 'https://video-ssl.itunes.apple.com/itunes-assets/Video125/v4/a0/57/54/a0575426-dd8e-2d25-bdf3-139702870b50/mzvf_786190431362224858.640x464.h264lc.U.p.m4v'
32
+ }]
33
+ }, {
34
+ reference: 'container-2',
35
+ style : {backgroundColor: 'rgb(139,166,255)', marginLeft: '50px', padding: '50px'}
36
+ }]
37
+ }, {
38
+ ntype : 'container',
39
+ layout: {ntype: 'vbox', align: 'start'},
40
+ style : {marginTop: '50px'},
41
+
42
+ items: [{
43
+ module : Button,
44
+ handler: 'up.onMoveVideoButtonClick',
45
+ text : 'Move Video'
46
+ }]
47
+ }]
48
+ }
49
+
50
+ /**
51
+ *
52
+ * @param {Object} data
53
+ */
54
+ onMoveVideoButtonClick(data) {
55
+ let me = this,
56
+ container1 = me.getReference('container-1'),
57
+ container2 = me.getReference('container-2');
58
+
59
+ container1.silentVdomUpdate = true;
60
+ container2.silentVdomUpdate = true;
61
+
62
+ if (container2.items.length < 1) {
63
+ container2.add(container1.removeAt(0, false))
64
+ } else {
65
+ container1.add(container2.removeAt(0, false))
66
+ }
67
+
68
+ me.promiseUpdate().then(() => {
69
+ container1.silentVdomUpdate = false;
70
+ container2.silentVdomUpdate = false
71
+ })
72
+ }
73
+ }
74
+
75
+ Neo.setupClass(MainContainer);
76
+
77
+ export default MainContainer;
@@ -0,0 +1,6 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ export const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.videoMove'
6
+ });
@@ -0,0 +1,11 @@
1
+ <!DOCTYPE HTML>
2
+ <html>
3
+ <head>
4
+ <meta name="viewport" content="width=device-width, initial-scale=1">
5
+ <meta charset="UTF-8">
6
+ <title>Neo.mjs - Moving a Video Tag</title>
7
+ </head>
8
+ <body>
9
+ <script src="../../src/MicroLoader.mjs" type="module"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,6 @@
1
+ {
2
+ "appPath" : "examples/videoMove/app.mjs",
3
+ "basePath" : "../../",
4
+ "environment": "development",
5
+ "mainPath" : "./Main.mjs"
6
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "6.22.1",
3
+ "version": "6.24.0",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -52,7 +52,7 @@
52
52
  "envinfo": "^7.13.0",
53
53
  "fs-extra": "^11.2.0",
54
54
  "highlightjs-line-numbers.js": "^2.8.0",
55
- "inquirer": "^10.1.4",
55
+ "inquirer": "^10.1.6",
56
56
  "marked": "^13.0.3",
57
57
  "monaco-editor": "^0.50.0",
58
58
  "neo-jsdoc": "1.0.1",
@@ -37,17 +37,18 @@
37
37
  }
38
38
 
39
39
  .separate-bar {
40
- animation: fade-in-animation 200ms linear;
41
- box-shadow: 0 5px 10px rgba(0,0,0,.3);
42
- position: absolute;
43
- right : 0;
44
- top : 58px;
45
- z-index : 9;
40
+ animation : fade-in-animation 200ms linear;
41
+ box-shadow : 0 5px 10px rgba(0,0,0,.3);
42
+ flex-direction: column;
43
+ position : absolute;
44
+ right : 0;
45
+ top : 58px;
46
+ z-index : 9;
46
47
  }
47
48
 
48
49
  // find parallel class hide-sidebar
49
50
  &:has(+div .hide-sidebar) .separate-bar {
50
- animation: fade-animation 200ms linear forwards;
51
+ animation: fade-out-animation 200ms linear forwards;
51
52
  }
52
53
  }
53
54
 
@@ -118,22 +119,22 @@
118
119
  @keyframes fade-in-animation {
119
120
  from {
120
121
  opacity: 0;
121
- right : -10px
122
+ right : -30px
122
123
  }
123
124
  to {
124
125
  opacity: 1;
125
- right : 20px;
126
+ right : 0;
126
127
  }
127
128
  }
128
129
 
129
- @keyframes fade-animation {
130
+ @keyframes fade-out-animation {
130
131
  from {
131
132
  opacity: 1;
132
- right : 20px;
133
+ right : 0;
133
134
  }
134
135
  to {
135
136
  opacity: 0;
136
- right : -10px
137
+ right : -30px
137
138
  }
138
139
  }
139
140
 
@@ -50,8 +50,9 @@
50
50
  }
51
51
 
52
52
  @media (max-width: 600px) {
53
- min-width: 100%;
54
- padding : 1em;
53
+ min-height: 300px;
54
+ min-width : 100%;
55
+ padding : 1em;
55
56
 
56
57
  .portal-profiles {
57
58
  flex-direction: column;
@@ -0,0 +1,7 @@
1
+ .portal-home-parts-colors {
2
+ @media (max-width: 840px) {
3
+ &.neo-flex-container {
4
+ flex-direction: column;
5
+ }
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ .portal-home-parts-helix {
2
+ @media (max-width: 840px) {
3
+ &.neo-flex-container {
4
+ flex-direction: column;
5
+ }
6
+ }
7
+ }
@@ -0,0 +1,7 @@
1
+ .portal-home-parts-how {
2
+ @media (max-width: 840px) {
3
+ &.neo-flex-container {
4
+ flex-direction: column;
5
+ }
6
+ }
7
+ }
@@ -260,12 +260,12 @@ const DefaultConfig = {
260
260
  useVdomWorker: true,
261
261
  /**
262
262
  * buildScripts/injectPackageVersion.mjs will update this value
263
- * @default '6.22.1'
263
+ * @default '6.24.0'
264
264
  * @memberOf! module:Neo
265
265
  * @name config.version
266
266
  * @type String
267
267
  */
268
- version: '6.22.1'
268
+ version: '6.24.0'
269
269
  };
270
270
 
271
271
  Object.assign(DefaultConfig, {