OLD | NEW |
| (Empty) |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | |
2 // for details. All rights reserved. Use of this source code is governed by a | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 import 'dart:html'; | |
6 | |
7 import 'package:observatory/app.dart'; | |
8 import 'package:observatory/repositories.dart'; | |
9 import 'package:observatory/service_html.dart' show Instance; | |
10 import 'package:observatory/src/elements/instance_ref.dart'; | |
11 import 'package:observatory/src/elements/helpers/tag.dart'; | |
12 import 'package:observatory/src/elements/shims/binding.dart'; | |
13 | |
14 @bindable | |
15 class InstanceRefElementWrapper extends HtmlElement { | |
16 | |
17 static const binder = const Binder<InstanceRefElementWrapper>(const { | |
18 'ref': #ref | |
19 }); | |
20 | |
21 static const tag = const Tag<InstanceRefElementWrapper>('instance-ref'); | |
22 | |
23 Instance _instance; | |
24 Instance get ref => _instance; | |
25 void set ref(Instance ref) { | |
26 _instance = ref; | |
27 render(); | |
28 } | |
29 | |
30 InstanceRefElementWrapper.created() : super.created() { | |
31 binder.registerCallback(this); | |
32 createShadowRoot(); | |
33 render(); | |
34 } | |
35 | |
36 @override | |
37 void attached() { | |
38 super.attached(); | |
39 render(); | |
40 } | |
41 | |
42 void render() { | |
43 shadowRoot.children = []; | |
44 if (ref == null) return; | |
45 | |
46 shadowRoot.children = [ | |
47 new StyleElement() | |
48 ..text = ''' | |
49 instance-ref-wrapped a[href]:hover { | |
50 text-decoration: underline; | |
51 } | |
52 instance-ref-wrapped a[href] { | |
53 color: #0489c3; | |
54 text-decoration: none; | |
55 } | |
56 instance-ref-wrapped .emphasize { | |
57 font-style: italic; | |
58 } | |
59 instance-ref-wrapped .indent { | |
60 margin-left: 1.5em; | |
61 font: 400 14px 'Montserrat', sans-serif; | |
62 line-height: 150%; | |
63 } | |
64 instance-ref-wrapped .stackTraceBox { | |
65 margin-left: 1.5em; | |
66 background-color: #f5f5f5; | |
67 border: 1px solid #ccc; | |
68 padding: 10px; | |
69 font-family: consolas, courier, monospace; | |
70 font-size: 12px; | |
71 white-space: pre; | |
72 overflow-x: auto; | |
73 }''', | |
74 new InstanceRefElement(_instance.isolate, _instance, | |
75 new InstanceRepository(), | |
76 queue: ObservatoryApplication.app.queue) | |
77 ]; | |
78 } | |
79 } | |
OLD | NEW |