• 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
16import path from 'path';
17
18export const NATIVE_MODULE: Set<string> = new Set(
19  ['system.app', 'ohos.app', 'system.router', 'system.curves', 'ohos.curves', 'system.matrix4', 'ohos.matrix4']);
20export const VALIDATE_MODULE: string[] = ['application', 'util', 'screen', 'mediaquery'];
21export const SYSTEM_PLUGIN: string = 'system';
22export const OHOS_PLUGIN: string = 'ohos';
23
24export const COMPONENT_DECORATOR_ENTRY: string = '@Entry';
25export const COMPONENT_DECORATOR_PREVIEW: string = '@Preview';
26export const COMPONENT_DECORATOR_COMPONENT: string = '@Component';
27export const COMPONENT_DECORATOR_CUSTOM_DIALOG: string = '@CustomDialog';
28
29export const COMPONENT_NON_DECORATOR: string = 'regular';
30export const COMPONENT_STATE_DECORATOR: string = '@State';
31export const COMPONENT_PROP_DECORATOR: string = '@Prop';
32export const COMPONENT_LINK_DECORATOR: string = '@Link';
33export const COMPONENT_STORAGE_PROP_DECORATOR: string = '@StorageProp';
34export const COMPONENT_STORAGE_LINK_DECORATOR: string = '@StorageLink';
35export const COMPONENT_PROVIDE_DECORATOR: string = '@Provide';
36export const COMPONENT_CONSUME_DECORATOR: string = '@Consume';
37export const COMPONENT_OBJECT_LINK_DECORATOR: string = '@ObjectLink';
38export const COMPONENT_WATCH_DECORATOR: string = '@Watch';
39export const COMPONENT_BUILDERPARAM_DECORATOR: string = '@BuilderParam';
40export const COMPONENT_LOCAL_STORAGE_LINK_DECORATOR: string = '@LocalStorageLink';
41export const COMPONENT_LOCAL_STORAGE_PROP_DECORATOR: string = '@LocalStorageProp';
42export const COMPONENT_CUSTOM_DECORATOR: string = 'COMPONENT_CUSTOM_DECORATOR';
43
44export const COMPONENT_DECORATORS_PARAMS: Set<string> = new Set([COMPONENT_CONSUME_DECORATOR,
45  COMPONENT_STORAGE_PROP_DECORATOR, COMPONENT_STORAGE_LINK_DECORATOR, COMPONENT_PROVIDE_DECORATOR,
46  COMPONENT_WATCH_DECORATOR]);
47export const INNER_COMPONENT_DECORATORS: Set<string> = new Set([COMPONENT_DECORATOR_ENTRY,
48  COMPONENT_DECORATOR_PREVIEW, COMPONENT_DECORATOR_COMPONENT, COMPONENT_DECORATOR_CUSTOM_DIALOG]);
49export const INNER_COMPONENT_MEMBER_DECORATORS: Set<string> = new Set([COMPONENT_STATE_DECORATOR,
50  COMPONENT_PROP_DECORATOR, COMPONENT_LINK_DECORATOR, COMPONENT_STORAGE_PROP_DECORATOR,
51  COMPONENT_STORAGE_LINK_DECORATOR, COMPONENT_PROVIDE_DECORATOR, COMPONENT_CONSUME_DECORATOR,
52  COMPONENT_OBJECT_LINK_DECORATOR, COMPONENT_WATCH_DECORATOR, COMPONENT_BUILDERPARAM_DECORATOR,
53  COMPONENT_LOCAL_STORAGE_LINK_DECORATOR, COMPONENT_LOCAL_STORAGE_PROP_DECORATOR]);
54
55export const COMPONENT_OBSERVED_DECORATOR: string = '@Observed';
56export const COMPONENT_BUILDER_DECORATOR: string = '@Builder';
57export const COMPONENT_EXTEND_DECORATOR: string = '@Extend';
58export const COMPONENT_STYLES_DECORATOR: string = '@Styles';
59export const CHECK_COMPONENT_EXTEND_DECORATOR: string = 'Extend';
60
61export const OBSERVED_PROPERTY_SIMPLE: string = 'ObservedPropertySimple';
62export const OBSERVED_PROPERTY_OBJECT: string = 'ObservedPropertyObject';
63export const SYNCHED_PROPERTY_SIMPLE_ONE_WAY: string = 'SynchedPropertySimpleOneWay';
64export const SYNCHED_PROPERTY_SIMPLE_TWO_WAY: string = 'SynchedPropertySimpleTwoWay';
65export const SYNCHED_PROPERTY_OBJECT_TWO_WAY: string = 'SynchedPropertyObjectTwoWay';
66export const SYNCHED_PROPERTY_NESED_OBJECT: string = 'SynchedPropertyNesedObject';
67
68export const INITIALIZE_CONSUME_FUNCTION: string = 'initializeConsume';
69export const ADD_PROVIDED_VAR: string = 'addProvidedVar';
70
71export const APP_STORAGE: string = 'AppStorage';
72export const APP_STORAGE_SET_AND_PROP: string = 'setAndProp';
73export const APP_STORAGE_SET_AND_LINK: string = 'setAndLink';
74export const APP_STORAGE_GET_OR_SET: string = 'GetOrCreate';
75
76export const PAGE_ENTRY_FUNCTION_NAME: string = 'loadDocument';
77export const STORE_PREVIEW_COMPONENTS: string = 'storePreviewComponents';
78export const PREVIEW_COMPONENT_FUNCTION_NAME: string = 'previewComponent';
79export const GET_PREVIEW_FLAG_FUNCTION_NAME: string = 'getPreviewComponentFlag';
80
81export const COMPONENT_DECORATOR_NAME_COMPONENT: string = 'Component';
82export const COMPONENT_DECORATOR_NAME_CUSTOMDIALOG: string = 'CustomDialog';
83export const CUSTOM_DECORATOR_NAME: Set<string> = new Set([
84  COMPONENT_DECORATOR_NAME_COMPONENT, COMPONENT_DECORATOR_NAME_CUSTOMDIALOG
85]);
86
87export const EXTNAME_ETS: string = '.ets';
88export const NODE_MODULES: string = 'node_modules';
89export const INDEX_ETS: string = 'index.ets';
90export const INDEX_TS: string = 'index.ts';
91export const PACKAGE_JSON: string = 'package.json';
92export const CUSTOM_COMPONENT_DEFAULT: string = 'default';
93
94export const BASE_COMPONENT_NAME: string = 'View';
95export const STRUCT: string = 'struct';
96export const CLASS: string = 'class';
97export const COMPONENT_BUILD_FUNCTION: string = 'build';
98export const COMPONENT_RENDER_FUNCTION: string = 'render';
99export const COMPONENT_TRANSITION_FUNCTION: string = 'pageTransition';
100export const COMPONENT_TRANSITION_NAME: string = 'PageTransition';
101
102export const COMPONENT_BUTTON: string = 'Button';
103export const COMPONENT_FOREACH: string = 'ForEach';
104export const COMPONENT_LAZYFOREACH: string = 'LazyForEach';
105export const IS_RENDERING_IN_PROGRESS: string = 'isRenderingInProgress';
106export const FOREACH_OBSERVED_OBJECT: string = 'ObservedObject';
107export const FOREACH_GET_RAW_OBJECT: string = 'GetRawObject';
108export const COMPONENT_IF: string = 'If';
109export const COMPONENT_IF_BRANCH_ID_FUNCTION: string = 'branchId';
110export const COMPONENT_IF_UNDEFINED: string = 'undefined';
111export const GLOBAL_CONTEXT: string = 'Context';
112export const ATTRIBUTE_ANIMATION: string = 'animation';
113export const ATTRIBUTE_ANIMATETO: string = 'animateTo';
114export const ATTRIBUTE_STATESTYLES: string = 'stateStyles';
115
116export const COMPONENT_CONSTRUCTOR_ID: string = 'compilerAssignedUniqueChildId';
117export const COMPONENT_CONSTRUCTOR_PARENT: string = 'parent';
118export const COMPONENT_CONSTRUCTOR_PARAMS: string = 'params';
119export const COMPONENT_CONSTRUCTOR_UNDEFINED: string = 'undefined';
120export const COMPONENT_CONSTRUCTOR_LOCALSTORAGE: string = 'localStorage';
121export const COMPONENT_SET_AND_LINK: string = 'setAndLink';
122export const COMPONENT_SET_AND_PROP: string = 'setAndProp';
123
124export const BUILD_ON: string = 'on';
125export const BUILD_OFF: string = 'off';
126
127export const COMPONENT_CREATE_FUNCTION: string = 'create';
128export const COMPONENT_CREATE_LABEL_FUNCTION: string = 'createWithLabel';
129export const COMPONENT_CREATE_CHILD_FUNCTION: string = 'createWithChild';
130export const COMPONENT_POP_FUNCTION: string = 'pop';
131export const COMPONENT_DEBUGLINE_FUNCTION: string = 'debugLine';
132
133export const COMPONENT_CONSTRUCTOR_UPDATE_PARAMS: string = 'updateWithValueParams';
134export const COMPONENT_CONSTRUCTOR_DELETE_PARAMS: string = 'aboutToBeDeleted';
135export const CREATE_GET_METHOD: string = 'get';
136export const CREATE_SET_METHOD: string = 'set';
137export const CREATE_NEWVALUE_IDENTIFIER: string = 'newValue';
138export const CREATE_CONSTRUCTOR_PARAMS: string = 'params';
139export const CREATE_CONSTRUCTOR_SUBSCRIBER_MANAGER: string = 'SubscriberManager';
140export const CREATE_CONSTRUCTOR_GET_FUNCTION: string = 'Get';
141export const CREATE_CONSTRUCTOR_DELETE_FUNCTION: string = 'delete';
142export const ABOUT_TO_BE_DELETE_FUNCTION_ID: string = 'id';
143export const COMPONENT_WATCH_FUNCTION: string = 'declareWatch';
144
145export const CREATE_STATE_METHOD: string = 'createState';
146export const CREATE_PROP_METHOD: string = 'createProp';
147export const CREATE_LINK_METHOD: string = 'createLink';
148export const CREATE_OBSERVABLE_OBJECT_METHOD: string = 'createObservableObject';
149
150export const CUSTOM_COMPONENT_EARLIER_CREATE_CHILD: string = 'earlierCreatedChild_';
151export const CUSTOM_COMPONENT_FUNCTION_FIND_CHILD_BY_ID: string = 'findChildById';
152export const CUSTOM_COMPONENT_NEEDS_UPDATE_FUNCTION: string = 'needsUpdate';
153export const CUSTOM_COMPONENT_MARK_STATIC_FUNCTION: string = 'markStatic';
154
155export const COMPONENT_GESTURE: string = 'Gesture';
156export const COMPONENT_GESTURE_GROUP: string = 'GestureGroup';
157export const GESTURE_ATTRIBUTE: string = 'gesture';
158export const PARALLEL_GESTURE_ATTRIBUTE: string = 'parallelGesture';
159export const PRIORITY_GESTURE_ATTRIBUTE: string = 'priorityGesture';
160export const GESTURE_ENUM_KEY: string = 'GesturePriority';
161export const GESTURE_ENUM_VALUE_HIGH: string = 'High';
162export const GESTURE_ENUM_VALUE_LOW: string = 'Low';
163export const GESTURE_ENUM_VALUE_PARALLEL: string = 'Parallel';
164
165export const RESOURCE: string = '$r';
166export const RESOURCE_RAWFILE: string = '$rawfile';
167export const RESOURCE_NAME_ID: string = 'id';
168export const RESOURCE_NAME_TYPE: string = 'type';
169export const RESOURCE_NAME_PARAMS: string = 'params';
170export const RESOURCE_TYPE = {
171  color: 10001,
172  float: 10002,
173  string: 10003,
174  plural: 10004,
175  boolean: 10005,
176  intarray: 10006,
177  integer: 10007,
178  pattern: 10008,
179  strarray: 10009,
180  media: 20000,
181  rawfile: 30000
182};
183
184export const WORKERS_DIR: string = 'workers';
185export const WORKER_OBJECT: string = 'Worker';
186
187export const SET_CONTROLLER_METHOD: string = 'setController';
188export const SET_CONTROLLER_CTR: string = 'ctr';
189export const SET_CONTROLLER_CTR_TYPE: string = 'CustomDialogController';
190export const JS_DIALOG: string = 'jsDialog';
191export const CUSTOM_DIALOG_CONTROLLER_BUILDER: string = 'builder';
192
193export const BUILDER_ATTR_NAME: string = 'builder';
194export const BUILDER_ATTR_BIND: string = 'bind';
195
196export const GEOMETRY_VIEW: string = 'GeometryView';
197
198export const MODULE_SHARE_PATH: string = 'src' + path.sep + 'main' + path.sep + 'ets' + path.sep + 'share';
199export const BUILD_SHARE_PATH: string = '../share';
200export const MODULE_ETS_PATH: string = 'src' + path.sep + 'main' + path.sep + 'ets';
201
202export const THIS: string = 'this';
203export const STYLES: string = 'Styles';
204export const VISUAL_STATE: string = 'visualState';
205export const VIEW_STACK_PROCESSOR: string = 'ViewStackProcessor';
206
207export const BIND_POPUP: string = 'bindPopup';
208export const BIND_POPUP_SET: Set<string> = new Set(['bindPopup']);
209export const BIND_DRAG_SET: Set<string> = new Set(['onDragStart', 'onItemDragStart']);
210export const CHECKED: string = 'checked';
211export const RADIO: string = 'Radio';
212export const $$_VALUE: string = 'value';
213export const $$_CHANGE_EVENT: string = 'changeEvent';
214export const TEXT_TIMER: string = 'TextTimer';
215export const FORMAT: string = 'format';
216export const IS_COUNT_DOWN: string = 'isCountDown';
217export const COUNT: string = 'count';
218export const $$_THIS: string = '$$this';
219export const $$_NEW_VALUE: string = 'newValue';
220export const $$: string = '$$';
221export const $$_VISIBILITY: string = 'visibility';
222
223export const STYLE_ADD_DOUBLE_DOLLAR: Set<string> = new Set([BIND_POPUP, $$_VISIBILITY])
224export const PROPERTIES_ADD_DOUBLE_DOLLAR: Map<string, Set<string>> = new Map([
225  [RADIO, new Set([CHECKED])], [TEXT_TIMER, new Set([FORMAT, COUNT, IS_COUNT_DOWN])],
226]);;
227
228export const INTERFACE_NAME_SUFFIX:string = '_Params';
229export const OBSERVED_PROPERTY_ABSTRACT:string = 'ObservedPropertyAbstract';
230
231export const SUPERVISUAL: string = './supervisual';
232export const SUPERVISUAL_SOURCEMAP_EXT: string = '.visual.js.map';
233
234export const INSTANCE: string = 'Instance';
235
236export const SUCCESS: number = 0;
237export const FAIL: number = 1;
238
239export const TEMPORARY: string = 'temporary';