(props: {
dataPath: Array<string>
activeQuery: Query
value: boolean
})
| 222 | } |
| 223 | |
| 224 | const ToggleValueButton = (props: { |
| 225 | dataPath: Array<string> |
| 226 | activeQuery: Query |
| 227 | value: boolean |
| 228 | }) => { |
| 229 | const theme = useTheme() |
| 230 | const css = useQueryDevtoolsContext().shadowDOMTarget |
| 231 | ? goober.css.bind({ target: useQueryDevtoolsContext().shadowDOMTarget }) |
| 232 | : goober.css |
| 233 | const styles = createMemo(() => { |
| 234 | return theme() === 'dark' ? darkStyles(css) : lightStyles(css) |
| 235 | }) |
| 236 | const queryClient = useQueryDevtoolsContext().client |
| 237 | |
| 238 | return ( |
| 239 | <button |
| 240 | class={cx( |
| 241 | styles().actionButton, |
| 242 | css` |
| 243 | width: ${tokens.size[3.5]}; |
| 244 | height: ${tokens.size[3.5]}; |
| 245 | `, |
| 246 | )} |
| 247 | title={'Toggle value'} |
| 248 | aria-label={'Toggle value'} |
| 249 | aria-pressed={props.value} |
| 250 | onClick={() => { |
| 251 | const oldData = props.activeQuery.state.data |
| 252 | const newData = updateNestedDataByPath( |
| 253 | oldData, |
| 254 | props.dataPath, |
| 255 | !props.value, |
| 256 | ) |
| 257 | queryClient.setQueryData(props.activeQuery.queryKey, newData) |
| 258 | }} |
| 259 | > |
| 260 | <Check theme={theme()} checked={props.value} /> |
| 261 | </button> |
| 262 | ) |
| 263 | } |
| 264 | |
| 265 | type ExplorerProps = { |
| 266 | editable?: boolean |
nothing calls this directly
no test coverage detected