efront 4.25.3 → 4.26.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.
@@ -1,6 +1,3 @@
1
- - zh-CN: "不能有特殊符号\"$1\""
2
- en: "Cannot have special symbol '$1'"
3
-
4
1
  - zh-CN: 不启用
5
2
  en: Disable
6
3
 
@@ -43,6 +40,15 @@
43
40
  - zh-CN: 英语
44
41
  en: English
45
42
 
43
+ - zh-CN: 大写锁定已打开
44
+ en: Capitalization lock turned on
45
+
46
+ - zh-CN: 数字键盘已关闭
47
+ en: The numeric keypad is turned off
48
+
49
+ - zh-CN: "不能有特殊符号\"$1\""
50
+ en: "Cannot have special symbol '$1'"
51
+
46
52
  - zh-CN: 商店
47
53
  en: Store
48
54
 
@@ -47,6 +47,7 @@ class Javascript extends Program {
47
47
  strapexp_reg = /^(new|void|typeof|delete|class|function|await)/;
48
48
  forceend_reg = /^(return|yield|break|continue|debugger|async)$/;
49
49
  defaultType = EXPRESS;
50
+ lbtype = true;
50
51
  }
51
52
  var propresolve_reg = /^(static|get|set|async|readonly|private|pub)$/;
52
53
 
@@ -54,6 +54,7 @@ testDetour('0o1ll.a', '0o1ll["a"]')
54
54
  var ts = new Javascript;
55
55
  ts.straps.push('interface', 'implements', "declare", "module", "readonly", "enum", 'type');
56
56
  ts.tags[0].push("{")
