@aiot-toolkit/parser 2.0.5-beta.8 → 2.0.5-widget-provider-beta.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.
Files changed (107) hide show
  1. package/README.md +11 -11
  2. package/lib/index.d.ts +1 -4
  3. package/lib/index.js +0 -27
  4. package/lib/utils/ParserUtil.js +15 -15
  5. package/lib/ux/config/ExtensionConfig.js +2 -2
  6. package/lib/ux/config/FeatureConfig.js +19 -19
  7. package/lib/ux/config/vela/StyleAttributeConfig.js +87 -87
  8. package/lib/ux/enum/StyleSelectorType.js +6 -6
  9. package/lib/ux/enum/TemplateNodeType.js +2 -2
  10. package/lib/ux/enum/android/StyleSelectorName.js +2 -2
  11. package/lib/ux/parser/ScriptParser.js +2 -2
  12. package/lib/ux/parser/StyleParser.js +62 -62
  13. package/lib/ux/parser/TemplateValueParser.js +49 -49
  14. package/lib/ux/parser/UxParser.js +11 -11
  15. package/lib/ux/translate/android/StyleToTypescript.js +51 -51
  16. package/lib/ux/translate/android/TemplateToTypescript.js +51 -51
  17. package/lib/ux/translate/android/UxToTypescript.js +14 -14
  18. package/lib/ux/translate/android/attributeTranslate/ForTranslate.js +17 -17
  19. package/lib/ux/translate/android/attributeTranslate/IfTranslate.js +9 -9
  20. package/lib/ux/translate/vela/ScriptToTypescript.js +13 -12
  21. package/lib/ux/translate/vela/StyleToTypescript.js +10 -10
  22. package/lib/ux/translate/vela/TemplateToTypescript.js +74 -74
  23. package/lib/ux/translate/vela/TranslateCache.js +2 -2
  24. package/lib/ux/translate/vela/UxToTypescript.js +6 -6
  25. package/lib/ux/translate/vela/VelaContext.js +2 -2
  26. package/lib/ux/translate/vela/plugins/e2e.js +61 -61
  27. package/lib/ux/translate/vela/protobuf/BinaryPlugin.js +172 -172
  28. package/lib/ux/translate/vela/protobuf/protobuf.js +235 -235
  29. package/lib/ux/translate/vela/protobuf/protobufControl.js +159 -159
  30. package/lib/ux/translate/vela/protobuf/vdom_pb.js +2374 -2374
  31. package/lib/ux/translate/vela/runtime/velaTestLibrary.js +104 -104
  32. package/lib/ux/translate/vela/utils/AttributeConfig.js +15 -15
  33. package/lib/ux/translate/vela/utils/ExtendedBoxStyle.js +38 -38
  34. package/lib/ux/translate/vela/utils/SourceMapUtil.js +30 -30
  35. package/lib/ux/translate/vela/utils/TemplateUtil.d.ts +10 -8
  36. package/lib/ux/translate/vela/utils/TemplateUtil.js +206 -191
  37. package/lib/ux/translate/vela/wrap/CbTranslate.js +8 -8
  38. package/lib/ux/translate/vela/wrap/CfTranslate.js +14 -14
  39. package/lib/ux/translate/vela/wrap/CiTranslate.js +11 -11
  40. package/lib/ux/utils/BabelUtil.js +35 -35
  41. package/lib/ux/utils/ElementConfigUtil.js +24 -24
  42. package/lib/ux/utils/StyleMapUtil.js +26 -16
  43. package/lib/ux/utils/StyleUtil.js +176 -174
  44. package/lib/ux/utils/UxUtil.js +32 -32
  45. package/lib/ux/validate/ElementValidate.js +2 -2
  46. package/lib/ux/validate/UxFileValidate.js +2 -2
  47. package/package.json +6 -6
  48. package/lib/xts/XtsParser.d.ts +0 -20
  49. package/lib/xts/XtsParser.js +0 -86
  50. package/lib/xts/XtsToTypescript.d.ts +0 -69
  51. package/lib/xts/XtsToTypescript.js +0 -894
  52. package/lib/xts/config/CommonAttributeList.d.ts +0 -6
  53. package/lib/xts/config/CommonAttributeList.js +0 -17
  54. package/lib/xts/config/classCount.json +0 -38
  55. package/lib/xts/config/commonAttribute.json +0 -84
  56. package/lib/xts/config/componentList.d.ts +0 -56
  57. package/lib/xts/config/componentList.js +0 -9
  58. package/lib/xts/config/predefinedComponent.json +0 -91
  59. package/lib/xts/config/render.json +0 -31
  60. package/lib/xts/data/ElementType.d.ts +0 -6
  61. package/lib/xts/data/ElementType.js +0 -5
  62. package/lib/xts/data/element/CommentElement.d.ts +0 -16
  63. package/lib/xts/data/element/CommentElement.js +0 -26
  64. package/lib/xts/data/element/ElementBase.d.ts +0 -14
  65. package/lib/xts/data/element/ElementBase.js +0 -20
  66. package/lib/xts/data/element/ForElement.d.ts +0 -58
  67. package/lib/xts/data/element/ForElement.js +0 -81
  68. package/lib/xts/data/element/IfElement.d.ts +0 -55
  69. package/lib/xts/data/element/IfElement.js +0 -87
  70. package/lib/xts/data/element/NodeElement.d.ts +0 -39
  71. package/lib/xts/data/element/NodeElement.js +0 -86
  72. package/lib/xts/enum/AttributeType.d.ts +0 -31
  73. package/lib/xts/enum/AttributeType.js +0 -53
  74. package/lib/xts/enum/Framework.d.ts +0 -98
  75. package/lib/xts/enum/Framework.js +0 -107
  76. package/lib/xts/interface/IContext.d.ts +0 -11
  77. package/lib/xts/interface/IContext.js +0 -1
  78. package/lib/xts/interface/IElement.d.ts +0 -17
  79. package/lib/xts/interface/IElement.js +0 -5
  80. package/lib/xts/interface/IExpressNode.d.ts +0 -20
  81. package/lib/xts/interface/IExpressNode.js +0 -1
  82. package/lib/xts/interface/config/ICommon.d.ts +0 -23
  83. package/lib/xts/interface/config/ICommon.js +0 -5
  84. package/lib/xts/interface/config/IRenderNode.d.ts +0 -25
  85. package/lib/xts/interface/config/IRenderNode.js +0 -1
  86. package/lib/xts/interface/validate/IAttibuteValidate.d.ts +0 -8
  87. package/lib/xts/interface/validate/IAttibuteValidate.js +0 -1
  88. package/lib/xts/interface/validate/IComponentValidate.d.ts +0 -9
  89. package/lib/xts/interface/validate/IComponentValidate.js +0 -1
  90. package/lib/xts/interface/validate/IRenderValidate.d.ts +0 -10
  91. package/lib/xts/interface/validate/IRenderValidate.js +0 -1
  92. package/lib/xts/interface/validate/ISourceFileValidate.d.ts +0 -7
  93. package/lib/xts/interface/validate/ISourceFileValidate.js +0 -1
  94. package/lib/xts/utils/AttributeUtil.d.ts +0 -73
  95. package/lib/xts/utils/AttributeUtil.js +0 -206
  96. package/lib/xts/utils/TypeUtil.d.ts +0 -60
  97. package/lib/xts/utils/TypeUtil.js +0 -97
  98. package/lib/xts/utils/TypescriptUtil.d.ts +0 -42
  99. package/lib/xts/utils/TypescriptUtil.js +0 -128
  100. package/lib/xts/validate/AttibuteValidate.d.ts +0 -18
  101. package/lib/xts/validate/AttibuteValidate.js +0 -97
  102. package/lib/xts/validate/ComponentValidate.d.ts +0 -19
  103. package/lib/xts/validate/ComponentValidate.js +0 -90
  104. package/lib/xts/validate/RenderValidate.d.ts +0 -63
  105. package/lib/xts/validate/RenderValidate.js +0 -239
  106. package/lib/xts/validate/SourceFileValidate.d.ts +0 -10
  107. package/lib/xts/validate/SourceFileValidate.js +0 -43
