import { createSignal } from 'solid-js' import { DevtoolsStateContext } from '../contexts/DevtoolsStateContext' import type { ParentProps } from 'solid-js' import type { DevtoolsState } from '../contexts/types' /** * Provides the selected query and mutation and the panel width to its children. * @param props - The `children` to render. * @returns The `children`, wrapped in the context provider. */ export function DevtoolsStateProvider(props: ParentProps) { const [selectedQueryHash, setSelectedQueryHash] = createSignal( null, ) const [selectedMutationId, setSelectedMutationId] = createSignal< number | null >(null) const [panelWidth, setPanelWidth] = createSignal(0) const state: DevtoolsState = { selectedQueryHash, setSelectedQueryHash, selectedMutationId, setSelectedMutationId, panelWidth, setPanelWidth, } return ( {props.children} ) }