Skip to content

Commit 23f3929

Browse files
devversionandrewseguin
authored andcommitted
refactor: switch "material-experimental" away from cross-package relative Sass imports
1 parent 416fcbd commit 23f3929

File tree

102 files changed

+633
-589
lines changed

Some content is hidden

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

102 files changed

+633
-589
lines changed

src/material-experimental/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ sass_library(
2929
)
3030

3131
sass_library(
32-
name = "theming_bundle",
32+
name = "sass_lib",
3333
srcs = ["_index.scss"],
3434
deps = [":theming_scss_lib"],
3535
)
@@ -38,7 +38,7 @@ ng_package(
3838
name = "npm_package",
3939
srcs = ["package.json"],
4040
data = [
41-
":theming_bundle",
41+
":sass_lib",
4242
":theming_scss_lib",
4343
],
4444
tags = ["release-package"],

src/material-experimental/_index.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,4 @@
7373
mdc-tooltip-typography, mdc-tooltip-density, mdc-tooltip-theme;
7474

7575
// Additional public APIs for individual components
76-
@forward './mdc-dialog/dialog-legacy-padding' as mdc-dialog-* show mdc-dialog-legacy-padding;
76+
@forward './mdc-dialog/dialog-legacy-padding' as mdc-dialog-* show mdc-dialog-legacy-padding;

src/material-experimental/column-resize/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ sass_library(
2121
name = "column_resize_scss_lib",
2222
srcs = glob(["**/_*.scss"]),
2323
deps = [
24-
"//src/material/core:core_scss_lib",
24+
"//src/material:sass_lib",
2525
],
2626
)
2727

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

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
@use 'sass:map';
2-
@use '../../material/core/style/variables';
3-
@use '../../material/core/style/vendor-prefixes';
4-
@use '../../material/core/theming/theming';
2+
@use '@angular/material' as mat;
53

64
@mixin color($config-or-theme) {
7-
$config: theming.get-color-config($config-or-theme);
5+
$config: mat.get-color-config($config-or-theme);
86
$primary: map.get($config, primary);
97
$foreground: map.get($config, foreground);
108

11-
$non-resizable-hover-divider: theming.get-color-from-palette($foreground, divider);
12-
$resizable-hover-divider: theming.get-color-from-palette($primary, 600);
13-
$resizable-active-divider: theming.get-color-from-palette($primary, 600);
9+
$non-resizable-hover-divider: mat.get-color-from-palette($foreground, divider);
10+
$resizable-hover-divider: mat.get-color-from-palette($primary, 600);
11+
$resizable-active-divider: mat.get-color-from-palette($primary, 600);
1412

1513
// TODO: these styles don't really belong in the `color` part of the theme.
1614
// We should figure out a better place for them.
@@ -45,8 +43,8 @@
4543
bottom: 0;
4644
position: absolute;
4745
top: 0;
48-
transition: background variables.$swift-ease-in-duration
49-
variables.$swift-ease-in-timing-function;
46+
transition: background mat.$private-swift-ease-in-duration
47+
mat.$private-swift-ease-in-timing-function;
5048
width: 1px;
5149
}
5250

@@ -111,9 +109,9 @@
111109
background: transparent;
112110
cursor: col-resize;
113111
height: 100%;
114-
transition: background variables.$swift-ease-in-duration
115-
variables.$swift-ease-in-timing-function;
116-
@include vendor-prefixes.user-select(none);
112+
transition: background mat.$private-swift-ease-in-duration
113+
mat.$private-swift-ease-in-timing-function;
114+
@include mat.private-user-select(none);
117115
width: 100%;
118116

119117
&:active {
@@ -142,11 +140,11 @@
142140
@mixin density($config-or-theme) {}
143141

144142
@mixin theme($theme-or-color-config) {
145-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
146-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-column-resize') {
147-
$color: theming.get-color-config($theme);
148-
$density: theming.get-density-config($theme);
149-
$typography: theming.get-typography-config($theme);
143+
$theme: mat.private-legacy-get-theme($theme-or-color-config);
144+
@include mat.private-check-duplicate-theme-styles($theme, 'mat-column-resize') {
145+
$color: mat.get-color-config($theme);
146+
$density: mat.get-density-config($theme);
147+
$typography: mat.get-typography-config($theme);
150148

151149
@if $color != null {
152150
@include color($color);

src/material-experimental/mdc-autocomplete/BUILD.bazel

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ sass_library(
2626
name = "mdc_autocomplete_scss_lib",
2727
srcs = glob(["**/_*.scss"]),
2828
deps = [
29+
"//src/material:sass_lib",
2930
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
3031
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
3132
],
@@ -38,9 +39,9 @@ sass_binary(
3839
"external/npm/node_modules",
3940
],
4041
deps = [
42+
"//src/cdk:sass_lib",
4143
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
4244
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
43-
"//src/material/core:core_scss_lib",
4445
],
4546
)
4647

src/material-experimental/mdc-autocomplete/_autocomplete-theme.scss

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1+
@use '@angular/material' as mat;
12
@use '@material/menu-surface/mixins' as mdc-menu-surface;
23
@use '@material/list/evolution-mixins' as mdc-list;
4+
35
@use '../mdc-helpers/mdc-helpers';
4-
@use '../../material/core/typography/typography';
5-
@use '../../material/core/theming/theming';
66

77
@mixin color($config-or-theme) {
8-
$config: theming.get-color-config($config-or-theme);
8+
$config: mat.get-color-config($config-or-theme);
99
@include mdc-helpers.mat-using-mdc-theme($config) {
1010
@include mdc-menu-surface.core-styles(mdc-helpers.$mat-theme-styles-query);
1111
@include mdc-list.without-ripple(mdc-helpers.$mat-theme-styles-query);
1212
}
1313
}
1414

1515
@mixin typography($config-or-theme) {
16-
$config: typography.private-typography-to-2018-config(
17-
theming.get-typography-config($config-or-theme));
16+
$config: mat.private-typography-to-2018-config(
17+
mat.get-typography-config($config-or-theme));
1818
@include mdc-helpers.mat-using-mdc-typography($config) {
1919
@include mdc-menu-surface.core-styles(mdc-helpers.$mat-typography-styles-query);
2020

@@ -29,11 +29,11 @@
2929
@mixin density($config-or-theme) {}
3030

3131
@mixin theme($theme-or-color-config) {
32-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
33-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-autocomplete') {
34-
$color: theming.get-color-config($theme);
35-
$density: theming.get-density-config($theme);
36-
$typography: theming.get-typography-config($theme);
32+
$theme: mat.private-legacy-get-theme($theme-or-color-config);
33+
@include mat.private-check-duplicate-theme-styles($theme, 'mat-mdc-autocomplete') {
34+
$color: mat.get-color-config($theme);
35+
$density: mat.get-density-config($theme);
36+
$typography: mat.get-typography-config($theme);
3737

3838
@if $color != null {
3939
@include color($color);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
@use '@angular/cdk';
12
@use '@material/menu-surface/mixins' as mdc-menu-surface;
23
@use '@material/list/evolution-mixins' as mdc-list;
3-
@use '../../cdk/a11y';
44

55
@include mdc-menu-surface.core-styles($query: structure);
66

@@ -16,7 +16,7 @@
1616
transform-origin: center top;
1717

1818
@include mdc-list.list-base($query: structure);
19-
@include a11y.high-contrast(active, off) {
19+
@include cdk.high-contrast(active, off) {
2020
outline: solid 1px;
2121
}
2222

src/material-experimental/mdc-button/BUILD.bazel

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ sass_library(
3535
name = "mdc_button_scss_lib",
3636
srcs = glob(["**/_*.scss"]),
3737
deps = [
38+
"//src/material:sass_lib",
3839
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
3940
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
4041
],
@@ -53,6 +54,7 @@ sass_binary(
5354
],
5455
deps = [
5556
":button_base_scss_lib",
57+
"//src/material:sass_lib",
5658
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
5759
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
5860
],
@@ -62,7 +64,9 @@ sass_binary(
6264
name = "button_high_contrast_scss",
6365
src = "button-high-contrast.scss",
6466
include_paths = ["external/npm/node_modules"],
65-
deps = ["//src/cdk/a11y:a11y_scss_lib"],
67+
deps = [
68+
"//src/cdk:sass_lib",
69+
],
6670
)
6771

6872
sass_binary(
@@ -73,6 +77,7 @@ sass_binary(
7377
],
7478
deps = [
7579
":button_base_scss_lib",
80+
"//src/material:sass_lib",
7681
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
7782
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
7883
],
@@ -86,6 +91,7 @@ sass_binary(
8691
],
8792
deps = [
8893
":button_base_scss_lib",
94+
"//src/material:sass_lib",
8995
"//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
9096
"//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
9197
],

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

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
@use 'sass:map';
2+
@use '@angular/material' as mat;
23
@use '@material/touch-target' as mdc-touch-target;
4+
35
@use '../mdc-helpers/mdc-helpers';
4-
@use '../../material/core/style/layout-common';
56

67
// Adds styles necessary to provide stateful interactions with the button. This includes providing
78
// content for the state container's ::before and ::after so that they can be given a background
@@ -13,7 +14,7 @@
1314
.mat-mdc-button-ripple,
1415
.mat-mdc-button-persistent-ripple,
1516
.mat-mdc-button-persistent-ripple::before {
16-
@include layout-common.fill;
17+
@include mat.private-fill;
1718

1819
// Disable pointer events for the ripple container and state overlay because the container
1920
// will overlay the user content and we don't want to disable mouse events on the user content.
@@ -46,7 +47,7 @@
4647

4748
// The focus indicator should match the bounds of the entire button.
4849
.mat-mdc-focus-indicator {
49-
@include layout-common.fill();
50+
@include mat.private-fill();
5051
}
5152
}
5253

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
@use 'sass:map';
22
@use '@material/ripple/ripple-theme' as mdc-ripple-theme;
33
@use '@material/theme/theme-color' as mdc-theme-color;
4-
@use '../../material/core/ripple/ripple-theme';
54

65
@mixin _ripple-color($color) {
76
--mat-mdc-button-persistent-ripple-color: #{$color};

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
@use 'sass:map';
2+
@use '@angular/material' as mat;
23
@use '@material/button/button' as mdc-button;
34
@use '@material/button/button-theme' as mdc-button-theme;
45
@use '@material/button/button-text-theme' as mdc-button-text-theme;
56
@use '@material/button/button-filled-theme' as mdc-button-filled-theme;
67
@use '@material/button/button-protected-theme' as mdc-button-protected-theme;
78
@use '@material/button/button-outlined-theme' as mdc-button-outlined-theme;
89
@use '@material/theme/theme-color' as mdc-theme-color;
9-
@use '../../material/core/typography/typography';
10+
1011
@use '../mdc-helpers/mdc-helpers';
11-
@use '../../material/core/theming/theming';
1212
@use './button-theme-private';
1313

1414
@mixin _button-variant($color) {
@@ -38,7 +38,7 @@
3838
}
3939

4040
@mixin color($config-or-theme) {
41-
$config: theming.get-color-config($config-or-theme);
41+
$config: mat.get-color-config($config-or-theme);
4242
@include mdc-helpers.mat-using-mdc-theme($config) {
4343
$is-dark: map.get($config, is-dark);
4444
$on-surface: mdc-theme-color.prop-value(on-surface);
@@ -183,15 +183,15 @@
183183
}
184184

185185
@mixin typography($config-or-theme) {
186-
$config: typography.private-typography-to-2018-config(
187-
theming.get-typography-config($config-or-theme));
186+
$config: mat.private-typography-to-2018-config(
187+
mat.get-typography-config($config-or-theme));
188188
@include mdc-helpers.mat-using-mdc-typography($config) {
189189
@include mdc-button.without-ripple($query: mdc-helpers.$mat-typography-styles-query);
190190
}
191191
}
192192

193193
@mixin density($config-or-theme) {
194-
$density-scale: theming.get-density-config($config-or-theme);
194+
$density-scale: mat.get-density-config($config-or-theme);
195195
.mat-mdc-button,
196196
.mat-mdc-raised-button,
197197
.mat-mdc-unelevated-button,
@@ -205,11 +205,11 @@
205205
}
206206

207207
@mixin theme($theme-or-color-config) {
208-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
209-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-button') {
210-
$color: theming.get-color-config($theme);
211-
$density: theming.get-density-config($theme);
212-
$typography: theming.get-typography-config($theme);
208+
$theme: mat.private-legacy-get-theme($theme-or-color-config);
209+
@include mat.private-check-duplicate-theme-styles($theme, 'mat-mdc-button') {
210+
$color: mat.get-color-config($theme);
211+
$density: mat.get-density-config($theme);
212+
$typography: mat.get-typography-config($theme);
213213

214214
@if $color != null {
215215
@include color($color);

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
@use 'sass:map';
2+
@use '@angular/material' as mat;
23
@use '@material/fab/fab' as mdc-fab;
34
@use '@material/fab/fab-theme' as mdc-fab-theme;
45
@use '@material/theme/theme-color' as mdc-theme-color;
6+
57
@use '../mdc-helpers/mdc-helpers';
6-
@use '../../material/core/theming/theming';
7-
@use '../../material/core/typography/typography';
88
@use './button-theme-private';
99

1010
@mixin _fab-variant($foreground, $background) {
@@ -17,7 +17,7 @@
1717
}
1818

1919
@mixin color($config-or-theme) {
20-
$config: theming.get-color-config($config-or-theme);
20+
$config: mat.get-color-config($config-or-theme);
2121
@include mdc-helpers.mat-using-mdc-theme($config) {
2222
$on-surface: mdc-theme-color.prop-value(on-surface);
2323
$is-dark: map.get($config, is-dark);
@@ -61,8 +61,8 @@
6161
}
6262

6363
@mixin typography($config-or-theme) {
64-
$config: typography.private-typography-to-2018-config(
65-
theming.get-typography-config($config-or-theme));
64+
$config: mat.private-typography-to-2018-config(
65+
mat.get-typography-config($config-or-theme));
6666
@include mdc-helpers.mat-using-mdc-typography($config) {
6767
@include mdc-fab.without-ripple($query: mdc-helpers.$mat-typography-styles-query);
6868
}
@@ -71,11 +71,11 @@
7171
@mixin density($config-or-theme) {}
7272

7373
@mixin theme($theme-or-color-config) {
74-
$theme: theming.private-legacy-get-theme($theme-or-color-config);
75-
@include theming.private-check-duplicate-theme-styles($theme, 'mat-mdc-fab') {
76-
$color: theming.get-color-config($theme);
77-
$density: theming.get-density-config($theme);
78-
$typography: theming.get-typography-config($theme);
74+
$theme: mat.private-legacy-get-theme($theme-or-color-config);
75+
@include mat.private-check-duplicate-theme-styles($theme, 'mat-mdc-fab') {
76+
$color: mat.get-color-config($theme);
77+
$density: mat.get-density-config($theme);
78+
$typography: mat.get-typography-config($theme);
7979

8080
@if $color != null {
8181
@include color($color);

0 commit comments

Comments
 (0)