{"name":"@graphiql/react","version":"0.3.0","license":"MIT","_id":"@graphiql/react@0.3.0","maintainers":[{"name":"leebyron","email":"lee@leebyron.com"},{"name":"acao","email":"rikki.schulte@gmail.com"}],"homepage":"http://github.com/graphql/graphiql/tree/master/packages/graphiql-react#readme","bugs":{"url":"https://github.com/graphql/graphiql/issues?q=issue+label:graphiql-react"},"dist":{"shasum":"3e5100b977a15020514350a6cbd9440a3430e73a","tarball":"http://registry-npm.ywwl.com/@graphiql/react/download/@graphiql/react-0.3.0.tgz","fileCount":120,"integrity":"sha512-XA+khix70FM5yQ0l0xTHC1y2LZ2v/mYWQAhxKo9+5mGfIiMtuo2hEEdJeQvX03CGfIIDjZHD6KOzQNO4LTLqxA==","signatures":[{"sig":"MEUCIF/tFS0HYXesAC+FuBfgUwZWuGpLT/+ZWSm5Yz7+eyxBAiEAsSUhBdfMxon19xe9ZXE5enL3e9DvRkJzxmA1fhFbd3M=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1828123,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJimwAgACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqrWw/+M88DM516rKgfJMMUmme751iKiP4DdjYeHi6grz0rln3tDctS\r\nas3M512zbygGEDD2/WUyWQzMMjj8Esuwm/yo0LUGDTqVKCqphCL+kDx+rhnU\r\nsMWfX9tN8sIfbxAnCM1lLrA/dX5zGFex8qDi2DzQoKJghTgrs/pJXNIbuPhZ\r\nYk0VeKMVEw3cCPioglt8HchXAiNp6WkF1wjFsi4elWqYbhzaP2yvYZLLI/E5\r\nXNej/lOKkycCKFjZcaYiHboqAXo9vx/+Mgde/6E+01srXIevCxDbWdxNEA1k\r\noO+Tbi+q0ByIP+BORLxls4DN2D65L3bJkQom8dfXBfoODKI14GqEV0ZcGLML\r\noyfBx3O3MQYK25rNyhHnR/TgV2QnFmI1P2CL+VDRZCz/vJ3b8VkhbcQppJDB\r\nVgSXW4rd2nNzDsVTkGgTTZ3UzVOeX0FPVIMpvF13gLmeIzFw6opu5geUNADG\r\nCE+QmyikH+dINtORQShLo+9/S1jDOYyAM2wcLC+JMb/D6Fjbs/53lBp0kQ9q\r\nhAaNFf0OdpeqWz122eHUlm5bQE5YXELLMQyqQrl2G9hP+rFw7QBjJUgroQhB\r\n5SHnUVEGnzYCFfgasL9OnsfXDe/KYRv4/QUrtVJrOdxxmtnIJ/918UYjoDlZ\r\nqqaNaJz4IIqAKksji9qlqX5pH2Hr088uP3M=\r\n=gfg8\r\n-----END PGP SIGNATURE-----\r\n","size":450780,"noattachment":false,"key":"/@graphiql/react/-/@graphiql/react-0.3.0.tgz"},"main":"dist/graphiql-react.cjs.js","types":"types/index.d.ts","module":"dist/graphiql-react.es.js","gitHead":"1818982c1beaf2f65fc5df0d21b5e2e5d2d448cf","scripts":{"dev":"vite","build":"tsc --emitDeclarationOnly && vite build","preview":"vite preview"},"_npmUser":{"name":"acao","email":"rikki.schulte@gmail.com"},"repository":{"url":"git+https://github.com/graphql/graphiql.git","type":"git","directory":"packages/graphiql-react"},"_npmVersion":"8.5.5","directories":{},"_nodeVersion":"16.15.0","dependencies":{"set-value":"^4.1.0","codemirror":"^5.65.3","escape-html":"^1.0.3","markdown-it":"^12.2.0","@graphiql/toolkit":"^0.6.0","copy-to-clipboard":"^3.2.0","codemirror-graphql":"^1.3.0","graphql-language-service":"^5.0.4"},"_hasShrinkwrap":false,"devDependencies":{"vite":"^2.9.5","react":"^17.0.2","graphql":"^16.4.0","react-dom":"^17.0.2","typescript":"^4.6.3","@types/set-value":"^4.0.1","@types/codemirror":"^5.60.5","@types/escape-html":"^1.0.1","@vitejs/plugin-react":"^1.3.0"},"peerDependencies":{"react":"^16.8.0 || ^17.0.0 || ^18.0.0","graphql":"^15.5.0 || ^16.0.0","react-dom":"^16.8.0 || ^17.0.0 || ^18.0.0"},"_npmOperationalInternal":{"tmp":"tmp/react_0.3.0_1654325280255_0.09511873992044162","host":"s3://npm-registry-packages"},"readme":"[Changelog](https://github.com/graphql/graphiql/blob/main/packages/graphiql-react/CHANGELOG.md)\n|\n[API Docs](https://graphiql-test.netlify.app/typedoc/modules/graphiql_react.html)\n| [NPM](https://www.npmjs.com/package/@graphiql/react)\n\n# `@graphiql/react`\n\nA React SDK for building integrated GraphQL developer experiences for the web.\n\n## Purpose\n\nThis package contains a set of building blocks that allow its users to build\nGraphQL IDEs with ease. It's the set of components that make up Graph*i*QL, the\nfirst and official GraphQL IDE, owned and maintained by the GraphQL Foundation.\n\nThere are two kinds of building blocks that this package provides: Stateful\ncontext providers for state management and simple UI components.\n\n## Getting started\n\nAll the state for your GraphQL IDE lives in multiple contexts. The easiest way\nto get started is by using the `GraphiQLProvider` component that renders all the\nindividual providers.\n\nThere is one required prop called `fetcher`. This is a function that performs\nGraphQL request against a given endpoint. You can easily create a fetcher using\nthe method `createGraphiQLFetcher` from the `@graphiql/toolkit` package.\n\n```jsx\nimport { GraphiQLProvider } from '@graphiql/react';\nimport { createGraphiQLFetcher } from '@graphiql/toolkit';\n\nconst fetcher = createGraphiQLFetcher({\n  url: 'https://my.graphql.api/graphql',\n});\n\nfunction MyGraphQLIDE() {\n  return (\n    <GraphiQLProvider fetcher={fetcher}>\n      <div className=\"graphiql-container\">Hello GraphQL</div>\n    </GraphiQLProvider>\n  );\n}\n```\n\nInside the provider you can now use any UI component provided by\n`@graphiql/react`. For example, you can render a query editor like this:\n\n```jsx\nimport { QueryEditor } from '@graphiql/react';\n\nfunction MyGraphQLIDE() {\n  return (\n    <GraphiQLProvider fetcher={fetcher}>\n      <div className=\"graphiql-container\">\n        <QueryEditor />\n      </div>\n    </GraphiQLProvider>\n  );\n}\n```\n\nThe package also ships the necessary CSS that all its UI components need. You\ncan import them from `@graphiql/react/dist/style.css`.\n\n> **Note**: In order for these styles to apply, the UI components need to be\n> rendered inside an element that has a class name `graphiql-container`.\n\nBy default, the UI components will try to use the\n[Roboto](https://fonts.google.com/specimen/Roboto) font for regular text and the\n[Fira Code](https://fonts.google.com/specimen/Fira+Code) font for mono-space\ntext. If you want to use the default fonts you can load them using these files:\n\n- `@graphiql/react/font/roboto.css`\n- `@graphiql/react/font/fira-code.css`.\n\nYou can of course use any other method to load these fonts (for example loading\nthem from Google Fonts).\n\nFurther details on how to use `@graphiql/react` can be found in the reference\nimplementation of a GraphQL IDE - Graph*i*QL - in the\n[`graphiql` package](https://github.com/graphql/graphiql/blob/main/packages/graphiql/src/components/GraphiQL.tsx).\n\n## Available contexts\n\nThere are multiple contexts that own different parts of the state that make up a\ncomplete GraphQL IDE. For each context there is a provider component\n(`<name>ContextProvider`) that makes sure the context is initialized and managed\nproperly. These components contains all the logic related to state management.\nIn addition, for each context there is also a hook (`use<name>Context`) that\nallows you to consume its current value.\n\nHere is a list of all contexts that come with `@graphiql/react`\n\n- `StorageContext`: Provides a storage API that can be used to persist state in\n  the browser (by default using `localStorage`)\n- `EditorContext`: Manages all the editors and tabs\n- `SchemaContext`: Fetches, validates and stores the GraphQL schema\n- `ExecutionContext`: Executes GraphQL requests\n- `HistoryContext`: Persists executed requests in storage\n- `ExplorerContext`: Handles the state for the docs explorer\n\nAll context properties are documented using JSDoc comments. If you're using an\nIDE like VSCode for development these descriptions will show up in auto-complete\ntooltips. All these descriptions can also be found in the\n[API Docs](https://graphiql-test.netlify.app/typedoc/modules/graphiql_react.html).\n\n## Theming\n\nAll the components from `@graphiql/react` have been designed with customization\nin mind. We achieve this using CSS variables.\n\nAll variables that are available for customization can be found in the\n[`root.css` file](https://github.com/graphql/graphiql/blob/main/packages/graphiql-react/src/style/root.css).\n\n### Colors\n\nColors are defined using the\n[HSL format](https://en.wikipedia.org/wiki/HSL_and_HSV). All CSS variables for\ncolors are defined as a list of the three values that make up HSL (hue,\nsaturation and lightness).\n\nThis approach allows `@graphiql/react` to use transparent colors by passing the\nvalue of the CSS variable in the `hsla` function. This enables us to provide\ntruly reusable UI elements where good contrasts are preserved regardless of the\nelements background.\n\n## Development\n\nIf you want to develop with `@graphiql/react` locally - in particular when\nworking on the `graphiql` package - all you need to do is run `yarn dev` in the\npackage folder in a separate terminal. This will build the package using Vite.\nWhen using it in combination with `yarn dev-graphiql` (running in the repo\nroot) this will give you auto-reloading when working on `graphiql` and\n`@graphiql/react` simultaneously.\n","publish_time":1654325280499,"_cnpm_publish_time":1654325280499,"dist-tags":{"alpha":"0.37.6-alpha.2","beta":"1.0.0-beta.4","canary":"0.37.3-canary-67317292.0","latest":"1.0.1","next":"1.0.0-next.2","rc":"1.0.0-rc.4"}}