@@ -663,7 +663,7 @@ function showCurrent(state)
663663 height: 0;
664664 clear: both;
665665}
666- pre.sf-dump span {
666+ pre.sf-dump .sf-dump-ellipsization {
667667 display: inline-flex;
668668}
669669pre.sf-dump a {
@@ -681,16 +681,12 @@ function showCurrent(state)
681681 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAHUlEQVQY02O8zAABilCaiQEN0EeA8QuUcX9g3QEAAjcC5piyhyEAAAAASUVORK5CYII=) #D3D3D3;
682682}
683683pre.sf-dump .sf-dump-ellipsis {
684- display: inline-block;
685- overflow: visible;
686684 text-overflow: ellipsis;
687- max-width: 5em;
688685 white-space: nowrap;
689686 overflow: hidden;
690- vertical-align: top;
691687}
692- pre.sf-dump .sf-dump-ellipsis+.sf-dump-ellipsis {
693- max-width: none ;
688+ pre.sf-dump .sf-dump-ellipsis-tail {
689+ flex-shrink: 0 ;
694690}
695691pre.sf-dump code {
696692 display:inline;
@@ -863,66 +859,75 @@ protected function style(string $style, string $value, array $attr = []): string
863859 return sprintf ('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a> ' , $ this ->dumpId , $ r , 1 + $ attr ['count ' ], $ v );
864860 }
865861
862+ $ dumpClasses = ['sf-dump- ' .$ style ];
863+ $ dumpTitle = '' ;
864+
866865 if ('const ' === $ style && isset ($ attr ['value ' ])) {
867- $ style .= sprintf ( ' title="%s" ' , esc (\is_scalar ($ attr ['value ' ]) ? $ attr ['value ' ] : json_encode ($ attr ['value ' ]) ));
866+ $ dumpTitle = esc (\is_scalar ($ attr ['value ' ]) ? $ attr ['value ' ] : json_encode ($ attr ['value ' ]));
868867 } elseif ('public ' === $ style ) {
869- $ style .= sprintf ( ' title="%s" ' , empty ($ attr ['dynamic ' ]) ? 'Public property ' : 'Runtime added dynamic property ' ) ;
868+ $ dumpTitle = empty ($ attr ['dynamic ' ]) ? 'Public property ' : 'Runtime added dynamic property ' ;
870869 } elseif ('str ' === $ style && 1 < $ attr ['length ' ]) {
871- $ style . = sprintf (' title=" %d%s characters" ' , $ attr ['length ' ], $ attr ['binary ' ] ? ' binary or non-UTF-8 ' : '' );
870+ $ dumpTitle = sprintf ('%d%s characters ' , $ attr ['length ' ], $ attr ['binary ' ] ? ' binary or non-UTF-8 ' : '' );
872871 } elseif ('note ' === $ style && 0 < ($ attr ['depth ' ] ?? 0 ) && false !== $ c = strrpos ($ value , '\\' )) {
873- $ style .= ' title="" ' ;
874872 $ attr += [
875873 'ellipsis ' => \strlen ($ value ) - $ c ,
876874 'ellipsis-type ' => 'note ' ,
877875 'ellipsis-tail ' => 1 ,
878876 ];
879877 } elseif ('protected ' === $ style ) {
880- $ style . = ' title=" Protected property" ' ;
878+ $ dumpTitle = 'Protected property ' ;
881879 } elseif ('meta ' === $ style && isset ($ attr ['title ' ])) {
882- $ style .= sprintf ( ' title="%s" ' , esc ($ this ->utf8Encode ($ attr ['title ' ]) ));
880+ $ dumpTitle = esc ($ this ->utf8Encode ($ attr ['title ' ]));
883881 } elseif ('private ' === $ style ) {
884- $ style . = sprintf (' title=" Private property defined in class: `%s`" ' , esc ($ this ->utf8Encode ($ attr ['class ' ])));
882+ $ dumpTitle = sprintf ('Private property defined in class: `%s`" ' , esc ($ this ->utf8Encode ($ attr ['class ' ])));
885883 }
886884
887885 if (isset ($ attr ['ellipsis ' ])) {
888- $ class = 'sf-dump-ellipsis ' ;
886+ $ dumpClasses [] = 'sf-dump-ellipsization ' ;
887+ $ ellipsisClass = 'sf-dump-ellipsis ' ;
889888 if (isset ($ attr ['ellipsis-type ' ])) {
890- $ class = sprintf ( ' "%s sf-dump-ellipsis-%s" ' , $ class , $ attr ['ellipsis-type ' ]) ;
889+ $ ellipsisClass .= ' sf-dump-ellipsis- ' . $ attr ['ellipsis-type ' ];
891890 }
892891 $ label = esc (substr ($ value , -$ attr ['ellipsis ' ]));
893- $ style = str_replace ( ' title=" ' , " title= \" $ v \n", $ style ) ;
894- $ v = sprintf ('<span class=%s >%s</span> ' , $ class , substr ($ v , 0 , -\strlen ($ label )));
892+ $ dumpTitle = $ v . " \n". $ dumpTitle ;
893+ $ v = sprintf ('<span class="%s" >%s</span> ' , $ ellipsisClass , substr ($ v , 0 , -\strlen ($ label )));
895894
896895 if (!empty ($ attr ['ellipsis-tail ' ])) {
897896 $ tail = \strlen (esc (substr ($ value , -$ attr ['ellipsis ' ], $ attr ['ellipsis-tail ' ])));
898- $ v .= sprintf ('<span class=%s >%s</span>%s ' , $ class , substr ($ label , 0 , $ tail ), substr ($ label , $ tail ));
897+ $ v .= sprintf ('<span class="%s" >%s</span><span class="sf-dump-ellipsis-tail">%s</span> ' , $ ellipsisClass , substr ($ label , 0 , $ tail ), substr ($ label , $ tail ));
899898 } else {
900- $ v .= $ label ;
899+ $ v .= sprintf ( ' <span class="sf-dump-ellipsis-tail">%s</span> ' , $ label) ;
901900 }
902901 }
903902
904903 $ map = static ::$ controlCharsMap ;
905- $ v = "<span class=sf-dump- {$ style }> " .preg_replace_callback (static ::$ controlCharsRx , function ($ c ) use ($ map ) {
906- $ s = $ b = '<span class="sf-dump-default ' ;
907- $ c = $ c [$ i = 0 ];
908- if ($ ns = "\r" === $ c [$ i ] || "\n" === $ c [$ i ]) {
909- $ s .= ' sf-dump-ns ' ;
910- }
911- $ s .= '"> ' ;
912- do {
913- if (("\r" === $ c [$ i ] || "\n" === $ c [$ i ]) !== $ ns ) {
914- $ s .= '</span> ' .$ b ;
915- if ($ ns = !$ ns ) {
916- $ s .= ' sf-dump-ns ' ;
917- }
918- $ s .= '"> ' ;
904+ $ v = sprintf (
905+ '<span class=%s%s%1$s%s>%s</span> ' ,
906+ 1 === count ($ dumpClasses ) ? '' : '" ' ,
907+ implode (' ' , $ dumpClasses ),
908+ $ dumpTitle ? ' title=" ' .$ dumpTitle .'" ' : '' ,
909+ preg_replace_callback (static ::$ controlCharsRx , function ($ c ) use ($ map ) {
910+ $ s = $ b = '<span class="sf-dump-default ' ;
911+ $ c = $ c [$ i = 0 ];
912+ if ($ ns = "\r" === $ c [$ i ] || "\n" === $ c [$ i ]) {
913+ $ s .= ' sf-dump-ns ' ;
919914 }
915+ $ s .= '"> ' ;
916+ do {
917+ if (("\r" === $ c [$ i ] || "\n" === $ c [$ i ]) !== $ ns ) {
918+ $ s .= '</span> ' .$ b ;
919+ if ($ ns = !$ ns ) {
920+ $ s .= ' sf-dump-ns ' ;
921+ }
922+ $ s .= '"> ' ;
923+ }
920924
921- $ s .= $ map [$ c [$ i ]] ?? sprintf ('\x%02X ' , \ord ($ c [$ i ]));
922- } while (isset ($ c [++$ i ]));
925+ $ s .= $ map [$ c [$ i ]] ?? sprintf ('\x%02X ' , \ord ($ c [$ i ]));
926+ } while (isset ($ c [++$ i ]));
923927
924- return $ s .'</span> ' ;
925- }, $ v ).'</span> ' ;
928+ return $ s .'</span> ' ;
929+ }, $ v )
930+ );
926931
927932 if (!($ attr ['binary ' ] ?? false )) {
928933 $ v = preg_replace_callback (static ::$ unicodeCharsRx , function ($ c ) {
0 commit comments