@@ -647,7 +647,7 @@ function showCurrent(state)
647647 height: 0;
648648 clear: both;
649649}
650- pre.sf-dump span {
650+ pre.sf-dump .sf-dump-ellipsization {
651651 display: inline-flex;
652652}
653653pre.sf-dump a {
@@ -665,16 +665,12 @@ function showCurrent(state)
665665 background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAHUlEQVQY02O8zAABilCaiQEN0EeA8QuUcX9g3QEAAjcC5piyhyEAAAAASUVORK5CYII=) #D3D3D3;
666666}
667667pre.sf-dump .sf-dump-ellipsis {
668- display: inline-block;
669- overflow: visible;
670668 text-overflow: ellipsis;
671- max-width: 5em;
672669 white-space: nowrap;
673670 overflow: hidden;
674- vertical-align: top;
675671}
676- pre.sf-dump .sf-dump-ellipsis+.sf-dump-ellipsis {
677- max-width: none ;
672+ pre.sf-dump .sf-dump-ellipsis-tail {
673+ flex-shrink: 0 ;
678674}
679675pre.sf-dump code {
680676 display:inline;
@@ -838,66 +834,75 @@ protected function style(string $style, string $value, array $attr = []): string
838834 return sprintf ('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a> ' , $ this ->dumpId , $ r , 1 + $ attr ['count ' ], $ v );
839835 }
840836
837+ $ dumpClasses = ['sf-dump- ' .$ style ];
838+ $ dumpTitle = '' ;
839+
841840 if ('const ' === $ style && isset ($ attr ['value ' ])) {
842- $ style .= sprintf ( ' title="%s" ' , esc (\is_scalar ($ attr ['value ' ]) ? $ attr ['value ' ] : json_encode ($ attr ['value ' ]) ));
841+ $ dumpTitle = esc (\is_scalar ($ attr ['value ' ]) ? $ attr ['value ' ] : json_encode ($ attr ['value ' ]));
843842 } elseif ('public ' === $ style ) {
844- $ style .= sprintf ( ' title="%s" ' , empty ($ attr ['dynamic ' ]) ? 'Public property ' : 'Runtime added dynamic property ' ) ;
843+ $ dumpTitle = empty ($ attr ['dynamic ' ]) ? 'Public property ' : 'Runtime added dynamic property ' ;
845844 } elseif ('str ' === $ style && 1 < $ attr ['length ' ]) {
846- $ style . = sprintf (' title=" %d%s characters" ' , $ attr ['length ' ], $ attr ['binary ' ] ? ' binary or non-UTF-8 ' : '' );
845+ $ dumpTitle = sprintf ('%d%s characters ' , $ attr ['length ' ], $ attr ['binary ' ] ? ' binary or non-UTF-8 ' : '' );
847846 } elseif ('note ' === $ style && 0 < ($ attr ['depth ' ] ?? 0 ) && false !== $ c = strrpos ($ value , '\\' )) {
848- $ style .= ' title="" ' ;
849847 $ attr += [
850848 'ellipsis ' => \strlen ($ value ) - $ c ,
851849 'ellipsis-type ' => 'note ' ,
852850 'ellipsis-tail ' => 1 ,
853851 ];
854852 } elseif ('protected ' === $ style ) {
855- $ style . = ' title=" Protected property" ' ;
853+ $ dumpTitle = 'Protected property ' ;
856854 } elseif ('meta ' === $ style && isset ($ attr ['title ' ])) {
857- $ style .= sprintf ( ' title="%s" ' , esc ($ this ->utf8Encode ($ attr ['title ' ]) ));
855+ $ dumpTitle = esc ($ this ->utf8Encode ($ attr ['title ' ]));
858856 } elseif ('private ' === $ style ) {
859- $ style . = sprintf (' title=" Private property defined in class: `%s`" ' , esc ($ this ->utf8Encode ($ attr ['class ' ])));
857+ $ dumpTitle = sprintf ('Private property defined in class: `%s`" ' , esc ($ this ->utf8Encode ($ attr ['class ' ])));
860858 }
861859
862860 if (isset ($ attr ['ellipsis ' ])) {
863- $ class = 'sf-dump-ellipsis ' ;
861+ $ dumpClasses [] = 'sf-dump-ellipsization ' ;
862+ $ ellipsisClass = 'sf-dump-ellipsis ' ;
864863 if (isset ($ attr ['ellipsis-type ' ])) {
865- $ class = sprintf ( ' "%s sf-dump-ellipsis-%s" ' , $ class , $ attr ['ellipsis-type ' ]) ;
864+ $ ellipsisClass .= ' sf-dump-ellipsis- ' . $ attr ['ellipsis-type ' ];
866865 }
867866 $ label = esc (substr ($ value , -$ attr ['ellipsis ' ]));
868- $ style = str_replace ( ' title=" ' , " title= \" $ v \n", $ style ) ;
869- $ v = sprintf ('<span class=%s >%s</span> ' , $ class , substr ($ v , 0 , -\strlen ($ label )));
867+ $ dumpTitle = $ v . " \n". $ dumpTitle ;
868+ $ v = sprintf ('<span class="%s" >%s</span> ' , $ ellipsisClass , substr ($ v , 0 , -\strlen ($ label )));
870869
871870 if (!empty ($ attr ['ellipsis-tail ' ])) {
872871 $ tail = \strlen (esc (substr ($ value , -$ attr ['ellipsis ' ], $ attr ['ellipsis-tail ' ])));
873- $ v .= sprintf ('<span class=%s >%s</span>%s ' , $ class , substr ($ label , 0 , $ tail ), substr ($ label , $ tail ));
872+ $ v .= sprintf ('<span class="%s" >%s</span><span class="sf-dump-ellipsis-tail">%s</span> ' , $ ellipsisClass , substr ($ label , 0 , $ tail ), substr ($ label , $ tail ));
874873 } else {
875- $ v .= $ label ;
874+ $ v .= sprintf ( ' <span class="sf-dump-ellipsis-tail">%s</span> ' , $ label) ;
876875 }
877876 }
878877
879878 $ map = static ::$ controlCharsMap ;
880- $ v = "<span class=sf-dump- {$ style }> " .preg_replace_callback (static ::$ controlCharsRx , function ($ c ) use ($ map ) {
881- $ s = $ b = '<span class="sf-dump-default ' ;
882- $ c = $ c [$ i = 0 ];
883- if ($ ns = "\r" === $ c [$ i ] || "\n" === $ c [$ i ]) {
884- $ s .= ' sf-dump-ns ' ;
885- }
886- $ s .= '"> ' ;
887- do {
888- if (("\r" === $ c [$ i ] || "\n" === $ c [$ i ]) !== $ ns ) {
889- $ s .= '</span> ' .$ b ;
890- if ($ ns = !$ ns ) {
891- $ s .= ' sf-dump-ns ' ;
892- }
893- $ s .= '"> ' ;
879+ $ v = sprintf (
880+ '<span class=%s%s%1$s%s>%s</span> ' ,
881+ 1 === count ($ dumpClasses ) ? '' : '" ' ,
882+ implode (' ' , $ dumpClasses ),
883+ $ dumpTitle ? ' title=" ' .$ dumpTitle .'" ' : '' ,
884+ preg_replace_callback (static ::$ controlCharsRx , function ($ c ) use ($ map ) {
885+ $ s = $ b = '<span class="sf-dump-default ' ;
886+ $ c = $ c [$ i = 0 ];
887+ if ($ ns = "\r" === $ c [$ i ] || "\n" === $ c [$ i ]) {
888+ $ s .= ' sf-dump-ns ' ;
894889 }
890+ $ s .= '"> ' ;
891+ do {
892+ if (("\r" === $ c [$ i ] || "\n" === $ c [$ i ]) !== $ ns ) {
893+ $ s .= '</span> ' .$ b ;
894+ if ($ ns = !$ ns ) {
895+ $ s .= ' sf-dump-ns ' ;
896+ }
897+ $ s .= '"> ' ;
898+ }
895899
896- $ s .= $ map [$ c [$ i ]] ?? sprintf ('\x%02X ' , \ord ($ c [$ i ]));
897- } while (isset ($ c [++$ i ]));
900+ $ s .= $ map [$ c [$ i ]] ?? sprintf ('\x%02X ' , \ord ($ c [$ i ]));
901+ } while (isset ($ c [++$ i ]));
898902
899- return $ s .'</span> ' ;
900- }, $ v ).'</span> ' ;
903+ return $ s .'</span> ' ;
904+ }, $ v )
905+ );
901906
902907 if (!($ attr ['binary ' ] ?? false )) {
903908 $ v = preg_replace_callback (static ::$ unicodeCharsRx , function ($ c ) {
0 commit comments