@@ -663,7 +663,7 @@ function showCurrent(state)
663
663
height: 0;
664
664
clear: both;
665
665
}
666
- pre.sf-dump span {
666
+ pre.sf-dump .sf-dump-ellipsization {
667
667
display: inline-flex;
668
668
}
669
669
pre.sf-dump a {
@@ -681,16 +681,12 @@ function showCurrent(state)
681
681
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAHUlEQVQY02O8zAABilCaiQEN0EeA8QuUcX9g3QEAAjcC5piyhyEAAAAASUVORK5CYII=) #D3D3D3;
682
682
}
683
683
pre.sf-dump .sf-dump-ellipsis {
684
- display: inline-block;
685
- overflow: visible;
686
684
text-overflow: ellipsis;
687
- max-width: 5em;
688
685
white-space: nowrap;
689
686
overflow: hidden;
690
- vertical-align: top;
691
687
}
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 ;
694
690
}
695
691
pre.sf-dump code {
696
692
display:inline;
@@ -863,66 +859,75 @@ protected function style(string $style, string $value, array $attr = []): string
863
859
return sprintf ('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a> ' , $ this ->dumpId , $ r , 1 + $ attr ['count ' ], $ v );
864
860
}
865
861
862
+ $ dumpClasses = ['sf-dump- ' .$ style ];
863
+ $ dumpTitle = '' ;
864
+
866
865
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 ' ]));
868
867
} 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 ' ;
870
869
} 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 ' : '' );
872
871
} elseif ('note ' === $ style && 0 < ($ attr ['depth ' ] ?? 0 ) && false !== $ c = strrpos ($ value , '\\' )) {
873
- $ style .= ' title="" ' ;
874
872
$ attr += [
875
873
'ellipsis ' => \strlen ($ value ) - $ c ,
876
874
'ellipsis-type ' => 'note ' ,
877
875
'ellipsis-tail ' => 1 ,
878
876
];
879
877
} elseif ('protected ' === $ style ) {
880
- $ style . = ' title=" Protected property" ' ;
878
+ $ dumpTitle = 'Protected property ' ;
881
879
} elseif ('meta ' === $ style && isset ($ attr ['title ' ])) {
882
- $ style .= sprintf ( ' title="%s" ' , esc ($ this ->utf8Encode ($ attr ['title ' ]) ));
880
+ $ dumpTitle = esc ($ this ->utf8Encode ($ attr ['title ' ]));
883
881
} 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 ' ])));
885
883
}
886
884
887
885
if (isset ($ attr ['ellipsis ' ])) {
888
- $ class = 'sf-dump-ellipsis ' ;
886
+ $ dumpClasses [] = 'sf-dump-ellipsization ' ;
887
+ $ ellipsisClass = 'sf-dump-ellipsis ' ;
889
888
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 ' ];
891
890
}
892
891
$ 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 )));
895
894
896
895
if (!empty ($ attr ['ellipsis-tail ' ])) {
897
896
$ 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 ));
899
898
} else {
900
- $ v .= $ label ;
899
+ $ v .= sprintf ( ' <span class="sf-dump-ellipsis-tail">%s</span> ' , $ label) ;
901
900
}
902
901
}
903
902
904
903
$ 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 ' ;
919
914
}
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
+ }
920
924
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 ]));
923
927
924
- return $ s .'</span> ' ;
925
- }, $ v ).'</span> ' ;
928
+ return $ s .'</span> ' ;
929
+ }, $ v )
930
+ );
926
931
927
932
if (!($ attr ['binary ' ] ?? false )) {
928
933
$ v = preg_replace_callback (static ::$ unicodeCharsRx , function ($ c ) {
0 commit comments