@@ -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;
@@ -793,7 +789,7 @@ public function dumpString(Cursor $cursor, string $str, bool $bin, int $cut)
793
789
if ('' === $ str && isset ($ cursor ->attr ['img-data ' ], $ cursor ->attr ['content-type ' ])) {
794
790
$ this ->dumpKey ($ cursor );
795
791
$ this ->line .= $ this ->style ('default ' , $ cursor ->attr ['img-size ' ] ?? '' , []);
796
- $ this ->line .= $ cursor ->depth >= $ this ->displayOptions ['maxDepth ' ] ? ' <samp class=sf-dump-compact> ' : ' <samp class=sf-dump-expanded> ' ;
792
+ $ this ->line .= $ cursor ->depth >= $ this ->displayOptions ['maxDepth ' ] ? ' <samp class=" sf-dump-compact" > ' : ' <samp class=" sf-dump-expanded" > ' ;
797
793
$ this ->endValue ($ cursor );
798
794
$ this ->line .= $ this ->indentPad ;
799
795
$ this ->line .= sprintf ('<img src="data:%s;base64,%s" /></samp> ' , $ cursor ->attr ['content-type ' ], base64_encode ($ cursor ->attr ['img-data ' ]));
@@ -815,10 +811,10 @@ public function enterHash(Cursor $cursor, int $type, string|int|null $class, boo
815
811
816
812
if ($ cursor ->skipChildren || $ cursor ->depth >= $ this ->displayOptions ['maxDepth ' ]) {
817
813
$ cursor ->skipChildren = false ;
818
- $ eol = ' class=sf-dump-compact> ' ;
814
+ $ eol = ' class=" sf-dump-compact" > ' ;
819
815
} else {
820
816
$ this ->expandNextHash = false ;
821
- $ eol = ' class=sf-dump-expanded> ' ;
817
+ $ eol = ' class=" sf-dump-expanded" > ' ;
822
818
}
823
819
824
820
if ($ hasChild ) {
@@ -856,53 +852,56 @@ protected function style(string $style, string $value, array $attr = []): string
856
852
857
853
if ('ref ' === $ style ) {
858
854
if (empty ($ attr ['count ' ])) {
859
- return sprintf ('<a class=sf-dump-ref>%s</a> ' , $ v );
855
+ return sprintf ('<a class=" sf-dump-ref" >%s</a> ' , $ v );
860
856
}
861
857
$ r = ('# ' !== $ v [0 ] ? 1 - ('@ ' !== $ v [0 ]) : 2 ).substr ($ value , 1 );
862
858
863
- return sprintf ('<a class=sf-dump-ref href=#%s-ref%s title="%d occurrences">%s</a> ' , $ this ->dumpId , $ r , 1 + $ attr ['count ' ], $ v );
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
+ $ dumpClass = '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
+ $ dumpClass .= ' 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 ) {
904
+ $ v = ' <span class=" ' . $ dumpClass .( $ dumpTitle ? ' " title=" ' . $ dumpTitle : '' ). ' "> ' .preg_replace_callback (static ::$ controlCharsRx , function ($ c ) use ($ map ) {
906
905
$ s = $ b = '<span class="sf-dump-default ' ;
907
906
$ c = $ c [$ i = 0 ];
908
907
if ($ ns = "\r" === $ c [$ i ] || "\n" === $ c [$ i ]) {
@@ -926,7 +925,7 @@ protected function style(string $style, string $value, array $attr = []): string
926
925
927
926
if (!($ attr ['binary ' ] ?? false )) {
928
927
$ v = preg_replace_callback (static ::$ unicodeCharsRx , function ($ c ) {
929
- return '<span class=sf-dump-default>\u{ ' .strtoupper (dechex (mb_ord ($ c [0 ]))).'}</span> ' ;
928
+ return '<span class=" sf-dump-default" >\u{ ' .strtoupper (dechex (mb_ord ($ c [0 ]))).'}</span> ' ;
930
929
}, $ v );
931
930
}
932
931
0 commit comments