index.d.ts 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /**
  2. * @license Angular v19.2.13
  3. * (c) 2010-2025 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. import * as i0 from '@angular/core';
  7. import { EnvironmentProviders, OnDestroy, RendererFactory2, NgZone, RendererType2, Renderer2, InjectionToken } from '@angular/core';
  8. import { ɵAnimationEngine as _AnimationEngine, ɵAnimationRendererFactory as _AnimationRendererFactory } from '@angular/animations/browser';
  9. /**
  10. * Returns the set of dependency-injection providers
  11. * to enable animations in an application. See [animations guide](guide/animations)
  12. * to learn more about animations in Angular.
  13. *
  14. * When you use this function instead of the eager `provideAnimations()`, animations won't be
  15. * rendered until the renderer is loaded.
  16. *
  17. * @usageNotes
  18. *
  19. * The function is useful when you want to enable animations in an application
  20. * bootstrapped using the `bootstrapApplication` function. In this scenario there
  21. * is no need to import the `BrowserAnimationsModule` NgModule at all, just add
  22. * providers returned by this function to the `providers` list as show below.
  23. *
  24. * ```ts
  25. * bootstrapApplication(RootComponent, {
  26. * providers: [
  27. * provideAnimationsAsync()
  28. * ]
  29. * });
  30. * ```
  31. *
  32. * @param type pass `'noop'` as argument to disable animations.
  33. *
  34. * @publicApi
  35. */
  36. declare function provideAnimationsAsync(type?: 'animations' | 'noop'): EnvironmentProviders;
  37. declare class AsyncAnimationRendererFactory implements OnDestroy, RendererFactory2 {
  38. private doc;
  39. private delegate;
  40. private zone;
  41. private animationType;
  42. private moduleImpl?;
  43. private _rendererFactoryPromise;
  44. private scheduler;
  45. private readonly injector;
  46. private readonly loadingSchedulerFn;
  47. private _engine?;
  48. /**
  49. *
  50. * @param moduleImpl allows to provide a mock implmentation (or will load the animation module)
  51. */
  52. constructor(doc: Document, delegate: RendererFactory2, zone: NgZone, animationType: 'animations' | 'noop', moduleImpl?: Promise<{
  53. ɵcreateEngine: (type: "animations" | "noop", doc: Document) => _AnimationEngine;
  54. ɵAnimationRendererFactory: typeof _AnimationRendererFactory;
  55. }> | undefined);
  56. /** @docs-private */
  57. ngOnDestroy(): void;
  58. /**
  59. * This method is delegating the renderer creation to the factories.
  60. * It uses default factory while the animation factory isn't loaded
  61. * and will rely on the animation factory once it is loaded.
  62. *
  63. * Calling this method will trigger as side effect the loading of the animation module
  64. * if the renderered component uses animations.
  65. */
  66. createRenderer(hostElement: any, rendererType: RendererType2): Renderer2;
  67. begin(): void;
  68. end(): void;
  69. whenRenderingDone?(): Promise<any>;
  70. /**
  71. * Used during HMR to clear any cached data about a component.
  72. * @param componentId ID of the component that is being replaced.
  73. */
  74. protected componentReplaced(componentId: string): void;
  75. static ɵfac: i0.ɵɵFactoryDeclaration<AsyncAnimationRendererFactory, never>;
  76. static ɵprov: i0.ɵɵInjectableDeclaration<AsyncAnimationRendererFactory>;
  77. }
  78. /**
  79. * Provides a custom scheduler function for the async loading of the animation package.
  80. *
  81. * Private token for investigation purposes
  82. */
  83. declare const ɵASYNC_ANIMATION_LOADING_SCHEDULER_FN: InjectionToken<(<T>(loadFn: () => T) => T)>;
  84. export { provideAnimationsAsync, ɵASYNC_ANIMATION_LOADING_SCHEDULER_FN, AsyncAnimationRendererFactory as ɵAsyncAnimationRendererFactory };