neo.mjs 6.18.2 → 6.19.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.
- package/README.md +28 -214
- package/apps/ServiceWorker.mjs +2 -2
- package/apps/colors/view/ViewportController.mjs +7 -3
- package/apps/portal/data/blog.json +13 -0
- package/apps/portal/view/HeaderToolbar.mjs +2 -2
- package/apps/portal/view/Viewport.mjs +4 -2
- package/apps/portal/view/ViewportController.mjs +89 -8
- package/apps/portal/view/blog/Container.mjs +8 -8
- package/apps/portal/view/blog/List.mjs +6 -6
- package/apps/portal/view/home/MainContainer.mjs +9 -10
- package/apps/portal/view/home/parts/BaseContainer.mjs +8 -1
- package/apps/portal/view/home/parts/Colors.mjs +4 -4
- package/apps/portal/view/home/parts/Helix.mjs +2 -2
- package/apps/portal/view/home/parts/How.mjs +3 -3
- package/apps/portal/view/home/parts/MainNeo.mjs +6 -7
- package/apps/portal/view/home/parts/References.mjs +88 -0
- package/apps/portal/view/learn/ContentView.mjs +3 -1
- package/apps/portal/view/learn/MainContainer.mjs +3 -2
- package/apps/portal/view/learn/MainContainerController.mjs +11 -0
- package/apps/portal/view/learn/PageContainer.mjs +5 -3
- package/apps/portal/view/services/Component.mjs +73 -0
- package/apps/website/data/blog.json +13 -0
- package/examples/ServiceWorker.mjs +2 -2
- package/examples/component/carousel/MainContainer.mjs +42 -33
- package/examples/layout/cube/MainContainer.mjs +217 -0
- package/examples/layout/cube/app.mjs +6 -0
- package/examples/layout/cube/index.html +11 -0
- package/examples/layout/cube/neo-config.json +6 -0
- package/package.json +7 -7
- package/resources/data/deck/learnneo/pages/2023-10-14T19-25-08-153Z.md +2 -2
- package/resources/data/deck/learnneo/pages/ComponentModels.md +6 -6
- package/resources/data/deck/learnneo/pages/ComponentsAndContainers.md +10 -10
- package/resources/data/deck/learnneo/pages/Config.md +6 -6
- package/resources/data/deck/learnneo/pages/CustomComponents.md +4 -4
- package/resources/data/deck/learnneo/pages/DescribingTheUI.md +4 -4
- package/resources/data/deck/learnneo/pages/Earthquakes-01-goals.md +32 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-01-generate-a-workspace.md +47 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-02-generate-the-starter-app.md +150 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-03-debugging.md +136 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-04-fetch-data.md +146 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-05-refactor-the-table.md +146 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-06-use-a-view-model.md +301 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-07-use-the-google-maps-addon.md +175 -0
- package/resources/data/deck/learnneo/pages/Earthquakes-Lab-08-events.md +38 -0
- package/resources/data/deck/learnneo/pages/Earthquakes.md +10 -10
- package/resources/data/deck/learnneo/pages/Events.md +7 -7
- package/resources/data/deck/learnneo/pages/Extending.md +7 -7
- package/resources/data/deck/learnneo/pages/Glossary.md +0 -0
- package/resources/data/deck/learnneo/pages/GuideEvents.md +97 -19
- package/resources/data/deck/learnneo/pages/GuideViewModels.md +21 -21
- package/resources/data/deck/learnneo/pages/References.md +8 -8
- package/resources/data/deck/learnneo/pages/TestLivePreview.md +5 -4
- package/resources/data/deck/learnneo/pages/TodoList.md +9 -9
- package/resources/data/deck/learnneo/pages/Welcome.md +3 -3
- package/resources/data/deck/learnneo/pages/WhyNeo-Multi-Window.md +2 -2
- package/resources/data/deck/learnneo/pages/WhyNeo-Speed.md +2 -2
- package/resources/data/deck/learnneo/tree.json +2 -1
- package/resources/images/apps/portal/neo-references.png +0 -0
- package/resources/scss/src/apps/portal/HeaderToolbar.scss +0 -46
- package/resources/scss/src/apps/portal/Viewport.scss +16 -1
- package/resources/scss/src/apps/portal/blog/Container.scss +7 -7
- package/resources/scss/src/apps/portal/blog/List.scss +20 -16
- package/resources/scss/src/apps/portal/home/parts/BaseContainer.scss +33 -4
- package/resources/scss/src/apps/portal/home/parts/MainNeo.scss +4 -5
- package/resources/scss/src/apps/portal/home/parts/References.scss +46 -0
- package/resources/scss/src/apps/portal/learn/ContentTreeList.scss +20 -0
- package/resources/scss/src/apps/portal/learn/ContentView.scss +4 -0
- package/resources/scss/src/apps/portal/learn/MainContainer.scss +1 -1
- package/resources/scss/src/apps/portal/learn/PageContainer.scss +22 -16
- package/resources/scss/src/apps/portal/services/Component.scss +20 -0
- package/resources/scss/src/{apps/portal/learn → code}/LivePreview.scss +1 -1
- package/resources/scss/src/component/Carousel.scss +21 -0
- package/resources/scss/src/component/Helix.scss +1 -2
- package/resources/scss/src/examples/layout/cube/MainContainer.scss +7 -0
- package/resources/scss/src/layout/Cube.scss +80 -0
- package/resources/scss/src/tab/Container.scss +10 -10
- package/resources/scss/theme-neo-light/apps/portal/blog/Container.scss +3 -0
- package/resources/scss/theme-neo-light/form/field/Search.scss +1 -1
- package/resources/scss/theme-neo-light/tooltip/Base.scss +1 -1
- package/src/DefaultConfig.mjs +2 -2
- package/src/Main.mjs +15 -1
- package/src/Neo.mjs +14 -3
- package/{apps/portal/view/learn → src/code}/LivePreview.mjs +43 -27
- package/src/component/Base.mjs +18 -1
- package/src/container/Base.mjs +3 -1
- package/src/dialog/Base.mjs +1 -2
- package/src/layout/Base.mjs +43 -6
- package/src/layout/Card.mjs +21 -59
- package/src/layout/Cube.mjs +428 -0
- package/src/layout/Fit.mjs +9 -38
- package/src/layout/Flexbox.mjs +16 -17
- package/src/layout/Form.mjs +13 -70
- package/src/layout/Grid.mjs +6 -18
- package/src/main/addon/ResizeObserver.mjs +18 -2
- package/src/main/mixin/DeltaUpdates.mjs +16 -3
- package/src/util/Array.mjs +36 -0
- package/src/vdom/Helper.mjs +328 -445
- package/src/vdom/VNode.mjs +12 -1
- package/test/siesta/siesta.js +16 -1
- package/test/siesta/tests/VdomCalendar.mjs +2111 -37
- package/test/siesta/tests/VdomHelper.mjs +283 -47
- package/test/siesta/tests/vdom/Advanced.mjs +367 -0
- package/test/siesta/tests/vdom/layout/Cube.mjs +189 -0
- package/test/siesta/tests/vdom/table/Container.mjs +133 -0
- package/apps/portal/view/home/parts/HelloWorld.mjs +0 -83
- package/apps/portal/view/home/preview/PageCodeContainer.mjs +0 -55
- package/resources/scss/src/apps/portal/home/preview/PageCodeContainer.scss +0 -115
- package/resources/scss/theme-neo-light/apps/portal/learn/ContentTreeList.scss +0 -23
@@ -0,0 +1,217 @@
|
|
1
|
+
import ConfigurationViewport from '../../ConfigurationViewport.mjs';
|
2
|
+
import Container from '../../../src/container/Base.mjs';
|
3
|
+
import CubeLayout from '../../../src/layout/Cube.mjs';
|
4
|
+
import NumberField from '../../../src/form/field/Number.mjs';
|
5
|
+
import Radio from '../../../src/form/field/Radio.mjs';
|
6
|
+
import RangeField from '../../../src/form/field/Range.mjs';
|
7
|
+
import Toolbar from '../../../src/toolbar/Base.mjs';
|
8
|
+
|
9
|
+
/**
|
10
|
+
* @class Neo.examples.layout.cube.MainContainer
|
11
|
+
* @extends Neo.examples.ConfigurationViewport
|
12
|
+
*/
|
13
|
+
class MainContainer extends ConfigurationViewport {
|
14
|
+
static config = {
|
15
|
+
className : 'Neo.examples.layout.cube.MainContainer',
|
16
|
+
cls : ['examples-layout-cube-maincontainer'],
|
17
|
+
configItemLabelWidth: 160,
|
18
|
+
configItemWidth : 280,
|
19
|
+
layout : {ntype: 'hbox', align: 'stretch'}
|
20
|
+
}
|
21
|
+
|
22
|
+
createConfigurationComponents() {
|
23
|
+
let me = this,
|
24
|
+
{layout} = me.exampleComponent.getItem('container');
|
25
|
+
|
26
|
+
return [{
|
27
|
+
module : Radio,
|
28
|
+
checked : layout.ntype === 'layout-cube',
|
29
|
+
hideValueLabel: false,
|
30
|
+
labelText : 'layout',
|
31
|
+
listeners : {change: me.onRadioLayoutChange.bind(me, 'cube')},
|
32
|
+
name : 'layout',
|
33
|
+
valueLabelText: 'Cube'
|
34
|
+
}, {
|
35
|
+
module : Radio,
|
36
|
+
checked : layout.ntype === 'layout-vbox',
|
37
|
+
hideValueLabel: false,
|
38
|
+
labelText : '',
|
39
|
+
listeners : {change: me.onRadioLayoutChange.bind(me, 'vbox')},
|
40
|
+
name : 'layout',
|
41
|
+
valueLabelText: 'VBox'
|
42
|
+
}, {
|
43
|
+
module : RangeField,
|
44
|
+
labelText: 'perspective',
|
45
|
+
listeners: {change: me.onLayoutConfigChange.bind(me, 'perspective')},
|
46
|
+
maxValue : 2000,
|
47
|
+
minValue : 400,
|
48
|
+
stepSize : 10,
|
49
|
+
style : {marginTop: '20px'},
|
50
|
+
value : layout.perspective
|
51
|
+
}, {
|
52
|
+
module : RangeField,
|
53
|
+
labelText: 'rotateX',
|
54
|
+
listeners: {change: me.onLayoutConfigChange.bind(me, 'rotateX')},
|
55
|
+
maxValue : 360,
|
56
|
+
minValue : 0,
|
57
|
+
stepSize : 1,
|
58
|
+
style : {marginTop: '20px'},
|
59
|
+
value : layout.rotateX
|
60
|
+
}, {
|
61
|
+
module : RangeField,
|
62
|
+
labelText: 'rotateY',
|
63
|
+
listeners: {change: me.onLayoutConfigChange.bind(me, 'rotateY')},
|
64
|
+
maxValue : 360,
|
65
|
+
minValue : 0,
|
66
|
+
stepSize : 1,
|
67
|
+
value : layout.rotateY
|
68
|
+
}, {
|
69
|
+
module : RangeField,
|
70
|
+
labelText: 'rotateZ',
|
71
|
+
listeners: {change: me.onLayoutConfigChange.bind(me, 'rotateZ')},
|
72
|
+
maxValue : 360,
|
73
|
+
minValue : 0,
|
74
|
+
stepSize : 1,
|
75
|
+
value : layout.rotateZ
|
76
|
+
}, {
|
77
|
+
module : RangeField,
|
78
|
+
labelText: 'sideX',
|
79
|
+
listeners: {change: me.onLayoutConfigChange.bind(me, 'sideX')},
|
80
|
+
maxValue : 400,
|
81
|
+
minValue : 100,
|
82
|
+
stepSize : 10,
|
83
|
+
style : {marginTop: '20px'},
|
84
|
+
value : layout.sideX
|
85
|
+
}, {
|
86
|
+
module : RangeField,
|
87
|
+
labelText: 'sideY',
|
88
|
+
listeners: {change: me.onLayoutConfigChange.bind(me, 'sideY')},
|
89
|
+
maxValue : 400,
|
90
|
+
minValue : 100,
|
91
|
+
stepSize : 10,
|
92
|
+
value : layout.sideY
|
93
|
+
}, {
|
94
|
+
module : RangeField,
|
95
|
+
labelText: 'sideZ',
|
96
|
+
listeners: {change: me.onLayoutConfigChange.bind(me, 'sideZ')},
|
97
|
+
maxValue : 400,
|
98
|
+
minValue : 100,
|
99
|
+
stepSize : 10,
|
100
|
+
value : layout.sideZ
|
101
|
+
}, {
|
102
|
+
module : NumberField,
|
103
|
+
clearable: true,
|
104
|
+
labelText: 'height',
|
105
|
+
listeners: {change: me.onConfigChange.bind(me, 'height')},
|
106
|
+
maxValue : 1000,
|
107
|
+
minValue : 300,
|
108
|
+
stepSize : 10,
|
109
|
+
style : {marginTop: '20px'},
|
110
|
+
value : me.exampleComponent.height
|
111
|
+
}, {
|
112
|
+
module : NumberField,
|
113
|
+
clearable: true,
|
114
|
+
labelText: 'width',
|
115
|
+
listeners: {change: me.onConfigChange.bind(me, 'width')},
|
116
|
+
maxValue : 1000,
|
117
|
+
minValue : 300,
|
118
|
+
stepSize : 10,
|
119
|
+
style : {marginTop: '10px'},
|
120
|
+
value : me.exampleComponent.width
|
121
|
+
}];
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* @returns {Neo.component.Base}
|
126
|
+
*/
|
127
|
+
createExampleComponent() {
|
128
|
+
return Neo.create({
|
129
|
+
module: Container,
|
130
|
+
height: 550,
|
131
|
+
layout: {ntype: 'vbox', align: 'center', pack: 'center'},
|
132
|
+
width : 550,
|
133
|
+
|
134
|
+
items: [{
|
135
|
+
module : Container,
|
136
|
+
reference: 'container',
|
137
|
+
style : {color: 'white', fontSize: '50px', margin: '50px', textAlign: 'center'},
|
138
|
+
|
139
|
+
layout: {
|
140
|
+
ntype : 'cube',
|
141
|
+
rotateX: 194,
|
142
|
+
rotateY: 213,
|
143
|
+
rotateZ: 162
|
144
|
+
},
|
145
|
+
|
146
|
+
items: [
|
147
|
+
{style: {backgroundColor: 'rgba(255, 0, 0, 0.5)'}, html: 'Front'},
|
148
|
+
{style: {backgroundColor: 'rgba( 0, 255, 0, 0.5)'}, html: 'Back'},
|
149
|
+
{style: {backgroundColor: 'rgba( 0, 0, 255, 0.5)'}, html: 'Left'},
|
150
|
+
{style: {backgroundColor: 'rgba( 0, 255, 255, 0.5)'}, html: 'Right'},
|
151
|
+
{style: {backgroundColor: 'rgba(255, 0, 255, 0.5)'}, html: 'Top'},
|
152
|
+
{style: {backgroundColor: 'rgba(255, 255, 0, 0.5)'}, html: 'Bottom'}
|
153
|
+
]
|
154
|
+
}, {
|
155
|
+
module: Toolbar,
|
156
|
+
flex : 'none',
|
157
|
+
style : {marginTop: '1em'},
|
158
|
+
|
159
|
+
itemDefaults: {
|
160
|
+
ntype : 'button',
|
161
|
+
handler: 'up.onFaceButtonClick',
|
162
|
+
style : {marginRight: '.3em'}
|
163
|
+
},
|
164
|
+
|
165
|
+
items: [
|
166
|
+
{text: 'Front'},
|
167
|
+
{text: 'Back'},
|
168
|
+
{text: 'Left'},
|
169
|
+
{text: 'Right'},
|
170
|
+
{text: 'Top'},
|
171
|
+
{text: 'Bottom'}
|
172
|
+
]
|
173
|
+
}]
|
174
|
+
})
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* @param {Object} data
|
179
|
+
*/
|
180
|
+
onFaceButtonClick(data) {
|
181
|
+
this.getItem('container').layout['activeFace'] = data.component.text.toLowerCase()
|
182
|
+
}
|
183
|
+
|
184
|
+
|
185
|
+
/**
|
186
|
+
* @param {String} config
|
187
|
+
* @param {Object} opts
|
188
|
+
*/
|
189
|
+
onLayoutConfigChange(config, opts) {
|
190
|
+
this.getItem('container').layout[config] = opts.value
|
191
|
+
}
|
192
|
+
|
193
|
+
/**
|
194
|
+
* @param {String} name
|
195
|
+
* @param {Object} opts
|
196
|
+
*/
|
197
|
+
onRadioLayoutChange(name, opts) {
|
198
|
+
if (opts.value === true) { // we only want to listen to check events, not uncheck
|
199
|
+
let layout = name;
|
200
|
+
|
201
|
+
if (name === 'cube') {
|
202
|
+
layout = {
|
203
|
+
ntype : 'cube',
|
204
|
+
rotateX: 194,
|
205
|
+
rotateY: 213,
|
206
|
+
rotateZ: 162
|
207
|
+
}
|
208
|
+
}
|
209
|
+
|
210
|
+
this.getItem('container').layout = layout;
|
211
|
+
}
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
Neo.setupClass(MainContainer);
|
216
|
+
|
217
|
+
export default MainContainer;
|
@@ -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 Cube Layout</title>
|
7
|
+
</head>
|
8
|
+
<body>
|
9
|
+
<script src="../../../src/MicroLoader.mjs" type="module"></script>
|
10
|
+
</body>
|
11
|
+
</html>
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "neo.mjs",
|
3
|
-
"version": "6.
|
3
|
+
"version": "6.19.0",
|
4
4
|
"description": "The webworkers driven UI framework",
|
5
5
|
"type": "module",
|
6
6
|
"repository": {
|
@@ -48,20 +48,20 @@
|
|
48
48
|
"chalk": "^5.3.0",
|
49
49
|
"clean-webpack-plugin": "^4.0.0",
|
50
50
|
"commander": "^12.1.0",
|
51
|
-
"cssnano": "^7.0.
|
51
|
+
"cssnano": "^7.0.4",
|
52
52
|
"envinfo": "^7.13.0",
|
53
53
|
"fs-extra": "^11.2.0",
|
54
54
|
"highlightjs-line-numbers.js": "^2.8.0",
|
55
|
-
"inquirer": "^
|
56
|
-
"marked": "^13.0.
|
55
|
+
"inquirer": "^10.0.1",
|
56
|
+
"marked": "^13.0.2",
|
57
57
|
"monaco-editor": "^0.50.0",
|
58
58
|
"neo-jsdoc": "1.0.1",
|
59
59
|
"neo-jsdoc-x": "1.0.5",
|
60
|
-
"postcss": "^8.4.
|
61
|
-
"sass": "^1.77.
|
60
|
+
"postcss": "^8.4.39",
|
61
|
+
"sass": "^1.77.8",
|
62
62
|
"siesta-lite": "5.5.2",
|
63
63
|
"url": "^0.11.3",
|
64
|
-
"webpack": "^5.
|
64
|
+
"webpack": "^5.93.0",
|
65
65
|
"webpack-cli": "^5.1.4",
|
66
66
|
"webpack-dev-server": "^5.0.4",
|
67
67
|
"webpack-hook-plugin": "^1.0.7",
|
@@ -121,8 +121,8 @@ actually used in the example, and the import root path is different to reflect t
|
|
121
121
|
Neo.mjs library relative to the examples.
|
122
122
|
|
123
123
|
<pre data-neo>
|
124
|
-
import Button from '
|
125
|
-
import Container from '
|
124
|
+
import Button from '../button/Base.mjs';
|
125
|
+
import Container from '../container/Base.mjs';
|
126
126
|
|
127
127
|
class MainView extends Container {
|
128
128
|
static config = {
|
@@ -4,9 +4,9 @@ A _view model_ — `Neo.model.Component` — instance holds properties t
|
|
4
4
|
can be bound to component properties.
|
5
5
|
|
6
6
|
<pre data-neo>
|
7
|
-
import Container from '
|
8
|
-
import Label from '
|
9
|
-
import TextField from '
|
7
|
+
import Container from '../container/Base.mjs';
|
8
|
+
import Label from '../component/Label.mjs';
|
9
|
+
import TextField from '../form/field/Text.mjs';
|
10
10
|
|
11
11
|
class MainView extends Container {
|
12
12
|
static config = {
|
@@ -56,9 +56,9 @@ usually coded as separate classes.)
|
|
56
56
|
Below is another example.
|
57
57
|
|
58
58
|
<pre data-neo>
|
59
|
-
import Container from '
|
60
|
-
import Label from '
|
61
|
-
import Panel from '
|
59
|
+
import Container from '../container/Base.mjs';
|
60
|
+
import Label from '../component/Label.mjs';
|
61
|
+
import Panel from '../container/Panel.mjs';
|
62
62
|
|
63
63
|
class MyPanel extends Panel {
|
64
64
|
static config = {
|
@@ -26,7 +26,7 @@ primitive. Components introduce various properties, such as `width`, `height`, `
|
|
26
26
|
Here's a container, with one child item.
|
27
27
|
|
28
28
|
<pre data-neo>
|
29
|
-
import Container from '
|
29
|
+
import Container from '../container/Base.mjs';
|
30
30
|
|
31
31
|
class MainView extends Container {
|
32
32
|
static config = {
|
@@ -48,7 +48,7 @@ Components also have an `html`. The `html` property is rarely used, and goes aga
|
|
48
48
|
sometimes it's handy as a placeholder as you stub out views.
|
49
49
|
|
50
50
|
<pre data-neo>
|
51
|
-
import Container from '
|
51
|
+
import Container from '../container/Base.mjs';
|
52
52
|
|
53
53
|
class MainView extends Container {
|
54
54
|
static config = {
|
@@ -78,7 +78,7 @@ some commonly-used layouts.
|
|
78
78
|
Fix is used when there's a single child. The component is sized to fit the container.
|
79
79
|
|
80
80
|
<pre data-neo>
|
81
|
-
import Container from '
|
81
|
+
import Container from '../container/Base.mjs';
|
82
82
|
|
83
83
|
class MainView extends Container {
|
84
84
|
static config = {
|
@@ -99,8 +99,8 @@ Neo.setupClass(MainView);
|
|
99
99
|
With `vbox` and `hbox`, items are arranged vertically or horizontally.
|
100
100
|
|
101
101
|
<pre data-neo>
|
102
|
-
import Button from '
|
103
|
-
import Container from '
|
102
|
+
import Button from '../button/Base.mjs';
|
103
|
+
import Container from '../container/Base.mjs';
|
104
104
|
|
105
105
|
class MainView extends Container {
|
106
106
|
static config = {
|
@@ -126,10 +126,10 @@ Neo.setupClass(MainView);
|
|
126
126
|
A card container has multiple child items, one of which is visible.
|
127
127
|
|
128
128
|
<pre data-neo>
|
129
|
-
import Button from '
|
130
|
-
import
|
129
|
+
import Button from '../button/Base.mjs';
|
130
|
+
import Container from '../container/Base.mjs';
|
131
131
|
|
132
|
-
class MainView extends
|
132
|
+
class MainView extends Container {
|
133
133
|
static config = {
|
134
134
|
className: 'Example.view.MainView',
|
135
135
|
layout : 'vbox',
|
@@ -178,7 +178,7 @@ Neo.mjs is class-based, and thus, any component or container can be defined as i
|
|
178
178
|
other component in the framework.
|
179
179
|
|
180
180
|
<pre data-neo>
|
181
|
-
import Button
|
181
|
+
import Button from '../button/Base.mjs';
|
182
182
|
// In practice this would be some handy reusable component
|
183
183
|
class MySpecialButton extends Button {
|
184
184
|
static config = {
|
@@ -191,7 +191,7 @@ class MySpecialButton extends Button {
|
|
191
191
|
Neo.setupClass(MySpecialButton);
|
192
192
|
|
193
193
|
|
194
|
-
import Container from '
|
194
|
+
import Container from '../container/Base.mjs';
|
195
195
|
|
196
196
|
class MainView extends Container {
|
197
197
|
static config = {
|
@@ -18,8 +18,8 @@ The `Simple` class introduces syntax. It doesn't have any content, so if you run
|
|
18
18
|
see anything. We'll change that in the next example.
|
19
19
|
|
20
20
|
<pre data-neo>
|
21
|
-
import Component
|
22
|
-
import Container
|
21
|
+
import Component from '../component/Base.mjs';
|
22
|
+
import Container from '../container/Base.mjs';
|
23
23
|
|
24
24
|
class Simple extends Component {
|
25
25
|
static config = {
|
@@ -59,8 +59,8 @@ updated or accessed. You're free to implment these methods to provide business r
|
|
59
59
|
values, or have side-effects, such as updating a view or firing an event.
|
60
60
|
|
61
61
|
<pre data-neo>
|
62
|
-
import Component
|
63
|
-
import Container
|
62
|
+
import Component from '../component/Base.mjs';
|
63
|
+
import Container from '../container/Base.mjs';
|
64
64
|
|
65
65
|
class Simple extends Component {
|
66
66
|
static config = {
|
@@ -113,8 +113,8 @@ Typically, the _afterSet_ method is used to update a view or to fire an event.
|
|
113
113
|
Look at this code: `afterSetBar()` fires an event, and the config in the `items[]` is listening to it.
|
114
114
|
|
115
115
|
<pre data-neo>
|
116
|
-
import Component
|
117
|
-
import Container
|
116
|
+
import Component from '../component/Base.mjs';
|
117
|
+
import Container from '../container/Base.mjs';
|
118
118
|
|
119
119
|
class Simple extends Component {
|
120
120
|
static config = {
|
@@ -10,20 +10,20 @@ Neo.mjs is class-based, which means you're free to extend any component (or any
|
|
10
10
|
## Lifecycle config properties
|
11
11
|
|
12
12
|
<pre data-neo>
|
13
|
-
import Button
|
13
|
+
import Button from '../button/Base.mjs';
|
14
14
|
// In practice this would be some handy reusable component
|
15
15
|
class MySpecialButton extends Button {
|
16
16
|
static config = {
|
17
17
|
className: 'Example.view.MySpecialButton',
|
18
|
-
iconCls: 'far fa-face-grin-wide',
|
19
|
-
ui: 'ghost'
|
18
|
+
iconCls : 'far fa-face-grin-wide',
|
19
|
+
ui : 'ghost'
|
20
20
|
}
|
21
21
|
}
|
22
22
|
|
23
23
|
Neo.setupClass(MySpecialButton);
|
24
24
|
|
25
25
|
|
26
|
-
import Container from '
|
26
|
+
import Container from '../container/Base.mjs';
|
27
27
|
|
28
28
|
class MainView extends Container {
|
29
29
|
static config = {
|
@@ -11,8 +11,8 @@ use to describe the component you're creating> You can also access or set the pr
|
|
11
11
|
## A view with one component
|
12
12
|
|
13
13
|
<pre data-neo>
|
14
|
-
import Button from '
|
15
|
-
import Container from '
|
14
|
+
import Button from '../button/Base.mjs';
|
15
|
+
import Container from '../container/Base.mjs';
|
16
16
|
|
17
17
|
class MainView extends Container {
|
18
18
|
static config = {
|
@@ -47,8 +47,8 @@ Let's put a second button in the container.
|
|
47
47
|
## A view with two components
|
48
48
|
|
49
49
|
<pre data-neo>
|
50
|
-
import Button from '
|
51
|
-
import Container from '
|
50
|
+
import Button from '../button/Base.mjs';
|
51
|
+
import Container from '../container/Base.mjs';
|
52
52
|
|
53
53
|
class MainView extends Container {
|
54
54
|
static config = {
|
@@ -0,0 +1,32 @@
|
|
1
|
+
In this topic you'll create an application that fetches data on earthquakes in Iceland,
|
2
|
+
and show the information in two views: a table, and a map.
|
3
|
+
You'll do this in a series of simple labs.
|
4
|
+
|
5
|
+
What are the goals of this lengthy topic?
|
6
|
+
|
7
|
+
- To give you hands-on coding a simple app
|
8
|
+
- To introduce fundamental Neo concepts
|
9
|
+
|
10
|
+
Most of these labs are copy-and-paste because we're focusing on _what_ the code is doing on rather than _how_.
|
11
|
+
|
12
|
+
For this tutorial don't worry about syntax details. Other tutorials and guides will spend more and
|
13
|
+
more time on syntax.e
|
14
|
+
|
15
|
+
## Key concepts
|
16
|
+
|
17
|
+
A few key concepts we'll be discussing:
|
18
|
+
|
19
|
+
- Creating a starter app
|
20
|
+
- Configuring components
|
21
|
+
- Debugging
|
22
|
+
- Class-based coding
|
23
|
+
- View models
|
24
|
+
- Events
|
25
|
+
- Controllers
|
26
|
+
|
27
|
+
## Advice
|
28
|
+
|
29
|
+
A word of advice: Keep a high-level perspective, especially early on. We'll have plenty of time to get
|
30
|
+
into the code, and we'll do most things multiple times. In other words, focus on what you're accomplishing,
|
31
|
+
and don't worry about syntax details.
|
32
|
+
|
@@ -0,0 +1,47 @@
|
|
1
|
+
In this lab, you'll generate a Neo.mjs workspace and run the starter app.
|
2
|
+
|
3
|
+
<details>
|
4
|
+
<summary>Wait!</summary>
|
5
|
+
You may already have a workspace! If so, you can skip this lab. For example, if you followed the <a href="#/learn/Setup">Getting Started > Setup</a> topic, above, you should already have a workspace.
|
6
|
+
|
7
|
+
If you don't have a workspace, then continue on to the next step.
|
8
|
+
</details>
|
9
|
+
|
10
|
+
<details>
|
11
|
+
<summary>Use the command-line to generate the workspace</summary>
|
12
|
+
|
13
|
+
Use a terminal window to navigate to some parent folder,
|
14
|
+
then run
|
15
|
+
|
16
|
+
npx neo-app@latest
|
17
|
+
|
18
|
+
You'll be prompted for a workspace name, starter app name, etc — accept the default for everything.
|
19
|
+
As the command finishes it starts a server and opens a browser window.
|
20
|
+
</details>
|
21
|
+
|
22
|
+
<details>
|
23
|
+
<summary>Inspect the workspace</summary>
|
24
|
+
|
25
|
+
The workspace contains a local copy of the API docs, an `apps` directory (where your apps are found),
|
26
|
+
and some other directories.
|
27
|
+
</details>
|
28
|
+
|
29
|
+
<details>
|
30
|
+
<summary>Start the server</summary>
|
31
|
+
From the root of the `workspace` start the server via `npm run server-start`. That starts a server
|
32
|
+
at port 8080 and opens a new browser window.
|
33
|
+
|
34
|
+
<img src="https://s3.amazonaws.com/mjs.neo.learning.images/earthquakes/StartServer.png" style="width:80%"/>
|
35
|
+
|
36
|
+
</details>
|
37
|
+
|
38
|
+
|
39
|
+
<details>
|
40
|
+
<summary>Run the starter app</summary>
|
41
|
+
|
42
|
+
By default, an app named `myapp` was created. You can run it by entering the `apps` directory and
|
43
|
+
clicking `myapp`. It's a folder containing an `index.html` along with the source code for the app.
|
44
|
+
|
45
|
+
<img src="https://s3.amazonaws.com/mjs.neo.learning.images/earthquakes/RunTheStarterApp.png" style="width:80%"/>
|
46
|
+
|
47
|
+
</details>
|