UNPKG

@scalar/api-reference

Version:

Generate beautiful API references from OpenAPI documents

90 lines (89 loc) 3.98 kB
import { defineComponent, ref, createBlock, openBlock, withCtx, createVNode, unref, createElementBlock, Fragment, renderList, createElementVNode, createTextVNode, toDisplayString } from "vue"; import { ScalarFormSection, ScalarFormInputGroup, ScalarToggleInput, ScalarIcon } from "@scalar/components"; import ApiReferenceToolbarBlurb from "./ApiReferenceToolbarBlurb.vue.js"; import _sfc_main$1 from "./ApiReferenceToolbarPopover.vue.js"; import _sfc_main$2 from "./ApiReferenceToolbarRegisterButton.vue.js"; const _hoisted_1 = { class: "inline-flex items-center gap-2" }; const _sfc_main = /* @__PURE__ */ defineComponent({ __name: "ApiReferenceToolbarSdks", props: { workspace: {} }, setup(__props) { const LANGUAGES = [ { key: "typescript", label: "Typescript", icon: "programming-language-typescript" }, { key: "python", label: "Python", icon: "programming-language-python" }, { key: "csharp", label: "C#", icon: "programming-language-csharp" }, { key: "java", label: "Java", icon: "programming-language-java" }, { key: "ruby", label: "Ruby", icon: "programming-language-ruby" }, { key: "php", label: "PHP", icon: "programming-language-php" }, { key: "go", label: "Go", icon: "programming-language-go" } ]; const selectedLanguages = ref([]); return (_ctx, _cache) => { return openBlock(), createBlock(_sfc_main$1, { class: "w-110" }, { label: withCtx(() => [..._cache[0] || (_cache[0] = [ createTextVNode("Generate SDKs", -1) ])]), default: withCtx(() => [ createVNode(unref(ScalarFormSection), null, { label: withCtx(() => [..._cache[1] || (_cache[1] = [ createTextVNode("Select Languages", -1) ])]), default: withCtx(() => [ createVNode(unref(ScalarFormInputGroup), null, { default: withCtx(() => [ (openBlock(), createElementBlock(Fragment, null, renderList(LANGUAGES, ({ key, label, icon }) => { return createVNode(unref(ScalarToggleInput), { key, modelValue: selectedLanguages.value.includes(key), "onUpdate:modelValue": (enabled) => enabled ? selectedLanguages.value = [...selectedLanguages.value, key] : selectedLanguages.value = selectedLanguages.value.filter( (k) => k !== key ) }, { default: withCtx(() => [ createElementVNode("span", _hoisted_1, [ createVNode(unref(ScalarIcon), { icon, class: "text-c-2 size-3.5" }, null, 8, ["icon"]), createTextVNode(" " + toDisplayString(label), 1) ]) ]), _: 2 }, 1032, ["modelValue", "onUpdate:modelValue"]); }), 64)) ]), _: 1 }), createVNode(_sfc_main$2, { sdks: selectedLanguages.value, workspace: __props.workspace }, null, 8, ["sdks", "workspace"]), createVNode(ApiReferenceToolbarBlurb, null, { default: withCtx(() => [..._cache[2] || (_cache[2] = [ createTextVNode(" Generating SDKs is a paid feature starting at $100/mo, learn more in our ", -1), createElementVNode("a", { href: "https://scalar.com/products/sdks/getting-started", target: "_blank" }, " guides", -1), createTextVNode(". ", -1) ])]), _: 1 }) ]), _: 1 }) ]), _: 1 }); }; } }); export { _sfc_main as default };