efront 3.32.0 → 3.33.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,10 +1,17 @@
1
1
  @height: 420px;
2
2
  @width: 480px;
3
- @margin-top: -160px;
4
- @margin-left: -180px;
3
+ @margintop: -210px;
4
+ @marginleft: -180px;
5
+ @leftwidth: 200px;
5
6
 
6
7
  & {
7
- margin: @margin-top @margin-left;
8
+ box-sizing: content-box;
9
+ margin: @margintop @marginleft;
10
+
11
+ &:not([resizing], [dragging]) {
12
+ transition: padding .2s, margin .2s;
13
+ }
14
+
8
15
  top: 50%;
9
16
  left: 50%;
10
17
  width: @width;
@@ -18,6 +25,81 @@
18
25
  max-height: 100%;
19
26
  }
20
27
 
28
+ >list {
29
+ width: @leftwidth;
30
+ position: absolute;
31
+ top: 0;
32
+ left: 0;
33
+
34
+ .id {
35
+ opacity: .6;
36
+ transform: scale(.8);
37
+ transform-origin: left center;
38
+ font-size: 10px;
39
+ }
40
+
41
+ .local(@color) {
42
+ font-size: 14px;
43
+ transform: scale(.6) rotate(-45deg);
44
+ text-align: center;
45
+ padding: 0 6px;
46
+ position: absolute;
47
+ left: -6px;
48
+ top: 4px;
49
+
50
+ &:after,
51
+ &:before {
52
+ display: block;
53
+ content: "";
54
+ border: 8px solid transparent;
55
+ position: absolute;
56
+ top: 50%;
57
+ margin: -8px 0;
58
+ transform: scaleX(.6);
59
+ }
60
+
61
+ &:before {
62
+ left: -8px;
63
+ border-left: 0;
64
+ border-right: 12px solid @color;
65
+
66
+ }
67
+
68
+ &:after {
69
+ right: -8px;
70
+ border-right: 0;
71
+ border-left: 12px solid @color;
72
+ }
73
+
74
+ background-color: @color;
75
+ color: #fff;
76
+ }
77
+
78
+ .local {
79
+ .local(#082);
80
+ }
81
+
82
+ >.button {
83
+ text-align: left;
84
+ display: block;
85
+ border-radius: 0;
86
+ width: 100%;
87
+
88
+ &[type=white].hover {
89
+ color: #09c;
90
+
91
+ >.track {
92
+ background: #09c1;
93
+ }
94
+ }
95
+ }
96
+ }
97
+
98
+ &.showList {
99
+ margin: @margintop -380px;
100
+ padding-left: @leftwidth;
101
+ }
102
+
21
103
  padding {
22
104
  display: block;
23
105
  position: relative;
@@ -29,6 +111,22 @@ padding {
29
111
  }
30
112
  }
31
113
 
114
+ .user {
115
+ padding: 10px 20px 10px 56px;
116
+ line-height: 20px;
117
+ box-shadow: none;
118
+
119
+ >avatar {
120
+ width: 42px;
121
+ height: 42px;
122
+ background-repeat: no-repeat;
123
+ background-size: cover;
124
+ display: inline-block;
125
+ position: absolute;
126
+ left: 10px;
127
+ }
128
+ }
129
+
32
130
  msg {
33
131
  display: block;
34
132
  border-radius: 4px;
@@ -40,18 +138,18 @@ msg {
40
138
  position: relative;
41
139
  margin: 0 10px;
42
140
  float: left;
141
+ user-select: text;
43
142
 
44
143
  &:before {
45
144
  content: "";
46
145
  display: block;
47
146
  position: absolute;
48
- border: 6px solid transparent;
147
+ border: 8px solid transparent;
49
148
  top: 22px;
50
- margin: -12px;
149
+ margin: -14px;
51
150
  }
52
151
 
53
152
  &:not([self]):before {
54
- display: block;
55
153
  left: 0;
56
154
  border-right-color: #fff;
57
155
  }
@@ -70,10 +168,77 @@ msg {
70
168
  }
71
169
  }
72
170
 
171
+ msg[files] {
172
+
173
+ a {
174
+ display: block;
175
+ border: 1px solid transparent;
176
+ border-left: 0;
177
+ border-right: 0;
178
+ margin: 0 -6px;
179
+ background-color: #fff;
180
+ padding: 0 14px 0 10px;
181
+ text-align: left;
182
+ border-radius: 0;
183
+
184
+ &:hover {
185
+ border-color: #c80;
186
+ background-color: #ffe;
187
+ }
188
+
189
+ &:active {
190
+ background-color: #ffc;
191
+ }
192
+
193
+ &:first-child {
194
+ border-top-color: transparent;
195
+ border-radius: 3px 3px 0 0;
196
+ }
197
+
198
+ &:last-child {
199
+ border-bottom-color: transparent;
200
+ border-radius: 0 0 3px 3px;
201
+ }
202
+ }
203
+ }
73
204
 
74
205
  >[head] {
75
206
  padding: 9px 16px;
76
207
  line-height: 24px;
208
+ text-align: center;
209
+
210
+ >span {
211
+ display: inline-block;
212
+ }
213
+
214
+ &:before {
215
+ display: none;
216
+ }
217
+
218
+ .id {
219
+ font-size: 10px;
220
+ color: #0009;
221
+ }
222
+
223
+ .menubtn {
224
+ border-radius: 50%;
225
+ width: 36px;
226
+ height: 36px;
227
+ text-align: center;
228
+ padding: 9px 0;
229
+ margin-right: 6px;
230
+ margin: -6px 6px -6px -6px;
231
+ box-shadow: none;
232
+ float: left;
233
+
234
+ >i {
235
+ margin: 0 auto;
236
+ display: block;
237
+ width: 14px;
238
+ border-top: 3px solid transparent;
239
+ border-bottom: 2px solid;
240
+ }
241
+ }
77
242
  }
78
243
 
79
244
  >grid {
@@ -143,12 +308,41 @@ chat {
143
308
  box-shadow: none;
144
309
  box-shadow: none;
145
310
  border-top: none;
311
+ margin-top: -34px;
312
+ }
146
313
 
147
- >btn {
148
- pointer-events: all;
149
- }
314
+ >[foot]>.button {
315
+ pointer-events: all;
316
+ bottom: 0;
317
+ margin: 0;
318
+ top: 0;
319
+ padding: 0;
320
+ border-radius: 0;
321
+ min-width: 52px;
322
+ }
323
+
324
+ .unread {
325
+ position: absolute;
326
+ background: #c00;
327
+ color: #fff;
328
+ border-radius: 8px;
329
+ font-size: 10px;
330
+ padding: 0;
331
+ line-height: 1;
332
+ right: 10px;
333
+ top: 10px;
334
+ border: 2px solid #c00;
335
+ min-width: 16px;
336
+ text-align: center;
150
337
  }
151
338
 
339
+ .file>svg {
340
+ line-height: 1;
341
+ vertical-align: top;
342
+ width: 1em;
343
+ height: 1em;
344
+ margin: 7px 2px 0 0;
345
+ }
152
346
 
153
347
  .max-size() {
154
348
  margin-top: 0 !important;
@@ -156,18 +350,66 @@ chat {
156
350
  height: 100% !important;
157
351
  margin-left: 0 !important;
158
352
  left: 0 !important;
159
- width: 100% !important;
353
+ right: 0;
354
+ width: auto !important;
160
355
  border: none;
161
- .editor-height(36px);
356
+ .editor-height(42px);
357
+
358
+ &.showList {
359
+ >grid:after {
360
+ content: "";
361
+ display: block;
362
+ position: absolute;
363
+ left: 0;
364
+ top: 0;
365
+ bottom: 0;
366
+ right: 0;
367
+ width: 100%;
368
+ height: 100%;
369
+ background: #0002;
370
+
371
+ }
372
+
373
+ // margin-left: -@leftwidth !important;
374
+ }
162
375
 
163
376
  [textarea] {
164
377
  border-bottom: none;
165
378
  outline: none;
379
+ background: #fff;
166
380
 
167
381
  >div {
168
- min-height: 30px;
169
- padding-right: 110px;
382
+ background-color: #eee;
383
+ background-clip: padding-box;
384
+ border: 4px solid transparent;
385
+ border-right-width: 52px;
386
+ border-left-width: 12px;
387
+ min-height: 32px;
388
+ padding: 6px;
170
389
  }
390
+
391
+ }
392
+
393
+ >[foot] {
394
+ padding: 0;
395
+
396
+ >.button {
397
+ height: 42px;
398
+ line-height: 42px;
399
+ }
400
+
401
+ .file {
402
+ min-width: 40px;
403
+
404
+ >svg {
405
+ margin-top: 14px;
406
+ }
407
+
408
+ >span {
409
+ display: none;
410
+ }
411
+ }
412
+
171
413
  }
172
414
  }
173
415
 
@@ -1,3 +1,3 @@
1
1
  &{
2
- color: #1f4a3bd4;
2
+ color: #dfec;
3
3
  }
@@ -30,10 +30,10 @@ var getColor = function (c) {
30
30
  }
31
31
  return '';
32
32
  };
33
- var colorReg = /<(\/?)([a-z][\w]*)[^\/\\\>]*\>/ig;
34
- var write = function (hasNewLine, str) {
33
+ var colorReg = /<(\/?)([a-z][\w]*)[^\/\\\>\s]*\>/ig;
34
+ var renderColor = function (obj) {
35
35
  var colorpath = [];
36
- str = String(str).replace(colorReg, function (_, e, c) {
36
+ return String(obj).replace(colorReg, function (_, e, c) {
37
37
  if (e) {
38
38
  colorpath.pop();
39
39
  c = colorpath[colorpath.length - 1];
@@ -43,8 +43,12 @@ var write = function (hasNewLine, str) {
43
43
  var res = [];
44
44
  if (e) res.push(colors.Reset);
45
45
  if (color) res.push(color);
46
- return res.join('');
46
+ if (res.length) return res.join('');
47
+ return _;
47
48
  });
49
+ };
50
+
51
+ var write = function (hasNewLine, str) {
48
52
  process.stdout.cork();
49
53
  var hasNextLine = /[\r\n\u2028\u2029]$/.test(str);
50
54
  if (process.stdout.isTTY) {
@@ -74,7 +78,7 @@ var write = function (hasNewLine, str) {
74
78
  if (hasNewLine) {
75
79
  lastLogLength = 0;
76
80
  } else {
77
- str = str.replace(/\x1b\[\d+m/g, '').replace(/\b/g, '');
81
+ str = String(str).replace(/\x1b\[\d+m/g, '').replace(/\b/g, '');
78
82
  lastLogLength = str.length + str.replace(/[\x20-\xff]/g, "").length;
79
83
  }
80
84
  process.stdout.uncork();
@@ -95,13 +99,14 @@ var write = function (hasNewLine, str) {
95
99
  var logger = function (...args) {
96
100
  var label = fgColor + bgColor + info + reset;
97
101
  var time_stamp = '';
98
- var str = [time_stamp, label, ...args.map(a => format(a))].join(" ");
102
+ var str = [time_stamp, label, ...args.map(a => renderColor(a))].join(" ");
99
103
  write1(hasNewLine, str);
100
104
  };
101
105
  colored[log] = logger;
102
106
  });
103
107
  var write1 = function (hasNewLine, str) {
104
108
  drop.cancel();
109
+ str = renderColor(str);
105
110
  write(hasNewLine, str);
106
111
  };
107
112
  var formatRows = function (arg, rows, deep, entry, leave) {
@@ -113,10 +118,15 @@ var formatRows = function (arg, rows, deep, entry, leave) {
113
118
  if (deepobjs.length === 0) circleobjs.splice(0, circleobjs.length);
114
119
  var space = new Array(deep).join(" ");
115
120
  var deepspace = new Array(deep + 1).join(" ");
116
- var lens = rows.map(r => r.replace(colorReg, '').replace(/[\u00ff-\uffff]/g, '00').length);
121
+ var lens = rows.slice(0, 100).map(r => r.replace(colorReg, '').replace(/[\u00ff-\uffff]/g, '00').length);
117
122
  var maxLength = Math.max(...lens) + 2;
118
123
  var itemcount = (process.stdout.columns - deepspace.length - 10) / maxLength | 0;
119
- if (itemcount * itemcount > rows.length) itemcount = Math.ceil(Math.sqrt(rows.length));
124
+ if (rows.length > itemcount) {
125
+ if (itemcount * itemcount > rows.length + process.stdout.columns) itemcount = Math.ceil(Math.sqrt(rows.length + process.stdout.columns));
126
+ if (itemcount > 20) itemcount = 20;
127
+ else if (itemcount > 10) itemcount = 10;
128
+ else if (itemcount > 5) itemcount = 5;
129
+ }
120
130
  if (itemcount < 1) itemcount = 1;
121
131
  var hasNextLine = false;
122
132
  var isArray = arg instanceof Array;
@@ -163,7 +173,7 @@ var deepobjs = [];
163
173
  var circleobjs = [];
164
174
  var format = function (arg, deep = 0) {
165
175
  deep++;
166
- if (arg === null) return arg;
176
+ if (arg === null) return String(arg);
167
177
  if (typeof arg === 'string') {
168
178
  if (deep > 1) return "<green>" + strings.encode(arg) + "</green>";
169
179
  return arg;
@@ -177,14 +187,25 @@ var format = function (arg, deep = 0) {
177
187
  if (ci < 0) ci = circleobjs.length, circleobjs.push(arg);
178
188
  return `<cyan>[循环点 *${ci + 1}]</cyan>`;
179
189
  }
180
- if (arg instanceof Array) {
181
- if (arg.length === 0) return '[]';
182
- if (deep > 3) return `${arg.__proto__.constructor.name}(${arg.length})[ ... ]`;
190
+ if (arg instanceof Error) {
191
+ if (deep === 1) return String(arg.message);
192
+ return String(arg.stack || arg.message);
193
+ }
194
+ if (arg instanceof Buffer || arg instanceof ArrayBuffer || arg instanceof SharedArrayBuffer) {
195
+ var data = new Uint8Array(arg.buffer || arg, arg.byteOffset || 0, arg.byteLength);
196
+ return `<magenta><${arg.__proto__.constructor.name} ${Array.prototype.slice.call(data, 0, 20).map(a => a < 16 ? "0" + a.toString(16) : a.toString(16)).join(' ')}${arg.byteLength > 20 ? ` ... 其他 ${arg.byteLength - 20} 字节` : ''}></megenta>`;
197
+ }
198
+ else if (isFinite(arg.length)) {
199
+ var entry = "[";
200
+ var leave = "]";
201
+ entry = `${arg.__proto__.constructor.name}(${arg.length})${entry}`;
202
+ if (arg.length === 0) return entry + leave;
203
+ if (deep > 3 && deep + arg.length > 5) return `${entry} ... ${leave}`;
183
204
  deepobjs.push(arg);
184
- var res = arg.slice(0, 100).map(a => format(a, deep));
205
+ var res = Array.prototype.slice.call(arg, 0, 100).map(a => format(a, deep));
185
206
  deepobjs.pop();
186
207
  if (arg.length > res.length) res.push(`<gray>.. 其他 ${arg.length - res.length} 项</gray>`);
187
- return formatRows(arg, res, deep, '[', ']');
208
+ return formatRows(arg, res, deep, entry, leave);
188
209
  }
189
210
  if (arg.constructor === Date) {
190
211
  return '<purple>' + formatDate.call(arg) + "</purple>";
@@ -194,7 +215,7 @@ var format = function (arg, deep = 0) {
194
215
  }
195
216
  var keys = Object.keys(arg);
196
217
  var ks = keys.slice(0, 100);
197
- if (deep > 3) {
218
+ if (deep > 3 && deep + keys.length > 5) {
198
219
  var kvs = [];
199
220
  if (keys.length > 0) kvs.push(`<gray>.. 共 ${keys.length} 个属性</gray>`);
200
221
  }
@@ -269,4 +290,9 @@ colored.clear = function (tag) {
269
290
  write1(false, '');
270
291
  if (tag) write1(true, tag);
271
292
  };
293
+ colored.format = function (a) {
294
+ a = format(a);
295
+ a = renderColor(a);
296
+ return a;
297
+ };
272
298
  module.exports = colored;
@@ -47,9 +47,11 @@ var data = [
47
47
  }()
48
48
  },
49
49
  /Abcdefg/gimuy,
50
+ new Error("错误信息"),
50
51
  new Date,
51
52
  { "循环对象": null },
52
53
  ];
53
54
  data[data.length - 1].循环对象 = data[data.length - 1];
54
55
  console.log(data);
55
- console.line(data);
56
+ console.line(data);
57
+ throw new Error(2);
@@ -1,6 +1,5 @@
1
1
  <svg width="92" height="92" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
2
- style="fill: #666;" overflow="hidden" viewBox="12 135 92 92">
3
-
2
+ style="fill: currentColor" overflow="hidden" viewBox="12 135 92 92">
4
3
  <g>
5
4
  <path
6
5
  d="M32 215 32 147 60 147 60 168 82 168 82 215 32 215ZM66 149.5 78.5 162 66 162 66 149.5ZM66 141 26 141 26 221 88 221 88 163 66 141Z"
@@ -3,10 +3,10 @@ function autofocus(e) {
3
3
  var savedElement;
4
4
  e.renders.push(function () {
5
5
  var parent = rootElements[rootElements.length - 1] || document.body;
6
- if (savedElement === parent) {
6
+ if (savedElement === this) {
7
7
  if (this !== parent || getTargetIn(parent, document.activeElement)) return;
8
8
  }
9
- savedElement = parent;
9
+ savedElement = this;
10
10
  if (/^(input|textarea)$/i.test(this.tagName) || /^true$/.test(this.contentEditable)) {
11
11
  if (getTargetIn(parent, this)) {
12
12
  this.focus();
@@ -8,7 +8,7 @@ function chooseFile(accept, multiple, extra) {
8
8
  // focus 事件比change事件早40-80毫秒
9
9
  if (opened && document.hasFocus()) {
10
10
  remove(input);
11
- setTimeout(oh, 210);
11
+ setTimeout(oh, 610);
12
12
  }
13
13
  };
14
14
  on("change")(input, function () {
@@ -82,6 +82,7 @@ function drag(target, initialEvent, preventOverflow, isMovingSource) {
82
82
  extraClones.map(c => document.body.appendChild(c));
83
83
  saved_delta.x += clone_left - target_left;
84
84
  saved_delta.y += clone_top - target_top;
85
+ target.setAttribute("dragging", '');
85
86
  dispatch("dragstart", target);
86
87
  }
87
88
  event.moveLocked = true;
@@ -106,7 +107,7 @@ function drag(target, initialEvent, preventOverflow, isMovingSource) {
106
107
  if (clone !== target) remove(clone), css(target, { opacity: saved_opacity, filter: saved_filter });
107
108
  remove(extraClones);
108
109
  extraTargets.map((target, cx) => css(target, extraStyles[cx]));
109
- if (saved_delta.ing) dispatch("dragend", target);
110
+ if (saved_delta.ing) target.removeAttribute("dragging"), dispatch("dragend", target);
110
111
  drag.target = null;
111
112
  saved_delta = null;
112
113
  };
@@ -67,7 +67,7 @@
67
67
  content: "";
68
68
  border-radius: 50%;
69
69
  color: inherit;
70
- border: 1em solid ;
70
+ border: 2px solid ;
71
71
  border-right-color: transparent;
72
72
  border-top-color: transparent;
73
73
  overflow: hidden;
@@ -182,7 +182,6 @@ function maps(config = {}) {
182
182
  var reshape = function () {
183
183
  canvas.width = canvas.offsetWidth;
184
184
  canvas.height = canvas.offsetHeight;
185
- console.log(canvas.map)
186
185
  canvas.map.refresh();
187
186
  canvas._default = canvas.map.defaultImage();
188
187
  };
@@ -14,7 +14,9 @@ var copyAttribute = function (node, copys) {
14
14
  node[name] = value;
15
15
  break;
16
16
  default:
17
- node.setAttribute(name, value);
17
+ if (isFunction(node.setAttribute)) {
18
+ node.setAttribute(name, value);
19
+ }
18
20
  }
19
21
  }
20
22
  var createTemplateNodes = function (text) {
@@ -41,6 +41,9 @@ var getResizer = function (event) {
41
41
  if (fringe.cursor || getTargetIn(rect.dragHandle, event.target)) {
42
42
  var { resize } = fringe;
43
43
  extend(resize, getScreenPosition(rect));
44
+ var computedStyle = getComputedStyle(rect);
45
+ resize.width = parseFloat(computedStyle.width);
46
+ resize.height = parseFloat(computedStyle.height);
44
47
  resize.rect = rect;
45
48
  resize.cursor = fringe.cursor;
46
49
  return resize;
@@ -53,6 +56,7 @@ var handle = {
53
56
  dragging = getResizer(event);
54
57
  if (!dragging) return;
55
58
  var elem = dragging.rect;
59
+ if (elem.setAttribute) elem.setAttribute("resizing", '');
56
60
  if (elem.offsetParent && /^(absolute|fixed|relative)$/i.test(getComputedStyle(elem.offsetParent).position)) {
57
61
  var parent = elem.offsetParent;
58
62
  var pos = getScreenPosition(parent);
@@ -131,6 +135,9 @@ var handle = {
131
135
  resizingList.hit(rect);
132
136
  },
133
137
  end(e) {
138
+ if (dragging && dragging.rect.removeAttribute) {
139
+ dragging.rect.removeAttribute("resizing");
140
+ }
134
141
  dragging = null;
135
142
  }
136
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.32.0",
3
+ "version": "3.33.1",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {