Skip to content

Commit 0f474fd

Browse files
committed
feat(Angular 5 release candidate)
5.0.0 alpha release candidate. See changelog for details. Addresses: Stabzs#128, Stabzs#129, Stabzs#139 and Stabzs#142
1 parent ed3134e commit 0f474fd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+33201
-291
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules\\typescript\\lib"
3+
}

CHANGELOG.md

+35-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,43 @@
1+
# 5.0.0-alpha.1 (2018-02-04)
2+
### BREAKING CHANGES
3+
* **angular2-toaster:** The library's Angular dependencies have been pinned to a minimum version of
4+
5.0.0 for common, compiler, and core and RxJS has been pinned to a minimum of 5.4.2 due to defects
5+
in lower RxJS versions.
6+
7+
* **toaster.module:** `ToasterModule` now exposes both `forRoot` and `forChild` methods to ensure
8+
that `ToasterService` is always provided as a singleton instance. `ToasterModule` should always be
9+
called with `forRoot` in the root of the application and subsequently called with `forChild` in
10+
additional "per component" container injections. Closes
11+
[#129](https://github.com/Stabzs/Angular2-Toaster/issues/129).
12+
13+
### FEATURES
14+
* **angular2-toaster:** A `toaster.min.css` file inclusion has been added. Closes
15+
[#142](https://github.com/Stabzs/Angular2-Toaster/issues/142).
16+
17+
* **demos:** Rebuilt the `angular-cli` demo to pull from local pathing to allow for better local
18+
examples.
19+
20+
### BUG FIXES
21+
* **toaster.css:** The close button is now properly responsive and no longer overflows its
22+
boundaries at collapsed resolutions. Closes
23+
[#139](https://github.com/Stabzs/Angular2-Toaster/issues/139).
24+
25+
* **angular2-toaster:** Optimized builds now work as intended. Closes
26+
[#128](https://github.com/Stabzs/Angular2-Toaster/issues/128).
27+
28+
* **toaster-container.component:** If the same toast was broadcast to multiple containers, the
29+
removal of the timeout for a toast in one container would affect all other timeouts for all
30+
other containers for that toast instance. Timeout Ids are now tracked internally in each container
31+
to ensure that each container's toast instance is tracked individually.
32+
33+
134
# 4.0.2 (2018-01-24)
235
### FEATURES
336
* **angular2-toaster:** Update Angular dependencies to support 5.x.x versions. Thanks @isaacplmann!
437

38+
539
# 4.0.1 (2017-7-16)
6-
* **toast-container.component:** The setTimeout call now runs outside of Angular and is patched on
40+
* **toaster-container.component:** The setTimeout call now runs outside of Angular and is patched on
741
reentry with an `ngZone.run()` call. This should provide better performance overall and should
842
make protractor testing easier. Closes
943
[#120](https://github.com/Stabzs/Angular2-Toaster/issues/120).

README.md

+28-29
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,8 @@ import {ToasterModule, ToasterService} from 'angular2-toaster';
6767
import {Root} from './root.component'
6868

6969
@NgModule({
70-
imports: [BrowserAnimationsModule, ToasterModule],
70+
imports: [BrowserAnimationsModule, ToasterModule.forRoot()],
7171
declarations: [Root],
72-
providers: [],
7372
bootstrap: [Root]
7473
})
7574

@@ -92,9 +91,11 @@ export class Root {
9291
}
9392
}
9493
```
94+
`ToasterModule.forRoot()` is recommended for most applications as it will guarantee a single instance of the ToasterService, ensuring that all recipient containers observe the same ToasterService events.
9595
96+
For subsequent inclusions, use `ToasterModule.forChild()` to provide the `ToasterContainerComponent` only, ensuring that `ToasterService` is still held as a singleton at the root.
9697
97-
## Getting Started with Default Configuration - Manual Component Inclusion:
98+
## Getting Started with Default Configuration - Manual Component Inclusion (obsolete >= 5.0.0):
9899
99100
```typescript
100101
import {Component} from '@angular/core';
@@ -131,15 +132,13 @@ bootstrap(Root);
131132
```typescript
132133
import {Component} from '@angular/core';
133134
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
134-
import {ToasterContainerComponent, ToasterService, ToasterConfig} from 'angular2-toaster';
135+
import {ToasterModule, ToasterService, ToasterConfig} from 'angular2-toaster';
135136

136137
@Component({
137138
selector: 'root',
138-
imports: [BrowserAnimationsModule],
139-
directives: [ToasterContainerComponent],
140-
providers: [ToasterService],
139+
imports: [BrowserAnimationsModule, ToasterModule.forRoot()],
141140
template: `
142-
<toaster-container [toasterconfig]="toasterconfig">
141+
<toaster-container [toasterconfig]="config">
143142
</toaster-container>
144143
<button (click)="popToast()">pop toast</button>`
145144
})
@@ -151,7 +150,7 @@ class Root {
151150
this.toasterService = toasterService;
152151
}
153152

154-
public toasterconfig : ToasterConfig =
153+
public config: ToasterConfig =
155154
new ToasterConfig({
156155
showCloseButton: true,
157156
tapToDismiss: false,
@@ -250,9 +249,9 @@ There are five animation styles that can be applied via the toasterconfig `anima
250249
251250
```typescript
252251
template:
253-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
252+
`<toaster-container [toasterconfig]="config"></toaster-container>`
254253

255-
public toasterconfig : ToasterConfig =
254+
public config: ToasterConfig =
256255
new ToasterConfig({animation: 'fade'});
257256
```
258257
@@ -264,9 +263,9 @@ To change this behavior, pass a "limit" option to the config:
264263
265264
```typescript
266265
template:
267-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
266+
`<toaster-container [toasterconfig]="config"></toaster-container>`
268267

269-
public toasterconfig : ToasterConfig =
268+
public config: ToasterConfig =
270269
new ToasterConfig({limit: 5});
271270
```
272271
@@ -277,9 +276,9 @@ that if set to false, the toast will only be dismissed if the close button is de
277276
278277
```typescript
279278
template:
280-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
279+
`<toaster-container [toasterconfig]="config"></toaster-container>`
281280

282-
public toasterconfig : ToasterConfig =
281+
public config: ToasterConfig =
283282
new ToasterConfig({tapToDismiss: false});
284283
```
285284
@@ -291,9 +290,9 @@ The Close Button's visibility can be configured at three different levels:
291290
292291
```typescript
293292
template:
294-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
293+
`<toaster-container [toasterconfig]="config"></toaster-container>`
295294

296-
public toasterconfig : ToasterConfig =
295+
public config: ToasterConfig =
297296
new ToasterConfig({showCloseButton: true});
298297
```
299298
@@ -302,9 +301,9 @@ By passing the close-button configuration as an object instead of a boolean, you
302301
303302
```typescript
304303
template:
305-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
304+
`<toaster-container [toasterconfig]="config"></toaster-container>`
306305

307-
public toasterconfig : ToasterConfig =
306+
public config: ToasterConfig =
308307
new ToasterConfig({
309308
showCloseButton: { 'warning': true, 'error': false }
310309
});
@@ -337,9 +336,9 @@ The close button html can be overridden either globally or per toast call.
337336
338337
```typescript
339338
template:
340-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
339+
`<toaster-container [toasterconfig]="config"></toaster-container>`
341340

342-
public toasterconfig : ToasterConfig =
341+
public config: ToasterConfig =
343342
new ToasterConfig({
344343
closeHtml: '<button>Close</button>'
345344
});
@@ -365,9 +364,9 @@ If changed to false via the config, toasts will be added to the bottom of other
365364
366365
```typescript
367366
template:
368-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
367+
`<toaster-container [toasterconfig]="config"></toaster-container>`
369368

370-
public toasterconfig : ToasterConfig =
369+
public config: ToasterConfig =
371370
new ToasterConfig({newestOnTop: false});
372371
```
373372
@@ -383,9 +382,9 @@ The timeout can be configured at three different levels:
383382
* Globally in the config for all toast types:
384383
```typescript
385384
template:
386-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
385+
`<toaster-container [toasterconfig]="config"></toaster-container>`
387386

388-
public toasterconfig : ToasterConfig =
387+
public config: ToasterConfig =
389388
new ToasterConfig({timeout: 2000});
390389
```
391390
@@ -395,9 +394,9 @@ behavior an info-class type should have.
395394
396395
```
397396
template:
398-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
397+
`<toaster-container [toasterconfig]="config"></toaster-container>`
399398

400-
public toasterconfig : ToasterConfig =
399+
public config: ToasterConfig =
401400
new ToasterConfig({timeout: {error:1000});
402401
```
403402
If a type is not defined and specified, a timeout will not be applied, making the toast "sticky".
@@ -421,9 +420,9 @@ This can be overriden via the container's config.
421420
422421
```typescript
423422
template:
424-
`<toaster-container [toasterconfig]="toasterconfig"></toaster-container>`
423+
`<toaster-container [toasterconfig]="config"></toaster-container>`
425424

426-
public toasterconfig : ToasterConfig =
425+
public config: ToasterConfig =
427426
new ToasterConfig({mouseoverTimerStop: false});
428427
```
429428

angular2-toaster.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
export { ToastComponent } from "./src/toast.component";
22
export { ToasterContainerComponent } from "./src/toaster-container.component";
3-
export { ToasterService, IClearWrapper } from "./src/toaster.service";
3+
export { ToasterService } from "./src/toaster.service";
4+
export { IClearWrapper } from "./src/clearWrapper";
45
export { ToasterConfig, IToasterConfig } from "./src/toaster-config";
5-
export { Toast, OnActionCallback, ClickHandler } from './src/toast';
6+
export { Toast, ClickHandler, OnActionCallback } from "./src/toast";
67
export { BodyOutputType } from "./src/bodyOutputType";
7-
export { ToasterModule } from "./src/toaster.module";
8+
export { ToasterModule } from "./src/toaster.module";

config/rollup.config.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
export default {
22
entry: './dist/angular2-toaster.js',
3-
dest: './dist/bundles/angular2-toaster.umd.js',
4-
format: 'umd',
3+
output: {
4+
file: 'dist/bundles/angular2-toaster.umd.js',
5+
format: 'umd'
6+
},
57
moduleName: 'angular2toaster',
68
external: [
79
'@angular/core',

demo/angular-cli/.angular-cli.json

+10-4
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,16 @@
3636
},
3737
"lint": [
3838
{
39-
"project": "src/tsconfig.app.json"
39+
"project": "src/tsconfig.app.json",
40+
"exclude": "**/node_modules/**"
4041
},
4142
{
42-
"project": "src/tsconfig.spec.json"
43+
"project": "src/tsconfig.spec.json",
44+
"exclude": "**/node_modules/**"
4345
},
4446
{
45-
"project": "e2e/tsconfig.e2e.json"
47+
"project": "e2e/tsconfig.e2e.json",
48+
"exclude": "**/node_modules/**"
4649
}
4750
],
4851
"test": {
@@ -52,6 +55,9 @@
5255
},
5356
"defaults": {
5457
"styleExt": "css",
55-
"component": {}
58+
"component": {},
59+
"build": {
60+
"preserveSymlinks": true
61+
}
5662
}
5763
}

demo/angular-cli/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
# compiled output
44
/dist
5+
/dist-server
56
/tmp
67
/out-tsc
78

demo/angular-cli/README.md

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
# AngularCli
22

3-
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.0.0.
3+
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.6.7.
4+
Due to local pathing support in order to test angular2-toaster locally, the following setup steps are required.
5+
6+
- run npm install
7+
- delete all @angular node packages from node_modules
8+
- delete @ngtools package from node_modules
9+
- delete ng and ngc files from node_modules/.bin
410

511
## Development server
612

7-
Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
13+
Run `npm run start --aot` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files.
814

915
## Code scaffolding
1016

11-
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.
17+
Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.
1218

1319
## Build
1420

@@ -21,7 +27,6 @@ Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.
2127
## Running end-to-end tests
2228

2329
Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
24-
Before running the tests make sure you are serving the app via `ng serve`.
2530

2631
## Further help
2732

demo/angular-cli/e2e/app.e2e-spec.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
import { AngularCliPage } from './app.po';
1+
import { AppPage } from './app.po';
22

33
describe('angular-cli App', () => {
4-
let page: AngularCliPage;
4+
let page: AppPage;
55

66
beforeEach(() => {
7-
page = new AngularCliPage();
7+
page = new AppPage();
88
});
99

10-
it('should display message saying app works', () => {
10+
it('should display welcome message', () => {
1111
page.navigateTo();
12-
expect(page.getParagraphText()).toEqual('app works!');
12+
expect(page.getParagraphText()).toEqual('Welcome to app!');
1313
});
1414
});

demo/angular-cli/e2e/app.po.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { browser, element, by } from 'protractor';
1+
import { browser, by, element } from 'protractor';
22

3-
export class AngularCliPage {
3+
export class AppPage {
44
navigateTo() {
55
return browser.get('/');
66
}

demo/angular-cli/e2e/tsconfig.e2e.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"extends": "../tsconfig.json",
33
"compilerOptions": {
44
"outDir": "../out-tsc/e2e",
5+
"baseUrl": "./",
56
"module": "commonjs",
67
"target": "es5",
7-
"types":[
8+
"types": [
89
"jasmine",
10+
"jasminewd2",
911
"node"
1012
]
1113
}

demo/angular-cli/karma.conf.js

+2-13
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Karma configuration file, see link for more information
2-
// https://karma-runner.github.io/0.13/config/configuration-file.html
2+
// https://karma-runner.github.io/1.0/config/configuration-file.html
33

44
module.exports = function (config) {
55
config.set({
@@ -15,25 +15,14 @@ module.exports = function (config) {
1515
client:{
1616
clearContext: false // leave Jasmine Spec Runner output visible in browser
1717
},
18-
files: [
19-
{ pattern: './src/test.ts', watched: false }
20-
],
21-
preprocessors: {
22-
'./src/test.ts': ['@angular/cli']
23-
},
24-
mime: {
25-
'text/x-typescript': ['ts','tsx']
26-
},
2718
coverageIstanbulReporter: {
2819
reports: [ 'html', 'lcovonly' ],
2920
fixWebpackSourcePaths: true
3021
},
3122
angularCli: {
3223
environment: 'dev'
3324
},
34-
reporters: config.angularCli && config.angularCli.codeCoverage
35-
? ['progress', 'coverage-istanbul']
36-
: ['progress', 'kjhtml'],
25+
reporters: ['progress', 'kjhtml'],
3726
port: 9876,
3827
colors: true,
3928
logLevel: config.LOG_INFO,

0 commit comments

Comments
 (0)