neo.mjs 5.9.3 → 5.10.1

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 (29) hide show
  1. package/apps/ServiceWorker.mjs +2 -2
  2. package/buildScripts/createClass.mjs +1 -3
  3. package/examples/ServiceWorker.mjs +2 -2
  4. package/examples/container/base/MainContainer.mjs +78 -0
  5. package/examples/container/{app.mjs → base/app.mjs} +1 -1
  6. package/examples/container/{index.html → base/index.html} +1 -1
  7. package/examples/container/{neo-config.json → base/neo-config.json} +2 -2
  8. package/examples/container/dialog/MainContainer.mjs +68 -0
  9. package/examples/container/dialog/MainContainerController.mjs +80 -0
  10. package/examples/container/dialog/app.mjs +6 -0
  11. package/examples/container/dialog/index.html +11 -0
  12. package/examples/container/dialog/neo-config.json +7 -0
  13. package/package.json +3 -3
  14. package/resources/scss/src/component/Process.scss +190 -0
  15. package/resources/scss/src/container/Dialog.scss +12 -0
  16. package/resources/scss/src/form/field/Switch.scss +135 -0
  17. package/resources/scss/theme-dark/component/Process.scss +21 -0
  18. package/resources/scss/theme-dark/form/field/Picker.scss +1 -1
  19. package/resources/scss/theme-dark/form/field/Switch.scss +17 -0
  20. package/resources/scss/theme-light/component/Process.scss +21 -0
  21. package/resources/scss/theme-light/form/field/Switch.scss +17 -0
  22. package/src/DefaultConfig.mjs +2 -2
  23. package/src/component/Process.mjs +180 -0
  24. package/src/container/Dialog.mjs +221 -0
  25. package/src/dialog/header/Toolbar.mjs +7 -7
  26. package/src/form/field/Select.mjs +15 -9
  27. package/src/form/field/Switch.mjs +43 -0
  28. package/src/main/addon/Dialog.mjs +68 -0
  29. package/examples/container/MainContainer.mjs +0 -93
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.9.3'
23
+ * @member {String} version='5.10.1'
24
24
  */
25
- version: '5.9.3'
25
+ version: '5.10.1'
26
26
  }
27
27
 
28
28
  /**
@@ -674,9 +674,7 @@ if (programOpts.info) {
674
674
  );
675
675
 
676
676
  isSingleton && classContent.push(
677
- `let instance = Neo.create(${file});`,
678
- "",
679
- "Neo.applyToGlobalNs(instance);",
677
+ `let instance = Neo.applyClassConfig(${file});`,
680
678
  "",
681
679
  "export default instance;"
682
680
  );
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.9.3'
23
+ * @member {String} version='5.10.1'
24
24
  */
25
- version: '5.9.3'
25
+ version: '5.10.1'
26
26
  }
27
27
 
28
28
  /**
@@ -0,0 +1,78 @@
1
+ import Button from '../../../src/button/Base.mjs';
2
+ import Container from '../../../src/container/Base.mjs';
3
+
4
+ /**
5
+ * @class Neo.examples.container.base.MainContainer
6
+ * @extends Neo.container.Base
7
+ */
8
+ class MainContainer extends Container {
9
+ static config = {
10
+ className: 'Neo.examples.container.base.MainContainer',
11
+ autoMount: true,
12
+ layout : 'vbox',
13
+
14
+ items: [{
15
+ ntype : 'button',
16
+ iconCls: 'fa fa-home',
17
+ text : 'Hello',
18
+ width : 200
19
+ }, {
20
+ ntype : 'button',
21
+ iconCls: 'fa fa-user',
22
+ text : 'World'
23
+ }, {
24
+ ntype : 'container',
25
+ layout: {
26
+ ntype: 'hbox',
27
+ align: 'stretch'
28
+ },
29
+ items : [{
30
+ ntype : 'button',
31
+ iconCls: 'fa fa-home',
32
+ style : {color: 'red'},
33
+ text : 'Hello2',
34
+ width : 200
35
+ }, {
36
+ ntype : 'button',
37
+ flex : 1,
38
+ iconCls : 'fa fa-user',
39
+ iconColor: 'red',
40
+ text : 'World2'
41
+ }]
42
+ }, {
43
+ ntype: 'container',
44
+
45
+ layout: {
46
+ ntype: 'vbox',
47
+ align: 'start'
48
+ },
49
+
50
+ style: {
51
+ marginTop: '30px'
52
+ },
53
+
54
+ items: [{
55
+ ntype : 'button',
56
+ iconCls : 'fa fa-home',
57
+ iconPosition: 'right',
58
+ text : 'Right'
59
+ }, {
60
+ ntype : 'button',
61
+ flex : 1,
62
+ iconCls : 'fa fa-user',
63
+ iconPosition: 'top',
64
+ text : 'Top'
65
+ }, {
66
+ ntype : 'button',
67
+ flex : 1,
68
+ iconCls : 'fa fa-play-circle',
69
+ iconPosition: 'bottom',
70
+ text : 'Bottom'
71
+ }]
72
+ }]
73
+ }
74
+ }
75
+
76
+ Neo.applyClassConfig(MainContainer);
77
+
78
+ export default MainContainer;
@@ -2,6 +2,6 @@ import MainContainer from './MainContainer.mjs';
2
2
 
3
3
  export const onStart = () => Neo.app({
4
4
  mainView: MainContainer,
5
- name : 'Neo.examples.container',
5
+ name : 'Neo.examples.container.base',
6
6
  parentId: 'main-container'
7
7
  });
@@ -9,6 +9,6 @@
9
9
  <p>Container Demo</p>
10
10
  <div id="main-container"></div>
11
11
 
12
- <script src="../../src/MicroLoader.mjs" type="module"></script>
12
+ <script src="../../../src/MicroLoader.mjs" type="module"></script>
13
13
  </body>
14
14
  </html>
@@ -1,6 +1,6 @@
1
1
  {
2
- "appPath" : "examples/container/app.mjs",
3
- "basePath" : "../../",
2
+ "appPath" : "examples/container/base/app.mjs",
3
+ "basePath" : "../../../",
4
4
  "environment": "development",
5
5
  "mainPath" : "./Main.mjs",
6
6
  "themes" : ["neo-theme-dark"]
@@ -0,0 +1,68 @@
1
+ import Button from '../../../src/button/Base.mjs';
2
+ import ConfigurationViewport from '../../ConfigurationViewport.mjs';
3
+ import MainContainerController from './MainContainerController.mjs';
4
+ import NumberField from '../../../src/form/field/Number.mjs';
5
+ import TextField from '../../../src/form/field/Text.mjs';
6
+
7
+ /**
8
+ * @class Neo.examples.container.dialog.MainContainer
9
+ * @extends Neo.examples.ConfigurationViewport
10
+ */
11
+ class MainContainer extends ConfigurationViewport {
12
+ static config = {
13
+ className : 'Neo.examples.container.dialog.MainContainer',
14
+ configItemLabelWidth: 160,
15
+ configItemWidth : 280,
16
+ controller : MainContainerController,
17
+ layout : {ntype: 'hbox', align: 'stretch'}
18
+ }
19
+
20
+ createConfigurationComponents() {
21
+ let me = this;
22
+
23
+ return [{
24
+ module : TextField,
25
+ clearable : true,
26
+ labelText : 'title',
27
+ listeners : {change: me.controller.onConfigChange.bind(me.controller, 'title')},
28
+ style : {marginTop: '10px'},
29
+ value : 'example dialog'
30
+ }, {
31
+ module : NumberField,
32
+ clearable : true,
33
+ labelText : 'height',
34
+ listeners : {change: me.controller.onConfigChange.bind(me.controller, 'height')},
35
+ maxValue : 1000,
36
+ minValue : 100,
37
+ stepSize : 10,
38
+ style : {marginTop: '10px'},
39
+ value : 300
40
+ }, {
41
+ module : NumberField,
42
+ clearable : true,
43
+ labelText : 'width',
44
+ listeners : {change: me.controller.onConfigChange.bind(me.controller, 'width')},
45
+ maxValue : 2000,
46
+ minValue : 100,
47
+ stepSize : 10,
48
+ style : {marginTop: '10px'},
49
+ value : 500
50
+ }];
51
+ }
52
+
53
+ createExampleComponent() {
54
+ let controller = this.getController();
55
+ return Neo.create({
56
+ module : Button,
57
+ height : 50,
58
+ text : 'show Dialog',
59
+ ui : 'primary',
60
+ width : 150,
61
+ handler : controller.onButtonClick.bind(controller)
62
+ });
63
+ }
64
+ }
65
+
66
+ Neo.applyClassConfig(MainContainer);
67
+
68
+ export default MainContainer;
@@ -0,0 +1,80 @@
1
+ import Component from '../../../src/controller/Component.mjs';
2
+
3
+ /**
4
+ * @class Neo.examples.container.dialog.MainContainerController
5
+ * @extends Neo.controller.Component
6
+ */
7
+ class MainContainerController extends Component {
8
+ static config = {
9
+ /**
10
+ * @member {String} className='Neo.examples.container.dialog.MainContainerController'
11
+ * @protected
12
+ */
13
+ className: 'Neo.examples.container.dialog.MainContainerController'
14
+ }
15
+
16
+ dialog = null;
17
+ title = 'example dialog';
18
+ height = 300;
19
+ width = 500;
20
+
21
+ /**
22
+ *
23
+ * @param {*} config
24
+ */
25
+ construct(config) {
26
+ super.construct(config);
27
+ }
28
+
29
+ /**
30
+ *
31
+ * @param {Object} data
32
+ */
33
+ async onButtonClick(data) {
34
+ if (!this.dialog) {
35
+ let module = await import ('../../../src/container/Dialog.mjs');
36
+ this.dialog = Neo.create({
37
+ module: module.default,
38
+ appName: this.component.appName,
39
+ autoMount: true,
40
+ autoRender: true,
41
+ title: this.title,
42
+ height: this.height,
43
+ width: this.width,
44
+ iconCls: ['fa', 'fa-home'],
45
+
46
+ headerConfig: {
47
+ items: [{
48
+ ntype: 'button',
49
+ text: 'foo'
50
+ }],
51
+ style: {borderBottom: 'solid 1px #bdbdbd'}
52
+ },
53
+
54
+ items: [{
55
+ ntype: 'container',
56
+ html: 'text'
57
+ }]
58
+ })
59
+ }
60
+ this.dialog.show();
61
+
62
+ console.log(data, this);
63
+ }
64
+
65
+ /**
66
+ * @param {String} config
67
+ * @param {Object} opts
68
+ */
69
+ onConfigChange(config, opts) {
70
+ if (this.dialog) {
71
+ this.dialog[config] = opts.value;
72
+ } else {
73
+ this[config] = opts.value;
74
+ }
75
+ }
76
+ }
77
+
78
+ Neo.applyClassConfig(MainContainerController);
79
+
80
+ export default MainContainerController;
@@ -0,0 +1,6 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ export const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.container.dialog'
6
+ });
@@ -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 Dialog</title>
7
+ </head>
8
+ <body>
9
+ <script src="../../../src/MicroLoader.mjs" type="module"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,7 @@
1
+ {
2
+ "appPath" : "examples/container/dialog/app.mjs",
3
+ "basePath" : "../../../",
4
+ "environment": "development",
5
+ "mainPath" : "./Main.mjs",
6
+ "mainThreadAddons": ["DragDrop", "ScrollSync", "Stylesheet", "Dialog"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "5.9.3",
3
+ "version": "5.10.1",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -52,12 +52,12 @@
52
52
  "envinfo": "^7.8.1",
53
53
  "fs-extra": "^11.1.1",
54
54
  "highlightjs-line-numbers.js": "^2.8.0",
55
- "inquirer": "^9.2.3",
55
+ "inquirer": "^9.2.6",
56
56
  "neo-jsdoc": "^1.0.1",
57
57
  "neo-jsdoc-x": "^1.0.5",
58
58
  "postcss": "^8.4.23",
59
59
  "sass": "^1.62.1",
60
- "webpack": "^5.82.1",
60
+ "webpack": "^5.84.1",
61
61
  "webpack-cli": "^5.1.1",
62
62
  "webpack-dev-server": "4.15.0",
63
63
  "webpack-hook-plugin": "^1.0.7",
@@ -0,0 +1,190 @@
1
+ .neo-process {
2
+ // will be set by the component if changes
3
+ --process-arrow-color: v(process-arrow-color);
4
+ --process-icon-color: v(process-icon-color);
5
+
6
+ display: flex;
7
+ background-color: v(process-background-color);
8
+ padding: 0.5rem;
9
+
10
+ .process-step {
11
+ position: relative;
12
+ z-index: 0;
13
+ padding: 0.75rem;
14
+
15
+ .arrow {
16
+ width: 0;
17
+ height: 0;
18
+ position: absolute;
19
+ top: 50%;
20
+
21
+ &.white {
22
+ z-index: 1;
23
+ border-bottom: 10px solid transparent;
24
+ border-right: 10px solid transparent;
25
+ }
26
+
27
+ &.yellow {
28
+ z-index: -1;
29
+ border-bottom: 20px solid transparent;
30
+ border-right: 20px solid transparent;
31
+ }
32
+ }
33
+
34
+ .slit {
35
+ position: absolute;
36
+ inset: 0;
37
+ }
38
+
39
+ .process-content {
40
+ position: relative;
41
+
42
+ .process-step-icon {
43
+ margin-left: auto;
44
+ margin-right: auto;
45
+ width: 100%;
46
+ text-align: center;
47
+ height: v(process-icon-size);
48
+ z-index: 10;
49
+
50
+ &::before {
51
+ // Do NOT switch to v()
52
+ color: var(--process-icon-color);
53
+ font-size: v(process-icon-size);
54
+ }
55
+ }
56
+
57
+ .process-step-header {
58
+ display: block;
59
+ color: v(process-title-color);
60
+ word-break: break-word;
61
+ text-align: center;
62
+ text-transform: uppercase;
63
+ margin: 1.5rem 0;
64
+ }
65
+
66
+ .process-step-text {
67
+ text-align: center;
68
+ display: block;
69
+ color: v(process-text-color);
70
+ font-size: 1em;
71
+ font-weight: 400;
72
+ line-height: 1.5;
73
+ }
74
+ }
75
+ }
76
+
77
+ &.neo-process-horizontal {
78
+ flex-direction: row;
79
+
80
+ .process-step {
81
+ .arrow.white {
82
+ border-left: 10px solid v(process-background-color);
83
+ border-top: 10px solid transparent;
84
+ top: 50%;
85
+ left: 0;
86
+ margin-left: 0;
87
+ margin-top: -10px;
88
+ }
89
+
90
+ .arrow.yellow {
91
+ // Do NOT switch to v()
92
+ border-left: 20px solid var(--process-arrow-color);
93
+ border-top: 20px solid transparent;
94
+ top: 50%;
95
+ left: 0;
96
+ margin-left: 0;
97
+ margin-top: -20px;
98
+ }
99
+
100
+ .slit {
101
+ box-shadow: inset 0 100px 50px -40px v(process-background-color),
102
+ inset 0 -100px 50px -40px v(process-background-color),
103
+ inset 5px 0 10px -5px v(process-shadow-color);
104
+ }
105
+
106
+ .process-content {
107
+ padding-left: 30px;
108
+ padding-top: 0;
109
+ }
110
+ }
111
+ }
112
+
113
+ &.neo-process-vertical {
114
+ flex-direction: column;
115
+
116
+ .process-step {
117
+ .arrow.white {
118
+ border-left: 10px solid transparent;
119
+ border-top: 10px solid v(process-background-color);
120
+ top: 0;
121
+ left: 50%;
122
+ margin-left: -10px;
123
+ margin-top: 0;
124
+
125
+ }
126
+
127
+ .arrow.yellow {
128
+ border-left: 20px solid transparent;
129
+ // Do NOT switch to v()
130
+ border-top: 20px solid var(--process-arrow-color);
131
+ top: 0;
132
+ left: 50%;
133
+ margin-left: -20px;
134
+ margin-top: 0;
135
+ }
136
+
137
+ .slit {
138
+ box-shadow: inset 80px 0 50px -40px v(process-background-color),
139
+ inset -80px 0 50px -40px v(process-background-color),
140
+ inset 0 5px 10px -5px v(process-shadow-color);
141
+ }
142
+
143
+ .process-content {
144
+ padding-left: 0;
145
+ padding-top: 30px;
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ @media screen and (max-width: 700px) {
152
+ .neo-process {
153
+ &.neo-process-horizontal {
154
+ flex-direction: column;
155
+
156
+ .process-step {
157
+ .arrow.white {
158
+ border-left: 10px solid transparent;
159
+ border-top: 10px solid v(process-background-color);
160
+ top: 0;
161
+ left: 50%;
162
+ margin-left: -10px;
163
+ margin-top: 0;
164
+
165
+ }
166
+
167
+ .arrow.yellow {
168
+ border-left: 20px solid transparent;
169
+ // Do NOT switch to v()
170
+ border-top: 20px solid var(--process-arrow-color);
171
+ top: 0;
172
+ left: 50%;
173
+ margin-left: -20px;
174
+ margin-top: 0;
175
+ }
176
+
177
+ .slit {
178
+ box-shadow: inset 80px 0 50px -40px v(process-background-color),
179
+ inset -80px 0 50px -40px v(process-background-color),
180
+ inset 0 5px 10px -5px v(process-shadow-color);
181
+ }
182
+
183
+ .process-content {
184
+ padding-left: 0;
185
+ padding-top: 30px;
186
+ }
187
+ }
188
+ }
189
+ }
190
+ }
@@ -0,0 +1,12 @@
1
+ .neo-container-dialog {
2
+ padding: 0;
3
+ z-index: 100;
4
+
5
+ &:not([open]) {
6
+ display: none;
7
+ }
8
+
9
+ > div {
10
+ padding: 1em;
11
+ }
12
+ }
@@ -0,0 +1,135 @@
1
+ .switchfield {
2
+ @keyframes switch-on-position {
3
+ 0% {
4
+ left: 0;
5
+ right: 50%
6
+ }
7
+ 25% {
8
+ left: 0;
9
+ right: 37.5%
10
+ }
11
+ 100% {
12
+ left: 50%;
13
+ right: 0
14
+ }
15
+ }
16
+
17
+ @keyframes switch-off-position {
18
+ 0% {
19
+ left: 50%;
20
+ right: 0
21
+ }
22
+ 25% {
23
+ left: 37.5%;
24
+ right: 0
25
+ }
26
+ 100% {
27
+ left: 0%;
28
+ right: 50%
29
+ }
30
+ }
31
+
32
+ @keyframes switch-on-transform {
33
+ 0% {
34
+ transform: translate(0) scaleX(1)
35
+ }
36
+ 25% {
37
+ transform: translate(0) scaleX(1.33)
38
+ }
39
+ 100% {
40
+ transform: translate(100%) scaleX(1)
41
+ }
42
+ }
43
+
44
+ @keyframes switch-off-transform {
45
+ 0% {
46
+ transform: translate(100%) scaleX(1)
47
+ }
48
+ 25% {
49
+ transform: translate(100%) scaleX(1.33)
50
+ }
51
+ 100% {
52
+ transform: translate(0) scaleX(1)
53
+ }
54
+ }
55
+
56
+ input[type="checkbox"] {
57
+ position: relative;
58
+ display: inline-block;
59
+ -webkit-appearance: none;
60
+ -webkit-tap-highlight-color: transparent;
61
+ height: 1.5em;
62
+ width: 3em;
63
+ font-size: 1.5em;
64
+
65
+ border-radius: 1.25em;
66
+ background-color: v(switchfield-background-color);
67
+ border-color: transparent;
68
+ background-clip: padding-box;
69
+ color: v(switchfield-inactive-color);
70
+ vertical-align: middle;
71
+ transition: all 0.25s linear 0.25s;
72
+
73
+
74
+ &::before {
75
+ content: "";
76
+ position: absolute;
77
+ top: 0;
78
+ left: 0;
79
+ bottom: 0;
80
+ right: 50%;
81
+ background-color: v(switchfield-thumb-color);
82
+ border-radius: 100%;
83
+ border: 0.125em solid transparent;
84
+ background-clip: padding-box;
85
+ z-index: 2;
86
+ transform-origin: right center;
87
+ }
88
+
89
+ &::after {
90
+ position: absolute;
91
+ left: 0.5em;
92
+ top: 0.15em;
93
+ line-height: 1.5;
94
+ font-family: "Font Awesome 6 Free";
95
+ font-weight: 900;
96
+ content: "\f00c\f00d";
97
+ letter-spacing: 1em;
98
+ z-index: 1;
99
+ font-size: 1.25rem;
100
+ }
101
+
102
+ &:focus {
103
+ color: v(switchfield-active-color);
104
+ border-color: transparent;
105
+ background-color: v(switchfield-background-color);
106
+ outline: none;
107
+ }
108
+
109
+ &:checked {
110
+ color: v(switchfield-inactive-color);
111
+ background-color: v(switchfield-checked);
112
+ border-color: transparent;
113
+
114
+ &::before {
115
+ transform-origin: left center;
116
+ }
117
+ }
118
+ }
119
+
120
+ input[type="checkbox"]::before {
121
+ animation: switch-off-position 0.25s ease-out forwards;
122
+ }
123
+
124
+ input[type="checkbox"]:checked::before {
125
+ animation: switch-on-position 0.25s ease-out forwards;
126
+ }
127
+
128
+ input[type="checkbox"]::before {
129
+ animation: switch-off-transform 0.25s ease-out forwards;
130
+ }
131
+
132
+ input[type="checkbox"]:checked::before {
133
+ animation: switch-on-transform 0.25s ease-out forwards;
134
+ }
135
+ }