Skip to content

Commit 4b8564f

Browse files
committed
refactor(material/core): run sass module migration
1 parent fc2a98b commit 4b8564f

File tree

342 files changed

+6353
-4808
lines changed

Some content is hidden

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

342 files changed

+6353
-4808
lines changed

src/cdk/a11y/_a11y.import.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
@forward 'a11y';
1+
@forward 'a11y' hide a11y, high-contrast;
2+
@forward 'a11y' as cdk-* hide cdk-optionally-nest-content;

src/cdk/a11y/_a11y.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@mixin cdk-a11y {
1+
@mixin a11y {
22
.cdk-visually-hidden {
33
border: 0;
44
clip: rect(0 0 0 0);
@@ -42,7 +42,7 @@
4242
/// * `on` - works for `Emulated`, `Native`, and `ShadowDom`
4343
/// * `off` - works for `None`
4444
/// * `any` - works for all encapsulation modes by emitting the CSS twice (default).
45-
@mixin cdk-high-contrast($target: active, $encapsulation: 'any') {
45+
@mixin high-contrast($target: active, $encapsulation: 'any') {
4646
@if ($target != 'active' and $target != 'black-on-white' and $target != 'white-on-black') {
4747
@error 'Unknown cdk-high-contrast value "#{$target}" provided. ' +
4848
'Allowed values are "active", "black-on-white", and "white-on-black"';

src/cdk/a11y/a11y-prebuilt.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
@import './a11y';
1+
@use './a11y';
22

3-
@include cdk-a11y();
3+
@include a11y.a11y();

src/cdk/overlay/_overlay.import.scss

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1-
@forward 'overlay';
1+
@forward '../a11y/a11y' as cdk-*;
2+
@forward 'overlay' hide $dark-backdrop-background, $z-index-overlay, $z-index-overlay-backdrop,
3+
$z-index-overlay-container, overlay;
4+
@forward 'overlay' as cdk-* hide $cdk-backdrop-animation-duration,
5+
$cdk-backdrop-animation-timing-function, $cdk-dark-backdrop-background;
6+
@forward 'overlay' as cdk-overlay-* hide $cdk-overlay-backdrop-animation-duration,
7+
$cdk-overlay-backdrop-animation-timing-function, $cdk-overlay-z-index-overlay,
8+
$cdk-overlay-z-index-overlay-backdrop, $cdk-overlay-z-index-overlay-container, cdk-overlay-overlay;
9+
10+
@import '../a11y/a11y';

src/cdk/overlay/_overlay.scss

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
@import '../a11y/a11y';
1+
@use '../a11y/a11y';
22

33
// We want overlays to always appear over user content, so set a baseline
44
// very high z-index for the overlay container, which is where we create the new
55
// stacking context for all overlays.
6-
$cdk-z-index-overlay-container: 1000 !default;
7-
$cdk-z-index-overlay: 1000 !default;
8-
$cdk-z-index-overlay-backdrop: 1000 !default;
6+
$z-index-overlay-container: 1000 !default;
7+
$z-index-overlay: 1000 !default;
8+
$z-index-overlay-backdrop: 1000 !default;
99

1010
// Background color for all of the backdrops
11-
$cdk-overlay-dark-backdrop-background: rgba(0, 0, 0, 0.32) !default;
11+
$dark-backdrop-background: rgba(0, 0, 0, 0.32) !default;
1212

1313
// Default backdrop animation is based on the Material Design swift-ease-out.
1414
$backdrop-animation-duration: 400ms !default;
1515
$backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
1616

1717

18-
@mixin cdk-overlay() {
18+
@mixin overlay() {
1919
.cdk-overlay-container, .cdk-global-overlay-wrapper {
2020
// Disable events from being captured on the overlay container.
2121
pointer-events: none;
@@ -30,7 +30,7 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
3030
// The overlay-container is an invisible element which contains all individual overlays.
3131
.cdk-overlay-container {
3232
position: fixed;
33-
z-index: $cdk-z-index-overlay-container;
33+
z-index: $z-index-overlay-container;
3434

3535
&:empty {
3636
// Hide the element when it doesn't have any child nodes. This doesn't
@@ -46,7 +46,7 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
4646
.cdk-global-overlay-wrapper {
4747
display: flex;
4848
position: absolute;
49-
z-index: $cdk-z-index-overlay;
49+
z-index: $z-index-overlay;
5050
}
5151

5252
// A single overlay pane.
@@ -56,7 +56,7 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
5656
position: absolute;
5757
pointer-events: auto;
5858
box-sizing: border-box;
59-
z-index: $cdk-z-index-overlay;
59+
z-index: $z-index-overlay;
6060

6161
// For connected-position overlays, we set `display: flex` in
6262
// order to force `max-width` and `max-height` to take effect.
@@ -73,7 +73,7 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
7373
left: 0;
7474
right: 0;
7575

76-
z-index: $cdk-z-index-overlay-backdrop;
76+
z-index: $z-index-overlay-backdrop;
7777
pointer-events: auto;
7878
-webkit-tap-highlight-color: transparent;
7979
transition: opacity $backdrop-animation-duration $backdrop-animation-timing-function;
@@ -86,14 +86,14 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
8686
// to making it opaque using `opacity`. Note that we can't use the `cdk-high-contrast`
8787
// mixin, because we can't normalize the import path to the _a11y.scss both for the
8888
// source and when this file is distributed. See #10908.
89-
@include cdk-high-contrast(active, off) {
89+
@include a11y.high-contrast(active, off) {
9090
opacity: 0.6;
9191
}
9292
}
9393
}
9494

9595
.cdk-overlay-dark-backdrop {
96-
background: $cdk-overlay-dark-backdrop-background;
96+
background: $dark-backdrop-background;
9797
}
9898

9999
.cdk-overlay-transparent-backdrop {
@@ -110,7 +110,7 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
110110
// overlay element's size to fit within the viewport.
111111
.cdk-overlay-connected-position-bounding-box {
112112
position: absolute;
113-
z-index: $cdk-z-index-overlay;
113+
z-index: $z-index-overlay;
114114

115115
// We use `display: flex` on this element exclusively for centering connected overlays.
116116
// When *not* centering, a top/left/bottom/right will be set which overrides the normal

src/cdk/overlay/overlay-prebuilt.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
@import './overlay';
1+
@use './overlay';
22

3-
@include cdk-overlay();
3+
@include overlay.overlay();
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,5 @@
1-
@forward 'text-field';
1+
@forward 'text-field' hide $autofill-color-frame-count, autofill-color, text-field;
2+
@forward 'text-field' as cdk-* hide $cdk-autofill-color-frame-count, cdk-autofill-color,
3+
cdk-textarea-autosize-measuring-base;
4+
@forward 'text-field' as cdk-text-field-* hide cdk-text-field-text-field,
5+
cdk-text-field-textarea-autosize-measuring-base;

src/cdk/text-field/_text-field.scss

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Core styles that enable monitoring autofill state of text fields.
2-
@mixin cdk-text-field {
2+
@mixin text-field {
33
// Keyframes that apply no styles, but allow us to monitor when an text field becomes autofilled
44
// by watching for the animation events that are fired when they start. Note: the /*!*/ comment is
55
// needed to prevent LibSass from stripping the keyframes out.
@@ -52,30 +52,30 @@
5252
}
5353

5454
// Used to generate UIDs for keyframes used to change the text field autofill styles.
55-
$cdk-text-field-autofill-color-frame-count: 0;
55+
$autofill-color-frame-count: 0;
5656

5757
// Mixin used to apply custom background and foreground colors to an autofilled text field.
5858
// Based on: https://stackoverflow.com/questions/2781549/
5959
// removing-input-background-colour-for-chrome-autocomplete#answer-37432260
60-
@mixin cdk-text-field-autofill-color($background, $foreground:'') {
61-
@keyframes cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count} {
60+
@mixin autofill-color($background, $foreground:'') {
61+
@keyframes cdk-text-field-autofill-color-#{$autofill-color-frame-count} {
6262
to {
6363
background: $background;
6464
@if $foreground != '' { color: $foreground; }
6565
}
6666
}
6767

6868
&:-webkit-autofill {
69-
animation: cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count} both;
69+
animation: cdk-text-field-autofill-color-#{$autofill-color-frame-count} both;
7070
}
7171

7272
&.cdk-text-field-autofill-monitored:-webkit-autofill {
7373
// Since Chrome 80 we need a 1ms delay for cdk-text-field-autofill-start, or the animationstart
7474
// event won't fire.
7575
animation: cdk-text-field-autofill-start 0s 1ms,
76-
cdk-text-field-autofill-color-#{$cdk-text-field-autofill-color-frame-count} both;
76+
cdk-text-field-autofill-color-#{$autofill-color-frame-count} both;
7777
}
7878

79-
$cdk-text-field-autofill-color-frame-count:
80-
$cdk-text-field-autofill-color-frame-count + 1 !global;
79+
$autofill-color-frame-count:
80+
$autofill-color-frame-count + 1 !global;
8181
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
@import 'text-field';
1+
@use 'text-field';
22

3-
@include cdk-text-field();
3+
@include text-field.text-field();

src/dev-app/datepicker/datepicker-demo.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../material/datepicker/datepicker-theme';
1+
@use '../../material/datepicker/datepicker-theme';
22

33
mat-calendar {
44
width: 300px;
@@ -9,5 +9,5 @@ mat-calendar {
99
}
1010

1111
.demo-custom-range {
12-
@include mat-date-range-colors(hotpink, teal, yellow, purple);
12+
@include datepicker-theme.date-range-colors(hotpink, teal, yellow, purple);
1313
}

src/dev-app/input/input-demo.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../cdk/text-field/text-field';
1+
@use '../../cdk/text-field/text-field';
22

33
.demo-basic {
44
padding: 0;
@@ -33,7 +33,7 @@
3333
}
3434

3535
.demo-custom-autofill-style {
36-
@include cdk-text-field-autofill-color(transparent, red);
36+
@include text-field.autofill-color(transparent, red);
3737
}
3838

3939
.demo-rows {

src/dev-app/mdc-dialog/mdc-dialog-demo.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../material-experimental/mdc-dialog/dialog-legacy-padding';
1+
@use '../../material-experimental/mdc-dialog/dialog-legacy-padding';
22

33
.demo-dialog-card {
44
max-width: 600px;
@@ -24,5 +24,5 @@
2424
}
2525

2626
.demo-dialog-legacy-padding {
27-
@include mat-mdc-dialog-legacy-padding();
27+
@include dialog-legacy-padding.legacy-padding();
2828
}

src/dev-app/mdc-input/mdc-input-demo.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@import '../../cdk/text-field/text-field';
1+
@use '../../cdk/text-field/text-field';
22

33
.demo-basic {
44
padding: 0;
@@ -41,7 +41,7 @@
4141
}
4242

4343
.demo-custom-autofill-style {
44-
@include cdk-text-field-autofill-color(transparent, red);
44+
@include text-field.autofill-color(transparent, red);
4545
}
4646

4747
.demo-rows {

src/dev-app/theme.scss

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,61 @@
1-
@import '../material/core/color/all-color';
2-
@import '../material/core/density/private/all-density';
3-
@import '../material/core/focus-indicators/focus-indicators';
4-
@import '../material/core/theming/all-theme';
5-
@import '../material-experimental/column-resize/column-resize';
6-
@import '../material-experimental/mdc-helpers/mdc-helpers';
7-
@import '../material-experimental/mdc-helpers/focus-indicators';
8-
@import '../material-experimental/mdc-color/all-color';
9-
@import '../material-experimental/mdc-theming/all-theme';
10-
@import '../material-experimental/mdc-typography/all-typography';
11-
@import '../material-experimental/mdc-density/all-density';
12-
@import '../material-experimental/mdc-slider/slider-theme';
13-
@import '../material-experimental/popover-edit/popover-edit';
14-
@import '../material-experimental/mdc-table/table-theme';
1+
@use '../material/core/color/all-color' as color-all-color;
2+
@use '../material/core/density/private/all-density' as private-all-density;
3+
@use '../material/core/focus-indicators/focus-indicators' as focus-indicators-focus-indicators;
4+
@use '../material/core/theming/all-theme' as theming-all-theme;
5+
@use '../material-experimental/column-resize/column-resize';
6+
@use '../material-experimental/mdc-helpers/mdc-helpers';
7+
@use '../material-experimental/mdc-helpers/focus-indicators';
8+
@use '../material-experimental/mdc-color/all-color';
9+
@use '../material-experimental/mdc-theming/all-theme';
10+
@use '../material-experimental/mdc-typography/all-typography';
11+
@use '../material-experimental/mdc-density/all-density';
12+
@use '../material-experimental/mdc-slider/slider-theme';
13+
@use '../material-experimental/popover-edit/popover-edit';
14+
@use '../material-experimental/mdc-table/table-theme';
15+
@use '../material/core/core';
16+
@use '../material/core/theming/palette';
17+
@use '../material/core/theming/theming';
18+
@use '../material/core/typography/typography';
1519

1620
// Plus imports for other components in your app.
1721

1822
// Include the common styles for Angular Material. We include this here so that you only
1923
// have to load a single css file for Angular Material in your app.
2024
// **Be sure that you only ever include this mixin once!**
21-
@include mat-core();
22-
@include angular-material-mdc-typography(mat-mdc-typography-config());
23-
@include mat-popover-edit-typography(mat-typography-config());
25+
@include core.core();
26+
@include all-typography.angular-material-mdc-typography(all-typography.config());
27+
@include popover-edit.typography(typography.config());
2428

2529
// Include base styles for strong focus indicators.
2630
.demo-strong-focus {
27-
@include mat-strong-focus-indicators();
28-
@include mat-mdc-strong-focus-indicators();
31+
@include focus-indicators-focus-indicators.strong-focus-indicators();
32+
@include focus-indicators.strong-focus-indicators();
2933
}
3034

3135
// Define the default theme (same as the example above).
32-
$candy-app-primary: mat-palette($mat-indigo);
33-
$candy-app-accent: mat-palette($mat-pink, A200, A100, A400);
34-
$candy-app-theme: mat-light-theme((
36+
$candy-app-primary: theming.palette(palette.$indigo);
37+
$candy-app-accent: theming.palette(palette.$pink, A200, A100, A400);
38+
$candy-app-theme: theming.light-theme((
3539
color: (
3640
primary: $candy-app-primary,
3741
accent: $candy-app-accent
3842
)
3943
));
4044

4145
// Include the default theme styles.
42-
@include angular-material-theme($candy-app-theme);
43-
@include angular-material-mdc-theme($candy-app-theme);
44-
@include mat-column-resize-theme($candy-app-theme);
45-
@include mat-popover-edit-theme($candy-app-theme);
46+
@include theming-all-theme.angular-material-theme($candy-app-theme);
47+
@include all-theme.angular-material-mdc-theme($candy-app-theme);
48+
@include column-resize.theme($candy-app-theme);
49+
@include popover-edit.theme($candy-app-theme);
4650

4751
// We add this in manually for now, because it isn't included in `angular-material-mdc-theme`.
48-
@include mat-mdc-slider-theme($candy-app-theme);
52+
@include slider-theme.theme($candy-app-theme);
4953

5054
// Define an alternate dark theme.
51-
$dark-primary: mat-palette($mat-blue-grey);
52-
$dark-accent: mat-palette($mat-amber, A200, A100, A400);
53-
$dark-warn: mat-palette($mat-deep-orange);
54-
$dark-theme: mat-dark-theme((
55+
$dark-primary: theming.palette(palette.$blue-grey);
56+
$dark-accent: theming.palette(palette.$amber, A200, A100, A400);
57+
$dark-warn: theming.palette(palette.$deep-orange);
58+
$dark-theme: theming.dark-theme((
5559
color: (
5660
primary: $dark-primary,
5761
accent: $dark-accent,
@@ -61,26 +65,26 @@ $dark-theme: mat-dark-theme((
6165

6266
// Include the default theme for focus indicators.
6367
.demo-strong-focus {
64-
@include mat-strong-focus-indicators-theme($candy-app-theme);
65-
@include mat-mdc-strong-focus-indicators-theme($candy-app-theme);
68+
@include focus-indicators-focus-indicators.strong-focus-indicators-theme($candy-app-theme);
69+
@include focus-indicators.strong-focus-indicators-theme($candy-app-theme);
6670
}
6771

6872
// Include the alternative theme styles inside of a block with a CSS class. You can make this
6973
// CSS class whatever you want. In this example, any component inside of an element with
7074
// `.demo-unicorn-dark-theme` will be affected by this alternate dark theme instead of the
7175
// default theme.
7276
.demo-unicorn-dark-theme {
73-
@include angular-material-color($dark-theme);
74-
@include angular-material-mdc-color($dark-theme);
75-
@include mat-column-resize-color($dark-theme);
76-
@include mat-popover-edit-color($dark-theme);
77-
@include mat-mdc-slider-color($dark-theme);
77+
@include color-all-color.angular-material-color($dark-theme);
78+
@include all-color.angular-material-mdc-color($dark-theme);
79+
@include column-resize.color($dark-theme);
80+
@include popover-edit.color($dark-theme);
81+
@include slider-theme.color($dark-theme);
7882
}
7983

8084
// Include the dark theme for focus indicators.
8185
.demo-unicorn-dark-theme.demo-strong-focus {
82-
@include mat-strong-focus-indicators-color($dark-theme);
83-
@include mat-mdc-strong-focus-indicators-color($dark-theme);
86+
@include focus-indicators-focus-indicators.strong-focus-indicators-color($dark-theme);
87+
@include focus-indicators.strong-focus-indicators-color($dark-theme);
8488
}
8589

8690
// Create classes for all density scales which are supported by all MDC-based components.
@@ -89,7 +93,7 @@ $dark-theme: mat-dark-theme((
8993
$density-scales: (-1, -2, minimum, maximum);
9094
@each $density in $density-scales {
9195
.demo-density-#{$density} {
92-
@include angular-material-density($density);
93-
@include angular-material-mdc-density($density);
96+
@include private-all-density.angular-material-density($density);
97+
@include all-density.angular-material-mdc-density($density);
9498
}
9599
}

0 commit comments

Comments
 (0)