Skip to content

Commit

Permalink
feat: update to angular 7
Browse files Browse the repository at this point in the history
  • Loading branch information
pimenovoleg committed Sep 1, 2018
1 parent 6e1fff3 commit 1a343b0
Show file tree
Hide file tree
Showing 33 changed files with 9,566 additions and 11,385 deletions.
20,265 changes: 9,228 additions & 11,037 deletions package-lock.json

Large diffs are not rendered by default.

62 changes: 32 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
"node": ">= 8",
"npm": ">=5"
},
"requiredAngularVersion": ">=7.0.0-beta.4",
"dependencies": {
"@angular/animations": "6.1.2",
"@angular/common": "6.1.2",
"@angular/compiler": "6.1.2",
"@angular/core": "6.1.2",
"@angular/elements": "6.1.2",
"@angular/forms": "6.1.2",
"@angular/platform-browser": "6.1.2",
"@angular/animations": "7.0.0-beta.4",
"@angular/common": "^7.0.0-beta.4",
"@angular/compiler": "^7.0.0-beta.4",
"@angular/core": "^7.0.0-beta.4",
"@angular/elements": "^7.0.0-beta.4",
"@angular/forms": "^7.0.0-beta.4",
"@angular/platform-browser": "^7.0.0-beta.4",
"@webcomponents/custom-elements": "^1.1.0",
"@ptsecurity/mosaic-icons": "2.5.3",
"core-js": "^2.5.7",
"rxjs": "^6.2.0",
Expand All @@ -29,13 +31,13 @@
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular/compiler-cli": "6.1.2",
"@angular/http": "6.1.2",
"@angular/platform-browser-dynamic": "6.1.2",
"@angular/platform-server": "6.1.2",
"@angular/router": "6.1.2",
"@commitlint/cli": "^7.0.0",
"@commitlint/config-conventional": "^7.0.1",
"@angular/compiler-cli": "7.0.0-beta.4",
"@angular/http": "7.0.0-beta.4",
"@angular/platform-browser-dynamic": "7.0.0-beta.4",
"@angular/platform-server": "7.0.0-beta.4",
"@angular/router": "7.0.0-beta.4",
"@commitlint/cli": "^7.1.1",
"@commitlint/config-conventional": "^7.1.1",
"@ngtools/webpack": "^6.1.5",
"@ptsecurity/commitlint-config": "^0.1.3",
"@ptsecurity/prettier-config": "0.1.0",
Expand All @@ -55,18 +57,18 @@
"awesome-typescript-loader": "^5.2.0",
"chalk": "^2.4.1",
"conventional-changelog": "^2.0.3",
"dgeni": "^0.4.9",
"dgeni-packages": "^0.26.5",
"dgeni": "^0.4.10",
"dgeni-packages": "^0.26.8",
"fs-extra": "^5.0.0",
"glob": "^7.1.2",
"glob": "^7.1.3",
"gulp": "^3.9.1",
"gulp-clean": "^0.4.0",
"gulp-clean-css": "^3.9.4",
"gulp-clean-css": "^3.10.0",
"gulp-cli": "^2.0.1",
"gulp-conventional-changelog": "^2.0.3",
"gulp-dom": "^0.9.17",
"gulp-flatten": "^0.3.1",
"gulp-highlight-files": "0.0.5",
"gulp-highlight-files": "^0.0.6",
"gulp-htmlmin": "^4.0.0",
"gulp-if": "^2.0.2",
"gulp-markdown": "^1.2.0",
Expand All @@ -77,8 +79,8 @@
"highlight.js": "^9.12.0",
"html-webpack-plugin": "^3.2.0",
"husky": "^0.14.3",
"jasmine-core": "~3.1.0",
"karma": "^2.0.5",
"jasmine-core": "~3.2.1",
"karma": "^3.0.0",
"karma-chrome-launcher": "2.2.0",
"karma-coverage": "^1.1.2",
"karma-jasmine": "^1.1.2",
Expand All @@ -88,12 +90,12 @@
"karma-sourcemap-loader": "0.3.7",
"karma-spec-reporter": "0.0.32",
"license-checker": "^16.0.0",
"lint-staged": "^7.2.0",
"lint-staged": "^7.2.2",
"madge": "^3.2.0",
"magic-string": "^0.22.5",
"node-sass": "^4.9.2",
"postcss-loader": "^2.1.6",
"prettier": "^1.14.0",
"node-sass": "^4.9.3",
"postcss-loader": "^3.0.0",
"prettier": "^1.14.2",
"raw-loader": "^0.5.1",
"resolve-bin": "^0.4.0",
"resolve-url-loader": "^2.3.0",
Expand All @@ -106,22 +108,22 @@
"scss-bundle": "^2.4.0",
"sorcery": "^0.10.0",
"spdx-satisfies": "^0.1.3",
"style-loader": "^0.22.1",
"style-loader": "^0.23.0",
"stylelint": "^9.5.0",
"stylelint-config-standard": "^18.2.0",
"stylelint-scss": "~3.2.0",
"stylelint-scss": "^3.3.0",
"ts-node": "4.1.0",
"tsconfig-paths": "^3.5.0",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"tslint": "^5.11.0",
"tslint-language-service": "^0.9.9",
"typescript": "~2.7.2",
"typescript": "3.0.3",
"uglify-js": "^2.8.29",
"url-loader": "^1.1.1",
"wallaby-webpack": "^3.9.10",
"wallaby-webpack": "^3.9.11",
"webpack": "^4.17.1",
"webpack-cli": "^3.1.0",
"webpack-dev-server": "^3.1.5"
"webpack-dev-server": "^3.1.7"
},
"scripts": {
"commitmsg": "commitlint -x=./commitlint.config.js -e $GIT_PARAMS",
Expand Down
1 change: 0 additions & 1 deletion src/cdk/bidi/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"public-api.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@ptsecurity/cdk/bidi",
Expand Down
23 changes: 11 additions & 12 deletions src/cdk/coercion/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"extends": "../tsconfig.build",
"files": [
"public-api.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@ptsecurity/cdk/coercion",
"skipTemplateCodegen": true,
"fullTemplateTypeCheck": true
}
"extends": "../tsconfig.build",
"files": [
"public-api.ts"
],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@ptsecurity/cdk/coercion",
"skipTemplateCodegen": true,
"fullTemplateTypeCheck": true
}
}
23 changes: 11 additions & 12 deletions src/cdk/collections/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"extends": "../tsconfig.build",
"files": [
"public-api.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@ptsecurity/cdk/collections",
"skipTemplateCodegen": true,
"fullTemplateTypeCheck": true
}
"extends": "../tsconfig.build",
"files": [
"public-api.ts"
],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@ptsecurity/cdk/collections",
"skipTemplateCodegen": true,
"fullTemplateTypeCheck": true
}
}
23 changes: 11 additions & 12 deletions src/cdk/keycodes/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"extends": "../tsconfig.build",
"files": [
"public-api.ts"
],
"angularCompilerOptions": {
"annotateForClosureCompiler": true,
"strictMetadataEmit": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@ptsecurity/cdk/keycodes",
"skipTemplateCodegen": true,
"fullTemplateTypeCheck": true
}
"extends": "../tsconfig.build",
"files": [
"public-api.ts"
],
"angularCompilerOptions": {
"strictMetadataEmit": true,
"flatModuleOutFile": "index.js",
"flatModuleId": "@ptsecurity/cdk/keycodes",
"skipTemplateCodegen": true,
"fullTemplateTypeCheck": true
}
}
160 changes: 80 additions & 80 deletions src/cdk/layout/breakpoints-observer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

