efront 3.36.3 → 3.36.5
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/#loader.js +50 -35
- package/coms/compile/Program.js +6 -1
- package/coms/compile/richcss.js +3 -5
- package/coms/compile/richcss_test.js +2 -1
- package/coms/docs/codetext.xht +78 -17
- package/coms/docs/markdown.js +6 -1
- package/coms/zimoli/AudioContext_test.less +1 -1
- package/coms/zimoli/alert.js +6 -6
- package/coms/zimoli/alert.less +2 -0
- package/coms/zimoli/getGenerator.js +1 -1
- package/coms/zimoli/render.js +1 -0
- package/coms/zimoli/zimoli.js +2 -1
- package/docs/main.xht +2 -2
- package/docs//347/273/204/344/273/266.xht +104 -22
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/coms/zimoli/onhistoryback.js +0 -0
package/coms/basic/#loader.js
CHANGED
|
@@ -244,12 +244,13 @@ var killCircle = function () {
|
|
|
244
244
|
};
|
|
245
245
|
// -->
|
|
246
246
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
247
|
-
var loadModule = function (
|
|
247
|
+
var loadModule = function (url, then, prebuilds = {}) {
|
|
248
|
+
var name = url.replace(/[\*~][\s\S]*$/, '');
|
|
248
249
|
if (/^(?:module|exports|define|require|window|global|undefined)$/.test(name)) return then();
|
|
249
|
-
if ((hasOwnProperty.call(prebuilds,
|
|
250
|
+
if ((hasOwnProperty.call(prebuilds, url)) || hasOwnProperty.call(modules, url) || (!/^on/.test(name) && window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name))
|
|
250
251
|
) return then();
|
|
251
|
-
preLoad(
|
|
252
|
-
var key = keyprefix +
|
|
252
|
+
preLoad(url);
|
|
253
|
+
var key = keyprefix + url;
|
|
253
254
|
if (loadedModules[key] instanceof Function) {
|
|
254
255
|
then();
|
|
255
256
|
return;
|
|
@@ -267,15 +268,15 @@ var loadModule = function (name, then, prebuilds = {}) {
|
|
|
267
268
|
}.bind(null, responseTree[name]));
|
|
268
269
|
};
|
|
269
270
|
if (/\.json([\#\?].*?)?$/i.test(name)) {
|
|
270
|
-
readFile(["JSON",
|
|
271
|
+
readFile(["JSON", url], saveModule);
|
|
271
272
|
} else {
|
|
272
|
-
readFile(
|
|
273
|
+
readFile(url, saveModule);
|
|
273
274
|
};
|
|
274
275
|
}
|
|
275
276
|
else {
|
|
276
277
|
|
|
277
278
|
var saveModule = function (error) {
|
|
278
|
-
var data = responseTree[
|
|
279
|
+
var data = responseTree[url];
|
|
279
280
|
if (typeof data === "function") {
|
|
280
281
|
var mod = data;
|
|
281
282
|
flushTree(loadedModules, key, mod);
|
|
@@ -289,7 +290,8 @@ var loadModule = function (name, then, prebuilds = {}) {
|
|
|
289
290
|
// <!--
|
|
290
291
|
if (!data) undefinedModules[name] = true;
|
|
291
292
|
// -->
|
|
292
|
-
var
|
|
293
|
+
var afterfix = url.slice(name.length);
|
|
294
|
+
var [argNames, body, args, required, strs, isAsync, isYield] = getArgs(data, afterfix);
|
|
293
295
|
if (isProduction) {
|
|
294
296
|
strs = strs.map ? strs.map(toRem) : strs;
|
|
295
297
|
} else {
|
|
@@ -300,7 +302,10 @@ var loadModule = function (name, then, prebuilds = {}) {
|
|
|
300
302
|
mod.argNames = argNames;
|
|
301
303
|
mod.strs = strs;
|
|
302
304
|
var loadingCount = 0;
|
|
303
|
-
if (required)
|
|
305
|
+
if (required) {
|
|
306
|
+
required = required.split(';').filter(a => !!a);
|
|
307
|
+
if (afterfix) required = required.map(r => r + afterfix);
|
|
308
|
+
}
|
|
304
309
|
required = required ? get_relatives(name, required) : [];
|
|
305
310
|
mod.required = required;
|
|
306
311
|
mod.file = name;
|
|
@@ -328,13 +333,15 @@ var loadModule = function (name, then, prebuilds = {}) {
|
|
|
328
333
|
});
|
|
329
334
|
}
|
|
330
335
|
};
|
|
331
|
-
readFile(
|
|
336
|
+
readFile(url, saveModule);
|
|
332
337
|
}
|
|
333
338
|
};
|
|
334
339
|
var toRem = text => pixelDecoder && typeof text === 'string' ? text.replace(/(\:\s*)?\b((?:\d*\.)?\d+)px(\s*\))?/ig, (m, h, d, quote) => (h || "") + (d !== '1' ? h && quote ? renderPixelRatio * d + "pt" : pixelDecoder(d) : renderPixelRatio > 1 ? ".78pt" : 0.78 / devicePixelRatio + "pt") + (quote || "")) : text;
|
|
335
340
|
"use ./#decrypt.js";
|
|
336
|
-
var getArgs = function (text) {
|
|
337
|
-
|
|
341
|
+
var getArgs = function (text, aftfix) {
|
|
342
|
+
if (!aftfix || /^\*/.test(aftfix)) {
|
|
343
|
+
"use ./#decrypt_.js";
|
|
344
|
+
}
|
|
338
345
|
var args, functionBody;
|
|
339
346
|
//依赖项名称部分的长度限制为36*36*18=23328
|
|
340
347
|
var doublecount = parseInt(text.slice(0, 3), 36);
|
|
@@ -365,6 +372,9 @@ var getArgs = function (text) {
|
|
|
365
372
|
var argNames = args.slice(argsstart, argsend);
|
|
366
373
|
var required = args[argsend];
|
|
367
374
|
args = args.slice(0, argsstart);
|
|
375
|
+
if (aftfix) {
|
|
376
|
+
args = args.map(a => a + aftfix);
|
|
377
|
+
}
|
|
368
378
|
} else {
|
|
369
379
|
functionBody = text;
|
|
370
380
|
}
|
|
@@ -422,7 +432,8 @@ var createModule = function (exec, originNames, compiledNames, prebuilds = {}) {
|
|
|
422
432
|
var isModuleInit = false;
|
|
423
433
|
var required = exec.required;
|
|
424
434
|
if (required) required = required.map(a => loadedModules[keyprefix + a]);
|
|
425
|
-
var argsList = originNames.map(function (
|
|
435
|
+
var argsList = originNames.map(function (aName) {
|
|
436
|
+
var argName = aName.replace(/[\*~][\s\S]*$/, '');
|
|
426
437
|
if (hasOwnProperty.call(prebuilds, argName)) {
|
|
427
438
|
return prebuilds[argName];
|
|
428
439
|
}
|
|
@@ -465,11 +476,8 @@ var createModule = function (exec, originNames, compiledNames, prebuilds = {}) {
|
|
|
465
476
|
var prebuilds2 = Object.create(null);
|
|
466
477
|
for (var k in prebuilds) if (hasOwnProperty.call(prebuilds, k)) prebuilds2[k] = prebuilds[k];
|
|
467
478
|
prebuilds = prebuilds2;
|
|
468
|
-
delete prebuilds.popup;
|
|
469
|
-
delete prebuilds.action;
|
|
470
|
-
delete prebuilds.init;
|
|
471
479
|
}
|
|
472
|
-
var promise = init(
|
|
480
|
+
var promise = init(aName, function (res) {
|
|
473
481
|
result = res;
|
|
474
482
|
created = true;
|
|
475
483
|
}, prebuilds);
|
|
@@ -489,19 +497,20 @@ var createModule = function (exec, originNames, compiledNames, prebuilds = {}) {
|
|
|
489
497
|
});
|
|
490
498
|
};
|
|
491
499
|
|
|
492
|
-
var init = function (
|
|
500
|
+
var init = function (url, then, prebuilds) {
|
|
493
501
|
// then = bindthen(then);
|
|
494
|
-
var key = keyprefix +
|
|
502
|
+
var key = keyprefix + url;
|
|
495
503
|
if (prebuilds) {
|
|
496
|
-
if (hasOwnProperty.call(prebuilds,
|
|
497
|
-
if (then) then(prebuilds[
|
|
498
|
-
return prebuilds[
|
|
504
|
+
if (hasOwnProperty.call(prebuilds, url)) {
|
|
505
|
+
if (then) then(prebuilds[url]);
|
|
506
|
+
return prebuilds[url];
|
|
499
507
|
}
|
|
500
508
|
}
|
|
501
|
-
if (hasOwnProperty.call(modules,
|
|
502
|
-
if (then) then(modules[
|
|
503
|
-
return modules[
|
|
509
|
+
if (hasOwnProperty.call(modules, url)) {
|
|
510
|
+
if (then) then(modules[url]);
|
|
511
|
+
return modules[url];
|
|
504
512
|
}
|
|
513
|
+
var name = url.replace(/[\*~][\s\S]*$/, '');
|
|
505
514
|
if (!/^on/.test(name) && window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name)) {
|
|
506
515
|
modules[name] = window[name]
|
|
507
516
|
if (then) then(modules[name]);
|
|
@@ -540,17 +549,17 @@ var init = function (name, then, prebuilds) {
|
|
|
540
549
|
};
|
|
541
550
|
var crack = function (error) {
|
|
542
551
|
if (res.resolved || res.errored) return;
|
|
543
|
-
var ed = errored[
|
|
552
|
+
var ed = errored[url];
|
|
544
553
|
res.errored = true;
|
|
545
554
|
res.error = error;
|
|
546
555
|
res.fire();
|
|
547
|
-
var rest = [
|
|
556
|
+
var rest = [url];
|
|
548
557
|
var track = [];
|
|
549
558
|
var length = 0;
|
|
550
559
|
var deep = 0;
|
|
551
560
|
// <!--
|
|
552
561
|
var map = Object.create(null);
|
|
553
|
-
map[
|
|
562
|
+
map[url] = true;
|
|
554
563
|
do {
|
|
555
564
|
deep++;
|
|
556
565
|
var rest2 = Object.create(null);
|
|
@@ -573,11 +582,11 @@ var init = function (name, then, prebuilds) {
|
|
|
573
582
|
track = track.map(([d, a, e]) => ` ${new Array(d + 1).join("•")} ${new Array(2 + length - a.length - d).join("-")} ${a} 溃于: ${e.reverse().join(", ")}`)
|
|
574
583
|
// -->
|
|
575
584
|
var report = window.performance || !window.alert ? console.error : window.alert;
|
|
576
|
-
report(`加载 ${
|
|
585
|
+
report(`加载 ${url} 失败,${ed && ed.length ? `${ed.join(', ')} 等 ${ed.length} 个模块` : "没有其他模块"}受到影响。\r\n${track.join("\r\n")}`);
|
|
577
586
|
};
|
|
578
|
-
loadModule(
|
|
579
|
-
if (hasOwnProperty.call(modules,
|
|
580
|
-
then(modules[
|
|
587
|
+
loadModule(url, function (error) {
|
|
588
|
+
if (hasOwnProperty.call(modules, url)) {
|
|
589
|
+
then(modules[url]);
|
|
581
590
|
return;
|
|
582
591
|
}
|
|
583
592
|
if (error) return crack(error);
|
|
@@ -587,7 +596,7 @@ var init = function (name, then, prebuilds) {
|
|
|
587
596
|
|
|
588
597
|
if (!args || !args.length) {
|
|
589
598
|
var created = module.call(window);
|
|
590
|
-
then(module.created = modules[
|
|
599
|
+
then(module.created = modules[url] = created);
|
|
591
600
|
return;
|
|
592
601
|
}
|
|
593
602
|
var filteredArgs = prebuilds ? args.filter(a => !hasOwnProperty.call(prebuilds, a)) : args;
|
|
@@ -611,12 +620,12 @@ var init = function (name, then, prebuilds) {
|
|
|
611
620
|
if (saveAsModule) {
|
|
612
621
|
penddings[key] = created;
|
|
613
622
|
created.then(function (res) {
|
|
614
|
-
then(modules[
|
|
623
|
+
then(modules[url] = res);
|
|
615
624
|
});
|
|
616
625
|
return;
|
|
617
626
|
}
|
|
618
627
|
} else {
|
|
619
|
-
if (saveAsModule) module.created = modules[
|
|
628
|
+
if (saveAsModule) module.created = modules[url] = created;
|
|
620
629
|
}
|
|
621
630
|
then(created);
|
|
622
631
|
}, prebuilds);
|
|
@@ -820,6 +829,12 @@ var modules = {
|
|
|
820
829
|
createFunction,
|
|
821
830
|
efrontsign: "",
|
|
822
831
|
};
|
|
832
|
+
modules["set request"] = function (req) {
|
|
833
|
+
request = req;
|
|
834
|
+
};
|
|
835
|
+
modules["get request"] = function () {
|
|
836
|
+
return request;
|
|
837
|
+
};
|
|
823
838
|
modules.debug = function () {
|
|
824
839
|
document.addEventListener("blur", e => e.stopPropagation(), true);
|
|
825
840
|
};
|
package/coms/compile/Program.js
CHANGED
|
@@ -194,7 +194,8 @@ class Program {
|
|
|
194
194
|
Object.defineProperty(scope, 'queue', { value: queue, enumerable: false });
|
|
195
195
|
scope.prev = last;
|
|
196
196
|
if (scope.type !== COMMENT && scope.type !== SPACE) {
|
|
197
|
-
|
|
197
|
+
var keeplast = program.setType(scope) === false;
|
|
198
|
+
if (keeplast) {
|
|
198
199
|
if (queue.last !== last) last = queue.last;
|
|
199
200
|
else if (scope.prev !== last) last = scope.prev;
|
|
200
201
|
while (queue[queue.length - 1] !== last) queue.pop();
|
|
@@ -202,6 +203,10 @@ class Program {
|
|
|
202
203
|
last.text = text.slice(last.start, last.end);
|
|
203
204
|
return;
|
|
204
205
|
}
|
|
206
|
+
if (queue.last !== last && queue.last !== o) {
|
|
207
|
+
last = queue.last, scope.prev = last;
|
|
208
|
+
if (last) last.text = text.slice(last.start, last.end);
|
|
209
|
+
}
|
|
205
210
|
if (last) last.next = scope;
|
|
206
211
|
queue.last = scope;
|
|
207
212
|
for (var cx = queue.length - 1; cx >= 0; cx--) {
|
package/coms/compile/richcss.js
CHANGED
|
@@ -26,13 +26,11 @@ Richcss.prototype.setType = function (o) {
|
|
|
26
26
|
}
|
|
27
27
|
if (pps.length > 1) {
|
|
28
28
|
var i = q.lastIndexOf(p = pps.pop());
|
|
29
|
-
q.splice(i + 1, q.length
|
|
30
|
-
p.next = o;
|
|
29
|
+
q.splice(i + 1, q.length);
|
|
31
30
|
p.type = PROPERTY;
|
|
32
31
|
p.end = pps[0].end;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return false;
|
|
32
|
+
q.last = p;
|
|
33
|
+
return;
|
|
36
34
|
}
|
|
37
35
|
}
|
|
38
36
|
if (!q.entry && o.type !== SCOPED) {
|
|
@@ -10,4 +10,5 @@ test(`a{ >b{a:1}}`,`a>b{a:1;}`);
|
|
|
10
10
|
test(`a{ &>b{a:1}}`,`a>b{a:1;}`);
|
|
11
11
|
test(`a{ &b{a:1}}`,`ab{a:1;}`);
|
|
12
12
|
test(`a{ &.b{a:1}}`,`a.b{a:1;}`);
|
|
13
|
-
test(`a{ &[b]{a:1}}`,`a[b]{a:1;}`);
|
|
13
|
+
test(`a{ &[b]{a:1}}`,`a[b]{a:1;}`);
|
|
14
|
+
test(`a{ &[b]:nth-child(1){a:1}}`,`a[b]:nth-child(1){a:1;}`);
|
package/coms/docs/codetext.xht
CHANGED
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
var encode = function (text) {
|
|
85
85
|
return text.replace(/[\<\>\|]/g, a => `&#${a.charCodeAt()};`)
|
|
86
86
|
};
|
|
87
|
-
var codecolor = function (c) {
|
|
87
|
+
var codecolor = function (c, blink) {
|
|
88
88
|
var envs = c.envs;
|
|
89
89
|
var predefs = Object.create(null);
|
|
90
90
|
predefs.module = true;
|
|
@@ -95,6 +95,8 @@
|
|
|
95
95
|
var { STRAP, SCOPED, QUOTED, LABEL, COMMENT, STAMP, VALUE, EXPRESS, PROPERTY, PIECE } = c;
|
|
96
96
|
var deep = 0;
|
|
97
97
|
var setcolor = function (o) {
|
|
98
|
+
var text = o.text;
|
|
99
|
+
if (o.blink >= 0) o.text = o.text.slice(0, o.blink) + blink + o.text.slice(o.blink);
|
|
98
100
|
switch (o.type) {
|
|
99
101
|
case LABEL:
|
|
100
102
|
o.text = `<label>${o.text}</label>`;
|
|
@@ -137,16 +139,16 @@
|
|
|
137
139
|
if (next && next.type === c.SCOPED && next.entry === '(') {
|
|
138
140
|
keys[keys.length - 1] = `<invoke>${keys[keys.length - 1]}</invoke>`;
|
|
139
141
|
}
|
|
142
|
+
var [name0] = text.split(".");
|
|
140
143
|
var [name] = keys;
|
|
141
|
-
if (/^</.test(
|
|
142
|
-
else if (/^(arguments|this|super|Infinity|NaN)$/.test(
|
|
143
|
-
else if (
|
|
144
|
-
|
|
144
|
+
if (/^</.test(name0));
|
|
145
|
+
else if (/^(arguments|this|super|Infinity|NaN)$/.test(name0)) name = `<strap>${name}</strap>`;
|
|
146
|
+
else if (name0 in envs) name = name0 in predefs ? `<predef>${name}</predef>` : `<outside>${name}</outside>`;
|
|
145
147
|
keys[0] = name;
|
|
146
148
|
o.text = keys.map(k => /^\</.test(k) || !k ? k : `<express>${k}</express>`).join(".");
|
|
147
149
|
break;
|
|
148
150
|
case STRAP:
|
|
149
|
-
if (/^(if|else|switch|case|do|while|for|break|continue|default|import|from|as|export|try|catch|finally|await|yield|return)/.test(
|
|
151
|
+
if (/^(if|else|switch|case|do|while|for|break|continue|default|import|from|as|export|try|catch|finally|await|yield|return)/.test(text))
|
|
150
152
|
o.text = `<flow>${o.text}</flow>`;
|
|
151
153
|
else o.text = `<strap>${o.text}</strap>`;
|
|
152
154
|
break;
|
|
@@ -166,10 +168,17 @@
|
|
|
166
168
|
var typescript = new compile$Javascript;
|
|
167
169
|
typescript.straps = typescript.straps.concat("interface", "implements", "declare", "module", "readonly", "enum");
|
|
168
170
|
var codesupports = {
|
|
169
|
-
javascript(a) {
|
|
171
|
+
javascript(a, blink) {
|
|
172
|
+
if (blink) var index = a.indexOf(blink);
|
|
173
|
+
if (index >= 0) a = a.slice(0, index) + a.slice(index + 1);
|
|
170
174
|
var c = compile$scanner2(a);
|
|
171
|
-
|
|
172
|
-
|
|
175
|
+
if (index >= 0) {
|
|
176
|
+
var patched = patchBlink(c, index, blink);
|
|
177
|
+
}
|
|
178
|
+
codecolor(c, blink);
|
|
179
|
+
a = c.toString();
|
|
180
|
+
if (index >= 0 && !patched) a = blink + a;
|
|
181
|
+
return a;
|
|
173
182
|
},
|
|
174
183
|
typescript(a) {
|
|
175
184
|
var c = compile$scanner2(a, typescript);
|
|
@@ -199,15 +208,67 @@
|
|
|
199
208
|
codesupports.jsx = codesupports.js = codesupports.javascript;
|
|
200
209
|
codesupports.tsx = codesupports.ts = codesupports.typescript;
|
|
201
210
|
codesupports.xml = codesupports.html;
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
211
|
+
var { SCOPED, QUOTED } = compile$common;
|
|
212
|
+
var patchBlink = function (code, index, blink) {
|
|
213
|
+
for (var cx = 0, dx = code.length; cx < dx; cx++) {
|
|
214
|
+
var c = code[cx];
|
|
215
|
+
var haschildren = c => c.type === SCOPED || c.type === QUOTED && c.length;
|
|
216
|
+
if (c.start === index) {
|
|
217
|
+
if (haschildren(c)) {
|
|
218
|
+
c.entry = blink + c.entry;
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
c.blink = 0;
|
|
222
|
+
}
|
|
223
|
+
return true;
|
|
224
|
+
}
|
|
225
|
+
else if (c.start < index && c.end > index) {
|
|
226
|
+
if (haschildren(c)) {
|
|
227
|
+
return patchBlink(c, index, blink);
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
c.blink = index - c.start;
|
|
231
|
+
return true;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
else if (c.end === index) {
|
|
235
|
+
if (haschildren(c)) {
|
|
236
|
+
c.leave += blink;
|
|
237
|
+
}
|
|
238
|
+
else {
|
|
239
|
+
c.blink = c.text.length;
|
|
240
|
+
}
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
else if (c.start > index) {
|
|
244
|
+
if (cx === 0) {
|
|
245
|
+
if (code.entry) return code.entry += blink, true;
|
|
246
|
+
return false;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
var p = code[cx - 1];
|
|
250
|
+
if (haschildren(p)) {
|
|
251
|
+
p.leave += blink;
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
p.blink = p.text.length;
|
|
255
|
+
}
|
|
256
|
+
return true;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
if (code.leave) {
|
|
261
|
+
code.leave = blink + code.leave;
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
return false;
|
|
265
|
+
};
|
|
266
|
+
function codetext(type, text, blink) {
|
|
267
|
+
type = type.toLowerCase();
|
|
268
|
+
if (type in codesupports) {
|
|
269
|
+
text = codesupports[type](text, blink);
|
|
210
270
|
}
|
|
271
|
+
else text = encode(text);
|
|
211
272
|
var codes = text.split(/\r\n|\r|\n/);
|
|
212
273
|
var minSpace = 0;
|
|
213
274
|
for (var c of codes) {
|
package/coms/docs/markdown.js
CHANGED
|
@@ -99,7 +99,12 @@ function markdown(text) {
|
|
|
99
99
|
if (q.length === 1) return `<m>${_}</m>`;
|
|
100
100
|
var t = /^\S+/.exec(c);
|
|
101
101
|
if (t) t = t[0]; c = c.slice(t.length).replace(/^(\r\n|\r|\n)|\s+$/g, '');
|
|
102
|
-
|
|
102
|
+
try {
|
|
103
|
+
return codetext(t, c);
|
|
104
|
+
} catch (e) {
|
|
105
|
+
console.error(e);
|
|
106
|
+
return c;
|
|
107
|
+
}
|
|
103
108
|
}).replace(/\s*(( \s*)+)/g, "$1").split(/\r\n|\r|\n/).forEach(richtext);
|
|
104
109
|
list_elem = null;
|
|
105
110
|
list_tag = null;
|
package/coms/zimoli/alert.js
CHANGED
|
@@ -12,10 +12,11 @@ styles.default = '#000a';
|
|
|
12
12
|
var fontSize = 16;
|
|
13
13
|
var singleHeight = fontSize * 3.125 | 0;
|
|
14
14
|
var container = document.createElement('alert-container');
|
|
15
|
-
css(container, 'height:0;left:0;right:0;transition:all 0.2s ease-out;position:absolute;')
|
|
15
|
+
css(container, 'top:0;height:0;left:0;right:0;transition:all 0.2s ease-out;position:absolute;')
|
|
16
16
|
var _text = function (bgcolor, parameters) {
|
|
17
17
|
var box = document.createElement('div');
|
|
18
|
-
box
|
|
18
|
+
css(box, `background-color:${bgcolor};color:${color.pair(bgcolor, 1)};`);
|
|
19
|
+
box.innerHTML = [].slice.call(parameters, 0).join(", ");
|
|
19
20
|
box.initialStyle = `margin-top:-${fromPixel(singleHeight)};`;
|
|
20
21
|
return box;
|
|
21
22
|
};
|
|
@@ -55,13 +56,12 @@ function alert() {
|
|
|
55
56
|
} else {
|
|
56
57
|
elem = _text(styles.log, [text]);
|
|
57
58
|
}
|
|
58
|
-
var _onclose = function (event) {
|
|
59
|
+
var _onclose = lazy(function (event) {
|
|
59
60
|
if (onclose) {
|
|
60
61
|
onclose.call(this, event);
|
|
61
62
|
}
|
|
62
63
|
if (close_timer) clearTimeout(close_timer);
|
|
63
|
-
|
|
64
|
-
}
|
|
64
|
+
});
|
|
65
65
|
onremove(elem, _onclose);
|
|
66
66
|
var close_timer;
|
|
67
67
|
var waitclose = function (autoclose, deltaTime) {
|
|
@@ -87,7 +87,7 @@ function alert() {
|
|
|
87
87
|
}
|
|
88
88
|
};
|
|
89
89
|
if (!container.parentNode) popup(container);
|
|
90
|
-
appendChild(container, elem);
|
|
90
|
+
if (!elem.parentNode) appendChild(container, elem);
|
|
91
91
|
return elem;
|
|
92
92
|
}
|
|
93
93
|
for (var k in styles) {
|
package/coms/zimoli/alert.less
CHANGED
|
@@ -24,7 +24,7 @@ var getGenerator = function (container, tagName = 'item') {
|
|
|
24
24
|
var template = document.createElement(container.tagName);
|
|
25
25
|
var templates = [];
|
|
26
26
|
for (let a of container.childNodes) {
|
|
27
|
-
if (a.hasAttribute('insert')) {
|
|
27
|
+
if (a.nodeType === 1 && a.hasAttribute('insert')) {
|
|
28
28
|
if (!templates.length) a.$isbefore = true;
|
|
29
29
|
else a.$isafter = true;
|
|
30
30
|
}
|
package/coms/zimoli/render.js
CHANGED
|
@@ -886,6 +886,7 @@ class Struct {
|
|
|
886
886
|
function createStructure(element) {
|
|
887
887
|
if (isArrayLike(element)) return Array.prototype.map.call(element, createStructure);
|
|
888
888
|
if (element.$struct) return element.$struct;
|
|
889
|
+
if (element.nodeType !== 1) return;
|
|
889
890
|
// 处理结构流
|
|
890
891
|
var attributes = element.attributes;
|
|
891
892
|
var attrs = Array.apply(null, attributes);
|
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -58,7 +58,8 @@ if (/MSIE\s*[2-7]/.test(navigator.userAgent)) {
|
|
|
58
58
|
if (currentHash && currentHash === targetHash) return;
|
|
59
59
|
var targetHashIndex = targetHash.indexOf("#" + current_history);
|
|
60
60
|
if (targetHashIndex < 0) return;
|
|
61
|
-
var targetpath = targetHash.slice(targetHashIndex + current_history.length);
|
|
61
|
+
var targetpath = targetHash.slice(targetHashIndex + current_history.length + 1);
|
|
62
|
+
targetpath = decodeURI(targetpath);
|
|
62
63
|
go(targetpath);
|
|
63
64
|
return;
|
|
64
65
|
}
|
package/docs/main.xht
CHANGED
|
@@ -150,7 +150,7 @@
|
|
|
150
150
|
var map = Object.create(null);
|
|
151
151
|
var children = [];
|
|
152
152
|
for (var a of c.children) {
|
|
153
|
-
if (/_test\.([tj]sx?|xht|html|less|md)$/i.test(a)) {
|
|
153
|
+
if (/_test\.([tj]sx?|xht|html|less|css|md)$/i.test(a)) {
|
|
154
154
|
var testName = a.replace(/\.\w+$/g, '');
|
|
155
155
|
if (!map[testName]) map[testName] = [];
|
|
156
156
|
map[testName].push(a);
|
|
@@ -175,7 +175,7 @@
|
|
|
175
175
|
c.children = children;
|
|
176
176
|
c.closed = true;
|
|
177
177
|
}
|
|
178
|
-
|
|
178
|
+
data.setInstance('components', m);
|
|
179
179
|
menus[2].children = m;
|
|
180
180
|
};
|
|
181
181
|
var initMenus = async function () {
|