@scalar/api-reference 1.58.0 → 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 +75 -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-DIIVMX31.js → AgentScalarChatInterface-BXB1nZKJ.js} +4 -4
- package/dist/browser/chunks/ScalarTextInput.vue-XkIzhvc0.js +27 -0
- package/dist/browser/chunks/basic-shape-diamond.svg-BTEOT1FL.js +1 -1
- package/dist/browser/chunks/basic-shape-hexagon.svg-BSPzaCgF.js +1 -1
- package/dist/browser/chunks/basic-shape-primary-circle-ellipse-round.svg-DKmZ8UUU.js +1 -1
- package/dist/browser/chunks/basic-shape-primary-square-rectangle.svg-n2YRykHD.js +1 -1
- package/dist/browser/chunks/basic-shape-shield.svg-Bec9cJDA.js +1 -1
- package/dist/browser/chunks/browser-67K6wmG9.js +1 -1
- package/dist/browser/chunks/computer-device-desktop-monitor.svg-m6j893Hb.js +1 -1
- package/dist/browser/chunks/computer-device-desktop.svg-Dk1VVO7k.js +1 -1
- package/dist/browser/chunks/computer-device-laptop.svg-BNGVUCYS.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung-back.svg-CC4UUTFw.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-android-samsung.svg-D8ExpMpL.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x-back.svg-CLm7sgMM.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-phone-iphone-x.svg-Xrttg6_7.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-tablet-touch.svg-DQ2oTvOG.js +1 -1
- package/dist/browser/chunks/computer-device-mobile-tablet.svg-DCr0XlRc.js +1 -1
- package/dist/browser/chunks/computer-device-network-ethernet-cat6.svg-AK9l0iOl.js +1 -1
- package/dist/browser/chunks/computer-device-network-lan-www.svg-gUIdFBlE.js +1 -1
- package/dist/browser/chunks/computer-device-network-wifi-connection.svg-Be-EMm4e.js +1 -1
- package/dist/browser/chunks/computer-device-network-wifi-router.svg-Dc2VzyqK.js +1 -1
- package/dist/browser/chunks/ecology-science-erlenmeyer-flask.svg-DHgy7Jfd.js +1 -1
- package/dist/browser/chunks/image-flash-lightning.svg-EETR_y1q.js +1 -1
- package/dist/browser/chunks/image-picture-flower.svg-DN1AYzJU.js +1 -1
- package/dist/browser/chunks/interface-alert-exclamation-diamond.svg-C5NozMV_.js +1 -1
- package/dist/browser/chunks/interface-alert-exclamation-triangle-warning.svg-DaAg2fF5.js +1 -1
- package/dist/browser/chunks/interface-alert-information-circle.svg-ckkkt9Mv.js +1 -1
- package/dist/browser/chunks/interface-award-crown.svg-pjvn9hY-.js +1 -1
- package/dist/browser/chunks/interface-bookmark-tag.svg-r2r-lQq4.js +1 -1
- package/dist/browser/chunks/interface-bookmark.svg-BK9HKQBT.js +1 -1
- package/dist/browser/chunks/interface-calendar-date-one.svg-DNnF0M1I.js +1 -1
- package/dist/browser/chunks/interface-content-book-open-pages.svg-CQj_w9Vp.js +1 -1
- package/dist/browser/chunks/interface-content-book-page.svg-DppoeJRe.js +1 -1
- package/dist/browser/chunks/interface-content-file.svg-CvcD7OiY.js +1 -1
- package/dist/browser/chunks/interface-content-folder.svg-BmtS5I9A.js +1 -1
- package/dist/browser/chunks/interface-copy-clipboard.svg-Be6EI50X.js +1 -1
- package/dist/browser/chunks/interface-edit-attachment.svg-G5TKzpWX.js +1 -1
- package/dist/browser/chunks/interface-edit-binocular.svg-jzL-DvGB.js +1 -1
- package/dist/browser/chunks/interface-edit-magic-wand.svg-BOTlymvp.js +1 -1
- package/dist/browser/chunks/interface-edit-tool-paint-roller.svg-s9dwryx7.js +1 -1
- package/dist/browser/chunks/interface-edit-tool-pencil.svg-C7v0dbB3.js +1 -1
- package/dist/browser/chunks/interface-favorite-award.svg-CYHUgUG0.js +1 -1
- package/dist/browser/chunks/interface-favorite-flag.svg-C10zlKOb.js +1 -1
- package/dist/browser/chunks/interface-favorite-heart.svg-eoduXxlz.js +1 -1
- package/dist/browser/chunks/interface-favorite-star.svg-BSmxJetr.js +1 -1
- package/dist/browser/chunks/interface-favorite-stars-sparkles.svg-JTFLj3Ls.js +1 -1
- package/dist/browser/chunks/interface-hierarchy-flowchart.svg-Cg_Wy0kN.js +1 -1
- package/dist/browser/chunks/interface-home-house.svg-DytoGRnv.js +1 -1
- package/dist/browser/chunks/interface-hyperlink.svg-CuEfmmQI.js +1 -1
- package/dist/browser/chunks/interface-lighting-brightness.svg-DSK0h_Pa.js +1 -1
- package/dist/browser/chunks/interface-lock-closed.svg-Cn6TaLYv.js +1 -1
- package/dist/browser/chunks/interface-lock-open-unlock.svg-CVkG5-9W.js +1 -1
- package/dist/browser/chunks/interface-login-key.svg-y-cwwXjN.js +1 -1
- package/dist/browser/chunks/interface-search.svg-S-puVFJB.js +1 -1
- package/dist/browser/chunks/interface-setting-cog.svg-CTH4_lLg.js +1 -1
- package/dist/browser/chunks/interface-share-megaphone-bullhorn.svg-Pbp39MyC.js +1 -1
- package/dist/browser/chunks/interface-share-rocket.svg-BgCsIRZO.js +1 -1
- package/dist/browser/chunks/interface-share-satellite.svg-DAMN9d5G.js +1 -1
- package/dist/browser/chunks/interface-share-space-ship.svg-Dt-Mejxk.js +1 -1
- package/dist/browser/chunks/interface-share.svg-vFYTXSti.js +1 -1
- package/dist/browser/chunks/interface-signal-square.svg-DNG4LpAe.js +1 -1
- package/dist/browser/chunks/interface-time-clock-circle.svg-Bpz-nLxo.js +1 -1
- package/dist/browser/chunks/interface-time-hour-glass.svg-D7agfKsH.js +1 -1
- package/dist/browser/chunks/interface-users-multiple.svg-CkPJBBnG.js +1 -1
- package/dist/browser/chunks/interface-weather-moon.svg-CaTZFMPO.js +1 -1
- package/dist/browser/chunks/mail-chat-bubble-square.svg-DC8RIihp.js +1 -1
- package/dist/browser/chunks/mail-send-email-paper-airplane.svg-D8OLs9jz.js +1 -1
- package/dist/browser/chunks/mail-send-envelope.svg-CV33h5Sx.js +1 -1
- package/dist/browser/chunks/modal-Bp9V4D2s.js +66 -0
- package/dist/browser/chunks/{modal-BA6EnLMO.js → modal-CtAiwzwH.js} +2 -2
- package/dist/browser/chunks/money-cashier-receipt.svg-CJL8C2gs.js +1 -1
- package/dist/browser/chunks/money-currency-dollar-pay.svg-VdBplCTx.js +1 -1
- package/dist/browser/chunks/money-graph-arrow-increase.svg-DcRov3zk.js +1 -1
- package/dist/browser/chunks/money-graph-bar-chart-increase.svg-Cc7KxjX-.js +1 -1
- package/dist/browser/chunks/nature-ecology-leaf.svg-DR3cTZxt.js +1 -1
- package/dist/browser/chunks/phone-telephone.svg-DyY0gUlk.js +1 -1
- package/dist/browser/chunks/programming-bug.svg-BHLT-Qhp.js +1 -1
- package/dist/browser/chunks/programming-cloud.svg-B6YW33ba.js +1 -1
- package/dist/browser/chunks/programming-computer-database-server.svg-B6o5Sdn-.js +1 -1
- package/dist/browser/chunks/programming-computer-database.svg-Cl7OVtpJ.js +1 -1
- package/dist/browser/chunks/programming-module-four-layout.svg-BQrerL1x.js +1 -1
- package/dist/browser/chunks/programming-module-three.svg-B2KTQzBM.js +1 -1
- package/dist/browser/chunks/programming-module.svg-CiID7kPm.js +1 -1
- package/dist/browser/chunks/programming-script-code.svg-D1M5rtkN.js +1 -1
- package/dist/browser/chunks/runtime-core.esm-bundler-Byrbbu5Q.js +1 -1
- package/dist/browser/chunks/shopping-cart.svg-BEegiIR9.js +1 -1
- package/dist/browser/chunks/shopping-gift-present.svg-BUHwuLix.js +1 -1
- package/dist/browser/chunks/shopping-shipping-box-parcel-package.svg-D6fxWdYx.js +1 -1
- package/dist/browser/chunks/tag-new-circle.svg-jsg1bGs0.js +1 -1
- package/dist/browser/chunks/travel-map-earth-globe.svg-ClbMiU-f.js +1 -1
- package/dist/browser/chunks/vendor-nugWm4eq.js +337 -0
- package/dist/browser/standalone.esm.js +19 -18
- package/dist/browser/standalone.js +245 -240
- 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 +19 -3
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.d.ts +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.d.ts.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js +4 -2
- package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.d.ts +4 -0
- package/dist/components/Content/AsyncApi/Channel.vue.d.ts.map +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.js +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.js.map +1 -1
- package/dist/components/Content/AsyncApi/Channel.vue.script.js +43 -3
- package/dist/components/Content/AsyncApi/Channel.vue.script.js.map +1 -1
- 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/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 +50 -6
- 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/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 +7 -2
- 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 +7 -0
- 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/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/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.map +1 -1
- package/dist/features/Search/components/SearchButton.vue.js.map +1 -1
- package/dist/features/Search/components/SearchButton.vue.script.js +13 -1
- package/dist/features/Search/components/SearchButton.vue.script.js.map +1 -1
- package/dist/features/Search/components/SearchModal.vue.d.ts.map +1 -1
- package/dist/features/Search/components/SearchModal.vue.js +1 -1
- package/dist/features/Search/components/SearchModal.vue.js.map +1 -1
- package/dist/features/Search/components/SearchModal.vue.script.js +2 -3
- package/dist/features/Search/components/SearchModal.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigTheme.vue.script.js +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/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/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/style.css +557 -374
- package/dist/vue-styles.css +547 -357
- package/package.json +16 -16
- package/dist/browser/chunks/ScalarTextInput.vue-DDsQgpOo.js +0 -27
- package/dist/browser/chunks/modal-DW-P3H1k.js +0 -66
- package/dist/browser/chunks/vendor-Ad2vN5Ro.js +0 -333
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useSearchIndex } from "../hooks/useSearchIndex.js";
|
|
2
2
|
import SearchResult_default from "./SearchResult.vue.js";
|
|
3
|
-
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, isRef, openBlock, ref, renderList, toDisplayString, unref, watch, withCtx, withKeys, withModifiers } from "vue";
|
|
4
|
-
import { nanoid } from "nanoid";
|
|
3
|
+
import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, isRef, openBlock, ref, renderList, toDisplayString, unref, useId, watch, withCtx, withKeys, withModifiers } from "vue";
|
|
5
4
|
import { ScalarModal } from "@scalar/components/modal";
|
|
6
5
|
import { ScalarSearchInput } from "@scalar/components/search-input";
|
|
7
6
|
import { ScalarSearchResultList } from "@scalar/components/search-results";
|
|
@@ -21,7 +20,7 @@ var SearchModal_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ de
|
|
|
21
20
|
setup(__props) {
|
|
22
21
|
const props = __props;
|
|
23
22
|
/** Base id for the search form */
|
|
24
|
-
const id =
|
|
23
|
+
const id = useId();
|
|
25
24
|
/** An id for the results listbox */
|
|
26
25
|
const listboxId = `${id}-search-result`;
|
|
27
26
|
/** An id for the results instructions */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchModal.vue.script.js","names":[],"sources":["../../../../src/features/Search/components/SearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { ModelsSectionLabel } from '@scalar/types/api-reference'\nimport type { AsyncApiDocument } from '@scalar/types/asyncapi/3.1'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport {
|
|
1
|
+
{"version":3,"file":"SearchModal.vue.script.js","names":[],"sources":["../../../../src/features/Search/components/SearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { ModelsSectionLabel } from '@scalar/types/api-reference'\nimport type { AsyncApiDocument } from '@scalar/types/asyncapi/3.1'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, useId, watch } from 'vue'\n\nimport { useSearchIndex } from '@/features/Search/hooks/useSearchIndex'\n\nimport SearchResult from './SearchResult.vue'\n\nconst props = defineProps<{\n modalState: ModalState\n document: OpenApiDocument | AsyncApiDocument | undefined\n eventBus: WorkspaceEventBus\n modelsSectionLabel?: ModelsSectionLabel\n}>()\n\n/** Base id for the search form */\nconst id = useId()\n/** An id for the results listbox */\nconst listboxId = `${id}-search-result`\n/** An id for the results instructions */\nconst instructionsId = `${id}-search-instructions`\n\nconst { query, results } = useSearchIndex(\n () => props.document,\n () => props.modelsSectionLabel,\n)\n\nconst selectedIndex = ref<number | undefined>(undefined)\n\n/** Clear the query value when the modal is opened */\nwatch(\n () => props.modalState.open,\n (open) => {\n if (open) {\n query.value = ''\n }\n },\n)\n\n/** Keyboard navigation */\nconst navigateSearchResults = (direction: 'up' | 'down') => {\n const offset = direction === 'up' ? -1 : 1\n const length = results.value.length\n\n if (typeof selectedIndex.value === 'number') {\n // Ensures we loop around the array by using the remainder\n selectedIndex.value = (selectedIndex.value + offset + length) % length\n } else {\n // If no index is selected, we select the first or last item depending on the direction\n\n selectedIndex.value = offset === -1 ? length - 1 : 0\n }\n}\n\n/** Handle the selection of a search result */\nfunction handleSelect(idx: number | undefined) {\n if (typeof idx !== 'number' || !results.value[idx]) {\n return\n }\n\n const result = results.value[idx]\n props.modalState.hide()\n props.eventBus.emit('scroll-to:nav-item', { id: result.item.id })\n}\n\n/**\n * Active descendant id for the search input\n * NOTE: Result items MUST share this id for the aria-activedescendant attribute to work correctly\n */\nconst activeDescendantId = computed(() => {\n const selectedResult = results.value[selectedIndex.value ?? -1]\n\n return selectedResult ? `search-result-${selectedResult.item.id}` : undefined\n})\n</script>\n<template>\n <ScalarModal\n aria-label=\"Reference Search\"\n :state=\"modalState\"\n variant=\"search\">\n <div\n class=\"mb-0 flex flex-col\"\n role=\"search\">\n <ScalarSearchInput\n v-model=\"query\"\n :aria-activedescendant=\"activeDescendantId\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-describedby=\"instructionsId\"\n role=\"combobox\"\n @blur=\"selectedIndex = undefined\"\n @keydown.down.stop.prevent=\"navigateSearchResults('down')\"\n @keydown.enter.stop.prevent=\"() => handleSelect(selectedIndex)\"\n @keydown.up.stop.prevent=\"navigateSearchResults('up')\" />\n </div>\n <ScalarSearchResultList\n :id=\"listboxId\"\n aria-label=\"Reference Search Results\"\n class=\"custom-scroll px-1 pb-1\"\n :noResults=\"!results.length\">\n <template #query>\n {{ query }}\n </template>\n <SearchResult\n v-for=\"(result, idx) in results\"\n :id=\"`search-result-${result.item.id}`\"\n :key=\"result.refIndex\"\n :isSelected=\"selectedIndex === idx\"\n :modelsSectionLabel=\"props.modelsSectionLabel\"\n :result=\"result\"\n @click.prevent=\"() => handleSelect(idx)\" />\n </ScalarSearchResultList>\n <div\n :id=\"instructionsId\"\n class=\"ref-search-meta\">\n <span\n aria-hidden=\"true\"\n class=\"contents\">\n <span>↑↓ Navigate</span>\n <span>⏎ Select</span>\n </span>\n <span class=\"sr-only\">\n Press up arrow / down arrow to navigate, enter to select, type to filter\n results\n </span>\n </div>\n </ScalarModal>\n</template>\n<style scoped>\n.ref-search-meta {\n background: var(--scalar-background-1);\n border-bottom-left-radius: var(--scalar-radius-lg);\n border-bottom-right-radius: var(--scalar-radius-lg);\n padding: 6px 12px;\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-3);\n font-weight: var(--scalar-semibold);\n display: flex;\n gap: 12px;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAcA,MAAM,QAAQ;;EAQd,MAAM,KAAK,OAAM;;EAEjB,MAAM,YAAY,GAAG,GAAG;;EAExB,MAAM,iBAAiB,GAAG,GAAG;EAE7B,MAAM,EAAE,OAAO,YAAY,qBACnB,MAAM,gBACN,MAAM,mBACd;EAEA,MAAM,gBAAgB,IAAwB,KAAA,EAAS;;AAGvD,cACQ,MAAM,WAAW,OACtB,SAAS;AACR,OAAI,KACF,OAAM,QAAQ;IAGpB;;EAGA,MAAM,yBAAyB,cAA6B;GAC1D,MAAM,SAAS,cAAc,OAAO,KAAK;GACzC,MAAM,SAAS,QAAQ,MAAM;AAE7B,OAAI,OAAO,cAAc,UAAU,SAEjC,eAAc,SAAS,cAAc,QAAQ,SAAS,UAAU;OAIhE,eAAc,QAAQ,WAAW,KAAK,SAAS,IAAI;;;EAKvD,SAAS,aAAa,KAAyB;AAC7C,OAAI,OAAO,QAAQ,YAAY,CAAC,QAAQ,MAAM,KAC5C;GAGF,MAAM,SAAS,QAAQ,MAAM;AAC7B,SAAM,WAAW,MAAK;AACtB,SAAM,SAAS,KAAK,sBAAsB,EAAE,IAAI,OAAO,KAAK,IAAI,CAAA;;;;;;EAOlE,MAAM,qBAAqB,eAAe;GACxC,MAAM,iBAAiB,QAAQ,MAAM,cAAc,SAAS;AAE5D,UAAO,iBAAiB,iBAAiB,eAAe,KAAK,OAAO,KAAA;IACrE;;uBAGC,YAkDc,MAAA,YAAA,EAAA;IAjDZ,cAAW;IACV,OAAO,QAAA;IACR,SAAQ;;2BAeF;KAdN,mBAcM,OAdN,YAcM,CAXJ,YAU2D,MAAA,kBAAA,EAAA;kBAThD,MAAA,MAAK;wFAAA,QAAA,SAAA;MACb,yBAAuB,mBAAA;MACxB,qBAAkB;MACjB,iBAAe;MACf,oBAAkB;MACnB,MAAK;MACJ,QAAI,OAAA,OAAA,OAAA,MAAA,WAAE,cAAA,QAAgB,KAAA;MACtB,WAAO;oEAAoB,sBAAqB,OAAA,EAAA,CAAA,QAAA,UAAA,CAAA,EAAA,CAAA,OAAA,CAAA;8DACd,aAAa,cAAA,MAAa,EAAA,CAAA,QAAA,UAAA,CAAA,EAAA,CAAA,QAAA,CAAA;oEACnC,sBAAqB,KAAA,EAAA,CAAA,QAAA,UAAA,CAAA,EAAA,CAAA,KAAA,CAAA;;;KAEnD,YAgByB,MAAA,uBAAA,EAAA;MAftB,IAAI;MACL,cAAW;MACX,OAAM;MACL,WAAS,CAAG,MAAA,QAAO,CAAC;;MACV,OAAK,cACH,CAAA,gBAAA,gBAAR,MAAA,MAAK,CAAA,EAAA,EAAA,CAAA,CAAA;6BAGwB,EAAA,UAAA,KAAA,EADlC,mBAO6C,UAAA,MAAA,WANnB,MAAA,QAAO,GAAvB,QAAQ,QAAG;2BADrB,YAO6C,sBAAA;QAL1C,IAAE,iBAAmB,OAAO,KAAK;QACjC,KAAK,OAAO;QACZ,YAAY,cAAA,UAAkB;QAC9B,oBAAoB,MAAM;QAClB;QACR,SAAK,oBAAgB,aAAa,IAAG,EAAA,CAAA,UAAA,CAAA;;;;;;;;;;;KAE1C,mBAaM,OAAA;MAZH,IAAI;MACL,OAAM;uCACN,mBAKO,QAAA;MAJL,eAAY;MACZ,OAAM;SACN,mBAAwB,QAAA,MAAlB,cAAW,EACjB,mBAAqB,QAAA,MAAf,WAAQ,CAAA,EAAA,GAAA,EAEhB,mBAGO,QAAA,EAHD,OAAM,WAAS,EAAC,sFAGtB,GAAA,CAAA,EAAA,CAAA"}
|
package/dist/features/developer-tools/components/ApiReferenceToolbarConfigTheme.vue.script.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { computed, createBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref, useModel, withCtx } from "vue";
|
|
2
2
|
import { presets, themeIds, themeLabels } from "@scalar/themes";
|
|
3
3
|
import { ScalarIconCaretDown } from "@scalar/icons";
|
|
4
|
-
import { ScalarCombobox } from "@scalar/components/combobox";
|
|
5
4
|
import { ScalarListboxCheckbox } from "@scalar/components/listbox";
|
|
5
|
+
import { ScalarCombobox } from "@scalar/components/combobox";
|
|
6
6
|
import { ScalarFormInput } from "@scalar/components/form";
|
|
7
7
|
import { ScalarThemeSwatches } from "@scalar/components/theme-swatches";
|
|
8
8
|
//#region src/features/developer-tools/components/ApiReferenceToolbarConfigTheme.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleResponse.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-responses/ExampleResponse.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExampleResponse.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-responses/ExampleResponse.vue"],"names":[],"mappings":"AAgJA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EAEhB,MAAM,8DAA8D,CAAA;AAGrE,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAA;IACrC,OAAO,EAAE,aAAa,GAAG,SAAS,CAAA;CACnC,CAAC;AAwHF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../_virtual/_plugin-vue_export
|
|
|
2
2
|
import ExampleResponse_vue_vue_type_script_setup_true_lang_default from "./ExampleResponse.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/features/example-responses/ExampleResponse.vue
|
|
5
|
-
var ExampleResponse_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ExampleResponse_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var ExampleResponse_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ExampleResponse_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-da52ac9d"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ExampleResponse_default as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleResponse.vue.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponse.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { getResolvedRefDeep } from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport {
|
|
1
|
+
{"version":3,"file":"ExampleResponse.vue.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponse.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { getResolvedRefDeep } from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport { ScalarVirtualCodeBlock } from '@scalar/components/virtual-code-block'\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport { getExampleFromSchema } from '@scalar/workspace-store/request-example'\nimport type {\n ExampleObject,\n MediaTypeObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nconst { example, response } = defineProps<{\n response: MediaTypeObject | undefined\n example: ExampleObject | undefined\n}>()\n\n/** Get content from the appropriate source */\nconst getContent = () => {\n if (example !== undefined) {\n return getResolvedRefDeep(example)?.value ?? ''\n }\n\n if (response?.schema) {\n return getExampleFromSchema(\n // Should be safe to deep resolve the schema here because we don't have to do any sibling resolution for example generation\n getResolvedRefDeep(response.schema) as SchemaObject,\n {\n emptyString: 'string',\n mode: 'read',\n },\n )\n }\n\n return undefined\n}\n\n/** Pre-pretty printed content string, avoids multiple pretty prints*/\nconst prettyPrintedContent = computed(() => {\n const content = getContent()\n if (content === undefined) {\n return undefined\n }\n return prettyPrintJson(content)\n})\n\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\n// Virtualize the code block if it's too large\nconst shouldVirtualize = computed(() => {\n if (prettyPrintedContent.value === undefined) {\n return false\n }\n return prettyPrintedContent.value.length > VIRTUALIZATION_THRESHOLD\n})\n</script>\n<template>\n <!-- Example -->\n <ScalarCodeBlock\n v-if=\"prettyPrintedContent !== undefined && !shouldVirtualize\"\n class=\"bg-b-2\"\n lang=\"json\"\n :prettyPrintedContent=\"prettyPrintedContent\" />\n\n <ScalarVirtualCodeBlock\n v-else-if=\"prettyPrintedContent !== undefined && shouldVirtualize\"\n class=\"bg-b-2\"\n :content=\"prettyPrintedContent\"\n lang=\"json\" />\n\n <div\n v-else\n class=\"empty-state\">\n No Body\n </div>\n</template>\n\n<style scoped>\n.empty-state {\n margin: 10px 0 10px 12px;\n text-align: center;\n font-size: var(--scalar-mini);\n min-height: 56px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--scalar-radius-lg);\n color: var(--scalar-color-2);\n}\n\n.rule-title {\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n display: inline-block;\n margin: 12px 0 6px;\n border-radius: var(--scalar-radius);\n}\n\n.rule {\n margin: 0 12px 0;\n border-radius: var(--scalar-radius-lg);\n}\n\n.rule-items {\n counter-reset: list-number;\n display: flex;\n flex-direction: column;\n gap: 12px;\n border-left: 1px solid var(--scalar-border-color);\n padding: 12px 0 12px;\n}\n.rule-item {\n counter-increment: list-number;\n border: 1px solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n overflow: hidden;\n margin-left: 24px;\n}\n.rule-item:before {\n /* content: counter(list-number); */\n border: 1px solid var(--scalar-border-color);\n border-top: 0;\n border-right: 0;\n content: ' ';\n display: block;\n width: 24px;\n height: 6px;\n border-radius: 0 0 0 var(--scalar-radius-lg);\n margin-top: 6px;\n color: var(--scalar-color-2);\n transform: translateX(-25px);\n color: var(--scalar-color-1);\n position: absolute;\n}\n</style>\n"],"mappings":""}
|
|
@@ -2,7 +2,7 @@ import { computed, createBlock, createElementBlock, defineComponent, openBlock,
|
|
|
2
2
|
import { getExampleFromSchema } from "@scalar/workspace-store/request-example";
|
|
3
3
|
import { getResolvedRefDeep } from "@scalar/api-client/blocks/operation-code-sample";
|
|
4
4
|
import { ScalarCodeBlock } from "@scalar/components/code-block";
|
|
5
|
-
import {
|
|
5
|
+
import { ScalarVirtualCodeBlock } from "@scalar/components/virtual-code-block";
|
|
6
6
|
import { prettyPrintJson } from "@scalar/helpers/json/pretty-print-json";
|
|
7
7
|
//#region src/features/example-responses/ExampleResponse.vue?vue&type=script&setup=true&lang.ts
|
|
8
8
|
var _hoisted_1 = {
|
|
@@ -41,13 +41,12 @@ var ExampleResponse_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ *
|
|
|
41
41
|
class: "bg-b-2",
|
|
42
42
|
lang: "json",
|
|
43
43
|
prettyPrintedContent: prettyPrintedContent.value
|
|
44
|
-
}, null, 8, ["prettyPrintedContent"])) : prettyPrintedContent.value !== void 0 && shouldVirtualize.value ? (openBlock(), createBlock(unref(
|
|
44
|
+
}, null, 8, ["prettyPrintedContent"])) : prettyPrintedContent.value !== void 0 && shouldVirtualize.value ? (openBlock(), createBlock(unref(ScalarVirtualCodeBlock), {
|
|
45
45
|
key: 1,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}, null, 8, ["text"])) : (openBlock(), createElementBlock("div", _hoisted_1, " No Body "));
|
|
46
|
+
class: "bg-b-2",
|
|
47
|
+
content: prettyPrintedContent.value,
|
|
48
|
+
lang: "json"
|
|
49
|
+
}, null, 8, ["content"])) : (openBlock(), createElementBlock("div", _hoisted_1, " No Body "));
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleResponse.vue.script.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponse.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { getResolvedRefDeep } from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport {
|
|
1
|
+
{"version":3,"file":"ExampleResponse.vue.script.js","names":[],"sources":["../../../src/features/example-responses/ExampleResponse.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { getResolvedRefDeep } from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport { ScalarVirtualCodeBlock } from '@scalar/components/virtual-code-block'\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport { getExampleFromSchema } from '@scalar/workspace-store/request-example'\nimport type {\n ExampleObject,\n MediaTypeObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nconst { example, response } = defineProps<{\n response: MediaTypeObject | undefined\n example: ExampleObject | undefined\n}>()\n\n/** Get content from the appropriate source */\nconst getContent = () => {\n if (example !== undefined) {\n return getResolvedRefDeep(example)?.value ?? ''\n }\n\n if (response?.schema) {\n return getExampleFromSchema(\n // Should be safe to deep resolve the schema here because we don't have to do any sibling resolution for example generation\n getResolvedRefDeep(response.schema) as SchemaObject,\n {\n emptyString: 'string',\n mode: 'read',\n },\n )\n }\n\n return undefined\n}\n\n/** Pre-pretty printed content string, avoids multiple pretty prints*/\nconst prettyPrintedContent = computed(() => {\n const content = getContent()\n if (content === undefined) {\n return undefined\n }\n return prettyPrintJson(content)\n})\n\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\n// Virtualize the code block if it's too large\nconst shouldVirtualize = computed(() => {\n if (prettyPrintedContent.value === undefined) {\n return false\n }\n return prettyPrintedContent.value.length > VIRTUALIZATION_THRESHOLD\n})\n</script>\n<template>\n <!-- Example -->\n <ScalarCodeBlock\n v-if=\"prettyPrintedContent !== undefined && !shouldVirtualize\"\n class=\"bg-b-2\"\n lang=\"json\"\n :prettyPrintedContent=\"prettyPrintedContent\" />\n\n <ScalarVirtualCodeBlock\n v-else-if=\"prettyPrintedContent !== undefined && shouldVirtualize\"\n class=\"bg-b-2\"\n :content=\"prettyPrintedContent\"\n lang=\"json\" />\n\n <div\n v-else\n class=\"empty-state\">\n No Body\n </div>\n</template>\n\n<style scoped>\n.empty-state {\n margin: 10px 0 10px 12px;\n text-align: center;\n font-size: var(--scalar-mini);\n min-height: 56px;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: var(--scalar-radius-lg);\n color: var(--scalar-color-2);\n}\n\n.rule-title {\n font-family: var(--scalar-font-code);\n color: var(--scalar-color-1);\n display: inline-block;\n margin: 12px 0 6px;\n border-radius: var(--scalar-radius);\n}\n\n.rule {\n margin: 0 12px 0;\n border-radius: var(--scalar-radius-lg);\n}\n\n.rule-items {\n counter-reset: list-number;\n display: flex;\n flex-direction: column;\n gap: 12px;\n border-left: 1px solid var(--scalar-border-color);\n padding: 12px 0 12px;\n}\n.rule-item {\n counter-increment: list-number;\n border: 1px solid var(--scalar-border-color);\n border-radius: var(--scalar-radius-lg);\n overflow: hidden;\n margin-left: 24px;\n}\n.rule-item:before {\n /* content: counter(list-number); */\n border: 1px solid var(--scalar-border-color);\n border-top: 0;\n border-right: 0;\n content: ' ';\n display: block;\n width: 24px;\n height: 6px;\n border-radius: 0 0 0 var(--scalar-radius-lg);\n margin-top: 6px;\n color: var(--scalar-color-2);\n transform: translateX(-25px);\n color: var(--scalar-color-1);\n position: absolute;\n}\n</style>\n"],"mappings":";;;;;;;;;;;AA+CA,IAAM,2BAA2B;;;;;;;;;EA5BjC,MAAM,mBAAmB;AACvB,OAAI,QAAA,YAAY,KAAA,EACd,QAAO,mBAAmB,QAAA,QAAQ,EAAE,SAAS;AAG/C,OAAI,QAAA,UAAU,OACZ,QAAO,qBAEL,mBAAmB,QAAA,SAAS,OAAO,EACnC;IACE,aAAa;IACb,MAAM;IACP,CACH;;;EAOJ,MAAM,uBAAuB,eAAe;GAC1C,MAAM,UAAU,YAAW;AAC3B,OAAI,YAAY,KAAA,EACd;AAEF,UAAO,gBAAgB,QAAO;IAC/B;EAKD,MAAM,mBAAmB,eAAe;AACtC,OAAI,qBAAqB,UAAU,KAAA,EACjC,QAAO;AAET,UAAO,qBAAqB,MAAM,SAAS;IAC5C;;UAKS,qBAAA,UAAyB,KAAA,KAAS,CAAK,iBAAA,SAAA,WAAA,EAD/C,YAIiD,MAAA,gBAAA,EAAA;;IAF/C,OAAM;IACN,MAAK;IACJ,sBAAsB,qBAAA;4CAGZ,qBAAA,UAAyB,KAAA,KAAa,iBAAA,SAAA,WAAA,EADnD,YAIgB,MAAA,uBAAA,EAAA;;IAFd,OAAM;IACL,SAAS,qBAAA;IACV,MAAK;6CAEP,mBAIM,OAJN,YAEsB,YAEtB"}
|
|
@@ -10,8 +10,8 @@ import { useClipboard } from "@scalar/use-hooks/useClipboard";
|
|
|
10
10
|
import { getExample } from "@scalar/workspace-store/request-example";
|
|
11
11
|
import { ExamplePicker } from "@scalar/api-client/blocks/operation-code-sample";
|
|
12
12
|
import { ScalarMarkdown } from "@scalar/components/markdown";
|
|
13
|
-
import { ScalarIcon } from "@scalar/components/icon";
|
|
14
13
|
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
14
|
+
import { ScalarIcon } from "@scalar/components/icon";
|
|
15
15
|
import { objectKeys } from "@scalar/helpers/object/object-keys";
|
|
16
16
|
import { ScalarCard, ScalarCardFooter, ScalarCardSection } from "@scalar/components/card";
|
|
17
17
|
//#region src/features/example-responses/ExampleResponses.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleSchema.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-responses/ExampleSchema.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExampleSchema.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-responses/ExampleSchema.vue"],"names":[],"mappings":"AAkDA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uDAAuD,CAAA;AAC1F,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AAGtF,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,aAAa,CAAC,YAAY,CAAC,CAAA;CACpC,CAAC;AAqFF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleSchema.vue.js","names":[],"sources":["../../../src/features/example-responses/ExampleSchema.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getResolvedRefDeep } from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport {
|
|
1
|
+
{"version":3,"file":"ExampleSchema.vue.js","names":[],"sources":["../../../src/features/example-responses/ExampleSchema.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getResolvedRefDeep } from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport { ScalarVirtualCodeBlock } from '@scalar/components/virtual-code-block'\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport type { ReferenceType } from '@scalar/workspace-store/schemas/v3.1/strict/reference'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/schema'\nimport { computed } from 'vue'\n\nconst { id, schema } = defineProps<{\n id: string\n schema: ReferenceType<SchemaObject>\n}>()\n\nconst schemaContent = computed(() => {\n if (!schema) {\n return undefined\n }\n\n return prettyPrintJson(getResolvedRefDeep(schema))\n})\n\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\nconst shouldVirtualizeSchema = computed(() => {\n return (schemaContent.value?.length ?? 0) > VIRTUALIZATION_THRESHOLD\n})\n</script>\n\n<template>\n <ScalarCodeBlock\n v-if=\"!shouldVirtualizeSchema\"\n :id=\"id\"\n class=\"bg-b-2\"\n lang=\"json\"\n :prettyPrintedContent=\"schemaContent ?? ''\" />\n <ScalarVirtualCodeBlock\n v-else\n :id=\"id\"\n class=\"bg-b-2\"\n :content=\"schemaContent ?? ''\"\n lang=\"json\" />\n</template>\n"],"mappings":""}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { computed, createBlock, defineComponent, openBlock, unref } from "vue";
|
|
2
2
|
import { getResolvedRefDeep } from "@scalar/api-client/blocks/operation-code-sample";
|
|
3
3
|
import { ScalarCodeBlock } from "@scalar/components/code-block";
|
|
4
|
-
import {
|
|
4
|
+
import { ScalarVirtualCodeBlock } from "@scalar/components/virtual-code-block";
|
|
5
5
|
import { prettyPrintJson } from "@scalar/helpers/json/pretty-print-json";
|
|
6
6
|
//#region src/features/example-responses/ExampleSchema.vue?vue&type=script&setup=true&lang.ts
|
|
7
7
|
var VIRTUALIZATION_THRESHOLD = 2e4;
|
|
@@ -26,14 +26,13 @@ var ExampleSchema_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */
|
|
|
26
26
|
class: "bg-b-2",
|
|
27
27
|
lang: "json",
|
|
28
28
|
prettyPrintedContent: schemaContent.value ?? ""
|
|
29
|
-
}, null, 8, ["id", "prettyPrintedContent"])) : (openBlock(), createBlock(unref(
|
|
29
|
+
}, null, 8, ["id", "prettyPrintedContent"])) : (openBlock(), createBlock(unref(ScalarVirtualCodeBlock), {
|
|
30
30
|
key: 1,
|
|
31
31
|
id: __props.id,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}, null, 8, ["id", "text"]));
|
|
32
|
+
class: "bg-b-2",
|
|
33
|
+
content: schemaContent.value ?? "",
|
|
34
|
+
lang: "json"
|
|
35
|
+
}, null, 8, ["id", "content"]));
|
|
37
36
|
};
|
|
38
37
|
}
|
|
39
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleSchema.vue.script.js","names":[],"sources":["../../../src/features/example-responses/ExampleSchema.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getResolvedRefDeep } from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport {
|
|
1
|
+
{"version":3,"file":"ExampleSchema.vue.script.js","names":[],"sources":["../../../src/features/example-responses/ExampleSchema.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { getResolvedRefDeep } from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport { ScalarVirtualCodeBlock } from '@scalar/components/virtual-code-block'\nimport { prettyPrintJson } from '@scalar/helpers/json/pretty-print-json'\nimport type { ReferenceType } from '@scalar/workspace-store/schemas/v3.1/strict/reference'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/schema'\nimport { computed } from 'vue'\n\nconst { id, schema } = defineProps<{\n id: string\n schema: ReferenceType<SchemaObject>\n}>()\n\nconst schemaContent = computed(() => {\n if (!schema) {\n return undefined\n }\n\n return prettyPrintJson(getResolvedRefDeep(schema))\n})\n\nconst VIRTUALIZATION_THRESHOLD = 20_000\n\nconst shouldVirtualizeSchema = computed(() => {\n return (schemaContent.value?.length ?? 0) > VIRTUALIZATION_THRESHOLD\n})\n</script>\n\n<template>\n <ScalarCodeBlock\n v-if=\"!shouldVirtualizeSchema\"\n :id=\"id\"\n class=\"bg-b-2\"\n lang=\"json\"\n :prettyPrintedContent=\"schemaContent ?? ''\" />\n <ScalarVirtualCodeBlock\n v-else\n :id=\"id\"\n class=\"bg-b-2\"\n :content=\"schemaContent ?? ''\"\n lang=\"json\" />\n</template>\n"],"mappings":";;;;;;AAsBA,IAAM,2BAA2B;;;;;;;;EARjC,MAAM,gBAAgB,eAAe;AACnC,OAAI,CAAC,QAAA,OACH;AAGF,UAAO,gBAAgB,mBAAmB,QAAA,OAAO,CAAA;IAClD;EAID,MAAM,yBAAyB,eAAe;AAC5C,WAAQ,cAAc,OAAO,UAAU,KAAK;IAC7C;;WAKU,uBAAA,SAAA,WAAA,EADT,YAKgD,MAAA,gBAAA,EAAA;;IAH7C,IAAI,QAAA;IACL,OAAM;IACN,MAAK;IACJ,sBAAsB,cAAA,SAAa;gEACtC,YAKgB,MAAA,uBAAA,EAAA;;IAHb,IAAI,QAAA;IACL,OAAM;IACL,SAAS,cAAA,SAAa;IACvB,MAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contact.vue.d.ts","sourceRoot":"","sources":["../../../src/features/info-object/Contact.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Contact.vue.d.ts","sourceRoot":"","sources":["../../../src/features/info-object/Contact.vue"],"names":[],"mappings":"AA2DA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AAWjG,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,aAAa,CAAA;CACtB,CAAC;AAmGF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contact.vue.js","names":[],"sources":["../../../src/features/info-object/Contact.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconEnvelopeSimple } from '@scalar/icons'\nimport { cva } from '@scalar/use-hooks/useBindCx'\nimport type { ContactObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nconst variants = cva({\n base: 'text-c-1 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 group-last:mr-0 xl:border-none',\n variants: {\n link: {\n true: 'no-underline hover:bg-b-2',\n },\n },\n})\n\ndefineProps<{\n value?: ContactObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n v-if=\"value
|
|
1
|
+
{"version":3,"file":"Contact.vue.js","names":[],"sources":["../../../src/features/info-object/Contact.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconEnvelopeSimple, ScalarIconLink } from '@scalar/icons'\nimport { cva } from '@scalar/use-hooks/useBindCx'\nimport type { ContactObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nconst variants = cva({\n base: 'text-c-1 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 group-last:mr-0 xl:border-none',\n variants: {\n link: {\n true: 'no-underline hover:bg-b-2',\n },\n },\n})\n\ndefineProps<{\n value?: ContactObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n v-if=\"value.email\"\n :class=\"variants({ link: true })\"\n :href=\"`mailto:${value.email}`\">\n <ScalarIconEnvelopeSimple\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value.name }}</span>\n </a>\n <a\n v-if=\"value.url\"\n :class=\"variants({ link: true })\"\n :href=\"value.url\"\n rel=\"noopener noreferrer\"\n target=\"_blank\">\n <ScalarIconLink\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <!-- Avoid repeating the name when the email link already shows it -->\n <span class=\"ml-1 empty:hidden\">{{\n value.email ? '' : value.name\n }}</span>\n </a>\n <span\n v-else-if=\"!value.email && value.name\"\n :class=\"variants({ link: false })\">\n {{ value.name }}\n </span>\n </div>\n </template>\n</template>\n"],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, toDisplayString, unref } from "vue";
|
|
2
|
-
import { ScalarIconEnvelopeSimple } from "@scalar/icons";
|
|
2
|
+
import { ScalarIconEnvelopeSimple, ScalarIconLink } from "@scalar/icons";
|
|
3
3
|
import { cva } from "@scalar/use-hooks/useBindCx";
|
|
4
4
|
//#region src/features/info-object/Contact.vue?vue&type=script&setup=true&lang.ts
|
|
5
5
|
var _hoisted_1 = {
|
|
@@ -8,6 +8,8 @@ var _hoisted_1 = {
|
|
|
8
8
|
};
|
|
9
9
|
var _hoisted_2 = ["href"];
|
|
10
10
|
var _hoisted_3 = { class: "ml-1 empty:hidden" };
|
|
11
|
+
var _hoisted_4 = ["href"];
|
|
12
|
+
var _hoisted_5 = { class: "ml-1 empty:hidden" };
|
|
11
13
|
var Contact_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
12
14
|
__name: "Contact",
|
|
13
15
|
props: { value: {} },
|
|
@@ -17,15 +19,24 @@ var Contact_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
17
19
|
variants: { link: { true: "no-underline hover:bg-b-2" } }
|
|
18
20
|
});
|
|
19
21
|
return (_ctx, _cache) => {
|
|
20
|
-
return __props.value ? (openBlock(), createElementBlock("div", _hoisted_1, [__props.value
|
|
22
|
+
return __props.value ? (openBlock(), createElementBlock("div", _hoisted_1, [__props.value.email ? (openBlock(), createElementBlock("a", {
|
|
21
23
|
key: 0,
|
|
22
24
|
class: normalizeClass(unref(variants)({ link: true })),
|
|
23
|
-
href: `mailto:${__props.value
|
|
25
|
+
href: `mailto:${__props.value.email}`
|
|
24
26
|
}, [createVNode(unref(ScalarIconEnvelopeSimple), {
|
|
25
27
|
weight: "bold",
|
|
26
28
|
class: "size-3 text-current"
|
|
27
|
-
}), createElementVNode("span", _hoisted_3, toDisplayString(__props.value.name), 1)], 10, _hoisted_2)) : __props.value
|
|
29
|
+
}), createElementVNode("span", _hoisted_3, toDisplayString(__props.value.name), 1)], 10, _hoisted_2)) : createCommentVNode("", true), __props.value.url ? (openBlock(), createElementBlock("a", {
|
|
28
30
|
key: 1,
|
|
31
|
+
class: normalizeClass(unref(variants)({ link: true })),
|
|
32
|
+
href: __props.value.url,
|
|
33
|
+
rel: "noopener noreferrer",
|
|
34
|
+
target: "_blank"
|
|
35
|
+
}, [createVNode(unref(ScalarIconLink), {
|
|
36
|
+
weight: "bold",
|
|
37
|
+
class: "size-3 text-current"
|
|
38
|
+
}), createElementVNode("span", _hoisted_5, toDisplayString(__props.value.email ? "" : __props.value.name), 1)], 10, _hoisted_4)) : !__props.value.email && __props.value.name ? (openBlock(), createElementBlock("span", {
|
|
39
|
+
key: 2,
|
|
29
40
|
class: normalizeClass(unref(variants)({ link: false }))
|
|
30
41
|
}, toDisplayString(__props.value.name), 3)) : createCommentVNode("", true)])) : createCommentVNode("", true);
|
|
31
42
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Contact.vue.script.js","names":[],"sources":["../../../src/features/info-object/Contact.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconEnvelopeSimple } from '@scalar/icons'\nimport { cva } from '@scalar/use-hooks/useBindCx'\nimport type { ContactObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nconst variants = cva({\n base: 'text-c-1 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 group-last:mr-0 xl:border-none',\n variants: {\n link: {\n true: 'no-underline hover:bg-b-2',\n },\n },\n})\n\ndefineProps<{\n value?: ContactObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n v-if=\"value
|
|
1
|
+
{"version":3,"file":"Contact.vue.script.js","names":[],"sources":["../../../src/features/info-object/Contact.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarIconEnvelopeSimple, ScalarIconLink } from '@scalar/icons'\nimport { cva } from '@scalar/use-hooks/useBindCx'\nimport type { ContactObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nconst variants = cva({\n base: 'text-c-1 mr-2 flex min-h-7 min-w-7 items-center rounded-lg border px-2 py-1 group-last:mr-0 xl:border-none',\n variants: {\n link: {\n true: 'no-underline hover:bg-b-2',\n },\n },\n})\n\ndefineProps<{\n value?: ContactObject\n}>()\n</script>\n\n<template>\n <template v-if=\"value\">\n <div\n class=\"group flex items-center last:border-r-0 xl:border-r xl:first:ml-auto\">\n <a\n v-if=\"value.email\"\n :class=\"variants({ link: true })\"\n :href=\"`mailto:${value.email}`\">\n <ScalarIconEnvelopeSimple\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <span class=\"ml-1 empty:hidden\">{{ value.name }}</span>\n </a>\n <a\n v-if=\"value.url\"\n :class=\"variants({ link: true })\"\n :href=\"value.url\"\n rel=\"noopener noreferrer\"\n target=\"_blank\">\n <ScalarIconLink\n weight=\"bold\"\n class=\"size-3 text-current\" />\n <!-- Avoid repeating the name when the email link already shows it -->\n <span class=\"ml-1 empty:hidden\">{{\n value.email ? '' : value.name\n }}</span>\n </a>\n <span\n v-else-if=\"!value.email && value.name\"\n :class=\"variants({ link: false })\">\n {{ value.name }}\n </span>\n </div>\n </template>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;EAKA,MAAM,WAAW,IAAI;GACnB,MAAM;GACN,UAAU,EACR,MAAM,EACJ,MAAM,6BACP,EACF;GACF,CAAA;;UAQiB,QAAA,SAAA,WAAA,EACd,mBA8BM,OA9BN,YA8BM,CA3BI,QAAA,MAAM,SAAA,WAAA,EADd,mBAQI,KAAA;;IAND,OAAK,eAAE,MAAA,SAAQ,CAAA,EAAA,MAAA,MAAA,CAAA,CAAA;IACf,MAAI,UAAY,QAAA,MAAM;OACvB,YAEgC,MAAA,yBAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OACR,mBAAuD,QAAvD,YAAuD,gBAApB,QAAA,MAAM,KAAI,EAAA,EAAA,CAAA,EAAA,IAAA,WAAA,IAAA,mBAAA,IAAA,KAAA,EAGvC,QAAA,MAAM,OAAA,WAAA,EADd,mBAaI,KAAA;;IAXD,OAAK,eAAE,MAAA,SAAQ,CAAA,EAAA,MAAA,MAAA,CAAA,CAAA;IACf,MAAM,QAAA,MAAM;IACb,KAAI;IACJ,QAAO;OACP,YAEgC,MAAA,eAAA,EAAA;IAD9B,QAAO;IACP,OAAM;OAER,mBAES,QAFT,YAES,gBADP,QAAA,MAAM,QAAK,KAAQ,QAAA,MAAM,KAAI,EAAA,EAAA,CAAA,EAAA,IAAA,WAAA,IAAA,CAInB,QAAA,MAAM,SAAS,QAAA,MAAM,QAAA,WAAA,EADnC,mBAIO,QAAA;;IAFJ,OAAK,eAAE,MAAA,SAAQ,CAAA,EAAA,MAAA,OAAA,CAAA,CAAA;sBACb,QAAA,MAAM,KAAI,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA,CAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
2
|
/**
|
|
3
3
|
* Loads the default HTTP client from storage and applies it to the workspace.
|
|
4
|
-
* Only updates if no default client is already set.
|
|
4
|
+
* Only updates if no default client is already set. Accepts both built-in client
|
|
5
|
+
* ids and custom sample ids (e.g. `custom/python`) so a custom selection persists.
|
|
5
6
|
*/
|
|
6
7
|
export declare const loadClientFromStorage: (store: WorkspaceStore) => void;
|
|
7
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-from-perssistance.d.ts","sourceRoot":"","sources":["../../src/helpers/load-from-perssistance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAIpE
|
|
1
|
+
{"version":3,"file":"load-from-perssistance.d.ts","sourceRoot":"","sources":["../../src/helpers/load-from-perssistance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAIpE;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,OAAO,cAAc,KAAG,IAM7D,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,cAAc,EAAE,MAAM,MAAM,KAAG,IAIzE,CAAA"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { authStorage, clientStorage } from "./storage.js";
|
|
2
|
-
import {
|
|
2
|
+
import { isSelectedClient } from "@scalar/api-client/blocks/operation-code-sample";
|
|
3
3
|
//#region src/helpers/load-from-perssistance.ts
|
|
4
4
|
/**
|
|
5
5
|
* Loads the default HTTP client from storage and applies it to the workspace.
|
|
6
|
-
* Only updates if no default client is already set.
|
|
6
|
+
* Only updates if no default client is already set. Accepts both built-in client
|
|
7
|
+
* ids and custom sample ids (e.g. `custom/python`) so a custom selection persists.
|
|
7
8
|
*/
|
|
8
9
|
var loadClientFromStorage = (store) => {
|
|
9
10
|
const storedClient = clientStorage().get();
|
|
10
|
-
if (
|
|
11
|
+
if (isSelectedClient(storedClient) && !store.workspace["x-scalar-default-client"]) store.update("x-scalar-default-client", storedClient);
|
|
11
12
|
};
|
|
12
13
|
/**
|
|
13
14
|
* Loads the authentication data from storage and applies it to the workspace.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load-from-perssistance.js","names":[],"sources":["../../src/helpers/load-from-perssistance.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"load-from-perssistance.js","names":[],"sources":["../../src/helpers/load-from-perssistance.ts"],"sourcesContent":["import { isSelectedClient } from '@scalar/api-client/blocks/operation-code-sample'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\n\nimport { authStorage, clientStorage } from '@/helpers/storage'\n\n/**\n * Loads the default HTTP client from storage and applies it to the workspace.\n * Only updates if no default client is already set. Accepts both built-in client\n * ids and custom sample ids (e.g. `custom/python`) so a custom selection persists.\n */\nexport const loadClientFromStorage = (store: WorkspaceStore): void => {\n const storedClient = clientStorage().get()\n\n if (isSelectedClient(storedClient) && !store.workspace['x-scalar-default-client']) {\n store.update('x-scalar-default-client', storedClient)\n }\n}\n\n/**\n * Loads the authentication data from storage and applies it to the workspace.\n * Only updates if no authentication data is already set.\n */\nexport const loadAuthFromStorage = (store: WorkspaceStore, slug: string): void => {\n const authPersistence = authStorage()\n const auth = authPersistence.getAuth(slug)\n store.auth.load({ [slug]: auth })\n}\n"],"mappings":";;;;;;;;AAUA,IAAa,yBAAyB,UAAgC;CACpE,MAAM,eAAe,eAAe,CAAC,KAAK;AAE1C,KAAI,iBAAiB,aAAa,IAAI,CAAC,MAAM,UAAU,2BACrD,OAAM,OAAO,2BAA2B,aAAa;;;;;;AAQzD,IAAa,uBAAuB,OAAuB,SAAuB;CAEhF,MAAM,OADkB,aAAa,CACR,QAAQ,KAAK;AAC1C,OAAM,KAAK,KAAK,GAAG,OAAO,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-api.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-api.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"html-api.d.ts","sourceRoot":"","sources":["../../../src/standalone/lib/html-api.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,mCAAmC,EACnC,kBAAkB,EACnB,MAAM,6BAA6B,CAAA;AAqEpC;;GAEG;AACH,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,QAAQ,GAAG,mCAAmC,CA+GrG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,QAAQ,EAAE,aAAa,EAAE,mCAAmC,QAiBnG;AAID,eAAO,MAAM,eAAe,GAAI,KAAK,QAAQ,EAAE,UAAU,OAAO,GAAG,IAAI,mBAatE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,kBAkJhC,CAAA"}
|
|
@@ -4,6 +4,56 @@ import "@scalar/schemas/api-reference";
|
|
|
4
4
|
import { createHead } from "@unhead/vue/client";
|
|
5
5
|
//#region src/standalone/lib/html-api.ts
|
|
6
6
|
/**
|
|
7
|
+
* The id given to the standalone build's single injected `<style>` tag.
|
|
8
|
+
* Keep in sync with `vite.standalone.config.ts` and `vite.standalone.esm.config.ts`.
|
|
9
|
+
*/
|
|
10
|
+
var STANDALONE_STYLE_ID = "scalar-style";
|
|
11
|
+
/**
|
|
12
|
+
* Per-document bookkeeping for the standalone build's injected styles.
|
|
13
|
+
*
|
|
14
|
+
* The CDN build injects all of its CSS into one `<style>` tag in `<head>`. Under
|
|
15
|
+
* SPA-style navigation (Turbo Drive, htmx boost, Astro view transitions) the host
|
|
16
|
+
* swaps the DOM without reloading the window, so those document-level styles
|
|
17
|
+
* (`@layer scalar-base`, the `:root` theme variables) would otherwise linger and
|
|
18
|
+
* bleed into the host app's next page. We reference-count the live instances and
|
|
19
|
+
* detach the styles when the last one is destroyed, re-attaching them when a new
|
|
20
|
+
* instance mounts so navigating back to the reference is still styled.
|
|
21
|
+
*
|
|
22
|
+
* State is keyed by document so the counter survives navigations (the JS context
|
|
23
|
+
* persists) while staying isolated per page.
|
|
24
|
+
*/
|
|
25
|
+
var standaloneStyleState = /* @__PURE__ */ new WeakMap();
|
|
26
|
+
var getStandaloneStyleState = (doc) => {
|
|
27
|
+
const existing = standaloneStyleState.get(doc);
|
|
28
|
+
if (existing) return existing;
|
|
29
|
+
const state = {
|
|
30
|
+
count: 0,
|
|
31
|
+
detachedStyle: null
|
|
32
|
+
};
|
|
33
|
+
standaloneStyleState.set(doc, state);
|
|
34
|
+
return state;
|
|
35
|
+
};
|
|
36
|
+
/** Track a freshly mounted instance and restore previously detached styles. */
|
|
37
|
+
var retainStandaloneStyles = (doc) => {
|
|
38
|
+
const state = getStandaloneStyleState(doc);
|
|
39
|
+
state.count += 1;
|
|
40
|
+
if (state.detachedStyle && !doc.getElementById(STANDALONE_STYLE_ID)) {
|
|
41
|
+
doc.head.appendChild(state.detachedStyle);
|
|
42
|
+
state.detachedStyle = null;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
/** Release an instance and detach the injected styles once the last one is gone. */
|
|
46
|
+
var releaseStandaloneStyles = (doc) => {
|
|
47
|
+
const state = getStandaloneStyleState(doc);
|
|
48
|
+
state.count = Math.max(0, state.count - 1);
|
|
49
|
+
if (state.count > 0) return;
|
|
50
|
+
const styleElement = doc.getElementById(STANDALONE_STYLE_ID);
|
|
51
|
+
if (styleElement instanceof HTMLStyleElement) {
|
|
52
|
+
state.detachedStyle = styleElement;
|
|
53
|
+
styleElement.remove();
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
7
57
|
* Create (and mount) a new Scalar API Reference
|
|
8
58
|
*
|
|
9
59
|
* @example createApiReference({ url: '/scalar.json' }).mount('#app')
|
|
@@ -21,8 +71,12 @@ var createApiReference = (elementOrSelectorOrConfig, optionalConfiguration) => {
|
|
|
21
71
|
};
|
|
22
72
|
const mountElement = optionalConfiguration ? typeof elementOrSelectorOrConfig === "string" ? document.querySelector(elementOrSelectorOrConfig) : elementOrSelectorOrConfig : null;
|
|
23
73
|
let app = createReferenceApp(!!optionalConfiguration && !!mountElement && mountElement.children.length > 0);
|
|
24
|
-
|
|
25
|
-
|
|
74
|
+
let hasMounted = false;
|
|
75
|
+
if (optionalConfiguration) if (mountElement) {
|
|
76
|
+
app.mount(mountElement);
|
|
77
|
+
hasMounted = true;
|
|
78
|
+
retainStandaloneStyles(document);
|
|
79
|
+
} else console.error("Could not find a mount point for API References:", elementOrSelectorOrConfig);
|
|
26
80
|
const abortController = new AbortController();
|
|
27
81
|
const listenerOptions = {
|
|
28
82
|
capture: false,
|
|
@@ -47,6 +101,10 @@ var createApiReference = (elementOrSelectorOrConfig, optionalConfiguration) => {
|
|
|
47
101
|
abortController.abort();
|
|
48
102
|
props.configuration = {};
|
|
49
103
|
app.unmount();
|
|
104
|
+
if (hasMounted) {
|
|
105
|
+
hasMounted = false;
|
|
106
|
+
releaseStandaloneStyles(document);
|
|
107
|
+
}
|
|
50
108
|
};
|
|
51
109
|
/**
|
|
52
110
|
* Allow user to destroy the API Reference
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"html-api.js","names":[],"sources":["../../../src/standalone/lib/html-api.ts"],"sourcesContent":["import type {\n AnyApiReferenceConfiguration,\n ApiReferenceConfigurationWithSource,\n CreateApiReference,\n} from '@scalar/types/api-reference'\nimport { apiReferenceConfigurationWithSourceSchema } from '@scalar/schemas/api-reference'\nimport { createHead } from '@unhead/vue/client'\nimport { createApp, createSSRApp, h, reactive } from 'vue'\n\nimport { default as ApiReference } from '@/components/ApiReference.vue'\n\nconst getSpecScriptTag = (doc: Document) => doc.getElementById('api-reference')\n\n/**\n * Reading the configuration from the data-attributes.\n */\nexport function getConfigurationFromDataAttributes(doc: Document): ApiReferenceConfigurationWithSource {\n const specElement = doc.querySelector('[data-spec]')\n const specUrlElement = doc.querySelector('[data-spec-url]')\n const configurationScriptElement = doc.querySelector('#api-reference[data-configuration]')\n\n const getConfiguration = () => {\n // <script data-configuration=\"{ … }\" />\n if (configurationScriptElement) {\n const configurationFromElement = configurationScriptElement.getAttribute('data-configuration')\n\n if (configurationFromElement) {\n return {\n _integration: 'html',\n ...JSON.parse(configurationFromElement.split('"').join('\"')),\n }\n }\n }\n\n return apiReferenceConfigurationWithSourceSchema({ _integration: 'html' })\n }\n\n const getUrl = () => {\n // Let's first check if the user passed a spec URL in the configuration.\n if (getConfiguration().url) {\n return getConfiguration().url\n }\n\n if (getConfiguration().spec?.url) {\n return getConfiguration().spec?.url\n }\n\n // <script id=\"api-reference\" data-url=\"/scalar.json\" />\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const urlFromScriptTag = specScriptTag.getAttribute('data-url')?.trim()\n\n if (urlFromScriptTag) {\n return urlFromScriptTag\n }\n }\n\n // <div data-spec-url=\"/scalar.json\" />\n if (specUrlElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec-url] HTML API is deprecated. Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead.',\n )\n const urlFromSpecUrlElement = specUrlElement.getAttribute('data-spec-url')\n\n if (urlFromSpecUrlElement) {\n return urlFromSpecUrlElement\n }\n }\n\n return undefined\n }\n\n const getContent = (): string | undefined => {\n // <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const specFromScriptTag = specScriptTag.innerHTML?.trim()\n\n if (specFromScriptTag) {\n return specFromScriptTag\n }\n }\n\n // <div data-spec='{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}' />\n if (specElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec] HTML API is deprecated. Use the new <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script> API instead.',\n )\n const specFromSpecElement = specElement.getAttribute('data-spec')?.trim()\n\n if (specFromSpecElement) {\n return specFromSpecElement\n }\n }\n\n return undefined\n }\n\n const getProxyUrl = () => {\n // <script id=\"api-reference\" data-proxy-url=\"https://proxy.scalar.com\">…</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const proxyUrl = specScriptTag.getAttribute('data-proxy-url')\n\n if (proxyUrl) {\n return proxyUrl.trim()\n }\n }\n\n return undefined\n }\n\n // Ensure Reference Props are reactive\n if (!specUrlElement && !specElement && !getSpecScriptTag(doc)) {\n // Stay quiet.\n } else {\n const urlOrContent = getContent() ? { content: getContent() } : { url: getUrl() }\n\n return apiReferenceConfigurationWithSourceSchema({\n _integration: 'html',\n proxyUrl: getProxyUrl(),\n ...getConfiguration(),\n ...urlOrContent,\n })\n }\n\n return apiReferenceConfigurationWithSourceSchema({ _integration: 'html' })\n}\n\n/**\n * Mount the Scalar API Reference on a given document.\n * Read the HTML data-attributes for configuration.\n */\nexport function findDataAttributes(doc: Document, configuration: ApiReferenceConfigurationWithSource) {\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specElement = doc.querySelector('[data-spec]')\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specUrlElement = doc.querySelector('[data-spec-url]')\n\n if (configuration?.darkMode) {\n doc.body?.classList.add('dark-mode')\n } else {\n doc.body?.classList.add('light-mode')\n }\n\n const container = createContainer(doc, specElement || specUrlElement)\n\n if (container) {\n createApiReference(container, configuration)\n }\n}\n\n// If it's a script tag, we can't mount the Vue.js app inside that tag.\n// We need to add a new container element before the script tag.\nexport const createContainer = (doc: Document, element?: Element | null) => {\n let _container: Element | null = null\n\n const specScriptTag = getSpecScriptTag(doc)\n\n if (specScriptTag) {\n _container = doc.createElement('div')\n specScriptTag?.parentNode?.insertBefore(_container, specScriptTag)\n } else if (element) {\n _container = element\n }\n\n return _container\n}\n\n/**\n * Create (and mount) a new Scalar API Reference\n *\n * @example createApiReference({ url: '/scalar.json' }).mount('#app')\n * @example createApiReference('#app', { url: '/scalar.json' })\n * @example createApiReference(document.getElementById('app'), { url: '/scalar.json' })\n */\nexport const createApiReference: CreateApiReference = (\n elementOrSelectorOrConfig,\n optionalConfiguration?: AnyApiReferenceConfiguration,\n) => {\n // Create an id prefix for useId so we don't have collisions with other Vue apps\n const idPrefix = 'scalar-refs'\n\n const props = reactive<{ configuration: AnyApiReferenceConfiguration }>({\n // Either the configuration will be the second argument or it MUST be the first (configuration only)\n configuration: optionalConfiguration ?? (elementOrSelectorOrConfig as AnyApiReferenceConfiguration) ?? {},\n })\n\n const createReferenceApp = (isSsr = false) => {\n const referenceApp = isSsr ? createSSRApp(() => h(ApiReference, props)) : createApp(() => h(ApiReference, props))\n\n // Meta tags, etc.\n referenceApp.use(createHead())\n referenceApp.config.idPrefix = idPrefix\n\n return referenceApp\n }\n\n // If we have an optional config, then we must mount the element immediately (not sure why type is not narrowing)\n const mountElement = optionalConfiguration\n ? typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n : null\n\n // Detect server-rendered content and use createSSRApp for hydration\n const shouldHydrate = !!optionalConfiguration && !!mountElement && mountElement.children.length > 0\n let app = createReferenceApp(shouldHydrate)\n\n if (optionalConfiguration) {\n if (mountElement) {\n app.mount(mountElement)\n } else {\n console.error('Could not find a mount point for API References:', elementOrSelectorOrConfig)\n }\n }\n\n // Tie the deprecated `document` listeners to an AbortController so `destroy`\n // can remove them all at once. Without this, every `createApiReference()`\n // call leaks three permanent listeners — visible during Astro view\n // transitions where each navigation creates a new instance.\n const abortController = new AbortController()\n const listenerOptions: AddEventListenerOptions = {\n capture: false,\n signal: abortController.signal,\n }\n\n /**\n * Reload the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:reload-references',\n () => {\n console.warn(\n 'scalar:reload-references event has been deprecated, please use the scalarInstance.app.mount method instead.',\n )\n if (!props.configuration) {\n return\n }\n\n // Snag the current element\n const currentElement =\n typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n\n if (!currentElement) {\n return\n }\n\n // Ensure we re-attach the element if it was unmounted\n if (currentElement && !document.body.contains(currentElement)) {\n document.body.appendChild(currentElement)\n }\n\n // Create a new Vue app instance\n app.unmount()\n app = createReferenceApp()\n app.mount(currentElement)\n },\n listenerOptions,\n )\n\n /** Destroy the current API Reference instance */\n const destroy = () => {\n abortController.abort()\n props.configuration = {}\n app.unmount()\n }\n\n /**\n * Allow user to destroy the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:destroy-references',\n () => {\n console.warn('scalar:destroy-references event has been deprecated, please use scalarInstance.destroy instead.')\n destroy()\n },\n listenerOptions,\n )\n\n /**\n * Allow user to update configuration\n * @deprecated\n */\n document.addEventListener(\n 'scalar:update-references-config',\n (ev) => {\n console.warn(\n 'scalar:update-references-config event has been deprecated, please use scalarInstance.updateConfiguration instead.',\n )\n if ('detail' in ev) {\n Object.assign(props, ev.detail)\n }\n },\n listenerOptions,\n )\n\n const instance = {\n app,\n getConfiguration: () => props.configuration ?? {},\n updateConfiguration: (newConfig: AnyApiReferenceConfiguration) => {\n props.configuration = newConfig\n },\n destroy,\n }\n\n return instance\n}\n"],"mappings":";;;;;;;;;;;;AAgLA,IAAa,sBACX,2BACA,0BACG;CAEH,MAAM,WAAW;CAEjB,MAAM,QAAQ,SAA0D,EAEtE,eAAe,yBAA0B,6BAA8D,EAAE,EAC1G,CAAC;CAEF,MAAM,sBAAsB,QAAQ,UAAU;EAC5C,MAAM,eAAe,QAAQ,mBAAmB,EAAE,sBAAc,MAAM,CAAC,GAAG,gBAAgB,EAAE,sBAAc,MAAM,CAAC;AAGjH,eAAa,IAAI,YAAY,CAAC;AAC9B,eAAa,OAAO,WAAW;AAE/B,SAAO;;CAIT,MAAM,eAAe,wBACjB,OAAO,8BAA8B,WACnC,SAAS,cAAc,0BAA0B,GAChD,4BACH;CAIJ,IAAI,MAAM,mBADY,CAAC,CAAC,yBAAyB,CAAC,CAAC,gBAAgB,aAAa,SAAS,SAAS,EACvD;AAE3C,KAAI,sBACF,KAAI,aACF,KAAI,MAAM,aAAa;KAEvB,SAAQ,MAAM,oDAAoD,0BAA0B;CAQhG,MAAM,kBAAkB,IAAI,iBAAiB;CAC7C,MAAM,kBAA2C;EAC/C,SAAS;EACT,QAAQ,gBAAgB;EACzB;;;;;AAMD,UAAS,iBACP,kCACM;AACJ,UAAQ,KACN,8GACD;AACD,MAAI,CAAC,MAAM,cACT;EAIF,MAAM,iBACJ,OAAO,8BAA8B,WACjC,SAAS,cAAc,0BAA0B,GAChD;AAEP,MAAI,CAAC,eACH;AAIF,MAAI,kBAAkB,CAAC,SAAS,KAAK,SAAS,eAAe,CAC3D,UAAS,KAAK,YAAY,eAAe;AAI3C,MAAI,SAAS;AACb,QAAM,oBAAoB;AAC1B,MAAI,MAAM,eAAe;IAE3B,gBACD;;CAGD,MAAM,gBAAgB;AACpB,kBAAgB,OAAO;AACvB,QAAM,gBAAgB,EAAE;AACxB,MAAI,SAAS;;;;;;AAOf,UAAS,iBACP,mCACM;AACJ,UAAQ,KAAK,kGAAkG;AAC/G,WAAS;IAEX,gBACD;;;;;AAMD,UAAS,iBACP,oCACC,OAAO;AACN,UAAQ,KACN,oHACD;AACD,MAAI,YAAY,GACd,QAAO,OAAO,OAAO,GAAG,OAAO;IAGnC,gBACD;AAWD,QATiB;EACf;EACA,wBAAwB,MAAM,iBAAiB,EAAE;EACjD,sBAAsB,cAA4C;AAChE,SAAM,gBAAgB;;EAExB;EACD"}
|
|
1
|
+
{"version":3,"file":"html-api.js","names":[],"sources":["../../../src/standalone/lib/html-api.ts"],"sourcesContent":["import { apiReferenceConfigurationWithSourceSchema } from '@scalar/schemas/api-reference'\nimport type {\n AnyApiReferenceConfiguration,\n ApiReferenceConfigurationWithSource,\n CreateApiReference,\n} from '@scalar/types/api-reference'\nimport { createHead } from '@unhead/vue/client'\nimport { createApp, createSSRApp, h, reactive } from 'vue'\n\nimport { default as ApiReference } from '@/components/ApiReference.vue'\n\nconst getSpecScriptTag = (doc: Document) => doc.getElementById('api-reference')\n\n/**\n * The id given to the standalone build's single injected `<style>` tag.\n * Keep in sync with `vite.standalone.config.ts` and `vite.standalone.esm.config.ts`.\n */\nconst STANDALONE_STYLE_ID = 'scalar-style'\n\n/**\n * Per-document bookkeeping for the standalone build's injected styles.\n *\n * The CDN build injects all of its CSS into one `<style>` tag in `<head>`. Under\n * SPA-style navigation (Turbo Drive, htmx boost, Astro view transitions) the host\n * swaps the DOM without reloading the window, so those document-level styles\n * (`@layer scalar-base`, the `:root` theme variables) would otherwise linger and\n * bleed into the host app's next page. We reference-count the live instances and\n * detach the styles when the last one is destroyed, re-attaching them when a new\n * instance mounts so navigating back to the reference is still styled.\n *\n * State is keyed by document so the counter survives navigations (the JS context\n * persists) while staying isolated per page.\n */\nconst standaloneStyleState = new WeakMap<Document, { count: number; detachedStyle: HTMLStyleElement | null }>()\n\nconst getStandaloneStyleState = (doc: Document): { count: number; detachedStyle: HTMLStyleElement | null } => {\n const existing = standaloneStyleState.get(doc)\n if (existing) {\n return existing\n }\n\n const state = { count: 0, detachedStyle: null }\n standaloneStyleState.set(doc, state)\n\n return state\n}\n\n/** Track a freshly mounted instance and restore previously detached styles. */\nconst retainStandaloneStyles = (doc: Document): void => {\n const state = getStandaloneStyleState(doc)\n state.count += 1\n\n if (state.detachedStyle && !doc.getElementById(STANDALONE_STYLE_ID)) {\n doc.head.appendChild(state.detachedStyle)\n state.detachedStyle = null\n }\n}\n\n/** Release an instance and detach the injected styles once the last one is gone. */\nconst releaseStandaloneStyles = (doc: Document): void => {\n const state = getStandaloneStyleState(doc)\n state.count = Math.max(0, state.count - 1)\n\n if (state.count > 0) {\n return\n }\n\n const styleElement = doc.getElementById(STANDALONE_STYLE_ID)\n if (styleElement instanceof HTMLStyleElement) {\n state.detachedStyle = styleElement\n styleElement.remove()\n }\n}\n\n/**\n * Reading the configuration from the data-attributes.\n */\nexport function getConfigurationFromDataAttributes(doc: Document): ApiReferenceConfigurationWithSource {\n const specElement = doc.querySelector('[data-spec]')\n const specUrlElement = doc.querySelector('[data-spec-url]')\n const configurationScriptElement = doc.querySelector('#api-reference[data-configuration]')\n\n const getConfiguration = () => {\n // <script data-configuration=\"{ … }\" />\n if (configurationScriptElement) {\n const configurationFromElement = configurationScriptElement.getAttribute('data-configuration')\n\n if (configurationFromElement) {\n return {\n _integration: 'html',\n ...JSON.parse(configurationFromElement.split('"').join('\"')),\n }\n }\n }\n\n return apiReferenceConfigurationWithSourceSchema({ _integration: 'html' })\n }\n\n const getUrl = () => {\n // Let's first check if the user passed a spec URL in the configuration.\n if (getConfiguration().url) {\n return getConfiguration().url\n }\n\n if (getConfiguration().spec?.url) {\n return getConfiguration().spec?.url\n }\n\n // <script id=\"api-reference\" data-url=\"/scalar.json\" />\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const urlFromScriptTag = specScriptTag.getAttribute('data-url')?.trim()\n\n if (urlFromScriptTag) {\n return urlFromScriptTag\n }\n }\n\n // <div data-spec-url=\"/scalar.json\" />\n if (specUrlElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec-url] HTML API is deprecated. Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead.',\n )\n const urlFromSpecUrlElement = specUrlElement.getAttribute('data-spec-url')\n\n if (urlFromSpecUrlElement) {\n return urlFromSpecUrlElement\n }\n }\n\n return undefined\n }\n\n const getContent = (): string | undefined => {\n // <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const specFromScriptTag = specScriptTag.innerHTML?.trim()\n\n if (specFromScriptTag) {\n return specFromScriptTag\n }\n }\n\n // <div data-spec='{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}' />\n if (specElement) {\n console.warn(\n '[@scalar/api-reference] The [data-spec] HTML API is deprecated. Use the new <script id=\"api-reference\" type=\"application/json\">{\"openapi\":\"3.1.0\",\"info\":{\"title\":\"Example\"},\"paths\":{}}</script> API instead.',\n )\n const specFromSpecElement = specElement.getAttribute('data-spec')?.trim()\n\n if (specFromSpecElement) {\n return specFromSpecElement\n }\n }\n\n return undefined\n }\n\n const getProxyUrl = () => {\n // <script id=\"api-reference\" data-proxy-url=\"https://proxy.scalar.com\">…</script>\n const specScriptTag = getSpecScriptTag(doc)\n if (specScriptTag) {\n const proxyUrl = specScriptTag.getAttribute('data-proxy-url')\n\n if (proxyUrl) {\n return proxyUrl.trim()\n }\n }\n\n return undefined\n }\n\n // Ensure Reference Props are reactive\n if (!specUrlElement && !specElement && !getSpecScriptTag(doc)) {\n // Stay quiet.\n } else {\n const urlOrContent = getContent() ? { content: getContent() } : { url: getUrl() }\n\n return apiReferenceConfigurationWithSourceSchema({\n _integration: 'html',\n proxyUrl: getProxyUrl(),\n ...getConfiguration(),\n ...urlOrContent,\n })\n }\n\n return apiReferenceConfigurationWithSourceSchema({ _integration: 'html' })\n}\n\n/**\n * Mount the Scalar API Reference on a given document.\n * Read the HTML data-attributes for configuration.\n */\nexport function findDataAttributes(doc: Document, configuration: ApiReferenceConfigurationWithSource) {\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specElement = doc.querySelector('[data-spec]')\n /** @deprecated Use the new <script id=\"api-reference\" data-url=\"/scalar.json\" /> API instead. */\n const specUrlElement = doc.querySelector('[data-spec-url]')\n\n if (configuration?.darkMode) {\n doc.body?.classList.add('dark-mode')\n } else {\n doc.body?.classList.add('light-mode')\n }\n\n const container = createContainer(doc, specElement || specUrlElement)\n\n if (container) {\n createApiReference(container, configuration)\n }\n}\n\n// If it's a script tag, we can't mount the Vue.js app inside that tag.\n// We need to add a new container element before the script tag.\nexport const createContainer = (doc: Document, element?: Element | null) => {\n let _container: Element | null = null\n\n const specScriptTag = getSpecScriptTag(doc)\n\n if (specScriptTag) {\n _container = doc.createElement('div')\n specScriptTag?.parentNode?.insertBefore(_container, specScriptTag)\n } else if (element) {\n _container = element\n }\n\n return _container\n}\n\n/**\n * Create (and mount) a new Scalar API Reference\n *\n * @example createApiReference({ url: '/scalar.json' }).mount('#app')\n * @example createApiReference('#app', { url: '/scalar.json' })\n * @example createApiReference(document.getElementById('app'), { url: '/scalar.json' })\n */\nexport const createApiReference: CreateApiReference = (\n elementOrSelectorOrConfig,\n optionalConfiguration?: AnyApiReferenceConfiguration,\n) => {\n // Create an id prefix for useId so we don't have collisions with other Vue apps\n const idPrefix = 'scalar-refs'\n\n const props = reactive<{ configuration: AnyApiReferenceConfiguration }>({\n // Either the configuration will be the second argument or it MUST be the first (configuration only)\n configuration: optionalConfiguration ?? (elementOrSelectorOrConfig as AnyApiReferenceConfiguration) ?? {},\n })\n\n const createReferenceApp = (isSsr = false) => {\n const referenceApp = isSsr ? createSSRApp(() => h(ApiReference, props)) : createApp(() => h(ApiReference, props))\n\n // Meta tags, etc.\n referenceApp.use(createHead())\n referenceApp.config.idPrefix = idPrefix\n\n return referenceApp\n }\n\n // If we have an optional config, then we must mount the element immediately (not sure why type is not narrowing)\n const mountElement = optionalConfiguration\n ? typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n : null\n\n // Detect server-rendered content and use createSSRApp for hydration\n const shouldHydrate = !!optionalConfiguration && !!mountElement && mountElement.children.length > 0\n let app = createReferenceApp(shouldHydrate)\n\n // Track whether this instance mounted so `destroy` only releases the shared\n // standalone styles for instances that actually retained them.\n let hasMounted = false\n\n if (optionalConfiguration) {\n if (mountElement) {\n app.mount(mountElement)\n hasMounted = true\n retainStandaloneStyles(document)\n } else {\n console.error('Could not find a mount point for API References:', elementOrSelectorOrConfig)\n }\n }\n\n // Tie the deprecated `document` listeners to an AbortController so `destroy`\n // can remove them all at once. Without this, every `createApiReference()`\n // call leaks three permanent listeners — visible during Astro view\n // transitions where each navigation creates a new instance.\n const abortController = new AbortController()\n const listenerOptions: AddEventListenerOptions = {\n capture: false,\n signal: abortController.signal,\n }\n\n /**\n * Reload the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:reload-references',\n () => {\n console.warn(\n 'scalar:reload-references event has been deprecated, please use the scalarInstance.app.mount method instead.',\n )\n if (!props.configuration) {\n return\n }\n\n // Snag the current element\n const currentElement =\n typeof elementOrSelectorOrConfig === 'string'\n ? document.querySelector(elementOrSelectorOrConfig)\n : (elementOrSelectorOrConfig as Element)\n\n if (!currentElement) {\n return\n }\n\n // Ensure we re-attach the element if it was unmounted\n if (currentElement && !document.body.contains(currentElement)) {\n document.body.appendChild(currentElement)\n }\n\n // Create a new Vue app instance\n app.unmount()\n app = createReferenceApp()\n app.mount(currentElement)\n },\n listenerOptions,\n )\n\n /** Destroy the current API Reference instance */\n const destroy = () => {\n abortController.abort()\n props.configuration = {}\n app.unmount()\n\n if (hasMounted) {\n hasMounted = false\n releaseStandaloneStyles(document)\n }\n }\n\n /**\n * Allow user to destroy the API Reference\n * @deprecated\n */\n document.addEventListener(\n 'scalar:destroy-references',\n () => {\n console.warn('scalar:destroy-references event has been deprecated, please use scalarInstance.destroy instead.')\n destroy()\n },\n listenerOptions,\n )\n\n /**\n * Allow user to update configuration\n * @deprecated\n */\n document.addEventListener(\n 'scalar:update-references-config',\n (ev) => {\n console.warn(\n 'scalar:update-references-config event has been deprecated, please use scalarInstance.updateConfiguration instead.',\n )\n if ('detail' in ev) {\n Object.assign(props, ev.detail)\n }\n },\n listenerOptions,\n )\n\n const instance = {\n app,\n getConfiguration: () => props.configuration ?? {},\n updateConfiguration: (newConfig: AnyApiReferenceConfiguration) => {\n props.configuration = newConfig\n },\n destroy,\n }\n\n return instance\n}\n"],"mappings":";;;;;;;;;AAiBA,IAAM,sBAAsB;;;;;;;;;;;;;;;AAgB5B,IAAM,uCAAuB,IAAI,SAA8E;AAE/G,IAAM,2BAA2B,QAA6E;CAC5G,MAAM,WAAW,qBAAqB,IAAI,IAAI;AAC9C,KAAI,SACF,QAAO;CAGT,MAAM,QAAQ;EAAE,OAAO;EAAG,eAAe;EAAM;AAC/C,sBAAqB,IAAI,KAAK,MAAM;AAEpC,QAAO;;;AAIT,IAAM,0BAA0B,QAAwB;CACtD,MAAM,QAAQ,wBAAwB,IAAI;AAC1C,OAAM,SAAS;AAEf,KAAI,MAAM,iBAAiB,CAAC,IAAI,eAAe,oBAAoB,EAAE;AACnE,MAAI,KAAK,YAAY,MAAM,cAAc;AACzC,QAAM,gBAAgB;;;;AAK1B,IAAM,2BAA2B,QAAwB;CACvD,MAAM,QAAQ,wBAAwB,IAAI;AAC1C,OAAM,QAAQ,KAAK,IAAI,GAAG,MAAM,QAAQ,EAAE;AAE1C,KAAI,MAAM,QAAQ,EAChB;CAGF,MAAM,eAAe,IAAI,eAAe,oBAAoB;AAC5D,KAAI,wBAAwB,kBAAkB;AAC5C,QAAM,gBAAgB;AACtB,eAAa,QAAQ;;;;;;;;;;AAuKzB,IAAa,sBACX,2BACA,0BACG;CAEH,MAAM,WAAW;CAEjB,MAAM,QAAQ,SAA0D,EAEtE,eAAe,yBAA0B,6BAA8D,EAAE,EAC1G,CAAC;CAEF,MAAM,sBAAsB,QAAQ,UAAU;EAC5C,MAAM,eAAe,QAAQ,mBAAmB,EAAE,sBAAc,MAAM,CAAC,GAAG,gBAAgB,EAAE,sBAAc,MAAM,CAAC;AAGjH,eAAa,IAAI,YAAY,CAAC;AAC9B,eAAa,OAAO,WAAW;AAE/B,SAAO;;CAIT,MAAM,eAAe,wBACjB,OAAO,8BAA8B,WACnC,SAAS,cAAc,0BAA0B,GAChD,4BACH;CAIJ,IAAI,MAAM,mBADY,CAAC,CAAC,yBAAyB,CAAC,CAAC,gBAAgB,aAAa,SAAS,SAAS,EACvD;CAI3C,IAAI,aAAa;AAEjB,KAAI,sBACF,KAAI,cAAc;AAChB,MAAI,MAAM,aAAa;AACvB,eAAa;AACb,yBAAuB,SAAS;OAEhC,SAAQ,MAAM,oDAAoD,0BAA0B;CAQhG,MAAM,kBAAkB,IAAI,iBAAiB;CAC7C,MAAM,kBAA2C;EAC/C,SAAS;EACT,QAAQ,gBAAgB;EACzB;;;;;AAMD,UAAS,iBACP,kCACM;AACJ,UAAQ,KACN,8GACD;AACD,MAAI,CAAC,MAAM,cACT;EAIF,MAAM,iBACJ,OAAO,8BAA8B,WACjC,SAAS,cAAc,0BAA0B,GAChD;AAEP,MAAI,CAAC,eACH;AAIF,MAAI,kBAAkB,CAAC,SAAS,KAAK,SAAS,eAAe,CAC3D,UAAS,KAAK,YAAY,eAAe;AAI3C,MAAI,SAAS;AACb,QAAM,oBAAoB;AAC1B,MAAI,MAAM,eAAe;IAE3B,gBACD;;CAGD,MAAM,gBAAgB;AACpB,kBAAgB,OAAO;AACvB,QAAM,gBAAgB,EAAE;AACxB,MAAI,SAAS;AAEb,MAAI,YAAY;AACd,gBAAa;AACb,2BAAwB,SAAS;;;;;;;AAQrC,UAAS,iBACP,mCACM;AACJ,UAAQ,KAAK,kGAAkG;AAC/G,WAAS;IAEX,gBACD;;;;;AAMD,UAAS,iBACP,oCACC,OAAO;AACN,UAAQ,KACN,oHACD;AACD,MAAI,YAAY,GACd,QAAO,OAAO,OAAO,GAAG,OAAO;IAGnC,gBACD;AAWD,QATiB;EACf;EACA,wBAAwB,MAAM,iBAAiB,EAAE;EACjD,sBAAsB,cAA4C;AAChE,SAAM,gBAAgB;;EAExB;EACD"}
|