MCPcopy
hub / github.com/TanStack/query / PiPPanel

Function PiPPanel

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

Source from the content-addressed store, hash-verified

282const PiPPanel: Component<{
283 children: JSX.Element
284}> = (props) => {
285 const pip = usePiPWindow()
286 const theme = useTheme()
287 const css = useQueryDevtoolsContext().shadowDOMTarget
288 ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget })
289 : goober.css
290 const styles = createMemo(() => {
291 return theme() === 'dark' ? darkStyles(css) : lightStyles(css)
292 })
293
294 const getPanelDynamicStyles = () => {
295 const { colors } = tokens
296 const t = (light: string, dark: string) =>
297 theme() === 'dark' ? dark : light
298 if (panelWidth() < secondBreakpoint) {
299 return css`
300 flex-direction: column;
301 background-color: ${t(colors.gray[300], colors.gray[600])};
302 `
303 }
304 return css`
305 flex-direction: row;
306 background-color: ${t(colors.gray[200], colors.darkGray[900])};
307 `
308 }
309
310 createEffect(() => {
311 const win = pip().pipWindow
312 const resizeCB = () => {
313 if (!win) return
314 setPanelWidth(win.innerWidth)
315 }
316 if (win) {
317 win.addEventListener('resize', resizeCB)
318 resizeCB()
319 }
320
321 onCleanup(() => {
322 if (win) {
323 win.removeEventListener('resize', resizeCB)
324 }
325 })
326 })
327
328 return (
329 <div
330 style={{
331 '--tsqd-font-size': '16px',
332 'max-height': '100vh',
333 height: '100vh',
334 width: '100vw',
335 }}
336 class={cx(
337 styles().panel,
338 getPanelDynamicStyles(),
339 {
340 [css`
341 min-width: min-content;

Callers

nothing calls this directly

Calls 7

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

Used in the wild real call sites across dependent graphs

searching dependent graphs…