@angular/platform-browser
Version:
Angular - library for using Angular in a web browser
1 lines • 11.1 kB
Source Map (JSON)
{"version":3,"file":"animations.mjs","sources":["../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/platform-browser/animations/src/providers.ts","../../../../../k8-fastbuild-ST-fdfa778d11ba/bin/packages/platform-browser/animations/src/module.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.dev/license\n */\n\nimport {\n AnimationDriver,\n NoopAnimationDriver,\n ɵAnimationEngine as AnimationEngine,\n ɵAnimationRendererFactory as AnimationRendererFactory,\n ɵAnimationStyleNormalizer as AnimationStyleNormalizer,\n ɵWebAnimationsDriver as WebAnimationsDriver,\n ɵWebAnimationsStyleNormalizer as WebAnimationsStyleNormalizer,\n} from '@angular/animations/browser';\nimport {DOCUMENT} from '@angular/common';\nimport {\n ANIMATION_MODULE_TYPE,\n inject,\n Inject,\n Injectable,\n NgZone,\n OnDestroy,\n Provider,\n RendererFactory2,\n} from '@angular/core';\nimport {ɵDomRendererFactory2 as DomRendererFactory2} from '../../index';\n\n@Injectable()\nexport class InjectableAnimationEngine extends AnimationEngine implements OnDestroy {\n // The `ApplicationRef` is injected here explicitly to force the dependency ordering.\n // Since the `ApplicationRef` should be created earlier before the `AnimationEngine`, they\n // both have `ngOnDestroy` hooks and `flush()` must be called after all views are destroyed.\n constructor(\n @Inject(DOCUMENT) doc: Document,\n driver: AnimationDriver,\n normalizer: AnimationStyleNormalizer,\n ) {\n super(doc, driver, normalizer);\n }\n\n ngOnDestroy(): void {\n this.flush();\n }\n}\n\nexport function instantiateDefaultStyleNormalizer() {\n return new WebAnimationsStyleNormalizer();\n}\n\nexport function instantiateRendererFactory() {\n return new AnimationRendererFactory(\n inject(DomRendererFactory2),\n inject(AnimationEngine),\n inject(NgZone),\n );\n}\n\nconst SHARED_ANIMATION_PROVIDERS: Provider[] = [\n {provide: AnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer},\n {provide: AnimationEngine, useClass: InjectableAnimationEngine},\n {\n provide: RendererFactory2,\n useFactory: instantiateRendererFactory,\n },\n];\n\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserTestingModule.\n */\nexport const BROWSER_NOOP_ANIMATIONS_PROVIDERS: Provider[] = [\n {provide: AnimationDriver, useClass: NoopAnimationDriver},\n {provide: ANIMATION_MODULE_TYPE, useValue: 'NoopAnimations'},\n ...SHARED_ANIMATION_PROVIDERS,\n];\n\n/**\n * Separate providers from the actual module so that we can do a local modification in Google3 to\n * include them in the BrowserModule.\n */\nexport const BROWSER_ANIMATIONS_PROVIDERS: Provider[] = [\n // Note: the `ngServerMode` happen inside factories to give the variable time to initialize.\n {\n provide: AnimationDriver,\n useFactory: () =>\n typeof ngServerMode !== 'undefined' && ngServerMode\n ? new NoopAnimationDriver()\n : new WebAnimationsDriver(),\n },\n {\n provide: ANIMATION_MODULE_TYPE,\n useFactory: () =>\n typeof ngServerMode !== 'undefined' && ngServerMode ? 'NoopAnimations' : 'BrowserAnimations',\n },\n ...SHARED_ANIMATION_PROVIDERS,\n];\n","/**\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.dev/license\n */\nimport {\n ModuleWithProviders,\n NgModule,\n Provider,\n ɵperformanceMarkFeature as performanceMarkFeature,\n} from '@angular/core';\n// g3-only import {BrowserModule} from '@angular/platform-browser';\nimport {BrowserModule} from '../../index'; // 3p-only\n\nimport {BROWSER_ANIMATIONS_PROVIDERS, BROWSER_NOOP_ANIMATIONS_PROVIDERS} from './providers';\n\n/**\n * Object used to configure the behavior of {@link BrowserAnimationsModule}\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\nexport interface BrowserAnimationsModuleConfig {\n /**\n * Whether animations should be disabled. Passing this is identical to providing the\n * `NoopAnimationsModule`, but it can be controlled based on a runtime value.\n */\n disableAnimations?: boolean;\n}\n\n/**\n * Exports `BrowserModule` with additional dependency-injection providers\n * for use with animations. See [Animations](guide/animations).\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\n@NgModule({\n exports: [BrowserModule],\n providers: BROWSER_ANIMATIONS_PROVIDERS,\n})\nexport class BrowserAnimationsModule {\n /**\n * Configures the module based on the specified object.\n *\n * @param config Object used to configure the behavior of the `BrowserAnimationsModule`.\n * @see {@link BrowserAnimationsModuleConfig}\n *\n * @usageNotes\n * When registering the `BrowserAnimationsModule`, you can use the `withConfig`\n * function as follows:\n * ```ts\n * @NgModule({\n * imports: [BrowserAnimationsModule.withConfig(config)]\n * })\n * class MyNgModule {}\n * ```\n */\n static withConfig(\n config: BrowserAnimationsModuleConfig,\n ): ModuleWithProviders<BrowserAnimationsModule> {\n return {\n ngModule: BrowserAnimationsModule,\n providers: config.disableAnimations\n ? BROWSER_NOOP_ANIMATIONS_PROVIDERS\n : BROWSER_ANIMATIONS_PROVIDERS,\n };\n }\n}\n\n/**\n * Returns the set of dependency-injection providers\n * to enable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to enable animations in an application\n * bootstrapped using the `bootstrapApplication` function. In this scenario there\n * is no need to import the `BrowserAnimationsModule` NgModule at all, just add\n * providers returned by this function to the `providers` list as show below.\n *\n * ```ts\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n *\n */\nexport function provideAnimations(): Provider[] {\n performanceMarkFeature('NgEagerAnimations');\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideAnimations` call results in app code.\n return [...BROWSER_ANIMATIONS_PROVIDERS];\n}\n\n/**\n * A null player that must be imported to allow disabling of animations.\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\n@NgModule({\n exports: [BrowserModule],\n providers: BROWSER_NOOP_ANIMATIONS_PROVIDERS,\n})\nexport class NoopAnimationsModule {}\n\n/**\n * Returns the set of dependency-injection providers\n * to disable animations in an application. See [animations guide](guide/animations)\n * to learn more about animations in Angular.\n *\n * @usageNotes\n *\n * The function is useful when you want to bootstrap an application using\n * the `bootstrapApplication` function, but you need to disable animations\n * (for example, when running tests).\n *\n * ```ts\n * bootstrapApplication(RootComponent, {\n * providers: [\n * provideNoopAnimations()\n * ]\n * });\n * ```\n *\n * @publicApi\n *\n * @deprecated 20.2 Use `animate.enter` or `animate.leave` instead. Intent to remove in v23\n */\nexport function provideNoopAnimations(): Provider[] {\n // Return a copy to prevent changes to the original array in case any in-place\n // alterations are performed to the `provideNoopAnimations` call results in app code.\n return [...BROWSER_NOOP_ANIMATIONS_PROVIDERS];\n}\n"],"names":["AnimationEngine","WebAnimationsStyleNormalizer","AnimationRendererFactory","AnimationStyleNormalizer","WebAnimationsDriver","performanceMarkFeature"],"mappings":";;;;;;;;;;;;;;;AA+BM,MAAO,yBAA0B,SAAQA,gBAAe,CAAA;AAI5D,EAAA,WAAA,CACoB,GAAa,EAC/B,MAAuB,EACvB,UAAoC,EAAA;AAEpC,IAAA,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,CAAC;AAChC,EAAA;AAEA,EAAA,WAAW,GAAA;IACT,IAAI,CAAC,KAAK,EAAE;AACd,EAAA;AAdW,EAAA,OAAA,IAAA,GAAA,EAAA,CAAA,kBAAA,CAAA;AAAA,IAAA,UAAA,EAAA,QAAA;AAAA,IAAA,OAAA,EAAA,mBAAA;AAAA,IAAA,QAAA,EAAA,EAAA;AAAA,IAAA,IAAA,EAAA,yBAAyB;;aAK1B;AAAQ,KAAA,EAAA;MAAA,KAAA,EAAA,EAAA,CAAA;AAAA,KAAA,EAAA;MAAA,KAAA,EAAA,EAAA,CAAA;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