@scalar/api-reference 1.49.8 → 1.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/browser/standalone.js +206 -204
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReference.vue.js +1 -1
  6. package/dist/components/ApiReference.vue.js.map +1 -1
  7. package/dist/components/ApiReference.vue.script.js +4 -4
  8. package/dist/components/ApiReference.vue.script.js.map +1 -1
  9. package/dist/components/Content/Auth/Auth.vue.d.ts +1 -1
  10. package/dist/components/Content/Auth/Auth.vue.d.ts.map +1 -1
  11. package/dist/components/Content/Auth/Auth.vue.js.map +1 -1
  12. package/dist/components/Content/Auth/Auth.vue.script.js +1 -1
  13. package/dist/components/Content/Auth/Auth.vue.script.js.map +1 -1
  14. package/dist/components/Content/Auth/helpers/get-default-security.d.ts +1 -1
  15. package/dist/components/Content/Auth/helpers/get-default-security.d.ts.map +1 -1
  16. package/dist/components/Content/Auth/helpers/get-default-security.js.map +1 -1
  17. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  18. package/dist/components/Content/Content.vue.js.map +1 -1
  19. package/dist/components/Content/Content.vue.script.js +2 -4
  20. package/dist/components/Content/Content.vue.script.js.map +1 -1
  21. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +1 -1
  22. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
  23. package/dist/components/Content/Operations/TraversedEntry.vue.js.map +1 -1
  24. package/dist/components/Content/Operations/TraversedEntry.vue.script.js +1 -1
  25. package/dist/components/Content/Operations/TraversedEntry.vue.script.js.map +1 -1
  26. package/dist/components/Content/Tags/components/ClassicLayout.vue.d.ts.map +1 -1
  27. package/dist/components/Content/Tags/components/ClassicLayout.vue.js +1 -1
  28. package/dist/components/Content/Tags/components/ClassicLayout.vue.js.map +1 -1
  29. package/dist/components/Content/Tags/components/ClassicLayout.vue.script.js +9 -5
  30. package/dist/components/Content/Tags/components/ClassicLayout.vue.script.js.map +1 -1
  31. package/dist/features/Operation/Operation.vue.d.ts +1 -1
  32. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  33. package/dist/features/Operation/Operation.vue.js.map +1 -1
  34. package/dist/features/Operation/Operation.vue.script.js +1 -1
  35. package/dist/features/Operation/Operation.vue.script.js.map +1 -1
  36. package/dist/features/Operation/helpers/filter-selected-security.d.ts +2 -1
  37. package/dist/features/Operation/helpers/filter-selected-security.d.ts.map +1 -1
  38. package/dist/features/Operation/helpers/filter-selected-security.js +1 -2
  39. package/dist/features/Operation/helpers/filter-selected-security.js.map +1 -1
  40. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +1 -1
  41. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  42. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  43. package/dist/features/Operation/layouts/ClassicLayout.vue.js.map +1 -1
  44. package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
  45. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +1 -1
  46. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  47. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  48. package/dist/features/Operation/layouts/ModernLayout.vue.js.map +1 -1
  49. package/dist/features/Operation/layouts/ModernLayout.vue.script.js.map +1 -1
  50. package/dist/features/Search/helpers/create-fuse-instance.d.ts.map +1 -1
  51. package/dist/features/Search/helpers/create-fuse-instance.js +4 -0
  52. package/dist/features/Search/helpers/create-fuse-instance.js.map +1 -1
  53. package/dist/features/Search/helpers/create-search-index.d.ts.map +1 -1
  54. package/dist/features/Search/helpers/create-search-index.js +41 -4
  55. package/dist/features/Search/helpers/create-search-index.js.map +1 -1
  56. package/dist/features/Search/types.d.ts +1 -0
  57. package/dist/features/Search/types.d.ts.map +1 -1
  58. package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
  59. package/dist/features/example-responses/ExampleResponse.vue.js +1 -1
  60. package/dist/features/example-responses/ExampleResponse.vue.js.map +1 -1
  61. package/dist/features/example-responses/ExampleResponse.vue.script.js +2 -1
  62. package/dist/features/example-responses/ExampleResponse.vue.script.js.map +1 -1
  63. package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
  64. package/dist/features/example-responses/ExampleResponses.vue.js.map +1 -1
  65. package/dist/features/example-responses/ExampleResponses.vue.script.js +1 -1
  66. package/dist/features/example-responses/ExampleResponses.vue.script.js.map +1 -1
  67. package/dist/features/external-docs/ExternalDocs.vue.d.ts +2 -2
  68. package/dist/features/external-docs/ExternalDocs.vue.d.ts.map +1 -1
  69. package/dist/features/external-docs/ExternalDocs.vue.js.map +1 -1
  70. package/dist/features/external-docs/ExternalDocs.vue.script.js.map +1 -1
  71. package/dist/features/info-object/Contact.vue.d.ts +2 -2
  72. package/dist/features/info-object/Contact.vue.d.ts.map +1 -1
  73. package/dist/features/info-object/Contact.vue.js.map +1 -1
  74. package/dist/features/info-object/Contact.vue.script.js.map +1 -1
  75. package/dist/features/info-object/License.vue.d.ts +2 -2
  76. package/dist/features/info-object/License.vue.d.ts.map +1 -1
  77. package/dist/features/info-object/License.vue.js.map +1 -1
  78. package/dist/features/info-object/License.vue.script.js.map +1 -1
  79. package/dist/features/info-object/TermsOfService.vue.d.ts +2 -2
  80. package/dist/features/info-object/TermsOfService.vue.d.ts.map +1 -1
  81. package/dist/features/info-object/TermsOfService.vue.js.map +1 -1
  82. package/dist/features/info-object/TermsOfService.vue.script.js.map +1 -1
  83. package/dist/helpers/openapi.d.ts +2 -5
  84. package/dist/helpers/openapi.d.ts.map +1 -1
  85. package/dist/helpers/openapi.js +25 -19
  86. package/dist/helpers/openapi.js.map +1 -1
  87. package/dist/style.css +321 -364
  88. package/package.json +20 -21
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleResponse.vue.script.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponse.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport {\n getExampleFromSchema,\n getResolvedRefDeep,\n} from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport { ScalarCodeBlock, ScalarVirtualText } from '@scalar/components'\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport type {\n ExampleObject,\n MediaTypeObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nconst { example, response } = defineProps<{\n response: MediaTypeObject | undefined\n example: ExampleObject | undefined\n}>()\n\n/** Get content from the appropriate source */\nconst getContent = () => {\n if (example !== undefined) {\n return getResolvedRefDeep(example)?.value ?? ''\n }\n\n if (response?.schema) {\n return getExampleFromSchema(\n // Should be safe to deep resolve the schema here because we don't have to do any sibling resolution for example generation\n getResolvedRefDeep(response.schema) as SchemaObject,\n {\n emptyString: 'string',\n mode: 'read',\n },\n )\n }\n\n return undefined\n}\n\n/** Pre-pretty printed content string, avoids multiple pretty prints*/\nconst prettyPrintedContent = computed(() => {\n const content = getContent()\n if (content === undefined) {\n return undefined\n }\n return prettyPrintJson(content)\n})\n\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\n// Virtualize the code block if it's too large\nconst shouldVirtualize = computed(() => {\n if (prettyPrintedContent.value === undefined) {\n return false\n }\n return prettyPrintedContent.value.length > VIRTUALIZATION_THRESHOLD\n})\n</script>\n<template>\n <!-- Example -->\n <ScalarCodeBlock\n v-if=\"prettyPrintedContent !== undefined && !shouldVirtualize\"\n class=\"bg-b-2\"\n lang=\"json\"\n :prettyPrintedContent=\"prettyPrintedContent\" />\n\n <ScalarVirtualText\n v-else-if=\"prettyPrintedContent !== undefined && shouldVirtualize\"\n containerClass=\"custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen\"\n contentClass=\"language-plaintext whitespace-pre font-code text-base\"\n :lineHeight=\"20\"\n :text=\"prettyPrintedContent\" />\n\n <div\n v-else\n class=\"empty-state\">\n No Body\n </div>\n</template>\n\n<style scoped>\n.empty-state {\n margin: 10px 0 10px 12px;\n text-align: center;\n font-size: var(--scalar-mini);\n min-height: 56px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--scalar-radius-lg);\n color: var(--scalar-color-2);\n}\n\n.rule-title {\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n display: inline-block;\n margin: 12px 0 6px;\n border-radius: var(--scalar-radius);\n}\n\n.rule {\n margin: 0 12px 0;\n border-radius: var(--scalar-radius-lg);\n}\n\n.rule-items {\n counter-reset: list-number;\n display: flex;\n flex-direction: column;\n gap: 12px;\n border-left: 1px solid var(--scalar-border-color);\n padding: 12px 0 12px;\n}\n.rule-item {\n counter-increment: list-number;\n border: 1px solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n overflow: hidden;\n margin-left: 24px;\n}\n.rule-item:before {\n /* content: counter(list-number); */\n border: 1px solid var(--scalar-border-color);\n border-top: 0;\n border-right: 0;\n content: ' ';\n display: block;\n width: 24px;\n height: 6px;\n border-radius: 0 0 0 var(--scalar-radius-lg);\n margin-top: 6px;\n color: var(--scalar-color-2);\n transform: translateX(-25px);\n color: var(--scalar-color-1);\n position: absolute;\n}\n</style>\n"],"mappings":";;;;;;;;;AAgDA,IAAM,2BAA2B;;;;;;;;;EA5BjC,MAAM,mBAAmB;AACvB,OAAI,QAAA,YAAY,KAAA,EACd,QAAO,mBAAmB,QAAA,QAAQ,EAAE,SAAS;AAG/C,OAAI,QAAA,UAAU,OACZ,QAAO,qBAEL,mBAAmB,QAAA,SAAS,OAAO,EACnC;IACE,aAAa;IACb,MAAM;IACP,CACH;;;EAOJ,MAAM,uBAAuB,eAAe;GAC1C,MAAM,UAAU,YAAW;AAC3B,OAAI,YAAY,KAAA,EACd;AAEF,UAAO,gBAAgB,QAAO;IAC/B;EAKD,MAAM,mBAAmB,eAAe;AACtC,OAAI,qBAAqB,UAAU,KAAA,EACjC,QAAO;AAET,UAAO,qBAAqB,MAAM,SAAS;IAC5C;;UAKS,qBAAA,UAAyB,KAAA,KAAS,CAAK,iBAAA,SAAA,WAAA,EAD/C,YAIiD,MAAA,gBAAA,EAAA;;IAF/C,OAAM;IACN,MAAK;IACJ,sBAAsB,qBAAA;4CAGZ,qBAAA,UAAyB,KAAA,KAAa,iBAAA,SAAA,WAAA,EADnD,YAKiC,MAAA,kBAAA,EAAA;;IAH/B,gBAAe;IACf,cAAa;IACZ,YAAY;IACZ,MAAM,qBAAA;0CAET,mBAIM,OAJN,YAEsB,YAEtB"}
1
+ {"version":3,"file":"ExampleResponse.vue.script.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponse.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { getResolvedRefDeep } from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport { ScalarCodeBlock, ScalarVirtualText } from '@scalar/components'\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport { getExampleFromSchema } from '@scalar/workspace-store/request-example'\nimport type {\n ExampleObject,\n MediaTypeObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nconst { example, response } = defineProps<{\n response: MediaTypeObject | undefined\n example: ExampleObject | undefined\n}>()\n\n/** Get content from the appropriate source */\nconst getContent = () => {\n if (example !== undefined) {\n return getResolvedRefDeep(example)?.value ?? ''\n }\n\n if (response?.schema) {\n return getExampleFromSchema(\n // Should be safe to deep resolve the schema here because we don't have to do any sibling resolution for example generation\n getResolvedRefDeep(response.schema) as SchemaObject,\n {\n emptyString: 'string',\n mode: 'read',\n },\n )\n }\n\n return undefined\n}\n\n/** Pre-pretty printed content string, avoids multiple pretty prints*/\nconst prettyPrintedContent = computed(() => {\n const content = getContent()\n if (content === undefined) {\n return undefined\n }\n return prettyPrintJson(content)\n})\n\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\n// Virtualize the code block if it's too large\nconst shouldVirtualize = computed(() => {\n if (prettyPrintedContent.value === undefined) {\n return false\n }\n return prettyPrintedContent.value.length > VIRTUALIZATION_THRESHOLD\n})\n</script>\n<template>\n <!-- Example -->\n <ScalarCodeBlock\n v-if=\"prettyPrintedContent !== undefined && !shouldVirtualize\"\n class=\"bg-b-2\"\n lang=\"json\"\n :prettyPrintedContent=\"prettyPrintedContent\" />\n\n <ScalarVirtualText\n v-else-if=\"prettyPrintedContent !== undefined && shouldVirtualize\"\n containerClass=\"custom-scroll scalar-code-block border rounded-b flex flex-1 max-h-screen\"\n contentClass=\"language-plaintext whitespace-pre font-code text-base\"\n :lineHeight=\"20\"\n :text=\"prettyPrintedContent\" />\n\n <div\n v-else\n class=\"empty-state\">\n No Body\n </div>\n</template>\n\n<style scoped>\n.empty-state {\n margin: 10px 0 10px 12px;\n text-align: center;\n font-size: var(--scalar-mini);\n min-height: 56px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--scalar-radius-lg);\n color: var(--scalar-color-2);\n}\n\n.rule-title {\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n display: inline-block;\n margin: 12px 0 6px;\n border-radius: var(--scalar-radius);\n}\n\n.rule {\n margin: 0 12px 0;\n border-radius: var(--scalar-radius-lg);\n}\n\n.rule-items {\n counter-reset: list-number;\n display: flex;\n flex-direction: column;\n gap: 12px;\n border-left: 1px solid var(--scalar-border-color);\n padding: 12px 0 12px;\n}\n.rule-item {\n counter-increment: list-number;\n border: 1px solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n overflow: hidden;\n margin-left: 24px;\n}\n.rule-item:before {\n /* content: counter(list-number); */\n border: 1px solid var(--scalar-border-color);\n border-top: 0;\n border-right: 0;\n content: ' ';\n display: block;\n width: 24px;\n height: 6px;\n border-radius: 0 0 0 var(--scalar-radius-lg);\n margin-top: 6px;\n color: var(--scalar-color-2);\n transform: translateX(-25px);\n color: var(--scalar-color-1);\n position: absolute;\n}\n</style>\n"],"mappings":";;;;;;;;;;AA8CA,IAAM,2BAA2B;;;;;;;;;EA5BjC,MAAM,mBAAmB;AACvB,OAAI,QAAA,YAAY,KAAA,EACd,QAAO,mBAAmB,QAAA,QAAQ,EAAE,SAAS;AAG/C,OAAI,QAAA,UAAU,OACZ,QAAO,qBAEL,mBAAmB,QAAA,SAAS,OAAO,EACnC;IACE,aAAa;IACb,MAAM;IACP,CACH;;;EAOJ,MAAM,uBAAuB,eAAe;GAC1C,MAAM,UAAU,YAAW;AAC3B,OAAI,YAAY,KAAA,EACd;AAEF,UAAO,gBAAgB,QAAO;IAC/B;EAKD,MAAM,mBAAmB,eAAe;AACtC,OAAI,qBAAqB,UAAU,KAAA,EACjC,QAAO;AAET,UAAO,qBAAqB,MAAM,SAAS;IAC5C;;UAKS,qBAAA,UAAyB,KAAA,KAAS,CAAK,iBAAA,SAAA,WAAA,EAD/C,YAIiD,MAAA,gBAAA,EAAA;;IAF/C,OAAM;IACN,MAAK;IACJ,sBAAsB,qBAAA;4CAGZ,qBAAA,UAAyB,KAAA,KAAa,iBAAA,SAAA,WAAA,EADnD,YAKiC,MAAA,kBAAA,EAAA;;IAH/B,gBAAe;IACf,cAAa;IACZ,YAAY;IACZ,MAAM,qBAAA;0CAET,mBAIM,OAJN,YAEsB,YAEtB"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
2
2
  import ExampleResponses_vue_vue_type_script_setup_true_lang_default from "./ExampleResponses.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/features/example-responses/ExampleResponses.vue
5
- var ExampleResponses_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ExampleResponses_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-5b8a574c"]]);
5
+ var ExampleResponses_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ExampleResponses_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-9f4fecde"]]);
6
6
  //#endregion
7
7
  export { ExampleResponses_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleResponses.vue.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponses.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { getExample } from '@scalar/api-client/v2/blocks/operation-block'\nimport { ExamplePicker } from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardSection,\n ScalarIcon,\n ScalarMarkdown,\n} from '@scalar/components'\nimport {\n getObjectKeys,\n normalizeMimeTypeObject,\n} from '@scalar/oas-utils/helpers'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n MediaTypeObject,\n ResponsesObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, toValue, useId, watch } from 'vue'\n\nimport ScreenReader from '@/components/ScreenReader.vue'\nimport ExampleSchema from '@/features/example-responses/ExampleSchema.vue'\n\nimport ExampleResponse from './ExampleResponse.vue'\nimport ExampleResponseTab from './ExampleResponseTab.vue'\nimport ExampleResponseTabList from './ExampleResponseTabList.vue'\nimport { hasResponseContent } from './has-response-content'\n\n/**\n * TODO: copyToClipboard isn't using the right content if there are multiple examples\n */\n\nconst { responses } = defineProps<{\n responses: ResponsesObject\n}>()\n\nconst id = useId()\nconst { copyToClipboard } = useClipboard()\n\n// Bring the status codes in the right order.\nconst orderedStatusCodes = computed<string[]>(() =>\n Object.keys(responses ?? {}).sort(),\n)\n\n// Filter to only valid response keys that should render in the example responses panel\nconst statusCodesWithContent = computed<string[]>(() =>\n orderedStatusCodes.value.filter((statusCode) =>\n hasResponseContent(getResolvedRef(responses?.[statusCode]), statusCode),\n ),\n)\n\n// Keep track of the current selected tab\nconst selectedResponseIndex = ref<number>(0)\n\n/**\n * Clamp the selected index when the filtered list shrinks.\n * Without this, the index can become out of bounds and cause a mismatch\n * between the visible tabs and the displayed content.\n *\n * We also reset `selectedExampleKey` to match the behavior of `changeTab`,\n * since the new response may not have the same example keys.\n */\nwatch(statusCodesWithContent, (codes) => {\n if (codes.length === 0) {\n selectedResponseIndex.value = 0\n selectedExampleKey.value = ''\n } else if (selectedResponseIndex.value >= codes.length) {\n selectedResponseIndex.value = codes.length - 1\n selectedExampleKey.value = ''\n }\n})\n\n// Return the whole response object\nconst currentResponse = computed(() => {\n const currentStatusCode =\n toValue(statusCodesWithContent)[toValue(selectedResponseIndex)] ?? ''\n\n return getResolvedRef(responses?.[currentStatusCode])\n})\n\nconst currentResponseContent = computed<MediaTypeObject | undefined>(() => {\n const normalizedContent = normalizeMimeTypeObject(\n currentResponse.value?.content,\n )\n\n /** All the keys of the normalized content */\n const keys = getObjectKeys(normalizedContent ?? {})\n\n return (\n // OpenAPI 3.x\n normalizedContent?.['application/json'] ??\n normalizedContent?.['application/xml'] ??\n normalizedContent?.['text/plain'] ??\n normalizedContent?.['text/html'] ??\n normalizedContent?.['*/*'] ??\n // Take the first key - in the future we may want to use the selected content type\n normalizedContent?.[keys[0] ?? ''] ??\n undefined\n )\n})\n\nconst hasMultipleExamples = computed<boolean>(\n () =>\n !!currentResponseContent.value?.examples &&\n Object.keys(currentResponseContent.value?.examples ?? {}).length > 1,\n)\n\nconst selectedExampleKey = ref<string>(\n Object.keys(currentResponseContent.value?.examples ?? {})[0] ?? '',\n)\n\n/** Get the current example to display */\nconst currentExample = computed(() => {\n if (!currentResponseContent.value) {\n return undefined\n }\n\n // When multiple examples exist and one is selected, we access it directly\n if (hasMultipleExamples.value && selectedExampleKey.value) {\n return currentResponseContent.value.examples?.[selectedExampleKey.value]\n }\n\n // Otherwise, we use getExample with an undefined exampleKey to handle fallbacks\n return getExample(currentResponseContent.value, undefined, undefined)\n})\n\nconst changeTab = (index: number) => {\n selectedResponseIndex.value = index\n selectedExampleKey.value = ''\n}\n\nconst showSchema = ref(false)\n</script>\n<template>\n <ScalarCard\n v-if=\"statusCodesWithContent.length\"\n aria-label=\"Example Responses\"\n class=\"response-card\"\n role=\"region\">\n <ExampleResponseTabList @change=\"changeTab\">\n <ExampleResponseTab\n v-for=\"statusCode in statusCodesWithContent\"\n :key=\"statusCode\"\n :aria-controls=\"id\">\n <ScreenReader>Status:</ScreenReader>\n {{ statusCode }}\n </ExampleResponseTab>\n\n <template #actions>\n <button\n v-if=\"currentResponseContent?.example\"\n class=\"code-copy\"\n type=\"button\"\n @click=\"() => copyToClipboard(currentResponseContent?.example)\">\n <ScalarIcon\n icon=\"Clipboard\"\n width=\"12px\" />\n </button>\n <label\n v-if=\"currentResponseContent?.schema\"\n class=\"scalar-card-checkbox\">\n Show Schema\n <input\n v-model=\"showSchema\"\n :aria-controls=\"id\"\n class=\"scalar-card-checkbox-input\"\n type=\"checkbox\" />\n <span class=\"scalar-card-checkbox-checkmark\" />\n </label>\n </template>\n </ExampleResponseTabList>\n <ScalarCardSection class=\"grid flex-1\">\n <!-- Schema -->\n <ExampleSchema\n v-if=\"currentResponseContent?.schema && showSchema\"\n :id=\"id\"\n :schema=\"currentResponseContent?.schema\" />\n\n <!-- Example -->\n <ExampleResponse\n v-else\n :id=\"id\"\n :example=\"currentExample\"\n :response=\"currentResponseContent\" />\n </ScalarCardSection>\n <ScalarCardFooter\n v-if=\"currentResponse?.description || hasMultipleExamples\"\n class=\"response-card-footer\">\n <ExamplePicker\n v-if=\"hasMultipleExamples\"\n v-model=\"selectedExampleKey\"\n class=\"response-example-selector px-0\"\n :examples=\"currentResponseContent?.examples\" />\n <div class=\"response-description\">\n <ScalarMarkdown\n v-if=\"currentResponse?.description\"\n class=\"response-description-markdown\"\n :value=\"currentResponse.description\" />\n </div>\n </ScalarCardFooter>\n </ScalarCard>\n</template>\n\n<style scoped>\n.response-card {\n font-size: var(--scalar-font-size-3);\n}\n\n.code-copy {\n display: flex;\n align-items: center;\n justify-content: center;\n appearance: none;\n -webkit-appearance: none;\n outline: none;\n background: transparent;\n cursor: pointer;\n color: var(--scalar-color-3);\n border: none;\n padding: 0;\n margin-right: 12px;\n}\n.code-copy:hover {\n color: var(--scalar-color-1);\n}\n.code-copy svg {\n width: 13px;\n height: 13px;\n}\n.response-card-footer {\n display: flex;\n flex-direction: row-reverse;\n flex-wrap: wrap;\n justify-content: start;\n flex-shrink: 0;\n padding: 7px 12px;\n column-gap: 8px;\n}\n.response-example-selector {\n flex-shrink: 0;\n margin: -4px;\n}\n.response-description {\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-small);\n color: var(--scalar-color--1);\n\n box-sizing: border-box;\n\n flex-grow: 1;\n}\n.response-description-markdown {\n max-height: 3lh;\n}\n\n.response-description-markdown :deep(*) {\n margin: 0;\n}\n.schema-type {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n background: var(--scalar-background-3);\n padding: 2px 4px;\n border-radius: 4px;\n margin-right: 4px;\n}\n.schema-example {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n}\n\n.example-response-tab {\n display: block;\n margin: 6px;\n}\n\n.scalar-card-checkbox {\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n min-height: 17px;\n cursor: pointer;\n user-select: none;\n font-size: var(--scalar-small);\n font-weight: var(--scalar-font-normal);\n color: var(--scalar-color-2);\n width: fit-content;\n white-space: nowrap;\n gap: 6px;\n padding: 7px 6px;\n}\n.scalar-card-checkbox:has(.scalar-card-checkbox-input:focus-visible)\n .scalar-card-checkbox-checkmark {\n outline: 1px solid var(--scalar-color-accent);\n}\n.scalar-card-checkbox:hover {\n color: var(--scalar-color--1);\n}\n.scalar-card-checkbox .scalar-card-checkbox-input {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n height: 0;\n width: 0;\n}\n\n.scalar-card-checkbox-checkmark {\n height: 16px;\n width: 16px;\n border-radius: var(--scalar-radius);\n background-color: transparent;\n background-color: var(--scalar-background-3);\n box-shadow: inset 0 0 0 var(--scalar-border-width) var(--scalar-border-color);\n}\n.scalar-card-checkbox:has(.scalar-card-checkbox-input:checked) {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n\n.scalar-card-checkbox\n .scalar-card-checkbox-input:checked\n ~ .scalar-card-checkbox-checkmark {\n background-color: var(--scalar-button-1);\n box-shadow: none;\n}\n\n.scalar-card-checkbox-checkmark:after {\n content: '';\n position: absolute;\n display: none;\n}\n\n.scalar-card-checkbox\n .scalar-card-checkbox-input:checked\n ~ .scalar-card-checkbox-checkmark:after {\n display: block;\n}\n\n.scalar-card-checkbox .scalar-card-checkbox-checkmark:after {\n right: 11.5px;\n top: 12.5px;\n width: 5px;\n height: 9px;\n border: solid 1px var(--scalar-button-1-color);\n border-width: 0 1.5px 1.5px 0;\n transform: rotate(45deg);\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"ExampleResponses.vue.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponses.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ExamplePicker } from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardSection,\n ScalarIcon,\n ScalarMarkdown,\n} from '@scalar/components'\nimport {\n getObjectKeys,\n normalizeMimeTypeObject,\n} from '@scalar/oas-utils/helpers'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { getExample } from '@scalar/workspace-store/request-example'\nimport type {\n MediaTypeObject,\n ResponsesObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, toValue, useId, watch } from 'vue'\n\nimport ScreenReader from '@/components/ScreenReader.vue'\nimport ExampleSchema from '@/features/example-responses/ExampleSchema.vue'\n\nimport ExampleResponse from './ExampleResponse.vue'\nimport ExampleResponseTab from './ExampleResponseTab.vue'\nimport ExampleResponseTabList from './ExampleResponseTabList.vue'\nimport { hasResponseContent } from './has-response-content'\n\n/**\n * TODO: copyToClipboard isn't using the right content if there are multiple examples\n */\n\nconst { responses } = defineProps<{\n responses: ResponsesObject\n}>()\n\nconst id = useId()\nconst { copyToClipboard } = useClipboard()\n\n// Bring the status codes in the right order.\nconst orderedStatusCodes = computed<string[]>(() =>\n Object.keys(responses ?? {}).sort(),\n)\n\n// Filter to only valid response keys that should render in the example responses panel\nconst statusCodesWithContent = computed<string[]>(() =>\n orderedStatusCodes.value.filter((statusCode) =>\n hasResponseContent(getResolvedRef(responses?.[statusCode]), statusCode),\n ),\n)\n\n// Keep track of the current selected tab\nconst selectedResponseIndex = ref<number>(0)\n\n/**\n * Clamp the selected index when the filtered list shrinks.\n * Without this, the index can become out of bounds and cause a mismatch\n * between the visible tabs and the displayed content.\n *\n * We also reset `selectedExampleKey` to match the behavior of `changeTab`,\n * since the new response may not have the same example keys.\n */\nwatch(statusCodesWithContent, (codes) => {\n if (codes.length === 0) {\n selectedResponseIndex.value = 0\n selectedExampleKey.value = ''\n } else if (selectedResponseIndex.value >= codes.length) {\n selectedResponseIndex.value = codes.length - 1\n selectedExampleKey.value = ''\n }\n})\n\n// Return the whole response object\nconst currentResponse = computed(() => {\n const currentStatusCode =\n toValue(statusCodesWithContent)[toValue(selectedResponseIndex)] ?? ''\n\n return getResolvedRef(responses?.[currentStatusCode])\n})\n\nconst currentResponseContent = computed<MediaTypeObject | undefined>(() => {\n const normalizedContent = normalizeMimeTypeObject(\n currentResponse.value?.content,\n )\n\n /** All the keys of the normalized content */\n const keys = getObjectKeys(normalizedContent ?? {})\n\n return (\n // OpenAPI 3.x\n normalizedContent?.['application/json'] ??\n normalizedContent?.['application/xml'] ??\n normalizedContent?.['text/plain'] ??\n normalizedContent?.['text/html'] ??\n normalizedContent?.['*/*'] ??\n // Take the first key - in the future we may want to use the selected content type\n normalizedContent?.[keys[0] ?? ''] ??\n undefined\n )\n})\n\nconst hasMultipleExamples = computed<boolean>(\n () =>\n !!currentResponseContent.value?.examples &&\n Object.keys(currentResponseContent.value?.examples ?? {}).length > 1,\n)\n\nconst selectedExampleKey = ref<string>(\n Object.keys(currentResponseContent.value?.examples ?? {})[0] ?? '',\n)\n\n/** Get the current example to display */\nconst currentExample = computed(() => {\n if (!currentResponseContent.value) {\n return undefined\n }\n\n // When multiple examples exist and one is selected, we access it directly\n if (hasMultipleExamples.value && selectedExampleKey.value) {\n return currentResponseContent.value.examples?.[selectedExampleKey.value]\n }\n\n // Otherwise, we use getExample with an undefined exampleKey to handle fallbacks\n return getExample(currentResponseContent.value, undefined, undefined)\n})\n\nconst changeTab = (index: number) => {\n selectedResponseIndex.value = index\n selectedExampleKey.value = ''\n}\n\nconst showSchema = ref(false)\n</script>\n<template>\n <ScalarCard\n v-if=\"statusCodesWithContent.length\"\n aria-label=\"Example Responses\"\n class=\"response-card\"\n role=\"region\">\n <ExampleResponseTabList @change=\"changeTab\">\n <ExampleResponseTab\n v-for=\"statusCode in statusCodesWithContent\"\n :key=\"statusCode\"\n :aria-controls=\"id\">\n <ScreenReader>Status:</ScreenReader>\n {{ statusCode }}\n </ExampleResponseTab>\n\n <template #actions>\n <button\n v-if=\"currentResponseContent?.example\"\n class=\"code-copy\"\n type=\"button\"\n @click=\"() => copyToClipboard(currentResponseContent?.example)\">\n <ScalarIcon\n icon=\"Clipboard\"\n width=\"12px\" />\n </button>\n <label\n v-if=\"currentResponseContent?.schema\"\n class=\"scalar-card-checkbox\">\n Show Schema\n <input\n v-model=\"showSchema\"\n :aria-controls=\"id\"\n class=\"scalar-card-checkbox-input\"\n type=\"checkbox\" />\n <span class=\"scalar-card-checkbox-checkmark\" />\n </label>\n </template>\n </ExampleResponseTabList>\n <ScalarCardSection class=\"grid flex-1\">\n <!-- Schema -->\n <ExampleSchema\n v-if=\"currentResponseContent?.schema && showSchema\"\n :id=\"id\"\n :schema=\"currentResponseContent?.schema\" />\n\n <!-- Example -->\n <ExampleResponse\n v-else\n :id=\"id\"\n :example=\"currentExample\"\n :response=\"currentResponseContent\" />\n </ScalarCardSection>\n <ScalarCardFooter\n v-if=\"currentResponse?.description || hasMultipleExamples\"\n class=\"response-card-footer\">\n <ExamplePicker\n v-if=\"hasMultipleExamples\"\n v-model=\"selectedExampleKey\"\n class=\"response-example-selector px-0\"\n :examples=\"currentResponseContent?.examples\" />\n <div class=\"response-description\">\n <ScalarMarkdown\n v-if=\"currentResponse?.description\"\n class=\"response-description-markdown\"\n :value=\"currentResponse.description\" />\n </div>\n </ScalarCardFooter>\n </ScalarCard>\n</template>\n\n<style scoped>\n.response-card {\n font-size: var(--scalar-font-size-3);\n}\n\n.code-copy {\n display: flex;\n align-items: center;\n justify-content: center;\n appearance: none;\n -webkit-appearance: none;\n outline: none;\n background: transparent;\n cursor: pointer;\n color: var(--scalar-color-3);\n border: none;\n padding: 0;\n margin-right: 12px;\n}\n.code-copy:hover {\n color: var(--scalar-color-1);\n}\n.code-copy svg {\n width: 13px;\n height: 13px;\n}\n.response-card-footer {\n display: flex;\n flex-direction: row-reverse;\n flex-wrap: wrap;\n justify-content: start;\n flex-shrink: 0;\n padding: 7px 12px;\n column-gap: 8px;\n}\n.response-example-selector {\n flex-shrink: 0;\n margin: -4px;\n}\n.response-description {\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-small);\n color: var(--scalar-color--1);\n\n box-sizing: border-box;\n\n flex-grow: 1;\n}\n.response-description-markdown {\n max-height: 3lh;\n}\n\n.response-description-markdown :deep(*) {\n margin: 0;\n}\n.schema-type {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n background: var(--scalar-background-3);\n padding: 2px 4px;\n border-radius: 4px;\n margin-right: 4px;\n}\n.schema-example {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n}\n\n.example-response-tab {\n display: block;\n margin: 6px;\n}\n\n.scalar-card-checkbox {\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n min-height: 17px;\n cursor: pointer;\n user-select: none;\n font-size: var(--scalar-small);\n font-weight: var(--scalar-font-normal);\n color: var(--scalar-color-2);\n width: fit-content;\n white-space: nowrap;\n gap: 6px;\n padding: 7px 6px;\n}\n.scalar-card-checkbox:has(.scalar-card-checkbox-input:focus-visible)\n .scalar-card-checkbox-checkmark {\n outline: 1px solid var(--scalar-color-accent);\n}\n.scalar-card-checkbox:hover {\n color: var(--scalar-color--1);\n}\n.scalar-card-checkbox .scalar-card-checkbox-input {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n height: 0;\n width: 0;\n}\n\n.scalar-card-checkbox-checkmark {\n height: 16px;\n width: 16px;\n border-radius: var(--scalar-radius);\n background-color: transparent;\n background-color: var(--scalar-background-3);\n box-shadow: inset 0 0 0 var(--scalar-border-width) var(--scalar-border-color);\n}\n.scalar-card-checkbox:has(.scalar-card-checkbox-input:checked) {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n\n.scalar-card-checkbox\n .scalar-card-checkbox-input:checked\n ~ .scalar-card-checkbox-checkmark {\n background-color: var(--scalar-button-1);\n box-shadow: none;\n}\n\n.scalar-card-checkbox-checkmark:after {\n content: '';\n position: absolute;\n display: none;\n}\n\n.scalar-card-checkbox\n .scalar-card-checkbox-input:checked\n ~ .scalar-card-checkbox-checkmark:after {\n display: block;\n}\n\n.scalar-card-checkbox .scalar-card-checkbox-checkmark:after {\n right: 11.5px;\n top: 12.5px;\n width: 5px;\n height: 9px;\n border: solid 1px var(--scalar-button-1-color);\n border-width: 0 1.5px 1.5px 0;\n transform: rotate(45deg);\n}\n</style>\n"],"mappings":""}
@@ -7,10 +7,10 @@ import { hasResponseContent } from "./has-response-content.js";
7
7
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, ref, renderList, toDisplayString, toValue, unref, useId, vModelCheckbox, watch, withCtx, withDirectives } from "vue";
8
8
  import { ScalarCard, ScalarCardFooter, ScalarCardSection, ScalarIcon, ScalarMarkdown } from "@scalar/components";
9
9
  import { useClipboard } from "@scalar/use-hooks/useClipboard";
10
+ import { getExample } from "@scalar/workspace-store/request-example";
10
11
  import { getObjectKeys, normalizeMimeTypeObject } from "@scalar/oas-utils/helpers";
11
12
  import { ExamplePicker } from "@scalar/api-client/v2/blocks/operation-code-sample";
12
13
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
13
- import { getExample } from "@scalar/api-client/v2/blocks/operation-block";
14
14
  //#region src/features/example-responses/ExampleResponses.vue?vue&type=script&setup=true&lang.ts
15
15
  var _hoisted_1 = {
16
16
  key: 1,
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleResponses.vue.script.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponses.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { getExample } from '@scalar/api-client/v2/blocks/operation-block'\nimport { ExamplePicker } from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardSection,\n ScalarIcon,\n ScalarMarkdown,\n} from '@scalar/components'\nimport {\n getObjectKeys,\n normalizeMimeTypeObject,\n} from '@scalar/oas-utils/helpers'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n MediaTypeObject,\n ResponsesObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, toValue, useId, watch } from 'vue'\n\nimport ScreenReader from '@/components/ScreenReader.vue'\nimport ExampleSchema from '@/features/example-responses/ExampleSchema.vue'\n\nimport ExampleResponse from './ExampleResponse.vue'\nimport ExampleResponseTab from './ExampleResponseTab.vue'\nimport ExampleResponseTabList from './ExampleResponseTabList.vue'\nimport { hasResponseContent } from './has-response-content'\n\n/**\n * TODO: copyToClipboard isn't using the right content if there are multiple examples\n */\n\nconst { responses } = defineProps<{\n responses: ResponsesObject\n}>()\n\nconst id = useId()\nconst { copyToClipboard } = useClipboard()\n\n// Bring the status codes in the right order.\nconst orderedStatusCodes = computed<string[]>(() =>\n Object.keys(responses ?? {}).sort(),\n)\n\n// Filter to only valid response keys that should render in the example responses panel\nconst statusCodesWithContent = computed<string[]>(() =>\n orderedStatusCodes.value.filter((statusCode) =>\n hasResponseContent(getResolvedRef(responses?.[statusCode]), statusCode),\n ),\n)\n\n// Keep track of the current selected tab\nconst selectedResponseIndex = ref<number>(0)\n\n/**\n * Clamp the selected index when the filtered list shrinks.\n * Without this, the index can become out of bounds and cause a mismatch\n * between the visible tabs and the displayed content.\n *\n * We also reset `selectedExampleKey` to match the behavior of `changeTab`,\n * since the new response may not have the same example keys.\n */\nwatch(statusCodesWithContent, (codes) => {\n if (codes.length === 0) {\n selectedResponseIndex.value = 0\n selectedExampleKey.value = ''\n } else if (selectedResponseIndex.value >= codes.length) {\n selectedResponseIndex.value = codes.length - 1\n selectedExampleKey.value = ''\n }\n})\n\n// Return the whole response object\nconst currentResponse = computed(() => {\n const currentStatusCode =\n toValue(statusCodesWithContent)[toValue(selectedResponseIndex)] ?? ''\n\n return getResolvedRef(responses?.[currentStatusCode])\n})\n\nconst currentResponseContent = computed<MediaTypeObject | undefined>(() => {\n const normalizedContent = normalizeMimeTypeObject(\n currentResponse.value?.content,\n )\n\n /** All the keys of the normalized content */\n const keys = getObjectKeys(normalizedContent ?? {})\n\n return (\n // OpenAPI 3.x\n normalizedContent?.['application/json'] ??\n normalizedContent?.['application/xml'] ??\n normalizedContent?.['text/plain'] ??\n normalizedContent?.['text/html'] ??\n normalizedContent?.['*/*'] ??\n // Take the first key - in the future we may want to use the selected content type\n normalizedContent?.[keys[0] ?? ''] ??\n undefined\n )\n})\n\nconst hasMultipleExamples = computed<boolean>(\n () =>\n !!currentResponseContent.value?.examples &&\n Object.keys(currentResponseContent.value?.examples ?? {}).length > 1,\n)\n\nconst selectedExampleKey = ref<string>(\n Object.keys(currentResponseContent.value?.examples ?? {})[0] ?? '',\n)\n\n/** Get the current example to display */\nconst currentExample = computed(() => {\n if (!currentResponseContent.value) {\n return undefined\n }\n\n // When multiple examples exist and one is selected, we access it directly\n if (hasMultipleExamples.value && selectedExampleKey.value) {\n return currentResponseContent.value.examples?.[selectedExampleKey.value]\n }\n\n // Otherwise, we use getExample with an undefined exampleKey to handle fallbacks\n return getExample(currentResponseContent.value, undefined, undefined)\n})\n\nconst changeTab = (index: number) => {\n selectedResponseIndex.value = index\n selectedExampleKey.value = ''\n}\n\nconst showSchema = ref(false)\n</script>\n<template>\n <ScalarCard\n v-if=\"statusCodesWithContent.length\"\n aria-label=\"Example Responses\"\n class=\"response-card\"\n role=\"region\">\n <ExampleResponseTabList @change=\"changeTab\">\n <ExampleResponseTab\n v-for=\"statusCode in statusCodesWithContent\"\n :key=\"statusCode\"\n :aria-controls=\"id\">\n <ScreenReader>Status:</ScreenReader>\n {{ statusCode }}\n </ExampleResponseTab>\n\n <template #actions>\n <button\n v-if=\"currentResponseContent?.example\"\n class=\"code-copy\"\n type=\"button\"\n @click=\"() => copyToClipboard(currentResponseContent?.example)\">\n <ScalarIcon\n icon=\"Clipboard\"\n width=\"12px\" />\n </button>\n <label\n v-if=\"currentResponseContent?.schema\"\n class=\"scalar-card-checkbox\">\n Show Schema\n <input\n v-model=\"showSchema\"\n :aria-controls=\"id\"\n class=\"scalar-card-checkbox-input\"\n type=\"checkbox\" />\n <span class=\"scalar-card-checkbox-checkmark\" />\n </label>\n </template>\n </ExampleResponseTabList>\n <ScalarCardSection class=\"grid flex-1\">\n <!-- Schema -->\n <ExampleSchema\n v-if=\"currentResponseContent?.schema && showSchema\"\n :id=\"id\"\n :schema=\"currentResponseContent?.schema\" />\n\n <!-- Example -->\n <ExampleResponse\n v-else\n :id=\"id\"\n :example=\"currentExample\"\n :response=\"currentResponseContent\" />\n </ScalarCardSection>\n <ScalarCardFooter\n v-if=\"currentResponse?.description || hasMultipleExamples\"\n class=\"response-card-footer\">\n <ExamplePicker\n v-if=\"hasMultipleExamples\"\n v-model=\"selectedExampleKey\"\n class=\"response-example-selector px-0\"\n :examples=\"currentResponseContent?.examples\" />\n <div class=\"response-description\">\n <ScalarMarkdown\n v-if=\"currentResponse?.description\"\n class=\"response-description-markdown\"\n :value=\"currentResponse.description\" />\n </div>\n </ScalarCardFooter>\n </ScalarCard>\n</template>\n\n<style scoped>\n.response-card {\n font-size: var(--scalar-font-size-3);\n}\n\n.code-copy {\n display: flex;\n align-items: center;\n justify-content: center;\n appearance: none;\n -webkit-appearance: none;\n outline: none;\n background: transparent;\n cursor: pointer;\n color: var(--scalar-color-3);\n border: none;\n padding: 0;\n margin-right: 12px;\n}\n.code-copy:hover {\n color: var(--scalar-color-1);\n}\n.code-copy svg {\n width: 13px;\n height: 13px;\n}\n.response-card-footer {\n display: flex;\n flex-direction: row-reverse;\n flex-wrap: wrap;\n justify-content: start;\n flex-shrink: 0;\n padding: 7px 12px;\n column-gap: 8px;\n}\n.response-example-selector {\n flex-shrink: 0;\n margin: -4px;\n}\n.response-description {\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-small);\n color: var(--scalar-color--1);\n\n box-sizing: border-box;\n\n flex-grow: 1;\n}\n.response-description-markdown {\n max-height: 3lh;\n}\n\n.response-description-markdown :deep(*) {\n margin: 0;\n}\n.schema-type {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n background: var(--scalar-background-3);\n padding: 2px 4px;\n border-radius: 4px;\n margin-right: 4px;\n}\n.schema-example {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n}\n\n.example-response-tab {\n display: block;\n margin: 6px;\n}\n\n.scalar-card-checkbox {\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n min-height: 17px;\n cursor: pointer;\n user-select: none;\n font-size: var(--scalar-small);\n font-weight: var(--scalar-font-normal);\n color: var(--scalar-color-2);\n width: fit-content;\n white-space: nowrap;\n gap: 6px;\n padding: 7px 6px;\n}\n.scalar-card-checkbox:has(.scalar-card-checkbox-input:focus-visible)\n .scalar-card-checkbox-checkmark {\n outline: 1px solid var(--scalar-color-accent);\n}\n.scalar-card-checkbox:hover {\n color: var(--scalar-color--1);\n}\n.scalar-card-checkbox .scalar-card-checkbox-input {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n height: 0;\n width: 0;\n}\n\n.scalar-card-checkbox-checkmark {\n height: 16px;\n width: 16px;\n border-radius: var(--scalar-radius);\n background-color: transparent;\n background-color: var(--scalar-background-3);\n box-shadow: inset 0 0 0 var(--scalar-border-width) var(--scalar-border-color);\n}\n.scalar-card-checkbox:has(.scalar-card-checkbox-input:checked) {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n\n.scalar-card-checkbox\n .scalar-card-checkbox-input:checked\n ~ .scalar-card-checkbox-checkmark {\n background-color: var(--scalar-button-1);\n box-shadow: none;\n}\n\n.scalar-card-checkbox-checkmark:after {\n content: '';\n position: absolute;\n display: none;\n}\n\n.scalar-card-checkbox\n .scalar-card-checkbox-input:checked\n ~ .scalar-card-checkbox-checkmark:after {\n display: block;\n}\n\n.scalar-card-checkbox .scalar-card-checkbox-checkmark:after {\n right: 11.5px;\n top: 12.5px;\n width: 5px;\n height: 9px;\n border: solid 1px var(--scalar-button-1-color);\n border-width: 0 1.5px 1.5px 0;\n transform: rotate(45deg);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCA,MAAM,KAAK,OAAM;EACjB,MAAM,EAAE,oBAAoB,cAAa;EAGzC,MAAM,qBAAqB,eACzB,OAAO,KAAK,QAAA,aAAa,EAAE,CAAC,CAAC,MAAM,CACrC;EAGA,MAAM,yBAAyB,eAC7B,mBAAmB,MAAM,QAAQ,eAC/B,mBAAmB,eAAe,QAAA,YAAY,YAAY,EAAE,WAAW,CACxE,CACH;EAGA,MAAM,wBAAwB,IAAY,EAAC;;;;;;;;;AAU3C,QAAM,yBAAyB,UAAU;AACvC,OAAI,MAAM,WAAW,GAAG;AACtB,0BAAsB,QAAQ;AAC9B,uBAAmB,QAAQ;cAClB,sBAAsB,SAAS,MAAM,QAAQ;AACtD,0BAAsB,QAAQ,MAAM,SAAS;AAC7C,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MAAA,eAAA,EAAA;;OADvC,OAAM;OACL,OAAO,gBAAA,MAAgB"}
1
+ {"version":3,"file":"ExampleResponses.vue.script.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponses.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ExamplePicker } from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport {\n ScalarCard,\n ScalarCardFooter,\n ScalarCardSection,\n ScalarIcon,\n ScalarMarkdown,\n} from '@scalar/components'\nimport {\n getObjectKeys,\n normalizeMimeTypeObject,\n} from '@scalar/oas-utils/helpers'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { getExample } from '@scalar/workspace-store/request-example'\nimport type {\n MediaTypeObject,\n ResponsesObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, toValue, useId, watch } from 'vue'\n\nimport ScreenReader from '@/components/ScreenReader.vue'\nimport ExampleSchema from '@/features/example-responses/ExampleSchema.vue'\n\nimport ExampleResponse from './ExampleResponse.vue'\nimport ExampleResponseTab from './ExampleResponseTab.vue'\nimport ExampleResponseTabList from './ExampleResponseTabList.vue'\nimport { hasResponseContent } from './has-response-content'\n\n/**\n * TODO: copyToClipboard isn't using the right content if there are multiple examples\n */\n\nconst { responses } = defineProps<{\n responses: ResponsesObject\n}>()\n\nconst id = useId()\nconst { copyToClipboard } = useClipboard()\n\n// Bring the status codes in the right order.\nconst orderedStatusCodes = computed<string[]>(() =>\n Object.keys(responses ?? {}).sort(),\n)\n\n// Filter to only valid response keys that should render in the example responses panel\nconst statusCodesWithContent = computed<string[]>(() =>\n orderedStatusCodes.value.filter((statusCode) =>\n hasResponseContent(getResolvedRef(responses?.[statusCode]), statusCode),\n ),\n)\n\n// Keep track of the current selected tab\nconst selectedResponseIndex = ref<number>(0)\n\n/**\n * Clamp the selected index when the filtered list shrinks.\n * Without this, the index can become out of bounds and cause a mismatch\n * between the visible tabs and the displayed content.\n *\n * We also reset `selectedExampleKey` to match the behavior of `changeTab`,\n * since the new response may not have the same example keys.\n */\nwatch(statusCodesWithContent, (codes) => {\n if (codes.length === 0) {\n selectedResponseIndex.value = 0\n selectedExampleKey.value = ''\n } else if (selectedResponseIndex.value >= codes.length) {\n selectedResponseIndex.value = codes.length - 1\n selectedExampleKey.value = ''\n }\n})\n\n// Return the whole response object\nconst currentResponse = computed(() => {\n const currentStatusCode =\n toValue(statusCodesWithContent)[toValue(selectedResponseIndex)] ?? ''\n\n return getResolvedRef(responses?.[currentStatusCode])\n})\n\nconst currentResponseContent = computed<MediaTypeObject | undefined>(() => {\n const normalizedContent = normalizeMimeTypeObject(\n currentResponse.value?.content,\n )\n\n /** All the keys of the normalized content */\n const keys = getObjectKeys(normalizedContent ?? {})\n\n return (\n // OpenAPI 3.x\n normalizedContent?.['application/json'] ??\n normalizedContent?.['application/xml'] ??\n normalizedContent?.['text/plain'] ??\n normalizedContent?.['text/html'] ??\n normalizedContent?.['*/*'] ??\n // Take the first key - in the future we may want to use the selected content type\n normalizedContent?.[keys[0] ?? ''] ??\n undefined\n )\n})\n\nconst hasMultipleExamples = computed<boolean>(\n () =>\n !!currentResponseContent.value?.examples &&\n Object.keys(currentResponseContent.value?.examples ?? {}).length > 1,\n)\n\nconst selectedExampleKey = ref<string>(\n Object.keys(currentResponseContent.value?.examples ?? {})[0] ?? '',\n)\n\n/** Get the current example to display */\nconst currentExample = computed(() => {\n if (!currentResponseContent.value) {\n return undefined\n }\n\n // When multiple examples exist and one is selected, we access it directly\n if (hasMultipleExamples.value && selectedExampleKey.value) {\n return currentResponseContent.value.examples?.[selectedExampleKey.value]\n }\n\n // Otherwise, we use getExample with an undefined exampleKey to handle fallbacks\n return getExample(currentResponseContent.value, undefined, undefined)\n})\n\nconst changeTab = (index: number) => {\n selectedResponseIndex.value = index\n selectedExampleKey.value = ''\n}\n\nconst showSchema = ref(false)\n</script>\n<template>\n <ScalarCard\n v-if=\"statusCodesWithContent.length\"\n aria-label=\"Example Responses\"\n class=\"response-card\"\n role=\"region\">\n <ExampleResponseTabList @change=\"changeTab\">\n <ExampleResponseTab\n v-for=\"statusCode in statusCodesWithContent\"\n :key=\"statusCode\"\n :aria-controls=\"id\">\n <ScreenReader>Status:</ScreenReader>\n {{ statusCode }}\n </ExampleResponseTab>\n\n <template #actions>\n <button\n v-if=\"currentResponseContent?.example\"\n class=\"code-copy\"\n type=\"button\"\n @click=\"() => copyToClipboard(currentResponseContent?.example)\">\n <ScalarIcon\n icon=\"Clipboard\"\n width=\"12px\" />\n </button>\n <label\n v-if=\"currentResponseContent?.schema\"\n class=\"scalar-card-checkbox\">\n Show Schema\n <input\n v-model=\"showSchema\"\n :aria-controls=\"id\"\n class=\"scalar-card-checkbox-input\"\n type=\"checkbox\" />\n <span class=\"scalar-card-checkbox-checkmark\" />\n </label>\n </template>\n </ExampleResponseTabList>\n <ScalarCardSection class=\"grid flex-1\">\n <!-- Schema -->\n <ExampleSchema\n v-if=\"currentResponseContent?.schema && showSchema\"\n :id=\"id\"\n :schema=\"currentResponseContent?.schema\" />\n\n <!-- Example -->\n <ExampleResponse\n v-else\n :id=\"id\"\n :example=\"currentExample\"\n :response=\"currentResponseContent\" />\n </ScalarCardSection>\n <ScalarCardFooter\n v-if=\"currentResponse?.description || hasMultipleExamples\"\n class=\"response-card-footer\">\n <ExamplePicker\n v-if=\"hasMultipleExamples\"\n v-model=\"selectedExampleKey\"\n class=\"response-example-selector px-0\"\n :examples=\"currentResponseContent?.examples\" />\n <div class=\"response-description\">\n <ScalarMarkdown\n v-if=\"currentResponse?.description\"\n class=\"response-description-markdown\"\n :value=\"currentResponse.description\" />\n </div>\n </ScalarCardFooter>\n </ScalarCard>\n</template>\n\n<style scoped>\n.response-card {\n font-size: var(--scalar-font-size-3);\n}\n\n.code-copy {\n display: flex;\n align-items: center;\n justify-content: center;\n appearance: none;\n -webkit-appearance: none;\n outline: none;\n background: transparent;\n cursor: pointer;\n color: var(--scalar-color-3);\n border: none;\n padding: 0;\n margin-right: 12px;\n}\n.code-copy:hover {\n color: var(--scalar-color-1);\n}\n.code-copy svg {\n width: 13px;\n height: 13px;\n}\n.response-card-footer {\n display: flex;\n flex-direction: row-reverse;\n flex-wrap: wrap;\n justify-content: start;\n flex-shrink: 0;\n padding: 7px 12px;\n column-gap: 8px;\n}\n.response-example-selector {\n flex-shrink: 0;\n margin: -4px;\n}\n.response-description {\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-small);\n color: var(--scalar-color--1);\n\n box-sizing: border-box;\n\n flex-grow: 1;\n}\n.response-description-markdown {\n max-height: 3lh;\n}\n\n.response-description-markdown :deep(*) {\n margin: 0;\n}\n.schema-type {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n background: var(--scalar-background-3);\n padding: 2px 4px;\n border-radius: 4px;\n margin-right: 4px;\n}\n.schema-example {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n}\n\n.example-response-tab {\n display: block;\n margin: 6px;\n}\n\n.scalar-card-checkbox {\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n min-height: 17px;\n cursor: pointer;\n user-select: none;\n font-size: var(--scalar-small);\n font-weight: var(--scalar-font-normal);\n color: var(--scalar-color-2);\n width: fit-content;\n white-space: nowrap;\n gap: 6px;\n padding: 7px 6px;\n}\n.scalar-card-checkbox:has(.scalar-card-checkbox-input:focus-visible)\n .scalar-card-checkbox-checkmark {\n outline: 1px solid var(--scalar-color-accent);\n}\n.scalar-card-checkbox:hover {\n color: var(--scalar-color--1);\n}\n.scalar-card-checkbox .scalar-card-checkbox-input {\n position: absolute;\n opacity: 0;\n cursor: pointer;\n height: 0;\n width: 0;\n}\n\n.scalar-card-checkbox-checkmark {\n height: 16px;\n width: 16px;\n border-radius: var(--scalar-radius);\n background-color: transparent;\n background-color: var(--scalar-background-3);\n box-shadow: inset 0 0 0 var(--scalar-border-width) var(--scalar-border-color);\n}\n.scalar-card-checkbox:has(.scalar-card-checkbox-input:checked) {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n\n.scalar-card-checkbox\n .scalar-card-checkbox-input:checked\n ~ .scalar-card-checkbox-checkmark {\n background-color: var(--scalar-button-1);\n box-shadow: none;\n}\n\n.scalar-card-checkbox-checkmark:after {\n content: '';\n position: absolute;\n display: none;\n}\n\n.scalar-card-checkbox\n .scalar-card-checkbox-input:checked\n ~ .scalar-card-checkbox-checkmark:after {\n display: block;\n}\n\n.scalar-card-checkbox .scalar-card-checkbox-checkmark:after {\n right: 11.5px;\n top: 12.5px;\n width: 5px;\n height: 9px;\n border: solid 1px var(--scalar-button-1-color);\n border-width: 0 1.5px 1.5px 0;\n transform: rotate(45deg);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCA,MAAM,KAAK,OAAM;EACjB,MAAM,EAAE,oBAAoB,cAAa;EAGzC,MAAM,qBAAqB,eACzB,OAAO,KAAK,QAAA,aAAa,EAAE,CAAC,CAAC,MAAM,CACrC;EAGA,MAAM,yBAAyB,eAC7B,mBAAmB,MAAM,QAAQ,eAC/B,mBAAmB,eAAe,QAAA,YAAY,YAAY,EAAE,WAAW,CACxE,CACH;EAGA,MAAM,wBAAwB,IAAY,EAAC;;;;;;;;;AAU3C,QAAM,yBAAyB,UAAU;AACvC,OAAI,MAAM,WAAW,GAAG;AACtB,0BAAsB,QAAQ;AAC9B,uBAAmB,QAAQ;cAClB,sBAAsB,SAAS,MAAM,QAAQ;AACtD,0BAAsB,QAAQ,MAAM,SAAS;AAC7C,uBAAmB,QAAQ;;IAE9B;EAGD,MAAM,kBAAkB,eAAe;GACrC,MAAM,oBACJ,QAAQ,uBAAuB,CAAC,QAAQ,sBAAsB,KAAK;AAErE,UAAO,eAAe,QAAA,YAAY,mBAAkB;IACrD;EAED,MAAM,yBAAyB,eAA4C;GACzE,MAAM,oBAAoB,wBACxB,gBAAgB,OAAO,Q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AM;QACN,MAAK;kDAHI,WAAA,MAAU,CAAA,CAAA;iCAIrB,mBAA+C,QAAA,EAAzC,OAAM,kCAAgC,EAAA,MAAA,GAAA;;6BA1BF,EAAA,UAAA,KAAA,EAD9C,mBAMqB,UAAA,MAAA,WALE,uBAAA,QAAd,eAAU;2BADnB,YAMqB,4BAAA;QAJlB,KAAK;QACL,iBAAe,MAAA,GAAE;;+BACkB,CAApC,YAAoC,sBAAA,MAAA;gCAAf,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAP,WAAO,GAAA,CAAA,EAAA,CAAA;;4BAAe,MACpC,gBAAG,WAAU,EAAA,EAAA,CAAA,CAAA;;;;;;KA0BjB,YAaoB,MAAA,kBAAA,EAAA,EAbD,OAAM,eAAa,EAAA;6BAKS,CAFrC,uBAAA,OAAwB,UAAU,WAAA,SAAA,WAAA,EAD1C,YAG6C,uBAAA;;OAD1C,IAAI,MAAA,GAAE;OACN,QAAQ,uBAAA,OAAwB;qDAGnC,YAIuC,yBAAA;;OAFpC,IAAI,MAAA,GAAE;OACN,SAAS,eAAA;OACT,UAAU,uBAAA;;;;;;;;KAGP,gBAAA,OAAiB,eAAe,oBAAA,SAAA,WAAA,EADxC,YAcmB,MAAA,iBAAA,EAAA;;MAZjB,OAAM;;6BAK2C,CAHzC,oBAAA,SAAA,WAAA,EADR,YAIiD,MAAA,cAAA,EAAA;;mBAFtC,mBAAA;uFAAkB,QAAA;OAC3B,OAAM;OACL,UAAU,uBAAA,OAAwB;+EACrC,mBAKM,OALN,YAKM,CAHI,gBAAA,OAAiB,eAAA,WAAA,EADzB,YAGyC,MAAA,eAAA,EAAA;;OADvC,OAAM;OACL,OAAO,gBAAA,MAAgB"}
@@ -1,6 +1,6 @@
1
- import { type OpenAPIV3_1 } from '@scalar/openapi-types';
1
+ import type { ExternalDocumentationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
2
  type __VLS_Props = {
3
- value?: OpenAPIV3_1.ExternalDocumentationObject;
3
+ value?: ExternalDocumentationObject;
4
4
  };
5
5
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
6
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalDocs.vue.d.ts","sourceRoot":"","sources":["../../../src/features/external-docs/ExternalDocs.vue"],"names":[],"mappings":"AAuCA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC,2BAA2B,CAAA;CAChD,CAAC;AAqFF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ExternalDocs.vue.d.ts","sourceRoot":"","sources":["../../../src/features/external-docs/ExternalDocs.vue"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8DAA8D,CAAA;AAE/G,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,2BAA2B,CAAA;CACpC,CAAC;AAqFF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalDocs.vue.js","names":[],"sources":["../../../src/features/external-docs/ExternalDocs.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconBook } from '@scalar/icons'\nimport { type OpenAPIV3_1 } from '@scalar/openapi-types'\n\ndefineProps<{\n value?: OpenAPIV3_1.ExternalDocumentationObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n :href=\"value.url\"\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconBook\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span\n class=\"ml-1 empty:hidden\"\n v-if=\"value.description\">\n {{ value.description }}\n </span>\n <span\n class=\"ml-1 empty:hidden\"\n v-else>\n {{ value.url }}\n </span>\n </a>\n </div>\n </template>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ExternalDocs.vue.js","names":[],"sources":["../../../src/features/external-docs/ExternalDocs.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconBook } from '@scalar/icons'\nimport type { ExternalDocumentationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\ndefineProps<{\n value?: ExternalDocumentationObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n :href=\"value.url\"\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconBook\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span\n class=\"ml-1 empty:hidden\"\n v-if=\"value.description\">\n {{ value.description }}\n </span>\n <span\n class=\"ml-1 empty:hidden\"\n v-else>\n {{ value.url }}\n </span>\n </a>\n </div>\n </template>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"ExternalDocs.vue.script.js","names":[],"sources":["../../../src/features/external-docs/ExternalDocs.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconBook } from '@scalar/icons'\nimport { type OpenAPIV3_1 } from '@scalar/openapi-types'\n\ndefineProps<{\n value?: OpenAPIV3_1.ExternalDocumentationObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n :href=\"value.url\"\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconBook\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span\n class=\"ml-1 empty:hidden\"\n v-if=\"value.description\">\n {{ value.description }}\n </span>\n <span\n class=\"ml-1 empty:hidden\"\n v-else>\n {{ value.url }}\n </span>\n </a>\n </div>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAUkB,QAAA,SAAA,WAAA,EACd,mBAqBM,OArBN,YAqBM,CAnBJ,mBAkBI,KAAA;IAjBD,MAAM,QAAA,MAAM;IACb,OAAM;IACN,QAAO;IACP,KAAI;OACJ,YAEgC,MAAA,eAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OAGA,QAAA,MAAM,eAAA,WAAA,EAFd,mBAIO,QAJP,YAIO,gBADF,QAAA,MAAM,YAAW,EAAA,EAAA,KAAA,WAAA,EAEtB,mBAIO,QAJP,YAIO,gBADF,QAAA,MAAM,IAAG,EAAA,EAAA,EAAA,EAAA,GAAA,WAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"ExternalDocs.vue.script.js","names":[],"sources":["../../../src/features/external-docs/ExternalDocs.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconBook } from '@scalar/icons'\nimport type { ExternalDocumentationObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\ndefineProps<{\n value?: ExternalDocumentationObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n :href=\"value.url\"\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconBook\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span\n class=\"ml-1 empty:hidden\"\n v-if=\"value.description\">\n {{ value.description }}\n </span>\n <span\n class=\"ml-1 empty:hidden\"\n v-else>\n {{ value.url }}\n </span>\n </a>\n </div>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;UAUkB,QAAA,SAAA,WAAA,EACd,mBAqBM,OArBN,YAqBM,CAnBJ,mBAkBI,KAAA;IAjBD,MAAM,QAAA,MAAM;IACb,OAAM;IACN,QAAO;IACP,KAAI;OACJ,YAEgC,MAAA,eAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OAGA,QAAA,MAAM,eAAA,WAAA,EAFd,mBAIO,QAJP,YAIO,gBADF,QAAA,MAAM,YAAW,EAAA,EAAA,KAAA,WAAA,EAEtB,mBAIO,QAJP,YAIO,gBADF,QAAA,MAAM,IAAG,EAAA,EAAA,EAAA,EAAA,GAAA,WAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
@@ -1,6 +1,6 @@
1
- import { type OpenAPIV3_1 } from '@scalar/openapi-types';
1
+ import type { ContactObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
2
  type __VLS_Props = {
3
- value?: OpenAPIV3_1.ContactObject;
3
+ value?: ContactObject;
4
4
  };
5
5
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
6
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"Contact.vue.d.ts","sourceRoot":"","sources":["../../../src/features/info-object/Contact.vue"],"names":[],"mappings":"AA6CA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAWxD,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC,aAAa,CAAA;CAClC,CAAC;AAoEF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"Contact.vue.d.ts","sourceRoot":"","sources":["../../../src/features/info-object/Contact.vue"],"names":[],"mappings":"AA6CA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAWjG,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAC;AAoEF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Contact.vue.js","names":[],"sources":["../../../src/features/info-object/Contact.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { cva } from '@scalar/components'\nimport { ScalarIconEnvelopeSimple } from '@scalar/icons'\nimport { type OpenAPIV3_1 } from '@scalar/openapi-types'\n\nconst variants = cva({\n base: 'text-c-1 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 group-last:mr-0 xl:border-none',\n variants: {\n link: {\n true: 'no-underline hover:bg-b-2',\n },\n },\n})\n\ndefineProps<{\n value?: OpenAPIV3_1.ContactObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n v-if=\"value?.email\"\n :class=\"variants({ link: true })\"\n :href=\"`mailto:${value?.email}`\">\n <ScalarIconEnvelopeSimple\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value.name }}</span>\n </a>\n <span\n v-else-if=\"value?.name\"\n :class=\"variants({ link: false })\">\n {{ value.name }}\n </span>\n </div>\n </template>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"Contact.vue.js","names":[],"sources":["../../../src/features/info-object/Contact.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { cva } from '@scalar/components'\nimport { ScalarIconEnvelopeSimple } from '@scalar/icons'\nimport type { ContactObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nconst variants = cva({\n base: 'text-c-1 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 group-last:mr-0 xl:border-none',\n variants: {\n link: {\n true: 'no-underline hover:bg-b-2',\n },\n },\n})\n\ndefineProps<{\n value?: ContactObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n v-if=\"value?.email\"\n :class=\"variants({ link: true })\"\n :href=\"`mailto:${value?.email}`\">\n <ScalarIconEnvelopeSimple\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value.name }}</span>\n </a>\n <span\n v-else-if=\"value?.name\"\n :class=\"variants({ link: false })\">\n {{ value.name }}\n </span>\n </div>\n </template>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"Contact.vue.script.js","names":[],"sources":["../../../src/features/info-object/Contact.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { cva } from '@scalar/components'\nimport { ScalarIconEnvelopeSimple } from '@scalar/icons'\nimport { type OpenAPIV3_1 } from '@scalar/openapi-types'\n\nconst variants = cva({\n base: 'text-c-1 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 group-last:mr-0 xl:border-none',\n variants: {\n link: {\n true: 'no-underline hover:bg-b-2',\n },\n },\n})\n\ndefineProps<{\n value?: OpenAPIV3_1.ContactObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n v-if=\"value?.email\"\n :class=\"variants({ link: true })\"\n :href=\"`mailto:${value?.email}`\">\n <ScalarIconEnvelopeSimple\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value.name }}</span>\n </a>\n <span\n v-else-if=\"value?.name\"\n :class=\"variants({ link: false })\">\n {{ value.name }}\n </span>\n </div>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAKA,MAAM,WAAW,IAAI;GACnB,MAAM;GACN,UAAU,EACR,MAAM,EACJ,MAAM,6BACP,EACF;GACF,CAAA;;UAQiB,QAAA,SAAA,WAAA,EACd,mBAgBM,OAhBN,YAgBM,CAbI,QAAA,OAAO,SAAA,WAAA,EADf,mBAQI,KAAA;;IAND,OAAK,eAAE,MAAA,SAAQ,CAAA,EAAA,MAAA,MAAA,CAAA,CAAA;IACf,MAAI,UAAY,QAAA,OAAO;OACxB,YAEgC,MAAA,yBAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OACR,mBAAuD,QAAvD,YAAuD,gBAApB,QAAA,MAAM,KAAI,EAAA,EAAA,CAAA,EAAA,IAAA,WAAA,IAGlC,QAAA,OAAO,QAAA,WAAA,EADpB,mBAIO,QAAA;;IAFJ,OAAK,eAAE,MAAA,SAAQ,CAAA,EAAA,MAAA,OAAA,CAAA,CAAA;sBACb,QAAA,MAAM,KAAI,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"Contact.vue.script.js","names":[],"sources":["../../../src/features/info-object/Contact.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { cva } from '@scalar/components'\nimport { ScalarIconEnvelopeSimple } from '@scalar/icons'\nimport type { ContactObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nconst variants = cva({\n base: 'text-c-1 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 group-last:mr-0 xl:border-none',\n variants: {\n link: {\n true: 'no-underline hover:bg-b-2',\n },\n },\n})\n\ndefineProps<{\n value?: ContactObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n v-if=\"value?.email\"\n :class=\"variants({ link: true })\"\n :href=\"`mailto:${value?.email}`\">\n <ScalarIconEnvelopeSimple\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value.name }}</span>\n </a>\n <span\n v-else-if=\"value?.name\"\n :class=\"variants({ link: false })\">\n {{ value.name }}\n </span>\n </div>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;EAKA,MAAM,WAAW,IAAI;GACnB,MAAM;GACN,UAAU,EACR,MAAM,EACJ,MAAM,6BACP,EACF;GACF,CAAA;;UAQiB,QAAA,SAAA,WAAA,EACd,mBAgBM,OAhBN,YAgBM,CAbI,QAAA,OAAO,SAAA,WAAA,EADf,mBAQI,KAAA;;IAND,OAAK,eAAE,MAAA,SAAQ,CAAA,EAAA,MAAA,MAAA,CAAA,CAAA;IACf,MAAI,UAAY,QAAA,OAAO;OACxB,YAEgC,MAAA,yBAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OACR,mBAAuD,QAAvD,YAAuD,gBAApB,QAAA,MAAM,KAAI,EAAA,EAAA,CAAA,EAAA,IAAA,WAAA,IAGlC,QAAA,OAAO,QAAA,WAAA,EADpB,mBAIO,QAAA;;IAFJ,OAAK,eAAE,MAAA,SAAQ,CAAA,EAAA,MAAA,OAAA,CAAA,CAAA;sBACb,QAAA,MAAM,KAAI,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
@@ -1,6 +1,6 @@
1
- import { type OpenAPIV3_1 } from '@scalar/openapi-types';
1
+ import type { LicenseObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
2
  type __VLS_Props = {
3
- value?: OpenAPIV3_1.LicenseObject;
3
+ value?: LicenseObject;
4
4
  };
5
5
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
6
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"License.vue.d.ts","sourceRoot":"","sources":["../../../src/features/info-object/License.vue"],"names":[],"mappings":"AAqCA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC,aAAa,CAAA;CAClC,CAAC;AAoGF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"License.vue.d.ts","sourceRoot":"","sources":["../../../src/features/info-object/License.vue"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAEjG,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAC;AAoGF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"License.vue.js","names":[],"sources":["../../../src/features/info-object/License.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconGavel } from '@scalar/icons'\nimport { type OpenAPIV3_1 } from '@scalar/openapi-types'\n\ndefineProps<{\n value?: OpenAPIV3_1.LicenseObject\n}>()\n</script>\n\n<template>\n <div\n class=\"group flex h-fit items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n v-if=\"value?.url\"\n :href=\"value.url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconGavel\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{\n value?.name || value.identifier || value.url\n }}</span>\n </a>\n <template v-else>\n <ScalarIconGavel\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value?.name }}</span>\n </template>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"License.vue.js","names":[],"sources":["../../../src/features/info-object/License.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconGavel } from '@scalar/icons'\nimport type { LicenseObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\ndefineProps<{\n value?: LicenseObject\n}>()\n</script>\n\n<template>\n <div\n class=\"group flex h-fit items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n v-if=\"value?.url\"\n :href=\"value.url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconGavel\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{\n value?.name || value.identifier || value.url\n }}</span>\n </a>\n <template v-else>\n <ScalarIconGavel\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value?.name }}</span>\n </template>\n </div>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"License.vue.script.js","names":[],"sources":["../../../src/features/info-object/License.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconGavel } from '@scalar/icons'\nimport { type OpenAPIV3_1 } from '@scalar/openapi-types'\n\ndefineProps<{\n value?: OpenAPIV3_1.LicenseObject\n}>()\n</script>\n\n<template>\n <div\n class=\"group flex h-fit items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n v-if=\"value?.url\"\n :href=\"value.url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconGavel\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{\n value?.name || value.identifier || value.url\n }}</span>\n </a>\n <template v-else>\n <ScalarIconGavel\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value?.name }}</span>\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;uBAUE,mBAqBM,OArBN,YAqBM,CAjBI,QAAA,OAAO,OAAA,WAAA,EAFf,mBAYI,KAAA;;IAXF,OAAM;IAEL,MAAM,QAAA,MAAM;IACb,QAAO;IACP,KAAI;OACJ,YAEgC,MAAA,gBAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OACR,mBAES,QAFT,YAES,gBADP,QAAA,OAAO,QAAQ,QAAA,MAAM,cAAc,QAAA,MAAM,IAAG,EAAA,EAAA,CAAA,EAAA,GAAA,WAAA,KAAA,WAAA,EAGhD,mBAKW,UAAA,EAAA,KAAA,GAAA,EAAA,CAJT,YAEgC,MAAA,gBAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OACR,mBAAwD,QAAxD,YAAwD,gBAArB,QAAA,OAAO,KAAI,EAAA,EAAA,CAAA,EAAA,GAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"License.vue.script.js","names":[],"sources":["../../../src/features/info-object/License.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconGavel } from '@scalar/icons'\nimport type { LicenseObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\ndefineProps<{\n value?: LicenseObject\n}>()\n</script>\n\n<template>\n <div\n class=\"group flex h-fit items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n v-if=\"value?.url\"\n :href=\"value.url\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconGavel\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{\n value?.name || value.identifier || value.url\n }}</span>\n </a>\n <template v-else>\n <ScalarIconGavel\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value?.name }}</span>\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;uBAUE,mBAqBM,OArBN,YAqBM,CAjBI,QAAA,OAAO,OAAA,WAAA,EAFf,mBAYI,KAAA;;IAXF,OAAM;IAEL,MAAM,QAAA,MAAM;IACb,QAAO;IACP,KAAI;OACJ,YAEgC,MAAA,gBAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OACR,mBAES,QAFT,YAES,gBADP,QAAA,OAAO,QAAQ,QAAA,MAAM,cAAc,QAAA,MAAM,IAAG,EAAA,EAAA,CAAA,EAAA,GAAA,WAAA,KAAA,WAAA,EAGhD,mBAKW,UAAA,EAAA,KAAA,GAAA,EAAA,CAJT,YAEgC,MAAA,gBAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OACR,mBAAwD,QAAxD,YAAwD,gBAArB,QAAA,OAAO,KAAI,EAAA,EAAA,CAAA,EAAA,GAAA,EAAA,CAAA"}
@@ -1,6 +1,6 @@
1
- import { type OpenAPIV3_1 } from '@scalar/openapi-types';
1
+ import type { InfoObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
2
2
  type __VLS_Props = {
3
- value?: OpenAPIV3_1.InfoObject['termsOfService'];
3
+ value?: InfoObject['termsOfService'];
4
4
  };
5
5
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
6
6
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"TermsOfService.vue.d.ts","sourceRoot":"","sources":["../../../src/features/info-object/TermsOfService.vue"],"names":[],"mappings":"AA8BA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,WAAW,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAA;CACjD,CAAC;AA0EF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"TermsOfService.vue.d.ts","sourceRoot":"","sources":["../../../src/features/info-object/TermsOfService.vue"],"names":[],"mappings":"AA8BA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8DAA8D,CAAA;AAE9F,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,CAAA;CACrC,CAAC;AA0EF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"TermsOfService.vue.js","names":[],"sources":["../../../src/features/info-object/TermsOfService.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconScroll } from '@scalar/icons'\nimport { type OpenAPIV3_1 } from '@scalar/openapi-types'\n\ndefineProps<{\n value?: OpenAPIV3_1.InfoObject['termsOfService']\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n :href=\"value\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconScroll\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">Terms of Service</span>\n </a>\n </div>\n </template>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"TermsOfService.vue.js","names":[],"sources":["../../../src/features/info-object/TermsOfService.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconScroll } from '@scalar/icons'\nimport type { InfoObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\ndefineProps<{\n value?: InfoObject['termsOfService']\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n :href=\"value\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconScroll\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">Terms of Service</span>\n </a>\n </div>\n </template>\n</template>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"TermsOfService.vue.script.js","names":[],"sources":["../../../src/features/info-object/TermsOfService.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconScroll } from '@scalar/icons'\nimport { type OpenAPIV3_1 } from '@scalar/openapi-types'\n\ndefineProps<{\n value?: OpenAPIV3_1.InfoObject['termsOfService']\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n :href=\"value\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconScroll\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">Terms of Service</span>\n </a>\n </div>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;UAUkB,QAAA,SAAA,WAAA,EACd,mBAYM,OAZN,YAYM,CAVJ,mBASI,KAAA;IARF,OAAM;IACL,MAAM,QAAA;IACP,QAAO;IACP,KAAI;OACJ,YAEgC,MAAA,iBAAA,EAAA;IAD9B,QAAO;IACP,OAAM;iCACR,mBAAuD,QAAA,EAAjD,OAAM,qBAAmB,EAAC,oBAAgB,GAAA,EAAA,EAAA,GAAA,WAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
1
+ {"version":3,"file":"TermsOfService.vue.script.js","names":[],"sources":["../../../src/features/info-object/TermsOfService.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconScroll } from '@scalar/icons'\nimport type { InfoObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\ndefineProps<{\n value?: InfoObject['termsOfService']\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n class=\"text-c-1 hover:bg-b-2 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 no-underline group-last:mr-0 xl:border-none\"\n :href=\"value\"\n target=\"_blank\"\n rel=\"noopener noreferrer\">\n <ScalarIconScroll\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">Terms of Service</span>\n </a>\n </div>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;UAUkB,QAAA,SAAA,WAAA,EACd,mBAYM,OAZN,YAYM,CAVJ,mBASI,KAAA;IARF,OAAM;IACL,MAAM,QAAA;IACP,QAAO;IACP,KAAI;OACJ,YAEgC,MAAA,iBAAA,EAAA;IAD9B,QAAO;IACP,OAAM;iCACR,mBAAuD,QAAA,EAAjD,OAAM,qBAAmB,EAAC,oBAAgB,GAAA,EAAA,EAAA,GAAA,WAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
@@ -1,5 +1,4 @@
1
- import type { OpenAPI } from '@scalar/openapi-types';
2
- import type { OperationObject, ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
1
+ import type { OpenApiDocument, OperationObject, ParameterObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
3
2
  /**
4
3
  * Extracts the request body from an operation.
5
4
  */
@@ -12,14 +11,12 @@ export declare function deepMerge(source: Record<any, any>, target: Record<any,
12
11
  * Creates an empty specification object.
13
12
  * The returning object has the same structure as a valid OpenAPI specification, but everything is empty.
14
13
  */
15
- export declare function createEmptySpecification(partialSpecification?: Partial<OpenAPI.Document>): OpenAPI.Document;
14
+ export declare function createEmptySpecification(partialSpecification?: Partial<OpenApiDocument>): OpenApiDocument;
16
15
  export type ParameterMap = {
17
16
  path: ParameterObject[];
18
17
  query: ParameterObject[];
19
18
  header: ParameterObject[];
20
19
  cookie: ParameterObject[];
21
- body: ParameterObject[];
22
- formData: ParameterObject[];
23
20
  };
24
21
  /**
25
22
  * This function creates a parameter map from an Operation Object, that's easier to consume.
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/helpers/openapi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAIpD,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EAGhB,MAAM,8DAA8D,CAAA;AAiFrE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,EAAE,GAAG,OAAO,CAYjF;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,oBAW3E;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,GAiBjF,OAAO,CAAC,QAAQ,CACvB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,eAAe,EAAE,CAAA;IACvB,KAAK,EAAE,eAAe,EAAE,CAAA;IACxB,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,IAAI,EAAE,eAAe,EAAE,CAAA;IACvB,QAAQ,EAAE,eAAe,EAAE,CAAA;CAC5B,CAAA;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,gBA2D5D"}
1
+ {"version":3,"file":"openapi.d.ts","sourceRoot":"","sources":["../../src/helpers/openapi.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,eAAe,EAGhB,MAAM,8DAA8D,CAAA;AAkGrE;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,EAAE,GAAG,OAAO,CAYjF;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,oBAW3E;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,mBA4BvF;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,eAAe,EAAE,CAAA;IACvB,KAAK,EAAE,eAAe,EAAE,CAAA;IACxB,MAAM,EAAE,eAAe,EAAE,CAAA;IACzB,MAAM,EAAE,eAAe,EAAE,CAAA;CAC1B,CAAA;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,eAAe,gBA4B5D"}
@@ -1,13 +1,19 @@
1
1
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
2
  import { isObjectSchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
3
- import { isDereferenced } from "@scalar/openapi-types/helpers";
4
3
  //#region src/helpers/openapi.ts
4
+ var isSchemaObject = (value) => typeof value === "object" && value !== null;
5
+ var schemaTypeToString = (schema) => {
6
+ if (!("type" in schema)) return "";
7
+ if (typeof schema.type === "string") return schema.type;
8
+ return Array.isArray(schema.type) ? schema.type.join("|") : "";
9
+ };
5
10
  /**
6
11
  * Resolves a schema reference from workspace-store to a SchemaObject.
7
- * Bridges SchemaReferenceType (which uses '$ref-value': unknown) to NodeInput (which uses '$ref-value': SchemaObject).
12
+ * Returns undefined when a reference exists but has not been resolved yet.
8
13
  */
9
14
  function resolveSchemaRef(ref) {
10
- return getResolvedRef(ref);
15
+ if (typeof ref === "object" && ref !== null && "$ref" in ref) return isSchemaObject(ref["$ref-value"]) ? ref["$ref-value"] : void 0;
16
+ return ref;
11
17
  }
12
18
  /**
13
19
  * Formats a property object into a string.
@@ -19,9 +25,9 @@ function formatProperty(key, obj) {
19
25
  const propRef = obj.properties[key];
20
26
  if (!propRef) return output;
21
27
  const property = resolveSchemaRef(propRef);
22
- if (property && typeof property === "object" && "type" in property) {
23
- output += property.type ?? "";
24
- if ("description" in property && typeof property.description === "string") output += " " + property.description;
28
+ if (property) {
29
+ output += schemaTypeToString(property);
30
+ if ("description" in property && typeof property.description === "string") output += ` ${property.description}`;
25
31
  }
26
32
  return output;
27
33
  }
@@ -49,7 +55,7 @@ function recursiveLogger(obj) {
49
55
  const ref = nestedProperties[subKey];
50
56
  if (!ref) return;
51
57
  const nested = resolveSchemaRef(ref);
52
- const typeStr = nested && typeof nested === "object" && "type" in nested ? nested.type ?? "" : "";
58
+ const typeStr = nested ? schemaTypeToString(nested) : "";
53
59
  results.push(`${subKey} ${typeStr}`);
54
60
  });
55
61
  }
@@ -83,7 +89,8 @@ function deepMerge(source, target) {
83
89
  * The returning object has the same structure as a valid OpenAPI specification, but everything is empty.
84
90
  */
85
91
  function createEmptySpecification(partialSpecification) {
86
- return deepMerge(partialSpecification ?? {}, {
92
+ const emptySpecification = {
93
+ openapi: "3.1.0",
87
94
  info: {
88
95
  title: "",
89
96
  description: "",
@@ -96,8 +103,12 @@ function createEmptySpecification(partialSpecification) {
96
103
  contact: { email: "" }
97
104
  },
98
105
  servers: [],
99
- tags: []
100
- });
106
+ tags: [],
107
+ "x-scalar-original-document-hash": ""
108
+ };
109
+ if (!partialSpecification) return emptySpecification;
110
+ deepMerge(partialSpecification, emptySpecification);
111
+ return emptySpecification;
101
112
  }
102
113
  /**
103
114
  * This function creates a parameter map from an Operation Object, that's easier to consume.
@@ -109,20 +120,15 @@ function createParameterMap(operation) {
109
120
  path: [],
110
121
  query: [],
111
122
  header: [],
112
- cookie: [],
113
- body: [],
114
- formData: []
123
+ cookie: []
115
124
  };
116
- const parameters = operation.parameters ?? [];
117
- if (parameters) parameters.forEach((parameter) => {
118
- if (!isDereferenced(parameter)) return;
119
- if (typeof parameter === "object" && parameter !== null && "$ref" in parameter) return;
125
+ (operation.parameters ?? []).forEach((parameterRef) => {
126
+ const parameter = getResolvedRef(parameterRef);
127
+ if (!parameter) return;
120
128
  if (parameter.in === "path") map.path.push(parameter);
121
129
  else if (parameter.in === "query") map.query.push(parameter);
122
130
  else if (parameter.in === "header") map.header.push(parameter);
123
131
  else if (parameter.in === "cookie") map.cookie.push(parameter);
124
- else if (parameter.in === "body") map.body.push(parameter);
125
- else if (parameter.in === "formData") map.formData.push(parameter);
126
132
  });
127
133
  return map;
128
134
  }
@@ -1 +1 @@
1
- {"version":3,"file":"openapi.js","names":[],"sources":["../../src/helpers/openapi.ts"],"sourcesContent":["import type { OpenAPI } from '@scalar/openapi-types'\nimport { isDereferenced } from '@scalar/openapi-types/helpers'\nimport { type NodeInput, getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.1/strict/media-type'\nimport type {\n OperationObject,\n ParameterObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\n/** Object schema shape with properties, used when logging request body. */\ntype ObjectSchemaWithProperties = {\n properties: Record<string, SchemaReferenceType<SchemaObject>>\n required?: string[]\n}\n\n/**\n * Resolves a schema reference from workspace-store to a SchemaObject.\n * Bridges SchemaReferenceType (which uses '$ref-value': unknown) to NodeInput (which uses '$ref-value': SchemaObject).\n */\nfunction resolveSchemaRef(ref: SchemaReferenceType<SchemaObject>): SchemaObject {\n return getResolvedRef(ref as NodeInput<SchemaObject>)\n}\n\n/**\n * Formats a property object into a string.\n */\nfunction formatProperty(key: string, obj: ObjectSchemaWithProperties): string {\n let output = key\n const isRequired = obj.required?.includes(key)\n output += isRequired ? ' REQUIRED ' : ' optional '\n const propRef = obj.properties[key]\n if (!propRef) return output\n const property = resolveSchemaRef(propRef)\n\n // Check existence before accessing\n if (property && typeof property === 'object' && 'type' in property) {\n output += (property as { type?: string }).type ?? ''\n if ('description' in property && typeof (property as { description?: string }).description === 'string') {\n output += ' ' + (property as { description: string }).description\n }\n }\n\n return output\n}\n\n/**\n * Recursively logs the properties of an object.\n */\nfunction recursiveLogger(obj: MediaTypeObject): string[] {\n const results: string[] = ['Body']\n const schema = getResolvedRef(obj?.schema)\n\n if (!schema || !isObjectSchema(schema) || !schema.properties) {\n return results\n }\n\n const properties = schema.properties\n const schemaWithProps: ObjectSchemaWithProperties = {\n properties,\n required: schema.required,\n }\n Object.keys(properties).forEach((key) => {\n if (!obj.schema) {\n return\n }\n\n results.push(formatProperty(key, schemaWithProps))\n\n const propRef = properties[key]\n if (!propRef) return\n const property = resolveSchemaRef(propRef)\n if (property && isObjectSchema(property) && property.properties) {\n const nestedProperties = property.properties\n Object.keys(nestedProperties).forEach((subKey) => {\n const ref = nestedProperties[subKey]\n if (!ref) return\n const nested = resolveSchemaRef(ref)\n const typeStr =\n nested && typeof nested === 'object' && 'type' in nested ? ((nested as { type?: string }).type ?? '') : ''\n results.push(`${subKey} ${typeStr}`)\n })\n }\n })\n\n return results\n}\n\n/**\n * Extracts the request body from an operation.\n */\nexport function extractRequestBody(operation: OperationObject): string[] | boolean {\n try {\n // TODO: Wait… there's more than just 'application/json' (https://github.com/scalar/scalar/issues/6427)\n const media = getResolvedRef(operation?.requestBody)?.content?.['application/json']\n if (!media) {\n throw new Error('Body not found')\n }\n\n return recursiveLogger(media)\n } catch (_error) {\n return false\n }\n}\n\n/**\n * Deep merge for objects\n */\nexport function deepMerge(source: Record<any, any>, target: Record<any, any>) {\n for (const [key, val] of Object.entries(source)) {\n if (val !== null && typeof val === 'object') {\n target[key] ??= new val.__proto__.constructor()\n deepMerge(val, target[key])\n } else if (typeof val !== 'undefined') {\n target[key] = val\n }\n }\n\n return target\n}\n\n/**\n * Creates an empty specification object.\n * The returning object has the same structure as a valid OpenAPI specification, but everything is empty.\n */\nexport function createEmptySpecification(partialSpecification?: Partial<OpenAPI.Document>) {\n return deepMerge(partialSpecification ?? {}, {\n info: {\n title: '',\n description: '',\n termsOfService: '',\n version: '',\n license: {\n name: '',\n url: '',\n },\n contact: {\n email: '',\n },\n },\n servers: [],\n tags: [],\n }) as OpenAPI.Document\n}\n\nexport type ParameterMap = {\n path: ParameterObject[]\n query: ParameterObject[]\n header: ParameterObject[]\n cookie: ParameterObject[]\n body: ParameterObject[]\n formData: ParameterObject[]\n}\n\n/**\n * This function creates a parameter map from an Operation Object, that's easier to consume.\n *\n * TODO: Isn't it easier to just stick to the OpenAPI structure, without transforming it?\n */\nexport function createParameterMap(operation: OperationObject) {\n const map: ParameterMap = {\n path: [],\n query: [],\n header: [],\n cookie: [],\n body: [],\n formData: [],\n }\n\n // TODO: They are not passed to the function, so we don't need to deal with them yet, but we should.\n // @see https://github.com/scalar/scalar/issues/6428\n // if (operation.pathParameters) {\n // operation.pathParameters.forEach((parameter: OpenAPIV3_1.ParameterObject) => {\n // if (parameter.in === 'path') {\n // map.path.push(parameter)\n // } else if (parameter.in === 'query') {\n // map.query.push(parameter)\n // } else if (parameter.in === 'header') {\n // map.header.push(parameter)\n // } else if (parameter.in === 'cookie') {\n // map.cookie.push(parameter)\n // } else if (parameter.in === 'body') {\n // map.body.push(parameter)\n // } else if (parameter.in === 'formData') {\n // map.formData.push(parameter)\n // }\n // })\n // }\n\n const parameters = operation.parameters ?? []\n\n if (parameters) {\n parameters.forEach((parameter) => {\n if (!isDereferenced<ParameterObject>(parameter)) {\n return\n }\n\n if (typeof parameter === 'object' && parameter !== null && '$ref' in parameter) {\n return\n }\n\n if (parameter.in === 'path') {\n map.path.push(parameter)\n } else if (parameter.in === 'query') {\n map.query.push(parameter)\n } else if (parameter.in === 'header') {\n map.header.push(parameter)\n } else if (parameter.in === 'cookie') {\n map.cookie.push(parameter)\n } else if (parameter.in === 'body') {\n map.body.push(parameter)\n } else if (parameter.in === 'formData') {\n map.formData.push(parameter)\n }\n })\n }\n\n return map\n}\n"],"mappings":";;;;;;;;AAsBA,SAAS,iBAAiB,KAAsD;AAC9E,QAAO,eAAe,IAA+B;;;;;AAMvD,SAAS,eAAe,KAAa,KAAyC;CAC5E,IAAI,SAAS;CACb,MAAM,aAAa,IAAI,UAAU,SAAS,IAAI;AAC9C,WAAU,aAAa,eAAe;CACtC,MAAM,UAAU,IAAI,WAAW;AAC/B,KAAI,CAAC,QAAS,QAAO;CACrB,MAAM,WAAW,iBAAiB,QAAQ;AAG1C,KAAI,YAAY,OAAO,aAAa,YAAY,UAAU,UAAU;AAClE,YAAW,SAA+B,QAAQ;AAClD,MAAI,iBAAiB,YAAY,OAAQ,SAAsC,gBAAgB,SAC7F,WAAU,MAAO,SAAqC;;AAI1D,QAAO;;;;;AAMT,SAAS,gBAAgB,KAAgC;CACvD,MAAM,UAAoB,CAAC,OAAO;CAClC,MAAM,SAAS,eAAe,KAAK,OAAO;AAE1C,KAAI,CAAC,UAAU,CAAC,eAAe,OAAO,IAAI,CAAC,OAAO,WAChD,QAAO;CAGT,MAAM,aAAa,OAAO;CAC1B,MAAM,kBAA8C;EAClD;EACA,UAAU,OAAO;EAClB;AACD,QAAO,KAAK,WAAW,CAAC,SAAS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;;;;AAiBJ,SAAgB,mBAAmB,WAA4B;CAC7D,MAAM,MAAoB;EACxB,MAAM,EAAE;EACR,OAAO,EAAE;EACT,QAAQ,EAAE;EACV,QAAQ,EAAE;EACV,MAAM,EAAE;EACR,UAAU,EAAE;EACb;CAsBD,MAAM,aAAa,UAAU,cAAc,EAAE;AAE7C,KAAI,WACF,YAAW,SAAS,cAAc;AAChC,MAAI,CAAC,eAAgC,UAAU,CAC7C;AAGF,MAAI,OAAO,cAAc,YAAY,cAAc,QAAQ,UAAU,UACnE;AAGF,MAAI,UAAU,OAAO,OACnB,KAAI,KAAK,KAAK,UAAU;WACf,UAAU,OAAO,QAC1B,KAAI,MAAM,KAAK,UAAU;WAChB,UAAU,OAAO,SAC1B,KAAI,OAAO,KAAK,UAAU;WACjB,UAAU,OAAO,SAC1B,KAAI,OAAO,KAAK,UAAU;WACjB,UAAU,OAAO,OAC1B,KAAI,KAAK,KAAK,UAAU;WACf,UAAU,OAAO,WAC1B,KAAI,SAAS,KAAK,UAAU;GAE9B;AAGJ,QAAO"}
1
+ {"version":3,"file":"openapi.js","names":[],"sources":["../../src/helpers/openapi.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { MediaTypeObject } from '@scalar/workspace-store/schemas/v3.1/strict/media-type'\nimport type {\n OpenApiDocument,\n OperationObject,\n ParameterObject,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\n/** Object schema shape with properties, used when logging request body. */\ntype ObjectSchemaWithProperties = {\n properties: Record<string, SchemaReferenceType<SchemaObject>>\n required?: string[]\n}\n\nconst isSchemaObject = (value: unknown): value is SchemaObject => typeof value === 'object' && value !== null\n\nconst schemaTypeToString = (schema: SchemaObject): string => {\n if (!('type' in schema)) {\n return ''\n }\n\n if (typeof schema.type === 'string') {\n return schema.type\n }\n\n return Array.isArray(schema.type) ? schema.type.join('|') : ''\n}\n\n/**\n * Resolves a schema reference from workspace-store to a SchemaObject.\n * Returns undefined when a reference exists but has not been resolved yet.\n */\nfunction resolveSchemaRef(ref: SchemaReferenceType<SchemaObject>): SchemaObject | undefined {\n if (typeof ref === 'object' && ref !== null && '$ref' in ref) {\n return isSchemaObject(ref['$ref-value']) ? ref['$ref-value'] : undefined\n }\n\n return ref\n}\n\n/**\n * Formats a property object into a string.\n */\nfunction formatProperty(key: string, obj: ObjectSchemaWithProperties): string {\n let output = key\n const isRequired = obj.required?.includes(key)\n output += isRequired ? ' REQUIRED ' : ' optional '\n const propRef = obj.properties[key]\n if (!propRef) return output\n const property = resolveSchemaRef(propRef)\n\n if (property) {\n output += schemaTypeToString(property)\n\n if ('description' in property && typeof property.description === 'string') {\n output += ` ${property.description}`\n }\n }\n\n return output\n}\n\n/**\n * Recursively logs the properties of an object.\n */\nfunction recursiveLogger(obj: MediaTypeObject): string[] {\n const results: string[] = ['Body']\n const schema = getResolvedRef(obj?.schema)\n\n if (!schema || !isObjectSchema(schema) || !schema.properties) {\n return results\n }\n\n const properties = schema.properties\n const schemaWithProps: ObjectSchemaWithProperties = {\n properties,\n required: schema.required,\n }\n Object.keys(properties).forEach((key) => {\n if (!obj.schema) {\n return\n }\n\n results.push(formatProperty(key, schemaWithProps))\n\n const propRef = properties[key]\n if (!propRef) return\n const property = resolveSchemaRef(propRef)\n if (property && isObjectSchema(property) && property.properties) {\n const nestedProperties = property.properties\n Object.keys(nestedProperties).forEach((subKey) => {\n const ref = nestedProperties[subKey]\n if (!ref) return\n const nested = resolveSchemaRef(ref)\n const typeStr = nested ? schemaTypeToString(nested) : ''\n results.push(`${subKey} ${typeStr}`)\n })\n }\n })\n\n return results\n}\n\n/**\n * Extracts the request body from an operation.\n */\nexport function extractRequestBody(operation: OperationObject): string[] | boolean {\n try {\n // TODO: Wait… there's more than just 'application/json' (https://github.com/scalar/scalar/issues/6427)\n const media = getResolvedRef(operation?.requestBody)?.content?.['application/json']\n if (!media) {\n throw new Error('Body not found')\n }\n\n return recursiveLogger(media)\n } catch (_error) {\n return false\n }\n}\n\n/**\n * Deep merge for objects\n */\nexport function deepMerge(source: Record<any, any>, target: Record<any, any>) {\n for (const [key, val] of Object.entries(source)) {\n if (val !== null && typeof val === 'object') {\n target[key] ??= new val.__proto__.constructor()\n deepMerge(val, target[key])\n } else if (typeof val !== 'undefined') {\n target[key] = val\n }\n }\n\n return target\n}\n\n/**\n * Creates an empty specification object.\n * The returning object has the same structure as a valid OpenAPI specification, but everything is empty.\n */\nexport function createEmptySpecification(partialSpecification?: Partial<OpenApiDocument>) {\n const emptySpecification = {\n openapi: '3.1.0',\n info: {\n title: '',\n description: '',\n termsOfService: '',\n version: '',\n license: {\n name: '',\n url: '',\n },\n contact: {\n email: '',\n },\n },\n servers: [],\n tags: [],\n 'x-scalar-original-document-hash': '',\n }\n\n if (!partialSpecification) {\n return emptySpecification as OpenApiDocument\n }\n\n deepMerge(partialSpecification, emptySpecification)\n\n return emptySpecification as OpenApiDocument\n}\n\nexport type ParameterMap = {\n path: ParameterObject[]\n query: ParameterObject[]\n header: ParameterObject[]\n cookie: ParameterObject[]\n}\n\n/**\n * This function creates a parameter map from an Operation Object, that's easier to consume.\n *\n * TODO: Isn't it easier to just stick to the OpenAPI structure, without transforming it?\n */\nexport function createParameterMap(operation: OperationObject) {\n const map: ParameterMap = {\n path: [],\n query: [],\n header: [],\n cookie: [],\n }\n\n const parameters = operation.parameters ?? []\n\n parameters.forEach((parameterRef) => {\n const parameter = getResolvedRef(parameterRef)\n if (!parameter) {\n return\n }\n\n if (parameter.in === 'path') {\n map.path.push(parameter)\n } else if (parameter.in === 'query') {\n map.query.push(parameter)\n } else if (parameter.in === 'header') {\n map.header.push(parameter)\n } else if (parameter.in === 'cookie') {\n map.cookie.push(parameter)\n }\n })\n\n return map\n}\n"],"mappings":";;;AAiBA,IAAM,kBAAkB,UAA0C,OAAO,UAAU,YAAY,UAAU;AAEzG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