efront 4.11.6 → 4.11.8

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.
@@ -8,7 +8,7 @@
8
8
  <field -repeat="f in fields" -src="[f,data]"></field>
9
9
  </div>
10
10
  <div class="left">
11
- <pre -text="task.code"></pre>
11
+ <jscode -value="task.code" type="js"></jscode>
12
12
  </div>
13
13
  <div class="right" :class="{error:error}">
14
14
  <pre -text="output"></pre>
@@ -16,6 +16,7 @@ function main(a) {
16
16
  task: a,
17
17
  output: '',
18
18
  error: false,
19
+ jscode: 茨菰$编辑框,
19
20
  async run() {
20
21
  var id = ++taskid;
21
22
  this.output = "正在执行..";
@@ -2,16 +2,19 @@
2
2
  position: absolute;
3
3
  width: 800px;
4
4
  }
5
- >[body]{
6
- border-top: 50px solid transparent;
7
- border-bottom: 50px solid transparent;
8
- }
5
+
6
+
9
7
  >[body]>div {
10
8
  display: inline-block;
11
9
  vertical-align: top;
12
10
  overflow: auto;
13
11
  font-size: 12px;
14
12
 
13
+ >jscode,
14
+ >pre {
15
+ height: 100%;
16
+ }
17
+
15
18
  &.top {
16
19
  left: 0;
17
20
  top: 0;
@@ -403,7 +403,7 @@ var patchstep = function (r, nextindex, h) {
403
403
  x = rescan`if (${name}) return [${nextindex}, 0]`;
404
404
  }
405
405
  else if (o === RD) {
406
- x = rescan`if (${name}!= null) return [${nextindex}, 0]`;
406
+ x = rescan`if (${name}!=null) return [${nextindex}, 0]`;
407
407
  }
408
408
  else continue;
409
409
  changed = true;
@@ -941,6 +941,13 @@ var _express = function (body, getname, ret) {
941
941
  q.name = cloneNode(body);
942
942
  return [q];
943
943
  }
944
+ if (isFunctionOnly(body)) {
945
+ result = [body];
946
+ return result;
947
+ }
948
+ else {
949
+ result = [];
950
+ }
944
951
  var result = [];
945
952
  var q = [];
946
953
  var bx = 0;
@@ -949,6 +956,7 @@ var _express = function (body, getname, ret) {
949
956
  var nameindex = 0;
950
957
  var maxindex = 0;
951
958
  var hasor = false;
959
+ var xorcount = 0;
952
960
  var getdeepname = function (deep = 0) {
953
961
  return getname(maxindex + deep);
954
962
  };
@@ -1007,12 +1015,20 @@ var _express = function (body, getname, ret) {
1007
1015
  q.name = cloneNode(name);
1008
1016
  if (isor) {
1009
1017
  if (o.text === '||') {
1018
+ if (xorcount) {
1019
+ result.push(..._invoke(q, getdeepname));
1020
+ result[result.length - 1].ret_ = true;
1021
+ q = [];
1022
+ q.name = cloneNode(name);
1023
+ }
1010
1024
  q.push(RE);
1011
1025
  }
1012
1026
  else if (o.text === '&&') {
1013
1027
  q.push(RZ);
1028
+ xorcount++;
1014
1029
  }
1015
1030
  else if (o.text === '??') {
1031
+ xorcount++;
1016
1032
  q.push(RD);
1017
1033
  }
1018
1034
  hasor = true;
@@ -1065,12 +1081,9 @@ var _express = function (body, getname, ret) {
1065
1081
  }
1066
1082
  }
1067
1083
  if (needname) q.name = [{ text: getname(nameindex), type: EXPRESS }];
1068
- relink(q);
1069
- if (isFunctionOnly(q, 2)) {
1070
- result = [q];
1071
- }
1072
- else {
1073
- result = _invoke(q, getdeepname);
1084
+ if (q.length) {
1085
+ relink(q);
1086
+ result.push(..._invoke(q, getdeepname));
1074
1087
  }
1075
1088
  if (hasor) result[result.length - 1].ret_ = true;
1076
1089
  return result;
@@ -158,4 +158,5 @@ unstruct.debug = true; r++;
158
158
  r++// test("if(a)else {}",'')
159
159
  test("if(a){if(b){c}d}else{e}", `if (!a) return [2, 0]; if (!b) return [1, 0]; c; return [1, 0];\r\n d; return [2, 0];\r\n e; return [1, 0]`)
160
160
  test("if(a){if(b){c}else{d}}else{e}", `if (!a) return [3, 0]; if (!b) return [1, 0]; c; return [2, 0];\r\n d; return [1, 0];\r\n return [2, 0];\r\n e; return [1, 0]`)
161
+ test("if(a&&b||c){d}", `_ = a; if (!_) return [1, 0]; _ = b;\r\n if (_) return [1, 0]; _ = c;\r\n if (!_) return [1, 0]; d; return [1, 0]`, true);
161
162
  test("if(a)switch(b){case c:d;break;} else{h}", `if (!a) return [3, 0]; if (b === c) return [1, 0]; return [2, 0];\r\n d; return [1, 0];\r\n return [2, 0];\r\n h; return [1, 0]`)
@@ -3,12 +3,13 @@
3
3
  box-shadow: none !important;
4
4
  display: block;
5
5
  line-height: 22px;
6
- border-bottom: 1px;
6
+ padding: 8px 0;
7
+ border-bottom: 1px solid #0001;
7
8
  }
8
9
 
9
10
  >.head,
10
11
  >.foot {
11
- padding: 10px 16px;
12
+ padding: 2px 16px;
12
13
  vertical-align: top;
13
14
  display: inline-block;
14
15
  position: absolute;
@@ -24,6 +25,12 @@ model {
24
25
  }
25
26
 
26
27
  >.head {
28
+ font-weight: 600;
29
+ font-family: "宋体";
30
+
31
+ &:after {
32
+ content: ":";
33
+ }
27
34
 
28
35
  .image {
29
36
  margin: 10px 0;
@@ -35,10 +42,10 @@ model {
35
42
  margin: 10px 0;
36
43
  }
37
44
 
45
+ min-height: 30px;
38
46
  vertical-align: top;
39
- padding: 10px 20px;
47
+ padding: 2px 16px;
40
48
  height: 100%;
41
- border-bottom: 1px solid #0001;
42
49
  display: inline-block;
43
50
  width: 100%;
44
51
  text-align: left;
@@ -543,7 +543,7 @@ var directives = {
543
543
  var parsedSrc = this.$src;
544
544
  return src2.call(this, parsedSrc && /[\{\[\s]/.test(src) ? parsedSrc.srcName : src);
545
545
  },
546
- model(search, target) {
546
+ model(search, target, change) {
547
547
  var getter = createGetter(this, search);
548
548
  var oldValue;
549
549
  var getstr = target.getValue instanceof Function ? "this.getValue()" : "";
@@ -561,12 +561,12 @@ var directives = {
561
561
  oldValue = value;
562
562
  this[key] = value;
563
563
  };
564
- if (/^input$/i.test(target.tagName) && /^checkbox$/i.test(target.type) || /^checkbox$/i.test(target.tagName)) {
565
- this.$renders.push(setter || setter2.bind(target, 'checked'));
566
- var change = getstr || "this.checked";
567
- } else if (("value" in target || target.getValue instanceof Function) && target.setValue instanceof Function) {
564
+ if (("value" in target || target.getValue instanceof Function) && target.setValue instanceof Function) {
568
565
  this.$renders.push(setter);
569
566
  var change = getstr || "this.value";
567
+ } else if (/^input$/i.test(target.tagName) && /^checkbox$/i.test(target.type) || /^checkbox$/i.test(target.tagName)) {
568
+ this.$renders.push(setter || setter2.bind(target, 'checked'));
569
+ var change = getstr || "this.checked";
570
570
  } else if (/^(select|input|textarea)$/i.test(target.tagName) || "value" in target) {
571
571
  this.$renders.push(setter || setter2.bind(target, 'value'));
572
572
  var change = getstr || "this.value";
@@ -580,6 +580,7 @@ var directives = {
580
580
  });
581
581
  var change = getstr || "'value' in this?this.value:this.innerHTML";
582
582
  }
583
+ if (change === false) return;
583
584
  setter2 = null;
584
585
  var changeme = $$eval.bind(this, search + "=" + change, getScopeList(this));
585
586
  var onchange = function () {
@@ -593,6 +594,9 @@ var directives = {
593
594
  };
594
595
  eventsBinders.forEach(on => on(target, onchange, true));
595
596
  },
597
+ value(search, target) {
598
+ directives.model.call(this, search, target, false);
599
+ },
596
600
 
597
601
  };
598
602
  // property binder
@@ -993,7 +997,7 @@ function createStructure(element, useExists) {
993
997
  }
994
998
  // ng-html,ng-src,ng-text,ng-model,ng-style,ng-class,...
995
999
  var key = name.replace(/^(ng|v|[^\_\:\.]*?)\-|^[\:\_\.]|^v\-bind\:/i, "").toLowerCase();
996
- if (directives.hasOwnProperty(key) || /^([\_\:\.]|v\-bind\:)/.test(name)) {
1000
+ if (key.length !== name.length && directives.hasOwnProperty(key) || /^([\_\:\.]|v\-bind\:)/.test(name)) {
997
1001
  if (value) binds[key] = value;
998
1002
  element.removeAttribute(name);
999
1003
  }
@@ -92,8 +92,12 @@ var init = function () {
92
92
  };
93
93
  var resize2 = function () {
94
94
  var [head, body, foot] = getTypedChildren(this, ["head", "body", "foot"]);
95
- if (head && body) {
95
+ var changed = false;
96
+ a: if (head && body) {
96
97
  var height = head.offsetHeight + head.offsetTop;
98
+ if (head.$height === height) break a;
99
+ head.$height = height;
100
+ changed = true;
97
101
  css(head, {
98
102
  marginBottom: fromOffset(-height),
99
103
  })
@@ -101,8 +105,11 @@ var resize2 = function () {
101
105
  paddingTop: fromOffset(height - body.clientTop)
102
106
  });
103
107
  }
104
- if (foot && body) {
108
+ a: if (foot && body) {
105
109
  var height = foot.offsetHeight;
110
+ if (foot.$height === height) break a;
111
+ foot.$height = height;
112
+ changed = true;
106
113
  css(body, {
107
114
  paddingBottom: fromOffset(height)
108
115
  });
@@ -110,13 +117,11 @@ var resize2 = function () {
110
117
  marginTop: fromOffset(-height)
111
118
  })
112
119
  }
113
- if (body) {
120
+ if (changed) {
121
+ css(body, { height: '' });
114
122
  if (body.scrollHeight + body.offsetTop > this.clientHeight + 1) {
115
123
  css(body, { height: fromOffset(this.clientHeight) });
116
124
  }
117
- else {
118
- css(body, { height: '' });
119
- }
120
125
  }
121
126
  };
122
127
  function view(element) {
@@ -9,7 +9,7 @@ var rows = function (type, text) {
9
9
  console.log(text)
10
10
  return [];
11
11
  }
12
- type = type.toLowerCase();
12
+ type = String(type).toLowerCase();
13
13
  if (type in 语言) {
14
14
  var c = 语言[type](text);
15
15
  标签化(c, encode);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.11.6",
3
+ "version": "4.11.8",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {