UNPKG

@graphiql/react

Version:

[Changelog](https://github.com/graphql/graphiql/blob/main/packages/graphiql-react/CHANGELOG.md) | [API Docs](https://graphiql-test.netlify.app/typedoc/modules/graphiql_react.html) | [NPM](https://www.npmjs.com/package/@graphiql/react)

256 lines (255 loc) 5.48 kB
import { c } from "react-compiler-runtime"; import { useGraphiQLActions, useGraphiQL } from "./components/provider.js"; import { pick } from "./utility/pick.js"; function usePrettifyEditors() { const { prettifyEditors } = useGraphiQLActions(); return prettifyEditors; } function useCopyQuery() { const { copyQuery } = useGraphiQLActions(); return copyQuery; } function useMergeQuery() { const { mergeQuery } = useGraphiQLActions(); return mergeQuery; } function useEditorContext() { const $ = c(22); const { addTab, changeTab, moveTab, closeTab, updateActiveTabValues, setEditor, setOperationName, setShouldPersistHeaders } = useGraphiQLActions(); let t0; if ($[0] !== setEditor) { t0 = (headerEditor) => setEditor({ headerEditor }); $[0] = setEditor; $[1] = t0; } else { t0 = $[1]; } const setHeaderEditor = t0; let t1; if ($[2] !== setEditor) { t1 = (queryEditor) => setEditor({ queryEditor }); $[2] = setEditor; $[3] = t1; } else { t1 = $[3]; } const setQueryEditor = t1; let t2; if ($[4] !== setEditor) { t2 = (responseEditor) => setEditor({ responseEditor }); $[4] = setEditor; $[5] = t2; } else { t2 = $[5]; } const setResponseEditor = t2; let t3; if ($[6] !== setEditor) { t3 = (variableEditor) => setEditor({ variableEditor }); $[6] = setEditor; $[7] = t3; } else { t3 = $[7]; } const setVariableEditor = t3; let t4; if ($[8] === Symbol.for("react.memo_cache_sentinel")) { t4 = pick("headerEditor", "queryEditor", "responseEditor", "variableEditor", "initialHeaders", "initialQuery", "initialVariables", "externalFragments", "shouldPersistHeaders"); $[8] = t4; } else { t4 = $[8]; } const values = useGraphiQL(t4); let t5; if ($[9] !== addTab || $[10] !== changeTab || $[11] !== closeTab || $[12] !== moveTab || $[13] !== setHeaderEditor || $[14] !== setOperationName || $[15] !== setQueryEditor || $[16] !== setResponseEditor || $[17] !== setShouldPersistHeaders || $[18] !== setVariableEditor || $[19] !== updateActiveTabValues || $[20] !== values) { t5 = { addTab, changeTab, moveTab, closeTab, updateActiveTabValues, setHeaderEditor, setQueryEditor, setResponseEditor, setVariableEditor, setOperationName, setShouldPersistHeaders, ...values }; $[9] = addTab; $[10] = changeTab; $[11] = closeTab; $[12] = moveTab; $[13] = setHeaderEditor; $[14] = setOperationName; $[15] = setQueryEditor; $[16] = setResponseEditor; $[17] = setShouldPersistHeaders; $[18] = setVariableEditor; $[19] = updateActiveTabValues; $[20] = values; $[21] = t5; } else { t5 = $[21]; } return t5; } function useExecutionContext() { const $ = c(4); const { run, stop } = useGraphiQLActions(); const values = useGraphiQL(_temp); let t0; if ($[0] !== run || $[1] !== stop || $[2] !== values) { t0 = { run, stop, ...values }; $[0] = run; $[1] = stop; $[2] = values; $[3] = t0; } else { t0 = $[3]; } return t0; } function _temp(state) { return { isFetching: state.isFetching, isSubscribed: Boolean(state.subscription), operationName: state.operationName }; } function usePluginContext() { const $ = c(4); const { setVisiblePlugin } = useGraphiQLActions(); let t0; if ($[0] === Symbol.for("react.memo_cache_sentinel")) { t0 = pick("plugins", "visiblePlugin"); $[0] = t0; } else { t0 = $[0]; } const values = useGraphiQL(t0); let t1; if ($[1] !== setVisiblePlugin || $[2] !== values) { t1 = { setVisiblePlugin, ...values }; $[1] = setVisiblePlugin; $[2] = values; $[3] = t1; } else { t1 = $[3]; } return t1; } function useSchemaContext() { const $ = c(3); const { introspect } = useGraphiQLActions(); const values = useGraphiQL(_temp2); let t0; if ($[0] !== introspect || $[1] !== values) { t0 = { introspect, ...values }; $[0] = introspect; $[1] = values; $[2] = t0; } else { t0 = $[2]; } return t0; } function _temp2(state) { return { isFetching: state.isIntrospecting, fetchError: state.fetchError, schema: state.schema, validationErrors: state.validationErrors }; } const useStorage = () => { return useGraphiQL(_temp3); }; const useStorageContext = useStorage; function useTheme() { const $ = c(3); const { setTheme } = useGraphiQLActions(); const theme = useGraphiQL(_temp4); let t0; if ($[0] !== setTheme || $[1] !== theme) { t0 = { setTheme, theme }; $[0] = setTheme; $[1] = theme; $[2] = t0; } else { t0 = $[2]; } return t0; } function _temp4(state) { return state.theme; } const useEditorStore = useEditorContext; const useExecutionStore = useExecutionContext; const usePluginStore = usePluginContext; const useSchemaStore = useSchemaContext; function _temp3(state) { return state.storage; } export { useCopyQuery, useEditorContext, useEditorStore, useExecutionContext, useExecutionStore, useMergeQuery, usePluginContext, usePluginStore, usePrettifyEditors, useSchemaContext, useSchemaStore, useStorage, useStorageContext, useTheme }; //# sourceMappingURL=deprecated.js.map