efront 4.0.55 → 4.0.56

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.
@@ -208,6 +208,7 @@ function scan(text, type = "js", lastIndex = 0) {
208
208
  program.Code = Code;
209
209
  program.lastIndex = lastIndex;
210
210
  var res = program.exec(text);
211
+ res.autospace = !program.keepspace;
211
212
  Object.defineProperty(res, "program", { value: program, enumerable: false })
212
213
  return res;
213
214
  }
@@ -8,9 +8,9 @@
8
8
  font-size: 16px;
9
9
  position: relative;
10
10
  min-height: 100px;
11
- padding: 0 0 10px 16px;
11
+ padding: 0 6px 10px 16px;
12
12
  font-family: 宋体;
13
- width: 422px;
13
+ width: 438px;
14
14
 
15
15
  >a {
16
16
  display: inline-block;
@@ -40,7 +40,7 @@
40
40
  word-spacing: 2px;
41
41
  font-size: inherit;
42
42
  line-height: 30px;
43
- margin: 0 0 10px -16px;
43
+ margin: 0 -6px 10px -16px;
44
44
  padding: 0 16px 0 16px;
45
45
  position: sticky;
46
46
  top: 0;
@@ -1,5 +1,5 @@
1
1
  & {
2
- height: 100%;
2
+ height: 300px;
3
3
  }
4
4
 
5
5
  &>gallery {
@@ -23,20 +23,22 @@ var getGenerator = function (container, tagName = 'item') {
23
23
  if (container.$generator) return container.$generator;
24
24
  var template = document.createElement(container.tagName);
25
25
  var templates = [];
26
+ var hasAfter = false;
26
27
  for (let a of container.childNodes) {
27
28
  if (a.nodeType === 1 && a.hasAttribute('insert')) {
28
29
  if (!templates.length) a.$isbefore = true;
29
- else a.$isafter = true;
30
+ else { a.$isafter = true; hasAfter = true; }
30
31
  }
31
- else {
32
+ else if (hasAfter);
33
+ else if (a.nodeType === 1 || templates.length) {
32
34
  templates.push(a);
33
35
  }
34
36
  }
37
+ while (templates.length > 1 && templates[templates.length - 1].nodeType !== 1) templates.pop();
35
38
  if (templates.length < container.childNodes.length && templates.length >= 1) {
36
- var c = document.createComment('lattice');
39
+ var c = document.createComment('generator');
37
40
  c.index = null;
38
41
  container.insertBefore(c, templates[0]);
39
- templates.splice(1, templates.length - 1);
40
42
  var paddingCount = [].indexOf.call(container.childNodes, c);
41
43
  container.paddingCount = paddingCount;
42
44
  }
@@ -4,6 +4,7 @@
4
4
  }
5
5
 
6
6
  >lattice {
7
+ max-height: 300px;
7
8
  height: 100%;
8
9
  @mask-color: rgba(0, 0, 0, .4);
9
10
  // background: linear-gradient(45deg, @mask-color, 25%, @mask-color, 25%, rgba(0, 0, 0, 0), 75%, rgba(0, 0, 0, 0), 75%, @mask-color), linear-gradient(135deg, @mask-color, 25%, @mask-color, 25%, rgba(0, 0, 0, 0), 75%, rgba(0, 0, 0, 0), 75%, @mask-color);
@@ -169,9 +169,9 @@ function ylist(container, generator, $Y) {
169
169
  delete childrenMap[offset];
170
170
  }
171
171
  if (last_index > offset) {
172
- if (item.nextElementSibling !== last_item) list.insertBefore(item, last_item);
172
+ if (item.nextElementSibling !== last_item) insertBeforeList(item, last_item);
173
173
  } else {
174
- if (item.previousElementSibling !== item) list.insertBefore(item, getNextSibling(last_item));
174
+ if (item.previousElementSibling !== item) insertBeforeList(item, getNextSibling(last_item));
175
175
  }
176
176
  last_index = offset;
177
177
  item = getNodeTarget(item);
@@ -229,6 +229,17 @@ function ylist(container, generator, $Y) {
229
229
  } while (next.offsetTop === element.offsetTop);
230
230
  return next.offsetTop - element.offsetTop;
231
231
  };
232
+ var insertBeforeList = function (elem, flag) {
233
+ if(flag){
234
+ var w = elem.with;
235
+ if (w) {
236
+ if (w[w.length - 1].nextSibling === flag) return;
237
+ }
238
+ else if (elem.nextSibling === flag) return;
239
+ }
240
+ list.insertBefore(elem, flag);
241
+ if (elem.with) for (var w of elem.with) list.insertBefore(w, flag);
242
+ };
232
243
  var patchBottom = function (deltaY = 0) {
233
244
  var cache_height = list.offsetHeight;
234
245
  var childrenMap = getChildrenMap();
@@ -250,7 +261,7 @@ function ylist(container, generator, $Y) {
250
261
  } else if (!restHeight) {
251
262
  restHeight = cache_height;
252
263
  }
253
- list.insertBefore(item, getNextSibling(last_element));
264
+ insertBeforeList(item, getNextSibling(last_element));
254
265
  }
255
266
  item = getNodeTarget(item);
256
267
  if (!item.offsetHeight) {
@@ -315,7 +326,7 @@ function ylist(container, generator, $Y) {
315
326
  if (!item) {
316
327
  item = createItem(offset);
317
328
  if (!item) break;
318
- list.insertBefore(item, first_element);
329
+ insertBeforeList(item, first_element);
319
330
  item = getNodeTarget(item);
320
331
  scrollTop += flag_element.offsetTop - offsetTop;
321
332
  offsetTop = flag_element.offsetTop;
@@ -648,6 +659,7 @@ function list() {
648
659
  list.clean = function (src, old) {
649
660
  var children = (container || list).childNodes;
650
661
  children = Array.prototype.filter.call(children, c => {
662
+ if (c.index === null) return false;
651
663
  if (isFinite(c.index)) return true;
652
664
  if (c.nodeType === 1 && c.$comment && isFinite(c.$comment.index)) return true;
653
665
  return false;
@@ -4,10 +4,9 @@
4
4
 
5
5
  & {
6
6
  max-height: 500px;
7
- position : fixed;
7
+ position : relative;
8
8
  width : 360px;
9
9
  height : 100%;
10
- padding : 50px 0 0 0;
11
10
  }
12
11
 
13
12
  .device {
@@ -225,7 +225,7 @@
225
225
  if (envs[templateName]) {
226
226
  delete envs[templateName];
227
227
  var template = await cross("get", './components:' + modName + ".html");
228
- codetext = `var ${templateName}={toString(){return \`${template.responseText}\`}};\r\n` + codetext;
228
+ codetext = `var ${templateName}={toString(){return \`${template.responseText.replace(/>\s+</g, '><')}\`}};\r\n` + codetext;
229
229
  }
230
230
  initcode(codetext);
231
231
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.0.55",
3
+ "version": "4.0.56",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {