{"name":"@graphiql/react","version":"0.12.0-canary-7210edd6.0","keywords":["react","graphql","sdk","codemirror"],"license":"MIT","_id":"@graphiql/react@0.12.0-canary-7210edd6.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":"32b1780108b332b7ba83b119fca36d3125a3b132","tarball":"http://registry-npm.ywwl.com/@graphiql/react/download/@graphiql/react-0.12.0-canary-7210edd6.0.tgz","fileCount":278,"integrity":"sha512-DPjEw1AxbK/kQVzblpuNf9cDjJ+Xm7ZLu3ElyxsRu94yEiuvxP7dd3DqPiFQ3fW80qzdfNES3LYdl4b+Jqciww==","signatures":[{"sig":"MEQCIBtvkKNtIT83ni1plMlHBJSrQ7OSWUckI3mN2nEHWs6IAiBG4UF9Z1ANmJVROnxezyEvoJAPRvjt9ZjqHJlcy9Qzjw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3157655,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjEguAACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmq8HQ/9FG4kFFOO2KzvXZjkA6VzFiYzgSvHzagf4GESzQnmyNhrcbpJ\r\ntq0p+JkE4xbTVe99Wl2NA61ODRPLNQMuFoFU2sWr4BtLO8YCWyXYf/qA9qIY\r\n337CYCddjcypWSk1ogeKEM7M8s3lHgHR/HJngOJV9/6+htzalg5URLYBEziU\r\nkOaMJZgESTq9S1g/+YFPy3hBAGJgMV+dxp6UIo/Rdbi/I0ft0hOv556P68J8\r\nG6V/MJxKoOP2PhdVOAg24rIVyxQbb5m+EeQbGn4IHmIcSktiqVTTyaRDea/d\r\nFJUGRLhH/Pp5jEg/aAejvmIFiNPi20wGhoV3A+96F9zHExoBDYnhh/qfwHiQ\r\n0NH3gmk9bxPeicgK2hmL0GZ9KgSPFkP84F8bhmw0LZIl+a+shnTgroSGjL3k\r\nOuXYKR7xzR3pLFFCnDC8kPpyYgzwo4i8P24mllAV8U2MAkjLQQgTR8VzHHAN\r\npcSO4chsGG/dQdwQLzPw5/rP9HSvsegwo7kmZqi29G/E73rOooTa6waLE/T1\r\nKyJsag8Nme2S9Xzn/xOTObU+Ul6CtuX3oM7kukpFKjrZfIOPUltpzXldVQRv\r\n4CDFtZ5bl+j40kRTBiC0GNXfi9fdUcbwcwmVRF3BJx9dMXJu0xwm4jLpiK7e\r\nN96zLfVKnKBD07OO1RElK34NeRUB/9c/opI=\r\n=kM9o\r\n-----END PGP SIGNATURE-----\r\n","size":938557,"noattachment":false,"key":"/@graphiql/react/-/@graphiql/react-0.12.0-canary-7210edd6.0.tgz"},"main":"dist/graphiql-react.cjs.js","types":"types/index.d.ts","module":"dist/graphiql-react.es.js","readme":"[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)\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 GraphQL IDEs with ease. It's the set of components that make up Graph*i*QL, the first and official GraphQL IDE, owned and maintained by the GraphQL Foundation.\n\nThere are two kinds of building blocks that this package provides: Stateful context 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 to get started is by using the `GraphiQLProvider` component that renders all the individual providers.\n\nThere is one required prop called `fetcher`. This is a function that performs GraphQL request against a given endpoint. You can easily create a fetcher using the 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 `@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 can import them from `@graphiql/react/dist/style.css`.\n\n**Note**: In order for these styles to apply, the UI components need to be rendered inside an element that has a class name `graphiql-container`.\n\nBy default the UI components will try to use the [Roboto](https://fonts.google.com/specimen/Roboto) font for regular text and the [Fira Code](https://fonts.google.com/specimen/Fira+Code) font for mono-space text. 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 them from Google Fonts).\n\nFurther details on how to use `@graphiql/react` can be found in the reference implementation of a GraphQL IDE - Graph*i*QL - in the [`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 complete GraphQL IDE. For each context there is a provider component (`<name>ContextProvider`) that makes sure the context is initialized and managed properly. These components contains all the logic related to state management. In addition, for each context there is also a hook (`use<name>Context`) that allows 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 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 IDE like VSCode for development these descriptions will show up in auto-complete tooltips. All these descriptions can also be found in the [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 in mind. We achieve this using CSS variables.\n\nAll variables that are available for customization can be found in the [`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 [HSL format](https://en.wikipedia.org/wiki/HSL_and_HSV). All CSS variables for colors are defined as a list of the three values that make up HSL (hue, saturation and lightness).\n\nThis approach allows `@graphiql/react` to use transparent colors by passing the value of the CSS variable in the `hsla` function. This enables us to provide truly reusable UI elements where good contrasts are preserved regardless of the elements background.\n\n## Development\n\nIf you want to develop with `@graphiql/react` locally - in particular when working on the `graphiql` package - all you need to do is run `yarn dev` in the package folder in a separate terminal. This will build the package using Vite. When using it in combination with `yarn start-graphiql` (running in the repo root) this will give you auto-reloading when working on `graphiql` and `@graphiql/react` simultaneously.\n","gitHead":"7210edd676f2bacfafe995814341e337896713f5","scripts":{"dev":"concurrently 'tsc --emitDeclarationOnly --watch' 'vite build --watch'","build":"tsc --emitDeclarationOnly && vite build"},"_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.15.0","description":"[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)","directories":{},"_nodeVersion":"16.17.0","dependencies":{"set-value":"^4.1.0","codemirror":"^5.65.3","markdown-it":"^12.2.0","@reach/dialog":"^0.17.0","@reach/listbox":"^0.17.0","@reach/tooltip":"^0.17.0","@reach/combobox":"^0.17.0","@graphiql/toolkit":"^0.7.0","copy-to-clipboard":"^3.2.0","@reach/menu-button":"^0.17.0","codemirror-graphql":"^2.0.0","@reach/visually-hidden":"^0.17.0","graphql-language-service":"^5.1.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"vite":"^2.9.13","react":"^17.0.2","graphql":"^16.4.0","react-dom":"^17.0.2","typescript":"^4.6.3","postcss-nesting":"^10.1.7","@types/set-value":"^4.0.1","@types/codemirror":"^5.60.5","@vitejs/plugin-react":"^1.3.0","vite-plugin-react-svg":"^0.2.0","@testing-library/react":"9.4.1"},"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.12.0-canary-7210edd6.0_1662126976266_0.6327037189988542","host":"s3://npm-registry-packages"},"publish_time":1662126976645,"_cnpm_publish_time":1662126976645,"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"}}