diff --git a/packages/query-devtools/package.json b/packages/query-devtools/package.json index 0152ddcbca..993bce9bc0 100644 --- a/packages/query-devtools/package.json +++ b/packages/query-devtools/package.json @@ -40,19 +40,21 @@ "test:lib": "vitest run --coverage", "test:lib:dev": "pnpm run test:lib --watch", "test:build": "publint --strict", - "build": "tsup" + "build": "tsup", + "build:dev": "tsup --watch" }, "files": [ "build", "src" ], "devDependencies": { - "@emotion/css": "^11.11.0", "@solid-primitives/keyed": "^1.2.0", "@solid-primitives/resize-observer": "^2.0.18", "@solid-primitives/storage": "^1.3.11", "@tanstack/match-sorter-utils": "^8.8.4", "@tanstack/query-core": "workspace:*", + "clsx": "^2.0.0", + "goober": "^2.1.13", "solid-js": "^1.7.8", "solid-transition-group": "^0.2.2", "superjson": "^1.12.4", diff --git a/packages/query-devtools/src/Devtools.tsx b/packages/query-devtools/src/Devtools.tsx index 3297dfaf6b..2ff9460a8c 100644 --- a/packages/query-devtools/src/Devtools.tsx +++ b/packages/query-devtools/src/Devtools.tsx @@ -9,7 +9,8 @@ import { onMount, } from 'solid-js' import { rankItem } from '@tanstack/match-sorter-utils' -import { css, cx } from '@emotion/css' +import { css } from 'goober' +import { clsx as cx } from 'clsx' import { TransitionGroup } from 'solid-transition-group' import { Key } from '@solid-primitives/keyed' import { createLocalStorage } from '@solid-primitives/storage' @@ -110,50 +111,56 @@ export const Devtools = () => { return localStore.position || useQueryDevtoolsContext().position || POSITION }) + createEffect(() => { + const root = document.querySelector('.tsqd-parent-container') as HTMLElement + const height = localStore.height || DEFAULT_HEIGHT + const width = localStore.width || DEFAULT_WIDTH + const panelPosition = position() + root.style.setProperty( + '--tsqd-panel-height', + `${panelPosition === 'top' ? '-' : ''}${height}px`, + ) + root.style.setProperty( + '--tsqd-panel-width', + `${panelPosition === 'left' ? '-' : ''}${width}px`, + ) + }) + return (
- + { /> - +
= (props) => { // - // min-width - When the panel is in the left or right position, the panel // width is set to min-content to allow the panel to shrink to the lowest possible width - class={`${styles.panel} ${styles[`panel-position-${position()}`]} ${css` - flex-direction: ${panelWidth() < secondBreakpoint ? 'column' : 'row'}; - background-color: ${panelWidth() < secondBreakpoint - ? tokens.colors.gray[600] - : tokens.colors.darkGray[900]}; - ${panelWidth() < thirdBreakpoint && - (position() === 'right' || position() === 'left') - ? ` + class={cx( + styles.panel, + styles[`panel-position-${position()}`], + css` + flex-direction: ${panelWidth() < secondBreakpoint ? 'column' : 'row'}; + background-color: ${panelWidth() < secondBreakpoint + ? tokens.colors.gray[600] + : tokens.colors.darkGray[900]}; + `, + { + [css` min-width: min-content; - ` - : ''} - `}`} + `]: + panelWidth() < thirdBreakpoint && + (position() === 'right' || position() === 'left'), + }, + 'tsqd-main-panel', + )} style={{ height: position() === 'bottom' || position() === 'top' @@ -390,12 +403,17 @@ export const DevtoolsPanel: Component = (props) => { class={cx( styles.dragHandle, styles[`dragHandle-position-${position()}`], + 'tsqd-drag-handle', )} onMouseDown={handleDragStart} >