index.d.ts 50 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625
  1. /**
  2. * @license Angular v16.0.4
  3. * (c) 2010-2022 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 <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code> method
  231. * to create a programmatic animation. 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. declare interface AnimationEvent_2 {
  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. export { AnimationEvent_2 as AnimationEvent }
  335. /**
  336. * A factory object returned from the
  337. * <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>
  338. * method.
  339. *
  340. * @publicApi
  341. */
  342. export declare abstract class AnimationFactory {
  343. /**
  344. * Creates an `AnimationPlayer` instance for the reusable animation defined by
  345. * the <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>
  346. * method that created this factory and attaches the new player a DOM element.
  347. *
  348. * @param element The DOM element to which to attach the player.
  349. * @param options A set of options that can include a time delay and
  350. * additional developer-defined parameters.
  351. */
  352. abstract create(element: any, options?: AnimationOptions): AnimationPlayer;
  353. }
  354. /**
  355. * Encapsulates an animation group.
  356. * Instantiated and returned by the `{@link animations/group group()}` function.
  357. *
  358. * @publicApi
  359. */
  360. export declare interface AnimationGroupMetadata extends AnimationMetadata {
  361. /**
  362. * One or more animation or style steps that form this group.
  363. */
  364. steps: AnimationMetadata[];
  365. /**
  366. * An options object containing a delay and
  367. * developer-defined parameters that provide styling defaults and
  368. * can be overridden on invocation. Default delay is 0.
  369. */
  370. options: AnimationOptions | null;
  371. }
  372. /**
  373. * Encapsulates a keyframes sequence. Instantiated and returned by
  374. * the `keyframes()` function.
  375. *
  376. * @publicApi
  377. */
  378. export declare interface AnimationKeyframesSequenceMetadata extends AnimationMetadata {
  379. /**
  380. * An array of animation styles.
  381. */
  382. steps: AnimationStyleMetadata[];
  383. }
  384. /**
  385. * Base for animation data structures.
  386. *
  387. * @publicApi
  388. */
  389. export declare interface AnimationMetadata {
  390. type: AnimationMetadataType;
  391. }
  392. /**
  393. * @description Constants for the categories of parameters that can be defined for animations.
  394. *
  395. * A corresponding function defines a set of parameters for each category, and
  396. * collects them into a corresponding `AnimationMetadata` object.
  397. *
  398. * @publicApi
  399. */
  400. export declare const enum AnimationMetadataType {
  401. /**
  402. * Associates a named animation state with a set of CSS styles.
  403. * See [`state()`](api/animations/state)
  404. */
  405. State = 0,
  406. /**
  407. * Data for a transition from one animation state to another.
  408. * See `transition()`
  409. */
  410. Transition = 1,
  411. /**
  412. * Contains a set of animation steps.
  413. * See `sequence()`
  414. */
  415. Sequence = 2,
  416. /**
  417. * Contains a set of animation steps.
  418. * See `{@link animations/group group()}`
  419. */
  420. Group = 3,
  421. /**
  422. * Contains an animation step.
  423. * See `animate()`
  424. */
  425. Animate = 4,
  426. /**
  427. * Contains a set of animation steps.
  428. * See `keyframes()`
  429. */
  430. Keyframes = 5,
  431. /**
  432. * Contains a set of CSS property-value pairs into a named style.
  433. * See `style()`
  434. */
  435. Style = 6,
  436. /**
  437. * Associates an animation with an entry trigger that can be attached to an element.
  438. * See `trigger()`
  439. */
  440. Trigger = 7,
  441. /**
  442. * Contains a re-usable animation.
  443. * See `animation()`
  444. */
  445. Reference = 8,
  446. /**
  447. * Contains data to use in executing child animations returned by a query.
  448. * See `animateChild()`
  449. */
  450. AnimateChild = 9,
  451. /**
  452. * Contains animation parameters for a re-usable animation.
  453. * See `useAnimation()`
  454. */
  455. AnimateRef = 10,
  456. /**
  457. * Contains child-animation query data.
  458. * See `query()`
  459. */
  460. Query = 11,
  461. /**
  462. * Contains data for staggering an animation sequence.
  463. * See `stagger()`
  464. */
  465. Stagger = 12
  466. }
  467. /**
  468. * @description Options that control animation styling and timing.
  469. *
  470. * The following animation functions accept `AnimationOptions` data:
  471. *
  472. * - `transition()`
  473. * - `sequence()`
  474. * - `{@link animations/group group()}`
  475. * - `query()`
  476. * - `animation()`
  477. * - `useAnimation()`
  478. * - `animateChild()`
  479. *
  480. * Programmatic animations built using the `AnimationBuilder` service also
  481. * make use of `AnimationOptions`.
  482. *
  483. * @publicApi
  484. */
  485. export declare interface AnimationOptions {
  486. /**
  487. * Sets a time-delay for initiating an animation action.
  488. * A number and optional time unit, such as "1s" or "10ms" for one second
  489. * and 10 milliseconds, respectively.The default unit is milliseconds.
  490. * Default value is 0, meaning no delay.
  491. */
  492. delay?: number | string;
  493. /**
  494. * A set of developer-defined parameters that modify styling and timing
  495. * when an animation action starts. An array of key-value pairs, where the provided value
  496. * is used as a default.
  497. */
  498. params?: {
  499. [name: string]: any;
  500. };
  501. }
  502. /**
  503. * Provides programmatic control of a reusable animation sequence,
  504. * built using the <code>[AnimationBuilder.build](api/animations/AnimationBuilder#build)()</code>
  505. * method which returns an `AnimationFactory`, whose
  506. * <code>[create](api/animations/AnimationFactory#create)()</code> method instantiates and
  507. * initializes this interface.
  508. *
  509. * @see `AnimationBuilder`
  510. * @see `AnimationFactory`
  511. * @see `animate()`
  512. *
  513. * @publicApi
  514. */
  515. export declare interface AnimationPlayer {
  516. /**
  517. * Provides a callback to invoke when the animation finishes.
  518. * @param fn The callback function.
  519. * @see `finish()`
  520. */
  521. onDone(fn: () => void): void;
  522. /**
  523. * Provides a callback to invoke when the animation starts.
  524. * @param fn The callback function.
  525. * @see `run()`
  526. */
  527. onStart(fn: () => void): void;
  528. /**
  529. * Provides a callback to invoke after the animation is destroyed.
  530. * @param fn The callback function.
  531. * @see `destroy()`
  532. * @see `beforeDestroy()`
  533. */
  534. onDestroy(fn: () => void): void;
  535. /**
  536. * Initializes the animation.
  537. */
  538. init(): void;
  539. /**
  540. * Reports whether the animation has started.
  541. * @returns True if the animation has started, false otherwise.
  542. */
  543. hasStarted(): boolean;
  544. /**
  545. * Runs the animation, invoking the `onStart()` callback.
  546. */
  547. play(): void;
  548. /**
  549. * Pauses the animation.
  550. */
  551. pause(): void;
  552. /**
  553. * Restarts the paused animation.
  554. */
  555. restart(): void;
  556. /**
  557. * Ends the animation, invoking the `onDone()` callback.
  558. */
  559. finish(): void;
  560. /**
  561. * Destroys the animation, after invoking the `beforeDestroy()` callback.
  562. * Calls the `onDestroy()` callback when destruction is completed.
  563. */
  564. destroy(): void;
  565. /**
  566. * Resets the animation to its initial state.
  567. */
  568. reset(): void;
  569. /**
  570. * Sets the position of the animation.
  571. * @param position A 0-based offset into the duration, in milliseconds.
  572. */
  573. setPosition(position: number): void;
  574. /**
  575. * Reports the current position of the animation.
  576. * @returns A 0-based offset into the duration, in milliseconds.
  577. */
  578. getPosition(): number;
  579. /**
  580. * The parent of this player, if any.
  581. */
  582. parentPlayer: AnimationPlayer | null;
  583. /**
  584. * The total run time of the animation, in milliseconds.
  585. */
  586. readonly totalTime: number;
  587. /**
  588. * Provides a callback to invoke before the animation is destroyed.
  589. */
  590. beforeDestroy?: () => any;
  591. }
  592. /**
  593. * Encapsulates an animation query. Instantiated and returned by
  594. * the `query()` function.
  595. *
  596. * @publicApi
  597. */
  598. export declare interface AnimationQueryMetadata extends AnimationMetadata {
  599. /**
  600. * The CSS selector for this query.
  601. */
  602. selector: string;
  603. /**
  604. * One or more animation step objects.
  605. */
  606. animation: AnimationMetadata | AnimationMetadata[];
  607. /**
  608. * A query options object.
  609. */
  610. options: AnimationQueryOptions | null;
  611. }
  612. /**
  613. * Encapsulates animation query options.
  614. * Passed to the `query()` function.
  615. *
  616. * @publicApi
  617. */
  618. export declare interface AnimationQueryOptions extends AnimationOptions {
  619. /**
  620. * True if this query is optional, false if it is required. Default is false.
  621. * A required query throws an error if no elements are retrieved when
  622. * the query is executed. An optional query does not.
  623. *
  624. */
  625. optional?: boolean;
  626. /**
  627. * A maximum total number of results to return from the query.
  628. * If negative, results are limited from the end of the query list towards the beginning.
  629. * By default, results are not limited.
  630. */
  631. limit?: number;
  632. }
  633. /**
  634. * Encapsulates a reusable animation, which is a collection of individual animation steps.
  635. * Instantiated and returned by the `animation()` function, and
  636. * passed to the `useAnimation()` function.
  637. *
  638. * @publicApi
  639. */
  640. export declare interface AnimationReferenceMetadata extends AnimationMetadata {
  641. /**
  642. * One or more animation step objects.
  643. */
  644. animation: AnimationMetadata | AnimationMetadata[];
  645. /**
  646. * An options object containing a delay and
  647. * developer-defined parameters that provide styling defaults and
  648. * can be overridden on invocation. Default delay is 0.
  649. */
  650. options: AnimationOptions | null;
  651. }
  652. /**
  653. * Encapsulates an animation sequence.
  654. * Instantiated and returned by the `sequence()` function.
  655. *
  656. * @publicApi
  657. */
  658. export declare interface AnimationSequenceMetadata extends AnimationMetadata {
  659. /**
  660. * An array of animation step objects.
  661. */
  662. steps: AnimationMetadata[];
  663. /**
  664. * An options object containing a delay and
  665. * developer-defined parameters that provide styling defaults and
  666. * can be overridden on invocation. Default delay is 0.
  667. */
  668. options: AnimationOptions | null;
  669. }
  670. /**
  671. * Encapsulates parameters for staggering the start times of a set of animation steps.
  672. * Instantiated and returned by the `stagger()` function.
  673. *
  674. * @publicApi
  675. **/
  676. export declare interface AnimationStaggerMetadata extends AnimationMetadata {
  677. /**
  678. * The timing data for the steps.
  679. */
  680. timings: string | number;
  681. /**
  682. * One or more animation steps.
  683. */
  684. animation: AnimationMetadata | AnimationMetadata[];
  685. }
  686. /**
  687. * Encapsulates an animation state by associating a state name with a set of CSS styles.
  688. * Instantiated and returned by the [`state()`](api/animations/state) function.
  689. *
  690. * @publicApi
  691. */
  692. export declare interface AnimationStateMetadata extends AnimationMetadata {
  693. /**
  694. * The state name, unique within the component.
  695. */
  696. name: string;
  697. /**
  698. * The CSS styles associated with this state.
  699. */
  700. styles: AnimationStyleMetadata;
  701. /**
  702. * An options object containing
  703. * developer-defined parameters that provide styling defaults and
  704. * can be overridden on invocation.
  705. */
  706. options?: {
  707. params: {
  708. [name: string]: any;
  709. };
  710. };
  711. }
  712. /**
  713. * Encapsulates an animation style. Instantiated and returned by
  714. * the `style()` function.
  715. *
  716. * @publicApi
  717. */
  718. export declare interface AnimationStyleMetadata extends AnimationMetadata {
  719. /**
  720. * A set of CSS style properties.
  721. */
  722. styles: '*' | {
  723. [key: string]: string | number;
  724. } | Array<{
  725. [key: string]: string | number;
  726. } | '*'>;
  727. /**
  728. * A percentage of the total animate time at which the style is to be applied.
  729. */
  730. offset: number | null;
  731. }
  732. /**
  733. * Encapsulates an animation transition. Instantiated and returned by the
  734. * `transition()` function.
  735. *
  736. * @publicApi
  737. */
  738. export declare interface AnimationTransitionMetadata extends AnimationMetadata {
  739. /**
  740. * An expression that describes a state change.
  741. */
  742. expr: string | ((fromState: string, toState: string, element?: any, params?: {
  743. [key: string]: any;
  744. }) => boolean);
  745. /**
  746. * One or more animation objects to which this transition applies.
  747. */
  748. animation: AnimationMetadata | AnimationMetadata[];
  749. /**
  750. * An options object containing a delay and
  751. * developer-defined parameters that provide styling defaults and
  752. * can be overridden on invocation. Default delay is 0.
  753. */
  754. options: AnimationOptions | null;
  755. }
  756. /**
  757. * Contains an animation trigger. Instantiated and returned by the
  758. * `trigger()` function.
  759. *
  760. * @publicApi
  761. */
  762. export declare interface AnimationTriggerMetadata extends AnimationMetadata {
  763. /**
  764. * The trigger name, used to associate it with an element. Unique within the component.
  765. */
  766. name: string;
  767. /**
  768. * An animation definition object, containing an array of state and transition declarations.
  769. */
  770. definitions: AnimationMetadata[];
  771. /**
  772. * An options object containing a delay and
  773. * developer-defined parameters that provide styling defaults and
  774. * can be overridden on invocation. Default delay is 0.
  775. */
  776. options: {
  777. params?: {
  778. [name: string]: any;
  779. };
  780. } | null;
  781. }
  782. /**
  783. * Specifies automatic styling.
  784. *
  785. * @publicApi
  786. */
  787. export declare const AUTO_STYLE = "*";
  788. /**
  789. * @description Defines a list of animation steps to be run in parallel.
  790. *
  791. * @param steps An array of animation step objects.
  792. * - When steps are defined by `style()` or `animate()`
  793. * function calls, each call within the group is executed instantly.
  794. * - To specify offset styles to be applied at a later time, define steps with
  795. * `keyframes()`, or use `animate()` calls with a delay value.
  796. * For example:
  797. *
  798. * ```typescript
  799. * group([
  800. * animate("1s", style({ background: "black" })),
  801. * animate("2s", style({ color: "white" }))
  802. * ])
  803. * ```
  804. *
  805. * @param options An options object containing a delay and
  806. * developer-defined parameters that provide styling defaults and
  807. * can be overridden on invocation.
  808. *
  809. * @return An object that encapsulates the group data.
  810. *
  811. * @usageNotes
  812. * Grouped animations are useful when a series of styles must be
  813. * animated at different starting times and closed off at different ending times.
  814. *
  815. * When called within a `sequence()` or a
  816. * `transition()` call, does not continue to the next
  817. * instruction until all of the inner animation steps have completed.
  818. *
  819. * @publicApi
  820. */
  821. export declare function group(steps: AnimationMetadata[], options?: AnimationOptions | null): AnimationGroupMetadata;
  822. /**
  823. * Defines a set of animation styles, associating each style with an optional `offset` value.
  824. *
  825. * @param steps A set of animation styles with optional offset data.
  826. * The optional `offset` value for a style specifies a percentage of the total animation
  827. * time at which that style is applied.
  828. * @returns An object that encapsulates the keyframes data.
  829. *
  830. * @usageNotes
  831. * Use with the `animate()` call. Instead of applying animations
  832. * from the current state
  833. * to the destination state, keyframes describe how each style entry is applied and at what point
  834. * within the animation arc.
  835. * Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp).
  836. *
  837. * ### Usage
  838. *
  839. * In the following example, the offset values describe
  840. * when each `backgroundColor` value is applied. The color is red at the start, and changes to
  841. * blue when 20% of the total time has elapsed.
  842. *
  843. * ```typescript
  844. * // the provided offset values
  845. * animate("5s", keyframes([
  846. * style({ backgroundColor: "red", offset: 0 }),
  847. * style({ backgroundColor: "blue", offset: 0.2 }),
  848. * style({ backgroundColor: "orange", offset: 0.3 }),
  849. * style({ backgroundColor: "black", offset: 1 })
  850. * ]))
  851. * ```
  852. *
  853. * If there are no `offset` values specified in the style entries, the offsets
  854. * are calculated automatically.
  855. *
  856. * ```typescript
  857. * animate("5s", keyframes([
  858. * style({ backgroundColor: "red" }) // offset = 0
  859. * style({ backgroundColor: "blue" }) // offset = 0.33
  860. * style({ backgroundColor: "orange" }) // offset = 0.66
  861. * style({ backgroundColor: "black" }) // offset = 1
  862. * ]))
  863. *```
  864. * @publicApi
  865. */
  866. export declare function keyframes(steps: AnimationStyleMetadata[]): AnimationKeyframesSequenceMetadata;
  867. /**
  868. * An empty programmatic controller for reusable animations.
  869. * Used internally when animations are disabled, to avoid
  870. * checking for the null case when an animation player is expected.
  871. *
  872. * @see `animate()`
  873. * @see `AnimationPlayer`
  874. * @see `GroupPlayer`
  875. *
  876. * @publicApi
  877. */
  878. export declare class NoopAnimationPlayer implements AnimationPlayer {
  879. private _onDoneFns;
  880. private _onStartFns;
  881. private _onDestroyFns;
  882. private _originalOnDoneFns;
  883. private _originalOnStartFns;
  884. private _started;
  885. private _destroyed;
  886. private _finished;
  887. private _position;
  888. parentPlayer: AnimationPlayer | null;
  889. readonly totalTime: number;
  890. constructor(duration?: number, delay?: number);
  891. private _onFinish;
  892. onStart(fn: () => void): void;
  893. onDone(fn: () => void): void;
  894. onDestroy(fn: () => void): void;
  895. hasStarted(): boolean;
  896. init(): void;
  897. play(): void;
  898. private _onStart;
  899. pause(): void;
  900. restart(): void;
  901. finish(): void;
  902. destroy(): void;
  903. reset(): void;
  904. setPosition(position: number): void;
  905. getPosition(): number;
  906. }
  907. /**
  908. * Finds one or more inner elements within the current element that is
  909. * being animated within a sequence. Use with `animate()`.
  910. *
  911. * @param selector The element to query, or a set of elements that contain Angular-specific
  912. * characteristics, specified with one or more of the following tokens.
  913. * - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements (not
  914. * all elements can be queried via these tokens, see
  915. * [Entering and Leaving Elements](#entering-and-leaving-elements))
  916. * - `query(":animating")` : Query all currently animating elements.
  917. * - `query("@triggerName")` : Query elements that contain an animation trigger.
  918. * - `query("@*")` : Query all elements that contain an animation triggers.
  919. * - `query(":self")` : Include the current element into the animation sequence.
  920. *
  921. * @param animation One or more animation steps to apply to the queried element or elements.
  922. * An array is treated as an animation sequence.
  923. * @param options An options object. Use the 'limit' field to limit the total number of
  924. * items to collect.
  925. * @return An object that encapsulates the query data.
  926. *
  927. * @usageNotes
  928. *
  929. * ### Multiple Tokens
  930. *
  931. * Tokens can be merged into a combined query selector string. For example:
  932. *
  933. * ```typescript
  934. * query(':self, .record:enter, .record:leave, @subTrigger', [...])
  935. * ```
  936. *
  937. * The `query()` function collects multiple elements and works internally by using
  938. * `element.querySelectorAll`. Use the `limit` field of an options object to limit
  939. * the total number of items to be collected. For example:
  940. *
  941. * ```js
  942. * query('div', [
  943. * animate(...),
  944. * animate(...)
  945. * ], { limit: 1 })
  946. * ```
  947. *
  948. * By default, throws an error when zero items are found. Set the
  949. * `optional` flag to ignore this error. For example:
  950. *
  951. * ```js
  952. * query('.some-element-that-may-not-be-there', [
  953. * animate(...),
  954. * animate(...)
  955. * ], { optional: true })
  956. * ```
  957. *
  958. * ### Entering and Leaving Elements
  959. *
  960. * Not all elements can be queried via the `:enter` and `:leave` tokens, the only ones
  961. * that can are those that Angular assumes can enter/leave based on their own logic
  962. * (if their insertion/removal is simply a consequence of that of their parent they
  963. * should be queried via a different token in their parent's `:enter`/`:leave` transitions).
  964. *
  965. * The only elements Angular assumes can enter/leave based on their own logic (thus the only
  966. * ones that can be queried via the `:enter` and `:leave` tokens) are:
  967. * - Those inserted dynamically (via `ViewContainerRef`)
  968. * - Those that have a structural directive (which, under the hood, are a subset of the above ones)
  969. *
  970. * <div class="alert is-helpful">
  971. *
  972. * Note that elements will be successfully queried via `:enter`/`:leave` even if their
  973. * insertion/removal is not done manually via `ViewContainerRef`or caused by their structural
  974. * directive (e.g. they enter/exit alongside their parent).
  975. *
  976. * </div>
  977. *
  978. * <div class="alert is-important">
  979. *
  980. * There is an exception to what previously mentioned, besides elements entering/leaving based on
  981. * their own logic, elements with an animation trigger can always be queried via `:leave` when
  982. * their parent is also leaving.
  983. *
  984. * </div>
  985. *
  986. * ### Usage Example
  987. *
  988. * The following example queries for inner elements and animates them
  989. * individually using `animate()`.
  990. *
  991. * ```typescript
  992. * @Component({
  993. * selector: 'inner',
  994. * template: `
  995. * <div [@queryAnimation]="exp">
  996. * <h1>Title</h1>
  997. * <div class="content">
  998. * Blah blah blah
  999. * </div>
  1000. * </div>
  1001. * `,
  1002. * animations: [
  1003. * trigger('queryAnimation', [
  1004. * transition('* => goAnimate', [
  1005. * // hide the inner elements
  1006. * query('h1', style({ opacity: 0 })),
  1007. * query('.content', style({ opacity: 0 })),
  1008. *
  1009. * // animate the inner elements in, one by one
  1010. * query('h1', animate(1000, style({ opacity: 1 }))),
  1011. * query('.content', animate(1000, style({ opacity: 1 }))),
  1012. * ])
  1013. * ])
  1014. * ]
  1015. * })
  1016. * class Cmp {
  1017. * exp = '';
  1018. *
  1019. * goAnimate() {
  1020. * this.exp = 'goAnimate';
  1021. * }
  1022. * }
  1023. * ```
  1024. *
  1025. * @publicApi
  1026. */
  1027. export declare function query(selector: string, animation: AnimationMetadata | AnimationMetadata[], options?: AnimationQueryOptions | null): AnimationQueryMetadata;
  1028. /**
  1029. * Defines a list of animation steps to be run sequentially, one by one.
  1030. *
  1031. * @param steps An array of animation step objects.
  1032. * - Steps defined by `style()` calls apply the styling data immediately.
  1033. * - Steps defined by `animate()` calls apply the styling data over time
  1034. * as specified by the timing data.
  1035. *
  1036. * ```typescript
  1037. * sequence([
  1038. * style({ opacity: 0 }),
  1039. * animate("1s", style({ opacity: 1 }))
  1040. * ])
  1041. * ```
  1042. *
  1043. * @param options An options object containing a delay and
  1044. * developer-defined parameters that provide styling defaults and
  1045. * can be overridden on invocation.
  1046. *
  1047. * @return An object that encapsulates the sequence data.
  1048. *
  1049. * @usageNotes
  1050. * When you pass an array of steps to a
  1051. * `transition()` call, the steps run sequentially by default.
  1052. * Compare this to the `{@link animations/group group()}` call, which runs animation steps in
  1053. *parallel.
  1054. *
  1055. * When a sequence is used within a `{@link animations/group group()}` or a `transition()` call,
  1056. * execution continues to the next instruction only after each of the inner animation
  1057. * steps have completed.
  1058. *
  1059. * @publicApi
  1060. **/
  1061. export declare function sequence(steps: AnimationMetadata[], options?: AnimationOptions | null): AnimationSequenceMetadata;
  1062. /**
  1063. * Use within an animation `query()` call to issue a timing gap after
  1064. * each queried item is animated.
  1065. *
  1066. * @param timings A delay value.
  1067. * @param animation One ore more animation steps.
  1068. * @returns An object that encapsulates the stagger data.
  1069. *
  1070. * @usageNotes
  1071. * In the following example, a container element wraps a list of items stamped out
  1072. * by an `ngFor`. The container element contains an animation trigger that will later be set
  1073. * to query for each of the inner items.
  1074. *
  1075. * Each time items are added, the opacity fade-in animation runs,
  1076. * and each removed item is faded out.
  1077. * When either of these animations occur, the stagger effect is
  1078. * applied after each item's animation is started.
  1079. *
  1080. * ```html
  1081. * <!-- list.component.html -->
  1082. * <button (click)="toggle()">Show / Hide Items</button>
  1083. * <hr />
  1084. * <div [@listAnimation]="items.length">
  1085. * <div *ngFor="let item of items">
  1086. * {{ item }}
  1087. * </div>
  1088. * </div>
  1089. * ```
  1090. *
  1091. * Here is the component code:
  1092. *
  1093. * ```typescript
  1094. * import {trigger, transition, style, animate, query, stagger} from '@angular/animations';
  1095. * @Component({
  1096. * templateUrl: 'list.component.html',
  1097. * animations: [
  1098. * trigger('listAnimation', [
  1099. * ...
  1100. * ])
  1101. * ]
  1102. * })
  1103. * class ListComponent {
  1104. * items = [];
  1105. *
  1106. * showItems() {
  1107. * this.items = [0,1,2,3,4];
  1108. * }
  1109. *
  1110. * hideItems() {
  1111. * this.items = [];
  1112. * }
  1113. *
  1114. * toggle() {
  1115. * this.items.length ? this.hideItems() : this.showItems();
  1116. * }
  1117. * }
  1118. * ```
  1119. *
  1120. * Here is the animation trigger code:
  1121. *
  1122. * ```typescript
  1123. * trigger('listAnimation', [
  1124. * transition('* => *', [ // each time the binding value changes
  1125. * query(':leave', [
  1126. * stagger(100, [
  1127. * animate('0.5s', style({ opacity: 0 }))
  1128. * ])
  1129. * ]),
  1130. * query(':enter', [
  1131. * style({ opacity: 0 }),
  1132. * stagger(100, [
  1133. * animate('0.5s', style({ opacity: 1 }))
  1134. * ])
  1135. * ])
  1136. * ])
  1137. * ])
  1138. * ```
  1139. *
  1140. * @publicApi
  1141. */
  1142. export declare function stagger(timings: string | number, animation: AnimationMetadata | AnimationMetadata[]): AnimationStaggerMetadata;
  1143. /**
  1144. * Declares an animation state within a trigger attached to an element.
  1145. *
  1146. * @param name One or more names for the defined state in a comma-separated string.
  1147. * The following reserved state names can be supplied to define a style for specific use
  1148. * cases:
  1149. *
  1150. * - `void` You can associate styles with this name to be used when
  1151. * the element is detached from the application. For example, when an `ngIf` evaluates
  1152. * to false, the state of the associated element is void.
  1153. * - `*` (asterisk) Indicates the default state. You can associate styles with this name
  1154. * to be used as the fallback when the state that is being animated is not declared
  1155. * within the trigger.
  1156. *
  1157. * @param styles A set of CSS styles associated with this state, created using the
  1158. * `style()` function.
  1159. * This set of styles persists on the element once the state has been reached.
  1160. * @param options Parameters that can be passed to the state when it is invoked.
  1161. * 0 or more key-value pairs.
  1162. * @return An object that encapsulates the new state data.
  1163. *
  1164. * @usageNotes
  1165. * Use the `trigger()` function to register states to an animation trigger.
  1166. * Use the `transition()` function to animate between states.
  1167. * When a state is active within a component, its associated styles persist on the element,
  1168. * even when the animation ends.
  1169. *
  1170. * @publicApi
  1171. **/
  1172. export declare function state(name: string, styles: AnimationStyleMetadata, options?: {
  1173. params: {
  1174. [name: string]: any;
  1175. };
  1176. }): AnimationStateMetadata;
  1177. /**
  1178. * Declares a key/value object containing CSS properties/styles that
  1179. * can then be used for an animation [`state`](api/animations/state), within an animation
  1180. *`sequence`, or as styling data for calls to `animate()` and `keyframes()`.
  1181. *
  1182. * @param tokens A set of CSS styles or HTML styles associated with an animation state.
  1183. * The value can be any of the following:
  1184. * - A key-value style pair associating a CSS property with a value.
  1185. * - An array of key-value style pairs.
  1186. * - An asterisk (*), to use auto-styling, where styles are derived from the element
  1187. * being animated and applied to the animation when it starts.
  1188. *
  1189. * Auto-styling can be used to define a state that depends on layout or other
  1190. * environmental factors.
  1191. *
  1192. * @return An object that encapsulates the style data.
  1193. *
  1194. * @usageNotes
  1195. * The following examples create animation styles that collect a set of
  1196. * CSS property values:
  1197. *
  1198. * ```typescript
  1199. * // string values for CSS properties
  1200. * style({ background: "red", color: "blue" })
  1201. *
  1202. * // numerical pixel values
  1203. * style({ width: 100, height: 0 })
  1204. * ```
  1205. *
  1206. * The following example uses auto-styling to allow an element to animate from
  1207. * a height of 0 up to its full height:
  1208. *
  1209. * ```
  1210. * style({ height: 0 }),
  1211. * animate("1s", style({ height: "*" }))
  1212. * ```
  1213. *
  1214. * @publicApi
  1215. **/
  1216. export declare function style(tokens: '*' | {
  1217. [key: string]: string | number;
  1218. } | Array<'*' | {
  1219. [key: string]: string | number;
  1220. }>): AnimationStyleMetadata;
  1221. /**
  1222. * Declares an animation transition which is played when a certain specified condition is met.
  1223. *
  1224. * @param stateChangeExpr A string with a specific format or a function that specifies when the
  1225. * animation transition should occur (see [State Change Expression](#state-change-expression)).
  1226. *
  1227. * @param steps One or more animation objects that represent the animation's instructions.
  1228. *
  1229. * @param options An options object that can be used to specify a delay for the animation or provide
  1230. * custom parameters for it.
  1231. *
  1232. * @returns An object that encapsulates the transition data.
  1233. *
  1234. * @usageNotes
  1235. *
  1236. * ### State Change Expression
  1237. *
  1238. * The State Change Expression instructs Angular when to run the transition's animations, it can
  1239. *either be
  1240. * - a string with a specific syntax
  1241. * - or a function that compares the previous and current state (value of the expression bound to
  1242. * the element's trigger) and returns `true` if the transition should occur or `false` otherwise
  1243. *
  1244. * The string format can be:
  1245. * - `fromState => toState`, which indicates that the transition's animations should occur then the
  1246. * expression bound to the trigger's element goes from `fromState` to `toState`
  1247. *
  1248. * _Example:_
  1249. * ```typescript
  1250. * transition('open => closed', animate('.5s ease-out', style({ height: 0 }) ))
  1251. * ```
  1252. *
  1253. * - `fromState <=> toState`, which indicates that the transition's animations should occur then
  1254. * the expression bound to the trigger's element goes from `fromState` to `toState` or vice versa
  1255. *
  1256. * _Example:_
  1257. * ```typescript
  1258. * transition('enabled <=> disabled', animate('1s cubic-bezier(0.8,0.3,0,1)'))
  1259. * ```
  1260. *
  1261. * - `:enter`/`:leave`, which indicates that the transition's animations should occur when the
  1262. * element enters or exists the DOM
  1263. *
  1264. * _Example:_
  1265. * ```typescript
  1266. * transition(':enter', [
  1267. * style({ opacity: 0 }),
  1268. * animate('500ms', style({ opacity: 1 }))
  1269. * ])
  1270. * ```
  1271. *
  1272. * - `:increment`/`:decrement`, which indicates that the transition's animations should occur when
  1273. * the numerical expression bound to the trigger's element has increased in value or decreased
  1274. *
  1275. * _Example:_
  1276. * ```typescript
  1277. * transition(':increment', query('@counter', animateChild()))
  1278. * ```
  1279. *
  1280. * - a sequence of any of the above divided by commas, which indicates that transition's animations
  1281. * should occur whenever one of the state change expressions matches
  1282. *
  1283. * _Example:_
  1284. * ```typescript
  1285. * transition(':increment, * => enabled, :enter', animate('1s ease', keyframes([
  1286. * style({ transform: 'scale(1)', offset: 0}),
  1287. * style({ transform: 'scale(1.1)', offset: 0.7}),
  1288. * style({ transform: 'scale(1)', offset: 1})
  1289. * ]))),
  1290. * ```
  1291. *
  1292. * Also note that in such context:
  1293. * - `void` can be used to indicate the absence of the element
  1294. * - asterisks can be used as wildcards that match any state
  1295. * - (as a consequence of the above, `void => *` is equivalent to `:enter` and `* => void` is
  1296. * equivalent to `:leave`)
  1297. * - `true` and `false` also match expression values of `1` and `0` respectively (but do not match
  1298. * _truthy_ and _falsy_ values)
  1299. *
  1300. * <div class="alert is-helpful">
  1301. *
  1302. * Be careful about entering end leaving elements as their transitions present a common
  1303. * pitfall for developers.
  1304. *
  1305. * Note that when an element with a trigger enters the DOM its `:enter` transition always
  1306. * gets executed, but its `:leave` transition will not be executed if the element is removed
  1307. * alongside its parent (as it will be removed "without warning" before its transition has
  1308. * a chance to be executed, the only way that such transition can occur is if the element
  1309. * is exiting the DOM on its own).
  1310. *
  1311. *
  1312. * </div>
  1313. *
  1314. * ### Animating to a Final State
  1315. *
  1316. * If the final step in a transition is a call to `animate()` that uses a timing value
  1317. * with no `style` data, that step is automatically considered the final animation arc,
  1318. * for the element to reach the final state, in such case Angular automatically adds or removes
  1319. * CSS styles to ensure that the element is in the correct final state.
  1320. *
  1321. *
  1322. * ### Usage Examples
  1323. *
  1324. * - Transition animations applied based on
  1325. * the trigger's expression value
  1326. *
  1327. * ```HTML
  1328. * <div [@myAnimationTrigger]="myStatusExp">
  1329. * ...
  1330. * </div>
  1331. * ```
  1332. *
  1333. * ```typescript
  1334. * trigger("myAnimationTrigger", [
  1335. * ..., // states
  1336. * transition("on => off, open => closed", animate(500)),
  1337. * transition("* <=> error", query('.indicator', animateChild()))
  1338. * ])
  1339. * ```
  1340. *
  1341. * - Transition animations applied based on custom logic dependent
  1342. * on the trigger's expression value and provided parameters
  1343. *
  1344. * ```HTML
  1345. * <div [@myAnimationTrigger]="{
  1346. * value: stepName,
  1347. * params: { target: currentTarget }
  1348. * }">
  1349. * ...
  1350. * </div>
  1351. * ```
  1352. *
  1353. * ```typescript
  1354. * trigger("myAnimationTrigger", [
  1355. * ..., // states
  1356. * transition(
  1357. * (fromState, toState, _element, params) =>
  1358. * ['firststep', 'laststep'].includes(fromState.toLowerCase())
  1359. * && toState === params?.['target'],
  1360. * animate('1s')
  1361. * )
  1362. * ])
  1363. * ```
  1364. *
  1365. * @publicApi
  1366. **/
  1367. export declare function transition(stateChangeExpr: string | ((fromState: string, toState: string, element?: any, params?: {
  1368. [key: string]: any;
  1369. }) => boolean), steps: AnimationMetadata | AnimationMetadata[], options?: AnimationOptions | null): AnimationTransitionMetadata;
  1370. /**
  1371. * Creates a named animation trigger, containing a list of [`state()`](api/animations/state)
  1372. * and `transition()` entries to be evaluated when the expression
  1373. * bound to the trigger changes.
  1374. *
  1375. * @param name An identifying string.
  1376. * @param definitions An animation definition object, containing an array of
  1377. * [`state()`](api/animations/state) and `transition()` declarations.
  1378. *
  1379. * @return An object that encapsulates the trigger data.
  1380. *
  1381. * @usageNotes
  1382. * Define an animation trigger in the `animations` section of `@Component` metadata.
  1383. * In the template, reference the trigger by name and bind it to a trigger expression that
  1384. * evaluates to a defined animation state, using the following format:
  1385. *
  1386. * `[@triggerName]="expression"`
  1387. *
  1388. * Animation trigger bindings convert all values to strings, and then match the
  1389. * previous and current values against any linked transitions.
  1390. * Booleans can be specified as `1` or `true` and `0` or `false`.
  1391. *
  1392. * ### Usage Example
  1393. *
  1394. * The following example creates an animation trigger reference based on the provided
  1395. * name value.
  1396. * The provided animation value is expected to be an array consisting of state and
  1397. * transition declarations.
  1398. *
  1399. * ```typescript
  1400. * @Component({
  1401. * selector: "my-component",
  1402. * templateUrl: "my-component-tpl.html",
  1403. * animations: [
  1404. * trigger("myAnimationTrigger", [
  1405. * state(...),
  1406. * state(...),
  1407. * transition(...),
  1408. * transition(...)
  1409. * ])
  1410. * ]
  1411. * })
  1412. * class MyComponent {
  1413. * myStatusExp = "something";
  1414. * }
  1415. * ```
  1416. *
  1417. * The template associated with this component makes use of the defined trigger
  1418. * by binding to an element within its template code.
  1419. *
  1420. * ```html
  1421. * <!-- somewhere inside of my-component-tpl.html -->
  1422. * <div [@myAnimationTrigger]="myStatusExp">...</div>
  1423. * ```
  1424. *
  1425. * ### Using an inline function
  1426. * The `transition` animation method also supports reading an inline function which can decide
  1427. * if its associated animation should be run.
  1428. *
  1429. * ```typescript
  1430. * // this method is run each time the `myAnimationTrigger` trigger value changes.
  1431. * function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key:
  1432. string]: any}): boolean {
  1433. * // notice that `element` and `params` are also available here
  1434. * return toState == 'yes-please-animate';
  1435. * }
  1436. *
  1437. * @Component({
  1438. * selector: 'my-component',
  1439. * templateUrl: 'my-component-tpl.html',
  1440. * animations: [
  1441. * trigger('myAnimationTrigger', [
  1442. * transition(myInlineMatcherFn, [
  1443. * // the animation sequence code
  1444. * ]),
  1445. * ])
  1446. * ]
  1447. * })
  1448. * class MyComponent {
  1449. * myStatusExp = "yes-please-animate";
  1450. * }
  1451. * ```
  1452. *
  1453. * ### Disabling Animations
  1454. * When true, the special animation control binding `@.disabled` binding prevents
  1455. * all animations from rendering.
  1456. * Place the `@.disabled` binding on an element to disable
  1457. * animations on the element itself, as well as any inner animation triggers
  1458. * within the element.
  1459. *
  1460. * The following example shows how to use this feature:
  1461. *
  1462. * ```typescript
  1463. * @Component({
  1464. * selector: 'my-component',
  1465. * template: `
  1466. * <div [@.disabled]="isDisabled">
  1467. * <div [@childAnimation]="exp"></div>
  1468. * </div>
  1469. * `,
  1470. * animations: [
  1471. * trigger("childAnimation", [
  1472. * // ...
  1473. * ])
  1474. * ]
  1475. * })
  1476. * class MyComponent {
  1477. * isDisabled = true;
  1478. * exp = '...';
  1479. * }
  1480. * ```
  1481. *
  1482. * When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating,
  1483. * along with any inner animations.
  1484. *
  1485. * ### Disable animations application-wide
  1486. * When an area of the template is set to have animations disabled,
  1487. * **all** inner components have their animations disabled as well.
  1488. * This means that you can disable all animations for an app
  1489. * by placing a host binding set on `@.disabled` on the topmost Angular component.
  1490. *
  1491. * ```typescript
  1492. * import {Component, HostBinding} from '@angular/core';
  1493. *
  1494. * @Component({
  1495. * selector: 'app-component',
  1496. * templateUrl: 'app.component.html',
  1497. * })
  1498. * class AppComponent {
  1499. * @HostBinding('@.disabled')
  1500. * public animationsDisabled = true;
  1501. * }
  1502. * ```
  1503. *
  1504. * ### Overriding disablement of inner animations
  1505. * Despite inner animations being disabled, a parent animation can `query()`
  1506. * for inner elements located in disabled areas of the template and still animate
  1507. * them if needed. This is also the case for when a sub animation is
  1508. * queried by a parent and then later animated using `animateChild()`.
  1509. *
  1510. * ### Detecting when an animation is disabled
  1511. * If a region of the DOM (or the entire application) has its animations disabled, the animation
  1512. * trigger callbacks still fire, but for zero seconds. When the callback fires, it provides
  1513. * an instance of an `AnimationEvent`. If animations are disabled,
  1514. * the `.disabled` flag on the event is true.
  1515. *
  1516. * @publicApi
  1517. */
  1518. export declare function trigger(name: string, definitions: AnimationMetadata[]): AnimationTriggerMetadata;
  1519. /**
  1520. * Starts a reusable animation that is created using the `animation()` function.
  1521. *
  1522. * @param animation The reusable animation to start.
  1523. * @param options An options object that can contain a delay value for the start of
  1524. * the animation, and additional override values for developer-defined parameters.
  1525. * @return An object that contains the animation parameters.
  1526. *
  1527. * @publicApi
  1528. */
  1529. export declare function useAnimation(animation: AnimationReferenceMetadata, options?: AnimationOptions | null): AnimationAnimateRefMetadata;
  1530. /**
  1531. * A programmatic controller for a group of reusable animations.
  1532. * Used internally to control animations.
  1533. *
  1534. * @see `AnimationPlayer`
  1535. * @see `{@link animations/group group()}`
  1536. *
  1537. */
  1538. export declare class ɵAnimationGroupPlayer implements AnimationPlayer {
  1539. private _onDoneFns;
  1540. private _onStartFns;
  1541. private _finished;
  1542. private _started;
  1543. private _destroyed;
  1544. private _onDestroyFns;
  1545. parentPlayer: AnimationPlayer | null;
  1546. totalTime: number;
  1547. readonly players: AnimationPlayer[];
  1548. constructor(_players: AnimationPlayer[]);
  1549. private _onFinish;
  1550. init(): void;
  1551. onStart(fn: () => void): void;
  1552. private _onStart;
  1553. onDone(fn: () => void): void;
  1554. onDestroy(fn: () => void): void;
  1555. hasStarted(): boolean;
  1556. play(): void;
  1557. pause(): void;
  1558. restart(): void;
  1559. finish(): void;
  1560. destroy(): void;
  1561. private _onDestroy;
  1562. reset(): void;
  1563. setPosition(p: number): void;
  1564. getPosition(): number;
  1565. beforeDestroy(): void;
  1566. }
  1567. export declare const ɵPRE_STYLE = "!";
  1568. /**
  1569. * Represents a set of CSS styles for use in an animation style as a generic.
  1570. */
  1571. export declare interface ɵStyleData {
  1572. [key: string]: string | number;
  1573. }
  1574. /**
  1575. * Represents a set of CSS styles for use in an animation style as a Map.
  1576. */
  1577. export declare type ɵStyleDataMap = Map<string, string | number>;
  1578. export { }