Skip to content

Commit

Permalink
change(components): disable shadow dom
Browse files Browse the repository at this point in the history
Disable shadow DOM:
- it causes some issues when compiled to JS
- it does not play nicely with Bootstrap
- most likely will be off in production because of performance issues with the shadow_dom polyfill
  • Loading branch information
vsavkin committed May 16, 2014
1 parent 89057fa commit b13679d
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 30 deletions.
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,19 @@ If you have any data in your local storage the application may not work as expec

## To do

* Transclusion
* Validations
* Application state management
* Shadow DOM
* Use factory, value, CreationStrategy, and Visibility

## Index

* Working with Shadow DOM => `toggle.html` and `toggle_component.dart`
* Building a component => `agenda.html`, `agenda_item.html`, , `agenda_component.dart`, `agenda_component_input.dart`
* Building components => `agenda.html`, `agenda_item.html`, `agenda_component.dart`, `agenda_component_input.dart`
* Building decorators => `toggle.dart`, `agenda_item_text_input.dart`
* Setting up route (including default) => `app_route_initializer.dart`
* Nested routes and nested views => `list.html`, and `app_route_initializer.dart`
* Using RouteProvider => `show_call_ctrl.dart`
* Using filters => `agenda.html` and `list.html`
* Using formatters => `agenda.html` and `list.html`
* Registering components, controllers, and other injectables => talk_to_me.dart
* Creating services => `parse_agenda_item.dart`, `storage.dart`
* Using the Http service => `users_repository.dart`
Expand Down
2 changes: 1 addition & 1 deletion lib/components/agenda_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ part of talk_to_me;
selector: 'agenda',
templateUrl: 'lib:components/agenda.html',
publishAs: 'ctrl',
applyAuthorStyles: true
useShadowDom: false
)
class AgendaComponent {
@NgOneWayOneTime("checkable")
Expand Down
2 changes: 1 addition & 1 deletion lib/components/agenda_item_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ part of talk_to_me;
@Component(
selector: 'agenda-item',
templateUrl: 'lib:components/agenda_item.html',
applyAuthorStyles: true,
useShadowDom: false,
publishAs: 'ctrl'
)
class AgendaItemComponent {
Expand Down
2 changes: 1 addition & 1 deletion lib/components/call_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ part of talk_to_me;
selector: 'call',
templateUrl: 'lib:components/call.html',
publishAs: 'ctrl',
applyAuthorStyles: true
useShadowDom: false
)
class CallComponent implements AttachAware {
Object videoSrc;
Expand Down
2 changes: 1 addition & 1 deletion lib/components/global_alert_component.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ part of talk_to_me;
selector: 'global-alert',
templateUrl: 'lib:components/global_alert.html',
publishAs: 'ctrl',
applyAuthorStyles: true
useShadowDom: false
)
class GlobalAlertComponent {
String message;
Expand Down
7 changes: 0 additions & 7 deletions lib/components/toggle.html

This file was deleted.

11 changes: 0 additions & 11 deletions lib/components/toggle_component.dart

This file was deleted.

30 changes: 30 additions & 0 deletions lib/decorators/toggle.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
part of talk_to_me;

@Decorator(selector: 'toggle')
class Toggle implements AttachAware {
@NgTwoWay("toggle-property")
bool open = false;

html.Element el;
Scope scope;

Toggle(this.el, this.scope);

void attach() {
final whenOpen = el.querySelector("when-open");
final whenClosed = el.querySelector("when-closed");

whenOpen.hidden = true;
whenClosed.hidden = true;

scope.watch("ctrl.open", (newValue, _) {
if(newValue) {
whenOpen.hidden = false;
whenClosed.hidden = true;
} else {
whenOpen.hidden = true;
whenClosed.hidden = false;
}
});
}
}
4 changes: 2 additions & 2 deletions lib/talk_to_me.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ part 'talk_to_me_route_initializer.dart';
part 'global_http_interceptors.dart';

part 'decorators/agenda_item_text_input.dart';
part 'decorators/toggle.dart';

part 'components/toggle_component.dart';
part 'components/call_component.dart';
part 'components/agenda_component.dart';
part 'components/agenda_item_component.dart';
Expand All @@ -46,7 +46,7 @@ class TalkToMeApp extends Module {
type(AgendaItemComponent);
type(AgendaComponent);
type(CallComponent);
type(ToggleComponent);
type(Toggle);

type(CallSerializer);
type(CallStorage);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/agenda_item_component_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ compileComponent(String html, Map scope, callback){

digest();

callback(el.shadowRoot);
callback(el);
});
});
}
Expand Down
1 change: 0 additions & 1 deletion web/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ <h1><a href="#">Talk to Me!</a></h1>
</div>
</div>

<script src="packages/shadow_dom/shadow_dom.debug.js"></script>
<script type="application/dart" src="talk_to_me_main.dart"></script>
<script src="packages/browser/dart.js"></script>
</body>
Expand Down

0 comments on commit b13679d

Please sign in to comment.