efront 4.0.35 → 4.0.38

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.
@@ -181,7 +181,7 @@ class Code extends Array {
181
181
  var avoidMap = null;
182
182
  var typeMap = Object.create(null);
183
183
  function scan(text, type = "js", lastIndex = 0) {
184
- if (isFinite(type)) lastIndex = +type, type = arguments[1];
184
+ if (isFinite(type)) lastIndex = +type, type = arguments[2] || type;
185
185
  var program = typeMap[type];
186
186
  if (!program) switch (type) {
187
187
  case "html":
@@ -1,4 +1,4 @@
1
- var { SPACE, COMMENT, EXPRESS, STRAP, QUOTED, STAMP, SCOPED, VALUE, LABEL, isEval, createString, skipAssignment, skipSentenceQueue, isHalfSentence, splice, relink, createExpressList, snapExpressHead, snapExpressFoot } = require("./common");
1
+ var { SPACE, COMMENT, EXPRESS, STRAP, QUOTED, STAMP, SCOPED, VALUE, LABEL, canbeTemp: _canbeTemp, isEval, createString, skipAssignment, skipSentenceQueue, isHalfSentence, splice, relink, createExpressList, snapExpressHead, snapExpressFoot } = require("./common");
2
2
  var scanner2 = require("./scanner2");
3
3
  var RE = { type: STRAP, text: "@re" };// if (_) return
4
4
  var RZ = { type: STRAP, text: "@rz" };// if (!_) return
@@ -871,24 +871,6 @@ var canbeOnce = function (body) {
871
871
  }
872
872
  return true;
873
873
  };
874
- var canbeTemp = function (body) {
875
- var cx = 0, dx = body.length - 1;
876
- while (cx < dx) {
877
- if (body[cx].type & (SPACE | COMMENT)) {
878
- cx++;
879
- continue;
880
- }
881
- if (body[dx].type & (SPACE | COMMENT)) {
882
- dx--;
883
- continue;
884
- }
885
- break;
886
- }
887
- if (body[cx] !== body[dx]) return false;
888
- var o = body[cx];
889
- if (!o) return false;
890
- return o.type === EXPRESS && (strip || !/[\.\[]/.test(o.text)) || o.type === VALUE || o.type === QUOTED && !o.length;
891
- };
892
874
  var _express = function (body, getname, ret) {
893
875
  if (canbeTemp(body)) {
894
876
  var q = [];
@@ -1316,6 +1298,9 @@ function toqueue(body, getname, ret = false, result = []) {
1316
1298
  }
1317
1299
  var ret_ = '';
1318
1300
  var strip = false;
1301
+ var canbeTemp = function (body) {
1302
+ return _canbeTemp(body, strip);
1303
+ };
1319
1304
  module.exports = function (body, newname, ret) {
1320
1305
  strip = body.strip;
1321
1306
  if (ret) ret = isString(ret) ? ret : newname();
@@ -58,7 +58,7 @@ if (/MSIE\s*[2-7]/.test(navigator.userAgent)) {
58
58
  if (currentHash && currentHash === targetHash) return;
59
59
  var targetHashIndex = targetHash.indexOf("#" + current_history);
60
60
  if (targetHashIndex < 0) return;
61
- var targetpath = targetHash.slice(targetHashIndex + current_history.length + 1);
61
+ var targetpath = targetHash.slice(targetHashIndex + current_history.replace(/\/$/, '').length + 1);
62
62
  targetpath = decodeURI(targetpath);
63
63
  go(targetpath);
64
64
  return;
package/docs/main.xht CHANGED
@@ -111,7 +111,8 @@
111
111
  closed: true,
112
112
  children: [
113
113
  { name: i18n`字符集检查`, path: "/工具/字符集检查" },
114
- { name: i18n`国际化`, path: "/工具/国际化" }
114
+ { name: i18n`国际化`, path: "/工具/国际化" },
115
+ { name: i18n`数值换算`, path: "/工具/数值换算" },
115
116
  ]
116
117
  }
117
118
  ];
@@ -0,0 +1,45 @@
1
+ <style></style>
2
+ <div>
3
+ <field -repeat="f in formats" -src="[f,value]"></field>
4
+ </div>
5
+ <script>
6
+ var _value = 0;
7
+ var parseFloat = (a, b) => new BigNumber(a, b);
8
+ var value = {
9
+ get 十进制() {
10
+ return _value;
11
+ },
12
+ set 十进制(v) {
13
+ _value = parseFloat(v)
14
+ },
15
+ get 十六进制() {
16
+ return _value.toString(16);
17
+ },
18
+ set 十六进制(v) {
19
+ _value = parseFloat(v, 16);
20
+ },
21
+ get 二进制() {
22
+ return _value.toString(2);
23
+ },
24
+ set 二进制(v) {
25
+ _value = parseFloat(v, 2);
26
+ },
27
+ get 八进制() {
28
+ return _value.toString(8)
29
+ },
30
+ set 八进制(v) {
31
+ _value = parseFloat(v, 8)
32
+ },
33
+ get 三十六进制() {
34
+ return _value.toString(36);
35
+ },
36
+ set 三十六进制(v) {
37
+ _value = parseFloat(v, 36);
38
+ },
39
+
40
+ };
41
+ var formats = Object.getOwnPropertyNames(value).map(k => {
42
+ return { name: k, key: k };
43
+ });
44
+
45
+ </script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.0.35",
3
+ "version": "4.0.38",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {