efront 3.15.6 → 3.16.1

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,3 +1,4 @@
1
+ cross.addDirect(/^https?\:\/\/([[a-z\.\d\:\/%]+\]|[\d\.]+)(\:\d+)?\//);
1
2
  var fields = refilm`
2
3
  地址/ip
3
4
  地理位置/ip ${function (e) {
@@ -20,9 +21,37 @@ var fields = refilm`
20
21
  启动时间/time ${function (e) {
21
22
  e.innerHTML = filterTime(e.data[e.field.key]);
22
23
  }}
23
- 端口/port input
24
- 版本/version
25
- 进程/pid
24
+ 端口/port ${async function (e) {
25
+ var { data, field } = e;
26
+ var ports = data[field.key].split(/,/);
27
+ var loaded = [];
28
+ for (var p of ports) {
29
+ var p0 = p;
30
+ var protocol = /^https/.test(p) ? "https://" : "http://";
31
+ p = p.replace(/[^\d]+/g, '');
32
+ if (p) p = ":" + p;
33
+ try {
34
+ var ip = data.ip;
35
+ if (/^::ffff:\d+\.\d+\.\d+\.\d+$/i.test(ip)) {
36
+ ip = ip.slice(7);
37
+ }
38
+ else {
39
+ ip = `[${ip}]`;
40
+ }
41
+ var xhr = await cross("options", `${protocol}${ip}${p}/:version`);
42
+ if (xhr.responseText === 'efront ' + data.version) {
43
+ loaded.push(`<span style="color:green">${p0}</span>`);
44
+ } else {
45
+ loaded.push(`<span style="color:red">${p0}</span>`);
46
+ }
47
+ } catch (e) {
48
+ loaded.push(`<span style="color:gray">${p0}</span>`);
49
+ }
50
+ e.innerHTML = loaded.join('');
51
+ }
52
+ }}
53
+ 版本 / version text
54
+ 进程 / pid
26
55
  `;
27
56
  function main() {
28
57
  var page = div();
@@ -1,3 +1,4 @@
1
+ var isEmpty = require("./isEmpty");
1
2
  var convertReg = /^(?:object|function)$/;
2
3
  var check = function (o) {
3
4
  return o === null || typeof o === 'bigint' || o instanceof BigInt || typeof o === 'number' || typeof o === "boolean";
@@ -24,16 +25,28 @@ var join = function (o) {
24
25
  if (o instanceof RegExp) return regexp(o);
25
26
  var arr = o[""];
26
27
  delete o[""];
28
+ var typeid = o._;
29
+ delete o._;
27
30
  var pairs = [].concat(arr);
28
31
  for (var k in o) {
29
32
  pairs.push(k + ':' + o[k]);
30
33
  }
34
+ var s;
31
35
  if (o instanceof Array) {
32
- return `[${pairs.join(',')}]`;
36
+ s = `[${pairs.join(',')}]`;
37
+ }
38
+ else {
39
+ s = `{${pairs.join(',')}}`;
40
+ }
41
+ if (typeid > 0) s = typeid + s;
42
+ return s;
43
+ };
44
+ function stringify(memery, preload) {
45
+ if (!isEmpty(preload)) {
46
+ preload = [].concat(preload);
47
+ var i = preload.indexOf(memery) + 1;
48
+ if (i > 0) return i + ',';
33
49
  }
34
- return `{${pairs.join(',')}}`;
35
- }
36
- function stringify(memery) {
37
50
  if (memery === undefined) return '';
38
51
  if (check(memery)) return String(memery);
39
52
  if (typeof memery === 'symbol') return symbol(memery);
@@ -48,15 +61,23 @@ function stringify(memery) {
48
61
  var rest = [memery];
49
62
  var trimed = [memery instanceof Array ? [] : {}];
50
63
  var objects = [trimed[0]];
64
+ if (!isEmpty(preload)) dist = dist.concat(preload);
65
+ var preload_used = false;
51
66
  while (rest.length) {
52
67
  var memery = rest.shift();
53
68
  var o = objects.shift();
54
69
  var inc = 0, arr = [];
55
70
  o[""] = arr;
71
+ o._ = dist.indexOf(memery.constructor);
72
+ if (o._ > 0) preload_used = true;
56
73
  for (var k in memery) {
57
74
  var m = memery[k];
58
75
  f: if (typeof m === 'function') {
59
76
  for (var k in m) break f;
77
+ if (dist.indexOf(m) >= 0) {
78
+ preload_used = true;
79
+ break f;
80
+ }
60
81
  continue;
61
82
  }
62
83
  if (inc === +k && k !== '') {
@@ -101,7 +122,9 @@ function stringify(memery) {
101
122
  }
102
123
  }
103
124
  }
104
- return trimed.map(join).join(',');
125
+ var result = trimed.map(join).join(',');
126
+ if (trimed.length === 1 && preload_used) result += ',';
127
+ return result;
105
128
  }
106
129
  var create = function (a, dst) {
107
130
  if (!a) return;
@@ -117,9 +140,10 @@ var create = function (a, dst) {
117
140
  }
118
141
  dst[""] = rest;
119
142
  };
120
- function parse(string) {
143
+ function parse(string, preload) {
121
144
  string = String(string);
122
145
  var trimed = [];
146
+ var reg0 = /\d+/g;
123
147
  var reg1 = /\}/g;
124
148
  var reg2 = /\]/g;
125
149
  var reg3 = /\\[\s\S]|"/g;
@@ -130,6 +154,18 @@ function parse(string) {
130
154
  for (var cx = 0, dx = string.length; cx < dx; cx++) {
131
155
  var s = string.charAt(cx);
132
156
  var reg = null, o = null;
157
+ reg0.lastIndex = 0;
158
+ var typeid = 0;
159
+ var m = reg0.test(string.charAt(cx));
160
+ if (m) {
161
+ reg0.lastIndex = cx;
162
+ var m = reg0.exec(string);
163
+ if (/^[\[\{]$/.test(string.charAt(reg0.lastIndex))) {
164
+ typeid = +m[0];
165
+ cx = reg0.lastIndex;
166
+ s = string.charAt(reg0.lastIndex);
167
+ }
168
+ }
133
169
  switch (s) {
134
170
  case ",":
135
171
  trimed.push(undefined);
@@ -148,6 +184,15 @@ function parse(string) {
148
184
  marked.push(trimed.length);
149
185
  trimed.push(o);
150
186
  cx = reg.lastIndex;
187
+ if (typeid) {
188
+ o._ = typeid;
189
+ }
190
+ if (/\d/.test(string.charAt(cx))) {
191
+ reg4.lastIndex = cx;
192
+ var m = reg4.exec(string);
193
+ o._ = typeid || string.slice(cx, m.index);
194
+ cx = m.index;
195
+ }
151
196
  break;
152
197
  case "/":
153
198
  reg = reg5;
@@ -176,15 +221,11 @@ function parse(string) {
176
221
  }
177
222
  trimed.push(s);
178
223
  break;
179
- case "/":
180
- break;
181
224
  default:
182
- reg4.lastIndex = cx + 1;
225
+ reg4.lastIndex = cx;
183
226
  var match = reg4.exec(string);
184
227
  var index = match.index;
185
-
186
228
  var s = string.slice(cx, index);
187
- cx = index;
188
229
  switch (s) {
189
230
  case "null":
190
231
  s = null;
@@ -211,21 +252,30 @@ function parse(string) {
211
252
 
212
253
  }
213
254
  trimed.push(s);
255
+ cx = index;
214
256
  }
215
257
  }
216
- var dist = trimed.slice(0, trimed.length);
258
+ if (string.charAt(string.length - 1) === ',') trimed.push(undefined);
259
+ var dist = [trimed[0]];
260
+ if (!isEmpty(preload)) dist = dist.concat(preload);
261
+ var preloads_length = dist.length - 1;
262
+ dist = dist.concat(trimed.slice(1, trimed.length));
217
263
  for (var cx = 0, dx = marked.length; cx < dx; cx++) {
218
264
  var index = marked[cx];
219
265
  var o = trimed[index];
220
- dist[index] = o instanceof Array ? [] : {};
266
+ if (index > 0) index += preloads_length;
267
+ if (o._ > 0) dist[index] = Object.create(dist[o._].prototype);
268
+ else dist[index] = o instanceof Array ? [] : {};
221
269
  }
222
270
  for (var cx = 0, dx = marked.length; cx < dx; cx++) {
223
271
  var index = marked[cx];
224
272
  var o = trimed[index];
273
+ if (index > 0) index += preloads_length;
225
274
  var t = dist[index];
226
275
  var arr = o[""];
227
276
  delete o[""];
228
- for (var k in arr) {
277
+ delete o._;
278
+ if (arr) for (var k in arr) {
229
279
  t[k] = dist[arr[k]];
230
280
  }
231
281
  for (var k in o) {
@@ -233,14 +283,17 @@ function parse(string) {
233
283
  t[dist[k]] = dist[v];
234
284
  }
235
285
  }
286
+ if (trimed.length > 1 && typeof trimed[0] === 'number') {
287
+ return dist[trimed[0]];
288
+ }
236
289
  return dist[0];
237
290
  }
238
291
  module.exports = {
239
292
  stringify,
240
- parse(data) {
241
- if (!/^\s*([\[\{]|\[\s*\]|\{\s*\})/.test(data)) return parse(data);
242
- if (/^\s*\{[\d\,\:\s]*\}\s*,/.test(data)) return parse(data);
243
- if (/^\s*\[[\d\,\:\s]*\]\s*,/.test(data)) return parse(data);
244
- return JSON.parse(data);
293
+ parse(data, preload) {
294
+ if (!/^\s*([\[\{]|\[\s*\]|\{\s*\})$/.test(data)) return parse(data, preload);
295
+ if (/^\s*\{[\d\,\:\s]*\}\s*,/.test(data)) return parse(data, preload);
296
+ if (/^\s*\[[\d\,\:\s]*\]\s*,/.test(data)) return parse(data, preload);
297
+ return JSON.parse(data, preload);
245
298
  }
246
299
  };
@@ -114,7 +114,7 @@ function cross_(jsonp, digest = noop, method, url, headers) {
114
114
  else {
115
115
  var nocross = notCross(url);
116
116
  var callback = function () {
117
- var exposeHeaders = xhr.getResponseHeader("access-control-expose-headers");
117
+ var exposeHeaders = !nocross && xhr.getResponseHeader("access-control-expose-headers");
118
118
  var exposeMap = {};
119
119
  if (exposeHeaders) exposeHeaders.split(",").forEach(h => exposeMap[h.toLowerCase()] = true);
120
120
  if (xhr.getResponseHeader) {
@@ -230,7 +230,7 @@ var killCircle = function () {
230
230
  var hasOwnProperty = {}.hasOwnProperty;
231
231
  var loadModule = function (name, then, prebuilds = {}) {
232
232
  if (/^(?:module|exports|define|require|window|global|undefined|__dirname|__filename)$/.test(name)) return then();
233
- if ((name in prebuilds) || hasOwnProperty.call(modules, name) || (window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name))
233
+ if ((name in prebuilds) || hasOwnProperty.call(modules, name) || (!/^on/.test(name) && window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name))
234
234
  ) return then();
235
235
  preLoad(name);
236
236
  var key = keyprefix + name;
@@ -545,7 +545,7 @@ var init = function (name, then, prebuilds) {
545
545
  if (then) then(modules[name]);
546
546
  return modules[name];
547
547
  }
548
- if (window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name)) {
548
+ if (!/^on/.test(name) && window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name)) {
549
549
  modules[name] = window[name]
550
550
  if (then) then(modules[name]);
551
551
  return modules[name];
@@ -32,9 +32,9 @@
32
32
  // end
33
33
  // end
34
34
  "use strict";
35
-
36
35
  var notMatchLength = new Error("矩阵长度不一致");
37
- function transform(dots, B) {
36
+
37
+ function transform(B, dots) {
38
38
  var dimention = Math.sqrt(B.length - 1) | 0;
39
39
  if (dots.length % dimention !== 0) throw notMatchLength;
40
40
  if (dots === B) B = B.slice(0);
@@ -43,10 +43,11 @@ function transform(dots, B) {
43
43
  for (var cx = 0, dx = dots.length; cx < dx; cx += dimention) {
44
44
  for (var cy = 0, dy = dimention; cy < dy; cy++) {
45
45
  var sum = 0;
46
+ var start = dim2 * cy;
46
47
  for (var ct = 0, dt = dimention; ct < dt; ct++) {
47
- sum += ds[cx + ct] * B[ct * dim2 + cy];
48
+ sum += ds[cx + ct] * B[start + ct];
48
49
  }
49
- sum += B[dimention * dim2 + cy];
50
+ sum += B[start + dimention];
50
51
  dots[cx + cy] = sum;
51
52
  }
52
53
  }
@@ -56,13 +57,12 @@ function transform(dots, B) {
56
57
  function translate(A, delta) {
57
58
  var [dim2, dim] = size(A);
58
59
  var inc = 0;
59
- for (var cx = dim * dim2, dx = cx + dim; cx < dx; cx++) {
60
+ for (var cx = dim, dx = dim * dim2; cx < dx; cx += dim2) {
60
61
  A[cx] = (A[cx] || 0) + delta[inc++];
61
62
  }
62
63
  return A;
63
64
  }
64
65
 
65
-
66
66
  function 负(a) {
67
67
  return -a;
68
68
  }
@@ -76,7 +76,7 @@ function multiply(A, B) {
76
76
  for (var cy = 0, dy = dim; cy < dy; cy++) {
77
77
  var sum = 0;
78
78
  for (var ct = 0, dt = dim; ct < dt; ct++) {
79
- sum += X[cx + ct] * B[ct * dim + cy];
79
+ sum += B[cx + ct] * X[ct * dim + cy];
80
80
  }
81
81
  A[cx + cy] = sum;
82
82
  }
@@ -132,15 +132,17 @@ function olinde(v, vector) {
132
132
  }
133
133
  return v;
134
134
  }
135
+
135
136
  function matrix2d(theta) {
136
137
  var cosa = Math.cos(theta);
137
138
  var sina = Math.sin(theta);
138
139
  return new Matrix(
139
- cosa, sina, 0,
140
- -sina, cosa, 0,
140
+ cosa, -sina, 0,
141
+ sina, cosa, 0,
141
142
  0, 0, 1
142
143
  );
143
- };
144
+ }
145
+
144
146
  function matrix3d(factor) {
145
147
  var theta = norm(factor);
146
148
  var vec = times(factor, 1 / theta);
@@ -150,9 +152,9 @@ function matrix3d(factor) {
150
152
  var [x_u, y_u, z_u] = factor ? [0, 0, 1] : vec;
151
153
 
152
154
  return new Matrix(
153
- cosa + x_u * x_u * vera, x_u * y_u * vera - z_u * sina, x_u * z_u * vera + y_u * sina, 0,
154
- x_u * y_u * vera + z_u * sina, cosa + y_u * y_u * vera, y_u * z_u * vera - x_u * sina, 0,
155
- x_u * z_u * vera - y_u * sina, y_u * z_u * vera + x_u * sina, cosa + z_u * z_u * vera, 0,
155
+ cosa + x_u * x_u * vera, x_u * y_u * vera + z_u * sina, x_u * z_u * vera - y_u * sina, 0,
156
+ x_u * y_u * vera - z_u * sina, cosa + y_u * y_u * vera, y_u * z_u * vera + x_u * sina, 0,
157
+ x_u * z_u * vera + y_u * sina, y_u * z_u * vera - x_u * sina, cosa + z_u * z_u * vera, 0,
156
158
  0, 0, 0, 1
157
159
  );
158
160
  }
@@ -173,42 +175,47 @@ var 逆 = function (A) {
173
175
  A.push.apply(A, E);
174
176
  for (var cx = 0, dx = dim; cx < dx; cx++) {
175
177
  var start = cx * dim + cx;
176
- for (var ct = start, dt = X.length; ct < dt; ct += dim) {
177
- if (X[ct] !== 0) break;
178
+ var max_ct, v = 0;
179
+ for (var ct = start, dt = cx * dim + dim; ct < dt; ct++) {
180
+ var v0 = Math.abs(X[ct]);
181
+ if (v0 > v) {
182
+ max_ct = ct;
183
+ v = v0;
184
+ }
178
185
  }
186
+ ct = max_ct;
179
187
  if (ct !== start) {
180
188
  var delta = ct - start;
181
- var ratio = 1 / X[ct];
182
- for (var cy = cx * dim, dy = cy + dim; cy < dy; cy++) {
189
+ var ratio = (1 - X[start]) / X[ct];
190
+ for (var cy = cx, dy = X.length; cy < dy; cy += dim) {
183
191
  X[cy] += X[cy + delta] * ratio;
184
192
  A[cy] += A[cy + delta] * ratio;
185
193
  }
186
194
  }
187
195
  if (X[start] !== 1) {
188
- var delta = ct - start;
189
196
  var ratio = 1 / X[start];
190
- for (var cy = cx * dim, dy = cy + dim; cy < dy; cy++) {
197
+ for (var cy = cx, dy = X.length; cy < dy; cy += dim) {
191
198
  X[cy] *= ratio;
192
199
  A[cy] *= ratio;
193
200
  }
194
201
  }
195
- for (var ct = start + dim, dt = X.length; ct < dt; ct += dim) {
202
+ for (var ct = start + 1, dt = start + dim - cx; ct < dt; ct++) {
196
203
  if (X[ct] === 0) continue;
197
204
  var ratio = -X[ct];
198
205
  var delta = start - ct;
199
- for (var cy = ct - cx, dy = cy + dim; cy < dy; cy++) {
206
+ for (var cy = cx + ct - start, dy = X.length; cy < dy; cy += dim) {
200
207
  X[cy] += X[cy + delta] * ratio;
201
208
  A[cy] += A[cy + delta] * ratio;
202
209
  }
203
210
  }
204
211
  }
205
- for (var cx = dim - 2; cx >= 0; cx--) {
206
- var start = cx * dim + cx + 1;
207
- for (var ct = start; ct >= 0; ct -= dim) {
212
+ for (var cx = dim - 1; cx >= 0; cx--) {
213
+ var start = cx * dim + cx;
214
+ for (var ct = start - 1, dt = start - cx; ct >= dt; ct--) {
208
215
  if (X[ct] === 0) continue;
209
216
  var ratio = -X[ct];
210
- var delta = dim + start - ct;
211
- for (var cy = cx * dim, dy = cy + dim; cy < dy; cy++) {
217
+ var delta = start - ct;
218
+ for (var cy = cx + ct - start, dy = X.length; cy < dy; cy += dim) {
212
219
  X[cy] += X[cy + delta] * ratio;
213
220
  A[cy] += A[cy + delta] * ratio;
214
221
  }
@@ -245,6 +252,19 @@ class Matrix extends Array {
245
252
  if (this._invert) return this._invert;
246
253
  return this._invert = this.slice().inverse();
247
254
  }
255
+ transpose() {
256
+ var [size] = this.size();
257
+ for (var cx = 0, dx = size; cx < dx; cx++) {
258
+ for (var cy = cx + 1, dy = dx; cy < dy; cy++) {
259
+ var i = cx * size + cy;
260
+ var j = cy * size + cx;
261
+ var tmp = this[i];
262
+ this[i] = this[j];
263
+ this[j] = tmp;
264
+ }
265
+ }
266
+ return this;
267
+ }
248
268
  inverse() {
249
269
  this.dirty();
250
270
  return 逆(this);
@@ -276,8 +296,11 @@ class Matrix extends Array {
276
296
  return multiply(this, a);
277
297
  }
278
298
  transform(dots) {
279
- if (dots instanceof Array) return transform(dots, this);
280
- if (isFinite(dots)) return dots * this[this.length - 1];
299
+ if (dots instanceof Array) return transform(this, dots);
300
+ if (arguments.length > 1) {
301
+ var a = Array.prototype.slice.apply(arguments, 0);
302
+ return transform(this, a);
303
+ }
281
304
  return dots;
282
305
  }
283
306
  }
@@ -119,7 +119,7 @@ var scan = function (text) {
119
119
  }
120
120
 
121
121
  if (/^\-(\s|$)/.test(row)) {
122
- if (data || span >= spacesize) push();
122
+ if (data || span && span >= spacesize) push();
123
123
  if (!parents[spacesize]) {
124
124
  var obj = [];
125
125
  push(obj);
@@ -11,8 +11,8 @@ function createSeek(express) {
11
11
  return dist;
12
12
  }
13
13
  function main(express) {
14
- if (!/\?\s*\.(?=[^\d])/.test(express)) return express;
15
- var reg = /\\[\s\S]|\?\s*(\.(?!\d))|[\:\,\+\=\-\!%\^\|\/\&\*\!\;\?\>\<~\{\}\[\]\(\)'"`\s]/g;
14
+ if (!/\?\s*\.(?=[^\d])|\?$/.test(express)) return express;
15
+ var reg = /\\[\s\S]|\?\s*(\.(?!\d)|\s*$)|[\:\,\+\=\-\!%\^\|\/\&\*\!\;\?\>\<~\{\}\[\]\(\)'"`\s]/g;
16
16
  var cache = [], queue = [];
17
17
  var exp = [];
18
18
  var instr = false;
@@ -81,7 +81,7 @@ function main(express) {
81
81
  add_exp(str);
82
82
  }
83
83
  lastIndex = match.index + m.length;
84
- if (match[1]) {
84
+ if (match[1] !== undefined) {
85
85
  exp.push(match[1]);
86
86
  }
87
87
  else if (/[\[\{\(]/.test(m)) {
@@ -3,6 +3,50 @@
3
3
  var menuid = 0;
4
4
  var savedChildren = Object.create(null);
5
5
  var savedMenus = Object.create(null);
6
+ var keymap = {};
7
+ var parseName = function (k) {
8
+ var icon, name, hotkey;
9
+ if (/(^|\s+)\./.test(k)) {
10
+ k = k.replace(/(?:^|\s+)\.([^\s,"'`]+)/, (_, m) => {
11
+ icon = m;
12
+ return '';
13
+ });
14
+ }
15
+ if (/(^|\s+)[\/\\]/.test(k)) {
16
+ k = k.replace(/(?:^|\s+)[\/\\]([\s\S]+)$/, (_, m) => {
17
+ hotkey = m;
18
+ return '';
19
+ });
20
+ }
21
+ if (/^(["'`])[\s\S]*\1/.test(k)) {
22
+ k = k.replace(/(['"`])[\s\S]\1/, (m) => {
23
+ name = strings.decode(m);
24
+ return '';
25
+ });
26
+ }
27
+ if (/,/.test(k)) {
28
+ var [k, ...roles] = k.split(',');
29
+ }
30
+ if (!icon && /\s+|\./.test(k)) {
31
+ [icon] = k.split(/\s+/);
32
+ k = k.slice(icon.length).trim();
33
+ }
34
+ if (!name) name = k;
35
+ var item = {};
36
+ if (icon) item.icon = icon.replace(/\./g, ' ');
37
+ if (name) item.name = name;
38
+ if (hotkey) {
39
+ hotkey = hotkey.split(',');
40
+ for (var k of hotkey) {
41
+ k = k.trim().toLowerCase().replace(/[\+\_\s]+/g, '.');
42
+ if (keymap[k]) console.warn("检查到两个项菜单使用了相同的快捷键", item, keymap[k]);
43
+ keymap[k] = item;
44
+ }
45
+ item.hotkey = hotkey;
46
+ }
47
+ if (roles) item.roles = roles;
48
+ return item;
49
+ }
6
50
  var getChildren = function (menu) {
7
51
  if (!menu.id) {
8
52
  menu.id = ++menuid;
@@ -52,29 +96,17 @@
52
96
 
53
97
  items = keys.map(k => {
54
98
  var c = items[k];
55
- var item = {};
99
+ var item = parseName(k);
56
100
  if (c instanceof Object) {
57
101
  item.children = parseMenuList(c);
58
102
  }
59
103
  else if (typeof c === 'string') {
60
104
  var [path, data] = c.split(/\?/);
105
+ if (data) data = data.trim();
61
106
  }
62
- var [icon] = k.split(/\s+/);
63
- if (icon.length < k.length) {
64
- item.icon = icon;
65
- var name = k.slice(icon.length).trim();
66
- } else name = k;
67
- if (/,/.test(name)) {
68
- var [name, ...roles] = name.split(',');
69
- }
70
- if (/^\-+$/.test(name)) item.line = true;
71
- else item.name = name;
72
- if (roles) item.roles = roles;
107
+ if (/^\-+$/.test(item.name)) item.line = true;
73
108
  if (path) item.path = path;
74
109
  if (data) item.params = parseKV(data);
75
- if (/,/.test(name)) {
76
-
77
- }
78
110
  item.closed = true;
79
111
  return item;
80
112
  });
@@ -85,7 +117,7 @@
85
117
  result.update = function (items) {
86
118
  delete result.loading_promise;
87
119
  delete result.then;
88
- items = parseMenuList(items);
120
+ items = result.parse(items);
89
121
  items.map(getChildren);
90
122
  var opened = data.getInstance("menu-opened");
91
123
  var historys = zimoli.getCurrentHistory();
@@ -198,7 +230,12 @@
198
230
  result.then = then;
199
231
  return result;
200
232
  };
201
- result.parse = parseMenuList;
233
+ result.parse = function (items) {
234
+ keymap = {};
235
+ items = parseMenuList(items);
236
+ items.keymap = keymap;
237
+ return items;
238
+ };
202
239
  var then = function (ok, oh) {
203
240
  if (this.loading_promise) {
204
241
  return this.loading_promise.then(ok, oh);
@@ -571,10 +571,8 @@ var privates = {
571
571
  headers = seekFromSource(headers, api.base);
572
572
  }
573
573
  cross(realmethod, uri, headers).send(params).done(e => {
574
- updateLoadingCount();
575
574
  ok(e.response || e.responseText);
576
575
  }).error(xhr => {
577
- updateLoadingCount();
578
576
  try {
579
577
  var e = getErrorMessage(parseData(xhr.response || xhr.responseText || xhr.statusText || xhr.status));
580
578
  oh({ status: xhr.status, api, params: params1, error: e, toString: getErrorMessage })
@@ -582,7 +580,6 @@ var privates = {
582
580
  oh(error);
583
581
  }
584
582
  });
585
- updateLoadingCount();
586
583
  });
587
584
  promise.search = search;
588
585
  promise.params = temp;
@@ -652,6 +649,7 @@ var getData = function () { return this.data };
652
649
  var updateLoadingCount = function () {
653
650
  data.loading_count = cross.requests.length;
654
651
  };
652
+ on('render')(window, updateLoadingCount, true);
655
653
  var data = {
656
654
  decodeStructure,
657
655
  encodeStructure,
@@ -883,12 +881,10 @@ var data = {
883
881
  headers = seekFromSource(headers, api.base);
884
882
  }
885
883
  instance.loading = cross(method, uri, headers).send(params).done(xhr => {
886
- updateLoadingCount();
887
884
  if (instance.loading !== xhr) return oh(aborted);
888
885
  instance.loading = null;
889
886
  ok(xhr.responseText || xhr.response);
890
887
  }).error(xhr => {
891
- updateLoadingCount();
892
888
  if (instance.loading !== xhr) return oh(aborted);
893
889
  instance.loading = null;
894
890
  try {
@@ -898,7 +894,6 @@ var data = {
898
894
  oh(error);
899
895
  }
900
896
  });
901
- updateLoadingCount();
902
897
  }).then(function (response) {
903
898
  return transpile(seekResponse(parseData(response), selector), api.transpile, api.root);
904
899
  });
@@ -8,6 +8,18 @@ var dispatch = "dispatchEvent" in document ? function dispatchEvent(target, even
8
8
  return target[fire] && target[fire](event);
9
9
  }
10
10
  };
11
+ /**
12
+ * @param {Event} e
13
+ */
14
+ function dispatch2(t, e) {
15
+ var on = 'on' + e.type;
16
+ var f = t[on];
17
+ var res = dispatch(t, e);
18
+ if (f && (t.nodeType !== 1 || t.constructor === window.HTMLUnknownElement)) {
19
+ return f.call(t, e) !== false;
20
+ }
21
+ return res;
22
+ }
11
23
  function main() {
12
24
  var target, event, value;
13
25
  for (var cx = 0, dx = arguments.length; cx < dx; cx++) {
@@ -27,7 +39,7 @@ function main() {
27
39
  event.value = arg;
28
40
  }
29
41
  }
30
- if (dispatch(target || window, event)) {
42
+ if (dispatch2(target || window, event)) {
31
43
  return event;
32
44
  };
33
45
  return false;
@@ -1,6 +1,6 @@
1
1
  var hasOwnProperty = {}.hasOwnProperty;
2
2
  function getValue(o = this) {
3
- if (!o) return o;
3
+ if (!isObject(o) && !isFunction(o)) return o;
4
4
  if (isFunction(o.getValue)) return o.getValue();
5
5
  if (hasOwnProperty.call(o, 'valueOf')) return o.valueOf();
6
6
  if ("key" in o) return o.key;