efront 4.1.9 → 4.1.11

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.
@@ -30,10 +30,15 @@ var skipAssignment = function (o, cx) {
30
30
  while (o && o.type & (SPACE | COMMENT)) o = body[++ox];
31
31
  cx = ox + 1;
32
32
  }
33
+ else if (o.type & (SPACE | COMMENT)) o = o.next;
33
34
  var needpunc = false;
34
35
  var qcount = 0;
35
36
  var ifdeep = 0;
37
+ var labeled = o && o.type === LABEL;
38
+ while (o && o.type === LABEL) next();
36
39
  loop: while (o) switch (o.type) {
40
+ case LABEL:
41
+ if (!ifdeep) break loop;
37
42
  case STAMP:
38
43
  switch (o.text) {
39
44
  case ";":
@@ -43,7 +48,7 @@ var skipAssignment = function (o, cx) {
43
48
  next();
44
49
  break;
45
50
  case ",":
46
- if (!ifdeep) break loop;
51
+ if (!ifdeep && !labeled) break loop;
47
52
  needpunc = false;
48
53
  next();
49
54
  break;
@@ -259,7 +264,7 @@ function snapSentenceHead(o) {
259
264
  break;
260
265
  }
261
266
  if (p.type === STAMP) {
262
- if (/=>|[,;]/.test(p.text)) {
267
+ if (/=>|;/.test(p.text)) {
263
268
  break;
264
269
  }
265
270
  if (/^[\?\:]$/.test(p.text)) {
@@ -1293,7 +1298,7 @@ var pickSentence = function (o) {
1293
1298
  if (o && o.type === STAMP && o.prev) o = o.prev;
1294
1299
  if (o.type === STRAP && /^(in|instanceof|as|of)$/.test(o.text) && o.prev) o = o.prev;
1295
1300
  var h = snapSentenceHead(o);
1296
- var e = skipAssignment(o);
1301
+ var e = skipAssignment(h);
1297
1302
  var q = o.queue;
1298
1303
  if (q) {
1299
1304
  var qh = q.indexOf(h);
@@ -0,0 +1,12 @@
1
+ function testPickSentence(text, index, except) {
2
+ var code = scanner2(text);
3
+ assert(common.createString(common.pickSentence(code[index])), except);
4
+ }
5
+ testPickSentence(`function 九尾妖狐(){}`, 0, "function 九尾妖狐() {}")
6
+ testPickSentence(`function 九尾妖狐(){}`, 2, "function 九尾妖狐() {}")
7
+ testPickSentence(`a: function 九尾妖狐(){}`, 1, "a: function 九尾妖狐() {}")
8
+ testPickSentence(`a: function 九尾妖狐(){}`, 0, "a: function 九尾妖狐() {}")
9
+ testPickSentence(`a: function 九尾妖狐(){}`, 2, "a: function 九尾妖狐() {}")
10
+ testPickSentence(`a: 王天霸, 步惊云 b:叶流云, 四顾剑`, 2, "a: 王天霸, 步惊云")
11
+ testPickSentence(`a: 王天霸, 步惊云 b:叶流云, 四顾剑`, 4, "b: 叶流云, 四顾剑")
12
+ testPickSentence(`a: 王天霸, 步惊云; b:叶流云, 四顾剑`, 4, "a: 王天霸, 步惊云")
@@ -61,6 +61,11 @@ function getI18nPrefixedText(code, dist = []) {
61
61
  c.fields = refilm([c.translate]);
62
62
  dist.push(c);
63
63
  }, 字段名);
64
+ if (envs.refilm_decode) get(used.refilm_decode.filter(o => o.text === 'refilm_decode').map(o => o.next), c => {
65
+ c.fields = refilm([c.translate]);
66
+ c.warn = false;
67
+ dist.push(c);
68
+ }, 字段名);
64
69
  return dist;
65
70
  }
66
71
  var ctn = function (tt, t) {
@@ -86,10 +91,10 @@ function translate([imap, supports], code) {
86
91
  if (a.start > b.start && a.end < b.end) return -1;
87
92
  return 0;
88
93
  });
89
- var getm = function (tt) {
94
+ var getm = function (tt, warn) {
90
95
  tt = tt.trim();
91
96
  if (!imap[tt]) {
92
- console.warn(`<yellow>${i18n`国际化翻译缺失:`}</yellow>${tt}`);
97
+ if (warn !== false) console.warn(`<yellow>${i18n`国际化翻译缺失:`}</yellow>${tt}`);
93
98
  imap[tt] = supports.map(_ => tt);
94
99
  }
95
100
  return imap[tt].map(m => strings.encode(m || tt, '`'));
@@ -110,8 +115,14 @@ function translate([imap, supports], code) {
110
115
  else if (t.transtype === 字段名) {
111
116
  var i = t.queue.indexOf(t.prev);
112
117
  var e = t.queue.indexOf(t, i);
113
- var ui = used.refilm.indexOf(t.prev);
114
- used.refilm.splice(ui, 1);
118
+ if (t.warn === false) {
119
+ var ui = used.refilm_decode.indexOf(t.prev);
120
+ if (ui >= 0) used.refilm_decode.splice(ui, 1);
121
+ }
122
+ else {
123
+ var ui = used.refilm.indexOf(t.prev);
124
+ if (ui >= 0) used.refilm.splice(ui, 1);
125
+ }
115
126
  if (!used.i18n) {
116
127
  used.i18n = [];
117
128
  code.envs.i18n = true;
@@ -127,7 +138,7 @@ function translate([imap, supports], code) {
127
138
  if (a in t) v = t[a];
128
139
  else v = scanner2(JSON.stringify(v));
129
140
  }
130
- else if (k === 'name') v = ctn(`i18n(${getm(v)})`, t);
141
+ else if (k === 'name') v = ctn(`i18n(${getm(v, t.warn)})`, t);
131
142
  else v = scanner2(JSON.stringify(v));
132
143
  o.push({ type: PROPERTY, isprop: true, text: JSON.stringify(k) }, { type: STAMP, text: ':' }, ...v, { type: STAMP, text: ',' });
133
144
  })
@@ -237,8 +237,10 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
237
237
  var children = targetBox.children;
238
238
  var srcElement = children[src];
239
239
  var dstElement = children[dst + delta];
240
- src = bindTarget(src, isMovingSource ? targetChild : srcElement);
241
- dst = bindTarget(dst, dstElement);
240
+ if (srcElement) {
241
+ src = bindTarget(src, isMovingSource ? targetChild : srcElement);
242
+ dst = bindTarget(dst, dstElement);
243
+ }
242
244
  var needFire = !isFunction(move) || move(src, dst, dst + delta, appendSibling, targetBox) !== false;
243
245
  if (needFire && srcElement === children[src] && dstElement === children[dst + delta] && srcElement && dstElement) appendSibling(dstElement, srcElement);
244
246
  } else if (isMovingSource === false) {
@@ -182,6 +182,7 @@ function main(e) {
182
182
  elem.setValue = function (v) {
183
183
  var [_x, _y, z, a] = color2xyz(v);
184
184
  hue.value = z;
185
+ sethue(z);
185
186
  opa.value = 1 - a;
186
187
  css(huepointer, { top: +(z * 100).toFixed(6) + '%' })
187
188
  css(opapointer, { top: +(100 - a * 100).toFixed(6) + '%' })
@@ -208,19 +209,20 @@ function main(e) {
208
209
  var c0 = color.parse(c).slice(0, 3).map(a => xy2c(a, x, y));
209
210
  c0[3] = a;
210
211
  var p = color.stringify(c0);
212
+ var lc = color.stringify(c0.slice(0, 3));
211
213
  var value = p;
212
214
  css(padpointer, {
213
215
  left: +(x * 100).toFixed(6) + "%",
214
216
  top: +(y * 100).toFixed(6) + "%",
215
217
  background: p,
216
- outlineColor: color.pair(p),
218
+ outlineColor: color.pair(lc),
217
219
  });
218
220
  css(huepointer, {
219
221
  outlineColor: color.pair(c),
220
222
  background: c
221
223
  });
222
224
  css(opapointer, {
223
- outlineColor: color.pair(p),
225
+ outlineColor: a > .6 ? color.pair(lc) : "#000",
224
226
  background: p
225
227
  });
226
228
  buildopa(opa, p);
@@ -229,7 +231,7 @@ function main(e) {
229
231
  rgb.setValue(value);
230
232
  hsl.setValue(value);
231
233
  bg.style.borderColor = value;
232
- val.style.color = color.pair(value);
234
+ val.style.color = a > .6 ? color.pair(lc) : "#000";
233
235
  elem.value = value;
234
236
  dispatch(elem, 'change');
235
237
  // console.log(value, hex.value, valuergb, valuehsl);
@@ -472,8 +472,13 @@ var src2 = function (search) {
472
472
  } else if (isEmpty(origin)) {
473
473
  temp = "";
474
474
  }
475
- var changes = getChanges(temp, savedValue);
476
- if (!changes || isEmpty(origin) && isEmpty(this.src) && isEmpty(savedValue)) return;
475
+ if (savedValue !== undefined && savedValue !== null) {
476
+ var changes = getChanges(temp, savedValue);
477
+ if (!changes || isEmpty(origin) && isEmpty(this.src) && isEmpty(savedValue)) return;
478
+ }
479
+ else {
480
+ if (isSame(savedValue, temp)) return;
481
+ }
477
482
  savedValue = temp;
478
483
  this.src = origin;
479
484
  cast(this, origin);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.1.9",
3
+ "version": "4.1.11",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {