@scalar/api-reference 1.51.0 → 1.52.1

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 (49) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/dist/browser/standalone.js +211 -209
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReference.vue.js +1 -1
  5. package/dist/components/ApiReference.vue.js.map +1 -1
  6. package/dist/components/ApiReference.vue.script.js +1 -1
  7. package/dist/components/ApiReference.vue.script.js.map +1 -1
  8. package/dist/components/Content/Schema/SchemaPropertyExamples.vue.d.ts.map +1 -1
  9. package/dist/components/Content/Schema/SchemaPropertyExamples.vue.js +1 -1
  10. package/dist/components/Content/Schema/SchemaPropertyExamples.vue.js.map +1 -1
  11. package/dist/components/Content/Schema/SchemaPropertyExamples.vue.script.js.map +1 -1
  12. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  13. package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
  14. package/dist/features/Operation/components/ParameterListItem.vue.js.map +1 -1
  15. package/dist/features/Operation/components/ParameterListItem.vue.script.js +22 -13
  16. package/dist/features/Operation/components/ParameterListItem.vue.script.js.map +1 -1
  17. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  18. package/dist/features/Operation/components/RequestBody.vue.js +1 -1
  19. package/dist/features/Operation/components/RequestBody.vue.js.map +1 -1
  20. package/dist/features/Operation/components/RequestBody.vue.script.js +31 -21
  21. package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
  22. package/dist/features/Search/helpers/create-fuse-instance.d.ts.map +1 -1
  23. package/dist/features/Search/helpers/create-fuse-instance.js +4 -0
  24. package/dist/features/Search/helpers/create-fuse-instance.js.map +1 -1
  25. package/dist/features/Search/helpers/create-search-index.js +4 -3
  26. package/dist/features/Search/helpers/create-search-index.js.map +1 -1
  27. package/dist/features/Search/types.d.ts +2 -2
  28. package/dist/features/Search/types.d.ts.map +1 -1
  29. package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
  30. package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
  31. package/dist/features/example-responses/ExampleResponses.vue.js.map +1 -1
  32. package/dist/features/example-responses/ExampleResponses.vue.script.js +1 -1
  33. package/dist/features/example-responses/ExampleResponses.vue.script.js.map +1 -1
  34. package/dist/helpers/map-config-plugins.d.ts +3 -2
  35. package/dist/helpers/map-config-plugins.d.ts.map +1 -1
  36. package/dist/helpers/map-config-plugins.js +13 -9
  37. package/dist/helpers/map-config-plugins.js.map +1 -1
  38. package/dist/helpers/openapi.d.ts +6 -14
  39. package/dist/helpers/openapi.d.ts.map +1 -1
  40. package/dist/helpers/openapi.js +24 -29
  41. package/dist/helpers/openapi.js.map +1 -1
  42. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  43. package/dist/standalone/lib/html-api.js +12 -12
  44. package/dist/standalone/lib/html-api.js.map +1 -1
  45. package/dist/style.css +210 -140
  46. package/package.json +11 -16
  47. package/dist/ssr.d.ts +0 -22
  48. package/dist/ssr.d.ts.map +0 -1
  49. package/dist/ssr.js +0 -7
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaPropertyExamples.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaPropertyExamples.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { computed } from 'vue'\n\nimport { formatExample } from './helpers/format-example'\n\nconst { examples, example } = defineProps<{\n examples?: unknown\n example?: unknown\n}>()\n\nconst { copyToClipboard } = useClipboard()\n\nconst hasSingleExample = computed(() => isDefined(example))\n\nconst normalizedExamples = computed<Record<string, unknown>>(() => {\n if (examples && typeof examples === 'object') {\n return examples as Record<string, unknown>\n }\n\n return {}\n})\n\nconst hasMultipleExamples = computed(\n () => Object.keys(normalizedExamples.value).length > 0,\n)\n\nconst multipleExamplesLabel = computed(() =>\n Object.keys(normalizedExamples.value).length === 1 ? 'Example' : 'Examples',\n)\n</script>\n<template>\n <!-- single example (deprecated) -->\n <template v-if=\"hasSingleExample\">\n <div class=\"property-example\">\n <button\n class=\"property-example-label\"\n type=\"button\">\n <span>Example</span>\n </button>\n <div class=\"property-example-value-list\">\n <button\n class=\"property-example-value group\"\n type=\"button\"\n @click=\"copyToClipboard(formatExample(example))\">\n <span>\n {{ formatExample(example) }}\n </span>\n <ScalarIcon\n class=\"group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3\"\n icon=\"Clipboard\"\n size=\"xs\" />\n </button>\n </div>\n </div>\n </template>\n\n <!-- multiple examples -->\n <template v-if=\"hasMultipleExamples\">\n <div class=\"property-example\">\n <button\n class=\"property-example-label\"\n type=\"button\">\n <span>\n {{ multipleExamplesLabel }}\n </span>\n </button>\n <div class=\"property-example-value-list\">\n <button\n v-for=\"(ex, key) in normalizedExamples\"\n :key=\"key\"\n class=\"property-example-value group\"\n type=\"button\"\n @click=\"copyToClipboard(formatExample(ex))\">\n <span>{{ formatExample(ex) }} </span>\n <ScalarIcon\n class=\"text-c-3 group-hover:text-c-1 ml-auto min-h-3 min-w-3\"\n icon=\"Clipboard\"\n size=\"xs\" />\n </button>\n </div>\n </div>\n </template>\n</template>\n\n<style scoped>\n.property-example {\n display: flex;\n flex-direction: column;\n font-size: var(--scalar-mini);\n position: relative;\n}\n.property-example:hover:before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 20px;\n border-radius: var(--scalar-radius);\n}\n.property-example:hover .property-example-label span {\n color: var(--scalar-color-1);\n}\n.property-example-label span {\n color: var(--scalar-color-3);\n position: relative;\n border-bottom: var(--scalar-border-width) dotted currentColor;\n}\n.property-example-value {\n font-family: var(--scalar-font-code);\n display: flex;\n gap: 8px;\n align-items: center;\n width: 100%;\n padding: 6px;\n}\n.property-example-value span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.property-example-value :deep(svg) {\n color: var(--scalar-color-3);\n}\n\n.property-example-value:hover :deep(svg) {\n color: var(--scalar-color-1);\n}\n\n.property-example-value {\n background: var(--scalar-background-2);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n}\n.property-example-value-list {\n position: absolute;\n top: 18px;\n left: 50%;\n transform: translate3d(-50%, 0, 0);\n overflow: auto;\n background-color: var(--scalar-background-1);\n box-shadow: var(--scalar-shadow-1);\n border-radius: var(--scalar-radius-lg);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 9px;\n min-width: 200px;\n max-width: 300px;\n flex-direction: column;\n gap: 3px;\n display: none;\n z-index: 2;\n}\n.property-example:hover .property-example-value-list,\n.property-example:focus-within .property-example-value-list {\n display: flex;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,EAAE,oBAAoB,cAAa;EAEzC,MAAM,mBAAmB,eAAe,UAAU,QAAA,QAAQ,CAAA;EAE1D,MAAM,qBAAqB,eAAwC;AACjE,OAAI,QAAA,YAAY,OAAO,QAAA,aAAa,SAClC,QAAO,QAAA;AAGT,UAAO,EAAC;IACT;EAED,MAAM,sBAAsB,eACpB,OAAO,KAAK,mBAAmB,MAAM,CAAC,SAAS,EACvD;EAEA,MAAM,wBAAwB,eAC5B,OAAO,KAAK,mBAAmB,MAAM,CAAC,WAAW,IAAI,YAAY,WACnE;;2DAIkB,iBAAA,SAAA,WAAA,EACd,mBAoBM,OApBN,YAoBM,CAAA,OAAA,OAAA,OAAA,KAnBJ,mBAIS,UAAA;IAHP,OAAM;IACN,MAAK;OACL,mBAAoB,QAAA,MAAd,UAAO,CAAA,EAAA,GAAA,GAEf,mBAaM,OAbN,YAaM,CAZJ,mBAWS,UAAA;IAVP,OAAM;IACN,MAAK;IACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,gBAAe,CAAC,MAAA,cAAa,CAAC,QAAA,QAAO,CAAA;OAC7C,mBAEO,QAAA,MAAA,gBADF,MAAA,cAAa,CAAC,QAAA,QAAO,CAAA,EAAA,EAAA,EAE1B,YAGc,MAAA,WAAA,EAAA;IAFZ,OAAM;IACN,MAAK;IACL,MAAK;6CAOC,oBAAA,SAAA,WAAA,EACd,mBAsBM,OAtBN,YAsBM,CArBJ,mBAMS,UANT,YAMS,CAHP,mBAEO,QAAA,MAAA,gBADF,sBAAA,MAAqB,EAAA,EAAA,CAAA,CAAA,EAG5B,mBAaM,OAbN,YAaM,EAAA,UAAA,KAAA,EAZJ,mBAWS,UAAA,MAAA,WAVa,mBAAA,QAAZ,IAAI,QAAG;wBADjB,mBAWS,UAAA;KATD;KACN,OAAM;KACN,MAAK;KACJ,UAAK,WAAE,MAAA,gBAAe,CAAC,MAAA,cAAa,CAAC,GAAE,CAAA;QACxC,mBAAqC,QAAA,MAAA,gBAA5B,MAAA,cAAa,CAAC,GAAE,CAAA,EAAA,EAAA,EACzB,YAGc,MAAA,WAAA,EAAA;KAFZ,OAAM;KACN,MAAK;KACL,MAAK"}
1
+ {"version":3,"file":"SchemaPropertyExamples.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaPropertyExamples.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { useClipboard } from '@scalar/use-hooks/useClipboard'\nimport { computed } from 'vue'\n\nimport { formatExample } from './helpers/format-example'\n\nconst { examples, example } = defineProps<{\n examples?: unknown\n example?: unknown\n}>()\n\nconst { copyToClipboard } = useClipboard()\n\nconst hasSingleExample = computed(() => isDefined(example))\n\nconst normalizedExamples = computed<Record<string, unknown>>(() => {\n if (examples && typeof examples === 'object') {\n return examples as Record<string, unknown>\n }\n\n return {}\n})\n\nconst hasMultipleExamples = computed(\n () => Object.keys(normalizedExamples.value).length > 0,\n)\n\nconst multipleExamplesLabel = computed(() =>\n Object.keys(normalizedExamples.value).length === 1 ? 'Example' : 'Examples',\n)\n</script>\n<template>\n <!-- single example (deprecated) -->\n <template v-if=\"hasSingleExample\">\n <div class=\"property-example\">\n <button\n class=\"property-example-label\"\n type=\"button\">\n <span>Example</span>\n </button>\n <div class=\"property-example-value-list\">\n <button\n class=\"property-example-value group\"\n type=\"button\"\n @click=\"copyToClipboard(formatExample(example))\">\n <span>\n {{ formatExample(example) }}\n </span>\n <ScalarIcon\n class=\"group-hover:text-c-1 text-c-3 ml-auto min-h-3 min-w-3\"\n icon=\"Clipboard\"\n size=\"xs\" />\n </button>\n </div>\n </div>\n </template>\n\n <!-- multiple examples -->\n <template v-if=\"hasMultipleExamples\">\n <div class=\"property-example\">\n <button\n class=\"property-example-label\"\n type=\"button\">\n <span>\n {{ multipleExamplesLabel }}\n </span>\n </button>\n <div class=\"property-example-value-list\">\n <button\n v-for=\"(ex, key) in normalizedExamples\"\n :key=\"key\"\n class=\"property-example-value group\"\n type=\"button\"\n @click=\"copyToClipboard(formatExample(ex))\">\n <span>{{ formatExample(ex) }} </span>\n <ScalarIcon\n class=\"text-c-3 group-hover:text-c-1 ml-auto min-h-3 min-w-3\"\n icon=\"Clipboard\"\n size=\"xs\" />\n </button>\n </div>\n </div>\n </template>\n</template>\n\n<style scoped>\n@reference \"../../../style.css\";\n\n.property-example {\n display: flex;\n flex-direction: column;\n font-size: var(--scalar-mini);\n position: relative;\n}\n.property-example:hover:before {\n content: '';\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 20px;\n border-radius: var(--scalar-radius);\n}\n.property-example:hover .property-example-label span {\n color: var(--scalar-color-1);\n}\n.property-example-label span {\n color: var(--scalar-color-3);\n position: relative;\n border-bottom: var(--scalar-border-width) dotted currentColor;\n}\n.property-example-value {\n font-family: var(--scalar-font-code);\n display: flex;\n gap: 8px;\n align-items: center;\n width: 100%;\n padding: 6px;\n}\n.property-example-value span {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n.property-example-value :deep(svg) {\n color: var(--scalar-color-3);\n}\n\n.property-example-value:hover :deep(svg) {\n color: var(--scalar-color-1);\n}\n\n.property-example-value {\n background: var(--scalar-background-2);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius);\n}\n.property-example-value-list {\n position: absolute;\n top: 18px;\n left: 50%;\n transform: translate3d(-50%, 0, 0);\n overflow: auto;\n background-color: var(--scalar-background-1);\n box-shadow: var(--scalar-shadow-1);\n border-radius: var(--scalar-radius-lg);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 9px;\n min-width: 200px;\n max-width: 300px;\n flex-direction: column;\n gap: 3px;\n display: none;\n @apply z-context;\n}\n.property-example:hover .property-example-value-list,\n.property-example:focus-within .property-example-value-list {\n display: flex;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,EAAE,oBAAoB,cAAa;EAEzC,MAAM,mBAAmB,eAAe,UAAU,QAAA,QAAQ,CAAA;EAE1D,MAAM,qBAAqB,eAAwC;AACjE,OAAI,QAAA,YAAY,OAAO,QAAA,aAAa,SAClC,QAAO,QAAA;AAGT,UAAO,EAAC;IACT;EAED,MAAM,sBAAsB,eACpB,OAAO,KAAK,mBAAmB,MAAM,CAAC,SAAS,EACvD;EAEA,MAAM,wBAAwB,eAC5B,OAAO,KAAK,mBAAmB,MAAM,CAAC,WAAW,IAAI,YAAY,WACnE;;2DAIkB,iBAAA,SAAA,WAAA,EACd,mBAoBM,OApBN,YAoBM,CAAA,OAAA,OAAA,OAAA,KAnBJ,mBAIS,UAAA;IAHP,OAAM;IACN,MAAK;OACL,mBAAoB,QAAA,MAAd,UAAO,CAAA,EAAA,GAAA,GAEf,mBAaM,OAbN,YAaM,CAZJ,mBAWS,UAAA;IAVP,OAAM;IACN,MAAK;IACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,MAAA,gBAAe,CAAC,MAAA,cAAa,CAAC,QAAA,QAAO,CAAA;OAC7C,mBAEO,QAAA,MAAA,gBADF,MAAA,cAAa,CAAC,QAAA,QAAO,CAAA,EAAA,EAAA,EAE1B,YAGc,MAAA,WAAA,EAAA;IAFZ,OAAM;IACN,MAAK;IACL,MAAK;6CAOC,oBAAA,SAAA,WAAA,EACd,mBAsBM,OAtBN,YAsBM,CArBJ,mBAMS,UANT,YAMS,CAHP,mBAEO,QAAA,MAAA,gBADF,sBAAA,MAAqB,EAAA,EAAA,CAAA,CAAA,EAG5B,mBAaM,OAbN,YAaM,EAAA,UAAA,KAAA,EAZJ,mBAWS,UAAA,MAAA,WAVa,mBAAA,QAAZ,IAAI,QAAG;wBADjB,mBAWS,UAAA;KATD;KACN,OAAM;KACN,MAAK;KACJ,UAAK,WAAE,MAAA,gBAAe,CAAC,MAAA,cAAa,CAAC,GAAE,CAAA;QACxC,mBAAqC,QAAA,MAAA,gBAA5B,MAAA,cAAa,CAAC,GAAE,CAAA,EAAA,EAAA,EACzB,YAGc,MAAA,WAAA,EAAA;KAFZ,OAAM;KACN,MAAK;KACL,MAAK"}
@@ -1 +1 @@
1
- {"version":3,"file":"ParameterListItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"names":[],"mappings":"AAkUA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEf,MAAM,8DAA8D,CAAA;AAKrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAKxE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,GAAG,cAAc,CAAA;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,IAAI,CACX,cAAc,CAAC,SAAS,CAAC,EACzB,8BAA8B,GAAG,yBAAyB,CAC3D,CAAA;CACF,CAAC;AAmYF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ParameterListItem.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"names":[],"mappings":"AA+UA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,eAAe,EACf,cAAc,EAEf,MAAM,8DAA8D,CAAA;AAKrE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAA;AAKxE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,eAAe,GAAG,cAAc,CAAA;IAC3C,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,OAAO,EAAE,IAAI,CACX,cAAc,CAAC,SAAS,CAAC,EACzB,8BAA8B,GAAG,yBAAyB,CAC3D,CAAA;CACF,CAAC;AAgZF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
2
2
  import ParameterListItem_vue_vue_type_script_setup_true_lang_default from "./ParameterListItem.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/features/Operation/components/ParameterListItem.vue
5
- var ParameterListItem_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ParameterListItem_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-f6277c9a"]]);
5
+ var ParameterListItem_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ParameterListItem_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-1f06a780"]]);
6
6
  //#endregion
7
7
  export { ParameterListItem_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"ParameterListItem.vue.js","names":[],"sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarMarkdown,\n ScalarMarkdownSummary,\n ScalarWrappingText,\n} from '@scalar/components'\nimport { ScalarIconCaretRight } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ResponseObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { getRefName } from '@/components/Content/Schema/helpers/get-ref-name'\nimport SchemaProperty from '@/components/Content/Schema/SchemaProperty.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\nimport Headers from './Headers.vue'\n\nconst { name, parameter, options, collapsableItems } = defineProps<{\n parameter: ParameterObject | ResponseObject\n name: string\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n collapsableItems?: boolean\n options: Pick<\n OperationProps['options'],\n 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Responses and params may both have a schema */\nconst schema = computed<SchemaObject | null>(() =>\n 'schema' in parameter && parameter.schema\n ? getResolvedRef(parameter.schema)\n : null,\n)\n\n/** Response and params may both have content */\nconst content = computed(() =>\n 'content' in parameter && parameter.content ? parameter.content : null,\n)\n\nconst selectedContentType = ref<string>(\n Object.keys(content.value || {})[0] ?? '',\n)\n\n/** Response headers */\nconst headers = computed<ResponseObject['headers'] | null>(() =>\n 'headers' in parameter && parameter.headers ? parameter.headers : null,\n)\n\n/** Raw schema (possibly with $ref) for the selected content type or param. */\nconst baseSchema = computed(() =>\n content.value\n ? content.value?.[selectedContentType.value]?.schema\n : 'schema' in parameter && parameter.schema\n ? parameter.schema\n : null,\n)\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(() => {\n const raw = baseSchema.value\n if (!raw) {\n return null\n }\n\n if ('$ref' in raw) {\n return getRefName(raw.$ref)\n }\n\n return null\n})\n\n/** Computed value from the combined schema param and content param */\nconst value = computed(() => {\n const base = baseSchema.value\n const resolvedBase = content.value ? getResolvedRef(base) : schema.value\n\n const deprecated =\n 'deprecated' in parameter ? parameter.deprecated : schema.value?.deprecated\n\n // Convert examples to schema examples which is an array\n const paramExamples = 'examples' in parameter ? parameter.examples : {}\n const recordExamples = Object.values({\n ...paramExamples,\n ...content.value?.[selectedContentType.value]?.examples,\n })\n\n // Only use parameter.example as fallback if no other examples exist\n const arrayExamples =\n schema.value?.examples ??\n (recordExamples.length === 0 && 'example' in parameter\n ? [parameter.example]\n : [])\n\n /** Combine param examples with content ones */\n const examples = [...recordExamples, ...arrayExamples]\n\n return {\n ...resolvedBase,\n deprecated: deprecated,\n examples,\n } as SchemaObject\n})\n\n/**\n * Determines whether this parameter item should be rendered as a collapsible disclosure.\n * Only collapses when collapsableItems is enabled and the parameter has additional\n * content to display (content types, headers, or schema details).\n */\nconst shouldCollapse = computed<boolean>(() =>\n Boolean(collapsableItems && (content.value || headers.value || schema.value)),\n)\n</script>\n<template>\n <li class=\"parameter-item group/parameter-item\">\n <Disclosure v-slot=\"{ open }\">\n <DisclosureButton\n v-if=\"shouldCollapse\"\n class=\"parameter-item-trigger\"\n :class=\"{ 'parameter-item-trigger-open': open }\">\n <div class=\"parameter-item-name min-w-0\">\n <ScalarIconCaretRight\n class=\"parameter-item-icon size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-90': open }\"\n weight=\"bold\" />\n <div>\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </div>\n </div>\n <ScalarMarkdownSummary\n v-if=\"!open && parameter.description\"\n class=\"parameter-item-description-summary min-w-0 flex-1\"\n controlled\n :value=\"parameter.description\" />\n <div\n v-else\n class=\"flex-1\" />\n </DisclosureButton>\n <div\n v-if=\"shouldCollapse && content\"\n class=\"absolute top-[calc(10px+0.5lh)] right-0 z-0 flex -translate-y-1/2 items-center text-base\"\n :class=\"{\n 'opacity-0 group-focus-within/parameter-item:opacity-100 group-hover/parameter-item:opacity-100':\n !open,\n }\">\n <div\n class=\"from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent\" />\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"content\" />\n </div>\n <DisclosurePanel\n class=\"parameter-item-container parameter-item-container-markdown\"\n :static=\"!shouldCollapse\">\n <ScalarMarkdown\n v-if=\"shouldCollapse && parameter.description\"\n class=\"parameter-item-description\"\n :value=\"parameter.description\" />\n <!-- Headers -->\n <Headers\n v-if=\"headers\"\n :breadcrumb=\"breadcrumb\"\n :eventBus=\"eventBus\"\n :headers=\"headers\"\n :orderRequiredPropertiesFirst=\"options.orderRequiredPropertiesFirst\"\n :orderSchemaPropertiesBy=\"options.orderSchemaPropertiesBy\" />\n\n <!-- Schema -->\n <SchemaProperty\n is=\"div\"\n :breadcrumb=\"breadcrumb\"\n compact\n :description=\"shouldCollapse ? '' : parameter.description\"\n :eventBus=\"eventBus\"\n :hideWriteOnly=\"true\"\n :modelName=\"schemaModelName\"\n :name=\"shouldCollapse ? '' : name\"\n :noncollapsible=\"true\"\n :options=\"{\n hideWriteOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :required=\"'required' in parameter && parameter.required\"\n :schema=\"value\" />\n </DisclosurePanel>\n </Disclosure>\n </li>\n</template>\n\n<style scoped>\n.parameter-item {\n display: flex;\n flex-direction: column;\n position: relative;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item:last-of-type .parameter-schema {\n padding-bottom: 0;\n}\n\n.parameter-item-container {\n padding: 0;\n}\n\n.parameter-item-headers {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item-name {\n position: relative;\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n overflow-wrap: break-word;\n}\n\n.parameter-item-description,\n.parameter-item-description-summary {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n}\n\n.parameter-item-description-summary.parameter-item-description-summary > * {\n --markdown-line-height: 1;\n}\n\n/* Match font size of markdown for property-detail-value since first child within accordian is displayed as if it were in the markdown section */\n.parameter-item-trigger\n ~ .parameter-item-container\n :deep(.property--level-0 > .property-heading .property-detail-value) {\n font-size: var(--scalar-micro);\n}\n\n.parameter-item-required-optional {\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n margin-right: 6px;\n position: relative;\n}\n\n.parameter-item--required {\n text-transform: uppercase;\n font-size: var(--scalar-micro);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-orange);\n}\n\n.parameter-item-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-item-description :deep(p) {\n margin-top: 4px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-schema {\n padding-bottom: 9px;\n margin-top: 3px;\n}\n\n.parameter-item-trigger {\n display: flex;\n align-items: baseline;\n line-height: var(--scalar-line-height-5);\n gap: 6px;\n flex-wrap: wrap;\n padding: 10px 0;\n outline: none;\n}\n\n.parameter-item-trigger-open {\n padding-bottom: 0;\n}\n\n.parameter-item-icon {\n color: var(--scalar-color-3);\n left: -19px;\n top: 0.5lh;\n translate: 0 -50%;\n position: absolute;\n}\n\n.parameter-item-trigger:hover .parameter-item-icon,\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n color: var(--scalar-color-1);\n}\n\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n outline: 1px solid var(--scalar-color-accent);\n outline-offset: 2px;\n border-radius: var(--scalar-radius);\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"ParameterListItem.vue.js","names":[],"sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarMarkdown,\n ScalarMarkdownSummary,\n ScalarWrappingText,\n} from '@scalar/components'\nimport { ScalarIconCaretRight } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ResponseObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { getRefName } from '@/components/Content/Schema/helpers/get-ref-name'\nimport SchemaProperty from '@/components/Content/Schema/SchemaProperty.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\nimport Headers from './Headers.vue'\n\nconst { name, parameter, options, collapsableItems } = defineProps<{\n parameter: ParameterObject | ResponseObject\n name: string\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n collapsableItems?: boolean\n options: Pick<\n OperationProps['options'],\n 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Whether the markdown summary is being truncated */\nconst truncated = ref(false)\n\n/** Responses and params may both have a schema */\nconst schema = computed<SchemaObject | null>(() =>\n 'schema' in parameter && parameter.schema\n ? getResolvedRef(parameter.schema)\n : null,\n)\n\n/** Response and params may both have content */\nconst content = computed(() => {\n if (!('content' in parameter) || !parameter.content) {\n return null\n }\n const keys = Object.keys(parameter.content)\n if (keys.length === 0) {\n return null\n }\n return parameter.content\n})\n\nconst selectedContentType = ref<string>(\n Object.keys(content.value || {})[0] ?? '',\n)\n\n/** Response headers */\nconst headers = computed<ResponseObject['headers'] | null>(() =>\n 'headers' in parameter && parameter.headers ? parameter.headers : null,\n)\n\n/** Raw schema (possibly with $ref) for the selected content type or param. */\nconst baseSchema = computed(() =>\n content.value\n ? content.value?.[selectedContentType.value]?.schema\n : 'schema' in parameter && parameter.schema\n ? parameter.schema\n : null,\n)\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(() => {\n const raw = baseSchema.value\n if (!raw) {\n return null\n }\n\n if ('$ref' in raw) {\n return getRefName(raw.$ref)\n }\n\n return null\n})\n\n/** Computed value from the combined schema param and content param */\nconst value = computed(() => {\n const base = baseSchema.value\n const resolvedBase = content.value ? getResolvedRef(base) : schema.value\n\n const deprecated =\n 'deprecated' in parameter ? parameter.deprecated : schema.value?.deprecated\n\n // Convert examples to schema examples which is an array\n const paramExamples = 'examples' in parameter ? parameter.examples : {}\n const recordExamples = Object.values({\n ...paramExamples,\n ...content.value?.[selectedContentType.value]?.examples,\n })\n\n // Only use parameter.example as fallback if no other examples exist\n const arrayExamples =\n schema.value?.examples ??\n (recordExamples.length === 0 && 'example' in parameter\n ? [parameter.example]\n : [])\n\n /** Combine param examples with content ones */\n const examples = [...recordExamples, ...arrayExamples]\n\n return {\n ...resolvedBase,\n deprecated: deprecated,\n examples,\n } as SchemaObject\n})\n\n/**\n * Determines whether this parameter item should be rendered as a collapsible disclosure.\n * Only collapses when collapsableItems is enabled and the parameter has additional\n * content to display (content types, headers, or schema details).\n */\nconst shouldCollapse = computed<boolean>(() =>\n Boolean(content.value || headers.value || schema.value || truncated.value),\n)\n</script>\n<template>\n <li class=\"parameter-item group/parameter-item\">\n <Disclosure v-slot=\"{ open }\">\n <component\n :is=\"shouldCollapse ? DisclosureButton : 'div'\"\n v-if=\"collapsableItems\"\n class=\"parameter-item-trigger\"\n :class=\"{ 'parameter-item-trigger-open': open }\">\n <div class=\"parameter-item-name min-w-0\">\n <ScalarIconCaretRight\n v-if=\"shouldCollapse\"\n class=\"parameter-item-icon size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-90': open }\"\n weight=\"bold\" />\n <div>\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </div>\n </div>\n <ScalarMarkdownSummary\n v-if=\"!open && parameter.description\"\n v-model:truncated=\"truncated\"\n class=\"parameter-item-description-summary min-w-0 flex-1\"\n controlled\n :value=\"parameter.description\" />\n <div\n v-else\n class=\"flex-1\" />\n </component>\n <div\n v-if=\"shouldCollapse && content\"\n class=\"absolute top-[calc(10px+0.5lh)] right-0 z-0 flex -translate-y-1/2 items-center text-base\"\n :class=\"{\n 'opacity-0 group-focus-within/parameter-item:opacity-100 group-hover/parameter-item:opacity-100':\n !open,\n }\">\n <div\n class=\"from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent\" />\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"content\" />\n </div>\n <DisclosurePanel\n class=\"parameter-item-container parameter-item-container-markdown\"\n :static=\"!collapsableItems\">\n <ScalarMarkdown\n v-if=\"collapsableItems && parameter.description\"\n class=\"parameter-item-description\"\n :value=\"parameter.description\" />\n <!-- Headers -->\n <Headers\n v-if=\"headers\"\n :breadcrumb=\"breadcrumb\"\n :eventBus=\"eventBus\"\n :headers=\"headers\"\n :orderRequiredPropertiesFirst=\"options.orderRequiredPropertiesFirst\"\n :orderSchemaPropertiesBy=\"options.orderSchemaPropertiesBy\" />\n\n <!-- Schema -->\n <SchemaProperty\n is=\"div\"\n :breadcrumb=\"breadcrumb\"\n compact\n :description=\"collapsableItems ? '' : parameter.description\"\n :eventBus=\"eventBus\"\n :hideWriteOnly=\"true\"\n :modelName=\"schemaModelName\"\n :name=\"collapsableItems ? '' : name\"\n :noncollapsible=\"true\"\n :options=\"{\n hideWriteOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :required=\"'required' in parameter && parameter.required\"\n :schema=\"value\" />\n </DisclosurePanel>\n </Disclosure>\n </li>\n</template>\n\n<style scoped>\n.parameter-item {\n display: flex;\n flex-direction: column;\n position: relative;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item:last-of-type .parameter-schema {\n padding-bottom: 0;\n}\n\n.parameter-item-container {\n padding: 0;\n}\n\n.parameter-item-headers {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item-name {\n position: relative;\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n overflow-wrap: break-word;\n}\n\n.parameter-item-description,\n.parameter-item-description-summary {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n}\n\n.parameter-item-description-summary.parameter-item-description-summary > * {\n --markdown-line-height: var(--scalar-line-height-5);\n}\n\n/* Match font size of markdown for property-detail-value since first child within accordian is displayed as if it were in the markdown section */\n.parameter-item-trigger\n ~ .parameter-item-container\n :deep(.property--level-0 > .property-heading .property-detail-value) {\n font-size: var(--scalar-micro);\n}\n\n.parameter-item-required-optional {\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n margin-right: 6px;\n position: relative;\n}\n\n.parameter-item--required {\n text-transform: uppercase;\n font-size: var(--scalar-micro);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-orange);\n}\n\n.parameter-item-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-item-description :deep(p) {\n margin-top: 4px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-schema {\n padding-bottom: 9px;\n margin-top: 3px;\n}\n\n.parameter-item-trigger {\n display: flex;\n align-items: baseline;\n line-height: var(--scalar-line-height-5);\n gap: 6px;\n flex-wrap: wrap;\n padding: 10px 0;\n outline: none;\n}\n\n.parameter-item-trigger-open {\n padding-bottom: 0;\n}\n\n.parameter-item-icon {\n color: var(--scalar-color-3);\n left: -19px;\n top: 0.5lh;\n translate: 0 -50%;\n position: absolute;\n}\n\n.parameter-item-trigger:hover .parameter-item-icon,\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n color: var(--scalar-color-1);\n}\n\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n outline: 1px solid var(--scalar-color-accent);\n outline-offset: 2px;\n border-radius: var(--scalar-radius);\n}\n</style>\n"],"mappings":""}
@@ -2,7 +2,7 @@ import { getRefName } from "../../../components/Content/Schema/helpers/get-ref-n
2
2
  import SchemaProperty_default from "../../../components/Content/Schema/SchemaProperty.vue.js";
3
3
  import ContentTypeSelect_default from "./ContentTypeSelect.vue.js";
4
4
  import Headers_default from "./Headers.vue.js";
5
- import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, unref, withCtx } from "vue";
5
+ import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, resolveDynamicComponent, unref, withCtx } from "vue";
6
6
  import { Disclosure, DisclosureButton, DisclosurePanel } from "@headlessui/vue";
7
7
  import { ScalarMarkdown, ScalarMarkdownSummary, ScalarWrappingText } from "@scalar/components";
8
8
  import { ScalarIconCaretRight } from "@scalar/icons";
@@ -25,10 +25,16 @@ var ParameterListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
25
25
  options: {}
26
26
  },
27
27
  setup(__props) {
28
+ /** Whether the markdown summary is being truncated */
29
+ const truncated = ref(false);
28
30
  /** Responses and params may both have a schema */
29
31
  const schema = computed(() => "schema" in __props.parameter && __props.parameter.schema ? getResolvedRef(__props.parameter.schema) : null);
30
32
  /** Response and params may both have content */
31
- const content = computed(() => "content" in __props.parameter && __props.parameter.content ? __props.parameter.content : null);
33
+ const content = computed(() => {
34
+ if (!("content" in __props.parameter) || !__props.parameter.content) return null;
35
+ if (Object.keys(__props.parameter.content).length === 0) return null;
36
+ return __props.parameter.content;
37
+ });
32
38
  const selectedContentType = ref(Object.keys(content.value || {})[0] ?? "");
33
39
  /** Response headers */
34
40
  const headers = computed(() => "headers" in __props.parameter && __props.parameter.headers ? __props.parameter.headers : null);
@@ -65,42 +71,45 @@ var ParameterListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
65
71
  * Only collapses when collapsableItems is enabled and the parameter has additional
66
72
  * content to display (content types, headers, or schema details).
67
73
  */
68
- const shouldCollapse = computed(() => Boolean(__props.collapsableItems && (content.value || headers.value || schema.value)));
74
+ const shouldCollapse = computed(() => Boolean(content.value || headers.value || schema.value || truncated.value));
69
75
  return (_ctx, _cache) => {
70
76
  return openBlock(), createElementBlock("li", _hoisted_1, [createVNode(unref(Disclosure), null, {
71
77
  default: withCtx(({ open }) => [
72
- shouldCollapse.value ? (openBlock(), createBlock(unref(DisclosureButton), {
78
+ __props.collapsableItems ? (openBlock(), createBlock(resolveDynamicComponent(shouldCollapse.value ? unref(DisclosureButton) : "div"), {
73
79
  key: 0,
74
80
  class: normalizeClass(["parameter-item-trigger", { "parameter-item-trigger-open": open }])
75
81
  }, {
76
- default: withCtx(() => [createElementVNode("div", _hoisted_2, [createVNode(unref(ScalarIconCaretRight), {
82
+ default: withCtx(() => [createElementVNode("div", _hoisted_2, [shouldCollapse.value ? (openBlock(), createBlock(unref(ScalarIconCaretRight), {
83
+ key: 0,
77
84
  class: normalizeClass(["parameter-item-icon size-3 transition-transform duration-100", { "rotate-90": open }]),
78
85
  weight: "bold"
79
- }, null, 8, ["class"]), createElementVNode("div", null, [createVNode(unref(ScalarWrappingText), {
86
+ }, null, 8, ["class"])) : createCommentVNode("", true), createElementVNode("div", null, [createVNode(unref(ScalarWrappingText), {
80
87
  preset: "property",
81
88
  text: __props.name
82
89
  }, null, 8, ["text"])])]), !open && __props.parameter.description ? (openBlock(), createBlock(unref(ScalarMarkdownSummary), {
83
90
  key: 0,
91
+ truncated: truncated.value,
92
+ "onUpdate:truncated": _cache[0] || (_cache[0] = ($event) => truncated.value = $event),
84
93
  class: "parameter-item-description-summary min-w-0 flex-1",
85
94
  controlled: "",
86
95
  value: __props.parameter.description
87
- }, null, 8, ["value"])) : (openBlock(), createElementBlock("div", _hoisted_3))]),
96
+ }, null, 8, ["truncated", "value"])) : (openBlock(), createElementBlock("div", _hoisted_3))]),
88
97
  _: 2
89
98
  }, 1032, ["class"])) : createCommentVNode("", true),
90
99
  shouldCollapse.value && content.value ? (openBlock(), createElementBlock("div", {
91
100
  key: 1,
92
101
  class: normalizeClass(["absolute top-[calc(10px+0.5lh)] right-0 z-0 flex -translate-y-1/2 items-center text-base", { "opacity-0 group-focus-within/parameter-item:opacity-100 group-hover/parameter-item:opacity-100": !open }])
93
- }, [_cache[1] || (_cache[1] = createElementVNode("div", { class: "from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent" }, null, -1)), createVNode(ContentTypeSelect_default, {
102
+ }, [_cache[2] || (_cache[2] = createElementVNode("div", { class: "from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent" }, null, -1)), createVNode(ContentTypeSelect_default, {
94
103
  modelValue: selectedContentType.value,
95
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedContentType.value = $event),
104
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedContentType.value = $event),
96
105
  content: content.value
97
106
  }, null, 8, ["modelValue", "content"])], 2)) : createCommentVNode("", true),
98
107
  createVNode(unref(DisclosurePanel), {
99
108
  class: "parameter-item-container parameter-item-container-markdown",
100
- static: !shouldCollapse.value
109
+ static: !__props.collapsableItems
101
110
  }, {
102
111
  default: withCtx(() => [
103
- shouldCollapse.value && __props.parameter.description ? (openBlock(), createBlock(unref(ScalarMarkdown), {
112
+ __props.collapsableItems && __props.parameter.description ? (openBlock(), createBlock(unref(ScalarMarkdown), {
104
113
  key: 0,
105
114
  class: "parameter-item-description",
106
115
  value: __props.parameter.description
@@ -123,11 +132,11 @@ var ParameterListItem_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
123
132
  is: "div",
124
133
  breadcrumb: __props.breadcrumb,
125
134
  compact: "",
126
- description: shouldCollapse.value ? "" : __props.parameter.description,
135
+ description: __props.collapsableItems ? "" : __props.parameter.description,
127
136
  eventBus: __props.eventBus,
128
137
  hideWriteOnly: true,
129
138
  modelName: schemaModelName.value,
130
- name: shouldCollapse.value ? "" : __props.name,
139
+ name: __props.collapsableItems ? "" : __props.name,
131
140
  noncollapsible: true,
132
141
  options: {
133
142
  hideWriteOnly: true,
@@ -1 +1 @@
1
- {"version":3,"file":"ParameterListItem.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarMarkdown,\n ScalarMarkdownSummary,\n ScalarWrappingText,\n} from '@scalar/components'\nimport { ScalarIconCaretRight } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ResponseObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { getRefName } from '@/components/Content/Schema/helpers/get-ref-name'\nimport SchemaProperty from '@/components/Content/Schema/SchemaProperty.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\nimport Headers from './Headers.vue'\n\nconst { name, parameter, options, collapsableItems } = defineProps<{\n parameter: ParameterObject | ResponseObject\n name: string\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n collapsableItems?: boolean\n options: Pick<\n OperationProps['options'],\n 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Responses and params may both have a schema */\nconst schema = computed<SchemaObject | null>(() =>\n 'schema' in parameter && parameter.schema\n ? getResolvedRef(parameter.schema)\n : null,\n)\n\n/** Response and params may both have content */\nconst content = computed(() =>\n 'content' in parameter && parameter.content ? parameter.content : null,\n)\n\nconst selectedContentType = ref<string>(\n Object.keys(content.value || {})[0] ?? '',\n)\n\n/** Response headers */\nconst headers = computed<ResponseObject['headers'] | null>(() =>\n 'headers' in parameter && parameter.headers ? parameter.headers : null,\n)\n\n/** Raw schema (possibly with $ref) for the selected content type or param. */\nconst baseSchema = computed(() =>\n content.value\n ? content.value?.[selectedContentType.value]?.schema\n : 'schema' in parameter && parameter.schema\n ? parameter.schema\n : null,\n)\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(() => {\n const raw = baseSchema.value\n if (!raw) {\n return null\n }\n\n if ('$ref' in raw) {\n return getRefName(raw.$ref)\n }\n\n return null\n})\n\n/** Computed value from the combined schema param and content param */\nconst value = computed(() => {\n const base = baseSchema.value\n const resolvedBase = content.value ? getResolvedRef(base) : schema.value\n\n const deprecated =\n 'deprecated' in parameter ? parameter.deprecated : schema.value?.deprecated\n\n // Convert examples to schema examples which is an array\n const paramExamples = 'examples' in parameter ? parameter.examples : {}\n const recordExamples = Object.values({\n ...paramExamples,\n ...content.value?.[selectedContentType.value]?.examples,\n })\n\n // Only use parameter.example as fallback if no other examples exist\n const arrayExamples =\n schema.value?.examples ??\n (recordExamples.length === 0 && 'example' in parameter\n ? [parameter.example]\n : [])\n\n /** Combine param examples with content ones */\n const examples = [...recordExamples, ...arrayExamples]\n\n return {\n ...resolvedBase,\n deprecated: deprecated,\n examples,\n } as SchemaObject\n})\n\n/**\n * Determines whether this parameter item should be rendered as a collapsible disclosure.\n * Only collapses when collapsableItems is enabled and the parameter has additional\n * content to display (content types, headers, or schema details).\n */\nconst shouldCollapse = computed<boolean>(() =>\n Boolean(collapsableItems && (content.value || headers.value || schema.value)),\n)\n</script>\n<template>\n <li class=\"parameter-item group/parameter-item\">\n <Disclosure v-slot=\"{ open }\">\n <DisclosureButton\n v-if=\"shouldCollapse\"\n class=\"parameter-item-trigger\"\n :class=\"{ 'parameter-item-trigger-open': open }\">\n <div class=\"parameter-item-name min-w-0\">\n <ScalarIconCaretRight\n class=\"parameter-item-icon size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-90': open }\"\n weight=\"bold\" />\n <div>\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </div>\n </div>\n <ScalarMarkdownSummary\n v-if=\"!open && parameter.description\"\n class=\"parameter-item-description-summary min-w-0 flex-1\"\n controlled\n :value=\"parameter.description\" />\n <div\n v-else\n class=\"flex-1\" />\n </DisclosureButton>\n <div\n v-if=\"shouldCollapse && content\"\n class=\"absolute top-[calc(10px+0.5lh)] right-0 z-0 flex -translate-y-1/2 items-center text-base\"\n :class=\"{\n 'opacity-0 group-focus-within/parameter-item:opacity-100 group-hover/parameter-item:opacity-100':\n !open,\n }\">\n <div\n class=\"from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent\" />\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"content\" />\n </div>\n <DisclosurePanel\n class=\"parameter-item-container parameter-item-container-markdown\"\n :static=\"!shouldCollapse\">\n <ScalarMarkdown\n v-if=\"shouldCollapse && parameter.description\"\n class=\"parameter-item-description\"\n :value=\"parameter.description\" />\n <!-- Headers -->\n <Headers\n v-if=\"headers\"\n :breadcrumb=\"breadcrumb\"\n :eventBus=\"eventBus\"\n :headers=\"headers\"\n :orderRequiredPropertiesFirst=\"options.orderRequiredPropertiesFirst\"\n :orderSchemaPropertiesBy=\"options.orderSchemaPropertiesBy\" />\n\n <!-- Schema -->\n <SchemaProperty\n is=\"div\"\n :breadcrumb=\"breadcrumb\"\n compact\n :description=\"shouldCollapse ? '' : parameter.description\"\n :eventBus=\"eventBus\"\n :hideWriteOnly=\"true\"\n :modelName=\"schemaModelName\"\n :name=\"shouldCollapse ? '' : name\"\n :noncollapsible=\"true\"\n :options=\"{\n hideWriteOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :required=\"'required' in parameter && parameter.required\"\n :schema=\"value\" />\n </DisclosurePanel>\n </Disclosure>\n </li>\n</template>\n\n<style scoped>\n.parameter-item {\n display: flex;\n flex-direction: column;\n position: relative;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item:last-of-type .parameter-schema {\n padding-bottom: 0;\n}\n\n.parameter-item-container {\n padding: 0;\n}\n\n.parameter-item-headers {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item-name {\n position: relative;\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n overflow-wrap: break-word;\n}\n\n.parameter-item-description,\n.parameter-item-description-summary {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n}\n\n.parameter-item-description-summary.parameter-item-description-summary > * {\n --markdown-line-height: 1;\n}\n\n/* Match font size of markdown for property-detail-value since first child within accordian is displayed as if it were in the markdown section */\n.parameter-item-trigger\n ~ .parameter-item-container\n :deep(.property--level-0 > .property-heading .property-detail-value) {\n font-size: var(--scalar-micro);\n}\n\n.parameter-item-required-optional {\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n margin-right: 6px;\n position: relative;\n}\n\n.parameter-item--required {\n text-transform: uppercase;\n font-size: var(--scalar-micro);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-orange);\n}\n\n.parameter-item-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-item-description :deep(p) {\n margin-top: 4px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-schema {\n padding-bottom: 9px;\n margin-top: 3px;\n}\n\n.parameter-item-trigger {\n display: flex;\n align-items: baseline;\n line-height: var(--scalar-line-height-5);\n gap: 6px;\n flex-wrap: wrap;\n padding: 10px 0;\n outline: none;\n}\n\n.parameter-item-trigger-open {\n padding-bottom: 0;\n}\n\n.parameter-item-icon {\n color: var(--scalar-color-3);\n left: -19px;\n top: 0.5lh;\n translate: 0 -50%;\n position: absolute;\n}\n\n.parameter-item-trigger:hover .parameter-item-icon,\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n color: var(--scalar-color-1);\n}\n\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n outline: 1px solid var(--scalar-color-accent);\n outline-offset: 2px;\n border-radius: var(--scalar-radius);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCA,MAAM,SAAS,eACb,YAAY,QAAA,aAAa,QAAA,UAAU,SAC/B,eAAe,QAAA,UAAU,OAAM,GAC/B,KACN;;EAGA,MAAM,UAAU,eACd,aAAa,QAAA,aAAa,QAAA,UAAU,UAAU,QAAA,UAAU,UAAU,KACpE;EAEA,MAAM,sBAAsB,IAC1B,OAAO,KAAK,QAAQ,SAAS,EAAE,CAAC,CAAC,MAAM,GACzC;;EAGA,MAAM,UAAU,eACd,aAAa,QAAA,aAAa,QAAA,UAAU,UAAU,QAAA,UAAU,UAAU,KACpE;;EAGA,MAAM,aAAa,eACjB,QAAQ,QACJ,QAAQ,QAAQ,oBAAoB,QAAQ,SAC5C,YAAY,QAAA,aAAa,QAAA,UAAU,SACjC,QAAA,UAAU,SACV,KACR;;EAGA,MAAM,kBAAkB,eAAe;GACrC,MAAM,MAAM,WAAW;AACvB,OAAI,CAAC,IACH,QAAO;AAGT,OAAI,UAAU,IACZ,QAAO,WAAW,IAAI,KAAI;AAG5B,UAAO;IACR;;EAGD,MAAM,QAAQ,eAAe;GAC3B,MAAM,OAAO,WAAW;GACxB,MAAM,eAAe,QAAQ,QAAQ,eAAe,KAAK,GAAG,OAAO;GAEnE,MAAM,aACJ,gBAAgB,QAAA,YAAY,QAAA,UAAU,aAAa,OAAO,OAA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A9F,OAAM,uFAAqF,EAAA,MAAA,GAAA,GAC7F,YAEuB,2BAAA;kBADZ,oBAAA;uFAAmB,QAAA;MAC3B,SAAS,QAAA;;KAEd,YAkCkB,MAAA,gBAAA,EAAA;MAjChB,OAAM;MACL,QAAM,CAAG,eAAA;;6BAIyB;OAF3B,eAAA,SAAkB,QAAA,UAAU,eAAA,WAAA,EADpC,YAGmC,MAAA,eAAA,EAAA;;QADjC,OAAM;QACL,OAAO,QAAA,UAAU;;OAGZ,QAAA,SAAA,WAAA,EADR,YAM+D,iBAAA;;QAJ5D,YAAY,QAAA;QACZ,UAAU,QAAA;QACV,SAAS,QAAA;QACT,8BAA8B,QAAA,QAAQ;QACtC,yBAAyB,QAAA,QAAQ;;;;;;;;OAGpC,YAgBoB,wBAAA;QAflB,IAAG;QACF,YAAY,QAAA;QACb,SAAA;QACC,aAAa,eAAA,QAAc,KAAQ,QAAA,UAAU;QAC7C,UAAU,QAAA;QACV,eAAe;QACf,WAAW,gBAAA;QACX,MAAM,eAAA,QAAc,KAAQ,QAAA;QAC5B,gBAAgB;QAChB,SAAO;;uCAA+E,QAAA,QAAQ;kCAAmE,QAAA,QAAQ;;QAKzK,UAAQ,cAAgB,QAAA,aAAa,QAAA,UAAU;QAC/C,QAAQ,MAAA"}
1
+ {"version":3,"file":"ParameterListItem.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/ParameterListItem.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport {\n ScalarMarkdown,\n ScalarMarkdownSummary,\n ScalarWrappingText,\n} from '@scalar/components'\nimport { ScalarIconCaretRight } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n ParameterObject,\n ResponseObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { getRefName } from '@/components/Content/Schema/helpers/get-ref-name'\nimport SchemaProperty from '@/components/Content/Schema/SchemaProperty.vue'\nimport type { OperationProps } from '@/features/Operation/Operation.vue'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\nimport Headers from './Headers.vue'\n\nconst { name, parameter, options, collapsableItems } = defineProps<{\n parameter: ParameterObject | ResponseObject\n name: string\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n collapsableItems?: boolean\n options: Pick<\n OperationProps['options'],\n 'orderRequiredPropertiesFirst' | 'orderSchemaPropertiesBy'\n >\n}>()\n\n/** Whether the markdown summary is being truncated */\nconst truncated = ref(false)\n\n/** Responses and params may both have a schema */\nconst schema = computed<SchemaObject | null>(() =>\n 'schema' in parameter && parameter.schema\n ? getResolvedRef(parameter.schema)\n : null,\n)\n\n/** Response and params may both have content */\nconst content = computed(() => {\n if (!('content' in parameter) || !parameter.content) {\n return null\n }\n const keys = Object.keys(parameter.content)\n if (keys.length === 0) {\n return null\n }\n return parameter.content\n})\n\nconst selectedContentType = ref<string>(\n Object.keys(content.value || {})[0] ?? '',\n)\n\n/** Response headers */\nconst headers = computed<ResponseObject['headers'] | null>(() =>\n 'headers' in parameter && parameter.headers ? parameter.headers : null,\n)\n\n/** Raw schema (possibly with $ref) for the selected content type or param. */\nconst baseSchema = computed(() =>\n content.value\n ? content.value?.[selectedContentType.value]?.schema\n : 'schema' in parameter && parameter.schema\n ? parameter.schema\n : null,\n)\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(() => {\n const raw = baseSchema.value\n if (!raw) {\n return null\n }\n\n if ('$ref' in raw) {\n return getRefName(raw.$ref)\n }\n\n return null\n})\n\n/** Computed value from the combined schema param and content param */\nconst value = computed(() => {\n const base = baseSchema.value\n const resolvedBase = content.value ? getResolvedRef(base) : schema.value\n\n const deprecated =\n 'deprecated' in parameter ? parameter.deprecated : schema.value?.deprecated\n\n // Convert examples to schema examples which is an array\n const paramExamples = 'examples' in parameter ? parameter.examples : {}\n const recordExamples = Object.values({\n ...paramExamples,\n ...content.value?.[selectedContentType.value]?.examples,\n })\n\n // Only use parameter.example as fallback if no other examples exist\n const arrayExamples =\n schema.value?.examples ??\n (recordExamples.length === 0 && 'example' in parameter\n ? [parameter.example]\n : [])\n\n /** Combine param examples with content ones */\n const examples = [...recordExamples, ...arrayExamples]\n\n return {\n ...resolvedBase,\n deprecated: deprecated,\n examples,\n } as SchemaObject\n})\n\n/**\n * Determines whether this parameter item should be rendered as a collapsible disclosure.\n * Only collapses when collapsableItems is enabled and the parameter has additional\n * content to display (content types, headers, or schema details).\n */\nconst shouldCollapse = computed<boolean>(() =>\n Boolean(content.value || headers.value || schema.value || truncated.value),\n)\n</script>\n<template>\n <li class=\"parameter-item group/parameter-item\">\n <Disclosure v-slot=\"{ open }\">\n <component\n :is=\"shouldCollapse ? DisclosureButton : 'div'\"\n v-if=\"collapsableItems\"\n class=\"parameter-item-trigger\"\n :class=\"{ 'parameter-item-trigger-open': open }\">\n <div class=\"parameter-item-name min-w-0\">\n <ScalarIconCaretRight\n v-if=\"shouldCollapse\"\n class=\"parameter-item-icon size-3 transition-transform duration-100\"\n :class=\"{ 'rotate-90': open }\"\n weight=\"bold\" />\n <div>\n <ScalarWrappingText\n preset=\"property\"\n :text=\"name\" />\n </div>\n </div>\n <ScalarMarkdownSummary\n v-if=\"!open && parameter.description\"\n v-model:truncated=\"truncated\"\n class=\"parameter-item-description-summary min-w-0 flex-1\"\n controlled\n :value=\"parameter.description\" />\n <div\n v-else\n class=\"flex-1\" />\n </component>\n <div\n v-if=\"shouldCollapse && content\"\n class=\"absolute top-[calc(10px+0.5lh)] right-0 z-0 flex -translate-y-1/2 items-center text-base\"\n :class=\"{\n 'opacity-0 group-focus-within/parameter-item:opacity-100 group-hover/parameter-item:opacity-100':\n !open,\n }\">\n <div\n class=\"from-b-1 absolute inset-y-0 -left-6 -z-1 w-8 bg-linear-to-l from-40% to-transparent\" />\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"content\" />\n </div>\n <DisclosurePanel\n class=\"parameter-item-container parameter-item-container-markdown\"\n :static=\"!collapsableItems\">\n <ScalarMarkdown\n v-if=\"collapsableItems && parameter.description\"\n class=\"parameter-item-description\"\n :value=\"parameter.description\" />\n <!-- Headers -->\n <Headers\n v-if=\"headers\"\n :breadcrumb=\"breadcrumb\"\n :eventBus=\"eventBus\"\n :headers=\"headers\"\n :orderRequiredPropertiesFirst=\"options.orderRequiredPropertiesFirst\"\n :orderSchemaPropertiesBy=\"options.orderSchemaPropertiesBy\" />\n\n <!-- Schema -->\n <SchemaProperty\n is=\"div\"\n :breadcrumb=\"breadcrumb\"\n compact\n :description=\"collapsableItems ? '' : parameter.description\"\n :eventBus=\"eventBus\"\n :hideWriteOnly=\"true\"\n :modelName=\"schemaModelName\"\n :name=\"collapsableItems ? '' : name\"\n :noncollapsible=\"true\"\n :options=\"{\n hideWriteOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :required=\"'required' in parameter && parameter.required\"\n :schema=\"value\" />\n </DisclosurePanel>\n </Disclosure>\n </li>\n</template>\n\n<style scoped>\n.parameter-item {\n display: flex;\n flex-direction: column;\n position: relative;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item:last-of-type .parameter-schema {\n padding-bottom: 0;\n}\n\n.parameter-item-container {\n padding: 0;\n}\n\n.parameter-item-headers {\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n\n.parameter-item-name {\n position: relative;\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n overflow-wrap: break-word;\n}\n\n.parameter-item-description,\n.parameter-item-description-summary {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n}\n\n.parameter-item-description-summary.parameter-item-description-summary > * {\n --markdown-line-height: var(--scalar-line-height-5);\n}\n\n/* Match font size of markdown for property-detail-value since first child within accordian is displayed as if it were in the markdown section */\n.parameter-item-trigger\n ~ .parameter-item-container\n :deep(.property--level-0 > .property-heading .property-detail-value) {\n font-size: var(--scalar-micro);\n}\n\n.parameter-item-required-optional {\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n margin-right: 6px;\n position: relative;\n}\n\n.parameter-item--required {\n text-transform: uppercase;\n font-size: var(--scalar-micro);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-orange);\n}\n\n.parameter-item-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-item-description :deep(p) {\n margin-top: 4px;\n font-size: var(--scalar-small);\n color: var(--scalar-color-2);\n line-height: 1.4;\n}\n\n.parameter-schema {\n padding-bottom: 9px;\n margin-top: 3px;\n}\n\n.parameter-item-trigger {\n display: flex;\n align-items: baseline;\n line-height: var(--scalar-line-height-5);\n gap: 6px;\n flex-wrap: wrap;\n padding: 10px 0;\n outline: none;\n}\n\n.parameter-item-trigger-open {\n padding-bottom: 0;\n}\n\n.parameter-item-icon {\n color: var(--scalar-color-3);\n left: -19px;\n top: 0.5lh;\n translate: 0 -50%;\n position: absolute;\n}\n\n.parameter-item-trigger:hover .parameter-item-icon,\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n color: var(--scalar-color-1);\n}\n\n.parameter-item-trigger:focus-visible .parameter-item-icon {\n outline: 1px solid var(--scalar-color-accent);\n outline-offset: 2px;\n border-radius: var(--scalar-radius);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCA,MAAM,YAAY,IAAI,MAAK;;EAG3B,MAAM,SAAS,eACb,YAAY,QAAA,aAAa,QAAA,UAAU,SAC/B,eAAe,QAAA,UAAU,OAAM,GAC/B,KACN;;EAGA,MAAM,UAAU,eAAe;AAC7B,OAAI,EAAE,aAAa,QAAA,cAAc,CAAC,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zC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"RequestBody.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Operation/components/RequestBody.vue"],"names":[],"mappings":"AAsQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8DAA8D,CAAA;AAarG,KAAK,WAAW,GAAG;IACjB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,WAAW,CAAC,EAAE,iBAAiB,CAAA;IAC/B,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,OAAO,EAAE;QACP,4BAA4B,EAAE,OAAO,GAAG,SAAS,CAAA;QACjD,uBAAuB,EAAE,OAAO,GAAG,UAAU,GAAG,SAAS,CAAA;KAC1D,CAAA;CACF,CAAC;AAqUF,QAAA,IAAI,OAAO,IAAW,CAAE;AACxB,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,OAAO,KAAK,GAAG,CAAA;CAAE,CAAC;AAK7C,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
2
2
  import RequestBody_vue_vue_type_script_setup_true_lang_default from "./RequestBody.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/features/Operation/components/RequestBody.vue
5
- var RequestBody_default = /* @__PURE__ */ _plugin_vue_export_helper_default(RequestBody_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-48eb3d5d"]]);
5
+ var RequestBody_default = /* @__PURE__ */ _plugin_vue_export_helper_default(RequestBody_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-f323f401"]]);
6
6
  //#endregion
7
7
  export { RequestBody_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"RequestBody.vue.js","names":[],"sources":["../../../../src/features/Operation/components/RequestBody.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { Schema } from '@/components/Content/Schema'\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport {\n reduceNamesToObject,\n sortPropertyNames,\n} from '@/components/Content/Schema/helpers/sort-property-names'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\n\nconst { requestBody, options } = defineProps<{\n breadcrumb?: string[]\n requestBody?: RequestBodyObject\n eventBus: WorkspaceEventBus | null\n options: {\n orderRequiredPropertiesFirst: boolean | undefined\n orderSchemaPropertiesBy: 'alpha' | 'preserve' | undefined\n }\n}>()\n\n/**\n * The maximum number of properties to show in the request body schema.\n */\nconst MAX_VISIBLE_PROPERTIES = 12\n\nconst availableContentTypes = computed(() =>\n Object.keys(requestBody?.content ?? {}),\n)\n\nconst selectedContentType = ref<string>('application/json')\n\nif (requestBody?.content) {\n if (availableContentTypes.value[0]) {\n selectedContentType.value = availableContentTypes.value[0]\n }\n}\n\nconst schema = computed(() =>\n getResolvedRef(requestBody?.content?.[selectedContentType.value]?.schema),\n)\n\n/**\n * Splits schema properties into visible and collapsed sections when there are more than 12 properties.\n * Returns null for schemas with fewer properties or non-object schemas.\n */\nconst partitionedSchema = computed(() => {\n // Early return if not an object schema\n if (!schema.value || !isTypeObject(schema.value)) {\n return null\n }\n\n // Lets sort the names first\n const sortedNames = sortPropertyNames(\n schema.value,\n schema.value.discriminator,\n {\n hideReadOnly: true,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n },\n )\n\n if (sortedNames.length <= MAX_VISIBLE_PROPERTIES) {\n return null\n }\n\n // Destructure everything except properties\n const { properties, ...schemaMetadata } = schema.value\n if (!properties) {\n return null\n }\n\n return {\n visibleProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(0, MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n collapsedProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n }\n})\n\n/**\n * We don't want to render the request body if its completely empty\n * @example\n * {\n * \"content\": {},\n * }\n */\nconst shouldRenderRequestBody = computed(\n () =>\n Object.keys(requestBody?.content ?? {}).length > 0 ||\n requestBody?.description ||\n requestBody?.required,\n)\n</script>\n<template>\n <div\n v-if=\"requestBody && shouldRenderRequestBody\"\n aria-label=\"Request Body\"\n class=\"request-body\"\n role=\"group\">\n <div class=\"request-body-header\">\n <div class=\"request-body-title\">\n <slot name=\"title\" />\n </div>\n <div class=\"flex items-center gap-2\">\n <div\n v-if=\"requestBody.required\"\n class=\"request-body-required\">\n required\n </div>\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"requestBody.content\" />\n </div>\n <div\n v-if=\"requestBody.description\"\n class=\"request-body-description\">\n <ScalarMarkdown :value=\"requestBody.description\" />\n </div>\n </div>\n\n <!-- For over 12 properties we want to show 12 and collapse the rest -->\n <div\n v-if=\"partitionedSchema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :eventBus=\"eventBus\"\n name=\"Request Body\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :compositionPath=\"['requestBody']\"\n schemaContext=\"requestBody\"\n :schema=\"partitionedSchema.visibleProperties\" />\n\n <Schema\n additionalProperties\n :breadcrumb\n compact\n :eventBus=\"eventBus\"\n name=\"Request Body\"\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :compositionPath=\"['requestBody']\"\n schemaContext=\"requestBody\"\n :schema=\"partitionedSchema.collapsedProperties\" />\n </div>\n\n <!-- Show em all 12 and under -->\n <div\n v-else-if=\"schema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :eventBus=\"eventBus\"\n :hideReadOnly=\"true\"\n name=\"Request Body\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :compositionPath=\"['requestBody']\"\n schemaContext=\"requestBody\"\n :schema=\"schema\" />\n </div>\n </div>\n</template>\n\n<style scoped>\n.request-body {\n margin-top: 24px;\n}\n.request-body-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-bottom: 12px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n flex-flow: wrap;\n}\n.request-body-title {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--scalar-font-size-2);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-1);\n}\n.request-body-required {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-orange);\n font-weight: normal;\n border-radius: 16px;\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 2px 8px;\n height: 20px;\n}\n.request-body-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n width: 100%;\n}\n\n.request-body-header\n + .request-body-schema:has(> .schema-card > .schema-card-description),\n.request-body-header\n + .request-body-schema:has(\n > .schema-card > .schema-properties > * > .property--level-0\n ) {\n /** Add a bit of space between the heading border and the schema description or properties */\n padding-top: 8px;\n}\n.request-body-description :deep(.markdown) * {\n color: var(--scalar-color-2) !important;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"RequestBody.vue.js","names":[],"sources":["../../../../src/features/Operation/components/RequestBody.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { Schema } from '@/components/Content/Schema'\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { getModelNameFromSchema } from '@/components/Content/Schema/helpers/schema-name'\nimport {\n reduceNamesToObject,\n sortPropertyNames,\n} from '@/components/Content/Schema/helpers/sort-property-names'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\n\nconst { requestBody, options } = defineProps<{\n breadcrumb?: string[]\n requestBody?: RequestBodyObject\n eventBus: WorkspaceEventBus | null\n options: {\n orderRequiredPropertiesFirst: boolean | undefined\n orderSchemaPropertiesBy: 'alpha' | 'preserve' | undefined\n }\n}>()\n\n/**\n * The maximum number of properties to show in the request body schema.\n */\nconst MAX_VISIBLE_PROPERTIES = 12\n\nconst availableContentTypes = computed(() =>\n Object.keys(requestBody?.content ?? {}),\n)\n\nconst selectedContentType = ref<string>('application/json')\n\nif (requestBody?.content) {\n if (availableContentTypes.value[0]) {\n selectedContentType.value = availableContentTypes.value[0]\n }\n}\n\n/** Raw schema (possibly with $ref) for the selected content type */\nconst rawSchema = computed(\n () => requestBody?.content?.[selectedContentType.value]?.schema,\n)\n\nconst schema = computed(() => getResolvedRef(rawSchema.value))\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(\n () => (rawSchema.value && getModelNameFromSchema(rawSchema.value)) ?? null,\n)\n\n/**\n * Splits schema properties into visible and collapsed sections when there are more than 12 properties.\n * Returns null for schemas with fewer properties or non-object schemas.\n */\nconst partitionedSchema = computed(() => {\n // Early return if not an object schema\n if (!schema.value || !isTypeObject(schema.value)) {\n return null\n }\n\n // Lets sort the names first\n const sortedNames = sortPropertyNames(\n schema.value,\n schema.value.discriminator,\n {\n hideReadOnly: true,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n },\n )\n\n if (sortedNames.length <= MAX_VISIBLE_PROPERTIES) {\n return null\n }\n\n // Destructure everything except properties\n const { properties, ...schemaMetadata } = schema.value\n if (!properties) {\n return null\n }\n\n return {\n visibleProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(0, MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n collapsedProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n }\n})\n\n/**\n * We don't want to render the request body if its completely empty\n * @example\n * {\n * \"content\": {},\n * }\n */\nconst shouldRenderRequestBody = computed(\n () =>\n Object.keys(requestBody?.content ?? {}).length > 0 ||\n requestBody?.description ||\n requestBody?.required,\n)\n</script>\n<template>\n <div\n v-if=\"requestBody && shouldRenderRequestBody\"\n aria-label=\"Request Body\"\n class=\"request-body\"\n role=\"group\">\n <div class=\"request-body-header\">\n <div class=\"request-body-title\">\n <slot name=\"title\" />\n <span\n v-if=\"schemaModelName\"\n class=\"text-c-2 text-xs leading-none font-normal\"\n data-testid=\"request-body-schema-name\">\n <span class=\"text-c-3 mx-1.5\">·</span>{{ schemaModelName }}\n </span>\n </div>\n <div class=\"flex items-center gap-2\">\n <div\n v-if=\"requestBody.required\"\n class=\"request-body-required\">\n required\n </div>\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"requestBody.content\" />\n </div>\n <div\n v-if=\"requestBody.description\"\n class=\"request-body-description\">\n <ScalarMarkdown :value=\"requestBody.description\" />\n </div>\n </div>\n\n <!-- For over 12 properties we want to show 12 and collapse the rest -->\n <div\n v-if=\"partitionedSchema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n name=\"Request Body\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :schema=\"partitionedSchema.visibleProperties\"\n schemaContext=\"requestBody\" />\n\n <Schema\n additionalProperties\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n name=\"Request Body\"\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :schema=\"partitionedSchema.collapsedProperties\"\n schemaContext=\"requestBody\" />\n </div>\n\n <!-- Show em all 12 and under -->\n <div\n v-else-if=\"schema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n :hideReadOnly=\"true\"\n name=\"Request Body\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :schema=\"schema\"\n schemaContext=\"requestBody\" />\n </div>\n </div>\n</template>\n\n<style scoped>\n.request-body {\n margin-top: 24px;\n}\n.request-body-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-bottom: 12px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n flex-flow: wrap;\n}\n.request-body-title {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--scalar-font-size-2);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-1);\n}\n.request-body-required {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-orange);\n font-weight: normal;\n border-radius: 16px;\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 2px 8px;\n height: 20px;\n}\n.request-body-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n width: 100%;\n}\n\n.request-body-header\n + .request-body-schema:has(> .schema-card > .schema-card-description),\n.request-body-header\n + .request-body-schema:has(\n > .schema-card > .schema-properties > * > .property--level-0\n ) {\n /** Add a bit of space between the heading border and the schema description or properties */\n padding-top: 8px;\n}\n.request-body-description :deep(.markdown) * {\n color: var(--scalar-color-2) !important;\n}\n</style>\n"],"mappings":""}
@@ -1,8 +1,9 @@
1
1
  import { isTypeObject } from "../../../components/Content/Schema/helpers/is-type-object.js";
2
2
  import { reduceNamesToObject, sortPropertyNames } from "../../../components/Content/Schema/helpers/sort-property-names.js";
3
+ import { getModelNameFromSchema } from "../../../components/Content/Schema/helpers/schema-name.js";
3
4
  import Schema_default from "../../../components/Content/Schema/Schema.vue.js";
4
5
  import ContentTypeSelect_default from "./ContentTypeSelect.vue.js";
5
- import { computed, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, ref, renderSlot, unref } from "vue";
6
+ import { computed, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, ref, renderSlot, toDisplayString, unref } from "vue";
6
7
  import { ScalarMarkdown } from "@scalar/components";
7
8
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
8
9
  //#region src/features/Operation/components/RequestBody.vue?vue&type=script&setup=true&lang.ts
@@ -14,20 +15,25 @@ var _hoisted_1 = {
14
15
  };
15
16
  var _hoisted_2 = { class: "request-body-header" };
16
17
  var _hoisted_3 = { class: "request-body-title" };
17
- var _hoisted_4 = { class: "flex items-center gap-2" };
18
- var _hoisted_5 = {
18
+ var _hoisted_4 = {
19
19
  key: 0,
20
- class: "request-body-required"
20
+ class: "text-c-2 text-xs leading-none font-normal",
21
+ "data-testid": "request-body-schema-name"
21
22
  };
23
+ var _hoisted_5 = { class: "flex items-center gap-2" };
22
24
  var _hoisted_6 = {
23
25
  key: 0,
24
- class: "request-body-description"
26
+ class: "request-body-required"
25
27
  };
26
28
  var _hoisted_7 = {
27
29
  key: 0,
28
- class: "request-body-schema"
30
+ class: "request-body-description"
29
31
  };
30
32
  var _hoisted_8 = {
33
+ key: 0,
34
+ class: "request-body-schema"
35
+ };
36
+ var _hoisted_9 = {
31
37
  key: 1,
32
38
  class: "request-body-schema"
33
39
  };
@@ -49,7 +55,11 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
49
55
  if (__props.requestBody?.content) {
50
56
  if (availableContentTypes.value[0]) selectedContentType.value = availableContentTypes.value[0];
51
57
  }
52
- const schema = computed(() => getResolvedRef(__props.requestBody?.content?.[selectedContentType.value]?.schema));
58
+ /** Raw schema (possibly with $ref) for the selected content type */
59
+ const rawSchema = computed(() => __props.requestBody?.content?.[selectedContentType.value]?.schema);
60
+ const schema = computed(() => getResolvedRef(rawSchema.value));
61
+ /** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */
62
+ const schemaModelName = computed(() => (rawSchema.value && getModelNameFromSchema(rawSchema.value)) ?? null);
53
63
  /**
54
64
  * Splits schema properties into visible and collapsed sections when there are more than 12 properties.
55
65
  * Returns null for schemas with fewer properties or non-object schemas.
@@ -85,16 +95,17 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
85
95
  const shouldRenderRequestBody = computed(() => Object.keys(__props.requestBody?.content ?? {}).length > 0 || __props.requestBody?.description || __props.requestBody?.required);
86
96
  return (_ctx, _cache) => {
87
97
  return __props.requestBody && shouldRenderRequestBody.value ? (openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [
88
- createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "title", {}, void 0, true)]),
89
- createElementVNode("div", _hoisted_4, [__props.requestBody.required ? (openBlock(), createElementBlock("div", _hoisted_5, " required ")) : createCommentVNode("", true), createVNode(ContentTypeSelect_default, {
98
+ createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "title", {}, void 0, true), schemaModelName.value ? (openBlock(), createElementBlock("span", _hoisted_4, [_cache[1] || (_cache[1] = createElementVNode("span", { class: "text-c-3 mx-1.5" }, "·", -1)), createTextVNode(toDisplayString(schemaModelName.value), 1)])) : createCommentVNode("", true)]),
99
+ createElementVNode("div", _hoisted_5, [__props.requestBody.required ? (openBlock(), createElementBlock("div", _hoisted_6, " required ")) : createCommentVNode("", true), createVNode(ContentTypeSelect_default, {
90
100
  modelValue: selectedContentType.value,
91
101
  "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedContentType.value = $event),
92
102
  content: __props.requestBody.content
93
103
  }, null, 8, ["modelValue", "content"])]),
94
- __props.requestBody.description ? (openBlock(), createElementBlock("div", _hoisted_6, [createVNode(unref(ScalarMarkdown), { value: __props.requestBody.description }, null, 8, ["value"])])) : createCommentVNode("", true)
95
- ]), partitionedSchema.value ? (openBlock(), createElementBlock("div", _hoisted_7, [createVNode(unref(Schema_default), {
104
+ __props.requestBody.description ? (openBlock(), createElementBlock("div", _hoisted_7, [createVNode(unref(ScalarMarkdown), { value: __props.requestBody.description }, null, 8, ["value"])])) : createCommentVNode("", true)
105
+ ]), partitionedSchema.value ? (openBlock(), createElementBlock("div", _hoisted_8, [createVNode(unref(Schema_default), {
96
106
  breadcrumb: __props.breadcrumb,
97
107
  compact: "",
108
+ compositionPath: ["requestBody"],
98
109
  eventBus: __props.eventBus,
99
110
  name: "Request Body",
100
111
  noncollapsible: "",
@@ -103,9 +114,8 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
103
114
  orderRequiredPropertiesFirst: __props.options.orderRequiredPropertiesFirst,
104
115
  orderSchemaPropertiesBy: __props.options.orderSchemaPropertiesBy
105
116
  },
106
- compositionPath: ["requestBody"],
107
- schemaContext: "requestBody",
108
- schema: partitionedSchema.value.visibleProperties
117
+ schema: partitionedSchema.value.visibleProperties,
118
+ schemaContext: "requestBody"
109
119
  }, null, 8, [
110
120
  "breadcrumb",
111
121
  "eventBus",
@@ -115,6 +125,7 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
115
125
  additionalProperties: "",
116
126
  breadcrumb: __props.breadcrumb,
117
127
  compact: "",
128
+ compositionPath: ["requestBody"],
118
129
  eventBus: __props.eventBus,
119
130
  name: "Request Body",
120
131
  options: {
@@ -122,17 +133,17 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
122
133
  orderRequiredPropertiesFirst: __props.options.orderRequiredPropertiesFirst,
123
134
  orderSchemaPropertiesBy: __props.options.orderSchemaPropertiesBy
124
135
  },
125
- compositionPath: ["requestBody"],
126
- schemaContext: "requestBody",
127
- schema: partitionedSchema.value.collapsedProperties
136
+ schema: partitionedSchema.value.collapsedProperties,
137
+ schemaContext: "requestBody"
128
138
  }, null, 8, [
129
139
  "breadcrumb",
130
140
  "eventBus",
131
141
  "options",
132
142
  "schema"
133
- ])])) : schema.value ? (openBlock(), createElementBlock("div", _hoisted_8, [createVNode(unref(Schema_default), {
143
+ ])])) : schema.value ? (openBlock(), createElementBlock("div", _hoisted_9, [createVNode(unref(Schema_default), {
134
144
  breadcrumb: __props.breadcrumb,
135
145
  compact: "",
146
+ compositionPath: ["requestBody"],
136
147
  eventBus: __props.eventBus,
137
148
  hideReadOnly: true,
138
149
  name: "Request Body",
@@ -142,9 +153,8 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
142
153
  orderRequiredPropertiesFirst: __props.options.orderRequiredPropertiesFirst,
143
154
  orderSchemaPropertiesBy: __props.options.orderSchemaPropertiesBy
144
155
  },
145
- compositionPath: ["requestBody"],
146
- schemaContext: "requestBody",
147
- schema: schema.value
156
+ schema: schema.value,
157
+ schemaContext: "requestBody"
148
158
  }, null, 8, [
149
159
  "breadcrumb",
150
160
  "eventBus",
@@ -1 +1 @@
1
- {"version":3,"file":"RequestBody.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/RequestBody.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { Schema } from '@/components/Content/Schema'\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport {\n reduceNamesToObject,\n sortPropertyNames,\n} from '@/components/Content/Schema/helpers/sort-property-names'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\n\nconst { requestBody, options } = defineProps<{\n breadcrumb?: string[]\n requestBody?: RequestBodyObject\n eventBus: WorkspaceEventBus | null\n options: {\n orderRequiredPropertiesFirst: boolean | undefined\n orderSchemaPropertiesBy: 'alpha' | 'preserve' | undefined\n }\n}>()\n\n/**\n * The maximum number of properties to show in the request body schema.\n */\nconst MAX_VISIBLE_PROPERTIES = 12\n\nconst availableContentTypes = computed(() =>\n Object.keys(requestBody?.content ?? {}),\n)\n\nconst selectedContentType = ref<string>('application/json')\n\nif (requestBody?.content) {\n if (availableContentTypes.value[0]) {\n selectedContentType.value = availableContentTypes.value[0]\n }\n}\n\nconst schema = computed(() =>\n getResolvedRef(requestBody?.content?.[selectedContentType.value]?.schema),\n)\n\n/**\n * Splits schema properties into visible and collapsed sections when there are more than 12 properties.\n * Returns null for schemas with fewer properties or non-object schemas.\n */\nconst partitionedSchema = computed(() => {\n // Early return if not an object schema\n if (!schema.value || !isTypeObject(schema.value)) {\n return null\n }\n\n // Lets sort the names first\n const sortedNames = sortPropertyNames(\n schema.value,\n schema.value.discriminator,\n {\n hideReadOnly: true,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n },\n )\n\n if (sortedNames.length <= MAX_VISIBLE_PROPERTIES) {\n return null\n }\n\n // Destructure everything except properties\n const { properties, ...schemaMetadata } = schema.value\n if (!properties) {\n return null\n }\n\n return {\n visibleProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(0, MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n collapsedProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n }\n})\n\n/**\n * We don't want to render the request body if its completely empty\n * @example\n * {\n * \"content\": {},\n * }\n */\nconst shouldRenderRequestBody = computed(\n () =>\n Object.keys(requestBody?.content ?? {}).length > 0 ||\n requestBody?.description ||\n requestBody?.required,\n)\n</script>\n<template>\n <div\n v-if=\"requestBody && shouldRenderRequestBody\"\n aria-label=\"Request Body\"\n class=\"request-body\"\n role=\"group\">\n <div class=\"request-body-header\">\n <div class=\"request-body-title\">\n <slot name=\"title\" />\n </div>\n <div class=\"flex items-center gap-2\">\n <div\n v-if=\"requestBody.required\"\n class=\"request-body-required\">\n required\n </div>\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"requestBody.content\" />\n </div>\n <div\n v-if=\"requestBody.description\"\n class=\"request-body-description\">\n <ScalarMarkdown :value=\"requestBody.description\" />\n </div>\n </div>\n\n <!-- For over 12 properties we want to show 12 and collapse the rest -->\n <div\n v-if=\"partitionedSchema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :eventBus=\"eventBus\"\n name=\"Request Body\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :compositionPath=\"['requestBody']\"\n schemaContext=\"requestBody\"\n :schema=\"partitionedSchema.visibleProperties\" />\n\n <Schema\n additionalProperties\n :breadcrumb\n compact\n :eventBus=\"eventBus\"\n name=\"Request Body\"\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :compositionPath=\"['requestBody']\"\n schemaContext=\"requestBody\"\n :schema=\"partitionedSchema.collapsedProperties\" />\n </div>\n\n <!-- Show em all 12 and under -->\n <div\n v-else-if=\"schema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :eventBus=\"eventBus\"\n :hideReadOnly=\"true\"\n name=\"Request Body\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :compositionPath=\"['requestBody']\"\n schemaContext=\"requestBody\"\n :schema=\"schema\" />\n </div>\n </div>\n</template>\n\n<style scoped>\n.request-body {\n margin-top: 24px;\n}\n.request-body-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-bottom: 12px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n flex-flow: wrap;\n}\n.request-body-title {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--scalar-font-size-2);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-1);\n}\n.request-body-required {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-orange);\n font-weight: normal;\n border-radius: 16px;\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 2px 8px;\n height: 20px;\n}\n.request-body-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n width: 100%;\n}\n\n.request-body-header\n + .request-body-schema:has(> .schema-card > .schema-card-description),\n.request-body-header\n + .request-body-schema:has(\n > .schema-card > .schema-properties > * > .property--level-0\n ) {\n /** Add a bit of space between the heading border and the schema description or properties */\n padding-top: 8px;\n}\n.request-body-description :deep(.markdown) * {\n color: var(--scalar-color-2) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,IAAM,yBAAyB;;;;;;;;;;;;;EAE/B,MAAM,wBAAwB,eAC5B,OAAO,KAAK,QAAA,aAAa,WAAW,EAAE,CAAC,CACzC;EAEA,MAAM,sBAAsB,IAAY,mBAAkB;AAE1D,MAAI,QAAA,aAAa;OACX,sBAAsB,MAAM,GAC9B,qBAAoB,QAAQ,sBAAsB,MAAM;;EAI5D,MAAM,SAAS,eACb,eAAe,QAAA,aAAa,UAAU,oBAAoB,QAAQ,OAAO,CAC3E;;;;;EAMA,MAAM,oBAAoB,eAAe;AAEvC,OAAI,CAAC,OAAO,SAAS,CAAC,aAAa,OAAO,MAAM,CAC9C,QAAO;GAIT,MAAM,cAAc,kBAClB,OAAO,OACP,OAAO,MAAM,eACb;IACE,cAAc;IACd,yBAAyB,QAAA,QAAQ;IACjC,8BAA8B,QAAA,QAAQ;IACvC,CACH;AAEA,OAAI,YAAY,UAAU,uBACxB,QAAO;GAIT,MAAM,EAAE,YAAY,GAAG,mBAAmB,OAAO;AACjD,OAAI,CAAC,WACH,QAAO;AAGT,UAAO;IACL,mBAAmB;KACjB,GAAG;KACH,YAAY,oBACV,YAAY,MAAM,GAAG,uBAAuB,EAC5C,WACD;KACF;IACD,qBAAqB;KACnB,GAAG;KACH,YAAY,oBACV,YAAY,MAAM,uBAAuB,EACzC,WACD;KACF;IACH;IACD;;;;;;;;EASD,MAAM,0BAA0B,eAE5B,OAAO,KAAK,QAAA,aAAa,WAAW,EAAE,CAAC,CAAC,SAAS,KACjD,QAAA,aAAa,eACb,QAAA,aAAa,SACjB;;UAIU,QAAA,eAAe,wBAAA,SAAA,WAAA,EADvB,mBAiFM,OAjFN,YAiFM,CA5EJ,mBAmBM,OAnBN,YAmBM;IAlBJ,mBAEM,OAFN,YAEM,CAD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b,QAAQ,OAAA"}
1
+ {"version":3,"file":"RequestBody.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/RequestBody.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type { RequestBodyObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport { Schema } from '@/components/Content/Schema'\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { getModelNameFromSchema } from '@/components/Content/Schema/helpers/schema-name'\nimport {\n reduceNamesToObject,\n sortPropertyNames,\n} from '@/components/Content/Schema/helpers/sort-property-names'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\n\nconst { requestBody, options } = defineProps<{\n breadcrumb?: string[]\n requestBody?: RequestBodyObject\n eventBus: WorkspaceEventBus | null\n options: {\n orderRequiredPropertiesFirst: boolean | undefined\n orderSchemaPropertiesBy: 'alpha' | 'preserve' | undefined\n }\n}>()\n\n/**\n * The maximum number of properties to show in the request body schema.\n */\nconst MAX_VISIBLE_PROPERTIES = 12\n\nconst availableContentTypes = computed(() =>\n Object.keys(requestBody?.content ?? {}),\n)\n\nconst selectedContentType = ref<string>('application/json')\n\nif (requestBody?.content) {\n if (availableContentTypes.value[0]) {\n selectedContentType.value = availableContentTypes.value[0]\n }\n}\n\n/** Raw schema (possibly with $ref) for the selected content type */\nconst rawSchema = computed(\n () => requestBody?.content?.[selectedContentType.value]?.schema,\n)\n\nconst schema = computed(() => getResolvedRef(rawSchema.value))\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst schemaModelName = computed(\n () => (rawSchema.value && getModelNameFromSchema(rawSchema.value)) ?? null,\n)\n\n/**\n * Splits schema properties into visible and collapsed sections when there are more than 12 properties.\n * Returns null for schemas with fewer properties or non-object schemas.\n */\nconst partitionedSchema = computed(() => {\n // Early return if not an object schema\n if (!schema.value || !isTypeObject(schema.value)) {\n return null\n }\n\n // Lets sort the names first\n const sortedNames = sortPropertyNames(\n schema.value,\n schema.value.discriminator,\n {\n hideReadOnly: true,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n },\n )\n\n if (sortedNames.length <= MAX_VISIBLE_PROPERTIES) {\n return null\n }\n\n // Destructure everything except properties\n const { properties, ...schemaMetadata } = schema.value\n if (!properties) {\n return null\n }\n\n return {\n visibleProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(0, MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n collapsedProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n }\n})\n\n/**\n * We don't want to render the request body if its completely empty\n * @example\n * {\n * \"content\": {},\n * }\n */\nconst shouldRenderRequestBody = computed(\n () =>\n Object.keys(requestBody?.content ?? {}).length > 0 ||\n requestBody?.description ||\n requestBody?.required,\n)\n</script>\n<template>\n <div\n v-if=\"requestBody && shouldRenderRequestBody\"\n aria-label=\"Request Body\"\n class=\"request-body\"\n role=\"group\">\n <div class=\"request-body-header\">\n <div class=\"request-body-title\">\n <slot name=\"title\" />\n <span\n v-if=\"schemaModelName\"\n class=\"text-c-2 text-xs leading-none font-normal\"\n data-testid=\"request-body-schema-name\">\n <span class=\"text-c-3 mx-1.5\">·</span>{{ schemaModelName }}\n </span>\n </div>\n <div class=\"flex items-center gap-2\">\n <div\n v-if=\"requestBody.required\"\n class=\"request-body-required\">\n required\n </div>\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"requestBody.content\" />\n </div>\n <div\n v-if=\"requestBody.description\"\n class=\"request-body-description\">\n <ScalarMarkdown :value=\"requestBody.description\" />\n </div>\n </div>\n\n <!-- For over 12 properties we want to show 12 and collapse the rest -->\n <div\n v-if=\"partitionedSchema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n name=\"Request Body\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :schema=\"partitionedSchema.visibleProperties\"\n schemaContext=\"requestBody\" />\n\n <Schema\n additionalProperties\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n name=\"Request Body\"\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :schema=\"partitionedSchema.collapsedProperties\"\n schemaContext=\"requestBody\" />\n </div>\n\n <!-- Show em all 12 and under -->\n <div\n v-else-if=\"schema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n :hideReadOnly=\"true\"\n name=\"Request Body\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n }\"\n :schema=\"schema\"\n schemaContext=\"requestBody\" />\n </div>\n </div>\n</template>\n\n<style scoped>\n.request-body {\n margin-top: 24px;\n}\n.request-body-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-bottom: 12px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n flex-flow: wrap;\n}\n.request-body-title {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--scalar-font-size-2);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-1);\n}\n.request-body-required {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-orange);\n font-weight: normal;\n border-radius: 16px;\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 2px 8px;\n height: 20px;\n}\n.request-body-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n width: 100%;\n}\n\n.request-body-header\n + .request-body-schema:has(> .schema-card > .schema-card-description),\n.request-body-header\n + .request-body-schema:has(\n > .schema-card > .schema-properties > * > .property--level-0\n ) {\n /** Add a bit of space between the heading border and the schema description or properties */\n padding-top: 8px;\n}\n.request-body-description :deep(.markdown) * {\n color: var(--scalar-color-2) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAM,yBAAyB;;;;;;;;;;;;;EAE/B,MAAM,wBAAwB,eAC5B,OAAO,KAAK,QAAA,aAAa,WAAW,EAAE,CAAC,CACzC;EAEA,MAAM,sBAAsB,IAAY,mBAAkB;AAE1D,MAAI,QAAA,aAAa;OACX,sBAAsB,MAAM,GAC9B,qBAAoB,QAAQ,sBAAsB,MAAM;;;EAK5D,MAAM,YAAY,eACV,QAAA,aAAa,UAAU,oBAAoB,QAAQ,OAC3D;EAEA,MAAM,SAAS,eAAe,eAAe,UAAU,MAAM,CAAA;;EAG7D,MAAM,kBAAkB,gBACf,UAAU,SAAS,uBAAuB,UAAU,MAAM,KAAK,KACxE;;;;;EAMA,MAAM,oBAAoB,eAAe;AAEvC,OAAI,CAAC,OAAO,SAAS,CAAC,aAAa,OAAO,MAAM,CAC9C,QAAO;GAIT,MAAM,cAAc,kBAClB,OAAO,OACP,OAAO,MAAM,eACb;IACE,cAAc;IACd,yBAAyB,QAAA,QAAQ;IACjC,8BAA8B,QAAA,QAAQ;IACvC,CACH;AAEA,OAAI,YAAY,UAAU,uBACxB,QAAO;GAIT,MAAM,EAAE,YAAY,GAAG,mBAAmB,OAAO;AACjD,OAAI,CAAC,WACH,QAAO;AAGT,UAAO;IACL,mBAAmB;KACjB,GAAG;KACH,YAAY,oBACV,YAAY,MAAM,GAAG,uBAAuB,EAC5C,WACD;KACF;IACD,qBAAqB;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AQ;;IAKlK,QAAQ,kBAAA,MAAkB;IAC3B,eAAc;;;;;;OAEhB,YAagC,MAAA,eAAA,EAAA;IAZ9B,sBAAA;IACC,YAAA,QAAA;IACD,SAAA;IACC,iBAAiB,CAAA,cAAe;IAChC,UAAU,QAAA;IACX,MAAK;IACJ,SAAO;;mCAA0E,QAAA,QAAQ;8BAAiE,QAAA,QAAQ;;IAKlK,QAAQ,kBAAA,MAAkB;IAC3B,eAAc;;;;;;WAKL,OAAA,SAAA,WAAA,EADb,mBAkBM,OAlBN,YAkBM,CAfJ,YAcgC,MAAA,eAAA,EAAA;IAb7B,YAAA,QAAA;IACD,SAAA;IACC,iBAAiB,CAAA,cAAe;IAChC,UAAU,QAAA;IACV,cAAc;IACf,MAAK;IACL,gBAAA;IACC,SAAO;;mCAA0E,QAAA,QAAQ;8BAAiE,QAAA,QAAQ;;IAKlK,QAAQ,OAAA;IACT,eAAc"}
@@ -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,CA+CnD"}
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,CAiDnD"}
@@ -16,6 +16,10 @@ function createFuseInstance() {
16
16
  name: "description",
17
17
  weight: .3
18
18
  },
19
+ {
20
+ name: "parameters",
21
+ weight: .2
22
+ },
19
23
  {
20
24
  name: "body",
21
25
  weight: .2
@@ -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 // 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
+ {"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 - parameters are searchable but they can be very long and noisy\n { name: 'parameters', weight: 0.2 },\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;IAAc,QAAQ;IAAK;GAEnC;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,4 +1,4 @@
1
- import { createParameterMap, extractRequestBody } from "../../../helpers/openapi.js";
1
+ import { extractParameters, extractRequestBody } from "../../../helpers/openapi.js";
2
2
  import { combineParams } from "@scalar/workspace-store/request-example";
3
3
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
4
4
  //#region src/features/Search/helpers/create-search-index.ts
@@ -59,8 +59,8 @@ function addEntryToIndex(entry, index, document) {
59
59
  ...operation,
60
60
  parameters: combineParams(pathItem?.parameters, operation.parameters)
61
61
  };
62
- const requestBodyOrParameterMap = extractRequestBody(operationWithPathParams) || createParameterMap(operationWithPathParams);
63
- const body = typeof requestBodyOrParameterMap !== "boolean" ? requestBodyOrParameterMap : null;
62
+ const parameters = extractParameters(operationWithPathParams.parameters ?? []);
63
+ const body = extractRequestBody(operationWithPathParams);
64
64
  const responseExamples = extractResponseExamples(operationWithPathParams.responses);
65
65
  index.push({
66
66
  type: "operation",
@@ -70,6 +70,7 @@ function addEntryToIndex(entry, index, document) {
70
70
  method: entry.method,
71
71
  path: entry.path,
72
72
  body: body || "",
73
+ parameters: parameters ?? "",
73
74
  responseExamples,
74
75
  operationId: operationWithPathParams.operationId,
75
76
  entry