Skip to content

Commit bf0aec4

Browse files
vicbrkirov
authored andcommitted
chore(example): fix examples and cleanup
* update pubspec * ignore .pub folder at any level * (form example): remove a reference to publishAs * (animation example): Do not use shadow DOM * (shadow dom example): use relative CSS urls
1 parent a3ff5cf commit bf0aec4

13 files changed

+26
-34
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ docs.angulardart.org
1919
dartdoc-viewer
2020
docs
2121
/e2e_bin
22-
/.pub
22+
.pub
2323
*.orig

example/pubspec.lock

-4
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ packages:
6767
description: pool
6868
source: hosted
6969
version: "1.0.1"
70-
quiver:
71-
description: quiver
72-
source: hosted
73-
version: "0.18.2"
7470
route_hierarchical:
7571
description: route_hierarchical
7672
source: hosted

example/pubspec.yaml

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ dependencies:
44
angular:
55
path: ../
66
browser: any
7-
quiver: '>=0.18.0<0.19.0'
87
unittest: any
98
web_components: any
109

example/web/animation/css_demo.dart

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ part of animation;
22

33
@Component(
44
selector: 'css-demo',
5+
useShadowDom: false,
56
template: '''
67
<div class="css-demo">
78
<button ng-click="stateA = !stateA"

example/web/animation/stress_demo.dart

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ part of animation;
22

33
@Component(
44
selector: 'stress-demo',
5+
useShadowDom: false,
56
template: '''
67
<div class="stress-demo">
78
<button ng-click="visible = !visible">

example/web/css/shadow_dom_bracket.css

+4
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,8 @@
22
:host {
33
border-top: 2px solid white;
44
border-bottom: 2px solid white;
5+
-webkit-user-select: none;
6+
-moz-user-select: none;
7+
-ms-user-select: none;
8+
user-select: none;
59
}

example/web/form.dart

-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import 'package:angular/application_factory.dart';
44
@Component(
55
selector: '[form-controller]',
66
templateUrl: 'form_controller.html',
7-
publishAs: 'form_ctrl',
87
useShadowDom: false)
98
class FormCtrl {
109
static const String _COLOR_HEX = "hex";

example/web/maps.dart

+3-4
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ class XGoogleMaps implements ShadowRootAware {
4747
}
4848

4949
main() {
50-
var module = new Module()
51-
..bind(XGoogleMaps);
50+
var module = new Module()..bind(XGoogleMaps);
5251

53-
var injector = applicationFactory().addModule(module)
52+
var injector = applicationFactory()
53+
.addModule(module)
5454
.run();
55-
var scope = injector.get(Scope);
5655
}

example/web/paper.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ import 'package:angular/application_factory.dart';
33

44

55
main() {
6-
var injector = applicationFactory()
7-
.run();
6+
var injector = applicationFactory().run();
87
var scope = injector.get(Scope);
98
scope.context['text'] = "Hello future";
109
scope.context['max'] = 20;

example/web/paper_input.dart

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ class PaperInputBindings {}
1212

1313
main() {
1414
applicationFactory()
15-
.addModule(new Module()
16-
..bind(PaperInputBindings))
15+
.addModule(new Module()..bind(PaperInputBindings))
1716
.run();
1817
}

example/web/shadow_dom_components.dart

+8-10
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import 'package:angular/application_factory.dart';
44
main() {
55
var app = applicationFactory();
66
app.modules.add(new Module()
7-
..bind(MyComponent)
8-
..bind(BracketButton));
7+
..bind(MyComponent)
8+
..bind(BracketButton));
99
app.selector("body");
1010
app.run();
1111
}
@@ -14,16 +14,14 @@ main() {
1414
selector: "my-component",
1515
template: """
1616
<div class="custom-component" ng-class="color">
17-
<span>Shadow [</span>
18-
<content></content>
19-
<span>]</span>
20-
<a href="#" ng-click="on=!on"><my-button>
21-
Toggle</my-button></a>
17+
<span>Shadow [</span><content></content><span>]</span>
18+
<a ng-click="on=!on">
19+
<my-button>Toggle</my-button></a>
2220
<span ng-if="on">off</span>
2321
<span ng-if="!on">on</span>
2422
</div>
2523
""",
26-
cssUrl: "/css/shadow_dom_components.css")
24+
cssUrl: "css/shadow_dom_components.css")
2725
class MyComponent {
2826
@NgAttr('color')
2927
String color;
@@ -35,6 +33,6 @@ class MyComponent {
3533
selector: "my-button",
3634
template: """<span class="custom-bracket">[[[<content>
3735
</content>]]]</span>""",
38-
cssUrl: "/css/shadow_dom_bracket.css")
36+
cssUrl: "css/shadow_dom_bracket.css")
3937
class BracketButton {
40-
}
38+
}

example/web/shadow_dom_components.html

+6-7
Original file line numberDiff line numberDiff line change
@@ -27,24 +27,22 @@
2727
<div class="content" ng-cloak>
2828
<h1>Hi</h1>
2929

30-
<p>There should be <strong>three</strong> components here. One red,
31-
one green, one blue:</p>
30+
<p>There should be <strong>three</strong> components here. One red, one green, one blue:</p>
3231

3332
<my-component color="red">I'm a red component</my-component>
3433
<my-component color="green">I'm a green component</my-component>
3534
<my-component color="blue">I'm a blue component</my-component>
3635

3736
<br />
38-
<my-component color="grey">I'm a
39-
<span>content span</span></my-component>
37+
<my-component color="grey">I'm a <span>content span</span></my-component>
4038
<br />
39+
4140
<div class="red">I'm just a div with the <code>.red</code> class</div>
4241
<div class="green">I'm just a div with the <code>.green</code> class</div>
4342
<div class="blue">I'm just a div with the <code>.blue</code> class</div>
4443
<br />
45-
<h4>Nesting</h4>
46-
4744

45+
<h4>Nesting</h4>
4846
<my-component color="red">
4947
<my-component color="green">
5048
<my-component color="blue">
@@ -69,7 +67,8 @@ <h4>Nesting</h4>
6967
</my-component>
7068
</my-component>
7169
</div>
70+
7271
<script type="application/dart" src="shadow_dom_components.dart"></script>
7372
<script src="packages/browser/dart.js"></script>
7473
</body>
75-
</html>
74+
</html>

example/web/todo.dart

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import 'package:angular/angular.dart';
66
import 'package:angular/application_factory.dart';
77
import 'package:angular/playback/playback_http.dart';
88

9-
import 'package:quiver/collection.dart';
10-
119
class Item {
1210
String text;
1311
bool done;

0 commit comments

Comments
 (0)