efront 4.17.0 → 4.18.3

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/#/345/233/275/351/231/205/345/214/226.yml +30 -0
  2. package/apps/kugou/home.less +0 -14
  3. package/apps/pivot/api.yml +7 -0
  4. package/apps/pivot/db/config.xht +37 -0
  5. package/apps/pivot/db/edit.xht +47 -0
  6. package/apps/pivot/db/list.xht +63 -0
  7. package/apps/pivot/home/welcome.html +8 -0
  8. package/apps/pivot/home/welcome.js +12 -1
  9. package/apps/pivot/home/welcome.less +3 -0
  10. package/apps/pivot/main.js +0 -3
  11. package/apps/pivot/wow/root.js +7 -10
  12. package/coms/basic/color.js +1 -0
  13. package/coms/basic/data.js +6 -4
  14. package/coms/basic/refilm_decode.js +14 -6
  15. package/coms/basic/submit_.js +12 -5
  16. package/coms/compile/Program.js +1 -1
  17. package/coms/compile/downLevel.js +4 -3
  18. package/coms/docs/markdown.js +5 -0
  19. package/coms/explorer/Explorer.js +2 -1
  20. package/coms/explorer/context.js +2 -0
  21. package/coms/explorer/edit.html +2 -1
  22. package/coms/explorer/edit.js +6 -4
  23. package/coms/frame/route.js +3 -3
  24. package/coms/kugou/parseSongsList.js +1 -1
  25. package/coms/reptile/readRequestAsJson.js +26 -0
  26. package/coms/zimoli/back.xht +22 -3
  27. package/coms/zimoli/button.js +12 -2
  28. package/coms/zimoli/confirm.js +3 -2
  29. package/coms/zimoli/confirm.less +1 -2
  30. package/coms/zimoli/field.html +2 -1
  31. package/coms/zimoli/field.js +4 -0
  32. package/coms/zimoli/getCursorPosition.js +21 -0
  33. package/coms/zimoli/model.js +97 -95
  34. package/coms/zimoli/on.js +9 -1
  35. package/coms/zimoli/progbar.xht +59 -0
  36. package/coms/zimoli/prompt.js +81 -35
  37. package/coms/zimoli/prompt.less +23 -3
  38. package/coms/zimoli/render.js +34 -20
  39. package/coms/zimoli/select.js +1 -1
  40. package/coms/zimoli/selectList.js +8 -6
  41. package/coms/zimoli/selectListEdit.html +1 -1
  42. package/coms/zimoli/selectListEdit.js +1 -0
  43. package/coms/zimoli/view.js +3 -0
  44. package/coms/zimoli/zimoli.js +6 -5
  45. package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +1 -1
  46. package/docs/mark.xht +8 -0
  47. package/package.json +1 -1
  48. package/public/efront.js +1 -1
  49. /package/coms/{zimoli → basic}/checkroles.js +0 -0
@@ -608,19 +608,21 @@ var binders = {
608
608
  attr = attr.replace(/\-(\w)/g, (_, w) => w.toUpperCase());
609
609
  var getter = createGetter(this, search);
610
610
  var oldValue;
611
- this.$renders.push(function () {
611
+ var hook = function () {
612
612
  var value = getter(this);
613
613
  if (deepEqual(value, oldValue)) return;
614
614
  oldValue = value;
615
615
  if (this[attr] !== value) {
616
616
  this[attr] = this[attr.replace(/\-[a-z]/g, a => a.toUpperCase())] = value;
617
617
  }
618
- });
618
+ }
619
+ this.$renders.push(hook);
620
+ return hook;
619
621
  },
620
622
  ""(attr, search) {
621
623
  var getter = createGetter(this, search);
622
624
  var oldValue;
623
- this.$renders.push(function () {
625
+ var hook = function () {
624
626
  var value = getter(this);
625
627
  if (deepEqual(value, oldValue)) return;
626
628
  oldValue = value;
@@ -633,7 +635,9 @@ var binders = {
633
635
  this.removeAttribute(attr);
634
636
  }
635
637
  } else if (this.getAttribute(attr) !== value) this.setAttribute(attr, value);
636
- });
638
+ }
639
+ this.$renders.push(hook);
640
+ return hook;
637
641
  }
638
642
  };
639
643
  var reject = function (e) { digest(); throw e };
@@ -715,6 +719,25 @@ function getFromScopes(key, scope, parentScopes) {
715
719
  if (key in presets) return presets[key];
716
720
  }
717
721
  }
