neo.mjs 6.15.5 → 6.15.6

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 (60) hide show
  1. package/apps/ServiceWorker.mjs +2 -2
  2. package/apps/form/view/FormContainerController.mjs +1 -1
  3. package/apps/form/view/ViewportController.mjs +2 -2
  4. package/apps/portal/view/home/MainContainer.mjs +2 -2
  5. package/apps/portal/view/learn/ContentView.mjs +1 -1
  6. package/apps/portal/view/learn/LivePreview.mjs +0 -27
  7. package/apps/realworld2/view/user/LoginFormContainer.mjs +1 -1
  8. package/docs/app/view/MainContainer.mjs +1 -11
  9. package/examples/ServiceWorker.mjs +2 -2
  10. package/examples/component/timer/MainContainerController.mjs +2 -2
  11. package/examples/component/toast/MainContainerController.mjs +2 -2
  12. package/examples/date/selectorContainer/MainContainer.mjs +215 -0
  13. package/examples/date/selectorContainer/app.mjs +6 -0
  14. package/examples/date/selectorContainer/index.html +11 -0
  15. package/examples/date/selectorContainer/neo-config.json +6 -0
  16. package/package.json +3 -3
  17. package/resources/data/deck/learnneo/pages/Welcome.md +8 -0
  18. package/resources/data/deck/learnneo/pages/WhyNeo-Speed.md +5 -3
  19. package/resources/data/deck/learnneo/tree.json +4 -4
  20. package/resources/scss/src/date/SelectorContainer.scss +120 -0
  21. package/resources/scss/theme-dark/date/SelectorContainer.scss +24 -0
  22. package/resources/scss/theme-light/date/SelectorContainer.scss +24 -0
  23. package/resources/scss/theme-neo-light/date/SelectorContainer.scss +24 -0
  24. package/src/DefaultConfig.mjs +2 -2
  25. package/src/Neo.mjs +5 -5
  26. package/src/component/Base.mjs +1 -1
  27. package/src/container/Base.mjs +42 -17
  28. package/src/controller/Component.mjs +5 -4
  29. package/src/core/Observable.mjs +30 -5
  30. package/src/core/Util.mjs +1 -1
  31. package/src/date/DayViewComponent.mjs +251 -0
  32. package/src/date/SelectorContainer.mjs +352 -0
  33. package/src/date/SelectorContainerModel.mjs +33 -0
  34. package/src/form/Container.mjs +10 -2
  35. package/src/form/field/Base.mjs +10 -2
  36. package/src/form/field/CheckBox.mjs +13 -5
  37. package/src/form/field/ComboBox.mjs +20 -15
  38. package/src/form/field/Date.mjs +2 -2
  39. package/src/form/field/Text.mjs +18 -17
  40. package/src/main/addon/IntersectionObserver.mjs +27 -20
  41. package/src/tab/Container.mjs +56 -55
  42. package/docs/app/model/Tutorial.mjs +0 -41
  43. package/docs/app/store/Tutorials.mjs +0 -28
  44. package/docs/app/view/TutorialsTreeList.mjs +0 -51
  45. package/docs/tutorials/01_Concept.html +0 -45
  46. package/docs/tutorials/01_Concept.json +0 -123
  47. package/docs/tutorials/01_Concept.md +0 -55
  48. package/docs/tutorials/02_ClassSystem.html +0 -171
  49. package/docs/tutorials/02_ClassSystem.md +0 -187
  50. package/docs/tutorials/03_ComponentLifecycle.html +0 -28
  51. package/docs/tutorials/03_ComponentLifecycle.md +0 -23
  52. package/docs/tutorials/04_VdomVnode.html +0 -161
  53. package/docs/tutorials/05_RemoteMethodAccess.html +0 -82
  54. package/docs/tutorials/06_EcmaScript6Plus.html +0 -10
  55. package/docs/tutorials/07_WebWorkers.html +0 -9
  56. package/docs/tutorials/08_DomEvents.html +0 -7
  57. package/docs/tutorials/09_TodoList_version1.html +0 -503
  58. package/docs/tutorials/11_CreateApp.html +0 -94
  59. package/docs/tutorials/tutorials.json +0 -100
  60. package/resources/scss/src/apps/docs/TutorialsTreeList.scss +0 -7
