feat(animations): provide support for offline compilation
This commit is contained in:
@ -74,10 +74,13 @@ export type AnimationGroupPlayer = t.AnimationGroupPlayer;
|
||||
export var AnimationGroupPlayer: typeof t.AnimationGroupPlayer = r.AnimationGroupPlayer;
|
||||
export type AnimationKeyframe = t.AnimationKeyframe;
|
||||
export var AnimationKeyframe: typeof t.AnimationKeyframe = r.AnimationKeyframe;
|
||||
export type AnimationStyleUtil = t.AnimationStyleUtil;
|
||||
export var AnimationStyleUtil: typeof t.AnimationStyleUtil = r.AnimationStyleUtil;
|
||||
export type AnimationStylrs = t.AnimationStyles;
|
||||
export type AnimationStyles = t.AnimationStyles;
|
||||
export var AnimationStyles: typeof t.AnimationStyles = r.AnimationStyles;
|
||||
export var ANY_STATE = r.ANY_STATE;
|
||||
export var EMPTY_STATE = r.EMPTY_STATE;
|
||||
export var FILL_STYLE_FLAG = r.FILL_STYLE_FLAG;
|
||||
export var balanceAnimationStyles: typeof t.balanceAnimationStyles = r.balanceAnimationStyles;
|
||||
export var balanceAnimationKeyframes: typeof t.balanceAnimationKeyframes = r.balanceAnimationKeyframes;
|
||||
export var flattenStyles: typeof t.flattenStyles = r.flattenStyles;
|
||||
export var clearStyles: typeof t.clearStyles = r.clearStyles;
|
||||
export var collectAndResolveStyles: typeof r.collectAndResolveStyles = r.collectAndResolveStyles;
|
||||
|
@ -249,7 +249,7 @@ class _AnimationBuilder implements AnimationAstVisitor {
|
||||
statements.push(
|
||||
_ANIMATION_FACTORY_RENDERER_VAR.callMethod('setElementStyles', [
|
||||
_ANIMATION_FACTORY_ELEMENT_VAR,
|
||||
o.importExpr(Identifiers.clearAnimationStyles).callFn([_ANIMATION_START_STATE_STYLES_VAR])
|
||||
o.importExpr(Identifiers.clearStyles).callFn([_ANIMATION_START_STATE_STYLES_VAR])
|
||||
]).toStmt());
|
||||
|
||||
ast.stateTransitions.forEach(transAst => statements.push(transAst.visit(this, context)));
|
||||
@ -287,7 +287,7 @@ class _AnimationBuilder implements AnimationAstVisitor {
|
||||
]).toStmt());
|
||||
|
||||
return o.fn([
|
||||
new o.FnParam(_ANIMATION_FACTORY_VIEW_VAR.name, o.importType(Identifiers.AppView)),
|
||||
new o.FnParam(_ANIMATION_FACTORY_VIEW_VAR.name, o.importType(Identifiers.AppView, [o.DYNAMIC_TYPE])),
|
||||
new o.FnParam(_ANIMATION_FACTORY_ELEMENT_VAR.name, o.DYNAMIC_TYPE),
|
||||
new o.FnParam(_ANIMATION_CURRENT_STATE_VAR.name, o.DYNAMIC_TYPE),
|
||||
new o.FnParam(_ANIMATION_NEXT_STATE_VAR.name, o.DYNAMIC_TYPE)
|
||||
|
@ -45,7 +45,10 @@ import {
|
||||
NoOpAnimationPlayer as NoOpAnimationPlayer_,
|
||||
AnimationGroupPlayer as AnimationGroupPlayer_,
|
||||
AnimationSequencePlayer as AnimationSequencePlayer_,
|
||||
AnimationStyleUtil,
|
||||
balanceAnimationStyles as impBalanceAnimationStyles,
|
||||
balanceAnimationKeyframes as impBalanceAnimationKeyframes,
|
||||
clearStyles as impClearStyles,
|
||||
collectAndResolveStyles as impCollectAndResolveStyles,
|
||||
SecurityContext
|
||||
} from '../core_private';
|
||||
|
||||
@ -245,22 +248,22 @@ export class Identifiers {
|
||||
static balanceAnimationStyles = new CompileIdentifierMetadata({
|
||||
name: 'balanceAnimationStyles',
|
||||
moduleUrl: ANIMATION_STYLE_UTIL_ASSET_URL,
|
||||
runtime: AnimationStyleUtil.balanceStyles
|
||||
runtime: impBalanceAnimationStyles
|
||||
});
|
||||
static balanceAnimationKeyframes = new CompileIdentifierMetadata({
|
||||
name: 'balanceAnimationKeyframes',
|
||||
moduleUrl: ANIMATION_STYLE_UTIL_ASSET_URL,
|
||||
runtime: AnimationStyleUtil.balanceKeyframes
|
||||
runtime: impBalanceAnimationKeyframes
|
||||
});
|
||||
static clearAnimationStyles = new CompileIdentifierMetadata({
|
||||
name: 'clearAnimationStyles',
|
||||
static clearStyles = new CompileIdentifierMetadata({
|
||||
name: 'clearStyles',
|
||||
moduleUrl: ANIMATION_STYLE_UTIL_ASSET_URL,
|
||||
runtime: AnimationStyleUtil.clearStyles
|
||||
runtime: impClearStyles
|
||||
});
|
||||
static collectAndResolveStyles = new CompileIdentifierMetadata({
|
||||
name: 'collectAndResolveStyles',
|
||||
moduleUrl: ANIMATION_STYLE_UTIL_ASSET_URL,
|
||||
runtime: AnimationStyleUtil.collectAndResolveStyles
|
||||
runtime: impCollectAndResolveStyles
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ import {
|
||||
AnimationStepAst
|
||||
} from '../../src/animation/animation_ast';
|
||||
|
||||
import {FILL_STYLE_FLAG, AnimationStyleUtil} from '../../core_private';
|
||||
import {FILL_STYLE_FLAG, flattenStyles} from '../../core_private';
|
||||
|
||||
import {StringMapWrapper} from '../../src/facade/collection';
|
||||
|
||||
@ -348,7 +348,7 @@ export function main() {
|
||||
var kf1 = keyframesStep.keyframes[0];
|
||||
var kf2 = keyframesStep.keyframes[1];
|
||||
|
||||
expect(AnimationStyleUtil.flattenStyles(kf1.styles.styles)).toEqual({
|
||||
expect(flattenStyles(kf1.styles.styles)).toEqual({
|
||||
"color": "red",
|
||||
"background": FILL_STYLE_FLAG
|
||||
});
|
||||
@ -368,7 +368,7 @@ export function main() {
|
||||
var kf2 = keyframesStep.keyframes[1];
|
||||
var kf3 = keyframesStep.keyframes[2];
|
||||
|
||||
expect(AnimationStyleUtil.flattenStyles(kf3.styles.styles)).toEqual({
|
||||
expect(flattenStyles(kf3.styles.styles)).toEqual({
|
||||
"background": "blue",
|
||||
"color": "red",
|
||||
"border-color": "white"
|
||||
@ -390,7 +390,7 @@ export function main() {
|
||||
var kf3 = keyframesStep.keyframes[2];
|
||||
|
||||
expect(kf1.offset).toEqual(0);
|
||||
expect(AnimationStyleUtil.flattenStyles(kf1.styles.styles)).toEqual({
|
||||
expect(flattenStyles(kf1.styles.styles)).toEqual({
|
||||
"font-size": FILL_STYLE_FLAG,
|
||||
"background": FILL_STYLE_FLAG,
|
||||
"color": FILL_STYLE_FLAG
|
||||
@ -412,7 +412,7 @@ export function main() {
|
||||
var kf3 = keyframesStep.keyframes[2];
|
||||
|
||||
expect(kf3.offset).toEqual(1);
|
||||
expect(AnimationStyleUtil.flattenStyles(kf3.styles.styles)).toEqual({
|
||||
expect(flattenStyles(kf3.styles.styles)).toEqual({
|
||||
"color": "orange",
|
||||
"background": "red",
|
||||
"transform": "rotate(360deg)",
|
||||
|
Reference in New Issue
Block a user