efront 4.5.7 → 4.5.10
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/pivot/log/boot.js +36 -49
- package/apps/pivot/log/boot.less +31 -0
- package/coms/basic/data.js +1 -1
- package/coms/compile/Javascript.js +1 -1
- package/coms/compile/common.js +2 -2
- package/coms/pivot/acme2.js +1 -1
- package/coms/zimoli/cless.js +1 -1
- package/coms/zimoli/field.less +4 -0
- package/coms/zimoli/model.js +1 -0
- package/coms/zimoli/model.less +5 -0
- package/coms/zimoli/table.html +1 -1
- package/docs//347/273/204/344/273/266.xht +110 -112
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/apps/pivot/log/boot.js
CHANGED
|
@@ -1,63 +1,50 @@
|
|
|
1
1
|
cross.addDirect(/^https?\:\/\/([[a-z\.\d\:\/%]+\]|[\d\.]+)(\:\d+)?\//);
|
|
2
|
+
var checkPort = async function (p, ip) {
|
|
3
|
+
if (!p.host) {
|
|
4
|
+
if (/^::ffff:\d+\.\d+\.\d+\.\d+$/i.test(ip)) {
|
|
5
|
+
ip = ip.slice(7);
|
|
6
|
+
}
|
|
7
|
+
else {
|
|
8
|
+
ip = `[${ip}]`;
|
|
9
|
+
}
|
|
10
|
+
p.locate(ip);
|
|
11
|
+
}
|
|
12
|
+
try {
|
|
13
|
+
p.locate("/:version");
|
|
14
|
+
var { response } = await cross("options", p.href);
|
|
15
|
+
if (/^efront/.test(response)) {
|
|
16
|
+
p.ok = true;
|
|
17
|
+
}
|
|
18
|
+
} catch (e) {
|
|
19
|
+
p.error = e;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
}
|
|
2
23
|
var fields = refilm`
|
|
3
|
-
地址/ip
|
|
4
|
-
地理位置/
|
|
5
|
-
var ip =
|
|
24
|
+
IP地址/ip text/120
|
|
25
|
+
地理位置/address/查看 act/80 ${async function (a) {
|
|
26
|
+
var ip = a.ip;
|
|
6
27
|
var m = /(\d+\.){3}\d+$/.exec(ip);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
appendChild(e, l);
|
|
10
|
-
l.innerHTML = ' ';
|
|
11
|
-
var setAddress = function (a) {
|
|
12
|
-
l.innerText = a;
|
|
13
|
-
};
|
|
14
|
-
if (e.data.address) setAddress(e.data.address);
|
|
15
|
-
else e.data.address = data.from("iplocation", { ip: m[0] }, function (a) {
|
|
16
|
-
setAddress(a.address);
|
|
17
|
-
return a.address;
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
return e;
|
|
28
|
+
var { address } = await data.from("iplocation", { ip: m ? m[0] : ip });
|
|
29
|
+
a.address = address;
|
|
21
30
|
}}
|
|
22
31
|
启动时间/time ${function (e) {
|
|
23
32
|
e.innerHTML = filterTime(e.data[e.field.key]);
|
|
24
33
|
}}
|
|
25
|
-
|
|
34
|
+
绑定地址/port 120/${async function (e) {
|
|
26
35
|
var { data, field } = e;
|
|
27
|
-
var ports = data[field.key].split(/,/);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var protocol = /^https/.test(p) ? "https://" : "http://";
|
|
35
|
-
p = p.replace(/[^\d]+/g, '');
|
|
36
|
-
if (p) p = ":" + p;
|
|
37
|
-
try {
|
|
38
|
-
var ip = data.ip;
|
|
39
|
-
if (!ip) return;
|
|
40
|
-
if (/^::ffff:\d+\.\d+\.\d+\.\d+$/i.test(ip)) {
|
|
41
|
-
ip = ip.slice(7);
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
ip = `[${ip}]`;
|
|
45
|
-
}
|
|
46
|
-
var xhr = await cross("options", `${protocol}${ip}${p}/:version`);
|
|
47
|
-
if (xhr.responseText === 'efront ' + data.version) {
|
|
48
|
-
loaded[cx] = (`<span style="color:green">${p0}</span>`);
|
|
49
|
-
} else {
|
|
50
|
-
loaded[cx] = (`<span style="color:red">${p0}</span>`);
|
|
51
|
-
}
|
|
52
|
-
} catch (e) {
|
|
53
|
-
loaded[cx] = (`<span style="color:gray">${p0}</span>`);
|
|
54
|
-
}
|
|
55
|
-
e.innerHTML = loaded.join(' ');
|
|
56
|
-
}
|
|
36
|
+
var ports = data[field.key].split(/,/).map(p => parseURL(p));
|
|
37
|
+
e.innerHTML = `<a -repeat="p in ports" @click="checkPort(p,ip)" -class="{ok:p.ok,error:p.error}"><span -bind=p></span></a>`;
|
|
38
|
+
render(e, {
|
|
39
|
+
ports,
|
|
40
|
+
ip: data.ip,
|
|
41
|
+
checkPort,
|
|
42
|
+
})
|
|
57
43
|
}}
|
|
58
44
|
版本/version input
|
|
59
45
|
进程/pid
|
|
60
|
-
|
|
46
|
+
`;
|
|
47
|
+
|
|
61
48
|
function main() {
|
|
62
49
|
var page = div();
|
|
63
50
|
page.innerHTML = template;
|
package/apps/pivot/log/boot.less
CHANGED
|
@@ -8,4 +8,35 @@ model {
|
|
|
8
8
|
color: #666;
|
|
9
9
|
font-size: 9px;
|
|
10
10
|
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
model[type=function] {
|
|
14
|
+
display: inline-block;
|
|
15
|
+
|
|
16
|
+
a {
|
|
17
|
+
text-align: left;
|
|
18
|
+
&.ok {
|
|
19
|
+
color: green;
|
|
20
|
+
|
|
21
|
+
&:after {
|
|
22
|
+
content: "(接通)";
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&.error {
|
|
27
|
+
&:after {
|
|
28
|
+
content: "(出错)";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
color: red;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:nth-child(2),
|
|
35
|
+
&:nth-last-child(2) {
|
|
36
|
+
padding: 0;
|
|
37
|
+
line-height: 1.2;
|
|
38
|
+
font-size: 14px;
|
|
39
|
+
display: block;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
11
42
|
}
|
package/coms/basic/data.js
CHANGED
package/coms/compile/common.js
CHANGED
|
@@ -1478,8 +1478,8 @@ var insertAfter = function (o) {
|
|
|
1478
1478
|
if (next) next.prev = o;
|
|
1479
1479
|
else queue.last = o;
|
|
1480
1480
|
};
|
|
1481
|
-
var unshort = function (o) {
|
|
1482
|
-
insertBefore.call(o.queue, o, { text: o.text, short: false, isprop: true, type: PROPERTY }, { text: ':', type: STAMP });
|
|
1481
|
+
var unshort = function (o, text) {
|
|
1482
|
+
insertBefore.call(o.queue, o, { text: text || o.text, short: false, isprop: true, type: PROPERTY }, { text: ':', type: STAMP });
|
|
1483
1483
|
o.isprop = false;
|
|
1484
1484
|
o.type = EXPRESS;
|
|
1485
1485
|
delete o.short;
|
package/coms/pivot/acme2.js
CHANGED
|
@@ -363,7 +363,7 @@ var acme2 = new class {
|
|
|
363
363
|
}
|
|
364
364
|
if (o.status === 'ready') {
|
|
365
365
|
await this.finalizeOrder(o, upload);
|
|
366
|
-
o = await this.waitStatus();
|
|
366
|
+
o = await this.waitStatus(o);
|
|
367
367
|
}
|
|
368
368
|
if (o.status === 'valid') {
|
|
369
369
|
var cert = await data.fromURL(o.certificate);
|
package/coms/zimoli/cless.js
CHANGED
|
@@ -18,7 +18,7 @@ var _create = function (commFactory, className, _invoke) {
|
|
|
18
18
|
commFactory.className = className;
|
|
19
19
|
keys(commFactory).map(k => result[k] = commFactory[k]);
|
|
20
20
|
result.call = function (context, ...args) {
|
|
21
|
-
if (
|
|
21
|
+
if (isHandled(context)) var release = commFactory.apply(context, args);
|
|
22
22
|
else release = commFactory.apply(result, args);
|
|
23
23
|
if (release) release = _invoke(release, className, _invoke);
|
|
24
24
|
return release;
|
package/coms/zimoli/field.less
CHANGED
package/coms/zimoli/model.js
CHANGED
|
@@ -257,6 +257,7 @@ var readonly_types = {
|
|
|
257
257
|
},
|
|
258
258
|
};
|
|
259
259
|
readonly_types.anchor = readonly_types.url;
|
|
260
|
+
readonly_types.do = readonly_types.act = readonly_types.action = constructors.generator;
|
|
260
261
|
readonly_types.gen = readonly_types.generator = readonly_types.text;
|
|
261
262
|
var createOptionsMap = function (options) {
|
|
262
263
|
if (!isObject(options[0])) return options;
|
package/coms/zimoli/model.less
CHANGED
package/coms/zimoli/table.html
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<td fixed row-index -bind="i+1" :style="adapter.firstChild.getAttribute('style')">
|
|
14
14
|
</td>
|
|
15
15
|
<td fixed:="f.fixed" -repeat="(f,i) in fields" :style="adapter.children[i+1].getAttribute('style')">
|
|
16
|
-
<model -if="!isEmpty(f.key)
|
|
16
|
+
<model -if="!isEmpty(f.key)" :field=f :data=d readonly></model>
|
|
17
17
|
<template -else> </template>
|
|
18
18
|
<a on-click="o.do(d)" -if="isEmpty(f.key)&&f.options&&(!o.when||o.when(d))"
|
|
19
19
|
_type="o.type instanceof Function?o.type(d):o.type" -repeat="o in f.options">
|
|
@@ -13,8 +13,8 @@
|
|
|
13
13
|
[body] {
|
|
14
14
|
border-top: 42px solid transparent;
|
|
15
15
|
padding-top: 40px;
|
|
16
|
+
overflow: auto;
|
|
16
17
|
padding-bottom: 0 !important;
|
|
17
|
-
border-bottom: 46px solid transparent;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
|
|
@@ -53,6 +53,11 @@
|
|
|
53
53
|
color: #29c;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
h2[head] {
|
|
57
|
+
font-size: 18px;
|
|
58
|
+
padding: 6px 14px;
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
h2 b {
|
|
57
62
|
font-size: 14px;
|
|
58
63
|
display: inline-block;
|
|
@@ -62,21 +67,21 @@
|
|
|
62
67
|
}
|
|
63
68
|
|
|
64
69
|
[codearea] {
|
|
65
|
-
width: 100%;
|
|
66
70
|
height: 100%;
|
|
67
71
|
}
|
|
68
72
|
|
|
69
73
|
[codearea]>code {
|
|
70
74
|
overflow: auto;
|
|
71
|
-
|
|
72
|
-
height:
|
|
73
|
-
|
|
75
|
+
display: block;
|
|
76
|
+
height: auto;
|
|
77
|
+
min-height: 100%;
|
|
78
|
+
padding: 10px 20px 40px 20px;
|
|
74
79
|
white-space: nowrap;
|
|
75
80
|
outline: none;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
markdown {
|
|
79
|
-
margin:
|
|
84
|
+
margin: 20px auto;
|
|
80
85
|
}
|
|
81
86
|
|
|
82
87
|
[foot]>button {
|
|
@@ -85,52 +90,55 @@
|
|
|
85
90
|
|
|
86
91
|
.result {
|
|
87
92
|
position: absolute;
|
|
88
|
-
bottom:
|
|
93
|
+
bottom: 40px;
|
|
89
94
|
right: 0;
|
|
90
95
|
left: 0;
|
|
91
|
-
padding: 10px 20px;
|
|
92
96
|
border-top: 1px solid #333;
|
|
93
97
|
background: #fff;
|
|
94
98
|
display: block;
|
|
95
99
|
z-index: 1;
|
|
96
100
|
}
|
|
97
101
|
</style>
|
|
98
|
-
<
|
|
99
|
-
<
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
</
|
|
105
|
-
|
|
106
|
-
<
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
<
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
</
|
|
123
|
-
|
|
124
|
-
<div
|
|
125
|
-
|
|
126
|
-
</div>
|
|
127
|
-
<
|
|
128
|
-
<
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
</
|
|
102
|
+
<form onclick="event.preventDefault()">
|
|
103
|
+
<xmenu -src="(t,i) in tags" @active="saveTagIndex(i)"></xmenu>
|
|
104
|
+
<h2 head>
|
|
105
|
+
<span -bind="name"></span>
|
|
106
|
+
<b -if="doc?.less" l>${i18n`有样式表`}</b>
|
|
107
|
+
<b -if="doc?.mark" w>${i18n`有文档`}</b>
|
|
108
|
+
<b -if="doc?.test" t>${i18n`有测试代码`}</b>
|
|
109
|
+
</h2>
|
|
110
|
+
<div body -if="tags[0].actived">
|
|
111
|
+
<container -if="doc?.url" .src="doc.url">
|
|
112
|
+
</container>
|
|
113
|
+
<p4 envs>
|
|
114
|
+
<span -if="envs?.length">
|
|
115
|
+
${i18n`环境依赖项:`} <m -repeat="c in envs" -bind="c"> </m>
|
|
116
|
+
</span>
|
|
117
|
+
<span -else> ${i18n`无环境依赖项`} </span>
|
|
118
|
+
</p4>
|
|
119
|
+
<p4 imported>
|
|
120
|
+
<span -if="required?.length">
|
|
121
|
+
${i18n`导入项:`} <m -repeat="c in required" -bind="c"></m>
|
|
122
|
+
</span>
|
|
123
|
+
<span -else>
|
|
124
|
+
${i18n`无导入项`}
|
|
125
|
+
</span>
|
|
126
|
+
</p4>
|
|
127
|
+
</div>
|
|
128
|
+
<div body onkeyup="!event.isComposing&&updatecode()" onkeydown.tab="keytab(event)" #coder codearea
|
|
129
|
+
-elseif="tags[1].actived">
|
|
130
|
+
</div>
|
|
131
|
+
<resultpad -if="tags[1].actived" .result #coderesult></resultpad>
|
|
132
|
+
<div foot -if="tags[1].actived">
|
|
133
|
+
<a -if="doc?.test" @click="clearpad()">${i18n`清理`}</a>
|
|
134
|
+
<a -if="doc?.test" @click="loadcode()">${i18n`载入测试代码`}</a>
|
|
135
|
+
<btn @click="execute()">${i18n`运行`}</btn>
|
|
136
|
+
</div>
|
|
137
|
+
</form>
|
|
132
138
|
<script>
|
|
139
|
+
var required, doc, envs;
|
|
133
140
|
var commaps = Object.create(null);
|
|
141
|
+
var form = view;
|
|
134
142
|
var initCommap = function (live) {
|
|
135
143
|
var commap = commaps[live];
|
|
136
144
|
if (!commap) {
|
|
@@ -164,14 +172,14 @@
|
|
|
164
172
|
});
|
|
165
173
|
var 分析 = lazy(async function (com, props) {
|
|
166
174
|
if (props.mark) props.url = '/mark/coms/' + com.replace(/\.js$/i, '.md');
|
|
167
|
-
|
|
168
|
-
|
|
175
|
+
doc = props;
|
|
176
|
+
name = com;
|
|
169
177
|
var xhr = await cross("get", "./components:" + com);
|
|
170
178
|
var code = compile$scanner2(xhr.response);
|
|
171
179
|
code.fix();
|
|
172
|
-
|
|
180
|
+
envs = code.envs;
|
|
173
181
|
if (props.less) envs.cless = true;
|
|
174
|
-
|
|
182
|
+
required = [];
|
|
175
183
|
if (envs.require) code.used.require.forEach(r => {
|
|
176
184
|
var next = r.next;
|
|
177
185
|
if (!next) return;
|
|
@@ -181,27 +189,27 @@
|
|
|
181
189
|
var req = code.program.createString([first]);
|
|
182
190
|
required.push(req);
|
|
183
191
|
});
|
|
184
|
-
|
|
185
|
-
scope.envs = Object.keys(envs);
|
|
192
|
+
envs = Object.keys(envs);
|
|
186
193
|
render.refresh();
|
|
187
194
|
if (tags[1].actived) loadcode();
|
|
188
195
|
});
|
|
189
196
|
var loadcode = async function () {
|
|
190
|
-
|
|
191
|
-
|
|
197
|
+
jschanged = false;
|
|
198
|
+
var modName = name.replace(/\.js$/, '_test');
|
|
199
|
+
if (doc.test) {
|
|
192
200
|
var xhr = await cross('get', "./components:" + modName + '.js');
|
|
193
|
-
|
|
194
|
-
var code = compile$scanner2(
|
|
201
|
+
jstext = xhr.responseText;
|
|
202
|
+
var code = compile$scanner2(jstext);
|
|
195
203
|
var envs = code.envs;
|
|
196
204
|
var vars = code.vars;
|
|
197
205
|
var commName = modName.replace(/^[\s\S]*\//, '');
|
|
198
206
|
var lessName = commName + ".less", lessData;
|
|
199
207
|
var cssWrap = `css-` + +new Date;
|
|
200
|
-
if (
|
|
208
|
+
if (doc.test.indexOf(lessName) >= 0) {
|
|
201
209
|
lessData = await cross("get", "./components:" + modName + ".less");
|
|
202
210
|
lessData = compile$素馨(lessData.responseText, "." + cssWrap);
|
|
203
211
|
if (code.isExpressQueue()) {
|
|
204
|
-
|
|
212
|
+
jstext = `return cless(${jstext},\`${lessData}\`,"${cssWrap}")`;
|
|
205
213
|
}
|
|
206
214
|
else {
|
|
207
215
|
var entryName;
|
|
@@ -209,36 +217,36 @@
|
|
|
209
217
|
else if (vars.Main) entryName = 'Main';
|
|
210
218
|
else if (vars.MAIN) entryName = "MAIN";
|
|
211
219
|
else if (vars[commName]) entryName = commName;
|
|
212
|
-
if (entryName)
|
|
220
|
+
if (entryName) jstext += `\r\nreturn cless(${entryName},\`${lessData}\`,"${cssWrap}")`;
|
|
213
221
|
}
|
|
214
222
|
}
|
|
215
223
|
else {
|
|
216
|
-
if (code.isExpressQueue())
|
|
217
|
-
else if (vars.main)
|
|
218
|
-
else if (vars.Main)
|
|
219
|
-
else if (vars.MAIN)
|
|
220
|
-
else if (vars[modName])
|
|
224
|
+
if (code.isExpressQueue()) jstext = "return " + jstext.trim();
|
|
225
|
+
else if (vars.main) jstext += '\r\nreturn main';
|
|
226
|
+
else if (vars.Main) jstext += '\r\nreturn Main';
|
|
227
|
+
else if (vars.MAIN) jstext += "\r\nreturn MAIN";
|
|
228
|
+
else if (vars[modName]) jstext += "\r\nreturn " + modName;
|
|
221
229
|
}
|
|
222
230
|
var templateName = commName;
|
|
223
231
|
if (envs.template) templateName = 'template';
|
|
224
232
|
if (envs[templateName]) {
|
|
225
233
|
delete envs[templateName];
|
|
226
234
|
var template = await cross("get", './components:' + modName + ".html");
|
|
227
|
-
|
|
235
|
+
jstext = `var ${templateName}={toString(){return \`${template.responseText.replace(/>\s+</g, '><')}\`}};\r\n` + jstext;
|
|
228
236
|
}
|
|
229
|
-
initcode(
|
|
237
|
+
initcode(jstext);
|
|
230
238
|
}
|
|
231
239
|
else {
|
|
232
240
|
initcode('');
|
|
233
241
|
}
|
|
234
|
-
|
|
242
|
+
jstext = coder.innerText;
|
|
235
243
|
execute();
|
|
236
244
|
};
|
|
237
245
|
var blink = "\u0080";
|
|
238
246
|
var markAnchorOffset = function () {
|
|
239
247
|
var { anchorNode, anchorOffset } = document.getSelection();
|
|
240
|
-
if (!anchorNode || !
|
|
241
|
-
var [c] =
|
|
248
|
+
if (!anchorNode || !coder) return;
|
|
249
|
+
var [c] = coder.children;
|
|
242
250
|
if (anchorNode.nodeType === 1) {
|
|
243
251
|
var node = document.createTextNode(blink);
|
|
244
252
|
anchorNode.insertBefore(node, anchorNode.childNodes[anchorOffset])
|
|
@@ -248,7 +256,7 @@
|
|
|
248
256
|
}
|
|
249
257
|
};
|
|
250
258
|
var unmarkAnchorOffset = function () {
|
|
251
|
-
var [c] =
|
|
259
|
+
var [c] = coder.children;
|
|
252
260
|
var node = c.firstChild;
|
|
253
261
|
while (node) {
|
|
254
262
|
if (node.nodeType === 1) {
|
|
@@ -273,7 +281,7 @@
|
|
|
273
281
|
}
|
|
274
282
|
var getAnchorOffset = function () {
|
|
275
283
|
var { anchorNode, anchorOffset } = document.getSelection();
|
|
276
|
-
var [c] =
|
|
284
|
+
var [c] = coder.children;
|
|
277
285
|
if (anchorNode === c || !anchorNode) return -anchorOffset;
|
|
278
286
|
var sibling = anchorNode.previousSibling ? anchorNode.previousSibling : anchorNode.parentNode.previousSibling;
|
|
279
287
|
while (sibling && sibling !== c) {
|
|
@@ -290,7 +298,7 @@
|
|
|
290
298
|
return anchorOffset;
|
|
291
299
|
};
|
|
292
300
|
var setAnchorOffset = function (anchorOffset) {
|
|
293
|
-
var [c] =
|
|
301
|
+
var [c] = coder.children;
|
|
294
302
|
if (anchorOffset < 0) {
|
|
295
303
|
anchorOffset = -anchorOffset;
|
|
296
304
|
if (anchorOffset > c.childNodes.length) anchorOffset = c.childNodes.length;
|
|
@@ -330,48 +338,51 @@
|
|
|
330
338
|
try {
|
|
331
339
|
var colored = codetext("js", innerText, blink);
|
|
332
340
|
} catch { return; }
|
|
333
|
-
var innerHTML =
|
|
341
|
+
var innerHTML = coder.innerHTML.replace(/\s*contenteditable\=[^\s\>]+/i, '');
|
|
334
342
|
if (innerHTML === colored) return;
|
|
335
|
-
var [c0] =
|
|
343
|
+
var [c0] = coder.children;
|
|
336
344
|
var contentLength = c0 ? innerText.length : 0;
|
|
337
345
|
var scrollTop = c0 ? c0.scrollTop : 0;
|
|
338
346
|
var scrollLeft = c0 ? c0.scrollLeft : 0;
|
|
339
|
-
|
|
340
|
-
var [c] =
|
|
347
|
+
coder.innerHTML = colored;
|
|
348
|
+
var [c] = coder.children;
|
|
341
349
|
c.scrollTop = scrollTop;
|
|
342
350
|
c.scrollLeft = scrollLeft;
|
|
343
351
|
c.contentEditable = true;
|
|
344
352
|
};
|
|
345
353
|
var updatecode = lazy(function () {
|
|
354
|
+
var trimreg = /[\s\u00a0\u2002\u0080]+([\}\{\;\[\]\(\)\,\>\<\+\-\*\&\^\/%!~:?])*/g;
|
|
355
|
+
var innerText = coder.innerText;
|
|
356
|
+
if (jstext.replace(trimreg, trimspace).trim() === innerText.replace(trimreg, trimspace).trim()) return;
|
|
346
357
|
markAnchorOffset();
|
|
347
|
-
var innerText =
|
|
358
|
+
var innerText = coder.innerText;
|
|
348
359
|
var trimspace = (_, a) => a ? "" : " ";
|
|
349
|
-
var trimreg = /[\s\u00a0\u2002\u0080]+([\}\{\;\[\]\(\)\,\>\<\+\-\*\&\^\/%!~:?])*/g;
|
|
350
360
|
unmarkAnchorOffset();
|
|
351
|
-
if (scope.codetext.replace(trimreg, trimspace).trim() === innerText.replace(trimreg, trimspace).trim()) return;
|
|
352
361
|
initcode(innerText);
|
|
353
362
|
unmarkAnchorOffset();
|
|
354
|
-
|
|
363
|
+
jstext = coder.innerText;
|
|
364
|
+
jschanged = true;
|
|
355
365
|
});
|
|
366
|
+
var jschanged = false;
|
|
356
367
|
var execute = async function () {
|
|
357
368
|
try {
|
|
358
|
-
var live = /^([\s\S]+)\//.exec(
|
|
369
|
+
var live = /^([\s\S]+)\//.exec(name);
|
|
359
370
|
if (live) live = live[1];
|
|
360
371
|
var commap = initCommap(live);
|
|
361
|
-
remove(
|
|
362
|
-
|
|
363
|
-
data.patchInstance("docscode", { codetext:
|
|
364
|
-
var code = compile$scanner2(
|
|
372
|
+
remove(coderesult.childNodes);
|
|
373
|
+
jstext = jstext.replace(/[\u2002\u00a0]/g, ' ');
|
|
374
|
+
data.patchInstance("docscode", { codetext: jstext })
|
|
375
|
+
var code = compile$scanner2(jstext);
|
|
365
376
|
var envs = code.envs;
|
|
366
377
|
var argNames = Object.keys(envs);
|
|
367
378
|
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 })));
|
|
368
|
-
var func = createFunction("",
|
|
379
|
+
var func = createFunction("", jstext, argNames, code.async, code.yield);
|
|
369
380
|
var res = func.apply(window, args);
|
|
370
381
|
if (isFunction(res)) {
|
|
371
382
|
res = res.call(res);
|
|
372
383
|
}
|
|
373
384
|
if (isElement(res) || isArray(res)) {
|
|
374
|
-
appendChild(
|
|
385
|
+
appendChild(coderesult, res);
|
|
375
386
|
}
|
|
376
387
|
} catch (e) {
|
|
377
388
|
alert(String(e), 'error');
|
|
@@ -384,35 +395,22 @@
|
|
|
384
395
|
];
|
|
385
396
|
tags[data.getInstance("docscode").tagIndex | 0].actived = true;
|
|
386
397
|
var actived = tags.map(t => t.actived);
|
|
398
|
+
// page.innerHTML = template;
|
|
399
|
+
var btn = button;
|
|
400
|
+
var a = button;
|
|
401
|
+
var jstext = '';
|
|
387
402
|
var xmenu = menu;
|
|
388
|
-
var
|
|
389
|
-
|
|
390
|
-
page.innerHTML = template;
|
|
391
|
-
var scope = {
|
|
392
|
-
btn: button,
|
|
393
|
-
container,
|
|
394
|
-
view,
|
|
395
|
-
tags,
|
|
396
|
-
a: button,
|
|
397
|
-
codetext: "",
|
|
398
|
-
xmenu: menu,
|
|
399
|
-
loadcode,
|
|
400
|
-
clearpad() {
|
|
401
|
-
remove(this.coderesult.childNodes);
|
|
402
|
-
},
|
|
403
|
-
execute,
|
|
404
|
-
updatecode,
|
|
405
|
-
saveTagIndex(i) {
|
|
406
|
-
data.setInstance("docscode", { tagIndex: i });
|
|
407
|
-
if (i === 1 && !scope.codetext) requestAnimationFrame(loadcode);
|
|
408
|
-
},
|
|
409
|
-
keytab(event) {
|
|
410
|
-
event.preventDefault();
|
|
411
|
-
}
|
|
403
|
+
var clearpad = function () {
|
|
404
|
+
remove(this.coderesult.childNodes);
|
|
412
405
|
};
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
406
|
+
var keytab = function (event) {
|
|
407
|
+
event.preventDefault();
|
|
408
|
+
};
|
|
409
|
+
|
|
410
|
+
var saveTagIndex = function (i) {
|
|
411
|
+
data.setInstance("docscode", { tagIndex: i });
|
|
412
|
+
if (i === 1 && !jschanged) requestAnimationFrame(loadcode);
|
|
413
|
+
};
|
|
414
|
+
var [name] = arguments;
|
|
415
|
+
分析(name, state.data);
|
|
418
416
|
</script>
|