@@ -25,11 +25,11 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
25
25
  const {
26
26
  validate: CsstreeValidator
27
27
  } = require('csstree-validator');
28
- /**
29
- * StyleParser
30
- * 1. 根据语言类型分别转为CSS样式
31
- * 2. 用CSSTREE解析CSS内容
32
- * 3. 把解析结果转换为目标格式
28
+ /**
29
+ * StyleParser
30
+ * 1. 根据语言类型分别转为CSS样式
31
+ * 2. 用CSSTREE解析CSS内容
32
+ * 3. 把解析结果转换为目标格式
33
33
  */
34
34
  class StyleParser {
35
35
  QUICKAPP_CONFIG = 'quickapp.config.js';
@@ -117,17 +117,17 @@ class StyleParser {
117
117
  };
118
118
  }
119
119
 
120
- /**
121
- * 获取用户配置的 alias
122
- * @returns
120
+ /**
121
+ * 获取用户配置的 alias
122
+ * @returns
123
123
  */
124
124
  getAlias() {
125
125
  return _sharedUtils.CommonUtil.requireModule(_path.default.join(this.options.projectPath, this.QUICKAPP_CONFIG))?.webpack?.resolve?.alias || {};
126
126
  }
127
- /**
128
- * 将Less样式转为CSS
129
- * @param sourceContent
130
- * @returns
127
+ /**
128
+ * 将Less样式转为CSS
129
+ * @param sourceContent
130
+ * @returns
131
131
  */
