@scalar/api-reference
Version:
Generate beautiful API references from OpenAPI documents
112 lines (111 loc) • 5.36 kB
JavaScript
import { createBlock, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, unref, useModel, withCtx } from "vue";
import { ScalarFormInputGroup, ScalarToggleInput } from "@scalar/components";
//#region src/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue?vue&type=script&setup=true&lang.ts
var ApiReferenceToolbarConfigLayoutOptions_vue_vue_type_script_setup_true_lang_default = /* @__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[11] || (_cache[11] = [createTextVNode(" Show Sidebar ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("defaultOpenFirstTag", true),
"onUpdate:modelValue": _cache[1] || (_cache[1] = (v) => setValue("defaultOpenFirstTag", !!v, true))
}, {
default: withCtx(() => [..._cache[12] || (_cache[12] = [createTextVNode(" Default Open First Tag ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("defaultOpenAllTags"),
"onUpdate:modelValue": _cache[2] || (_cache[2] = (v) => setValue("defaultOpenAllTags", !!v))
}, {
default: withCtx(() => [..._cache[13] || (_cache[13] = [createTextVNode(" Default Open All Tags ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("expandAllModelSections"),
"onUpdate:modelValue": _cache[3] || (_cache[3] = (v) => setValue("expandAllModelSections", !!v))
}, {
default: withCtx(() => [..._cache[14] || (_cache[14] = [createTextVNode(" Expand All Model Sections ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("expandAllResponses"),
"onUpdate:modelValue": _cache[4] || (_cache[4] = (v) => setValue("expandAllResponses", !!v))
}, {
default: withCtx(() => [..._cache[15] || (_cache[15] = [createTextVNode(" Expand All Responses ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("hideClientButton"),
"onUpdate:modelValue": _cache[5] || (_cache[5] = (v) => setValue("hideClientButton", !!v))
}, {
default: withCtx(() => [..._cache[16] || (_cache[16] = [createTextVNode(" Hide Client Button ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("hideDarkModeToggle"),
"onUpdate:modelValue": _cache[6] || (_cache[6] = (v) => setValue("hideDarkModeToggle", !!v))
}, {
default: withCtx(() => [..._cache[17] || (_cache[17] = [createTextVNode(" Hide Dark Mode Toggle ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("hideModels"),
"onUpdate:modelValue": _cache[7] || (_cache[7] = (v) => setValue("hideModels", !!v))
}, {
default: withCtx(() => [..._cache[18] || (_cache[18] = [createTextVNode(" Hide Models ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("hideSearch"),
"onUpdate:modelValue": _cache[8] || (_cache[8] = (v) => setValue("hideSearch", !!v))
}, {
default: withCtx(() => [..._cache[19] || (_cache[19] = [createTextVNode(" Hide Search ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("showOperationId"),
"onUpdate:modelValue": _cache[9] || (_cache[9] = (v) => setValue("showOperationId", !!v))
}, {
default: withCtx(() => [..._cache[20] || (_cache[20] = [createTextVNode(" Show Operation ID ", -1)])]),
_: 1
}, 8, ["modelValue"]),
createVNode(unref(ScalarToggleInput), {
modelValue: getValue("hideTestRequestButton"),
"onUpdate:modelValue": _cache[10] || (_cache[10] = (v) => setValue("hideTestRequestButton", !!v))
}, {
default: withCtx(() => [..._cache[21] || (_cache[21] = [createTextVNode(" Hide Test Request Button ", -1)])]),
_: 1
}, 8, ["modelValue"])
]),
_: 1
});
};
}
});
//#endregion
export { ApiReferenceToolbarConfigLayoutOptions_vue_vue_type_script_setup_true_lang_default as default };
//# sourceMappingURL=ApiReferenceToolbarConfigLayoutOptions.vue.script.js.map