Skip to content

Commit

Permalink
fix(material-experimental/mdc-core): consolidate mdc theming code und…
Browse files Browse the repository at this point in the history
…er mdc-core (#25084)

The theming code for mdc is currently scattered across mdc-theming,
mdc-color, mdc-density, mdc-typography, and mdc-helpers. This PR
consolidates it all under mdc-core to better match the way our entry
points are organized in @angular/material

(cherry picked from commit 4aaa6eb)
  • Loading branch information
mmalerba committed Jun 16, 2022
1 parent a40158e commit 2388fe7
Show file tree
Hide file tree
Showing 161 changed files with 718 additions and 728 deletions.
5 changes: 0 additions & 5 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,9 @@
/src/material-experimental/mdc-card/** @mmalerba
/src/material-experimental/mdc-checkbox/** @mmalerba
/src/material-experimental/mdc-chips/** @mmalerba
/src/material-experimental/mdc-color/** @andrewseguin @devversion
/src/material-experimental/mdc-core/** @crisbeto
/src/material-experimental/mdc-density/** @devversion
/src/material-experimental/mdc-dialog/** @devversion
/src/material-experimental/mdc-form-field/** @devversion @mmalerba
/src/material-experimental/mdc-helpers/** @mmalerba
/src/material-experimental/mdc-input/** @devversion @mmalerba
/src/material-experimental/mdc-list/** @mmalerba @devversion
/src/material-experimental/mdc-menu/** @crisbeto
Expand All @@ -123,8 +120,6 @@
/src/material-experimental/mdc-tabs/** @crisbeto
/src/material-experimental/mdc-tooltip/** @crisbeto
/src/material-experimental/mdc-table/** @andrewseguin
/src/material-experimental/mdc-theming/** @mmalerba
/src/material-experimental/mdc-typography/** @mmalerba
/src/material-experimental/menubar/** @jelbourn
/src/material-experimental/popover-edit/** @andrewseguin
/src/material-experimental/selection/** @andrewseguin
Expand Down
5 changes: 0 additions & 5 deletions .ng-dev/commit-message.mts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,9 @@ export const commitMessage: CommitMessageConfig = {
'material-experimental/mdc-card',
'material-experimental/mdc-checkbox',
'material-experimental/mdc-chips',
'material-experimental/mdc-color',
'material-experimental/mdc-core',
'material-experimental/mdc-density',
'material-experimental/mdc-dialog',
'material-experimental/mdc-form-field',
'material-experimental/mdc-helpers',
'material-experimental/mdc-input',
'material-experimental/mdc-list',
'material-experimental/mdc-menu',
Expand All @@ -65,8 +62,6 @@ export const commitMessage: CommitMessageConfig = {
'material-experimental/mdc-table',
'material-experimental/mdc-tabs',
'material-experimental/mdc-tooltip',
'material-experimental/mdc-theming',
'material-experimental/mdc-typography',
'material-experimental/menubar',
'material-experimental/popover-edit',
'material-experimental/selection',
Expand Down
2 changes: 1 addition & 1 deletion scripts/migrate-sass-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ migrate('material/core/**/_*.scss', materialPrefixes, true);
commentOutMdc('material-experimental/**/*.scss');

// Migrate all of the MDC partials.
migrate('material-experimental/mdc-helpers/**/_*.scss', mdcPrefixes, true);
migrate('material-experimental/mdc-core/mdc-helpers/**/_*.scss', mdcPrefixes, true);
migrate('material-experimental/mdc-core/**/_*.scss', mdcPrefixes, true, ['**/_core.scss']);
migrate('material-experimental/**/_*.scss', mdcPrefixes, true);

Expand Down
10 changes: 5 additions & 5 deletions src/material-experimental/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ ts_library(
sass_library(
name = "theming_scss_lib",
srcs = MATERIAL_EXPERIMENTAL_SCSS_LIBS + [
"//src/material-experimental/mdc-color",
"//src/material-experimental/mdc-density",
"//src/material-experimental/mdc-helpers",
"//src/material-experimental/mdc-theming",
"//src/material-experimental/mdc-typography",
"//src/material-experimental/mdc-core/color",
"//src/material-experimental/mdc-core/density",
"//src/material-experimental/mdc-core/mdc-helpers",
"//src/material-experimental/mdc-core/theming",
"//src/material-experimental/mdc-core/typography",
],
)

Expand Down
12 changes: 6 additions & 6 deletions src/material-experimental/_index.scss
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Structural
@forward './mdc-helpers/focus-indicators' as mdc-* show mdc-strong-focus-indicators;
@forward './mdc-core/mdc-helpers/focus-indicators' as mdc-* show mdc-strong-focus-indicators;
@forward './mdc-core/elevation' as mdc-* show mdc-elevation, mdc-overridable-elevation;

// Theme bundles
@forward './mdc-theming/all-theme' show all-mdc-component-themes;
@forward './mdc-color/all-color' show all-mdc-component-colors;
@forward './mdc-typography/all-typography' show all-mdc-component-typographies,
@forward './mdc-core/theming/all-theme' show all-mdc-component-themes;
@forward './mdc-core/color/all-color' show all-mdc-component-colors;
@forward './mdc-core/typography/all-typography' show all-mdc-component-typographies,
define-mdc-typography-config;
@forward './mdc-density/all-density' show all-mdc-component-densities;
@forward './mdc-core/density/all-density' show all-mdc-component-densities;

// Component themes
@forward './column-resize/column-resize-theme' as column-resize-* show column-resize-color,
Expand All @@ -18,7 +18,7 @@
// MDC-related themes
@forward './mdc-core/core-theme' as mdc-core-* show mdc-core-theme, mdc-core-color,
mdc-core-density, mdc-core-typography;
@forward './mdc-helpers/focus-indicators-theme' as mdc-strong-focus-indicators-* show
@forward './mdc-core/mdc-helpers/focus-indicators-theme' as mdc-strong-focus-indicators-* show
mdc-strong-focus-indicators-color, mdc-strong-focus-indicators-theme;
@forward './mdc-core/option/option-theme' as mdc-option-* show mdc-option-color,
mdc-option-typography, mdc-option-density, mdc-option-theme;
Expand Down
8 changes: 4 additions & 4 deletions src/material-experimental/mdc-autocomplete/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ sass_library(
srcs = glob(["**/_*.scss"]),
deps = [
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand All @@ -40,8 +40,8 @@ sass_binary(
],
deps = [
"//src/cdk:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@forward '../mdc-helpers/mdc-helpers.import';
@forward '../mdc-helpers/mdc-helpers';
@forward '../mdc-core/mdc-helpers/mdc-helpers.import';
@forward '../mdc-core/mdc-helpers/mdc-helpers';
@forward 'autocomplete-theme' as mat-mdc-autocomplete-*;

@import '../mdc-helpers/mdc-helpers';
@import '../mdc-core/mdc-helpers/mdc-helpers';
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@use '@material/menu-surface/mixins' as mdc-menu-surface;
@use '@material/list/evolution-mixins' as mdc-list;

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';

@mixin color($config-or-theme) {
$config: mat.get-color-config($config-or-theme);
Expand Down
16 changes: 8 additions & 8 deletions src/material-experimental/mdc-button/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ sass_library(
srcs = glob(["**/_*.scss"]),
deps = [
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand All @@ -55,8 +55,8 @@ sass_binary(
deps = [
":button_base_scss_lib",
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand All @@ -78,8 +78,8 @@ sass_binary(
deps = [
":button_base_scss_lib",
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand All @@ -92,8 +92,8 @@ sass_binary(
deps = [
":button_base_scss_lib",
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-button/_button-base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@use '@angular/material' as mat;
@use '@material/touch-target' as mdc-touch-target;

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';

// Adds styles necessary to provide stateful interactions with the button. This includes providing
// content for the state container's ::before and ::after so that they can be given a background
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@forward '../mdc-helpers/mdc-helpers.import';
@forward '../mdc-core/mdc-helpers/mdc-helpers.import';
@forward '../../material/core/ripple/ripple.import';
@forward '../mdc-helpers/mdc-helpers';
@forward '../mdc-core/mdc-helpers/mdc-helpers';
@forward 'button-theme' hide color, density, theme, typography;
@forward 'button-theme' as mat-mdc-* hide $mat-mdc-mat-button-state-target, mat-mdc-color,
mat-mdc-density, mat-mdc-mat-button-apply-disabled-style, mat-mdc-mat-button-disabled-background,
Expand All @@ -13,4 +13,4 @@ mat-mdc-button-mat-button-disabled-color, mat-mdc-button-mat-button-ripple-ink-c
@forward 'icon-button-theme' as mat-mdc-icon-button-*;

@import '../../material/core/ripple/ripple';
@import '../mdc-helpers/mdc-helpers';
@import '../mdc-core/mdc-helpers/mdc-helpers';
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-button/_button-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@use '@material/button/button-outlined-theme' as mdc-button-outlined-theme;
@use '@material/theme/theme-color' as mdc-theme-color;

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';
@use './button-theme-private';

@mixin _button-variant($color) {
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-button/_fab-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@use '@material/fab/fab-theme' as mdc-fab-theme;
@use '@material/theme/theme-color' as mdc-theme-color;

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';
@use './button-theme-private';

@mixin _fab-variant($foreground, $background) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@use '@material/icon-button/icon-button-theme' as mdc-icon-button-theme;
@use '@material/theme/theme-color' as mdc-theme-color;

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';
@use './button-theme-private';

@mixin color($config-or-theme) {
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-button/button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@use '@material/button/button-protected-theme' as mdc-button-protected-theme;
@use '@material/button/button-outlined-theme' as mdc-button-outlined-theme;

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';
@use './button-base';

@include mdc-helpers.disable-fallback-declarations {
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-button/fab.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
@use '@material/fab' as mdc-fab;
@use '@material/elevation/elevation-theme' as mdc-elevation-theme;

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';
@use './button-base';

@include mdc-helpers.disable-fallback-declarations {
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-button/icon-button.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@use '@material/icon-button/icon-button' as mdc-icon-button;
@use '@material/icon-button/icon-button-theme' as mdc-icon-button-theme;

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';
@use './button-base';

@include mdc-helpers.disable-fallback-declarations {
Expand Down
8 changes: 4 additions & 4 deletions src/material-experimental/mdc-card/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ sass_library(
srcs = glob(["**/_*.scss"]),
deps = [
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand All @@ -40,8 +40,8 @@ sass_binary(
"external/npm/node_modules",
],
deps = [
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand Down
6 changes: 3 additions & 3 deletions src/material-experimental/mdc-card/_card-theme.import.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@forward '../mdc-helpers/mdc-helpers.import';
@forward '../mdc-helpers/mdc-helpers';
@forward '../mdc-core/mdc-helpers/mdc-helpers.import';
@forward '../mdc-core/mdc-helpers/mdc-helpers';
@forward 'card-theme' hide color, density, theme, typography;
@forward 'card-theme' as mat-mdc-card-* hide $mat-mdc-card-mdc-card-action-icon-color,
$mat-mdc-card-mdc-card-outline-color;

@import '../mdc-helpers/mdc-helpers';
@import '../mdc-core/mdc-helpers/mdc-helpers';
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-card/_card-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
@use 'sass:color';
@use 'sass:map';

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';

@mixin color($config-or-theme) {
$config: mat.get-color-config($config-or-theme);
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-card/card.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@use 'sass:math';
@use '@material/card' as mdc-card;
@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';

// TODO(jelbourn): move header and title-group styles to their own files.

Expand Down
8 changes: 4 additions & 4 deletions src/material-experimental/mdc-checkbox/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ sass_library(
srcs = glob(["**/_*.scss"]),
deps = [
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand All @@ -51,8 +51,8 @@ sass_binary(
":mdc_checkbox_scss_lib",
"//src/cdk:sass_lib",
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@forward '../mdc-helpers/mdc-helpers.import';
@forward '../mdc-helpers/mdc-helpers';
@forward '../mdc-core/mdc-helpers/mdc-helpers.import';
@forward '../mdc-core/mdc-helpers/mdc-helpers';
@forward 'checkbox-theme' hide color, density, private-checkbox-styles-with-color, theme,
typography;
@forward 'checkbox-theme' as mat-mdc-* hide $mat-mdc-mdc-checkbox-border-color,
Expand All @@ -12,4 +12,4 @@ mat-mdc-checkbox-background-focus-indicator-checked-color,
mat-mdc-checkbox-background-focus-indicator-color,
mat-mdc-checkbox-private-checkbox-styles-with-color;

@import '../mdc-helpers/mdc-helpers';
@import '../mdc-core/mdc-helpers/mdc-helpers';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@use 'sass:map';
@use 'sass:color';

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';
@use './checkbox-private';

// Apply ripple colors to the MatRipple element and the MDC ripple element when the
Expand Down
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-checkbox/checkbox.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@use '@material/touch-target' as mdc-touch-target;
@use 'sass:map';

@use '../mdc-helpers/mdc-helpers';
@use '../mdc-core/mdc-helpers/mdc-helpers';
@use './checkbox-private';

@include mdc-helpers.disable-fallback-declarations {
Expand Down
12 changes: 6 additions & 6 deletions src/material-experimental/mdc-chips/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ sass_library(
srcs = glob(["**/_*.scss"]),
deps = [
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand All @@ -51,8 +51,8 @@ sass_binary(
deps = [
"//src/cdk:sass_lib",
"//src/material:sass_lib",
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
],
)

Expand All @@ -63,8 +63,8 @@ sass_binary(
"external/npm/node_modules",
],
deps = [
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_helpers_scss_lib",
"//src/material-experimental/mdc-core/mdc-helpers:mdc_scss_deps_lib",
"//src/material/core:core_scss_lib",
],
)
Expand Down
Loading

0 comments on commit 2388fe7

Please sign in to comment.