@@ -647,7 +647,7 @@ function showCurrent(state)
647
647
height: 0;
648
648
clear: both;
649
649
}
650
- pre.sf-dump span {
650
+ pre.sf-dump .sf-dump-ellipsization {
651
651
display: inline-flex;
652
652
}
653
653
pre.sf-dump a {
@@ -665,16 +665,12 @@ function showCurrent(state)
665
665
background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAHUlEQVQY02O8zAABilCaiQEN0EeA8QuUcX9g3QEAAjcC5piyhyEAAAAASUVORK5CYII=) #D3D3D3;
666
666
}
667
667
pre.sf-dump .sf-dump-ellipsis {
668
- display: inline-block;
669
- overflow: visible;
670
668
text-overflow: ellipsis;
671
- max-width: 5em;
672
669
white-space: nowrap;
673
670
overflow: hidden;
674
- vertical-align: top;
675
671
}
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 ;
678
674
}
679
675
pre.sf-dump code {
680
676
display:inline;
@@ -838,66 +834,75 @@ protected function style(string $style, string $value, array $attr = []): string
838
834
return sprintf ('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a> ' , $ this ->dumpId , $ r , 1 + $ attr ['count ' ], $ v );
839
835
}
840
836
837
+ $ dumpClasses = ['sf-dump- ' .$ style ];
838
+ $ dumpTitle = '' ;
839
+
841
840
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 ' ]));
843
842
} 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 ' ;
845
844
} 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 ' : '' );
847
846
} elseif ('note ' === $ style && 0 < ($ attr ['depth ' ] ?? 0 ) && false !== $ c = strrpos ($ value , '\\' )) {
848
- $ style .= ' title="" ' ;
849
847
$ attr += [
850
848
'ellipsis ' => \strlen ($ value ) - $ c ,
851
849
'ellipsis-type ' => 'note ' ,
852
850
'ellipsis-tail ' => 1 ,
853
851
];
854
852
} elseif ('protected ' === $ style ) {
855
- $ style . = ' title=" Protected property" ' ;
853
+ $ dumpTitle = 'Protected property ' ;
856
854
} elseif ('meta ' === $ style && isset ($ attr ['title ' ])) {
857
- $ style .= sprintf ( ' title="%s" ' , esc ($ this ->utf8Encode ($ attr ['title ' ]) ));
855
+ $ dumpTitle = esc ($ this ->utf8Encode ($ attr ['title ' ]));
858
856
} 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 ' ])));
860
858
}
861
859
862
860
if (isset ($ attr ['ellipsis ' ])) {
863
- $ class = 'sf-dump-ellipsis ' ;
861
+ $ dumpClasses [] = 'sf-dump-ellipsization ' ;
862
+ $ ellipsisClass = 'sf-dump-ellipsis ' ;
864
863
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 ' ];
866
865
}
867
866
$ 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 )));
870
869
871
870
if (!empty ($ attr ['ellipsis-tail ' ])) {
872
871
$ 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 ));
874
873
} else {
875
- $ v .= $ label ;
874
+ $ v .= sprintf ( ' <span class="sf-dump-ellipsis-tail">%s</span> ' , $ label) ;
876
875
}
877
876
}
878
877
879
878
$ 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 ' ;
894
889
}
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
+ }
895
899
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 ]));
898
902
899
- return $ s .'</span> ' ;
900
- }, $ v ).'</span> ' ;
903
+ return $ s .'</span> ' ;
904
+ }, $ v )
905
+ );
901
906
902
907
if (!($ attr ['binary ' ] ?? false )) {
903
908
$ v = preg_replace_callback (static ::$ unicodeCharsRx , function ($ c ) {
0 commit comments