Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(animations): Add the possibility of lazy loading animations code. (
#50738) `provideLazyLoadedAnimations()` returns providers which allow the lazy loading of the animation module. Lazy loading of the animation code can shave off up to 16KB gzipped of the main bundle. PR Close #50738
- Loading branch information
Showing
24 changed files
with
1,020 additions
and
204 deletions.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
goldens/public-api/platform-browser/animations/async/index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
## API Report File for "@angular/platform-browser_animations_async" | ||
|
||
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/). | ||
```ts | ||
|
||
import { Provider } from '@angular/core'; | ||
|
||
// @public | ||
export function provideAnimationsAsync(type?: 'animations' | 'noop'): Provider[]; | ||
|
||
// (No @packageDocumentation comment for this package) | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* 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 {NoopAnimationStyleNormalizer} from './dsl/style_normalization/animation_style_normalizer'; | ||
import {WebAnimationsStyleNormalizer} from './dsl/style_normalization/web_animations_style_normalizer'; | ||
import {NoopAnimationDriver} from './render/animation_driver'; | ||
import {AnimationEngine} from './render/animation_engine_next'; | ||
import {WebAnimationsDriver} from './render/web_animations/web_animations_driver'; | ||
|
||
export function createEngine(type: 'animations'|'noop', doc: Document): AnimationEngine { | ||
// TODO: find a way to make this tree shakable. | ||
if (type === 'noop') { | ||
return new AnimationEngine(doc, new NoopAnimationDriver(), new NoopAnimationStyleNormalizer()); | ||
} | ||
|
||
return new AnimationEngine(doc, new WebAnimationsDriver(), new WebAnimationsStyleNormalizer()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.