efront 3.0.9 → 3.2.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,35 +1,44 @@
1
+ // 1.如果time大于0,传的和函数会延迟time执行,如果期间有新的调用,前一个调用会被忽略
2
+ // 2.如果time小于0,传入的函数会立即执行,并忽略-time内的连续调用,time时间后触发最后一次调用
3
+ // 如果time传false或0 使用requestAnimationFrame代替setTimeout按第1步执行
4
+ // 如果time传null或undefined或NaN使用requestAnimationFrame代替setTimeout按第2步执行
1
5
  function lazy(run, time = false) {
2
- var fireing, args, that;
6
+ var wait = +time ? setTimeout : requestAnimationFrame;
7
+ var ing, args, that;
3
8
  var fire = function () {
4
- if (time > 17) {
5
- if (fireing === true) {
6
- fireing = setTimeout(fire, +time);
9
+ if (time >= 0) {
10
+ if (ing === true) {
11
+ ing = wait(fire, +time);
7
12
  }
8
- else if (isFinite(fireing)) {
9
- fireing = run.apply(that, args);
13
+ else if (isFinite(ing)) {
14
+ ing = run.apply(that, args);
10
15
  }
11
16
  else {
12
- fireing = false;
17
+ ing = false;
13
18
  }
14
- } else {
15
- if (fireing === true) {
16
- fireing = run.apply(that, args);
19
+ }
20
+ else {
21
+ if (ing === true) {
22
+ ing = run.apply(that, args);
23
+ wait(fire, -time);
24
+ if (!ing) ing = 1;
17
25
  } else {
18
- fireing = false;
26
+ ing = false;
19
27
  }
20
28
  }
21
- if (fireing instanceof Promise) fireing.then(fire, fire);
29
+ if (ing instanceof Promise) ing.then(fire, fire);
22
30
  };
23
31
  return function () {
24
32
  args = arguments;
25
33
  that = this;
26
- if (fireing) return fireing = true;
27
- if (time > 0) {
28
- fireing = setTimeout(fire, +time);
29
- } else {
30
- fireing = requestAnimationFrame(fire);
31
- if (time === false || time === 0) fireing = true;
32
- else run();
34
+ if (ing) return ing = true;
35
+ if (time >= 0) {
36
+ ing = wait(fire, +time);
37
+ }
38
+ else {
39
+ ing = run.apply(that, args);
40
+ if (ing instanceof Promise) ing.then(fire, fire);
41
+ ing = wait(fire, -time);
33
42
  }
34
43
  };
35
44
  }
@@ -36,7 +36,8 @@ if (PREVENT_FRAMEWORK_MODE !== false) {
36
36
  } catch (e) {
37
37
  document.write(message);
38
38
  top.location.reload();
39
- throw message;
39
+ console.error(message);
40
+ return;
40
41
  }
41
42
  }
42
43
  var _devicePixelRatio = devicePixelRatio;
@@ -23,7 +23,8 @@ var seek = function (object, seeker) {
23
23
  if (isObject(seeker)) {
24
24
  var dist = {};
25
25
  for (var k in seeker) {
26
- var o = seek(object, seeker[k]);
26
+ var { k: v = k } = seeker;
27
+ var o = seek(object, v);
27
28
  if (o === undefined) return;
28
29
  dist[k] = o;
29
30
  }
@@ -41,6 +41,21 @@ var trimStringLiteral = function (block) {
41
41
  if (block.type === block.regexp_quote_scanner) {
42
42
  return setMatchedConstRegExp(block_string);
43
43
  }
44
+ if (block.type === block.template_quote_scanner) {
45
+ var { start, end } = block;
46
+ if (block.children) {
47
+ var res = [];
48
+ for (var c of block.children) {
49
+ res.push(
50
+ module_string.slice(start, c.start),
51
+ trimStringLiteral(c)
52
+ );
53
+ start = c.end;
54
+ }
55
+ res.push(module_string.slice(start, end));
56
+ return res.join('');
57
+ }
58
+ }
44
59
  return block_string;
45
60
  };
46
61
  var paramsMap = Object.create(null);
@@ -158,7 +158,7 @@ function template_quote_scanner(index, blocks) {
158
158
  return this.length;
159
159
  }
160
160
  if (res[0] === "${") {
161
- index = block_code_scanner.call(this, res.index + 2, blocks) + 1;
161
+ index = block_code_scanner.call(this, res.index + 2, blocks);
162
162
  } else if (res[0].length === 1) {
163
163
  return res.index + 1;
164
164
  } else {
@@ -294,9 +294,9 @@ function single_comment_scanner2(index) {
294
294
  // }, count); //3354+
295
295
  // console.log(t1, t2);
296
296
  function block_code_scanner(index, blocks = []) {
297
- var save = (blocks instanceof Array) ? function (scanner) {
297
+ var save = (blocks instanceof Array) ? function (scanner, children) {
298
298
  if (saved_index < index) {
299
- blocks.push(new Block(scanner, saved_index, index));
299
+ blocks.push(new Block(scanner, saved_index, index, children));
300
300
  saved_index = index;
301
301
  }
302
302
  } : function () { };
@@ -374,8 +374,9 @@ function block_code_scanner(index, blocks = []) {
374
374
  break;
375
375
  case "`": // `
376
376
  save(block_code_scanner);
377
- index = template_quote_scanner.call(this, index);
378
- save(template_quote_scanner);
377
+ var children = [];
378
+ index = template_quote_scanner.call(this, index, children);
379
+ save(template_quote_scanner, children);
379
380
  break;
380
381
  case "'": // '
381
382
  save(block_code_scanner);
@@ -459,7 +460,7 @@ function block_code_scanner2(index, blocks) {
459
460
  break;
460
461
  case "`": // `
461
462
  save(block_code_scanner);
462
- index = template_quote_scanner.call(this, index);
463
+ index = template_quote_scanner.call(this, index, blocks);
463
464
  save(template_quote_scanner);
464
465
  break;
465
466
  case "'": // '
@@ -629,9 +630,10 @@ var scanner = module.exports = function (s) {
629
630
  // console.log(blocks.map(a => s.slice(a.start, a.end)).join())
630
631
  return blocks;
631
632
  };
632
- function Block(scanner, start, end) {
633
+ function Block(scanner, start, end, children) {
633
634
  this.type = scanner;
634
635
  this.start = start;
636
+ if (children) this.children = children;
635
637
  this.end = end;
636
638
  }
637
639
  Block.prototype = {
@@ -104,10 +104,10 @@ var skipAssignment = function (o) {
104
104
  }
105
105
  break;
106
106
  default:
107
+ console.log(o);
107
108
  throw new Error('代码结构异常!');
108
109
  o = o.next;
109
110
  }
110
- if (o === o0) throw new Error("代码结构异常!");
111
111
  return o;
112
112
  };
113
113
 
@@ -140,12 +140,12 @@ var needBreak = function (prev, next) {
140
140
  };
141
141
 
142
142
  var getDeclared = function (o, kind) {
143
-
144
143
  var declared = Object.create(null), used = Object.create(null); var skiped = [];
145
144
  loop: while (o) {
146
145
  while (o && o.type === STAMP && o.text === ',') o = o.next;
147
146
  if (!o) break;
148
147
  if (o.isprop) {
148
+ skiped.push(o);
149
149
  if (o.next && o.next.type === STAMP && o.next.text === ":") {
150
150
  o = o.next;
151
151
  o = o.next;
@@ -259,6 +259,23 @@ var compress = function (scoped, maped) {
259
259
 
260
260
  var strings = require("../basic/strings");
261
261
 
262
+ var insertAfter = function (o,) {
263
+ var queue = o.queue;
264
+ var index = queue.indexOf(o) + 1;
265
+ var os = [].slice.call(arguments, 1);
266
+ queue.splice.apply(queue, [index, 0].concat(os));
267
+ var prev = o, next = o.next;
268
+ for (var o of os) {
269
+ prev.next = o;
270
+ o.prev = prev;
271
+ prev = o;
272
+ }
273
+ if (next) {
274
+ o.next = next;
275
+ next.prev = o;
276
+ }
277
+ };
278
+
262
279
  var detour = function (o, ie) {
263
280
  while (o) {
264
281
  switch (o.type) {
@@ -277,17 +294,23 @@ var detour = function (o, ie) {
277
294
  }
278
295
  if (!o.isprop) break;
279
296
  case PROPERTY:
280
- if (/^(get|set|async)$/.test(o.text) && o.next && o.next.type === PROPERTY) break;
297
+ if (/^(get|set|async|static)$/.test(o.text) && o.next && (o.next.type === PROPERTY || o.next.isprop)) break;
298
+ if (o.text === 'static' && o.next && o.next.type === SCOPED && o.next.entry === '{') break;
281
299
  if (!ie || program.strap_reg.test(o.text)) {
282
- if (!/^\[/.test(o.text)) {
283
- o.text = `[${strings.encode(strings.decode(o.text))}]`;
300
+ if (!/^\[/.test(o.text) && o.queue.isObject) {
301
+ if (o.short) {
302
+ insertAfter(o, { text: ':', type: STAMP }, { text: o.text, type: EXPRESS, isExpress: true });
303
+ o.short = false;
304
+ }
305
+ var text = strings.encode(strings.decode(o.text));
306
+ o.text = ie ? text : `[${text}]`;
284
307
  }
285
308
  }
286
309
  break;
287
310
  }
288
311
  o = o.next;
289
312
  }
290
- }
313
+ };
291
314
 
292
315
  class Program extends Array {
293
316
  COMMENT = COMMENT
@@ -321,6 +344,16 @@ class Program extends Array {
321
344
  var lasttype;
322
345
  var result = [];
323
346
  var run = (o, i, a) => {
347
+ if (!~[SPACE, COMMENT, STAMP, PIECE].indexOf(o.type) && lasttype !== SPACE && !this.pressed) {
348
+ var prev = o.prev;
349
+ if (~[QUOTED, SCOPED, STRAP].indexOf(lasttype)
350
+ || prev && prev.type === STAMP && !/(\+\+|\-\-|~|!)$/.test(prev.text) && prev.prev && prev.prev.type !== STAMP) {
351
+ if (o.type !== EXPRESS || !/^\./.test(o.text)) {
352
+ result.push(" ");
353
+ lasttype = SPACE
354
+ }
355
+ }
356
+ }
324
357
  switch (o.type) {
325
358
  case COMMENT:
326
359
  // 每一次要远行,我都不得不对自己的物品去粗取精。取舍之间,什么重要,什么不是那么重要,都有了一道明显的分界线。
@@ -336,7 +369,6 @@ class Program extends Array {
336
369
  result.push(o.text);
337
370
  break;
338
371
  }
339
- if (!o.prev || !o.next) break;
340
372
  var b = needBreak(o.prev, o.next);
341
373
  if (b) result.push(b);
342
374
  break;
@@ -348,23 +380,31 @@ class Program extends Array {
348
380
  case SCOPED:
349
381
  if (!this.pressed && o.entry !== "[" && (lasttype === STRAP || lasttype === SCOPED) && o.type !== QUOTED) result.push(" ");
350
382
  result.push(o.entry);
351
- if (o.entry === "{" && result[0] && result[0].type !== SPACE) {
352
- if (!this.pressed) result.push(" ");
353
- }
354
- lasttype = undefined;
355
- o.forEach(run);
356
- if (o.leave === "}" && (!o.next || o.next.type !== PIECE) && o.length > 0 && o[o.length - 1].type !== SPACE) {
357
- result.push(" ");
383
+ if (o.length > 0) {
384
+ if (o.entry === "{" && result[0].type !== SPACE) {
385
+ if (!this.pressed) {
386
+ result.push(" ");
387
+ }
388
+ }
389
+ lasttype = undefined;
390
+ o.forEach(run);
391
+ if (/^[,;]$/.test(result[result.length - 1]) && this.pressed) {
392
+ if (!o.prev || o.prev.text !== 'for') result.pop();
393
+ }
394
+ if (o.leave === "}" && (!o.next || o.next.type !== PIECE) && o[o.length - 1].type !== SPACE) {
395
+ result.push(" ");
396
+ }
358
397
  }
359
398
  result.push(o.leave);
360
399
  break;
361
400
  default:
362
- if ([STRAP, EXPRESS, PROPERTY, VALUE].indexOf(lasttype) >= 0 && [STRAP, EXPRESS, PROPERTY, VALUE].indexOf(o.type) >= 0) result.push(" ");
363
401
  if (o instanceof Object) {
364
- // var broker = needBreak(o.prev, o);
365
- // if (broker) result.push(broker);
366
- if (o.prev && o.type === STAMP && !/^([,;])$/.test(o.text) && result[result.length - 1] !== " ") {
367
- if (lasttype === STAMP) {
402
+ if ([STRAP, EXPRESS, PROPERTY, VALUE].indexOf(lasttype) >= 0 && [STRAP, EXPRESS, PROPERTY, VALUE].indexOf(o.type) >= 0) {
403
+ result.push(" ");
404
+ }
405
+ else if (o.prev && o.type === STAMP && !/^([,;])$/.test(o.text)) {
406
+ if (result[result.length - 1] === " " || lasttype === PROPERTY && o.text === ':') { }
407
+ else if (lasttype === STAMP) {
368
408
  result.push(" ");
369
409
  }
370
410
  else if (/^(\+\+|\-\-)$/.test(o.prev.text) && o.prev.prev) {
@@ -375,13 +415,10 @@ class Program extends Array {
375
415
  || prev_prev.type === VALUE
376
416
  ) result.push(";");
377
417
  }
378
- else if (o.text !== ":" || o.prev.type !== STRAP && o.prev.prev && o.prev.prev.type !== STRAP) {
418
+ else if (!/^(\+\+|\-\-)$/.test(o.text)) {
379
419
  if (!this.pressed) result.push(" ");
380
420
  }
381
421
  }
382
- else if (lasttype === SCOPED && !~[SPACE, COMMENT, STAMP, PIECE].indexOf(o.type)) {
383
- if (!this.pressed) if (o.type !== EXPRESS || !/^\./.test(o.text)) result.push(" ");
384
- }
385
422
  result.push(o.text);
386
423
  }
387
424
  else {
@@ -389,6 +426,7 @@ class Program extends Array {
389
426
  }
390
427
  }
391
428
  lasttype = o.type;
429
+ if (o.isprop) lasttype = PROPERTY;
392
430
  };
393
431
  this.forEach(run);
394
432
  return result.join("");
@@ -517,7 +555,6 @@ class Program extends Array {
517
555
  lets = Object.create(null);
518
556
  vars = Object.create(null);
519
557
  scoped = [];
520
- _scoped.push(scoped);
521
558
  var isExpress = o.isExpress;
522
559
 
523
560
  if (isFunction || isArrow) {
@@ -595,12 +632,24 @@ class Program extends Array {
595
632
  } while (o);
596
633
  }
597
634
  var map = isFunction ? vars : lets;
598
- for (var k in used) {
599
- if (!(k in map)) {
600
- for (var u of used[k]) {
601
- saveTo(_used, k, u);
635
+ var keepscope = false;
636
+ for (var k in map) {
637
+ keepscope = true;
638
+ break;
639
+ }
640
+ if (keepscope) {
641
+ for (var k in used) {
642
+ if (!(k in map)) {
643
+ for (var u of used[k]) {
644
+ saveTo(_used, k, u);
645
+ }
602
646
  }
603
647
  }
648
+ _scoped.push(scoped);
649
+ }
650
+ else {
651
+ mergeTo(_used, used);
652
+ if (scoped.length) _scoped.push(scoped);
604
653
  }
605
654
  if (vars.this) {
606
655
  delete vars.this;
@@ -641,11 +690,6 @@ class Program extends Array {
641
690
  detour(this.first, true);
642
691
  return this;
643
692
  }
644
- // 标记要保留的代码
645
- ahchor() { }
646
- // 清理无效的代码
647
- clean() {
648
- }
649
693
  // 压缩
650
694
  press() {
651
695
  this.pressed = true;
@@ -675,9 +719,9 @@ class Javascript {
675
719
  number_reg = /^[\+\-]?(0x[0-9a-f]+|0b\d+|0o\d+|(\d*\.\d+|\d+\.?)(e[\+\-]?\d+|[mn])?)$/i;
676
720
  transive = /^(new|var|let|const|yield|void|in|of|typeof|delete|case|return|await|export|default|instanceof|throw|extends|import|from)$/
677
721
  straps = `if,in,do,as,of
678
- var,for,new,try,let
722
+ var,for,new,try,let,get,set
679
723
  else,case,void,with,enum,from,eval
680
- async,while,break,catch,throw,const,yield,class,await
724
+ async,while,break,catch,throw,const,yield,class,await,super
681
725
  return,typeof,delete,switch,export,import,static
682
726
  default,finally,extends
683
727
  function,continue,debugger
@@ -717,16 +761,24 @@ class Javascript {
717
761
  }
718
762
  else if (scope.type === SCOPED && scope.entry === '[') {
719
763
  if (queue.isObject) {
720
- scope.isprop = !last || last.type === STAMP && /^(\+\+|\-\-|;)$/.test(last.text)
764
+ scope.isprop = !last || last.type === STAMP && last.text === ','
721
765
  }
722
766
  else if (queue.isClass) {
723
- scope.isprop = !last || last.type === STAMP && last.text === ','
767
+ scope.isprop = !last || last.type === STAMP && /^(\+\+|\-\-|;)$/.test(last.text)
724
768
  }
725
769
  }
726
770
  if (scope.type !== COMMENT && scope.type !== SPACE) {
771
+ if (scope.type === PROPERTY || scope.isprop) scope.queue = queue;
772
+ else if (scope.type === STRAP && /^(get|set|static)$/.test(scope.text)) {
773
+ scope.type = EXPRESS;
774
+ }
727
775
  if (last) {
728
776
  scope.prev = last;
729
777
  last.next = scope;
778
+ if (!scope.isprop && last.type === STRAP) {
779
+ if (last.text === 'async' && scope.text !== "function")
780
+ last.type = EXPRESS;
781
+ }
730
782
  }
731
783
  if (!queue.first) queue.first = scope;
732
784
  queue.lastUncomment = scope;
@@ -744,10 +796,18 @@ class Javascript {
744
796
  var save = (type) => {
745
797
  if (lasttype === STAMP && type === STAMP && !/[,;\:\?]/.test(m)) {
746
798
  var scope = queue[queue.length - 1];
747
- if (/=>$/i.test(scope.text) || /=$/.test(scope.text) && /[^>=]/.test(m)) {
799
+ if (/=>$/i.test(scope.text) || /=$/.test(scope.text) && /[^>=]/.test(m) || scope.end !== start) {
748
800
  } else {
749
801
  scope.end = end;
750
802
  scope.text = text.slice(scope.start, scope.end);
803
+ if (scope.text === '=>') {
804
+ if (scope.prev && scope.prev.prev) {
805
+ var pp = scope.prev.prev;
806
+ if (pp.type === EXPRESS && pp.text === 'async') {
807
+ pp.type = STRAP;
808
+ }
809
+ }
810
+ }
751
811
  queue.inExpress = true;
752
812
  return;
753
813
  }
@@ -757,6 +817,11 @@ class Javascript {
757
817
  case QUOTED:
758
818
  if (isProperty()) type = PROPERTY;
759
819
  break;
820
+ case SPACE:
821
+ if (last && last.type === STRAP && last.text === 'retrun') {
822
+ queue.inExpress = false;
823
+ }
824
+ break;
760
825
  case EXPRESS:
761
826
  if (!/^\./.test(m) && isProperty()) type = PROPERTY;
762
827
  else if (this.number_reg.test(m)) type = VALUE;
@@ -791,6 +856,7 @@ class Javascript {
791
856
  }
792
857
  if (~[EXPRESS, VALUE].indexOf(last.type)) {
793
858
  last.type = PROPERTY;
859
+ last.queue = queue;
794
860
  } else {
795
861
  type = EXPRESS;
796
862
  }
@@ -805,19 +871,13 @@ class Javascript {
805
871
  else queue.question++;
806
872
  break;
807
873
  case ",":
874
+ case "=":
808
875
  if (queue.isObject) {
809
876
  if (last.type === PROPERTY) {
810
- var _m = m;
811
- var _end = end;
812
- end = start;
813
- m = ":";
814
- save(STAMP);
815
- m = last.text;
816
- save(EXPRESS);
817
- m = _m;
818
- end = _end;
877
+ last.short = true;
819
878
  }
820
879
  }
880
+ queue.inExpress = true;
821
881
  break;
822
882
  case ":":
823
883
  if (queue.question) {
@@ -894,12 +954,17 @@ class Javascript {
894
954
  var isProperty = function () {
895
955
  var prev = queue.lastUncomment;
896
956
  if (queue.isObject) {
897
- return !prev || prev.type === STAMP && prev.text === "," || prev.type === PROPERTY && /^(get|set|async)$/.test(prev.text);
957
+ if (!prev || prev.type === STAMP && prev.text === ",") return true;
898
958
  }
899
959
  if (queue.isClass) {
900
960
  if (!prev) return true;
901
961
  if (prev.type === STAMP) return /^(\+\+|\-\-|;)$/.test(prev.text);
902
- return prev.type === EXPRESS && !/\.$/.test(prev.text) || ~[SCOPED, VALUE, QUOTED, PROPERTY].indexOf(prev.type);
962
+ if (prev.type === EXPRESS && !/\.$/.test(prev.text)) return true;
963
+ if (~[SCOPED, VALUE, QUOTED, PROPERTY].indexOf(prev.type)) return true;
964
+ }
965
+ if (!prev) return false;
966
+ if (prev.type === PROPERTY && /^(get|set|async|static)$/.test(prev.text)) {
967
+ return true;
903
968
  }
904
969
  return false;
905
970
  };
@@ -907,9 +972,10 @@ class Javascript {
907
972
  loop: while (index < text.length) {
908
973
  if (queue.type === QUOTED) {
909
974
  var quote = this.quote_map[queue.entry];
975
+ var reg = quote.reg;
976
+ start = index;
910
977
  while (index < text.length) {
911
- var reg = quote.reg;
912
- start = reg.lastIndex = index;
978
+ reg.lastIndex = index;
913
979
  var match = reg.exec(text);
914
980
  if (!match) {
915
981
  index = text.length;
@@ -926,6 +992,7 @@ class Javascript {
926
992
  }
927
993
  if (m in quote.entry) {
928
994
  push_quote();
995
+ start = index;
929
996
  continue loop;
930
997
  }
931
998
  }
@@ -1007,8 +1074,18 @@ class Javascript {
1007
1074
  continue;
1008
1075
  }
1009
1076
  if (this.strap_reg.test(m)) {
1077
+ if (!/^(async|function|class)$/.test(m)) queue.inExpress = this.transive.test(m);
1078
+ else {
1079
+ var last = queue.lastUncomment;
1080
+ if (!last) queue.inExpress = false;
1081
+ else if (last.type === STAMP) {
1082
+ queue.inExpress = !/^(;|\+\+|\-\-)$/.test(last.text);
1083
+ }
1084
+ else if (last.type !== STRAP) {
1085
+ queue.inExpress = false;
1086
+ }
1087
+ }
1010
1088
  save(STRAP);
1011
- queue.inExpress = this.transive.test(m);
1012
1089
  continue;
1013
1090
  }
1014
1091
  if (this.value_reg.test(m) || this.number_reg.test(m)) {
@@ -1018,6 +1095,7 @@ class Javascript {
1018
1095
  }
1019
1096
  if (this.express_reg.test(m)) {
1020
1097
  save(EXPRESS);
1098
+ queue.inExpress = true;
1021
1099
  continue;
1022
1100
  }
1023
1101
 
@@ -1027,7 +1105,10 @@ class Javascript {
1027
1105
  scope.type = SCOPED;
1028
1106
  var last = queue.lastUncomment;
1029
1107
  if (m === "{") {
1030
- if (last && queue.classed > 0) {
1108
+ if (!last) {
1109
+ scope.isObject = queue.inExpress;
1110
+ }
1111
+ else if (queue.classed > 0) {
1031
1112
  if (last.type !== STAMP || last.text !== "=>") {
1032
1113
  queue.classed--;
1033
1114
  scope.isClass = true;
@@ -1035,20 +1116,16 @@ class Javascript {
1035
1116
  scope.inExpress = false;
1036
1117
  }
1037
1118
  }
1038
- else if (!queue.lastUncomment) {
1039
- scope.isObject = queue.inExpress;
1040
- }
1041
- else if (queue.lastUncomment.type === STAMP) {
1042
- if (queue.lastUncomment.text === ':') {
1119
+ else if (last.type === STAMP) {
1120
+ if (last.text === ':') {
1043
1121
  scope.isObject = queue.inExpress;
1044
1122
  }
1045
- else scope.isObject = !/^(;|\+\+|\-\-|=>)$/.test(queue.lastUncomment.text);
1123
+ else scope.isObject = !/^(;|\+\+|\-\-|=>)$/.test(last.text);
1046
1124
  }
1047
- else if (STRAP === queue.lastUncomment.type) {
1048
- if (queue[queue.length - 1].type === SPACE && queue.lastUncomment.text === 'return');
1125
+ else if (last.type === STRAP) {
1126
+ if (queue[queue.length - 1].type === SPACE && last.text === 'return');
1049
1127
  else scope.isObject = queue.inExpress;
1050
1128
  }
1051
- queue.inExpress = scope.isObject;
1052
1129
  }
1053
1130
  else {
1054
1131
  scope.isExpress = queue.inExpress;
@@ -1066,15 +1143,7 @@ class Javascript {
1066
1143
  var lastUncomment = queue.lastUncomment;
1067
1144
  if (lastUncomment) {
1068
1145
  if (lastUncomment.type === PROPERTY) {
1069
- var _start = start;
1070
- var _m = m;
1071
- start = end;
1072
- m = ":";
1073
- save(STAMP);
1074
- m = lastUncomment.text;
1075
- save(EXPRESS);
1076
- m = _m;
1077
- start = _start;
1146
+ lastUncomment.short = true;
1078
1147
  }
1079
1148
  }
1080
1149
 
@@ -1090,6 +1159,7 @@ class Javascript {
1090
1159
  }
1091
1160
 
1092
1161
  }
1162
+ if (queue !== origin) throw new Error("代码异常结束");
1093
1163
  return queue;
1094
1164
  }
1095
1165
  commit() {
@@ -67,8 +67,19 @@ function testRegexp() {
67
67
  var m = scanner(`/${/[^\u0130\u0131\u00DFa-z0-9\\/:\-_\. ]+/g.source}/g/** a */`)
68
68
  console.log(m)
69
69
  }
70
- testSpeed();
71
- testVariables();
72
- testRegexp();
70
+ function testStatic() {
71
+ var m = scanner(`class a{static{console.log(1)}}`);
72
+ console.log(m);
73
+ }
74
+ function testAssign() {
75
+ var m = scanner(`a=function(){}
76
+ a()`);
77
+ console.log(m.press().toString());
78
+ }
79
+ // testSpeed();
80
+ // testVariables();
81
+ // testRegexp();
82
+ // testStatic();
83
+ testAssign();
73
84
  // var typescript = require("../typescript/index");
74
85
  // typescript.transpile(data.toString(), { noEmitHelpers: true });
@@ -39,7 +39,7 @@ var active = function () {
39
39
  __addClass(this, "hover active");
40
40
  };
41
41
  var checkclick = function () {
42
- if (this.hasAttribute("disabled") || this.disabled || this.hasAttribute("loading") || this.loading) onclick.preventClick = true;
42
+ if (this.hasAttribute("disabled") || this.disabled || this.hasAttribute("loading") || this.loading || this.hasAttribute("pending") || this.pending) onclick.preventClick = true;
43
43
  };
44
44
  var resetactive = function () {
45
45
  removeClass(this, "active");
@@ -94,6 +94,7 @@
94
94
  }
95
95
 
96
96
  &.active,
97
+ &[pending],
97
98
  &[loading] {
98
99
  >.track {
99
100
  background: #0003;
@@ -102,6 +103,7 @@
102
103
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.3) inset;
103
104
  }
104
105
 
106
+ &[pending],
105
107
  &[loading] {
106
108
  @keyframes ltr {
107
109
  0% {