132
132
  lessToCss(sourceContent) {
133
133
  let CSSCode = '';
@@ -167,10 +167,10 @@ class StyleParser {
167
167
  });
168
168
  });
169
169
  }
170
- /**
171
- * 将Scss样式转为CSS
172
- * @param sourceContent
173
- * @returns
170
+ /**
171
+ * 将Scss样式转为CSS
172
+ * @param sourceContent
173
+ * @returns
174
174
  */
175
175
  async scssToCss(sourceContent, isSass) {
176
176
  const {
@@ -206,11 +206,11 @@ class StyleParser {
206
206
  });
207
207
  }
208
208
  }
209
- /**
210
- * 使用postcss做css样式转换
211
- * 例如:将@import 转换为引入的内容
212
- * @param sourceContent
213
- * @returns
209
+ /**
210
+ * 使用postcss做css样式转换
211
+ * 例如:将@import 转换为引入的内容
212
+ * @param sourceContent
213
+ * @returns
214
214
  */
215
215
  async parserCss(sourceContent) {
216
216
  const {
@@ -263,12 +263,12 @@ class StyleParser {
263
263
  }
264
264
  }
265
265
  }
266
- /**
267
- * 解析CSS语法树的上的节点
268
- * 1. 将节点按照rule节点、Atrule节点、没有prelude属性的Atrule节点区分
269
- * 2. 节点内容将按照定义的IRuleType类型返回
270
- * @param sourceNode
271
- * @returns
266
+ /**
267
+ * 解析CSS语法树的上的节点
268
+ * 1. 将节点按照rule节点、Atrule节点、没有prelude属性的Atrule节点区分
269
+ * 2. 节点内容将按照定义的IRuleType类型返回
270
+ * @param sourceNode
271
+ * @returns
272
272
  */
