UNPKG

@scalar/api-reference

Version:

Generate beautiful API references from OpenAPI documents

86 lines (85 loc) 3.94 kB
import ApiReferenceToolbarPopover_default from "./ApiReferenceToolbarPopover.vue.js"; import ApiReferenceToolbarConfigLayout_default from "./ApiReferenceToolbarConfigLayout.vue.js"; import ApiReferenceToolbarConfigLayoutOptions_default from "./ApiReferenceToolbarConfigLayoutOptions.vue.js"; import ApiReferenceToolbarConfigTheme_default from "./ApiReferenceToolbarConfigTheme.vue.js"; import { computed, createBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, unref, useModel, withCtx } from "vue"; import { ScalarCodeBlock, ScalarFormField, ScalarFormSection } from "@scalar/components"; import { prettyPrintJson } from "@scalar/helpers/json/pretty-print-json"; //#region src/features/developer-tools/components/ModifyConfiguration.vue?vue&type=script&setup=true&lang.ts var _hoisted_1 = { class: "flex flex-col gap-4" }; var ModifyConfiguration_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({ __name: "ModifyConfiguration", props: /* @__PURE__ */ mergeModels({ configuration: {} }, { "overrides": {}, "overridesModifiers": {} }), emits: ["update:overrides"], setup(__props) { const overrides = useModel(__props, "overrides"); const snippet = computed(() => { return prettyPrintJson({ ...overrides.value, ...__props.configuration, ...overrides.value }); }); const theme = computed({ get: () => overrides.value?.theme ?? __props.configuration?.theme ?? "default", set: (t) => overrides.value = { ...overrides.value, theme: t } }); const layout = computed({ get: () => overrides.value?.layout ?? __props.configuration?.layout ?? "modern", set: (l) => overrides.value = { ...overrides.value, layout: l } }); return (_ctx, _cache) => { return openBlock(), createBlock(ApiReferenceToolbarPopover_default, { class: "w-120" }, { label: withCtx(() => [..._cache[3] || (_cache[3] = [createTextVNode("Configure", -1)])]), default: withCtx(() => [createVNode(unref(ScalarFormSection), null, { label: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode("Scalar Configuration", -1)])]), default: withCtx(() => [createVNode(unref(ScalarCodeBlock), { class: "bg-b-1.5 flex max-h-40 flex-col rounded border text-sm", content: snippet.value, lang: "json" }, null, 8, ["content"])]), _: 1 }), createElementVNode("div", _hoisted_1, [ createVNode(unref(ScalarFormField), null, { label: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("Theme", -1)])]), default: withCtx(() => [createVNode(ApiReferenceToolbarConfigTheme_default, { modelValue: theme.value, "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => theme.value = $event) }, null, 8, ["modelValue"])]), _: 1 }), createVNode(unref(ScalarFormField), null, { label: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode("Layout", -1)])]), default: withCtx(() => [createVNode(ApiReferenceToolbarConfigLayout_default, { modelValue: layout.value, "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => layout.value = $event) }, null, 8, ["modelValue"])]), _: 1 }), createVNode(unref(ScalarFormField), { is: "div" }, { label: withCtx(() => [..._cache[7] || (_cache[7] = [createTextVNode("Layout Options", -1)])]), default: withCtx(() => [createVNode(ApiReferenceToolbarConfigLayoutOptions_default, { modelValue: overrides.value, "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => overrides.value = $event), configuration: __props.configuration }, null, 8, ["modelValue", "configuration"])]), _: 1 }) ])]), _: 1 }); }; } }); //#endregion export { ModifyConfiguration_vue_vue_type_script_setup_true_lang_default as default }; //# sourceMappingURL=ModifyConfiguration.vue.script.js.map