From d21e5a4aca8a5cc25acb65d79498e653ca7f11b1 Mon Sep 17 00:00:00 2001 From: sunfei Date: Fri, 25 Apr 2025 16:19:46 +0800 Subject: [PATCH 1/3] use ts kit demo Signed-off-by: sunfei Change-Id: I12af58bc1674654e4c8057cf39cd3a3e3d693a5c --- bundle.json | 4 +- kittest/BUILD.gn | 65 +++++++++++++++++++++++ kittest/arktsconfig.json | 13 +++++ kittest/ets/kittest.ets | 25 +++++++++ kittest/gen_arkts_config.py | 100 ++++++++++++++++++++++++++++++++++++ 5 files changed, 206 insertions(+), 1 deletion(-) create mode 100644 kittest/BUILD.gn create mode 100644 kittest/arktsconfig.json create mode 100644 kittest/ets/kittest.ets create mode 100755 kittest/gen_arkts_config.py diff --git a/bundle.json b/bundle.json index 2551aca..5b051a5 100644 --- a/bundle.json +++ b/bundle.json @@ -19,6 +19,7 @@ "deps": { "components": [ "hilog", + "ace_engine", "napi" ], "third_party": [] @@ -32,7 +33,8 @@ "//foundation/arkui/advanced_ui_component/innerfullscreenlaunchcomponent/interfaces:innerfullscreenlaunchcomponent", "//foundation/arkui/advanced_ui_component/interstitialdialogaction/interfaces:interstitialdialogaction", "//foundation/arkui/advanced_ui_component/customappbar/interfaces:custom_app_bar", - "//foundation/arkui/advanced_ui_component/halfscreenlaunchcomponent/interfaces:halfscreenlaunchcomponent" + "//foundation/arkui/advanced_ui_component/halfscreenlaunchcomponent/interfaces:halfscreenlaunchcomponent", + "//foundation/arkui/advanced_ui_component/kittest:kittest_abc_etc" ], "inner_kits": [], "test": [] diff --git a/kittest/BUILD.gn b/kittest/BUILD.gn new file mode 100644 index 0000000..a9ec08c --- /dev/null +++ b/kittest/BUILD.gn @@ -0,0 +1,65 @@ +# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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. + +import("//build/config/components/ets_frontend/ets2abc_config.gni") +import("//build/ohos.gni") + +action("gen_arkts_config") { + script = "./gen_arkts_config.py" + + inputs = [ "./arktsconfig.json" ] + outputs = [ "$target_out_dir/arktsconfig.json" ] + args = [ + # Paths: 0 base dir + rebase_path("."), + + # Paths: 1 source config file + rebase_path("./arktsconfig.json"), + + # Paths: 2 output dir. + rebase_path("$target_out_dir"), + + # Paths: 3 innerkits config path. + rebase_path("$root_out_dir/arkui/innerkits"), + + # Paths: 4 stdlib path. + rebase_path("$ohos_ets_stdlib_path"), + ] + + external_deps = [ "ace_engine:libace_compatible" ] +} + +generate_static_abc("kittest_abc") { + base_url = "." + files = [ + "./ets/kittest.ets" + ] + dst_file = target_out_dir + "/kittest.abc" + out_puts = [ target_out_dir + "/kittest.abc" ] + arktsconfig = "$target_out_dir/arktsconfig.json" + use_local_config = "True" + is_boot_abc = "True" + device_dst_file = "/system/framework/kittest.abc" + + dependencies = [ + ":gen_arkts_config" + ] +} + +ohos_prebuilt_etc("kittest_abc_etc") { + source = target_out_dir + "/kittest.abc" + deps = [ ":kittest_abc" ] + module_install_dir = "framework" + subsystem_name = "arkui" + part_name = "advanced_ui_component" +} diff --git a/kittest/arktsconfig.json b/kittest/arktsconfig.json new file mode 100644 index 0000000..efc31aa --- /dev/null +++ b/kittest/arktsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "package": "arkui", + "outDir": "kittest_abc/cache", + "baseUrl": ".", + "paths": { + + } + }, + "files": [ + "./ets/kittest.ets" + ] +} \ No newline at end of file diff --git a/kittest/ets/kittest.ets b/kittest/ets/kittest.ets new file mode 100644 index 0000000..39696f1 --- /dev/null +++ b/kittest/ets/kittest.ets @@ -0,0 +1,25 @@ +/* + * Copyright (c) 2025 Huawei Device Co., Ltd. + * 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. + */ + +import { PeerNode } from "@ohos/arkui" + +export default class KitTest { + static { console.log("xxx") } + + constructor() { + const node = PeerNode.generateRootPeer(); + node.setId(10) + } +} \ No newline at end of file diff --git a/kittest/gen_arkts_config.py b/kittest/gen_arkts_config.py new file mode 100755 index 0000000..87c51d1 --- /dev/null +++ b/kittest/gen_arkts_config.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (c) 2025 Huawei Device Co., Ltd. +# 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. + +# Description +# +# This script is invoked by the build system and does not need to be executed directly by the developer. +# First, it checks if --release is provided as an argument. This is the only allowed type for stateMgmt +# that is included in the build image. It then verifies if the node_modules folder exists. If not, npm +# install is executed. Afterward, npm run build_release is performed, which also generates generateGni.js +# The files_to_watch.gni file contains a list of input files from tsconfig.base.json. When any of these +# files are modified, the build system triggers this script to regenerate stateMgmt.js. + +import os +import sys +import json + + +class Paths: + def __init__(self): + self.base_path = None + self.source_config_file = None + self.output_target_path = None + self.innerkits_path = None + self.stdlib_path = None + + +def parse_argv(argv) -> Paths: + """ + parse command line arguments + """ + if len(argv) < 3: + print("Usage: python gen_arkts_config.py ") + sys.exit(1) + + path = Paths() + path.base_path = os.path.abspath(argv[1]) + path.source_config_file = os.path.abspath(argv[2]) + path.output_target_path = os.path.abspath(argv[3]) + path.innerkits_path = os.path.abspath(argv[4]) + path.stdlib_path = os.path.abspath(argv[5]) + return path + + +def generate_new_arkts_config(path: Paths): + """ + generate new arkts config json + """ + paths = {} + + old_arkts_config_path = path.source_config_file + arkui_kit_paths_file = os.path.join(path.innerkits_path, "arkts_paths.json") + new_arkts_config_path = os.path.join(path.output_target_path, "arktsconfig.json") + print(f"generate_new_arkts_config old_arkts_config_path: {old_arkts_config_path}") + print(f"generate_new_arkts_config arkui_kit_paths_file: {arkui_kit_paths_file}") + print(f"generate_new_arkts_config new_arkts_config_path: {new_arkts_config_path}") + # need take old arkts config json paths splicing to new arkts config paths + with open(arkui_kit_paths_file, 'r', encoding='utf-8') as f: + json_data = json.load(f) + paths = json_data['paths'] + f.close() + print(f"generate_new_arkts_config read paths") + paths["std"] = [os.path.join(path.stdlib_path, "std")] + paths["escompat"] = [os.path.join(path.stdlib_path, "escompat")] + with open(old_arkts_config_path, 'r', encoding='utf-8') as f: + old_data = json.load(f) + old_data['compilerOptions']['paths'].update(paths) + files = old_data['files'] + resolved_files = [] + for value in files: + resolved_value = os.path.abspath(os.path.join(path.base_path, value)) + resolved_files.append(resolved_value) + old_data['files'] = resolved_files + base_url = old_data['compilerOptions']['baseUrl'] + old_data['compilerOptions']['baseUrl'] = os.path.abspath(os.path.join(path.base_path, base_url)) + old_data['compilerOptions']['rootDir'] = os.path.abspath(os.path.join(path.base_path, base_url)) + print(f"generate_new_arkts_config update paths") + with open(new_arkts_config_path, 'w', encoding="utf-8") as f: + json.dump(old_data, f, indent=2, ensure_ascii=False) + print(f"generate_new_arkts_config done") + + +def main(argv): + path = parse_argv(argv) + generate_new_arkts_config(path) + + +if __name__ == '__main__': + main(sys.argv) -- Gitee From beab8f0479ec80e7c1e39de6f8edaae327762e13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=9E=97=E8=82=AF?= Date: Fri, 6 Jun 2025 11:52:24 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E9=80=82=E9=85=8Dinnerapi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 邹林肯 Change-Id: I832c45dce26da302ee62b82dfb61a3c5334b712f --- kittest/BUILD.gn | 51 ++++++++++++++++++++++++++++++++++++----- kittest/ets/kittest.ets | 37 ++++++++++++++++++++++++++++-- 2 files changed, 80 insertions(+), 8 deletions(-) diff --git a/kittest/BUILD.gn b/kittest/BUILD.gn index a9ec08c..0448178 100644 --- a/kittest/BUILD.gn +++ b/kittest/BUILD.gn @@ -41,19 +41,58 @@ action("gen_arkts_config") { generate_static_abc("kittest_abc") { base_url = "." - files = [ - "./ets/kittest.ets" + files = [ "./ets/kittest.ets" ] + + paths_keys = [ + "arkui/component/common", + "arkui/component/tabs", + "arkui/component/text", + "arkui/component/navigation", + "arkui/component/navDestination", + "arkui/component/listItem", + "arkui/handwritten/Router", + "arkui/ComponentBase", + "arkui/PeerNode", + "arkui/ReusablePool", + "@koalaui/common", + "@koalaui/compat", + "@koalaui/interop", + "@ohos/router", + "@koalaui/runtime/memo/node", + "@koalaui/runtime/memo/remember", + ] + paths_values = [ + "$ohos_ets_inner_path/arkui/component/common.d.ets", + "$ohos_ets_inner_path/arkui/component/tabs.d.ets", + "$ohos_ets_inner_path/arkui/component/text.d.ets", + "$ohos_ets_inner_path/arkui/component/navigation.d.ets", + "$ohos_ets_inner_path/arkui/component/navDestination.d.ets", + "$ohos_ets_inner_path/arkui/component/listItem.d.ets", + "$ohos_ets_inner_path/arkui/handwritten/Router.ts", + "$ohos_ets_inner_path/arkui/ComponentBase.d.ets", + "$ohos_ets_inner_path/arkui/PeerNode.d.ets", + "$ohos_ets_inner_path/arkui/ReusablePool.d.ets", + "$ohos_ets_inner_path/@koalaui/common.d.ets", + "$ohos_ets_inner_path/@koalaui/compat.d.ets", + "$ohos_ets_inner_path/@koalaui/interop.d.ets", + "$ohos_ets_inner_path/@ohos/router.d.ets", + "$ohos_ets_inner_path/@koalaui/runtime/memo/node.d.ets", + "$ohos_ets_inner_path/@koalaui/runtime/memo/remember.d.ets", ] + dst_file = target_out_dir + "/kittest.abc" out_puts = [ target_out_dir + "/kittest.abc" ] arktsconfig = "$target_out_dir/arktsconfig.json" - use_local_config = "True" + + # use_local_config = "True" is_boot_abc = "True" device_dst_file = "/system/framework/kittest.abc" - dependencies = [ - ":gen_arkts_config" - ] + external_dependencies = [ "ace_engine:copy_arkui_ets" ] + + # dependencies = [ + # ":gen_arkts_config" + # ] } ohos_prebuilt_etc("kittest_abc_etc") { diff --git a/kittest/ets/kittest.ets b/kittest/ets/kittest.ets index 39696f1..15245c2 100644 --- a/kittest/ets/kittest.ets +++ b/kittest/ets/kittest.ets @@ -13,13 +13,46 @@ * limitations under the License. */ -import { PeerNode } from "@ohos/arkui" +import { PeerNode } from "arkui/PeerNode" +import { ComponentBase } from "arkui/ComponentBase" +import { ArkCommonMethodPeer } from "arkui/component/common" +import { NodeAttach } from "@koalaui/runtime/memo/node" +import { ArkTabsComponent } from "arkui/component/tabs" +import { ArkTextComponent } from "arkui/component/text" +import { ArkNavigationComponent } from "arkui/component/navigation" +import { ArkNavDestinationComponent } from "arkui/component/navDestination" +import { ArkListItemComponent } from "arkui/component/listItem" +import router from "@ohos/router" +import { Router } from "arkui/handwritten/Router" + +// class MyCommonAttribute implements CommonMethod { +// constructor() { +// console.log("MyCommonAttribute") +// } +// } + +// class MyUICommonAttribute implements UICommonMethod { +// constructor() { +// console.log("MyCommonAttribute") +// } +// } + +class MyComponent extends ComponentBase { + constructor() { + super() + console.log("MyComponent") + } +} export default class KitTest { static { console.log("xxx") } constructor() { const node = PeerNode.generateRootPeer(); - node.setId(10) + const component = new MyComponent(); + // const attribute = new MyCommonAttribute(); + // const uiAttribute = new MyUICommonAttribute(); + // const x = AxisAction.BEGIN + // node.setId(10) } } \ No newline at end of file -- Gitee From ecd24a7cc886151ad01c5709b44297baebdeff24 Mon Sep 17 00:00:00 2001 From: fangzhiyuan Date: Sun, 15 Jun 2025 14:29:23 +0000 Subject: [PATCH 3/3] =?UTF-8?q?KitTest=E7=BB=A7=E6=89=BFText?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: fangzhiyuan Change-Id: Ib58354b6b36dd9cbec818b9b3437864b13ea69d3 --- kittest/BUILD.gn | 2 +- kittest/arkui/component/kittest.ets | 314 ++++++++++++++++++++++++++++ kittest/ets/kittest.ets | 58 ----- 3 files changed, 315 insertions(+), 59 deletions(-) create mode 100644 kittest/arkui/component/kittest.ets delete mode 100644 kittest/ets/kittest.ets diff --git a/kittest/BUILD.gn b/kittest/BUILD.gn index 0448178..4945bf8 100644 --- a/kittest/BUILD.gn +++ b/kittest/BUILD.gn @@ -41,7 +41,7 @@ action("gen_arkts_config") { generate_static_abc("kittest_abc") { base_url = "." - files = [ "./ets/kittest.ets" ] + files = [ "./arkui/component/kittest.ets" ] paths_keys = [ "arkui/component/common", diff --git a/kittest/arkui/component/kittest.ets b/kittest/arkui/component/kittest.ets new file mode 100644 index 0000000..5ae6907 --- /dev/null +++ b/kittest/arkui/component/kittest.ets @@ -0,0 +1,314 @@ + +import { __memo_context_type as __memo_context_type, __memo_id_type as __memo_id_type } from "arkui.stateManagement.runtime"; + +import { memo as memo } from "arkui.stateManagement.runtime"; + +import { NodeAttach as NodeAttach } from "@koalaui.runtime.memo.node"; + +import { remember as remember } from "@koalaui.runtime.memo.remember"; + +import { ArkTextPeer as ArkTextPeer, ArkTextComponent, TextAttribute } from "arkui/component/text"; + +import { ShadowOptions, AttributeModifier } from 'arkui.component.common'; +import { CustomBuilder } from 'arkui.component.builder'; +// import { int32, int64 } from '@koalaui/compat'; +// import { KPointer } from '@koalaui/interop'; +import { ComponentBase } from 'arkui.ComponentBase'; +import { ResourceColor, Length, Font } from 'arkui.component.units'; +import { + MarqueeState, + TextOverflowOptions, + TextMarqueeOptions, + TextSpanType, + TextResponseType, + TextOptions, +} from 'arkui.component.text'; +import { Resource } from 'global.resource'; +import { + CopyOptions, + EllipsisMode, + FontStyle, + FontWeight, + LineBreakStrategy, + TextAlign, + TextHeightAdaptivePolicy, + WordBreak, + TextCase, + TextSelectableMode, +} from 'arkui.component.enums'; +import { TextDataDetectorConfig, EditMenuOptions, FontSettingOptions } from 'arkui.component.textCommon'; +import { LengthMetrics } from 'arkui.Graphics'; +import { SelectionMenuOptions } from 'arkui.component.richEditor'; +import { DecorationStyleInterface } from 'arkui.component.styledString'; + + +function main(): void { } + +type KPointer = long +type int32 = int + +@memo() export function KitTest(__memo_context: __memo_context_type, __memo_id: __memo_id_type, @memo() style: ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, attributes: KitTestAttribute) => void) | undefined, content?: string | Resource, value?: TextOptions, @memo() content_?: ((__memo_context: __memo_context_type, __memo_id: __memo_id_type) => void) | undefined): void { + const __memo_scope = __memo_context.scope(((__memo_id) + (244210824)), 4); + const __memo_parameter_style = __memo_scope.param(0, style), __memo_parameter_content = __memo_scope.param(1, content), __memo_parameter_value = __memo_scope.param(2, value), __memo_parameter_content_ = __memo_scope.param(3, content_); + if (__memo_scope.unchanged) { + __memo_scope.cached; + return; + } + const receiver = remember(__memo_context, ((__memo_id) + (206378858)), __memo_context.compute(((__memo_id) + (161889811)), (() => { + return (() => { + return new ArkKitTestComponent(); + }); + }))); + NodeAttach(__memo_context, ((__memo_id) + (17622861)), __memo_context.compute(((__memo_id) + (33235184)), ((): (() => ArkKitTestPeer) => { + return ((): ArkKitTestPeer => { + return ArkKitTestPeer.create(receiver); + }); + })), __memo_context.compute(((__memo_id) + (244802229)), ((): ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, _: ArkKitTestPeer) => void) => { + return ((__memo_context: __memo_context_type, __memo_id: __memo_id_type, _: ArkKitTestPeer): void => { + const __memo_scope = __memo_context.scope(((__memo_id) + (126778677)), 1); + const __memo_parameter__ = __memo_scope.param(0, _); + if (__memo_scope.unchanged) { + __memo_scope.cached; + return; + } + receiver.setTextOptions(__memo_parameter_content.value, __memo_parameter_value.value); + (__memo_parameter_style.value?.(__memo_context, ((__memo_id) + (96460547)), receiver)); + (__memo_parameter_content_.value?.(__memo_context, ((__memo_id) + (130745567)))); + receiver.applyAttributesFinish(); + { + __memo_scope.recache(); + return; + } + }); + }))); + { + __memo_scope.recache(); + return; + } +} + + +export interface KitTestAttribute extends TextAttribute { +} + +export class ArkKitTestComponent extends ArkTextComponent implements KitTestAttribute { + getPeer(): ArkTextPeer { + return (this.peer as ArkTextPeer); + } + initAttributeSet(modifier: AttributeModifier): void { + super.initAttributeSet(modifier); + } + setTextOptions(content?: string | Resource, value?: TextOptions): this { + super.setTextOptions(content, value); + return this; + } + font(fontValue: Font | undefined, options?: FontSettingOptions): this { + super.font(fontValue, options); + return this; + } + fontColor(value: ResourceColor | undefined): this { + super.fontColor(value); + return this; + } + fontSize(value: number | string | Resource | undefined): this { + super.fontSize(value); + return this; + } + minFontSize(value: number | string | Resource | undefined): this { + super.minFontSize(value); + return this; + } + maxFontSize(value: number | string | Resource | undefined): this { + super.maxFontSize(value); + return this; + } + minFontScale(value: number | Resource | undefined): this { + super.minFontScale(value); + return this; + } + maxFontScale(value: number | Resource | undefined): this { + super.maxFontScale(value); + return this; + } + fontStyle(value: FontStyle | undefined): this { + super.fontStyle(value); + return this; + } + fontWeight(weight: number | FontWeight | string | undefined, options?: FontSettingOptions): this { + super.fontWeight(weight, options); + return this; + } + lineSpacing(value: LengthMetrics | undefined): this { + super.lineSpacing(value); + return this; + } + textAlign(value: TextAlign | undefined): this { + super.textAlign(value); + return this; + } + lineHeight(value: number | string | Resource | undefined): this { + super.lineHeight(value); + return this; + } + textOverflow(value: TextOverflowOptions | undefined): this { + super.textOverflow(value); + return this; + } + fontFamily(value: string | Resource | undefined): this { + super.fontFamily(value); + return this; + } + maxLines(value: number | undefined): this { + super.maxLines(value); + return this; + } + decoration(value: DecorationStyleInterface | undefined): this { + super.decoration(value); + return this; + } + letterSpacing(value: number | string | undefined): this { + super.letterSpacing(value); + return this; + } + textCase(value: TextCase | undefined): this { + super.textCase(value); + return this; + } + baselineOffset(value: number | string | undefined): this { + super.baselineOffset(value); + return this; + } + copyOption(value: CopyOptions | undefined): this { + super.copyOption(value); + return this; + } + draggable(value: boolean | undefined): this { + super.draggable(value); + return this; + } + textShadow(value: ShadowOptions | Array | undefined): this { + super.textShadow(value); + return this; + } + heightAdaptivePolicy(value: TextHeightAdaptivePolicy | undefined): this { + super.heightAdaptivePolicy(value); + return this; + } + textIndent(value: Length | undefined): this { + super.textIndent(value); + return this; + } + wordBreak(value: WordBreak | undefined): this { + super.wordBreak(value); + return this; + } + lineBreakStrategy(value: LineBreakStrategy | undefined): this { + super.lineBreakStrategy(value); + return this; + } + onCopy(value: ((breakpoints: string) => void) | undefined): this { + super.onCopy(value); + return this; + } + caretColor(value: ResourceColor | undefined): this { + super.caretColor(value); + return this; + } + selectedBackgroundColor(value: ResourceColor | undefined): this { + super.selectedBackgroundColor(value); + return this; + } + ellipsisMode(value: EllipsisMode | undefined): this { + super.ellipsisMode(value); + return this; + } + enableDataDetector(value: boolean | undefined): this { + super.enableDataDetector(value); + return this; + } + dataDetectorConfig(value: TextDataDetectorConfig | undefined): this { + super.dataDetectorConfig(value); + return this; + } + onTextSelectionChange(value: ((first: number, last: number) => void) | undefined): this { + super.onTextSelectionChange(value); + return this; + } + fontFeature(value: string | undefined): this { + super.fontFeature(value); + return this; + } + marqueeOptions(value: TextMarqueeOptions | undefined): this { + super.marqueeOptions(value); + return this; + } + onMarqueeStateChange(value: ((parameter: MarqueeState) => void) | undefined): this { + super.onMarqueeStateChange(value); + return this; + } + privacySensitive(value: boolean | undefined): this { + super.privacySensitive(value); + return this; + } + textSelectable(value: TextSelectableMode | undefined): this { + super.textSelectable(value); + return this; + } + editMenuOptions(value: EditMenuOptions | undefined): this { + super.editMenuOptions(value); + return this; + } + halfLeading(value: boolean | undefined): this { + super.halfLeading(value); + return this; + } + enableHapticFeedback(value: boolean | undefined): this { + super.enableHapticFeedback(value); + return this; + } + selection(selectionStart: number | undefined, selectionEnd: number | undefined): this { + super.selection(selectionStart, selectionEnd); + return this; + } + bindSelectionMenu( + spanType: TextSpanType | undefined, + content: CustomBuilder | undefined, + responseType: TextResponseType | undefined, + options?: SelectionMenuOptions + ): this { + super.bindSelectionMenu(spanType, content, responseType, options); + return this; + } + applyAttributesFinish(): void { + super.applyAttributesFinish(); + } + +} + +export class ArkKitTestPeer extends ArkTextPeer { + constructor(peerPtr: KPointer, id: int32, name: string) { + this(peerPtr, id, name, 0); + } + + constructor(peerPtr: KPointer, id: int32) { + this(peerPtr, id, "", 0); + } + + protected constructor(peerPtr: KPointer, id: int32, name: string, flags: int32) { + super(peerPtr, id, name, flags); + } + + static create(component: ComponentBase | undefined, gensym___1?: int32): ArkKitTestPeer { + let flags: int32 = (((gensym___1) !== (undefined)) ? gensym___1 : (0 as int32)); + const textPeer = ArkTextPeer.create(component, flags); + const _peerPtr = textPeer.getPeerPtr(); + const peerId = textPeer.getId(); + const _peer = new ArkKitTestPeer(_peerPtr, peerId, "KitTest") + return _peer; + } + +} + + + + diff --git a/kittest/ets/kittest.ets b/kittest/ets/kittest.ets deleted file mode 100644 index 15245c2..0000000 --- a/kittest/ets/kittest.ets +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * 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. - */ - -import { PeerNode } from "arkui/PeerNode" -import { ComponentBase } from "arkui/ComponentBase" -import { ArkCommonMethodPeer } from "arkui/component/common" -import { NodeAttach } from "@koalaui/runtime/memo/node" -import { ArkTabsComponent } from "arkui/component/tabs" -import { ArkTextComponent } from "arkui/component/text" -import { ArkNavigationComponent } from "arkui/component/navigation" -import { ArkNavDestinationComponent } from "arkui/component/navDestination" -import { ArkListItemComponent } from "arkui/component/listItem" -import router from "@ohos/router" -import { Router } from "arkui/handwritten/Router" - -// class MyCommonAttribute implements CommonMethod { -// constructor() { -// console.log("MyCommonAttribute") -// } -// } - -// class MyUICommonAttribute implements UICommonMethod { -// constructor() { -// console.log("MyCommonAttribute") -// } -// } - -class MyComponent extends ComponentBase { - constructor() { - super() - console.log("MyComponent") - } -} - -export default class KitTest { - static { console.log("xxx") } - - constructor() { - const node = PeerNode.generateRootPeer(); - const component = new MyComponent(); - // const attribute = new MyCommonAttribute(); - // const uiAttribute = new MyUICommonAttribute(); - // const x = AxisAction.BEGIN - // node.setId(10) - } -} \ No newline at end of file -- Gitee