@coolon/angular-ui-powerups 3.0.3 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [3.1.0](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.0.3...v3.1.0) (2020-09-18)
6
+
7
+
8
+ ### Features
9
+
10
+ * updated bootstrap-app to generate application root component ([6562f41](https://bitbucket.org/coolon/angular-ui-powerups/commit/6562f41166006d778782a4b2254cc869e7ed6b53))
11
+
5
12
  ### [3.0.3](https://bitbucket.org/coolon/angular-ui-powerups/compare/v3.0.2...v3.0.3) (2020-09-13)
6
13
 
7
14
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coolon/angular-ui-powerups",
3
- "version": "3.0.3",
3
+ "version": "3.1.0",
4
4
  "schematics": "./schematics/collection.json",
5
5
  "dependencies": {
6
6
  "@coolon/typescript-utilities": "^2.0.0",
@@ -1,3 +1,4 @@
1
- import { Rule } from '@angular-devkit/schematics';
1
+ import { Rule, Source } from '@angular-devkit/schematics';
2
2
  import { Schema } from './schema';
3
3
  export declare function bootstrapApp(_options: Schema): Rule;
4
+ export declare function applyWithOverwrite(source: Source, rules: Rule[]): Rule;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bootstrapApp = void 0;
3
+ exports.applyWithOverwrite = exports.bootstrapApp = void 0;
4
4
  const core_1 = require("@angular-devkit/core");
5
5
  const schematics_1 = require("@angular-devkit/schematics");
6
6
  const package_util_1 = require("../package-util");
@@ -18,13 +18,12 @@ function bootstrapApp(_options) {
18
18
  if (!_options.project) {
19
19
  _options.project = workspace.defaultProject;
20
20
  }
21
- const templateSource = schematics_1.apply(schematics_1.url('./templates'), [
21
+ const templateSource = applyWithOverwrite(schematics_1.url('./templates'), [
22
22
  schematics_1.applyTemplates(Object.assign(Object.assign({}, _options), core_1.strings)),
23
- schematics_1.move(`apps/${_options.project}/src`),
23
+ schematics_1.move(`apps/${_options.project}/src`)
24
24
  ]);
25
- const fileMerge = schematics_1.mergeWith(templateSource, schematics_1.MergeStrategy.Overwrite);
26
25
  const rule = schematics_1.chain([
27
- fileMerge,
26
+ templateSource,
28
27
  updatePackageJsonScripts(_options)
29
28
  ]);
30
29
  return rule(tree, _context);
@@ -34,10 +33,27 @@ exports.bootstrapApp = bootstrapApp;
34
33
  function updatePackageJsonScripts(_options) {
35
34
  return (tree, _) => {
36
35
  return package_util_1.updatePackageJson(tree, draft => {
37
- draft.scripts = Object.assign(Object.assign({}, draft.scripts), { [`place-routes:${_options.project}`]: `ng generate @coolon/angular-ui-powerups:place-routes --project ${_options.project}`, [`i18n:${_options.project}`]: `i18n-resource-generator apps/${_options.project}/src/i18n apps/${_options.project}/src/app` });
36
+ draft.scripts = Object.assign(Object.assign({}, draft.scripts), { [`i18n:${_options.project}`]: `i18n-resource-generator apps/${_options.project}/src/i18n apps/${_options.project}/src/app`, [`place-routes:${_options.project}`]: `ng generate @coolon/angular-ui-powerups:place-routes --project ${_options.project}`, [`build:${_options.project}`]: 'nx build --prod --project ${_options.project}', [`start:${_options.project}`]: 'nx serve --project ${_options.project}' });
38
37
  });
39
38
  };
40
39
  }
40
+ // See https://stackoverflow.com/a/53230034
41
+ function applyWithOverwrite(source, rules) {
42
+ return (tree, _context) => {
43
+ const rule = schematics_1.mergeWith(schematics_1.apply(source, [
44
+ ...rules,
45
+ schematics_1.forEach((fileEntry) => {
46
+ if (tree.exists(fileEntry.path)) {
47
+ tree.overwrite(fileEntry.path, fileEntry.content);
48
+ return null;
49
+ }
50
+ return fileEntry;
51
+ })
52
+ ]));
53
+ return rule(tree, _context);
54
+ };
55
+ }
56
+ exports.applyWithOverwrite = applyWithOverwrite;
41
57
  // function generateApp(name: string): Rule {
42
58
  // return externalSchematic('@nrwl/angular', 'application', {
43
59
  // name,
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/bootstrap-app/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAC7D,2DAUoC;AACpC,kDAAoD;AAGpD,yFAAyF;AAEzF,SAAgB,YAAY,CAAC,QAAgB;IAE3C,OAAO,CAAC,IAAU,EAAE,QAA0B,EAAE,EAAE;QAGhD,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,CAAC,eAAe,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,gDAAgD,CAAC,CAAC;SACnE;QAED,8BAA8B;QAC9B,MAAM,gBAAgB,GAAG,eAAe,CAAC,QAAQ,EAAE,CAAC;QAEpD,0CAA0C;QAC1C,MAAM,SAAS,GAA2C,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QAEvF,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE;YACrB,QAAQ,CAAC,OAAO,GAAG,SAAS,CAAC,cAAc,CAAC;SAC7C;QAED,MAAM,cAAc,GAAG,kBAAK,CAC1B,gBAAG,CAAC,aAAa,CAAC,EAAE;YAClB,2BAAc,iCAAM,QAAQ,GAAK,cAAO,EAAG;YAC3C,iBAAI,CAAC,QAAQ,QAAQ,CAAC,OAAO,MAAM,CAAC;SACrC,CAAC,CAAC;QACL,MAAM,SAAS,GAAG,sBAAS,CAAC,cAAc,EAAE,0BAAa,CAAC,SAAS,CAAC,CAAC;QAErE,MAAM,IAAI,GAAG,kBAAK,CAAC;YACjB,SAAS;YACT,wBAAwB,CAAC,QAAQ,CAAC;SACnC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAS,CAAC;IACtC,CAAC,CAAC;AACJ,CAAC;AAlCD,oCAkCC;AAED,SAAS,wBAAwB,CAAC,QAAgB;IAChD,OAAO,CAAC,IAAU,EAAE,CAAmB,EAAQ,EAAE;QAC/C,OAAO,gCAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;YACrC,KAAK,CAAC,OAAO,mCACR,KAAK,CAAC,OAAO,KAChB,CAAC,gBAAgB,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,kEAAkE,QAAQ,CAAC,OAAO,EAAE,EAC1H,CAAC,QAAQ,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,gCAAgC,QAAQ,CAAC,OAAO,kBAAkB,QAAQ,CAAC,OAAO,UAAU,GAC3H,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAGD,6CAA6C;AAC7C,+DAA+D;AAC/D,YAAY;AACZ,wBAAwB;AACxB,uBAAuB;AACvB,qBAAqB;AACrB,qBAAqB;AACrB,0BAA0B;AAC1B,4BAA4B;AAC5B,QAAQ;AACR,IAAI;AAGJ,kDAAkD;AAClD,gCAAgC;AAChC,EAAE;AACF,yDAAyD;AACzD,EAAE;AACF,qDAAqD;AACrD,8CAA8C;AAC9C,UAAU;AACV,4EAA4E;AAC5E,EAAE;AACF,2BAA2B;AAC3B,kBAAkB;AAClB,UAAU;AACV,EAAE;AACF,2CAA2C;AAC3C,OAAO;AACP,IAAI;AAGJ,oDAAoD;AACpD,yDAAyD;AACzD,2EAA2E;AAC3E,mBAAmB;AACnB,OAAO;AACP,IAAI;AACJ,EAAE;AACF,qDAAqD;AACrD,yDAAyD;AACzD,oEAAoE;AACpE,mBAAmB;AACnB,OAAO;AACP,IAAI"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/angular-ui-powerups/schematics/bootstrap-app/index.ts"],"names":[],"mappings":";;;AAAA,+CAA6D;AAC7D,2DAaoC;AACpC,kDAAoD;AAGpD,yFAAyF;AAEzF,SAAgB,YAAY,CAAC,QAAgB;IAE3C,OAAO,CAAC,IAAU,EAAE,QAA0B,EAA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ACJ,EAAE;AACF,qDAAqD;AACrD,yDAAyD;AACzD,oEAAoE;AACpE,mBAAmB;AACnB,OAAO;AACP,IAAI"}
@@ -0,0 +1,7 @@
1
+ <mat-toolbar>App Home</mat-toolbar>
2
+ <aup-place-outlet #outlet
3
+ [animate]="false"
4
+ [placeAnimationOrder]="places"></aup-place-outlet>
5
+
6
+
7
+
@@ -0,0 +1,12 @@
1
+ /*
2
+ * Remove template code below
3
+ */
4
+ :host {
5
+ display: flex;
6
+ flex-direction: column;
7
+ align-items: stretch;
8
+ }
9
+
10
+ aup-place-outlet {
11
+ flex:1
12
+ }
@@ -0,0 +1,18 @@
1
+ import {Component} from "@angular/core";
2
+ import {HomeComponent} from "./places/home/home.component";
3
+
4
+ @Component({
5
+ selector: "<%= dasherize(project)%>-root",
6
+ templateUrl: "./app.component.html",
7
+ styleUrls: ["./app.component.scss"],
8
+ })
9
+ export class AppComponent {
10
+
11
+ readonly places = [
12
+ HomeComponent
13
+ ];
14
+
15
+ constructor() {
16
+ }
17
+
18
+ }
@@ -0,0 +1,84 @@
1
+ import {DOCUMENT} from "@angular/common";
2
+ import {HttpClientModule} from "@angular/common/http";
3
+ import {ApplicationRef, DoBootstrap, Inject, LOCALE_ID, NgModule} from "@angular/core";
4
+ import {FlexModule} from "@angular/flex-layout";
5
+ import {MAT_MOMENT_DATE_FORMATS, MomentDateAdapter} from "@angular/material-moment-adapter";
6
+ import {DateAdapter, MAT_DATE_FORMATS, MAT_DATE_LOCALE} from "@angular/material/core";
7
+ import {MatDialogModule} from "@angular/material/dialog";
8
+ import {MatIconRegistry} from "@angular/material/icon";
9
+ import {BrowserModule, DomSanitizer} from "@angular/platform-browser";
10
+ import {BrowserAnimationsModule} from "@angular/platform-browser/animations";
11
+ import {
12
+ AngularUiPowerupsModule,
13
+ DIALOG_INTERACTION_SERVICE_DEFAULTS,
14
+ DialogInteractionContextFactory,
15
+ ModalInteractionContextFactory,
16
+ PlaceModule
17
+ } from "@coolon/angular-ui-powerups";
18
+ import {
19
+ CoolonCloudAuthModule,
20
+ COGNITO_CONFIGURATION,
21
+ OidcClientAuthService,
22
+ AuthService
23
+ } from "@coolon/mars/cloud-auth";
24
+ import {Logger} from "@coolon/pectin";
25
+ import {setAutoFreeze} from "immer";
26
+ import {environment} from "../environments/environment";
27
+ import {AppRoutingModuleTs} from "./app-routing.module";
28
+
29
+ import {AppComponent} from "./app.component";
30
+
31
+ @NgModule({
32
+ declarations: [AppComponent],
33
+ imports: [
34
+ BrowserModule,
35
+ BrowserAnimationsModule,
36
+ MatDialogModule,
37
+ AppRoutingModuleTs,
38
+ PlaceModule,
39
+ AngularUiPowerupsModule,
40
+ FlexModule,
41
+ CoolonCloudAuthModule,
42
+ HttpClientModule
43
+ ],
44
+ providers: [
45
+ {provide: DIALOG_INTERACTION_SERVICE_DEFAULTS, useValue: {restoreFocus: true}},
46
+ {provide: ModalInteractionContextFactory, useClass: DialogInteractionContextFactory},
47
+ {provide: LOCALE_ID, useValue: 'en-AU'},
48
+ {provide: MAT_DATE_LOCALE, useExisting: LOCALE_ID},
49
+ {provide: DateAdapter, useClass: MomentDateAdapter, deps: [MAT_DATE_LOCALE]},
50
+ {provide: MAT_DATE_FORMATS, useValue: MAT_MOMENT_DATE_FORMATS},
51
+ {provide: COGNITO_CONFIGURATION, useValue: environment.cognito}
52
+ ],
53
+ bootstrap: [],
54
+ })
55
+ export class AppModule implements DoBootstrap {
56
+ constructor(readonly authService: AuthService,
57
+ @Inject(DOCUMENT) private document: any,
58
+ iconRegistry: MatIconRegistry,
59
+ domSanitizer: DomSanitizer) {
60
+ Logger.logToConsole();
61
+
62
+ // Immer version 7 is barfing with this error https://github.com/immerjs/immer/issues/537.
63
+ setAutoFreeze(false);
64
+
65
+ // iconRegistry.addSvgIcon('check_box_outline', domSanitizer.bypassSecurityTrustResourceUrl('assets/icons/check_box_outline-24px.svg'));
66
+ }
67
+
68
+ ngDoBootstrap(appRef: ApplicationRef): void {
69
+
70
+ this.authService
71
+ .init()
72
+ .then((authorised) => {
73
+ if (authorised) {
74
+ this.document.body.classList.add("ready")
75
+ }
76
+ console.log('[ngDoBootstrap] cognito initialised, starting app.');
77
+ appRef.bootstrap(AppComponent);
78
+ })
79
+ .catch(error => {
80
+ this.document.body.classList.add("auth-failure")
81
+ console.error('[ngDoBootstrap] cognito initialisation failed', error);
82
+ });
83
+ }
84
+ }
@@ -1,5 +1,5 @@
1
1
  import { NgModule } from '@angular/core';
2
- import { AuthGuard } from './auth.guard.ts.template';
2
+ import { AuthGuard } from './auth.guard';
3
3
 
4
4
  @NgModule({
5
5
  declarations: [],
@@ -1,6 +1,6 @@
1
1
  import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
2
 
3
- import { HomeComponent } from './home.component.ts.template';
3
+ import { HomeComponent } from './home.component';
4
4
 
5
5
  describe('HomeComponent', () => {
6
6
  let component: HomeComponent;
@@ -1,6 +1,6 @@
1
1
  import { Component, OnInit } from '@angular/core';
2
2
  import { Place, PlaceComponent } from '@coolon/angular-ui-powerups';
3
- import { I18n } from '../../i18n.ts.template';
3
+ import { I18n } from '../../i18n';
4
4
 
5
5
  @Place({
6
6
  path: 'home',
@@ -0,0 +1,19 @@
1
+ import {NgModule} from '@angular/core';
2
+ import {ComponentsModule, InteractionModule} from "@coolon/angular-ui-powerups";
3
+ import {HomeComponent} from './home/home.component';
4
+
5
+ @NgModule({
6
+ declarations: [
7
+ HomeComponent
8
+ ],
9
+ imports: [
10
+ ComponentsModule,
11
+ InteractionModule
12
+ ],
13
+ providers: [],
14
+ })
15
+ export class PlacesModule {
16
+ constructor() {
17
+
18
+ }
19
+ }
@@ -0,0 +1,12 @@
1
+
2
+ :root {
3
+ --nav-bar-height: 56px;
4
+ --default-padding: 16px;
5
+
6
+ --pinstripe-border-color: rgba(0, 0, 0, 0.2);
7
+ --pinstripe-border: 1px solid var(--pinstripe-border-color);
8
+ --pinstripe-border-dashed: 1px dashed var(--pinstripe-border-color);
9
+
10
+ --sub-header-height: 48px;
11
+ }
12
+
@@ -0,0 +1,37 @@
1
+ @import '~@angular/material/theming';
2
+ // Plus imports for other components in your app.
3
+
4
+ // Include the common styles for Angular Material. We include this here so that you only
5
+ // have to load a single css file for Angular Material in your app.
6
+ // Be sure that you only ever include this mixin once!
7
+ @include mat-core();
8
+
9
+ // Define the palettes for your theme using the Material Design palettes available in palette.scss
10
+ // (imported above). For each palette, you can optionally specify a default, lighter, and darker
11
+ // hue. Available color palettes: https://material.io/design/color/
12
+ $tester-app-primary: mat-palette($mat-indigo);
13
+ $tester-app-accent: mat-palette($mat-pink, A200, A100, A400);
14
+
15
+ // The warn palette is optional (defaults to red).
16
+ $tester-app-warn: mat-palette($mat-red);
17
+
18
+ // Create the theme object (a Sass map containing all of the palettes).
19
+ $tester-app-theme: mat-light-theme($tester-app-primary, $tester-app-accent, $tester-app-warn);
20
+
21
+ // Include theme styles for core and each component used in your app.
22
+ // Alternatively, you can import and @include the theme mixins for each component
23
+ // that you are using.
24
+ @include angular-material-theme($tester-app-theme);
25
+
26
+ :root {
27
+ --theme-primary-color: #{mat-color(map-get($tester-app-theme, primary))};
28
+ --theme-forground-color: #{mat-color(map-get($tester-app-theme, foreground))};
29
+ --theme-background-color: #{mat-color(map-get($tester-app-theme, background))};
30
+ --theme-warn-color: #{mat-color(map-get($tester-app-theme, warn))};
31
+ //--theme-warn-background-color: #{mat-color(map-get($tester-app-theme, warn))};
32
+ --theme-warn-background-color: #{mat-color(map-get($tester-app-theme, warn), 0.4)};
33
+ --theme-warn-color-default-contrast: #{mat-color(map-get($tester-app-theme, warn), default-contrast)};
34
+ --theme-selected-item-background-color: #{mat-color(map-get($tester-app-theme, primary), 0.15)};
35
+ --theme-selected-item-border-color: #{mat-color(map-get($tester-app-theme, primary), 0.6)};
36
+ --theme-selected-item-background-hover-color: #{mat-color(map-get($tester-app-theme, primary), 0.05)};
37
+ }