diff --git a/.angular-cli.json b/.angular-cli.json index 313ed955d7..f85a350072 100644 --- a/.angular-cli.json +++ b/.angular-cli.json @@ -13,7 +13,7 @@ "main": "../demo-app/main.ts", "polyfills": "../demo-app/polyfills.ts", "test": "../test/test.ts", - "tsconfig": "tsconfig.lib.json", + "tsconfig": "../tsconfig.lib.json", "testTsconfig": "../tsconfig.spec.json", "prefix": "igo", "mobile": true, @@ -25,18 +25,20 @@ "root": "src/demo-app", "outDir": "dist", "assets": [ - "assets" + "assets", + { "glob": "**/*", "input": "../assets/", "output": "./assets/igo2/" } ], "index": "index.html", "main": "main.ts", "polyfills": "polyfills.ts", - "tsconfig": "tsconfig.demo.json", + "tsconfig": "../tsconfig.demo.json", "prefix": "demo", "mobile": true, "styles": [ "../../node_modules/openlayers/dist/ol.css", - "style/main.styl", - "style/material-font.styl" + "../themes/deeppurple-amber.styl", + "../style/igo.styl", + "style/main.styl" ], "scripts": [ "../../node_modules/openlayers/dist/ol.js" @@ -48,9 +50,6 @@ } } ], - "addons": [ - "assets/fonts/*.+(otf|eot|svg|ttf|woff|woff2)" - ], "e2e": { "protractor": { "config": "./protractor.conf.js" @@ -58,7 +57,7 @@ }, "lint": [ { - "project": "src/lib/tsconfig.lib.json", + "project": "src/tsconfig.lib.json", "exclude": "**/node_modules/**/*" }, { @@ -66,7 +65,7 @@ "exclude": "**/node_modules/**/*" }, { - "project": "src/demo-app/tsconfig.demo.json", + "project": "src/tsconfig.demo.json", "exclude": "**/node_modules/**/*" }, { diff --git a/karma.conf.js b/karma.conf.js index c9e3793eda..ec18ce9c21 100644 --- a/karma.conf.js +++ b/karma.conf.js @@ -18,7 +18,7 @@ module.exports = function (config) { files: [ './node_modules/openlayers/dist/ol.js', { - pattern: './src/assets/locale/*.json', + pattern: './src/locale/*.json', watched: false, included: false, nocache: false, diff --git a/package.json b/package.json index 64653b431f..4d3189da8d 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "ng": "ng", "start": "ng serve --app demo --proxy-config proxy.conf.json", "start.lib": "ng serve --proxy-config proxy.conf.json", - "build.lib": "npm run clean && gulp && ngc -p ./src/lib/tsconfig.lib.json && npm run build.lib.bundle", + "build.lib": "npm run clean && gulp && ngc -p ./src/tsconfig.lib.json && npm run build.lib.bundle", "build.lib.bundle": "webpack --config webpack.conf.js --bail", "build.demo": "ng build --app demo", "test": "npm run lint && ng test --single-run", @@ -28,7 +28,7 @@ "e2e": "ng e2e --app demo", "clean": "rimraf dist && rimraf bundle", "language.extract": "npm run language.extract.lib && npm run language.extract.demo", - "language.extract.lib": "ngx-translate-extract -i ./src/lib -o ./src/assets/locale/fr.json ./src/assets/locale/en.json -s -f namespaced-json -m _ -c", + "language.extract.lib": "ngx-translate-extract -i ./src/lib -o ./src/locale/fr.json ./src/locale/en.json -s -f namespaced-json -m _ -c", "language.extract.demo": "ngx-translate-extract -i ./src/demo-app -o ./src/demo-app/assets/locale/fr.json ./src/demo-app/assets/locale/en.json -s -f namespaced-json -m _ -c" }, "dependencies": { diff --git a/src/demo-app/style/main.styl b/src/demo-app/style/main.styl index 142fb87809..639fa409a8 100644 --- a/src/demo-app/style/main.styl +++ b/src/demo-app/style/main.styl @@ -1,7 +1,3 @@ -@import '~@angular/material/prebuilt-themes/deeppurple-amber.css'; -@import '../../themes/deeppurple-amber.styl'; -@import '../../style/cls.styl'; - /*** Reset ***/ html, diff --git a/src/assets/fonts/MaterialIcons-Regular.eot b/src/fonts/MaterialIcons-Regular.eot similarity index 100% rename from src/assets/fonts/MaterialIcons-Regular.eot rename to src/fonts/MaterialIcons-Regular.eot diff --git a/src/assets/fonts/MaterialIcons-Regular.ttf b/src/fonts/MaterialIcons-Regular.ttf similarity index 100% rename from src/assets/fonts/MaterialIcons-Regular.ttf rename to src/fonts/MaterialIcons-Regular.ttf diff --git a/src/assets/fonts/MaterialIcons-Regular.woff b/src/fonts/MaterialIcons-Regular.woff similarity index 100% rename from src/assets/fonts/MaterialIcons-Regular.woff rename to src/fonts/MaterialIcons-Regular.woff diff --git a/src/assets/fonts/MaterialIcons-Regular.woff2 b/src/fonts/MaterialIcons-Regular.woff2 similarity index 100% rename from src/assets/fonts/MaterialIcons-Regular.woff2 rename to src/fonts/MaterialIcons-Regular.woff2 diff --git a/src/lib/language/shared/language-loader.ts b/src/lib/language/shared/language-loader.ts index fd3f240236..42642dbe99 100644 --- a/src/lib/language/shared/language-loader.ts +++ b/src/lib/language/shared/language-loader.ts @@ -11,7 +11,7 @@ export class LanguageLoader implements TranslateLoader { private suffix: string = '.json') {} public getTranslation(lang: string): any { - const translation = require(`../../../../src/assets/locale/${lang}.json`); + const translation = require(`../../../../src/locale/${lang}.json`); const igoLocale$ = Observable.of(translation); if (!this.http) { diff --git a/src/lib/language/shared/language.service.ts b/src/lib/language/shared/language.service.ts index 3df8efb15c..6c84c13b2e 100644 --- a/src/lib/language/shared/language.service.ts +++ b/src/lib/language/shared/language.service.ts @@ -1,10 +1,10 @@ -import { Injectable, NgZone } from '@angular/core'; +import { Injectable } from '@angular/core'; import { TranslateService } from '@ngx-translate/core'; @Injectable() export class LanguageService { - constructor(private translate: TranslateService, private zone: NgZone) { + constructor(private translate: TranslateService) { const lang = this.getLanguage(); this.translate.setDefaultLang(lang); } @@ -15,8 +15,7 @@ export class LanguageService { } public setLanguage(language: string) { - this.translate.use(language); - this.translate.reloadLang(language); - this.zone.run(() => {}); + this.translate.use(language); + this.translate.reloadLang(language); } } diff --git a/src/lib/overlay/shared/overlay.directive.ts b/src/lib/overlay/shared/overlay.directive.ts index bd32437288..3cec5acc65 100644 --- a/src/lib/overlay/shared/overlay.directive.ts +++ b/src/lib/overlay/shared/overlay.directive.ts @@ -44,7 +44,7 @@ export class OverlayDirective implements OnInit, OnDestroy { this.overlayMarkerStyle = new ol.style.Style({ image: new ol.style.Icon({ - src: 'src/assets/icons/place_blue_36px.svg', + src: './assets/igo2/icons/place_blue_36px.svg', imgSize: [36, 36], // for ie anchor: [0.5, 1] }) diff --git a/src/assets/locale/en.json b/src/locale/en.json similarity index 100% rename from src/assets/locale/en.json rename to src/locale/en.json diff --git a/src/assets/locale/fr.json b/src/locale/fr.json similarity index 100% rename from src/assets/locale/fr.json rename to src/locale/fr.json diff --git a/src/style/igo.styl b/src/style/igo.styl new file mode 100644 index 0000000000..b07f65282b --- /dev/null +++ b/src/style/igo.styl @@ -0,0 +1,2 @@ +@require './material-font.styl'; +@require './cls.styl'; diff --git a/src/demo-app/style/material-font.styl b/src/style/material-font.styl similarity index 71% rename from src/demo-app/style/material-font.styl rename to src/style/material-font.styl index 0e689a5fd8..985dd912b5 100644 --- a/src/demo-app/style/material-font.styl +++ b/src/style/material-font.styl @@ -2,12 +2,12 @@ font-family: 'Material Icons'; font-style: normal; font-weight: 400; - src: url(../../assets/fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ + src: url(../fonts/MaterialIcons-Regular.eot); /* For IE6-8 */ src: local('Material Icons'), local('MaterialIcons-Regular'), - url(../../assets/fonts/MaterialIcons-Regular.woff2) format('woff2'), - url(../../assets/fonts/MaterialIcons-Regular.woff) format('woff'), - url(../../assets/fonts/MaterialIcons-Regular.ttf) format('truetype'); + url(../fonts/MaterialIcons-Regular.woff2) format('woff2'), + url(../fonts/MaterialIcons-Regular.woff) format('woff'), + url(../fonts/MaterialIcons-Regular.ttf) format('truetype'); } .material-icons { @@ -34,4 +34,4 @@ /* Support for IE. */ font-feature-settings: 'liga' 1; -ms-font-feature-settings: 'liga' 1; -} \ No newline at end of file +} diff --git a/src/themes/deeppurple-amber.styl b/src/themes/deeppurple-amber.styl index 591f353be9..b18f9811fa 100644 --- a/src/themes/deeppurple-amber.styl +++ b/src/themes/deeppurple-amber.styl @@ -1,3 +1,5 @@ +@import '~@angular/material/prebuilt-themes/deeppurple-amber.css'; + $primary-color = rgb(103, 58, 183); $accent-color = rgb(255, 215, 64); diff --git a/src/demo-app/tsconfig.demo.json b/src/tsconfig.demo.json similarity index 60% rename from src/demo-app/tsconfig.demo.json rename to src/tsconfig.demo.json index 0371bec04b..4ae6e19218 100644 --- a/src/demo-app/tsconfig.demo.json +++ b/src/tsconfig.demo.json @@ -1,13 +1,13 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", "compilerOptions": { - "outDir": "../../out-tsc/app", + "outDir": "../out-tsc/app", "module": "es2015", "baseUrl": "", "types": [] }, "exclude": [ - "test.ts", + "test/test.ts", "**/*.spec.ts" ] } diff --git a/src/lib/tsconfig.lib.json b/src/tsconfig.lib.json similarity index 85% rename from src/lib/tsconfig.lib.json rename to src/tsconfig.lib.json index b4392dd038..834823a47c 100644 --- a/src/lib/tsconfig.lib.json +++ b/src/tsconfig.lib.json @@ -1,5 +1,5 @@ { - "extends": "../../tsconfig.json", + "extends": "../tsconfig.json", "compilerOptions": { "declaration": true, "stripInternal": false, @@ -10,7 +10,7 @@ "types": [] }, "files": [ - "../../dist/lib/index.ts" + "../dist/lib/index.ts" ], "angularCompilerOptions": { "annotateForClosureCompiler": true, diff --git a/webpack.conf.js b/webpack.conf.js index 0fe44aee05..32a6fbf4b2 100644 --- a/webpack.conf.js +++ b/webpack.conf.js @@ -72,7 +72,7 @@ module.exports = { use: [{ loader: 'awesome-typescript-loader?declaration=false', options: { - tsconfig: './src/lib/tsconfig.lib.json' + tsconfig: './src/tsconfig.lib.json' } }, {