efront 3.35.13 → 3.36.0

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 (40) hide show
  1. package/apps/blank/index.html +1 -21
  2. package/apps/blank/main.js +1 -1
  3. package/apps/kugou/singer/keywords.less +1 -0
  4. package/apps/sciters/main.js +31 -0
  5. package/coms/basic/#loader.js +3 -4
  6. package/coms/basic/i18n.js +25 -0
  7. package/coms/basic/i18n.md +10 -0
  8. package/coms/basic/parseYML.js +1 -0
  9. package/coms/basic/refilm_decode.js +2 -1
  10. package/coms/basic/strings.js +3 -3
  11. package/coms/compile/Javascript.js +1 -20
  12. package/coms/compile/autoi18n.js +17 -0
  13. package/coms/compile/autoi18n_test.js +6 -0
  14. package/coms/compile/common.js +22 -0
  15. package/coms/compile/namelist.js +19 -11
  16. package/coms/compile/translate.js +131 -0
  17. package/coms/compile/wraphtml.js +3 -0
  18. package/coms/docs/md5.js +174 -0
  19. package/coms/frame/route.js +1 -1
  20. package/coms/zimoli/XMLHttpRequest.js +33 -1
  21. package/coms/zimoli/alert.js +1 -1
  22. package/coms/zimoli/appendChild.js +2 -1
  23. package/coms/zimoli/button.less +1 -0
  24. package/coms/zimoli/createEvent.js +8 -3
  25. package/coms/zimoli/cross.js +1 -1
  26. package/coms/zimoli/cross_test.js +8 -2
  27. package/coms/zimoli/forceUpdate.js +2 -6
  28. package/coms/zimoli/list.js +1 -0
  29. package/coms/zimoli/on.js +4 -2
  30. package/coms/zimoli/render.js +5 -2
  31. package/coms/zimoli/transition.js +4 -5
  32. package/coms/zimoli/tree.js +12 -9
  33. package/coms/zimoli/zimoli.js +3 -3
  34. package/docs/index.html +1 -12
  35. package/docs/main.xht +2 -1
  36. package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +578 -0
  37. package/package.json +1 -1
  38. package/public/efront.js +1 -1
  39. package/readme.md +1 -1
  40. package/coms/zimoli/i18n.js +0 -192
@@ -1 +1,33 @@
1
- this.XMLHttpRequest || this.ActiveXObject.bind(null, 'Microsoft.XMLHTTP')
1
+ if (this.XMLHttpRequest) return this.XMLHttpRequest;
2
+ if (this.ActiveXObject) return this.ActiveXObject.bind(null, 'Microsoft.XMLHTTP');
3
+ if (!this.fetch) return;
4
+ var window = this;
5
+ return class XMLHttpRequest {
6
+ onload = null;
7
+ onerror = null;
8
+ onreadystatechange = null;
9
+ readyState = 0;
10
+ fetch = window.fetch;
11
+ open(method, url) {
12
+ this.readyState = 1;
13
+ this.method = method;
14
+ this.url = url;
15
+ }
16
+ send(data) {
17
+ var u = new URL(this.url);
18
+ if (!u.host) u.host = location.host || 'localhost'
19
+ this.fetch(this.url, { method: this.method }).then(d => {
20
+
21
+ this.fetched = d;
22
+ this.readyState = 4;
23
+ this.status = d.status;
24
+ this.responseText = d.text();
25
+ if (this.onreadystatechange) this.onreadystatechange({ target: this });
26
+ if (this.onload) this.onload({ target: this });
27
+ }, e => {
28
+ this.readyState = 4;
29
+ if (this.onreadystatechange) this.onreadystatechange({ target: this });
30
+ if (this.onerror) this.onerror({ target: this });
31
+ });
32
+ }
33
+ }
@@ -26,7 +26,7 @@ var _text = function (bgcolor, parameters) {
26
26
  var box = div();
27
27
  css(box, `top:${fromPixel(alerts.length ? Math.max.apply(Math, alerts.map(e => e.offsetTop + e.children[0].offsetHeight)) : 0)};height:0;line-height:${fromPixel(singleHeight - 20)};left:0;right:0;font-size:${fromPixel(fontSize)}; transition: all 0.2s ease-out;position:absolute;text-align:center;`);
28
28
  box.innerHTML = `<div style='width: 720px;white-space:pre-wrap;max-width:100%;display:inline-block;height:auto;padding:${fromPixel(10)} ${fromPixel(20)};background-color:${bgcolor};color:${color.pair(bgcolor, 1)};'>${[].slice.call(parameters, 0).join(", ")}</div>`;
29
- box.initialStyle = `margin:-${fromPixel(singleHeight)} auto;opacity:0;`;
29
+ box.initialStyle = `margin-top:-${fromPixel(singleHeight)};opacity:0;`;
30
30
  return box;
31
31
  };
