@@ -31,6 +31,13 @@ function getWebTypesPackages() {
3131
3232const byName = ( a , b ) => a . name . localeCompare ( b . name ) ;
3333
34+ /**
35+ * The `deprecated` flag or message of a manifest item for its web-types entry.
36+ * @param {{ deprecated?: boolean | string } } item
37+ * @return {{ deprecated?: boolean | string } }
38+ */
39+ const deprecation = ( item ) => ( item . deprecated ? { deprecated : item . deprecated } : { } ) ;
40+
3441/**
3542 * Maps a type such as `'boolean | null | undefined'` into an array of type
3643 * strings, such as `['boolean', 'null', 'undefined']`
@@ -91,6 +98,7 @@ function createPlainElementDefinition(packageJson, elementDeclaration) {
9198 value : {
9299 type : mapType ( attribute . type ) ,
93100 } ,
101+ ...deprecation ( attribute ) ,
94102 } ) ) ;
95103
96104 const properties = getPublicWritableProperties ( elementDeclaration )
@@ -101,16 +109,19 @@ function createPlainElementDefinition(packageJson, elementDeclaration) {
101109 value : {
102110 type : mapType ( prop . type ) ,
103111 } ,
112+ ...deprecation ( prop ) ,
104113 } ) ) ;
105114
106115 const events = ( elementDeclaration . events || [ ] ) . sort ( byName ) . map ( ( event ) => ( {
107116 name : event . name ,
108117 description : transformDescription ( packageJson , event . description || '' ) ,
118+ ...deprecation ( event ) ,
109119 } ) ) ;
110120
111121 return {
112122 name : elementDeclaration . tagName ,
113123 description : transformDescription ( packageJson , elementDeclaration . description || '' ) ,
124+ ...deprecation ( elementDeclaration ) ,
114125 attributes,
115126 js : {
116127 properties,
@@ -136,25 +147,26 @@ function createPlainWebTypes(packageJson, packageElements) {
136147}
137148
138149function createLitElementDefinition ( packageJson , elementDeclaration ) {
139- function toLitAttribute ( name , description ) {
150+ function toLitAttribute ( name , item ) {
140151 return {
141152 name,
142- description : transformDescription ( packageJson , description || '' ) ,
153+ description : transformDescription ( packageJson , item . description || '' ) ,
143154 // Type checking does not work with template tagged literals.
144155 // Since this Lit binding should use an expression, just declare it as such.
145156 value : { kind : 'expression' } ,
157+ ...deprecation ( item ) ,
146158 } ;
147159 }
148160
149161 const publicProperties = getPublicWritableProperties ( elementDeclaration ) ;
150162 const propertyBindings = publicProperties . sort ( byName ) . map ( ( prop ) => {
151163 const prefix = mapType ( prop . type ) . includes ( 'boolean' ) ? '?' : '.' ;
152- return toLitAttribute ( `${ prefix } ${ prop . name } ` , prop . description ) ;
164+ return toLitAttribute ( `${ prefix } ${ prop . name } ` , prop ) ;
153165 } ) ;
154166
155167 const eventBindings = ( elementDeclaration . events || [ ] )
156168 . sort ( byName )
157- . map ( ( event ) => toLitAttribute ( `@${ event . name } ` , event . description ) ) ;
169+ . map ( ( event ) => toLitAttribute ( `@${ event . name } ` , event ) ) ;
158170
159171 return {
160172 name : elementDeclaration . tagName ,
0 commit comments