Skip to content

Commit 30e09d7

Browse files
authored
refactor(material/core): move classes out of core (#29811)
* refactor(material/core): move classes out of core * fixup! refactor(material/core): move classes out of core * fixup! refactor(material/core): move classes out of core * fixup! refactor(material/core): move classes out of core
1 parent 5be8905 commit 30e09d7

9 files changed

+33
-9
lines changed

src/material/core/_core.scss

+17-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
// Mixin that renders all of the core styles that are not theme-dependent.
88
@mixin core() {
9+
@include cdk.a11y-visually-hidden();
10+
@include private.structural-styling();
11+
}
12+
13+
// Emits the mat-app-background CSS class. This predefined class sets the
14+
// background color and text color of an element.
15+
@mixin app-background() {
916
// TODO: Move ripple styles to be dynamically loaded instead of in core.
1017
// This variable is used as a fallback for the ripple element's
1118
// background color. However, if it isn't defined anywhere, then MSS
@@ -14,9 +21,6 @@
1421
--mat-app-on-surface: initial;
1522
}
1623

17-
@include cdk.a11y-visually-hidden();
18-
@include private.structural-styling();
19-
2024
// Wrapper element that provides the theme background when the
2125
// user's content isn't inside of a `mat-sidenav-container`.
2226
@at-root {
@@ -26,7 +30,17 @@
2630
@include token-utils.create-token-slot(background-color, background-color, transparent);
2731
@include token-utils.create-token-slot(color, text-color, inherit);
2832
}
33+
}
34+
}
35+
}
2936

37+
// Emits CSS classes for applying elevation. These classes follow the pattern
38+
// mat-elevation-z#, where # is the elevation number you want, from 0 to 24.
39+
// These predefined classes use the CSS box-shadow settings defined by the
40+
// Material Design specification.
41+
@mixin elevation-classes() {
42+
@at-root {
43+
@include token-utils.use-tokens(tokens-mat-app.$prefix, tokens-mat-app.get-token-slots()) {
3044
// Provides external CSS classes for each elevation value. Each CSS class is formatted as
3145
// `mat-elevation-z$z-value` where `$z-value` corresponds to the z-space to which the element
3246
// is elevated.
@@ -42,9 +56,3 @@
4256
}
4357
}
4458
}
45-
46-
// Mixin that provides the .mat-app-background class.
47-
@mixin app-background() {}
48-
49-
// Mixin that provides the .mat-elevation-* classes.
50-
@mixin elevation-classes() {}

src/material/core/theming/prebuilt/azure-blue.scss

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@use '../../typography/typography';
77

88
@include core.core();
9+
@include core.app-background();
10+
@include core.elevation-classes();
911

1012
$theme: definition.define-theme((
1113
color: (

src/material/core/theming/prebuilt/cyan-orange.scss

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@use '../../typography/typography';
77

88
@include core.core();
9+
@include core.app-background();
10+
@include core.elevation-classes();
911

1012
$theme: definition.define-theme((
1113
color: (

src/material/core/theming/prebuilt/deeppurple-amber.scss

+2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
// Include non-theme styles for core.
77
@include core.core();
8+
@include core.app-background();
9+
@include core.elevation-classes();
810

911
// Define a theme.
1012
$primary: m2.define-palette(m2.$deep-purple-palette);

src/material/core/theming/prebuilt/indigo-pink.scss

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
// Include non-theme styles for core.
88
@include core.core();
9+
@include core.app-background();
10+
@include core.elevation-classes();
911

1012
// Define a theme.
1113
$primary: m2.define-palette(m2.$indigo-palette);

src/material/core/theming/prebuilt/magenta-violet.scss

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@use '../../typography/typography';
77

88
@include core.core();
9+
@include core.app-background();
10+
@include core.elevation-classes();
911

1012
$theme: definition.define-theme((
1113
color: (

src/material/core/theming/prebuilt/pink-bluegrey.scss

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
// Include non-theme styles for core.
88
@include core.core();
9+
@include core.app-background();
10+
@include core.elevation-classes();
911

1012
// Define a theme.
1113
$primary: m2.define-palette(m2.$pink-palette, 700, 500, 900);

src/material/core/theming/prebuilt/purple-green.scss

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
// Include non-theme styles for core.
88
@include core.core();
9+
@include core.app-background();
10+
@include core.elevation-classes();
911

1012
// Define a theme.
1113
$primary: m2.define-palette(m2.$purple-palette, 700, 500, 800);

src/material/core/theming/prebuilt/rose-red.scss

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
@use '../../typography/typography';
77

88
@include core.core();
9+
@include core.app-background();
10+
@include core.elevation-classes();
911

1012
$theme: definition.define-theme((
1113
color: (

0 commit comments

Comments
 (0)