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
@@ -49,8 +49,8 @@ onhashchange(window, function (event) {
49
49
  });
50
50
  // body
51
51
  var location_pathname = location.pathname;
52
- var _zimoli_params_key = `_zimoli_parameters:${location_pathname}#`;
53
- var _zimoli_state_prefix = `_zimoli_page_state:${location_pathname}#`;
52
+ var _zimoli_params_key = `紫茉莉:${location_pathname}#`;
53
+ var _zimoli_state_prefix = `茉莉紫:${location_pathname}#`;
54
54
 
55
55
  function getReverseStyle(style) {
56
56
  if (!isObject(style)) {
@@ -120,54 +120,28 @@ function go(pagepath, args, history_name, oldpagepath) {
120
120
  return true;
121
121
  }
122
122
  var realpath = getpgpath(pagepath);
123
- if (realpath.length > 1) var [pgpath, args0] = realpath;
123
+ if (realpath.length > 1) var [pgpath] = realpath;
124
124
  else pgpath = pagepath;
125
- setZimoliParams(pagepath, { data: args, from: oldpagepath, options, roles, id });
125
+ var params = { data: args, from: oldpagepath, options, roles, id };
126
+ setZimoliParams(pagepath, params);
126
127
  if (!page_generators[pgpath]) {
127
128
  return zimoli(pagepath, args, history_name, oldpagepath);
128
129
  }
129
- var page_object = page_generators[pgpath];
130
- if (!isEmpty(args0)) page_object.state.data = args, args = args0;
131
- var fullfill = function () {
132
- zimoliad = zimoliid;
133
- var _page = create(pgpath, args, oldpagepath);
134
- var isRecover = pushstate(pagepath, history_name, oldpagepath);
135
- if (isNode(history_name)) {
136
- if (history_name.activate === pagepath && history_name.activateNode === _page) return fullfill_is_dispatched--;
137
- else remove(history_name.activateNode);
138
- history_name.activate = pagepath;
139
- history_name.activateNode = _page;
140
- }
141
- else if (isString(pagepath)) {
142
- if (fullfill_is_dispatched > 0) return;
143
- fullfill_is_dispatched = 1;
144
- var event = createEvent("zimoli");
145
- event.$reload = fullfill;
146
- event.zimoli = {
147
- path: pagepath,
148
- roles,
149
- data: args,
150
- target: _page,
151
- id,
152
- options
153
- };
154
- dispatch(document, event);
155
- fullfill_is_dispatched = 0;
156
- }
157
- if (isRecover) setWithStyle(_page, false);
158
- addGlobal(_page, history_name, isRecover);
159
- page_object.prepares.splice(0, page_object.prepares.length).forEach(function (url) {
160
- if (isNumber(url)) {
161
- url = _history[url < 2 ? _history.index + url : url];
162
- }
163
- if (isString(url)) prepare(url);
164
- });
165
- if (_page) {
166
- _page.$reload = fullfill;
167
- }
168
- return _page;
169
- };
170
- return fullfill();
130
+ var page = create(pagepath, args, oldpagepath, roles, params);
131
+ zimoliad = zimoliid;
132
+ var isRecover = pushstate(pagepath, history_name, oldpagepath);
133
+ if (isNode(history_name)) {
134
+ if (history_name.activate === pgpath && history_name.activateNode === page) return;
135
+ else remove(history_name.activateNode);
136
+ history_name.activate = pgpath;
137
+ history_name.activateNode = page;
138
+ }
139
+ else if (isString(pgpath)) {
140
+ page.disptch();
141
+ }
142
+ if (isRecover) setWithStyle(page, false);
143
+ addGlobal(page, history_name, isRecover);
144
+ return page;
171
145
  }
172
146
  var page_generators = {};
173
147
  /**
@@ -359,29 +333,40 @@ function prepare(pgpath, ok) {
359
333
  emit(pg);
360
334
  }, state, true);
361
335
  }
362
- function create(pagepath, args, from, needroles) {
336
+ function create(pagepath, args, from, needroles, zimolidata) {
337
+ if (zimolidata) {
338
+ if (!isHandled(args)) args = zimolidata.data;
339
+ if (!isHandled(needroles)) needroles = zimolidata.roles;
340
+ }
363
341
  if (typeof pagepath === 'string') {
364
- var page_object = page_generators[pagepath];
342
+ var [pgpath, args0] = getpgpath(pagepath);
343
+ var page_object = page_generators[pgpath];
344
+ if (!isEmpty(args0)) page_object.state.data = args, args = args0;
345
+ }
346
+ else pgpath = pagepath;
347
+ if (typeof pgpath === 'string') {
348
+ var page_object = page_generators[pgpath];
365
349
  if (!page_object) {
366
- throw new Error(i18n`调用create前请确保prepare执行完毕:${pagepath}`);
350
+ throw new Error(i18n`调用create前请确保prepare执行完毕:${pgpath}`);
367
351
  }
368
352
  var { pg, "with": _with_elements, state, onback: _pageback_listener, roles } = page_object;
369
353
  }
370
- else if (isFunction(pagepath)) {
371
- var pg = pagepath;
354
+ else if (isFunction(pgpath)) {
355
+ var pg = pgpath;
372
356
  var { with: _with_elements = [], state = {}, onback: _pageback_listener, roles } = pg;
373
357
  }
358
+ var h = history[current_history];
374
359
  if (!checkroles(user.roles, roles) || !checkroles(user.roles, needroles)) {
375
360
  // 检查权限
376
361
  if (!user.isLogin && user.loginPath) {
377
362
  var pg = create(user.loginPath);
378
- history[current_history].wardable = false;
363
+ if (h) h.wardable = false;
379
364
  return pg;
380
365
  }
381
- return alert(i18n`没有权限!`, 0);
366
+ return zimoli.alert(i18n`没有权限!`, 0);
382
367
  }
383
368
  if (!pg) return;
384
- if (history[current_history]) history[current_history].wardable = true;
369
+ if (h) h.wardable = true;
385
370
  var _with_length = _with_elements.length;
386
371
  state.onback = function (handler) {
387
372
  _pageback_listener = handler;
@@ -418,7 +403,33 @@ function create(pagepath, args, from, needroles) {
418
403
  if (isEmpty(_page.onback)) {
419
404
  _page.onback = _pageback_listener;
420
405
  }
406
+ _page.disptch = function () {
407
+ if (!zimolidata) return;
408
+ zimoli.upwith = state.upwith;
409
+ if (fullfill_is_dispatched > 0) return;
410
+ fullfill_is_dispatched = 1;
411
+ var event = createEvent("zimoli");
412
+ event.$reload = _page.$reload.bind(_page);
413
+ zimolidata.target = _page;
414
+ zimolidata.path = pagepath;
415
+ event.zimoli = zimolidata;
416
+ dispatch(document, event);
417
+ fullfill_is_dispatched = 0;
418
+ }
419
+ _page.$reload = function () {
420
+ var _page = create(pagepath, undefined, from, undefined, zimolidata);
421
+ appendChild.replace(this, _page);
422
+ return _page;
423
+ };
421
424
  }
425
+ if (!page_object) return _page;
426
+ var _history = history[current_history];
427
+ if (_history) page_object.prepares.splice(0, page_object.prepares.length).forEach(function (url) {
428
+ if (isNumber(url)) {
429
+ url = _history[url < 2 ? _history.index + url : url];
430
+ }
431
+ if (isString(url)) prepare(url);
432
+ });
422
433
  return _page;
423
434
 
424
435
  }
@@ -460,7 +471,7 @@ var global = {};
460
471
  var history = {};
461
472
  var current_history, default_history = current_history = "";
462
473
  history[current_history] = createEmptyHistory('/main', false);
463
- var history_session_object_key = `_zimoli_history_key:${location_pathname}`;
474
+ var history_session_object_key = `紫茉莉:${location_pathname}`;
464
475
  try {
465
476
  history = JSAM.parse(historyStorage.getItem(history_session_object_key)) || history;
466
477
  } catch (e) {
@@ -676,7 +687,7 @@ function addGlobal(element, name = null, isBack) {
676
687
  if (isBack) appendChild.insert(body, element);
677
688
  else appendChild(body, element);
678
689
  }
679
- var upwith = element.$upwith || rootElements;
690
+ var upwith = $upwith.get(element) || rootElements;
680
691
  if (upwith.indexOf(element) < 0) upwith.push(element);
681
692
  }
682
693
  if (hasLock) fixurl(), fixLock = false;
@@ -730,6 +741,8 @@ rootElements.splice = function () {
730
741
  appendChild.transition = transition;
731
742
  remove.transition = transition;
732
743
  zimoli.prepare = prepare;
744
+ var upwith = [];
745
+ zimoli.upwith = popup.upwith(upwith);
733
746
  zimoli.setStorage = function (storage) {
734
747
  historyStorage = storage;
735
748
  try {
@@ -800,8 +813,7 @@ zimoli.enableTouchBack = function () {
800
813
  var path0 = historyList[historyList.index - 1];
801
814
  prepare(path0, function () {
802
815
  if (id !== touchId) return;
803
- var args = getZimoliParams(path0).data;
804
- backwardTarget = create(path0, args, path1);
816
+ backwardTarget = create(path0, null, path1, null, getZimoliParams(path0));
805
817
  setWithStyle(backwardTarget, true);
806
818
  appendChild.insert(body, backwardTarget);
807
819
  });
@@ -814,8 +826,7 @@ zimoli.enableTouchBack = function () {
814
826
  var path2 = historyList[historyList.index + 1];
815
827
  prepare(path2, function () {
816
828
  if (id !== touchId) return;
817
- var args = getZimoliParams(path2).data;
818
- forwardTarget = create(path2, args, path1);
829
+ forwardTarget = create(path2, null, path1, null, getZimoliParams(path2));
819
830
  setWithStyle(forwardTarget, false);
820
831
  appendChild.insert(body, forwardTarget);
821
832
  });
@@ -838,6 +849,7 @@ zimoli.enableTouchBack = function () {
838
849
  transition(backwardTarget, 1);
839
850
  global[history_name] = backwardTarget;
840
851
  fixurl();
852
+ backwardTarget.disptch();
841
853
  }
842
854
  else if (historyList.index < historyList.length - 1 && (deltaX < 0 && ratio < -.1 || deltaX > 0 && ratio < -.9 || deltaX === 0 && ratio < -.4)) {
843
855
  pushstate(historyList[historyList.index + 1], history_name);
@@ -847,6 +859,7 @@ zimoli.enableTouchBack = function () {
847
859
  transition(forwardTarget, 1);
848
860
  global[history_name] = forwardTarget;
849
861
  fixurl();
862
+ forwardTarget.disptch();
850
863
  }
851
864
  else {
852
865
  if (backwardTarget) setWithStyle(backwardTarget, false), remove(backwardTarget);
@@ -860,4 +873,9 @@ zimoli.enableTouchBack = function () {
860
873
  ratio = null;
861
874
  }
862
875
  }, 'x')
876
+ };
877
+ zimoli.alert = function () {
878
+ var ae = alert.apply(this, arguments);
879
+ zimoli.upwith(ae.parentNode);
880
+ return ae;
863
881
  };
@@ -10,4 +10,6 @@
10
10
 
11
11
  4.0 No longer relying on `typescript` (nearly 170000 lines of source code), the compilation speed has increased by four times, the memory usage has been reduced to 1/8 of the original, and the self compilation time on GitHub has also been reduced to about 15 seconds.
12
12
 
13
- 4.1 No longer relying on `less-node` or `pngjs`, while the `less-node` is replaced with [suxin](https://www.npmjs.com/package/suxin) from `efront`.
13
+ 4.1 No longer relying on `less-node` or `pngjs`, while the `less-node` is replaced with [suxin](https://www.npmjs.com/package/suxin) from `efront`.
14
+
15
+ 4.23 The `zimoli` library has adjusted the component rendering method to provide a relatively clean DOM for developers. When calling methods such as `on` and `render`, associated data is no longer attached to DOM elements (except for browsers without WeakMap). Code that uses corresponding underlying features needs to be modified.
@@ -10,4 +10,6 @@
10
10
 
11
11
  4.0版本 不再依赖`typescipt`(近17万行源码),编译速度再次提升4倍,占用内存减少到原来的1/8,github上自我编译时间也减少到15秒左右。
12
12
 
13
- 4.1版本 不再依赖`less-node`和`pngjs`,其中`less-node` 由`efront`自建的css工具[素馨](https://www.npmjs.com/package/suxin)代替。
13
+ 4.1版本 不再依赖`less-node`和`pngjs`,其中`less-node` 由`efront`自建的css工具[素馨](https://www.npmjs.com/package/suxin)代替。
14
+
15
+ 4.23版本 紫茉莉库`zimoli`调整组件渲染方式,给开发一个相对干净的DOM,调用`on`和`render`等方法时,不再将关联的数据挂载到dom元素,(无WeakMap的浏览器除外),用到相应的底层特性的代码需要修改。
@@ -286,7 +286,20 @@
286
286
  }
287
287
  }
288
288
  var argNames = Object.keys(envs);
289
- var args = await Promise.all(argNames.map(a => init(a + "*" + live, null, { ["init*" + live]: init, ["put*" + live]: put, ["zimoli*" + live]: zimoli, ["appendChild*" + live]: appendChild, ["remove*" + live]: remove, ["render*" + live]: render })));
289
+ var args = await Promise.all(argNames.map(a => init(a + "*" + live, null, {
290
+ ["init*" + live]: init,
291
+ ["put*" + live]: put,
292
+ ["zimoli*" + live]: zimoli,
293
+ ["appendChild*" + live]: appendChild,
294
+ ["remove*" + live]: remove,
295
+ ["render*" + live]: render,
296
+ ["$structed*" + live]: $structed,
297
+ ["$scoped*" + live]: $scoped,
298
+ ["$parented*" + live]: $parented,
299
+ ["$mounted*" + live]: $mounted,
300
+ ["$watches*" + live]: $watches,
301
+ ["$renders*" + live]: $renders,
302
+ })));
290
303
  var func = createFunction("", jstext, argNames, code.async, code.yield);
291
304
  var res = func.apply(window, args);
292
305
  if (isFunction(res)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.22.19",
3
+ "version": "4.23.3",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {