@angular/animations 6.0.3 → 6.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/browser/browser.metadata.json +1 -1
  2. package/browser/src/dsl/animation_transition_factory.d.ts +1 -1
  3. package/browser/src/render/animation_engine_next.d.ts +2 -1
  4. package/browser/src/render/shared.d.ts +2 -0
  5. package/browser/src/render/timeline_animation_engine.d.ts +2 -1
  6. package/browser/src/render/transition_animation_engine.d.ts +3 -3
  7. package/browser/testing.d.ts +0 -5
  8. package/browser/testing.metadata.json +1 -1
  9. package/browser.d.ts +0 -5
  10. package/browser.metadata.json +1 -1
  11. package/bundles/animations-browser-testing.umd.js +28 -10
  12. package/bundles/animations-browser-testing.umd.js.map +1 -1
  13. package/bundles/animations-browser-testing.umd.min.js +16 -2
  14. package/bundles/animations-browser-testing.umd.min.js.map +1 -1
  15. package/bundles/animations-browser.umd.js +200 -83
  16. package/bundles/animations-browser.umd.js.map +1 -1
  17. package/bundles/animations-browser.umd.min.js +55 -6
  18. package/bundles/animations-browser.umd.min.js.map +1 -1
  19. package/bundles/animations.umd.js +470 -577
  20. package/bundles/animations.umd.js.map +1 -1
  21. package/bundles/animations.umd.min.js +9 -2
  22. package/bundles/animations.umd.min.js.map +1 -1
  23. package/esm2015/animations.externs.js +1 -1
  24. package/esm2015/browser/browser.externs.js +3 -3
  25. package/esm2015/browser/src/dsl/animation_transition_factory.js +4 -3
  26. package/esm2015/browser/src/render/animation_driver.js +1 -12
  27. package/esm2015/browser/src/render/animation_engine_next.js +8 -4
  28. package/esm2015/browser/src/render/shared.js +18 -3
  29. package/esm2015/browser/src/render/timeline_animation_engine.js +6 -2
  30. package/esm2015/browser/src/render/transition_animation_engine.js +23 -19
  31. package/esm2015/browser/src/render/web_animations/web_animations_driver.js +3 -3
  32. package/esm2015/browser/src/util.js +57 -1
  33. package/esm2015/src/animation_metadata.js +626 -659
  34. package/esm2015/src/version.js +1 -1
  35. package/esm5/browser/index.js +5 -1
  36. package/esm5/browser/public_api.js +6 -1
  37. package/esm5/browser/src/browser.js +6 -1
  38. package/esm5/browser/src/dsl/animation.js +1 -1
  39. package/esm5/browser/src/dsl/animation_ast_builder.js +11 -4
  40. package/esm5/browser/src/dsl/animation_timeline_builder.js +27 -21
  41. package/esm5/browser/src/dsl/animation_timeline_instruction.js +1 -1
  42. package/esm5/browser/src/dsl/animation_transition_expr.js +1 -1
  43. package/esm5/browser/src/dsl/animation_transition_factory.js +3 -3
  44. package/esm5/browser/src/dsl/animation_transition_instruction.js +1 -1
  45. package/esm5/browser/src/dsl/animation_trigger.js +2 -8
  46. package/esm5/browser/src/dsl/element_instruction_map.js +1 -1
  47. package/esm5/browser/src/dsl/style_normalization/animation_style_normalizer.js +3 -15
  48. package/esm5/browser/src/dsl/style_normalization/web_animations_style_normalizer.js +8 -1
  49. package/esm5/browser/src/private_export.js +8 -1
  50. package/esm5/browser/src/render/animation_driver.js +8 -3
  51. package/esm5/browser/src/render/animation_engine_next.js +5 -4
  52. package/esm5/browser/src/render/css_keyframes/css_keyframes_driver.js +1 -1
  53. package/esm5/browser/src/render/css_keyframes/css_keyframes_player.js +2 -4
  54. package/esm5/browser/src/render/css_keyframes/direct_style_player.js +8 -1
  55. package/esm5/browser/src/render/css_keyframes/element_animation_style_handler.js +1 -1
  56. package/esm5/browser/src/render/shared.js +19 -3
  57. package/esm5/browser/src/render/timeline_animation_engine.js +10 -2
  58. package/esm5/browser/src/render/transition_animation_engine.js +36 -39
  59. package/esm5/browser/src/render/web_animations/dom_animation.js +1 -1
  60. package/esm5/browser/src/render/web_animations/web_animations_driver.js +3 -3
  61. package/esm5/browser/src/render/web_animations/web_animations_player.js +3 -7
  62. package/esm5/browser/src/util.js +51 -3
  63. package/esm5/browser/testing/index.js +5 -1
  64. package/esm5/browser/testing/public_api.js +6 -1
  65. package/esm5/browser/testing/src/mock_animation_driver.js +12 -17
  66. package/esm5/browser/testing/src/testing.js +8 -1
  67. package/esm5/index.js +5 -1
  68. package/esm5/public_api.js +6 -1
  69. package/esm5/src/animation_builder.js +3 -93
  70. package/esm5/src/animation_event.js +1 -1
  71. package/esm5/src/animation_metadata.js +439 -568
  72. package/esm5/src/animations.js +6 -1
  73. package/esm5/src/players/animation_group_player.js +2 -4
  74. package/esm5/src/players/animation_player.js +11 -14
  75. package/esm5/src/private_export.js +8 -1
  76. package/esm5/src/util.js +1 -1
  77. package/esm5/src/version.js +3 -23
  78. package/fesm2015/animations.js +446 -631
  79. package/fesm2015/animations.js.map +1 -1
  80. package/fesm2015/browser/testing.js +1 -1
  81. package/fesm2015/browser/testing.js.map +1 -1
  82. package/fesm2015/browser.js +104 -29
  83. package/fesm2015/browser.js.map +1 -1
  84. package/fesm5/animations.js +470 -577
  85. package/fesm5/animations.js.map +1 -1
  86. package/fesm5/browser/testing.js +28 -10
  87. package/fesm5/browser/testing.js.map +1 -1
  88. package/fesm5/browser.js +200 -83
  89. package/fesm5/browser.js.map +1 -1
  90. package/package.json +3 -3
  91. package/src/animation_metadata.d.ts +673 -650
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v6.0.3
2
+ * @license Angular v6.0.7
3
3
  * (c) 2010-2018 Google, Inc. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -67,40 +67,49 @@ var AnimationFactory = /** @class */ (function () {
67
67
  }());
68
68
 
69
69
  /**
70
- * @experimental Animation support is experimental.
70
+ * @license
71
+ * Copyright Google Inc. All Rights Reserved.
72
+ *
73
+ * Use of this source code is governed by an MIT-style license that can be
74
+ * found in the LICENSE file at https://angular.io/license
75
+ */
76
+ /**
77
+ * Specifies automatic styling.
71
78
  */
72
79
  var AUTO_STYLE = '*';
73
80
  /**
74
- * `trigger` is an animation-specific function that is designed to be used inside of Angular's
75
- * animation DSL language. If this information is new, please navigate to the
76
- * {@link Component#animations component animations metadata page} to gain a better
77
- * understanding of how animations in Angular are used.
78
- *
79
- * `trigger` Creates an animation trigger which will a list of {@link state state} and
80
- * {@link transition transition} entries that will be evaluated when the expression
81
+ * Creates a named animation trigger, containing a list of `state()`
82
+ * and `transition()` entries to be evaluated when the expression
81
83
  * bound to the trigger changes.
82
84
  *
83
- * Triggers are registered within the component annotation data under the
84
- * {@link Component#animations animations section}. An animation trigger can be placed on an element
85
- * within a template by referencing the name of the trigger followed by the expression value that
86
- the
87
- * trigger is bound to (in the form of `[@triggerName]="expression"`.
85
+ * @param name An identifying string.
86
+ * @param definitions An animation definition object, containing an array of `state()`
87
+ * and `transition()` declarations.
88
88
  *
89
- * Animation trigger bindings strigify values and then match the previous and current values against
90
- * any linked transitions. If a boolean value is provided into the trigger binding then it will both
91
- * be represented as `1` or `true` and `0` or `false` for a true and false boolean values
92
- * respectively.
89
+ * @return An object that encapsulates the trigger data.
93
90
  *
94
- * ### Usage
91
+ * @usageNotes
92
+ * Define an animation trigger in the `animations` section of `@Component` metadata.
93
+ * In the template, reference the trigger by name and bind it to a trigger expression that
94
+ * evaluates to a defined animation state, using the following format:
95
+ *
96
+ * `[@triggerName]="expression"`
97
+ *
98
+ * Animation trigger bindings convert all values to strings, and then match the
99
+ * previous and current values against any linked transitions.
100
+ * Booleans can be specified as `1` or `true` and `0` or `false`.
95
101
  *
96
- * `trigger` will create an animation trigger reference based on the provided `name` value. The
97
- * provided `animation` value is expected to be an array consisting of {@link state state} and
98
- * {@link transition transition} declarations.
102
+ * ### Usage Example
103
+ *
104
+ * The following example creates an animation trigger reference based on the provided
105
+ * name value.
106
+ * The provided animation value is expected to be an array consisting of state and
107
+ * transition declarations.
99
108
  *
100
109
  * ```typescript
101
110
  * @Component({
102
- * selector: 'my-component',
103
- * templateUrl: 'my-component-tpl.html',
111
+ * selector: "my-component",
112
+ * templateUrl: "my-component-tpl.html",
104
113
  * animations: [
105
114
  * trigger("myAnimationTrigger", [
106
115
  * state(...),
@@ -115,8 +124,8 @@ var AUTO_STYLE = '*';
115
124
  * }
116
125
  * ```
117
126
  *
118
- * The template associated with this component will make use of the `myAnimationTrigger` animation
119
- trigger by binding to an element within its template code.
127
+ * The template associated with this component makes use of the defined trigger
128
+ * by binding to an element within its template code.
120
129
  *
121
130
  * ```html
122
131
  * <!-- somewhere inside of my-component-tpl.html -->
@@ -127,9 +136,8 @@ var AUTO_STYLE = '*';
127
136
  * The `transition` animation method also supports reading an inline function which can decide
128
137
  * if its associated animation should be run.
129
138
  *
130
- * ```
131
- * // this method will be run each time the `myAnimationTrigger`
132
- * // trigger value changes...
139
+ * ```typescript
140
+ * // this method is run each time the `myAnimationTrigger` trigger value changes.
133
141
  * function myInlineMatcherFn(fromState: string, toState: string, element: any, params: {[key:
134
142
  string]: any}): boolean {
135
143
  * // notice that `element` and `params` are also available here
@@ -152,18 +160,16 @@ var AUTO_STYLE = '*';
152
160
  * }
153
161
  * ```
154
162
  *
155
- * The inline method will be run each time the trigger
156
- * value changes
157
- *
158
- * ## Disable Animations
159
- * A special animation control binding called `@.disabled` can be placed on an element which will
160
- then disable animations for any inner animation triggers situated within the element as well as
161
- any animations on the element itself.
163
+ * ### Disabling Animations
164
+ * When true, the special animation control binding `@.disabled` binding prevents
165
+ * all animations from rendering.
166
+ * Place the `@.disabled` binding on an element to disable
167
+ * animations on the element itself, as well as any inner animation triggers
168
+ * within the element.
162
169
  *
163
- * When true, the `@.disabled` binding will prevent all animations from rendering. The example
164
- below shows how to use this feature:
170
+ * The following example shows how to use this feature:
165
171
  *
166
- * ```ts
172
+ * ```typescript
167
173
  * @Component({
168
174
  * selector: 'my-component',
169
175
  * template: `
@@ -183,19 +189,16 @@ var AUTO_STYLE = '*';
183
189
  * }
184
190
  * ```
185
191
  *
186
- * The `@childAnimation` trigger will not animate because `@.disabled` prevents it from happening
187
- (when true).
192
+ * When `@.disabled` is true, it prevents the `@childAnimation` trigger from animating,
193
+ * along with any inner animations.
188
194
  *
189
- * Note that `@.disabled` will only disable all animations (this means any animations running on
190
- * the same element will also be disabled).
195
+ * ### Disable animations application-wide
196
+ * When an area of the template is set to have animations disabled,
197
+ * **all** inner components have their animations disabled as well.
198
+ * This means that you can disable all animations for an app
199
+ * by placing a host binding set on `@.disabled` on the topmost Angular component.
191
200
  *
192
- * ### Disabling Animations Application-wide
193
- * When an area of the template is set to have animations disabled, **all** inner components will
194
- also have their animations disabled as well. This means that all animations for an angular
195
- application can be disabled by placing a host binding set on `@.disabled` on the topmost Angular
196
- component.
197
- *
198
- * ```ts
201
+ * ```typescript
199
202
  * import {Component, HostBinding} from '@angular/core';
200
203
  *
201
204
  * @Component({
@@ -208,19 +211,17 @@ var AUTO_STYLE = '*';
208
211
  * }
209
212
  * ```
210
213
  *
211
- * ### What about animations that us `query()` and `animateChild()`?
212
- * Despite inner animations being disabled, a parent animation can {@link query query} for inner
213
- elements located in disabled areas of the template and still animate them as it sees fit. This is
214
- also the case for when a sub animation is queried by a parent and then later animated using {@link
215
- animateChild animateChild}.
216
-
217
- * ### Detecting when an animation is disabled
218
- * If a region of the DOM (or the entire application) has its animations disabled, then animation
219
- * trigger callbacks will still fire just as normal (only for zero seconds).
214
+ * ### Overriding disablement of inner animations
215
+ * Despite inner animations being disabled, a parent animation can `query()`
216
+ * for inner elements located in disabled areas of the template and still animate
217
+ * them if needed. This is also the case for when a sub animation is
218
+ * queried by a parent and then later animated using `animateChild()`.
220
219
  *
221
- * When a trigger callback fires it will provide an instance of an {@link AnimationEvent}. If
222
- animations
223
- * are disabled then the `.disabled` flag on the event will be true.
220
+ * ### Detecting when an animation is disabled
221
+ * If a region of the DOM (or the entire application) has its animations disabled, the animation
222
+ * trigger callbacks still fire, but for zero seconds. When the callback fires, it provides
223
+ * an instance of an `AnimationEvent`. If animations are disabled,
224
+ * the `.disabled` flag on the event is true.
224
225
  *
225
226
  * @experimental Animation support is experimental.
226
227
  */
@@ -228,73 +229,74 @@ function trigger(name, definitions) {
228
229
  return { type: 7 /* Trigger */, name: name, definitions: definitions, options: {} };
229
230
  }
230
231
  /**
231
- * `animate` is an animation-specific function that is designed to be used inside of Angular's
232
- * animation DSL language. If this information is new, please navigate to the {@link
233
- * Component#animations component animations metadata page} to gain a better understanding of
234
- * how animations in Angular are used.
235
- *
236
- * `animate` specifies an animation step that will apply the provided `styles` data for a given
237
- * amount of time based on the provided `timing` expression value. Calls to `animate` are expected
238
- * to be used within {@link sequence an animation sequence}, {@link group group}, or {@link
239
- * transition transition}.
240
- *
241
- * ### Usage
242
- *
243
- * The `animate` function accepts two input parameters: `timing` and `styles`:
244
- *
245
- * - `timing` is a string based value that can be a combination of a duration with optional delay
246
- * and easing values. The format for the expression breaks down to `duration delay easing`
247
- * (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000,
248
- * delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the
249
- * `duration` value in millisecond form.
250
- * - `styles` is the style input data which can either be a call to {@link style style} or {@link
251
- * keyframes keyframes}. If left empty then the styles from the destination state will be collected
252
- * and used (this is useful when describing an animation step that will complete an animation by
253
- * {@link transition#the-final-animate-call animating to the final state}).
254
- *
232
+ * Defines an animation step that combines styling information with timing information.
233
+ *
234
+ * @param timings Sets `AnimateTimings` for the parent animation.
235
+ * A string in the format "duration [delay] [easing]".
236
+ * - Duration and delay are expressed as a number and optional time unit,
237
+ * such as "1s" or "10ms" for one second and 10 milliseconds, respectively.
238
+ * The default unit is milliseconds.
239
+ * - The easing value controls how the animation accelerates and decelerates
240
+ * during its runtime. Value is one of `ease`, `ease-in`, `ease-out`,
241
+ * `ease-in-out`, or a `cubic-bezier()` function call.
242
+ * If not supplied, no easing is applied.
243
+ *
244
+ * For example, the string "1s 100ms ease-out" specifies a duration of
245
+ * 1000 milliseconds, and delay of 100 ms, and the "ease-out" easing style,
246
+ * which decelerates near the end of the duration.
247
+ * @param styles Sets AnimationStyles for the parent animation.
248
+ * A function call to either `style()` or `keyframes()`
249
+ * that returns a collection of CSS style entries to be applied to the parent animation.
250
+ * When null, uses the styles from the destination state.
251
+ * This is useful when describing an animation step that will complete an animation;
252
+ * see "Animating to the final state" in `transitions()`.
253
+ * @returns An object that encapsulates the animation step.
254
+ *
255
+ * @usageNotes
256
+ * Call within an animation `sequence()`, `{@link animations/group group()}`, or
257
+ * `transition()` call to specify an animation step
258
+ * that applies given style data to the parent animation for a given amount of time.
259
+ *
260
+ * ### Syntax Examples
261
+ * **Timing examples**
262
+ *
263
+ * The following examples show various `timings` specifications.
264
+ * - `animate(500)` : Duration is 500 milliseconds.
265
+ * - `animate("1s")` : Duration is 1000 milliseconds.
266
+ * - `animate("100ms 0.5s")` : Duration is 100 milliseconds, delay is 500 milliseconds.
267
+ * - `animate("5s ease-in")` : Duration is 5000 milliseconds, easing in.
268
+ * - `animate("5s 10ms cubic-bezier(.17,.67,.88,.1)")` : Duration is 5000 milliseconds, delay is 10
269
+ * milliseconds, easing according to a bezier curve.
270
+ *
271
+ * **Style examples**
272
+ *
273
+ * The following example calls `style()` to set a single CSS style.
255
274
  * ```typescript
256
- * // various functions for specifying timing data
257
- * animate(500, style(...))
258
- * animate("1s", style(...))
259
- * animate("100ms 0.5s", style(...))
260
- * animate("5s ease", style(...))
261
- * animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...))
262
- *
263
- * // either style() of keyframes() can be used
264
275
  * animate(500, style({ background: "red" }))
265
- * animate(500, keyframes([
276
+ * ```
277
+ * The following example calls `keyframes()` to set a CSS style
278
+ * to different values for successive keyframes.
279
+ * ```typescript
280
+ * animate(500, keyframes(
281
+ * [
266
282
  * style({ background: "blue" })),
267
283
  * style({ background: "red" }))
268
- * ])
284
+ * ])
269
285
  * ```
270
- *
271
- * {@example core/animation/ts/dsl/animation_example.ts region='Component'}
272
- *
273
- * @experimental Animation support is experimental.
274
286
  */
275
287
  function animate(timings, styles) {
276
288
  if (styles === void 0) { styles = null; }
277
289
  return { type: 4 /* Animate */, styles: styles, timings: timings };
278
290
  }
279
291
  /**
280
- * `group` is an animation-specific function that is designed to be used inside of Angular's
281
- * animation DSL language. If this information is new, please navigate to the {@link
282
- * Component#animations component animations metadata page} to gain a better understanding of
283
- * how animations in Angular are used.
284
- *
285
- * `group` specifies a list of animation steps that are all run in parallel. Grouped animations are
286
- * useful when a series of styles must be animated/closed off at different starting/ending times.
287
- *
288
- * The `group` function can either be used within a {@link sequence sequence} or a {@link transition
289
- * transition} and it will only continue to the next instruction once all of the inner animation
290
- * steps have completed.
291
- *
292
- * ### Usage
292
+ * @description Defines a list of animation steps to be run in parallel.
293
293
  *
294
- * The `steps` data that is passed into the `group` animation function can either consist of {@link
295
- * style style} or {@link animate animate} function calls. Each call to `style()` or `animate()`
296
- * within a group will be executed instantly (use {@link keyframes keyframes} or a {@link
297
- * animate#usage animate() with a delay value} to offset styles to be applied at a later time).
294
+ * @param steps An array of animation step objects.
295
+ * - When steps are defined by `style()` or `animate()`
296
+ * function calls, each call within the group is executed instantly.
297
+ * - To specify offset styles to be applied at a later time, define steps with
298
+ * `keyframes()`, or use `animate()` calls with a delay value.
299
+ * For example:
298
300
  *
299
301
  * ```typescript
300
302
  * group([
@@ -303,36 +305,31 @@ function animate(timings, styles) {
303
305
  * ])
304
306
  * ```
305
307
  *
306
- * {@example core/animation/ts/dsl/animation_example.ts region='Component'}
308
+ * @param options An options object containing a delay and
309
+ * developer-defined parameters that provide styling defaults and
310
+ * can be overridden on invocation.
307
311
  *
308
- * @experimental Animation support is experimental.
312
+ * @return An object that encapsulates the group data.
313
+ *
314
+ * @usageNotes
315
+ * Grouped animations are useful when a series of styles must be
316
+ * animated at different starting times and closed off at different ending times.
317
+ *
318
+ * When called within a `sequence()` or a
319
+ * `transition()` call, does not continue to the next
320
+ * instruction until all of the inner animation steps have completed.
309
321
  */
310
322
  function group(steps, options) {
311
323
  if (options === void 0) { options = null; }
312
324
  return { type: 3 /* Group */, steps: steps, options: options };
313
325
  }
314
326
  /**
315
- * `sequence` is an animation-specific function that is designed to be used inside of Angular's
316
- * animation DSL language. If this information is new, please navigate to the {@link
317
- * Component#animations component animations metadata page} to gain a better understanding of
318
- * how animations in Angular are used.
319
- *
320
- * `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by
321
- * default when an array is passed as animation data into {@link transition transition}.)
322
- *
323
- * The `sequence` function can either be used within a {@link group group} or a {@link transition
324
- * transition} and it will only continue to the next instruction once each of the inner animation
325
- * steps have completed.
326
- *
327
- * To perform animation styling in parallel with other animation steps then have a look at the
328
- * {@link group group} animation function.
329
- *
330
- * ### Usage
327
+ * Defines a list of animation steps to be run sequentially, one by one.
331
328
  *
332
- * The `steps` data that is passed into the `sequence` animation function can either consist of
333
- * {@link style style} or {@link animate animate} function calls. A call to `style()` will apply the
334
- * provided styling data immediately while a call to `animate()` will apply its styling data over a
335
- * given time depending on its timing data.
329
+ * @param steps An array of animation step objects.
330
+ * - Steps defined by `style()` calls apply the styling data immediately.
331
+ * - Steps defined by `animate()` calls apply the styling data over time
332
+ * as specified by the timing data.
336
333
  *
337
334
  * ```typescript
338
335
  * sequence([
@@ -341,131 +338,120 @@ function group(steps, options) {
341
338
  * ])
342
339
  * ```
343
340
  *
344
- * {@example core/animation/ts/dsl/animation_example.ts region='Component'}
341
+ * @param options An options object containing a delay and
342
+ * developer-defined parameters that provide styling defaults and
343
+ * can be overridden on invocation.
345
344
  *
346
- * @experimental Animation support is experimental.
347
- */
345
+ * @return An object that encapsulates the sequence data.
346
+ *
347
+ * @usageNotes
348
+ * When you pass an array of steps to a
349
+ * `transition()` call, the steps run sequentially by default.
350
+ * Compare this to the `{@link animations/group group()}` call, which runs animation steps in parallel.
351
+ *
352
+ * When a sequence is used within a `{@link animations/group group()}` or a `transition()` call,
353
+ * execution continues to the next instruction only after each of the inner animation
354
+ * steps have completed.
355
+ *
356
+ **/
348
357
  function sequence(steps, options) {
349
358
  if (options === void 0) { options = null; }
350
359
  return { type: 2 /* Sequence */, steps: steps, options: options };
351
360
  }
352
361
  /**
353
- * `style` is an animation-specific function that is designed to be used inside of Angular's
354
- * animation DSL language. If this information is new, please navigate to the {@link
355
- * Component#animations component animations metadata page} to gain a better understanding of
356
- * how animations in Angular are used.
362
+ * Declares a key/value object containing CSS properties/styles that
363
+ * can then be used for an animation `state`, within an animation `sequence`,
364
+ * or as styling data for calls to `animate()` and `keyframes()`.
357
365
  *
358
- * `style` declares a key/value object containing CSS properties/styles that can then be used for
359
- * {@link state animation states}, within an {@link sequence animation sequence}, or as styling data
360
- * for both {@link animate animate} and {@link keyframes keyframes}.
366
+ * @param tokens A set of CSS styles or HTML styles associated with an animation state.
367
+ * The value can be any of the following:
368
+ * - A key-value style pair associating a CSS property with a value.
369
+ * - An array of key-value style pairs.
370
+ * - An asterisk (*), to use auto-styling, where styles are derived from the element
371
+ * being animated and applied to the animation when it starts.
361
372
  *
362
- * ### Usage
373
+ * Auto-styling can be used to define a state that depends on layout or other
374
+ * environmental factors.
375
+ *
376
+ * @return An object that encapsulates the style data.
363
377
  *
364
- * `style` takes in a key/value string map as data and expects one or more CSS property/value pairs
365
- * to be defined.
378
+ * @usageNotes
379
+ * The following examples create animation styles that collect a set of
380
+ * CSS property values:
366
381
  *
367
382
  * ```typescript
368
- * // string values are used for css properties
383
+ * // string values for CSS properties
369
384
  * style({ background: "red", color: "blue" })
370
385
  *
371
- * // numerical (pixel) values are also supported
386
+ * // numerical pixel values
372
387
  * style({ width: 100, height: 0 })
373
388
  * ```
374
389
  *
375
- * #### Auto-styles (using `*`)
390
+ * The following example uses auto-styling to allow a component to animate from
391
+ * a height of 0 up to the height of the parent element:
376
392
  *
377
- * When an asterix (`*`) character is used as a value then it will be detected from the element
378
- * being animated and applied as animation data when the animation starts.
379
- *
380
- * This feature proves useful for a state depending on layout and/or environment factors; in such
381
- * cases the styles are calculated just before the animation starts.
382
- *
383
- * ```typescript
384
- * // the steps below will animate from 0 to the
385
- * // actual height of the element
393
+ * ```
386
394
  * style({ height: 0 }),
387
395
  * animate("1s", style({ height: "*" }))
388
396
  * ```
389
397
  *
390
- * {@example core/animation/ts/dsl/animation_example.ts region='Component'}
391
- *
392
- * @experimental Animation support is experimental.
393
- */
398
+ **/
394
399
  function style(tokens) {
395
400
  return { type: 6 /* Style */, styles: tokens, offset: null };
396
401
  }
397
402
  /**
398
- * `state` is an animation-specific function that is designed to be used inside of Angular's
399
- * animation DSL language. If this information is new, please navigate to the {@link
400
- * Component#animations component animations metadata page} to gain a better understanding of
401
- * how animations in Angular are used.
402
- *
403
- * `state` declares an animation state within the given trigger. When a state is active within a
404
- * component then its associated styles will persist on the element that the trigger is attached to
405
- * (even when the animation ends).
406
- *
407
- * To animate between states, have a look at the animation {@link transition transition} DSL
408
- * function. To register states to an animation trigger please have a look at the {@link trigger
409
- * trigger} function.
410
- *
411
- * #### The `void` state
412
- *
413
- * The `void` state value is a reserved word that angular uses to determine when the element is not
414
- * apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the
415
- * associated element is void).
416
- *
417
- * #### The `*` (default) state
418
- *
419
- * The `*` state (when styled) is a fallback state that will be used if the state that is being
420
- * animated is not declared within the trigger.
421
- *
422
- * ### Usage
423
- *
424
- * `state` will declare an animation state with its associated styles
425
- * within the given trigger.
426
- *
427
- * - `stateNameExpr` can be one or more state names separated by commas.
428
- * - `styles` refers to the {@link style styling data} that will be persisted on the element once
429
- * the state has been reached.
430
- *
431
- * ```typescript
432
- * // "void" is a reserved name for a state and is used to represent
433
- * // the state in which an element is detached from from the application.
434
- * state("void", style({ height: 0 }))
435
- *
436
- * // user-defined states
437
- * state("closed", style({ height: 0 }))
438
- * state("open, visible", style({ height: "*" }))
439
- * ```
440
- *
441
- * {@example core/animation/ts/dsl/animation_example.ts region='Component'}
442
- *
443
- * @experimental Animation support is experimental.
444
- */
403
+ * Declares an animation state within a trigger attached to an element.
404
+ *
405
+ * @param name One or more names for the defined state in a comma-separated string.
406
+ * The following reserved state names can be supplied to define a style for specific use
407
+ * cases:
408
+ *
409
+ * - `void` You can associate styles with this name to be used when
410
+ * the element is detached from the application. For example, when an `ngIf` evaluates
411
+ * to false, the state of the associated element is void.
412
+ * - `*` (asterisk) Indicates the default state. You can associate styles with this name
413
+ * to be used as the fallback when the state that is being animated is not declared
414
+ * within the trigger.
415
+ *
416
+ * @param styles A set of CSS styles associated with this state, created using the
417
+ * `style()` function.
418
+ * This set of styles persists on the element once the state has been reached.
419
+ * @param options Parameters that can be passed to the state when it is invoked.
420
+ * 0 or more key-value pairs.
421
+ * @return An object that encapsulates the new state data.
422
+ *
423
+ * @usageNotes
424
+ * Use the `trigger()` function to register states to an animation trigger.
425
+ * Use the `transition()` function to animate between states.
426
+ * When a state is active within a component, its associated styles persist on the element,
427
+ * even when the animation ends.
428
+ **/
445
429
  function state(name, styles, options) {
446
430
  return { type: 0 /* State */, name: name, styles: styles, options: options };
447
431
  }
448
432
  /**
449
- * `keyframes` is an animation-specific function that is designed to be used inside of Angular's
450
- * animation DSL language. If this information is new, please navigate to the {@link
451
- * Component#animations component animations metadata page} to gain a better understanding of
452
- * how animations in Angular are used.
433
+ * Defines a set of animation styles, associating each style with an optional `offset` value.
453
434
  *
454
- * `keyframes` specifies a collection of {@link style style} entries each optionally characterized
455
- * by an `offset` value.
435
+ * @param steps A set of animation styles with optional offset data.
436
+ * The optional `offset` value for a style specifies a percentage of the total animation
437
+ * time at which that style is applied.
438
+ * @returns An object that encapsulates the keyframes data.
456
439
  *
457
- * ### Usage
440
+ * @usageNotes
441
+ * Use with the `animate()` call. Instead of applying animations
442
+ * from the current state
443
+ * to the destination state, keyframes describe how each style entry is applied and at what point
444
+ * within the animation arc.
445
+ * Compare [CSS Keyframe Animations](https://www.w3schools.com/css/css3_animations.asp).
458
446
  *
459
- * The `keyframes` animation function is designed to be used alongside the {@link animate animate}
460
- * animation function. Instead of applying animations from where they are currently to their
461
- * destination, keyframes can describe how each style entry is applied and at what point within the
462
- * animation arc (much like CSS Keyframe Animations do).
447
+ * ### Usage
463
448
  *
464
- * For each `style()` entry an `offset` value can be set. Doing so allows to specify at what
465
- * percentage of the animate time the styles will be applied.
449
+ * In the following example, the offset values describe
450
+ * when each `backgroundColor` value is applied. The color is red at the start, and changes to
451
+ * blue when 20% of the total time has elapsed.
466
452
  *
467
453
  * ```typescript
468
- * // the provided offset values describe when each backgroundColor value is applied.
454
+ * // the provided offset values
469
455
  * animate("5s", keyframes([
470
456
  * style({ backgroundColor: "red", offset: 0 }),
471
457
  * style({ backgroundColor: "blue", offset: 0.2 }),
@@ -474,8 +460,8 @@ function state(name, styles, options) {
474
460
  * ]))
475
461
  * ```
476
462
  *
477
- * Alternatively, if there are no `offset` values used within the style entries then the offsets
478
- * will be calculated automatically.
463
+ * If there are no `offset` values specified in the style entries, the offsets
464
+ * are calculated automatically.
479
465
  *
480
466
  * ```typescript
481
467
  * animate("5s", keyframes([
@@ -484,240 +470,211 @@ function state(name, styles, options) {
484
470
  * style({ backgroundColor: "orange" }) // offset = 0.66
485
471
  * style({ backgroundColor: "black" }) // offset = 1
486
472
  * ]))
487
- * ```
488
- *
489
- * {@example core/animation/ts/dsl/animation_example.ts region='Component'}
490
- *
491
- * @experimental Animation support is experimental.
473
+ *```
492
474
  */
493
475
  function keyframes(steps) {
494
476
  return { type: 5 /* Keyframes */, steps: steps };
495
477
  }
496
478
  /**
497
- * `transition` is an animation-specific function that is designed to be used inside of Angular's
498
- * animation DSL language. If this information is new, please navigate to the {@link
499
- * Component#animations component animations metadata page} to gain a better understanding of
500
- * how animations in Angular are used.
501
- *
502
- * `transition` declares the {@link sequence sequence of animation steps} that will be run when the
503
- * provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 =>
504
- * state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting
505
- * and/or ending state).
506
- *
507
- * A function can also be provided as the `stateChangeExpr` argument for a transition and this
508
- * function will be executed each time a state change occurs. If the value returned within the
509
- * function is true then the associated animation will be run.
510
- *
511
- * Animation transitions are placed within an {@link trigger animation trigger}. For an transition
512
- * to animate to a state value and persist its styles then one or more {@link state animation
513
- * states} is expected to be defined.
479
+ * Declares an animation transition as a sequence of animation steps to run when a given
480
+ * condition is satisfied. The condition is a Boolean expression or function that compares
481
+ * the previous and current animation states, and returns true if this transition should occur.
482
+ * When the state criteria of a defined transition are met, the associated animation is
483
+ * triggered.
514
484
  *
515
- * ### Usage
485
+ * @param stateChangeExpr A Boolean expression or function that compares the previous and current
486
+ * animation states, and returns true if this transition should occur. Note that "true" and "false"
487
+ * match 1 and 0, respectively. An expression is evaluated each time a state change occurs in the
488
+ * animation trigger element.
489
+ * The animation steps run when the expression evaluates to true.
490
+ *
491
+ * - A state-change string takes the form "state1 => state2", where each side is a defined animation
492
+ * state, or an asterix (*) to refer to a dynamic start or end state.
493
+ * - The expression string can contain multiple comma-separated statements;
494
+ * for example "state1 => state2, state3 => state4".
495
+ * - Special values `:enter` and `:leave` initiate a transition on the entry and exit states,
496
+ * equivalent to "void => *" and "* => void".
497
+ * - Special values `:increment` and `:decrement` initiate a transition when a numeric value has
498
+ * increased or decreased in value.
499
+ * - A function is executed each time a state change occurs in the animation trigger element.
500
+ * The animation steps run when the function returns true.
501
+ *
502
+ * @param steps One or more animation objects, as returned by the `animate()` or
503
+ * `sequence()` function, that form a transformation from one state to another.
504
+ * A sequence is used by default when you pass an array.
505
+ * @param options An options object that can contain a delay value for the start of the animation,
506
+ * and additional developer-defined parameters. Provided values for additional parameters are used
507
+ * as defaults, and override values can be passed to the caller on invocation.
508
+ * @returns An object that encapsulates the transition data.
509
+ *
510
+ * @usageNotes
511
+ * The template associated with a component binds an animation trigger to an element.
512
+ *
513
+ * ```HTML
514
+ * <!-- somewhere inside of my-component-tpl.html -->
515
+ * <div [@myAnimationTrigger]="myStatusExp">...</div>
516
+ * ```
516
517
  *
517
- * An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on
518
- * what the previous state is and what the current state has become. In other words, if a transition
519
- * is defined that matches the old/current state criteria then the associated animation will be
520
- * triggered.
518
+ * All transitions are defined within an animation trigger,
519
+ * along with named states that the transitions change to and from.
521
520
  *
522
521
  * ```typescript
523
- * // all transition/state changes are defined within an animation trigger
524
522
  * trigger("myAnimationTrigger", [
525
- * // if a state is defined then its styles will be persisted when the
526
- * // animation has fully completed itself
527
- * state("on", style({ background: "green" })),
528
- * state("off", style({ background: "grey" })),
529
- *
530
- * // a transition animation that will be kicked off when the state value
531
- * // bound to "myAnimationTrigger" changes from "on" to "off"
532
- * transition("on => off", animate(500)),
533
- *
534
- * // it is also possible to do run the same animation for both directions
535
- * transition("on <=> off", animate(500)),
536
- *
537
- * // or to define multiple states pairs separated by commas
538
- * transition("on => off, off => void", animate(500)),
539
- *
540
- * // this is a catch-all state change for when an element is inserted into
541
- * // the page and the destination state is unknown
542
- * transition("void => *", [
543
- * style({ opacity: 0 }),
544
- * animate(500)
545
- * ]),
523
+ * // define states
524
+ * state("on", style({ background: "green" })),
525
+ * state("off", style({ background: "grey" })),
526
+ * ...]
527
+ * ```
546
528
  *
547
- * // this will capture a state change between any states
548
- * transition("* => *", animate("1s 0s")),
529
+ * Note that when you call the `sequence()` function within a `{@link animations/group group()}`
530
+ * or a `transition()` call, execution does not continue to the next instruction
531
+ * until each of the inner animation steps have completed.
549
532
  *
550
- * // you can also go full out and include a function
551
- * transition((fromState, toState) => {
552
- * // when `true` then it will allow the animation below to be invoked
553
- * return fromState == "off" && toState == "on";
554
- * }, animate("1s 0s"))
555
- * ])
556
- * ```
533
+ * ### Syntax examples
557
534
  *
558
- * The template associated with this component will make use of the `myAnimationTrigger` animation
559
- * trigger by binding to an element within its template code.
535
+ * The following examples define transitions between the two defined states (and default states),
536
+ * using various options:
560
537
  *
561
- * ```html
562
- * <!-- somewhere inside of my-component-tpl.html -->
563
- * <div [@myAnimationTrigger]="myStatusExp">...</div>
538
+ * ```typescript
539
+ * // Transition occurs when the state value
540
+ * // bound to "myAnimationTrigger" changes from "on" to "off"
541
+ * transition("on => off", animate(500))
542
+ * // Run the same animation for both directions
543
+ * transition("on <=> off", animate(500))
544
+ * // Define multiple state-change pairs separated by commas
545
+ * transition("on => off, off => void", animate(500))
564
546
  * ```
565
547
  *
566
- * #### The final `animate` call
548
+ * ### Special values for state-change expressions
567
549
  *
568
- * If the final step within the transition steps is a call to `animate()` that **only** uses a
569
- * timing value with **no style data** then it will be automatically used as the final animation arc
570
- * for the element to animate itself to the final state. This involves an automatic mix of
571
- * adding/removing CSS styles so that the element will be in the exact state it should be for the
572
- * applied state to be presented correctly.
550
+ * - Catch-all state change for when an element is inserted into the page and the
551
+ * destination state is unknown:
573
552
  *
574
- * ```
575
- * // start off by hiding the element, but make sure that it animates properly to whatever state
576
- * // is currently active for "myAnimationTrigger"
553
+ * ```typescript
577
554
  * transition("void => *", [
578
- * style({ opacity: 0 }),
579
- * animate(500)
580
- * ])
555
+ * style({ opacity: 0 }),
556
+ * animate(500)
557
+ * ])
581
558
  * ```
582
559
  *
583
- * ### Using :enter and :leave
560
+ * - Capture a state change between any states:
584
561
  *
585
- * Given that enter (insertion) and leave (removal) animations are so common, the `transition`
586
- * function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `*
587
- * => void` state changes.
562
+ * `transition("* => *", animate("1s 0s"))`
588
563
  *
589
- * ```
564
+ * - Entry and exit transitions:
565
+ *
566
+ * ```typescript
590
567
  * transition(":enter", [
591
568
  * style({ opacity: 0 }),
592
569
  * animate(500, style({ opacity: 1 }))
593
- * ]),
570
+ * ]),
594
571
  * transition(":leave", [
595
572
  * animate(500, style({ opacity: 0 }))
596
- * ])
573
+ * ])
597
574
  * ```
598
575
  *
599
- * ### Boolean values
600
- * if a trigger binding value is a boolean value then it can be matched using a transition
601
- * expression that compares `true` and `false` or `1` and `0`.
576
+ * - Use `:increment` and `:decrement` to initiate transitions:
602
577
  *
603
- * ```
604
- * // in the template
605
- * <div [@openClose]="open ? true : false">...</div>
578
+ * ```typescript
579
+ * transition(":increment", group([
580
+ * query(':enter', [
581
+ * style({ left: '100%' }),
582
+ * animate('0.5s ease-out', style('*'))
583
+ * ]),
584
+ * query(':leave', [
585
+ * animate('0.5s ease-out', style({ left: '-100%' }))
586
+ * ])
587
+ * ]))
606
588
  *
607
- * // in the component metadata
608
- * trigger('openClose', [
609
- * state('true', style({ height: '*' })),
610
- * state('false', style({ height: '0px' })),
611
- * transition('false <=> true', animate(500))
612
- * ])
589
+ * transition(":decrement", group([
590
+ * query(':enter', [
591
+ * style({ left: '100%' }),
592
+ * animate('0.5s ease-out', style('*'))
593
+ * ]),
594
+ * query(':leave', [
595
+ * animate('0.5s ease-out', style({ left: '-100%' }))
596
+ * ])
597
+ * ]))
613
598
  * ```
614
599
  *
615
- * ### Using :increment and :decrement
616
- * In addition to the :enter and :leave transition aliases, the :increment and :decrement aliases
617
- * can be used to kick off a transition when a numeric value has increased or decreased in value.
600
+ * ### State-change functions
601
+ *
602
+ * Here is an example of a `fromState` specified as a state-change function that invokes an
603
+ * animation when true:
618
604
  *
605
+ * ```typescript
606
+ * transition((fromState, toState) =>
607
+ * {
608
+ * return fromState == "off" && toState == "on";
609
+ * },
610
+ * animate("1s 0s"))
619
611
  * ```
620
- * import {group, animate, query, transition, style, trigger} from '@angular/animations';
621
- * import {Component} from '@angular/core';
622
612
  *
623
- * @Component({
624
- * selector: 'banner-carousel-component',
625
- * styles: [`
626
- * .banner-container {
627
- * position:relative;
628
- * height:500px;
629
- * overflow:hidden;
630
- * }
631
- * .banner-container > .banner {
632
- * position:absolute;
633
- * left:0;
634
- * top:0;
635
- * font-size:200px;
636
- * line-height:500px;
637
- * font-weight:bold;
638
- * text-align:center;
639
- * width:100%;
640
- * }
641
- * `],
642
- * template: `
643
- * <button (click)="previous()">Previous</button>
644
- * <button (click)="next()">Next</button>
645
- * <hr>
646
- * <div [@bannerAnimation]="selectedIndex" class="banner-container">
647
- * <div class="banner" *ngFor="let banner of banners"> {{ banner }} </div>
648
- * </div>
649
- * `,
650
- * animations: [
651
- * trigger('bannerAnimation', [
652
- * transition(":increment", group([
653
- * query(':enter', [
654
- * style({ left: '100%' }),
655
- * animate('0.5s ease-out', style('*'))
656
- * ]),
657
- * query(':leave', [
658
- * animate('0.5s ease-out', style({ left: '-100%' }))
659
- * ])
660
- * ])),
661
- * transition(":decrement", group([
662
- * query(':enter', [
663
- * style({ left: '-100%' }),
664
- * animate('0.5s ease-out', style('*'))
665
- * ]),
666
- * query(':leave', [
667
- * animate('0.5s ease-out', style({ left: '100%' }))
668
- * ])
669
- * ]))
670
- * ])
671
- * ]
672
- * })
673
- * class BannerCarouselComponent {
674
- * allBanners: string[] = ['1', '2', '3', '4'];
675
- * selectedIndex: number = 0;
613
+ * ### Animating to the final state
676
614
  *
677
- * get banners() {
678
- * return [this.allBanners[this.selectedIndex]];
679
- * }
615
+ * If the final step in a transition is a call to `animate()` that uses a timing value
616
+ * with no style data, that step is automatically considered the final animation arc,
617
+ * for the element to reach the final state. Angular automatically adds or removes
618
+ * CSS styles to ensure that the element is in the correct final state.
680
619
  *
681
- * previous() {
682
- * this.selectedIndex = Math.max(this.selectedIndex - 1, 0);
683
- * }
620
+ * The following example defines a transition that starts by hiding the element,
621
+ * then makes sure that it animates properly to whatever state is currently active for trigger:
684
622
  *
685
- * next() {
686
- * this.selectedIndex = Math.min(this.selectedIndex + 1, this.allBanners.length - 1);
687
- * }
688
- * }
623
+ * ```typescript
624
+ * transition("void => *", [
625
+ * style({ opacity: 0 }),
626
+ * animate(500)
627
+ * ])
689
628
  * ```
629
+ * ### Boolean value matching
630
+ * If a trigger binding value is a Boolean, it can be matched using a transition expression
631
+ * that compares true and false or 1 and 0. For example:
690
632
  *
691
- * {@example core/animation/ts/dsl/animation_example.ts region='Component'}
692
- *
693
- * @experimental Animation support is experimental.
694
- */
633
+ * ```
634
+ * // in the template
635
+ * <div [@openClose]="open ? true : false">...</div>
636
+ * // in the component metadata
637
+ * trigger('openClose', [
638
+ * state('true', style({ height: '*' })),
639
+ * state('false', style({ height: '0px' })),
640
+ * transition('false <=> true', animate(500))
641
+ * ])
642
+ * ```
643
+ **/
695
644
  function transition(stateChangeExpr, steps, options) {
696
645
  if (options === void 0) { options = null; }
697
646
  return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps, options: options };
698
647
  }
699
648
  /**
700
- * `animation` is an animation-specific function that is designed to be used inside of Angular's
701
- * animation DSL language.
649
+ * Produces a reusable animation that can be invoked in another animation or sequence,
650
+ * by calling the `useAnimation()` function.
651
+ *
652
+ * @param steps One or more animation objects, as returned by the `animate()`
653
+ * or `sequence()` function, that form a transformation from one state to another.
654
+ * A sequence is used by default when you pass an array.
655
+ * @param options An options object that can contain a delay value for the start of the
656
+ * animation, and additional developer-defined parameters.
657
+ * Provided values for additional parameters are used as defaults,
658
+ * and override values can be passed to the caller on invocation.
659
+ * @returns An object that encapsulates the animation data.
660
+ *
661
+ * @usageNotes
662
+ * The following example defines a reusable animation, providing some default parameter
663
+ * values.
702
664
  *
703
- * `var myAnimation = animation(...)` is designed to produce a reusable animation that can be later
704
- * invoked in another animation or sequence. Reusable animations are designed to make use of
705
- * animation parameters and the produced animation can be used via the `useAnimation` method.
706
- *
707
- * ```
665
+ * ```typescript
708
666
  * var fadeAnimation = animation([
709
667
  * style({ opacity: '{{ start }}' }),
710
668
  * animate('{{ time }}',
711
- * style({ opacity: '{{ end }}'}))
712
- * ], { params: { time: '1000ms', start: 0, end: 1 }});
669
+ * style({ opacity: '{{ end }}'}))
670
+ * ],
671
+ * { params: { time: '1000ms', start: 0, end: 1 }});
713
672
  * ```
714
673
  *
715
- * If parameters are attached to an animation then they act as **default parameter values**. When an
716
- * animation is invoked via `useAnimation` then parameter values are allowed to be passed in
717
- * directly. If any of the passed in parameter values are missing then the default values will be
718
- * used.
674
+ * The following invokes the defined animation with a call to `useAnimation()`,
675
+ * passing in override parameter values.
719
676
  *
720
- * ```
677
+ * ```js
721
678
  * useAnimation(fadeAnimation, {
722
679
  * params: {
723
680
  * time: '2s',
@@ -727,140 +684,75 @@ function transition(stateChangeExpr, steps, options) {
727
684
  * })
728
685
  * ```
729
686
  *
730
- * If one or more parameter values are missing before animated then an error will be thrown.
731
- *
732
- * @experimental Animation support is experimental.
687
+ * If any of the passed-in parameter values are missing from this call,
688
+ * the default values are used. If one or more parameter values are missing before a step is
689
+ * animated, `useAnimation()` throws an error.
733
690
  */
734
691
  function animation(steps, options) {
735
692
  if (options === void 0) { options = null; }
736
693
  return { type: 8 /* Reference */, animation: steps, options: options };
737
694
  }
