From 1ff38caaa2f11d7c1093ffec043a64b5aa0f4c62 Mon Sep 17 00:00:00 2001 From: liuhui Date: Mon, 28 Jul 2025 11:33:57 +0800 Subject: [PATCH] =?UTF-8?q?1.2=E6=8E=A5=E5=8F=A3=E6=8B=86=E5=88=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: liuhui --- .../component/ets/embedded_component.d.ts | 62 +--- .../component/ets/plugin_component.d.ts | 61 +--- .../component/ets/ui_extension_component.d.ts | 143 ++------ ...i.advanced.FullScreenLaunchComponent.d.ets | 2 +- ...ced.FullScreenLaunchComponent.static.d.ets | 91 +++++ api/@ohos.arkui.inspector.d.ts | 96 +---- api/@ohos.arkui.inspector.static.d.ets | 173 +++++++++ api/@ohos.pluginComponent.d.ts | 5 +- ...ets => @ohos.pluginComponent.static.d.ets} | 341 +++-------------- .../component/embeddedComponent.static.d.ets | 87 +++++ .../component/pluginComponent.static.d.ets | 194 ++++++++++ .../uiExtensionComponent.static.d.ets | 342 ++++++++++++++++++ 12 files changed, 1009 insertions(+), 588 deletions(-) create mode 100644 api/@ohos.arkui.advanced.FullScreenLaunchComponent.static.d.ets create mode 100644 api/@ohos.arkui.inspector.static.d.ets rename api/{@ohos.pluginComponent.d.ets => @ohos.pluginComponent.static.d.ets} (58%) create mode 100644 api/arkui/component/embeddedComponent.static.d.ets create mode 100644 api/arkui/component/pluginComponent.static.d.ets create mode 100644 api/arkui/component/uiExtensionComponent.static.d.ets diff --git a/api/@internal/component/ets/embedded_component.d.ts b/api/@internal/component/ets/embedded_component.d.ts index 1dca4bf8ee..810607e06a 100644 --- a/api/@internal/component/ets/embedded_component.d.ts +++ b/api/@internal/component/ets/embedded_component.d.ts @@ -18,13 +18,6 @@ * @kit ArkUI */ -/*** if arkts 1.2 */ -import Want from '../../@ohos.app.ability.Want' -import { Callback, ErrorCallback ,BusinessError} from '../../@ohos.base' -import { CommonMethod, TerminationInfo } from './common' -import { EmbeddedType } from './enums' -/*** endif */ - /** * Provide an interface for the EmbeddedComponent, which is used *
to render UI asynchronously @@ -32,8 +25,8 @@ import { EmbeddedType } from './enums' * @interface EmbeddedComponentInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * @noninterop */ interface EmbeddedComponentInterface { /** @@ -51,23 +44,6 @@ interface EmbeddedComponentInterface { loader: import('../api/@ohos.app.ability.Want').default, type: EmbeddedType ): EmbeddedComponentAttribute; - - /** - * Construct the EmbeddedComponent.
- * Called when the EmbeddedComponent is used. - * - * @param { Want } loader - indicates initialization parameter - * @param { EmbeddedType } type - indicates type of the EmbeddedComponent - * @returns { EmbeddedComponentAttribute } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - ( - loader: Want, - type: EmbeddedType - ): EmbeddedComponentAttribute; } /** @@ -87,7 +63,7 @@ declare interface TerminationInfo { * @atomicservice * @since 12 */ - code: number; + code: number; /** * Defines the additional termination information. @@ -97,7 +73,7 @@ declare interface TerminationInfo { * @atomicservice * @since 12 */ - want?: import('../api/@ohos.app.ability.Want').default; + want?: import('../api/@ohos.app.ability.Want').default; } /** @@ -106,8 +82,8 @@ declare interface TerminationInfo { * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 + * @noninterop */ declare class EmbeddedComponentAttribute extends CommonMethod { /** @@ -120,18 +96,6 @@ declare class EmbeddedComponentAttribute extends CommonMethod): EmbeddedComponentAttribute; - - /** - * Called when the provider of the embedded UI is terminated. - * - * @param { Callback } callback - * @returns { EmbeddedComponentAttribute } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - onTerminated(callback: Callback): EmbeddedComponentAttribute; /** * Called when some error occurred. @@ -143,18 +107,6 @@ declare class EmbeddedComponentAttribute extends CommonMethod } callback - * @returns { EmbeddedComponentAttribute } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 20 - * @arkts 1.2 - */ - onError(callback: ErrorCallback): EmbeddedComponentAttribute; } /** @@ -163,6 +115,7 @@ declare class EmbeddedComponentAttribute extends CommonMethod void; @@ -179,8 +155,8 @@ declare type PluginErrorCallback = (info: PluginErrorData) => void; * @interface PluginComponentInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @noninterop */ interface PluginComponentInterface { /** @@ -200,8 +176,7 @@ interface PluginComponentInterface { * @returns { PluginComponentAttribute } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ (options: PluginComponentOptions): PluginComponentAttribute; } @@ -212,8 +187,8 @@ interface PluginComponentInterface { * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'9','1.2':'20'} - * @arkts 1.1&1.2 + * @since 9 + * @noninterop */ declare class PluginComponentAttribute extends CommonMethod { /** @@ -233,8 +208,7 @@ declare class PluginComponentAttribute extends CommonMethod } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'14','1.2':'20'} - * @arkts 1.1&1.2 + * @since 14 */ areaChangePlaceholder?: Record; @@ -139,8 +121,7 @@ declare interface UIExtensionOptions { * @default DpiFollowStrategy.FOLLOW_UI_EXTENSION_ABILITY_DPI * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ dpiFollowStrategy?: DpiFollowStrategy; @@ -150,8 +131,7 @@ declare interface UIExtensionOptions { * @default WindowModeFollowStrategy.FOLLOW_UI_EXTENSION_ABILITY_WINDOW_MODE * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ windowModeFollowStrategy?: WindowModeFollowStrategy; } @@ -196,18 +176,6 @@ declare interface TerminationInfo { * @since 18 */ declare type ReceiveCallback = import('../api/@ohos.base').Callback>; - -/** - * Get Callback from @ohos.base. - * - * @typedef { Callback> } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @systemapi - * @since 20 - * @arkts 1.2 - */ -type ReceiveCallback = Callback>; - /** * This interface is used for send data to the UIExtensionAbility.
* It is returned from onRemoteReady callback of UIExtensionComponent
@@ -216,8 +184,7 @@ type ReceiveCallback = Callback>; * @interface UIExtensionProxy * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ declare interface UIExtensionProxy { /** @@ -235,8 +202,7 @@ declare interface UIExtensionProxy { * @param { Record } data * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ send(data: Record): void; @@ -261,8 +227,7 @@ declare interface UIExtensionProxy { * @throws { BusinessError } 100012 - Transferring data failed. * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ sendSync(data: Record): Record; @@ -283,8 +248,7 @@ declare interface UIExtensionProxy { * @param { Callback } callback - Callback of the listened event. * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ on(type: 'asyncReceiverRegister', callback: Callback): void; @@ -305,8 +269,7 @@ declare interface UIExtensionProxy { * @param { Callback } callback - Callback of the listened event. * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ on(type: 'syncReceiverRegister', callback: Callback): void; @@ -327,8 +290,7 @@ declare interface UIExtensionProxy { * @param { Callback } [callback] - Callback of the listened event. * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'asyncReceiverRegister', callback?: Callback): void; @@ -349,8 +311,7 @@ declare interface UIExtensionProxy { * @param { Callback } [callback] - Callback of the listened event. * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'18','1.2':'20'} - * @arkts 1.1&1.2 + * @since 18 */ off(type: 'syncReceiverRegister', callback?: Callback): void; } @@ -362,8 +323,7 @@ declare interface UIExtensionProxy { * @interface UIExtensionComponentInterface * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 */ interface UIExtensionComponentInterface { /** @@ -391,24 +351,6 @@ interface UIExtensionComponentInterface { want: import('../api/@ohos.app.ability.Want').default, options?: UIExtensionOptions ): UIExtensionComponentAttribute; - - /** - * Construct the UIExtensionComponent.
- * Called when the UIExtensionComponent is used. - * - * @param { Want } want - indicates the want of UIExtensionAbility - * @param { UIExtensionOptions } [options] - Construction configuration of UIExtensionComponentAttribute - * @returns { UIExtensionComponentAttribute } - * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @systemapi - * @since 20 - * @arkts 1.2 - */ - ( - want: Want, - options?: UIExtensionOptions - ): UIExtensionComponentAttribute; } /** @@ -417,8 +359,8 @@ interface UIExtensionComponentInterface { * @extends CommonMethod * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since arkts {'1.1':'10','1.2':'20'} - * @arkts 1.1&1.2 + * @since 10 + * @noninterop */ declare class UIExtensionComponentAttribute extends CommonMethod { /** @@ -433,21 +375,6 @@ declare class UIExtensionComponentAttribute extends CommonMethod ): UIExtensionComponentAttribute; - - /** - * callback called when remote UIExtensionAbility object is ready for receive data - * - * @param { Callback } callback - * @returns { UIExtensionComponentAttribute } - * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @systemapi - * @since 20 - * @arkts 1.2 - */ - onRemoteReady( - callback: Callback - ): UIExtensionComponentAttribute; /** * @param { import('../api/@ohos.base').Callback<{ [key: string]: Object }> } callback @@ -464,8 +391,7 @@ declare class UIExtensionComponentAttribute extends CommonMethod } callback - * @returns { UIExtensionComponentAttribute } - * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @systemapi - * @since 20 - * @arkts 1.2 - */ - onError( - callback: ErrorCallback - ): UIExtensionComponentAttribute; /** * Called when the provider of the embedded UI is terminated. @@ -535,8 +446,7 @@ declare class UIExtensionComponentAttribute extends CommonMethod): UIExtensionComponentAttribute; @@ -546,8 +456,7 @@ declare class UIExtensionComponentAttribute extends CommonMethod): UIExtensionComponentAttribute; } @@ -558,6 +467,7 @@ declare class UIExtensionComponentAttribute extends CommonMethod | Array } RecordData + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @arkts 1.2 + */ +export type RecordData = undefined | null | Object | Record | Array; + +/** + * Declares the FullScreenLaunchComponent, a component provided by ArkUI that allows + * you to define and use it in your application through the ArkTS-based declarative + * development paradigm. + * @struct { FullScreenLaunchComponent } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +@Component +export declare struct FullScreenLaunchComponent { + /** + * Sets the component content. + * @type { Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + @BuilderParam content: Callback; + /** + * Indicates atomic service appId. + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + appId: string; + /** + * Indicates the atomic service start options. + * @type { ?AtomicServiceOptions } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + options?: AtomicServiceOptions; + /** + * Callback triggered when an error occurs during running of the started ExtensionAbility. + * It is supported only when the atomic service runs in embedded mode, + * with the parameter being of type BusinessError. + * @type { ?ErrorCallback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onError?: ErrorCallback; + /** + * Callback triggered when the EmbeddableUIAbility is terminated to receive the information + * about the termination. It is supported only when the atomic service runs in embedded mode, + * with the parameter being of type TerminationInfo. + * @type { ?Callback } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onTerminated?: Callback; + /** + * Indicates the callback of onReceive. + * @type { ?Callback> } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onReceive?: Callback>; +} \ No newline at end of file diff --git a/api/@ohos.arkui.inspector.d.ts b/api/@ohos.arkui.inspector.d.ts index 2634340ef8..7588379244 100644 --- a/api/@ohos.arkui.inspector.d.ts +++ b/api/@ohos.arkui.inspector.d.ts @@ -33,8 +33,7 @@ import { Callback } from './@ohos.base'; * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ declare namespace inspector { @@ -51,8 +50,7 @@ declare namespace inspector { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ interface ComponentObserver { @@ -73,8 +71,7 @@ declare namespace inspector { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'layout', callback: () => void): void; @@ -95,8 +92,7 @@ declare namespace inspector { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'layout', callback?: () => void): void; @@ -117,8 +113,7 @@ declare namespace inspector { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ on(type: 'draw', callback: () => void): void; @@ -139,8 +134,7 @@ declare namespace inspector { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 */ off(type: 'draw', callback?: () => void): void; @@ -184,85 +178,11 @@ declare namespace inspector { * @syscap SystemCapability.ArkUI.ArkUI.Full * @crossplatform * @atomicservice - * @since arkts {'1.1':'12','1.2':'20'} - * @arkts 1.1&1.2 + * @since 12 * @deprecated since 18 * @useinstead ohos.arkui.UIContext.UIInspector#createComponentObserver */ function createComponentObserver(id: string): ComponentObserver; - - /** - * Obtains all attributes of the component with the specified ID. - * - * @param { string } id - ID of the component whose attributes are to be obtained. - * @returns { string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @test - * @arkts 1.2 - */ - function getInspectorByKey(id: string): string; - - /** - * Get components tree. - * - * @returns { Object } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @test - * @arkts 1.2 - */ - function getInspectorTree(): Object; - - /** - * Sends an event to the component with the specified ID. - * - * @param { string } id - ID of the component for which the event is to be sent. - * @param { number } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. - * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". - * @returns { boolean } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @test - * @arkts 1.2 - */ - function sendEventByKey(id: string, action: number, params: string): boolean; } -export default inspector; -/** - * export function getInspectorByKey from inspector namespace and provide it for kit ArkUI. - * @constant - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ -export const GETINSPECTORBYKEY = inspector.getInspectorByKey; -/** - * export function getInspectorTree from inspector namespace and provide it for kit ArkUI. - * @constant - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ -export const GETINSPECTORTREE = inspector.getInspectorTree; -/** - * export function sendEventByKey from inspector namespace and provide it for kit ArkUI. - * @constant - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @crossplatform - * @atomicservice - * @since 20 - * @arkts 1.2 - */ -export const SENDEVENTBYKEY = inspector.sendEventByKey; \ No newline at end of file +export default inspector; \ No newline at end of file diff --git a/api/@ohos.arkui.inspector.static.d.ets b/api/@ohos.arkui.inspector.static.d.ets new file mode 100644 index 0000000000..cdf11d54db --- /dev/null +++ b/api/@ohos.arkui.inspector.static.d.ets @@ -0,0 +1,173 @@ +/* + * 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ +import { Callback } from './@ohos.base'; + +/** + * Used to do observer layout and draw event for component. + * + * @namespace inspector + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +declare namespace inspector { + + /** + * The ComponentObserver is used to listen for layout, draw and drawChildren events. + * + * @interface ComponentObserver + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + interface ComponentObserver { + + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the component layout complete. + * @param { 'layout' } type - type of the listened event. + * @param { Callback } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onLayout(type: 'layout', callback: Callback): void; + + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the component layout complete. + * @param { 'layout' } type - type of the listened event. + * @param { Callback } [callback] - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + offLayout(type: 'layout', callback?: Callback): void; + + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the component draw complete. + * @param { 'draw' } type - type of the listened event. + * @param { Callback } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDraw(type: 'draw', callback: Callback): void; + + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the component draw complete. + * @param { 'draw' } type - type of the listened event. + * @param { Callback } [callback] - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + offDraw(type: 'draw', callback?: Callback): void; + + /** + * Registers a callback with the corresponding query condition by using the handle. + * This callback is triggered when the child of component draw complete. + * @param { 'drawChildren' } type - type of the listened event. + * @param { Callback } callback - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onDrawChildren(type: 'drawChildren', callback: Callback): void; + + /** + * Deregisters a callback with the corresponding query condition by using the handle. + * This callback is not triggered when the child of component draw complete. + * @param { 'drawChildren' } type - type of the listened event. + * @param { Callback } [callback] - callback of the listened event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + offDrawChildren(type: 'drawChildren', callback?: Callback): void; + + /** + * @since 20 + */ + overload on { onLayout, onDraw, onDrawChildren } + /** + * @since 20 + */ + overload off { offLayout, offDraw, offDrawChildren } + } + + /** + * Sets the component after layout or draw criteria and returns the corresponding listening handle + * @param { string } id - component id. + * @returns { ComponentObserver } create listener for observer component event. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @deprecated since 18 + * @useinstead ohos.arkui.UIContext.UIInspector#createComponentObserver + */ + function createComponentObserver(id: string): ComponentObserver; + /** + * Obtains all attributes of the component with the specified ID. + * + * @param { string } id - ID of the component whose attributes are to be obtained. + * @returns { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @test + */ + function getInspectorByKey(id: string): string; + /** + * Get components tree. + * + * @returns { Object } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @test + */ + function getInspectorTree(): Object; + /** + * Sends an event to the component with the specified ID. + * + * @param { string } id - ID of the component for which the event is to be sent. + * @param { int } action - Type of the event to be sent. The options are as follows: Click event: 10 LongClick: 11. + * @param { string } params - Event parameters. If there is no parameter, pass an empty string "". + * @returns { boolean } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + * @test + */ + function sendEventByKey(id: string, action: int, params: string): boolean; +} +export default inspector; +/** + * export function getInspectorByKey from inspector namespace and provide it for kit ArkUI. + * @constant + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export const GETINSPECTORBYKEY = inspector.getInspectorByKey; +/** + * export function getInspectorTree from inspector namespace and provide it for kit ArkUI. + * @constant + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export const GETINSPECTORTREE = inspector.getInspectorTree; +/** + * export function sendEventByKey from inspector namespace and provide it for kit ArkUI. + * @constant + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ +export const SENDEVENTBYKEY = inspector.sendEventByKey; diff --git a/api/@ohos.pluginComponent.d.ts b/api/@ohos.pluginComponent.d.ts index b0666d852a..664140e643 100644 --- a/api/@ohos.pluginComponent.d.ts +++ b/api/@ohos.pluginComponent.d.ts @@ -18,9 +18,6 @@ * @kit ArkUI */ -import { AsyncCallback } from './@ohos.base'; -import Want from './@ohos.app.ability.Want'; - /** * Plugin component template property. * @@ -103,7 +100,7 @@ declare namespace pluginComponentManager { * @atomicservice * @since 12 */ - type KVObject = { [key: string]: number | string | boolean | [] | KVObject } + type KVObject = { [key: string]: number | string | boolean | [] | KVObject }; /** * Plugin component push parameters. diff --git a/api/@ohos.pluginComponent.d.ets b/api/@ohos.pluginComponent.static.d.ets similarity index 58% rename from api/@ohos.pluginComponent.d.ets rename to api/@ohos.pluginComponent.static.d.ets index 5f79e3d5e1..d61c495c85 100644 --- a/api/@ohos.pluginComponent.d.ets +++ b/api/@ohos.pluginComponent.static.d.ets @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-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 @@ -16,6 +16,7 @@ /** * @file * @kit ArkUI + * @arkts 1.2 */ import { AsyncCallback } from './@ohos.base'; @@ -26,15 +27,7 @@ import Want from './@ohos.app.ability.Want'; * * @interface PluginComponentTemplate * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ -/** - * Plugin component template property. - * - * @interface PluginComponentTemplate - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ export interface PluginComponentTemplate { /** @@ -42,15 +35,7 @@ export interface PluginComponentTemplate { * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines the source - * - * @type { string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ source: string; @@ -59,15 +44,7 @@ export interface PluginComponentTemplate { * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines the ability - * - * @type { string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ ability: string; } @@ -77,15 +54,7 @@ export interface PluginComponentTemplate { * * @namespace pluginComponentManager * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ -/** - * Plugin component manager interface. - * - * @namespace pluginComponentManager - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ declare namespace pluginComponentManager { /** @@ -93,32 +62,22 @@ declare namespace pluginComponentManager { * * @typedef { object } KVObject * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 + * @since 20 */ /** * Defines KVObject * - * @typedef { object } KVObject + * @typedef { Record | KVObject> } KVObject * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ - export type KVObject = Record> - + export type KVObject = Record | KVObject> /** * Plugin component push parameters. * * @interface PushParameters * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Plugin component push parameters. - * - * @interface PushParameters - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ export interface PushParameters { /** @@ -126,15 +85,7 @@ declare namespace pluginComponentManager { * * @type { Want } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines want. - * - * @type { Want } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ want: Want; @@ -143,15 +94,7 @@ declare namespace pluginComponentManager { * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines name. - * - * @type { string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ name: string; @@ -160,15 +103,7 @@ declare namespace pluginComponentManager { * * @type { KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines data. - * - * @type { KVObject } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ data: KVObject; @@ -177,15 +112,7 @@ declare namespace pluginComponentManager { * * @type { KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines extraData. - * - * @type { KVObject } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ extraData: KVObject; @@ -194,15 +121,7 @@ declare namespace pluginComponentManager { * * @type { ?string } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines jsonPath. - * - * @type { ?string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ jsonPath?: string; } @@ -213,7 +132,7 @@ declare namespace pluginComponentManager { * @interface PushParameterForStage * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ export interface PushParameterForStage { /** @@ -222,7 +141,7 @@ declare namespace pluginComponentManager { * @type { Want } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ owner: Want; @@ -232,7 +151,7 @@ declare namespace pluginComponentManager { * @type { Want } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ target: Want; @@ -242,7 +161,7 @@ declare namespace pluginComponentManager { * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ name: string; @@ -252,7 +171,7 @@ declare namespace pluginComponentManager { * @type { KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ data: KVObject; @@ -262,7 +181,7 @@ declare namespace pluginComponentManager { * @type { KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ extraData: KVObject; @@ -272,7 +191,7 @@ declare namespace pluginComponentManager { * @type { ?string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ jsonPath?: string; } @@ -282,15 +201,7 @@ declare namespace pluginComponentManager { * * @interface RequestParameters * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Plugin component request parameters. - * - * @interface RequestParameters - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ export interface RequestParameters { /** @@ -298,15 +209,7 @@ declare namespace pluginComponentManager { * * @type { Want } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines want. - * - * @type { Want } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ want: Want; @@ -315,32 +218,16 @@ declare namespace pluginComponentManager { * * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines name. - * - * @type { string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ name: string; - - /** - * Defines data. - * - * @type { KVObject } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ + /** * Defines data. * * @type { KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ data: KVObject; @@ -349,15 +236,7 @@ declare namespace pluginComponentManager { * * @type { ?string } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines jsonPath. - * - * @type { ?string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ jsonPath?: string; } @@ -368,7 +247,7 @@ declare namespace pluginComponentManager { * @interface RequestParameterForStage * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ export interface RequestParameterForStage { /** @@ -377,7 +256,7 @@ declare namespace pluginComponentManager { * @type { Want } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ owner: Want; @@ -387,7 +266,7 @@ declare namespace pluginComponentManager { * @type { Want } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ target: Want; /** @@ -396,7 +275,7 @@ declare namespace pluginComponentManager { * @type { string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ name: string; @@ -406,7 +285,7 @@ declare namespace pluginComponentManager { * @type { KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ data: KVObject; @@ -416,7 +295,7 @@ declare namespace pluginComponentManager { * @type { ?string } * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @since 9 + * @since 20 */ jsonPath?: string; } @@ -426,15 +305,7 @@ declare namespace pluginComponentManager { * * @interface RequestCallbackParameters * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Plugin component request callback parameters. - * - * @interface RequestCallbackParameters - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ export interface RequestCallbackParameters { @@ -443,32 +314,16 @@ declare namespace pluginComponentManager { * * @type { PluginComponentTemplate } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines componentTemplate. - * - * @type { PluginComponentTemplate } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ componentTemplate: PluginComponentTemplate; - - /** - * Defines data. - * - * @type { KVObject } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ + /** * Defines data. * * @type { KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ data: KVObject; @@ -477,15 +332,7 @@ declare namespace pluginComponentManager { * * @type { KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines extraData. - * - * @type { KVObject } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ extraData: KVObject; } @@ -495,15 +342,7 @@ declare namespace pluginComponentManager { * * @interface RequestEventResult * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Plugin component request event result value. - * - * @interface RequestEventResult - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ export interface RequestEventResult { /** @@ -511,15 +350,7 @@ declare namespace pluginComponentManager { * * @type { ?string } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines template. - * - * @type { ?string } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ template?: string; @@ -528,15 +359,7 @@ declare namespace pluginComponentManager { * * @type { ?KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines data. - * - * @type { ?KVObject } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ data?: KVObject; @@ -545,15 +368,7 @@ declare namespace pluginComponentManager { * * @type { ?KVObject } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Defines extraData. - * - * @type { ?KVObject } - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ extraData?: KVObject; } @@ -562,16 +377,12 @@ declare namespace pluginComponentManager { * Plugin component push event callback. * * @typedef { function } OnPushEventCallback + * @param { Want } source - Push request sender's relevant information. + * @param { PluginComponentTemplate } template - Request component template name. + * @param { KVObject } data - data info. + * @param { KVObject } extraData - extra data info. * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Plugin component push event callback. - * - * @typedef { function } OnPushEventCallback - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ export type OnPushEventCallback = (source: Want, template: PluginComponentTemplate, data: KVObject, extraData: KVObject) => void; @@ -580,18 +391,13 @@ declare namespace pluginComponentManager { * Plugin component request event callback. * * @typedef { function } OnRequestEventCallback + * @param { Want } source - Request the sender to provide relevant information. + * @param { string } name - Template name. + * @param { KVObject } data - data info. + * @returns { RequestEventResult } * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Plugin component request event callback. - * - * @typedef { function } OnRequestEventCallback - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ - export type OnRequestEventCallback = (source: Want, name: string, data: KVObject) => RequestEventResult; /** @@ -600,16 +406,7 @@ declare namespace pluginComponentManager { * @param { PushParameters } param * @param { AsyncCallback } callback * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Plugin component push method. - * - * @param { PushParameters } param - * @param { AsyncCallback } callback - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ export function push(param: PushParameters, callback: AsyncCallback): void; @@ -619,16 +416,7 @@ declare namespace pluginComponentManager { * @param { RequestParameters } param * @param { AsyncCallback } callback * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Plugin component request method. - * - * @param { RequestParameters } param - * @param { AsyncCallback } callback - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ export function request(param: RequestParameters, callback: AsyncCallback): void; @@ -639,8 +427,7 @@ declare namespace pluginComponentManager { * @param { AsyncCallback } callback - Plugin component push event callback. * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @StageModelOnly - * @since 9 + * @since 20 */ export function push(param: PushParameterForStage, callback: AsyncCallback): void; @@ -651,8 +438,7 @@ declare namespace pluginComponentManager { * @param { AsyncCallback } callback - Plugin component request event callback. * @syscap SystemCapability.ArkUI.ArkUI.Full * @systemapi - * @StageModelOnly - * @since 9 + * @since 20 */ export function request(param: RequestParameterForStage, callback: AsyncCallback): void; @@ -662,16 +448,7 @@ declare namespace pluginComponentManager { * @param { string } eventType * @param { OnPushEventCallback | OnRequestEventCallback } callback * @syscap SystemCapability.ArkUI.ArkUI.Full - * @since 8 - */ - /** - * Plugin component event listener. - * - * @param { string } eventType - * @param { OnPushEventCallback | OnRequestEventCallback } callback - * @syscap SystemCapability.ArkUI.ArkUI.Full - * @atomicservice - * @since 12 + * @since 20 */ export function on(eventType: string, callback: OnPushEventCallback | OnRequestEventCallback): void; } diff --git a/api/arkui/component/embeddedComponent.static.d.ets b/api/arkui/component/embeddedComponent.static.d.ets new file mode 100644 index 0000000000..299e0a8f9e --- /dev/null +++ b/api/arkui/component/embeddedComponent.static.d.ets @@ -0,0 +1,87 @@ +/* + * 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. + */ + +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import Want from '../../@ohos.app.ability.Want' +import { memo, ComponentBuilder } from './../stateManagement/runtime'; +import { Callback, ErrorCallback ,BusinessError} from '../../@ohos.base' +import { AttributeModifier, CommonMethod, TerminationInfo } from './common' +import { EmbeddedType } from './enums' + +/** + * Define the attribute functions of EmbeddedComponent. + * + * @extends CommonMethod + * @typedef EmbeddedComponentAttribute + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @noninterop + * @since 20 + */ +export declare interface EmbeddedComponentAttribute extends CommonMethod { + /** + * Called when the provider of the embedded UI is terminated. + * + * @param { Callback | undefined } callback + * @returns { EmbeddedComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onTerminated(callback: Callback | undefined): this; + + /** + * Called when some error occurred. + * + * @param { ErrorCallback | undefined } callback + * @returns { EmbeddedComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + onError(callback: ErrorCallback | undefined): this; + + /** + * Set attributeModifier. + * + * @param { AttributeModifier | AttributeModifier | undefined } modifier + * @returns { EmbeddedComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @since 20 + */ + attributeModifier(modifier: AttributeModifier | AttributeModifier | undefined): this; +} + +/** + * Defines EmbeddedComponent Component. + * + * @param { Want } loader - indicates initialization parameter. + * @param { EmbeddedType } [type] - indicates type of the EmbeddedComponent. + * @param { function } [content_] - container + * @returns { EmbeddedComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @noninterop + * @since 20 + */ +@memo +@ComponentBuilder +export declare function EmbeddedComponent( + loader: Want, type?: EmbeddedType, + @memo + content_?: () => void, +): EmbeddedComponentAttribute \ No newline at end of file diff --git a/api/arkui/component/pluginComponent.static.d.ets b/api/arkui/component/pluginComponent.static.d.ets new file mode 100644 index 0000000000..a9a9ed0b58 --- /dev/null +++ b/api/arkui/component/pluginComponent.static.d.ets @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2021-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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ + +import { VoidCallback } from './units'; +import { memo, ComponentBuilder } from './../stateManagement/runtime'; +import { AttributeModifier, CommonMethod } from './common'; +/** + * PluginComponentTemplate + * + * @interface PluginComponentTemplate + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export interface PluginComponentTemplate { + /** + * Defines the plugin source name. + * + * @type { string | undefined } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + source: string | undefined; + /** + * Defines the bundle name of the Template. + * + * @type { string | undefined } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + bundleName: string | undefined; +} + +/** + * Defines RecordData. + * + * @typedef { undefined | null | Object | Record | Array } RecordData + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export type RecordData = undefined | null | Object | Record | Array; + +/** + * Define options used to construct a plugin component. + * AnonyMous Object Rectification + * + * @interface PluginComponentOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export declare interface PluginComponentOptions { + /** + * Plugin component template. + * AnonyMous Object Rectification + * @type { PluginComponentTemplate } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + template: PluginComponentTemplate; + /** + * Plugin component data. + * AnonyMous Object Rectification + * @type { RecordData } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + data: RecordData; +} +/** + * Data provided when an error occurs. + * AnonyMous Object Rectification + * + * @interface PluginErrorData + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export declare interface PluginErrorData { + /** + * Error code. + * AnonyMous Object Rectification + * @type { int } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + errcode: int; + /** + * Error message. + * AnonyMous Object Rectification + * @type { string } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + msg: string; +} +/** + * Callback invoked when an error occurs. + * AnonyMous Object Rectification + * + * @typedef { function } PluginErrorCallback + * @param { PluginErrorData } info - Plugin error data + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export type PluginErrorCallback = (info: PluginErrorData) => void; + +/** + * Defines the plugin component attribute functions. + * + * @extends CommonMethod + * @typedef PluginComponentAttribute + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @noninterop + * @since 20 + */ +export declare interface PluginComponentAttribute extends CommonMethod { + /** + * PluginComponent onComplete callback + * AnonyMous Object Rectification + * + * @param { VoidCallback | undefined } callback + * @returns { PluginComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + onComplete(callback: VoidCallback | undefined): this; + /** + * PluginComponent onError callback + * AnonyMous Object Rectification + * + * @param { PluginErrorCallback | undefined } callback + * @returns { PluginComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + onError(callback: PluginErrorCallback | undefined): this; + /** + * Set the attribute modifier of PluginComponent Component. + * + * @param { AttributeModifier | AttributeModifier | undefined } modifier + * @returns { PluginComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + attributeModifier(modifier: AttributeModifier | AttributeModifier | undefined): this; +} + +/** + * Defines PluginComponent Component. + * @param { PluginComponentOptions } options - The options + * @param { function } [content_] - container + * @returns { PluginComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @noninterop + * @since 20 + */ +@memo +@ComponentBuilder +export declare function PluginComponent( + options: PluginComponentOptions, + @memo + content_?: () => void, +): PluginComponentAttribute \ No newline at end of file diff --git a/api/arkui/component/uiExtensionComponent.static.d.ets b/api/arkui/component/uiExtensionComponent.static.d.ets new file mode 100644 index 0000000000..937802b344 --- /dev/null +++ b/api/arkui/component/uiExtensionComponent.static.d.ets @@ -0,0 +1,342 @@ +/* + * 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. + */ +/** + * @file + * @kit ArkUI + * @arkts 1.2 + */ +import Want from '../../@ohos.app.ability.Want'; +import { Callback, ErrorCallback, BusinessError } from '../../@ohos.base'; +import { CommonMethod, TerminationInfo } from './common'; +import { ComponentContent } from '../ComponentContent'; +import { memo, ComponentBuilder } from './../stateManagement/runtime'; +import { AttributeModifier, CommonMethod } from './common'; + +/** + * Defines RecordData. + * + * @typedef { undefined | null | Object | Record | Array } RecordData + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export type RecordData = undefined | null | Object | Record | Array; + +/** + * Enumeration of different types of DpiFollowStrategy. + * + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export declare enum DpiFollowStrategy { + /** + * Followed the host DPI. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + FOLLOW_HOST_DPI = 0, + /** + * Followed the UIExtensionAbility. + * + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + FOLLOW_UI_EXTENSION_ABILITY_DPI = 1 +} +/** + * Enumeration of different types of WindowModeFollowStrategy. + * @enum { number } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export declare enum WindowModeFollowStrategy { + /** + * Followed the host Window Mode. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + FOLLOW_HOST_WINDOW_MODE = 0, + /** + * Followed the UIExtensionAbility. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + FOLLOW_UI_EXTENSION_ABILITY_WINDOW_MODE = 1 +} +/** + * This interface is used to set the options for UIExtensionComponentAttribute during construction + * + * @interface UIExtensionOptions + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export declare interface UIExtensionOptions { + /** + * Set whether the current capability is used as a Caller.
+ * If set to true, as a Caller, the current token of UIExtensionComponent is set to rootToken. + * + * @type { ?boolean } + * @default false + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + isTransferringCaller?: boolean; + /** + * Set placeholder. + * If set placeholder ComponentContent, show placeholder node when connection is not established. + * + * @type { ?ComponentContent } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + placeholder?: ComponentContent; + /** + * Set Areachange placeholder. + * If the Areachange placeholder ComponentContent is set, the placeholder node is displayed until + * the UIExtensionComponent size change is complete. + * + * @type { ?Record } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + areaChangePlaceholder?: Record; + /** + * Set UIExtensionComponent Content Dpi Follow Strategy. + * + * @type { ?DpiFollowStrategy } + * @default DpiFollowStrategy.FOLLOW_UI_EXTENSION_ABILITY_DPI + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + dpiFollowStrategy?: DpiFollowStrategy; + /** + * Set UIExtensionComponent Content Window Mode Follow Strategy. + * @type { ?WindowModeFollowStrategy } + * @default WindowModeFollowStrategy.FOLLOW_UI_EXTENSION_ABILITY_WINDOW_MODE + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + windowModeFollowStrategy?: WindowModeFollowStrategy; +} +/** + * Get Callback from @ohos.base. + * + * @typedef { Callback> } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export type ReceiveCallback = Callback>; +/** + * This interface is used for send data to the UIExtensionAbility.
+ * It is returned from onRemoteReady callback of UIExtensionComponent
+ * when UIExtensionAbility connects successfully + * + * @interface UIExtensionProxy + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ +export declare interface UIExtensionProxy { + /** + * This function is for sending data to the UIExtensionAbility. + * AnonyMous Object Rectification + * + * @param { Record } data + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + send(data: Record): void; + /** + * This function is for sending data to the UIExtensionAbility and waiting for the result in blocking mode. + * AnonyMous Object Rectification + * + * @param { Record } data - Data send to the UIExtensionAbility. + * @returns { Record } data - Data transferred from the UIExtensionAbility. + * @throws { BusinessError } 100011 - No callback has been registered to respond to this request. + * @throws { BusinessError } 100012 - Transferring data failed. + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + sendSync(data: Record): Record; + /** + * Register the listener that watches for async data receiver callback being registered by UIExtensionAbility. + * AnonyMous Object Rectification + * + * @param { 'asyncReceiverRegister' } type - Indicates the type of event. + * @param { Callback } callback - Callback of the listened event. + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + onAsyncReceiverRegister(type: 'asyncReceiverRegister', callback: Callback): void; + /** + * Register the listener that watches for sync data receiver callback being registered by UIExtensionAbility. + * AnonyMous Object Rectification + * + * @param { 'syncReceiverRegister' } type - Indicates the type of event. + * @param { Callback } callback - Callback of the listened event. + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + onSyncReceiverRegister(type: 'syncReceiverRegister', callback: Callback): void; + /** + * Deregisters the listener that watches for async data receiver callback being registered by UIExtensionAbility. + * AnonyMous Object Rectification + * + * @param { 'asyncReceiverRegister' } type - Type of the listened event. + * @param { Callback } [callback] - Callback of the listened event. + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + offAsyncReceiverRegister(type: 'asyncReceiverRegister', callback?: Callback): void; + /** + * Deregisters the listener that watches for sync data receiver callback being registered by UIExtensionAbility. + * AnonyMous Object Rectification + * + * @param { 'syncReceiverRegister' } type - Type of the listened event. + * @param { Callback } [callback] - Callback of the listened event. + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + offSyncReceiverRegister(type: 'syncReceiverRegister', callback?: Callback): void; + /** + * @since 20 + */ + overload on { onAsyncReceiverRegister, onSyncReceiverRegister } + /** + * @since 20 + */ + overload off { offAsyncReceiverRegister, offSyncReceiverRegister } +} + +/** + * Define the attribute functions of UIExtensionComponent. + * + * @extends CommonMethod + * @typedef UIExtensionComponentAttribute + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @noninterop + * @since 20 + */ +export declare interface UIExtensionComponentAttribute extends CommonMethod { + /** + * callback called when remote UIExtensionAbility object is ready for receive data + * + * @param { Callback | undefined } callback + * @returns { UIExtensionComponentAttribute } + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + onRemoteReady(callback: Callback | undefined): this; + /** + * AnonyMous Object Rectification + * + * @param { ReceiveCallback | undefined } callback - Called when data received from UIExtensionAbility + * @returns { UIExtensionComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + onReceive(callback: ReceiveCallback | undefined): this; + /** + * called when some error occurred except disconnected from UIExtensionAbility. + * + * @param { ErrorCallback | undefined } callback + * @returns { UIExtensionComponentAttribute } + * @throws { BusinessError } 202 - Non-system applications are not allowed to use system APIs. + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + onError(callback: ErrorCallback | undefined): this; + /** + * Called when the provider of the embedded UI is terminated. + * + * @param { Callback | undefined } callback + * @returns { UIExtensionComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + onTerminated(callback: Callback | undefined): this; + /** + * Callback called when the UIExtensionAbility draw the first frame. + * @param { Callback | undefined } callback + * @returns { UIExtensionComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + onDrawReady(callback: Callback | undefined): this; + + /** + * Set the attribute modifier of UIExtensionComponent Component. + * + * @param { AttributeModifier | AttributeModifier | undefined } modifier + * @returns { UIExtensionComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @since 20 + */ + attributeModifier(modifier: AttributeModifier | AttributeModifier | undefined): this; +} + +/** + * Defines UIExtensionComponent Component. + * @param { Want } want - The want + * @param { UIExtensionOptions } [options] - The options + * @param { function } [content_] - container + * @returns { UIExtensionComponentAttribute } + * @syscap SystemCapability.ArkUI.ArkUI.Full + * @systemapi + * @noninterop + * @since 20 + */ +@memo +@ComponentBuilder +export declare function UIExtensionComponent( + want: Want, options?: UIExtensionOptions, + @memo + content_?: () => void, +): UIExtensionComponentAttribute \ No newline at end of file -- Gitee