@@ -52,67 +52,77 @@ export const NodeValue = ({
5252
5353 const t = chunkData ?. t ?? item ?. t ;
5454
55+ const _t = chunkData ?. _t ?? item ?. _t ;
56+
5557 const text = useMemo ( ( ) => {
56- if ( n ) {
57- return n ;
58- }
59- if ( t === "Array" || t === "Set" || t === "Map" ) {
60- const re = getText ( "Array" , data ?? [ ] ) ;
61- if ( t === "Set" || t === "Map" ) {
62- if ( Array . isArray ( re ) ) {
63- return (
64- < >
65- { t }
66- { "([" }
67- { re . map ( ( i , index ) => (
68- < Fragment key = { index } >
69- { i }
70- { index < re . length - 1 ? ", " : "" }
71- </ Fragment >
72- ) ) }
73- { "])" }
74- </ >
75- ) ;
58+ const finalType = _t || t ;
59+ const getTextElement = ( ) => {
60+ if ( n ) {
61+ return n ;
62+ }
63+ if ( finalType === "Array" || finalType === "Set" || finalType === "Map" ) {
64+ const re = getText ( "Array" , data ?? [ ] ) ;
65+ if ( finalType === "Set" || finalType === "Map" ) {
66+ if ( Array . isArray ( re ) ) {
67+ return (
68+ < >
69+ { finalType }
70+ { "([" }
71+ { re . map ( ( i , index ) => (
72+ < Fragment key = { index } >
73+ { i }
74+ { index < re . length - 1 ? ", " : "" }
75+ </ Fragment >
76+ ) ) }
77+ { "])" }
78+ </ >
79+ ) ;
80+ }
81+ return `${ finalType } ([${ re } ])` ;
82+ } else {
83+ if ( Array . isArray ( re ) ) {
84+ return (
85+ < >
86+ { "[" }
87+ { re . map ( ( i , index ) => (
88+ < Fragment key = { index } >
89+ { i }
90+ { index < re . length - 1 ? ", " : "" }
91+ </ Fragment >
92+ ) ) }
93+ { "]" }
94+ </ >
95+ ) ;
96+ }
97+ return `[${ re } ]` ;
7698 }
77- return `${ t } ([${ re } ])` ;
78- } else {
99+ }
100+ if ( finalType === "Iterable" || finalType === "Object" ) {
101+ const re = getText ( "Object" , data ?? { } ) ;
79102 if ( Array . isArray ( re ) ) {
80103 return (
81104 < >
82- { "[ " }
105+ { "{ " }
83106 { re . map ( ( i , index ) => (
84107 < Fragment key = { index } >
85108 { i }
86109 { index < re . length - 1 ? ", " : "" }
87110 </ Fragment >
88111 ) ) }
89- { "] " }
112+ { "} " }
90113 </ >
91114 ) ;
92115 }
93- return `[${ re } ]` ;
94- }
95- }
96- if ( t === "Iterable" || t === "Object" ) {
97- const re = getText ( "Object" , data ?? { } ) ;
98- if ( Array . isArray ( re ) ) {
99- return (
100- < >
101- { "{" }
102- { re . map ( ( i , index ) => (
103- < Fragment key = { index } >
104- { i }
105- { index < re . length - 1 ? ", " : "" }
106- </ Fragment >
107- ) ) }
108- { "}" }
109- </ >
110- ) ;
116+ return `{${ re } }` ;
111117 }
112- return `{${ re } }` ;
118+ } ;
119+
120+ if ( t === "Promise" || t === "Module" ) {
121+ return < > [object { t } { getTextElement ( ) } ]</ > ;
113122 }
114- return `[object ${ t } ]` ;
115- } , [ t , n , data ] ) ;
123+
124+ return getTextElement ( ) ;
125+ } , [ t , n , data , _t ] ) ;
116126
117127 useEffect ( ( ) => {
118128 if ( expand && item ?. l === false && item . i && ( ! chunkData || chunkData . i !== item . i ) ) {
@@ -185,13 +195,13 @@ export const NodeValue = ({
185195 < div className = "flex w-full my-0.5 items-center" >
186196 < span className = "text-transparent w-[1.5em] h-[1.5em] inline-block shrink-0" > { StateIcon } </ span >
187197 { prefix }
188- < div className = { `w-full relative flex pr-2` } >
198+ < div className = { `w-full relative flex pr-2 line-clamp-1 break-all ` } >
189199 < span className = "flex-shrink-0 cursor-pointer select-none whitespace-nowrap" onContextMenu = { onContextClick } >
190200 { name }
191201 </ span >
192202 < span className = "flex-shrink-0 pr-1" > :</ span >
193203 { currentIsEditable ? (
194- < span className = "hook-value-placeholder line-clamp-1 break-all relative " >
204+ < span className = "hook-value-placeholder relative line-clamp-1 break-all" >
195205 < NodeValueChange item = { item } chunkId = { chunkId } hookIndex = { hookIndex } path = { name } type = { type || "" } rootItem = { rootItem } parentItem = { parentItem } >
196206 { element }
197207 </ NodeValueChange >
@@ -215,7 +225,7 @@ export const NodeValue = ({
215225 { StateIcon }
216226 </ span >
217227 { prefix }
218- < div className = "max-w-full flex" >
228+ < div className = "max-w-full flex line-clamp-1 break-all " >
219229 < span className = "flex-shrink-0 cursor-pointer select-none whitespace-nowrap" onClick = { ( ) => setExpand ( ! expand ) } onContextMenu = { onContextClick } >
220230 { name }
221231 </ span >
0 commit comments