• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 const SPECIAL_STYLE = {
17   OPACITY: 'opacity',
18   BORDEROPACITY: 'borderOpacity',
19   ANIMATION_DELAY: 'animationDelay',
20   ANIMATION_DURATION: 'animationDuration',
21   ANIMATION_ITERATION_COUNT: 'animationIterationCount',
22   BACKGROUND_IMAGE: 'backgroundImage',
23   BACKGROUND_IMAGE_ACTIVE: 'backgroundImage:active',
24   BACKGROUND_IMAGE_CHECKED: 'backgroundImage:checked',
25 };
26 const DEVICE_LEVEL = {
27   RICH: 'rich',
28   LITE: 'lite',
29   CARD: 'card',
30 };
31 const DEVICE_TYPE = {
32   LITEWEARABLE: 'liteWearable',
33   SMARTVISION: 'smartVision',
34 };
35 
36 const PLATFORM = {
37   VERSION3: 'Version3',
38   VERSION4: 'Version4',
39   VERSION5: 'Version5',
40   VERSION6: 'Version6',
41 };
42 
43 const REGEXP_NUMBER_PX = /^[-+]?[0-9]*\.?[0-9]+(px|cm|em|deg|rad)?$/;
44 const REGEXP_COLOR = /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/;
45 const REGEXP_UNIT = /px|cm|em|deg|rad/;
46 const REGEXP_PNG = /(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/;
47 const REGXP_QUOTES = /"|'/g;
48 const REGXP_LANGUAGE = /\$t/;
49 const REGXP_LANGUAGE_KEY = /_vm\.\$t\([^()]+?\)/g;
50 const REGXP_FUNC_RETURN = /return(.*)}/g;
51 
52 exports.SPECIAL_STYLE = SPECIAL_STYLE;
53 exports.REGEXP_NUMBER_PX = REGEXP_NUMBER_PX;
54 exports.REGEXP_COLOR = REGEXP_COLOR;
55 exports.REGEXP_UNIT = REGEXP_UNIT;
56 exports.DEVICE_LEVEL = DEVICE_LEVEL;
57 exports.REGEXP_PNG = REGEXP_PNG;
58 exports.REGXP_QUOTES = REGXP_QUOTES;
59 exports.DEVICE_TYPE = DEVICE_TYPE;
60 exports.REGXP_LANGUAGE = REGXP_LANGUAGE;
61 exports.REGXP_LANGUAGE_KEY = REGXP_LANGUAGE_KEY;
62 exports.REGXP_FUNC_RETURN = REGXP_FUNC_RETURN;
63 exports.PLATFORM = PLATFORM;
64