animations.d.ts 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599
  1. /**
  2. * @license Angular v8.1.0
  3. * (c) 2010-2019 Google LLC. https://angular.io/
  4. * License: MIT
  5. */
  6. /**
  7. * Defines an animation step that combines styling information with timing information.
  8. *
  9. * @param timings Sets `AnimateTimings` for the parent animation.
  10. * A string in the format "duration [delay] [easing]".
  11. * - Duration and delay are expressed as a number and optional time unit,
  12. * such as "1s" or "10ms" for one second and 10 milliseconds, respectively.
  13. * The default unit is milliseconds.
  14. * - The easing value controls how the animation accelerates and decelerates
  15. * during its runtime. Value is one of `ease`, `ease-in`, `ease-out`,
  16. * `ease-in-out`, or a `cubic-bezier()` function call.
  17. * If not supplied, no easing is applied.
  18. *
  19. * For example, the string "1s 100ms ease-out" specifies a duration of
  20. * 1000 milliseconds, and delay of 100 ms, and the "ease-out" easing style,
  21. * which decelerates near the end of the duration.
  22. * @param styles Sets AnimationStyles for the parent animation.
  23. * A function call to either `style()` or `keyframes()`
  24. * that returns a collection of CSS style entries to be applied to the parent animation.
  25. * When null, uses the styles from the destination state.
  26. * This is useful when describing an animation step that will complete an animation;
  27. * see "Animating to the final state" in `transitions()`.
  28. * @returns An object that encapsulates the animation step.
  29. *
  30. * @usageNotes
  31. * Call within an animation `sequence()`, `{@link animations/group group()}`, or
  32. * `transition()` call to specify an animation step
  33. * that applies given style data to the parent animation for a given amount of time.
  34. *
  35. * ### Syntax Examples
  36. * **Timing examples**
  37. *
  38. * The following examples show various `timings` specifications.
  39. * - `animate(500)` : Duration is 500 milliseconds.
  40. * - `animate("1s")` : Duration is 1000 milliseconds.
  41. * - `animate("100ms 0.5s")` : Duration is 100 milliseconds, delay is 500 milliseconds.
  42. * - `animate("5s ease-in")` : Duration is 5000 milliseconds, easing in.
  43. * - `animate("5s 10ms cubic-bezier(.17,.67,.88,.1)")` : Duration is 5000 milliseconds, delay is 10
  44. * milliseconds, easing according to a bezier curve.
  45. *
  46. * **Style examples**
  47. *
  48. * The following example calls `style()` to set a single CSS style.
  49. * ```typescript
  50. * animate(500, style({ background: "red" }))
  51. * ```
  52. * The following example calls `keyframes()` to set a CSS style
  53. * to different values for successive keyframes.
  54. * ```typescript
  55. * animate(500, keyframes(
  56. * [
  57. * style({ background: "blue" })),
  58. * style({ background: "red" }))
  59. * ])
  60. * ```
  61. *
  62. * @publicApi
  63. */
  64. export declare function animate(timings: string | number, styles?: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata | null): AnimationAnimateMetadata;
  65. /**
  66. * Executes a queried inner animation element within an animation sequence.
  67. *
  68. * @param options An options object that can contain a delay value for the start of the
  69. * animation, and additional override values for developer-defined parameters.
  70. * @return An object that encapsulates the child animation data.
  71. *
  72. * @usageNotes
  73. * Each time an animation is triggered in Angular, the parent animation
  74. * has priority and any child animations are blocked. In order
  75. * for a child animation to run, the parent animation must query each of the elements
  76. * containing child animations, and run them using this function.
  77. *
  78. * Note that this feature is designed to be used with `query()` and it will only work
  79. * with animations that are assigned using the Angular animation library. CSS keyframes
  80. * and transitions are not handled by this API.
  81. *
  82. * @publicApi
  83. */
  84. export declare function animateChild(options?: AnimateChildOptions | null): AnimationAnimateChildMetadata;
  85. /**
  86. * Adds duration options to control animation styling and timing for a child animation.
  87. *
  88. * @see `animateChild()`
  89. *
  90. * @publicApi
  91. */
  92. export declare interface AnimateChildOptions extends AnimationOptions {
  93. duration?: number | string;
  94. }
  95. /**
  96. * Represents animation-step timing parameters for an animation step.
  97. * @see `animate()`
  98. *
  99. * @publicApi
  100. */
  101. export declare type AnimateTimings = {
  102. /**
  103. * The full duration of an animation step. A number and optional time unit,
  104. * such as "1s" or "10ms" for one second and 10 milliseconds, respectively.
  105. * The default unit is milliseconds.
  106. */
  107. duration: number;
  108. /**
  109. * The delay in applying an animation step. A number and optional time unit.
  110. * The default unit is milliseconds.
  111. */
  112. delay: number;
  113. /**
  114. * An easing style that controls how an animations step accelerates
  115. * and decelerates during its run time. An easing function such as `cubic-bezier()`,
  116. * or one of the following constants:
  117. * - `ease-in`
  118. * - `ease-out`
  119. * - `ease-in-and-out`
  120. */
  121. easing: string | null;
  122. };
  123. /**
  124. * Produces a reusable animation that can be invoked in another animation or sequence,
  125. * by calling the `useAnimation()` function.
  126. *
  127. * @param steps One or more animation objects, as returned by the `animate()`
  128. * or `sequence()` function, that form a transformation from one state to another.
  129. * A sequence is used by default when you pass an array.
  130. * @param options An options object that can contain a delay value for the start of the
  131. * animation, and additional developer-defined parameters.
  132. * Provided values for additional parameters are used as defaults,
  133. * and override values can be passed to the caller on invocation.
  134. * @returns An object that encapsulates the animation data.
  135. *
  136. * @usageNotes
  137. * The following example defines a reusable animation, providing some default parameter
  138. * values.
  139. *
  140. * ```typescript
  141. * var fadeAnimation = animation([
  142. * style({ opacity: '{{ start }}' }),
  143. * animate('{{ time }}',
  144. * style({ opacity: '{{ end }}'}))
  145. * ],
  146. * { params: { time: '1000ms', start: 0, end: 1 }});
  147. * ```
  148. *
  149. * The following invokes the defined animation with a call to `useAnimation()`,
  150. * passing in override parameter values.
  151. *
  152. * ```js
  153. * useAnimation(fadeAnimation, {
  154. * params: {
  155. * time: '2s',
  156. * start: 1,
  157. * end: 0
  158. * }
  159. * })
  160. * ```
  161. *
  162. * If any of the passed-in parameter values are missing from this call,
  163. * the default values are used. If one or more parameter values are missing before a step is
  164. * animated, `useAnimation()` throws an error.
  165. *
  166. * @publicApi
  167. */
  168. export declare function animation(steps: AnimationMetadata | AnimationMetadata[], options?: AnimationOptions | null): AnimationReferenceMetadata;
  169. /**
  170. * Encapsulates a child animation, that can be run explicitly when the parent is run.
  171. * Instantiated and returned by the `animateChild` function.
  172. *
  173. * @publicApi
  174. */
  175. export declare interface AnimationAnimateChildMetadata extends AnimationMetadata {
  176. /**
  177. * An options object containing a delay and
  178. * developer-defined parameters that provide styling defaults and
  179. * can be overridden on invocation. Default delay is 0.
  180. */
  181. options: AnimationOptions | null;
  182. }
  183. /**
  184. * Encapsulates an animation step. Instantiated and returned by
  185. * the `animate()` function.
  186. *
  187. * @publicApi
  188. */
  189. export declare interface AnimationAnimateMetadata extends AnimationMetadata {
  190. /**
  191. * The timing data for the step.
  192. */
  193. timings: string | number | AnimateTimings;
  194. /**
  195. * A set of styles used in the step.
  196. */
  197. styles: AnimationStyleMetadata | AnimationKeyframesSequenceMetadata | null;
  198. }
  199. /**
  200. * Encapsulates a reusable animation.
  201. * Instantiated and returned by the `useAnimation()` function.
  202. *
  203. * @publicApi
  204. */
  205. export declare interface AnimationAnimateRefMetadata extends AnimationMetadata {
  206. /**
  207. * An animation reference object.
  208. */
  209. animation: AnimationReferenceMetadata;
  210. /**
  211. * An options object containing a delay and
  212. * developer-defined parameters that provide styling defaults and
  213. * can be overridden on invocation. Default delay is 0.
  214. */
  215. options: AnimationOptions | null;
  216. }
  217. /**
  218. * An injectable service that produces an animation sequence programmatically within an
  219. * Angular component or directive.
  220. * Provided by the `BrowserAnimationsModule` or `NoopAnimationsModule`.
  221. *
  222. * @usageNotes
  223. *
  224. * To use this service, add it to your component or directive as a dependency.
  225. * The service is instantiated along with your component.
  226. *
  227. * Apps do not typically need to create their own animation players, but if you
  228. * do need to, follow these steps:
  229. *
  230. * 1. Use the `build()` method to create a programmatic animation using the
  231. * `animate()` function. The method returns an `AnimationFactory` instance.
  232. *
  233. * 2. Use the factory object to create an `AnimationPlayer` and attach it to a DOM element.
  234. *
  235. * 3. Use the player object to control the animation programmatically.
  236. *
  237. * For example:
  238. *
  239. * ```ts
  240. * // import the service from BrowserAnimationsModule
  241. * import {AnimationBuilder} from '@angular/animations';
  242. * // require the service as a dependency
  243. * class MyCmp {
  244. * constructor(private _builder: AnimationBuilder) {}
  245. *
  246. * makeAnimation(element: any) {
  247. * // first define a reusable animation
  248. * const myAnimation = this._builder.build([
  249. * style({ width: 0 }),
  250. * animate(1000, style({ width: '100px' }))
  251. * ]);
  252. *
  253. * // use the returned factory object to create a player
  254. * const player = myAnimation.create(element);
  255. *
  256. * player.play();
  257. * }
  258. * }
  259. * ```
  260. *
  261. * @publicApi
  262. */
  263. export declare abstract class AnimationBuilder {
  264. /**
  265. * Builds a factory for producing a defined animation.
  266. * @param animation A reusable animation definition.
  267. * @returns A factory object that can create a player for the defined animation.
  268. * @see `animate()`
  269. */
  270. abstract build(animation: AnimationMetadata | AnimationMetadata[]): AnimationFactory;
  271. }
  272. /**
  273. * An instance of this class is returned as an event parameter when an animation
  274. * callback is captured for an animation either during the start or done phase.
  275. *
  276. * ```typescript
  277. * @Component({
  278. * host: {
  279. * '[@myAnimationTrigger]': 'someExpression',
  280. * '(@myAnimationTrigger.start)': 'captureStartEvent($event)',
  281. * '(@myAnimationTrigger.done)': 'captureDoneEvent($event)',
  282. * },
  283. * animations: [
  284. * trigger("myAnimationTrigger", [
  285. * // ...
  286. * ])
  287. * ]
  288. * })
  289. * class MyComponent {
  290. * someExpression: any = false;
  291. * captureStartEvent(event: AnimationEvent) {
  292. * // the toState, fromState and totalTime data is accessible from the event variable
  293. * }
  294. *
  295. * captureDoneEvent(event: AnimationEvent) {
  296. * // the toState, fromState and totalTime data is accessible from the event variable
  297. * }
  298. * }
  299. * ```
  300. *
  301. * @publicApi
  302. */
  303. export declare interface AnimationEvent {
  304. /**
  305. * The name of the state from which the animation is triggered.
  306. */
  307. fromState: string;
  308. /**
  309. * The name of the state in which the animation completes.
  310. */
  311. toState: string;
  312. /**
  313. * The time it takes the animation to complete, in milliseconds.
  314. */
  315. totalTime: number;
  316. /**
  317. * The animation phase in which the callback was invoked, one of
  318. * "start" or "done".
  319. */
  320. phaseName: string;
  321. /**
  322. * The element to which the animation is attached.
  323. */
  324. element: any;
  325. /**
  326. * Internal.
  327. */
  328. triggerName: string;
  329. /**
  330. * Internal.
  331. */
  332. disabled: boolean;
  333. }
  334. /**
  335. * A factory object returned from the `AnimationBuilder`.`build()` method.
  336. *
  337. * @publicApi
  338. */
  339. export declare abstract class AnimationFactory {
  340. /**
  341. * Creates an `AnimationPlayer` instance for the reusable animation defined by
  342. * the `AnimationBuilder`.`build()` method that created this factory.
  343. * Attaches the new player a DOM element.
  344. * @param element The DOM element to which to attach the animation.
  345. * @param options A set of options that can include a time delay and
  346. * additional developer-defined parameters.
  347. */
  348. abstract create(element: any, options?: AnimationOptions): AnimationPlayer;
  349. }
  350. /**
  351. * Encapsulates an animation group.
  352. * Instantiated and returned by the `{@link animations/group group()}` function.
  353. *
  354. * @publicApi
  355. */
  356. export declare interface AnimationGroupMetadata extends AnimationMetadata {
  357. /**
  358. * One or more animation or style steps that form this group.
  359. */
  360. steps: AnimationMetadata[];
  361. /**
  362. * An options object containing a delay and
  363. * developer-defined parameters that provide styling defaults and
  364. * can be overridden on invocation. Default delay is 0.
  365. */
  366. options: AnimationOptions | null;
  367. }
  368. /**
  369. * Encapsulates a keyframes sequence. Instantiated and returned by
  370. * the `keyframes()` function.
  371. *
  372. * @publicApi
  373. */
  374. export declare interface AnimationKeyframesSequenceMetadata extends AnimationMetadata {
  375. /**
  376. * An array of animation styles.
  377. */
  378. steps: AnimationStyleMetadata[];
  379. }
  380. /**
  381. * Base for animation data structures.
  382. *
  383. * @publicApi
  384. */
  385. export declare interface AnimationMetadata {
  386. type: AnimationMetadataType;
  387. }
  388. /**
  389. * @description Constants for the categories of parameters that can be defined for animations.
  390. *
  391. * A corresponding function defines a set of parameters for each category, and
  392. * collects them into a corresponding `AnimationMetadata` object.
  393. *
  394. * @publicApi
  395. */
  396. export declare const enum AnimationMetadataType {
  397. /**
  398. * Associates a named animation state with a set of CSS styles.
  399. * See `state()`
  400. */
  401. State = 0,
  402. /**
  403. * Data for a transition from one animation state to another.
  404. * See `transition()`
  405. */
  406. Transition = 1,
  407. /**
  408. * Contains a set of animation steps.
  409. * See `sequence()`
  410. */
  411. Sequence = 2,
  412. /**
  413. * Contains a set of animation steps.
  414. * See `{@link animations/group group()}`
  415. */
  416. Group = 3,
  417. /**
  418. * Contains an animation step.
  419. * See `animate()`
  420. */
  421. Animate = 4,
  422. /**
  423. * Contains a set of animation steps.
  424. * See `keyframes()`
  425. */
  426. Keyframes = 5,
  427. /**
  428. * Contains a set of CSS property-value pairs into a named style.
  429. * See `style()`
  430. */
  431. Style = 6,
  432. /**
  433. * Associates an animation with an entry trigger that can be attached to an element.
  434. * See `trigger()`
  435. */
  436. Trigger = 7,
  437. /**
  438. * Contains a re-usable animation.
  439. * See `animation()`
  440. */
  441. Reference = 8,
  442. /**
  443. * Contains data to use in executing child animations returned by a query.
  444. * See `animateChild()`
  445. */
  446. AnimateChild = 9,
  447. /**
  448. * Contains animation parameters for a re-usable animation.
  449. * See `useAnimation()`
  450. */
  451. AnimateRef = 10,
  452. /**
  453. * Contains child-animation query data.
  454. * See `query()`
  455. */
  456. Query = 11,
  457. /**
  458. * Contains data for staggering an animation sequence.
  459. * See `stagger()`
  460. */
  461. Stagger = 12
  462. }
  463. /**
  464. * @description Options that control animation styling and timing.
  465. *
  466. * The following animation functions accept `AnimationOptions` data:
  467. *
  468. * - `transition()`
  469. * - `sequence()`
  470. * - `{@link animations/group group()}`
  471. * - `query()`
  472. * - `animation()`
  473. * - `useAnimation()`
  474. * - `animateChild()`
  475. *
  476. * Programmatic animations built using the `AnimationBuilder` service also
  477. * make use of `AnimationOptions`.
  478. *
  479. * @publicApi
  480. */
  481. export declare interface AnimationOptions {
  482. /**
  483. * Sets a time-delay for initiating an animation action.
  484. * A number and optional time unit, such as "1s" or "10ms" for one second
  485. * and 10 milliseconds, respectively.The default unit is milliseconds.
  486. * Default value is 0, meaning no delay.
  487. */
  488. delay?: number | string;
  489. /**
  490. * A set of developer-defined parameters that modify styling and timing
  491. * when an animation action starts. An array of key-value pairs, where the provided value
  492. * is used as a default.
  493. */
  494. params?: {
  495. [name: string]: any;
  496. };
  497. }
  498. /**
  499. * Provides programmatic control of a reusable animation sequence,
  500. * built using the `build()` method of `AnimationBuilder`. The `build()` method
  501. * returns a factory, whose `create()` method instantiates and initializes this interface.
  502. *
  503. * @see `AnimationBuilder`
  504. * @see `AnimationFactory`
  505. * @see `animate()`
  506. *
  507. * @publicApi
  508. */
  509. export declare interface AnimationPlayer {
  510. /**
  511. * Provides a callback to invoke when the animation finishes.
  512. * @param fn The callback function.
  513. * @see `finish()`
  514. */
  515. onDone(fn: () => void): void;
  516. /**
  517. * Provides a callback to invoke when the animation starts.
  518. * @param fn The callback function.
  519. * @see `run()`
  520. */
  521. onStart(fn: () => void): void;
  522. /**
  523. * Provides a callback to invoke after the animation is destroyed.
  524. * @param fn The callback function.
  525. * @see `destroy()`
  526. * @see `beforeDestroy()`
  527. */
  528. onDestroy(fn: () => void): void;
  529. /**
  530. * Initializes the animation.
  531. */
  532. init(): void;
  533. /**
  534. * Reports whether the animation has started.
  535. * @returns True if the animation has started, false otherwise.
  536. */
  537. hasStarted(): boolean;
  538. /**
  539. * Runs the animation, invoking the `onStart()` callback.
  540. */
  541. play(): void;
  542. /**
  543. * Pauses the animation.
  544. */
  545. pause(): void;
  546. /**
  547. * Restarts the paused animation.
  548. */
  549. restart(): void;
  550. /**
  551. * Ends the animation, invoking the `onDone()` callback.
  552. */
  553. finish(): void;
  554. /**
  555. * Destroys the animation, after invoking the `beforeDestroy()` callback.
  556. * Calls the `onDestroy()` callback when destruction is completed.
  557. */
  558. destroy(): void;
  559. /**
  560. * Resets the animation to its initial state.
  561. */
  562. reset(): void;
  563. /**
  564. * Sets the position of the animation.
  565. * @param position A 0-based offset into the duration, in milliseconds.
  566. */
  567. setPosition(position: any /** TODO #9100 */): void;
  568. /**
  569. * Reports the current position of the animation.
  570. * @returns A 0-based offset into the duration, in milliseconds.
  571. */
  572. getPosition(): number;
  573. /**
  574. * The parent of this player, if any.
  575. */
  576. parentPlayer: AnimationPlayer | null;
  577. /**
  578. * The total run time of the animation, in milliseconds.
  579. */
  580. readonly totalTime: number;
  581. /**
  582. * Provides a callback to invoke before the animation is destroyed.
  583. */
  584. beforeDestroy?: () => any;
  585. }
  586. /**
  587. * Encapsulates an animation query. Instantiated and returned by
  588. * the `query()` function.
  589. *
  590. * @publicApi
  591. */
  592. export declare interface AnimationQueryMetadata extends AnimationMetadata {
  593. /**
  594. * The CSS selector for this query.
  595. */
  596. selector: string;
  597. /**
  598. * One or more animation step objects.
  599. */
  600. animation: AnimationMetadata | AnimationMetadata[];
  601. /**
  602. * A query options object.
  603. */
  604. options: AnimationQueryOptions | null;
  605. }
  606. /**
  607. * Encapsulates animation query options.
  608. * Passed to the `query()` function.
  609. *
  610. * @publicApi
  611. */
  612. export declare interface AnimationQueryOptions extends AnimationOptions {
  613. /**
  614. * True if this query is optional, false if it is required. Default is false.
  615. * A required query throws an error if no elements are retrieved when
  616. * the query is executed. An optional query does not.
  617. *
  618. */
  619. optional?: boolean;
  620. /**
  621. * A maximum total number of results to return from the query.
  622. * If negative, results are limited from the end of the query list towards the beginning.
  623. * By default, results are not limited.
  624. */
  625. limit?: number;
  626. }
  627. /**
  628. * Encapsulates a reusable animation, which is a collection of individual animation steps.
  629. * Instantiated and returned by the `animation()` function, and
  630. * passed to the `useAnimation()` function.
  631. *
  632. * @publicApi
  633. */
  634. export declare interface AnimationReferenceMetadata extends AnimationMetadata {
  635. /**
  636. * One or more animation step objects.
  637. */
  638. animation: AnimationMetadata | AnimationMetadata[];
  639. /**
  640. * An options object containing a delay and
  641. * developer-defined parameters that provide styling defaults and
  642. * can be overridden on invocation. Default delay is 0.
  643. */
  644. options: AnimationOptions | null;
  645. }
  646. /**
  647. * Encapsulates an animation sequence.
  648. * Instantiated and returned by the `sequence()` function.
  649. *
  650. * @publicApi
  651. */
  652. export declare interface AnimationSequenceMetadata extends AnimationMetadata {
  653. /**
  654. * An array of animation step objects.
  655. */
  656. steps: AnimationMetadata[];
  657. /**
  658. * An options object containing a delay and
  659. * developer-defined parameters that provide styling defaults and
  660. * can be overridden on invocation. Default delay is 0.
  661. */
  662. options: AnimationOptions | null;
  663. }
  664. /**
  665. * Encapsulates parameters for staggering the start times of a set of animation steps.
  666. * Instantiated and returned by the `stagger()` function.
  667. *
  668. * @publicApi
  669. **/
  670. export declare interface AnimationStaggerMetadata extends AnimationMetadata {
  671. /**
  672. * The timing data for the steps.
  673. */
  674. timings: string | number;
  675. /**
  676. * One or more animation steps.
  677. */
  678. animation: AnimationMetadata | AnimationMetadata[];
  679. }
  680. /**
  681. * Encapsulates an animation state by associating a state name with a set of CSS styles.
  682. * Instantiated and returned by the `state()` function.
  683. *
  684. * @publicApi
  685. */
  686. export declare interface AnimationStateMetadata extends AnimationMetadata {
  687. /**
  688. * The state name, unique within the component.
  689. */
  690. name: string;
  691. /**
  692. * The CSS styles associated with this state.
  693. */
  694. styles: AnimationStyleMetadata;
  695. /**
  696. * An options object containing
  697. * developer-defined parameters that provide styling defaults and
  698. * can be overridden on invocation.
  699. */
  700. options?: {
  701. params: {
  702. [name: string]: any;
  703. };
  704. };
  705. }
  706. /**
  707. * Encapsulates an animation style. Instantiated and returned by
  708. * the `style()` function.
  709. *
  710. * @publicApi
  711. */
  712. export declare interface AnimationStyleMetadata extends AnimationMetadata {
  713. /**
  714. * A set of CSS style properties.
  715. */
  716. styles: '*' | {
  717. [key: string]: string | number;
  718. } | Array<{
  719. [key: string]: string | number;
  720. } | '*'>;
  721. /**
  722. * A percentage of the total animate time at which the style is to be applied.
  723. */
  724. offset: number | null;
  725. }
  726. /**
  727. * Encapsulates an animation transition. Instantiated and returned by the
  728. * `transition()` function.
  729. *
  730. * @publicApi
  731. */
  732. export declare interface AnimationTransitionMetadata extends AnimationMetadata {
  733. /**
  734. * An expression that describes a state change.
  735. */
  736. expr: string | ((fromState: string, toState: string, element?: any, params?: {
  737. [key: string]: any;
  738. }) => boolean);
  739. /**
  740. * One or more animation objects to which this transition applies.
  741. */
  742. animation: AnimationMetadata | AnimationMetadata[];
  743. /**
  744. * An options object containing a delay and
  745. * developer-defined parameters that provide styling defaults and
  746. * can be overridden on invocation. Default delay is 0.
  747. */
  748. options: AnimationOptions | null;
  749. }
  750. /**
  751. * Contains an animation trigger. Instantiated and returned by the
  752. * `trigger()` function.
  753. *
  754. * @publicApi
  755. */
  756. export declare interface AnimationTriggerMetadata extends AnimationMetadata {
  757. /**
  758. * The trigger name, used to associate it with an element. Unique within the component.
  759. */
  760. name: string;
  761. /**
  762. * An animation definition object, containing an array of state and transition declarations.
  763. */
  764. definitions: AnimationMetadata[];
  765. /**
  766. * An options object containing a delay and
  767. * developer-defined parameters that provide styling defaults and
  768. * can be overridden on invocation. Default delay is 0.
  769. */
  770. options: {
  771. params?: {
  772. [name: string]: any;
  773. };
  774. } | null;
  775. }
  776. /**
  777. * Specifies automatic styling.
  778. *
  779. * @publicApi
  780. */
  781. export declare const AUTO_STYLE = "*";
  782. /**
  783. * @description Defines a list of animation steps to be run in parallel.
  784. *
  785. * @param steps An array of animation step objects.
  786. * - When steps are defined by `style()` or `animate()`
  787. * function calls, each call within the group is executed instantly.
  788. * - To specify offset styles to be applied at a later time, define steps with
  789. * `keyframes()`, or use `animate()` calls with a delay value.
  790. * For example:
  791. *
  792. * ```typescript
  793. * group([
  794. * animate("1s", style({ background: "black" })),
  795. * animate("2s", style({ color: "white" }))
  796. * ])
  797. * ```
  798. *
  799. * @param options An options object containing a delay and
  800. * developer-defined parameters that provide styling defaults and
  801. * can be overridden on invocation.
  802. *
  803. * @return An object that encapsulates the group data.
  804. *
  805. * @usageNotes
  806. * Grouped animations are useful when a series of styles must be
  807. * animated at different starting times and closed off at different ending times.
  808. *
  809. * When called within a `sequence()` or a
  810. * `transition()` call, does not continue to the next
  811. * instruction until all of the inner animation steps have completed.
  812. *
  813. * @publicApi
  814. */
  815. export declare function group(steps: AnimationMetadata[], options?: AnimationOptions | null): AnimationGroupMetadata;
  816. /**
  817. * Defines a set of animation styles, associating each style with an optional `offset` value.
  818. *
  819. * @param steps A set of animation styles with optional offset data.
  820. * The optional `offset` value for a style specifies a percentage of the total animation
  821. * time at which that style is applied.
  822. * @returns An object that encapsulates the keyframes data.
  823. *
  824. * @usageNotes
  825. * Use with the `animate()` call. Instead of applying animations
  826. * from the current state
  827. * to the destination state, keyframes describe how each style entry is applied and at what point
  828. * within the animation arc.
  829. * Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp).
  830. *
  831. * ### Usage
  832. *
  833. * In the following example, the offset values describe
  834. * when each `backgroundColor` value is applied. The color is red at the start, and changes to
  835. * blue when 20% of the total time has elapsed.
  836. *
  837. * ```typescript
  838. * // the provided offset values
  839. * animate("5s", keyframes([
  840. * style({ backgroundColor: "red", offset: 0 }),
  841. * style({ backgroundColor: "blue", offset: 0.2 }),
  842. * style({ backgroundColor: "orange", offset: 0.3 }),
  843. * style({ backgroundColor: "black", offset: 1 })
  844. * ]))
  845. * ```
  846. *
  847. * If there are no `offset` values specified in the style entries, the offsets
  848. * are calculated automatically.
  849. *
  850. * ```typescript
  851. * animate("5s", keyframes([
  852. * style({ backgroundColor: "red" }) // offset = 0
  853. * style({ backgroundColor: "blue" }) // offset = 0.33
  854. * style({ backgroundColor: "orange" }) // offset = 0.66
  855. * style({ backgroundColor: "black" }) // offset = 1
  856. * ]))
  857. *```
  858. * @publicApi
  859. */
  860. export declare function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSequenceMetadata;
  861. /**
  862. * An empty programmatic controller for reusable animations.
  863. * Used internally when animations are disabled, to avoid
  864. * checking for the null case when an animation player is expected.
  865. *
  866. * @see `animate()`
  867. * @see `AnimationPlayer`
  868. * @see `GroupPlayer`
  869. *
  870. * @publicApi
  871. */
  872. export declare class NoopAnimationPlayer implements AnimationPlayer {
  873. private _onDoneFns;
  874. private _onStartFns;
  875. private _onDestroyFns;
  876. private _started;
  877. private _destroyed;
  878. private _finished;
  879. parentPlayer: AnimationPlayer | null;
  880. readonly totalTime: number;
  881. constructor(duration?: number, delay?: number);
  882. private _onFinish;
  883. onStart(fn: () => void): void;
  884. onDone(fn: () => void): void;
  885. onDestroy(fn: () => void): void;
  886. hasStarted(): boolean;
  887. init(): void;
  888. play(): void;
  889. private _onStart;
  890. pause(): void;
  891. restart(): void;
  892. finish(): void;
  893. destroy(): void;
  894. reset(): void;
  895. setPosition(position: number): void;
  896. getPosition(): number;
  897. }
  898. /**
  899. * Finds one or more inner elements within the current element that is
  900. * being animated within a sequence. Use with `animate()`.
  901. *
  902. * @param selector The element to query, or a set of elements that contain Angular-specific
  903. * characteristics, specified with one or more of the following tokens.
  904. * - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements.
  905. * - `query(":animating")` : Query all currently animating elements.
  906. * - `query("@triggerName")` : Query elements that contain an animation trigger.
  907. * - `query("@*")` : Query all elements that contain an animation triggers.
  908. * - `query(":self")` : Include the current element into the animation sequence.
  909. *
  910. * @param animation One or more animation steps to apply to the queried element or elements.
  911. * An array is treated as an animation sequence.
  912. * @param options An options object. Use the 'limit' field to limit the total number of
  913. * items to collect.
  914. * @return An object that encapsulates the query data.
  915. *
  916. * @usageNotes
  917. * Tokens can be merged into a combined query selector string. For example:
  918. *
  919. * ```typescript
  920. * query(':self, .record:enter, .record:leave, @subTrigger', [...])
  921. * ```
  922. *
  923. * The `query()` function collects multiple elements and works internally by using
  924. * `element.querySelectorAll`. Use the `limit` field of an options object to limit
  925. * the total number of items to be collected. For example:
  926. *
  927. * ```js
  928. * query('div', [
  929. * animate(...),
  930. * animate(...)
  931. * ], { limit: 1 })
  932. * ```
  933. *
  934. * By default, throws an error when zero items are found. Set the
  935. * `optional` flag to ignore this error. For example:
  936. *
  937. * ```js
  938. * query('.some-element-that-may-not-be-there', [
  939. * animate(...),
  940. * animate(...)
  941. * ], { optional: true })
  942. * ```
  943. *
  944. * ### Usage Example
  945. *
  946. * The following example queries for inner elements and animates them
  947. * individually using `animate()`.
  948. *
  949. * ```typescript
  950. * @Component({
  951. * selector: 'inner',
  952. * template: `
  953. * <div [@queryAnimation]="exp">
  954. * <h1>Title</h1>
  955. * <div class="content">
  956. * Blah blah blah
  957. * </div>
  958. * </div>
  959. * `,
  960. * animations: [
  961. * trigger('queryAnimation', [
  962. * transition('* => goAnimate', [
  963. * // hide the inner elements
  964. * query('h1', style({ opacity: 0 })),
  965. * query('.content', style({ opacity: 0 })),
  966. *
  967. * // animate the inner elements in, one by one
  968. * query('h1', animate(1000, style({ opacity: 1 }))),
  969. * query('.content', animate(1000, style({ opacity: 1 }))),
  970. * ])
  971. * ])
  972. * ]
  973. * })
  974. * class Cmp {
  975. * exp = '';
  976. *
  977. * goAnimate() {
  978. * this.exp = 'goAnimate';
  979. * }
  980. * }
  981. * ```
  982. *
  983. * @publicApi
  984. */
  985. export declare function query(selector: string, animation: AnimationMetadata | AnimationMetadata[], options?: AnimationQueryOptions | null): AnimationQueryMetadata;
  986. /**
  987. * Defines a list of animation steps to be run sequentially, one by one.
  988. *
  989. * @param steps An array of animation step objects.
  990. * - Steps defined by `style()` calls apply the styling data immediately.
  991. * - Steps defined by `animate()` calls apply the styling data over time
  992. * as specified by the timing data.
  993. *
  994. * ```typescript
  995. * sequence([
  996. * style({ opacity: 0 })),
  997. * animate("1s", style({ opacity: 1 }))
  998. * ])
  999. * ```
  1000. *
  1001. * @param options An options object containing a delay and
  1002. * developer-defined parameters that provide styling defaults and
  1003. * can be overridden on invocation.
  1004. *
  1005. * @return An object that encapsulates the sequence data.
  1006. *
  1007. * @usageNotes
  1008. * When you pass an array of steps to a
  1009. * `transition()` call, the steps run sequentially by default.
  1010. * Compare this to the `{@link animations/group group()}` call, which runs animation steps in parallel.
  1011. *
  1012. * When a sequence is used within a `{@link animations/group group()}` or a `transition()` call,
  1013. * execution continues to the next instruction only after each of the inner animation
  1014. * steps have completed.
  1015. *
  1016. * @publicApi
  1017. **/
  1018. export declare function sequence(steps: AnimationMetadata[], options?: AnimationOptions | null): AnimationSequenceMetadata;
  1019. /**
  1020. * Use within an animation `query()` call to issue a timing gap after
  1021. * each queried item is animated.
  1022. *
  1023. * @param timings A delay value.
  1024. * @param animation One ore more animation steps.
  1025. * @returns An object that encapsulates the stagger data.
  1026. *
  1027. * @usageNotes
  1028. * In the following example, a container element wraps a list of items stamped out
  1029. * by an `ngFor`. The container element contains an animation trigger that will later be set
  1030. * to query for each of the inner items.
  1031. *
  1032. * Each time items are added, the opacity fade-in animation runs,
  1033. * and each removed item is faded out.
  1034. * When either of these animations occur, the stagger effect is
  1035. * applied after each item's animation is started.
  1036. *
  1037. * ```html
  1038. * <!-- list.component.html -->
  1039. * <button (click)="toggle()">Show / Hide Items</button>
  1040. * <hr />
  1041. * <div [@listAnimation]="items.length">
  1042. * <div *ngFor="let item of items">
  1043. * {{ item }}
  1044. * </div>
  1045. * </div>
  1046. * ```
  1047. *
  1048. * Here is the component code:
  1049. *
  1050. * ```typescript
  1051. * import {trigger, transition, style, animate, query, stagger} from '@angular/animations';
  1052. * @Component({
  1053. * templateUrl: 'list.component.html',
  1054. * animations: [
  1055. * trigger('listAnimation', [
  1056. * ...
  1057. * ])
  1058. * ]
  1059. * })
  1060. * class ListComponent {
  1061. * items = [];
  1062. *
  1063. * showItems() {
  1064. * this.items = [0,1,2,3,4];
  1065. * }
  1066. *
  1067. * hideItems() {
  1068. * this.items = [];
  1069. * }
  1070. *
  1071. * toggle() {
  1072. * this.items.length ? this.hideItems() : this.showItems();
  1073. * }
  1074. * }
  1075. * ```
  1076. *
  1077. * Here is the animation trigger code:
  1078. *
  1079. * ```typescript
  1080. * trigger('listAnimation', [
  1081. * transition('* => *', [ // each time the binding value changes
  1082. * query(':leave', [
  1083. * stagger(100, [
  1084. * animate('0.5s', style({ opacity: 0 }))
  1085. * ])
  1086. * ]),
  1087. * query(':enter', [
  1088. * style({ opacity: 0 }),
  1089. * stagger(100, [
  1090. * animate('0.5s', style({ opacity: 1 }))
  1091. * ])
  1092. * ])
  1093. * ])
  1094. * ])
  1095. * ```
  1096. *
  1097. * @publicApi
  1098. */
  1099. export declare function stagger(timings: string | number, animation: AnimationMetadata | AnimationMetadata[]): AnimationStaggerMetadata;
  1100. /**
  1101. * Declares an animation state within a trigger attached to an element.
  1102. *
  1103. * @param name One or more names for the defined state in a comma-separated string.
  1104. * The following reserved state names can be supplied to define a style for specific use
  1105. * cases:
  1106. *
  1107. * - `void` You can associate styles with this name to be used when
  1108. * the element is detached from the application. For example, when an `ngIf` evaluates
  1109. * to false, the state of the associated element is void.
  1110. * - `*` (asterisk) Indicates the default state. You can associate styles with this name
  1111. * to be used as the fallback when the state that is being animated is not declared
  1112. * within the trigger.
  1113. *
  1114. * @param styles A set of CSS styles associated with this state, created using the
  1115. * `style()` function.
  1116. * This set of styles persists on the element once the state has been reached.
  1117. * @param options Parameters that can be passed to the state when it is invoked.
  1118. * 0 or more key-value pairs.
  1119. * @return An object that encapsulates the new state data.
  1120. *
  1121. * @usageNotes
  1122. * Use the `trigger()` function to register states to an animation trigger.
  1123. * Use the `transition()` function to animate between states.
  1124. * When a state is active within a component, its associated styles persist on the element,
  1125. * even when the animation ends.
  1126. *
  1127. * @publicApi
  1128. **/
  1129. export declare function state(name: string, styles: AnimationStyleMetadata, options?: {
  1130. params: {
  1131. [name: string]: any;
  1132. };
  1133. }): AnimationStateMetadata;
  1134. /**
  1135. * Declares a key/value object containing CSS properties/styles that
  1136. * can then be used for an animation `state`, within an animation `sequence`,
  1137. * or as styling data for calls to `animate()` and `keyframes()`.
  1138. *
  1139. * @param tokens A set of CSS styles or HTML styles associated with an animation state.
  1140. * The value can be any of the following:
  1141. * - A key-value style pair associating a CSS property with a value.
  1142. * - An array of key-value style pairs.
  1143. * - An asterisk (*), to use auto-styling, where styles are derived from the element
  1144. * being animated and applied to the animation when it starts.
  1145. *
  1146. * Auto-styling can be used to define a state that depends on layout or other
  1147. * environmental factors.
  1148. *
  1149. * @return An object that encapsulates the style data.
  1150. *
  1151. * @usageNotes
  1152. * The following examples create animation styles that collect a set of
  1153. * CSS property values:
  1154. *
  1155. * ```typescript
  1156. * // string values for CSS properties
  1157. * style({ background: "red", color: "blue" })
  1158. *
  1159. * // numerical pixel values
  1160. * style({ width: 100, height: 0 })
  1161. * ```
  1162. *
  1163. * The following example uses auto-styling to allow a component to animate from
  1164. * a height of 0 up to the height of the parent element:
  1165. *
  1166. * ```
  1167. * style({ height: 0 }),
  1168. * animate("1s", style({ height: "*" }))
  1169. * ```
  1170. *
  1171. * @publicApi
  1172. **/
  1173. export declare function style(tokens: '*' | {
  1174. [key: string]: string | number;
  1175. } | Array<'*' | {
  1176. [key: string]: string | number;
  1177. }>): AnimationStyleMetadata;
  1178. /**
  1179. * Declares an animation transition as a sequence of animation steps to run when a given
  1180. * condition is satisfied. The condition is a Boolean expression or function that compares
  1181. * the previous and current animation states, and returns true if this transition should occur.
  1182. * When the state criteria of a defined transition are met, the associated animation is
  1183. * triggered.
  1184. *
  1185. * @param stateChangeExpr A Boolean expression or function that compares the previous and current
  1186. * animation states, and returns true if this transition should occur. Note that "true" and "false"
  1187. * match 1 and 0, respectively. An expression is evaluated each time a state change occurs in the
  1188. * animation trigger element.
  1189. * The animation steps run when the expression evaluates to true.
  1190. *
  1191. * - A state-change string takes the form "state1 => state2", where each side is a defined animation
  1192. * state, or an asterix (*) to refer to a dynamic start or end state.
  1193. * - The expression string can contain multiple comma-separated statements;
  1194. * for example "state1 => state2, state3 => state4".
  1195. * - Special values `:enter` and `:leave` initiate a transition on the entry and exit states,
  1196. * equivalent to "void => *" and "* => void".
  1197. * - Special values `:increment` and `:decrement` initiate a transition when a numeric value has
  1198. * increased or decreased in value.
  1199. * - A function is executed each time a state change occurs in the animation trigger element.
  1200. * The animation steps run when the function returns true.
  1201. *
  1202. * @param steps One or more animation objects, as returned by the `animate()` or
  1203. * `sequence()` function, that form a transformation from one state to another.
  1204. * A sequence is used by default when you pass an array.
  1205. * @param options An options object that can contain a delay value for the start of the animation,
  1206. * and additional developer-defined parameters. Provided values for additional parameters are used
  1207. * as defaults, and override values can be passed to the caller on invocation.
  1208. * @returns An object that encapsulates the transition data.
  1209. *
  1210. * @usageNotes
  1211. * The template associated with a component binds an animation trigger to an element.
  1212. *
  1213. * ```HTML
  1214. * <!-- somewhere inside of my-component-tpl.html -->
  1215. * <div [@myAnimationTrigger]="myStatusExp">...</div>
  1216. * ```
  1217. *
  1218. * All transitions are defined within an animation trigger,
  1219. * along with named states that the transitions change to and from.
  1220. *
  1221. * ```typescript
  1222. * trigger("myAnimationTrigger", [
  1223. * // define states
  1224. * state("on", style({ background: "green" })),
  1225. * state("off", style({ background: "grey" })),
  1226. * ...]
  1227. * ```
  1228. *
  1229. * Note that when you call the `sequence()` function within a `{@link animations/group group()}`
  1230. * or a `transition()` call, execution does not continue to the next instruction
  1231. * until each of the inner animation steps have completed.
  1232. *
  1233. * ### Syntax examples
  1234. *
  1235. * The following examples define transitions between the two defined states (and default states),
  1236. * using various options:
  1237. *
  1238. * ```typescript
  1239. * // Transition occurs when the state value
  1240. * // bound to "myAnimationTrigger" changes from "on" to "off"
  1241. * transition("on => off", animate(500))
  1242. * // Run the same animation for both directions
  1243. * transition("on <=> off", animate(500))
  1244. * // Define multiple state-change pairs separated by commas
  1245. * transition("on => off, off => void", animate(500))
  1246. * ```
  1247. *
  1248. * ### Special values for state-change expressions
  1249. *
  1250. * - Catch-all state change for when an element is inserted into the page and the
  1251. * destination state is unknown:
  1252. *
  1253. * ```typescript
  1254. * transition("void => *", [
  1255. * style({ opacity: 0 }),
  1256. * animate(500)
  1257. * ])
  1258. * ```
  1259. *
  1260. * - Capture a state change between any states:
  1261. *
  1262. * `transition("* => *", animate("1s 0s"))`
  1263. *
  1264. * - Entry and exit transitions:
  1265. *
  1266. * ```typescript
  1267. * transition(":enter", [
  1268. * style({ opacity: 0 }),
  1269. * animate(500, style({ opacity: 1 }))
  1270. * ]),
  1271. * transition(":leave", [
  1272. * animate(500, style({ opacity: 0 }))
  1273. * ])
  1274. * ```
  1275. *
  1276. * - Use `:increment` and `:decrement` to initiate transitions:
  1277. *
  1278. * ```typescript
  1279. * transition(":increment", group([
  1280. * query(':enter', [
  1281. * style({ left: '100%' }),
  1282. * animate('0.5s ease-out', style('*'))
  1283. * ]),
  1284. * query(':leave', [
  1285. * animate('0.5s ease-out', style({ left: '-100%' }))
  1286. * ])
  1287. * ]))
  1288. *
  1289. * transition(":decrement", group([
  1290. * query(':enter', [
  1291. * style({ left: '100%' }),
  1292. * animate('0.5s ease-out', style('*'))
  1293. * ]),
  1294. * query(':leave', [
  1295. * animate('0.5s ease-out', style({ left: '-100%' }))
  1296. * ])
  1297. * ]))
  1298. * ```
  1299. *
  1300. * ### State-change functions
  1301. *
  1302. * Here is an example of a `fromState` specified as a state-change function that invokes an
  1303. * animation when true:
  1304. *
  1305. * ```typescript
  1306. * transition((fromState, toState) =>
  1307. * {
  1308. * return fromState == "off" && toState == "on";
  1309. * },
  1310. * animate("1s 0s"))
  1311. * ```
  1312. *
  1313. * ### Animating to the final state
  1314. *
  1315. * If the final step in a transition is a call to `animate()` that uses a timing value
  1316. * with no style data, that step is automatically considered the final animation arc,
  1317. * for the element to reach the final state. Angular automatically adds or removes
  1318. * CSS styles to ensure that the element is in the correct final state.
  1319. *
  1320. * The following example defines a transition that starts by hiding the element,
  1321. * then makes sure that it animates properly to whatever state is currently active for trigger:
  1322. *
  1323. * ```typescript
  1324. * transition("void => *", [
  1325. * style({ opacity: 0 }),
  1326. * animate(500)
  1327. * ])
  1328. * ```
  1329. * ### Boolean value matching
  1330. * If a trigger binding value is a Boolean, it can be matched using a transition expression
  1331. * that compares true and false or 1 and 0. For example:
  1332. *
  1333. * ```
  1334. * // in the template
  1335. * <div [@openClose]="open ? true : false">...</div>
  1336. * // in the component metadata
  1337. * trigger('openClose', [
  1338. * state('true', style({ height: '*' })),
  1339. * state('false', style({ height: '0px' })),
  1340. * transition('false <=> true', animate(500))
  1341. * ])
  1342. * ```
  1343. *
  1344. * @publicApi
  1345. **/
  1346. export declare function transition(stateChangeExpr: string | ((fromState: string, toState: string, element?: any, params?: {
  1347. [key: string]: any;
  1348. }) => boolean), steps: AnimationMetadata | AnimationMetadata[], options?: AnimationOptions | null): AnimationTransitionMetadata;
  1349. /**
  1350. * Creates a named animation trigger, containing a list of `state()`
  1351. * and `transition()` entries to be evaluated when the expression
  1352. * bound to the trigger changes.
  1353. *
  1354. * @param name An identifying string.
  1355. * @param definitions An animation definition object, containing an array of `state()`
  1356. * and `transition()` declarations.
  1357. *
  1358. * @return An object that encapsulates the trigger data.
  1359. *
  1360. * @usageNotes
  1361. * Define an animation trigger in the `animations` section of `@Component` metadata.
  1362. * In the template, reference the trigger by name and bind it to a trigger expression that
  1363. * evaluates to a defined animation state, using the following format:
  1364. *
  1365. * `[@triggerName]="expression"`
  1366. *
  1367. * Animation trigger bindings convert all values to strings, and then match the
  1368. * previous and current values against any linked transitions.
  1369. * Booleans can be specified as `1` or `true` and `0` or `false`.
  1370. *
  1371. * ### Usage Example
  1372. *
  1373. * The following example creates an animation trigger reference based on the provided
  1374. * name value.
  1375. * The provided animation value is expected to be an array consisting of state and
  1376. * transition declarations.
  1377. *
  1378. * ```typescript
  1379. * @Component({
  1380. * selector: "my-component",
  1381. * templateUrl: "my-component-tpl.html",
  1382. * animations: [
  1383. * trigger("myAnimationTrigger", [
  1384. * state(...),
  1385. * state(...),
  1386. * transition(...),
  1387. * transition(...)
  1388. * ])
  1389. * ]
  1390. * })
  1391. * class MyComponent {
  1392. * myStatusExp = "something";
  1393. * }
  1394. * ```
  1395. *
  1396. * The template associated with this component makes use of the defined trigger
  1397. * by binding to an element within its template code.
  1398. *
  1399. * ```html
  1400. * <!-- somewhere inside of my-component-tpl.html -->
  1401. * <div [@myAnimationTrigger]="myStatusExp">...</div>
  1402. * ```
  1403. *
  1404. * ### Using an inline function
  1405. * The `transition` animation method also supports reading an inline function which can decide
  1406. * if its associated animation should be run.
  1407. *
  1408. * ```typescript
  1409. * // this method is run each time the `myAnimationTrigger` trigger value changes.
  1410. * function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key:
  1411. string]: any}): boolean {
  1412. * // notice that `element` and `params` are also available here
  1413. * return toState == 'yes-please-animate';
  1414. * }
  1415. *
  1416. * @Component({
  1417. * selector: 'my-component',
  1418. * templateUrl: 'my-component-tpl.html',
  1419. * animations: [
  1420. * trigger('myAnimationTrigger', [
  1421. * transition(myInlineMatcherFn, [
  1422. * // the animation sequence code
  1423. * ]),
  1424. * ])
  1425. * ]
  1426. * })
  1427. * class MyComponent {
  1428. * myStatusExp = "yes-please-animate";
  1429. * }
  1430. * ```
  1431. *
  1432. * ### Disabling Animations
  1433. * When true, the special animation control binding `@.disabled` binding prevents
  1434. * all animations from rendering.
  1435. * Place the `@.disabled` binding on an element to disable
  1436. * animations on the element itself, as well as any inner animation triggers
  1437. * within the element.
  1438. *
  1439. * The following example shows how to use this feature:
  1440. *
  1441. * ```typescript
  1442. * @Component({
  1443. * selector: 'my-component',
  1444. * template: `
  1445. * <div [@.disabled]="isDisabled">
  1446. * <div [@childAnimation]="exp"></div>
  1447. * </div>
  1448. * `,
  1449. * animations: [
  1450. * trigger("childAnimation", [
  1451. * // ...
  1452. * ])
  1453. * ]
  1454. * })
  1455. * class MyComponent {
  1456. * isDisabled = true;
  1457. * exp = '...';
  1458. * }
  1459. * ```
  1460. *
  1461. * When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating,
  1462. * along with any inner animations.
  1463. *
  1464. * ### Disable animations application-wide
  1465. * When an area of the template is set to have animations disabled,
  1466. * **all** inner components have their animations disabled as well.
  1467. * This means that you can disable all animations for an app
  1468. * by placing a host binding set on `@.disabled` on the topmost Angular component.
  1469. *
  1470. * ```typescript
  1471. * import {Component, HostBinding} from '@angular/core';
  1472. *
  1473. * @Component({
  1474. * selector: 'app-component',
  1475. * templateUrl: 'app.component.html',
  1476. * })
  1477. * class AppComponent {
  1478. * @HostBinding('@.disabled')
  1479. * public animationsDisabled = true;
  1480. * }
  1481. * ```
  1482. *
  1483. * ### Overriding disablement of inner animations
  1484. * Despite inner animations being disabled, a parent animation can `query()`
  1485. * for inner elements located in disabled areas of the template and still animate
  1486. * them if needed. This is also the case for when a sub animation is
  1487. * queried by a parent and then later animated using `animateChild()`.
  1488. *
  1489. * ### Detecting when an animation is disabled
  1490. * If a region of the DOM (or the entire application) has its animations disabled, the animation
  1491. * trigger callbacks still fire, but for zero seconds. When the callback fires, it provides
  1492. * an instance of an `AnimationEvent`. If animations are disabled,
  1493. * the `.disabled` flag on the event is true.
  1494. *
  1495. * @publicApi
  1496. */
  1497. export declare function trigger(name: string, definitions: AnimationMetadata[]): AnimationTriggerMetadata;
  1498. /**
  1499. * Starts a reusable animation that is created using the `animation()` function.
  1500. *
  1501. * @param animation The reusable animation to start.
  1502. * @param options An options object that can contain a delay value for the start of
  1503. * the animation, and additional override values for developer-defined parameters.
  1504. * @return An object that contains the animation parameters.
  1505. *
  1506. * @publicApi
  1507. */
  1508. export declare function useAnimation(animation: AnimationReferenceMetadata, options?: AnimationOptions | null): AnimationAnimateRefMetadata;
  1509. /**
  1510. * A programmatic controller for a group of reusable animations.
  1511. * Used internally to control animations.
  1512. *
  1513. * @see `AnimationPlayer`
  1514. * @see `{@link animations/group group()}`
  1515. *
  1516. */
  1517. export declare class ɵAnimationGroupPlayer implements AnimationPlayer {
  1518. private _onDoneFns;
  1519. private _onStartFns;
  1520. private _finished;
  1521. private _started;
  1522. private _destroyed;
  1523. private _onDestroyFns;
  1524. parentPlayer: AnimationPlayer | null;
  1525. totalTime: number;
  1526. readonly players: AnimationPlayer[];
  1527. constructor(_players: AnimationPlayer[]);
  1528. private _onFinish;
  1529. init(): void;
  1530. onStart(fn: () => void): void;
  1531. private _onStart;
  1532. onDone(fn: () => void): void;
  1533. onDestroy(fn: () => void): void;
  1534. hasStarted(): boolean;
  1535. play(): void;
  1536. pause(): void;
  1537. restart(): void;
  1538. finish(): void;
  1539. destroy(): void;
  1540. private _onDestroy;
  1541. reset(): void;
  1542. setPosition(p: number): void;
  1543. getPosition(): number;
  1544. beforeDestroy(): void;
  1545. }
  1546. export declare const ɵPRE_STYLE = "!";
  1547. /**
  1548. * Represents a set of CSS styles for use in an animation style.
  1549. */
  1550. export declare interface ɵStyleData {
  1551. [key: string]: string | number;
  1552. }
  1553. export { }