efront 4.9.2 → 4.9.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.
@@ -1,3 +1,9 @@
1
+ - zh-CN: 这个文件的内容不能在非nodejs环境中运行
2
+ en: The content of this file cannot be run in a non nodejs environment
3
+
4
+ - zh-CN: 这个文件的内容不能在线运行
5
+ en: The content of this file cannot be run online
6
+
1
7
  - zh-CN: 这个文件内的测试代码暂不支持在线查看
2
8
  en: The test code in this file does not currently support online viewing
3
9
 
@@ -320,7 +320,7 @@ function snapSentenceHead(o) {
320
320
  o = p;
321
321
  continue;
322
322
  }
323
- if (o.type === STRAP && /^(in|instanceof|of|as|from)$/.test(o.text)) {
323
+ if (o.type === STRAP && /^(in|instanceof|of|as|from)$/.test(o.text) || o.type === STAMP && !o.unary) {
324
324
  o = p;
325
325
  continue;
326
326
  }
@@ -11,18 +11,18 @@ var codecolor = function (c, encode) {
11
11
  var deep = 0;
12
12
  var used = c.used;
13
13
  var setExpress = function (o, label) {
14
- var text = o.text;
14
+ if (!o.text) return;
15
15
  var keys = o.text.split(".");
16
16
  var next = o.next;
17
17
  if (next && next.type === SCOPED && next.entry === '(') {
18
- keys[keys.length - 1] = `<invoke>${keys[keys.length - 1]}</invoke>`;
18
+ if (!/^\</.test(keys[keys.length - 1])) keys[keys.length - 1] = `<invoke>${keys[keys.length - 1]}</invoke>`;
19
19
  }
20
- var [name0] = text.split(".");
21
20
  var [name] = keys;
22
- if (/^</.test(name0));
23
- else if (/^(arguments|this|super|Infinity|NaN)$/.test(name0)) name = `<strap>${name}</strap>`;
21
+ if (/^[\<\?]/.test(name) || !name);
22
+ else if (c.program?.strap_reg.test(name) || c.program?.value_reg.test(name) || /^(this|arguments)$/.test(name)) name = `<strap>${name}</strap>`;
23
+ else name = `<${label}>${name}</${label}>`;
24
24
  keys[0] = name;
25
- o.text = keys.map(k => /^\</.test(k) || !k ? k : `<${label}>${k}</${label}>`).join(".");
25
+ o.text = keys.map(k => /^\</.test(k) || !k ? k : `<express>${k}</express>`).join(".");
26
26
  }
27
27
  var setPredef = o => setExpress(o, 'predef');
28
28
  var setOutside = o => setExpress(o, 'outside');
@@ -1,6 +1,6 @@
1
1
  function main() {
2
2
  var page = div();
3
- page.innerHTML = SpeechReconigition_test;
3
+ page.innerHTML = SpeechRecognition_test;
4
4
  var rec = new SpeechRecognition;
5
5
  rec.onresult = function (event) {
6
6
  console.log('result', event);
@@ -1,36 +1,36 @@
1
- var change = lazy(async function (src) {
2
- if (src !== this.$src) return;
3
- if (!src) remove(this.with);
4
- else if (isNode(src)) {
5
- if (isElement(src) && this.$struct.copys) {
6
- for (var c of this.$struct.copys) {
7
- if (c.name === 'class') {
8
- addClass(src, c.value);
9
- }
10
- else if (c.name === 'style') {
11
- css(src, c.value);
1
+ function container(element) {
2
+ var change = lazy(async function (src) {
3
+ if (src !== this.$src) return;
4
+ if (!src) remove(this.with);
5
+ else if (isNode(src)) {
6
+ if (isElement(src) && this.$struct.copys) {
7
+ for (var c of this.$struct.copys) {
8
+ if (c.name === 'class') {
9
+ addClass(src, c.value);
10
+ }
11
+ else if (c.name === 'style') {
12
+ css(src, c.value);
13
+ }
14
+ else src.setAttribute(c.name, c.value);
12
15
  }
13
- else src.setAttribute(c.name, c.value);
14
16
  }
17
+ zimoli.global(src, this);
15
18
  }
16
- zimoli.global(src, this);
17
- }
18
- else if (isString(src) || +src < 0) {
19
- watch(this, 'params', onparams);
20
- onparams.call(this, this.params);
21
- }
22
- });
23
- var gosrc = function (src) {
24
- if (!isHandled(this.$src) && !isHandled(src)) return;
25
- if (src !== this.$src) {
26
- this.$src = src;
27
- change.call(this, src);
28
- }
29
- };
30
- var onparams = lazy(function (params) {
31
- zimoli.go(this.$src, params, this);
32
- });
33
- function container(element) {
19
+ else if (isString(src) || +src < 0) {
20
+ watch(this, 'params', onparams);
21
+ onparams.call(this, this.params);
22
+ }
23
+ });
24
+ var gosrc = function (src) {
25
+ if (!isHandled(this.$src) && !isHandled(src)) return;
26
+ if (src !== this.$src) {
27
+ this.$src = src;
28
+ change.call(this, src);
29
+ }
30
+ };
31
+ var onparams = lazy(function (params) {
32
+ zimoli.go(this.$src, params, this);
33
+ });
34
34
  var comment = document.createComment('container');
35
35
  comment.$struct = element.$struct;
36
36
  care(comment, gosrc);
@@ -193,9 +193,10 @@
193
193
  render.refresh();
194
194
  if (tags[1].actived) loadcode();
195
195
  });
196
+ var modName = '';
196
197
  var loadcode = async function () {
197
198
  jschanged = false;
198
- var modName = name.replace(/\.js$/i, '_test');
199
+ modName = name.replace(/\.js$/i, '_test');
199
200
  if (doc.test) {
200
201
  var lessdata = [], htmldata = [];
201
202
  jstext = [];
@@ -374,7 +375,6 @@
374
375
  var getEnspBefore = function (node) {
375
376
  if (!node) return 0;
376
377
  while (node && (node.nodeType !== 1 || !/^br$/i.test(node.tagName))) {
377
- console.log(node)
378
378
  node = node.previousSibling;
379
379
  }
380
380
  if (node) {
@@ -428,6 +428,14 @@
428
428
  data.patchInstance("docscode", { codetext: jstext })
429
429
  var code = compile$scanner2(jstext);
430
430
  var envs = code.envs;
431
+ if (envs.require && !window.require) {
432
+ throw i18n`这个文件的内容不能在非nodejs环境中运行`;
433
+ }
434
+ for (var k in envs) {
435
+ if (/\_test/i.test(k) && k !== modName) {
436
+ if (isProduction) throw i18n`这个文件的内容不能在线运行`;
437
+ }
438
+ }
431
439
  var argNames = Object.keys(envs);
432
440
  var args = await Promise.all(argNames.map(a => init(a + "*" + live, null, { ["init*" + live]: init, ["put*" + live]: put, ["zimoli*" + live]: zimoli, ["appendChild*" + live]: appendChild, ["remove*" + live]: remove, ["render*" + live]: render })));
433
441
  var func = createFunction("", jstext, argNames, code.async, code.yield);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.9.2",
3
+ "version": "4.9.4",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {