efront 3.27.0 → 3.28.0

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 (44) hide show
  1. package/apps/kugou/home.html +7 -2
  2. package/apps/kugou/home.js +1 -0
  3. package/apps/kugou/home.less +3 -6
  4. package/apps/kugou/main.js +1 -1
  5. package/apps/kugou/search/search.html +2 -2
  6. package/apps/kugou/search/search.less +12 -30
  7. package/apps/kugou/search.html +6 -0
  8. package/apps/kugou/singer/keywords.html +1 -0
  9. package/apps/kugou/singer/keywords.js +2 -0
  10. package/apps/kugou/singer/keywords.less +39 -4
  11. package/coms/basic/Field.js +0 -1
  12. package/coms/basic/Table.js +1 -0
  13. package/coms/basic/encodePack.js +2 -2
  14. package/coms/basic/getIndexFromOrderedArray.js +3 -3
  15. package/coms/basic/isArrayLike.js +1 -1
  16. package/coms/basic_/rest_.js +1 -1
  17. package/coms/kugou/api.js +1 -1
  18. package/coms/kugou/bg.js +3 -0
  19. package/coms/kugou/bg.less +34 -0
  20. package/coms/kugou/bindScroll.js +30 -15
  21. package/coms/kugou/buildList.js +1 -1
  22. package/coms/kugou/buildList.less +3 -11
  23. package/coms/kugou/buildScroll.js +0 -1
  24. package/coms/kugou/playList.less +9 -2
  25. package/coms/kugou/player.js +0 -1
  26. package/coms/kugou/player.less +6 -4
  27. package/coms/kugou/song.html +1 -1
  28. package/coms/kugou/song.js +2 -1
  29. package/coms/kugou/song.less +10 -7
  30. package/coms/kugou/titlebar.less +0 -3
  31. package/coms/reptile/colored_console.js +122 -0
  32. package/coms/reptile/colors.js +54 -0
  33. package/coms/zimoli/bindGlobalkey.js +3 -2
  34. package/coms/zimoli/block.less +0 -35
  35. package/coms/zimoli/cloneVisible.js +1 -1
  36. package/coms/zimoli/menu.js +1 -1
  37. package/coms/zimoli/render.js +27 -26
  38. package/coms/zimoli/titlebar.js +1 -1
  39. package/coms/zimoli/titlebar.less +1 -1
  40. package/coms/zimoli/view.js +1 -1
  41. package/coms/zimoli/view.less +6 -6
  42. package/coms/zimoli/zimoli.js +1 -1
  43. package/package.json +1 -1
  44. package/public/efront.js +1 -1
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var colored = Object.create(null);
3
+ var lazy = require("../basic/lazy");
4
+ var colors = require("./colors");
5
+ var lastLogLength = 0;
6
+ var getColor = function (c) {
7
+ switch (c) {
8
+ case "red":
9
+ case "error":
10
+ case "danger":
11
+ return colors.FgRed;
12
+ case "info":
13
+ case "tip":
14
+ case "blue":
15
+ return colors.FgBlue;
16
+ case "green":
17
+ return colors.FgGreen;
18
+ default:
19
+ if (c in colors) return colors[c];
20
+ c = c[0].toUpperCase() + c.slice(1).toLowerCase();
21
+ if (c in colors) return colors[c];
22
+ var k = "Fg" + c;
23
+ if (k in colors) {
24
+ return colors[k];
25
+ }
26
+ c = c.slice(0, 2) + c[2].toUpperCase() + c.slice(3);
27
+ if (c in colors) return colors[c];
28
+ }
29
+ return '';
30
+ };
31
+ var write = function (hasNewLine, str) {
32
+ str = String(str).replace(/<([a-z][\w]*)[^\>]*\>([\s\S]*?)<\/\1\>/ig, function (_, c, s) {
33
+ var color = getColor(c);
34
+ if (color) return color + s + colors.Reset;
35
+ return s;
36
+ });
37
+ process.stdout.cork();
38
+ var hasNextLine = /[\r\n\u2028\u2029]/.test(str);
39
+ if (process.stdout.isTTY) {
40
+ if (lastLogLength) {
41
+ var width = process.stdout.columns;
42
+ var dx = lastLogLength % width;
43
+ var dy = (lastLogLength - 1) / width | 0;
44
+ process.stdout.moveCursor(-dx, -dy);
45
+ process.stdout.clearScreenDown();
46
+ }
47
+ }
48
+ else {
49
+ if (!hasNewLine && !hasNextLine) str = '';
50
+ }
51
+ hasNewLine && !hasNextLine ? process.stdout.write(str + "\r\n") : process.stdout.write("\r" + str);
52
+ if (hasNextLine) hasNewLine = true;
53
+ if (hasNewLine) {
54
+ lastLogLength = 0;
55
+ } else {
56
+ str = str.replace(/\x1b\[\d+m/g, '').replace(/\b/g, '');
57
+ lastLogLength = str.length + str.replace(/[\x20-\xff]/g, "").length;
58
+ }
59
+ process.stdout.uncork();
60
+ };
61
+ [
62
+ "pass:[ ✔ ]:FgGreen:",
63
+ "fail:[ ✘ ]:FgRed2:",
64
+ "test:[ ∞ ]:FgYellow:",
65
+ "info:提示:FgCyan:",
66
+ "warn:注意:FgYellow:",
67
+ "error:错误:FgRed2:"
68
+ ].forEach(function (config) {
69
+ var [log, info = log.toUpperCase(), fg, bg] = config.split(":");
70
+ var fgColor = colors[fg] || "",
71
+ bgColor = colors[bg] || "",
72
+ reset = colors.Reset;
73
+ var hasNewLine = /^(warn|error|pass|fail)$/.test(log);
74
+ var logger = function (...args) {
75
+ var label = fgColor + bgColor + info + reset;
76
+ var time_stamp = '';
77
+ var str = [time_stamp, label, ...args].join(" ");
78
+ if (queue.length > 1 && !queue[queue.length - 2] && !/[\r\n\u2028\u2029]/.test(queue[queue.length - 1])) {
79
+ queue.pop();
80
+ queue.pop();
81
+ }
82
+ write1(hasNewLine, str);
83
+ };
84
+ colored[log] = logger;
85
+ });
86
+ var queue = [];
87
+ var flush = function () {
88
+ while (queue.length) write(queue.shift(), queue.shift());
89
+ };
90
+ // var write0 = lazy(flush, -60);
91
+ var write1 = function (hasNewLine, str) {
92
+ writeid++;
93
+ // queue.push(hasNewLine, str);
94
+ write(hasNewLine, str);
95
+ };
96
+ colored.flush = flush;
97
+ colored.type = function (...args) {
98
+ write1(false, args.join(' '));
99
+ };
100
+ var _log = console.log;
101
+ colored.log = function () {
102
+ flush();
103
+ _log.apply(console, arguments);
104
+ };
105
+ colored.begin = function (c) {
106
+ return write1(false, getColor(c));
107
+ };
108
+ var writeid = 0;
109
+ var drop = lazy(function (dropid) {
110
+ if (dropid === writeid) write1(false, "");
111
+ }, 160);
112
+ colored.drop = function () {
113
+ drop(++writeid);
114
+ };
115
+ colored.end = function () {
116
+ return write1(false, colors.Reset);
117
+ };
118
+ colored.clear = function (tag) {
119
+ write1(false, '');
120
+ if (tag) write1(true, tag);
121
+ };
122
+ module.exports = colored;
@@ -0,0 +1,54 @@
1
+ var colors = module.exports = {
2
+ Reset: "\x1b[0m",
3
+ Bright: "\x1b[1m",
4
+ Dim: "\x1b[2m",
5
+ Underscore: "\x1b[4m",
6
+ Blink: "\x1b[5m",
7
+ Reverse: "\x1b[7m",
8
+ Hidden: "\x1b[8m",
9
+ FgBlack: "\x1b[30m",
10
+ FgRed: "\x1b[31m",
11
+ FgGreen: "\x1b[32m",
12
+ FgYellow: "\x1b[33m",
13
+ FgBlue: "\x1b[34m",
14
+ FgMagenta: "\x1b[35m",
15
+ FgCyan: "\x1b[36m",
16
+ FgWhite: "\x1b[37m",
17
+ BgBlack: "\x1b[40m",
18
+ BgRed: "\x1b[41m",
19
+ BgGreen: "\x1b[42m",
20
+ BgYellow: "\x1b[43m",
21
+ BgBlue: "\x1b[44m",
22
+ BgMagenta: "\x1b[45m",
23
+ BgCyan: "\x1b[46m",
24
+ BgWhite: "\x1b[47m",
25
+ FgGray: "\x1b[90m",
26
+ FgRed2: "\x1b[91m",
27
+ FgGreen2: "\x1b[92m",
28
+ FgYellow2: "\x1b[93m",
29
+ FgBlue2: "\x1b[94m",
30
+ FgPurple: "\x1b[95m",
31
+ FgCyan2: "\x1b[96m",
32
+ FgWhite2: "\x1b[97m",
33
+ // test: "\x1b[97m",
34
+ BgGray: "\x1b[100m",
35
+ BgRed2: "\x1b[102m",
36
+ BgGreen2: "\x1b[102m",
37
+ BgYellow2: "\x1b[103m",
38
+ BgBlue2: "\x1b[104m",
39
+ BgMagenta2: "\x1b[105m",
40
+ BgCyan2: "\x1b[106m",
41
+ BgWhite2: "\x1b[107m",
42
+ };
43
+ class Color {
44
+ constructor(name, value) {
45
+ this.name = name;
46
+ this.value = value;
47
+ }
48
+ toString() {
49
+ return this.value;
50
+ }
51
+ }
52
+ for (var k in colors) {
53
+ colors[k] = new Color(k, colors[k]);
54
+ }
@@ -4,7 +4,8 @@
4
4
  */
5
5
  var emitEvent = function (item, event) {
6
6
  if (event.defaultPrevented) return;
7
- if (!getTargetIn(this, event.target) && !getTargetIn(event.target, this)) return;
7
+ var target = this.target || this;
8
+ if (!getTargetIn(target, event.target) && !getTargetIn(event.target, target)) return;
8
9
  event.preventDefault(true);
9
10
  if (item.disabled) return;
10
11
  active(this, item, "global", this.$src ? createItemTarget.call(this, item) : this);
@@ -31,7 +32,7 @@ function bindGlobalkey(elem, keymap, item) {
31
32
  if (!keymap) return;
32
33
  var keyoff = [];
33
34
  for (let k in keymap) {
34
- keyoff.push(bindonly(elem, k, item));
35
+ keyoff.push(bindonly(elem, k, keymap[k]));
35
36
  }
36
37
  elem.$keyoff = keyoff;
37
38
  }
@@ -3,39 +3,4 @@
3
3
  position: relative;
4
4
  background: #fffc;
5
5
  border-radius: 4px 0 4px 0;
6
- }
7
-
8
- >.bg {
9
- border: 1px solid rgba(0, 0, 0, .1);
10
- border-radius: inherit;
11
- position: absolute;
12
- left: 0;
13
- right: 0;
14
- top: 0;
15
- bottom: 0;
16
- overflow: hidden;
17
-
18
- &:after {
19
- margin: -100px -180px;
20
- width: 300px;
21
- height: 200px;
22
- right: 0;
23
- bottom: 0;
24
- }
25
-
26
- &:before {
27
- width: 60px;
28
- height: 100px;
29
- margin: -55px -35px;
30
- left: 0;
31
- top: 0;
32
- }
33
-
34
- &:after,
35
- &:before {
36
- content: "";
37
- background-color: rgba(90, 200, 250, 0.1);
38
- position: absolute;
39
- border-radius: 50%;
40
- }
41
6
  }
@@ -1,5 +1,5 @@
1
1
  var cloneProperties = "fontWeight,fontSize,fontFamily,color,textShadow,opacity,writingMode,blockSize,wordSpacing,letterSpacing,whiteSpace".split(",");
2
- var cloneProperties2 = "position,backdropFilter,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,textOverflow,wordBreak,webkitLineClamp,webkitBoxOrient,writingMode,blockSize,wordSpacing,letterSpacing,textIndent,lineHeight,display,appearance,webkitAppearance,MozAppearance".split(",");
2
+ var cloneProperties2 = "position,backdropFilter,filter,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,textOverflow,wordBreak,webkitLineClamp,webkitBoxOrient,writingMode,blockSize,wordSpacing,letterSpacing,textIndent,lineHeight,display,appearance,webkitAppearance,MozAppearance".split(",");
3
3
  var pushProperty = function (key, props) {
4
4
  props.split(",").forEach(k => {
5
5
  cloneProperties2.push(key + k);
@@ -206,7 +206,7 @@ function main(elem, mode) {
206
206
  }
207
207
  if (!elem.hasAttribute('mode')) elem.setAttribute('mode', mode);
208
208
  if (!elem.hasAttribute(mode)) elem.setAttribute(mode, '');
209
-
209
+ elem.target = document.body;
210
210
  return elem;
211
211
 
212
212
  }
@@ -1,21 +1,29 @@
1
1
  var hasOwnProperty = {}.hasOwnProperty;
2
2
  var renderElements = Object.create(null);
3
3
  var presets = Object.create(null);
4
+ var copyAttribute = function (node, copys) {
5
+ for (var { name, value } of copys) switch (name.toLowerCase()) {
6
+ case "class":
7
+ addClass(node, value);
8
+ break;
9
+ case "style":
10
+ css(node, value);
11
+ break;
12
+ case "src":
13
+ case "placeholder":
14
+ node[name] = value;
15
+ break;
16
+ default:
17
+ node.setAttribute(name, value);
18
+ }
19
+ }
4
20
  var createTemplateNodes = function (text) {
5
21
  remove(this.with);
6
22
  if (isEmpty(text)) return;
7
23
  if (isNode(text)) {
8
24
  var node = text;
9
25
  if (isElement(node) && this.$struct.copys) {
10
- for (var c of this.$struct.copys) {
11
- if (c.name === 'class') {
12
- addClass(node, c.value);
13
- }
14
- else if (c.name === 'style') {
15
- css(node, c.value);
16
- }
17
- else node.setAttribute(c.name, c.value);
18
- }
26
+ copyAttribute(node, this.$struct.copys);
19
27
  }
20
28
  this.with = [node];
21
29
  return;
@@ -779,23 +787,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
779
787
  if (nextSibling) appendChild.before(nextSibling, replacer);
780
788
  else if (parentNode) appendChild(parentNode, replacer);
781
789
  if (element.parentNode === parentNode) remove(element);
782
- copys.forEach(function (attr) {
783
- var { name, value } = attr;
784
- switch (name.toLowerCase()) {
785
- case "class":
786
- addClass(replacer, value);
787
- break;
788
- case "style":
789
- css(replacer, value);
790
- break;
791
- case "src":
792
- case "placeholder":
793
- replacer[name] = value;
794
- break;
795
- default:
796
- replacer.setAttribute(name, value);
797
- }
798
- });
790
+ copyAttribute(replacer, copys);
799
791
  if (!replacer.renderid) replacer.renderid = element.renderid;
800
792
  }
801
793
  }
@@ -899,6 +891,15 @@ function createStructure(element) {
899
891
  element.removeAttribute(name);
900
892
  continue;
901
893
  };
894
+ if (/^\./.test(name) && !value) {
895
+ // 识别为class
896
+ element.removeAttribute(name);
897
+ value = name.slice(1).replace(/\./g, ' ')
898
+ name = 'class';
899
+ copys.push({ name, value });
900
+ element.setAttribute(name, value);
901
+ continue;
902
+ }
902
903
  if (/^(?:class|style|src|\:|placeholder)$/i.test(name)) {
903
904
  copys.push(attr);
904
905
  continue;
@@ -1,4 +1,4 @@
1
- var nav = createElement(div);
1
+ var nav = createElement("titlebar");
2
2
 
3
3
  function btn(element) {
4
4
  var opt = button(element);
@@ -14,7 +14,7 @@
14
14
  border : 1px solid #18333c;
15
15
  background-color: #18333c99;
16
16
  backdrop-filter : blur(20px);
17
- box-shadow : inset 0 0 6px #51ddf6, inset 200px -160px 200px -200px #51ddf6;
17
+ box-shadow : inset 0 0 6px #51ddf666, inset 200px -160px 200px -200px #51ddf633;
18
18
  cursor : default;
19
19
 
20
20
  >label {
@@ -93,7 +93,7 @@ var init = function () {
93
93
  var isType = function (target, type) {
94
94
  // 记得小时候,不论是苍蝇还是蚊子,飞起来都是有声音的。最近看到的一种像蚊子一样小的飞虫,喜欢像苍蝇一样趴在食物上,飞起来却听不到声音。
95
95
  // 是我的听力下降了?还是外界太过嘈杂?还是飞虫拍打翅膀的频率超出了我的听觉范围?还是飞行可以不产生声音?
96
- return target.hasAttribute(type) || hasClass(type);
96
+ return target.hasAttribute(type) || hasClass(target, type);
97
97
  }
98
98
  var resize2 = function () {
99
99
  var head, body, foot;
@@ -15,6 +15,7 @@ body>& {
15
15
  -webkit-user-select: none;
16
16
  border: 1px solid #0006;
17
17
  min-width: 160px;
18
+ background: #fff;
18
19
  }
19
20
 
20
21
  &[draggable] {
@@ -25,7 +26,7 @@ body>& {
25
26
  >[body] {
26
27
  padding: 6px 20px 6px 6px;
27
28
  margin-right: -20px;
28
- background: #f2f4f6;
29
+ background: #f2f4f622;
29
30
  display: block;
30
31
  width: auto;
31
32
  height: 100%;
@@ -35,8 +36,8 @@ body>& {
35
36
  box-sizing: border-box;
36
37
  background-clip: padding-box;
37
38
 
38
- border-top: 6px solid #fff;
39
- border-bottom: 6px solid #fff;
39
+ border-top: 6px solid #fff2;
40
+ border-bottom: 6px solid #fff2;
40
41
 
41
42
  &:not(:nth-last-child(1)) {
42
43
  padding-bottom: 42px;
@@ -48,13 +49,12 @@ body>& {
48
49
  >[head] {
49
50
  top: 0;
50
51
  z-index: 2;
51
- background: #fffc;
52
+ background: inherit;
52
53
  position: relative;
53
54
  position: sticky;
54
55
  line-height: 20px;
55
56
  overflow: hidden;
56
57
  text-overflow: ellipsis;
57
- color: #333;
58
58
  padding: 12px 16px 10px 16px;
59
59
 
60
60
  &:before {
@@ -108,7 +108,7 @@ body>& {
108
108
  padding: 6px 16px 0 16px;
109
109
  border-top: 1px solid rgba(0, 0, 0, .16);
110
110
  backdrop-filter: blur(20px);
111
- background: #fffc;
111
+ background: inherit;
112
112
  position: sticky;
113
113
  width: 100%;
114
114
  bottom: 0;
@@ -323,7 +323,7 @@ function prepare(pgpath, ok) {
323
323
  };
324
324
  state.titlebar = function () {
325
325
  var realTitleBar = titlebar.apply(null, arguments);
326
- state.with(realTitleBar);
326
+ if (!realTitleBar.parentNode) state.with(realTitleBar);
327
327
  return realTitleBar;
328
328
  };
329
329
  var roles = res || null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.27.0",
3
+ "version": "3.28.0",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {