@@ -649,7 +649,7 @@ function showCurrent(state)
649649 height: 0;
650650 clear: both;
651651}
652- pre.sf-dump span {
652+ pre.sf-dump .sf-dump-ellipsization {
653653 display: inline-flex;
654654}
655655pre.sf-dump a {
@@ -667,16 +667,12 @@ function showCurrent(state)
667667 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAHUlEQVQY02O8zAABilCaiQEN0EeA8QuUcX9g3QEAAjcC5piyhyEAAAAASUVORK5CYII=) #D3D3D3;
668668}
669669pre.sf-dump .sf-dump-ellipsis {
670- display: inline-block;
671- overflow: visible;
672670 text-overflow: ellipsis;
673- max-width: 5em;
674671 white-space: nowrap;
675672 overflow: hidden;
676- vertical-align: top;
677673}
678- pre.sf-dump .sf-dump-ellipsis+.sf-dump-ellipsis {
679- max-width: none ;
674+ pre.sf-dump .sf-dump-ellipsis-tail {
675+ flex-shrink: 0 ;
680676}
681677pre.sf-dump code {
682678 display:inline;
@@ -840,66 +836,75 @@ protected function style(string $style, string $value, array $attr = []): string
840836 return \sprintf ('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a> ' , $ this ->dumpId , $ r , 1 + $ attr ['count ' ], $ v );
841837 }
842838
839+ $ dumpClasses = ['sf-dump- ' .$ style ];
840+ $ dumpTitle = '' ;
841+
843842 if ('const ' === $ style && isset ($ attr ['value ' ])) {
844- $ style .= \sprintf ( ' title="%s" ' , esc (\is_scalar ($ attr ['value ' ]) ? $ attr ['value ' ] : json_encode ($ attr ['value ' ]) ));
843+ $ dumpTitle = esc (\is_scalar ($ attr ['value ' ]) ? $ attr ['value ' ] : json_encode ($ attr ['value ' ]));
845844 } elseif ('public ' === $ style ) {
846- $ style .= \sprintf ( ' title="%s" ' , empty ($ attr ['dynamic ' ]) ? 'Public property ' : 'Runtime added dynamic property ' ) ;
845+ $ dumpTitle = empty ($ attr ['dynamic ' ]) ? 'Public property ' : 'Runtime added dynamic property ' ;
847846 } elseif ('str ' === $ style && 1 < $ attr ['length ' ]) {
848- $ style . = \sprintf (' title=" %d%s characters" ' , $ attr ['length ' ], $ attr ['binary ' ] ? ' binary or non-UTF-8 ' : '' );
847+ $ dumpTitle = \sprintf ('%d%s characters ' , $ attr ['length ' ], $ attr ['binary ' ] ? ' binary or non-UTF-8 ' : '' );
849848 } elseif ('note ' === $ style && 0 < ($ attr ['depth ' ] ?? 0 ) && false !== $ c = strrpos ($ value , '\\' )) {
850- $ style .= ' title="" ' ;
851849 $ attr += [
852850 'ellipsis ' => \strlen ($ value ) - $ c ,
853851 'ellipsis-type ' => 'note ' ,
854852 'ellipsis-tail ' => 1 ,
855853 ];
856854 } elseif ('protected ' === $ style ) {
857- $ style . = ' title=" Protected property" ' ;
855+ $ dumpTitle = 'Protected property ' ;
858856 } elseif ('meta ' === $ style && isset ($ attr ['title ' ])) {
859- $ style .= \sprintf ( ' title="%s" ' , esc ($ this ->utf8Encode ($ attr ['title ' ]) ));
857+ $ dumpTitle = esc ($ this ->utf8Encode ($ attr ['title ' ]));
860858 } elseif ('private ' === $ style ) {
861- $ style . = \sprintf (' title=" Private property defined in class: `%s`" ' , esc ($ this ->utf8Encode ($ attr ['class ' ])));
859+ $ dumpTitle = \sprintf ('Private property defined in class: `%s`" ' , esc ($ this ->utf8Encode ($ attr ['class ' ])));
862860 }
863861
864862 if (isset ($ attr ['ellipsis ' ])) {
865- $ class = 'sf-dump-ellipsis ' ;
863+ $ dumpClasses [] = 'sf-dump-ellipsization ' ;
864+ $ ellipsisClass = 'sf-dump-ellipsis ' ;
866865 if (isset ($ attr ['ellipsis-type ' ])) {
867- $ class = \sprintf ( ' "%s sf-dump-ellipsis-%s" ' , $ class , $ attr ['ellipsis-type ' ]) ;
866+ $ ellipsisClass .= ' sf-dump-ellipsis- ' . $ attr ['ellipsis-type ' ];
868867 }
869868 $ label = esc (substr ($ value , -$ attr ['ellipsis ' ]));
870- $ style = str_replace ( ' title=" ' , " title= \" $ v \n", $ style ) ;
871- $ v = \ sprintf ('<span class=%s >%s</span> ' , $ class , substr ($ v , 0 , -\strlen ($ label )));
869+ $ dumpTitle = $ v . " \n". $ dumpTitle ;
870+ $ v = sprintf ('<span class="%s" >%s</span> ' , $ ellipsisClass , substr ($ v , 0 , -\strlen ($ label )));
872871
873872 if (!empty ($ attr ['ellipsis-tail ' ])) {
874873 $ tail = \strlen (esc (substr ($ value , -$ attr ['ellipsis ' ], $ attr ['ellipsis-tail ' ])));
875- $ v .= \ sprintf ('<span class=%s >%s</span>%s ' , $ class , substr ($ label , 0 , $ tail ), substr ($ label , $ tail ));
874+ $ v .= sprintf ('<span class="%s" >%s</span><span class="sf-dump-ellipsis-tail">%s</span> ' , $ ellipsisClass , substr ($ label , 0 , $ tail ), substr ($ label , $ tail ));
876875 } else {
877- $ v .= $ label ;
876+ $ v .= sprintf ( ' <span class="sf-dump-ellipsis-tail">%s</span> ' , $ label) ;
878877 }
879878 }
880879
881880 $ map = static ::$ controlCharsMap ;
882- $ v = "<span class=sf-dump- {$ style }> " .preg_replace_callback (static ::$ controlCharsRx , function ($ c ) use ($ map ) {
883- $ s = $ b = '<span class="sf-dump-default ' ;
884- $ c = $ c [$ i = 0 ];
885- if ($ ns = "\r" === $ c [$ i ] || "\n" === $ c [$ i ]) {
886- $ s .= ' sf-dump-ns ' ;
887- }
888- $ s .= '"> ' ;
889- do {
890- if (("\r" === $ c [$ i ] || "\n" === $ c [$ i ]) !== $ ns ) {
891- $ s .= '</span> ' .$ b ;
892- if ($ ns = !$ ns ) {
893- $ s .= ' sf-dump-ns ' ;
894- }
895- $ s .= '"> ' ;
881+ $ v = sprintf (
882+ '<span class=%s%s%1$s%s>%s</span> ' ,
883+ 1 === count ($ dumpClasses ) ? '' : '" ' ,
884+ implode (' ' , $ dumpClasses ),
885+ $ dumpTitle ? ' title=" ' .$ dumpTitle .'" ' : '' ,
886+ preg_replace_callback (static ::$ controlCharsRx , function ($ c ) use ($ map ) {
887+ $ s = $ b = '<span class="sf-dump-default ' ;
888+ $ c = $ c [$ i = 0 ];
889+ if ($ ns = "\r" === $ c [$ i ] || "\n" === $ c [$ i ]) {
890+ $ s .= ' sf-dump-ns ' ;
896891 }
892+ $ s .= '"> ' ;
893+ do {
894+ if (("\r" === $ c [$ i ] || "\n" === $ c [$ i ]) !== $ ns ) {
895+ $ s .= '</span> ' .$ b ;
896+ if ($ ns = !$ ns ) {
897+ $ s .= ' sf-dump-ns ' ;
898+ }
899+ $ s .= '"> ' ;
900+ }
897901
898- $ s .= $ map [$ c [$ i ]] ?? \sprintf ('\x%02X ' , \ord ($ c [$ i ]));
899- } while (isset ($ c [++$ i ]));
902+ $ s .= $ map [$ c [$ i ]] ?? \sprintf ('\x%02X ' , \ord ($ c [$ i ]));
903+ } while (isset ($ c [++$ i ]));
900904
901- return $ s .'</span> ' ;
902- }, $ v ).'</span> ' ;
905+ return $ s .'</span> ' ;
906+ }, $ v )
907+ );
903908
904909 if (!($ attr ['binary ' ] ?? false )) {
905910 $ v = preg_replace_callback (static ::$ unicodeCharsRx , function ($ c ) {
0 commit comments