@scalar/api-reference 1.49.4 → 1.49.5

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 (112) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/browser/standalone.js +2309 -45729
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/AgentScalar/AgentScalarChatInterface.vue.d.ts +2 -1
  5. package/dist/components/AgentScalar/AgentScalarChatInterface.vue.d.ts.map +1 -1
  6. package/dist/components/AgentScalar/AgentScalarChatInterface.vue.js.map +1 -1
  7. package/dist/components/AgentScalar/AgentScalarChatInterface.vue.script.js +6 -4
  8. package/dist/components/AgentScalar/AgentScalarChatInterface.vue.script.js.map +1 -1
  9. package/dist/components/AgentScalar/AgentScalarDrawer.vue.d.ts +2 -3
  10. package/dist/components/AgentScalar/AgentScalarDrawer.vue.d.ts.map +1 -1
  11. package/dist/components/AgentScalar/AgentScalarDrawer.vue.js +1 -1
  12. package/dist/components/AgentScalar/AgentScalarDrawer.vue.js.map +1 -1
  13. package/dist/components/AgentScalar/AgentScalarDrawer.vue.script.js +4 -2
  14. package/dist/components/AgentScalar/AgentScalarDrawer.vue.script.js.map +1 -1
  15. package/dist/components/AgentScalar/OpenMCPButton.vue.d.ts +2 -0
  16. package/dist/components/AgentScalar/OpenMCPButton.vue.d.ts.map +1 -1
  17. package/dist/components/AgentScalar/OpenMCPButton.vue.js +1 -1
  18. package/dist/components/AgentScalar/OpenMCPButton.vue.js.map +1 -1
  19. package/dist/components/AgentScalar/OpenMCPButton.vue.script.js +5 -5
  20. package/dist/components/AgentScalar/OpenMCPButton.vue.script.js.map +1 -1
  21. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  22. package/dist/components/ApiReference.vue.js +1 -1
  23. package/dist/components/ApiReference.vue.js.map +1 -1
  24. package/dist/components/ApiReference.vue.script.js +6 -0
  25. package/dist/components/ApiReference.vue.script.js.map +1 -1
  26. package/dist/components/Content/Schema/Schema.vue.d.ts +4 -0
  27. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  28. package/dist/components/Content/Schema/Schema.vue.js +1 -1
  29. package/dist/components/Content/Schema/Schema.vue.js.map +1 -1
  30. package/dist/components/Content/Schema/Schema.vue.script.js +15 -5
  31. package/dist/components/Content/Schema/Schema.vue.script.js.map +1 -1
  32. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts +4 -0
  33. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
  34. package/dist/components/Content/Schema/SchemaComposition.vue.js.map +1 -1
  35. package/dist/components/Content/Schema/SchemaComposition.vue.script.js +33 -3
  36. package/dist/components/Content/Schema/SchemaComposition.vue.script.js.map +1 -1
  37. package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts +2 -0
  38. package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts.map +1 -1
  39. package/dist/components/Content/Schema/SchemaObjectProperties.vue.js.map +1 -1
  40. package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js +25 -5
  41. package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js.map +1 -1
  42. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +6 -0
  43. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  44. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  45. package/dist/components/Content/Schema/SchemaProperty.vue.js.map +1 -1
  46. package/dist/components/Content/Schema/SchemaProperty.vue.script.js +20 -3
  47. package/dist/components/Content/Schema/SchemaProperty.vue.script.js.map +1 -1
  48. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  49. package/dist/features/Operation/components/RequestBody.vue.js +1 -1
  50. package/dist/features/Operation/components/RequestBody.vue.js.map +1 -1
  51. package/dist/features/Operation/components/RequestBody.vue.script.js +6 -0
  52. package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
  53. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  54. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  55. package/dist/features/Operation/layouts/ClassicLayout.vue.js.map +1 -1
  56. package/dist/features/Operation/layouts/ClassicLayout.vue.script.js +16 -5
  57. package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
  58. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  59. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  60. package/dist/features/Operation/layouts/ModernLayout.vue.js.map +1 -1
  61. package/dist/features/Operation/layouts/ModernLayout.vue.script.js +16 -5
  62. package/dist/features/Operation/layouts/ModernLayout.vue.script.js.map +1 -1
  63. package/dist/features/Operation/request-body-composition-index.d.ts +8 -0
  64. package/dist/features/Operation/request-body-composition-index.d.ts.map +1 -0
  65. package/dist/features/Operation/request-body-composition-index.js +10 -0
  66. package/dist/features/Operation/request-body-composition-index.js.map +1 -0
  67. package/dist/features/developer-tools/DeveloperTools.vue.d.ts +2 -1
  68. package/dist/features/developer-tools/DeveloperTools.vue.d.ts.map +1 -1
  69. package/dist/features/developer-tools/DeveloperTools.vue.js.map +1 -1
  70. package/dist/features/developer-tools/DeveloperTools.vue.script.js +9 -2
  71. package/dist/features/developer-tools/DeveloperTools.vue.script.js.map +1 -1
  72. package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.d.ts +2 -0
  73. package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.d.ts.map +1 -1
  74. package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.js.map +1 -1
  75. package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.script.js +3 -3
  76. package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.script.js.map +1 -1
  77. package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.d.ts +2 -0
  78. package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.d.ts.map +1 -1
  79. package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.js.map +1 -1
  80. package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.script.js +9 -3
  81. package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.script.js.map +1 -1
  82. package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.d.ts +2 -0
  83. package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.d.ts.map +1 -1
  84. package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.js.map +1 -1
  85. package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.script.js +6 -4
  86. package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.script.js.map +1 -1
  87. package/dist/features/developer-tools/components/DeployApiReference.vue.d.ts +2 -0
  88. package/dist/features/developer-tools/components/DeployApiReference.vue.d.ts.map +1 -1
  89. package/dist/features/developer-tools/components/DeployApiReference.vue.js.map +1 -1
  90. package/dist/features/developer-tools/components/DeployApiReference.vue.script.js +8 -2
  91. package/dist/features/developer-tools/components/DeployApiReference.vue.script.js.map +1 -1
  92. package/dist/features/developer-tools/components/ShareApiReference.vue.d.ts +2 -0
  93. package/dist/features/developer-tools/components/ShareApiReference.vue.d.ts.map +1 -1
  94. package/dist/features/developer-tools/components/ShareApiReference.vue.js.map +1 -1
  95. package/dist/features/developer-tools/components/ShareApiReference.vue.script.js +8 -2
  96. package/dist/features/developer-tools/components/ShareApiReference.vue.script.js.map +1 -1
  97. package/dist/features/test-request-button/TestRequestButton.vue.d.ts +1 -0
  98. package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
  99. package/dist/features/test-request-button/TestRequestButton.vue.js +1 -1
  100. package/dist/features/test-request-button/TestRequestButton.vue.js.map +1 -1
  101. package/dist/features/test-request-button/TestRequestButton.vue.script.js +4 -2
  102. package/dist/features/test-request-button/TestRequestButton.vue.script.js.map +1 -1
  103. package/dist/helpers/upload-temp-document.d.ts +2 -1
  104. package/dist/helpers/upload-temp-document.d.ts.map +1 -1
  105. package/dist/helpers/upload-temp-document.js +3 -3
  106. package/dist/helpers/upload-temp-document.js.map +1 -1
  107. package/dist/style.css +175 -175
  108. package/package.json +13 -13
  109. package/dist/consts/urls.d.ts +0 -13
  110. package/dist/consts/urls.d.ts.map +0 -1
  111. package/dist/consts/urls.js +0 -17
  112. package/dist/consts/urls.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.vue.js","names":[],"sources":["../../../../src/components/Content/Schema/Schema.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarIcon, ScalarMarkdown } from '@scalar/components'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\nimport ScreenReader from '@/components/ScreenReader.vue'\n\nimport { isEmptySchemaObject } from './helpers/is-empty-schema-object'\nimport { isTypeObject } from './helpers/is-type-object'\nimport SchemaHeading from './SchemaHeading.vue'\nimport SchemaObjectProperties from './SchemaObjectProperties.vue'\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst {\n schema,\n level = 0,\n name,\n compact,\n noncollapsible = false,\n hideHeading,\n additionalProperties,\n discriminator,\n breadcrumb,\n hideModelNames = false,\n options,\n} = defineProps<{\n schema?: SchemaObject\n /** Track how deep we've gone */\n level?: number\n /* Show as a heading */\n name?: string\n /** A tighter layout with less borders and without a heading */\n compact?: boolean\n /** Shows a toggle to hide/show children */\n noncollapsible?: boolean\n /** Hide the heading */\n hideHeading?: boolean\n /** Show a special one way toggle for additional properties, also has a top border when open */\n additionalProperties?: boolean\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Discriminator object */\n discriminator?: DiscriminatorObject\n /** Breadcrumb for the schema */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into a single prop so they are easy to pass around */\n options: SchemaOptions\n}>()\n\n/**\n * Determines whether to show the collapse/expand toggle button.\n * We hide the toggle for non-collapsible schemas and root-level schemas.\n */\nconst shouldShowToggle = computed((): boolean => {\n return !noncollapsible && level > 0\n})\n\n/** Gets the description to show for the schema */\nconst schemaDescription = computed(() => {\n // For the request body we want to show the base description or the first allOf schema description\n if (schema?.allOf && schema.allOf.length > 0 && name === 'Request Body') {\n return schema.description || schema.allOf[0]?.description || null\n }\n\n // Don't show description if there's no description or it's not a string\n if (!schema?.description || typeof schema.description !== 'string') {\n return null\n }\n\n // Don't show description if the schema has other composition keywords\n // This prevents duplicate descriptions when individual schemas are part of compositions\n if (schema.oneOf || schema.anyOf) {\n return null\n }\n\n // Don't show description for enum schemas (they have special handling)\n if (schema.enum) {\n return null\n }\n\n // Will be shown in the properties anyway\n if (\n !('properties' in schema) &&\n !('patternProperties' in schema) &&\n !('additionalProperties' in schema)\n ) {\n return null\n }\n\n // Return the schema's own description\n return schema.description\n})\n\n// Prevent click action if noncollapsible\nconst handleClick = (e: MouseEvent) => noncollapsible && e.stopPropagation()\n</script>\n<template>\n <Disclosure\n v-if=\"typeof schema === 'object' && Object.keys(schema).length\"\n v-slot=\"{ open }\"\n :defaultOpen=\"noncollapsible\">\n <div\n class=\"schema-card\"\n :class=\"[\n `schema-card--level-${level}`,\n { 'schema-card--compact': compact, 'schema-card--open': open },\n { 'border-t': additionalProperties && open },\n ]\">\n <!-- Schema description -->\n <div\n v-if=\"schemaDescription\"\n class=\"schema-card-description\">\n <ScalarMarkdown :value=\"schemaDescription\" />\n </div>\n <div\n v-if=\"isEmptySchemaObject(schema)\"\n class=\"pt-2\">\n Empty object\n </div>\n <div\n class=\"schema-properties\"\n :class=\"{\n 'schema-properties-open': open,\n }\">\n <!-- Toggle to collapse/expand long lists of properties -->\n <div\n v-if=\"additionalProperties\"\n v-show=\"!open\"\n class=\"schema-properties\">\n <DisclosureButton\n as=\"button\"\n class=\"schema-card-title schema-card-title--compact\"\n @click.capture=\"handleClick\">\n <ScalarIcon\n class=\"schema-card-title-icon\"\n icon=\"Add\"\n size=\"sm\" />\n Show additional properties\n <ScreenReader v-if=\"name\">for {{ name }}</ScreenReader>\n </DisclosureButton>\n </div>\n\n <DisclosureButton\n v-else-if=\"shouldShowToggle\"\n v-show=\"!hideHeading && !(noncollapsible && compact)\"\n :as=\"noncollapsible ? 'div' : 'button'\"\n class=\"schema-card-title\"\n :class=\"{ 'schema-card-title--compact': compact }\"\n :style=\"{\n top: `calc(var(--refs-viewport-offset) + calc(var(--schema-title-height) * ${level}))`,\n }\"\n @click.capture=\"handleClick\">\n <template v-if=\"compact\">\n <ScalarIcon\n class=\"schema-card-title-icon\"\n :class=\"{ 'schema-card-title-icon--open': open }\"\n icon=\"Add\"\n size=\"sm\" />\n <template v-if=\"open\">\n Hide {{ schema?.title ?? 'Child Attributes' }}\n </template>\n <template v-else>\n Show {{ schema?.title ?? 'Child Attributes' }}\n </template>\n <ScreenReader v-if=\"name\">for {{ name }}</ScreenReader>\n </template>\n <template v-else>\n <ScalarIcon\n class=\"schema-card-title-icon\"\n :class=\"{ 'schema-card-title-icon--open': open }\"\n icon=\"Add\"\n size=\"sm\" />\n <SchemaHeading\n :name=\"schema?.title ?? name\"\n :value=\"schema\" />\n </template>\n </DisclosureButton>\n <DisclosurePanel\n v-if=\"!additionalProperties || open\"\n as=\"ul\"\n :static=\"!shouldShowToggle\">\n <!-- Object properties -->\n <SchemaObjectProperties\n v-if=\"isTypeObject(schema)\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level=\"level + 1\"\n :options\n :schema />\n <!-- Not an object -->\n <template v-else>\n <SchemaProperty\n v-if=\"schema\"\n :breadcrumb\n :compact\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :options\n :schema />\n </template>\n </DisclosurePanel>\n </div>\n </div>\n </Disclosure>\n</template>\n<style scoped>\n.error {\n background-color: var(--scalar-color-red);\n}\n.schema-card {\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-1);\n}\n.schema-card-title {\n height: var(--schema-title-height);\n\n padding: 6px 8px;\n\n display: flex;\n align-items: center;\n gap: 4px;\n\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-mini);\n border-bottom: var(--scalar-border-width) solid transparent;\n}\nbutton.schema-card-title {\n cursor: pointer;\n}\nbutton.schema-card-title:hover {\n color: var(--scalar-color-1);\n}\n.schema-card-title-icon--open {\n transform: rotate(45deg);\n}\n.schema-properties-open > .schema-card-title {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-properties-open > .schema-properties {\n width: fit-content;\n}\n.schema-card-description {\n color: var(--scalar-color-2);\n}\n.schema-card-description + .schema-properties {\n width: fit-content;\n}\n.schema-card-description + .schema-properties {\n margin-top: 8px;\n}\n.schema-card--level-0:nth-of-type(1)\n > .schema-card-description:has(+ .schema-properties) {\n margin-bottom: -8px;\n padding-bottom: 8px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-card--level-0\n ~ .schema-card--level-0\n > .schema-card-description:has(+ .schema-properties) {\n padding-top: 8px;\n}\n\n.schema-properties-open.schema-properties,\n.schema-properties-open > .schema-card--open {\n width: 100%;\n}\n.schema-properties {\n display: flex;\n flex-direction: column;\n\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n width: fit-content;\n}\n.schema-properties-name {\n width: 100%;\n}\n.schema-properties .schema-properties {\n border-radius: 13.5px;\n}\n.schema-properties .schema-properties.schema-properties-open {\n border-radius: var(--scalar-radius-lg);\n}\n.schema-properties-open {\n width: 100%;\n}\n.schema-card--compact {\n align-self: flex-start;\n}\n.schema-card--compact.schema-card--open {\n align-self: initial;\n}\n.schema-card-title--compact {\n color: var(--scalar-color-2);\n padding: 6px 10px 6px 8px;\n height: auto;\n border-bottom: none;\n}\n.schema-card-title--compact > .schema-card-title-icon {\n margin: 0;\n}\n.schema-card-title--compact > .schema-card-title-icon--open {\n transform: rotate(45deg);\n}\n.schema-properties-open > .schema-card-title--compact {\n position: static;\n}\n.property--level-0\n > .schema-properties\n > .schema-card--level-0\n > .schema-properties {\n border: none;\n}\n.property--level-0\n .schema-card--level-0:not(.schema-card--compact)\n .property--level-1 {\n padding: 0 0 8px;\n}\n:not(.composition-panel)\n > .schema-card--compact.schema-card--level-0\n > .schema-properties {\n border: none;\n}\n:deep(.schema-card-description) p {\n font-size: var(--scalar-small, var(--scalar-paragraph));\n color: var(--scalar-color-2);\n line-height: 1.5;\n margin-bottom: 0;\n display: block;\n margin-bottom: 6px;\n}\n.children .schema-card-description:first-of-type {\n padding-top: 0;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"Schema.vue.js","names":[],"sources":["../../../../src/components/Content/Schema/Schema.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarIcon, ScalarMarkdown } from '@scalar/components'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\nimport ScreenReader from '@/components/ScreenReader.vue'\n\nimport { isEmptySchemaObject } from './helpers/is-empty-schema-object'\nimport { isTypeObject } from './helpers/is-type-object'\nimport SchemaHeading from './SchemaHeading.vue'\nimport SchemaObjectProperties from './SchemaObjectProperties.vue'\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst {\n schema,\n level = 0,\n name,\n compact,\n noncollapsible = false,\n hideHeading,\n additionalProperties,\n discriminator,\n breadcrumb,\n hideModelNames = false,\n options,\n schemaContext,\n compositionPath,\n} = defineProps<{\n schema?: SchemaObject\n /** Track how deep we've gone */\n level?: number\n /* Show as a heading */\n name?: string\n /** A tighter layout with less borders and without a heading */\n compact?: boolean\n /** Shows a toggle to hide/show children */\n noncollapsible?: boolean\n /** Hide the heading */\n hideHeading?: boolean\n /** Show a special one way toggle for additional properties, also has a top border when open */\n additionalProperties?: boolean\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Discriminator object */\n discriminator?: DiscriminatorObject\n /** Breadcrumb for the schema */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into a single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", composition dropdown selection is synced with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n}>()\n\n/**\n * Determines whether to show the collapse/expand toggle button.\n * We hide the toggle for non-collapsible schemas and root-level schemas.\n */\nconst shouldShowToggle = computed((): boolean => {\n return !noncollapsible && level > 0\n})\n\n/** Gets the description to show for the schema */\nconst schemaDescription = computed(() => {\n // For the request body we want to show the base description or the first allOf schema description\n if (schema?.allOf && schema.allOf.length > 0 && name === 'Request Body') {\n return schema.description || schema.allOf[0]?.description || null\n }\n\n // Don't show description if there's no description or it's not a string\n if (!schema?.description || typeof schema.description !== 'string') {\n return null\n }\n\n // Don't show description if the schema has other composition keywords\n // This prevents duplicate descriptions when individual schemas are part of compositions\n if (schema.oneOf || schema.anyOf) {\n return null\n }\n\n // Don't show description for enum schemas (they have special handling)\n if (schema.enum) {\n return null\n }\n\n // Will be shown in the properties anyway\n if (\n !('properties' in schema) &&\n !('patternProperties' in schema) &&\n !('additionalProperties' in schema)\n ) {\n return null\n }\n\n // Return the schema's own description\n return schema.description\n})\n\n// Prevent click action if noncollapsible\nconst handleClick = (e: MouseEvent) => noncollapsible && e.stopPropagation()\n</script>\n<template>\n <Disclosure\n v-if=\"typeof schema === 'object' && Object.keys(schema).length\"\n v-slot=\"{ open }\"\n :defaultOpen=\"noncollapsible\">\n <div\n class=\"schema-card\"\n :class=\"[\n `schema-card--level-${level}`,\n { 'schema-card--compact': compact, 'schema-card--open': open },\n { 'border-t': additionalProperties && open },\n ]\">\n <!-- Schema description -->\n <div\n v-if=\"schemaDescription\"\n class=\"schema-card-description\">\n <ScalarMarkdown :value=\"schemaDescription\" />\n </div>\n <div\n v-if=\"isEmptySchemaObject(schema)\"\n class=\"pt-2\">\n Empty object\n </div>\n <div\n class=\"schema-properties\"\n :class=\"{\n 'schema-properties-open': open,\n }\">\n <!-- Toggle to collapse/expand long lists of properties -->\n <div\n v-if=\"additionalProperties\"\n v-show=\"!open\"\n class=\"schema-properties\">\n <DisclosureButton\n as=\"button\"\n class=\"schema-card-title schema-card-title--compact\"\n @click.capture=\"handleClick\">\n <ScalarIcon\n class=\"schema-card-title-icon\"\n icon=\"Add\"\n size=\"sm\" />\n Show additional properties\n <ScreenReader v-if=\"name\">for {{ name }}</ScreenReader>\n </DisclosureButton>\n </div>\n\n <DisclosureButton\n v-else-if=\"shouldShowToggle\"\n v-show=\"!hideHeading && !(noncollapsible && compact)\"\n :as=\"noncollapsible ? 'div' : 'button'\"\n class=\"schema-card-title\"\n :class=\"{ 'schema-card-title--compact': compact }\"\n :style=\"{\n top: `calc(var(--refs-viewport-offset) + calc(var(--schema-title-height) * ${level}))`,\n }\"\n @click.capture=\"handleClick\">\n <template v-if=\"compact\">\n <ScalarIcon\n class=\"schema-card-title-icon\"\n :class=\"{ 'schema-card-title-icon--open': open }\"\n icon=\"Add\"\n size=\"sm\" />\n <template v-if=\"open\">\n Hide {{ schema?.title ?? 'Child Attributes' }}\n </template>\n <template v-else>\n Show {{ schema?.title ?? 'Child Attributes' }}\n </template>\n <ScreenReader v-if=\"name\">for {{ name }}</ScreenReader>\n </template>\n <template v-else>\n <ScalarIcon\n class=\"schema-card-title-icon\"\n :class=\"{ 'schema-card-title-icon--open': open }\"\n icon=\"Add\"\n size=\"sm\" />\n <SchemaHeading\n :name=\"schema?.title ?? name\"\n :value=\"schema\" />\n </template>\n </DisclosureButton>\n <DisclosurePanel\n v-if=\"!additionalProperties || open\"\n as=\"ul\"\n :static=\"!shouldShowToggle\">\n <!-- Object properties -->\n <SchemaObjectProperties\n v-if=\"isTypeObject(schema)\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level=\"level + 1\"\n :options\n :schema\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\" />\n <!-- Not an object -->\n <template v-else>\n <SchemaProperty\n v-if=\"schema\"\n :breadcrumb\n :compact\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :options\n :schema\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\" />\n </template>\n </DisclosurePanel>\n </div>\n </div>\n </Disclosure>\n</template>\n<style scoped>\n.error {\n background-color: var(--scalar-color-red);\n}\n.schema-card {\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-1);\n}\n.schema-card-title {\n height: var(--schema-title-height);\n\n padding: 6px 8px;\n\n display: flex;\n align-items: center;\n gap: 4px;\n\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-mini);\n border-bottom: var(--scalar-border-width) solid transparent;\n}\nbutton.schema-card-title {\n cursor: pointer;\n}\nbutton.schema-card-title:hover {\n color: var(--scalar-color-1);\n}\n.schema-card-title-icon--open {\n transform: rotate(45deg);\n}\n.schema-properties-open > .schema-card-title {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-properties-open > .schema-properties {\n width: fit-content;\n}\n.schema-card-description {\n color: var(--scalar-color-2);\n}\n.schema-card-description + .schema-properties {\n width: fit-content;\n}\n.schema-card-description + .schema-properties {\n margin-top: 8px;\n}\n.schema-card--level-0:nth-of-type(1)\n > .schema-card-description:has(+ .schema-properties) {\n margin-bottom: -8px;\n padding-bottom: 8px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-card--level-0\n ~ .schema-card--level-0\n > .schema-card-description:has(+ .schema-properties) {\n padding-top: 8px;\n}\n\n.schema-properties-open.schema-properties,\n.schema-properties-open > .schema-card--open {\n width: 100%;\n}\n.schema-properties {\n display: flex;\n flex-direction: column;\n\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n width: fit-content;\n}\n.schema-properties-name {\n width: 100%;\n}\n.schema-properties .schema-properties {\n border-radius: 13.5px;\n}\n.schema-properties .schema-properties.schema-properties-open {\n border-radius: var(--scalar-radius-lg);\n}\n.schema-properties-open {\n width: 100%;\n}\n.schema-card--compact {\n align-self: flex-start;\n}\n.schema-card--compact.schema-card--open {\n align-self: initial;\n}\n.schema-card-title--compact {\n color: var(--scalar-color-2);\n padding: 6px 10px 6px 8px;\n height: auto;\n border-bottom: none;\n}\n.schema-card-title--compact > .schema-card-title-icon {\n margin: 0;\n}\n.schema-card-title--compact > .schema-card-title-icon--open {\n transform: rotate(45deg);\n}\n.schema-properties-open > .schema-card-title--compact {\n position: static;\n}\n.property--level-0\n > .schema-properties\n > .schema-card--level-0\n > .schema-properties {\n border: none;\n}\n.property--level-0\n .schema-card--level-0:not(.schema-card--compact)\n .property--level-1 {\n padding: 0 0 8px;\n}\n:not(.composition-panel)\n > .schema-card--compact.schema-card--level-0\n > .schema-properties {\n border: none;\n}\n:deep(.schema-card-description) p {\n font-size: var(--scalar-small, var(--scalar-paragraph));\n color: var(--scalar-color-2);\n line-height: 1.5;\n margin-bottom: 0;\n display: block;\n margin-bottom: 6px;\n}\n.children .schema-card-description:first-of-type {\n padding-top: 0;\n}\n</style>\n"],"mappings":""}
@@ -40,7 +40,9 @@ var Schema_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
40
40
  discriminator: {},
41
41
  breadcrumb: {},
42
42
  eventBus: {},
43
- options: {}
43
+ options: {},
44
+ schemaContext: {},
45
+ compositionPath: {}
44
46
  },
45
47
  setup(__props) {
46
48
  /**
@@ -139,7 +141,9 @@ var Schema_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
139
141
  hideModelNames: __props.hideModelNames,
140
142
  level: __props.level + 1,
141
143
  options: __props.options,
142
- schema: __props.schema
144
+ schema: __props.schema,
145
+ compositionPath: __props.compositionPath,
146
+ schemaContext: __props.schemaContext
143
147
  }, null, 8, [
144
148
  "breadcrumb",
145
149
  "compact",
@@ -149,7 +153,9 @@ var Schema_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
149
153
  "hideModelNames",
150
154
  "level",
151
155
  "options",
152
- "schema"
156
+ "schema",
157
+ "compositionPath",
158
+ "schemaContext"
153
159
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [__props.schema ? (openBlock(), createBlock(SchemaProperty_default, {
154
160
  key: 0,
155
161
  breadcrumb: __props.breadcrumb,
@@ -159,7 +165,9 @@ var Schema_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
159
165
  hideModelNames: __props.hideModelNames,
160
166
  level: __props.level,
161
167
  options: __props.options,
162
- schema: __props.schema
168
+ schema: __props.schema,
169
+ compositionPath: __props.compositionPath,
170
+ schemaContext: __props.schemaContext
163
171
  }, null, 8, [
164
172
  "breadcrumb",
165
173
  "compact",
@@ -168,7 +176,9 @@ var Schema_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
168
176
  "hideModelNames",
169
177
  "level",
170
178
  "options",
171
- "schema"
179
+ "schema",
180
+ "compositionPath",
181
+ "schemaContext"
172
182
  ])) : createCommentVNode("", true)], 64))]),
173
183
  _: 1
174
184
  }, 8, ["static"])) : createCommentVNode("", true)], 2)
@@ -1 +1 @@
1
- {"version":3,"file":"Schema.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/Schema.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarIcon, ScalarMarkdown } from '@scalar/components'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\nimport ScreenReader from '@/components/ScreenReader.vue'\n\nimport { isEmptySchemaObject } from './helpers/is-empty-schema-object'\nimport { isTypeObject } from './helpers/is-type-object'\nimport SchemaHeading from './SchemaHeading.vue'\nimport SchemaObjectProperties from './SchemaObjectProperties.vue'\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst {\n schema,\n level = 0,\n name,\n compact,\n noncollapsible = false,\n hideHeading,\n additionalProperties,\n discriminator,\n breadcrumb,\n hideModelNames = false,\n options,\n} = defineProps<{\n schema?: SchemaObject\n /** Track how deep we've gone */\n level?: number\n /* Show as a heading */\n name?: string\n /** A tighter layout with less borders and without a heading */\n compact?: boolean\n /** Shows a toggle to hide/show children */\n noncollapsible?: boolean\n /** Hide the heading */\n hideHeading?: boolean\n /** Show a special one way toggle for additional properties, also has a top border when open */\n additionalProperties?: boolean\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Discriminator object */\n discriminator?: DiscriminatorObject\n /** Breadcrumb for the schema */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into a single prop so they are easy to pass around */\n options: SchemaOptions\n}>()\n\n/**\n * Determines whether to show the collapse/expand toggle button.\n * We hide the toggle for non-collapsible schemas and root-level schemas.\n */\nconst shouldShowToggle = computed((): boolean => {\n return !noncollapsible && level > 0\n})\n\n/** Gets the description to show for the schema */\nconst schemaDescription = computed(() => {\n // For the request body we want to show the base description or the first allOf schema description\n if (schema?.allOf && schema.allOf.length > 0 && name === 'Request Body') {\n return schema.description || schema.allOf[0]?.description || null\n }\n\n // Don't show description if there's no description or it's not a string\n if (!schema?.description || typeof schema.description !== 'string') {\n return null\n }\n\n // Don't show description if the schema has other composition keywords\n // This prevents duplicate descriptions when individual schemas are part of compositions\n if (schema.oneOf || schema.anyOf) {\n return null\n }\n\n // Don't show description for enum schemas (they have special handling)\n if (schema.enum) {\n return null\n }\n\n // Will be shown in the properties anyway\n if (\n !('properties' in schema) &&\n !('patternProperties' in schema) &&\n !('additionalProperties' in schema)\n ) {\n return null\n }\n\n // Return the schema's own description\n return schema.description\n})\n\n// Prevent click action if noncollapsible\nconst handleClick = (e: MouseEvent) => noncollapsible && e.stopPropagation()\n</script>\n<template>\n <Disclosure\n v-if=\"typeof schema === 'object' && Object.keys(schema).length\"\n v-slot=\"{ open }\"\n :defaultOpen=\"noncollapsible\">\n <div\n class=\"schema-card\"\n :class=\"[\n `schema-card--level-${level}`,\n { 'schema-card--compact': compact, 'schema-card--open': open },\n { 'border-t': additionalProperties && open },\n ]\">\n <!-- Schema description -->\n <div\n v-if=\"schemaDescription\"\n class=\"schema-card-description\">\n <ScalarMarkdown :value=\"schemaDescription\" />\n </div>\n <div\n v-if=\"isEmptySchemaObject(schema)\"\n class=\"pt-2\">\n Empty object\n </div>\n <div\n class=\"schema-properties\"\n :class=\"{\n 'schema-properties-open': open,\n }\">\n <!-- Toggle to collapse/expand long lists of properties -->\n <div\n v-if=\"additionalProperties\"\n v-show=\"!open\"\n class=\"schema-properties\">\n <DisclosureButton\n as=\"button\"\n class=\"schema-card-title schema-card-title--compact\"\n @click.capture=\"handleClick\">\n <ScalarIcon\n class=\"schema-card-title-icon\"\n icon=\"Add\"\n size=\"sm\" />\n Show additional properties\n <ScreenReader v-if=\"name\">for {{ name }}</ScreenReader>\n </DisclosureButton>\n </div>\n\n <DisclosureButton\n v-else-if=\"shouldShowToggle\"\n v-show=\"!hideHeading && !(noncollapsible && compact)\"\n :as=\"noncollapsible ? 'div' : 'button'\"\n class=\"schema-card-title\"\n :class=\"{ 'schema-card-title--compact': compact }\"\n :style=\"{\n top: `calc(var(--refs-viewport-offset) + calc(var(--schema-title-height) * ${level}))`,\n }\"\n @click.capture=\"handleClick\">\n <template v-if=\"compact\">\n <ScalarIcon\n class=\"schema-card-title-icon\"\n :class=\"{ 'schema-card-title-icon--open': open }\"\n icon=\"Add\"\n size=\"sm\" />\n <template v-if=\"open\">\n Hide {{ schema?.title ?? 'Child Attributes' }}\n </template>\n <template v-else>\n Show {{ schema?.title ?? 'Child Attributes' }}\n </template>\n <ScreenReader v-if=\"name\">for {{ name }}</ScreenReader>\n </template>\n <template v-else>\n <ScalarIcon\n class=\"schema-card-title-icon\"\n :class=\"{ 'schema-card-title-icon--open': open }\"\n icon=\"Add\"\n size=\"sm\" />\n <SchemaHeading\n :name=\"schema?.title ?? name\"\n :value=\"schema\" />\n </template>\n </DisclosureButton>\n <DisclosurePanel\n v-if=\"!additionalProperties || open\"\n as=\"ul\"\n :static=\"!shouldShowToggle\">\n <!-- Object properties -->\n <SchemaObjectProperties\n v-if=\"isTypeObject(schema)\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level=\"level + 1\"\n :options\n :schema />\n <!-- Not an object -->\n <template v-else>\n <SchemaProperty\n v-if=\"schema\"\n :breadcrumb\n :compact\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :options\n :schema />\n </template>\n </DisclosurePanel>\n </div>\n </div>\n </Disclosure>\n</template>\n<style scoped>\n.error {\n background-color: var(--scalar-color-red);\n}\n.schema-card {\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-1);\n}\n.schema-card-title {\n height: var(--schema-title-height);\n\n padding: 6px 8px;\n\n display: flex;\n align-items: center;\n gap: 4px;\n\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-mini);\n border-bottom: var(--scalar-border-width) solid transparent;\n}\nbutton.schema-card-title {\n cursor: pointer;\n}\nbutton.schema-card-title:hover {\n color: var(--scalar-color-1);\n}\n.schema-card-title-icon--open {\n transform: rotate(45deg);\n}\n.schema-properties-open > .schema-card-title {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-properties-open > .schema-properties {\n width: fit-content;\n}\n.schema-card-description {\n color: var(--scalar-color-2);\n}\n.schema-card-description + .schema-properties {\n width: fit-content;\n}\n.schema-card-description + .schema-properties {\n margin-top: 8px;\n}\n.schema-card--level-0:nth-of-type(1)\n > .schema-card-description:has(+ .schema-properties) {\n margin-bottom: -8px;\n padding-bottom: 8px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-card--level-0\n ~ .schema-card--level-0\n > .schema-card-description:has(+ .schema-properties) {\n padding-top: 8px;\n}\n\n.schema-properties-open.schema-properties,\n.schema-properties-open > .schema-card--open {\n width: 100%;\n}\n.schema-properties {\n display: flex;\n flex-direction: column;\n\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n width: fit-content;\n}\n.schema-properties-name {\n width: 100%;\n}\n.schema-properties .schema-properties {\n border-radius: 13.5px;\n}\n.schema-properties .schema-properties.schema-properties-open {\n border-radius: var(--scalar-radius-lg);\n}\n.schema-properties-open {\n width: 100%;\n}\n.schema-card--compact {\n align-self: flex-start;\n}\n.schema-card--compact.schema-card--open {\n align-self: initial;\n}\n.schema-card-title--compact {\n color: var(--scalar-color-2);\n padding: 6px 10px 6px 8px;\n height: auto;\n border-bottom: none;\n}\n.schema-card-title--compact > .schema-card-title-icon {\n margin: 0;\n}\n.schema-card-title--compact > .schema-card-title-icon--open {\n transform: rotate(45deg);\n}\n.schema-properties-open > .schema-card-title--compact {\n position: static;\n}\n.property--level-0\n > .schema-properties\n > .schema-card--level-0\n > .schema-properties {\n border: none;\n}\n.property--level-0\n .schema-card--level-0:not(.schema-card--compact)\n .property--level-1 {\n padding: 0 0 8px;\n}\n:not(.composition-panel)\n > .schema-card--compact.schema-card--level-0\n > .schema-properties {\n border: none;\n}\n:deep(.schema-card-description) p {\n font-size: var(--scalar-small, var(--scalar-paragraph));\n color: var(--scalar-color-2);\n line-height: 1.5;\n margin-bottom: 0;\n display: block;\n margin-bottom: 6px;\n}\n.children .schema-card-description:first-of-type {\n padding-top: 0;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6DA,MAAM,mBAAmB,eAAwB;AAC/C,UAAO,CAAC,QAAA,kBAAkB,QAAA,QAAQ;IACnC;;EAGD,MAAM,oBAAoB,eAAe;AAEvC,OAAI,QAAA,QAAQ,SAAS,QAAA,OAAO,MAAM,SAAS,KAAK,QAAA,SAAS,eACvD,QAAO,QAAA,OAAO,eAAe,QAAA,OAAO,MAAM,IAAI,eAAe;AAI/D,OAAI,CAAC,QAAA,QAAQ,eAAe,OAAO,QAAA,OAAO,gBAAgB,SACxD,QAAO;AAKT,OAAI,QAAA,OAAO,SAAS,QAAA,OAAO,MACzB,QAAO;AAIT,OAAI,QAAA,OAAO,KACT,QAAO;AAIT,OACE,EAAE,gBAAgB,QAAA,WAClB,EAAE,uBAAuB,QAAA,WACzB,EAAE,0BAA0B,QAAA,QAE5B,QAAO;AAIT,UAAO,QAAA,OAAO;IACf;EAGD,MAAM,eAAe,MAAkB,QAAA,kBAAkB,EAAE,iBAAgB;;iBAI1D,QAAA,WAAM,YAAiB,OAAO,KAAK,QAAA,OAAM,CAAE,UAAA,WAAA,EAD1D,YAgHa,MAAA,WAAA,EAAA;;IA7GV,aAAa,QAAA;;sBA4GR,EA7GI,WAAI,CAEd,mBA2GM,OAAA,EA1GJ,OAAK,eAAA,CAAC,eAAa;2BACqB,QAAA;;8BAA2C,QAAA;MAAO,qBAAuB;MAAI;mBAA0B,QAAA,wBAAwB,MAAI;;KAOnK,kBAAA,SAAA,WAAA,EADR,mBAIM,OAJN,YAIM,CADJ,YAA6C,MAAA,eAAA,EAAA,EAA5B,OAAO,kBAAA,OAAiB,EAAA,MAAA,GAAA,CAAA,QAAA,CAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;KAGn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A,gBAFM,WACV,gBAAG,QAAA,QAAQ,SAAK,mBAAA,EAAA,EAAA,CAAA,EAAA,GAAA;OAEH,QAAA,QAAA,WAAA,EAApB,YAAuD,sBAAA,EAAA,KAAA,GAAA,EAAA;+BAAzB,CAAA,gBAAJ,SAAI,gBAAG,QAAA,KAAI,EAAA,EAAA,CAAA,CAAA;;;8BAEvC,mBASW,UAAA,EAAA,KAAA,GAAA,EAAA,CART,YAIc,MAAA,WAAA,EAAA;OAHZ,OAAK,eAAA,CAAC,0BAAwB,EAAA,gCACY,MAAI,CAAA,CAAA;OAC9C,MAAK;OACL,MAAK;8BACP,YAEoB,uBAAA;OADjB,MAAM,QAAA,QAAQ,SAAS,QAAA;OACvB,OAAO,QAAA;;;;;;;oBA9BH,QAAA,eAAW,EAAM,QAAA,kBAAkB,QAAA,SAAO,CAAA,CAAA,GAAA,mBAAA,IAAA,KAAA,EAAA,CAkC5C,QAAA,wBAAwB,QAAA,WAAA,EADjC,YA6BkB,MAAA,gBAAA,EAAA;;MA3BhB,IAAG;MACF,QAAM,CAAG,iBAAA;;6BAYE,CATJ,MAAA,aAAY,CAAC,QAAA,OAAM,IAAA,WAAA,EAD3B,YAUY,gCAAA;;OART,YAAA,QAAA;OACA,SAAA,QAAA;OACA,eAAA,QAAA;OACA,UAAU,QAAA;OACV,aAAA,QAAA;OACA,gBAAA,QAAA;OACA,OAAO,QAAA,QAAK;OACZ,SAAA,QAAA;OACA,QAAA,QAAA;;;;;;;;;;;0BAEH,mBAWW,UAAA,EAAA,KAAA,GAAA,EAAA,CATD,QAAA,UAAA,WAAA,EADR,YASY,wBAAA;;OAPT,YAAA,QAAA;OACA,SAAA,QAAA;OACA,UAAU,QAAA;OACV,aAAA,QAAA;OACA,gBAAA,QAAA;OACA,OAAA,QAAA;OACA,SAAA,QAAA;OACA,QAAA,QAAA"}
1
+ {"version":3,"file":"Schema.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/Schema.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarIcon, ScalarMarkdown } from '@scalar/components'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\nimport ScreenReader from '@/components/ScreenReader.vue'\n\nimport { isEmptySchemaObject } from './helpers/is-empty-schema-object'\nimport { isTypeObject } from './helpers/is-type-object'\nimport SchemaHeading from './SchemaHeading.vue'\nimport SchemaObjectProperties from './SchemaObjectProperties.vue'\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst {\n schema,\n level = 0,\n name,\n compact,\n noncollapsible = false,\n hideHeading,\n additionalProperties,\n discriminator,\n breadcrumb,\n hideModelNames = false,\n options,\n schemaContext,\n compositionPath,\n} = defineProps<{\n schema?: SchemaObject\n /** Track how deep we've gone */\n level?: number\n /* Show as a heading */\n name?: string\n /** A tighter layout with less borders and without a heading */\n compact?: boolean\n /** Shows a toggle to hide/show children */\n noncollapsible?: boolean\n /** Hide the heading */\n hideHeading?: boolean\n /** Show a special one way toggle for additional properties, also has a top border when open */\n additionalProperties?: boolean\n /** Hide model names in type display */\n hideModelNames?: boolean\n /** Discriminator object */\n discriminator?: DiscriminatorObject\n /** Breadcrumb for the schema */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into a single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", composition dropdown selection is synced with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n}>()\n\n/**\n * Determines whether to show the collapse/expand toggle button.\n * We hide the toggle for non-collapsible schemas and root-level schemas.\n */\nconst shouldShowToggle = computed((): boolean => {\n return !noncollapsible && level > 0\n})\n\n/** Gets the description to show for the schema */\nconst schemaDescription = computed(() => {\n // For the request body we want to show the base description or the first allOf schema description\n if (schema?.allOf && schema.allOf.length > 0 && name === 'Request Body') {\n return schema.description || schema.allOf[0]?.description || null\n }\n\n // Don't show description if there's no description or it's not a string\n if (!schema?.description || typeof schema.description !== 'string') {\n return null\n }\n\n // Don't show description if the schema has other composition keywords\n // This prevents duplicate descriptions when individual schemas are part of compositions\n if (schema.oneOf || schema.anyOf) {\n return null\n }\n\n // Don't show description for enum schemas (they have special handling)\n if (schema.enum) {\n return null\n }\n\n // Will be shown in the properties anyway\n if (\n !('properties' in schema) &&\n !('patternProperties' in schema) &&\n !('additionalProperties' in schema)\n ) {\n return null\n }\n\n // Return the schema's own description\n return schema.description\n})\n\n// Prevent click action if noncollapsible\nconst handleClick = (e: MouseEvent) => noncollapsible && e.stopPropagation()\n</script>\n<template>\n <Disclosure\n v-if=\"typeof schema === 'object' && Object.keys(schema).length\"\n v-slot=\"{ open }\"\n :defaultOpen=\"noncollapsible\">\n <div\n class=\"schema-card\"\n :class=\"[\n `schema-card--level-${level}`,\n { 'schema-card--compact': compact, 'schema-card--open': open },\n { 'border-t': additionalProperties && open },\n ]\">\n <!-- Schema description -->\n <div\n v-if=\"schemaDescription\"\n class=\"schema-card-description\">\n <ScalarMarkdown :value=\"schemaDescription\" />\n </div>\n <div\n v-if=\"isEmptySchemaObject(schema)\"\n class=\"pt-2\">\n Empty object\n </div>\n <div\n class=\"schema-properties\"\n :class=\"{\n 'schema-properties-open': open,\n }\">\n <!-- Toggle to collapse/expand long lists of properties -->\n <div\n v-if=\"additionalProperties\"\n v-show=\"!open\"\n class=\"schema-properties\">\n <DisclosureButton\n as=\"button\"\n class=\"schema-card-title schema-card-title--compact\"\n @click.capture=\"handleClick\">\n <ScalarIcon\n class=\"schema-card-title-icon\"\n icon=\"Add\"\n size=\"sm\" />\n Show additional properties\n <ScreenReader v-if=\"name\">for {{ name }}</ScreenReader>\n </DisclosureButton>\n </div>\n\n <DisclosureButton\n v-else-if=\"shouldShowToggle\"\n v-show=\"!hideHeading && !(noncollapsible && compact)\"\n :as=\"noncollapsible ? 'div' : 'button'\"\n class=\"schema-card-title\"\n :class=\"{ 'schema-card-title--compact': compact }\"\n :style=\"{\n top: `calc(var(--refs-viewport-offset) + calc(var(--schema-title-height) * ${level}))`,\n }\"\n @click.capture=\"handleClick\">\n <template v-if=\"compact\">\n <ScalarIcon\n class=\"schema-card-title-icon\"\n :class=\"{ 'schema-card-title-icon--open': open }\"\n icon=\"Add\"\n size=\"sm\" />\n <template v-if=\"open\">\n Hide {{ schema?.title ?? 'Child Attributes' }}\n </template>\n <template v-else>\n Show {{ schema?.title ?? 'Child Attributes' }}\n </template>\n <ScreenReader v-if=\"name\">for {{ name }}</ScreenReader>\n </template>\n <template v-else>\n <ScalarIcon\n class=\"schema-card-title-icon\"\n :class=\"{ 'schema-card-title-icon--open': open }\"\n icon=\"Add\"\n size=\"sm\" />\n <SchemaHeading\n :name=\"schema?.title ?? name\"\n :value=\"schema\" />\n </template>\n </DisclosureButton>\n <DisclosurePanel\n v-if=\"!additionalProperties || open\"\n as=\"ul\"\n :static=\"!shouldShowToggle\">\n <!-- Object properties -->\n <SchemaObjectProperties\n v-if=\"isTypeObject(schema)\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level=\"level + 1\"\n :options\n :schema\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\" />\n <!-- Not an object -->\n <template v-else>\n <SchemaProperty\n v-if=\"schema\"\n :breadcrumb\n :compact\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :options\n :schema\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\" />\n </template>\n </DisclosurePanel>\n </div>\n </div>\n </Disclosure>\n</template>\n<style scoped>\n.error {\n background-color: var(--scalar-color-red);\n}\n.schema-card {\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-1);\n}\n.schema-card-title {\n height: var(--schema-title-height);\n\n padding: 6px 8px;\n\n display: flex;\n align-items: center;\n gap: 4px;\n\n color: var(--scalar-color-2);\n font-weight: var(--scalar-semibold);\n font-size: var(--scalar-mini);\n border-bottom: var(--scalar-border-width) solid transparent;\n}\nbutton.schema-card-title {\n cursor: pointer;\n}\nbutton.schema-card-title:hover {\n color: var(--scalar-color-1);\n}\n.schema-card-title-icon--open {\n transform: rotate(45deg);\n}\n.schema-properties-open > .schema-card-title {\n border-bottom-left-radius: 0;\n border-bottom-right-radius: 0;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-properties-open > .schema-properties {\n width: fit-content;\n}\n.schema-card-description {\n color: var(--scalar-color-2);\n}\n.schema-card-description + .schema-properties {\n width: fit-content;\n}\n.schema-card-description + .schema-properties {\n margin-top: 8px;\n}\n.schema-card--level-0:nth-of-type(1)\n > .schema-card-description:has(+ .schema-properties) {\n margin-bottom: -8px;\n padding-bottom: 8px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.schema-card--level-0\n ~ .schema-card--level-0\n > .schema-card-description:has(+ .schema-properties) {\n padding-top: 8px;\n}\n\n.schema-properties-open.schema-properties,\n.schema-properties-open > .schema-card--open {\n width: 100%;\n}\n.schema-properties {\n display: flex;\n flex-direction: column;\n\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n width: fit-content;\n}\n.schema-properties-name {\n width: 100%;\n}\n.schema-properties .schema-properties {\n border-radius: 13.5px;\n}\n.schema-properties .schema-properties.schema-properties-open {\n border-radius: var(--scalar-radius-lg);\n}\n.schema-properties-open {\n width: 100%;\n}\n.schema-card--compact {\n align-self: flex-start;\n}\n.schema-card--compact.schema-card--open {\n align-self: initial;\n}\n.schema-card-title--compact {\n color: var(--scalar-color-2);\n padding: 6px 10px 6px 8px;\n height: auto;\n border-bottom: none;\n}\n.schema-card-title--compact > .schema-card-title-icon {\n margin: 0;\n}\n.schema-card-title--compact > .schema-card-title-icon--open {\n transform: rotate(45deg);\n}\n.schema-properties-open > .schema-card-title--compact {\n position: static;\n}\n.property--level-0\n > .schema-properties\n > .schema-card--level-0\n > .schema-properties {\n border: none;\n}\n.property--level-0\n .schema-card--level-0:not(.schema-card--compact)\n .property--level-1 {\n padding: 0 0 8px;\n}\n:not(.composition-panel)\n > .schema-card--compact.schema-card--level-0\n > .schema-properties {\n border: none;\n}\n:deep(.schema-card-description) p {\n font-size: var(--scalar-small, var(--scalar-paragraph));\n color: var(--scalar-color-2);\n line-height: 1.5;\n margin-bottom: 0;\n display: block;\n margin-bottom: 6px;\n}\n.children .schema-card-description:first-of-type {\n padding-top: 0;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmEA,MAAM,mBAAmB,eAAwB;AAC/C,UAAO,CAAC,QAAA,kBAAkB,QAAA,QAAQ;IACnC;;EAGD,MAAM,oBAAoB,eAAe;AAEvC,OAAI,QAAA,QAAQ,SAAS,QAAA,OAAO,MAAM,SAAS,KAAK,QAAA,SAAS,eACvD,QAAO,QAAA,OAAO,eAAe,QAAA,OAAO,MAAM,IAAI,eAAe;AAI/D,OAAI,CAAC,QAAA,QAAQ,eAAe,OAAO,QAAA,OAAO,gBAAgB,SACxD,QAAO;AAKT,OAAI,QAAA,OAAO,SAAS,QAAA,OAAO,MACzB,QAAO;AAIT,OAAI,QAAA,OAAO,KACT,QAAO;AAIT,OACE,EAAE,gBAAgB,QAAA,WAClB,EAAE,uBAAuB,QAAA,WACzB,EAAE,0BAA0B,QAAA,QAE5B,QAAO;AAIT,UAAO,QAAA,OAAO;IACf;EAGD,MAAM,eAAe,MAAkB,QAAA,kBAAkB,EAAE,iBAAgB;;iBAI1D,QAAA,WAAM,YAAiB,OAAO,KAAK,QAAA,OAAM,CAAE,UAAA,WAAA,EAD1D,YAoHa,MAAA,WAAA,EAAA;;IAjHV,aAAa,QAAA;;sBAgHR,EAjHI,WAAI,CAEd,mBA+GM,OAAA,EA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jB,eAAe,QAAA;;;;;;;;;;;;;0BAElB,mBAaW,UAAA,EAAA,KAAA,GAAA,EAAA,CAXD,QAAA,UAAA,WAAA,EADR,YAWmC,wBAAA;;OAThC,YAAA,QAAA;OACA,SAAA,QAAA;OACA,UAAU,QAAA;OACV,aAAA,QAAA;OACA,gBAAA,QAAA;OACA,OAAA,QAAA;OACA,SAAA,QAAA;OACA,QAAA,QAAA;OACA,iBAAiB,QAAA;OACjB,eAAe,QAAA"}
@@ -23,6 +23,10 @@ type __VLS_Props = {
23
23
  eventBus: WorkspaceEventBus | null;
24
24
  /** Move the options into single prop so they are easy to pass around */
25
25
  options: SchemaOptions;
26
+ /** When "requestBody", sync selected index with the example snippet */
27
+ schemaContext?: string;
28
+ /** Internal path used to sync nested request body compositions with the code sample */
29
+ compositionPath?: string[];
26
30
  };
27
31
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
28
32
  compact: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaComposition.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Schema/SchemaComposition.vue"],"names":[],"mappings":"AA+KA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAItE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAItE,KAAK,WAAW,GAAG;IACf,oDAAoD;IACpD,WAAW,EAAE,kBAAkB,CAAA;IAC/B,4DAA4D;IAC5D,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,MAAM,EAAE,YAAY,CAAA;IACpB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kCAAkC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,iCAAiC;IACjC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,yEAAyE;IACzE,OAAO,EAAE,aAAa,CAAA;CACvB,CAAC;AAsQJ,QAAA,MAAM,YAAY;aA/QJ,OAAO;iBAEH,OAAO;6EAgRvB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"SchemaComposition.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Schema/SchemaComposition.vue"],"names":[],"mappings":"AAyPA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAGrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAQtE,OAAO,EAAE,KAAK,kBAAkB,EAAE,MAAM,8BAA8B,CAAA;AAItE,KAAK,WAAW,GAAG;IACf,oDAAoD;IACpD,WAAW,EAAE,kBAAkB,CAAA;IAC/B,4DAA4D;IAC5D,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,kDAAkD;IAClD,MAAM,EAAE,YAAY,CAAA;IACpB,2CAA2C;IAC3C,KAAK,EAAE,MAAM,CAAA;IACb,oCAAoC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kCAAkC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,gCAAgC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,iCAAiC;IACjC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,yEAAyE;IACzE,OAAO,EAAE,aAAa,CAAA;IACtB,uEAAuE;IACvE,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,uFAAuF;IACvF,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;CAC3B,CAAC;AA4UJ,QAAA,MAAM,YAAY;aAzVJ,OAAO;iBAEH,OAAO;6EA0VvB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaComposition.vue.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaComposition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarListbox, type ScalarListboxOption } from '@scalar/components'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\n\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { mergeAllOfSchemas } from './helpers/merge-all-of-schemas'\nimport { type CompositionKeyword } from './helpers/schema-composition'\nimport { getModelNameFromSchema } from './helpers/schema-name'\nimport Schema from './Schema.vue'\n\nconst props = withDefaults(\n defineProps<{\n /** The composition keyword (oneOf, anyOf, allOf) */\n composition: CompositionKeyword\n /** Optional discriminator object for polymorphic schemas */\n discriminator?: DiscriminatorObject\n /** Optional name for the schema */\n name?: string\n /** The schema value containing the composition */\n schema: SchemaObject\n /** Nesting level for proper indentation */\n level: number\n /** Whether to use compact layout */\n compact?: boolean\n /** Whether to hide the heading */\n hideHeading?: boolean\n /** Breadcrumb for navigation */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into single prop so they are easy to pass around */\n options: SchemaOptions\n }>(),\n {\n compact: false,\n hideHeading: false,\n },\n)\n\n/** The current composition */\nconst composition = computed(() =>\n [props.schema[props.composition]]\n .flat()\n .map((schema) => ({ value: resolve.schema(schema), original: schema }))\n .filter((it) => isDefined(it.value)),\n)\n\n/**\n * Generate listbox options for the composition selector.\n * Each option represents a schema in the composition with a human-readable label.\n * Prefers schema title/name over structural type when present.\n */\nconst listboxOptions = computed((): ScalarListboxOption[] =>\n composition.value.map((schema, index: number) => {\n const resolved = resolve.schema(schema.original!)\n const label =\n (getModelNameFromSchema(resolved) ?? getSchemaType(resolved)) || 'Schema'\n return { id: String(index), label }\n }),\n)\n\n/**\n * Two-way computed property for the selected option.\n * Handles conversion between the selected index and the listbox option format.\n */\nconst selectedOption = ref<ScalarListboxOption | undefined>(\n listboxOptions.value[0],\n)\n\n/**\n * Humanize composition keyword name for display.\n * Converts camelCase to Title Case (e.g., oneOf -> One of).\n */\nconst humanizeType = (type: CompositionKeyword): string =>\n type\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (str) => str.toUpperCase())\n .toLowerCase()\n .replace(/^(\\w)/, (c) => c.toUpperCase())\n\n/** Inside the currently selected composition */\nconst selectedComposition = computed(\n () => composition.value[Number(selectedOption.value?.id ?? '0')]?.value,\n)\n\n/** Controls whether the nested schema is displayed */\nconst showNestedSchema = ref(false)\n</script>\n\n<template>\n <div class=\"property-rule\">\n <!-- We merge allOf schemas into a single schema -->\n <Schema\n v-if=\"props.composition === 'allOf'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :hideHeading=\"hideHeading\"\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"mergeAllOfSchemas(schema)\" />\n\n <template v-else>\n <!-- Composition selector and panel for nested compositions -->\n <ScalarListbox\n v-model=\"selectedOption\"\n :options=\"listboxOptions\"\n resize>\n <button\n class=\"composition-selector bg-b-1.5 hover:bg-b-2 flex w-full cursor-pointer items-center gap-1 rounded-t-lg border px-2.5 py-2.5 pr-3 text-left\"\n type=\"button\">\n <span class=\"text-c-2\">{{ humanizeType(props.composition) }}</span>\n <span\n class=\"composition-selector-label text-c-1\"\n :class=\"{\n 'line-through': selectedComposition?.deprecated,\n }\">\n {{ selectedOption?.label || 'Schema' }}\n </span>\n <div\n v-if=\"selectedComposition?.deprecated\"\n class=\"text-red\">\n deprecated\n </div>\n <ScalarIconCaretDown />\n </button>\n </ScalarListbox>\n\n <div class=\"composition-panel\">\n <!-- Button to toggle nested schema display -->\n <button\n v-if=\"!showNestedSchema && level > 2\"\n class=\"bg-b-1 hover:bg-b-2 text-c-1 flex w-full items-center justify-center gap-2 rounded-b-lg border border-t-0 px-2 py-2 text-sm font-medium transition-colors\"\n type=\"button\"\n @click=\"showNestedSchema = true\">\n Show Schema Details\n <ScalarIconCaretDown class=\"h-3 w-3\" />\n </button>\n\n <!-- Render the selected schema if it has content to display -->\n <Schema\n v-else\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :hideHeading=\"hideHeading\"\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"selectedComposition\" />\n </div>\n </template>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SchemaComposition.vue.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaComposition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarListbox, type ScalarListboxOption } from '@scalar/components'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, inject, ref, watch } from 'vue'\n\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from '@/features/Operation/request-body-composition-index'\n\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { mergeAllOfSchemas } from './helpers/merge-all-of-schemas'\nimport { type CompositionKeyword } from './helpers/schema-composition'\nimport { getModelNameFromSchema } from './helpers/schema-name'\nimport Schema from './Schema.vue'\n\nconst props = withDefaults(\n defineProps<{\n /** The composition keyword (oneOf, anyOf, allOf) */\n composition: CompositionKeyword\n /** Optional discriminator object for polymorphic schemas */\n discriminator?: DiscriminatorObject\n /** Optional name for the schema */\n name?: string\n /** The schema value containing the composition */\n schema: SchemaObject\n /** Nesting level for proper indentation */\n level: number\n /** Whether to use compact layout */\n compact?: boolean\n /** Whether to hide the heading */\n hideHeading?: boolean\n /** Breadcrumb for navigation */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", sync selected index with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n }>(),\n {\n compact: false,\n hideHeading: false,\n },\n)\n\n/** The current composition */\nconst composition = computed(() =>\n [props.schema[props.composition]]\n .flat()\n .map((schema) => ({ value: resolve.schema(schema), original: schema }))\n .filter((it) => isDefined(it.value)),\n)\n\n/**\n * Generate listbox options for the composition selector.\n * Each option represents a schema in the composition with a human-readable label.\n * Prefers schema title/name over structural type when present.\n */\nconst listboxOptions = computed((): ScalarListboxOption[] =>\n composition.value.map((schema, index: number) => {\n const resolved = resolve.schema(schema.original!)\n const label =\n (getModelNameFromSchema(resolved) ?? getSchemaType(resolved)) || 'Schema'\n return { id: String(index), label }\n }),\n)\n\nconst compositionSelectionKey = computed(() =>\n props.compositionPath?.length\n ? [...props.compositionPath, props.composition].join('.')\n : '',\n)\n\n/** When this composition is in the request body, sync selection with the example snippet */\nconst requestBodyCompositionSelectionRef = inject(\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n undefined,\n)\n\nconst initialSelectedIndex = computed(() => {\n if (\n props.schemaContext !== 'requestBody' ||\n !requestBodyCompositionSelectionRef?.value ||\n !compositionSelectionKey.value\n ) {\n return 0\n }\n\n const selectedIndex =\n requestBodyCompositionSelectionRef.value[compositionSelectionKey.value]\n\n if (typeof selectedIndex !== 'number' || Number.isNaN(selectedIndex)) {\n return 0\n }\n\n return Math.max(0, Math.min(selectedIndex, listboxOptions.value.length - 1))\n})\n\n/**\n * Two-way computed property for the selected option.\n * Handles conversion between the selected index and the listbox option format.\n */\nconst selectedOption = ref<ScalarListboxOption | undefined>()\n\nwatch(\n [listboxOptions, initialSelectedIndex],\n ([options, selectedIndex]) => {\n if (\n !selectedOption.value ||\n !options.some((option) => option.id === selectedOption.value?.id)\n ) {\n selectedOption.value = options[selectedIndex] ?? options[0]\n }\n },\n { immediate: true },\n)\n\n/**\n * Humanize composition keyword name for display.\n * Converts camelCase to Title Case (e.g., oneOf -> One of).\n */\nconst humanizeType = (type: CompositionKeyword): string =>\n type\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (str) => str.toUpperCase())\n .toLowerCase()\n .replace(/^(\\w)/, (c) => c.toUpperCase())\n\n/** Inside the currently selected composition */\nconst selectedComposition = computed(\n () => composition.value[Number(selectedOption.value?.id ?? '0')]?.value,\n)\n\n/** Controls whether the nested schema is displayed */\nconst showNestedSchema = ref(false)\n\nif (\n requestBodyCompositionSelectionRef &&\n props.schemaContext === 'requestBody' &&\n compositionSelectionKey.value\n) {\n watch(\n selectedOption,\n (option) => {\n const index = option ? Number(option.id) : 0\n if (!Number.isNaN(index)) {\n requestBodyCompositionSelectionRef.value = {\n ...requestBodyCompositionSelectionRef.value,\n [compositionSelectionKey.value]: index,\n } satisfies RequestBodyCompositionSelection\n }\n },\n { immediate: true },\n )\n}\n</script>\n\n<template>\n <div class=\"property-rule\">\n <!-- We merge allOf schemas into a single schema -->\n <Schema\n v-if=\"props.composition === 'allOf'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :hideHeading=\"hideHeading\"\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\"\n :schema=\"mergeAllOfSchemas(schema)\" />\n\n <template v-else>\n <!-- Composition selector and panel for nested compositions -->\n <ScalarListbox\n v-model=\"selectedOption\"\n :options=\"listboxOptions\"\n resize>\n <button\n class=\"composition-selector bg-b-1.5 hover:bg-b-2 flex w-full cursor-pointer items-center gap-1 rounded-t-lg border px-2.5 py-2.5 pr-3 text-left\"\n type=\"button\">\n <span class=\"text-c-2\">{{ humanizeType(props.composition) }}</span>\n <span\n class=\"composition-selector-label text-c-1\"\n :class=\"{\n 'line-through': selectedComposition?.deprecated,\n }\">\n {{ selectedOption?.label || 'Schema' }}\n </span>\n <div\n v-if=\"selectedComposition?.deprecated\"\n class=\"text-red\">\n deprecated\n </div>\n <ScalarIconCaretDown />\n </button>\n </ScalarListbox>\n\n <div class=\"composition-panel\">\n <!-- Button to toggle nested schema display -->\n <button\n v-if=\"!showNestedSchema && level > 2\"\n class=\"bg-b-1 hover:bg-b-2 text-c-1 flex w-full items-center justify-center gap-2 rounded-b-lg border border-t-0 px-2 py-2 text-sm font-medium transition-colors\"\n type=\"button\"\n @click=\"showNestedSchema = true\">\n Show Schema Details\n <ScalarIconCaretDown class=\"h-3 w-3\" />\n </button>\n\n <!-- Render the selected schema if it has content to display -->\n <Schema\n v-else\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :hideHeading=\"hideHeading\"\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\"\n :schema=\"selectedComposition\" />\n </div>\n </template>\n </div>\n</template>\n"],"mappings":""}
