efront 3.34.12 → 3.35.1
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/apps/moue/content//344/275/240/345/245/275/344/270/226/347/225/214.vue +21 -0
- package/apps/moue/content//344/275/240/345/245/275/345/274/200/345/217/221/350/200/205.html +1 -0
- package/apps/moue/{home/index.js → content//344/275/240/345/245/275/345/274/200/345/217/221/350/200/205.js} +4 -2
- package/apps/moue/content//344/275/240/345/245/275/345/274/200/345/217/221/350/200/205.less +4 -0
- package/apps/moue/home/index2.vue +97 -18
- package/apps/moue/index.html +1 -1
- package/coms/basic/ArrayFill.md +9 -0
- package/coms/basic/awaitable.md +10 -0
- package/coms/basic/backEach.md +7 -0
- package/coms/basic/combine.md +23 -0
- package/coms/basic/renderExpress.js +3 -2
- package/coms/basic/wait.js +5 -0
- package/coms/basic_/readme.md +5 -4
- package/coms/compile/#/350/257/264/346/230/216.md +1 -0
- package/coms/compile/Html.js +263 -0
- package/coms/compile/Html_test.js +5 -0
- package/coms/compile/Javascript.js +627 -0
- package/coms/compile/Program.js +666 -0
- package/coms/compile/autoenum.js +179 -0
- package/coms/compile/autoenum_test.js +17 -0
- package/coms/compile/autoeval.js +50 -0
- package/coms/compile/autoeval_test.js +28 -0
- package/coms/compile/autoiota.js +121 -0
- package/coms/compile/breakcode.js +83 -0
- package/coms/compile/common.js +1063 -0
- package/coms/compile/downLevel.js +901 -0
- package/coms/compile/downLevel_test.js +111 -0
- package/coms/compile/formatcode.js +57 -0
- package/coms/compile/iso8859.js +9 -0
- package/coms/compile/iso8859_test.js +2 -0
- package/coms/compile/keywords.js +6 -0
- package/coms/compile/namelist.js +154 -0
- package/coms/compile/namelist_test.js +7 -0
- package/coms/compile/polyfill.js +31 -0
- package/coms/compile/required.js +20 -0
- package/coms/compile/richcss.js +237 -0
- package/coms/compile/richcss_test.js +7 -0
- package/coms/compile/scanner.js +653 -0
- package/coms/compile/scanner2.js +202 -0
- package/coms/compile/scanner2_test.js +110 -0
- package/coms/compile/scanner_test.js +10 -0
- package/coms/compile/unstruct.js +712 -0
- package/coms/compile/unstruct_test.js +54 -0
- package/coms/compile/washcode.js +237 -0
- package/coms/compile/washcode_test.js +17 -0
- package/coms/docs/helps.js +71 -0
- package/coms/docs/markdown.js +248 -0
- package/coms/frame/route.js +1 -1
- package/coms/reptile/colored_console.js +2 -1
- package/coms/zimoli/cless.js +1 -0
- package/coms/zimoli/css.js +1 -9
- package/coms/zimoli/html.js +1 -1
- package/coms/zimoli/menu.js +1 -1
- package/coms/zimoli/menuItem.html +1 -1
- package/coms/zimoli/menuItem.js +1 -1
- package/coms/zimoli/render.js +14 -3
- package/coms/zimoli/text.js +1 -1
- package/coms/zimoli/tree.js +2 -4
- package/coms/zimoli/zimoli.js +39 -12
- package/docs/compare.md +5 -5
- package/docs/components.jsp +24 -0
- package/docs/index.html +18 -26
- package/docs/main.xht +207 -0
- package/docs/mark.xht +171 -0
- package/docs/version.jsp +3 -0
- package/docs/welcome.jsp +8 -0
- package/docs//345/221/275/344/273/244.xht +100 -0
- package/docs//347/211/210/346/234/254/350/257/264/346/230/216.md +9 -0
- package/docs//347/273/204/344/273/266.xht +111 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/readme.md +8 -11
- package/apis/docs/getAllComponents.js +0 -69
- package/apps/moue/home/index.html +0 -1
- package/apps/moue/home/index.less +0 -0
- package/docs/data/iconfont-kugou.eot +0 -0
- package/docs/data/iconfont-kugou.otf +0 -0
- package/docs/data/iconfont-kugou.ttf +0 -0
- package/docs/data/iconfont-kugou.woff +0 -0
- package/docs/data/web.xml +0 -4742
- package/docs/main.js +0 -17
package/coms/zimoli/html.js
CHANGED
package/coms/zimoli/menu.js
CHANGED
|
@@ -139,7 +139,7 @@ function main(elem, mode) {
|
|
|
139
139
|
});
|
|
140
140
|
tree(elem, function (index, item, menu) {
|
|
141
141
|
var e = generator(index, item);
|
|
142
|
-
if (!e || e.children.length) return e;
|
|
142
|
+
if (!e || !e.children || e.children.length) return e;
|
|
143
143
|
var m = menuItem(null, menu, elem.useIcon[0]);
|
|
144
144
|
return m;
|
|
145
145
|
});
|
package/coms/zimoli/menuItem.js
CHANGED
|
@@ -7,7 +7,7 @@ function main(elem, scope, hasIcon) {
|
|
|
7
7
|
else if (item.$scope) {
|
|
8
8
|
var scope = item.$scope;
|
|
9
9
|
}
|
|
10
|
-
if (scope.menu) scope = scope.menu;
|
|
10
|
+
if (scope.menu || scope.$item) scope = scope.menu || scope.$item;
|
|
11
11
|
if (hasIcon === undefined) hasIcon = !!scope.icon;
|
|
12
12
|
if (scope.disabled || scope.enabled === false) {
|
|
13
13
|
item.setAttribute('disabled', '');
|
package/coms/zimoli/render.js
CHANGED
|
@@ -244,7 +244,7 @@ var createRepeat = function (search, id = 0) {
|
|
|
244
244
|
}
|
|
245
245
|
else {
|
|
246
246
|
var c = changes[k];
|
|
247
|
-
if (clonedElements[k]) if (!c
|
|
247
|
+
if (clonedElements[k]) if (!c) return clonedElements1[k] = clonedElements[k];
|
|
248
248
|
}
|
|
249
249
|
var clone = element.cloneNode();
|
|
250
250
|
clone.innerHTML = element.innerHTML;
|
|
@@ -443,6 +443,7 @@ var createBinder = function (binder) {
|
|
|
443
443
|
this.renders.push(function () {
|
|
444
444
|
var value = getter(this);
|
|
445
445
|
if (deepEqual.shallow(value, oldValue)) return;
|
|
446
|
+
var oldv = oldValue;
|
|
446
447
|
oldValue = value;
|
|
447
448
|
if (isNode(value) || isArray(value)) {
|
|
448
449
|
if (value !== this.firstChild) {
|
|
@@ -451,7 +452,7 @@ var createBinder = function (binder) {
|
|
|
451
452
|
}
|
|
452
453
|
} else {
|
|
453
454
|
if (isEmpty(value)) value = '';
|
|
454
|
-
if (binder(this) !== value) binder(this, value);
|
|
455
|
+
if (binder(this) !== value) binder(this, value, oldv);
|
|
455
456
|
}
|
|
456
457
|
});
|
|
457
458
|
|
|
@@ -489,7 +490,17 @@ var directives = {
|
|
|
489
490
|
if (arguments.length === 1) return elem.style.display !== 'none';
|
|
490
491
|
elem.style.display = value ? '' : 'none';
|
|
491
492
|
}),
|
|
492
|
-
style: createBinder(
|
|
493
|
+
style: createBinder(function (elem, value, oldValue) {
|
|
494
|
+
if (isString(value)) value = parseKV(value, ';', ':');
|
|
495
|
+
if (isString(oldValue)) oldValue = parseKV(oldValue, ";", ":");
|
|
496
|
+
var changed = getChanges(value, oldValue);
|
|
497
|
+
var targetValue = Object.create(null);
|
|
498
|
+
for (var k in changed) {
|
|
499
|
+
targetValue[k] = isEmpty(value[k]) ? "" : value[k];
|
|
500
|
+
}
|
|
501
|
+
value = targetValue;
|
|
502
|
+
css(elem, value);
|
|
503
|
+
}),
|
|
493
504
|
src(src) {
|
|
494
505
|
var parsedSrc = this.$src;
|
|
495
506
|
return src2.call(this, parsedSrc ? parsedSrc.srcName : src);
|
package/coms/zimoli/text.js
CHANGED
package/coms/zimoli/tree.js
CHANGED
|
@@ -44,9 +44,9 @@ function tree() {
|
|
|
44
44
|
}
|
|
45
45
|
var dom = [], root = null;
|
|
46
46
|
var changed_index, changed_offset;
|
|
47
|
-
var saved_top, saved_offset, timer = 0, timeout = function () {
|
|
47
|
+
var saved_top, saved_offset, timer = 0, timeout = function (call, time) {
|
|
48
48
|
clearTimeout(timer);
|
|
49
|
-
timer = setTimeout
|
|
49
|
+
timer = setTimeout(call, time + 100);
|
|
50
50
|
};
|
|
51
51
|
var banner = list(element, function (index) {
|
|
52
52
|
var coms = dom;
|
|
@@ -216,9 +216,7 @@ function tree() {
|
|
|
216
216
|
}
|
|
217
217
|
setState(false);
|
|
218
218
|
z0();
|
|
219
|
-
console.log(change_elem.getAttribute("style"),margin_top)
|
|
220
219
|
var res = transition(change_elem, { transition: `margin-top ${time(margin_top)}s ease-out`, marginTop: fromOffset(margin_top) }, false);
|
|
221
|
-
console.log(change_elem.getAttribute("style"),margin_top)
|
|
222
220
|
timeout(z1, res);
|
|
223
221
|
}
|
|
224
222
|
});
|
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -134,16 +134,20 @@ function go(pagepath, args, history_name, oldpagepath) {
|
|
|
134
134
|
}
|
|
135
135
|
return true;
|
|
136
136
|
}
|
|
137
|
+
var realpath = getpgpath(pagepath);
|
|
138
|
+
if (realpath.length > 1) var [pgpath, args0] = realpath;
|
|
139
|
+
else pgpath = pagepath;
|
|
137
140
|
setZimoliParams(pagepath, { data: args, from: oldpagepath, options, roles, id });
|
|
138
|
-
prepare(
|
|
141
|
+
prepare(pgpath, function (res) {
|
|
139
142
|
if (!res.roles || res.roles === true) res.roles = !!roles;
|
|
140
143
|
});
|
|
141
|
-
if (!page_generators[
|
|
144
|
+
if (!page_generators[pgpath]) {
|
|
142
145
|
return zimoli(pagepath, args, history_name, oldpagepath);
|
|
143
146
|
}
|
|
144
|
-
var page_object = page_generators[
|
|
147
|
+
var page_object = page_generators[pgpath];
|
|
148
|
+
if (!isEmpty(args0)) page_object.state.data = args, args = args0;
|
|
145
149
|
var fullfill = function () {
|
|
146
|
-
var _page = create(
|
|
150
|
+
var _page = create(pgpath, args, oldpagepath);
|
|
147
151
|
var isDestroy = pushstate(pagepath, history_name, oldpagepath);
|
|
148
152
|
if (isNode(history_name)) {
|
|
149
153
|
if (history_name.activate === pagepath && history_name.activateNode === _page) return fullfill_is_dispatched--;
|
|
@@ -188,13 +192,28 @@ var page_generators = {};
|
|
|
188
192
|
* 如果args是bool值true,那么当执行history.back()时,此对象被清除
|
|
189
193
|
*/
|
|
190
194
|
var loading_tree = {};
|
|
195
|
+
var pathmaped = Object.create(null);
|
|
191
196
|
var getpgpath = function (pagepath) {
|
|
192
197
|
pagepath = /^[@#!]/.test(pagepath) ? pagepath.slice(1) : pagepath;
|
|
193
198
|
if (pagepath === 'main') pagepath = modules.efrontPath || "/main";
|
|
194
|
-
|
|
199
|
+
var pathlist = pagepath.split("/");
|
|
200
|
+
var params = [];
|
|
201
|
+
while (pathlist.length && !pathmaped[pathlist.join("/")]) params.push(pathlist.pop());
|
|
202
|
+
if (pathlist.length) {
|
|
203
|
+
pagepath = pathlist.join("/");
|
|
204
|
+
var mparams = pathmaped[pagepath];
|
|
205
|
+
var argobj = {};
|
|
206
|
+
if (!mparams.length) argobj = params.reverse().join("/");
|
|
207
|
+
else {
|
|
208
|
+
for (var m of mparams) argobj[m] = params.pop();
|
|
209
|
+
if (params.length) argobj[m] += "/" + params.reverse().join("/");
|
|
210
|
+
}
|
|
211
|
+
return [pagepath, argobj];
|
|
212
|
+
}
|
|
213
|
+
return [pagepath];
|
|
195
214
|
};
|
|
196
215
|
function createState(pgpath) {
|
|
197
|
-
var pgpath = getpgpath(pgpath);
|
|
216
|
+
var [pgpath] = getpgpath(pgpath);
|
|
198
217
|
var _zimoli_state_key = _zimoli_state_prefix + pgpath;
|
|
199
218
|
var state = function state(condition, setAsAdditional = condition !== null) {
|
|
200
219
|
var state_string = hostoryStorage.getItem(_zimoli_state_key);
|
|
@@ -233,7 +252,7 @@ function prepare(pgpath, ok) {
|
|
|
233
252
|
for (var p of pgpath) prepare(p);
|
|
234
253
|
return;
|
|
235
254
|
}
|
|
236
|
-
var pgpath = getpgpath(pgpath);
|
|
255
|
+
var [pgpath] = getpgpath(pgpath);
|
|
237
256
|
if (page_generators[pgpath]) {
|
|
238
257
|
if (isFunction(ok)) {
|
|
239
258
|
var res = page_generators[pgpath];
|
|
@@ -377,7 +396,7 @@ function prepare(pgpath, ok) {
|
|
|
377
396
|
}
|
|
378
397
|
function create(pagepath, args, from, needroles) {
|
|
379
398
|
if (typeof pagepath === 'string') {
|
|
380
|
-
var page_object =
|
|
399
|
+
var page_object = page_generators[pagepath];
|
|
381
400
|
if (!page_object) {
|
|
382
401
|
throw new Error(`调用create前请确保prepare执行完毕:${pagepath}`);
|
|
383
402
|
}
|
|
@@ -405,7 +424,7 @@ function create(pagepath, args, from, needroles) {
|
|
|
405
424
|
var _page = pg.call(state, args, from);
|
|
406
425
|
if (undefined === args || null === args) args = {};
|
|
407
426
|
if (_page) {
|
|
408
|
-
_page.with = _with_elements;
|
|
427
|
+
if (_with_elements.length) _page.with = _with_elements.concat(_page.with || []);
|
|
409
428
|
if (args.initialStyle) _page.initialStyle = args.initialStyle;
|
|
410
429
|
if (args.holdupStyle) _page.holdupStyle = args.holdupStyle;
|
|
411
430
|
if (_page.initialStyle && !_page.holdupStyle) {
|
|
@@ -483,7 +502,7 @@ var pushstate = function (path_name, history_name, oldpagepath) {
|
|
|
483
502
|
history[history_name] = [path_name];
|
|
484
503
|
} else {
|
|
485
504
|
var _history = history[history_name];
|
|
486
|
-
if ([].indexOf.call(_history, oldpagepath, 0) < 0) {
|
|
505
|
+
if (oldpagepath && [].indexOf.call(_history, oldpagepath, 0) < 0) {
|
|
487
506
|
_history.splice(root_path === _history[0], _history.length);
|
|
488
507
|
isDestroy = true;
|
|
489
508
|
}
|
|
@@ -513,14 +532,14 @@ var popstate = function (path_name, history_name) {
|
|
|
513
532
|
}
|
|
514
533
|
};
|
|
515
534
|
var getCurrentHash = function () {
|
|
516
|
-
var _historylist = history[current_history];
|
|
535
|
+
var _historylist = history[current_history] || [];
|
|
517
536
|
var history_name = current_history.replace(/\/$/, '');
|
|
518
537
|
if (rootElements.length) {
|
|
519
538
|
return `#${history_name}/`;
|
|
520
539
|
}
|
|
521
540
|
if (_historylist.length < 2) return "";
|
|
522
541
|
var targeturl = `#${history_name}${_historylist.length ? _historylist[_historylist.length - 1] : ""}`;
|
|
523
|
-
return targeturl;
|
|
542
|
+
return encodeURI(targeturl);
|
|
524
543
|
};
|
|
525
544
|
|
|
526
545
|
var fixurl = function () {
|
|
@@ -669,6 +688,14 @@ zimoli.setStorage = function (storage) {
|
|
|
669
688
|
} catch (e) {
|
|
670
689
|
}
|
|
671
690
|
};
|
|
691
|
+
zimoli.register = function (pathlike) {
|
|
692
|
+
var params = [];
|
|
693
|
+
pathlike = pathlike.replace(/\/\:(^[^\/]+)?/g, function (_, id) {
|
|
694
|
+
params.push(id);
|
|
695
|
+
return '';
|
|
696
|
+
});
|
|
697
|
+
pathmaped[pathlike] = params;
|
|
698
|
+
};
|
|
672
699
|
zimoli.clearHistory = function () {
|
|
673
700
|
hostoryStorage.removeItem(history_session_object_key);
|
|
674
701
|
history = {};
|
package/docs/compare.md
CHANGED
|
@@ -258,10 +258,10 @@ function main(elem){
|
|
|
258
258
|
styles:[],
|
|
259
259
|
})
|
|
260
260
|
class ComponentName implements OnChanges,AfterViewInit,OnInit,OnDestroy{
|
|
261
|
-
@Input() params1
|
|
262
|
-
@Input() params2
|
|
263
|
-
@Output() event1
|
|
264
|
-
@Output() event2
|
|
261
|
+
@Input() params1;
|
|
262
|
+
@Input() params2;
|
|
263
|
+
@Output() event1;
|
|
264
|
+
@Output() event2;
|
|
265
265
|
constructor(){
|
|
266
266
|
}
|
|
267
267
|
ngOnInit(){
|
|
@@ -272,7 +272,7 @@ class ComponentName implements OnChanges,AfterViewInit,OnInit,OnDestroy{
|
|
|
272
272
|
}
|
|
273
273
|
ngOnChanges(){
|
|
274
274
|
// 参数变化时触发
|
|
275
|
-
}
|
|
275
|
+
}
|
|
276
276
|
ngAfterViewInit(){
|
|
277
277
|
// 渲染完成后触发
|
|
278
278
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script serverside>
|
|
2
|
+
|
|
3
|
+
var fs = require("fs").promises;
|
|
4
|
+
var path = require("path");
|
|
5
|
+
var comm_file_reg = /\.([tj]sx?|xht|md|less)$/i;
|
|
6
|
+
var basepath = path.join(String(__efront), 'coms');
|
|
7
|
+
if (req.id) {
|
|
8
|
+
var compath = path.join(basepath, req.id);
|
|
9
|
+
if (!comm_file_reg.test(req.id) || !/^\.\./.test(path.relative(compath, basepath))) return forbidden("禁止访问");
|
|
10
|
+
return fs.readFile(compath);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
var readdir = async function (a) {
|
|
14
|
+
var b = path.join(basepath, a);
|
|
15
|
+
var names = await fs.readdir(b);
|
|
16
|
+
names = names.filter(name => {
|
|
17
|
+
if (/#/.test(name) || !comm_file_reg.test(name)) return false;
|
|
18
|
+
return true;
|
|
19
|
+
});
|
|
20
|
+
return { children: names, name: a };
|
|
21
|
+
};
|
|
22
|
+
var data = await queue.call(["basic", "zimoli", "reptile", "frame"], readdir);
|
|
23
|
+
return JSON.stringify(data);
|
|
24
|
+
</script>
|
package/docs/index.html
CHANGED
|
@@ -1,29 +1,6 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<!--
|
|
3
|
-
|
|
4
|
-
进入8点钟,
|
|
5
|
-
外边已是黑夜,
|
|
6
|
-
时不时地传来一阵寒冷。
|
|
7
|
-
天空由蔚蓝变成深蓝,
|
|
8
|
-
蓝得深邃,
|
|
9
|
-
蓝得发黑,
|
|
10
|
-
蓝得让人感到遥不可及。
|
|
11
|
-
我的心似乎已经冰凉,
|
|
12
|
-
几乎找不到一丁点的暖意,
|
|
13
|
-
望着远方的天空,
|
|
14
|
-
看不到星星,
|
|
15
|
-
也看不到月亮,
|
|
16
|
-
不知星在何方,
|
|
17
|
-
不知月在何方。
|
|
18
|
-
|
|
19
|
-
心又在何方?
|
|
20
|
-
理想变得遥远,
|
|
21
|
-
远处已经渺茫。
|
|
22
|
-
总是想知道,
|
|
23
|
-
但又不能知道:
|
|
24
|
-
以后会怎样。
|
|
25
|
-
|
|
26
|
-
http://efront.cc
|
|
3
|
+
http://efront.cc/docs/
|
|
27
4
|
-->
|
|
28
5
|
<html lang="zh-CN">
|
|
29
6
|
|
|
@@ -33,7 +10,20 @@
|
|
|
33
10
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
34
11
|
<link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
|
|
35
12
|
<meta name="viewport" content="initial-scale=1,maximum-scale=1,width=device-width" />
|
|
36
|
-
<title>
|
|
13
|
+
<title>efront 文档</title>
|
|
14
|
+
<style>
|
|
15
|
+
body,
|
|
16
|
+
html {
|
|
17
|
+
height: 100%;
|
|
18
|
+
margin: 0;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
*,
|
|
22
|
+
::before,
|
|
23
|
+
::after {
|
|
24
|
+
box-sizing: border-box;
|
|
25
|
+
}
|
|
26
|
+
</style>
|
|
37
27
|
<script deleteoncompile>
|
|
38
28
|
-function (body, window) {
|
|
39
29
|
body.removeChild(body.getElementsByTagName("script")[0]);
|
|
@@ -49,6 +39,8 @@
|
|
|
49
39
|
</script>
|
|
50
40
|
</head>
|
|
51
41
|
|
|
52
|
-
<body scroll=no max-render=1440
|
|
42
|
+
<body scroll=no max-render=1440>
|
|
43
|
+
走过多少路口,听过多少叹息,我认真着你的不知所措..
|
|
44
|
+
</body>
|
|
53
45
|
|
|
54
46
|
</html>
|
package/docs/main.xht
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
:root {
|
|
3
|
+
--leftwidth: 260px;
|
|
4
|
+
display: block;
|
|
5
|
+
width: auto;
|
|
6
|
+
top: 0;
|
|
7
|
+
left: 0;
|
|
8
|
+
right: 0;
|
|
9
|
+
margin-right: -16px;
|
|
10
|
+
height: 100%;
|
|
11
|
+
position: absolute;
|
|
12
|
+
padding-left: var(--leftwidth);
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:root+scrollbar {
|
|
17
|
+
right: 0;
|
|
18
|
+
background: transparent;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
:root>* {
|
|
22
|
+
vertical-align: top;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
:root>menu f {
|
|
26
|
+
margin-left: 6px;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
:root>menu f[test]:before {
|
|
30
|
+
color: #fc0;
|
|
31
|
+
content: "测";
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
:root>menu f[dang]:before {
|
|
35
|
+
color: #2cf;
|
|
36
|
+
content: "档";
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
:root>menu f[less]:before {
|
|
40
|
+
color: #2c9;
|
|
41
|
+
content: "样";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
menu {
|
|
45
|
+
width: var(--leftwidth);
|
|
46
|
+
margin-left: -var(--leftwidth);
|
|
47
|
+
height: 100%;
|
|
48
|
+
display: inline-block;
|
|
49
|
+
min-width: 200px;
|
|
50
|
+
max-width: 600px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
div1 {
|
|
54
|
+
display: inline-block;
|
|
55
|
+
width: 100%;
|
|
56
|
+
height: 100%;
|
|
57
|
+
font-size: 16px;
|
|
58
|
+
vertical-align: top;
|
|
59
|
+
overflow-x: hidden;
|
|
60
|
+
overflow-y: scroll;
|
|
61
|
+
position: relative;
|
|
62
|
+
background: linear-gradient(#f2f4ff, 70%, #e9fff2);
|
|
63
|
+
}
|
|
64
|
+
:root>menu v{
|
|
65
|
+
display: inline-block;
|
|
66
|
+
font-size: 12px;
|
|
67
|
+
color: #79a;
|
|
68
|
+
margin-left: 12px;
|
|
69
|
+
}
|
|
70
|
+
</style>
|
|
71
|
+
<menu #mulu inline -src="m in menus" @active="openMenu(m)">
|
|
72
|
+
<div2></div2>
|
|
73
|
+
</menu>
|
|
74
|
+
<div1 #content></div1>
|
|
75
|
+
<script>
|
|
76
|
+
var menus = [
|
|
77
|
+
{
|
|
78
|
+
name: "efront 简介",
|
|
79
|
+
children: [
|
|
80
|
+
{ name: "使用说明", md: "readme.md" },
|
|
81
|
+
{ name: "兼容性说明", md: "coms/basic_/readme.md" },
|
|
82
|
+
{ name: "版本说明", md: "docs/版本说明.md" },
|
|
83
|
+
{ name: "与前端框架对比", md: "docs/compare.md" },
|
|
84
|
+
// { name: "notive", md: "docs/notive.md" },
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: "组件库",
|
|
89
|
+
closed: true,
|
|
90
|
+
children: []
|
|
91
|
+
},
|
|
92
|
+
// {
|
|
93
|
+
// name: "小工具"
|
|
94
|
+
// }
|
|
95
|
+
];
|
|
96
|
+
zimoli.register("/mark");
|
|
97
|
+
zimoli.register("/命令");
|
|
98
|
+
zimoli.register("/组件");
|
|
99
|
+
contextmenu(document, function (event) {
|
|
100
|
+
if (!window.require) return;
|
|
101
|
+
return menuList(null, [
|
|
102
|
+
{
|
|
103
|
+
"name": "开发者选项",
|
|
104
|
+
do() {
|
|
105
|
+
window.require("electron").ipcRenderer.send("window", "open-dev-tools");
|
|
106
|
+
window.resizeBy(400, 0);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
]);
|
|
110
|
+
})
|
|
111
|
+
var initVersionInfo = async function () {
|
|
112
|
+
var xhr = await cross("get", "version");
|
|
113
|
+
console.log(xhr)
|
|
114
|
+
var version = xhr.response.split(",");
|
|
115
|
+
menus[0].name += ` <v>${version[0]}</v>`;
|
|
116
|
+
}
|
|
117
|
+
var initCommandsDocs = async function () {
|
|
118
|
+
var helps = await init("docs$helps");
|
|
119
|
+
var m = {
|
|
120
|
+
name: "命令参考",
|
|
121
|
+
children: [
|
|
122
|
+
{ name: "防御系", a: "f" },
|
|
123
|
+
{ name: "强攻系", a: "q" },
|
|
124
|
+
{ name: "辅助系", a: "z" },
|
|
125
|
+
{ name: "控制系", a: "k" },
|
|
126
|
+
{ name: "暗器系", a: "a" }
|
|
127
|
+
]
|
|
128
|
+
};
|
|
129
|
+
m.children.forEach(a => {
|
|
130
|
+
a.children = helps.helps.filter(h => h.type === a.a);
|
|
131
|
+
a.children.forEach(c => {
|
|
132
|
+
c.name = c.info;
|
|
133
|
+
c.path = `/命令/${c.name}`;
|
|
134
|
+
});
|
|
135
|
+
a.closed = true;
|
|
136
|
+
});
|
|
137
|
+
menus.splice(1, 0, m);
|
|
138
|
+
};
|
|
139
|
+
var initComponentDocs = async function () {
|
|
140
|
+
var m = await cross("get", "components");
|
|
141
|
+
m = JSON.parse(m.response);
|
|
142
|
+
for (var c of m) {
|
|
143
|
+
var map = Object.create(null);
|
|
144
|
+
var children = [];
|
|
145
|
+
for (var a of c.children) {
|
|
146
|
+
if (!/\.([jt]sx?|xht)$/i.test(a) || /_test\.([tj]sx?|xht)$/i.test(a)) {
|
|
147
|
+
map[a.replace(/\.\w+$/g, a => a.toLowerCase())] = a;
|
|
148
|
+
continue;
|
|
149
|
+
}
|
|
150
|
+
children.push({ name: a, path: `/组件/${c.name}/${a}` });
|
|
151
|
+
}
|
|
152
|
+
for (var cc of children) {
|
|
153
|
+
cc.data = {
|
|
154
|
+
mark: !!map[cc.name.replace(/\.[tj]sx?$/i, ".md")],
|
|
155
|
+
test: !!map[cc.name.replace(/\.[tj]sx?$/i, "_test.js")],
|
|
156
|
+
less: !!map[cc.name.replace(/\.[tj]sx?$/i, ".less")]
|
|
157
|
+
}
|
|
158
|
+
if (cc.data.less) cc.name += "<f less></f>"
|
|
159
|
+
if (cc.data.mark) cc.name += "<f dang></f>"
|
|
160
|
+
if (cc.data.test) cc.name += "<f test></f>"
|
|
161
|
+
}
|
|
162
|
+
c.children = children;
|
|
163
|
+
c.closed = true;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
menus[2].children = m;
|
|
167
|
+
};
|
|
168
|
+
var initMenus = async function () {
|
|
169
|
+
menus[0].children.forEach(c => { c.path = "/mark/" + c.md });
|
|
170
|
+
zimoli.switch('', scope.content, menus[0].children[0].path);
|
|
171
|
+
await initVersionInfo();
|
|
172
|
+
await initCommandsDocs();
|
|
173
|
+
await initComponentDocs();
|
|
174
|
+
var route = await init("frame$route");
|
|
175
|
+
scope.menus = route.update(menus);
|
|
176
|
+
zimoli();
|
|
177
|
+
render.refresh();
|
|
178
|
+
}
|
|
179
|
+
var scope = {
|
|
180
|
+
menus,
|
|
181
|
+
div2(elem, scope) {
|
|
182
|
+
if (scope.m.data?.mark) elem.setAttribute("mark", '');
|
|
183
|
+
if (scope.m.data?.test) elem.setAttribute("test", '');
|
|
184
|
+
return menuItem.apply(this, arguments);
|
|
185
|
+
},
|
|
186
|
+
grid,
|
|
187
|
+
menu,
|
|
188
|
+
openMenu(m) {
|
|
189
|
+
this.menus.open(m);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var page = document.createElement('grid');
|
|
193
|
+
page.innerHTML = template;
|
|
194
|
+
render(page, scope);
|
|
195
|
+
var s = scrollbar();
|
|
196
|
+
on("mounted")(page, initMenus);
|
|
197
|
+
s.bindTarget(scope.content);
|
|
198
|
+
page.with = s;
|
|
199
|
+
bind("render")(page, function () {
|
|
200
|
+
requestAnimationFrame(function () {
|
|
201
|
+
s.reshape();
|
|
202
|
+
})
|
|
203
|
+
});
|
|
204
|
+
function main() {
|
|
205
|
+
return page;
|
|
206
|
+
}
|
|
207
|
+
</script>
|