32
32
  function alert() {
@@ -10,7 +10,8 @@ function hasEnterStyle(e) {
10
10
 
11
11
  function _onappend(node, append = createEvent("append"), mount = createEvent("mounted")) {
12
12
  if (node.isMounted) return;
13
- if (node.nodeType === 1 || node.nodeType === 8) node.isMounted = true;
13
+ node.isMounted = true;
14
+ if (node.nodeType !== 1 && node.nodeType !== 8) return;
14
15
  dispatch(node, append);
15
16
  var children = Array.apply(null, node.childNodes);
16
17
  for (var c of children) {
@@ -16,6 +16,7 @@
16
16
  text-align: center;
17
17
  overflow: hidden;
18
18
  outline: none;
19
+ appearance: none;
19
20
  user-select: none;
20
21
  }
21
22
 
@@ -1,12 +1,17 @@
1
1
  /**
2
2
  * 创建自定义事件
3
3
  */
4
- var createEvent = "createEvent" in document ? function createEvent(eventName, canBubble = false, cancelable = true) {
4
+ if ("createEvent" in document) var createEvent = function createEvent(eventName, canBubble = false, cancelable = true) {
5
5
  var event = document.createEvent("Event");
6
6
  event.initEvent(eventName, canBubble, cancelable);
7
7
  return event;
8
- } : function createEventObject(eventName) {
8
+ }
9
+ else if ("createEventObject" in document) var createEvent = function createEventObject(eventName) {
9
10
  var event = document.createEventObject();
10
11
  event.type = eventName;
11
12
  return event;
12
- };
13
+ }
14
+ else var Event = window.Event, createEvent = function (eventName) {
15
+ var event = new Event(eventName);
16
+ return event;
17
+ }
@@ -72,4 +72,4 @@ cross.addCookie = function (cookie_text, dp) {
72
72
  cross.delCookies = function (dp) {
73
73
  return cookie.delCookies(dp);
74
74
  };
75
- if (cross_host) cross.setHost(cross_host);
75
+ if (cross_host) cross.setHost(cross_host);
@@ -1,4 +1,10 @@
1
- function main() {
1
+ async function main() {
2
2
  cross.addDirect('//baidu.com/');
3
- cross("fpost", 'http://baidu.com').data({ a: 1 }).done(console.log);
3
+ try{
4
+ var xhr = await cross("fpost", 'http://baidu.com');
5
+ console.log(xhr.responseText);
6
+ }
7
+ catch(e){
8
+ console.error(String(e));
9
+ }
4
10
  }
@@ -1,9 +1,6 @@
1
1
  var { window, location, preventCache = true, parseInt, navigator, Date } = this;
2
2
  var start_time = +new Date / 1000 | 0;
3
- while (true) {
4
- if (!preventCache) {
5
- break;
6
- }
3
+ if (preventCache && navigator) {
7
4
 
8
5
  var page_time = location.search.replace(/^.*?[\?&]\=([^&]+).*?$/i, "$1");
9
6
  page_time = parseInt(page_time, 36) || 0;
@@ -21,7 +18,6 @@ while (true) {
21
18
  } else {
22
19
  search = "=" + mark_time.toString(36);
23
20
  }
24
- if (!/Safari|Firefox/.test(navigator.userAgent)) location.replace(location.pathname + "?" + search);
21
+ if (!/Safari|Firefox|Sciter/.test(navigator.userAgent)) location.replace(location.pathname + "?" + search);
25
22
  }
26
- break;
27
23
  }
@@ -618,6 +618,7 @@ function list() {
618
618
  }
619
619
  var savedSrc = [];
620
620
  if (bindSrc === true) care(container, function (src, old) {
621
+ if (container.src !== src) return;
621
622
  var index = container.index();
622
623
  if (src !== old) container.clean(), index = 0;
623
624
  else container.clean(src, savedSrc);
package/coms/zimoli/on.js CHANGED
@@ -268,7 +268,7 @@ var remove = function (k, hk, [eventtypes, handler, context]) {
268
268
  }
269
269
  if (!hs.length && hs.h) {
270
270
  element[hk] = null;
271
- if (is_addEventListener_enabled) {
271
+ if (element.removeEventListener) {
272
272
  element.removeEventListener(k, hs.h, getListenerOption(eventtypes, k));
273
273
  } else {
274
274
  if (element["on" + k] === hs.h) element["on" + k] = null;
@@ -354,7 +354,9 @@ var on = document.efronton = function (k) {
354
354
  var h = broadcast.bind(target, k, hk);
355
355
  target[hk] = [];
356
356
  target[hk].h = h;
357
- target.addEventListener(k, h, getListenerOption(eventtypes, k));
357
+ if (target.addEventListener)
358
+ target.addEventListener(k, h, getListenerOption(eventtypes, k));
359
+ else target[on_event_path] = h;
358
360
  }
359
361
  var listener = [eventtypes, handler, context];
360
362
  append.call(target, k, hk, listener, firstmost);
@@ -753,7 +753,6 @@ function renderElement(element, scope = element.$scope, parentScopes = element.$
753
753
  }
754
754
  element.$parentScopes = parentScopes || [];
755
755
  var s = createStructure(element);
756
-
757
756
  if (isEmpty(s.once)) s.once = once;
758
757
  element.$eval = $eval;
759
758
  }
@@ -888,7 +887,11 @@ function createStructure(element) {
888
887
  if (isArrayLike(element)) return Array.prototype.map.call(element, createStructure);
889
888
  if (element.$struct) return element.$struct;
890
889
  // 处理结构流
891
- var attrs = Array.apply(null, element.attributes);
890
+ var attributes = element.attributes;
891
+ var attrs = Array.apply(null, attributes);
892
+ if (attributes.length && !attributes[0]) {
893
+ for (var cx = 0, dx = attributes.length; cx < dx; cx++) attrs[cx] = attributes.item(cx);
894
+ }
892
895
  var types = {};
893
896
  var emiter_reg = /^(?:(v|ng|on|once)?\-|v\-on\:|@|once|on)/i;
894
897
  var ons = [];
@@ -97,12 +97,11 @@ function 帧样式(style, captureStyle, point) {
97
97
  function InnerStyle(o) {
98
98
  for (var k in o) {
99
99
  var v = o[k];
100
- this[css.transformNodeKey(k)] = css.transformValue(v);
100
+ this[css.transformNodeKey(k)] = css.transformValue(v, k);
101
101
  }
102
102
  }
103
103
 
104
104
  var transitionKey = css.transformNodeKey("transition");
105
-
106
105
  function transition(target, _isLeave, _initialStyle) {
107
106
  if (!target) return;
108
107
  if ((isObject(_isLeave) || typeof _isLeave === "string") && (isFinite(_initialStyle) || !_initialStyle)) {
@@ -140,13 +139,13 @@ function transition(target, _isLeave, _initialStyle) {
140
139
  clearTimeout(transitionTimerEnd);
141
140
  var transitionDuration = 100;
142
141
  if (!initialStyle[transitionKey]) {
143
- initialStyle[transitionKey] = "all .3s ease";
142
+ initialStyle[transitionKey] = Object.keys(initialStyle).map(k => k.replace(/[A-Z]/g, a => "-" + a.toLowerCase()) + " .3s ease").join(",");
144
143
  transitionDuration = 300;
145
144
  }
146
- String(initialStyle[transitionKey]).replace(/([\.\d]+)(m?)s/gi, function (m, d, t) {
145
+ initialStyle[transitionKey] = String(initialStyle[transitionKey]).replace(/([\.\d]+)(m?)s/gi, function (m, d, t) {
147
146
  if (t) transitionDuration = Math.max(+d, transitionDuration);
148
147
  else transitionDuration = Math.max(d * 1000, transitionDuration);
149
- return m;
148
+ return transitionDuration + "ms";
150
149
  });
151
150
  transitionDuration = transitionDuration || 260;
152
151
  if (!recoverStyle) recoverStyle = {};
@@ -48,6 +48,11 @@ function tree() {
48
48
  clearTimeout(timer);
49
49
  timer = setTimeout(call, time);
50
50
  };
51
+ care(element, function () {
52
+ banner.setData(this.src);
53
+ this.src = root;
54
+ });
55
+
51
56
  var banner = list(element, function (index) {
52
57
  var coms = dom;
53
58
  if (index >= coms.length) return;
@@ -184,6 +189,7 @@ function tree() {
184
189
  };
185
190
  com.forEach(z);
186
191
  setState();
192
+ css(banner, { paddingBottom: '' });
187
193
  };
188
194
  var time = size => (Math.log(-size / 30 + 2) * 100 | 0) / 1000;
189
195
  if (com.isClosed() && com.length) {
@@ -198,6 +204,7 @@ function tree() {
198
204
  } else {
199
205
  marginTop = top.offsetTop - bottom.offsetTop - bottom.offsetHeight;
200
206
  }
207
+ css(banner, { paddingBottom: -marginTop });
201
208
  var res = transition(top, {
202
209
  transition: `margin-top ${time(marginTop)}s ease-out`,
203
210
  marginTop: fromOffset(marginTop)
@@ -216,8 +223,10 @@ function tree() {
216
223
  }
217
224
  setState(false);
218
225
  z0();
226
+ var paddingBottom = -margin_top;
227
+ css(banner, { paddingBottom });
219
228
  var res = transition(change_elem, { transition: `margin-top ${time(margin_top)}s ease-out`, marginTop: fromOffset(margin_top) }, false);
220
- timeout(z1, res);
229
+ timeout(z1, res + 60);
221
230
  }
222
231
  });
223
232
 
@@ -229,9 +238,6 @@ function tree() {
229
238
  root = new Tree(src);
230
239
  refresh();
231
240
  };
232
- care(banner, function () {
233
- this.setData(this.src);
234
- });
235
241
  banner.addData = function (data, parent = root) {
236
242
  appendTo(parent, data);
237
243
  refresh();
@@ -240,12 +246,9 @@ function tree() {
240
246
  var index = banner.index();
241
247
  var needremoves = dom.map(d => d.target).filter(d => !!d);
242
248
  dom = getArrayFromTree(root, true);
243
- needremoves.forEach(_div => {
244
- delete _div.initialStyle;
245
- css(_div, "transition:;margin-top:;");
246
- });
247
- remove(needremoves);
249
+ remove(needremoves, false);
248
250
  banner.go(index || 0);
251
+ css(banner, { paddingBottom: '' });
249
252
  };
250
253
  banner.refresh = refresh;
251
254
 
@@ -5,7 +5,7 @@
5
5
  //main
6
6
  var body = document.body;
7
7
  var onbacks = [];
8
- var window_history = window.history;
8
+ var window_history = window.history || { length: 0, go() { }, back() { } };
9
9
  var window_history_length = window_history.length;
10
10
  var sessionSavedHashKey = "__zimoli_session_init_hash" + location.pathname;
11
11
  var sessionInitHash = sessionStorage.getItem(sessionSavedHashKey);
@@ -168,7 +168,7 @@ function go(pagepath, args, history_name, oldpagepath) {
168
168
  id,
169
169
  options
170
170
  };
171
- dispatch(window, event);
171
+ dispatch(document, event);
172
172
  fullfill_is_dispatched = 0;
173
173
  }
174
174
  addGlobal(_page, history_name, isDestroy);
@@ -411,7 +411,7 @@ function create(pagepath, args, from, needroles) {
411
411
  if (!user.isLogin && user.loginPath) {
412
412
  return create(user.loginPath);
413
413
  }
414
- return alert(i18n("没有权限!", "No Access!"), 0);
414
+ return alert(i18n`没有权限!`, 0);
415
415
  }
416
416
  _with_elements = [].concat(_with_elements);
417
417
  state.with = function (element) {
package/docs/index.html CHANGED
@@ -33,18 +33,7 @@
33
33
  box-sizing: border-box;
34
34
  }
35
35
  </style>
36
- <script deleteoncompile>
37
- -function (body, window) {
38
- body.removeChild(body.getElementsByTagName("script")[0]);
39
- var xhr = new (window.XMLHttpRequest || ActiveXObject)('Microsoft.XMLHTTP');
40
- xhr.onreadystatechange = function () {
41
- if (xhr.readyState === 4) {
42
- new Function(xhr.responseText).call(window);
43
- }
44
- };
45
- xhr.open('POST', 'comm/main');
46
- xhr.send("step into my sight..");
47
- }.call(this, document.documentElement.children[0], this);
36
+ <script efrontloader deleteoncompile>
48
37
  </script>
49
38
  </head>
50
39
 
package/docs/main.xht CHANGED
@@ -95,7 +95,8 @@
95
95
  name: "小工具",
96
96
  closed: true,
97
97
  children: [
98
- "字符集检查"
98
+ "字符集检查",
99
+ "国际化",
99
100
  ].map(a => ({ name: a, path: "/工具/" + a }))
100
101
  }
101
102
  ];