@@ -1,8 +1,9 @@
1
+ import { REQUEST_BODY_COMPOSITION_INDEX_SYMBOL } from "../../../features/Operation/request-body-composition-index.js";
1
2
  import { getSchemaType } from "./helpers/get-schema-type.js";
2
3
  import { mergeAllOfSchemas } from "./helpers/merge-all-of-schemas.js";
3
4
  import { getModelNameFromSchema } from "./helpers/schema-name.js";
4
5
  import Schema_default from "./Schema.vue.js";
5
- import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, ref, toDisplayString, unref, withCtx } from "vue";
6
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, normalizeClass, openBlock, ref, toDisplayString, unref, watch, withCtx } from "vue";
6
7
  import { ScalarListbox } from "@scalar/components";
7
8
  import { ScalarIconCaretDown } from "@scalar/icons";
8
9
  import { resolve } from "@scalar/workspace-store/resolve";
@@ -37,7 +38,9 @@ var SchemaComposition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
37
38
  },
38
39
  breadcrumb: {},
39
40
  eventBus: {},
40
- options: {}
41
+ options: {},
42
+ schemaContext: {},
43
+ compositionPath: {}
41
44
  },
42
45
  setup(__props) {
43
46
  const props = __props;
@@ -59,11 +62,23 @@ var SchemaComposition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
59
62
  label
60
63
  };
