@@ -99,7 +99,7 @@ export class DefaultTheme extends Theme {
99
99
return this . getRenderContext ( pageEvent ) . defaultLayout ( template , pageEvent ) ;
100
100
} ;
101
101
102
- getReflectionClasses ( reflection : DeclarationReflection | DocumentReflection ) {
102
+ getReflectionClasses ( reflection : Reflection ) {
103
103
const filters = this . application . options . getValue ( "visibilityFilters" ) as Record < string , boolean > ;
104
104
return getReflectionClasses ( reflection , filters ) ;
105
105
}
@@ -502,46 +502,55 @@ export class DefaultTheme extends Theme {
502
502
}
503
503
}
504
504
505
- function getReflectionClasses (
506
- reflection : DeclarationReflection | DocumentReflection ,
507
- filters : Record < string , boolean > ,
508
- ) {
509
- const classes : string [ ] = [ ] ;
505
+ function getReflectionClasses ( reflection : Reflection , filters : Record < string , boolean > ) {
506
+ const classes = new Set < string > ( ) ;
510
507
511
508
// Filter classes should match up with the settings function in
512
509
// partials/navigation.tsx.
513
510
for ( const key of Object . keys ( filters ) ) {
514
511
if ( key === "inherited" ) {
515
512
if ( reflection . flags . isInherited ) {
516
- classes . push ( "tsd-is-inherited" ) ;
513
+ classes . add ( "tsd-is-inherited" ) ;
517
514
}
518
515
} else if ( key === "protected" ) {
519
516
if ( reflection . flags . isProtected ) {
520
- classes . push ( "tsd-is-protected" ) ;
517
+ classes . add ( "tsd-is-protected" ) ;
521
518
}
522
519
} else if ( key === "private" ) {
523
520
if ( reflection . flags . isPrivate ) {
524
- classes . push ( "tsd-is-private" ) ;
521
+ classes . add ( "tsd-is-private" ) ;
525
522
}
526
523
} else if ( key === "external" ) {
527
524
if ( reflection . flags . isExternal ) {
528
- classes . push ( "tsd-is-external" ) ;
525
+ classes . add ( "tsd-is-external" ) ;
529
526
}
530
527
} else if ( key . startsWith ( "@" ) ) {
531
528
if ( key === "@deprecated" ) {
532
529
if ( reflection . isDeprecated ( ) ) {
533
- classes . push ( toStyleClass ( `tsd-is-${ key . substring ( 1 ) } ` ) ) ;
530
+ classes . add ( toStyleClass ( `tsd-is-${ key . substring ( 1 ) } ` ) ) ;
534
531
}
535
532
} else if (
536
533
reflection . comment ?. hasModifier ( key as `@${string } `) ||
537
534
reflection . comment ?. getTag ( key as `@${string } `)
538
535
) {
539
- classes . push ( toStyleClass ( `tsd-is-${ key . substring ( 1 ) } ` ) ) ;
536
+ classes . add ( toStyleClass ( `tsd-is-${ key . substring ( 1 ) } ` ) ) ;
537
+ } else if ( reflection . isDeclaration ( ) ) {
538
+ const ownSignatures = reflection . getNonIndexSignatures ( ) ;
539
+ // Check methods and accessors, find common tags, elevate
540
+ if (
541
+ ownSignatures . length &&
542
+ ownSignatures . every (
543
+ ( refl ) =>
544
+ refl . comment ?. hasModifier ( key as `@${string } `) || refl . comment ?. getTag ( key as `@${string } `) ,
545
+ )
546
+ ) {
547
+ classes . add ( toStyleClass ( `tsd-is-${ key . substring ( 1 ) } ` ) ) ;
548
+ }
540
549
}
541
550
}
542
551
}
543
552
544
- return classes . join ( " " ) ;
553
+ return Array . from ( classes ) . join ( " " ) ;
545
554
}
546
555
547
556
function shouldShowCategories ( reflection : Reflection , opts : { includeCategories : boolean ; includeGroups : boolean } ) {
0 commit comments