57
+ ts.lbtype = false;
57
58
  var testTypescript = function (text) {
58
59
  var s = scanner2(text, ts);
59
60
  return assert(s.toString(), text);
@@ -149,6 +149,7 @@ class Program {
149
149
  control_reg = /^(if|else|switch|case|do|while|for|loop|break|continue|default|import|from|as|export|try|catch|finally|throw|await|yield|return)$/;
150
150
  type_reg = /^(var|let|const|function|fn|func|class|interface|type|struct|enum|impl|local)$/;
151
151
  nocase = false
152
+ lbtype = false;
152
153
  keepspace = false;
153
154
  lastIndex = 0
154
155
  detectLabel(o) {
@@ -171,7 +172,6 @@ class Program {
171
172
  o.isprop = true;
172
173
  break;
173
174
  }
174
- if (last.type & (STAMP | STRAP) || last.istype) break;
175
175
  inExpress = true;
176
176
  if (!queue.question) queue.question = 1;
177
177
  else queue.question++;
@@ -206,9 +206,15 @@ class Program {
206
206
  queue.question--;
207
207
  if (last.type === STAMP && last.text === '?') {
208
208
  inExpress = false;
209
- o.istype = true;
210
- last.istype = true;
211
- last.type = EXPRESS;
209
+ var lp = last.prev;
210
+ if (lp) {
211
+ var lpp = lp.prev;
212
+ if (lpp?.type === EXPRESS) {
213
+ lpp.type = LABEL;
214
+ }
215
+ lp.needle = true;
216
+ last.needle = true;
217
+ }
212
218
  }
213
219
  else {
214
220
  inExpress = true;
@@ -239,8 +245,7 @@ class Program {
239
245
  if (!queue.isargl && last.type & (EXPRESS | STRAP | VALUE | QUOTED)) {
240
246
  // label
241
247
  var lp = last.prev;
242
- if (lp && lp.type === STAMP && lp.text === ',') {
243
- o.istype = true;
248
+ if (lp && !this.lbtype && lp.type === STAMP && lp.text === ',') {
244
249
  break;
245
250
  }
246
251
  if (!lp || lp.type !== STRAP || !lp.transive || lp.isend) {
@@ -1121,6 +1121,7 @@ var getDeclared = function (o, kind, queue) {
1121
1121
  continue;
1122
1122
  }
1123
1123
  break;
1124
+ case LABEL:
1124
1125
  case PROPERTY:
1125
1126
  var n = getnext(o);
1126
1127
  if (n) {
@@ -1587,8 +1588,14 @@ var createExpressList = function (code) {
1587
1588
  for (var cx = 0, dx = code.length; cx < dx;) {
1588
1589
  var o = code[cx];
1589
1590
  var ex = skipAssignment(code, cx);
1590
- if (code[ex] && code[ex].type === STAMP && /[,;]/.test(code[ex].text)) {
1591
- ex++;
1591
+ var c = code[ex];
1592
+ if (c?.type === STAMP) {
1593
+ if (/^[,;]$/.test(c.text)) {
1594
+ ex++;
1595
+ }
1596
+ else if (c.text === ':' && !c.isExpress && c.prev?.type !== PROPERTY) {
1597
+ ex++;
1598
+ }
1592
1599
  }
1593
1600
  if (ex > dx) ex = dx;
1594
1601
  var exp = [];
@@ -2,7 +2,7 @@ var { createExpressList, createString } = common;
2
2
  var test = function (text) {
3
3
  var code = scanner2(text);
4
4
  var exps = createExpressList(code);
5
- console.log(code.isExpressQueue(),exps.map(createString))
5
+ console.log(code.isExpressQueue(), exps.map(createString))
6
6
  };
7
7
  test('a')
8
8
  test('a+b=c')
@@ -17,4 +17,9 @@ test('try{}catch{}\r\nfinally{}\r\n if(m)c=d+a;else aa debugger\r\n a')
17
17
  test('var a')
18
18
  test('var a,b,c=1;')
19
19
  test('a:')
20
- test('a`b`,a`aa{s}`,c;')
20
+ test('a`b`,a`aa{s}`,c;')
21
+ test('case 1?2:3:{}case 2:default:``')
22
+ test('a: b,c,d;')
23
+ test('a: var b,c,d;')
24
+ test('a: if(){}')
25
+ test('a: a=1, b: b=2;')
@@ -1,24 +1,59 @@
1
+
1
2
  function password() {
2
3
  var element = div();
4
+ var capslock = null, numhide = null;
5
+ bind('keydown')(element, function (event) {
6
+ var which = event.which;
7
+ switch (which) {
8
+ case 144/*numlock*/:
9
+ if (numhide !== null) numhide = !numhide; break;
10
+ case 20/*capslock*/: if (capslock !== null) capslock = !capslock; break;
11
+ }
12
+ if (!numhide && /^Numpad/.test(event.code)) {
13
+ numhide = which < 96;
14
+ }
15
+ if (which >= 65 && which <= 90) {
16
+ var key = event.key;
17
+ capslock = event.shiftKey ^ (key >= "A" && key <= "Z");
18
+ }
19
+ updatetips();
20
+ });
3
21
  var saved_value = element.value = "";
4
22
  var savedKeyCodes = [];
5
- element.innerHTML = "<input type=password /><insert></insert><holder></holder>";
6
- var [_input, insert, holder] = element.children;
7
- var text = document.createTextNode("");
8
- element.insertBefore(text, _input);
23
+ element.innerHTML = "<tips></tips><input type=password /><text><insert></insert></text><holder></holder>";
24
+ var [tips, _input, text, holder] = element.children;
25
+ var textNode = document.createTextNode('');
26
+ text.insertBefore(textNode, text.firstChild);
9
27
  var build = function () {
10
28
  element.value = String.fromCharCode(...savedKeyCodes);
11
29
  if (!savedKeyCodes.length && element.placeholder) {
12
30
  element.appendChild(holder);
13
31
  holder.innerText = element.placeholder;
14
- element.insertBefore(insert, holder);
15
32
  } else {
16
33
  holder.parentNode === element && element.removeChild(holder);
17
- element.appendChild(insert);
18
34
  }
19
- text.nodeValue = savedKeyCodes.map(e => "●").join("");
20
- element.scrollLeft = insert.offsetLeft + insert.offsetWidth + element.clientTop + 2;
35
+ textNode.nodeValue = savedKeyCodes.map(e => "●").join("");
21
36
  };
37
+ bind('focus')(element, function () {
38
+ capslock = null;
39
+ numhide = null;
40
+ updatetips();
41
+ });
42
+ bind('blur')(element, function () {
43
+ capslock = null;
44
+ numhide = null;
45
+ updatetips();
46
+ })
47
+ var updatetips = function () {
48
+ var tip = [];
49
+ if (capslock) {
50
+ tip.push(i18n`大写锁定已打开`);
51
+ }
52
+ if (numhide) {
53
+ tip.push(i18n`数字键盘已关闭`);
54
+ }
55
+ tips.innerText = tip.join(', ');
56
+ }
22
57
  element.onfocus = function () {
23
58
  addClass(element, 'focus');
24
59
  saved_value = element.value;
@@ -24,7 +24,7 @@
24
24
  line-height: 26px;
25
25
  border-radius: 3px;
26
26
  font-size: 16px;
27
- -webkit-appearance: none;
27
+ appearance: none;
28
28
  box-shadow: none;
29
29
  outline: none;
30
30
  background-color: #fff;
@@ -32,17 +32,57 @@
32
32
  vertical-align: middle;
33
33
  position: relative;
34
34
  overflow: auto;
35
- overflow: hidden;
35
+ border: 1px solid transparent;
36
+ overflow: visible;
36
37
 
37
- >insert {
38
+ &.focus {
39
+ >input {
40
+ border-color: transparent;
41
+ outline: none;
42
+ }
43
+
44
+ outline: none;
45
+ border-color: #29c;
46
+
47
+ >tips:not(:empty) {
48
+ display: block;
49
+ }
50
+ }
51
+
52
+
53
+ >tips {
54
+ display: none;
55
+ position: absolute;
56
+ left: 2px;
57
+ border: 1px solid;
58
+ border-bottom: none;
59
+ background: #FFF;
60
+ top: -12px;
61
+ line-height: 12px;
62
+ font-size: 12px;
63
+ height: 12px;
64
+ padding: 2px 4px 0 4px;
65
+ }
66
+
67
+ insert {
38
68
  display: inline;
39
69
  border-left: .75pt solid;
40
70
  opacity: 0;
41
71
  white-space: nowrap;
42
72
  }
43
73
 
74
+ >text {
75
+ position: relative;
76
+ overflow: hidden;
77
+ text-overflow: clip;
78
+ white-space: nowrap;
79
+ width: 100%;
80
+ display: block;
81
+ }
82
+
44
83
  >holder {
45
84
  color: #777;
85
+ position: relative;
46
86
  }
47
87
 
48
88
  >input[type=password] {
@@ -64,7 +104,7 @@
64
104
  height: auto;
65
105
  }
66
106
 
67
- >input:focus+insert {
107
+ &.focus insert {
68
108
  animation: flash-opacity 1s linear 0s infinite;
69
109
  }
70
110
  }
@@ -9,6 +9,7 @@ go.istype = function (o) {
9
9
  };
10
10
 
11
11
  var typescript = new compile$Javascript;
12
+ typescript.lbtype = false;
12
13
  typescript.straps = typescript.straps.concat(
13
14
  "interface", "implements", "declare", "module", "namespace",
14
15
  "readonly", "private", "asserts", "is",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.25.3",
3
+ "version": "4.26.1",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {