Skip to content

Commit 029136e

Browse files
authored
refactor(material/core): resolve circular dependencies (#21110)
Hopefully the last set of code changes for the Sass module system migration. * Combines `theming/_theming.scss` and `theming/_private.scss`, because they had a circular dependency and since `theming.scss` could be considered a public API, we can't move the utilities out into a shared file. * Changes the `angular-material-density` mixin to include density mixins individually, instead of going through `angular-material-theme`. The previous approach had transient circular dependencies that will turn into hard errors once we switch to the Sass module system. The new approach is in line with what we're doing already inside `angular-material-typography`. * Switches a few MDC function calls to go through `@use` instead of `@import`. For some reason Sass was having a hard time finding the old ones after the files are migrated to the module system. * Passes a variable as a parameter to `mat-mdc-private-dialog-structure-overrides`, instead of expecting it to be available as a global variable. This seems like an oversight. * Fixes several places where mixins were being imported transitevely, rather than explicitly. This will be an error with the Sass module system.
1 parent 26c7e54 commit 029136e

File tree

67 files changed

+220
-237
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+220
-237
lines changed

src/dev-app/theme.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ $dark-theme: mat-dark-theme((
8686
// The classes are applied conditionally based on the selected density in the dev-app layout
8787
// component.
8888
$density-scales: (-1, -2, minimum, maximum);
89-
@each $density in$density-scales {
89+
@each $density in $density-scales {
9090
.demo-density-#{$density} {
9191
@include angular-material-density($density);
9292
@include angular-material-mdc-density($density);

src/material-experimental/column-resize/_column-resize.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
@import '../../material/core/style/variables';
22
@import '../../material/core/style/vendor-prefixes';
3-
@import '../../material/core/theming/private';
43
@import '../../material/core/theming/palette';
54
@import '../../material/core/theming/theming';
65

src/material-experimental/mdc-button/_button-theme.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@import '@material/fab/mixins.import';
44
@import '@material/ripple/mixins.import';
55
@import '@material/icon-button/mixins.import';
6+
@import '@material/theme/mixins.import';
67
@import '../../material/core/ripple/ripple';
78
@import '../mdc-helpers/mdc-helpers';
89

src/material-experimental/mdc-core/_core.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../material/core/theming/private';
1+
@import '../../material/core/theming/theming';
22
@import './option/option-theme';
33
@import './option/optgroup-theme';
44

src/material-experimental/mdc-core/option/_optgroup-theme.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
@import '@material/list/mixins.import';
22
@import '@material/list/variables.import';
33
@import '@material/theme/functions.import';
4+
@import '@material/theme/mixins.import';
45
@import '../../mdc-helpers/mdc-helpers';
5-
@import '../../../material/core/theming/private';
6+
@import '../../../material/core/theming/theming';
67

78
@mixin mat-mdc-optgroup-color($config-or-theme) {
89
$config: mat-get-color-config($config-or-theme);

src/material-experimental/mdc-core/option/_option-theme.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
@import '@material/list/mixins.import';
22
@import '@material/list/variables.import';
33
@import '@material/theme/functions.import';
4+
@import '@material/theme/mixins.import';
45
@import '../../mdc-helpers/mdc-helpers';
5-
@import '../../../material/core/theming/private';
6+
@import '../../../material/core/theming/theming';
67

78
@mixin mat-mdc-option-color($config-or-theme) {
89
$config: mat-get-color-config($config-or-theme);

src/material-experimental/mdc-dialog/_mdc-dialog-structure-overrides.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Mixin that can be included to override the default MDC dialog styles to fit
22
// our needs. See individual comments for context on why certain styles need to be modified.
3-
@mixin mat-mdc-private-dialog-structure-overrides() {
3+
@mixin mat-mdc-private-dialog-structure-overrides($content-max-height) {
44
// MDC dialog sets max-height and max-width on the `mdc-dialog__surface` element. This
55
// element is the parent of the portal outlet. This means that the actual user-content
66
// is scrollable, but as per Material Design specification, only the dialog content
@@ -10,7 +10,7 @@
1010
// an explicit max-height for the content element, so that the content is scrollable. This
1111
// matches the behavior from the non-MDC dialog and is backwards compatible.
1212
.mat-mdc-dialog-content {
13-
max-height: $mat-dialog-content-max-height;
13+
max-height: $content-max-height;
1414
}
1515

1616
.mat-mdc-dialog-container {

src/material-experimental/mdc-dialog/dialog.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ $mat-dialog-content-max-height: 65vh !default;
1212
$mat-dialog-button-horizontal-margin: 8px !default;
1313

1414
@include mdc-dialog-core-styles($query: $mat-base-styles-query);
15-
@include mat-mdc-private-dialog-structure-overrides();
15+
@include mat-mdc-private-dialog-structure-overrides($mat-dialog-content-max-height);
1616

1717
// The dialog container is focusable. We remove the default outline shown in browsers.
1818
.mat-mdc-dialog-container {

src/material-experimental/mdc-form-field/_form-field-density.scss

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
@import '@material/density/functions.import';
1+
@use '@material/density';
22
@import '@material/textfield/variables.import';
3+
@import '../../material/core/theming/theming';
34
@import 'form-field-sizing';
45

56
// Mixin that sets the vertical spacing for the infix container of filled form fields.
@@ -38,7 +39,7 @@
3839
@mixin mat-mdc-private-form-field-density($config-or-theme) {
3940
$density-scale: mat-get-density-config($config-or-theme);
4041
// Height of the form field that is based on the current density scale.
41-
$height: mdc-density-prop-value(
42+
$height: density.prop-value(
4243
$density-config: $mdc-text-field-density-config,
4344
$density-scale: $density-scale,
4445
$property-name: height,

src/material-experimental/mdc-form-field/_form-field-subscript.scss

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
@import '@material/theme/mixins.import';
2+
@import '@material/textfield/variables.import';
13
@import 'form-field-sizing';
24
@import '../mdc-helpers/mdc-helpers';
35

0 commit comments

Comments
 (0)