@graphiql/plugin-doc-explorer
Version:
79 lines (78 loc) • 1.62 kB
JavaScript
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
import { c } from "react-compiler-runtime";
import { astFromValue, print } from "graphql";
/* empty css */
const printDefault = (ast) => {
if (!ast) {
return "";
}
return print(ast);
};
const DefaultValue = (t0) => {
const $ = c(12);
const {
field
} = t0;
if (!("defaultValue" in field) || field.defaultValue === void 0) {
return null;
}
const t1 = field.defaultValue;
const t2 = field.type;
let t3;
let t4;
let t5;
let t6;
if ($[0] !== field.defaultValue || $[1] !== field.type) {
t6 = Symbol.for("react.early_return_sentinel");
bb0: {
const ast = astFromValue(t1, t2);
if (!ast) {
t6 = null;
break bb0;
}
t5 = " = ";
t3 = "graphiql-doc-explorer-default-value";
t4 = printDefault(ast);
}
$[0] = field.defaultValue;
$[1] = field.type;
$[2] = t3;
$[3] = t4;
$[4] = t5;
$[5] = t6;
} else {
t3 = $[2];
t4 = $[3];
t5 = $[4];
t6 = $[5];
}
if (t6 !== Symbol.for("react.early_return_sentinel")) {
return t6;
}
let t7;
if ($[6] !== t3 || $[7] !== t4) {
t7 = /* @__PURE__ */ jsx("span", { className: t3, children: t4 });
$[6] = t3;
$[7] = t4;
$[8] = t7;
} else {
t7 = $[8];
}
let t8;
if ($[9] !== t5 || $[10] !== t7) {
t8 = /* @__PURE__ */ jsxs(Fragment, { children: [
t5,
t7
] });
$[9] = t5;
$[10] = t7;
$[11] = t8;
} else {
t8 = $[11];
}
return t8;
};
export {
DefaultValue
};
//# sourceMappingURL=default-value.js.map