@@ -3,6 +3,7 @@ import {Injectable} from '@angular/core';
33export interface DocItem {
44 id : string ;
55 name : string ;
6+ packageName ?: string ;
67 examples ?: string [ ] ;
78}
89
@@ -107,51 +108,47 @@ const DOCS: {[key: string]: DocCategory[]} = {
107108 }
108109 ] ,
109110 [ CDK ] : [
110- {
111- id : 'components' ,
112- name : 'Components' ,
113- items : [
114- { id : 'table' , name : 'Table' , examples : [ ] } ,
115- { id : 'stepper' , name : 'Stepper' , examples : [ ] } ,
116-
117- ]
118- } ,
119111 {
120112 id : 'component-composition' ,
121- name : 'Component Composition ' ,
113+ name : 'Common Behaviors ' ,
122114 items : [
115+ { id : 'a11y' , name : 'Accessibility' , examples : [ ] } ,
123116 { id : 'observers' , name : 'Observers' , examples : [ ] } ,
124117 { id : 'layout' , name : 'Layout' , examples : [ ] } ,
125118 { id : 'overlay' , name : 'Overlay' , examples : [ ] } ,
126119 { id : 'portal' , name : 'Portal' , examples : [ ] } ,
127120 { id : 'bidi' , name : 'Bidirectionality' , examples : [ ] } ,
128121 { id : 'scrolling' , name : 'Scrolling' , examples : [ ] } ,
129- { id : 'viewport' , name : 'Viewport' , examples : [ ] } ,
130- ]
131- } ,
132- {
133- id : 'utilities' ,
134- name : 'Utilities' ,
135- items : [
136- { id : 'coercion' , name : 'Coercion' , examples : [ ] } ,
137- { id : 'collections' , name : 'Collections' , examples : [ ] } ,
138- { id : 'keycodes' , name : 'Keycodes' , examples : [ ] } ,
139- { id : 'platform' , name : 'Platform' , examples : [ ] } ,
140122 ]
141123 } ,
142124 {
143- id : 'accessibility ' ,
144- name : 'Accessibility ' ,
125+ id : 'components ' ,
126+ name : 'Components ' ,
145127 items : [
146- { id : 'focus-key-manager' , name : 'Focus Key Manager' , examples : [ ] } ,
147- { id : 'focus-trap' , name : 'Focus Trap' , examples : [ ] } ,
148- { id : 'interactivity-checker' , name : 'Interactivity Checker' , examples : [ ] } ,
149- { id : 'list-key-manager' , name : 'List Key Manager' , examples : [ ] } ,
150- { id : 'live-announcer' , name : 'Live Announcer' , examples : [ ] } ,
128+ { id : 'table' , name : 'Table' , examples : [ ] } ,
129+ { id : 'stepper' , name : 'Stepper' , examples : [ ] } ,
130+
151131 ]
152132 } ,
133+ // TODO(jelbourn): re-add utilities and a11y as top-level categories once we can generate
134+ // their API docs with dgeni. Currently our setup doesn't generate API docs for constants
135+ // and standalone functions (much of the utilities) and we have no way of generating API
136+ // docs more granularly than directory-level (within a11y) (same for viewport).
153137 ]
154138} ;
139+
140+ for ( let category of DOCS [ COMPONENTS ] ) {
141+ for ( let doc of category . items ) {
142+ doc . packageName = 'material' ;
143+ }
144+ }
145+
146+ for ( let category of DOCS [ CDK ] ) {
147+ for ( let doc of category . items ) {
148+ doc . packageName = 'cdk' ;
149+ }
150+ }
151+
155152const ALL_COMPONENTS = DOCS [ COMPONENTS ] . reduce (
156153 ( result , category ) => result . concat ( category . items ) , [ ] ) ;
157154const ALL_CDK = DOCS [ CDK ] . reduce ( ( result , cdk ) => result . concat ( cdk . items ) , [ ] ) ;
@@ -174,8 +171,9 @@ export class DocumentationItems {
174171 return [ ] ;
175172 }
176173
177- getItemById ( id : string ) : DocItem {
178- return ALL_DOCS . find ( i => i . id === id ) ;
174+ getItemById ( id : string , section : string ) : DocItem {
175+ const sectionLookup = section == 'cdk' ? 'cdk' : 'material' ;
176+ return ALL_DOCS . find ( doc => doc . id === id && doc . packageName == sectionLookup ) ;
179177 }
180178
181179 getCategoryById ( id : string ) : DocCategory {
0 commit comments