index.d.ts 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  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 { RendererFactory2 } from '@angular/core';
  8. import { AnimationMetadata, AnimationOptions, AnimationPlayer } from './animation_player.d-Dv9iW4uh.js';
  9. export { AUTO_STYLE, AnimateChildOptions, AnimateTimings, AnimationAnimateChildMetadata, AnimationAnimateMetadata, AnimationAnimateRefMetadata, AnimationGroupMetadata, AnimationKeyframesSequenceMetadata, AnimationMetadataType, AnimationQueryMetadata, AnimationQueryOptions, AnimationReferenceMetadata, AnimationSequenceMetadata, AnimationStaggerMetadata, AnimationStateMetadata, AnimationStyleMetadata, AnimationTransitionMetadata, AnimationTriggerMetadata, NoopAnimationPlayer, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, ɵStyleData, ɵStyleDataMap } from './animation_player.d-Dv9iW4uh.js';
  10. /**
  11. * An injectable service that produces an animation sequence programmatically within an
  12. * Angular component or directive.
  13. * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.
  14. *
  15. * @usageNotes
  16. *
  17. * To use this service, add it to your component or directive as a dependency.
  18. * The service is instantiated along with your component.
  19. *
  20. * Apps do not typically need to create their own animation players, but if you
  21. * do need to, follow these steps:
  22. *
  23. * 1. Use the <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code> method
  24. * to create a programmatic animation. The method returns an `AnimationFactory` instance.
  25. *
  26. * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.
  27. *
  28. * 3. Use the player object to control the animation programmatically.
  29. *
  30. * For example:
  31. *
  32. * ```ts
  33. * // import the service from BrowserAnimationsModule
  34. * import {AnimationBuilder} from '@angular/animations';
  35. * // require the service as a dependency
  36. * class MyCmp {
  37. * constructor(private _builder: AnimationBuilder) {}
  38. *
  39. * makeAnimation(element: any) {
  40. * // first define a reusable animation
  41. * const myAnimation = this._builder.build([
  42. * style({ width: 0 }),
  43. * animate(1000, style({ width: '100px' }))
  44. * ]);
  45. *
  46. * // use the returned factory object to create a player
  47. * const player = myAnimation.create(element);
  48. *
  49. * player.play();
  50. * }
  51. * }
  52. * ```
  53. *
  54. * @publicApi
  55. */
  56. declare abstract class AnimationBuilder {
  57. /**
  58. * Builds a factory for producing a defined animation.
  59. * @param animation A reusable animation definition.
  60. * @returns A factory object that can create a player for the defined animation.
  61. * @see {@link animate}
  62. */
  63. abstract build(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory;
  64. static ɵfac: i0.ɵɵFactoryDeclaration<AnimationBuilder, never>;
  65. static ɵprov: i0.ɵɵInjectableDeclaration<AnimationBuilder>;
  66. }
  67. /**
  68. * A factory object returned from the
  69. * <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>
  70. * method.
  71. *
  72. * @publicApi
  73. */
  74. declare abstract class AnimationFactory {
  75. /**
  76. * Creates an `AnimationPlayer` instance for the reusable animation defined by
  77. * the <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>
  78. * method that created this factory and attaches the new player a DOM element.
  79. *
  80. * @param element The DOM element to which to attach the player.
  81. * @param options A set of options that can include a time delay and
  82. * additional developer-defined parameters.
  83. */
  84. abstract create(element: any, options?: AnimationOptions): AnimationPlayer;
  85. }
  86. declare class BrowserAnimationBuilder extends AnimationBuilder {
  87. private animationModuleType;
  88. private _nextAnimationId;
  89. private _renderer;
  90. constructor(rootRenderer: RendererFactory2, doc: Document);
  91. build(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory;
  92. static ɵfac: i0.ɵɵFactoryDeclaration<BrowserAnimationBuilder, never>;
  93. static ɵprov: i0.ɵɵInjectableDeclaration<BrowserAnimationBuilder>;
  94. }
  95. /**
  96. * An instance of this class is returned as an event parameter when an animation
  97. * callback is captured for an animation either during the start or done phase.
  98. *
  99. * ```ts
  100. * @Component({
  101. * host: {
  102. * '[@myAnimationTrigger]': 'someExpression',
  103. * '(@myAnimationTrigger.start)': 'captureStartEvent($event)',
  104. * '(@myAnimationTrigger.done)': 'captureDoneEvent($event)',
  105. * },
  106. * animations: [
  107. * trigger("myAnimationTrigger", [
  108. * // ...
  109. * ])
  110. * ]
  111. * })
  112. * class MyComponent {
  113. * someExpression: any = false;
  114. * captureStartEvent(event: AnimationEvent) {
  115. * // the toState, fromState and totalTime data is accessible from the event variable
  116. * }
  117. *
  118. * captureDoneEvent(event: AnimationEvent) {
  119. * // the toState, fromState and totalTime data is accessible from the event variable
  120. * }
  121. * }
  122. * ```
  123. *
  124. * @publicApi
  125. */
  126. interface AnimationEvent {
  127. /**
  128. * The name of the state from which the animation is triggered.
  129. */
  130. fromState: string;
  131. /**
  132. * The name of the state in which the animation completes.
  133. */
  134. toState: string;
  135. /**
  136. * The time it takes the animation to complete, in milliseconds.
  137. */
  138. totalTime: number;
  139. /**
  140. * The animation phase in which the callback was invoked, one of
  141. * "start" or "done".
  142. */
  143. phaseName: string;
  144. /**
  145. * The element to which the animation is attached.
  146. */
  147. element: any;
  148. /**
  149. * Internal.
  150. */
  151. triggerName: string;
  152. /**
  153. * Internal.
  154. */
  155. disabled: boolean;
  156. }
  157. /**
  158. * The list of error codes used in runtime code of the `animations` package.
  159. * Reserved error code range: 3000-3999.
  160. */
  161. declare const enum RuntimeErrorCode {
  162. INVALID_TIMING_VALUE = 3000,
  163. INVALID_STYLE_PARAMS = 3001,
  164. INVALID_STYLE_VALUE = 3002,
  165. INVALID_PARAM_VALUE = 3003,
  166. INVALID_NODE_TYPE = 3004,
  167. INVALID_CSS_UNIT_VALUE = 3005,
  168. INVALID_TRIGGER = 3006,
  169. INVALID_DEFINITION = 3007,
  170. INVALID_STATE = 3008,
  171. INVALID_PROPERTY = 3009,
  172. INVALID_PARALLEL_ANIMATION = 3010,
  173. INVALID_KEYFRAMES = 3011,
  174. INVALID_OFFSET = 3012,
  175. INVALID_STAGGER = 3013,
  176. INVALID_QUERY = 3014,
  177. INVALID_EXPRESSION = 3015,
  178. INVALID_TRANSITION_ALIAS = 3016,
  179. NEGATIVE_STEP_VALUE = 3100,
  180. NEGATIVE_DELAY_VALUE = 3101,
  181. KEYFRAME_OFFSETS_OUT_OF_ORDER = 3200,
  182. KEYFRAMES_MISSING_OFFSETS = 3202,
  183. MISSING_OR_DESTROYED_ANIMATION = 3300,
  184. MISSING_PLAYER = 3301,
  185. MISSING_TRIGGER = 3302,
  186. MISSING_EVENT = 3303,
  187. UNSUPPORTED_TRIGGER_EVENT = 3400,
  188. UNREGISTERED_TRIGGER = 3401,
  189. TRIGGER_TRANSITIONS_FAILED = 3402,
  190. TRIGGER_PARSING_FAILED = 3403,
  191. TRIGGER_BUILD_FAILED = 3404,
  192. VALIDATION_FAILED = 3500,
  193. BUILDING_FAILED = 3501,
  194. ANIMATION_FAILED = 3502,
  195. REGISTRATION_FAILED = 3503,
  196. CREATE_ANIMATION_FAILED = 3504,
  197. TRANSITION_FAILED = 3505,
  198. BROWSER_ANIMATION_BUILDER_INJECTED_WITHOUT_ANIMATIONS = 3600
  199. }
  200. /**
  201. * A programmatic controller for a group of reusable animations.
  202. * Used internally to control animations.
  203. *
  204. * @see {@link AnimationPlayer}
  205. * @see {@link animations/group group}
  206. *
  207. */
  208. declare class AnimationGroupPlayer implements AnimationPlayer {
  209. private _onDoneFns;
  210. private _onStartFns;
  211. private _finished;
  212. private _started;
  213. private _destroyed;
  214. private _onDestroyFns;
  215. parentPlayer: AnimationPlayer | null;
  216. totalTime: number;
  217. readonly players: AnimationPlayer[];
  218. constructor(_players: AnimationPlayer[]);
  219. private _onFinish;
  220. init(): void;
  221. onStart(fn: () => void): void;
  222. private _onStart;
  223. onDone(fn: () => void): void;
  224. onDestroy(fn: () => void): void;
  225. hasStarted(): boolean;
  226. play(): void;
  227. pause(): void;
  228. restart(): void;
  229. finish(): void;
  230. destroy(): void;
  231. private _onDestroy;
  232. reset(): void;
  233. setPosition(p: number): void;
  234. getPosition(): number;
  235. beforeDestroy(): void;
  236. }
  237. declare const ɵPRE_STYLE = "!";
  238. export { AnimationBuilder, AnimationFactory, AnimationMetadata, AnimationOptions, AnimationPlayer, AnimationGroupPlayer as ɵAnimationGroupPlayer, BrowserAnimationBuilder as ɵBrowserAnimationBuilder, ɵPRE_STYLE, RuntimeErrorCode as ɵRuntimeErrorCode };
  239. export type { AnimationEvent };