Skip to content

Commit 4d82f83

Browse files
jelbournmmalerba
authored andcommitted
feat(cdk): move overlay into cdk (#6100)
1 parent 0754320 commit 4d82f83

File tree

110 files changed

+554
-535
lines changed

Some content is hidden

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

110 files changed

+554
-535
lines changed

scripts/closure-compiler/build-devapp-bundle.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ $(npm bin)/ngc -p scripts/closure-compiler/tsconfig-rxjs.json
2424
rxjsSourceFiles=$(find dist/packages/rxjs -name '*.js');
2525

2626
# List of entry points in the CDK package. Exclude "testing" since it's not an entry point.
27-
cdkEntryPoints=($(find src/cdk/* -type d ! -name testing -exec basename {} \;))
27+
cdkEntryPoints=($(find src/cdk -maxdepth 1 -mindepth 1 -type d -not -name testing -exec basename {} \;))
2828

2929
# Due a Closure Compiler issue https://github.com/google/closure-compiler/issues/2247
3030
# we need to add exports to the different RxJS ES2015 files.

src/lib/core/overlay/_overlay.scss renamed to src/cdk/overlay/_overlay.scss

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
1-
@import '../style/variables';
1+
// We want overlays to always appear over user content, so set a baseline
2+
// very high z-index for the overlay container, which is where we create the new
3+
// stacking context for all overlays.
4+
$cdk-z-index-overlay-container: 1000;
5+
$cdk-z-index-overlay: 1000;
6+
$cdk-z-index-overlay-backdrop: 1000;
7+
8+
// Background color for all of the backdrops
9+
$cdk-overlay-dark-backdrop-background: rgba(0, 0, 0, 0.6);
10+
11+
// Default backdrop animation is based on the Material Design swift-ease-out.
12+
$backdrop-animation-duration: 400ms !default;
13+
$backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default;
214

315

416
@mixin cdk-overlay() {
@@ -48,10 +60,7 @@
4860
z-index: $cdk-z-index-overlay-backdrop;
4961
pointer-events: auto;
5062
-webkit-tap-highlight-color: transparent;
51-
52-
// TODO(jelbourn): figure out if there are actually spec'ed colors for both light and dark
53-
// themes here. Currently using the values from AngularJS Material.
54-
transition: opacity $swift-ease-out-duration $swift-ease-out-timing-function;
63+
transition: opacity $backdrop-animation-duration $backdrop-animation-timing-function;
5564
opacity: 0;
5665

5766
&.cdk-overlay-backdrop-showing {

src/cdk/overlay/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/**
2+
* @license
3+
* Copyright Google Inc. All Rights Reserved.
4+
*
5+
* Use of this source code is governed by an MIT-style license that can be
6+
* found in the LICENSE file at https://angular.io/license
7+
*/
8+
9+
export * from './public_api';

src/lib/core/overlay/overlay-directives.spec.ts renamed to src/cdk/overlay/overlay-directives.spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
21
import {Component, ViewChild} from '@angular/core';
32
import {By} from '@angular/platform-browser';
3+
import {ComponentFixture, TestBed, async} from '@angular/core/testing';
4+
import {Directionality} from '@angular/cdk/bidi';
5+
import {dispatchKeyboardEvent} from '@angular/cdk/testing';
6+
import {ESCAPE} from '@angular/cdk/keycodes';
47
import {ConnectedOverlayDirective, OverlayModule, OverlayOrigin} from './index';
58
import {OverlayContainer} from './overlay-container';
69
import {ConnectedPositionStrategy} from './position/connected-position-strategy';
710
import {ConnectedOverlayPositionChange} from './position/connected-position';
8-
import {Directionality} from '../bidi/index';
9-
import {dispatchKeyboardEvent} from '@angular/cdk/testing';
10-
import {ESCAPE} from '../keyboard/keycodes';
1111

1212

1313
describe('Overlay directives', () => {

src/lib/core/overlay/overlay-directives.ts renamed to src/cdk/overlay/overlay-directives.ts

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,37 @@
77
*/
88

99
import {
10-
Directive,
11-
EventEmitter,
12-
TemplateRef,
13-
ViewContainerRef,
14-
Optional,
15-
Input,
16-
OnDestroy,
17-
Output,
18-
ElementRef,
19-
Renderer2,
20-
OnChanges,
21-
SimpleChanges,
22-
InjectionToken,
23-
Inject,
10+
Directive,
11+
ElementRef,
12+
EventEmitter,
13+
Inject,
14+
InjectionToken,
15+
Input,
16+
OnChanges,
17+
OnDestroy,
18+
Optional,
19+
Output,
20+
Renderer2,
21+
SimpleChanges,
22+
TemplateRef,
23+
ViewContainerRef,
2424
} from '@angular/core';
25+
import {Direction, Directionality} from '@angular/cdk/bidi';
26+
import {coerceBooleanProperty} from '@angular/cdk/coercion';
27+
import {ESCAPE} from '@angular/cdk/keycodes';
28+
import {TemplatePortal} from '@angular/cdk/portal';
2529
import {Overlay} from './overlay';
2630
import {OverlayRef} from './overlay-ref';
27-
import {TemplatePortal} from '../portal/portal';
2831
import {OverlayState} from './overlay-state';
2932
import {
30-
ConnectionPositionPair,
31-
// This import is only used to define a generic type. The current TypeScript version incorrectly
32-
// considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953)
33-
// tslint:disable-next-line:no-unused-variable
34-
ConnectedOverlayPositionChange
33+
// This import is only used to define a generic type. The current TypeScript version incorrectly
34+
// considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953)
35+
// tslint:disable-next-line:no-unused-variable
36+
ConnectedOverlayPositionChange,
37+
ConnectionPositionPair,
3538
} from './position/connected-position';
3639
import {ConnectedPositionStrategy} from './position/connected-position-strategy';
37-
import {Directionality, Direction} from '../bidi/index';
38-
import {coerceBooleanProperty} from '@angular/cdk/coercion';
39-
import {ScrollStrategy, RepositionScrollStrategy} from './scroll/index';
40-
import {ESCAPE} from '../keyboard/keycodes';
40+
import {RepositionScrollStrategy, ScrollStrategy} from './scroll/index';
4141
import {Subscription} from 'rxjs/Subscription';
4242

4343

@@ -56,7 +56,8 @@ export const MD_CONNECTED_OVERLAY_SCROLL_STRATEGY =
5656
new InjectionToken<() => ScrollStrategy>('md-connected-overlay-scroll-strategy');
5757

5858
/** @docs-private */
59-
export function MD_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay) {
59+
export function MD_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay):
60+
() => RepositionScrollStrategy {
6061
return () => overlay.scrollStrategies.reposition();
6162
}
6263

src/cdk/overlay/overlay-prebuilt.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
@import './overlay';
2+
3+
@include cdk-overlay();

src/lib/core/overlay/overlay-ref.ts renamed to src/cdk/overlay/overlay-ref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88

99
import {NgZone} from '@angular/core';
10-
import {PortalHost, Portal} from '../portal/portal';
10+
import {PortalHost, Portal} from '@angular/cdk/portal';
1111
import {OverlayState} from './overlay-state';
1212
import {Observable} from 'rxjs/Observable';
1313
import {Subject} from 'rxjs/Subject';

0 commit comments

Comments
 (0)