1 line
20 KiB
Text
1 line
20 KiB
Text
|
{"version":3,"file":"async.mjs","sources":["../../../../../../../packages/platform-browser/animations/async/src/async_animation_renderer.ts","../../../../../../../packages/platform-browser/animations/async/src/providers.ts","../../../../../../../packages/platform-browser/animations/async/src/async-animations.ts","../../../../../../../packages/platform-browser/animations/async/public_api.ts","../../../../../../../packages/platform-browser/animations/async/index.ts","../../../../../../../packages/platform-browser/animations/async/async.ts"],"sourcesContent":["/**\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n\nimport {ɵAnimationEngine as AnimationEngine, ɵAnimationRenderer as AnimationRenderer, ɵAnimationRendererFactory as AnimationRendererFactory} from '@angular/animations/browser';\nimport {inject, Injectable, NgZone, OnDestroy, Renderer2, RendererFactory2, RendererStyleFlags2, RendererType2, ɵAnimationRendererType as AnimationRendererType, ɵChangeDetectionScheduler as ChangeDetectionScheduler, ɵRuntimeError as RuntimeError} from '@angular/core';\nimport {ɵRuntimeErrorCode as RuntimeErrorCode} from '@angular/platform-browser';\n\nconst ANIMATION_PREFIX = '@';\n\n@Injectable()\nexport class AsyncAnimationRendererFactory implements OnDestroy, RendererFactory2 {\n private _rendererFactoryPromise: Promise<AnimationRendererFactory>|null = null;\n private readonly scheduler = inject(ChangeDetectionScheduler, {optional: true});\n private _engine?: AnimationEngine;\n\n /**\n *\n * @param moduleImpl allows to provide a mock implmentation (or will load the animation module)\n */\n constructor(\n private doc: Document, private delegate: RendererFactory2, private zone: NgZone,\n private animationType: 'animations'|'noop', private moduleImpl?: Promise<{\n ɵcreateEngine:\n (type: 'animations'|'noop', doc: Document,\n scheduler: ChangeDetectionScheduler|null) => AnimationEngine,\n ɵAnimationRendererFactory: typeof AnimationRendererFactory\n }>) {}\n\n /** @nodoc */\n ngOnDestroy(): void {\n // When the root view is removed, the renderer defers the actual work to the\n // `TransitionAnimationEngine` to do this, and the `TransitionAnimationEngine` doesn't actually\n // remove the DOM node, but just calls `markElementAsRemoved()`. The actual DOM node is not\n // removed until `TransitionAnimationEngine` \"flushes\".\n // Note: we already flush on destroy within the `InjectableAnimationEngine`. The injectable\n // engine is not provided when async animations are used.\n this._engine?.flush();\n }\n\n /**\n * @internal\n */\n private loadImpl(): Promise<AnimationRendererFactory> {\n const moduleImpl = this.moduleImpl ?? import('@angular/animations/browser');\n\n return moduleImpl\n .catch((e) => {\n throw new RuntimeError(\n RuntimeErrorCode.ANIMATION_RENDERER_ASYNC_LOADING_FAILURE,\n (typeof ngDevMode === 'undefined' || ngDevMode) &&\n 'Async loading for animations package was ' +\n 'enabled, but loading failed. Angular falls back to using regular rendering. ' +\n 'No animations will be displayed and their styles won\\'t be applied.');\n })\n .then(({ɵcreateEngine, ɵAnimationRendererFactory}) => {\n // We can't create the renderer yet because we might need the hostElement and the type\n // Both are provided in createRenderer().\n this._engine = ɵcreateEngine(this.animationType, this.doc, this.scheduler);\n const rendererFactory =\n new ɵAnimationRendererFactory(this.delegate, this._engine, this.zone);\n this.delegate = rendererFactory;\n return rendererFactory;\n });\n }\n\n /**\n * This method is delegating the renderer creation to the factories.\n * It uses default factory while
|