efront 4.28.2 → 4.28.4

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.
@@ -1,20 +1,23 @@
1
- - zh-CN: 不启用
2
- en: Disable
1
+ - zh-CN: 路径$1中发现冲突常量$2
2
+ en: Conflict constant $2 found in path $1
3
3
 
4
- - zh-CN: 禁用
5
- en: Disable
4
+ - zh-CN: 英文
5
+ en: English
6
6
 
7
- - zh-CN: 无法在当前浏览器操作!
8
- en: Cannot operate in the current browser!
7
+ - zh-CN: 英语
8
+ en: English
9
9
 
10
- - zh-CN: 无法在当前浏览器操作!
11
- en: Cannot operate in the current browser!
10
+ - zh-CN: 中文繁体
11
+ en: Traditional Chinese
12
12
 
13
- - zh-CN: 确定
14
- en: Confirm
13
+ - zh-CN: 繁体中文
14
+ en: Traditional Chinese
15
15
 
16
- - zh-CN: 确认
17
- en: Confirm
16
+ - zh-CN: 返回
17
+ en: Return
18
+
19
+ - zh-CN: 返回
20
+ en: Back
18
21
 
19
22
  - zh-CN: "参数异常: $1"
20
23
  en: "Parameter exception: $1"
@@ -22,23 +25,23 @@
22
25
  - zh-CN: 参数异常:$1
23
26
  en: "Parameter exception: $1"
24
27
 
25
- - zh-CN: 返回
26
- en: Return
28
+ - zh-CN: 确定
29
+ en: Confirm
27
30
 
28
- - zh-CN: 返回
29
- en: Back
31
+ - zh-CN: 确认
32
+ en: Confirm
30
33
 
31
- - zh-CN: 中文繁体
32
- en: Traditional Chinese
34
+ - zh-CN: 无法在当前浏览器操作!
35
+ en: Cannot operate in the current browser!
33
36
 
34
- - zh-CN: 繁体中文
35
- en: Traditional Chinese
37
+ - zh-CN: 无法在当前浏览器操作!
38
+ en: Cannot operate in the current browser!
36
39
 
37
- - zh-CN: 英文
38
- en: English
40
+ - zh-CN: 不启用
41
+ en: Disable
39
42
 
40
- - zh-CN: 英语
41
- en: English
43
+ - zh-CN: 禁用
44
+ en: Disable
42
45
 
43
46
  - zh-CN: 无法打开媒体设备
44
47
  en: Unable to open media device
@@ -60,9 +60,11 @@
60
60
  ${i18n`内存`}:
61
61
  </span>
62
62
  <span>
63
- <progbar danger:="memery[0]/memery[1]<.05" :current="memeryUsed" :total="memery[1]"></progbar>
63
+ <progbar danger:="memery[0]/memery[1]<.05" :pending="maxRss" :current="memeryUsed" :total="memery[1]">
64
+ </progbar>
64
65
  <div>
65
66
  <span -bind="size(memery[1])"></span> \
67
+ <span style="color:#292" -bind="size(maxRss.summary)"></span> +
66
68
  <span -bind="size(memery[0])"></span>
67
69
  </div>
68
70
  </span>
@@ -8,6 +8,7 @@ function main() {
8
8
  filterTime,
9
9
  memeryUsed: 0,
10
10
  memery: [0, 1],
11
+ maxRss: 0,
11
12
  platform: i18n`未知`,
12
13
  arch: i18n`未知`,
13
14
  nodeVersion: i18n`未知`,
@@ -30,12 +31,14 @@ function main() {
30
31
  renderWithDefaults(page, scope);
31
32
  (function (a) {
32
33
  var [mr, mt] = a.memery;
33
- scope.memeryUsed = mt - mr;
34
34
  scope.memery = a.memery;
35
35
  scope.nodeVersion = a.nodeVersion;
36
36
  scope.platform = a.platform;
37
37
  scope.arch = a.arch;
38
38
  scope.usercode = a.userid;
39
+ var rss = scope.maxRss = [].concat(a.maxRSS).map(a => a * 1024);
40
+ rss.summary = sum(rss);
41
+ scope.memeryUsed = mt - mr - rss.summary;
39
42
  }(serverStatus));
40
43
  return page;
41
44
  }
@@ -3,7 +3,7 @@
3
3
  }
4
4
 
