From 603a6dffde9a8bc7f4db2e8fed4483692c59112b Mon Sep 17 00:00:00 2001 From: sohotz Date: Tue, 26 Dec 2023 21:04:26 +0800 Subject: [PATCH] feat(ohos): hippy support ohos --- .gitignore | 8 + AppScope/app.json5 | 10 + AppScope/resources/base/element/string.json | 8 + AppScope/resources/base/media/app_icon.png | Bin 0 -> 2041 bytes build-profile.json5 | 57 + buildconfig/cmake/GlobalPackagesModule.cmake | 7 + devtools/devtools-backend/CMakeLists.txt | 6 +- .../include/api/adapter/data/domain_metas.h | 4 + .../devtools_common_protocol_adapter.h | 1 + .../include/tunnel/tcp/frame_codec.h | 1 + .../src/tunnel/tcp/tcp_channel.cc | 1 + devtools/devtools-integration/CMakeLists.txt | 3 + .../native/CMakeLists.txt | 24 +- .../devtools-integration/ohos/CMakeLists.txt | 73 + .../ohos/include/devtools_napi.h | 32 + .../ohos/src/devtools_napi.cc | 207 +++ docs/api/hippy-vue/components.md | 74 +- docs/development/native-event.md | 12 + docs/development/native-integration.md | 122 +- docs/development/native-module.md | 135 ++ docs/feature/feature2.0/jsi.md | 101 ++ dom/CMakeLists.txt | 22 +- dom/include/dom/dom_node.h | 4 + dom/include/dom/layout_node.h | 2 + dom/include/dom/root_node.h | 22 + dom/include/dom/taitank_layout_node.h | 4 +- dom/include/dom/yoga_layout_node.h | 6 +- dom/src/dom/animation/animation_manager.cc | 9 +- .../dom/animation/cubic_bezier_animation.cc | 40 +- dom/src/dom/dom_manager.cc | 4 +- dom/src/dom/dom_node.cc | 5 +- dom/src/dom/layer_optimized_render_manager.cc | 6 +- dom/src/dom/root_node.cc | 17 +- dom/src/dom/yoga_layout_node.cc | 29 +- driver/js/CMakeLists.txt | 50 +- .../js/examples/hippy-react-demo/package.json | 8 +- .../scripts/hippy-webpack.ohos-vendor.js | 79 + .../scripts/hippy-webpack.ohos.js | 112 ++ .../js/examples/hippy-vue-demo/package.json | 8 +- .../scripts/hippy-webpack.ohos-vendor.js | 131 ++ .../scripts/hippy-webpack.ohos.js | 178 ++ .../components/demos/demo-dynamicimport.vue | 2 +- .../src/components/demos/demo-list.vue | 34 + .../src/components/demos/demo-shadow.vue | 86 + .../src/components/demos/demo-turbo.vue | 2 +- .../native-demos/demo-vue-native.vue | 10 +- .../native-demos/demo-waterfall.vue | 3 +- .../examples/hippy-vue-next-demo/package.json | 8 +- .../scripts/hippy-webpack.ohos-vendor.js | 108 ++ .../scripts/hippy-webpack.ohos.js | 169 ++ driver/js/include/driver/js_driver_utils.h | 3 +- driver/js/include/driver/napi/js_ctx.h | 2 + .../driver/napi/jsh/jsh_class_definition.h | 51 + driver/js/include/driver/napi/jsh/jsh_ctx.h | 250 +++ .../include/driver/napi/jsh/jsh_ctx_value.h | 66 + .../include/driver/napi/jsh/jsh_try_catch.h | 55 + driver/js/include/driver/scope.h | 16 +- driver/js/include/driver/vm/jsh/jsh_vm.h | 101 ++ driver/js/lib/bridge/ohos/js2native.js | 171 ++ driver/js/lib/bridge/ohos/native2js.js | 95 + driver/js/lib/entry/ohos/hippy.js | 45 + driver/js/lib/global/ohos/Turbo.js | 39 + driver/js/lib/global/ohos/global.js | 26 + .../js/packages/hippy-vue-loader/package.json | 3 +- .../src/runtime/native/index.ts | 18 +- .../packages/hippy-vue/src/runtime/native.ts | 12 +- driver/js/scripts/build-core.js | 24 + driver/js/scripts/build-example.js | 1 + driver/js/src/base/js_convert_utils.cc | 9 + driver/js/src/engine.cc | 2 + driver/js/src/js_driver_utils.cc | 70 +- driver/js/src/modules/scene_builder_module.cc | 14 +- .../js/src/napi/jsh/jsh_class_definition.cc | 42 + driver/js/src/napi/jsh/jsh_ctx.cc | 1533 +++++++++++++++++ driver/js/src/napi/jsh/jsh_try_catch.cc | 140 ++ driver/js/src/napi/v8/v8_ctx.cc | 3 + driver/js/src/scope.cc | 12 + driver/js/src/vm/jsh/jsh_vm.cc | 214 +++ .../js/src/vm/jsh/native_source_code_ohos.cc | 80 + driver/js/src/vm/v8/serializer.cc | 4 +- .../asyncComponentFromHttp.android.js | 1 + .../hippy-react/asyncComponentFromHttp.ios.js | 1 + .../asyncComponentFromHttp.ohos.js | 1 + .../asyncComponentFromHttp.android.js | 1 + .../asyncComponentFromHttp.ios.js | 1 + .../asyncComponentFromHttp.ohos.js | 1 + .../asyncComponentFromHttp.android.js | 1 + .../hippy-vue/asyncComponentFromHttp.ios.js | 1 + .../hippy-vue/asyncComponentFromHttp.ohos.js | 1 + framework/android/src/main/cpp/CMakeLists.txt | 7 + .../tencent/mtt/hippy/HippyEngineContext.java | 7 + .../mtt/hippy/HippyEngineManagerImpl.java | 6 +- framework/examples/ohos-demo/.clang-format | 62 + framework/examples/ohos-demo/.clang-tidy | 1 + framework/examples/ohos-demo/.clangd | 11 + .../examples/ohos-demo/build-profile.json5 | 36 + framework/examples/ohos-demo/hvigorfile.ts | 28 + .../examples/ohos-demo/obfuscation-rules.txt | 38 + framework/examples/ohos-demo/oh-package.json5 | 12 + framework/examples/ohos-demo/oh_modules/hippy | 1 + .../ohos-demo/src/main/cpp/CMakeLists.txt | 51 + .../cpp/hippy_extend/include/example_view_a.h | 53 + .../cpp/hippy_extend/include/example_view_b.h | 58 + .../cpp/hippy_extend/src/example_view_a.cc | 76 + .../cpp/hippy_extend/src/example_view_b.cc | 76 + .../hippy_extend/src/example_view_provider.cc | 44 + .../main/ets/entryability/EntryAbility.ets | 84 + .../ohos-demo/src/main/ets/fonts/TTTGB.otf | 3 + .../ets/hippy_extend/ExampleAPIProvider.ets | 82 + .../main/ets/hippy_extend/ExampleMenuView.ets | 54 + .../ets/hippy_extend/ExampleNativeModule.ets | 117 ++ .../hippy_extend/ExampleNativeTurboModule.ets | 69 + .../main/ets/hippy_extend/ExampleViewA.ets | 99 ++ .../main/ets/hippy_extend/ExampleViewB.ets | 95 + .../ets/hippy_extend/turbo/TurboConfig.ets | 42 + .../src/main/ets/pages/DriverSetting.ets | 87 + .../ohos-demo/src/main/ets/pages/Index.ets | 154 ++ .../src/main/ets/pages/PageConfiguration.ets | 397 +++++ .../src/main/ets/pages/PageManagement.ets | 304 ++++ .../src/main/ets/pages/PageSetting.ets | 76 + .../src/main/ets/pages/RendererSetting.ets | 71 + .../examples/ohos-demo/src/main/module.json5 | 38 + .../main/resources/base/element/color.json | 12 + .../main/resources/base/element/string.json | 60 + .../main/resources/base/media/add_page_2x.png | Bin 0 -> 2196 bytes .../src/main/resources/base/media/back_2x.png | Bin 0 -> 419 bytes .../resources/base/media/delete_page_2x.png | Bin 0 -> 1055 bytes .../src/main/resources/base/media/devtool.svg | 4 + .../main/resources/base/media/hippy_2x.png | Bin 0 -> 1562 bytes .../src/main/resources/base/media/ic_back.png | Bin 0 -> 1020 bytes .../main/resources/base/media/ic_launcher.png | Bin 0 -> 12927 bytes .../src/main/resources/base/media/icon.png | Bin 0 -> 2041 bytes .../src/main/resources/base/media/logo_1x.png | Bin 0 -> 270727 bytes .../base/media/page_config_create_2x.png | Bin 0 -> 3399 bytes .../base/media/page_config_debug_2x.png | Bin 0 -> 1003 bytes .../base/media/page_config_debug_off_2x.png | Bin 0 -> 1401 bytes .../base/media/page_config_debug_on_2x.png | Bin 0 -> 1265 bytes .../base/media/page_config_driver_2x.png | Bin 0 -> 347 bytes .../base/media/page_config_forward_4x.png | Bin 0 -> 374 bytes .../base/media/page_config_render_2x.png | Bin 0 -> 444 bytes .../resources/base/media/page_item_add_4x.png | Bin 0 -> 343 bytes .../base/media/page_item_tips_4x.png | Bin 0 -> 1032 bytes .../base/media/page_management_2x.png | Bin 0 -> 694 bytes .../base/media/page_management_pressed_2x.png | Bin 0 -> 536 bytes .../base/media/page_setting_building_2x.png | Bin 0 -> 50067 bytes .../main/resources/base/media/setting_2x.png | Bin 0 -> 1274 bytes .../base/media/setting_pressed_2x.png | Bin 0 -> 952 bytes .../main/resources/base/media/startIcon.png | Bin 0 -> 4351 bytes .../resources/base/media/start_prompt_2x.png | Bin 0 -> 4607 bytes .../resources/base/profile/main_pages.json | 8 + .../main/resources/en_US/element/string.json | 16 + .../main/resources/rawfile/fonts/TTTGB.otf | 3 + .../rawfile/react/assets/defaultSource.jpg | Bin 0 -> 42281 bytes .../rawfile/react/assets/hippyLogoWhite.png | Bin 0 -> 24639 bytes .../react/asyncComponentFromHttp.android.js | 1 + .../react/asyncComponentFromHttp.ohos.js | 1 + .../react/asyncComponentFromLocal.android.js | 1 + .../react/asyncComponentFromLocal.ohos.js | 1 + .../resources/rawfile/react/index.android.js | 9 + .../resources/rawfile/react/index.ohos.js | 9 + .../rawfile/react/vendor-manifest.json | 1 + .../resources/rawfile/react/vendor.android.js | 53 + .../resources/rawfile/react/vendor.ohos.js | 53 + .../rawfile/vue2/assets/defaultSource.jpg | Bin 0 -> 42281 bytes .../rawfile/vue2/assets/hippyLogoWhite.png | Bin 0 -> 24639 bytes .../vue2/asyncComponentFromHttp.ohos.js | 1 + .../vue2/asyncComponentFromLocal.ohos.js | 1 + .../main/resources/rawfile/vue2/index.ohos.js | 25 + .../rawfile/vue2/vendor-manifest.json | 1 + .../resources/rawfile/vue2/vendor.ohos.js | 47 + .../rawfile/vue3/assets/defaultSource.jpg | Bin 0 -> 42281 bytes .../rawfile/vue3/assets/hippyLogoWhite.png | Bin 0 -> 24639 bytes .../vue3/asyncComponentFromHttp.android.js | 1 + .../vue3/asyncComponentFromHttp.ohos.js | 1 + .../vue3/asyncComponentFromLocal.android.js | 1 + .../vue3/asyncComponentFromLocal.ohos.js | 1 + .../resources/rawfile/vue3/index.android.js | 7 + .../main/resources/rawfile/vue3/index.ohos.js | 29 + .../rawfile/vue3/vendor-manifest.json | 1 + .../resources/rawfile/vue3/vendor.android.js | 24 + .../resources/rawfile/vue3/vendor.ohos.js | 43 + .../main/resources/resfile/fonts/TTTGB.otf | 3 + .../main/resources/zh_CN/element/string.json | 28 + .../src/ohosTest/ets/test/Ability.test.ets | 35 + .../src/ohosTest/ets/test/List.test.ets | 5 + .../ohosTest/ets/testability/TestAbility.ets | 50 + .../ohosTest/ets/testability/pages/Index.ets | 17 + .../ets/testrunner/OpenHarmonyTestRunner.ets | 47 + .../ohos-demo/src/ohosTest/module.json5 | 38 + .../resources/base/element/color.json | 8 + .../resources/base/element/string.json | 16 + .../ohosTest/resources/base/media/icon.png | Bin 0 -> 6790 bytes .../resources/base/profile/test_pages.json | 5 + .../examples/ohos-demo/src/test/List.test.ets | 5 + .../ohos-demo/src/test/LocalUnit.test.ets | 33 + framework/examples/ohos-har-demo/.gitignore | 7 + .../ohos-har-demo/build-profile.json5 | 28 + .../examples/ohos-har-demo/hvigorfile.ts | 28 + .../ohos-har-demo/obfuscation-rules.txt | 38 + .../examples/ohos-har-demo/oh-package.json5 | 13 + .../main/ets/entryability/EntryAbility.ets | 45 + .../entrybackupability/EntryBackupAbility.ets | 12 + .../src/main/ets/pages/Index.ets | 120 ++ .../ohos-har-demo/src/main/module.json5 | 52 + .../main/resources/base/element/color.json | 8 + .../main/resources/base/element/string.json | 16 + .../main/resources/base/media/background.png | Bin 0 -> 57364 bytes .../main/resources/base/media/foreground.png | Bin 0 -> 12430 bytes .../resources/base/media/layered_image.json | 7 + .../main/resources/base/media/startIcon.png | Bin 0 -> 20093 bytes .../resources/base/profile/backup_config.json | 3 + .../resources/base/profile/main_pages.json | 5 + .../main/resources/en_US/element/string.json | 16 + .../rawfile/vue2/assets/defaultSource.jpg | Bin 0 -> 42281 bytes .../rawfile/vue2/assets/hippyLogoWhite.png | Bin 0 -> 24639 bytes .../vue2/asyncComponentFromHttp.ohos.js | 1 + .../vue2/asyncComponentFromLocal.ohos.js | 1 + .../main/resources/rawfile/vue2/index.ohos.js | 25 + .../rawfile/vue2/vendor-manifest.json | 1 + .../resources/rawfile/vue2/vendor.ohos.js | 49 + .../main/resources/zh_CN/element/string.json | 16 + .../ohos-har-demo/src/mock/mock-config.json5 | 2 + .../src/ohosTest/ets/test/Ability.test.ets | 35 + .../src/ohosTest/ets/test/List.test.ets | 5 + .../ohos-har-demo/src/ohosTest/module.json5 | 13 + .../ohos-har-demo/src/test/List.test.ets | 5 + .../ohos-har-demo/src/test/LocalUnit.test.ets | 33 + framework/ohos/CHANGELOG.md | 17 + framework/ohos/LICENSE | 254 +++ framework/ohos/README.md | 59 + framework/ohos/build-profile.json5 | 58 + framework/ohos/consumer-rules.txt | 20 + framework/ohos/hvigorfile.ts | 28 + framework/ohos/index.ets | 4 + framework/ohos/obfuscation-rules.txt | 38 + framework/ohos/oh-package.json5 | 12 + framework/ohos/src/main/cpp/CMakeLists.txt | 33 + .../ohos/src/main/cpp/impl/CMakeLists.txt | 73 + .../main/cpp/impl/connector/CMakeLists.txt | 92 + .../impl/connector/include/connector/ark2js.h | 35 + .../include/connector/arkts_turbo_module.h | 87 + .../impl/connector/include/connector/bridge.h | 44 + .../include/connector/dom_manager_napi.h | 35 + .../include/connector/exception_handler.h | 46 + .../impl/connector/include/connector/js2ark.h | 37 + .../include/connector/js_driver_napi.h | 35 + .../include/connector/native_renderer_napi.h | 37 + .../include/connector/setting_napi.h | 32 + .../impl/connector/include/connector/turbo.h | 46 + .../connector/include/connector/turbo.utils.h | 59 + .../include/connector/turbo_module_manager.h | 42 + .../src/main/cpp/impl/connector/src/ark2js.cc | 98 ++ .../impl/connector/src/arkts_turbo_module.cc | 182 ++ .../impl/connector/src/dom_manager_napi.cc | 198 +++ .../impl/connector/src/exception_handler.cc | 66 + .../src/main/cpp/impl/connector/src/js2ark.cc | 95 + .../cpp/impl/connector/src/js_driver_napi.cc | 523 ++++++ .../connector/src/native_renderer_napi.cc | 203 +++ .../cpp/impl/connector/src/setting_napi.cc | 84 + .../connector/src/turbo_module_manager.cc | 176 ++ .../cpp/impl/connector/src/turbo_utils.cc | 226 +++ framework/ohos/src/main/cpp/impl/entry.cc | 24 + .../cpp/impl/renderer/native/CMakeLists.txt | 135 ++ .../renderer/api/hippy_view_provider.h | 47 + .../include/renderer/arkui/arkui_node.h | 248 +++ .../renderer/arkui/arkui_node_registry.h | 52 + .../include/renderer/arkui/column_node.h | 41 + .../include/renderer/arkui/custom_ts_node.h | 42 + .../renderer/arkui/dialog_controller.h | 67 + .../include/renderer/arkui/image_node.h | 112 ++ .../include/renderer/arkui/image_span_node.h | 56 + .../include/renderer/arkui/list_item_node.h | 54 + .../native/include/renderer/arkui/list_node.h | 92 + .../renderer/arkui/native_dialog_api.h | 42 + .../include/renderer/arkui/native_node_api.h | 42 + .../include/renderer/arkui/refresh_node.h | 71 + .../native/include/renderer/arkui/row_node.h | 45 + .../include/renderer/arkui/scroll_node.h | 86 + .../native/include/renderer/arkui/span_node.h | 70 + .../include/renderer/arkui/stack_node.h | 50 + .../include/renderer/arkui/swiper_node.h | 87 + .../include/renderer/arkui/text_area_node.h | 83 + .../renderer/arkui/text_input_base_node.h | 86 + .../include/renderer/arkui/text_input_node.h | 92 + .../native/include/renderer/arkui/text_node.h | 103 ++ .../renderer/arkui/water_flow_item_node.h | 61 + .../include/renderer/arkui/water_flow_node.h | 86 + .../include/renderer/components/base_view.h | 208 +++ .../renderer/components/custom_ts_view.h | 62 + .../include/renderer/components/custom_view.h | 47 + .../include/renderer/components/div_view.h | 53 + .../components/hippy_render_view_creator.h | 37 + .../include/renderer/components/image_view.h | 62 + .../renderer/components/list_item_adapter.h | 163 ++ .../renderer/components/list_item_view.h | 78 + .../include/renderer/components/list_view.h | 156 ++ .../include/renderer/components/modal_view.h | 65 + .../renderer/components/pager_item_adapter.h | 130 ++ .../renderer/components/pager_item_view.h | 52 + .../include/renderer/components/pager_view.h | 84 + .../renderer/components/pull_footer_view.h | 56 + .../renderer/components/pull_header_view.h | 50 + .../components/refresh_wrapper_item_view.h | 52 + .../components/refresh_wrapper_view.h | 76 + .../components/rich_text_image_span_view.h | 59 + .../renderer/components/rich_text_span_view.h | 81 + .../renderer/components/rich_text_view.h | 113 ++ .../include/renderer/components/root_view.h | 49 + .../include/renderer/components/scroll_view.h | 67 + .../renderer/components/text_input_view.h | 144 ++ .../renderer/components/waterfall_item_view.h | 53 + .../renderer/components/waterfall_view.h | 126 ++ .../include/renderer/dom_node/hr_node_props.h | 182 ++ .../native/include/renderer/native_render.h | 50 + .../include/renderer/native_render_context.h | 59 + .../include/renderer/native_render_impl.h | 106 ++ .../include/renderer/native_render_manager.h | 206 +++ .../include/renderer/native_render_params.h | 45 + .../include/renderer/native_render_provider.h | 102 ++ .../renderer/native_render_provider_capi.h | 45 + .../renderer/native_render_provider_manager.h | 44 + .../renderer/native_render_provider_napi.h | 56 + .../include/renderer/recycle/recycle_view.h | 48 + .../text_measure/font_collection_manager.h | 105 ++ .../text_measure/text_measure_manager.h | 134 ++ .../renderer/text_measure/text_measurer.h | 147 ++ .../uimanager/hr_gesture_dispatcher.h | 58 + .../include/renderer/uimanager/hr_manager.h | 68 + .../include/renderer/uimanager/hr_mutation.h | 142 ++ .../renderer/uimanager/hr_view_manager.h | 155 ++ .../include/renderer/utils/hr_convert_utils.h | 48 + .../renderer/utils/hr_display_sync_utils.h | 52 + .../include/renderer/utils/hr_event_utils.h | 159 ++ .../include/renderer/utils/hr_pixel_utils.h | 68 + .../renderer/utils/hr_text_convert_utils.h | 47 + .../native/include/renderer/utils/hr_types.h | 141 ++ .../include/renderer/utils/hr_url_utils.h | 28 + .../include/renderer/utils/hr_value_utils.h | 153 ++ .../renderer/virtual/hr_virtual_view.h | 50 + .../virtual/hr_virtual_view_manager.h | 50 + .../native/src/api/hippy_view_provider.cc | 62 + .../renderer/native/src/arkui/arkui_node.cc | 797 +++++++++ .../native/src/arkui/arkui_node_registry.cc | 80 + .../renderer/native/src/arkui/column_node.cc | 37 + .../native/src/arkui/custom_ts_node.cc | 38 + .../native/src/arkui/dialog_controller.cc | 131 ++ .../renderer/native/src/arkui/image_node.cc | 305 ++++ .../native/src/arkui/image_span_node.cc | 83 + .../native/src/arkui/list_item_node.cc | 69 + .../renderer/native/src/arkui/list_node.cc | 216 +++ .../native/src/arkui/native_dialog_api.cc | 40 + .../native/src/arkui/native_node_api.cc | 40 + .../renderer/native/src/arkui/refresh_node.cc | 123 ++ .../renderer/native/src/arkui/row_node.cc | 52 + .../renderer/native/src/arkui/scroll_node.cc | 232 +++ .../renderer/native/src/arkui/span_node.cc | 162 ++ .../renderer/native/src/arkui/stack_node.cc | 61 + .../renderer/native/src/arkui/swiper_node.cc | 185 ++ .../native/src/arkui/text_area_node.cc | 182 ++ .../native/src/arkui/text_input_base_node.cc | 125 ++ .../native/src/arkui/text_input_node.cc | 234 +++ .../renderer/native/src/arkui/text_node.cc | 273 +++ .../native/src/arkui/water_flow_item_node.cc | 89 + .../native/src/arkui/water_flow_node.cc | 191 ++ .../native/src/components/base_view.cc | 1112 ++++++++++++ .../native/src/components/custom_ts_view.cc | 148 ++ .../native/src/components/custom_view.cc | 38 + .../native/src/components/div_view.cc | 88 + .../components/hippy_render_view_creator.cc | 141 ++ .../native/src/components/image_view.cc | 184 ++ .../src/components/list_item_adapter.cc | 32 + .../native/src/components/list_item_view.cc | 189 ++ .../native/src/components/list_view.cc | 617 +++++++ .../native/src/components/modal_view.cc | 148 ++ .../src/components/pager_item_adapter.cc | 32 + .../native/src/components/pager_item_view.cc | 73 + .../native/src/components/pager_view.cc | 255 +++ .../native/src/components/pull_footer_view.cc | 100 ++ .../native/src/components/pull_header_view.cc | 99 ++ .../components/refresh_wrapper_item_view.cc | 79 + .../src/components/refresh_wrapper_view.cc | 169 ++ .../components/rich_text_image_span_view.cc | 159 ++ .../src/components/rich_text_span_view.cc | 252 +++ .../native/src/components/rich_text_view.cc | 467 +++++ .../native/src/components/root_view.cc | 72 + .../native/src/components/scroll_view.cc | 264 +++ .../native/src/components/text_input_view.cc | 602 +++++++ .../src/components/waterfall_item_view.cc | 96 ++ .../native/src/components/waterfall_view.cc | 386 +++++ .../native/src/native_render_context.cc | 29 + .../renderer/native/src/native_render_impl.cc | 354 ++++ .../native/src/native_render_manager.cc | 1489 ++++++++++++++++ .../native/src/native_render_params.cc | 33 + .../native/src/native_render_provider.cc | 235 +++ .../native/src/native_render_provider_capi.cc | 529 ++++++ .../src/native_render_provider_manager.cc | 45 + .../native/src/native_render_provider_napi.cc | 468 +++++ .../native/src/recycle/recycle_view.cc | 49 + .../text_measure/font_collection_manager.cc | 33 + .../src/text_measure/text_measure_manager.cc | 33 + .../native/src/text_measure/text_measurer.cc | 620 +++++++ .../src/uimanager/hr_gesture_dispatcher.cc | 45 + .../native/src/uimanager/hr_manager.cc | 88 + .../native/src/uimanager/hr_mutation.cc | 29 + .../native/src/uimanager/hr_view_manager.cc | 734 ++++++++ .../native/src/utils/hr_convert_utils.cc | 216 +++ .../native/src/utils/hr_display_sync_utils.cc | 101 ++ .../native/src/utils/hr_event_utils.cc | 62 + .../native/src/utils/hr_pixel_utils.cc | 35 + .../native/src/utils/hr_text_convert_utils.cc | 142 ++ .../renderer/native/src/utils/hr_url_utils.cc | 87 + .../native/src/virtual/hr_virtual_view.cc | 29 + .../src/virtual/hr_virtual_view_manager.cc | 69 + .../main/ets/hippy_framework/HippyEngine.ets | 289 ++++ .../hippy_framework/HippyEngineContext.ets | 82 + .../HippyEngineContextImpl.ets | 348 ++++ .../HippyEngineManagerImpl.ets | 420 +++++ .../hippy_framework/HippyGlobalConfigs.ets | 184 ++ .../hippy_framework/HippyResourceLoader.ets | 114 ++ .../adapter/device/DefaultDeviceAdapter.ets | 32 + .../adapter/device/HippyDeviceAdapter.ets | 27 + .../exception/DefaultExceptionHandler.ets | 37 + .../HippyExceptionHandlerAdapter.ets | 29 + .../DefaultExecutorSupplierAdapter.ets | 57 + .../executor/HippyExecutorSupplierAdapter.ets | 30 + .../adapter/file/FileRequestAdapter.ets | 122 ++ .../adapter/file/HippyFileAdapter.ets | 28 + .../adapter/font/DefaultFontScaleAdapter.ets | 38 + .../adapter/font/HippyFontScaleAdapter.ets | 30 + .../adapter/http/DefaultHttpAdapter.ets | 216 +++ .../adapter/http/HippyHttpAdapter.ets | 44 + .../adapter/http/HippyHttpHeader.ets | 53 + .../adapter/http/HippyHttpRequest.ets | 221 +++ .../adapter/http/HippyHttpResponse.ets | 54 + .../adapter/http/HttpTaskCallbackImpl.ets | 67 + .../adapter/log/DefaultLogAdapter.ets | 43 + .../adapter/log/HippyLogAdapter.ets | 30 + .../monitor/DefaultEngineMonitorAdapter.ets | 56 + .../monitor/HippyEngineMonitorAdapter.ets | 38 + .../soloader/DefaultSoLoaderAdapter.ets | 26 + .../adapter/soloader/HippySoLoaderAdapter.ets | 23 + .../adapter/storage/DefaultStorageAdapter.ets | 144 ++ .../adapter/storage/HippyStorageAdapter.ets | 37 + .../storage/PreferencesStorageAdapter.ets | 113 ++ .../thirdparty/HippyThirdPartyAdapter.ets | 47 + .../bridge/HippyAPIProvider.ets | 35 + .../hippy_framework/bridge/HippyBridge.ets | 49 + .../bridge/HippyBridgeImpl.ets | 201 +++ .../bridge/HippyBridgeManager.ets | 47 + .../bridge/HippyBridgeManagerImpl.ets | 379 ++++ .../bridge/HippyCallNativeParams.ets | 39 + .../bundleloader/HippyAssetBundleLoader.ets | 95 + .../bridge/bundleloader/HippyBundleLoader.ets | 32 + .../bundleloader/HippyFileBundleLoader.ets | 78 + .../bundleloader/HippyRemoteBundleLoader.ets | 80 + .../common/HippyJsException.ets | 27 + .../hippy_framework/connector/DomManager.ets | 80 + .../hippy_framework/connector/JsDriver.ets | 231 +++ .../connector/NativeCallback.ets | 20 + .../connector/NativeRenderer.ets | 69 + .../devsupport/DevFloatButton.ets | 180 ++ .../devsupport/DevRemoteServerData.ets | 105 ++ .../devsupport/DevServerCallBack.ets | 32 + .../devsupport/DevServerConfig.ets | 50 + .../devsupport/DevServerHelper.ets | 72 + .../devsupport/DevServerImpl.ets | 175 ++ .../devsupport/DevServerInterface.ets | 41 + .../devsupport/DevSupportManager.ets | 77 + .../devsupport/DevtoolsManager.ets | 87 + .../src/main/ets/hippy_framework/index.ets | 42 + .../modules/HippyModuleManager.ets | 37 + .../modules/HippyModuleManagerImpl.ets | 222 +++ .../modules/HippyModulePromise.ets | 33 + .../modules/HippyModulePromiseImpl.ets | 80 + .../modules/javascript/Dimensions.ets | 26 + .../modules/javascript/EventDispatcher.ets | 46 + .../javascript/HippyJavaScriptModuleBase.ets | 35 + .../modules/native/HippyNativeModuleBase.ets | 47 + .../native/audio/AudioPlayerModule.ets | 248 +++ .../modules/native/console/ConsoleModule.ets | 74 + .../modules/native/debug/DevMenuModule.ets | 54 + .../native/deviceevent/DeviceEventModule.ets | 86 + .../native/exception/ExceptionModule.ets | 70 + .../native/image/ImageLoaderModule.ets | 153 ++ .../hippy_framework/modules/native/index.ets | 31 + .../modules/native/netinfo/NetInfoModule.ets | 147 ++ .../modules/native/network/NetworkModule.ets | 208 +++ .../native/network/WebSocketModule.ets | 228 +++ .../modules/native/storage/StorageModule.ets | 147 ++ .../modules/native/utils/UtilsModule.ets | 104 ++ .../native/viewmanager/ViewManagerModule.ets | 56 + .../modules/turbo/TurboModuleManager.ets | 42 + .../serialization/ArrayBufferViewTag.ets | 53 + .../serialization/Deserializer.ets | 441 +++++ .../serialization/ErrorTag.ets | 47 + .../serialization/JSSerializationTag.ets | 46 + .../serialization/Serializer.ets | 69 + .../main/ets/hippy_library/HippyLibrary.ets | 134 ++ .../ohos/src/main/ets/hippy_library/index.ets | 20 + .../ets/renderer_native/FrameworkProxy.ets | 54 + .../renderer_native/HippyBizViewBuilder.ets | 21 + .../ets/renderer_native/HippyRenderView.ets | 142 ++ .../HippyRenderViewBuilder.ets | 135 ++ .../ets/renderer_native/HippyRootView.ets | 239 +++ .../renderer_native/HippyRootViewManager.ets | 36 + .../ets/renderer_native/HippyViewEvent.ets | 34 + .../IHippyRenderExceptionListener.ets | 24 + .../main/ets/renderer_native/NativeRender.ets | 88 + .../NativeRenderBuilderForCApi.ets | 93 + .../renderer_native/NativeRenderContext.ets | 57 + .../ets/renderer_native/NativeRenderImpl.ets | 801 +++++++++ .../renderer_native/NativeRenderProvider.ets | 353 ++++ .../NativeRenderProviderManager.ets | 36 + .../components/HippyRenderRegisterMap.ets | 63 + .../components/base/HippyRenderBaseView.ets | 768 +++++++++ .../custom/HippyCustomComponentView.ets | 57 + .../components/image/HRImageView.ets | 504 ++++++ .../components/image/ImageDataSupplier.ets | 23 + .../components/image/ImageDecoderAdapter.ets | 22 + .../components/image/ImageLoader.ets | 82 + .../components/image/ImageLoaderAdapter.ets | 29 + .../components/image/ImageRequestListener.ets | 43 + .../components/list/HRList.ets | 449 +++++ .../components/list/HRListDataSource.ets | 62 + .../components/list/HRListItemView.ets | 163 ++ .../components/list/HRListView.ets | 162 ++ .../components/modal/HRModalView.ets | 180 ++ .../components/pager/HRViewPager.ets | 234 +++ .../components/pager/HRViewPagerItem.ets | 88 + .../components/pullfooter/HRPullFooter.ets | 124 ++ .../components/pullheader/HRPullHeader.ets | 160 ++ .../refreshwrapper/HRRefreshWrapper.ets | 184 ++ .../refreshwrapper/HRRefreshWrapperItem.ets | 79 + .../components/richtext/FontAdapter.ets | 30 + .../components/richtext/HRRichTextView.ets | 350 ++++ .../components/scroller/HRScrollView.ets | 321 ++++ .../components/textinput/HRTextInputView.ets | 584 +++++++ .../components/view/HRDivView.ets | 182 ++ .../components/waterfall/HRWaterfall.ets | 241 +++ .../waterfall/HRWaterfallDataSource.ets | 91 + .../waterfall/HRWaterfallItemView.ets | 112 ++ .../components/waterfall/HRWaterfallView.ets | 130 ++ .../components/web/HRWebView.ets | 247 +++ .../renderer_native/dom_node/HRNodeProps.ets | 168 ++ .../src/main/ets/renderer_native/index.ets | 30 + .../renderer_native/node/HRVirtualNode.ets | 32 + .../node/HRVirtualNodeManager.ets | 62 + .../NativeRenderDeserializer.ets | 219 +++ .../NativeRenderSerializationTag.ets | 34 + .../serialization/NativeRenderSerializer.ets | 102 ++ .../uimanager/HRBuilderNodeManager.ets | 76 + .../uimanager/HRGestureDispatcher.ets | 47 + .../renderer_native/uimanager/HRManager.ets | 86 + .../renderer_native/uimanager/HRMutation.ets | 132 ++ .../uimanager/HRViewManager.ets | 365 ++++ .../renderer_native/utils/HRConvertUtil.ets | 290 ++++ .../utils/HRDisplaySyncUtils.ets | 114 ++ .../renderer_native/utils/HRDownloadUtils.ets | 81 + .../renderer_native/utils/HREventUtils.ets | 159 ++ .../ets/renderer_native/utils/HRMeasure.ets | 35 + .../ets/renderer_native/utils/HRTypes.ets | 78 + .../renderer_native/utils/HRValueUtils.ets | 75 + .../PrimitiveSerializationTag.ets | 39 + .../PrimitiveValueDeserializer.ets | 262 +++ .../PrimitiveValueSerializer.ets | 149 ++ .../ets/serialization/SharedSerialization.ets | 95 + .../ets/serialization/reader/BinaryReader.ets | 106 ++ .../string/DirectStringTable.ets | 58 + .../string/InternalizedStringTable.ets | 181 ++ .../serialization/string/StringEncoding.ets | 24 + .../serialization/string/StringLocation.ets | 35 + .../ets/serialization/string/StringTable.ets | 32 + .../ets/serialization/writer/BinaryWriter.ets | 101 ++ .../support/annotation/HippyNativeModule.ets | 35 + .../ets/support/common/HippyException.ets | 38 + .../main/ets/support/common/HippyExecutor.ets | 211 +++ .../main/ets/support/common/HippyTypes.ets | 29 + framework/ohos/src/main/ets/support/index.ets | 24 + .../main/ets/support/utils/ArgumentUtils.ets | 166 ++ .../main/ets/support/utils/DimensionsUtil.ets | 135 ++ .../src/main/ets/support/utils/I18nUtil.ets | 41 + .../src/main/ets/support/utils/LogUtils.ets | 71 + .../src/main/ets/support/utils/PixelUtil.ets | 74 + .../src/main/ets/support/utils/TextUtils.ets | 59 + .../main/ets/support/utils/TimeMonitor.ets | 185 ++ .../src/main/ets/support/utils/UrlUtils.ets | 27 + .../src/main/ets/support/workers/worker.ets | 34 + .../src/main/ets/vfs/DefaultProcessor.ets | 49 + .../main/ets/vfs/FetchResourceCallback.ets | 38 + framework/ohos/src/main/ets/vfs/Processor.ets | 40 + .../src/main/ets/vfs/ProcessorCallback.ets | 24 + .../src/main/ets/vfs/ResourceDataHolder.ets | 204 +++ .../ohos/src/main/ets/vfs/ResourceLoader.ets | 31 + .../ohos/src/main/ets/vfs/VfsManager.ets | 248 +++ framework/ohos/src/main/module.json5 | 25 + .../main/resources/base/element/string.json | 8 + .../main/resources/en_US/element/string.json | 8 + .../main/resources/zh_CN/element/string.json | 8 + framework/ohos/src/test/List.test.ets | 5 + framework/ohos/src/test/LocalUnit.test.ets | 33 + hippy.podspec | 23 +- hvigor/hvigor-config.json5 | 17 + hvigorfile.ts | 28 + modules/footstone/CMakeLists.txt | 5 + modules/footstone/include/footstone/logging.h | 29 +- .../include/footstone/string_view_utils.h | 6 +- .../footstone/include/footstone/task_runner.h | 3 + modules/footstone/include/footstone/worker.h | 1 + modules/footstone/src/platform/adr/logging.cc | 3 + modules/footstone/src/platform/ios/logging.cc | 3 + .../footstone/src/platform/ohos/logging.cc | 118 ++ .../src/platform/ohos/worker_impl.cc | 36 + modules/footstone/src/worker_manager.cc | 6 +- modules/ohos/oh_napi/CMakeLists.txt | 59 + .../include/oh_napi/abstract_task_runner.h | 35 + modules/ohos/oh_napi/include/oh_napi/ark_ts.h | 141 ++ .../oh_napi/include/oh_napi/data_holder.h | 42 + .../include/oh_napi/oh_napi_invocation.h | 60 + .../oh_napi/include/oh_napi/oh_napi_object.h | 58 + .../include/oh_napi/oh_napi_object_builder.h | 58 + .../include/oh_napi/oh_napi_register.h | 82 + .../include/oh_napi/oh_napi_task_runner.h | 58 + .../oh_napi/include/oh_napi/oh_napi_utils.h | 34 + modules/ohos/oh_napi/src/ark_ts.cc | 403 +++++ modules/ohos/oh_napi/src/data_holder.cc | 63 + .../ohos/oh_napi/src/oh_napi_invocation.cc | 72 + modules/ohos/oh_napi/src/oh_napi_object.cc | 47 + .../oh_napi/src/oh_napi_object_builder.cc | 83 + modules/ohos/oh_napi/src/oh_napi_register.cc | 66 + .../ohos/oh_napi/src/oh_napi_task_runner.cc | 99 ++ modules/ohos/oh_napi/src/oh_napi_utils.cc | 116 ++ modules/vfs/CMakeLists.txt | 2 + modules/vfs/native/CMakeLists.txt | 8 +- modules/vfs/ohos/CMakeLists.txt | 64 + .../ohos/include/vfs/handler/asset_handler.h | 68 + .../ohos/include/vfs/handler/file_handler.h | 57 + .../vfs/handler/napi_delegate_handler.h | 73 + modules/vfs/ohos/include/vfs/uri.h | 49 + .../vfs/ohos/include/vfs/vfs_manager_napi.h | 30 + .../ohos/include/vfs/vfs_resource_holder.h | 60 + modules/vfs/ohos/src/handler/asset_handler.cc | 196 +++ modules/vfs/ohos/src/handler/file_handler.cc | 90 + .../ohos/src/handler/napi_delegate_handler.cc | 268 +++ modules/vfs/ohos/src/uri.cc | 60 + modules/vfs/ohos/src/vfs_manager_napi.cc | 96 ++ modules/vfs/ohos/src/vfs_resource_holder.cc | 191 ++ oh-package.json5 | 13 + .../ios/renderer/component/view/HippyView.h | 4 + .../ios/renderer/component/view/HippyView.m | 79 +- .../component/view/HippyViewInnerLayer.h | 49 + .../component/view/HippyViewInnerLayer.m | 222 +++ .../component/view/HippyViewManager.mm | 2 + .../component/view/UIBezierPath+HippyShadow.h | 32 + .../component/view/UIBezierPath+HippyShadow.m | 104 ++ 654 files changed, 58565 insertions(+), 150 deletions(-) create mode 100644 AppScope/app.json5 create mode 100644 AppScope/resources/base/element/string.json create mode 100644 AppScope/resources/base/media/app_icon.png create mode 100644 build-profile.json5 create mode 100644 devtools/devtools-integration/ohos/CMakeLists.txt create mode 100644 devtools/devtools-integration/ohos/include/devtools_napi.h create mode 100644 devtools/devtools-integration/ohos/src/devtools_napi.cc create mode 100644 driver/js/examples/hippy-react-demo/scripts/hippy-webpack.ohos-vendor.js create mode 100644 driver/js/examples/hippy-react-demo/scripts/hippy-webpack.ohos.js create mode 100644 driver/js/examples/hippy-vue-demo/scripts/hippy-webpack.ohos-vendor.js create mode 100644 driver/js/examples/hippy-vue-demo/scripts/hippy-webpack.ohos.js create mode 100644 driver/js/examples/hippy-vue-next-demo/scripts/hippy-webpack.ohos-vendor.js create mode 100644 driver/js/examples/hippy-vue-next-demo/scripts/hippy-webpack.ohos.js create mode 100644 driver/js/include/driver/napi/jsh/jsh_class_definition.h create mode 100644 driver/js/include/driver/napi/jsh/jsh_ctx.h create mode 100644 driver/js/include/driver/napi/jsh/jsh_ctx_value.h create mode 100644 driver/js/include/driver/napi/jsh/jsh_try_catch.h create mode 100644 driver/js/include/driver/vm/jsh/jsh_vm.h create mode 100644 driver/js/lib/bridge/ohos/js2native.js create mode 100644 driver/js/lib/bridge/ohos/native2js.js create mode 100644 driver/js/lib/entry/ohos/hippy.js create mode 100644 driver/js/lib/global/ohos/Turbo.js create mode 100644 driver/js/lib/global/ohos/global.js create mode 100644 driver/js/src/napi/jsh/jsh_class_definition.cc create mode 100644 driver/js/src/napi/jsh/jsh_ctx.cc create mode 100644 driver/js/src/napi/jsh/jsh_try_catch.cc create mode 100644 driver/js/src/vm/jsh/jsh_vm.cc create mode 100644 driver/js/src/vm/jsh/native_source_code_ohos.cc create mode 100644 driver/js/static/hippy-react/asyncComponentFromHttp.android.js create mode 100644 driver/js/static/hippy-react/asyncComponentFromHttp.ios.js create mode 100644 driver/js/static/hippy-react/asyncComponentFromHttp.ohos.js create mode 100644 driver/js/static/hippy-vue-next/asyncComponentFromHttp.android.js create mode 100644 driver/js/static/hippy-vue-next/asyncComponentFromHttp.ios.js create mode 100644 driver/js/static/hippy-vue-next/asyncComponentFromHttp.ohos.js create mode 100644 driver/js/static/hippy-vue/asyncComponentFromHttp.android.js create mode 100644 driver/js/static/hippy-vue/asyncComponentFromHttp.ios.js create mode 100644 driver/js/static/hippy-vue/asyncComponentFromHttp.ohos.js create mode 100644 framework/examples/ohos-demo/.clang-format create mode 100644 framework/examples/ohos-demo/.clang-tidy create mode 100644 framework/examples/ohos-demo/.clangd create mode 100644 framework/examples/ohos-demo/build-profile.json5 create mode 100644 framework/examples/ohos-demo/hvigorfile.ts create mode 100644 framework/examples/ohos-demo/obfuscation-rules.txt create mode 100644 framework/examples/ohos-demo/oh-package.json5 create mode 120000 framework/examples/ohos-demo/oh_modules/hippy create mode 100644 framework/examples/ohos-demo/src/main/cpp/CMakeLists.txt create mode 100644 framework/examples/ohos-demo/src/main/cpp/hippy_extend/include/example_view_a.h create mode 100644 framework/examples/ohos-demo/src/main/cpp/hippy_extend/include/example_view_b.h create mode 100644 framework/examples/ohos-demo/src/main/cpp/hippy_extend/src/example_view_a.cc create mode 100644 framework/examples/ohos-demo/src/main/cpp/hippy_extend/src/example_view_b.cc create mode 100644 framework/examples/ohos-demo/src/main/cpp/hippy_extend/src/example_view_provider.cc create mode 100644 framework/examples/ohos-demo/src/main/ets/entryability/EntryAbility.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/fonts/TTTGB.otf create mode 100755 framework/examples/ohos-demo/src/main/ets/hippy_extend/ExampleAPIProvider.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/hippy_extend/ExampleMenuView.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/hippy_extend/ExampleNativeModule.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/hippy_extend/ExampleNativeTurboModule.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/hippy_extend/ExampleViewA.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/hippy_extend/ExampleViewB.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/hippy_extend/turbo/TurboConfig.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/pages/DriverSetting.ets create mode 100755 framework/examples/ohos-demo/src/main/ets/pages/Index.ets create mode 100755 framework/examples/ohos-demo/src/main/ets/pages/PageConfiguration.ets create mode 100755 framework/examples/ohos-demo/src/main/ets/pages/PageManagement.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/pages/PageSetting.ets create mode 100644 framework/examples/ohos-demo/src/main/ets/pages/RendererSetting.ets create mode 100644 framework/examples/ohos-demo/src/main/module.json5 create mode 100644 framework/examples/ohos-demo/src/main/resources/base/element/color.json create mode 100644 framework/examples/ohos-demo/src/main/resources/base/element/string.json create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/add_page_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/back_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/delete_page_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/devtool.svg create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/hippy_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/ic_back.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/ic_launcher.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/icon.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/logo_1x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_config_create_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_config_debug_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_config_debug_off_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_config_debug_on_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_config_driver_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_config_forward_4x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_config_render_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_item_add_4x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_item_tips_4x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_management_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_management_pressed_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/page_setting_building_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/setting_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/setting_pressed_2x.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/startIcon.png create mode 100644 framework/examples/ohos-demo/src/main/resources/base/media/start_prompt_2x.png create mode 100755 framework/examples/ohos-demo/src/main/resources/base/profile/main_pages.json create mode 100644 framework/examples/ohos-demo/src/main/resources/en_US/element/string.json create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/fonts/TTTGB.otf create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/assets/defaultSource.jpg create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/assets/hippyLogoWhite.png create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/asyncComponentFromHttp.android.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/asyncComponentFromHttp.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/asyncComponentFromLocal.android.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/asyncComponentFromLocal.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/index.android.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/index.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/vendor-manifest.json create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/vendor.android.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/react/vendor.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue2/assets/defaultSource.jpg create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue2/assets/hippyLogoWhite.png create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue2/asyncComponentFromHttp.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue2/asyncComponentFromLocal.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue2/index.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue2/vendor-manifest.json create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue2/vendor.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/assets/defaultSource.jpg create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/assets/hippyLogoWhite.png create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/asyncComponentFromHttp.android.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/asyncComponentFromHttp.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/asyncComponentFromLocal.android.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/asyncComponentFromLocal.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/index.android.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/index.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/vendor-manifest.json create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/vendor.android.js create mode 100644 framework/examples/ohos-demo/src/main/resources/rawfile/vue3/vendor.ohos.js create mode 100644 framework/examples/ohos-demo/src/main/resources/resfile/fonts/TTTGB.otf create mode 100644 framework/examples/ohos-demo/src/main/resources/zh_CN/element/string.json create mode 100644 framework/examples/ohos-demo/src/ohosTest/ets/test/Ability.test.ets create mode 100644 framework/examples/ohos-demo/src/ohosTest/ets/test/List.test.ets create mode 100644 framework/examples/ohos-demo/src/ohosTest/ets/testability/TestAbility.ets create mode 100644 framework/examples/ohos-demo/src/ohosTest/ets/testability/pages/Index.ets create mode 100644 framework/examples/ohos-demo/src/ohosTest/ets/testrunner/OpenHarmonyTestRunner.ets create mode 100644 framework/examples/ohos-demo/src/ohosTest/module.json5 create mode 100644 framework/examples/ohos-demo/src/ohosTest/resources/base/element/color.json create mode 100644 framework/examples/ohos-demo/src/ohosTest/resources/base/element/string.json create mode 100644 framework/examples/ohos-demo/src/ohosTest/resources/base/media/icon.png create mode 100644 framework/examples/ohos-demo/src/ohosTest/resources/base/profile/test_pages.json create mode 100644 framework/examples/ohos-demo/src/test/List.test.ets create mode 100644 framework/examples/ohos-demo/src/test/LocalUnit.test.ets create mode 100644 framework/examples/ohos-har-demo/.gitignore create mode 100644 framework/examples/ohos-har-demo/build-profile.json5 create mode 100644 framework/examples/ohos-har-demo/hvigorfile.ts create mode 100644 framework/examples/ohos-har-demo/obfuscation-rules.txt create mode 100644 framework/examples/ohos-har-demo/oh-package.json5 create mode 100644 framework/examples/ohos-har-demo/src/main/ets/entryability/EntryAbility.ets create mode 100644 framework/examples/ohos-har-demo/src/main/ets/entrybackupability/EntryBackupAbility.ets create mode 100644 framework/examples/ohos-har-demo/src/main/ets/pages/Index.ets create mode 100644 framework/examples/ohos-har-demo/src/main/module.json5 create mode 100644 framework/examples/ohos-har-demo/src/main/resources/base/element/color.json create mode 100644 framework/examples/ohos-har-demo/src/main/resources/base/element/string.json create mode 100644 framework/examples/ohos-har-demo/src/main/resources/base/media/background.png create mode 100644 framework/examples/ohos-har-demo/src/main/resources/base/media/foreground.png create mode 100644 framework/examples/ohos-har-demo/src/main/resources/base/media/layered_image.json create mode 100644 framework/examples/ohos-har-demo/src/main/resources/base/media/startIcon.png create mode 100644 framework/examples/ohos-har-demo/src/main/resources/base/profile/backup_config.json create mode 100644 framework/examples/ohos-har-demo/src/main/resources/base/profile/main_pages.json create mode 100644 framework/examples/ohos-har-demo/src/main/resources/en_US/element/string.json create mode 100644 framework/examples/ohos-har-demo/src/main/resources/rawfile/vue2/assets/defaultSource.jpg create mode 100644 framework/examples/ohos-har-demo/src/main/resources/rawfile/vue2/assets/hippyLogoWhite.png create mode 100644 framework/examples/ohos-har-demo/src/main/resources/rawfile/vue2/asyncComponentFromHttp.ohos.js create mode 100644 framework/examples/ohos-har-demo/src/main/resources/rawfile/vue2/asyncComponentFromLocal.ohos.js create mode 100644 framework/examples/ohos-har-demo/src/main/resources/rawfile/vue2/index.ohos.js create mode 100644 framework/examples/ohos-har-demo/src/main/resources/rawfile/vue2/vendor-manifest.json create mode 100644 framework/examples/ohos-har-demo/src/main/resources/rawfile/vue2/vendor.ohos.js create mode 100644 framework/examples/ohos-har-demo/src/main/resources/zh_CN/element/string.json create mode 100644 framework/examples/ohos-har-demo/src/mock/mock-config.json5 create mode 100644 framework/examples/ohos-har-demo/src/ohosTest/ets/test/Ability.test.ets create mode 100644 framework/examples/ohos-har-demo/src/ohosTest/ets/test/List.test.ets create mode 100644 framework/examples/ohos-har-demo/src/ohosTest/module.json5 create mode 100644 framework/examples/ohos-har-demo/src/test/List.test.ets create mode 100644 framework/examples/ohos-har-demo/src/test/LocalUnit.test.ets create mode 100644 framework/ohos/CHANGELOG.md create mode 100644 framework/ohos/LICENSE create mode 100644 framework/ohos/README.md create mode 100644 framework/ohos/build-profile.json5 create mode 100644 framework/ohos/consumer-rules.txt create mode 100644 framework/ohos/hvigorfile.ts create mode 100644 framework/ohos/index.ets create mode 100644 framework/ohos/obfuscation-rules.txt create mode 100644 framework/ohos/oh-package.json5 create mode 100644 framework/ohos/src/main/cpp/CMakeLists.txt create mode 100644 framework/ohos/src/main/cpp/impl/CMakeLists.txt create mode 100644 framework/ohos/src/main/cpp/impl/connector/CMakeLists.txt create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/ark2js.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/arkts_turbo_module.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/bridge.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/dom_manager_napi.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/exception_handler.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/js2ark.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/js_driver_napi.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/native_renderer_napi.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/setting_napi.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/turbo.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/turbo.utils.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/include/connector/turbo_module_manager.h create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/ark2js.cc create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/arkts_turbo_module.cc create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/dom_manager_napi.cc create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/exception_handler.cc create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/js2ark.cc create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/js_driver_napi.cc create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/native_renderer_napi.cc create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/setting_napi.cc create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/turbo_module_manager.cc create mode 100644 framework/ohos/src/main/cpp/impl/connector/src/turbo_utils.cc create mode 100644 framework/ohos/src/main/cpp/impl/entry.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/CMakeLists.txt create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/api/hippy_view_provider.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/arkui_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/arkui_node_registry.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/column_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/custom_ts_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/dialog_controller.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/image_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/image_span_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/list_item_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/list_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/native_dialog_api.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/native_node_api.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/refresh_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/row_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/scroll_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/span_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/stack_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/swiper_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/text_area_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/text_input_base_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/text_input_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/text_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/water_flow_item_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/arkui/water_flow_node.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/base_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/custom_ts_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/custom_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/div_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/hippy_render_view_creator.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/image_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/list_item_adapter.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/list_item_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/list_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/modal_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/pager_item_adapter.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/pager_item_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/pager_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/pull_footer_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/pull_header_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/refresh_wrapper_item_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/refresh_wrapper_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/rich_text_image_span_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/rich_text_span_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/rich_text_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/root_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/scroll_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/text_input_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/waterfall_item_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/components/waterfall_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/dom_node/hr_node_props.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/native_render.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/native_render_context.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/native_render_impl.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/native_render_manager.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/native_render_params.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/native_render_provider.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/native_render_provider_capi.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/native_render_provider_manager.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/native_render_provider_napi.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/recycle/recycle_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/text_measure/font_collection_manager.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/text_measure/text_measure_manager.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/text_measure/text_measurer.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/uimanager/hr_gesture_dispatcher.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/uimanager/hr_manager.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/uimanager/hr_mutation.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/uimanager/hr_view_manager.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/utils/hr_convert_utils.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/utils/hr_display_sync_utils.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/utils/hr_event_utils.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/utils/hr_pixel_utils.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/utils/hr_text_convert_utils.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/utils/hr_types.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/utils/hr_url_utils.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/utils/hr_value_utils.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/virtual/hr_virtual_view.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/include/renderer/virtual/hr_virtual_view_manager.h create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/api/hippy_view_provider.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/arkui_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/arkui_node_registry.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/column_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/custom_ts_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/dialog_controller.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/image_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/image_span_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/list_item_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/list_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/native_dialog_api.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/native_node_api.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/refresh_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/row_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/scroll_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/span_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/stack_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/swiper_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/text_area_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/text_input_base_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/text_input_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/text_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/water_flow_item_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/arkui/water_flow_node.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/base_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/custom_ts_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/custom_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/div_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/hippy_render_view_creator.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/image_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/list_item_adapter.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/list_item_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/list_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/modal_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/pager_item_adapter.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/pager_item_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/pager_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/pull_footer_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/pull_header_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/refresh_wrapper_item_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/refresh_wrapper_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/rich_text_image_span_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/rich_text_span_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/rich_text_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/root_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/scroll_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/text_input_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/waterfall_item_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/components/waterfall_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/native_render_context.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/native_render_impl.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/native_render_manager.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/native_render_params.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/native_render_provider.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/native_render_provider_capi.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/native_render_provider_manager.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/native_render_provider_napi.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/recycle/recycle_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/text_measure/font_collection_manager.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/text_measure/text_measure_manager.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/text_measure/text_measurer.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/uimanager/hr_gesture_dispatcher.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/uimanager/hr_manager.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/uimanager/hr_mutation.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/uimanager/hr_view_manager.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/utils/hr_convert_utils.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/utils/hr_display_sync_utils.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/utils/hr_event_utils.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/utils/hr_pixel_utils.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/utils/hr_text_convert_utils.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/utils/hr_url_utils.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/virtual/hr_virtual_view.cc create mode 100644 framework/ohos/src/main/cpp/impl/renderer/native/src/virtual/hr_virtual_view_manager.cc create mode 100644 framework/ohos/src/main/ets/hippy_framework/HippyEngine.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/HippyEngineContext.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/HippyEngineContextImpl.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/HippyEngineManagerImpl.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/HippyGlobalConfigs.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/HippyResourceLoader.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/device/DefaultDeviceAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/device/HippyDeviceAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/exception/DefaultExceptionHandler.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/exception/HippyExceptionHandlerAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/executor/DefaultExecutorSupplierAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/executor/HippyExecutorSupplierAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/file/FileRequestAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/file/HippyFileAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/font/DefaultFontScaleAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/font/HippyFontScaleAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/http/DefaultHttpAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/http/HippyHttpAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/http/HippyHttpHeader.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/http/HippyHttpRequest.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/http/HippyHttpResponse.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/http/HttpTaskCallbackImpl.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/log/DefaultLogAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/log/HippyLogAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/monitor/DefaultEngineMonitorAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/monitor/HippyEngineMonitorAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/soloader/DefaultSoLoaderAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/soloader/HippySoLoaderAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/storage/DefaultStorageAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/storage/HippyStorageAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/storage/PreferencesStorageAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/adapter/thirdparty/HippyThirdPartyAdapter.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/HippyAPIProvider.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/HippyBridge.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/HippyBridgeImpl.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/HippyBridgeManager.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/HippyBridgeManagerImpl.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/HippyCallNativeParams.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/bundleloader/HippyAssetBundleLoader.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/bundleloader/HippyBundleLoader.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/bundleloader/HippyFileBundleLoader.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/bridge/bundleloader/HippyRemoteBundleLoader.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/common/HippyJsException.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/connector/DomManager.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/connector/JsDriver.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/connector/NativeCallback.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/connector/NativeRenderer.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/devsupport/DevFloatButton.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/devsupport/DevRemoteServerData.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/devsupport/DevServerCallBack.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/devsupport/DevServerConfig.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/devsupport/DevServerHelper.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/devsupport/DevServerImpl.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/devsupport/DevServerInterface.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/devsupport/DevSupportManager.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/devsupport/DevtoolsManager.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/index.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/HippyModuleManager.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/HippyModuleManagerImpl.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/HippyModulePromise.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/HippyModulePromiseImpl.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/javascript/Dimensions.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/javascript/EventDispatcher.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/javascript/HippyJavaScriptModuleBase.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/HippyNativeModuleBase.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/audio/AudioPlayerModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/console/ConsoleModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/debug/DevMenuModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/deviceevent/DeviceEventModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/exception/ExceptionModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/image/ImageLoaderModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/index.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/netinfo/NetInfoModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/network/NetworkModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/network/WebSocketModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/storage/StorageModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/utils/UtilsModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/native/viewmanager/ViewManagerModule.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/modules/turbo/TurboModuleManager.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/serialization/ArrayBufferViewTag.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/serialization/Deserializer.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/serialization/ErrorTag.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/serialization/JSSerializationTag.ets create mode 100644 framework/ohos/src/main/ets/hippy_framework/serialization/Serializer.ets create mode 100644 framework/ohos/src/main/ets/hippy_library/HippyLibrary.ets create mode 100644 framework/ohos/src/main/ets/hippy_library/index.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/FrameworkProxy.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/HippyBizViewBuilder.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/HippyRenderView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/HippyRenderViewBuilder.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/HippyRootView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/HippyRootViewManager.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/HippyViewEvent.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/IHippyRenderExceptionListener.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/NativeRender.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/NativeRenderBuilderForCApi.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/NativeRenderContext.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/NativeRenderImpl.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/NativeRenderProvider.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/NativeRenderProviderManager.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/HippyRenderRegisterMap.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/base/HippyRenderBaseView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/custom/HippyCustomComponentView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/image/HRImageView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/image/ImageDataSupplier.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/image/ImageDecoderAdapter.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/image/ImageLoader.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/image/ImageLoaderAdapter.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/image/ImageRequestListener.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/list/HRList.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/list/HRListDataSource.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/list/HRListItemView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/list/HRListView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/modal/HRModalView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/pager/HRViewPager.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/pager/HRViewPagerItem.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/pullfooter/HRPullFooter.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/pullheader/HRPullHeader.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/refreshwrapper/HRRefreshWrapper.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/refreshwrapper/HRRefreshWrapperItem.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/richtext/FontAdapter.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/richtext/HRRichTextView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/scroller/HRScrollView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/textinput/HRTextInputView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/view/HRDivView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/waterfall/HRWaterfall.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/waterfall/HRWaterfallDataSource.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/waterfall/HRWaterfallItemView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/waterfall/HRWaterfallView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/components/web/HRWebView.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/dom_node/HRNodeProps.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/index.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/node/HRVirtualNode.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/node/HRVirtualNodeManager.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/serialization/NativeRenderDeserializer.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/serialization/NativeRenderSerializationTag.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/serialization/NativeRenderSerializer.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/uimanager/HRBuilderNodeManager.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/uimanager/HRGestureDispatcher.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/uimanager/HRManager.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/uimanager/HRMutation.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/uimanager/HRViewManager.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/utils/HRConvertUtil.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/utils/HRDisplaySyncUtils.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/utils/HRDownloadUtils.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/utils/HREventUtils.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/utils/HRMeasure.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/utils/HRTypes.ets create mode 100644 framework/ohos/src/main/ets/renderer_native/utils/HRValueUtils.ets create mode 100644 framework/ohos/src/main/ets/serialization/PrimitiveSerializationTag.ets create mode 100644 framework/ohos/src/main/ets/serialization/PrimitiveValueDeserializer.ets create mode 100644 framework/ohos/src/main/ets/serialization/PrimitiveValueSerializer.ets create mode 100644 framework/ohos/src/main/ets/serialization/SharedSerialization.ets create mode 100644 framework/ohos/src/main/ets/serialization/reader/BinaryReader.ets create mode 100644 framework/ohos/src/main/ets/serialization/string/DirectStringTable.ets create mode 100644 framework/ohos/src/main/ets/serialization/string/InternalizedStringTable.ets create mode 100644 framework/ohos/src/main/ets/serialization/string/StringEncoding.ets create mode 100644 framework/ohos/src/main/ets/serialization/string/StringLocation.ets create mode 100644 framework/ohos/src/main/ets/serialization/string/StringTable.ets create mode 100644 framework/ohos/src/main/ets/serialization/writer/BinaryWriter.ets create mode 100644 framework/ohos/src/main/ets/support/annotation/HippyNativeModule.ets create mode 100644 framework/ohos/src/main/ets/support/common/HippyException.ets create mode 100644 framework/ohos/src/main/ets/support/common/HippyExecutor.ets create mode 100644 framework/ohos/src/main/ets/support/common/HippyTypes.ets create mode 100644 framework/ohos/src/main/ets/support/index.ets create mode 100644 framework/ohos/src/main/ets/support/utils/ArgumentUtils.ets create mode 100644 framework/ohos/src/main/ets/support/utils/DimensionsUtil.ets create mode 100644 framework/ohos/src/main/ets/support/utils/I18nUtil.ets create mode 100644 framework/ohos/src/main/ets/support/utils/LogUtils.ets create mode 100644 framework/ohos/src/main/ets/support/utils/PixelUtil.ets create mode 100644 framework/ohos/src/main/ets/support/utils/TextUtils.ets create mode 100644 framework/ohos/src/main/ets/support/utils/TimeMonitor.ets create mode 100644 framework/ohos/src/main/ets/support/utils/UrlUtils.ets create mode 100644 framework/ohos/src/main/ets/support/workers/worker.ets create mode 100644 framework/ohos/src/main/ets/vfs/DefaultProcessor.ets create mode 100644 framework/ohos/src/main/ets/vfs/FetchResourceCallback.ets create mode 100644 framework/ohos/src/main/ets/vfs/Processor.ets create mode 100644 framework/ohos/src/main/ets/vfs/ProcessorCallback.ets create mode 100644 framework/ohos/src/main/ets/vfs/ResourceDataHolder.ets create mode 100644 framework/ohos/src/main/ets/vfs/ResourceLoader.ets create mode 100644 framework/ohos/src/main/ets/vfs/VfsManager.ets create mode 100644 framework/ohos/src/main/module.json5 create mode 100644 framework/ohos/src/main/resources/base/element/string.json create mode 100644 framework/ohos/src/main/resources/en_US/element/string.json create mode 100644 framework/ohos/src/main/resources/zh_CN/element/string.json create mode 100644 framework/ohos/src/test/List.test.ets create mode 100644 framework/ohos/src/test/LocalUnit.test.ets create mode 100644 hvigor/hvigor-config.json5 create mode 100644 hvigorfile.ts create mode 100644 modules/footstone/src/platform/ohos/logging.cc create mode 100644 modules/footstone/src/platform/ohos/worker_impl.cc create mode 100644 modules/ohos/oh_napi/CMakeLists.txt create mode 100644 modules/ohos/oh_napi/include/oh_napi/abstract_task_runner.h create mode 100644 modules/ohos/oh_napi/include/oh_napi/ark_ts.h create mode 100644 modules/ohos/oh_napi/include/oh_napi/data_holder.h create mode 100644 modules/ohos/oh_napi/include/oh_napi/oh_napi_invocation.h create mode 100644 modules/ohos/oh_napi/include/oh_napi/oh_napi_object.h create mode 100644 modules/ohos/oh_napi/include/oh_napi/oh_napi_object_builder.h create mode 100644 modules/ohos/oh_napi/include/oh_napi/oh_napi_register.h create mode 100644 modules/ohos/oh_napi/include/oh_napi/oh_napi_task_runner.h create mode 100644 modules/ohos/oh_napi/include/oh_napi/oh_napi_utils.h create mode 100644 modules/ohos/oh_napi/src/ark_ts.cc create mode 100644 modules/ohos/oh_napi/src/data_holder.cc create mode 100644 modules/ohos/oh_napi/src/oh_napi_invocation.cc create mode 100644 modules/ohos/oh_napi/src/oh_napi_object.cc create mode 100644 modules/ohos/oh_napi/src/oh_napi_object_builder.cc create mode 100644 modules/ohos/oh_napi/src/oh_napi_register.cc create mode 100644 modules/ohos/oh_napi/src/oh_napi_task_runner.cc create mode 100644 modules/ohos/oh_napi/src/oh_napi_utils.cc create mode 100644 modules/vfs/ohos/CMakeLists.txt create mode 100644 modules/vfs/ohos/include/vfs/handler/asset_handler.h create mode 100644 modules/vfs/ohos/include/vfs/handler/file_handler.h create mode 100644 modules/vfs/ohos/include/vfs/handler/napi_delegate_handler.h create mode 100644 modules/vfs/ohos/include/vfs/uri.h create mode 100644 modules/vfs/ohos/include/vfs/vfs_manager_napi.h create mode 100644 modules/vfs/ohos/include/vfs/vfs_resource_holder.h create mode 100644 modules/vfs/ohos/src/handler/asset_handler.cc create mode 100644 modules/vfs/ohos/src/handler/file_handler.cc create mode 100644 modules/vfs/ohos/src/handler/napi_delegate_handler.cc create mode 100644 modules/vfs/ohos/src/uri.cc create mode 100644 modules/vfs/ohos/src/vfs_manager_napi.cc create mode 100644 modules/vfs/ohos/src/vfs_resource_holder.cc create mode 100644 oh-package.json5 create mode 100644 renderer/native/ios/renderer/component/view/HippyViewInnerLayer.h create mode 100644 renderer/native/ios/renderer/component/view/HippyViewInnerLayer.m create mode 100644 renderer/native/ios/renderer/component/view/UIBezierPath+HippyShadow.h create mode 100644 renderer/native/ios/renderer/component/view/UIBezierPath+HippyShadow.m diff --git a/.gitignore b/.gitignore index 33cc2630ba5..f3eb78a9e39 100644 --- a/.gitignore +++ b/.gitignore @@ -106,3 +106,11 @@ framework/voltron/VoltronCore/VoltronCore.xcodeproj/project.xcworkspace framework/voltron/VoltronCore/VoltronCore.xcodeproj/xcuserdata/ renderer/voltron/core/lib/ + +.hvigor/ +oh_modules/* +oh-package-lock.json5 +.clang-format +.clang-tidy +.clangd +BuildProfile.ets diff --git a/AppScope/app.json5 b/AppScope/app.json5 new file mode 100644 index 00000000000..e0605ec6682 --- /dev/null +++ b/AppScope/app.json5 @@ -0,0 +1,10 @@ +{ + "app": { + "bundleName": "com.tencent.hippydemo", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name" + } +} diff --git a/AppScope/resources/base/element/string.json b/AppScope/resources/base/element/string.json new file mode 100644 index 00000000000..5d806813dd8 --- /dev/null +++ b/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string": [ + { + "name": "app_name", + "value": "HippyDemo" + } + ] +} diff --git a/AppScope/resources/base/media/app_icon.png b/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..cd45accb1dfd2fd0da16c732c72faa6e46b26521 GIT binary patch literal 2041 zcmaJ?c~nzZ9u6@;0AXaYAVN(;Kr(@>EJ+}skOWf=BA~*l4us@ELY9{%0m5QX6pnb} z(jZF|S&pLAS}3BZAfeQSvJ_h>F2Q1PYqi?o5`;m_yjZdG$1v}l_wK#F^L^iMz2}uD z#K$>1dON~kFlWvhW+Jp=tuN9J`ZlM-rl4h+ij|^D0y9;4JOuz-EdVnB6i3R-0ulk9 zApi4zAQA>!N9@-o026$1@L`d124`3G5<@_m`0f)Ug_Ie~;HT2q<_a=HH> zDwTdfD^-cW-|_xWVP$f@93UhDN-#&khZ>jZXLTi~$0`7x3REP6pk%&^2|`c>DutjN zMJD4Zs6Z}{FOpd;*mo2zm(GzXRXiCV;4m3zNCYnu3Fy=i5;2An&Lp!#LP;bRD~1&s z%VH6UY+}r6YDgG+p34OJIZ{BTn&%4s=CT&#TBkuOhdeU@g(w#guoa*b^)73=XyI65 z7Swys6)YS}?1EeZ6b!-I+yCnIya^g0>-NLsLWd8t56GZ_S3r|ZGbR+mV2ErEb9J)X zIF!njY-D-7{qtF2(?nlQ$0}!pzt=}hc*m%%)0Jb#N_K4@IC-`Pi5DahPZN7N9rH;ol;Gc*>-Go@gXKTM{eP)iJj6CYTIi}B#zLKZYD@_;m zrXmXXsFq@~ou-z!9bHoM8*(hwl>X(zm)TDcdkF4lZm$1jP*HbnD`o1$g}_R#+bu2D zr%7Y8KdsaC-V*aem5#@*M%r^GPgu%P2e-BnBClhP2yoGFe40>);=}>{NONtkXQ01p z)OX^t2Ojhddot9eg0WTIVSTNBa}7V-^_pO595w|Hx9q?k4dMp@$G7PK*TD=y;ck6J zdGRB!_RAI2nR3%tO1IkdWp*bw*?<=pM_LZb30?!oK)s;En( z!#nnd9=cXJ<}+e{XLdx(q3&ikJISe?eSHHohk+pz+$6Cv{ytvc{QXmMn2XQ9U8rvt zrJdAn(0gpSD@N=yTrI_2^P#*zQg7MTp1)k(lv(*(KtUR6@M|2WB>2wRwC-h=wk6XF zPtSes*_JwI+^d>xW489MJw5R6=t5?{R zc|E8i?RL@p9)A3ZJAQOg`}+F;<_vnWA!KxR#g%jZ@y_1Qu#Uw)kFPw_xmZ?a^e*1{ zM|ImtqA|(CaDQ@Fyvcof`MN66&VI6m6gAyAXx`%cDx6BI{Bj#}V*Rn1(b~;Am)D2u zX7(027IO?Z2VYK^1vXXpoZ@AtH~N?0rYWwtyA15`6vEf6fk&;o-L;7zFt`5nk*iOy z`<918zB+k;EytI$FAXug)jk*e@e};4e9g__w4A5ev!!)H$yC@{?vsRqJ##X1R%xPG z&_R3oDi$MtTkVqfPj)HEUDx_7wd!y{8#1%$U*Dd0sK@=#6+!XlsE-s^1f5E`R9Wo71^b~mbVdU;Fw0LG~mUQg;xsX4QYRo3B@rH_=ry>DE8ef!c2ta8UcI#26# zF|`*4wtMHe@%#eGZw`#Yj|QWuB`eRD)b~)r9mM95p_JVG%-IdcbIX5qG#GpGD+IrS zEqxb1Rg&Dadk5#7t4j68I1f!@A$efp1?I%&d*56)yl!tkz!14<$0Od_&6cGw$WW0r zjSlQA7l*6;vgfhv!cR|RmAD$+w6j`rVf=-?-D@q>kOseUVSb*~jbAS^*1h?ZL)n(9 zDa}`4etXO6`}9;{k5E^N{rcfnV_(LPwsDg``wtyS*V<19c3!PGJ3Kqy9ksvkwbJ%Z z*N(fT0{e*Wji-Ck5!3YE0j|PZ@&z`v=kitWL$bqSt!e4bH!+(|Q)CZ30^nVPfkx{s zX{6of`p=BiPb@u@IyL!tRk>?qgBqCmo-Zlt!636g?z`s~zdfwuB7DXZHvV`Usp+%Z zo*&;Biu@MHE&2j+?j^o`Cr12u<>vOe=a&8a2hlcmFjJiDR>XnD4c4DAhZWCkiAgW{ E51q9-lK=n! literal 0 HcmV?d00001 diff --git a/build-profile.json5 b/build-profile.json5 new file mode 100644 index 00000000000..660eb033a34 --- /dev/null +++ b/build-profile.json5 @@ -0,0 +1,57 @@ +{ + "app": { + "products": [ + { + "name": "default", + "signingConfig": "default", + "compatibleSdkVersion": "5.0.0(12)", + "runtimeOS": "HarmonyOS" + } + ], + "buildModeSet": [ + { + "name": "debug", + "buildOption": { + "externalNativeOptions": { + "abiFilters": [ + "arm64-v8a" + ] + } + } + }, + { + "name": "release" + } + ] + }, + "modules": [ + { + "name": "entry_har", + "srcPath": "./framework/examples/ohos-har-demo", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "entry", + "srcPath": "./framework/examples/ohos-demo", + "targets": [ + { + "name": "default", + "applyToProducts": [ + "default" + ] + } + ] + }, + { + "name": "hippy", + "srcPath": "./framework/ohos" + }, + ] +} diff --git a/buildconfig/cmake/GlobalPackagesModule.cmake b/buildconfig/cmake/GlobalPackagesModule.cmake index 061c633845f..166d9573910 100644 --- a/buildconfig/cmake/GlobalPackagesModule.cmake +++ b/buildconfig/cmake/GlobalPackagesModule.cmake @@ -45,6 +45,13 @@ function(GlobalPackages_Add_jni) endif() endfunction() +function(GlobalPackages_Add_oh_napi) + if (NOT TARGET oh_napi) + InfraPackage_Add(OH_NAPI + LOCAL "${PROJECT_ROOT_DIR}/modules/ohos/oh_napi") + endif() +endfunction() + function(GlobalPackages_Add_vfs) if (NOT TARGET vfs) InfraPackage_Add(VFS diff --git a/devtools/devtools-backend/CMakeLists.txt b/devtools/devtools-backend/CMakeLists.txt index e51e0c82a84..f319ec12b47 100644 --- a/devtools/devtools-backend/CMakeLists.txt +++ b/devtools/devtools-backend/CMakeLists.txt @@ -50,7 +50,11 @@ endif () # endregion # region footstone -GlobalPackages_Add(footstone) +if (OHOS) + GlobalPackages_Add_footstone() +else () + GlobalPackages_Add(footstone) +endif () target_link_libraries(${PROJECT_NAME} PRIVATE footstone) # endregion diff --git a/devtools/devtools-backend/include/api/adapter/data/domain_metas.h b/devtools/devtools-backend/include/api/adapter/data/domain_metas.h index 9a1e41b54bd..cdad49eedaf 100644 --- a/devtools/devtools-backend/include/api/adapter/data/domain_metas.h +++ b/devtools/devtools-backend/include/api/adapter/data/domain_metas.h @@ -22,7 +22,11 @@ #include #include +// nlohmann/json.hpp:3177:30: error: out-of-line definition of constexpr static data member is redundant in C++17 and is deprecated [-Werror,-Wdeprecated] +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated" #include "nlohmann/json.hpp" +#pragma clang diagnostic pop namespace hippy::devtools { diff --git a/devtools/devtools-backend/include/api/adapter/devtools_common_protocol_adapter.h b/devtools/devtools-backend/include/api/adapter/devtools_common_protocol_adapter.h index 4a188a21c72..7c02eccaa5b 100644 --- a/devtools/devtools-backend/include/api/adapter/devtools_common_protocol_adapter.h +++ b/devtools/devtools-backend/include/api/adapter/devtools_common_protocol_adapter.h @@ -19,6 +19,7 @@ */ #pragma once +#pragma clang diagnostic ignored "-Wdeprecated" #include #include "nlohmann/json.hpp" diff --git a/devtools/devtools-backend/include/tunnel/tcp/frame_codec.h b/devtools/devtools-backend/include/tunnel/tcp/frame_codec.h index 32a1bef8f29..176fe67d4d0 100644 --- a/devtools/devtools-backend/include/tunnel/tcp/frame_codec.h +++ b/devtools/devtools-backend/include/tunnel/tcp/frame_codec.h @@ -21,6 +21,7 @@ #pragma once #include +#include #include #include diff --git a/devtools/devtools-backend/src/tunnel/tcp/tcp_channel.cc b/devtools/devtools-backend/src/tunnel/tcp/tcp_channel.cc index 77fc77651a7..9a717d6eb93 100644 --- a/devtools/devtools-backend/src/tunnel/tcp/tcp_channel.cc +++ b/devtools/devtools-backend/src/tunnel/tcp/tcp_channel.cc @@ -20,6 +20,7 @@ #include "tunnel/tcp/tcp_channel.h" #include +#include #include #include #include diff --git a/devtools/devtools-integration/CMakeLists.txt b/devtools/devtools-integration/CMakeLists.txt index 6577bf9fc02..32c7b6dfdc0 100644 --- a/devtools/devtools-integration/CMakeLists.txt +++ b/devtools/devtools-integration/CMakeLists.txt @@ -30,4 +30,7 @@ elseif (ANDROID) add_subdirectory(${PROJECT_ROOT_DIR}/devtools/devtools-integration/android/src/main/cpp) elseif (IOS) add_subdirectory(${PROJECT_ROOT_DIR}/devtools/devtools-integration/ios) +elseif (OHOS) + add_subdirectory(${PROJECT_ROOT_DIR}/devtools/devtools-integration/ohos) endif() + diff --git a/devtools/devtools-integration/native/CMakeLists.txt b/devtools/devtools-integration/native/CMakeLists.txt index 8abcb8a90f5..55cffdd2799 100644 --- a/devtools/devtools-integration/native/CMakeLists.txt +++ b/devtools/devtools-integration/native/CMakeLists.txt @@ -51,22 +51,38 @@ endif () # endregion # region footstone -GlobalPackages_Add(footstone) +if (OHOS) + GlobalPackages_Add_footstone() +else () + GlobalPackages_Add(footstone) +endif () target_link_libraries(${PROJECT_NAME} PRIVATE footstone) # endregion # region vfs -GlobalPackages_Add(vfs) +if (OHOS) + GlobalPackages_Add_vfs() +else () + GlobalPackages_Add(vfs) +endif () target_link_libraries(${PROJECT_NAME} PRIVATE vfs) # endregion # region dom -GlobalPackages_Add(dom) +if (OHOS) + GlobalPackages_Add_dom() +else () + GlobalPackages_Add(dom) +endif () target_link_libraries(${PROJECT_NAME} PRIVATE dom) # endregion # region devtools -GlobalPackages_Add(devtools_backend) +if (OHOS) + GlobalPackages_Add_devtools_backend() +else () + GlobalPackages_Add(devtools_backend) +endif () target_link_libraries(${PROJECT_NAME} PRIVATE devtools_backend) # endregion diff --git a/devtools/devtools-integration/ohos/CMakeLists.txt b/devtools/devtools-integration/ohos/CMakeLists.txt new file mode 100644 index 00000000000..a6af6fdd0de --- /dev/null +++ b/devtools/devtools-integration/ohos/CMakeLists.txt @@ -0,0 +1,73 @@ +# +# Tencent is pleased to support the open source community by making +# Hippy available. +# +# Copyright (C) 2022 THL A29 Limited, a Tencent company. +# All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +cmake_minimum_required(VERSION 3.14) + +project("devtools_integration") + +get_filename_component(PROJECT_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../" REALPATH) + +include("${PROJECT_ROOT_DIR}/buildconfig/cmake/InfraPackagesModule.cmake") +include("${PROJECT_ROOT_DIR}/buildconfig/cmake/compiler_toolchain.cmake") + +set(CMAKE_CXX_STANDARD 17) + +# region library +add_library(${PROJECT_NAME} STATIC) +target_include_directories(${PROJECT_NAME} PUBLIC include) +target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS}) +# endregion + +# region jni +GlobalPackages_Add_oh_napi() +target_link_libraries(${PROJECT_NAME} PUBLIC oh_napi) +# endregion + +# region footstone +GlobalPackages_Add_footstone() +target_link_libraries(${PROJECT_NAME} PRIVATE footstone) +# endregion + +# region dom +GlobalPackages_Add_dom() +target_link_libraries(${PROJECT_NAME} PRIVATE dom) +# endregion + +# region vfs +GlobalPackages_Add_vfs() +target_link_libraries(${PROJECT_NAME} PRIVATE vfs) +# endregion + +# region devtools +GlobalPackages_Add_devtools_backend() +target_link_libraries(${PROJECT_NAME} PRIVATE devtools_backend) +# endregion + +# region devtools_integration +add_subdirectory(${PROJECT_ROOT_DIR}/devtools/devtools-integration/native ${CMAKE_CURRENT_BINARY_DIR}/devtools-integration/native) +target_link_libraries(${PROJECT_NAME} PUBLIC devtools_integration_native) +# endregion + +# region source set +set(SOURCE_SET + src/devtools_napi.cc) + +target_sources(${PROJECT_NAME} PUBLIC ${SOURCE_SET}) +# endregion diff --git a/devtools/devtools-integration/ohos/include/devtools_napi.h b/devtools/devtools-integration/ohos/include/devtools_napi.h new file mode 100644 index 00000000000..cca4ffa10b7 --- /dev/null +++ b/devtools/devtools-integration/ohos/include/devtools_napi.h @@ -0,0 +1,32 @@ +/* + * Tencent is pleased to support the open source community by making + * Hippy available. + * + * Copyright (C) 2022 THL A29 Limited, a Tencent company. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "footstone/string_view.h" +#include "footstone/task_runner.h" +#include +#include + +namespace hippy::devtools { + + +} + diff --git a/devtools/devtools-integration/ohos/src/devtools_napi.cc b/devtools/devtools-integration/ohos/src/devtools_napi.cc new file mode 100644 index 00000000000..e46c9d517b5 --- /dev/null +++ b/devtools/devtools-integration/ohos/src/devtools_napi.cc @@ -0,0 +1,207 @@ +/* + * + * Tencent is pleased to support the open source community by making + * Hippy available. + * + * Copyright (C) 2022 THL A29 Limited, a Tencent company. + * All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#include "footstone/string_view_utils.h" +#include "napi/native_api.h" +#include +#include +#include "oh_napi/data_holder.h" +#include "oh_napi/oh_napi_register.h" +#include "oh_napi/ark_ts.h" +#include "dom/dom_manager.h" +#include "dom/root_node.h" +#include "footstone/check.h" +#include "footstone/logging.h" +#include "footstone/persistent_object_map.h" +#include "footstone/task_runner.h" +#include "footstone/worker_impl.h" +#include "devtools_napi.h" +#include "devtools/devtools_data_source.h" + +namespace hippy::devtools { + +using WorkerManager = footstone::runner::WorkerManager; +using string_view = footstone::stringview::string_view; +using StringViewUtils = footstone::stringview::StringViewUtils; +constexpr uint32_t kPoolSize = 1; +constexpr char kDevToolsNapiTag[] = "DevTools-Napi:"; +std::shared_ptr worker_manager; +using DevtoolsDataSource = hippy::devtools::DevtoolsDataSource; + +static napi_value OnCreateDevtools(napi_env env, napi_callback_info info) { + // size_t requireArgc = 2; + ArkTS arkTs(env); + size_t argc = 2; + napi_value args[2] = {nullptr}; + + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + std::vector argVector = arkTs.GetCallbackArgs(info); + FOOTSTONE_DLOG(INFO) << "devtools napi::OnCreateDevtools::" << argVector.size(); + + if (argc != 2) { + napi_throw_error(env, nullptr, " Requires 2 arguments: data directory and WebSocket URL."); + return nullptr; + } + + napi_valuetype dirType = arkTs.GetType(args[0]); + napi_valuetype wsType = arkTs.GetType(args[1]); + if (!(dirType == napi_string && wsType == napi_string)) { + napi_throw_error(env, nullptr, "Both arguments must be strings."); + return nullptr; + } + + std::string data_dir = arkTs.GetString(args[0]); + std::string ws_url = arkTs.GetString(args[1]); + + worker_manager = std::make_shared(kPoolSize); + + DevtoolsDataSource::SetFileCacheDir(data_dir); + + auto devtools_data_source = + std::make_shared(); + devtools_data_source->CreateDevtoolsService(ws_url, worker_manager); + uint32_t id = devtools::DevtoolsDataSource::Insert(devtools_data_source); + + napi_value result = arkTs.CreateInt(static_cast(id)); + + return result; +} + +static napi_value OnDestroyDevtools(napi_env env, napi_callback_info info) { + ArkTS arkTs(env); + size_t argc = 2; + napi_value args[2] = {nullptr}; + + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + std::vector argVector = arkTs.GetCallbackArgs(info); + FOOTSTONE_DLOG(INFO) << "devtools napi::OnDestroyDevtools::" << argVector.size(); + + if (argc != 2) { + napi_throw_error(env, nullptr, " Requires 2 arguments: data directory and WebSocket URL."); + return nullptr; + } + + napi_valuetype devtoolsIdType = arkTs.GetType(args[0]); + napi_valuetype isReloadType = arkTs.GetType(args[1]); + if (!(devtoolsIdType == napi_number && isReloadType == napi_boolean)) { + napi_throw_error(env, nullptr, "Both arguments must be strings."); + return nullptr; + } + + int devtools_id = arkTs.GetInteger(args[0]); + bool is_reload = arkTs.GetBoolean(args[1]); + std::shared_ptr devtools_data_source = DevtoolsDataSource::Find(footstone::checked_numeric_cast(devtools_id)); + devtools_data_source->Destroy(is_reload); + bool flag = DevtoolsDataSource::Erase(footstone::checked_numeric_cast(devtools_id)); + FOOTSTONE_DLOG(INFO) << kDevToolsNapiTag << "OnDestroyDevtools devtools_id=" << devtools_id << ",flag=" << flag; + FOOTSTONE_DCHECK(flag); + worker_manager->Terminate(); + napi_value result = arkTs.GetUndefined(); + return result; +} + + +static napi_value OnBindDevtools(napi_env env, napi_callback_info info) { + ArkTS arkTs(env); + size_t argc = 4; + napi_value args[4] = {nullptr}; + + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + std::vector argVector = arkTs.GetCallbackArgs(info); + FOOTSTONE_DLOG(INFO) << "devtools napi::OnBindDevtools::" << argVector.size(); + + if (argc != 4) { + napi_throw_error(env, nullptr, " Requires 4 arguments: data directory and WebSocket URL."); + return nullptr; + } + + napi_valuetype devtoolsIdType = arkTs.GetType(args[0]); + // napi_valuetype driverIdType = arkTs.GetType(args[1]); + napi_valuetype domIdType = arkTs.GetType(args[2]); + // napi_valuetype renderIdType = arkTs.GetType(args[3]); + if (!(devtoolsIdType == napi_number && domIdType == napi_number)) { + napi_throw_error(env, nullptr, "Both arguments must be strings."); + return nullptr; + } + + int devtools_id = arkTs.GetInteger(args[0]); + // int driver_id = arkTs.GetInteger(args[1]); + int dom_id = arkTs.GetInteger(args[2]); + // int render_id = arkTs.GetInteger(args[3]); + std::shared_ptr devtools_data_source = + DevtoolsDataSource::Find(footstone::checked_numeric_cast(devtools_id)); + std::any dom_manager; + auto flag = hippy::global_data_holder.Find(footstone::checked_numeric_cast(dom_id), dom_manager); + FOOTSTONE_CHECK(flag); + auto dom_manager_object = std::any_cast>(dom_manager); + devtools_data_source->Bind(dom_manager_object); + + napi_value result = arkTs.GetUndefined(); + return result; +} + +static napi_value OnAttachToRoot(napi_env env, napi_callback_info info) { + ArkTS arkTs(env); + size_t argc = 2; + napi_value args[2] = {nullptr}; + + napi_get_cb_info(env, info, &argc, args, nullptr, nullptr); + std::vector argVector = arkTs.GetCallbackArgs(info); + FOOTSTONE_DLOG(INFO) << "devtools napi::OnAttachToRoot::" << argVector.size(); + + if (argc != 2) { + napi_throw_error(env, nullptr, " Requires 2 arguments: data directory and WebSocket URL."); + return nullptr; + } + + napi_valuetype devtoolsIdType = arkTs.GetType(args[0]); + napi_valuetype rootIdType = arkTs.GetType(args[1]); + if (!(devtoolsIdType == napi_number && rootIdType == napi_number)) { + napi_throw_error(env, nullptr, "Both arguments must be number."); + return nullptr; + } + + int devtools_id = arkTs.GetInteger(args[0]); + int root_id = arkTs.GetInteger(args[1]); + + auto &root_map = RootNode::PersistentMap(); + std::shared_ptr root_node; + auto ret = root_map.Find(footstone::checked_numeric_cast(root_id), root_node); + if (!ret) { + FOOTSTONE_DLOG(WARNING) << kDevToolsTag << "OnAttachToRoot root_node is nullptr"; + return nullptr; + } + + FOOTSTONE_DLOG(INFO) << kDevToolsTag << "OnAttachToRoot root_id=" << root_id; + std::shared_ptr devtools_data_source = + DevtoolsDataSource::Find(footstone::checked_numeric_cast(devtools_id)); + devtools_data_source->SetRootNode(root_node); + napi_value result = arkTs.GetUndefined(); + return result; +} + +REGISTER_OH_NAPI("Devtools", "Devtools_OnCreateDevtools", OnCreateDevtools) +REGISTER_OH_NAPI("Devtools", "Devtools_OnDestroyDevtools", OnDestroyDevtools) +REGISTER_OH_NAPI("Devtools", "Devtools_OnBindDevtools", OnBindDevtools) +REGISTER_OH_NAPI("Devtools", "Devtools_OnAttachToRoot", OnAttachToRoot) + +} // namespace devtools diff --git a/docs/api/hippy-vue/components.md b/docs/api/hippy-vue/components.md index c2fa9c550e1..21bb0090935 100644 --- a/docs/api/hippy-vue/components.md +++ b/docs/api/hippy-vue/components.md @@ -65,7 +65,7 @@ | scrollEnabled | 当值为 `false` 的时候,内容不能滚动。`default: true` `(仅在 overflow-y/x: scroll 时适用)` | `boolean` | `Android、iOS、Web-Renderer、Voltron` | | showScrollIndicator | 是否显示滚动条。 `default: false`(仅在 overflow-y/x: scroll 时适用) | `boolean` | `Android、Voltron` | | showsHorizontalScrollIndicator | 当此值设为 `false` 的时候,`ScrollView` 会隐藏水平的滚动条。`default: true` `(仅在 overflow-y/x: scroll 时适用)`| `boolean` | `iOS、Voltron` | -| showsVerticalScrollIndicator | 当此值设为 `false` 的时候,`ScrollView` 会隐藏垂直的滚动条。 `default: true` `(仅在 overflow-y/x: scroll 时适用)`| `boolean` | `iOS、Voltron` | +| showsVerticalScrollIndicator | 当此值设为 `false` 的时候,`ScrollView` 会隐藏垂直的滚动条。 `default: true` `(仅在 overflow-y/x: scroll 时适用)`| `boolean` | `iOS、Voltron` | | nativeBackgroundAndroid | 配置水波纹效果,`最低支持版本 2.13.1`;配置项为 `{ borderless: boolean, color: Color, rippleRadius: number }`; `borderless` 表示波纹是否有边界,默认false;`color` 波纹颜色;`rippleRadius` 波纹半径,若不设置,默认容器边框为边界; `注意:设置水波纹后默认不显示,需要在对应触摸事件中调用 setPressed 和 setHotspot 方法进行水波纹展示,详情参考相关`[demo](//github.com/Tencent/Hippy/tree/master/examples/hippy-vue-demo/src/components/demos/demo-div.vue) | `Object`| `Android` | | pointerEvents | 用于控制视图是否可以成为触摸事件的目标。 | `enum('box-none', 'none', 'box-only', 'auto')` | `iOS` | | nestedScrollPriority* | 嵌套滚动事件处理优先级,`default:self`。相当于同时设置 `nestedScrollLeftPriority`、 `nestedScrollTopPriority`、 `nestedScrollRightPriority`、 `nestedScrollBottomPriority`。 `Android最低支持版本 2.16.0,iOS最低支持版本3.3.3` | `enum(self,parent,none)` | `Android、iOS` | @@ -184,17 +184,17 @@ | 参数 | 描述 | 类型 | 支持平台 | | ------------------ | ------------------------------------------------------------ | ------------------------------------ | --------- | -| src | 内嵌用的网址 | `string` | `Android、iOS、Web-Renderer、Voltron` | -| method | 请求方式,`get`、`post` | `string` | `Android、iOS` | -| userAgent | Webview userAgent | `string` | `Android、iOS、Voltron`| +| src | 内嵌用的网址 | `string` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| method | 请求方式,`get`、`post` | `string` | `Android、iOS、Ohos` | +| userAgent | Webview userAgent | `string` | `Android、iOS、Voltron、Ohos` | ## 事件 | 事件名称 | 描述 | 类型 | 支持平台 | | ------------- | ------------------------------------------------------------ | ----------------------------------------- | -------- | -| load | 网页加载成功后会触发 | `(object: { url: string }) => void` | `Android、iOS、Web-Renderer、Voltron` | -| loadStart | 网页开始加载时触发 | `(object: { url: string }) => void` | `Android、iOS、Web-Renderer、Voltron` | -| loadEnd | 网页加载结束时触发 (`success`与`error`参数仅`Android`、`iOS`上可用,最低支持版本`2.15.3`) | `(object: { url: string, success: boolean, error: string }) => void` | `Android、iOS、Web-Renderer、Voltron` | +| load | 网页加载成功后会触发 | `(object: { url: string }) => void` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| loadStart | 网页开始加载时触发 | `(object: { url: string }) => void` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| loadEnd | 网页加载结束时触发 (`success`与`error`参数仅`Android`、`iOS`上可用,最低支持版本`2.15.3`) | `(object: { url: string, success: boolean, error: string }) => void` | `Android、iOS、Web-Renderer、Voltron、Ohos` | --- @@ -211,9 +211,9 @@ | 参数 | 描述 | 类型 | 支持平台 | | ------------- | ------------------------------------------------------------ | ----------------------------------------- | -------- | -| src | 图片地址。现在支持的图片格式有 png , jpg , jpeg , bmp , gif 。 | string | `Android、iOS、Web-Renderer、Voltron` | -| capInsets | 当调整 img 大小的时候,由 capInsets 指定的边角尺寸会被固定而不进行缩放,而中间和边上其他的部分则会被拉伸。这在制作一些可变大小的圆角按钮、阴影、以及其它资源的时候非常有用。 | `{ top: number, left: number, bottom: number, right: number }` | `Android、iOS、Voltron` | -| placeholder | 指定当 `img` 组件还没加载出 `src` 属性指定的图片或者图片加载出错时的占位符图片 | `string`: 图片 base64 字符串 | `Android、iOS、Web-Renderer、Voltron` | +| src | 图片地址。现在支持的图片格式有 png , jpg , jpeg , bmp , gif 。 | string | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| capInsets | 当调整 img 大小的时候,由 capInsets 指定的边角尺寸会被固定而不进行缩放,而中间和边上其他的部分则会被拉伸。这在制作一些可变大小的圆角按钮、阴影、以及其它资源的时候非常有用。 | `{ top: number, left: number, bottom: number, right: number }` | `Android、iOS、Voltron` | +| placeholder | 指定当 `img` 组件还没加载出 `src` 属性指定的图片或者图片加载出错时的占位符图片 | `string`: 图片 base64 字符串 | `Android、iOS、Web-Renderer、Voltron、Ohos` | > `2.8.1` 版本后支持终端本地图片能力,可通过 webpack `file-loader` 加载。 @@ -221,17 +221,17 @@ | 参数 | 描述 | 类型 | 支持平台 | | ------------------ | ------------------------------------------------------------ | ------------------------------------ | --------- | -| resize-mode | 决定当组件尺寸和图片尺寸不成比例的时候如何调整图片的大小。(`Web-Renderer 不支持 repeat`) | `enum (cover, contain, stretch, repeat, center)` | `Android、iOS、Web-Renderer、Voltron` | +| resize-mode | 决定当组件尺寸和图片尺寸不成比例的时候如何调整图片的大小。(`Web-Renderer 不支持 repeat`) | `enum (cover, contain, stretch, repeat, center)` | `Android、iOS、Web-Renderer、Voltron、Ohos` | ## 事件 | 事件名称 | 描述 | 类型 | 支持平台 | | ------------- | ------------------------------------------------------------ | ----------------------------------------- | -------- | | layout | 当元素挂载或者布局改变的时候调用,参数为: `nativeEvent: { layout: { x, y, width, height } }`,其中 `x` 和 `y` 为相对父元素的坐标位置 | `Function` | `Android、iOS、Web-Renderer、Voltron` | -| load | 加载成功完成时调用此回调函数。 | `Function` | `Android、iOS、Web-Renderer、Voltron` | +| load | 加载成功完成时调用此回调函数。 | `Function` | `Android、iOS、Web-Renderer、Voltron、Ohos` | | loadStart | 加载开始时调用。 | `Function` | `Android、iOS、Web-Renderer、Voltron` | -| loadEnd | 加载结束后,不论成功还是失败,调用此回调函数。参数为:`nativeEvent: { success: number, width: number, height: number}` | `Function` | `Android、iOS、Web-Renderer、Voltron` | -| error | 当加载错误的时候调用此回调函数。| `Function` | `Android、iOS、Web-Renderer、Voltron` | +| loadEnd | 加载结束后,不论成功还是失败,调用此回调函数。参数为:`nativeEvent: { success: number, width: number, height: number}` | `Function` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| error | 当加载错误的时候调用此回调函数。| `Function` | `Android、iOS、Web-Renderer、Voltron、Ohos` | | progress | 在加载过程中不断调用,参数为 `nativeEvent: { loaded: number, total: number }`, `loaded` 表示加载中的图片大小, `total` 表示图片总大小 | `Function` | `iOS、Voltron` | | touchstart | 触屏开始事件,最低支持版本 2.6.2,参数为 `evt: { touches: [{ clientX: number, clientY: number }] }`,`clientX` 和 `clientY` 分别表示点击在屏幕内的绝对位置 | `Function` | `Android、iOS、Web-Renderer、Voltron` | | touchmove | 触屏移动事件,最低支持版本 2.6.2,参数为 `evt: { touches: [{ clientX: number, clientY: number }] }`,`clientX` 和 `clientY` 分别表示点击在屏幕内的绝对位置 | `Function` | `Android、iOS、Web-Renderer、Voltron` | @@ -293,15 +293,15 @@ | 参数 | 描述 | 类型 | 支持平台 | | --------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | --------- | -| caret-color | 输入光标颜色。(也可设置为 Style 属性) `最低支持版本2.11.5` | [`color`](api/style/color.md) | `Android、Voltron` | -| defaultValue | 提供一个文本框中的初始值。当用户开始输入的时候,值就可以改变。 在一些简单的使用情形下,如果你不想用监听消息然后更新 value 属性的方法来保持属性和状态同步的时候,就可以用 defaultValue 来代替。 | `string` | `Android、iOS、Voltron` | +| caret-color | 输入光标颜色。(也可设置为 Style 属性) `最低支持版本2.11.5` | [`color`](api/style/color.md) | `Android、Voltron、Ohos` | +| defaultValue | 提供一个文本框中的初始值。当用户开始输入的时候,值就可以改变。 在一些简单的使用情形下,如果你不想用监听消息然后更新 value 属性的方法来保持属性和状态同步的时候,就可以用 defaultValue 来代替。 | `string` | `Android、iOS、Voltron、Ohos` | | editable | 如果为 false,文本框是不可编辑的。`default: true` | `boolean` | `Android、iOS、Web-Renderer、Voltron` | -| type | 决定弹出的何种软键盘的。 注意,`password`仅在属性 `multiline=false` 单行文本框时生效。 | `enum(default, numeric, password, email, phone-pad)` | `Android、iOS、Web-Renderer、Voltron` | -| maxlength | 限制文本框中最多的字符数。使用这个属性而不用JS 逻辑去实现,可以避免闪烁的现象。 | `numbers` | `Android、iOS、Web-Renderer、Voltron` | +| type | 决定弹出的何种软键盘的。 注意,`password`仅在属性 `multiline=false` 单行文本框时生效。 | `enum(default, numeric, password, email, phone-pad)` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| maxlength | 限制文本框中最多的字符数。使用这个属性而不用JS 逻辑去实现,可以避免闪烁的现象。 | `numbers` | `Android、iOS、Web-Renderer、Voltron、Ohos` | | numberOfLines | 设置 `input` 最大显示行数,如果 `input` 没有显式设置高度,会根据 `numberOfLines` 来计算高度撑开。在使用的时候必需同时设置 `multiline` 参数为 `true`。 | `number` | `Android、Voltron、Web-Renderer` | -| placeholder | 如果没有任何文字输入,会显示此字符串。 | `string` | `Android、iOS、Web-Renderer、Voltron` | -| placeholder-text-color | 占位字符串显示的文字颜色。(也可设置为 Style 属性) `最低支持版本2.13.4` | [`color`](api/style/color.md) | `Android、iOS、Web-Renderer、Voltron` | -| returnKeyType | 指定软键盘的回车键显示的样式。(其中部分样式仅对单行文本组件有效) | `enum(done, go, next, search, send)` | `Android、iOS、Web-Renderer` | +| placeholder | 如果没有任何文字输入,会显示此字符串。 | `string` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| placeholder-text-color | 占位字符串显示的文字颜色。(也可设置为 Style 属性) `最低支持版本2.13.4` | [`color`](api/style/color.md) | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| returnKeyType | 指定软键盘的回车键显示的样式。(其中部分样式仅对单行文本组件有效) | `enum(done, go, next, search, send)` | `Android、iOS、Web-Renderer`、Ohos | | value | 指定 `input` 组件的值。 | `string` | `Android、iOS、Web-Renderer、Voltron` | | break-strategy* | 设置Android API 23及以上系统的文本换行策略。`default: simple` | `enum(simple, high_quality, balanced)` | `Android(版本 2.14.2以上)` | @@ -316,13 +316,13 @@ | ------------- | ------------------------------------------------------------ | ----------------------------------------- | -------- | | blur | 当文本框失去焦点的时候调用此回调函数。 | `Function` | `Android、iOS、Web-Renderer、Voltron` | | focus | 当文本框获得焦点的时候调用此回调函数。 | `Function` | `Android、iOS、Voltron` | -| change | 当文本框内容变化时调用此回调函数。改变后的文字内容会作为参数传递。 | `Function` | `Android、iOS、Voltron` | +| change | 当文本框内容变化时调用此回调函数。改变后的文字内容会作为参数传递。 | `Function` | `Android、iOS、Voltron、Ohos` | | keyboardWillShow | 在弹出输入法键盘时候会触发此回调函数,返回值包含键盘高度 `keyboardHeight`,样式如 `{ keyboardHeight: 260 }`。 | `Function` | `Android、iOS、Voltron` | | keyboardWillHide | 在隐藏输入法键盘时候会触发此回调函数 | `Function` | `Android、iOS、Voltron` | -| keyboardHeightChanged | 在输入法键盘高度改变时触发此回调函数,返回值包含键盘高度 `keyboardHeight`,样式如 `{ keyboardHeight: 260 }`, `最低支持版本2.14.0`。 | `Function` | `iOS、Voltron` | -| endEditing | 当文本输入结束后调用此回调函数。 | `Function` | `Android、iOS、Web-Renderer、Voltron` | +| keyboardHeightChanged | 在输入法键盘高度改变时触发此回调函数,返回值包含键盘高度 `keyboardHeight`,样式如 `{ keyboardHeight: 260 }`, `最低支持版本2.14.0`。 | `Function` | `iOS、Voltron` | +| endEditing | 当文本输入结束后调用此回调函数。 | `Function` | `Android、iOS、Web-Renderer、Voltron、Ohos` | | layout | 当元素挂载或者布局改变的时候调用,参数为: `nativeEvent: { layout: { x, y, width, height } }`,其中 `x` 和 `y` 为相对父元素的坐标位置。 | `Function` | `Android、iOS、Web-Renderer、Voltron` | -| selectionChange | 当输入框选择文字的范围被改变时调用。返回参数的样式如 `{ nativeEvent: { selection: { start, end } } }`。 | `Function` | `Android、iOS、Web-Renderer、Voltron` | +| selectionChange | 当输入框选择文字的范围被改变时调用。返回参数的样式如 `{ nativeEvent: { selection: { start, end } } }`。 | `Function` | `Android、iOS、Web-Renderer、Voltron、Ohos` | ## 方法 @@ -385,15 +385,15 @@ Hippy 的重点功能,高性能的可复用列表组件,在终端侧会被 | 参数 | 描述 | 类型 | 支持平台 | | --------------------- | ------------------------------------------------------------ | ----------------------------------------------------------- | -------- | -| horizontal | 指定 `ul` 是否采用横向布局。`default: undefined` 纵向布局,Android `2.14.1` 版本后可设置 `false` 显式固定纵向布局;iOS 暂不支持横向 `ul` | `boolean \| undefined` | `Android、Voltron` | -| initialContentOffset | 初始位移值。在列表初始化时即可指定滚动距离,避免初始化后再通过 scrollTo 系列方法产生的闪动。Android 在 `2.8.0` 版本后支持 | `number` | `Android、iOS、Web-Renderer、Voltron` | +| horizontal | 指定 `ul` 是否采用横向布局。`default: undefined` 纵向布局,Android `2.14.1` 版本后可设置 `false` 显式固定纵向布局;iOS 暂不支持横向 `ul` | `boolean \| undefined` | `Android、Voltron、Ohos` | +| initialContentOffset | 初始位移值。在列表初始化时即可指定滚动距离,避免初始化后再通过 scrollTo 系列方法产生的闪动。Android 在 `2.8.0` 版本后支持 | `number` | `Android、iOS、Web-Renderer、Voltron、Ohos` | | bounces | 是否开启回弹效果,默认 `true`, Android `2.14.1` 版本后支持该属性,老版本使用 `overScrollEnabled` | `boolean` | `Android、iOS、Voltron` | | rowShouldSticky | 设置 `ul` 是否需要开启悬停效果能力,与 `li` 的 `sticky` 配合使用。 `default: false` | `boolean` | `Android、iOS、Web-Renderer、Voltron`| -| scrollEnabled | 滑动是否开启。`default: true` | `boolean` | `Android、iOS、Web-Renderer、Voltron` | -| scrollEventThrottle | 指定滑动事件的回调频率,传入数值指定了多少毫秒(ms)组件会调用一次 `onScroll` 回调事件,默认 200ms | `number` | `Android、iOS、Web-Renderer、Voltron` | +| scrollEnabled | 滑动是否开启。`default: true` | `boolean` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| scrollEventThrottle | 指定滑动事件的回调频率,传入数值指定了多少毫秒(ms)组件会调用一次 `onScroll` 回调事件,默认 200ms | `number` | `Android、iOS、Web-Renderer、Voltron、Ohos` | | showScrollIndicator | 是否显示滚动条。`default: true` | `boolean` | `iOS、Voltron` | -| preloadItemNumber | 指定当列表滚动至倒数第几行时触发 `endReached` 回调。 | `number` | `Android、iOS、Web-Renderer、Voltron` | -| exposureEventEnabled | Android 曝光能力启用开关,如果要使用 `appear`、`disappear` 相关事件,Android 需要设置该开关(iOS无需设置), `default: true` | `boolean` | `Android、Voltron`| +| preloadItemNumber | 指定当列表滚动至倒数第几行时触发 `endReached` 回调。 | `number` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| exposureEventEnabled | Android 曝光能力启用开关,如果要使用 `appear`、`disappear` 相关事件,Android 需要设置该开关(iOS无需设置), `default: true` | `boolean` | `Android、Voltron、Ohos` | | endReached | 当所有的数据都已经渲染过,并且列表被滚动到最后一条时,将触发 `endReached` 回调。 | `Function` | `Android、iOS、Web-Renderer、Voltron` | | editable | 是否可编辑,开启侧滑删除时需要设置为 `true`。`最低支持版本2.9.0` | `boolean` | `iOS` | | delText | 侧滑删除文本。`最低支持版本2.9.0` | `string` | `iOS` | @@ -420,12 +420,12 @@ Hippy 的重点功能,高性能的可复用列表组件,在终端侧会被 | 事件名称 | 描述 | 类型 | 支持平台 | | ------------- | ------------------------------------------------------------ | ----------------------------------------- | -------- | -| endReached | 当所有的数据都已经渲染过,并且列表被滚动到最后一条时,将触发 `onEndReached` 回调。 | `Function` | `Android、iOS、Web-Renderer、Voltron` | -| momentumScrollBegin | 在 `ListView` 开始滑动的时候调起,`2.14.6` 版本后支持 `offset` 相关参数 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron` | -| momentumScrollEnd | 在 `ListView` 结束滑动的时候调起,`2.14.6` 版本后支持 `offset` 相关参数 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron` | -| scroll | 当触发 `ListView` 的滑动事件时回调。由于在 `ListView` 滑动时回调,调用会非常频繁,请使用 `scrollEventThrottle` 进行频率控制。 注意:ListView 在滚动时会进行组件回收,不要在滚动时对 renderRow() 生成的 ListItemView 做任何 ref 节点级的操作(例如:所有 callUIFunction 和 measureInAppWindow 方法),回收后的节点将无法再进行操作而报错。横向ListView时,Android在 `2.8.0` 版本后支持 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron` | -| scrollBeginDrag | 当用户开始拖拽 `ListView` 时调用,`2.14.6` 版本后支持 `offset` 相关参数 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron` | -| scrollEndDrag | 当用户停止拖拽 `ListView` 或者放手让 `ListView` 开始滑动的时候调用,`2.14.6` 版本后支持 `offset` 相关参数 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron` | +| endReached | 当所有的数据都已经渲染过,并且列表被滚动到最后一条时,将触发 `onEndReached` 回调。 | `Function` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| momentumScrollBegin | 在 `ListView` 开始滑动的时候调起,`2.14.6` 版本后支持 `offset` 相关参数 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| momentumScrollEnd | 在 `ListView` 结束滑动的时候调起,`2.14.6` 版本后支持 `offset` 相关参数 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| scroll | 当触发 `ListView` 的滑动事件时回调。由于在 `ListView` 滑动时回调,调用会非常频繁,请使用 `scrollEventThrottle` 进行频率控制。 注意:ListView 在滚动时会进行组件回收,不要在滚动时对 renderRow() 生成的 ListItemView 做任何 ref 节点级的操作(例如:所有 callUIFunction 和 measureInAppWindow 方法),回收后的节点将无法再进行操作而报错。横向ListView时,Android在 `2.8.0` 版本后支持 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| scrollBeginDrag | 当用户开始拖拽 `ListView` 时调用,`2.14.6` 版本后支持 `offset` 相关参数 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron、Ohos` | +| scrollEndDrag | 当用户停止拖拽 `ListView` 或者放手让 `ListView` 开始滑动的时候调用,`2.14.6` 版本后支持 `offset` 相关参数 | `(event: { offsetX: number, offsetY: number }) => any` | `Android、iOS、Web-Renderer、Voltron、Ohos` | | layout | 当元素挂载或者布局改变的时候调用,参数为: `nativeEvent: { layout: { x, y, width, height } }`,其中 `x` 和 `y` 为相对父元素的坐标位置。 | `Function` | `Android、iOS、Web-Renderer、Voltron` | | delete | 在列表项侧滑删除时调起。`最低支持版本2.9.0` | `(nativeEvent: { index: number}) => void` | `iOS` | diff --git a/docs/development/native-event.md b/docs/development/native-event.md index 02772a9a1ee..f7e5a4ef415 100644 --- a/docs/development/native-event.md +++ b/docs/development/native-event.md @@ -142,6 +142,18 @@ hippyEngine.sendEvent("rotate", hippyMap); - (void)sendEvent:(NSString *)eventName params:(NSDictionary *_Nullable)params; ``` +# Ohos + +鸿蒙平台接口和安卓相似。 + +终端在需要发送事件的地方调用代码: + +```typescript +const map = new Map(); +map.pushString("result", "hello i am from native"); +hippyEngine.sendEvent("rotate", map); +``` + # Voltron ```dart diff --git a/docs/development/native-integration.md b/docs/development/native-integration.md index c7d43e6ff83..1f343f07c26 100644 --- a/docs/development/native-integration.md +++ b/docs/development/native-integration.md @@ -1,6 +1,6 @@ # 环境搭建 -这篇教程,讲述了如何将 Hippy 集成到 Android、iOS 、Flutter、Web(同构) 等平台。 +这篇教程,讲述了如何将 Hippy 集成到 Android、iOS、Ohos、Flutter、Web(同构) 等平台。


