efront 4.1.1 → 4.1.3
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.
|
@@ -108,13 +108,13 @@ var splitParams = function (params) {
|
|
|
108
108
|
for (var cx = 0, dx = code.length; cx < dx; cx++) {
|
|
109
109
|
var o = code[cx];
|
|
110
110
|
if (o.type === STAMP && o.text === ',') {
|
|
111
|
-
params.push(createString(p));
|
|
111
|
+
params.push(createString(p).trim());
|
|
112
112
|
p = [];
|
|
113
113
|
continue;
|
|
114
114
|
}
|
|
115
115
|
p.push(o);
|
|
116
116
|
}
|
|
117
|
-
if (p.length) params.push(createString(p));
|
|
117
|
+
if (p.length) params.push(createString(p).trim());
|
|
118
118
|
return params;
|
|
119
119
|
}
|
|
120
120
|
var createArgMap = function (args, split = ',', equal = ':') {
|
|
@@ -431,11 +431,15 @@ function evalscoped(scoped, base = '') {
|
|
|
431
431
|
var vlist = [vars];
|
|
432
432
|
var mlist = [macros];
|
|
433
433
|
var clist = [smaps];
|
|
434
|
+
var calcvars = function (v) {
|
|
435
|
+
return v.replace(/(^|\s|[\]\)\(\[\-\+\*\/,;])(?:var\s*\(([\s\S]*?)\)|(--\S+|@[^\s\{\}\(\)\[\]\:\+\*\/,;\!\>\$\=\&\%\#\@'"`\?\.\/\|~#]+|@\{[^\}@]*\}))/g, function (m, q, a, b) {
|
|
436
|
+
return q + getFromScopeList(b || a.trim(), vlist, m.slice(q.length));
|
|
437
|
+
});
|
|
438
|
+
};
|
|
434
439
|
var initvars = function (vars) {
|
|
435
440
|
for (var k in vars) {
|
|
436
441
|
var v = vars[k];
|
|
437
|
-
|
|
438
|
-
vars[k] = v;
|
|
442
|
+
vars[k] = replace_punc(calcvars(v));
|
|
439
443
|
}
|
|
440
444
|
};
|
|
441
445
|
initvars(vars);
|
|
@@ -453,11 +457,6 @@ function evalscoped(scoped, base = '') {
|
|
|
453
457
|
base = temp;
|
|
454
458
|
return res;
|
|
455
459
|
};
|
|
456
|
-
var calcvars = function (v) {
|
|
457
|
-
return v.replace(/(^|\s|[\]\)\(\[\-\+\*\/,;])(?:var\s*\(([\s\S]*?)\)|(--\S+|@[^\s\{\(\:\+\*\/,;\!\[\>\$\=\&\%\#\@\+'"`\?\.\/\|~]+|@\{[^\}@]*\}))/g, function (m, q, a, b) {
|
|
458
|
-
return q + getFromScopeList(b || a.trim(), vlist, m.slice(q.length));
|
|
459
|
-
});
|
|
460
|
-
};
|
|
461
460
|
var evalproc = function (k, retnoparam) {
|
|
462
461
|
var match = (retnoparam !== false ? /^([^\(\)\s,;:]*)(?:\s*\(([\s\S]*)\))$/ : /^([^\(\)\s,;:]+)(?:\s*\(([\s\S]*)\))?$/).exec(k);
|
|
463
462
|
if (!match) return calcvars(k);
|
|
@@ -536,6 +535,7 @@ function evalscoped(scoped, base = '') {
|
|
|
536
535
|
if (base && !p.rooted) p.base = fixBase(base, k);
|
|
537
536
|
else p.base = presets.test(k) ? `@{${k}}` : k;
|
|
538
537
|
if (p.vars) vlist.push(p.vars);
|
|
538
|
+
initvars(p.vars);
|
|
539
539
|
var value = evalthis(p);
|
|
540
540
|
if (p.vars) vlist.pop();
|
|
541
541
|
if (value.rest.length) rest = rest.concat(value.rest);
|
|
@@ -57,6 +57,8 @@ test(`:not(a):not(b){c:d}`, `:not(a):not(b){c:d;}`);
|
|
|
57
57
|
test(`a>{b{a:b}}`, `a>b{a:b;}`);
|
|
58
58
|
test(`a >{b{a:b}}`, `a>b{a:b;}`);
|
|
59
59
|
test(`a{>b{a:b}}`, `a>b{a:b;}`);
|
|
60
|
+
test(`.type(@type,@media) {.@{type} {&:before{content:"@{media}";}}}.type(videoinput, "相机");`, `.videoinput:before{content:"相机";}`);
|
|
61
|
+
test(`.type(@type,@media) {.@{type} {&:before{content:"@{media}";}}}.type(videoinput, 相机);`, `.videoinput:before{content:"相机";}`);
|
|
60
62
|
assert(素馨(`:not(a):not(b){c:d}`, 'abc'), `abc :not(a):not(b){c:d;}`);
|
|
61
63
|
assert(素馨(`&:not(a):not(b){c:d}`, 'abc'), `abc:not(a):not(b){c:d;}`);
|
|
62
64
|
assert(素馨(`:scope{&:not(a):not(b){c:d}}`, 'abc'), `abc:not(a):not(b){c:d;}`);
|
|
@@ -65,4 +67,6 @@ assert(素馨(`&{&:not(a):not(b){c:d}}`, 'abc'), `abc:not(a):not(b){c:d;}`);
|
|
|
65
67
|
assert(素馨(`:root>a{&:not(a):not(b){c:d}}`, '.abc-'), `.abc->a:not(a):not(b){c:d;}`);
|
|
66
68
|
assert(素馨(`a>:root{&:not(a):not(b){c:d}}`, '.abc-'), `a>.abc-:not(a):not(b){c:d;}`);
|
|
67
69
|
|
|
68
|
-
assert(素馨(`.a (){ &:after{abc:1}} .b{.a();}`, '.abc-'), `.abc- .b:after{abc:1;}`);
|
|
70
|
+
assert(素馨(`.a (){ &:after{abc:1}} .b{.a();}`, '.abc-'), `.abc- .b:after{abc:1;}`);
|
|
71
|
+
assert(素馨(`@a:1px;@margin-x:@a+10px; a{m:-@margin-x}`), `a{m:-11px;}`);
|
|
72
|
+
assert(素馨(`a{@a:1px;@margin-x:@a+10px;m:-@margin-x}`), `a{m:-11px;}`);
|