efront 4.11.0 → 4.11.2
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.
- package/coms/basic/getName.js +4 -4
- package/coms/compile/Html.js +2 -1
- package/coms/compile/Html_test.js +6 -3
- package/coms/compile/Program.js +19 -5
- package/coms/compile//347/264/240/351/246/250.js +39 -29
- package/coms/compile//347/264/240/351/246/250_test.js +8 -3
- package/coms/docs/codecolor.js +9 -8
- package/coms/docs/codetext.xht +92 -10
- package/coms/frame/chat.js +1 -1
- package/coms/kugou/api.js +1 -1
- package/coms/kugou/player.js +3 -0
- package/coms/zimoli/addClass.js +19 -16
- package/coms/zimoli/css.js +12 -1
- package/coms/zimoli/getGenerator.js +27 -13
- package/coms/zimoli/menuList.js +29 -23
- package/coms/zimoli/on.js +8 -0
- package/coms/zimoli/removeClass.js +4 -6
- package/coms/zimoli/render.js +123 -64
- package/coms/zimoli/table.js +2 -0
- package/coms/zimoli/vbox.js +2 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/basic/getName.js
CHANGED
|
@@ -9,11 +9,11 @@ function getName(o) {
|
|
|
9
9
|
if (!isEmpty(name)) return String(name);
|
|
10
10
|
}
|
|
11
11
|
for (var k of keys) {
|
|
12
|
-
|
|
13
|
-
if (!isEmpty(o
|
|
14
|
-
if (isString(
|
|
12
|
+
var v = o[k];
|
|
13
|
+
if (!isEmpty(v) && hasOwnProperty.call(o, k)) return String(v);
|
|
14
|
+
if (isString(v)) name = v;
|
|
15
15
|
}
|
|
16
|
-
if (hasOwnProperty.call(o, 'valueOf')) name = o.valueOf();
|
|
16
|
+
if (!name && hasOwnProperty.call(o, 'valueOf')) name = o.valueOf();
|
|
17
17
|
if (isString(name)) return name;
|
|
18
18
|
return String(o);
|
|
19
19
|
}
|
package/coms/compile/Html.js
CHANGED
|
@@ -88,7 +88,7 @@ var replaceISO8859 = function (data) {
|
|
|
88
88
|
return String(data).replace(/<\!--([\s\S]*)--\>$/g, '$1').replace(/&\w+;/g, a => iso8859[a] || a).replace(/&#(\d+);/g, (_, a) => String.fromCodePoint(a))
|
|
89
89
|
};
|
|
90
90
|
var parseExpress = function (data, mayberepeat) {
|
|
91
|
-
data = replaceISO8859(data);
|
|
91
|
+
data = "=" + replaceISO8859(data);
|
|
92
92
|
if (mayberepeat && /\s+(in|of)\s+/.test(data)) {
|
|
93
93
|
data = data.split(/\s+(in|of)\s+/).pop();
|
|
94
94
|
}
|
|
@@ -132,6 +132,7 @@ Html.prototype.createScoped = function (code) {
|
|
|
132
132
|
else if (c.tagName === 'STYLE') {
|
|
133
133
|
styleNodes.push(c);
|
|
134
134
|
tempNodes.push(c);
|
|
135
|
+
c.isStyle = true;
|
|
135
136
|
}
|
|
136
137
|
}
|
|
137
138
|
|
|
@@ -7,6 +7,7 @@ var test = function (source, pick, value) {
|
|
|
7
7
|
if (arguments.length === 2) source = pick;
|
|
8
8
|
assert(h.createString(b), source);
|
|
9
9
|
if (arguments.length === 3) {
|
|
10
|
+
b.scoped = h.createScoped(b);
|
|
10
11
|
assert(seek(b, pick), value);
|
|
11
12
|
}
|
|
12
13
|
};
|
|
@@ -31,7 +32,9 @@ test('<div>$\\{${`<div></div>`}</div>');
|
|
|
31
32
|
test('<div>$\\{${typeof `<div></div>`}</div>');
|
|
32
33
|
test('<div>$\\{${\\a+typeof`<div></div>`}</div>', '<div>$\\{${\\a + typeof `<div></div>`}</div>');
|
|
33
34
|
test('${i18n`加载中..`}<div class="loader"></div>');
|
|
34
|
-
test('${a +typeof i18n`加载中..`}<div class="loader"></div>','${a + typeof i18n`加载中..`}<div class="loader"></div>');
|
|
35
|
+
test('${a +typeof i18n`加载中..`}<div class="loader"></div>', '${a + typeof i18n`加载中..`}<div class="loader"></div>');
|
|
35
36
|
test('${a > 1}');
|
|
36
|
-
test('a>1','a > 1');
|
|
37
|
-
test('a><a></a>','a > <a></a>');
|
|
37
|
+
test('a>1', 'a > 1');
|
|
38
|
+
test('a><a></a>', 'a > <a></a>');
|
|
39
|
+
test('X', 'X');
|
|
40
|
+
test('<input -class="{actived:actived===f}"/>', 'scoped.envs.actived', true);
|
package/coms/compile/Program.js
CHANGED
|
@@ -13,6 +13,7 @@ const {
|
|
|
13
13
|
/*2048 */ELEMENT,
|
|
14
14
|
createString,
|
|
15
15
|
number_reg,
|
|
16
|
+
digit_reg,
|
|
16
17
|
} = require("./common");
|
|
17
18
|
var combine = require("../basic/combine");
|
|
18
19
|
var sortRegster = require("../basic/sortRegister");
|
|
@@ -105,6 +106,7 @@ class Program {
|
|
|
105
106
|
stamps = "/=+;|:?<>-!~%^&*,".split("")
|
|
106
107
|
value_reg = /^(false|true|null)$/
|
|
107
108
|
number_reg = number_reg;
|
|
109
|
+
digit_reg = digit_reg;
|
|
108
110
|
Code = Array;
|
|
109
111
|
powermap = powermap;
|
|
110
112
|
transive_reg = /^(new|var|let|const|yield|void|in|of|typeof|delete|case|return|await|default|instanceof|throw|extends|import|from)$/;
|
|
@@ -183,11 +185,19 @@ class Program {
|
|
|
183
185
|
var funcstrap_reg = this.funcstrap_reg;
|
|
184
186
|
var entry_reg = this.entry_reg;
|
|
185
187
|
var type_reg = this.type_reg;
|
|
188
|
+
var digit_reg = this.digit_reg;
|
|
186
189
|
var comment_entry = this.comment_entry;
|
|
187
190
|
var rowsOf = m => m.replace(/[^\r\n\u2028\u2029]+/g, ';').replace(/\r\n|\r|\n|\u2028|\u2029/g, ' ').replace(/;/g, '').length;
|
|
188
191
|
var setRows = m => {
|
|
189
192
|
row += rowsOf(m);
|
|
190
|
-
|
|
193
|
+
var reg = /[\r\n\u2028\u2029]/g;
|
|
194
|
+
reg.lastIndex = 0;
|
|
195
|
+
var index = 0;
|
|
196
|
+
do {
|
|
197
|
+
index = reg.lastIndex;
|
|
198
|
+
var match = reg.exec(m);
|
|
199
|
+
} while (match);
|
|
200
|
+
colstart = start + index;
|
|
191
201
|
};
|
|
192
202
|
var queue_push = (scope) => {
|
|
193
203
|
if (scope.type & (SPACE | COMMENT | PIECE | QUOTED)) {
|
|
@@ -479,7 +489,7 @@ class Program {
|
|
|
479
489
|
save(space_reg.test(m) ? SPACE : PIECE);
|
|
480
490
|
}
|
|
481
491
|
}
|
|
482
|
-
m = match[0];
|
|
492
|
+
m = match?.[0];
|
|
483
493
|
}
|
|
484
494
|
loop: while (index < text.length) {
|
|
485
495
|
|
|
@@ -492,6 +502,7 @@ class Program {
|
|
|
492
502
|
var match = reg.exec(text);
|
|
493
503
|
if (!match) {
|
|
494
504
|
index = text.length;
|
|
505
|
+
if (queue === origin) push_piece(index);
|
|
495
506
|
break loop;
|
|
496
507
|
}
|
|
497
508
|
var m = match[0];
|
|
@@ -763,7 +774,7 @@ class Program {
|
|
|
763
774
|
}
|
|
764
775
|
continue;
|
|
765
776
|
}
|
|
766
|
-
var isdigit =
|
|
777
|
+
var isdigit = digit_reg.exec(m);
|
|
767
778
|
if (isdigit) {
|
|
768
779
|
var m1 = isdigit[0];
|
|
769
780
|
if (m1.length < m.length) {
|
|
@@ -900,7 +911,7 @@ class Program {
|
|
|
900
911
|
if (p.tag) p.type = ELEMENT;
|
|
901
912
|
queue_push(p);
|
|
902
913
|
}
|
|
903
|
-
}
|
|
914
|
+
}
|
|
904
915
|
if (cache_stamp) push_stamp();
|
|
905
916
|
this.lastIndex = index;
|
|
906
917
|
if (queue !== origin) {
|
|
@@ -1003,7 +1014,10 @@ class Program {
|
|
|
1003
1014
|
var powers_entries = this.createRegExp(this.tags.map(t => t[0]).concat(powers), true).source;
|
|
1004
1015
|
var entries_reg = new RegExp(`^(${powers_entries}|${quotes_entries}|${scopes})$`, this.nocase ? 'iu' : '');
|
|
1005
1016
|
stamps = this.compile(this.stamps.filter(s => !entries_reg.test(s)).join(''));
|
|
1006
|
-
|
|
1017
|
+
var number_reg = this.number_reg;
|
|
1018
|
+
var numbers = number_reg.source.replace(/^\^|\$$/g, "");
|
|
1019
|
+
this.digit_reg = new RegExp(/^[+\-]?/.source + numbers, number_reg.flags);
|
|
1020
|
+
this.entry_reg = new RegExp([`[${spaces}]+|${quotes_entries}|[${scopes}]|${numbers}[^${tokens}]*|${express}|${powers_entries}|[${stamps}]`], "gi" + flagUnicode);
|
|
1007
1021
|
}
|
|
1008
1022
|
}
|
|
1009
1023
|
module.exports = Program;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var { STAMP, PROPERTY, SCOPED, VALUE, EXPRESS, QUOTED, SPACE, COMMENT, createString: _createString, splice } = require("./common");
|
|
1
|
+
var { STAMP, PROPERTY, SCOPED, VALUE, STRAP, EXPRESS, QUOTED, SPACE, COMMENT, createString: _createString, splice } = require("./common");
|
|
2
2
|
var createString = function (a) {
|
|
3
3
|
a.autospace = false;
|
|
4
4
|
return _createString(a);
|
|
@@ -198,29 +198,35 @@ macros.escape = function (a) {
|
|
|
198
198
|
macros.e = function (a) {
|
|
199
199
|
return strings.decode(a);
|
|
200
200
|
};
|
|
201
|
-
var wrapColor = function (
|
|
202
|
-
|
|
201
|
+
var wrapColor = function (k) {
|
|
202
|
+
var f = color[k];
|
|
203
|
+
macros[k] = function (c) {
|
|
203
204
|
if (color.isColor(c)) return f(...arguments);
|
|
204
|
-
return
|
|
205
|
-
}
|
|
206
|
-
}
|
|
205
|
+
return `${k}(${Array.apply(null, arguments).join(',')})`;
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
[
|
|
210
|
+
"saturate",
|
|
211
|
+
"desaturate",
|
|
212
|
+
"lighten",
|
|
213
|
+
"darken",
|
|
214
|
+
"fadein",
|
|
215
|
+
"fadeout",
|
|
216
|
+
"fade",
|
|
217
|
+
"spin",
|
|
218
|
+
"mix",
|
|
219
|
+
"tint",
|
|
220
|
+
"shade",
|
|
221
|
+
"grayscale",
|
|
222
|
+
"grayluma",
|
|
223
|
+
"fade"
|
|
224
|
+
].forEach(wrapColor);
|
|
225
|
+
|
|
207
226
|
macros[""] = function (a) {
|
|
208
227
|
return a;
|
|
209
228
|
};
|
|
210
|
-
|
|
211
|
-
macros.desaturate = wrapColor(color.desaturate);
|
|
212
|
-
macros.lighten = wrapColor(color.lighten);
|
|
213
|
-
macros.darken = wrapColor(color.darken);
|
|
214
|
-
macros.fadein = wrapColor(color.fadein);
|
|
215
|
-
macros.fadeout = wrapColor(color.fadeout);
|
|
216
|
-
macros.fade = wrapColor(color.fade);
|
|
217
|
-
macros.spin = wrapColor(color.spin);
|
|
218
|
-
macros.mix = wrapColor(color.mix);
|
|
219
|
-
macros.tint = wrapColor(color.tint);
|
|
220
|
-
macros.shade = wrapColor(color.shade);
|
|
221
|
-
macros.grayscale = wrapColor(color.grayscale);
|
|
222
|
-
macros.grayluma = wrapColor(color.grayluma);
|
|
223
|
-
macros.fade = wrapColor(color.fade);
|
|
229
|
+
|
|
224
230
|
macros.each = function (list, body) {
|
|
225
231
|
var match = /^(?:\s*[#\.]?\(([\s\S]*?)\))?\s*\{([\s\S]*)\}$/.exec(body);
|
|
226
232
|
if (!match) throw new Error(i18n`each参数异常!`);
|
|
@@ -274,25 +280,28 @@ macros.each = function (list, body) {
|
|
|
274
280
|
};
|
|
275
281
|
|
|
276
282
|
|
|
283
|
+
var presets = /^@(media|keyframes|layer|import|namespace|page|property|suppports|font-face|document|counter-style|charset|color-profile|container|font-feature-values|font-palette-values|scope|starting-style)(\s|\(|$)/i;
|
|
277
284
|
class 素心 extends Program {
|
|
278
|
-
straps = ["and"];
|
|
285
|
+
straps = ["and", ...presets.source.replace(/^[\s\S]*?\(([\s\S]*?)\)[\s\S]*$/, '$1').split('|').map(a => "@" + a)];
|
|
279
286
|
stamps = `;:,>+~&!/`.split("");
|
|
280
287
|
quotes = rarg.quotes;
|
|
281
288
|
keepspace = true;
|
|
289
|
+
control_reg = presets;
|
|
282
290
|
scopes = [["{", "}"], ["(", ")"]]
|
|
283
291
|
}
|
|
284
292
|
|
|
285
|
-
var presets = /^@(media|keyframes|layer|import|namespace|page|property|suppports|font-face|document|counter-style|charset|color-profile|container|font-feature-values|font-palette-values)(\s|\(|$)/i;
|
|
286
293
|
|
|
287
294
|
素心.prototype.setType = function (o) {
|
|
288
295
|
var p = o.prev;
|
|
289
296
|
if (o.type !== SCOPED) {
|
|
290
297
|
if (!p || p.type === STAMP && p.text === ";" || p.type === SCOPED && p.entry === '{') {
|
|
291
|
-
o.type = PROPERTY;
|
|
298
|
+
if (o.type === EXPRESS) o.type = PROPERTY;
|
|
299
|
+
o.isprop = true;
|
|
292
300
|
return;
|
|
293
301
|
}
|
|
294
|
-
if (p.
|
|
295
|
-
o.type = PROPERTY;
|
|
302
|
+
if (p.isprop && o.type & ~(STAMP | SCOPED)) {
|
|
303
|
+
if (o.type === EXPRESS) o.type = PROPERTY;
|
|
304
|
+
o.isprop = true;
|
|
296
305
|
return;
|
|
297
306
|
}
|
|
298
307
|
}
|
|
@@ -303,7 +312,7 @@ var presets = /^@(media|keyframes|layer|import|namespace|page|property|suppports
|
|
|
303
312
|
}
|
|
304
313
|
while (p && (p.type !== SCOPED || p.entry !== "{") && (p.type !== STAMP || p.text !== ';')) {
|
|
305
314
|
p.isprop = true;
|
|
306
|
-
if (p.type
|
|
315
|
+
if (p.type === EXPRESS) p.type = PROPERTY;
|
|
307
316
|
p = p.prev;
|
|
308
317
|
}
|
|
309
318
|
}
|
|
@@ -334,13 +343,13 @@ var presets = /^@(media|keyframes|layer|import|namespace|page|property|suppports
|
|
|
334
343
|
for (var cx = 0, dx = code.length; cx < dx; cx++) {
|
|
335
344
|
var o = code[cx];
|
|
336
345
|
if (o && (o.type & (SPACE | COMMENT) || o.type === STAMP && o.text === ';')) continue;
|
|
337
|
-
if (o.
|
|
346
|
+
if (!o.isprop) {
|
|
338
347
|
console.log(createString([o]), o.type, createString(code))
|
|
339
348
|
throw new Error(i18n`结构异常`);
|
|
340
349
|
}
|
|
341
350
|
var p = [], v = [];
|
|
342
351
|
while (o && (o.type !== SCOPED || o.entry !== "{")) {
|
|
343
|
-
if (o.type === STAMP) break;
|
|
352
|
+
if (o.type === STAMP && !o.isprop) break;
|
|
344
353
|
p.push(o);
|
|
345
354
|
o = code[++cx];
|
|
346
355
|
}
|
|
@@ -609,4 +618,5 @@ function 素馨(text, scopeName, compress) {
|
|
|
609
618
|
}
|
|
610
619
|
return a;
|
|
611
620
|
}).filter(a => !!a).join(compress ? "" : "\r\n") + getquried();
|
|
612
|
-
}
|
|
621
|
+
}
|
|
622
|
+
素馨.素心 = 素心;
|
|
@@ -70,7 +70,12 @@ assert(素馨(`a>:root{&:not(a):not(b){c:d}}`, '.abc-'), `a>.abc-:not(a):not(b){
|
|
|
70
70
|
assert(素馨(`.a (){ &:after{abc:1}} .b{.a();}`, '.abc-'), `.abc- .b:after{abc:1;}`);
|
|
71
71
|
assert(素馨(`@a:1px;@margin-x:@a+10px; a{m:-@margin-x}`), `a{m:-11px;}`);
|
|
72
72
|
assert(素馨(`a{@a:1px;@margin-x:@a+10px;m:-@margin-x}`), `a{m:-11px;}`);
|
|
73
|
-
assert(素馨(`@media screen{&.a{b:1}}`,'a'), `@media screen{a.a{b:1;}}`);
|
|
74
|
-
assert(素馨(`@media screen and(max-width:100px){&.a{b:1}}`,'a'), `@media screen and (max-width:100px){a.a{b:1;}}`);
|
|
73
|
+
assert(素馨(`@media screen{&.a{b:1}}`, 'a'), `@media screen{a.a{b:1;}}`);
|
|
74
|
+
assert(素馨(`@media screen and(max-width:100px){&.a{b:1}}`, 'a'), `@media screen and (max-width:100px){a.a{b:1;}}`);
|
|
75
75
|
assert(素馨(`b{:not([resizing], [dragging]) {transition: padding .2s, margin .2s;}}`), `b :not([resizing], [dragging]){transition:padding .2s, margin .2s;}`);
|
|
76
|
-
assert(素馨(`@a(@b){a@b{@w:@b/2;c:@w;}} @a(1); @a(2); @a(3)`)
|
|
76
|
+
assert(素馨(`@a(@b){a@b{@w:@b/2;c:@w;}} @a(1); @a(2); @a(3)`), `a1{c:0.5;}\r\na2{c:1;}\r\na3{c:1.5;}`);
|
|
77
|
+
assert(素馨(`a{filter:grayscale(.9)}`), `a{filter:grayscale(.9);}`);
|
|
78
|
+
assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[0].text, '-0.2em');
|
|
79
|
+
assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[0].isdigit, true);
|
|
80
|
+
assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[2].text, ".3em");
|
|
81
|
+
assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[2].isdigit, true);
|
package/coms/docs/codecolor.js
CHANGED
|
@@ -13,6 +13,7 @@ var codecolor = function (c, encode) {
|
|
|
13
13
|
var scoped = c.scoped;
|
|
14
14
|
var setdefs = function (scoped) {
|
|
15
15
|
var { used } = scoped;
|
|
16
|
+
if (!isObject(used) || isArray(used)) return;
|
|
16
17
|
for (var k in used) {
|
|
17
18
|
var isdef = false;
|
|
18
19
|
for (var o of used[k]) {
|
|
@@ -29,12 +30,12 @@ var codecolor = function (c, encode) {
|
|
|
29
30
|
}
|
|
30
31
|
scoped.forEach(setdefs);
|
|
31
32
|
};
|
|
32
|
-
setdefs(scoped);
|
|
33
|
+
if (scoped) setdefs(scoped);
|
|
33
34
|
var isConstValue = () => false;
|
|
34
35
|
if (c.program) {
|
|
35
36
|
var { strap_reg, value_reg } = c.program;
|
|
36
37
|
isConstValue = a => strap_reg.test(a) || value_reg.test(a);
|
|
37
|
-
}
|
|
38
|
+
}
|
|
38
39
|
var isInvoke = function (o) {
|
|
39
40
|
var o = o.next;
|
|
40
41
|
if (o?.type === EXPRESS && needhead_reg.test(o.text)) o = o.next;
|
|
@@ -42,9 +43,9 @@ var codecolor = function (c, encode) {
|
|
|
42
43
|
if (o?.type === STAMP && o.needle) o = o.next;
|
|
43
44
|
if (o?.type === SCOPED && o.entry === "(") return true;
|
|
44
45
|
return false;
|
|
45
|
-
}
|
|
46
|
+
};
|
|
46
47
|
var setExpress = function (o, label) {
|
|
47
|
-
if (!o.text) return;
|
|
48
|
+
if (!o.text || /^</.test(o.text)) return;
|
|
48
49
|
var keys = o.text.split(".");
|
|
49
50
|
if (isInvoke(o)) {
|
|
50
51
|
if (!/^[\<\?]/.test(keys[keys.length - 1])) keys[keys.length - 1] = `<invoke>${keys[keys.length - 1]}</invoke>`;
|
|
@@ -55,21 +56,21 @@ var codecolor = function (c, encode) {
|
|
|
55
56
|
else name = `<${label}>${name}</${label}>`;
|
|
56
57
|
keys[0] = name;
|
|
57
58
|
o.text = keys.map(k => /^[\<\?]/.test(k) || !k ? k : `<express>${k}</express>`).join(".");
|
|
58
|
-
}
|
|
59
|
+
};
|
|
59
60
|
var setPredef = o => setExpress(o, 'predef');
|
|
60
61
|
var setOutside = o => setExpress(o, 'outside');
|
|
61
62
|
if (used) for (var k in envs) {
|
|
62
63
|
used[k].forEach(k in predefs ? setPredef : setOutside);
|
|
63
64
|
}
|
|
64
65
|
if (c.program) var { space_exp: spaceReg, control_reg } = c.program;
|
|
65
|
-
var unspaceReg = new RegExp(spaceReg.source.replace(/^\[/, "[^"), spaceReg.flags + 'g');
|
|
66
|
+
if (spaceReg) var unspaceReg = new RegExp(spaceReg.source.replace(/^\[/, "[^"), spaceReg.flags + 'g');
|
|
66
67
|
var wraptext = function (t, l) {
|
|
67
68
|
if (unspaceReg) t = t.replace(unspaceReg, a => {
|
|
68
69
|
a = encode(a);
|
|
69
70
|
return `<${l}>${a}</${l}>`
|
|
70
71
|
});
|
|
71
72
|
return t;
|
|
72
|
-
}
|
|
73
|
+
};
|
|
73
74
|
c.colored = true;
|
|
74
75
|
var setcolor = function (o) {
|
|
75
76
|
if (o.colored) return;
|
|
@@ -151,5 +152,5 @@ var codecolor = function (c, encode) {
|
|
|
151
152
|
}
|
|
152
153
|
};
|
|
153
154
|
c.forEach(setcolor);
|
|
154
|
-
|
|
155
|
+
return c;
|
|
155
156
|
}
|
package/coms/docs/codetext.xht
CHANGED
|
@@ -43,6 +43,10 @@
|
|
|
43
43
|
color: #569cd6;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
selector {
|
|
47
|
+
color: #d7ba7d;
|
|
48
|
+
}
|
|
49
|
+
|
|
46
50
|
@deep(@num, @color) {
|
|
47
51
|
deep@num {
|
|
48
52
|
color: @color;
|
|
@@ -141,6 +145,74 @@
|
|
|
141
145
|
}
|
|
142
146
|
}
|
|
143
147
|
}
|
|
148
|
+
var 素心 = new compile$素馨.素心;
|
|
149
|
+
素心.scopes.push(['[', ']']);
|
|
150
|
+
素心.straps.push('important',
|
|
151
|
+
'after', 'backdrop', 'before',
|
|
152
|
+
'cue', 'cue-range',
|
|
153
|
+
'file-selector-button', 'first-letter', 'last-letter', 'first-line',
|
|
154
|
+
'grammer-error', 'highlight', 'marker', 'part',
|
|
155
|
+
'placeholder', 'selection', 'slotted', 'spelling-error', 'target-text',
|
|
156
|
+
'view-transition', 'view-transition-group', 'view-transition-image-pair', 'view-transition-new', 'view-transition-old',
|
|
157
|
+
'active', 'any-link', 'autofill',
|
|
158
|
+
'blank',
|
|
159
|
+
'checked', 'current',
|
|
160
|
+
'dir', 'default', 'defined', 'disabled',
|
|
161
|
+
'empty', 'enabled',
|
|
162
|
+
'first', 'first-child', 'first-of-type', 'future', 'focus', 'focus-visible', 'focus-within', 'fullscreen',
|
|
163
|
+
'has', 'host', 'host-context', 'hover',
|
|
164
|
+
'indeterminate', 'in-range', 'invalid', 'is',
|
|
165
|
+
'lang', 'last-child', 'last-of-type', 'left', 'link', 'local-link',
|
|
166
|
+
'modal',
|
|
167
|
+
'not', 'nth-child', 'nth-col', 'nth-last-child', 'nth-last-col', 'nth-last-of-type', 'nth-of-type',
|
|
168
|
+
"only-child", 'only-of-type', 'optional', 'out-of-range',
|
|
169
|
+
'past', 'picture-in-picture', 'placeholder-shown', 'paused', 'playing',
|
|
170
|
+
'read-only', 'read-write', 'required', 'right', 'root',
|
|
171
|
+
'scope', 'state',
|
|
172
|
+
'target', 'target-within',
|
|
173
|
+
'user-invalid',
|
|
174
|
+
'valid', 'visited',
|
|
175
|
+
'where'
|
|
176
|
+
);
|
|
177
|
+
素心.stamps.push("=");
|
|
178
|
+
var setless = function (c) {
|
|
179
|
+
var set = function (o) {
|
|
180
|
+
if (o.type === PROPERTY) {
|
|
181
|
+
var q = o.queue;
|
|
182
|
+
if (q.type === SCOPED && q.entry !== "{") return;
|
|
183
|
+
var next = o.next;
|
|
184
|
+
if (next && (next.type !== STAMP || !/^[\:\=]$/.test(next.text))) {
|
|
185
|
+
o.text = `<selector>${o.text}</selector>`;
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
if (next && (next.type === STAMP && next.text === ':')) {
|
|
189
|
+
while (next && next.type !== SCOPED) {
|
|
190
|
+
if (next.type === STAMP && next.text === ';') return;
|
|
191
|
+
next = next.next;
|
|
192
|
+
}
|
|
193
|
+
if (next) o.text = `<selector>${o.text}</selector>`;
|
|
194
|
+
}
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
if (o.type === EXPRESS) {
|
|
198
|
+
var next = o.next;
|
|
199
|
+
if (next?.type === SCOPED) return;
|
|
200
|
+
if (!o.length) o.type = QUOTED;
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (o.type === STRAP) {
|
|
204
|
+
if (!o.isprop) return o.type = EXPRESS;
|
|
205
|
+
var p = o.prev;
|
|
206
|
+
if (!/^@/.test(o.text) && (!p || p.type !== STAMP || !/\:$/.test(p.text))) o.type = PROPERTY;
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
if (o.type === SCOPED && o.length) {
|
|
211
|
+
o.forEach(set);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
c.forEach(set);
|
|
215
|
+
};
|
|
144
216
|
var codesupports = {
|
|
145
217
|
javascript(a, blink) {
|
|
146
218
|
if (blink) var index = a.indexOf(blink);
|
|
@@ -165,6 +237,12 @@
|
|
|
165
237
|
codecolor(c, encode);
|
|
166
238
|
return c.toString();
|
|
167
239
|
},
|
|
240
|
+
less(a) {
|
|
241
|
+
var c = compile$scanner2(a, 素心);
|
|
242
|
+
setless(c);
|
|
243
|
+
codecolor(c, encode);
|
|
244
|
+
return c.toString();
|
|
245
|
+
},
|
|
168
246
|
rs(a) {
|
|
169
247
|
var c = compile$scanner2(a, rust);
|
|
170
248
|
codecolor(c, encode);
|
|
@@ -179,24 +257,26 @@
|
|
|
179
257
|
var code = compile$scanner2(a, 'html');
|
|
180
258
|
var scoped = code.scoped;
|
|
181
259
|
backEach(scoped.richNodes, n => {
|
|
182
|
-
if (n.isScript) {
|
|
183
|
-
var
|
|
260
|
+
if (n.isScript || n.isStyle) {
|
|
261
|
+
var s = n.isScript ? js : 素心;
|
|
262
|
+
var c = [];
|
|
184
263
|
compile$common.createString(n).replace(/^(\s*\<\!--)([\s\S]*)(--\!?\>\s*)$|^[\s\S]*$/, (m, p, a, f) => {
|
|
185
264
|
if (!a) {
|
|
186
|
-
|
|
265
|
+
c = compile$scanner2(m, s);
|
|
187
266
|
}
|
|
188
267
|
else {
|
|
189
|
-
|
|
190
|
-
|
|
268
|
+
c = compile$scanner2(a, s);
|
|
269
|
+
c.unshift(
|
|
191
270
|
{ type: compile$common.COMMENT, text: p },
|
|
192
271
|
);
|
|
193
|
-
|
|
272
|
+
c.push(
|
|
194
273
|
{ type: compile$common.COMMENT, text: f }
|
|
195
274
|
);
|
|
196
275
|
}
|
|
197
|
-
|
|
276
|
+
if (n.isStyle) setless(c);
|
|
277
|
+
codecolor(c, encode);
|
|
198
278
|
});
|
|
199
|
-
n.splice(0, n.length, ...
|
|
279
|
+
n.splice(0, n.length, ...c);
|
|
200
280
|
}
|
|
201
281
|
})
|
|
202
282
|
codecolor(code, encode);
|
|
@@ -210,10 +290,12 @@
|
|
|
210
290
|
};
|
|
211
291
|
codesupports.gl = codesupports.glsl;
|
|
212
292
|
codesupports.cmd = codesupports.bat;
|
|
293
|
+
codesupports.css = codesupports.less;
|
|
213
294
|
codesupports.cjs = codesupports.mjs = codesupports.jsx = codesupports.js = codesupports.javascript;
|
|
214
295
|
codesupports.tsx = codesupports.ts = codesupports.typescript;
|
|
215
|
-
codesupports.jsp = codesupports.asp = codesupports.php = codesupports.xml = codesupports.html;
|
|
216
|
-
|
|
296
|
+
codesupports.xht = codesupports.jsp = codesupports.asp = codesupports.php = codesupports.xml = codesupports.html;
|
|
297
|
+
codesupports.vue = codesupports.xht;
|
|
298
|
+
var { SCOPED, QUOTED, SPACE, STAMP, STRAP, EXPRESS, PROPERTY } = compile$common;
|
|
217
299
|
var patchBlink = function (code, index, blink) {
|
|
218
300
|
for (var cx = 0, dx = code.length; cx < dx; cx++) {
|
|
219
301
|
var c = code[cx];
|
package/coms/frame/chat.js
CHANGED
package/coms/kugou/api.js
CHANGED
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"download-krc;accesskey&id": "get:content download?ver=1&client=pc&fmt=krc&charset=utf8"
|
|
47
47
|
},
|
|
48
48
|
"https://music.91q.com/": {// 千千静听/百度音乐
|
|
49
|
-
"search-qqjt
|
|
49
|
+
"search-qqjt?word": "get:data.typeTrack v1/search#songname=title&singername=artist<、>.name&avatar=pic&priced=isVip",
|
|
50
50
|
"qqjt-url?TSID": "get:data v1/song/tracklink#url=path"
|
|
51
51
|
}
|
|
52
52
|
})
|
package/coms/kugou/player.js
CHANGED
|
@@ -67,15 +67,18 @@ on("keydown")(window, function (event) {
|
|
|
67
67
|
if (!$scope.audio && !kugou$musicList.getActived()) return;
|
|
68
68
|
switch (event.keyCode || event.which) {
|
|
69
69
|
case 32:
|
|
70
|
+
case 179:
|
|
70
71
|
if (event.repeat) break;
|
|
71
72
|
if ($scope.playing) $scope.pause();
|
|
72
73
|
else $scope.play();
|
|
73
74
|
break;
|
|
74
75
|
case 37:
|
|
76
|
+
case 177:
|
|
75
77
|
// left
|
|
76
78
|
$scope.play($scope.index - 1);
|
|
77
79
|
break;
|
|
78
80
|
case 39:
|
|
81
|
+
case 176:
|
|
79
82
|
$scope.play($scope.index + 1);
|
|
80
83
|
// right
|
|
81
84
|
break;
|
package/coms/zimoli/addClass.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
+
var classToMap = function (className) {
|
|
2
|
+
if (isString(className)) className = className.trim().split(/\s+/);
|
|
3
|
+
if (isArray(className)) {
|
|
4
|
+
var classMap = Object.create(null);
|
|
5
|
+
for (var c of className) {
|
|
6
|
+
if (isString(c)) classMap[c] = true;
|
|
7
|
+
else Object.assign(classMap, classToMap(c));
|
|
8
|
+
}
|
|
9
|
+
return classMap;
|
|
10
|
+
}
|
|
11
|
+
else if (isObject(className)) return className;
|
|
12
|
+
return Object.create(null);
|
|
13
|
+
};
|
|
1
14
|
function addClass(target, classNames) {
|
|
2
15
|
var _className = target.className;
|
|
3
16
|
var arr = String(_className || "").trim().split(/\s+/);
|
|
4
|
-
var cls =
|
|
17
|
+
var cls = Object.create(null);
|
|
5
18
|
for (var cx = 0, dx = arr.length; cx < dx; cx++) {
|
|
6
19
|
var c = arr[cx];
|
|
7
20
|
if (c) cls[c] = true;
|
|
8
21
|
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
for (var cx = 0, dx = clsNames.length; cx < dx; cx++) {
|
|
12
|
-
var c = clsNames[cx];
|
|
13
|
-
if (c) cls[c] = true;
|
|
14
|
-
}
|
|
15
|
-
} else {
|
|
16
|
-
merge(cls, classNames);
|
|
17
|
-
}
|
|
22
|
+
classNames = classToMap(classNames);
|
|
23
|
+
Object.assign(cls, classNames);
|
|
18
24
|
var newarr = [];
|
|
19
|
-
for (var k in cls)
|
|
20
|
-
if (k && cls[k]) {
|
|
21
|
-
newarr.push(k);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
25
|
+
for (var k in cls) if (k && cls[k]) newarr.push(k);
|
|
24
26
|
target.className = newarr.join(" ");
|
|
25
|
-
}
|
|
27
|
+
}
|
|
28
|
+
addClass.classToMap = classToMap;
|
package/coms/zimoli/css.js
CHANGED
|
@@ -109,6 +109,16 @@ var cssTargetNode = function (targetNode, oStyle, oValue) {
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
};
|
|
112
|
+
var styleToMap = function (style) {
|
|
113
|
+
if (isString(style)) return parseKV(style, ';', ':');
|
|
114
|
+
if (isObject(style)) return style;
|
|
115
|
+
if (isArray(style)) {
|
|
116
|
+
var styleMap = Object.create(null);
|
|
117
|
+
for (var s of style) extend(styleMap, styleToMap(s));
|
|
118
|
+
return styleMap;
|
|
119
|
+
}
|
|
120
|
+
return Object.create(null);
|
|
121
|
+
}
|
|
112
122
|
/**
|
|
113
123
|
* 将样式绑定到选择器
|
|
114
124
|
* @param {string} targetSelector
|
|
@@ -185,4 +195,5 @@ var css = function (target, oStyle, oValue) {
|
|
|
185
195
|
};
|
|
186
196
|
css.transformCssKey = transformCssKey;
|
|
187
197
|
css.transformNodeKey = transformNodeKey;
|
|
188
|
-
css.transformValue = transformValue;
|
|
198
|
+
css.transformValue = transformValue;
|
|
199
|
+
css.styleToMap = styleToMap;
|