From 3a7a090d02ae639f07d1ffedc8f8c9c60b24fb40 Mon Sep 17 00:00:00 2001 From: Alexander Gorshenev Date: Fri, 28 Feb 2025 22:36:13 +0800 Subject: [PATCH] Dropped unneeded things from incremental runtime imitation Signed-off-by: Alexander Gorshenev --- .../runtime-api/animation/AnimatedState.sts | 37 ------------ .../runtime-api/animation/AnimationRange.sts | 19 ------ .../runtime-api/animation/Easing.sts | 45 -------------- .../runtime-api/animation/EasingSupport.sts | 23 ------- .../runtime-api/animation/GlobalTimer.sts | 20 ------- .../runtime-api/animation/TimeAnimation.sts | 60 ------------------- .../runtime-api/animation/memo.sts | 28 --------- .../memo-plugin/runtime-api/index.sts | 52 ---------------- .../runtime-api/states/Dependency.sts | 27 --------- .../runtime-api/states/Journal.sts | 34 ----------- .../runtime-api/tree/TreeUpdater.sts | 30 ---------- 11 files changed, 375 deletions(-) delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/animation/AnimatedState.sts delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/animation/AnimationRange.sts delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/animation/Easing.sts delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/animation/EasingSupport.sts delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/animation/GlobalTimer.sts delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/animation/TimeAnimation.sts delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/animation/memo.sts delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/states/Dependency.sts delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/states/Journal.sts delete mode 100644 arkoala-arkts/memo-plugin/runtime-api/tree/TreeUpdater.sts diff --git a/arkoala-arkts/memo-plugin/runtime-api/animation/AnimatedState.sts b/arkoala-arkts/memo-plugin/runtime-api/animation/AnimatedState.sts deleted file mode 100644 index 470d228f34..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/animation/AnimatedState.sts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { int64 } from "../common" -import { TimeAnimation } from "./TimeAnimation" -import { MutableState, State } from "../states/State" -export declare interface AnimatedState extends State { - animation: TimeAnimation - readonly running: boolean - paused: boolean -} -export declare function animatedState(animation: TimeAnimation, startNow: boolean = false, timeProvider?: () => int64): AnimatedState -export declare interface MutableAnimatedState extends MutableState { - animation: TimeAnimation - readonly running: boolean -} -export declare function mutableAnimatedState(initial: Value, animationProvider: ImplicitAnimationProvider): MutableAnimatedState -export type ImplicitAnimationProvider = (from: Value, to: Value) => TimeAnimation -export declare interface StateAnimator { - parameter: Parameter - readonly value: Value - onValueChange(action: (newValue: Value) => void): void -} -export declare function stateAnimator(parameter: P, animationProvider: ParametrizedAnimationProvider): StateAnimator -export type ParametrizedAnimationProvider = (parameter: P, value: V | undefined) => TimeAnimation diff --git a/arkoala-arkts/memo-plugin/runtime-api/animation/AnimationRange.sts b/arkoala-arkts/memo-plugin/runtime-api/animation/AnimationRange.sts deleted file mode 100644 index 236cd721e1..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/animation/AnimationRange.sts +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { float64 } from "../common" -export type AnimationRange = (value: float64) => Value -export declare function ArrayAnimationRange(from: ReadonlyArray, to: ReadonlyArray, compute: (array: ReadonlyArray) => Value): AnimationRange -export declare function NumberAnimationRange(from: float64, to: float64): AnimationRange diff --git a/arkoala-arkts/memo-plugin/runtime-api/animation/Easing.sts b/arkoala-arkts/memo-plugin/runtime-api/animation/Easing.sts deleted file mode 100644 index bc0a01b259..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/animation/Easing.sts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { float64, uint32 } from "../common" -export type EasingCurve = (value: float64) => float64 -export declare class Easing { - static readonly Linear: EasingCurve - static readonly LinearReversed: EasingCurve - static readonly EaseInSine: EasingCurve - static readonly EaseOutSine: EasingCurve - static readonly EaseInOutSine: EasingCurve - static readonly Ease: EasingCurve - static readonly EaseIn: EasingCurve - static readonly EaseOut: EasingCurve - static readonly EaseInOut: EasingCurve - static readonly ViscousFluid: EasingCurve - static readonly Bubble: EasingCurve - static inverted(easing: EasingCurve): EasingCurve - static reversed(easing: EasingCurve): EasingCurve - static restarted(easing: EasingCurve): EasingCurve - static repeated(easing: EasingCurve, count: uint32): EasingCurve - static joined(...easing: EasingCurve[]): EasingCurve - static thereAndBackAgain(easing: EasingCurve): EasingCurve - static cubicBezier(p1x: float64, p1y: float64, p2x: float64, p2y: float64): EasingCurve - static steps(stops: uint32, jump: EasingStepJump = EasingStepJump.None): EasingCurve - static viscousFluid(v0: float64 = 1, f: float64 = 3): EasingCurve -} -export enum EasingStepJump { - Start, - End, - None, - Both, -} diff --git a/arkoala-arkts/memo-plugin/runtime-api/animation/EasingSupport.sts b/arkoala-arkts/memo-plugin/runtime-api/animation/EasingSupport.sts deleted file mode 100644 index b67f72891a..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/animation/EasingSupport.sts +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { float64, uint32 } from "../common" -export declare class EasingSupport { - private x: Float64Array - private y: Float64Array - private constructor(size: uint32, xSupplier: (value: float64) => float64, ySupplier: (value: float64) => float64) - convert(value: float64): float64 - static newCubicBezier(p1x: float64, p1y: float64, p2x: float64, p2y: float64, size: uint32 = 1024): EasingSupport -} diff --git a/arkoala-arkts/memo-plugin/runtime-api/animation/GlobalTimer.sts b/arkoala-arkts/memo-plugin/runtime-api/animation/GlobalTimer.sts deleted file mode 100644 index 446dd5c9a7..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/animation/GlobalTimer.sts +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { int64 } from "../common" -import { GlobalStateManager } from "../states/GlobalStateManager" -import { MutableState, StateContext } from "../states/State" -export declare function getAnimationTimer(context: StateContext = GlobalStateManager.instance): MutableState | undefined -export declare function createAnimationTimer(context: StateContext, initial: int64 = 0): MutableState diff --git a/arkoala-arkts/memo-plugin/runtime-api/animation/TimeAnimation.sts b/arkoala-arkts/memo-plugin/runtime-api/animation/TimeAnimation.sts deleted file mode 100644 index f82ee81749..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/animation/TimeAnimation.sts +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { float64, int32, int64, uint32 } from "../common" -import { AnimationRange } from "./AnimationRange" -import { EasingCurve } from "./Easing" -export declare const DEFAULT_ANIMATION_DURATION: uint32 -export declare interface TimeAnimation { - readonly running: boolean - getValue(time: int64): Value - onStart(time: int64): void - onPause(time: int64): void -} -export declare interface AnimationSpec { - readonly duration: uint32 - readonly delay: uint32 - readonly easing: EasingCurve - readonly onEdge: OnEdge - readonly onPause: OnPause - readonly iterations: int32 | undefined - readonly onStart: (() => void) | undefined - readonly onEnd: (() => void) | undefined - readonly onReset: (() => void) | undefined -} -export declare class OnEdge { - static Nothing: OnEdge - static Reverse: OnEdge - static Restart: OnEdge - private constructor(name: string) -} -export declare class OnPause { - static Nothing: OnPause - static Reset: OnPause - static Fade: OnPause - private constructor(name: string) -} -export declare function constAnimation(value: Value): TimeAnimation -export declare function timeAnimation(compute: (time: int64) => Value, initialTime: int64 = 0): TimeAnimation -export declare function smoothAnimation(period: uint32, from: float64 = 0.0, to: float64 = 1.0): TimeAnimation -export declare function blinkAnimation(period: uint32, initialValue: boolean = false): TimeAnimation -export declare function countAnimation(period: uint32, initialCount: int64 = 0): TimeAnimation -export declare function periodicAnimation(period: uint32, compute: (count: int64) => Value, initialCount: int64 = 0): TimeAnimation -export declare function periodicAnimationWithDelay(delay: uint32, period: uint32, compute: (count: int64) => Value, initialCount: int64 = 0): TimeAnimation -export declare function frameAnimation(frameTime: ReadonlyArray, compute: (index: int64) => Value): TimeAnimation -export declare function numberAnimation(spec: Partial, to: float64 = 1.0, from: float64 = 0.0): TimeAnimation -export declare function animation(spec: Partial, compute: AnimationRange, initialState: float64 = 0): TimeAnimation -export declare function transition(duration: uint32, easing: EasingCurve, compute: AnimationRange, initialState: int64 = 0): TimeAnimation -export declare function linearTransition(duration: uint32, compute: AnimationRange, initialState: int64 = 0): TimeAnimation \ No newline at end of file diff --git a/arkoala-arkts/memo-plugin/runtime-api/animation/memo.sts b/arkoala-arkts/memo-plugin/runtime-api/animation/memo.sts deleted file mode 100644 index 1ed38006d8..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/animation/memo.sts +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { memo } from "../annotations" -import { float64, int64, uint32 } from "../common" -import { AnimatedState, ImplicitAnimationProvider, MutableAnimatedState, ParametrizedAnimationProvider, StateAnimator, animatedState, mutableAnimatedState, stateAnimator } from "./AnimatedState" -import { AnimationRange } from "./AnimationRange" -import { Easing, EasingCurve } from "./Easing" -import { AnimationSpec, TimeAnimation } from "./TimeAnimation" -@memo export declare function sampledValue(sampleRate: uint32, generator: (tick: int64) => V): V -@memo export declare function rememberAnimatedState(animation: () => TimeAnimation, startNow: boolean = false): AnimatedState -@memo export declare function rememberNumberTransition(on: boolean, duration: uint32, easing: EasingCurve = Easing.Linear, to: float64 = 1.0, from: float64 = 0.0): AnimatedState -@memo export declare function rememberTransition(on: boolean, duration: uint32, easing: EasingCurve, compute: AnimationRange, initial: boolean = on): AnimatedState -@memo export declare function rememberMutableAnimatedState(initial: Value, animationProvider: ImplicitAnimationProvider): MutableAnimatedState -@memo export declare function rememberMutableAnimatedStateNumber(initial: float64, animationSpec: Partial): MutableAnimatedState -@memo export declare function rememberAnimator(parameter: P, animationProvider: ParametrizedAnimationProvider): StateAnimator \ No newline at end of file diff --git a/arkoala-arkts/memo-plugin/runtime-api/index.sts b/arkoala-arkts/memo-plugin/runtime-api/index.sts index a057aae348..6047618750 100644 --- a/arkoala-arkts/memo-plugin/runtime-api/index.sts +++ b/arkoala-arkts/memo-plugin/runtime-api/index.sts @@ -13,58 +13,6 @@ * limitations under the License. */ -export { - AnimatedState, - ImplicitAnimationProvider, - MutableAnimatedState, - ParametrizedAnimationProvider, - StateAnimator, - animatedState, - mutableAnimatedState, - stateAnimator, -} from "./animation/AnimatedState" -export { - AnimationRange, - ArrayAnimationRange, - NumberAnimationRange, -} from "./animation/AnimationRange" -export { - Easing, - EasingCurve, - EasingStepJump, -} from "./animation/Easing" -export { - createAnimationTimer, - getAnimationTimer, -} from "./animation/GlobalTimer" -export { - rememberAnimatedState, - rememberAnimator, - rememberMutableAnimatedState, - rememberMutableAnimatedStateNumber, - rememberNumberTransition, - rememberTransition, - sampledValue, -} from "./animation/memo" -export { - AnimationSpec, - OnEdge, - OnPause, - TimeAnimation, - animation, - blinkAnimation, - constAnimation, - countAnimation, - frameAnimation, - linearTransition, - numberAnimation, - periodicAnimation, - periodicAnimationWithDelay, - smoothAnimation, - timeAnimation, - transition, -} from "./animation/TimeAnimation" - export { memoBind, memoBind2, diff --git a/arkoala-arkts/memo-plugin/runtime-api/states/Dependency.sts b/arkoala-arkts/memo-plugin/runtime-api/states/Dependency.sts deleted file mode 100644 index 88b8b10f96..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/states/Dependency.sts +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2022-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. - */ - -export declare interface Dependency { - readonly obsolete: boolean - invalidate(): void -} -export declare class Dependencies { - private frame: int - private dependencies: Set | undefined - private latest: Dependency | undefined - get empty(): boolean - register(dependency?: Dependency): void - updateDependencies(invalidate: boolean): void -} diff --git a/arkoala-arkts/memo-plugin/runtime-api/states/Journal.sts b/arkoala-arkts/memo-plugin/runtime-api/states/Journal.sts deleted file mode 100644 index cab0f9d853..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/states/Journal.sts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AtomicRef } from "../common" -export interface Changes { - getChange(state: Object): AtomicRef | undefined - clear(): void -} -export declare class Journal implements Changes { - private readonly current: AtomicRef - setMarker(): void - addChange(state: Object, value: Value): void - getChanges(): Changes | undefined - getChange(state: Object): AtomicRef | undefined - clear(): void - getCachedArray(state: Object, array: Array): Array -} -declare class Chunk { - readonly previous: AtomicRef - readonly map: Map - get(state: Object): AtomicRef | undefined -} diff --git a/arkoala-arkts/memo-plugin/runtime-api/tree/TreeUpdater.sts b/arkoala-arkts/memo-plugin/runtime-api/tree/TreeUpdater.sts deleted file mode 100644 index 173a8ac4b9..0000000000 --- a/arkoala-arkts/memo-plugin/runtime-api/tree/TreeUpdater.sts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2022-2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { int32, uint32 } from "../common" -import { TreePath } from "./TreePath" -export declare class TreeUpdater { - private current: TreePath - readonly reverse: boolean - constructor(root: Node, reverse: boolean = false) - get path(): TreePath - get node(): Node - down(node: Node): void - up(): void - clear(): void - insert(index: int32, node: Node): void - remove(index: int32, amount: uint32): void - move(indexFrom: int32, indexTo: int32, amount: uint32): void -} -- Gitee