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 )
145 }
146
147 return <span />
148 })()}
149 {props.copyable && (
150 <div class={clsx(styles().tree.actions, 'actions')}>
151 <CopyButton value={props.value} />
152 </div>
153 )}
154 {props.isLastKey || props.isRoot ? (
155 ''
156 ) : (
157 <span data-tsd-syntax="punctuation">,</span>
158 )}
159 </span>
160 )
161}
162
163const ArrayValue = (props: {
164 value: Array<any>
165 copyable?: boolean
166 keyName?: string
167 defaultExpansionDepth: number
168 depth: number
169 collapsePaths?: Array<string>
170 path: string
171 config?: { dateFormat?: string }
172}) => {
173 const styles = createStyles()
174
175 const [expanded, setExpanded] = createSignal(
176 props.depth <= props.defaultExpansionDepth &&
177 !props.collapsePaths?.includes(props.path),
178 )
179
180 if (props.value.length === 0) {
181 return (
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 return (
199 <span class={styles().tree.expanderContainer}>
200 <Expander
201 onClick={() => setExpanded(!expanded())}
202 expanded={expanded()}

Callers

nothing calls this directly

Calls 1

createStylesFunction · 0.90

Tested by

no test coverage detected