| 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 .empathize { |
| 60 font-style: italic; |
| 61 } |
| 62 eval-box-wrapped .indent { |
| 63 margin-left: 1.5em; |
| 64 font: 400 14px 'Montserrat', sans-serif; |
| 65 line-height: 150%; |
| 66 } |
| 67 eval-box-wrapped .stackTraceBox { |
| 68 margin-left: 1.5em; |
| 69 background-color: #f5f5f5; |
| 70 border: 1px solid #ccc; |
| 71 padding: 10px; |
| 72 font-family: consolas, courier, monospace; |
| 73 font-size: 12px; |
| 74 white-space: pre; |
| 75 overflow-x: auto; |
| 76 } |
| 77 eval-box-wrapped .heading { |
| 78 line-height: 30px; |
| 79 position: relative; |
| 80 box-sizing: border-box; |
| 81 width: 100%; |
| 82 min-width: 450px; |
| 83 padding-right: 150px; |
| 84 } |
| 85 eval-box-wrapped .heading .textbox { |
| 86 width: 100%; |
| 87 min-width: 300px; |
| 88 } |
| 89 eval-box-wrapped .heading .buttons { |
| 90 position: absolute; |
| 91 top: 0; |
| 92 right: 0px; |
| 93 } |
| 94 eval-box-wrapped.historyExpr, |
| 95 eval-box-wrapped .historyValue { |
| 96 vertical-align: text-top; |
| 97 font: 400 14px 'Montserrat', sans-serif; |
| 98 } |
| 99 eval-box-wrapped .historyExpr button { |
| 100 display: block; |
| 101 color: black; |
| 102 border: none; |
| 103 background: none; |
| 104 text-decoration: none; |
| 105 padding: 6px 6px; |
| 106 cursor: pointer; |
| 107 white-space: pre-line; |
| 108 } |
| 109 eval-box-wrapped .historyExpr button:hover { |
| 110 background-color: #fff3e3; |
| 111 } |
| 112 eval-box-wrapped .historyValue { |
| 113 display: block; |
| 114 padding: 6px 6px; |
| 115 } |
| 116 eval-box-wrapped .historyDelete button { |
| 117 border: none; |
| 118 background: none; |
| 119 } |
| 120 eval-box-wrapped .historyDelete button:hover { |
| 121 color: #BB3311; |
| 122 } |
| 123 ''', |
| 124 new EvalBoxElement(_context.isolate, _context, |
| 125 new InstanceRepository(), |
| 126 new EvalRepository(), |
| 127 queue: ObservatoryApplication.app.queue) |
| 128 ]; |
| 129 } |
| 130 } |
| OLD | NEW |