efront 4.22.19 → 4.23.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 (108) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +6 -0
  2. package/apps/kugou/search/search.js +4 -3
  3. package/apps/noice/main.js +1 -1
  4. package/apps/pivot/auth/login.js +4 -4
  5. package/apps/pivot/dht/list.js +5 -5
  6. package/apps/pivot/link/chat.js +1 -1
  7. package/apps/pivot/link/index.js +1 -1
  8. package/apps/pivot/link/list.js +5 -4
  9. package/apps/pivot/share/list.js +6 -5
  10. package/apps/pivot/wow/root.js +3 -2
  11. package/coms/basic/ArrayFill.js +5 -1
  12. package/coms/basic/BigNumber.js +2 -2
  13. package/coms/basic/LoadingArray.js +1 -0
  14. package/coms/basic/cross_.js +4 -1
  15. package/coms/basic/data.js +27 -23
  16. package/coms/basic/extend.js +18 -1
  17. package/coms/basic/isFinit.js +1 -0
  18. package/coms/basic_/&ArrayFill.js +1 -5
  19. package/coms/basic_/&extend.js +1 -18
  20. package/coms/basic_/WeakMap.js +36 -0
  21. package/coms/compile/Javascript.js +2 -1
  22. package/coms/explorer/context.js +10 -7
  23. package/coms/explorer/edit.js +1 -1
  24. package/coms/explorer/fileitem.js +9 -7
  25. package/coms/explorer/main.js +20 -17
  26. package/coms/frame/chat.js +17 -16
  27. package/coms/frame/list.js +6 -5
  28. package/coms/kugou/bindScroll.js +0 -1
  29. package/coms/kugou/buildScroll.js +5 -4
  30. package/coms/kugou/krc.js +2 -2
  31. package/coms/kugou/player.js +2 -2
  32. package/coms/kugou/song.js +1 -1
  33. package/coms/layer/leftCenter.js +5 -5
  34. package/coms/pivot/checkGeo.js +0 -1
  35. package/coms/reptile/alert.js +5 -1
  36. package/coms/reptile/data.js +3 -0
  37. package/coms/zimoli/$cared.js +1 -0
  38. package/coms/zimoli/$casted.js +1 -0
  39. package/coms/zimoli/$eval.js +1 -0
  40. package/coms/zimoli/$mounted.js +1 -0
  41. package/coms/zimoli/$parented.js +1 -0
  42. package/coms/zimoli/$renders.js +1 -0
  43. package/coms/zimoli/$scoped.js +1 -0
  44. package/coms/zimoli/$structed.js +1 -0
  45. package/coms/zimoli/$upwith.js +1 -0
  46. package/coms/zimoli/$watches.js +1 -0
  47. package/coms/zimoli/HexEditor.js +1 -1
  48. package/coms/zimoli/alert.js +4 -2
  49. package/coms/zimoli/appendChild.js +2 -2
  50. package/coms/zimoli/autodragchildren_test.js +1 -1
  51. package/coms/zimoli/care.js +27 -9
  52. package/coms/zimoli/cast.js +13 -14
  53. package/coms/zimoli/checkbox.js +1 -1
  54. package/coms/zimoli/container.js +4 -3
  55. package/coms/zimoli/createItemTarget.js +10 -6
  56. package/coms/zimoli/cross.js +1 -1
  57. package/coms/zimoli/data.js +16 -0
  58. package/coms/zimoli/field.js +3 -3
  59. package/coms/zimoli/gallery_test.js +4 -3
  60. package/coms/zimoli/getArgsChildren.js +1 -1
  61. package/coms/zimoli/getChanged.js +8 -0
  62. package/coms/zimoli/getGenerator.js +36 -28
  63. package/coms/zimoli/grid.js +2 -2
  64. package/coms/zimoli/isMounted.js +6 -3
  65. package/coms/zimoli/lattice.js +2 -4
  66. package/coms/zimoli/maps.js +1 -2
  67. package/coms/zimoli/menu.js +1 -0
  68. package/coms/zimoli/menuItem.js +4 -3
  69. package/coms/zimoli/menuList.js +7 -8
  70. package/coms/zimoli/menu_test.js +4 -3
  71. package/coms/zimoli/model.js +15 -10
  72. package/coms/zimoli/on.js +39 -23
  73. package/coms/zimoli/picture.js +0 -7
  74. package/coms/zimoli/popup.js +5 -5
  75. package/coms/zimoli/radio.js +1 -1
  76. package/coms/zimoli/remove.js +3 -3
  77. package/coms/zimoli/render.js +397 -223
  78. package/coms/zimoli/scrollbar.js +90 -42
  79. package/coms/zimoli/scrollbar.less +5 -3
  80. package/coms/zimoli/select.js +3 -3
  81. package/coms/zimoli/selectList.js +1 -1
  82. package/coms/zimoli/selectListEdit.js +5 -4
  83. package/coms/zimoli/table.html +6 -4
  84. package/coms/zimoli/table.js +82 -41
  85. package/coms/zimoli/table.less +22 -0
  86. package/coms/zimoli/vbox.less +2 -2
  87. package/coms/zimoli/view.js +1 -1
  88. package/coms/zimoli/watch.js +7 -5
  89. package/coms/zimoli/zimoli.js +78 -60
  90. package/docs/version-desc.md +3 -1
  91. package/docs//347/211/210/346/234/254/350/257/264/346/230/216.md +3 -1
  92. package/docs//347/273/204/344/273/266.xht +14 -1
  93. package/package.json +1 -1
  94. package/public/efront.js +1 -1
  95. package/public/pivot/api.yml +46 -0
  96. package/public/pivot/menu.yml +16 -0
  97. package/public/pivot/page/auth/login.txt +1 -0
  98. package/public/pivot/page/cert/main.txt +1 -0
  99. package/public/pivot/page/cert/orders.txt +1 -0
  100. package/public/pivot/page/cert/update.txt +1 -0
  101. package/public/pivot/page/db/act.txt +1 -0
  102. package/public/pivot/page/db/config.txt +1 -0
  103. package/public/pivot/page/db/edit.txt +1 -0
  104. package/public/pivot/page/db/list.txt +1 -0
  105. package/public/pivot//344/270/273/351/241/265.html +46 -0
  106. package/coms/reptile/on.js +0 -4
  107. package/coms/reptile/onmounted.js +0 -1
  108. /package/coms/{zimoli → basic}/encode62.js +0 -0
@@ -0,0 +1,16 @@
1
+ basic$data.setReporter(
2
+ alert
3
+ // <!--
4
+ && function (error, type) {
5
+ basic$data.setReporter(alert);
6
+ alert(error, type);
7
+ console.info(i18n`已使用默认的报错工具,您可以使用 ${"data.setReporter(error_reporter,error_finder)"} 替换! 本信息在仅在开发环境显示。`);
8
+ }
9
+ // -->
10
+ );
11
+ basic$data.setEnvs(cross, on, onmounted);
12
+ var updateLoadingCount = function () {
13
+ basic$data.loading_count = cross.requests.length;
14
+ };
15
+ on('render')(window, updateLoadingCount, true);
16
+ return basic$data;
@@ -53,13 +53,13 @@ var reshape = function () {
53
53
  };
54
54
  var checkValue = function () {
55
55
  if (!(this.src instanceof Array)) return;
56
- var { field, data } = this.$scope;
56
+ var scope = $scoped.get(this);
57
+ var { field, data } = scope;
57
58
  if (!field || !data) return;
58
59
  var v = data[field.key];
59
60
  if (!this.checked) if (v === this.oldValue || isEmpty(this.oldValue) && isEmpty(v)) return;
60
61
  this.checked = false;
61
62
  this.setAttribute("dirty", '');
62
- var scope = this.$scope;
63
63
  var error = valid(field, data);
64
64
  if (error) {
65
65
  this.setAttribute("error", error);
@@ -120,7 +120,7 @@ function main(elem) {
120
120
  if (head) addClass(head, "head");
121
121
  if (body) addClass(body, "body");
122
122
  if (foot) addClass(foot, "foot");
123
- elem.$renders.push(reshape);
123
+ elem.$renders = [reshape];
124
124
  }
125
125
  return elem;
126
126
  }
@@ -2,13 +2,14 @@ function main() {
2
2
  var items = new Array(100).fill(0).map((_, i) => ({ color: color.random(), name: "item " + (i + 1), height: Math.random() * 100 + 60 }));
3
3
  var layer = div();
4
4
  layer.innerHTML = template;
5
- renderWithDefaults(layer, {
5
+ var scope = {
6
6
  gallery,
7
7
  data: []
8
- });
8
+ };
9
+ renderWithDefaults(layer, scope);
9
10
  layer.querySelector("gallery").go(0);
10
11
  onappend(layer, function () {
11
- layer.$scope.data = items;
12
+ scope.data = items;
12
13
  });
13
14
  return layer;
14
15
  }
@@ -12,7 +12,7 @@ var getArgsChildren = function (args, from = 1) {
12
12
  else ith = null;
13
13
  }
14
14
  }
15
- else if (transition === false) {
15
+ else if (transition === false || transition === true || !isHandled(obj)) {
16
16
  children = [].concat(obj);
17
17
  }
18
18
  else {
@@ -0,0 +1,8 @@
1
+ function getChanged(current_props, previous_props) {
2
+ var changed = [];
3
+ keys(previous_props, current_props).forEach(function (key) {
4
+ if (key.charAt(0) === "$") return;
5
+ if (!isSame(current_props[key], previous_props[key])) changed.push(key);
6
+ });
7
+ return changed;
8
+ }
@@ -1,13 +1,13 @@
1
+ var renderIds = render.stepId;
1
2
  /**
2
3
  * @param {Element} template
3
4
  */
4
- var cloneChildNodes = function (template) {
5
+ var cloneChildNodes = function (template, structs, ids) {
5
6
  var cloned = template.cloneNode(true);
6
7
  var cNodes = cloned.childNodes;
7
- var tNodes = template.childNodes;
8
8
  for (var cx = 0, dx = cNodes.length; cx < dx; cx++) {
9
- cNodes[cx].$struct = tNodes[cx].$struct;
10
- cNodes[cx].$renderid = tNodes[cx].$renderid;
9
+ $structed.set(cNodes[cx], structs[cx]);
10
+ renderIds.set(cNodes[cx], ids[cx]);
11
11
  }
12
12
  return cNodes;
13
13
  }
@@ -23,12 +23,12 @@ var setitem = function (i, v) {
23
23
  if (isFunction(src.set)) return src.set(i);
24
24
  else return src[i] = v;
25
25
  }
26
- var createScope = function (container, index, com) {
26
+ var createScope = function (container, index, com, wrap) {
27
27
  var parsedSrc = container.$src;
28
28
  var wraped = undefined;
29
29
  var origin = com;
30
- if (container.$wrapItem) {
31
- com = container.$wrapItem(com);
30
+ if (wrap) {
31
+ com = wrap(com);
32
32
  }
33
33
  if (com.constructor === Item) {
34
34
  wraped = com;
@@ -60,30 +60,31 @@ var createScope = function (container, index, com) {
60
60
  newScope.$origin = origin;
61
61
  return newScope;
62
62
  }
63
- var update = function (scope, index) {
63
+ var update = function (scope, index, wrap) {
64
64
  var item = getitem.call(this, index);
65
65
  if (!isHandled(item) || item === scope.$origin) return;
66
- var newScope = createScope(this, index, item);
66
+ var newScope = createScope(this, index, item, wrap);
67
67
  extend(scope, newScope);
68
68
  }
69
-
69
+ var generatorScopes = new WeakMap;
70
+ var generators = new WeakMap;
71
+ var wrapItem1 = a => new Item(a);
70
72
  /**
71
73
  * @param {Element} container
72
74
  * @param {Element|string} tagName;
73
75
  */
74
76
  var getGenerator = function (container, tagName = 'item', wrapItem = false) {
75
77
  if (!container) return;
76
- var scopes = container.$parentScopes || [];
77
- if (container.$scope) scopes = scopes.concat(container.$scope);
78
- container.$generatorScopes = scopes;
79
- if (container.$generator) return container.$generator;
78
+ var generator = generators.get(container);
79
+ if (wrapItem) {
80
+ wrapItem = isFunction(wrapItem) ? wrapItem : wrapItem1;
81
+ }
82
+ if (generator) return generator;
83
+ var scopes = render.getScopes(container) || [];
80
84
  var template = document.createElement(container.tagName);
81
85
  var tagTemplate = isElement(tagName);
82
86
  var templates = [];
83
87
  var hasAfter = false;
84
- if (wrapItem) {
85
- container.$wrapItem = isFunction(wrapItem) ? wrapItem : Item;
86
- }
87
88
  for (let a of container.childNodes) {
88
89
  if (a.nodeType === 1 && a.hasAttribute('insert')) {
89
90
  if (!templates.length) a.$isbefore = true;
@@ -111,19 +112,21 @@ var getGenerator = function (container, tagName = 'item', wrapItem = false) {
111
112
 
112
113
  appendChild(template, templates);
113
114
  render.struct(templates);
115
+ var ids, structs;
114
116
  if (tagTemplate) {
115
- render.struct(tagName);
117
+ var tt = $structed.get(tagName);
116
118
  var template0 = templates[0];
117
- template0.$struct = render.mergeStruct(tagName.$struct, template0.$struct);
118
- template0.$renderid = tagName.$renderid;
119
+ tt = render.mergeStruct(tt, $structed.get(template0));
120
+ $structed.set(template0, tt);
121
+ renderIds.set(template0, renderIds.get(tagName));
119
122
  }
120
- if (templates.length) container.$template = template;
123
+
121
124
  /**
122
125
  * @param {number} index;
123
126
  * @param {Object} com;
124
127
  * @param {Element} element;
125
128
  */
126
- return container.$generator = function (index, com, element) {
129
+ generator = function (index, com, element) {
127
130
  if (com === undefined) {
128
131
  com = getitem.call(container, index);
129
132
  }
@@ -133,17 +136,22 @@ var getGenerator = function (container, tagName = 'item', wrapItem = false) {
133
136
  element = document.createElement(tagName);
134
137
  }
135
138
  else {
136
- var childNodes = cloneChildNodes(template);
139
+ var childNodes = cloneChildNodes(template, structs, ids);
137
140
  element = childNodes[0];
138
141
  if (childNodes.length > 1) element.with = Array.prototype.slice.call(childNodes, 1);
139
142
  }
140
- var scopes = container.$generatorScopes;
141
- var newScope = createScope(container, index, com);
142
- element.$scope = newScope;
143
- element.$parentScopes = scopes;
144
- element.$renders = [update.bind(container, newScope, index)];
143
+ var newScope = createScope(container, index, com, wrapItem);
144
+ element.$renders = [update.bind(container, newScope, index, wrapItem)];
145
145
  var newItem = render(element, newScope, scopes, false);
146
146
  if (element.with) newItem.with = render(element.with, newScope, scopes, false);
147
147
  return newItem;
148
148
  };
149
+ if (templates.length) {
150
+ generator.$template = template;
151
+ ids = Array.prototype.map.call(templates, a => renderIds.get(a));
152
+ structs = Array.prototype.map.call(templates, a => $structed.get(a));
153
+ }
154
+ generators.set(container, generator);
155
+ generator.scopes = scopes;
156
+ return generator;
149
157
  };
@@ -290,7 +290,7 @@ function grid(breakpoints) {
290
290
  }
291
291
  extend(grid, grid_prototype);
292
292
  if (!breakpoints) {
293
- if (grid.clientHeight || grid.$mounted) {
293
+ if (grid.clientHeight || $mounted.get(grid)) {
294
294
  createPointsWithChildren.call(grid);
295
295
  } else {
296
296
  on("append")(grid, createPointsWithChildren);
@@ -456,7 +456,7 @@ var grid_prototype = {
456
456
  run(this.breakpoints);
457
457
  },
458
458
  reshape() {
459
- if (this.$mounted || this.offsetWidth || this.offsetHeight) {
459
+ if (this.offsetWidth || this.offsetHeight || $mounted.get(this)) {
460
460
  this._reshape();
461
461
  } else {
462
462
  once("append")(this, this._reshape);
@@ -1,9 +1,12 @@
1
1
  function isMounted(parent) {
2
- if ("$mounted" in parent) return parent.$mounted;
2
+ var m = $mounted.get(parent);
3
+ if (m !== undefined) return m;
3
4
  var temp = parent;
4
5
  while (temp && temp !== document.documentElement) {
5
- if ("$mounted" in temp) {
6
- return parent.$mounted = temp.$mounted;
6
+ if ($mounted.has(temp)) {
7
+ var m = $mounted.get(temp);
8
+ $mounted.set(parent, m);
9
+ return m;
7
10
  }
8
11
  temp = temp.parentNode;
9
12
  }
@@ -29,9 +29,7 @@ function lattice(element, minWidth, _maxWidth, layers) {
29
29
  _box.group = boxCount;
30
30
  if (savedCount === boxCount) return;
31
31
  _box.clean();
32
- [].forEach.call(_box.children, function (c) {
33
- build(c);
34
- });
32
+ [].forEach.call(_box.children, build);
35
33
  return true;
36
34
  };
37
35
  if (layers) {
@@ -105,7 +103,7 @@ function main() {
105
103
  initMinWidth(arg);
106
104
  }
107
105
  });
108
- if (element && element.$scope) {
106
+ if (element && element.$src) {
109
107
  layers = null;
110
108
  }
111
109
  return lattice(element, minWidth || 240, maxWidth, layers);
@@ -185,8 +185,7 @@ function maps(config = {}) {
185
185
  canvas.map.refresh();
186
186
  canvas._default = canvas.map.defaultImage();
187
187
  };
188
- if (canvas.$mounted) reshape();
189
- else once("append")(canvas, reshape);
188
+ once("append")(canvas, reshape);
190
189
  bind('resize')(canvas, reshape);
191
190
 
192
191
  return canvas;
@@ -197,6 +197,7 @@ function main() {
197
197
  while (i < s.length) {
198
198
  src0.push.apply(src0, s.slice(i, i += 1000));
199
199
  }
200
+ elem.src = src0;
200
201
  });
201
202
  menuList(elem, src0, emit, direction);
202
203
  }
@@ -2,10 +2,11 @@ var preventDefault = function (e) { e.preventDefault() };
2
2
  function main(elem, scope, hasIcon) {
3
3
  var item = elem || document.createElement('menu-item');
4
4
  item.innerHTML = menuItem;
5
- if (isObject(scope) && scope !== item.$scope) {
5
+ var ms = $scoped.get(item);
6
+ if (isObject(scope) && scope !== ms) {
6
7
  }
7
- else if (item.$scope) {
8
- var scope = item.$scope;
8
+ else if (ms) {
9
+ var scope = ms;
9
10
  }
10
11
  var menu = scope;
11
12
  if (menu.menu || menu.$item) menu = menu.menu || menu.$item;
@@ -133,9 +133,7 @@ function main() {
133
133
  if (!item.length) return;
134
134
  var menu = item.menu;
135
135
  if (!menu) {
136
- var clone = template.cloneNode();
137
- clone.$parentScopes = page.$parentScopes;
138
- clone.$scope = page.$scope;
136
+ var clone =render.clone(template);
139
137
  clone.$src = src;
140
138
  clone.innerHTML = template.innerHTML;
141
139
  menu = item.menu = main(clone, item.children, active);
@@ -258,7 +256,7 @@ function main() {
258
256
  };
259
257
  var $scope = {
260
258
  "menu-item"(e, s) {
261
- if (e && s === e.$scope) s = itemName ? s[itemName] : s.$item.value;
259
+ if (e && s === $scoped.get(e)) s = itemName ? s[itemName] : s.$item.value;
262
260
  var a = button(
263
261
  menuItem(e, s, this.hasIcon)
264
262
  );
@@ -284,6 +282,7 @@ function main() {
284
282
  ItemTemplate.setAttribute("e-class", className);
285
283
  if (src.itemName) ItemTemplate.setAttribute("e-if", notHidden);
286
284
  ItemTemplate.innerHTML = menuItem.template;
285
+ page.src = items;
287
286
  var generator = getGenerator(page, ItemTemplate, (item) => {
288
287
  if (item.constructor !== Item) item = new Item(item);
289
288
  if (istoolbar) {
@@ -294,15 +293,15 @@ function main() {
294
293
  }
295
294
  return item;
296
295
  });
297
- page.$generatorScopes.push($scope);
298
- page.src = items;
296
+ var generatorScopes = generator.scopes;
297
+ generatorScopes.push($scope);
299
298
  list(page, generator, direction);
300
299
  if (!page.$renders) page.$renders = [];
301
300
  page.$renders.unshift(function () {
302
- this.$scope.hasIcon = hasIcon();
301
+ $scope.hasIcon = hasIcon();
303
302
  });
304
303
  var getMenu = function (a) {
305
- return a.$scope.$item;
304
+ return $scoped.get(a).$item;
306
305
  }
307
306
  page.open = function (a) {
308
307
  var amenu = getMenu(a);
@@ -22,12 +22,13 @@ function main() {
22
22
  ]
23
23
  }]
24
24
  }], 20);
25
- render(page, {
25
+ var scope = {
26
26
  ylist: menu,
27
27
  menus: []
28
- });
28
+ };
29
+ render(page, scope);
29
30
  on("append")(page, function () {
30
- page.$scope.menus = data;
31
+ scope.menus = data;
31
32
  page.querySelector("ylist").go(0)
32
33
  });
33
34
  return page;
@@ -56,9 +56,10 @@ var constructors = {
56
56
  return e;
57
57
  },
58
58
  success(e) {
59
+ var { field } = e;
59
60
  success(e);
60
61
  e.innerHTML = `<span ng-html="field.comment"></span>`;
61
- render(e.children, e.$scope, e.$parentScopes);
62
+ render(e.children, { field });
62
63
  return e;
63
64
  },
64
65
  switch: swap,
@@ -147,8 +148,8 @@ var constructors = {
147
148
  },
148
149
  "repeat"(_) {
149
150
  var elem = input();
151
+ var { field, data } = _;
150
152
  elem.$renders = [function () {
151
- var { field, data } = this.$scope;
152
153
  var { status } = this;
153
154
  var field_type = field.ref;
154
155
  var valid = this.value === data[field_type];
@@ -304,12 +305,15 @@ var getOptionsFrom = function () {
304
305
  var { data, field } = this;
305
306
  return data[field.options_from];
306
307
  };
307
- function setModel(ipt) {
308
+ function setModel(renders, ipt) {
308
309
  var elem = this;
309
310
  if (isHandled(ipt)) {
310
311
  if (isNode(ipt)) {
311
312
  var model = new Model(getScopeValue, setScopeValue, ipt);
312
- model.hook(elem, elem.field.option_to ? copyOptionData : true);
313
+ var binder = model.hook(elem, elem.field.option_to ? copyOptionData : true);
314
+ removeFromList(renders, elem.$binder);
315
+ renders.push(binder);
316
+ elem.$binder = binder;
313
317
  if (elem !== ipt) appendChild(elem, ipt);
314
318
  }
315
319
  else {
@@ -319,18 +323,19 @@ function setModel(ipt) {
319
323
  }
320
324
  function setBinder(elem, binder) {
321
325
  if (binder === elem.$binder) return;
322
- removeFromList(elem.$renders, elem.$binder);
326
+ var renders = $renders.get(elem);
327
+ removeFromList(renders, elem.$binder);
323
328
  remove(elem.childNodes);
324
329
  if (binder instanceof Binder) {
325
330
  binder.call(elem);
326
- elem.$renders.push(binder);
331
+ renders.push(binder);
327
332
  }
328
333
  else {
329
334
  var ipt = binder(elem);
330
335
  if (ipt && isFunction(ipt.then)) {
331
- ipt.then(setModel.bind(elem));
336
+ ipt.then(setModel.bind(elem, renders));
332
337
  }
333
- else setModel.call(elem, ipt);
338
+ else setModel.call(elem, renders, ipt);
334
339
  binder = null;
335
340
  }
336
341
  elem.$binder = binder;
@@ -350,11 +355,11 @@ var createOptionsMap = function (options) {
350
355
  }
351
356
  readonly_types.radio = readonly_types.select = readonly_types.swap;
352
357
  var findReaderForElement = function (type, e) {
353
- var editor = render.getFromScopes(type, e.$scope, e.$parentScopes);
358
+ var editor = render.findKey(type, e);
354
359
  if (isFunction(editor) && (editor.isreader || !editor.isediter) && editor.isreader !== false) return editor;
355
360
  };
356
361
  var findEditerForElement = function (type, e) {
357
- var editor = render.getFromScopes(type, e.$scope, e.$parentScopes);
362
+ var editor = render.findKey(type, e);
358
363
  if (isFunction(editor) && (editor.isediter || !editor.isreader) && editor.isediter !== false) return editor;
359
364
  };
360
365
  var markReader = function (readers) {
package/coms/zimoli/on.js CHANGED
@@ -270,19 +270,24 @@ function pending(h, event) {
270
270
  }
271
271
  return h;
272
272
  }
273
+ var changes = new WeakMap;
273
274
  var remove = function (k, hk, [eventtypes, handler, context]) {
274
275
  var element = this;
275
- var hs = element[hk];
276
+ var hs = hk.get(element);
276
277
  if (hs) {
277
278
  for (var cx = hs.length - 1; cx >= 0; cx--) {
278
279
  var [e, h, c] = hs[cx];
279
280
  if (h === handler && shallowEqual(e, eventtypes, 2) && c === context) {
280
281
  hs.splice(cx, 1);
281
- if (k === changes_key) element.$needchanges--;
282
+ if (k === changes_key) {
283
+ var i = changes.get(element) - 1;
284
+ if (i > 0) changes.set(element, i);
285
+ else changes.delete(element), $watches.delete(element);
286
+ };
282
287
  }
283
288
  }
284
289
  if (!hs.length && hs.h) {
285
- element[hk] = null;
290
+ hk.delete(element);
286
291
  if (element.removeEventListener) {
287
292
  element.removeEventListener(k, hs.h, getListenerOption(eventtypes, k));
288
293
  }
@@ -292,7 +297,7 @@ var remove = function (k, hk, [eventtypes, handler, context]) {
292
297
  };
293
298
  var broadcast = function (k, hk, event) {
294
299
  var element = this;
295
- var handlers = element[hk];
300
+ var handlers = hk.get(element);
296
301
  if (handlers.length > 1) handlers = handlers.slice();
297
302
  if (event.which === 1 && event.buttons === 0) {
298
303
  // firefox 无按键
@@ -341,35 +346,44 @@ var checkroot = function (element, k) {
341
346
  var append = function (k, hk, listener2, firstmost) {
342
347
  var [eventtypes, handler, context] = listener2;
343
348
  var element = this;
344
- var handlers = element[hk];
349
+ var handlers = hk.get(element);
345
350
  for (var [e, h, c, d] of handlers) {
346
351
  if (h === handler && c === context && shallowEqual(eventtypes, e, 2)) return d.dulp = true, d;
347
352
  }
348
353
  if (k === changes_key) {
349
- if (!element.$needchanges) element.$needchanges = 0;
350
- element.$needchanges++;
354
+ var i = changes.get(element) || 0;
355
+ changes.set(element, i + 1);
356
+ if (i === 0) {
357
+ if (!$watches.has(element)) $watches.set(element, {});
358
+ }
351
359
  }
352
360
  if (firstmost) handlers.unshift(listener2);
353
361
  else handlers.push(listener2);
354
362
  return listener2[3] = remove.bind(element, k, hk, listener2);
355
363
  };
356
-
364
+ var emitersMap = Object.create(null);
365
+ var getEmiters = function (k, eventtypes) {
366
+ k = k + +!!eventtypes.capture;
367
+ k = k + +!!eventtypes.passive;
368
+ var m = emitersMap[k];
369
+ if (!m) m = emitersMap[k] = new WeakMap;
370
+ return m;
371
+ }
357
372
  var on = document.efronton = function (k) {
358
373
  var on_event_path = "on" + k;
359
374
  if (handlersMap[on_event_path]) return handlersMap[on_event_path];
360
375
  var eventtypes = parseEventTypes(k);
361
376
  k = k.replace(eventtypereg, '');
362
- var handler_path = "$h_" + k;
363
- var hk = handler_path + +!!eventtypes.capture;
364
- if (supportPassive) hk += +!!eventtypes.passive;
377
+ var hk = getEmiters(k, is_addEventListener_enabled && eventtypes);
365
378
  if (is_addEventListener_enabled) var addhandler = function (context, handler, firstmost = false) {
366
379
  var target = this || context;
367
380
  target = checkroot(target, k);
368
- if (target[hk] instanceof Array) {
369
- } else {
381
+ var emiters = hk.get(target);
382
+ if (!emiters) {
370
383
  var h = broadcast.bind(target, k, hk);
371
- target[hk] = [];
372
- target[hk].h = h;
384
+ emiters = [];
385
+ emiters.h = h;
386
+ hk.set(target, emiters);
373
387
  if (target.addEventListener)
374
388
  target.addEventListener(k, h, getListenerOption(eventtypes, k));
375
389
  else target[on_event_path] = h;
@@ -385,8 +399,8 @@ var on = document.efronton = function (k) {
385
399
  firstmost = true;
386
400
  }
387
401
  target = checkroot(target, k);
388
- if (target[handler_path] instanceof Array) {
389
- } else {
402
+ var emiters = hk.get(target);
403
+ if (!emiters) {
390
404
  var h = function (e) {
391
405
  if (!e) e = window.event || {};
392
406
  if (!e.target && e.srcElement) {
@@ -411,16 +425,18 @@ var on = document.efronton = function (k) {
411
425
  if (e.keyCode) {
412
426
  if (e.which === undefined) e.which = e.keyCode;
413
427
  }
414
- broadcast.call(target, k, handler_path, e);
428
+ broadcast.call(target, k, hk, e);
415
429
  return e.returnValue;
416
430
  };
417
- target[handler_path] = target["on" + k] && target["on" + k] !== handler ? [[{}, target["on" + k]]] : [];
418
- target[handler_path].h = h;
419
- target["on" + k] = h;
420
-
431
+ var emiters = [];
432
+ emiters.h = h;
433
+ var h0 = target[on_event_path];
434
+ if (h0 && h0 !== h) emiters.push([{}, h0, target]);
435
+ hk.set(target, emiters);
436
+ target[on_event_path] = h;
421
437
  }
422
438
  var listener = [eventtypes, handler, context];
423
- return append.call(target, k, handler_path, listener, firstmost);
439
+ return append.call(target, k, hk, listener, firstmost);
424
440
  }, addhandler = function (context, handler, firstmost) {
425
441
  return _addhandler(context, context, handler, firstmost);
426
442
  };
@@ -47,13 +47,6 @@ var create = function (url, key, report_error) {
47
47
  remove(p);
48
48
  };
49
49
  image.park = function (x, y, scaled, rotate) {
50
- var style = get_style(x, y, scaled, rotate);
51
- var a = transition(imgpic, style, true);
52
- setTimeout(function () {
53
- // set_unlock();
54
- // image.locked = false;
55
- }, a || 0);
56
-
57
50
  };
58
51
  var init = function () {
59
52
  if (!imgpic) return;
@@ -27,20 +27,20 @@ var popup = function (path) {
27
27
  throw new Error(i18n`参数异常:${path}`);
28
28
  };
29
29
  var onAppendUp = function () {
30
- var upwith = this.$upwith;
30
+ var upwith = $upwith.get(this);
31
31
  if (isArray(upwith) && upwith.indexOf(this) < 0) {
32
32
  upwith.push(this);
33
33
  }
34
34
  };
35
35
  var onRemoveUp = function () {
36
- var upwith = this.$upwith;
36
+ var upwith = $upwith.get(this);
37
37
  if (isArray(upwith)) {
38
38
  removeFromList(upwith, this);
39
39
  }
40
40
  };
41
41
  var setUpwith = function (page, upwith) {
42
42
  if (!isArray(upwith)) return;
43
- page.$upwith = upwith;
43
+ $upwith.set(page, upwith);
44
44
  on('append')(page, onAppendUp);
45
45
  on('remove')(page, onRemoveUp);
46
46
  };
@@ -365,7 +365,7 @@ var _as_yextra = function (global, innerWidth, innerHeight, element, target, poi
365
365
  };
366
366
  var _as_xextra = arriswise(_as_yextra, arguments);
367
367
  var popup_as_single = function (element, z) {
368
- if (!isMounted(element)) css(element, `z-index:${Number.isFinite(z) ? z : zIndex()};`);
368
+ if (!isMounted(element)) css(element, `z-index:${isFinit(z) ? z : zIndex()};`);
369
369
  global(element, false);
370
370
  };
371
371
  var popup_to_point = function (element, [x, y]) {
@@ -427,7 +427,7 @@ popup.upwith = function (collects) {
427
427
  };
428
428
  var global = function (element, issingle) {
429
429
  once("remove")(element, cleanup);
430
- var upwith = element.$upwith || rootElements;
430
+ var upwith = $upwith.get(element) || rootElements;
431
431
  if (upwith.indexOf(element) < 0) upwith.push(element);
432
432
  if (isMounted(element)) return;
433
433
  popup.global &&
@@ -27,7 +27,7 @@ function main(elem = document.createElement("radio-group")) {
27
27
  }
28
28
  });
29
29
  elem.setValue = function (key) {
30
- var { options } = this.$scope;
30
+ var { options } = $scoped.get(this);
31
31
  if (!(options instanceof Array)) return;
32
32
  var index = options.map(a => getValue(a)).indexOf(key);
33
33
  options.active = options[index];
@@ -33,14 +33,14 @@ function hasLeaveStyle(o) {
33
33
  }
34
34
 
35
35
  function _onremove(node, event) {
36
- if (!node || node.$mounted === false) return;
36
+ if (!node || $mounted.get(node) === false) return;
37
37
  var children = node.childNodes;
38
- if (node.$mounted) {
38
+ if ($mounted.get(node)) {
39
39
  if (!event) {
40
40
  event = createEvent("remove");
41
41
  }
42
42
  dispatch(node, event);
43
- node.$mounted = false;
43
+ $mounted.set(node, false);
44
44
  }
45
45
  if (children) for (var cx = 0, dx = children.length; cx < dx; cx++) {
46
46
  _onremove(children[cx], event);