neo.mjs 4.6.9 → 4.6.11

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 (24) hide show
  1. package/examples/{toast → component/toast}/MainContainer.mjs +18 -17
  2. package/examples/{toast → component/toast}/MainContainerController.mjs +5 -5
  3. package/examples/{toast → component/toast}/app.mjs +1 -1
  4. package/examples/{toast → component/toast}/index.html +2 -2
  5. package/examples/component/toast/neo-config.json +7 -0
  6. package/examples/{toast → component/toast}/resources/highlight/CHANGES.md +0 -0
  7. package/examples/{toast → component/toast}/resources/highlight/LICENSE +0 -0
  8. package/examples/{toast → component/toast}/resources/highlight/README.md +0 -0
  9. package/examples/{toast → component/toast}/resources/highlight/highlight.pack.js +0 -0
  10. package/examples/{toast → component/toast}/resources/highlightjs-custom-dark-theme.css +0 -0
  11. package/examples/{toast → component/toast}/resources/highlightjs-custom-github-theme.css +0 -0
  12. package/package.json +1 -1
  13. package/resources/scss/src/form/field/CheckBox.scss +1 -0
  14. package/resources/scss/src/form/field/Radio.scss +1 -0
  15. package/resources/scss/theme-dark/form/field/CheckBox.scss +7 -5
  16. package/resources/scss/theme-dark/form/field/Radio.scss +7 -5
  17. package/resources/scss/theme-light/form/field/CheckBox.scss +7 -5
  18. package/resources/scss/theme-light/form/field/Radio.scss +7 -5
  19. package/src/component/Base.mjs +1 -1
  20. package/src/form/field/CheckBox.mjs +35 -1
  21. package/src/form/field/Radio.mjs +5 -1
  22. package/src/form/field/Text.mjs +16 -2
  23. package/src/main/DomEvents.mjs +7 -9
  24. package/examples/toast/neo-config.json +0 -7
@@ -1,20 +1,20 @@
1
- import Button from '../../src/button/Base.mjs';
2
- import CheckBox from '../../src/form/field/CheckBox.mjs';
3
- import Component from '../../src/component/Base.mjs';
4
- import FormContainer from '../../src/form/Container.mjs';
1
+ import Button from '../../../src/button/Base.mjs';
2
+ import CheckBox from '../../../src/form/field/CheckBox.mjs';
3
+ import Component from '../../../src/component/Base.mjs';
4
+ import FormContainer from '../../../src/form/Container.mjs';
5
5
  import MainContainerController from './MainContainerController.mjs';
6
- import NumberField from '../../src/form/field/Number.mjs';
7
- import SelectField from '../../src/form/field/Select.mjs';
8
- import TextField from '../../src/form/field/Text.mjs';
9
- import Viewport from '../../src/container/Viewport.mjs';
6
+ import NumberField from '../../../src/form/field/Number.mjs';
7
+ import SelectField from '../../../src/form/field/Select.mjs';
8
+ import TextField from '../../../src/form/field/Text.mjs';
9
+ import Viewport from '../../../src/container/Viewport.mjs';
10
10
 
11
11
  /**
12
- * @class Neo.examples.toast.MainContainer
12
+ * @class Neo.examples.component.toast.MainContainer
13
13
  * @extends Neo.container.Viewport
14
14
  */
15
15
  class MainContainer extends Viewport {
16
16
  static getConfig() {return {
17
- className : 'Neo.examples.toast.MainContainer',
17
+ className : 'Neo.examples.component.toast.MainContainer',
18
18
  autoMount : true,
19
19
  controller: MainContainerController,
20
20
  layout: {ntype: 'hbox', align: 'stretch'},
@@ -79,12 +79,13 @@ class MainContainer extends Viewport {
79
79
  name : 'timeout',
80
80
  maxValue : 99999
81
81
  }, {
82
- module : CheckBox,
83
- labelText : 'Closable',
84
- labelWidth: 70,
85
- name : 'closable',
86
- reference : 'closable',
87
- style : {padding: '8px 0 10px 9px'}
82
+ module : CheckBox,
83
+ labelPosition: 'left',
84
+ labelText : 'Closable',
85
+ labelWidth : 70,
86
+ name : 'closable',
87
+ reference : 'closable',
88
+ style : {padding: '8px 0 10px 9px'}
88
89
  }, {
89
90
  module : Button,
90
91
  reference: 'creation-button',
@@ -108,7 +109,7 @@ class MainContainer extends Viewport {
108
109
 
109
110
  itemTpl: data => {
110
111
  return [
111
- {cls: 'import', innerHTML: 'import Toast from \'../../../../node_modules/neo.mjs/src/dialog/Toast.mjs\';'},
112
+ {cls: 'import', innerHTML: 'import Toast from \'../../../../node_modules/neo.mjs/src/component/Toast.mjs\';'},
112
113
  {innerHTML: 'Neo.toast({'},
113
114
  {cls: 'tab', cn: [
114
115
  {cls: 'grey', innerHTML: '/* mandatory */'},
@@ -1,17 +1,17 @@
1
- import ComponentController from '../../src/controller/Component.mjs';
2
- import Toast from '../../src/component/Toast.mjs';
1
+ import ComponentController from '../../../src/controller/Component.mjs';
2
+ import Toast from '../../../src/component/Toast.mjs';
3
3
 
4
4
  /**
5
- * @class Neo.examples.toast.MainContainerController
5
+ * @class Neo.examples.component.toast.MainContainerController
6
6
  * @extends Neo.controller.Component
7
7
  */
8
8
  class MainContainerController extends ComponentController {
9
9
  static getConfig() {return {
10
10
  /**
11
- * @member {String} className='Neo.examples.toast.MainContainerController'
11
+ * @member {String} className='Neo.examples.component.toast.MainContainerController'
12
12
  * @protected
13
13
  */
14
- className: 'Neo.examples.toast.MainContainerController'
14
+ className: 'Neo.examples.component.toast.MainContainerController'
15
15
  }}
16
16
 
17
17
  /**
@@ -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.toast'
5
+ name : 'Neo.examples.component.toast'
6
6
  });
7
7
 
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1">
5
5
  <meta charset="UTF-8">
6
- <title>Neo GoogleMaps Component</title>
6
+ <title>Neo Toast Component</title>
7
7
 
8
8
  <style>
9
9
  .output {
@@ -22,6 +22,6 @@
22
22
  </head>
23
23
  </head>
24
24
  <body>
25
- <script src="../../src/MicroLoader.mjs" type="module"></script>
25
+ <script src="../../../src/MicroLoader.mjs" type="module"></script>
26
26
  </body>
27
27
  </html>
@@ -0,0 +1,7 @@
1
+ {
2
+ "appPath" : "examples/component/toast/app.mjs",
3
+ "basePath" : "../../../",
4
+ "environment" : "development",
5
+ "mainPath" : "./Main.mjs",
6
+ "mainThreadAddons": ["HighlightJS", "Stylesheet"]
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "4.6.9",
3
+ "version": "4.6.11",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -43,6 +43,7 @@
43
43
 
44
44
  .neo-checkbox-label {
45
45
  display: block;
46
+ margin : v(checkboxfield-label-top-margin);
46
47
  }
47
48
  }
48
49
  }
@@ -43,6 +43,7 @@
43
43
 
44
44
  .neo-radio-label {
45
45
  display: block;
46
+ margin : v(radiofield-label-top-margin);
46
47
  }
47
48
  }
48
49
  }
@@ -1,11 +1,13 @@
1
1
  $neoMap: map-merge($neoMap, (
2
- 'checkboxfield-color' : #eee,
3
- 'checkboxfield-checked-color': #64B5F6
2
+ 'checkboxfield-color' : #eee,
3
+ 'checkboxfield-checked-color' : #64B5F6,
4
+ 'checkboxfield-label-top-margin': 0 0 3px
4
5
  ));
5
6
 
6
7
  @if $useCssVars == true {
7
8
  :root .neo-theme-dark { // .neo-checkboxfield
8
- --checkboxfield-color : #{neo(checkboxfield-color)};
9
- --checkboxfield-checked-color: #{neo(checkboxfield-checked-color)};
9
+ --checkboxfield-color : #{neo(checkboxfield-color)};
10
+ --checkboxfield-checked-color : #{neo(checkboxfield-checked-color)};
11
+ --checkboxfield-label-top-margin: #{neo(checkboxfield-label-top-margin)};
10
12
  }
11
- }
13
+ }
@@ -1,11 +1,13 @@
1
1
  $neoMap: map-merge($neoMap, (
2
- 'radiofield-color' : #eee,
3
- 'radiofield-checked-color': #64B5F6
2
+ 'radiofield-color' : #eee,
3
+ 'radiofield-checked-color' : #64B5F6,
4
+ 'radiofield-label-top-margin': 0 0 3px
4
5
  ));
5
6
 
6
7
  @if $useCssVars == true {
7
8
  :root .neo-theme-dark { // .neo-radiofield
8
- --radiofield-color : #{neo(radiofield-color)};
9
- --radiofield-checked-color: #{neo(radiofield-checked-color)};
9
+ --radiofield-color : #{neo(radiofield-color)};
10
+ --radiofield-checked-color : #{neo(radiofield-checked-color)};
11
+ --radiofield-label-top-margin: #{neo(radiofield-label-top-margin)};
10
12
  }
11
- }
13
+ }
@@ -1,11 +1,13 @@
1
1
  $neoMap: map-merge($neoMap, (
2
- 'checkboxfield-color' : #aaa,
3
- 'checkboxfield-checked-color': #1c60a0
2
+ 'checkboxfield-color' : #aaa,
3
+ 'checkboxfield-checked-color' : #1c60a0,
4
+ 'checkboxfield-label-top-margin': 0 0 3px
4
5
  ));
5
6
 
6
7
  @if $useCssVars == true {
7
8
  :root .neo-theme-light { // .neo-checkboxfield
8
- --checkboxfield-color : #{neo(checkboxfield-color)};
9
- --checkboxfield-checked-color: #{neo(checkboxfield-checked-color)};
9
+ --checkboxfield-color : #{neo(checkboxfield-color)};
10
+ --checkboxfield-checked-color : #{neo(checkboxfield-checked-color)};
11
+ --checkboxfield-label-top-margin: #{neo(checkboxfield-label-top-margin)};
10
12
  }
11
- }
13
+ }
@@ -1,11 +1,13 @@
1
1
  $neoMap: map-merge($neoMap, (
2
- 'radiofield-color' : #aaa,
3
- 'radiofield-checked-color': #1c60a0
2
+ 'radiofield-color' : #aaa,
3
+ 'radiofield-checked-color' : #1c60a0,
4
+ 'radiofield-label-top-margin': 0 0 3px
4
5
  ));
5
6
 
6
7
  @if $useCssVars == true {
7
8
  :root .neo-theme-light { // .neo-radiofield
8
- --radiofield-color : #{neo(radiofield-color)};
9
- --radiofield-checked-color: #{neo(radiofield-checked-color)};
9
+ --radiofield-color : #{neo(radiofield-color)};
10
+ --radiofield-checked-color : #{neo(radiofield-checked-color)};
11
+ --radiofield-label-top-margin: #{neo(radiofield-label-top-margin)};
10
12
  }
11
- }
13
+ }
@@ -859,7 +859,7 @@ class Base extends CoreBase {
859
859
  * @protected
860
860
  */
861
861
  beforeSetCls(value, oldValue) {
862
- return NeoArray.union(value || [], this.baseCls);;
862
+ return NeoArray.union(value || [], this.baseCls);
863
863
  }
864
864
 
865
865
  /**
@@ -48,6 +48,14 @@ class CheckBox extends Base {
48
48
  * @member {String} inputType_='checkbox'
49
49
  */
50
50
  inputType_: 'checkbox',
51
+ /**
52
+ * @member {String[]} labelBaseCls=['neo-checkbox-label']
53
+ */
54
+ labelBaseCls: ['neo-checkbox-label'],
55
+ /**
56
+ * @member {String[]} labelCls_=[]
57
+ */
58
+ labelCls_: [],
51
59
  /**
52
60
  * Valid values: 'left', 'top'
53
61
  * @member {String} labelPosition_='left'
@@ -75,7 +83,7 @@ class CheckBox extends Base {
75
83
  */
76
84
  _vdom:
77
85
  {cn: [
78
- {tag: 'label', cls: ['neo-checkbox-label']},
86
+ {tag: 'label', cls: []},
79
87
  {tag: 'input', cls: ['neo-checkbox-input']},
80
88
  {tag: 'label', cls: ['neo-checkbox-value-label']}
81
89
  ]}
@@ -173,6 +181,22 @@ class CheckBox extends Base {
173
181
  this.update();
174
182
  }
175
183
 
184
+ /**
185
+ * Triggered after the labelCls config got changed
186
+ * @param {String[]} value
187
+ * @param {String[]} oldValue
188
+ * @protected
189
+ */
190
+ afterSetLabelCls(value, oldValue) {
191
+ let me = this,
192
+ cls = me.vdom.cn[0].cls;
193
+
194
+ NeoArray.remove(cls, oldValue);
195
+ NeoArray.add(cls, value);
196
+
197
+ me.update();
198
+ }
199
+
176
200
  /**
177
201
  * Triggered after the labelPosition config got changed
178
202
  * @param {String} value
@@ -259,6 +283,16 @@ class CheckBox extends Base {
259
283
  me.update();
260
284
  }
261
285
 
286
+ /**
287
+ * Triggered before the labelCls config gets changed.
288
+ * @param {String[]} value
289
+ * @param {String[]} oldValue
290
+ * @protected
291
+ */
292
+ beforeSetLabelCls(value, oldValue) {
293
+ return NeoArray.union(value || [], this.labelBaseCls);
294
+ }
295
+
262
296
  /**
263
297
  * Triggered before the labelPosition config gets changed
264
298
  * @param {String} value
@@ -25,12 +25,16 @@ class Radio extends CheckBox {
25
25
  * @member {String} inputType='radio'
26
26
  */
27
27
  inputType: 'radio',
28
+ /**
29
+ * @member {String[]} labelBaseCls=['neo-radio-label']
30
+ */
31
+ labelBaseCls: ['neo-radio-label'],
28
32
  /**
29
33
  * @member {Object} _vdom
30
34
  */
31
35
  _vdom:
32
36
  {cn: [
33
- {tag: 'label', cls: ['neo-radio-label']},
37
+ {tag: 'label', cls: []},
34
38
  {tag: 'input', cls: ['neo-radio-input']},
35
39
  {tag: 'label', cls: ['neo-radio-value-label']}
36
40
  ]}
@@ -94,9 +94,13 @@ class Text extends Base {
94
94
  */
95
95
  inputType_: 'text',
96
96
  /**
97
- * @member {String[]} labelCls_=['neo-textfield-label']
97
+ * @member {String[]} labelBaseCls=['neo-textfield-label']
98
98
  */
99
- labelCls_: ['neo-textfield-label'],
99
+ labelBaseCls: ['neo-textfield-label'],
100
+ /**
101
+ * @member {String[]} labelCls_=[]
102
+ */
103
+ labelCls_: [],
100
104
  /**
101
105
  * Valid values: 'bottom', 'inline', 'left', 'right', 'top'
102
106
  * @member {String} labelPosition_='left'
@@ -648,6 +652,16 @@ class Text extends Base {
648
652
  return this.beforeSetEnumValue(value, oldValue, 'autoCapitalize', 'autoCapitalizeValues');
649
653
  }
650
654
 
655
+ /**
656
+ * Triggered before the labelCls config gets changed.
657
+ * @param {String[]} value
658
+ * @param {String[]} oldValue
659
+ * @protected
660
+ */
661
+ beforeSetLabelCls(value, oldValue) {
662
+ return NeoArray.union(value || [], this.labelBaseCls);
663
+ }
664
+
651
665
  /**
652
666
  * Triggered before the labelPosition config gets changed
653
667
  * @param {String} value
@@ -251,14 +251,12 @@ class DomEvents extends Base {
251
251
  * @returns {Object}
252
252
  */
253
253
  getEventData(event) {
254
- let path = event.path || event.composedPath(); // FF does not support path
255
-
256
254
  return {
257
- path : path.map(e => this.getTargetData(e)),
255
+ path : event.composedPath().map(e => this.getTargetData(e)),
258
256
  target : this.getTargetData(event.target),
259
257
  timeStamp: event.timeStamp,
260
258
  type : event.type
261
- };
259
+ }
262
260
  }
263
261
 
264
262
  /**
@@ -277,7 +275,7 @@ class DomEvents extends Base {
277
275
  keyCode,
278
276
  metaKey,
279
277
  shiftKey
280
- };
278
+ }
281
279
  }
282
280
 
283
281
  /**
@@ -301,7 +299,7 @@ class DomEvents extends Base {
301
299
  screenX,
302
300
  screenY,
303
301
  shiftKey
304
- };
302
+ }
305
303
  }
306
304
 
307
305
  /**
@@ -341,7 +339,7 @@ class DomEvents extends Base {
341
339
  width : r.width,
342
340
  x : r.x,
343
341
  y : r.y
344
- });
342
+ })
345
343
  }
346
344
 
347
345
  return {
@@ -372,7 +370,7 @@ class DomEvents extends Base {
372
370
  style : node.style?.cssText,
373
371
  tabIndex : node.tabIndex,
374
372
  tagName : node.tagName?.toLowerCase()
375
- };
373
+ }
376
374
  }
377
375
 
378
376
  /**
@@ -686,7 +684,7 @@ class DomEvents extends Base {
686
684
  action : 'domEvent',
687
685
  eventName: data.type,
688
686
  data
689
- });
687
+ })
690
688
  }
691
689
 
692
690
  /**
@@ -1,7 +0,0 @@
1
- {
2
- "appPath": "examples/toast/app.mjs",
3
- "basePath": "../../",
4
- "environment": "development",
5
- "mainPath": "./Main.mjs",
6
- "mainThreadAddons": ["HighlightJS", "Stylesheet"]
7
- }