File tree Expand file tree Collapse file tree
adev/shared-docs/components/viewers/docs-viewer Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66 --translate-y : clamp (5px , 0.25em , 7px );
77}
88
9+ .docs-rendered.docs-rendered {
10+ opacity : 1 ;
11+ visibility : visible ;
12+ }
13+
914.docs-viewer {
1015 display : flex ;
1116 flex-direction : column ;
1217 padding : 0px ;
1318 box-sizing : border-box ;
1419 padding-inline : var (--layout-padding );
1520
21+ visibility : hidden ;
22+ opacity : 0 ;
23+ transition : opacity 0.2s ease-in-out ;
24+
1625 @include mq .for-large-desktop-down {
1726 container : docs- content / inline-size ;
1827 }
Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ import {
2323 output ,
2424 PendingTasks ,
2525 PLATFORM_ID ,
26+ signal ,
2627 Type ,
28+ untracked ,
2729 ViewContainerRef ,
2830 ViewEncapsulation ,
2931} from '@angular/core' ;
@@ -61,6 +63,7 @@ export const GITHUB_CONTENT_URL = 'https://github.com/angular/angular/blob/main/
6163 host : {
6264 '[class.docs-animate-content]' : 'animateContent' ,
6365 '[class.docs-with-TOC]' : 'hasToc()' ,
66+ '[class.docs-rendered]' : 'isRendered()' ,
6467 } ,
6568} )
6669export class DocViewer {
@@ -81,6 +84,8 @@ export class DocViewer {
8184 private readonly sanitizer = inject ( DomSanitizer ) ;
8285
8386 protected animateContent = false ;
87+ protected isRendered = signal ( false ) ;
88+ protected processTimeout : ReturnType < typeof setTimeout > | undefined ;
8489 private readonly pendingTasks = inject ( PendingTasks ) ;
8590
8691 private readonly isBrowser = isPlatformBrowser ( inject ( PLATFORM_ID ) ) ;
@@ -92,6 +97,13 @@ export class DocViewer {
9297 const removeTask = this . pendingTasks . add ( ) ;
9398 await this . renderContentsAndRunClientSetup ( this . docContent ( ) ) ;
9499 removeTask ( ) ;
100+
101+ if ( ! untracked ( ( ) => this . isRendered ( ) ) ) {
102+ clearTimeout ( this . processTimeout ) ;
103+ this . processTimeout = setTimeout ( ( ) => {
104+ this . isRendered . set ( true ) ;
105+ } , 500 ) ;
106+ }
95107 } ) ;
96108 }
97109
You can’t perform that action at this time.
0 commit comments