@@ -74,6 +74,28 @@ const ElementValuePreview: ValueComponent<ValueType.Element> = props => (
7474 < span class = { styles . ValueElement } > { props . value } </ span >
7575)
7676
77+ const ObjectValuePreview : Component <
78+ EncodedValueOf < ValueType . Object | ValueType . Array , boolean > & { extended ?: boolean }
79+ > = props => (
80+ < Switch >
81+ < Match when = { ! props . children || props . value === 0 || props . extended === false } >
82+ < Show
83+ when = { props . value > 0 }
84+ fallback = {
85+ < span class = { styles . Nullable } >
86+ Empty { props . type === ValueType . Array ? "Array" : "Object" }
87+ </ span >
88+ }
89+ >
90+ < span class = { styles . baseValue } >
91+ { props . type === ValueType . Array ? "Array" : "Object" } [{ props . value } ]
92+ </ span >
93+ </ Show >
94+ </ Match >
95+ < Match when = { props . children } > { value => < CollapsableObjectPreview value = { value } /> } </ Match >
96+ </ Switch >
97+ )
98+
7799const CollapsableObjectPreview : Component < {
78100 value :
79101 | EncodedValueOf < ValueType . Object , true > [ "children" ]
@@ -123,30 +145,6 @@ const CollapsableObjectPreview: Component<{
123145 </ ul >
124146)
125147
126- const ObjectValuePreview : Component <
127- EncodedValueOf < ValueType . Object | ValueType . Array , boolean > & { extended ?: boolean }
128- > = props => (
129- < Switch >
130- < Match when = { ! props . children || props . value === 0 || props . extended === false } >
131- < Switch >
132- < Match when = { props . type === ValueType . Object } >
133- < span class = { styles . ValueObject } > …</ span >
134- </ Match >
135- < Match when = { props . type === ValueType . Array } >
136- < ArrayHead value = { props . value } />
137- </ Match >
138- </ Switch >
139- </ Match >
140- < Match when = { props . children } > { value => < CollapsableObjectPreview value = { value } /> } </ Match >
141- </ Switch >
142- )
143-
144- const ArrayHead : Component < { value : number } > = props => (
145- < Show when = { props . value > 0 } fallback = { < span class = { styles . EmptyArray } > Empty Array</ span > } >
146- < span class = { styles . baseValue } > Array [{ props . value } ]</ span >
147- </ Show >
148- )
149-
150148const ValuePreview : Component < { value : EncodedValue < boolean > } > = props =>
151149 createMemo ( ( ) => {
152150 switch ( props . value . type ) {
0 commit comments