import {Injectable, NgZone, OnDestroy} from '@angular/core';
import {coerceArray} from '@ptsecurity/cdk/coercion';
import {combineLatest, fromEventPattern, Observable, Subject} from 'rxjs';
Expand All @@ -9,100 +8,101 @@ import {MediaMatcher} from './media-matcher';

/** The current state of a layout breakpoint. */
export interface IBreakpointState {
/** Whether the breakpoint is currently matching. */
matches: boolean;
/** Whether the breakpoint is currently matching. */
matches: boolean;
}

interface IQuery {
observable: Observable<IBreakpointState>;
mql: MediaQueryList;
observable: Observable<IBreakpointState>;
mql: MediaQueryList;
}

/** Utility for checking the matching state of @media queries. */
@Injectable({providedIn: 'root'})
export class BreakpointObserver implements OnDestroy {
/** A map of all media queries currently being listened for. */
private _queries: Map<string, IQuery> = new Map();
/** A subject for all other observables to takeUntil based on. */
private _destroySubject: Subject<{}> = new Subject();

constructor(private mediaMatcher: MediaMatcher, private zone: NgZone) {}

/** Completes the active subject, signalling to all other observables to complete. */
ngOnDestroy() {
this._destroySubject.next();
this._destroySubject.complete();
}

/**
* Whether one or more media queries match the current viewport size.
* @param value One or more media queries to check.
* @returns Whether any of the media queries match.
*/
isMatched(value: string | string[]): boolean {
const queries = splitQueries(coerceArray(value));

return queries.some((mediaQuery) => this._registerQuery(mediaQuery).mql.matches);
}

/**
* Gets an observable of results for the given queries that will emit new results for any changes
* in matching of the given queries.
* @param value One or more media queries to check.
* @returns A stream of matches for the given queries.
*/
observe(value: string | string[]): Observable<IBreakpointState> {
const queries = splitQueries(coerceArray(value));
const observables = queries.map((query) => this._registerQuery(query).observable);

return combineLatest(observables).pipe(map((breakpointStates: IBreakpointState[]) => {
return {
matches: breakpointStates.some((state) => state && state.matches)
};
}));
}

/** Registers a specific query to be listened for. */
private _registerQuery(query: string): IQuery {
// Only set up a new MediaQueryList if it is not already being listened for.
if (this._queries.has(query)) {
return this._queries.get(query)!; //tslint:disable-line
/** A map of all media queries currently being listened for. */
private _queries: Map<string, IQuery> = new Map();
/** A subject for all other observables to takeUntil based on. */
private _destroySubject: Subject<{}> = new Subject();

constructor(private mediaMatcher: MediaMatcher, private zone: NgZone) {
}

/** Completes the active subject, signalling to all other observables to complete. */
ngOnDestroy() {
this._destroySubject.next();
this._destroySubject.complete();
}

/**
* Whether one or more media queries match the current viewport size.
* @param value One or more media queries to check.
* @returns Whether any of the media queries match.
*/
isMatched(value: string | string[]): boolean {
const queries = splitQueries(coerceArray(value));

return queries.some((mediaQuery) => this._registerQuery(mediaQuery).mql.matches);
}

const mql: MediaQueryList = this.mediaMatcher.matchMedia(query);
// Create callback for match changes and add it is as a listener.
const queryObservable = fromEventPattern(
// Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed
// back into the zone because matchMedia is only included in Zone.js by loading the
// webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not
// have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js
// patches it.
(listener: MediaQueryListListener) => {
mql.addListener((e: MediaQueryList) => this.zone.run(() => listener(e)));
},
(listener: MediaQueryListListener) => {
mql.removeListener((e: MediaQueryList) => this.zone.run(() => listener(e)));
})
.pipe(
takeUntil(this._destroySubject),
startWith(mql),
map((nextMql: MediaQueryList) => ({matches: nextMql.matches}))
);

// Add the MediaQueryList to the set of queries.
const output = {observable: queryObservable, mql: mql}; //tslint:disable-line
this._queries.set(query, output);

return output;
}
/**
* Gets an observable of results for the given queries that will emit new results for any changes
* in matching of the given queries.
* @param value One or more media queries to check.
* @returns A stream of matches for the given queries.
*/
observe(value: string | string[]): Observable<IBreakpointState> {
const queries = splitQueries(coerceArray(value));
const observables = queries.map((query) => this._registerQuery(query).observable);

return combineLatest(observables).pipe(map((breakpointStates: IBreakpointState[]) => {
return {
matches: breakpointStates.some((state) => state && state.matches)
};
}));
}

/** Registers a specific query to be listened for. */
private _registerQuery(query: string): IQuery {
// Only set up a new MediaQueryList if it is not already being listened for.
if (this._queries.has(query)) {
return this._queries.get(query)!; //tslint:disable-line
}

const mql: MediaQueryList = this.mediaMatcher.matchMedia(query);
// Create callback for match changes and add it is as a listener.
const queryObservable = fromEventPattern<MediaQueryList>(
// Listener callback methods are wrapped to be placed back in ngZone. Callbacks must be placed
// back into the zone because matchMedia is only included in Zone.js by loading the
// webapis-media-query.js file alongside the zone.js file. Additionally, some browsers do not
// have MediaQueryList inherit from EventTarget, which causes inconsistencies in how Zone.js
// patches it.
(listener: Function) => {
mql.addListener((e: MediaQueryList) => this.zone.run(() => listener(e)));
},
(listener: Function) => {
mql.removeListener((e: MediaQueryList) => this.zone.run(() => listener(e)));
})
.pipe(
takeUntil(this._destroySubject),
startWith(mql),
map((nextMql: MediaQueryList) => ({query, matches: nextMql.matches}))
);

// Add the MediaQueryList to the set of queries.
const output = {observable: queryObservable, mql: mql}; //tslint:disable-line
this._queries.set(query, output);

return output;
}
}

/**
* Split each query string into separate query strings if two queries are provided as comma
* separated.
*/
function splitQueries(queries: string[]): string[] {
return queries.map((query: string) => query.split(','))
.reduce((a1: string[], a2: string[]) => a1.concat(a2))
.map((query) => query.trim());
return queries.map((query: string) => query.split(','))
.reduce((a1: string[], a2: string[]) => a1.concat(a2))
.map((query) => query.trim());
}
Loading

0 comments on commit 1a343b0

Please sign in to comment.