@@ -1,161 +0,0 @@
1
- <div class="neo-header-text-container">
2
- <span class="neo-header-text">Tutorial: Virtual DOM & Virtual Nodes</span>
3
- </div>
4
- <article>
5
- <h4>Virtual DOM (Vdom)</h4>
6
- <p>Since most parts of the neoteric framework as well as all apps you will create run inside the App worker,
7
- there is no direct access to the DOM (window & window.document are undefined inside the worker scope).</p>
8
- <p>Neoteric uses a custom JSON / JS-Object based vdom engine to handle the component markup and the changes.
9
- As an example, let's take a look at the component.Button markup:</p>
10
- <pre><code>_vdom: {
11
- tag: 'button',
12
- cn : [{
13
- tag: 'span',
14
- cls: ['neo-button-glyph']
15
- }, {
16
- tag: 'span',
17
- cls: ['neo-button-text']
18
- }]
19
- }</code></pre>
20
- <p>This template filled with content would create a resulting html like:</p>
21
- <pre><code>&lt;button class="neo-button icon-left" id="neo-button-1000"&gt;
22
- &lt;span class="neo-button-glyph fa fa-home" id="neo-vnode-1000">&lt;/span&gt;
23
- &lt;span class="neo-button-text" id="neo-vnode-1001">Hello World&lt;/span&gt;
24
- &lt;/button&gt;</code></pre>
25
- <p>Which will look like this:</p>
26
- <button class="neo-button icon-left" id="neo-button-1000">
27
- <span class="neo-button-glyph fa fa-home" id="neo-vnode-1000"></span>
28
- <span class="neo-button-text" id="neo-vnode-1001">Hello World</span>
29
- </button>
30
- <p>Available properties for each vdom object are:</p>
31
- <pre><code>{String} tag|nodeName the tag of the node, defaults to 'div'
32
- {String} html|innerHTML node.innerHTML
33
- {Array} cn child nodes
34
- {Array|String} cls node.className
35
- {String} flag pseudo-attribute to find nodes via util.VDom.getByFlag() or util.VDom.getFlags()
36
- {Number|String} height shortcut for style.height, defaults to px
37
- {String} id the dom id, will get auto-populated if not set (e.g. neo-vnode-1)
38
- {Number|String} maxHeight shortcut for style.maxHeight, defaults to px
39
- {Number|String} maxWidth shortcut for style.maxWidth, defaults to px
40
- {Number|String} minHeight shortcut for style.minHeight, defaults to px
41
- {Number|String} minWidth shortcut for style.minWidth, defaults to px
42
- {Object|String} style camel cased style definitions
43
- {Boolean} removeDom pseudo-attribute to remove a node from the VNode tree
44
- {String} vtype 'text' => inline text, positioned before or after nodes
45
- {Number|String} width shortcut for style.width, defaults to px
46
- </code></pre>
47
- <p>For more details, take a look at:
48
- <a class="neo-docs-view-source-link" href="#viewSource=vdom.Helper&amp;line=223">vdom.Helper:parseHelper()</a>
49
- </p>
50
- <hr>
51
- <h4>Rendering an app</h4>
52
- <p>Once you created your app, you will call the render() method for its main view.
53
- This will send the full vdom tree to the Vdom worker and create a Virtual Node (VNode) tree.<br>
54
- See: <a class="neo-docs-view-source-link" href="#viewSource=component.Base&amp;line=769">component.Base:render()</a>
55
- </p>
56
- <p>The top level vnode will contain the full html as a string inside the outerHTML property.
57
- If you want to, you could create an outerHTML property for each sub-node as well
58
- (take a look at the vdom.Helper config returnChildNodeOuterHtml: false.
59
- Not recommended or needed to change it, but it could help you for debugging purposes).
60
- </p>
61
- <hr>
62
- <h4>Mounting an app</h4>
63
- <p>Once you call mount() on your application main view (or in case the autoMount config is set to true),
64
- the App worker will send the html to the main thread which will inject the html into a given DOM node id
65
- or the framework will take care of the DOM node itself in case the main view is a container.Viewport.
66
- </p>
67
- <hr>
68
- <h4>Virtual Nodes (Vnodes)</h4>
69
- <p>After render() gets called on your main view, the framework will assign the relevant vnode sub-trees
70
- to each container item in a recursive way. So at this point, every rendered component of your app will
71
- have a vdom and a vnode property.
72
- </p>
73
- <hr>
74
- <h4>Delta Updates</h4>
75
- <p>After your app is mounted, you can modify the vdom of each component directly to trigger delta updates.
76
- As an example:</p>
77
- <pre><code>myButton.iconColor='red';</code></pre>
78
- <p>This "assignment" will trigger the setter method of this config, which will call:</p>
79
- <pre><code>afterSetIconColor(value) {
80
- let me = this,
81
- vdom = me.vdom,
82
- iconNode = me.getVdomRoot().cn[0];
83
-
84
- if (!iconNode.style) {
85
- iconNode.style = {};
86
- }
87
-
88
- if (value && value !== '') {
89
- iconNode.style.color = value;
90
- me.vdom = vdom;
91
- }
92
- }</code></pre>
93
- <p>The result could look like this:</p>
94
- <button class="neo-button icon-left" id="neo-button-1001">
95
- <span style="color:red;" class="neo-button-glyph fa fa-home" id="neo-vnode-1002"></span>
96
- <span class="neo-button-text" id="neo-vnode-1003">Hello World</span>
97
- </button>
98
- <p>The key here is me.vdom = vdom; which will trigger the vdom config setter, resulting in:
99
- </p>
100
- <pre><code>/**
101
- * Gets called after the vdom config gets changed in case the component is already mounted (delta updates).
102
- * @param {Object} vdom
103
- * @param {Neo.vdom.VNode} vnode
104
- * @private
105
- */
106
- updateVdom(vdom, vnode) {
107
- let me = this;
108
-
109
- Neo.vdom.Helper.update({
110
- vdom : vdom,
111
- vnode: vnode
112
- }).then(data => {
113
- Object.keys(me.vnode).forEach(key => {
114
- delete me.vnode[key];
115
- });
116
-
117
- Object.assign(me.vnode, data.vnode);
118
-
119
- me.syncVdomIds(me.vnode, me.vdom);
120
- }).catch(err => {
121
- console.log('Error attempting to update component dom', err, me);
122
- });
123
- }</code></pre>
124
- <p>The App worker will send the vdom & vnode property of this component to the VDom worker,
125
- which will create a new vnode using the vdom and then compare the old & new vnodes to calculate the deltas,
126
- which will modify the DOM as needed inside the main thread. Take a look at:<br>
127
- <a class="neo-docs-view-source-link" href="#viewSource=vdom.Helper&amp;line=102">vdom.Helper:update()</a>
128
- </p>
129
- <p>The given example will create an deltas array like:</p>
130
- <pre><code>deltas: [{
131
- id: 'neo-button-1000',
132
- style: {
133
- color: 'red'
134
- }
135
- }]</code></pre>
136
- <p>The deltas will get sent to the main thread &
137
- main.DomAccess:update() will apply each delta update to the real DOM automatically.</p>
138
- <hr>
139
- <h4>The virtual dom engine for delta updates is optional!</h4>
140
- <p>In case you do know exactly what needs to change for a given component, you can also manually create the deltas
141
- and send the result from the App worker to the main thread.
142
- We do recommend to keep the vdom in sync though, since a top level component update could revert the manual changes
143
- otherwise. One example for this strategy would be component.Helix:</p>
144
- <pre><code>afterSetPerspective(value) {
145
- let me = this;
146
-
147
- if (me.mounted) {
148
- Neo.currentWorker.promiseMessage('main', {
149
- action: 'updateDom',
150
- deltas: {
151
- id : me.vdom.id,
152
- style: {
153
- perspective: value + 'px'
154
- }
155
- }
156
- });
157
-
158
- me.updateCloneTranslate();
159
- }
160
- }</code></pre>
161
- </article>
@@ -1,82 +0,0 @@
1
- <div class="neo-header-text-container">
2
- <span class="neo-header-text">Tutorial: Remote Method Access</span>
3
- </div>
4
- <article>
5
- <p>To simplify the communication between the different workers (App, Data, VDom),
6
- neoteric provides remote method access for singletons.
7
- As an example, let's take a look at the vdom.Helper which lives inside the VDom worker:</p>
8
- <pre><code>class Helper extends Base {
9
- static getConfig() {return {
10
- className: 'Neo.vdom.Helper',
11
- ntype : 'vdom-helper',
12
- singleton: true,
13
-
14
- remote: {
15
- app: ['create', 'update']
16
- }
17
- //...
18
- }
19
-
20
- create(opts) {
21
- //...
22
- }
23
-
24
- update(opts) {
25
- //...
26
- }
27
-
28
- //...
29
- }</code></pre>
30
- <p>As you can see, you can use the remote config to define method names (string based)
31
- for other worker targets (lower case => app, data, vdom).
32
- Using the remote config will automatically create the matching namespaces inside the target workers.
33
- The remotely defined methods can then get called as a promise.
34
- Example inside the App worker (component.Base):
35
- </p>
36
- <pre><code>updateVdom(vdom, vnode) {
37
- let me = this;
38
-
39
- Neo.vdom.Helper.update({
40
- vdom : vdom,
41
- vnode: vnode
42
- }).then(data => {
43
- Object.keys(me.vnode).forEach(key => {
44
- delete me.vnode[key];
45
- });
46
-
47
- Object.assign(me.vnode, data.vnode);
48
-
49
- me.syncVdomIds(me.vnode, me.vdom);
50
- }).catch(err => {
51
- console.log('Error attempting to update component dom', err, me);
52
- });
53
- }</code></pre>
54
- <p>Obviously, using a remote method works asynchronously. What happens under the hood is that the app worker
55
- will send a postMessage to the main thread, main a postMessage to the VDom worker,
56
- vdom will send back the response to main and main forward this to app.
57
- We can reduce the routes once SharedWorkers are supported.</p>
58
- <p>You can directly promise messages to a target worker or the main thread as well.
59
- As an example: component.Base: updateStyle()</p>
60
- <pre><code>updateStyle(newValue, oldValue) {
61
- let delta = Style.compareStyles(newValue, oldValue);
62
-
63
- if (delta) {
64
- Neo.currentWorker.promiseMessage('main', {
65
- action: 'updateDom',
66
- deltas: [
67
- {
68
- id : this.id,
69
- style: delta
70
- }
71
- ]
72
- }).then(() => {
73
- console.log('Component style updated');
74
- }).catch(err => {
75
- console.log('Error attempting to update component style', err, this);
76
- });
77
- }
78
- }</code></pre>
79
- <p>This allows you to send messages directly to the main thread or to a different worker.
80
- In case the target is not main, neoteric will send the message to main and from there to the target worker
81
- and afterwards forward the reply back to the origin.</p>
82
- </article>
@@ -1,10 +0,0 @@
1
- <div class="neo-header-text-container">
2
- <span class="neo-header-text">Guide: EcmaScript 6+</span>
3
- </div>
4
- <article>
5
- <h3>Some useful resources:</h3>
6
- <p><a target="_blank" href="http://es6-features.org/#Constants">es6-features.org</a></p>
7
- <p><a target="_blank" href="https://dev.to/dipakkr/es6-a-comprehensive-guide-to-learn-es2015-es6-2ao1">dev.to/dipakkr</a></p>
8
- <p><a target="_blank" href="https://flaviocopes.com/es6/">flaviocopes.com/es6</a></p>
9
- <p><a target="_blank" href="https://www.telerik.com/blogs/es6-syntax-features-and-additions">telerik.com/blogs</a></p>
10
- </article>
@@ -1,9 +0,0 @@
1
- <div class="neo-header-text-container">
2
- <span class="neo-header-text">Guide: Web Workers</span>
3
- </div>
4
- <article>
5
- <h3>Some useful resources:</h3>
6
- <p><a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers">developer.mozilla.org</a></p>
7
- <p><a target="_blank" href="https://www.html5rocks.com/en/tutorials/workers/basics/">www.html5rocks.com</a></p>
8
- <p><a target="_blank" href="https://bugs.chromium.org/p/chromium/issues/detail?id=680046">bugs.chromium.org</a></p>
9
- </article>
@@ -1,7 +0,0 @@
1
- <script src="../../../../Users/tobiasuhlig/IdeaProjects/pdcat/pdcat-webapp/src/main/resources/static/app/ux/GridToolTipPlugin.js"></script>
2
- <div class="neo-header-text-container">
3
- <span class="neo-header-text">Tutorial: Dom Events</span>
4
- </div>
5
- <article>
6
-
7
- </article>