efront 3.25.3 → 3.25.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.
Files changed (49) hide show
  1. package/apps/_index.html +1 -1
  2. package/apps/pivot/log/count.html +2 -2
  3. package/coms/basic/Field.js +5 -0
  4. package/coms/basic/Item.js +16 -6
  5. package/coms/basic/Speed.js +20 -6
  6. package/coms/basic/Table.js +120 -0
  7. package/coms/basic/Tree.js +4 -4
  8. package/coms/basic/loader.js +11 -8
  9. package/coms/basic/mark.js +7 -5
  10. package/coms/basic/parseKV.js +1 -1
  11. package/coms/basic/with_.js +6 -0
  12. package/coms/basic/withget_.js +6 -0
  13. package/coms/frame/route.js +7 -1
  14. package/coms/kugou/playList.less +6 -0
  15. package/coms/random//350/272/253/344/273/275/350/257/201.js +4 -3
  16. package/coms/zimoli/alert.js +12 -13
  17. package/coms/zimoli/autodragchildren.js +4 -1
  18. package/coms/zimoli/cloneVisible.js +8 -2
  19. package/coms/zimoli/color.js +9 -4
  20. package/coms/zimoli/contextmenu.js +1 -1
  21. package/coms/zimoli/drag.js +1 -1
  22. package/coms/zimoli/getName.js +14 -6
  23. package/coms/zimoli/hexagon.js +33 -0
  24. package/coms/zimoli/list.js +5 -5
  25. package/coms/zimoli/menuItem.html +5 -2
  26. package/coms/zimoli/menuItem.less +1 -1
  27. package/coms/zimoli/menuList.js +30 -15
  28. package/coms/zimoli/menuList.less +0 -1
  29. package/coms/zimoli/moveupon.js +1 -0
  30. package/coms/zimoli/picture_.js +10 -10
  31. package/coms/zimoli/popup.js +4 -2
  32. package/coms/zimoli/render.js +1 -1
  33. package/coms/zimoli/resize.js +1 -0
  34. package/coms/zimoli/search.js +3 -72
  35. package/coms/zimoli/selectList.js +2 -1
  36. package/coms/zimoli/slider.js +21 -9
  37. package/coms/zimoli/table.js +18 -12
  38. package/coms/zimoli/table.less +9 -0
  39. package/coms/zimoli/touchList.js +22 -20
  40. package/coms/zimoli/tree.js +3 -2
  41. package/coms/zimoli/tree.less +4 -4
  42. package/coms/zimoli/vbox.js +6 -5
  43. package/coms/zimoli/watch.js +26 -0
  44. package/docs/compare.md +16 -10
  45. package/docs/main.js +3 -3
  46. package/package.json +5 -9
  47. package/public/efront.js +1 -1
  48. package/coms/zimoli/$objectHash.js +0 -22
  49. package/coms/zimoli/$objectHash_test.js +0 -15
@@ -24,7 +24,7 @@ var touchstart = function (event) {
24
24
  }
25
25
  if (!target) return;
26
26
  cancelAnimationFrame(target.scrollTimer);
27
- saved_x = null;
27
+ saved_x = event.clientX, saved_y = event.clientY, moving = false, 0;
28
28
  currentTarget = target;
29
29
  if (!target.querySelector(".ylife-touch-delete")) {
30
30
  css(target, {
@@ -37,11 +37,10 @@ var touchstart = function (event) {
37
37
  };
38
38
  var moving = false;
39
39
  var touchmove = function (event) {
40
- if (!saved_x) return saved_x = event.clientX, saved_y = event.clientY, moving = false, 0;
41
40
  var delta_x = event.clientX - saved_x;
42
41
  var delta_y = event.clientY - saved_y;
43
42
  if (!moving) {
44
- if (Math.abs(delta_x) < 2 && Math.abs(delta_y) < 2) return;
43
+ if (Math.abs(delta_x) < MOVELOCK_DELTA && Math.abs(delta_y) < MOVELOCK_DELTA) return;
45
44
  if (Math.abs(delta_y) < Math.abs(delta_x)) {
46
45
  moving = 1;
47
46
  } else {
@@ -49,28 +48,35 @@ var touchmove = function (event) {
49
48
  }
50
49
  }
51
50
  if (moving !== 1) return;
52
- event.preventDefault();
53
- var marginLeft = -parseInt(currentTarget.scrollLeft) || 0;
54
- if (delta_x + marginLeft > 0) {
55
- delta_x = -marginLeft;
51
+ event.moveLocked = true;
52
+ var buttonWidth = currentTarget.scrollWidth - currentTarget.clientWidth;
53
+ var scrollLeft = -currentTarget.scrollLeft;
54
+ if (delta_x + scrollLeft > 0) {
55
+ delta_x = -scrollLeft;
56
56
  }
57
- else if (delta_x + marginLeft < - calcPixel(85)) {
58
- delta_x = -calcPixel(85) - marginLeft;
57
+ else if (delta_x + scrollLeft < - buttonWidth) {
58
+ delta_x = -buttonWidth - scrollLeft;
59
59
  }
60
- marginLeft += delta_x;
60
+ scrollLeft += delta_x;
61
61
  saved_x += delta_x;
62
62
  direction = delta_x;
63
- currentTarget.scrollLeft = -marginLeft;
63
+ currentTarget.scrollLeft = -scrollLeft;
64
64
  };
65
65
  var scrollTo = function (targetLeft) {
66
66
  if (!this) return;
67
67
  cancelAnimationFrame(this.scrollTimer);
68
68
  var that = this;
69
+ var scrollTime = +Speed.now();
69
70
  var reshape = function () {
70
- var currentLeft = parseInt(that.scrollLeft) || 0;
71
+ var currentLeft = that.scrollLeft;
71
72
  if (0 === (0 | currentLeft - targetLeft)) return;
72
- var thisTimeLeft = (targetLeft + currentLeft * 3) / 4 | 0;
73
- if (Math.abs(thisTimeLeft - currentLeft) < 3) {
73
+ var now = +Speed.now();
74
+ var thisTimeLeft = currentLeft;
75
+ while (scrollTime < now) {
76
+ scrollTime += 6;
77
+ thisTimeLeft = (thisTimeLeft * 11 + targetLeft) / 12;
78
+ }
79
+ if (Math.abs(thisTimeLeft - currentLeft) < .5) {
74
80
  thisTimeLeft = targetLeft;
75
81
  } else {
76
82
  that.scrollTimer = requestAnimationFrame(reshape);
@@ -94,10 +100,10 @@ var scrollToRight = function () {
94
100
  var touchend = function () {
95
101
  var marginLeft = -parseInt(currentTarget.scrollLeft) || 0;
96
102
  moving = false;
97
- if (direction < 0 && marginLeft < -calcPixel(20)) {
103
+ if (direction < 0 && marginLeft < -7) {
98
104
  scrollToLeft.call(currentTarget);
99
105
  }
100
- else if (direction > 0 && marginLeft > -currentTarget.clientWidth + calcPixel(20)) {
106
+ else if (direction > 0 && marginLeft > -currentTarget.clientWidth + 7) {
101
107
  scrollToRight.call(currentTarget);
102
108
  }
103
109
  else if (marginLeft < currentTarget.clientWidth - currentTarget.scrollWidth >> 1) {
@@ -130,9 +136,5 @@ function touchList(listElement) {
130
136
  move: touchmove,
131
137
  end: touchend
132
138
  });
133
- // ontouchstart(listElement, touchstart);
134
- // ontouchmove(listElement, touchmove);
135
- // ontouchend(listElement, touchend);
136
- // ontouchcancel(listElement, touchend);
137
139
  return listElement;
138
140
  }
@@ -39,7 +39,7 @@ function tree() {
39
39
  generator = arg;
40
40
  }
41
41
  });
42
- if (!generator && "$src" in element && element.childNodes.length) {
42
+ if (!generator && element && "$src" in element && element.childNodes.length) {
43
43
  generator = getGenerator(element, 'node');
44
44
  }
45
45
  var dom = [], root = null;
@@ -65,11 +65,12 @@ function tree() {
65
65
  if (!elem) return;
66
66
  span = document.createElement('span');
67
67
  span.innerHTML = tabs;
68
+ span.setAttribute("tabs", '');
68
69
  elem.insertBefore(span, elem.firstChild);
69
70
  span = elem;
70
71
  } else {
71
72
  span = document.createElement("node");
72
- html(span, `${tabs}<c>${com.name}</c>${com.test ? "<i>_test</i>" : ""}<a class=count>${com.count}</a>`);
73
+ html(span, `<span tabs>${tabs}</span><c>${com.name}</c>${com.test ? "<i>_test</i>" : ""}<a class=count>${com.count}</a>`);
73
74
  span.count = span.lastElementChild;
74
75
  }
75
76
  var _div = button(span);
@@ -53,19 +53,19 @@ t {
53
53
 
54
54
  .closed,
55
55
  .open {
56
- c:before {
56
+ [tabs]+*:before {
57
57
  content: "";
58
- display: inline-block;
58
+ display: inline-block !important;
59
59
  border: .3em solid transparent;
60
60
  }
61
61
  }
62
62
 
63
- .closed c:before {
63
+ .closed [tabs]+*:before {
64
64
  border-left: .4em solid;
65
65
  border-right: .2em solid transparent;
66
66
  }
67
67
 
68
- .open c:before {
68
+ .open [tabs]+*:before {
69
69
  margin-left: -.2em;
70
70
  margin-right: .2em;
71
71
  margin-top: .2em;
@@ -61,7 +61,7 @@ function ybox(generator) {
61
61
  addClass(increaser_t, 'y-insert');
62
62
  var increaser_b = increaser_t.cloneNode();
63
63
  var increase_height = calcPixel(100);
64
- var _decrease = function (increaser) {
64
+ var _decrease = function (increaser, t) {
65
65
  var height = parseInt(increaser.height);
66
66
  if (height > 1) {
67
67
  var scrollTop = _box.$Top();
@@ -76,8 +76,9 @@ function ybox(generator) {
76
76
  var deltaY = tH - bH - scrollTop > height ? height : tH - bH - scrollTop;
77
77
  height -= deltaY;
78
78
  }
79
- increaser.height = height = height > 16 ? (height * 2 + 6) / 3 : height >> 1;
80
- increaser.style.height = fromOffset(height | 0);
79
+ height = height * Math.pow(.92, t / 6);
80
+ increaser.height = height
81
+ increaser.style.height = fromOffset(height);
81
82
  return height;
82
83
  }
83
84
  if (increaser.height) {
@@ -92,8 +93,8 @@ function ybox(generator) {
92
93
  var stop2 = lazy(function () {
93
94
  scrollY.smooth(stop);
94
95
  }, 40);
95
- var decrease = function () {
96
- var res = _decrease(increaser_t) + _decrease(increaser_b);
96
+ var decrease = function (t) {
97
+ var res = _decrease(increaser_t, t) + _decrease(increaser_b, t);
97
98
  if (!res) {
98
99
  scrollY.smooth(stop);
99
100
  }
@@ -0,0 +1,26 @@
1
+ function watcher({ changes }) {
2
+ var watches = this.$watches;
3
+ for (var k in changes) {
4
+ if (k in watches) {
5
+ var { current, previous } = changes[k];
6
+ watches[k](current, previous);
7
+ }
8
+ }
9
+ }
10
+ function watch(elem, prop, handler) {
11
+ if (!elem.$watches) {
12
+ elem.$watches = {};
13
+ on("changes")(elem, watcher);
14
+ }
15
+ if (isFunction(handler)) {
16
+ elem.$watches[prop] = handler;
17
+ }
18
+ else if (isObject(prop)) {
19
+ var e = 0;
20
+ for (var k in prop) {
21
+ if (!isFunction(prop[k])) e++;
22
+ else elem.$watches[k] = prop[k];
23
+ }
24
+ if (e > 0) throw new Error("参数不支持!");
25
+ }
26
+ }
package/docs/compare.md CHANGED
@@ -6,17 +6,17 @@
6
6
 
7
7
  ## 表面参数对比
8
8
 
9
- | 对比项\框架 | efront/(zimoli) | angular | react | vue |
10
- | -------------------- | ---------------------------------------------------------------------- | ---------------------------------- | -------------------------------- | ------------------------------ |
11
- | Hello World 目标代码 | ≈1kb; | &gt;30kb | &gt;30kb | ≈30kb; |
12
- | 开发环境启动时间 | ≈0s; | &gt;2s | &gt;2s | >2s |
13
- | 开发语言 | js/html/less/ts | ts/html/less/sass/scss | jsx/css/js/ts/html | html/css/js |
14
- | 导出组件依赖项 | 无 | angular | react | vue |
15
- | 官方路由 | zimoli,使用前无需注册路径 | angular-router, 使用前需要注册路径 | react-router, 使用前需要注册路径 | vue-router, 使用前需要注册路径 |
16
- | 跨域实现 | 开发环境内置 | 配置浏览器或服务器 | 配置浏览器或服务器 | 配置浏览器或服务器 |
9
+ | 对比项\框架 | efront/(zimoli) | angular | react | vue |
10
+ | -------------------- | --------------------------------------------------------------------------- | ---------------------------------- | -------------------------------- | ------------------------------ |
11
+ | Hello World 目标代码 | ≈1kb; | &gt;30kb | &gt;30kb | ≈30kb; |
12
+ | 开发环境启动时间 | ≈0s; | &gt;2s | &gt;2s | >2s |
13
+ | 开发语言 | js/html/less | ts/html/less/sass/scss | jsx/css/js/ts/html | html/css/js |
14
+ | 导出组件依赖项 | 无 | angular | react | vue |
15
+ | 官方路由 | zimoli,使用前无需注册路径 | angular-router, 使用前需要注册路径 | react-router, 使用前需要注册路径 | vue-router, 使用前需要注册路径 |
16
+ | 跨域实现 | 开发环境内置 | 配置浏览器或服务器 | 配置浏览器或服务器 | 配置浏览器或服务器 |
17
17
  | 代码加载方案 | 依赖加载/自动预加载/手动预加载`preapre('/page/path');` / 动态路径访问时加载 | 一次加载/或访问时加载 | 一次加载/或访问时加载 | 一次加载/或访问时加载 |
18
- | 跳转传参 | `go`(pagepath,&nbsp;params) | 略 | 略 | 略 |
19
- | 异步对象传参 | `cast`(target,&nbsp;data) &#013;&#010; `care`(target,&nbsp;handle) | 略 | 略 | 略 |
18
+ | 跳转传参 | `go`(pagepath,&nbsp;params) | 略 | 略 | 略 |
19
+ | 异步对象传参 | `cast`(target,&nbsp;data) &#013;&#010; `care`(target,&nbsp;handle) | 略 | 略 | 略 |
20
20
 
21
21
  ## 架构对比
22
22
 
@@ -205,6 +205,12 @@ function main(elem){
205
205
  onremove(elem,function(event){
206
206
  // 移除之前触发,必要时可以绑定
207
207
  });
208
+ watch(elem, {
209
+ // propname 指用法<element :propname=propvalue ></element>中的propname
210
+ propname(current_value, previous_value){
211
+ // 参数变化后的任务
212
+ }
213
+ });
208
214
  var scope = {
209
215
  // html内使用的内容要在这里出现
210
216
  btn: button, // 内部组件可以在渲染前重命名,以简化html中的tagName,方便在局部语境中编写和阅读
package/docs/main.js CHANGED
@@ -2,13 +2,13 @@ zimoli.clearHistory();
2
2
  zimoli('/loader');
3
3
  contextmenu(document, function (event) {
4
4
  if (!window.require) return;
5
- return [
5
+ return menuList(null, [
6
6
  {
7
7
  "name": "开发者选项",
8
- do(){
8
+ do() {
9
9
  window.require("electron").ipcRenderer.send("window", "open-dev-tools");
10
10
  window.resizeBy(400, 0);
11
11
  }
12
12
  }
13
- ];
13
+ ]);
14
14
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.25.3",
3
+ "version": "3.25.8",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {
@@ -18,14 +18,10 @@
18
18
  "url": "https://github.com/yunxu1019/efront.git"
19
19
  },
20
20
  "keywords": [
21
- "angular",
22
- "angularjs",
23
- "react",
24
- "vue",
25
- "jquery",
26
- "commonjs",
27
- "cross",
28
- "server"
21
+ "efront",
22
+ "前端",
23
+ "server",
24
+ "webpack"
29
25
  ],
30
26
  "author": "yunxu1019",
31
27
  "license": "MIT"