722
+ function renderProp(elem, props) {
723
+ for (var k in props) {
724
+ try {
725
+ if (elem[k] !== props[k]) elem[k] = props[k];
726
+ } catch (e) { }
727
+ }
728
+ }
729
+
730
+ function renderBinds(element, binds, init) {
731
+ var bind = binders._;
732
+ var hs = [];
733
+ for (var k in binds) {
734
+ if (k === 'src') continue;
735
+ if (directives.hasOwnProperty(k)) continue;
736
+ var h = bind.call(element, k, binds[k]);
737
+ hs.push(h);
738
+ }
739
+ return hs;
740
+ }
718
741
 
719
742
  function renderRest(element, struct, replacer = element) {
720
743
  var renders = element.$renders;
@@ -724,24 +747,13 @@ function renderRest(element, struct, replacer = element) {
724
747
  delete element.renders;
725
748
  }
726
749
  element.$renders = [];
727
- var { binds, attrs, props } = struct;
728
- for (var k in binds) {
729
- if (k === 'src') continue;
730
- if (directives.hasOwnProperty(k)) {
731
- directives[k].call(element, binds[k], replacer);
732
- }
733
- else {
734
- binders._.call(element, k, binds[k]);
735
- }
750
+ var { attrs, binds } = struct;
751
+ for (var k in binds) if (k !== 'src' && k in directives) {
752
+ directives[k].call(element, binds[k], replacer);
736
753
  }
737
754
  for (var k in struct.attrs) {
738
755
  binders[""].call(element, k, attrs[k]);
739
756
  }
740
- for (var k in struct.props) {
741
- try {
742
- if (replacer[k] !== props[k]) replacer[k] = props[k];
743
- } catch (e) { }
744
- }
745
757
  if (binds.src) directives.src.call(element, binds.src);
746
758
  if (renders && renders.length) element.$renders.push.apply(element.$renders, renders);
747
759
  if (!isElement(replacer)) replacer = element;
@@ -791,7 +803,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
791
803
  }
792
804
  var $struct = element.$struct;
793
805
  element.$renders = element.$renders || element.renders ? [].concat(element.$renders || [], element.renders || []) : [];
794
- var { copys, binds, once } = $struct;
806
+ var { copys, binds, once, props } = $struct;
795
807
  if (once) element.$renderid = 9;
796
808
  if (binds.src) {
797
809
  element.$src = parseRepeat(binds.src);
@@ -799,6 +811,8 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
799
811
  var { tagName, parentNode, nextSibling } = element;
800
812
  // 替换元素
801
813
  var constructor = getFromScopes(tagName, scope, parentScopes);
814
+ renderProp(element, props);
815
+ renderBinds(element, binds);
802
816
  if (isFunction(constructor)) {
803
817
  var replacer = constructor.call(scope, element, scope, parentScopes);
804
818
  if (element === replacer) {
@@ -837,7 +851,7 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
837
851
  }
838
852
  if (element.$renders.length) {
839
853
  if (element.$renderid !== 9) {
840
- onmounted(element, addRenderElement);
854
+ on("append")(element, addRenderElement);
841
855
  onremove(element, removeRenderElement);
842
856
  if (isMounted(element) || element.$renderid > 1) addRenderElement.call(element);
843
857
  else if (eagermount) rebuild(element);
@@ -93,7 +93,7 @@ function select() {
93
93
  this.appendChild(o);
94
94
  });
95
95
  care(target, 'set-options', function (options) {
96
- this.innerHTML = options.map(o => `<option value="${o.value}">${o.name}</option>`).join("");
96
+ this.innerHTML = options.map(o => `<option value="${o.key || o.value}">${o.name || o.innerHTML}</option>`).join("");
97
97
  });
98
98
  on('focus')(target, preventDefault);
99
99
  }
@@ -76,7 +76,7 @@ function main() {
76
76
  var clicker = multiple ? multipleClick : singleClick;
77
77
  var itemMap = Object.create(null);
78
78
  function createItem(option) {
79
- var key = option.key || option.value;
79
+ var key = isEmpty(option.key) ? option.value : option.key;
80
80
  if (key in itemMap) return itemMap[key];
81
81
  var item = itemMap[key] = document.createElement('div');
82
82
  item.setAttribute("item", '');
@@ -89,7 +89,7 @@ function main() {
89
89
  page.setAttribute('iconed', '');
90
90
  }
91
91
  hasIcon = true;
92
- css(item, { backgroundImage: `url('${icon}')` });
92
+ css(item, { backgroundImage: icon });
93
93
  }
94
94
  item.value = key;
95
95
  if (item.value === page.value) {
@@ -201,14 +201,16 @@ function main() {
201
201
  break;
202
202
  case this.children[1]:
203
203
  var options = Array.apply(null, children);
204
- var edit = selectListEdit(options.slice(0));
204
+ var optholder = isEmpty(options[0].key) && isEmpty(options[0].value) ? options.shift() : null;
205
+ var edit = selectListEdit(options);
205
206
  page.with = edit;
206
- on("remove")(edit, function () {
207
+ care(edit, function () {
207
208
  itemMap = Object.create(null);
208
209
  page.with = null;
209
210
  children.splice(0, children.length);
210
- children.push.apply(children, edit.$scope.options.map(o => ({ key: o.key || o.value, name: o.name || o.innerHTML })))
211
- cast(page.target, 'set-options', edit.$scope.options);
211
+ if (optholder) children.push(optholder);
212
+ children.push.apply(children, edit.$scope.options.map(o => ({ value: o.key || o.value, name: o.name || o.innerHTML })))
213
+ cast(page.target, 'set-options', children);
212
214
  page.clean();
213
215
  remove(adder);
214
216
  page.go(0);
@@ -5,7 +5,7 @@
5
5
  -if="search&&!filtered.hasFullmatch">添加</a>
6
6
  </div>
7
7
  <div class="item" -repeat="o in (search?filtered:options)">
8
- <span -html=o.name></span>
8
+ <span -html=o.name||o.innerHTML></span>
9
9
  <a type="danger" @click="del(o)">删除</a>
10
10
  </div>
11
11
  </div>
@@ -42,6 +42,7 @@ function main(options) {
42
42
  remove(page);
43
43
  },
44
44
  save() {
45
+ cast(page, options);
45
46
  remove(page);
46
47
  },
47
48
  filtered: []
@@ -94,6 +94,9 @@ var init = function () {
94
94
  };
95
95
  var resize2 = function () {
96
96
  var [head, body, foot] = getTypedChildren(this, ["head", "body", "foot"]);
97
+ this.head = head;
98
+ this.body = body;
99
+ this.foot = foot;
97
100
  var changed = false;
98
101
  a: if (head && body) {
99
102
  var height = head.offsetHeight + head.offsetTop;
@@ -144,6 +144,7 @@ function go(pagepath, args, history_name, oldpagepath) {
144
144
  var page_object = page_generators[pgpath];
145
145
  if (!isEmpty(args0)) page_object.state.data = args, args = args0;
146
146
  var fullfill = function () {
147
+ zimoliad = zimoliid;
147
148
  var _page = create(pgpath, args, oldpagepath);
148
149
  var isDestroy = pushstate(pagepath, history_name, oldpagepath);
149
150
  if (isNode(history_name)) {
@@ -436,13 +437,10 @@ function create(pagepath, args, from, needroles) {
436
437
 
437
438
  }
438
439
 
439
- var zimoliid = 0;
440
+ var zimoliid = 0, zimoliad = 0;
440
441
  function zimoli(pagepath, args, history_name, oldpagepath) {
441
-
442
- if (isNode(history_name))
443
- var zid = history_name.zimoliid = (history_name.zimoliid | 0) + 1;
444
- else var zid = ++zimoliid;
445
442
  if (arguments.length === 0) {
443
+ if (zimoliid !== zimoliad) return;
446
444
  history_name = current_history;
447
445
  var _history = history[history_name] || [];
448
446
  root_path = _history[0] || "/main";
@@ -456,6 +454,9 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
456
454
  args = data;
457
455
  oldpagepath = from;
458
456
  }
457
+ if (isNode(history_name))
458
+ var zid = history_name.zimoliid = (history_name.zimoliid | 0) + 1;
459
+ else var zid = ++zimoliid;
459
460
 
460
461
  if (page_generators[pagepath]) return go(pagepath, args, history_name, oldpagepath);
461
462
  return prepare(pagepath, function () {
@@ -29,7 +29,7 @@
29
29
  coder.innerHTML = colored;
30
30
  };
31
31
  coder.getValue = function () {
32
- return coder.innerText;
32
+ return coder.innerText.replace(/[\u00a0\u2002]/g, ' ');
33
33
  };
34
34
  var markAnchorOffset = function () {
35
35
  var { anchorNode, anchorOffset } = document.getSelection();
package/docs/mark.xht CHANGED
@@ -62,6 +62,14 @@
62
62
  color: #808080;
63
63
  }
64
64
 
65
+ blockquote {
66
+ margin: 10px 0 0 0;
67
+ border: 1px solid #0003;
68
+ border-left: 6px solid #0003;
69
+ padding: 6px 10px;
70
+ background: #fff6;
71
+ }
72
+
65
73
  m {
66
74
  padding: 0 6px;
67
75
  margin: 0 4px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.17.0",
3
+ "version": "4.18.3",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {