efront 4.19.4 → 4.19.6

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.
@@ -986,10 +986,21 @@ var _express = function (body, getname, ret) {
986
986
  var p = 0;
987
987
  if (o.unary) p = powermap["!"];
988
988
  else p = powermap[o.text];
989
- var b = body.slice(bx, cx + 1);
990
- bx = cx + 1;
991
- b.index = nameindex;
992
989
  var isor = p === powermap["||"];
990
+ var b = body.slice(bx, cx);
991
+ if (isor || isempty(b, SPACE | COMMENT) || canbeTemp(b) || p <= powermap["="] || !o.unary && /^(\+\+|\-\-)$/.test(o.text)) {
992
+ b = body.slice(bx, cx + 1);
993
+ b.index = nameindex;
994
+ }
995
+ else {
996
+ if (needcomma(q)) q.push({ type: STAMP, text: ';' });
997
+ q.push(...scanner2(`${getname(nameindex)}=`), ...b);
998
+ b = [{ text: getname(nameindex), type: EXPRESS }, body[cx]];
999
+ b.index = nameindex;
1000
+ nameindex++;
1001
+ if (maxindex < nameindex) maxindex = nameindex;
1002
+ }
1003
+ bx = cx + 1;
993
1004
  if (!isor) if (!cache.length || p > cache[cache.length - 1] || p >= powermap.new) {
994
1005
  cache.push(b, p);
995
1006
  continue;
@@ -102,13 +102,13 @@ test("if(a) a = 1;function* a(){}", "a = function *() {}; if (!a) return [1, 0];
102
102
  test("await new Promise(function(){})", '_ = function () {}; _ = new Promise(_); return [_, 1]', true);
103
103
  test(`onerror({ status: xhr.status, response: "Cookie解析异常!", toString: toResponse })`, '_ = { status: xhr.status, response: "Cookie解析异常!", toString: toResponse }; onerror(_)', true);
104
104
  test(`if (!/^https\\:\\/\\/|^s\\/\\//.test(url)) console.warn("请使用https访问如下路径:" + url)`, '_ = /^https\\:\\/\\/|^s\\/\\//.test(url); if (_) return [1, 0]; _ = "请使用https访问如下路径:" + url; _ = console.warn(_); return [1, 0]', true);
105
- test(`url += (/\\?/.test(url) ? "&" : "?") + datas;`, '_ = /\\?/.test(url); if (!_) return [1, 0]; _ = "&"; return [2, 0];\r\n _ = "?"; return [1, 0];\r\n _ = _ + datas; url = url + _', true);
105
+ test(`url += (/\\?/.test(url) ? "&" : "?") + datas;`, '_0 = /\\?/.test(url); if (!_0) return [1, 0]; _0 = "&"; return [2, 0];\r\n _0 = "?"; return [1, 0];\r\n _ = _0, _ = _ + datas; url = url + _', true);
106
106
  test(`a = newname.querySelector("input,textarea").value = c.name.replace(/\\/$/, '')`, `_ = newname.querySelector("input,textarea"); _0 = c.name.replace(/\\/$/, ''); _.value = _0; a = _0`, true);
107
107
  test(`if (selected[f.url]) f.selected = true;`, `_ = f.url; _ = selected[_]; if (!_) return [1, 0]; f.selected = true; return [1, 0]`, true);
108
- test(`location.protocol + parseURL(a.b).host `, `_ = a.b; _ = parseURL(_); location.protocol + _.host`, true);
109
- test(`var base = location.protocol + "//" + parseURL(this.$scope.data.host).host + "/";`, `_ = location.protocol + "//", _0 = this.$scope.data.host; _0 = parseURL(_0); _ = _ + _0.host, base = _ + "/"`, true);
108
+ test(`location.protocol + parseURL(a.b).host `, `_ = location.protocol, _0 = a.b; _0 = parseURL(_0); _ + _0.host`, true);
109
+ test(`var base = location.protocol + "//" + parseURL(this.$scope.data.host).host + "/";`, `_ = location.protocol, _ = _ + "//"; _1 = this.$scope.data.host; _1 = parseURL(_1); _0 = _1.host, _ = _ + _0, base = _ + "/"`, true);
110
110
  test(`a=a+b*c+c*d`, `_ = b * c, _ = a + _, _0 = c * d, a = _ + _0`, true);
111
- test(`cc.name += "<f test></f>"`, `_ = cc.name + "<f test></f>"; cc.name = _`, true);
111
+ test(`cc.name += "<f test></f>"`, `_ = cc.name, _ = _ + "<f test></f>"; cc.name = _`, true);
112
112
  test("throw a", 'throw a', true);
113
113
  test("throw a,b", 'a; throw b', true);
114
114
  test("return a,b", 'a; return [b, 2]', true);
@@ -119,8 +119,8 @@ test("a(b,b+=1)", '_ = b; _0 = b + 1; b = _0; a(_, _0)', true);
119
119
  test("while(a){if(b){if(c);else d;continue;}}", 'if (!a) return [4, 0]; if (!b) return [3, 0]; if (!c) return [1, 0]; return [2, 0];\r\n d; return [1, 0];\r\n return [-2, 0];\r\n return [-3, 0]', true);
120
120
  test("/*abc*/", '/*abc*/', true);
121
121
  test("//aaa", '//aaa', true);
122
- test("menus[0].name+='aaa'", "_ = menus[0]; _0 = _.name + 'aaa'; _.name = _0", true);
123
- test("menus[a+b].name+='aaa'", "_ = a + b; _ = menus[_]; _0 = _.name + 'aaa'; _.name = _0", true);
122
+ test("menus[0].name+='aaa'", "_ = menus[0]; _0 = _.name, _0 = _0 + 'aaa'; _.name = _0", true);
123
+ test("menus[a+b].name+='aaa'", "_ = a + b; _ = menus[_]; _0 = _.name, _0 = _0 + 'aaa'; _.name = _0", true);
124
124
  test("menus[a+b]()", "_ = a + b; menus[_]()", true);
125
125
  test(`switch(a){default: a;case 1:b;}`, 'if (a === 1) return [2, 0]; return [1, 0];\r\n a; return [1, 0];\r\n b; return [1, 0]', true);
126
126
  test("loop:{a=b;if(a) continue loop}", "a = b; if (a) return [0, 0]", true);
@@ -130,9 +130,9 @@ test("predef[key[1]](r.slice(key[0].length).trim())", '_ = key[1]; _0 = key[0].l
130
130
  test("predef[key[1]](r.slice())(r.slice())", '_ = key[1]; _0 = r.slice(); _ = predef[_](_0); _0 = r.slice(); _(_0)');
131
131
  test("predef[key[1]][key[2]][key[3]]", '_ = key[1]; _ = predef[_]; _0 = key[2]; _ = _[_0]; _0 = key[3]; _[_0]');
132
132
  test("[key[1]][key[2]][key[3]]", '_ = key[1]; _ = [_]; _0 = key[2]; _ = _[_0]; _0 = key[3]; _[_0]');
133
- test("[key[1]][key[2]]+[key[3]][key[4]]", '_ = key[1]; _ = [_]; _0 = key[2]; _ = _[_0]; _0 = key[3]; _0 = [_0]; _1 = key[4]; _ + _0[_1]');
133
+ test("[key[1]][key[2]]+[key[3]][key[4]]", '_0 = key[1]; _0 = [_0]; _1 = key[2]; _ = _0[_1], _1 = key[3]; _0 = [_1]; _1 = key[4]; _ + _0[_1]');
134
134
  test("if(a)a:{break a}", "if (!a) return [2, 0]; return [1, 0];\r\n return [1, 0]", true);
135
- test("rgb=(rgb<<8|rgb>>16)&0xffffff", "_ = rgb << 8, _0 = rgb >> 16, _ = _ | _0; rgb = _ & 0xffffff", true);
135
+ test("rgb=(rgb<<8|rgb>>16)&0xffffff", "_0 = rgb << 8, _1 = rgb >> 16, _0 = _0 | _1; _ = _0, rgb = _ & 0xffffff", true);
136
136
  test(`if (c) a; else return true; return false`, "if (!c) return [1, 0]; a; return [2, 0];\r\n return [true, 2];\r\n return [false, 2]")
137
137
  test(`switch(a){case a:a=a?1:0;break;case b:a=b;break;}`, "if (a === a) return [1, 0]; if (a === b) return [4, 0]; return [5, 0];\r\n if (!a) return [1, 0]; a = 1; return [2, 0];\r\n a = 0; return [1, 0];\r\n return [2, 0];\r\n a = b; return [1, 0]");
138
138
  test(`a=typeof a!==1`, "_ = typeof a, a = _ !== 1");
@@ -153,8 +153,7 @@ test(`c=b+ !a`, "_ = !a, c = b + _");
153
153
  test(`do {var loadcount = 0;} while (loadcount !== 0);`, `loadcount = 0; _ = loadcount !== 0; if (_) return [0, 0]`);
154
154
  test("if(a)try{a}catch{};a;", 'if (!a) return [4, 0]; return [1, 7];\r\n a; return [0, 9];\r\n return [1, 9];\r\n return [1, 0];\r\n a');
155
155
  test("url = (o===void 0||o===null?void 0:o.url)", '_ = void 0, _ = o === _; if (_) return [1, 0]; _ = o === null;\r\n if (!_) return [1, 0]; _ = void 0; return [2, 0];\r\n _ = o.url; return [1, 0];\r\n url = _', true);
156
- test("p ? (ishttps ? `https` : `http`).toUpperCase() + i18n`端口` + (ishttps ? ': ' : ': ') + p : ''", "if (!p) return [1, 0]; if (!ishttps) return [1, 0]; _0 = `https`; return [2, 0];\r\n _0 = `http`; return [1, 0];\r\n _1 = _0.toUpperCase(); _ = _1 + i18n`端口`; if (!ishttps) return [1, 0]; _2 = ': '; return [2, 0];\r\n _2 = ': '; return [1, 0];\r\n _ = _ + _2, _ = _ + p; return [2, 0];\r\n ''; return [1, 0]")
157
- unstruct.debug = true; r++;
156
+ test("p ? (ishttps ? `https` : `http`).toUpperCase() + i18n`端口` + (ishttps ? ': ' : ': ') + p : ''", "if (!p) return [1, 0]; if (!ishttps) return [1, 0]; _1 = `https`; return [2, 0];\r\n _1 = `http`; return [1, 0];\r\n _ = _1.toUpperCase(); _0 = i18n`端口`, _ = _ + _0; if (!ishttps) return [1, 0]; _2 = ': '; return [2, 0];\r\n _2 = ': '; return [1, 0];\r\n _0 = _2, _ = _ + _0, _ = _ + p; return [2, 0];\r\n ''; return [1, 0]")
158
157
  r++// test("if(a)else {}",'')
159
158
  test("if(a){if(b){c}d}else{e}", `if (!a) return [2, 0]; if (!b) return [1, 0]; c; return [1, 0];\r\n d; return [2, 0];\r\n e; return [1, 0]`)
160
159
  test("if(a){if(b){c}else{d}}else{e}", `if (!a) return [3, 0]; if (!b) return [1, 0]; c; return [2, 0];\r\n d; return [1, 0];\r\n return [2, 0];\r\n e; return [1, 0]`)
@@ -164,3 +163,6 @@ test("var res = null, krc;", `res = null; krc`)
164
163
  test("res = null, krc;", `res = null; krc`)
165
164
  test(`while (a && b);`, '_ = a; if (!_) return [1, 0]; _ = b;\r\n if (!_) return [1, 0]; return [-1, 0]', true);
166
165
  test(`while (a < b);`, '_ = a < b; if (!_) return [1, 0]; return [0, 0]', true);
166
+ unstruct.debug = true; r++;
167
+ test(`if (a() > a+b);`, '_ = a(), _0 = a + b, _ = _ > _0; if (!_) return [1, 0]; return [1, 0]', true);
168
+ test(`index > start && result.length < pageSize`, '_ = index > start; if (!_) return [1, 0]; _ = result.length, _ < pageSize', true);
@@ -17,7 +17,7 @@ function main(dataid, datapath) {
17
17
  if (s.hash || s.url) {
18
18
  kugou$player.play(s);
19
19
  } else {
20
- go(datapath, s);
20
+ zimoli.go(datapath, s);
21
21
  }
22
22
  },
23
23
  datas: data.from(dataid, parseSongsList)
@@ -13,7 +13,7 @@ function Main(dataid, datapath, titleid) {
13
13
  if (s.hash) {
14
14
  this.player.play(s);
15
15
  } else {
16
- go(datapath, s);
16
+ zimoli.go(datapath, s);
17
17
  }
18
18
  },
19
19
  png: img,
@@ -5,7 +5,8 @@
5
5
  right: 0;
6
6
  bottom: -60px;
7
7
  top: 0;
8
- height: auto;
8
+ height: 100%;
9
+ display: block;
9
10
  background: #323336;
10
11
  }
11
12
  &+.titlebar>back{
@@ -64,7 +64,7 @@ return a => {
64
64
  var { name, singer } = parseFileName(b);
65
65
  data.name = name;
66
66
  data.singer = singer;
67
- data.url = "song/" + b;
67
+ data.url = "https://efront.cc/song/" + b;
68
68
  }
69
69
  if (!data.singer) {
70
70
  data.singer = data.author_name;
@@ -79,7 +79,7 @@ return a => {
79
79
  if (data.singer) data.singer = formatSingerNames(data.singer);
80
80
  if (!data.avatar && data.singer) {
81
81
  var singer0 = data.singer.split("、")[0];
82
- if (singer0 in singerPhotosMap) data.avatar = `singer/` + singerPhotosMap[singer0];
82
+ if (singer0 in singerPhotosMap) data.avatar = `https://efront.cc/singer/` + singerPhotosMap[singer0];
83
83
  }
84
84
  if (!data.singerName) data.singerName = data.singer;
85
85
  if (!data.songName) data.songName = data.name;
package/coms/zimoli/on.js CHANGED
@@ -228,7 +228,7 @@ function checkKeyNeed(eventtypes, e) {
228
228
  for (var cx = 0, dx = keyneed.length; cx < dx; cx++) {
229
229
  var key = keyneed[cx];
230
230
  keykeep[key] = true;
231
- if (!e[key + "Key"]) return false;
231
+ if (!e[key + "Key"] && e.keyCode !== keyCodeMap[key]) return false;
232
232
  }
233
233
  }
234
234
  if (eventtypes.only) {
@@ -543,7 +543,7 @@ var directives = {
543
543
  var style = elem.style;
544
544
  if (style.display !== display) style.display = display;
545
545
  }, function (elem) {
546
- return elem.style.display === 'none';
546
+ return elem.style.display !== 'none';
547
547
  }),
548
548
  style: createMapper(css, css.styleToMap),
549
549
  class: createMapper(addClass, addClass.classToMap),
@@ -708,6 +708,7 @@ var emiters = {
708
708
  };
709
709
  emiters.v = emiters.ng = emiters.on;
710
710
 
711
+ var 驼峰化 = key => key.replace(/\-([a-z])/ig, (_, w) => w.toUpperCase());
711
712
  var keyAdapters = [
712
713
  key => key,
713
714
  key => key.toLowerCase(),
@@ -947,7 +948,7 @@ class Struct {
947
948
 
948
949
  var pushid = function (ids, name) {
949
950
  ids.push(name);
950
- var name1 = name.replace(/\-([a-z])/ig, (_, a) => a.toUpperCase());
951
+ var name1 = 驼峰化(name);
951
952
  if (name1 !== name) ids.push(name1);
952
953
  };
953
954
 
@@ -1021,22 +1022,28 @@ function createStructure(element, useExists) {
1021
1022
  }
1022
1023
  // ng-html,ng-src,ng-text,ng-model,ng-style,ng-class,...
1023
1024
  var key = name.replace(/^(ng|v|[^\_\:\.]*?)\-|^[\:\_\.\?\@\*&]|^v\-bind\:/i, "").toLowerCase();
1024
- if (key.length !== name.length && directives.hasOwnProperty(key) || /^([\_\:\.]|v\-bind\:)/.test(name) || /^[@&\?\*]/.test(name) && !value) {
1025
+ if (key.length !== name.length && directives.hasOwnProperty(key) || /^([\_\:\.]|v\-bind\:)/.test(name) || /^[@&\?\*\+]/.test(name) && !value) {
1025
1026
  if (value) binds[key] = value;
1026
- else switch (name.charAt(0)) {
1027
- case "?":
1028
- case ":":
1029
- binds.text = key;
1030
- break;
1031
- case "@":
1032
- binds.html = key;
1033
- break;
1034
- case "*":
1035
- binds.model = key;
1036
- break;
1037
- case "&":
1038
- binds.src = key;
1039
- break;
1027
+ else {
1028
+ key = 驼峰化(name.slice(1));
1029
+ switch (name.charAt(0)) {
1030
+ case "?":
1031
+ case ":":
1032
+ binds.text = key;
1033
+ break;
1034
+ case "@":
1035
+ binds.html = key;
1036
+ break;
1037
+ case "*":
1038
+ binds.model = key;
1039
+ break;
1040
+ case "&":
1041
+ binds.src = key;
1042
+ break;
1043
+ case "+":
1044
+ binds[key] = key;
1045
+ break;
1046
+ }
1040
1047
  }
1041
1048
  element.removeAttribute(name);
1042
1049
  }
@@ -1048,10 +1055,11 @@ function createStructure(element, useExists) {
1048
1055
  if (value) ons.push([emiters[ngon], name.replace(emiter_reg, ''), value]);
1049
1056
  }
1050
1057
  // placeholder_ href_ checked_ ...
1051
- else if (/[_@\:\.&\?\*]$/.test(name)) {
1058
+ else if (/[_@\:\.&\?\*\+]$/.test(name)) {
1052
1059
  var key = name.slice(0, name.length - 1);
1053
1060
  if (value) attr1[key] = value;
1054
1061
  else {
1062
+ key = 驼峰化(name.slice(0, name.length - 1));
1055
1063
  switch (name.charAt(name.length - 1)) {
1056
1064
  case "?":
1057
1065
  binds.text = key;
@@ -1065,6 +1073,9 @@ function createStructure(element, useExists) {
1065
1073
  case "&":
1066
1074
  binds.src = key;
1067
1075
  break;
1076
+ case "+":
1077
+ binds[key] = key;
1078
+ break;
1068
1079
  }
1069
1080
  element.setAttribute(key.replace(/\./g, '-'), '');
1070
1081
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.19.4",
4
- "description": "简化前端开发,优化web性能",
3
+ "version": "4.19.6",
4
+ "description": "一个开发环境,提供前端开发所需的各种功能。此项目不依赖vue和angular的基础库,却同样提供了对vue/angular的语法的支持,像v-if/v-else,ng-if,v-show,ng-model,v-bind,ng-bind,@click,ng-click等可在同一个文件中使用,另外组件可以拆分成脚本、样式、模板分三个文件保存,也可以合并成一个文件保存,这取决于使用者的偏好,而不是冷冰冰的硬性规定。像vue3中直接绑定变量,vue2绑定的却是data中的数据,这种vue不同版本不兼容的问题,efront同时兼容两种绑定方式,同样取决于使用者的喜好,而不是框架作者的喜好。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {
7
7
  "test": "test"