@angular/animations 13.1.0-next.3 → 13.2.0-next.1

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 (30) hide show
  1. package/animations.d.ts +151 -148
  2. package/browser/browser.d.ts +9 -8
  3. package/browser/testing/testing.d.ts +2 -2
  4. package/esm2020/browser/src/dsl/animation_ast_builder.mjs +1 -1
  5. package/esm2020/browser/src/dsl/animation_timeline_builder.mjs +2 -2
  6. package/esm2020/browser/src/dsl/element_instruction_map.mjs +3 -10
  7. package/esm2020/browser/src/private_export.mjs +2 -2
  8. package/esm2020/browser/src/render/animation_driver.mjs +8 -7
  9. package/esm2020/browser/src/render/css_keyframes/css_keyframes_driver.mjs +5 -4
  10. package/esm2020/browser/src/render/shared.mjs +1 -19
  11. package/esm2020/browser/src/render/transition_animation_engine.mjs +12 -32
  12. package/esm2020/browser/src/render/web_animations/web_animations_driver.mjs +5 -4
  13. package/esm2020/browser/src/render/web_animations/web_animations_player.mjs +7 -4
  14. package/esm2020/browser/src/util.mjs +1 -3
  15. package/esm2020/browser/testing/src/mock_animation_driver.mjs +4 -4
  16. package/esm2020/src/animation_metadata.mjs +151 -148
  17. package/esm2020/src/version.mjs +3 -16
  18. package/fesm2015/animations.mjs +151 -148
  19. package/fesm2015/animations.mjs.map +1 -1
  20. package/fesm2015/browser/testing.mjs +4 -4
  21. package/fesm2015/browser/testing.mjs.map +1 -1
  22. package/fesm2015/browser.mjs +37 -75
  23. package/fesm2015/browser.mjs.map +1 -1
  24. package/fesm2020/animations.mjs +151 -148
  25. package/fesm2020/animations.mjs.map +1 -1
  26. package/fesm2020/browser/testing.mjs +4 -4
  27. package/fesm2020/browser/testing.mjs.map +1 -1
  28. package/fesm2020/browser.mjs +34 -75
  29. package/fesm2020/browser.mjs.map +1 -1
  30. package/package.json +2 -2
