@@ -9,32 +9,15 @@ abstract class HtmlOptions {
9
9
String get toolVersion;
10
10
}
11
11
12
- class Subnav {
13
- final String name;
14
- final String href;
15
-
16
- Subnav (this .name, this .href);
17
-
18
- @override
19
- String toString () => name;
20
- }
21
-
22
12
abstract class TemplateData <T extends Documentable > {
23
13
final PackageGraph packageGraph;
24
14
final HtmlOptions htmlOptions;
25
15
26
- List <Subnav > _subNameItemCache;
27
-
28
16
TemplateData (this .htmlOptions, this .packageGraph);
29
17
30
- List <Category > get displayedCategories => < Category > [];
31
- String get documentation => self.documentation;
32
- String get oneLineDoc => self.oneLineDoc;
33
18
String get title;
34
19
String get layoutTitle;
35
20
String get metaDescription;
36
- String get name => self.name;
37
- String get kind => self is ModelElement ? (self as ModelElement ).kind : null ;
38
21
39
22
List get navLinks;
40
23
List get navLinksWithGenerics => [];
@@ -48,39 +31,19 @@ abstract class TemplateData<T extends Documentable> {
48
31
bool get includeVersion => false ;
49
32
50
33
bool get hasHomepage => false ;
51
- String get homepage => null ;
52
-
53
- bool get hasSubNav => subnavItems.isNotEmpty;
54
-
55
- List <Subnav > get subnavItems {
56
- if (_subNameItemCache == null ) {
57
- _subNameItemCache = getSubNavItems ().toList ();
58
- }
59
- return _subNameItemCache;
60
- }
61
34
62
35
String get htmlBase;
63
36
T get self;
64
37
String get version => htmlOptions.toolVersion;
65
38
String get relCanonicalPrefix => htmlOptions.relCanonicalPrefix;
66
39
67
- Iterable <Subnav > getSubNavItems () => < Subnav > [];
68
-
69
40
String _layoutTitle (String name, String kind, bool isDeprecated) {
70
41
if (isDeprecated) {
71
42
return '<span class="deprecated">${name }</span> ${kind }' ;
72
43
} else {
73
44
return '${name } ${kind }' ;
74
45
}
75
46
}
76
-
77
- Iterable <Subnav > _gatherSubnavForInvokable (ModelElement element) {
78
- if (element.hasSourceCode) {
79
- return [new Subnav ('Source' , '${element .href }#source' )];
80
- } else {
81
- return < Subnav > [];
82
- }
83
- }
84
47
}
85
48
86
49
class PackageTemplateData extends TemplateData <Package > {
@@ -98,21 +61,14 @@ class PackageTemplateData extends TemplateData<Package> {
98
61
@override
99
62
Package get self => package;
100
63
@override
101
- String get layoutTitle => _layoutTitle (package.name, kind, false );
64
+ String get layoutTitle => _layoutTitle (package.name, package. kind, false );
102
65
@override
103
66
String get metaDescription =>
104
67
'${package .name } API docs, for the Dart programming language.' ;
105
- @override
106
- Iterable <Subnav > getSubNavItems () {
107
- return [new Subnav ('Libraries' , '${package .href }#libraries' )];
108
- }
109
68
110
69
@override
111
70
bool get hasHomepage => package.hasHomepage;
112
- @override
113
71
String get homepage => package.homepage;
114
- @override
115
- String get kind => package.kind;
116
72
117
73
/// `null` for packages because they are at the root – not needed
118
74
@override
@@ -141,25 +97,6 @@ class CategoryTemplateData extends TemplateData<Category> {
141
97
142
98
@override
143
99
List get navLinks => [category.package];
144
- @override
145
- Iterable <Subnav > getSubNavItems () sync * {
146
- if (category.hasPublicClasses)
147
- yield new Subnav ('Libraries' , '${category .href }#libraries' );
148
- if (category.hasPublicClasses)
149
- yield new Subnav ('Classes' , '${category .href }#classes' );
150
- if (category.hasPublicConstants)
151
- yield new Subnav ('Constants' , '${category .href }#constants' );
152
- if (category.hasPublicProperties)
153
- yield new Subnav ('Properties' , '${category .href }#properties' );
154
- if (category.hasPublicFunctions)
155
- yield new Subnav ('Functions' , '${category .href }#functions' );
156
- if (category.hasPublicEnums)
157
- yield new Subnav ('Enums' , '${category .href }#enums' );
158
- if (category.hasPublicTypedefs)
159
- yield new Subnav ('Typedefs' , '${category .href }#typedefs' );
160
- if (category.hasPublicExceptions)
161
- yield new Subnav ('Exceptions' , '${category .href }#exceptions' );
162
- }
163
100
164
101
@override
165
102
Category get self => category;
@@ -175,31 +112,12 @@ class LibraryTemplateData extends TemplateData<Library> {
175
112
@override
176
113
String get title => '${library .name } library - Dart API' ;
177
114
@override
178
- String get documentation => library.documentation;
179
- @override
180
115
String get htmlBase => '..' ;
181
116
@override
182
117
String get metaDescription =>
183
118
'${library .name } library API docs, for the Dart programming language.' ;
184
119
@override
185
120
List get navLinks => [packageGraph.defaultPackage];
186
- @override
187
- Iterable <Subnav > getSubNavItems () sync * {
188
- if (library.hasPublicClasses)
189
- yield new Subnav ('Classes' , '${library .href }#classes' );
190
- if (library.hasPublicConstants)
191
- yield new Subnav ('Constants' , '${library .href }#constants' );
192
- if (library.hasPublicProperties)
193
- yield new Subnav ('Properties' , '${library .href }#properties' );
194
- if (library.hasPublicFunctions)
195
- yield new Subnav ('Functions' , '${library .href }#functions' );
196
- if (library.hasPublicEnums)
197
- yield new Subnav ('Enums' , '${library .href }#enums' );
198
- if (library.hasPublicTypedefs)
199
- yield new Subnav ('Typedefs' , '${library .href }#typedefs' );
200
- if (library.hasPublicExceptions)
201
- yield new Subnav ('Exceptions' , '${library .href }#exceptions' );
202
- }
203
121
204
122
@override
205
123
String get layoutTitle =>
@@ -250,23 +168,6 @@ class ClassTemplateData<T extends Class> extends TemplateData<T> {
250
168
List get navLinks => [packageGraph.defaultPackage, library];
251
169
@override
252
170
String get htmlBase => '..' ;
253
- @override
254
- Iterable <Subnav > getSubNavItems () sync * {
255
- if (clazz.hasPublicConstructors)
256
- yield new Subnav ('Constructors' , '${clazz .href }#constructors' );
257
- if (clazz.hasPublicProperties)
258
- yield new Subnav ('Properties' , '${clazz .href }#instance-properties' );
259
- if (clazz.hasPublicMethods)
260
- yield new Subnav ('Methods' , '${clazz .href }#instance-methods' );
261
- if (clazz.hasPublicOperators)
262
- yield new Subnav ('Operators' , '${clazz .href }#operators' );
263
- if (clazz.hasPublicStaticProperties)
264
- yield new Subnav ('Static Properties' , '${clazz .href }#static-properties' );
265
- if (clazz.hasPublicStaticMethods)
266
- yield new Subnav ('Static Methods' , '${clazz .href }#static-methods' );
267
- if (clazz.hasPublicConstants)
268
- yield new Subnav ('Constants' , '${clazz .href }#constants' );
269
- }
270
171
271
172
Class get objectType {
272
173
if (_objectType != null ) {
@@ -303,7 +204,6 @@ class ConstructorTemplateData extends TemplateData<Constructor> {
303
204
@override
304
205
List get navLinksWithGenerics => [clazz];
305
206
@override
306
- Iterable <Subnav > getSubNavItems () => _gatherSubnavForInvokable (constructor);
307
207
@override
308
208
String get htmlBase => '../..' ;
309
209
@override
@@ -324,13 +224,6 @@ class EnumTemplateData extends ClassTemplateData<Enum> {
324
224
Enum get eNum => clazz;
325
225
@override
326
226
Enum get self => eNum;
327
- @override
328
- Iterable <Subnav > getSubNavItems () => [
329
- new Subnav ('Constants' , '${eNum .href }#constants' ),
330
- new Subnav ('Properties' , '${eNum .href }#instance-properties' ),
331
- new Subnav ('Methods' , '${eNum .href }#instance-methods' ),
332
- new Subnav ('Operators' , '${eNum .href }#operators' )
333
- ];
334
227
}
335
228
336
229
class FunctionTemplateData extends TemplateData <ModelFunction > {
@@ -356,8 +249,6 @@ class FunctionTemplateData extends TemplateData<ModelFunction> {
356
249
@override
357
250
List get navLinks => [packageGraph.defaultPackage, library];
358
251
@override
359
- Iterable <Subnav > getSubNavItems () => _gatherSubnavForInvokable (function);
360
- @override
361
252
String get htmlBase => '..' ;
362
253
}
363
254
@@ -387,8 +278,6 @@ class MethodTemplateData extends TemplateData<Method> {
387
278
@override
388
279
List get navLinksWithGenerics => [clazz];
389
280
@override
390
- Iterable <Subnav > getSubNavItems () => _gatherSubnavForInvokable (method);
391
- @override
392
281
String get htmlBase => '../..' ;
393
282
}
394
283
@@ -458,8 +347,6 @@ class TypedefTemplateData extends TemplateData<Typedef> {
458
347
List get navLinks => [packageGraph.defaultPackage, library];
459
348
@override
460
349
String get htmlBase => '..' ;
461
- @override
462
- Iterable <Subnav > getSubNavItems () => _gatherSubnavForInvokable (typeDef);
463
350
}
464
351
465
352
class TopLevelPropertyTemplateData extends TemplateData <TopLevelVariable > {
0 commit comments