UNPKG

@scalar/api-reference

Version:

Generate beautiful API references from OpenAPI documents

121 lines (120 loc) 4.98 kB
import { defineComponent, mergeModels, useModel, createBlock, openBlock, unref, withCtx, createVNode, createTextVNode } from "vue"; import { ScalarFormInputGroup, ScalarToggleInput } from "@scalar/components"; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ApiReferenceToolbarConfigLayoutOptions", props: /* @__PURE__ */ mergeModels({ configuration: {} }, { "modelValue": { default: {} }, "modelModifiers": {} }), emits: ["update:modelValue"], setup(__props) { const model = useModel(__props, "modelValue"); function getValue(key, defaultValue = false) { return model.value[key] ?? __props.configuration?.[key] ?? defaultValue; } function setValue(key, value, defaultValue = false) { if (value !== defaultValue) { model.value = { ...model.value, [key]: value }; } else { model.value = Object.fromEntries( Object.entries(model.value).filter(([k]) => key !== k) ); } } return (_ctx, _cache) => { return openBlock(), createBlock(unref(ScalarFormInputGroup), null, { default: withCtx(() => [ createVNode(unref(ScalarToggleInput), { modelValue: getValue("showSidebar", true), "onUpdate:modelValue": _cache[0] || (_cache[0] = (v) => setValue("showSidebar", !!v, true)) }, { default: withCtx(() => [..._cache[9] || (_cache[9] = [ createTextVNode(" Show Sidebar ", -1) ])]), _: 1 }, 8, ["modelValue"]), createVNode(unref(ScalarToggleInput), { modelValue: getValue("defaultOpenAllTags"), "onUpdate:modelValue": _cache[1] || (_cache[1] = (v) => setValue("defaultOpenAllTags", !!v)) }, { default: withCtx(() => [..._cache[10] || (_cache[10] = [ createTextVNode(" Default Open All Tags ", -1) ])]), _: 1 }, 8, ["modelValue"]), createVNode(unref(ScalarToggleInput), { modelValue: getValue("expandAllModelSections"), "onUpdate:modelValue": _cache[2] || (_cache[2] = (v) => setValue("expandAllModelSections", !!v)) }, { default: withCtx(() => [..._cache[11] || (_cache[11] = [ createTextVNode(" Expand All Model Sections ", -1) ])]), _: 1 }, 8, ["modelValue"]), createVNode(unref(ScalarToggleInput), { modelValue: getValue("expandAllResponses"), "onUpdate:modelValue": _cache[3] || (_cache[3] = (v) => setValue("expandAllResponses", !!v)) }, { default: withCtx(() => [..._cache[12] || (_cache[12] = [ createTextVNode(" Expand All Responses ", -1) ])]), _: 1 }, 8, ["modelValue"]), createVNode(unref(ScalarToggleInput), { modelValue: getValue("hideClientButton"), "onUpdate:modelValue": _cache[4] || (_cache[4] = (v) => setValue("hideClientButton", !!v)) }, { default: withCtx(() => [..._cache[13] || (_cache[13] = [ createTextVNode(" Hide Client Button ", -1) ])]), _: 1 }, 8, ["modelValue"]), createVNode(unref(ScalarToggleInput), { modelValue: getValue("hideDarkModeToggle"), "onUpdate:modelValue": _cache[5] || (_cache[5] = (v) => setValue("hideDarkModeToggle", !!v)) }, { default: withCtx(() => [..._cache[14] || (_cache[14] = [ createTextVNode(" Hide Dark Mode Toggle ", -1) ])]), _: 1 }, 8, ["modelValue"]), createVNode(unref(ScalarToggleInput), { modelValue: getValue("hideModels"), "onUpdate:modelValue": _cache[6] || (_cache[6] = (v) => setValue("hideModels", !!v)) }, { default: withCtx(() => [..._cache[15] || (_cache[15] = [ createTextVNode(" Hide Models ", -1) ])]), _: 1 }, 8, ["modelValue"]), createVNode(unref(ScalarToggleInput), { modelValue: getValue("hideSearch"), "onUpdate:modelValue": _cache[7] || (_cache[7] = (v) => setValue("hideSearch", !!v)) }, { default: withCtx(() => [..._cache[16] || (_cache[16] = [ createTextVNode(" Hide Search ", -1) ])]), _: 1 }, 8, ["modelValue"]), createVNode(unref(ScalarToggleInput), { modelValue: getValue("hideTestRequestButton"), "onUpdate:modelValue": _cache[8] || (_cache[8] = (v) => setValue("hideTestRequestButton", !!v)) }, { default: withCtx(() => [..._cache[17] || (_cache[17] = [ createTextVNode(" Hide Test Request Button ", -1) ])]), _: 1 }, 8, ["modelValue"]) ]), _: 1 }); }; } }); export { _sfc_main as default };