@@ -272,6 +272,126 @@ ENV['layout_engine'] = 'Yoga' 之后,重新执行`pod install`命令更新项目依赖即可。 +# Ohos + +> 注:以下文档都是假设您已经具备一定的 Ohos 开发经验。 + +--- + +## 前期准备 + +- 已经安装 DevEco Studio 最新版本 + +## Demo 体验 + +Ohos Har Demo:Har 包方式依赖 Hippy。 体验方法:DevEco 打开 hippy 项目根目录运行 entry_har。 + +Ohos Demo:源码依赖 Hippy。体验方法:DevEco 打开 hippy 项目根目录直接运行 entry。 + +## 接入方式一:Har包快速接入 + +### 1. 创建一个 Ohos 工程 + +### 2. Har 包集成 + +- 配置 oh-package.json5 + + ```json + "dependencies": { + "hippy": "1.3.0" + } + ``` + +### 3. 初始化代码 + +- 获取 libhippy.so 接口对象和 UIAbility context + + ```TypeScript + import libHippy from 'libhippy.so' + AppStorage.setOrCreate("libHippy", libHippy) + AppStorage.setOrCreate("abilityContext", this.context) + ``` + +> 注:App 直接集成 Hippy,context 使用 UIAbility context;如果 App 在一个模块里集成 Hippy,js 等资源也集成在模块里,context 使用 getContext().createModuleContext("moduleName"),否则会找不到 js 等资源。 + +- 创建 HippyEngine、初始化 HippyEngine、加载业务 bundle + + ```TypeScript + this.hippyEngine = createHippyEngine(params) + this.hippyEngine.initEngine() + this.hippyEngine?.loadModule() + ``` + +- 组装 HippyRoot 组件 + + ```TypeScript + HippyRoot({ + hippyEngine: this.hippyEngine, + rootViewWrapper: this.rootViewWrapper, + onRenderException: (exception: HippyException) => { + this.exception = `${exception.message}\n${exception.stack}` + }, + }) + ``` + +具体可以参考 [Har Demo](https://github.com/sohotz/Hippy/tree/main/framework/examples/ohos-har-demo) 工程中 `EntryAbility.ets` `Index.ets` 实现 + +## 接入方式二:源码接入 + +> 源码接入主要为了方便在 App 项目里直接调试 Hippy 代码(c++ 和 ets 代码)。 + +### 1. 创建一个 Ohos 工程 + +### 2. Hippy 代码集成 + +- 拉取 hippy 代码到项目里(比如:根目录下) + +> https://github.com/sohotz/Hippy.git,分支:main + +- 配置 oh-package.json5 + + ```json + "dependencies": { + "hippy": "file:../Hippy/framework/ohos/" + } + ``` + +### 3. 初始化代码 + +- 获取 libhippy.so 接口对象和 UIAbility context + + ```TypeScript + import libHippy from 'libhippy.so' + AppStorage.setOrCreate("libHippy", libHippy) + AppStorage.setOrCreate("abilityContext", this.context) + ``` + +- 创建 HippyEngine、初始化 HippyEngine、加载业务 bundle + + ```TypeScript + this.hippyEngine = createHippyEngine(params) + this.hippyEngine.initEngine() + this.hippyEngine?.loadModule() + ``` + +- 组装 HippyRoot 组件 + + ```TypeScript + HippyRoot({ + hippyEngine: this.hippyEngine, + rootViewWrapper: this.rootViewWrapper, + onRenderException: (exception: HippyException) => { + this.exception = `${exception.message}\n${exception.stack}` + }, + }) + ``` + +具体可以参考 [Demo](https://github.com/sohotz/Hippy/tree/main/framework/examples/ohos-demo) 工程中 `EntryAbility.ets` `ExampleHippyPage.ets` 实现 + +## 接入方式三:定制场景接入 + +- 对于需要直接依赖 hippy c++ 代码编译使用的定制场景,可参考 [Demo](https://github.com/sohotz/Hippy/tree/main/framework/examples/ohos-demo) 工程中 `CMakeLists.txt` 说明 + # Voltron/Flutter > 注:以下文档都是假设您已经具备一定的 Flutter 开发经验。 diff --git a/docs/development/native-module.md b/docs/development/native-module.md index aa12b911f1a..1fa924fb13e 100644 --- a/docs/development/native-module.md +++ b/docs/development/native-module.md @@ -274,6 +274,141 @@ HIPPY_EXPORT_METHOD(click) { @end ``` +# 鸿蒙 + +很多时候 `JS` 需要访问对应终端的一些能力模块,比如数据库、下载、网络请求等,这时候就需要使用 `Module` 来暴露接口给JS使用。Voltron SDK 中默认实现了部分 `Module`,但这极有可能无法满足你的需求,这就需要你对 `Module` 进行扩展封装。 + +--- + +## Module扩展 + +我们将以 `TestModule` 为例,从头扩展一个 `Module`,这个 `Module` 将展示前端如何调用终端能力,并且把结果返回给前端 + +终端扩展 `Module` 包括四步: + +1. 创建 `TestModule` +2. 实现导出给 `JS` 的方法。 +3. 注册 `Module`。 + +## 1. 创建 `TestModule`,并且继承 HippyNativeModuleBase + +```typescript +export class ExampleNativeModule extends HippyNativeModuleBase { + public static readonly NAME = 'ExampleNativeModule' + + constructor(ctx: HippyEngineContext) { + super(ctx) + } + + public call(method: string, params: Array, promise: HippyModulePromise): HippyAny { + switch (method) { + case 'test': { + this.test(); + break; + } + case 'testPromise': { + this.testPromise(params, promise); + break; + } + case 'testSendEvent': { + this.testSendEvent(params, promise); + } + default: + super.call(method, params, promise); + } + return null; + } + + public test() { + LogUtils.i(ExampleNativeModule.NAME, 'module test'); + } + + public testPromise(params: Array, promise: HippyModulePromise) { + promise.resolve('test'); + } + + public testSendEvent(params: Array, promise: HippyModulePromise) { + LogUtils.i(ExampleNativeModule.NAME, 'testSendEvent'); + if (this.ctx != null && this.ctx.getModuleManager() != null) { + const eventModule = this.ctx.getModuleManager().getJavaScriptModule(EventDispatcher.MODULE_NAME); + if (eventModule != null) { + const event = 'testEvent'; + const params = new Map(); + params.set('testString', 'testStringValue'); + + const valueMap = new Map(); + valueMap.set('testString2', 'testStringValue2'); + params.set('testMap', valueMap); + + const array: HippyArray = []; + array.push(valueMap); + params.set('testArray', array); + + (eventModule as EventDispatcher).receiveNativeEvent(event, params); + } + } + } + +} + +``` + +需要注意的是,这里与Android、iOS有几处不同。 + +1. 需要指定 NAME,设置为前端调用的 module name + +2. 需要实现 call 方法 + +## Turbo Module扩展 + +和 Module 的扩展一致,不过还需要配置 isTurbo 方法,且不需要实现 call 方法,参考如下: + +```typescript +export class ExampleNativeTurboModule extends HippyNativeModuleBase { + public static readonly NAME = 'demoTurbo' + + constructor(ctx: HippyEngineContext) { + super(ctx) + } + + isTurbo(): boolean { + return true + } + + public getString(info: string): string { + return 'demoTurbo' + info; + } + + public getNum(num: number): number { + return num; + } + + public getBoolean(b: boolean): boolean { + return b; + } + + public getMap(map: HippyMap): HippyMap { + return map + } + + public getArray(array: HippyArray): HippyArray { + return array + } + + public getObject(obj: HippyAny): HippyAny { + return obj + } + + public getTurboConfig(): TurboConfig { + return new TurboConfig(); + } + + public printTurboConfig(turboConfig: TurboConfig): string { + return turboConfig.info; + } +} + +``` # Voltron diff --git a/docs/feature/feature2.0/jsi.md b/docs/feature/feature2.0/jsi.md index 7fd33998677..49298610347 100644 --- a/docs/feature/feature2.0/jsi.md +++ b/docs/feature/feature2.0/jsi.md @@ -148,6 +148,107 @@ HIPPY_EXPORT_TURBO_METHOD(setInfo:(NSString *)string) { 更多示例可参考类[DemoIOSTurboModule](https://github.com/Tencent/Hippy/blob/master/examples/ios-demo/HippyDemo/turbomodule/TurboBaseModule.mm) +## 鸿蒙 + +* 通过设置引擎初始化参数开启JSI能力 + +```typescript +initParams.enableTurbo = true +``` + +* 定义Module + +> 跟普通NativeModule类似,区别在于需要设置 isTurbo 为 true + +```typescript +export class ExampleNativeTurboModule extends HippyNativeModuleBase { + public static readonly NAME = 'demoTurbo' + + constructor(ctx: HippyEngineContext) { + super(ctx) + } + + isTurbo(): boolean { + return true + } + + public getString(info: string): string { + return 'demoTurbo' + info; + } + + public getNum(num: number): number { + return num; + } + + public getBoolean(b: boolean): boolean { + return b; + } + + public getMap(map: HippyMap): HippyMap { + return map + } + + public getArray(array: HippyArray): HippyArray { + return array + } + + public getObject(obj: HippyAny): HippyAny { + return obj + } + + public getTurboConfig(): TurboConfig { + return new TurboConfig(); + } + + public printTurboConfig(turboConfig: TurboConfig): string { + return turboConfig.info; + } +} +``` + +> 嵌套 turbo 对象需要设置注解@HippyTurboObject, 否则会当作普通对象解析 + +``` typescript +@HippyTurboObject() +export class TurboConfig { + public static readonly NAME = 'turboConfig' + public info = "info from turboConfig" + private static instance: TurboConfig; + + public static getInstance() { + if (!TurboConfig.instance) { + TurboConfig.instance = new TurboConfig(); + } + return TurboConfig.instance; + } + + public toString() { + return this.info; + } + + public getTestString() { + return 'test' + this.info; + } +} +``` + +> 支持的数据类型说明: + +| Objec类型 | Js类型 | +|:----------|:----------| +| napi_boolean | Bool | +| napi_number | Number | +| napi_bigint | Number | +| napi_string | String | +| napi_object | Array | +| napi_object | Object | +| NULL | null | + +更多示例可参考类[DemoTurboModule](https://github.com/sohotz/Hippy/blob/main/framework/examples/ohos-demo/src/main/ets/hippy_extend/ExampleNativeTurboModule.ets) + +* 注册TurboModule模块,跟NativeModule注册方法完全一致 + + # 使用例子 diff --git a/dom/CMakeLists.txt b/dom/CMakeLists.txt index 9027fd00546..7cba289b8ae 100644 --- a/dom/CMakeLists.txt +++ b/dom/CMakeLists.txt @@ -37,7 +37,12 @@ target_compile_options(${PROJECT_NAME} PRIVATE ${COMPILE_OPTIONS}) # endregion # region footstone -GlobalPackages_Add(footstone) +if (OHOS) + GlobalPackages_Add_footstone() +else () + GlobalPackages_Add(footstone) +endif () + target_link_libraries(${PROJECT_NAME} PRIVATE footstone) # endregion @@ -47,10 +52,17 @@ if (NOT DEFINED LAYOUT_ENGINE) endif () if ("${LAYOUT_ENGINE}" STREQUAL "Yoga") - InfraPackage_Add(yoga - REMOTE "dom/third_party/yoga/1.19.0/git-repo.tgz" - LOCAL "third_party/yoga" - ) + if (ANDROID) + InfraPackage_Add(yoga + REMOTE "dom/third_party/yoga/1.19.0/git-repo.tgz" + LOCAL "third_party/yoga" + ) + else () + InfraPackage_Add(yoga + REMOTE "dom/third_party/yoga_ohos/1.19.0/git-repo.tgz" + LOCAL "third_party/yoga" + ) + endif () target_compile_definitions(${PROJECT_NAME} PRIVATE "USE_YOGA") target_link_libraries(${PROJECT_NAME} PRIVATE yogacore) elseif ("${LAYOUT_ENGINE}" STREQUAL "Taitank") diff --git a/dom/include/dom/dom_node.h b/dom/include/dom/dom_node.h index b485c468e30..ea9900ed1d2 100644 --- a/dom/include/dom/dom_node.h +++ b/dom/include/dom/dom_node.h @@ -243,6 +243,10 @@ class DomNode : public std::enable_shared_from_this { bool is_virtual_{}; bool layout_only_ = false; + // support root wrap_content, invoke SetRootSize with param NAN + bool is_layout_width_nan_ = false; + bool is_layout_height_nan_ = false; + // Node can only be eliminated for the first time, // and if they cannot be eliminated for the first time, they cannot be eliminated at all times. bool enable_eliminated_ = true; diff --git a/dom/include/dom/layout_node.h b/dom/include/dom/layout_node.h index ddb1926a695..c0234b31c78 100644 --- a/dom/include/dom/layout_node.h +++ b/dom/include/dom/layout_node.h @@ -81,6 +81,8 @@ class LayoutNode { virtual void SetWidth(float width) = 0; virtual void SetHeight(float height) = 0; + virtual void SetMaxWidth(float width) = 0; + virtual void SetMaxHeight(float height) = 0; virtual void SetPosition(Edge edge, float position) = 0; virtual void SetScaleFactor(float scale_factor) = 0; virtual bool HasNewLayout() = 0; diff --git a/dom/include/dom/root_node.h b/dom/include/dom/root_node.h index 2b8f505565b..e2a7a79059e 100644 --- a/dom/include/dom/root_node.h +++ b/dom/include/dom/root_node.h @@ -53,6 +53,18 @@ class DomNodeStyleDiffer { std::unordered_map>> node_ext_style_map_; }; +struct ListenerOp { + bool add; + std::weak_ptr dom_node; + std::string name; + + ListenerOp(bool add, std::weak_ptr dom_node, const std::string& name) { + this->add = add; + this->dom_node = dom_node; + this->name = name; + } +}; + class RootNode : public DomNode { public: using TaskRunner = footstone::runner::TaskRunner; @@ -72,6 +84,8 @@ class RootNode : public DomNode { virtual void AddEventListener(const std::string& name, uint64_t listener_id, bool use_capture, const EventCallback& cb) override; virtual void RemoveEventListener(const std::string& name, uint64_t listener_id) override; + + std::map> &EventListenerOps() { return event_listener_ops_; } void ReleaseResources(); void CreateDomNodes(std::vector>&& nodes, bool needSortByIndex); @@ -94,11 +108,16 @@ class RootNode : public DomNode { void SetRootOrigin(float x, float y); void Traverse(const std::function&)>& on_traverse); void AddInterceptor(const std::shared_ptr& interceptor); + void SetDisableSetRootSize(bool disable) { + disable_set_root_size_ = disable; + } static footstone::utils::PersistentObjectMap>& PersistentMap() { return persistent_map_; } + std::vector> GetAllTextNodes(); + private: static void MarkLayoutNodeDirty(const std::vector>& nodes); @@ -115,6 +134,7 @@ class RootNode : public DomNode { std::vector dom_operations_; std::vector event_operations_; + std::map> event_listener_ops_; void FlushDomOperations(const std::shared_ptr& render_manager); void FlushEventOperations(const std::shared_ptr& render_manager); @@ -128,6 +148,8 @@ class RootNode : public DomNode { std::shared_ptr animation_manager_; std::unique_ptr style_differ_; + bool disable_set_root_size_ { false }; + static footstone::utils::PersistentObjectMap> persistent_map_; }; diff --git a/dom/include/dom/taitank_layout_node.h b/dom/include/dom/taitank_layout_node.h index b1394e6f372..14854b71389 100644 --- a/dom/include/dom/taitank_layout_node.h +++ b/dom/include/dom/taitank_layout_node.h @@ -239,13 +239,13 @@ class TaitankLayoutNode : public LayoutNode, public std::enable_shared_from_this * @brief 设置 max width 属性 * @param max_width 最大宽度 */ - void SetMaxWidth(float max_width); + void SetMaxWidth(float max_width) override; /** * @brief 设置 max height 属性 * @param max_height 最大高度 */ - void SetMaxHeight(float max_height); + void SetMaxHeight(float max_height) override; /** * @brief 设置 min width 属性 diff --git a/dom/include/dom/yoga_layout_node.h b/dom/include/dom/yoga_layout_node.h index d0153e5ee63..48906156e9c 100644 --- a/dom/include/dom/yoga_layout_node.h +++ b/dom/include/dom/yoga_layout_node.h @@ -46,6 +46,10 @@ class YogaLayoutNode : public LayoutNode, public std::enable_shared_from_this hippy_value); - void SetFlexBasis(float flex_basis); + void SetYGFlexBasis(std::shared_ptr dom_value); void SetFlex(float flex); diff --git a/dom/src/dom/animation/animation_manager.cc b/dom/src/dom/animation/animation_manager.cc index 04aa8fdd332..8e39a617acb 100644 --- a/dom/src/dom/animation/animation_manager.cc +++ b/dom/src/dom/animation/animation_manager.cc @@ -345,11 +345,12 @@ void AnimationManager::UpdateCubicBezierAnimation(double current, HippyValue prop_value(current); for (auto prop: prop_it->second) { dom_node->EmplaceStyleMapAndGetDiff(prop, prop_value, diff_value); - FOOTSTONE_DLOG(INFO) << "animation related_animation_id = " << related_animation_id - << "node id = " << dom_node->GetId() << ", key = " << prop << ", value = " << prop_value; + if (footstone::gEnableUpdateAnimLog) { + FOOTSTONE_DLOG(INFO) << "animation related_animation_id = " << related_animation_id + << "node id = " << dom_node->GetId() << ", key = " << prop << ", value = " << prop_value; + } } - dom_node->SetDiffStyle(std::make_shared< std::unordered_map>>(std::move(diff_value))); update_node_map[dom_node_id] = dom_node; @@ -409,6 +410,8 @@ void AnimationManager::UpdateAnimations() { return; } + footstone::AutoInUpdateAnimScope autoInUpdateAnimScope; + auto now = footstone::time::MonotonicallyIncreasingTime(); std::unordered_map> update_node_map; // xcode crash if we change for to loop diff --git a/dom/src/dom/animation/cubic_bezier_animation.cc b/dom/src/dom/animation/cubic_bezier_animation.cc index df33f510f2b..89b1c61f511 100644 --- a/dom/src/dom/animation/cubic_bezier_animation.cc +++ b/dom/src/dom/animation/cubic_bezier_animation.cc @@ -51,22 +51,32 @@ CubicBezier CubicBezierAnimation::ParseCubicBezierStr(const std::string& str) { double CubicBezierAnimation::CalculateColor(double start_color, double to_color, double scale) { auto start_value = static_cast(start_color); - auto start_red = static_cast(((start_value >> 24) & 0xff)); - auto start_green = static_cast(((start_value >> 16) & 0xff)); - auto start_blue = static_cast(((start_value >> 8) & 0xff)); - auto start_alpha = static_cast((start_value & 0xff)); - + if (start_color < 0) { + auto start_int_value = static_cast(start_color); + start_value = static_cast(start_int_value); + } + + auto start_alpha = ((start_value >> 24) & 0xff); + auto start_red = ((start_value >> 16) & 0xff); + auto start_green = ((start_value >> 8) & 0xff); + auto start_blue = (start_value & 0xff); + auto to_value = static_cast(to_color); - auto to_red = static_cast(((to_value >> 24) & 0xff)); - auto to_green = static_cast(((to_value >> 16) & 0xff)); - auto to_blue = static_cast(((to_value >> 8) & 0xff)); - auto to_alpha = static_cast((to_value & 0xff)); - - auto red = static_cast(start_red + (to_red - start_red) * scale); - auto green = static_cast(start_green + (to_green - start_green) * scale); - auto blue = static_cast(start_blue + (to_blue - start_blue) * scale); - auto alpha = static_cast(start_alpha + (to_alpha - start_alpha) * scale); - auto ret = (static_cast(red) << 24) + (static_cast(green) << 16) + (static_cast(blue) << 8) + alpha; + if (to_color < 0) { + auto to_int_value = static_cast(to_color); + to_value = static_cast(to_int_value); + } + + auto to_alpha = ((to_value >> 24) & 0xff); + auto to_red = ((to_value >> 16) & 0xff); + auto to_green = ((to_value >> 8) & 0xff); + auto to_blue = (to_value & 0xff); + + auto red = static_cast(start_red + static_cast(to_red - start_red) * scale); + auto green = static_cast(start_green + static_cast(to_green - start_green) * scale); + auto blue = static_cast(start_blue + static_cast(to_blue - start_blue) * scale); + auto alpha = static_cast(start_alpha + static_cast(to_alpha - start_alpha) * scale); + auto ret = (static_cast(alpha) << 24) + (static_cast(red) << 16) + (static_cast(green) << 8) + static_cast(blue); return static_cast(ret); } diff --git a/dom/src/dom/dom_manager.cc b/dom/src/dom/dom_manager.cc index 2a6a9e1cdb9..b319cea536f 100644 --- a/dom/src/dom/dom_manager.cc +++ b/dom/src/dom/dom_manager.cc @@ -132,7 +132,9 @@ void DomManager::EndBatch(const std::weak_ptr& weak_root_node) { if (!root_node) { return; } - FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] total node size = " << root_node->GetChildCount(); + if (!footstone::gInUpdateAnimScope || footstone::gEnableUpdateAnimLog) { + FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] total node size = " << root_node->GetChildCount(); + } root_node->SyncWithRenderManager(render_manager); } diff --git a/dom/src/dom/dom_node.cc b/dom/src/dom/dom_node.cc index 9a55af08db2..6c7d68adc90 100644 --- a/dom/src/dom/dom_node.cc +++ b/dom/src/dom/dom_node.cc @@ -205,7 +205,7 @@ void DomNode::DoLayout() { } void DomNode::DoLayout(std::vector>& changed_nodes) { - layout_node_->CalculateLayout(0, 0); + layout_node_->CalculateLayout(is_layout_width_nan_ ? NAN : 0, is_layout_height_nan_ ? NAN : 0); TransferLayoutOutputsRecursive(changed_nodes); } @@ -221,6 +221,9 @@ std::tuple DomNode::GetLayoutSize() { } void DomNode::SetLayoutSize(float width, float height) { + is_layout_width_nan_ = std::isnan(width) ? true : false; + is_layout_height_nan_ = std::isnan(height) ? true : false; + layout_node_->SetWidth(width); layout_node_->SetHeight(height); } diff --git a/dom/src/dom/layer_optimized_render_manager.cc b/dom/src/dom/layer_optimized_render_manager.cc index 3c744dc0010..1ce6cadc28d 100644 --- a/dom/src/dom/layer_optimized_render_manager.cc +++ b/dom/src/dom/layer_optimized_render_manager.cc @@ -88,8 +88,10 @@ void LayerOptimizedRenderManager::UpdateRenderNode(std::weak_ptr root_ } } } - FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] update node size before optimize = " << nodes.size() - << ", update node size after optimize = " << nodes_to_update.size(); + if (!footstone::gInUpdateAnimScope || footstone::gEnableUpdateAnimLog) { + FOOTSTONE_DLOG(INFO) << "[Hippy Statistic] update node size before optimize = " << nodes.size() + << ", update node size after optimize = " << nodes_to_update.size(); + } if (!nodes_to_update.empty()) { render_manager_->UpdateRenderNode(root_node, std::move(nodes_to_update)); } diff --git a/dom/src/dom/root_node.cc b/dom/src/dom/root_node.cc index 0c660158a41..d3b950748ad 100644 --- a/dom/src/dom/root_node.cc +++ b/dom/src/dom/root_node.cc @@ -460,7 +460,11 @@ std::shared_ptr RootNode::GetNode(uint32_t id) { std::tuple RootNode::GetRootSize() { return GetLayoutSize(); } -void RootNode::SetRootSize(float width, float height) { SetLayoutSize(width, height); } +void RootNode::SetRootSize(float width, float height) { + if (!disable_set_root_size_) { + SetLayoutSize(width, height); + } +} void RootNode::SetRootOrigin(float x, float y) { SetLayoutOrigin(x, y); } @@ -575,5 +579,16 @@ void RootNode::Traverse(const std::function& } } +std::vector> RootNode::GetAllTextNodes() { + std::vector> textNodes; + for (auto it = nodes_.begin(); it != nodes_.end(); it++) { + auto node = it->second.lock(); + if (node && node->GetViewName() == "Text") { + textNodes.emplace_back(node); + } + } + return textNodes; +} + } // namespace dom } // namespace hippy diff --git a/dom/src/dom/yoga_layout_node.cc b/dom/src/dom/yoga_layout_node.cc index 2d4a4d37bc3..87929a8847c 100644 --- a/dom/src/dom/yoga_layout_node.cc +++ b/dom/src/dom/yoga_layout_node.cc @@ -288,6 +288,10 @@ void YogaLayoutNode::SetWidth(float width) { YGNodeStyleSetWidth(yoga_node_, wid void YogaLayoutNode::SetHeight(float height) { YGNodeStyleSetHeight(yoga_node_, height); } +void YogaLayoutNode::SetMaxWidth(float width) { YGNodeStyleSetMaxWidth(yoga_node_, width); } + +void YogaLayoutNode::SetMaxHeight(float height) { YGNodeStyleSetMaxHeight(yoga_node_, height); } + void YogaLayoutNode::SetScaleFactor(float scale_factor) { YGConfigSetPointScaleFactor(yoga_config_, scale_factor); } static LayoutMeasureMode ToLayoutMeasureMode(YGMeasureMode measure_mode) { @@ -307,6 +311,7 @@ static YGSize YGMeasureFunction(YGNodeRef node, float width, YGMeasureMode width YGMeasureMode height_mode) { auto yoga_node = reinterpret_cast(YGNodeGetContext(node)); int64_t key = yoga_node->GetKey(); + std::lock_guard lock(mutex); auto iter = measure_function_map.find(key); if (iter != measure_function_map.end()) { auto size = iter->second(width, ToLayoutMeasureMode(width_mode), height, ToLayoutMeasureMode(height_mode), nullptr); @@ -319,12 +324,17 @@ static YGSize YGMeasureFunction(YGNodeRef node, float width, YGMeasureMode width } void YogaLayoutNode::SetMeasureFunction(MeasureFunction measure_function) { + std::lock_guard lock(mutex); measure_function_map[key_] = measure_function; YGNodeSetContext(yoga_node_, reinterpret_cast(this)); return YGNodeSetMeasureFunc(yoga_node_, YGMeasureFunction); } -bool YogaLayoutNode::HasMeasureFunction() { return measure_function_map.find(key_) != measure_function_map.end(); } +bool YogaLayoutNode::HasMeasureFunction() { + std::lock_guard lock(mutex); + return measure_function_map.find(key_) != measure_function_map.end(); +} + float YogaLayoutNode::GetLeft() { return YGNodeLayoutGetLeft(yoga_node_); } float YogaLayoutNode::GetTop() { return YGNodeLayoutGetTop(yoga_node_); } @@ -467,7 +477,8 @@ void YogaLayoutNode::Parser( if (it != style_delete.end()) YGNodeStyleSetFlexShrink(yoga_node_, 0); } if (style_update.find(kFlexBasis) != style_update.end()) { - SetFlexBasis(static_cast(style_update.find(kFlexBasis)->second->ToDoubleChecked())); + auto dom_value = style_update.find(kFlexBasis)->second; + SetYGFlexBasis(dom_value); } else { auto it = std::find(style_delete.begin(), style_delete.end(), kFlexBasis); if (it != style_delete.end()) YGNodeStyleSetFlexBasis(yoga_node_, NAN); @@ -694,11 +705,13 @@ void YogaLayoutNode::Parser( if (it != style_delete.end()) YGNodeStyleSetAspectRatio(yoga_node_, 0); } - // if (style_update.find(kAlignContent) != style_update.end()) { - // SetAlignContent(GetFlexAlign(style_update.find(kAlignContent)->second->ToString())); - // } + if (style_update.find(kAlignContent) != style_update.end()) { + SetAlignContent(GetFlexAlign(style_update.find(kAlignContent)->second->ToStringChecked())); + } } +YG_SET_NUMBER_PERCENT_AUTO_DECL(FlexBasis) + YG_SET_NUMBER_PERCENT_AUTO_DECL(Width) YG_SET_NUMBER_PERCENT_AUTO_DECL(Height) @@ -713,8 +726,6 @@ YG_SET_NUMBER_PERCENT_DECL(MinHeight) void YogaLayoutNode::SetDirection(YGDirection direction) { YGNodeStyleSetDirection(yoga_node_, direction); } -void YogaLayoutNode::SetFlexBasis(float flex_basis) { YGNodeStyleSetFlexBasis(yoga_node_, flex_basis); } - void YogaLayoutNode::SetFlex(float flex) { YGNodeStyleSetFlex(yoga_node_, flex); } void YogaLayoutNode::SetFlexGrow(float flex_grow) { YGNodeStyleSetFlexGrow(yoga_node_, flex_grow); } @@ -741,8 +752,8 @@ void YogaLayoutNode::SetFlexWrap(YGWrap wrap_mode) { YGNodeStyleSetFlexWrap(yoga void YogaLayoutNode::SetJustifyContent(YGJustify justify) { YGNodeStyleSetJustifyContent(yoga_node_, justify); } -// void YogaLayoutNode::SetAlignContent(YGAlign align_content) { YGNodeStyleSetAlignContent(yoga_node_, align_content); -// } +void YogaLayoutNode::SetAlignContent(YGAlign align_content) { YGNodeStyleSetAlignContent(yoga_node_, align_content); +} void YogaLayoutNode::SetAlignItems(YGAlign align_items) { YGNodeStyleSetAlignItems(yoga_node_, align_items); } diff --git a/driver/js/CMakeLists.txt b/driver/js/CMakeLists.txt index 892b5502695..35b3befaacd 100644 --- a/driver/js/CMakeLists.txt +++ b/driver/js/CMakeLists.txt @@ -30,6 +30,16 @@ include("${PROJECT_ROOT_DIR}/buildconfig/cmake/compiler_toolchain.cmake") set(CMAKE_VERBOSE_MAKEFILE on) set(CMAKE_CXX_STANDARD 17) +# Ohos系统上,配置本来应该放到生成so对应的build-profile.json5里。 +#(externalNativeOptions里arguments项) +# 现在源码集成配置需在app的build-profile.json5里,不方便,所以先放在这里。 +# 后续hippy产物的独立后,放到hippy模块的build-profile.json5里。 +if (OHOS) +# set(JS_ENGINE "V8") + set(V8_COMPONENT "10.6.194") + set(JS_ENGINE "JSH") +endif () + # region library add_library(${PROJECT_NAME} STATIC) target_include_directories(${PROJECT_NAME} PUBLIC include) @@ -60,6 +70,8 @@ if ("${JS_ENGINE}" STREQUAL "V8") set(V8_REMOTE_FILENAME "windows-x64.zip") endif() endif() + elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "OHOS") + set(V8_REMOTE_FILENAME "ohos-arm64.tgz") elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "iOS") if ("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm") set(V8_REMOTE_FILENAME "ios-arm64.tgz") @@ -115,30 +127,52 @@ if ("${JS_ENGINE}" STREQUAL "V8") endif () elseif ("${JS_ENGINE}" STREQUAL "JSC") target_compile_definitions(${PROJECT_NAME} PUBLIC "JS_JSC") +elseif ("${JS_ENGINE}" STREQUAL "JSH") + target_compile_definitions(${PROJECT_NAME} PUBLIC "JS_JSH") endif () # endregion # region footstone -GlobalPackages_Add(footstone) +if (OHOS) + GlobalPackages_Add_footstone() +else () + GlobalPackages_Add(footstone) +endif () target_link_libraries(${PROJECT_NAME} PRIVATE footstone) # endregion # region vfs -GlobalPackages_Add(vfs) +if (OHOS) + GlobalPackages_Add_vfs() +else () + GlobalPackages_Add(vfs) +endif () # Just reference the `dom` header files, no library needed target_include_directories(${PROJECT_NAME} PRIVATE $) # endregion # region dom -GlobalPackages_Add(dom) +if (OHOS) + GlobalPackages_Add_dom() +else () + GlobalPackages_Add(dom) +endif () target_link_libraries(${PROJECT_NAME} PRIVATE dom) # endregion # region devtools if (ENABLE_INSPECTOR) +if (OHOS) + GlobalPackages_Add_devtools_backend() +else () GlobalPackages_Add(devtools_backend) +endif () target_link_libraries(${PROJECT_NAME} PUBLIC devtools_backend) +if (OHOS) + GlobalPackages_Add_devtools_integration() +else () GlobalPackages_Add(devtools_integration) +endif () target_link_libraries(${PROJECT_NAME} PUBLIC devtools_integration) endif () # endregion @@ -174,6 +208,9 @@ if ("${JS_ENGINE}" STREQUAL "V8") src/vm/v8/native_source_code_android.cc src/vm/v8/serializer.cc src/vm/v8/v8_vm.cc) + + set_source_files_properties(src/vm/v8/serializer.cc PROPERTIES COMPILE_FLAGS -fno-rtti) + if (NOT V8_WITHOUT_INSPECTOR) list(APPEND SOURCE_SET src/vm/v8/inspector/v8_channel_impl.cc @@ -186,6 +223,13 @@ elseif ("${JS_ENGINE}" STREQUAL "JSC") src/napi/jsc/jsc_try_catch.cc src/vm/jsc/jsc_vm.cc src/vm/jsc/native_source_code_ios.cc) +elseif ("${JS_ENGINE}" STREQUAL "JSH") + list(APPEND SOURCE_SET + src/napi/jsh/jsh_class_definition.cc + src/napi/jsh/jsh_ctx.cc + src/napi/jsh/jsh_try_catch.cc + src/vm/jsh/jsh_vm.cc + src/vm/jsh/native_source_code_ohos.cc) endif () set(SOURCE_SET_STANDALONE src/modules/console_module.cc diff --git a/driver/js/examples/hippy-react-demo/package.json b/driver/js/examples/hippy-react-demo/package.json index e3225b0130c..50d2737107d 100644 --- a/driver/js/examples/hippy-react-demo/package.json +++ b/driver/js/examples/hippy-react-demo/package.json @@ -12,10 +12,12 @@ "serve": "node ./scripts/env-polyfill.js webpack serve --config ./scripts/hippy-webpack.web.dev.js", "build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.web.js", "hippy:dev": "node ./scripts/env-polyfill.js hippy-dev -c ./scripts/hippy-webpack.dev.js", - "hippy:vendor": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ios-vendor.js --config ./scripts/hippy-webpack.android-vendor.js", - "hippy:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ios.js --config ./scripts/hippy-webpack.android.js", + "hippy:vendor": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ios-vendor.js --config ./scripts/hippy-webpack.android-vendor.js --config ./scripts/hippy-webpack.ohos-vendor.js", + "hippy:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ios.js --config ./scripts/hippy-webpack.android.js --config ./scripts/hippy-webpack.ohos.js", "web:dev": "npm run hippy:dev & node ./scripts/env-polyfill.js webpack serve --config ./scripts/hippy-webpack.web-renderer.dev.js", - "web:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.web-renderer.js" + "web:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.web-renderer.js", + "ohos:vendor": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ohos-vendor.js", + "ohos:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ohos.js" }, "keywords": [ "Hippy", diff --git a/driver/js/examples/hippy-react-demo/scripts/hippy-webpack.ohos-vendor.js b/driver/js/examples/hippy-react-demo/scripts/hippy-webpack.ohos-vendor.js new file mode 100644 index 00000000000..be251153f42 --- /dev/null +++ b/driver/js/examples/hippy-react-demo/scripts/hippy-webpack.ohos-vendor.js @@ -0,0 +1,79 @@ +const fs = require('fs'); +const path = require('path'); +const webpack = require('webpack'); +const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); + +const platform = 'ohos'; + +module.exports = { + mode: 'production', + bail: true, + entry: { + vendor: [path.resolve(__dirname, './vendor.js')], + }, + output: { + filename: `[name].${platform}.js`, + path: path.resolve(`./dist/${platform}/`), + globalObject: '(0, eval)("this")', + library: 'hippyReactBase', + }, + plugins: [ + new webpack.NamedModulesPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production'), + __PLATFORM__: JSON.stringify(platform), + }), + new CaseSensitivePathsPlugin(), + new webpack.DllPlugin({ + context: path.resolve(__dirname, '..'), + path: path.resolve(__dirname, `../dist/${platform}/[name]-manifest.json`), + name: 'hippyReactBase', + }), + ], + module: { + rules: [ + { + test: /\.(js)$/, + use: [ + { + loader: 'babel-loader', + options: { + presets: [ + [ + '@babel/preset-env', + { + targets: { + chrome: 57, + }, + }, + ], + ], + plugins: [ + ['@babel/plugin-proposal-class-properties'], + ], + }, + }, + ], + }, + ], + }, + resolve: { + extensions: ['.js', '.jsx', '.json'], + // if node_modules path listed below is not your repo directory, change it. + modules: [path.resolve(__dirname, '../node_modules')], + alias: (() => { + const aliases = {}; + // If hippy-react was built exist then make a alias + // Remove the section if you don't use it + const hippyReactPath = path.resolve(__dirname, '../../../packages/hippy-react'); + if (fs.existsSync(path.resolve(hippyReactPath, 'dist/index.js'))) { + console.warn(`* Using the @hippy/react in ${hippyReactPath}`); + aliases['@hippy/react'] = hippyReactPath; + } else { + console.warn('* Using the @hippy/react defined in package.json'); + } + + return aliases; + })(), + }, +}; diff --git a/driver/js/examples/hippy-react-demo/scripts/hippy-webpack.ohos.js b/driver/js/examples/hippy-react-demo/scripts/hippy-webpack.ohos.js new file mode 100644 index 00000000000..105c494fdb2 --- /dev/null +++ b/driver/js/examples/hippy-react-demo/scripts/hippy-webpack.ohos.js @@ -0,0 +1,112 @@ +const fs = require('fs'); +const path = require('path'); +const webpack = require('webpack'); +const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); +const HippyDynamicImportPlugin = require('@hippy/hippy-dynamic-import-plugin'); +const pkg = require('../package.json'); +const manifest = require('../dist/ohos/vendor-manifest.json'); + +const platform = 'ohos'; + +module.exports = { + mode: 'production', + bail: true, + entry: { + index: ['regenerator-runtime', path.resolve(pkg.main)], + }, + output: { + filename: `[name].${platform}.js`, + path: path.resolve(`./dist/${platform}/`), + globalObject: '(0, eval)("this")', + // CDN path can be configured to load children bundles from remote server + // publicPath: 'https://xxx/hippy/hippyReactDemo/', + }, + plugins: [ + new webpack.NamedModulesPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production'), + __PLATFORM__: JSON.stringify(platform), + }), + new CaseSensitivePathsPlugin(), + new webpack.DllReferencePlugin({ + context: path.resolve(__dirname, '..'), + manifest, + }), + new HippyDynamicImportPlugin(), + // LimitChunkCountPlugin can control dynamic import ability + // Using 1 will prevent any additional chunks from being added + // new webpack.optimize.LimitChunkCountPlugin({ + // maxChunks: 1, + // }), + // use SourceMapDevToolPlugin can generate sourcemap file + // new webpack.SourceMapDevToolPlugin({ + // test: /\.(js|jsbundle|css|bundle)($|\?)/i, + // filename: '[file].map', + // }), + ], + module: { + rules: [ + { + test: /\.(jsx?)$/, + use: [ + { + loader: 'babel-loader', + options: { + sourceType: 'unambiguous', + presets: [ + '@babel/preset-react', + [ + '@babel/preset-env', + { + targets: { + chrome: 57, + }, + }, + ], + ], + plugins: [ + ['@babel/plugin-proposal-class-properties'], + ['@babel/plugin-proposal-decorators', { legacy: true }], + ['@babel/plugin-transform-runtime', { regenerator: true }], + ], + }, + }, + ], + }, + { + test: /\.(png|jpe?g|gif)$/i, + use: [{ + loader: 'url-loader', + options: { + // if you would like to use base64 for picture, uncomment limit: true + // limit: true, + limit: 8192, + fallback: 'file-loader', + name: '[name].[ext]', + outputPath: 'assets/', + }, + }], + }, + ], + }, + resolve: { + extensions: ['.js', '.jsx', '.json'], + // if node_modules path listed below is not your repo directory, change it. + modules: [path.resolve(__dirname, '../node_modules')], + alias: (() => { + const aliases = {}; + + // If hippy-react was built exist then make a alias + // Remove the section if you don't use it + const hippyReactPath = path.resolve(__dirname, '../../../packages/hippy-react'); + if (fs.existsSync(path.resolve(hippyReactPath, 'dist/index.js'))) { + console.warn(`* Using the @hippy/react in ${hippyReactPath}`); + aliases['@hippy/react'] = hippyReactPath; + } else { + console.warn('* Using the @hippy/react defined in package.json'); + } + + return aliases; + })(), + }, +}; diff --git a/driver/js/examples/hippy-vue-demo/package.json b/driver/js/examples/hippy-vue-demo/package.json index caef249c2b0..55beadb9e50 100644 --- a/driver/js/examples/hippy-vue-demo/package.json +++ b/driver/js/examples/hippy-vue-demo/package.json @@ -10,10 +10,12 @@ "repository": "https://github.com/Tencent/Hippy/tree/master/examples/hippy-vue-demo", "scripts": { "hippy:dev": "node ./scripts/env-polyfill.js hippy-dev -c ./scripts/hippy-webpack.dev.js", - "hippy:vendor": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ios-vendor.js --config ./scripts/hippy-webpack.android-vendor.js", - "hippy:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ios.js --config ./scripts/hippy-webpack.android.js", + "hippy:vendor": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ohos-vendor.js", + "hippy:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ohos.js", "web:dev": "npm run hippy:dev & node ./scripts/env-polyfill.js webpack serve --config ./scripts/hippy-webpack.web-renderer.dev.js", - "web:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.web-renderer.js" + "web:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.web-renderer.js", + "ohos:vendor": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ohos-vendor.js", + "ohos:build": "node ./scripts/env-polyfill.js webpack --config ./scripts/hippy-webpack.ohos.js" }, "dependencies": { "@hippy/vue": "3.3.1-rc.1", diff --git a/driver/js/examples/hippy-vue-demo/scripts/hippy-webpack.ohos-vendor.js b/driver/js/examples/hippy-vue-demo/scripts/hippy-webpack.ohos-vendor.js new file mode 100644 index 00000000000..d1158ae17a3 --- /dev/null +++ b/driver/js/examples/hippy-vue-demo/scripts/hippy-webpack.ohos-vendor.js @@ -0,0 +1,131 @@ +const fs = require('fs'); +const path = require('path'); +const webpack = require('webpack'); +const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); + +const platform = 'ohos'; + +let vueLoader = '@hippy/vue-loader'; +let VueLoaderPlugin; +const hippyVueLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib'); +const hippyVueLoaderNodeModulesPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/node_modules'); +if (fs.existsSync(hippyVueLoaderNodeModulesPath) && fs.existsSync(hippyVueLoaderPath)) { + console.warn(`* Using the @hippy/vue-loader in ${hippyVueLoaderPath}`); + vueLoader = hippyVueLoaderPath; + VueLoaderPlugin = require(path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib/plugin')); +} else { + console.warn('* Using the @hippy/vue-loader defined in package.json'); + VueLoaderPlugin = require('@hippy/vue-loader/lib/plugin'); +} + +module.exports = { + mode: 'production', + bail: true, + entry: { + vendor: [path.resolve(__dirname, './vendor.js')], + }, + output: { + filename: `[name].${platform}.js`, + path: path.resolve(`./dist/${platform}/`), + globalObject: '(0, eval)("this")', + library: 'hippyVueBase', + }, + plugins: [ + new webpack.NamedModulesPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production'), + __PLATFORM__: JSON.stringify(platform), + }), + new CaseSensitivePathsPlugin(), + new VueLoaderPlugin(), + new webpack.DllPlugin({ + context: path.resolve(__dirname, '..'), + path: path.resolve(__dirname, `../dist/${platform}/[name]-manifest.json`), + name: 'hippyVueBase', + }), + ], + module: { + rules: [ + { + test: /\.vue$/, + use: [ + { + loader: vueLoader, + options: { + compilerOptions: { + // whitespace handler, default is 'preserve' + whitespace: 'condense', + }, + }, + }, + ], + }, + { + test: /\.(js)$/, + use: [ + { + loader: 'babel-loader', + options: { + presets: [ + [ + '@babel/preset-env', + { + targets: { + chrome: 57, + }, + }, + ], + ], + plugins: [ + ['@babel/plugin-proposal-class-properties'], + ], + }, + }, + ], + }, + ], + }, + resolve: { + extensions: ['.js', '.vue', '.json'], + // if node_modules path listed below is not your repo directory, change it. + modules: [path.resolve(__dirname, '../node_modules')], + alias: (() => { + const aliases = { + vue: '@hippy/vue', + '@': path.resolve('./src'), + 'vue-router': '@hippy/vue-router', + }; + // If hippy-vue was built exist then make a alias + // Remove the section if you don't use it + const hippyVuePath = path.resolve(__dirname, '../../../packages/hippy-vue'); + if (fs.existsSync(path.resolve(hippyVuePath, 'dist/index.js'))) { + console.warn(`* Using the @hippy/vue in ${hippyVuePath} as vue alias`); + aliases.vue = hippyVuePath; + aliases['@hippy/vue'] = hippyVuePath; + } else { + console.warn('* Using the @hippy/vue defined in package.json'); + } + // If hippy-vue-router was built exist then make a alias + // Remove the section if you don't use it + const hippyVueRouterPath = path.resolve(__dirname, '../../../packages/hippy-vue-router'); + if (fs.existsSync(path.resolve(hippyVueRouterPath, 'dist/index.js'))) { + console.warn(`* Using the @hippy/vue-router in ${hippyVueRouterPath} as vue-router alias`); + aliases['vue-router'] = hippyVueRouterPath; + } else { + console.warn('* Using the @hippy/vue-router defined in package.json'); + } + + // If hippy-vue-native-components was built exist then make a alias + // Remove the section if you don't use it + const hippyVueNativeComponentsPath = path.resolve(__dirname, '../../../packages/hippy-vue-native-components'); + if (fs.existsSync(path.resolve(hippyVueNativeComponentsPath, 'dist/index.js'))) { + console.warn(`* Using the @hippy/vue-native-components in ${hippyVueNativeComponentsPath}`); + aliases['@hippy/vue-native-components'] = hippyVueNativeComponentsPath; + } else { + console.warn('* Using the @hippy/vue-native-components defined in package.json'); + } + + return aliases; + })(), + }, +}; diff --git a/driver/js/examples/hippy-vue-demo/scripts/hippy-webpack.ohos.js b/driver/js/examples/hippy-vue-demo/scripts/hippy-webpack.ohos.js new file mode 100644 index 00000000000..3775a177b9d --- /dev/null +++ b/driver/js/examples/hippy-vue-demo/scripts/hippy-webpack.ohos.js @@ -0,0 +1,178 @@ +const fs = require('fs'); +const path = require('path'); +const webpack = require('webpack'); +const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); +const HippyDynamicImportPlugin = require('@hippy/hippy-dynamic-import-plugin'); +const pkg = require('../package.json'); +const manifest = require('../dist/ohos/vendor-manifest.json'); + +const platform = 'ohos'; +let cssLoader = '@hippy/vue-css-loader'; +const hippyVueCssLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-css-loader/dist/css-loader.js'); +if (fs.existsSync(hippyVueCssLoaderPath)) { + console.warn(`* Using the @hippy/vue-css-loader in ${hippyVueCssLoaderPath}`); + cssLoader = hippyVueCssLoaderPath; +} else { + console.warn('* Using the @hippy/vue-css-loader defined in package.json'); +} + +let vueLoader = '@hippy/vue-loader'; +let VueLoaderPlugin; +const hippyVueLoaderPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib'); +const hippyVueLoaderNodeModulesPath = path.resolve(__dirname, '../../../packages/hippy-vue-loader/node_modules'); +if (fs.existsSync(hippyVueLoaderNodeModulesPath) && fs.existsSync(hippyVueLoaderPath)) { + console.warn(`* Using the @hippy/vue-loader in ${hippyVueLoaderPath}`); + vueLoader = hippyVueLoaderPath; + VueLoaderPlugin = require(path.resolve(__dirname, '../../../packages/hippy-vue-loader/lib/plugin')); +} else { + console.warn('* Using the @hippy/vue-loader defined in package.json'); + VueLoaderPlugin = require('@hippy/vue-loader/lib/plugin'); +} + +module.exports = { + mode: 'production', + bail: true, + entry: { + index: [path.resolve(pkg.nativeMain)], + }, + output: { + filename: `[name].${platform}.js`, + path: path.resolve(`./dist/${platform}/`), + globalObject: '(0, eval)("this")', + // CDN path can be configured to load children bundles from remote server + // publicPath: 'https://xxx/hippy/hippyVueDemo/', + }, + plugins: [ + new webpack.NamedModulesPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify('production'), + __PLATFORM__: JSON.stringify(platform), + }), + new CaseSensitivePathsPlugin(), + new VueLoaderPlugin(), + new webpack.DllReferencePlugin({ + context: path.resolve(__dirname, '..'), + manifest, + }), + new HippyDynamicImportPlugin(), + // LimitChunkCountPlugin can control dynamic import ability + // Using 1 will prevent any additional chunks from being added + // new webpack.optimize.LimitChunkCountPlugin({ + // maxChunks: 1, + // }), + // use SourceMapDevToolPlugin can generate sourcemap file + // new webpack.SourceMapDevToolPlugin({ + // test: /\.(js|jsbundle|css|bundle)($|\?)/i, + // filename: '[file].map', + // }), + ], + module: { + rules: [ + { + test: /\.vue$/, + use: [ + { + loader: vueLoader, + options: { + compilerOptions: { + // whitespace handler, default is 'preserve' + whitespace: 'condense', + }, + }, + }, + ], + }, + { + test: /\.css$/, + use: [ + cssLoader, + ], + }, + { + test: /\.(js)$/, + use: [ + { + loader: 'babel-loader', + options: { + sourceType: 'unambiguous', + presets: [ + [ + '@babel/preset-env', + { + targets: { + chrome: 57, + }, + }, + ], + ], + plugins: [ + ['@babel/plugin-proposal-class-properties'], + ['@babel/plugin-proposal-decorators', { legacy: true }], + ['@babel/plugin-transform-runtime', { regenerator: true }], + ], + }, + }, + ], + }, + { + test: /\.(png|jpe?g|gif)$/i, + use: [{ + loader: 'url-loader', + options: { + // if you would like to use base64 for picture, uncomment limit: true + // limit: true, + limit: 8192, + fallback: 'file-loader', + name: '[name].[ext]', + outputPath: 'assets/', + }, + }], + }, + ], + }, + resolve: { + extensions: ['.js', '.vue', '.json'], + // if node_modules path listed below is not your repo directory, change it. + modules: [path.resolve(__dirname, '../node_modules')], + alias: (() => { + const aliases = { + vue: '@hippy/vue', + '@': path.resolve('./src'), + 'vue-router': '@hippy/vue-router', + }; + + // If hippy-vue was built exist in packages directory then make a alias + // Remove the section if you don't use it + const hippyVuePath = path.resolve(__dirname, '../../../packages/hippy-vue'); + if (fs.existsSync(path.resolve(hippyVuePath, 'dist/index.js'))) { + console.warn(`* Using the @hippy/vue in ${hippyVuePath} as vue alias`); + aliases.vue = hippyVuePath; + aliases['@hippy/vue'] = hippyVuePath; + } else { + console.warn('* Using the @hippy/vue defined in package.json'); + } + + // If hippy-vue-router was built exist in packages directory then make a alias + // Remove the section if you don't use it + const hippyVueRouterPath = path.resolve(__dirname, '../../../packages/hippy-vue-router'); + if (fs.existsSync(path.resolve(hippyVueRouterPath, 'dist/index.js'))) { + console.warn(`* Using the @hippy/vue-router in ${hippyVueRouterPath} as vue-router alias`); + aliases['vue-router'] = hippyVueRouterPath; + } else { + console.warn('* Using the @hippy/vue-router defined in package.json'); + } + + // If hippy-vue-native-components was built in packages directory exist then make a alias + // Remove the section if you don't use it + const hippyVueNativeComponentsPath = path.resolve(__dirname, '../../../packages/hippy-vue-native-components'); + if (fs.existsSync(path.resolve(hippyVueNativeComponentsPath, 'dist/index.js'))) { + console.warn(`* Using the @hippy/vue-native-components in ${hippyVueNativeComponentsPath}`); + aliases['@hippy/vue-native-components'] = hippyVueNativeComponentsPath; + } else { + console.warn('* Using the @hippy/vue-native-components defined in package.json'); + } + + return aliases; + })(), + }, +}; diff --git a/driver/js/examples/hippy-vue-demo/src/components/demos/demo-dynamicimport.vue b/driver/js/examples/hippy-vue-demo/src/components/demos/demo-dynamicimport.vue index 0afaf20f342..dc21bf736c7 100644 --- a/driver/js/examples/hippy-vue-demo/src/components/demos/demo-dynamicimport.vue +++ b/driver/js/examples/hippy-vue-demo/src/components/demos/demo-dynamicimport.vue @@ -40,7 +40,7 @@ export default { * customChunkPath 会在运行时替换全局配置的publicPath * import 出错时需在catch里做对应的降级方案 */ - AsyncComponentFromHttp: process.env.NODE_ENV === 'development' ? () => import(/* webpackMode: "lazy", webpackChunkName: "asyncComponentFromHttp" */'./dynamicImport/async-component-http.vue').then(res => res).catch(err => console.error('import async remote component error', err)) : () => import(/* webpackMode: "lazy",customChunkPath: "https://raw.githubusercontent.com/Tencent/Hippy/master/static/hippy-vue/", webpackChunkName: "asyncComponentFromHttp" */'./dynamicImport/async-component-http.vue').then(res => res).catch(err => console.error('import async remote component error', err)), + AsyncComponentFromHttp: process.env.NODE_ENV === 'development' ? () => import(/* webpackMode: "lazy", webpackChunkName: "asyncComponentFromHttp" */'./dynamicImport/async-component-http.vue').then(res => res).catch(err => console.error('import async remote component error', err)) : () => import(/* webpackMode: "lazy",customChunkPath: "https://raw.githubusercontent.com/sohotz/Hippy/main/driver/js/static/hippy-vue/", webpackChunkName: "asyncComponentFromHttp" */'./dynamicImport/async-component-http.vue').then(res => res).catch(err => console.error('import async remote component error', err)), }, data() { return { diff --git a/driver/js/examples/hippy-vue-demo/src/components/demos/demo-list.vue b/driver/js/examples/hippy-vue-demo/src/components/demos/demo-list.vue index 24d2a913cb2..58a2501ee2a 100644 --- a/driver/js/examples/hippy-vue-demo/src/components/demos/demo-list.vue +++ b/driver/js/examples/hippy-vue-demo/src/components/demos/demo-list.vue @@ -108,6 +108,40 @@

+ +
+
+

+ 切换方向 +

+
+
+ diff --git a/driver/js/examples/hippy-vue-demo/src/components/demos/demo-shadow.vue b/driver/js/examples/hippy-vue-demo/src/components/demos/demo-shadow.vue index 3dc24eb8dde..c474f11dba4 100644 --- a/driver/js/examples/hippy-vue-demo/src/components/demos/demo-shadow.vue +++ b/driver/js/examples/hippy-vue-demo/src/components/demos/demo-shadow.vue @@ -1,5 +1,6 @@