From eb1293cba047d0ac310d216ac310ae16f5104e4c Mon Sep 17 00:00:00 2001 From: Jeremy Elbourn Date: Thu, 27 Jul 2017 13:01:11 -0700 Subject: [PATCH] feat(cdk): move overlay into cdk --- .../closure-compiler/build-devapp-bundle.sh | 2 +- src/{lib/core => cdk}/overlay/_overlay.scss | 19 ++- .../overlay/fullscreen-overlay-container.ts | 0 .../overlay/generic-component-type.ts | 0 src/cdk/overlay/index.ts | 9 ++ .../core => cdk}/overlay/overlay-container.ts | 0 .../overlay/overlay-directives.spec.ts | 8 +- .../overlay/overlay-directives.ts | 51 +++---- src/cdk/overlay/overlay-prebuilt.scss | 3 + src/{lib/core => cdk}/overlay/overlay-ref.ts | 2 +- .../core => cdk}/overlay/overlay-state.ts | 2 +- src/{lib/core => cdk}/overlay/overlay.spec.ts | 16 ++- src/{lib/core => cdk}/overlay/overlay.ts | 2 +- .../connected-position-strategy.spec.ts | 0 .../position/connected-position-strategy.ts | 0 .../overlay/position/connected-position.ts | 0 .../position/global-position-strategy.spec.ts | 0 .../position/global-position-strategy.ts | 0 .../position/overlay-position-builder.ts | 2 +- .../overlay/position/position-strategy.ts | 0 .../overlay/position/viewport-ruler.spec.ts | 2 +- .../overlay/position/viewport-ruler.ts | 0 src/cdk/overlay/public_api.ts | 55 ++++++++ .../scroll/block-scroll-strategy.spec.ts | 7 +- .../overlay/scroll/block-scroll-strategy.ts | 0 .../scroll/close-scroll-strategy.spec.ts | 5 +- .../overlay/scroll/close-scroll-strategy.ts | 0 src/{lib/core => cdk}/overlay/scroll/index.ts | 2 +- .../overlay/scroll/noop-scroll-strategy.ts | 0 .../scroll/reposition-scroll-strategy.spec.ts | 15 +- .../scroll/reposition-scroll-strategy.ts | 0 .../overlay/scroll/scroll-dispatcher.spec.ts | 2 +- .../overlay/scroll/scroll-dispatcher.ts | 2 +- .../overlay/scroll/scroll-strategy-options.ts | 0 .../overlay/scroll/scroll-strategy.md | 0 .../overlay/scroll/scroll-strategy.ts | 0 .../core => cdk}/overlay/scroll/scrollable.ts | 0 src/cdk/overlay/tsconfig-build.json | 13 ++ src/cdk/portal/portal-errors.ts | 2 +- .../testing}/fake-viewport-ruler.ts | 0 src/cdk/testing/public_api.ts | 1 + src/demo-app/system-config.ts | 1 + .../block-scroll-strategy-e2e.ts | 2 +- src/e2e-app/e2e-app-module.ts | 3 +- src/e2e-app/system-config.ts | 1 + src/lib/autocomplete/autocomplete-trigger.ts | 30 ++-- src/lib/autocomplete/autocomplete.spec.ts | 21 ++- src/lib/autocomplete/index.ts | 3 +- src/lib/button-toggle/button-toggle.ts | 3 +- src/lib/button/button.spec.ts | 4 +- src/lib/button/button.ts | 3 +- src/lib/checkbox/checkbox.spec.ts | 9 +- src/lib/core/_core.scss | 5 +- src/lib/core/core.ts | 36 +++-- src/lib/core/overlay/index.ts | 46 +------ src/lib/core/ripple/index.ts | 7 +- src/lib/core/ripple/ripple-renderer.ts | 4 +- src/lib/core/ripple/ripple.spec.ts | 6 +- src/lib/core/ripple/ripple.ts | 4 +- src/lib/core/style/_variables.scss | 12 -- src/lib/datepicker/datepicker.spec.ts | 11 +- src/lib/datepicker/datepicker.ts | 23 ++-- src/lib/datepicker/index.ts | 4 +- src/lib/dialog/dialog-config.ts | 2 +- src/lib/dialog/dialog-container.ts | 25 ++-- src/lib/dialog/dialog-ref.ts | 4 +- src/lib/dialog/dialog.spec.ts | 7 +- src/lib/dialog/dialog.ts | 27 ++-- src/lib/dialog/index.ts | 10 +- src/lib/grid-list/grid-list.ts | 2 +- src/lib/input/input.ts | 4 +- src/lib/menu/index.ts | 3 +- src/lib/menu/menu-directive.ts | 2 +- src/lib/menu/menu-panel.ts | 2 +- src/lib/menu/menu-trigger.ts | 130 ++++++++++-------- src/lib/menu/menu.spec.ts | 21 ++- src/lib/module.ts | 15 +- src/lib/radio/index.ts | 2 +- src/lib/radio/radio.spec.ts | 12 +- src/lib/select/index.ts | 3 +- src/lib/select/select.spec.ts | 24 ++-- src/lib/select/select.ts | 57 ++++---- src/lib/sidenav/index.ts | 4 +- src/lib/sidenav/sidenav.ts | 9 +- src/lib/slide-toggle/index.ts | 3 +- src/lib/slide-toggle/slide-toggle.ts | 4 +- src/lib/slider/slider.ts | 15 +- src/lib/snack-bar/index.ts | 5 +- src/lib/snack-bar/snack-bar-config.ts | 3 +- src/lib/snack-bar/snack-bar-container.ts | 7 +- src/lib/snack-bar/snack-bar-ref.ts | 2 +- src/lib/snack-bar/snack-bar.spec.ts | 3 +- src/lib/snack-bar/snack-bar.ts | 21 +-- src/lib/sort/sort-header.ts | 8 +- src/lib/sort/sort.ts | 2 +- src/lib/tabs/index.ts | 10 +- src/lib/tabs/tab-body.spec.ts | 6 +- src/lib/tabs/tab-body.ts | 4 +- src/lib/tabs/tab-group.spec.ts | 14 +- src/lib/tabs/tab-group.ts | 4 +- src/lib/tabs/tab-header.spec.ts | 16 +-- src/lib/tabs/tab-header.ts | 15 +- src/lib/tabs/tab-label.ts | 2 +- src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts | 10 +- src/lib/tabs/tab-nav-bar/tab-nav-bar.ts | 20 +-- src/lib/tooltip/index.ts | 5 +- src/lib/tooltip/tooltip.spec.ts | 32 ++--- src/lib/tooltip/tooltip.ts | 49 +++---- test/karma-test-shim.js | 1 + tools/package-tools/secondary-entry-points.ts | 3 +- 110 files changed, 554 insertions(+), 535 deletions(-) rename src/{lib/core => cdk}/overlay/_overlay.scss (76%) rename src/{lib/core => cdk}/overlay/fullscreen-overlay-container.ts (100%) rename src/{lib/core => cdk}/overlay/generic-component-type.ts (100%) create mode 100644 src/cdk/overlay/index.ts rename src/{lib/core => cdk}/overlay/overlay-container.ts (100%) rename src/{lib/core => cdk}/overlay/overlay-directives.spec.ts (99%) rename src/{lib/core => cdk}/overlay/overlay-directives.ts (93%) create mode 100644 src/cdk/overlay/overlay-prebuilt.scss rename src/{lib/core => cdk}/overlay/overlay-ref.ts (99%) rename src/{lib/core => cdk}/overlay/overlay-state.ts (97%) rename src/{lib/core => cdk}/overlay/overlay.spec.ts (98%) rename src/{lib/core => cdk}/overlay/overlay.ts (98%) rename src/{lib/core => cdk}/overlay/position/connected-position-strategy.spec.ts (100%) rename src/{lib/core => cdk}/overlay/position/connected-position-strategy.ts (100%) rename src/{lib/core => cdk}/overlay/position/connected-position.ts (100%) rename src/{lib/core => cdk}/overlay/position/global-position-strategy.spec.ts (100%) rename src/{lib/core => cdk}/overlay/position/global-position-strategy.ts (100%) rename src/{lib/core => cdk}/overlay/position/overlay-position-builder.ts (100%) rename src/{lib/core => cdk}/overlay/position/position-strategy.ts (100%) rename src/{lib/core => cdk}/overlay/position/viewport-ruler.spec.ts (100%) rename src/{lib/core => cdk}/overlay/position/viewport-ruler.ts (100%) create mode 100644 src/cdk/overlay/public_api.ts rename src/{lib/core => cdk}/overlay/scroll/block-scroll-strategy.spec.ts (97%) rename src/{lib/core => cdk}/overlay/scroll/block-scroll-strategy.ts (100%) rename src/{lib/core => cdk}/overlay/scroll/close-scroll-strategy.spec.ts (96%) rename src/{lib/core => cdk}/overlay/scroll/close-scroll-strategy.ts (100%) rename src/{lib/core => cdk}/overlay/scroll/index.ts (95%) rename src/{lib/core => cdk}/overlay/scroll/noop-scroll-strategy.ts (100%) rename src/{lib/core => cdk}/overlay/scroll/reposition-scroll-strategy.spec.ts (92%) rename src/{lib/core => cdk}/overlay/scroll/reposition-scroll-strategy.ts (100%) rename src/{lib/core => cdk}/overlay/scroll/scroll-dispatcher.spec.ts (100%) rename src/{lib/core => cdk}/overlay/scroll/scroll-dispatcher.ts (99%) rename src/{lib/core => cdk}/overlay/scroll/scroll-strategy-options.ts (100%) rename src/{lib/core => cdk}/overlay/scroll/scroll-strategy.md (100%) rename src/{lib/core => cdk}/overlay/scroll/scroll-strategy.ts (100%) rename src/{lib/core => cdk}/overlay/scroll/scrollable.ts (100%) create mode 100644 src/cdk/overlay/tsconfig-build.json rename src/{lib/core/overlay/position => cdk/testing}/fake-viewport-ruler.ts (100%) diff --git a/scripts/closure-compiler/build-devapp-bundle.sh b/scripts/closure-compiler/build-devapp-bundle.sh index 086782809715..51cfba69397c 100755 --- a/scripts/closure-compiler/build-devapp-bundle.sh +++ b/scripts/closure-compiler/build-devapp-bundle.sh @@ -24,7 +24,7 @@ $(npm bin)/ngc -p scripts/closure-compiler/tsconfig-rxjs.json rxjsSourceFiles=$(find dist/packages/rxjs -name '*.js'); # List of entry points in the CDK package. Exclude "testing" since it's not an entry point. -cdkEntryPoints=($(find src/cdk/* -type d ! -name testing -exec basename {} \;)) +cdkEntryPoints=($(find src/cdk -maxdepth 1 -mindepth 1 -type d -not -name testing -exec basename {} \;)) # Due a Closure Compiler issue https://github.com/google/closure-compiler/issues/2247 # we need to add exports to the different RxJS ES2015 files. diff --git a/src/lib/core/overlay/_overlay.scss b/src/cdk/overlay/_overlay.scss similarity index 76% rename from src/lib/core/overlay/_overlay.scss rename to src/cdk/overlay/_overlay.scss index 98c967932eac..766bd603efae 100644 --- a/src/lib/core/overlay/_overlay.scss +++ b/src/cdk/overlay/_overlay.scss @@ -1,4 +1,16 @@ -@import '../style/variables'; +// 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. +$cdk-z-index-overlay-container: 1000; +$cdk-z-index-overlay: 1000; +$cdk-z-index-overlay-backdrop: 1000; + +// Background color for all of the backdrops +$cdk-overlay-dark-backdrop-background: rgba(0, 0, 0, 0.6); + +// Default backdrop animation is based on the Material Design swift-ease-out. +$backdrop-animation-duration: 400ms !default; +$backdrop-animation-timing-function: cubic-bezier(0.25, 0.8, 0.25, 1) !default; @mixin cdk-overlay() { @@ -48,10 +60,7 @@ z-index: $cdk-z-index-overlay-backdrop; pointer-events: auto; -webkit-tap-highlight-color: transparent; - - // TODO(jelbourn): figure out if there are actually spec'ed colors for both light and dark - // themes here. Currently using the values from AngularJS Material. - transition: opacity $swift-ease-out-duration $swift-ease-out-timing-function; + transition: opacity $backdrop-animation-duration $backdrop-animation-timing-function; opacity: 0; &.cdk-overlay-backdrop-showing { diff --git a/src/lib/core/overlay/fullscreen-overlay-container.ts b/src/cdk/overlay/fullscreen-overlay-container.ts similarity index 100% rename from src/lib/core/overlay/fullscreen-overlay-container.ts rename to src/cdk/overlay/fullscreen-overlay-container.ts diff --git a/src/lib/core/overlay/generic-component-type.ts b/src/cdk/overlay/generic-component-type.ts similarity index 100% rename from src/lib/core/overlay/generic-component-type.ts rename to src/cdk/overlay/generic-component-type.ts diff --git a/src/cdk/overlay/index.ts b/src/cdk/overlay/index.ts new file mode 100644 index 000000000000..f93e7c31d564 --- /dev/null +++ b/src/cdk/overlay/index.ts @@ -0,0 +1,9 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ + +export * from './public_api'; diff --git a/src/lib/core/overlay/overlay-container.ts b/src/cdk/overlay/overlay-container.ts similarity index 100% rename from src/lib/core/overlay/overlay-container.ts rename to src/cdk/overlay/overlay-container.ts diff --git a/src/lib/core/overlay/overlay-directives.spec.ts b/src/cdk/overlay/overlay-directives.spec.ts similarity index 99% rename from src/lib/core/overlay/overlay-directives.spec.ts rename to src/cdk/overlay/overlay-directives.spec.ts index babd63dc991f..e0876038d708 100644 --- a/src/lib/core/overlay/overlay-directives.spec.ts +++ b/src/cdk/overlay/overlay-directives.spec.ts @@ -1,13 +1,13 @@ -import {ComponentFixture, TestBed, async} from '@angular/core/testing'; import {Component, ViewChild} from '@angular/core'; import {By} from '@angular/platform-browser'; +import {ComponentFixture, TestBed, async} from '@angular/core/testing'; +import {Directionality} from '@angular/cdk/bidi'; +import {dispatchKeyboardEvent} from '@angular/cdk/testing'; +import {ESCAPE} from '@angular/cdk/keycodes'; import {ConnectedOverlayDirective, OverlayModule, OverlayOrigin} from './index'; import {OverlayContainer} from './overlay-container'; import {ConnectedPositionStrategy} from './position/connected-position-strategy'; import {ConnectedOverlayPositionChange} from './position/connected-position'; -import {Directionality} from '../bidi/index'; -import {dispatchKeyboardEvent} from '@angular/cdk/testing'; -import {ESCAPE} from '../keyboard/keycodes'; describe('Overlay directives', () => { diff --git a/src/lib/core/overlay/overlay-directives.ts b/src/cdk/overlay/overlay-directives.ts similarity index 93% rename from src/lib/core/overlay/overlay-directives.ts rename to src/cdk/overlay/overlay-directives.ts index 2366a0df7615..757ae1331fb4 100644 --- a/src/lib/core/overlay/overlay-directives.ts +++ b/src/cdk/overlay/overlay-directives.ts @@ -7,37 +7,37 @@ */ import { - Directive, - EventEmitter, - TemplateRef, - ViewContainerRef, - Optional, - Input, - OnDestroy, - Output, - ElementRef, - Renderer2, - OnChanges, - SimpleChanges, - InjectionToken, - Inject, + Directive, + ElementRef, + EventEmitter, + Inject, + InjectionToken, + Input, + OnChanges, + OnDestroy, + Optional, + Output, + Renderer2, + SimpleChanges, + TemplateRef, + ViewContainerRef, } from '@angular/core'; +import {Direction, Directionality} from '@angular/cdk/bidi'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; +import {ESCAPE} from '@angular/cdk/keycodes'; +import {TemplatePortal} from '@angular/cdk/portal'; import {Overlay} from './overlay'; import {OverlayRef} from './overlay-ref'; -import {TemplatePortal} from '../portal/portal'; import {OverlayState} from './overlay-state'; import { - ConnectionPositionPair, - // This import is only used to define a generic type. The current TypeScript version incorrectly - // considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953) - // tslint:disable-next-line:no-unused-variable - ConnectedOverlayPositionChange + // This import is only used to define a generic type. The current TypeScript version incorrectly + // considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953) + // tslint:disable-next-line:no-unused-variable + ConnectedOverlayPositionChange, + ConnectionPositionPair, } from './position/connected-position'; import {ConnectedPositionStrategy} from './position/connected-position-strategy'; -import {Directionality, Direction} from '../bidi/index'; -import {coerceBooleanProperty} from '@angular/cdk/coercion'; -import {ScrollStrategy, RepositionScrollStrategy} from './scroll/index'; -import {ESCAPE} from '../keyboard/keycodes'; +import {RepositionScrollStrategy, ScrollStrategy} from './scroll/index'; import {Subscription} from 'rxjs/Subscription'; @@ -56,7 +56,8 @@ export const MD_CONNECTED_OVERLAY_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>('md-connected-overlay-scroll-strategy'); /** @docs-private */ -export function MD_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay) { +export function MD_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): + () => RepositionScrollStrategy { return () => overlay.scrollStrategies.reposition(); } diff --git a/src/cdk/overlay/overlay-prebuilt.scss b/src/cdk/overlay/overlay-prebuilt.scss new file mode 100644 index 000000000000..5c3798a319e1 --- /dev/null +++ b/src/cdk/overlay/overlay-prebuilt.scss @@ -0,0 +1,3 @@ +@import './overlay'; + +@include cdk-overlay(); diff --git a/src/lib/core/overlay/overlay-ref.ts b/src/cdk/overlay/overlay-ref.ts similarity index 99% rename from src/lib/core/overlay/overlay-ref.ts rename to src/cdk/overlay/overlay-ref.ts index a1a272cb2fdb..25bd7a07e4dc 100644 --- a/src/lib/core/overlay/overlay-ref.ts +++ b/src/cdk/overlay/overlay-ref.ts @@ -7,7 +7,7 @@ */ import {NgZone} from '@angular/core'; -import {PortalHost, Portal} from '../portal/portal'; +import {PortalHost, Portal} from '@angular/cdk/portal'; import {OverlayState} from './overlay-state'; import {Observable} from 'rxjs/Observable'; import {Subject} from 'rxjs/Subject'; diff --git a/src/lib/core/overlay/overlay-state.ts b/src/cdk/overlay/overlay-state.ts similarity index 97% rename from src/lib/core/overlay/overlay-state.ts rename to src/cdk/overlay/overlay-state.ts index 16003dff607d..c65f16add06f 100644 --- a/src/lib/core/overlay/overlay-state.ts +++ b/src/cdk/overlay/overlay-state.ts @@ -7,7 +7,7 @@ */ import {PositionStrategy} from './position/position-strategy'; -import {Direction} from '../bidi/index'; +import {Direction} from '@angular/cdk/bidi'; import {ScrollStrategy} from './scroll/scroll-strategy'; import {NoopScrollStrategy} from './scroll/noop-scroll-strategy'; diff --git a/src/lib/core/overlay/overlay.spec.ts b/src/cdk/overlay/overlay.spec.ts similarity index 98% rename from src/lib/core/overlay/overlay.spec.ts rename to src/cdk/overlay/overlay.spec.ts index a937724ea0c4..a5b0e9309783 100644 --- a/src/lib/core/overlay/overlay.spec.ts +++ b/src/cdk/overlay/overlay.spec.ts @@ -1,13 +1,17 @@ -import {inject, TestBed, async, ComponentFixture} from '@angular/core/testing'; -import {NgModule, Component, ViewChild, ViewContainerRef} from '@angular/core'; -import {TemplatePortalDirective, PortalModule} from '../portal/portal-directives'; -import {TemplatePortal, ComponentPortal} from '../portal/portal'; +import {async, ComponentFixture, inject, TestBed} from '@angular/core/testing'; +import {Component, NgModule, ViewChild, ViewContainerRef} from '@angular/core'; import { + ComponentPortal, + PortalModule, + TemplatePortal, + TemplatePortalDirective +} from '@angular/cdk/portal'; +import { + Overlay, + OverlayContainer, OverlayModule, OverlayRef, OverlayState, - OverlayContainer, - Overlay, PositionStrategy, ScrollStrategy, } from './index'; diff --git a/src/lib/core/overlay/overlay.ts b/src/cdk/overlay/overlay.ts similarity index 98% rename from src/lib/core/overlay/overlay.ts rename to src/cdk/overlay/overlay.ts index 29b20e8d30b4..3af90a695d1b 100644 --- a/src/lib/core/overlay/overlay.ts +++ b/src/cdk/overlay/overlay.ts @@ -13,8 +13,8 @@ import { Injector, NgZone, } from '@angular/core'; +import {DomPortalHost} from '@angular/cdk/portal'; import {OverlayState} from './overlay-state'; -import {DomPortalHost} from '../portal/dom-portal-host'; import {OverlayRef} from './overlay-ref'; import {OverlayPositionBuilder} from './position/overlay-position-builder'; import {OverlayContainer} from './overlay-container'; diff --git a/src/lib/core/overlay/position/connected-position-strategy.spec.ts b/src/cdk/overlay/position/connected-position-strategy.spec.ts similarity index 100% rename from src/lib/core/overlay/position/connected-position-strategy.spec.ts rename to src/cdk/overlay/position/connected-position-strategy.spec.ts diff --git a/src/lib/core/overlay/position/connected-position-strategy.ts b/src/cdk/overlay/position/connected-position-strategy.ts similarity index 100% rename from src/lib/core/overlay/position/connected-position-strategy.ts rename to src/cdk/overlay/position/connected-position-strategy.ts diff --git a/src/lib/core/overlay/position/connected-position.ts b/src/cdk/overlay/position/connected-position.ts similarity index 100% rename from src/lib/core/overlay/position/connected-position.ts rename to src/cdk/overlay/position/connected-position.ts diff --git a/src/lib/core/overlay/position/global-position-strategy.spec.ts b/src/cdk/overlay/position/global-position-strategy.spec.ts similarity index 100% rename from src/lib/core/overlay/position/global-position-strategy.spec.ts rename to src/cdk/overlay/position/global-position-strategy.spec.ts diff --git a/src/lib/core/overlay/position/global-position-strategy.ts b/src/cdk/overlay/position/global-position-strategy.ts similarity index 100% rename from src/lib/core/overlay/position/global-position-strategy.ts rename to src/cdk/overlay/position/global-position-strategy.ts diff --git a/src/lib/core/overlay/position/overlay-position-builder.ts b/src/cdk/overlay/position/overlay-position-builder.ts similarity index 100% rename from src/lib/core/overlay/position/overlay-position-builder.ts rename to src/cdk/overlay/position/overlay-position-builder.ts index a7535269a4fa..5f0d85b538ec 100644 --- a/src/lib/core/overlay/position/overlay-position-builder.ts +++ b/src/cdk/overlay/position/overlay-position-builder.ts @@ -6,9 +6,9 @@ * found in the LICENSE file at https://angular.io/license */ +import {ElementRef, Injectable} from '@angular/core'; import {ViewportRuler} from './viewport-ruler'; import {ConnectedPositionStrategy} from './connected-position-strategy'; -import {ElementRef, Injectable} from '@angular/core'; import {GlobalPositionStrategy} from './global-position-strategy'; import {OverlayConnectionPosition, OriginConnectionPosition} from './connected-position'; diff --git a/src/lib/core/overlay/position/position-strategy.ts b/src/cdk/overlay/position/position-strategy.ts similarity index 100% rename from src/lib/core/overlay/position/position-strategy.ts rename to src/cdk/overlay/position/position-strategy.ts diff --git a/src/lib/core/overlay/position/viewport-ruler.spec.ts b/src/cdk/overlay/position/viewport-ruler.spec.ts similarity index 100% rename from src/lib/core/overlay/position/viewport-ruler.spec.ts rename to src/cdk/overlay/position/viewport-ruler.spec.ts index 376c50397282..ec87f5961448 100644 --- a/src/lib/core/overlay/position/viewport-ruler.spec.ts +++ b/src/cdk/overlay/position/viewport-ruler.spec.ts @@ -1,6 +1,6 @@ -import {ViewportRuler, VIEWPORT_RULER_PROVIDER} from './viewport-ruler'; import {TestBed, inject} from '@angular/core/testing'; import {ScrollDispatchModule} from '../scroll/index'; +import {ViewportRuler, VIEWPORT_RULER_PROVIDER} from './viewport-ruler'; // For all tests, we assume the browser window is 1024x786 (outerWidth x outerHeight). diff --git a/src/lib/core/overlay/position/viewport-ruler.ts b/src/cdk/overlay/position/viewport-ruler.ts similarity index 100% rename from src/lib/core/overlay/position/viewport-ruler.ts rename to src/cdk/overlay/position/viewport-ruler.ts diff --git a/src/cdk/overlay/public_api.ts b/src/cdk/overlay/public_api.ts new file mode 100644 index 000000000000..572474a2dd3e --- /dev/null +++ b/src/cdk/overlay/public_api.ts @@ -0,0 +1,55 @@ +/** + * @license + * Copyright Google Inc. All Rights Reserved. + * + * Use of this source code is governed by an MIT-style license that can be + * found in the LICENSE file at https://angular.io/license + */ +import {NgModule, Provider} from '@angular/core'; +import {PortalModule} from '@angular/cdk/portal'; +import {Overlay} from './overlay'; +import {ScrollDispatchModule} from './scroll/index'; +import { + ConnectedOverlayDirective, + OverlayOrigin, + MD_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER, +} from './overlay-directives'; +import {OverlayPositionBuilder} from './position/overlay-position-builder'; +import {VIEWPORT_RULER_PROVIDER} from './position/viewport-ruler'; +import {OVERLAY_CONTAINER_PROVIDER} from './overlay-container'; + + +export const OVERLAY_PROVIDERS: Provider[] = [ + Overlay, + OverlayPositionBuilder, + VIEWPORT_RULER_PROVIDER, + OVERLAY_CONTAINER_PROVIDER, + MD_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER, +]; + +@NgModule({ + imports: [PortalModule, ScrollDispatchModule], + exports: [ConnectedOverlayDirective, OverlayOrigin, ScrollDispatchModule], + declarations: [ConnectedOverlayDirective, OverlayOrigin], + providers: [OVERLAY_PROVIDERS], +}) +export class OverlayModule {} + + +export {Overlay} from './overlay'; +export {OverlayContainer} from './overlay-container'; +export {FullscreenOverlayContainer} from './fullscreen-overlay-container'; +export {OverlayRef} from './overlay-ref'; +export {OverlayState} from './overlay-state'; +export {ConnectedOverlayDirective, OverlayOrigin} from './overlay-directives'; +export {ViewportRuler} from './position/viewport-ruler'; +export {ComponentType} from '@angular/cdk/portal'; + +export * from './position/connected-position'; +export * from './scroll/index'; + +// Export pre-defined position strategies and interface to build custom ones. +export {PositionStrategy} from './position/position-strategy'; +export {GlobalPositionStrategy} from './position/global-position-strategy'; +export {ConnectedPositionStrategy} from './position/connected-position-strategy'; +export {VIEWPORT_RULER_PROVIDER} from './position/viewport-ruler'; diff --git a/src/lib/core/overlay/scroll/block-scroll-strategy.spec.ts b/src/cdk/overlay/scroll/block-scroll-strategy.spec.ts similarity index 97% rename from src/lib/core/overlay/scroll/block-scroll-strategy.spec.ts rename to src/cdk/overlay/scroll/block-scroll-strategy.spec.ts index b2c7108ee4fe..98b920341db3 100644 --- a/src/lib/core/overlay/scroll/block-scroll-strategy.spec.ts +++ b/src/cdk/overlay/scroll/block-scroll-strategy.spec.ts @@ -1,16 +1,15 @@ import {NgModule, Component} from '@angular/core'; import {inject, TestBed, async} from '@angular/core/testing'; +import {ComponentPortal, PortalModule} from '@angular/cdk/portal'; +import {Platform} from '@angular/cdk/platform'; import { - ComponentPortal, OverlayModule, - PortalModule, - Platform, ViewportRuler, OverlayState, Overlay, OverlayRef, OverlayContainer, -} from '../../core'; +} from '../index'; describe('BlockScrollStrategy', () => { diff --git a/src/lib/core/overlay/scroll/block-scroll-strategy.ts b/src/cdk/overlay/scroll/block-scroll-strategy.ts similarity index 100% rename from src/lib/core/overlay/scroll/block-scroll-strategy.ts rename to src/cdk/overlay/scroll/block-scroll-strategy.ts diff --git a/src/lib/core/overlay/scroll/close-scroll-strategy.spec.ts b/src/cdk/overlay/scroll/close-scroll-strategy.spec.ts similarity index 96% rename from src/lib/core/overlay/scroll/close-scroll-strategy.spec.ts rename to src/cdk/overlay/scroll/close-scroll-strategy.spec.ts index f5d0b2ad5851..2dffe7ef538f 100644 --- a/src/lib/core/overlay/scroll/close-scroll-strategy.spec.ts +++ b/src/cdk/overlay/scroll/close-scroll-strategy.spec.ts @@ -1,16 +1,15 @@ import {inject, TestBed, async} from '@angular/core/testing'; import {NgModule, Component} from '@angular/core'; import {Subject} from 'rxjs/Subject'; +import {ComponentPortal, PortalModule} from '@angular/cdk/portal'; import { - PortalModule, - ComponentPortal, Overlay, OverlayState, OverlayRef, OverlayModule, ScrollDispatcher, OverlayContainer, -} from '../../core'; +} from '../index'; describe('CloseScrollStrategy', () => { diff --git a/src/lib/core/overlay/scroll/close-scroll-strategy.ts b/src/cdk/overlay/scroll/close-scroll-strategy.ts similarity index 100% rename from src/lib/core/overlay/scroll/close-scroll-strategy.ts rename to src/cdk/overlay/scroll/close-scroll-strategy.ts diff --git a/src/lib/core/overlay/scroll/index.ts b/src/cdk/overlay/scroll/index.ts similarity index 95% rename from src/lib/core/overlay/scroll/index.ts rename to src/cdk/overlay/scroll/index.ts index 692330838ce0..73b1708a2b4f 100644 --- a/src/lib/core/overlay/scroll/index.ts +++ b/src/cdk/overlay/scroll/index.ts @@ -7,9 +7,9 @@ */ import {NgModule} from '@angular/core'; +import {PlatformModule} from '@angular/cdk/platform'; import {SCROLL_DISPATCHER_PROVIDER} from './scroll-dispatcher'; import {Scrollable} from './scrollable'; -import {PlatformModule} from '../../platform/index'; import {ScrollStrategyOptions} from './scroll-strategy-options'; export {Scrollable} from './scrollable'; diff --git a/src/lib/core/overlay/scroll/noop-scroll-strategy.ts b/src/cdk/overlay/scroll/noop-scroll-strategy.ts similarity index 100% rename from src/lib/core/overlay/scroll/noop-scroll-strategy.ts rename to src/cdk/overlay/scroll/noop-scroll-strategy.ts diff --git a/src/lib/core/overlay/scroll/reposition-scroll-strategy.spec.ts b/src/cdk/overlay/scroll/reposition-scroll-strategy.spec.ts similarity index 92% rename from src/lib/core/overlay/scroll/reposition-scroll-strategy.spec.ts rename to src/cdk/overlay/scroll/reposition-scroll-strategy.spec.ts index af6a82553237..01e60314262c 100644 --- a/src/lib/core/overlay/scroll/reposition-scroll-strategy.spec.ts +++ b/src/cdk/overlay/scroll/reposition-scroll-strategy.spec.ts @@ -1,16 +1,15 @@ -import {inject, TestBed, async} from '@angular/core/testing'; -import {NgModule, Component} from '@angular/core'; +import {async, inject, TestBed} from '@angular/core/testing'; +import {Component, NgModule} from '@angular/core'; import {Subject} from 'rxjs/Subject'; +import {ComponentPortal, PortalModule} from '@angular/cdk/portal'; import { - PortalModule, - ComponentPortal, Overlay, - OverlayState, - OverlayRef, - OverlayModule, OverlayContainer, + OverlayModule, + OverlayRef, + OverlayState, ScrollDispatcher, -} from '../../core'; +} from '../index'; describe('RepositionScrollStrategy', () => { diff --git a/src/lib/core/overlay/scroll/reposition-scroll-strategy.ts b/src/cdk/overlay/scroll/reposition-scroll-strategy.ts similarity index 100% rename from src/lib/core/overlay/scroll/reposition-scroll-strategy.ts rename to src/cdk/overlay/scroll/reposition-scroll-strategy.ts diff --git a/src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts b/src/cdk/overlay/scroll/scroll-dispatcher.spec.ts similarity index 100% rename from src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts rename to src/cdk/overlay/scroll/scroll-dispatcher.spec.ts index 692a7c39c4f2..94112e82c67f 100644 --- a/src/lib/core/overlay/scroll/scroll-dispatcher.spec.ts +++ b/src/cdk/overlay/scroll/scroll-dispatcher.spec.ts @@ -1,7 +1,7 @@ import {inject, TestBed, async, fakeAsync, ComponentFixture, tick} from '@angular/core/testing'; import {NgModule, Component, ViewChild, ElementRef} from '@angular/core'; -import {OverlayModule, Scrollable, ScrollDispatcher} from '../index'; import {dispatchFakeEvent} from '@angular/cdk/testing'; +import {OverlayModule, Scrollable, ScrollDispatcher} from '../index'; describe('Scroll Dispatcher', () => { diff --git a/src/lib/core/overlay/scroll/scroll-dispatcher.ts b/src/cdk/overlay/scroll/scroll-dispatcher.ts similarity index 99% rename from src/lib/core/overlay/scroll/scroll-dispatcher.ts rename to src/cdk/overlay/scroll/scroll-dispatcher.ts index 0d0144e20ce7..a85adc5fcff3 100644 --- a/src/lib/core/overlay/scroll/scroll-dispatcher.ts +++ b/src/cdk/overlay/scroll/scroll-dispatcher.ts @@ -7,7 +7,7 @@ */ import {ElementRef, Injectable, NgZone, Optional, SkipSelf} from '@angular/core'; -import {Platform} from '../../platform/index'; +import {Platform} from '@angular/cdk/platform'; import {Scrollable} from './scrollable'; import {Subject} from 'rxjs/Subject'; import {Subscription} from 'rxjs/Subscription'; diff --git a/src/lib/core/overlay/scroll/scroll-strategy-options.ts b/src/cdk/overlay/scroll/scroll-strategy-options.ts similarity index 100% rename from src/lib/core/overlay/scroll/scroll-strategy-options.ts rename to src/cdk/overlay/scroll/scroll-strategy-options.ts diff --git a/src/lib/core/overlay/scroll/scroll-strategy.md b/src/cdk/overlay/scroll/scroll-strategy.md similarity index 100% rename from src/lib/core/overlay/scroll/scroll-strategy.md rename to src/cdk/overlay/scroll/scroll-strategy.md diff --git a/src/lib/core/overlay/scroll/scroll-strategy.ts b/src/cdk/overlay/scroll/scroll-strategy.ts similarity index 100% rename from src/lib/core/overlay/scroll/scroll-strategy.ts rename to src/cdk/overlay/scroll/scroll-strategy.ts diff --git a/src/lib/core/overlay/scroll/scrollable.ts b/src/cdk/overlay/scroll/scrollable.ts similarity index 100% rename from src/lib/core/overlay/scroll/scrollable.ts rename to src/cdk/overlay/scroll/scrollable.ts diff --git a/src/cdk/overlay/tsconfig-build.json b/src/cdk/overlay/tsconfig-build.json new file mode 100644 index 000000000000..8b6df58dda2a --- /dev/null +++ b/src/cdk/overlay/tsconfig-build.json @@ -0,0 +1,13 @@ +{ + "extends": "../tsconfig-build", + "files": [ + "public_api.ts" + ], + "angularCompilerOptions": { + "annotateForClosureCompiler": true, + "strictMetadataEmit": true, + "flatModuleOutFile": "index.js", + "flatModuleId": "@angular/cdk/overlay", + "skipTemplateCodegen": true + } +} diff --git a/src/cdk/portal/portal-errors.ts b/src/cdk/portal/portal-errors.ts index f899e9636f26..b2530e8efa57 100644 --- a/src/cdk/portal/portal-errors.ts +++ b/src/cdk/portal/portal-errors.ts @@ -35,7 +35,7 @@ export function throwPortalHostAlreadyDisposedError() { * @docs-private */ export function throwUnknownPortalTypeError() { - throw Error('Attempting to attach an unknown Portal type. BasePortalHost accepts either' + + throw Error('Attempting to attach an unknown Portal type. BasePortalHost accepts either ' + 'a ComponentPortal or a TemplatePortal.'); } diff --git a/src/lib/core/overlay/position/fake-viewport-ruler.ts b/src/cdk/testing/fake-viewport-ruler.ts similarity index 100% rename from src/lib/core/overlay/position/fake-viewport-ruler.ts rename to src/cdk/testing/fake-viewport-ruler.ts diff --git a/src/cdk/testing/public_api.ts b/src/cdk/testing/public_api.ts index d0b8f467c650..91d9bedf97c8 100644 --- a/src/cdk/testing/public_api.ts +++ b/src/cdk/testing/public_api.ts @@ -10,3 +10,4 @@ export * from './dispatch-events'; export * from './event-objects'; export * from './type-in-element'; export * from './wrapped-error-message'; +export * from './fake-viewport-ruler'; diff --git a/src/demo-app/system-config.ts b/src/demo-app/system-config.ts index 7b2a5bdacbdd..d4d5a6c7447b 100644 --- a/src/demo-app/system-config.ts +++ b/src/demo-app/system-config.ts @@ -32,6 +32,7 @@ System.config({ '@angular/cdk/coercion': 'dist/bundles/cdk-coercion.umd.js', '@angular/cdk/keycodes': 'dist/bundles/cdk-keycodes.umd.js', '@angular/cdk/observers': 'dist/bundles/cdk-observers.umd.js', + '@angular/cdk/overlay': 'dist/bundles/cdk-overlay-content.umd.js', '@angular/cdk/platform': 'dist/bundles/cdk-platform.umd.js', '@angular/cdk/portal': 'dist/bundles/cdk-portal.umd.js', '@angular/cdk/rxjs': 'dist/bundles/cdk-rxjs.umd.js', diff --git a/src/e2e-app/block-scroll-strategy/block-scroll-strategy-e2e.ts b/src/e2e-app/block-scroll-strategy/block-scroll-strategy-e2e.ts index 927ba58b006b..fead6ad73adc 100644 --- a/src/e2e-app/block-scroll-strategy/block-scroll-strategy-e2e.ts +++ b/src/e2e-app/block-scroll-strategy/block-scroll-strategy-e2e.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {Overlay, ScrollStrategy} from '@angular/material'; +import {Overlay, ScrollStrategy} from '@angular/cdk/overlay'; @Component({ moduleId: module.id, diff --git a/src/e2e-app/e2e-app-module.ts b/src/e2e-app/e2e-app-module.ts index 21c5afabb684..8367ba4b7d38 100644 --- a/src/e2e-app/e2e-app-module.ts +++ b/src/e2e-app/e2e-app-module.ts @@ -20,7 +20,6 @@ import {InputE2E} from './input/input-e2e'; import {SidenavE2E} from './sidenav/sidenav-e2e'; import {BlockScrollStrategyE2E} from './block-scroll-strategy/block-scroll-strategy-e2e'; import { - FullscreenOverlayContainer, MdButtonModule, MdCheckboxModule, MdDialogModule, @@ -37,8 +36,8 @@ import { MdSidenavModule, MdSlideToggleModule, MdTabsModule, - OverlayContainer, } from '@angular/material'; +import {FullscreenOverlayContainer, OverlayContainer} from '@angular/cdk/overlay'; import {ExampleModule} from '@angular/material-examples'; /** diff --git a/src/e2e-app/system-config.ts b/src/e2e-app/system-config.ts index eb615b349ea0..418d03aedac8 100644 --- a/src/e2e-app/system-config.ts +++ b/src/e2e-app/system-config.ts @@ -32,6 +32,7 @@ System.config({ '@angular/cdk/coercion': 'dist/bundles/cdk-coercion.umd.js', '@angular/cdk/keycodes': 'dist/bundles/cdk-keycodes.umd.js', '@angular/cdk/observers': 'dist/bundles/cdk-observers.umd.js', + '@angular/cdk/overlay': 'dist/bundles/cdk-overlay.umd.js', '@angular/cdk/platform': 'dist/bundles/cdk-platform.umd.js', '@angular/cdk/portal': 'dist/bundles/cdk-portal.umd.js', '@angular/cdk/rxjs': 'dist/bundles/cdk-rxjs.umd.js', diff --git a/src/lib/autocomplete/autocomplete-trigger.ts b/src/lib/autocomplete/autocomplete-trigger.ts index 234927443da4..d0da2c36bc66 100644 --- a/src/lib/autocomplete/autocomplete-trigger.ts +++ b/src/lib/autocomplete/autocomplete-trigger.ts @@ -7,45 +7,46 @@ */ import { + ChangeDetectorRef, Directive, ElementRef, forwardRef, Host, + Inject, + InjectionToken, Input, NgZone, - Optional, OnDestroy, + Optional, ViewContainerRef, - Inject, - ChangeDetectorRef, - InjectionToken, } from '@angular/core'; import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms'; import {DOCUMENT} from '@angular/platform-browser'; +import {Directionality} from '@angular/cdk/bidi'; +import {filter, first, map, RxChain, switchMap} from '@angular/cdk/rxjs'; import { + ConnectedPositionStrategy, Overlay, OverlayRef, OverlayState, - TemplatePortal, + PositionStrategy, RepositionScrollStrategy, // This import is only used to define a generic type. The current TypeScript version incorrectly // considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953) // tslint:disable-next-line:no-unused-variable ScrollStrategy, -} from '../core'; -import {MdAutocomplete} from './autocomplete'; -import {PositionStrategy} from '../core/overlay/position/position-strategy'; -import {ConnectedPositionStrategy} from '../core/overlay/position/connected-position-strategy'; +} from '@angular/cdk/overlay'; +import {TemplatePortal} from '@angular/cdk/portal'; +import {DOWN_ARROW, ENTER, ESCAPE, UP_ARROW} from '@angular/cdk/keycodes'; import {Observable} from 'rxjs/Observable'; -import {MdOptionSelectionChange, MdOption} from '../core/option/option'; -import {ENTER, UP_ARROW, DOWN_ARROW, ESCAPE} from '../core/keyboard/keycodes'; -import {Directionality} from '../core/bidi/index'; import {MdFormField} from '../form-field/index'; import {Subscription} from 'rxjs/Subscription'; import {merge} from 'rxjs/observable/merge'; import {fromEvent} from 'rxjs/observable/fromEvent'; import {of as observableOf} from 'rxjs/observable/of'; -import {RxChain, switchMap, first, filter, map} from '../core/rxjs/index'; +import {MdOption, MdOptionSelectionChange} from '../core/option/option'; +import {MdAutocomplete} from './autocomplete'; + /** * The following style constants are necessary to save here in order @@ -64,7 +65,8 @@ export const MD_AUTOCOMPLETE_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>('md-autocomplete-scroll-strategy'); /** @docs-private */ -export function MD_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay) { +export function MD_AUTOCOMPLETE_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): + () => RepositionScrollStrategy { return () => overlay.scrollStrategies.reposition(); } diff --git a/src/lib/autocomplete/autocomplete.spec.ts b/src/lib/autocomplete/autocomplete.spec.ts index 1599f189717a..8c9dfd745074 100644 --- a/src/lib/autocomplete/autocomplete.spec.ts +++ b/src/lib/autocomplete/autocomplete.spec.ts @@ -1,34 +1,33 @@ -import {TestBed, async, fakeAsync, tick, ComponentFixture} from '@angular/core/testing'; +import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'; import { + ChangeDetectionStrategy, Component, OnDestroy, + OnInit, QueryList, ViewChild, ViewChildren, - ChangeDetectionStrategy, - OnInit, } from '@angular/core'; import {By} from '@angular/platform-browser'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; +import {OverlayContainer, ScrollDispatcher} from '@angular/cdk/overlay'; +import {Direction, Directionality} from '@angular/cdk/bidi'; +import {map, RxChain, startWith} from '@angular/cdk/rxjs'; +import {createKeyboardEvent, dispatchFakeEvent, typeInElement} from '@angular/cdk/testing'; import { + getMdAutocompleteMissingPanelError, + MdAutocomplete, MdAutocompleteModule, MdAutocompleteTrigger, - MdAutocomplete, - getMdAutocompleteMissingPanelError, } from './index'; -import {OverlayContainer} from '../core/overlay/overlay-container'; import {MdInputModule} from '../input/index'; -import {Directionality, Direction} from '../core/bidi/index'; import {Subscription} from 'rxjs/Subscription'; -import {ENTER, DOWN_ARROW, SPACE, UP_ARROW, ESCAPE} from '../core/keyboard/keycodes'; +import {DOWN_ARROW, ENTER, ESCAPE, SPACE, UP_ARROW} from '../core/keyboard/keycodes'; import {MdOption} from '../core/option/option'; import {MdFormField, MdFormFieldModule} from '../form-field/index'; import {Observable} from 'rxjs/Observable'; import {Subject} from 'rxjs/Subject'; -import {createKeyboardEvent, dispatchFakeEvent, typeInElement} from '@angular/cdk/testing'; -import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher'; -import {RxChain, map, startWith} from '../core/rxjs/index'; describe('MdAutocomplete', () => { diff --git a/src/lib/autocomplete/index.ts b/src/lib/autocomplete/index.ts index ff52c4b6a0ee..c5f09f6b83ac 100644 --- a/src/lib/autocomplete/index.ts +++ b/src/lib/autocomplete/index.ts @@ -7,8 +7,9 @@ */ import {NgModule} from '@angular/core'; -import {MdOptionModule, OverlayModule, MdCommonModule} from '../core'; import {CommonModule} from '@angular/common'; +import {OverlayModule} from '@angular/cdk/overlay'; +import {MdOptionModule, MdCommonModule} from '../core'; import {MdAutocomplete} from './autocomplete'; import { MdAutocompleteTrigger, diff --git a/src/lib/button-toggle/button-toggle.ts b/src/lib/button-toggle/button-toggle.ts index 43fb897df922..f2fc081c5110 100644 --- a/src/lib/button-toggle/button-toggle.ts +++ b/src/lib/button-toggle/button-toggle.ts @@ -26,7 +26,8 @@ import { ChangeDetectorRef, } from '@angular/core'; import {NG_VALUE_ACCESSOR, ControlValueAccessor} from '@angular/forms'; -import {UniqueSelectionDispatcher, coerceBooleanProperty, FocusOriginMonitor} from '../core'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; +import {UniqueSelectionDispatcher, FocusOriginMonitor} from '../core'; import {CanDisable, mixinDisabled} from '../core/common-behaviors/disabled'; /** Acceptable types for a button toggle. */ diff --git a/src/lib/button/button.spec.ts b/src/lib/button/button.spec.ts index a859dea89816..294ded4a2643 100644 --- a/src/lib/button/button.spec.ts +++ b/src/lib/button/button.spec.ts @@ -1,9 +1,9 @@ import {async, ComponentFixture, TestBed} from '@angular/core/testing'; import {Component, DebugElement} from '@angular/core'; import {By} from '@angular/platform-browser'; +import {ViewportRuler} from '@angular/cdk/overlay'; +import {FakeViewportRuler} from '@angular/cdk/testing'; import {MdButtonModule} from './index'; -import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; -import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler'; import {MdRipple} from '../core/ripple/index'; diff --git a/src/lib/button/button.ts b/src/lib/button/button.ts index 655ed53c2af7..497a56ca618e 100644 --- a/src/lib/button/button.ts +++ b/src/lib/button/button.ts @@ -19,7 +19,8 @@ import { ViewEncapsulation, Inject, } from '@angular/core'; -import {FocusOriginMonitor, Platform} from '../core'; +import {Platform} from '@angular/cdk/platform'; +import {FocusOriginMonitor} from '../core'; import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled'; import {CanColor, mixinColor} from '../core/common-behaviors/color'; import {CanDisableRipple, mixinDisableRipple} from '../core/common-behaviors/disable-ripple'; diff --git a/src/lib/checkbox/checkbox.spec.ts b/src/lib/checkbox/checkbox.spec.ts index 6a13b4c51919..bfdc0159c29d 100644 --- a/src/lib/checkbox/checkbox.spec.ts +++ b/src/lib/checkbox/checkbox.spec.ts @@ -1,18 +1,17 @@ import { async, + ComponentFixture, fakeAsync, flushMicrotasks, - ComponentFixture, TestBed, tick, } from '@angular/core/testing'; -import {NgModel, FormsModule, ReactiveFormsModule, FormControl} from '@angular/forms'; +import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms'; import {Component, DebugElement} from '@angular/core'; import {By} from '@angular/platform-browser'; +import {ViewportRuler} from '@angular/cdk/overlay'; +import {dispatchFakeEvent, FakeViewportRuler} from '@angular/cdk/testing'; import {MdCheckbox, MdCheckboxChange, MdCheckboxModule} from './index'; -import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; -import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler'; -import {dispatchFakeEvent} from '@angular/cdk/testing'; import {RIPPLE_FADE_IN_DURATION, RIPPLE_FADE_OUT_DURATION} from '../core/ripple/ripple-renderer'; diff --git a/src/lib/core/_core.scss b/src/lib/core/_core.scss index 90e9e2474732..b13dd35b4ea4 100644 --- a/src/lib/core/_core.scss +++ b/src/lib/core/_core.scss @@ -1,7 +1,10 @@ +// We can use relative imports for imports from the cdk because we bundle everything +// up into a single flat scss file for material. +@import '../../cdk/overlay/overlay'; + // Core styles that can be used to apply material design treatments to any element. @import 'a11y/a11y'; @import 'style/elevation'; -@import 'overlay/overlay'; @import 'ripple/ripple'; @import 'option/option'; @import 'option/option-theme'; diff --git a/src/lib/core/core.ts b/src/lib/core/core.ts index 48f600a031b1..842fb0fbc345 100644 --- a/src/lib/core/core.ts +++ b/src/lib/core/core.ts @@ -7,13 +7,13 @@ */ import {NgModule} from '@angular/core'; +import {A11yModule} from '@angular/cdk/a11y'; +import {BidiModule} from '@angular/cdk/bidi'; import {ObserversModule} from '@angular/cdk/observers'; +import {OverlayModule} from '@angular/cdk/overlay'; +import {PortalModule} from '@angular/cdk/portal'; import {MdLineModule} from './line/line'; -import {BidiModule} from './bidi/index'; import {MdOptionModule} from './option/index'; -import {PortalModule} from './portal/portal-directives'; -import {OverlayModule} from './overlay/index'; -import {A11yModule} from './a11y/index'; import {MdSelectionModule} from './selection/index'; import {MdRippleModule} from './ripple/index'; @@ -49,10 +49,10 @@ export { export {DomPortalHost} from './portal/dom-portal-host'; // Platform -export * from './platform/index'; +export * from '@angular/cdk/platform'; // Overlay -export * from './overlay/index'; +export * from '@angular/cdk/overlay'; // Gestures export {GestureConfig} from './gestures/gesture-config'; @@ -63,22 +63,23 @@ export {HammerInput, HammerManager} from './gestures/gesture-annotations'; // Ripple export * from './ripple/index'; +// Selection +export * from './selection/selection'; + // a11y export { AriaLivePoliteness, LiveAnnouncer, LIVE_ANNOUNCER_ELEMENT_TOKEN, LIVE_ANNOUNCER_PROVIDER, -} from './a11y/live-announcer'; - -// Selection -export * from './selection/selection'; - -export * from './a11y/focus-trap'; -export {InteractivityChecker} from './a11y/interactivity-checker'; -export {isFakeMousedownFromScreenReader} from './a11y/fake-mousedown'; - -export {A11yModule} from './a11y/index'; + InteractivityChecker, + FocusTrap, + FocusTrapFactory, + FocusTrapDeprecatedDirective, + FocusTrapDirective, + isFakeMousedownFromScreenReader, + A11yModule, +} from '@angular/cdk/a11y'; export { UniqueSelectionDispatcher, @@ -91,9 +92,6 @@ export {MdLineModule, MdLine, MdLineSetter} from './line/line'; // Style export * from './style/index'; -// Misc -export {ComponentType} from './overlay/generic-component-type'; - // Keybindings export * from './keyboard/keycodes'; diff --git a/src/lib/core/overlay/index.ts b/src/lib/core/overlay/index.ts index bb6945f68f3f..621bec001c17 100644 --- a/src/lib/core/overlay/index.ts +++ b/src/lib/core/overlay/index.ts @@ -5,49 +5,5 @@ * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ -import {NgModule, Provider} from '@angular/core'; -import {Overlay} from './overlay'; -import {ScrollDispatchModule} from './scroll/index'; -import {PortalModule} from '../portal/portal-directives'; -import { - ConnectedOverlayDirective, - OverlayOrigin, - MD_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER, -} from './overlay-directives'; -import {OverlayPositionBuilder} from './position/overlay-position-builder'; -import {VIEWPORT_RULER_PROVIDER} from './position/viewport-ruler'; -import {OVERLAY_CONTAINER_PROVIDER} from './overlay-container'; - -export const OVERLAY_PROVIDERS: Provider[] = [ - Overlay, - OverlayPositionBuilder, - VIEWPORT_RULER_PROVIDER, - OVERLAY_CONTAINER_PROVIDER, - MD_CONNECTED_OVERLAY_SCROLL_STRATEGY_PROVIDER, -]; - -@NgModule({ - imports: [PortalModule, ScrollDispatchModule], - exports: [ConnectedOverlayDirective, OverlayOrigin, ScrollDispatchModule], - declarations: [ConnectedOverlayDirective, OverlayOrigin], - providers: [OVERLAY_PROVIDERS], -}) -export class OverlayModule {} - - -export {Overlay} from './overlay'; -export {OverlayContainer} from './overlay-container'; -export {FullscreenOverlayContainer} from './fullscreen-overlay-container'; -export {OverlayRef} from './overlay-ref'; -export {OverlayState} from './overlay-state'; -export {ConnectedOverlayDirective, OverlayOrigin} from './overlay-directives'; -export {ViewportRuler} from './position/viewport-ruler'; - -export * from './position/connected-position'; -export * from './scroll/index'; - -// Export pre-defined position strategies and interface to build custom ones. -export {PositionStrategy} from './position/position-strategy'; -export {GlobalPositionStrategy} from './position/global-position-strategy'; -export {ConnectedPositionStrategy} from './position/connected-position-strategy'; +export * from '@angular/cdk/overlay'; diff --git a/src/lib/core/ripple/index.ts b/src/lib/core/ripple/index.ts index f2e9272cf7e0..400d872b314a 100644 --- a/src/lib/core/ripple/index.ts +++ b/src/lib/core/ripple/index.ts @@ -7,11 +7,10 @@ */ import {NgModule} from '@angular/core'; -import {MdRipple} from './ripple'; +import {ScrollDispatchModule, VIEWPORT_RULER_PROVIDER} from '@angular/cdk/overlay'; +import {PlatformModule} from '@angular/cdk/platform'; import {MdCommonModule} from '../common-behaviors/common-module'; -import {VIEWPORT_RULER_PROVIDER} from '../overlay/position/viewport-ruler'; -import {ScrollDispatchModule} from '../overlay/scroll/index'; -import {PlatformModule} from '../platform/index'; +import {MdRipple} from './ripple'; export {MdRipple, RippleGlobalOptions, MD_RIPPLE_GLOBAL_OPTIONS} from './ripple'; export {RippleRef, RippleState} from './ripple-ref'; diff --git a/src/lib/core/ripple/ripple-renderer.ts b/src/lib/core/ripple/ripple-renderer.ts index 423d2ec3c6bc..1748a707d304 100644 --- a/src/lib/core/ripple/ripple-renderer.ts +++ b/src/lib/core/ripple/ripple-renderer.ts @@ -7,8 +7,8 @@ */ import {ElementRef, NgZone} from '@angular/core'; -import {Platform} from '../platform/platform'; -import {ViewportRuler} from '../overlay/position/viewport-ruler'; +import {Platform} from '@angular/cdk/platform'; +import {ViewportRuler} from '@angular/cdk/overlay'; import {RippleRef, RippleState} from './ripple-ref'; diff --git a/src/lib/core/ripple/ripple.spec.ts b/src/lib/core/ripple/ripple.spec.ts index 3fcb30607bd2..a3b1d491c26a 100644 --- a/src/lib/core/ripple/ripple.spec.ts +++ b/src/lib/core/ripple/ripple.spec.ts @@ -1,12 +1,12 @@ import {TestBed, ComponentFixture, fakeAsync, tick, inject} from '@angular/core/testing'; import {Component, ViewChild} from '@angular/core'; -import {ViewportRuler} from '../overlay/position/viewport-ruler'; -import {RIPPLE_FADE_OUT_DURATION, RIPPLE_FADE_IN_DURATION} from './ripple-renderer'; +import {Platform} from '@angular/cdk/platform'; +import {ViewportRuler} from '@angular/cdk/overlay'; import {dispatchMouseEvent} from '@angular/cdk/testing'; +import {RIPPLE_FADE_OUT_DURATION, RIPPLE_FADE_IN_DURATION} from './ripple-renderer'; import { MdRipple, MdRippleModule, MD_RIPPLE_GLOBAL_OPTIONS, RippleState, RippleGlobalOptions } from './index'; -import {Platform} from '@angular/cdk/platform'; describe('MdRipple', () => { diff --git a/src/lib/core/ripple/ripple.ts b/src/lib/core/ripple/ripple.ts index 5f25f10fce80..9616b842943b 100644 --- a/src/lib/core/ripple/ripple.ts +++ b/src/lib/core/ripple/ripple.ts @@ -18,10 +18,10 @@ import { InjectionToken, Optional, } from '@angular/core'; +import {ViewportRuler} from '@angular/cdk/overlay'; +import {Platform} from '@angular/cdk/platform'; import {RippleConfig, RippleRenderer} from './ripple-renderer'; import {RippleRef} from './ripple-ref'; -import {ViewportRuler} from '../overlay/position/viewport-ruler'; -import {Platform} from '../platform/platform'; export interface RippleGlobalOptions { disabled?: boolean; diff --git a/src/lib/core/style/_variables.scss b/src/lib/core/style/_variables.scss index 837fa64437c7..f3cdbecd2128 100644 --- a/src/lib/core/style/_variables.scss +++ b/src/lib/core/style/_variables.scss @@ -13,18 +13,6 @@ $mat-font-family: Roboto, 'Helvetica Neue', sans-serif !default; $z-index-fab: 20 !default; $z-index-drawer: 100 !default; -// Overlay z indices. - -// 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. -$cdk-z-index-overlay-container: 1000; -$cdk-z-index-overlay: 1000; -$cdk-z-index-overlay-backdrop: 1000; - -// Background color for all of the backdrops -$cdk-overlay-dark-backdrop-background: rgba(0, 0, 0, 0.6); - // Global constants $pi: 3.14159265; diff --git a/src/lib/datepicker/datepicker.spec.ts b/src/lib/datepicker/datepicker.spec.ts index bcaeb0b1e736..88a15edbdd1c 100644 --- a/src/lib/datepicker/datepicker.spec.ts +++ b/src/lib/datepicker/datepicker.spec.ts @@ -3,19 +3,16 @@ import {async, ComponentFixture, TestBed, inject} from '@angular/core/testing'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; import {FormControl, FormsModule, ReactiveFormsModule} from '@angular/forms'; import {By} from '@angular/platform-browser'; +import {OverlayContainer} from '@angular/cdk/overlay'; +import {ESCAPE} from '@angular/cdk/keycodes'; +import {dispatchFakeEvent, dispatchMouseEvent} from '@angular/cdk/testing'; import {MdDatepickerModule, MdDatepickerIntl} from './index'; import {MdDatepicker} from './datepicker'; import {MdDatepickerInput} from './datepicker-input'; import {MdInputModule} from '../input/index'; import {MdNativeDateModule} from '../core/datetime/index'; -import {ESCAPE, OverlayContainer} from '../core'; import {DEC, JAN} from '../core/testing/month-constants'; -import { - dispatchFakeEvent, - dispatchMouseEvent, - createKeyboardEvent, - dispatchEvent, -} from '@angular/cdk/testing'; +import {createKeyboardEvent, dispatchEvent} from '@angular/cdk/testing'; import {MdFormFieldModule} from '../form-field/index'; describe('MdDatepicker', () => { diff --git a/src/lib/datepicker/datepicker.ts b/src/lib/datepicker/datepicker.ts index 759db81cb5d9..55a8c4a02197 100644 --- a/src/lib/datepicker/datepicker.ts +++ b/src/lib/datepicker/datepicker.ts @@ -12,41 +12,41 @@ import { Component, ComponentRef, EventEmitter, + Inject, + InjectionToken, Input, + NgZone, OnDestroy, Optional, Output, ViewChild, ViewContainerRef, ViewEncapsulation, - NgZone, - Inject, - InjectionToken, } from '@angular/core'; import {DOCUMENT} from '@angular/platform-browser'; +import {first} from '@angular/cdk/rxjs'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; import { Overlay, OverlayRef, OverlayState, + PositionStrategy, RepositionScrollStrategy, // This import is only used to define a generic type. The current TypeScript version incorrectly // considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953) // tslint:disable-next-line:no-unused-variable ScrollStrategy, -} from '../core/overlay/index'; -import {ComponentPortal} from '../core/portal/portal'; -import {Directionality} from '../core/bidi/index'; +} from '@angular/cdk/overlay'; +import {ComponentPortal} from '@angular/cdk/portal'; +import {Directionality} from '@angular/cdk/bidi'; +import {ESCAPE} from '@angular/cdk/keycodes'; import {MdDialog} from '../dialog/dialog'; import {MdDialogRef} from '../dialog/dialog-ref'; -import {PositionStrategy} from '../core/overlay/position/position-strategy'; import {MdDatepickerInput} from './datepicker-input'; import {Subscription} from 'rxjs/Subscription'; import {DateAdapter} from '../core/datetime/index'; import {createMissingDateImplError} from './datepicker-errors'; -import {ESCAPE} from '../core/keyboard/keycodes'; import {MdCalendar} from './calendar'; -import {first} from '../core/rxjs/index'; -import {coerceBooleanProperty} from '@angular/cdk/coercion'; /** Used to generate a unique ID for each datepicker instance. */ @@ -57,7 +57,8 @@ export const MD_DATEPICKER_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>('md-datepicker-scroll-strategy'); /** @docs-private */ -export function MD_DATEPICKER_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay) { +export function MD_DATEPICKER_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): + () => RepositionScrollStrategy { return () => overlay.scrollStrategies.reposition(); } diff --git a/src/lib/datepicker/index.ts b/src/lib/datepicker/index.ts index b0ea50af17f6..e66a1a81b7c6 100644 --- a/src/lib/datepicker/index.ts +++ b/src/lib/datepicker/index.ts @@ -9,7 +9,9 @@ import {NgModule} from '@angular/core'; import {MdMonthView} from './month-view'; import {CommonModule} from '@angular/common'; -import {A11yModule, OverlayModule, StyleModule} from '../core'; +import {OverlayModule} from '@angular/cdk/overlay'; +import {A11yModule} from '@angular/cdk/a11y'; +import {StyleModule} from '../core'; import {MdCalendarBody} from './calendar-body'; import {MdYearView} from './year-view'; import { diff --git a/src/lib/dialog/dialog-config.ts b/src/lib/dialog/dialog-config.ts index 6b5eeb26c84b..3fa7e657765f 100644 --- a/src/lib/dialog/dialog-config.ts +++ b/src/lib/dialog/dialog-config.ts @@ -7,7 +7,7 @@ */ import {ViewContainerRef} from '@angular/core'; -import {Direction} from '../core'; +import {Direction} from '@angular/cdk/bidi'; /** Valid ARIA roles for a dialog element. */ export type DialogRole = 'dialog' | 'alertdialog'; diff --git a/src/lib/dialog/dialog-container.ts b/src/lib/dialog/dialog-container.ts index 61ae1338cff2..816b4ce11ea8 100644 --- a/src/lib/dialog/dialog-container.ts +++ b/src/lib/dialog/dialog-container.ts @@ -9,27 +9,26 @@ import { Component, ComponentRef, - ViewChild, - ViewEncapsulation, - NgZone, ElementRef, EventEmitter, Inject, + NgZone, Optional, ChangeDetectorRef, + ViewChild, + ViewEncapsulation, } from '@angular/core'; -import { - animate, - trigger, - state, - style, - transition, - AnimationEvent, -} from '@angular/animations'; +import {animate, AnimationEvent, state, style, transition, trigger} from '@angular/animations'; import {DOCUMENT} from '@angular/platform-browser'; -import {BasePortalHost, ComponentPortal, PortalHostDirective, TemplatePortal} from '../core'; +import { + BasePortalHost, + ComponentPortal, + PortalHostDirective, + TemplatePortal +} from '@angular/cdk/portal'; +import {FocusTrap, FocusTrapFactory} from '@angular/cdk/a11y'; import {MdDialogConfig} from './dialog-config'; -import {FocusTrapFactory, FocusTrap} from '../core/a11y/focus-trap'; + /** * Throws an exception for the case when a ComponentPortal is diff --git a/src/lib/dialog/dialog-ref.ts b/src/lib/dialog/dialog-ref.ts index 1d8faeea3fc6..5b5a52169311 100644 --- a/src/lib/dialog/dialog-ref.ts +++ b/src/lib/dialog/dialog-ref.ts @@ -6,12 +6,12 @@ * found in the LICENSE file at https://angular.io/license */ -import {OverlayRef, GlobalPositionStrategy} from '../core'; +import {OverlayRef, GlobalPositionStrategy} from '@angular/cdk/overlay'; +import {filter, first, RxChain} from '@angular/cdk/rxjs'; import {DialogPosition} from './dialog-config'; import {Observable} from 'rxjs/Observable'; import {Subject} from 'rxjs/Subject'; import {MdDialogContainer} from './dialog-container'; -import {RxChain, first, filter} from '../core/rxjs/index'; // TODO(jelbourn): resizing diff --git a/src/lib/dialog/dialog.spec.ts b/src/lib/dialog/dialog.spec.ts index 597732465d66..398fd269caa1 100644 --- a/src/lib/dialog/dialog.spec.ts +++ b/src/lib/dialog/dialog.spec.ts @@ -21,12 +21,11 @@ import {By} from '@angular/platform-browser'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; import {Location} from '@angular/common'; import {SpyLocation} from '@angular/common/testing'; -import {MdDialogModule} from './index'; -import {MdDialog, MD_DIALOG_DATA} from './dialog'; import {MdDialogContainer} from './dialog-container'; -import {OverlayContainer, ESCAPE} from '../core'; -import {MdDialogRef} from './dialog-ref'; +import {OverlayContainer} from '@angular/cdk/overlay'; +import {ESCAPE} from '@angular/cdk/keycodes'; import {dispatchKeyboardEvent} from '@angular/cdk/testing'; +import {MdDialogModule, MdDialogRef, MdDialog, MD_DIALOG_DATA} from './index'; describe('MdDialog', () => { diff --git a/src/lib/dialog/dialog.ts b/src/lib/dialog/dialog.ts index 6c9364a02ee4..efb0d3bd0af6 100644 --- a/src/lib/dialog/dialog.ts +++ b/src/lib/dialog/dialog.ts @@ -7,39 +7,37 @@ */ import { - Injector, ComponentRef, + Inject, Injectable, + InjectionToken, + Injector, Optional, SkipSelf, TemplateRef, - Inject, - InjectionToken, } from '@angular/core'; import {Location} from '@angular/common'; -import {Observable} from 'rxjs/Observable'; -import {Subject} from 'rxjs/Subject'; +import {ComponentPortal, ComponentType, TemplatePortal} from '@angular/cdk/portal'; import { + BlockScrollStrategy, Overlay, OverlayRef, - ComponentType, OverlayState, - ComponentPortal, - BlockScrollStrategy, // This import is only used to define a generic type. The current TypeScript version incorrectly // considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953) // tslint:disable-next-line:no-unused-variable ScrollStrategy, -} from '../core'; +} from '@angular/cdk/overlay'; +import {ESCAPE} from '@angular/cdk/keycodes'; +import {startWith} from '@angular/cdk/rxjs'; +import {Observable} from 'rxjs/Observable'; +import {Subject} from 'rxjs/Subject'; +import {defer} from 'rxjs/observable/defer'; import {PortalInjector} from '../core/portal/portal-injector'; import {extendObject} from '../core/util/object-extend'; -import {ESCAPE} from '../core/keyboard/keycodes'; import {MdDialogConfig} from './dialog-config'; import {MdDialogRef} from './dialog-ref'; import {MdDialogContainer} from './dialog-container'; -import {TemplatePortal} from '../core/portal/portal'; -import {defer} from 'rxjs/observable/defer'; -import {startWith} from '../core/rxjs/index'; export const MD_DIALOG_DATA = new InjectionToken('MdDialogData'); @@ -49,7 +47,8 @@ export const MD_DIALOG_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>('md-dialog-scroll-strategy'); /** @docs-private */ -export function MD_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay) { +export function MD_DIALOG_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): + () => BlockScrollStrategy { return () => overlay.scrollStrategies.block(); } diff --git a/src/lib/dialog/index.ts b/src/lib/dialog/index.ts index 76572bcf9e24..ea9468cb3ae7 100644 --- a/src/lib/dialog/index.ts +++ b/src/lib/dialog/index.ts @@ -8,12 +8,10 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; -import { - OverlayModule, - PortalModule, - A11yModule, - MdCommonModule, -} from '../core'; +import {OverlayModule} from '@angular/cdk/overlay'; +import {PortalModule} from '@angular/cdk/portal'; +import {A11yModule} from '@angular/cdk/a11y'; +import {MdCommonModule} from '../core'; import {MdDialog, MD_DIALOG_SCROLL_STRATEGY_PROVIDER} from './dialog'; import {MdDialogContainer} from './dialog-container'; import { diff --git a/src/lib/grid-list/grid-list.ts b/src/lib/grid-list/grid-list.ts index 99adc8ff4078..20cc6befd653 100644 --- a/src/lib/grid-list/grid-list.ts +++ b/src/lib/grid-list/grid-list.ts @@ -22,7 +22,7 @@ import { import {MdGridTile} from './grid-tile'; import {TileCoordinator} from './tile-coordinator'; import {TileStyler, FitTileStyler, RatioTileStyler, FixedTileStyler} from './tile-styler'; -import {Directionality} from '../core'; +import {Directionality} from '@angular/cdk/bidi'; import { coerceToString, coerceToNumber, diff --git a/src/lib/input/input.ts b/src/lib/input/input.ts index f0449a9bc994..ff23a0e4520b 100644 --- a/src/lib/input/input.ts +++ b/src/lib/input/input.ts @@ -18,9 +18,9 @@ import { Renderer2, Self, } from '@angular/core'; -import {coerceBooleanProperty, Platform} from '../core'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; import {FormControl, FormGroupDirective, NgControl, NgForm} from '@angular/forms'; -import {getSupportedInputTypes} from '../core/platform/features'; +import {Platform, getSupportedInputTypes} from '@angular/cdk/platform'; import {getMdInputUnsupportedTypeError} from './input-errors'; import { defaultErrorStateMatcher, diff --git a/src/lib/menu/index.ts b/src/lib/menu/index.ts index 1545666e8449..06e7c2827980 100644 --- a/src/lib/menu/index.ts +++ b/src/lib/menu/index.ts @@ -8,7 +8,8 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; -import {OverlayModule, MdCommonModule} from '../core'; +import {MdCommonModule} from '../core'; +import {OverlayModule} from '@angular/cdk/overlay'; import {MdMenu, MD_MENU_DEFAULT_OPTIONS} from './menu-directive'; import {MdMenuItem} from './menu-item'; import {MdMenuTrigger, MD_MENU_SCROLL_STRATEGY_PROVIDER} from './menu-trigger'; diff --git a/src/lib/menu/menu-directive.ts b/src/lib/menu/menu-directive.ts index 7e0ea30f3468..5c62eee09c79 100644 --- a/src/lib/menu/menu-directive.ts +++ b/src/lib/menu/menu-directive.ts @@ -34,7 +34,7 @@ import {transformMenu, fadeInItems} from './menu-animations'; import {ESCAPE, LEFT_ARROW, RIGHT_ARROW} from '../core/keyboard/keycodes'; import {merge} from 'rxjs/observable/merge'; import {Observable} from 'rxjs/Observable'; -import {Direction} from '../core'; +import {Direction} from '@angular/cdk/bidi'; /** Default `md-menu` options that can be overridden. */ export interface MdMenuDefaultOptions { diff --git a/src/lib/menu/menu-panel.ts b/src/lib/menu/menu-panel.ts index 2eeb4fbbef7f..073d40805267 100644 --- a/src/lib/menu/menu-panel.ts +++ b/src/lib/menu/menu-panel.ts @@ -8,7 +8,7 @@ import {EventEmitter, TemplateRef} from '@angular/core'; import {MenuPositionX, MenuPositionY} from './menu-positions'; -import {Direction} from '../core'; +import {Direction} from '@angular/cdk/bidi'; export interface MdMenuPanel { xPosition: MenuPositionX; diff --git a/src/lib/menu/menu-trigger.ts b/src/lib/menu/menu-trigger.ts index bbcfe673daaa..a290c0ccc2e8 100644 --- a/src/lib/menu/menu-trigger.ts +++ b/src/lib/menu/menu-trigger.ts @@ -11,40 +11,35 @@ import { Directive, ElementRef, EventEmitter, + Inject, + InjectionToken, Input, OnDestroy, Optional, Output, - ViewContainerRef, Self, - Inject, - InjectionToken, + ViewContainerRef, } from '@angular/core'; +import {Direction, Directionality} from '@angular/cdk/bidi'; +import {isFakeMousedownFromScreenReader} from '@angular/cdk/a11y'; +import {TemplatePortal} from '@angular/cdk/portal'; +import {LEFT_ARROW, RIGHT_ARROW} from '@angular/cdk/keycodes'; import { - isFakeMousedownFromScreenReader, - Directionality, - Direction, - Overlay, - OverlayState, - OverlayRef, - TemplatePortal, ConnectedPositionStrategy, HorizontalConnectionPos, - VerticalConnectionPos, - RIGHT_ARROW, - LEFT_ARROW, + Overlay, + OverlayRef, + OverlayState, RepositionScrollStrategy, - // This import is only used to define a generic type. The current TypeScript version incorrectly - // considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953) - // tslint:disable-next-line:no-unused-variable ScrollStrategy, -} from '../core'; + VerticalConnectionPos, +} from '@angular/cdk/overlay'; +import {filter, RxChain} from '@angular/cdk/rxjs'; import {MdMenu} from './menu-directive'; import {MdMenuItem} from './menu-item'; import {MdMenuPanel} from './menu-panel'; import {MenuPositionX, MenuPositionY} from './menu-positions'; import {throwMdMenuMissingError} from './menu-errors'; -import {RxChain, filter} from '../core/rxjs/index'; import {of as observableOf} from 'rxjs/observable/of'; import {merge} from 'rxjs/observable/merge'; import {Subscription} from 'rxjs/Subscription'; @@ -54,7 +49,8 @@ export const MD_MENU_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>('md-menu-scroll-strategy'); /** @docs-private */ -export function MD_MENU_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay) { +export function MD_MENU_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): + () => RepositionScrollStrategy { return () => overlay.scrollStrategies.reposition(); } @@ -100,18 +96,33 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy { /** @deprecated */ @Input('md-menu-trigger-for') - get _deprecatedMdMenuTriggerFor(): MdMenuPanel { return this.menu; } - set _deprecatedMdMenuTriggerFor(v: MdMenuPanel) { this.menu = v; } + get _deprecatedMdMenuTriggerFor(): MdMenuPanel { + return this.menu; + } + + set _deprecatedMdMenuTriggerFor(v: MdMenuPanel) { + this.menu = v; + } /** @deprecated */ @Input('mat-menu-trigger-for') - get _deprecatedMatMenuTriggerFor(): MdMenuPanel { return this.menu; } - set _deprecatedMatMenuTriggerFor(v: MdMenuPanel) { this.menu = v; } + get _deprecatedMatMenuTriggerFor(): MdMenuPanel { + return this.menu; + } + + set _deprecatedMatMenuTriggerFor(v: MdMenuPanel) { + this.menu = v; + } // Trigger input for compatibility mode @Input('matMenuTriggerFor') - get _matMenuTriggerFor(): MdMenuPanel { return this.menu; } - set _matMenuTriggerFor(v: MdMenuPanel) { this.menu = v; } + get _matMenuTriggerFor(): MdMenuPanel { + return this.menu; + } + + set _matMenuTriggerFor(v: MdMenuPanel) { + this.menu = v; + } /** References the menu instance that the trigger is associated with. */ @Input('mdMenuTriggerFor') menu: MdMenuPanel; @@ -122,14 +133,13 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy { /** Event emitted when the associated menu is closed. */ @Output() onMenuClose = new EventEmitter(); - constructor( - private _overlay: Overlay, - private _element: ElementRef, - private _viewContainerRef: ViewContainerRef, - @Inject(MD_MENU_SCROLL_STRATEGY) private _scrollStrategy, - @Optional() private _parentMenu: MdMenu, - @Optional() @Self() private _menuItemInstance: MdMenuItem, - @Optional() private _dir: Directionality) { + constructor(private _overlay: Overlay, + private _element: ElementRef, + private _viewContainerRef: ViewContainerRef, + @Inject(MD_MENU_SCROLL_STRATEGY) private _scrollStrategy, + @Optional() private _parentMenu: MdMenu, + @Optional() @Self() private _menuItemInstance: MdMenuItem, + @Optional() private _dir: Directionality) { if (_menuItemInstance) { _menuItemInstance._triggersSubmenu = this.triggersSubmenu(); @@ -151,11 +161,11 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy { if (this.triggersSubmenu()) { // Subscribe to changes in the hovered item in order to toggle the panel. this._hoverSubscription = filter - .call(this._parentMenu.hover(), active => active === this._menuItemInstance) - .subscribe(() => { - this._openedByMouse = true; - this.openMenu(); - }); + .call(this._parentMenu.hover(), active => active === this._menuItemInstance) + .subscribe(() => { + this._openedByMouse = true; + this.openMenu(); + }); } } @@ -338,10 +348,10 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy { */ private _getPosition(): ConnectedPositionStrategy { let [originX, originFallbackX]: HorizontalConnectionPos[] = - this.menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end']; + this.menu.xPosition === 'before' ? ['end', 'start'] : ['start', 'end']; let [overlayY, overlayFallbackY]: VerticalConnectionPos[] = - this.menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom']; + this.menu.yPosition === 'above' ? ['bottom', 'top'] : ['top', 'bottom']; let [originY, originFallbackY] = [overlayY, overlayFallbackY]; let [overlayX, overlayFallbackX] = [originX, originFallbackX]; @@ -362,18 +372,18 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy { } return this._overlay.position() - .connectedTo(this._element, {originX, originY}, {overlayX, overlayY}) - .withDirection(this.dir) - .withOffsetY(offsetY) - .withFallbackPosition( - {originX: originFallbackX, originY}, - {overlayX: overlayFallbackX, overlayY}) - .withFallbackPosition( - {originX, originY: originFallbackY}, - {overlayX, overlayY: overlayFallbackY}) - .withFallbackPosition( - {originX: originFallbackX, originY: originFallbackY}, - {overlayX: overlayFallbackX, overlayY: overlayFallbackY}); + .connectedTo(this._element, {originX, originY}, {overlayX, overlayY}) + .withDirection(this.dir) + .withOffsetY(offsetY) + .withFallbackPosition( + {originX: originFallbackX, originY}, + {overlayX: overlayFallbackX, overlayY}) + .withFallbackPosition( + {originX, originY: originFallbackY}, + {overlayX, overlayY: overlayFallbackY}) + .withFallbackPosition( + {originX: originFallbackX, originY: originFallbackY}, + {overlayX: overlayFallbackX, overlayY: overlayFallbackY}); } /** Cleans up the active subscriptions. */ @@ -383,8 +393,8 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy { this._positionSubscription, this._hoverSubscription ] - .filter(subscription => !!subscription) - .forEach(subscription => subscription.unsubscribe()); + .filter(subscription => !!subscription) + .forEach(subscription => subscription.unsubscribe()); } /** Returns a stream that emits whenever an action that should close the menu occurs. */ @@ -392,9 +402,9 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy { const backdrop = this._overlayRef!.backdropClick(); const parentClose = this._parentMenu ? this._parentMenu.close : observableOf(null); const hover = this._parentMenu ? RxChain.from(this._parentMenu.hover()) - .call(filter, active => active !== this._menuItemInstance) - .call(filter, () => this._menuOpen) - .result() : observableOf(null); + .call(filter, active => active !== this._menuItemInstance) + .call(filter, () => this._menuOpen) + .result() : observableOf(null); return merge(backdrop, parentClose, hover); } @@ -411,9 +421,9 @@ export class MdMenuTrigger implements AfterViewInit, OnDestroy { const keyCode = event.keyCode; if (this.triggersSubmenu() && ( - (keyCode === RIGHT_ARROW && this.dir === 'ltr') || - (keyCode === LEFT_ARROW && this.dir === 'rtl'))) { - this.openMenu(); + (keyCode === RIGHT_ARROW && this.dir === 'ltr') || + (keyCode === LEFT_ARROW && this.dir === 'rtl'))) { + this.openMenu(); } } diff --git a/src/lib/menu/menu.spec.ts b/src/lib/menu/menu.spec.ts index 775a6826f5f7..f83488fe30f8 100644 --- a/src/lib/menu/menu.spec.ts +++ b/src/lib/menu/menu.spec.ts @@ -1,4 +1,4 @@ -import {TestBed, async, ComponentFixture, fakeAsync, tick} from '@angular/core/testing'; +import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'; import {By} from '@angular/platform-browser'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; import { @@ -8,24 +8,19 @@ import { Input, Output, TemplateRef, - ViewChild + ViewChild, } from '@angular/core'; +import {Direction, Directionality} from '@angular/cdk/bidi'; +import {OverlayContainer} from '@angular/cdk/overlay'; +import {ESCAPE, LEFT_ARROW, RIGHT_ARROW} from '@angular/cdk/keycodes'; import { - OverlayContainer, - Directionality, - Direction, - ESCAPE, - RIGHT_ARROW, - LEFT_ARROW, -} from '../core'; -import { + MD_MENU_DEFAULT_OPTIONS, + MdMenu, MdMenuModule, - MdMenuTrigger, MdMenuPanel, + MdMenuTrigger, MenuPositionX, MenuPositionY, - MdMenu, - MD_MENU_DEFAULT_OPTIONS, } from './index'; import {MENU_PANEL_TOP_PADDING} from './menu-trigger'; import {extendObject} from '../core/util/object-extend'; diff --git a/src/lib/module.ts b/src/lib/module.ts index 1ebbcc15ef71..4cec7ca1de0c 100644 --- a/src/lib/module.ts +++ b/src/lib/module.ts @@ -8,16 +8,13 @@ import {NgModule} from '@angular/core'; -import { - A11yModule, - BidiModule, - MdCommonModule, - MdRippleModule, - ObserversModule, - OverlayModule, - PortalModule -} from './core/index'; +import {OverlayModule} from '@angular/cdk/overlay'; +import {A11yModule} from '@angular/cdk/a11y'; +import {BidiModule} from '@angular/cdk/bidi'; +import {ObserversModule} from '@angular/cdk/observers'; +import {PortalModule} from '@angular/cdk/portal'; +import {MdCommonModule, MdRippleModule} from './core'; import {MdButtonToggleModule} from './button-toggle/index'; import {MdButtonModule} from './button/index'; import {MdCheckboxModule} from './checkbox/index'; diff --git a/src/lib/radio/index.ts b/src/lib/radio/index.ts index d81f789abf17..990836c1bea0 100644 --- a/src/lib/radio/index.ts +++ b/src/lib/radio/index.ts @@ -8,7 +8,7 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; -import {VIEWPORT_RULER_PROVIDER} from '../core/overlay/position/viewport-ruler'; +import {VIEWPORT_RULER_PROVIDER} from '@angular/cdk/overlay'; import { MdRippleModule, MdCommonModule, diff --git a/src/lib/radio/radio.spec.ts b/src/lib/radio/radio.spec.ts index 55e5bbf0de47..1ba5c0195acc 100644 --- a/src/lib/radio/radio.spec.ts +++ b/src/lib/radio/radio.spec.ts @@ -1,13 +1,11 @@ -import {async, ComponentFixture, TestBed, fakeAsync, tick} from '@angular/core/testing'; -import {NgModel, FormsModule, ReactiveFormsModule, FormControl} from '@angular/forms'; +import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'; +import {FormControl, FormsModule, NgModel, ReactiveFormsModule} from '@angular/forms'; import {Component, DebugElement} from '@angular/core'; import {By} from '@angular/platform-browser'; -import {MdRadioGroup, MdRadioButton, MdRadioChange, MdRadioModule} from './index'; -import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; -import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler'; -import {dispatchFakeEvent} from '@angular/cdk/testing'; +import {ViewportRuler} from '@angular/cdk/overlay'; +import {dispatchFakeEvent, FakeViewportRuler} from '@angular/cdk/testing'; import {RIPPLE_FADE_IN_DURATION, RIPPLE_FADE_OUT_DURATION} from '../core/ripple/ripple-renderer'; - +import {MdRadioButton, MdRadioChange, MdRadioGroup, MdRadioModule} from './index'; describe('MdRadio', () => { diff --git a/src/lib/select/index.ts b/src/lib/select/index.ts index 83fcb32d6747..bd79179836f8 100644 --- a/src/lib/select/index.ts +++ b/src/lib/select/index.ts @@ -9,7 +9,8 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; import {MdSelect, MdSelectTrigger, MD_SELECT_SCROLL_STRATEGY_PROVIDER} from './select'; -import {MdCommonModule, OverlayModule, MdOptionModule} from '../core'; +import {MdCommonModule, MdOptionModule} from '../core'; +import {OverlayModule} from '@angular/cdk/overlay'; @NgModule({ diff --git a/src/lib/select/select.spec.ts b/src/lib/select/select.spec.ts index 6f7e382e2a58..ee55075a76fe 100644 --- a/src/lib/select/select.spec.ts +++ b/src/lib/select/select.spec.ts @@ -1,41 +1,39 @@ import { + ChangeDetectionStrategy, Component, DebugElement, + OnInit, QueryList, ViewChild, ViewChildren, - ChangeDetectionStrategy, - OnInit, } from '@angular/core'; import { ControlValueAccessor, FormControl, + FormGroup, + FormGroupDirective, FormsModule, NG_VALUE_ACCESSOR, ReactiveFormsModule, - FormGroup, - FormGroupDirective, Validators, } from '@angular/forms'; import {By} from '@angular/platform-browser'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {TestBed, async, ComponentFixture, fakeAsync, tick, inject} from '@angular/core/testing'; +import {async, ComponentFixture, fakeAsync, inject, TestBed, tick} from '@angular/core/testing'; +import {Directionality} from '@angular/cdk/bidi'; +import {DOWN_ARROW, END, ENTER, HOME, SPACE, TAB, UP_ARROW} from '@angular/cdk/keycodes'; +import {OverlayContainer, ScrollDispatcher, ViewportRuler} from '@angular/cdk/overlay'; +import {dispatchFakeEvent, dispatchKeyboardEvent, wrappedErrorMessage} from '@angular/cdk/testing'; +import {Subject} from 'rxjs/Subject'; +import {map} from 'rxjs/operator/map'; import {MdSelectModule} from './index'; -import {OverlayContainer} from '../core/overlay/overlay-container'; import {MdSelect} from './select'; import {getMdSelectDynamicMultipleError, getMdSelectNonArrayValueError} from './select-errors'; import {MdOption} from '../core/option/option'; -import {Directionality} from '../core/bidi/index'; -import {DOWN_ARROW, UP_ARROW, ENTER, SPACE, HOME, END, TAB} from '../core/keyboard/keycodes'; -import {Subject} from 'rxjs/Subject'; -import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; -import {dispatchFakeEvent, dispatchKeyboardEvent, wrappedErrorMessage} from '@angular/cdk/testing'; -import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher'; import { FloatPlaceholderType, MD_PLACEHOLDER_GLOBAL_OPTIONS } from '../core/placeholder/placeholder-options'; -import {map} from 'rxjs/operator/map'; describe('MdSelect', () => { diff --git a/src/lib/select/select.ts b/src/lib/select/select.ts index 3887896a69a8..ee179ceeb55b 100644 --- a/src/lib/select/select.ts +++ b/src/lib/select/select.ts @@ -8,56 +8,58 @@ import { AfterContentInit, + Attribute, + ChangeDetectionStrategy, + ChangeDetectorRef, Component, ContentChild, ContentChildren, ElementRef, EventEmitter, + Inject, + InjectionToken, Input, OnDestroy, + OnInit, Optional, Output, QueryList, Renderer2, Self, - ViewEncapsulation, ViewChild, - ChangeDetectorRef, - Attribute, - OnInit, - Inject, - ChangeDetectionStrategy, - InjectionToken, + ViewEncapsulation, Directive, } from '@angular/core'; -import {NgForm, FormGroupDirective} from '@angular/forms'; -import {MdOption, MdOptionSelectionChange, MdOptgroup} from '../core/option/index'; -import {ENTER, SPACE, UP_ARROW, DOWN_ARROW, HOME, END} from '../core/keyboard/keycodes'; -import {FocusKeyManager} from '../core/a11y/focus-key-manager'; -import {Directionality} from '../core/bidi/index'; +import {ControlValueAccessor, FormGroupDirective, NgControl, NgForm} from '@angular/forms'; +import {DOWN_ARROW, END, ENTER, HOME, SPACE, UP_ARROW} from '@angular/cdk/keycodes'; +import {FocusKeyManager} from '@angular/cdk/a11y'; +import {Directionality} from '@angular/cdk/bidi'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; +import {filter, startWith} from '@angular/cdk/rxjs'; +import { + ConnectedOverlayDirective, + Overlay, + RepositionScrollStrategy, + // This import is only used to define a generic type. The current TypeScript version incorrectly + // considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953) + // tslint:disable-next-line:no-unused-variable + ScrollStrategy, + ViewportRuler +} from '@angular/cdk/overlay'; +import {merge} from 'rxjs/observable/merge'; import {Observable} from 'rxjs/Observable'; import {Subscription} from 'rxjs/Subscription'; -import {transformPlaceholder, transformPanel, fadeInContent} from './select-animations'; -import {ControlValueAccessor, NgControl} from '@angular/forms'; -import {coerceBooleanProperty} from '@angular/cdk/coercion'; -import {ConnectedOverlayDirective} from '../core/overlay/overlay-directives'; -import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; +import {fadeInContent, transformPanel, transformPlaceholder} from './select-animations'; import {SelectionModel} from '../core/selection/selection'; -import {Overlay} from '../core/overlay/overlay'; import {getMdSelectDynamicMultipleError, getMdSelectNonArrayValueError} from './select-errors'; -import {startWith, filter} from '../core/rxjs/index'; -import {merge} from 'rxjs/observable/merge'; import {CanColor, mixinColor} from '../core/common-behaviors/color'; import {CanDisable, mixinDisabled} from '../core/common-behaviors/disabled'; +import {MdOptgroup, MdOption, MdOptionSelectionChange} from '../core/option/index'; import { FloatPlaceholderType, - PlaceholderOptions, - MD_PLACEHOLDER_GLOBAL_OPTIONS + MD_PLACEHOLDER_GLOBAL_OPTIONS, + PlaceholderOptions } from '../core/placeholder/placeholder-options'; -// This import is only used to define a generic type. The current TypeScript version incorrectly -// considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953) -// tslint:disable-next-line:no-unused-variable -import {ScrollStrategy, RepositionScrollStrategy} from '../core/overlay/scroll'; import {Platform} from '@angular/cdk/platform'; /** @@ -126,7 +128,8 @@ export const MD_SELECT_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>('md-select-scroll-strategy'); /** @docs-private */ -export function MD_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay) { +export function MD_SELECT_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): + () => RepositionScrollStrategy { return () => overlay.scrollStrategies.reposition(); } diff --git a/src/lib/sidenav/index.ts b/src/lib/sidenav/index.ts index ed6d8f43d48c..c0f6e8351a5a 100644 --- a/src/lib/sidenav/index.ts +++ b/src/lib/sidenav/index.ts @@ -8,9 +8,9 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; +import {A11yModule} from '@angular/cdk/a11y'; +import {OverlayModule} from '@angular/cdk/overlay'; import {MdCommonModule} from '../core'; -import {A11yModule} from '../core/a11y/index'; -import {OverlayModule} from '../core/overlay/index'; import {MdSidenav, MdSidenavContainer} from './sidenav'; diff --git a/src/lib/sidenav/sidenav.ts b/src/lib/sidenav/sidenav.ts index c051a8202f01..47d90947b8f6 100644 --- a/src/lib/sidenav/sidenav.ts +++ b/src/lib/sidenav/sidenav.ts @@ -25,10 +25,11 @@ import { ChangeDetectorRef, } from '@angular/core'; import {animate, state, style, transition, trigger, AnimationEvent} from '@angular/animations'; -import {Directionality, coerceBooleanProperty} from '../core'; -import {FocusTrapFactory, FocusTrap} from '../core/a11y/focus-trap'; -import {ESCAPE} from '../core/keyboard/keycodes'; -import {first, takeUntil, startWith} from '../core/rxjs/index'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; +import {Directionality} from '@angular/cdk/bidi'; +import {ESCAPE} from '@angular/cdk/keycodes'; +import {first, takeUntil, startWith} from '@angular/cdk/rxjs'; +import {FocusTrapFactory, FocusTrap} from '@angular/cdk/a11y'; import {DOCUMENT} from '@angular/platform-browser'; import {merge} from 'rxjs/observable/merge'; diff --git a/src/lib/slide-toggle/index.ts b/src/lib/slide-toggle/index.ts index 51412f905a57..6220ea1fee2e 100644 --- a/src/lib/slide-toggle/index.ts +++ b/src/lib/slide-toggle/index.ts @@ -8,15 +8,16 @@ import {NgModule} from '@angular/core'; import {HAMMER_GESTURE_CONFIG} from '@angular/platform-browser'; +import {PlatformModule} from '@angular/cdk/platform'; import {MdSlideToggle} from './slide-toggle'; import { FOCUS_ORIGIN_MONITOR_PROVIDER, GestureConfig, MdCommonModule, MdRippleModule, - PlatformModule, } from '../core'; + @NgModule({ imports: [MdRippleModule, MdCommonModule, PlatformModule], exports: [MdSlideToggle, MdCommonModule], diff --git a/src/lib/slide-toggle/slide-toggle.ts b/src/lib/slide-toggle/slide-toggle.ts index f3ce234f20ad..07b4e69bf613 100644 --- a/src/lib/slide-toggle/slide-toggle.ts +++ b/src/lib/slide-toggle/slide-toggle.ts @@ -21,15 +21,15 @@ import { ViewChild, ViewEncapsulation } from '@angular/core'; +import {Platform} from '@angular/cdk/platform'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; import { applyCssTransform, - coerceBooleanProperty, FocusOrigin, FocusOriginMonitor, HammerInput, MdRipple, RippleRef, - Platform, } from '../core'; import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms'; import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled'; diff --git a/src/lib/slider/slider.ts b/src/lib/slider/slider.ts index 3788213cbf83..ccfd09d994a0 100644 --- a/src/lib/slider/slider.ts +++ b/src/lib/slider/slider.ts @@ -7,6 +7,8 @@ */ import { + ChangeDetectionStrategy, + ChangeDetectorRef, Component, ElementRef, EventEmitter, @@ -17,13 +19,11 @@ import { Output, Renderer2, ViewEncapsulation, - ChangeDetectionStrategy, - ChangeDetectorRef, ViewChild, } from '@angular/core'; import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms'; -import {coerceBooleanProperty, coerceNumberProperty, HammerInput} from '../core'; -import {Directionality} from '../core/bidi/index'; +import {coerceBooleanProperty, coerceNumberProperty} from '@angular/cdk/coercion'; +import {Directionality} from '@angular/cdk/bidi'; import { DOWN_ARROW, END, @@ -32,10 +32,11 @@ import { PAGE_DOWN, PAGE_UP, RIGHT_ARROW, - UP_ARROW -} from '../core/keyboard/keycodes'; + UP_ARROW, +} from '@angular/cdk/keycodes'; +import {HammerInput} from '../core'; import {FocusOrigin, FocusOriginMonitor} from '../core/style/focus-origin-monitor'; -import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled'; +import {CanDisable, mixinDisabled} from '../core/common-behaviors/disabled'; /** diff --git a/src/lib/snack-bar/index.ts b/src/lib/snack-bar/index.ts index ad0818aad0d8..12082fa3c625 100644 --- a/src/lib/snack-bar/index.ts +++ b/src/lib/snack-bar/index.ts @@ -7,8 +7,11 @@ */ import {NgModule} from '@angular/core'; -import {OverlayModule, PortalModule, MdCommonModule, LIVE_ANNOUNCER_PROVIDER} from '../core'; import {CommonModule} from '@angular/common'; +import {OverlayModule} from '@angular/cdk/overlay'; +import {PortalModule} from '@angular/cdk/portal'; +import {LIVE_ANNOUNCER_PROVIDER} from '@angular/cdk/a11y'; +import {MdCommonModule} from '../core'; import {MdSnackBar} from './snack-bar'; import {MdSnackBarContainer} from './snack-bar-container'; import {SimpleSnackBar} from './simple-snack-bar'; diff --git a/src/lib/snack-bar/snack-bar-config.ts b/src/lib/snack-bar/snack-bar-config.ts index 11c8046918cd..85f02041e42e 100644 --- a/src/lib/snack-bar/snack-bar-config.ts +++ b/src/lib/snack-bar/snack-bar-config.ts @@ -7,7 +7,8 @@ */ import {ViewContainerRef, InjectionToken} from '@angular/core'; -import {AriaLivePoliteness, Direction} from '../core'; +import {AriaLivePoliteness} from '@angular/cdk/a11y'; +import {Direction} from '@angular/cdk/bidi'; export const MD_SNACK_BAR_DATA = new InjectionToken('MdSnackBarData'); diff --git a/src/lib/snack-bar/snack-bar-container.ts b/src/lib/snack-bar/snack-bar-container.ts index a0db0cad1042..6a0f8f6d065e 100644 --- a/src/lib/snack-bar/snack-bar-container.ts +++ b/src/lib/snack-bar/snack-bar-container.ts @@ -28,12 +28,11 @@ import { BasePortalHost, ComponentPortal, PortalHostDirective, -} from '../core'; -import {MdSnackBarConfig} from './snack-bar-config'; +} from '@angular/cdk/portal'; +import {first} from '@angular/cdk/rxjs'; import {Observable} from 'rxjs/Observable'; import {Subject} from 'rxjs/Subject'; -import {first} from '../core/rxjs/index'; - +import {MdSnackBarConfig} from './snack-bar-config'; export type SnackBarState = 'initial' | 'visible' | 'complete' | 'void'; diff --git a/src/lib/snack-bar/snack-bar-ref.ts b/src/lib/snack-bar/snack-bar-ref.ts index 32349ff2c3ed..a2ae2053bba0 100644 --- a/src/lib/snack-bar/snack-bar-ref.ts +++ b/src/lib/snack-bar/snack-bar-ref.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {OverlayRef} from '../core'; +import {OverlayRef} from '@angular/cdk/overlay'; import {Observable} from 'rxjs/Observable'; import {Subject} from 'rxjs/Subject'; import {MdSnackBarContainer} from './snack-bar-container'; diff --git a/src/lib/snack-bar/snack-bar.spec.ts b/src/lib/snack-bar/snack-bar.spec.ts index 74a770d16adb..2d57d390f381 100644 --- a/src/lib/snack-bar/snack-bar.spec.ts +++ b/src/lib/snack-bar/snack-bar.spec.ts @@ -10,7 +10,8 @@ import { import {NgModule, Component, Directive, ViewChild, ViewContainerRef, Inject} from '@angular/core'; import {CommonModule} from '@angular/common'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {OverlayContainer, LiveAnnouncer} from '../core'; +import {OverlayContainer} from '@angular/cdk/overlay'; +import {LiveAnnouncer} from '@angular/cdk/a11y'; import { MdSnackBarModule, MdSnackBar, diff --git a/src/lib/snack-bar/snack-bar.ts b/src/lib/snack-bar/snack-bar.ts index c51a1efcaa65..6f182f8f5d8a 100644 --- a/src/lib/snack-bar/snack-bar.ts +++ b/src/lib/snack-bar/snack-bar.ts @@ -6,24 +6,13 @@ * found in the LICENSE file at https://angular.io/license */ -import { - Injectable, - ComponentRef, - Optional, - SkipSelf, - Injector, -} from '@angular/core'; -import { - ComponentType, - ComponentPortal, - Overlay, - OverlayRef, - OverlayState, - LiveAnnouncer, -} from '../core'; +import {ComponentRef, Injectable, Injector, Optional, SkipSelf } from '@angular/core'; +import {Overlay, OverlayRef, OverlayState} from '@angular/cdk/overlay'; +import {ComponentPortal, ComponentType} from '@angular/cdk/portal'; +import {LiveAnnouncer} from '@angular/cdk/a11y'; import {PortalInjector} from '../core/portal/portal-injector'; import {extendObject} from '../core/util/object-extend'; -import {MdSnackBarConfig, MD_SNACK_BAR_DATA} from './snack-bar-config'; +import {MD_SNACK_BAR_DATA, MdSnackBarConfig} from './snack-bar-config'; import {MdSnackBarRef} from './snack-bar-ref'; import {MdSnackBarContainer} from './snack-bar-container'; import {SimpleSnackBar} from './simple-snack-bar'; diff --git a/src/lib/sort/sort-header.ts b/src/lib/sort/sort-header.ts index db59feacf20c..8daa517e51e2 100644 --- a/src/lib/sort/sort-header.ts +++ b/src/lib/sort/sort-header.ts @@ -14,13 +14,13 @@ import { Optional, ViewEncapsulation } from '@angular/core'; -import {MdSort, MdSortable} from './sort'; -import {MdSortHeaderIntl} from './sort-header-intl'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; import {CdkColumnDef} from '@angular/cdk/table'; -import {coerceBooleanProperty} from '../core'; -import {getMdSortHeaderNotContainedWithinMdSortError} from './sort-errors'; import {Subscription} from 'rxjs/Subscription'; import {merge} from 'rxjs/observable/merge'; +import {MdSort, MdSortable} from './sort'; +import {MdSortHeaderIntl} from './sort-header-intl'; +import {getMdSortHeaderNotContainedWithinMdSortError} from './sort-errors'; /** * Applies sorting behavior (click to change sort) and styles to an element, including an diff --git a/src/lib/sort/sort.ts b/src/lib/sort/sort.ts index 87920d3fd336..ec30d607b24e 100644 --- a/src/lib/sort/sort.ts +++ b/src/lib/sort/sort.ts @@ -7,8 +7,8 @@ */ import {Directive, EventEmitter, Input, Output} from '@angular/core'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; import {SortDirection} from './sort-direction'; -import {coerceBooleanProperty} from '../core'; import {getMdSortDuplicateMdSortableIdError, getMdSortHeaderMissingIdError} from './sort-errors'; export interface MdSortable { diff --git a/src/lib/tabs/index.ts b/src/lib/tabs/index.ts index aa4849d9a1da..58ee4f85de05 100644 --- a/src/lib/tabs/index.ts +++ b/src/lib/tabs/index.ts @@ -8,20 +8,18 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; -import {MdCommonModule} from '../core'; +import {PortalModule} from '@angular/cdk/portal'; import {ObserversModule} from '@angular/cdk/observers'; -import {PortalModule} from '../core'; -import {MdRippleModule} from '../core/ripple/index'; +import {ScrollDispatchModule, VIEWPORT_RULER_PROVIDER} from '@angular/cdk/overlay'; +import {MdCommonModule, MdRippleModule} from '../core'; import {MdTab} from './tab'; import {MdTabGroup} from './tab-group'; import {MdTabLabel} from './tab-label'; import {MdTabLabelWrapper} from './tab-label-wrapper'; -import {MdTabNav, MdTabLink} from './tab-nav-bar/tab-nav-bar'; +import {MdTabLink, MdTabNav} from './tab-nav-bar/tab-nav-bar'; import {MdInkBar} from './ink-bar'; import {MdTabBody} from './tab-body'; -import {VIEWPORT_RULER_PROVIDER} from '../core/overlay/position/viewport-ruler'; import {MdTabHeader} from './tab-header'; -import {ScrollDispatchModule} from '../core/overlay/scroll/index'; @NgModule({ diff --git a/src/lib/tabs/tab-body.spec.ts b/src/lib/tabs/tab-body.spec.ts index 9c0f7e0023b2..1f83fc3639dc 100644 --- a/src/lib/tabs/tab-body.spec.ts +++ b/src/lib/tabs/tab-body.spec.ts @@ -1,12 +1,12 @@ -import {async, ComponentFixture, TestBed, flushMicrotasks, fakeAsync} from '@angular/core/testing'; import {Component, ViewChild, TemplateRef, ViewContainerRef} from '@angular/core'; +import {CommonModule} from '@angular/common'; +import {PortalModule} from '@angular/cdk/portal'; +import {async, ComponentFixture, TestBed, flushMicrotasks, fakeAsync} from '@angular/core/testing'; import {NoopAnimationsModule} from '@angular/platform-browser/animations'; import {Direction, Directionality} from '../core/bidi/index'; import {TemplatePortal} from '../core/portal/portal'; import {MdTabBody} from './tab-body'; import {MdRippleModule} from '../core/ripple/index'; -import {CommonModule} from '@angular/common'; -import {PortalModule} from '../core'; describe('MdTabBody', () => { diff --git a/src/lib/tabs/tab-body.ts b/src/lib/tabs/tab-body.ts index 1057dda318bf..7d6a2f25ebf5 100644 --- a/src/lib/tabs/tab-body.ts +++ b/src/lib/tabs/tab-body.ts @@ -27,7 +27,9 @@ import { transition, AnimationEvent, } from '@angular/animations'; -import {TemplatePortal, PortalHostDirective, Directionality, Direction} from '../core'; +import {TemplatePortal, PortalHostDirective} from '@angular/cdk/portal'; +import {Directionality, Direction} from '@angular/cdk/bidi'; + /** * These position states are used internally as animation states for the tab body. Setting the diff --git a/src/lib/tabs/tab-group.spec.ts b/src/lib/tabs/tab-group.spec.ts index d3b3b0843901..06d27fe2177f 100644 --- a/src/lib/tabs/tab-group.spec.ts +++ b/src/lib/tabs/tab-group.spec.ts @@ -1,15 +1,11 @@ -import { - async, fakeAsync, tick, ComponentFixture, TestBed -} from '@angular/core/testing'; -import {MdTabGroup, MdTabsModule, MdTabHeaderPosition} from './index'; +import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'; import {Component, ViewChild} from '@angular/core'; -import {NoopAnimationsModule, BrowserAnimationsModule} from '@angular/platform-browser/animations'; +import {BrowserAnimationsModule, NoopAnimationsModule} from '@angular/platform-browser/animations'; import {By} from '@angular/platform-browser'; +import {ViewportRuler} from '@angular/cdk/overlay'; +import {dispatchFakeEvent, FakeViewportRuler} from '@angular/cdk/testing'; import {Observable} from 'rxjs/Observable'; -import {MdTab} from './tab'; -import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; -import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler'; -import {dispatchFakeEvent} from '@angular/cdk/testing'; +import {MdTab, MdTabGroup, MdTabHeaderPosition, MdTabsModule} from './index'; describe('MdTabGroup', () => { diff --git a/src/lib/tabs/tab-group.ts b/src/lib/tabs/tab-group.ts index 4230db2954e8..89521bca7308 100644 --- a/src/lib/tabs/tab-group.ts +++ b/src/lib/tabs/tab-group.ts @@ -23,11 +23,11 @@ import { AfterContentChecked, OnDestroy, } from '@angular/core'; -import {coerceBooleanProperty} from '../core'; +import {coerceBooleanProperty} from '@angular/cdk/coercion'; +import {map} from '@angular/cdk/rxjs'; import {Observable} from 'rxjs/Observable'; import {Subscription} from 'rxjs/Subscription'; import {MdTab} from './tab'; -import {map} from '../core/rxjs/index'; import {merge} from 'rxjs/observable/merge'; import {CanDisableRipple, mixinDisableRipple} from '../core/common-behaviors/disable-ripple'; import {CanColor, mixinColor, ThemePalette} from '../core/common-behaviors/color'; diff --git a/src/lib/tabs/tab-header.spec.ts b/src/lib/tabs/tab-header.spec.ts index 1a7df4c13806..50a37a59ff17 100644 --- a/src/lib/tabs/tab-header.spec.ts +++ b/src/lib/tabs/tab-header.spec.ts @@ -2,19 +2,19 @@ import { async, ComponentFixture, TestBed, fakeAsync, tick, discardPeriodicTasks } from '@angular/core/testing'; import {Component, ViewChild, ViewContainerRef} from '@angular/core'; -import {Direction, Directionality} from '../core/bidi/index'; +import {CommonModule} from '@angular/common'; +import {By} from '@angular/platform-browser'; +import {ENTER, LEFT_ARROW, RIGHT_ARROW} from '@angular/cdk/keycodes'; +import {PortalModule} from '@angular/cdk/portal'; +import {ViewportRuler} from '@angular/cdk/overlay'; +import {Direction, Directionality} from '@angular/cdk/bidi'; +import {dispatchFakeEvent, dispatchKeyboardEvent, FakeViewportRuler} from '@angular/cdk/testing'; import {MdTabHeader} from './tab-header'; import {MdRippleModule} from '../core/ripple/index'; -import {CommonModule} from '@angular/common'; -import {PortalModule} from '../core'; import {MdInkBar} from './ink-bar'; import {MdTabLabelWrapper} from './tab-label-wrapper'; -import {RIGHT_ARROW, LEFT_ARROW, ENTER} from '../core/keyboard/keycodes'; -import {FakeViewportRuler} from '../core/overlay/position/fake-viewport-ruler'; -import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; -import {dispatchFakeEvent, dispatchKeyboardEvent} from '@angular/cdk/testing'; import {Subject} from 'rxjs/Subject'; -import {By} from '@angular/platform-browser'; + describe('MdTabHeader', () => { diff --git a/src/lib/tabs/tab-header.ts b/src/lib/tabs/tab-header.ts index 711fa429f49c..64106c46c48c 100644 --- a/src/lib/tabs/tab-header.ts +++ b/src/lib/tabs/tab-header.ts @@ -25,20 +25,15 @@ import { ChangeDetectionStrategy, ChangeDetectorRef } from '@angular/core'; -import { - RIGHT_ARROW, - LEFT_ARROW, - ENTER, - Directionality, - Direction, -} from '../core'; -import {MdTabLabelWrapper} from './tab-label-wrapper'; -import {MdInkBar} from './ink-bar'; +import {Directionality, Direction} from '@angular/cdk/bidi'; +import {RIGHT_ARROW, LEFT_ARROW, ENTER} from '@angular/cdk/keycodes'; +import {auditTime, startWith} from '@angular/cdk/rxjs'; import {Subscription} from 'rxjs/Subscription'; -import {auditTime, startWith} from '../core/rxjs/index'; import {of as observableOf} from 'rxjs/observable/of'; import {merge} from 'rxjs/observable/merge'; import {fromEvent} from 'rxjs/observable/fromEvent'; +import {MdTabLabelWrapper} from './tab-label-wrapper'; +import {MdInkBar} from './ink-bar'; import {CanDisableRipple, mixinDisableRipple} from '../core/common-behaviors/disable-ripple'; import {RxChain, debounceTime} from '@angular/cdk/rxjs'; import {Platform} from '@angular/cdk/platform'; diff --git a/src/lib/tabs/tab-label.ts b/src/lib/tabs/tab-label.ts index a27ea8bee3b4..216feff44efb 100644 --- a/src/lib/tabs/tab-label.ts +++ b/src/lib/tabs/tab-label.ts @@ -7,7 +7,7 @@ */ import {Directive, TemplateRef, ViewContainerRef} from '@angular/core'; -import {TemplatePortalDirective} from '../core'; +import {TemplatePortalDirective} from '@angular/cdk/portal'; /** Workaround for https://github.com/angular/angular/issues/17849 */ export const _MdTabLabelBaseClass = TemplatePortalDirective; diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts index 7b6abc8abbb3..7bca77c309e6 100644 --- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts +++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.spec.ts @@ -1,13 +1,11 @@ import {async, ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing'; -import {MdTabsModule} from '../index'; -import {MdTabNav, MdTabLink} from './tab-nav-bar'; import {Component, ViewChild} from '@angular/core'; import {By} from '@angular/platform-browser'; -import {ViewportRuler} from '../../core/overlay/position/viewport-ruler'; -import {FakeViewportRuler} from '../../core/overlay/position/fake-viewport-ruler'; -import {dispatchFakeEvent, dispatchMouseEvent} from '@angular/cdk/testing'; -import {Direction, Directionality} from '../../core/bidi/index'; +import {ViewportRuler} from '@angular/cdk/overlay'; +import {dispatchFakeEvent, dispatchMouseEvent, FakeViewportRuler} from '@angular/cdk/testing'; +import {Direction, Directionality} from '@angular/cdk/bidi'; import {Subject} from 'rxjs/Subject'; +import {MdTabNav, MdTabsModule, MdTabLink} from '../index'; describe('MdTabNavBar', () => { diff --git a/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts b/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts index d468f1457024..8df00aaf7f7b 100644 --- a/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts +++ b/src/lib/tabs/tab-nav-bar/tab-nav-bar.ts @@ -8,6 +8,8 @@ import { AfterContentInit, + ChangeDetectionStrategy, + ChangeDetectorRef, Component, Directive, ElementRef, @@ -19,26 +21,26 @@ import { Renderer2, ViewChild, ViewEncapsulation, - ChangeDetectionStrategy, - ChangeDetectorRef, ContentChildren, QueryList, forwardRef, } from '@angular/core'; -import {MdInkBar} from '../ink-bar'; -import {CanDisable, mixinDisabled} from '../../core/common-behaviors/disabled'; -import {MdRipple} from '../../core'; -import {ViewportRuler} from '../../core/overlay/position/viewport-ruler'; -import {Directionality, MD_RIPPLE_GLOBAL_OPTIONS, Platform, RippleGlobalOptions} from '../../core'; -import {CanColor, mixinColor, ThemePalette} from '../../core/common-behaviors/color'; +import {ViewportRuler} from '@angular/cdk/overlay'; +import {Directionality} from '@angular/cdk/bidi'; +import {Platform} from '@angular/cdk/platform'; +import {auditTime, takeUntil} from '@angular/cdk/rxjs'; import {Subject} from 'rxjs/Subject'; import {Subscription} from 'rxjs/Subscription'; -import {takeUntil, auditTime} from '../../core/rxjs/index'; import {of as observableOf} from 'rxjs/observable/of'; import {merge} from 'rxjs/observable/merge'; import {fromEvent} from 'rxjs/observable/fromEvent'; import {CanDisableRipple, mixinDisableRipple} from '../../core/common-behaviors/disable-ripple'; import {coerceBooleanProperty} from '@angular/cdk/coercion'; +import {CanDisable, mixinDisabled} from '../../core/common-behaviors/disabled'; +import {MD_RIPPLE_GLOBAL_OPTIONS, MdRipple, RippleGlobalOptions} from '../../core'; +import {CanColor, mixinColor, ThemePalette} from '../../core/common-behaviors/color'; +import {MdInkBar} from '../ink-bar'; + // Boilerplate for applying mixins to MdTabNav. /** @docs-private */ diff --git a/src/lib/tooltip/index.ts b/src/lib/tooltip/index.ts index 9b6095568de8..1fa88320c3e2 100644 --- a/src/lib/tooltip/index.ts +++ b/src/lib/tooltip/index.ts @@ -8,8 +8,9 @@ import {NgModule} from '@angular/core'; import {CommonModule} from '@angular/common'; -import {OverlayModule, MdCommonModule} from '../core'; -import {PlatformModule} from '../core/platform/index'; +import {OverlayModule} from '@angular/cdk/overlay'; +import {PlatformModule} from '@angular/cdk/platform'; +import {MdCommonModule} from '../core'; import {MdTooltip, TooltipComponent, MD_TOOLTIP_SCROLL_STRATEGY_PROVIDER} from './tooltip'; diff --git a/src/lib/tooltip/tooltip.spec.ts b/src/lib/tooltip/tooltip.spec.ts index 1834f0ccd5be..cb451e3807e6 100644 --- a/src/lib/tooltip/tooltip.spec.ts +++ b/src/lib/tooltip/tooltip.spec.ts @@ -1,31 +1,27 @@ import { async, ComponentFixture, - TestBed, - tick, fakeAsync, - flushMicrotasks + flushMicrotasks, + TestBed, + tick } from '@angular/core/testing'; +import {ChangeDetectionStrategy, Component, DebugElement, ViewChild} from '@angular/core'; +import {AnimationEvent} from '@angular/animations'; +import {By} from '@angular/platform-browser'; +import {NoopAnimationsModule} from '@angular/platform-browser/animations'; +import {Direction, Directionality} from '@angular/cdk/bidi'; +import {OverlayContainer, OverlayModule, Scrollable} from '@angular/cdk/overlay'; +import {Platform} from '@angular/cdk/platform'; +import {dispatchFakeEvent} from '@angular/cdk/testing'; import { - Component, - DebugElement, - ViewChild, - ChangeDetectionStrategy -} from '@angular/core'; -import { - TooltipPosition, MdTooltip, MdTooltipModule, SCROLL_THROTTLE_MS, - TOOLTIP_PANEL_CLASS + TOOLTIP_PANEL_CLASS, + TooltipPosition } from './index'; -import {AnimationEvent} from '@angular/animations'; -import {By} from '@angular/platform-browser'; -import {NoopAnimationsModule} from '@angular/platform-browser/animations'; -import {Directionality, Direction} from '../core/bidi/index'; -import {OverlayModule, Scrollable, OverlayContainer} from '../core/overlay/index'; -import {Platform} from '../core/platform/platform'; -import {dispatchFakeEvent} from '@angular/cdk/testing'; + const initialTooltipMessage = 'initial tooltip message'; diff --git a/src/lib/tooltip/tooltip.ts b/src/lib/tooltip/tooltip.ts index 85d5383701fc..6a9aa095f4ba 100644 --- a/src/lib/tooltip/tooltip.ts +++ b/src/lib/tooltip/tooltip.ts @@ -7,50 +7,44 @@ */ import { + ChangeDetectionStrategy, + ChangeDetectorRef, Component, Directive, - Input, ElementRef, - ViewContainerRef, + Inject, + InjectionToken, + Input, NgZone, - Optional, OnDestroy, + Optional, Renderer2, - ChangeDetectorRef, - ChangeDetectionStrategy, + ViewContainerRef, ViewEncapsulation, - InjectionToken, - Inject, } from '@angular/core'; +import {animate, AnimationEvent, state, style, transition, trigger} from '@angular/animations'; +import {ComponentPortal} from '@angular/cdk/portal'; +import {Observable} from 'rxjs/Observable'; +import {Subject} from 'rxjs/Subject'; +import {Directionality} from '@angular/cdk/bidi'; +import {Platform} from '@angular/cdk/platform'; +import {first} from '@angular/cdk/rxjs'; import { - style, - trigger, - state, - transition, - animate, - AnimationEvent, -} from '@angular/animations'; -import { + OriginConnectionPosition, Overlay, - OverlayState, - OverlayRef, - ComponentPortal, OverlayConnectionPosition, - OriginConnectionPosition, + OverlayRef, + OverlayState, RepositionScrollStrategy, + ScrollDispatcher, // This import is only used to define a generic type. The current TypeScript version incorrectly // considers such imports as unused (https://github.com/Microsoft/TypeScript/issues/14953) // tslint:disable-next-line:no-unused-variable ScrollStrategy, -} from '../core'; -import {Observable} from 'rxjs/Observable'; -import {Subject} from 'rxjs/Subject'; -import {Directionality} from '../core/bidi/index'; -import {Platform} from '../core/platform/index'; -import {first} from '../core/rxjs/index'; -import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher'; +} from '@angular/cdk/overlay'; import {coerceBooleanProperty} from '@angular/cdk/coercion'; + export type TooltipPosition = 'left' | 'right' | 'above' | 'below' | 'before' | 'after'; /** Time in ms to delay before changing the tooltip visibility to hidden */ @@ -72,7 +66,8 @@ export const MD_TOOLTIP_SCROLL_STRATEGY = new InjectionToken<() => ScrollStrategy>('md-tooltip-scroll-strategy'); /** @docs-private */ -export function MD_TOOLTIP_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay) { +export function MD_TOOLTIP_SCROLL_STRATEGY_PROVIDER_FACTORY(overlay: Overlay): + () => RepositionScrollStrategy { return () => overlay.scrollStrategies.reposition({ scrollThrottle: SCROLL_THROTTLE_MS }); } diff --git a/test/karma-test-shim.js b/test/karma-test-shim.js index 5ef9cdc4ac91..fadbd1397e7d 100644 --- a/test/karma-test-shim.js +++ b/test/karma-test-shim.js @@ -54,6 +54,7 @@ System.config({ '@angular/cdk/coercion': 'dist/packages/cdk/coercion/index.js', '@angular/cdk/keycodes': 'dist/packages/cdk/keycodes/index.js', '@angular/cdk/observers': 'dist/packages/cdk/observers/index.js', + '@angular/cdk/overlay': 'dist/packages/cdk/overlay/index.js', '@angular/cdk/platform': 'dist/packages/cdk/platform/index.js', '@angular/cdk/portal': 'dist/packages/cdk/portal/index.js', '@angular/cdk/rxjs': 'dist/packages/cdk/rxjs/index.js', diff --git a/tools/package-tools/secondary-entry-points.ts b/tools/package-tools/secondary-entry-points.ts index 46207b924ba7..54989974ae28 100644 --- a/tools/package-tools/secondary-entry-points.ts +++ b/tools/package-tools/secondary-entry-points.ts @@ -47,8 +47,9 @@ export function getSecondaryEntryPointsForPackage(pkg: BuildPackage) { .stdout .toString() .split('\n') - .filter(String) + .filter(n => n) .map(importStatement => importStatement.match(importRegex)![1]) + .filter(n => nodeLookup.has(n)) .map(depName => nodeLookup.get(depName)!) || []; });