efront 3.28.1 → 3.29.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.
@@ -1,7 +1,7 @@
1
1
  var fs = require("fs");
2
2
  var path = require("path");
3
- var test_file_reg = /_test\.[tj]sx?$/i;
4
- var comm_file_reg = /\.[tj]sx?$/i;
3
+ var test_file_reg = /_test\.([tj]sx?|xht)$/i;
4
+ var comm_file_reg = /\.([tj]sx?|xht)$/i;
5
5
  var readdir = function (a) {
6
6
  return new Promise(function (ok, oh) {
7
7
  a = path.join(__dirname, "../../coms", a);
@@ -5,6 +5,7 @@
5
5
  top: 0;
6
6
  right: 0;
7
7
  bottom: 0;
8
+ width: 100%;
8
9
  background: inherit;
9
10
  }
10
11
 
@@ -93,6 +93,7 @@ class Table extends Array {
93
93
  this.searched = 0;
94
94
  this.splice(0, this.length);
95
95
  var source = this.sorted ? this.sorted : this.source;
96
+ if (!source) return;
96
97
  var searchid = ++this.searchid;
97
98
  this.complete = false;
98
99
  this.coverCount = 0;
File without changes
@@ -2,7 +2,7 @@
2
2
  var compile = require("./compile");
3
3
  var javascript = function () {
4
4
  "use strict";
5
- var Enum = require("../basic/Enum");
5
+ var Enum = require("./Enum");
6
6
  var Tokens = new Enum;
7
7
  var {
8
8
  SingleLineComment,
@@ -62,9 +62,9 @@ var javascript = function () {
62
62
  entry: ProgramCodeBlock
63
63
  };
64
64
  }();
65
- var fs = require("fs");
66
- var path = require("path");
67
- var assert = require("../basic/assert");
65
+ // var fs = require("fs");
66
+ // var path = require("path");
67
+ var assert = require("./assert");
68
68
 
69
69
 
70
70
 
@@ -35,4 +35,9 @@ function decode(s) {
35
35
  return b;
36
36
  });
37
37
  }
38
- module.exports = { encode, decode };
38
+ function recode(s) {
39
+ s = decode(s);
40
+ s = encode(s);
41
+ return s;
42
+ }
43
+ module.exports = { encode, decode, recode };
@@ -17,7 +17,7 @@ var getPageScope = function (d) {
17
17
  return $scope;
18
18
  };
19
19
  var never = function () { return false };
20
- var popupEdit = function (d) {
20
+ var popupRen = function (d) {
21
21
  var $scope = getPageScope(d);
22
22
  var selected = $scope.selected;
23
23
  var active;
@@ -28,8 +28,14 @@ var popupEdit = function (d) {
28
28
  else {
29
29
  active = d.$scope.d;
30
30
  }
31
- if (d === $scope)
32
- if (d.$scope.pending) return;
31
+ if (d.$scope.pending) return;
32
+ popupEdit($scope, active);
33
+ };
34
+ var popupAdd = function (d) {
35
+ var $scope = getPageScope(d);
36
+ popupEdit($scope, null);
37
+ };
38
+ var popupEdit = function ($scope, active) {
33
39
  var params = {
34
40
  path: $scope.pathlist.join('/'),
35
41
  hasName: $scope.hasName.bind($scope),
@@ -153,7 +159,7 @@ return extend([
153
159
  {
154
160
  name: "新建文件夹(D)",
155
161
  when: notGetActive,
156
- do: popupEdit
162
+ do: popupAdd
157
163
  },
158
164
  {
159
165
  name: "添加文件(F)",
@@ -167,7 +173,7 @@ return extend([
167
173
  hotkey: "F2",
168
174
  name: '重命名(R)',
169
175
  when: getStable,
170
- do: popupEdit
176
+ do: popupRen
171
177
  },
172
178
  {
173
179
  get name() {
@@ -13,7 +13,7 @@ appendChild(layer, leftLayer, centerLayer);
13
13
  onappend(centerLayer, function () {
14
14
  zimoli.switch("layer-left-center", layer);
15
15
  zimoli();
16
- var cancel_resize = onresize(window, reshape);
16
+ var cancel_resize = on("resize")(window, reshape);
17
17
  once("remove")(centerLayer, cancel_resize);
18
18
  });
19
19
  function reshape() {
@@ -0,0 +1,31 @@
1
+ <img ng-src="user.avatar||'images/avatar.png'" draggable="false"/>
2
+ <style>
3
+ & {
4
+ border-radius: 50%;
5
+ display: inline-block;
6
+ background-repeat: no-repeat;
7
+ background-size: cover;
8
+ background-position: center;
9
+ }
10
+ </style>
11
+ <script>
12
+ function main(elem) {
13
+ if (!isElement(elem)) {
14
+ elem = document.createElement("img");
15
+ }
16
+ if (!/^img$/i.test(elem.tagName)) {
17
+ care(elem, function (src) {
18
+ css(elem, { backgroundImage: `url('${src}')` });
19
+ })
20
+ }
21
+ var size = +elem.getAttribute('size');
22
+ if (size) {
23
+ css(elem, {
24
+ width: fromPixel(size),
25
+ height: fromPixel(size)
26
+ });
27
+ }
28
+ return elem;
29
+ }
30
+ main.toString = template.toString;
31
+ </script>
@@ -0,0 +1,33 @@
1
+ <back onclick="history.back()">
2
+ <i></i><span>返回</span>
3
+ </back>
4
+ <style>
5
+ i:before {
6
+ content: "‹";
7
+ font-size: 28px;
8
+ }
9
+
10
+ i {
11
+ font-style: normal;
12
+ margin-top: -12px;
13
+ }
14
+
15
+ span {
16
+ font-size: 14px;
17
+ margin-left: 10px;
18
+ margin-top: -10px;
19
+ }
20
+
21
+ span,
22
+ i {
23
+ position: absolute;
24
+ left: 10px;
25
+ top: 50%;
26
+ height: 20px;
27
+ line-height: 20px;
28
+ font-style: normal;
29
+ }
30
+ </style>
31
+ <script>
32
+ var back = button;
33
+ </script>
@@ -0,0 +1,110 @@
1
+ <style>
2
+ /* less */
3
+ strong{
4
+ color: #666;
5
+ }
6
+ div span:before{
7
+ content: '<a>pseudo</a>';
8
+ display: 'inline-block';
9
+ padding: 0 16px;
10
+ color: blue;
11
+ }
12
+ caption,td,th {
13
+ position: relative;
14
+ padding: 10px 16px;
15
+ background: #fff;
16
+ }
17
+
18
+ clone,
19
+ canvas {
20
+ position: absolute !important;
21
+ left: 16px !important;
22
+ top: 10px !important;
23
+ }
24
+ border-collapse: collapse;
25
+
26
+ td,
27
+ th {
28
+ border: 2px solid #ccc;
29
+ }
30
+
31
+ td {
32
+ background: #fff;
33
+ @mask-color1 : rgba(255, 255, 255, .6);
34
+ @mask-color2 : rgba(0, 0, 0, 0);
35
+ @mask-color3 : rgba(0, 0, 0, .1);
36
+ background:
37
+ linear-gradient(45deg, @mask-color1, 25%, @mask-color1, 25%, @mask-color2, 75%, @mask-color1, 75%, @mask-color1),
38
+ linear-gradient(45deg, @mask-color1, 25%, @mask-color1, 25%, @mask-color2, 75%, @mask-color1, 75%, @mask-color1),
39
+ linear-gradient(45deg, @mask-color3, 25%, @mask-color3, 25%, @mask-color2, 75%, @mask-color3, 75%, @mask-color3),
40
+ linear-gradient(45deg, @mask-color3, 25%, @mask-color3, 25%, @mask-color2, 75%, @mask-color3, 75%, @mask-color3);
41
+ background-size: 20px 20px;
42
+ background-position: 0 0, 10px 10px, 10px 0, 0 10px;
43
+ background-repeat: repeat;
44
+ background-clip: border-box;
45
+
46
+ }
47
+ </style>
48
+ <table onmounted="update()">
49
+
50
+ <caption><strong>cloneVisible</strong>&nbsp;&nbsp;<i>vs.</i>&nbsp;&nbsp;<strong>html2canvas</strong></caption>
51
+ <thead>
52
+ <tr>
53
+ <th>原图</th>
54
+ <th>cloneVisible</th>
55
+ <th>html2canvas</th>
56
+ </tr>
57
+ </thead>
58
+ <tbody>
59
+ <tr #row>
60
+ <td>
61
+ <div
62
+ style="width:100px;height:100px;position:relative;background-color:#223223;overflow:hidden;border-radius:100px;">
63
+ <div
64
+ style="border:5px dashed;line-height:40px;text-align:center;text-shadow:1px 3px 0 red;color:#ff3;text-indent:20px">
65
+ abc
66
+ <span class='cl-c'>cl-c</span>
67
+ <input style="width:10px;height:10px;-webkit-appearance:none" />
68
+ <span style="writing-mode:vertical-rl;letter-spacing:12px">
69
+ 书生<br />意气
70
+ </span>
71
+ </div>
72
+ <style>
73
+ .cl-c {
74
+ display: block;
75
+ float: right;
76
+ }
77
+ </style>
78
+
79
+ </div>
80
+ </td>
81
+ <td></td>
82
+ <td></td>
83
+ </tr>
84
+ </tbody>
85
+ </table>
86
+ <script>
87
+ function update() {
88
+ var [td1, td2, td3] = this.row.children;
89
+ var ele = td1.children[0]
90
+ setTimeout(function () {
91
+ var clone = cloneVisible(ele);
92
+ appendChild(td2, clone);
93
+ console.log(ele)
94
+ ele.with ? ele.with.push(clone) : ele.with = [clone];
95
+ var e1 = window.e1 = ele.querySelector("input");
96
+ var e2 = window.e2 = clone.querySelector("input");
97
+ var s1 = window.s1 = getComputedStyle(e1);
98
+ var s2 = window.s2 = getComputedStyle(e2);
99
+ for (var k in s1) {
100
+ if (s1[k] !== s2[k] && !/cssText/.test(k)) {
101
+ console.warn(k, 'src:', s1[k], 'dst:', s2[k]);
102
+ }
103
+ }
104
+
105
+ html2canvas(ele, { backgroundColor: "rgba(0,0,0,0)" }).then(function (e) {
106
+ appendChild(td3, e);
107
+ });
108
+ });
109
+ }
110
+ </script>
@@ -47,7 +47,6 @@ function gallery(element, minWidth, generator) {
47
47
  maxWidth: fromPixel(maxWidth),
48
48
  });
49
49
  };
50
- resizingList.set(element);
51
50
  var createColumn = function (id) {
52
51
  var _box = list(function (index) {
53
52
  var realindex = index * boxCount + id;
@@ -95,7 +94,7 @@ function gallery(element, minWidth, generator) {
95
94
  this.clean();
96
95
  this.go(index || 0);
97
96
  });
98
- on('resize')(element, element.resize);
97
+ resizingList.set(element, element.resize);
99
98
  return element;
100
99
  }
101
100
  function main() {
@@ -79,7 +79,7 @@ function lattice(element, minWidth, _maxWidth, layers) {
79
79
  go.call(_box, index);
80
80
  }
81
81
  });
82
- resizingList.set(_box);
82
+ resizingList.set(_box, _box.resize);
83
83
  on('resize')(_box, _box.resize);
84
84
  return _box;
85
85
  }
@@ -1 +1,2 @@
1
- var onresize=on("resize");
1
+ console.warn(`%c onresize(...) %c方法将在未来的版本中移除!使用%c on("resize")(window, handler) %c 或 %c resizingList.set(element, handler) %c 代替`,
2
+ "color:red","color:#333","color:blue","color:#333","color:blue","color:#333"), on("resize");
@@ -797,6 +797,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
797
797
  }
798
798
  if (!isFirstRender) return element;
799
799
  renderRest(element, element.$struct, replacer);
800
+ var restons = element.$struct.ons;
800
801
  if (replacer) {
801
802
  if (!replacer.renders) replacer.renders = [];
802
803
  if (isElement(replacer)) createStructure(replacer);
@@ -810,7 +811,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
810
811
  }
811
812
  element = replacer;
812
813
  }
813
- if (element.$struct) element.$struct.ons.forEach(([on, key, value]) => on.call(element, element, key, value));
814
+ restons.forEach(([on, key, value]) => on.call(element, element, key, value));
814
815
  if (element.renders.length) {
815
816
  if (element.renderid !== 9) {
816
817
  onmounted(element, addRenderElement);
@@ -897,7 +898,7 @@ function createStructure(element) {
897
898
  value = name.slice(1).replace(/\./g, ' ')
898
899
  name = 'class';
899
900
  copys.push({ name, value });
900
- element.setAttribute(name, value);
901
+ addClass(element, value);
901
902
  continue;
902
903
  }
903
904
  if (/^(?:class|style|src|\:|placeholder)$/i.test(name)) {
@@ -1,3 +1,4 @@
1
+ var onresize = on("resize");
1
2
  onresize(window, function () {
2
3
  for (var r of resizingList) {
3
4
  dispatch(r, 'resize');
@@ -11,9 +12,13 @@ var unmount = function () {
11
12
  removeFromList(resizingList, this);
12
13
  };
13
14
  var resizingList = [];
14
- resizingList.set = function (e) {
15
- on('append')(e, mount);
16
- on("remove")(e, unmount);
15
+ resizingList.set = function (e, h) {
16
+ var off1 = onmounted(e, mount);
17
+ var off2 = on("remove")(e, unmount);
18
+ if (isFunction(h)) var off3 = onresize(e, h);
19
+ var offs = [off1, off2];
20
+ if (off3) offs.push(off3);
21
+ return function (offs) { for (var off of offs) off() };
17
22
  };
18
23
  resizingList.hit = function (e) {
19
24
  for (var a of this) {
@@ -323,7 +323,7 @@ function slider(autoplay, circle = true) {
323
323
  var cancel_resize;
324
324
  onappend(outter, function () {
325
325
  cancel_resize && cancel_resize();
326
- cancel_resize = onresize(window, function () {
326
+ cancel_resize = on("resize")(window, function () {
327
327
  switchBy(0);
328
328
  });
329
329
  if (isFinite(outter.index)) switchBy(0);
@@ -527,8 +527,7 @@ function table(elem) {
527
527
  })
528
528
  }
529
529
  );
530
- resizingList.set(table);
531
- on("resize")(table, setFixedColumn);
530
+ resizingList.set(table, setFixedColumn);
532
531
  on("scroll")(table, setFixedColumn);
533
532
  return table;
534
533
  }
@@ -3,6 +3,7 @@ body>& {
3
3
  }
4
4
 
5
5
  & {
6
+ display: block;
6
7
  max-width: 100%;
7
8
  width: 360px;
8
9
  height: auto;
@@ -22,7 +23,7 @@ body>& {
22
23
  position: absolute;
23
24
  }
24
25
 
25
- &>.body,
26
+ >.body,
26
27
  >[body] {
27
28
  padding: 6px 20px 6px 6px;
28
29
  margin-right: -20px;
@@ -45,7 +46,7 @@ body>& {
45
46
  }
46
47
 
47
48
 
48
- &>.head,
49
+ >.head,
49
50
  >[head] {
50
51
  top: 0;
51
52
  z-index: 2;
@@ -94,13 +95,13 @@ body>& {
94
95
  }
95
96
  }
96
97
 
97
- &>.foot,
98
+ >.foot,
98
99
  >[foot] {
99
100
  white-space: nowrap;
100
101
  overflow: auto;
101
102
  }
102
103
 
103
- &>.foot,
104
+ >.foot,
104
105
  >[foot] {
105
106
  z-index: 1;
106
107
  text-align: right;
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.28.1",
3
+ "version": "3.29.2",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {