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