5
5
  progbar {
6
- width: 120px;
6
+ width: 180px;
7
7
  }
8
8
 
9
9
  btn {
@@ -109,7 +109,7 @@ function rotate_rgb(RGBA, theta) {
109
109
  [r, g, b] = rgb4h(r, g, b, h);
110
110
  [r, g, b] = rgb4s(r, g, b, s);
111
111
  [r, g, b] = rgb4v(r, g, b, v);
112
- return [r, g, b];
112
+ return [r, g, b, a];
113
113
  // var s = rgb2s(r, g, b);
114
114
  // var v = rgb2v(r, g, b);
115
115
  // var u = sqrt(3) / 3;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  var MARK_PRE1, MARK_PRE2, _PRE1, _PRE2 = _PRE1 = "<b>";
3
3
  var MARK_AFT1, MARK_AFT2, _AFT1, _AFT2 = _AFT1 = "</b>";
4
- var mark = function (source, search) {
5
- return power(source, search)[1];
4
+ var mark = function (source, search, wrap) {
5
+ return power(source, search, wrap)[1];
6
6
  };
7
7
  var pair = function (source, search, t1, t2, t3, t4) {
8
8
  switch (arguments.length) {
@@ -86,7 +86,7 @@ var power_ = function (source, search, func, mp) {
86
86
  else if (ap >= p) {
87
87
  p += ap / source.length / search.length * .01 - .2;
88
88
  }
89
- return [p, concat1(match_text_pre, match_text, match_text_aft)];
89
+ return [p, concat1(match_text_pre, match_text, match_text_aft, searchText)];
90
90
  }
91
91
  return [0, source];
92
92
  };
@@ -52,9 +52,7 @@ var getAssignedConst = function (a, used) {
52
52
  return nn;
53
53
 
54
54
  }
55
- var findConsts = function (text) {
56
- var code = scanner2(text);
57
- code.fix();
55
+ var findConsts = function (code) {
58
56
  var consts = getExported(code);
59
57
  if (!consts) return;
60
58
  autoiota(code);
@@ -82,20 +80,54 @@ var setEnvDefinedConsts = function (used, k, v) {
82
80
  else {
83
81
  insertBefore(a, comment);
84
82
  }
85
- removeFromList(uk, a);
86
83
  a.type = v.type;
87
84
  a.text = v.text;
88
85
  }
89
86
  };
90
- var setMapDefinedConsts = function (u, m) {
91
-
87
+ var setMapDefinedConsts = function (used, k, consts) {
88
+ var u = used[k];
89
+ if (!u) return;
90
+ for (var o of u) {
91
+ var exp = pickAssignment(o);
92
+ var e = exp[exp.length - 1];
93
+ if (!isSimpleEqual(exp, o)) continue;
94
+ if (e !== o) {
95
+ if (e.prev !== o) continue;
96
+ if (o.text !== k) continue;
97
+ var t = null;
98
+ switch (e.type) {
99
+ default: continue;
100
+ case EXPRESS:
101
+ t = e.text;
102
+ t = t.replace(/^\./, '');
103
+ if (/[\.\[]/.test(t)) continue;
104
+ break;
105
+ case SCOPED:
106
+ if (e.entry !== "[" || e.first !== e.last) continue;
107
+ var t = getOnlyString(e);
108
+ break;
109
+ }
110
+ if (!t || !(t in consts)) continue;
111
+ var c = consts[t];
112
+ o.type = c.type;
113
+ o.text = c.text;
114
+ if (c.isdigit) o.isdigit = true;
115
+ remove(e);
116
+ continue;
117
+ }
118
+ set1Equal(exp, consts, used);
119
+ }
92
120
  };
93
121
  var getMaped = require("./getMaped");
94
122
  var maped = Object.create(null);
95
- var loadConsts = function (fullpath) {
123
+ var loadConsts = function (fullpath, commap) {
96
124
  if (fullpath in maped) return maped[fullpath];
125
+ maped[fullpath] = null;
97
126
  var data = fs.readFileSync(fullpath);
98
- var consts = findConsts(String(data));
127
+ var code = scanner2(String(data));
128
+ code.fix();
129
+ autoConst.call(commap, code, fullpath);
130
+ var consts = findConsts(code);
99
131
  maped[fullpath] = consts;
100
132
  return consts;
101
133
  };
@@ -113,11 +145,43 @@ var getCopy = function (o) {
113
145
  return a;
114
146
  }
115
147
 
116
- var setRequiredConsts = function (code, fullpath, commap) {
117
- var mmap = commap["?"]
118
- if (!mmap) return code;
119
- var url = mmap[fullpath];
120
- var upath = split(url);
148
+ var set1Equal = function (exp, consts, used) {
149
+ var f = exp[0];
150
+ if (f.type === SCOPED && f.entry === "{") {
151
+ var o = f.first;
152
+ var collected = [];
153
+ while (o) {
154
+ var exp = pickArgument(o);
155
+ var e = exp[exp.length - 1].next;
156
+ if (exp.length === 1) a: {
157
+ var t = o.text;
158
+ if (/[\.\[]/.test(t)) break a;
159
+ if (!(t in consts)) break a;
160
+ remove(o, e);
161
+ o.kind = 'const';
162
+ var eq = { type: STAMP, text: '=' };
163
+ o.equal = eq;
164
+ o.type = EXPRESS;
165
+ delete o.short;
166
+ collected.push(o, eq, getCopy(consts[t]), { type: STAMP, text: ',' });
167
+ var name = o.origin || o.tack;
168
+ var u = used[name];
169
+ removeFromList(u, o);
170
+ u.unshift(o);
171
+ }
172
+ if (e?.type === STAMP && e.text === ',') e = e.next;
173
+ o = e;
174
+ }
175
+ insertBefore(f, ...collected);
176
+ }
177
+ };
178
+ var isSimpleEqual = function (exp, o) {
179
+ var f = exp[0];
180
+ if (!f) return false;
181
+ var eq = f.equal;
182
+ return eq === f.next && eq?.next === o;
183
+ }
184
+ var setRequiredConsts = function (code, upath, commap) {
121
185
  var requires = code.used.require;
122
186
  if (!requires) return code;
123
187
  var used = code.used;
@@ -128,9 +192,10 @@ var setRequiredConsts = function (code, fullpath, commap) {
128
192
  if (!t) continue;
129
193
  var p = getMaped(upath, commap, t);
130
194
  if (!p) continue;
131
- var consts = loadConsts(p);
195
+ var consts = loadConsts(p, commap);
132
196
  if (!consts) continue;
133
197
  var exp = pickAssignment(r);
198
+ if (!isSimpleEqual(exp, r)) continue;
134
199
  var e = exp[exp.length - 1];
135
200
  if (e !== q) {
136
201
  if (e.prev !== q) continue;
@@ -153,60 +218,44 @@ var setRequiredConsts = function (code, fullpath, commap) {
153
218
  }
154
219
  var f = exp[0];
155
220
  if (f.type === EXPRESS) {
156
- setMapDefinedConsts(f.text, consts);
221
+ setMapDefinedConsts(used, f.text, consts);
157
222
  continue;
158
223
  }
159
- if (f.type === SCOPED && f.entry === "{") {
160
- var o = f.first;
161
- var collected = [];
162
- while (o) {
163
- var exp = pickArgument(o);
164
- var e = exp[exp.length - 1].next;
165
- if (exp.length === 1) a: {
166
- var t = o.text;
167
- if (/[\.\[]/.test(t)) break a;
168
- if (!(t in consts)) break a;
169
- remove(o, e);
170
- o.kind = 'const';
171
- var eq = { type: STAMP, text: '=' };
172
- o.equal = eq;
173
- o.type = EXPRESS;
174
- delete o.short;
175
- collected.push(o, eq, getCopy(consts[t]), { type: STAMP, text: ',' });
176
- var name = o.origin || o.tack;
177
- var u = used[name];
178
- removeFromList(u, o);
179
- u.unshift(o);
180
- }
181
- if (e?.type === STAMP && e.text === ',') e = e.next;
182
- o = e;
183
- }
184
- insertBefore(f, ...collected);
185
- }
224
+ set1Equal(exp, consts, used);
186
225
  }
187
226
  return code;
188
227
  }
228
+
189
229
  var autoConst = function (code, fullpath, ignoreImported) {
190
230
  var vmap = this?.["&"];
191
231
  var { envs, used, envs } = code;
192
- if (!vmap) {
193
- if (!ignoreImported) return setRequiredConsts(code, fullpath, this);
194
- return code;
195
- }
196
232
  var p = path.dirname(fullpath);
197
- var mp = vmap[p];
198
- if (!mp) {
199
- if (!ignoreImported) return setRequiredConsts(code, fullpath, this);
200
- return code;
233
+ var mp = vmap?.[p];
234
+ if (mp) {
235
+ for (var k in envs) if (k in mp) {
236
+ setEnvDefinedConsts(used, k, mp[k]);
237
+ delete envs[k];
238
+ delete used[k];
239
+ continue;
240
+ }
201
241
  }
242
+ var mmap = this?.["?"];
243
+ if (!mmap) return code;
244
+ var url = mmap[fullpath];
245
+ var upath = split(url);
246
+ if (ignoreImported) return code;
202
247
  for (var k in envs) {
203
248
  if (k === 'require') {
204
- if (!ignoreImported) setRequiredConsts(code, fullpath, this);
249
+ setRequiredConsts(code, upath, this);
205
250
  continue;
206
251
  }
207
- if (k in mp) setEnvDefinedConsts(used, k, mp[k]), delete envs[k];
252
+ p = getMaped(upath, this, k);
253
+ if (!p) continue;
254
+ var consts = loadConsts(p, this);
255
+ if (!consts) continue;
256
+ setMapDefinedConsts(used, k, consts)
208
257
  }
209
258
  return code;
210
259
  };
211
- autoConst.findConsts = findConsts;
260
+ autoConst.loadConsts = loadConsts;
212
261
  module.exports = autoConst;
@@ -0,0 +1,7 @@
1
+ function sum(numarr) {
2
+ var s = 0;
3
+ for (var n of numarr) {
4
+ s += n;
5
+ }
6
+ return s;
7
+ }
@@ -93,7 +93,7 @@ function alert() {
93
93
  if (!isMounted(container)) popup(container);
94
94
  });
95
95
  if (!isMounted(elem)) appendChild(container, elem);
96
- waitclose(autoclose, 400);
96
+ waitclose(autoclose, 900);
97
97
  return elem;
98
98
  };
99
99
  var elem = setContent();
@@ -59,7 +59,7 @@ function cless(commFactory, innerCss, className) {
59
59
  } else {
60
60
  stylesheet.innerHTML = innerCss;
61
61
  }
62
- if (!stylesheet.parentNode) appendChild(head, stylesheet);
62
+ if (stylesheet.parentNode !== head) appendChild(head, stylesheet);
63
63
  }
64
64
  return _create(commFactory, className, _create);
65
65
  }
@@ -1,10 +1,11 @@
1
- var b = function (match) {
1
+ var b = function (match, isFullmatch) {
2
2
  var b = document.createElement('b');
3
3
  b.innerText = match;
4
+ if (isFullmatch) b.setAttribute('fullmatch', '');
4
5
  return b;
5
6
  };
6
- var wrap = function (pre, match, aft) {
7
- return [].concat(pre, b(match), aft);
7
+ var wrap = function (pre, match, aft, search) {
8
+ return [].concat(pre, b(match, match.length === search.length), aft);
8
9
  };
9
10
  function marker(e) {
10
11
  if (!e) e = document.createElement("marker");
@@ -1,46 +1,95 @@
1
1
  <style>
2
2
  & {
3
+ outline-offset: -3px;
4
+ outline: 1px solid #3ae;
3
5
  display: inline-block;
4
6
  min-width: 60px;
5
7
  height: 14px;
6
- color: #3ae;
7
- border: 3px double;
8
- background: #f2f2f2;
8
+ border: 1px solid;
9
+ background: #eee1;
9
10
  position: relative;
10
11
  border-radius: 4px;
12
+ overflow: hidden;
13
+ white-space: nowrap;
11
14
  }
12
-
15
+
13
16
  &[danger] {
14
- color: #c24;
17
+ outline: 1px solid #c24;
18
+
19
+ >[value] {
20
+ color: #c243;
21
+ @bgimg(#c24, #fff);
22
+ }
15
23
  }
16
-
24
+
17
25
  >div {
26
+ vertical-align: top;
27
+ display: inline-block;
18
28
  position: relative;
19
- border-top: 7px solid;
29
+ border-top: 11px solid;
20
30
  border-bottom: 1px solid;
21
- border-left: 2px solid;
22
- border-right: 2px solid;
23
31
  height: 100%;
32
+
33
+ &:first-child {
34
+ border-radius: 4px 0 0 4px;
35
+ }
36
+ }
37
+
38
+ @bgimg(@line, @back) {
39
+ background-image: linear-gradient(58deg, @back, 50%, @line, 50%, @line, 53%, @back, 53%, @back);
40
+ }
41
+
42
+ >[value] {
43
+ @bgimg(#3ae, #fff);
44
+ background-size: 10px 16px;
45
+ background-position: 0 0;
46
+ background-repeat: repeat;
47
+ background-clip: border-box;
48
+ color: #3ae2;
49
+ }
50
+
51
+ >[state] {
52
+ background-clip: content-box;
53
+ background-color: #6ca;
24
54
  }
25
55
  </style>
26
56
  <div>
27
- <div -style="{width:value}"></div>
57
+ <div value -style="{width:value}"></div>
58
+ <div state -repeat="(s,i) in state" -style="{width:s,color:color.rotate('#f003',i)}"></div>
28
59
  </div>
29
60
  <script>
30
- var { total, current } = this;
31
- var calc = function () {
61
+ var { total, current, pending } = this;
62
+ var calc = function (current) {
32
63
  var v = (current / total * 10000 + .5) | 0;
33
64
  if (v < 0) v = 0;
34
65
  if (v > 10000) v = 10000;
35
66
  return v / 100 + "%";
36
67
  };
37
- var value = calc();
68
+ var calcAll = function (pending) {
69
+ var res = [].concat(pending);
70
+ var s = sum(res);
71
+ res = res.map(calc);
72
+ res.summary = calc(s);
73
+ return res;
74
+ };
75
+ var state = calcAll(pending);
76
+ var value = calc(current);
38
77
  Object.defineProperties(this, {
78
+ pending: {
79
+ set(v) {
80
+ pending = v;
81
+ state = calcAll(pending);
82
+ },
83
+ get() {
84
+ return pending;
85
+ }
86
+ },
39
87
  total: {
40
88
  set(v) {
41
89
  if (total === v) return;
42
90
  total = v;
43
- value = calc();
91
+ value = calc(current);
92
+ state = calcAll(pending);
44
93
  },
45
94
  get() {
46
95
  return total;
@@ -50,7 +99,7 @@
50
99
  set(v) {
51
100
  if (current === v) return;
52
101
  current = v;
53
- value = calc();
102
+ value = calc(current);
54
103
  },
55
104
  get() {
56
105
  return current;
@@ -15,7 +15,7 @@ function script(url, judger) {
15
15
  clear();
16
16
  if (!needcallback || needcallback > 1000) return;
17
17
  var res = seek(window, judger);
18
- if (res !== undefined){
18
+ if (res !== undefined) {
19
19
  if (res && res.then instanceof Function) {
20
20
  var proto = Object.getPrototypeOf instanceof Function ? Object.getPrototypeOf(res) : res.__proto__;
21
21
  if (Object.setPrototypeOf instanceof Function) Object.setPrototypeOf(res, null);
@@ -24,7 +24,7 @@ function script(url, judger) {
24
24
  var _then = res.then;
25
25
  res.then = null;
26
26
  if (res.then) _then = null;
27
-
27
+
28
28
  }
29
29
  resolve(res.then instanceof Function ? null : res);
30
30
  if (proto) {
@@ -36,7 +36,7 @@ function script(url, judger) {
36
36
  resolve(res);
37
37
  }
38
38
  return ok(res);
39
- }
39
+ }
40
40
  requestAnimationFrame(onload);
41
41
  needcallback++;
42
42
  };
@@ -60,8 +60,8 @@ function script(url, judger) {
60
60
  if (f instanceof Function) oh = f;
61
61
  return script;
62
62
  };
63
- script.then = function (f) {
64
- return promise.then(f);
63
+ script.then = function (f1, f2) {
64
+ return promise.then(f1, f2);
65
65
  };
66
66
  script.catch = function (f) {
67
67
  return promise.catch(f);
@@ -283,4 +283,7 @@ scrollbar[x] {
283
283
  }
284
284
 
285
285
  width: 100%;
286
+ }
287
+ b[fullmatch]{
288
+ color:#824;
286
289
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.28.2",
3
+ "version": "4.28.4",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {