MCPcopy Create free account
hub / github.com/TanStack/query / PiPPanel

Function PiPPanel

packages/query-devtools/src/Devtools.tsx:359–428  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

357const PiPPanel: Component<{
358 children: JSX.Element
359}> = (props) => {
360 const { panelWidth, setPanelWidth } = useDevtoolsState()
361
362 const pip = usePiPWindow()
363 const theme = useTheme()
364 const css = useQueryDevtoolsContext().shadowDOMTarget
365 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
366 : goober.css
367 const styles = createMemo(() => {
368 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
369 })
370
371 const getPanelDynamicStyles = () => {
372 const { colors } = tokens
373 const t = (light: string, dark: string) =>
374 theme() === 'dark' ? dark : light
375 if (panelWidth() < secondBreakpoint) {
376 return css`
377 flex-direction: column;
378 background-color: ${t(colors.gray[300], colors.gray[600])};
379 `
380 }
381 return css`
382 flex-direction: row;
383 background-color: ${t(colors.gray[200], colors.darkGray[900])};
384 `
385 }
386
387 createEffect(() => {
388 const win = pip().pipWindow
389 const resizeCB = () => {
390 if (!win) return
391 setPanelWidth(win.innerWidth)
392 }
393 if (win) {
394 win.addEventListener('resize', resizeCB)
395 resizeCB()
396 }
397
398 onCleanup(() => {
399 if (win) {
400 win.removeEventListener('resize', resizeCB)
401 }
402 })
403 })
404
405 return (
406 <div
407 dir="ltr"
408 style={{
409 '--tsqd-font-size': '16px',
410 'max-height': '100vh',
411 height: '100vh',
412 width: '100vw',
413 }}
414 class={cx(
415 styles().panel,
416 getPanelDynamicStyles(),

Callers

nothing calls this directly

Calls 8

useDevtoolsStateFunction · 0.90
usePiPWindowFunction · 0.90
useThemeFunction · 0.90
useQueryDevtoolsContextFunction · 0.90
resizeCBFunction · 0.85
getPanelDynamicStylesFunction · 0.85
darkStylesFunction · 0.70
lightStylesFunction · 0.70

Tested by

no test coverage detected