efront 4.35.2 → 4.35.4

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.
Files changed (35) hide show
  1. package/#/345/233/275/351/231/205/345/214/226.yml +3 -0
  2. package/coms/basic/#loader.js +1 -1
  3. package/coms/basic/Table.js +26 -0
  4. package/coms/basic/escapeRegExp.js +24 -0
  5. package/coms/basic/escapeRegExp_test.js +35 -0
  6. package/coms/basic/math.js +106 -4
  7. package/coms/basic/math.md +128 -25
  8. package/coms/basic/spaces.js +1 -1
  9. package/coms/compile/Program.js +1 -1
  10. package/coms/compile/common.js +1 -1
  11. package/coms/compile//347/256/227/345/274/217.js +62 -20
  12. package/coms/compile//347/256/227/345/274/217_test.js +6 -2
  13. package/coms/compile//347/264/240/351/246/250.js +5 -4
  14. package/coms/compile//347/264/240/351/246/250_test.js +21 -1
  15. package/coms/explorer/main.less +1 -0
  16. package/coms/reptile/colors.js +2 -1
  17. package/coms/zimoli/arriswise.js +6 -1
  18. package/coms/zimoli/color-config.less +1 -1
  19. package/coms/zimoli/confirm.js +1 -1
  20. package/coms/zimoli/getGenerator.js +0 -1
  21. package/coms/zimoli/list.js +609 -576
  22. package/coms/zimoli/popup.js +1 -1
  23. package/coms/zimoli/prompt.js +4 -1
  24. package/coms/zimoli/scrollbar.less +1 -1
  25. package/coms/zimoli/table.js +1 -1
  26. package/coms/zimoli/vbox.js +1 -0
  27. package/coms//350/214/250/350/217/260//344/270/212/350/211/262.xht +5 -1
  28. package/coms//350/214/250/350/217/260//346/240/207/347/255/276/345/214/226.js +9 -1
  29. package/coms//350/214/250/350/217/260//346/270/262/346/237/223.js +1 -1
  30. package/coms//350/214/250/350/217/260//347/274/226/350/276/221/346/241/206.xht +16 -2
  31. package/coms//350/214/250/350/217/260//350/257/255/350/250/200.js +5 -0
  32. package/package.json +1 -1
  33. package/public/efront.js +1 -1
  34. package/public//346/226/207/344/273/266/347/263/273/347/273/237//344/270/273/351/241/265.jsp +2 -2
  35. package/debug.log +0 -3
@@ -2,30 +2,42 @@ const {
2
2
  STAMP, EXPRESS, SCOPED,
3
3
  createExpressList,
4
4
  skipAssignment,
5
+ createScoped,
6
+ createString,
5
7
  } = require("./common");
6
8
  var powermap = require("./powermap");
7
-
9
+ var number_rep = /^[+-]?([\d\.]+)(?:e([+-]?\d+))?$/;
8
10
  class Math extends Program {
9
- number_reg = /^(\d+(\.\d+)?|\.\d+)$/;
11
+ number_reg = /^(\d+(?:\.\d+){0,2}|(?:\.\d+){1,2}|(?:\d+\.){1,3})\.*(?:e[+-]?\d+)?$/;
12
+ powermap = Object.assign({}, powermap);
13
+ value_reg = /^(false|true|null|Infinity|NaN|undefined|eval|this|arguments)$/;
14
+ constructor() {
15
+ super();
16
+ var pmap = this.powermap;
17
+ pmap["+-"] = pmap["-+"] = powermap["+"];
18
+ pmap["×"] = pmap[".*"] = powermap["*"];
19
+ pmap["≈"] = pmap["~="] = pmap["=="];
20
+ pmap["≉"] = pmap["!≈"] = pmap["!~="] = pmap["~!="] = pmap["=="];
21
+ pmap["≠"] = powermap["!="];
22
+ pmap["≢"] = powermap["!=="];
23
+ pmap["^"] = powermap["**"];
24
+ pmap["_"] = powermap["?."];
25
+ pmap["'"] = powermap["?."];
26
+ this.stamps.push('\\', '_');
27
+ }
10
28
  }
29
+ Math.prototype.createScoped = createScoped;
30
+ Math.prototype.createString = createString;
11
31
  var math = new Math;
12
- math.stamps.push('\\', '_');
13
- var pmap = math.powermap = Object.assign({}, powermap);
14
- pmap["×"] = pmap[".*"] = powermap["*"];
15
- pmap["≈"] = pmap["~="] = pmap["=="];
16
- pmap["≉"] = pmap["!≈"] = pmap["!~="] = pmap["~!="] = pmap["=="];
17
- pmap["≠"] = powermap["!="];
18
- pmap["≢"] = powermap["!=="];
19
- pmap["^"] = powermap["**"];
20
- pmap["_"] = powermap["?."];
21
- pmap["'"] = powermap["?."];
32
+ var pmap = math.powermap;
22
33
  var puncmap = {
23
34
  "*": "×", // 叉乘
24
35
  '.*': '·',
25
36
  "!=": "≉",
26
37
  "!==": "≢",
27
38
  "~=": "≈",
28
- "-+": "±",
39
+ "-+": "",
40
+ "+-": "±",
29
41
  "!<": "≮",
30
42
  "!>": "≯",
31
43
  ">=": "≥",
@@ -90,7 +102,12 @@ var getRows = function (code) {
90
102
  return trs;
91
103
  }
92
104
  var getArgs = function (a) {
93
- return split(a, ',').map(toFlat);
105
+ return split(a, ',').map(a => {
106
+ var cells = createExpressList(a);
107
+ if (!cells[cells.length - 1]?.first) cells.pop();
108
+ if (cells.length === 1) return toFlat(cells[0]);
109
+ return cells.map(toFlat);
110
+ });
94
111
  }
95
112
  var uncup = function (cup) {
96
113
  if (cup.iscup && cup.length <= 1) cup = cup[0];
@@ -116,7 +133,7 @@ var back = function (cache) {
116
133
  cache.splice(s, cache.length - s);
117
134
  }
118
135
  var toFlat = function (exp) {
119
- if (exp.length === 1 && exp[0].type !== SCOPED) return exp[0].text;
136
+ if (exp.length === 1 && exp[0].type !== SCOPED && !exp[0].isdigit) return exp[0].text;
120
137
  var bx = 0;
121
138
  var p0 = 0;
122
139
  var left = [];
@@ -204,7 +221,6 @@ var toFlat = function (exp) {
204
221
  }
205
222
  else {
206
223
  var args = getArgs(e);
207
- console.log(args)
208
224
  // 下标
209
225
  left = [make("_", left, ...args)];
210
226
  }
@@ -225,12 +241,37 @@ var toFlat = function (exp) {
225
241
  }
226
242
  if (e.isdigit) a: {
227
243
  var et = e.text;
228
- var v = +et;
244
+ var [, a, e10] = number_rep.exec(et);
245
+ var b = a.split('.');
246
+ if (b.length > 2 || e10) {
247
+ var nrep = b[2] || b[1];
248
+ var npre = b[0];
249
+ if (b[2]) {
250
+ npre += "." + b[1];
251
+ }
252
+ else if (b[1] ? b.length <= 2 || b.length > 3 : b.length <= 1 || b.length > 2) {
253
+ if (nrep) npre += "." + nrep;
254
+ nrep = '';
255
+ }
256
+ if (String(+npre) === npre) npre = +npre;
257
+ if (String(+nrep) === nrep) nrep = +nrep;
258
+ var v = [npre, nrep];
259
+ if (b.length > (b[2] ? 4 : b[1] ? 3 : 2)) v.push(b.slice(b[2] ? 3 : b[1] ? 2 : 1, b.length).join('.') + ".");
260
+ else if (e10) v.push('');
261
+ if (e10) {
262
+ if (String(+e10) === e10) e10 = +e10;
263
+ v.push(e10);
264
+ }
265
+ v = { "..": v };
266
+ left.push(v);
267
+ continue;
268
+ }
269
+ var v = +a;
229
270
  if (/^\+/.test(et)) {
230
- if (String(v) !== et.slice(1)) break a;
271
+ if (String(v) !== a.slice(1)) break a;
231
272
  v = make("+", '', v);
232
273
  }
233
- if (String(v) !== et) break a;
274
+ if (String(v) !== a) break a;
234
275
  left.push(v);
235
276
  continue;
236
277
  }
@@ -273,4 +314,5 @@ function main(text) {
273
314
  }
274
315
  res.pop();
275
316
  return uncup(res);
276
- }
317
+ }
318
+ main.MathScript = Math;
@@ -21,6 +21,10 @@ t(`a(b,c)`)
21
21
  t(`[b,c]'`)
22
22
  t(`H[+]`)
23
23
  t(`H[2-]`)
24
- t.debug = true;
25
24
  t(`H'*1`)
26
- t(`cos(theta,2)*E +(1 - cos(theta))*K'*K+sin(theta)*[0,-K_2,K_1;K_2,0,-K_0;-K_1,K_0,0]`)
25
+ t(`cos(theta,2)*E +(1 - cos(theta))*K'*K+sin(theta)*[0,-K_2,K_1;K_2,0,-K_0;-K_1,K_0,0]`)
26
+ t.debug = true;
27
+ t(`group(
28
+ x+y=10 tab(circle,1),
29
+ x*y=25 tab(circle,2)
30
+ )`)
@@ -1,5 +1,5 @@
1
1
  var { STAMP, PROPERTY, SCOPED, VALUE, STRAP, EXPRESS, QUOTED, SPACE, COMMENT, createString: _createString, splice } = require("./common");
2
- var numberReg = /((?:[\+\-]+)?(?:\d+(?:\.\d*)?|\.\d+))([a-zH]+|%)?/;
2
+ var numberReg = /((?:\d+(?:\.\d*)?|\.\d+))([a-zH]+|%)?/;
3
3
  var createString = function (a) {
4
4
  a.autospace = false;
5
5
  return _createString(a);
@@ -16,9 +16,10 @@ class 素玉 extends Program {
16
16
 
17
17
  var rarg = new 素玉;
18
18
  rarg.quotes.push(["url(", ")"]);
19
- var replaceHReg = new RegExp(numberReg.source + /\s*([\/\*])\s*/.source + numberReg.source, 'gi');
20
- var replaceLReg = new RegExp(numberReg.source + /(\s*[\+\-]\s+|[\+\-])/.source + numberReg.source, 'gi');
21
- var replaceTReg = new RegExp(numberReg.source + /\s*[\/\*\+\-]\s*/.source + numberReg.source, 'i');
19
+ var numberReg2 = /([\-\+]?(?:\d+(?:\.\d*)?|\.\d+))([a-zH]+|%)?/;
20
+ var replaceHReg = new RegExp(numberReg2.source + /\s*([\/\*])\s*/.source + numberReg2.source, 'gi');
21
+ var replaceLReg = new RegExp(numberReg2.source + /(\s*[\+\-]\s+|[\+\-])/.source + numberReg2.source, 'gi');
22
+ var replaceTReg = new RegExp(numberReg2.source + /\s*[\/\*\+\-]\s*/.source + numberReg2.source, 'i');
22
23
  var remove_quote = a => a.replace(/~\s*(['"`])((?:\\[\s\S]|[^'"`\\])*?)\1/g, '$2');
23
24
  var keepdot = function (a) {
24
25
  var g = Math.pow(10, Math.log10(a) | 0) * 1000;
@@ -78,6 +78,26 @@ test(`a >{b{a:b}}`, `a>b{a:b;}`);
78
78
  test(`a{>b{a:b}}`, `a>b{a:b;}`);
79
79
  test(`.type(@type,@media) {.@{type} {&:before{content:"@{media}";}}}.type(videoinput, "相机");`, `.videoinput:before{content:"相机";}`);
80
80
  test(`.type(@type,@media) {.@{type} {&:before{content:"@{media}";}}}.type(videoinput, 相机);`, `.videoinput:before{content:"相机";}`);
81
+ test(`
82
+ @avatar-top: -12px;
83
+ a{
84
+ top: 12px- @avatar-top;
85
+ }
86
+ `,'a{top:24px;}');
87
+ common.createString.debug = true;
88
+ Program.debug = true;
89
+ test(`@type(@len){
90
+ &[ntype="@{len}"] {
91
+ @w: @len/2+1.4;
92
+ >[nlist] {
93
+ width: @{w}em;
94
+ }
95
+ }
96
+ }
97
+ @type(1)
98
+ `, '>[nlist]{width:1.9em;}');
99
+ Program.debug = false;
100
+ common.createString.debug = false;
81
101
  assert(素馨(`:not(a):not(b){c:d}`, 'abc'), `abc :not(a):not(b){c:d;}`);
82
102
  assert(素馨(`&:not(a):not(b){c:d}`, 'abc'), `abc:not(a):not(b){c:d;}`);
83
103
  assert(素馨(`:scope{&:not(a):not(b){c:d}}`, 'abc'), `abc:not(a):not(b){c:d;}`);
@@ -118,4 +138,4 @@ assert(素馨(`h1{a:c; span{a:b} i{a:b} }`, '.home-', true), `.home- h1 span{a:b
118
138
  assert(素馨(`h1{ button{&:not(hover){.track{a:b}}} }`, '.home-', true), `.home- h1 button:not(hover) .track{a:b;}`);
119
139
  assert(素馨(`@type(@a){&[type=@a]{a:1}} @type(white)`, '.btn-', true), `.btn-[type=white]{a:1;}`);
120
140
  assert(素馨(`a,b{c,d{ g&{e:f}}}`, '', true), `a gc,b gc,a gd,b gd{e:f;}`);
121
- assert(素馨(`a{a:lch(from rgb(20 20 20) l c h)}`, '', true), `a{a:lch(from rgb(20 20 20) l c h);}`);
141
+ assert(素馨(`a{a:lch(from rgb(20 20 20) l c h)}`, '', true), `a{a:lch(from rgb(20 20 20) l c h);}`);
@@ -52,6 +52,7 @@ padding {
52
52
 
53
53
  & {
54
54
  height: 100%;
55
+ overflow: hidden;
55
56
  }
56
57
 
57
58
  fileitem {
@@ -40,7 +40,8 @@ var colors = module.exports = {
40
40
  BgCyan2: "\x1b[106m",
41
41
  BgWhite2: "\x1b[107m",
42
42
  };
43
- colors.label = colors.strap = colors.value = colors.FgBlue2;
43
+ colors.tag = colors.FgBlue2;
44
+ colors.label = colors.strap = colors.value = colors.FgWhite;
44
45
  colors.comment = colors.FgGreen;
45
46
  colors.invoke = colors.method = colors.FgYellow2;
46
47
  colors.express = colors.property = colors.FgCyan2;
@@ -41,7 +41,12 @@ function build(func, argNames, argsArr) {
41
41
  var arriswise = function (func, args = []) {
42
42
  if (isFunction(args.slice)) {
43
43
  // 兼容老方法
44
- return build.call(arguments[2] || this, func, args.slice(0, args.length >> 1), args.slice(args.length >> 1));
44
+ var argArr = args.slice(args.length - 3 >>> 1);
45
+ argArr.splice(argArr.length - 3, 2);
46
+ return build.call(arguments[2] || this, func,
47
+ args.slice(0, args.length - 3 >>> 1),
48
+ argArr,
49
+ );
45
50
  }
46
51
  var allArgumentsNames = args[args.length - 1];
47
52
  return build.call(this, func, allArgumentsNames, [].slice.call(args, 0));
@@ -1,2 +1,2 @@
1
1
  @border-solid: #0003;
2
- @border-focus: #06fe;
2
+ @border-focus: #29c;
@@ -151,7 +151,7 @@ function confirm() {
151
151
  Promise.resolve().then(function () {
152
152
  if (isMounted(element)) return;
153
153
  element.$mask = true;
154
- popup(element, target || [.5, .5], target ? 'rhomb' : true);
154
+ popup(element, target || [.5, .5], target ? 'rhomb' : target !== false);
155
155
  element.focus();
156
156
  if (!target) drag.on(head, element);
157
157
  else {
@@ -141,7 +141,6 @@ var getGenerator = function (container, tagName = 'item', wrapItem = false) {
141
141
  if (childNodes.length > 1) element.with = Array.prototype.slice.call(childNodes, 1);
142
142
  }
143
143
  var newScope = createScope(container, index, com, wrapItem);
144
- element.$renders = [update.bind(container, newScope, index, wrapItem)];
145
144
  var newItem = render(element, newScope, scopes, false);
146
145
  if (element.with) newItem.with = render(element.with, newScope, scopes, false);
147
146
  return newItem;