738
695
  /**
739
- * `animateChild` is an animation-specific function that is designed to be used inside of Angular's
740
- * animation DSL language. It works by allowing a queried element to execute its own
741
- * animation within the animation sequence.
742
- *
743
- * Each time an animation is triggered in angular, the parent animation
744
- * will always get priority and any child animations will be blocked. In order
745
- * for a child animation to run, the parent animation must query each of the elements
746
- * containing child animations and then allow the animations to run using `animateChild`.
747
- *
748
- * The example HTML code below shows both parent and child elements that have animation
749
- * triggers that will execute at the same time.
750
- *
751
- * ```html
752
- * <!-- parent-child.component.html -->
753
- * <button (click)="exp =! exp">Toggle</button>
754
- * <hr>
755
- *
756
- * <div [@parentAnimation]="exp">
757
- * <header>Hello</header>
758
- * <div [@childAnimation]="exp">
759
- * one
760
- * </div>
761
- * <div [@childAnimation]="exp">
762
- * two
763
- * </div>
764
- * <div [@childAnimation]="exp">
765
- * three
766
- * </div>
767
- * </div>
768
- * ```
696
+ * Executes a queried inner animation element within an animation sequence.
769
697
  *
770
- * Now when the `exp` value changes to true, only the `parentAnimation` animation will animate
771
- * because it has priority. However, using `query` and `animateChild` each of the inner animations
772
- * can also fire:
698
+ * @param options An options object that can contain a delay value for the start of the
699
+ * animation, and additional override values for developer-defined parameters.
700
+ * @return An object that encapsulates the child animation data.
773
701
  *
774
- * ```ts
775
- * // parent-child.component.ts
776
- * import {trigger, transition, animate, style, query, animateChild} from '@angular/animations';
777
- * @Component({
778
- * selector: 'parent-child-component',
779
- * animations: [
780
- * trigger('parentAnimation', [
781
- * transition('false => true', [
782
- * query('header', [
783
- * style({ opacity: 0 }),
784
- * animate(500, style({ opacity: 1 }))
785
- * ]),
786
- * query('@childAnimation', [
787
- * animateChild()
788
- * ])
789
- * ])
790
- * ]),
791
- * trigger('childAnimation', [
792
- * transition('false => true', [
793
- * style({ opacity: 0 }),
794
- * animate(500, style({ opacity: 1 }))
795
- * ])
796
- * ])
797
- * ]
798
- * })
799
- * class ParentChildCmp {
800
- * exp: boolean = false;
801
- * }
802
- * ```
803
- *
804
- * In the animation code above, when the `parentAnimation` transition kicks off it first queries to
805
- * find the header element and fades it in. It then finds each of the sub elements that contain the
806
- * `@childAnimation` trigger and then allows for their animations to fire.
807
- *
808
- * This example can be further extended by using stagger:
809
- *
810
- * ```ts
811
- * query('@childAnimation', stagger(100, [
812
- * animateChild()
813
- * ]))
814
- * ```
815
- *
816
- * Now each of the sub animations start off with respect to the `100ms` staggering step.
817
- *
818
- * ## The first frame of child animations
819
- * When sub animations are executed using `animateChild` the animation engine will always apply the
820
- * first frame of every sub animation immediately at the start of the animation sequence. This way
821
- * the parent animation does not need to set any initial styling data on the sub elements before the
822
- * sub animations kick off.
823
- *
824
- * In the example above the first frame of the `childAnimation`'s `false => true` transition
825
- * consists of a style of `opacity: 0`. This is applied immediately when the `parentAnimation`
826
- * animation transition sequence starts. Only then when the `@childAnimation` is queried and called
827
- * with `animateChild` will it then animate to its destination of `opacity: 1`.
828
- *
829
- * Note that this feature designed to be used alongside {@link query query()} and it will only work
830
- * with animations that are assigned using the Angular animation DSL (this means that CSS keyframes
831
- * and transitions are not handled by this API).
702
+ * @usageNotes
703
+ * Each time an animation is triggered in Angular, the parent animation
704
+ * has priority and any child animations are blocked. In order
705
+ * for a child animation to run, the parent animation must query each of the elements
706
+ * containing child animations, and run them using this function.
832
707
  *
833
- * @experimental Animation support is experimental.
708
+ * Note that this feature designed to be used with `query()` and it will only work
709
+ * with animations that are assigned using the Angular animation library. CSS keyframes
710
+ * and transitions are not handled by this API.
834
711
  */
835
712
  function animateChild(options) {
836
713
  if (options === void 0) { options = null; }
837
714
  return { type: 9 /* AnimateChild */, options: options };
838
715
  }
839
716
  /**
840
- * `useAnimation` is an animation-specific function that is designed to be used inside of Angular's
841
- * animation DSL language. It is used to kick off a reusable animation that is created using {@link
842
- * animation animation()}.
717
+ * Starts a reusable animation that is created using the `animation()` function.
843
718
  *
844
- * @experimental Animation support is experimental.
719
+ * @param animation The reusable animation to start.
720
+ * @param options An options object that can contain a delay value for the start of
721
+ * the animation, and additional override values for developer-defined parameters.
722
+ * @return An object that contains the animation parameters.
845
723
  */
846
724
  function useAnimation(animation, options) {
847
725
  if (options === void 0) { options = null; }
848
726
  return { type: 10 /* AnimateRef */, animation: animation, options: options };
849
727
  }
850
728
  /**
851
- * `query` is an animation-specific function that is designed to be used inside of Angular's
852
- * animation DSL language.
853
- *
854
- * query() is used to find one or more inner elements within the current element that is
855
- * being animated within the sequence. The provided animation steps are applied
856
- * to the queried element (by default, an array is provided, then this will be
857
- * treated as an animation sequence).
729
+ * Finds one or more inner elements within the current element that is
730
+ * being animated within a sequence. Use with `animateChild()`.
731
+ *
732
+ * @param selector The element to query, or a set of elements that contain Angular-specific
733
+ * characteristics, specified with one or more of the following tokens.
734
+ * - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements.
735
+ * - `query(":animating")` : Query all currently animating elements.
736
+ * - `query("@triggerName")` : Query elements that contain an animation trigger.
737
+ * - `query("@*")` : Query all elements that contain an animation triggers.
738
+ * - `query(":self")` : Include the current element into the animation sequence.
739
+ *
740
+ * @param animation One or more animation steps to apply to the queried element or elements.
741
+ * An array is treated as an animation sequence.
742
+ * @param options An options object. Use the 'limit' field to limit the total number of
743
+ * items to collect.
744
+ * @return An object that encapsulates the query data.
745
+ *
746
+ * @usageNotes
747
+ * Tokens can be merged into a combined query selector string. For example:
858
748
  *
859
- * ### Usage
749
+ * ```typescript
750
+ * query(':self, .record:enter, .record:leave, @subTrigger', [...])
751
+ * ```
860
752
  *
861
- * query() is designed to collect multiple elements and works internally by using
862
- * `element.querySelectorAll`. An additional options object can be provided which
863
- * can be used to limit the total amount of items to be collected.
753
+ * The `query()` function collects multiple elements and works internally by using
754
+ * `element.querySelectorAll`. Use the `limit` field of an options object to limit
755
+ * the total number of items to be collected. For example:
864
756
  *
865
757
  * ```js
866
758
  * query('div', [
@@ -869,8 +761,8 @@ function useAnimation(animation, options) {
869
761
  * ], { limit: 1 })
870
762
  * ```
871
763
  *
872
- * query(), by default, will throw an error when zero items are found. If a query
873
- * has the `optional` flag set to true then this error will be ignored.
764
+ * By default, throws an error when zero items are found. Set the
765
+ * `optional` flag to ignore this error. For example:
874
766
  *
875
767
  * ```js
876
768
  * query('.some-element-that-may-not-be-there', [
@@ -879,31 +771,12 @@ function useAnimation(animation, options) {
879
771
  * ], { optional: true })
880
772
  * ```
881
773
  *
882
- * ### Special Selector Values
883
- *
884
- * The selector value within a query can collect elements that contain angular-specific
885
- * characteristics
886
- * using special pseudo-selectors tokens.
887
- *
888
- * These include:
889
- *
890
- * - Querying for newly inserted/removed elements using `query(":enter")`/`query(":leave")`
891
- * - Querying all currently animating elements using `query(":animating")`
892
- * - Querying elements that contain an animation trigger using `query("@triggerName")`
893
- * - Querying all elements that contain an animation triggers using `query("@*")`
894
- * - Including the current element into the animation sequence using `query(":self")`
895
- *
896
- *
897
- * Each of these pseudo-selector tokens can be merged together into a combined query selector
898
- * string:
899
- *
900
- * ```
901
- * query(':self, .record:enter, .record:leave, @subTrigger', [...])
902
- * ```
774
+ * ### Usage Example
903
775
  *
904
- * ### Demo
776
+ * The following example queries for inner elements and animates them
777
+ * individually using `animateChild()`.
905
778
  *
906
- * ```
779
+ * ```typescript
907
780
  * @Component({
908
781
  * selector: 'inner',
909
782
  * template: `
@@ -936,24 +809,29 @@ function useAnimation(animation, options) {
936
809
  * }
937
810
  * }
938
811
  * ```
939
- *
940
- * @experimental Animation support is experimental.
941
812
  */
942
813
  function query(selector, animation, options) {
943
814
  if (options === void 0) { options = null; }
944
815
  return { type: 11 /* Query */, selector: selector, animation: animation, options: options };
945
816
  }
946
817
  /**
947
- * `stagger` is an animation-specific function that is designed to be used inside of Angular's
948
- * animation DSL language. It is designed to be used inside of an animation {@link query query()}
949
- * and works by issuing a timing gap between after each queried item is animated.
818
+ * Use within an animation `query()` call to issue a timing gap after
819
+ * each queried item is animated.
950
820
  *
951
- * ### Usage
821
+ * @param timings A delay value.
822
+ * @param animation One ore more animation steps.
823
+ * @returns An object that encapsulates the stagger data.
952
824
  *
953
- * In the example below there is a container element that wraps a list of items stamped out
954
- * by an ngFor. The container element contains an animation trigger that will later be set
825
+ * @usageNotes
826
+ * In the following example, a container element wraps a list of items stamped out
827
+ * by an `ngFor`. The container element contains an animation trigger that will later be set
955
828
  * to query for each of the inner items.
956
829
  *
830
+ * Each time items are added, the opacity fade-in animation runs,
831
+ * and each removed item is faded out.
832
+ * When either of these animations occur, the stagger effect is
833
+ * applied after each item's animation is started.
834
+ *
957
835
  * ```html
958
836
  * <!-- list.component.html -->
959
837
  * <button (click)="toggle()">Show / Hide Items</button>
@@ -965,15 +843,15 @@ function query(selector, animation, options) {
965
843
  * </div>
966
844
  * ```
967
845
  *
968
- * The component code for this looks as such:
846
+ * Here is the component code:
969
847
  *
970
- * ```ts
848
+ * ```typescript
971
849
  * import {trigger, transition, style, animate, query, stagger} from '@angular/animations';
972
850
  * @Component({
973
851
  * templateUrl: 'list.component.html',
974
852
  * animations: [
975
853
  * trigger('listAnimation', [
976
- * //...
854
+ * ...
977
855
  * ])
978
856
  * ]
979
857
  * })
@@ -990,13 +868,13 @@ function query(selector, animation, options) {
990
868
  *
991
869
  * toggle() {
992
870
  * this.items.length ? this.hideItems() : this.showItems();
993
- * }
994
- * }
871
+ * }
872
+ * }
995
873
  * ```
996
874
  *
997
- * And now for the animation trigger code:
875
+ * Here is the animation trigger code:
998
876
  *
999
- * ```ts
877
+ * ```typescript
1000
878
  * trigger('listAnimation', [
1001
879
  * transition('* => *', [ // each time the binding value changes
1002
880
  * query(':leave', [
@@ -1013,13 +891,6 @@ function query(selector, animation, options) {
1013
891
  * ])
1014
892
  * ])
1015
893
  * ```
1016
- *
1017
- * Now each time the items are added/removed then either the opacity
1018
- * fade-in animation will run or each removed item will be faded out.
1019
- * When either of these animations occur then a stagger effect will be
1020
- * applied after each item's animation is started.
1021
- *
1022
- * @experimental Animation support is experimental.
1023
894
  */
1024
895
  function stagger(timings, animation) {
1025
896
  return { type: 12 /* Stagger */, timings: timings, animation: animation };
@@ -1036,6 +907,13 @@ function scheduleMicroTask(cb) {
1036
907
  Promise.resolve(null).then(cb);
1037
908
  }
1038
909
 
910
+ /**
911
+ * @license
912
+ * Copyright Google Inc. All Rights Reserved.
913
+ *
914
+ * Use of this source code is governed by an MIT-style license that can be
915
+ * found in the LICENSE file at https://angular.io/license
916
+ */
1039
917
  /**
1040
918
  * @experimental Animation support is experimental.
1041
919
  */
@@ -1072,9 +950,7 @@ var NoopAnimationPlayer = /** @class */ (function () {
1072
950
  this._started = true;
1073
951
  };
1074
952
  /* @internal */
1075
- /* @internal */
1076
- NoopAnimationPlayer.prototype.triggerMicrotask = /* @internal */
1077
- function () {
953
+ NoopAnimationPlayer.prototype.triggerMicrotask = function () {
1078
954
  var _this = this;
1079
955
  scheduleMicroTask(function () { return _this._onFinish(); });
1080
956
  };
@@ -1100,9 +976,7 @@ var NoopAnimationPlayer = /** @class */ (function () {
1100
976
  NoopAnimationPlayer.prototype.setPosition = function (p) { };
1101
977
  NoopAnimationPlayer.prototype.getPosition = function () { return 0; };
1102
978
  /* @internal */
1103
- /* @internal */
1104
- NoopAnimationPlayer.prototype.triggerCallback = /* @internal */
1105
- function (phaseName) {
979
+ NoopAnimationPlayer.prototype.triggerCallback = function (phaseName) {
1106
980
  var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
1107
981
  methods.forEach(function (fn) { return fn(); });
1108
982
  methods.length = 0;
@@ -1228,9 +1102,7 @@ var AnimationGroupPlayer = /** @class */ (function () {
1228
1102
  });
1229
1103
  };
1230
1104
  /* @internal */
1231
- /* @internal */
1232
- AnimationGroupPlayer.prototype.triggerCallback = /* @internal */
1233
- function (phaseName) {
1105
+ AnimationGroupPlayer.prototype.triggerCallback = function (phaseName) {
1234
1106
  var methods = phaseName == 'start' ? this._onStartFns : this._onDoneFns;
1235
1107
  methods.forEach(function (fn) { return fn(); });
1236
1108
  methods.length = 0;
@@ -1238,6 +1110,13 @@ var AnimationGroupPlayer = /** @class */ (function () {
1238
1110
  return AnimationGroupPlayer;
1239
1111
  }());
1240
1112
 
1113
+ /**
1114
+ * @license
1115
+ * Copyright Google Inc. All Rights Reserved.
1116
+ *
1117
+ * Use of this source code is governed by an MIT-style license that can be
1118
+ * found in the LICENSE file at https://angular.io/license
1119
+ */
1241
1120
  var ɵPRE_STYLE = '!';
1242
1121
 
1243
1122
  /**
@@ -1247,6 +1126,11 @@ var ɵPRE_STYLE = '!';
1247
1126
  * Use of this source code is governed by an MIT-style license that can be
1248
1127
  * found in the LICENSE file at https://angular.io/license
1249
1128
  */
1129
+ /**
1130
+ * @module
1131
+ * @description
1132
+ * Entry point for all animation APIs of the animation package.
1133
+ */
1250
1134
 
1251
1135
  /**
1252
1136
  * @license
@@ -1255,6 +1139,11 @@ var ɵPRE_STYLE = '!';
1255
1139
  * Use of this source code is governed by an MIT-style license that can be
1256
1140
  * found in the LICENSE file at https://angular.io/license
1257
1141
  */
1142
+ /**
1143
+ * @module
1144
+ * @description
1145
+ * Entry point for all public APIs of this package.
1146
+ */
1258
1147
 
1259
1148
  /**
1260
1149
  * @license
@@ -1263,6 +1152,10 @@ var ɵPRE_STYLE = '!';
1263
1152
  * Use of this source code is governed by an MIT-style license that can be
1264
1153
  * found in the LICENSE file at https://angular.io/license
1265
1154
  */
1155
+ // This file is not used to build this module. It is only used during editing
1156
+ // by the TypeScript language service and during build for verification. `ngc`
1157
+ // replaces this file with production index.ts when it rewrites private symbol
1158
+ // names.
1266
1159
 
1267
1160
  /**
1268
1161
  * Generated bundle index. Do not edit.