@scalar/api-reference 1.49.8 → 1.51.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 (95) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/browser/standalone.js +192 -190
  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 +50 -15
  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 +3 -14
  13. package/dist/components/Content/Auth/Auth.vue.script.js.map +1 -1
  14. package/dist/components/Content/Content.vue.d.ts +1 -0
  15. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  16. package/dist/components/Content/Content.vue.js.map +1 -1
  17. package/dist/components/Content/Content.vue.script.js +7 -8
  18. package/dist/components/Content/Content.vue.script.js.map +1 -1
  19. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +1 -1
  20. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
  21. package/dist/components/Content/Operations/TraversedEntry.vue.js.map +1 -1
  22. package/dist/components/Content/Operations/TraversedEntry.vue.script.js +1 -1
  23. package/dist/components/Content/Operations/TraversedEntry.vue.script.js.map +1 -1
  24. package/dist/components/Content/Tags/components/ClassicLayout.vue.d.ts.map +1 -1
  25. package/dist/components/Content/Tags/components/ClassicLayout.vue.js +1 -1
  26. package/dist/components/Content/Tags/components/ClassicLayout.vue.js.map +1 -1
  27. package/dist/components/Content/Tags/components/ClassicLayout.vue.script.js +9 -5
  28. package/dist/components/Content/Tags/components/ClassicLayout.vue.script.js.map +1 -1
  29. package/dist/features/Operation/Operation.vue.d.ts +1 -1
  30. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  31. package/dist/features/Operation/Operation.vue.js.map +1 -1
  32. package/dist/features/Operation/Operation.vue.script.js +1 -1
  33. package/dist/features/Operation/Operation.vue.script.js.map +1 -1
  34. package/dist/features/Operation/helpers/filter-selected-security.d.ts +2 -1
  35. package/dist/features/Operation/helpers/filter-selected-security.d.ts.map +1 -1
  36. package/dist/features/Operation/helpers/filter-selected-security.js +1 -2
  37. package/dist/features/Operation/helpers/filter-selected-security.js.map +1 -1
  38. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +1 -1
  39. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  40. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  41. package/dist/features/Operation/layouts/ClassicLayout.vue.js.map +1 -1
  42. package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
  43. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +1 -1
  44. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  45. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  46. package/dist/features/Operation/layouts/ModernLayout.vue.js.map +1 -1
  47. package/dist/features/Operation/layouts/ModernLayout.vue.script.js.map +1 -1
  48. package/dist/features/Search/helpers/create-fuse-instance.d.ts.map +1 -1
  49. package/dist/features/Search/helpers/create-fuse-instance.js +4 -0
  50. package/dist/features/Search/helpers/create-fuse-instance.js.map +1 -1
  51. package/dist/features/Search/helpers/create-search-index.d.ts.map +1 -1
  52. package/dist/features/Search/helpers/create-search-index.js +41 -4
  53. package/dist/features/Search/helpers/create-search-index.js.map +1 -1
  54. package/dist/features/Search/types.d.ts +1 -0
  55. package/dist/features/Search/types.d.ts.map +1 -1
  56. package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
  57. package/dist/features/example-responses/ExampleResponse.vue.js +1 -1
  58. package/dist/features/example-responses/ExampleResponse.vue.js.map +1 -1
  59. package/dist/features/example-responses/ExampleResponse.vue.script.js +2 -1
  60. package/dist/features/example-responses/ExampleResponse.vue.script.js.map +1 -1
  61. package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
  62. package/dist/features/example-responses/ExampleResponses.vue.js.map +1 -1
  63. package/dist/features/example-responses/ExampleResponses.vue.script.js +1 -1
  64. package/dist/features/example-responses/ExampleResponses.vue.script.js.map +1 -1
  65. package/dist/features/external-docs/ExternalDocs.vue.d.ts +2 -2
  66. package/dist/features/external-docs/ExternalDocs.vue.d.ts.map +1 -1
  67. package/dist/features/external-docs/ExternalDocs.vue.js.map +1 -1
  68. package/dist/features/external-docs/ExternalDocs.vue.script.js.map +1 -1
  69. package/dist/features/info-object/Contact.vue.d.ts +2 -2
  70. package/dist/features/info-object/Contact.vue.d.ts.map +1 -1
  71. package/dist/features/info-object/Contact.vue.js.map +1 -1
  72. package/dist/features/info-object/Contact.vue.script.js.map +1 -1
  73. package/dist/features/info-object/License.vue.d.ts +2 -2
  74. package/dist/features/info-object/License.vue.d.ts.map +1 -1
  75. package/dist/features/info-object/License.vue.js.map +1 -1
  76. package/dist/features/info-object/License.vue.script.js.map +1 -1
  77. package/dist/features/info-object/TermsOfService.vue.d.ts +2 -2
  78. package/dist/features/info-object/TermsOfService.vue.d.ts.map +1 -1
  79. package/dist/features/info-object/TermsOfService.vue.js.map +1 -1
  80. package/dist/features/info-object/TermsOfService.vue.script.js.map +1 -1
  81. package/dist/helpers/openapi.d.ts +2 -5
  82. package/dist/helpers/openapi.d.ts.map +1 -1
  83. package/dist/helpers/openapi.js +25 -19
  84. package/dist/helpers/openapi.js.map +1 -1
  85. package/dist/helpers/safe-deep-clone.d.ts +17 -0
  86. package/dist/helpers/safe-deep-clone.d.ts.map +1 -0
  87. package/dist/helpers/safe-deep-clone.js +25 -0
  88. package/dist/helpers/safe-deep-clone.js.map +1 -0
  89. package/dist/helpers/storage.d.ts +5 -5
  90. package/dist/style.css +321 -364
  91. package/package.json +20 -21
  92. package/dist/components/Content/Auth/helpers/get-default-security.d.ts +0 -18
  93. package/dist/components/Content/Auth/helpers/get-default-security.d.ts.map +0 -1
  94. package/dist/components/Content/Auth/helpers/get-default-security.js +0 -64
  95. package/dist/components/Content/Auth/helpers/get-default-security.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ModernLayout.vue.js","names":[],"sources":["../../../../src/features/Operation/layouts/ModernLayout.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { OperationCodeSample } from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport type { SecuritySchemeObjectSecret } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block'\nimport { ScalarErrorBoundary, ScalarMarkdown } from '@scalar/components'\nimport { ScalarIconWebhooksLogo } from '@scalar/icons'\nimport {\n getOperationStability,\n getOperationStabilityColor,\n isOperationDeprecated,\n} from '@scalar/oas-utils/helpers'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, provide, ref, useId } from 'vue'\n\nimport { Anchor } from '@/components/Anchor'\nimport { Badge } from '@/components/Badge'\nimport { LinkList } from '@/components/LinkList'\nimport OperationPath from '@/components/OperationPath.vue'\nimport {\n Section,\n SectionColumn,\n SectionColumns,\n SectionContent,\n SectionHeader,\n SectionHeaderTag,\n} from '@/components/Section'\nimport AskAgentButton from '@/features/ask-agent-button/AskAgentButton.vue'\nimport { ExampleResponses } from '@/features/example-responses'\nimport { ExternalDocs } from '@/features/external-docs'\nimport Callbacks from '@/features/Operation/components/callbacks/Callbacks.vue'\nimport OperationParameters from '@/features/Operation/components/OperationParameters.vue'\nimport OperationResponses from '@/features/Operation/components/OperationResponses.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from '@/features/Operation/request-body-composition-index'\nimport { getXKeysFromObject } from '@/features/specification-extension'\nimport SpecificationExtension from '@/features/specification-extension/SpecificationExtension.vue'\nimport { TestRequestButton } from '@/features/test-request-button'\nimport { XBadges } from '@/features/x-badges'\n\nconst {\n clientOptions,\n eventBus,\n isWebhook,\n method,\n operation,\n options,\n path,\n selectedServer,\n selectedSecuritySchemes,\n selectedClient,\n} = defineProps<\n Omit<\n OperationProps,\n | 'document'\n | 'pathValue'\n | 'server'\n | 'isCollapsed'\n | 'securitySchemes'\n | 'authStore'\n > & {\n /** Operation object with path params */\n operation: OperationObject\n /** The selected server for the operation */\n selectedServer: ServerObject | null\n /** The selected security schemes for the operation */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n }\n>()\n\nconst operationTitle = computed(() => operation.summary || path || '')\n\nconst labelId = useId()\n\nconst operationExtensions = computed(() => getXKeysFromObject(operation))\n\n/** Selected request body oneOf/anyOf variants; synced with schema dropdowns and code sample */\nconst requestBodyCompositionSelection = ref<RequestBodyCompositionSelection>({})\n\nconst requestBodyCompositionSelectionForCodeSample = computed(\n (): RequestBodyCompositionSelection => ({\n ...requestBodyCompositionSelection.value,\n }),\n)\n\nconst requestBodyCompositionSelectionKey = computed(() =>\n JSON.stringify(requestBodyCompositionSelectionForCodeSample.value),\n)\n\nprovide(REQUEST_BODY_COMPOSITION_INDEX_SYMBOL, requestBodyCompositionSelection)\n</script>\n\n<template>\n <Section\n :id=\"id\"\n :aria-labelledby=\"labelId\"\n :label=\"operationTitle\"\n tabindex=\"-1\"\n @intersecting=\"() => eventBus?.emit('intersecting:nav-item', { id })\">\n <SectionContent>\n <div class=\"flex flex-row justify-between gap-1\">\n <!-- Left -->\n <div class=\"flex gap-1\">\n <!-- Operation ID -->\n <Badge v-if=\"options?.showOperationId && operation.operationId\">\n {{ operation.operationId }}\n </Badge>\n <!-- Stability badge -->\n <Badge\n v-if=\"getOperationStability(operation)\"\n class=\"capitalize\"\n :class=\"getOperationStabilityColor(operation)\">\n {{ getOperationStability(operation) }}\n </Badge>\n <!-- Webhook badge -->\n <Badge\n v-if=\"isWebhook\"\n class=\"font-code text-green flex w-fit items-center justify-center gap-1\">\n <ScalarIconWebhooksLogo weight=\"bold\" />Webhook\n </Badge>\n <!-- x-badges before -->\n <XBadges\n :badges=\"operation['x-badges']\"\n position=\"before\" />\n </div>\n <!-- Right -->\n <div class=\"flex gap-1\">\n <!-- x-badges after -->\n <XBadges\n :badges=\"operation['x-badges']\"\n position=\"after\" />\n </div>\n </div>\n <div :class=\"isOperationDeprecated(operation) ? 'deprecated' : ''\">\n <SectionHeader>\n <Anchor\n @copyAnchorUrl=\"() => eventBus?.emit('copy-url:nav-item', { id })\">\n <SectionHeaderTag\n :id=\"labelId\"\n :level=\"3\">\n {{ operationTitle }}\n </SectionHeaderTag>\n </Anchor>\n </SectionHeader>\n </div>\n <SectionColumns>\n <SectionColumn>\n <div class=\"operation-details\">\n <SpecificationExtension :value=\"operationExtensions\" />\n <ScalarMarkdown\n :anchorPrefix=\"id\"\n aria-label=\"Operation Description\"\n role=\"group\"\n transformType=\"heading\"\n :value=\"operation.description\"\n withAnchors\n withImages />\n <OperationParameters\n :breadcrumb=\"[id]\"\n :eventBus\n :options\n :parameters=\"operation.parameters\"\n :requestBody=\"getResolvedRef(operation.requestBody)\" />\n <OperationResponses\n :breadcrumb=\"[id]\"\n :collapsableItems=\"!options.expandAllResponses\"\n :eventBus\n :options\n :responses=\"operation.responses\" />\n\n <!-- Callbacks -->\n <ScalarErrorBoundary>\n <Callbacks\n v-if=\"operation.callbacks\"\n :callbacks=\"operation.callbacks\"\n class=\"mt-6\"\n :eventBus\n :options\n :path />\n </ScalarErrorBoundary>\n </div>\n </SectionColumn>\n <SectionColumn>\n <div class=\"examples\">\n <!-- External Docs -->\n <LinkList v-if=\"operation.externalDocs\">\n <ExternalDocs :value=\"operation.externalDocs\" />\n </LinkList>\n\n <!-- New Example Request -->\n <ScalarErrorBoundary>\n <OperationCodeSample\n :key=\"requestBodyCompositionSelectionKey\"\n :clientOptions\n :eventBus\n fallback\n :isWebhook\n :method\n :operation\n :path\n :requestBodyCompositionSelection=\"\n requestBodyCompositionSelectionForCodeSample\n \"\n :securitySchemes=\"selectedSecuritySchemes\"\n :selectedClient\n :selectedServer>\n <template #header>\n <OperationPath\n class=\"font-code text-c-2 [&_em]:text-c-1 [&_em]:not-italic\"\n :deprecated=\"operation?.deprecated\"\n :path=\"path\" />\n </template>\n <template\n v-if=\"!isWebhook\"\n #footer=\"{ exampleName }\">\n <div class=\"flex\">\n <AskAgentButton />\n <TestRequestButton\n v-if=\"!options.hideTestRequestButton\"\n :id\n :eventBus\n :exampleName\n :method\n :path\n :requestBodyCompositionSelection=\"\n requestBodyCompositionSelectionForCodeSample\n \" />\n </div>\n </template>\n </OperationCodeSample>\n </ScalarErrorBoundary>\n\n <ScalarErrorBoundary>\n <ExampleResponses\n v-if=\"operation.responses\"\n :responses=\"operation.responses\"\n style=\"margin-top: 12px\" />\n </ScalarErrorBoundary>\n </div>\n </SectionColumn>\n </SectionColumns>\n </SectionContent>\n </Section>\n</template>\n\n<style scoped>\n.examples {\n position: sticky;\n top: calc(var(--refs-viewport-offset) + 24px);\n}\n\n.examples > * {\n max-height: calc((var(--refs-viewport-height) - 60px) / 2);\n position: relative;\n}\n\n.examples > *:first-of-type:last-of-type {\n max-height: calc((var(--refs-viewport-height) - 60px));\n}\n\n/*\n * Don't constrain card height on mobile\n * (or zoomed in screens)\n */\n@media (max-width: 600px) {\n .examples > * {\n max-height: unset;\n }\n}\n.deprecated * {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"ModernLayout.vue.js","names":[],"sources":["../../../../src/features/Operation/layouts/ModernLayout.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { OperationCodeSample } from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport { ScalarErrorBoundary, ScalarMarkdown } from '@scalar/components'\nimport { ScalarIconWebhooksLogo } from '@scalar/icons'\nimport {\n getOperationStability,\n getOperationStabilityColor,\n isOperationDeprecated,\n} from '@scalar/oas-utils/helpers'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, provide, ref, useId } from 'vue'\n\nimport { Anchor } from '@/components/Anchor'\nimport { Badge } from '@/components/Badge'\nimport { LinkList } from '@/components/LinkList'\nimport OperationPath from '@/components/OperationPath.vue'\nimport {\n Section,\n SectionColumn,\n SectionColumns,\n SectionContent,\n SectionHeader,\n SectionHeaderTag,\n} from '@/components/Section'\nimport AskAgentButton from '@/features/ask-agent-button/AskAgentButton.vue'\nimport { ExampleResponses } from '@/features/example-responses'\nimport { ExternalDocs } from '@/features/external-docs'\nimport Callbacks from '@/features/Operation/components/callbacks/Callbacks.vue'\nimport OperationParameters from '@/features/Operation/components/OperationParameters.vue'\nimport OperationResponses from '@/features/Operation/components/OperationResponses.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from '@/features/Operation/request-body-composition-index'\nimport { getXKeysFromObject } from '@/features/specification-extension'\nimport SpecificationExtension from '@/features/specification-extension/SpecificationExtension.vue'\nimport { TestRequestButton } from '@/features/test-request-button'\nimport { XBadges } from '@/features/x-badges'\n\nconst {\n clientOptions,\n eventBus,\n isWebhook,\n method,\n operation,\n options,\n path,\n selectedServer,\n selectedSecuritySchemes,\n selectedClient,\n} = defineProps<\n Omit<\n OperationProps,\n | 'document'\n | 'pathValue'\n | 'server'\n | 'isCollapsed'\n | 'securitySchemes'\n | 'authStore'\n > & {\n /** Operation object with path params */\n operation: OperationObject\n /** The selected server for the operation */\n selectedServer: ServerObject | null\n /** The selected security schemes for the operation */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n }\n>()\n\nconst operationTitle = computed(() => operation.summary || path || '')\n\nconst labelId = useId()\n\nconst operationExtensions = computed(() => getXKeysFromObject(operation))\n\n/** Selected request body oneOf/anyOf variants; synced with schema dropdowns and code sample */\nconst requestBodyCompositionSelection = ref<RequestBodyCompositionSelection>({})\n\nconst requestBodyCompositionSelectionForCodeSample = computed(\n (): RequestBodyCompositionSelection => ({\n ...requestBodyCompositionSelection.value,\n }),\n)\n\nconst requestBodyCompositionSelectionKey = computed(() =>\n JSON.stringify(requestBodyCompositionSelectionForCodeSample.value),\n)\n\nprovide(REQUEST_BODY_COMPOSITION_INDEX_SYMBOL, requestBodyCompositionSelection)\n</script>\n\n<template>\n <Section\n :id=\"id\"\n :aria-labelledby=\"labelId\"\n :label=\"operationTitle\"\n tabindex=\"-1\"\n @intersecting=\"() => eventBus?.emit('intersecting:nav-item', { id })\">\n <SectionContent>\n <div class=\"flex flex-row justify-between gap-1\">\n <!-- Left -->\n <div class=\"flex gap-1\">\n <!-- Operation ID -->\n <Badge v-if=\"options?.showOperationId && operation.operationId\">\n {{ operation.operationId }}\n </Badge>\n <!-- Stability badge -->\n <Badge\n v-if=\"getOperationStability(operation)\"\n class=\"capitalize\"\n :class=\"getOperationStabilityColor(operation)\">\n {{ getOperationStability(operation) }}\n </Badge>\n <!-- Webhook badge -->\n <Badge\n v-if=\"isWebhook\"\n class=\"font-code text-green flex w-fit items-center justify-center gap-1\">\n <ScalarIconWebhooksLogo weight=\"bold\" />Webhook\n </Badge>\n <!-- x-badges before -->\n <XBadges\n :badges=\"operation['x-badges']\"\n position=\"before\" />\n </div>\n <!-- Right -->\n <div class=\"flex gap-1\">\n <!-- x-badges after -->\n <XBadges\n :badges=\"operation['x-badges']\"\n position=\"after\" />\n </div>\n </div>\n <div :class=\"isOperationDeprecated(operation) ? 'deprecated' : ''\">\n <SectionHeader>\n <Anchor\n @copyAnchorUrl=\"() => eventBus?.emit('copy-url:nav-item', { id })\">\n <SectionHeaderTag\n :id=\"labelId\"\n :level=\"3\">\n {{ operationTitle }}\n </SectionHeaderTag>\n </Anchor>\n </SectionHeader>\n </div>\n <SectionColumns>\n <SectionColumn>\n <div class=\"operation-details\">\n <SpecificationExtension :value=\"operationExtensions\" />\n <ScalarMarkdown\n :anchorPrefix=\"id\"\n aria-label=\"Operation Description\"\n role=\"group\"\n transformType=\"heading\"\n :value=\"operation.description\"\n withAnchors\n withImages />\n <OperationParameters\n :breadcrumb=\"[id]\"\n :eventBus\n :options\n :parameters=\"operation.parameters\"\n :requestBody=\"getResolvedRef(operation.requestBody)\" />\n <OperationResponses\n :breadcrumb=\"[id]\"\n :collapsableItems=\"!options.expandAllResponses\"\n :eventBus\n :options\n :responses=\"operation.responses\" />\n\n <!-- Callbacks -->\n <ScalarErrorBoundary>\n <Callbacks\n v-if=\"operation.callbacks\"\n :callbacks=\"operation.callbacks\"\n class=\"mt-6\"\n :eventBus\n :options\n :path />\n </ScalarErrorBoundary>\n </div>\n </SectionColumn>\n <SectionColumn>\n <div class=\"examples\">\n <!-- External Docs -->\n <LinkList v-if=\"operation.externalDocs\">\n <ExternalDocs :value=\"operation.externalDocs\" />\n </LinkList>\n\n <!-- New Example Request -->\n <ScalarErrorBoundary>\n <OperationCodeSample\n :key=\"requestBodyCompositionSelectionKey\"\n :clientOptions\n :eventBus\n fallback\n :isWebhook\n :method\n :operation\n :path\n :requestBodyCompositionSelection=\"\n requestBodyCompositionSelectionForCodeSample\n \"\n :securitySchemes=\"selectedSecuritySchemes\"\n :selectedClient\n :selectedServer>\n <template #header>\n <OperationPath\n class=\"font-code text-c-2 [&_em]:text-c-1 [&_em]:not-italic\"\n :deprecated=\"operation?.deprecated\"\n :path=\"path\" />\n </template>\n <template\n v-if=\"!isWebhook\"\n #footer=\"{ exampleName }\">\n <div class=\"flex\">\n <AskAgentButton />\n <TestRequestButton\n v-if=\"!options.hideTestRequestButton\"\n :id\n :eventBus\n :exampleName\n :method\n :path\n :requestBodyCompositionSelection=\"\n requestBodyCompositionSelectionForCodeSample\n \" />\n </div>\n </template>\n </OperationCodeSample>\n </ScalarErrorBoundary>\n\n <ScalarErrorBoundary>\n <ExampleResponses\n v-if=\"operation.responses\"\n :responses=\"operation.responses\"\n style=\"margin-top: 12px\" />\n </ScalarErrorBoundary>\n </div>\n </SectionColumn>\n </SectionColumns>\n </SectionContent>\n </Section>\n</template>\n\n<style scoped>\n.examples {\n position: sticky;\n top: calc(var(--refs-viewport-offset) + 24px);\n}\n\n.examples > * {\n max-height: calc((var(--refs-viewport-height) - 60px) / 2);\n position: relative;\n}\n\n.examples > *:first-of-type:last-of-type {\n max-height: calc((var(--refs-viewport-height) - 60px));\n}\n\n/*\n * Don't constrain card height on mobile\n * (or zoomed in screens)\n */\n@media (max-width: 600px) {\n .examples > * {\n max-height: unset;\n }\n}\n.deprecated * {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"ModernLayout.vue.script.js","names":[],"sources":["../../../../src/features/Operation/layouts/ModernLayout.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { OperationCodeSample } from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport type { SecuritySchemeObjectSecret } from '@scalar/api-client/v2/blocks/scalar-auth-selector-block'\nimport { ScalarErrorBoundary, ScalarMarkdown } from '@scalar/components'\nimport { ScalarIconWebhooksLogo } from '@scalar/icons'\nimport {\n getOperationStability,\n getOperationStabilityColor,\n isOperationDeprecated,\n} from '@scalar/oas-utils/helpers'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, provide, ref, useId } from 'vue'\n\nimport { Anchor } from '@/components/Anchor'\nimport { Badge } from '@/components/Badge'\nimport { LinkList } from '@/components/LinkList'\nimport OperationPath from '@/components/OperationPath.vue'\nimport {\n Section,\n SectionColumn,\n SectionColumns,\n SectionContent,\n SectionHeader,\n SectionHeaderTag,\n} from '@/components/Section'\nimport AskAgentButton from '@/features/ask-agent-button/AskAgentButton.vue'\nimport { ExampleResponses } from '@/features/example-responses'\nimport { ExternalDocs } from '@/features/external-docs'\nimport Callbacks from '@/features/Operation/components/callbacks/Callbacks.vue'\nimport OperationParameters from '@/features/Operation/components/OperationParameters.vue'\nimport OperationResponses from '@/features/Operation/components/OperationResponses.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from '@/features/Operation/request-body-composition-index'\nimport { getXKeysFromObject } from '@/features/specification-extension'\nimport SpecificationExtension from '@/features/specification-extension/SpecificationExtension.vue'\nimport { TestRequestButton } from '@/features/test-request-button'\nimport { XBadges } from '@/features/x-badges'\n\nconst {\n clientOptions,\n eventBus,\n isWebhook,\n method,\n operation,\n options,\n path,\n selectedServer,\n selectedSecuritySchemes,\n selectedClient,\n} = defineProps<\n Omit<\n OperationProps,\n | 'document'\n | 'pathValue'\n | 'server'\n | 'isCollapsed'\n | 'securitySchemes'\n | 'authStore'\n > & {\n /** Operation object with path params */\n operation: OperationObject\n /** The selected server for the operation */\n selectedServer: ServerObject | null\n /** The selected security schemes for the operation */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n }\n>()\n\nconst operationTitle = computed(() => operation.summary || path || '')\n\nconst labelId = useId()\n\nconst operationExtensions = computed(() => getXKeysFromObject(operation))\n\n/** Selected request body oneOf/anyOf variants; synced with schema dropdowns and code sample */\nconst requestBodyCompositionSelection = ref<RequestBodyCompositionSelection>({})\n\nconst requestBodyCompositionSelectionForCodeSample = computed(\n (): RequestBodyCompositionSelection => ({\n ...requestBodyCompositionSelection.value,\n }),\n)\n\nconst requestBodyCompositionSelectionKey = computed(() =>\n JSON.stringify(requestBodyCompositionSelectionForCodeSample.value),\n)\n\nprovide(REQUEST_BODY_COMPOSITION_INDEX_SYMBOL, requestBodyCompositionSelection)\n</script>\n\n<template>\n <Section\n :id=\"id\"\n :aria-labelledby=\"labelId\"\n :label=\"operationTitle\"\n tabindex=\"-1\"\n @intersecting=\"() => eventBus?.emit('intersecting:nav-item', { id })\">\n <SectionContent>\n <div class=\"flex flex-row justify-between gap-1\">\n <!-- Left -->\n <div class=\"flex gap-1\">\n <!-- Operation ID -->\n <Badge v-if=\"options?.showOperationId && operation.operationId\">\n {{ operation.operationId }}\n </Badge>\n <!-- Stability badge -->\n <Badge\n v-if=\"getOperationStability(operation)\"\n class=\"capitalize\"\n :class=\"getOperationStabilityColor(operation)\">\n {{ getOperationStability(operation) }}\n </Badge>\n <!-- Webhook badge -->\n <Badge\n v-if=\"isWebhook\"\n class=\"font-code text-green flex w-fit items-center justify-center gap-1\">\n <ScalarIconWebhooksLogo weight=\"bold\" />Webhook\n </Badge>\n <!-- x-badges before -->\n <XBadges\n :badges=\"operation['x-badges']\"\n position=\"before\" />\n </div>\n <!-- Right -->\n <div class=\"flex gap-1\">\n <!-- x-badges after -->\n <XBadges\n :badges=\"operation['x-badges']\"\n position=\"after\" />\n </div>\n </div>\n <div :class=\"isOperationDeprecated(operation) ? 'deprecated' : ''\">\n <SectionHeader>\n <Anchor\n @copyAnchorUrl=\"() => eventBus?.emit('copy-url:nav-item', { id })\">\n <SectionHeaderTag\n :id=\"labelId\"\n :level=\"3\">\n {{ operationTitle }}\n </SectionHeaderTag>\n </Anchor>\n </SectionHeader>\n </div>\n <SectionColumns>\n <SectionColumn>\n <div class=\"operation-details\">\n <SpecificationExtension :value=\"operationExtensions\" />\n <ScalarMarkdown\n :anchorPrefix=\"id\"\n aria-label=\"Operation Description\"\n role=\"group\"\n transformType=\"heading\"\n :value=\"operation.description\"\n withAnchors\n withImages />\n <OperationParameters\n :breadcrumb=\"[id]\"\n :eventBus\n :options\n :parameters=\"operation.parameters\"\n :requestBody=\"getResolvedRef(operation.requestBody)\" />\n <OperationResponses\n :breadcrumb=\"[id]\"\n :collapsableItems=\"!options.expandAllResponses\"\n :eventBus\n :options\n :responses=\"operation.responses\" />\n\n <!-- Callbacks -->\n <ScalarErrorBoundary>\n <Callbacks\n v-if=\"operation.callbacks\"\n :callbacks=\"operation.callbacks\"\n class=\"mt-6\"\n :eventBus\n :options\n :path />\n </ScalarErrorBoundary>\n </div>\n </SectionColumn>\n <SectionColumn>\n <div class=\"examples\">\n <!-- External Docs -->\n <LinkList v-if=\"operation.externalDocs\">\n <ExternalDocs :value=\"operation.externalDocs\" />\n </LinkList>\n\n <!-- New Example Request -->\n <ScalarErrorBoundary>\n <OperationCodeSample\n :key=\"requestBodyCompositionSelectionKey\"\n :clientOptions\n :eventBus\n fallback\n :isWebhook\n :method\n :operation\n :path\n :requestBodyCompositionSelection=\"\n requestBodyCompositionSelectionForCodeSample\n \"\n :securitySchemes=\"selectedSecuritySchemes\"\n :selectedClient\n :selectedServer>\n <template #header>\n <OperationPath\n class=\"font-code text-c-2 [&_em]:text-c-1 [&_em]:not-italic\"\n :deprecated=\"operation?.deprecated\"\n :path=\"path\" />\n </template>\n <template\n v-if=\"!isWebhook\"\n #footer=\"{ exampleName }\">\n <div class=\"flex\">\n <AskAgentButton />\n <TestRequestButton\n v-if=\"!options.hideTestRequestButton\"\n :id\n :eventBus\n :exampleName\n :method\n :path\n :requestBodyCompositionSelection=\"\n requestBodyCompositionSelectionForCodeSample\n \" />\n </div>\n </template>\n </OperationCodeSample>\n </ScalarErrorBoundary>\n\n <ScalarErrorBoundary>\n <ExampleResponses\n v-if=\"operation.responses\"\n :responses=\"operation.responses\"\n style=\"margin-top: 12px\" />\n </ScalarErrorBoundary>\n </div>\n </SectionColumn>\n </SectionColumns>\n </SectionContent>\n </Section>\n</template>\n\n<style scoped>\n.examples {\n position: sticky;\n top: calc(var(--refs-viewport-offset) + 24px);\n}\n\n.examples > * {\n max-height: calc((var(--refs-viewport-height) - 60px) / 2);\n position: relative;\n}\n\n.examples > *:first-of-type:last-of-type {\n max-height: calc((var(--refs-viewport-height) - 60px));\n}\n\n/*\n * Don't constrain card height on mobile\n * (or zoomed in screens)\n */\n@media (max-width: 600px) {\n .examples > * {\n max-height: unset;\n }\n}\n.deprecated * {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EA,MAAM,iBAAiB,eAAe,QAAA,UAAU,WAAW,QAAA,QAAQ,GAAE;EAErE,MAAM,UAAU,OAAM;EAEtB,MAAM,sBAAsB,eAAe,mBAAmB,QAAA,UAAU,CAAA;;EAGxE,MAAM,kCAAkC,IAAqC,EAAE,CAAA;EAE/E,MAAM,+CAA+C,gBACX,EACtC,GAAG,gCAAgC,OACpC,EACH;EAEA,MAAM,qCAAqC,eACzC,KAAK,UAAU,6CAA6C,MAAM,CACpE;AAEA,UAAQ,uCAAuC,gCAA+B;;uBAI5E,YAqJU,MAAA,gBAAA,EAAA;IApJP,IAAI,QAAA;IACJ,mBAAiB,MAAA,QAAO;IACxB,OAAO,eAAA;IACR,UAAS;IACR,gBAAY,OAAA,OAAA,OAAA,WAAQ,QAAA,UAAU,KAAI,yBAAA,EAAA,IAA4B,QAAA,IAAE,CAAA;;2BA+IhD,CA9IjB,YA8IiB,MAAA,uBAAA,EAAA,MAAA;4BA7GT;MAhCN,mBAgCM,OAhCN,YAgCM,CA9BJ,mBAsBM,OAtBN,YAsBM;OApBS,QAAA,SAAS,mBAAmB,QAAA,UAAU,eAAA,WAAA,EAAnD,YAEQ,MAAA,cAAA,EAAA,EAAA,KAAA,GAAA,EAAA;+BADqB,CAAA,gBAAA,gBAAxB,QAAA,UAAU,YAAW,EAAA,EAAA,CAAA,CAAA;;;OAIlB,MAAA,sBAAqB,CAAC,QAAA,UAAS,IAAA,WAAA,EADvC,YAKQ,MAAA,cAAA,EAAA;;QAHN,OAAK,eAAA,CAAC,cACE,MAAA,2BAA0B,CAAC,QAAA,UAAS,CAAA,CAAA;;+BACN,CAAA,gBAAA,gBAAnC,MAAA,sBAAqB,CAAC,QAAA,UAAS,CAAA,EA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QAAQ,yBAAA,WAAA,EADjB,YASM,MAAA,0BAAA,EAAA;;YAPH,IAAA,QAAA;YACA,UAAA,QAAA;YACA;YACA,QAAA,QAAA;YACA,MAAA,QAAA;YACA,iCAA0D,6CAAA;;;;;;;;;;;;;;;;;;;;;;;;SAQrE,YAKsB,MAAA,oBAAA,EAAA,MAAA;kCAHZ,QAAA,UAAU,aAAA,WAAA,EADlB,YAG6B,MAAA,yBAAA,EAAA;;WAD1B,WAAW,QAAA,UAAU;WACtB,OAAA,EAAA,cAAA,QAAwB"}
1
+ {"version":3,"file":"ModernLayout.vue.script.js","names":[],"sources":["../../../../src/features/Operation/layouts/ModernLayout.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { OperationCodeSample } from '@scalar/api-client/v2/blocks/operation-code-sample'\nimport { ScalarErrorBoundary, ScalarMarkdown } from '@scalar/components'\nimport { ScalarIconWebhooksLogo } from '@scalar/icons'\nimport {\n getOperationStability,\n getOperationStabilityColor,\n isOperationDeprecated,\n} from '@scalar/oas-utils/helpers'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { SecuritySchemeObjectSecret } from '@scalar/workspace-store/request-example'\nimport type {\n OperationObject,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, provide, ref, useId } from 'vue'\n\nimport { Anchor } from '@/components/Anchor'\nimport { Badge } from '@/components/Badge'\nimport { LinkList } from '@/components/LinkList'\nimport OperationPath from '@/components/OperationPath.vue'\nimport {\n Section,\n SectionColumn,\n SectionColumns,\n SectionContent,\n SectionHeader,\n SectionHeaderTag,\n} from '@/components/Section'\nimport AskAgentButton from '@/features/ask-agent-button/AskAgentButton.vue'\nimport { ExampleResponses } from '@/features/example-responses'\nimport { ExternalDocs } from '@/features/external-docs'\nimport Callbacks from '@/features/Operation/components/callbacks/Callbacks.vue'\nimport OperationParameters from '@/features/Operation/components/OperationParameters.vue'\nimport OperationResponses from '@/features/Operation/components/OperationResponses.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from '@/features/Operation/request-body-composition-index'\nimport { getXKeysFromObject } from '@/features/specification-extension'\nimport SpecificationExtension from '@/features/specification-extension/SpecificationExtension.vue'\nimport { TestRequestButton } from '@/features/test-request-button'\nimport { XBadges } from '@/features/x-badges'\n\nconst {\n clientOptions,\n eventBus,\n isWebhook,\n method,\n operation,\n options,\n path,\n selectedServer,\n selectedSecuritySchemes,\n selectedClient,\n} = defineProps<\n Omit<\n OperationProps,\n | 'document'\n | 'pathValue'\n | 'server'\n | 'isCollapsed'\n | 'securitySchemes'\n | 'authStore'\n > & {\n /** Operation object with path params */\n operation: OperationObject\n /** The selected server for the operation */\n selectedServer: ServerObject | null\n /** The selected security schemes for the operation */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n }\n>()\n\nconst operationTitle = computed(() => operation.summary || path || '')\n\nconst labelId = useId()\n\nconst operationExtensions = computed(() => getXKeysFromObject(operation))\n\n/** Selected request body oneOf/anyOf variants; synced with schema dropdowns and code sample */\nconst requestBodyCompositionSelection = ref<RequestBodyCompositionSelection>({})\n\nconst requestBodyCompositionSelectionForCodeSample = computed(\n (): RequestBodyCompositionSelection => ({\n ...requestBodyCompositionSelection.value,\n }),\n)\n\nconst requestBodyCompositionSelectionKey = computed(() =>\n JSON.stringify(requestBodyCompositionSelectionForCodeSample.value),\n)\n\nprovide(REQUEST_BODY_COMPOSITION_INDEX_SYMBOL, requestBodyCompositionSelection)\n</script>\n\n<template>\n <Section\n :id=\"id\"\n :aria-labelledby=\"labelId\"\n :label=\"operationTitle\"\n tabindex=\"-1\"\n @intersecting=\"() => eventBus?.emit('intersecting:nav-item', { id })\">\n <SectionContent>\n <div class=\"flex flex-row justify-between gap-1\">\n <!-- Left -->\n <div class=\"flex gap-1\">\n <!-- Operation ID -->\n <Badge v-if=\"options?.showOperationId && operation.operationId\">\n {{ operation.operationId }}\n </Badge>\n <!-- Stability badge -->\n <Badge\n v-if=\"getOperationStability(operation)\"\n class=\"capitalize\"\n :class=\"getOperationStabilityColor(operation)\">\n {{ getOperationStability(operation) }}\n </Badge>\n <!-- Webhook badge -->\n <Badge\n v-if=\"isWebhook\"\n class=\"font-code text-green flex w-fit items-center justify-center gap-1\">\n <ScalarIconWebhooksLogo weight=\"bold\" />Webhook\n </Badge>\n <!-- x-badges before -->\n <XBadges\n :badges=\"operation['x-badges']\"\n position=\"before\" />\n </div>\n <!-- Right -->\n <div class=\"flex gap-1\">\n <!-- x-badges after -->\n <XBadges\n :badges=\"operation['x-badges']\"\n position=\"after\" />\n </div>\n </div>\n <div :class=\"isOperationDeprecated(operation) ? 'deprecated' : ''\">\n <SectionHeader>\n <Anchor\n @copyAnchorUrl=\"() => eventBus?.emit('copy-url:nav-item', { id })\">\n <SectionHeaderTag\n :id=\"labelId\"\n :level=\"3\">\n {{ operationTitle }}\n </SectionHeaderTag>\n </Anchor>\n </SectionHeader>\n </div>\n <SectionColumns>\n <SectionColumn>\n <div class=\"operation-details\">\n <SpecificationExtension :value=\"operationExtensions\" />\n <ScalarMarkdown\n :anchorPrefix=\"id\"\n aria-label=\"Operation Description\"\n role=\"group\"\n transformType=\"heading\"\n :value=\"operation.description\"\n withAnchors\n withImages />\n <OperationParameters\n :breadcrumb=\"[id]\"\n :eventBus\n :options\n :parameters=\"operation.parameters\"\n :requestBody=\"getResolvedRef(operation.requestBody)\" />\n <OperationResponses\n :breadcrumb=\"[id]\"\n :collapsableItems=\"!options.expandAllResponses\"\n :eventBus\n :options\n :responses=\"operation.responses\" />\n\n <!-- Callbacks -->\n <ScalarErrorBoundary>\n <Callbacks\n v-if=\"operation.callbacks\"\n :callbacks=\"operation.callbacks\"\n class=\"mt-6\"\n :eventBus\n :options\n :path />\n </ScalarErrorBoundary>\n </div>\n </SectionColumn>\n <SectionColumn>\n <div class=\"examples\">\n <!-- External Docs -->\n <LinkList v-if=\"operation.externalDocs\">\n <ExternalDocs :value=\"operation.externalDocs\" />\n </LinkList>\n\n <!-- New Example Request -->\n <ScalarErrorBoundary>\n <OperationCodeSample\n :key=\"requestBodyCompositionSelectionKey\"\n :clientOptions\n :eventBus\n fallback\n :isWebhook\n :method\n :operation\n :path\n :requestBodyCompositionSelection=\"\n requestBodyCompositionSelectionForCodeSample\n \"\n :securitySchemes=\"selectedSecuritySchemes\"\n :selectedClient\n :selectedServer>\n <template #header>\n <OperationPath\n class=\"font-code text-c-2 [&_em]:text-c-1 [&_em]:not-italic\"\n :deprecated=\"operation?.deprecated\"\n :path=\"path\" />\n </template>\n <template\n v-if=\"!isWebhook\"\n #footer=\"{ exampleName }\">\n <div class=\"flex\">\n <AskAgentButton />\n <TestRequestButton\n v-if=\"!options.hideTestRequestButton\"\n :id\n :eventBus\n :exampleName\n :method\n :path\n :requestBodyCompositionSelection=\"\n requestBodyCompositionSelectionForCodeSample\n \" />\n </div>\n </template>\n </OperationCodeSample>\n </ScalarErrorBoundary>\n\n <ScalarErrorBoundary>\n <ExampleResponses\n v-if=\"operation.responses\"\n :responses=\"operation.responses\"\n style=\"margin-top: 12px\" />\n </ScalarErrorBoundary>\n </div>\n </SectionColumn>\n </SectionColumns>\n </SectionContent>\n </Section>\n</template>\n\n<style scoped>\n.examples {\n position: sticky;\n top: calc(var(--refs-viewport-offset) + 24px);\n}\n\n.examples > * {\n max-height: calc((var(--refs-viewport-height) - 60px) / 2);\n position: relative;\n}\n\n.examples > *:first-of-type:last-of-type {\n max-height: calc((var(--refs-viewport-height) - 60px));\n}\n\n/*\n * Don't constrain card height on mobile\n * (or zoomed in screens)\n */\n@media (max-width: 600px) {\n .examples > * {\n max-height: unset;\n }\n}\n.deprecated * {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EA,MAAM,iBAAiB,eAAe,QAAA,UAAU,WAAW,QAAA,QAAQ,G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A,UAAU,aAAA,WAAA,EADlB,YAG6B,MAAA,yBAAA,EAAA;;WAD1B,WAAW,QAAA,UAAU;WACtB,OAAA,EAAA,cAAA,QAAwB"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-fuse-instance.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-fuse-instance.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAA;AAE1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAAC,QAAQ,CAAC,CA6CnD"}
1
+ {"version":3,"file":"create-fuse-instance.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-fuse-instance.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,SAAS,CAAA;AAE1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvD;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAAC,QAAQ,CAAC,CA+CnD"}
@@ -20,6 +20,10 @@ function createFuseInstance() {
20
20
  name: "body",
21
21
  weight: .2
22
22
  },
23
+ {
24
+ name: "responseExamples",
25
+ weight: .25
26
+ },
23
27
  {
24
28
  name: "operationId",
25
29
  weight: .6
@@ -1 +1 @@
1
- {"version":3,"file":"create-fuse-instance.js","names":[],"sources":["../../../../src/features/Search/helpers/create-fuse-instance.ts"],"sourcesContent":["import Fuse from 'fuse.js'\n\nimport type { FuseData } from '@/features/Search/types'\n\n/**\n * Create a Fuse instance for searching the API reference.\n *\n * Doesn't have any data yet, so it's empty.\n */\nexport function createFuseInstance(): Fuse<FuseData> {\n return new Fuse([], {\n // Define searchable fields with weights to prioritize more important matches\n keys: [\n // Highest weight - titles are most descriptive\n { name: 'title', weight: 0.7 },\n // Medium weight - helpful but often verbose\n { name: 'description', weight: 0.3 },\n // Lowest weight - can be very long and noisy\n { name: 'body', weight: 0.2 },\n // High weight - unique identifiers for operations\n { name: 'operationId', weight: 0.6 },\n // Good weight - endpoint paths are searchable\n { name: 'path', weight: 0.5 },\n // Medium-high weight - helps with categorization\n { name: 'tag', weight: 0.4 },\n // Medium weight - useful for filtering by method\n { name: 'method', weight: 0.3 },\n ],\n\n // Threshold controls how strict the matching is (0.0 = perfect match, 1.0 = very loose)\n // 0.3 allows for some typos and partial matches while maintaining relevance\n threshold: 0.3,\n\n // Maximum distance between characters that can be matched\n // Higher values allow matches even when characters are far apart in long text\n distance: 100,\n\n // Include the match score in results for debugging and potential UI enhancements\n includeScore: true,\n\n // Include detailed match information showing which parts of the text matched\n includeMatches: true,\n\n // Don't require matches to be at the beginning of strings\n // Makes search more flexible and user-friendly\n ignoreLocation: true,\n\n // Enable advanced search syntax like 'exact' for exact matches or !exclude for exclusions\n useExtendedSearch: true,\n\n // Find all possible matches in each item, not just the first one\n // Ensures comprehensive search results\n findAllMatches: true,\n })\n}\n"],"mappings":";;;;;;;AASA,SAAgB,qBAAqC;AACnD,QAAO,IAAI,KAAK,EAAE,EAAE;EAElB,MAAM;GAEJ;IAAE,MAAM;IAAS,QAAQ;IAAK;GAE9B;IAAE,MAAM;IAAe,QAAQ;IAAK;GAEpC;IAAE,MAAM;IAAQ,QAAQ;IAAK;GAE7B;IAAE,MAAM;IAAe,QAAQ;IAAK;GAEpC;IAAE,MAAM;IAAQ,QAAQ;IAAK;GAE7B;IAAE,MAAM;IAAO,QAAQ;IAAK;GAE5B;IAAE,MAAM;IAAU,QAAQ;IAAK;GAChC;EAID,WAAW;EAIX,UAAU;EAGV,cAAc;EAGd,gBAAgB;EAIhB,gBAAgB;EAGhB,mBAAmB;EAInB,gBAAgB;EACjB,CAAC"}
1
+ {"version":3,"file":"create-fuse-instance.js","names":[],"sources":["../../../../src/features/Search/helpers/create-fuse-instance.ts"],"sourcesContent":["import Fuse from 'fuse.js'\n\nimport type { FuseData } from '@/features/Search/types'\n\n/**\n * Create a Fuse instance for searching the API reference.\n *\n * Doesn't have any data yet, so it's empty.\n */\nexport function createFuseInstance(): Fuse<FuseData> {\n return new Fuse([], {\n // Define searchable fields with weights to prioritize more important matches\n keys: [\n // Highest weight - titles are most descriptive\n { name: 'title', weight: 0.7 },\n // Medium weight - helpful but often verbose\n { name: 'description', weight: 0.3 },\n // Lowest weight - can be very long and noisy\n { name: 'body', weight: 0.2 },\n // Low-medium weight - response examples can help full-text matching\n { name: 'responseExamples', weight: 0.25 },\n // High weight - unique identifiers for operations\n { name: 'operationId', weight: 0.6 },\n // Good weight - endpoint paths are searchable\n { name: 'path', weight: 0.5 },\n // Medium-high weight - helps with categorization\n { name: 'tag', weight: 0.4 },\n // Medium weight - useful for filtering by method\n { name: 'method', weight: 0.3 },\n ],\n\n // Threshold controls how strict the matching is (0.0 = perfect match, 1.0 = very loose)\n // 0.3 allows for some typos and partial matches while maintaining relevance\n threshold: 0.3,\n\n // Maximum distance between characters that can be matched\n // Higher values allow matches even when characters are far apart in long text\n distance: 100,\n\n // Include the match score in results for debugging and potential UI enhancements\n includeScore: true,\n\n // Include detailed match information showing which parts of the text matched\n includeMatches: true,\n\n // Don't require matches to be at the beginning of strings\n // Makes search more flexible and user-friendly\n ignoreLocation: true,\n\n // Enable advanced search syntax like 'exact' for exact matches or !exclude for exclusions\n useExtendedSearch: true,\n\n // Find all possible matches in each item, not just the first one\n // Ensures comprehensive search results\n findAllMatches: true,\n })\n}\n"],"mappings":";;;;;;;AASA,SAAgB,qBAAqC;AACnD,QAAO,IAAI,KAAK,EAAE,EAAE;EAElB,MAAM;GAEJ;IAAE,MAAM;IAAS,QAAQ;IAAK;GAE9B;IAAE,MAAM;IAAe,QAAQ;IAAK;GAEpC;IAAE,MAAM;IAAQ,QAAQ;IAAK;GAE7B;IAAE,MAAM;IAAoB,QAAQ;IAAM;GAE1C;IAAE,MAAM;IAAe,QAAQ;IAAK;GAEpC;IAAE,MAAM;IAAQ,QAAQ;IAAK;GAE7B;IAAE,MAAM;IAAO,QAAQ;IAAK;GAE5B;IAAE,MAAM;IAAU,QAAQ;IAAK;GAChC;EAID,WAAW;EAIX,UAAU;EAGV,cAAc;EAGd,gBAAgB;EAIhB,gBAAgB;EAGhB,mBAAmB;EAInB,gBAAgB;EACjB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"create-search-index.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAGvD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,GAAG,QAAQ,EAAE,CAoBnF"}
1
+ {"version":3,"file":"create-search-index.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAEV,eAAe,EAGhB,MAAM,8DAA8D,CAAA;AAErE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AA0DvD;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,eAAe,GAAG,SAAS,GAAG,QAAQ,EAAE,CAoBnF"}
@@ -1,6 +1,36 @@
1
1
  import { createParameterMap, extractRequestBody } from "../../../helpers/openapi.js";
2
+ import { combineParams } from "@scalar/workspace-store/request-example";
2
3
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
3
4
  //#region src/features/Search/helpers/create-search-index.ts
5
+ function responseExampleValueToString(value) {
6
+ if (typeof value === "string") return value;
7
+ try {
8
+ return JSON.stringify(value);
9
+ } catch (_error) {
10
+ return "";
11
+ }
12
+ }
13
+ function mediaTypeExamplesToStrings(mediaType) {
14
+ const examplesFromNamedMap = Object.values(mediaType.examples ?? {}).flatMap((example) => {
15
+ const resolvedExample = getResolvedRef(example);
16
+ if (!resolvedExample || !("value" in resolvedExample)) return [];
17
+ return responseExampleValueToString(resolvedExample.value);
18
+ }).filter((value) => value.length > 0);
19
+ const mediaTypeExample = "example" in mediaType && mediaType.example !== void 0 ? responseExampleValueToString(mediaType.example) : "";
20
+ return mediaTypeExample ? [mediaTypeExample, ...examplesFromNamedMap] : examplesFromNamedMap;
21
+ }
22
+ function extractResponseExamples(responses) {
23
+ if (!responses) return [];
24
+ return Object.values(responses).flatMap((response) => {
25
+ const resolvedResponse = getResolvedRef(response);
26
+ if (!resolvedResponse?.content) return [];
27
+ return Object.values(resolvedResponse.content).flatMap((mediaType) => {
28
+ const resolvedMediaType = getResolvedRef(mediaType);
29
+ if (!resolvedMediaType) return [];
30
+ return mediaTypeExamplesToStrings(resolvedMediaType);
31
+ });
32
+ }).filter((value) => value.length > 0);
33
+ }
4
34
  /**
5
35
  * Create a search index from a list of entries.
6
36
  */
@@ -23,18 +53,25 @@ function createSearchIndex(document) {
23
53
  */
24
54
  function addEntryToIndex(entry, index, document) {
25
55
  if (entry.type === "operation") {
26
- const operation = getResolvedRef(document?.paths?.[entry.path]?.[entry.method]) ?? {};
27
- const requestBodyOrParameterMap = extractRequestBody(operation) || createParameterMap(operation);
56
+ const pathItem = getResolvedRef(document?.paths?.[entry.path]);
57
+ const operation = getResolvedRef(pathItem?.[entry.method]) ?? {};
58
+ const operationWithPathParams = {
59
+ ...operation,
60
+ parameters: combineParams(pathItem?.parameters, operation.parameters)
61
+ };
62
+ const requestBodyOrParameterMap = extractRequestBody(operationWithPathParams) || createParameterMap(operationWithPathParams);
28
63
  const body = typeof requestBodyOrParameterMap !== "boolean" ? requestBodyOrParameterMap : null;
64
+ const responseExamples = extractResponseExamples(operationWithPathParams.responses);
29
65
  index.push({
30
66
  type: "operation",
31
67
  title: entry.title,
32
68
  id: entry.id,
33
- description: operation.description || "",
69
+ description: operationWithPathParams.description || "",
34
70
  method: entry.method,
35
71
  path: entry.path,
36
72
  body: body || "",
37
- operationId: operation.operationId,
73
+ responseExamples,
74
+ operationId: operationWithPathParams.operationId,
38
75
  entry
39
76
  });
40
77
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"create-search-index.js","names":[],"sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport type { FuseData } from '@/features/Search/types'\nimport { createParameterMap, extractRequestBody } from '@/helpers/openapi'\n\n/**\n * Create a search index from a list of entries.\n */\nexport function createSearchIndex(document: OpenApiDocument | undefined): FuseData[] {\n const index: FuseData[] = []\n\n /**\n * Recursively processes entries and their children to build the search index.\n */\n function processEntries(entriesToProcess: TraversedEntry[]): void {\n entriesToProcess.forEach((entry) => {\n addEntryToIndex(entry, index, document)\n\n // Recursively process children if they exist\n if ('children' in entry && entry.children) {\n processEntries(entry.children)\n }\n })\n }\n\n processEntries(document?.['x-scalar-navigation']?.children ?? [])\n\n return index\n}\n\n/**\n * Adds a single entry to the search index, handling all entry types recursively.\n */\nfunction addEntryToIndex(entry: TraversedEntry, index: FuseData[], document?: OpenApiDocument): void {\n // Operation\n if (entry.type === 'operation') {\n const operation = getResolvedRef(document?.paths?.[entry.path]?.[entry.method]) ?? {}\n\n const requestBodyOrParameterMap = extractRequestBody(operation) || createParameterMap(operation)\n const body = typeof requestBodyOrParameterMap !== 'boolean' ? requestBodyOrParameterMap : null\n\n index.push({\n type: 'operation',\n title: entry.title,\n id: entry.id,\n description: operation.description || '',\n method: entry.method,\n path: entry.path,\n body: body || '',\n operationId: operation.operationId,\n entry,\n })\n\n return\n }\n\n // Webhook\n if (entry.type === 'webhook') {\n const webhook = getResolvedRef(document?.webhooks?.[entry.name]?.[entry.method]) ?? {}\n\n index.push({\n id: entry.id,\n type: 'webhook',\n title: entry.title,\n description: 'Webhook',\n method: entry.method,\n body: webhook.description || '',\n operationId: webhook.operationId,\n entry,\n })\n\n return\n }\n\n // Model\n if (entry.type === 'model') {\n const schema = getResolvedRef(document?.components?.schemas?.[entry.name])\n\n const description = schema?.description ?? ''\n\n index.push({\n type: 'model',\n title: entry.title,\n description: 'Model',\n id: entry.id,\n body: description,\n entry,\n })\n\n return\n }\n\n // Models heading\n if (entry.type === 'models') {\n index.push({\n id: entry.id,\n type: 'heading',\n title: 'Models',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n\n // Tag\n if (entry.type === 'tag' && entry.isWebhooks === true) {\n index.push({\n id: entry.id,\n type: 'heading',\n title: 'Webhooks',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n\n if (entry.type === 'tag' && entry.isGroup === false) {\n index.push({\n id: entry.id,\n title: entry.title,\n description: entry.description || '',\n type: 'tag',\n body: '',\n entry,\n })\n\n return\n }\n\n // Tag group\n if (entry.type === 'tag' && entry.isGroup === true) {\n index.push({\n id: entry.id,\n title: entry.title,\n description: 'Tag Group',\n type: 'tag',\n body: '',\n entry,\n })\n\n return\n }\n\n // Headings from info.description\n if (entry.type === 'text') {\n index.push({\n id: entry.id,\n type: 'heading',\n title: entry.title ?? '',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n}\n"],"mappings":";;;;;;AAUA,SAAgB,kBAAkB,UAAmD;CACnF,MAAM,QAAoB,EAAE;;;;CAK5B,SAAS,eAAe,kBAA0C;AAChE,mBAAiB,SAAS,UAAU;AAClC,mBAAgB,OAAO,OAAO,SAAS;AAGvC,OAAI,cAAc,SAAS,MAAM,SAC/B,gBAAe,MAAM,SAAS;IAEhC;;AAGJ,gBAAe,WAAW,wBAAwB,YAAY,EAAE,CAAC;AAEjE,QAAO;;;;;AAMT,SAAS,gBAAgB,OAAuB,OAAmB,UAAkC;AAEnG,KAAI,MAAM,SAAS,aAAa;EAC9B,MAAM,YAAY,eAAe,UAAU,QAAQ,MAAM,QAAQ,MAAM,QAAQ,IAAI,EAAE;EAErF,MAAM,4BAA4B,mBAAmB,UAA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AAM,KAAK;GACT,IAAI,MAAM;GACV,OAAO,MAAM;GACb,aAAa;GACb,MAAM;GACN,MAAM;GACN;GACD,CAAC;AAEF;;AAIF,KAAI,MAAM,SAAS,QAAQ;AACzB,QAAM,KAAK;GACT,IAAI,MAAM;GACV,MAAM;GACN,OAAO,MAAM,SAAS;GACtB,aAAa;GACb,MAAM;GACN;GACD,CAAC;AAEF"}
1
+ {"version":3,"file":"create-search-index.js","names":[],"sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { combineParams } from '@scalar/workspace-store/request-example'\nimport type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\nimport type {\n MediaTypeObject,\n OpenApiDocument,\n OperationObject,\n ResponsesObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport type { FuseData } from '@/features/Search/types'\nimport { createParameterMap, extractRequestBody } from '@/helpers/openapi'\n\nfunction responseExampleValueToString(value: unknown): string {\n if (typeof value === 'string') {\n return value\n }\n\n try {\n return JSON.stringify(value)\n } catch (_error) {\n return ''\n }\n}\n\nfunction mediaTypeExamplesToStrings(mediaType: MediaTypeObject): string[] {\n const examplesFromNamedMap = Object.values(mediaType.examples ?? {})\n .flatMap((example) => {\n const resolvedExample = getResolvedRef(example)\n\n if (!resolvedExample || !('value' in resolvedExample)) {\n return []\n }\n\n return responseExampleValueToString(resolvedExample.value)\n })\n .filter((value) => value.length > 0)\n\n const mediaTypeExample =\n 'example' in mediaType && mediaType.example !== undefined ? responseExampleValueToString(mediaType.example) : ''\n\n return mediaTypeExample ? [mediaTypeExample, ...examplesFromNamedMap] : examplesFromNamedMap\n}\n\nfunction extractResponseExamples(responses: ResponsesObject | undefined): string[] {\n if (!responses) {\n return []\n }\n\n return Object.values(responses)\n .flatMap((response) => {\n const resolvedResponse = getResolvedRef(response)\n if (!resolvedResponse?.content) {\n return []\n }\n\n return Object.values(resolvedResponse.content).flatMap((mediaType) => {\n const resolvedMediaType = getResolvedRef(mediaType)\n if (!resolvedMediaType) {\n return []\n }\n\n return mediaTypeExamplesToStrings(resolvedMediaType)\n })\n })\n .filter((value) => value.length > 0)\n}\n\n/**\n * Create a search index from a list of entries.\n */\nexport function createSearchIndex(document: OpenApiDocument | undefined): FuseData[] {\n const index: FuseData[] = []\n\n /**\n * Recursively processes entries and their children to build the search index.\n */\n function processEntries(entriesToProcess: TraversedEntry[]): void {\n entriesToProcess.forEach((entry) => {\n addEntryToIndex(entry, index, document)\n\n // Recursively process children if they exist\n if ('children' in entry && entry.children) {\n processEntries(entry.children)\n }\n })\n }\n\n processEntries(document?.['x-scalar-navigation']?.children ?? [])\n\n return index\n}\n\n/**\n * Adds a single entry to the search index, handling all entry types recursively.\n */\nfunction addEntryToIndex(entry: TraversedEntry, index: FuseData[], document?: OpenApiDocument): void {\n // Operation\n if (entry.type === 'operation') {\n const pathItem = getResolvedRef(document?.paths?.[entry.path])\n const operation = (getResolvedRef(pathItem?.[entry.method]) ?? {}) as OperationObject\n const operationWithPathParams = {\n ...operation,\n parameters: combineParams(pathItem?.parameters, operation.parameters),\n }\n\n const requestBodyOrParameterMap =\n extractRequestBody(operationWithPathParams) || createParameterMap(operationWithPathParams)\n const body = typeof requestBodyOrParameterMap !== 'boolean' ? requestBodyOrParameterMap : null\n const responseExamples = extractResponseExamples(operationWithPathParams.responses)\n\n index.push({\n type: 'operation',\n title: entry.title,\n id: entry.id,\n description: operationWithPathParams.description || '',\n method: entry.method,\n path: entry.path,\n body: body || '',\n responseExamples,\n operationId: operationWithPathParams.operationId,\n entry,\n })\n\n return\n }\n\n // Webhook\n if (entry.type === 'webhook') {\n const webhook = getResolvedRef(document?.webhooks?.[entry.name]?.[entry.method]) ?? {}\n\n index.push({\n id: entry.id,\n type: 'webhook',\n title: entry.title,\n description: 'Webhook',\n method: entry.method,\n body: webhook.description || '',\n operationId: webhook.operationId,\n entry,\n })\n\n return\n }\n\n // Model\n if (entry.type === 'model') {\n const schema = getResolvedRef(document?.components?.schemas?.[entry.name])\n\n const description = schema?.description ?? ''\n\n index.push({\n type: 'model',\n title: entry.title,\n description: 'Model',\n id: entry.id,\n body: description,\n entry,\n })\n\n return\n }\n\n // Models heading\n if (entry.type === 'models') {\n index.push({\n id: entry.id,\n type: 'heading',\n title: 'Models',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n\n // Tag\n if (entry.type === 'tag' && entry.isWebhooks === true) {\n index.push({\n id: entry.id,\n type: 'heading',\n title: 'Webhooks',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n\n if (entry.type === 'tag' && entry.isGroup === false) {\n index.push({\n id: entry.id,\n title: entry.title,\n description: entry.description || '',\n type: 'tag',\n body: '',\n entry,\n })\n\n return\n }\n\n // Tag group\n if (entry.type === 'tag' && entry.isGroup === true) {\n index.push({\n id: entry.id,\n title: entry.title,\n description: 'Tag Group',\n type: 'tag',\n body: '',\n entry,\n })\n\n return\n }\n\n // Headings from info.description\n if (entry.type === 'text') {\n index.push({\n id: entry.id,\n type: 'heading',\n title: entry.title ?? '',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n}\n"],"mappings":";;;;AAaA,SAAS,6BAA6B,OAAwB;AAC5D,KAAI,OAAO,UAAU,SACnB,QAAO;AAGT,KAAI;AACF,SAAO,KAAK,UAAU,MAAM;UACrB,QAAQ;AACf,SAAO;;;AAIX,SAAS,2BAA2B,WAAsC;CACxE,MAAM,uBAAuB,OAAO,OAAO,UAAU,YAAY,EAAE,CAAC,CACjE,SAAS,YAAY;EACpB,MAAM,kBAAkB,eAAe,QAAQ;AAE/C,MAAI,CAAC,mBAAmB,EAAE,WAAW,iBACnC,QAAO,EAAE;AAGX,SAAO,6BAA6B,gBAAgB,MAAM;GAC1D,CACD,QAAQ,UAAU,MAAM,SAAS,EAAE;CAEtC,MAAM,mBACJ,aAAa,aAAa,UAAU,YAAY,KAAA,IAAY,6BAA6B,UAAU,QAAQ,GAAG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;GACT,IAAI,MAAM;GACV,MAAM;GACN,OAAO,MAAM,SAAS;GACtB,aAAa;GACb,MAAM;GACN;GACD,CAAC;AAEF"}
@@ -7,6 +7,7 @@ export type FuseData = {
7
7
  title: string;
8
8
  description: string;
9
9
  body?: string | string[] | ParameterMap;
10
+ responseExamples?: string[];
10
11
  method?: string;
11
12
  path?: string;
12
13
  operationId?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/Search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAEhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAA;AAE7E,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,SAAS,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,YAAY,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,cAAc,CAAA;CACtB,CAAA"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/Search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAEhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAA;AAE7E,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,SAAS,CAAA;IACf,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,YAAY,CAAA;IACvC,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,EAAE,cAAc,CAAA;CACtB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleResponse.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-responses/ExampleResponse.vue"],"names":[],"mappings":"AAmJA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAGrE,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAA;IACrC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAA;CACnC,CAAC;AAyHF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ExampleResponse.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-responses/ExampleResponse.vue"],"names":[],"mappings":"AA+IA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAGrE,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAA;IACrC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAA;CACnC,CAAC;AAyHF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
2
2
  import ExampleResponse_vue_vue_type_script_setup_true_lang_default from "./ExampleResponse.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/features/example-responses/ExampleResponse.vue
5
- var ExampleResponse_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ExampleResponse_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-de6a4e70"]]);
5
+ var ExampleResponse_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ExampleResponse_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-c29c16d8"]]);
6
6
  //#endregion
7
7
  export { ExampleResponse_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleResponse.vue.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":""}
1
+ {"version":3,"file":"ExampleResponse.vue.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":""}
@@ -1,6 +1,7 @@
1
1
  import { computed, createBlock, createElementBlock, defineComponent, openBlock, unref } from "vue";
2
2
  import { ScalarCodeBlock, ScalarVirtualText } from "@scalar/components";
3
- import { getExampleFromSchema, getResolvedRefDeep } from "@scalar/api-client/v2/blocks/operation-code-sample";
3
+ import { getExampleFromSchema } from "@scalar/workspace-store/request-example";
4
+ import { getResolvedRefDeep } from "@scalar/api-client/v2/blocks/operation-code-sample";
4
5
  import { prettyPrintJson } from "@scalar/helpers/json/pretty-print-json";
5
6
  //#region src/features/example-responses/ExampleResponse.vue?vue&type=script&setup=true&lang.ts
6
7
  var _hoisted_1 = {
@@ -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,uBAAm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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,QACzB;;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N,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"}