diff --git a/arkoala-arkts/arkui/src/generated/ArkNavDestination.ts b/arkoala-arkts/arkui/src/generated/ArkNavDestination.ts deleted file mode 100644 index 65ae1a9b199f66ba24cd78d10a3eea97ed148ac3..0000000000000000000000000000000000000000 --- a/arkoala-arkts/arkui/src/generated/ArkNavDestination.ts +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright (c) 2024 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. - */ - - -// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! - -import { int32 } from "@koalaui/common" -import { KStringPtr, KBoolean } from "@koalaui/interop" -import { NodeAttach, remember } from "@koalaui/runtime" -import { runtimeType, RuntimeType, isResource, isInstanceOf } from "./peers/SerializerBase" -import { ComponentBase } from "./ComponentBase" -import { TypeChecker } from "#components" -import { ArkCommonMethodComponent } from "./ArkCommon" -import { ArkNavDestinationPeer } from "./peers/ArkNavDestinationPeer" -import { UseEventsProperties } from "./use_properties" -import { CommonMethod, SymbolGlyphModifier, CustomBuilder, LayoutSafeAreaType, LayoutSafeAreaEdge } from "./ArkCommonInterfaces" -import { NavDestinationAttribute, NavDestinationMode, NavigationSystemTransitionType, NestedScrollInfo, NavDestinationCommonTitle, NavDestinationCustomTitle } from "./ArkNavDestinationInterfaces" -import { Callback_Void, Callback_Boolean, Callback_NavDestinationContext_Void } from "./SyntheticDeclarations" -import { ResourceStr } from "./ArkUnitsInterfaces" -import { PixelMap } from "./ArkPixelMapMaterialized" -import { NavigationMenuItem, SystemBarStyle, NavigationTitleOptions, ToolbarItem, NavigationToolbarOptions } from "./ArkNavigationInterfaces" -import { NavDestinationContext } from "./ArkNavDestinationContextMaterialized" -import { Scroller } from "./ArkScrollerMaterialized" -import { Resource } from "./ArkResourceInterfaces" -/** @memo:stable */ -export class ArkNavDestinationComponent extends ArkCommonMethodComponent { - getPeer(): ArkNavDestinationPeer { - return (this.peer as ArkNavDestinationPeer) - } - /** @memo */ - setNavDestinationOptions(): this { - if (this.checkPriority("setNavDestinationOptions")) { - this.getPeer()?.setNavDestinationOptionsAttribute() - return this - } - return this - } - /** @memo */ - hideTitleBar(hide: boolean, animated?: boolean): this { - if (this.checkPriority("hideTitleBar")) { - const hide_type = runtimeType(hide) - const animated_type = runtimeType(animated) - if ((((RuntimeType.BOOLEAN == hide_type))) && (((RuntimeType.BOOLEAN == animated_type)))) { - const hide_casted = hide as (boolean) - const animated_casted = animated as (boolean) - this.getPeer()?.hideTitleBar1Attribute(hide_casted, animated_casted) - return this - } - if ((((RuntimeType.BOOLEAN == hide_type))) && (((RuntimeType.UNDEFINED == animated_type)))) { - const hide_casted = hide as (boolean) - this.getPeer()?.hideTitleBar0Attribute(hide_casted) - return this - } - throw new Error("Can not select appropriate overload") - } - return this - } - /** @memo */ - onShown(value: Function0): this { - if (this.checkPriority("onShown")) { - const value_casted = value as (Function0) - this.getPeer()?.onShownAttribute(value_casted) - return this - } - return this - } - /** @memo */ - onHidden(value: Function0): this { - if (this.checkPriority("onHidden")) { - const value_casted = value as (Function0) - this.getPeer()?.onHiddenAttribute(value_casted) - return this - } - return this - } - /** @memo */ - onBackPressed(value: Function0): this { - if (this.checkPriority("onBackPressed")) { - const value_casted = value as (Function0) - this.getPeer()?.onBackPressedAttribute(value_casted) - return this - } - return this - } - /** @memo */ - mode(value: NavDestinationMode): this { - if (this.checkPriority("mode")) { - const value_casted = value as (NavDestinationMode) - this.getPeer()?.modeAttribute(value_casted) - return this - } - return this - } - /** @memo */ - backButtonIcon(value: ResourceStr | PixelMap | SymbolGlyphModifier): this { - if (this.checkPriority("backButtonIcon")) { - const value_casted = value as (ResourceStr | PixelMap | SymbolGlyphModifier) - this.getPeer()?.backButtonIconAttribute(value_casted) - return this - } - return this - } - /** @memo */ - menus(value: Array | CustomBuilder): this { - if (this.checkPriority("menus")) { - const value_casted = value as (Array | CustomBuilder) - this.getPeer()?.menusAttribute(value_casted) - return this - } - return this - } - /** @memo */ - onReady(value: Function1): this { - if (this.checkPriority("onReady")) { - const value_casted = value as (Function1) - this.getPeer()?.onReadyAttribute(value_casted) - return this - } - return this - } - /** @memo */ - onWillAppear(value: Function0): this { - if (this.checkPriority("onWillAppear")) { - const value_casted = value as (Function0) - this.getPeer()?.onWillAppearAttribute(value_casted) - return this - } - return this - } - /** @memo */ - onWillDisappear(value: Function0): this { - if (this.checkPriority("onWillDisappear")) { - const value_casted = value as (Function0) - this.getPeer()?.onWillDisappearAttribute(value_casted) - return this - } - return this - } - /** @memo */ - onWillShow(value: Function0): this { - if (this.checkPriority("onWillShow")) { - const value_casted = value as (Function0) - this.getPeer()?.onWillShowAttribute(value_casted) - return this - } - return this - } - /** @memo */ - onWillHide(value: Function0): this { - if (this.checkPriority("onWillHide")) { - const value_casted = value as (Function0) - this.getPeer()?.onWillHideAttribute(value_casted) - return this - } - return this - } - /** @memo */ - systemBarStyle(value?: SystemBarStyle): this { - if (this.checkPriority("systemBarStyle")) { - const value_casted = value as (SystemBarStyle | undefined) - this.getPeer()?.systemBarStyleAttribute(value_casted) - return this - } - return this - } - /** @memo */ - recoverable(value?: boolean): this { - if (this.checkPriority("recoverable")) { - const value_casted = value as (boolean | undefined) - this.getPeer()?.recoverableAttribute(value_casted) - return this - } - return this - } - /** @memo */ - systemTransition(value: NavigationSystemTransitionType): this { - if (this.checkPriority("systemTransition")) { - const value_casted = value as (NavigationSystemTransitionType) - this.getPeer()?.systemTransitionAttribute(value_casted) - return this - } - return this - } - /** @memo */ - bindToScrollable(value: Array): this { - if (this.checkPriority("bindToScrollable")) { - const value_casted = value as (Array) - this.getPeer()?.bindToScrollableAttribute(value_casted) - return this - } - return this - } - /** @memo */ - bindToNestedScrollable(value: Array): this { - if (this.checkPriority("bindToNestedScrollable")) { - const value_casted = value as (Array) - this.getPeer()?.bindToNestedScrollableAttribute(value_casted) - return this - } - return this - } - /** @memo */ - title(value: string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle | Resource, options?: NavigationTitleOptions): this { - if (this.checkPriority("title")) { - const value_casted = value as (string | CustomBuilder | NavDestinationCommonTitle | NavDestinationCustomTitle | Resource) - const options_casted = options as (NavigationTitleOptions | undefined) - this.getPeer()?.titleAttribute(value_casted, options_casted) - return this - } - return this - } - /** @memo */ - toolbarConfiguration(toolbarParam: Array | CustomBuilder, options?: NavigationToolbarOptions): this { - if (this.checkPriority("toolbarConfiguration")) { - const toolbarParam_casted = toolbarParam as (Array | CustomBuilder) - const options_casted = options as (NavigationToolbarOptions | undefined) - this.getPeer()?.toolbarConfigurationAttribute(toolbarParam_casted, options_casted) - return this - } - return this - } - /** @memo */ - hideToolBar(hide: boolean, animated?: boolean): this { - if (this.checkPriority("hideToolBar")) { - const hide_casted = hide as (boolean) - const animated_casted = animated as (boolean | undefined) - this.getPeer()?.hideToolBarAttribute(hide_casted, animated_casted) - return this - } - return this - } - /** @memo */ - ignoreLayoutSafeArea(types?: Array, edges?: Array): this { - if (this.checkPriority("ignoreLayoutSafeArea")) { - const types_casted = types as (Array | undefined) - const edges_casted = edges as (Array | undefined) - this.getPeer()?.ignoreLayoutSafeAreaAttribute(types_casted, edges_casted) - return this - } - return this - } - public applyAttributesFinish(): void { - // we calls this function outside of class, so need to make it public - super.applyAttributesFinish() - } -} - -/** @memo */ -export function ArkNavDestination( - /** @memo */ - style: ((attributes: ArkNavDestinationComponent) => void) | undefined, - /** @memo */ - content_: (() => void) | undefined, - -) { - const receiver = remember(() => { - return new ArkNavDestinationComponent() - }) - NodeAttach((): ArkNavDestinationPeer => ArkNavDestinationPeer.create(receiver), (_: ArkNavDestinationPeer) => { - receiver.setNavDestinationOptions() - style?.(receiver) - content_?.() - receiver.applyAttributesFinish() - }) -} diff --git a/arkoala-arkts/arkui/src/generated/index.ts b/arkoala-arkts/arkui/src/generated/index.ts index 5d35042a1cef3101ebb2c4be25ead79663c1da74..adb242f7224c9da8ec9cff3413d0ebd83b6fef40 100644 --- a/arkoala-arkts/arkui/src/generated/index.ts +++ b/arkoala-arkts/arkui/src/generated/index.ts @@ -49,7 +49,6 @@ export * from "./ArkMediaCachedImage" export * from "./ArkMenu" export * from "./ArkMenuItem" export * from "./ArkMenuItemGroup" -export * from "./ArkNavDestination" export * from "./ArkNavRouter" export * from "./ArkNavigator" export * from "./ArkNodeContainer" @@ -151,7 +150,6 @@ export * from "./ArkImageAnalyzerControllerMaterialized" export * from "./ArkListScrollerMaterialized" export * from "./ArkMatrix2DMaterialized" export * from "./ArkNavDestinationContextMaterialized" -export * from "./ArkNavPathStackMaterialized" export * from "./ArkNavigationTransitionProxyMaterialized" export * from "./ArkPatternLockControllerMaterialized" export * from "./ArkRichEditorBaseControllerMaterialized" @@ -281,7 +279,7 @@ export * from "./ArkPageTransitionInterfaces" export * from "./ArkPanelInterfaces" export * from "./ArkParticleInterfaces" export * from "./ArkPasteButtonInterfaces" -export * from "./ArkPathInterfaces" +// export * from "./ArkPathInterfaces" export * from "./ArkPatternLockInterfaces" export * from "./ArkPluginComponentInterfaces" export * from "./ArkPolygonInterfaces" diff --git a/arkoala-arkts/arkui/src/handwritten/ArkNavDestinationContext.ts b/arkoala-arkts/arkui/src/handwritten/ArkNavDestinationContext.ts new file mode 100644 index 0000000000000000000000000000000000000000..4dba841aaa5e7c2298897daccda761db3e4c18aa --- /dev/null +++ b/arkoala-arkts/arkui/src/handwritten/ArkNavDestinationContext.ts @@ -0,0 +1,3 @@ +export class NavDestinationContext{ + +} \ No newline at end of file diff --git a/arkoala-arkts/arkui/src/handwritten/ArkNavDestinationInterfaces.ts b/arkoala-arkts/arkui/src/handwritten/ArkNavDestinationInterfaces.ts new file mode 100644 index 0000000000000000000000000000000000000000..460856662f08f1f5f0971f1d62aed34a88b67440 --- /dev/null +++ b/arkoala-arkts/arkui/src/handwritten/ArkNavDestinationInterfaces.ts @@ -0,0 +1,105 @@ +import { int32, int64, float32 } from "@koalaui/common" +import { KInt, KPointer, KBoolean, KStringPtr, wrapCallback } from "@koalaui/interop" +import { NodeAttach, remember } from "@koalaui/runtime" +import { Resource, PixelMap, SymbolGlyphModifier, ResourceStr, + CustomBuilder, TitleHeight, Length, Scroller, + CommonMethod, LayoutSafeAreaType, LayoutSafeAreaEdge } from "../generated" +import { NavigationMenuItem, SystemBarStyle, NavigationTitleOptions, ToolbarItem, NavigationToolbarOptions } from "./ArkNavigationInterfaces" +import { NavDestinationContext } from "./ArkNavDestinationContext" + +export interface NavDestinationCommonTitle { + main: string | Resource; + sub: string | Resource; +} +export interface NavDestinationCustomTitle { + builder: CustomBuilder; + height: TitleHeight | Length; +} +export class NavigationSystemTransitionType { + static readonly DEFAULT: NavigationSystemTransitionType = new NavigationSystemTransitionType(0,0) + static readonly NONE: NavigationSystemTransitionType = new NavigationSystemTransitionType(1,1) + static readonly TITLE: NavigationSystemTransitionType = new NavigationSystemTransitionType(2,2) + static readonly CONTENT: NavigationSystemTransitionType = new NavigationSystemTransitionType(3,3) + constructor(value: int32, ordinal: int32) { + this.value = value + this.ordinal = ordinal + } + public readonly value: int32 + public readonly ordinal: int32 + public static of(arg0: int32): NavigationSystemTransitionType { + if ((arg0) == (NavigationSystemTransitionType.DEFAULT.value)) + return NavigationSystemTransitionType.DEFAULT + if ((arg0) == (NavigationSystemTransitionType.NONE.value)) + return NavigationSystemTransitionType.NONE + if ((arg0) == (NavigationSystemTransitionType.TITLE.value)) + return NavigationSystemTransitionType.TITLE + if ((arg0) == (NavigationSystemTransitionType.CONTENT.value)) + return NavigationSystemTransitionType.CONTENT + throw new Error(`Enum member '${arg0}' not found`) + } + public static ofOrdinal(arg0: int32): NavigationSystemTransitionType { + if ((arg0) == (NavigationSystemTransitionType.DEFAULT.ordinal)) + return NavigationSystemTransitionType.DEFAULT + if ((arg0) == (NavigationSystemTransitionType.NONE.ordinal)) + return NavigationSystemTransitionType.NONE + if ((arg0) == (NavigationSystemTransitionType.TITLE.ordinal)) + return NavigationSystemTransitionType.TITLE + if ((arg0) == (NavigationSystemTransitionType.CONTENT.ordinal)) + return NavigationSystemTransitionType.CONTENT + throw new Error(`Enum member '${arg0}' not found`) + } +} +export class NavDestinationMode { + static readonly STANDARD: NavDestinationMode = new NavDestinationMode(0,0) + static readonly DIALOG: NavDestinationMode = new NavDestinationMode(1,1) + constructor(value: int32, ordinal: int32) { + this.value = value + this.ordinal = ordinal + } + public readonly value: int32 + public readonly ordinal: int32 + public static of(arg0: int32): NavDestinationMode { + if ((arg0) == (NavDestinationMode.STANDARD.value)) + return NavDestinationMode.STANDARD + if ((arg0) == (NavDestinationMode.DIALOG.value)) + return NavDestinationMode.DIALOG + throw new Error(`Enum member '${arg0}' not found`) + } + public static ofOrdinal(arg0: int32): NavDestinationMode { + if ((arg0) == (NavDestinationMode.STANDARD.ordinal)) + return NavDestinationMode.STANDARD + if ((arg0) == (NavDestinationMode.DIALOG.ordinal)) + return NavDestinationMode.DIALOG + throw new Error(`Enum member '${arg0}' not found`) + } +} +export type NavDestinationInterface = () => NavDestinationAttribute; +export interface RouteMapConfig { + name: string; + pageSourceFile: string; + data: Object; +} +export interface NestedScrollInfo { + parent: Scroller; + child: Scroller; +} +export interface NavDestinationAttribute extends CommonMethod { + hideTitleBar: boolean; + onShown: Function0; + onHidden: Function0; + onBackPressed: Function0; + mode: NavDestinationMode; + backButtonIcon: ResourceStr | PixelMap | SymbolGlyphModifier; + menus: Array | CustomBuilder; + onReady: Function1; + onWillAppear: Function0; + onWillDisappear: Function0; + onWillShow: Function0; + onWillHide: Function0; + systemBarStyle: SystemBarStyle | undefined; + recoverable: boolean | undefined; + systemTransition: NavigationSystemTransitionType; + bindToScrollable: Array; + bindToNestedScrollable: Array; + +} \ No newline at end of file diff --git a/arkoala-arkts/arkui/src/handwritten/ArkNavPathInfo.ts b/arkoala-arkts/arkui/src/handwritten/ArkNavPathInfo.ts new file mode 100644 index 0000000000000000000000000000000000000000..6e0d227209aa3fcaa795daf91f6e36549b541952 --- /dev/null +++ b/arkoala-arkts/arkui/src/handwritten/ArkNavPathInfo.ts @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { PopInfo } from "../generated/ArkNavigationInterfaces" + +/** + * Represents navigation path information. + */ +export class NavPathInfo { + name: string + param?: object + onPop?: (parameter: PopInfo) => void + isEntry: boolean + + /** + * Creates an instance of NavPathInfo. + * @param name - The name of the navigation path. + * @param param - Additional parameters associated with the path. + * @param onPop - Optional callback invoked when the path is popped. + * @param isEntry - Indicates if this path is an entry point. + */ + constructor(name: string, param?: object, onPop?: (parameter: PopInfo) => void, isEntry: boolean = false) { + this.name = name + this.param = param + this.onPop = onPop + this.isEntry = isEntry + } + + /** + * Handles the pop action for the navigation path. + * @param parameter - Information about the pop event. + */ + handlePop(parameter: PopInfo): void { + this.onPop?.(parameter) + } + + + /** + * Checks if the navigation path is an entry point. + * @returns True if it's an entry path, otherwise false. + */ + isEntryPoint(): boolean { + return this.isEntry + } +} diff --git a/arkoala-arkts/arkui/src/handwritten/ArkNavPathStack.ts b/arkoala-arkts/arkui/src/handwritten/ArkNavPathStack.ts new file mode 100644 index 0000000000000000000000000000000000000000..2761bf6a73fb8d916651151f605237e808a428b3 --- /dev/null +++ b/arkoala-arkts/arkui/src/handwritten/ArkNavPathStack.ts @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2024 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. + */ + +/** + * Interface representing the result of a navigation pop action. + */ +interface PopResult {} + +/** + * Interface representing the information of a navigation path. + */ +interface NavPathInfo { + name: string // The name of the navigation path + onPop: (info: PopInfo) => void // Callback function triggered when the path is popped +} + +/** + * Interface representing the information passed when a navigation path is popped. + */ +interface PopInfo { + info: NavPathInfo // The navigation path information + result: PopResult // The result of the pop action +} + +/** + * Interface for navigation interception handling. + */ +interface NavigationInterception {} + +/** + * Class representing a stack for managing navigation paths. + */ +export class NavPathStack { + private singleElement?: NavPathInfo // Single navigation path in the stack + private parentStack?: NavPathStack // Reference to the parent stack + private interception?: NavigationInterception // Navigation interception handler + private animationsDisabled: boolean = false // Flag to disable animations + + /** + * Constructor to initialize the NavPathStack. + * @param parentStack Optional parent stack. + */ + constructor(parentStack?: NavPathStack) { + this.parentStack = parentStack + } + + /** + * Adds a new navigation path to the stack. + * @param info The navigation path information to add. + */ + pushPath(info: NavPathInfo): void { + this.singleElement = info + } + + /** + * Adds a new navigation destination asynchronously. + * @param info The navigation path information to add. + * @returns A promise that resolves when the operation is complete. + */ + pushDestination(info: NavPathInfo): Promise { + this.pushPath(info) + return Promise.resolve() + } + + /** + * Replaces the current navigation path with a new one. + * @param info The navigation path information to replace with. + */ + replacePath(info: NavPathInfo): void { + this.singleElement = info + } + + /** + * Pops the top navigation path from the stack and triggers its onPop callback. + */ + popToIndex(): void { + const popped = this.singleElement + if (popped) { + const popInfo: PopInfo = { info: popped, result: {} } + popped.onPop?.(popInfo) + this.singleElement = undefined + } + } + + /** + * Clears the stack by removing the current navigation path and triggering its onPop callback. + */ + clear(): void { + const popped = this.singleElement + if (popped) { + const popInfo: PopInfo = { info: popped, result: {} } + popped.onPop?.(popInfo) + this.singleElement = undefined + } + } + + /** + * Retrieves all path names in the stack. + * @returns An array of path names. + */ + getAllPathName(): string[] { + const element = this.singleElement + if (element != undefined && element.name != undefined) { + return [element.name] + } + return [] + } + + /** + * Retrieves the size of the stack. + * @returns The number of elements in the stack. + */ + size(): number { + return this.singleElement ? 1 : 0 + } + + /** + * Enables or disables animations for navigation actions. + * @param value A boolean indicating whether to disable animations. + */ + disableAnimation(value: boolean): void { + this.animationsDisabled = value + } + + /** + * Sets a navigation interception handler. + * @param interception The interception handler to set. + */ + setInterception(interception: NavigationInterception): void { + this.interception = interception + } + + /** + * Retrieves the parent stack of the current stack. + * @returns The parent stack, or undefined if there is none. + */ + getParent(): NavPathStack | undefined { + return this.parentStack + } +} diff --git a/arkoala-arkts/arkui/src/handwritten/ArkNavigationInterfaces.ts b/arkoala-arkts/arkui/src/handwritten/ArkNavigationInterfaces.ts new file mode 100644 index 0000000000000000000000000000000000000000..627b7467e7ff1ae526ce5bae2cc79d98cc816014 --- /dev/null +++ b/arkoala-arkts/arkui/src/handwritten/ArkNavigationInterfaces.ts @@ -0,0 +1,333 @@ +import { int32, int64, float32 } from "@koalaui/common" +import { KInt, KPointer, KBoolean, KStringPtr, wrapCallback } from "@koalaui/interop" +import { NodeAttach, remember } from "@koalaui/runtime" +import { Resource } from "../generated/ArkResourceInterfaces" +import { CustomBuilder, SymbolGlyphModifier, BlurStyle, CommonMethod, LayoutSafeAreaType, LayoutSafeAreaEdge } from "../generated/ArkCommonInterfaces" +import { TitleHeight } from "../generated/ArkEnumsInterfaces" +import { Length, ResourceStr, ResourceColor, Dimension } from "../generated/ArkUnitsInterfaces" +import { Callback_Void, Callback_PopInfo_Void, Tuple_Dimension_Dimension, Callback_NavigationTitleMode_Void, Callback_Boolean_Void, Callback_NavigationMode_Void, Callback_String_Unknown_Void, Type_NavigationAttribute_customNavContentTransition_delegate, Callback_NavigationTransitionProxy_Void } from "../generated" +// import { NavPathStack } from "./ArkNavPathStackMaterialized" +import { LengthMetrics, TextModifier } from "../generated/ArkArkui-externalInterfaces" +import { PixelMap } from "../generated/ArkPixelMapMaterialized" +import { NavDestinationMode } from "../generated" //./ArkNavDestinationInterfaces" +import { NavDestinationContext } from "./ArkNavDestinationContext" +import { NavigationTransitionProxy } from "../generated" //./ArkNavigationTransitionProxyMaterialized" + +export interface SystemBarStyle { + __SystemBarStyleStub: string; +} +export interface NavigationCommonTitle { + main: string | Resource; + sub: string | Resource; +} +export interface NavigationCustomTitle { + builder: CustomBuilder; + height: TitleHeight | Length; +} +export class NavigationMode { + static readonly STACK: NavigationMode = new NavigationMode(0,0) + static readonly Stack: NavigationMode = NavigationMode.STACK + static readonly SPLIT: NavigationMode = new NavigationMode(1,1) + static readonly Split: NavigationMode = NavigationMode.SPLIT + static readonly AUTO: NavigationMode = new NavigationMode(2,2) + static readonly Auto: NavigationMode = NavigationMode.AUTO + constructor(value: int32, ordinal: int32) { + this.value = value + this.ordinal = ordinal + } + public readonly value: int32 + public readonly ordinal: int32 + public static of(arg0: int32): NavigationMode { + if ((arg0) == (NavigationMode.STACK.value)) + return NavigationMode.STACK + if ((arg0) == (NavigationMode.SPLIT.value)) + return NavigationMode.SPLIT + if ((arg0) == (NavigationMode.AUTO.value)) + return NavigationMode.AUTO + throw new Error(`Enum member '${arg0}' not found`) + } + public static ofOrdinal(arg0: int32): NavigationMode { + if ((arg0) == (NavigationMode.STACK.ordinal)) + return NavigationMode.STACK + if ((arg0) == (NavigationMode.SPLIT.ordinal)) + return NavigationMode.SPLIT + if ((arg0) == (NavigationMode.AUTO.ordinal)) + return NavigationMode.AUTO + throw new Error(`Enum member '${arg0}' not found`) + } +} +export class NavBarPosition { + static readonly START: NavBarPosition = new NavBarPosition(0,0) + static readonly Start: NavBarPosition = NavBarPosition.START + static readonly END: NavBarPosition = new NavBarPosition(1,1) + static readonly End: NavBarPosition = NavBarPosition.END + constructor(value: int32, ordinal: int32) { + this.value = value + this.ordinal = ordinal + } + public readonly value: int32 + public readonly ordinal: int32 + public static of(arg0: int32): NavBarPosition { + if ((arg0) == (NavBarPosition.START.value)) + return NavBarPosition.START + if ((arg0) == (NavBarPosition.END.value)) + return NavBarPosition.END + throw new Error(`Enum member '${arg0}' not found`) + } + public static ofOrdinal(arg0: int32): NavBarPosition { + if ((arg0) == (NavBarPosition.START.ordinal)) + return NavBarPosition.START + if ((arg0) == (NavBarPosition.END.ordinal)) + return NavBarPosition.END + throw new Error(`Enum member '${arg0}' not found`) + } +} +export class NavigationTitleMode { + static readonly FREE: NavigationTitleMode = new NavigationTitleMode(0,0) + static readonly Free: NavigationTitleMode = NavigationTitleMode.FREE + static readonly FULL: NavigationTitleMode = new NavigationTitleMode(1,1) + static readonly Full: NavigationTitleMode = NavigationTitleMode.FULL + static readonly MINI: NavigationTitleMode = new NavigationTitleMode(2,2) + static readonly Mini: NavigationTitleMode = NavigationTitleMode.MINI + constructor(value: int32, ordinal: int32) { + this.value = value + this.ordinal = ordinal + } + public readonly value: int32 + public readonly ordinal: int32 + public static of(arg0: int32): NavigationTitleMode { + if ((arg0) == (NavigationTitleMode.FREE.value)) + return NavigationTitleMode.FREE + if ((arg0) == (NavigationTitleMode.FULL.value)) + return NavigationTitleMode.FULL + if ((arg0) == (NavigationTitleMode.MINI.value)) + return NavigationTitleMode.MINI + throw new Error(`Enum member '${arg0}' not found`) + } + public static ofOrdinal(arg0: int32): NavigationTitleMode { + if ((arg0) == (NavigationTitleMode.FREE.ordinal)) + return NavigationTitleMode.FREE + if ((arg0) == (NavigationTitleMode.FULL.ordinal)) + return NavigationTitleMode.FULL + if ((arg0) == (NavigationTitleMode.MINI.ordinal)) + return NavigationTitleMode.MINI + throw new Error(`Enum member '${arg0}' not found`) + } +} +export interface NavigationMenuItem { + value: string | Resource; + icon?: string | Resource; + symbolIcon?: SymbolGlyphModifier; + isEnabled?: boolean; + action?: Function0; +} +export interface PopInfo { + info: NavPathInfo; + result: Object; +} +export interface NavPathInfo { + name: string; + param?: object; + onPop?: Function1; + isEntry?: boolean; +} +export class LaunchMode { + static readonly STANDARD: LaunchMode = new LaunchMode(0,0) + static readonly MOVE_TO_TOP_SINGLETON: LaunchMode = new LaunchMode(1,1) + static readonly POP_TO_SINGLETON: LaunchMode = new LaunchMode(2,2) + static readonly NEW_INSTANCE: LaunchMode = new LaunchMode(3,3) + constructor(value: int32, ordinal: int32) { + this.value = value + this.ordinal = ordinal + } + public readonly value: int32 + public readonly ordinal: int32 + public static of(arg0: int32): LaunchMode { + if ((arg0) == (LaunchMode.STANDARD.value)) + return LaunchMode.STANDARD + if ((arg0) == (LaunchMode.MOVE_TO_TOP_SINGLETON.value)) + return LaunchMode.MOVE_TO_TOP_SINGLETON + if ((arg0) == (LaunchMode.POP_TO_SINGLETON.value)) + return LaunchMode.POP_TO_SINGLETON + if ((arg0) == (LaunchMode.NEW_INSTANCE.value)) + return LaunchMode.NEW_INSTANCE + throw new Error(`Enum member '${arg0}' not found`) + } + public static ofOrdinal(arg0: int32): LaunchMode { + if ((arg0) == (LaunchMode.STANDARD.ordinal)) + return LaunchMode.STANDARD + if ((arg0) == (LaunchMode.MOVE_TO_TOP_SINGLETON.ordinal)) + return LaunchMode.MOVE_TO_TOP_SINGLETON + if ((arg0) == (LaunchMode.POP_TO_SINGLETON.ordinal)) + return LaunchMode.POP_TO_SINGLETON + if ((arg0) == (LaunchMode.NEW_INSTANCE.ordinal)) + return LaunchMode.NEW_INSTANCE + throw new Error(`Enum member '${arg0}' not found`) + } +} +export interface NavigationOptions { + launchMode?: LaunchMode; + animated?: boolean; +} +export type NavBar = string; +export type InterceptionShowCallback = (from: NavDestinationContext | NavBar, to: NavDestinationContext | NavBar, operation: NavigationOperation, isAnimated: boolean) => void; +export type InterceptionModeCallback = (mode: NavigationMode) => void; +export interface NavigationInterception { + willShow?: InterceptionShowCallback; + didShow?: InterceptionShowCallback; + modeChange?: InterceptionModeCallback; +} +export interface NavigationInterface { + invoke(): NavigationAttribute; + +} +export class ToolbarItemStatus { + static readonly NORMAL: ToolbarItemStatus = new ToolbarItemStatus(0,0) + static readonly DISABLED: ToolbarItemStatus = new ToolbarItemStatus(1,1) + static readonly ACTIVE: ToolbarItemStatus = new ToolbarItemStatus(2,2) + constructor(value: int32, ordinal: int32) { + this.value = value + this.ordinal = ordinal + } + public readonly value: int32 + public readonly ordinal: int32 + public static of(arg0: int32): ToolbarItemStatus { + if ((arg0) == (ToolbarItemStatus.NORMAL.value)) + return ToolbarItemStatus.NORMAL + if ((arg0) == (ToolbarItemStatus.DISABLED.value)) + return ToolbarItemStatus.DISABLED + if ((arg0) == (ToolbarItemStatus.ACTIVE.value)) + return ToolbarItemStatus.ACTIVE + throw new Error(`Enum member '${arg0}' not found`) + } + public static ofOrdinal(arg0: int32): ToolbarItemStatus { + if ((arg0) == (ToolbarItemStatus.NORMAL.ordinal)) + return ToolbarItemStatus.NORMAL + if ((arg0) == (ToolbarItemStatus.DISABLED.ordinal)) + return ToolbarItemStatus.DISABLED + if ((arg0) == (ToolbarItemStatus.ACTIVE.ordinal)) + return ToolbarItemStatus.ACTIVE + throw new Error(`Enum member '${arg0}' not found`) + } +} +export class NavigationOperation { + static readonly PUSH: NavigationOperation = new NavigationOperation(1,0) + static readonly POP: NavigationOperation = new NavigationOperation(2,1) + static readonly REPLACE: NavigationOperation = new NavigationOperation(3,2) + constructor(value: int32, ordinal: int32) { + this.value = value + this.ordinal = ordinal + } + public readonly value: int32 + public readonly ordinal: int32 + public static of(arg0: int32): NavigationOperation { + if ((arg0) == (NavigationOperation.PUSH.value)) + return NavigationOperation.PUSH + if ((arg0) == (NavigationOperation.POP.value)) + return NavigationOperation.POP + if ((arg0) == (NavigationOperation.REPLACE.value)) + return NavigationOperation.REPLACE + throw new Error(`Enum member '${arg0}' not found`) + } + public static ofOrdinal(arg0: int32): NavigationOperation { + if ((arg0) == (NavigationOperation.PUSH.ordinal)) + return NavigationOperation.PUSH + if ((arg0) == (NavigationOperation.POP.ordinal)) + return NavigationOperation.POP + if ((arg0) == (NavigationOperation.REPLACE.ordinal)) + return NavigationOperation.REPLACE + throw new Error(`Enum member '${arg0}' not found`) + } +} +export interface ToolbarItem { + value: ResourceStr; + icon?: ResourceStr; + symbolIcon?: SymbolGlyphModifier; + action?: Function0; + status?: ToolbarItemStatus; + activeIcon?: ResourceStr; + activeSymbolIcon?: SymbolGlyphModifier; +} +export interface NavigationTitleOptions { + backgroundColor?: ResourceColor; + backgroundBlurStyle?: BlurStyle; + barStyle?: BarStyle; + paddingStart?: LengthMetrics; + paddingEnd?: LengthMetrics; + mainTitleModifier?: TextModifier; + subTitleModifier?: TextModifier; + enableHoverMode?: boolean +} +export class BarStyle { + static readonly STANDARD: BarStyle = new BarStyle(0,0) + static readonly STACK: BarStyle = new BarStyle(1,1) + static readonly SAFE_AREA_PADDING: BarStyle = new BarStyle(2,2) + constructor(value: int32, ordinal: int32) { + this.value = value + this.ordinal = ordinal + } + public readonly value: int32 + public readonly ordinal: int32 + public static of(arg0: int32): BarStyle { + if ((arg0) == (BarStyle.STANDARD.value)) + return BarStyle.STANDARD + if ((arg0) == (BarStyle.STACK.value)) + return BarStyle.STACK + if ((arg0) == (BarStyle.SAFE_AREA_PADDING.value)) + return BarStyle.SAFE_AREA_PADDING + throw new Error(`Enum member '${arg0}' not found`) + } + public static ofOrdinal(arg0: int32): BarStyle { + if ((arg0) == (BarStyle.STANDARD.ordinal)) + return BarStyle.STANDARD + if ((arg0) == (BarStyle.STACK.ordinal)) + return BarStyle.STACK + if ((arg0) == (BarStyle.SAFE_AREA_PADDING.ordinal)) + return BarStyle.SAFE_AREA_PADDING + throw new Error(`Enum member '${arg0}' not found`) + } +} +export interface NavigationToolbarOptions { + backgroundColor?: ResourceColor; + backgroundBlurStyle?: BlurStyle; + barStyle?: BarStyle; +} +export interface NavigationAttribute extends CommonMethod { + navBarWidth: Length; + navBarPosition: NavBarPosition; + navBarWidthRange: [ Dimension, Dimension ]; + minContentWidth: Dimension; + mode: NavigationMode; + backButtonIcon: string | PixelMap | Resource | SymbolGlyphModifier; + hideNavBar: boolean; + subTitle: string; + hideTitleBar: boolean; + hideBackButton: boolean; + titleMode: NavigationTitleMode; + menus: Array | CustomBuilder; + toolBar: Object | CustomBuilder; + hideToolBar: boolean; + onTitleModeChange: Function1; + onNavBarStateChange: Function1; + onNavigationModeChange: Function1; + navDestination: Function2; + customNavContentTransition: Function3; + systemBarStyle: SystemBarStyle | undefined; + recoverable: boolean | undefined; + enableDragBar: boolean | undefined; + + +} +export interface NavigationAnimatedTransition { + onTransitionEnd?: Function1; + timeout?: number; + isInteractive?: boolean; + transition: Function1; +} +export interface NavContentInfo { + name?: string; + index: number; + mode?: NavDestinationMode; + param?: Object; + navDestinationId?: string; +} \ No newline at end of file diff --git a/arkoala-arkts/arkui/src/handwritten/index.ts b/arkoala-arkts/arkui/src/handwritten/index.ts index 86abb2a63ecfbc58de7c1139d692b7629ced8a70..15fd85f372381e1fd9a69afc4cc6ebb0bdfaa934 100644 --- a/arkoala-arkts/arkui/src/handwritten/index.ts +++ b/arkoala-arkts/arkui/src/handwritten/index.ts @@ -1,3 +1,6 @@ export * from "./ArkPageTransition" export * from "./ArkPageTransitionData" export * from "./Router" +export * from "./ArkNavDestination" +// export * from "./ArkNavPathInfo" +// export * from "./ArkNavPathStack" diff --git a/arkoala-arkts/arkui/src/generated/peers/ArkNavDestinationPeer.ts b/arkoala-arkts/arkui/src/handwritten/peers/ArkNavDestinationPeer.ts similarity index 88% rename from arkoala-arkts/arkui/src/generated/peers/ArkNavDestinationPeer.ts rename to arkoala-arkts/arkui/src/handwritten/peers/ArkNavDestinationPeer.ts index 9f6bc280dd14cd41d6319340d1ba24416f5a7dcd..9e1a84f6b77e11da4f5273a643a8729483779aa7 100644 --- a/arkoala-arkts/arkui/src/generated/peers/ArkNavDestinationPeer.ts +++ b/arkoala-arkts/arkui/src/handwritten/peers/ArkNavDestinationPeer.ts @@ -13,38 +13,22 @@ * limitations under the License. */ +import { int32 } from "@koalaui/common"; +import { KPointer } from "@koalaui/interop" +import { ArkCommonMethodAttributes, ArkCommonMethodPeer } from "../../generated/peers/ArkCommonPeer" +import { ComponentBase, } from "../../generated/ComponentBase" +import { PeerNode } from "../../generated/PeerNode" +import { NativeModule, TypeChecker } from "#components" +import { Serializer } from "../../generated/peers/Serializer" +import { CustomBuilder, LayoutSafeAreaEdge, LayoutSafeAreaType } from "../../generated" +import { NavDestinationCommonTitle, NavDestinationCustomTitle, NavDestinationMode, NavigationSystemTransitionType, NestedScrollInfo} from "../ArkNavDestinationInterfaces" +import { Resource, ResourceStr, Scroller, SymbolGlyphModifier } from "../../generated" +import { NavigationMenuItem, NavigationTitleOptions, NavigationToolbarOptions, SystemBarStyle, ToolbarItem } from "../ArkNavigationInterfaces" +import { PixelMap } from "../../generated/ArkPixelMapMaterialized" +import { isResource, runtimeType, RuntimeType } from "../../generated/peers/SerializerBase" +import { CallbackTransformer } from "../../generated/peers/CallbackTransformer" +import { NavDestinationContext } from "../ArkNavDestinationContext" -// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! - -import { int32 } from "@koalaui/common" -import { nullptr, KPointer, KInt, KBoolean, KStringPtr } from "@koalaui/interop" -import { isResource, isInstanceOf, runtimeType, RuntimeType } from "./SerializerBase" -import { Serializer } from "./Serializer" -import { ArkUINodeType } from "./ArkUINodeType" -import { ComponentBase } from "../ComponentBase" -import { PeerNode } from "../PeerNode" -import { NativeModule } from "#components" -import { ArkCommonMethodPeer, ArkCommonMethodAttributes } from "./ArkCommonPeer" -import { CommonMethod, SymbolGlyphModifier, CustomBuilder, LayoutSafeAreaType, LayoutSafeAreaEdge } from "./../ArkCommonInterfaces" -import { NavDestinationAttribute, NavDestinationMode, NavigationSystemTransitionType, NestedScrollInfo, NavDestinationCommonTitle, NavDestinationCustomTitle } from "./../ArkNavDestinationInterfaces" -import { Callback_Void, Callback_Boolean, Callback_NavDestinationContext_Void } from "./../SyntheticDeclarations" -import { ResourceStr } from "./../ArkUnitsInterfaces" -import { PixelMap } from "./../ArkPixelMapMaterialized" -import { NavigationMenuItem, SystemBarStyle, NavigationTitleOptions, ToolbarItem, NavigationToolbarOptions } from "./../ArkNavigationInterfaces" -import { NavDestinationContext } from "./../ArkNavDestinationContextMaterialized" -import { Scroller } from "./../ArkScrollerMaterialized" -import { Resource } from "./../ArkResourceInterfaces" -import { GestureName, GestureComponent } from "./../shared/generated-utils" -import { CallbackKind } from "./CallbackKind" -import { CallbackTransformer } from "./CallbackTransformer" -import { TypeChecker } from "#components" -import { registerCallback } from "./SerializerBase" -import { wrapCallback } from "@koalaui/interop" -import { MaterializedBase } from "./../MaterializedBase" -import { DotIndicator } from "./../ArkDotIndicatorBuilder" -import { DigitIndicator } from "./../ArkDigitIndicatorBuilder" -import { SubTabBarStyle } from "./../ArkSubTabBarStyleBuilder" -import { BottomTabBarStyle } from "./../ArkBottomTabBarStyleBuilder" export class ArkNavDestinationPeer extends ArkCommonMethodPeer { protected constructor(peerPtr: KPointer, id: int32, name: string = "", flags: int32 = 0) { super(peerPtr, id, name, flags)