efront 4.23.6 → 4.23.8

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.
@@ -196,8 +196,7 @@
196
196
  remove(e);
197
197
  }
198
198
  })
199
- popup(e);
200
- move.setPosition(e, [.5, .5]);
199
+ popup(e, [.5, .5]);
201
200
  },
202
201
  async upload(o) {
203
202
  var cert = await data.fromURL(o.certificate);
@@ -21,7 +21,7 @@ var isValidK = function (k) {
21
21
  return k.length < 16 && !/^\d|[,:'"\\\/`\-\[\]\{\}\(\)\.\+\#\@\&^]/.test(k) && spaces.trim(k) === k;
22
22
  };
23
23
  var extractK = function (k) {
24
- return k.length < 16 && isFinite(k);
24
+ return /^\d{1,16}$/.test(k) && !/^0\d/.test(k);
25
25
  };
26
26
  var noDulp = false, plength = 0, dulp = false;
27
27
  var hasOwnProperty = {}.hasOwnProperty;
@@ -85,12 +85,12 @@ function _tostring(memery, preload, dist) {
85
85
  v = _tostring(v, preload);
86
86
  }
87
87
 
88
- if (k && +k === inc) {
89
- arr.push(v);
88
+ if (extractK(k)) {
89
+ if (+k === inc) arr.push(v);
90
+ else arr.push("+" + k + ":" + v);
90
91
  }
91
92
  else {
92
- if (extractK(k)) k = "+" + k;
93
- else if (!isValidK(k)) k = string(String(k));
93
+ if (!isValidK(k)) k = string(String(k));
94
94
  arr.push(k + ":" + v);
95
95
  }
96
96
  inc++;
@@ -11,6 +11,10 @@ var test_self = function () {
11
11
  test(null) // null;
12
12
  test(undefined); // 空字符串
13
13
  test(1); // 1
14
+ test([0]);
15
+ test(["00"]);
16
+ test({"0":"00"});
17
+ test({"00":"00"});
14
18
  test(true); // true
15
19
  test(false); // false
16
20
  test(NaN); // NaN
@@ -328,6 +332,24 @@ function test_time() {
328
332
  var t4 = gettime(() => JSAM.stringify(data, false));
329
333
  console.log(t1, t2, t3, t4);
330
334
  }
335
+ function test_encode() {
336
+ for (var cx = 0, dx = 0xffff; cx < dx; cx++) {
337
+ var str = String.fromCodePoint(cx);
338
+ var enc = JSAM.stringify(str);
339
+ var dec = JSAM.parse(enc);
340
+ assert(str, dec);
341
+ var obj = { [str]: str };
342
+ enc = JSAM.stringify(obj);
343
+ dec = JSAM.parse(enc);
344
+ if (!assert(dec, obj) || cx === 0x41) {
345
+ console.log(cx, str, cx.toString(16), enc);
346
+ };
347
+ obj = { [str]: obj, [enc]: obj };
348
+ enc = JSAM.stringify(obj);
349
+ dec = JSAM.parse(enc);
350
+ assert(dec, obj);
351
+ }
352
+ }
331
353
  function JSAM_test() {
332
354
  test_self();
333
355
  test_json();
@@ -336,4 +358,5 @@ function JSAM_test() {
336
358
  test_parse();
337
359
  JSAM.debug = false;
338
360
  test_time();
361
+ test_encode();
339
362
  }
@@ -8,7 +8,6 @@ var escapeMap = {
8
8
  "\u2028": "\\u2028",
9
9
  "\u2029": "\\u2029",
10
10
  };
11
- var unescapeReg = new RegExp(`[${Object.keys(escapeMap).map(a => escapeMap[a]).join('')}]`, 'g');
12
11
  var unescapeFun = a => escapeMap[a];
13
12
  var unescapeUnc = function (a) {
14
13
  if (escapeMap.hasOwnProperty(a)) return escapeMap[a];
@@ -23,8 +22,11 @@ var unescapeUnc = function (a) {
23
22
  }
24
23
  return "\\u" + code;
25
24
  };
26
- var unescapeMap = {};
25
+ var unescapeMap = {
26
+ "\\v": "\v",
27
+ };
27
28
  for (var k in escapeMap) unescapeMap[escapeMap[k]] = k;
29
+ var unescapeReg = new RegExp(`[${Object.keys(escapeMap).map(a => escapeMap[a]).join('')}]`, 'g');
28
30
  function encode(str, q = "\"", escapeUnicode = true) {
29
31
  str = str.replace(new RegExp(`[\\\\${q}]`, 'g'), "\\$&");
30
32
  if (escapeUnicode) str = str.replace(/[\r\n\t\v\f\u0008\u0000-\u001f\u007f-\uffff]/g, unescapeUnc);
@@ -0,0 +1,11 @@
1
+ function test_recode(a, b = a) {
2
+ assert(strings.recode(a), b);
3
+ }
4
+ test_recode(`"\v"`, `"\\u000b"`);
5
+ test_recode(`"\b"`, `"\\b"`);
6
+ test_recode(`"\f"`, `"\\f"`);
7
+ test_recode(`"\t"`, `"\\t"`);
8
+ test_recode(`"\r"`, `"\\r"`);
9
+ test_recode(`"\n"`, `"\\n"`);
10
+ test_recode(`"\0"`, `"\\u0000"`);
11
+ test_recode(`"\u0001"`, `"\\u0001"`);
@@ -1,5 +1,4 @@
1
1
  var JSON0 = window.JSON;
2
- console.log(JSON0);
3
2
  var test = function (JSON) {
4
3
  var parse = function (s) {
5
4
  try {
@@ -172,10 +171,33 @@ var test2 = function (JSON) {
172
171
  assert(JSON.parse(`{/*a*/"1":\r\n2}`), { "1": 2 })
173
172
  assert(JSON.parse(`{"1/*a*/":\r\n2}`), { "1/*a*/": 2 })
174
173
  }
174
+ var test3 = function (JSON) {
175
+ console.log(JSON, JSON0, JSON === JSON0);
176
+ var start_time = performance.now();
177
+ for (var cx = 0, dx = 0xffff; cx < dx; cx++) {
178
+ var str = String.fromCodePoint(cx);
179
+ var enc = JSON.stringify(str);
180
+ var dec = JSON.parse(enc);
181
+ assert(dec, str);
182
+ var obj = { [str]: str };
183
+ enc = JSON.stringify(obj);
184
+ dec = JSON.parse(enc);
185
+ assert(dec, obj);
186
+ obj = { [enc]: dec, [str]: obj };
187
+ var enc = JSON.stringify(obj);
188
+ dec = JSON.parse(enc);
189
+ if (!assert(dec, obj)) {
190
+ console.log(cx, str, cx.toString(16), enc, dec, obj);
191
+ process.exit(1);
192
+ }
193
+ }
194
+ console.log(performance.now() - start_time);
195
+ }
175
196
  function JSON_test() {
176
197
  window.JSON0 = JSON0;
177
198
  window.JSON = void 0;
178
199
  delete modules.JSON;
179
200
  modules.init("JSON", test2);
201
+ modules.init("JSON", test3);
180
202
  window.JSON = JSON0;
181
203
  }
@@ -199,29 +199,29 @@ var acme2 = new class {
199
199
  var acme2 = this;
200
200
  var extra;
201
201
  [private_key, public_key, extra] = unique.split(',');
202
- if (extra) {
203
- extra = JSON.parse(decodeUTF8(fromBase64(extra)));
204
- acme2.email = extra.email;
205
- acme2.kid = extra.kid;
206
- if (extra.kid) {
207
- var account = data.getUrlParamsForApi(accountApi, extra.kid);
208
- acme2.aid = account.aid;
209
- }
210
- acme2.domain = extra.domain;
211
- acme2.termsOfServiceAgreed = extra.termsOfServiceAgreed;
212
- acme2.orders = extra.orders;
213
- acme2.lastUpdateTime = filterTime(extra.lastUpdateTime, "y-MM-dd hh:mm");
214
- acme2.nextUpdateTime = parseDate(extra.nextUpdateTime);
215
- acme2.schadulePeriod = +extra.schadulePeriod || 80;
216
- acme2.schaduleEnabled = extra.schaduleEnabled;
217
- this.updateTime();
218
- }
219
202
  if (!this.enabled) {
220
203
  public_key = null;
221
204
  private_key = null;
222
205
  return;
223
206
  }
224
207
  try {
208
+ if (extra) {
209
+ extra = JSON.parse(decodeUTF8(fromBase64(extra)));
210
+ acme2.email = extra.email;
211
+ acme2.kid = extra.kid;
212
+ if (extra.kid) {
213
+ var account = data.getUrlParamsForApi(accountApi, extra.kid);
214
+ acme2.aid = account.aid;
215
+ }
216
+ acme2.domain = extra.domain;
217
+ acme2.termsOfServiceAgreed = extra.termsOfServiceAgreed;
218
+ acme2.orders = extra.orders;
219
+ acme2.lastUpdateTime = filterTime(extra.lastUpdateTime, "y-MM-dd hh:mm");
220
+ acme2.nextUpdateTime = parseDate(extra.nextUpdateTime);
221
+ acme2.schadulePeriod = +extra.schadulePeriod || 80;
222
+ acme2.schaduleEnabled = extra.schaduleEnabled;
223
+ this.updateTime();
224
+ }
225
225
  privateKey = await subtle.importKey("pkcs8", new Uint8Array(fromBase64(private_key)), {
226
226
  name: RSASSA_PKCS1_v1_5,
227
227
  hash: "SHA-256",
@@ -231,7 +231,9 @@ var acme2 = new class {
231
231
  hash: "SHA-256",
232
232
  }, true, ["verify"]);
233
233
  acme2.public_key = public_key;
234
- } catch (e) { alert("加载服务器公钥异常!", "error"); throw e }
234
+ } catch (e) {
235
+ alert("加载服务器公钥异常!", "error");
236
+ }
235
237
  }
236
238
  pickUnique() {
237
239
  var acme2 = this;
@@ -109,7 +109,7 @@ function main(elem) {
109
109
  if (elem.break === false) elem.break = Infinity;
110
110
  resizingList.set(elem, reshape);
111
111
  elem.setAttribute("field", '');
112
- elem.$digest = ondigest;
112
+ elem.$digest = reshape;
113
113
  elem.removeAttribute("tabindex");
114
114
 
115
115
  if (!elem.childNodes.length) {
@@ -120,7 +120,7 @@ function main(elem) {
120
120
  if (head) addClass(head, "head");
121
121
  if (body) addClass(body, "body");
122
122
  if (foot) addClass(foot, "foot");
123
- elem.$renders = [reshape];
124
123
  }
124
+ elem.$renders = [checkValue];
125
125
  return elem;
126
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.23.6",
3
+ "version": "4.23.8",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {