efront 4.0.54 → 4.0.55
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_/exec_.js +1 -1
- package/coms/compile/Program.js +8 -5
- package/coms/compile/richcss.js +89 -26
- package/coms/compile/richcss_test.js +13 -1
- package/coms/docs/codetext.xht +1 -1
- package/coms/docs/markdown.js +28 -15
- package/coms/zimoli/AudioContext_test.less +38 -5
- package/coms/zimoli/autodragchildren.js +13 -0
- package/coms/zimoli/cloneVisible.js +1 -1
- package/coms/zimoli/drag.js +1 -0
- package/coms/zimoli/maps_test.less +7 -2
- package/docs/main.xht +1 -1
- package/docs/mark.xht +45 -2
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/basic/#loader.js
CHANGED
package/coms/basic_/exec_.js
CHANGED
|
@@ -53,10 +53,10 @@ var exec_ = function (args, ok, oh, int) {
|
|
|
53
53
|
}
|
|
54
54
|
if (finished) return ok(r);
|
|
55
55
|
}
|
|
56
|
-
catch_ = null;
|
|
57
56
|
while (index < args_length) {
|
|
58
57
|
try {
|
|
59
58
|
var a = args[index].call(t, p) || [1, 0];
|
|
59
|
+
catch_ = null;
|
|
60
60
|
p = a[0];
|
|
61
61
|
i = a[1];
|
|
62
62
|
} catch (e) {
|
package/coms/compile/Program.js
CHANGED
|
@@ -657,10 +657,13 @@ class Program {
|
|
|
657
657
|
if (a instanceof Array) {
|
|
658
658
|
a.forEach(a => {
|
|
659
659
|
quote_map[a] = q;
|
|
660
|
-
tokens[a
|
|
660
|
+
if (a.length === 1) tokens[a] = true;
|
|
661
661
|
});
|
|
662
662
|
}
|
|
663
|
-
else
|
|
663
|
+
else {
|
|
664
|
+
quote_map[a] = q
|
|
665
|
+
if (a.length === 1) tokens[a] = true;
|
|
666
|
+
}
|
|
664
667
|
var r = q.slice(q[2] ? 2 : 3).concat(q[1]).map(q => {
|
|
665
668
|
if (q instanceof Array) {
|
|
666
669
|
q = q[q.length - 2];
|
|
@@ -688,11 +691,11 @@ class Program {
|
|
|
688
691
|
var [a, b] = s;
|
|
689
692
|
scope_entry[a] = b;
|
|
690
693
|
scope_leave[b] = a;
|
|
691
|
-
tokens[a] = true;
|
|
692
|
-
tokens[b] = true;
|
|
694
|
+
if (a.length === 1) tokens[a] = true;
|
|
695
|
+
if (b.length === 1) tokens[b] = true;
|
|
693
696
|
});
|
|
694
697
|
this.stamps.forEach(s => {
|
|
695
|
-
tokens[s] = true;
|
|
698
|
+
if (s.length === 1) tokens[s] = true;
|
|
696
699
|
});
|
|
697
700
|
var scopes = this.scopes.map(a => a.join("")).join("");
|
|
698
701
|
scopes = this.compile(scopes);
|
package/coms/compile/richcss.js
CHANGED
|
@@ -5,6 +5,8 @@ class Richcss extends Program {
|
|
|
5
5
|
quotes = this.quotes.slice(0, 2);
|
|
6
6
|
scopes = [["{", "}"]]
|
|
7
7
|
}
|
|
8
|
+
var presets = /^@(media|keyframes|layer|import|namespace|page|property|suppports|font-face|document|counter-style|charset|color-profile|container|font-feature-values|font-palette-values)(\s|\(|$)/i;
|
|
9
|
+
|
|
8
10
|
Richcss.prototype.setType = function (o) {
|
|
9
11
|
var p = o.prev;
|
|
10
12
|
if (o.type !== SCOPED) {
|
|
@@ -34,10 +36,39 @@ Richcss.prototype.setType = function (o) {
|
|
|
34
36
|
}
|
|
35
37
|
}
|
|
36
38
|
if (!q.entry && o.type !== SCOPED) {
|
|
39
|
+
var p = q.last;
|
|
40
|
+
if (p && p.type === STAMP && p.text === ':') {
|
|
41
|
+
if (p.keep) return;
|
|
42
|
+
}
|
|
43
|
+
else if (o.type === STAMP && o.text === ':') {
|
|
44
|
+
if (p.type & (EXPRESS | PROPERTY)) {
|
|
45
|
+
o.keep = true;
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
37
49
|
if (o.type !== STAMP || o.text !== ";") return false;
|
|
38
50
|
}
|
|
39
51
|
};
|
|
52
|
+
|
|
40
53
|
Richcss.prototype.createScoped = function (code) {
|
|
54
|
+
var setVarsUsed = function (s) {
|
|
55
|
+
var vars = null, used = null;
|
|
56
|
+
for (var cx = s.length - 1; cx >= 0; cx--) {
|
|
57
|
+
var { p: k, v } = s[cx];
|
|
58
|
+
if (/^\-\-|^@[^\{]/.test(k) && !("used" in v) && v.length) {
|
|
59
|
+
if (!vars) vars = {};
|
|
60
|
+
vars[k] = v.join(" ");
|
|
61
|
+
s.splice(cx, 1);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
if (!used) used = [];
|
|
65
|
+
used.push({ p: k, v });
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (used) used.reverse();
|
|
69
|
+
s.used = used;
|
|
70
|
+
s.vars = vars;
|
|
71
|
+
};
|
|
41
72
|
var run = function (o) {
|
|
42
73
|
var props = [];
|
|
43
74
|
var values = null;
|
|
@@ -65,29 +96,20 @@ Richcss.prototype.createScoped = function (code) {
|
|
|
65
96
|
break;
|
|
66
97
|
case SCOPED:
|
|
67
98
|
var s = run(o.first);
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
if (/^\-\-/.test(k)) {
|
|
71
|
-
if (!vars) vars = {};
|
|
72
|
-
vars[k] = v.join(" ");
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
if (!used) used = [];
|
|
76
|
-
used.push({ p: k, v });
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
values.used = used;
|
|
80
|
-
values.vars = vars;
|
|
99
|
+
values.used = s.used;
|
|
100
|
+
values.vars = s.vars;
|
|
81
101
|
|
|
82
102
|
}
|
|
83
103
|
o = o.next;
|
|
84
104
|
}
|
|
105
|
+
setVarsUsed(props);
|
|
85
106
|
return props;
|
|
86
107
|
};
|
|
87
108
|
return run(code.first);
|
|
88
109
|
};
|
|
89
110
|
Richcss.prototype.createString = createString;
|
|
90
111
|
var getFromScopeList = function (name, varsList, value) {
|
|
112
|
+
name = name.replace(/^@\{\s*(\S*)\s*\}$/g, '@$1');
|
|
91
113
|
for (var cx = varsList.length - 1; cx >= 0; cx--) {
|
|
92
114
|
var o = varsList[cx];
|
|
93
115
|
if (name in o) return o[name];
|
|
@@ -96,6 +118,7 @@ var getFromScopeList = function (name, varsList, value) {
|
|
|
96
118
|
}
|
|
97
119
|
var fixBase = function (b, a) {
|
|
98
120
|
return a.split(/,\s*/).map(a => {
|
|
121
|
+
if (presets.test(a)) a = `@{${a}}`;
|
|
99
122
|
var replaced = false;
|
|
100
123
|
return b.split(/\s*,\s*/).map(b => {
|
|
101
124
|
var a1 = a.replace(/(:scope|&)/g, function (match) {
|
|
@@ -113,10 +136,11 @@ var fixBase = function (b, a) {
|
|
|
113
136
|
}).join(",");
|
|
114
137
|
}
|
|
115
138
|
function evalscoped(scoped, scopeNames, base = '') {
|
|
116
|
-
var root = scoped[":root"], scope = scoped[":scope"];
|
|
117
|
-
var vars = Object.create(null);
|
|
139
|
+
var root = scoped[":root"], scope = scoped[":scope"], and = scoped["&"];
|
|
140
|
+
var vars = extend(Object.create(null), scoped.vars);
|
|
118
141
|
if (root) root.forEach(r => extend(vars, r.vars));
|
|
119
142
|
if (scope) scope.forEach(s => extend(vars, s.vars));
|
|
143
|
+
if (and) and.forEach(s => extend(vars, s.vars));
|
|
120
144
|
scopeNames.forEach(s => {
|
|
121
145
|
var ss = scoped[s];
|
|
122
146
|
if (ss) ss.forEach(s => {
|
|
@@ -129,7 +153,7 @@ function evalscoped(scoped, scopeNames, base = '') {
|
|
|
129
153
|
var queue = [];
|
|
130
154
|
for (var k in vars) {
|
|
131
155
|
var v = vars[k];
|
|
132
|
-
while (
|
|
156
|
+
while (/^\-\-|^@[^\{]/.test(v)) {
|
|
133
157
|
if (queue.indexOf(v) >= 0) throw `变量环形引用,无法初始化:${queue}`;
|
|
134
158
|
queue.push(v);
|
|
135
159
|
v = getFromScopeList(v, vlist);
|
|
@@ -138,6 +162,7 @@ function evalscoped(scoped, scopeNames, base = '') {
|
|
|
138
162
|
}
|
|
139
163
|
};
|
|
140
164
|
initvars(vars);
|
|
165
|
+
|
|
141
166
|
var eval2 = function (props) {
|
|
142
167
|
var rest = [];
|
|
143
168
|
var result = [];
|
|
@@ -154,7 +179,7 @@ function evalscoped(scoped, scopeNames, base = '') {
|
|
|
154
179
|
return res;
|
|
155
180
|
};
|
|
156
181
|
var calcvars = function (v) {
|
|
157
|
-
return v.replace(/(^|\s|[\]\)\(\[\-\+\*\/])(?:var\s*\(([\s\S]*?)\)|(
|
|
182
|
+
return v.replace(/(^|\s|[\]\)\(\[\-\+\*\/])(?:var\s*\(([\s\S]*?)\)|(--\S+|@[^\s\{\(\:\+\*\/]+|@\{[^\}@]*\}))/g, function (m, q, a, b) {
|
|
158
183
|
return q + getFromScopeList(b || a.trim(), vlist, m.slice(q.length));
|
|
159
184
|
});
|
|
160
185
|
};
|
|
@@ -162,18 +187,23 @@ function evalscoped(scoped, scopeNames, base = '') {
|
|
|
162
187
|
if (p.used) {
|
|
163
188
|
var match = /^(@[^\s,]+)\s*\(\s*(@[^\s,]+\s*(?:,\s*@[^\s,]+\s*)*)?\)/.exec(k);
|
|
164
189
|
if (!match) continue;
|
|
190
|
+
if (presets.test(match[1])) continue;
|
|
165
191
|
p.base = base;
|
|
166
192
|
var [, name, args] = match;
|
|
167
|
-
args = args.split(",").map(a => a.trim());
|
|
168
|
-
p.
|
|
193
|
+
args = args.split(",").map(a => a.trim().split(':'));
|
|
194
|
+
p.argDefaults = args.map(a => a[1]);
|
|
195
|
+
args = p.args = args.map(a => a[0]);
|
|
169
196
|
p.reg = new RegExp(args.join("|"), 'g');
|
|
170
197
|
if (!methods[name]) methods[name] = [];
|
|
171
198
|
methods[name].push(function () {
|
|
172
199
|
var body = evalthis(this);
|
|
173
200
|
var valueMap = {};
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
201
|
+
var argDefaults = p.argDefaults;
|
|
202
|
+
this.args.forEach((k, i) => {
|
|
203
|
+
var a = arguments[i];
|
|
204
|
+
if (a === undefined || a === null) a = argDefaults[i];
|
|
205
|
+
valueMap[k] = a;
|
|
206
|
+
});
|
|
177
207
|
var replace = text => text.replace(this.reg, function (name) {
|
|
178
208
|
if (name in valueMap) return valueMap[name];
|
|
179
209
|
return name;
|
|
@@ -188,9 +218,10 @@ function evalscoped(scoped, scopeNames, base = '') {
|
|
|
188
218
|
}
|
|
189
219
|
for (var { p: k, v: p } of props) {
|
|
190
220
|
if (p.isMethod) continue;
|
|
221
|
+
k = calcvars(k);
|
|
191
222
|
if (p.used) {
|
|
192
223
|
if (base && !p.rooted) p.base = fixBase(base, k);
|
|
193
|
-
else p.base = k;
|
|
224
|
+
else p.base = presets.test(k) ? `@{${k}}` : k;
|
|
194
225
|
var value = evalthis(p);
|
|
195
226
|
if (value.rest.length) rest = rest.concat(value.rest);
|
|
196
227
|
if (value.length) rest.push([p.base, '{', value.join(""), "}"]);
|
|
@@ -199,9 +230,9 @@ function evalscoped(scoped, scopeNames, base = '') {
|
|
|
199
230
|
result.push(k, ":", calcvars(p.join(" ")), ';');
|
|
200
231
|
}
|
|
201
232
|
else {
|
|
202
|
-
k = calcvars(k);
|
|
203
233
|
var match = /^(@\S+)\s*\(([\s\S]*)\)$/.exec(k);
|
|
204
234
|
if (!match) continue;
|
|
235
|
+
if (presets.test(match[1])) continue;
|
|
205
236
|
var [, name, params] = match;
|
|
206
237
|
params = params.split(",").map(a => a.trim());
|
|
207
238
|
var method = getFromScopeList(name, mlist);
|
|
@@ -223,12 +254,13 @@ function evalscoped(scoped, scopeNames, base = '') {
|
|
|
223
254
|
var rcss = null;
|
|
224
255
|
function richcss(text, scopeName, compress) {
|
|
225
256
|
if (!rcss) rcss = new Richcss;
|
|
257
|
+
rcss.debug = true;
|
|
226
258
|
var code = scanner2(text, rcss);
|
|
227
259
|
var scopeNames = [];
|
|
228
260
|
if (scopeName) code.forEach(c => {
|
|
229
261
|
if (c.type === PROPERTY) {
|
|
230
262
|
var replaced = false;
|
|
231
|
-
c.text = c.text.replace(/\:(scope|root)
|
|
263
|
+
c.text = c.text.replace(/\:(scope|root)|&/g, function () {
|
|
232
264
|
replaced = true;
|
|
233
265
|
return scopeName;
|
|
234
266
|
});
|
|
@@ -239,5 +271,36 @@ function richcss(text, scopeName, compress) {
|
|
|
239
271
|
})
|
|
240
272
|
var { scoped } = code;
|
|
241
273
|
var result = evalscoped(scoped, scopeNames, scopeName);
|
|
242
|
-
return result.rest.map(a => a.join("")).concat(result).
|
|
274
|
+
return result.rest.map(a => a.join("")).concat(result).map(a => {
|
|
275
|
+
var ats = [];
|
|
276
|
+
a = a.replace(/@\{(@[^\}]*)\}\s*/g, function (_, q) {
|
|
277
|
+
ats.push(q);
|
|
278
|
+
return ''
|
|
279
|
+
})
|
|
280
|
+
.replace(/((?:[\+\-]+\s*)?(?:\d+(?:\.\d*)?|\.\d+))\s*(px|%|pt|cm|mm|r?em)?\s*([\/\*\+\-])\s*((?:[\+\-]+\s*)?(?:\d+(?:\.\d*)?|\.\d+))(px|%|pt|cm|mm|r?em)?/ig, function (_, d1, p1 = '', c, d2, p2 = '') {
|
|
281
|
+
d1 = eval(d1);
|
|
282
|
+
d2 = eval(d2);
|
|
283
|
+
if (!p2) {
|
|
284
|
+
if (c === '*') {
|
|
285
|
+
return d1 * d2 + p1;
|
|
286
|
+
}
|
|
287
|
+
if (c === '/') {
|
|
288
|
+
return d1 / d2 + p1;
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
else if (p1 === p2) {
|
|
292
|
+
if (c === "+") {
|
|
293
|
+
return (+d1 + +d2) + p1;
|
|
294
|
+
}
|
|
295
|
+
if (c === '-') {
|
|
296
|
+
return (d1 - d2) + p1;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return _;
|
|
300
|
+
})
|
|
301
|
+
while (ats.length) {
|
|
302
|
+
a = ats.pop() + `{${a}}`;
|
|
303
|
+
}
|
|
304
|
+
return a;
|
|
305
|
+
}).join(compress ? "" : "\r\n");
|
|
243
306
|
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
var test = function (data, expect) {
|
|
2
2
|
assert(richcss(data), expect);
|
|
3
3
|
};
|
|
4
|
+
test(`&{--a:1}a{opacity:--a}`, `a{opacity:1;}`);
|
|
5
|
+
test(`:root{--a:1}a{opacity:--a}`, `a{opacity:1;}`);
|
|
4
6
|
test(`:scope{--a:1}a{opacity:--a}`, `a{opacity:1;}`);
|
|
5
7
|
test(`:scope{--b:--a;--a:1;}a{opacity:--b}`, `a{opacity:1;}`);
|
|
6
8
|
test(`@a(@p,@b){@p{opacity:@b}}@a(a,1);`, `a{opacity:1;}`);
|
|
@@ -12,4 +14,14 @@ test(`a{ &b{a:1}}`,`ab{a:1;}`);
|
|
|
12
14
|
test(`a{ &.b{a:1}}`,`a.b{a:1;}`);
|
|
13
15
|
test(`a{ &[b]{a:1}}`,`a[b]{a:1;}`);
|
|
14
16
|
test(`a{ &[b]:nth-child(1){a:1}}`,`a[b]:nth-child(1){a:1;}`);
|
|
15
|
-
test(`a,b{c{a:1}}`,`a c,b c{a:1;}`);
|
|
17
|
+
test(`a,b{c{a:1}}`,`a c,b c{a:1;}`);
|
|
18
|
+
test(`@media(){div{a:1}}`,`@media(){div{a:1;}}`);
|
|
19
|
+
test(`@keyframes a{%1{a:1}}`,`@keyframes a{%1{a:1;}}`);
|
|
20
|
+
test(`@media screen and (max-width:200px){@keyframes a{%1{a:1}}}`,`@media screen and (max-width:200px){@keyframes a{%1{a:1;}}}`);
|
|
21
|
+
test(`@a:1`, ``);
|
|
22
|
+
test(`@a:1;a{a:@a}`, `a{a:1;}`);
|
|
23
|
+
test(`@a:1;a{@{a}:@a}`, `a{1:1;}`);
|
|
24
|
+
test(`@a:1;a{@a:2;@{a}:@a}`, `a{2:2;}`);
|
|
25
|
+
test(`@a:1;@a{@a:2;@{a}:@a}`, `1{2:2;}`);
|
|
26
|
+
test(`@b(@a:1){@a{a:b}}@b(2)`, `2{a:b;}`);
|
|
27
|
+
test(`@a:1; a{a:@a/2}`, `a{a:0.5;}`);
|
package/coms/docs/codetext.xht
CHANGED
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
o.text = keys.map(k => /^\</.test(k) || !k ? k : `<express>${k}</express>`).join(".");
|
|
149
149
|
break;
|
|
150
150
|
case STRAP:
|
|
151
|
-
if (/^(if|else|switch|case|do|while|for|break|continue|default|import|from|as|export|try|catch|finally|await|yield|return)$/.test(text))
|
|
151
|
+
if (/^(if|else|switch|case|do|while|for|break|continue|default|import|from|as|export|try|catch|finally|throw|await|yield|return)$/.test(text))
|
|
152
152
|
o.text = `<flow>${o.text}</flow>`;
|
|
153
153
|
else o.text = `<strap>${o.text}</strap>`;
|
|
154
154
|
break;
|
package/coms/docs/markdown.js
CHANGED
|
@@ -20,24 +20,28 @@ var h = function (text) {
|
|
|
20
20
|
var p = function (text) {
|
|
21
21
|
if (text.length) return new Element("p", text);
|
|
22
22
|
};
|
|
23
|
+
var p2 = function (text) {
|
|
24
|
+
if (text.length) return new Element('div', text);
|
|
25
|
+
}
|
|
23
26
|
var li = function (c) {
|
|
24
27
|
var li = new Element(li, c.replace(/^\*\s+|^[\d]+\.\s+/, ''));
|
|
25
28
|
return li;
|
|
26
29
|
}
|
|
27
30
|
var list_elem = null, list_tag;
|
|
28
|
-
var list = function (tag, text, li = 'li') {
|
|
31
|
+
var list = function (tag, text, indent, li = 'li') {
|
|
29
32
|
if (!list_elem || list_tag !== tag || list_elem !== content[content.length - 1]) {
|
|
30
33
|
list_elem = new Element(tag);
|
|
34
|
+
list_elem.indent = indent;
|
|
31
35
|
list_tag = tag;
|
|
32
36
|
content.push(list_elem);
|
|
33
37
|
}
|
|
34
38
|
list_elem.appendChild(new Element(li, text.replace(/^\*\s+|^\d+\.\s+/, '')));
|
|
35
39
|
};
|
|
36
|
-
var ul = function (content) {
|
|
37
|
-
return list('ul', content);
|
|
40
|
+
var ul = function (content, indent) {
|
|
41
|
+
return list('ul', content, indent);
|
|
38
42
|
};
|
|
39
|
-
var ol = function (content) {
|
|
40
|
-
return list('ol', content);
|
|
43
|
+
var ol = function (content, indent) {
|
|
44
|
+
return list('ol', content, indent);
|
|
41
45
|
};
|
|
42
46
|
var tr = function (line) {
|
|
43
47
|
if (/^[\|\-\s]+$/.test(line)) {
|
|
@@ -64,22 +68,31 @@ var tr = function (line) {
|
|
|
64
68
|
return;
|
|
65
69
|
}
|
|
66
70
|
line = line.replace(/^\||\|$/g, '').split("|").map(t => `<td>${t}</td>`).join('');
|
|
67
|
-
return list('table', line, 'tr');
|
|
71
|
+
return list('table', line, NaN, 'tr');
|
|
68
72
|
}
|
|
69
73
|
function richtext(line) {
|
|
70
|
-
|
|
74
|
+
var tagIndent = /^\s+/.exec(line);
|
|
75
|
+
if (!tagIndent) tagIndent = 0;
|
|
76
|
+
else tagIndent = tagIndent[0].length;
|
|
77
|
+
line = line.slice(tagIndent);
|
|
71
78
|
line = line.replace(/\[([\s\S]*?)\](?:\(([\s\S]*?)\))?|<(\w+)>[\s\S]*?<\/\3>/g, function (_, content, href) {
|
|
72
79
|
if (/^\</.test(_)) return _;
|
|
73
80
|
if (href) var href1 = ` href=${strings.recode(href)}`;
|
|
74
81
|
return `<a${href1}>${content || href}</a>`;
|
|
75
82
|
});
|
|
76
83
|
var a;
|
|
77
|
-
if (/^#/.test(line))
|
|
78
|
-
else if (/^\*\s+/.test(line)) ul(line);
|
|
79
|
-
else if (/^\d+\.\s+/.test(line)) ol(line);
|
|
84
|
+
if (/^#/.test(line)) content.push(h(line));
|
|
85
|
+
else if (/^\*\s+/.test(line)) ul(line, tagIndent);
|
|
86
|
+
else if (/^\d+\.\s+/.test(line)) ol(line, tagIndent);
|
|
80
87
|
else if (/^\|/.test(line)) tr(line);
|
|
81
|
-
else
|
|
82
|
-
|
|
88
|
+
else {
|
|
89
|
+
if (list_elem && list_elem === content[content.length - 1] && list_elem.indent <= tagIndent) {
|
|
90
|
+
list_elem.appendChild(p(line));
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
content.push(p2(line));
|
|
94
|
+
}
|
|
95
|
+
}
|
|
83
96
|
}
|
|
84
97
|
/**
|
|
85
98
|
* @type {Element}
|
|
@@ -87,7 +100,7 @@ function richtext(line) {
|
|
|
87
100
|
var content;
|
|
88
101
|
function markdown(text) {
|
|
89
102
|
var c = content = [];
|
|
90
|
-
text.replace(/ *(`+|\*+)(\S[\s\S]*?)\
|
|
103
|
+
text.replace(/([ \t\v]*)(`+|\*+)(\S[\s\S]*?)\2([ \t\v]*)/g, function (_, s1, q, c, s2, i) {
|
|
91
104
|
if (/^\*/.test(q)) {
|
|
92
105
|
var m = q.length;
|
|
93
106
|
if (m & 1) c = `<i>${c}</i>`;
|
|
@@ -96,11 +109,11 @@ function markdown(text) {
|
|
|
96
109
|
}
|
|
97
110
|
_ = codetext.encode(_.trim()).slice(1, -1);
|
|
98
111
|
if (/[\*#\.]\s/.test(text.slice(i - 1, i + 1))) _ = " " + _;
|
|
99
|
-
if (q.length === 1) return
|
|
112
|
+
if (q.length === 1) return `${s1}<m>${_}</m>${s2}`;
|
|
100
113
|
var t = /^\S+/.exec(c);
|
|
101
114
|
if (t) t = t[0]; c = c.slice(t.length).replace(/^(\r\n|\r|\n)|\s+$/g, '');
|
|
102
115
|
try {
|
|
103
|
-
return codetext(t, c);
|
|
116
|
+
return s1 + codetext(t, c) + s2;
|
|
104
117
|
} catch (e) {
|
|
105
118
|
console.error(e);
|
|
106
119
|
return c;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
& {
|
|
2
2
|
white-space: nowrap;
|
|
3
3
|
overflow: auto;
|
|
4
|
+
background: #421;
|
|
5
|
+
border-top: 10px solid #000;
|
|
6
|
+
padding: 20px 40px 60px 40px;
|
|
7
|
+
// perspective: 3000px; 多嵌套一层,不起作用
|
|
4
8
|
}
|
|
5
9
|
|
|
6
10
|
&>div {
|
|
@@ -11,7 +15,11 @@
|
|
|
11
15
|
z-index: 2;
|
|
12
16
|
width: 60px;
|
|
13
17
|
text-align: center;
|
|
14
|
-
|
|
18
|
+
text-transform: uppercase;
|
|
19
|
+
font-family: 'Times New Roman', Times, serif;
|
|
20
|
+
font-style: italic;
|
|
21
|
+
font-weight: 900;
|
|
22
|
+
color: #999;
|
|
15
23
|
|
|
16
24
|
&:before {
|
|
17
25
|
content: "c";
|
|
@@ -26,6 +34,32 @@
|
|
|
26
34
|
|
|
27
35
|
button {
|
|
28
36
|
pointer-events: all;
|
|
37
|
+
transform-style: preserve-3d;
|
|
38
|
+
|
|
39
|
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
|
40
|
+
position: relative;
|
|
41
|
+
|
|
42
|
+
&.hover {
|
|
43
|
+
>.track {
|
|
44
|
+
box-shadow: none;
|
|
45
|
+
background: #fff1;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
box-shadow: 0 0 12px -4px #0003;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.active {
|
|
52
|
+
z-index: 0;
|
|
53
|
+
|
|
54
|
+
>.track {
|
|
55
|
+
background: #0003;
|
|
56
|
+
background: linear-gradient(0deg, #0003, #0000);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
transform-origin: 30px -270px -10px;
|
|
60
|
+
transform:rotateX(-7deg);
|
|
61
|
+
}
|
|
62
|
+
|
|
29
63
|
}
|
|
30
64
|
|
|
31
65
|
&.odd {
|
|
@@ -34,10 +68,9 @@
|
|
|
34
68
|
margin: 0 2px;
|
|
35
69
|
width: 56px;
|
|
36
70
|
background: #fff;
|
|
37
|
-
color: #
|
|
71
|
+
color: #aaa;
|
|
38
72
|
height: 280px;
|
|
39
73
|
padding: 80px 0 0 0;
|
|
40
|
-
|
|
41
74
|
box-shadow: 0 0 20px -6px rgba(0, 0, 0, .3);
|
|
42
75
|
|
|
43
76
|
span {
|
|
@@ -52,7 +85,7 @@
|
|
|
52
85
|
|
|
53
86
|
button {
|
|
54
87
|
width: 40px;
|
|
55
|
-
margin:
|
|
88
|
+
margin: 10px 10px;
|
|
56
89
|
box-shadow: 0 0 20px -6px rgba(0, 0, 0, .3);
|
|
57
90
|
|
|
58
91
|
&:nth-child(1) {
|
|
@@ -68,7 +101,7 @@
|
|
|
68
101
|
color: #fff;
|
|
69
102
|
height: 120px;
|
|
70
103
|
|
|
71
|
-
&:nth-child(
|
|
104
|
+
&:nth-child(2) {
|
|
72
105
|
margin-right: 70px;
|
|
73
106
|
}
|
|
74
107
|
}
|
|
@@ -340,6 +340,17 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
340
340
|
offdragend();
|
|
341
341
|
};
|
|
342
342
|
var offdragstart = on('dragstart')(targetChild, function () {
|
|
343
|
+
var c = drag.shadow;
|
|
344
|
+
var zIndex = c.style.zIndex - 1;
|
|
345
|
+
var copyZIndex = function (e) {
|
|
346
|
+
e.style.zIndex = zIndex;
|
|
347
|
+
var z = zIndex - 1;
|
|
348
|
+
if (e.with) for (var w of e.with) w.style.zIndex = z;
|
|
349
|
+
};
|
|
350
|
+
if (zIndex > 2) {
|
|
351
|
+
previousElements.forEach(copyZIndex);
|
|
352
|
+
followedElements.forEach(copyZIndex);
|
|
353
|
+
}
|
|
343
354
|
setOpacity(targetBox, draggingSourceOpacity);
|
|
344
355
|
});
|
|
345
356
|
var offdragend = on("dragend")(targetChild, function () {
|
|
@@ -350,6 +361,8 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
350
361
|
remove(followedElements);
|
|
351
362
|
previousElements.map(recover);
|
|
352
363
|
followedElements.map(recover);
|
|
364
|
+
previousElements.splice(0, previousElements.length);
|
|
365
|
+
followedElements.splice(0, followedElements.length);
|
|
353
366
|
});
|
|
354
367
|
var offdragmove = on("dragmove")(targetChild, dragmove);
|
|
355
368
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var cloneProperties = "fontWeight,fontSize,fontFamily,color,textShadow,opacity,writingMode,blockSize,wordSpacing,letterSpacing,whiteSpace
|
|
1
|
+
var cloneProperties = "fontWeight,fontSize,fontFamily,color,textShadow,opacity,writingMode,blockSize,wordSpacing,letterSpacing,whiteSpace".split(",");// text-node
|
|
2
2
|
var cloneProperties2 = "position,backdropFilter,filter,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,textOverflow,wordBreak,webkitLineClamp,webkitBoxOrient,writingMode,blockSize,wordSpacing,letterSpacing,textIndent,lineHeight,display,appearance,webkitAppearance,MozAppearance".split(",");// element
|
|
3
3
|
var pushProperty = function (key, props) {
|
|
4
4
|
props.split(",").forEach(k => {
|
package/coms/zimoli/drag.js
CHANGED
|
@@ -76,6 +76,7 @@ function drag(target, initialEvent, preventOverflow, isMovingSource) {
|
|
|
76
76
|
extraTargets = [];
|
|
77
77
|
if (target.style) css(target, { zIndex: z });
|
|
78
78
|
}
|
|
79
|
+
drag.shadow = clone;
|
|
79
80
|
var [clone_left, clone_top] = getOffset(clone);
|
|
80
81
|
extraClones = extraTargets.map(toCloneTarget);
|
|
81
82
|
extraClones.forEach(addZIndex);
|
|
@@ -7,9 +7,14 @@
|
|
|
7
7
|
background-position: 0 0, @background-size/2 @background-size/2;
|
|
8
8
|
height: 200px;
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
menu{
|
|
11
|
+
left: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
appearance: none;
|
|
14
|
+
display: block;
|
|
15
|
+
}
|
|
11
16
|
canvas {
|
|
12
17
|
width: 100%;
|
|
13
|
-
height:
|
|
18
|
+
height: 300px;
|
|
14
19
|
background-color: #035;
|
|
15
20
|
}
|
package/docs/main.xht
CHANGED
package/docs/mark.xht
CHANGED
|
@@ -2,8 +2,52 @@
|
|
|
2
2
|
:scope {
|
|
3
3
|
line-height: 1.8;
|
|
4
4
|
display: block;
|
|
5
|
-
padding: 0 20px;
|
|
6
5
|
font-family: Times, "宋体", sans-serif;
|
|
6
|
+
|
|
7
|
+
@media screen and (max-width:830px) {
|
|
8
|
+
padding: 20px 40px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@media screen and (min-width:1160px) {
|
|
12
|
+
margin: 20px auto;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media screen and (min-width:830px) {
|
|
16
|
+
max-width: 890px;
|
|
17
|
+
border: 1px solid #000;
|
|
18
|
+
padding: 60px 80px;
|
|
19
|
+
box-shadow: 0 0 20px -6px #0006;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
code {
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
table {
|
|
28
|
+
margin-top: 12px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
thead {
|
|
32
|
+
font-weight: 900;
|
|
33
|
+
text-align: center;
|
|
34
|
+
|
|
35
|
+
td {
|
|
36
|
+
border-bottom: 1px solid #000;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
ol,
|
|
41
|
+
ul {
|
|
42
|
+
padding-left: 20px;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
h1,
|
|
46
|
+
h2,
|
|
47
|
+
h3,
|
|
48
|
+
h4,
|
|
49
|
+
h5 {
|
|
50
|
+
border-bottom: 1px solid #000;
|
|
7
51
|
}
|
|
8
52
|
|
|
9
53
|
[type="xml"] stamp,
|
|
@@ -54,7 +98,6 @@
|
|
|
54
98
|
border-collapse: collapse;
|
|
55
99
|
border: 1.2px solid #0007;
|
|
56
100
|
}
|
|
57
|
-
|
|
58
101
|
</style>
|
|
59
102
|
<script>
|
|
60
103
|
var history = [];
|