@scalar/api-reference 1.64.1 → 1.65.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/browser/chunks/{AgentScalarChatInterface-D1mzA447.js → AgentScalarChatInterface-2lNB6wO-.js} +4 -4
- package/dist/browser/chunks/ScalarTextInput.vue-DVmXRWbS.js +27 -0
- package/dist/browser/chunks/basic-shape-diamond.svg-o5eiY2I7.js +1 -1
- package/dist/browser/chunks/basic-shape-hexagon.svg-CGuS7mbd.js +1 -1
- package/dist/browser/chunks/basic-shape-primary-circle-ellipse-round.svg-DDIpXiBm.js +1 -1
- package/dist/browser/chunks/basic-shape-primary-square-rectangle.svg-DzVEJHMB.js +1 -1
- package/dist/browser/chunks/basic-shape-shield.svg-BZzapRqv.js +1 -1
- package/dist/browser/chunks/browser-CTPPEMEL.js +1 -1
- package/dist/browser/chunks/computer-device-desktop-monitor.svg-OSM05r1I.js +1 -1
- package/dist/browser/chunks/computer-device-desktop.svg-BMFzGZ27.js +1 -1
- package/dist/browser/chunks/computer-device-laptop.svg-CMAjzuB-.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung-back.svg-D4xBONmL.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung.svg-gbMJLjJw.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x-back.svg-Bl1rmdKA.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x.svg-DVetP0aa.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-tablet-touch.svg-Zi88BP4L.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-tablet.svg-C1ggisWP.js +1 -1
- package/dist/browser/chunks/computer-device-network-ethernet-cat6.svg-BIUymdC1.js +1 -1
- package/dist/browser/chunks/computer-device-network-lan-www.svg-CoFUlIVO.js +1 -1
- package/dist/browser/chunks/computer-device-network-wifi-connection.svg-DeWsacxI.js +1 -1
- package/dist/browser/chunks/computer-device-network-wifi-router.svg-BjpZEot4.js +1 -1
- package/dist/browser/chunks/ecology-science-erlenmeyer-flask.svg-ftjGGirE.js +1 -1
- package/dist/browser/chunks/image-flash-lightning.svg-DYQ0W4Fi.js +1 -1
- package/dist/browser/chunks/image-picture-flower.svg-Bfe5SVDf.js +1 -1
- package/dist/browser/chunks/interface-alert-exclamation-diamond.svg-D1HePDNM.js +1 -1
- package/dist/browser/chunks/interface-alert-exclamation-triangle-warning.svg-CILUsxBC.js +1 -1
- package/dist/browser/chunks/interface-alert-information-circle.svg-9LrbJM5J.js +1 -1
- package/dist/browser/chunks/interface-award-crown.svg-DllWgiU1.js +1 -1
- package/dist/browser/chunks/interface-bookmark-tag.svg-Dc-JL-Kc.js +1 -1
- package/dist/browser/chunks/interface-bookmark.svg-Dc-JL-Kc.js +1 -1
- package/dist/browser/chunks/interface-calendar-date-one.svg-DO2jelhF.js +1 -1
- package/dist/browser/chunks/interface-content-book-open-pages.svg-BJjMjIgA.js +1 -1
- package/dist/browser/chunks/interface-content-book-page.svg-C6rKB2fs.js +1 -1
- package/dist/browser/chunks/interface-content-file.svg-CS0q2FKx.js +1 -1
- package/dist/browser/chunks/interface-content-folder.svg-CThTWsJX.js +1 -1
- package/dist/browser/chunks/interface-copy-clipboard.svg-DdN67cLv.js +1 -1
- package/dist/browser/chunks/interface-edit-attachment.svg-Ciizphuh.js +1 -1
- package/dist/browser/chunks/interface-edit-binocular.svg-Dw1nDqmL.js +1 -1
- package/dist/browser/chunks/interface-edit-magic-wand.svg-BYS0jm_E.js +1 -1
- package/dist/browser/chunks/interface-edit-tool-paint-roller.svg-NioSHZC2.js +1 -1
- package/dist/browser/chunks/interface-edit-tool-pencil.svg-P87QFlat.js +1 -1
- package/dist/browser/chunks/interface-favorite-award.svg-DBBAChSi.js +1 -1
- package/dist/browser/chunks/interface-favorite-flag.svg-HlhPomHY.js +1 -1
- package/dist/browser/chunks/interface-favorite-heart.svg-Cqu2GYDo.js +1 -1
- package/dist/browser/chunks/interface-favorite-star.svg-BD4JY_J2.js +1 -1
- package/dist/browser/chunks/interface-favorite-stars-sparkles.svg-BXi6aO8q.js +1 -1
- package/dist/browser/chunks/interface-hierarchy-flowchart.svg-CDEVSsD4.js +1 -1
- package/dist/browser/chunks/interface-home-house.svg-DJetUjwj.js +1 -1
- package/dist/browser/chunks/interface-hyperlink.svg-DJ1LREmz.js +1 -1
- package/dist/browser/chunks/interface-lighting-brightness.svg-TGKAaHYV.js +1 -1
- package/dist/browser/chunks/interface-lock-closed.svg-3hehWr3i.js +1 -1
- package/dist/browser/chunks/interface-lock-open-unlock.svg-CuXKcv1m.js +1 -1
- package/dist/browser/chunks/interface-login-key.svg-Chwvvywd.js +1 -1
- package/dist/browser/chunks/interface-search.svg-JDE3fk0u.js +1 -1
- package/dist/browser/chunks/interface-setting-cog.svg-BBCkeh4K.js +1 -1
- package/dist/browser/chunks/interface-share-megaphone-bullhorn.svg-CDdxF-4y.js +1 -1
- package/dist/browser/chunks/interface-share-rocket.svg-DSbdn_o7.js +1 -1
- package/dist/browser/chunks/interface-share-satellite.svg-CefBVZvY.js +1 -1
- package/dist/browser/chunks/interface-share-space-ship.svg-tFA2dsSU.js +1 -1
- package/dist/browser/chunks/interface-share.svg-BpOGopyv.js +1 -1
- package/dist/browser/chunks/interface-signal-square.svg-BcX_BoaC.js +1 -1
- package/dist/browser/chunks/interface-time-clock-circle.svg-C8B_L_RM.js +1 -1
- package/dist/browser/chunks/interface-time-hour-glass.svg-qw-oeoVn.js +1 -1
- package/dist/browser/chunks/interface-users-multiple.svg-Cs13Eewq.js +1 -1
- package/dist/browser/chunks/interface-weather-moon.svg-CV-oDTae.js +1 -1
- package/dist/browser/chunks/mail-chat-bubble-square.svg-dpauJhin.js +1 -1
- package/dist/browser/chunks/mail-send-email-paper-airplane.svg-BBofxojL.js +1 -1
- package/dist/browser/chunks/mail-send-envelope.svg-DyENgYOI.js +1 -1
- package/dist/browser/chunks/modal-70ibkEHi.js +102 -0
- package/dist/browser/chunks/money-cashier-receipt.svg-dNTr5aio.js +1 -1
- package/dist/browser/chunks/money-currency-dollar-pay.svg-1ZESPtFY.js +1 -1
- package/dist/browser/chunks/money-graph-arrow-increase.svg-kEZ2u2z2.js +1 -1
- package/dist/browser/chunks/money-graph-bar-chart-increase.svg-B-t2UWB3.js +1 -1
- package/dist/browser/chunks/nature-ecology-leaf.svg-DZ2GJV8m.js +1 -1
- package/dist/browser/chunks/phone-telephone.svg-C12QjpN7.js +1 -1
- package/dist/browser/chunks/programming-bug.svg-wLTsruN9.js +1 -1
- package/dist/browser/chunks/programming-cloud.svg-3XU6dNUg.js +1 -1
- package/dist/browser/chunks/programming-computer-database-server.svg-B1JrHSPd.js +1 -1
- package/dist/browser/chunks/programming-computer-database.svg-BxHSuFl7.js +1 -1
- package/dist/browser/chunks/programming-module-four-layout.svg-CeV35q45.js +1 -1
- package/dist/browser/chunks/programming-module-three.svg-YIBpLt45.js +1 -1
- package/dist/browser/chunks/programming-module.svg-CU_pEibI.js +1 -1
- package/dist/browser/chunks/programming-script-code.svg-CLzinmHT.js +1 -1
- package/dist/browser/chunks/runtime-core.esm-bundler-CqqEw5ds.js +1 -1
- package/dist/browser/chunks/shopping-cart.svg-Brzddu3K.js +1 -1
- package/dist/browser/chunks/shopping-gift-present.svg-l2K48g7L.js +1 -1
- package/dist/browser/chunks/shopping-shipping-box-parcel-package.svg-DesGopPo.js +1 -1
- package/dist/browser/chunks/tag-new-circle.svg-DE-VaLZU.js +1 -1
- package/dist/browser/chunks/travel-map-earth-globe.svg-DLaOMzx6.js +1 -1
- package/dist/browser/chunks/vendor-BcTep96u.js +306 -0
- package/dist/browser/standalone.esm.js +20 -20
- package/dist/browser/standalone.js +235 -232
- package/dist/components/AgentScalar/OpenMCPButton.vue.d.ts.map +1 -1
- package/dist/components/AgentScalar/OpenMCPButton.vue.js +1 -1
- package/dist/components/AgentScalar/OpenMCPButton.vue.js.map +1 -1
- package/dist/components/AgentScalar/OpenMCPButton.vue.script.js.map +1 -1
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue.js.map +1 -1
- package/dist/components/ApiReference.vue.script.js +8 -8
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/index.d.ts +3 -0
- package/dist/components/Content/AsyncApi/index.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js +5 -0
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts +6 -0
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.script.js +5 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/helpers/get-ref-name.d.ts +16 -0
- package/dist/components/Content/Schema/helpers/get-ref-name.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/get-ref-name.js +28 -1
- package/dist/components/Content/Schema/helpers/get-ref-name.js.map +1 -1
- package/dist/components/Content/Schema/helpers/is-model-linkable.d.ts +15 -0
- package/dist/components/Content/Schema/helpers/is-model-linkable.d.ts.map +1 -0
- package/dist/components/Content/Schema/helpers/is-model-linkable.js +22 -0
- package/dist/components/Content/Schema/helpers/is-model-linkable.js.map +1 -0
- package/dist/components/Content/Schema/helpers/schema-name.d.ts +6 -1
- package/dist/components/Content/Schema/helpers/schema-name.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/schema-name.js +5 -4
- package/dist/components/Content/Schema/helpers/schema-name.js.map +1 -1
- package/dist/components/Content/Schema/types.d.ts +7 -0
- package/dist/components/Content/Schema/types.d.ts.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +5 -1
- package/dist/features/Operation/components/Header.vue.d.ts +2 -0
- package/dist/features/Operation/components/Header.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/Header.vue.js.map +1 -1
- package/dist/features/Operation/components/Header.vue.script.js +3 -1
- package/dist/features/Operation/components/Header.vue.script.js.map +1 -1
- package/dist/features/Operation/components/Headers.vue.d.ts +2 -0
- package/dist/features/Operation/components/Headers.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/Headers.vue.js +1 -1
- package/dist/features/Operation/components/Headers.vue.js.map +1 -1
- package/dist/features/Operation/components/Headers.vue.script.js +4 -1
- package/dist/features/Operation/components/Headers.vue.script.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.script.js +2 -2
- package/dist/features/Operation/components/OperationParameters.vue.script.js.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.script.js +3 -0
- package/dist/features/Operation/components/ParameterListItem.vue.script.js.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.script.js +10 -1
- package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.d.ts.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.js.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.script.js +2 -2
- package/dist/features/Search/components/SearchResult.vue.script.js.map +1 -1
- package/dist/helpers/build-models-index.d.ts +15 -0
- package/dist/helpers/build-models-index.d.ts.map +1 -0
- package/dist/helpers/build-models-index.js +28 -0
- package/dist/helpers/build-models-index.js.map +1 -0
- package/dist/helpers/storage.d.ts +16 -0
- package/dist/helpers/storage.d.ts.map +1 -1
- package/dist/style.css +418 -409
- package/dist/vue-styles.css +370 -361
- package/package.json +12 -12
- package/dist/browser/chunks/ScalarTextInput.vue-OfiA6SHf.js +0 -27
- package/dist/browser/chunks/modal-BS4e2gew.js +0 -99
- package/dist/browser/chunks/vendor-DWZAEyBy.js +0 -306
- package/dist/features/Operation/helpers/should-ignore-entity.d.ts +0 -8
- package/dist/features/Operation/helpers/should-ignore-entity.d.ts.map +0 -1
- package/dist/features/Operation/helpers/should-ignore-entity.js +0 -9
- package/dist/features/Operation/helpers/should-ignore-entity.js.map +0 -1
|
@@ -4,6 +4,7 @@ import { isTypeObject } from "../../../components/Content/Schema/helpers/is-type
|
|
|
4
4
|
import { getModelNameFromSchema } from "../../../components/Content/Schema/helpers/schema-name.js";
|
|
5
5
|
import { reduceNamesToObject, sortPropertyNames } from "../../../components/Content/Schema/helpers/sort-property-names.js";
|
|
6
6
|
import LinkButton_default from "../../../components/Content/Schema/LinkButton.vue.js";
|
|
7
|
+
import { isModelLinkable } from "../../../components/Content/Schema/helpers/is-model-linkable.js";
|
|
7
8
|
import Schema_default from "../../../components/Content/Schema/Schema.vue.js";
|
|
8
9
|
import ContentTypeSelect_default from "./ContentTypeSelect.vue.js";
|
|
9
10
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, renderSlot, toDisplayString, unref, useModel, withCtx } from "vue";
|
|
@@ -64,6 +65,11 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
64
65
|
const schema = computed(() => getResolvedRef(rawSchema.value));
|
|
65
66
|
/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */
|
|
66
67
|
const modelLink = computed(() => (rawSchema.value && getModelNameFromSchema(rawSchema.value)) ?? null);
|
|
68
|
+
/** Whether the model name links to the models section, or renders as plain text. */
|
|
69
|
+
const modelLinkable = computed(() => isModelLinkable(modelLink.value?.schemaKey, {
|
|
70
|
+
hideModels: __props.options.hideModels,
|
|
71
|
+
document: __props.document
|
|
72
|
+
}));
|
|
67
73
|
/**
|
|
68
74
|
* Splits schema properties into visible and collapsed sections when there are more than 12 properties.
|
|
69
75
|
* Returns null for schemas with fewer properties or non-object schemas.
|
|
@@ -105,7 +111,7 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
105
111
|
class: "request-body",
|
|
106
112
|
role: "group"
|
|
107
113
|
}, [createElementVNode("div", _hoisted_2, [
|
|
108
|
-
createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "title", {}, void 0, true), modelLink.value ? (openBlock(), createElementBlock("span", _hoisted_4, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "text-c-3 mx-1.5" }, "·", -1)), __props.eventBus && modelLink.value.schemaKey ? (openBlock(), createBlock(LinkButton_default, {
|
|
114
|
+
createElementVNode("div", _hoisted_3, [renderSlot(_ctx.$slots, "title", {}, void 0, true), modelLink.value ? (openBlock(), createElementBlock("span", _hoisted_4, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "text-c-3 mx-1.5" }, "·", -1)), __props.eventBus && modelLink.value.schemaKey && modelLinkable.value ? (openBlock(), createBlock(LinkButton_default, {
|
|
109
115
|
key: 0,
|
|
110
116
|
onClick: _cache[0] || (_cache[0] = ($event) => __props.eventBus.emit("scroll-to:model-by-name", { name: modelLink.value.schemaKey }))
|
|
111
117
|
}, {
|
|
@@ -130,6 +136,7 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
130
136
|
orderRequiredPropertiesFirst: __props.options.orderRequiredPropertiesFirst,
|
|
131
137
|
orderSchemaPropertiesBy: __props.options.orderSchemaPropertiesBy,
|
|
132
138
|
expandAllSchemaProperties: __props.options.expandAllSchemaProperties,
|
|
139
|
+
hideModels: __props.options.hideModels,
|
|
133
140
|
document: __props.document
|
|
134
141
|
},
|
|
135
142
|
schema: partitionedSchema.value.visibleProperties,
|
|
@@ -153,6 +160,7 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
153
160
|
orderRequiredPropertiesFirst: __props.options.orderRequiredPropertiesFirst,
|
|
154
161
|
orderSchemaPropertiesBy: __props.options.orderSchemaPropertiesBy,
|
|
155
162
|
expandAllSchemaProperties: __props.options.expandAllSchemaProperties,
|
|
163
|
+
hideModels: __props.options.hideModels,
|
|
156
164
|
document: __props.document
|
|
157
165
|
},
|
|
158
166
|
schema: partitionedSchema.value.collapsedProperties,
|
|
@@ -176,6 +184,7 @@ var RequestBody_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defi
|
|
|
176
184
|
orderRequiredPropertiesFirst: __props.options.orderRequiredPropertiesFirst,
|
|
177
185
|
orderSchemaPropertiesBy: __props.options.orderSchemaPropertiesBy,
|
|
178
186
|
expandAllSchemaProperties: __props.options.expandAllSchemaProperties,
|
|
187
|
+
hideModels: __props.options.hideModels,
|
|
179
188
|
document: __props.document
|
|
180
189
|
},
|
|
181
190
|
schema: schema.value,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestBody.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/RequestBody.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n OpenApiDocument,\n RequestBodyObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { Schema } from '@/components/Content/Schema'\nimport { inferDiscriminatorMappingComposition } from '@/components/Content/Schema/helpers/get-compositions-to-render'\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { getModelNameFromSchema } from '@/components/Content/Schema/helpers/schema-name'\nimport {\n reduceNamesToObject,\n sortPropertyNames,\n} from '@/components/Content/Schema/helpers/sort-property-names'\nimport LinkButton from '@/components/Content/Schema/LinkButton.vue'\nimport { useLocalization } from '@/features/localization'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\n\nconst { requestBody, options, document } = defineProps<{\n breadcrumb?: string[]\n requestBody?: RequestBodyObject\n eventBus: WorkspaceEventBus | null\n /** The document the request body belongs to, used to resolve schema references for display */\n document?: OpenApiDocument\n options: {\n orderRequiredPropertiesFirst: boolean | undefined\n orderSchemaPropertiesBy: 'alpha' | 'preserve' | undefined\n hideModels: boolean | undefined\n expandAllSchemaProperties: boolean | undefined\n }\n}>()\nconst { translate } = useLocalization()\n\n/**\n * The maximum number of properties to show in the request body schema.\n */\nconst MAX_VISIBLE_PROPERTIES = 12\n\nconst availableContentTypes = computed(() =>\n Object.keys(requestBody?.content ?? {}),\n)\n\nconst selectedContentType = defineModel<string>('selectedContentType', {\n default: 'application/json',\n})\n\nif (requestBody?.content) {\n if (availableContentTypes.value[0]) {\n selectedContentType.value = availableContentTypes.value[0]\n }\n}\n\n/** Raw schema (possibly with $ref) for the selected content type */\nconst rawSchema = computed(\n () => requestBody?.content?.[selectedContentType.value]?.schema,\n)\n\nconst schema = computed(() => getResolvedRef(rawSchema.value))\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst modelLink = computed(\n () => (rawSchema.value && getModelNameFromSchema(rawSchema.value)) ?? null,\n)\n\n/**\n * Splits schema properties into visible and collapsed sections when there are more than 12 properties.\n * Returns null for schemas with fewer properties or non-object schemas.\n */\nconst partitionedSchema = computed(() => {\n // Early return if not an object schema\n if (!schema.value || !isTypeObject(schema.value)) {\n return null\n }\n\n // A schema whose variants are inferred from a `discriminator.mapping` renders\n // as a single variant selector, not a flat property list. Splitting it would\n // duplicate that selector across the visible and collapsed blocks, so we keep\n // it whole. See https://github.com/scalar/scalar/issues/7472\n if (inferDiscriminatorMappingComposition(schema.value, document)) {\n return null\n }\n\n // Lets sort the names first\n const sortedNames = sortPropertyNames(\n schema.value,\n schema.value.discriminator,\n {\n hideReadOnly: true,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n },\n )\n\n if (sortedNames.length <= MAX_VISIBLE_PROPERTIES) {\n return null\n }\n\n // Destructure everything except properties\n const { properties, ...schemaMetadata } = schema.value\n if (!properties) {\n return null\n }\n\n return {\n visibleProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(0, MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n collapsedProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n }\n})\n\n/**\n * We don't want to render the request body if its completely empty\n * @example\n * {\n * \"content\": {},\n * }\n */\nconst shouldRenderRequestBody = computed(\n () =>\n Object.keys(requestBody?.content ?? {}).length > 0 ||\n requestBody?.description ||\n requestBody?.required,\n)\n</script>\n<template>\n <div\n v-if=\"requestBody && shouldRenderRequestBody\"\n :aria-label=\"translate('operation.requestBody')\"\n class=\"request-body\"\n role=\"group\">\n <div class=\"request-body-header\">\n <div class=\"request-body-title\">\n <slot name=\"title\" />\n <span\n v-if=\"modelLink\"\n class=\"text-c-2 text-xs leading-none font-normal\"\n data-testid=\"request-body-schema-name\">\n <span class=\"text-c-3 mx-1.5\">·</span>\n <LinkButton\n v-if=\"eventBus && modelLink.schemaKey\"\n @click=\"\n eventBus.emit('scroll-to:model-by-name', {\n name: modelLink.schemaKey,\n })\n \">\n {{ modelLink.label }}\n </LinkButton>\n <template v-else>{{ modelLink.label }}</template>\n </span>\n </div>\n <div class=\"flex items-center gap-2\">\n <div\n v-if=\"requestBody.required\"\n class=\"request-body-required\">\n {{ translate('common.required') }}\n </div>\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"requestBody.content\" />\n </div>\n <div\n v-if=\"requestBody.description\"\n class=\"request-body-description\">\n <ScalarMarkdown :value=\"requestBody.description\" />\n </div>\n </div>\n\n <!-- For over 12 properties we want to show 12 and collapse the rest -->\n <div\n v-if=\"partitionedSchema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n :name=\"translate('operation.requestBody')\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n expandAllSchemaProperties: options.expandAllSchemaProperties,\n document,\n }\"\n :schema=\"partitionedSchema.visibleProperties\"\n schemaContext=\"requestBody\" />\n\n <Schema\n additionalProperties\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n hideDescription\n :name=\"translate('operation.requestBody')\"\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n expandAllSchemaProperties: options.expandAllSchemaProperties,\n document,\n }\"\n :schema=\"partitionedSchema.collapsedProperties\"\n schemaContext=\"requestBody\" />\n </div>\n\n <!-- Show em all 12 and under -->\n <div\n v-else-if=\"schema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n :hideReadOnly=\"true\"\n :name=\"translate('operation.requestBody')\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n expandAllSchemaProperties: options.expandAllSchemaProperties,\n document,\n }\"\n :schema=\"schema\"\n schemaContext=\"requestBody\" />\n </div>\n </div>\n</template>\n\n<style scoped>\n.request-body {\n margin-top: 24px;\n}\n.request-body-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-bottom: 12px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n flex-flow: wrap;\n}\n.request-body-title {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--scalar-font-size-2);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-1);\n}\n.request-body-required {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-orange);\n font-weight: normal;\n border-radius: 16px;\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 2px 8px;\n height: 20px;\n}\n.request-body-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n width: 100%;\n}\n\n.request-body-header\n + .request-body-schema:has(> .schema-card > .schema-card-description),\n.request-body-header\n + .request-body-schema:has(\n > .schema-card > .schema-properties > * > .property--level-0\n ) {\n /** Add a bit of space between the heading border and the schema description or properties */\n padding-top: 8px;\n}\n.request-body-description :deep(.markdown) * {\n color: var(--scalar-color-2) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyCA,IAAM,yBAAyB;;;;;;;;;;;;;;;EAL/B,MAAM,EAAE,cAAc,gBAAgB;;;;EAOtC,MAAM,wBAAwB,eAC5B,OAAO,KAAK,QAAA,aAAa,WAAW,CAAC,CAAC,CACxC;EAEA,MAAM,sBAAsB,SAAmB,SAAC,qBAE/C;EAED,IAAI,QAAA,aAAa;OACX,sBAAsB,MAAM,IAC9B,oBAAoB,QAAQ,sBAAsB,MAAM;EAAA;;EAK5D,MAAM,YAAY,eACV,QAAA,aAAa,UAAU,oBAAoB,MAAM,EAAE,MAC3D;EAEA,MAAM,SAAS,eAAe,eAAe,UAAU,KAAK,CAAC;;EAG7D,MAAM,YAAY,gBACT,UAAU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,iBAAA;IACC,MAAM,MAAA,SAAA,CAAS,CAAA,uBAAA;IACf,SAAO;;mCAA0E,QAAA,QAAQ;8BAAiE,QAAA,QAAQ;gCAA8D,QAAA,QAAQ;eAAqC,QAAA;;IAO7Q,QAAQ,kBAAA,MAAkB;IAC3B,eAAc;;;;;;;WAKL,OAAA,SAAA,UAAA,GADb,mBAoBM,OApBN,YAoBM,CAjBJ,YAgBgC,MAAA,cAAA,GAAA;IAf7B,YAAA,QAAA;IACD,SAAA;IACC,iBAAiB,CAAA,aAAA;IACjB,UAAU,QAAA;IACV,cAAc;IACd,MAAM,MAAA,SAAA,CAAS,CAAA,uBAAA;IAChB,gBAAA;IACC,SAAO;;mCAA0E,QAAA,QAAQ;8BAAiE,QAAA,QAAQ;gCAA8D,QAAA,QAAQ;eAAqC,QAAA;;IAO7Q,QAAQ,OAAA;IACT,eAAc"}
|
|
1
|
+
{"version":3,"file":"RequestBody.vue.script.js","names":[],"sources":["../../../../src/features/Operation/components/RequestBody.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n OpenApiDocument,\n RequestBodyObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { Schema } from '@/components/Content/Schema'\nimport { inferDiscriminatorMappingComposition } from '@/components/Content/Schema/helpers/get-compositions-to-render'\nimport { isModelLinkable } from '@/components/Content/Schema/helpers/is-model-linkable'\nimport { isTypeObject } from '@/components/Content/Schema/helpers/is-type-object'\nimport { getModelNameFromSchema } from '@/components/Content/Schema/helpers/schema-name'\nimport {\n reduceNamesToObject,\n sortPropertyNames,\n} from '@/components/Content/Schema/helpers/sort-property-names'\nimport LinkButton from '@/components/Content/Schema/LinkButton.vue'\nimport { useLocalization } from '@/features/localization'\n\nimport ContentTypeSelect from './ContentTypeSelect.vue'\n\nconst { requestBody, options, document } = defineProps<{\n breadcrumb?: string[]\n requestBody?: RequestBodyObject\n eventBus: WorkspaceEventBus | null\n /** The document the request body belongs to, used to resolve schema references for display */\n document?: OpenApiDocument\n options: {\n orderRequiredPropertiesFirst: boolean | undefined\n orderSchemaPropertiesBy: 'alpha' | 'preserve' | undefined\n hideModels: boolean | undefined\n expandAllSchemaProperties: boolean | undefined\n }\n}>()\nconst { translate } = useLocalization()\n\n/**\n * The maximum number of properties to show in the request body schema.\n */\nconst MAX_VISIBLE_PROPERTIES = 12\n\nconst availableContentTypes = computed(() =>\n Object.keys(requestBody?.content ?? {}),\n)\n\nconst selectedContentType = defineModel<string>('selectedContentType', {\n default: 'application/json',\n})\n\nif (requestBody?.content) {\n if (availableContentTypes.value[0]) {\n selectedContentType.value = availableContentTypes.value[0]\n }\n}\n\n/** Raw schema (possibly with $ref) for the selected content type */\nconst rawSchema = computed(\n () => requestBody?.content?.[selectedContentType.value]?.schema,\n)\n\nconst schema = computed(() => getResolvedRef(rawSchema.value))\n\n/** When the schema is a $ref, preserve its name so the UI can show the ref name instead of just the type. */\nconst modelLink = computed(\n () => (rawSchema.value && getModelNameFromSchema(rawSchema.value)) ?? null,\n)\n\n/** Whether the model name links to the models section, or renders as plain text. */\nconst modelLinkable = computed(() =>\n isModelLinkable(modelLink.value?.schemaKey, {\n hideModels: options.hideModels,\n document,\n }),\n)\n\n/**\n * Splits schema properties into visible and collapsed sections when there are more than 12 properties.\n * Returns null for schemas with fewer properties or non-object schemas.\n */\nconst partitionedSchema = computed(() => {\n // Early return if not an object schema\n if (!schema.value || !isTypeObject(schema.value)) {\n return null\n }\n\n // A schema whose variants are inferred from a `discriminator.mapping` renders\n // as a single variant selector, not a flat property list. Splitting it would\n // duplicate that selector across the visible and collapsed blocks, so we keep\n // it whole. See https://github.com/scalar/scalar/issues/7472\n if (inferDiscriminatorMappingComposition(schema.value, document)) {\n return null\n }\n\n // Lets sort the names first\n const sortedNames = sortPropertyNames(\n schema.value,\n schema.value.discriminator,\n {\n hideReadOnly: true,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n },\n )\n\n if (sortedNames.length <= MAX_VISIBLE_PROPERTIES) {\n return null\n }\n\n // Destructure everything except properties\n const { properties, ...schemaMetadata } = schema.value\n if (!properties) {\n return null\n }\n\n return {\n visibleProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(0, MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n collapsedProperties: {\n ...schemaMetadata,\n properties: reduceNamesToObject(\n sortedNames.slice(MAX_VISIBLE_PROPERTIES),\n properties,\n ),\n },\n }\n})\n\n/**\n * We don't want to render the request body if its completely empty\n * @example\n * {\n * \"content\": {},\n * }\n */\nconst shouldRenderRequestBody = computed(\n () =>\n Object.keys(requestBody?.content ?? {}).length > 0 ||\n requestBody?.description ||\n requestBody?.required,\n)\n</script>\n<template>\n <div\n v-if=\"requestBody && shouldRenderRequestBody\"\n :aria-label=\"translate('operation.requestBody')\"\n class=\"request-body\"\n role=\"group\">\n <div class=\"request-body-header\">\n <div class=\"request-body-title\">\n <slot name=\"title\" />\n <span\n v-if=\"modelLink\"\n class=\"text-c-2 text-xs leading-none font-normal\"\n data-testid=\"request-body-schema-name\">\n <span class=\"text-c-3 mx-1.5\">·</span>\n <LinkButton\n v-if=\"eventBus && modelLink.schemaKey && modelLinkable\"\n @click=\"\n eventBus.emit('scroll-to:model-by-name', {\n name: modelLink.schemaKey,\n })\n \">\n {{ modelLink.label }}\n </LinkButton>\n <template v-else>{{ modelLink.label }}</template>\n </span>\n </div>\n <div class=\"flex items-center gap-2\">\n <div\n v-if=\"requestBody.required\"\n class=\"request-body-required\">\n {{ translate('common.required') }}\n </div>\n <ContentTypeSelect\n v-model=\"selectedContentType\"\n :content=\"requestBody.content\" />\n </div>\n <div\n v-if=\"requestBody.description\"\n class=\"request-body-description\">\n <ScalarMarkdown :value=\"requestBody.description\" />\n </div>\n </div>\n\n <!-- For over 12 properties we want to show 12 and collapse the rest -->\n <div\n v-if=\"partitionedSchema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n :name=\"translate('operation.requestBody')\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n expandAllSchemaProperties: options.expandAllSchemaProperties,\n hideModels: options.hideModels,\n document,\n }\"\n :schema=\"partitionedSchema.visibleProperties\"\n schemaContext=\"requestBody\" />\n\n <Schema\n additionalProperties\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n hideDescription\n :name=\"translate('operation.requestBody')\"\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n expandAllSchemaProperties: options.expandAllSchemaProperties,\n hideModels: options.hideModels,\n document,\n }\"\n :schema=\"partitionedSchema.collapsedProperties\"\n schemaContext=\"requestBody\" />\n </div>\n\n <!-- Show em all 12 and under -->\n <div\n v-else-if=\"schema\"\n class=\"request-body-schema\">\n <Schema\n :breadcrumb\n compact\n :compositionPath=\"['requestBody']\"\n :eventBus=\"eventBus\"\n :hideReadOnly=\"true\"\n :name=\"translate('operation.requestBody')\"\n noncollapsible\n :options=\"{\n hideReadOnly: true,\n orderRequiredPropertiesFirst: options.orderRequiredPropertiesFirst,\n orderSchemaPropertiesBy: options.orderSchemaPropertiesBy,\n expandAllSchemaProperties: options.expandAllSchemaProperties,\n hideModels: options.hideModels,\n document,\n }\"\n :schema=\"schema\"\n schemaContext=\"requestBody\" />\n </div>\n </div>\n</template>\n\n<style scoped>\n.request-body {\n margin-top: 24px;\n}\n.request-body-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding-bottom: 12px;\n border-bottom: var(--scalar-border-width) solid var(--scalar-border-color);\n flex-flow: wrap;\n}\n.request-body-title {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--scalar-font-size-2);\n font-weight: var(--scalar-semibold);\n color: var(--scalar-color-1);\n}\n.request-body-required {\n font-size: var(--scalar-micro);\n color: var(--scalar-color-orange);\n font-weight: normal;\n border-radius: 16px;\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n padding: 2px 8px;\n height: 20px;\n}\n.request-body-description {\n margin-top: 6px;\n font-size: var(--scalar-small);\n width: 100%;\n}\n\n.request-body-header\n + .request-body-schema:has(> .schema-card > .schema-card-description),\n.request-body-header\n + .request-body-schema:has(\n > .schema-card > .schema-properties > * > .property--level-0\n ) {\n /** Add a bit of space between the heading border and the schema description or properties */\n padding-top: 8px;\n}\n.request-body-description :deep(.markdown) * {\n color: var(--scalar-color-2) !important;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,IAAM,yBAAyB;;;;;;;;;;;;;;;EAL/B,MAAM,EAAE,cAAc,gBAAgB;;;;EAOtC,MAAM,wBAAwB,eAC5B,OAAO,KAAK,QAAA,aAAa,WAAW,CAAC,CAAC,CACxC;EAEA,MAAM,sBAAsB,SAAmB,SAAC,qBAE/C;EAED,IAAI,QAAA,aAAa;OACX,sBAAsB,MAAM,IAC9B,oBAAoB,QAAQ,sBAAsB,MAAM;EAAA;;EAK5D,MAAM,YAAY,eACV,QAAA,aAAa,UAAU,oBAAoB,MAAM,EAAE,MAC3D;EAEA,MAAM,SAAS,eAAe,eAAe,UAAU,KAAK,CAAC;;EAG7D,MAAM,YAAY,gBACT,UAAU,SAAS,uBAAuB,UAAU,KAAK,MAAM,IACxE;;EAGA,MAAM,gBAAgB,eACpB,gBAAgB,UAAU,OAAO,WAAW;GAC1C,YAAY,QAAA,QAAQ;GACpB,UAAO,QAAA;EACT,CAAC,CACH;;;;;EAMA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MAAM,MAAA,SAAA,CAAS,CAAA,uBAAA;IACf,SAAO;;mCAA0E,QAAA,QAAQ;8BAAiE,QAAA,QAAQ;gCAA8D,QAAA,QAAQ;iBAAiD,QAAA,QAAQ;eAAsB,QAAA;;IAQvT,QAAQ,kBAAA,MAAkB;IAC3B,eAAc;;;;;;;WAKL,OAAA,SAAA,UAAA,GADb,mBAqBM,OArBN,YAqBM,CAlBJ,YAiBgC,MAAA,cAAA,GAAA;IAhB7B,YAAA,QAAA;IACD,SAAA;IACC,iBAAiB,CAAA,aAAA;IACjB,UAAU,QAAA;IACV,cAAc;IACd,MAAM,MAAA,SAAA,CAAS,CAAA,uBAAA;IAChB,gBAAA;IACC,SAAO;;mCAA0E,QAAA,QAAQ;8BAAiE,QAAA,QAAQ;gCAA8D,QAAA,QAAQ;iBAAiD,QAAA,QAAQ;eAAsB,QAAA;;IAQvT,QAAQ,OAAA;IACT,eAAc"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResult.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/components/SearchResult.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchResult.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/components/SearchResult.vue"],"names":[],"mappings":"AAgHA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAIzC,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAElE,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,OAAO,CAAA;IACnB,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;IAC5B,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;CACxC,CAAC;AAiJF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResult.vue.js","names":[],"sources":["../../../../src/features/Search/components/SearchResult.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarSearchResultItem } from '@scalar/components/search-results'\nimport {\n ScalarIconBracketsCurly,\n ScalarIconTag,\n ScalarIconTerminalWindow,\n ScalarIconTextAlignLeft,\n} from '@scalar/icons'\nimport type { ScalarIconComponent } from '@scalar/icons/types'\nimport { HttpMethod } from '@scalar/sidebar'\nimport {\n DEFAULT_MODELS_SECTION_LABEL,\n type ModelsSectionLabel,\n} from '@scalar/types/api-reference'\nimport type { FuseResult } from 'fuse.js'\nimport { computed } from 'vue'\n\nimport { useLocalization } from '@/features/localization'\nimport type { EntryType, FuseData } from '@/features/Search/types'\n\nconst { modelsSectionLabel = DEFAULT_MODELS_SECTION_LABEL } = defineProps<{\n id: string\n isSelected: boolean\n result: FuseResult<FuseData>\n modelsSectionLabel?: ModelsSectionLabel\n}>()\nconst { translate } = useLocalization()\n\nconst ENTRY_ICONS: { [x in EntryType]: ScalarIconComponent } = {\n heading: ScalarIconTextAlignLeft,\n model: ScalarIconBracketsCurly,\n operation: ScalarIconTerminalWindow,\n tag: ScalarIconTag,\n webhook:
|
|
1
|
+
{"version":3,"file":"SearchResult.vue.js","names":[],"sources":["../../../../src/features/Search/components/SearchResult.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarSearchResultItem } from '@scalar/components/search-results'\nimport {\n ScalarIconBracketsCurly,\n ScalarIconTag,\n ScalarIconTerminalWindow,\n ScalarIconTextAlignLeft,\n ScalarIconWebhooksLogo,\n} from '@scalar/icons'\nimport type { ScalarIconComponent } from '@scalar/icons/types'\nimport { HttpMethod } from '@scalar/sidebar'\nimport {\n DEFAULT_MODELS_SECTION_LABEL,\n type ModelsSectionLabel,\n} from '@scalar/types/api-reference'\nimport type { FuseResult } from 'fuse.js'\nimport { computed } from 'vue'\n\nimport { useLocalization } from '@/features/localization'\nimport type { EntryType, FuseData } from '@/features/Search/types'\n\nconst { modelsSectionLabel = DEFAULT_MODELS_SECTION_LABEL } = defineProps<{\n id: string\n isSelected: boolean\n result: FuseResult<FuseData>\n modelsSectionLabel?: ModelsSectionLabel\n}>()\nconst { translate } = useLocalization()\n\nconst ENTRY_ICONS: { [x in EntryType]: ScalarIconComponent } = {\n heading: ScalarIconTextAlignLeft,\n model: ScalarIconBracketsCurly,\n operation: ScalarIconTerminalWindow,\n tag: ScalarIconTag,\n webhook: ScalarIconWebhooksLogo,\n}\n\nconst entryLabels = computed((): { [x in EntryType]: string } => ({\n heading: translate('search.entryHeading'),\n operation: translate('search.entryOperation'),\n tag: translate('search.entryTag'),\n model: modelsSectionLabel,\n webhook: translate('search.entryWebhook'),\n}))\n</script>\n\n<template>\n <ScalarSearchResultItem\n :id=\"id\"\n :icon=\"ENTRY_ICONS[result.item.type]\"\n :selected=\"isSelected\">\n <span\n :class=\"{\n 'text-decoration-line':\n result.item.entry.type === 'operation' &&\n result.item.entry.isDeprecated,\n }\">\n <span class=\"sr-only\">\n {{ entryLabels[result.item.type] }}: \n <template\n v-if=\"\n result.item.entry.type === 'operation' &&\n result.item.entry.isDeprecated\n \">\n ({{ translate('common.deprecated') }}) \n </template>\n </span>\n {{ result.item.title }}\n <span class=\"sr-only\">,</span>\n </span>\n <template\n v-if=\"\n result.item.type !== 'webhook' &&\n (result.item.method || result.item.path) &&\n result.item.path !== result.item.title\n \"\n #description>\n <span class=\"inline-flex items-center gap-1\">\n <template v-if=\"result.item.type === 'operation'\">\n <HttpMethod\n aria-hidden=\"true\"\n :method=\"result.item.method ?? 'get'\" />\n <span class=\"sr-only\">\n {{ translate('common.httpMethod') }}:\n {{ result.item.method ?? 'get' }}\n </span>\n </template>\n <span class=\"sr-only\">{{ translate('common.path') }}: </span>\n {{ result.item.path }}\n </span>\n </template>\n <template\n v-else-if=\"result.item.description\"\n #description>\n <span class=\"sr-only\">{{ translate('common.description') }}: </span>\n {{ result.item.description }}\n </template>\n </ScalarSearchResultItem>\n</template>\n"],"mappings":""}
|
|
@@ -2,7 +2,7 @@ import { useLocalization } from "../../localization/use-localization.js";
|
|
|
2
2
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
3
3
|
import { HttpMethod } from "@scalar/sidebar";
|
|
4
4
|
import { DEFAULT_MODELS_SECTION_LABEL } from "@scalar/types/api-reference";
|
|
5
|
-
import { ScalarIconBracketsCurly, ScalarIconTag, ScalarIconTerminalWindow, ScalarIconTextAlignLeft } from "@scalar/icons";
|
|
5
|
+
import { ScalarIconBracketsCurly, ScalarIconTag, ScalarIconTerminalWindow, ScalarIconTextAlignLeft, ScalarIconWebhooksLogo } from "@scalar/icons";
|
|
6
6
|
import { ScalarSearchResultItem } from "@scalar/components/search-results";
|
|
7
7
|
//#region src/features/Search/components/SearchResult.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var _hoisted_1 = { class: "sr-only" };
|
|
@@ -25,7 +25,7 @@ var SearchResult_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ def
|
|
|
25
25
|
model: ScalarIconBracketsCurly,
|
|
26
26
|
operation: ScalarIconTerminalWindow,
|
|
27
27
|
tag: ScalarIconTag,
|
|
28
|
-
webhook:
|
|
28
|
+
webhook: ScalarIconWebhooksLogo
|
|
29
29
|
};
|
|
30
30
|
const entryLabels = computed(() => ({
|
|
31
31
|
heading: translate("search.entryHeading"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchResult.vue.script.js","names":[],"sources":["../../../../src/features/Search/components/SearchResult.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarSearchResultItem } from '@scalar/components/search-results'\nimport {\n ScalarIconBracketsCurly,\n ScalarIconTag,\n ScalarIconTerminalWindow,\n ScalarIconTextAlignLeft,\n} from '@scalar/icons'\nimport type { ScalarIconComponent } from '@scalar/icons/types'\nimport { HttpMethod } from '@scalar/sidebar'\nimport {\n DEFAULT_MODELS_SECTION_LABEL,\n type ModelsSectionLabel,\n} from '@scalar/types/api-reference'\nimport type { FuseResult } from 'fuse.js'\nimport { computed } from 'vue'\n\nimport { useLocalization } from '@/features/localization'\nimport type { EntryType, FuseData } from '@/features/Search/types'\n\nconst { modelsSectionLabel = DEFAULT_MODELS_SECTION_LABEL } = defineProps<{\n id: string\n isSelected: boolean\n result: FuseResult<FuseData>\n modelsSectionLabel?: ModelsSectionLabel\n}>()\nconst { translate } = useLocalization()\n\nconst ENTRY_ICONS: { [x in EntryType]: ScalarIconComponent } = {\n heading: ScalarIconTextAlignLeft,\n model: ScalarIconBracketsCurly,\n operation: ScalarIconTerminalWindow,\n tag: ScalarIconTag,\n webhook:
|
|
1
|
+
{"version":3,"file":"SearchResult.vue.script.js","names":[],"sources":["../../../../src/features/Search/components/SearchResult.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarSearchResultItem } from '@scalar/components/search-results'\nimport {\n ScalarIconBracketsCurly,\n ScalarIconTag,\n ScalarIconTerminalWindow,\n ScalarIconTextAlignLeft,\n ScalarIconWebhooksLogo,\n} from '@scalar/icons'\nimport type { ScalarIconComponent } from '@scalar/icons/types'\nimport { HttpMethod } from '@scalar/sidebar'\nimport {\n DEFAULT_MODELS_SECTION_LABEL,\n type ModelsSectionLabel,\n} from '@scalar/types/api-reference'\nimport type { FuseResult } from 'fuse.js'\nimport { computed } from 'vue'\n\nimport { useLocalization } from '@/features/localization'\nimport type { EntryType, FuseData } from '@/features/Search/types'\n\nconst { modelsSectionLabel = DEFAULT_MODELS_SECTION_LABEL } = defineProps<{\n id: string\n isSelected: boolean\n result: FuseResult<FuseData>\n modelsSectionLabel?: ModelsSectionLabel\n}>()\nconst { translate } = useLocalization()\n\nconst ENTRY_ICONS: { [x in EntryType]: ScalarIconComponent } = {\n heading: ScalarIconTextAlignLeft,\n model: ScalarIconBracketsCurly,\n operation: ScalarIconTerminalWindow,\n tag: ScalarIconTag,\n webhook: ScalarIconWebhooksLogo,\n}\n\nconst entryLabels = computed((): { [x in EntryType]: string } => ({\n heading: translate('search.entryHeading'),\n operation: translate('search.entryOperation'),\n tag: translate('search.entryTag'),\n model: modelsSectionLabel,\n webhook: translate('search.entryWebhook'),\n}))\n</script>\n\n<template>\n <ScalarSearchResultItem\n :id=\"id\"\n :icon=\"ENTRY_ICONS[result.item.type]\"\n :selected=\"isSelected\">\n <span\n :class=\"{\n 'text-decoration-line':\n result.item.entry.type === 'operation' &&\n result.item.entry.isDeprecated,\n }\">\n <span class=\"sr-only\">\n {{ entryLabels[result.item.type] }}: \n <template\n v-if=\"\n result.item.entry.type === 'operation' &&\n result.item.entry.isDeprecated\n \">\n ({{ translate('common.deprecated') }}) \n </template>\n </span>\n {{ result.item.title }}\n <span class=\"sr-only\">,</span>\n </span>\n <template\n v-if=\"\n result.item.type !== 'webhook' &&\n (result.item.method || result.item.path) &&\n result.item.path !== result.item.title\n \"\n #description>\n <span class=\"inline-flex items-center gap-1\">\n <template v-if=\"result.item.type === 'operation'\">\n <HttpMethod\n aria-hidden=\"true\"\n :method=\"result.item.method ?? 'get'\" />\n <span class=\"sr-only\">\n {{ translate('common.httpMethod') }}:\n {{ result.item.method ?? 'get' }}\n </span>\n </template>\n <span class=\"sr-only\">{{ translate('common.path') }}: </span>\n {{ result.item.path }}\n </span>\n </template>\n <template\n v-else-if=\"result.item.description\"\n #description>\n <span class=\"sr-only\">{{ translate('common.description') }}: </span>\n {{ result.item.description }}\n </template>\n </ScalarSearchResultItem>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EA2BA,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,cAAyD;GAC7D,SAAS;GACT,OAAO;GACP,WAAW;GACX,KAAK;GACL,SAAS;EACX;EAEA,MAAM,cAAc,gBAA8C;GAChE,SAAS,UAAU,qBAAqB;GACxC,WAAW,UAAU,uBAAuB;GAC5C,KAAK,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wB,OACpC,gBAAG,QAAA,OAAO,KAAK,UAAM,KAAA,GAAA,CAAA,CAAA,GAAA,EAAA,KAAA,mBAAA,IAAA,IAAA;KAGzB,mBAAkE,QAAlE,YAAkE,gBAAzC,MAAA,SAAA,CAAS,CAAA,aAAA,CAAA,IAAkB,SAAO,CAAA;qBAAO,MAClE,gBAAG,QAAA,OAAO,KAAK,IAAI,GAAA,CAAA;;;OAIV,QAAA,OAAO,KAAK,cAAA;UACtB;sBACwE,CAAzE,mBAAyE,QAAzE,YAAyE,gBAAhD,MAAA,SAAA,CAAS,CAAA,oBAAA,CAAA,IAAyB,SAAO,CAAA,GAAA,gBAAO,MACzE,gBAAG,QAAA,OAAO,KAAK,WAAW,GAAA,CAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
|
|
2
|
+
/**
|
|
3
|
+
* Builds a mapping from model names to their sidebar entry IDs.
|
|
4
|
+
*
|
|
5
|
+
* The map powers the `scroll-to:model-by-name` navigation used by model-name links
|
|
6
|
+
* (for example the `Satellite[]` link next to a property type, or a request-body model name).
|
|
7
|
+
*
|
|
8
|
+
* Model entries do not always live under the top-level `models` group: a component schema with an
|
|
9
|
+
* `x-tags` extension is placed under its tag group instead. To keep those links working we walk the
|
|
10
|
+
* whole navigation tree and collect every `type === 'model'` entry, wherever it lives.
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/scalar/scalar/issues/9854
|
|
13
|
+
*/
|
|
14
|
+
export declare const buildModelsIndex: (entries: TraversedEntry[]) => Record<string, string>;
|
|
15
|
+
//# sourceMappingURL=build-models-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-models-index.d.ts","sourceRoot":"","sources":["../../src/helpers/build-models-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAEhF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,gBAAgB,GAAI,SAAS,cAAc,EAAE,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAqBjF,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region src/helpers/build-models-index.ts
|
|
2
|
+
/**
|
|
3
|
+
* Builds a mapping from model names to their sidebar entry IDs.
|
|
4
|
+
*
|
|
5
|
+
* The map powers the `scroll-to:model-by-name` navigation used by model-name links
|
|
6
|
+
* (for example the `Satellite[]` link next to a property type, or a request-body model name).
|
|
7
|
+
*
|
|
8
|
+
* Model entries do not always live under the top-level `models` group: a component schema with an
|
|
9
|
+
* `x-tags` extension is placed under its tag group instead. To keep those links working we walk the
|
|
10
|
+
* whole navigation tree and collect every `type === 'model'` entry, wherever it lives.
|
|
11
|
+
*
|
|
12
|
+
* @see https://github.com/scalar/scalar/issues/9854
|
|
13
|
+
*/
|
|
14
|
+
var buildModelsIndex = (entries) => {
|
|
15
|
+
const index = {};
|
|
16
|
+
const collect = (items) => {
|
|
17
|
+
for (const item of items) {
|
|
18
|
+
if (item.type === "model") index[item.name] ??= item.id;
|
|
19
|
+
if ("children" in item && item.children?.length) collect(item.children);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
collect(entries);
|
|
23
|
+
return index;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
export { buildModelsIndex };
|
|
27
|
+
|
|
28
|
+
//# sourceMappingURL=build-models-index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-models-index.js","names":[],"sources":["../../src/helpers/build-models-index.ts"],"sourcesContent":["import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\n\n/**\n * Builds a mapping from model names to their sidebar entry IDs.\n *\n * The map powers the `scroll-to:model-by-name` navigation used by model-name links\n * (for example the `Satellite[]` link next to a property type, or a request-body model name).\n *\n * Model entries do not always live under the top-level `models` group: a component schema with an\n * `x-tags` extension is placed under its tag group instead. To keep those links working we walk the\n * whole navigation tree and collect every `type === 'model'` entry, wherever it lives.\n *\n * @see https://github.com/scalar/scalar/issues/9854\n */\nexport const buildModelsIndex = (entries: TraversedEntry[]): Record<string, string> => {\n const index: Record<string, string> = {}\n\n const collect = (items: TraversedEntry[]): void => {\n for (const item of items) {\n if (item.type === 'model') {\n // Keep the first entry for a given name. A name can appear more than once when a schema is\n // listed under multiple tags, and the exact target does not matter as long as it scrolls\n // to that model.\n index[item.name] ??= item.id\n }\n\n if ('children' in item && item.children?.length) {\n collect(item.children)\n }\n }\n }\n\n collect(entries)\n\n return index\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,IAAa,oBAAoB,YAAsD;CACrF,MAAM,QAAgC,CAAC;CAEvC,MAAM,WAAW,UAAkC;EACjD,KAAK,MAAM,QAAQ,OAAO;GACxB,IAAI,KAAK,SAAS,SAIhB,MAAM,KAAK,UAAU,KAAK;GAG5B,IAAI,cAAc,QAAQ,KAAK,UAAU,QACvC,QAAQ,KAAK,QAAQ;EAEzB;CACF;CAEA,QAAQ,OAAO;CAEf,OAAO;AACT"}
|
|
@@ -120,6 +120,10 @@ export declare const authStorage: () => {
|
|
|
120
120
|
'x-scalar-secret-auth-url'?: string | undefined;
|
|
121
121
|
} & {
|
|
122
122
|
'x-scalar-secret-token-url'?: string | undefined;
|
|
123
|
+
} & {
|
|
124
|
+
'x-order'?: number | undefined;
|
|
125
|
+
} & {
|
|
126
|
+
'x-scalar-ignore'?: boolean | undefined;
|
|
123
127
|
} & {
|
|
124
128
|
authorizationUrl: string;
|
|
125
129
|
} & {
|
|
@@ -150,6 +154,10 @@ export declare const authStorage: () => {
|
|
|
150
154
|
'x-scalar-secret-auth-url'?: string | undefined;
|
|
151
155
|
} & {
|
|
152
156
|
'x-scalar-secret-token-url'?: string | undefined;
|
|
157
|
+
} & {
|
|
158
|
+
'x-order'?: number | undefined;
|
|
159
|
+
} & {
|
|
160
|
+
'x-scalar-ignore'?: boolean | undefined;
|
|
153
161
|
} & {
|
|
154
162
|
tokenUrl: string;
|
|
155
163
|
} & {
|
|
@@ -187,6 +195,10 @@ export declare const authStorage: () => {
|
|
|
187
195
|
'x-scalar-secret-auth-url'?: string | undefined;
|
|
188
196
|
} & {
|
|
189
197
|
'x-scalar-secret-token-url'?: string | undefined;
|
|
198
|
+
} & {
|
|
199
|
+
'x-order'?: number | undefined;
|
|
200
|
+
} & {
|
|
201
|
+
'x-scalar-ignore'?: boolean | undefined;
|
|
190
202
|
} & {
|
|
191
203
|
tokenUrl: string;
|
|
192
204
|
} & {
|
|
@@ -221,6 +233,10 @@ export declare const authStorage: () => {
|
|
|
221
233
|
'x-scalar-secret-auth-url'?: string | undefined;
|
|
222
234
|
} & {
|
|
223
235
|
'x-scalar-secret-token-url'?: string | undefined;
|
|
236
|
+
} & {
|
|
237
|
+
'x-order'?: number | undefined;
|
|
238
|
+
} & {
|
|
239
|
+
'x-scalar-ignore'?: boolean | undefined;
|
|
224
240
|
} & {
|
|
225
241
|
authorizationUrl: string;
|
|
226
242
|
tokenUrl: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/helpers/storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,uCAAuC,CAAA;AAM7E;;;GAGG;AACH,eAAO,MAAM,aAAa;IAGtB;;OAEG;;IAIH;;;OAGG;iBACU,MAAM;CAItB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW;IAMpB;;OAEG;oBACa,MAAM
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/helpers/storage.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,EAAc,MAAM,uCAAuC,CAAA;AAM7E;;;GAGG;AACH,eAAO,MAAM,aAAa;IAGtB;;OAEG;;IAIH;;;OAGG;iBACU,MAAM;CAItB,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW;IAMpB;;OAEG;oBACa,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAItB;;;OAGG;oBACa,MAAM,SAAS,IAAI;CAItC,CAAA"}
|