@scalar/api-reference 1.57.5 → 1.58.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 +37 -0
- package/dist/browser/chunks/AgentScalarChatInterface-DIIVMX31.js +27 -0
- package/dist/browser/chunks/ScalarTextInput.vue-DDsQgpOo.js +27 -0
- package/dist/browser/chunks/basic-shape-diamond.svg-BTEOT1FL.js +15 -0
- package/dist/browser/chunks/basic-shape-hexagon.svg-BSPzaCgF.js +15 -0
- package/dist/browser/chunks/basic-shape-primary-circle-ellipse-round.svg-DKmZ8UUU.js +15 -0
- package/dist/browser/chunks/basic-shape-primary-square-rectangle.svg-n2YRykHD.js +15 -0
- package/dist/browser/chunks/basic-shape-shield.svg-Bec9cJDA.js +15 -0
- package/dist/browser/chunks/browser-67K6wmG9.js +129 -0
- package/dist/browser/chunks/computer-device-desktop-monitor.svg-m6j893Hb.js +15 -0
- package/dist/browser/chunks/computer-device-desktop.svg-Dk1VVO7k.js +15 -0
- package/dist/browser/chunks/computer-device-laptop.svg-BNGVUCYS.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung-back.svg-CC4UUTFw.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung.svg-D8ExpMpL.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x-back.svg-CLm7sgMM.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x.svg-Xrttg6_7.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-tablet-touch.svg-DQ2oTvOG.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-tablet.svg-DCr0XlRc.js +15 -0
- package/dist/browser/chunks/computer-device-network-ethernet-cat6.svg-AK9l0iOl.js +15 -0
- package/dist/browser/chunks/computer-device-network-lan-www.svg-gUIdFBlE.js +15 -0
- package/dist/browser/chunks/computer-device-network-wifi-connection.svg-Be-EMm4e.js +15 -0
- package/dist/browser/chunks/computer-device-network-wifi-router.svg-Dc2VzyqK.js +15 -0
- package/dist/browser/chunks/ecology-science-erlenmeyer-flask.svg-DHgy7Jfd.js +15 -0
- package/dist/browser/chunks/image-flash-lightning.svg-EETR_y1q.js +15 -0
- package/dist/browser/chunks/image-picture-flower.svg-DN1AYzJU.js +15 -0
- package/dist/browser/chunks/interface-alert-exclamation-diamond.svg-C5NozMV_.js +15 -0
- package/dist/browser/chunks/interface-alert-exclamation-triangle-warning.svg-DaAg2fF5.js +15 -0
- package/dist/browser/chunks/interface-alert-information-circle.svg-ckkkt9Mv.js +15 -0
- package/dist/browser/chunks/interface-award-crown.svg-pjvn9hY-.js +15 -0
- package/dist/browser/chunks/interface-bookmark-tag.svg-r2r-lQq4.js +15 -0
- package/dist/browser/chunks/interface-bookmark.svg-BK9HKQBT.js +15 -0
- package/dist/browser/chunks/interface-calendar-date-one.svg-DNnF0M1I.js +15 -0
- package/dist/browser/chunks/interface-content-book-open-pages.svg-CQj_w9Vp.js +15 -0
- package/dist/browser/chunks/interface-content-book-page.svg-DppoeJRe.js +15 -0
- package/dist/browser/chunks/interface-content-file.svg-CvcD7OiY.js +15 -0
- package/dist/browser/chunks/interface-content-folder.svg-BmtS5I9A.js +15 -0
- package/dist/browser/chunks/interface-copy-clipboard.svg-Be6EI50X.js +15 -0
- package/dist/browser/chunks/interface-edit-attachment.svg-G5TKzpWX.js +15 -0
- package/dist/browser/chunks/interface-edit-binocular.svg-jzL-DvGB.js +15 -0
- package/dist/browser/chunks/interface-edit-magic-wand.svg-BOTlymvp.js +15 -0
- package/dist/browser/chunks/interface-edit-tool-paint-roller.svg-s9dwryx7.js +15 -0
- package/dist/browser/chunks/interface-edit-tool-pencil.svg-C7v0dbB3.js +15 -0
- package/dist/browser/chunks/interface-favorite-award.svg-CYHUgUG0.js +15 -0
- package/dist/browser/chunks/interface-favorite-flag.svg-C10zlKOb.js +15 -0
- package/dist/browser/chunks/interface-favorite-heart.svg-eoduXxlz.js +15 -0
- package/dist/browser/chunks/interface-favorite-star.svg-BSmxJetr.js +15 -0
- package/dist/browser/chunks/interface-favorite-stars-sparkles.svg-JTFLj3Ls.js +15 -0
- package/dist/browser/chunks/interface-hierarchy-flowchart.svg-Cg_Wy0kN.js +15 -0
- package/dist/browser/chunks/interface-home-house.svg-DytoGRnv.js +15 -0
- package/dist/browser/chunks/interface-hyperlink.svg-CuEfmmQI.js +15 -0
- package/dist/browser/chunks/interface-lighting-brightness.svg-DSK0h_Pa.js +15 -0
- package/dist/browser/chunks/interface-lock-closed.svg-Cn6TaLYv.js +15 -0
- package/dist/browser/chunks/interface-lock-open-unlock.svg-CVkG5-9W.js +15 -0
- package/dist/browser/chunks/interface-login-key.svg-y-cwwXjN.js +15 -0
- package/dist/browser/chunks/interface-search.svg-S-puVFJB.js +15 -0
- package/dist/browser/chunks/interface-setting-cog.svg-CTH4_lLg.js +15 -0
- package/dist/browser/chunks/interface-share-megaphone-bullhorn.svg-Pbp39MyC.js +15 -0
- package/dist/browser/chunks/interface-share-rocket.svg-BgCsIRZO.js +15 -0
- package/dist/browser/chunks/interface-share-satellite.svg-DAMN9d5G.js +15 -0
- package/dist/browser/chunks/interface-share-space-ship.svg-Dt-Mejxk.js +15 -0
- package/dist/browser/chunks/interface-share.svg-vFYTXSti.js +15 -0
- package/dist/browser/chunks/interface-signal-square.svg-DNG4LpAe.js +15 -0
- package/dist/browser/chunks/interface-time-clock-circle.svg-Bpz-nLxo.js +15 -0
- package/dist/browser/chunks/interface-time-hour-glass.svg-D7agfKsH.js +15 -0
- package/dist/browser/chunks/interface-users-multiple.svg-CkPJBBnG.js +15 -0
- package/dist/browser/chunks/interface-weather-moon.svg-CaTZFMPO.js +15 -0
- package/dist/browser/chunks/mail-chat-bubble-square.svg-DC8RIihp.js +15 -0
- package/dist/browser/chunks/mail-send-email-paper-airplane.svg-D8OLs9jz.js +15 -0
- package/dist/browser/chunks/mail-send-envelope.svg-CV33h5Sx.js +15 -0
- package/dist/browser/chunks/modal-BA6EnLMO.js +15 -0
- package/dist/browser/chunks/modal-DW-P3H1k.js +66 -0
- package/dist/browser/chunks/money-cashier-receipt.svg-CJL8C2gs.js +15 -0
- package/dist/browser/chunks/money-currency-dollar-pay.svg-VdBplCTx.js +15 -0
- package/dist/browser/chunks/money-graph-arrow-increase.svg-DcRov3zk.js +15 -0
- package/dist/browser/chunks/money-graph-bar-chart-increase.svg-Cc7KxjX-.js +15 -0
- package/dist/browser/chunks/nature-ecology-leaf.svg-DR3cTZxt.js +15 -0
- package/dist/browser/chunks/phone-telephone.svg-DyY0gUlk.js +15 -0
- package/dist/browser/chunks/programming-bug.svg-BHLT-Qhp.js +15 -0
- package/dist/browser/chunks/programming-cloud.svg-B6YW33ba.js +15 -0
- package/dist/browser/chunks/programming-computer-database-server.svg-B6o5Sdn-.js +15 -0
- package/dist/browser/chunks/programming-computer-database.svg-Cl7OVtpJ.js +15 -0
- package/dist/browser/chunks/programming-module-four-layout.svg-BQrerL1x.js +15 -0
- package/dist/browser/chunks/programming-module-three.svg-B2KTQzBM.js +15 -0
- package/dist/browser/chunks/programming-module.svg-CiID7kPm.js +15 -0
- package/dist/browser/chunks/programming-script-code.svg-D1M5rtkN.js +15 -0
- package/dist/browser/chunks/runtime-core.esm-bundler-Byrbbu5Q.js +17 -0
- package/dist/browser/chunks/shopping-cart.svg-BEegiIR9.js +15 -0
- package/dist/browser/chunks/shopping-gift-present.svg-BUHwuLix.js +15 -0
- package/dist/browser/chunks/shopping-shipping-box-parcel-package.svg-D6fxWdYx.js +15 -0
- package/dist/browser/chunks/tag-new-circle.svg-jsg1bGs0.js +15 -0
- package/dist/browser/chunks/travel-map-earth-globe.svg-ClbMiU-f.js +15 -0
- package/dist/browser/chunks/vendor-Ad2vN5Ro.js +333 -0
- package/dist/browser/standalone.esm.js +1852 -0
- package/dist/browser/standalone.js +253 -255
- 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 +61 -26
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.d.ts +16 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.js +7 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.js.map +1 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js +164 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js.map +1 -0
- package/dist/components/Content/AsyncApi/Channel.vue.d.ts +14 -0
- package/dist/components/Content/AsyncApi/Channel.vue.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/Channel.vue.js +9 -0
- package/dist/components/Content/AsyncApi/Channel.vue.js.map +1 -0
- package/dist/components/Content/AsyncApi/Channel.vue.script.js +108 -0
- package/dist/components/Content/AsyncApi/Channel.vue.script.js.map +1 -0
- package/dist/components/Content/AsyncApi/index.d.ts +2 -0
- package/dist/components/Content/AsyncApi/index.d.ts.map +1 -0
- package/dist/components/Content/Content.vue.d.ts +3 -3
- package/dist/components/Content/Content.vue.d.ts.map +1 -1
- package/dist/components/Content/Content.vue.js.map +1 -1
- package/dist/components/Content/Content.vue.script.js +19 -3
- package/dist/components/Content/Content.vue.script.js.map +1 -1
- package/dist/components/Content/Models/ModelTag.vue.d.ts +2 -0
- package/dist/components/Content/Models/ModelTag.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/ModelTag.vue.js.map +1 -1
- package/dist/components/Content/Models/ModelTag.vue.script.js +11 -12
- package/dist/components/Content/Models/ModelTag.vue.script.js.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.js.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.script.js +4 -2
- package/dist/components/Content/Operations/TraversedEntry.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js +4 -6
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.d.ts +2 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +40 -25
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/features/Search/components/SearchButton.vue.d.ts +4 -1
- package/dist/features/Search/components/SearchButton.vue.d.ts.map +1 -1
- package/dist/features/Search/components/SearchButton.vue.js.map +1 -1
- package/dist/features/Search/components/SearchButton.vue.script.js +7 -8
- package/dist/features/Search/components/SearchButton.vue.script.js.map +1 -1
- package/dist/features/Search/components/SearchModal.vue.d.ts +4 -1
- package/dist/features/Search/components/SearchModal.vue.d.ts.map +1 -1
- package/dist/features/Search/components/SearchModal.vue.js +1 -1
- package/dist/features/Search/components/SearchModal.vue.js.map +1 -1
- package/dist/features/Search/components/SearchModal.vue.script.js +5 -2
- package/dist/features/Search/components/SearchModal.vue.script.js.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.d.ts +2 -0
- 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 +8 -6
- package/dist/features/Search/components/SearchResult.vue.script.js.map +1 -1
- package/dist/features/Search/helpers/create-search-index.d.ts +9 -1
- package/dist/features/Search/helpers/create-search-index.d.ts.map +1 -1
- package/dist/features/Search/helpers/create-search-index.js +27 -8
- package/dist/features/Search/helpers/create-search-index.js.map +1 -1
- package/dist/features/Search/hooks/useSearchIndex.d.ts +4 -2
- package/dist/features/Search/hooks/useSearchIndex.d.ts.map +1 -1
- package/dist/features/Search/hooks/useSearchIndex.js +4 -3
- package/dist/features/Search/hooks/useSearchIndex.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.d.ts +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.script.js +11 -9
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.script.js +9 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.script.js.map +1 -1
- package/dist/helpers/get-async-api-model-schema.d.ts +15 -0
- package/dist/helpers/get-async-api-model-schema.d.ts.map +1 -0
- package/dist/helpers/get-async-api-model-schema.js +32 -0
- package/dist/helpers/get-async-api-model-schema.js.map +1 -0
- package/dist/helpers/id-routing.d.ts +18 -0
- package/dist/helpers/id-routing.d.ts.map +1 -1
- package/dist/helpers/id-routing.js +41 -1
- package/dist/helpers/id-routing.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/{persistance-plugin.d.ts → persistence-plugin.d.ts} +2 -8
- package/dist/plugins/persistence-plugin.d.ts.map +1 -0
- package/dist/plugins/{persistance-plugin.js → persistence-plugin.js} +4 -13
- package/dist/plugins/persistence-plugin.js.map +1 -0
- package/dist/standalone.esm.d.ts +4 -0
- package/dist/standalone.esm.d.ts.map +1 -0
- package/dist/style.css +90 -78
- package/dist/vue-styles.css +84 -76
- package/package.json +21 -19
- package/dist/browser/webpack-stats.json +0 -1
- package/dist/plugins/persistance-plugin.d.ts.map +0 -1
- package/dist/plugins/persistance-plugin.js.map +0 -1
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
|
|
|
2
2
|
import SearchModal_vue_vue_type_script_setup_true_lang_default from "./SearchModal.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/features/Search/components/SearchModal.vue
|
|
5
|
-
var SearchModal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(SearchModal_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var SearchModal_default = /* @__PURE__ */ _plugin_vue_export_helper_default(SearchModal_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-c66e857d"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { SearchModal_default as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchModal.vue.js","names":[],"sources":["../../../../src/features/Search/components/SearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { nanoid } from 'nanoid'\nimport { computed, ref, watch } from 'vue'\n\nimport { useSearchIndex } from '@/features/Search/hooks/useSearchIndex'\n\nimport SearchResult from './SearchResult.vue'\n\nconst props = defineProps<{\n modalState: ModalState\n document: OpenApiDocument | undefined\n eventBus: WorkspaceEventBus\n}>()\n\n/** Base id for the search form */\nconst id = nanoid()\n/** An id for the results listbox */\nconst listboxId = `${id}-search-result`\n/** An id for the results instructions */\nconst instructionsId = `${id}-search-instructions`\n\nconst { query, results } = useSearchIndex(() => props.document)\n\nconst selectedIndex = ref<number | undefined>(undefined)\n\n/** Clear the query value when the modal is opened */\nwatch(\n () => props.modalState.open,\n (open) => {\n if (open) {\n query.value = ''\n }\n },\n)\n\n/** Keyboard navigation */\nconst navigateSearchResults = (direction: 'up' | 'down') => {\n const offset = direction === 'up' ? -1 : 1\n const length = results.value.length\n\n if (typeof selectedIndex.value === 'number') {\n // Ensures we loop around the array by using the remainder\n selectedIndex.value = (selectedIndex.value + offset + length) % length\n } else {\n // If no index is selected, we select the first or last item depending on the direction\n\n selectedIndex.value = offset === -1 ? length - 1 : 0\n }\n}\n\n/** Handle the selection of a search result */\nfunction handleSelect(idx: number | undefined) {\n if (typeof idx !== 'number' || !results.value[idx]) {\n return\n }\n\n const result = results.value[idx]\n props.modalState.hide()\n props.eventBus.emit('scroll-to:nav-item', { id: result.item.id })\n}\n\n/**\n * Active descendant id for the search input\n * NOTE: Result items MUST share this id for the aria-activedescendant attribute to work correctly\n */\nconst activeDescendantId = computed(() => {\n const selectedResult = results.value[selectedIndex.value ?? -1]\n\n return selectedResult ? `search-result-${selectedResult.item.id}` : undefined\n})\n</script>\n<template>\n <ScalarModal\n aria-label=\"Reference Search\"\n :state=\"modalState\"\n variant=\"search\">\n <div\n class=\"mb-0 flex flex-col\"\n role=\"search\">\n <ScalarSearchInput\n v-model=\"query\"\n :aria-activedescendant=\"activeDescendantId\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-describedby=\"instructionsId\"\n role=\"combobox\"\n @blur=\"selectedIndex = undefined\"\n @keydown.down.stop.prevent=\"navigateSearchResults('down')\"\n @keydown.enter.stop.prevent=\"() => handleSelect(selectedIndex)\"\n @keydown.up.stop.prevent=\"navigateSearchResults('up')\" />\n </div>\n <ScalarSearchResultList\n :id=\"listboxId\"\n aria-label=\"Reference Search Results\"\n class=\"custom-scroll px-1 pb-1\"\n :noResults=\"!results.length\">\n <template #query>\n {{ query }}\n </template>\n <SearchResult\n v-for=\"(result, idx) in results\"\n :id=\"`search-result-${result.item.id}`\"\n :key=\"result.refIndex\"\n :isSelected=\"selectedIndex === idx\"\n :result=\"result\"\n @click.prevent=\"() => handleSelect(idx)\" />\n </ScalarSearchResultList>\n <div\n :id=\"instructionsId\"\n class=\"ref-search-meta\">\n <span\n aria-hidden=\"true\"\n class=\"contents\">\n <span>↑↓ Navigate</span>\n <span>⏎ Select</span>\n </span>\n <span class=\"sr-only\">\n Press up arrow / down arrow to navigate, enter to select, type to filter\n results\n </span>\n </div>\n </ScalarModal>\n</template>\n<style scoped>\n.ref-search-meta {\n background: var(--scalar-background-1);\n border-bottom-left-radius: var(--scalar-radius-lg);\n border-bottom-right-radius: var(--scalar-radius-lg);\n padding: 6px 12px;\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-3);\n font-weight: var(--scalar-semibold);\n display: flex;\n gap: 12px;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"SearchModal.vue.js","names":[],"sources":["../../../../src/features/Search/components/SearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { ModelsSectionLabel } from '@scalar/types/api-reference'\nimport type { AsyncApiDocument } from '@scalar/types/asyncapi/3.1'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { nanoid } from 'nanoid'\nimport { computed, ref, watch } from 'vue'\n\nimport { useSearchIndex } from '@/features/Search/hooks/useSearchIndex'\n\nimport SearchResult from './SearchResult.vue'\n\nconst props = defineProps<{\n modalState: ModalState\n document: OpenApiDocument | AsyncApiDocument | undefined\n eventBus: WorkspaceEventBus\n modelsSectionLabel?: ModelsSectionLabel\n}>()\n\n/** Base id for the search form */\nconst id = nanoid()\n/** An id for the results listbox */\nconst listboxId = `${id}-search-result`\n/** An id for the results instructions */\nconst instructionsId = `${id}-search-instructions`\n\nconst { query, results } = useSearchIndex(\n () => props.document,\n () => props.modelsSectionLabel,\n)\n\nconst selectedIndex = ref<number | undefined>(undefined)\n\n/** Clear the query value when the modal is opened */\nwatch(\n () => props.modalState.open,\n (open) => {\n if (open) {\n query.value = ''\n }\n },\n)\n\n/** Keyboard navigation */\nconst navigateSearchResults = (direction: 'up' | 'down') => {\n const offset = direction === 'up' ? -1 : 1\n const length = results.value.length\n\n if (typeof selectedIndex.value === 'number') {\n // Ensures we loop around the array by using the remainder\n selectedIndex.value = (selectedIndex.value + offset + length) % length\n } else {\n // If no index is selected, we select the first or last item depending on the direction\n\n selectedIndex.value = offset === -1 ? length - 1 : 0\n }\n}\n\n/** Handle the selection of a search result */\nfunction handleSelect(idx: number | undefined) {\n if (typeof idx !== 'number' || !results.value[idx]) {\n return\n }\n\n const result = results.value[idx]\n props.modalState.hide()\n props.eventBus.emit('scroll-to:nav-item', { id: result.item.id })\n}\n\n/**\n * Active descendant id for the search input\n * NOTE: Result items MUST share this id for the aria-activedescendant attribute to work correctly\n */\nconst activeDescendantId = computed(() => {\n const selectedResult = results.value[selectedIndex.value ?? -1]\n\n return selectedResult ? `search-result-${selectedResult.item.id}` : undefined\n})\n</script>\n<template>\n <ScalarModal\n aria-label=\"Reference Search\"\n :state=\"modalState\"\n variant=\"search\">\n <div\n class=\"mb-0 flex flex-col\"\n role=\"search\">\n <ScalarSearchInput\n v-model=\"query\"\n :aria-activedescendant=\"activeDescendantId\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-describedby=\"instructionsId\"\n role=\"combobox\"\n @blur=\"selectedIndex = undefined\"\n @keydown.down.stop.prevent=\"navigateSearchResults('down')\"\n @keydown.enter.stop.prevent=\"() => handleSelect(selectedIndex)\"\n @keydown.up.stop.prevent=\"navigateSearchResults('up')\" />\n </div>\n <ScalarSearchResultList\n :id=\"listboxId\"\n aria-label=\"Reference Search Results\"\n class=\"custom-scroll px-1 pb-1\"\n :noResults=\"!results.length\">\n <template #query>\n {{ query }}\n </template>\n <SearchResult\n v-for=\"(result, idx) in results\"\n :id=\"`search-result-${result.item.id}`\"\n :key=\"result.refIndex\"\n :isSelected=\"selectedIndex === idx\"\n :modelsSectionLabel=\"props.modelsSectionLabel\"\n :result=\"result\"\n @click.prevent=\"() => handleSelect(idx)\" />\n </ScalarSearchResultList>\n <div\n :id=\"instructionsId\"\n class=\"ref-search-meta\">\n <span\n aria-hidden=\"true\"\n class=\"contents\">\n <span>↑↓ Navigate</span>\n <span>⏎ Select</span>\n </span>\n <span class=\"sr-only\">\n Press up arrow / down arrow to navigate, enter to select, type to filter\n results\n </span>\n </div>\n </ScalarModal>\n</template>\n<style scoped>\n.ref-search-meta {\n background: var(--scalar-background-1);\n border-bottom-left-radius: var(--scalar-radius-lg);\n border-bottom-right-radius: var(--scalar-radius-lg);\n padding: 6px 12px;\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-3);\n font-weight: var(--scalar-semibold);\n display: flex;\n gap: 12px;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n</style>\n"],"mappings":""}
|
|
@@ -15,7 +15,8 @@ var SearchModal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
15
15
|
props: {
|
|
16
16
|
modalState: {},
|
|
17
17
|
document: {},
|
|
18
|
-
eventBus: {}
|
|
18
|
+
eventBus: {},
|
|
19
|
+
modelsSectionLabel: {}
|
|
19
20
|
},
|
|
20
21
|
setup(__props) {
|
|
21
22
|
const props = __props;
|
|
@@ -25,7 +26,7 @@ var SearchModal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
25
26
|
const listboxId = `${id}-search-result`;
|
|
26
27
|
/** An id for the results instructions */
|
|
27
28
|
const instructionsId = `${id}-search-instructions`;
|
|
28
|
-
const { query, results } = useSearchIndex(() => props.document);
|
|
29
|
+
const { query, results } = useSearchIndex(() => props.document, () => props.modelsSectionLabel);
|
|
29
30
|
const selectedIndex = ref(void 0);
|
|
30
31
|
/** Clear the query value when the modal is opened */
|
|
31
32
|
watch(() => props.modalState.open, (open) => {
|
|
@@ -87,11 +88,13 @@ var SearchModal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
87
88
|
id: `search-result-${result.item.id}`,
|
|
88
89
|
key: result.refIndex,
|
|
89
90
|
isSelected: selectedIndex.value === idx,
|
|
91
|
+
modelsSectionLabel: props.modelsSectionLabel,
|
|
90
92
|
result,
|
|
91
93
|
onClick: withModifiers(() => handleSelect(idx), ["prevent"])
|
|
92
94
|
}, null, 8, [
|
|
93
95
|
"id",
|
|
94
96
|
"isSelected",
|
|
97
|
+
"modelsSectionLabel",
|
|
95
98
|
"result",
|
|
96
99
|
"onClick"
|
|
97
100
|
]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchModal.vue.script.js","names":[],"sources":["../../../../src/features/Search/components/SearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { nanoid } from 'nanoid'\nimport { computed, ref, watch } from 'vue'\n\nimport { useSearchIndex } from '@/features/Search/hooks/useSearchIndex'\n\nimport SearchResult from './SearchResult.vue'\n\nconst props = defineProps<{\n modalState: ModalState\n document: OpenApiDocument | undefined\n eventBus: WorkspaceEventBus\n}>()\n\n/** Base id for the search form */\nconst id = nanoid()\n/** An id for the results listbox */\nconst listboxId = `${id}-search-result`\n/** An id for the results instructions */\nconst instructionsId = `${id}-search-instructions`\n\nconst { query, results } = useSearchIndex(() => props.document)\n\nconst selectedIndex = ref<number | undefined>(undefined)\n\n/** Clear the query value when the modal is opened */\nwatch(\n () => props.modalState.open,\n (open) => {\n if (open) {\n query.value = ''\n }\n },\n)\n\n/** Keyboard navigation */\nconst navigateSearchResults = (direction: 'up' | 'down') => {\n const offset = direction === 'up' ? -1 : 1\n const length = results.value.length\n\n if (typeof selectedIndex.value === 'number') {\n // Ensures we loop around the array by using the remainder\n selectedIndex.value = (selectedIndex.value + offset + length) % length\n } else {\n // If no index is selected, we select the first or last item depending on the direction\n\n selectedIndex.value = offset === -1 ? length - 1 : 0\n }\n}\n\n/** Handle the selection of a search result */\nfunction handleSelect(idx: number | undefined) {\n if (typeof idx !== 'number' || !results.value[idx]) {\n return\n }\n\n const result = results.value[idx]\n props.modalState.hide()\n props.eventBus.emit('scroll-to:nav-item', { id: result.item.id })\n}\n\n/**\n * Active descendant id for the search input\n * NOTE: Result items MUST share this id for the aria-activedescendant attribute to work correctly\n */\nconst activeDescendantId = computed(() => {\n const selectedResult = results.value[selectedIndex.value ?? -1]\n\n return selectedResult ? `search-result-${selectedResult.item.id}` : undefined\n})\n</script>\n<template>\n <ScalarModal\n aria-label=\"Reference Search\"\n :state=\"modalState\"\n variant=\"search\">\n <div\n class=\"mb-0 flex flex-col\"\n role=\"search\">\n <ScalarSearchInput\n v-model=\"query\"\n :aria-activedescendant=\"activeDescendantId\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-describedby=\"instructionsId\"\n role=\"combobox\"\n @blur=\"selectedIndex = undefined\"\n @keydown.down.stop.prevent=\"navigateSearchResults('down')\"\n @keydown.enter.stop.prevent=\"() => handleSelect(selectedIndex)\"\n @keydown.up.stop.prevent=\"navigateSearchResults('up')\" />\n </div>\n <ScalarSearchResultList\n :id=\"listboxId\"\n aria-label=\"Reference Search Results\"\n class=\"custom-scroll px-1 pb-1\"\n :noResults=\"!results.length\">\n <template #query>\n {{ query }}\n </template>\n <SearchResult\n v-for=\"(result, idx) in results\"\n :id=\"`search-result-${result.item.id}`\"\n :key=\"result.refIndex\"\n :isSelected=\"selectedIndex === idx\"\n :result=\"result\"\n @click.prevent=\"() => handleSelect(idx)\" />\n </ScalarSearchResultList>\n <div\n :id=\"instructionsId\"\n class=\"ref-search-meta\">\n <span\n aria-hidden=\"true\"\n class=\"contents\">\n <span>↑↓ Navigate</span>\n <span>⏎ Select</span>\n </span>\n <span class=\"sr-only\">\n Press up arrow / down arrow to navigate, enter to select, type to filter\n results\n </span>\n </div>\n </ScalarModal>\n</template>\n<style scoped>\n.ref-search-meta {\n background: var(--scalar-background-1);\n border-bottom-left-radius: var(--scalar-radius-lg);\n border-bottom-right-radius: var(--scalar-radius-lg);\n padding: 6px 12px;\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-3);\n font-weight: var(--scalar-semibold);\n display: flex;\n gap: 12px;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n</style>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"SearchModal.vue.script.js","names":[],"sources":["../../../../src/features/Search/components/SearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { ModelsSectionLabel } from '@scalar/types/api-reference'\nimport type { AsyncApiDocument } from '@scalar/types/asyncapi/3.1'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { nanoid } from 'nanoid'\nimport { computed, ref, watch } from 'vue'\n\nimport { useSearchIndex } from '@/features/Search/hooks/useSearchIndex'\n\nimport SearchResult from './SearchResult.vue'\n\nconst props = defineProps<{\n modalState: ModalState\n document: OpenApiDocument | AsyncApiDocument | undefined\n eventBus: WorkspaceEventBus\n modelsSectionLabel?: ModelsSectionLabel\n}>()\n\n/** Base id for the search form */\nconst id = nanoid()\n/** An id for the results listbox */\nconst listboxId = `${id}-search-result`\n/** An id for the results instructions */\nconst instructionsId = `${id}-search-instructions`\n\nconst { query, results } = useSearchIndex(\n () => props.document,\n () => props.modelsSectionLabel,\n)\n\nconst selectedIndex = ref<number | undefined>(undefined)\n\n/** Clear the query value when the modal is opened */\nwatch(\n () => props.modalState.open,\n (open) => {\n if (open) {\n query.value = ''\n }\n },\n)\n\n/** Keyboard navigation */\nconst navigateSearchResults = (direction: 'up' | 'down') => {\n const offset = direction === 'up' ? -1 : 1\n const length = results.value.length\n\n if (typeof selectedIndex.value === 'number') {\n // Ensures we loop around the array by using the remainder\n selectedIndex.value = (selectedIndex.value + offset + length) % length\n } else {\n // If no index is selected, we select the first or last item depending on the direction\n\n selectedIndex.value = offset === -1 ? length - 1 : 0\n }\n}\n\n/** Handle the selection of a search result */\nfunction handleSelect(idx: number | undefined) {\n if (typeof idx !== 'number' || !results.value[idx]) {\n return\n }\n\n const result = results.value[idx]\n props.modalState.hide()\n props.eventBus.emit('scroll-to:nav-item', { id: result.item.id })\n}\n\n/**\n * Active descendant id for the search input\n * NOTE: Result items MUST share this id for the aria-activedescendant attribute to work correctly\n */\nconst activeDescendantId = computed(() => {\n const selectedResult = results.value[selectedIndex.value ?? -1]\n\n return selectedResult ? `search-result-${selectedResult.item.id}` : undefined\n})\n</script>\n<template>\n <ScalarModal\n aria-label=\"Reference Search\"\n :state=\"modalState\"\n variant=\"search\">\n <div\n class=\"mb-0 flex flex-col\"\n role=\"search\">\n <ScalarSearchInput\n v-model=\"query\"\n :aria-activedescendant=\"activeDescendantId\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-describedby=\"instructionsId\"\n role=\"combobox\"\n @blur=\"selectedIndex = undefined\"\n @keydown.down.stop.prevent=\"navigateSearchResults('down')\"\n @keydown.enter.stop.prevent=\"() => handleSelect(selectedIndex)\"\n @keydown.up.stop.prevent=\"navigateSearchResults('up')\" />\n </div>\n <ScalarSearchResultList\n :id=\"listboxId\"\n aria-label=\"Reference Search Results\"\n class=\"custom-scroll px-1 pb-1\"\n :noResults=\"!results.length\">\n <template #query>\n {{ query }}\n </template>\n <SearchResult\n v-for=\"(result, idx) in results\"\n :id=\"`search-result-${result.item.id}`\"\n :key=\"result.refIndex\"\n :isSelected=\"selectedIndex === idx\"\n :modelsSectionLabel=\"props.modelsSectionLabel\"\n :result=\"result\"\n @click.prevent=\"() => handleSelect(idx)\" />\n </ScalarSearchResultList>\n <div\n :id=\"instructionsId\"\n class=\"ref-search-meta\">\n <span\n aria-hidden=\"true\"\n class=\"contents\">\n <span>↑↓ Navigate</span>\n <span>⏎ Select</span>\n </span>\n <span class=\"sr-only\">\n Press up arrow / down arrow to navigate, enter to select, type to filter\n results\n </span>\n </div>\n </ScalarModal>\n</template>\n<style scoped>\n.ref-search-meta {\n background: var(--scalar-background-1);\n border-bottom-left-radius: var(--scalar-radius-lg);\n border-bottom-right-radius: var(--scalar-radius-lg);\n padding: 6px 12px;\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-3);\n font-weight: var(--scalar-semibold);\n display: flex;\n gap: 12px;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;EAeA,MAAM,QAAQ;;EAQd,MAAM,KAAK,QAAO;;EAElB,MAAM,YAAY,GAAG,GAAG;;EAExB,MAAM,iBAAiB,GAAG,GAAG;EAE7B,MAAM,EAAE,OAAO,YAAY,qBACnB,MAAM,gBACN,MAAM,mBACd;EAEA,MAAM,gBAAgB,IAAwB,KAAA,EAAS;;AAGvD,cACQ,MAAM,WAAW,OACtB,SAAS;AACR,OAAI,KACF,OAAM,QAAQ;IAGpB;;EAGA,MAAM,yBAAyB,cAA6B;GAC1D,MAAM,SAAS,cAAc,OAAO,KAAK;GACzC,MAAM,SAAS,QAAQ,MAAM;AAE7B,OAAI,OAAO,cAAc,UAAU,SAEjC,eAAc,SAAS,cAAc,QAAQ,SAAS,UAAU;OAIhE,eAAc,QAAQ,WAAW,KAAK,SAAS,IAAI;;;EAKvD,SAAS,aAAa,KAAyB;AAC7C,OAAI,OAAO,QAAQ,YAAY,CAAC,QAAQ,MAAM,KAC5C;GAGF,MAAM,SAAS,QAAQ,MAAM;AAC7B,SAAM,WAAW,MAAK;AACtB,SAAM,SAAS,KAAK,sBAAsB,EAAE,IAAI,OAAO,KAAK,IAAI,CAAA;;;;;;EAOlE,MAAM,qBAAqB,eAAe;GACxC,MAAM,iBAAiB,QAAQ,MAAM,cAAc,SAAS;AAE5D,UAAO,iBAAiB,iBAAiB,eAAe,KAAK,OAAO,KAAA;IACrE;;uBAGC,YAkDc,MAAA,YAAA,EAAA;IAjDZ,cAAW;IACV,OAAO,QAAA;IACR,SAAQ;;2BAeF;KAdN,mBAcM,OAdN,YAcM,CAXJ,YAU2D,MAAA,kBAAA,EAAA;kBAThD,MAAA,MAAK;wFAAA,QAAA,SAAA;MACb,yBAAuB,mBAAA;MACxB,qBAAkB;MACjB,iBAAe;MACf,oBAAkB;MACnB,MAAK;MACJ,QAAI,OAAA,OAAA,OAAA,MAAA,WAAE,cAAA,QAAgB,KAAA;MACtB,WAAO;oEAAoB,sBAAqB,OAAA,EAAA,CAAA,QAAA,UAAA,CAAA,EAAA,CAAA,OAAA,CAAA;8DACd,aAAa,cAAA,MAAa,EAAA,CAAA,QAAA,UAAA,CAAA,EAAA,CAAA,QAAA,CAAA;oEACnC,sBAAqB,KAAA,EAAA,CAAA,QAAA,UAAA,CAAA,EAAA,CAAA,KAAA,CAAA;;;KAEnD,YAgByB,MAAA,uBAAA,EAAA;MAftB,IAAI;MACL,cAAW;MACX,OAAM;MACL,WAAS,CAAG,MAAA,QAAO,CAAC;;MACV,OAAK,cACH,CAAA,gBAAA,gBAAR,MAAA,MAAK,CAAA,EAAA,EAAA,CAAA,CAAA;6BAGwB,EAAA,UAAA,KAAA,EADlC,mBAO6C,UAAA,MAAA,WANnB,MAAA,QAAO,GAAvB,QAAQ,QAAG;2BADrB,YAO6C,sBAAA;QAL1C,IAAE,iBAAmB,OAAO,KAAK;QACjC,KAAK,OAAO;QACZ,YAAY,cAAA,UAAkB;QAC9B,oBAAoB,MAAM;QAClB;QACR,SAAK,oBAAgB,aAAa,IAAG,EAAA,CAAA,UAAA,CAAA;;;;;;;;;;;KAE1C,mBAaM,OAAA;MAZH,IAAI;MACL,OAAM;uCACN,mBAKO,QAAA;MAJL,eAAY;MACZ,OAAM;SACN,mBAAwB,QAAA,MAAlB,cAAW,EACjB,mBAAqB,QAAA,MAAf,WAAQ,CAAA,EAAA,GAAA,EAEhB,mBAGO,QAAA,EAHD,OAAM,WAAS,EAAC,sFAGtB,GAAA,CAAA,EAAA,CAAA"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { type ModelsSectionLabel } from '@scalar/types/api-reference';
|
|
1
2
|
import type { FuseResult } from 'fuse.js';
|
|
2
3
|
import type { FuseData } from '../../../features/Search/types';
|
|
3
4
|
type __VLS_Props = {
|
|
4
5
|
id: string;
|
|
5
6
|
isSelected: boolean;
|
|
6
7
|
result: FuseResult<FuseData>;
|
|
8
|
+
modelsSectionLabel?: ModelsSectionLabel;
|
|
7
9
|
};
|
|
8
10
|
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>;
|
|
9
11
|
declare const _default: typeof __VLS_export;
|
|
@@ -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":"AA2GA,OAAO,EAEL,KAAK,kBAAkB,EACxB,MAAM,6BAA6B,CAAA;AACpC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAGzC,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;AAsIF,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 type { FuseResult } from 'fuse.js'\n\nimport type { EntryType, FuseData } from '@/features/Search/types'\n\
|
|
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 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}>()\n\nconst ENTRY_ICONS: { [x in EntryType]: ScalarIconComponent } = {\n heading: ScalarIconTextAlignLeft,\n model: ScalarIconBracketsCurly,\n operation: ScalarIconTerminalWindow,\n tag: ScalarIconTag,\n webhook: ScalarIconTerminalWindow,\n}\n\nconst entryLabels = computed((): { [x in EntryType]: string } => ({\n heading: 'Heading',\n operation: 'Operation',\n tag: 'Tag',\n model: modelsSectionLabel,\n webhook: 'Webhook',\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 (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 HTTP Method: {{ result.item.method ?? 'get' }}\n </span>\n </template>\n <span class=\"sr-only\">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\">Description: </span>\n {{ result.item.description }}\n </template>\n </ScalarSearchResultItem>\n</template>\n"],"mappings":""}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Fragment, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
1
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
2
2
|
import { HttpMethod } from "@scalar/sidebar";
|
|
3
|
+
import { DEFAULT_MODELS_SECTION_LABEL } from "@scalar/types/api-reference";
|
|
3
4
|
import { ScalarIconBracketsCurly, ScalarIconTag, ScalarIconTerminalWindow, ScalarIconTextAlignLeft } from "@scalar/icons";
|
|
4
5
|
import { ScalarSearchResultItem } from "@scalar/components/search-results";
|
|
5
6
|
//#region src/features/Search/components/SearchResult.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -11,7 +12,8 @@ var SearchResult_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
11
12
|
props: {
|
|
12
13
|
id: {},
|
|
13
14
|
isSelected: { type: Boolean },
|
|
14
|
-
result: {}
|
|
15
|
+
result: {},
|
|
16
|
+
modelsSectionLabel: { default: () => DEFAULT_MODELS_SECTION_LABEL }
|
|
15
17
|
},
|
|
16
18
|
setup(__props) {
|
|
17
19
|
const ENTRY_ICONS = {
|
|
@@ -21,13 +23,13 @@ var SearchResult_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
21
23
|
tag: ScalarIconTag,
|
|
22
24
|
webhook: ScalarIconTerminalWindow
|
|
23
25
|
};
|
|
24
|
-
const
|
|
26
|
+
const entryLabels = computed(() => ({
|
|
25
27
|
heading: "Heading",
|
|
26
28
|
operation: "Operation",
|
|
27
29
|
tag: "Tag",
|
|
28
|
-
model:
|
|
30
|
+
model: __props.modelsSectionLabel,
|
|
29
31
|
webhook: "Webhook"
|
|
30
|
-
};
|
|
32
|
+
}));
|
|
31
33
|
return (_ctx, _cache) => {
|
|
32
34
|
return openBlock(), createBlock(unref(ScalarSearchResultItem), {
|
|
33
35
|
id: __props.id,
|
|
@@ -35,7 +37,7 @@ var SearchResult_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ d
|
|
|
35
37
|
selected: __props.isSelected
|
|
36
38
|
}, createSlots({
|
|
37
39
|
default: withCtx(() => [createElementVNode("span", { class: normalizeClass({ "text-decoration-line": __props.result.item.entry.type === "operation" && __props.result.item.entry.isDeprecated }) }, [
|
|
38
|
-
createElementVNode("span", _hoisted_1, [createTextVNode(toDisplayString(
|
|
40
|
+
createElementVNode("span", _hoisted_1, [createTextVNode(toDisplayString(entryLabels.value[__props.result.item.type]) + ":\xA0 ", 1), __props.result.item.entry.type === "operation" && __props.result.item.entry.isDeprecated ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(" (Deprecated)\xA0 ")], 64)) : createCommentVNode("", true)]),
|
|
39
41
|
createTextVNode(" " + toDisplayString(__props.result.item.title) + " ", 1),
|
|
40
42
|
_cache[0] || (_cache[0] = createElementVNode("span", { class: "sr-only" }, ",", -1))
|
|
41
43
|
], 2)]),
|
|
@@ -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 type { FuseResult } from 'fuse.js'\n\nimport type { EntryType, FuseData } from '@/features/Search/types'\n\
|
|
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 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}>()\n\nconst ENTRY_ICONS: { [x in EntryType]: ScalarIconComponent } = {\n heading: ScalarIconTextAlignLeft,\n model: ScalarIconBracketsCurly,\n operation: ScalarIconTerminalWindow,\n tag: ScalarIconTag,\n webhook: ScalarIconTerminalWindow,\n}\n\nconst entryLabels = computed((): { [x in EntryType]: string } => ({\n heading: 'Heading',\n operation: 'Operation',\n tag: 'Tag',\n model: modelsSectionLabel,\n webhook: 'Webhook',\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 (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 HTTP Method: {{ result.item.method ?? 'get' }}\n </span>\n </template>\n <span class=\"sr-only\">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\">Description: </span>\n {{ result.item.description }}\n </template>\n </ScalarSearchResultItem>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;EA0BA,MAAM,cAAyD;GAC7D,SAAS;GACT,OAAO;GACP,WAAW;GACX,KAAK;GACL,SAAS;GACX;EAEA,MAAM,cAAc,gBAA8C;GAChE,SAAS;GACT,WAAW;GACX,KAAK;GACL,OAAO,QAAA;GACP,SAAS;GACV,EAAC;;uBAIA,YAiDyB,MAAA,uBAAA,EAAA;IAhDtB,IAAI,QAAA;IACJ,MAAM,YAAY,QAAA,OAAO,KAAK;IAC9B,UAAU,QAAA;;2BAmBJ,CAlBP,mBAkBO,QAAA,EAjBJ,OAAK,eAAA,EAAA,wBAA8C,QAAA,OAAO,KAAK,MAAM,SAAI,eAA8B,QAAA,OAAO,KAAK,MAAM,cAAA,CAAA,EAAA,EAAA;KAK1H,mBASO,QATP,YASO,CAAA,gBAAA,gBARF,YAAA,MAAY,QAAA,OAAO,KAAK,MAAI,GAAI,UACnC,EAAA,EACqB,QAAA,OAAO,KAAK,MAAM,SAAI,eAAgC,QAAA,OAAO,KAAK,MAAM,gBAAA,WAAA,EAD7F,mBAMW,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,gBAFP,qBAEJ,CAAA,EAAA,GAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA;qBACK,MACP,gBAAG,QAAA,OAAO,KAAK,MAAK,GAAG,KACvB,EAAA;+BAAA,mBAA8B,QAAA,EAAxB,OAAM,WAAS,EAAC,KAAC,GAAA;;;OAGR,QAAA,OAAO,KAAK,SAAI,cAA2B,QAAA,OAAO,KAAK,UAAU,QAAA,OAAO,KAAK,SAAiB,QAAA,OAAO,KAAK,SAAS,QAAA,OAAO,KAAK,QAAA;UAK7I;sBAYM,CAXP,mBAWO,QAXP,YAWO;KAVW,QAAA,OAAO,KAAK,SAAI,eAAA,WAAA,EAAhC,mBAOW,UAAA,EAAA,KAAA,GAAA,EAAA,CANT,YAE0C,MAAA,WAAA,EAAA;MADxC,eAAY;MACX,QAAQ,QAAA,OAAO,KAAK,UAAM;8BAC7B,mBAEO,QAFP,YAAsB,mBACP,gBAAG,QAAA,OAAO,KAAK,UAAM,MAAA,EAAA,EAAA,CAAA,EAAA,GAAA,IAAA,mBAAA,IAAA,KAAA;+BAGtC,mBAAwC,QAAA,EAAlC,OAAM,WAAS,EAAC,aAAW,GAAA;qBAAO,MACxC,gBAAG,QAAA,OAAO,KAAK,KAAI,EAAA,EAAA;;;OAIV,QAAA,OAAO,KAAK,cAAA;UACtB;sBAC8C,CAAA,OAAA,OAAA,OAAA,KAA/C,mBAA+C,QAAA,EAAzC,OAAM,WAAS,EAAC,oBAAkB,GAAA,GAAA,gBAAO,MAC/C,gBAAG,QAAA,OAAO,KAAK,YAAW,EAAA,EAAA,CAAA,CAAA"}
|
|
@@ -1,7 +1,15 @@
|
|
|
1
|
+
import { type ModelsSectionLabel } from '@scalar/types/api-reference';
|
|
2
|
+
import type { AsyncApiDocument } from '@scalar/types/asyncapi/3.1';
|
|
1
3
|
import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
4
|
import type { FuseData } from '../../../features/Search/types';
|
|
5
|
+
/** Documents the search index can ingest. AsyncAPI is supported for headings, tags, and models; channels/operations/messages are not indexed yet. */
|
|
6
|
+
type SearchableDocument = OpenApiDocument | AsyncApiDocument;
|
|
7
|
+
type CreateSearchIndexOptions = {
|
|
8
|
+
modelsSectionLabel?: ModelsSectionLabel;
|
|
9
|
+
};
|
|
3
10
|
/**
|
|
4
11
|
* Create a search index from a list of entries.
|
|
5
12
|
*/
|
|
6
|
-
export declare function createSearchIndex(document:
|
|
13
|
+
export declare function createSearchIndex(document: SearchableDocument | undefined, options?: CreateSearchIndexOptions): FuseData[];
|
|
14
|
+
export {};
|
|
7
15
|
//# sourceMappingURL=create-search-index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-search-index.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-search-index.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAKlE,OAAO,KAAK,EAEV,eAAe,EAIhB,MAAM,8DAA8D,CAAA;AAErE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAWvD,qJAAqJ;AACrJ,KAAK,kBAAkB,GAAG,eAAe,GAAG,gBAAgB,CAAA;AA4E5D,KAAK,wBAAwB,GAAG;IAC9B,kBAAkB,CAAC,EAAE,kBAAkB,CAAA;CACxC,CAAA;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,kBAAkB,GAAG,SAAS,EACxC,OAAO,CAAC,EAAE,wBAAwB,GACjC,QAAQ,EAAE,CAqBZ"}
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
import { getAsyncApiModelSchema } from "../../../helpers/get-async-api-model-schema.js";
|
|
1
2
|
import { extractBodyDescriptions, extractBodyFieldNames, extractParameterDescriptions, extractParameterNames, extractSchemaDescriptions, extractSchemaFieldNames } from "../../../helpers/openapi.js";
|
|
3
|
+
import { DEFAULT_MODELS_SECTION_LABEL } from "@scalar/types/api-reference";
|
|
2
4
|
import { combineParams } from "@scalar/workspace-store/request-example";
|
|
5
|
+
import { isAsyncApiDocument, isOpenApiDocument } from "@scalar/workspace-store/schemas/type-guards";
|
|
3
6
|
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
4
7
|
//#region src/features/Search/helpers/create-search-index.ts
|
|
8
|
+
/**
|
|
9
|
+
* Resolves a schema from `components.schemas` for either document type.
|
|
10
|
+
*
|
|
11
|
+
* OpenAPI and AsyncAPI keep reusable schemas in the same place, so model search entries can read
|
|
12
|
+
* property names and descriptions from both. AsyncAPI entries need extra handling (ref siblings,
|
|
13
|
+
* multi-format wrappers, boolean schemas), which lives in {@link getAsyncApiModelSchema}.
|
|
14
|
+
*/
|
|
15
|
+
function getModelSchema(document, name) {
|
|
16
|
+
if (isOpenApiDocument(document)) return getResolvedRef(document.components?.schemas?.[name]);
|
|
17
|
+
if (isAsyncApiDocument(document)) return getAsyncApiModelSchema(document, name);
|
|
18
|
+
}
|
|
5
19
|
function responseExampleValueToString(value) {
|
|
6
20
|
if (typeof value === "string") return value;
|
|
7
21
|
try {
|
|
@@ -34,14 +48,15 @@ function extractResponseExamples(responses) {
|
|
|
34
48
|
/**
|
|
35
49
|
* Create a search index from a list of entries.
|
|
36
50
|
*/
|
|
37
|
-
function createSearchIndex(document) {
|
|
51
|
+
function createSearchIndex(document, options) {
|
|
38
52
|
const index = [];
|
|
53
|
+
const modelsSectionTitle = options?.modelsSectionLabel ?? DEFAULT_MODELS_SECTION_LABEL;
|
|
39
54
|
/**
|
|
40
55
|
* Recursively processes entries and their children to build the search index.
|
|
41
56
|
*/
|
|
42
57
|
function processEntries(entriesToProcess) {
|
|
43
58
|
entriesToProcess.forEach((entry) => {
|
|
44
|
-
addEntryToIndex(entry, index, document);
|
|
59
|
+
addEntryToIndex(entry, index, document, modelsSectionTitle);
|
|
45
60
|
if ("children" in entry && entry.children) processEntries(entry.children);
|
|
46
61
|
});
|
|
47
62
|
}
|
|
@@ -50,10 +65,14 @@ function createSearchIndex(document) {
|
|
|
50
65
|
}
|
|
51
66
|
/**
|
|
52
67
|
* Adds a single entry to the search index, handling all entry types recursively.
|
|
68
|
+
*
|
|
69
|
+
* AsyncAPI documents contribute heading, tag, and model entries here. Their
|
|
70
|
+
* channels, operations, and messages are not indexed yet.
|
|
53
71
|
*/
|
|
54
|
-
function addEntryToIndex(entry, index, document) {
|
|
72
|
+
function addEntryToIndex(entry, index, document, modelsSectionTitle) {
|
|
73
|
+
const openApiDocument = isOpenApiDocument(document) ? document : void 0;
|
|
55
74
|
if (entry.type === "operation") {
|
|
56
|
-
const pathItem = getResolvedRef(
|
|
75
|
+
const pathItem = getResolvedRef(openApiDocument?.paths?.[entry.path]);
|
|
57
76
|
const operation = getResolvedRef(pathItem?.[entry.method]) ?? {};
|
|
58
77
|
const operationWithPathParams = {
|
|
59
78
|
...operation,
|
|
@@ -82,7 +101,7 @@ function addEntryToIndex(entry, index, document) {
|
|
|
82
101
|
return;
|
|
83
102
|
}
|
|
84
103
|
if (entry.type === "webhook") {
|
|
85
|
-
const webhook = getResolvedRef(
|
|
104
|
+
const webhook = getResolvedRef(openApiDocument?.webhooks?.[entry.name]?.[entry.method]) ?? {};
|
|
86
105
|
const webhookDescription = webhook.description || "";
|
|
87
106
|
index.push({
|
|
88
107
|
id: entry.id,
|
|
@@ -98,14 +117,14 @@ function addEntryToIndex(entry, index, document) {
|
|
|
98
117
|
return;
|
|
99
118
|
}
|
|
100
119
|
if (entry.type === "model") {
|
|
101
|
-
const schema =
|
|
120
|
+
const schema = getModelSchema(document, entry.name);
|
|
102
121
|
const schemaDescription = schema?.description ?? "";
|
|
103
122
|
const propertyNames = extractSchemaFieldNames(schema);
|
|
104
123
|
const propertyDescriptions = extractSchemaDescriptions(schema);
|
|
105
124
|
index.push({
|
|
106
125
|
type: "model",
|
|
107
126
|
title: entry.title,
|
|
108
|
-
description:
|
|
127
|
+
description: modelsSectionTitle,
|
|
109
128
|
id: entry.id,
|
|
110
129
|
body: propertyNames,
|
|
111
130
|
bodyDescriptions: schemaDescription ? [schemaDescription, ...propertyDescriptions] : propertyDescriptions,
|
|
@@ -117,7 +136,7 @@ function addEntryToIndex(entry, index, document) {
|
|
|
117
136
|
index.push({
|
|
118
137
|
id: entry.id,
|
|
119
138
|
type: "heading",
|
|
120
|
-
title:
|
|
139
|
+
title: entry.title,
|
|
121
140
|
description: "Heading",
|
|
122
141
|
body: "",
|
|
123
142
|
entry
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-search-index.js","names":[],"sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { combineParams } from '@scalar/workspace-store/request-example'\nimport type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\nimport type {\n MediaTypeObject,\n OpenApiDocument,\n OperationObject,\n ResponsesObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport type { FuseData } from '@/features/Search/types'\nimport {\n extractBodyDescriptions,\n extractBodyFieldNames,\n extractParameterDescriptions,\n extractParameterNames,\n extractSchemaDescriptions,\n extractSchemaFieldNames,\n} from '@/helpers/openapi'\n\nfunction responseExampleValueToString(value: unknown): string {\n if (typeof value === 'string') {\n return value\n }\n\n try {\n return JSON.stringify(value)\n } catch (_error) {\n return ''\n }\n}\n\nfunction mediaTypeExamplesToStrings(mediaType: MediaTypeObject): string[] {\n const examplesFromNamedMap = Object.values(mediaType.examples ?? {})\n .flatMap((example) => {\n const resolvedExample = getResolvedRef(example)\n\n if (!resolvedExample || !('value' in resolvedExample)) {\n return []\n }\n\n return responseExampleValueToString(resolvedExample.value)\n })\n .filter((value) => value.length > 0)\n\n const mediaTypeExample =\n 'example' in mediaType && mediaType.example !== undefined ? responseExampleValueToString(mediaType.example) : ''\n\n return mediaTypeExample ? [mediaTypeExample, ...examplesFromNamedMap] : examplesFromNamedMap\n}\n\nfunction extractResponseExamples(responses: ResponsesObject | undefined): string[] {\n if (!responses) {\n return []\n }\n\n return Object.values(responses)\n .flatMap((response) => {\n const resolvedResponse = getResolvedRef(response)\n if (!resolvedResponse?.content) {\n return []\n }\n\n return Object.values(resolvedResponse.content).flatMap((mediaType) => {\n const resolvedMediaType = getResolvedRef(mediaType)\n if (!resolvedMediaType) {\n return []\n }\n\n return mediaTypeExamplesToStrings(resolvedMediaType)\n })\n })\n .filter((value) => value.length > 0)\n}\n\n/**\n * Create a search index from a list of entries.\n */\nexport function createSearchIndex(document: OpenApiDocument | undefined): FuseData[] {\n const index: FuseData[] = []\n\n /**\n * Recursively processes entries and their children to build the search index.\n */\n function processEntries(entriesToProcess: TraversedEntry[]): void {\n entriesToProcess.forEach((entry) => {\n addEntryToIndex(entry, index, document)\n\n // Recursively process children if they exist\n if ('children' in entry && entry.children) {\n processEntries(entry.children)\n }\n })\n }\n\n processEntries(document?.['x-scalar-navigation']?.children ?? [])\n\n return index\n}\n\n/**\n * Adds a single entry to the search index, handling all entry types recursively.\n */\nfunction addEntryToIndex(entry: TraversedEntry, index: FuseData[], document?: OpenApiDocument): void {\n // Operation\n if (entry.type === 'operation') {\n const pathItem = getResolvedRef(document?.paths?.[entry.path])\n const operation = (getResolvedRef(pathItem?.[entry.method]) ?? {}) as OperationObject\n const operationWithPathParams = {\n ...operation,\n parameters: combineParams(pathItem?.parameters, operation.parameters),\n }\n\n const parameters = extractParameterNames(operationWithPathParams.parameters ?? [])\n const parameterDescriptions = extractParameterDescriptions(operationWithPathParams.parameters ?? [])\n const body = extractBodyFieldNames(operationWithPathParams)\n const bodyDescriptions = extractBodyDescriptions(operationWithPathParams)\n const responseExamples = extractResponseExamples(operationWithPathParams.responses)\n\n index.push({\n type: 'operation',\n title: entry.title,\n id: entry.id,\n description: operationWithPathParams.description || '',\n method: entry.method,\n path: entry.path,\n body,\n bodyDescriptions,\n parameters,\n parameterDescriptions,\n responseExamples,\n operationId: operationWithPathParams.operationId,\n entry,\n })\n\n return\n }\n\n // Webhook\n if (entry.type === 'webhook') {\n const webhook = getResolvedRef(document?.webhooks?.[entry.name]?.[entry.method]) ?? {}\n const webhookDescription = webhook.description || ''\n\n index.push({\n id: entry.id,\n type: 'webhook',\n title: entry.title,\n description: 'Webhook',\n method: entry.method,\n body: '',\n bodyDescriptions: webhookDescription ? [webhookDescription] : [],\n operationId: webhook.operationId,\n entry,\n })\n\n return\n }\n\n // Model\n if (entry.type === 'model') {\n const schema = getResolvedRef(document?.components?.schemas?.[entry.name])\n const schemaDescription = schema?.description ?? ''\n const propertyNames = extractSchemaFieldNames(schema)\n const propertyDescriptions = extractSchemaDescriptions(schema)\n\n index.push({\n type: 'model',\n title: entry.title,\n description: 'Model',\n id: entry.id,\n body: propertyNames,\n bodyDescriptions: schemaDescription ? [schemaDescription, ...propertyDescriptions] : propertyDescriptions,\n entry,\n })\n\n return\n }\n\n // Models heading\n if (entry.type === 'models') {\n index.push({\n id: entry.id,\n type: 'heading',\n title: 'Models',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n\n // Tag\n if (entry.type === 'tag' && entry.isWebhooks === true) {\n index.push({\n id: entry.id,\n type: 'heading',\n title: 'Webhooks',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n\n if (entry.type === 'tag' && entry.isGroup === false) {\n index.push({\n id: entry.id,\n title: entry.title,\n description: entry.description || '',\n type: 'tag',\n body: '',\n entry,\n })\n\n return\n }\n\n // Tag group\n if (entry.type === 'tag' && entry.isGroup === true) {\n index.push({\n id: entry.id,\n title: entry.title,\n description: 'Tag Group',\n type: 'tag',\n body: '',\n entry,\n })\n\n return\n }\n\n // Headings from info.description\n if (entry.type === 'text') {\n index.push({\n id: entry.id,\n type: 'heading',\n title: entry.title ?? '',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"create-search-index.js","names":[],"sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"sourcesContent":["import { DEFAULT_MODELS_SECTION_LABEL, type ModelsSectionLabel } from '@scalar/types/api-reference'\nimport type { AsyncApiDocument } from '@scalar/types/asyncapi/3.1'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { combineParams } from '@scalar/workspace-store/request-example'\nimport type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\nimport { isAsyncApiDocument, isOpenApiDocument } from '@scalar/workspace-store/schemas/type-guards'\nimport type {\n MediaTypeObject,\n OpenApiDocument,\n OperationObject,\n ResponsesObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport type { FuseData } from '@/features/Search/types'\nimport { getAsyncApiModelSchema } from '@/helpers/get-async-api-model-schema'\nimport {\n extractBodyDescriptions,\n extractBodyFieldNames,\n extractParameterDescriptions,\n extractParameterNames,\n extractSchemaDescriptions,\n extractSchemaFieldNames,\n} from '@/helpers/openapi'\n\n/** Documents the search index can ingest. AsyncAPI is supported for headings, tags, and models; channels/operations/messages are not indexed yet. */\ntype SearchableDocument = OpenApiDocument | AsyncApiDocument\n\n/**\n * Resolves a schema from `components.schemas` for either document type.\n *\n * OpenAPI and AsyncAPI keep reusable schemas in the same place, so model search entries can read\n * property names and descriptions from both. AsyncAPI entries need extra handling (ref siblings,\n * multi-format wrappers, boolean schemas), which lives in {@link getAsyncApiModelSchema}.\n */\nfunction getModelSchema(document: SearchableDocument | undefined, name: string): SchemaObject | undefined {\n if (isOpenApiDocument(document)) {\n return getResolvedRef(document.components?.schemas?.[name])\n }\n\n if (isAsyncApiDocument(document)) {\n return getAsyncApiModelSchema(document, name)\n }\n\n return undefined\n}\n\nfunction responseExampleValueToString(value: unknown): string {\n if (typeof value === 'string') {\n return value\n }\n\n try {\n return JSON.stringify(value)\n } catch (_error) {\n return ''\n }\n}\n\nfunction mediaTypeExamplesToStrings(mediaType: MediaTypeObject): string[] {\n const examplesFromNamedMap = Object.values(mediaType.examples ?? {})\n .flatMap((example) => {\n const resolvedExample = getResolvedRef(example)\n\n if (!resolvedExample || !('value' in resolvedExample)) {\n return []\n }\n\n return responseExampleValueToString(resolvedExample.value)\n })\n .filter((value) => value.length > 0)\n\n const mediaTypeExample =\n 'example' in mediaType && mediaType.example !== undefined ? responseExampleValueToString(mediaType.example) : ''\n\n return mediaTypeExample ? [mediaTypeExample, ...examplesFromNamedMap] : examplesFromNamedMap\n}\n\nfunction extractResponseExamples(responses: ResponsesObject | undefined): string[] {\n if (!responses) {\n return []\n }\n\n return Object.values(responses)\n .flatMap((response) => {\n const resolvedResponse = getResolvedRef(response)\n if (!resolvedResponse?.content) {\n return []\n }\n\n return Object.values(resolvedResponse.content).flatMap((mediaType) => {\n const resolvedMediaType = getResolvedRef(mediaType)\n if (!resolvedMediaType) {\n return []\n }\n\n return mediaTypeExamplesToStrings(resolvedMediaType)\n })\n })\n .filter((value) => value.length > 0)\n}\n\ntype CreateSearchIndexOptions = {\n modelsSectionLabel?: ModelsSectionLabel\n}\n\n/**\n * Create a search index from a list of entries.\n */\nexport function createSearchIndex(\n document: SearchableDocument | undefined,\n options?: CreateSearchIndexOptions,\n): FuseData[] {\n const index: FuseData[] = []\n const modelsSectionTitle = options?.modelsSectionLabel ?? DEFAULT_MODELS_SECTION_LABEL\n\n /**\n * Recursively processes entries and their children to build the search index.\n */\n function processEntries(entriesToProcess: TraversedEntry[]): void {\n entriesToProcess.forEach((entry) => {\n addEntryToIndex(entry, index, document, modelsSectionTitle)\n\n // Recursively process children if they exist\n if ('children' in entry && entry.children) {\n processEntries(entry.children)\n }\n })\n }\n\n processEntries(document?.['x-scalar-navigation']?.children ?? [])\n\n return index\n}\n\n/**\n * Adds a single entry to the search index, handling all entry types recursively.\n *\n * AsyncAPI documents contribute heading, tag, and model entries here. Their\n * channels, operations, and messages are not indexed yet.\n */\nfunction addEntryToIndex(\n entry: TraversedEntry,\n index: FuseData[],\n document: SearchableDocument | undefined,\n modelsSectionTitle: string,\n): void {\n // OpenAPI-only branches read fields that do not exist on AsyncAPI documents (paths, webhooks,\n // components.schemas). Narrow once here so each branch can dereference safely.\n const openApiDocument = isOpenApiDocument(document) ? document : undefined\n\n // Operation\n if (entry.type === 'operation') {\n const pathItem = getResolvedRef(openApiDocument?.paths?.[entry.path])\n const operation = (getResolvedRef(pathItem?.[entry.method]) ?? {}) as OperationObject\n const operationWithPathParams = {\n ...operation,\n parameters: combineParams(pathItem?.parameters, operation.parameters),\n }\n\n const parameters = extractParameterNames(operationWithPathParams.parameters ?? [])\n const parameterDescriptions = extractParameterDescriptions(operationWithPathParams.parameters ?? [])\n const body = extractBodyFieldNames(operationWithPathParams)\n const bodyDescriptions = extractBodyDescriptions(operationWithPathParams)\n const responseExamples = extractResponseExamples(operationWithPathParams.responses)\n\n index.push({\n type: 'operation',\n title: entry.title,\n id: entry.id,\n description: operationWithPathParams.description || '',\n method: entry.method,\n path: entry.path,\n body,\n bodyDescriptions,\n parameters,\n parameterDescriptions,\n responseExamples,\n operationId: operationWithPathParams.operationId,\n entry,\n })\n\n return\n }\n\n // Webhook\n if (entry.type === 'webhook') {\n const webhook = getResolvedRef(openApiDocument?.webhooks?.[entry.name]?.[entry.method]) ?? {}\n const webhookDescription = webhook.description || ''\n\n index.push({\n id: entry.id,\n type: 'webhook',\n title: entry.title,\n description: 'Webhook',\n method: entry.method,\n body: '',\n bodyDescriptions: webhookDescription ? [webhookDescription] : [],\n operationId: webhook.operationId,\n entry,\n })\n\n return\n }\n\n // Model\n if (entry.type === 'model') {\n const schema = getModelSchema(document, entry.name)\n const schemaDescription = schema?.description ?? ''\n const propertyNames = extractSchemaFieldNames(schema)\n const propertyDescriptions = extractSchemaDescriptions(schema)\n\n index.push({\n type: 'model',\n title: entry.title,\n description: modelsSectionTitle,\n id: entry.id,\n body: propertyNames,\n bodyDescriptions: schemaDescription ? [schemaDescription, ...propertyDescriptions] : propertyDescriptions,\n entry,\n })\n\n return\n }\n\n // Models heading\n if (entry.type === 'models') {\n index.push({\n id: entry.id,\n type: 'heading',\n title: entry.title,\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n\n // Tag\n if (entry.type === 'tag' && entry.isWebhooks === true) {\n index.push({\n id: entry.id,\n type: 'heading',\n title: 'Webhooks',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n\n if (entry.type === 'tag' && entry.isGroup === false) {\n index.push({\n id: entry.id,\n title: entry.title,\n description: entry.description || '',\n type: 'tag',\n body: '',\n entry,\n })\n\n return\n }\n\n // Tag group\n if (entry.type === 'tag' && entry.isGroup === true) {\n index.push({\n id: entry.id,\n title: entry.title,\n description: 'Tag Group',\n type: 'tag',\n body: '',\n entry,\n })\n\n return\n }\n\n // Headings from info.description\n if (entry.type === 'text') {\n index.push({\n id: entry.id,\n type: 'heading',\n title: entry.title ?? '',\n description: 'Heading',\n body: '',\n entry,\n })\n\n return\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAmCA,SAAS,eAAe,UAA0C,MAAwC;AACxG,KAAI,kBAAkB,SAAS,CAC7B,QAAO,eAAe,SAAS,YAAY,UAAU,MAAM;AAG7D,KAAI,mBAAmB,SAAS,CAC9B,QAAO,uBAAuB,UAAU,KAAK;;AAMjD,SAAS,6BAA6B,OAAwB;AAC5D,KAAI,OAAO,UAAU,SACnB,QAAO;AAGT,KAAI;AACF,SAAO,KAAK,UAAU,MAAM;UACrB,QAAQ;AACf,SAAO;;;AAIX,SAAS,2BAA2B,WAAsC;CACxE,MAAM,uBAAuB,OAAO,OAAO,UAAU,YAAY,EAAE,CAAC,CACjE,SAAS,YAAY;EACpB,MAAM,kBAAkB,eAAe,QAAQ;AAE/C,MAAI,CAAC,mBAAmB,EAAE,WAAW,iBACnC,QAAO,EAAE;AAGX,SAAO,6BAA6B,gBAAgB,MAAM;GAC1D,CACD,QAAQ,UAAU,MAAM,SAAS,EAAE;CAEtC,MAAM,mBACJ,aAAa,aAAa,UAAU,YAAY,KAAA,IAAY,6BAA6B,UAAU,QAAQ,GAAG;AAEhH,QAAO,mBAAmB,CAAC,kBAAkB,GAAG,qBAAqB,GAAG;;AAG1E,SAAS,wBAAwB,WAAkD;AACjF,KAAI,CAAC,UACH,QAAO,EAAE;AAGX,QAAO,OAAO,OAAO,UAAU,CAC5B,SAAS,aAAa;EACrB,MAAM,mBAAmB,eAAe,SAAS;AACjD,MAAI,CAAC,kBAAkB,QACrB,QAAO,EAAE;AAGX,SAAO,OAAO,OAAO,iBAAiB,QAAQ,CAAC,SAAS,cAAc;GACpE,MAAM,oBAAoB,eAAe,UAAU;AACnD,OAAI,CAAC,kBACH,QAAO,EAAE;AAGX,UAAO,2BAA2B,kBAAkB;IACpD;GACF,CACD,QAAQ,UAAU,MAAM,SAAS,EAAE;;;;;AAUxC,SAAgB,kBACd,UACA,SACY;CACZ,MAAM,QAAoB,EAAE;CAC5B,MAAM,qBAAqB,SAAS,sBAAsB;;;;CAK1D,SAAS,eAAe,kBAA0C;AAChE,mBAAiB,SAAS,UAAU;AAClC,mBAAgB,OAAO,OAAO,UAAU,mBAAmB;AAG3D,OAAI,cAAc,SAAS,MAAM,SAC/B,gBAAe,MAAM,SAAS;IAEhC;;AAGJ,gBAAe,WAAW,wBAAwB,YAAY,EAAE,CAAC;AAEjE,QAAO;;;;;;;;AAST,SAAS,gBACP,OACA,OACA,UACA,oBACM;CAGN,MAAM,kBAAkB,kBAAkB,SAAS,GAAG,WAAW,KAAA;AAGjE,KAAI,MAAM,SAAS,aAAa;EAC9B,MAAM,WAAW,eAAe,iBAAiB,QAAQ,MAAM,MAAM;EACrE,MAAM,YAAa,eAAe,WAAW,MAAM,QAAQ,IAAI,EAAE;EACjE,MAAM,0BAA0B;GAC9B,GAAG;GACH,YAAY,cAAc,UAAU,YAAY,UAAU,WAAW;GACtE;EAED,MAAM,aAAa,sBAAsB,wBAAwB,cAAc,EAAE,CAAC;EAClF,MAAM,wBAAwB,6BAA6B,wBAAwB,cAAc,EAAE,CAAC;EACpG,MAAM,OAAO,sBAAsB,wBAAwB;EAC3D,MAAM,mBAAmB,wBAAwB,wBAAwB;EACzE,MAAM,mBAAmB,wBAAwB,wBAAwB,UAAU;AAEnF,QAAM,KAAK;GACT,MAAM;GACN,OAAO,MAAM;GACb,IAAI,MAAM;GACV,aAAa,wBAAwB,eAAe;GACpD,QAAQ,MAAM;GACd,MAAM,MAAM;GACZ;GACA;GACA;GACA;GACA;GACA,aAAa,wBAAwB;GACrC;GACD,CAAC;AAEF;;AAIF,KAAI,MAAM,SAAS,WAAW;EAC5B,MAAM,UAAU,eAAe,iBAAiB,WAAW,MAAM,QAAQ,MAAM,QAAQ,IAAI,EAAE;EAC7F,MAAM,qBAAqB,QAAQ,eAAe;AAElD,QAAM,KAAK;GACT,IAAI,MAAM;GACV,MAAM;GACN,OAAO,MAAM;GACb,aAAa;GACb,QAAQ,MAAM;GACd,MAAM;GACN,kBAAkB,qBAAqB,CAAC,mBAAmB,GAAG,EAAE;GAChE,aAAa,QAAQ;GACrB;GACD,CAAC;AAEF;;AAIF,KAAI,MAAM,SAAS,SAAS;EAC1B,MAAM,SAAS,eAAe,UAAU,MAAM,KAAK;EACnD,MAAM,oBAAoB,QAAQ,eAAe;EACjD,MAAM,gBAAgB,wBAAwB,OAAO;EACrD,MAAM,uBAAuB,0BAA0B,OAAO;AAE9D,QAAM,KAAK;GACT,MAAM;GACN,OAAO,MAAM;GACb,aAAa;GACb,IAAI,MAAM;GACV,MAAM;GACN,kBAAkB,oBAAoB,CAAC,mBAAmB,GAAG,qBAAqB,GAAG;GACrF;GACD,CAAC;AAEF;;AAIF,KAAI,MAAM,SAAS,UAAU;AAC3B,QAAM,KAAK;GACT,IAAI,MAAM;GACV,MAAM;GACN,OAAO,MAAM;GACb,aAAa;GACb,MAAM;GACN;GACD,CAAC;AAEF;;AAIF,KAAI,MAAM,SAAS,SAAS,MAAM,eAAe,MAAM;AACrD,QAAM,KAAK;GACT,IAAI,MAAM;GACV,MAAM;GACN,OAAO;GACP,aAAa;GACb,MAAM;GACN;GACD,CAAC;AAEF;;AAGF,KAAI,MAAM,SAAS,SAAS,MAAM,YAAY,OAAO;AACnD,QAAM,KAAK;GACT,IAAI,MAAM;GACV,OAAO,MAAM;GACb,aAAa,MAAM,eAAe;GAClC,MAAM;GACN,MAAM;GACN;GACD,CAAC;AAEF;;AAIF,KAAI,MAAM,SAAS,SAAS,MAAM,YAAY,MAAM;AAClD,QAAM,KAAK;GACT,IAAI,MAAM;GACV,OAAO,MAAM;GACb,aAAa;GACb,MAAM;GACN,MAAM;GACN;GACD,CAAC;AAEF;;AAIF,KAAI,MAAM,SAAS,QAAQ;AACzB,QAAM,KAAK;GACT,IAAI,MAAM;GACV,MAAM;GACN,OAAO,MAAM,SAAS;GACtB,aAAa;GACb,MAAM;GACN;GACD,CAAC;AAEF"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { type ModelsSectionLabel } from '@scalar/types/api-reference';
|
|
2
|
+
import type { AsyncApiDocument } from '@scalar/types/asyncapi/3.1';
|
|
1
3
|
import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
2
4
|
import { type MaybeRefOrGetter } from 'vue';
|
|
3
5
|
import type { FuseData } from '../types';
|
|
4
6
|
/**
|
|
5
|
-
* Creates the search index from an OpenAPI document.
|
|
7
|
+
* Creates the search index from an OpenAPI or AsyncAPI document.
|
|
6
8
|
*/
|
|
7
|
-
export declare function useSearchIndex(document: MaybeRefOrGetter<OpenApiDocument | undefined>): {
|
|
9
|
+
export declare function useSearchIndex(document: MaybeRefOrGetter<OpenApiDocument | AsyncApiDocument | undefined>, modelsSectionLabel?: MaybeRefOrGetter<ModelsSectionLabel | undefined>): {
|
|
8
10
|
results: import("vue").ComputedRef<{
|
|
9
11
|
item: FuseData;
|
|
10
12
|
refIndex: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearchIndex.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/hooks/useSearchIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,KAAK,CAAA;AAInE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC;;GAEG;AACH,wBAAgB,cAAc,
|
|
1
|
+
{"version":3,"file":"useSearchIndex.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/hooks/useSearchIndex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,KAAK,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AACnG,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAEnG,OAAO,EAAE,KAAK,gBAAgB,EAA0B,MAAM,KAAK,CAAA;AAInE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC;;GAEG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,gBAAgB,CAAC,eAAe,GAAG,gBAAgB,GAAG,SAAS,CAAC,EAC1E,kBAAkB,GAAE,gBAAgB,CAAC,kBAAkB,GAAG,SAAS,CAAgC;;;;;;EAsCpG"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { createFuseInstance } from "../helpers/create-fuse-instance.js";
|
|
2
2
|
import { createSearchIndex } from "../helpers/create-search-index.js";
|
|
3
3
|
import { computed, ref, toValue } from "vue";
|
|
4
|
+
import { DEFAULT_MODELS_SECTION_LABEL } from "@scalar/types/api-reference";
|
|
4
5
|
//#region src/features/Search/hooks/useSearchIndex.ts
|
|
5
6
|
var MAX_SEARCH_RESULTS = 25;
|
|
6
7
|
/**
|
|
7
|
-
* Creates the search index from an OpenAPI document.
|
|
8
|
+
* Creates the search index from an OpenAPI or AsyncAPI document.
|
|
8
9
|
*/
|
|
9
|
-
function useSearchIndex(document) {
|
|
10
|
-
const searchIndex = computed(() => createSearchIndex(toValue(document)));
|
|
10
|
+
function useSearchIndex(document, modelsSectionLabel = DEFAULT_MODELS_SECTION_LABEL) {
|
|
11
|
+
const searchIndex = computed(() => createSearchIndex(toValue(document), { modelsSectionLabel: toValue(modelsSectionLabel) ?? DEFAULT_MODELS_SECTION_LABEL }));
|
|
11
12
|
/** When the document changes we replace the search index */
|
|
12
13
|
const fuse = computed(() => {
|
|
13
14
|
const instance = createFuseInstance();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSearchIndex.js","names":[],"sources":["../../../../src/features/Search/hooks/useSearchIndex.ts"],"sourcesContent":["import type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { FuseResult } from 'fuse.js'\nimport { type MaybeRefOrGetter, computed, ref, toValue } from 'vue'\n\nimport { createFuseInstance } from '../helpers/create-fuse-instance'\nimport { createSearchIndex } from '../helpers/create-search-index'\nimport type { FuseData } from '../types'\n\nconst MAX_SEARCH_RESULTS = 25\n\n/**\n * Creates the search index from an OpenAPI document.\n */\nexport function useSearchIndex(document: MaybeRefOrGetter<OpenApiDocument | undefined>) {\n const searchIndex = computed<FuseData[]>(()
|
|
1
|
+
{"version":3,"file":"useSearchIndex.js","names":[],"sources":["../../../../src/features/Search/hooks/useSearchIndex.ts"],"sourcesContent":["import { DEFAULT_MODELS_SECTION_LABEL, type ModelsSectionLabel } from '@scalar/types/api-reference'\nimport type { AsyncApiDocument } from '@scalar/types/asyncapi/3.1'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { FuseResult } from 'fuse.js'\nimport { type MaybeRefOrGetter, computed, ref, toValue } from 'vue'\n\nimport { createFuseInstance } from '../helpers/create-fuse-instance'\nimport { createSearchIndex } from '../helpers/create-search-index'\nimport type { FuseData } from '../types'\n\nconst MAX_SEARCH_RESULTS = 25\n\n/**\n * Creates the search index from an OpenAPI or AsyncAPI document.\n */\nexport function useSearchIndex(\n document: MaybeRefOrGetter<OpenApiDocument | AsyncApiDocument | undefined>,\n modelsSectionLabel: MaybeRefOrGetter<ModelsSectionLabel | undefined> = DEFAULT_MODELS_SECTION_LABEL,\n) {\n const searchIndex = computed<FuseData[]>(() =>\n createSearchIndex(toValue(document), {\n modelsSectionLabel: toValue(modelsSectionLabel) ?? DEFAULT_MODELS_SECTION_LABEL,\n }),\n )\n\n /** When the document changes we replace the search index */\n const fuse = computed(() => {\n const instance = createFuseInstance()\n instance.setCollection(searchIndex.value)\n return instance\n })\n\n const query = ref<string>('')\n\n const results = computed(() => {\n if (query.value.length !== 0) {\n return fuse.value.search(query.value, {\n limit: MAX_SEARCH_RESULTS,\n })\n }\n\n // Show a few entries as a placeholder\n return searchIndex.value.slice(0, MAX_SEARCH_RESULTS).map(\n (item: FuseData, index: number) =>\n ({\n item,\n refIndex: index,\n }) satisfies FuseResult<FuseData>,\n )\n })\n\n return {\n results,\n query,\n }\n}\n"],"mappings":";;;;;AAUA,IAAM,qBAAqB;;;;AAK3B,SAAgB,eACd,UACA,qBAAuE,8BACvE;CACA,MAAM,cAAc,eAClB,kBAAkB,QAAQ,SAAS,EAAE,EACnC,oBAAoB,QAAQ,mBAAmB,IAAI,8BACpD,CAAC,CACH;;CAGD,MAAM,OAAO,eAAe;EAC1B,MAAM,WAAW,oBAAoB;AACrC,WAAS,cAAc,YAAY,MAAM;AACzC,SAAO;GACP;CAEF,MAAM,QAAQ,IAAY,GAAG;AAmB7B,QAAO;EACL,SAlBc,eAAe;AAC7B,OAAI,MAAM,MAAM,WAAW,EACzB,QAAO,KAAK,MAAM,OAAO,MAAM,OAAO,EACpC,OAAO,oBACR,CAAC;AAIJ,UAAO,YAAY,MAAM,MAAM,GAAG,mBAAmB,CAAC,KACnD,MAAgB,WACd;IACC;IACA,UAAU;IACX,EACJ;IACD;EAIA;EACD"}
|
package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiReferenceToolbarConfigLayoutOptions.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiReferenceToolbarConfigLayoutOptions.vue.d.ts","sourceRoot":"","sources":["../../../../src/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue"],"names":[],"mappings":"AAqHA,OAAO,EAEL,KAAK,yBAAyB,EAC/B,MAAM,6BAA6B,CAAA;AAGpC,KAAK,aAAa,GAAG;IACnB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,mBAAmB,CAAC,EAAE,OAAO,CAAA;IAC7B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,sBAAsB,CAAC,EAAE,OAAO,CAAA;IAChC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,kBAAkB,CAAC,EAAE,OAAO,CAAA;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,qBAAqB,CAAC,EAAE,OAAO,CAAA;IAC/B,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,KAAK,WAAW,GAAG;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC,yBAAyB,CAAC,CAAA;CACnD,CAAC;AAkCF,KAAK,gBAAgB,GAAG;IACxB,UAAU,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAKF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAgRxD,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiReferenceToolbarConfigLayoutOptions.vue.js","names":[],"sources":["../../../../src/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarFormInputGroup } from '@scalar/components/form'\nimport { ScalarToggleInput } from '@scalar/components/toggle'\nimport type
|
|
1
|
+
{"version":3,"file":"ApiReferenceToolbarConfigLayoutOptions.vue.js","names":[],"sources":["../../../../src/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarFormInputGroup } from '@scalar/components/form'\nimport { ScalarToggleInput } from '@scalar/components/toggle'\nimport {\n DEFAULT_MODELS_SECTION_LABEL,\n type ApiReferenceConfiguration,\n} from '@scalar/types/api-reference'\nimport { computed } from 'vue'\n\ntype LayoutOptions = {\n showSidebar?: boolean\n defaultOpenFirstTag?: boolean\n defaultOpenAllTags?: boolean\n expandAllModelSections?: boolean\n expandAllResponses?: boolean\n hideClientButton?: boolean\n hideDarkModeToggle?: boolean\n hideModels?: boolean\n hideSearch?: boolean\n hideTestRequestButton?: boolean\n showOperationId?: boolean\n}\n\nconst { configuration } = defineProps<{\n configuration?: Partial<ApiReferenceConfiguration>\n}>()\n\nconst model = defineModel<LayoutOptions>({\n default: {},\n})\n\nfunction getValue(key: keyof LayoutOptions, defaultValue: boolean = false) {\n return model.value[key] ?? configuration?.[key] ?? defaultValue\n}\n\nfunction setValue(\n key: keyof LayoutOptions,\n value: boolean,\n defaultValue: boolean = false,\n) {\n if (value !== defaultValue) {\n model.value = { ...model.value, [key]: value }\n } else {\n model.value = Object.fromEntries(\n Object.entries(model.value).filter(([k]) => key !== k),\n )\n }\n}\n\nconst modelsSectionLabel = computed(\n () => configuration?.modelsSectionLabel ?? DEFAULT_MODELS_SECTION_LABEL,\n)\n</script>\n<template>\n <ScalarFormInputGroup>\n <ScalarToggleInput\n :modelValue=\"getValue('showSidebar', true)\"\n @update:modelValue=\"(v) => setValue('showSidebar', !!v, true)\">\n Show Sidebar\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('defaultOpenFirstTag', true)\"\n @update:modelValue=\"(v) => setValue('defaultOpenFirstTag', !!v, true)\">\n Default Open First Tag\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('defaultOpenAllTags')\"\n @update:modelValue=\"(v) => setValue('defaultOpenAllTags', !!v)\">\n Default Open All Tags\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('expandAllModelSections')\"\n @update:modelValue=\"(v) => setValue('expandAllModelSections', !!v)\">\n Expand All {{ modelsSectionLabel }}\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('expandAllResponses')\"\n @update:modelValue=\"(v) => setValue('expandAllResponses', !!v)\">\n Expand All Responses\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('hideClientButton')\"\n @update:modelValue=\"(v) => setValue('hideClientButton', !!v)\">\n Hide Client Button\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('hideDarkModeToggle')\"\n @update:modelValue=\"(v) => setValue('hideDarkModeToggle', !!v)\">\n Hide Dark Mode Toggle\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('hideModels')\"\n @update:modelValue=\"(v) => setValue('hideModels', !!v)\">\n Hide {{ modelsSectionLabel }}\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('hideSearch')\"\n @update:modelValue=\"(v) => setValue('hideSearch', !!v)\">\n Hide Search\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('showOperationId')\"\n @update:modelValue=\"(v) => setValue('showOperationId', !!v)\">\n Show Operation ID\n </ScalarToggleInput>\n <ScalarToggleInput\n :modelValue=\"getValue('hideTestRequestButton')\"\n @update:modelValue=\"(v) => setValue('hideTestRequestButton', !!v)\">\n Hide Test Request Button\n </ScalarToggleInput>\n </ScalarFormInputGroup>\n</template>\n"],"mappings":""}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { createBlock, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, unref, useModel, withCtx } from "vue";
|
|
1
|
+
import { computed, createBlock, createTextVNode, createVNode, defineComponent, mergeModels, openBlock, toDisplayString, unref, useModel, withCtx } from "vue";
|
|
2
|
+
import { DEFAULT_MODELS_SECTION_LABEL } from "@scalar/types/api-reference";
|
|
2
3
|
import { ScalarFormInputGroup } from "@scalar/components/form";
|
|
3
4
|
import { ScalarToggleInput } from "@scalar/components/toggle";
|
|
4
5
|
//#region src/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -21,6 +22,7 @@ var ApiReferenceToolbarConfigLayoutOptions_vue_vue_type_script_setup_true_lang_d
|
|
|
21
22
|
};
|
|
22
23
|
else model.value = Object.fromEntries(Object.entries(model.value).filter(([k]) => key !== k));
|
|
23
24
|
}
|
|
25
|
+
const modelsSectionLabel = computed(() => __props.configuration?.modelsSectionLabel ?? DEFAULT_MODELS_SECTION_LABEL);
|
|
24
26
|
return (_ctx, _cache) => {
|
|
25
27
|
return openBlock(), createBlock(unref(ScalarFormInputGroup), null, {
|
|
26
28
|
default: withCtx(() => [
|
|
@@ -49,56 +51,56 @@ var ApiReferenceToolbarConfigLayoutOptions_vue_vue_type_script_setup_true_lang_d
|
|
|
49
51
|
modelValue: getValue("expandAllModelSections"),
|
|
50
52
|
"onUpdate:modelValue": _cache[3] || (_cache[3] = (v) => setValue("expandAllModelSections", !!v))
|
|
51
53
|
}, {
|
|
52
|
-
default: withCtx(() => [
|
|
54
|
+
default: withCtx(() => [createTextVNode(" Expand All " + toDisplayString(modelsSectionLabel.value), 1)]),
|
|
53
55
|
_: 1
|
|
54
56
|
}, 8, ["modelValue"]),
|
|
55
57
|
createVNode(unref(ScalarToggleInput), {
|
|
56
58
|
modelValue: getValue("expandAllResponses"),
|
|
57
59
|
"onUpdate:modelValue": _cache[4] || (_cache[4] = (v) => setValue("expandAllResponses", !!v))
|
|
58
60
|
}, {
|
|
59
|
-
default: withCtx(() => [..._cache[
|
|
61
|
+
default: withCtx(() => [..._cache[14] || (_cache[14] = [createTextVNode(" Expand All Responses ", -1)])]),
|
|
60
62
|
_: 1
|
|
61
63
|
}, 8, ["modelValue"]),
|
|
62
64
|
createVNode(unref(ScalarToggleInput), {
|
|
63
65
|
modelValue: getValue("hideClientButton"),
|
|
64
66
|
"onUpdate:modelValue": _cache[5] || (_cache[5] = (v) => setValue("hideClientButton", !!v))
|
|
65
67
|
}, {
|
|
66
|
-
default: withCtx(() => [..._cache[
|
|
68
|
+
default: withCtx(() => [..._cache[15] || (_cache[15] = [createTextVNode(" Hide Client Button ", -1)])]),
|
|
67
69
|
_: 1
|
|
68
70
|
}, 8, ["modelValue"]),
|
|
69
71
|
createVNode(unref(ScalarToggleInput), {
|
|
70
72
|
modelValue: getValue("hideDarkModeToggle"),
|
|
71
73
|
"onUpdate:modelValue": _cache[6] || (_cache[6] = (v) => setValue("hideDarkModeToggle", !!v))
|
|
72
74
|
}, {
|
|
73
|
-
default: withCtx(() => [..._cache[
|
|
75
|
+
default: withCtx(() => [..._cache[16] || (_cache[16] = [createTextVNode(" Hide Dark Mode Toggle ", -1)])]),
|
|
74
76
|
_: 1
|
|
75
77
|
}, 8, ["modelValue"]),
|
|
76
78
|
createVNode(unref(ScalarToggleInput), {
|
|
77
79
|
modelValue: getValue("hideModels"),
|
|
78
80
|
"onUpdate:modelValue": _cache[7] || (_cache[7] = (v) => setValue("hideModels", !!v))
|
|
79
81
|
}, {
|
|
80
|
-
default: withCtx(() => [
|
|
82
|
+
default: withCtx(() => [createTextVNode(" Hide " + toDisplayString(modelsSectionLabel.value), 1)]),
|
|
81
83
|
_: 1
|
|
82
84
|
}, 8, ["modelValue"]),
|
|
83
85
|
createVNode(unref(ScalarToggleInput), {
|
|
84
86
|
modelValue: getValue("hideSearch"),
|
|
85
87
|
"onUpdate:modelValue": _cache[8] || (_cache[8] = (v) => setValue("hideSearch", !!v))
|
|
86
88
|
}, {
|
|
87
|
-
default: withCtx(() => [..._cache[
|
|
89
|
+
default: withCtx(() => [..._cache[17] || (_cache[17] = [createTextVNode(" Hide Search ", -1)])]),
|
|
88
90
|
_: 1
|
|
89
91
|
}, 8, ["modelValue"]),
|
|
90
92
|
createVNode(unref(ScalarToggleInput), {
|
|
91
93
|
modelValue: getValue("showOperationId"),
|
|
92
94
|
"onUpdate:modelValue": _cache[9] || (_cache[9] = (v) => setValue("showOperationId", !!v))
|
|
93
95
|
}, {
|
|
94
|
-
default: withCtx(() => [..._cache[
|
|
96
|
+
default: withCtx(() => [..._cache[18] || (_cache[18] = [createTextVNode(" Show Operation ID ", -1)])]),
|
|
95
97
|
_: 1
|
|
96
98
|
}, 8, ["modelValue"]),
|
|
97
99
|
createVNode(unref(ScalarToggleInput), {
|
|
98
100
|
modelValue: getValue("hideTestRequestButton"),
|
|
99
101
|
"onUpdate:modelValue": _cache[10] || (_cache[10] = (v) => setValue("hideTestRequestButton", !!v))
|
|
100
102
|
}, {
|
|
101
|
-
default: withCtx(() => [..._cache[
|
|
103
|
+
default: withCtx(() => [..._cache[19] || (_cache[19] = [createTextVNode(" Hide Test Request Button ", -1)])]),
|
|
102
104
|
_: 1
|
|
103
105
|
}, 8, ["modelValue"])
|
|
104
106
|
]),
|