efront 4.11.2 → 4.11.5

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.
Files changed (36) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +1 -1
  2. package/apps/pivot/cert/list.js +3 -7
  3. package/coms/basic/#loader.js +13 -14
  4. package/coms/basic/JSAM.js +2 -1
  5. package/coms/basic/assert.js +5 -3
  6. package/coms/basic/cookie.js +9 -9
  7. package/coms/basic/data.js +1 -1
  8. package/coms/basic/i18n.js +4 -2
  9. package/coms/basic_/Array2.js +4 -1
  10. package/coms/compile/Html_test.js +1 -0
  11. package/coms/compile/Javascript.js +5 -1
  12. package/coms/compile/Javascript_test.js +14 -2
  13. package/coms/compile/Program.js +6 -3
  14. package/coms/compile/common.js +1 -1
  15. package/coms/docs/markdown.js +5 -3
  16. package/coms/frame/route.js +15 -15
  17. package/coms/pivot/pedit.less +23 -1
  18. package/coms/zimoli/cless.js +2 -1
  19. package/coms/zimoli/forceUpdate.js +1 -1
  20. package/coms/zimoli/render.js +44 -64
  21. package/coms/zimoli/view.less +0 -1
  22. package/coms//350/214/250/350/217/260/tab.js +35 -0
  23. package/coms//350/214/250/350/217/260//344/270/212/350/211/262.xht +99 -0
  24. package/coms//350/214/250/350/217/260//345/205/211/346/240/207.js +1 -0
  25. package/coms//350/214/250/350/217/260//346/211/253/346/217/217.js +12 -0
  26. package/coms/{docs/codecolor.js → /350/214/250/350/217/260//346/240/207/347/255/276/345/214/226.js} +2 -1
  27. package/coms//350/214/250/350/217/260//346/270/262/346/237/223.js +45 -0
  28. package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +132 -0
  29. package/coms//350/214/250/350/217/260//350/257/255/350/250/200.js +210 -0
  30. package/coms//350/214/250/350/217/260//350/277/275/345/212/240/345/205/211/346/240/207.js +62 -0
  31. package/docs//347/273/204/344/273/266.xht +8 -162
  32. package/package.json +1 -1
  33. package/public/efront.js +1 -1
  34. package/readme-en.md +4 -5
  35. package/readme.md +2 -5
  36. package/coms/docs/codetext.xht +0 -386
@@ -1655,7 +1655,7 @@
1655
1655
  en: "The commands that can be used are:"
1656
1656
 
1657
1657
  - zh-CN: 如要显示更具体的信息,请使用:$1
1658
- en: "To show more messages, used"
1658
+ en: "To show more messages, use $1"
1659
1659
 
1660
1660
  - zh-CN: 是
1661
1661
  en: is
@@ -1,9 +1,5 @@
1
1
  plist.bind(null, '接口管理', "cert", refilm`
2
2
  *域名/hostname input/253
3
- 公钥/private gen/600 ${async function (data) {
4
- var [private_key, public_key] = await acme2.createKeyPair();
5
- data.private = private_key;
6
- data.public = public_key;
7
- }}
8
- -私钥/public text
9
- $证书/cert text`, '/cert/edit');
3
+ 公钥/private text
4
+ 私钥/public text
5
+ 证书/cert text`, '/cert/edit');
@@ -96,9 +96,9 @@ var readFile = function (names, then) {
96
96
  }
97
97
  };
98
98
  if (!names.length) return then();
99
- names.forEach(function (name) {
99
+ for (var name of names) {
100
100
  readFile(name, callback);
101
- });
101
+ }
102
102
  return;
103
103
  }
104
104
  var name = names;
@@ -155,7 +155,8 @@ var readFile = function (names, then) {
155
155
  }
156
156
  if (loadingTree[key]) {
157
157
  loadingTree[key].error = e;
158
- loadingTree[key].forEach(a => a(e));
158
+ var loading = loadingTree[key];
159
+ for (var a of loading) a(e);
159
160
  }
160
161
  };
161
162
  var tryload = function () {
@@ -183,7 +184,7 @@ var killCircle = function () {
183
184
  if (!(loadedModules[k] instanceof Array)) continue;
184
185
  var args = loadedModules[k].args;
185
186
  if (!(args instanceof Array)) continue;
186
- args.forEach(arg => {
187
+ for (var arg of args) {
187
188
  if (!penddings[arg]) {
188
189
  penddings[arg] = [];
189
190
  }
@@ -191,7 +192,7 @@ var killCircle = function () {
191
192
  penddings[arg][k] = true;
192
193
  penddings[arg].push(key);
193
194
  }
194
- })
195
+ }
195
196
  circle.push(key);
196
197
  module_keys.push(k);
197
198
  }
@@ -212,10 +213,10 @@ var killCircle = function () {
212
213
  if (savedLength === circle.length) {
213
214
  break;
214
215
  }
215
- circle.forEach(function (c) {
216
+ for (var c of circle) {
216
217
  var args = penddings[c];
217
218
  penddings[c] = args.filter(a => !deleted[a]);
218
- });
219
+ }
219
220
  }
220
221
  if (circle.length > 0) {
221
222
  circle = circle.sort((a, b) => {
@@ -235,13 +236,11 @@ var killCircle = function () {
235
236
  ));
236
237
  } else {
237
238
  var tree = {};
238
- module_keys.forEach(function (k) {
239
+ for (var k of module_keys) {
239
240
  var loading = tree[k] = loadedModules[k];
240
241
  loadedModules[k] = loading.mod;
241
- });
242
- module_keys.forEach(function (k) {
243
- flushTree(tree, k);
244
- });
242
+ }
243
+ for (var k of module_keys) flushTree(tree, k);
245
244
  }
246
245
  };
247
246
  // -->
@@ -331,9 +330,9 @@ var loadModule = function (url, then, prebuilds = {}) {
331
330
  } else {
332
331
  loadedModules[key].args = mod.args;
333
332
  loadedModules[key].mod = mod;
334
- args.forEach(function (moduleName) {
333
+ for (var moduleName of args) {
335
334
  loadModule(moduleName, response, prebuilds);
336
- });
335
+ }
337
336
  }
338
337
  };
339
338
  readFile(url, saveModule);
@@ -132,7 +132,8 @@ var create = function (a, dst) {
132
132
  var arr = a.split(',');
133
133
  var rest = [];
134
134
  for (var cx = 0, dx = arr.length; cx < dx; cx++) {
135
- var [k, v] = arr[cx].split(':');
135
+ var s = arr[cx].split(":");
136
+ var k = s[0], v = s[1];
136
137
  if (v === undefined) {
137
138
  rest.push(k);
138
139
  } else {
@@ -34,7 +34,7 @@ var gray = format('<gray>;</gray>').split(';');
34
34
  var green = format('<green>;</green>').split(';');
35
35
  var crack = format('<red2>;</red2>').split(';');
36
36
  var dump = function (a, msg) {
37
- if (a instanceof Object) console.error(i18n`属性错误`), clog(msg ? msg + " " : " {\r\n", Object.keys(a).map(k => ` ${k}${gray.join(':')}\r\n ${a[k]}`).join('\r\n') + "\r\n }");
37
+ if (isObject(a)) console.error(i18n`属性错误`), clog(msg ? msg + " " : " {\r\n", Object.keys(a).map(k => ` ${k}${gray.join(':')}\r\n ${a[k]}`).join('\r\n') + "\r\n }");
38
38
  else if (msg) clog(msg + ":", a);
39
39
  else clog(a);
40
40
  };
@@ -66,12 +66,14 @@ var assert = function (result, expect, log = dump) {
66
66
  mark.setTag2(color2[1], color2[0]);
67
67
  var [r, e] = mark.pair(result, expect);
68
68
  var s = r;
69
+ if (typeof s === 'object') console.log(typeof s, s);
70
+
69
71
  r = colorString(r, color1, e, color2);
70
72
  e = colorString(e, color2, s, color1);
71
73
  errors = `${color3[0]}结果 ${color3[1]}${r}\r\n ${color3[0]}应为 ${color3[1]}${e}\r\n`;
72
74
  };
73
75
  return function (error) {
74
- if (error instanceof Object) {
76
+ if (isObject(error)) {
75
77
  Object.keys(error).forEach(y => {
76
78
  var e = y;
77
79
  errors[`${gray.join('[')}${green.join(k)}${gray.join("]->")}` + e] = error[y];
@@ -101,7 +103,7 @@ var assert = function (result, expect, log = dump) {
101
103
  }
102
104
  } else if (expect instanceof Function) {
103
105
  res = expect(result, (...args) => (b) => assert(result.apply(null, args), b, collect(b, args)), collect(`()`)) !== false;
104
- } else if (expect instanceof Object && result instanceof Object) {
106
+ } else if (isObject(expect) && isObject(result)) {
105
107
  var res = true;
106
108
  for (var k in expect) {
107
109
  res = res && assert(result[k], expect[k], collect(k));
@@ -21,10 +21,10 @@ var parseCookieFromText = function (cookie) {
21
21
  return [pair, info];
22
22
  };
23
23
 
24
- class Cookie {
25
- cookiesMap = {};
24
+ function Cookie() {
25
+ this.cookiesMap = {};
26
26
  }
27
- var CookieProto = Cookie.prototype;
27
+ var CookieProto = Cookie.prototype = new Cookie;
28
28
  CookieProto.addCookie = function addCookie(cookie_text, originDomain = "") {
29
29
  var { cookiesMap } = this;
30
30
  originDomain = getDomainPath(originDomain);
@@ -59,7 +59,7 @@ CookieProto.addCookie = function addCookie(cookie_text, originDomain = "") {
59
59
  }
60
60
  }
61
61
  }
62
- }
62
+ };
63
63
 
64
64
  CookieProto.getCookies = function getCookies(domainPath) {
65
65
  var { cookiesMap } = this;
@@ -91,7 +91,7 @@ CookieProto.getCookies = function getCookies(domainPath) {
91
91
  splited[0] = domain;
92
92
  } while (domain.length);
93
93
  return serialize(cookieObject, ";");
94
- }
94
+ };
95
95
 
96
96
  CookieProto.delCookies = function delCookies(domainPath) {
97
97
  var { cookiesMap } = this;
@@ -99,7 +99,7 @@ CookieProto.delCookies = function delCookies(domainPath) {
99
99
  var splited = domainPath.split("/");
100
100
  var domain = splited[0];
101
101
  delete cookiesMap[domain];
102
- }
102
+ };
103
103
  function getDomainPath(url) {
104
104
  var { host, pathname } = parseURL(url);
105
105
  if (pathname) return host + pathname;
@@ -115,10 +115,10 @@ CookieProto.linkCookie = function linkCookie(from, to) {
115
115
  }
116
116
  cookiesMap[to] = cookiesMap[from] = extend({}, cookiesMap[to], cookiesMap[from]);
117
117
  return to;
118
- }
118
+ };
119
119
  CookieProto.copyCookie = function copyCookie(from, to) {
120
120
  var { cookiesMap } = this;
121
- from = getDomainPath(from).replace(/\/$,'/, '');
121
+ from = getDomainPath(from).replace(/\/$/, '');
122
122
  to = getDomainPath(to).replace(/\/$/, '');
123
123
  if (from in cookiesMap) {
124
124
  cookiesMap[to] = JSON.parse(JSON.stringify(cookiesMap[from]));
@@ -126,7 +126,7 @@ CookieProto.copyCookie = function copyCookie(from, to) {
126
126
  else {
127
127
  delete cookiesMap[to];
128
128
  }
129
- }
129
+ };
130
130
  var defaultCookie = new Cookie;
131
131
  defaultCookie.new = () => new Cookie;
132
132
  return defaultCookie;
@@ -443,7 +443,7 @@ function createApiMap(data) {
443
443
  var items1 = data;
444
444
  for (var key in items1) {
445
445
  var keeys = key.split(/\s+/);
446
- var [base] = keeys.filter(a => reg.test(a));
446
+ var base = keeys.filter(a => reg.test(a))[0];
447
447
  if (!base) {
448
448
  var headersIndex = 0;
449
449
  } else {
@@ -14,9 +14,11 @@ var getLanguageIndexFromName = function (language) {
14
14
  if (isFinite(language)) return language;
15
15
  if (language in languageMap) return languageMap[language];
16
16
  language = String(language).toLowerCase();
17
- for (var l of language.split(",").slice(0, 12)) {
17
+ var ls = language.split(",").slice(0, 12);
18
+ for (var l of ls) {
18
19
  for (var k in languageMap) {
19
- for (var kk of k.toLowerCase().split("-")) {
20
+ var ks = k.toLowerCase().split("-");
21
+ for (var kk of ks) {
20
22
  if (l.indexOf(kk) >= 0) return languageMap[k];
21
23
  }
22
24
  }
@@ -1,4 +1,7 @@
1
- var hasOwnProperty = Object.prototype.hasOwnProperty;
1
+ var hasOwnProperty = {}.__proto__ === Object ? function (k) {
2
+ var proto = this.__proto__;
3
+ return k in this && (!proto || !(k in proto));
4
+ } : Object.prototype.hasOwnProperty;
2
5
  var setPrototypeOf = Object.setPrototypeOf;
3
6
  a: if (!setPrototypeOf) {
4
7
  var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
@@ -35,6 +35,7 @@ test('${i18n`加载中..`}<div class="loader"></div>');
35
35
  test('${a +typeof i18n`加载中..`}<div class="loader"></div>', '${a + typeof i18n`加载中..`}<div class="loader"></div>');
36
36
  test('${a > 1}');
37
37
  test('a>1', 'a > 1');
38
+ test(`<meta charset="utf-8" />`);
38
39
  test('a><a></a>', 'a > <a></a>');
39
40
  test('X', 'X');
40
41
  test('<input -class="{actived:actived===f}"/>', 'scoped.envs.actived', true);
@@ -434,7 +434,11 @@ Javascript.prototype.setType = function (o) {
434
434
  }
435
435
  }
436
436
  else if (o.type === STAMP) {
437
- o.isprop = o.text === "*" && (!last || /^[,;]$/.test(last.text) || queue.isClass && isShortMethodEnd(last));
437
+ if (!/^[,;:=\|&]$/.test(o.text)) {
438
+ if (!last || last.type === STAMP && /^[,;]$/.test(last.text) || last.isprop || queue.isClass && isShortMethodEnd(last)) {
439
+ o.isprop = true;
440
+ }
441
+ }
438
442
  }
439
443
  else if (o.type === PROPERTY) {
440
444
  o.isprop = true;
@@ -6,6 +6,7 @@ var testFix = function (a, e) {
6
6
  assert(c.toString(), e);
7
7
  }
8
8
  js.debug = true;
9
+ assert(scanner2("/a/g", js)[0].type, common.QUOTED);
9
10
  testFix(`import a from "a";console.log(a)`, 'var a = require("a"); console.log(a.default)');
10
11
  testFix(`import {a} from "a";console.log(a)`, 'var a1 = require("a"); console.log(a1.a)');
11
12
  testFix(`import a,{a as b} from "a";console.log(a,b)`, 'var a = require("a"); console.log(a.default, a.a)');
@@ -120,5 +121,16 @@ var testPress = function (text, expect) {
120
121
  };
121
122
  testPress(`if(){}\r\nelse {}`, `if(){}else{}`)
122
123
  testPress(`if(a)a={}\r\nelse{}`, `if(a)a={};else{}`)
123
- testPress(`if()a=function(){}\r\nelse {}`,`if()a=function(){};else{}`)
124
- testPress(`if()function a(){}\r\nelse {}`,`if()function a(){}else{}`)
124
+ testPress(`if()a=function(){}\r\nelse {}`, `if()a=function(){};else{}`)
125
+ testPress(`if()function a(){}\r\nelse {}`, `if()function a(){}else{}`)
126
+
127
+ var testStar = function (text, envs) {
128
+ var code = scanner2(text);
129
+ return assert(code.envs, envs);
130
+ };
131
+ testStar(`var a=class {a=1\r\nasync * a(){
132
+ var names=[];
133
+ for(var n of names) {
134
+ yield n;
135
+ }
136
+ }}`, {});
@@ -197,7 +197,7 @@ class Program {
197
197
  index = reg.lastIndex;
198
198
  var match = reg.exec(m);
199
199
  } while (match);
200
- colstart = start + index;
200
+ colstart = start + index - 1;
201
201
  };
202
202
  var queue_push = (scope) => {
203
203
  if (scope.type & (SPACE | COMMENT | PIECE | QUOTED)) {
@@ -459,8 +459,11 @@ class Program {
459
459
  queue.last = last.prev;
460
460
  }
461
461
  else {
462
- var m = queue.leave;
463
- index = queue.end - m.length;
462
+ var m = queue.leave || queue.tag_leave;
463
+ index = queue.end
464
+ if (m) {
465
+ index - m.length;
466
+ }
464
467
  }
465
468
  delete queue.start;
466
469
  delete queue.end;
@@ -1326,7 +1326,7 @@ var createString = function (parsed) {
1326
1326
  }
1327
1327
  else {
1328
1328
  if (a.type === PIECE && !a.text) continue;
1329
- if (!needvalue && !/\s$/.test(result[result.length - 1]) && a.type !== ELEMENT && (a.type !== PIECE || !/^[\=\s]/.test(a.text))) result.push(" ");
1329
+ if (!needvalue && !/\s$/.test(result[result.length - 1]) && a.type !== ELEMENT && (a.type & ~(PIECE | SPACE) || !/^[\=\s]/.test(a.text))) result.push(" ");
1330
1330
  run(a);
1331
1331
  needvalue = a.type === PIECE && /[\=]$/.test(a.text);
1332
1332
  }
@@ -107,13 +107,15 @@ function markdown(text) {
107
107
  if (m & 2) c = `<b>${c}</b>`;
108
108
  return c;
109
109
  }
110
- _ = codetext.encode(_.trim()).slice(1, -1);
111
110
  if (/[\*#\.]\s/.test(text.slice(i - 1, i + 1))) _ = " " + _;
112
- if (q.length === 1) return `${s1}<m>${_}</m>${s2}`;
111
+ if (q.length === 1) {
112
+ _ = 茨菰$渲染.encode(_.trim()).slice(1, -1);
113
+ return `${s1}<m>${_}</m>${s2}`;
114
+ }
113
115
  var t = /^\S+/.exec(c);
114
116
  if (t) t = t[0]; c = c.slice(t.length).replace(/^(\r\n|\r|\n)|\s+$/g, '');
115
117
  try {
116
- return s1 + codetext(t, c) + s2;
118
+ return s1 + 茨菰$上色(t, c) + s2;
117
119
  } catch (e) {
118
120
  console.error(e);
119
121
  return c;
@@ -141,19 +141,19 @@
141
141
  }
142
142
  mmap[menu.id] = menu;
143
143
  }
144
- if (menu.id === opened.$active) actived = menu, actived_value = historys.length;
144
+ if (menu.id === opened.active) actived = menu, actived_value = historys.length;
145
145
  }
146
146
  return res;
147
147
  };
148
148
  result.push.apply(result, items.filter(a));
149
149
  result.opened = opened.map(a => mmap[a]).filter(a => !!a);
150
- var active = result.$active;
150
+ var active = result.active;
151
151
  if (!active || result.indexOf(active) < 0) {
152
- actived = mmap[opened.$active] || actived;
152
+ actived = mmap[opened.active] || actived;
153
153
  if (actived) {
154
154
  if (actived_value === historys.length) {
155
155
  setActive(actived, true);
156
- result.$active = actived;
156
+ result.active = actived;
157
157
  };
158
158
  }
159
159
  }
@@ -176,38 +176,38 @@
176
176
  data.setInstance("option-buttons", zimoli.options || [], false);
177
177
  var menu = getChild(zimoli);
178
178
  if (!menu) return;
179
- if (menu !== result.$active) {
180
- setActive(result.$active, false);
179
+ if (menu !== result.active) {
180
+ setActive(result.active, false);
181
181
  setActive(menu, true);
182
- result.$active = menu;
182
+ result.active = menu;
183
183
  }
184
184
  if (menu.id) {
185
185
  var opened = result.opened || [];
186
186
  var oped = opened.map(a => a.id);
187
- oped.$active = menu.id;
187
+ oped.active = menu.id;
188
188
  data.setInstance('menu-opened', oped);
189
189
  }
190
190
  });
191
191
  result.open = function (menu) {
192
192
  if (!menu) {
193
- menu = result.$active || result[0];
194
- delete result.$active;
193
+ menu = result.active || result[0];
194
+ delete result.active;
195
195
  }
196
196
  if (!menu.path) {
197
197
  menu.closed = !menu.closed;
198
198
  return;
199
199
  }
200
- if (menu === result.$active) return;
200
+ if (menu === result.active) return;
201
201
  var opened = result.opened || [];
202
202
  if (!~opened.indexOf(menu) && !getChild(menu).id) {
203
203
  opened.push(menu);
204
204
  }
205
- if (result.$active && result.$active.id !== menu.id) {
206
- setActive(result.$active, false);
205
+ if (result.active && result.active.id !== menu.id) {
206
+ setActive(result.active, false);
207
207
  }
208
208
  setActive(menu, true);
209
209
  result.load(menu);
210
- result.$active = menu;
210
+ result.active = menu;
211
211
  };
212
212
  result.close = function (menu) {
213
213
  if (menu === result[0]) return;
@@ -228,7 +228,7 @@
228
228
  }
229
229
  };
230
230
  result.reload = function () {
231
- result.load(result.$active);
231
+ result.load(result.active);
232
232
  return result;
233
233
  };
234
234
  result.from = result.fetch = function (url) {
@@ -1,3 +1,25 @@
1
- &{
1
+ & {
2
2
  position: absolute;
3
+
4
+ .model {
5
+ font-family: 仿宋, 宋体, Consolas, "Courier New", monospace;
6
+
7
+ &[type=gen],
8
+ &[type=text] {
9
+ display: block;
10
+ font-size: 12px;
11
+ line-height: 12px;
12
+ }
13
+
14
+ textarea {
15
+ font-family: Consolas, 仿宋, sans-serif;
16
+ }
17
+ }
18
+
19
+ white-space: pre-wrap;
20
+
21
+ [body],
22
+ .body {
23
+ font-family: 宋体;
24
+ }
3
25
  }
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2
3
  var _create = function (commFactory, className, _invoke) {
3
4
  if (!className) return commFactory;
4
5
  if (commFactory instanceof Promise) {
@@ -23,7 +24,7 @@ var _create = function (commFactory, className, _invoke) {
23
24
  if (release) release = _invoke(release, className, _invoke);
24
25
  return release;
25
26
  };
26
- if ({}.hasOwnProperty.call(commFactory, 'toString')) {
27
+ if (hasOwnProperty.call(commFactory, 'toString')) {
27
28
  result.toString = function () {
28
29
  return _invoke(commFactory.toString(), className, _invoke);
29
30
  };
@@ -18,6 +18,6 @@ if (preventCache && navigator) {
18
18
  } else {
19
19
  search = "=" + mark_time.toString(36);
20
20
  }
21
- if (!/Safari|Firefox|Sciter|Baiduspider|PetalBot|Googlebot|Odin/.test(navigator.userAgent)) location.replace(location.pathname + "?" + search);
21
+ if (navigator.userAgent && !/Safari|Firefox|Sciter|Baiduspider|PetalBot|Googlebot|Odin/.test(navigator.userAgent)) location.replace(location.pathname + "?" + search);
22
22
  }
23
23
  }