@aiot-toolkit/parser 2.0.5-widget-provider-beta.2 → 2.0.6-alpha.0

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 (49) hide show
  1. package/README.md +11 -11
  2. package/lib/utils/ParserUtil.js +15 -15
  3. package/lib/ux/config/ExtensionConfig.js +2 -2
  4. package/lib/ux/config/FeatureConfig.js +19 -19
  5. package/lib/ux/config/vela/ElementConfig.js +0 -8
  6. package/lib/ux/config/vela/StyleAttributeConfig.js +134 -88
  7. package/lib/ux/enum/StyleSelectorType.js +6 -6
  8. package/lib/ux/enum/TemplateNodeType.js +2 -2
  9. package/lib/ux/enum/android/StyleSelectorName.js +2 -2
  10. package/lib/ux/interface/IUxAst.d.ts +2 -0
  11. package/lib/ux/parser/ScriptParser.js +2 -2
  12. package/lib/ux/parser/StyleParser.js +79 -72
  13. package/lib/ux/parser/TemplateValueParser.js +49 -49
  14. package/lib/ux/parser/UxParser.js +18 -12
  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 +10 -10
  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 +63 -62
  27. package/lib/ux/translate/vela/plugins/startPage.js +1 -1
  28. package/lib/ux/translate/vela/protobuf/BinaryPlugin.js +172 -172
  29. package/lib/ux/translate/vela/protobuf/protobuf.js +235 -235
  30. package/lib/ux/translate/vela/protobuf/protobufControl.js +159 -159
  31. package/lib/ux/translate/vela/protobuf/vdom_pb.js +2374 -2374
  32. package/lib/ux/translate/vela/runtime/velaTestLibrary.js +104 -104
  33. package/lib/ux/translate/vela/utils/AttributeConfig.js +15 -15
  34. package/lib/ux/translate/vela/utils/ExtendedBoxStyle.js +38 -38
  35. package/lib/ux/translate/vela/utils/SourceMapUtil.d.ts +0 -4
  36. package/lib/ux/translate/vela/utils/SourceMapUtil.js +30 -36
  37. package/lib/ux/translate/vela/utils/TemplateUtil.js +180 -180
  38. package/lib/ux/translate/vela/wrap/CbTranslate.js +8 -8
  39. package/lib/ux/translate/vela/wrap/CfTranslate.js +14 -14
  40. package/lib/ux/translate/vela/wrap/CiTranslate.js +11 -11
  41. package/lib/ux/utils/BabelUtil.js +35 -35
  42. package/lib/ux/utils/ElementConfigUtil.js +24 -24
  43. package/lib/ux/utils/StyleMapUtil.js +15 -15
  44. package/lib/ux/utils/StyleUtil.d.ts +1 -1
  45. package/lib/ux/utils/StyleUtil.js +192 -248
  46. package/lib/ux/utils/UxUtil.js +32 -32
  47. package/lib/ux/validate/ElementValidate.js +2 -2
  48. package/lib/ux/validate/UxFileValidate.js +2 -2
  49. package/package.json +4 -4
@@ -14,82 +14,82 @@ var _StyleSelectorType = require("../enum/StyleSelectorType");
14
14
  var _StyleAttributeConfig = require("../config/vela/StyleAttributeConfig");
15
15
  var _tinycolor = _interopRequireDefault(require("tinycolor2"));
16
16
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
- /**
18
- * StyleUtil
17
+ /**
18
+ * StyleUtil
19
19
  */
