Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: client/web/element_summary.html

Issue 11636011: Web components based app to view dart docs. Still has rough edges. (Closed) Base URL: https://github.com/dart-lang/dart-api-app.git@master
Patch Set: Code review fixes Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html><body> 2 <html>
3 <element name="x-doc-link" constructor="DocLink" extends="span"> 3 <head>
4 <link rel="components" href="doc_link.html">
5 </head>
6
7 <body>
8 <element name="x-member-blocks" extends="div">
4 <template> 9 <template>
5 <template instantiate="if ref.refId != 'void'"> 10 <template iterate='block in blocks'>
6 <a href="{{permalink(ref)}}">{{ref.name}}</a> 11 <div>
7 </template> 12 <h3>{{block.kindTitle}}</h3>
8 <template instantiate="if ref.refId == 'void'"> 13 <template iterate='element in block.elements'>
9 {{ref.name}} 14 <x-element-summary element="{{element}}"></x-element-summary>
15 </template>
16 </div>
10 </template> 17 </template>
11 </template> 18 </template>
12 <script type="application/dart"> 19 <script type="application/dart">
13 import 'package:web_ui/web_ui.dart'; 20 import 'package:web_ui/web_ui.dart';
14 import 'ast.dart'; 21 import 'ast.dart';
15 import 'model.dart'; 22 import 'model.dart';
16
17 class DocLink extends WebComponent {
18 /// Must be a Reference or Element.
19 var ref;
20 }
21 </script>
22 </element>
23
24 <element name="x-member-blocks" constructor="MemberBlocks" extends="div">
25 <template>
26 <template iterate='block in blocks'>
27 <div>
28 <h3>{{block.kindTitle}}</h3>
29 <ul>
30 <template iterate='element in block.elements'>
31 <li class="{{kindCssClass(element)}}">
32 <x-element-summary element="{{element}}"></x-element-summary>
33 </li>
34 </template>
35 </ul>
36 </div>
37 </template>
38 </template>
39 <script type="application/dart">
40 // TODO(jacobr): this is kinda a rediculous way to do this
41 import 'package:web_ui/web_ui.dart';
42 import 'ast.dart';
43 import 'model.dart';
44 23
45 class MemberBlocks extends WebComponent { 24 class MemberBlocks extends WebComponent {
46 List<ElementBlock> blocks; 25 List<ElementBlock> blocks;
47 } 26 }
48 </script> 27 </script>
49 </element> 28 </element>
50 29
51 <element name="x-element-signature" constructor="ElementSignature" extends="sp an"> 30 <element name="x-element-signature" extends="span">
52 <template> 31 <template>
53 <span class="element-class"> 32 <span class="element-class">
54 <template instantiate="if (element is MethodElementBase || element is Ty pedefElement) && element.returnType != null"> 33 <template instantiate="if hasReturnType">
55 <x-doc-link ref="{{element.returnType}}"></x-doc-link> 34 <x-doc-link ref="{{element.returnType}}"></x-doc-link>
56 </template> 35 </template>
57 </span> 36 </span>
58 <span class="element-definition"> 37 <span class="element-definition">
59 <span class="element-name"><x-doc-link ref="{{element}}"></x-doc-link></ span> 38 <span class="element-name">
60 <template instantiate="if element is MethodElement || element is Constru ctorElement || element is TypedefElement"> 39 <x-doc-link ref="{{element}}" short="{{true}}"></x-doc-link>
40 </span>
41 <template instantiate="if hasArguments">
61 <span class="args">( 42 <span class="args">(
62 <template iterate="param in element.parameters"> 43 <template iterate="param in element.parameters">
63 <span class="arg"> 44 <span class="arg">
64 <template instantiate="if param.type != null"> 45 <template instantiate="if param.type != null">
65 <span class = "arg-type"> 46 <span class = "arg-type">
Siggi Cherem (dart-lang) 2013/01/02 21:40:55 remove spaces around =
66 <x-doc-link ref="{{param.type}}"></x-doc-link> 47 <x-doc-link ref="{{param.type}}"></x-doc-link>
67 </span> 48 </span>
68 </template> 49 </template>
69 <span class="arg-name">{{param.name}}</span> 50 <span class="arg-name">{{param.name}}</span>
70 </span> 51 </span>
71 </template>) 52 </template>)
72 </span> 53 </span>
73 </template> 54 </template>
74 </span> 55 </span>
75 </template> 56 </template>
76 <script type="application/dart"> 57 <script type="application/dart">
77 import 'package:web_ui/web_ui.dart'; 58 import 'package:web_ui/web_ui.dart';
78 import 'ast.dart'; 59 import 'ast.dart';
79 import 'model.dart'; 60 import 'model.dart';
80 61
81 class ElementSignature extends WebComponent { 62 class ElementSignature extends WebComponent {
82 Element element; 63 Element element;
64
65 bool get hasReturnType =>
66 (element is MethodElementBase || element is TypedefElement)
67 && element.returnType != null;
68
69 bool get hasArguments =>
70 element is MethodElement || element is ConstructorElement
71 || element is TypedefElement;
83 } 72 }
84 </script> 73 </script>
85 </element> 74 </element>
86 75
87 <element name="x-element-summary" constructor="ElementSummary" extends="div"> 76 <element name="x-element-summary" extends="div">
88 <template> 77 <template>
89 <!--TODO(jacobr): use id instead of data-id and use a different escaping s cheme--> 78 <!--TODO(jacobr): use id instead of data-id and use a different escaping s cheme-->
90 <details class="element-details {{(element is MethodElementBase) ? 'member -details' : 'type-details'}}" data-id="{{element.id}}" open="{{currentMember != null && element.id == currentMember.id}}"> 79 <details class="element-details {{kindClass}} {{memberOrTypeClass}}"
91 <summary> 80 data-id="{{element.id}}"
81 open="{{isOpen}}">
82 <summary>
92 <div class="overflow-shadow"></div> 83 <div class="overflow-shadow"></div>
93 <template instantiate="if element is! ClassElement"> 84 <template instantiate="if element is! ClassElement">
94 <x-element-signature element="{{element}}"> 85 <x-element-signature element="{{element}}">
95 </x-element-signature> 86 </x-element-signature>
96 </template> 87 </template>
97 <template instantiate="if element is ClassElement"> 88 <template instantiate="if element is ClassElement">
98 <x-doc-link class="element-name element-definition" ref="{{element}} "></x-doc-link> 89 <x-doc-link class="element-name element-definition"
90 ref="{{element}}">
91 </x-doc-link>
99 </template> 92 </template>
100 <div class="documentation"> 93 <div class="documentation">{{element.commentHtml}}</div>
101 {{element.commentHtml}}
102 </div>
103 </summary> 94 </summary>
104 <details class="extended-element-info"> 95 <details class="extended-element-info">
105 <summary>View ?? comments.</summary> 96 <summary>View ?? comments.</summary>
106 TODO(jacobr): implement. 97 TODO(jacobr): implement.
107 </details> 98 </details>
108 </details> 99 </details>
109 </template> 100 </template>
110 <script type="application/dart"> 101 <script type="application/dart">
111 // TODO(jacobr): this is kinda a rediculous way to do this 102 // TODO(jacobr): this is kinda a rediculous way to do this
112 import 'package:web_ui/web_ui.dart'; 103 import 'package:web_ui/web_ui.dart';
113 import 'ast.dart'; 104 import 'ast.dart';
114 import 'model.dart'; 105 import 'model.dart';
115 106
116 class ElementSummary extends WebComponent { 107 class ElementSummary extends WebComponent {
117 Element element; 108 Element element;
109
110 String get kindClass => kindCssClass(element);
111 String get memberOrTypeClass =>
112 (element is MethodElementBase) ? 'member-details' : 'type-details';
113
114 bool get isOpen =>
115 currentMember != null && element.id == currentMember.id;
118 } 116 }
119 </script> 117 </script>
120 </element> 118 </element>
121 119
122 <element name="x-class-hierarchy-subtree" constructor="ClassHierarchySubtree" extends="div"> 120 <element name="x-class-hierarchy-subtree" extends="div">
123 <template> 121 <template>
124 <template instantiate="if (index < clazz.superclasses.length)"> 122 <template instantiate="if (index < clazz.superclasses.length)">
125 <div><x-doc-link ref={{clazz.superclasses[index]}}></x-doc-link></div> 123 <div><x-doc-link ref={{clazz.superclasses[index]}}></x-doc-link></div>
126 <div style="padding-left: 15px"> 124 <!-- TODO(jacobr): why doesn't it work to just put this class on the
125 x-class-hierarchy-subtree node? -->
126 <div class="child-subtree">
127 <x-class-hierarchy-subtree clazz="{{clazz}}" index="{{index+1}}"> 127 <x-class-hierarchy-subtree clazz="{{clazz}}" index="{{index+1}}">
128 </x-class-hierarchy-subtree> 128 </x-class-hierarchy-subtree>
129 </div> 129 </div>
130 </template> 130 </template>
131 <template instantiate="if index == clazz.superclasses.length"> 131 <template instantiate="if index == clazz.superclasses.length">
132 <div><strong>{{clazz.name}}</strong></div> 132 <div><strong>{{clazz.shortDescription}}</strong></div>
133 </template> 133 </template>
134 </template> 134 </template>
135 <script type="application/dart"> 135 <script type="application/dart">
136 // TODO(jacobr): this is kinda a rediculous way to do this 136 // TODO(jacobr): this is kinda a rediculous way to do this
137 import 'package:web_ui/web_ui.dart'; 137 import 'package:web_ui/web_ui.dart';
138 import 'ast.dart'; 138 import 'ast.dart';
139 import 'model.dart'; 139 import 'model.dart';
140 140
141 class ClassHierarchySubtree extends WebComponent { 141 class ClassHierarchySubtree extends WebComponent {
142 ClassElement clazz; 142 ClassElement clazz;
143 int index; 143 int index;
144 } 144 }
145 </script> 145 </script>
146 </element> 146 </element>
147 147
148 <element name="x-class-hierarchy" constructor="ClassHierarchy" extends="div"> 148 <element name="x-class-hierarchy" extends="div">
149 <template> 149 <template>
150 <x-class-hierarchy-subtree clazz="{{clazz}}" index="{{0}}"> 150 <x-class-hierarchy-subtree clazz="{{clazz}}" index="{{0}}">
151 </x-class-hierarchy-subtree> 151 </x-class-hierarchy-subtree>
152 </template> 152 </template>
153 <script type="application/dart"> 153 <script type="application/dart">
154 import 'package:web_ui/web_ui.dart'; 154 import 'package:web_ui/web_ui.dart';
155 import 'ast.dart'; 155 import 'ast.dart';
156 import 'model.dart'; 156 import 'model.dart';
157 157
158 class ClassHierarchy extends WebComponent { 158 class ClassHierarchy extends WebComponent {
159 ClassElement clazz; 159 ClassElement clazz;
160 } 160 }
161 </script> 161 </script>
162 </element> 162 </element>
163 <!-- more below... -->
164 </body></html> 163 </body></html>
OLDNEW
« client/web/ast.dart ('K') | « client/web/doc_link.html ('k') | client/web/index.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698