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

Function PiPPanel

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

Source from the content-addressed store, hash-verified

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