1 /* 2 * Copyright (c) 2021-2022 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 #include "core/components/declaration/common/declaration_constants.h" 17 18 namespace OHOS::Ace { 19 20 // attributes, styles, events and methods supported default. 21 const std::vector<AttributeTag> DeclarationConstants::DEFAULT_ATTRS { AttributeTag::COMMON_ATTR, 22 AttributeTag::COMMON_DISABLED_ATTR, AttributeTag::COMMON_FOCUSABLE_ATTR, AttributeTag::COMMON_TOUCHABLE_ATTR, 23 AttributeTag::COMMON_DATA_ATTR, AttributeTag::COMMON_CLICK_EFFECT_ATTR, AttributeTag::COMMON_RENDER_ATTR, 24 AttributeTag::COMMON_MULTIMODAL_ATTR }; 25 const std::vector<StyleTag> DeclarationConstants::DEFAULT_STYLES { StyleTag::COMMON_STYLE, StyleTag::COMMON_SIZE_STYLE, 26 StyleTag::COMMON_MARGIN_STYLE, StyleTag::COMMON_PADDING_STYLE, StyleTag::COMMON_BORDER_STYLE, 27 StyleTag::COMMON_BACKGROUND_STYLE, StyleTag::COMMON_FLEX_STYLE, StyleTag::COMMON_POSITION_STYLE, 28 StyleTag::COMMON_OPACITY_STYLE, StyleTag::COMMON_VISIBILITY_STYLE, StyleTag::COMMON_DISPLAY_STYLE, 29 StyleTag::COMMON_SHADOW_STYLE, StyleTag::COMMON_OVERFLOW_STYLE, StyleTag::COMMON_FILTER_STYLE, 30 StyleTag::COMMON_ANIMATION_STYLE, StyleTag::COMMON_SHARE_TRANSITION_STYLE, StyleTag::COMMON_CARD_TRANSITION_STYLE, 31 StyleTag::COMMON_PAGE_TRANSITION_STYLE, StyleTag::COMMON_CLIP_PATH_STYLE, StyleTag::COMMON_MASK_STYLE, 32 StyleTag::COMMON_IMAGE_STYLE }; 33 const std::vector<EventTag> DeclarationConstants::DEFAULT_EVENTS { EventTag::COMMON_RAW_EVENT, 34 EventTag::COMMON_GESTURE_EVENT, EventTag::COMMON_FOCUS_EVENT, EventTag::COMMON_KEY_EVENT, 35 EventTag::COMMON_REMOTE_MESSAGE_GESTURE_EVENT, 36 EventTag::COMMON_MOUSE_EVENT, EventTag::COMMON_SWIPE_EVENT, EventTag::COMMON_ATTACH_EVENT, 37 EventTag::COMMON_CROWN_EVENT }; 38 const std::vector<MethodTag> DeclarationConstants::DEFAULT_METHODS { MethodTag::COMMON_METHOD }; 39 40 // default common attribute 41 const std::shared_ptr<CommonAttribute> DeclarationConstants::DEFAULT_COMMON_ATTR = std::make_shared<CommonAttribute>(); 42 const std::shared_ptr<CommonDisabledAttribute> DeclarationConstants::DEFAULT_DISABLED_ATTR = 43 std::make_shared<CommonDisabledAttribute>(); 44 const std::shared_ptr<CommonFocusableAttribute> DeclarationConstants::DEFAULT_FOCUSABLE_ATTR = 45 std::make_shared<CommonFocusableAttribute>(); 46 const std::shared_ptr<CommonTouchableAttribute> DeclarationConstants::DEFAULT_TOUCHABLE_ATTR = 47 std::make_shared<CommonTouchableAttribute>(); 48 const std::shared_ptr<CommonDataAttribute> DeclarationConstants::DEFAULT_DATA_ATTR = 49 std::make_shared<CommonDataAttribute>(); 50 const std::shared_ptr<CommonClickEffectAttribute> DeclarationConstants::DEFAULT_CLICK_EFFECT_ATTR = 51 std::make_shared<CommonClickEffectAttribute>(); 52 const std::shared_ptr<CommonRenderAttribute> DeclarationConstants::DEFAULT_RENDER_ATTR = 53 std::make_shared<CommonRenderAttribute>(); 54 const std::shared_ptr<CommonMultimodalAttribute> DeclarationConstants::DEFAULT_MULTI_MODAL_ATTR = 55 std::make_shared<CommonMultimodalAttribute>(); 56 57 // default common style 58 const std::shared_ptr<CommonStyle> DeclarationConstants::DEFAULT_COMMON_STYLE = std::make_shared<CommonStyle>(); 59 const std::shared_ptr<CommonSizeStyle> DeclarationConstants::DEFAULT_SIZE_STYLE = std::make_shared<CommonSizeStyle>(); 60 const std::shared_ptr<CommonMarginStyle> DeclarationConstants::DEFAULT_MARGIN_STYLE = 61 std::make_shared<CommonMarginStyle>(); 62 const std::shared_ptr<CommonPaddingStyle> DeclarationConstants::DEFAULT_PADDING_STYLE = 63 std::make_shared<CommonPaddingStyle>(); 64 const std::shared_ptr<CommonBorderStyle> DeclarationConstants::DEFAULT_BORDER_STYLE = 65 std::make_shared<CommonBorderStyle>(); 66 const std::shared_ptr<CommonBackgroundStyle> DeclarationConstants::DEFAULT_BACKGROUND_STYLE = 67 std::make_shared<CommonBackgroundStyle>(); 68 const std::shared_ptr<CommonFlexStyle> DeclarationConstants::DEFAULT_FLEX_STYLE = std::make_shared<CommonFlexStyle>(); 69 const std::shared_ptr<CommonPositionStyle> DeclarationConstants::DEFAULT_POSITION_STYLE = 70 std::make_shared<CommonPositionStyle>(); 71 const std::shared_ptr<CommonOpacityStyle> DeclarationConstants::DEFAULT_OPACITY_STYLE = 72 std::make_shared<CommonOpacityStyle>(); 73 const std::shared_ptr<CommonVisibilityStyle> DeclarationConstants::DEFAULT_VISIBILITY_STYLE = 74 std::make_shared<CommonVisibilityStyle>(); 75 const std::shared_ptr<CommonDisplayStyle> DeclarationConstants::DEFAULT_DISPLAY_STYLE = 76 std::make_shared<CommonDisplayStyle>(); 77 const std::shared_ptr<CommonShadowStyle> DeclarationConstants::DEFAULT_SHADOW_STYLE = 78 std::make_shared<CommonShadowStyle>(); 79 const std::shared_ptr<CommonOverflowStyle> DeclarationConstants::DEFAULT_OVERFLOW_STYLE = 80 std::make_shared<CommonOverflowStyle>(); 81 const std::shared_ptr<CommonFilterStyle> DeclarationConstants::DEFAULT_FILTER_STYLE = 82 std::make_shared<CommonFilterStyle>(); 83 const std::shared_ptr<CommonAnimationStyle> DeclarationConstants::DEFAULT_ANIMATION_STYLE = 84 std::make_shared<CommonAnimationStyle>(); 85 const std::shared_ptr<CommonShareTransitionStyle> DeclarationConstants::DEFAULT_SHARE_TRANSITION_STYLE = 86 std::make_shared<CommonShareTransitionStyle>(); 87 const std::shared_ptr<CommonCardTransitionStyle> DeclarationConstants::DEFAULT_CARD_TRANSITION_STYLE = 88 std::make_shared<CommonCardTransitionStyle>(); 89 const std::shared_ptr<CommonPageTransitionStyle> DeclarationConstants::DEFAULT_PAGE_TRANSITION_STYLE = 90 std::make_shared<CommonPageTransitionStyle>(); 91 const std::shared_ptr<CommonClipPathStyle> DeclarationConstants::DEFAULT_CLIP_PATH_STYLE = 92 std::make_shared<CommonClipPathStyle>(); 93 const std::shared_ptr<CommonMaskStyle> DeclarationConstants::DEFAULT_MASK_STYLE = 94 std::make_shared<CommonMaskStyle>(); 95 const std::shared_ptr<CommonImageStyle> DeclarationConstants::DEFAULT_IMAGE_STYLE = 96 std::make_shared<CommonImageStyle>(); 97 98 // default common event 99 const std::shared_ptr<CommonRawEvent> DeclarationConstants::DEFAULT_RAW_EVENT = std::make_shared<CommonRawEvent>(); 100 const std::shared_ptr<CommonGestureEvent> DeclarationConstants::DEFAULT_GESTURE_EVENT = 101 std::make_shared<CommonGestureEvent>(); 102 const std::shared_ptr<CommonFocusEvent> DeclarationConstants::DEFAULT_FOCUS_EVENT = 103 std::make_shared<CommonFocusEvent>(); 104 const std::shared_ptr<CommonKeyEvent> DeclarationConstants::DEFAULT_KEY_EVENT = std::make_shared<CommonKeyEvent>(); 105 const std::shared_ptr<CommonMouseEvent> DeclarationConstants::DEFAULT_MOUSE_EVENT = 106 std::make_shared<CommonMouseEvent>(); 107 const std::shared_ptr<CommonSwipeEvent> DeclarationConstants::DEFAULT_SWIPE_EVENT = 108 std::make_shared<CommonSwipeEvent>(); 109 const std::shared_ptr<CommonAttachEvent> DeclarationConstants::DEFAULT_ATTACH_EVENT = 110 std::make_shared<CommonAttachEvent>(); 111 const std::shared_ptr<CommonCrownEvent> DeclarationConstants::DEFAULT_CROWN_EVENT = 112 std::make_shared<CommonCrownEvent>(); 113 114 // default common method 115 const std::shared_ptr<CommonMethod> DeclarationConstants::DEFAULT_METHOD = std::make_shared<CommonMethod>(); 116 117 // default value of badge 118 const std::shared_ptr<BadgeAttribute> DeclarationConstants::DEFAULT_BADGE_ATTR = std::make_shared<BadgeAttribute>(); 119 const std::shared_ptr<BadgeStyle> DeclarationConstants::DEFAULT_BADGE_STYLE = std::make_shared<BadgeStyle>(); 120 const std::shared_ptr<BadgeEvent> DeclarationConstants::DEFAULT_BADGE_EVENT = std::make_shared<BadgeEvent>(); 121 122 // default value of button 123 const std::shared_ptr<ButtonAttribute> DeclarationConstants::DEFAULT_BUTTON_ATTR = std::make_shared<ButtonAttribute>(); 124 const std::shared_ptr<ButtonStyle> DeclarationConstants::DEFAULT_BUTTON_STYLE = std::make_shared<ButtonStyle>(); 125 const std::shared_ptr<ButtonEvent> DeclarationConstants::DEFAULT_BUTTON_EVENT = std::make_shared<ButtonEvent>(); 126 const std::shared_ptr<ButtonMethod> DeclarationConstants::DEFAULT_BUTTON_METHOD = std::make_shared<ButtonMethod>(); 127 128 // default value of div 129 const std::shared_ptr<DivAttribute> DeclarationConstants::DEFAULT_DIV_ATTR = std::make_shared<DivAttribute>(); 130 const std::shared_ptr<DivStyle> DeclarationConstants::DEFAULT_DIV_STYLE = std::make_shared<DivStyle>(); 131 132 // default value of input 133 const std::shared_ptr<InputAttribute> DeclarationConstants::DEFAULT_INPUT_ATTR = std::make_shared<InputAttribute>(); 134 135 // default value of piece 136 const std::shared_ptr<PieceAttribute> DeclarationConstants::DEFAULT_PIECE_ATTR = std::make_shared<PieceAttribute>(); 137 const std::shared_ptr<PieceStyle> DeclarationConstants::DEFAULT_PIECE_STYLE = std::make_shared<PieceStyle>(); 138 const std::shared_ptr<PieceEvent> DeclarationConstants::DEFAULT_PIECE_EVENT = std::make_shared<PieceEvent>(); 139 140 // default value of qrcode 141 const std::shared_ptr<QrcodeAttribute> DeclarationConstants::DEFAULT_QRCODE_ATTR = std::make_shared<QrcodeAttribute>(); 142 const std::shared_ptr<QrcodeStyle> DeclarationConstants::DEFAULT_QRCODE_STYLE = std::make_shared<QrcodeStyle>(); 143 144 // default value of search 145 const std::shared_ptr<SearchAttribute> DeclarationConstants::DEFAULT_SEARCH_ATTR = std::make_shared<SearchAttribute>(); 146 const std::shared_ptr<SearchStyle> DeclarationConstants::DEFAULT_SEARCH_STYLE = std::make_shared<SearchStyle>(); 147 const std::shared_ptr<SearchEvent> DeclarationConstants::DEFAULT_SEARCH_EVENT = std::make_shared<SearchEvent>(); 148 const std::shared_ptr<SearchMethod> DeclarationConstants::DEFAULT_SEARCH_METHOD = std::make_shared<SearchMethod>(); 149 150 // default value of side bar 151 const std::shared_ptr<SideBarContainerAttribute> DeclarationConstants::DEFAULT_SIDE_BAR_ATTR = 152 std::make_shared<SideBarContainerAttribute>(); 153 const std::shared_ptr<RegionEvent> DeclarationConstants::DEFAULT_REGION_EVENT = std::make_shared<RegionEvent>(); 154 155 // default value of span 156 const std::shared_ptr<SpanAttribute> DeclarationConstants::DEFAULT_SPAN_ATTR = std::make_shared<SpanAttribute>(); 157 const std::shared_ptr<SpanStyle> DeclarationConstants::DEFAULT_SPAN_STYLE = std::make_shared<SpanStyle>(); 158 159 // default value of swiper 160 const std::shared_ptr<SwiperAttribute> DeclarationConstants::DEFAULT_SWIPER_ATTR = std::make_shared<SwiperAttribute>(); 161 const std::shared_ptr<SwiperStyle> DeclarationConstants::DEFAULT_SWIPER_STYLE = std::make_shared<SwiperStyle>(); 162 const std::shared_ptr<SwiperEvent> DeclarationConstants::DEFAULT_SWIPER_EVENT = std::make_shared<SwiperEvent>(); 163 const std::shared_ptr<SwiperMethod> DeclarationConstants::DEFAULT_SWIPER_METHOD = std::make_shared<SwiperMethod>(); 164 165 // default value of text 166 const std::shared_ptr<TextSpecializedAttribute> DeclarationConstants::DEFAULT_TEXT_ATTR = 167 std::make_shared<TextSpecializedAttribute>(); 168 const std::shared_ptr<TextSpecializedStyle> DeclarationConstants::DEFAULT_TEXT_STYLE = 169 std::make_shared<TextSpecializedStyle>(); 170 171 // default value of textfield 172 const std::shared_ptr<TextFieldAttribute> DeclarationConstants::DEFAULT_TEXTFIELD_ATTR = 173 std::make_shared<TextFieldAttribute>(); 174 const std::shared_ptr<TextFieldStyle> DeclarationConstants::DEFAULT_TEXTFIELD_STYLE = 175 std::make_shared<TextFieldStyle>(); 176 const std::shared_ptr<TextFieldEvent> DeclarationConstants::DEFAULT_TEXTFIELD_EVENT = 177 std::make_shared<TextFieldEvent>(); 178 const std::shared_ptr<TextFieldMethod> DeclarationConstants::DEFAULT_TEXTFIELD_METHOD = 179 std::make_shared<TextFieldMethod>(); 180 181 // default value of texttimer 182 const std::shared_ptr<TextTimerAttribute> DeclarationConstants::DEFAULT_TEXTTIMER_ATTR = 183 std::make_shared<TextTimerAttribute>(); 184 const std::shared_ptr<TextTimerStyle> DeclarationConstants::DEFAULT_TEXTTIMER_STYLE = 185 std::make_shared<TextTimerStyle>(); 186 const std::shared_ptr<TextTimerEvent> DeclarationConstants::DEFAULT_TEXTTIMER_EVENT = 187 std::make_shared<TextTimerEvent>(); 188 const std::shared_ptr<TextTimerMethod> DeclarationConstants::DEFAULT_TEXTTIMER_METHOD = 189 std::make_shared<TextTimerMethod>(); 190 191 // default value of svg 192 const std::shared_ptr<SvgAnimateAttribute> DeclarationConstants::DEFAULT_SVG_ANIMATE_ATTR = 193 std::make_shared<SvgAnimateAttribute>(); 194 const std::shared_ptr<SvgAttribute> DeclarationConstants::DEFAULT_SVG_ATTR = std::make_shared<SvgAttribute>(); 195 const std::shared_ptr<SvgBaseAttribute> DeclarationConstants::DEFAULT_SVG_BASE_ATTR = 196 std::make_shared<SvgBaseAttribute>(); 197 const std::shared_ptr<SvgCircleAttribute> DeclarationConstants::DEFAULT_SVG_CIRCLE_ATTR = 198 std::make_shared<SvgCircleAttribute>(); 199 const std::shared_ptr<SvgEllipseAttribute> DeclarationConstants::DEFAULT_SVG_ELLIPSE_ATTR = 200 std::make_shared<SvgEllipseAttribute>(); 201 const std::shared_ptr<SvgImageAttribute> DeclarationConstants::DEFAULT_SVG_IMAGE_ATTR = 202 std::make_shared<SvgImageAttribute>(); 203 const std::shared_ptr<SvgLineAttribute> DeclarationConstants::DEFAULT_SVG_LINE_ATTR = 204 std::make_shared<SvgLineAttribute>(); 205 const std::shared_ptr<SvgMaskAttribute> DeclarationConstants::DEFAULT_SVG_MASK_ATTR = 206 std::make_shared<SvgMaskAttribute>(); 207 const std::shared_ptr<SvgPathAttribute> DeclarationConstants::DEFAULT_SVG_PATH_ATTR = 208 std::make_shared<SvgPathAttribute>(); 209 const std::shared_ptr<SvgPatternAttribute> DeclarationConstants::DEFAULT_SVG_PATTERN_ATTR = 210 std::make_shared<SvgPatternAttribute>(); 211 const std::shared_ptr<SvgPolygonAttribute> DeclarationConstants::DEFAULT_SVG_POLYGON_ATTR = 212 std::make_shared<SvgPolygonAttribute>(); 213 const std::shared_ptr<SvgRectAttribute> DeclarationConstants::DEFAULT_SVG_RECT_ATTR = 214 std::make_shared<SvgRectAttribute>(); 215 const std::shared_ptr<SvgTextAttribute> DeclarationConstants::DEFAULT_SVG_TEXT_ATTR = 216 std::make_shared<SvgTextAttribute>(); 217 const std::shared_ptr<SvgTextPathAttribute> DeclarationConstants::DEFAULT_SVG_TEXT_PATH_ATTR = 218 std::make_shared<SvgTextPathAttribute>(); 219 const std::shared_ptr<SvgStopAttribute> DeclarationConstants::DEFAULT_SVG_STOP_ATTR = 220 std::make_shared<SvgStopAttribute>(); 221 const std::shared_ptr<SvgGradientAttribute> DeclarationConstants::DEFAULT_SVG_GRADIENT_ATTR = 222 std::make_shared<SvgGradientAttribute>(); 223 const std::shared_ptr<SvgFilterAttribute> DeclarationConstants::DEFAULT_SVG_FILTER_ATTR = 224 std::make_shared<SvgFilterAttribute>(); 225 const std::shared_ptr<SvgFeColorMatrixAttribute> DeclarationConstants::DEFAULT_SVG_FE_COLORMATRIX_ATTR = 226 std::make_shared<SvgFeColorMatrixAttribute>(); 227 const std::shared_ptr<SvgFeAttribute> DeclarationConstants::DEFAULT_SVG_FE_COMPONENT_TRANSFER_ATTR = 228 std::make_shared<SvgFeAttribute>(); 229 const std::shared_ptr<SvgFeCompositeAttribute> DeclarationConstants::DEFAULT_SVG_FE_COMPOSITE_ATTR = 230 std::make_shared<SvgFeCompositeAttribute>(); 231 const std::shared_ptr<SvgFeOffsetAttribute> DeclarationConstants::DEFAULT_SVG_FE_OFFSET_ATTR = 232 std::make_shared<SvgFeOffsetAttribute>(); 233 const std::shared_ptr<SvgFeFloodAttribute> DeclarationConstants::DEFAULT_SVG_FE_FLOOD_ATTR = 234 std::make_shared<SvgFeFloodAttribute>(); 235 const std::shared_ptr<SvgFeFuncAttribute> DeclarationConstants::DEFAULT_SVG_FE_FUNC_ATTR = 236 std::make_shared<SvgFeFuncAttribute>(); 237 const std::shared_ptr<SvgFeGaussianBlurAttribute> DeclarationConstants::DEFAULT_SVG_FE_GAUSSIAN_BLUR_ATTR = 238 std::make_shared<SvgFeGaussianBlurAttribute>(); 239 const std::shared_ptr<SvgFeMergeAttribute> DeclarationConstants::DEFAULT_SVG_FE_MERGE_ATTR = 240 std::make_shared<SvgFeMergeAttribute>(); 241 const std::shared_ptr<SvgFeMergeNodeAttribute> DeclarationConstants::DEFAULT_SVG_FE_MERGE_NODE_ATTR = 242 std::make_shared<SvgFeMergeNodeAttribute>(); 243 const std::shared_ptr<SvgFeBlendAttribute> DeclarationConstants::DEFAULT_SVG_FE_BLEND_ATTR = 244 std::make_shared<SvgFeBlendAttribute>(); 245 246 // default value of image_animator 247 const std::shared_ptr<ImageAnimatorAttribute> DeclarationConstants::DEFAULT_IMAGE_ANIMATOR_ATTR = 248 std::make_shared<ImageAnimatorAttribute>(); 249 250 // default value of web 251 const std::shared_ptr<WebAttribute> DeclarationConstants::DEFAULT_WEB_ATTR = std::make_shared<WebAttribute>(); 252 const std::shared_ptr<WebEvent> DeclarationConstants::DEFAULT_WEB_EVENT = std::make_shared<WebEvent>(); 253 const std::shared_ptr<WebMethod> DeclarationConstants::DEFAULT_WEB_METHOD = std::make_shared<WebMethod>(); 254 255 // default value of richtext 256 const std::shared_ptr<RichTextAttribute> DeclarationConstants::DEFAULT_RICH_TEXT_ATTR = 257 std::make_shared<RichTextAttribute>(); 258 const std::shared_ptr<RichTextEvent> DeclarationConstants::DEFAULT_RICH_TEXT_EVENT = 259 std::make_shared<RichTextEvent>(); 260 261 // default value of clock 262 const std::shared_ptr<ClockAttribute> DeclarationConstants::DEFAULT_CLOCK_ATTR = std::make_shared<ClockAttribute>(); 263 const std::shared_ptr<ClockStyle> DeclarationConstants::DEFAULT_CLOCK_STYLE = std::make_shared<ClockStyle>(); 264 const std::shared_ptr<ClockEvent> DeclarationConstants::DEFAULT_CLOCK_EVENT = std::make_shared<ClockEvent>(); 265 266 // default value of xcomponent 267 const std::shared_ptr<XComponentAttribute> DeclarationConstants::DEFAULT_XCOMPONENT_ATTR = 268 std::make_shared<XComponentAttribute>(); 269 const std::shared_ptr<XComponentEvent> DeclarationConstants::DEFAULT_XCOMPONENT_EVENT = 270 std::make_shared<XComponentEvent>(); 271 } // namespace OHOS::Ace 272