Skip to content

Commit

Permalink
fix(material/snack-bar): remove remaining animation dependencies
Browse files Browse the repository at this point in the history
Removes the remaning dependencies on `@angular/animations` from the package.
  • Loading branch information
crisbeto committed Feb 3, 2025
1 parent 712d5e2 commit 02ed862
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 37 deletions.
97 changes: 62 additions & 35 deletions src/material/snack-bar/snack-bar-animations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.dev/license
*/
import {
animate,
state,
style,
transition,
trigger,
AnimationTriggerMetadata,
} from '@angular/animations';

/**
* Animations used by the Material snack bar.
Expand All @@ -21,33 +13,68 @@ import {
* @breaking-change 21.0.0
*/
export const matSnackBarAnimations: {
readonly snackBarState: AnimationTriggerMetadata;
readonly snackBarState: any;
} = {
// Represents
// trigger('state', [
// state(
// 'void, hidden',
// style({
// transform: 'scale(0.8)',
// opacity: 0,
// }),
// ),
// state(
// 'visible',
// style({
// transform: 'scale(1)',
// opacity: 1,
// }),
// ),
// transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
// transition(
// '* => void, * => hidden',
// animate(
// '75ms cubic-bezier(0.4, 0.0, 1, 1)',
// style({
// opacity: 0,
// }),
// ),
// ),
// ])

/** Animation that shows and hides a snack bar. */
snackBarState: trigger('state', [
state(
'void, hidden',
style({
transform: 'scale(0.8)',
opacity: 0,
}),
),
state(
'visible',
style({
transform: 'scale(1)',
opacity: 1,
}),
),
transition('* => visible', animate('150ms cubic-bezier(0, 0, 0.2, 1)')),
transition(
'* => void, * => hidden',
animate(
'75ms cubic-bezier(0.4, 0.0, 1, 1)',
style({
opacity: 0,
}),
),
),
]),
snackBarState: {
type: 7,
name: 'state',
'definitions': [
{
type: 0,
name: 'void, hidden',
styles: {type: 6, styles: {transform: 'scale(0.8)', opacity: 0}, offset: null},
},
{
type: 0,
name: 'visible',
styles: {type: 6, styles: {transform: 'scale(1)', opacity: 1}, offset: null},
},
{
type: 1,
expr: '* => visible',
animation: {type: 4, styles: null, timings: '150ms cubic-bezier(0, 0, 0.2, 1)'},
options: null,
},
{
type: 1,
expr: '* => void, * => hidden',
animation: {
type: 4,
styles: {type: 6, styles: {opacity: 0}, offset: null},
timings: '75ms cubic-bezier(0.4, 0.0, 1, 1)',
},
options: null,
},
],
options: {},
},
};
3 changes: 1 addition & 2 deletions tools/public_api_guard/material/snack-bar.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
```ts

import { AnimationTriggerMetadata } from '@angular/animations';
import { AriaLivePoliteness } from '@angular/cdk/a11y';
import { BasePortalOutlet } from '@angular/cdk/portal';
import { CdkPortalOutlet } from '@angular/cdk/portal';
Expand Down Expand Up @@ -76,7 +75,7 @@ export class MatSnackBarActions {

// @public @deprecated
export const matSnackBarAnimations: {
readonly snackBarState: AnimationTriggerMetadata;
readonly snackBarState: any;
};

// @public
Expand Down

0 comments on commit 02ed862

Please sign in to comment.