neo.mjs 6.15.4 → 6.15.5
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/examples/ServiceWorker.mjs +2 -2
- package/package.json +3 -3
- package/resources/data/deck/learnneo/pages/TestLivePreview.md +1 -2
- package/resources/data/deck/learnneo/pages/Welcome.md +60 -0
- package/resources/data/deck/learnneo/pages/WhyNeo-Multi-Threaded.md +2 -0
- package/resources/data/deck/learnneo/pages/WhyNeo-Multi-Window.md +3 -3
- package/resources/data/deck/learnneo/pages/WhyNeo-Speed.md +34 -12
- package/resources/data/deck/learnneo/tree.json +1 -0
- package/resources/scss/src/apps/portal/learn/PageContainer.scss +4 -3
- package/src/DefaultConfig.mjs +2 -2
- package/src/form/field/ComboBox.mjs +1 -0
- package/test/components/app.mjs +1 -0
- package/test/components/files/component/Base.mjs +88 -0
- package/test/components/siesta.js +1 -0
package/apps/ServiceWorker.mjs
CHANGED
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
{
|
3
3
|
"name": "neo.mjs",
|
4
|
-
"version": "6.15.
|
4
|
+
"version": "6.15.5",
|
5
5
|
"description": "The webworkers driven UI framework",
|
6
6
|
"type": "module",
|
7
7
|
"repository": {
|
@@ -44,7 +44,7 @@
|
|
44
44
|
},
|
45
45
|
"homepage": "https://neomjs.github.io/pages/",
|
46
46
|
"devDependencies": {
|
47
|
-
"@fortawesome/fontawesome-free": "^6.5.
|
47
|
+
"@fortawesome/fontawesome-free": "^6.5.2",
|
48
48
|
"autoprefixer": "^10.4.19",
|
49
49
|
"chalk": "^5.3.0",
|
50
50
|
"clean-webpack-plugin": "^4.0.0",
|
@@ -53,7 +53,7 @@
|
|
53
53
|
"envinfo": "^7.11.1",
|
54
54
|
"fs-extra": "^11.2.0",
|
55
55
|
"highlightjs-line-numbers.js": "^2.8.0",
|
56
|
-
"inquirer": "^9.2.
|
56
|
+
"inquirer": "^9.2.17",
|
57
57
|
"marked": "^12.0.1",
|
58
58
|
"monaco-editor": "^0.47.0",
|
59
59
|
"neo-jsdoc": "1.0.1",
|
@@ -1,7 +1,6 @@
|
|
1
1
|
To code a live preview, enclose the code in a `pre` tag with the `data-neo` attribute.
|
2
2
|
|
3
|
-
<
|
4
|
-
</pre>
|
3
|
+
<code><pre data-neo>...</pre> <</code>
|
5
4
|
|
6
5
|
Imports are relative to the portal app running within the framework. That means
|
7
6
|
Neo.mjs imports should be coded to go up four levels, then look into the `src`
|
@@ -0,0 +1,60 @@
|
|
1
|
+
Welcome to Neo.mjs! This set of topics contains information to help you use Neo.mjs.
|
2
|
+
|
3
|
+
|
4
|
+
## Topics
|
5
|
+
|
6
|
+
### Why Neo?
|
7
|
+
|
8
|
+
Describes technical and business reasons for using Neo.mjs
|
9
|
+
|
10
|
+
### Getting Started
|
11
|
+
|
12
|
+
Install instructions, along with fundamental concepts that are good to understand before diving into Neo.mjs.
|
13
|
+
|
14
|
+
### Tutorials
|
15
|
+
|
16
|
+
Hands-on tutorials where you'll code a few simple Neo.mjs applications.
|
17
|
+
|
18
|
+
### Guides
|
19
|
+
|
20
|
+
These are in-depth discussions of various topics.
|
21
|
+
|
22
|
+
### Appendix
|
23
|
+
|
24
|
+
You can ignore this! It just holds a site style sheet and other miscellanea.
|
25
|
+
|
26
|
+
## Using these topics
|
27
|
+
|
28
|
+
As you can see, the topics table of contents is on the left. Topic sections and sub-sections are shown on the right.
|
29
|
+
|
30
|
+
Topics sometimes contain "disclosure" widgets, which are just <details> tags. These are used in cases
|
31
|
+
where we want to present high-level points and reveal details when the disclosure is expanded.
|
32
|
+
|
33
|
+
<details>
|
34
|
+
<summary>This is a disclosure widget</summary>
|
35
|
+
<p style="background-color:lightgreen;padding:8px">This is a fascinating piece of information which is revealed when the widget is expanded.</p>
|
36
|
+
</details>
|
37
|
+
|
38
|
+
Topics also sometimes contain runnable examples. These are shown as tab panels with Source and Preview tabs.
|
39
|
+
|
40
|
+
You can also launch the preview in a window by going to the Preview tab, then clicking on the little window
|
41
|
+
icon on the right <span class="far fa-xs fa-window-maximize"></span>. This web site is a Neo.mjs application,
|
42
|
+
and the ability to launch browser windows — all integrated within a single app — is a unique feature of Neo.mjs!
|
43
|
+
|
44
|
+
<pre data-neo>
|
45
|
+
import Button from '../../../../src/button/Base.mjs';
|
46
|
+
import Container from '../../../../src/container/Base.mjs';
|
47
|
+
|
48
|
+
class MainView extends Container {
|
49
|
+
static config = {
|
50
|
+
className: 'Example.view.MainView',
|
51
|
+
layout : {ntype:'vbox', align:'start'},
|
52
|
+
items : [{
|
53
|
+
module : Button,
|
54
|
+
text : 'Button'
|
55
|
+
}]
|
56
|
+
}
|
57
|
+
}
|
58
|
+
|
59
|
+
Neo.setupClass(MainView);
|
60
|
+
</pre>
|
@@ -6,6 +6,8 @@ to the main browser thread, resulting in:
|
|
6
6
|
3. A <b>data</b> web-worker were HTTP and socket calls are run
|
7
7
|
4. A <b>view</b> web-worker that manages delta updates
|
8
8
|
|
9
|
+
<img src="https://s3.amazonaws.com/mjs.neo.learning.images/why/IndexHtmlFlow.png" width="120%"></img>
|
10
|
+
|
9
11
|
The benefits of using web workers is that each runs in parallel its own thread. In a typical framework
|
10
12
|
all code is run in the main thread, so processes compete for CPU cycles.
|
11
13
|
|
@@ -8,11 +8,11 @@ across windows, running seamlessly as a single application.
|
|
8
8
|
|
9
9
|
<details>
|
10
10
|
<summary><h3>Example</h3></summary>
|
11
|
-
An easy way to show this is by looking at a code preview example.
|
11
|
+
An easy way to show this is by looking at a code preview example. In the example below, click Preview,
|
12
12
|
then click on the new window icon on the right side of the toolbar. This launches a new window
|
13
13
|
running the code. Even though it's running in a new window, it's still part of the app.
|
14
|
-
(In this case, the app is the
|
15
|
-
share events,
|
14
|
+
(In this case, the app is the web site you're looking at now.) That means both the code in both windows
|
15
|
+
seamlessly share events, data, etc. — the code doesn't care that some code is running in a
|
16
16
|
separate window.
|
17
17
|
<pre data-neo>
|
18
18
|
import Button from '../../../../src/button/Base.mjs';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
The Neo.mjs web-worker processes are automatically run in parallel, on separate CPU cores.
|
2
2
|
|
3
3
|
By contrast, other JavaScript frameworks run in a single thread, so all business logic,
|
4
4
|
data handling, and DOM rendering compete for CPU resources.
|
@@ -12,16 +12,38 @@ If the default four threads aren't enough, you're free to launch additional web-
|
|
12
12
|
to run other specialized logic.
|
13
13
|
|
14
14
|
|
15
|
-
|
16
|
-
<summary>Example</summary>
|
17
|
-
Look at this example. It's complex. As you pan left and right, and zoom in and out, the upper-right
|
18
|
-
shows you the number of delta updates being applied. If you move really quickly, you might reach 20,000
|
19
|
-
or 30,000 delta updates per second. We've seen some examples that go over 40,000 updates per second —
|
20
|
-
but we've never actually hit the limit.
|
15
|
+
### Example
|
21
16
|
|
22
|
-
|
17
|
+
Look at this example. It's the `Neo.component.Helix` component. Besides looking cool, it illustrates how quickly Neo.mjs can update a complex user interface.
|
23
18
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
19
|
+
Click on Preview, then use your mouse or trackpad to pan and zoom — the helix zooms and spirals accordingly, very very rapidly.
|
20
|
+
If you move quickly, you might reach 20,000 or 30,000 delta updates per second. We've seen some examples that go over 40,000 updates per
|
21
|
+
second — but we've never actually hit the limit.
|
22
|
+
|
23
|
+
<pre data-neo>
|
24
|
+
import Base from '../../../../src/container/Base.mjs';
|
25
|
+
import Helix from '../../../../src/component/Helix.mjs';
|
26
|
+
class Foo extends Base {
|
27
|
+
static config = {
|
28
|
+
className: 'Foo',
|
29
|
+
layout: 'fit',
|
30
|
+
items: [{
|
31
|
+
module: Helix,
|
32
|
+
imageField : 'image',
|
33
|
+
imageSource: '../../../../resources/examples/',
|
34
|
+
store: {
|
35
|
+
autoLoad: true,
|
36
|
+
model: {
|
37
|
+
fields: [ { name: 'image' , type: 'String' } ],
|
38
|
+
},
|
39
|
+
url: '../../../../resources/examples/data/ai_contacts.json'
|
40
|
+
}
|
41
|
+
}]
|
42
|
+
}
|
43
|
+
}
|
44
|
+
Neo.setupClass(Foo);
|
45
|
+
</pre>
|
46
|
+
|
47
|
+
|
48
|
+
If you're interested, there's <a href="../../examples/component/helix/index.html" target="_blank">a more full-featured helix example</a> that includes showing delta updates,
|
49
|
+
along with some other control. Look at the upper-right corner to see delta updates.
|
@@ -1,4 +1,5 @@
|
|
1
1
|
{"data": [
|
2
|
+
{"name": "Welcome!", "parentId": null, "isLeaf": true, "id": "Welcome" },
|
2
3
|
{"name": "Why Neo.mjs?", "parentId": null, "isLeaf": false, "id": "WhyNeo"},
|
3
4
|
{"name": "Introduction ", "parentId": "WhyNeo", "isLeaf": true, "id": "WhyNeo-Intro"},
|
4
5
|
{"name": "Multi-Threaded", "parentId": "WhyNeo", "isLeaf": true, "id": "WhyNeo-Multi-Threaded"},
|
package/src/DefaultConfig.mjs
CHANGED
@@ -260,12 +260,12 @@ const DefaultConfig = {
|
|
260
260
|
useVdomWorker: true,
|
261
261
|
/**
|
262
262
|
* buildScripts/injectPackageVersion.mjs will update this value
|
263
|
-
* @default '6.15.
|
263
|
+
* @default '6.15.5'
|
264
264
|
* @memberOf! module:Neo
|
265
265
|
* @name config.version
|
266
266
|
* @type String
|
267
267
|
*/
|
268
|
-
version: '6.15.
|
268
|
+
version: '6.15.5'
|
269
269
|
};
|
270
270
|
|
271
271
|
Object.assign(DefaultConfig, {
|
package/test/components/app.mjs
CHANGED
@@ -0,0 +1,88 @@
|
|
1
|
+
StartTest(t => {
|
2
|
+
t.it('Checking colliding style updates', async t => {
|
3
|
+
const containerId = await Neo.worker.App.createNeoInstance({
|
4
|
+
ntype : 'container',
|
5
|
+
height: 250,
|
6
|
+
style : {backgroundColor: 'red'},
|
7
|
+
width : 300
|
8
|
+
});
|
9
|
+
|
10
|
+
t.is(containerId, 'neo-container-1');
|
11
|
+
|
12
|
+
await t.waitForSelector('.neo-container');
|
13
|
+
t.diag('Container got rendered.');
|
14
|
+
|
15
|
+
const componentId = await Neo.worker.App.createNeoInstance({
|
16
|
+
ntype : 'component',
|
17
|
+
height : 150,
|
18
|
+
parentId: containerId,
|
19
|
+
style : {backgroundColor: 'blue'},
|
20
|
+
width : 150
|
21
|
+
});
|
22
|
+
|
23
|
+
t.is(componentId, 'neo-component-1');
|
24
|
+
t.diag('Component got rendered.');
|
25
|
+
|
26
|
+
t.diag('Child update before parent update');
|
27
|
+
Neo.worker.App.setConfigs({id: componentId, style: {backgroundColor: 'green'}});
|
28
|
+
Neo.worker.App.setConfigs({id: containerId, style: {backgroundColor: 'orange'}});
|
29
|
+
|
30
|
+
await t.waitFor(100);
|
31
|
+
|
32
|
+
t.is(document.getElementById(componentId).style.backgroundColor, 'green');
|
33
|
+
t.is(document.getElementById(containerId).style.backgroundColor, 'orange');
|
34
|
+
|
35
|
+
t.diag('Parent update before child update');
|
36
|
+
Neo.worker.App.setConfigs({id: containerId, style: {backgroundColor: 'pink'}});
|
37
|
+
Neo.worker.App.setConfigs({id: componentId, style: {backgroundColor: 'purple'}});
|
38
|
+
|
39
|
+
await t.waitFor(100);
|
40
|
+
|
41
|
+
t.is(document.getElementById(containerId).style.backgroundColor, 'pink');
|
42
|
+
t.is(document.getElementById(componentId).style.backgroundColor, 'purple');
|
43
|
+
|
44
|
+
await Neo.worker.App.destroyNeoInstance(containerId)
|
45
|
+
});
|
46
|
+
|
47
|
+
t.it('Checking colliding vdom updates', async t => {
|
48
|
+
const toolbarId = await Neo.worker.App.createNeoInstance({
|
49
|
+
ntype : 'toolbar',
|
50
|
+
height: 200,
|
51
|
+
width : 300
|
52
|
+
});
|
53
|
+
|
54
|
+
t.is(toolbarId, 'neo-toolbar-1');
|
55
|
+
|
56
|
+
await t.waitForSelector('.neo-toolbar');
|
57
|
+
t.diag('Toolbar got rendered.');
|
58
|
+
|
59
|
+
const buttonId = await Neo.worker.App.createNeoInstance({
|
60
|
+
ntype : 'button',
|
61
|
+
parentId: toolbarId,
|
62
|
+
text : 'hello'
|
63
|
+
});
|
64
|
+
|
65
|
+
t.is(buttonId, 'neo-button-1');
|
66
|
+
|
67
|
+
await t.waitForSelector('.neo-button');
|
68
|
+
t.diag('Button got rendered.');
|
69
|
+
|
70
|
+
t.diag('Child update before parent update');
|
71
|
+
Neo.worker.App.setConfigs({id: buttonId, text : 'world'});
|
72
|
+
Neo.worker.App.setConfigs({id: toolbarId, height: 300});
|
73
|
+
|
74
|
+
await t.waitFor(100);
|
75
|
+
|
76
|
+
t.is(document.getElementById(toolbarId).style.height, '300px');
|
77
|
+
t.is(document.getElementById(buttonId).firstChild.innerHTML, 'world');
|
78
|
+
|
79
|
+
t.diag('Parent update before child update');
|
80
|
+
Neo.worker.App.setConfigs({id: toolbarId, height: 200});
|
81
|
+
Neo.worker.App.setConfigs({id: buttonId, text : 'hello'});
|
82
|
+
|
83
|
+
await t.waitFor(100);
|
84
|
+
|
85
|
+
t.is(document.getElementById(toolbarId).style.height, '200px');
|
86
|
+
t.is(document.getElementById(buttonId).firstChild.innerHTML, 'hello');
|
87
|
+
});
|
88
|
+
});
|