File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747 } ) ;
4848 document . addEventListener ( "click" , hide , true ) ;
4949} ) ( ) ;
50+
51+ /* Briefly highlight the definition you jump to, so it's easy to spot. */
52+ ( function ( ) {
53+ function flash ( ) {
54+ const id = location . hash ? decodeURIComponent ( location . hash . slice ( 1 ) ) : "" ;
55+ if ( ! id ) return ;
56+ const el = document . getElementById ( id ) ;
57+ if ( ! el ) return ;
58+ const block = el . closest ( "li, p, tr" ) || el ;
59+ block . classList . remove ( "api-target-flash" ) ;
60+ void block . offsetWidth ; // force reflow so the animation restarts on every click
61+ block . classList . add ( "api-target-flash" ) ;
62+ }
63+ document . addEventListener ( "animationend" , function ( e ) {
64+ if ( e . target . classList && e . target . classList . contains ( "api-target-flash" ) ) {
65+ e . target . classList . remove ( "api-target-flash" ) ;
66+ }
67+ } ) ;
68+ window . addEventListener ( "hashchange" , flash ) ;
69+ window . addEventListener ( "load" , flash ) ;
70+ // Material instant navigation swaps content without a reload — re-run then too.
71+ if ( window . document$ && window . document$ . subscribe ) {
72+ window . document$ . subscribe ( function ( ) { setTimeout ( flash , 30 ) ; } ) ;
73+ }
74+ } ) ( ) ;
Original file line number Diff line number Diff line change 3636 line-height : 1.5 ;
3737 pointer-events : none;
3838}
39+
40+ /* Keep a jumped-to definition clear of the sticky header. */
41+ .md-typeset code [id ^= "ref-" ] {
42+ scroll-margin-top : 4rem ;
43+ }
44+
45+ /* Brief highlight flash on the definition you jump to. */
46+ @keyframes api-target-flash {
47+ from {
48+ background-color : rgba (124 , 77 , 162 , 0.4 ); /* fallback */
49+ background-color : color-mix (in srgb, var (--md-accent-fg-color ) 40% , transparent);
50+ }
51+ to {
52+ background-color : transparent;
53+ }
54+ }
55+ .md-typeset .api-target-flash {
56+ animation : api-target-flash 1.8s ease-out;
57+ border-radius : 0.15rem ;
58+ box-decoration-break : clone;
59+ }
You can’t perform that action at this time.
0 commit comments