diff --git a/tns-core-modules/tns-core-modules.base.d.ts b/tns-core-modules/tns-core-modules.base.d.ts
index e7ef36440..3ad3f62f8 100644
--- a/tns-core-modules/tns-core-modules.base.d.ts
+++ b/tns-core-modules/tns-core-modules.base.d.ts
@@ -86,7 +86,6 @@
///
///
///
-///
///
///
///
diff --git a/tns-core-modules/ui/animation/animation-common.ts b/tns-core-modules/ui/animation/animation-common.ts
index 01bbbbd7f..79ddf1407 100644
--- a/tns-core-modules/ui/animation/animation-common.ts
+++ b/tns-core-modules/ui/animation/animation-common.ts
@@ -69,7 +69,9 @@ export abstract class AnimationBase implements AnimationBaseDefinition {
this._propertyAnimations = new Array();
for (let i = 0, length = animationDefinitions.length; i < length; i++) {
- animationDefinitions[i].curve = this._resolveAnimationCurve(animationDefinitions[i].curve);
+ if (animationDefinitions[i].curve){
+ animationDefinitions[i].curve = this._resolveAnimationCurve(animationDefinitions[i].curve);
+ }
this._propertyAnimations = this._propertyAnimations.concat(AnimationBase._createPropertyAnimations(animationDefinitions[i]));
}
diff --git a/tns-core-modules/ui/animation/animation.android.ts b/tns-core-modules/ui/animation/animation.android.ts
index 7c7c2df66..fabaf7f4a 100644
--- a/tns-core-modules/ui/animation/animation.android.ts
+++ b/tns-core-modules/ui/animation/animation.android.ts
@@ -3,10 +3,10 @@ import {
AnimationBase, Properties, PropertyAnimation, CubicBezierAnimationCurve, AnimationPromise,
opacityProperty, backgroundColorProperty, rotateProperty,
translateXProperty, translateYProperty,
- scaleXProperty, scaleYProperty, Color, layout, traceWrite, traceEnabled, traceCategories
+ scaleXProperty, scaleYProperty, Color, traceWrite, traceEnabled, traceCategories
} from "./animation-common";
-import { CacheLayerType } from "utils/utils";
+import { CacheLayerType, layout } from "utils/utils";
import lazy from "utils/lazy";
export * from "./animation-common";
@@ -71,11 +71,12 @@ export function _resolveAnimationCurve(curve: string | CubicBezierAnimationCurve
}
if (curve instanceof CubicBezierAnimationCurve) {
return (android).support.v4.view.animation.PathInterpolatorCompat.create(curve.x1, curve.y1, curve.x2, curve.y2);
- } else if (curve instanceof android.view.animation.Interpolator) {
+ }
+ else if (curve instanceof android.view.animation.Interpolator) {
return curve;
}
else {
- throw new Error("Invalid android.view.animation.Interpolator.");
+ throw new Error(`Invalid animation curve: ${curve}`);
}
}
}
@@ -206,16 +207,16 @@ export class Animation extends AnimationBase {
traceWrite("Creating ObjectAnimator(s) for animation: " + Animation._getAnimationInfo(propertyAnimation) + "...", traceCategories.Animation);
}
- if (!propertyAnimation.target) {
- throw new Error("Animation target cannot be null or undefined!");
+ if (propertyAnimation.target === null || propertyAnimation.target === undefined) {
+ throw new Error(`Animation target cannot be null or undefined; property: ${propertyAnimation.property}; value: ${propertyAnimation.value};`);
}
- if (!propertyAnimation.property) {
- throw new Error("Animation property cannot be null or undefined!");
+ if (propertyAnimation.property === null || propertyAnimation.property === undefined) {
+ throw new Error(`Animation property cannot be null or undefined; target: ${propertyAnimation.target}; value: ${propertyAnimation.value};`);
}
- if (!propertyAnimation.value) {
- throw new Error("Animation value cannot be null or undefined!");
+ if (propertyAnimation.value === null || propertyAnimation.value === undefined) {
+ throw new Error(`Animation value cannot be null or undefined; target: ${propertyAnimation.target}; property: ${propertyAnimation.property};`);
}
let nativeArray;
diff --git a/tns-core-modules/ui/animation/animation.ios.ts b/tns-core-modules/ui/animation/animation.ios.ts
index 5a5877890..8f428106e 100644
--- a/tns-core-modules/ui/animation/animation.ios.ts
+++ b/tns-core-modules/ui/animation/animation.ios.ts
@@ -136,7 +136,9 @@ export function _resolveAnimationCurve(curve: string | CubicBezierAnimationCurve
let animationCurve = curve;
return CAMediaTimingFunction.functionWithControlPoints(animationCurve.x1, animationCurve.y1, animationCurve.x2, animationCurve.y2);
}
- return undefined;
+ else {
+ throw new Error(`Invalid animation curve: ${curve}`);
+ }
}
}
diff --git a/tns-core-modules/ui/animation/keyframe-animation.ts b/tns-core-modules/ui/animation/keyframe-animation.ts
index b47d2a261..18f4a6305 100644
--- a/tns-core-modules/ui/animation/keyframe-animation.ts
+++ b/tns-core-modules/ui/animation/keyframe-animation.ts
@@ -5,7 +5,8 @@ import {
KeyframeAnimation as KeyframeAnimationDefinition
} from "ui/animation/keyframe-animation";
-import { View, unsetValue, Animation } from "ui/core/view";
+import { View, unsetValue } from "ui/core/view";
+import { Animation } from "ui/animation";
export class KeyframeDeclaration implements KeyframeDeclarationDefinition {
public property: string;
diff --git a/tns-core-modules/ui/core/view-base.ts b/tns-core-modules/ui/core/view-base.ts
index 666f3126a..3c559b35b 100644
--- a/tns-core-modules/ui/core/view-base.ts
+++ b/tns-core-modules/ui/core/view-base.ts
@@ -4,14 +4,21 @@ import { Property, InheritedProperty, Style, clearInheritedProperties, propagate
import { Binding, BindingOptions, Bindable } from "ui/core/bindable";
import { isIOS, isAndroid } from "platform";
import { fromString as gestureFromString } from "ui/gestures";
-import { CssState, StyleScope, applyInlineStyle } from "ui/styling/style-scope";
import { SelectorCore } from "ui/styling/css-selector";
import { KeyframeAnimation } from "ui/animation/keyframe-animation";
import { enabled as traceEnabled, write as traceWrite, categories as traceCategories, notifyEvent as traceNotifyEvent, isCategorySet } from "trace";
+import * as ssm from "ui/styling/style-scope";
+let styleScopeModule: typeof ssm;
+function ensureStyleScopeModule() {
+ if (!styleScopeModule){
+ styleScopeModule = require("ui/styling/style-scope");
+ }
+}
+
export {
- KeyframeAnimation, Observable, EventData, Binding, BindingOptions, Bindable, isIOS, isAndroid,
+ Observable, EventData, Binding, BindingOptions, Bindable, isIOS, isAndroid,
gestureFromString, traceEnabled, traceWrite, traceCategories, traceNotifyEvent, isCategorySet
};
export * from "./properties";
@@ -113,7 +120,7 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
public _context: any;
public _isAddedToNativeVisualTree: any;
- public _cssState: CssState;
+ public _cssState: ssm.CssState;
constructor() {
super();
this._domId = viewIdCounter++;
@@ -202,12 +209,12 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
if (!rootPage || !rootPage.isLoaded) {
return;
}
- let scope: StyleScope = (rootPage)._getStyleScope();
+ let scope: ssm.StyleScope = (rootPage)._getStyleScope();
scope.applySelectors(this);
}
// TODO: Make sure the state is set to null and this is called on unloaded to clean up change listeners...
- _setCssState(next: CssState): void {
+ _setCssState(next: ssm.CssState): void {
const previous = this._cssState;
this._cssState = next;
@@ -333,7 +340,8 @@ export class ViewBase extends Observable implements ViewBaseDefinition {
if (typeof inlineStyle === "string") {
try {
// this.style._beginUpdate();
- applyInlineStyle(this, inlineStyle);
+ ensureStyleScopeModule();
+ styleScopeModule.applyInlineStyle(this, inlineStyle);
} finally {
// this.style._endUpdate();
}
diff --git a/tns-core-modules/ui/core/view-common.ts b/tns-core-modules/ui/core/view-common.ts
index 3b7a3030c..0c5c5e2da 100644
--- a/tns-core-modules/ui/core/view-common.ts
+++ b/tns-core-modules/ui/core/view-common.ts
@@ -1,6 +1,5 @@
import { View as ViewDefinition, Point, Size } from "ui/core/view";
import { Color } from "color";
-import { Animation, AnimationPromise } from "ui/animation";
import { Source } from "utils/debug";
import { Background } from "ui/styling/background";
import {
@@ -10,7 +9,6 @@ import {
} from "./view-base";
import { observe as gestureObserve, GesturesObserver, GestureTypes, GestureEventData } from "ui/gestures";
import { Font, parseFont, FontStyle, FontWeight } from "ui/styling/font";
-import { fontSizeConverter } from "../styling/converters";
// Only types:
import { Order, FlexGrow, FlexShrink, FlexWrapBefore, AlignSelf } from "ui/layouts/flexbox-layout";
@@ -24,10 +22,17 @@ export * from "./view-base";
export {
GestureTypes, GesturesObserver, GestureEventData,
- Animation, AnimationPromise,
Background, Font, Color
}
+import * as am from "ui/animation";
+let animationModule: typeof am;
+function ensureAnimationModule() {
+ if (!animationModule){
+ animationModule = require("ui/animation");
+ }
+}
+
// registerSpecialProperty("class", (instance: ViewDefinition, propertyValue: string) => {
// instance.className = propertyValue;
// });
@@ -831,13 +836,14 @@ export abstract class ViewCommon extends ViewBase implements ViewDefinition {
};
}
- public animate(animation: any): AnimationPromise {
+ public animate(animation: any): am.AnimationPromise {
return this.createAnimation(animation).play();
}
- public createAnimation(animation: any): any {
+ public createAnimation(animation: any): am.Animation {
+ ensureAnimationModule();
animation.target = this;
- return new Animation([animation]);
+ return new animationModule.Animation([animation]);
}
public toString(): string {
@@ -1983,7 +1989,7 @@ const fontProperty = new ShorthandProperty