neo.mjs 5.10.13 → 5.11.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.
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.10.13'
23
+ * @member {String} version='5.11.0'
24
24
  */
25
- version: '5.10.13'
25
+ version: '5.11.0'
26
26
  }
27
27
 
28
28
  /**
@@ -20,9 +20,9 @@ class ServiceWorker extends ServiceBase {
20
20
  */
21
21
  singleton: true,
22
22
  /**
23
- * @member {String} version='5.10.13'
23
+ * @member {String} version='5.11.0'
24
24
  */
25
- version: '5.10.13'
25
+ version: '5.11.0'
26
26
  }
27
27
 
28
28
  /**
@@ -1,5 +1,6 @@
1
1
  import CheckBox from '../../../src/form/field/CheckBox.mjs';
2
2
  import ConfigurationViewport from '../../ConfigurationViewport.mjs';
3
+ import DateField from '../../../src/form/field/Date.mjs';
3
4
  import DateSelector from '../../../src/component/DateSelector.mjs';
4
5
  import Radio from '../../../src/form/field/Radio.mjs';
5
6
  import NumberField from '../../../src/form/field/Number.mjs';
@@ -107,14 +108,26 @@ class MainContainer extends ConfigurationViewport {
107
108
  name : 'dayNameFormat',
108
109
  valueLabelText: 'long'
109
110
  }, {
110
- module : NumberField,
111
+ module : DateField,
112
+ labelText : 'maxValue',
113
+ listeners : {change: me.onConfigChange.bind(me, 'maxValue')},
114
+ matchPickerWidth: false,
115
+ style : {marginTop: '10px'},
116
+ value : me.exampleComponent.maxValue
117
+ }, {
118
+ module : DateField,
119
+ labelText : 'minValue',
120
+ listeners : {change: me.onConfigChange.bind(me, 'minValue')},
121
+ matchPickerWidth: false,
122
+ value : me.exampleComponent.minValue
123
+ }, {
124
+ module : NumberField,
111
125
  clearable : true,
112
126
  labelText : 'height',
113
127
  listeners : {change: me.onConfigChange.bind(me, 'height')},
114
128
  maxValue : 800,
115
129
  minValue : 230,
116
130
  stepSize : 10,
117
- style : {marginTop: '10px'},
118
131
  value : me.exampleComponent.height
119
132
  }, {
120
133
  module : CheckBox,
@@ -176,7 +189,7 @@ class MainContainer extends ConfigurationViewport {
176
189
  return Neo.create(DateSelector, {
177
190
  height: 300,
178
191
  width : 300
179
- });
192
+ })
180
193
  }
181
194
 
182
195
  onMonthRadioChange(value, opts) {
@@ -0,0 +1,71 @@
1
+ import ConfigurationViewport from '../../ConfigurationViewport.mjs';
2
+ import Timer from '../../../src/component/Timer.mjs';
3
+ import Container from '../../../src/container/Base.mjs';
4
+ import TextField from "../../../src/form/field/Text.mjs";
5
+ import ColorField from "../../../src/form/field/Color.mjs"
6
+
7
+ /**
8
+ * @class Neo.examples.component.timer.MainContainer
9
+ * @extends Neo.examples.ConfigurationViewport
10
+ */
11
+ class MainContainer extends ConfigurationViewport {
12
+ static config = {
13
+ className : 'Neo.examples.component.timer.MainContainer',
14
+ }
15
+
16
+ createConfigurationComponents() {
17
+ let me = this;
18
+
19
+ return [{
20
+ module : TextField,
21
+ labelText: 'dimensions',
22
+ value : '8rem',
23
+ listeners: {change: me.onConfigChange.bind(me, 'dimensions')}
24
+ }, {
25
+ module : ColorField,
26
+ clearable : false,
27
+ labelText: 'colorStart',
28
+ value: '#8a9b0f',
29
+ listeners: {change: me.onConfigChange.bind(me, 'colorStart')}
30
+ }, {
31
+ module : ColorField,
32
+ clearable : false,
33
+ labelText: 'colorEnd',
34
+ value: '#940a3d',
35
+ listeners: {change: me.onConfigChange.bind(me, 'colorEnd')}
36
+ }];
37
+ }
38
+
39
+ createExampleComponent() {
40
+ return Neo.create({
41
+ module: Container,
42
+ style: {
43
+ overflow: 'auto',
44
+ maxHeight: '100%'
45
+ },
46
+ items : [{
47
+ html: '<h1>Configurable</h1>',
48
+ style: {textAlign: 'center'}
49
+ }, {
50
+ module : Timer,
51
+ duration : '20s',
52
+ flag : 'timer-component',
53
+ dimensions: '8rem',
54
+ }]
55
+ });
56
+ }
57
+
58
+ /**
59
+ * @param {String} config
60
+ * @param {Object} opts
61
+ */
62
+ onConfigChange(config, opts) {
63
+ const timer = this.down({flag: 'timer-component'});
64
+
65
+ timer[config] = opts.value;
66
+ }
67
+ }
68
+
69
+ Neo.applyClassConfig(MainContainer);
70
+
71
+ export default MainContainer;
@@ -0,0 +1,95 @@
1
+ import ComponentController from '../../../src/controller/Component.mjs';
2
+ import Toast from '../../../src/component/Toast.mjs';
3
+
4
+ /**
5
+ * @class Neo.examples.component.toast.MainContainerController
6
+ * @extends Neo.controller.Component
7
+ */
8
+ class MainContainerController extends ComponentController {
9
+ static config = {
10
+ /**
11
+ * @member {String} className='Neo.examples.component.toast.MainContainerController'
12
+ * @protected
13
+ */
14
+ className: 'Neo.examples.component.toast.MainContainerController'
15
+ }
16
+
17
+ /**
18
+ * @param {Object} config
19
+ */
20
+ construct(config) {
21
+ super.construct(config);
22
+ Neo.main.addon.HighlightJS.switchTheme('dark');
23
+ }
24
+
25
+ /**
26
+ * Whenever any field changes we update the output
27
+ * @param {Object} data
28
+ * @returns {Promise<void>}
29
+ */
30
+ async onChange(data) {
31
+ let me = this,
32
+ form = me.getReference('form'),
33
+ output = me.getReference('output'),
34
+ button = me.getReference('creation-button'),
35
+ oVdom = output.vdom.cn[0].cn[0],
36
+ isValid = await form.isValid(),
37
+ values;
38
+
39
+ if (Neo.isBoolean(data.value)) {
40
+ me.getReference('closable').value = data.value;
41
+ }
42
+
43
+ values = await form.getValues();
44
+
45
+ values.appName = me.component.appName;
46
+ button.disabled = !isValid;
47
+
48
+ if (isValid) {
49
+ oVdom.cn = output.itemTpl(values);
50
+
51
+ output.update();
52
+
53
+ await Neo.timeout(20)
54
+ me.syntaxHighlight();
55
+ }
56
+ }
57
+
58
+ /**
59
+ * Cleanup the values and show the toast
60
+ */
61
+ async createToast() {
62
+ let me = this,
63
+ form = me.getReference('form'),
64
+ values = await form.getValues(),
65
+ clear = ['position', 'slideDirection', 'ui', 'minHeight', 'maxWidth', 'closable', 'timeout'];
66
+
67
+ // use the defaults from toast if not set
68
+ clear.forEach(item => {
69
+ if (values[item] === null) {
70
+ delete values[item];
71
+ }
72
+ })
73
+
74
+ values.appName = me.component.appName;
75
+ Neo.toast(values);
76
+ }
77
+
78
+ /**
79
+ * 3rd party tool to highlight the code
80
+ */
81
+ syntaxHighlight() {
82
+ let me = this,
83
+ output = me.getReference('output'),
84
+ oVdom = output.vdom;
85
+
86
+ Neo.main.addon.HighlightJS.syntaxHighlight({
87
+ appName: me.component.appName,
88
+ vnodeId: oVdom.cn[0].id
89
+ });
90
+ }
91
+ }
92
+
93
+ Neo.applyClassConfig(MainContainerController);
94
+
95
+ export default MainContainerController;
@@ -0,0 +1,7 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ export const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.component.timer'
6
+ });
7
+
@@ -0,0 +1,12 @@
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 Timer</title>
7
+ </head>
8
+ </head>
9
+ <body>
10
+ <script src="../../../src/MicroLoader.mjs" type="module"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,7 @@
1
+ {
2
+ "appPath" : "examples/component/timer/app.mjs",
3
+ "basePath" : "../../../",
4
+ "environment" : "development",
5
+ "mainPath" : "./Main.mjs",
6
+ "mainThreadAddons": ["Stylesheet", "ScrollSync"]
7
+ }
@@ -0,0 +1,131 @@
1
+ import ConfigurationViewport from '../../ConfigurationViewport.mjs';
2
+ import Form from '../../../src/form/Container.mjs';
3
+ import Fieldset from '../../../src/form/Fieldset.mjs';
4
+ import TextField from '../../../src/form/field/Text.mjs';
5
+ import FormLayout from '../../../src/layout/Form.mjs';
6
+
7
+ /**
8
+ * @class Neo.examples.layout.form.MainContainer
9
+ * @extends Neo.examples.ConfigurationViewport
10
+ */
11
+ class MainContainer extends ConfigurationViewport {
12
+ static config = {
13
+ className : 'Neo.examples.layout.form.MainContainer',
14
+ autoMount : true,
15
+ configItemLabelWidth: 160,
16
+ layout : {ntype: 'hbox', align: 'stretch'}
17
+ }
18
+
19
+ createConfigurationComponents() {
20
+ let me = this;
21
+
22
+ return [{
23
+ ntype: 'component',
24
+ html : 'On the left you see' +
25
+ '<ul>Form > layout-form' +
26
+ '<li>textfield' +
27
+ '<li>textfield' +
28
+ '<li>Fieldset inside the form with another > layout-form' +
29
+ '<ul>' +
30
+ '<li>textfield' +
31
+ '<li>textfield' +
32
+ '</ul></ul>'
33
+ }, {
34
+ module : TextField,
35
+ clearable: true,
36
+ labelText: 'gap (row column)',
37
+ listeners: {
38
+ change: {
39
+ fn : function (data) {
40
+ const comp = this.exampleComponent;
41
+
42
+ comp.layout.gap = data.value;
43
+ comp.down('fieldset').layout.gap = data.value;
44
+ },
45
+ scope: this
46
+ }
47
+ },
48
+ value : '0 .5rem'
49
+ }, {
50
+ module : TextField,
51
+ clearable: true,
52
+ labelText: 'Textfield 01 Label',
53
+ listeners: {change: me.updateLabelFromTextField.bind(me, 1)},
54
+ value : 'This is a wide label inside Form'
55
+ }, {
56
+ module : TextField,
57
+ clearable: true,
58
+ labelText: 'Textfield 02 Label',
59
+ listeners: {change: me.updateLabelFromTextField.bind(me, 2)},
60
+ value : 'Small label'
61
+ }, {
62
+ module : TextField,
63
+ clearable: true,
64
+ labelText: 'Textfield 03 Label',
65
+ listeners: {change: me.updateLabelFromTextField.bind(me, 3)},
66
+ value : 'I am inside a fieldset'
67
+ }, {
68
+ module : TextField,
69
+ clearable: true,
70
+ labelText: 'Textfield 04 Label',
71
+ listeners: {change: me.updateLabelFromTextField.bind(me, 4)},
72
+ value : 'Fieldset with layout-form'
73
+ }]
74
+ }
75
+
76
+ createExampleComponent() {
77
+ return Neo.create(Form, {
78
+ layout : {
79
+ ntype: 'layout-form',
80
+ gap : '0 .5rem'
81
+ },
82
+ itemDefaults: {
83
+ ntype : 'textfield',
84
+ clearable: true,
85
+ value : 'Layout Demo'
86
+ },
87
+ items : [{
88
+ labelText: 'This is a wide Label inside Form',
89
+ name : 1
90
+ }, {
91
+ labelText: 'Small Label',
92
+ name : 2
93
+ }, {
94
+ module : Fieldset,
95
+ title : 'Fieldset with Layout',
96
+ layout : {
97
+ ntype: 'layout-form',
98
+ gap : '0 .5rem'
99
+ },
100
+ itemDefaults: {
101
+ ntype : 'textfield',
102
+ clearable: true,
103
+ value : 'Layout Demo'
104
+ },
105
+ items : [{
106
+ labelText: 'I am inside a fieldset',
107
+ name : 3
108
+ }, {
109
+ labelText: 'Fieldset with layout-form',
110
+ name : 4
111
+ }]
112
+ }]
113
+ })
114
+ }
115
+
116
+ /**
117
+ * Update the textfield labelText, based on index
118
+ * @param {Number} index
119
+ * @param {Object} data
120
+ */
121
+ updateLabelFromTextField(index, data) {
122
+ const comp = this.exampleComponent,
123
+ textfield = comp.down({ntype: 'textfield', name: index});
124
+
125
+ textfield.labelText = data.value;
126
+ }
127
+ }
128
+
129
+ Neo.applyClassConfig(MainContainer);
130
+
131
+ export default MainContainer;
@@ -0,0 +1,6 @@
1
+ import MainContainer from './MainContainer.mjs';
2
+
3
+ export const onStart = () => Neo.app({
4
+ mainView: MainContainer,
5
+ name : 'Neo.examples.layout.form'
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 Form Layout</title>
7
+ </head>
8
+ <body>
9
+ <script src="../../../src/MicroLoader.mjs" type="module"></script>
10
+ </body>
11
+ </html>
@@ -0,0 +1,6 @@
1
+ {
2
+ "appPath" : "examples/layout/form/app.mjs",
3
+ "basePath" : "../../../",
4
+ "environment": "development",
5
+ "mainPath" : "./Main.mjs"
6
+ }
@@ -2,6 +2,7 @@ import CellColumnModel from '../../../src/selection/table/CellColumnModel.
2
2
  import CellColumnRowModel from '../../../src/selection/table/CellColumnRowModel.mjs';
3
3
  import CellModel from '../../../src/selection/table/CellModel.mjs';
4
4
  import CellRowModel from '../../../src/selection/table/CellRowModel.mjs';
5
+ import Checkbox from '../../../src/form/field/CheckBox.mjs';
5
6
  import ConfigurationViewport from '../../ConfigurationViewport.mjs';
6
7
  import ColumnModel from '../../../src/selection/table/ColumnModel.mjs';
7
8
  import MainStore from './MainStore.mjs';
@@ -75,6 +76,11 @@ class MainContainer extends ConfigurationViewport {
75
76
  checked : me.exampleComponent.selectionModel.ntype === 'selection-table-cellcolumnrowmodel',
76
77
  listeners : {change: me.onRadioChange.bind(me, 'selectionModel', CellColumnRowModel)},
77
78
  valueLabelText: 'Cell & Column & Row'
79
+ }, {
80
+ module : Checkbox,
81
+ labelText: 'sortable',
82
+ listeners: {change: me.onConfigChange.bind(me, 'sortable')},
83
+ value : me.exampleComponent.sortable
78
84
  }];
79
85
  }
