Skip to content

Commit 879cbe7

Browse files
committedFeb 3, 2025
fix(material/menu): remove remaining animation dependencies
Removes the remaning dependencies on `@angular/animations` from the package.
1 parent 37693e3 commit 879cbe7

File tree

3 files changed

+92
-46
lines changed

3 files changed

+92
-46
lines changed
 

‎src/material/menu/BUILD.bazel

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ ng_module(
2424
"//src/cdk/overlay",
2525
"//src/cdk/scrolling",
2626
"//src/material/core",
27-
"@npm//@angular/animations",
2827
"@npm//@angular/common",
2928
"@npm//@angular/core",
3029
],

‎src/material/menu/menu-animations.ts

+88-40
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import {
10-
trigger,
11-
state,
12-
style,
13-
animate,
14-
transition,
15-
AnimationTriggerMetadata,
16-
} from '@angular/animations';
17-
189
/**
1910
* Animations used by the mat-menu component.
2011
* Animation duration and timing values are based on:
@@ -24,9 +15,31 @@ import {
2415
* @breaking-change 21.0.0
2516
*/
2617
export const matMenuAnimations: {
27-
readonly transformMenu: AnimationTriggerMetadata;
28-
readonly fadeInItems: AnimationTriggerMetadata;
18+
readonly transformMenu: any;
19+
readonly fadeInItems: any;
2920
} = {
21+
// Represents:
22+
// trigger('transformMenu', [
23+
// state(
24+
// 'void',
25+
// style({
26+
// opacity: 0,
27+
// transform: 'scale(0.8)',
28+
// }),
29+
// ),
30+
// transition(
31+
// 'void => enter',
32+
// animate(
33+
// '120ms cubic-bezier(0, 0, 0.2, 1)',
34+
// style({
35+
// opacity: 1,
36+
// transform: 'scale(1)',
37+
// }),
38+
// ),
39+
// ),
40+
// transition('* => void', animate('100ms 25ms linear', style({opacity: 0}))),
41+
// ])
42+
3043
/**
3144
* This animation controls the menu panel's entry and exit from the page.
3245
*
@@ -35,40 +48,75 @@ export const matMenuAnimations: {
3548
* When the menu panel is removed from the DOM, it simply fades out after a brief
3649
* delay to display the ripple.
3750
*/
38-
transformMenu: trigger('transformMenu', [
39-
state(
40-
'void',
41-
style({
42-
opacity: 0,
43-
transform: 'scale(0.8)',
44-
}),
45-
),
46-
transition(
47-
'void => enter',
48-
animate(
49-
'120ms cubic-bezier(0, 0, 0.2, 1)',
50-
style({
51-
opacity: 1,
52-
transform: 'scale(1)',
53-
}),
54-
),
55-
),
56-
transition('* => void', animate('100ms 25ms linear', style({opacity: 0}))),
57-
]),
51+
transformMenu: {
52+
type: 7,
53+
name: 'transformMenu',
54+
definitions: [
55+
{
56+
type: 0,
57+
name: 'void',
58+
styles: {type: 6, styles: {opacity: 0, transform: 'scale(0.8)'}, offset: null},
59+
},
60+
{
61+
type: 1,
62+
expr: 'void => enter',
63+
animation: {
64+
type: 4,
65+
styles: {type: 6, styles: {opacity: 1, transform: 'scale(1)'}, offset: null},
66+
timings: '120ms cubic-bezier(0, 0, 0.2, 1)',
67+
},
68+
options: null,
69+
},
70+
{
71+
type: 1,
72+
expr: '* => void',
73+
animation: {
74+
type: 4,
75+
styles: {type: 6, styles: {opacity: 0}, offset: null},
76+
timings: '100ms 25ms linear',
77+
},
78+
options: null,
79+
},
80+
],
81+
options: {},
82+
},
83+
84+
// Represents:
85+
// trigger('fadeInItems', [
86+
// // TODO(crisbeto): this is inside the `transformMenu`
87+
// // now. Remove next time we do breaking changes.
88+
// state('showing', style({opacity: 1})),
89+
// transition('void => *', [
90+
// style({opacity: 0}),
91+
// animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)'),
92+
// ]),
93+
// ])
5894

5995
/**
6096
* This animation fades in the background color and content of the menu panel
6197
* after its containing element is scaled in.
6298
*/
63-
fadeInItems: trigger('fadeInItems', [
64-
// TODO(crisbeto): this is inside the `transformMenu`
65-
// now. Remove next time we do breaking changes.
66-
state('showing', style({opacity: 1})),
67-
transition('void => *', [
68-
style({opacity: 0}),
69-
animate('400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)'),
70-
]),
71-
]),
99+
fadeInItems: {
100+
type: 7,
101+
name: 'fadeInItems',
102+
definitions: [
103+
{
104+
type: 0,
105+
name: 'showing',
106+
styles: {type: 6, styles: {opacity: 1}, offset: null},
107+
},
108+
{
109+
type: 1,
110+
expr: 'void => *',
111+
animation: [
112+
{type: 6, styles: {opacity: 0}, offset: null},
113+
{type: 4, styles: null, timings: '400ms 100ms cubic-bezier(0.55, 0, 0.55, 0.2)'},
114+
],
115+
options: null,
116+
},
117+
],
118+
options: {},
119+
},
72120
};
73121

74122
/**

‎tools/public_api_guard/material/menu.md

+4-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import { AfterContentInit } from '@angular/core';
88
import { AfterViewInit } from '@angular/core';
9-
import { AnimationTriggerMetadata } from '@angular/animations';
109
import { Direction } from '@angular/cdk/bidi';
1110
import { EventEmitter } from '@angular/core';
1211
import { FocusableOption } from '@angular/cdk/a11y';
@@ -26,7 +25,7 @@ import { Subject } from 'rxjs';
2625
import { TemplateRef } from '@angular/core';
2726

2827
// @public @deprecated (undocumented)
29-
export const fadeInItems: AnimationTriggerMetadata;
28+
export const fadeInItems: any;
3029

3130
// @public
3231
export const MAT_MENU_CONTENT: InjectionToken<MatMenuContent>;
@@ -119,8 +118,8 @@ export class MatMenu implements AfterContentInit, MatMenuPanel<MatMenuItem>, OnI
119118

120119
// @public @deprecated
121120
export const matMenuAnimations: {
122-
readonly transformMenu: AnimationTriggerMetadata;
123-
readonly fadeInItems: AnimationTriggerMetadata;
121+
readonly transformMenu: any;
122+
readonly fadeInItems: any;
124123
};
125124

126125
// @public
@@ -287,7 +286,7 @@ export type MenuPositionX = 'before' | 'after';
287286
export type MenuPositionY = 'above' | 'below';
288287

289288
// @public @deprecated (undocumented)
290-
export const transformMenu: AnimationTriggerMetadata;
289+
export const transformMenu: any;
291290

292291
// (No @packageDocumentation comment for this package)
293292

0 commit comments

Comments
 (0)
Please sign in to comment.