61
64
  }));
65
+ const compositionSelectionKey = computed(() => props.compositionPath?.length ? [...props.compositionPath, props.composition].join(".") : "");
66
+ /** When this composition is in the request body, sync selection with the example snippet */
67
+ const requestBodyCompositionSelectionRef = inject(REQUEST_BODY_COMPOSITION_INDEX_SYMBOL, void 0);
68
+ const initialSelectedIndex = computed(() => {
69
+ if (props.schemaContext !== "requestBody" || !requestBodyCompositionSelectionRef?.value || !compositionSelectionKey.value) return 0;
70
+ const selectedIndex = requestBodyCompositionSelectionRef.value[compositionSelectionKey.value];
71
+ if (typeof selectedIndex !== "number" || Number.isNaN(selectedIndex)) return 0;
72
+ return Math.max(0, Math.min(selectedIndex, listboxOptions.value.length - 1));
73
+ });
62
74
  /**
63
75
  * Two-way computed property for the selected option.
64
76
  * Handles conversion between the selected index and the listbox option format.
65
77
  */
66
- const selectedOption = ref(listboxOptions.value[0]);
78
+ const selectedOption = ref();
79
+ watch([listboxOptions, initialSelectedIndex], ([options, selectedIndex]) => {
80
+ if (!selectedOption.value || !options.some((option) => option.id === selectedOption.value?.id)) selectedOption.value = options[selectedIndex] ?? options[0];
81
+ }, { immediate: true });
67
82
  /**
68
83
  * Humanize composition keyword name for display.
69
84
  * Converts camelCase to Title Case (e.g., oneOf -> One of).
@@ -73,6 +88,13 @@ var SchemaComposition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
73
88
  const selectedComposition = computed(() => composition.value[Number(selectedOption.value?.id ?? "0")]?.value);
74
89
  /** Controls whether the nested schema is displayed */
