/* * 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 { LocalStorage } from '@ohos.arkui.stateManagement' import { StateContext } from '../runtime-api/@koalaui.runtime.states.State' // From incremental engine @Retention({policy: "SOURCE"}) export declare @interface memo {}; @Retention({policy: "SOURCE"}) export @interface ComponentBuilder {} export type __memo_context_type = StateContext; export type __memo_id_type = MemoCallSiteKey; export type MemoCallSiteKey = int; export interface Disposable { readonly disposed: boolean; dispose(): void; } interface State { readonly modified: boolean; readonly value: T; } export interface MutableState extends Disposable, State { value: T; } export type Equivalent = (oldV: T, newV: T) => boolean; export interface InternalScope { readonly unchanged: boolean; readonly cached: Value; recache(newValue?: Value): Value; param(index: int, value: T, equivalent?: Equivalent, name?: string, contextLocal?: boolean): State; } // export interface StateContext { // scope(id: MemoCallSiteKey, paramCount?: int): InternalScope; // } // From Arkoala export declare function propState(value?: T): SyncedProperty; export declare function objectLinkState(value?: T): SyncedProperty; export declare function stateOf(value: T): MutableState; export declare function contextLocalStateOf(value: string, key: () => T): MutableState; export declare function contextLocal(value: string): MutableState; export declare function observableProxy(value: T): T; export declare function StorageLinkState(storage: LocalStorage, name: string, value: T): MutableState export declare function AppStorageLinkState(name: string, value: T): MutableState; export declare class SyncedProperty implements MutableState { constructor(value: T | undefined, deepCopyOnUpdate: boolean); dispose(): void; get disposed(): boolean; get modified(): boolean; get value(): T; set value(value: T); update(value?: T): void; }