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