Skip to content

feat(material/core): deprecate the core mixin #29906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 0 additions & 25 deletions guides/material-2.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,19 +108,6 @@ custom theme with Sass, or by importing a pre-built theme CSS file.
A **theme file** is a Sass file that calls Angular Material Sass mixins to output color,
typography, and density CSS styles.

#### The `core` mixin

Angular Material defines a mixin named `core` that includes prerequisite styles for common
features used by multiple components, such as ripples. The `core` mixin must be included exactly
once for your application, even if you define multiple themes. Including the `core` mixin multiple
times will result in duplicate CSS in your application.

```scss
@use '@angular/material' as mat;

@include mat.core();
```

#### Defining a theme

Angular Material represents a theme as a Sass map that contains your color, typography, and density
Expand Down Expand Up @@ -190,8 +177,6 @@ theme Sass mixins.
```scss
@use '@angular/material' as mat;

@include mat.core();

$my-primary: mat.m2-define-palette(mat.$m2-indigo-palette, 500);
$my-accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400);

Expand Down Expand Up @@ -225,8 +210,6 @@ uses every single component, this will produce unnecessary CSS.
```scss
@use '@angular/material' as mat;

@include mat.core();

$my-primary: mat.m2-define-palette(mat.$m2-indigo-palette, 500);
$my-accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400);

Expand Down Expand Up @@ -337,8 +320,6 @@ CSS rule declaration. See the [documentation for Sass mixins][sass-mixins] for f
```scss
@use '@angular/material' as mat;

@include mat.core();

// Define a dark theme
$dark-theme: mat.m2-define-dark-theme((
color: (
Expand Down Expand Up @@ -470,7 +451,6 @@ the custom theme API.
```scss
@use '@angular/material' as mat;

@include mat.core();
@include mat.strong-focus-indicators();

$my-primary: mat.m2-define-palette(mat.$m2-indigo-palette, 500);
Expand Down Expand Up @@ -502,7 +482,6 @@ of the custom theme API.
```scss
@use '@angular/material' as mat;

@include mat.core();
@include mat.strong-focus-indicators((
border-style: dotted,
border-width: 4px,
Expand Down Expand Up @@ -812,8 +791,6 @@ defining multiple themes](#defining-multiple-themes).
```scss
@use '@angular/material' as mat;

@include mat.core();

$my-primary: mat.m2-define-palette(mat.$indigo-palette, 500);
$my-accent: mat.m2-define-palette(mat.$pink-palette, A200, A100, A400);
$my-typography: mat.m2-define-typography-config();
Expand Down Expand Up @@ -1064,8 +1041,6 @@ the other theme mixins in your application.
@use '@angular/material' as mat;
@use './path/to/carousel-theme' as carousel;

@include mat.core();

$my-primary: mat.m2-define-palette(mat.$m2-indigo-palette, 500);
$my-accent: mat.m2-define-palette(mat.$m2-pink-palette, A200, A100, A400);

Expand Down
2 changes: 0 additions & 2 deletions guides/theming-your-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,6 @@ the other theme mixins in your application.
@use '@angular/material' as mat;
@use './path/to/carousel-theme' as carousel;

@include mat.core();

$my-theme: mat.define-theme((
color: (
theme-type: light,
Expand Down
21 changes: 0 additions & 21 deletions guides/theming.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,6 @@ familiarity with CSS and Sass basics, including variables, functions, and mixins
A **theme file** is a Sass file that calls Angular Material Sass mixins to output color,
typography, and density CSS styles.

#### The `core` mixin

Angular Material defines a mixin named `core` that includes prerequisite styles for common
features used by multiple components, such as ripples. The `core` mixin must be included exactly
once for your application, even if you define multiple themes. Including the `core` mixin multiple
times will result in duplicate CSS in your application.

```scss
@use '@angular/material' as mat;

@include mat.core();
```

#### Defining a theme

Angular Material represents a theme as a Sass map that contains your color, typography, and density
Expand Down Expand Up @@ -218,8 +205,6 @@ theme Sass mixins.
```scss
@use '@angular/material' as mat;

@include mat.core();

$my-theme: mat.define-theme((
color: (
theme-type: light,
Expand Down Expand Up @@ -250,8 +235,6 @@ uses every single component, this will produce unnecessary CSS.
```scss
@use '@angular/material' as mat;

@include mat.core();

$my-theme: mat.define-theme((
color: (
theme-type: light,
Expand Down Expand Up @@ -335,8 +318,6 @@ CSS rule declaration. See the [documentation for Sass mixins][sass-mixins] for f
```scss
@use '@angular/material' as mat;

@include mat.core();

// Define a dark theme
$dark-theme: mat.define-theme((
color: (
Expand Down Expand Up @@ -500,7 +481,6 @@ the custom theme API.
```scss
@use '@angular/material' as mat;

@include mat.core();
@include mat.strong-focus-indicators();

$my-theme: mat.define-theme((
Expand Down Expand Up @@ -531,7 +511,6 @@ of the custom theme API.
```scss
@use '@angular/material' as mat;

@include mat.core();
@include mat.strong-focus-indicators((
border-style: dotted,
border-width: 4px,
Expand Down
2 changes: 0 additions & 2 deletions integration/yarn-pnp-compat/src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ $theme: mat.m2-define-light-theme((
density: 0
));

@include mat.core();

@include mat.all-component-themes($theme);

html,
Expand Down
5 changes: 0 additions & 5 deletions src/dev-app/theme-m3.scss
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,6 @@ $light-theme: create-theme($type: light);
// Create our dark theme.
$dark-theme: create-theme($type: dark);

// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// **Be sure that you only ever include this mixin once!**
@include mat.core();

// Include the default theme styles.
html {
body:not(.demo-experimental-theme) {
Expand Down
4 changes: 0 additions & 4 deletions src/dev-app/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ $candy-app-theme: mat.m2-define-light-theme((
density: 0,
));

// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// **Be sure that you only ever include this mixin once!**
@include mat.core();
@include mat.app-background();
@include mat.elevation-classes();

Expand Down
2 changes: 0 additions & 2 deletions src/e2e-app/theme.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@use '@angular/material' as mat;

@include mat.core();

$theme: mat.define-theme((
color: (
theme-type: light,
Expand Down
2 changes: 1 addition & 1 deletion src/material/core/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@use './tokens/token-utils';
@use './style/elevation';

// Mixin that renders all of the core styles that are not theme-dependent.
/// @deprecated This mixin is a no-op and is going to be removed in v21.
@mixin core() {}

// Emits the mat-app-background CSS class. This predefined class sets the
Expand Down
1 change: 0 additions & 1 deletion src/material/core/theming/prebuilt/azure-blue.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@use '../../core';
@use '../../typography/typography';

@include core.core();
@include core.app-background();
@include core.elevation-classes();

Expand Down
1 change: 0 additions & 1 deletion src/material/core/theming/prebuilt/cyan-orange.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@use '../../core';
@use '../../typography/typography';

@include core.core();
@include core.app-background();
@include core.elevation-classes();

Expand Down
2 changes: 0 additions & 2 deletions src/material/core/theming/prebuilt/deeppurple-amber.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
@use '../../m2';
@use '../../typography/typography';

// Include non-theme styles for core.
@include core.core();
@include core.app-background();
@include core.elevation-classes();

Expand Down
3 changes: 0 additions & 3 deletions src/material/core/theming/prebuilt/indigo-pink.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
@use '../../m2';
@use '../../typography/typography';


// Include non-theme styles for core.
@include core.core();
@include core.app-background();
@include core.elevation-classes();

Expand Down
1 change: 0 additions & 1 deletion src/material/core/theming/prebuilt/magenta-violet.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@use '../../core';
@use '../../typography/typography';

@include core.core();
@include core.app-background();
@include core.elevation-classes();

Expand Down
3 changes: 0 additions & 3 deletions src/material/core/theming/prebuilt/pink-bluegrey.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
@use '../../m2';
@use '../../typography/typography';


// Include non-theme styles for core.
@include core.core();
@include core.app-background();
@include core.elevation-classes();

Expand Down
3 changes: 0 additions & 3 deletions src/material/core/theming/prebuilt/purple-green.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
@use '../../m2';
@use '../../typography/typography';


// Include non-theme styles for core.
@include core.core();
@include core.app-background();
@include core.elevation-classes();

Expand Down
1 change: 0 additions & 1 deletion src/material/core/theming/prebuilt/rose-red.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
@use '../../core';
@use '../../typography/typography';

@include core.core();
@include core.app-background();
@include core.elevation-classes();

Expand Down
1 change: 0 additions & 1 deletion src/material/core/theming/tests/test-theming-bundle.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ $rem-typography: mat.m2-define-rem-typography-config();
@include mat.all-component-densities($theme);

// Core mixins.
@include mat.core();
@include mat.strong-focus-indicators();
@include mat.strong-focus-indicators-theme($theme);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ export function createCustomTheme(name: string = 'app') {
@use '@angular/material' as mat;
// Plus imports for other components in your app.

// Include the common styles for Angular Material. We include this here so that you only
// have to load a single css file for Angular Material in your app.
// Be sure that you only ever include this mixin once!
@include mat.core();

// Define the theme object.
$${name}-theme: mat.define-theme((
color: (
Expand Down
1 change: 0 additions & 1 deletion src/universal-app/styles.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@use '@angular/material' as mat;

@include mat.core();
@include mat.app-background();

$theme: mat.define-theme((
Expand Down
Loading