@scalar/api-reference 1.57.5 → 1.59.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +112 -0
- package/dist/blocks/index.d.ts +1 -0
- package/dist/blocks/index.d.ts.map +1 -1
- package/dist/blocks/index.js +2 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.d.ts +24 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.d.ts.map +1 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.js +7 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.js.map +1 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.script.js +80 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.script.js.map +1 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.d.ts +25 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.d.ts.map +1 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.js +7 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.js.map +1 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.script.js +76 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.script.js.map +1 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/index.d.ts +2 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/index.d.ts.map +1 -0
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts +2 -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.map +1 -1
- package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts +2 -6
- 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 +26 -36
- 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.d.ts +1 -1
- package/dist/blocks/scalar-client-selector-block/helpers/featured-clients.d.ts.map +1 -1
- package/dist/blocks/scalar-client-selector-block/helpers/featured-clients.js.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.d.ts +9 -0
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.d.ts.map +1 -0
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.js +9 -0
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.js.map +1 -0
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.script.js +225 -0
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.script.js.map +1 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/language-icon.d.ts +4 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/language-icon.d.ts.map +1 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/language-icon.js +59 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/language-icon.js.map +1 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/renderable-sdks.d.ts +19 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/renderable-sdks.d.ts.map +1 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/renderable-sdks.js +19 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/renderable-sdks.js.map +1 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/visible-tab-count.d.ts +16 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/visible-tab-count.d.ts.map +1 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/visible-tab-count.js +29 -0
- package/dist/blocks/scalar-sdk-installation-instructions/helpers/visible-tab-count.js.map +1 -0
- package/dist/blocks/scalar-sdk-installation-instructions/index.d.ts +3 -0
- package/dist/blocks/scalar-sdk-installation-instructions/index.d.ts.map +1 -0
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.script.js +1 -1
- package/dist/browser/chunks/AgentScalarChatInterface-BXB1nZKJ.js +27 -0
- package/dist/browser/chunks/ScalarTextInput.vue-XkIzhvc0.js +27 -0
- package/dist/browser/chunks/basic-shape-diamond.svg-BTEOT1FL.js +15 -0
- package/dist/browser/chunks/basic-shape-hexagon.svg-BSPzaCgF.js +15 -0
- package/dist/browser/chunks/basic-shape-primary-circle-ellipse-round.svg-DKmZ8UUU.js +15 -0
- package/dist/browser/chunks/basic-shape-primary-square-rectangle.svg-n2YRykHD.js +15 -0
- package/dist/browser/chunks/basic-shape-shield.svg-Bec9cJDA.js +15 -0
- package/dist/browser/chunks/browser-67K6wmG9.js +129 -0
- package/dist/browser/chunks/computer-device-desktop-monitor.svg-m6j893Hb.js +15 -0
- package/dist/browser/chunks/computer-device-desktop.svg-Dk1VVO7k.js +15 -0
- package/dist/browser/chunks/computer-device-laptop.svg-BNGVUCYS.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung-back.svg-CC4UUTFw.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung.svg-D8ExpMpL.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x-back.svg-CLm7sgMM.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x.svg-Xrttg6_7.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-tablet-touch.svg-DQ2oTvOG.js +15 -0
- package/dist/browser/chunks/computer-device-mobile-tablet.svg-DCr0XlRc.js +15 -0
- package/dist/browser/chunks/computer-device-network-ethernet-cat6.svg-AK9l0iOl.js +15 -0
- package/dist/browser/chunks/computer-device-network-lan-www.svg-gUIdFBlE.js +15 -0
- package/dist/browser/chunks/computer-device-network-wifi-connection.svg-Be-EMm4e.js +15 -0
- package/dist/browser/chunks/computer-device-network-wifi-router.svg-Dc2VzyqK.js +15 -0
- package/dist/browser/chunks/ecology-science-erlenmeyer-flask.svg-DHgy7Jfd.js +15 -0
- package/dist/browser/chunks/image-flash-lightning.svg-EETR_y1q.js +15 -0
- package/dist/browser/chunks/image-picture-flower.svg-DN1AYzJU.js +15 -0
- package/dist/browser/chunks/interface-alert-exclamation-diamond.svg-C5NozMV_.js +15 -0
- package/dist/browser/chunks/interface-alert-exclamation-triangle-warning.svg-DaAg2fF5.js +15 -0
- package/dist/browser/chunks/interface-alert-information-circle.svg-ckkkt9Mv.js +15 -0
- package/dist/browser/chunks/interface-award-crown.svg-pjvn9hY-.js +15 -0
- package/dist/browser/chunks/interface-bookmark-tag.svg-r2r-lQq4.js +15 -0
- package/dist/browser/chunks/interface-bookmark.svg-BK9HKQBT.js +15 -0
- package/dist/browser/chunks/interface-calendar-date-one.svg-DNnF0M1I.js +15 -0
- package/dist/browser/chunks/interface-content-book-open-pages.svg-CQj_w9Vp.js +15 -0
- package/dist/browser/chunks/interface-content-book-page.svg-DppoeJRe.js +15 -0
- package/dist/browser/chunks/interface-content-file.svg-CvcD7OiY.js +15 -0
- package/dist/browser/chunks/interface-content-folder.svg-BmtS5I9A.js +15 -0
- package/dist/browser/chunks/interface-copy-clipboard.svg-Be6EI50X.js +15 -0
- package/dist/browser/chunks/interface-edit-attachment.svg-G5TKzpWX.js +15 -0
- package/dist/browser/chunks/interface-edit-binocular.svg-jzL-DvGB.js +15 -0
- package/dist/browser/chunks/interface-edit-magic-wand.svg-BOTlymvp.js +15 -0
- package/dist/browser/chunks/interface-edit-tool-paint-roller.svg-s9dwryx7.js +15 -0
- package/dist/browser/chunks/interface-edit-tool-pencil.svg-C7v0dbB3.js +15 -0
- package/dist/browser/chunks/interface-favorite-award.svg-CYHUgUG0.js +15 -0
- package/dist/browser/chunks/interface-favorite-flag.svg-C10zlKOb.js +15 -0
- package/dist/browser/chunks/interface-favorite-heart.svg-eoduXxlz.js +15 -0
- package/dist/browser/chunks/interface-favorite-star.svg-BSmxJetr.js +15 -0
- package/dist/browser/chunks/interface-favorite-stars-sparkles.svg-JTFLj3Ls.js +15 -0
- package/dist/browser/chunks/interface-hierarchy-flowchart.svg-Cg_Wy0kN.js +15 -0
- package/dist/browser/chunks/interface-home-house.svg-DytoGRnv.js +15 -0
- package/dist/browser/chunks/interface-hyperlink.svg-CuEfmmQI.js +15 -0
- package/dist/browser/chunks/interface-lighting-brightness.svg-DSK0h_Pa.js +15 -0
- package/dist/browser/chunks/interface-lock-closed.svg-Cn6TaLYv.js +15 -0
- package/dist/browser/chunks/interface-lock-open-unlock.svg-CVkG5-9W.js +15 -0
- package/dist/browser/chunks/interface-login-key.svg-y-cwwXjN.js +15 -0
- package/dist/browser/chunks/interface-search.svg-S-puVFJB.js +15 -0
- package/dist/browser/chunks/interface-setting-cog.svg-CTH4_lLg.js +15 -0
- package/dist/browser/chunks/interface-share-megaphone-bullhorn.svg-Pbp39MyC.js +15 -0
- package/dist/browser/chunks/interface-share-rocket.svg-BgCsIRZO.js +15 -0
- package/dist/browser/chunks/interface-share-satellite.svg-DAMN9d5G.js +15 -0
- package/dist/browser/chunks/interface-share-space-ship.svg-Dt-Mejxk.js +15 -0
- package/dist/browser/chunks/interface-share.svg-vFYTXSti.js +15 -0
- package/dist/browser/chunks/interface-signal-square.svg-DNG4LpAe.js +15 -0
- package/dist/browser/chunks/interface-time-clock-circle.svg-Bpz-nLxo.js +15 -0
- package/dist/browser/chunks/interface-time-hour-glass.svg-D7agfKsH.js +15 -0
- package/dist/browser/chunks/interface-users-multiple.svg-CkPJBBnG.js +15 -0
- package/dist/browser/chunks/interface-weather-moon.svg-CaTZFMPO.js +15 -0
- package/dist/browser/chunks/mail-chat-bubble-square.svg-DC8RIihp.js +15 -0
- package/dist/browser/chunks/mail-send-email-paper-airplane.svg-D8OLs9jz.js +15 -0
- package/dist/browser/chunks/mail-send-envelope.svg-CV33h5Sx.js +15 -0
- package/dist/browser/chunks/modal-Bp9V4D2s.js +66 -0
- package/dist/browser/chunks/modal-CtAiwzwH.js +15 -0
- package/dist/browser/chunks/money-cashier-receipt.svg-CJL8C2gs.js +15 -0
- package/dist/browser/chunks/money-currency-dollar-pay.svg-VdBplCTx.js +15 -0
- package/dist/browser/chunks/money-graph-arrow-increase.svg-DcRov3zk.js +15 -0
- package/dist/browser/chunks/money-graph-bar-chart-increase.svg-Cc7KxjX-.js +15 -0
- package/dist/browser/chunks/nature-ecology-leaf.svg-DR3cTZxt.js +15 -0
- package/dist/browser/chunks/phone-telephone.svg-DyY0gUlk.js +15 -0
- package/dist/browser/chunks/programming-bug.svg-BHLT-Qhp.js +15 -0
- package/dist/browser/chunks/programming-cloud.svg-B6YW33ba.js +15 -0
- package/dist/browser/chunks/programming-computer-database-server.svg-B6o5Sdn-.js +15 -0
- package/dist/browser/chunks/programming-computer-database.svg-Cl7OVtpJ.js +15 -0
- package/dist/browser/chunks/programming-module-four-layout.svg-BQrerL1x.js +15 -0
- package/dist/browser/chunks/programming-module-three.svg-B2KTQzBM.js +15 -0
- package/dist/browser/chunks/programming-module.svg-CiID7kPm.js +15 -0
- package/dist/browser/chunks/programming-script-code.svg-D1M5rtkN.js +15 -0
- package/dist/browser/chunks/runtime-core.esm-bundler-Byrbbu5Q.js +17 -0
- package/dist/browser/chunks/shopping-cart.svg-BEegiIR9.js +15 -0
- package/dist/browser/chunks/shopping-gift-present.svg-BUHwuLix.js +15 -0
- package/dist/browser/chunks/shopping-shipping-box-parcel-package.svg-D6fxWdYx.js +15 -0
- package/dist/browser/chunks/tag-new-circle.svg-jsg1bGs0.js +15 -0
- package/dist/browser/chunks/travel-map-earth-globe.svg-ClbMiU-f.js +15 -0
- package/dist/browser/chunks/vendor-nugWm4eq.js +337 -0
- package/dist/browser/standalone.esm.js +1853 -0
- package/dist/browser/standalone.js +258 -255
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue.js.map +1 -1
- package/dist/components/ApiReference.vue.script.js +79 -28
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.d.ts +16 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.js +7 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.js.map +1 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js +166 -0
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js.map +1 -0
- package/dist/components/Content/AsyncApi/Channel.vue.d.ts +18 -0
- package/dist/components/Content/AsyncApi/Channel.vue.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/Channel.vue.js +9 -0
- package/dist/components/Content/AsyncApi/Channel.vue.js.map +1 -0
- package/dist/components/Content/AsyncApi/Channel.vue.script.js +148 -0
- package/dist/components/Content/AsyncApi/Channel.vue.script.js.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/adapt-async-api-parameters.d.ts +14 -0
- package/dist/components/Content/AsyncApi/helpers/adapt-async-api-parameters.d.ts.map +1 -0
- package/dist/components/Content/AsyncApi/helpers/adapt-async-api-parameters.js +34 -0
- package/dist/components/Content/AsyncApi/helpers/adapt-async-api-parameters.js.map +1 -0
- package/dist/components/Content/AsyncApi/index.d.ts +2 -0
- package/dist/components/Content/AsyncApi/index.d.ts.map +1 -0
- package/dist/components/Content/Auth/Auth.vue.d.ts +1 -1
- package/dist/components/Content/Auth/Auth.vue.d.ts.map +1 -1
- package/dist/components/Content/Auth/Auth.vue.js.map +1 -1
- package/dist/components/Content/Auth/Auth.vue.script.js +2 -0
- package/dist/components/Content/Auth/Auth.vue.script.js.map +1 -1
- package/dist/components/Content/Content.vue.d.ts +3 -3
- package/dist/components/Content/Content.vue.d.ts.map +1 -1
- package/dist/components/Content/Content.vue.js.map +1 -1
- package/dist/components/Content/Content.vue.script.js +69 -9
- package/dist/components/Content/Content.vue.script.js.map +1 -1
- package/dist/components/Content/Models/Model.vue.d.ts +4 -2
- package/dist/components/Content/Models/Model.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/Model.vue.js.map +1 -1
- package/dist/components/Content/Models/Model.vue.script.js +6 -1
- package/dist/components/Content/Models/Model.vue.script.js.map +1 -1
- package/dist/components/Content/Models/ModelTag.vue.d.ts +2 -0
- package/dist/components/Content/Models/ModelTag.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/ModelTag.vue.js.map +1 -1
- package/dist/components/Content/Models/ModelTag.vue.script.js +11 -12
- package/dist/components/Content/Models/ModelTag.vue.script.js.map +1 -1
- package/dist/components/Content/Models/components/ClassicLayout.vue.d.ts +4 -2
- 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.js.map +1 -1
- package/dist/components/Content/Models/components/ClassicLayout.vue.script.js +9 -2
- package/dist/components/Content/Models/components/ClassicLayout.vue.script.js.map +1 -1
- package/dist/components/Content/Models/components/ModernLayout.vue.d.ts +4 -1
- package/dist/components/Content/Models/components/ModernLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/components/ModernLayout.vue.js.map +1 -1
- package/dist/components/Content/Models/components/ModernLayout.vue.script.js +5 -1
- package/dist/components/Content/Models/components/ModernLayout.vue.script.js.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.js.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.script.js +11 -4
- package/dist/components/Content/Operations/TraversedEntry.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.d.ts +6 -0
- 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 +32 -7
- 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 +16 -3
- package/dist/components/Content/Schema/SchemaComposition.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectExampleCodeBlock.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js +11 -6
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +2 -0
- 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 +17 -2
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/helpers/get-compositions-to-render.d.ts +3 -2
- package/dist/components/Content/Schema/helpers/get-compositions-to-render.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/get-compositions-to-render.js +26 -1
- package/dist/components/Content/Schema/helpers/get-compositions-to-render.js.map +1 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.d.ts +2 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.d.ts.map +1 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +40 -25
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js.map +1 -1
- package/dist/components/Content/Schema/helpers/schema-cycle.d.ts +31 -0
- package/dist/components/Content/Schema/helpers/schema-cycle.d.ts.map +1 -0
- package/dist/components/Content/Schema/helpers/schema-cycle.js +39 -0
- package/dist/components/Content/Schema/helpers/schema-cycle.js.map +1 -0
- package/dist/components/Content/Schema/types.d.ts +10 -0
- package/dist/components/Content/Schema/types.d.ts.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/features/Operation/Operation.vue.d.ts +1 -1
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js.map +1 -1
- package/dist/features/Operation/Operation.vue.script.js +4 -0
- package/dist/features/Operation/Operation.vue.script.js.map +1 -1
- package/dist/features/Operation/components/ContentTypeSelect.vue.script.js +1 -1
- package/dist/features/Operation/components/Header.vue.d.ts +4 -1
- package/dist/features/Operation/components/Header.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/Header.vue.js.map +1 -1
- package/dist/features/Operation/components/Header.vue.script.js +6 -2
- package/dist/features/Operation/components/Header.vue.script.js.map +1 -1
- package/dist/features/Operation/components/Headers.vue.d.ts +4 -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.js.map +1 -1
- package/dist/features/Operation/components/Headers.vue.script.js +10 -4
- package/dist/features/Operation/components/Headers.vue.script.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.d.ts +4 -2
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.script.js +12 -1
- package/dist/features/Operation/components/OperationParameters.vue.script.js.map +1 -1
- package/dist/features/Operation/components/OperationResponses.vue.d.ts +4 -2
- package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationResponses.vue.js.map +1 -1
- package/dist/features/Operation/components/OperationResponses.vue.script.js +3 -0
- package/dist/features/Operation/components/OperationResponses.vue.script.js.map +1 -1
- package/dist/features/Operation/components/ParameterList.vue.d.ts +4 -2
- package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterList.vue.js.map +1 -1
- package/dist/features/Operation/components/ParameterList.vue.script.js +3 -0
- package/dist/features/Operation/components/ParameterList.vue.script.js.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts +4 -2
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.script.js +8 -1
- package/dist/features/Operation/components/ParameterListItem.vue.script.js.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.d.ts +4 -1
- package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.script.js +10 -3
- package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +4 -2
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.js +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.js.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.script.js +5 -0
- package/dist/features/Operation/components/callbacks/Callback.vue.script.js.map +1 -1
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +4 -2
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callbacks.vue.js.map +1 -1
- package/dist/features/Operation/components/callbacks/Callbacks.vue.script.js +3 -0
- package/dist/features/Operation/components/callbacks/Callbacks.vue.script.js.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +3 -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 +8 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +3 -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 +170 -176
- package/dist/features/Operation/layouts/ModernLayout.vue.script.js.map +1 -1
- package/dist/features/Search/components/SearchButton.vue.d.ts +4 -1
- package/dist/features/Search/components/SearchButton.vue.d.ts.map +1 -1
- package/dist/features/Search/components/SearchButton.vue.js.map +1 -1
- package/dist/features/Search/components/SearchButton.vue.script.js +20 -9
- package/dist/features/Search/components/SearchButton.vue.script.js.map +1 -1
- package/dist/features/Search/components/SearchModal.vue.d.ts +4 -1
- package/dist/features/Search/components/SearchModal.vue.d.ts.map +1 -1
- package/dist/features/Search/components/SearchModal.vue.js +1 -1
- package/dist/features/Search/components/SearchModal.vue.js.map +1 -1
- package/dist/features/Search/components/SearchModal.vue.script.js +7 -5
- package/dist/features/Search/components/SearchModal.vue.script.js.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.d.ts +2 -0
- package/dist/features/Search/components/SearchResult.vue.d.ts.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.js.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.script.js +8 -6
- package/dist/features/Search/components/SearchResult.vue.script.js.map +1 -1
- package/dist/features/Search/helpers/create-search-index.d.ts +9 -1
- package/dist/features/Search/helpers/create-search-index.d.ts.map +1 -1
- package/dist/features/Search/helpers/create-search-index.js +27 -8
- package/dist/features/Search/helpers/create-search-index.js.map +1 -1
- package/dist/features/Search/hooks/useSearchIndex.d.ts +4 -2
- package/dist/features/Search/hooks/useSearchIndex.d.ts.map +1 -1
- package/dist/features/Search/hooks/useSearchIndex.js +4 -3
- package/dist/features/Search/hooks/useSearchIndex.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.d.ts +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.script.js +11 -9
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigTheme.vue.script.js +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.script.js +9 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.js.map +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.script.js +6 -7
- package/dist/features/example-responses/ExampleResponse.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.script.js +1 -1
- package/dist/features/example-responses/ExampleSchema.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleSchema.vue.js.map +1 -1
- package/dist/features/example-responses/ExampleSchema.vue.script.js +6 -7
- package/dist/features/example-responses/ExampleSchema.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 +15 -4
- package/dist/features/info-object/Contact.vue.script.js.map +1 -1
- package/dist/helpers/get-async-api-model-schema.d.ts +15 -0
- package/dist/helpers/get-async-api-model-schema.d.ts.map +1 -0
- package/dist/helpers/get-async-api-model-schema.js +32 -0
- package/dist/helpers/get-async-api-model-schema.js.map +1 -0
- package/dist/helpers/id-routing.d.ts +18 -0
- package/dist/helpers/id-routing.d.ts.map +1 -1
- package/dist/helpers/id-routing.js +41 -1
- package/dist/helpers/id-routing.js.map +1 -1
- package/dist/helpers/load-from-perssistance.d.ts +2 -1
- package/dist/helpers/load-from-perssistance.d.ts.map +1 -1
- package/dist/helpers/load-from-perssistance.js +4 -3
- package/dist/helpers/load-from-perssistance.js.map +1 -1
- package/dist/plugins/index.d.ts +1 -1
- package/dist/plugins/index.js +1 -1
- package/dist/plugins/{persistance-plugin.d.ts → persistence-plugin.d.ts} +2 -8
- package/dist/plugins/persistence-plugin.d.ts.map +1 -0
- package/dist/plugins/{persistance-plugin.js → persistence-plugin.js} +4 -13
- package/dist/plugins/persistence-plugin.js.map +1 -0
- package/dist/standalone/lib/html-api.d.ts.map +1 -1
- package/dist/standalone/lib/html-api.js +60 -2
- package/dist/standalone/lib/html-api.js.map +1 -1
- package/dist/standalone.esm.d.ts +4 -0
- package/dist/standalone.esm.d.ts.map +1 -0
- package/dist/style.css +665 -470
- package/dist/vue-styles.css +661 -463
- package/package.json +21 -19
- package/dist/browser/webpack-stats.json +0 -1
- package/dist/plugins/persistance-plugin.d.ts.map +0 -1
- package/dist/plugins/persistance-plugin.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,117 @@
|
|
|
1
1
|
# @scalar/api-reference
|
|
2
2
|
|
|
3
|
+
## 1.59.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#9435](https://github.com/scalar/scalar/pull/9435): feat(api-reference): render AsyncAPI channel parameters
|
|
8
|
+
|
|
9
|
+
Channel address parameters (the `{param}` placeholders in a channel address) are now shown in the API reference, reusing the same parameter list component as OpenAPI operations. Their `enum`, `default`, and `examples` are displayed on a string schema.
|
|
10
|
+
|
|
11
|
+
- [#9438](https://github.com/scalar/scalar/pull/9438): feat(api-reference): add an AsyncAPI server selector
|
|
12
|
+
|
|
13
|
+
Adds a server selector for AsyncAPI documents in the API reference introduction. It mirrors the OpenAPI server selector but works with the AsyncAPI server shape (a named map of `host`/`protocol`/`pathname`), labelling each server with its constructed connection URL.
|
|
14
|
+
|
|
15
|
+
Server selection and variable changes are now persisted to the workspace store via new `asyncapi-server:update:selected` and `asyncapi-server:update:variables` events and their mutators, mirroring the OpenAPI wiring.
|
|
16
|
+
|
|
17
|
+
- [#9422](https://github.com/scalar/scalar/pull/9422): Add a `nonce` option for Content Security Policy support.
|
|
18
|
+
|
|
19
|
+
When you pass a `nonce`, the rendered HTML stamps it onto the inline `<script>` and the CDN `<script>` tag (and Scalar's own `<style>` tags, plus a matching `<meta property="csp-nonce">`). This lets the API Reference run under a strict `script-src` with no `unsafe-inline` and no `unsafe-eval`.
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
ApiReference({
|
|
23
|
+
url: '/openapi.json',
|
|
24
|
+
// Match this value in your `script-src` CSP directive.
|
|
25
|
+
nonce: 'r4nd0m',
|
|
26
|
+
})
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Note: `style-src` still needs `'unsafe-inline'`. The reference renders inline `style="…"` attributes, which a CSP nonce can never authorize (nonces only apply to `<script>`, `<style>` and `<link>` elements), so a nonce-only `style-src` is not possible. The win is a fully strict `script-src`.
|
|
30
|
+
|
|
31
|
+
- [#9400](https://github.com/scalar/scalar/pull/9400): feat(api-reference): add `expandAllSchemaProperties` config option.
|
|
32
|
+
|
|
33
|
+
When enabled, nested schema properties are expanded by default while keeping the
|
|
34
|
+
"Show/Hide Child Attributes" button available for manual collapsing. Expansion
|
|
35
|
+
is cycle-safe: every finite branch is expanded fully, and self-referential
|
|
36
|
+
($ref or inline) schemas stop at the point they would otherwise recurse forever.
|
|
37
|
+
|
|
38
|
+
- [#9399](https://github.com/scalar/scalar/pull/9399): Show custom SDK installation instructions from `x-scalar-sdk-installation` in the introduction card, falling back to the client selector when there are none. Each entry takes a `lang` and a Markdown `description`, so a single tab can render rich instructions with syntax-highlighted code blocks (for example Maven and Gradle for Java)
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- [#9388](https://github.com/scalar/scalar/pull/9388): Add `ScalarVirtualCodeBlock` component with copy button support for virtualized code blocks
|
|
43
|
+
- [#9436](https://github.com/scalar/scalar/pull/9436): Hide the client selector for AsyncAPI documents
|
|
44
|
+
- [#9398](https://github.com/scalar/scalar/pull/9398): feat: read code samples from x-readme, x-stainless and x-scalar extensions
|
|
45
|
+
|
|
46
|
+
In addition to `x-codeSamples`, the code sample picker now reads custom samples from `x-scalar-examples`, `x-stainless-snippets`, `x-stainless-examples`, and `x-readme.code-samples`. When more than one is present on an operation, the highest-priority source is used (x-scalar-examples > x-stainless-snippets > x-stainless-examples > x-readme > x-codeSamples).
|
|
47
|
+
|
|
48
|
+
- [#9426](https://github.com/scalar/scalar/pull/9426): feat(api-reference): render the contact URL from `info.contact.url`
|
|
49
|
+
- [#8573](https://github.com/scalar/scalar/pull/8573): fix(api-reference): infer discriminator variants from mapping
|
|
50
|
+
- [#9131](https://github.com/scalar/scalar/pull/9131): fix(api-reference): preserve OAuth redirect URI when switching OpenAPI documents
|
|
51
|
+
|
|
52
|
+
When using multiple OpenAPI documents with OAuth configured via `oauth2RedirectUri`,
|
|
53
|
+
switching to another document no longer clears the Redirect URL in the Authentication
|
|
54
|
+
section.
|
|
55
|
+
|
|
56
|
+
The fix threads `oauth2RedirectUri` from the top-level configuration into the security
|
|
57
|
+
scheme merge chain so that each newly loaded document's OAuth flows are pre-populated
|
|
58
|
+
with the configured redirect URI, rather than relying solely on a component-level watcher
|
|
59
|
+
that would skip re-population when the same OAuth flow identity was detected across
|
|
60
|
+
documents.
|
|
61
|
+
|
|
62
|
+
- [#9391](https://github.com/scalar/scalar/pull/9391): fix: stabilize the tab title at the top of the document
|
|
63
|
+
|
|
64
|
+
The document-start sentinel and the Introduction section both fire an intersection event at scroll-top. They resolved to different entries, so the tab title raced between the section title and the document title. The sentinel now emits the Introduction entry, so both agree.
|
|
65
|
+
|
|
66
|
+
- [#9370](https://github.com/scalar/scalar/pull/9370): fix(api-reference): rework the modern operation layout with CSS grid so the request example sits directly under the description on narrow screens, and move the operation title and auth badge into the same grid
|
|
67
|
+
- [#9421](https://github.com/scalar/scalar/pull/9421): fix(api-reference): avoid SSR hydration mismatch from the search shortcut and teleport ids
|
|
68
|
+
|
|
69
|
+
The macOS search shortcut symbol was derived from `navigator` during render, so a Mac client hydrated `⌘` where the server sent `⌃`. The platform is now resolved after mount. Teleport target ids and the search modal ids also switched from `nanoid()` to Vue's SSR-stable `useId()`.
|
|
70
|
+
|
|
71
|
+
- [#9392](https://github.com/scalar/scalar/pull/9392): Clean up the standalone build's injected `<head>` styles on `destroy()` so they no longer linger after SPA-style navigation (Turbo Drive, htmx). The styles are re-attached when a new instance mounts.
|
|
72
|
+
- [#9420](https://github.com/scalar/scalar/pull/9420): fix(api-reference): make x-tagGroups titles navigable from search
|
|
73
|
+
|
|
74
|
+
Tag group titles appeared as search results but clicking them did nothing,
|
|
75
|
+
because the flattened modern layout rendered no element carrying the tag
|
|
76
|
+
group id to scroll to. The group now exposes its id as a scroll anchor.
|
|
77
|
+
|
|
78
|
+
## 1.58.0
|
|
79
|
+
|
|
80
|
+
### Minor Changes
|
|
81
|
+
|
|
82
|
+
- [#9372](https://github.com/scalar/scalar/pull/9372): Render AsyncAPI `components.schemas` as Models, listed in the sidebar and content just like OpenAPI schemas
|
|
83
|
+
- [#7618](https://github.com/scalar/scalar/pull/7618): feat(api-reference): add `setPageTitle` to customize the browser tab title
|
|
84
|
+
|
|
85
|
+
Pass a `setPageTitle` function to control the browser tab title. It is called whenever the section in view changes — on sidebar clicks, on scroll, and when switching documents — and receives the section title and the active OpenAPI document:
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
setPageTitle: ({ title, document }) => `${document.title} – ${title}`
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Patch Changes
|
|
92
|
+
|
|
93
|
+
- [#9348](https://github.com/scalar/scalar/pull/9348): Render AsyncAPI channels as sections in the content area, with the channel address as the heading and the channel description below. Channels are grouped under tags when the navigation tree groups them. Operations and messages are not rendered yet.
|
|
94
|
+
- [#9255](https://github.com/scalar/scalar/pull/9255): Surface the Introduction entry and any headings extracted from `info.description` of AsyncAPI documents in the sidebar, mirroring how OpenAPI documents are handled.
|
|
95
|
+
- [#9347](https://github.com/scalar/scalar/pull/9347): Surface AsyncAPI `info.description` headings in the search modal, mirroring the sidebar behaviour. AsyncAPI channels, operations, and messages are not indexed yet.
|
|
96
|
+
- [#9350](https://github.com/scalar/scalar/pull/9350): feat(api-reference): list Ask AI and MCP Servers as Scalar Docs features in the Deploy popover
|
|
97
|
+
- [#9310](https://github.com/scalar/scalar/pull/9310): Add an ESM standalone build (`dist/browser/standalone.esm.js`) alongside the existing UMD bundle. The new bundle works as a side-effect script (registers `window.Scalar.createApiReference` and reads `data-*` configuration) and exports `createApiReference` for direct ESM consumers. It is fully minified through Rolldown's native minifier and uses code splitting so heavy features load asynchronously after first paint:
|
|
98
|
+
- The API client modal (request editor, response viewer, CodeMirror) is now `await import`'d inside `onMounted` instead of statically imported, moving ~265 KB into a `chunks/modal-*.js` chunk that loads in the background.
|
|
99
|
+
- The Agent Scalar chat interface (already wrapped in `defineAsyncComponent`) becomes a real `chunks/AgentScalarChatInterface-*.js` chunk (~200 KB), loaded only when the agent is enabled.
|
|
100
|
+
- The 84 per-icon dynamic imports from `@scalar/icons/library` are coalesced into a single `chunks/icons-*.js`.
|
|
101
|
+
|
|
102
|
+
Net effect: initial sync load drops from ~3.32 MB (UMD) to ~2.73 MB (ESM) — a ~570 KB improvement — while total bundle size shrinks by ~140 KB.
|
|
103
|
+
|
|
104
|
+
Also adds an `@scalar/api-client/modal/map-hidden-clients-config` deep export so consumers that only need the lightweight client-list helper don't pull the full modal barrel into their static graph.
|
|
105
|
+
|
|
106
|
+
- [#9139](https://github.com/scalar/scalar/pull/9139): fix(api-reference): preserve OAuth redirect URL when switching between OpenAPI documents
|
|
107
|
+
|
|
108
|
+
Auth changes were being persisted under the wrong document slug and shared a single debounce queue across all documents. When switching documents quickly, the pending save for the first document could be overwritten or dropped by a save for the second document, causing the redirect URL (and other auth secrets) to appear cleared after switching back.
|
|
109
|
+
|
|
110
|
+
The fix uses `event.documentName` as both the debounce key and the storage key, giving each document its own independent debounce queue.
|
|
111
|
+
|
|
112
|
+
- [#9194](https://github.com/scalar/scalar/pull/9194): fix(api-reference): break cycles in `mergeAllOfSchemas` for self-referencing schemas (whether they `$ref` back to themselves through array items or through a plain object property), which previously crashed the docs preview with "too much recursion"
|
|
113
|
+
- [#9309](https://github.com/scalar/scalar/pull/9309): feat: add `modelsSectionLabel` configuration (`'Models' | 'Schemas' | string`) to use OpenAPI-style Schemas terminology in the sidebar, content, and search.
|
|
114
|
+
|
|
3
115
|
## 1.57.5
|
|
4
116
|
|
|
5
117
|
### Patch Changes
|
package/dist/blocks/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { AsyncApiServerSelector } from './scalar-asyncapi-server-selector-block';
|
|
1
2
|
export { ClientSelector } from './scalar-client-selector-block';
|
|
2
3
|
export { InfoBlock, IntroductionCardItem } from './scalar-info-block';
|
|
3
4
|
export { ServerSelector } from './scalar-server-selector-block';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA"}
|
package/dist/blocks/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import AsyncApiServerSelector_default from "./scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.js";
|
|
1
2
|
import ClientSelector_default from "./scalar-client-selector-block/components/ClientSelector.vue.js";
|
|
2
3
|
import InfoBlock_default from "./scalar-info-block/components/InfoBlock.vue.js";
|
|
3
4
|
import IntroductionCardItem_default from "./scalar-info-block/components/IntroductionCardItem.vue.js";
|
|
4
5
|
import ServerSelector_default from "./scalar-server-selector-block/components/ServerSelector.vue.js";
|
|
5
|
-
export { ClientSelector_default as ClientSelector, InfoBlock_default as InfoBlock, IntroductionCardItem_default as IntroductionCardItem, ServerSelector_default as ServerSelector };
|
|
6
|
+
export { AsyncApiServerSelector_default as AsyncApiServerSelector, ClientSelector_default as ClientSelector, InfoBlock_default as InfoBlock, IntroductionCardItem_default as IntroductionCardItem, ServerSelector_default as ServerSelector };
|
package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example';
|
|
2
|
+
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
3
|
+
type SelectorProps = {
|
|
4
|
+
/** The event bus to use for emitting events */
|
|
5
|
+
eventBus: WorkspaceEventBus;
|
|
6
|
+
/** The currently selected server */
|
|
7
|
+
selectedServer: AsyncApiServerEntry | null;
|
|
8
|
+
/** Available servers */
|
|
9
|
+
servers: AsyncApiServerEntry[];
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* AsyncApiServerSelector
|
|
13
|
+
*
|
|
14
|
+
* Core component for rendering an AsyncAPI server selector block. It mirrors the
|
|
15
|
+
* OpenAPI ServerSelector, but works with the AsyncAPI server shape (a named map
|
|
16
|
+
* of `host`/`protocol`/`pathname` rather than an array of `url`).
|
|
17
|
+
*
|
|
18
|
+
* @event asyncapi-server:update:selected - Emitted when the selected server changes
|
|
19
|
+
* @event asyncapi-server:update:variables - Emitted when a server variable changes
|
|
20
|
+
*/
|
|
21
|
+
declare const _default: typeof __VLS_export;
|
|
22
|
+
export default _default;
|
|
23
|
+
declare const __VLS_export: import("vue").DefineComponent<SelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SelectorProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
24
|
+
//# sourceMappingURL=AsyncApiServerSelector.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncApiServerSelector.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue"],"names":[],"mappings":"AAmHA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAOvE,KAAK,aAAa,GAAG;IACnB,+CAA+C;IAC/C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,oCAAoC;IACpC,cAAc,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAC1C,wBAAwB;IACxB,OAAO,EAAE,mBAAmB,EAAE,CAAA;CAC/B,CAAA;AAED;;;;;;;;;GASG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY,sSAiKd,CAAC"}
|
package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import AsyncApiServerSelector_vue_vue_type_script_setup_true_lang_default from "./AsyncApiServerSelector.vue.script.js";
|
|
2
|
+
//#region src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue
|
|
3
|
+
var AsyncApiServerSelector_default = AsyncApiServerSelector_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { AsyncApiServerSelector_default as default };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=AsyncApiServerSelector.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncApiServerSelector.vue.js","names":[],"sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue"],"sourcesContent":["<script lang=\"ts\">\ntype SelectorProps = {\n /** The event bus to use for emitting events */\n eventBus: WorkspaceEventBus\n /** The currently selected server */\n selectedServer: AsyncApiServerEntry | null\n /** Available servers */\n servers: AsyncApiServerEntry[]\n}\n\n/**\n * AsyncApiServerSelector\n *\n * Core component for rendering an AsyncAPI server selector block. It mirrors the\n * OpenAPI ServerSelector, but works with the AsyncAPI server shape (a named map\n * of `host`/`protocol`/`pathname` rather than an array of `url`).\n *\n * @event asyncapi-server:update:selected - Emitted when the selected server changes\n * @event asyncapi-server:update:variables - Emitted when a server variable changes\n */\nexport default {}\n</script>\n\n<script lang=\"ts\" setup>\nimport { ServerVariablesForm } from '@scalar/api-client/components/Server'\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, useId } from 'vue'\n\nimport Selector from './Selector.vue'\n\nconst { eventBus, servers, selectedServer } = defineProps<SelectorProps>()\n\nconst id = useId()\n\n/**\n * Normalize AsyncAPI server variables into the shape the shared\n * ServerVariablesForm expects (resolving references and defaulting `default`).\n */\nconst serverVariables = computed(() => {\n const variables = selectedServer?.server.variables\n if (!variables) {\n return undefined\n }\n\n return Object.fromEntries(\n Object.entries(variables).map(([name, variable]) => {\n const resolved = getResolvedRef(variable)\n return [\n name,\n {\n default: resolved.default ?? '',\n enum: resolved.enum,\n description: resolved.description,\n },\n ]\n }),\n )\n})\n\n/** Update the selected server */\nconst updateServer = (name: string) => {\n eventBus.emit('asyncapi-server:update:selected', { name })\n}\n\n/** Update a server variable on the selected server */\nconst updateServerVariable = (key: string, value: string) => {\n if (!selectedServer) {\n return\n }\n\n eventBus.emit('asyncapi-server:update:variables', {\n name: selectedServer.name,\n key,\n value,\n })\n}\n</script>\n\n<template>\n <label\n class=\"bg-b-2 flex h-8 items-center rounded-t-xl border-x border-t px-3 py-2.5 font-medium\">\n Server\n </label>\n <div\n :id=\"id\"\n class=\"border\"\n :class=\"{\n 'rounded-b-xl': !selectedServer?.description && !serverVariables,\n }\">\n <Selector\n v-if=\"servers.length\"\n :selectedServer\n :servers=\"servers\"\n :target=\"id\"\n @update:modelValue=\"updateServer\" />\n </div>\n <ServerVariablesForm\n layout=\"reference\"\n :variables=\"serverVariables\"\n @update:variable=\"updateServerVariable\" />\n\n <!-- Description -->\n <ScalarMarkdown\n v-if=\"selectedServer?.description\"\n class=\"text-c-3 rounded-b-xl border-x border-b px-3 py-1.5\"\n :value=\"selectedServer.description\" />\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import Selector_default from "./Selector.vue.js";
|
|
2
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, unref, useId } from "vue";
|
|
3
|
+
import { ServerVariablesForm } from "@scalar/api-client/components/Server";
|
|
4
|
+
import { ScalarMarkdown } from "@scalar/components/markdown";
|
|
5
|
+
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
6
|
+
//#region src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
+
var _hoisted_1 = ["id"];
|
|
8
|
+
var AsyncApiServerSelector_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
9
|
+
__name: "AsyncApiServerSelector",
|
|
10
|
+
props: {
|
|
11
|
+
eventBus: {},
|
|
12
|
+
selectedServer: {},
|
|
13
|
+
servers: {}
|
|
14
|
+
},
|
|
15
|
+
setup(__props) {
|
|
16
|
+
const id = useId();
|
|
17
|
+
/**
|
|
18
|
+
* Normalize AsyncAPI server variables into the shape the shared
|
|
19
|
+
* ServerVariablesForm expects (resolving references and defaulting `default`).
|
|
20
|
+
*/
|
|
21
|
+
const serverVariables = computed(() => {
|
|
22
|
+
const variables = __props.selectedServer?.server.variables;
|
|
23
|
+
if (!variables) return;
|
|
24
|
+
return Object.fromEntries(Object.entries(variables).map(([name, variable]) => {
|
|
25
|
+
const resolved = getResolvedRef(variable);
|
|
26
|
+
return [name, {
|
|
27
|
+
default: resolved.default ?? "",
|
|
28
|
+
enum: resolved.enum,
|
|
29
|
+
description: resolved.description
|
|
30
|
+
}];
|
|
31
|
+
}));
|
|
32
|
+
});
|
|
33
|
+
/** Update the selected server */
|
|
34
|
+
const updateServer = (name) => {
|
|
35
|
+
__props.eventBus.emit("asyncapi-server:update:selected", { name });
|
|
36
|
+
};
|
|
37
|
+
/** Update a server variable on the selected server */
|
|
38
|
+
const updateServerVariable = (key, value) => {
|
|
39
|
+
if (!__props.selectedServer) return;
|
|
40
|
+
__props.eventBus.emit("asyncapi-server:update:variables", {
|
|
41
|
+
name: __props.selectedServer.name,
|
|
42
|
+
key,
|
|
43
|
+
value
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
return (_ctx, _cache) => {
|
|
47
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
48
|
+
_cache[0] || (_cache[0] = createElementVNode("label", { class: "bg-b-2 flex h-8 items-center rounded-t-xl border-x border-t px-3 py-2.5 font-medium" }, " Server ", -1)),
|
|
49
|
+
createElementVNode("div", {
|
|
50
|
+
id: unref(id),
|
|
51
|
+
class: normalizeClass(["border", { "rounded-b-xl": !__props.selectedServer?.description && !serverVariables.value }])
|
|
52
|
+
}, [__props.servers.length ? (openBlock(), createBlock(Selector_default, {
|
|
53
|
+
key: 0,
|
|
54
|
+
selectedServer: __props.selectedServer,
|
|
55
|
+
servers: __props.servers,
|
|
56
|
+
target: unref(id),
|
|
57
|
+
"onUpdate:modelValue": updateServer
|
|
58
|
+
}, null, 8, [
|
|
59
|
+
"selectedServer",
|
|
60
|
+
"servers",
|
|
61
|
+
"target"
|
|
62
|
+
])) : createCommentVNode("", true)], 10, _hoisted_1),
|
|
63
|
+
createVNode(unref(ServerVariablesForm), {
|
|
64
|
+
layout: "reference",
|
|
65
|
+
variables: serverVariables.value,
|
|
66
|
+
"onUpdate:variable": updateServerVariable
|
|
67
|
+
}, null, 8, ["variables"]),
|
|
68
|
+
__props.selectedServer?.description ? (openBlock(), createBlock(unref(ScalarMarkdown), {
|
|
69
|
+
key: 0,
|
|
70
|
+
class: "text-c-3 rounded-b-xl border-x border-b px-3 py-1.5",
|
|
71
|
+
value: __props.selectedServer.description
|
|
72
|
+
}, null, 8, ["value"])) : createCommentVNode("", true)
|
|
73
|
+
], 64);
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
//#endregion
|
|
78
|
+
export { AsyncApiServerSelector_vue_vue_type_script_setup_true_lang_default as default };
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=AsyncApiServerSelector.vue.script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AsyncApiServerSelector.vue.script.js","names":[],"sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue"],"sourcesContent":["<script lang=\"ts\">\ntype SelectorProps = {\n /** The event bus to use for emitting events */\n eventBus: WorkspaceEventBus\n /** The currently selected server */\n selectedServer: AsyncApiServerEntry | null\n /** Available servers */\n servers: AsyncApiServerEntry[]\n}\n\n/**\n * AsyncApiServerSelector\n *\n * Core component for rendering an AsyncAPI server selector block. It mirrors the\n * OpenAPI ServerSelector, but works with the AsyncAPI server shape (a named map\n * of `host`/`protocol`/`pathname` rather than an array of `url`).\n *\n * @event asyncapi-server:update:selected - Emitted when the selected server changes\n * @event asyncapi-server:update:variables - Emitted when a server variable changes\n */\nexport default {}\n</script>\n\n<script lang=\"ts\" setup>\nimport { ServerVariablesForm } from '@scalar/api-client/components/Server'\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, useId } from 'vue'\n\nimport Selector from './Selector.vue'\n\nconst { eventBus, servers, selectedServer } = defineProps<SelectorProps>()\n\nconst id = useId()\n\n/**\n * Normalize AsyncAPI server variables into the shape the shared\n * ServerVariablesForm expects (resolving references and defaulting `default`).\n */\nconst serverVariables = computed(() => {\n const variables = selectedServer?.server.variables\n if (!variables) {\n return undefined\n }\n\n return Object.fromEntries(\n Object.entries(variables).map(([name, variable]) => {\n const resolved = getResolvedRef(variable)\n return [\n name,\n {\n default: resolved.default ?? '',\n enum: resolved.enum,\n description: resolved.description,\n },\n ]\n }),\n )\n})\n\n/** Update the selected server */\nconst updateServer = (name: string) => {\n eventBus.emit('asyncapi-server:update:selected', { name })\n}\n\n/** Update a server variable on the selected server */\nconst updateServerVariable = (key: string, value: string) => {\n if (!selectedServer) {\n return\n }\n\n eventBus.emit('asyncapi-server:update:variables', {\n name: selectedServer.name,\n key,\n value,\n })\n}\n</script>\n\n<template>\n <label\n class=\"bg-b-2 flex h-8 items-center rounded-t-xl border-x border-t px-3 py-2.5 font-medium\">\n Server\n </label>\n <div\n :id=\"id\"\n class=\"border\"\n :class=\"{\n 'rounded-b-xl': !selectedServer?.description && !serverVariables,\n }\">\n <Selector\n v-if=\"servers.length\"\n :selectedServer\n :servers=\"servers\"\n :target=\"id\"\n @update:modelValue=\"updateServer\" />\n </div>\n <ServerVariablesForm\n layout=\"reference\"\n :variables=\"serverVariables\"\n @update:variable=\"updateServerVariable\" />\n\n <!-- Description -->\n <ScalarMarkdown\n v-if=\"selectedServer?.description\"\n class=\"text-c-3 rounded-b-xl border-x border-b px-3 py-1.5\"\n :value=\"selectedServer.description\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;EAmCA,MAAM,KAAK,OAAM;;;;;EAMjB,MAAM,kBAAkB,eAAe;GACrC,MAAM,YAAY,QAAA,gBAAgB,OAAO;AACzC,OAAI,CAAC,UACH;AAGF,UAAO,OAAO,YACZ,OAAO,QAAQ,UAAU,CAAC,KAAK,CAAC,MAAM,cAAc;IAClD,MAAM,WAAW,eAAe,SAAQ;AACxC,WAAO,CACL,MACA;KACE,SAAS,SAAS,WAAW;KAC7B,MAAM,SAAS;KACf,aAAa,SAAS;KACvB,CACH;KACA,CACJ;IACD;;EAGD,MAAM,gBAAgB,SAAiB;AACrC,WAAA,SAAS,KAAK,mCAAmC,EAAE,MAAM,CAAA;;;EAI3D,MAAM,wBAAwB,KAAa,UAAkB;AAC3D,OAAI,CAAC,QAAA,eACH;AAGF,WAAA,SAAS,KAAK,oCAAoC;IAChD,MAAM,QAAA,eAAe;IACrB;IACA;IACD,CAAA;;;;8BAKD,mBAGQ,SAAA,EAFN,OAAM,uFAAqF,EAAC,YAE9F,GAAA;IACA,mBAYM,OAAA;KAXH,IAAI,MAAA,GAAE;KACP,OAAK,eAAA,CAAC,UAAQ,EAAA,gBAAA,CACmB,QAAA,gBAAgB,eAAW,CAAK,gBAAA,OAAA,CAAA,CAAA;QAIzD,QAAA,QAAQ,UAAA,WAAA,EADhB,YAKsC,kBAAA;;KAHnC,gBAAA,QAAA;KACA,SAAS,QAAA;KACT,QAAQ,MAAA,GAAE;KACV,uBAAmB;;;;;;IAExB,YAG4C,MAAA,oBAAA,EAAA;KAF1C,QAAO;KACN,WAAW,gBAAA;KACX,qBAAiB;;IAIZ,QAAA,gBAAgB,eAAA,WAAA,EADxB,YAGwC,MAAA,eAAA,EAAA;;KADtC,OAAM;KACL,OAAO,QAAA,eAAe"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example';
|
|
2
|
+
type __VLS_Props = {
|
|
3
|
+
/** The selected server */
|
|
4
|
+
selectedServer: AsyncApiServerEntry | null;
|
|
5
|
+
/** Available servers */
|
|
6
|
+
servers: AsyncApiServerEntry[];
|
|
7
|
+
/** The id of the target to use for the popover (e.g. address bar) */
|
|
8
|
+
target: string;
|
|
9
|
+
};
|
|
10
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
|
|
11
|
+
servers: AsyncApiServerEntry[];
|
|
12
|
+
serverUrlWithoutTrailingSlash: import("vue").ComputedRef<string>;
|
|
13
|
+
serverOptions: import("vue").ComputedRef<{
|
|
14
|
+
id: string;
|
|
15
|
+
label: string;
|
|
16
|
+
}[]>;
|
|
17
|
+
selectedServer: AsyncApiServerEntry | null;
|
|
18
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
19
|
+
"update:modelValue": (value: string) => any;
|
|
20
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
21
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
22
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
23
|
+
declare const _default: typeof __VLS_export;
|
|
24
|
+
export default _default;
|
|
25
|
+
//# sourceMappingURL=Selector.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Selector.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue"],"names":[],"mappings":"AAoFA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAGlF,KAAK,WAAW,GAAG;IACjB,0BAA0B;IAC1B,cAAc,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAC1C,wBAAwB;IACxB,OAAO,EAAE,mBAAmB,EAAE,CAAA;IAC9B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAA;CACf,CAAC;AAmMF,QAAA,MAAM,YAAY;;;;;;;;;;;;kFAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Selector_vue_vue_type_script_setup_true_lang_default from "./Selector.vue.script.js";
|
|
2
|
+
//#region src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue
|
|
3
|
+
var Selector_default = Selector_vue_vue_type_script_setup_true_lang_default;
|
|
4
|
+
//#endregion
|
|
5
|
+
export { Selector_default as default };
|
|
6
|
+
|
|
7
|
+
//# sourceMappingURL=Selector.vue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Selector.vue.js","names":[],"sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarListbox } from '@scalar/components/listbox'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example'\nimport { computed } from 'vue'\n\nconst { target, servers, selectedServer } = defineProps<{\n /** The selected server */\n selectedServer: AsyncApiServerEntry | null\n /** Available servers */\n servers: AsyncApiServerEntry[]\n /** The id of the target to use for the popover (e.g. address bar) */\n target: string\n}>()\n\nconst emit = defineEmits<{\n /** Emitted with the server name when the selected server changes */\n (e: 'update:modelValue', value: string): void\n}>()\n\n/**\n * AsyncAPI servers are a named map without a single `url`, so we key options by\n * the server name and label them with the constructed connection URL.\n */\nconst serverOptions = computed(() =>\n servers.map((server) => ({\n id: server.name,\n label: server.url,\n })),\n)\n\nconst serverUrlWithoutTrailingSlash = computed(\n () => selectedServer?.url?.replace(/\\/$/, '') || '',\n)\n\nconst selectedServerOption = computed(() =>\n serverOptions.value.find((opt) => opt.id === selectedServer?.name),\n)\n\n// For testing\ndefineExpose({\n servers,\n serverUrlWithoutTrailingSlash,\n serverOptions,\n selectedServer,\n})\n</script>\n<template>\n <ScalarListbox\n v-if=\"serverOptions.length > 1\"\n ref=\"elem\"\n class=\"group\"\n :modelValue=\"selectedServerOption\"\n :options=\"serverOptions\"\n placement=\"bottom-start\"\n resize\n :target=\"target\"\n @update:modelValue=\"(e) => emit('update:modelValue', e.id)\">\n <ScalarButton\n class=\"bg-b-1 text-c-1 h-auto w-full justify-start gap-1.5 overflow-x-auto rounded-t-none !rounded-b-xl px-3 py-1.5 text-base/5.25 font-normal whitespace-nowrap -outline-offset-1\"\n variant=\"ghost\">\n <span class=\"sr-only\">Server:</span>\n <span class=\"overflow-x-auto\">{{\n serverUrlWithoutTrailingSlash || 'Select a server'\n }}</span>\n <ScalarIconCaretDown\n class=\"text-c-2 ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarListbox>\n <div\n v-else\n class=\"text-c-1 flex h-auto w-full items-center gap-0.75 !rounded-b-xl px-3 py-1.5 text-base leading-[20px] whitespace-nowrap\">\n <span class=\"sr-only\">Server:</span>\n <span class=\"overflow-x-auto\">{{ serverUrlWithoutTrailingSlash }}</span>\n </div>\n</template>\n"],"mappings":""}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
2
|
+
import { ScalarIconCaretDown } from "@scalar/icons";
|
|
3
|
+
import { ScalarButton } from "@scalar/components/button";
|
|
4
|
+
import { ScalarListbox } from "@scalar/components/listbox";
|
|
5
|
+
//#region src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
+
var _hoisted_1 = { class: "overflow-x-auto" };
|
|
7
|
+
var _hoisted_2 = {
|
|
8
|
+
key: 1,
|
|
9
|
+
class: "text-c-1 flex h-auto w-full items-center gap-0.75 !rounded-b-xl px-3 py-1.5 text-base leading-[20px] whitespace-nowrap"
|
|
10
|
+
};
|
|
11
|
+
var _hoisted_3 = { class: "overflow-x-auto" };
|
|
12
|
+
var Selector_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
13
|
+
__name: "Selector",
|
|
14
|
+
props: {
|
|
15
|
+
selectedServer: {},
|
|
16
|
+
servers: {},
|
|
17
|
+
target: {}
|
|
18
|
+
},
|
|
19
|
+
emits: ["update:modelValue"],
|
|
20
|
+
setup(__props, { expose: __expose, emit: __emit }) {
|
|
21
|
+
const emit = __emit;
|
|
22
|
+
/**
|
|
23
|
+
* AsyncAPI servers are a named map without a single `url`, so we key options by
|
|
24
|
+
* the server name and label them with the constructed connection URL.
|
|
25
|
+
*/
|
|
26
|
+
const serverOptions = computed(() => __props.servers.map((server) => ({
|
|
27
|
+
id: server.name,
|
|
28
|
+
label: server.url
|
|
29
|
+
})));
|
|
30
|
+
const serverUrlWithoutTrailingSlash = computed(() => __props.selectedServer?.url?.replace(/\/$/, "") || "");
|
|
31
|
+
const selectedServerOption = computed(() => serverOptions.value.find((opt) => opt.id === __props.selectedServer?.name));
|
|
32
|
+
__expose({
|
|
33
|
+
servers: __props.servers,
|
|
34
|
+
serverUrlWithoutTrailingSlash,
|
|
35
|
+
serverOptions,
|
|
36
|
+
selectedServer: __props.selectedServer
|
|
37
|
+
});
|
|
38
|
+
return (_ctx, _cache) => {
|
|
39
|
+
return serverOptions.value.length > 1 ? (openBlock(), createBlock(unref(ScalarListbox), {
|
|
40
|
+
key: 0,
|
|
41
|
+
ref: "elem",
|
|
42
|
+
class: "group",
|
|
43
|
+
modelValue: selectedServerOption.value,
|
|
44
|
+
options: serverOptions.value,
|
|
45
|
+
placement: "bottom-start",
|
|
46
|
+
resize: "",
|
|
47
|
+
target: __props.target,
|
|
48
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = (e) => emit("update:modelValue", e.id))
|
|
49
|
+
}, {
|
|
50
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
51
|
+
class: "bg-b-1 text-c-1 h-auto w-full justify-start gap-1.5 overflow-x-auto rounded-t-none !rounded-b-xl px-3 py-1.5 text-base/5.25 font-normal whitespace-nowrap -outline-offset-1",
|
|
52
|
+
variant: "ghost"
|
|
53
|
+
}, {
|
|
54
|
+
default: withCtx(() => [
|
|
55
|
+
_cache[1] || (_cache[1] = createElementVNode("span", { class: "sr-only" }, "Server:", -1)),
|
|
56
|
+
createElementVNode("span", _hoisted_1, toDisplayString(serverUrlWithoutTrailingSlash.value || "Select a server"), 1),
|
|
57
|
+
createVNode(unref(ScalarIconCaretDown), {
|
|
58
|
+
class: "text-c-2 ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
|
|
59
|
+
weight: "bold"
|
|
60
|
+
})
|
|
61
|
+
]),
|
|
62
|
+
_: 1
|
|
63
|
+
})]),
|
|
64
|
+
_: 1
|
|
65
|
+
}, 8, [
|
|
66
|
+
"modelValue",
|
|
67
|
+
"options",
|
|
68
|
+
"target"
|
|
69
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_2, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "sr-only" }, "Server:", -1)), createElementVNode("span", _hoisted_3, toDisplayString(serverUrlWithoutTrailingSlash.value), 1)]));
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
//#endregion
|
|
74
|
+
export { Selector_vue_vue_type_script_setup_true_lang_default as default };
|
|
75
|
+
|
|
76
|
+
//# sourceMappingURL=Selector.vue.script.js.map
|
package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.script.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Selector.vue.script.js","names":[],"sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarListbox } from '@scalar/components/listbox'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example'\nimport { computed } from 'vue'\n\nconst { target, servers, selectedServer } = defineProps<{\n /** The selected server */\n selectedServer: AsyncApiServerEntry | null\n /** Available servers */\n servers: AsyncApiServerEntry[]\n /** The id of the target to use for the popover (e.g. address bar) */\n target: string\n}>()\n\nconst emit = defineEmits<{\n /** Emitted with the server name when the selected server changes */\n (e: 'update:modelValue', value: string): void\n}>()\n\n/**\n * AsyncAPI servers are a named map without a single `url`, so we key options by\n * the server name and label them with the constructed connection URL.\n */\nconst serverOptions = computed(() =>\n servers.map((server) => ({\n id: server.name,\n label: server.url,\n })),\n)\n\nconst serverUrlWithoutTrailingSlash = computed(\n () => selectedServer?.url?.replace(/\\/$/, '') || '',\n)\n\nconst selectedServerOption = computed(() =>\n serverOptions.value.find((opt) => opt.id === selectedServer?.name),\n)\n\n// For testing\ndefineExpose({\n servers,\n serverUrlWithoutTrailingSlash,\n serverOptions,\n selectedServer,\n})\n</script>\n<template>\n <ScalarListbox\n v-if=\"serverOptions.length > 1\"\n ref=\"elem\"\n class=\"group\"\n :modelValue=\"selectedServerOption\"\n :options=\"serverOptions\"\n placement=\"bottom-start\"\n resize\n :target=\"target\"\n @update:modelValue=\"(e) => emit('update:modelValue', e.id)\">\n <ScalarButton\n class=\"bg-b-1 text-c-1 h-auto w-full justify-start gap-1.5 overflow-x-auto rounded-t-none !rounded-b-xl px-3 py-1.5 text-base/5.25 font-normal whitespace-nowrap -outline-offset-1\"\n variant=\"ghost\">\n <span class=\"sr-only\">Server:</span>\n <span class=\"overflow-x-auto\">{{\n serverUrlWithoutTrailingSlash || 'Select a server'\n }}</span>\n <ScalarIconCaretDown\n class=\"text-c-2 ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarListbox>\n <div\n v-else\n class=\"text-c-1 flex h-auto w-full items-center gap-0.75 !rounded-b-xl px-3 py-1.5 text-base leading-[20px] whitespace-nowrap\">\n <span class=\"sr-only\">Server:</span>\n <span class=\"overflow-x-auto\">{{ serverUrlWithoutTrailingSlash }}</span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAgBA,MAAM,OAAO;;;;;EASb,MAAM,gBAAgB,eACpB,QAAA,QAAQ,KAAK,YAAY;GACvB,IAAI,OAAO;GACX,OAAO,OAAO;GACf,EAAE,CACL;EAEA,MAAM,gCAAgC,eAC9B,QAAA,gBAAgB,KAAK,QAAQ,OAAO,GAAG,IAAI,GACnD;EAEA,MAAM,uBAAuB,eAC3B,cAAc,MAAM,MAAM,QAAQ,IAAI,OAAO,QAAA,gBAAgB,KAAK,CACpE;AAGA,WAAa;GACX,SAAM,QAAA;GACN;GACA;GACA,gBAAa,QAAA;GACd,CAAA;;UAIS,cAAA,MAAc,SAAM,KAAA,WAAA,EAD5B,YAqBgB,MAAA,cAAA,EAAA;;IAnBd,KAAI;IACJ,OAAM;IACL,YAAY,qBAAA;IACZ,SAAS,cAAA;IACV,WAAU;IACV,QAAA;IACC,QAAQ,QAAA;IACR,uBAAiB,OAAA,OAAA,OAAA,MAAG,MAAM,KAAI,qBAAsB,EAAE,GAAE;;2BAW1C,CAVf,YAUe,MAAA,aAAA,EAAA;KATb,OAAM;KACN,SAAQ;;4BAC4B;gCAApC,mBAAoC,QAAA,EAA9B,OAAM,WAAS,EAAC,WAAO,GAAA;MAC7B,mBAES,QAFT,YAES,gBADP,8BAAA,SAA6B,kBAAA,EAAA,EAAA;MAE/B,YAEkB,MAAA,oBAAA,EAAA;OADhB,OAAM;OACN,QAAO;;;;;;;;;;uBAGb,mBAKM,OALN,YAKM,CAAA,OAAA,OAAA,OAAA,KAFJ,mBAAoC,QAAA,EAA9B,OAAM,WAAS,EAAC,WAAO,GAAA,GAC7B,mBAAwE,QAAxE,YAAwE,gBAAvC,8BAAA,MAA6B,EAAA,EAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/scalar-asyncapi-server-selector-block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,yCAAyC,CAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { type ClientOption, type ClientOptionGroup } from '@scalar/api-client/blocks/operation-code-sample';
|
|
2
|
-
import type { AvailableClients } from '@scalar/types/snippetz';
|
|
3
2
|
import { type WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
4
3
|
type __VLS_Props = {
|
|
5
4
|
/** Client options */
|
|
6
5
|
clientOptions: ClientOptionGroup[];
|
|
7
|
-
/** The currently selected Http Client */
|
|
8
|
-
selectedClient?:
|
|
6
|
+
/** The currently selected Http Client (a built-in client id or a custom sample id) */
|
|
7
|
+
selectedClient?: string;
|
|
9
8
|
/** List of featured clients */
|
|
10
9
|
featuredClients: ClientOption[];
|
|
11
10
|
/** Event bus */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientDropdown.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"names":[],"mappings":"AA4PA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEvB,MAAM,iDAAiD,CAAA;
|
|
1
|
+
{"version":3,"file":"ClientDropdown.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"names":[],"mappings":"AA4PA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEvB,MAAM,iDAAiD,CAAA;AAKxD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAKvE,KAAK,WAAW,GAAG;IACf,qBAAqB;IACrB,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,+BAA+B;IAC/B,eAAe,EAAE,YAAY,EAAE,CAAA;IAC/B,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AAqPJ,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
|
|
|
2
2
|
import ClientDropdown_vue_vue_type_script_setup_true_lang_default from "./ClientDropdown.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/blocks/scalar-client-selector-block/components/ClientDropdown.vue
|
|
5
|
-
var ClientDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ClientDropdown_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var ClientDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ClientDropdown_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-c2617b43"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ClientDropdown_default as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientDropdown.vue.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Tab } from '@headlessui/vue'\nimport {\n filterClientsByQuery,\n findClient,\n type ClientOption,\n type ClientOptionGroup,\n type CustomClientOption,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport type {
|
|
1
|
+
{"version":3,"file":"ClientDropdown.vue.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Tab } from '@headlessui/vue'\nimport {\n filterClientsByQuery,\n findClient,\n type ClientOption,\n type ClientOptionGroup,\n type CustomClientOption,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport type { TargetId } from '@scalar/types/snippetz'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { computed, ref } from 'vue'\n\nimport { isFeaturedClient } from '@/blocks/scalar-client-selector-block/helpers/featured-clients'\n\nconst { clientOptions, featuredClients, eventBus, selectedClient } =\n defineProps<{\n /** Client options */\n clientOptions: ClientOptionGroup[]\n /** The currently selected Http Client (a built-in client id or a custom sample id) */\n selectedClient?: string\n /** List of featured clients */\n featuredClients: ClientOption[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n }>()\n\nconst containerRef = ref<HTMLElement>()\n\n/**\n * Icons have longer names to appear in icon searches, e.g. \"javascript-js\" instead of just \"javascript\". This function\n * maps the language key to the icon name.\n */\nconst getIconByLanguageKey = (targetKey: TargetId) =>\n `programming-language-${targetKey === 'js' ? 'javascript' : targetKey}` as const\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption | CustomClientOption) => {\n if (!containerRef.value) {\n return\n }\n\n // We need to freeze the ui to prevent scrolling as the clients change\n const unfreeze = freezeElement(containerRef.value)\n setTimeout(() => {\n unfreeze()\n }, 300)\n\n // Update the store\n if (option.clientKey !== 'custom') {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n/** Calculates the targetKey from the selected client id */\nconst selectedTargetKey = computed(\n () => selectedClient?.split('/')[0] as TargetId | undefined,\n)\n</script>\n<template>\n <div\n ref=\"containerRef\"\n class=\"client-libraries-content\">\n <Tab\n v-for=\"featuredClient in featuredClients\"\n :key=\"featuredClient.clientKey\"\n class=\"client-libraries rendered-code-sdks\"\n :class=\"{\n 'client-libraries__active': featuredClient.id === selectedClient,\n }\">\n <div :class=\"`client-libraries-icon__${featuredClient.targetKey}`\">\n <ScalarIcon\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(featuredClient.targetKey)\" />\n </div>\n <span class=\"client-libraries-text\">{{\n featuredClient.targetTitle\n }}</span>\n </Tab>\n\n <!-- Client Dropdown -->\n <ScalarCombobox\n :filterFn=\"filterClientsByQuery\"\n :modelValue=\"findClient(clientOptions, selectedClient)\"\n :options=\"clientOptions\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <button\n class=\"client-libraries client-libraries__select\"\n :class=\"{\n 'client-libraries__active':\n selectedClient && !isFeaturedClient(selectedClient),\n }\"\n type=\"button\">\n <div\n aria-hidden=\"true\"\n class=\"client-libraries-icon__more\">\n <template v-if=\"selectedClient && !isFeaturedClient(selectedClient)\">\n <div :class=\"`client-libraries-icon__${selectedTargetKey}`\">\n <ScalarIcon\n v-if=\"selectedTargetKey\"\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(selectedTargetKey)\" />\n </div>\n </template>\n <template v-else>\n <svg\n class=\"client-libraries-icon\"\n height=\"50\"\n role=\"presentation\"\n viewBox=\"0 0 50 50\"\n width=\"50\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <g\n fill=\"currentColor\"\n fill-rule=\"nonzero\">\n <path\n d=\"M10.71 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M21.13 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M31.55 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0\" />\n </g>\n </svg>\n </template>\n </div>\n <span\n v-if=\"clientOptions.length\"\n class=\"client-libraries-text client-libraries-text-more\">\n More\n </span>\n <span class=\"sr-only\">Select from all clients</span>\n </button>\n </ScalarCombobox>\n </div>\n</template>\n<style scoped>\n.client-libraries-content {\n container: client-libraries-content / inline-size;\n display: flex;\n justify-content: center;\n overflow: hidden;\n padding: 0 12px;\n background-color: var(--scalar-background-1);\n border-left: var(--scalar-border-width) solid var(--scalar-border-color);\n border-right: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.client-libraries {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n position: relative;\n cursor: pointer;\n white-space: nowrap;\n padding: 8px 2px;\n gap: 6px;\n color: var(--scalar-color-3);\n border-bottom: 1px solid transparent;\n user-select: none;\n}\n\n.client-libraries:not(.client-libraries__active):hover:before {\n content: '';\n position: absolute;\n width: calc(100% - 4px);\n height: calc(100% - 4px);\n background: var(--scalar-background-2);\n left: 2px;\n top: 2px;\n z-index: 0;\n border-radius: var(--scalar-radius);\n}\n.client-libraries:active {\n color: var(--scalar-color-1);\n}\n.client-libraries:focus-visible {\n outline: none;\n box-shadow: inset 0 0 0 1px var(--scalar-color-accent);\n}\n/* remove php and c on mobile */\n@media screen and (max-width: 450px) {\n .client-libraries:nth-of-type(4),\n .client-libraries:nth-of-type(5) {\n display: none;\n }\n}\n.client-libraries-icon {\n max-width: 14px;\n max-height: 14px;\n min-width: 14px;\n width: 100%;\n aspect-ratio: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n color: currentColor;\n}\n.client-libraries-icon__more svg {\n height: initial;\n}\n@container client-libraries-content (width < 400px) {\n .client-libraries__select {\n width: fit-content;\n\n .client-libraries-icon__more + span {\n display: none;\n }\n }\n}\n@container client-libraries-content (width < 380px) {\n .client-libraries {\n width: 100%;\n }\n .client-libraries span {\n display: none;\n }\n}\n.client-libraries__active {\n color: var(--scalar-color-1);\n border-bottom: 1px solid var(--scalar-color-1);\n}\n@keyframes codeloader {\n 0% {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(1turn);\n }\n}\n.client-libraries .client-libraries-text {\n font-size: var(--scalar-small);\n position: relative;\n display: flex;\n align-items: center;\n}\n.client-libraries__active .client-libraries-text {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n@media screen and (max-width: 600px) {\n .references-classic .client-libraries {\n flex-direction: column;\n }\n}\n</style>\n"],"mappings":""}
|
package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.script.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientDropdown.vue.script.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Tab } from '@headlessui/vue'\nimport {\n filterClientsByQuery,\n findClient,\n type ClientOption,\n type ClientOptionGroup,\n type CustomClientOption,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport type {
|
|
1
|
+
{"version":3,"file":"ClientDropdown.vue.script.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Tab } from '@headlessui/vue'\nimport {\n filterClientsByQuery,\n findClient,\n type ClientOption,\n type ClientOptionGroup,\n type CustomClientOption,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport type { TargetId } from '@scalar/types/snippetz'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { computed, ref } from 'vue'\n\nimport { isFeaturedClient } from '@/blocks/scalar-client-selector-block/helpers/featured-clients'\n\nconst { clientOptions, featuredClients, eventBus, selectedClient } =\n defineProps<{\n /** Client options */\n clientOptions: ClientOptionGroup[]\n /** The currently selected Http Client (a built-in client id or a custom sample id) */\n selectedClient?: string\n /** List of featured clients */\n featuredClients: ClientOption[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n }>()\n\nconst containerRef = ref<HTMLElement>()\n\n/**\n * Icons have longer names to appear in icon searches, e.g. \"javascript-js\" instead of just \"javascript\". This function\n * maps the language key to the icon name.\n */\nconst getIconByLanguageKey = (targetKey: TargetId) =>\n `programming-language-${targetKey === 'js' ? 'javascript' : targetKey}` as const\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption | CustomClientOption) => {\n if (!containerRef.value) {\n return\n }\n\n // We need to freeze the ui to prevent scrolling as the clients change\n const unfreeze = freezeElement(containerRef.value)\n setTimeout(() => {\n unfreeze()\n }, 300)\n\n // Update the store\n if (option.clientKey !== 'custom') {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n/** Calculates the targetKey from the selected client id */\nconst selectedTargetKey = computed(\n () => selectedClient?.split('/')[0] as TargetId | undefined,\n)\n</script>\n<template>\n <div\n ref=\"containerRef\"\n class=\"client-libraries-content\">\n <Tab\n v-for=\"featuredClient in featuredClients\"\n :key=\"featuredClient.clientKey\"\n class=\"client-libraries rendered-code-sdks\"\n :class=\"{\n 'client-libraries__active': featuredClient.id === selectedClient,\n }\">\n <div :class=\"`client-libraries-icon__${featuredClient.targetKey}`\">\n <ScalarIcon\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(featuredClient.targetKey)\" />\n </div>\n <span class=\"client-libraries-text\">{{\n featuredClient.targetTitle\n }}</span>\n </Tab>\n\n <!-- Client Dropdown -->\n <ScalarCombobox\n :filterFn=\"filterClientsByQuery\"\n :modelValue=\"findClient(clientOptions, selectedClient)\"\n :options=\"clientOptions\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <button\n class=\"client-libraries client-libraries__select\"\n :class=\"{\n 'client-libraries__active':\n selectedClient && !isFeaturedClient(selectedClient),\n }\"\n type=\"button\">\n <div\n aria-hidden=\"true\"\n class=\"client-libraries-icon__more\">\n <template v-if=\"selectedClient && !isFeaturedClient(selectedClient)\">\n <div :class=\"`client-libraries-icon__${selectedTargetKey}`\">\n <ScalarIcon\n v-if=\"selectedTargetKey\"\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(selectedTargetKey)\" />\n </div>\n </template>\n <template v-else>\n <svg\n class=\"client-libraries-icon\"\n height=\"50\"\n role=\"presentation\"\n viewBox=\"0 0 50 50\"\n width=\"50\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <g\n fill=\"currentColor\"\n fill-rule=\"nonzero\">\n <path\n d=\"M10.71 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M21.13 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M31.55 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0\" />\n </g>\n </svg>\n </template>\n </div>\n <span\n v-if=\"clientOptions.length\"\n class=\"client-libraries-text client-libraries-text-more\">\n More\n </span>\n <span class=\"sr-only\">Select from all clients</span>\n </button>\n </ScalarCombobox>\n </div>\n</template>\n<style scoped>\n.client-libraries-content {\n container: client-libraries-content / inline-size;\n display: flex;\n justify-content: center;\n overflow: hidden;\n padding: 0 12px;\n background-color: var(--scalar-background-1);\n border-left: var(--scalar-border-width) solid var(--scalar-border-color);\n border-right: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.client-libraries {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n position: relative;\n cursor: pointer;\n white-space: nowrap;\n padding: 8px 2px;\n gap: 6px;\n color: var(--scalar-color-3);\n border-bottom: 1px solid transparent;\n user-select: none;\n}\n\n.client-libraries:not(.client-libraries__active):hover:before {\n content: '';\n position: absolute;\n width: calc(100% - 4px);\n height: calc(100% - 4px);\n background: var(--scalar-background-2);\n left: 2px;\n top: 2px;\n z-index: 0;\n border-radius: var(--scalar-radius);\n}\n.client-libraries:active {\n color: var(--scalar-color-1);\n}\n.client-libraries:focus-visible {\n outline: none;\n box-shadow: inset 0 0 0 1px var(--scalar-color-accent);\n}\n/* remove php and c on mobile */\n@media screen and (max-width: 450px) {\n .client-libraries:nth-of-type(4),\n .client-libraries:nth-of-type(5) {\n display: none;\n }\n}\n.client-libraries-icon {\n max-width: 14px;\n max-height: 14px;\n min-width: 14px;\n width: 100%;\n aspect-ratio: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n color: currentColor;\n}\n.client-libraries-icon__more svg {\n height: initial;\n}\n@container client-libraries-content (width < 400px) {\n .client-libraries__select {\n width: fit-content;\n\n .client-libraries-icon__more + span {\n display: none;\n }\n }\n}\n@container client-libraries-content (width < 380px) {\n .client-libraries {\n width: 100%;\n }\n .client-libraries span {\n display: none;\n }\n}\n.client-libraries__active {\n color: var(--scalar-color-1);\n border-bottom: 1px solid var(--scalar-color-1);\n}\n@keyframes codeloader {\n 0% {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(1turn);\n }\n}\n.client-libraries .client-libraries-text {\n font-size: var(--scalar-small);\n position: relative;\n display: flex;\n align-items: center;\n}\n.client-libraries__active .client-libraries-text {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n@media screen and (max-width: 600px) {\n .references-classic .client-libraries {\n flex-direction: column;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BA,MAAM,eAAe,KAAiB;;;;;EAMtC,MAAM,wBAAwB,cAC5B,wBAAwB,cAAc,OAAO,eAAe;;EAG9D,MAAM,gBAAgB,WAA8C;AAClE,OAAI,CAAC,aAAa,MAChB;GAIF,MAAM,WAAW,cAAc,aAAa,MAAK;AACjD,oBAAiB;AACf,cAAS;MACR,IAAG;AAGN,OAAI,OAAO,cAAc,SACvB,SAAA,SAAS,KAAK,oCAAoC,OAAO,GAAE;;;EAK/D,MAAM,oBAAoB,eAClB,QAAA,gBAAgB,MAAM,IAAI,CAAC,GACnC;;uBAGE,mBAuEM,OAAA;aAtEA;IAAJ,KAAI;IACJ,OAAM;yBACN,mBAeM,UAAA,MAAA,WAdqB,QAAA,kBAAlB,mBAAc;wBADvB,YAeM,MAAA,IAAA,EAAA;KAbH,KAAK,eAAe;KACrB,OAAK,eAAA,CAAC,uCAAqC,EAAA,4BACG,eAAe,OAAO,QAAA,gBAAA,CAAA,CAAA;;4BAO9D,CAJN,mBAIM,OAAA,EAJA,OAAK,eAAA,0BAA4B,eAAe,YAAS,EAAA,EAAA,CAC7D,YAE2D,MAAA,WAAA,EAAA;MADzD,OAAM;MACL,MAAM,qBAAqB,eAAe,UAAS;iCAExD,mBAES,QAFT,YAES,gBADP,eAAe,YAAW,EAAA,EAAA,CAAA,CAAA;;;cAK9B,YAiDiB,MAAA,eAAA,EAAA;IAhDd,UAAU,MAAA,qBAAoB;IAC9B,YAAY,MAAA,WAAU,CAAC,QAAA,eAAe,QAAA,eAAc;IACpD,SAAS,QAAA;IACV,WAAU;IACV,UAAA;IACC,uBAAiB,OAAA,OAAA,OAAA,MAAA,WAAE,aAAa,OAAM;;2BA0C9B,CAzCT,mBAyCS,UAAA;KAxCP,OAAK,eAAA,CAAC,6CAA2C,EAAA,4BACW,QAAA,kBAAc,CAAK,MAAA,iBAAgB,CAAC,QAAA,eAAc,EAAA,CAAA,CAAA;KAI9G,MAAK;;KACL,mBA2BM,OA3BN,YA2BM,CAxBY,QAAA,kBAAc,CAAK,MAAA,iBAAgB,CAAC,QAAA,eAAc,IAAA,WAAA,EAChE,mBAKM,OAAA;;MALA,OAAK,eAAA,0BAA4B,kBAAA,QAAiB;SAE9C,kBAAA,SAAA,WAAA,EADR,YAGoD,MAAA,WAAA,EAAA;;MADlD,OAAM;MACL,MAAM,qBAAqB,kBAAA,MAAiB;iFAIjD,mBAaM,OAbN,YAaM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CANJ,mBAKI,KAAA;MAJF,MAAK;MACL,aAAU;SACV,mBACoL,QAAA,EAAlL,GAAE,+KAA6K,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,CAAA,EAAA,CAAA;KAMjL,QAAA,cAAc,UAAA,WAAA,EADtB,mBAIO,QAJP,YAE2D,SAE3D,IAAA,mBAAA,IAAA,KAAA;+BACA,mBAAoD,QAAA,EAA9C,OAAM,WAAS,EAAC,2BAAuB,GAAA"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { type ClientOptionGroup } from '@scalar/api-client/blocks/operation-code-sample';
|
|
2
|
-
import type { AvailableClient } from '@scalar/snippetz';
|
|
3
2
|
import { type WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
4
|
-
import type { XScalarSdkInstallation } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-sdk-installation';
|
|
5
3
|
type __VLS_Props = {
|
|
6
|
-
/** Selected SDK installation instructions */
|
|
7
|
-
xScalarSdkInstallation?: XScalarSdkInstallation['x-scalar-sdk-installation'];
|
|
8
4
|
/** Computed list of all available Http Client options */
|
|
9
5
|
clientOptions: ClientOptionGroup[];
|
|
10
|
-
/** The currently selected Http Client */
|
|
11
|
-
selectedClient?:
|
|
6
|
+
/** The currently selected Http Client (a built-in client id or a custom sample id) */
|
|
7
|
+
selectedClient?: string;
|
|
12
8
|
/** Event bus */
|
|
13
9
|
eventBus: WorkspaceEventBus;
|
|
14
10
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ClientSelector.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientSelector.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ClientSelector.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientSelector.vue"],"names":[],"mappings":"AAqLA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAUvE,KAAK,WAAW,GAAG;IACjB,yDAAyD;IACzD,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AAwOF,QAAA,MAAM,YAAY;;oPAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
|
|
|
2
2
|
import ClientSelector_vue_vue_type_script_setup_true_lang_default from "./ClientSelector.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/blocks/scalar-client-selector-block/components/ClientSelector.vue
|
|
5
|
-
var ClientSelector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ClientSelector_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var ClientSelector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ClientSelector_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-0769d07b"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ClientSelector_default as default };
|
|
8
8
|
|