neo.mjs 7.0.5 → 7.1.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.
Files changed (79) hide show
  1. package/README.md +2 -2
  2. package/apps/ServiceWorker.mjs +2 -2
  3. package/apps/portal/index.html +1 -1
  4. package/apps/portal/model/Content.mjs +3 -2
  5. package/apps/portal/view/home/FooterContainer.mjs +1 -1
  6. package/apps/portal/view/home/parts/Features.mjs +5 -5
  7. package/examples/ServiceWorker.mjs +2 -2
  8. package/examples/todoList/version2/MainContainer.mjs +38 -48
  9. package/examples/todoList/version2/TodoList.mjs +6 -39
  10. package/examples/todoList/version2/TodoListModel.mjs +1 -1
  11. package/package.json +7 -7
  12. package/resources/data/deck/learnneo/pages/Welcome.md +0 -4
  13. package/resources/data/deck/learnneo/pages/guides/Forms.md +1 -0
  14. package/resources/data/deck/learnneo/pages/guides/InstanceLifecycle.md +1 -0
  15. package/resources/data/deck/learnneo/pages/guides/Layouts.md +1 -0
  16. package/resources/data/deck/learnneo/pages/guides/Mixins.md +1 -0
  17. package/resources/data/deck/learnneo/pages/guides/MultiWindow.md +1 -0
  18. package/resources/data/deck/learnneo/pages/guides/Tables.md +1 -0
  19. package/resources/data/deck/learnneo/pages/guides/events/DomEvents.md +263 -0
  20. package/resources/data/deck/learnneo/pages/{TodoList.md → tutorials/TodoList.md} +23 -33
  21. package/resources/data/deck/learnneo/tree.json +45 -48
  22. package/resources/scss/src/component/Splitter.scss +10 -1
  23. package/resources/scss/theme-dark/component/Splitter.scss +6 -3
  24. package/resources/scss/theme-light/component/Splitter.scss +6 -3
  25. package/resources/scss/theme-neo-light/component/Splitter.scss +6 -20
  26. package/src/DefaultConfig.mjs +2 -2
  27. package/src/code/LivePreview.mjs +28 -1
  28. package/src/collection/Base.mjs +1 -0
  29. package/src/component/Splitter.mjs +22 -4
  30. package/src/controller/Component.mjs +10 -10
  31. package/src/core/Observable.mjs +4 -27
  32. package/src/draggable/DragZone.mjs +6 -5
  33. package/src/grid/View.mjs +82 -0
  34. package/src/list/Base.mjs +16 -0
  35. package/src/main/addon/DragDrop.mjs +3 -2
  36. package/src/manager/DomEvent.mjs +30 -18
  37. package/src/table/View.mjs +82 -0
  38. package/src/util/Function.mjs +24 -0
  39. package/resources/data/deck/learnneo/pages/2023-10-08T20-37-30-658Z.md +0 -0
  40. package/resources/data/deck/learnneo/pages/2023-10-08T22-22-11-013Z.md +0 -0
  41. package/resources/data/deck/learnneo/pages/Earthquakes-01-goals.md +0 -32
  42. package/resources/data/deck/learnneo/pages/Earthquakes-Lab-01-generate-a-workspace.md +0 -47
  43. package/resources/data/deck/learnneo/pages/Earthquakes-Lab-02-generate-the-starter-app.md +0 -150
  44. package/resources/data/deck/learnneo/pages/Earthquakes-Lab-03-debugging.md +0 -136
  45. package/resources/data/deck/learnneo/pages/Earthquakes-Lab-04-fetch-data.md +0 -146
  46. package/resources/data/deck/learnneo/pages/Earthquakes-Lab-05-refactor-the-table.md +0 -146
  47. package/resources/data/deck/learnneo/pages/Earthquakes-Lab-06-use-a-view-model.md +0 -301
  48. package/resources/data/deck/learnneo/pages/Earthquakes-Lab-07-use-the-google-maps-addon.md +0 -175
  49. package/resources/data/deck/learnneo/pages/Earthquakes-Lab-08-events.md +0 -38
  50. package/resources/data/deck/learnneo/pages/TestLivePreview.md +0 -32
  51. package/resources/data/deck/learnneo/pages/WhatAboutHTML.md +0 -1
  52. package/resources/data/deck/learnneo/pages/stylesheet.md +0 -57
  53. /package/resources/data/deck/learnneo/pages/{WhyNeo-Effort.md → benefits/Effort.md} +0 -0
  54. /package/resources/data/deck/learnneo/pages/{WhyNeo-Features.md → benefits/Features.md} +0 -0
  55. /package/resources/data/deck/learnneo/pages/{WhyNeo-Intro.md → benefits/Introduction.md} +0 -0
  56. /package/resources/data/deck/learnneo/pages/{WhyNeo-Multi-Window.md → benefits/Multi-Window.md} +0 -0
  57. /package/resources/data/deck/learnneo/pages/{WhyNeo-Quick.md → benefits/Quick.md} +0 -0
  58. /package/resources/data/deck/learnneo/pages/{WhyNeo-Speed.md → benefits/Speed.md} +0 -0
  59. /package/resources/data/deck/learnneo/pages/{ComponentModels.md → gettingstarted/ComponentModels.md} +0 -0
  60. /package/resources/data/deck/learnneo/pages/{Config.md → gettingstarted/Config.md} +0 -0
  61. /package/resources/data/deck/learnneo/pages/{DescribingTheUI.md → gettingstarted/DescribingTheUI.md} +0 -0
  62. /package/resources/data/deck/learnneo/pages/{Events.md → gettingstarted/Events.md} +0 -0
  63. /package/resources/data/deck/learnneo/pages/{Extending.md → gettingstarted/Extending.md} +0 -0
  64. /package/resources/data/deck/learnneo/pages/{References.md → gettingstarted/References.md} +0 -0
  65. /package/resources/data/deck/learnneo/pages/{Setup.md → gettingstarted/Setup.md} +0 -0
  66. /package/resources/data/deck/learnneo/pages/{2023-10-14T19-25-08-153Z.md → gettingstarted/Workspaces.md} +0 -0
  67. /package/resources/data/deck/learnneo/pages/{ComponentsAndContainers.md → guides/ComponentsAndContainers.md} +0 -0
  68. /package/resources/data/deck/learnneo/pages/{CustomComponents.md → guides/CustomComponents.md} +0 -0
  69. /package/resources/data/deck/learnneo/pages/{MainThreadAddonExample.md → guides/MainThreadAddonExample.md} +0 -0
  70. /package/resources/data/deck/learnneo/pages/{MainThreadAddonIntro.md → guides/MainThreadAddonIntro.md} +0 -0
  71. /package/resources/data/deck/learnneo/pages/{GuideViewModels.md → guides/ViewModels.md} +0 -0
  72. /package/resources/data/deck/learnneo/pages/{GuideEvents.md → guides/events/CustomEvents.md} +0 -0
  73. /package/resources/data/deck/learnneo/pages/{2023-10-08T20-20-37-336Z.md → javascript/ClassFeatures.md} +0 -0
  74. /package/resources/data/deck/learnneo/pages/{2023-10-07T19-18-28-517Z.md → javascript/Classes.md} +0 -0
  75. /package/resources/data/deck/learnneo/pages/{2023-10-31T13-59-37-550Z.md → javascript/NewNode.md} +0 -0
  76. /package/resources/data/deck/learnneo/pages/{2023-10-08T20-20-07-934Z.md → javascript/Overrides.md} +0 -0
  77. /package/resources/data/deck/learnneo/pages/{2023-10-08T21-58-25-809Z.md → javascript/Super.md} +0 -0
  78. /package/resources/data/deck/learnneo/pages/{Earthquakes.md → tutorials/Earthquakes.md} +0 -0
  79. /package/resources/data/deck/learnneo/pages/{RSP.md → tutorials/RSP.md} +0 -0
