efront 4.20.0 → 4.20.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.
@@ -357,7 +357,7 @@ var detectLabel = function (o) {
357
357
  if (!queue.isargl && last.type & (EXPRESS | STRAP | VALUE | QUOTED)) {
358
358
  // label
359
359
  var lp = last.prev;
360
- if (!lp || lp.type !== STRAP || lp.isend) {
360
+ if (!lp || lp.type !== STRAP || !lp.transive || lp.isend) {
361
361
  last.type = LABEL;
362
362
  last.text += ":";
363
363
  last.end = end;
@@ -1137,7 +1137,7 @@ var getDeclared = function (o, kind, queue) {
1137
1137
  o = f.next;
1138
1138
  break;
1139
1139
  default:
1140
- console.log(createString(pickSentence(queue)), o.text, o.type);
1140
+ console.log(createString(pickSentence(o.queue)), o.text, o.type);
1141
1141
  throw new Error(i18n`代码结构异常`);
1142
1142
  }
1143
1143
  if (!o) break;
@@ -440,9 +440,9 @@ function () {
440
440
  if (!a) return [1, 0]; return [2, 0]
441
441
  },
442
442
  function () {
443
- _1 = getRequestProtocol(url); _0 = _1 + "//", location = _0 + location; return [1, 0]
443
+ _0 = getRequestProtocol(url), _0 = _0 + "//", location = _0 + location; return [1, 0]
444
444
  })
445
- var _0, _1 }`);
445
+ var _0 }`);
446
446
  assert(downLevel("var{a}=await b"), `return async_(
447
447
  function () {
448
448
  _0 = b; return [_0, 1]
@@ -863,6 +863,7 @@ var ternary = function (body, getname, ret) {
863
863
  var punc = eq.text.slice(0, eq.text.length - 1);
864
864
  var bdtmp = [...ass.map(cloneNode), { type: STAMP, text: punc }, ...asn];
865
865
  relink(bdtmp);
866
+ eqused++;
866
867
  var explist2 = _express(bdtmp, getnextname, true);
867
868
  if (isSimpleAssign) {
868
869
  [asn, an = cloneNode(ass)] = popexp(explist2);
@@ -163,6 +163,9 @@ test("var res = null, krc;", `res = null; krc`)
163
163
  test("res = null, krc;", `res = null; krc`)
164
164
  test(`while (a && b);`, '_ = a; if (!_) return [1, 0]; _ = b;\r\n if (!_) return [1, 0]; return [-1, 0]', true);
165
165
  test(`while (a < b);`, '_ = a < b; if (!_) return [1, 0]; return [0, 0]', true);
166
- unstruct.debug = true; r++;
167
166
  test(`if (a() > a+b);`, '_ = a(), _0 = a + b, _ = _ > _0; if (!_) return [1, 0]; return [1, 0]', true);
168
167
  test(`index > start && result.length < pageSize`, '_ = index > start; if (!_) return [1, 0]; _ = result.length, _ < pageSize', true);
168
+ unstruct.debug = true; r++;
169
+ test(`menus[0][str_name] += [str__v_, version[0], str__v_1][str_join]("")`, `_ = menus[0]; _0 = str__v_; _1 = version[0]; _2 = str__v_1; _0 = [_0, _1, _2]; _0 = _0[str_join](""); _1 = _[str_name], _1 = _1 + _0; _[str_name] = _1`);
170
+ test(`a.b.c += menus[0][str_name] += [str__v_, version[0], str__v_1][str_join]("")`, `_ = menus[0]; _0 = str__v_; _1 = version[0]; _2 = str__v_1; _0 = [_0, _1, _2]; _0 = _0[str_join](""); _1 = _[str_name], _1 = _1 + _0; _[str_name] = _1; _2 = a.b.c, _2 = _2 + _1; a.b.c = _2`);
171
+ test(`menus[0].c += menus[0][str_name] += [str__v_, version[0], str__v_1][str_join]("")`, `_ = menus[0]; _0 = menus[0]; _1 = str__v_; _2 = version[0]; _3 = str__v_1; _1 = [_1, _2, _3]; _1 = _1[str_join](""); _2 = _0[str_name], _2 = _2 + _1; _0[str_name] = _2; _3 = _.c, _3 = _3 + _2; _.c = _3`);
@@ -463,8 +463,15 @@ var Method = function () {
463
463
  if (!this.base) this.base = base;
464
464
  vlist.push(valueMap);
465
465
  var argDefaults = this.args.defaults;
466
+ var ipd = 0;
466
467
  this.args.forEach((k, i) => {
467
- var a = arguments[i];
468
+ var p = i + ipd;
469
+ if (/^\.\.\.@/i.test(k)) {
470
+ var a = Array.prototype.slice.call(arguments, p, i + arguments.length - this.args.length + 1);
471
+ ipd += a.length - 1;
472
+ k = k.slice(3);
473
+ }
474
+ else var a = arguments[p];
468
475
  if (a === undefined || a === null) a = seprateFunc(calcvars(argDefaults[k])).map(evalproc).join('');
469
476
  valueMap[k] = a;
470
477
  });
@@ -497,17 +504,18 @@ var killneg = function (v, n) {
497
504
  v = n + v;
498
505
  }
499
506
  }
507
+ else if (n === '...');
500
508
  else if (n) v = n + v;
501
509
  return v;
502
510
  };
503
511
  var calcvars = function (v) {
504
512
  var decode = /^['"`]/.test(v) ? strings.decode : a => a;
505
- return v.replace(/(^\-)?(@[^\s\{\}\(\)\[\]\:\+\*\/,;\!\>\$\=\&\%\#\@'"`\?\.\/\|~#]+|@\{[^\}@]*\})/g, function (_, n, m) {
513
+ return v.replace(/(^\-|\.\.\.)?(@[^\s\{\}\(\)\[\]\:\+\*\/,;\!\>\$\=\&\%\#\@'"`\?\.\/\|~#]+|@\{[^\}@]*\})/g, function (_, n, m) {
506
514
  var value = getFromScopeList(m, vlist, m);
507
515
  value = decode(value);
508
516
  value = killneg(value, n);
509
517
  return value;
510
- }).replace(/(^|\s|[\]\)\(\[\+\*\/,;]|^\-)(?:var\s*\(([\s\S]*?)\)|(--\S+))/g, function (m, q, a, b) {
518
+ }).replace(/(^|\s|[\]\)\(\[\+\*\/,;]|\-|\.\.\.)(?:var\s*\(([\s\S]*?)\)|(--\S+))/g, function (m, q, a, b) {
511
519
  var v = getFromScopeList(b || a.trim(), vlist, m.slice(q.length));
512
520
  v = killneg(v, q);
513
521
  return v;
@@ -564,7 +572,7 @@ var eval2 = function (props) {
564
572
  var [, name, args] = match;
565
573
  args = createArgMap(args);
566
574
  p.args = args;
567
- p.reg = new RegExp(args.join("|") + /|@\{[^\}@]+\}/.source, 'g');
575
+ p.reg = new RegExp(args.map(a => /(?:\.\.\.)?/.source + a.replace(/^\.\.\./, '')).join("|") + /|@\{[^\}@]+\}/.source, 'g');
568
576
  if (!methods[name]) methods[name] = [];
569
577
  var argDefaults = args.defaults;
570
578
  Object.keys(argDefaults).forEach(k => {
@@ -87,7 +87,10 @@ assert(素馨(`a{a:extract(2 3,2)}`), `a{a:3;}`);
87
87
  assert(素馨(`value: range(10px, 30px, 10);`, '', true), `value:10px 20px 30px;`);
88
88
  assert(素馨(`value: range(4);`, '', true), `value:1 2 3 4;`);
89
89
  assert(素馨(`@a:-1;b{a:-@a}`, '', true), `b{a:1;}`);
90
+ assert(素馨(`@b(@c,...@d,@e){each(@d,(@a){a:@a})};@b(1,2,3,4,5,3,4)`, '', true), `a:2;a:3;a:4;a:5;a:3;`);
90
91
  assert(素馨(`--mwidth:0px;--bwidth:2px;--qwidth: var(--mwidth)+var(--bwidth);width:--qwidth`, '', true), `width:2px;`);
92
+ assert(素馨(`a{--a:1px;padding:var(--a) -var(--a);}`, '', true), `a{padding:1px -1px;}`);
93
+ assert(素馨(`a{@a:1px;padding:@a -@a;}`, '', true), `a{padding:1px -1px;}`);
91
94
  assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[0].text, '-0.2em');
92
95
  assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[0].isdigit, true);
93
96
  assert(scanner2(`-0.2em .3em -0.2em 0`, new 素馨.素心)[2].text, ".3em");
@@ -1,8 +1,9 @@
1
- <fileitem type_="d.type" @mouseenter="startMarquee(sp)" @mouseleave="stopMarquee(sp)" @touchstart="startMarquee(sp)"
2
- @touchend="stopMarquee(sp)">
1
+ <fileitem type_="d.type" ext+ @mouseenter="startMarquee(sp)" @mouseleave="stopMarquee(sp)"
2
+ @touchstart="startMarquee(sp)" @touchend="stopMarquee(sp)">
3
3
  <template -src="d.isfolder?icons.folder:icons.file"></template>
4
- <span #sp ng-text=d.name></span>
5
- <p -if="d.pending" keep >
4
+ <span #sp name ng-text=d.name></span>
5
+ <p -if="d.pending" keep>
6
6
  <r -style="{width:(d.percent*100).toFixed(4)+'%'}"></r>
7
7
  </p>
8
+ <span ext? -if="!d.isfolder"></span>
8
9
  </fileitem>
@@ -8,6 +8,7 @@ class Fileitem {
8
8
  var e = Fileitem.prototype;
9
9
  e.startMarquee = function (sp) {
10
10
  if (sp.scrollWidth <= sp.clientWidth) return;
11
+ clearInterval(sp.mq);
11
12
  sp.mq = setInterval(function () {
12
13
  clearInterval(sp.mq);
13
14
  sp.mq = setInterval(function () {
@@ -17,7 +18,7 @@ e.startMarquee = function (sp) {
17
18
  }, 16);
18
19
  }, 400);
19
20
  sp.setAttribute("marquee", '');
20
- sp.scrollLeft = sp.clientWidth;
21
+ sp.scrollLeft = sp.clientWidth - parseFloat(getComputedStyle(sp).paddingLeft);
21
22
  };
22
23
  e.stopMarquee = function (sp) {
23
24
  clearInterval(sp.mq);
@@ -29,6 +30,9 @@ function fileitem(elem) {
29
30
  elem.innerHTML = template;
30
31
  var e = elem.children[0];
31
32
  e.$scope = new Fileitem;
33
+ var ext = /\.([^\.]+)$/.exec(elem.$scope.d.name);
34
+ if (ext) e.$scope.ext = ext[1];
35
+ else e.$scope.ext = '';
32
36
  extend(e.$scope, elem.$scope);
33
37
  return e;
34
38
  }
@@ -1,22 +1,76 @@
1
1
  & {
2
2
  position: relative;
3
3
  display: block;
4
- padding: 10px 20px 10px 44px;
4
+ padding: 10px 0 10px 52px;
5
5
  white-space: nowrap;
6
6
  line-height: 28px;
7
7
  background: #fff9;
8
8
  }
9
+
10
+ &[type=folder] {
11
+ >svg {
12
+ transform: scale(.9);
13
+ }
14
+ }
15
+
9
16
  &[cut] {
10
17
  opacity: .4;
11
18
  }
12
19
 
20
+ &>[ext] {
21
+ display: block;
22
+ position: absolute;
23
+ left: 2px;
24
+ bottom: 11px;
25
+ width: 46px;
26
+ text-align: center;
27
+ font-size: 12px;
28
+ line-height: 12px;
29
+ text-transform: uppercase;
30
+ background-color: #fff;
31
+ border: 1.2px solid;
32
+ }
33
+
34
+ @ext(...@name, @color) {
35
+ each(@name, (@n) {
36
+ &[ext=@n] {
37
+ >[ext] {
38
+ color: #fff;
39
+ border-color: transparent;
40
+ background: @color;
41
+ }
42
+ }
43
+ });
44
+ }
45
+
46
+ @ext(mp3, flac, wma, wav, midi, aac, #2ac);
47
+ @ext(krc, lrc, grc, qrc, #2ca);
48
+ @ext(mp4, avi, wmv, mov, rmvb, rm, flv, #a32);
49
+ @ext(jpg, svg, jpeg, png, bmp, dib, gif, webp, jfif, tiff, dng, #84c);
50
+ @ext(js, mjs, cjs, jsx, #db9);
51
+ @ext(bat, cmd, sh, #6ad);
52
+ @ext(tmp, log, #bbb);
53
+ @ext(exe, scr, com, #666);
54
+ @ext(dll, sys, a, lib, #999);
55
+ @ext(rar, jar, tar, zip, 7z, war, apk, tgz, xz, #666);
56
+ @ext(ts, tsx, #9cc);
57
+ @ext(java, c, go, rs, s, asm, h, ini, cpp, hpp, m, #9ab);
58
+ @ext(less, #9bd);
59
+ @ext(css, #9db);
60
+ @ext(html, #bc9);
61
+ @ext(ico, #b9c);
62
+ @ext(xht, vue, #bb9);
63
+ @ext(jsp, asp, php, #adc);
64
+ @ext(yml, json, #ca9);
65
+ @ext(md, rtf, gsp, doc, docx, #66a);
66
+
13
67
 
14
68
  >svg {
15
- width: 28px;
16
- height: 28px;
69
+ width: 52px;
70
+ height: 52px;
17
71
  display: inline-block;
18
72
  vertical-align: top;
19
- margin: 0 6px 0 -34px;
73
+ margin: -12px 0 -12px -52px;
20
74
  }
21
75
 
22
76
  >span {
@@ -27,7 +81,12 @@
27
81
  text-overflow: ellipsis;
28
82
  display: inline-block;
29
83
  vertical-align: top;
84
+ }
30
85
 
86
+ >[name] {
87
+ padding-left: 10px;
88
+ margin-left: -10px;
89
+ box-sizing: content-box;
31
90
  }
32
91
 
33
92
  &:not([dragclone]) [marquee] {
@@ -49,14 +108,16 @@
49
108
  left: 6px;
50
109
  margin-left: 6px;
51
110
  }
52
- p{
111
+
112
+ p {
53
113
  display: block;
54
114
  margin: 0;
55
115
  position: relative;
56
116
  height: 4px;
57
117
  background: #29c2;
58
118
  border-radius: 2px;
59
- >r{
119
+
120
+ >r {
60
121
  height: 100%;
61
122
  display: block;
62
123
  background: #29c;
@@ -338,7 +338,7 @@ var _as_yextra = function (global, innerWidth, innerHeight, element, target, poi
338
338
  };
339
339
  var _as_xextra = arriswise(_as_yextra, arguments);
340
340
  var popup_as_single = function (element) {
341
- css(element, `z-index:${zIndex()};`);
341
+ if (!isMounted(element)) css(element, `z-index:${zIndex()};`);
342
342
  global(element, false);
343
343
  };
344
344
  var popup_to_point = function (element, [x, y]) {
@@ -392,6 +392,7 @@ var popup_to_event = function (element, { clientX, clientY }) {
392
392
  var global = function (element, issingle) {
393
393
  once("remove")(element, cleanup);
394
394
  rootElements.push(element);
395
+ if (isMounted(element)) return;
395
396
  popup.global &&
396
397
  issingle !== false ? popup.global(element, true) : appendChild(document.body, element);
397
398
  };
@@ -1059,7 +1059,7 @@ function createStructure(element, useExists) {
1059
1059
  else if (/[_@\:\.&\?\*\+\#]$/.test(name)) {
1060
1060
  var key = name.slice(0, name.length - 1);
1061
1061
  if (value) attr1[key] = value;
1062
- else {
1062
+ else a: {
1063
1063
  key = 驼峰化(name.slice(0, name.length - 1));
1064
1064
  switch (name.charAt(name.length - 1)) {
1065
1065
  case "?":
@@ -1075,8 +1075,8 @@ function createStructure(element, useExists) {
1075
1075
  binds.src = key;
1076
1076
  break;
1077
1077
  case "+":
1078
- binds[key] = key;
1079
- break;
1078
+ attr1[key] = key;
1079
+ break a;
1080
1080
  case "#":
1081
1081
  ids.push(key);
1082
1082
  break;
@@ -107,7 +107,7 @@ var resize2 = function () {
107
107
  marginBottom: fromOffset(-height),
108
108
  })
109
109
  css(body, {
110
- paddingTop: fromOffset(height - body.clientTop)
110
+ paddingTop: fromOffset(height - body.clientTop - body.offsetTop)
111
111
  });
112
112
  }
113
113
  a: if (foot && body) {
@@ -115,12 +115,12 @@ var resize2 = function () {
115
115
  if (foot.$height === height) break a;
116
116
  foot.$height = height;
117
117
  changed = true;
118
- css(body, {
119
- paddingBottom: fromOffset(height)
120
- });
121
118
  css(foot, {
122
119
  marginTop: fromOffset(-height)
123
120
  })
121
+ css(body, {
122
+ paddingBottom: fromOffset(body.clientTop + body.clientHeight + body.offsetTop - foot.offsetTop)
123
+ });
124
124
  }
125
125
  };
126
126
  function view(element) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.20.0",
3
+ "version": "4.20.2",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {