Skip to content

Commit

Permalink
refactor: move mat-app-background out of core
Browse files Browse the repository at this point in the history
  • Loading branch information
wagnermaciel committed Sep 19, 2024
1 parent 5782834 commit 12a7b69
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/dev-app/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ $candy-app-theme: mat.m2-define-light-theme((
// 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 the default theme styles.
@include mat.all-component-themes($candy-app-theme);
Expand Down
2 changes: 1 addition & 1 deletion src/material/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
@forward './core/style/validation' as private-*;

// Structural
@forward './core/core' show core;
@forward './core/core' show core, app-background;
@forward './core/ripple/ripple' show ripple;
@forward './core/focus-indicators/private' show strong-focus-indicators,
strong-focus-indicators-color, strong-focus-indicators-theme;
Expand Down
17 changes: 12 additions & 5 deletions src/material/core/_core.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@
@at-root {
// Note: we need to emit fallback values here to avoid errors in internal builds.
@include token-utils.use-tokens(tokens-mat-app.$prefix, tokens-mat-app.get-token-slots()) {
.mat-app-background {
@include token-utils.create-token-slot(background-color, background-color, transparent);
@include token-utils.create-token-slot(color, text-color, inherit);
}

// Provides external CSS classes for each elevation value. Each CSS class is formatted as
// `mat-elevation-z$z-value` where `$z-value` corresponds to the z-space to which the element
// is elevated.
Expand All @@ -42,3 +37,15 @@
}
}
}

// Mixin that provides the .mat-app-background class.
@mixin app-background() {
@at-root {
@include token-utils.use-tokens(tokens-mat-app.$prefix, tokens-mat-app.get-token-slots()) {
.mat-app-background {
@include token-utils.create-token-slot(background-color, background-color, transparent);
@include token-utils.create-token-slot(color, text-color, inherit);
}
}
}
}
1 change: 1 addition & 0 deletions src/universal-app/styles.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@use '@angular/material' as mat;

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

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

0 comments on commit 12a7b69

Please sign in to comment.