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