1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645
  1. /**
  2. * @license Angular v5.2.11
  3. * (c) 2010-2018 Google, Inc. https://angular.io/
  4. * License: MIT
  5. */
  6. /**
  7. * @fileoverview added by tsickle
  8. * @suppress {checkTypes} checked by tsc
  9. */
  10. /**
  11. * AnimationBuilder is an injectable service that is available when the {\@link
  12. * BrowserAnimationsModule BrowserAnimationsModule} or {\@link NoopAnimationsModule
  13. * NoopAnimationsModule} modules are used within an application.
  14. *
  15. * The purpose if this service is to produce an animation sequence programmatically within an
  16. * angular component or directive.
  17. *
  18. * Programmatic animations are first built and then a player is created when the build animation is
  19. * attached to an element.
  20. *
  21. * ```ts
  22. * // remember to include the BrowserAnimationsModule module for this to work...
  23. * import {AnimationBuilder} from '\@angular/animations';
  24. *
  25. * class MyCmp {
  26. * constructor(private _builder: AnimationBuilder) {}
  27. *
  28. * makeAnimation(element: any) {
  29. * // first build the animation
  30. * const myAnimation = this._builder.build([
  31. * style({ width: 0 }),
  32. * animate(1000, style({ width: '100px' }))
  33. * ]);
  34. *
  35. * // then create a player from it
  36. * const player = myAnimation.create(element);
  37. *
  38. * player.play();
  39. * }
  40. * }
  41. * ```
  42. *
  43. * When an animation is built an instance of {\@link AnimationFactory AnimationFactory} will be
  44. * returned. Using that an {\@link AnimationPlayer AnimationPlayer} can be created which can then be
  45. * used to start the animation.
  46. *
  47. * \@experimental Animation support is experimental.
  48. * @abstract
  49. */
  50. var AnimationBuilder = /** @class */ (function () {
  51. function AnimationBuilder() {
  52. }
  53. return AnimationBuilder;
  54. }());
  55. /**
  56. * An instance of `AnimationFactory` is returned from {\@link AnimationBuilder#build
  57. * AnimationBuilder.build}.
  58. *
  59. * \@experimental Animation support is experimental.
  60. * @abstract
  61. */
  62. var AnimationFactory = /** @class */ (function () {
  63. function AnimationFactory() {
  64. }
  65. return AnimationFactory;
  66. }());
  67. /**
  68. * @fileoverview added by tsickle
  69. * @suppress {checkTypes} checked by tsc
  70. */
  71. /**
  72. * @license
  73. * Copyright Google Inc. All Rights Reserved.
  74. *
  75. * Use of this source code is governed by an MIT-style license that can be
  76. * found in the LICENSE file at https://angular.io/license
  77. * @record
  78. */
  79. /**
  80. * \@experimental Animation support is experimental.
  81. */
  82. var AUTO_STYLE = '*';
  83. /**
  84. * \@experimental Animation support is experimental.
  85. * @record
  86. */
  87. /**
  88. * Metadata representing the entry of animations. Instances of this interface are provided via the
  89. * animation DSL when the {\@link trigger trigger animation function} is called.
  90. *
  91. * \@experimental Animation support is experimental.
  92. * @record
  93. */
  94. /**
  95. * Metadata representing the entry of animations. Instances of this interface are provided via the
  96. * animation DSL when the {\@link state state animation function} is called.
  97. *
  98. * \@experimental Animation support is experimental.
  99. * @record
  100. */
  101. /**
  102. * Metadata representing the entry of animations. Instances of this interface are provided via the
  103. * animation DSL when the {\@link transition transition animation function} is called.
  104. *
  105. * \@experimental Animation support is experimental.
  106. * @record
  107. */
  108. /**
  109. * \@experimental Animation support is experimental.
  110. * @record
  111. */
  112. /**
  113. * \@experimental Animation support is experimental.
  114. * @record
  115. */
  116. /**
  117. * Metadata representing the entry of animations. Instances of this interface are provided via the
  118. * animation DSL when the {\@link keyframes keyframes animation function} is called.
  119. *
  120. * \@experimental Animation support is experimental.
  121. * @record
  122. */
  123. /**
  124. * Metadata representing the entry of animations. Instances of this interface are provided via the
  125. * animation DSL when the {\@link style style animation function} is called.
  126. *
  127. * \@experimental Animation support is experimental.
  128. * @record
  129. */
  130. /**
  131. * Metadata representing the entry of animations. Instances of this interface are provided via the
  132. * animation DSL when the {\@link animate animate animation function} is called.
  133. *
  134. * \@experimental Animation support is experimental.
  135. * @record
  136. */
  137. /**
  138. * Metadata representing the entry of animations. Instances of this interface are provided via the
  139. * animation DSL when the {\@link animateChild animateChild animation function} is called.
  140. *
  141. * \@experimental Animation support is experimental.
  142. * @record
  143. */
  144. /**
  145. * Metadata representing the entry of animations. Instances of this interface are provided via the
  146. * animation DSL when the {\@link useAnimation useAnimation animation function} is called.
  147. *
  148. * \@experimental Animation support is experimental.
  149. * @record
  150. */
  151. /**
  152. * Metadata representing the entry of animations. Instances of this interface are provided via the
  153. * animation DSL when the {\@link sequence sequence animation function} is called.
  154. *
  155. * \@experimental Animation support is experimental.
  156. * @record
  157. */
  158. /**
  159. * Metadata representing the entry of animations. Instances of this interface are provided via the
  160. * animation DSL when the {\@link group group animation function} is called.
  161. *
  162. * \@experimental Animation support is experimental.
  163. * @record
  164. */
  165. /**
  166. * Metadata representing the entry of animations. Instances of this interface are provided via the
  167. * animation DSL when the {\@link stagger stagger animation function} is called.
  168. *
  169. * \@experimental Animation support is experimental.
  170. * @record
  171. */
  172. /**
  173. * `trigger` is an animation-specific function that is designed to be used inside of Angular's
  174. * animation DSL language. If this information is new, please navigate to the
  175. * {\@link Component#animations component animations metadata page} to gain a better
  176. * understanding of how animations in Angular are used.
  177. *
  178. * `trigger` Creates an animation trigger which will a list of {\@link state state} and
  179. * {\@link transition transition} entries that will be evaluated when the expression
  180. * bound to the trigger changes.
  181. *
  182. * Triggers are registered within the component annotation data under the
  183. * {\@link Component#animations animations section}. An animation trigger can be placed on an element
  184. * within a template by referencing the name of the trigger followed by the expression value that
  185. * the
  186. * trigger is bound to (in the form of `[\@triggerName]="expression"`.
  187. *
  188. * Animation trigger bindings strigify values and then match the previous and current values against
  189. * any linked transitions. If a boolean value is provided into the trigger binding then it will both
  190. * be represented as `1` or `true` and `0` or `false` for a true and false boolean values
  191. * respectively.
  192. *
  193. * ### Usage
  194. *
  195. * `trigger` will create an animation trigger reference based on the provided `name` value. The
  196. * provided `animation` value is expected to be an array consisting of {\@link state state} and
  197. * {\@link transition transition} declarations.
  198. *
  199. * ```typescript
  200. * \@Component({
  201. * selector: 'my-component',
  202. * templateUrl: 'my-component-tpl.html',
  203. * animations: [
  204. * trigger("myAnimationTrigger", [
  205. * state(...),
  206. * state(...),
  207. * transition(...),
  208. * transition(...)
  209. * ])
  210. * ]
  211. * })
  212. * class MyComponent {
  213. * myStatusExp = "something";
  214. * }
  215. * ```
  216. *
  217. * The template associated with this component will make use of the `myAnimationTrigger` animation
  218. * trigger by binding to an element within its template code.
  219. *
  220. * ```html
  221. * <!-- somewhere inside of my-component-tpl.html -->
  222. * <div [\@myAnimationTrigger]="myStatusExp">...</div>
  223. * ```
  224. *
  225. * ## Disable Animations
  226. * A special animation control binding called `\@.disabled` can be placed on an element which will
  227. * then disable animations for any inner animation triggers situated within the element as well as
  228. * any animations on the element itself.
  229. *
  230. * When true, the `\@.disabled` binding will prevent all animations from rendering. The example
  231. * below shows how to use this feature:
  232. *
  233. * ```ts
  234. * \@Component({
  235. * selector: 'my-component',
  236. * template: `
  237. * <div [\@.disabled]="isDisabled">
  238. * <div [\@childAnimation]="exp"></div>
  239. * </div>
  240. * `,
  241. * animations: [
  242. * trigger("childAnimation", [
  243. * // ...
  244. * ])
  245. * ]
  246. * })
  247. * class MyComponent {
  248. * isDisabled = true;
  249. * exp = '...';
  250. * }
  251. * ```
  252. *
  253. * The `\@childAnimation` trigger will not animate because `\@.disabled` prevents it from happening
  254. * (when true).
  255. *
  256. * Note that `\@.disabled` will only disable all animations (this means any animations running on
  257. * the same element will also be disabled).
  258. *
  259. * ### Disabling Animations Application-wide
  260. * When an area of the template is set to have animations disabled, **all** inner components will
  261. * also have their animations disabled as well. This means that all animations for an angular
  262. * application can be disabled by placing a host binding set on `\@.disabled` on the topmost Angular
  263. * component.
  264. *
  265. * ```ts
  266. * import {Component, HostBinding} from '\@angular/core';
  267. *
  268. * \@Component({
  269. * selector: 'app-component',
  270. * templateUrl: 'app.component.html',
  271. * })
  272. * class AppComponent {
  273. * \@HostBinding('\@.disabled')
  274. * public animationsDisabled = true;
  275. * }
  276. * ```
  277. *
  278. * ### What about animations that us `query()` and `animateChild()`?
  279. * Despite inner animations being disabled, a parent animation can {\@link query query} for inner
  280. * elements located in disabled areas of the template and still animate them as it sees fit. This is
  281. * also the case for when a sub animation is queried by a parent and then later animated using {\@link
  282. * animateChild animateChild}.
  283. *
  284. * \@experimental Animation support is experimental.
  285. * @param {?} name
  286. * @param {?} definitions
  287. * @return {?}
  288. */
  289. function trigger(name, definitions) {
  290. return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} };
  291. }
  292. /**
  293. * `animate` is an animation-specific function that is designed to be used inside of Angular's
  294. * animation DSL language. If this information is new, please navigate to the {\@link
  295. * Component#animations component animations metadata page} to gain a better understanding of
  296. * how animations in Angular are used.
  297. *
  298. * `animate` specifies an animation step that will apply the provided `styles` data for a given
  299. * amount of time based on the provided `timing` expression value. Calls to `animate` are expected
  300. * to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link
  301. * transition transition}.
  302. *
  303. * ### Usage
  304. *
  305. * The `animate` function accepts two input parameters: `timing` and `styles`:
  306. *
  307. * - `timing` is a string based value that can be a combination of a duration with optional delay
  308. * and easing values. The format for the expression breaks down to `duration delay easing`
  309. * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
  310. * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the
  311. * `duration` value in millisecond form.
  312. * - `styles` is the style input data which can either be a call to {\@link style style} or {\@link
  313. * keyframes keyframes}. If left empty then the styles from the destination state will be collected
  314. * and used (this is useful when describing an animation step that will complete an animation by
  315. * {\@link transition#the-final-animate-call animating to the final state}).
  316. *
  317. * ```typescript
  318. * // various functions for specifying timing data
  319. * animate(500, style(...))
  320. * animate("1s", style(...))
  321. * animate("100ms 0.5s", style(...))
  322. * animate("5s ease", style(...))
  323. * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
  324. *
  325. * // either style() of keyframes() can be used
  326. * animate(500, style({ background: "red" }))
  327. * animate(500, keyframes([
  328. * style({ background: "blue" })),
  329. * style({ background: "red" }))
  330. * ])
  331. * ```
  332. *
  333. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  334. *
  335. * \@experimental Animation support is experimental.
  336. * @param {?} timings
  337. * @param {?=} styles
  338. * @return {?}
  339. */
  340. function animate(timings, styles) {
  341. if (styles === void 0) { styles = null; }
  342. return { type: 4 /* Animate */, styles: styles, timings: timings };
  343. }
  344. /**
  345. * `group` is an animation-specific function that is designed to be used inside of Angular's
  346. * animation DSL language. If this information is new, please navigate to the {\@link
  347. * Component#animations component animations metadata page} to gain a better understanding of
  348. * how animations in Angular are used.
  349. *
  350. * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are
  351. * useful when a series of styles must be animated/closed off at different starting/ending times.
  352. *
  353. * The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition
  354. * transition} and it will only continue to the next instruction once all of the inner animation
  355. * steps have completed.
  356. *
  357. * ### Usage
  358. *
  359. * The `steps` data that is passed into the `group` animation function can either consist of {\@link
  360. * style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()`
  361. * within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link
  362. * animate#usage animate() with a delay value} to offset styles to be applied at a later time).
  363. *
  364. * ```typescript
  365. * group([
  366. * animate("1s", { background: "black" }))
  367. * animate("2s", { color: "white" }))
  368. * ])
  369. * ```
  370. *
  371. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  372. *
  373. * \@experimental Animation support is experimental.
  374. * @param {?} steps
  375. * @param {?=} options
  376. * @return {?}
  377. */
  378. function group(steps, options) {
  379. if (options === void 0) { options = null; }
  380. return { type: 3 /* Group */, steps: steps, options: options };
  381. }
  382. /**
  383. * `sequence` is an animation-specific function that is designed to be used inside of Angular's
  384. * animation DSL language. If this information is new, please navigate to the {\@link
  385. * Component#animations component animations metadata page} to gain a better understanding of
  386. * how animations in Angular are used.
  387. *
  388. * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by
  389. * default when an array is passed as animation data into {\@link transition transition}.)
  390. *
  391. * The `sequence` function can either be used within a {\@link group group} or a {\@link transition
  392. * transition} and it will only continue to the next instruction once each of the inner animation
  393. * steps have completed.
  394. *
  395. * To perform animation styling in parallel with other animation steps then have a look at the
  396. * {\@link group group} animation function.
  397. *
  398. * ### Usage
  399. *
  400. * The `steps` data that is passed into the `sequence` animation function can either consist of
  401. * {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the
  402. * provided styling data immediately while a call to `animate()` will apply its styling data over a
  403. * given time depending on its timing data.
  404. *
  405. * ```typescript
  406. * sequence([
  407. * style({ opacity: 0 })),
  408. * animate("1s", { opacity: 1 }))
  409. * ])
  410. * ```
  411. *
  412. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  413. *
  414. * \@experimental Animation support is experimental.
  415. * @param {?} steps
  416. * @param {?=} options
  417. * @return {?}
  418. */
  419. function sequence(steps, options) {
  420. if (options === void 0) { options = null; }
  421. return { type: 2 /* Sequence */, steps: steps, options: options };
  422. }
  423. /**
  424. * `style` is an animation-specific function that is designed to be used inside of Angular's
  425. * animation DSL language. If this information is new, please navigate to the {\@link
  426. * Component#animations component animations metadata page} to gain a better understanding of
  427. * how animations in Angular are used.
  428. *
  429. * `style` declares a key/value object containing CSS properties/styles that can then be used for
  430. * {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data
  431. * for both {\@link animate animate} and {\@link keyframes keyframes}.
  432. *
  433. * ### Usage
  434. *
  435. * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs
  436. * to be defined.
  437. *
  438. * ```typescript
  439. * // string values are used for css properties
  440. * style({ background: "red", color: "blue" })
  441. *
  442. * // numerical (pixel) values are also supported
  443. * style({ width: 100, height: 0 })
  444. * ```
  445. *
  446. * #### Auto-styles (using `*`)
  447. *
  448. * When an asterix (`*`) character is used as a value then it will be detected from the element
  449. * being animated and applied as animation data when the animation starts.
  450. *
  451. * This feature proves useful for a state depending on layout and/or environment factors; in such
  452. * cases the styles are calculated just before the animation starts.
  453. *
  454. * ```typescript
  455. * // the steps below will animate from 0 to the
  456. * // actual height of the element
  457. * style({ height: 0 }),
  458. * animate("1s", style({ height: "*" }))
  459. * ```
  460. *
  461. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  462. *
  463. * \@experimental Animation support is experimental.
  464. * @param {?} tokens
  465. * @return {?}
  466. */
  467. function style(tokens) {
  468. return { type: 6 /* Style */, styles: tokens, offset: null };
  469. }
  470. /**
  471. * `state` is an animation-specific function that is designed to be used inside of Angular's
  472. * animation DSL language. If this information is new, please navigate to the {\@link
  473. * Component#animations component animations metadata page} to gain a better understanding of
  474. * how animations in Angular are used.
  475. *
  476. * `state` declares an animation state within the given trigger. When a state is active within a
  477. * component then its associated styles will persist on the element that the trigger is attached to
  478. * (even when the animation ends).
  479. *
  480. * To animate between states, have a look at the animation {\@link transition transition} DSL
  481. * function. To register states to an animation trigger please have a look at the {\@link trigger
  482. * trigger} function.
  483. *
  484. * #### The `void` state
  485. *
  486. * The `void` state value is a reserved word that angular uses to determine when the element is not
  487. * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
  488. * associated element is void).
  489. *
  490. * #### The `*` (default) state
  491. *
  492. * The `*` state (when styled) is a fallback state that will be used if the state that is being
  493. * animated is not declared within the trigger.
  494. *
  495. * ### Usage
  496. *
  497. * `state` will declare an animation state with its associated styles
  498. * within the given trigger.
  499. *
  500. * - `stateNameExpr` can be one or more state names separated by commas.
  501. * - `styles` refers to the {\@link style styling data} that will be persisted on the element once
  502. * the state has been reached.
  503. *
  504. * ```typescript
  505. * // "void" is a reserved name for a state and is used to represent
  506. * // the state in which an element is detached from from the application.
  507. * state("void", style({ height: 0 }))
  508. *
  509. * // user-defined states
  510. * state("closed", style({ height: 0 }))
  511. * state("open, visible", style({ height: "*" }))
  512. * ```
  513. *
  514. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  515. *
  516. * \@experimental Animation support is experimental.
  517. * @param {?} name
  518. * @param {?} styles
  519. * @param {?=} options
  520. * @return {?}
  521. */
  522. function state(name, styles, options) {
  523. return { type: 0 /* State */, name: name, styles: styles, options: options };
  524. }
  525. /**
  526. * `keyframes` is an animation-specific function that is designed to be used inside of Angular's
  527. * animation DSL language. If this information is new, please navigate to the {\@link
  528. * Component#animations component animations metadata page} to gain a better understanding of
  529. * how animations in Angular are used.
  530. *
  531. * `keyframes` specifies a collection of {\@link style style} entries each optionally characterized
  532. * by an `offset` value.
  533. *
  534. * ### Usage
  535. *
  536. * The `keyframes` animation function is designed to be used alongside the {\@link animate animate}
  537. * animation function. Instead of applying animations from where they are currently to their
  538. * destination, keyframes can describe how each style entry is applied and at what point within the
  539. * animation arc (much like CSS Keyframe Animations do).
  540. *
  541. * For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what
  542. * percentage of the animate time the styles will be applied.
  543. *
  544. * ```typescript
  545. * // the provided offset values describe when each backgroundColor value is applied.
  546. * animate("5s", keyframes([
  547. * style({ backgroundColor: "red", offset: 0 }),
  548. * style({ backgroundColor: "blue", offset: 0.2 }),
  549. * style({ backgroundColor: "orange", offset: 0.3 }),
  550. * style({ backgroundColor: "black", offset: 1 })
  551. * ]))
  552. * ```
  553. *
  554. * Alternatively, if there are no `offset` values used within the style entries then the offsets
  555. * will be calculated automatically.
  556. *
  557. * ```typescript
  558. * animate("5s", keyframes([
  559. * style({ backgroundColor: "red" }) // offset = 0
  560. * style({ backgroundColor: "blue" }) // offset = 0.33
  561. * style({ backgroundColor: "orange" }) // offset = 0.66
  562. * style({ backgroundColor: "black" }) // offset = 1
  563. * ]))
  564. * ```
  565. *
  566. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  567. *
  568. * \@experimental Animation support is experimental.
  569. * @param {?} steps
  570. * @return {?}
  571. */
  572. function keyframes(steps) {
  573. return { type: 5 /* Keyframes */, steps: steps };
  574. }
  575. /**
  576. * `transition` is an animation-specific function that is designed to be used inside of Angular's
  577. * animation DSL language. If this information is new, please navigate to the {\@link
  578. * Component#animations component animations metadata page} to gain a better understanding of
  579. * how animations in Angular are used.
  580. *
  581. * `transition` declares the {\@link sequence sequence of animation steps} that will be run when the
  582. * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 =>
  583. * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting
  584. * and/or ending state).
  585. *
  586. * A function can also be provided as the `stateChangeExpr` argument for a transition and this
  587. * function will be executed each time a state change occurs. If the value returned within the
  588. * function is true then the associated animation will be run.
  589. *
  590. * Animation transitions are placed within an {\@link trigger animation trigger}. For an transition
  591. * to animate to a state value and persist its styles then one or more {\@link state animation
  592. * states} is expected to be defined.
  593. *
  594. * ### Usage
  595. *
  596. * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
  597. * what the previous state is and what the current state has become. In other words, if a transition
  598. * is defined that matches the old/current state criteria then the associated animation will be
  599. * triggered.
  600. *
  601. * ```typescript
  602. * // all transition/state changes are defined within an animation trigger
  603. * trigger("myAnimationTrigger", [
  604. * // if a state is defined then its styles will be persisted when the
  605. * // animation has fully completed itself
  606. * state("on", style({ background: "green" })),
  607. * state("off", style({ background: "grey" })),
  608. *
  609. * // a transition animation that will be kicked off when the state value
  610. * // bound to "myAnimationTrigger" changes from "on" to "off"
  611. * transition("on => off", animate(500)),
  612. *
  613. * // it is also possible to do run the same animation for both directions
  614. * transition("on <=> off", animate(500)),
  615. *
  616. * // or to define multiple states pairs separated by commas
  617. * transition("on => off, off => void", animate(500)),
  618. *
  619. * // this is a catch-all state change for when an element is inserted into
  620. * // the page and the destination state is unknown
  621. * transition("void => *", [
  622. * style({ opacity: 0 }),
  623. * animate(500)
  624. * ]),
  625. *
  626. * // this will capture a state change between any states
  627. * transition("* => *", animate("1s 0s")),
  628. *
  629. * // you can also go full out and include a function
  630. * transition((fromState, toState) => {
  631. * // when `true` then it will allow the animation below to be invoked
  632. * return fromState == "off" && toState == "on";
  633. * }, animate("1s 0s"))
  634. * ])
  635. * ```
  636. *
  637. * The template associated with this component will make use of the `myAnimationTrigger` animation
  638. * trigger by binding to an element within its template code.
  639. *
  640. * ```html
  641. * <!-- somewhere inside of my-component-tpl.html -->
  642. * <div [\@myAnimationTrigger]="myStatusExp">...</div>
  643. * ```
  644. *
  645. * #### The final `animate` call
  646. *
  647. * If the final step within the transition steps is a call to `animate()` that **only** uses a
  648. * timing value with **no style data** then it will be automatically used as the final animation arc
  649. * for the element to animate itself to the final state. This involves an automatic mix of
  650. * adding/removing CSS styles so that the element will be in the exact state it should be for the
  651. * applied state to be presented correctly.
  652. *
  653. * ```
  654. * // start off by hiding the element, but make sure that it animates properly to whatever state
  655. * // is currently active for "myAnimationTrigger"
  656. * transition("void => *", [
  657. * style({ opacity: 0 }),
  658. * animate(500)
  659. * ])
  660. * ```
  661. *
  662. * ### Using :enter and :leave
  663. *
  664. * Given that enter (insertion) and leave (removal) animations are so common, the `transition`
  665. * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `*
  666. * => void` state changes.
  667. *
  668. * ```
  669. * transition(":enter", [
  670. * style({ opacity: 0 }),
  671. * animate(500, style({ opacity: 1 }))
  672. * ]),
  673. * transition(":leave", [
  674. * animate(500, style({ opacity: 0 }))
  675. * ])
  676. * ```
  677. *
  678. * ### Boolean values
  679. * if a trigger binding value is a boolean value then it can be matched using a transition
  680. * expression that compares `true` and `false` or `1` and `0`.
  681. *
  682. * ```
  683. * // in the template
  684. * <div [\@openClose]="open ? true : false">...</div>
  685. *
  686. * // in the component metadata
  687. * trigger('openClose', [
  688. * state('true', style({ height: '*' })),
  689. * state('false', style({ height: '0px' })),
  690. * transition('false <=> true', animate(500))
  691. * ])
  692. * ```
  693. *
  694. * ### Using :increment and :decrement
  695. * In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases
  696. * can be used to kick off a transition when a numeric value has increased or decreased in value.
  697. *
  698. * ```
  699. * import {group, animate, query, transition, style, trigger} from '\@angular/animations';
  700. * import {Component} from '\@angular/core';
  701. *
  702. * \@Component({
  703. * selector: 'banner-carousel-component',
  704. * styles: [`
  705. * .banner-container {
  706. * position:relative;
  707. * height:500px;
  708. * overflow:hidden;
  709. * }
  710. * .banner-container > .banner {
  711. * position:absolute;
  712. * left:0;
  713. * top:0;
  714. * font-size:200px;
  715. * line-height:500px;
  716. * font-weight:bold;
  717. * text-align:center;
  718. * width:100%;
  719. * }
  720. * `],
  721. * template: `
  722. * <button (click)="previous()">Previous</button>
  723. * <button (click)="next()">Next</button>
  724. * <hr>
  725. * <div [\@bannerAnimation]="selectedIndex" class="banner-container">
  726. * <div class="banner" *ngFor="let banner of banners"> {{ banner }} </div>
  727. * </div>
  728. * `,
  729. * animations: [
  730. * trigger('bannerAnimation', [
  731. * transition(":increment", group([
  732. * query(':enter', [
  733. * style({ left: '100%' }),
  734. * animate('0.5s ease-out', style('*'))
  735. * ]),
  736. * query(':leave', [
  737. * animate('0.5s ease-out', style({ left: '-100%' }))
  738. * ])
  739. * ])),
  740. * transition(":decrement", group([
  741. * query(':enter', [
  742. * style({ left: '-100%' }),
  743. * animate('0.5s ease-out', style('*'))
  744. * ]),
  745. * query(':leave', [
  746. * animate('0.5s ease-out', style({ left: '100%' }))
  747. * ])
  748. * ]))
  749. * ])
  750. * ]
  751. * })
  752. * class BannerCarouselComponent {
  753. * allBanners: string[] = ['1', '2', '3', '4'];
  754. * selectedIndex: number = 0;
  755. *
  756. * get banners() {
  757. * return [this.allBanners[this.selectedIndex]];
  758. * }
  759. *
  760. * previous() {
  761. * this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
  762. * }
  763. *
  764. * next() {
  765. * this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1);
  766. * }
  767. * }
  768. * ```
  769. *
  770. * {\@example core/animation/ts/dsl/animation_example.ts region='Component'}
  771. *
  772. * \@experimental Animation support is experimental.
  773. * @param {?} stateChangeExpr
  774. * @param {?} steps
  775. * @param {?=} options
  776. * @return {?}
  777. */
  778. function transition(stateChangeExpr, steps, options) {
  779. if (options === void 0) { options = null; }
  780. return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options };
  781. }
  782. /**
  783. * `animation` is an animation-specific function that is designed to be used inside of Angular's
  784. * animation DSL language.
  785. *
  786. * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later
  787. * invoked in another animation or sequence. Reusable animations are designed to make use of
  788. * animation parameters and the produced animation can be used via the `useAnimation` method.
  789. *
  790. * ```
  791. * var fadeAnimation = animation([
  792. * style({ opacity: '{{ start }}' }),
  793. * animate('{{ time }}',
  794. * style({ opacity: '{{ end }}'}))
  795. * ], { params: { time: '1000ms', start: 0, end: 1 }});
  796. * ```
  797. *
  798. * If parameters are attached to an animation then they act as **default parameter values**. When an
  799. * animation is invoked via `useAnimation` then parameter values are allowed to be passed in
  800. * directly. If any of the passed in parameter values are missing then the default values will be
  801. * used.
  802. *
  803. * ```
  804. * useAnimation(fadeAnimation, {
  805. * params: {
  806. * time: '2s',
  807. * start: 1,
  808. * end: 0
  809. * }
  810. * })
  811. * ```
  812. *
  813. * If one or more parameter values are missing before animated then an error will be thrown.
  814. *
  815. * \@experimental Animation support is experimental.
  816. * @param {?} steps
  817. * @param {?=} options
  818. * @return {?}
  819. */
  820. function animation(steps, options) {
  821. if (options === void 0) { options = null; }
  822. return { type: 8 /* Reference */, animation: steps, options: options };
  823. }
  824. /**
  825. * `animateChild` is an animation-specific function that is designed to be used inside of Angular's
  826. * animation DSL language. It works by allowing a queried element to execute its own
  827. * animation within the animation sequence.
  828. *
  829. * Each time an animation is triggered in angular, the parent animation
  830. * will always get priority and any child animations will be blocked. In order
  831. * for a child animation to run, the parent animation must query each of the elements
  832. * containing child animations and then allow the animations to run using `animateChild`.
  833. *
  834. * The example HTML code below shows both parent and child elements that have animation
  835. * triggers that will execute at the same time.
  836. *
  837. * ```html
  838. * <!-- parent-child.component.html -->
  839. * <button (click)="exp =! exp">Toggle</button>
  840. * <hr>
  841. *
  842. * <div [\@parentAnimation]="exp">
  843. * <header>Hello</header>
  844. * <div [\@childAnimation]="exp">
  845. * one
  846. * </div>
  847. * <div [\@childAnimation]="exp">
  848. * two
  849. * </div>
  850. * <div [\@childAnimation]="exp">
  851. * three
  852. * </div>
  853. * </div>
  854. * ```
  855. *
  856. * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate
  857. * because it has priority. However, using `query` and `animateChild` each of the inner animations
  858. * can also fire:
  859. *
  860. * ```ts
  861. * // parent-child.component.ts
  862. * import {trigger, transition, animate, style, query, animateChild} from '\@angular/animations';
  863. * \@Component({
  864. * selector: 'parent-child-component',
  865. * animations: [
  866. * trigger('parentAnimation', [
  867. * transition('false => true', [
  868. * query('header', [
  869. * style({ opacity: 0 }),
  870. * animate(500, style({ opacity: 1 }))
  871. * ]),
  872. * query('\@childAnimation', [
  873. * animateChild()
  874. * ])
  875. * ])
  876. * ]),
  877. * trigger('childAnimation', [
  878. * transition('false => true', [
  879. * style({ opacity: 0 }),
  880. * animate(500, style({ opacity: 1 }))
  881. * ])
  882. * ])
  883. * ]
  884. * })
  885. * class ParentChildCmp {
  886. * exp: boolean = false;
  887. * }
  888. * ```
  889. *
  890. * In the animation code above, when the `parentAnimation` transition kicks off it first queries to
  891. * find the header element and fades it in. It then finds each of the sub elements that contain the
  892. * `\@childAnimation` trigger and then allows for their animations to fire.
  893. *
  894. * This example can be further extended by using stagger:
  895. *
  896. * ```ts
  897. * query('\@childAnimation', stagger(100, [
  898. * animateChild()
  899. * ]))
  900. * ```
  901. *
  902. * Now each of the sub animations start off with respect to the `100ms` staggering step.
  903. *
  904. * ## The first frame of child animations
  905. * When sub animations are executed using `animateChild` the animation engine will always apply the
  906. * first frame of every sub animation immediately at the start of the animation sequence. This way
  907. * the parent animation does not need to set any initial styling data on the sub elements before the
  908. * sub animations kick off.
  909. *
  910. * In the example above the first frame of the `childAnimation`'s `false => true` transition
  911. * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation`
  912. * animation transition sequence starts. Only then when the `\@childAnimation` is queried and called
  913. * with `animateChild` will it then animate to its destination of `opacity: 1`.
  914. *
  915. * Note that this feature designed to be used alongside {\@link query query()} and it will only work
  916. * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes
  917. * and transitions are not handled by this API).
  918. *
  919. * \@experimental Animation support is experimental.
  920. * @param {?=} options
  921. * @return {?}
  922. */
  923. function animateChild(options) {
  924. if (options === void 0) { options = null; }
  925. return { type: 9 /* AnimateChild */, options: options };
  926. }
  927. /**
  928. * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's
  929. * animation DSL language. It is used to kick off a reusable animation that is created using {\@link
  930. * animation animation()}.
  931. *
  932. * \@experimental Animation support is experimental.
  933. * @param {?} animation
  934. * @param {?=} options
  935. * @return {?}
  936. */
  937. function useAnimation(animation, options) {
  938. if (options === void 0) { options = null; }
  939. return { type: 10 /* AnimateRef */, animation: animation, options: options };
  940. }
  941. /**
  942. * `query` is an animation-specific function that is designed to be used inside of Angular's
  943. * animation DSL language.
  944. *
  945. * query() is used to find one or more inner elements within the current element that is
  946. * being animated within the sequence. The provided animation steps are applied
  947. * to the queried element (by default, an array is provided, then this will be
  948. * treated as an animation sequence).
  949. *
  950. * ### Usage
  951. *
  952. * query() is designed to collect mutiple elements and works internally by using
  953. * `element.querySelectorAll`. An additional options object can be provided which
  954. * can be used to limit the total amount of items to be collected.
  955. *
  956. * ```js
  957. * query('div', [
  958. * animate(...),
  959. * animate(...)
  960. * ], { limit: 1 })
  961. * ```
  962. *
  963. * query(), by default, will throw an error when zero items are found. If a query
  964. * has the `optional` flag set to true then this error will be ignored.
  965. *
  966. * ```js
  967. * query('.some-element-that-may-not-be-there', [
  968. * animate(...),
  969. * animate(...)
  970. * ], { optional: true })
  971. * ```
  972. *
  973. * ### Special Selector Values
  974. *
  975. * The selector value within a query can collect elements that contain angular-specific
  976. * characteristics
  977. * using special pseudo-selectors tokens.
  978. *
  979. * These include:
  980. *
  981. * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")`
  982. * - Querying all currently animating elements using `query(":animating")`
  983. * - Querying elements that contain an animation trigger using `query("\@triggerName")`
  984. * - Querying all elements that contain an animation triggers using `query("\@*")`
  985. * - Including the current element into the animation sequence using `query(":self")`
  986. *
  987. *
  988. * Each of these pseudo-selector tokens can be merged together into a combined query selector
  989. * string:
  990. *
  991. * ```
  992. * query(':self, .record:enter, .record:leave, \@subTrigger', [...])
  993. * ```
  994. *
  995. * ### Demo
  996. *
  997. * ```
  998. * \@Component({
  999. * selector: 'inner',
  1000. * template: `
  1001. * <div [\@queryAnimation]="exp">
  1002. * <h1>Title</h1>
  1003. * <div class="content">
  1004. * Blah blah blah
  1005. * </div>
  1006. * </div>
  1007. * `,
  1008. * animations: [
  1009. * trigger('queryAnimation', [
  1010. * transition('* => goAnimate', [
  1011. * // hide the inner elements
  1012. * query('h1', style({ opacity: 0 })),
  1013. * query('.content', style({ opacity: 0 })),
  1014. *
  1015. * // animate the inner elements in, one by one
  1016. * query('h1', animate(1000, style({ opacity: 1 })),
  1017. * query('.content', animate(1000, style({ opacity: 1 })),
  1018. * ])
  1019. * ])
  1020. * ]
  1021. * })
  1022. * class Cmp {
  1023. * exp = '';
  1024. *
  1025. * goAnimate() {
  1026. * this.exp = 'goAnimate';
  1027. * }
  1028. * }
  1029. * ```
  1030. *
  1031. * \@experimental Animation support is experimental.
  1032. * @param {?} selector
  1033. * @param {?} animation
  1034. * @param {?=} options
  1035. * @return {?}
  1036. */
  1037. function query(selector, animation, options) {
  1038. if (options === void 0) { options = null; }
  1039. return { type: 11 /* Query */, selector: selector, animation: animation, options: options };
  1040. }
  1041. /**
  1042. * `stagger` is an animation-specific function that is designed to be used inside of Angular's
  1043. * animation DSL language. It is designed to be used inside of an animation {\@link query query()}
  1044. * and works by issuing a timing gap between after each queried item is animated.
  1045. *
  1046. * ### Usage
  1047. *
  1048. * In the example below there is a container element that wraps a list of items stamped out
  1049. * by an ngFor. The container element contains an animation trigger that will later be set
  1050. * to query for each of the inner items.
  1051. *
  1052. * ```html
  1053. * <!-- list.component.html -->
  1054. * <button (click)="toggle()">Show / Hide Items</button>
  1055. * <hr />
  1056. * <div [\@listAnimation]="items.length">
  1057. * <div *ngFor="let item of items">
  1058. * {{ item }}
  1059. * </div>
  1060. * </div>
  1061. * ```
  1062. *
  1063. * The component code for this looks as such:
  1064. *
  1065. * ```ts
  1066. * import {trigger, transition, style, animate, query, stagger} from '\@angular/animations';
  1067. * \@Component({
  1068. * templateUrl: 'list.component.html',
  1069. * animations: [
  1070. * trigger('listAnimation', [
  1071. * //...
  1072. * ])
  1073. * ]
  1074. * })
  1075. * class ListComponent {
  1076. * items = [];
  1077. *
  1078. * showItems() {
  1079. * this.items = [0,1,2,3,4];
  1080. * }
  1081. *
  1082. * hideItems() {
  1083. * this.items = [];
  1084. * }
  1085. *
  1086. * toggle() {
  1087. * this.items.length ? this.hideItems() : this.showItems();
  1088. * }
  1089. * }
  1090. * ```
  1091. *
  1092. * And now for the animation trigger code:
  1093. *
  1094. * ```ts
  1095. * trigger('listAnimation', [
  1096. * transition('* => *', [ // each time the binding value changes
  1097. * query(':leave', [
  1098. * stagger(100, [
  1099. * animate('0.5s', style({ opacity: 0 }))
  1100. * ])
  1101. * ]),
  1102. * query(':enter', [
  1103. * style({ opacity: 0 }),
  1104. * stagger(100, [
  1105. * animate('0.5s', style({ opacity: 1 }))
  1106. * ])
  1107. * ])
  1108. * ])
  1109. * ])
  1110. * ```
  1111. *
  1112. * Now each time the items are added/removed then either the opacity
  1113. * fade-in animation will run or each removed item will be faded out.
  1114. * When either of these animations occur then a stagger effect will be
  1115. * applied after each item's animation is started.
  1116. *
  1117. * \@experimental Animation support is experimental.
  1118. * @param {?} timings
  1119. * @param {?} animation
  1120. * @return {?}
  1121. */
  1122. function stagger(timings, animation) {
  1123. return { type: 12 /* Stagger */, timings: timings, animation: animation };
  1124. }
  1125. /**
  1126. * @fileoverview added by tsickle
  1127. * @suppress {checkTypes} checked by tsc
  1128. */
  1129. /**
  1130. * @license
  1131. * Copyright Google Inc. All Rights Reserved.
  1132. *
  1133. * Use of this source code is governed by an MIT-style license that can be
  1134. * found in the LICENSE file at https://angular.io/license
  1135. * @param {?} cb
  1136. * @return {?}
  1137. */
  1138. function scheduleMicroTask(cb) {
  1139. Promise.resolve(null).then(cb);
  1140. }
  1141. /**
  1142. * @fileoverview added by tsickle
  1143. * @suppress {checkTypes} checked by tsc
  1144. */
  1145. /**
  1146. * AnimationPlayer controls an animation sequence that was produced from a programmatic animation.
  1147. * (see {\@link AnimationBuilder AnimationBuilder} for more information on how to create programmatic
  1148. * animations.)
  1149. *
  1150. * \@experimental Animation support is experimental.
  1151. * @record
  1152. */
  1153. /**
  1154. * \@experimental Animation support is experimental.
  1155. */
  1156. var NoopAnimationPlayer = /** @class */ (function () {
  1157. function NoopAnimationPlayer() {
  1158. this._onDoneFns = [];
  1159. this._onStartFns = [];
  1160. this._onDestroyFns = [];
  1161. this._started = false;
  1162. this._destroyed = false;
  1163. this._finished = false;
  1164. this.parentPlayer = null;
  1165. this.totalTime = 0;
  1166. }
  1167. /**
  1168. * @return {?}
  1169. */
  1170. NoopAnimationPlayer.prototype._onFinish = /**
  1171. * @return {?}
  1172. */
  1173. function () {
  1174. if (!this._finished) {
  1175. this._finished = true;
  1176. this._onDoneFns.forEach(function (fn) { return fn(); });
  1177. this._onDoneFns = [];
  1178. }
  1179. };
  1180. /**
  1181. * @param {?} fn
  1182. * @return {?}
  1183. */
  1184. NoopAnimationPlayer.prototype.onStart = /**
  1185. * @param {?} fn
  1186. * @return {?}
  1187. */
  1188. function (fn) { this._onStartFns.push(fn); };
  1189. /**
  1190. * @param {?} fn
  1191. * @return {?}
  1192. */
  1193. NoopAnimationPlayer.prototype.onDone = /**
  1194. * @param {?} fn
  1195. * @return {?}
  1196. */
  1197. function (fn) { this._onDoneFns.push(fn); };
  1198. /**
  1199. * @param {?} fn
  1200. * @return {?}
  1201. */
  1202. NoopAnimationPlayer.prototype.onDestroy = /**
  1203. * @param {?} fn
  1204. * @return {?}
  1205. */
  1206. function (fn) { this._onDestroyFns.push(fn); };
  1207. /**
  1208. * @return {?}
  1209. */
  1210. NoopAnimationPlayer.prototype.hasStarted = /**
  1211. * @return {?}
  1212. */
  1213. function () { return this._started; };
  1214. /**
  1215. * @return {?}
  1216. */
  1217. NoopAnimationPlayer.prototype.init = /**
  1218. * @return {?}
  1219. */
  1220. function () { };
  1221. /**
  1222. * @return {?}
  1223. */
  1224. NoopAnimationPlayer.prototype.play = /**
  1225. * @return {?}
  1226. */
  1227. function () {
  1228. if (!this.hasStarted()) {
  1229. this._onStart();
  1230. this.triggerMicrotask();
  1231. }
  1232. this._started = true;
  1233. };
  1234. /* @internal */
  1235. /**
  1236. * @return {?}
  1237. */
  1238. NoopAnimationPlayer.prototype.triggerMicrotask = /**
  1239. * @return {?}
  1240. */
  1241. function () {
  1242. var _this = this;
  1243. scheduleMicroTask(function () { return _this._onFinish(); });
  1244. };
  1245. /**
  1246. * @return {?}
  1247. */
  1248. NoopAnimationPlayer.prototype._onStart = /**
  1249. * @return {?}
  1250. */
  1251. function () {
  1252. this._onStartFns.forEach(function (fn) { return fn(); });
  1253. this._onStartFns = [];
  1254. };
  1255. /**
  1256. * @return {?}
  1257. */
  1258. NoopAnimationPlayer.prototype.pause = /**
  1259. * @return {?}
  1260. */
  1261. function () { };
  1262. /**
  1263. * @return {?}
  1264. */
  1265. NoopAnimationPlayer.prototype.restart = /**
  1266. * @return {?}
  1267. */
  1268. function () { };
  1269. /**
  1270. * @return {?}
  1271. */
  1272. NoopAnimationPlayer.prototype.finish = /**
  1273. * @return {?}
  1274. */
  1275. function () { this._onFinish(); };
  1276. /**
  1277. * @return {?}
  1278. */
  1279. NoopAnimationPlayer.prototype.destroy = /**
  1280. * @return {?}
  1281. */
  1282. function () {
  1283. if (!this._destroyed) {
  1284. this._destroyed = true;
  1285. if (!this.hasStarted()) {
  1286. this._onStart();
  1287. }
  1288. this.finish();
  1289. this._onDestroyFns.forEach(function (fn) { return fn(); });
  1290. this._onDestroyFns = [];
  1291. }
  1292. };
  1293. /**
  1294. * @return {?}
  1295. */
  1296. NoopAnimationPlayer.prototype.reset = /**
  1297. * @return {?}
  1298. */
  1299. function () { };
  1300. /**
  1301. * @param {?} p
  1302. * @return {?}
  1303. */
  1304. NoopAnimationPlayer.prototype.setPosition = /**
  1305. * @param {?} p
  1306. * @return {?}
  1307. */
  1308. function (p) { };
  1309. /**
  1310. * @return {?}
  1311. */
  1312. NoopAnimationPlayer.prototype.getPosition = /**
  1313. * @return {?}
  1314. */
  1315. function () { return 0; };
  1316. /* @internal */
  1317. /**
  1318. * @param {?} phaseName
  1319. * @return {?}
  1320. */
  1321. NoopAnimationPlayer.prototype.triggerCallback = /**
  1322. * @param {?} phaseName
  1323. * @return {?}
  1324. */
  1325. function (phaseName) {
  1326. var /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
  1327. methods.forEach(function (fn) { return fn(); });
  1328. methods.length = 0;
  1329. };
  1330. return NoopAnimationPlayer;
  1331. }());
  1332. /**
  1333. * @fileoverview added by tsickle
  1334. * @suppress {checkTypes} checked by tsc
  1335. */
  1336. /**
  1337. * @license
  1338. * Copyright Google Inc. All Rights Reserved.
  1339. *
  1340. * Use of this source code is governed by an MIT-style license that can be
  1341. * found in the LICENSE file at https://angular.io/license
  1342. */
  1343. var AnimationGroupPlayer = /** @class */ (function () {
  1344. function AnimationGroupPlayer(_players) {
  1345. var _this = this;
  1346. this._onDoneFns = [];
  1347. this._onStartFns = [];
  1348. this._finished = false;
  1349. this._started = false;
  1350. this._destroyed = false;
  1351. this._onDestroyFns = [];
  1352. this.parentPlayer = null;
  1353. this.totalTime = 0;
  1354. this.players = _players;
  1355. var /** @type {?} */ doneCount = 0;
  1356. var /** @type {?} */ destroyCount = 0;
  1357. var /** @type {?} */ startCount = 0;
  1358. var /** @type {?} */ total = this.players.length;
  1359. if (total == 0) {
  1360. scheduleMicroTask(function () { return _this._onFinish(); });
  1361. }
  1362. else {
  1363. this.players.forEach(function (player) {
  1364. player.onDone(function () {
  1365. if (++doneCount == total) {
  1366. _this._onFinish();
  1367. }
  1368. });
  1369. player.onDestroy(function () {
  1370. if (++destroyCount == total) {
  1371. _this._onDestroy();
  1372. }
  1373. });
  1374. player.onStart(function () {
  1375. if (++startCount == total) {
  1376. _this._onStart();
  1377. }
  1378. });
  1379. });
  1380. }
  1381. this.totalTime = this.players.reduce(function (time, player) { return Math.max(time, player.totalTime); }, 0);
  1382. }
  1383. /**
  1384. * @return {?}
  1385. */
  1386. AnimationGroupPlayer.prototype._onFinish = /**
  1387. * @return {?}
  1388. */
  1389. function () {
  1390. if (!this._finished) {
  1391. this._finished = true;
  1392. this._onDoneFns.forEach(function (fn) { return fn(); });
  1393. this._onDoneFns = [];
  1394. }
  1395. };
  1396. /**
  1397. * @return {?}
  1398. */
  1399. AnimationGroupPlayer.prototype.init = /**
  1400. * @return {?}
  1401. */
  1402. function () { this.players.forEach(function (player) { return player.init(); }); };
  1403. /**
  1404. * @param {?} fn
  1405. * @return {?}
  1406. */
  1407. AnimationGroupPlayer.prototype.onStart = /**
  1408. * @param {?} fn
  1409. * @return {?}
  1410. */
  1411. function (fn) { this._onStartFns.push(fn); };
  1412. /**
  1413. * @return {?}
  1414. */
  1415. AnimationGroupPlayer.prototype._onStart = /**
  1416. * @return {?}
  1417. */
  1418. function () {
  1419. if (!this.hasStarted()) {
  1420. this._started = true;
  1421. this._onStartFns.forEach(function (fn) { return fn(); });
  1422. this._onStartFns = [];
  1423. }
  1424. };
  1425. /**
  1426. * @param {?} fn
  1427. * @return {?}
  1428. */
  1429. AnimationGroupPlayer.prototype.onDone = /**
  1430. * @param {?} fn
  1431. * @return {?}
  1432. */
  1433. function (fn) { this._onDoneFns.push(fn); };
  1434. /**
  1435. * @param {?} fn
  1436. * @return {?}
  1437. */
  1438. AnimationGroupPlayer.prototype.onDestroy = /**
  1439. * @param {?} fn
  1440. * @return {?}
  1441. */
  1442. function (fn) { this._onDestroyFns.push(fn); };
  1443. /**
  1444. * @return {?}
  1445. */
  1446. AnimationGroupPlayer.prototype.hasStarted = /**
  1447. * @return {?}
  1448. */
  1449. function () { return this._started; };
  1450. /**
  1451. * @return {?}
  1452. */
  1453. AnimationGroupPlayer.prototype.play = /**
  1454. * @return {?}
  1455. */
  1456. function () {
  1457. if (!this.parentPlayer) {
  1458. this.init();
  1459. }
  1460. this._onStart();
  1461. this.players.forEach(function (player) { return player.play(); });
  1462. };
  1463. /**
  1464. * @return {?}
  1465. */
  1466. AnimationGroupPlayer.prototype.pause = /**
  1467. * @return {?}
  1468. */
  1469. function () { this.players.forEach(function (player) { return player.pause(); }); };
  1470. /**
  1471. * @return {?}
  1472. */
  1473. AnimationGroupPlayer.prototype.restart = /**
  1474. * @return {?}
  1475. */
  1476. function () { this.players.forEach(function (player) { return player.restart(); }); };
  1477. /**
  1478. * @return {?}
  1479. */
  1480. AnimationGroupPlayer.prototype.finish = /**
  1481. * @return {?}
  1482. */
  1483. function () {
  1484. this._onFinish();
  1485. this.players.forEach(function (player) { return player.finish(); });
  1486. };
  1487. /**
  1488. * @return {?}
  1489. */
  1490. AnimationGroupPlayer.prototype.destroy = /**
  1491. * @return {?}
  1492. */
  1493. function () { this._onDestroy(); };
  1494. /**
  1495. * @return {?}
  1496. */
  1497. AnimationGroupPlayer.prototype._onDestroy = /**
  1498. * @return {?}
  1499. */
  1500. function () {
  1501. if (!this._destroyed) {
  1502. this._destroyed = true;
  1503. this._onFinish();
  1504. this.players.forEach(function (player) { return player.destroy(); });
  1505. this._onDestroyFns.forEach(function (fn) { return fn(); });
  1506. this._onDestroyFns = [];
  1507. }
  1508. };
  1509. /**
  1510. * @return {?}
  1511. */
  1512. AnimationGroupPlayer.prototype.reset = /**
  1513. * @return {?}
  1514. */
  1515. function () {
  1516. this.players.forEach(function (player) { return player.reset(); });
  1517. this._destroyed = false;
  1518. this._finished = false;
  1519. this._started = false;
  1520. };
  1521. /**
  1522. * @param {?} p
  1523. * @return {?}
  1524. */
  1525. AnimationGroupPlayer.prototype.setPosition = /**
  1526. * @param {?} p
  1527. * @return {?}
  1528. */
  1529. function (p) {
  1530. var /** @type {?} */ timeAtPosition = p * this.totalTime;
  1531. this.players.forEach(function (player) {
  1532. var /** @type {?} */ position = player.totalTime ? Math.min(1, timeAtPosition / player.totalTime) : 1;
  1533. player.setPosition(position);
  1534. });
  1535. };
  1536. /**
  1537. * @return {?}
  1538. */
  1539. AnimationGroupPlayer.prototype.getPosition = /**
  1540. * @return {?}
  1541. */
  1542. function () {
  1543. var /** @type {?} */ min = 0;
  1544. this.players.forEach(function (player) {
  1545. var /** @type {?} */ p = player.getPosition();
  1546. min = Math.min(p, min);
  1547. });
  1548. return min;
  1549. };
  1550. /**
  1551. * @return {?}
  1552. */
  1553. AnimationGroupPlayer.prototype.beforeDestroy = /**
  1554. * @return {?}
  1555. */
  1556. function () {
  1557. this.players.forEach(function (player) {
  1558. if (player.beforeDestroy) {
  1559. player.beforeDestroy();
  1560. }
  1561. });
  1562. };
  1563. /* @internal */
  1564. /**
  1565. * @param {?} phaseName
  1566. * @return {?}
  1567. */
  1568. AnimationGroupPlayer.prototype.triggerCallback = /**
  1569. * @param {?} phaseName
  1570. * @return {?}
  1571. */
  1572. function (phaseName) {
  1573. var /** @type {?} */ methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
  1574. methods.forEach(function (fn) { return fn(); });
  1575. methods.length = 0;
  1576. };
  1577. return AnimationGroupPlayer;
  1578. }());
  1579. /**
  1580. * @fileoverview added by tsickle
  1581. * @suppress {checkTypes} checked by tsc
  1582. */
  1583. var ɵPRE_STYLE = '!';
  1584. /**
  1585. * @fileoverview added by tsickle
  1586. * @suppress {checkTypes} checked by tsc
  1587. */
  1588. /**
  1589. * @license
  1590. * Copyright Google Inc. All Rights Reserved.
  1591. *
  1592. * Use of this source code is governed by an MIT-style license that can be
  1593. * found in the LICENSE file at https://angular.io/license
  1594. */
  1595. /**
  1596. * @fileoverview added by tsickle
  1597. * @suppress {checkTypes} checked by tsc
  1598. */
  1599. /**
  1600. * @license
  1601. * Copyright Google Inc. All Rights Reserved.
  1602. *
  1603. * Use of this source code is governed by an MIT-style license that can be
  1604. * found in the LICENSE file at https://angular.io/license
  1605. */
  1606. /**
  1607. * @module
  1608. * @description
  1609. * Entry point for all public APIs of this package.
  1610. */
  1611. /**
  1612. * @fileoverview added by tsickle
  1613. * @suppress {checkTypes} checked by tsc
  1614. */
  1615. /**
  1616. * Generated bundle index. Do not edit.
  1617. */
  1618. export { AnimationBuilder, AnimationFactory, AUTO_STYLE, animate, animateChild, animation, group, keyframes, query, sequence, stagger, state, style, transition, trigger, useAnimation, NoopAnimationPlayer, AnimationGroupPlayer as ɵAnimationGroupPlayer, ɵPRE_STYLE };
  1619. //# sourceMappingURL=animations.js.map