@scalar/api-reference 1.63.0 → 1.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +90 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.script.js +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.script.js.map +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.script.js +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.script.js.map +1 -1
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/AsyncApiSidebarFilters.vue.script.js +2 -2
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/AsyncApiSidebarFilters.vue.script.js.map +1 -1
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/SidebarFilter.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/SidebarFilter.vue.script.js +1 -1
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/SidebarFilter.vue.script.js.map +1 -1
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/helpers/filter-async-api-navigation.js.map +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts +1 -3
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.js +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.js.map +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.script.js +13 -27
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.script.js.map +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.js +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.js.map +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.script.js +37 -25
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.script.js.map +1 -1
- package/dist/blocks/scalar-client-selector-block/helpers/featured-clients.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.script.js +10 -4
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoBlock.vue.script.js +1 -1
- package/dist/blocks/scalar-info-block/components/InfoBlock.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoDescription.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/InfoDescription.vue.script.js +1 -1
- package/dist/blocks/scalar-info-block/components/InfoDescription.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoLinks.vue.script.js +1 -1
- package/dist/blocks/scalar-info-block/components/InfoLinks.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoMarkdownSection.vue.script.js +1 -1
- package/dist/blocks/scalar-info-block/components/InfoMarkdownSection.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoVersion.vue.script.js +1 -1
- package/dist/blocks/scalar-info-block/components/InfoVersion.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionCard.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionCard.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionCard.vue.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionCard.vue.script.js +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionCard.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionCardItem.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionCardItem.vue.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue.script.js +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLoading.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLoading.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLoading.vue.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLoading.vue.script.js +5 -5
- package/dist/blocks/scalar-info-block/components/IntroductionLoading.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/SpecificationVersion.vue.script.js +1 -1
- package/dist/blocks/scalar-info-block/components/SpecificationVersion.vue.script.js.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.js +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.js.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.script.js +16 -9
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.script.js.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/language-icon.js.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/renderable-sdks.js.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/visible-tab-count.js.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.script.js +1 -1
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.script.js.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.script.js +1 -1
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.script.js.map +1 -1
- package/dist/browser/chunks/AgentScalarChatInterface-D1mzA447.js +27 -0
- package/dist/browser/chunks/ScalarTextInput.vue-OfiA6SHf.js +27 -0
- package/dist/browser/chunks/{basic-shape-diamond.svg-BTEOT1FL.js → basic-shape-diamond.svg-o5eiY2I7.js} +2 -2
- package/dist/browser/chunks/{basic-shape-hexagon.svg-BSPzaCgF.js → basic-shape-hexagon.svg-CGuS7mbd.js} +2 -2
- package/dist/browser/chunks/{basic-shape-primary-circle-ellipse-round.svg-DKmZ8UUU.js → basic-shape-primary-circle-ellipse-round.svg-DDIpXiBm.js} +2 -2
- package/dist/browser/chunks/{basic-shape-primary-square-rectangle.svg-n2YRykHD.js → basic-shape-primary-square-rectangle.svg-DzVEJHMB.js} +2 -2
- package/dist/browser/chunks/{basic-shape-shield.svg-Bec9cJDA.js → basic-shape-shield.svg-BZzapRqv.js} +2 -2
- package/dist/browser/chunks/browser-CTPPEMEL.js +129 -0
- package/dist/browser/chunks/{computer-device-desktop-monitor.svg-m6j893Hb.js → computer-device-desktop-monitor.svg-OSM05r1I.js} +2 -2
- package/dist/browser/chunks/{computer-device-desktop.svg-Dk1VVO7k.js → computer-device-desktop.svg-BMFzGZ27.js} +2 -2
- package/dist/browser/chunks/{computer-device-laptop.svg-BNGVUCYS.js → computer-device-laptop.svg-CMAjzuB-.js} +2 -2
- package/dist/browser/chunks/{computer-device-mobile-phone-android-samsung-back.svg-CC4UUTFw.js → computer-device-mobile-phone-android-samsung-back.svg-D4xBONmL.js} +2 -2
- package/dist/browser/chunks/{computer-device-mobile-phone-android-samsung.svg-D8ExpMpL.js → computer-device-mobile-phone-android-samsung.svg-gbMJLjJw.js} +2 -2
- package/dist/browser/chunks/{computer-device-mobile-phone-iphone-x-back.svg-CLm7sgMM.js → computer-device-mobile-phone-iphone-x-back.svg-Bl1rmdKA.js} +2 -2
- package/dist/browser/chunks/{computer-device-mobile-phone-iphone-x.svg-Xrttg6_7.js → computer-device-mobile-phone-iphone-x.svg-DVetP0aa.js} +2 -2
- package/dist/browser/chunks/{computer-device-mobile-tablet-touch.svg-DQ2oTvOG.js → computer-device-mobile-tablet-touch.svg-Zi88BP4L.js} +2 -2
- package/dist/browser/chunks/{computer-device-mobile-tablet.svg-DCr0XlRc.js → computer-device-mobile-tablet.svg-C1ggisWP.js} +2 -2
- package/dist/browser/chunks/{computer-device-network-ethernet-cat6.svg-AK9l0iOl.js → computer-device-network-ethernet-cat6.svg-BIUymdC1.js} +2 -2
- package/dist/browser/chunks/{computer-device-network-lan-www.svg-gUIdFBlE.js → computer-device-network-lan-www.svg-CoFUlIVO.js} +2 -2
- package/dist/browser/chunks/{computer-device-network-wifi-connection.svg-Be-EMm4e.js → computer-device-network-wifi-connection.svg-DeWsacxI.js} +2 -2
- package/dist/browser/chunks/{computer-device-network-wifi-router.svg-Dc2VzyqK.js → computer-device-network-wifi-router.svg-BjpZEot4.js} +2 -2
- package/dist/browser/chunks/{ecology-science-erlenmeyer-flask.svg-DHgy7Jfd.js → ecology-science-erlenmeyer-flask.svg-ftjGGirE.js} +2 -2
- package/dist/browser/chunks/{image-flash-lightning.svg-EETR_y1q.js → image-flash-lightning.svg-DYQ0W4Fi.js} +2 -2
- package/dist/browser/chunks/{image-picture-flower.svg-DN1AYzJU.js → image-picture-flower.svg-Bfe5SVDf.js} +2 -2
- package/dist/browser/chunks/{interface-alert-exclamation-diamond.svg-C5NozMV_.js → interface-alert-exclamation-diamond.svg-D1HePDNM.js} +2 -2
- package/dist/browser/chunks/{interface-alert-exclamation-triangle-warning.svg-DaAg2fF5.js → interface-alert-exclamation-triangle-warning.svg-CILUsxBC.js} +2 -2
- package/dist/browser/chunks/{interface-alert-information-circle.svg-ckkkt9Mv.js → interface-alert-information-circle.svg-9LrbJM5J.js} +2 -2
- package/dist/browser/chunks/{interface-award-crown.svg-pjvn9hY-.js → interface-award-crown.svg-DllWgiU1.js} +2 -2
- package/dist/browser/chunks/{interface-bookmark.svg-BK9HKQBT.js → interface-bookmark-tag.svg-Dc-JL-Kc.js} +2 -2
- package/dist/browser/chunks/{interface-bookmark-tag.svg-r2r-lQq4.js → interface-bookmark.svg-Dc-JL-Kc.js} +2 -2
- package/dist/browser/chunks/{interface-calendar-date-one.svg-DNnF0M1I.js → interface-calendar-date-one.svg-DO2jelhF.js} +2 -2
- package/dist/browser/chunks/{interface-content-book-open-pages.svg-CQj_w9Vp.js → interface-content-book-open-pages.svg-BJjMjIgA.js} +2 -2
- package/dist/browser/chunks/{interface-content-book-page.svg-DppoeJRe.js → interface-content-book-page.svg-C6rKB2fs.js} +2 -2
- package/dist/browser/chunks/{interface-content-file.svg-CvcD7OiY.js → interface-content-file.svg-CS0q2FKx.js} +2 -2
- package/dist/browser/chunks/{interface-content-folder.svg-BmtS5I9A.js → interface-content-folder.svg-CThTWsJX.js} +2 -2
- package/dist/browser/chunks/{interface-copy-clipboard.svg-Be6EI50X.js → interface-copy-clipboard.svg-DdN67cLv.js} +2 -2
- package/dist/browser/chunks/{interface-edit-attachment.svg-G5TKzpWX.js → interface-edit-attachment.svg-Ciizphuh.js} +2 -2
- package/dist/browser/chunks/{interface-edit-binocular.svg-jzL-DvGB.js → interface-edit-binocular.svg-Dw1nDqmL.js} +2 -2
- package/dist/browser/chunks/{interface-edit-magic-wand.svg-BOTlymvp.js → interface-edit-magic-wand.svg-BYS0jm_E.js} +2 -2
- package/dist/browser/chunks/{interface-edit-tool-paint-roller.svg-s9dwryx7.js → interface-edit-tool-paint-roller.svg-NioSHZC2.js} +2 -2
- package/dist/browser/chunks/{interface-edit-tool-pencil.svg-C7v0dbB3.js → interface-edit-tool-pencil.svg-P87QFlat.js} +2 -2
- package/dist/browser/chunks/{interface-favorite-award.svg-CYHUgUG0.js → interface-favorite-award.svg-DBBAChSi.js} +2 -2
- package/dist/browser/chunks/{interface-favorite-flag.svg-C10zlKOb.js → interface-favorite-flag.svg-HlhPomHY.js} +2 -2
- package/dist/browser/chunks/{interface-favorite-heart.svg-eoduXxlz.js → interface-favorite-heart.svg-Cqu2GYDo.js} +2 -2
- package/dist/browser/chunks/{interface-favorite-star.svg-BSmxJetr.js → interface-favorite-star.svg-BD4JY_J2.js} +2 -2
- package/dist/browser/chunks/{interface-favorite-stars-sparkles.svg-JTFLj3Ls.js → interface-favorite-stars-sparkles.svg-BXi6aO8q.js} +2 -2
- package/dist/browser/chunks/{interface-hierarchy-flowchart.svg-Cg_Wy0kN.js → interface-hierarchy-flowchart.svg-CDEVSsD4.js} +2 -2
- package/dist/browser/chunks/{interface-home-house.svg-DytoGRnv.js → interface-home-house.svg-DJetUjwj.js} +2 -2
- package/dist/browser/chunks/{interface-hyperlink.svg-CuEfmmQI.js → interface-hyperlink.svg-DJ1LREmz.js} +2 -2
- package/dist/browser/chunks/{interface-lighting-brightness.svg-DSK0h_Pa.js → interface-lighting-brightness.svg-TGKAaHYV.js} +2 -2
- package/dist/browser/chunks/{interface-lock-closed.svg-Cn6TaLYv.js → interface-lock-closed.svg-3hehWr3i.js} +2 -2
- package/dist/browser/chunks/{interface-lock-open-unlock.svg-CVkG5-9W.js → interface-lock-open-unlock.svg-CuXKcv1m.js} +2 -2
- package/dist/browser/chunks/{interface-login-key.svg-y-cwwXjN.js → interface-login-key.svg-Chwvvywd.js} +2 -2
- package/dist/browser/chunks/{interface-search.svg-S-puVFJB.js → interface-search.svg-JDE3fk0u.js} +2 -2
- package/dist/browser/chunks/{interface-setting-cog.svg-CTH4_lLg.js → interface-setting-cog.svg-BBCkeh4K.js} +2 -2
- package/dist/browser/chunks/{interface-share-megaphone-bullhorn.svg-Pbp39MyC.js → interface-share-megaphone-bullhorn.svg-CDdxF-4y.js} +2 -2
- package/dist/browser/chunks/{interface-share-rocket.svg-BgCsIRZO.js → interface-share-rocket.svg-DSbdn_o7.js} +2 -2
- package/dist/browser/chunks/{interface-share-satellite.svg-DAMN9d5G.js → interface-share-satellite.svg-CefBVZvY.js} +2 -2
- package/dist/browser/chunks/{interface-share-space-ship.svg-Dt-Mejxk.js → interface-share-space-ship.svg-tFA2dsSU.js} +2 -2
- package/dist/browser/chunks/{interface-share.svg-vFYTXSti.js → interface-share.svg-BpOGopyv.js} +2 -2
- package/dist/browser/chunks/{interface-signal-square.svg-DNG4LpAe.js → interface-signal-square.svg-BcX_BoaC.js} +2 -2
- package/dist/browser/chunks/{interface-time-clock-circle.svg-Bpz-nLxo.js → interface-time-clock-circle.svg-C8B_L_RM.js} +2 -2
- package/dist/browser/chunks/{interface-time-hour-glass.svg-D7agfKsH.js → interface-time-hour-glass.svg-qw-oeoVn.js} +2 -2
- package/dist/browser/chunks/{interface-users-multiple.svg-CkPJBBnG.js → interface-users-multiple.svg-Cs13Eewq.js} +2 -2
- package/dist/browser/chunks/{interface-weather-moon.svg-CaTZFMPO.js → interface-weather-moon.svg-CV-oDTae.js} +2 -2
- package/dist/browser/chunks/{mail-chat-bubble-square.svg-DC8RIihp.js → mail-chat-bubble-square.svg-dpauJhin.js} +2 -2
- package/dist/browser/chunks/{mail-send-email-paper-airplane.svg-D8OLs9jz.js → mail-send-email-paper-airplane.svg-BBofxojL.js} +2 -2
- package/dist/browser/chunks/{mail-send-envelope.svg-CV33h5Sx.js → mail-send-envelope.svg-DyENgYOI.js} +2 -2
- package/dist/browser/chunks/modal-BS4e2gew.js +99 -0
- package/dist/browser/chunks/{money-cashier-receipt.svg-CJL8C2gs.js → money-cashier-receipt.svg-dNTr5aio.js} +2 -2
- package/dist/browser/chunks/{money-currency-dollar-pay.svg-VdBplCTx.js → money-currency-dollar-pay.svg-1ZESPtFY.js} +2 -2
- package/dist/browser/chunks/{money-graph-arrow-increase.svg-DcRov3zk.js → money-graph-arrow-increase.svg-kEZ2u2z2.js} +2 -2
- package/dist/browser/chunks/{money-graph-bar-chart-increase.svg-Cc7KxjX-.js → money-graph-bar-chart-increase.svg-B-t2UWB3.js} +2 -2
- package/dist/browser/chunks/{nature-ecology-leaf.svg-DR3cTZxt.js → nature-ecology-leaf.svg-DZ2GJV8m.js} +2 -2
- package/dist/browser/chunks/{phone-telephone.svg-DyY0gUlk.js → phone-telephone.svg-C12QjpN7.js} +2 -2
- package/dist/browser/chunks/{programming-bug.svg-BHLT-Qhp.js → programming-bug.svg-wLTsruN9.js} +2 -2
- package/dist/browser/chunks/{programming-cloud.svg-B6YW33ba.js → programming-cloud.svg-3XU6dNUg.js} +2 -2
- package/dist/browser/chunks/{programming-computer-database-server.svg-B6o5Sdn-.js → programming-computer-database-server.svg-B1JrHSPd.js} +2 -2
- package/dist/browser/chunks/{programming-computer-database.svg-Cl7OVtpJ.js → programming-computer-database.svg-BxHSuFl7.js} +2 -2
- package/dist/browser/chunks/{programming-module-four-layout.svg-BQrerL1x.js → programming-module-four-layout.svg-CeV35q45.js} +2 -2
- package/dist/browser/chunks/{programming-module-three.svg-B2KTQzBM.js → programming-module-three.svg-YIBpLt45.js} +2 -2
- package/dist/browser/chunks/{programming-module.svg-CiID7kPm.js → programming-module.svg-CU_pEibI.js} +2 -2
- package/dist/browser/chunks/{programming-script-code.svg-D1M5rtkN.js → programming-script-code.svg-CLzinmHT.js} +2 -2
- package/dist/browser/chunks/runtime-core.esm-bundler-CqqEw5ds.js +17 -0
- package/dist/browser/chunks/{shopping-cart.svg-BEegiIR9.js → shopping-cart.svg-Brzddu3K.js} +2 -2
- package/dist/browser/chunks/{shopping-gift-present.svg-BUHwuLix.js → shopping-gift-present.svg-l2K48g7L.js} +2 -2
- package/dist/browser/chunks/{shopping-shipping-box-parcel-package.svg-D6fxWdYx.js → shopping-shipping-box-parcel-package.svg-DesGopPo.js} +2 -2
- package/dist/browser/chunks/{tag-new-circle.svg-jsg1bGs0.js → tag-new-circle.svg-DE-VaLZU.js} +2 -2
- package/dist/browser/chunks/{travel-map-earth-globe.svg-ClbMiU-f.js → travel-map-earth-globe.svg-DLaOMzx6.js} +2 -2
- package/dist/browser/chunks/vendor-DWZAEyBy.js +306 -0
- package/dist/browser/standalone.esm.js +26 -24
- package/dist/browser/standalone.js +310 -311
- package/dist/components/AgentScalar/AgentScalarButton.vue.script.js +1 -1
- package/dist/components/AgentScalar/AgentScalarButton.vue.script.js.map +1 -1
- package/dist/components/AgentScalar/AgentScalarChatInterface.vue.script.js +1 -1
- package/dist/components/AgentScalar/AgentScalarChatInterface.vue.script.js.map +1 -1
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.d.ts.map +1 -1
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.js +1 -1
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.script.js +1 -1
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.script.js.map +1 -1
- 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 +47 -32
- package/dist/components/AgentScalar/OpenMCPButton.vue.script.js.map +1 -1
- package/dist/components/Anchor/Anchor.vue.d.ts.map +1 -1
- package/dist/components/Anchor/Anchor.vue.script.js +1 -1
- package/dist/components/Anchor/Anchor.vue.script.js.map +1 -1
- package/dist/components/Anchor/WithBreadcrumb.vue.script.js +2 -2
- package/dist/components/Anchor/WithBreadcrumb.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 +141 -33
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Badge/Badge.vue.d.ts.map +1 -1
- package/dist/components/Badge/Badge.vue.js +1 -1
- package/dist/components/Badge/Badge.vue.js.map +1 -1
- package/dist/components/Badge/Badge.vue.script.js +9 -9
- package/dist/components/Badge/Badge.vue.script.js.map +1 -1
- package/dist/components/ClassicHeader.vue.js +1 -1
- package/dist/components/ClassicHeader.vue.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.js +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.script.js +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.d.ts.map +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.js +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.script.js +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/ChannelsList.vue.js +1 -1
- package/dist/components/Content/AsyncApi/ChannelsList.vue.script.js +1 -1
- package/dist/components/Content/AsyncApi/ChannelsList.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/Message.vue.d.ts.map +1 -1
- package/dist/components/Content/AsyncApi/Message.vue.js +1 -1
- package/dist/components/Content/AsyncApi/Message.vue.script.js +2 -2
- package/dist/components/Content/AsyncApi/Message.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/Operation.vue.d.ts.map +1 -1
- package/dist/components/Content/AsyncApi/Operation.vue.js +1 -1
- package/dist/components/Content/AsyncApi/Operation.vue.js.map +1 -1
- package/dist/components/Content/AsyncApi/Operation.vue.script.js +6 -1
- package/dist/components/Content/AsyncApi/Operation.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/helpers/adapt-async-api-parameters.js.map +1 -1
- package/dist/components/Content/AsyncApi/helpers/async-api-render-options.js.map +1 -1
- package/dist/components/Content/AsyncApi/helpers/filter-children-by-type.js.map +1 -1
- package/dist/components/Content/AsyncApi/helpers/get-async-api-labels.js.map +1 -1
- package/dist/components/Content/AsyncApi/helpers/get-async-api-required-security.d.ts +17 -0
- package/dist/components/Content/AsyncApi/helpers/get-async-api-required-security.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/get-async-api-required-security.js +21 -0
- package/dist/components/Content/AsyncApi/helpers/get-async-api-required-security.js.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/pick-heading.js.map +1 -1
- package/dist/components/Content/AsyncApi/helpers/resolve-async-api-nodes.js.map +1 -1
- package/dist/components/Content/Auth/Auth.vue.script.js +1 -1
- package/dist/components/Content/Auth/Auth.vue.script.js.map +1 -1
- package/dist/components/Content/Content.vue.script.js +1 -1
- package/dist/components/Content/Content.vue.script.js.map +1 -1
- package/dist/components/Content/Models/Model.vue.script.js +1 -1
- package/dist/components/Content/Models/Model.vue.script.js.map +1 -1
- package/dist/components/Content/Models/ModelTag.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/ModelTag.vue.script.js +2 -2
- package/dist/components/Content/Models/ModelTag.vue.script.js.map +1 -1
- package/dist/components/Content/Models/components/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/components/ClassicLayout.vue.js +1 -1
- package/dist/components/Content/Models/components/ClassicLayout.vue.script.js +1 -1
- package/dist/components/Content/Models/components/ClassicLayout.vue.script.js.map +1 -1
- package/dist/components/Content/Models/components/ModernLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/components/ModernLayout.vue.script.js +1 -1
- package/dist/components/Content/Models/components/ModernLayout.vue.script.js.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.script.js +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/LinkButton.vue.js +1 -1
- package/dist/components/Content/Schema/LinkButton.vue.js.map +1 -1
- package/dist/components/Content/Schema/RenderString.vue.script.js +1 -1
- package/dist/components/Content/Schema/RenderString.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.js +1 -1
- package/dist/components/Content/Schema/Schema.vue.js.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.script.js +5 -13
- package/dist/components/Content/Schema/Schema.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.script.js +69 -34
- package/dist/components/Content/Schema/SchemaComposition.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaEnumPropertyItem.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaEnumPropertyItem.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaEnumPropertyItem.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaEnums.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaEnums.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaEnums.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaEnums.vue.script.js +16 -8
- package/dist/components/Content/Schema/SchemaEnums.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaHeading.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaHeading.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaHeading.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectExampleCodeBlock.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaObjectExampleCodeBlock.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js.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 +4 -3
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDefault.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDefault.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDefault.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDetail.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDetail.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDetail.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.script.js.map +1 -1
- 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 +31 -21
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/helpers/dynamic-scope.js.map +1 -1
- package/dist/components/Content/Schema/helpers/format-example.js.map +1 -1
- package/dist/components/Content/Schema/helpers/format-value.js.map +1 -1
- package/dist/components/Content/Schema/helpers/get-compositions-to-render.js.map +1 -1
- package/dist/components/Content/Schema/helpers/get-enum-values.js.map +1 -1
- package/dist/components/Content/Schema/helpers/get-property-description.js.map +1 -1
- package/dist/components/Content/Schema/helpers/get-ref-name.js.map +1 -1
- package/dist/components/Content/Schema/helpers/get-schema-type.js.map +1 -1
- package/dist/components/Content/Schema/helpers/has-complex-array-items.js.map +1 -1
- package/dist/components/Content/Schema/helpers/is-empty-schema-object.js.map +1 -1
- package/dist/components/Content/Schema/helpers/is-type-object.js.map +1 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +3 -3
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js.map +1 -1
- package/dist/components/Content/Schema/helpers/optimize-value-for-display.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/optimize-value-for-display.js +1 -4
- package/dist/components/Content/Schema/helpers/optimize-value-for-display.js.map +1 -1
- package/dist/components/Content/Schema/helpers/partition-all-of-compositions.d.ts +32 -0
- package/dist/components/Content/Schema/helpers/partition-all-of-compositions.d.ts.map +1 -0
- package/dist/components/Content/Schema/helpers/partition-all-of-compositions.js +97 -0
- package/dist/components/Content/Schema/helpers/partition-all-of-compositions.js.map +1 -0
- package/dist/components/Content/Schema/helpers/schema-composition.js.map +1 -1
- package/dist/components/Content/Schema/helpers/schema-cycle.js.map +1 -1
- package/dist/components/Content/Schema/helpers/schema-name.js.map +1 -1
- package/dist/components/Content/Schema/helpers/should-display-description.js.map +1 -1
- package/dist/components/Content/Schema/helpers/should-display-heading.js.map +1 -1
- package/dist/components/Content/Schema/helpers/should-render-array-item-composition.js.map +1 -1
- package/dist/components/Content/Schema/helpers/sort-property-names.js.map +1 -1
- package/dist/components/Content/Tags/Tag.vue.script.js +1 -1
- package/dist/components/Content/Tags/Tag.vue.script.js.map +1 -1
- package/dist/components/Content/Tags/components/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/Tags/components/ClassicLayout.vue.js +1 -1
- package/dist/components/Content/Tags/components/ClassicLayout.vue.script.js +1 -1
- package/dist/components/Content/Tags/components/ClassicLayout.vue.script.js.map +1 -1
- package/dist/components/Content/Tags/components/ModernLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/Tags/components/ModernLayout.vue.js +1 -1
- package/dist/components/Content/Tags/components/ModernLayout.vue.script.js +1 -1
- package/dist/components/Content/Tags/components/ModernLayout.vue.script.js.map +1 -1
- package/dist/components/Content/Tags/components/TagSection.vue.d.ts.map +1 -1
- package/dist/components/Content/Tags/components/TagSection.vue.script.js +1 -1
- package/dist/components/Content/Tags/components/TagSection.vue.script.js.map +1 -1
- package/dist/components/GettingStarted.vue.d.ts.map +1 -1
- package/dist/components/GettingStarted.vue.js +1 -1
- package/dist/components/GettingStarted.vue.js.map +1 -1
- package/dist/components/GettingStarted.vue.script.js +4 -3
- package/dist/components/GettingStarted.vue.script.js.map +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.script.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.script.js.map +1 -1
- package/dist/components/IntersectionObserver.vue.script.js +10 -7
- package/dist/components/IntersectionObserver.vue.script.js.map +1 -1
- package/dist/components/Lazy/Lazy.vue.script.js +2 -2
- package/dist/components/Lazy/Lazy.vue.script.js.map +1 -1
- package/dist/components/LinkList/LinkList.vue.js +1 -1
- package/dist/components/LinkList/LinkList.vue.js.map +1 -1
- package/dist/components/LinkList/LinkList.vue.script.js +2 -2
- package/dist/components/LinkList/LinkList.vue.script.js.map +1 -1
- package/dist/components/MobileHeader.vue.d.ts.map +1 -1
- package/dist/components/MobileHeader.vue.script.js +4 -4
- package/dist/components/MobileHeader.vue.script.js.map +1 -1
- package/dist/components/OperationPath.vue.d.ts.map +1 -1
- package/dist/components/OperationPath.vue.js +1 -1
- package/dist/components/OperationPath.vue.script.js +1 -1
- package/dist/components/OperationPath.vue.script.js.map +1 -1
- package/dist/components/OperationsList/OperationsList.vue.js +1 -1
- package/dist/components/OperationsList/OperationsList.vue.script.js +1 -1
- package/dist/components/OperationsList/OperationsList.vue.script.js.map +1 -1
- package/dist/components/OperationsList/OperationsListItem.vue.js +1 -1
- package/dist/components/OperationsList/OperationsListItem.vue.script.js +1 -1
- package/dist/components/OperationsList/OperationsListItem.vue.script.js.map +1 -1
- package/dist/components/RenderPlugins/RenderPluginView.vue.script.js +1 -1
- package/dist/components/RenderPlugins/RenderPluginView.vue.script.js.map +1 -1
- package/dist/components/RenderPlugins/RenderPlugins.vue.script.js +1 -1
- package/dist/components/RenderPlugins/RenderPlugins.vue.script.js.map +1 -1
- package/dist/components/ScreenReader.vue.js +1 -1
- package/dist/components/ScreenReader.vue.script.js +2 -2
- package/dist/components/ScreenReader.vue.script.js.map +1 -1
- package/dist/components/Section/CompactSection.vue.d.ts.map +1 -1
- package/dist/components/Section/CompactSection.vue.js +1 -1
- package/dist/components/Section/CompactSection.vue.js.map +1 -1
- package/dist/components/Section/CompactSection.vue.script.js +22 -6
- package/dist/components/Section/CompactSection.vue.script.js.map +1 -1
- package/dist/components/Section/Section.vue.js +1 -1
- package/dist/components/Section/Section.vue.script.js +1 -1
- package/dist/components/Section/Section.vue.script.js.map +1 -1
- package/dist/components/Section/SectionAccordion.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionAccordion.vue.js +1 -1
- package/dist/components/Section/SectionAccordion.vue.script.js +1 -1
- package/dist/components/Section/SectionAccordion.vue.script.js.map +1 -1
- package/dist/components/Section/SectionColumn.vue.js +1 -1
- package/dist/components/Section/SectionColumn.vue.js.map +1 -1
- package/dist/components/Section/SectionColumns.vue.js +1 -1
- package/dist/components/Section/SectionColumns.vue.js.map +1 -1
- package/dist/components/Section/SectionContainer.vue.js +1 -1
- package/dist/components/Section/SectionContainer.vue.script.js +2 -2
- package/dist/components/Section/SectionContainer.vue.script.js.map +1 -1
- package/dist/components/Section/SectionContainerAccordion.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionContainerAccordion.vue.js +1 -1
- package/dist/components/Section/SectionContainerAccordion.vue.script.js +1 -1
- package/dist/components/Section/SectionContainerAccordion.vue.script.js.map +1 -1
- package/dist/components/Section/SectionContent.vue.js +1 -1
- package/dist/components/Section/SectionContent.vue.js.map +1 -1
- package/dist/components/Section/SectionHeader.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionHeader.vue.js +1 -1
- package/dist/components/Section/SectionHeader.vue.js.map +1 -1
- package/dist/components/Section/SectionHeader.vue.script.js +3 -3
- package/dist/components/Section/SectionHeader.vue.script.js.map +1 -1
- package/dist/components/Section/SectionHeaderTag.vue.js +1 -1
- package/dist/components/Section/SectionHeaderTag.vue.script.js +1 -1
- package/dist/components/Section/SectionHeaderTag.vue.script.js.map +1 -1
- package/dist/components/SectionFlare/SectionFlare.vue.js +1 -1
- package/dist/components/SectionFlare/SectionFlare.vue.js.map +1 -1
- package/dist/components/ShowMoreButton.vue.js +1 -1
- package/dist/components/ShowMoreButton.vue.script.js +1 -1
- package/dist/components/ShowMoreButton.vue.script.js.map +1 -1
- package/dist/features/Operation/Operation.vue.script.js +2 -2
- package/dist/features/Operation/Operation.vue.script.js.map +1 -1
- package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ContentTypeSelect.vue.script.js +2 -2
- package/dist/features/Operation/components/ContentTypeSelect.vue.script.js.map +1 -1
- package/dist/features/Operation/components/Header.vue.script.js +1 -1
- package/dist/features/Operation/components/Header.vue.script.js.map +1 -1
- 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.script.js +1 -1
- package/dist/features/Operation/components/Headers.vue.script.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/OperationResponses.vue.script.js +1 -1
- package/dist/features/Operation/components/OperationResponses.vue.script.js.map +1 -1
- package/dist/features/Operation/components/OperationScopes.vue.d.ts +8 -0
- package/dist/features/Operation/components/OperationScopes.vue.d.ts.map +1 -0
- package/dist/features/Operation/components/OperationScopes.vue.js +7 -0
- package/dist/features/Operation/components/OperationScopes.vue.js.map +1 -0
- package/dist/features/Operation/components/OperationScopes.vue.script.js +60 -0
- package/dist/features/Operation/components/OperationScopes.vue.script.js.map +1 -0
- package/dist/features/Operation/components/ParameterList.vue.script.js +1 -1
- package/dist/features/Operation/components/ParameterList.vue.script.js.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.script.js +1 -1
- 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.script.js +2 -2
- package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.js.map +1 -1
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.script.js +90 -17
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.script.js.map +1 -1
- package/dist/features/Operation/components/SecurityRequirementBadgeScheme.vue.script.js +1 -1
- package/dist/features/Operation/components/SecurityRequirementBadgeScheme.vue.script.js.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.js +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.script.js +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.script.js.map +1 -1
- package/dist/features/Operation/components/callbacks/Callbacks.vue.script.js +1 -1
- package/dist/features/Operation/components/callbacks/Callbacks.vue.script.js.map +1 -1
- package/dist/features/Operation/components/helpers/get-parameter-examples.js.map +1 -1
- package/dist/features/Operation/helpers/filter-selected-security.js.map +1 -1
- package/dist/features/Operation/helpers/flatten-deep-object-query-parameter.js.map +1 -1
- package/dist/features/Operation/helpers/get-required-security.d.ts +13 -0
- package/dist/features/Operation/helpers/get-required-security.d.ts.map +1 -1
- package/dist/features/Operation/helpers/get-required-security.js +22 -1
- package/dist/features/Operation/helpers/get-required-security.js.map +1 -1
- package/dist/features/Operation/helpers/operation-stability.js.map +1 -1
- package/dist/features/Operation/helpers/should-ignore-entity.js.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.script.js +16 -7
- package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.script.js +3 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.script.js.map +1 -1
- package/dist/features/Operation/request-body-composition-index.js.map +1 -1
- package/dist/features/Search/components/SearchButton.vue.d.ts.map +1 -1
- package/dist/features/Search/components/SearchButton.vue.script.js +1 -1
- package/dist/features/Search/components/SearchButton.vue.script.js.map +1 -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.script.js +1 -1
- package/dist/features/Search/components/SearchModal.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.script.js +1 -1
- package/dist/features/Search/components/SearchResult.vue.script.js.map +1 -1
- package/dist/features/Search/helpers/create-fuse-instance.js.map +1 -1
- package/dist/features/Search/helpers/create-search-index.js.map +1 -1
- package/dist/features/Search/hooks/useSearchIndex.js.map +1 -1
- package/dist/features/ask-agent-button/AskAgentButton.vue.js +1 -1
- package/dist/features/ask-agent-button/AskAgentButton.vue.script.js +1 -1
- package/dist/features/ask-agent-button/AskAgentButton.vue.script.js.map +1 -1
- package/dist/features/developer-tools/DeveloperTools.vue.script.js +2 -2
- package/dist/features/developer-tools/DeveloperTools.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarBlurb.vue.js +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarBlurb.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayout.vue.script.js +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayout.vue.script.js.map +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 +3 -3
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigTheme.vue.d.ts +2 -2
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigTheme.vue.script.js +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigTheme.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarPopover.vue.script.js +2 -2
- package/dist/features/developer-tools/components/ApiReferenceToolbarPopover.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.script.js +4 -3
- package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.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 +2 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.script.js +4 -3
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarTitle.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarTitle.vue.script.js +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarTitle.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/DeployApiReference.vue.script.js +1 -1
- package/dist/features/developer-tools/components/DeployApiReference.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ModifyConfiguration.vue.script.js +2 -2
- package/dist/features/developer-tools/components/ModifyConfiguration.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ShareApiReference.vue.script.js +1 -1
- package/dist/features/developer-tools/components/ShareApiReference.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.script.js +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleResponseTab.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponseTab.vue.script.js +1 -1
- package/dist/features/example-responses/ExampleResponseTab.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleResponseTabList.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponseTabList.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponseTabList.vue.script.js +1 -1
- package/dist/features/example-responses/ExampleResponseTabList.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.script.js +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleSchema.vue.script.js +1 -1
- package/dist/features/example-responses/ExampleSchema.vue.script.js.map +1 -1
- package/dist/features/example-responses/helpers/has-response-content.js.map +1 -1
- package/dist/features/example-responses/helpers/normalize-mime-type-object.js.map +1 -1
- package/dist/features/example-responses/helpers/normalize-mime-type.js.map +1 -1
- package/dist/features/external-docs/ExternalDocs.vue.d.ts.map +1 -1
- package/dist/features/external-docs/ExternalDocs.vue.js.map +1 -1
- package/dist/features/external-docs/ExternalDocs.vue.script.js +27 -15
- package/dist/features/external-docs/ExternalDocs.vue.script.js.map +1 -1
- package/dist/features/info-object/Contact.vue.d.ts.map +1 -1
- package/dist/features/info-object/Contact.vue.js.map +1 -1
- package/dist/features/info-object/Contact.vue.script.js +18 -12
- package/dist/features/info-object/Contact.vue.script.js.map +1 -1
- package/dist/features/info-object/InfoLink.vue.d.ts.map +1 -1
- package/dist/features/info-object/InfoLink.vue.js.map +1 -1
- package/dist/features/info-object/InfoLink.vue.script.js +23 -11
- package/dist/features/info-object/InfoLink.vue.script.js.map +1 -1
- package/dist/features/info-object/License.vue.d.ts.map +1 -1
- package/dist/features/info-object/License.vue.js.map +1 -1
- package/dist/features/info-object/License.vue.script.js +13 -7
- package/dist/features/info-object/License.vue.script.js.map +1 -1
- package/dist/features/info-object/TermsOfService.vue.d.ts.map +1 -1
- package/dist/features/info-object/TermsOfService.vue.js.map +1 -1
- package/dist/features/info-object/TermsOfService.vue.script.js +12 -6
- package/dist/features/info-object/TermsOfService.vue.script.js.map +1 -1
- package/dist/features/localization/locales/ar.d.ts +1 -0
- package/dist/features/localization/locales/ar.d.ts.map +1 -1
- package/dist/features/localization/locales/ar.js +2 -1
- package/dist/features/localization/locales/ar.js.map +1 -1
- package/dist/features/localization/locales/de.d.ts +1 -0
- package/dist/features/localization/locales/de.d.ts.map +1 -1
- package/dist/features/localization/locales/de.js +2 -1
- package/dist/features/localization/locales/de.js.map +1 -1
- package/dist/features/localization/locales/en.d.ts +1 -0
- package/dist/features/localization/locales/en.d.ts.map +1 -1
- package/dist/features/localization/locales/en.js +2 -1
- package/dist/features/localization/locales/en.js.map +1 -1
- package/dist/features/localization/locales/es.d.ts +1 -0
- package/dist/features/localization/locales/es.d.ts.map +1 -1
- package/dist/features/localization/locales/es.js +2 -1
- package/dist/features/localization/locales/es.js.map +1 -1
- package/dist/features/localization/locales/fr.d.ts +1 -0
- package/dist/features/localization/locales/fr.d.ts.map +1 -1
- package/dist/features/localization/locales/fr.js +2 -1
- package/dist/features/localization/locales/fr.js.map +1 -1
- package/dist/features/localization/locales/pt.d.ts +229 -0
- package/dist/features/localization/locales/pt.d.ts.map +1 -0
- package/dist/features/localization/locales/pt.js +227 -0
- package/dist/features/localization/locales/pt.js.map +1 -0
- package/dist/features/localization/locales/ru.d.ts +1 -0
- package/dist/features/localization/locales/ru.d.ts.map +1 -1
- package/dist/features/localization/locales/ru.js +2 -1
- package/dist/features/localization/locales/ru.js.map +1 -1
- package/dist/features/localization/locales/zh-cn.d.ts +1 -0
- package/dist/features/localization/locales/zh-cn.d.ts.map +1 -1
- package/dist/features/localization/locales/zh-cn.js +2 -1
- package/dist/features/localization/locales/zh-cn.js.map +1 -1
- package/dist/features/localization/translations.d.ts +235 -0
- package/dist/features/localization/translations.d.ts.map +1 -1
- package/dist/features/localization/translations.js +4 -2
- package/dist/features/localization/translations.js.map +1 -1
- package/dist/features/localization/use-localization.js.map +1 -1
- package/dist/features/multiple-documents/DocumentSelector.vue.d.ts.map +1 -1
- package/dist/features/multiple-documents/DocumentSelector.vue.script.js +1 -1
- package/dist/features/multiple-documents/DocumentSelector.vue.script.js.map +1 -1
- package/dist/features/specification-extension/SpecificationExtension.vue.script.js +1 -1
- package/dist/features/specification-extension/SpecificationExtension.vue.script.js.map +1 -1
- package/dist/features/specification-extension/helpers.js.map +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.js +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.script.js +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.script.js.map +1 -1
- package/dist/features/x-badges/XBadges.vue.d.ts.map +1 -1
- package/dist/features/x-badges/XBadges.vue.script.js +1 -1
- package/dist/features/x-badges/XBadges.vue.script.js.map +1 -1
- package/dist/helpers/color-mode.js.map +1 -1
- package/dist/helpers/download.js.map +1 -1
- package/dist/helpers/get-async-api-message-payload-schema.js.map +1 -1
- package/dist/helpers/get-async-api-model-schema.js.map +1 -1
- package/dist/helpers/id-routing.d.ts +18 -4
- package/dist/helpers/id-routing.d.ts.map +1 -1
- package/dist/helpers/id-routing.js +67 -20
- package/dist/helpers/id-routing.js.map +1 -1
- package/dist/helpers/is-introduction-entry.js.map +1 -1
- package/dist/helpers/lazy-bus.js.map +1 -1
- package/dist/helpers/load-from-perssistance.js.map +1 -1
- package/dist/helpers/map-config-plugins.js.map +1 -1
- package/dist/helpers/map-config-to-workspace-store.js.map +1 -1
- package/dist/helpers/normalize-configurations.js +1 -1
- package/dist/helpers/normalize-configurations.js.map +1 -1
- package/dist/helpers/openapi.d.ts +6 -1
- package/dist/helpers/openapi.d.ts.map +1 -1
- package/dist/helpers/openapi.js +37 -6
- package/dist/helpers/openapi.js.map +1 -1
- package/dist/helpers/safe-deep-clone.js.map +1 -1
- package/dist/helpers/storage.d.ts +21 -2
- package/dist/helpers/storage.d.ts.map +1 -1
- package/dist/helpers/storage.js +14 -0
- package/dist/helpers/storage.js.map +1 -1
- package/dist/helpers/upload-temp-document.js.map +1 -1
- package/dist/hooks/use-agent.js.map +1 -1
- package/dist/hooks/use-intersection.js.map +1 -1
- package/dist/plugins/hooks/usePluginManager.js.map +1 -1
- package/dist/plugins/persistence-plugin.js +6 -1
- package/dist/plugins/persistence-plugin.js.map +1 -1
- package/dist/plugins/plugin-manager.js +35 -0
- package/dist/plugins/plugin-manager.js.map +1 -1
- package/dist/plugins/posthog/index.js.map +1 -1
- package/dist/standalone/lib/html-api.d.ts.map +1 -1
- package/dist/standalone/lib/html-api.js +11 -4
- package/dist/standalone/lib/html-api.js.map +1 -1
- package/dist/standalone/lib/load-plugins-from-urls.d.ts +13 -0
- package/dist/standalone/lib/load-plugins-from-urls.d.ts.map +1 -0
- package/dist/standalone/lib/load-plugins-from-urls.js +60 -0
- package/dist/standalone/lib/load-plugins-from-urls.js.map +1 -0
- package/dist/style.css +1637 -1505
- package/dist/styles/print.css +118 -0
- package/dist/styles/tailwind.config.css +16 -0
- package/dist/vue-styles.css +1102 -1050
- package/package.json +29 -29
- package/dist/browser/chunks/AgentScalarChatInterface-YU9KKgvZ.js +0 -27
- package/dist/browser/chunks/ScalarTextInput.vue-B-Nhpn0q.js +0 -27
- package/dist/browser/chunks/browser-67K6wmG9.js +0 -129
- package/dist/browser/chunks/modal-BVUfMpuv.js +0 -15
- package/dist/browser/chunks/modal-WJ4Gcv8N.js +0 -99
- package/dist/browser/chunks/runtime-core.esm-bundler-Byrbbu5Q.js +0 -17
- package/dist/browser/chunks/vendor-BqFs9NIb.js +0 -306
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openapi.js","names":[],"sources":["../../src/helpers/openapi.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n MediaTypeObject,\n OpenApiDocument,\n OperationObject,\n ParameterObject,\n ReferenceType,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\nconst isSchemaObject = (value: unknown): value is SchemaObject => typeof value === 'object' && value !== null\n\n/**\n * Resolves a schema reference from workspace-store to a SchemaObject.\n * Returns undefined when a reference exists but has not been resolved yet.\n */\nfunction resolveSchemaRef(ref: SchemaReferenceType<SchemaObject>): SchemaObject | undefined {\n if (typeof ref === 'object' && ref !== null && '$ref' in ref) {\n return isSchemaObject(ref['$ref-value']) ? ref['$ref-value'] : undefined\n }\n\n return ref\n}\n\nfunction pushUnique(target: string[], value: string | undefined): void {\n if (!value) {\n return\n }\n if (!target.includes(value)) {\n target.push(value)\n }\n}\n\ntype CollectOptions = {\n visit: (key: string, schema: SchemaObject | undefined) => void\n visited: Set<SchemaObject>\n maxPropertyDepth: number\n}\n\n/**\n * Recursively visits every property of a schema, descending transparently through composition\n * keywords (`oneOf`, `anyOf`, `allOf`) and one level into nested object properties.\n *\n * Composition is treated as transparent — a `oneOf` of two object variants is *the same level* as a\n * single object, just expressed as multiple shapes. Property nesting is capped to keep the index\n * focused on shallow, commonly-searched fields. A visited-set keyed by resolved-schema identity\n * guards against recursive (`Tree → Tree`) schemas.\n */\nfunction collectSchemaProperties(schema: SchemaObject | undefined, options: CollectOptions, propertyDepth = 0): void {\n if (!schema || options.visited.has(schema)) {\n return\n }\n options.visited.add(schema)\n\n const variants = [...(schema.oneOf ?? []), ...(schema.anyOf ?? []), ...(schema.allOf ?? [])]\n variants.forEach((variantRef) => {\n collectSchemaProperties(resolveSchemaRef(variantRef), options, propertyDepth)\n })\n\n if (isObjectSchema(schema) && schema.properties) {\n Object.entries(schema.properties).forEach(([key, propRef]) => {\n const property = resolveSchemaRef(propRef)\n options.visit(key, property)\n if (propertyDepth + 1 < options.maxPropertyDepth) {\n collectSchemaProperties(property, options, propertyDepth + 1)\n }\n })\n }\n}\n\n/**\n * Walks the request body schemas of an operation and yields each property schema with its key.\n */\nfunction forEachRequestBodyProperty(\n operation: OperationObject,\n visit: (key: string, schema: SchemaObject | undefined) => void,\n): void {\n const content = getResolvedRef(operation?.requestBody)?.content\n if (!content) {\n return\n }\n\n const visited = new Set<SchemaObject>()\n Object.values(content).forEach((media) => {\n const resolvedMedia = getResolvedRef(media) as MediaTypeObject | undefined\n const schema = getResolvedRef(resolvedMedia?.schema)\n collectSchemaProperties(schema, { visit, visited, maxPropertyDepth: 2 })\n })\n}\n\n/**\n * Extracts the names of every parameter on an operation.\n *\n * The returned strings contain only parameter names (e.g. `userId`, `limit`) so they can be indexed\n * as a high-signal field for search. Filter-style metadata like `REQUIRED`, `optional`, `query` and\n * the schema type are intentionally excluded — those tokens dilute fuzzy matches and produce false\n * positives for queries like `query` or `integer`.\n */\nexport function extractParameterNames(parameters: ReferenceType<ParameterObject>[]): string[] {\n const names: string[] = []\n\n parameters.forEach((parameter) => {\n const resolved = getResolvedRef(parameter)\n pushUnique(names, resolved?.name)\n })\n\n return names\n}\n\n/**\n * Extracts the descriptions of every parameter on an operation.\n *\n * Kept separate from parameter names so the search index can weight each independently.\n */\nexport function extractParameterDescriptions(parameters: ReferenceType<ParameterObject>[]): string[] {\n const descriptions: string[] = []\n\n parameters.forEach((parameter) => {\n const resolved = getResolvedRef(parameter)\n pushUnique(descriptions, resolved?.description)\n })\n\n return descriptions\n}\n\n/**\n * Extracts the names of properties from the request body schema(s) of an operation.\n *\n * Walks every media type and includes both top-level and one level of nested property names so\n * common fields like `email` or `username` surface in search regardless of how the body is shaped.\n */\nexport function extractBodyFieldNames(operation: OperationObject): string[] {\n const names: string[] = []\n\n forEachRequestBodyProperty(operation, (key) => {\n pushUnique(names, key)\n })\n\n return names\n}\n\n/**\n * Extracts the descriptions of properties from the request body schema(s) of an operation.\n */\nexport function extractBodyDescriptions(operation: OperationObject): string[] {\n const descriptions: string[] = []\n\n forEachRequestBodyProperty(operation, (_key, schema) => {\n if (schema && 'description' in schema && typeof schema.description === 'string') {\n pushUnique(descriptions, schema.description)\n }\n })\n\n return descriptions\n}\n\n/**\n * Extracts the property names of a schema for the search index.\n *\n * Same depth and composition behavior as `extractBodyFieldNames` — descends transparently through\n * `oneOf`/`anyOf`/`allOf`, walks one level into nested object properties, dedupes.\n */\nexport function extractSchemaFieldNames(schema: SchemaObject | undefined): string[] {\n const names: string[] = []\n collectSchemaProperties(schema, {\n visit: (key) => pushUnique(names, key),\n visited: new Set<SchemaObject>(),\n maxPropertyDepth: 2,\n })\n return names\n}\n\n/**\n * Extracts the property descriptions of a schema for the search index.\n */\nexport function extractSchemaDescriptions(schema: SchemaObject | undefined): string[] {\n const descriptions: string[] = []\n collectSchemaProperties(schema, {\n visit: (_key, propertySchema) => {\n if (propertySchema && 'description' in propertySchema && typeof propertySchema.description === 'string') {\n pushUnique(descriptions, propertySchema.description)\n }\n },\n visited: new Set<SchemaObject>(),\n maxPropertyDepth: 2,\n })\n return descriptions\n}\n\n/**\n * Deep merge for objects\n */\nexport function deepMerge(source: Record<any, any>, target: Record<any, any>) {\n for (const [key, val] of Object.entries(source)) {\n if (val !== null && typeof val === 'object') {\n target[key] ??= new val.__proto__.constructor()\n deepMerge(val, target[key])\n } else if (typeof val !== 'undefined') {\n target[key] = val\n }\n }\n\n return target\n}\n\n/**\n * Creates an empty specification object.\n * The returning object has the same structure as a valid OpenAPI specification, but everything is empty.\n */\nexport function createEmptySpecification(partialSpecification?: Partial<OpenApiDocument>) {\n const emptySpecification = {\n openapi: '3.1.0',\n info: {\n title: '',\n description: '',\n termsOfService: '',\n version: '',\n license: {\n name: '',\n url: '',\n },\n contact: {\n email: '',\n },\n },\n servers: [],\n tags: [],\n 'x-scalar-original-document-hash': '',\n }\n\n if (!partialSpecification) {\n return emptySpecification as OpenApiDocument\n }\n\n deepMerge(partialSpecification, emptySpecification)\n\n return emptySpecification as OpenApiDocument\n}\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"openapi.js","names":[],"sources":["../../src/helpers/openapi.ts"],"sourcesContent":["import { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport type {\n MediaTypeObject,\n OpenApiDocument,\n OperationObject,\n ParameterObject,\n ReferenceType,\n SchemaObject,\n SchemaReferenceType,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\nconst isSchemaObject = (value: unknown): value is SchemaObject => typeof value === 'object' && value !== null\n\n/**\n * Resolves a schema reference from workspace-store to a SchemaObject.\n * Returns undefined when a reference exists but has not been resolved yet.\n */\nfunction resolveSchemaRef(ref: SchemaReferenceType<SchemaObject>): SchemaObject | undefined {\n if (typeof ref === 'object' && ref !== null && '$ref' in ref) {\n return isSchemaObject(ref['$ref-value']) ? ref['$ref-value'] : undefined\n }\n\n return ref\n}\n\nfunction pushUnique(target: string[], value: string | undefined): void {\n if (!value) {\n return\n }\n if (!target.includes(value)) {\n target.push(value)\n }\n}\n\ntype CollectOptions = {\n visit: (key: string, schema: SchemaObject | undefined) => void\n visited: Set<SchemaObject>\n maxPropertyDepth: number\n}\n\n/**\n * Recursively visits every property of a schema, descending transparently through composition\n * keywords (`oneOf`, `anyOf`, `allOf`) and one level into nested object properties.\n *\n * Composition is treated as transparent — a `oneOf` of two object variants is *the same level* as a\n * single object, just expressed as multiple shapes. Property nesting is capped to keep the index\n * focused on shallow, commonly-searched fields. A visited-set keyed by resolved-schema identity\n * guards against recursive (`Tree → Tree`) schemas.\n */\nfunction collectSchemaProperties(schema: SchemaObject | undefined, options: CollectOptions, propertyDepth = 0): void {\n if (!schema || options.visited.has(schema)) {\n return\n }\n options.visited.add(schema)\n\n const variants = [...(schema.oneOf ?? []), ...(schema.anyOf ?? []), ...(schema.allOf ?? [])]\n variants.forEach((variantRef) => {\n collectSchemaProperties(resolveSchemaRef(variantRef), options, propertyDepth)\n })\n\n if (isObjectSchema(schema) && schema.properties) {\n Object.entries(schema.properties).forEach(([key, propRef]) => {\n const property = resolveSchemaRef(propRef)\n options.visit(key, property)\n if (propertyDepth + 1 < options.maxPropertyDepth) {\n collectSchemaProperties(property, options, propertyDepth + 1)\n }\n })\n }\n}\n\n/**\n * Walks the request body schemas of an operation and yields each property schema with its key.\n */\nfunction forEachRequestBodyProperty(\n operation: OperationObject,\n visit: (key: string, schema: SchemaObject | undefined) => void,\n): void {\n const content = getResolvedRef(operation?.requestBody)?.content\n if (!content) {\n return\n }\n\n const visited = new Set<SchemaObject>()\n Object.values(content).forEach((media) => {\n const resolvedMedia = getResolvedRef(media) as MediaTypeObject | undefined\n const schema = getResolvedRef(resolvedMedia?.schema)\n collectSchemaProperties(schema, { visit, visited, maxPropertyDepth: 2 })\n })\n}\n\n/**\n * Extracts the names of every parameter on an operation.\n *\n * The returned strings contain only parameter names (e.g. `userId`, `limit`) so they can be indexed\n * as a high-signal field for search. Filter-style metadata like `REQUIRED`, `optional`, `query` and\n * the schema type are intentionally excluded — those tokens dilute fuzzy matches and produce false\n * positives for queries like `query` or `integer`.\n */\nexport function extractParameterNames(parameters: ReferenceType<ParameterObject>[]): string[] {\n const names: string[] = []\n\n parameters.forEach((parameter) => {\n const resolved = getResolvedRef(parameter)\n pushUnique(names, resolved?.name)\n })\n\n return names\n}\n\n/**\n * Extracts the descriptions of every parameter on an operation.\n *\n * Kept separate from parameter names so the search index can weight each independently.\n */\nexport function extractParameterDescriptions(parameters: ReferenceType<ParameterObject>[]): string[] {\n const descriptions: string[] = []\n\n parameters.forEach((parameter) => {\n const resolved = getResolvedRef(parameter)\n pushUnique(descriptions, resolved?.description)\n })\n\n return descriptions\n}\n\n/**\n * Extracts the names of properties from the request body schema(s) of an operation.\n *\n * Walks every media type and includes both top-level and one level of nested property names so\n * common fields like `email` or `username` surface in search regardless of how the body is shaped.\n */\nexport function extractBodyFieldNames(operation: OperationObject): string[] {\n const names: string[] = []\n\n forEachRequestBodyProperty(operation, (key) => {\n pushUnique(names, key)\n })\n\n return names\n}\n\n/**\n * Extracts the descriptions of properties from the request body schema(s) of an operation.\n */\nexport function extractBodyDescriptions(operation: OperationObject): string[] {\n const descriptions: string[] = []\n\n forEachRequestBodyProperty(operation, (_key, schema) => {\n if (schema && 'description' in schema && typeof schema.description === 'string') {\n pushUnique(descriptions, schema.description)\n }\n })\n\n return descriptions\n}\n\n/**\n * Extracts the property names of a schema for the search index.\n *\n * Same depth and composition behavior as `extractBodyFieldNames` — descends transparently through\n * `oneOf`/`anyOf`/`allOf`, walks one level into nested object properties, dedupes.\n */\nexport function extractSchemaFieldNames(schema: SchemaObject | undefined): string[] {\n const names: string[] = []\n collectSchemaProperties(schema, {\n visit: (key) => pushUnique(names, key),\n visited: new Set<SchemaObject>(),\n maxPropertyDepth: 2,\n })\n return names\n}\n\n/**\n * Extracts the property descriptions of a schema for the search index.\n */\nexport function extractSchemaDescriptions(schema: SchemaObject | undefined): string[] {\n const descriptions: string[] = []\n collectSchemaProperties(schema, {\n visit: (_key, propertySchema) => {\n if (propertySchema && 'description' in propertySchema && typeof propertySchema.description === 'string') {\n pushUnique(descriptions, propertySchema.description)\n }\n },\n visited: new Set<SchemaObject>(),\n maxPropertyDepth: 2,\n })\n return descriptions\n}\n\n/**\n * Assigns a value as an ordinary own, enumerable data property.\n *\n * `target.__proto__ = value` runs the prototype setter instead of creating a property, so a\n * document with a `__proto__` key could otherwise change the prototype of the merged object.\n * Defining the property explicitly keeps a key with that name as plain data.\n */\nconst defineOwnProperty = (target: Record<any, any>, key: string, value: unknown): void => {\n if (key === '__proto__') {\n Object.defineProperty(target, key, { value, writable: true, enumerable: true, configurable: true })\n } else {\n target[key] = value\n }\n}\n\n/**\n * Whether `target` already has its own mergeable object under `key`.\n *\n * Only an own object is a safe merge target. Reaching an inherited property — every object inherits\n * `constructor`, and `__proto__` resolves to an accessor on `Object.prototype` — would let a\n * document walk up to `Object.prototype` and add a property to every object on the page.\n */\nconst hasOwnObject = (target: Record<any, any>, key: string): boolean =>\n Object.hasOwn(target, key) && target[key] !== null && typeof target[key] === 'object'\n\n/**\n * Deep merge for objects.\n *\n * OpenAPI documents are untrusted input and can carry keys like `__proto__`, `constructor`, or\n * `prototype` (a schema is free to describe a property named `constructor`). Those keys are merged\n * as ordinary own data, so nothing is silently dropped, but the merge never writes through the\n * prototype chain, which would otherwise pollute `Object.prototype` for every object on the page.\n */\nexport function deepMerge(source: Record<any, any>, target: Record<any, any>): Record<any, any> {\n for (const [key, val] of Object.entries(source)) {\n if (val !== null && typeof val === 'object') {\n if (!hasOwnObject(target, key)) {\n // Match the shape of the source value rather than reaching through its prototype, which\n // also keeps objects created with a `null` prototype from throwing.\n defineOwnProperty(target, key, Array.isArray(val) ? [] : {})\n }\n deepMerge(val, target[key])\n } else if (typeof val !== 'undefined') {\n defineOwnProperty(target, key, val)\n }\n }\n\n return target\n}\n\n/**\n * Creates an empty specification object.\n * The returning object has the same structure as a valid OpenAPI specification, but everything is empty.\n */\nexport function createEmptySpecification(partialSpecification?: Partial<OpenApiDocument>) {\n const emptySpecification = {\n openapi: '3.1.0',\n info: {\n title: '',\n description: '',\n termsOfService: '',\n version: '',\n license: {\n name: '',\n url: '',\n },\n contact: {\n email: '',\n },\n },\n servers: [],\n tags: [],\n 'x-scalar-original-document-hash': '',\n }\n\n if (!partialSpecification) {\n return emptySpecification as OpenApiDocument\n }\n\n deepMerge(partialSpecification, emptySpecification)\n\n return emptySpecification as OpenApiDocument\n}\n"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"safe-deep-clone.js","names":[],"sources":["../../src/helpers/safe-deep-clone.ts"],"sourcesContent":["import { deepClone } from '@scalar/workspace-store/helpers/deep-clone'\n\n/**\n * Deep-clones plain data for use where mutation must not affect the source.\n *\n * In the browser we use `structuredClone`, which preserves `Date`, `Map`, `Set`,\n * typed arrays, and other structured types. During SSR there is no `window`, so\n * we fall back to `JSON.parse(JSON.stringify(...))`, which only supports JSON\n * values (functions, `undefined` in objects, symbols, etc. are dropped or altered).\n *\n * @example\n * ```ts\n * const copy = safeDeepClone(spec)\n * copy.info.title = 'Draft'\n * // original spec is unchanged\n * ```\n */\nexport const safeDeepClone = <T>(value: T): T => {\n if (typeof window === 'undefined') {\n return deepClone(value)\n }\n return window.structuredClone(value) as T\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAa,iBAAoB,UAAgB;
|
|
1
|
+
{"version":3,"file":"safe-deep-clone.js","names":[],"sources":["../../src/helpers/safe-deep-clone.ts"],"sourcesContent":["import { deepClone } from '@scalar/workspace-store/helpers/deep-clone'\n\n/**\n * Deep-clones plain data for use where mutation must not affect the source.\n *\n * In the browser we use `structuredClone`, which preserves `Date`, `Map`, `Set`,\n * typed arrays, and other structured types. During SSR there is no `window`, so\n * we fall back to `JSON.parse(JSON.stringify(...))`, which only supports JSON\n * values (functions, `undefined` in objects, symbols, etc. are dropped or altered).\n *\n * @example\n * ```ts\n * const copy = safeDeepClone(spec)\n * copy.info.title = 'Draft'\n * // original spec is unchanged\n * ```\n */\nexport const safeDeepClone = <T>(value: T): T => {\n if (typeof window === 'undefined') {\n return deepClone(value)\n }\n return window.structuredClone(value) as T\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAiBA,IAAa,iBAAoB,UAAgB;CAC/C,IAAI,OAAO,WAAW,aACpB,OAAO,UAAU,KAAK;CAExB,OAAO,OAAO,gBAAgB,KAAK;AACrC"}
|
|
@@ -225,7 +225,7 @@ export declare const authStorage: () => {
|
|
|
225
225
|
authorizationUrl: string;
|
|
226
226
|
tokenUrl: string;
|
|
227
227
|
} & {
|
|
228
|
-
'x-usePkce': "
|
|
228
|
+
'x-usePkce': "plain" | "SHA-256" | "no";
|
|
229
229
|
} & {
|
|
230
230
|
'x-scalar-credentials-location'?: "body" | "header" | undefined;
|
|
231
231
|
} & {
|
|
@@ -242,7 +242,26 @@ export declare const authStorage: () => {
|
|
|
242
242
|
'x-scalar-credentials-location'?: "body" | "header" | undefined;
|
|
243
243
|
}) | undefined;
|
|
244
244
|
type: "openIdConnect";
|
|
245
|
-
}
|
|
245
|
+
} | ({
|
|
246
|
+
type: "userPassword" | "plain" | "scramSha256" | "scramSha512";
|
|
247
|
+
} & {
|
|
248
|
+
'x-scalar-secret-username': string;
|
|
249
|
+
'x-scalar-secret-password': string;
|
|
250
|
+
}) | ({
|
|
251
|
+
type: "X509";
|
|
252
|
+
} & {
|
|
253
|
+
'x-scalar-secret-client-certificate': string;
|
|
254
|
+
} & {
|
|
255
|
+
'x-scalar-secret-private-key': string;
|
|
256
|
+
}) | ({
|
|
257
|
+
type: "symmetricEncryption" | "asymmetricEncryption";
|
|
258
|
+
} & {
|
|
259
|
+
'x-scalar-secret-token': string;
|
|
260
|
+
}) | ({
|
|
261
|
+
type: "gssapi";
|
|
262
|
+
} & {
|
|
263
|
+
'x-scalar-secret-service-name': string;
|
|
264
|
+
});
|
|
246
265
|
};
|
|
247
266
|
};
|
|
248
267
|
/**
|
|
@@ -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"}
|
package/dist/helpers/storage.js
CHANGED
|
@@ -10,9 +10,16 @@ var storage = safeLocalStorage();
|
|
|
10
10
|
var clientStorage = () => {
|
|
11
11
|
const key = REFERENCE_LS_KEYS.SELECTED_CLIENT;
|
|
12
12
|
return {
|
|
13
|
+
/**
|
|
14
|
+
* Gets the stored selected client from local storage.
|
|
15
|
+
*/
|
|
13
16
|
get: () => {
|
|
14
17
|
return storage.getItem(key);
|
|
15
18
|
},
|
|
19
|
+
/**
|
|
20
|
+
* Stores the selected client value in local storage.
|
|
21
|
+
* @param value The value to store
|
|
22
|
+
*/
|
|
16
23
|
set: (value) => {
|
|
17
24
|
storage.setItem(key, value);
|
|
18
25
|
}
|
|
@@ -28,9 +35,16 @@ var authStorage = () => {
|
|
|
28
35
|
return `${REFERENCE_LS_KEYS.AUTH}-${slug}`;
|
|
29
36
|
};
|
|
30
37
|
return {
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves and coerces the authentication schemes stored in local storage.
|
|
40
|
+
*/
|
|
31
41
|
getAuth: (slug) => {
|
|
32
42
|
return coerceValue(AuthSchema, JSON.parse(storage.getItem(getKey(slug)) ?? "{}"));
|
|
33
43
|
},
|
|
44
|
+
/**
|
|
45
|
+
* Stores the authentication schemes in local storage.
|
|
46
|
+
* @param value The Auth object to stringify and store.
|
|
47
|
+
*/
|
|
34
48
|
setAuth: (slug, value) => {
|
|
35
49
|
storage.setItem(getKey(slug), JSON.stringify(value));
|
|
36
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","names":[],"sources":["../../src/helpers/storage.ts"],"sourcesContent":["import { REFERENCE_LS_KEYS, safeLocalStorage } from '@scalar/helpers/object/local-storage'\nimport { type Auth, AuthSchema } from '@scalar/workspace-store/entities/auth'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\n\n// Local storage helper instance, safely wrapped.\nconst storage = safeLocalStorage()\n\n/**\n * Provides an interface to store and retrieve the selected client value\n * in local storage.\n */\nexport const clientStorage = () => {\n const key = REFERENCE_LS_KEYS.SELECTED_CLIENT\n return {\n /**\n * Gets the stored selected client from local storage.\n */\n get: () => {\n return storage.getItem(key)\n },\n /**\n * Stores the selected client value in local storage.\n * @param value The value to store\n */\n set: (value: string) => {\n storage.setItem(key, value as string)\n },\n }\n}\n\n/**\n * Provides an interface to store and retrieve authentication scheme\n * information in local storage, including both the available schemes and\n * the user's selected schemes.\n */\nexport const authStorage = () => {\n const getKey = (slug: string) => {\n return `${REFERENCE_LS_KEYS.AUTH}-${slug}`\n }\n\n return {\n /**\n * Retrieves and coerces the authentication schemes stored in local storage.\n */\n getAuth: (slug: string) => {\n const parsed = JSON.parse(storage.getItem(getKey(slug)) ?? '{}')\n return coerceValue(AuthSchema, parsed)\n },\n /**\n * Stores the authentication schemes in local storage.\n * @param value The Auth object to stringify and store.\n */\n setAuth: (slug: string, value: Auth) => {\n storage.setItem(getKey(slug), JSON.stringify(value))\n },\n }\n}\n"],"mappings":";;;;AAKA,IAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"storage.js","names":[],"sources":["../../src/helpers/storage.ts"],"sourcesContent":["import { REFERENCE_LS_KEYS, safeLocalStorage } from '@scalar/helpers/object/local-storage'\nimport { type Auth, AuthSchema } from '@scalar/workspace-store/entities/auth'\nimport { coerceValue } from '@scalar/workspace-store/schemas/typebox-coerce'\n\n// Local storage helper instance, safely wrapped.\nconst storage = safeLocalStorage()\n\n/**\n * Provides an interface to store and retrieve the selected client value\n * in local storage.\n */\nexport const clientStorage = () => {\n const key = REFERENCE_LS_KEYS.SELECTED_CLIENT\n return {\n /**\n * Gets the stored selected client from local storage.\n */\n get: () => {\n return storage.getItem(key)\n },\n /**\n * Stores the selected client value in local storage.\n * @param value The value to store\n */\n set: (value: string) => {\n storage.setItem(key, value as string)\n },\n }\n}\n\n/**\n * Provides an interface to store and retrieve authentication scheme\n * information in local storage, including both the available schemes and\n * the user's selected schemes.\n */\nexport const authStorage = () => {\n const getKey = (slug: string) => {\n return `${REFERENCE_LS_KEYS.AUTH}-${slug}`\n }\n\n return {\n /**\n * Retrieves and coerces the authentication schemes stored in local storage.\n */\n getAuth: (slug: string) => {\n const parsed = JSON.parse(storage.getItem(getKey(slug)) ?? '{}')\n return coerceValue(AuthSchema, parsed)\n },\n /**\n * Stores the authentication schemes in local storage.\n * @param value The Auth object to stringify and store.\n */\n setAuth: (slug: string, value: Auth) => {\n storage.setItem(getKey(slug), JSON.stringify(value))\n },\n }\n}\n"],"mappings":";;;;AAKA,IAAM,UAAU,iBAAiB;;;;;AAMjC,IAAa,sBAAsB;CACjC,MAAM,MAAM,kBAAkB;CAC9B,OAAO;;;;EAIL,WAAW;GACT,OAAO,QAAQ,QAAQ,GAAG;EAC5B;;;;;EAKA,MAAM,UAAkB;GACtB,QAAQ,QAAQ,KAAK,KAAe;EACtC;CACF;AACF;;;;;;AAOA,IAAa,oBAAoB;CAC/B,MAAM,UAAU,SAAiB;EAC/B,OAAO,GAAG,kBAAkB,KAAK,GAAG;CACtC;CAEA,OAAO;;;;EAIL,UAAU,SAAiB;GAEzB,OAAO,YAAY,YADJ,KAAK,MAAM,QAAQ,QAAQ,OAAO,IAAI,CAAC,KAAK,IAC5B,CAAM;EACvC;;;;;EAKA,UAAU,MAAc,UAAgB;GACtC,QAAQ,QAAQ,OAAO,IAAI,GAAG,KAAK,UAAU,KAAK,CAAC;EACrD;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-temp-document.js","names":[],"sources":["../../src/helpers/upload-temp-document.ts"],"sourcesContent":["import { redirectToProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport type { ExternalUrls } from '@scalar/types/api-reference'\n\n/** Type guard for the response body */\nfunction isResponseBody(data: unknown): data is { url: string } {\n return !!data && typeof data === 'object' && 'url' in data && typeof (data as any).url === 'string'\n}\n\n/** Upload a document and return a temporary URL */\nexport async function uploadTempDocument(\n document: string,\n urls: Pick<ExternalUrls, 'proxyUrl' | 'apiBaseUrl'>,\n): Promise<string> {\n const body = JSON.stringify({ document })\n const uploadUrl = `${urls.apiBaseUrl}/core/share/upload/apis`\n\n // Proxy the request to avoid localhost CORS issues\n const response = await fetch(redirectToProxy(urls.proxyUrl, uploadUrl), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body,\n })\n\n if (!response.ok) {\n throw new Error(` Failed to generate temporary link, server responded with ${response.status}`)\n }\n const data = (await response.json()) as unknown\n\n if (!isResponseBody(data)) {\n throw new Error('Failed to generate temporary link, invalid response from server')\n }\n\n return data.url\n}\n"],"mappings":";;;AAIA,SAAS,eAAe,MAAwC;
|
|
1
|
+
{"version":3,"file":"upload-temp-document.js","names":[],"sources":["../../src/helpers/upload-temp-document.ts"],"sourcesContent":["import { redirectToProxy } from '@scalar/helpers/url/redirect-to-proxy'\nimport type { ExternalUrls } from '@scalar/types/api-reference'\n\n/** Type guard for the response body */\nfunction isResponseBody(data: unknown): data is { url: string } {\n return !!data && typeof data === 'object' && 'url' in data && typeof (data as any).url === 'string'\n}\n\n/** Upload a document and return a temporary URL */\nexport async function uploadTempDocument(\n document: string,\n urls: Pick<ExternalUrls, 'proxyUrl' | 'apiBaseUrl'>,\n): Promise<string> {\n const body = JSON.stringify({ document })\n const uploadUrl = `${urls.apiBaseUrl}/core/share/upload/apis`\n\n // Proxy the request to avoid localhost CORS issues\n const response = await fetch(redirectToProxy(urls.proxyUrl, uploadUrl), {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body,\n })\n\n if (!response.ok) {\n throw new Error(` Failed to generate temporary link, server responded with ${response.status}`)\n }\n const data = (await response.json()) as unknown\n\n if (!isResponseBody(data)) {\n throw new Error('Failed to generate temporary link, invalid response from server')\n }\n\n return data.url\n}\n"],"mappings":";;;AAIA,SAAS,eAAe,MAAwC;CAC9D,OAAO,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAQ,KAAa,QAAQ;AAC7F;;AAGA,eAAsB,mBACpB,UACA,MACiB;CACjB,MAAM,OAAO,KAAK,UAAU,EAAE,SAAS,CAAC;CACxC,MAAM,YAAY,GAAG,KAAK,WAAW;CAGrC,MAAM,WAAW,MAAM,MAAM,gBAAgB,KAAK,UAAU,SAAS,GAAG;EACtE,QAAQ;EACR,SAAS,EAAE,gBAAgB,mBAAmB;EAC9C;CACF,CAAC;CAED,IAAI,CAAC,SAAS,IACZ,MAAM,IAAI,MAAM,6DAA6D,SAAS,QAAQ;CAEhG,MAAM,OAAQ,MAAM,SAAS,KAAK;CAElC,IAAI,CAAC,eAAe,IAAI,GACtB,MAAM,IAAI,MAAM,iEAAiE;CAGnF,OAAO,KAAK;AACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-agent.js","names":[],"sources":["../../src/hooks/use-agent.ts"],"sourcesContent":["import { isLocalUrl } from '@scalar/helpers/url/is-local-url'\nimport type { ComputedRef, Ref } from 'vue'\nimport { type InjectionKey, computed, inject, ref } from 'vue'\n\ntype UseAgentOptions = {\n /** Optional. When provided, controls whether the agent UI is enabled (e.g. from doc config). Defaults to isLocalUrl. */\n agentEnabled?: ComputedRef<boolean>\n}\n\ntype UseAgentReturn = {\n showAgent: Ref<boolean>\n agentEnabled: ComputedRef<boolean>\n /** Ref used to pass a prefill message into the agent when opening. Cleared on close. */\n prefilledMessage: Ref<string>\n openAgent: (message?: string) => void\n closeAgent: () => void\n toggleAgent: () => void\n}\n\nexport const AGENT_CONTEXT_SYMBOL = Symbol() as InjectionKey<UseAgentReturn>\n\n/**\n * Module-level ref so useAgentContext() can resolve context even when inject fails\n * (e.g. async component boundary or mount order). Set when ApiReference calls useAgent().\n */\nconst agentStateRef: Ref<UseAgentReturn | null> = ref(null)\n\n/**\n * Hook for agent visibility and enabled state.\n * Call from the API Reference root (e.g. ApiReference.vue) with options to create the state, then provide it so descendants can inject it.\n *\n * Returns:\n * - showAgent: whether the agent panel is visible\n * - agentEnabled: whether the agent is enabled\n * - openAgent, closeAgent, toggleAgent: imperative controls\n */\nexport function useAgent(options: UseAgentOptions): UseAgentReturn {\n const showAgent = ref(false)\n const prefilledMessage = ref('')\n\n const agentEnabled = options.agentEnabled ?? computed(() => isLocalUrl(window.location.href))\n\n const openAgent = (message?: string) => {\n prefilledMessage.value = message ?? ''\n showAgent.value = true\n }\n\n const closeAgent = () => {\n showAgent.value = false\n prefilledMessage.value = ''\n }\n\n const toggleAgent = () => {\n showAgent.value = !showAgent.value\n if (!showAgent.value) {\n prefilledMessage.value = ''\n }\n }\n\n const state: UseAgentReturn = {\n showAgent,\n agentEnabled,\n prefilledMessage,\n openAgent,\n closeAgent,\n toggleAgent,\n }\n agentStateRef.value = state\n return state\n}\n\n/**\n * Inject the agent context provided by ApiReference.\n * Falls back to module-level state when inject is undefined (e.g. async boundary or mount order).\n * Use in descendant components (e.g. AskAgentButton) to open the agent or check if it is enabled.\n *\n * Returns a computed ref; use v-if=\"agentContext?.agentEnabled\" so the button only renders when context exists and agent is enabled.\n */\nexport function useAgentContext(): ComputedRef<UseAgentReturn | undefined> {\n const injected = inject(AGENT_CONTEXT_SYMBOL, undefined)\n return computed((): UseAgentReturn | undefined => injected ?? agentStateRef.value ?? undefined)\n}\n"],"mappings":";;;AAmBA,IAAa,uBAAuB,
|
|
1
|
+
{"version":3,"file":"use-agent.js","names":[],"sources":["../../src/hooks/use-agent.ts"],"sourcesContent":["import { isLocalUrl } from '@scalar/helpers/url/is-local-url'\nimport type { ComputedRef, Ref } from 'vue'\nimport { type InjectionKey, computed, inject, ref } from 'vue'\n\ntype UseAgentOptions = {\n /** Optional. When provided, controls whether the agent UI is enabled (e.g. from doc config). Defaults to isLocalUrl. */\n agentEnabled?: ComputedRef<boolean>\n}\n\ntype UseAgentReturn = {\n showAgent: Ref<boolean>\n agentEnabled: ComputedRef<boolean>\n /** Ref used to pass a prefill message into the agent when opening. Cleared on close. */\n prefilledMessage: Ref<string>\n openAgent: (message?: string) => void\n closeAgent: () => void\n toggleAgent: () => void\n}\n\nexport const AGENT_CONTEXT_SYMBOL = Symbol() as InjectionKey<UseAgentReturn>\n\n/**\n * Module-level ref so useAgentContext() can resolve context even when inject fails\n * (e.g. async component boundary or mount order). Set when ApiReference calls useAgent().\n */\nconst agentStateRef: Ref<UseAgentReturn | null> = ref(null)\n\n/**\n * Hook for agent visibility and enabled state.\n * Call from the API Reference root (e.g. ApiReference.vue) with options to create the state, then provide it so descendants can inject it.\n *\n * Returns:\n * - showAgent: whether the agent panel is visible\n * - agentEnabled: whether the agent is enabled\n * - openAgent, closeAgent, toggleAgent: imperative controls\n */\nexport function useAgent(options: UseAgentOptions): UseAgentReturn {\n const showAgent = ref(false)\n const prefilledMessage = ref('')\n\n const agentEnabled = options.agentEnabled ?? computed(() => isLocalUrl(window.location.href))\n\n const openAgent = (message?: string) => {\n prefilledMessage.value = message ?? ''\n showAgent.value = true\n }\n\n const closeAgent = () => {\n showAgent.value = false\n prefilledMessage.value = ''\n }\n\n const toggleAgent = () => {\n showAgent.value = !showAgent.value\n if (!showAgent.value) {\n prefilledMessage.value = ''\n }\n }\n\n const state: UseAgentReturn = {\n showAgent,\n agentEnabled,\n prefilledMessage,\n openAgent,\n closeAgent,\n toggleAgent,\n }\n agentStateRef.value = state\n return state\n}\n\n/**\n * Inject the agent context provided by ApiReference.\n * Falls back to module-level state when inject is undefined (e.g. async boundary or mount order).\n * Use in descendant components (e.g. AskAgentButton) to open the agent or check if it is enabled.\n *\n * Returns a computed ref; use v-if=\"agentContext?.agentEnabled\" so the button only renders when context exists and agent is enabled.\n */\nexport function useAgentContext(): ComputedRef<UseAgentReturn | undefined> {\n const injected = inject(AGENT_CONTEXT_SYMBOL, undefined)\n return computed((): UseAgentReturn | undefined => injected ?? agentStateRef.value ?? undefined)\n}\n"],"mappings":";;;AAmBA,IAAa,uBAAuB,OAAO;;;;;AAM3C,IAAM,gBAA4C,IAAI,IAAI;;;;;;;;;;AAW1D,SAAgB,SAAS,SAA0C;CACjE,MAAM,YAAY,IAAI,KAAK;CAC3B,MAAM,mBAAmB,IAAI,EAAE;CAE/B,MAAM,eAAe,QAAQ,gBAAgB,eAAe,WAAW,OAAO,SAAS,IAAI,CAAC;CAE5F,MAAM,aAAa,YAAqB;EACtC,iBAAiB,QAAQ,WAAW;EACpC,UAAU,QAAQ;CACpB;CAEA,MAAM,mBAAmB;EACvB,UAAU,QAAQ;EAClB,iBAAiB,QAAQ;CAC3B;CAEA,MAAM,oBAAoB;EACxB,UAAU,QAAQ,CAAC,UAAU;EAC7B,IAAI,CAAC,UAAU,OACb,iBAAiB,QAAQ;CAE7B;CAEA,MAAM,QAAwB;EAC5B;EACA;EACA;EACA;EACA;EACA;CACF;CACA,cAAc,QAAQ;CACtB,OAAO;AACT;;;;;;;;AASA,SAAgB,kBAA2D;CACzE,MAAM,WAAW,OAAO,sBAAsB,KAAA,CAAS;CACvD,OAAO,eAA2C,YAAY,cAAc,SAAS,KAAA,CAAS;AAChG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-intersection.js","names":[],"sources":["../../src/hooks/use-intersection.ts"],"sourcesContent":["import { useIntersectionObserver } from '@vueuse/core'\nimport { type TemplateRef, onMounted } from 'vue'\n\n/**\n * Shrinks the observation root to a thin horizontal strip at the vertical middle of\n * the viewport (~2% of viewport height). Emits only while the target overlaps that line.\n */\nconst VIEWPORT_VERTICAL_CENTER_ROOT_MARGIN = '-49% 0px -49% 0px'\n\ntype UseIntersectionOptions = {\n /** Called when the element stops intersecting. */\n onExit?: () => void\n /**\n * Whether to immediately fire the intersection as soon as the element is on the screen.\n *\n * When false (default) we use a root margin that is 2% of the viewport height on the middle of the viewport.\n */\n immediate?: boolean\n}\n\nexport const useIntersection = (\n el: TemplateRef<HTMLElement | undefined>,\n onIntersect: () => void,\n options?: UseIntersectionOptions,\n) => {\n onMounted(() => {\n const observerOptions = {\n rootMargin: options?.immediate ? '0px 0px 0px 0px' : VIEWPORT_VERTICAL_CENTER_ROOT_MARGIN,\n threshold: 0,\n } as const\n\n if (el.value) {\n useIntersectionObserver(\n el,\n ([entry]) => {\n if (entry?.isIntersecting) {\n onIntersect()\n } else {\n options?.onExit?.()\n }\n },\n observerOptions,\n )\n }\n })\n}\n"],"mappings":";;;;;;;AAOA,IAAM,uCAAuC;AAa7C,IAAa,mBACX,IACA,aACA,YACG;
|
|
1
|
+
{"version":3,"file":"use-intersection.js","names":[],"sources":["../../src/hooks/use-intersection.ts"],"sourcesContent":["import { useIntersectionObserver } from '@vueuse/core'\nimport { type TemplateRef, onMounted } from 'vue'\n\n/**\n * Shrinks the observation root to a thin horizontal strip at the vertical middle of\n * the viewport (~2% of viewport height). Emits only while the target overlaps that line.\n */\nconst VIEWPORT_VERTICAL_CENTER_ROOT_MARGIN = '-49% 0px -49% 0px'\n\ntype UseIntersectionOptions = {\n /** Called when the element stops intersecting. */\n onExit?: () => void\n /**\n * Whether to immediately fire the intersection as soon as the element is on the screen.\n *\n * When false (default) we use a root margin that is 2% of the viewport height on the middle of the viewport.\n */\n immediate?: boolean\n}\n\nexport const useIntersection = (\n el: TemplateRef<HTMLElement | undefined>,\n onIntersect: () => void,\n options?: UseIntersectionOptions,\n) => {\n onMounted(() => {\n const observerOptions = {\n rootMargin: options?.immediate ? '0px 0px 0px 0px' : VIEWPORT_VERTICAL_CENTER_ROOT_MARGIN,\n threshold: 0,\n } as const\n\n if (el.value) {\n useIntersectionObserver(\n el,\n ([entry]) => {\n if (entry?.isIntersecting) {\n onIntersect()\n } else {\n options?.onExit?.()\n }\n },\n observerOptions,\n )\n }\n })\n}\n"],"mappings":";;;;;;;AAOA,IAAM,uCAAuC;AAa7C,IAAa,mBACX,IACA,aACA,YACG;CACH,gBAAgB;EACd,MAAM,kBAAkB;GACtB,YAAY,SAAS,YAAY,oBAAoB;GACrD,WAAW;EACb;EAEA,IAAI,GAAG,OACL,wBACE,KACC,CAAC,WAAW;GACX,IAAI,OAAO,gBACT,YAAY;QAEZ,SAAS,SAAS;EAEtB,GACA,eACF;CAEJ,CAAC;AACH"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePluginManager.js","names":[],"sources":["../../../src/plugins/hooks/usePluginManager.ts"],"sourcesContent":["import { type PluginManager, createPluginManager } from '@/plugins/plugin-manager'\nimport { type InjectionKey, inject } from 'vue'\n\nexport const PLUGIN_MANAGER_SYMBOL = Symbol() as InjectionKey<PluginManager>\n\n/**\n * Hook to access the plugin manager\n */\nexport const usePluginManager = (): PluginManager => {\n const manager = inject(PLUGIN_MANAGER_SYMBOL)\n\n // No plugin manager provided, creating a new one.\n if (!manager) {\n return createPluginManager({})\n }\n\n return manager\n}\n"],"mappings":";;;AAGA,IAAa,wBAAwB,
|
|
1
|
+
{"version":3,"file":"usePluginManager.js","names":[],"sources":["../../../src/plugins/hooks/usePluginManager.ts"],"sourcesContent":["import { type PluginManager, createPluginManager } from '@/plugins/plugin-manager'\nimport { type InjectionKey, inject } from 'vue'\n\nexport const PLUGIN_MANAGER_SYMBOL = Symbol() as InjectionKey<PluginManager>\n\n/**\n * Hook to access the plugin manager\n */\nexport const usePluginManager = (): PluginManager => {\n const manager = inject(PLUGIN_MANAGER_SYMBOL)\n\n // No plugin manager provided, creating a new one.\n if (!manager) {\n return createPluginManager({})\n }\n\n return manager\n}\n"],"mappings":";;;AAGA,IAAa,wBAAwB,OAAO;;;;AAK5C,IAAa,yBAAwC;CACnD,MAAM,UAAU,OAAO,qBAAqB;CAG5C,IAAI,CAAC,SACH,OAAO,oBAAoB,CAAC,CAAC;CAG/B,OAAO;AACT"}
|
|
@@ -15,7 +15,12 @@ var persistencePlugin = ({ debounceDelay = 500, maxWait = 1e4, persistAuth = fal
|
|
|
15
15
|
if (typeof persistAuth === "function") return persistAuth();
|
|
16
16
|
return persistAuth;
|
|
17
17
|
};
|
|
18
|
-
return { hooks: {
|
|
18
|
+
return { hooks: {
|
|
19
|
+
/**
|
|
20
|
+
* Handles all workspace state change events.
|
|
21
|
+
* Each write is debounced by a key to prevent frequent writes for the same entity.
|
|
22
|
+
*/
|
|
23
|
+
onWorkspaceStateChanges(event) {
|
|
19
24
|
if (event.type === "meta") {
|
|
20
25
|
const defaultClient = event.value["x-scalar-default-client"];
|
|
21
26
|
if (defaultClient !== void 0) execute("x-scalar-default-client", () => clientPersistence.set(defaultClient));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence-plugin.js","names":[],"sources":["../../src/plugins/persistence-plugin.ts"],"sourcesContent":["import { debounce } from '@scalar/helpers/general/debounce'\nimport type { WorkspacePlugin } from '@scalar/workspace-store/workspace-plugin'\n\nimport { authStorage, clientStorage } from '@/helpers/storage'\n\n/**\n * Plugin to persist workspace state changes with debounced writes.\n */\nexport const persistencePlugin = ({\n debounceDelay = 500,\n maxWait = 10000,\n persistAuth = false,\n}: {\n debounceDelay?: number\n /** Maximum time in milliseconds to wait before forcing execution, even with continuous calls. */\n maxWait?: number\n /**\n * Determines whether authentication details should be persisted.\n * Accepts a boolean or a function that returns a boolean.\n * Allows for conditional persistence logic, e.g., based on environment or user settings.\n */\n persistAuth?: boolean | (() => boolean)\n}): WorkspacePlugin => {\n // Debounced execute function for batching similar state changes\n const { execute } = debounce({ delay: debounceDelay, maxWait })\n const authPersistence = authStorage()\n const clientPersistence = clientStorage()\n\n const getPersistAuth = () => {\n if (typeof persistAuth === 'function') {\n return persistAuth()\n }\n\n return persistAuth\n }\n\n return {\n hooks: {\n /**\n * Handles all workspace state change events.\n * Each write is debounced by a key to prevent frequent writes for the same entity.\n */\n onWorkspaceStateChanges(event) {\n // If the event is for workspace meta data, debounce by workspaceId\n if (event.type === 'meta') {\n // Persist the meta fields\n const defaultClient = event.value['x-scalar-default-client']\n if (defaultClient !== undefined) {\n execute('x-scalar-default-client', () => clientPersistence.set(defaultClient))\n }\n return\n }\n\n // Persist auth and [server](TODO)\n // Use event.documentName as both the debounce key and the storage key so that\n // concurrent auth changes across multiple documents do not clobber each other and\n // the correct slug is used even when the active document has already changed.\n if (getPersistAuth() && event.type === 'auth') {\n execute(`auth-${event.documentName}`, () => authPersistence.setAuth(event.documentName, event.value))\n }\n\n // No action for other event types\n return\n },\n },\n }\n}\n"],"mappings":";;;;;;AAQA,IAAa,qBAAqB,EAChC,gBAAgB,KAChB,UAAU,KACV,cAAc,YAWO;CAErB,MAAM,EAAE,YAAY,SAAS;EAAE,OAAO;EAAe;
|
|
1
|
+
{"version":3,"file":"persistence-plugin.js","names":[],"sources":["../../src/plugins/persistence-plugin.ts"],"sourcesContent":["import { debounce } from '@scalar/helpers/general/debounce'\nimport type { WorkspacePlugin } from '@scalar/workspace-store/workspace-plugin'\n\nimport { authStorage, clientStorage } from '@/helpers/storage'\n\n/**\n * Plugin to persist workspace state changes with debounced writes.\n */\nexport const persistencePlugin = ({\n debounceDelay = 500,\n maxWait = 10000,\n persistAuth = false,\n}: {\n debounceDelay?: number\n /** Maximum time in milliseconds to wait before forcing execution, even with continuous calls. */\n maxWait?: number\n /**\n * Determines whether authentication details should be persisted.\n * Accepts a boolean or a function that returns a boolean.\n * Allows for conditional persistence logic, e.g., based on environment or user settings.\n */\n persistAuth?: boolean | (() => boolean)\n}): WorkspacePlugin => {\n // Debounced execute function for batching similar state changes\n const { execute } = debounce({ delay: debounceDelay, maxWait })\n const authPersistence = authStorage()\n const clientPersistence = clientStorage()\n\n const getPersistAuth = () => {\n if (typeof persistAuth === 'function') {\n return persistAuth()\n }\n\n return persistAuth\n }\n\n return {\n hooks: {\n /**\n * Handles all workspace state change events.\n * Each write is debounced by a key to prevent frequent writes for the same entity.\n */\n onWorkspaceStateChanges(event) {\n // If the event is for workspace meta data, debounce by workspaceId\n if (event.type === 'meta') {\n // Persist the meta fields\n const defaultClient = event.value['x-scalar-default-client']\n if (defaultClient !== undefined) {\n execute('x-scalar-default-client', () => clientPersistence.set(defaultClient))\n }\n return\n }\n\n // Persist auth and [server](TODO)\n // Use event.documentName as both the debounce key and the storage key so that\n // concurrent auth changes across multiple documents do not clobber each other and\n // the correct slug is used even when the active document has already changed.\n if (getPersistAuth() && event.type === 'auth') {\n execute(`auth-${event.documentName}`, () => authPersistence.setAuth(event.documentName, event.value))\n }\n\n // No action for other event types\n return\n },\n },\n }\n}\n"],"mappings":";;;;;;AAQA,IAAa,qBAAqB,EAChC,gBAAgB,KAChB,UAAU,KACV,cAAc,YAWO;CAErB,MAAM,EAAE,YAAY,SAAS;EAAE,OAAO;EAAe;CAAQ,CAAC;CAC9D,MAAM,kBAAkB,YAAY;CACpC,MAAM,oBAAoB,cAAc;CAExC,MAAM,uBAAuB;EAC3B,IAAI,OAAO,gBAAgB,YACzB,OAAO,YAAY;EAGrB,OAAO;CACT;CAEA,OAAO,EACL,OAAO;;;;;AAKL,wBAAwB,OAAO;EAE7B,IAAI,MAAM,SAAS,QAAQ;GAEzB,MAAM,gBAAgB,MAAM,MAAM;GAClC,IAAI,kBAAkB,KAAA,GACpB,QAAQ,iCAAiC,kBAAkB,IAAI,aAAa,CAAC;GAE/E;EACF;EAMA,IAAI,eAAe,KAAK,MAAM,SAAS,QACrC,QAAQ,QAAQ,MAAM,sBAAsB,gBAAgB,QAAQ,MAAM,cAAc,MAAM,KAAK,CAAC;CAKxG,EACF,EACF;AACF"}
|
|
@@ -35,11 +35,21 @@ var createPluginManager = ({ plugins = [], auth }) => {
|
|
|
35
35
|
registeredPlugins.set(pluginInstance.name, pluginInstance);
|
|
36
36
|
});
|
|
37
37
|
return {
|
|
38
|
+
/**
|
|
39
|
+
* Get all extensions with the given name from registered plugins
|
|
40
|
+
*/
|
|
38
41
|
getSpecificationExtensions: (name) => {
|
|
39
42
|
const extensions = [];
|
|
40
43
|
for (const plugin of registeredPlugins.values()) for (const extension of plugin.extensions) if (extension.name === name) extensions.push(extension);
|
|
41
44
|
return extensions;
|
|
42
45
|
},
|
|
46
|
+
/**
|
|
47
|
+
* Get all components for a specific view from registered plugins.
|
|
48
|
+
*
|
|
49
|
+
* Each component carries a stable `id` (scoped to the active document slug) so the rendered
|
|
50
|
+
* DOM element and the sidebar entry (see `getSidebarEntries`) share the same id and stay in
|
|
51
|
+
* sync for scroll navigation and deep-linking.
|
|
52
|
+
*/
|
|
43
53
|
getViewComponents: (viewName, documentSlug) => {
|
|
44
54
|
const components = [];
|
|
45
55
|
for (const plugin of registeredPlugins.values()) {
|
|
@@ -53,27 +63,52 @@ var createPluginManager = ({ plugins = [], auth }) => {
|
|
|
53
63
|
}
|
|
54
64
|
return components;
|
|
55
65
|
},
|
|
66
|
+
/**
|
|
67
|
+
* Notify all plugins that the API Reference has been initialized
|
|
68
|
+
*/
|
|
56
69
|
notifyInit: (config) => {
|
|
57
70
|
for (const plugin of registeredPlugins.values()) plugin.hooks?.onInit?.({
|
|
58
71
|
config,
|
|
59
72
|
auth: authState
|
|
60
73
|
});
|
|
61
74
|
},
|
|
75
|
+
/**
|
|
76
|
+
* Notify all plugins that the configuration has changed
|
|
77
|
+
*/
|
|
62
78
|
notifyConfigChange: (config) => {
|
|
63
79
|
for (const plugin of registeredPlugins.values()) plugin.hooks?.onConfigChange?.({
|
|
64
80
|
config,
|
|
65
81
|
auth: authState
|
|
66
82
|
});
|
|
67
83
|
},
|
|
84
|
+
/**
|
|
85
|
+
* Get the read-only accessor for the global authentication state.
|
|
86
|
+
*
|
|
87
|
+
* Plugin view components can call this (via `usePluginManager`) to read stored secrets and the
|
|
88
|
+
* selected security schemes. Returns an empty auth state when no accessor was provided.
|
|
89
|
+
*/
|
|
68
90
|
getAuthState: () => authState,
|
|
91
|
+
/**
|
|
92
|
+
* Notify all plugins that the API Reference is being destroyed
|
|
93
|
+
*/
|
|
69
94
|
notifyDestroy: () => {
|
|
70
95
|
for (const plugin of registeredPlugins.values()) plugin.hooks?.onDestroy?.();
|
|
71
96
|
},
|
|
97
|
+
/**
|
|
98
|
+
* Get all client plugins provided by registered plugins
|
|
99
|
+
*/
|
|
72
100
|
getApiClientPlugins: () => {
|
|
73
101
|
const apiClientPlugins = [];
|
|
74
102
|
for (const plugin of registeredPlugins.values()) if (plugin.apiClientPlugins) apiClientPlugins.push(...plugin.apiClientPlugins);
|
|
75
103
|
return apiClientPlugins;
|
|
76
104
|
},
|
|
105
|
+
/**
|
|
106
|
+
* Get all sidebar entries contributed by plugin views.
|
|
107
|
+
*
|
|
108
|
+
* Only views that opt in via `sidebar.show` are returned. Each entry's `id` matches the
|
|
109
|
+
* id of the rendered component (see `getViewComponents`), so the API Reference can add it
|
|
110
|
+
* to the sidebar navigation and scrolling/active-tracking work out of the box.
|
|
111
|
+
*/
|
|
77
112
|
getSidebarEntries: (documentSlug) => {
|
|
78
113
|
const entries = [];
|
|
79
114
|
for (const plugin of registeredPlugins.values()) for (const viewName of PLUGIN_VIEW_NAMES) (plugin.views?.[viewName])?.forEach((component, index) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin-manager.js","names":[],"sources":["../../src/plugins/plugin-manager.ts"],"sourcesContent":["import type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type {\n ApiReferencePlugin as OriginalApiReferencePlugin,\n PluginAuthState,\n SpecificationExtension,\n ViewComponent,\n} from '@scalar/types/api-reference'\n\nexport type ApiReferencePlugin = OriginalApiReferencePlugin\n\nexport type { PluginAuthState }\n\ntype CreatePluginManagerParams = {\n plugins?: ApiReferencePlugin[]\n /**\n * Read-only accessor for the global authentication state.\n *\n * Passed through to plugin lifecycle hooks and exposed via `getAuthState`, letting plugins read\n * stored secrets and the selected security schemes without being able to mutate them.\n */\n auth?: PluginAuthState\n}\n\n/**\n * A no-op auth state used when no accessor is provided (e.g. in tests or a standalone manager).\n * It reports an empty authentication state so plugins can call the read methods unconditionally.\n */\nconst createEmptyAuthState = (): PluginAuthState => ({\n export: () => ({}),\n getAuthSecrets: () => undefined,\n getAuthSelectedSchemas: () => undefined,\n})\n\n/** Plugin view slots that can render custom components in the content area */\nconst PLUGIN_VIEW_NAMES = ['content.start', 'content.end'] as const\n\ntype PluginViewName = (typeof PLUGIN_VIEW_NAMES)[number]\n\n/** A plugin view component paired with the stable id used for the DOM and sidebar navigation */\nexport type PluginViewComponent = ViewComponent & { id: string }\n\n/** A sidebar entry contributed by a plugin view */\ntype PluginSidebarEntry = {\n id: string\n label: string\n viewName: PluginViewName\n}\n\n/**\n * Build a stable, unique id for a plugin view component.\n *\n * The same id is used as the DOM element id (so scroll navigation can find it) and as the\n * sidebar navigation entry id (so clicking it scrolls to the element). Keeping both in sync\n * is what lets plugin views participate in the existing scroll-spy and navigation logic.\n *\n * The id is prefixed with the document slug so it matches the navigation id convention. That is\n * what lets URL deep-linking work: `getIdFromUrl` re-prepends the document slug on initial load,\n * so a hash like `plugin-view/<plugin>/<view>/<index>` resolves back to this exact id.\n */\nconst getPluginViewId = (documentSlug: string, pluginName: string, viewName: PluginViewName, index: number): string =>\n `${documentSlug}/plugin-view/${pluginName}/${viewName}/${index}`\n\n/**\n * Create the plugin manager store\n *\n * This store manages all plugins registered with the API client\n */\nexport const createPluginManager = ({ plugins = [], auth }: CreatePluginManagerParams) => {\n const registeredPlugins = new Map<string, ReturnType<ApiReferencePlugin>>()\n\n // Fall back to an empty read-only auth state so hooks and `getAuthState` always have an accessor.\n const authState = auth ?? createEmptyAuthState()\n\n // Register initial plugins\n plugins.forEach((plugin) => {\n const pluginInstance = plugin()\n registeredPlugins.set(pluginInstance.name, pluginInstance)\n })\n\n return {\n /**\n * Get all extensions with the given name from registered plugins\n */\n getSpecificationExtensions: (name: `x-${string}`): SpecificationExtension[] => {\n const extensions: SpecificationExtension[] = []\n\n for (const plugin of registeredPlugins.values()) {\n for (const extension of plugin.extensions) {\n if (extension.name === name) {\n extensions.push(extension)\n }\n }\n }\n\n return extensions\n },\n\n /**\n * Get all components for a specific view from registered plugins.\n *\n * Each component carries a stable `id` (scoped to the active document slug) so the rendered\n * DOM element and the sidebar entry (see `getSidebarEntries`) share the same id and stay in\n * sync for scroll navigation and deep-linking.\n */\n getViewComponents: (viewName: PluginViewName, documentSlug: string): PluginViewComponent[] => {\n const components: PluginViewComponent[] = []\n\n for (const plugin of registeredPlugins.values()) {\n const viewComponents = plugin.views?.[viewName]\n if (viewComponents) {\n viewComponents.forEach((component: ViewComponent, index: number) => {\n components.push({ ...component, id: getPluginViewId(documentSlug, plugin.name, viewName, index) })\n })\n }\n }\n\n return components\n },\n\n /**\n * Notify all plugins that the API Reference has been initialized\n */\n notifyInit: (config: Record<string, unknown>): void => {\n for (const plugin of registeredPlugins.values()) {\n plugin.hooks?.onInit?.({ config, auth: authState })\n }\n },\n\n /**\n * Notify all plugins that the configuration has changed\n */\n notifyConfigChange: (config: Record<string, unknown>): void => {\n for (const plugin of registeredPlugins.values()) {\n plugin.hooks?.onConfigChange?.({ config, auth: authState })\n }\n },\n\n /**\n * Get the read-only accessor for the global authentication state.\n *\n * Plugin view components can call this (via `usePluginManager`) to read stored secrets and the\n * selected security schemes. Returns an empty auth state when no accessor was provided.\n */\n getAuthState: (): PluginAuthState => authState,\n\n /**\n * Notify all plugins that the API Reference is being destroyed\n */\n notifyDestroy: (): void => {\n for (const plugin of registeredPlugins.values()) {\n plugin.hooks?.onDestroy?.()\n }\n },\n\n /**\n * Get all client plugins provided by registered plugins\n */\n getApiClientPlugins: (): ClientPlugin[] => {\n const apiClientPlugins: ClientPlugin[] = []\n\n for (const plugin of registeredPlugins.values()) {\n if (plugin.apiClientPlugins) {\n apiClientPlugins.push(...(plugin.apiClientPlugins as ClientPlugin[]))\n }\n }\n\n return apiClientPlugins\n },\n\n /**\n * Get all sidebar entries contributed by plugin views.\n *\n * Only views that opt in via `sidebar.show` are returned. Each entry's `id` matches the\n * id of the rendered component (see `getViewComponents`), so the API Reference can add it\n * to the sidebar navigation and scrolling/active-tracking work out of the box.\n */\n getSidebarEntries: (documentSlug: string): PluginSidebarEntry[] => {\n const entries: PluginSidebarEntry[] = []\n\n for (const plugin of registeredPlugins.values()) {\n for (const viewName of PLUGIN_VIEW_NAMES) {\n const viewComponents = plugin.views?.[viewName]\n viewComponents?.forEach((component: ViewComponent, index: number) => {\n if (component.sidebar?.show && component.sidebar.label) {\n entries.push({\n id: getPluginViewId(documentSlug, plugin.name, viewName, index),\n label: component.sidebar.label,\n viewName,\n })\n }\n })\n }\n }\n\n return entries\n },\n }\n}\n\nexport type PluginManager = ReturnType<typeof createPluginManager>\n"],"mappings":";;;;;AA2BA,IAAM,8BAA+C;CACnD,eAAe,
|
|
1
|
+
{"version":3,"file":"plugin-manager.js","names":[],"sources":["../../src/plugins/plugin-manager.ts"],"sourcesContent":["import type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type {\n ApiReferencePlugin as OriginalApiReferencePlugin,\n PluginAuthState,\n SpecificationExtension,\n ViewComponent,\n} from '@scalar/types/api-reference'\n\nexport type ApiReferencePlugin = OriginalApiReferencePlugin\n\nexport type { PluginAuthState }\n\ntype CreatePluginManagerParams = {\n plugins?: ApiReferencePlugin[]\n /**\n * Read-only accessor for the global authentication state.\n *\n * Passed through to plugin lifecycle hooks and exposed via `getAuthState`, letting plugins read\n * stored secrets and the selected security schemes without being able to mutate them.\n */\n auth?: PluginAuthState\n}\n\n/**\n * A no-op auth state used when no accessor is provided (e.g. in tests or a standalone manager).\n * It reports an empty authentication state so plugins can call the read methods unconditionally.\n */\nconst createEmptyAuthState = (): PluginAuthState => ({\n export: () => ({}),\n getAuthSecrets: () => undefined,\n getAuthSelectedSchemas: () => undefined,\n})\n\n/** Plugin view slots that can render custom components in the content area */\nconst PLUGIN_VIEW_NAMES = ['content.start', 'content.end'] as const\n\ntype PluginViewName = (typeof PLUGIN_VIEW_NAMES)[number]\n\n/** A plugin view component paired with the stable id used for the DOM and sidebar navigation */\nexport type PluginViewComponent = ViewComponent & { id: string }\n\n/** A sidebar entry contributed by a plugin view */\ntype PluginSidebarEntry = {\n id: string\n label: string\n viewName: PluginViewName\n}\n\n/**\n * Build a stable, unique id for a plugin view component.\n *\n * The same id is used as the DOM element id (so scroll navigation can find it) and as the\n * sidebar navigation entry id (so clicking it scrolls to the element). Keeping both in sync\n * is what lets plugin views participate in the existing scroll-spy and navigation logic.\n *\n * The id is prefixed with the document slug so it matches the navigation id convention. That is\n * what lets URL deep-linking work: `getIdFromUrl` re-prepends the document slug on initial load,\n * so a hash like `plugin-view/<plugin>/<view>/<index>` resolves back to this exact id.\n */\nconst getPluginViewId = (documentSlug: string, pluginName: string, viewName: PluginViewName, index: number): string =>\n `${documentSlug}/plugin-view/${pluginName}/${viewName}/${index}`\n\n/**\n * Create the plugin manager store\n *\n * This store manages all plugins registered with the API client\n */\nexport const createPluginManager = ({ plugins = [], auth }: CreatePluginManagerParams) => {\n const registeredPlugins = new Map<string, ReturnType<ApiReferencePlugin>>()\n\n // Fall back to an empty read-only auth state so hooks and `getAuthState` always have an accessor.\n const authState = auth ?? createEmptyAuthState()\n\n // Register initial plugins\n plugins.forEach((plugin) => {\n const pluginInstance = plugin()\n registeredPlugins.set(pluginInstance.name, pluginInstance)\n })\n\n return {\n /**\n * Get all extensions with the given name from registered plugins\n */\n getSpecificationExtensions: (name: `x-${string}`): SpecificationExtension[] => {\n const extensions: SpecificationExtension[] = []\n\n for (const plugin of registeredPlugins.values()) {\n for (const extension of plugin.extensions) {\n if (extension.name === name) {\n extensions.push(extension)\n }\n }\n }\n\n return extensions\n },\n\n /**\n * Get all components for a specific view from registered plugins.\n *\n * Each component carries a stable `id` (scoped to the active document slug) so the rendered\n * DOM element and the sidebar entry (see `getSidebarEntries`) share the same id and stay in\n * sync for scroll navigation and deep-linking.\n */\n getViewComponents: (viewName: PluginViewName, documentSlug: string): PluginViewComponent[] => {\n const components: PluginViewComponent[] = []\n\n for (const plugin of registeredPlugins.values()) {\n const viewComponents = plugin.views?.[viewName]\n if (viewComponents) {\n viewComponents.forEach((component: ViewComponent, index: number) => {\n components.push({ ...component, id: getPluginViewId(documentSlug, plugin.name, viewName, index) })\n })\n }\n }\n\n return components\n },\n\n /**\n * Notify all plugins that the API Reference has been initialized\n */\n notifyInit: (config: Record<string, unknown>): void => {\n for (const plugin of registeredPlugins.values()) {\n plugin.hooks?.onInit?.({ config, auth: authState })\n }\n },\n\n /**\n * Notify all plugins that the configuration has changed\n */\n notifyConfigChange: (config: Record<string, unknown>): void => {\n for (const plugin of registeredPlugins.values()) {\n plugin.hooks?.onConfigChange?.({ config, auth: authState })\n }\n },\n\n /**\n * Get the read-only accessor for the global authentication state.\n *\n * Plugin view components can call this (via `usePluginManager`) to read stored secrets and the\n * selected security schemes. Returns an empty auth state when no accessor was provided.\n */\n getAuthState: (): PluginAuthState => authState,\n\n /**\n * Notify all plugins that the API Reference is being destroyed\n */\n notifyDestroy: (): void => {\n for (const plugin of registeredPlugins.values()) {\n plugin.hooks?.onDestroy?.()\n }\n },\n\n /**\n * Get all client plugins provided by registered plugins\n */\n getApiClientPlugins: (): ClientPlugin[] => {\n const apiClientPlugins: ClientPlugin[] = []\n\n for (const plugin of registeredPlugins.values()) {\n if (plugin.apiClientPlugins) {\n apiClientPlugins.push(...(plugin.apiClientPlugins as ClientPlugin[]))\n }\n }\n\n return apiClientPlugins\n },\n\n /**\n * Get all sidebar entries contributed by plugin views.\n *\n * Only views that opt in via `sidebar.show` are returned. Each entry's `id` matches the\n * id of the rendered component (see `getViewComponents`), so the API Reference can add it\n * to the sidebar navigation and scrolling/active-tracking work out of the box.\n */\n getSidebarEntries: (documentSlug: string): PluginSidebarEntry[] => {\n const entries: PluginSidebarEntry[] = []\n\n for (const plugin of registeredPlugins.values()) {\n for (const viewName of PLUGIN_VIEW_NAMES) {\n const viewComponents = plugin.views?.[viewName]\n viewComponents?.forEach((component: ViewComponent, index: number) => {\n if (component.sidebar?.show && component.sidebar.label) {\n entries.push({\n id: getPluginViewId(documentSlug, plugin.name, viewName, index),\n label: component.sidebar.label,\n viewName,\n })\n }\n })\n }\n }\n\n return entries\n },\n }\n}\n\nexport type PluginManager = ReturnType<typeof createPluginManager>\n"],"mappings":";;;;;AA2BA,IAAM,8BAA+C;CACnD,eAAe,CAAC;CAChB,sBAAsB,KAAA;CACtB,8BAA8B,KAAA;AAChC;;AAGA,IAAM,oBAAoB,CAAC,iBAAiB,aAAa;;;;;;;;;;;;AAyBzD,IAAM,mBAAmB,cAAsB,YAAoB,UAA0B,UAC3F,GAAG,aAAa,eAAe,WAAW,GAAG,SAAS,GAAG;;;;;;AAO3D,IAAa,uBAAuB,EAAE,UAAU,CAAC,GAAG,WAAsC;CACxF,MAAM,oCAAoB,IAAI,IAA4C;CAG1E,MAAM,YAAY,QAAQ,qBAAqB;CAG/C,QAAQ,SAAS,WAAW;EAC1B,MAAM,iBAAiB,OAAO;EAC9B,kBAAkB,IAAI,eAAe,MAAM,cAAc;CAC3D,CAAC;CAED,OAAO;;;;EAIL,6BAA6B,SAAkD;GAC7E,MAAM,aAAuC,CAAC;GAE9C,KAAK,MAAM,UAAU,kBAAkB,OAAO,GAC5C,KAAK,MAAM,aAAa,OAAO,YAC7B,IAAI,UAAU,SAAS,MACrB,WAAW,KAAK,SAAS;GAK/B,OAAO;EACT;;;;;;;;EASA,oBAAoB,UAA0B,iBAAgD;GAC5F,MAAM,aAAoC,CAAC;GAE3C,KAAK,MAAM,UAAU,kBAAkB,OAAO,GAAG;IAC/C,MAAM,iBAAiB,OAAO,QAAQ;IACtC,IAAI,gBACF,eAAe,SAAS,WAA0B,UAAkB;KAClE,WAAW,KAAK;MAAE,GAAG;MAAW,IAAI,gBAAgB,cAAc,OAAO,MAAM,UAAU,KAAK;KAAE,CAAC;IACnG,CAAC;GAEL;GAEA,OAAO;EACT;;;;EAKA,aAAa,WAA0C;GACrD,KAAK,MAAM,UAAU,kBAAkB,OAAO,GAC5C,OAAO,OAAO,SAAS;IAAE;IAAQ,MAAM;GAAU,CAAC;EAEtD;;;;EAKA,qBAAqB,WAA0C;GAC7D,KAAK,MAAM,UAAU,kBAAkB,OAAO,GAC5C,OAAO,OAAO,iBAAiB;IAAE;IAAQ,MAAM;GAAU,CAAC;EAE9D;;;;;;;EAQA,oBAAqC;;;;EAKrC,qBAA2B;GACzB,KAAK,MAAM,UAAU,kBAAkB,OAAO,GAC5C,OAAO,OAAO,YAAY;EAE9B;;;;EAKA,2BAA2C;GACzC,MAAM,mBAAmC,CAAC;GAE1C,KAAK,MAAM,UAAU,kBAAkB,OAAO,GAC5C,IAAI,OAAO,kBACT,iBAAiB,KAAK,GAAI,OAAO,gBAAmC;GAIxE,OAAO;EACT;;;;;;;;EASA,oBAAoB,iBAA+C;GACjE,MAAM,UAAgC,CAAC;GAEvC,KAAK,MAAM,UAAU,kBAAkB,OAAO,GAC5C,KAAK,MAAM,YAAY,mBAErB,CADuB,OAAO,QAAQ,UAAA,EACtB,SAAS,WAA0B,UAAkB;IACnE,IAAI,UAAU,SAAS,QAAQ,UAAU,QAAQ,OAC/C,QAAQ,KAAK;KACX,IAAI,gBAAgB,cAAc,OAAO,MAAM,UAAU,KAAK;KAC9D,OAAO,UAAU,QAAQ;KACzB;IACF,CAAC;GAEL,CAAC;GAIL,OAAO;EACT;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../src/plugins/posthog/index.ts"],"sourcesContent":["import { PostHogClientPlugin, type PostHogConfig } from '@scalar/api-client/plugins/posthog'\nimport type { PostHog } from 'posthog-js'\nimport ph from 'posthog-js'\n\nimport type { ApiReferencePlugin } from '../plugin-manager'\n\nexport type { PostHogConfig }\n\n/**\n * PostHog analytics plugin for the API Reference.\n *\n * Loading this plugin opts in to analytics for both the API Reference\n * and the embedded API Client (tracked as separate products).\n *\n * Respects the `telemetry` configuration option — when set to `false`,\n * capturing is disabled. Reacts dynamically to config changes at runtime.\n *\n * If the plugin is not loaded, no tracking occurs.\n */\nexport const PostHogPlugin = (config: PostHogConfig): ApiReferencePlugin => {\n let posthog: PostHog | null = null\n const clientPlugin = PostHogClientPlugin(config)\n\n return () => ({\n name: 'posthog',\n extensions: [],\n apiClientPlugins: [clientPlugin],\n hooks: {\n onInit({ config: referenceConfig }) {\n if (typeof window === 'undefined') {\n return\n }\n\n const instance = ph.init(\n config.apiKey,\n {\n api_host: config.apiHost,\n ...(config.uiHost ? { ui_host: config.uiHost } : {}),\n ...(config.defaults ? { defaults: config.defaults } : {}),\n opt_out_capturing_by_default: true,\n },\n 'scalar-api-reference',\n )\n\n if (instance) {\n posthog = instance\n posthog.register({ product: 'api-reference' })\n\n if (referenceConfig.telemetry !== false) {\n posthog.opt_in_capturing()\n }\n }\n\n clientPlugin.lifecycle?.onInit?.({ config: referenceConfig })\n },\n onConfigChange({ config: referenceConfig }) {\n if (posthog) {\n if (referenceConfig.telemetry === false) {\n posthog.opt_out_capturing()\n } else {\n posthog.opt_in_capturing()\n }\n }\n\n clientPlugin.lifecycle?.onConfigChange?.({ config: referenceConfig })\n },\n onDestroy() {\n posthog?.reset()\n posthog = null\n\n clientPlugin.lifecycle?.onDestroy?.()\n },\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,IAAa,iBAAiB,WAA8C;CAC1E,IAAI,UAA0B;CAC9B,MAAM,eAAe,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../src/plugins/posthog/index.ts"],"sourcesContent":["import { PostHogClientPlugin, type PostHogConfig } from '@scalar/api-client/plugins/posthog'\nimport type { PostHog } from 'posthog-js'\nimport ph from 'posthog-js'\n\nimport type { ApiReferencePlugin } from '../plugin-manager'\n\nexport type { PostHogConfig }\n\n/**\n * PostHog analytics plugin for the API Reference.\n *\n * Loading this plugin opts in to analytics for both the API Reference\n * and the embedded API Client (tracked as separate products).\n *\n * Respects the `telemetry` configuration option — when set to `false`,\n * capturing is disabled. Reacts dynamically to config changes at runtime.\n *\n * If the plugin is not loaded, no tracking occurs.\n */\nexport const PostHogPlugin = (config: PostHogConfig): ApiReferencePlugin => {\n let posthog: PostHog | null = null\n const clientPlugin = PostHogClientPlugin(config)\n\n return () => ({\n name: 'posthog',\n extensions: [],\n apiClientPlugins: [clientPlugin],\n hooks: {\n onInit({ config: referenceConfig }) {\n if (typeof window === 'undefined') {\n return\n }\n\n const instance = ph.init(\n config.apiKey,\n {\n api_host: config.apiHost,\n ...(config.uiHost ? { ui_host: config.uiHost } : {}),\n ...(config.defaults ? { defaults: config.defaults } : {}),\n opt_out_capturing_by_default: true,\n },\n 'scalar-api-reference',\n )\n\n if (instance) {\n posthog = instance\n posthog.register({ product: 'api-reference' })\n\n if (referenceConfig.telemetry !== false) {\n posthog.opt_in_capturing()\n }\n }\n\n clientPlugin.lifecycle?.onInit?.({ config: referenceConfig })\n },\n onConfigChange({ config: referenceConfig }) {\n if (posthog) {\n if (referenceConfig.telemetry === false) {\n posthog.opt_out_capturing()\n } else {\n posthog.opt_in_capturing()\n }\n }\n\n clientPlugin.lifecycle?.onConfigChange?.({ config: referenceConfig })\n },\n onDestroy() {\n posthog?.reset()\n posthog = null\n\n clientPlugin.lifecycle?.onDestroy?.()\n },\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;;AAmBA,IAAa,iBAAiB,WAA8C;CAC1E,IAAI,UAA0B;CAC9B,MAAM,eAAe,oBAAoB,MAAM;CAE/C,cAAc;EACZ,MAAM;EACN,YAAY,CAAC;EACb,kBAAkB,CAAC,YAAY;EAC/B,OAAO;GACL,OAAO,EAAE,QAAQ,mBAAmB;IAClC,IAAI,OAAO,WAAW,aACpB;IAGF,MAAM,WAAW,GAAG,KAClB,OAAO,QACP;KACE,UAAU,OAAO;KACjB,GAAI,OAAO,SAAS,EAAE,SAAS,OAAO,OAAO,IAAI,CAAC;KAClD,GAAI,OAAO,WAAW,EAAE,UAAU,OAAO,SAAS,IAAI,CAAC;KACvD,8BAA8B;IAChC,GACA,sBACF;IAEA,IAAI,UAAU;KACZ,UAAU;KACV,QAAQ,SAAS,EAAE,SAAS,gBAAgB,CAAC;KAE7C,IAAI,gBAAgB,cAAc,OAChC,QAAQ,iBAAiB;IAE7B;IAEA,aAAa,WAAW,SAAS,EAAE,QAAQ,gBAAgB,CAAC;GAC9D;GACA,eAAe,EAAE,QAAQ,mBAAmB;IAC1C,IAAI,SACF,IAAI,gBAAgB,cAAc,OAChC,QAAQ,kBAAkB;SAE1B,QAAQ,iBAAiB;IAI7B,aAAa,WAAW,iBAAiB,EAAE,QAAQ,gBAAgB,CAAC;GACtE;GACA,YAAY;IACV,SAAS,MAAM;IACf,UAAU;IAEV,aAAa,WAAW,YAAY;GACtC;EACF;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-api.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mCAAmC,EACnC,kBAAkB,EACnB,MAAM,6BAA6B,CAAA;
|
|
1
|
+
{"version":3,"file":"html-api.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mCAAmC,EACnC,kBAAkB,EACnB,MAAM,6BAA6B,CAAA;AAsEpC;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,QAAQ,GAAG,mCAAmC,CA+GrG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,mCAAmC,QAiBnG;AAID,eAAO,MAAM,eAAe,GAAI,KAAK,QAAQ,EAAE,UAAU,OAAO,GAAG,IAAI,mBAatE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAoKhC,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ApiReference_default from "../../components/ApiReference.vue.js";
|
|
2
|
+
import { hasPluginUrls, loadPluginsFromUrls } from "./load-plugins-from-urls.js";
|
|
2
3
|
import { createApp, createSSRApp, h, reactive } from "vue";
|
|
3
4
|
import "@scalar/schemas/api-reference";
|
|
4
5
|
import { createHead } from "@unhead/vue/client";
|
|
@@ -73,9 +74,15 @@ var createApiReference = (elementOrSelectorOrConfig, optionalConfiguration) => {
|
|
|
73
74
|
let app = createReferenceApp(!!optionalConfiguration && !!mountElement && mountElement.children.length > 0);
|
|
74
75
|
let hasMounted = false;
|
|
75
76
|
if (optionalConfiguration) if (mountElement) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
77
|
+
const mount = () => {
|
|
78
|
+
app.mount(mountElement);
|
|
79
|
+
hasMounted = true;
|
|
80
|
+
retainStandaloneStyles(document);
|
|
81
|
+
};
|
|
82
|
+
if (hasPluginUrls(props.configuration)) loadPluginsFromUrls(props.configuration).then(() => {
|
|
83
|
+
if (!abortController.signal.aborted) mount();
|
|
84
|
+
});
|
|
85
|
+
else mount();
|
|
79
86
|
} else console.error("Could not find a mount point for API References:", elementOrSelectorOrConfig);
|
|
80
87
|
const abortController = new AbortController();
|
|
81
88
|
const listenerOptions = {
|
|
@@ -100,9 +107,9 @@ var createApiReference = (elementOrSelectorOrConfig, optionalConfiguration) => {
|
|
|
100
107
|
const destroy = () => {
|
|
101
108
|
abortController.abort();
|
|
102
109
|
props.configuration = {};
|
|
103
|
-
app.unmount();
|
|
104
110
|
if (hasMounted) {
|
|
105
111
|
hasMounted = false;
|
|
112
|
+
app.unmount();
|
|
106
113
|
releaseStandaloneStyles(document);
|
|
107
114
|
}
|
|
108
115
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-api.js","names":[],"sources":["../../../src/standalone/lib/html-api.ts"],"sourcesContent":["import { apiReferenceConfigurationWithSourceSchema } from '@scalar/schemas/api-reference'\nimport type {\n AnyApiReferenceConfiguration,\n ApiReferenceConfigurationWithSource,\n CreateApiReference,\n} from '@scalar/types/api-reference'\nimport { createHead } from '@unhead/vue/client'\nimport { createApp, createSSRApp, h, reactive } from 'vue'\n\nimport { default as ApiReference } from '@/components/ApiReference.vue'\n\nconst getSpecScriptTag = (doc: Document) => doc.getElementById('api-reference')\n\n/**\n * The id given to the standalone build's single injected `<style>` tag.\n * Keep in sync with `vite.standalone.config.ts` and `vite.standalone.esm.config.ts`.\n */\nconst STANDALONE_STYLE_ID = 'scalar-style'\n\n/**\n * Per-document bookkeeping for the standalone build's injected styles.\n *\n * The CDN build injects all of its CSS into one `<style>` tag in `<head>`. Under\n * SPA-style navigation (Turbo Drive, htmx boost, Astro view transitions) the host\n * swaps the DOM without reloading the window, so those document-level styles\n * (`@layer scalar-base`, the `:root` theme variables) would otherwise linger and\n * bleed into the host app's next page. We reference-count the live instances and\n * detach the styles when the last one is destroyed, re-attaching them when a new\n * instance mounts so navigating back to the reference is still styled.\n *\n * State is keyed by document so the counter survives navigations (the JS context\n * persists) while staying isolated per page.\n */\nconst standaloneStyleState = new WeakMap<Document, { count: number; detachedStyle: HTMLStyleElement | null }>()\n\nconst getStandaloneStyleState = (doc: Document): { count: number; detachedStyle: HTMLStyleElement | null } => {\n const existing = standaloneStyleState.get(doc)\n if (existing) {\n return existing\n }\n\n const state = { count: 0, detachedStyle: null }\n standaloneStyleState.set(doc, state)\n\n return state\n}\n\n/** Track a freshly mounted instance and restore previously detached styles. */\nconst retainStandaloneStyles = (doc: Document): void => {\n const state = getStandaloneStyleState(doc)\n state.count += 1\n\n if (state.detachedStyle && !doc.getElementById(STANDALONE_STYLE_ID)) {\n doc.head.appendChild(state.detachedStyle)\n state.detachedStyle = null\n }\n}\n\n/** Release an instance and detach the injected styles once the last one is gone. */\nconst releaseStandaloneStyles = (doc: Document): void => {\n const state = getStandaloneStyleState(doc)\n state.count = Math.max(0, state.count - 1)\n\n if (state.count > 0) {\n return\n }\n\n const styleElement = doc.getElementById(STANDALONE_STYLE_ID)\n if (styleElement instanceof HTMLStyleElement) {\n state.detachedStyle = styleElement\n styleElement.remove()\n }\n}\n\n/**\n * Reading the configuration from the data-attributes.\n */\nexport function getConfigurationFromDataAttributes(doc: Document): ApiReferenceConfigurationWithSource {\n const specElement = doc.querySelector('[data-spec]')\n const specUrlElement = doc.querySelector('[data-spec-url]')\n const configurationScriptElement = doc.querySelector('#api-reference[data-configuration]')\n\n const getConfiguration = () => {\n // <script data-configuration=\"{ … }\" />\n if (configurationScriptElement) {\n const configurationFromElement = configurationScriptElement.getAttribute('data-configuration')\n\n if (configurationFromElement) {\n return {\n _integration: 'html',\n ...JSON.parse(configurationFromElement.split('"').join('\"')),\n }\n }\n }\n\n return apiReferenceConfigurationWithSourceSchema({ _integration: 'html' })\n }\n\n const getUrl = () => {\n // Let's first check if the user passed a spec URL in the configuration.\n if (getConfiguration().url) {\n return getConfiguration().url\n }\n\n if (getConfiguration().spec?.url) {\n return getConfiguration().spec?.url\n }\n\n // <script id=\"api-reference\" data-url=\"/scalar.json\" />\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const urlFromScriptTag = specScriptTag.getAttribute('data-url')?.trim()\n\n if (urlFromScriptTag) {\n return urlFromScriptTag\n }\n }\n\n // <div data-spec-url=\"/scalar.json\" />\n if (specUrlElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec-url] HTML API is deprecated. Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead.',\n )\n const urlFromSpecUrlElement = specUrlElement.getAttribute('data-spec-url')\n\n if (urlFromSpecUrlElement) {\n return urlFromSpecUrlElement\n }\n }\n\n return undefined\n }\n\n const getContent = (): string | undefined => {\n // <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const specFromScriptTag = specScriptTag.innerHTML?.trim()\n\n if (specFromScriptTag) {\n return specFromScriptTag\n }\n }\n\n // <div data-spec='{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}' />\n if (specElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec] HTML API is deprecated. Use the new <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script> API instead.',\n )\n const specFromSpecElement = specElement.getAttribute('data-spec')?.trim()\n\n if (specFromSpecElement) {\n return specFromSpecElement\n }\n }\n\n return undefined\n }\n\n const getProxyUrl = () => {\n // <script id=\"api-reference\" data-proxy-url=\"https://proxy.scalar.com\">…</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const proxyUrl = specScriptTag.getAttribute('data-proxy-url')\n\n if (proxyUrl) {\n return proxyUrl.trim()\n }\n }\n\n return undefined\n }\n\n // Ensure Reference Props are reactive\n if (!specUrlElement && !specElement && !getSpecScriptTag(doc)) {\n // Stay quiet.\n } else {\n const urlOrContent = getContent() ? { content: getContent() } : { url: getUrl() }\n\n return apiReferenceConfigurationWithSourceSchema({\n _integration: 'html',\n proxyUrl: getProxyUrl(),\n ...getConfiguration(),\n ...urlOrContent,\n })\n }\n\n return apiReferenceConfigurationWithSourceSchema({ _integration: 'html' })\n}\n\n/**\n * Mount the Scalar API Reference on a given document.\n * Read the HTML data-attributes for configuration.\n */\nexport function findDataAttributes(doc: Document, configuration: ApiReferenceConfigurationWithSource) {\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specElement = doc.querySelector('[data-spec]')\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specUrlElement = doc.querySelector('[data-spec-url]')\n\n if (configuration?.darkMode) {\n doc.body?.classList.add('dark-mode')\n } else {\n doc.body?.classList.add('light-mode')\n }\n\n const container = createContainer(doc, specElement || specUrlElement)\n\n if (container) {\n createApiReference(container, configuration)\n }\n}\n\n// If it's a script tag, we can't mount the Vue.js app inside that tag.\n// We need to add a new container element before the script tag.\nexport const createContainer = (doc: Document, element?: Element | null) => {\n let _container: Element | null = null\n\n const specScriptTag = getSpecScriptTag(doc)\n\n if (specScriptTag) {\n _container = doc.createElement('div')\n specScriptTag?.parentNode?.insertBefore(_container, specScriptTag)\n } else if (element) {\n _container = element\n }\n\n return _container\n}\n\n/**\n * Create (and mount) a new Scalar API Reference\n *\n * @example createApiReference({ url: '/scalar.json' }).mount('#app')\n * @example createApiReference('#app', { url: '/scalar.json' })\n * @example createApiReference(document.getElementById('app'), { url: '/scalar.json' })\n */\nexport const createApiReference: CreateApiReference = (\n elementOrSelectorOrConfig,\n optionalConfiguration?: AnyApiReferenceConfiguration,\n) => {\n // Create an id prefix for useId so we don't have collisions with other Vue apps\n const idPrefix = 'scalar-refs'\n\n const props = reactive<{ configuration: AnyApiReferenceConfiguration }>({\n // Either the configuration will be the second argument or it MUST be the first (configuration only)\n configuration: optionalConfiguration ?? (elementOrSelectorOrConfig as AnyApiReferenceConfiguration) ?? {},\n })\n\n const createReferenceApp = (isSsr = false) => {\n const referenceApp = isSsr ? createSSRApp(() => h(ApiReference, props)) : createApp(() => h(ApiReference, props))\n\n // Meta tags, etc.\n referenceApp.use(createHead())\n referenceApp.config.idPrefix = idPrefix\n\n return referenceApp\n }\n\n // If we have an optional config, then we must mount the element immediately (not sure why type is not narrowing)\n const mountElement = optionalConfiguration\n ? typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n : null\n\n // Detect server-rendered content and use createSSRApp for hydration\n const shouldHydrate = !!optionalConfiguration && !!mountElement && mountElement.children.length > 0\n let app = createReferenceApp(shouldHydrate)\n\n // Track whether this instance mounted so `destroy` only releases the shared\n // standalone styles for instances that actually retained them.\n let hasMounted = false\n\n if (optionalConfiguration) {\n if (mountElement) {\n app.mount(mountElement)\n hasMounted = true\n retainStandaloneStyles(document)\n } else {\n console.error('Could not find a mount point for API References:', elementOrSelectorOrConfig)\n }\n }\n\n // Tie the deprecated `document` listeners to an AbortController so `destroy`\n // can remove them all at once. Without this, every `createApiReference()`\n // call leaks three permanent listeners — visible during Astro view\n // transitions where each navigation creates a new instance.\n const abortController = new AbortController()\n const listenerOptions: AddEventListenerOptions = {\n capture: false,\n signal: abortController.signal,\n }\n\n /**\n * Reload the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:reload-references',\n () => {\n console.warn(\n 'scalar:reload-references event has been deprecated, please use the scalarInstance.app.mount method instead.',\n )\n if (!props.configuration) {\n return\n }\n\n // Snag the current element\n const currentElement =\n typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n\n if (!currentElement) {\n return\n }\n\n // Ensure we re-attach the element if it was unmounted\n if (currentElement && !document.body.contains(currentElement)) {\n document.body.appendChild(currentElement)\n }\n\n // Create a new Vue app instance\n app.unmount()\n app = createReferenceApp()\n app.mount(currentElement)\n },\n listenerOptions,\n )\n\n /** Destroy the current API Reference instance */\n const destroy = () => {\n abortController.abort()\n props.configuration = {}\n app.unmount()\n\n if (hasMounted) {\n hasMounted = false\n releaseStandaloneStyles(document)\n }\n }\n\n /**\n * Allow user to destroy the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:destroy-references',\n () => {\n console.warn('scalar:destroy-references event has been deprecated, please use scalarInstance.destroy instead.')\n destroy()\n },\n listenerOptions,\n )\n\n /**\n * Allow user to update configuration\n * @deprecated\n */\n document.addEventListener(\n 'scalar:update-references-config',\n (ev) => {\n console.warn(\n 'scalar:update-references-config event has been deprecated, please use scalarInstance.updateConfiguration instead.',\n )\n if ('detail' in ev) {\n Object.assign(props, ev.detail)\n }\n },\n listenerOptions,\n )\n\n const instance = {\n app,\n getConfiguration: () => props.configuration ?? {},\n updateConfiguration: (newConfig: AnyApiReferenceConfiguration) => {\n props.configuration = newConfig\n },\n destroy,\n }\n\n return instance\n}\n"],"mappings":";;;;;;;;;AAiBA,IAAM,sBAAsB;;;;;;;;;;;;;;;AAgB5B,IAAM,uCAAuB,IAAI,SAA8E;AAE/G,IAAM,2BAA2B,QAA6E;CAC5G,MAAM,WAAW,qBAAqB,IAAI,IAAI;AAC9C,KAAI,SACF,QAAO;CAGT,MAAM,QAAQ;EAAE,OAAO;EAAG,eAAe;EAAM;AAC/C,sBAAqB,IAAI,KAAK,MAAM;AAEpC,QAAO;;;AAIT,IAAM,0BAA0B,QAAwB;CACtD,MAAM,QAAQ,wBAAwB,IAAI;AAC1C,OAAM,SAAS;AAEf,KAAI,MAAM,iBAAiB,CAAC,IAAI,eAAe,oBAAoB,EAAE;AACnE,MAAI,KAAK,YAAY,MAAM,cAAc;AACzC,QAAM,gBAAgB;;;;AAK1B,IAAM,2BAA2B,QAAwB;CACvD,MAAM,QAAQ,wBAAwB,IAAI;AAC1C,OAAM,QAAQ,KAAK,IAAI,GAAG,MAAM,QAAQ,EAAE;AAE1C,KAAI,MAAM,QAAQ,EAChB;CAGF,MAAM,eAAe,IAAI,eAAe,oBAAoB;AAC5D,KAAI,wBAAwB,kBAAkB;AAC5C,QAAM,gBAAgB;AACtB,eAAa,QAAQ;;;;;;;;;;AAuKzB,IAAa,sBACX,2BACA,0BACG;CAEH,MAAM,WAAW;CAEjB,MAAM,QAAQ,SAA0D,EAEtE,eAAe,yBAA0B,6BAA8D,EAAE,EAC1G,CAAC;CAEF,MAAM,sBAAsB,QAAQ,UAAU;EAC5C,MAAM,eAAe,QAAQ,mBAAmB,EAAE,sBAAc,MAAM,CAAC,GAAG,gBAAgB,EAAE,sBAAc,MAAM,CAAC;AAGjH,eAAa,IAAI,YAAY,CAAC;AAC9B,eAAa,OAAO,WAAW;AAE/B,SAAO;;CAIT,MAAM,eAAe,wBACjB,OAAO,8BAA8B,WACnC,SAAS,cAAc,0BAA0B,GAChD,4BACH;CAIJ,IAAI,MAAM,mBADY,CAAC,CAAC,yBAAyB,CAAC,CAAC,gBAAgB,aAAa,SAAS,SAAS,EACvD;CAI3C,IAAI,aAAa;AAEjB,KAAI,sBACF,KAAI,cAAc;AAChB,MAAI,MAAM,aAAa;AACvB,eAAa;AACb,yBAAuB,SAAS;OAEhC,SAAQ,MAAM,oDAAoD,0BAA0B;CAQhG,MAAM,kBAAkB,IAAI,iBAAiB;CAC7C,MAAM,kBAA2C;EAC/C,SAAS;EACT,QAAQ,gBAAgB;EACzB;;;;;AAMD,UAAS,iBACP,kCACM;AACJ,UAAQ,KACN,8GACD;AACD,MAAI,CAAC,MAAM,cACT;EAIF,MAAM,iBACJ,OAAO,8BAA8B,WACjC,SAAS,cAAc,0BAA0B,GAChD;AAEP,MAAI,CAAC,eACH;AAIF,MAAI,kBAAkB,CAAC,SAAS,KAAK,SAAS,eAAe,CAC3D,UAAS,KAAK,YAAY,eAAe;AAI3C,MAAI,SAAS;AACb,QAAM,oBAAoB;AAC1B,MAAI,MAAM,eAAe;IAE3B,gBACD;;CAGD,MAAM,gBAAgB;AACpB,kBAAgB,OAAO;AACvB,QAAM,gBAAgB,EAAE;AACxB,MAAI,SAAS;AAEb,MAAI,YAAY;AACd,gBAAa;AACb,2BAAwB,SAAS;;;;;;;AAQrC,UAAS,iBACP,mCACM;AACJ,UAAQ,KAAK,kGAAkG;AAC/G,WAAS;IAEX,gBACD;;;;;AAMD,UAAS,iBACP,oCACC,OAAO;AACN,UAAQ,KACN,oHACD;AACD,MAAI,YAAY,GACd,QAAO,OAAO,OAAO,GAAG,OAAO;IAGnC,gBACD;AAWD,QATiB;EACf;EACA,wBAAwB,MAAM,iBAAiB,EAAE;EACjD,sBAAsB,cAA4C;AAChE,SAAM,gBAAgB;;EAExB;EACD"}
|
|
1
|
+
{"version":3,"file":"html-api.js","names":[],"sources":["../../../src/standalone/lib/html-api.ts"],"sourcesContent":["import { apiReferenceConfigurationWithSourceSchema } from '@scalar/schemas/api-reference'\nimport type {\n AnyApiReferenceConfiguration,\n ApiReferenceConfigurationWithSource,\n CreateApiReference,\n} from '@scalar/types/api-reference'\nimport { createHead } from '@unhead/vue/client'\nimport { createApp, createSSRApp, h, reactive } from 'vue'\n\nimport { default as ApiReference } from '@/components/ApiReference.vue'\nimport { hasPluginUrls, loadPluginsFromUrls } from '@/standalone/lib/load-plugins-from-urls'\n\nconst getSpecScriptTag = (doc: Document) => doc.getElementById('api-reference')\n\n/**\n * The id given to the standalone build's single injected `<style>` tag.\n * Keep in sync with `vite.standalone.config.ts` and `vite.standalone.esm.config.ts`.\n */\nconst STANDALONE_STYLE_ID = 'scalar-style'\n\n/**\n * Per-document bookkeeping for the standalone build's injected styles.\n *\n * The CDN build injects all of its CSS into one `<style>` tag in `<head>`. Under\n * SPA-style navigation (Turbo Drive, htmx boost, Astro view transitions) the host\n * swaps the DOM without reloading the window, so those document-level styles\n * (`@layer scalar-base`, the `:root` theme variables) would otherwise linger and\n * bleed into the host app's next page. We reference-count the live instances and\n * detach the styles when the last one is destroyed, re-attaching them when a new\n * instance mounts so navigating back to the reference is still styled.\n *\n * State is keyed by document so the counter survives navigations (the JS context\n * persists) while staying isolated per page.\n */\nconst standaloneStyleState = new WeakMap<Document, { count: number; detachedStyle: HTMLStyleElement | null }>()\n\nconst getStandaloneStyleState = (doc: Document): { count: number; detachedStyle: HTMLStyleElement | null } => {\n const existing = standaloneStyleState.get(doc)\n if (existing) {\n return existing\n }\n\n const state = { count: 0, detachedStyle: null }\n standaloneStyleState.set(doc, state)\n\n return state\n}\n\n/** Track a freshly mounted instance and restore previously detached styles. */\nconst retainStandaloneStyles = (doc: Document): void => {\n const state = getStandaloneStyleState(doc)\n state.count += 1\n\n if (state.detachedStyle && !doc.getElementById(STANDALONE_STYLE_ID)) {\n doc.head.appendChild(state.detachedStyle)\n state.detachedStyle = null\n }\n}\n\n/** Release an instance and detach the injected styles once the last one is gone. */\nconst releaseStandaloneStyles = (doc: Document): void => {\n const state = getStandaloneStyleState(doc)\n state.count = Math.max(0, state.count - 1)\n\n if (state.count > 0) {\n return\n }\n\n const styleElement = doc.getElementById(STANDALONE_STYLE_ID)\n if (styleElement instanceof HTMLStyleElement) {\n state.detachedStyle = styleElement\n styleElement.remove()\n }\n}\n\n/**\n * Reading the configuration from the data-attributes.\n */\nexport function getConfigurationFromDataAttributes(doc: Document): ApiReferenceConfigurationWithSource {\n const specElement = doc.querySelector('[data-spec]')\n const specUrlElement = doc.querySelector('[data-spec-url]')\n const configurationScriptElement = doc.querySelector('#api-reference[data-configuration]')\n\n const getConfiguration = () => {\n // <script data-configuration=\"{ … }\" />\n if (configurationScriptElement) {\n const configurationFromElement = configurationScriptElement.getAttribute('data-configuration')\n\n if (configurationFromElement) {\n return {\n _integration: 'html',\n ...JSON.parse(configurationFromElement.split('"').join('\"')),\n }\n }\n }\n\n return apiReferenceConfigurationWithSourceSchema({ _integration: 'html' })\n }\n\n const getUrl = () => {\n // Let's first check if the user passed a spec URL in the configuration.\n if (getConfiguration().url) {\n return getConfiguration().url\n }\n\n if (getConfiguration().spec?.url) {\n return getConfiguration().spec?.url\n }\n\n // <script id=\"api-reference\" data-url=\"/scalar.json\" />\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const urlFromScriptTag = specScriptTag.getAttribute('data-url')?.trim()\n\n if (urlFromScriptTag) {\n return urlFromScriptTag\n }\n }\n\n // <div data-spec-url=\"/scalar.json\" />\n if (specUrlElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec-url] HTML API is deprecated. Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead.',\n )\n const urlFromSpecUrlElement = specUrlElement.getAttribute('data-spec-url')\n\n if (urlFromSpecUrlElement) {\n return urlFromSpecUrlElement\n }\n }\n\n return undefined\n }\n\n const getContent = (): string | undefined => {\n // <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const specFromScriptTag = specScriptTag.innerHTML?.trim()\n\n if (specFromScriptTag) {\n return specFromScriptTag\n }\n }\n\n // <div data-spec='{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}' />\n if (specElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec] HTML API is deprecated. Use the new <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script> API instead.',\n )\n const specFromSpecElement = specElement.getAttribute('data-spec')?.trim()\n\n if (specFromSpecElement) {\n return specFromSpecElement\n }\n }\n\n return undefined\n }\n\n const getProxyUrl = () => {\n // <script id=\"api-reference\" data-proxy-url=\"https://proxy.scalar.com\">…</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const proxyUrl = specScriptTag.getAttribute('data-proxy-url')\n\n if (proxyUrl) {\n return proxyUrl.trim()\n }\n }\n\n return undefined\n }\n\n // Ensure Reference Props are reactive\n if (!specUrlElement && !specElement && !getSpecScriptTag(doc)) {\n // Stay quiet.\n } else {\n const urlOrContent = getContent() ? { content: getContent() } : { url: getUrl() }\n\n return apiReferenceConfigurationWithSourceSchema({\n _integration: 'html',\n proxyUrl: getProxyUrl(),\n ...getConfiguration(),\n ...urlOrContent,\n })\n }\n\n return apiReferenceConfigurationWithSourceSchema({ _integration: 'html' })\n}\n\n/**\n * Mount the Scalar API Reference on a given document.\n * Read the HTML data-attributes for configuration.\n */\nexport function findDataAttributes(doc: Document, configuration: ApiReferenceConfigurationWithSource) {\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specElement = doc.querySelector('[data-spec]')\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specUrlElement = doc.querySelector('[data-spec-url]')\n\n if (configuration?.darkMode) {\n doc.body?.classList.add('dark-mode')\n } else {\n doc.body?.classList.add('light-mode')\n }\n\n const container = createContainer(doc, specElement || specUrlElement)\n\n if (container) {\n createApiReference(container, configuration)\n }\n}\n\n// If it's a script tag, we can't mount the Vue.js app inside that tag.\n// We need to add a new container element before the script tag.\nexport const createContainer = (doc: Document, element?: Element | null) => {\n let _container: Element | null = null\n\n const specScriptTag = getSpecScriptTag(doc)\n\n if (specScriptTag) {\n _container = doc.createElement('div')\n specScriptTag?.parentNode?.insertBefore(_container, specScriptTag)\n } else if (element) {\n _container = element\n }\n\n return _container\n}\n\n/**\n * Create (and mount) a new Scalar API Reference\n *\n * @example createApiReference({ url: '/scalar.json' }).mount('#app')\n * @example createApiReference('#app', { url: '/scalar.json' })\n * @example createApiReference(document.getElementById('app'), { url: '/scalar.json' })\n */\nexport const createApiReference: CreateApiReference = (\n elementOrSelectorOrConfig,\n optionalConfiguration?: AnyApiReferenceConfiguration,\n) => {\n // Create an id prefix for useId so we don't have collisions with other Vue apps\n const idPrefix = 'scalar-refs'\n\n const props = reactive<{ configuration: AnyApiReferenceConfiguration }>({\n // Either the configuration will be the second argument or it MUST be the first (configuration only)\n configuration: optionalConfiguration ?? (elementOrSelectorOrConfig as AnyApiReferenceConfiguration) ?? {},\n })\n\n const createReferenceApp = (isSsr = false) => {\n const referenceApp = isSsr ? createSSRApp(() => h(ApiReference, props)) : createApp(() => h(ApiReference, props))\n\n // Meta tags, etc.\n referenceApp.use(createHead())\n referenceApp.config.idPrefix = idPrefix\n\n return referenceApp\n }\n\n // If we have an optional config, then we must mount the element immediately (not sure why type is not narrowing)\n const mountElement = optionalConfiguration\n ? typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n : null\n\n // Detect server-rendered content and use createSSRApp for hydration\n const shouldHydrate = !!optionalConfiguration && !!mountElement && mountElement.children.length > 0\n let app = createReferenceApp(shouldHydrate)\n\n // Track whether this instance mounted so `destroy` only releases the shared\n // standalone styles for instances that actually retained them.\n let hasMounted = false\n\n if (optionalConfiguration) {\n if (mountElement) {\n const mount = () => {\n app.mount(mountElement)\n hasMounted = true\n retainStandaloneStyles(document)\n }\n\n if (hasPluginUrls(props.configuration)) {\n // Plugins referenced by URL must be resolved before the app mounts — plugin registration\n // happens once at first render and is not reactive, so a plugin that arrives later would\n // never be picked up.\n loadPluginsFromUrls(props.configuration).then(() => {\n // Skip mounting when the instance was destroyed while the plugins were loading.\n if (!abortController.signal.aborted) {\n mount()\n }\n })\n } else {\n mount()\n }\n } else {\n console.error('Could not find a mount point for API References:', elementOrSelectorOrConfig)\n }\n }\n\n // Tie the deprecated `document` listeners to an AbortController so `destroy`\n // can remove them all at once. Without this, every `createApiReference()`\n // call leaks three permanent listeners — visible during Astro view\n // transitions where each navigation creates a new instance.\n const abortController = new AbortController()\n const listenerOptions: AddEventListenerOptions = {\n capture: false,\n signal: abortController.signal,\n }\n\n /**\n * Reload the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:reload-references',\n () => {\n console.warn(\n 'scalar:reload-references event has been deprecated, please use the scalarInstance.app.mount method instead.',\n )\n if (!props.configuration) {\n return\n }\n\n // Snag the current element\n const currentElement =\n typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n\n if (!currentElement) {\n return\n }\n\n // Ensure we re-attach the element if it was unmounted\n if (currentElement && !document.body.contains(currentElement)) {\n document.body.appendChild(currentElement)\n }\n\n // Create a new Vue app instance\n app.unmount()\n app = createReferenceApp()\n app.mount(currentElement)\n },\n listenerOptions,\n )\n\n /** Destroy the current API Reference instance */\n const destroy = () => {\n abortController.abort()\n props.configuration = {}\n\n // Only unmount an app that actually mounted. With `pluginUrls`, mounting is deferred until the\n // plugin modules resolve, so `destroy` can run first — unmounting then would just warn.\n if (hasMounted) {\n hasMounted = false\n app.unmount()\n releaseStandaloneStyles(document)\n }\n }\n\n /**\n * Allow user to destroy the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:destroy-references',\n () => {\n console.warn('scalar:destroy-references event has been deprecated, please use scalarInstance.destroy instead.')\n destroy()\n },\n listenerOptions,\n )\n\n /**\n * Allow user to update configuration\n * @deprecated\n */\n document.addEventListener(\n 'scalar:update-references-config',\n (ev) => {\n console.warn(\n 'scalar:update-references-config event has been deprecated, please use scalarInstance.updateConfiguration instead.',\n )\n if ('detail' in ev) {\n Object.assign(props, ev.detail)\n }\n },\n listenerOptions,\n )\n\n const instance = {\n app,\n getConfiguration: () => props.configuration ?? {},\n updateConfiguration: (newConfig: AnyApiReferenceConfiguration) => {\n props.configuration = newConfig\n },\n destroy,\n }\n\n return instance\n}\n"],"mappings":"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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AnyApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
2
|
+
/** Whether any of the passed configurations reference a plugin by URL */
|
|
3
|
+
export declare const hasPluginUrls: (configuration: AnyApiReferenceConfiguration) => boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Resolve the `pluginUrls` of all passed configurations and append the loaded plugins to the
|
|
6
|
+
* respective configuration's `plugins`.
|
|
7
|
+
*
|
|
8
|
+
* Plugin registration is not reactive — plugins are read once when the API reference renders for
|
|
9
|
+
* the first time — so this must complete before the app is mounted. Each URL is imported only
|
|
10
|
+
* once, even when multiple configurations reference it.
|
|
11
|
+
*/
|
|
12
|
+
export declare const loadPluginsFromUrls: (configuration: AnyApiReferenceConfiguration) => Promise<void>;
|
|
13
|
+
//# sourceMappingURL=load-plugins-from-urls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load-plugins-from-urls.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/load-plugins-from-urls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAsB,MAAM,6BAA6B,CAAA;AAwCnG,yEAAyE;AACzE,eAAO,MAAM,aAAa,GAAI,eAAe,4BAA4B,KAAG,OACW,CAAA;AAEvF;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAAU,eAAe,4BAA4B,KAAG,OAAO,CAAC,IAAI,CAuBnG,CAAA"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
//#region src/standalone/lib/load-plugins-from-urls.ts
|
|
2
|
+
/**
|
|
3
|
+
* Import a plugin module with a browser-native dynamic `import()`.
|
|
4
|
+
*
|
|
5
|
+
* The specifier is fully dynamic, so bundlers can't analyze it and leave the `import()` call
|
|
6
|
+
* as-is in the output (including the UMD standalone bundle) — the `@vite-ignore` comment just
|
|
7
|
+
* silences the warning about that.
|
|
8
|
+
*/
|
|
9
|
+
var importModule = (url) => import(
|
|
10
|
+
/* @vite-ignore */
|
|
11
|
+
url
|
|
12
|
+
);
|
|
13
|
+
/**
|
|
14
|
+
* Load a single plugin module and return its default export.
|
|
15
|
+
*
|
|
16
|
+
* Failures (network errors, modules without a function default export) are logged and swallowed
|
|
17
|
+
* so a broken plugin URL never prevents the API reference itself from mounting.
|
|
18
|
+
*/
|
|
19
|
+
var loadPluginFromUrl = async (url) => {
|
|
20
|
+
try {
|
|
21
|
+
const plugin = (await importModule(url))?.default;
|
|
22
|
+
if (typeof plugin !== "function") {
|
|
23
|
+
console.error(`[@scalar/api-reference] The module at ${url} does not export an API Reference plugin as its default export.`);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
return plugin;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
console.error(`[@scalar/api-reference] Failed to load the plugin module at ${url}:`, error);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
/** Normalize the configuration input to a list of configuration objects */
|
|
33
|
+
var getConfigurations = (configuration) => Array.isArray(configuration) ? configuration : [configuration];
|
|
34
|
+
/** Whether any of the passed configurations reference a plugin by URL */
|
|
35
|
+
var hasPluginUrls = (configuration) => getConfigurations(configuration).some((config) => Boolean(config.pluginUrls?.length));
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the `pluginUrls` of all passed configurations and append the loaded plugins to the
|
|
38
|
+
* respective configuration's `plugins`.
|
|
39
|
+
*
|
|
40
|
+
* Plugin registration is not reactive — plugins are read once when the API reference renders for
|
|
41
|
+
* the first time — so this must complete before the app is mounted. Each URL is imported only
|
|
42
|
+
* once, even when multiple configurations reference it.
|
|
43
|
+
*/
|
|
44
|
+
var loadPluginsFromUrls = async (configuration) => {
|
|
45
|
+
const pendingImports = /* @__PURE__ */ new Map();
|
|
46
|
+
const importOnce = (url) => {
|
|
47
|
+
const pending = pendingImports.get(url) ?? loadPluginFromUrl(url);
|
|
48
|
+
pendingImports.set(url, pending);
|
|
49
|
+
return pending;
|
|
50
|
+
};
|
|
51
|
+
await Promise.all(getConfigurations(configuration).map(async (config) => {
|
|
52
|
+
if (!config.pluginUrls?.length) return;
|
|
53
|
+
const plugins = (await Promise.all(config.pluginUrls.map(importOnce))).filter((plugin) => plugin !== void 0);
|
|
54
|
+
if (plugins.length) config.plugins = [...config.plugins ?? [], ...plugins];
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
//#endregion
|
|
58
|
+
export { hasPluginUrls, loadPluginsFromUrls };
|
|
59
|
+
|
|
60
|
+
//# sourceMappingURL=load-plugins-from-urls.js.map
|