80
86
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neo.mjs",
3
- "version": "5.10.13",
3
+ "version": "5.11.0",
4
4
  "description": "The webworkers driven UI framework",
5
5
  "type": "module",
6
6
  "repository": {
@@ -45,7 +45,7 @@
45
45
  "@material/mwc-button": "^0.27.0",
46
46
  "@material/mwc-textfield": "^0.27.0",
47
47
  "autoprefixer": "^10.4.14",
48
- "chalk": "^5.2.0",
48
+ "chalk": "^5.3.0",
49
49
  "clean-webpack-plugin": "^4.0.0",
50
50
  "commander": "^11.0.0",
51
51
  "cssnano": "^6.0.1",
@@ -55,7 +55,7 @@
55
55
  "inquirer": "^9.2.7",
56
56
  "neo-jsdoc": "^1.0.1",
57
57
  "neo-jsdoc-x": "^1.0.5",
58
- "postcss": "^8.4.24",
58
+ "postcss": "^8.4.25",
59
59
  "sass": "^1.63.6",
60
60
  "webpack": "^5.88.1",
61
61
  "webpack-cli": "^5.1.4",
@@ -0,0 +1,115 @@
1
+ //@property --neo-timer-current {
2
+ // syntax: '<number>';
3
+ // initial-value: 1000;
4
+ // inherits: true
5
+ //}
6
+
7
+ .neo-timer {
8
+ --neo-timer-current: '';
9
+ --neo-timer-full: '';
10
+
11
+ margin: 1rem auto;
12
+
13
+ .countdown {
14
+ display: grid;
15
+ width: v(timer-dimension);
16
+ height: v(timer-dimension);
17
+ container-type: size;
18
+ }
19
+
20
+ @keyframes t {
21
+ to {
22
+ --neo-timer-current: 0
23
+ }
24
+ }
25
+
26
+ svg {
27
+ grid-column: 1;
28
+ grid-row: 1
29
+ }
30
+
31
+ [r] {
32
+ fill: none;
33
+ stroke: silver;
34
+
35
+ + [r] {
36
+ --k: calc(var(--neo-timer-current) / var(--neo-timer-full));
37
+ transform: rotate(-90deg);
38
+ stroke-linecap: round;
39
+ stroke: color-mix(in hsl shorter hue, v(timer-color-start) calc(var(--k) * 300%), v(timer-color-end));
40
+ stroke-dasharray: var(--k) 1
41
+ }
42
+ }
43
+ }
44
+
45
+ .flip-card {
46
+ grid-column: 1;
47
+ grid-row: 1;
48
+
49
+ margin: 7cqh;
50
+ border-radius: 100%;
51
+ overflow: hidden;
52
+
53
+ background-color: transparent;
54
+ perspective: 1000px; /* Remove this if you don't want the 3D effect */
55
+
56
+ /* This container is needed to position the front and back side */
57
+ .flip-card-inner {
58
+ position: relative;
59
+ width: 100%;
60
+ height: 100%;
61
+ text-align: center;
62
+ transition: transform 0.8s;
63
+ transform-style: preserve-3d;
64
+
65
+ /* Position the front and back side */
66
+ .flip-card-front, .flip-card-back {
67
+ position: absolute;
68
+ width: 100%;
69
+ height: 100%;
70
+ -webkit-backface-visibility: hidden; /* Safari */
71
+ backface-visibility: hidden;
72
+ }
73
+
74
+ /* Style the front side (fallback if image is missing) */
75
+ .flip-card-front {
76
+ & > input {
77
+ background-color: v(container-background-color);
78
+ color: v(container-color);
79
+ margin-top: 25%;
80
+ height:41%;
81
+ width: 100%;
82
+ font: calc(v(timer-dimension) * 0.25)/2 ubuntu mono, consolas, monaco, monospace;
83
+ text-align: center;
84
+ border-width: 0 !important;
85
+
86
+ &:focus {
87
+ outline: none;
88
+ }
89
+ }
90
+
91
+ & > button {
92
+ border: 0 none;
93
+ background-color: v(timer-button-color);
94
+ height: 35%;
95
+ width: 100%;
96
+ font-size: 15cqh;
97
+ }
98
+ }
99
+
100
+ /* Style the back side */
101
+ .flip-card-back {
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: center;
105
+ font: calc(v(timer-dimension)*.25)/ 2 ubuntu mono, consolas, monaco, monospace;
106
+ // initial transformation
107
+ transform: rotateY(180deg);
108
+ }
109
+ }
110
+
111
+ /* Do an horizontal flip when you move the mouse over the flip box container */
112
+ &.turn .flip-card-inner {
113
+ transform: rotateY(180deg);
114
+ }
115
+ }
@@ -0,0 +1,27 @@
1
+ .neo-layout-form {
2
+ display: grid;
3
+ grid-template-columns: max-content 1fr;
4
+ column-gap: 1rem;
5
+
6
+ & > .neo-layout-form-item {
7
+ grid-column: 1 / 3;
8
+
9
+ display: grid;
10
+ grid-template-columns: subgrid;
11
+
12
+ .neo-textfield-label {
13
+ grid-column: 1 / 2;
14
+ width: auto !important;
15
+ }
16
+
17
+ .neo-input-wrapper {
18
+ grid-column: 2 / 3;
19
+ }
20
+ }
21
+
22
+ // In case we have a fieldset inside the form
23
+ & > .neo-layout-form-subfieldset,
24
+ .legend {
25
+ grid-column: 1 / 3;
26
+ }
27
+ }
@@ -0,0 +1,14 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'timer-color-start': #8a9b0f,
3
+ 'timer-color-end': #940a3d,
4
+ 'timer-dimension': '6rem'
5
+ ));
6
+
7
+ @if $useCssVars == true {
8
+ :root .neo-theme-dark { // .neo-timer
9
+ --timer-color-start : #{neo(timer-color-start)};
10
+ --timer-color-end : #{neo(timer-color-end)};
11
+ --timer-dimension : #{neo(timer-dimension)};
12
+ --timer-button-color : #{neo(container-color)};
13
+ }
14
+ }
@@ -0,0 +1,15 @@
1
+ $neoMap: map-merge($neoMap, (
2
+ 'timer-color-start': #8a9b0f,
3
+ 'timer-color-end': #940a3d,
4
+ 'timer-dimension': '6rem',
5
+ 'timer-button-color': #cde8e7
6
+ ));
7
+
8
+ @if $useCssVars == true {
9
+ :root .neo-theme-light { // .neo-timer
10
+ --timer-color-start : #{neo(timer-color-start)};
11
+ --timer-color-end : #{neo(timer-color-end)};
12
+ --timer-dimension : #{neo(timer-dimension)};
13
+ --timer-button-color : #{neo(timer-button-color)};
14
+ }
15
+ }
@@ -236,12 +236,12 @@ const DefaultConfig = {
236
236
  useVdomWorker: true,
237
237
  /**
238
238
  * buildScripts/injectPackageVersion.mjs will update this value
239
- * @default '5.10.13'
239
+ * @default '5.11.0'
240
240
  * @memberOf! module:Neo
241
241
  * @name config.version
242
242
  * @type String
243
243
  */
244
- version: '5.10.13'
244
+ version: '5.11.0'
245
245
  };
246
246
 
247
247
  Object.assign(DefaultConfig, {