UNPKG

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