UNPKG

@scalar/api-client

Version:

the open source API testing client

42 lines (41 loc) 1.41 kB
import { defineComponent as i, ref as u, useId as p, toRef as r, createElementBlock as m, openBlock as n, createBlock as f, createCommentVNode as _, createElementVNode as c, unref as l } from "vue"; import { ScalarCodeBlockCopy as g } from "@scalar/components"; import { prettyPrintJson as k } from "@scalar/oas-utils/helpers"; import { useCodeMirror as y } from "@scalar/use-codemirror"; const b = { class: "scalar-code-block group/code-block body-raw grid min-h-0 overflow-hidden p-px outline-none has-[:focus-visible]:outline" }, v = { class: "body-raw-scroller custom-scroll relative pr-1", tabindex: "0" }, M = /* @__PURE__ */ i({ __name: "ResponseBodyRaw", props: { content: {}, language: {} }, setup(s) { const e = s, o = u(null), a = p(), { codeMirror: d } = y({ codeMirrorRef: o, readOnly: !0, lineNumbers: !0, content: r(() => k(e.content)), language: r(() => e.language), forceFoldGutter: !0 }), t = () => d.value?.state.doc.toString() || ""; return (C, h) => (n(), m("div", b, [ t() ? (n(), f(l(g), { key: 0, content: t(), controls: l(a), class: "z-context top-2 mr-2" }, null, 8, ["content", "controls"])) : _("", !0), c("div", v, [ c("div", { ref_key: "codeMirrorRef", ref: o }, null, 512) ]) ])); } }); export { M as default };