@graphiql/plugin-code-exporter
Version:
This package provides a plugin that integrates the [GraphiQL Code Exporter](https://github.com/OneGraph/graphiql-code-exporter) into the GraphiQL UI.
44 lines (43 loc) • 1.32 kB
JavaScript
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const react = require("@graphiql/react");
const React = require("react");
const GraphiQLCodeExporter = require("graphiql-code-exporter");
function GraphiQLCodeExporterPlugin(props) {
const [operationsString] = react.useOperationsEditorState();
return /* @__PURE__ */ React.createElement(
GraphiQLCodeExporter,
{
codeMirrorTheme: "graphiql",
...props,
query: operationsString
}
);
}
function codeExporterPlugin(props) {
return {
title: "GraphiQL Code Exporter",
icon: () => /* @__PURE__ */ React.createElement(
"svg",
{
xmlns: "http://www.w3.org/2000/svg",
fill: "none",
viewBox: "0 0 24 24",
strokeWidth: "1.5",
stroke: "currentColor"
},
/* @__PURE__ */ React.createElement(
"path",
{
strokeLinecap: "round",
strokeLinejoin: "round",
d: "M9 8.25H7.5a2.25 2.25 0 00-2.25 2.25v9a2.25 2.25 0 002.25 2.25h9a2.25 2.25 0 002.25-2.25v-9a2.25 2.25 0 00-2.25-2.25H15m0-3l-3-3m0 0l-3 3m3-3V15"
}
)
),
content() {
return /* @__PURE__ */ React.createElement(GraphiQLCodeExporterPlugin, { ...props });
}
};
}
exports.codeExporterPlugin = codeExporterPlugin;
;