273
273
  parserNode(sourceNode) {
274
274
  let targetNode = {
@@ -297,10 +297,10 @@ class StyleParser {
297
297
  }
298
298
  return targetNode;
299
299
  }
300
- /**
301
- * 解析rule节点
302
- * @param sourceNode
303
- * @returns 返回预定义的RuleType结构
300
+ /**
301
+ * 解析rule节点
302
+ * @param sourceNode
303
+ * @returns 返回预定义的RuleType结构
304
304
  */
305
305
  paserRuleNode(sourceNode) {
306
306
  const targetNode = {
@@ -319,10 +319,10 @@ class StyleParser {
319
319
  targetNode.block = this.parserBlock(block);
320
320
  return targetNode;
321
321
  }
322
- /**
323
- * 解析一般的Atrule节点
324
- * @param sourceNode
325
- * @returns 返回预定义的AtRuleType结构
322
+ /**
323
+ * 解析一般的Atrule节点
324
+ * @param sourceNode
325
+ * @returns 返回预定义的AtRuleType结构
326
326
  */
327
327
  paserAtRuleNode(sourceNode) {
328
328
  const targetNode = {
@@ -365,11 +365,11 @@ class StyleParser {
365
365
  }
366
366
  return targetNode;
367
367
  }
368
- /**
369
- * 解析没有prelude属性的Atrule节点
370
- * 1. 处理block中的属性和值的内容
371
- * @param sourceNode
372
- * @returns 返回预定义的NoPreludeAtRule结构
368
+ /**
369
+ * 解析没有prelude属性的Atrule节点
370
+ * 1. 处理block中的属性和值的内容
371
+ * @param sourceNode
372
+ * @returns 返回预定义的NoPreludeAtRule结构
373
373
  */
374
374
  parserNoPreludeAtRule(sourceNode) {
375
375
  const targetNode = {
@@ -389,12 +389,12 @@ class StyleParser {
389
389
  targetNode.block = this.parserBlock(block);
390
390
  return targetNode;
391
391
  }
392
- /**
393
- * 解析prelude节点
394
- * 1. SelectorList时,返回选择器列表
395
- * 2. AtrulePrelude时,返回条件字符串列表
396
- * @param nodeList
397
- * @returns
392
+ /**
393
+ * 解析prelude节点
394
+ * 1. SelectorList时,返回选择器列表
395
+ * 2. AtrulePrelude时,返回条件字符串列表
396
+ * @param nodeList
397
+ * @returns
398
398
  */
399
399
  parserPrelude(sourceNode) {
400
400
  let targetList = [];
@@ -434,17 +434,17 @@ class StyleParser {
434
434
  }
435
435
  return targetList;
436
436
  }
437
- /**
438
- * 解析block结构
439
- * 生成属性name和value组成的对象列表
440
- * [
441
- * {
442
- * name: '',
443
- * value: [{value:'', unit:''}, ...]
444
- * }, ...
445
- * ]
446
- * @param sourceNode
447
- * @returns
437
+ /**
438
+ * 解析block结构
439
+ * 生成属性name和value组成的对象列表
440
+ * [
441
+ * {
442
+ * name: '',
443
+ * value: [{value:'', unit:''}, ...]
444
+ * }, ...
445
+ * ]
446
+ * @param sourceNode
447
+ * @returns
448
448
  */
449
449
  parserBlock(sourceNode) {
450
450
  const targetList = [];
@@ -470,11 +470,11 @@ class StyleParser {
470
470
  });
471
471
  return targetList;
472
472
  }
473
- /**
474
- * 解析value属性
475
- * 1. 若value对象有'Children'属性则表示存在值,否则返回空列表
476
- * 2. 循环Children列表,遇到操作符、Url做特殊处理
477
- * 3. 其他子项,需要取出value和unit内容
473
+ /**
474
+ * 解析value属性
475
+ * 1. 若value对象有'Children'属性则表示存在值,否则返回空列表
476
+ * 2. 循环Children列表,遇到操作符、Url做特殊处理
477
+ * 3. 其他子项,需要取出value和unit内容
478
478
  */
479
479
  parserValue(nodeName, node) {
480
480
  const {
@@ -16,55 +16,55 @@ var TemplateValueParseState = /*#__PURE__*/function (TemplateValueParseState) {
16
16
  return TemplateValueParseState;
17
17
  }(TemplateValueParseState || {});
18
18
  class TemplateValueParser {
19
- /**
20
- * 解析模板字符串
21
- *
22
- * 概述:模板字符串包含两种类型--文字类型和代码类型,代码类型被包裹在 {{}}中
23
- * 例如 a{{b}}c,[{value:'a', type:'文字类型'}, {value:'b', type:'代码类型'}, {value:'c', type:'文字类型'}]
24
- *
25
- * @example `new TemplateValueParser().parse('a{{b}}c')`
26
- *
27
- * 解析过程
28
- * 1. 初始
29
- * a. 状态为文字状态
30
- * b. 定义变量`bracketCounter`,记录'{'的数量
31
- * b. 遍历字符串进行解析
32
- * 2. 文字状态
33
- * a. 遇到 { 且下个字符也是 {, 则:
34
- * a1. 如果当前值有值,则添加到结果列表中(文本类型)
35
- * a2. 循环序号+1
36
- * a4. bracketCounter重置为0
37
- * a3. 进入代码状态
38
- * b. 否则,字符添加到当前值中
39
- * 3. 代码状态
40
- * a. 遇到 }
41
- * c1. 如计数为0
42
- * c11. 判断后面的字符是否为}
43
- * c111. 如果是,如果当前值有值,则添加到结果列表中(代码类型)并进入`文字状态`
44
- * c112. 否则,字符添加到当前值
45
- * c2. 否则,计数减1,但最小值为0
46
- * b. 遇到 {
47
- * b1. 如果下一个字符也是{,则报错
48
- * b2. 否则计数+1, 并把字符添加到当前值-因为js代码会有{},例如
49
- * ```
50
- *
51
- * {{()=>{}}}
52
- * 12 3456
53
- *
54
- * // 遇到3时,是{,计数加1
55
- * // 遇到4时,是}, 计数减1, 此时计数为0
56
- * // 遇到5时,是{,计数为0,则判断下一个字符也是}, jscode 状态结束
57
- * ```
58
- * c. 如果是"或', 进入`代码_字符串`状态,同时字符添加到当前值
59
- * d. 否则,字符添加到当前值
60
- * 4. 代码_字符串
61
- * a. 字符添加到当前值中
62
- * c. 如果是"或', 则:退回到`代码状态`
63
- * 5. 遇到最后一个字符
64
- * a. 如果仍处于代码状态,则把`{{ + 当前值`以文字类型添加到结果列表中. 示例:a{{b --> [a, {{b]
65
- * b. 否则,把`当前值`以`文字类型`添加到结果列表中
66
- * 6. 返回结果列表
67
- * @param template
19
+ /**
20
+ * 解析模板字符串
21
+ *
22
+ * 概述:模板字符串包含两种类型--文字类型和代码类型,代码类型被包裹在 {{}}中
23
+ * 例如 a{{b}}c,[{value:'a', type:'文字类型'}, {value:'b', type:'代码类型'}, {value:'c', type:'文字类型'}]
24
+ *
25
+ * @example `new TemplateValueParser().parse('a{{b}}c')`
26
+ *
27
+ * 解析过程
28
+ * 1. 初始
29
+ * a. 状态为文字状态
30
+ * b. 定义变量`bracketCounter`,记录'{'的数量
31
+ * b. 遍历字符串进行解析
32
+ * 2. 文字状态
33
+ * a. 遇到 { 且下个字符也是 {, 则:
34
+ * a1. 如果当前值有值,则添加到结果列表中(文本类型)
35
+ * a2. 循环序号+1
36
+ * a4. bracketCounter重置为0
37
+ * a3. 进入代码状态
38
+ * b. 否则,字符添加到当前值中
39
+ * 3. 代码状态
40
+ * a. 遇到 }
41
+ * c1. 如计数为0
42
+ * c11. 判断后面的字符是否为}
43
+ * c111. 如果是,如果当前值有值,则添加到结果列表中(代码类型)并进入`文字状态`
44
+ * c112. 否则,字符添加到当前值
45
+ * c2. 否则,计数减1,但最小值为0
46
+ * b. 遇到 {
47
+ * b1. 如果下一个字符也是{,则报错
48
+ * b2. 否则计数+1, 并把字符添加到当前值-因为js代码会有{},例如
49
+ * ```
50
+ *
51
+ * {{()=>{}}}
52
+ * 12 3456
53
+ *
54
+ * // 遇到3时,是{,计数加1
55
+ * // 遇到4时,是}, 计数减1, 此时计数为0
56
+ * // 遇到5时,是{,计数为0,则判断下一个字符也是}, jscode 状态结束
57
+ * ```
58
+ * c. 如果是"或', 进入`代码_字符串`状态,同时字符添加到当前值
59
+ * d. 否则,字符添加到当前值
60
+ * 4. 代码_字符串
61
+ * a. 字符添加到当前值中
62
+ * c. 如果是"或', 则:退回到`代码状态`
63
+ * 5. 遇到最后一个字符
64
+ * a. 如果仍处于代码状态,则把`{{ + 当前值`以文字类型添加到结果列表中. 示例:a{{b --> [a, {{b]
65
+ * b. 否则,把`当前值`以`文字类型`添加到结果列表中
66
+ * 6. 返回结果列表
67
+ * @param template
68
68
  */
69
69
  parse(template) {
70
70
  let state = TemplateValueParseState.IN_CHAR;
@@ -14,8 +14,8 @@ var _StyleParser = _interopRequireDefault(require("./StyleParser"));
14
14
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
15
15
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
16
16
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
17
- /**
18
- * UxParser
17
+ /**
18
+ * UxParser
19
19
  */
20
20
  class UxParser {
21
21
  constructor(options, compilerOption, globalVar, collectImageResource) {
@@ -190,11 +190,11 @@ class UxParser {
190
190
  };
191
191
  }
192
192
 
193
- /**
194
- * 验证内容
195
- * 1. template:
196
- * a. 最多1个
197
- * b. 子元素有且仅有1个,不能是 block
193
+ /**
194
+ * 验证内容
195
+ * 1. template:
196
+ * a. 最多1个
197
+ * b. 子元素有且仅有1个,不能是 block
198
198
  */
199
199
  validateContent(childNodes) {
200
200
  let result = true;
@@ -260,10 +260,10 @@ class UxParser {
260
260
 
261
261
  return result;
262
262
  }
263
- /**
264
- * 解析import内容
265
- * @param sourceNode
266
- * @param ast
263
+ /**
264
+ * 解析import内容
265
+ * @param sourceNode
266
+ * @param ast
267
267
  */
268
268
  parserImport(sourceNode, ast) {
269
269
  const {
@@ -9,8 +9,8 @@ var _StyleSelectorType = require("../../enum/StyleSelectorType");
9
9
  var _StyleSelectorName = _interopRequireDefault(require("../../enum/android/StyleSelectorName"));
10
10
  var _StyleUtil = _interopRequireDefault(require("../../utils/StyleUtil"));
11
11
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- /**
13
- * StyleToTypescript
12
+ /**
13
+ * StyleToTypescript
14
14
  */
15
15
  class StyleToTypescript {
16
16
  constructor(options, compilerOption) {
@@ -28,13 +28,13 @@ class StyleToTypescript {
28
28
  };
29
29
  }
30
30
 
31
- /**
32
- * 转换节点列表
33
- *
34
- * 1. 对于任一节点,根据类型做不同的转换
35
- * 2. 转换结果和已有的结果进行合并
36
- * @param nodes
37
- * @returns
31
+ /**
32
+ * 转换节点列表
33
+ *
34
+ * 1. 对于任一节点,根据类型做不同的转换
35
+ * 2. 转换结果和已有的结果进行合并
36
+ * @param nodes
37
+ * @returns
38
38
  */
39
39
  translateNodes(nodes) {
40
40
  const result = {};
@@ -58,14 +58,14 @@ class StyleToTypescript {
58
58
  return result;
59
59
  }
60
60
 
61
- /**
62
- * 合并样式
63
- *
64
- * 1. media: 合并数组
65
- * 2. 其它(fontface, keyframes, 普通样式):合并对象
66
- * @param currentStyle
67
- * @param newStyle
68
- * @returns
61
+ /**
62
+ * 合并样式
63
+ *
64
+ * 1. media: 合并数组
65
+ * 2. 其它(fontface, keyframes, 普通样式):合并对象
66
+ * @param currentStyle
67
+ * @param newStyle
68
+ * @returns
69
69
  */
70
70
  mergeStyle(currentStyle, newStyle) {
71
71
  for (const styleName in newStyle) {
@@ -84,11 +84,11 @@ class StyleToTypescript {
84
84
  }
85
85
  }
86
86
 
87
- /**
88
- * 转换@ 开头的样式
89
- *
90
- * @param node
91
- * @returns
87
+ /**
88
+ * 转换@ 开头的样式
89
+ *
90
+ * @param node
91
+ * @returns
92
92
  */
93
93
  translateAtRule(node) {
94
94
  const {
@@ -107,10 +107,10 @@ class StyleToTypescript {
107
107
  }
108
108
  }
109
109
 
110
- /**
111
- * 转换keyframe
112
- * @param node
113
- * @returns
110
+ /**
111
+ * 转换keyframe
112
+ * @param node
113
+ * @returns
114
114
  */
115
115
  translateKeyFrames(node) {
116
116
  const result = {
@@ -128,14 +128,14 @@ class StyleToTypescript {
128
128
  return result;
129
129
  }
130
130
 
131
- /**
132
- * 转换 @font-face
133
- *
134
- * 1. 以font-family 为key
135
- * 2. 额外生成fontName=fontFamily fontSrc=src
136
- *
137
- * @param node
138
- * @returns
131
+ /**
132
+ * 转换 @font-face
133
+ *
134
+ * 1. 以font-family 为key
135
+ * 2. 额外生成fontName=fontFamily fontSrc=src
136
+ *
137
+ * @param node
138
+ * @returns
139
139
  */
140
140
  translateFontFace(node) {
141
141
  const {
@@ -172,14 +172,14 @@ class StyleToTypescript {
172
172
  };
173
173
  }
174
174
 
175
- /**
176
- * 转换 @media
177
- *
178
- * 1. 以"@MEDIA"为键
179
- * 2. 以条件为 `condition` 的值
180
- * 3. 递归 translateNodes 转换其中的内容
181
- * @param node
182
- * @returns
175
+ /**
176
+ * 转换 @media
177
+ *
178
+ * 1. 以"@MEDIA"为键
179
+ * 2. 以条件为 `condition` 的值
180
+ * 3. 递归 translateNodes 转换其中的内容
181
+ * @param node
182
+ * @returns
183
183
  */
184
184
  translateMedia(node) {
185
185
  const {
@@ -212,15 +212,15 @@ class StyleToTypescript {
212
212
  };
213
213
  }
214
214
 
215
- /**
216
- * 转换常规样式
217
- * ```
218
- * .a .b {
219
- * color: red;
220
- * }
221
- * ```
222
- * @param node
223
- * @returns
215
+ /**
216
+ * 转换常规样式
217
+ * ```
218
+ * .a .b {
219
+ * color: red;
220
+ * }
221
+ * ```
222
+ * @param node
223
+ * @returns
224
224
  */
225
225
  translateRule(node) {
226
226
  const {
@@ -15,8 +15,8 @@ var _AndroidContext = _interopRequireDefault(require("./AndroidContext"));
15
15
  var _ForTranslate = _interopRequireDefault(require("./attributeTranslate/ForTranslate"));
16
16
  var _IfTranslate = _interopRequireDefault(require("./attributeTranslate/IfTranslate"));
17
17
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
- /**
19
- * TemplateToTypescript
18
+ /**
19
+ * TemplateToTypescript
20
20
  */
21
21
  class TemplateToTypescript {
22
22
  _mapList = [];
@@ -47,13 +47,13 @@ class TemplateToTypescript {
47
47
  };
48
48
  }
49
49
 
50
- /**
51
- * 创建节点对象
52
- *
53
- * 1. 创建对象
54
- * 2. 把对象的属性依次加到sourceFile中,并记录位置
55
- * 3.
56
- * @param node
50
+ /**
51
+ * 创建节点对象
52
+ *
53
+ * 1. 创建对象
54
+ * 2. 把对象的属性依次加到sourceFile中,并记录位置
55
+ * 3.
56
+ * @param node
57
57
  */
58
58
  async translateNoe(node) {
59
59
  if (_TemplateUtil.default.isElement(node)) {
@@ -62,36 +62,36 @@ class TemplateToTypescript {
62
62
  }
63
63
  }
64
64
 
65
- /**
66
- * 产物节点添加到代码中,并记录位置映射关系
67
- *
68
- * 1. 循环非 children 的属性,依次添加到产物树,并记录位置映射关系
69
- * 2. 如果 children有值,递归处理 children
70
- *
71
- * 此函数修改 this._target 和 this._mapList
72
- * @param node
65
+ /**
66
+ * 产物节点添加到代码中,并记录位置映射关系
67
+ *
68
+ * 1. 循环非 children 的属性,依次添加到产物树,并记录位置映射关系
69
+ * 2. 如果 children有值,递归处理 children
70
+ *
71
+ * 此函数修改 this._target 和 this._mapList
72
+ * @param node
73
73
  */
74
74
  addTargetNodeToCode(node) {
75
75
  const str = _sharedUtils.StringUtil.objectToString(node);
76
76
  this._target.addStatements(str);
77
77
  }
78
78
 
79
- /**
80
- * 创建节点(此函数生成节点,不修改产物树)
81
- *
82
- * 1. 元素处理
83
- * a. 创建节点
84
- * 2. 普通属性生成: **属性名需要转成驼峰**
85
- * 3. 特殊属性处理
86
- * a. classList、style、events, 单独赋值
87
- * b. dataset 放到attr 中
88
- * c. 如果有 id 属性,id在attr同级也要设置
89
- * d. for if 单独处理
90
- * e. models 属性转换后放到 events , attr 中
91
- *
92
- * 4. 递归子元素生成 children
93
- * @param node 元素节点
94
- * @param existingIdentifiers 已存在的标识符列表
79
+ /**
80
+ * 创建节点(此函数生成节点,不修改产物树)
81
+ *
82
+ * 1. 元素处理
83
+ * a. 创建节点
84
+ * 2. 普通属性生成: **属性名需要转成驼峰**
85
+ * 3. 特殊属性处理
86
+ * a. classList、style、events, 单独赋值
87
+ * b. dataset 放到attr 中
88
+ * c. 如果有 id 属性,id在attr同级也要设置
89
+ * d. for if 单独处理
90
+ * e. models 属性转换后放到 events , attr 中
91
+ *
92
+ * 4. 递归子元素生成 children
93
+ * @param node 元素节点
94
+ * @param existingIdentifiers 已存在的标识符列表
95
95
  */
96
96
  async createTargetNode(node, existingIdentifiers) {
97
97
  const {
@@ -180,16 +180,16 @@ class TemplateToTypescript {
180
180
  return result;
181
181
  }
182
182
 
183
- /**
184
- * 转换 model 数据
185
- * 1. 自定义组件转换为
186
- * events[update:NAME] = function(evt){ VALUE = evt.detail}
187
- * attr[驼峰名称(NAME)] = function(){ return VALUE }
188
- * 2. 普通组件转换为
189
- * events['change'] = function(evt){ VALUE = evt.target.NAME}
190
- * @param node
191
- * @param models
192
- * @returns
183
+ /**
184
+ * 转换 model 数据
185
+ * 1. 自定义组件转换为
186
+ * events[update:NAME] = function(evt){ VALUE = evt.detail}
187
+ * attr[驼峰名称(NAME)] = function(){ return VALUE }
188
+ * 2. 普通组件转换为
189
+ * events['change'] = function(evt){ VALUE = evt.target.NAME}
190
+ * @param node
191
+ * @param models
192
+ * @returns
193
193
  */
194
194
  translateModels(node, models) {
195
195
  const result = {
@@ -219,14 +219,14 @@ class TemplateToTypescript {
219
219
  return result;
220
220
  }
221
221
 
222
- /**
223
- * 预处理属性
224
- * 1. 特定元素和特定属性处理
225
- * a. 特定元素:文本子元素做为 value 属性
226
- * b. 特定元素的特定属性:如果是静态路径,加上 require
227
- * 2. 去除特殊属性
228
- * 3. 事件、逻辑属性强制设置为动态属性
229
- * @param node
222
+ /**
223
+ * 预处理属性
224
+ * 1. 特定元素和特定属性处理
225
+ * a. 特定元素:文本子元素做为 value 属性
226
+ * b. 特定元素的特定属性:如果是静态路径,加上 require
227
+ * 2. 去除特殊属性
228
+ * 3. 事件、逻辑属性强制设置为动态属性
229
+ * @param node
230
230
  */
231
231
  preprocessingProperties(node) {
232
232
  const {
@@ -11,8 +11,8 @@ var _SourceMapUtil = _interopRequireDefault(require("../vela/utils/SourceMapUtil
11
11
  var _StyleToTypescript = _interopRequireDefault(require("./StyleToTypescript"));
12
12
  var _TemplateToTypescript = _interopRequireDefault(require("./TemplateToTypescript"));
13
13
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
14
- /**
15
- * UxToTypescript
14
+ /**
15
+ * UxToTypescript
16
16
  */
17
17
  class UxToTypescript {
18
18
  contenAccess = `\n
@@ -43,18 +43,18 @@ class UxToTypescript {
43
43
  this.compilerOption = compilerOption;
44
44
  this.contxt = contxt;
45
45
  }
46
- /**
47
- *
48
- * 转换过程
49
- * 1. 源树分为 import template script style 4部分
50
- * 2. 转换import: 此步骤使用 import
51
- * 3. 转换template: 此步骤使用 template
52
- * 4. 转换script: 此步骤使用 import script
53
- * 5. 转换style: 此步骤使用 style
54
- * 6. 添加包裹函数
55
- * @param sourceTree
56
- * @param offsetList
57
- * @param param
46
+ /**
47
+ *
48
+ * 转换过程
49
+ * 1. 源树分为 import template script style 4部分
50
+ * 2. 转换import: 此步骤使用 import
51
+ * 3. 转换template: 此步骤使用 template
52
+ * 4. 转换script: 此步骤使用 import script
53
+ * 5. 转换style: 此步骤使用 style
54
+ * 6. 添加包裹函数
55
+ * @param sourceTree
56
+ * @param offsetList
57
+ * @param param
58
58
  */
59
59
  async translate(sourceTree, offsetList) {
60
60
  const sourceFile = _ParserUtil.default.createSourceFile('', _path.default.basename(this.options.filePath));