efront 3.23.0 → 3.24.2
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.
- package/coms/basic/BigNumber.js +28 -5
- package/coms/basic/BigNumber_test.js +14 -1
- package/coms/basic/[]map.js +18 -13
- package/coms/basic/loader.js +25 -11
- package/coms/compile/common.js +5 -0
- package/coms/compile/scanner2.js +13 -1
- package/coms/kugou/parseSongsList.js +1 -1
- package/coms/kugou/player.js +3 -2
- package/coms/zimoli/Promise.js +84 -133
- package/coms/zimoli/appendChild.js +4 -14
- package/coms/zimoli/cless.js +11 -5
- package/coms/zimoli/color.js +0 -1
- package/coms/zimoli/cross.js +1 -1
- package/coms/zimoli/data.js +6 -2
- package/coms/zimoli/dispatch.js +1 -1
- package/coms/zimoli/on.js +64 -47
- package/coms/zimoli/remove.js +0 -9
- package/coms/zimoli/render.js +2 -2
- package/coms/zimoli/zimoli.js +2 -2
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/zimoli/data.js
CHANGED
|
@@ -323,9 +323,13 @@ var parseData = function (sourceText) {
|
|
|
323
323
|
sourceText = sourceText
|
|
324
324
|
.replace(/<!--[\s\S]*?-->|<\[CDATA\[[\s\S]*?\]\]>/ig, '')
|
|
325
325
|
.replace(/^[\s\S]*?<html>([\s\S]*)<\/html>[\s\S]*?$/i, '$1')
|
|
326
|
-
.replace(/^[\s\S]
|
|
326
|
+
.replace(/^([\s\S]*?)<body>([\s\S]*?)$/i, '$1<body>$2')
|
|
327
327
|
.replace(/<\/body>[\s\S]*?$/, '');
|
|
328
|
-
|
|
328
|
+
var div = document.createElement('div');
|
|
329
|
+
div.innerHTML = sourceText.replace(/^([\s\S]*?)<body>[\s\S]*?$/, "$1")
|
|
330
|
+
.replace(/<head>/i, '').replace(/<\/head>/i, '');
|
|
331
|
+
for (var c of [...div.childNodes]) doc.head.appendChild(c);
|
|
332
|
+
doc.body.innerHTML = sourceText.replace(/^[\s\S]*?<body>/, '');
|
|
329
333
|
} else {
|
|
330
334
|
doc.documentElement.innerHTML = sourceText;
|
|
331
335
|
}
|
package/coms/zimoli/dispatch.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var dispatch = "dispatchEvent" in document ? function dispatchEvent(target, event) {
|
|
2
2
|
return target.dispatchEvent(event);
|
|
3
|
-
} : function
|
|
3
|
+
} : function (target, event) {
|
|
4
4
|
var fire = "on" + event.type;
|
|
5
5
|
try {
|
|
6
6
|
return target.fireEvent(fire, event);
|
package/coms/zimoli/on.js
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
"use strict";
|
|
1
|
+
// "use strict";
|
|
2
2
|
if (document.efronton) return document.efronton;
|
|
3
3
|
var is_addEventListener_enabled = "addEventListener" in window;
|
|
4
|
+
if ('attachEvent' in document) {
|
|
5
|
+
is_addEventListener_enabled = false;
|
|
6
|
+
}
|
|
7
|
+
if (!is_addEventListener_enabled) var __call = function (target, context, handler, firstmost) {
|
|
8
|
+
// use strict 无效的情况
|
|
9
|
+
if (isEmpty(target)) {
|
|
10
|
+
this(context, context, handler, firstmost);
|
|
11
|
+
}
|
|
12
|
+
else {
|
|
13
|
+
this(target, context, handler, firstmost);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
|
|
4
17
|
var handlersMap = {};
|
|
5
18
|
var changes_key = 'changes';
|
|
6
19
|
var eventtypereg = /(?:\.once|\.prevent|\.stop|\.capture|\.self|\.passive|\.[a-z0-9]+)+\.?$/i;
|
|
@@ -70,7 +83,6 @@ var keyCodeMap = {
|
|
|
70
83
|
numdot: 110,
|
|
71
84
|
divide: 111,
|
|
72
85
|
div: 111,
|
|
73
|
-
"/": 111,
|
|
74
86
|
f1: 112,
|
|
75
87
|
f2: 113,
|
|
76
88
|
f3: 114,
|
|
@@ -104,7 +116,7 @@ var keyCodeMap = {
|
|
|
104
116
|
">": 110,
|
|
105
117
|
slash: 191,
|
|
106
118
|
"/": 191,
|
|
107
|
-
"
|
|
119
|
+
"?": 191,
|
|
108
120
|
backquote: 192,
|
|
109
121
|
"`": 192,
|
|
110
122
|
"~": 192,
|
|
@@ -308,50 +320,55 @@ var on = document.efronton = function (k) {
|
|
|
308
320
|
return remove.bind(target, k, hk, listener);
|
|
309
321
|
};
|
|
310
322
|
|
|
311
|
-
else
|
|
312
|
-
var
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
323
|
+
else {
|
|
324
|
+
var _addhandler = function (target, context, handler, firstmost = false) {
|
|
325
|
+
if (eventtypes.capture) {
|
|
326
|
+
console.warn("当前运行环境不支持事件capture");
|
|
327
|
+
firstmost = true;
|
|
328
|
+
}
|
|
329
|
+
target = checkroot(target, k);
|
|
330
|
+
if (target[handler_path] instanceof Array) {
|
|
331
|
+
} else {
|
|
332
|
+
var h = function (e) {
|
|
333
|
+
if (!e) e = window.event || {};
|
|
334
|
+
if (!e.target && e.srcElement) {
|
|
335
|
+
e.target = e.srcElement;
|
|
336
|
+
}
|
|
337
|
+
if (e.stopedPropagation) return;
|
|
338
|
+
if (!e.stopPropagation) {
|
|
339
|
+
e.stopPropagation = function () {
|
|
340
|
+
this.stopedPropagation = true;
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
if (!e.preventDefault) {
|
|
344
|
+
e.preventDefault = function () {
|
|
345
|
+
e.returnValue = false;
|
|
346
|
+
e.defaultPrevented = true;
|
|
347
|
+
};
|
|
348
|
+
}
|
|
349
|
+
if (e.button) {
|
|
350
|
+
if (e.buttons === undefined) e.buttons = e.button;
|
|
351
|
+
if (e.which === undefined) e.which = e.button + 1;
|
|
352
|
+
}
|
|
353
|
+
if (e.keyCode) {
|
|
354
|
+
if (e.which === undefined) e.which = e.keyCode;
|
|
355
|
+
}
|
|
356
|
+
broadcast.call(target, k, handler_path, e);
|
|
357
|
+
return e.returnValue;
|
|
358
|
+
};
|
|
359
|
+
target[handler_path] = target["on" + k] && target["on" + k] !== handler ? [[{}, target["on" + k]]] : [];
|
|
360
|
+
target[handler_path].h = h;
|
|
361
|
+
target["on" + k] = h;
|
|
362
|
+
|
|
363
|
+
}
|
|
364
|
+
var listener = [eventtypes, handler, context];
|
|
365
|
+
append.call(target, k, handler_path, listener, firstmost);
|
|
366
|
+
return remove.bind(target, k, handler_path, listener);
|
|
367
|
+
}, addhandler = function (context, handler, firstmost) {
|
|
368
|
+
return _addhandler(context, context, handler, firstmost);
|
|
369
|
+
};
|
|
370
|
+
addhandler.call = __call.bind(_addhandler);
|
|
371
|
+
}
|
|
355
372
|
handlersMap[on_event_path] = addhandler;
|
|
356
373
|
return addhandler;
|
|
357
374
|
};
|
package/coms/zimoli/remove.js
CHANGED
|
@@ -43,19 +43,10 @@ function _onremove(node, event) {
|
|
|
43
43
|
if (!node || node.isMounted === false) return;
|
|
44
44
|
var children = node.childNodes;
|
|
45
45
|
if (node.isMounted) {
|
|
46
|
-
var onremove = node.onremove;
|
|
47
46
|
if (!event) {
|
|
48
47
|
event = createEvent("remove");
|
|
49
48
|
}
|
|
50
49
|
dispatch(node, event);
|
|
51
|
-
if (isArray(onremove)) {
|
|
52
|
-
onremove.map(function (remove_hindler) {
|
|
53
|
-
remove_hindler.call(this, event);
|
|
54
|
-
}, node);
|
|
55
|
-
}
|
|
56
|
-
if (isFunction(onremove)) {
|
|
57
|
-
onremove.call(node, event);
|
|
58
|
-
}
|
|
59
50
|
node.isMounted = false;
|
|
60
51
|
}
|
|
61
52
|
if (children) for (var cx = 0, dx = children.length; cx < dx; cx++) {
|
package/coms/zimoli/render.js
CHANGED
|
@@ -173,7 +173,7 @@ var createRepeat = function (search, id = 0) {
|
|
|
173
173
|
var $parentScopes = element.$parentScopes || [];
|
|
174
174
|
var $struct = element.$struct;
|
|
175
175
|
if (element.$scope) {
|
|
176
|
-
$struct =
|
|
176
|
+
$struct = extend({}, $struct, { context: $struct.context + `with(this.$parentScopes[${$parentScopes.length}])` }), $parentScopes = $parentScopes.concat(element.$scope);
|
|
177
177
|
}
|
|
178
178
|
var clonedElements1 = Object.create(null);
|
|
179
179
|
var cloned = keys.map(function (key, cx) {
|
|
@@ -631,7 +631,7 @@ function getFromScopes(key, scope, parentScopes) {
|
|
|
631
631
|
|
|
632
632
|
function renderElement(element, scope = element.$scope, parentScopes = element.$parentScopes, once) {
|
|
633
633
|
if (!isNode(element) && element.length) {
|
|
634
|
-
return Array.prototype.
|
|
634
|
+
return Array.prototype.map.call(element, function (element) {
|
|
635
635
|
return renderElement(element, scope, parentScopes, once);
|
|
636
636
|
});
|
|
637
637
|
}
|
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -301,7 +301,7 @@ function prepare(pgpath, ok) {
|
|
|
301
301
|
if (isString(menu)) {
|
|
302
302
|
res = state.go(menu, item);
|
|
303
303
|
} else if (menu && menu.path) {
|
|
304
|
-
menu =
|
|
304
|
+
menu = extend({}, menu, { path: state.path(menu.path) });
|
|
305
305
|
res = go(menu, undefined, undefined, pgpath);
|
|
306
306
|
} else {
|
|
307
307
|
res = action(menu, item, params);
|
|
@@ -476,7 +476,7 @@ var pushstate = function (path_name, history_name, oldpagepath) {
|
|
|
476
476
|
history[history_name] = [path_name];
|
|
477
477
|
} else {
|
|
478
478
|
var _history = history[history_name];
|
|
479
|
-
if (
|
|
479
|
+
if ([].indexOf.call(_history, oldpagepath, 0) < 0) {
|
|
480
480
|
_history.splice(root_path === _history[0], _history.length);
|
|
481
481
|
isDestroy = true;
|
|
482
482
|
}
|