efront 3.35.0 → 3.35.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.
@@ -621,7 +621,9 @@ var init = function (name, then, prebuilds) {
621
621
  }, prebuilds);
622
622
  return res;
623
623
  };
624
- var forceRequest = {};
624
+ var forceRequest = {
625
+ Promise: true
626
+ };
625
627
  var removeGlobalProperty = function (property) {
626
628
  forceRequest[property] = true;
627
629
  };
@@ -853,6 +855,7 @@ var initIfNotDefined = function (defined, path, onload) {
853
855
 
854
856
  if (document) loadResponseTreeFromStorage();
855
857
  initIfNotDefined([].map, "[]map", map => map);
858
+ "use ../basic_/#checkPromise.js";
856
859
  initIfNotDefined(Promise, "Promise", promise => Promise = promise);
857
860
  // <!-- window.modules = modules; -->
858
861
  var onload = function () {
@@ -169,7 +169,7 @@ class Tree extends Array {
169
169
  for (var data of datas) {
170
170
  if (isObject(data) || isString(data)) {
171
171
  var item;
172
- if (data instanceof Item) {
172
+ if (data.constructor === Item) {
173
173
  item = data;
174
174
  Tree.remove(item);
175
175
  }
@@ -3,7 +3,8 @@ function createSeek(express) {
3
3
  express.forEach(function (search) {
4
4
  if (dist) {
5
5
  if (/[\=]/.test(dist)) dist = `(${dist})`;
6
- dist = `typeof ${dist}!=='undefined'&&${dist}!==null?${dist}${search}:''`
6
+ var pd = /[\.\[]/.test(dist) ? `${dist}!==void 0` : `typeof ${dist}!=='undefined'`;
7
+ dist = `${pd}&&${dist}!==null?${dist}${search}:''`
7
8
  } else {
8
9
  dist = search;
9
10
  }
@@ -0,0 +1,9 @@
1
+ if (Promise) {
2
+ var SafePromise = void 0;
3
+ Promise.resolve({
4
+ then() {
5
+ SafePromise = Promise;
6
+ }
7
+ });
8
+ Promise = SafePromise;
9
+ }
@@ -1,9 +1,61 @@
1
- var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
2
- var hasOwnProperty = Object.prototype.hasOwnProperty;
3
- for (var p in proto) if (hasOwnProperty.call(proto, p) && !(p in obj)) obj[p] = proto[p];
4
- return obj;
1
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2
+ var setPrototypeOf = Object.setPrototypeOf;
3
+ a: if (!setPrototypeOf) {
4
+ var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
5
+ var getOwnPropertyNames = Object.getOwnPropertyNames;
6
+ var defineProperty = Object.defineProperty;
7
+ try {
8
+ defineProperty({}, 'o', { value: 0 });
9
+ setPrototypeOf = function (obj, proto) {
10
+ for (var n of getOwnPropertyNames(proto)) {
11
+ var d = getOwnPropertyDescriptor(proto, n);
12
+ defineProperty(obj, n, d);
13
+ }
14
+ return obj;
15
+ }
16
+ break a;
17
+ } catch (e) {
18
+ getOwnPropertyDescriptor = null;
19
+ defineProperty = null;
20
+ getOwnPropertyNames = null;
21
+ }
22
+ // <!--
23
+ console.error('当前运行环境使用class extends Array会有难以解决的不兼容性问题,请更换代码的实现方式!');
24
+ // -->
25
+ setPrototypeOf = function (obj, proto) {
26
+ for (var p in proto) if (hasOwnProperty.call(proto, p) && !(p in obj)) obj[p] = proto[p];
27
+ obj.constructor = proto.constructor;
28
+ return obj;
29
+ }
5
30
  }
31
+ var wrapMethod = method => function () {
32
+ var res = method.apply(this, arguments);
33
+ var res0 = this.constructor.apply(this, []);
34
+ res0.length = res.length;
35
+ for (var k in res) {
36
+ k = +k;
37
+ if ((k & 0x7fffffff) !== k) break;
38
+ res0[k] = res[k];
39
+ }
40
+ return res0;
41
+ };
42
+ var map = wrapMethod([].map);
43
+ var slice = wrapMethod([].slice);
44
+ var filter = wrapMethod([].filter);
45
+ var splice = wrapMethod([].splice);
46
+ var concat = wrapMethod([].concat);
47
+
6
48
  function Array2() {
7
- return setPrototypeOf(Array.apply(this, arguments), this.constructor.prototype);
49
+ var proto = this.constructor.prototype;
50
+ /**
51
+ * @type {PropertyDescriptor}
52
+ */
53
+ if (!hasOwnProperty.call(proto, 'map')) proto.map = map;
54
+ if (!hasOwnProperty.call(proto, 'slice')) proto.slice = slice;
55
+ if (!hasOwnProperty.call(proto, 'filter')) proto.filter = filter;
56
+ if (!hasOwnProperty.call(proto, 'splice')) proto.splice = splice;
57
+ if (!hasOwnProperty.call(proto, 'concat')) proto.concat = concat;
58
+ var obj = setPrototypeOf(Array.apply(this, arguments), proto);
59
+ return obj;
8
60
  }
9
61
  Array2.prototype = Array.prototype;
@@ -3,14 +3,14 @@ var Array = window.Array;
3
3
  var setTimeout = window.setTimeout;
4
4
  var Function = window.Function;
5
5
  var console = window.console;
6
- var Error = window.Error;
6
+ var navigator = window.navigator;
7
7
  var requestAnimationFrame = window.setImmediate || window.setTimeout;
8
8
  var isFunction = function (f) {
9
9
  return typeof f === "function";
10
10
  };
11
- if (window.Promise) {
12
- var Promise = window.Promise;
13
- } else {
11
+ var Promise = window.Promise;
12
+ "use ./#checkPromise.js";
13
+ if (!Promise) {
14
14
  var isThenable = function (pendding) {
15
15
  return pendding instanceof Promise || pendding && isFunction(pendding.then);
16
16
  };
@@ -93,7 +93,7 @@ if (window.Promise) {
93
93
  if (this.oked || this.ohed) fire(this);
94
94
  return promise;
95
95
  },
96
- catch(f) {
96
+ "catch"(f) {
97
97
  return this.then(null, f);
98
98
  },
99
99
  }
@@ -18,6 +18,7 @@ const {
18
18
  createString,
19
19
  getDeclared,
20
20
  createScoped,
21
+ snapExpressHead,
21
22
  relink,
22
23
  skipAssignment,
23
24
  } = require("./common");
@@ -180,8 +181,13 @@ var isShortMethodEnd = function (o) {
180
181
  };
181
182
 
182
183
  Javascript.prototype.setType = function (o) {
183
- this.fixType(o);
184
184
  var last = o.prev;
185
+ if (o.type === EXPRESS && /^\.[^\.]/.test(o.text) && last.type === STAMP && last.text === "?") {
186
+ last = o.prev = snapExpressHead(last.prev);
187
+ last.type = EXPRESS;
188
+ return false;
189
+ }
190
+ this.fixType(o);
185
191
  var queue = o.queue;
186
192
  if (queue.isObject || queue.isClass) {
187
193
  if (o.type & (VALUE | QUOTED | STRAP)) {
@@ -282,13 +288,32 @@ var collectProperty = function (o, text) {
282
288
  q.defined[text] = o;
283
289
  };
284
290
 
291
+ var replace = function (o, ...args) {
292
+ var queue = o.queue;
293
+ var i = queue.indexOf(o);
294
+ if (i >= 0) queue.splice(i, 1, ...args);
295
+ var prev = o.prev;
296
+ var next = o.next;
297
+ if (!args.length) {
298
+ if (prev) prev.next = next;
299
+ else queue.first = next;
300
+ if (next) next.prev = prev;
301
+ else queue.last = prev;
302
+ }
303
+ else {
304
+ if (prev) prev.next = args[0], args[0].prev = prev;
305
+ else queue.first = args[0];
306
+ if (next) next.prev = args[args.length - 1], args[args.length - 1].next = next;
307
+ else queue.last = args[args.length - 1];
308
+ }
309
+ return args.length ? args[0] : next;
310
+ };
285
311
  var hasComma = function (c) {
286
312
  for (var cc of c) {
287
313
  if (cc.type === STAMP && cc.text === ',') return true;
288
314
  }
289
315
  return false;
290
316
  }
291
-
292
317
  var removeQoute = function (o, c, i) {
293
318
  if (hasComma(c)) return;
294
319
  if (!isFinite(i)) i = o.indexOf(c);
@@ -309,13 +334,21 @@ Javascript.prototype.detour = function detour(o, ie) {
309
334
  this.detour(o.first, ie);
310
335
  break;
311
336
  case EXPRESS:
337
+ var text = o.text.replace(/^\.\.\./, '');
338
+ var hasdot = o.text.length !== text.length;
312
339
  if (avoidMap) {
313
- var m = /^[^\.\[\]]+/.exec(o.text.replace(/^\.\.\./, ''));
340
+ var m = /^[^\.\[\]]+/.exec(o.text);
314
341
  if (m) { avoidMap[m[0]] = true; }
315
342
  }
316
- if (!/^\.\.\.|\.\.\.$/.test(o.text)) {
317
- o.text = o.text.replace(/\.([^\.\[]+)/g, (_, a) => ie === undefined || this.strap_reg.test(a) ? `[${strings.recode(a)}]` : _);
343
+ if (/\?\./.test(text)) {
344
+ text = renderExpress(text);
345
+ if (hasdot) text = "..." + text;
346
+ o = replace(o, ...scan(text));
347
+ continue;
318
348
  }
349
+ text = text.replace(/\.([^\.\[\!\=\:]+)/g, (_, a) => ie === undefined || this.strap_reg.test(a) ? `[${strings.recode(a)}]` : _);
350
+ if (hasdot) text = "..." + text;
351
+ o.text = text;
319
352
  break;
320
353
  case QUOTED:
321
354
  if (o.length) {
@@ -94,7 +94,33 @@ var stringsFromRegExp = function (reg) {
94
94
  var res = combine(...queue).map(a => a.join(""));
95
95
  return res;
96
96
  }
97
-
97
+ var supportUnicodeRegExp = false;
98
+ var spaceDefined = [
99
+ "\\u0002",
100
+ "\\b-\\r",// "\\b"/*8*/, "\\t"/*9*/, "\\n"/*10*/, "\\v"/*11*/, "\\f"/*12*/, "\\r"/*13*/,
101
+ " "/*32*/,
102
+ "\\u007f", "\\u00a0", "\\u00ad", "\\u034f", "\\u061c",
103
+ "\\u115f", "\\u1160",
104
+ "\\u17b4", "\\u17b5",
105
+ "\\u180b-\\u180e",
106
+ "\\u1cbb", "\\u1cbc",
107
+ "\\u2000-\\u200f",
108
+ "\\u2028-\\u202f",
109
+ "\\u205f-\\u206f",
110
+ "\\u2800", "\\u3000", "\\u3164",
111
+ "\\ufe00-\\ufe0f",
112
+ "\\ufeff", "\\uffa0",
113
+ "\\ufff0-\\ufff8",
114
+ "\\u{133fc}",
115
+ "\\u{1d173}-\\u{1d17a}"
116
+ ]
117
+ try {
118
+ new RegExp('.', 'u');
119
+ supportUnicodeRegExp = true;
120
+ } catch (e) {
121
+ spaceDefined.pop();
122
+ spaceDefined.pop();
123
+ }
98
124
  class Program {
99
125
  quotes = [
100
126
  [/'/, /'/, /\\[\s\S]/],
@@ -126,29 +152,11 @@ class Program {
126
152
  classstrap_reg = /^(class)$/;
127
153
  extends_reg = /^(extends)$/;
128
154
  export_reg = /^(export)$/;
129
- spaces = [
130
- "\\u0002",
131
- "\\b-\\r",// "\\b"/*8*/, "\\t"/*9*/, "\\n"/*10*/, "\\v"/*11*/, "\\f"/*12*/, "\\r"/*13*/,
132
- " "/*32*/,
133
- "\\u007f", "\\u00a0", "\\u00ad", "\\u034f", "\\u061c",
134
- "\\u115f", "\\u1160",
135
- "\\u17b4", "\\u17b5",
136
- "\\u180b-\\u180e",
137
- "\\u1cbb", "\\u1cbc",
138
- "\\u2000-\\u200f",
139
- "\\u2028-\\u202f",
140
- "\\u205f-\\u206f",
141
- "\\u2800", "\\u3000", "\\u3164",
142
- "\\ufe00-\\ufe0f",
143
- "\\ufeff", "\\uffa0",
144
- "\\ufff0-\\ufff8",
145
- "\\u{133fc}",
146
- "\\u{1d173}-\\u{1d17a}"
147
- ]
155
+ spaces = spaceDefined;
148
156
  nocase = false
149
157
  lastIndex = 0
150
158
  compile(s) {
151
- return s.replace(/\\[\s\S]|[\[\]\(\)\{\}\+\.\-\*\?\$\^\|\\\/]/g, function (m) {
159
+ return s.replace(/\\[\s\S]|[\[\]\(\)\{\}\+\.\-\*\?\$\^\|\\\/ ]/g, function (m) {
152
160
  if (m.length > 1) {
153
161
  return m;
154
162
  }
@@ -177,7 +185,6 @@ class Program {
177
185
  var lasttype;
178
186
  var Code = this.Code;
179
187
  var queue = new Code();
180
- queue.__proto__ = Code.prototype;
181
188
  var origin = queue;
182
189
  var colonstrap_reg = this.colonstrap_reg;
183
190
  var forceend_reg = this.forceend_reg;
@@ -188,7 +195,9 @@ class Program {
188
195
  scope.prev = last;
189
196
  if (scope.type !== COMMENT && scope.type !== SPACE) {
190
197
  if (program.setType(scope) === false) {
191
- last = scope.prev;
198
+ if (queue.last !== last) last = queue.last;
199
+ else if (scope.prev !== last) last = scope.prev;
200
+ while (queue[queue.length - 1] !== last) queue.pop();
192
201
  last.end = scope.end;
193
202
  last.text = text.slice(last.start, last.end);
194
203
  return;
@@ -654,11 +663,12 @@ class Program {
654
663
  tokens = Object.keys(tokens).join("");
655
664
  tokens = this.compile(tokens) + spaces;
656
665
  var express = `[^${tokens}]+`;
657
- this.express_reg = new RegExp(`^${express}$`, 'u');
658
- this.space_reg = new RegExp(`^[${spaces}]+$`, 'u');
659
- this.space_exp = new RegExp(`[${spaces}]+`, 'u');
666
+ var flagUnicode = supportUnicodeRegExp ? 'u' : '';
667
+ this.express_reg = new RegExp(`^${express}$`, flagUnicode);
668
+ this.space_reg = new RegExp(`^[${spaces}]+$`, flagUnicode);
669
+ this.space_exp = new RegExp(`[${spaces}]+`, flagUnicode);
660
670
  var quotes = this.createRegExp(quoteslike.map(q => q[0]), true).source;
661
- this.entry_reg = new RegExp([`[${spaces}]+|${quotes}|[${scopes}]|${this.number_reg.source.replace(/^\^|\$$/g, "")}[^${tokens}]*|${express}|[${stamps}]`], "giu");
671
+ this.entry_reg = new RegExp([`[${spaces}]+|${quotes}|[${scopes}]|${this.number_reg.source.replace(/^\^|\$$/g, "")}[^${tokens}]*|${express}|[${stamps}]`], "gi" + flagUnicode);
662
672
  }
663
673
  }
664
674
  module.exports = Program;
@@ -237,7 +237,7 @@ var snapExpressHead = function (o) {
237
237
  while (o && o.prev) {
238
238
  var p = o.prev;
239
239
  if (p.type & (EXPRESS | VALUE)) {
240
- if (o.type === SCOPED && o.entry === '[' || o.type === EXPRESS && /^\./.test(o.text) || /\.$/.test(p.text) && !p.isdigit) {
240
+ if (o.type === SCOPED && o.entry === '[' || o.type === EXPRESS && /^\??\.[^\.]/.test(o.text) || /\.$/.test(p.text) && !p.isdigit) {
241
241
  o = p;
242
242
  continue;
243
243
  }
@@ -250,7 +250,7 @@ var snapExpressFoot = function (o) {
250
250
  if (!o || !(o.type & (EXPRESS | VALUE))) return;
251
251
  while (o && o.next) {
252
252
  var n = o.next;
253
- if (n.type === SCOPED && o.entry === '[' || /\.$/.test(o.text) && !o.isdigit || n.type === EXPRESS && /^\./.test(n.text)) {
253
+ if (n.type === SCOPED && o.entry === '[' || /\.$/.test(o.text) && !o.isdigit || n.type === EXPRESS && /^\??\.[^\.]/.test(n.text)) {
254
254
  if (n.type & (EXPRESS | SCOPED)) {
255
255
  o = n;
256
256
  continue;
@@ -4,8 +4,8 @@ function active(target, value, item = value, srcElem) {
4
4
  activeEvent.item = item;
5
5
  activeEvent.value = value;
6
6
  if (srcElem) {
7
- if (Object.defineProperty) Object.defineProperty(activeEvent, 'currentTarget', { value: srcElem });
8
- else activeEvent.currentTarget = srcElem;
7
+ if (Object.defineProperty) Object.defineProperty(activeEvent, 'active', { value: srcElem });
8
+ else activeEvent.active = srcElem;
9
9
  }
10
10
  activeEvent = dispatch(target, activeEvent);
11
11
  return activeEvent && !activeEvent.defaultPrevented;
@@ -1,7 +1,4 @@
1
1
  var slice = [].slice;
2
- var { appendChild: _appendChild, insertBefore: _insertBefore } = document.createElement('a');
3
- var isWorseIE = /msie\s+[2-8]/i.test(navigator.userAgent);
4
-
5
2
  function release(node) {
6
3
  if (node === null || node === undefined) return node;
7
4
  return isFunction(node) ? node() : isNode(node) ? node : document.createTextNode(node);
@@ -35,15 +32,7 @@ function appendChild(parent, obj, transition) {
35
32
  if (hasEnterStyle(o) && transition !== false) {
36
33
  isFunction(appendChild.transition) && appendChild.transition(o);
37
34
  }
38
- if (isWorseIE) {
39
- try {
40
- _appendChild.call(parent, o);
41
- } catch (e) {
42
- console.error("appendChild", parent.tagName, o.tagName);
43
- }
44
- } else {
45
- _appendChild.call(parent, o);
46
- }
35
+ parent.appendChild(o);
47
36
  o.with && appendChild(parent, o.with, transition);
48
37
  if (isMounted(parent)) _onappend(o);
49
38
  }
@@ -62,7 +51,7 @@ function insertBefore(alreadyMounted, obj, transition) {
62
51
  var o = release(children[cx]);
63
52
  if (!o) continue;
64
53
  if (o.removeTimer) clearTimeout(o.removeTimer);
65
- _insertBefore.call(parent, o, alreadyMounted);
54
+ parent.insertBefore(o, alreadyMounted);
66
55
  o.with && insertBefore(alreadyMounted, o.with, transition);
67
56
  if (isMounted(parent)) _onappend(o);
68
57
  if (hasEnterStyle(o) && transition !== false) {
@@ -82,7 +71,7 @@ function insertAfter(alreadyMounted, obj, transition) {
82
71
  for (var cx = 0, dx = children.length; cx < dx; cx++) {
83
72
  var o = release(children[cx]);
84
73
  if (o.removeTimer) clearTimeout(o.removeTimer);
85
- _insertBefore.call(parent, o, alreadyMounted.nextSibling);
74
+ parent.insertBefore(o, alreadyMounted.nextSibling);
86
75
  o.with && insertBefore(alreadyMounted.nextSibling, o.with, transition);
87
76
  if (isMounted(parent)) _onappend(o);
88
77
  if (hasEnterStyle(o) && transition !== false) {
@@ -108,4 +97,18 @@ appendChild.replace = function (alreadyMounted, element) {
108
97
  if (!alreadyMounted || !alreadyMounted.parentNode) return;
109
98
  insertBefore(alreadyMounted, element);
110
99
  remove(alreadyMounted);
100
+ };
101
+ var wrapTargetMethod = function (target, methodName) {
102
+ var method = target[methodName];
103
+ if (method.wrapped) return;
104
+ var newMethod = target[methodName] = function (node) {
105
+ var res = method.apply(this, arguments);
106
+ _onappend(node);
107
+ return res;
108
+ };
109
+ newMethod.wrapped = true;
110
+ };
111
+ appendChild.wrapTarget = function (target) {
112
+ wrapTargetMethod(target, 'insertBefore');
113
+ wrapTargetMethod(target, 'appendChild');
111
114
  };
@@ -40,6 +40,9 @@ var cross = cross_.bind(function (callback, onerror) {
40
40
  }
41
41
  break;
42
42
  default:
43
+ if (xhr.response === void 0) {
44
+ xhr.response = xhr.responseText;
45
+ }
43
46
  callback();
44
47
  }
45
48
  saveCookie();
@@ -129,13 +129,10 @@ var cssTargetSelector = function (targetSelector, oStyle, oValue) {
129
129
  var key = transformCssKey(oStyle);
130
130
  styleobject[key] = oValue;
131
131
  } else {
132
- oStyle.replace(/^;+|;+$/g, "").split(/;+/).map(function (kv) {
133
- var [k, v] = kv.split(":");
134
- delete styleobject[k];
135
- if (k) styleobject[k] = v || '';
136
- });
132
+ oStyle = parseKV(oStyle, ';', ':');
137
133
  }
138
- } else if (isObject(oStyle)) {
134
+ }
135
+ if (isObject(oStyle)) {
139
136
  for (var k in oStyle) {
140
137
  var key = transformCssKey(k);
141
138
  styleobject[key] = oStyle[k];
@@ -144,12 +141,12 @@ var cssTargetSelector = function (targetSelector, oStyle, oValue) {
144
141
  var rowStyles = [];
145
142
  var styleSheet = stylesheet.styleSheet;
146
143
  var cssText = stylesheet.savedText || (styleSheet ? styleSheet.cssText : stylesheet.innerHTML).replace(/^[\s\S]*?\{([\s\S]*?)\}[\s\S]*?$/, "$1");
147
- cssText.split(";").forEach(function (kv) {
148
- var k = kv.replace(/^(.*?)\:.*$/, "$1");
144
+ cssText.trim().split(/\s*;\s*/).forEach(function (kv) {
145
+ var k = kv.replace(/^(.*?)\s*\:.*$/, "$1");
149
146
  if (k && !(k in styleobject)) rowStyles.push(kv);
150
147
  });
151
148
  for (var k in styleobject) {
152
- if (styleobject[k]) {
149
+ if (!isEmpty(styleobject[k])) {
153
150
  rowStyles.push(k + ":" + transformValue(styleobject[k], k));
154
151
  }
155
152
  }
@@ -8,6 +8,7 @@ var dispatch = "dispatchEvent" in document ? function dispatchEvent(target, even
8
8
  return target[fire] && target[fire](event);
9
9
  }
10
10
  };
11
+ var isWorseEnv = /MSIE\s([2-9]|10)|Presto/.test(navigator.userAgent);
11
12
  /**
12
13
  * @param {Event} e
13
14
  */
@@ -15,7 +16,7 @@ function dispatch2(t, e) {
15
16
  var on = 'on' + e.type;
16
17
  var f = t[on];
17
18
  var res = dispatch(t, e);
18
- if (f && (t.nodeType !== 1 || t.constructor === window.HTMLUnknownElement)) {
19
+ if (f && (t.nodeType !== 1 || t.constructor === window.HTMLUnknownElement || isWorseEnv && !(on in t.constructor.prototype))) {
19
20
  return f.call(t, e) !== false;
20
21
  }
21
22
  return res;
@@ -308,7 +308,6 @@ function grid(breakpoints) {
308
308
  }
309
309
  class Point extends Array {
310
310
  constructor(value, range) {
311
- super();
312
311
  var solid = false;
313
312
  if (isObject(value)) {
314
313
  this.value = value.value;
@@ -334,7 +333,7 @@ var createPoints = function (values, direction = "x", result = new Point(0)) {
334
333
  if (!(values instanceof Array)) values = arguments;
335
334
  for (var cx = 0, dx = values.length; cx < dx; cx++) {
336
335
  var value = values[cx];
337
- if (value instanceof Array && !(value instanceof Point)) {
336
+ if (value instanceof Array && value.constructor !== Point) {
338
337
  if (!result.length) throw new Error("数据转换为grid失败!");
339
338
  createPoints(value, direction === "x" ? "y" : "x", result[result.length - 1]);
340
339
  } else {
@@ -581,20 +581,6 @@ var getGeneratorFromArray = function (source) {
581
581
  };
582
582
  };
583
583
 
584
-
585
- var _insertBefore = function (child, referer) {
586
- if (referer) {
587
- if (referer.parentNode !== this) throw new Error('关联节点不是当前节点的子节点!');
588
- appendChild.before(referer, child, false);
589
- } else {
590
- appendChild(this, child, false);
591
- }
592
- return child;
593
- };
594
- var _appendChild = function (child) {
595
- appendChild(this, child, false);
596
- return child;
597
- };
598
584
  /**
599
585
  *
600
586
  * @param {Boolean|Array|Function} generator
@@ -644,8 +630,7 @@ function list() {
644
630
  if (groupCount) groupCount = +groupCount[0];
645
631
  $Y = /^[xh]|[xh]$/i.test($Y) ? "X" : "Y";
646
632
  if (!container) container = document.createElement('list');
647
- container.insertBefore = _insertBefore;
648
- container.appendChild = _appendChild;
633
+ appendChild.wrapTarget(container);
649
634
  var list = ($Y === "X" ? xlist : ylist)(container, generator, $Y);
650
635
  if (!list.group) list.group = groupCount || 2;
651
636
  if (bindSrc instanceof Array) {
@@ -133,7 +133,6 @@ function main(elem, mode) {
133
133
  care(elem, function (src) {
134
134
  if (src) src = getTreeFromData(src);
135
135
  var hasIcon = src.hasIcon;
136
- JSON.stringify(src);
137
136
  elem.useIcon = hasIcon;
138
137
  elem.src = src;
139
138
  });
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var oncetree = {};
3
3
  function emit(ontype, target, handler, firstmost) {
4
- var off = ontype.call(this, target, function (event) {
4
+ var off = ontype(target, function (event) {
5
5
  off();
6
6
  return handler.call(this, event);
7
7
  }, firstmost);
@@ -648,7 +648,8 @@ var createEmiter = function (on) {
648
648
  digest();
649
649
  var parsedSrc = this.$src;
650
650
  if (parsedSrc instanceof Repeater) {
651
- var target = e.currentTarget === this ? e.target : e.currentTarget || e.target;
651
+ if (e.active || e.currentTarget) var target = e.active || e.currentTarget;
652
+ else var target = e.target;
652
653
  if (target === this) {
653
654
  scope = parsedSrc.createScope();
654
655
  }
@@ -61,7 +61,7 @@ function tree() {
61
61
  }
62
62
  var tabs = new Array(com.tab + 1).join("<t></t>");
63
63
  if (isFunction(generator)) {
64
- var elem = generator(index, com instanceof Item ? com.value : com, com);
64
+ var elem = generator(index, com.constructor === Item ? com.value : com, com);
65
65
  if (!elem) return;
66
66
  span = document.createElement('span');
67
67
  span.innerHTML = tabs;
@@ -2,9 +2,16 @@
2
2
 
3
3
  var fs = require("fs").promises;
4
4
  var path = require("path");
5
- var comm_file_reg = /\.([tj]sx?|xht|md)$/i;
5
+ var comm_file_reg = /\.([tj]sx?|xht|md|less)$/i;
6
+ var basepath = path.join(String(__efront), 'coms');
7
+ if (req.id) {
8
+ var compath = path.join(basepath, req.id);
9
+ if (!comm_file_reg.test(req.id) || !/^\.\./.test(path.relative(compath, basepath))) return forbidden("禁止访问");
10
+ return fs.readFile(compath);
11
+ }
12
+
6
13
  var readdir = async function (a) {
7
- var b = path.join(__efront, "coms", a);
14
+ var b = path.join(basepath, a);
8
15
  var names = await fs.readdir(b);
9
16
  names = names.filter(name => {
10
17
  if (/#/.test(name) || !comm_file_reg.test(name)) return false;
package/docs/index.html CHANGED
@@ -8,7 +8,7 @@
8
8
  <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
9
9
  <meta charset="utf-8" />
10
10
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
11
- <link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
11
+ <link rel="Shortcut Icon" href="favicon.ico" type="image/x-icon" />
12
12
  <meta name="viewport" content="initial-scale=1,maximum-scale=1,width=device-width" />
13
13
  <title>efront 文档</title>
14
14
  <style>
@@ -39,6 +39,8 @@
39
39
  </script>
40
40
  </head>
41
41
 
42
- <body scroll=no max-render=1440></body>
42
+ <body scroll=no max-render=1440>
43
+ 走过多少路口,听过多少叹息,我认真着你的不知所措..
44
+ </body>
43
45
 
44
46
  </html>