mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
chore: remove critical circular dependencies (#8114)
* chore: remove critical circular dependencies * chore: fix tslint errors * chore: remove platform specific types from interfaces * chore: update unit tests polyfills * fix: incorrect null check * chore: update api.md file * test: improve test case * chore: apply comments * test: avoid page style leaks in tests
This commit is contained in:
committed by
Alexander Vakrilov
parent
5b647bd809
commit
0ffc790d82
@@ -1,19 +1,23 @@
|
||||
// Definitions.
|
||||
// Types.
|
||||
import {
|
||||
CubicBezierAnimationCurve as CubicBezierAnimationCurveDefinition,
|
||||
AnimationPromise as AnimationPromiseDefinition,
|
||||
Animation as AnimationBaseDefinition,
|
||||
AnimationDefinition,
|
||||
Pair
|
||||
Animation as AnimationBaseDefinition
|
||||
} from ".";
|
||||
import { View } from "../core/view";
|
||||
import {
|
||||
AnimationDefinition, AnimationPromise as AnimationPromiseDefinition,
|
||||
Pair, PropertyAnimation
|
||||
} from "./animation-interfaces";
|
||||
|
||||
// Types.
|
||||
// Requires.
|
||||
import { Color } from "../../color";
|
||||
import { isEnabled as traceEnabled, write as traceWrite, categories as traceCategories, messageType as traceType } from "../../trace";
|
||||
import {
|
||||
isEnabled as traceEnabled, write as traceWrite,
|
||||
categories as traceCategories, messageType as traceType
|
||||
} from "../../trace";
|
||||
import { PercentLength } from "../styling/style-properties";
|
||||
|
||||
export { Color, traceEnabled, traceWrite, traceCategories, traceType };
|
||||
export * from "./animation-interfaces";
|
||||
|
||||
export module Properties {
|
||||
export const opacity = "opacity";
|
||||
@@ -25,16 +29,6 @@ export module Properties {
|
||||
export const width = "width";
|
||||
}
|
||||
|
||||
export interface PropertyAnimation {
|
||||
target: View;
|
||||
property: string;
|
||||
value: any;
|
||||
duration?: number;
|
||||
delay?: number;
|
||||
iterations?: number;
|
||||
curve?: any;
|
||||
}
|
||||
|
||||
export class CubicBezierAnimationCurve implements CubicBezierAnimationCurveDefinition {
|
||||
|
||||
public x1: number;
|
||||
|
||||
72
nativescript-core/ui/animation/animation-interfaces.ts
Normal file
72
nativescript-core/ui/animation/animation-interfaces.ts
Normal file
@@ -0,0 +1,72 @@
|
||||
// Types
|
||||
import { View } from "../core/view";
|
||||
import { PercentLength } from "../styling/style-properties";
|
||||
import { Color } from "../../color";
|
||||
|
||||
export type Transformation = {
|
||||
property: TransformationType;
|
||||
value: TransformationValue;
|
||||
};
|
||||
|
||||
export type TransformationType = "rotate" |
|
||||
"translate" | "translateX" | "translateY" |
|
||||
"scale" | "scaleX" | "scaleY";
|
||||
|
||||
export type TransformationValue = Pair | number;
|
||||
|
||||
export type TransformFunctionsInfo = {
|
||||
translate: Pair,
|
||||
rotate: number,
|
||||
scale: Pair,
|
||||
};
|
||||
|
||||
export type AnimationPromise = Promise<void> & Cancelable;
|
||||
|
||||
export interface Pair {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface Cancelable {
|
||||
cancel(): void;
|
||||
}
|
||||
|
||||
export interface PropertyAnimation {
|
||||
target: View;
|
||||
property: string;
|
||||
value: any;
|
||||
duration?: number;
|
||||
delay?: number;
|
||||
iterations?: number;
|
||||
curve?: any;
|
||||
}
|
||||
|
||||
export interface PropertyAnimationInfo extends PropertyAnimation {
|
||||
_propertyResetCallback?: any;
|
||||
_originalValue?: any;
|
||||
}
|
||||
|
||||
export interface AnimationDefinition {
|
||||
target?: View;
|
||||
opacity?: number;
|
||||
backgroundColor?: Color;
|
||||
translate?: Pair;
|
||||
scale?: Pair;
|
||||
height?: PercentLength | string;
|
||||
width?: PercentLength | string;
|
||||
rotate?: number;
|
||||
duration?: number;
|
||||
delay?: number;
|
||||
iterations?: number;
|
||||
curve?: any;
|
||||
}
|
||||
|
||||
export interface AnimationDefinitionInternal extends AnimationDefinition {
|
||||
valueSource?: "animation" | "keyframe";
|
||||
}
|
||||
|
||||
export interface IOSView extends View {
|
||||
_suspendPresentationLayerUpdates();
|
||||
_resumePresentationLayerUpdates();
|
||||
_isPresentationLayerUpdateSuspeneded();
|
||||
}
|
||||
@@ -1,22 +1,22 @@
|
||||
// Definitions.
|
||||
import { AnimationDefinition, AnimationPromise } from ".";
|
||||
// Types.
|
||||
import { AnimationDefinitionInternal, AnimationPromise, PropertyAnimation } from "./animation-common";
|
||||
import { View } from "../core/view";
|
||||
|
||||
import { AnimationBase, Properties, PropertyAnimation, CubicBezierAnimationCurve, Color, traceWrite, traceEnabled, traceCategories, traceType } from "./animation-common";
|
||||
// Requires
|
||||
import {
|
||||
AnimationBase, Properties, CubicBezierAnimationCurve, Color, traceWrite,
|
||||
traceEnabled, traceCategories, traceType
|
||||
} from "./animation-common";
|
||||
import {
|
||||
opacityProperty, backgroundColorProperty, rotateProperty,
|
||||
translateXProperty, translateYProperty, scaleXProperty, scaleYProperty,
|
||||
heightProperty, widthProperty, PercentLength
|
||||
} from "../styling/style-properties";
|
||||
|
||||
import { layout } from "../../utils/utils";
|
||||
import { device, screen } from "../../platform";
|
||||
import lazy from "../../utils/lazy";
|
||||
export * from "./animation-common";
|
||||
|
||||
interface AnimationDefinitionInternal extends AnimationDefinition {
|
||||
valueSource?: "animation" | "keyframe";
|
||||
}
|
||||
export * from "./animation-common";
|
||||
|
||||
let argbEvaluator: android.animation.ArgbEvaluator;
|
||||
function ensureArgbEvaluator() {
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
import { AnimationDefinition, AnimationPromise } from ".";
|
||||
// Types
|
||||
import {
|
||||
AnimationDefinitionInternal, AnimationPromise, IOSView,
|
||||
PropertyAnimation, PropertyAnimationInfo
|
||||
} from "./animation-common";
|
||||
import { View } from "../core/view";
|
||||
|
||||
import { AnimationBase, Properties, PropertyAnimation, CubicBezierAnimationCurve, traceWrite, traceEnabled, traceCategories, traceType } from "./animation-common";
|
||||
// Requires
|
||||
import {
|
||||
AnimationBase, Properties, CubicBezierAnimationCurve,
|
||||
traceWrite, traceEnabled, traceCategories, traceType
|
||||
} from "./animation-common";
|
||||
import {
|
||||
opacityProperty, backgroundColorProperty, rotateProperty,
|
||||
translateXProperty, translateYProperty, scaleXProperty, scaleYProperty,
|
||||
@@ -26,21 +34,6 @@ class AnimationInfo {
|
||||
public delay: number;
|
||||
}
|
||||
|
||||
interface PropertyAnimationInfo extends PropertyAnimation {
|
||||
_propertyResetCallback?: any;
|
||||
_originalValue?: any;
|
||||
}
|
||||
|
||||
interface AnimationDefinitionInternal extends AnimationDefinition {
|
||||
valueSource?: "animation" | "keyframe";
|
||||
}
|
||||
|
||||
interface IOSView extends View {
|
||||
_suspendPresentationLayerUpdates();
|
||||
_resumePresentationLayerUpdates();
|
||||
_isPresentationLayerUpdateSuspeneded();
|
||||
}
|
||||
|
||||
class AnimationDelegateImpl extends NSObject implements CAAnimationDelegate {
|
||||
|
||||
public nextAnimation: Function;
|
||||
|
||||
Reference in New Issue
Block a user