@@ -1,136 +0,0 @@
1
- In this lab you'll get a little debugging practice by getting component references, changing properties,
2
- and runing methods.
3
-
4
- Remember that when using the debugger console you need to be in the _neo-app-worker_ context.
5
-
6
- <details>
7
- <summary>Use `Neo.manager.Component.items`</summary>
8
-
9
- While running the _earthquakes_ app, open Chrome devtools, choose the _neomjs-app-worker_ JavaScript
10
- context, and run this statement:
11
-
12
- Neo.manager.Component.items
13
-
14
- The `items` property is an array of all created components. The array may have a lot of entries, depending on
15
- the complexity of an app and how much you've done while running it. But it's an easy way to explore what's
16
- been created.
17
-
18
- </details>
19
-
20
- <details>
21
- <summary>Store as global variable</summary>
22
-
23
- Any time you have a object reference in the console &mdash; even if it's nested within an array or object &mdash;
24
- you can right click on the object and choose _Store as global_ variable. Chrome will create a variable named
25
- `temp1`, `temp2`, etc., that references the object. That can make it easier to inspect the object and run its methods..
26
-
27
-
28
- <img src="https://s3.amazonaws.com/mjs.neo.learning.images/earthquakes/StoreAsGlobal.png" style="width:80%"/>
29
-
30
- </details>
31
-
32
-
33
- <details>
34
- <summary>Use `Neo.find()` and `Neo.findFirst()`</summary>
35
-
36
- If you know what you're looking for, and don't want to bother inspecting everything in `Neo.manager.Component.items`,
37
- you can use `Neo.find()`, passing an object used to match against what you're searching for.
38
-
39
- `Neo.find()` returns an array of matching instances, and `Neo.findFirst()` returns the first matching item.
40
- Often you know there's only a single instance, so in practice `Neo.findFirst()` is more commonly used.
41
-
42
- You could find the button via Neo.find({ntype:'button'}) or Neo.find({text:'Button!'} (assuming you haven't changed
43
- the button's text.) You can even match a property you give the button. For example, if you configured it with a made-up
44
- property `foo:true`, you could find it via `Neo.findFirst({foo:true})`. The point is you can search for any properties
45
- you'd like.
46
-
47
- Try this out.
48
-
49
- `Neo.findFirst({text:'Button!'}).text = 'Foo!'
50
-
51
- You should see the button's text change immediately.
52
-
53
- </details>
54
-
55
-
56
- <details>
57
- <summary>Use `Shift-Ctrl-right-click`</summary>
58
-
59
- With your cursor over the button, press _Shift-Ctrl-right-click_. The console will log the button, its parent `MainView`
60
- and the subsequent parent `Viewport. The button reference shows up as `Base` because the button class name is `Neo.button.Base`.
61
-
62
- <img width="80%" src="https://s3.amazonaws.com/mjs.neo.learning.images/earthquakes/EarthquakesDemoShiftCtrl.png">
63
-
64
- Note that _Shift-Ctrl-right-click_ is only available during development &mdash; it isn't available in a build.
65
-
66
- </details>
67
-
68
-
69
- <details>
70
- <summary>Add a method</summary>
71
-
72
- As we mentioned, when debugging, if you a have a reference you can access or update its properties, or run
73
- its methods. Let's try that out by adding a method.
74
-
75
- Edit `apps/earthquakes/view/MainView.mjs` and add a method.
76
-
77
- <pre data-javascript>
78
-
79
- import Base from '../../../node_modules/neo.mjs/src/container/Base.mjs';
80
- import Button from '../../../node_modules/neo.mjs/src/button/Base.mjs';
81
- import Controller from './MainViewController.mjs';
82
- import ViewModel from './MainViewModel.mjs';
83
-
84
- class MainView extends Base {
85
- static config = {
86
- className: 'Earthquakes.view.MainView',
87
- ntype: 'earthquakes-main',
88
-
89
- controller: {module: Controller},
90
- model: {module: ViewModel},
91
-
92
- layout: {
93
- ntype: 'vbox',
94
- align: 'start'
95
- },
96
- items: [{
97
- module: Button,
98
- foo: true,
99
- text: 'Button!'
100
- }],
101
- }
102
- doFoo() {
103
- console.log('foo!');
104
- }
105
- }
106
-
107
- Neo.setupClass(MainView);
108
-
109
- export default MainView;
110
- </pre>
111
-
112
- Save your changes.
113
-
114
- As you can see, the code defined an instance method `doFoo()` that simply logs a message. We'll run the method via debugging techniques in the next step.
115
-
116
- </details>
117
-
118
- <details>
119
- <summary>Use `Neo.component.Manager.items` to run the method</summary>
120
-
121
- On the console run `Neo.component.Manager.items`. Expand the array and right-click on the entry for `MainView` and
122
- choose `Store object as global variable`. Then type `temp1.doFoo()` &mdash; you should see "foo!" being logged.
123
-
124
- Remember that you _must_ run console statement in the _neomjs-app-worker_ context, and every time your choose
125
- `Store object as global variable` it'll increment the name of the temp variable: `temp1`, `temp2`, etc.
126
- </details>
127
-
128
- <details>
129
- <summary>Use _Shift-Ctrl-right-click_ to run the method</summary>
130
-
131
- Now try the _Shift-Ctrl-right-click_ technique.
132
-
133
- With your cursor over the button, do a _Shift-Ctrl-right-click_ &mdash; you'll see the component hierarchy logged.
134
- As you did in the previous step, right-click on the entry for `MainView` and choose `Store object as global variable`.
135
- Then run `doFoo()` using that variable.
136
- </details>
@@ -1,146 +0,0 @@
1
- <details>
2
- <summary>Copy the table into its own class</summary>
3
-
4
- Create a new file named `apps/earthquakes/view/earthquakes/Table.mjs` with this content.
5
-
6
- <pre data-javascript>
7
- import Base from '../../../../node_modules/neo.mjs/src/table/Container.mjs';
8
-
9
- class Table extends Base {
10
- static config = {
11
- className: 'Earthquakes.view.earthquakes.Table',
12
- ntype: 'earthquakes-table',
13
- layout: {ntype: 'vbox', align: 'stretch'},
14
- style: {width: '100%'},
15
- columns: [{
16
- dataField: "timestamp",
17
- text: "Date",
18
- renderer: (data) => data.value.toLocaleDateString(undefined, {weekday: "long", year: "numeric", month: "long", day: "numeric"}),
19
- }, {
20
- dataField: "humanReadableLocation",
21
- text: "Location",
22
- }, {
23
- dataField: "size",
24
- text: "Magnitude",
25
- align: "right",
26
- renderer: (data) => data.value.toLocaleString(),
27
- }],
28
- }
29
- }
30
-
31
- Neo.setupClass(Table);
32
-
33
- export default Table;
34
- </pre>
35
-
36
- </details>
37
-
38
- <details>
39
- <summary>Review the code</summary>
40
-
41
- - The class extends `Neo.table.Container`
42
- - It has an `ntype`, which we can use when creating an instance, or when debugging
43
- - Each column has `text` and `dataField` configs, and some have renderers
44
-
45
- </details>
46
-
47
- <details>
48
- <summary>Use the new component</summary>
49
-
50
- Edit `apps/earthquakes/view/MainView` and make these changes.
51
-
52
- - Add `import EarthquakesTable from './earthquakes/Table.mjs';`
53
- - Replace the `module: Table` with `module: EarthquakesTable`
54
- - Remove the `columns:[]` config
55
- - Leave the `store` config alone
56
-
57
- Save and refresh the browser, and your app should run as before.
58
-
59
- You can confim that the new class _is being loaded_ by using DevTools to try to open `earthquakes/Table` &mdash; if it
60
- was imported, it'll be listed.
61
-
62
- You can confirm that an instance _was created_ by using the DevTools console and searching for it via
63
-
64
- Neo.first('earthquakes-table')
65
-
66
- </details>
67
-
68
- <details>
69
- <summary>Here's the code</summary>
70
-
71
- <pre data-javascript>
72
- import Base from '../../../node_modules/neo.mjs/src/container/Base.mjs';
73
- import Controller from './MainViewController.mjs';
74
- import EarthquakesTable from './earthquakes/Table.mjs';
75
- import Store from '../../../node_modules/neo.mjs/src/data/Store.mjs';
76
- import ViewModel from './MainViewModel.mjs';
77
-
78
- class MainView extends Base {
79
- static config = {
80
- className: 'Earthquakes.view.MainView',
81
- ntype: 'earthquakes-main',
82
-
83
- controller: {module: Controller},
84
- model: {module: ViewModel},
85
-
86
- layout: {ntype: 'vbox', align: 'stretch'},
87
- items: [{
88
- module: EarthquakesTable,
89
- store: {
90
- module: Store,
91
- model: {
92
- fields: [{
93
- name: "humanReadableLocation",
94
- }, {
95
- name: "size",
96
- }, {
97
- name: "timestamp",
98
- type: "Date",
99
- }],
100
- },
101
- url: "https://apis.is/earthquake/is",
102
- responseRoot: "results",
103
- autoLoad: true,
104
- },
105
- style: {width: '100%'},
106
- }],
107
- }
108
- }
109
-
110
- Neo.setupClass(MainView);
111
-
112
- export default MainView;
113
- </pre>
114
-
115
- </details>
116
-
117
- <details>
118
- <summary>Why are some things in `MainView` and not in `Table`?</summary>
119
-
120
- When we refactored the table into its own class we didn't move all the configs. Both
121
- the width styling and `store` were left in `MainView`. Why?
122
-
123
- It's a matter of re-use and what you need in a given situation. By leaving the width specification
124
- outside the table class we're to specify a different value in all the places we're using the table.
125
-
126
- Similarly, if the store were in the table class, it would be using that specific store and
127
- each instance of the table would have its own instance of the store. If we want multiple
128
- instance of the table with each using a different store &mdash; or if
129
- we wanted to share the store with other components &mdash; then it makes sense for the
130
- store to be outside the table class.
131
-
132
- </details>
133
-
134
- <details>
135
- <summary>Make a second instance of the table</summary>
136
-
137
- To further illustrate that the table is reusable, let's create a second instance.
138
-
139
- Simply copy-and-paste the value in the `MainView` `items` with an identical second item.
140
-
141
- Save and refresh and you should see two tables.
142
-
143
- <img style="width:80%" src="https://s3.amazonaws.com/mjs.neo.learning.images/earthquakes/EarthquakesTwoTables.png"></img>
144
-
145
- </details>
146
-
@@ -1,146 +0,0 @@
1
- <details>
2
- <summary>Copy the table into its own class</summary>
3
-
4
- Create a new file named `apps/earthquakes/view/earthquakes/Table.mjs` with this content.
5
-
6
- <pre data-javascript>
7
- import Base from '../../../../node_modules/neo.mjs/src/table/Container.mjs';
8
-
9
- class Table extends Base {
10
- static config = {
11
- className: 'Earthquakes.view.earthquakes.Table',
12
- ntype: 'earthquakes-table',
13
- layout: {ntype: 'vbox', align: 'stretch'},
14
- style: {width: '100%'},
15
- columns: [{
16
- dataField: "timestamp",
17
- text: "Date",
18
- renderer: (data) => data.value.toLocaleDateString(undefined, {weekday: "long", year: "numeric", month: "long", day: "numeric"}),
19
- }, {
20
- dataField: "humanReadableLocation",
21
- text: "Location",
22
- }, {
23
- dataField: "size",
24
- text: "Magnitude",
25
- align: "right",
26
- renderer: (data) => data.value.toLocaleString(),
27
- }],
28
- }
29
- }
30
-
31
- Neo.setupClass(Table);
32
-
33
- export default Table;
34
- </pre>
35
-
36
- </details>
37
-
38
- <details>
39
- <summary>Review the code</summary>
40
-
41
- - The class extends `Neo.table.Container`
42
- - It has an `ntype`, which we can use when creating an instance, or when debugging
43
- - Each column has `text` and `dataField` configs, and some have renderers
44
-
45
- </details>
46
-
47
- <details>
48
- <summary>Use the new component</summary>
49
-
50
- Edit `apps/earthquakes/view/MainView` and make these changes.
51
-
52
- - Add `import EarthquakesTable from './earthquakes/Table.mjs';`
53
- - Replace the `module: Table` with `module: EarthquakesTable`
54
- - Remove the `columns:[]` config
55
- - Leave the `store` config alone
56
-
57
- Save and refresh the browser, and your app should run as before.
58
-
59
- You can confim that the new class _is being loaded_ by using DevTools to try to open `earthquakes/Table` &mdash; if it
60
- was imported, it'll be listed.
61
-
62
- You can confirm that an instance _was created_ by using the DevTools console and searching for it via
63
-
64
- Neo.first('earthquakes-table')
65
-
66
- </details>
67
-
68
- <details>
69
- <summary>Here's the code</summary>
70
-
71
- <pre data-javascript>
72
- import Base from '../../../node_modules/neo.mjs/src/container/Base.mjs';
73
- import Controller from './MainViewController.mjs';
74
- import EarthquakesTable from './earthquakes/Table.mjs';
75
- import Store from '../../../node_modules/neo.mjs/src/data/Store.mjs';
76
- import ViewModel from './MainViewModel.mjs';
77
-
78
- class MainView extends Base {
79
- static config = {
80
- className: 'Earthquakes.view.MainView',
81
- ntype: 'earthquakes-main',
82
-
83
- controller: {module: Controller},
84
- model: {module: ViewModel},
85
-
86
- layout: {ntype: 'vbox', align: 'stretch'},
87
- items: [{
88
- module: EarthquakesTable,
89
- store: {
90
- module: Store,
91
- model: {
92
- fields: [{
93
- name: "humanReadableLocation",
94
- }, {
95
- name: "size",
96
- }, {
97
- name: "timestamp",
98
- type: "Date",
99
- }],
100
- },
101
- url: "https://apis.is/earthquake/is",
102
- responseRoot: "results",
103
- autoLoad: true,
104
- },
105
- style: {width: '100%'},
106
- }],
107
- }
108
- }
109
-
110
- Neo.setupClass(MainView);
111
-
112
- export default MainView;
113
- </pre>
114
-
115
- </details>
116
-
117
- <details>
118
- <summary>Why are some things in `MainView` and not in `Table`?</summary>
119
-
120
- When we refactored the table into its own class we didn't move all the configs. Both
121
- the width styling and `store` were left in `MainView`. Why?
122
-
123
- It's a matter of re-use and what you need in a given situation. By leaving the width specification
124
- outside the table class we're free to specify a different value the various places we might be using the table.
125
-
126
- Similarly, if the store were in the table class, it would be using that specific store and
127
- each instance of the table would have its own instance of the store. If we want multiple
128
- instance of the table with each using a different store &mdash; or if
129
- we wanted to share the store with other components &mdash; then it makes sense for the
130
- store to be outside the table class.
131
-
132
- </details>
133
-
134
- <details>
135
- <summary>Make a second instance of the table</summary>
136
-
137
- To further illustrate that the table is reusable, let's create a second instance.
138
-
139
- Simply copy-and-paste the value in the `MainView` `items` with an identical second item.
140
-
141
- Save and refresh and you should see two tables.
142
-
143
- <img style="width:80%" src="https://s3.amazonaws.com/mjs.neo.learning.images/earthquakes/EarthquakesTwoTables.png"></img>
144
-
145
- </details>
146
-