package/animations.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.1.0-next.3
2
+ * @license Angular v13.2.0-next.1
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -936,7 +936,9 @@ export declare class NoopAnimationPlayer implements AnimationPlayer {
936
936
  *
937
937
  * @param selector The element to query, or a set of elements that contain Angular-specific
938
938
  * characteristics, specified with one or more of the following tokens.
939
- * - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements.
939
+ * - `query(":enter")` or `query(":leave")` : Query for newly inserted/removed elements (not
940
+ * all elements can be queried via these tokens, see
941
+ * [Entering and Leaving Elements](#entering-and-leaving-elements))
940
942
  * - `query(":animating")` : Query all currently animating elements.
941
943
  * - `query("@triggerName")` : Query elements that contain an animation trigger.
942
944
  * - `query("@*")` : Query all elements that contain an animation triggers.
@@ -949,6 +951,9 @@ export declare class NoopAnimationPlayer implements AnimationPlayer {
949
951
  * @return An object that encapsulates the query data.
950
952
  *
951
953
  * @usageNotes
954
+ *
955
+ * ### Multiple Tokens
956
+ *
952
957
  * Tokens can be merged into a combined query selector string. For example:
953
958
  *
954
959
  * ```typescript
@@ -976,6 +981,26 @@ export declare class NoopAnimationPlayer implements AnimationPlayer {
976
981
  * ], { optional: true })
977
982
  * ```
978
983
  *
984
+ * ### Entering and Leaving Elements
985
+ *
986
+ * Not all elements can be queried via the `:enter` and `:leave` tokens, the only ones
987
+ * that can are those that Angular assumes can enter/leave based on their own logic
988
+ * (if their insertion/removal is simply a consequence of that of their parent they
989
+ * should be queried via a different token in their parent's `:enter`/`:leave` transitions).
990
+ *
991
+ * The only elements Angular assumes can enter/leave on their own logic (thus the only
992
+ * ones that can be queried via the `:enter` and `:leave` tokens) are:
993
+ * - Those inserted dynamically (via `ViewContainerRef`)
994
+ * - Those that have a structural directive (which, under the hood, are a subset of the above ones)
995
+ *
996
+ * <div class="alert is-helpful">
997
+ *
998
+ * Note that elements will be successfully queried via `:enter`/`:leave` even if their
999
+ * insertion/removal is not done manually via `ViewContainerRef`or caused by their structural
1000
+ * directive (e.g. they enter/exit alongside their parent).
1001
+ *
1002
+ * </div>
1003
+ *
979
1004
  * ### Usage Example
980
1005
  *
981
1006
  * The following example queries for inner elements and animates them
@@ -1217,170 +1242,148 @@ export declare function style(tokens: '*' | {
1217
1242
  }>): AnimationStyleMetadata;
1218
1243
 
1219
1244
  /**
1220
- * Declares an animation transition as a sequence of animation steps to run when a given
1221
- * condition is satisfied. The condition is a Boolean expression or function that compares
1222
- * the previous and current animation states, and returns true if this transition should occur.
1223
- * When the state criteria of a defined transition are met, the associated animation is
1224
- * triggered.
1225
- *
1226
- * @param stateChangeExpr A Boolean expression or function that compares the previous and current
1227
- * animation states, and returns true if this transition should occur. Note that "true" and "false"
1228
- * match 1 and 0, respectively. An expression is evaluated each time a state change occurs in the
1229
- * animation trigger element.
1230
- * The animation steps run when the expression evaluates to true.
1231
- *
1232
- * - A state-change string takes the form "state1 => state2", where each side is a defined animation
1233
- * state, or an asterisk (*) to refer to a dynamic start or end state.
1234
- * - The expression string can contain multiple comma-separated statements;
1235
- * for example "state1 => state2, state3 => state4".
1236
- * - Special values `:enter` and `:leave` initiate a transition on the entry and exit states,
1237
- * equivalent to "void => *" and "* => void".
1238
- * - Special values `:increment` and `:decrement` initiate a transition when a numeric value has
1239
- * increased or decreased in value.
1240
- * - A function is executed each time a state change occurs in the animation trigger element.
1241
- * The animation steps run when the function returns true.
1242
- *
1243
- * @param steps One or more animation objects, as returned by the `animate()` or
1244
- * `sequence()` function, that form a transformation from one state to another.
1245
- * A sequence is used by default when you pass an array.
1246
- * @param options An options object that can contain a delay value for the start of the animation,
1247
- * and additional developer-defined parameters. Provided values for additional parameters are used
1248
- * as defaults, and override values can be passed to the caller on invocation.
1249
- * @returns An object that encapsulates the transition data.
1245
+ * Declares an animation transition which is played when a certain specified condition is met.
1250
1246
  *
1251
- * @usageNotes
1252
- * The template associated with a component binds an animation trigger to an element.
1247
+ * @param stateChangeExpr A string with a specific format or a function that specifies when the
1248
+ * animation transition should occur (see [State Change Expression](#state-change-expression)).
1253
1249
  *
1254
- * ```HTML
1255
- * <!-- somewhere inside of my-component-tpl.html -->
1256
- * <div [@myAnimationTrigger]="myStatusExp">...</div>
1257
- * ```
1250
+ * @param steps One or more animation objects that represent the animation's instructions.
1258
1251
  *
1259
- * All transitions are defined within an animation trigger,
1260
- * along with named states that the transitions change to and from.
1252
+ * @param options An options object that can be used to specify a delay for the animation or provide
1253
+ * custom parameters for it.
1261
1254
  *
1262
- * ```typescript
1263
- * trigger("myAnimationTrigger", [
1264
- * // define states
1265
- * state("on", style({ background: "green" })),
1266
- * state("off", style({ background: "grey" })),
1267
- * ...]
1268
- * ```
1255
+ * @returns An object that encapsulates the transition data.
1269
1256
  *
1270
- * Note that when you call the `sequence()` function within a `{@link animations/group group()}`
1271
- * or a `transition()` call, execution does not continue to the next instruction
1272
- * until each of the inner animation steps have completed.
1257
+ * @usageNotes
1273
1258
  *
1274
- * ### Syntax examples
1259
+ * ### State Change Expression
1260
+ *
1261
+ * The State Change Expression instructs Angular when to run the transition's animations, it can
1262
+ *either be
1263
+ * - a string with a specific syntax
1264
+ * - or a function that compares the previous and current state (value of the expression bound to
1265
+ * the element's trigger) and returns `true` if the transition should occur or `false` otherwise
1266
+ *
1267
+ * The string format can be:
1268
+ * - `fromState => toState`, which indicates that the transition's animations should occur then the
1269
+ * expression bound to the trigger's element goes from `fromState` to `toState`
1270
+ *
1271
+ * _Example:_
1272
+ * ```typescript
1273
+ * transition('open => closed', animate('.5s ease-out', style({ height: 0 }) ))
1274
+ * ```
1275
+ *
1276
+ * - `fromState <=> toState`, which indicates that the transition's animations should occur then
1277
+ * the expression bound to the trigger's element goes from `fromState` to `toState` or vice versa
1278
+ *
1279
+ * _Example:_
1280
+ * ```typescript
1281
+ * transition('enabled <=> disabled', animate('1s cubic-bezier(0.8,0.3,0,1)'))
1282
+ * ```
1283
+ *
1284
+ * - `:enter`/`:leave`, which indicates that the transition's animations should occur when the
1285
+ * element enters or exists the DOM
1286
+ *
1287
+ * _Example:_
1288
+ * ```typescript
1289
+ * transition(':enter', [
1290
+ * style({ opacity: 0 }),
1291
+ * animate('500ms', style({ opacity: 1 }))
1292
+ * ])
1293
+ * ```
1294
+ *
1295
+ * - `:increment`/`:decrement`, which indicates that the transition's animations should occur when
1296
+ * the numerical expression bound to the trigger's element has increased in value or decreased
1297
+ *
1298
+ * _Example:_
1299
+ * ```typescript
1300
+ * transition(':increment', query('@counter', animateChild()))
1301
+ * ```
1302
+ *
1303
+ * - a sequence of any of the above divided by commas, which indicates that transition's animations
1304
+ * should occur whenever one of the state change expressions matches
1305
+ *
1306
+ * _Example:_
1307
+ * ```typescript
1308
+ * transition(':increment, * => enabled, :enter', animate('1s ease', keyframes([
1309
+ * style({ transform: 'scale(1)', offset: 0}),
1310
+ * style({ transform: 'scale(1.1)', offset: 0.7}),
1311
+ * style({ transform: 'scale(1)', offset: 1})
1312
+ * ]))),
1313
+ * ```
1314
+ *
1315
+ * Also note that in such context:
1316
+ * - `void` can be used to indicate the absence of the element
1317
+ * - asterisks can be used as wildcards that match any state
1318
+ * - (as a consequence of the above, `void => *` is equivalent to `:enter` and `* => void` is
1319
+ * equivalent to `:leave`)
1320
+ * - `true` and `false` also match expression values of `1` and `0` respectively (but do not match
1321
+ * _truthy_ and _falsy_ values)
1322
+ *
1323
+ * <div class="alert is-helpful">
1324
+ *
1325
+ * Be careful about entering end leaving elements as their transitions present a common
1326
+ * pitfall for developers.
1327
+ *
1328
+ * Note that when an element with a trigger enters the DOM its `:enter` transition always
1329
+ * gets executed, but its `:leave` transition will not be executed if the element is removed
1330
+ * alongside its parent (as it will be removed "without warning" before its transition has
1331
+ * a chance to be executed, the only way that such transition can occur is if the element
1332
+ * is exiting the DOM on its own).
1275
1333
  *
1276
- * The following examples define transitions between the two defined states (and default states),
1277
- * using various options:
1278
1334
  *
1279
- * ```typescript
1280
- * // Transition occurs when the state value
1281
- * // bound to "myAnimationTrigger" changes from "on" to "off"
1282
- * transition("on => off", animate(500))
1283
- * // Run the same animation for both directions
1284
- * transition("on <=> off", animate(500))
1285
- * // Define multiple state-change pairs separated by commas
1286
- * transition("on => off, off => void", animate(500))
1287
- * ```
1335
+ * </div>
1288
1336
  *
1289
- * ### Special values for state-change expressions
1337
+ * ### Animating to a Final State
1290
1338
  *
1291
- * - Catch-all state change for when an element is inserted into the page and the
1292
- * destination state is unknown:
1339
+ * If the final step in a transition is a call to `animate()` that uses a timing value
1340
+ * with no `style` data, that step is automatically considered the final animation arc,
1341
+ * for the element to reach the final state, in such case Angular automatically adds or removes
1342
+ * CSS styles to ensure that the element is in the correct final state.
1293
1343
  *
1294
- * ```typescript
1295
- * transition("void => *", [
1296
- * style({ opacity: 0 }),
1297
- * animate(500)
1298
- * ])
1299
- * ```
1300
1344
  *
1301
- * - Capture a state change between any states:
1345
+ * ### Usage Examples
1302
1346
  *
1303
- * `transition("* => *", animate("1s 0s"))`
1347
+ * - Transition animations applied based on
1348
+ * the trigger's expression value
1304
1349
  *
1305
- * - Entry and exit transitions:
1350
+ * ```HTML
1351
+ * <div [@myAnimationTrigger]="myStatusExp">
1352
+ * ...
1353
+ * </div>
1354
+ * ```
1306
1355
  *
1307
- * ```typescript
1308
- * transition(":enter", [
1309
- * style({ opacity: 0 }),
1310
- * animate(500, style({ opacity: 1 }))
1311
- * ]),
1312
- * transition(":leave", [
1313
- * animate(500, style({ opacity: 0 }))
1356
+ * ```typescript
1357
+ * trigger("myAnimationTrigger", [
1358
+ * ..., // states
1359
+ * transition("on => off, open => closed", animate(500)),
1360
+ * transition("* <=> error", query('.indicator', animateChild()))
1314
1361
  * ])
1315
- * ```
1316
- *
1317
- * - Use `:increment` and `:decrement` to initiate transitions:
1318
- *
1319
- * ```typescript
1320
- * transition(":increment", group([
1321
- * query(':enter', [
1322
- * style({ left: '100%' }),
1323
- * animate('0.5s ease-out', style('*'))
1324
- * ]),
1325
- * query(':leave', [
1326
- * animate('0.5s ease-out', style({ left: '-100%' }))
1327
- * ])
1328
- * ]))
1329
- *
1330
- * transition(":decrement", group([
1331
- * query(':enter', [
1332
- * style({ left: '100%' }),
1333
- * animate('0.5s ease-out', style('*'))
1334
- * ]),
1335
- * query(':leave', [
1336
- * animate('0.5s ease-out', style({ left: '-100%' }))
1337
- * ])
1338
- * ]))
1339
- * ```
1340
- *
1341
- * ### State-change functions
1342
- *
1343
- * Here is an example of a `fromState` specified as a state-change function that invokes an
1344
- * animation when true:
1345
- *
1346
- * ```typescript
1347
- * transition((fromState, toState) =>
1348
- * {
1349
- * return fromState == "off" && toState == "on";
1350
- * },
1351
- * animate("1s 0s"))
1352
- * ```
1362
+ * ```
1353
1363
  *
1354
- * ### Animating to the final state
1364
+ * - Transition animations applied based on custom logic dependent
1365
+ * on the trigger's expression value and provided parameters
1355
1366
  *
1356
- * If the final step in a transition is a call to `animate()` that uses a timing value
1357
- * with no style data, that step is automatically considered the final animation arc,
1358
- * for the element to reach the final state. Angular automatically adds or removes
1359
- * CSS styles to ensure that the element is in the correct final state.
1360
- *
1361
- * The following example defines a transition that starts by hiding the element,
1362
- * then makes sure that it animates properly to whatever state is currently active for trigger:
1363
- *
1364
- * ```typescript
1365
- * transition("void => *", [
1366
- * style({ opacity: 0 }),
1367
- * animate(500)
1368
- * ])
1369
- * ```
1370
- * ### Boolean value matching
1371
- * If a trigger binding value is a Boolean, it can be matched using a transition expression
1372
- * that compares true and false or 1 and 0. For example:
1373
- *
1374
- * ```
1375
- * // in the template
1376
- * <div [@openClose]="open ? true : false">...</div>
1377
- * // in the component metadata
1378
- * trigger('openClose', [
1379
- * state('true', style({ height: '*' })),
1380
- * state('false', style({ height: '0px' })),
1381
- * transition('false <=> true', animate(500))
1382
- * ])
1383
- * ```
1367
+ * ```HTML
1368
+ * <div [@myAnimationTrigger]="{
1369
+ * value: stepName,
1370
+ * params: { target: currentTarget }
1371
+ * }">
1372
+ * ...
1373
+ * </div>
1374
+ * ```
1375
+ *
1376
+ * ```typescript
1377
+ * trigger("myAnimationTrigger", [
1378
+ * ..., // states
1379
+ * transition(
1380
+ * (fromState, toState, _element, params) =>
1381
+ * ['firststep', 'laststep'].includes(fromState.toLowerCase())
1382
+ * && toState === params?.['target'],
1383
+ * animate('1s')
1384
+ * )
1385
+ * ])
1386
+ * ```
1384
1387
  *
1385
1388
  * @publicApi
1386
1389
  **/
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.1.0-next.3
2
+ * @license Angular v13.2.0-next.1
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -17,6 +17,9 @@ import { ɵStyleData } from '@angular/animations';
17
17
  export declare abstract class AnimationDriver {
18
18
  static NOOP: AnimationDriver;
19
19
  abstract validateStyleProperty(prop: string): boolean;
20
+ /**
21
+ * @deprecated No longer in use. Will be removed.
22
+ */
20
23
  abstract matchesElement(element: any, selector: string): boolean;
21
24
  abstract containsElement(elm1: any, elm2: any): boolean;
22
25
  abstract query(element: any, selector: string, multi: boolean): any[];
@@ -72,7 +75,7 @@ declare interface DOMAnimation {
72
75
 
73
76
  declare class ElementInstructionMap {
74
77
  private _map;
75
- consume(element: any): AnimationTimelineInstruction[];
78
+ get(element: any): AnimationTimelineInstruction[];
76
79
  append(element: any, instructions: AnimationTimelineInstruction[]): void;
77
80
  has(element: any): boolean;
78
81
  clear(): void;
@@ -150,7 +153,7 @@ export declare const ɵcontainsElement: (elm1: any, elm2: any) => boolean;
150
153
  export declare class ɵCssKeyframesDriver implements AnimationDriver {
151
154
  private _count;
152
155
  validateStyleProperty(prop: string): boolean;
153
- matchesElement(element: any, selector: string): boolean;
156
+ matchesElement(_element: any, _selector: string): boolean;
154
157
  containsElement(elm1: any, elm2: any): boolean;
155
158
  query(element: any, selector: string, multi: boolean): any[];
156
159
  computeStyle(element: any, prop: string, defaultValue?: string): string;
@@ -207,14 +210,12 @@ export declare class ɵCssKeyframesPlayer implements AnimationPlayer {
207
210
 
208
211
  export declare const ɵinvokeQuery: (element: any, selector: string, multi: boolean) => any[];
209
212
 
210
- export declare const ɵmatchesElement: (element: any, selector: string) => boolean;
211
-
212
213
  /**
213
214
  * @publicApi
214
215
  */
215
216
  export declare class ɵNoopAnimationDriver implements AnimationDriver {
216
217
  validateStyleProperty(prop: string): boolean;
217
- matchesElement(element: any, selector: string): boolean;
218
+ matchesElement(_element: any, _selector: string): boolean;
218
219
  containsElement(elm1: any, elm2: any): boolean;
219
220
  query(element: any, selector: string, multi: boolean): any[];
220
221
  computeStyle(element: any, prop: string, defaultValue?: string): string;
@@ -241,7 +242,7 @@ export declare class ɵWebAnimationsDriver implements AnimationDriver {
241
242
  private _isNativeImpl;
242
243
  private _cssKeyframesDriver;
243
244
  validateStyleProperty(prop: string): boolean;
244
- matchesElement(element: any, selector: string): boolean;
245
+ matchesElement(_element: any, _selector: string): boolean;
245
246
  containsElement(elm1: any, elm2: any): boolean;
246
247
  query(element: any, selector: string, multi: boolean): any[];
247
248
  computeStyle(element: any, prop: string, defaultValue?: string): string;
@@ -267,7 +268,7 @@ export declare class ɵWebAnimationsPlayer implements AnimationPlayer {
267
268
  private _finished;
268
269
  private _started;
269
270
  private _destroyed;
270
- private _finalKeyframe;
271
+ private _finalKeyframe?;
271
272
  readonly domPlayer: DOMAnimation;
272
273
  time: number;
273
274
  parentPlayer: AnimationPlayer | null;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v13.1.0-next.3
2
+ * @license Angular v13.2.0-next.1
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -15,7 +15,7 @@ import { ɵStyleData } from '@angular/animations';
15
15
  export declare class MockAnimationDriver implements AnimationDriver {
16
16
  static log: AnimationPlayer[];
17
17
  validateStyleProperty(prop: string): boolean;
18
- matchesElement(element: any, selector: string): boolean;
18
+ matchesElement(_element: any, _selector: string): boolean;
19
19
  containsElement(elm1: any, elm2: any): boolean;
20
20
  query(element: any, selector: string, multi: boolean): any[];
21
21
  computeStyle(element: any, prop: string, defaultValue?: string): string;