• 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
16const 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};
26const DEVICE_LEVEL = {
27  RICH: 'rich',
28  LITE: 'lite',
29  CARD: 'card',
30};
31const DEVICE_TYPE = {
32  LITEWEARABLE: 'liteWearable',
33  SMARTVISION: 'smartVision',
34};
35
36const PLATFORM = {
37  VERSION3: 'Version3',
38  VERSION4: 'Version4',
39  VERSION5: 'Version5',
40  VERSION6: 'Version6',
41};
42
43const REGEXP_NUMBER_PX = /^[-+]?[0-9]*\.?[0-9]+(px|cm|em|deg|rad)?$/;
44const REGEXP_COLOR = /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/;
45const REGEXP_UNIT = /px|cm|em|deg|rad/;
46const REGEXP_PNG = /(\.png|\.jpg|\.bmp|\.jpeg|\.BMP|\.JPG|\.PNG|\.JPEG)$/;
47const REGXP_QUOTES = /"|'/g;
48const REGXP_LANGUAGE = /\$t/;
49const REGXP_LANGUAGE_KEY = /_vm\.\$t\([^()]+?\)/g;
50const REGXP_FUNC_RETURN = /return(.*)}/g;
51
52exports.SPECIAL_STYLE = SPECIAL_STYLE;
53exports.REGEXP_NUMBER_PX = REGEXP_NUMBER_PX;
54exports.REGEXP_COLOR = REGEXP_COLOR;
55exports.REGEXP_UNIT = REGEXP_UNIT;
56exports.DEVICE_LEVEL = DEVICE_LEVEL;
57exports.REGEXP_PNG = REGEXP_PNG;
58exports.REGXP_QUOTES = REGXP_QUOTES;
59exports.DEVICE_TYPE = DEVICE_TYPE;
60exports.REGXP_LANGUAGE = REGXP_LANGUAGE;
61exports.REGXP_LANGUAGE_KEY = REGXP_LANGUAGE_KEY;
62exports.REGXP_FUNC_RETURN = REGXP_FUNC_RETURN;
63exports.PLATFORM = PLATFORM;
64