Skip to content

Commit 0a000dc

Browse files
authored
Update to ng4 (#6)
1 parent d71777d commit 0a000dc

14 files changed

+76
-77
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,6 @@ pubspec.lock
77

88
# Directory created by dartdoc
99
doc/api/
10+
11+
# Idea IntelliJ
12+
.idea

CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 0.1.0
4+
5+
- Version bump to AngularDart v4.0
6+
- Cleaner project
7+
38
## 0.0.1
49

510
- Initial version, created by Stagehand

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
# toastino
22

33
Toast component written in AngularDart.
4-
Provides clear and easy to use notifying system.
4+
Provides clear and easy to use notifying system.
55

66
## Usage
77

8-
1. Create a new ToastManagerComponent in your class by this way:
8+
1. Create a new ToastManagerComponent in your class in this way:
99

1010
```dart
1111
ToastManagerComponent _toastManager;
1212
13-
ToastinoExampleComponent(DynamicComponentLoader toastComponentLoader, ViewContainerRef viewContainerRef){
13+
ToastinoExampleComponent(SlowComponentLoader toastComponentLoader, ViewContainerRef viewContainerRef){
1414
_toastManager = new ToastManagerComponent(toastComponentLoader, viewContainerRef);
1515
}
1616
```
@@ -25,4 +25,4 @@ Provides clear and easy to use notifying system.
2525

2626
## Libraries
2727

28-
- **[toast_manager_component](./lib/src/toast_manager_component.dart)** - The core of Toastino: It keeps trace of every toast created and manages their positioning and removal.
28+
- **[toast_manager_component](./lib/src/toast_manager_component.dart)** - The core of Toastino: it keeps trace of every toast created and manages their positioning and removal.

example/lib/toastino_example_component.css

-6
This file was deleted.

example/lib/toastino_example_component.dart

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
// Copyright (c) 2017, Marco Bramini, Qurami. All rights reserved. Use of this source code is governed by a
22
// BSD-style license that can be found in the LICENSE file.
33

4-
import 'dart:core';
5-
import 'package:angular2/core.dart';
4+
import 'package:angular/angular.dart';
5+
import 'package:angular/core.dart';
66
import 'package:toastino/toastino.dart';
77

88
@Component(
9-
selector: 'toastino-example',
10-
templateUrl: 'toastino_example_component.html',
11-
)
9+
selector: 'toastino-example',
10+
templateUrl: 'toastino_example_component.html')
1211
class ToastinoExampleComponent {
1312
ToastManagerComponent _toastManager;
1413

15-
ToastinoExampleComponent(DynamicComponentLoader toastComponentLoader,
14+
ToastinoExampleComponent(SlowComponentLoader toastComponentLoader,
1615
ViewContainerRef viewContainerRef) {
1716
_toastManager =
1817
new ToastManagerComponent(toastComponentLoader, viewContainerRef);
+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<!-- Copyright (c) 2017, Marco Bramini, Qurami. All rights reserved. Use of this source code is governed by a
22
BSD-style license that can be found in the LICENSE file. -->
33

4-
<button (click)="toast('HelloWorld')" style="top: 400px;position: absolute">newToast</button>
4+
<button (click)="toast('HelloWorld')" style="top: 400px;position: absolute">newToast</button>

example/pubspec.yaml

+8-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
name: toastino_example
22
description: Use example of Toastino library.
3-
version: 0.0.1
3+
version: 0.1.0
44
author: Marco Bramini, Qurami <marco.bramini@qurami.com>
55
dependencies:
6-
angular2: ^3.1.0
6+
angular: ^4.0.0
77
toastino:
88
path: ..
9+
910
dev_dependencies:
1011
browser: ^0.10.0
11-
dart_to_js_script_rewriter: "^1.0.3"
12+
dart_to_js_script_rewriter: ^1.0.3
13+
1214
transformers:
13-
- angular2:
14-
entry-point: web/main.dart
15-
platform_directives:
16-
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
17-
platform_pipes:
18-
- 'package:angular2/common.dart#COMMON_PIPES'
19-
- dart_to_js_script_rewriter
15+
- angular:
16+
entry_points: web/main.dart
17+
- dart_to_js_script_rewriter

example/web/index.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33

44
<!DOCTYPE html>
55
<html>
6-
<head>
6+
<head>
77
<title>toastino</title>
88
<meta charset="utf-8">
99
<meta name="viewport" content="width=device-width, initial-scale=1">
1010
<script defer src="main.dart" type="application/dart"></script>
1111
<script defer src="packages/browser/dart.js"></script>
1212
<link rel="stylesheet" href="styles.css">
1313
<link rel="icon" type="image/png" href="favicon.png">
14-
</head>
15-
<body>
16-
<toastino-example>Loading...</toastino-example>
17-
</body>
14+
</head>
15+
<body>
16+
<toastino-example>Loading...</toastino-example>
17+
</body>
1818
</html>

example/web/main.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) 2017, Marco Bramini, Qurami. All rights reserved. Use of this source code
22
// is governed by a BSD-style license that can be found in the LICENSE file.
33

4-
import 'package:angular2/platform/browser.dart';
4+
import 'package:angular/angular.dart';
55

66
import 'package:toastino_example/toastino_example_component.dart';
77

lib/src/toast_component.css

+22-15
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
:host {
66
display: flex;
77
position: fixed;
8-
bottom:0;
8+
bottom: 0;
99
left: 0;
10-
right:0;
10+
right: 0;
1111
justify-content: flex-start;
1212
align-items: center;
1313
width: 100%;
@@ -22,13 +22,14 @@
2222
animation-duration: 600ms;
2323
}
2424
}
25+
2526
@media screen and (min-width: 650px) {
2627
:host {
2728
display: flex;
2829
position: fixed;
2930
bottom: 0;
3031
left: 0;
31-
right:0;
32+
right: 0;
3233
justify-content: flex-start;
3334
align-items: center;
3435
height: 8%;
@@ -45,19 +46,25 @@
4546
animation-duration: 600ms;
4647
}
4748
}
48-
@-webkit-keyframes show {
49-
from{bottom:-10%; opacity: 0}
50-
to{bottom:0; opacity: 1}
51-
}
49+
5250
@keyframes show {
53-
from{bottom:-10%; opacity: 0}
54-
to{bottom:0; opacity: 1}
55-
}
56-
@-webkit-keyframes hide {
57-
from{bottom:0; opacity: 1}
58-
to{bottom:-10%; opacity: 0}
51+
from {
52+
bottom: -10%;
53+
opacity: 0
54+
}
55+
to {
56+
bottom: 0;
57+
opacity: 1
58+
}
5959
}
60+
6061
@keyframes hide {
61-
from{bottom:0; opacity: 1}
62-
to{bottom:-10%; opacity: 0}
62+
from {
63+
bottom: 0;
64+
opacity: 1
65+
}
66+
to {
67+
bottom: -10%;
68+
opacity: 0
69+
}
6370
}

lib/src/toast_component.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,19 @@
22
// BSD-style license that can be found in the LICENSE file.
33

44
import 'dart:core';
5-
import 'package:angular2/core.dart';
5+
6+
import 'package:angular/angular.dart';
67

78
/// A Toast component.
89
/// It's used to display a toast.
910
///
1011
/// [ToastComponent]'s [_position] affects the host's bottom property.
1112
///
12-
13-
@Component(selector: 'toast', template: '{{title}}', styleUrls: const [
14-
'toast_component.css'
15-
], host: const {
16-
'[style.animation-name]': 'animation'
17-
})
13+
@Component(
14+
selector: 'toast',
15+
template: '{{title}}',
16+
styleUrls: const ['toast_component.css'],
17+
host: const {'[style.animation-name]': 'animation'})
1818
class ToastComponent {
1919
String _title;
2020

@@ -38,4 +38,4 @@ class ToastComponent {
3838
void hide() {
3939
_animation = "hide";
4040
}
41-
}
41+
}

lib/src/toast_manager_component.dart

+9-10
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// Copyright (c) 2017, Marco Bramini, Qurami. All rights reserved. Use of this source code is governed by a
22
// BSD-style license that can be found in the LICENSE file.
33
import 'dart:async';
4-
import 'package:angular2/core.dart';
54
import 'dart:core';
6-
import 'package:angular2/angular2.dart';
75

6+
import 'package:angular/angular.dart';
7+
import 'package:angular/core.dart';
88
import 'package:toastino/src/toast_component.dart';
99

1010
/// A Toast manager component.
@@ -17,20 +17,18 @@ import 'package:toastino/src/toast_component.dart';
1717
///
1818
/// ToastManagerComponent _toastManager;
1919
///
20-
/// ToastinoExampleComponent(DynamicComponentLoader toastComponentLoader, ViewContainerRef viewContainerRef){
20+
/// ToastinoExampleComponent(SlowComponentLoader toastComponentLoader, ViewContainerRef viewContainerRef){
2121
/// _toastManager = new ToastManagerComponent(toastComponentLoader, viewContainerRef);
2222
/// }
2323
///
2424
/// void toast(String title){
2525
/// _toastManager.newToast(title, callback: (){print('hi');});
2626
/// }
2727
///
28-
@Component(
29-
selector: 'toast-manager',
30-
template: '<ng-content></ng-content>',
31-
)
28+
@Component(selector: 'toast-manager', template: '<ng-content></ng-content>')
3229
class ToastManagerComponent {
33-
DynamicComponentLoader _toastComponentLoader;
30+
SlowComponentLoader
31+
_toastComponentLoader; // TODO should use faster ComponentLoader
3432

3533
ViewContainerRef _viewContainerRef;
3634

@@ -41,7 +39,7 @@ class ToastManagerComponent {
4139

4240
ComponentRef _activeToastRef;
4341

44-
/// Constructor requires the injection of a [DynamicComponentLoader] and the [ViewContainerRef],
42+
/// Constructor requires the injection of a [SlowComponentLoader] and the [ViewContainerRef],
4543
/// next which new [ToastComponent]s will be appended.
4644
ToastManagerComponent(this._toastComponentLoader, this._viewContainerRef) {
4745
_streamController = new StreamController<String>();
@@ -51,7 +49,8 @@ class ToastManagerComponent {
5149
_stream.listen((String eventType) {
5250
if (eventType == "toast_added" && _activeToastRef == null)
5351
loadNextToast();
54-
else if (eventType == "toast_removed" && _toastsQueue.length > 0) loadNextToast();
52+
else if (eventType == "toast_removed" && _toastsQueue.length > 0)
53+
loadNextToast();
5554
});
5655
}
5756

lib/toastino.dart

-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
// Copyright (c) 2017, Marco Bramini, Qurami. All rights reserved. Use of this source code is governed by a
22
// BSD-style license that can be found in the LICENSE file.
33

4-
library toastino;
5-
64
export 'src/toast_manager_component.dart';

pubspec.yaml

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
name: toastino
22
description: Toast component written in AngularDart. Provides clear and easy to use notifying system.
3-
version: 0.0.1
3+
version: 0.1.0
44
author: Marco Bramini, Qurami <marco.bramini@qurami.com>
5+
56
dependencies:
6-
angular2: ^3.1.0
7-
dart_to_js_script_rewriter: "^1.0.3"
7+
angular: ^4.0.0
8+
89
transformers:
9-
- angular2:
10-
platform_directives:
11-
- 'package:angular2/common.dart#COMMON_DIRECTIVES'
12-
platform_pipes:
13-
- 'package:angular2/common.dart#COMMON_PIPES'
14-
- dart_to_js_script_rewriter
10+
- angular

0 commit comments

Comments
 (0)