efront 3.36.1 → 3.36.3
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 +1 -0
- package/coms/basic/YAML.js +8 -2
- package/coms/basic/YAML_test.js +9 -0
- package/coms/compile/Javascript.js +1 -1
- package/coms/compile/common.js +2 -0
- package/coms/compile/richcss_test.js +7 -1
- package/coms/compile/scanner2_test.js +9 -1
- package/coms/docs/codetext.xht +223 -0
- package/coms/docs/markdown.js +3 -143
- package/coms/typescript-helpers/__asyncDelegator.js +12 -0
- package/coms/typescript-helpers/__asyncValues.js +14 -0
- package/coms/typescript-helpers/__esDecorate.js +34 -0
- package/coms/typescript-helpers/__propKey.js +10 -0
- package/coms/typescript-helpers/__runInitializers.js +14 -0
- package/coms/typescript-helpers/__setFunctionName.js +11 -0
- package/coms/zimoli/alert.js +8 -19
- package/coms/zimoli/alert.less +10 -0
- package/coms/zimoli/data_test.js +0 -3
- package/coms/zimoli/render.js +1 -1
- package/docs/components.jsp +1 -1
- package/docs/main.xht +8 -2
- package/docs/mark.xht +0 -80
- package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +8 -7
- package/docs//347/273/204/344/273/266.xht +247 -21
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/apps/sciters/main.js +0 -31
package/coms/basic/#loader.js
CHANGED
package/coms/basic/YAML.js
CHANGED
|
@@ -13,8 +13,14 @@ var stringify = function (data) {
|
|
|
13
13
|
var save = function (data) {
|
|
14
14
|
var v = String(data);
|
|
15
15
|
if (kesize.length) {
|
|
16
|
-
var
|
|
17
|
-
|
|
16
|
+
var isrow = /^\s*\-/.test(result[result.length - 2]);
|
|
17
|
+
if (isrow) {
|
|
18
|
+
var ksize = kesize[kesize.length - 1] - result[result.length - 1].length + 1;
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
var ksize = kesize[kesize.length - 1] - result[result.length - 1].length + (kesize.length << 1);
|
|
22
|
+
}
|
|
23
|
+
v = new Array(ksize + 3).join(" ") + v;
|
|
18
24
|
}
|
|
19
25
|
result.push(v);
|
|
20
26
|
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
var data = [
|
|
2
|
+
{ a: 1, b: 2 },
|
|
3
|
+
{ abcd: 2, c: 3 },
|
|
4
|
+
{ abcdefg: 3, d: 4 },
|
|
5
|
+
{ abcdefgh: 3, e: 5, g: { h: 1, k: 2 } },
|
|
6
|
+
{ abcdefgh: 3, e: 5, g: [{ a: 1, b: 2 }] },
|
|
7
|
+
{ abcdefgh: 3, e: 5, g: [{ a: 1, b: [{ c: 3, defg: 3 }] }] },
|
|
8
|
+
]
|
|
9
|
+
console.log(YAML.stringify(data));
|
|
@@ -183,7 +183,7 @@ var isShortMethodEnd = function (o) {
|
|
|
183
183
|
|
|
184
184
|
Javascript.prototype.setType = function (o) {
|
|
185
185
|
var last = o.prev;
|
|
186
|
-
if (o.type === EXPRESS && /^\.[^\.]/.test(o.text) && last.type === STAMP && last.text === "?") {
|
|
186
|
+
if (o.type === EXPRESS && /^\.[^\.]/.test(o.text) && last && last.type === STAMP && last.text === "?") {
|
|
187
187
|
last = o.prev = snapExpressHead(last.prev);
|
|
188
188
|
last.type = EXPRESS;
|
|
189
189
|
return false;
|
package/coms/compile/common.js
CHANGED
|
@@ -419,6 +419,7 @@ var createScoped = function (parsed, wash) {
|
|
|
419
419
|
if (o.next.type === STAMP) {
|
|
420
420
|
isAster = true;
|
|
421
421
|
o = o.next;
|
|
422
|
+
o.isExpress = o.prev.isExpress;
|
|
422
423
|
}
|
|
423
424
|
case "catch":
|
|
424
425
|
if (s === 'catch') isCatch = true;
|
|
@@ -560,6 +561,7 @@ var createScoped = function (parsed, wash) {
|
|
|
560
561
|
scoped.body = o;
|
|
561
562
|
o.isExpress = isExpress;
|
|
562
563
|
run(o.first);
|
|
564
|
+
if (isArrow && id >= 0 && o) o = o.next;
|
|
563
565
|
if (wash && isFunction) {
|
|
564
566
|
var e = o.next;
|
|
565
567
|
if (e && e.type === EXPRESS && /^[\.\[]/.test(e.text) || e && e.type === SCOPED && e.entry === "[") {
|
|
@@ -4,4 +4,10 @@ var test = function (data, expect) {
|
|
|
4
4
|
test(`:scope{--a:1}a{opacity:--a}`, `a{opacity:1;}`);
|
|
5
5
|
test(`:scope{--b:--a;--a:1;}a{opacity:--b}`, `a{opacity:1;}`);
|
|
6
6
|
test(`@a(@p,@b){@p{opacity:@b}}@a(a,1);`, `a{opacity:1;}`);
|
|
7
|
-
test(`@a(a,1);@a(@p,@b){@p{opacity:@b}}`, `a{opacity:1;}`);
|
|
7
|
+
test(`@a(a,1);@a(@p,@b){@p{opacity:@b}}`, `a{opacity:1;}`);
|
|
8
|
+
test(`a{ b{a:1}}`,`a b{a:1;}`);
|
|
9
|
+
test(`a{ >b{a:1}}`,`a>b{a:1;}`);
|
|
10
|
+
test(`a{ &>b{a:1}}`,`a>b{a:1;}`);
|
|
11
|
+
test(`a{ &b{a:1}}`,`ab{a:1;}`);
|
|
12
|
+
test(`a{ &.b{a:1}}`,`a.b{a:1;}`);
|
|
13
|
+
test(`a{ &[b]{a:1}}`,`a[b]{a:1;}`);
|
|
@@ -76,6 +76,13 @@ function testAssign() {
|
|
|
76
76
|
a()`);
|
|
77
77
|
console.log(m.press().toString());
|
|
78
78
|
}
|
|
79
|
+
function testArrow() {
|
|
80
|
+
var m = scanner(`(a)=>(b)=>{c,b};`);
|
|
81
|
+
console.log("1", m.envs);
|
|
82
|
+
var m = scanner(`(a,b)=>{c,b};`);
|
|
83
|
+
console.log("2", m.envs);
|
|
84
|
+
}
|
|
85
|
+
|
|
79
86
|
function testFormat() {
|
|
80
87
|
var t = fs.readFileSync(path.join(__dirname, "../efront/memery.js")).toString();
|
|
81
88
|
assert(scanner(t).toString(), t);
|
|
@@ -111,6 +118,7 @@ Program.debug = true;
|
|
|
111
118
|
// testJsx2();
|
|
112
119
|
// testJsx3();
|
|
113
120
|
// testJsxOnlyHtml();
|
|
114
|
-
testSpaceLess();
|
|
121
|
+
// testSpaceLess();
|
|
122
|
+
testArrow();
|
|
115
123
|
// var typescript = require("../typescript/index");
|
|
116
124
|
// typescript.transpile(data.toString(), { noEmitHelpers: true });
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
<style>
|
|
2
|
+
:scope {
|
|
3
|
+
padding: 10px 20px;
|
|
4
|
+
border-radius: 3px;
|
|
5
|
+
display: inline-block;
|
|
6
|
+
background: #333;
|
|
7
|
+
color: #d4d4d4;
|
|
8
|
+
vertical-align: top;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
strap,
|
|
12
|
+
value {
|
|
13
|
+
color: #569cd6;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
regexp {
|
|
17
|
+
color: #d16969;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
text {
|
|
21
|
+
color: #ce9178;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
flow {
|
|
25
|
+
color: #c586c0;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
digit {
|
|
29
|
+
color: #b5cea8;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
label {
|
|
33
|
+
color: #569cd6;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
@deep(@num, @color) {
|
|
37
|
+
deep@num {
|
|
38
|
+
color: @color;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
@deep(0, #ffd700);
|
|
43
|
+
@deep(1, #da70d6);
|
|
44
|
+
@deep(2, #179fff);
|
|
45
|
+
@deep(3, #ffd700);
|
|
46
|
+
@deep(4, #da70d6);
|
|
47
|
+
@deep(5, #179fff);
|
|
48
|
+
@deep(6, #ffd700);
|
|
49
|
+
@deep(7, #da70d6);
|
|
50
|
+
@deep(8, #179fff);
|
|
51
|
+
@deep(9, #ffd700);
|
|
52
|
+
@deep(10, #da70d6);
|
|
53
|
+
@deep(11, #179fff);
|
|
54
|
+
@deep(12, #ffd700);
|
|
55
|
+
@deep(13, #da70d6);
|
|
56
|
+
@deep(14, #179fff);
|
|
57
|
+
@deep(15, #ffd700);
|
|
58
|
+
@deep(16, #da70d6);
|
|
59
|
+
@deep(17, #179fff);
|
|
60
|
+
|
|
61
|
+
express,
|
|
62
|
+
property {
|
|
63
|
+
color: #9cdcfe;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
invoke,
|
|
67
|
+
method {
|
|
68
|
+
color: #dcdcaa;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
predef {
|
|
72
|
+
color: #4ec9b0;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
outside {
|
|
76
|
+
color: #4fc1ff;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
comment {
|
|
80
|
+
color: #6a9955;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
83
|
+
<script>
|
|
84
|
+
var encode = function (text) {
|
|
85
|
+
return text.replace(/[\<\>\|]/g, a => `&#${a.charCodeAt()};`)
|
|
86
|
+
};
|
|
87
|
+
var codecolor = function (c) {
|
|
88
|
+
var envs = c.envs;
|
|
89
|
+
var predefs = Object.create(null);
|
|
90
|
+
predefs.module = true;
|
|
91
|
+
predefs.exports = true;
|
|
92
|
+
predefs["module.exports"] = true;
|
|
93
|
+
predefs.Promise = true;
|
|
94
|
+
[Boolean, Number, String, Function, Object, Array, Date, RegExp, Error].forEach(p => predefs[p.name] = true);
|
|
95
|
+
var { STRAP, SCOPED, QUOTED, LABEL, COMMENT, STAMP, VALUE, EXPRESS, PROPERTY, PIECE } = c;
|
|
96
|
+
var deep = 0;
|
|
97
|
+
var setcolor = function (o) {
|
|
98
|
+
switch (o.type) {
|
|
99
|
+
case LABEL:
|
|
100
|
+
o.text = `<label>${o.text}</label>`;
|
|
101
|
+
break;
|
|
102
|
+
case QUOTED:
|
|
103
|
+
case PIECE:
|
|
104
|
+
if (!o.length) {
|
|
105
|
+
if (/^\//.test(o.text)) {
|
|
106
|
+
o.text = `<regexp>${encode(o.text)}</regexp>`;
|
|
107
|
+
}
|
|
108
|
+
else o.text = `<text>${encode(o.text)}</text>`;
|
|
109
|
+
break;
|
|
110
|
+
}
|
|
111
|
+
o.forEach(setcolor);
|
|
112
|
+
o.entry = "<text>" + o.entry;
|
|
113
|
+
o.leave = o.leave + "</text>";
|
|
114
|
+
break;
|
|
115
|
+
case SCOPED:
|
|
116
|
+
deep++;
|
|
117
|
+
o.forEach(setcolor);
|
|
118
|
+
deep--;
|
|
119
|
+
o.entry = `<deep${deep}>${o.entry}</deep${deep}>`;
|
|
120
|
+
o.leave = `<deep${deep}>${o.leave}</deep${deep}>`;
|
|
121
|
+
break;
|
|
122
|
+
case VALUE:
|
|
123
|
+
if (o.isdigit) o.text = `<digit>${o.text}</digit>`;
|
|
124
|
+
else o.text = `<value>${o.text}</value>`;
|
|
125
|
+
break;
|
|
126
|
+
case PROPERTY:
|
|
127
|
+
var next = o.next;
|
|
128
|
+
if (next && next.type === c.SCOPED && next.entry === '(') {
|
|
129
|
+
o.text = `<method>${o.text}</method>`;
|
|
130
|
+
}
|
|
131
|
+
else o.text = `<property>${o.text}</property>`;
|
|
132
|
+
|
|
133
|
+
break;
|
|
134
|
+
case EXPRESS:
|
|
135
|
+
var keys = o.text.split(".");
|
|
136
|
+
var next = o.next;
|
|
137
|
+
if (next && next.type === c.SCOPED && next.entry === '(') {
|
|
138
|
+
keys[keys.length - 1] = `<invoke>${keys[keys.length - 1]}</invoke>`;
|
|
139
|
+
}
|
|
140
|
+
var [name] = keys;
|
|
141
|
+
if (/^</.test(name));
|
|
142
|
+
else if (/^(arguments|this|super|Infinity|NaN)$/.test(name)) name = `<strap>${name}</strap>`;
|
|
143
|
+
else if (name in envs) name = name in predefs ? `<predef>${name}</predef>` : `<outside>${name}</outside>`;
|
|
144
|
+
|
|
145
|
+
keys[0] = name;
|
|
146
|
+
o.text = keys.map(k => /^\</.test(k) || !k ? k : `<express>${k}</express>`).join(".");
|
|
147
|
+
break;
|
|
148
|
+
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(o.text))
|
|
150
|
+
o.text = `<flow>${o.text}</flow>`;
|
|
151
|
+
else o.text = `<strap>${o.text}</strap>`;
|
|
152
|
+
break;
|
|
153
|
+
case STAMP:
|
|
154
|
+
if (/^(=>)$/.test(o.text) || o.text === "*" && o.prev && o.prev.type === c.STRAP) o.text = `<strap>${encode(o.text)}</strap>`;
|
|
155
|
+
else if (!/^[<\/>]+$/.test(o.text));
|
|
156
|
+
else o.text = `<stamp>${encode(o.text)}</stamp>`;
|
|
157
|
+
break;
|
|
158
|
+
case COMMENT:
|
|
159
|
+
o.text = `<comment>${encode(o.text)}</comment>`;
|
|
160
|
+
break;
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
c.forEach(setcolor);
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
var typescript = new compile$Javascript;
|
|
167
|
+
typescript.straps = typescript.straps.concat("interface", "implements", "declare", "module", "readonly", "enum");
|
|
168
|
+
var codesupports = {
|
|
169
|
+
javascript(a) {
|
|
170
|
+
var c = compile$scanner2(a);
|
|
171
|
+
codecolor(c);
|
|
172
|
+
return c.toString();
|
|
173
|
+
},
|
|
174
|
+
typescript(a) {
|
|
175
|
+
var c = compile$scanner2(a, typescript);
|
|
176
|
+
codecolor(c);
|
|
177
|
+
return c.toString();
|
|
178
|
+
},
|
|
179
|
+
html(a) {
|
|
180
|
+
var code = compile$scanner2(a, 'html');
|
|
181
|
+
var scoped = code.scoped;
|
|
182
|
+
codecolor(code);
|
|
183
|
+
backEach(scoped.richNodes, n => {
|
|
184
|
+
if (n.isScript) {
|
|
185
|
+
var js = compile$scanner2(n.innerText);
|
|
186
|
+
codecolor(js);
|
|
187
|
+
code.splice(n.innerStart, n.innerEnd - n.innerStart, { text: js.toString() });
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
return code.toString();
|
|
191
|
+
},
|
|
192
|
+
css(a) {
|
|
193
|
+
var c = compile$scanner2(a);
|
|
194
|
+
codecolor(c);
|
|
195
|
+
return c.toString();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
codesupports.cmd = codesupports.bat;
|
|
199
|
+
codesupports.jsx = codesupports.js = codesupports.javascript;
|
|
200
|
+
codesupports.tsx = codesupports.ts = codesupports.typescript;
|
|
201
|
+
codesupports.xml = codesupports.html;
|
|
202
|
+
function codetext(type, text) {
|
|
203
|
+
try {
|
|
204
|
+
type = type.toLowerCase();
|
|
205
|
+
if (type in codesupports) text = codesupports[type](text);
|
|
206
|
+
else text = encode(text);
|
|
207
|
+
|
|
208
|
+
} catch (e) {
|
|
209
|
+
console.error(e);
|
|
210
|
+
}
|
|
211
|
+
var codes = text.split(/\r\n|\r|\n/);
|
|
212
|
+
var minSpace = 0;
|
|
213
|
+
for (var c of codes) {
|
|
214
|
+
var m = /^\s*/.exec(c);
|
|
215
|
+
if (m && m[0].length < c.length) {
|
|
216
|
+
minSpace = m[0].length;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
if (minSpace > 0) codes = codes.map(c => /^\s+/.test(c) ? c.slice(minSpace) : c);
|
|
220
|
+
return `<code type=${type}>${codes.join("<br/>").replace(/\t/g, Array(5).join(' ')).replace(/\s/g, ' ')}</code> `;
|
|
221
|
+
}
|
|
222
|
+
codetext.encode = encode;
|
|
223
|
+
</script>
|
package/coms/docs/markdown.js
CHANGED
|
@@ -81,149 +81,10 @@ function richtext(line) {
|
|
|
81
81
|
else a = p(line);
|
|
82
82
|
if (a) content.push(a);
|
|
83
83
|
}
|
|
84
|
-
var codecolor = function (c) {
|
|
85
|
-
var envs = c.envs;
|
|
86
|
-
var predefs = Object.create(null);
|
|
87
|
-
predefs.module = true;
|
|
88
|
-
predefs.exports = true;
|
|
89
|
-
predefs["module.exports"] = true;
|
|
90
|
-
predefs.Promise = true;
|
|
91
|
-
[Boolean, Number, String, Function, Object, Array, Date, RegExp, Error].forEach(p => predefs[p.name] = true);
|
|
92
|
-
var { STRAP, SCOPED, QUOTED, LABEL, COMMENT, STAMP, VALUE, EXPRESS, PROPERTY, PIECE } = c;
|
|
93
|
-
var deep = 0;
|
|
94
|
-
var setcolor = function (o) {
|
|
95
|
-
switch (o.type) {
|
|
96
|
-
case LABEL:
|
|
97
|
-
o.text = `<label>${o.text}</label>`;
|
|
98
|
-
break;
|
|
99
|
-
case QUOTED:
|
|
100
|
-
case PIECE:
|
|
101
|
-
if (!o.length) {
|
|
102
|
-
if (/^\//.test(o.text)) {
|
|
103
|
-
o.text = `<regexp>${encode(o.text)}</regexp>`;
|
|
104
|
-
}
|
|
105
|
-
else o.text = `<text>${encode(o.text)}</text>`;
|
|
106
|
-
break;
|
|
107
|
-
}
|
|
108
|
-
o.forEach(setcolor);
|
|
109
|
-
o.entry = "<text>" + o.entry;
|
|
110
|
-
o.leave = o.leave + "</text>";
|
|
111
|
-
break;
|
|
112
|
-
case SCOPED:
|
|
113
|
-
deep++;
|
|
114
|
-
o.forEach(setcolor);
|
|
115
|
-
deep--;
|
|
116
|
-
o.entry = `<deep${deep}>${o.entry}</deep${deep}>`;
|
|
117
|
-
o.leave = `<deep${deep}>${o.leave}</deep${deep}>`;
|
|
118
|
-
break;
|
|
119
|
-
case VALUE:
|
|
120
|
-
if (o.isdigit) o.text = `<digit>${o.text}</digit>`;
|
|
121
|
-
else o.text = `<value>${o.text}</value>`;
|
|
122
|
-
break;
|
|
123
|
-
case PROPERTY:
|
|
124
|
-
var next = o.next;
|
|
125
|
-
if (next && next.type === c.SCOPED && next.entry === '(') {
|
|
126
|
-
o.text = `<method>${o.text}</method>`;
|
|
127
|
-
}
|
|
128
|
-
else o.text = `<property>${o.text}</property>`;
|
|
129
|
-
|
|
130
|
-
break;
|
|
131
|
-
case EXPRESS:
|
|
132
|
-
var keys = o.text.split(".");
|
|
133
|
-
var next = o.next;
|
|
134
|
-
if (next && next.type === c.SCOPED && next.entry === '(') {
|
|
135
|
-
keys[keys.length - 1] = `<invoke>${keys[keys.length - 1]}</invoke>`;
|
|
136
|
-
}
|
|
137
|
-
var [name] = keys;
|
|
138
|
-
if (/^</.test(name));
|
|
139
|
-
else if (/^(arguments|this|super|Infinity|NaN)$/.test(name)) name = `<strap>${name}</strap>`;
|
|
140
|
-
else if (name in envs) name = name in predefs ? `<predef>${name}</predef>` : `<outside>${name}</outside>`;
|
|
141
|
-
|
|
142
|
-
keys[0] = name;
|
|
143
|
-
o.text = keys.map(k => /^\</.test(k) || !k ? k : `<express>${k}</express>`).join(".");
|
|
144
|
-
break;
|
|
145
|
-
case STRAP:
|
|
146
|
-
if (/^(if|else|switch|case|do|while|for|break|continue|default|import|from|as|export|try|catch|finally|await|yield|return)/.test(o.text))
|
|
147
|
-
o.text = `<flow>${o.text}</flow>`;
|
|
148
|
-
else o.text = `<strap>${o.text}</strap>`;
|
|
149
|
-
break;
|
|
150
|
-
case STAMP:
|
|
151
|
-
if (/^(=>)$/.test(o.text) || o.text === "*" && o.prev && o.prev.type === c.STRAP) o.text = `<strap>${encode(o.text)}</strap>`;
|
|
152
|
-
else if (!/^[<\/>]+$/.test(o.text));
|
|
153
|
-
else o.text = `<stamp>${encode(o.text)}</stamp>`;
|
|
154
|
-
break;
|
|
155
|
-
case COMMENT:
|
|
156
|
-
o.text = `<comment>${encode(o.text)}</comment>`;
|
|
157
|
-
break;
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
c.forEach(setcolor);
|
|
161
|
-
|
|
162
|
-
}
|
|
163
|
-
var typescript = new compile$Javascript;
|
|
164
|
-
typescript.straps = typescript.straps.concat("interface", "implements", "declare", "module", "readonly", "enum");
|
|
165
|
-
var codesupports = {
|
|
166
|
-
javascript(a) {
|
|
167
|
-
var c = compile$scanner2(a);
|
|
168
|
-
codecolor(c);
|
|
169
|
-
return c.toString();
|
|
170
|
-
},
|
|
171
|
-
typescript(a) {
|
|
172
|
-
var c = compile$scanner2(a, typescript);
|
|
173
|
-
codecolor(c);
|
|
174
|
-
return c.toString();
|
|
175
|
-
},
|
|
176
|
-
html(a) {
|
|
177
|
-
var code = compile$scanner2(a, 'html');
|
|
178
|
-
var scoped = code.scoped;
|
|
179
|
-
codecolor(code);
|
|
180
|
-
backEach(scoped.richNodes, n => {
|
|
181
|
-
if (n.isScript) {
|
|
182
|
-
var js = compile$scanner2(n.innerText);
|
|
183
|
-
codecolor(js);
|
|
184
|
-
code.splice(n.innerStart, n.innerEnd - n.innerStart, { text: js.toString() });
|
|
185
|
-
}
|
|
186
|
-
})
|
|
187
|
-
return code.toString();
|
|
188
|
-
},
|
|
189
|
-
css(a) {
|
|
190
|
-
var c = compile$scanner2(a);
|
|
191
|
-
codecolor(c);
|
|
192
|
-
return c.toString();
|
|
193
|
-
}
|
|
194
|
-
};
|
|
195
|
-
codesupports.cmd = codesupports.bat;
|
|
196
|
-
codesupports.jsx = codesupports.js = codesupports.javascript;
|
|
197
|
-
codesupports.tsx = codesupports.ts = codesupports.typescript;
|
|
198
|
-
codesupports.xml = codesupports.html;
|
|
199
|
-
function codetext(type, text) {
|
|
200
|
-
try {
|
|
201
|
-
type = type.toLowerCase();
|
|
202
|
-
if (type in codesupports) text = codesupports[type](text);
|
|
203
|
-
else text = encode(text);
|
|
204
|
-
|
|
205
|
-
} catch (e) {
|
|
206
|
-
console.error(e);
|
|
207
|
-
}
|
|
208
|
-
text = text.replace(/^(\r\n|\r|\n)|\s+$/g, '');
|
|
209
|
-
var codes = text.split(/\r\n|\r|\n/);
|
|
210
|
-
var minSpace = 0;
|
|
211
|
-
for (var c of codes) {
|
|
212
|
-
var m = /^\s*/.exec(c);
|
|
213
|
-
if (m && m[0].length < c.length) {
|
|
214
|
-
minSpace = m[0].length;
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
if (minSpace > 0) codes = codes.map(c => c.slice(minSpace));
|
|
218
|
-
return `<code type=${type}>${codes.join("<br/>").replace(/\t/g, Array(5).join(' ')).replace(/\s/g, ' ')}</code> `;
|
|
219
|
-
}
|
|
220
84
|
/**
|
|
221
85
|
* @type {Element}
|
|
222
86
|
*/
|
|
223
87
|
var content;
|
|
224
|
-
var encode = function (text) {
|
|
225
|
-
return text.replace(/[\<\>\|]/g, a => `&#${a.charCodeAt()};`)
|
|
226
|
-
};
|
|
227
88
|
function markdown(text) {
|
|
228
89
|
var c = content = [];
|
|
229
90
|
text.replace(/ *(`+|\*+)(\S[\s\S]*?)\1 */g, function (_, q, c, i) {
|
|
@@ -233,16 +94,15 @@ function markdown(text) {
|
|
|
233
94
|
if (m & 2) c = `<b>${c}</b>`;
|
|
234
95
|
return c;
|
|
235
96
|
}
|
|
236
|
-
_ = encode(_.trim()).slice(1, -1);
|
|
97
|
+
_ = codetext.encode(_.trim()).slice(1, -1);
|
|
237
98
|
if (/[\*#\.]\s/.test(text.slice(i - 1, i + 1))) _ = " " + _;
|
|
238
99
|
if (q.length === 1) return `<m>${_}</m>`;
|
|
239
100
|
var t = /^\S+/.exec(c);
|
|
240
|
-
if (t) t = t[0]; c = c.slice(t.length);
|
|
101
|
+
if (t) t = t[0]; c = c.slice(t.length).replace(/^(\r\n|\r|\n)|\s+$/g, '');
|
|
241
102
|
return codetext(t, c);
|
|
242
103
|
}).replace(/\s*(( \s*)+)/g, "$1").split(/\r\n|\r|\n/).forEach(richtext);
|
|
243
104
|
list_elem = null;
|
|
244
105
|
list_tag = null;
|
|
245
106
|
content = null;
|
|
246
107
|
return c.join('');
|
|
247
|
-
}
|
|
248
|
-
markdown.javascript = codetext.bind(null, 'javascript');
|
|
108
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* typescript:asyncDelegator
|
|
3
|
+
* 这个文件由工具生成,请不要手动修改
|
|
4
|
+
*
|
|
5
|
+
* Efront Authors
|
|
6
|
+
* 2023-03-31T13:49:30.678Z
|
|
7
|
+
*/
|
|
8
|
+
var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
|
|
9
|
+
var i, p;
|
|
10
|
+
return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
|
|
11
|
+
function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* typescript:asyncValues
|
|
3
|
+
* 这个文件由工具生成,请不要手动修改
|
|
4
|
+
*
|
|
5
|
+
* Efront Authors
|
|
6
|
+
* 2023-03-31T13:49:30.678Z
|
|
7
|
+
*/
|
|
8
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
9
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
10
|
+
var m = o[Symbol.asyncIterator], i;
|
|
11
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
12
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
13
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
14
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* typescript:esDecorate
|
|
3
|
+
* 这个文件由工具生成,请不要手动修改
|
|
4
|
+
*
|
|
5
|
+
* Efront Authors
|
|
6
|
+
* 2023-03-31T13:49:30.678Z
|
|
7
|
+
*/
|
|
8
|
+
var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
9
|
+
function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; }
|
|
10
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
11
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
12
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
13
|
+
var _, done = false;
|
|
14
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
15
|
+
var context = {};
|
|
16
|
+
for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p];
|
|
17
|
+
for (var p in contextIn.access) context.access[p] = contextIn.access[p];
|
|
18
|
+
context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); };
|
|
19
|
+
var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
20
|
+
if (kind === "accessor") {
|
|
21
|
+
if (result === void 0) continue;
|
|
22
|
+
if (result === null || typeof result !== "object") throw new TypeError("Object expected");
|
|
23
|
+
if (_ = accept(result.get)) descriptor.get = _;
|
|
24
|
+
if (_ = accept(result.set)) descriptor.set = _;
|
|
25
|
+
if (_ = accept(result.init)) initializers.push(_);
|
|
26
|
+
}
|
|
27
|
+
else if (_ = accept(result)) {
|
|
28
|
+
if (kind === "field") initializers.push(_);
|
|
29
|
+
else descriptor[key] = _;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (target) Object.defineProperty(target, contextIn.name, descriptor);
|
|
33
|
+
done = true;
|
|
34
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* typescript:runInitializers
|
|
3
|
+
* 这个文件由工具生成,请不要手动修改
|
|
4
|
+
*
|
|
5
|
+
* Efront Authors
|
|
6
|
+
* 2023-03-31T13:49:30.678Z
|
|
7
|
+
*/
|
|
8
|
+
var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) {
|
|
9
|
+
var useValue = arguments.length > 2;
|
|
10
|
+
for (var i = 0; i < initializers.length; i++) {
|
|
11
|
+
value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
|
|
12
|
+
}
|
|
13
|
+
return useValue ? value : void 0;
|
|
14
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* typescript:setFunctionName
|
|
3
|
+
* 这个文件由工具生成,请不要手动修改
|
|
4
|
+
*
|
|
5
|
+
* Efront Authors
|
|
6
|
+
* 2023-03-31T13:49:30.678Z
|
|
7
|
+
*/
|
|
8
|
+
var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) {
|
|
9
|
+
if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : "";
|
|
10
|
+
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
11
|
+
};
|
package/coms/zimoli/alert.js
CHANGED
|
@@ -9,24 +9,14 @@ styles.info = styles.blue;
|
|
|
9
9
|
styles.error = styles.danger = styles.red;
|
|
10
10
|
styles.warn = styles.orange;
|
|
11
11
|
styles.default = '#000a';
|
|
12
|
-
var alerts = [];
|
|
13
|
-
var clean = Cleanup(alerts);
|
|
14
|
-
var build = function () {
|
|
15
|
-
var sum = 0;
|
|
16
|
-
alerts.forEach(function (elem) {
|
|
17
|
-
if (elem.offsetTop !== sum) {
|
|
18
|
-
elem.style.top = fromOffset(sum);
|
|
19
|
-
};
|
|
20
|
-
sum += elem.offsetHeight;
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
12
|
var fontSize = 16;
|
|
24
13
|
var singleHeight = fontSize * 3.125 | 0;
|
|
14
|
+
var container = document.createElement('alert-container');
|
|
15
|
+
css(container, 'height:0;left:0;right:0;transition:all 0.2s ease-out;position:absolute;')
|
|
25
16
|
var _text = function (bgcolor, parameters) {
|
|
26
|
-
var box = div
|
|
27
|
-
|
|
28
|
-
box.
|
|
29
|
-
box.initialStyle = `margin-top:-${fromPixel(singleHeight)};opacity:0;`;
|
|
17
|
+
var box = document.createElement('div');
|
|
18
|
+
box.innerHTML = `<div style='padding:${fromPixel(10)} ${fromPixel(20)};background-color:${bgcolor};color:${color.pair(bgcolor, 1)};'>${[].slice.call(parameters, 0).join(", ")}</div>`;
|
|
19
|
+
box.initialStyle = `margin-top:-${fromPixel(singleHeight)};`;
|
|
30
20
|
return box;
|
|
31
21
|
};
|
|
32
22
|
function alert() {
|
|
@@ -69,9 +59,8 @@ function alert() {
|
|
|
69
59
|
if (onclose) {
|
|
70
60
|
onclose.call(this, event);
|
|
71
61
|
}
|
|
72
|
-
clean(this);
|
|
73
|
-
build();
|
|
74
62
|
if (close_timer) clearTimeout(close_timer);
|
|
63
|
+
if (!container.children.length) remove(container);
|
|
75
64
|
}
|
|
76
65
|
onremove(elem, _onclose);
|
|
77
66
|
var close_timer;
|
|
@@ -97,8 +86,8 @@ function alert() {
|
|
|
97
86
|
waitclose(timeout, -100);
|
|
98
87
|
}
|
|
99
88
|
};
|
|
100
|
-
|
|
101
|
-
|
|
89
|
+
if (!container.parentNode) popup(container);
|
|
90
|
+
appendChild(container, elem);
|
|
102
91
|
return elem;
|
|
103
92
|
}
|
|
104
93
|
for (var k in styles) {
|