perf(animations): reduce size of bundle by removing AST classes (#19539)
This CL refactors the animation AST code to make use of interfaces instead of classes. Given that interfaces are not persisted during runtime the removal of classes should nicely cut down on size for the animations-browser bundle. -- before -- animations-browser.umd.js = 222kb animations-browser.umd.min.js = 107kb -- after -- animations-browser.umd.js = 213kb animations-browser.umd.min.js = 102kb PR Close #19539
This commit is contained in:

committed by
Chuck Jazdzewski

parent
f83989bb0d
commit
d5c9c5f183
@ -5,7 +5,7 @@
|
||||
* Use of this source code is governed by an MIT-style license that can be
|
||||
* found in the LICENSE file at https://angular.io/license
|
||||
*/
|
||||
import {ɵStyleData} from '@angular/animations';
|
||||
import {AnimationMetadataType, ɵStyleData} from '@angular/animations';
|
||||
|
||||
import {copyStyles, interpolateParams} from '../util';
|
||||
|
||||
@ -13,6 +13,7 @@ import {SequenceAst, StyleAst, TransitionAst, TriggerAst} from './animation_ast'
|
||||
import {AnimationStateStyles, AnimationTransitionFactory} from './animation_transition_factory';
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @experimental Animation support is experimental.
|
||||
*/
|
||||
@ -60,8 +61,15 @@ function createFallbackTransition(
|
||||
triggerName: string,
|
||||
states: {[stateName: string]: AnimationStateStyles}): AnimationTransitionFactory {
|
||||
const matchers = [(fromState: any, toState: any) => true];
|
||||
const animation = new SequenceAst([]);
|
||||
const transition = new TransitionAst(matchers, animation);
|
||||
const animation: SequenceAst = {type: AnimationMetadataType.Sequence, steps: [], options: null};
|
||||
const transition: TransitionAst = {
|
||||
type: AnimationMetadataType.Transition,
|
||||
animation,
|
||||
matchers,
|
||||
options: null,
|
||||
queryCount: 0,
|
||||
depCount: 0
|
||||
};
|
||||
return new AnimationTransitionFactory(triggerName, transition, states);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user