neo.mjs 6.17.1 → 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.
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/portal/view/HeaderToolbar.mjs +44 -27
- package/apps/portal/view/Viewport.mjs +12 -1
- package/apps/portal/view/home/MainContainer.mjs +28 -60
- package/apps/portal/view/home/parts/AfterMath.mjs +58 -0
- package/apps/portal/view/home/parts/CoolStuff.mjs +82 -0
- package/apps/portal/view/home/parts/Features.mjs +52 -0
- package/apps/portal/view/home/parts/HelloWorld.mjs +82 -0
- package/apps/portal/view/home/parts/MainNeo.mjs +55 -0
- package/apps/portal/view/home/preview/PageCodeContainer.mjs +55 -0
- package/apps/portal/view/learn/LivePreview.mjs +16 -14
- package/buildScripts/webpack/webpack.server.config.mjs +4 -1
- package/examples/ServiceWorker.mjs +2 -2
- package/package.json +4 -4
- package/resources/images/Neo_Logo_Blue.svg +6 -0
- package/resources/images/Neo_Logo_Text.svg +5 -0
- package/resources/images/Neo_Logo_White.svg +6 -0
- package/resources/scss/src/apps/portal/HeaderToolbar.scss +189 -17
- package/resources/scss/src/apps/portal/home/MainContainer.scss +46 -20
- package/resources/scss/src/apps/portal/home/parts/Features.scss +3 -0
- package/resources/scss/src/apps/portal/home/preview/PageCodeContainer.scss +115 -0
- package/resources/scss/src/component/Base.scss +2 -0
- package/src/DefaultConfig.mjs +2 -2
- package/src/component/Base.mjs +139 -71
- package/src/component/wrapper/MonacoEditor.mjs +1 -6
- package/src/container/Base.mjs +5 -5
- package/src/container/Viewport.mjs +30 -1
- package/src/manager/DomEvent.mjs +11 -6
- package/src/plugin/Responsive.mjs +175 -0
- package/src/util/Logger.mjs +3 -3
- package/resources/images/Neo_Vector.svg +0 -3
- package/resources/images/logos/Github-logo-black.svg +0 -1
- package/resources/images/logos/Slack-logo-black.svg +0 -17
package/apps/ServiceWorker.mjs
CHANGED
@@ -26,9 +26,12 @@ class HeaderToolbar extends Base {
|
|
26
26
|
* @member {Object[]} items
|
27
27
|
*/
|
28
28
|
items: [{
|
29
|
-
cls
|
30
|
-
|
31
|
-
|
29
|
+
cls : ['logo'],
|
30
|
+
id : 'neo-logo-button',
|
31
|
+
minWidth: 60,
|
32
|
+
iconCls : 'neo-logo-blue',
|
33
|
+
route : '/home',
|
34
|
+
text : 'neo.mjs'
|
32
35
|
}, '->', {
|
33
36
|
text : 'Learn',
|
34
37
|
route: '/learn'
|
@@ -40,30 +43,44 @@ class HeaderToolbar extends Base {
|
|
40
43
|
text : 'Docs',
|
41
44
|
route: '/docs'
|
42
45
|
}, {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
46
|
+
ntype : 'container',
|
47
|
+
layout: 'hbox',
|
48
|
+
|
49
|
+
responsive: {
|
50
|
+
medium: { cls: ['separate-bar'], layout: 'vbox' },
|
51
|
+
large : { cls: ['inline'], layout: 'hbox' }
|
52
|
+
},
|
53
|
+
|
54
|
+
itemDefaults: {
|
55
|
+
ntype: 'button',
|
56
|
+
ui : 'ghost'
|
57
|
+
},
|
58
|
+
|
59
|
+
items: [{
|
60
|
+
iconCls: 'fa-brands fa-github',
|
61
|
+
url : 'https://github.com/neomjs/neo',
|
62
|
+
tooltip: {
|
63
|
+
html : 'GitHub',
|
64
|
+
showDelay: '0',
|
65
|
+
hideDelay: '0'
|
66
|
+
}
|
67
|
+
}, {
|
68
|
+
iconCls: 'fa-brands fa-slack',
|
69
|
+
url : 'https://join.slack.com/t/neomjs/shared_invite/zt-6c50ueeu-3E1~M4T9xkNnb~M_prEEOA',
|
70
|
+
tooltip: {
|
71
|
+
html : 'Join Slack',
|
72
|
+
showDelay: '0',
|
73
|
+
hideDelay: '0'
|
74
|
+
}
|
75
|
+
}, {
|
76
|
+
iconCls: 'fa-brands fa-discord',
|
77
|
+
url : 'https://discord.gg/6p8paPq',
|
78
|
+
tooltip: {
|
79
|
+
html : 'Join Discord',
|
80
|
+
showDelay: '0',
|
81
|
+
hideDelay: '0'
|
82
|
+
}
|
83
|
+
}]
|
67
84
|
}]
|
68
85
|
}
|
69
86
|
}
|
@@ -28,6 +28,10 @@ class Viewport extends BaseViewport {
|
|
28
28
|
* @member {Neo.controller.Component} controller=ViewportController
|
29
29
|
*/
|
30
30
|
controller: ViewportController,
|
31
|
+
/**
|
32
|
+
* @member {Object} layout={ntype:'vbox',align:'stretch'}
|
33
|
+
*/
|
34
|
+
layout: {ntype: 'vbox', align: 'stretch'},
|
31
35
|
/**
|
32
36
|
* @member {Object[]} items
|
33
37
|
*/
|
@@ -50,6 +54,10 @@ class Viewport extends BaseViewport {
|
|
50
54
|
* @member {Neo.model.Component} model=ViewportModel
|
51
55
|
*/
|
52
56
|
model: ViewportModel,
|
57
|
+
/**
|
58
|
+
* @member {Boolean} monitorSize=true
|
59
|
+
*/
|
60
|
+
monitorSize: true,
|
53
61
|
/**
|
54
62
|
* Values are: large, medium, small, xSmall
|
55
63
|
* @member {String|null} size_=null
|
@@ -62,7 +70,10 @@ class Viewport extends BaseViewport {
|
|
62
70
|
*/
|
63
71
|
construct(config) {
|
64
72
|
super.construct(config);
|
65
|
-
|
73
|
+
|
74
|
+
let me = this;
|
75
|
+
|
76
|
+
me.on('resize', me.onResize, me)
|
66
77
|
}
|
67
78
|
|
68
79
|
/**
|
@@ -1,12 +1,15 @@
|
|
1
|
-
import
|
1
|
+
import AfterMath from './parts/AfterMath.mjs';
|
2
2
|
import Container from '../../../../src/container/Base.mjs';
|
3
|
-
import
|
3
|
+
import CoolStuff from './parts/CoolStuff.mjs';
|
4
|
+
import Features from './parts/Features.mjs';
|
5
|
+
import HelloWorld from './parts/HelloWorld.mjs';
|
6
|
+
import MainNeo from './parts/MainNeo.mjs';
|
4
7
|
|
5
8
|
/**
|
6
9
|
* @class Portal.view.home.MainContainer
|
7
10
|
* @extends Neo.container.Base
|
8
11
|
*/
|
9
|
-
class
|
12
|
+
class MainContainer extends Container {
|
10
13
|
static config = {
|
11
14
|
/**
|
12
15
|
* @member {String} className='Portal.view.home.MainContainer'
|
@@ -14,71 +17,36 @@ class Viewport extends Container {
|
|
14
17
|
*/
|
15
18
|
className: 'Portal.view.home.MainContainer',
|
16
19
|
/**
|
17
|
-
* @member {String[]} cls=['
|
20
|
+
* @member {String[]} cls=['portal-home-maincontainer']
|
18
21
|
*/
|
19
|
-
cls: ['
|
22
|
+
cls: ['portal-home-maincontainer'],
|
20
23
|
/**
|
21
|
-
* @member {Object}
|
24
|
+
* @member {Object[]} items
|
22
25
|
*/
|
23
|
-
|
26
|
+
items: [
|
27
|
+
{
|
28
|
+
ntype: 'component',
|
29
|
+
id : 'progress'
|
30
|
+
},
|
31
|
+
MainNeo,
|
32
|
+
Features,
|
33
|
+
HelloWorld,
|
34
|
+
CoolStuff,
|
35
|
+
AfterMath
|
36
|
+
],
|
24
37
|
/**
|
25
|
-
* @member {
|
38
|
+
* @member {Boolean} scrollable=true
|
26
39
|
*/
|
27
|
-
|
28
|
-
cls : ['vector'],
|
29
|
-
flex : 'none'
|
30
|
-
}, {
|
31
|
-
cls : 'neo-h1',
|
32
|
-
flex: 'none',
|
33
|
-
html: 'The High-Performance Web Framework for Next Generation Interfaces'
|
34
|
-
}, {
|
35
|
-
module: Container,
|
36
|
-
cls : ['button-group'],
|
37
|
-
flex : 'none',
|
38
|
-
layout: {ntype: 'hbox'},
|
39
|
-
|
40
|
-
items: [{
|
41
|
-
module: Button,
|
42
|
-
flex : 'none',
|
43
|
-
text : 'View on GitHub',
|
44
|
-
ui : 'secondary',
|
45
|
-
url : 'https://github.com/neomjs/neo'
|
46
|
-
}, {
|
47
|
-
module: Button,
|
48
|
-
flex : 'none',
|
49
|
-
text : 'Get started',
|
50
|
-
route : '/learn'
|
51
|
-
}]
|
52
|
-
}, {
|
53
|
-
module: Container,
|
54
|
-
flex : '1 0 auto',
|
55
|
-
layout: {ntype: 'hbox', align: 'stretch'},
|
56
|
-
|
57
|
-
items: [{
|
58
|
-
module: ContentBox,
|
59
|
-
header: 'Next-Generation Runtime',
|
60
|
-
route : '#/learn/WhyNeo-Quick',
|
61
|
-
|
62
|
-
content: [
|
63
|
-
'Multi-threaded',
|
64
|
-
'Elegant state management',
|
65
|
-
'Simple and powerful debugging'
|
66
|
-
]
|
67
|
-
}, {
|
68
|
-
module: ContentBox,
|
69
|
-
header: 'Extreme Speed',
|
70
|
-
route : '#/learn/WhyNeo-Speed',
|
40
|
+
scrollable: true,
|
71
41
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
]
|
77
|
-
}]
|
42
|
+
domListeners: [{
|
43
|
+
scroll(event) {
|
44
|
+
this.toggleCls('hide-sidebar', event.scrollTop > 80)
|
45
|
+
}
|
78
46
|
}]
|
79
47
|
}
|
80
48
|
}
|
81
49
|
|
82
|
-
Neo.setupClass(
|
50
|
+
Neo.setupClass(MainContainer);
|
83
51
|
|
84
|
-
export default
|
52
|
+
export default MainContainer;
|
@@ -0,0 +1,58 @@
|
|
1
|
+
import Container from '../../../../../src/container/Base.mjs';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* @class Portal.view.home.parts.AfterMath
|
5
|
+
* @extends Neo.container.Base
|
6
|
+
*/
|
7
|
+
class AfterMath extends Container {
|
8
|
+
static config = {
|
9
|
+
/**
|
10
|
+
* @member {String} className='Portal.view.home.parts.AfterMath'
|
11
|
+
* @protected
|
12
|
+
*/
|
13
|
+
className: 'Portal.view.home.parts.AfterMath',
|
14
|
+
|
15
|
+
cls: ['page', 'after-math'],
|
16
|
+
|
17
|
+
layout: {ntype: 'vbox', align: 'stretch', pack: 'center'},
|
18
|
+
/**
|
19
|
+
* @member {Object[]} items
|
20
|
+
*/
|
21
|
+
items: [{
|
22
|
+
module: Container,
|
23
|
+
flex : 1
|
24
|
+
}, {
|
25
|
+
cls : 'neo-h1',
|
26
|
+
flex: 'none',
|
27
|
+
html: 'Additional Stuff'
|
28
|
+
}, {
|
29
|
+
cls : 'neo-h2',
|
30
|
+
flex: 'none',
|
31
|
+
html: 'More to come her',
|
32
|
+
// height: 200
|
33
|
+
}, {
|
34
|
+
cls : 'neo-content',
|
35
|
+
flex: 'none',
|
36
|
+
html: 'Neo uses several cores to run the application. See the spinner on the page?',
|
37
|
+
// height: 200
|
38
|
+
}, {
|
39
|
+
module: Container,
|
40
|
+
flex : 1
|
41
|
+
}, {
|
42
|
+
module: Container,
|
43
|
+
cls : 'home-footer',
|
44
|
+
height: '40%',
|
45
|
+
style : { // todo: css
|
46
|
+
background: 'black',
|
47
|
+
color : 'white',
|
48
|
+
height : '40%',
|
49
|
+
padding : '15px'
|
50
|
+
},
|
51
|
+
html : 'This is the footer'
|
52
|
+
}]
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
Neo.setupClass(AfterMath);
|
57
|
+
|
58
|
+
export default AfterMath;
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import Container from '../../../../../src/container/Base.mjs';
|
2
|
+
import LivePreview from '../../learn/LivePreview.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Portal.view.home.parts.CoolStuff
|
6
|
+
* @extends Neo.container.Base
|
7
|
+
*/
|
8
|
+
class CoolStuff extends Container {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Portal.view.home.parts.CoolStuff'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Portal.view.home.parts.CoolStuff',
|
15
|
+
|
16
|
+
cls: ['page', 'cool-stuff'],
|
17
|
+
|
18
|
+
responsive: {
|
19
|
+
medium: {layout: {ntype: 'vbox', align: 'stretch', pack: 'center'}},
|
20
|
+
large : {layout: {ntype: 'hbox', align: 'stretch', pack: 'center'}}
|
21
|
+
},
|
22
|
+
|
23
|
+
/**
|
24
|
+
* @member {Object[]} items
|
25
|
+
*/
|
26
|
+
items: [{
|
27
|
+
module: Container,
|
28
|
+
flex : '1',
|
29
|
+
style : {padding: '2rem'},
|
30
|
+
layout: {ntype: 'vbox', align: 'center', pack: 'center'},
|
31
|
+
items : [{
|
32
|
+
cls : 'neo-h1',
|
33
|
+
flex: 'none',
|
34
|
+
html: 'Cool Stuff'
|
35
|
+
}, {
|
36
|
+
cls : 'neo-h2',
|
37
|
+
flex: 'none',
|
38
|
+
html: 'WOW - See the power of Neo',
|
39
|
+
// height: 200
|
40
|
+
}, {
|
41
|
+
cls : 'neo-content',
|
42
|
+
flex: 'none',
|
43
|
+
html: 'Neo uses several cores to run the application. See the spinner on the page?',
|
44
|
+
// height: 200
|
45
|
+
}]
|
46
|
+
}, {
|
47
|
+
module: Container,
|
48
|
+
flex : '0.8',
|
49
|
+
// responsive: {
|
50
|
+
// medium: {flex: '1.2'},
|
51
|
+
// large: {flex: '0.6'}
|
52
|
+
// },
|
53
|
+
style : {background: 'grey', padding: '20px'},
|
54
|
+
layout: {ntype: 'vbox', align: 'stretch', pack: 'center'},
|
55
|
+
items : [{
|
56
|
+
module: LivePreview,
|
57
|
+
cls : ['page-live-preview'],
|
58
|
+
style : {background: 'white'},
|
59
|
+
value : [
|
60
|
+
"import Container from '../../../../src/container/Base.mjs';",
|
61
|
+
"",
|
62
|
+
"class MainView extends Container {",
|
63
|
+
" static config = {",
|
64
|
+
" className: 'Portal.view.MainView',",
|
65
|
+
" layout : {ntype:'vbox', align:'stretch'},",
|
66
|
+
" items : [{",
|
67
|
+
" module: Container,",
|
68
|
+
" html : 'Hello World'",
|
69
|
+
" }]",
|
70
|
+
" }",
|
71
|
+
"}",
|
72
|
+
"",
|
73
|
+
"Neo.setupClass(MainView);"
|
74
|
+
].join('\n')
|
75
|
+
}]
|
76
|
+
}]
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
Neo.setupClass(CoolStuff);
|
81
|
+
|
82
|
+
export default CoolStuff;
|
@@ -0,0 +1,52 @@
|
|
1
|
+
import Container from '../../../../../src/container/Base.mjs';
|
2
|
+
import ContentBox from '../ContentBox.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Portal.view.home.parts.Features
|
6
|
+
* @extends Neo.container.Base
|
7
|
+
*/
|
8
|
+
class Features extends Container {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Portal.view.home.parts.Features'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Portal.view.home.parts.Features',
|
15
|
+
/**
|
16
|
+
* @member {String[]} cls=['portal-home-features','page']
|
17
|
+
*/
|
18
|
+
cls: ['portal-home-features', 'page'],
|
19
|
+
/**
|
20
|
+
* @member {Object} layout={ntype:'hbox',align:'stretch',wrap:'wrap'}
|
21
|
+
*/
|
22
|
+
layout: {ntype: 'hbox', align: 'stretch', wrap: 'wrap'},
|
23
|
+
/**
|
24
|
+
* @member {Object[]} items
|
25
|
+
*/
|
26
|
+
items: [{
|
27
|
+
module: ContentBox,
|
28
|
+
header: 'Next-Generation Runtime',
|
29
|
+
route : '#/learn/WhyNeo-Quick',
|
30
|
+
|
31
|
+
content: [
|
32
|
+
'Multi-threaded',
|
33
|
+
'Elegant state management',
|
34
|
+
'Simple and powerful debugging'
|
35
|
+
]
|
36
|
+
}, {
|
37
|
+
module: ContentBox,
|
38
|
+
header: 'Extreme Speed',
|
39
|
+
route : '#/learn/WhyNeo-Speed',
|
40
|
+
|
41
|
+
content: [
|
42
|
+
'Multi-threaded',
|
43
|
+
'Over 40,000 delta updates per second',
|
44
|
+
'Item 3'
|
45
|
+
]
|
46
|
+
}]
|
47
|
+
}
|
48
|
+
}
|
49
|
+
|
50
|
+
Neo.setupClass(Features);
|
51
|
+
|
52
|
+
export default Features;
|
@@ -0,0 +1,82 @@
|
|
1
|
+
import Container from '../../../../../src/container/Base.mjs';
|
2
|
+
import LivePreviewContainer from '../preview/PageCodeContainer.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Portal.view.home.parts.HelloWorld
|
6
|
+
* @extends Neo.container.Base
|
7
|
+
*/
|
8
|
+
class HelloWorld extends Container {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Portal.view.home.parts.HelloWorld'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Portal.view.home.parts.HelloWorld',
|
15
|
+
|
16
|
+
cls: ['page', 'hello-world'],
|
17
|
+
/**
|
18
|
+
* @member {Object} layout=null
|
19
|
+
*/
|
20
|
+
// layout: null,
|
21
|
+
|
22
|
+
responsiveConfig: {
|
23
|
+
oldPhone: {maxWidth: 320},
|
24
|
+
phone : {maxWidth: 480},
|
25
|
+
tablet : {maxWidth: 770},
|
26
|
+
medium : {maxWidth: 840},
|
27
|
+
large : {minWidth: 841}
|
28
|
+
},
|
29
|
+
|
30
|
+
responsive: {
|
31
|
+
medium: {layout: {ntype: 'vbox', align: 'stretch', pack: 'center'}},
|
32
|
+
large : {layout: {ntype: 'hbox', align: 'stretch', pack: 'center'}}
|
33
|
+
},
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @member {Object[]} items
|
37
|
+
*/
|
38
|
+
items: [{
|
39
|
+
module: Container,
|
40
|
+
flex : '1',
|
41
|
+
style : {padding: '2rem'},
|
42
|
+
layout: {ntype: 'vbox', align: 'center', pack: 'center'},
|
43
|
+
items : [{
|
44
|
+
cls : 'neo-h1',
|
45
|
+
id : 'neo-hello-world-h1',
|
46
|
+
flex: 'none',
|
47
|
+
html: 'Hello World'
|
48
|
+
}, {
|
49
|
+
cls : 'neo-h2',
|
50
|
+
flex: 'none',
|
51
|
+
html: 'Your first code snippet'
|
52
|
+
}, {
|
53
|
+
cls : 'neo-content',
|
54
|
+
flex: 'none',
|
55
|
+
html: 'If you understand these lines, you are ready to start with Neo.mjs'
|
56
|
+
}]
|
57
|
+
}, {
|
58
|
+
module: LivePreviewContainer,
|
59
|
+
flex: 0.8,
|
60
|
+
value : [
|
61
|
+
"import Container from '../../../../src/container/Base.mjs';",
|
62
|
+
"",
|
63
|
+
"class MainView extends Container {",
|
64
|
+
" static config = {",
|
65
|
+
" className: 'Portal.view.MainView',",
|
66
|
+
" layout : {ntype:'vbox', align:'stretch'},",
|
67
|
+
" items : [{",
|
68
|
+
" module: Container,",
|
69
|
+
" html : 'Hello World'",
|
70
|
+
" }]",
|
71
|
+
" }",
|
72
|
+
"}",
|
73
|
+
"",
|
74
|
+
"Neo.setupClass(MainView);"
|
75
|
+
].join('\n')
|
76
|
+
}]
|
77
|
+
}
|
78
|
+
}
|
79
|
+
|
80
|
+
Neo.setupClass(HelloWorld);
|
81
|
+
|
82
|
+
export default HelloWorld;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import Button from '../../../../../src/button/Base.mjs';
|
2
|
+
import Container from '../../../../../src/container/Base.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Portal.view.home.parts.MainNeo
|
6
|
+
* @extends Neo.container.Base
|
7
|
+
*/
|
8
|
+
class MainNeo extends Container {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Portal.view.home.parts.MainNeo'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Portal.view.home.parts.MainNeo',
|
15
|
+
|
16
|
+
cls: ['page', 'landing-page'],
|
17
|
+
|
18
|
+
layout: {ntype: 'vbox', align: 'center', pack: 'center'},
|
19
|
+
/**
|
20
|
+
* @member {Object[]} items
|
21
|
+
*/
|
22
|
+
items: [{
|
23
|
+
module: Container,
|
24
|
+
cls : ['vector'],
|
25
|
+
flex : 'none',
|
26
|
+
}, {
|
27
|
+
cls : 'neo-h1',
|
28
|
+
flex: 'none',
|
29
|
+
html: 'The High-Performance Web Framework for Next Generation Interfaces'
|
30
|
+
}, {
|
31
|
+
module: Container,
|
32
|
+
cls : ['button-group'],
|
33
|
+
flex : 'none',
|
34
|
+
|
35
|
+
items: [{
|
36
|
+
module : Button,
|
37
|
+
cls : ['get-started-button'],
|
38
|
+
text : 'Get started',
|
39
|
+
flex : 'none',
|
40
|
+
route : '/learn'
|
41
|
+
}, {
|
42
|
+
module: Button,
|
43
|
+
cls : ['neo-github'],
|
44
|
+
flex : 'none',
|
45
|
+
text : 'View on GitHub',
|
46
|
+
ui : 'secondary',
|
47
|
+
url : 'https://github.com/neomjs/neo'
|
48
|
+
}]
|
49
|
+
}]
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
Neo.setupClass(MainNeo);
|
54
|
+
|
55
|
+
export default MainNeo;
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import Container from '../../../../../src/container/Base.mjs';
|
2
|
+
import LivePreview from '../../learn/LivePreview.mjs';
|
3
|
+
|
4
|
+
/**
|
5
|
+
* @class Portal.view.home.preview.PageCodeContainer
|
6
|
+
* @extends Neo.container.Base
|
7
|
+
*/
|
8
|
+
class PageCodeContainer extends Container {
|
9
|
+
static config = {
|
10
|
+
/**
|
11
|
+
* @member {String} className='Portal.view.home.preview.PageCodeContainer'
|
12
|
+
* @protected
|
13
|
+
*/
|
14
|
+
className: 'Portal.view.home.preview.PageCodeContainer',
|
15
|
+
/**
|
16
|
+
* @member {String} ntype='page-code-container'
|
17
|
+
* @protected
|
18
|
+
*/
|
19
|
+
ntype: 'page-code-container',
|
20
|
+
/**
|
21
|
+
* @member {String[]} cls=['page-code-container']
|
22
|
+
* @protected
|
23
|
+
*/
|
24
|
+
cls: ['page-code-container'],
|
25
|
+
/**
|
26
|
+
* @member {Object} layout={ntype:'vbox',align:'stretch',pack:'center'}
|
27
|
+
*/
|
28
|
+
layout: {ntype: 'vbox', align: 'stretch', pack: 'center'},
|
29
|
+
/**
|
30
|
+
* @member {Object[]} items
|
31
|
+
*/
|
32
|
+
items : [{
|
33
|
+
module: LivePreview,
|
34
|
+
cls : ['live-preview']
|
35
|
+
}],
|
36
|
+
/**
|
37
|
+
* @member {String|null} value_=null
|
38
|
+
*/
|
39
|
+
value_: null,
|
40
|
+
}
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Triggered after the size config got changed
|
44
|
+
* @param {String|null} value
|
45
|
+
* @param {String|null} oldValue
|
46
|
+
* @protected
|
47
|
+
*/
|
48
|
+
afterSetValue(value, oldValue) {
|
49
|
+
this.items[0].value = value
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
Neo.setupClass(PageCodeContainer);
|
54
|
+
|
55
|
+
export default PageCodeContainer;
|
@@ -137,7 +137,7 @@ class LivePreview extends Container {
|
|
137
137
|
} else if (line.match(exportRegex)) {
|
138
138
|
// Skip export statements
|
139
139
|
} else {
|
140
|
-
cleanLines.push(line);
|
140
|
+
cleanLines.push(` ${line}`);
|
141
141
|
}
|
142
142
|
});
|
143
143
|
|
@@ -161,21 +161,23 @@ class LivePreview extends Container {
|
|
161
161
|
|
162
162
|
let promises = moduleNameAndPath.map(item => {
|
163
163
|
params.push(`${item.moduleName}Module`);
|
164
|
-
vars.push(`const ${item.moduleName} = ${item.moduleName}Module.default
|
165
|
-
return `import(
|
164
|
+
vars.push(` const ${item.moduleName} = ${item.moduleName}Module.default;`);
|
165
|
+
return `import('${item.path}')`
|
166
166
|
});
|
167
167
|
|
168
|
-
const codeString =
|
169
|
-
Promise.all([
|
170
|
-
|
171
|
-
])
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
168
|
+
const codeString = [
|
169
|
+
'Promise.all([',
|
170
|
+
` ${promises.join(',\n')}`,
|
171
|
+
`]).then(([${params.join(', ')}]) => {`,
|
172
|
+
`${vars.join('\n')}`,
|
173
|
+
` ${cleanLines.join('\n')}`,
|
174
|
+
'',
|
175
|
+
` if (${className} && Neo.component.Base.isPrototypeOf(${className})) {`,
|
176
|
+
` container.add({module:${className}})`,
|
177
|
+
' }',
|
178
|
+
'})',
|
179
|
+
'.catch(error => container.add({ntype:\'component\', html:error.message}));'
|
180
|
+
].join('\n')
|
179
181
|
|
180
182
|
const container = me.getPreviewContainer();
|
181
183
|
container.removeAll();
|