diff --git a/.travis.yml b/.travis.yml index 8866678cc2f7..cfcdb600fa94 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,6 +36,7 @@ env: matrix: # Order: a slower build first, so that we don't occupy an idle travis worker waiting for others to complete. - MODE=lint + - MODE=circular_deps - MODE=e2e - MODE=saucelabs_required - MODE=browserstack_required diff --git a/package.json b/package.json index 68ab2172d247..fc1fc6bd33cd 100644 --- a/package.json +++ b/package.json @@ -8,12 +8,13 @@ "url": "https://github.com/angular/material2.git" }, "scripts": { - "ci:forbidden-identifiers": "node ./scripts/ci/forbidden-identifiers.js", + "ci:forbidden-identifiers": "node ./scripts/ci/forbidden-identifiers.js", "build": "ng build", "demo-app": "ng serve", "test": "karma start test/karma.conf.js", "tslint": "tslint -c tslint.json 'src/**/*.ts'", "stylelint": "stylelint 'src/**/*.scss' --config stylelint-config.json --syntax scss", + "check-circular-deps": "madge --circular ./dist", "typings": "typings install --ambient", "postinstall": "npm run typings", "e2e": "protractor", @@ -60,13 +61,14 @@ "karma-firefox-launcher": "^0.1.7", "karma-jasmine": "^0.3.8", "karma-sauce-launcher": "^0.2.14", + "madge": "^0.5.3", "node-sass": "^3.4.2", "protractor": "^3.3.0", "protractor-accessibility-plugin": "0.1.1", "sass": "^0.5.0", "strip-ansi": "^3.0.0", - "symlink-or-copy": "^1.0.1", "stylelint": "^6.5.1", + "symlink-or-copy": "^1.0.1", "ts-node": "^0.7.3", "tslint": "^3.5.0", "typescript": "^1.9.0-dev", diff --git a/scripts/ci/build-and-test.sh b/scripts/ci/build-and-test.sh index a39be3384f61..c5d2a8574cf8 100755 --- a/scripts/ci/build-and-test.sh +++ b/scripts/ci/build-and-test.sh @@ -18,7 +18,9 @@ wait_for_tunnel if is_lint; then npm run tslint npm run ci:forbidden-identifiers - npm run stylelint + npm run stylelint +elif is_circular_deps_check; then + npm run check-circular-deps elif is_e2e; then MD_APP=e2e ng serve & sleep 20 diff --git a/scripts/ci/sources/mode.sh b/scripts/ci/sources/mode.sh index ea3b231d0e4c..ce2dd1c5c3ec 100644 --- a/scripts/ci/sources/mode.sh +++ b/scripts/ci/sources/mode.sh @@ -8,3 +8,7 @@ is_e2e() { is_lint() { [[ "$MODE" = lint ]] } + +is_circular_deps_check() { + [[ "$MODE" = circular_deps ]] +} diff --git a/src/components/grid-list/grid-list-measure.ts b/src/components/grid-list/grid-list-measure.ts new file mode 100644 index 000000000000..7dbd8e145777 --- /dev/null +++ b/src/components/grid-list/grid-list-measure.ts @@ -0,0 +1,16 @@ + +/** + * Converts values into strings. Falsy values become empty strings. + * @internal + */ +export function coerceToString(value: string | number): string { + return `${value || ''}`; +} + +/** + * Converts a value that might be a string into a number. + * @internal + */ +export function coerceToNumber(value: string | number): number { + return typeof value === 'string' ? parseInt(value, 10) : value; +} diff --git a/src/components/grid-list/grid-list.ts b/src/components/grid-list/grid-list.ts index e1b7c65804a8..cf54b00f8e68 100644 --- a/src/components/grid-list/grid-list.ts +++ b/src/components/grid-list/grid-list.ts @@ -21,6 +21,7 @@ import { import {MdGridListColsError} from './grid-list-errors'; import {Dir} from '@angular2-material/core/rtl/dir'; import {MdLine} from '@angular2-material/core/line/line'; +import {coerceToString, coerceToNumber} from './grid-list-measure'; // TODO(kara): Conditional (responsive) column count / row size. // TODO(kara): Re-layout on window resize / media change (debounced). @@ -152,20 +153,5 @@ export class MdGridList implements OnInit, AfterContentChecked { } } -/** - * Converts values into strings. Falsy values become empty strings. - * @internal - */ -export function coerceToString(value: string | number): string { - return `${value || ''}`; -} - -/** - * Converts a value that might be a string into a number. - * @internal - */ -export function coerceToNumber(value: string | number): number { - return typeof value === 'string' ? parseInt(value, 10) : value; -} export const MD_GRID_LIST_DIRECTIVES: any[] = [MdGridList, MdGridTile, MdLine, MdGridTileText]; diff --git a/src/components/grid-list/grid-tile.ts b/src/components/grid-list/grid-tile.ts index a709d85f8b40..194671f341cb 100644 --- a/src/components/grid-list/grid-tile.ts +++ b/src/components/grid-list/grid-tile.ts @@ -8,8 +8,8 @@ import { QueryList, AfterContentInit } from '@angular/core'; -import { coerceToNumber } from './grid-list'; import { MdLine, MdLineSetter } from '@angular2-material/core/line/line'; +import {coerceToNumber} from './grid-list-measure'; @Component({ moduleId: module.id, diff --git a/src/core/live-announcer/README.md b/src/core/a11y/README.md similarity index 100% rename from src/core/live-announcer/README.md rename to src/core/a11y/README.md diff --git a/src/core/live-announcer/live-announcer.scss b/src/core/a11y/live-announcer.scss similarity index 100% rename from src/core/live-announcer/live-announcer.scss rename to src/core/a11y/live-announcer.scss diff --git a/src/core/live-announcer/live-announcer.spec.ts b/src/core/a11y/live-announcer.spec.ts similarity index 100% rename from src/core/live-announcer/live-announcer.spec.ts rename to src/core/a11y/live-announcer.spec.ts diff --git a/src/core/live-announcer/live-announcer.ts b/src/core/a11y/live-announcer.ts similarity index 100% rename from src/core/live-announcer/live-announcer.ts rename to src/core/a11y/live-announcer.ts diff --git a/src/core/core.ts b/src/core/core.ts index e73e6cf50343..c86c7284e3a2 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -1,11 +1,37 @@ // RTL -export * from './rtl/dir'; +export {Dir, LayoutDirection} from './rtl/dir'; // Portals -export * from './portal/portal'; -export * from './portal/portal-directives'; +export { + Portal, + PortalHost, + BasePortalHost, + ComponentPortal, + TemplatePortal +} from './portal/portal'; +export { + PortalHostDirective, + TemplatePortalDirective, + PORTAL_DIRECTIVES +} from './portal/portal-directives'; +export {DomPortalHost} from './portal/dom-portal-host'; + +// Overlay +export {Overlay, OVERLAY_CONTAINER_TOKEN, OVERLAY_PROVIDERS} from './overlay/overlay'; +export {OverlayRef} from './overlay/overlay-ref'; +export {OverlayState} from './overlay/overlay-state'; +export { + ConnectedOverlayDirective, + OverlayOrigin, + OVERLAY_DIRECTIVES +} from './overlay/overlay-directives'; // Gestures -export * from './gestures/MdGestureConfig'; +export {MdGestureConfig} from './gestures/MdGestureConfig'; -export * from './line/line'; +// a11y +export { + AriaLivePoliteness, + MdLiveAnnouncer, + LIVE_ANNOUNCER_ELEMENT_TOKEN +} from './a11y/live-announcer'; diff --git a/src/core/overlay/overlay.ts b/src/core/overlay/overlay.ts index 380bf2ef267c..6ab20397dd88 100644 --- a/src/core/overlay/overlay.ts +++ b/src/core/overlay/overlay.ts @@ -98,9 +98,3 @@ export const OVERLAY_PROVIDERS = [ OverlayPositionBuilder, Overlay, ]; - -// Re-export overlay-related modules so they can be imported directly from here. -export {OverlayState} from './overlay-state'; -export {OverlayRef} from './overlay-ref'; -export {createOverlayContainer} from './overlay-container'; -export {OVERLAY_DIRECTIVES, ConnectedOverlayDirective, OverlayOrigin} from './overlay-directives'; diff --git a/src/core/portal/portal.ts b/src/core/portal/portal.ts index 9a8306315713..0936d5ee3d91 100644 --- a/src/core/portal/portal.ts +++ b/src/core/portal/portal.ts @@ -203,7 +203,3 @@ export abstract class BasePortalHost implements PortalHost { this._disposeFn = fn; } } - - -export {PORTAL_DIRECTIVES, TemplatePortalDirective, PortalHostDirective} from './portal-directives'; -export {DomPortalHost} from './dom-portal-host'; diff --git a/src/demo-app/live-announcer/live-announcer-demo.ts b/src/demo-app/live-announcer/live-announcer-demo.ts index 8fda54a3dacc..ea9aab8c75c2 100644 --- a/src/demo-app/live-announcer/live-announcer-demo.ts +++ b/src/demo-app/live-announcer/live-announcer-demo.ts @@ -1,5 +1,5 @@ import {Component} from '@angular/core'; -import {MdLiveAnnouncer} from '@angular2-material/core/live-announcer/live-announcer'; +import {MdLiveAnnouncer} from '@angular2-material/core/a11y/live-announcer'; @Component({ moduleId: module.id, diff --git a/src/demo-app/main.scss b/src/demo-app/main.scss index 7b92647788dd..3c3e40cf99b3 100644 --- a/src/demo-app/main.scss +++ b/src/demo-app/main.scss @@ -3,4 +3,4 @@ // that are consumed across multiple components (and thus shouldn't be scoped). @import "core/overlay/overlay"; -@import "core/live-announcer/live-announcer"; \ No newline at end of file +@import "core/a11y/live-announcer"; diff --git a/src/demo-app/main.ts b/src/demo-app/main.ts index 15ef934edd7f..883fc8f60ebd 100644 --- a/src/demo-app/main.ts +++ b/src/demo-app/main.ts @@ -6,7 +6,7 @@ import {provide} from '@angular/core'; import {Renderer} from '@angular/core'; import {OVERLAY_CONTAINER_TOKEN} from '@angular2-material/core/overlay/overlay'; -import {MdLiveAnnouncer} from '@angular2-material/core/live-announcer/live-announcer'; +import {MdLiveAnnouncer} from '@angular2-material/core/a11y/live-announcer'; import {createOverlayContainer} from '@angular2-material/core/overlay/overlay-container'; import {MdGestureConfig} from '@angular2-material/core/gestures/MdGestureConfig'; import {MdIconRegistry} from '@angular2-material/icon/icon-registry'; diff --git a/src/demo-app/overlay/overlay-demo.ts b/src/demo-app/overlay/overlay-demo.ts index b5fcaa8de622..ecf3bf011651 100644 --- a/src/demo-app/overlay/overlay-demo.ts +++ b/src/demo-app/overlay/overlay-demo.ts @@ -11,14 +11,12 @@ import { OverlayState, OverlayOrigin, OVERLAY_PROVIDERS, - OVERLAY_DIRECTIVES -} from '@angular2-material/core/overlay/overlay'; -import { + OVERLAY_DIRECTIVES, ComponentPortal, Portal, PORTAL_DIRECTIVES, TemplatePortalDirective -} from '@angular2-material/core/portal/portal'; +} from '@angular2-material/core/core'; @Component({ diff --git a/src/demo-app/portal/portal-demo.ts b/src/demo-app/portal/portal-demo.ts index b2bb0cd3e0b8..759c398a6e62 100644 --- a/src/demo-app/portal/portal-demo.ts +++ b/src/demo-app/portal/portal-demo.ts @@ -1,10 +1,11 @@ -import {Component} from '@angular/core'; -import {PortalHostDirective} from '@angular2-material/core/portal/portal-directives'; -import {TemplatePortalDirective} from '@angular2-material/core/portal/portal-directives'; -import {Portal} from '@angular2-material/core/portal/portal'; -import {ViewChildren} from '@angular/core'; -import {QueryList} from '@angular/core'; -import {ComponentPortal} from '@angular2-material/core/portal/portal'; +import {Component, ViewChildren, QueryList} from '@angular/core'; +import { + Portal, + ComponentPortal, + TemplatePortalDirective, + PortalHostDirective +} from '@angular2-material/core/core'; + @Component({ moduleId: module.id, diff --git a/src/e2e-app/main.scss b/src/e2e-app/main.scss index 36e9cd52c131..73b3fbb8b0e3 100644 --- a/src/e2e-app/main.scss +++ b/src/e2e-app/main.scss @@ -1,2 +1,2 @@ @import "core/overlay/overlay"; -@import "core/live-announcer/live-announcer"; \ No newline at end of file +@import "core/a11y/live-announcer"; diff --git a/src/e2e-app/main.ts b/src/e2e-app/main.ts index 1fbdcef84c86..f65e68817b3d 100644 --- a/src/e2e-app/main.ts +++ b/src/e2e-app/main.ts @@ -6,7 +6,7 @@ import {provide} from '@angular/core'; import {Renderer} from '@angular/core'; import {OVERLAY_CONTAINER_TOKEN} from '@angular2-material/core/overlay/overlay'; -import {MdLiveAnnouncer} from '@angular2-material/core/live-announcer/live-announcer'; +import {MdLiveAnnouncer} from '@angular2-material/core/a11y/live-announcer'; import {createOverlayContainer} from '@angular2-material/core/overlay/overlay-container'; import {MdGestureConfig} from '@angular2-material/core/gestures/MdGestureConfig'; import {MdIconRegistry} from '@angular2-material/icon/icon-registry';