75
90
  const showNestedSchema = ref(false);
91
+ if (requestBodyCompositionSelectionRef && props.schemaContext === "requestBody" && compositionSelectionKey.value) watch(selectedOption, (option) => {
92
+ const index = option ? Number(option.id) : 0;
93
+ if (!Number.isNaN(index)) requestBodyCompositionSelectionRef.value = {
94
+ ...requestBodyCompositionSelectionRef.value,
95
+ [compositionSelectionKey.value]: index
96
+ };
97
+ }, { immediate: true });
76
98
  return (_ctx, _cache) => {
77
99
  return openBlock(), createElementBlock("div", _hoisted_1, [props.composition === "allOf" ? (openBlock(), createBlock(Schema_default, {
78
100
  key: 0,
@@ -85,6 +107,8 @@ var SchemaComposition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
85
107
  name: __props.name,
86
108
  noncollapsible: true,
87
109
  options: __props.options,
110
+ compositionPath: __props.compositionPath,
111
+ schemaContext: __props.schemaContext,
88
112
  schema: unref(mergeAllOfSchemas)(__props.schema)
89
113
  }, null, 8, [
90
114
  "breadcrumb",
@@ -95,6 +119,8 @@ var SchemaComposition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
95
119
  "level",
96
120
  "name",
97
121
  "options",
122
+ "compositionPath",
123
+ "schemaContext",
98
124
  "schema"
99
125
  ])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createVNode(unref(ScalarListbox), {
100
126
  modelValue: selectedOption.value,
@@ -125,6 +151,8 @@ var SchemaComposition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
125
151
  name: __props.name,
126
152
  noncollapsible: true,
127
153
  options: __props.options,
154
+ compositionPath: __props.compositionPath,
155
+ schemaContext: __props.schemaContext,
128
156
  schema: selectedComposition.value
129
157
  }, null, 8, [
130
158
  "breadcrumb",
@@ -135,6 +163,8 @@ var SchemaComposition_vue_vue_type_script_setup_true_lang_default = /* @__PURE__
135
163
  "level",
136
164
  "name",
137
165
  "options",
166
+ "compositionPath",
167
+ "schemaContext",
138
168
  "schema"
139
169
  ]))])], 64))]);
140
170
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaComposition.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaComposition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarListbox, type ScalarListboxOption } from '@scalar/components'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref } from 'vue'\n\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\n\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { mergeAllOfSchemas } from './helpers/merge-all-of-schemas'\nimport { type CompositionKeyword } from './helpers/schema-composition'\nimport { getModelNameFromSchema } from './helpers/schema-name'\nimport Schema from './Schema.vue'\n\nconst props = withDefaults(\n defineProps<{\n /** The composition keyword (oneOf, anyOf, allOf) */\n composition: CompositionKeyword\n /** Optional discriminator object for polymorphic schemas */\n discriminator?: DiscriminatorObject\n /** Optional name for the schema */\n name?: string\n /** The schema value containing the composition */\n schema: SchemaObject\n /** Nesting level for proper indentation */\n level: number\n /** Whether to use compact layout */\n compact?: boolean\n /** Whether to hide the heading */\n hideHeading?: boolean\n /** Breadcrumb for navigation */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into single prop so they are easy to pass around */\n options: SchemaOptions\n }>(),\n {\n compact: false,\n hideHeading: false,\n },\n)\n\n/** The current composition */\nconst composition = computed(() =>\n [props.schema[props.composition]]\n .flat()\n .map((schema) => ({ value: resolve.schema(schema), original: schema }))\n .filter((it) => isDefined(it.value)),\n)\n\n/**\n * Generate listbox options for the composition selector.\n * Each option represents a schema in the composition with a human-readable label.\n * Prefers schema title/name over structural type when present.\n */\nconst listboxOptions = computed((): ScalarListboxOption[] =>\n composition.value.map((schema, index: number) => {\n const resolved = resolve.schema(schema.original!)\n const label =\n (getModelNameFromSchema(resolved) ?? getSchemaType(resolved)) || 'Schema'\n return { id: String(index), label }\n }),\n)\n\n/**\n * Two-way computed property for the selected option.\n * Handles conversion between the selected index and the listbox option format.\n */\nconst selectedOption = ref<ScalarListboxOption | undefined>(\n listboxOptions.value[0],\n)\n\n/**\n * Humanize composition keyword name for display.\n * Converts camelCase to Title Case (e.g., oneOf -> One of).\n */\nconst humanizeType = (type: CompositionKeyword): string =>\n type\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (str) => str.toUpperCase())\n .toLowerCase()\n .replace(/^(\\w)/, (c) => c.toUpperCase())\n\n/** Inside the currently selected composition */\nconst selectedComposition = computed(\n () => composition.value[Number(selectedOption.value?.id ?? '0')]?.value,\n)\n\n/** Controls whether the nested schema is displayed */\nconst showNestedSchema = ref(false)\n</script>\n\n<template>\n <div class=\"property-rule\">\n <!-- We merge allOf schemas into a single schema -->\n <Schema\n v-if=\"props.composition === 'allOf'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :hideHeading=\"hideHeading\"\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"mergeAllOfSchemas(schema)\" />\n\n <template v-else>\n <!-- Composition selector and panel for nested compositions -->\n <ScalarListbox\n v-model=\"selectedOption\"\n :options=\"listboxOptions\"\n resize>\n <button\n class=\"composition-selector bg-b-1.5 hover:bg-b-2 flex w-full cursor-pointer items-center gap-1 rounded-t-lg border px-2.5 py-2.5 pr-3 text-left\"\n type=\"button\">\n <span class=\"text-c-2\">{{ humanizeType(props.composition) }}</span>\n <span\n class=\"composition-selector-label text-c-1\"\n :class=\"{\n 'line-through': selectedComposition?.deprecated,\n }\">\n {{ selectedOption?.label || 'Schema' }}\n </span>\n <div\n v-if=\"selectedComposition?.deprecated\"\n class=\"text-red\">\n deprecated\n </div>\n <ScalarIconCaretDown />\n </button>\n </ScalarListbox>\n\n <div class=\"composition-panel\">\n <!-- Button to toggle nested schema display -->\n <button\n v-if=\"!showNestedSchema && level > 2\"\n class=\"bg-b-1 hover:bg-b-2 text-c-1 flex w-full items-center justify-center gap-2 rounded-b-lg border border-t-0 px-2 py-2 text-sm font-medium transition-colors\"\n type=\"button\"\n @click=\"showNestedSchema = true\">\n Show Schema Details\n <ScalarIconCaretDown class=\"h-3 w-3\" />\n </button>\n\n <!-- Render the selected schema if it has content to display -->\n <Schema\n v-else\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :hideHeading=\"hideHeading\"\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :schema=\"selectedComposition\" />\n </div>\n </template>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBA,MAAM,QAAQ;;EA8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,YAAmE,gBAAzC,aAAa,MAAM,YAAW,CAAA,EAAA,EAAA;KACxD,mBAMO,QAAA,EALL,OAAK,eAAA,CAAC,uCAAqC,EAAA,gBACH,oBAAA,OAAqB,YAAA,CAAA,CAAA,EAAA,EAAA,gBAG1D,eAAA,OAAgB,SAAK,SAAA,EAAA,EAAA;KAGlB,oBAAA,OAAqB,cAAA,WAAA,EAD7B,mBAIM,OAJN,YAEmB,eAEnB,IAAA,mBAAA,IAAA,KAAA;KACA,YAAuB,MAAA,oBAAA,CAAA;;;qCAI3B,mBAwBM,OAxBN,YAwBM,CAAA,CArBK,iBAAA,SAAoB,QAAA,QAAK,KAAA,WAAA,EADlC,mBAOS,UAAA;;IALP,OAAM;IACN,MAAK;IACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,iBAAA,QAAgB;iDAAS,yBAEjC,GAAA,GAAA,YAAuC,MAAA,oBAAA,EAAA,EAAlB,OAAM,WAAS,CAAA,CAAA,CAAA,KAAA,WAAA,EAItC,YAWkC,gBAAA;;IAT/B,YAAY,QAAA;IACZ,SAAS,QAAA;IACT,eAAe,QAAA;IACf,UAAU,QAAA;IACV,aAAa,QAAA;IACb,OAAO,QAAA,QAAK;IACZ,MAAM,QAAA;IACN,gBAAgB;IAChB,SAAS,QAAA;IACT,QAAQ,oBAAA"}
1
+ {"version":3,"file":"SchemaComposition.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaComposition.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarListbox, type ScalarListboxOption } from '@scalar/components'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, inject, ref, watch } from 'vue'\n\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\nimport {\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n type RequestBodyCompositionSelection,\n} from '@/features/Operation/request-body-composition-index'\n\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { mergeAllOfSchemas } from './helpers/merge-all-of-schemas'\nimport { type CompositionKeyword } from './helpers/schema-composition'\nimport { getModelNameFromSchema } from './helpers/schema-name'\nimport Schema from './Schema.vue'\n\nconst props = withDefaults(\n defineProps<{\n /** The composition keyword (oneOf, anyOf, allOf) */\n composition: CompositionKeyword\n /** Optional discriminator object for polymorphic schemas */\n discriminator?: DiscriminatorObject\n /** Optional name for the schema */\n name?: string\n /** The schema value containing the composition */\n schema: SchemaObject\n /** Nesting level for proper indentation */\n level: number\n /** Whether to use compact layout */\n compact?: boolean\n /** Whether to hide the heading */\n hideHeading?: boolean\n /** Breadcrumb for navigation */\n breadcrumb?: string[]\n /** Event bus emitting actions */\n eventBus: WorkspaceEventBus | null\n /** Move the options into single prop so they are easy to pass around */\n options: SchemaOptions\n /** When \"requestBody\", sync selected index with the example snippet */\n schemaContext?: string\n /** Internal path used to sync nested request body compositions with the code sample */\n compositionPath?: string[]\n }>(),\n {\n compact: false,\n hideHeading: false,\n },\n)\n\n/** The current composition */\nconst composition = computed(() =>\n [props.schema[props.composition]]\n .flat()\n .map((schema) => ({ value: resolve.schema(schema), original: schema }))\n .filter((it) => isDefined(it.value)),\n)\n\n/**\n * Generate listbox options for the composition selector.\n * Each option represents a schema in the composition with a human-readable label.\n * Prefers schema title/name over structural type when present.\n */\nconst listboxOptions = computed((): ScalarListboxOption[] =>\n composition.value.map((schema, index: number) => {\n const resolved = resolve.schema(schema.original!)\n const label =\n (getModelNameFromSchema(resolved) ?? getSchemaType(resolved)) || 'Schema'\n return { id: String(index), label }\n }),\n)\n\nconst compositionSelectionKey = computed(() =>\n props.compositionPath?.length\n ? [...props.compositionPath, props.composition].join('.')\n : '',\n)\n\n/** When this composition is in the request body, sync selection with the example snippet */\nconst requestBodyCompositionSelectionRef = inject(\n REQUEST_BODY_COMPOSITION_INDEX_SYMBOL,\n undefined,\n)\n\nconst initialSelectedIndex = computed(() => {\n if (\n props.schemaContext !== 'requestBody' ||\n !requestBodyCompositionSelectionRef?.value ||\n !compositionSelectionKey.value\n ) {\n return 0\n }\n\n const selectedIndex =\n requestBodyCompositionSelectionRef.value[compositionSelectionKey.value]\n\n if (typeof selectedIndex !== 'number' || Number.isNaN(selectedIndex)) {\n return 0\n }\n\n return Math.max(0, Math.min(selectedIndex, listboxOptions.value.length - 1))\n})\n\n/**\n * Two-way computed property for the selected option.\n * Handles conversion between the selected index and the listbox option format.\n */\nconst selectedOption = ref<ScalarListboxOption | undefined>()\n\nwatch(\n [listboxOptions, initialSelectedIndex],\n ([options, selectedIndex]) => {\n if (\n !selectedOption.value ||\n !options.some((option) => option.id === selectedOption.value?.id)\n ) {\n selectedOption.value = options[selectedIndex] ?? options[0]\n }\n },\n { immediate: true },\n)\n\n/**\n * Humanize composition keyword name for display.\n * Converts camelCase to Title Case (e.g., oneOf -> One of).\n */\nconst humanizeType = (type: CompositionKeyword): string =>\n type\n .replace(/([A-Z])/g, ' $1')\n .replace(/^./, (str) => str.toUpperCase())\n .toLowerCase()\n .replace(/^(\\w)/, (c) => c.toUpperCase())\n\n/** Inside the currently selected composition */\nconst selectedComposition = computed(\n () => composition.value[Number(selectedOption.value?.id ?? '0')]?.value,\n)\n\n/** Controls whether the nested schema is displayed */\nconst showNestedSchema = ref(false)\n\nif (\n requestBodyCompositionSelectionRef &&\n props.schemaContext === 'requestBody' &&\n compositionSelectionKey.value\n) {\n watch(\n selectedOption,\n (option) => {\n const index = option ? Number(option.id) : 0\n if (!Number.isNaN(index)) {\n requestBodyCompositionSelectionRef.value = {\n ...requestBodyCompositionSelectionRef.value,\n [compositionSelectionKey.value]: index,\n } satisfies RequestBodyCompositionSelection\n }\n },\n { immediate: true },\n )\n}\n</script>\n\n<template>\n <div class=\"property-rule\">\n <!-- We merge allOf schemas into a single schema -->\n <Schema\n v-if=\"props.composition === 'allOf'\"\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :hideHeading=\"hideHeading\"\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\"\n :schema=\"mergeAllOfSchemas(schema)\" />\n\n <template v-else>\n <!-- Composition selector and panel for nested compositions -->\n <ScalarListbox\n v-model=\"selectedOption\"\n :options=\"listboxOptions\"\n resize>\n <button\n class=\"composition-selector bg-b-1.5 hover:bg-b-2 flex w-full cursor-pointer items-center gap-1 rounded-t-lg border px-2.5 py-2.5 pr-3 text-left\"\n type=\"button\">\n <span class=\"text-c-2\">{{ humanizeType(props.composition) }}</span>\n <span\n class=\"composition-selector-label text-c-1\"\n :class=\"{\n 'line-through': selectedComposition?.deprecated,\n }\">\n {{ selectedOption?.label || 'Schema' }}\n </span>\n <div\n v-if=\"selectedComposition?.deprecated\"\n class=\"text-red\">\n deprecated\n </div>\n <ScalarIconCaretDown />\n </button>\n </ScalarListbox>\n\n <div class=\"composition-panel\">\n <!-- Button to toggle nested schema display -->\n <button\n v-if=\"!showNestedSchema && level > 2\"\n class=\"bg-b-1 hover:bg-b-2 text-c-1 flex w-full items-center justify-center gap-2 rounded-b-lg border border-t-0 px-2 py-2 text-sm font-medium transition-colors\"\n type=\"button\"\n @click=\"showNestedSchema = true\">\n Show Schema Details\n <ScalarIconCaretDown class=\"h-3 w-3\" />\n </button>\n\n <!-- Render the selected schema if it has content to display -->\n <Schema\n v-else\n :breadcrumb=\"breadcrumb\"\n :compact=\"compact\"\n :discriminator=\"discriminator\"\n :eventBus=\"eventBus\"\n :hideHeading=\"hideHeading\"\n :level=\"level + 1\"\n :name=\"name\"\n :noncollapsible=\"true\"\n :options=\"options\"\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\"\n :schema=\"selectedComposition\" />\n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AG1D,eAAA,OAAgB,SAAK,SAAA,EAAA,EAAA;KAGlB,oBAAA,OAAqB,cAAA,WAAA,EAD7B,mBAIM,OAJN,YAEmB,eAEnB,IAAA,mBAAA,IAAA,KAAA;KACA,YAAuB,MAAA,oBAAA,CAAA;;;qCAI3B,mBA0BM,OA1BN,YA0BM,CAAA,CAvBK,iBAAA,SAAoB,QAAA,QAAK,KAAA,WAAA,EADlC,mBAOS,UAAA;;IALP,OAAM;IACN,MAAK;IACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,iBAAA,QAAgB;iDAAS,yBAEjC,GAAA,GAAA,YAAuC,MAAA,oBAAA,EAAA,EAAlB,OAAM,WAAS,CAAA,CAAA,CAAA,KAAA,WAAA,EAItC,YAakC,gBAAA;;IAX/B,YAAY,QAAA;IACZ,SAAS,QAAA;IACT,eAAe,QAAA;IACf,UAAU,QAAA;IACV,aAAa,QAAA;IACb,OAAO,QAAA,QAAK;IACZ,MAAM,QAAA;IACN,gBAAgB;IAChB,SAAS,QAAA;IACT,iBAAiB,QAAA;IACjB,eAAe,QAAA;IACf,QAAQ,oBAAA"}
@@ -11,6 +11,8 @@ type __VLS_Props = {
11
11
  breadcrumb?: string[];
12
12
  eventBus: WorkspaceEventBus | null;
13
13
  options: SchemaOptions;
14
+ schemaContext?: string;
15
+ compositionPath?: string[];
14
16
  };
15
17
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
18
  declare const _default: typeof __VLS_export;
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaObjectProperties.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Schema/SchemaObjectProperties.vue"],"names":[],"mappings":"AAsMA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAKrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAItE,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,YAAY,CAAA;IACpB,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,OAAO,EAAE,aAAa,CAAA;CACvB,CAAC;AA0PF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"SchemaObjectProperties.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Schema/SchemaObjectProperties.vue"],"names":[],"mappings":"AAuNA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAKrE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAItE,KAAK,WAAW,GAAG;IACf,MAAM,EAAE,YAAY,CAAA;IACpB,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,OAAO,EAAE,aAAa,CAAA;IACtB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;CAC3B,CAAC;AAuRJ,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaObjectProperties.vue.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { sortPropertyNames } from '@/components/Content/Schema/helpers/sort-property-names'\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\n\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst { schema, discriminator, options } = defineProps<{\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n}>()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n if (\n additionalProperties === true ||\n (typeof additionalProperties === 'object' &&\n Object.keys(additionalProperties).length === 0) ||\n typeof additionalProperties !== 'object' ||\n !('type' in additionalProperties)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof additionalProperties === 'object' ? additionalProperties : {}),\n }\n }\n\n return additionalProperties\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"property in sortedProperties\"\n :key=\"property\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"property\"\n :options=\"options\"\n :required=\"schema.required?.includes(property)\"\n :schema=\"resolve.schema(schema.properties[property])\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"resolve.schema(property)\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"SchemaObjectProperties.vue.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { sortPropertyNames } from '@/components/Content/Schema/helpers/sort-property-names'\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\n\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<{\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n }>()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n if (\n additionalProperties === true ||\n (typeof additionalProperties === 'object' &&\n Object.keys(additionalProperties).length === 0) ||\n typeof additionalProperties !== 'object' ||\n !('type' in additionalProperties)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof additionalProperties === 'object' ? additionalProperties : {}),\n }\n }\n\n return additionalProperties\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"property in sortedProperties\"\n :key=\"property\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"property\"\n :options=\"options\"\n :compositionPathSegment=\"property\"\n :compositionPath=\"compositionPath\"\n :required=\"schema.required?.includes(property)\"\n :schema=\"resolve.schema(schema.properties[property])\"\n :schemaContext=\"schemaContext\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :compositionPathSegment=\"key\"\n :compositionPath=\"compositionPath\"\n :schema=\"resolve.schema(property)\"\n :schemaContext=\"schemaContext\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":""}
@@ -15,7 +15,9 @@ var SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default = /* @__P
15
15
  hideModelNames: { type: Boolean },
16
16
  breadcrumb: {},
17
17
  eventBus: {},
18
- options: {}
18
+ options: {},
19
+ schemaContext: {},
20
+ compositionPath: {}
19
21
  },
20
22
  setup(__props) {
21
23
  /**
@@ -81,8 +83,11 @@ var SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default = /* @__P
81
83
  level: __props.level,
82
84
  name: property,
83
85
  options: __props.options,
86
+ compositionPathSegment: property,
87
+ compositionPath: __props.compositionPath,
84
88
  required: __props.schema.required?.includes(property),
85
- schema: unref(resolve).schema(__props.schema.properties[property])
89
+ schema: unref(resolve).schema(__props.schema.properties[property]),
90
+ schemaContext: __props.schemaContext
86
91
  }, null, 8, [
87
92
  "breadcrumb",
88
93
  "compact",
@@ -93,8 +98,11 @@ var SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default = /* @__P
93
98
  "level",
94
99
  "name",
95
100
  "options",
101
+ "compositionPathSegment",
102
+ "compositionPath",
96
103
  "required",
97
- "schema"
104
+ "schema",
105
+ "schemaContext"
98
106
  ]);
99
107
  }), 128)) : createCommentVNode("", true),
100
108
  unref(isTypeObject)(__props.schema) && __props.schema.patternProperties ? (openBlock(true), createElementBlock(Fragment, { key: 1 }, renderList(Object.entries(__props.schema.patternProperties), ([key, property]) => {
@@ -109,7 +117,10 @@ var SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default = /* @__P
109
117
  level: __props.level,
110
118
  name: key,
111
119
  options: __props.options,
112
- schema: unref(resolve).schema(property)
120
+ compositionPathSegment: key,
121
+ compositionPath: __props.compositionPath,
122
+ schema: unref(resolve).schema(property),
123
+ schemaContext: __props.schemaContext
113
124
  }, null, 8, [
114
125
  "breadcrumb",
115
126
  "compact",
@@ -120,7 +131,10 @@ var SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default = /* @__P
120
131
  "level",
121
132
  "name",
122
133
  "options",
123
- "schema"
134
+ "compositionPathSegment",
135
+ "compositionPath",
136
+ "schema",
137
+ "schemaContext"
124
138
  ]);
125
139
  }), 128)) : createCommentVNode("", true),
126
140
  unref(isTypeObject)(__props.schema) && __props.schema.additionalProperties ? (openBlock(), createBlock(SchemaProperty_default, {
@@ -135,6 +149,9 @@ var SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default = /* @__P
135
149
  name: getAdditionalPropertiesName(__props.schema.additionalProperties, __props.schema.propertyNames),
136
150
  noncollapsible: "",
137
151
  options: __props.options,
152
+ compositionPathSegment: getAdditionalPropertiesName(__props.schema.additionalProperties, __props.schema.propertyNames),
153
+ compositionPath: __props.compositionPath,
154
+ schemaContext: __props.schemaContext,
138
155
  propertyNamesEnum: additionalPropertiesEnum.value,
139
156
  schema: getAdditionalPropertiesValue(__props.schema.additionalProperties),
140
157
  variant: "additionalProperties"
@@ -148,6 +165,9 @@ var SchemaObjectProperties_vue_vue_type_script_setup_true_lang_default = /* @__P
148
165
  "level",
149
166
  "name",
150
167
  "options",
168
+ "compositionPathSegment",
169
+ "compositionPath",
170
+ "schemaContext",
151
171
  "propertyNamesEnum",
152
172
  "schema"
153
173
  ])) : createCommentVNode("", true)
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaObjectProperties.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { sortPropertyNames } from '@/components/Content/Schema/helpers/sort-property-names'\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\n\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst { schema, discriminator, options } = defineProps<{\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n}>()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n if (\n additionalProperties === true ||\n (typeof additionalProperties === 'object' &&\n Object.keys(additionalProperties).length === 0) ||\n typeof additionalProperties !== 'object' ||\n !('type' in additionalProperties)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof additionalProperties === 'object' ? additionalProperties : {}),\n }\n }\n\n return additionalProperties\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"property in sortedProperties\"\n :key=\"property\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"property\"\n :options=\"options\"\n :required=\"schema.required?.includes(property)\"\n :schema=\"resolve.schema(schema.properties[property])\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :schema=\"resolve.schema(property)\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;EA+BA,MAAM,mBAAmB,eACvB,kBAAkB,QAAA,QAAQ,QAAA,eAAe,QAAA,QAAQ,CACnD;;;;;;;EAQA,MAAM,+BACJ,uBAIA,mBACG;GACH,MAAM,uBACJ,OAAO,0BAA0B,YAC7B,wBACA,QAAQ,OAAO,sBAAqB;AAE1C,OACE,OAAO,yBAAyB,YAChC,OAAO,qBAAqB,kCAAkC,YAC9D,qBAAqB,8BAA8B,MAAM,CAAC,SAAS,EAEnE,QAAO,GAAG,qBAAqB,8BAA8B,MAAM;AAIrE,OAAI,gBAAgB;IAClB,MAAM,WAAW,QAAQ,OAAO,eAAc;AAC9C,QAAI,UAAU,MACZ,QAAO,SAAS;;AAIpB,UAAO;;;;;;;;;EAUT,MAAM,wBACJ,mBACyB;AACzB,OAAI,CAAC,eACH;GAGF,MAAM,WAAW,QAAQ,OAAO,eAAc;AAC9C,OACE,YACA,UAAU,YACV,MAAM,QAAQ,SAAS,KAAK,IAC5B,SAAS,KAAK,SAAS,EAEvB,QAAO,SAAS;;;EAOpB,MAAM,2BAA2B,eAAe;AAC9C,OAAI,CAAC,aAAa,QAAA,OAAO,IAAI,CAAC,QAAA,OAAO,qBACnC;AAEF,UAAO,qBAAqB,QAAA,OAAO,cAAa;IACjD;;;;;;EAOD,MAAM,gCACJ,yBAIiB;AACjB,OACE,yBAAyB,QACxB,OAAO,yBAAyB,YAC/B,OAAO,KAAK,qBAAqB,CAAC,WAAW,KAC/C,OAAO,yBAAyB,YAChC,EAAE,UAAU,sBAEZ,QAAO;IAEL,MAAM;IACN,GAAI,OAAO,yBAAyB,WAAW,uB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;KACnB,QAAQ,6BAA6B,QAAA,OAAO,qBAAoB;KACjE,SAAQ"}
1
+ {"version":3,"file":"SchemaObjectProperties.vue.script.js","names":[],"sources":["../../../../src/components/Content/Schema/SchemaObjectProperties.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type {\n DiscriminatorObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { sortPropertyNames } from '@/components/Content/Schema/helpers/sort-property-names'\nimport type { SchemaOptions } from '@/components/Content/Schema/types'\n\nimport SchemaProperty from './SchemaProperty.vue'\n\nconst { schema, discriminator, options, schemaContext, compositionPath } =\n defineProps<{\n schema: SchemaObject\n discriminator?: DiscriminatorObject\n compact?: boolean\n hideHeading?: boolean\n level?: number\n hideModelNames?: boolean\n breadcrumb?: string[]\n eventBus: WorkspaceEventBus | null\n options: SchemaOptions\n schemaContext?: string\n compositionPath?: string[]\n }>()\n\n/**\n * Sorts properties by required status first, then alphabetically.\n * Required properties appear first, followed by optional properties.\n */\nconst sortedProperties = computed(() =>\n sortPropertyNames(schema, discriminator, options),\n)\n\n/**\n * Get the display name for additional properties.\n *\n * Checks x-additionalPropertiesName extension first, then falls back to the\n * propertyNames schema title if available.\n */\nconst getAdditionalPropertiesName = (\n _additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n) => {\n const additionalProperties =\n typeof _additionalProperties === 'boolean'\n ? _additionalProperties\n : resolve.schema(_additionalProperties)\n\n if (\n typeof additionalProperties === 'object' &&\n typeof additionalProperties['x-additionalPropertiesName'] === 'string' &&\n additionalProperties['x-additionalPropertiesName'].trim().length > 0\n ) {\n return `${additionalProperties['x-additionalPropertiesName'].trim()}`\n }\n\n // Fall back to the propertyNames title when available\n if (_propertyNames) {\n const resolved = resolve.schema(_propertyNames)\n if (resolved?.title) {\n return resolved.title\n }\n }\n\n return 'propertyName'\n}\n\n/**\n * Extract enum values from the propertyNames schema.\n *\n * JSON Schema's propertyNames keyword constrains which keys are valid\n * in an object with additionalProperties. When it contains an enum,\n * these are the allowed key names.\n */\nconst getPropertyNamesEnum = (\n _propertyNames?: Extract<SchemaObject, { type: 'object' }>['propertyNames'],\n): string[] | undefined => {\n if (!_propertyNames) {\n return undefined\n }\n\n const resolved = resolve.schema(_propertyNames)\n if (\n resolved &&\n 'enum' in resolved &&\n Array.isArray(resolved.enum) &&\n resolved.enum.length > 0\n ) {\n return resolved.enum as string[]\n }\n\n return undefined\n}\n\n/** Enum values for the property keys, derived from propertyNames if present. */\nconst additionalPropertiesEnum = computed(() => {\n if (!isTypeObject(schema) || !schema.additionalProperties) {\n return undefined\n }\n return getPropertyNamesEnum(schema.propertyNames)\n})\n\n/**\n * Get the value for additional properties.\n *\n * When additionalProperties is true or an empty object, it should render as { type: 'anything' }.\n */\nconst getAdditionalPropertiesValue = (\n additionalProperties: Extract<\n SchemaObject,\n { type: 'object' }\n >['additionalProperties'],\n): SchemaObject => {\n if (\n additionalProperties === true ||\n (typeof additionalProperties === 'object' &&\n Object.keys(additionalProperties).length === 0) ||\n typeof additionalProperties !== 'object' ||\n !('type' in additionalProperties)\n ) {\n return {\n // @ts-expect-error - ask hans\n type: 'anything',\n ...(typeof additionalProperties === 'object' ? additionalProperties : {}),\n }\n }\n\n return additionalProperties\n}\n</script>\n\n<template>\n <!-- Properties -->\n <template v-if=\"isTypeObject(schema) && schema.properties\">\n <SchemaProperty\n v-for=\"property in sortedProperties\"\n :key=\"property\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"property\"\n :options=\"options\"\n :compositionPathSegment=\"property\"\n :compositionPath=\"compositionPath\"\n :required=\"schema.required?.includes(property)\"\n :schema=\"resolve.schema(schema.properties[property])\"\n :schemaContext=\"schemaContext\" />\n </template>\n\n <!-- patternProperties -->\n <template v-if=\"isTypeObject(schema) && schema.patternProperties\">\n <SchemaProperty\n v-for=\"[key, property] in Object.entries(schema.patternProperties)\"\n :key=\"key\"\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames=\"hideModelNames\"\n :level\n :name=\"key\"\n :options=\"options\"\n :compositionPathSegment=\"key\"\n :compositionPath=\"compositionPath\"\n :schema=\"resolve.schema(property)\"\n :schemaContext=\"schemaContext\" />\n </template>\n\n <!-- additionalProperties -->\n <template v-if=\"isTypeObject(schema) && schema.additionalProperties\">\n <SchemaProperty\n :breadcrumb\n :compact\n :discriminator\n :eventBus=\"eventBus\"\n :hideHeading\n :hideModelNames\n :level\n :name=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n noncollapsible\n :options=\"options\"\n :compositionPathSegment=\"\n getAdditionalPropertiesName(\n schema.additionalProperties,\n schema.propertyNames,\n )\n \"\n :compositionPath=\"compositionPath\"\n :schemaContext=\"schemaContext\"\n :propertyNamesEnum=\"additionalPropertiesEnum\"\n :schema=\"getAdditionalPropertiesValue(schema.additionalProperties)\"\n variant=\"additionalProperties\" />\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAkCA,MAAM,mBAAmB,eACvB,kBAAkB,QAAA,QAAQ,QAAA,eAAe,QAAA,QAAQ,CACnD;;;;;;;EAQA,MAAM,+BACJ,uBAIA,mBACG;GACH,MAAM,uBACJ,OAAO,0BAA0B,YAC7B,wBACA,QAAQ,OAAO,sBAAqB;AAE1C,OACE,OAAO,yBAAyB,YAChC,OAAO,qBAAqB,kCAAkC,YAC9D,qBAAqB,8BAA8B,MAAM,CAAC,SAAS,EAEnE,QAAO,GAAG,qBAAqB,8BAA8B,MAAM;AAIrE,OAAI,gBAAgB;IAClB,MAAM,WAAW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A,KAAA,EAC7C,mBAemC,UAAA,EAAA,KAAA,GAAA,EAAA,WAdP,OAAO,QAAQ,QAAA,OAAO,kBAAiB,GAAA,CAAzD,KAAK,cAAQ;yBADvB,YAemC,wBAAA;MAb3B;MACL,YAAA,QAAA;MACA,SAAA,QAAA;MACA,eAAA,QAAA;MACA,UAAU,QAAA;MACV,aAAA,QAAA;MACA,gBAAgB,QAAA;MAChB,OAAA,QAAA;MACA,MAAM;MACN,SAAS,QAAA;MACT,wBAAwB;MACxB,iBAAiB,QAAA;MACjB,QAAQ,MAAA,QAAO,CAAC,OAAO,SAAQ;MAC/B,eAAe,QAAA;;;;;;;;;;;;;;;;;IAIJ,MAAA,aAAY,CAAC,QAAA,OAAM,IAAK,QAAA,OAAO,wBAAA,WAAA,EAC7C,YA0BmC,wBAAA;;KAzBhC,YAAA,QAAA;KACA,SAAA,QAAA;KACA,eAAA,QAAA;KACA,UAAU,QAAA;KACV,aAAA,QAAA;KACA,gBAAA,QAAA;KACA,OAAA,QAAA;KACA,MAAe,4BAAuC,QAAA,OAAO,sBAAgC,QAAA,OAAO,cAAA;KAMrG,gBAAA;KACC,SAAS,QAAA;KACT,wBAAiC,4BAAuC,QAAA,OAAO,sBAAgC,QAAA,OAAO,cAAA;KAMtH,iBAAiB,QAAA;KACjB,eAAe,QAAA;KACf,mBAAmB,yBAAA;KACnB,QAAQ,6BAA6B,QAAA,OAAO,qBAAoB;KACjE,SAAQ"}
@@ -28,6 +28,12 @@ type __VLS_Props = {
28
28
  options: SchemaOptions;
29
29
  /** Enum values for property names (from JSON Schema propertyNames keyword). */
30
30
  propertyNamesEnum?: string[];
31
+ /** When "requestBody", composition selection is synced with the example snippet */
32
+ schemaContext?: string;
33
+ /** Internal path used to sync nested request body compositions with the code sample */
34
+ compositionPath?: string[];
35
+ /** Internal path segment for this property when building nested composition keys */
36
+ compositionPathSegment?: string;
31
37
  };
32
38
  declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
33
39
  level: number;
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaProperty.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Schema/SchemaProperty.vue"],"names":[],"mappings":"AAucA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAErE,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,KAAK,CAAA;AAI9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAetE;;;;;GAKG;AAEH,KAAK,WAAW,GAAG;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IAChC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,CAAC,EAAE,sBAAsB,GAAG,mBAAmB,CAAA;IACtD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,OAAO,EAAE,aAAa,CAAA;IACtB,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC7B,CAAC;AAqeJ,QAAA,MAAM,YAAY;WArfN,MAAM;cAEH,OAAO;aACR,OAAO;oBAGA,OAAO;6EAkf1B,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"SchemaProperty.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/Content/Schema/SchemaProperty.vue"],"names":[],"mappings":"AA8dA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAErE,OAAO,EAAY,KAAK,SAAS,EAAE,MAAM,KAAK,CAAA;AAI9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAetE;;;;;GAKG;AAEH,KAAK,WAAW,GAAG;IACf,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACvB,MAAM,EAAE,YAAY,GAAG,SAAS,CAAA;IAChC,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,aAAa,CAAC,EAAE,mBAAmB,CAAA;IACnC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,OAAO,CAAA;IACxB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,kGAAkG;IAClG,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,OAAO,CAAC,EAAE,sBAAsB,GAAG,mBAAmB,CAAA;IACtD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,OAAO,EAAE,aAAa,CAAA;IACtB,+EAA+E;IAC/E,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC5B,mFAAmF;IACnF,aAAa,CAAC,E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