Skip to content

Commit

Permalink
upgraded angular & material modules to latest (#90)
Browse files Browse the repository at this point in the history
* upgraded angular & material modules to latest

* router updated to latest

* breaking change to include only @angular/material package in package.json

* changed @angular2-material/* to @angular/material

* fixed rollup.js file

* added require-dir, merge2 and upgraded gulp-typescript

* fixed rollup build for platform deployment using ts2.0, material new package and webpack changes

* added example for snackbar

* update(app scss): remove color overrides

* update(theme): main & example themes

* update(themes): docs for new themes

* update(theme): docs text padding

* update(material-components): grid-list headers & footers

* abstracted scss from app.component.scss and moved to styles.scss (global file)

* added dialog examples

* update(styles): comments & moved divider to app.component.scss

* update(app scss): Shadow DOM divider styles
  • Loading branch information
richavyas authored and emoralesb05 committed Oct 3, 2016
1 parent 0a272b0 commit 790278d
Show file tree
Hide file tree
Showing 22 changed files with 416 additions and 410 deletions.
6 changes: 3 additions & 3 deletions angular-cli.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
"prefix": "app",
"mobile": false,
"styles": [
"styles.css",
"styles.scss",
"theme.scss",
"platform/core/styles/platform.scss",
"../node_modules/@angular2-material/core/style/core.css",
"../node_modules/@angular2-material/core/overlay/overlay.css"
"../node_modules/@angular/material/core/overlay/overlay.css"
],
"scripts": [
"../node_modules/hammerjs/hammer.min.js",
Expand Down
9 changes: 7 additions & 2 deletions build.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ module.exports = {
tsfiles: [
'src/typings.d.ts',
'!src/main.ts',
'!src/system-config.ts',
'!src/polyfills.ts',
'!src/test.ts',
'src/**/**.ts',
'!src/**/**/**spec.ts',
'!src/app/**/**.ts'
'!src/app/**/**.ts',
'!src/environments/**/**.ts'
],
styles: [
'!src/theme.scss',
'!src/styles.css',
'src/**/**.scss',
'!src/app/**/**.scss',
'src/**/**.css',
Expand All @@ -27,6 +31,7 @@ module.exports = {
'src/**/MaterialIcons-Regular.ttf',
'src/**/MaterialIcons-Regular.woff',
'src/**/MaterialIcons-Regular.woff2',
'!src/theme.scss',
'src/**/**.scss',
'!src/app/**/**.scss',
'src/**/**.html',
Expand Down
24 changes: 4 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,25 +57,7 @@
"@angular/platform-browser-dynamic": "^2.0.0",
"@angular/platform-server": "^2.0.0",
"@angular/router": "^3.0.0",
"@angular2-material/button": "^2.0.0-alpha.8-2",
"@angular2-material/button-toggle": "^2.0.0-alpha.8-2",
"@angular2-material/card": "^2.0.0-alpha.8-2",
"@angular2-material/checkbox": "^2.0.0-alpha.8-2",
"@angular2-material/core": "^2.0.0-alpha.8-2",
"@angular2-material/grid-list": "^2.0.0-alpha.8-2",
"@angular2-material/icon": "^2.0.0-alpha.8-2",
"@angular2-material/input": "^2.0.0-alpha.8-2",
"@angular2-material/list": "^2.0.0-alpha.8-2",
"@angular2-material/menu": "^2.0.0-alpha.8-2",
"@angular2-material/progress-bar": "^2.0.0-alpha.8-2",
"@angular2-material/progress-circle": "^2.0.0-alpha.8-2",
"@angular2-material/radio": "^2.0.0-alpha.8-2",
"@angular2-material/sidenav": "^2.0.0-alpha.8-2",
"@angular2-material/slide-toggle": "^2.0.0-alpha.8-2",
"@angular2-material/slider": "^2.0.0-alpha.8-2",
"@angular2-material/tabs": "^2.0.0-alpha.8-2",
"@angular2-material/toolbar": "^2.0.0-alpha.8-2",
"@angular2-material/tooltip": "^2.0.0-alpha.8-2",
"@angular/material": "2.0.0-alpha.9-3",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"highlight.js": "9.6.0",
Expand All @@ -100,7 +82,7 @@
"gulp-if": "2.0.1",
"gulp-sass": "2.3.2",
"gulp-sourcemaps": "1.6.0",
"gulp-typescript": "2.13.6",
"gulp-typescript": "3.0.1",
"gulp-util": "3.0.7",
"jasmine-core": "^2.4.1",
"jasmine-spec-reporter": "2.5.0",
Expand All @@ -111,9 +93,11 @@
"karma-remap-istanbul": "^0.2.1",
"karma-firefox-launcher": "^1.0.0",
"karma-phantomjs-launcher": "1.0.1",
"merge2": "1.0.2",
"node-sass": "3.8.0",
"phantomjs-prebuilt": "2.1.7",
"protractor": "4.0.7",
"require-dir": "0.3.0",
"rollup": "^0.35.9",
"rollup-plugin-commonjs": "4.1.0",
"rollup-plugin-node-resolve": "2.0.0",
Expand Down
14 changes: 11 additions & 3 deletions scripts/compile-ts.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,27 @@ var tsProject = ts.createProject({
declaration: true,
emitDecoratorMetadata: true,
experimentalDecorators: true,
module: "commonjs",
mapRoot: "./",
lib: ["es6", "dom"],
module: "es6",
moduleResolution: "node",
noEmitOnError: true,
noImplicitAny: false,
target: "ES5",
typescript: require('typescript')
typescript: require('typescript'),
typeRoots: [
"../node_modules/@types"
],
types: [
"hammerjs"
]
});

gulp.task('compile-ts', 'Build the UDA scripts', function() {
var tsResult = gulp
.src(config.paths.tsfiles)
.pipe(sourcemaps.init())
.pipe(ts(tsProject));
.pipe(tsProject());

return merge(tsResult.dts
.pipe(gulp.dest('deploy/')),
Expand Down
1 change: 1 addition & 0 deletions scripts/inline-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ function inlineStyle(filePath, content) {
const urls = eval(styleUrls);
return 'styles: ['
+ urls.map(styleUrl => {
styleUrl = styleUrl.replace('scss', 'css'); //look for built css instead of scss
const styleFile = path.join(path.dirname(filePath), styleUrl);
const styleContent = fs.readFileSync(styleFile, 'utf-8');
const shortenedStyle = styleContent
Expand Down
28 changes: 2 additions & 26 deletions scripts/rollup.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,7 @@ gulp.task('rollup-code', '', function() {
'@angular/router': 'ng.router',
'@angular/platform-browser': 'ng.platformBrowser',
'@angular/platform-browser-dynamic': 'ng.platformBrowserDynamic',

// Angular dependencies

'@angular2-material/button': 'md.button',
'@angular2-material/button-toggle': 'md.buttonToggle',
'@angular2-material/card': 'md.card',
'@angular2-material/checkbox': 'md.checkbox',
'@angular2-material/core': 'md.core',
'@angular2-material/grid-list': 'md.gridList',
'@angular2-material/icon': 'md.icon',
'@angular2-material/input': 'md.input',
'@angular2-material/list': 'md.list',
'@angular2-material/menu': 'md.menu',
'@angular2-material/progress-bar': 'md.progressBar',
'@angular2-material/progress-circle': 'md.progressCircle',
'@angular2-material/radio': 'md.radio',
'@angular2-material/sidenav': 'md.sidenav',
'@angular2-material/slider': 'md.slider',
'@angular2-material/slide-toggle': 'md.slideToggle',
'@angular2-material/tabs': 'md.tabs',
'@angular2-material/toolbar': 'md.toolbar',
'@angular2-material/tooltip': 'md.tooltip',
'@angular/material': 'ng.material',

// Rxjs dependencies
'rxjs/Subject': 'Rx',
Expand All @@ -74,10 +53,7 @@ gulp.task('rollup-code', '', function() {
return rollup({
entry: path.join(config.paths.deployed, name, 'index.js'),
context: 'window',
external: Object.keys(globals).concat(components.map(name => `@covalent/${name}`)),
plugins: [
commonjs({ jsnext: true, main: true }),
]
external: Object.keys(globals).concat(components.map(name => `@covalent/${name}`))
});
})
.then((bundle) => {
Expand Down
172 changes: 5 additions & 167 deletions src/app/app.component.scss
Original file line number Diff line number Diff line change
@@ -1,172 +1,10 @@
/* Variables */
$md-primary: #F57C00;
$md-primary-opacity: rgba(245, 124, 0, 0.12);
$md-accent: #0288D1;
$md-accent-opacity: rgba(2, 136, 209, 0.12);
$md-warn: #C62828;
// Applies Shadow DOM styles to the root app component

/* :host /deep/ lets shadowdom style child elements */
// :host /deep/ lets you travel down the Shadow DOM tree to change web component styles
:host /deep/ {
md-toolbar,
[md-raised-button],
[md-fab],
[md-mini-fab] {
&.md-primary {
background-color: $md-primary;
}
&.md-accent {
background-color: $md-accent;
}
}
[md-fab],
[md-mini-fab],
.md-radio-checked .md-radio-inner-circle,
.md-checkbox-checked .md-checkbox-background {
background-color: $md-accent;
}
.md-radio-checked {
.md-radio-outer-circle {
border-color: $md-accent;
}
}
[md-button],
[md-icon-button] {
&.md-primary {
color: $md-primary;
}
&.md-accent {
color: $md-accent;
}
}
[md-button]:hover {
&.md-primary::after {
background-color: $md-primary-opacity;
}
&.md-accent::after{
background-color: $md-accent-opacity;
}
}
.md-radio-focused,
.md-checkbox-focused {
.md-ink-ripple {
background-color: $md-accent-opacity;
}
}
.md-input-placeholder.md-focused {
color: $md-primary !important;
}
.md-progress-bar-fill::after {
background-color: $md-primary !important;
}
.md-input-underline .md-input-ripple {
background-color: $md-primary !important;
&.md-accent {
background-color: $md-accent !important;
}
&.md-warn {
background-color: $md-warn !important;
}
}
.md-progress-bar-buffer {
background-color: lighten($md-primary, 40%) !important;
}
md-progress-bar[color='accent'] {
.md-progress-bar-fill::after,
.md-input-underline .md-input-ripple {
background-color: $md-accent !important;
}
.md-progress-bar-buffer {
background-color: lighten($md-accent, 40%) !important;
}
}
md-progress-bar[color='warn'] {
.md-progress-bar-fill::after,
.md-input-underline .md-input-ripple {
background-color: $md-warn !important;
}
.md-progress-bar-buffer {
background-color: lighten($md-warn, 40%) !important;
}
}
md-progress-circle,
md-spinner {
path {
stroke: $md-primary !important;
}
&[color='accent'] {
path {
stroke: $md-accent !important;
}
}
&[color='warn'] {
path {
stroke: $md-warn !important;
}
}
}
md-ink-bar {
background-color: $md-primary !important;
}
.md-tab-label:focus {
background-color: $md-primary-opacity !important;
}
md-slide-toggle {
&.md-checked {
.md-slide-toggle-thumb {
background-color: $md-accent !important;
}
.md-slide-toggle-bar {
background-color: $md-accent-opacity !important;
}
}
&.md-slide-toggle-focused {
.md-ink-ripple {
background-color: $md-accent-opacity !important;
}
}
}
.md-slider-thumb::after {
background-color: $md-accent;
border-color: $md-accent;
}
.md-slider-track-fill {
background-color: $md-accent;
}
md-nav-list {
[md-list-item].active {
md-icon[md-list-avatar] {
background-color: $md-accent;
color: white;
}
md-icon[md-list-icon] {
color: $md-accent;
}
}
}
a[md-icon-button] {
line-height: 36px;
}
.md-tab-label {
flex-grow: 1;
}
/* md-hint styles were missing from material2 */
md-hint {
position: absolute;
font-size: 75%;
bottom: -0.5em;

&.md-right {
right: 0;
}

[dir='rtl'] & {
right: 0;
left: auto;

&.md-right {
right: auto;
left: 0;
}
}
// md-divider has a bug in angular-material that doesn't apply color
md-divider {
border-top-color: rgba(black, 0.12);
}
}
Loading

0 comments on commit 790278d

Please sign in to comment.