MCPcopy Create free account
hub / github.com/TanStack/devtools / ArrayValue

Function ArrayValue

packages/devtools-ui/src/components/tree.tsx:145–235  ·  view source on GitHub ↗
(props: {
  value: Array<any>
  copyable?: boolean
  keyName?: string
  defaultExpansionDepth: number
  depth: number
  collapsePaths?: Array<string>
  path: string
  config?: { dateFormat?: string }
})

Source from the content-addressed store, hash-verified

143
144 return <span />
145 })()}
146 {props.copyable && (
147 <div class={clsx(styles().tree.actions, 'actions')}>
148 <CopyButton value={props.value} />
149 </div>
150 )}
151 {props.isLastKey || props.isRoot ? (
152 ''
153 ) : (
154 <span data-tsd-syntax="punctuation">,</span>
155 )}
156 </span>
157 )
158}
159
160const ArrayValue = (props: {
161 value: Array<any>
162 copyable?: boolean
163 keyName?: string
164 defaultExpansionDepth: number
165 depth: number
166 collapsePaths?: Array<string>
167 path: string
168 config?: { dateFormat?: string }
169}) => {
170 const styles = createStyles()
171
172 const [expanded, setExpanded] = createSignal(
173 () =>
174 props.depth <= props.defaultExpansionDepth &&
175 !props.collapsePaths?.includes(props.path),
176 )
177
178 return (
179 <Show
180 when={props.value.length > 0}
181 fallback={
182 <span class={styles().tree.expanderContainer}>
183 {props.keyName && (
184 <span
185 data-tsd-syntax="property"
186 class={clsx(styles().tree.valueKey, styles().tree.collapsible)}
187 >
188 &quot;{props.keyName}&quot;:{' '}
189 </span>
190 )}
191
192 <span data-tsd-syntax="punctuation" class={styles().tree.valueBraces}>
193 []
194 </span>
195 </span>
196 }
197 >
198 <span class={styles().tree.expanderContainer}>
199 <Expander
200 onClick={() => setExpanded(!expanded())}
201 expanded={expanded()}
202 />

Callers

nothing calls this directly

Calls 1

createStylesFunction · 0.90

Tested by

no test coverage detected