@@ -114,24 +114,31 @@ function getPublicWritableProperties(elementAnalysis) {
114114function createPlainElementDefinition ( packageJson , elementAnalysis ) {
115115 const attributes = [ ...elementAnalysis . attributes , ...additionalAttributes ]
116116 . filter ( ( attribute ) => isWritablePrimitiveAttribute ( elementAnalysis , attribute ) )
117+ . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
117118 . map ( ( attribute ) => ( {
118119 name : attribute . name ,
119120 description : transformDescription ( packageJson , attribute . description ) ,
120121 value : {
121122 type : mapType ( attribute . type ) ,
122123 } ,
123124 } ) ) ;
124- const properties = getPublicWritableProperties ( elementAnalysis ) . map ( ( prop ) => ( {
125- name : prop . name ,
126- description : transformDescription ( packageJson , prop . description ) ,
127- value : {
128- type : mapType ( prop . type ) ,
129- } ,
130- } ) ) ;
131- const events = elementAnalysis . events . map ( ( event ) => ( {
132- name : event . name ,
133- description : transformDescription ( packageJson , event . description ) ,
134- } ) ) ;
125+
126+ const properties = getPublicWritableProperties ( elementAnalysis )
127+ . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
128+ . map ( ( prop ) => ( {
129+ name : prop . name ,
130+ description : transformDescription ( packageJson , prop . description ) ,
131+ value : {
132+ type : mapType ( prop . type ) ,
133+ } ,
134+ } ) ) ;
135+
136+ const events = [ ...elementAnalysis . events ]
137+ . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
138+ . map ( ( event ) => ( {
139+ name : event . name ,
140+ description : transformDescription ( packageJson , event . description ) ,
141+ } ) ) ;
135142
136143 return {
137144 name : elementAnalysis . tagname ,
@@ -162,6 +169,7 @@ function createLitElementDefinition(packageJson, elementAnalysis) {
162169 const publicProperties = getPublicWritableProperties ( elementAnalysis ) ;
163170 const booleanAttributes = publicProperties
164171 . filter ( ( prop ) => prop . type . includes ( 'boolean' ) )
172+ . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
165173 . map ( ( prop ) => ( {
166174 name : `?${ prop . name } ` ,
167175 description : transformDescription ( packageJson , prop . description ) ,
@@ -171,8 +179,10 @@ function createLitElementDefinition(packageJson, elementAnalysis) {
171179 kind : 'expression' ,
172180 } ,
173181 } ) ) ;
182+
174183 const propertyAttributes = publicProperties
175184 . filter ( ( prop ) => ! prop . type . includes ( 'boolean' ) )
185+ . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
176186 . map ( ( prop ) => ( {
177187 name : `.${ prop . name } ` ,
178188 description : transformDescription ( packageJson , prop . description ) ,
@@ -182,15 +192,18 @@ function createLitElementDefinition(packageJson, elementAnalysis) {
182192 kind : 'expression' ,
183193 } ,
184194 } ) ) ;
185- const eventAttributes = elementAnalysis . events . map ( ( event ) => ( {
186- name : `@${ event . name } ` ,
187- description : transformDescription ( packageJson , event . description ) ,
188- value : {
189- // Type checking does not work with template tagged literals
190- // Since this Lit binding should use an expression, just declare it as such
191- kind : 'expression' ,
192- } ,
193- } ) ) ;
195+
196+ const eventAttributes = [ ...elementAnalysis . events ]
197+ . sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
198+ . map ( ( event ) => ( {
199+ name : `@${ event . name } ` ,
200+ description : transformDescription ( packageJson , event . description ) ,
201+ value : {
202+ // Type checking does not work with template tagged literals
203+ // Since this Lit binding should use an expression, just declare it as such
204+ kind : 'expression' ,
205+ } ,
206+ } ) ) ;
194207
195208 return {
196209 name : elementAnalysis . tagname ,
0 commit comments