diff --git a/src/lib/core/coercion/boolean-property.spec.ts b/src/cdk/coercion/boolean-property.spec.ts similarity index 99% rename from src/lib/core/coercion/boolean-property.spec.ts rename to src/cdk/coercion/boolean-property.spec.ts index b16c4ea75714..27bc488e34de 100644 --- a/src/lib/core/coercion/boolean-property.spec.ts +++ b/src/cdk/coercion/boolean-property.spec.ts @@ -1,7 +1,7 @@ import {coerceBooleanProperty} from './boolean-property'; - describe('coerceBooleanProperty', () => { + it('should coerce undefined to false', () => { expect(coerceBooleanProperty(undefined)).toBe(false); }); @@ -45,4 +45,5 @@ describe('coerceBooleanProperty', () => { it('should coerce an array to true', () => { expect(coerceBooleanProperty([])).toBe(true); }); + }); diff --git a/src/lib/core/coercion/boolean-property.ts b/src/cdk/coercion/boolean-property.ts similarity index 100% rename from src/lib/core/coercion/boolean-property.ts rename to src/cdk/coercion/boolean-property.ts diff --git a/src/cdk/coercion/index.ts b/src/cdk/coercion/index.ts new file mode 100644 index 000000000000..53767a7ac274 --- /dev/null +++ b/src/cdk/coercion/index.ts @@ -0,0 +1,10 @@ +/** + * @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 './boolean-property'; +export * from './number-property'; diff --git a/src/lib/core/coercion/number-property.spec.ts b/src/cdk/coercion/number-property.spec.ts similarity index 99% rename from src/lib/core/coercion/number-property.spec.ts rename to src/cdk/coercion/number-property.spec.ts index fb0edfd2e544..e8112aa46fac 100644 --- a/src/lib/core/coercion/number-property.spec.ts +++ b/src/cdk/coercion/number-property.spec.ts @@ -1,7 +1,7 @@ import {coerceNumberProperty} from './number-property'; - describe('coerceNumberProperty', () => { + it('should coerce undefined to 0 or default', () => { expect(coerceNumberProperty(undefined)).toBe(0); expect(coerceNumberProperty(undefined, 111)).toBe(111); @@ -78,4 +78,5 @@ describe('coerceNumberProperty', () => { expect(coerceNumberProperty([])).toBe(0); expect(coerceNumberProperty([], 111)).toBe(111); }); + }); diff --git a/src/lib/core/coercion/number-property.ts b/src/cdk/coercion/number-property.ts similarity index 100% rename from src/lib/core/coercion/number-property.ts rename to src/cdk/coercion/number-property.ts diff --git a/src/cdk/index.ts b/src/cdk/index.ts new file mode 100644 index 000000000000..f2136b9e2899 --- /dev/null +++ b/src/cdk/index.ts @@ -0,0 +1,14 @@ +/** + * @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 + */ + +/* + * This file is not used to build this module. The real "index.js" file will be generated by the + * Angular Compiler CLI. This file is used inside of Google and is also used to simplify the + * SystemJS configuration + */ +export * from './public_api'; diff --git a/src/cdk/public_api.ts b/src/cdk/public_api.ts index 004bb90c919f..06df0c5c82c8 100644 --- a/src/cdk/public_api.ts +++ b/src/cdk/public_api.ts @@ -6,4 +6,4 @@ * found in the LICENSE file at https://angular.io/license */ -export const __TEMP__ = -1; +export * from './coercion/index'; diff --git a/src/cdk/tsconfig-tests.json b/src/cdk/tsconfig-tests.json index 95e7f82d42ef..e02c0320f908 100644 --- a/src/cdk/tsconfig-tests.json +++ b/src/cdk/tsconfig-tests.json @@ -11,6 +11,7 @@ "experimentalDecorators": true }, "include": [ - "**/*.spec.ts" + "**/*.spec.ts", + "index.ts" ] } diff --git a/src/lib/checkbox/checkbox.ts b/src/lib/checkbox/checkbox.ts index 6d78402a9847..32552c157606 100644 --- a/src/lib/checkbox/checkbox.ts +++ b/src/lib/checkbox/checkbox.ts @@ -22,7 +22,7 @@ import { ViewEncapsulation, } from '@angular/core'; import {ControlValueAccessor, NG_VALUE_ACCESSOR} from '@angular/forms'; -import {coerceBooleanProperty} from '../core/coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; import {FocusOrigin, FocusOriginMonitor, MdRipple, RippleRef} from '../core'; import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled'; import {CanColor, mixinColor} from '../core/common-behaviors/color'; diff --git a/src/lib/chips/chip-list.ts b/src/lib/chips/chip-list.ts index 86e0897c3378..c3c1aaae4290 100644 --- a/src/lib/chips/chip-list.ts +++ b/src/lib/chips/chip-list.ts @@ -19,8 +19,8 @@ import { import {MdChip} from './chip'; import {FocusKeyManager} from '../core/a11y/focus-key-manager'; -import {coerceBooleanProperty} from '../core/coercion/boolean-property'; import {SPACE, LEFT_ARROW, RIGHT_ARROW, TAB} from '../core/keyboard/keycodes'; +import {coerceBooleanProperty} from '@angular/cdk'; import {Subscription} from 'rxjs/Subscription'; /** diff --git a/src/lib/chips/chip.ts b/src/lib/chips/chip.ts index be1533f9815f..3ab000852f3b 100644 --- a/src/lib/chips/chip.ts +++ b/src/lib/chips/chip.ts @@ -17,7 +17,7 @@ import { } from '@angular/core'; import {Focusable} from '../core/a11y/focus-key-manager'; -import {coerceBooleanProperty} from '../core/coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; import {CanColor, mixinColor} from '../core/common-behaviors/color'; import {CanDisable, mixinDisabled} from '../core/common-behaviors/disabled'; diff --git a/src/lib/core/a11y/focus-trap.ts b/src/lib/core/a11y/focus-trap.ts index b5c09adf0302..6206fb724ea7 100644 --- a/src/lib/core/a11y/focus-trap.ts +++ b/src/lib/core/a11y/focus-trap.ts @@ -17,7 +17,7 @@ import { } from '@angular/core'; import {InteractivityChecker} from './interactivity-checker'; import {Platform} from '../platform/platform'; -import {coerceBooleanProperty} from '../coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; import 'rxjs/add/operator/first'; diff --git a/src/lib/core/common-behaviors/disabled.ts b/src/lib/core/common-behaviors/disabled.ts index 95c6316dbb1e..266fcf422a85 100644 --- a/src/lib/core/common-behaviors/disabled.ts +++ b/src/lib/core/common-behaviors/disabled.ts @@ -6,7 +6,7 @@ * found in the LICENSE file at https://angular.io/license */ -import {coerceBooleanProperty} from '../coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; import {Constructor} from './constructor'; /** @docs-private */ diff --git a/src/lib/core/core.ts b/src/lib/core/core.ts index 0be7b12636bb..28035d5d6493 100644 --- a/src/lib/core/core.ts +++ b/src/lib/core/core.ts @@ -17,6 +17,8 @@ import {A11yModule} from './a11y/index'; import {MdSelectionModule} from './selection/index'; import {MdRippleModule} from './ripple/index'; +// Re-exports of the CDK to avoid breaking changes. +export {coerceBooleanProperty, coerceNumberProperty} from '@angular/cdk'; // RTL export {Dir, Direction, Directionality, BidiModule} from './bidi/index'; @@ -98,10 +100,6 @@ export * from './animation/animation'; // Selection export * from './selection/index'; -// Coercion -export {coerceBooleanProperty} from './coercion/boolean-property'; -export {coerceNumberProperty} from './coercion/number-property'; - // Compatibility export {CompatibilityModule, NoConflictStyleCompatibilityMode} from './compatibility/compatibility'; diff --git a/src/lib/core/option/option.ts b/src/lib/core/option/option.ts index b15fc6300966..4cc82b6c9b7c 100644 --- a/src/lib/core/option/option.ts +++ b/src/lib/core/option/option.ts @@ -18,7 +18,7 @@ import { Optional, } from '@angular/core'; import {ENTER, SPACE} from '../keyboard/keycodes'; -import {coerceBooleanProperty} from '../coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; import {MATERIAL_COMPATIBILITY_MODE} from '../../core/compatibility/compatibility'; import {MdOptgroup} from './optgroup'; diff --git a/src/lib/core/overlay/overlay-directives.ts b/src/lib/core/overlay/overlay-directives.ts index e42b5225f7d7..5700835186dd 100644 --- a/src/lib/core/overlay/overlay-directives.ts +++ b/src/lib/core/overlay/overlay-directives.ts @@ -32,7 +32,7 @@ import {ConnectedPositionStrategy} from './position/connected-position-strategy' import {Directionality, Direction} from '../bidi/index'; import {Scrollable} from './scroll/scrollable'; import {ScrollStrategy} from './scroll/scroll-strategy'; -import {coerceBooleanProperty} from '../coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; import {ESCAPE} from '../keyboard/keycodes'; import {Subscription} from 'rxjs/Subscription'; diff --git a/src/lib/expansion/accordion.ts b/src/lib/expansion/accordion.ts index 25cb7cc623a9..6e46135373da 100644 --- a/src/lib/expansion/accordion.ts +++ b/src/lib/expansion/accordion.ts @@ -7,7 +7,7 @@ */ import {Directive, Input} from '@angular/core'; -import {coerceBooleanProperty} from '../core/coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; /** MdAccordion's display modes. */ export type MdAccordionDisplayMode = 'default' | 'flat'; diff --git a/src/lib/package.json b/src/lib/package.json index 8dc98c84ba44..b6ea8b0c0f18 100644 --- a/src/lib/package.json +++ b/src/lib/package.json @@ -22,6 +22,7 @@ }, "homepage": "https://github.com/angular/material2#readme", "peerDependencies": { + "@angular/cdk": "0.0.0-PLACEHOLDER", "@angular/core": "^4.0.0", "@angular/common": "^4.0.0" }, diff --git a/src/lib/radio/radio.ts b/src/lib/radio/radio.ts index 27804ad684fb..6fc9d2b8d0f1 100644 --- a/src/lib/radio/radio.ts +++ b/src/lib/radio/radio.ts @@ -35,7 +35,7 @@ import { FocusOriginMonitor, FocusOrigin, } from '../core'; -import {coerceBooleanProperty} from '../core/coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled'; import {CanColor, mixinColor} from '../core/common-behaviors/color'; diff --git a/src/lib/select/select.ts b/src/lib/select/select.ts index 2f69af06fa45..e00d54ef1827 100644 --- a/src/lib/select/select.ts +++ b/src/lib/select/select.ts @@ -34,7 +34,7 @@ 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 '../core/coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; import {ConnectedOverlayDirective} from '../core/overlay/overlay-directives'; import {ViewportRuler} from '../core/overlay/position/viewport-ruler'; import {SelectionModel} from '../core/selection/selection'; diff --git a/src/lib/tooltip/tooltip.ts b/src/lib/tooltip/tooltip.ts index b65b4dae64a3..281a6260bc7e 100644 --- a/src/lib/tooltip/tooltip.ts +++ b/src/lib/tooltip/tooltip.ts @@ -41,7 +41,7 @@ import {Directionality} from '../core/bidi/index'; import {Platform} from '../core/platform/index'; import 'rxjs/add/operator/first'; import {ScrollDispatcher} from '../core/overlay/scroll/scroll-dispatcher'; -import {coerceBooleanProperty} from '../core/coercion/boolean-property'; +import {coerceBooleanProperty} from '@angular/cdk'; export type TooltipPosition = 'left' | 'right' | 'above' | 'below' | 'before' | 'after'; diff --git a/src/lib/tsconfig-tests.json b/src/lib/tsconfig-tests.json index afb1fe3be0fd..92eb3d94d4fb 100644 --- a/src/lib/tsconfig-tests.json +++ b/src/lib/tsconfig-tests.json @@ -12,6 +12,7 @@ "strictNullChecks": true }, "include": [ - "**/*.spec.ts" + "**/*.spec.ts", + "index.ts" ] } diff --git a/test/karma-test-shim.js b/test/karma-test-shim.js index ba7c95093921..a93a6de91af4 100644 --- a/test/karma-test-shim.js +++ b/test/karma-test-shim.js @@ -46,7 +46,8 @@ System.config({ 'node:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic-testing.umd.js', // Path mappings for local packages that can be imported inside of tests. - '@angular/material': 'dist/packages/material/index.js', + // TODO(devversion): replace once the index.ts file for the Material package has been added. + '@angular/material': 'dist/packages/material/public_api.js', '@angular/cdk': 'dist/packages/cdk/index.js', }, packages: {