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 HeapObject; | |
10 import 'package:observatory/src/elements/eval_box.dart'; | |
11 import 'package:observatory/src/elements/helpers/tag.dart'; | |
12 import 'package:observatory/src/elements/shims/binding.dart'; | |
13 | |
14 @bindable | |
15 class EvalBoxElementWrapper extends HtmlElement { | |
16 static const binder = const Binder<EvalBoxElementWrapper>(const { | |
17 'context': #context | |
18 }); | |
19 | |
20 static const tag = const Tag<EvalBoxElementWrapper>('eval-box'); | |
21 | |
22 HeapObject _context; | |
23 | |
24 HeapObject get context => _context; | |
25 | |
26 void set context(HeapObject value) { | |
27 _context = value; | |
28 render(); | |
29 } | |
30 | |
31 EvalBoxElementWrapper.created() : super.created() { | |
32 binder.registerCallback(this); | |
33 createShadowRoot(); | |
34 render(); | |
35 } | |
36 | |
37 @override | |
38 void attached() { | |
39 super.attached(); | |
40 render(); | |
41 } | |
42 | |
43 void render() { | |
44 shadowRoot.children = []; | |
45 if (_context == null) { | |
46 return; | |
47 } | |
48 | |
49 shadowRoot.children = [ | |
50 new StyleElement() | |
51 ..text = ''' | |
52 eval-box-wrapped a[href]:hover { | |
53 text-decoration: underline; | |
54 } | |
55 eval-box-wrapped a[href] { | |
56 color: #0489c3; | |
57 text-decoration: none; | |
58 } | |
59 eval-box-wrapped .quicks > button:hover { | |
60 background-color: transparent; | |
61 border: none; | |
62 text-decoration: underline; | |
63 } | |
64 eval-box-wrapped .quicks > button { | |
65 background-color: transparent; | |
66 border: none; | |
67 color: #0489c3; | |
68 padding: 0; | |
69 margin-right: 1em; | |
70 text-decoration: none; | |
71 } | |
72 eval-box-wrapped .emphasize { | |
73 font-style: italic; | |
74 } | |
75 eval-box-wrapped .indent { | |
76 margin-left: 1.5em; | |
77 font: 400 14px 'Montserrat', sans-serif; | |
78 line-height: 150%; | |
79 } | |
80 eval-box-wrapped .stackTraceBox { | |
81 margin-left: 1.5em; | |
82 background-color: #f5f5f5; | |
83 border: 1px solid #ccc; | |
84 padding: 10px; | |
85 font-family: consolas, courier, monospace; | |
86 font-size: 12px; | |
87 white-space: pre; | |
88 overflow-x: auto; | |
89 } | |
90 eval-box-wrapped .heading { | |
91 line-height: 30px; | |
92 position: relative; | |
93 box-sizing: border-box; | |
94 width: 100%; | |
95 min-width: 450px; | |
96 padding-right: 150px; | |
97 } | |
98 eval-box-wrapped .heading .textbox { | |
99 width: 100%; | |
100 min-width: 300px; | |
101 } | |
102 eval-box-wrapped .heading .buttons { | |
103 position: absolute; | |
104 top: 0; | |
105 right: 0px; | |
106 } | |
107 eval-box-wrapped.historyExpr, | |
108 eval-box-wrapped .historyValue { | |
109 vertical-align: text-top; | |
110 font: 400 14px 'Montserrat', sans-serif; | |
111 } | |
112 eval-box-wrapped .historyExpr button { | |
113 display: block; | |
114 color: black; | |
115 border: none; | |
116 background: none; | |
117 text-decoration: none; | |
118 padding: 6px 6px; | |
119 cursor: pointer; | |
120 white-space: pre-line; | |
121 } | |
122 eval-box-wrapped .historyExpr button:hover { | |
123 background-color: #fff3e3; | |
124 } | |
125 eval-box-wrapped .historyValue { | |
126 display: block; | |
127 padding: 6px 6px; | |
128 } | |
129 eval-box-wrapped .historyDelete button { | |
130 border: none; | |
131 background: none; | |
132 } | |
133 eval-box-wrapped .historyDelete button:hover { | |
134 color: #BB3311; | |
135 } | |
136 ''', | |
137 new EvalBoxElement(_context.isolate, _context, | |
138 new InstanceRepository(), | |
139 new EvalRepository(), | |
140 queue: ObservatoryApplication.app.queue) | |
141 ]; | |
142 } | |
143 } | |
OLD | NEW |