From 20dd5fea8cf57fe832c338b06130cd65ea3d9144 Mon Sep 17 00:00:00 2001 From: swx480578 Date: Fri, 30 May 2025 14:25:15 +0300 Subject: [PATCH 1/5] Description:support hms closed-source components configuration TicketNo:DTS0000000000000 Team:OTHERS Feature or Bugfix:Feature Binary Source:N PrivateCode(Yes/No):N --- arkui_transformer.py | 4 +- .../config/arkui_config.json | 5 +-- .../src/arkui_config_util.ts | 39 ++++++++++++++----- .../src/arkui_transformer.ts | 13 +++++-- .../arkui_transformer/src/component_file.ts | 4 +- .../src/interface_converter.ts | 4 +- 6 files changed, 49 insertions(+), 20 deletions(-) diff --git a/arkui_transformer.py b/arkui_transformer.py index 0d00f1b74d..fa96956589 100755 --- a/arkui_transformer.py +++ b/arkui_transformer.py @@ -30,6 +30,7 @@ def compile_package(options): nodejs = os.path.abspath(options.node_js) input_dir = os.path.abspath(options.input) output = os.path.abspath(options.output) + config_path = os.path.abspath(options.config_path) custom_env = { 'PATH': f"{os.path.dirname(os.path.abspath(options.node_js))}:{os.environ.get('PATH')}", 'NODE_HOME': os.path.dirname(os.path.abspath(options.node_js)), @@ -38,7 +39,7 @@ def compile_package(options): process = subprocess.run([npm, "run", "compile:arkui"], env=custom_env, cwd=tool_path, shell=False) if os.path.exists(package_path): - p = subprocess.run([nodejs, package_path, "--input-dir", input_dir, "--target-dir", output], cwd=tool_path, shell=False) + p = subprocess.run([nodejs, package_path, "--input-dir", input_dir, "--target-dir", output, "--config-path", config_path], cwd=tool_path, shell=False) else: print("arkui_transformer: tool path does not exist") @@ -49,6 +50,7 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('--input', required=True) parser.add_argument('--output', required=True) + parser.add_argument('--config_path', required=False, default='') parser.add_argument('--source_root_dir', required=True) parser.add_argument('--npm-path', required=True) parser.add_argument('--node-js', required=True) diff --git a/build-tools/arkui_transformer/config/arkui_config.json b/build-tools/arkui_transformer/config/arkui_config.json index bb1069ea54..890f2d737f 100644 --- a/build-tools/arkui_transformer/config/arkui_config.json +++ b/build-tools/arkui_transformer/config/arkui_config.json @@ -54,7 +54,6 @@ "Menu", "MenuItem", "MenuItemGroup", - "Metaball", "MovingPhotoView", "NavDestination", "NavRouter", @@ -130,8 +129,6 @@ "ContainerSpan", "ArcSwiper", "ArcScrollBar", - "ArcAlphabetIndexer", - "HdsNavigation", - "HdsNavDestination" + "ArcAlphabetIndexer" ] } \ No newline at end of file diff --git a/build-tools/arkui_transformer/src/arkui_config_util.ts b/build-tools/arkui_transformer/src/arkui_config_util.ts index a293a73c6c..585515b25d 100644 --- a/build-tools/arkui_transformer/src/arkui_config_util.ts +++ b/build-tools/arkui_transformer/src/arkui_config_util.ts @@ -39,7 +39,7 @@ export class ArkUIConfigUtil { }) this.noneUIconfig = JSON.parse(fs.readFileSync("./config/none_arkui_files.json", 'utf-8')) this.noneUIconfig.files.forEach(f => { - this.noneUIFielSet.add(f) + this.noneUIFileSet.add(f) }) const useM3Config: UseM3Config = JSON.parse(fs.readFileSync("./config/arkui_m3_white_list.json", 'utf-8')) this._useM3Files = useM3Config.useM3 @@ -48,21 +48,23 @@ export class ArkUIConfigUtil { private config: ArkUIConfig // None ui files private noneUIconfig: NoneUIConfig - private noneUIFielSet: Set = new Set - // Full set of component, should be manually mantained by config file + private noneUIFileSet: Set = new Set + // Full set of component, should be manually maintained by config file private componentSet: Set = new Set - // Component superclass set, generated by traversing the declartion AST + // Component superclass set, generated by traversing the declaration AST private componentSuperclassSet: Set = new Set // All class/interface name related to component attribute heritage private componentHeritage: Set = new Set // All implement relationship of component heritage - private componentHerirageRelation: Map = new Map + private componentHeritageRelation: Map = new Map // All component filename private componentFiles: Set = new Set - private file2Attrbiute: Map = new Map + private file2Attribute: Map = new Map private shouldNotHaveAttributeModifier: Set = new Set private _useMemoM3: boolean = false private _useM3Files: Array = [] + private _configPath: string = '' + get useMemoM3(): boolean { return this._useMemoM3 } @@ -78,10 +80,29 @@ export class ArkUIConfigUtil { return this._useM3Files.includes(path.basename(file)) } + get isHdsComponent(): boolean { + return this._configPath.length > 0 + } + public loadConfig(config: OptionValues): void { if (config.useMemoM3) { this._useMemoM3 = true } + if (config.configPath != undefined) { + this._configPath = config.configPath + } + if (this.isHdsComponent) { + this.config = JSON.parse(fs.readFileSync(this._configPath + "/hds_uicomponents.json", 'utf-8')) + this.componentSet.clear() + this.config.components.forEach(c => { + this.componentSet.add(c) + }) + this.noneUIconfig = JSON.parse(fs.readFileSync(this._configPath + "/hds_none_uicomponents.json", 'utf-8')) + this.noneUIFileSet.clear() + this.noneUIconfig.files.forEach(f => { + this.noneUIFileSet.add(f) + }) + } } private getPureName(name: string): string { return path.basename(name).replaceAll(".d.ts", "").replaceAll(".d.ets", "").replaceAll("_","").toLowerCase() @@ -102,7 +123,7 @@ export class ArkUIConfigUtil { let prev: string | undefined = undefined name.forEach(n => { if (prev) { - this.componentHerirageRelation.set(prev, n) + this.componentHeritageRelation.set(prev, n) } prev = n this.componentHeritage.add(n) @@ -112,13 +133,13 @@ export class ArkUIConfigUtil { } } public getComponentSuperclass(name: string): string | undefined { - return this.componentHerirageRelation.get(name) + return this.componentHeritageRelation.get(name) } public isUIHeritage(name: string): boolean { return this.componentHeritage.has(name) } public notUIFile(name: string): boolean { - return this.noneUIFielSet.has(this.getPureName(name)) + return this.noneUIFileSet.has(this.getPureName(name)) } public addComponentFile(name: string): void { this.componentFiles.add(this.getPureName(name)) diff --git a/build-tools/arkui_transformer/src/arkui_transformer.ts b/build-tools/arkui_transformer/src/arkui_transformer.ts index 65a17e6bff..5b51688ccc 100644 --- a/build-tools/arkui_transformer/src/arkui_transformer.ts +++ b/build-tools/arkui_transformer/src/arkui_transformer.ts @@ -29,8 +29,14 @@ function getFiles(dir: string, fileFilter: (f: string) => boolean): string[] { for (const entry of dirents) { const fullPath = path.join(dir, entry.name) if (entry.isFile() && fileFilter(fullPath) && !uiconfig.notUIFile(fullPath)) { - result.push(fullPath) - uiconfig.addComponentFile(fullPath) + let addFile: boolean = true + if (uiconfig.isHdsComponent) { + addFile = entry.name.startsWith("@hms.hds.") + } + if (addFile) { + result.push(fullPath) + uiconfig.addComponentFile(fullPath) + } } } return result @@ -49,7 +55,7 @@ function convertFiles(files: string[]): string[] { function printResult(source: string, file: ComponentFile) { const outPath = path.join(options.targetDir, file.outFileName) fs.mkdirSync(path.dirname(outPath), { recursive: true }); - fs.writeFileSync(outPath, source.concat(file.concactSource)) + fs.writeFileSync(outPath, source.concat(file.concatSource)) } function withM3Config(f: string, func: () => void) { @@ -96,6 +102,7 @@ function main() { const options = program .option('--input-dir ', "Path of where d.ets exist") .option('--target-dir ', "Path to generate d.ets file") + .option('--config-path ', "Path to folder with config files") .option('--use-memo-m3', "Generate code with m3 @memo annotations and functions with @ComponentBuilder", false) .parse() .opts() diff --git a/build-tools/arkui_transformer/src/component_file.ts b/build-tools/arkui_transformer/src/component_file.ts index 56bc9e62c1..f7a41d7615 100644 --- a/build-tools/arkui_transformer/src/component_file.ts +++ b/build-tools/arkui_transformer/src/component_file.ts @@ -41,10 +41,10 @@ export class ComponentFile { } public appendFunction(str: string) { - this.functionSource = str + this.functionSource += str } - get concactSource() { + get concatSource) { return [...this.attributeSource, this.functionSource].join('\n') } diff --git a/build-tools/arkui_transformer/src/interface_converter.ts b/build-tools/arkui_transformer/src/interface_converter.ts index 983db2f3c5..5a8c874ca1 100644 --- a/build-tools/arkui_transformer/src/interface_converter.ts +++ b/build-tools/arkui_transformer/src/interface_converter.ts @@ -112,9 +112,11 @@ function handleComponentInterface(node: ts.InterfaceDeclaration, file: Component const result = getAllInterfaceCallSignature(node, file.sourceFile, !uiconfig.useMemoM3); const declPattern = readLangTemplate() const declComponentFunction: string[] = [] + const attributeName = node.name!.escapedText as string + const componentName = attributeName.replaceAll('Interface', ''); result.forEach(p => { declComponentFunction.push(declPattern - .replaceAll("%COMPONENT_NAME%", file.componentName) + .replaceAll("%COMPONENT_NAME%", componentName) .replaceAll("%FUNCTION_PARAMETERS%", p.sig?.map(it => `${it}, `).join("") ?? "") .replaceAll("%COMPONENT_COMMENT%", p.comment)) }) -- Gitee From 84563fd2ac76054f92d4dc70ca60b03270dc24e6 Mon Sep 17 00:00:00 2001 From: swx480578 Date: Fri, 30 May 2025 16:02:26 +0300 Subject: [PATCH 2/5] Description:Fix syntax error TicketNo:DTS0000000000000 Team:OTHERS Feature or Bugfix:Bugfix Binary Source:N PrivateCode(Yes/No):N --- build-tools/arkui_transformer/src/component_file.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-tools/arkui_transformer/src/component_file.ts b/build-tools/arkui_transformer/src/component_file.ts index f7a41d7615..78f5306508 100644 --- a/build-tools/arkui_transformer/src/component_file.ts +++ b/build-tools/arkui_transformer/src/component_file.ts @@ -44,7 +44,7 @@ export class ComponentFile { this.functionSource += str } - get concatSource) { + get concatSource() { return [...this.attributeSource, this.functionSource].join('\n') } -- Gitee From 8f26e4ab0124b73c19a8ac402256f9e43a230081 Mon Sep 17 00:00:00 2001 From: swx480578 Date: Fri, 30 May 2025 17:39:30 +0300 Subject: [PATCH 3/5] Description:Fix configPath param TicketNo:DTS0000000000000 Team:OTHERS Feature or Bugfix:Bugfix Binary Source:N PrivateCode(Yes/No):N --- arkui_transformer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arkui_transformer.py b/arkui_transformer.py index fa96956589..fdc4f2dcf2 100755 --- a/arkui_transformer.py +++ b/arkui_transformer.py @@ -30,7 +30,7 @@ def compile_package(options): nodejs = os.path.abspath(options.node_js) input_dir = os.path.abspath(options.input) output = os.path.abspath(options.output) - config_path = os.path.abspath(options.config_path) + config_path = options.config_path custom_env = { 'PATH': f"{os.path.dirname(os.path.abspath(options.node_js))}:{os.environ.get('PATH')}", 'NODE_HOME': os.path.dirname(os.path.abspath(options.node_js)), -- Gitee From 2b41c58dc79e0466ae1f86a091f2c16559100af9 Mon Sep 17 00:00:00 2001 From: swx480578 Date: Fri, 30 May 2025 18:31:54 +0300 Subject: [PATCH 4/5] Description: Fix different behavior TicketNo:DTS0000000000000 Team:OTHERS Feature or Bugfix:Bugfix Binary Source:N PrivateCode(Yes/No):N --- arkui_transformer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arkui_transformer.py b/arkui_transformer.py index fdc4f2dcf2..c113f9eca1 100755 --- a/arkui_transformer.py +++ b/arkui_transformer.py @@ -31,6 +31,9 @@ def compile_package(options): input_dir = os.path.abspath(options.input) output = os.path.abspath(options.output) config_path = options.config_path + if (len(config_path) > 0): + config_path = os.path.abspath(options.config_path) + custom_env = { 'PATH': f"{os.path.dirname(os.path.abspath(options.node_js))}:{os.environ.get('PATH')}", 'NODE_HOME': os.path.dirname(os.path.abspath(options.node_js)), @@ -39,7 +42,10 @@ def compile_package(options): process = subprocess.run([npm, "run", "compile:arkui"], env=custom_env, cwd=tool_path, shell=False) if os.path.exists(package_path): - p = subprocess.run([nodejs, package_path, "--input-dir", input_dir, "--target-dir", output, "--config-path", config_path], cwd=tool_path, shell=False) + if (len(config_path) > 0): + p = subprocess.run([nodejs, package_path, "--input-dir", input_dir, "--target-dir", output, "--config-path", config_path], cwd=tool_path, shell=False) + else: + p = subprocess.run([nodejs, package_path, "--input-dir", input_dir, "--target-dir", output], cwd=tool_path, shell=False) else: print("arkui_transformer: tool path does not exist") -- Gitee From 7c3485fabf97312e2dbd0d0f79282e2150ee9924 Mon Sep 17 00:00:00 2001 From: swx480578 Date: Mon, 23 Jun 2025 14:45:24 +0300 Subject: [PATCH 5/5] Description:Add Metaball TicketNo:DTS000000000000000 Team: Feature or Bugfix:Bugfix Binary Source:N PrivateCode(Yes/No):N --- arkui_transformer.py | 10 +- build-tools/arkui_transformer/package.json | 6 +- .../arkui_transformer/src/add_import.ts | 4 +- .../src/arkui_config_util.ts | 44 +- hmscore_sdk_js/api/@hms.hds.Metaball.d.ts | 390 ++++++++++++++++++ .../config/hds_none_uicomponents.json | 4 + hmscore_sdk_js/config/hds_uicomponents.json | 7 + transform.sh | 8 + 8 files changed, 443 insertions(+), 30 deletions(-) create mode 100644 hmscore_sdk_js/api/@hms.hds.Metaball.d.ts create mode 100644 hmscore_sdk_js/config/hds_none_uicomponents.json create mode 100644 hmscore_sdk_js/config/hds_uicomponents.json create mode 100755 transform.sh diff --git a/arkui_transformer.py b/arkui_transformer.py index c113f9eca1..86e599bff1 100755 --- a/arkui_transformer.py +++ b/arkui_transformer.py @@ -30,8 +30,8 @@ def compile_package(options): nodejs = os.path.abspath(options.node_js) input_dir = os.path.abspath(options.input) output = os.path.abspath(options.output) - config_path = options.config_path - if (len(config_path) > 0): + config_path = '' + if (len(options.config_path) > 0): config_path = os.path.abspath(options.config_path) custom_env = { @@ -43,9 +43,9 @@ def compile_package(options): if os.path.exists(package_path): if (len(config_path) > 0): - p = subprocess.run([nodejs, package_path, "--input-dir", input_dir, "--target-dir", output, "--config-path", config_path], cwd=tool_path, shell=False) + p = subprocess.run([nodejs, package_path, "--input-dir", input_dir, "--target-dir", output, "--config-path", config_path], cwd=tool_path, shell=False) else: - p = subprocess.run([nodejs, package_path, "--input-dir", input_dir, "--target-dir", output], cwd=tool_path, shell=False) + p = subprocess.run([nodejs, package_path, "--input-dir", input_dir, "--target-dir", output], cwd=tool_path, shell=False) else: print("arkui_transformer: tool path does not exist") @@ -56,7 +56,7 @@ def main(): parser = argparse.ArgumentParser() parser.add_argument('--input', required=True) parser.add_argument('--output', required=True) - parser.add_argument('--config_path', required=False, default='') + parser.add_argument('--config-path', required=False, default='') parser.add_argument('--source_root_dir', required=True) parser.add_argument('--npm-path', required=True) parser.add_argument('--node-js', required=True) diff --git a/build-tools/arkui_transformer/package.json b/build-tools/arkui_transformer/package.json index e7f81dda98..0b658830aa 100644 --- a/build-tools/arkui_transformer/package.json +++ b/build-tools/arkui_transformer/package.json @@ -4,8 +4,8 @@ "main": "build/arkui_transformer.js", "scripts": { "compile:arkui": "rollup -c", - "transform:arkui": "npm run compile:arkui && node . --input-dir ../../etstest --target-dir ../../api/arkui/component.test/", - "transform:arkui:m3": "npm run compile:arkui && node . --input-dir ../../etstest --target-dir ../../api/arkui/component.test/ --use-memo-m3" + "transform:arkui": "npm run compile:arkui && node . --input-dir ../../temp/ --target-dir ../../out/hms/ets/ets1.2/api/ --config-path ../../hmscore_sdk_js/config/", + "transform:arkui:m3": "npm run compile:arkui && node . --input-dir ../../temp --target-dir ../../out/hms/ets/ets1.2/api/ --config-path ../../hmscore_sdk_js/config/ --use-memo-m3" }, "author": "", "license": "ISC", @@ -17,7 +17,7 @@ }, "devDependencies": { "@rollup/plugin-node-resolve": "^16.0.1", - "@rollup/plugin-typescript": "^12.1.2", + "@rollup/plugin-typescript": "^11.1.6", "rollup": "^3.29.5", "tslib": "^2.8.1" } diff --git a/build-tools/arkui_transformer/src/add_import.ts b/build-tools/arkui_transformer/src/add_import.ts index daf313dd4e..4459b20565 100644 --- a/build-tools/arkui_transformer/src/add_import.ts +++ b/build-tools/arkui_transformer/src/add_import.ts @@ -123,7 +123,7 @@ function createTargetImport(sourceFile: ts.SourceFile, context: ts.Transformatio ts.factory.createImportSpecifier(false, undefined, ts.factory.createIdentifier("ComponentBuilder")) ]) ), - ts.factory.createStringLiteral("./../stateManagement/runtime") + ts.factory.createStringLiteral("@ohos.arkui.stateManagement") ); targetImport.push(memoImport) @@ -151,7 +151,7 @@ function createTargetImport(sourceFile: ts.SourceFile, context: ts.Transformatio ] : []) ]) ), - ts.factory.createStringLiteral("./common"), + ts.factory.createStringLiteral("@ohos.arkui.component"), undefined ) targetImport.push(commonImport) diff --git a/build-tools/arkui_transformer/src/arkui_config_util.ts b/build-tools/arkui_transformer/src/arkui_config_util.ts index 585515b25d..aa4755e035 100644 --- a/build-tools/arkui_transformer/src/arkui_config_util.ts +++ b/build-tools/arkui_transformer/src/arkui_config_util.ts @@ -49,22 +49,21 @@ export class ArkUIConfigUtil { // None ui files private noneUIconfig: NoneUIConfig private noneUIFileSet: Set = new Set - // Full set of component, should be manually maintained by config file + // Full set of component, should be manually mantained by config file private componentSet: Set = new Set - // Component superclass set, generated by traversing the declaration AST + // Component superclass set, generated by traversing the declartion AST private componentSuperclassSet: Set = new Set // All class/interface name related to component attribute heritage private componentHeritage: Set = new Set // All implement relationship of component heritage - private componentHeritageRelation: Map = new Map + private componentHerirageRelation: Map = new Map // All component filename private componentFiles: Set = new Set - private file2Attribute: Map = new Map + private file2Attrbiute: Map = new Map private shouldNotHaveAttributeModifier: Set = new Set private _useMemoM3: boolean = false private _useM3Files: Array = [] private _configPath: string = '' - get useMemoM3(): boolean { return this._useMemoM3 } @@ -88,20 +87,25 @@ export class ArkUIConfigUtil { if (config.useMemoM3) { this._useMemoM3 = true } - if (config.configPath != undefined) { + + if (config.configPath != undefined && config.configPath != '') { this._configPath = config.configPath - } - if (this.isHdsComponent) { - this.config = JSON.parse(fs.readFileSync(this._configPath + "/hds_uicomponents.json", 'utf-8')) - this.componentSet.clear() - this.config.components.forEach(c => { - this.componentSet.add(c) - }) - this.noneUIconfig = JSON.parse(fs.readFileSync(this._configPath + "/hds_none_uicomponents.json", 'utf-8')) - this.noneUIFileSet.clear() - this.noneUIconfig.files.forEach(f => { - this.noneUIFileSet.add(f) - }) + // exception process: avoid non-existing given path + try { + this.config = JSON.parse(fs.readFileSync(this._configPath + "/hds_uicomponents.json", 'utf-8')) + this.componentSet.clear() + this.config.components.forEach(c => { + this.componentSet.add(c) + }) + this.noneUIconfig = JSON.parse(fs.readFileSync(this._configPath + "/hds_none_uicomponents.json", 'utf-8')) + this.noneUIFileSet.clear() + this.noneUIconfig.files.forEach(f => { + this.noneUIFileSet.add(f) + }) + } catch (error) { + this._configPath = '' + console.log("Load given hds_uicomponents file failed!", error); + } } } private getPureName(name: string): string { @@ -123,7 +127,7 @@ export class ArkUIConfigUtil { let prev: string | undefined = undefined name.forEach(n => { if (prev) { - this.componentHeritageRelation.set(prev, n) + this.componentHerirageRelation.set(prev, n) } prev = n this.componentHeritage.add(n) @@ -133,7 +137,7 @@ export class ArkUIConfigUtil { } } public getComponentSuperclass(name: string): string | undefined { - return this.componentHeritageRelation.get(name) + return this.componentHerirageRelation.get(name) } public isUIHeritage(name: string): boolean { return this.componentHeritage.has(name) diff --git a/hmscore_sdk_js/api/@hms.hds.Metaball.d.ts b/hmscore_sdk_js/api/@hms.hds.Metaball.d.ts new file mode 100644 index 0000000000..82e737da27 --- /dev/null +++ b/hmscore_sdk_js/api/@hms.hds.Metaball.d.ts @@ -0,0 +1,390 @@ +/* + * Copyright (c) Huawei Technologies Co., Ltd. 2024-2024. All rights reserved. + */ + +/** + * @file Defines the Metaball Component + * @kit UIDesignKit + */ + +/*** if arkts 1.2 */ +import { AnimateParam, CustomBuilder, ClickEvent } from '@ohos.arkui.component'; +import { ResourceColor, ResourceStr, Dimension, Length } from '@ohos.arkui.component'; +/*** endif */ + +/** + * Defines the Metaball ball params. + * + * @interface BallParams + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ +export declare interface BallParams { + /** + * The x-coordinate of the center of the ball. + * + * @type { Length } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + centerX: Length; + + /** + * The y-coordinate of the center of the ball. + * + * @type { Length } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + centerY: Length; + + /** + * The radius of the Ball. + * + * @type { Length } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + radius: Length; + + /** + * Whether the Ball is isolated. Indicates whether combined with surrounding balls into a capsule. + * + * @type { boolean } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + isIsolated: boolean; +} + +/** + * Enumerated values of metaball animation scene. + * @enum { number } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ +export declare enum MetaballAnimationScene { + /** + * Normal animation scene. + * + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + NORMAL = 0, + + /** + * Animation scene with glow and enlarge. + * + * @syscap SystemCapability.MultimodalInput.Input.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + GLOW_ENLARGE = 1, + + /** + * Animation scene with glow enlarge and upwards. + * + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + GLOW_ENLARGE_UPWARDS = 2, + + /** + * Animation scene with glow enlarge and rightwards. + * + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + GLOW_ENLARGE_RIGHTWARDS = 3, + + /** + * Animation scene with glow enlarge upwards and rightwards. + * + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + GLOW_ENLARGE_UPWARDS_RIGHTWARDS = 4, + + /** + * Animation scene with glow and rightwards. + * + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + GLOW_RIGHTWARDS = 5 +} + +/** + * Defines the Metaball animation params. + * + * @interface MetaballAnimationParams + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ +declare interface MetaballAnimationParams { + /** + * Metaball animation param. + * + * @type { AnimateParam } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + animateParam: AnimateParam; + + /** + * Metaball animation scene. + * + * @type { MetaballAnimationScene } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + scene: MetaballAnimationScene; +} + +/** + * Provides a way to control Metaball. + * + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ +export declare class MetaballController { + /** + * Provides a way to control Metaball. + * + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + constructor(); + + /** + * Start animation of fusion ball. + * + * @param { Array } status Array of status of ball. Indicates whether combined with surrounding balls into a capsule. + * @param { MetaballAnimationParams } params Param of metaball animation. + * @param { Array } colors Array of stroke color of ball. If has no color, stroke is not need. + * @param { Length } stroke Width of stroke. If color array length is 0, stroke is not need. + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @throws { BusinessError } 401 - Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + startFusionBallAnimation(status: Array, params: MetaballAnimationParams, colors: Array, stroke?: Length): void; +} + +/** + * Defines params of Metaball. + * + * @interface MetaballParams + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ +declare interface MetaballParams { + /** + * Array of ball params. + * + * @type { Array } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + ballParams: Array; + + /** + * Controller of Metaball component. + * + * @type { MetaballController } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + controller: MetaballController; +} + +/** + * The tap action triggers this method invocation. + * + * @extends ClickEvent + * @interface BallClickEvent + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ +export interface BallClickEvent extends ClickEvent { + /** + * Index of ball of click point. + * + * @type { Array } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ + ballIndexes: Array; +} + +/** + * Function that capsule on click callback. + * + * @typedef { function } CapsuleClickCallback + * @param { BallClickEvent } event Click event when called + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since arkts {'1.1':'5.1.0(18)','1.2':'6.0.0(20)'} + * @arkts 1.1&1.2 + */ +export declare type CapsuleClickCallback = (event: BallClickEvent) => void; + +/*** if arkts 1.1 */ +/** + * Defines the Metaball Component attribute functions. + * + * @extends CommonMethod + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since 5.1.0(18) + */ +export declare class MetaballAttribute extends CommonMethod { + /** + * Trigger a click event when a click is clicked. + * + * @param { CapsuleClickCallback } capsuleClickCallback + * @returns { MetaballAttribute } + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since 5.1.0(18) + */ + onCapsuleClick(capsuleClickCallback: CapsuleClickCallback): MetaballAttribute; +} +/*** endif */ +/*** if arkts 1.2 */ + +/** + * Defines the Metaball Component attribute functions. + * + * @extends CommonMethod + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since 6.0.0(20) + */ +export declare class MetaballAttribute extends CommonMethod { + /** + * Trigger a click event when a click is clicked. + * + * @param { CapsuleClickCallback } capsuleClickCallback + * @returns { MetaballAttribute } + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since 6.0.0(20) + */ + onCapsuleClick(capsuleClickCallback: CapsuleClickCallback): MetaballAttribute; +} +/*** endif */ +/** + * Defines the Metaball Component interface. + * + * @interface MetaballInterface + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since 5.1.0(18) + */ +interface MetaballInterface { + /** + * Sets the params. + * + * @param { MetaballParams } params + * @returns { MetaballAttribute } + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since 5.1.0(18) + * @arkts 1.1 + */ + (params: MetaballParams): MetaballAttribute; +} + +/** + * Defines the Metaball component interface. + * + * @interface MetaballInterface + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @since 6.0.0(20) + * @arkts 1.2 + */ +interface MetaballInterface { + /** + * Called when the Metaball component interface is used. + * + * @param { MetaballParams } params + * @returns { MetaballAttribute } Returns the instance of the MetaballAttribute. + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @since 6.0.0(20) + * @arkts 1.2 + */ + (params: MetaballParams): MetaballAttribute; +} + +/** + * Defines Metaball Component. + * + * @type { MetaballInterface } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @uicomponent + * @since 5.1.0(18) + */ +export declare const Metaball: MetaballInterface; + +/** + * Defines Metaball Component instance. + * + * @type { MetaballAttribute } + * @syscap SystemCapability.UIDesign.HDSComponent.Core + * @systemapi + * @since 5.1.0(18) + */ +declare const MetaballInstance: MetaballAttribute; diff --git a/hmscore_sdk_js/config/hds_none_uicomponents.json b/hmscore_sdk_js/config/hds_none_uicomponents.json new file mode 100644 index 0000000000..025b2de78a --- /dev/null +++ b/hmscore_sdk_js/config/hds_none_uicomponents.json @@ -0,0 +1,4 @@ +{ + "files": [ + ] +} \ No newline at end of file diff --git a/hmscore_sdk_js/config/hds_uicomponents.json b/hmscore_sdk_js/config/hds_uicomponents.json new file mode 100644 index 0000000000..8f237af9c0 --- /dev/null +++ b/hmscore_sdk_js/config/hds_uicomponents.json @@ -0,0 +1,7 @@ +{ + "components": [ + "Metaball", + "HdsNavigation", + "HdsNavDestination" + ] +} \ No newline at end of file diff --git a/transform.sh b/transform.sh new file mode 100755 index 0000000000..e1b00fa47b --- /dev/null +++ b/transform.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +cd build-tools/ +node handleApiFiles.js --path ../hmscore_sdk_js/api/ --output ../out/hms/ets/ets1.1/api/ --type ets +node handleApiFiles.js --path ../hmscore_sdk_js/api/ --output ../temp/ --type ets2 +cd arkui_transformer/ +npm run transform:arkui:m3 +cd ../../ -- Gitee