@aiot-toolkit/parser 2.0.5-beta.9 → 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.
- package/README.md +11 -11
- package/lib/index.d.ts +1 -4
- package/lib/index.js +0 -27
- package/lib/utils/ParserUtil.js +15 -15
- package/lib/ux/config/ExtensionConfig.js +2 -2
- package/lib/ux/config/FeatureConfig.js +19 -19
- package/lib/ux/config/vela/StyleAttributeConfig.js +87 -87
- package/lib/ux/enum/StyleSelectorType.js +6 -6
- package/lib/ux/enum/TemplateNodeType.js +2 -2
- package/lib/ux/enum/android/StyleSelectorName.js +2 -2
- package/lib/ux/parser/ScriptParser.js +2 -2
- package/lib/ux/parser/StyleParser.js +62 -62
- package/lib/ux/parser/TemplateValueParser.js +49 -49
- package/lib/ux/parser/UxParser.js +11 -11
- package/lib/ux/translate/android/StyleToTypescript.js +51 -51
- package/lib/ux/translate/android/TemplateToTypescript.js +51 -51
- package/lib/ux/translate/android/UxToTypescript.js +14 -14
- package/lib/ux/translate/android/attributeTranslate/ForTranslate.js +17 -17
- package/lib/ux/translate/android/attributeTranslate/IfTranslate.js +9 -9
- package/lib/ux/translate/vela/ScriptToTypescript.js +13 -12
- package/lib/ux/translate/vela/StyleToTypescript.js +10 -10
- package/lib/ux/translate/vela/TemplateToTypescript.js +74 -74
- package/lib/ux/translate/vela/TranslateCache.js +2 -2
- package/lib/ux/translate/vela/UxToTypescript.js +6 -6
- package/lib/ux/translate/vela/VelaContext.js +2 -2
- package/lib/ux/translate/vela/plugins/e2e.js +61 -61
- package/lib/ux/translate/vela/protobuf/BinaryPlugin.js +172 -172
- package/lib/ux/translate/vela/protobuf/protobuf.js +235 -235
- package/lib/ux/translate/vela/protobuf/protobufControl.js +159 -159
- package/lib/ux/translate/vela/protobuf/vdom_pb.js +2374 -2374
- package/lib/ux/translate/vela/runtime/velaTestLibrary.js +104 -104
- package/lib/ux/translate/vela/utils/AttributeConfig.js +15 -15
- package/lib/ux/translate/vela/utils/ExtendedBoxStyle.js +38 -38
- package/lib/ux/translate/vela/utils/SourceMapUtil.js +30 -30
- package/lib/ux/translate/vela/utils/TemplateUtil.d.ts +10 -8
- package/lib/ux/translate/vela/utils/TemplateUtil.js +206 -191
- package/lib/ux/translate/vela/wrap/CbTranslate.js +8 -8
- package/lib/ux/translate/vela/wrap/CfTranslate.js +14 -14
- package/lib/ux/translate/vela/wrap/CiTranslate.js +11 -11
- package/lib/ux/utils/BabelUtil.js +35 -35
- package/lib/ux/utils/ElementConfigUtil.js +24 -24
- package/lib/ux/utils/StyleMapUtil.js +26 -16
- package/lib/ux/utils/StyleUtil.js +165 -165
- package/lib/ux/utils/UxUtil.js +32 -32
- package/lib/ux/validate/ElementValidate.js +2 -2
- package/lib/ux/validate/UxFileValidate.js +2 -2
- package/package.json +4 -5
- package/lib/xts/XtsParser.d.ts +0 -20
- package/lib/xts/XtsParser.js +0 -86
- package/lib/xts/XtsToTypescript.d.ts +0 -69
- package/lib/xts/XtsToTypescript.js +0 -894
- package/lib/xts/config/CommonAttributeList.d.ts +0 -6
- package/lib/xts/config/CommonAttributeList.js +0 -17
- package/lib/xts/config/classCount.json +0 -38
- package/lib/xts/config/commonAttribute.json +0 -84
- package/lib/xts/config/componentList.d.ts +0 -56
- package/lib/xts/config/componentList.js +0 -9
- package/lib/xts/config/predefinedComponent.json +0 -91
- package/lib/xts/config/render.json +0 -31
- package/lib/xts/data/ElementType.d.ts +0 -6
- package/lib/xts/data/ElementType.js +0 -5
- package/lib/xts/data/element/CommentElement.d.ts +0 -16
- package/lib/xts/data/element/CommentElement.js +0 -26
- package/lib/xts/data/element/ElementBase.d.ts +0 -14
- package/lib/xts/data/element/ElementBase.js +0 -20
- package/lib/xts/data/element/ForElement.d.ts +0 -58
- package/lib/xts/data/element/ForElement.js +0 -81
- package/lib/xts/data/element/IfElement.d.ts +0 -55
- package/lib/xts/data/element/IfElement.js +0 -87
- package/lib/xts/data/element/NodeElement.d.ts +0 -39
- package/lib/xts/data/element/NodeElement.js +0 -86
- package/lib/xts/enum/AttributeType.d.ts +0 -31
- package/lib/xts/enum/AttributeType.js +0 -53
- package/lib/xts/enum/Framework.d.ts +0 -98
- package/lib/xts/enum/Framework.js +0 -107
- package/lib/xts/interface/IContext.d.ts +0 -11
- package/lib/xts/interface/IContext.js +0 -1
- package/lib/xts/interface/IElement.d.ts +0 -17
- package/lib/xts/interface/IElement.js +0 -5
- package/lib/xts/interface/IExpressNode.d.ts +0 -20
- package/lib/xts/interface/IExpressNode.js +0 -1
- package/lib/xts/interface/config/ICommon.d.ts +0 -23
- package/lib/xts/interface/config/ICommon.js +0 -5
- package/lib/xts/interface/config/IRenderNode.d.ts +0 -25
- package/lib/xts/interface/config/IRenderNode.js +0 -1
- package/lib/xts/interface/validate/IAttibuteValidate.d.ts +0 -8
- package/lib/xts/interface/validate/IAttibuteValidate.js +0 -1
- package/lib/xts/interface/validate/IComponentValidate.d.ts +0 -9
- package/lib/xts/interface/validate/IComponentValidate.js +0 -1
- package/lib/xts/interface/validate/IRenderValidate.d.ts +0 -10
- package/lib/xts/interface/validate/IRenderValidate.js +0 -1
- package/lib/xts/interface/validate/ISourceFileValidate.d.ts +0 -7
- package/lib/xts/interface/validate/ISourceFileValidate.js +0 -1
- package/lib/xts/utils/AttributeUtil.d.ts +0 -73
- package/lib/xts/utils/AttributeUtil.js +0 -206
- package/lib/xts/utils/TypeUtil.d.ts +0 -60
- package/lib/xts/utils/TypeUtil.js +0 -97
- package/lib/xts/utils/TypescriptUtil.d.ts +0 -42
- package/lib/xts/utils/TypescriptUtil.js +0 -128
- package/lib/xts/validate/AttibuteValidate.d.ts +0 -18
- package/lib/xts/validate/AttibuteValidate.js +0 -97
- package/lib/xts/validate/ComponentValidate.d.ts +0 -19
- package/lib/xts/validate/ComponentValidate.js +0 -90
- package/lib/xts/validate/RenderValidate.d.ts +0 -63
- package/lib/xts/validate/RenderValidate.js +0 -239
- package/lib/xts/validate/SourceFileValidate.d.ts +0 -10
- package/lib/xts/validate/SourceFileValidate.js +0 -43
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
# `parser`
|
|
2
|
-
|
|
3
|
-
> TODO: description
|
|
4
|
-
|
|
5
|
-
## Usage
|
|
6
|
-
|
|
7
|
-
```
|
|
8
|
-
const parser = require('parser');
|
|
9
|
-
|
|
10
|
-
// TODO: DEMONSTRATE API
|
|
11
|
-
```
|
|
1
|
+
# `parser`
|
|
2
|
+
|
|
3
|
+
> TODO: description
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
const parser = require('parser');
|
|
9
|
+
|
|
10
|
+
// TODO: DEMONSTRATE API
|
|
11
|
+
```
|
package/lib/index.d.ts
CHANGED
|
@@ -10,7 +10,4 @@ import ScriptToTypescript from './ux/translate/vela/ScriptToTypescript';
|
|
|
10
10
|
import TemplateToTypescript from './ux/translate/vela/TemplateToTypescript';
|
|
11
11
|
import TranslateCache from './ux/translate/vela/TranslateCache';
|
|
12
12
|
import SourceMapUtil from './ux/translate/vela/utils/SourceMapUtil';
|
|
13
|
-
|
|
14
|
-
import XtsToTypescript from './xts/XtsToTypescript';
|
|
15
|
-
import { HomeState, tsFrameWork } from './xts/enum/Framework';
|
|
16
|
-
export { ExtensionConfig, HomeState, ScriptParser, SourceMapUtil, TranslateCache, XtsParser, XtsToTypescript, tsFrameWork, ScriptToTypescript, IOptions, UxParser, IStyleNode, IImageFunction, TemplateToTypescript, TemplateValueParser, StyleParser };
|
|
13
|
+
export { ExtensionConfig, ScriptParser, SourceMapUtil, TranslateCache, ScriptToTypescript, IOptions, UxParser, IStyleNode, IImageFunction, TemplateToTypescript, TemplateValueParser, StyleParser };
|
package/lib/index.js
CHANGED
|
@@ -9,12 +9,6 @@ Object.defineProperty(exports, "ExtensionConfig", {
|
|
|
9
9
|
return _ExtensionConfig.default;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
-
Object.defineProperty(exports, "HomeState", {
|
|
13
|
-
enumerable: true,
|
|
14
|
-
get: function () {
|
|
15
|
-
return _Framework.HomeState;
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
12
|
Object.defineProperty(exports, "IImageFunction", {
|
|
19
13
|
enumerable: true,
|
|
20
14
|
get: function () {
|
|
@@ -81,24 +75,6 @@ Object.defineProperty(exports, "UxParser", {
|
|
|
81
75
|
return _UxParser.default;
|
|
82
76
|
}
|
|
83
77
|
});
|
|
84
|
-
Object.defineProperty(exports, "XtsParser", {
|
|
85
|
-
enumerable: true,
|
|
86
|
-
get: function () {
|
|
87
|
-
return _XtsParser.default;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
Object.defineProperty(exports, "XtsToTypescript", {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function () {
|
|
93
|
-
return _XtsToTypescript.default;
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
Object.defineProperty(exports, "tsFrameWork", {
|
|
97
|
-
enumerable: true,
|
|
98
|
-
get: function () {
|
|
99
|
-
return _Framework.tsFrameWork;
|
|
100
|
-
}
|
|
101
|
-
});
|
|
102
78
|
var _ExtensionConfig = _interopRequireDefault(require("./ux/config/ExtensionConfig"));
|
|
103
79
|
var _IOptions = _interopRequireDefault(require("./ux/config/IOptions"));
|
|
104
80
|
var _IImageResource = require("./ux/interface/IImageResource");
|
|
@@ -111,7 +87,4 @@ var _ScriptToTypescript = _interopRequireDefault(require("./ux/translate/vela/Sc
|
|
|
111
87
|
var _TemplateToTypescript = _interopRequireDefault(require("./ux/translate/vela/TemplateToTypescript"));
|
|
112
88
|
var _TranslateCache = _interopRequireDefault(require("./ux/translate/vela/TranslateCache"));
|
|
113
89
|
var _SourceMapUtil = _interopRequireDefault(require("./ux/translate/vela/utils/SourceMapUtil"));
|
|
114
|
-
var _XtsParser = _interopRequireDefault(require("./xts/XtsParser"));
|
|
115
|
-
var _XtsToTypescript = _interopRequireDefault(require("./xts/XtsToTypescript"));
|
|
116
|
-
var _Framework = require("./xts/enum/Framework");
|
|
117
90
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
package/lib/utils/ParserUtil.js
CHANGED
|
@@ -5,15 +5,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _tsMorph = require("ts-morph");
|
|
8
|
-
/**
|
|
9
|
-
* ParserUtil
|
|
8
|
+
/**
|
|
9
|
+
* ParserUtil
|
|
10
10
|
*/
|
|
11
11
|
class ParserUtil {
|
|
12
|
-
/**
|
|
13
|
-
* 根据偏移列表,查找 pos 对应的偏移量
|
|
14
|
-
* @param pos
|
|
15
|
-
* @param offsetList
|
|
16
|
-
* @returns
|
|
12
|
+
/**
|
|
13
|
+
* 根据偏移列表,查找 pos 对应的偏移量
|
|
14
|
+
* @param pos
|
|
15
|
+
* @param offsetList
|
|
16
|
+
* @returns
|
|
17
17
|
*/
|
|
18
18
|
static getOffsetPos(pos, offsetList) {
|
|
19
19
|
if (!offsetList.length) {
|
|
@@ -26,14 +26,14 @@ class ParserUtil {
|
|
|
26
26
|
return item ? item.offset : 0;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/**
|
|
30
|
-
* 获取指定位置的列偏移量
|
|
31
|
-
*
|
|
32
|
-
* 偏移量= 从offsetList 中获取 (在同一行 且 位置小于 position ) 的项,偏移量进行累加。
|
|
33
|
-
*
|
|
34
|
-
* 确保同一行有多个偏移项也可获取正确的偏移量
|
|
35
|
-
* @param position
|
|
36
|
-
* @param offsetList
|
|
29
|
+
/**
|
|
30
|
+
* 获取指定位置的列偏移量
|
|
31
|
+
*
|
|
32
|
+
* 偏移量= 从offsetList 中获取 (在同一行 且 位置小于 position ) 的项,偏移量进行累加。
|
|
33
|
+
*
|
|
34
|
+
* 确保同一行有多个偏移项也可获取正确的偏移量
|
|
35
|
+
* @param position
|
|
36
|
+
* @param offsetList
|
|
37
37
|
*/
|
|
38
38
|
static getOffsetColumn(position, offsetList) {
|
|
39
39
|
if (!offsetList?.length) {
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* FeatureConfig
|
|
7
|
+
/**
|
|
8
|
+
* FeatureConfig
|
|
9
9
|
*/
|
|
10
|
-
/**
|
|
11
|
-
* FeatureConfig
|
|
10
|
+
/**
|
|
11
|
+
* FeatureConfig
|
|
12
12
|
*/
|
|
13
13
|
class FeatureConfig {
|
|
14
14
|
SYSTEM = 'system';
|
|
@@ -18,14 +18,14 @@ class FeatureConfig {
|
|
|
18
18
|
SYSTEM_FEATURE = ['app', 'model', 'router', 'configuration', 'alarm', 'audio', 'barcode', 'bluetooth', 'brightness', 'calendar', 'cipher', 'clipboard', 'contact', 'device', 'fetch', 'file', 'geolocation', 'image', 'keyguard', 'media', 'network', 'notification', 'package', 'prompt', 'record', 'request', 'resident', 'sensor', 'share', 'shortcut', 'sms', 'storage', 'vibrator', 'volume', 'websocketfactory', 'webview', 'battery', 'wifi', 'mediaquery', 'zip', 'telecom', 'decode', 'uploadtask', 'downloadtask', 'interconnect', 'crypto', 'exchange', 'internal.message', 'microphone', 'internal.ota', 'internal.power', 'internal.settings', 'internal.micamera', 'serviceUtil', 'event'].map(item => `${this.SYSTEM}.${item}`);
|
|
19
19
|
SERVICE_FEATURE = ['account', 'alipay', 'ad', 'wxaccount', 'qqaccount', 'wbaccount', 'exchange', 'health', 'pay', 'push', 'qqaccount', 'share', 'stats', 'wbaccount', 'wxaccount', 'wxpay', 'biometriverify', 'texttoaudio', 'wechat', 'internal.audiosync', 'internal.audiofocus', 'internal.alarm', 'mihome', 'bootstrap', 'miai'].map(item => `${this.SERVICE}.${item}`);
|
|
20
20
|
|
|
21
|
-
/**
|
|
22
|
-
* 是否为系统模块
|
|
23
|
-
*
|
|
24
|
-
* 以特定名称开头的为系统模块
|
|
25
|
-
*
|
|
26
|
-
* @example isSystemModule("@system.route")
|
|
27
|
-
* @param modulePath
|
|
28
|
-
* @returns
|
|
21
|
+
/**
|
|
22
|
+
* 是否为系统模块
|
|
23
|
+
*
|
|
24
|
+
* 以特定名称开头的为系统模块
|
|
25
|
+
*
|
|
26
|
+
* @example isSystemModule("@system.route")
|
|
27
|
+
* @param modulePath
|
|
28
|
+
* @returns
|
|
29
29
|
*/
|
|
30
30
|
isSystemModule(modulePath) {
|
|
31
31
|
if (!modulePath) {
|
|
@@ -35,13 +35,13 @@ class FeatureConfig {
|
|
|
35
35
|
return name.findIndex(item => modulePath.startsWith(`@${item}`)) >= 0;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
/**
|
|
39
|
-
* 是否为有效的系统模块
|
|
40
|
-
*
|
|
41
|
-
* 有效系统模块指:显式配置的模块
|
|
42
|
-
*
|
|
43
|
-
* @param modulePath
|
|
44
|
-
* @returns
|
|
38
|
+
/**
|
|
39
|
+
* 是否为有效的系统模块
|
|
40
|
+
*
|
|
41
|
+
* 有效系统模块指:显式配置的模块
|
|
42
|
+
*
|
|
43
|
+
* @param modulePath
|
|
44
|
+
* @returns
|
|
45
45
|
*/
|
|
46
46
|
isEffectSystemModule(modulePath) {
|
|
47
47
|
if (!modulePath) {
|
|
@@ -343,10 +343,10 @@ const STYLE_ATTRIBUTE_CONFIG = exports.STYLE_ATTRIBUTE_CONFIG = {
|
|
|
343
343
|
},
|
|
344
344
|
background: {
|
|
345
345
|
// csstree-validator可校验,但与1.0校验原理不同,目前按照1.0逻辑进行校验
|
|
346
|
-
/**
|
|
347
|
-
* 验证属性值每个参数的格式
|
|
348
|
-
* @param sourceNode
|
|
349
|
-
* @returns
|
|
346
|
+
/**
|
|
347
|
+
* 验证属性值每个参数的格式
|
|
348
|
+
* @param sourceNode
|
|
349
|
+
* @returns
|
|
350
350
|
*/
|
|
351
351
|
validate: sourceNode => {
|
|
352
352
|
let validateInfo = {
|
|
@@ -357,11 +357,11 @@ const STYLE_ATTRIBUTE_CONFIG = exports.STYLE_ATTRIBUTE_CONFIG = {
|
|
|
357
357
|
value,
|
|
358
358
|
name: attributeName
|
|
359
359
|
} = sourceNode;
|
|
360
|
-
/**
|
|
361
|
-
* 创建线性渐变背景的函数
|
|
362
|
-
* 参数分为两类:direction渐变的方向、color-stop渐变颜色的位置
|
|
363
|
-
* @param valueStr
|
|
364
|
-
* @returns
|
|
360
|
+
/**
|
|
361
|
+
* 创建线性渐变背景的函数
|
|
362
|
+
* 参数分为两类:direction渐变的方向、color-stop渐变颜色的位置
|
|
363
|
+
* @param valueStr
|
|
364
|
+
* @returns
|
|
365
365
|
*/
|
|
366
366
|
const validLinearGradient = sourceNode => {
|
|
367
367
|
let validInfo = {
|
|
@@ -502,23 +502,23 @@ const STYLE_ATTRIBUTE_CONFIG = exports.STYLE_ATTRIBUTE_CONFIG = {
|
|
|
502
502
|
}
|
|
503
503
|
return validInfo;
|
|
504
504
|
};
|
|
505
|
-
/**
|
|
506
|
-
* 创建径向渐变背景的函数
|
|
507
|
-
* 参数分为四类:
|
|
508
|
-
* 1. sharp 圆的类型,可选参数
|
|
509
|
-
* 1.1 ellipse
|
|
510
|
-
* 1.2 circle
|
|
511
|
-
* 2. size 渐变尺寸,可选参数
|
|
512
|
-
* 2.1 [farthest-corner、closest-side、closest-corner、farthest-side]
|
|
513
|
-
* 2.2 50% 60px
|
|
514
|
-
* 2.3 30%
|
|
515
|
-
* 3. position 渐变位置,可选参数
|
|
516
|
-
* 3.1 at [center、top、left、right、bottom]
|
|
517
|
-
* 3.2 at 30% 20%
|
|
518
|
-
* 3.3 at center top
|
|
519
|
-
* 4. color 渐变颜色
|
|
520
|
-
* @param sourceNode
|
|
521
|
-
* @returns
|
|
505
|
+
/**
|
|
506
|
+
* 创建径向渐变背景的函数
|
|
507
|
+
* 参数分为四类:
|
|
508
|
+
* 1. sharp 圆的类型,可选参数
|
|
509
|
+
* 1.1 ellipse
|
|
510
|
+
* 1.2 circle
|
|
511
|
+
* 2. size 渐变尺寸,可选参数
|
|
512
|
+
* 2.1 [farthest-corner、closest-side、closest-corner、farthest-side]
|
|
513
|
+
* 2.2 50% 60px
|
|
514
|
+
* 2.3 30%
|
|
515
|
+
* 3. position 渐变位置,可选参数
|
|
516
|
+
* 3.1 at [center、top、left、right、bottom]
|
|
517
|
+
* 3.2 at 30% 20%
|
|
518
|
+
* 3.3 at center top
|
|
519
|
+
* 4. color 渐变颜色
|
|
520
|
+
* @param sourceNode
|
|
521
|
+
* @returns
|
|
522
522
|
*/
|
|
523
523
|
const validRadialGradient = sourceNode => {
|
|
524
524
|
let validInfo = {
|
|
@@ -837,17 +837,17 @@ const STYLE_ATTRIBUTE_CONFIG = exports.STYLE_ATTRIBUTE_CONFIG = {
|
|
|
837
837
|
// 转换扩展,待实现translate
|
|
838
838
|
},
|
|
839
839
|
display: {
|
|
840
|
-
/**
|
|
841
|
-
* sourceNode 示例:
|
|
842
|
-
* {
|
|
843
|
-
* name: 'display',
|
|
844
|
-
* value: [{
|
|
845
|
-
* unit: '',
|
|
846
|
-
* value: 'flex'
|
|
847
|
-
* }]
|
|
848
|
-
* }
|
|
849
|
-
* @param sourceNode
|
|
850
|
-
* @returns
|
|
840
|
+
/**
|
|
841
|
+
* sourceNode 示例:
|
|
842
|
+
* {
|
|
843
|
+
* name: 'display',
|
|
844
|
+
* value: [{
|
|
845
|
+
* unit: '',
|
|
846
|
+
* value: 'flex'
|
|
847
|
+
* }]
|
|
848
|
+
* }
|
|
849
|
+
* @param sourceNode
|
|
850
|
+
* @returns
|
|
851
851
|
*/
|
|
852
852
|
validate: function (sourceNode) {
|
|
853
853
|
const supportValues = ['flex', 'none'];
|
|
@@ -1320,10 +1320,10 @@ const STYLE_ATTRIBUTE_CONFIG = exports.STYLE_ATTRIBUTE_CONFIG = {
|
|
|
1320
1320
|
// 按照一般转换即可,无需额外转换
|
|
1321
1321
|
}
|
|
1322
1322
|
};
|
|
1323
|
-
/**
|
|
1324
|
-
* 校验节点的长度值
|
|
1325
|
-
* @param sourceNode
|
|
1326
|
-
* @returns
|
|
1323
|
+
/**
|
|
1324
|
+
* 校验节点的长度值
|
|
1325
|
+
* @param sourceNode
|
|
1326
|
+
* @returns
|
|
1327
1327
|
*/
|
|
1328
1328
|
function validateLengthNode(sourceNode) {
|
|
1329
1329
|
const {
|
|
@@ -1349,10 +1349,10 @@ function validateLengthNode(sourceNode) {
|
|
|
1349
1349
|
}
|
|
1350
1350
|
return validateInfo;
|
|
1351
1351
|
}
|
|
1352
|
-
/**
|
|
1353
|
-
* 使用css-tree的语法解析来做校验
|
|
1354
|
-
* @param value
|
|
1355
|
-
* @returns
|
|
1352
|
+
/**
|
|
1353
|
+
* 使用css-tree的语法解析来做校验
|
|
1354
|
+
* @param value
|
|
1355
|
+
* @returns
|
|
1356
1356
|
*/
|
|
1357
1357
|
function validLength(value) {
|
|
1358
1358
|
let validateInfo = {
|
|
@@ -1368,8 +1368,8 @@ function validLength(value) {
|
|
|
1368
1368
|
}
|
|
1369
1369
|
return validateInfo;
|
|
1370
1370
|
}
|
|
1371
|
-
/**
|
|
1372
|
-
* 校验枚举值
|
|
1371
|
+
/**
|
|
1372
|
+
* 校验枚举值
|
|
1373
1373
|
*/
|
|
1374
1374
|
function enumValidate(enumList, sourceNode) {
|
|
1375
1375
|
const {
|
|
@@ -1399,8 +1399,8 @@ function enumValidate(enumList, sourceNode) {
|
|
|
1399
1399
|
}
|
|
1400
1400
|
return validateInfo;
|
|
1401
1401
|
}
|
|
1402
|
-
/**
|
|
1403
|
-
* 校验ValueType[]数组中的仅有一个值,且结构为SimpleValueType
|
|
1402
|
+
/**
|
|
1403
|
+
* 校验ValueType[]数组中的仅有一个值,且结构为SimpleValueType
|
|
1404
1404
|
*/
|
|
1405
1405
|
function validSimpleValue(sourceNode) {
|
|
1406
1406
|
const {
|
|
@@ -1428,9 +1428,9 @@ function validSimpleValue(sourceNode) {
|
|
|
1428
1428
|
}
|
|
1429
1429
|
return validateInfo;
|
|
1430
1430
|
}
|
|
1431
|
-
/**
|
|
1432
|
-
* 颜色值校验, 支持 rgb, rgba, hsl, hsla, #fff, #fffa, #ffffff, #ffffffaa, named-color
|
|
1433
|
-
* @param value
|
|
1431
|
+
/**
|
|
1432
|
+
* 颜色值校验, 支持 rgb, rgba, hsl, hsla, #fff, #fffa, #ffffff, #ffffffaa, named-color
|
|
1433
|
+
* @param value
|
|
1434
1434
|
*/
|
|
1435
1435
|
function validColorNode(sourceNode) {
|
|
1436
1436
|
const {
|
|
@@ -1457,10 +1457,10 @@ function validColorNode(sourceNode) {
|
|
|
1457
1457
|
return validateInfo;
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
1460
|
-
/**
|
|
1461
|
-
* 使用css-tree的语法解析来做校验
|
|
1462
|
-
* @param value
|
|
1463
|
-
* @returns
|
|
1460
|
+
/**
|
|
1461
|
+
* 使用css-tree的语法解析来做校验
|
|
1462
|
+
* @param value
|
|
1463
|
+
* @returns
|
|
1464
1464
|
*/
|
|
1465
1465
|
function validColor(value) {
|
|
1466
1466
|
let validateInfo = {
|
|
@@ -1474,10 +1474,10 @@ function validColor(value) {
|
|
|
1474
1474
|
}
|
|
1475
1475
|
return validateInfo;
|
|
1476
1476
|
}
|
|
1477
|
-
/**
|
|
1478
|
-
* 校验值符合REGEXP_NAME正则表达式
|
|
1479
|
-
* @param sourceNode
|
|
1480
|
-
* @returns
|
|
1477
|
+
/**
|
|
1478
|
+
* 校验值符合REGEXP_NAME正则表达式
|
|
1479
|
+
* @param sourceNode
|
|
1480
|
+
* @returns
|
|
1481
1481
|
*/
|
|
1482
1482
|
function validName(sourceNode) {
|
|
1483
1483
|
const {
|
|
@@ -1504,12 +1504,12 @@ function validName(sourceNode) {
|
|
|
1504
1504
|
}
|
|
1505
1505
|
return validateInfo;
|
|
1506
1506
|
}
|
|
1507
|
-
/**
|
|
1508
|
-
* 校验位置
|
|
1509
|
-
* 1. 位置值长度最多为3
|
|
1510
|
-
* 2. 每一个(旧版本中要求值类型必须为长度值)
|
|
1511
|
-
* @param sourceNode
|
|
1512
|
-
* @returns
|
|
1507
|
+
/**
|
|
1508
|
+
* 校验位置
|
|
1509
|
+
* 1. 位置值长度最多为3
|
|
1510
|
+
* 2. 每一个(旧版本中要求值类型必须为长度值)
|
|
1511
|
+
* @param sourceNode
|
|
1512
|
+
* @returns
|
|
1513
1513
|
*/
|
|
1514
1514
|
function validPosition(sourceNode) {
|
|
1515
1515
|
let validateInfo = {
|
|
@@ -1548,16 +1548,16 @@ function validPosition(sourceNode) {
|
|
|
1548
1548
|
}
|
|
1549
1549
|
return validateInfo;
|
|
1550
1550
|
}
|
|
1551
|
-
/**
|
|
1552
|
-
* 校验mylocation属性
|
|
1553
|
-
* 1. 属性值最多有三个
|
|
1554
|
-
* 2. 扩展值
|
|
1555
|
-
* 2.1 第一次出现的颜色为mylocationFillColor属性值
|
|
1556
|
-
* 2.2 第二次出现的颜色为mylocationStrokeColor属性值
|
|
1557
|
-
* 2.3 url值为mylocationIconPath属性值
|
|
1558
|
-
*
|
|
1559
|
-
* @param sourceNode
|
|
1560
|
-
* @returns
|
|
1551
|
+
/**
|
|
1552
|
+
* 校验mylocation属性
|
|
1553
|
+
* 1. 属性值最多有三个
|
|
1554
|
+
* 2. 扩展值
|
|
1555
|
+
* 2.1 第一次出现的颜色为mylocationFillColor属性值
|
|
1556
|
+
* 2.2 第二次出现的颜色为mylocationStrokeColor属性值
|
|
1557
|
+
* 2.3 url值为mylocationIconPath属性值
|
|
1558
|
+
*
|
|
1559
|
+
* @param sourceNode
|
|
1560
|
+
* @returns
|
|
1561
1561
|
*/
|
|
1562
1562
|
function validMyLocation(sourceNode) {
|
|
1563
1563
|
let validateInfo = {
|
|
@@ -1602,13 +1602,13 @@ function validMyLocation(sourceNode) {
|
|
|
1602
1602
|
}
|
|
1603
1603
|
return validateInfo;
|
|
1604
1604
|
}
|
|
1605
|
-
/**
|
|
1606
|
-
* 校验url值,由于parser时已转换了url值,所以校验步骤修改如下:
|
|
1607
|
-
* 1. 是否绝对路径
|
|
1608
|
-
* 2. 是否为网络值
|
|
1609
|
-
* 3. 是否为none
|
|
1610
|
-
* @param sourceNode
|
|
1611
|
-
* @returns
|
|
1605
|
+
/**
|
|
1606
|
+
* 校验url值,由于parser时已转换了url值,所以校验步骤修改如下:
|
|
1607
|
+
* 1. 是否绝对路径
|
|
1608
|
+
* 2. 是否为网络值
|
|
1609
|
+
* 3. 是否为none
|
|
1610
|
+
* @param sourceNode
|
|
1611
|
+
* @returns
|
|
1612
1612
|
*/
|
|
1613
1613
|
function validUrl(sourceNode) {
|
|
1614
1614
|
let validateInfo = {
|
|
@@ -1636,10 +1636,10 @@ function validUrl(sourceNode) {
|
|
|
1636
1636
|
}
|
|
1637
1637
|
return validateInfo;
|
|
1638
1638
|
}
|
|
1639
|
-
/**
|
|
1640
|
-
* 校验单位
|
|
1641
|
-
* @param sourceNode
|
|
1642
|
-
* @returns
|
|
1639
|
+
/**
|
|
1640
|
+
* 校验单位
|
|
1641
|
+
* @param sourceNode
|
|
1642
|
+
* @returns
|
|
1643
1643
|
*/
|
|
1644
1644
|
function validAngleNode(sourceNode) {
|
|
1645
1645
|
let validateInfo = {
|
|
@@ -58,12 +58,12 @@ function findSelectorIndex(type) {
|
|
|
58
58
|
function isMeidaType(type) {
|
|
59
59
|
return Object.values(MediaType).includes(type);
|
|
60
60
|
}
|
|
61
|
-
/**
|
|
62
|
-
* 安卓快应用支持所有的媒体类型,只需要判断媒体类型是否合法
|
|
63
|
-
* vela快应用仅支持 MediaType.SCREEN
|
|
64
|
-
* @param type
|
|
65
|
-
* @param projectType
|
|
66
|
-
* @returns
|
|
61
|
+
/**
|
|
62
|
+
* 安卓快应用支持所有的媒体类型,只需要判断媒体类型是否合法
|
|
63
|
+
* vela快应用仅支持 MediaType.SCREEN
|
|
64
|
+
* @param type
|
|
65
|
+
* @param projectType
|
|
66
|
+
* @returns
|
|
67
67
|
*/
|
|
68
68
|
function isSupportMediaType(type, projectType) {
|
|
69
69
|
let supportedMediaList = [];
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* TemplateNode 类型枚举
|
|
7
|
+
/**
|
|
8
|
+
* TemplateNode 类型枚举
|
|
9
9
|
*/
|
|
10
10
|
var TemplateNodeType = /*#__PURE__*/function (TemplateNodeType) {
|
|
11
11
|
TemplateNodeType["TEMPLATE"] = "template";
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
/**
|
|
8
|
-
* StyleSelectorName
|
|
7
|
+
/**
|
|
8
|
+
* StyleSelectorName
|
|
9
9
|
*/
|
|
10
10
|
var StyleSelectorName = /*#__PURE__*/function (StyleSelectorName) {
|
|
11
11
|
StyleSelectorName["FONT_FACE"] = "@FONT-FACE";
|