neo.mjs 4.0.41 → 4.0.44
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,7 +20,7 @@ fs.watch(scssPath, {
|
|
|
20
20
|
recursive: true
|
|
21
21
|
}, (eventType, filename) => {
|
|
22
22
|
if (filename.endsWith('.scss')) {
|
|
23
|
-
switch
|
|
23
|
+
switch(eventType) {
|
|
24
24
|
case 'change': {
|
|
25
25
|
buildFile(filename);
|
|
26
26
|
}
|
|
@@ -45,51 +45,55 @@ function buildFile(filename) {
|
|
|
45
45
|
].join('');
|
|
46
46
|
|
|
47
47
|
fs.readFile(filePath).then(content => {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
try {
|
|
49
|
+
let result = sass.renderSync({
|
|
50
|
+
data : data + content.toString(),
|
|
51
|
+
outFile : destPath,
|
|
52
|
+
sourceMap : true,
|
|
53
|
+
sourceMapEmbed: false
|
|
54
|
+
});
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
map = result.map?.toString();
|
|
56
57
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
if (map) {
|
|
59
|
+
// https://github.com/neomjs/neo/issues/1970
|
|
60
|
+
map = JSON.parse(map);
|
|
60
61
|
|
|
61
|
-
|
|
62
|
+
let filenameSlash = filename;
|
|
62
63
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
if (path.sep === '\\') {
|
|
65
|
+
filenameSlash = filenameSlash.replace(/\\/g, '/');
|
|
66
|
+
}
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
for (; i < len; i++) {
|
|
72
|
-
src = '../' + src;
|
|
73
|
-
}
|
|
68
|
+
let len = filenameSlash.split('/').length,
|
|
69
|
+
src = `/scss/${filenameSlash}`,
|
|
70
|
+
i = 0;
|
|
74
71
|
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
for (; i < len; i++) {
|
|
73
|
+
src = '../' + src;
|
|
74
|
+
}
|
|
77
75
|
|
|
78
|
-
|
|
79
|
-
from: filePath,
|
|
80
|
-
to : destPath,
|
|
81
|
-
map : {
|
|
82
|
-
prev: map && JSON.stringify(map)
|
|
76
|
+
map.sources = [src];
|
|
83
77
|
}
|
|
84
|
-
}).then(result => {
|
|
85
|
-
fs.writeFileSync(destPath, result.css, () => true);
|
|
86
78
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
79
|
+
postcss([autoprefixer]).process(result.css, {
|
|
80
|
+
from: filePath,
|
|
81
|
+
to : destPath,
|
|
82
|
+
map : {
|
|
83
|
+
prev: map && JSON.stringify(map)
|
|
84
|
+
}
|
|
85
|
+
}).then(result => {
|
|
86
|
+
fs.writeFileSync(destPath, result.css, () => true);
|
|
87
|
+
|
|
88
|
+
if (result.map) {
|
|
89
|
+
fs.writeFileSync(result.opts.to + '.map', result.map.toString());
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const processTime = (Math.round((new Date - startDate) * 100) / 100000).toFixed(2);
|
|
93
|
+
console.log('Updated file:', (chalk.blue(`${processTime}s`)), destPath);
|
|
94
|
+
});
|
|
95
|
+
} catch(error) {
|
|
96
|
+
console.log('SCSS build failed for', chalk.red(filename));
|
|
97
|
+
}
|
|
94
98
|
});
|
|
95
99
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "neo.mjs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.44",
|
|
4
4
|
"description": "The webworkers driven UI framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"neo-jsdoc": "^1.0.1",
|
|
51
51
|
"neo-jsdoc-x": "^1.0.4",
|
|
52
52
|
"postcss": "^8.4.14",
|
|
53
|
-
"sass": "^1.52.
|
|
53
|
+
"sass": "^1.52.3",
|
|
54
54
|
"webpack": "^5.73.0",
|
|
55
|
-
"webpack-cli": "^4.
|
|
55
|
+
"webpack-cli": "^4.10.0",
|
|
56
56
|
"webpack-dev-server": "4.9.2",
|
|
57
57
|
"webpack-hook-plugin": "^1.0.7",
|
|
58
58
|
"webpack-node-externals": "^3.0.0"
|
package/src/component/Base.mjs
CHANGED
|
@@ -17,6 +17,13 @@ import VNodeUtil from '../util/VNode.mjs';
|
|
|
17
17
|
*/
|
|
18
18
|
class Base extends CoreBase {
|
|
19
19
|
static getStaticConfig() {return {
|
|
20
|
+
/**
|
|
21
|
+
* Valid values for hideMode
|
|
22
|
+
* @member {String[]} hideModes=['removeDom','visibility']
|
|
23
|
+
* @protected
|
|
24
|
+
* @static
|
|
25
|
+
*/
|
|
26
|
+
hideModes: ['removeDom', 'visibility'],
|
|
20
27
|
/**
|
|
21
28
|
* True automatically applies the core/Observable.mjs mixin
|
|
22
29
|
* @member {Boolean} observable=true
|
|
@@ -147,12 +154,18 @@ class Base extends CoreBase {
|
|
|
147
154
|
* @member {Number|String|null} height_=null
|
|
148
155
|
*/
|
|
149
156
|
height_: null,
|
|
157
|
+
/**
|
|
158
|
+
* Initial setting to hide or show the component and
|
|
159
|
+
* you can use either hide()/show() or change this config directly to change the hidden state
|
|
160
|
+
* @member {Boolean} hidden_=false
|
|
161
|
+
*/
|
|
162
|
+
hidden_: false,
|
|
150
163
|
/**
|
|
151
164
|
* Used for hide and show and defines if the component
|
|
152
165
|
* should use css visibility:'hidden' or vdom:removeDom
|
|
153
|
-
* @member {
|
|
166
|
+
* @member {String} hideMode_='visibility'
|
|
154
167
|
*/
|
|
155
|
-
|
|
168
|
+
hideMode_: 'visibility',
|
|
156
169
|
/**
|
|
157
170
|
* The top level innerHTML of the component
|
|
158
171
|
* @member {String|null} html_=null
|
|
@@ -537,6 +550,18 @@ class Base extends CoreBase {
|
|
|
537
550
|
this.changeVdomRootKey('height', value);
|
|
538
551
|
}
|
|
539
552
|
|
|
553
|
+
/**
|
|
554
|
+
* Triggered after the hidden config got changed
|
|
555
|
+
* @param {Boolean} value
|
|
556
|
+
* @param {Boolean} oldValue
|
|
557
|
+
* @protected
|
|
558
|
+
*/
|
|
559
|
+
afterSetHidden(value, oldValue) {
|
|
560
|
+
if (!(!value && oldValue === undefined)) {
|
|
561
|
+
this[value ? 'hide' : 'show']();
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
540
565
|
/**
|
|
541
566
|
* Triggered after the html config got changed
|
|
542
567
|
* @param {String|null} value
|
|
@@ -742,6 +767,16 @@ class Base extends CoreBase {
|
|
|
742
767
|
return value || [];
|
|
743
768
|
}
|
|
744
769
|
|
|
770
|
+
/**
|
|
771
|
+
* Triggered before the hideMode config gets changed
|
|
772
|
+
* @param {String} value
|
|
773
|
+
* @param {String} oldValue
|
|
774
|
+
* @protected
|
|
775
|
+
*/
|
|
776
|
+
beforeSetHideMode(value, oldValue) {
|
|
777
|
+
return this.beforeSetEnumValue(value, oldValue, 'hideMode');
|
|
778
|
+
}
|
|
779
|
+
|
|
745
780
|
/**
|
|
746
781
|
* Triggered before the keys config gets changed.
|
|
747
782
|
* Creates a KeyNavigation instance if needed.
|
|
@@ -1080,14 +1115,14 @@ class Base extends CoreBase {
|
|
|
1080
1115
|
|
|
1081
1116
|
/**
|
|
1082
1117
|
* Hide the component.
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1085
|
-
* If
|
|
1118
|
+
* hideMode: 'removeDom' uses vdom removeDom.
|
|
1119
|
+
* hideMode: 'visibility' uses css visibility.
|
|
1120
|
+
* If hideMode === 'removeDom' you can pass a timeout for custom css class hiding.
|
|
1086
1121
|
* @param {Number} timeout
|
|
1087
1122
|
*/
|
|
1088
1123
|
hide(timeout) {
|
|
1089
1124
|
let me = this,
|
|
1090
|
-
doRemove = me.
|
|
1125
|
+
doRemove = me.hideMode !== 'visibility';
|
|
1091
1126
|
|
|
1092
1127
|
if (doRemove) {
|
|
1093
1128
|
let removeFn = function() {
|
|
@@ -1106,6 +1141,8 @@ class Base extends CoreBase {
|
|
|
1106
1141
|
style.visibility = 'hidden';
|
|
1107
1142
|
me.style = style;
|
|
1108
1143
|
}
|
|
1144
|
+
|
|
1145
|
+
this._hidden = true;
|
|
1109
1146
|
}
|
|
1110
1147
|
|
|
1111
1148
|
/**
|
|
@@ -1464,12 +1501,12 @@ class Base extends CoreBase {
|
|
|
1464
1501
|
|
|
1465
1502
|
/**
|
|
1466
1503
|
* Show the component.
|
|
1467
|
-
*
|
|
1468
|
-
*
|
|
1504
|
+
* hideMode: 'removeDom' uses vdom removeDom.
|
|
1505
|
+
* hideMode: 'visibility' uses css visibility.
|
|
1469
1506
|
*/
|
|
1470
1507
|
show() {
|
|
1471
1508
|
let me = this,
|
|
1472
|
-
doAdd = me.
|
|
1509
|
+
doAdd = me.hideMode !== 'visibility';
|
|
1473
1510
|
|
|
1474
1511
|
if (doAdd) {
|
|
1475
1512
|
let vdom = me.vdom;
|
|
@@ -1480,6 +1517,8 @@ class Base extends CoreBase {
|
|
|
1480
1517
|
style.visibility = 'visible';
|
|
1481
1518
|
me.style = style;
|
|
1482
1519
|
}
|
|
1520
|
+
|
|
1521
|
+
this._hidden = false;
|
|
1483
1522
|
}
|
|
1484
1523
|
|
|
1485
1524
|
/**
|
|
@@ -76,7 +76,7 @@ class RecordFactory extends Base {
|
|
|
76
76
|
|
|
77
77
|
if (Array.isArray(model.fields)) {
|
|
78
78
|
model.fields.forEach(field => {
|
|
79
|
-
let parsedValue = instance.parseRecordValue(field, config[field.name]),
|
|
79
|
+
let parsedValue = instance.parseRecordValue(field, config[field.name], config),
|
|
80
80
|
symbol = Symbol.for(field.name);
|
|
81
81
|
|
|
82
82
|
properties = {
|
|
@@ -98,7 +98,7 @@ class RecordFactory extends Base {
|
|
|
98
98
|
oldValue = me[symbol];
|
|
99
99
|
|
|
100
100
|
if (!Neo.isEqual(value, oldValue)) {
|
|
101
|
-
value = instance.parseRecordValue(field, value);
|
|
101
|
+
value = instance.parseRecordValue(field, value, null);
|
|
102
102
|
|
|
103
103
|
me[symbol] = value;
|
|
104
104
|
|
|
@@ -223,10 +223,22 @@ class RecordFactory extends Base {
|
|
|
223
223
|
* todo: parse value for more field types
|
|
224
224
|
* @param {Object} field
|
|
225
225
|
* @param {*} value
|
|
226
|
+
* @param {Object} recordConfig
|
|
226
227
|
* @returns {*}
|
|
227
228
|
*/
|
|
228
|
-
parseRecordValue(field, value) {
|
|
229
|
-
|
|
229
|
+
parseRecordValue(field, value, recordConfig) {
|
|
230
|
+
let mapping = field.mapping,
|
|
231
|
+
type = field.type?.toLowerCase();
|
|
232
|
+
|
|
233
|
+
// only trigger mappings for initial values
|
|
234
|
+
// dynamic changes of a field will not pass the recordConfig
|
|
235
|
+
if (mapping && recordConfig) {
|
|
236
|
+
let ns = mapping.split('.'),
|
|
237
|
+
key = ns.pop();
|
|
238
|
+
|
|
239
|
+
ns = Neo.ns(ns, true, recordConfig);
|
|
240
|
+
value = ns[key];
|
|
241
|
+
}
|
|
230
242
|
|
|
231
243
|
if (type === 'date') {
|
|
232
244
|
return new Date(value);
|