Skip to content

refactor(cdk/overlay): clean up variable names #22359

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/cdk/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@forward './overlay/overlay' show overlay, $z-index-overlay-container, $z-index-overlay,
$z-index-overlay-backdrop, $dark-backdrop-background;
@forward './overlay/overlay' show overlay, $overlay-container-z-index, $overlay-z-index,
$overlay-backdrop-z-index, $overlay-backdrop-color;
@forward './a11y/a11y' show a11y-visually-hidden, high-contrast;
@forward './text-field/text-field' show text-field-autosize, text-field-autofill,
text-field-autofill-color,
Expand Down
13 changes: 13 additions & 0 deletions src/cdk/overlay/_overlay-deprecated.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
@use './overlay';

// @deprecated Use `$overlay-container-z-index`.
$z-index-overlay-container: overlay.$overlay-container-z-index;

// @deprecated Use `$overlay-z-index`.
$z-index-overlay: overlay.$overlay-z-index;

// @deprecated Use `$overlay-backdrop-color`.
$dark-backdrop-background: overlay.$overlay-backdrop-color;

// @deprecated Use `$overlay-backdrop-z-index`.
$z-index-overlay-backdrop: overlay.$overlay-backdrop-z-index;
13 changes: 8 additions & 5 deletions src/cdk/overlay/_overlay.import.scss
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
@forward '../a11y/a11y' as cdk-*;
@forward 'overlay' hide $dark-backdrop-background, $z-index-overlay, $z-index-overlay-backdrop,
$z-index-overlay-container, overlay;
@forward 'overlay' hide $overlay-backdrop-color, $overlay-z-index, $overlay-backdrop-z-index,
$overlay-container-z-index, overlay;
@forward 'overlay' as cdk-* hide $cdk-backdrop-animation-duration,
$cdk-backdrop-animation-timing-function, $cdk-dark-backdrop-background;
$cdk-backdrop-animation-timing-function, $cdk-overlay-backdrop-color;
@forward 'overlay' as cdk-overlay-* hide $cdk-overlay-backdrop-animation-duration,
$cdk-overlay-backdrop-animation-timing-function, $cdk-overlay-z-index-overlay,
$cdk-overlay-z-index-overlay-backdrop, $cdk-overlay-z-index-overlay-container, cdk-overlay-overlay;
$cdk-overlay-backdrop-animation-timing-function, $cdk-overlay-overlay-z-index,
$cdk-overlay-overlay-backdrop-z-index, $cdk-overlay-overlay-container-z-index,
cdk-overlay-overlay;
@forward './overlay-deprecated' as cdk-*;
@forward './overlay-deprecated' as cdk-overlay-*;

@import '../a11y/a11y';
20 changes: 10 additions & 10 deletions src/cdk/overlay/_overlay.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
// We want overlays to always appear over user content, so set a baseline
// very high z-index for the overlay container, which is where we create the new
// stacking context for all overlays.
$z-index-overlay-container: 1000 !default;
$z-index-overlay: 1000 !default;
$z-index-overlay-backdrop: 1000 !default;
$overlay-container-z-index: 1000 !default;
$overlay-z-index: 1000 !default;
$overlay-backdrop-z-index: 1000 !default;

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

// Default backdrop animation is based on the Material Design swift-ease-out.
$backdrop-animation-duration: 400ms !default;
Expand All @@ -28,7 +28,7 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
// The overlay-container is an invisible element which contains all individual overlays.
.cdk-overlay-container {
position: fixed;
z-index: $z-index-overlay-container;
z-index: $overlay-container-z-index;

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

// A single overlay pane.
Expand All @@ -54,7 +54,7 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
position: absolute;
pointer-events: auto;
box-sizing: border-box;
z-index: $z-index-overlay;
z-index: $overlay-z-index;

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

z-index: $z-index-overlay-backdrop;
z-index: $overlay-backdrop-z-index;
pointer-events: auto;
-webkit-tap-highlight-color: transparent;
transition: opacity $backdrop-animation-duration $backdrop-animation-timing-function;
Expand All @@ -92,7 +92,7 @@ $backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
}

.cdk-overlay-dark-backdrop {
background: $dark-backdrop-background;
background: $overlay-backdrop-color;
}

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

// We use `display: flex` on this element exclusively for centering connected overlays.
// When *not* centering, a top/left/bottom/right will be set which overrides the normal
Expand Down
6 changes: 3 additions & 3 deletions src/material/schematics/ng-generate/theming-api/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('Material theming API schematic', () => {
`@include cdk.overlay();`,
``,
`.my-dialog {`,
`z-index: cdk.$z-index-overlay-container + 1;`,
`z-index: cdk.$overlay-container-z-index + 1;`,
`}`,
``,
`@include cdk.high-contrast(active, off) {`,
Expand Down Expand Up @@ -161,7 +161,7 @@ describe('Material theming API schematic', () => {
`@include mat.all-component-themes($candy-app-theme);`,

`.my-dialog {`,
`z-index: cdk.$z-index-overlay-container + 1;`,
`z-index: cdk.$overlay-container-z-index + 1;`,
`}`
]);
});
Expand Down Expand Up @@ -284,7 +284,7 @@ describe('Material theming API schematic', () => {
expect(getFileContent(tree, '/components/dialog.scss').split('\n')).toEqual([
`@use '~@angular/cdk' as cdk;`,
`.my-dialog {`,
`z-index: cdk.$z-index-overlay-container + 1;`,
`z-index: cdk.$overlay-container-z-index + 1;`,
`}`,
]);
});
Expand Down
8 changes: 4 additions & 4 deletions src/material/schematics/ng-generate/theming-api/migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ const materialVariables: Record<string, string> = {

/** Mapping of CDK variables that should be renamed. */
const cdkVariables: Record<string, string> = {
'cdk-z-index-overlay-container': 'z-index-overlay-container',
'cdk-z-index-overlay': 'z-index-overlay',
'cdk-z-index-overlay-backdrop': 'z-index-overlay-backdrop',
'cdk-overlay-dark-backdrop-background': 'overlay-dark-backdrop-background',
'cdk-z-index-overlay-container': 'overlay-container-z-index',
'cdk-z-index-overlay': 'overlay-z-index',
'cdk-z-index-overlay-backdrop': 'overlay-backdrop-z-index',
'cdk-overlay-dark-backdrop-background': 'overlay-backdrop-color',
};

/** Mapping of CDK mixins that should be renamed. */
Expand Down