20
20
  class StyleUtil {
21
- /**
22
- * 判断节点是否为declaration节点
23
- * @param node
24
- * @returns
21
+ /**
22
+ * 判断节点是否为declaration节点
23
+ * @param node
24
+ * @returns
25
25
  */
26
26
  static isDeclaration(node) {
27
27
  return node.type === 'Declaration';
28
28
  }
29
29
 
30
- /**
31
- * 判断节点是否为Identifier类型
32
- * @param node
33
- * @returns
30
+ /**
31
+ * 判断节点是否为Identifier类型
32
+ * @param node
33
+ * @returns
34
34
  */
35
35
  static isIdentifier(node) {
36
36
  return node.type === 'Identifier';
37
37
  }
38
38
 
39
- /**
40
- * 判断节点是否为SelectorList类型
41
- * @param node
42
- * @returns
39
+ /**
40
+ * 判断节点是否为SelectorList类型
41
+ * @param node
42
+ * @returns
43
43
  */
44
44
  static isSelectorList(node) {
45
45
  return node.type === 'SelectorList';
46
46
  }
47
47
 
48
- /**
49
- * 判断节点是否为AtrulePrelude类型
50
- * @param node
51
- * @returns
48
+ /**
49
+ * 判断节点是否为AtrulePrelude类型
50
+ * @param node
51
+ * @returns
52
52
  */
53
53
  static isAtrulePrelude(node) {
54
54
  return node.type === 'AtrulePrelude';
55
55
  }
56
56
 
57
- /**
58
- * 判断节点是否为MediaFeature类型
59
- * @param node
60
- * @returns
57
+ /**
58
+ * 判断节点是否为MediaFeature类型
59
+ * @param node
60
+ * @returns
61
61
  */
62
62
  static isMediaFeature(node) {
63
63
  return node.type === 'MediaFeature';
64
64
  }
65
- /**
66
- * 判断节点是否为MediaQuery类型
67
- * @param node
68
- * @returns
65
+ /**
66
+ * 判断节点是否为MediaQuery类型
67
+ * @param node
68
+ * @returns
69
69
  */
70
70
  static isMediaQuery(node) {
71
71
  return node.type === 'MediaQuery';
72
72
  }
73
73
 
74
- /**
75
- * 判断节点是否为MediaQueryList类型
76
- * @param node
77
- * @returns
74
+ /**
75
+ * 判断节点是否为MediaQueryList类型
76
+ * @param node
77
+ * @returns
78
78
  */
79
79
  static isMediaQueryList(node) {
80
80
  return node.type === 'MediaQueryList';
81
81
  }
82
82
 
83
- /**
84
- * 生成节点的name
85
- * 1. 节点存在name且存在value时,nodeName = generate(node)生成css代码
86
- * 2. 节点存在name且没有value时,nodeName = node.name
87
- * 3. 节点存在value且没有name时,nodeName = node.value
88
- *
89
- * 例如:#title为存在name且没有value的情况,应返回node.name返回;
90
- * 例如:50% {}时,节点存在value没有name,应返回node.value
91
- * @param node
92
- * @returns
83
+ /**
84
+ * 生成节点的name
85
+ * 1. 节点存在name且存在value时,nodeName = generate(node)生成css代码
86
+ * 2. 节点存在name且没有value时,nodeName = node.name
87
+ * 3. 节点存在value且没有name时,nodeName = node.value
88
+ *
89
+ * 例如:#title为存在name且没有value的情况,应返回node.name返回;
90
+ * 例如:50% {}时,节点存在value没有name,应返回node.value
91
+ * @param node
92
+ * @returns
93
93
  */
94
94
  static generateNodename(node) {
95
95
  let nodeName = '';
@@ -106,13 +106,13 @@ class StyleUtil {
106
106
  }
107
107
  return nodeName;
108
108
  }
109
- /**
110
- * 处理 @media 媒体查询条件
111
- * 1. 循环MediaQueryList节点的子节点(MediaQuery节点)
112
- * 2. 检查每个MediaQuery节点的媒体类型
113
- *
114
- * @param node
115
- * @returns
109
+ /**
110
+ * 处理 @media 媒体查询条件
111
+ * 1. 循环MediaQueryList节点的子节点(MediaQuery节点)
112
+ * 2. 检查每个MediaQuery节点的媒体类型
113
+ *
114
+ * @param node
115
+ * @returns
116
116
  */
117
117
  static parseMediaQueryList(options, node, styleMapUtil) {
118
118
  let resultList = [];
@@ -163,15 +163,15 @@ class StyleUtil {
163
163
  return resultList;
164
164
  }
165
165
 
166
- /**
167
- * 处理css中资源引入
168
- * 1. 判断是否为绝对路径
169
- * 1.1 资源路径为绝对路径时
170
- * 1.2 资源路径为非绝对路径时,拼接路径为一个绝对路径
171
- * 2. 判断由第一步生成的绝对路径是否在指定路径外
172
- * 2.1 资源在指定路径外,复制资源到指定文件夹下,返回修改后的路径
173
- * 2.2 资源在指定路径内,返回相对路径
174
- *
166
+ /**
167
+ * 处理css中资源引入
168
+ * 1. 判断是否为绝对路径
169
+ * 1.1 资源路径为绝对路径时
170
+ * 1.2 资源路径为非绝对路径时,拼接路径为一个绝对路径
171
+ * 2. 判断由第一步生成的绝对路径是否在指定路径外
172
+ * 2.1 资源在指定路径外,复制资源到指定文件夹下,返回修改后的路径
173
+ * 2.2 资源在指定路径内,返回相对路径
174
+ *
175
175
  */
176
176
  static handleDynamicAssets(options, compilerOption, assetsPath, collectImageResource, position) {
177
177
  // 判断url值是否为网址等
@@ -235,14 +235,14 @@ class StyleUtil {
235
235
  }
236
236
  }
237
237
 
238
- /**
239
- * 转换相对路径为 “相对项目源码目录的绝对路径”
240
- *
241
- * 例如:有文件`project/src/page/a.so`,则将 `./a.so` 转换为 `/page/a.so`
242
- * @param reslovePath 路径值, 例如 `require('./a.so'), 则此值为 `./a.so`
243
- * @param options
244
- * @param compilerOption
245
- * @returns
238
+ /**
239
+ * 转换相对路径为 “相对项目源码目录的绝对路径”
240
+ *
241
+ * 例如:有文件`project/src/page/a.so`,则将 `./a.so` 转换为 `/page/a.so`
242
+ * @param reslovePath 路径值, 例如 `require('./a.so'), 则此值为 `./a.so`
243
+ * @param options
244
+ * @param compilerOption
245
+ * @returns
246
246
  */
247
247
  static getRelativePath(reslovePath, options, compilerOption) {
248
248
  const {
@@ -273,11 +273,11 @@ class StyleUtil {
273
273
  return true;
274
274
  }
275
275
 
276
- /**
277
- * 收集解析错误
278
- * @param error
279
- * @param fallbackNode
280
- * @returns
276
+ /**
277
+ * 收集解析错误
278
+ * @param error
279
+ * @param fallbackNode
280
+ * @returns
281
281
  */
282
282
  static collectParserError(error, fallbackNode) {
283
283
  // 检查错误解析是否为需要输出
@@ -293,11 +293,11 @@ class StyleUtil {
293
293
  parserError = {
294
294
  message: name,
295
295
  details: message,
296
- startLine: loc?.start?.startLine || 0,
297
- startCol: loc?.start?.startCol || 0,
296
+ startLine: loc?.start?.line || loc?.start?.startLine || 0,
297
+ startCol: loc?.start?.column || loc?.start?.startCol || 0,
298
298
  startOffset: loc?.start?.offset || 0,
299
- endLine: loc?.start?.startLine || 0,
300
- endCol: loc?.start?.startCol || 0,
299
+ endLine: loc?.end?.line || loc?.start?.startLine || 0,
300
+ endCol: loc?.end?.column || loc?.start?.startCol || 0,
301
301
  endOffset: loc?.end?.offset || 0,
302
302
  source: 'value' in fallbackNode ? fallbackNode.value : ''
303
303
  };
@@ -307,15 +307,13 @@ class StyleUtil {
307
307
  }
308
308
  }
309
309
 
310
- /**
311
- * 收集CSS语法错误
312
- * @param errors
313
- * @param trace 是否需要追溯到上一次sourcemap, default: false
314
- * @returns
310
+ /**
311
+ * 收集CSS语法错误
312
+ * @param errors
313
+ * @param trace 是否需要追溯到上一次sourcemap, default: false
314
+ * @returns
315
315
  */
316
- static collectSyntaxError(errors, instance) {
317
- let trace = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
318
- let startLineOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
316
+ static collectSyntaxError(errors) {
319
317
  let syntaxErrors = [];
320
318
  for (let i = 0; i < errors.length; i++) {
321
319
  const error = errors[i];
@@ -329,99 +327,45 @@ class StyleUtil {
329
327
  continue;
330
328
  }
331
329
  if (loc) {
332
- if (!trace) {
333
- syntaxErrors.push({
334
- message,
335
- details,
336
- startLine: loc?.start?.line || 0,
337
- startCol: (loc?.start?.column || 1) - 1,
338
- startOffset: loc?.start?.offset || 0,
339
- endLine: loc?.start?.line || 0,
340
- endCol: (loc?.start?.column || 1) - 1,
341
- endOffset: loc?.end?.offset || 0,
342
- source: css
343
- });
344
- } else {
345
- const transformedLoc = instance.transfromLocToPosition({
346
- start: {
347
- line: loc.start.line,
348
- column: loc.start.column,
349
- offset: 0
350
- },
351
- end: {
352
- line: loc.start.line,
353
- column: loc.start.column,
354
- offset: 0
355
- },
356
- source: css
357
- });
358
- syntaxErrors.push({
359
- message,
360
- details,
361
- startLine: transformedLoc?.startLine - startLineOffset + 1,
362
- startCol: transformedLoc?.startColumn,
363
- startOffset: transformedLoc?.pos,
364
- endLine: transformedLoc?.endLine - startLineOffset + 1,
365
- endCol: transformedLoc?.endColumn,
366
- endOffset: transformedLoc?.end,
367
- source: css
368
- });
369
- }
330
+ syntaxErrors.push({
331
+ message,
332
+ details,
333
+ startLine: loc?.start?.line || 0,
334
+ startCol: loc?.start?.column || 1,
335
+ startOffset: loc?.start?.offset || 0,
336
+ endLine: loc?.start?.line || 0,
337
+ endCol: loc?.start?.column || 1,
338
+ endOffset: loc?.end?.offset || 0,
339
+ source: css
340
+ });
370
341
  } else {
371
342
  const propertyLength = error?.property?.length || 0;
372
- if (!trace) {
373
- syntaxErrors.push({
374
- message,
375
- details,
376
- startLine: error.line || 0,
377
- startCol: error.column || 0,
378
- startOffset: error.offset || 0,
379
- endLine: error.line || 0,
380
- endCol: (error.column || 0) + propertyLength - 1,
381
- endOffset: (error.offset || 0) + propertyLength - 1,
382
- source: css
383
- });
384
- } else {
385
- const transformedLoc = instance.transfromLocToPosition({
386
- start: {
387
- line: error.line,
388
- column: error.column,
389
- offset: 0
390
- },
391
- end: {
392
- line: error.line,
393
- column: error.column,
394
- offset: 0
395
- },
396
- source: css
397
- });
398
- syntaxErrors.push({
399
- message,
400
- details,
401
- startLine: transformedLoc?.startLine,
402
- startCol: transformedLoc?.startColumn,
403
- startOffset: transformedLoc?.pos,
404
- endLine: transformedLoc?.endLine,
405
- endCol: transformedLoc?.endColumn,
406
- endOffset: transformedLoc?.end,
407
- source: css
408
- });
409
- }
343
+ syntaxErrors.push({
344
+ message,
345
+ details,
346
+ startLine: error.line || 0,
347
+ startCol: error.column || 0,
348
+ startOffset: error.offset || 0,
349
+ endLine: error.line || 0,
350
+ endCol: (error.column || 0) + propertyLength,
351
+ endOffset: (error.offset || 0) + propertyLength,
352
+ source: css
353
+ });
410
354
  continue;
411
355
  }
412
356
  }
413
357
  return syntaxErrors;
414
358
  }
415
359
 
416
- /**
417
- * 相同选择器时融合样式
418
- * 1. 遍历待融合列表,如果元素长度为3,判断选择器列表是否在存储列表中存在
419
- * 2. 存在相同选择器列表时,再判断condition是否一致,都一致表示为相同选择器
420
- * 3. 如果元素长度为2,判断选择器列表是否在存储列表中存在,是则表示为相同选择器
421
- * 4. 如果元素长度为1,则提示样式内容为空,去掉该选择器
422
- * @param compareList 存储融合结果的样式列表
423
- * @param candidateList 待融合的样式列表
424
- * @returns
360
+ /**
361
+ * 相同选择器时融合样式
362
+ * 1. 遍历待融合列表,如果元素长度为3,判断选择器列表是否在存储列表中存在
363
+ * 2. 存在相同选择器列表时,再判断condition是否一致,都一致表示为相同选择器
364
+ * 3. 如果元素长度为2,判断选择器列表是否在存储列表中存在,是则表示为相同选择器
365
+ * 4. 如果元素长度为1,则提示样式内容为空,去掉该选择器
366
+ * @param compareList 存储融合结果的样式列表
367
+ * @param candidateList 待融合的样式列表
368
+ * @returns
425
369
  */
426
370
  static mergeSelectorList(compareList, candidateList) {
427
371
  let resultList = [...compareList];
@@ -481,19 +425,19 @@ class StyleUtil {
481
425
  return resultList;
482
426
  }
483
427
 
484
- /**
485
- * 判断StyleItem类型的节点是否有"condition"属性
486
- * @param conditionNode
487
- * @returns
428
+ /**
429
+ * 判断StyleItem类型的节点是否有"condition"属性
430
+ * @param conditionNode
431
+ * @returns
488
432
  */
489
433
  static isConditionStyleItem(conditionNode) {
490
434
  return 'condition' in conditionNode && typeof conditionNode['condition'] === 'string';
491
435
  }
492
436
 
493
- /**
494
- * 转换百分号
495
- * @param unit
496
- * @returns
437
+ /**
438
+ * 转换百分号
439
+ * @param unit
440
+ * @returns
497
441
  */
498
442
  static translatePercentage(unit) {
499
443
  return unit === 'Percentage' ? '%' : unit;
@@ -502,25 +446,25 @@ class StyleUtil {
502
446
  return obj && 'name' in obj && 'param' in obj;
503
447
  }
504
448
 
505
- /**
506
- * 压缩css属性名
507
- * 1. 取出转换结果中的每一组样式( 选择器 + 样式对象)styleNode
508
- * 一般样式的格式为:
509
- * [
510
- * [[]],
511
- * {}
512
- * ]
513
- * 1.1 @meida的样式不需要压缩 (condition + 选择器 + 样式对象)
514
- * [
515
- * {},
516
- * [[]],
517
- * {}
518
- * ]
519
- * 2. 从styleNode中取出样式对象 AttrObj
520
- * 3. 遍历样式对象,找到属性对应的压缩值
521
- * 4. 替换属性名和属性值
522
- * @param sourceNodes
523
- * @returns
449
+ /**
450
+ * 压缩css属性名
451
+ * 1. 取出转换结果中的每一组样式( 选择器 + 样式对象)styleNode
452
+ * 一般样式的格式为:
453
+ * [
454
+ * [[]],
455
+ * {}
456
+ * ]
457
+ * 1.1 @meida的样式不需要压缩 (condition + 选择器 + 样式对象)
458
+ * [
459
+ * {},
460
+ * [[]],
461
+ * {}
462
+ * ]
463
+ * 2. 从styleNode中取出样式对象 AttrObj
464
+ * 3. 遍历样式对象,找到属性对应的压缩值
465
+ * 4. 替换属性名和属性值
466
+ * @param sourceNodes
467
+ * @returns
524
468
  */
525
469
  static compressStyleAttributeName(sourceNodes) {
526
470
  const cloneNodes = _lodash.default.cloneDeep(sourceNodes);
@@ -545,16 +489,16 @@ class StyleUtil {
545
489
  return cloneNodes;
546
490
  }
547
491
 
548
- /**
549
- * 检查每一个MediaQuery的MediaType
550
- * 1. 判断节点是否为MediaQuery类型,非MediaQuery暂不处理
551
- * 2. 取出节点的所有子节点
552
- * 3. MediaType应该只出现在前两个Identifier节点中
553
- * 3.1 @media screen and...时,screen在第一个Identifier节点上
554
- * 3.2 @media not|only screen and...时,screen在第二个Identifier节点上
555
- * 3.3 @media not {}
556
- * 4. 校验MediaType是否合法
557
- *
492
+ /**
493
+ * 检查每一个MediaQuery的MediaType
494
+ * 1. 判断节点是否为MediaQuery类型,非MediaQuery暂不处理
495
+ * 2. 取出节点的所有子节点
496
+ * 3. MediaType应该只出现在前两个Identifier节点中
497
+ * 3.1 @media screen and...时,screen在第一个Identifier节点上
498
+ * 3.2 @media not|only screen and...时,screen在第二个Identifier节点上
499
+ * 3.3 @media not {}
500
+ * 4. 校验MediaType是否合法
501
+ *
558
502
  */
559
503
  static checkMediaType(options, node, styleMapUil) {
560
504
  const {
@@ -610,18 +554,18 @@ class StyleUtil {
610
554
  }
611
555
  }
612
556
 
613
- /**
614
- * 转换 keyframe 的规则项
615
- *
616
- * @param rule 规则项。 示例
617
- * ```css
618
- * from {
619
- * width: 100px;
620
- * color: red;
621
- * }
622
- * ```
623
- * @param options
624
- * @returns
557
+ /**
558
+ * 转换 keyframe 的规则项
559
+ *
560
+ * @param rule 规则项。 示例
561
+ * ```css
562
+ * from {
563
+ * width: 100px;
564
+ * color: red;
565
+ * }
566
+ * ```
567
+ * @param options
568
+ * @returns
625
569
  */
626
570
  static translateKeyFramesRule(rule, options) {
627
571
  const {
@@ -669,17 +613,17 @@ class StyleUtil {
669
613
  return result;
670
614
  }
671
615
 
672
- /**
673
- * 转换样式块
674
- * @param sourceNodes 样式块. 示例
675
- * ```css
676
- * {
677
- * color: red;
678
- * font-size: 12px
679
- * }
680
- * ```
681
- * @param options
682
- * @returns
616
+ /**
617
+ * 转换样式块
618
+ * @param sourceNodes 样式块. 示例
619
+ * ```css
620
+ * {
621
+ * color: red;
622
+ * font-size: 12px
623
+ * }
624
+ * ```
625
+ * @param options
626
+ * @returns
683
627
  */
684
628
  static translateBlock(sourceNodes, options) {
685
629
  let targetList = {};
@@ -717,15 +661,15 @@ class StyleUtil {
717
661
  return targetList;
718
662
  }
719
663
 
720
- /**
721
- * 转换值节点
722
- *
723
- * 1. ComplexValueType类型
724
- * 2. SimpleValueType类型
725
- * 无论哪种类型,转换后还是数组
726
- *
727
- * @param sourceNode sourceNode为数组,且数组元素只会是一种类型
728
- * @returns
664
+ /**
665
+ * 转换值节点
666
+ *
667
+ * 1. ComplexValueType类型
668
+ * 2. SimpleValueType类型
669
+ * 无论哪种类型,转换后还是数组
670
+ *
671
+ * @param sourceNode sourceNode为数组,且数组元素只会是一种类型
672
+ * @returns
729
673
  */
730
674
  static translateValueNode(sourceNode) {
731
675
  // 1.
@@ -748,12 +692,12 @@ class StyleUtil {
748
692
  }
749
693
  }
750
694
 
751
- /**
752
- * 1. 数字值且无单位,则转换为数字, 示例: opaticy: 1 的"1" -->1
753
- * 2. 颜色值,进行格式化,示例: rgba(1,1,1,.88) --> rgba(1,1,1.0.88)
754
- * 3. 其它,保持原值,但百分比单位转换为%
755
- * @param node
756
- * @returns
695
+ /**
696
+ * 1. 数字值且无单位,则转换为数字, 示例: opaticy: 1 的"1" -->1
697
+ * 2. 颜色值,进行格式化,示例: rgba(1,1,1,.88) --> rgba(1,1,1.0.88)
698
+ * 3. 其它,保持原值,但百分比单位转换为%
699
+ * @param node
700
+ * @returns
757
701
  */
758
702
  static translateNodeValue(node) {
759
703
  const {
@@ -799,13 +743,13 @@ class StyleUtil {
799
743
  }
800
744
  }
801
745
 
802
- /**
803
- * 属性值目前存储在数组中,该函数将数组中的值转换为字符串、数字
804
- * animation-name属性值为 ['GO','Color','scaleX'] --> "GO, Color, scaleX"
805
- * opacity属性值为 [1] --> 数字1
806
- * transform属性值为对象`transform: scale(1) rotate(180deg)` --> `transform: '{"scaleX":1,"scaleY":1,"rotate":"180deg"}'`
807
- * @param value
808
- * @returns
746
+ /**
747
+ * 属性值目前存储在数组中,该函数将数组中的值转换为字符串、数字
748
+ * animation-name属性值为 ['GO','Color','scaleX'] --> "GO, Color, scaleX"
749
+ * opacity属性值为 [1] --> 数字1
750
+ * transform属性值为对象`transform: scale(1) rotate(180deg)` --> `transform: '{"scaleX":1,"scaleY":1,"rotate":"180deg"}'`
751
+ * @param value
752
+ * @returns
809
753
  */
810
754
  static translateToNormalValue(value) {
811
755
  if (typeof value === 'object') {