@scalar/api-reference 1.61.0 → 1.62.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +31 -0
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.js.map +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.script.js +8 -5
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.script.js.map +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.js.map +1 -1
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.script.js +11 -7
- package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.script.js.map +1 -1
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/AsyncApiSidebarFilters.vue.d.ts +36 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/AsyncApiSidebarFilters.vue.d.ts.map +1 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/AsyncApiSidebarFilters.vue.js +7 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/AsyncApiSidebarFilters.vue.js.map +1 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/AsyncApiSidebarFilters.vue.script.js +69 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/AsyncApiSidebarFilters.vue.script.js.map +1 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/SidebarFilter.vue.d.ts +28 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/SidebarFilter.vue.d.ts.map +1 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/SidebarFilter.vue.js +7 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/SidebarFilter.vue.js.map +1 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/SidebarFilter.vue.script.js +62 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/components/SidebarFilter.vue.script.js.map +1 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/helpers/filter-async-api-navigation.d.ts +18 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/helpers/filter-async-api-navigation.d.ts.map +1 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/helpers/filter-async-api-navigation.js +59 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/helpers/filter-async-api-navigation.js.map +1 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/index.d.ts +3 -0
- package/dist/blocks/scalar-asyncapi-sidebar-filters-block/index.d.ts.map +1 -0
- package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts +1 -1
- 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 +6 -3
- 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 -2
- 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 +4 -2
- 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-info-block/components/DownloadLink.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.script.js +3 -1
- package/dist/blocks/scalar-info-block/components/DownloadLink.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoLinks.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoLinks.vue.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/InfoLinks.vue.script.js +17 -3
- package/dist/blocks/scalar-info-block/components/InfoLinks.vue.script.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue.js +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue.js.map +1 -1
- package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue.script.js +4 -2
- package/dist/blocks/scalar-info-block/components/IntroductionLayout.vue.script.js.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.js +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.js.map +1 -1
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.script.js +16 -12
- package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.script.js.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.js.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.script.js +11 -7
- package/dist/blocks/scalar-server-selector-block/components/Selector.vue.script.js.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.d.ts.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.js.map +1 -1
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.script.js +7 -4
- package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.script.js.map +1 -1
- package/dist/browser/chunks/AgentScalarChatInterface-D7J_MHKY.js +27 -0
- package/dist/browser/chunks/ScalarTextInput.vue-Fb0snAee.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-CZI71Aau.js → modal-BLBi4S4R.js} +20 -20
- package/dist/browser/chunks/{modal-CKthJJWy.js → modal-BlpWsFBT.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-DHN5fsxL.js +306 -0
- package/dist/browser/standalone.esm.js +20 -20
- package/dist/browser/standalone.js +293 -293
- package/dist/components/AgentScalar/AgentScalarButton.vue.d.ts.map +1 -1
- package/dist/components/AgentScalar/AgentScalarButton.vue.js.map +1 -1
- package/dist/components/AgentScalar/AgentScalarButton.vue.script.js +4 -2
- package/dist/components/AgentScalar/AgentScalarButton.vue.script.js.map +1 -1
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.d.ts.map +1 -1
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.js +1 -1
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.js.map +1 -1
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.script.js +4 -2
- package/dist/components/AgentScalar/AgentScalarDrawer.vue.script.js.map +1 -1
- package/dist/components/AgentScalar/OpenMCPButton.vue.d.ts.map +1 -1
- package/dist/components/AgentScalar/OpenMCPButton.vue.js +1 -1
- package/dist/components/AgentScalar/OpenMCPButton.vue.js.map +1 -1
- package/dist/components/AgentScalar/OpenMCPButton.vue.script.js +8 -6
- package/dist/components/AgentScalar/OpenMCPButton.vue.script.js.map +1 -1
- package/dist/components/Anchor/Anchor.vue.d.ts.map +1 -1
- package/dist/components/Anchor/Anchor.vue.js.map +1 -1
- package/dist/components/Anchor/Anchor.vue.script.js +5 -3
- package/dist/components/Anchor/Anchor.vue.script.js.map +1 -1
- package/dist/components/Anchor/WithBreadcrumb.vue.d.ts +1 -3
- package/dist/components/Anchor/WithBreadcrumb.vue.d.ts.map +1 -1
- package/dist/components/Anchor/WithBreadcrumb.vue.js.map +1 -1
- package/dist/components/Anchor/WithBreadcrumb.vue.script.js +6 -2
- package/dist/components/Anchor/WithBreadcrumb.vue.script.js.map +1 -1
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +1 -1
- package/dist/components/ApiReference.vue.js.map +1 -1
- package/dist/components/ApiReference.vue.script.js +172 -43
- package/dist/components/ApiReference.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.d.ts.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.js +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.js.map +1 -1
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.script.js +6 -2
- package/dist/components/Content/AsyncApi/AsyncApiLabels.vue.script.js.map +1 -1
- package/dist/components/Content/AsyncApi/Message.vue.script.js +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 +5 -2
- package/dist/components/Content/Auth/Auth.vue.script.js.map +1 -1
- package/dist/components/Content/Content.vue.d.ts +1 -0
- 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 +4 -1
- package/dist/components/Content/Content.vue.script.js.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +3 -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 +9 -0
- package/dist/components/Content/Operations/TraversedEntry.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.js +1 -1
- package/dist/components/Content/Schema/Schema.vue.js.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.script.js +100 -16
- 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 +9 -11
- package/dist/components/Content/Schema/SchemaComposition.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaEnums.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaEnums.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaEnums.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaEnums.vue.script.js +4 -2
- package/dist/components/Content/Schema/SchemaEnums.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaHeading.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaHeading.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaHeading.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaHeading.vue.script.js +5 -3
- package/dist/components/Content/Schema/SchemaHeading.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectExampleCodeBlock.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectExampleCodeBlock.vue.script.js +1 -1
- package/dist/components/Content/Schema/SchemaObjectExampleCodeBlock.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.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 +12 -0
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +3 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js +41 -9
- package/dist/components/Content/Schema/SchemaProperty.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDefault.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDefault.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDefault.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyDefault.vue.script.js +8 -5
- package/dist/components/Content/Schema/SchemaPropertyDefault.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.script.js +5 -3
- package/dist/components/Content/Schema/SchemaPropertyExamples.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts +3 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.script.js +48 -23
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.script.js.map +1 -1
- package/dist/components/Content/Schema/helpers/dynamic-scope.d.ts +27 -0
- package/dist/components/Content/Schema/helpers/dynamic-scope.d.ts.map +1 -0
- package/dist/components/Content/Schema/helpers/dynamic-scope.js +35 -0
- package/dist/components/Content/Schema/helpers/dynamic-scope.js.map +1 -0
- package/dist/components/Content/Schema/helpers/get-compositions-to-render.d.ts +10 -0
- 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 +11 -2
- package/dist/components/Content/Schema/helpers/get-compositions-to-render.js.map +1 -1
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +9 -2
- package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js.map +1 -1
- package/dist/components/Content/Tags/components/ModernLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/Tags/components/ModernLayout.vue.js +1 -1
- package/dist/components/Content/Tags/components/ModernLayout.vue.js.map +1 -1
- package/dist/components/Content/Tags/components/ModernLayout.vue.script.js +3 -1
- package/dist/components/Content/Tags/components/ModernLayout.vue.script.js.map +1 -1
- package/dist/components/Content/Tags/components/TagSection.vue.d.ts.map +1 -1
- package/dist/components/Content/Tags/components/TagSection.vue.js.map +1 -1
- package/dist/components/Content/Tags/components/TagSection.vue.script.js +3 -1
- package/dist/components/Content/Tags/components/TagSection.vue.script.js.map +1 -1
- package/dist/components/GettingStarted.vue.d.ts.map +1 -1
- package/dist/components/GettingStarted.vue.js +1 -1
- package/dist/components/GettingStarted.vue.js.map +1 -1
- package/dist/components/GettingStarted.vue.script.js +58 -21
- package/dist/components/GettingStarted.vue.script.js.map +1 -1
- package/dist/components/MobileHeader.vue.d.ts.map +1 -1
- package/dist/components/MobileHeader.vue.js.map +1 -1
- package/dist/components/MobileHeader.vue.script.js +3 -1
- package/dist/components/MobileHeader.vue.script.js.map +1 -1
- package/dist/components/OperationsList/OperationsList.vue.d.ts.map +1 -1
- package/dist/components/OperationsList/OperationsList.vue.js +1 -1
- package/dist/components/OperationsList/OperationsList.vue.js.map +1 -1
- package/dist/components/OperationsList/OperationsList.vue.script.js +4 -2
- package/dist/components/OperationsList/OperationsList.vue.script.js.map +1 -1
- package/dist/components/ShowMoreButton.vue.d.ts.map +1 -1
- package/dist/components/ShowMoreButton.vue.js +1 -1
- package/dist/components/ShowMoreButton.vue.js.map +1 -1
- package/dist/components/ShowMoreButton.vue.script.js +4 -2
- package/dist/components/ShowMoreButton.vue.script.js.map +1 -1
- package/dist/features/Operation/Operation.vue.d.ts +3 -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 +6 -1
- package/dist/features/Operation/Operation.vue.script.js.map +1 -1
- package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ContentTypeSelect.vue.js.map +1 -1
- package/dist/features/Operation/components/ContentTypeSelect.vue.script.js +4 -2
- package/dist/features/Operation/components/ContentTypeSelect.vue.script.js.map +1 -1
- package/dist/features/Operation/components/Headers.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/Headers.vue.js +1 -1
- package/dist/features/Operation/components/Headers.vue.js.map +1 -1
- package/dist/features/Operation/components/Headers.vue.script.js +8 -6
- package/dist/features/Operation/components/Headers.vue.script.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.script.js +8 -6
- package/dist/features/Operation/components/OperationParameters.vue.script.js.map +1 -1
- 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 +10 -7
- package/dist/features/Operation/components/OperationResponses.vue.script.js.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.script.js +1 -1
- package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.script.js +21 -14
- package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.js.map +1 -1
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.script.js +5 -3
- package/dist/features/Operation/components/SecurityRequirementBadge.vue.script.js.map +1 -1
- 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 +11 -8
- package/dist/features/Operation/components/callbacks/Callbacks.vue.script.js.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.script.js +37 -17
- package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.script.js +22 -7
- 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 +15 -8
- 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 +29 -10
- package/dist/features/Search/components/SearchModal.vue.script.js.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.d.ts.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.js.map +1 -1
- package/dist/features/Search/components/SearchResult.vue.script.js +12 -8
- package/dist/features/Search/components/SearchResult.vue.script.js.map +1 -1
- package/dist/features/Search/helpers/create-search-index.d.ts +8 -0
- package/dist/features/Search/helpers/create-search-index.d.ts.map +1 -1
- package/dist/features/Search/helpers/create-search-index.js +18 -9
- package/dist/features/Search/helpers/create-search-index.js.map +1 -1
- package/dist/features/Search/hooks/useSearchIndex.d.ts +7 -1
- package/dist/features/Search/hooks/useSearchIndex.d.ts.map +1 -1
- package/dist/features/Search/hooks/useSearchIndex.js +11 -2
- package/dist/features/Search/hooks/useSearchIndex.js.map +1 -1
- package/dist/features/ask-agent-button/AskAgentButton.vue.d.ts.map +1 -1
- package/dist/features/ask-agent-button/AskAgentButton.vue.js +1 -1
- package/dist/features/ask-agent-button/AskAgentButton.vue.js.map +1 -1
- package/dist/features/ask-agent-button/AskAgentButton.vue.script.js +10 -6
- package/dist/features/ask-agent-button/AskAgentButton.vue.script.js.map +1 -1
- package/dist/features/developer-tools/DeveloperTools.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/DeveloperTools.vue.js.map +1 -1
- package/dist/features/developer-tools/DeveloperTools.vue.script.js +10 -8
- package/dist/features/developer-tools/DeveloperTools.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayout.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayout.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayout.vue.script.js +11 -11
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayout.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.script.js +15 -11
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigLayoutOptions.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarConfigTheme.vue.script.js +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarPopover.vue.d.ts +1 -3
- package/dist/features/developer-tools/components/ApiReferenceToolbarPopover.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarPopover.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarPopover.vue.script.js +4 -6
- package/dist/features/developer-tools/components/ApiReferenceToolbarPopover.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.script.js +6 -4
- package/dist/features/developer-tools/components/ApiReferenceToolbarRegisterButton.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.script.js +23 -22
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareRegister.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.script.js +7 -5
- package/dist/features/developer-tools/components/ApiReferenceToolbarShareTemporary.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarTitle.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarTitle.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ApiReferenceToolbarTitle.vue.script.js +9 -7
- package/dist/features/developer-tools/components/ApiReferenceToolbarTitle.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/DeployApiReference.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/DeployApiReference.vue.js.map +1 -1
- package/dist/features/developer-tools/components/DeployApiReference.vue.script.js +7 -4
- package/dist/features/developer-tools/components/DeployApiReference.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ModifyConfiguration.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ModifyConfiguration.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ModifyConfiguration.vue.script.js +8 -6
- package/dist/features/developer-tools/components/ModifyConfiguration.vue.script.js.map +1 -1
- package/dist/features/developer-tools/components/ShareApiReference.vue.d.ts.map +1 -1
- package/dist/features/developer-tools/components/ShareApiReference.vue.js.map +1 -1
- package/dist/features/developer-tools/components/ShareApiReference.vue.script.js +7 -4
- package/dist/features/developer-tools/components/ShareApiReference.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.js.map +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.script.js +5 -3
- package/dist/features/example-responses/ExampleResponse.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.d.ts +9 -0
- package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.js.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.script.js +42 -23
- package/dist/features/example-responses/ExampleResponses.vue.script.js.map +1 -1
- package/dist/features/example-responses/ExampleSchema.vue.js.map +1 -1
- package/dist/features/example-responses/ExampleSchema.vue.script.js +1 -1
- package/dist/features/example-responses/ExampleSchema.vue.script.js.map +1 -1
- package/dist/features/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 +14 -11
- package/dist/features/info-object/Contact.vue.script.js.map +1 -1
- package/dist/features/info-object/InfoLink.vue.d.ts +8 -0
- package/dist/features/info-object/InfoLink.vue.d.ts.map +1 -0
- package/dist/features/info-object/InfoLink.vue.js +7 -0
- package/dist/features/info-object/InfoLink.vue.js.map +1 -0
- package/dist/features/info-object/InfoLink.vue.script.js +30 -0
- package/dist/features/info-object/InfoLink.vue.script.js.map +1 -0
- package/dist/features/info-object/TermsOfService.vue.d.ts.map +1 -1
- package/dist/features/info-object/TermsOfService.vue.js.map +1 -1
- package/dist/features/info-object/TermsOfService.vue.script.js +9 -6
- package/dist/features/info-object/TermsOfService.vue.script.js.map +1 -1
- package/dist/features/info-object/index.d.ts +1 -0
- package/dist/features/info-object/index.d.ts.map +1 -1
- package/dist/features/localization/index.d.ts +2 -0
- package/dist/features/localization/index.d.ts.map +1 -0
- package/dist/features/localization/locales/ar.d.ts +227 -0
- package/dist/features/localization/locales/ar.d.ts.map +1 -0
- package/dist/features/localization/locales/ar.js +225 -0
- package/dist/features/localization/locales/ar.js.map +1 -0
- package/dist/features/localization/locales/de.d.ts +227 -0
- package/dist/features/localization/locales/de.d.ts.map +1 -0
- package/dist/features/localization/locales/de.js +225 -0
- package/dist/features/localization/locales/de.js.map +1 -0
- package/dist/features/localization/locales/en.d.ts +227 -0
- package/dist/features/localization/locales/en.d.ts.map +1 -0
- package/dist/features/localization/locales/en.js +225 -0
- package/dist/features/localization/locales/en.js.map +1 -0
- package/dist/features/localization/locales/es.d.ts +227 -0
- package/dist/features/localization/locales/es.d.ts.map +1 -0
- package/dist/features/localization/locales/es.js +225 -0
- package/dist/features/localization/locales/es.js.map +1 -0
- package/dist/features/localization/locales/fr.d.ts +227 -0
- package/dist/features/localization/locales/fr.d.ts.map +1 -0
- package/dist/features/localization/locales/fr.js +225 -0
- package/dist/features/localization/locales/fr.js.map +1 -0
- package/dist/features/localization/locales/ru.d.ts +227 -0
- package/dist/features/localization/locales/ru.d.ts.map +1 -0
- package/dist/features/localization/locales/ru.js +225 -0
- package/dist/features/localization/locales/ru.js.map +1 -0
- package/dist/features/localization/locales/zh-cn.d.ts +227 -0
- package/dist/features/localization/locales/zh-cn.d.ts.map +1 -0
- package/dist/features/localization/locales/zh-cn.js +225 -0
- package/dist/features/localization/locales/zh-cn.js.map +1 -0
- package/dist/features/localization/translations.d.ts +1588 -0
- package/dist/features/localization/translations.d.ts.map +1 -0
- package/dist/features/localization/translations.js +27 -0
- package/dist/features/localization/translations.js.map +1 -0
- package/dist/features/localization/use-localization.d.ts +18 -0
- package/dist/features/localization/use-localization.d.ts.map +1 -0
- package/dist/features/localization/use-localization.js +58 -0
- package/dist/features/localization/use-localization.js.map +1 -0
- package/dist/features/multiple-documents/DocumentSelector.vue.script.js +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.js +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.js.map +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.script.js +3 -1
- package/dist/features/test-request-button/TestRequestButton.vue.script.js.map +1 -1
- package/dist/helpers/is-introduction-entry.d.ts +16 -0
- package/dist/helpers/is-introduction-entry.d.ts.map +1 -0
- package/dist/helpers/is-introduction-entry.js +17 -0
- package/dist/helpers/is-introduction-entry.js.map +1 -0
- package/dist/helpers/load-from-perssistance.js +1 -1
- package/dist/helpers/load-from-perssistance.js.map +1 -1
- package/dist/helpers/map-config-to-workspace-store.js +1 -1
- package/dist/helpers/map-config-to-workspace-store.js.map +1 -1
- package/dist/helpers/storage.d.ts +14 -14
- package/dist/style.css +446 -434
- package/dist/styles/tailwind.config.css +1 -0
- package/dist/vue-styles.css +383 -380
- package/package.json +17 -16
- package/dist/browser/chunks/AgentScalarChatInterface-BhUn0w1j.js +0 -27
- package/dist/browser/chunks/ScalarTextInput.vue-BUzf4Z_k.js +0 -27
- package/dist/browser/chunks/vendor-BeJNu9KM.js +0 -306
- package/dist/features/Operation/helpers/get-first-server.d.ts +0 -9
- package/dist/features/Operation/helpers/get-first-server.d.ts.map +0 -1
- package/dist/features/Operation/helpers/get-first-server.js +0 -27
- package/dist/features/Operation/helpers/get-first-server.js.map +0 -1
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocalization } from "../../../features/localization/use-localization.js";
|
|
1
2
|
import Badge_default from "../../Badge/Badge.vue.js";
|
|
2
3
|
import ScreenReader_default from "../../ScreenReader.vue.js";
|
|
3
4
|
import { getSchemaType } from "./helpers/get-schema-type.js";
|
|
@@ -9,8 +10,8 @@ import SchemaPropertyDetail_default from "./SchemaPropertyDetail.vue.js";
|
|
|
9
10
|
import SchemaPropertyExamples_default from "./SchemaPropertyExamples.vue.js";
|
|
10
11
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createSlots, createTextVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, renderSlot, toDisplayString, toRef, unref, withCtx } from "vue";
|
|
11
12
|
import { resolve } from "@scalar/workspace-store/resolve";
|
|
12
|
-
import { isArraySchema, isNumberSchema, isStringSchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
|
|
13
13
|
import { isDefined } from "@scalar/helpers/array/is-defined";
|
|
14
|
+
import { isArraySchema, isNumberSchema, isStringSchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
|
|
14
15
|
//#region src/components/Content/Schema/SchemaPropertyHeading.vue?vue&type=script&setup=true&lang.ts
|
|
15
16
|
var _hoisted_1 = { class: "property-heading" };
|
|
16
17
|
var _hoisted_2 = {
|
|
@@ -64,10 +65,12 @@ var SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
64
65
|
default: false
|
|
65
66
|
},
|
|
66
67
|
modelName: {},
|
|
68
|
+
propertyNames: {},
|
|
67
69
|
eventBus: { default: null }
|
|
68
70
|
},
|
|
69
71
|
setup(__props) {
|
|
70
72
|
const props = __props;
|
|
73
|
+
const { translate } = useLocalization();
|
|
71
74
|
const valueRef = toRef(props, "value");
|
|
72
75
|
const constValue = computed(() => {
|
|
73
76
|
if (!valueRef.value) return;
|
|
@@ -91,18 +94,18 @@ var SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
91
94
|
});
|
|
92
95
|
if (schema.uniqueItems) properties.push({
|
|
93
96
|
key: "unique-items",
|
|
94
|
-
value: "unique
|
|
97
|
+
value: `${translate("common.unique")}!`
|
|
95
98
|
});
|
|
96
99
|
}
|
|
97
100
|
if (isStringSchema(schema)) {
|
|
98
101
|
if (schema.minLength) properties.push({
|
|
99
102
|
key: "min-length",
|
|
100
|
-
prefix: "
|
|
103
|
+
prefix: `${translate("common.minLength")}: `,
|
|
101
104
|
value: schema.minLength
|
|
102
105
|
});
|
|
103
106
|
if (schema.maxLength) properties.push({
|
|
104
107
|
key: "max-length",
|
|
105
|
-
prefix: "
|
|
108
|
+
prefix: `${translate("common.maxLength")}: `,
|
|
106
109
|
value: schema.maxLength
|
|
107
110
|
});
|
|
108
111
|
if (schema.pattern) properties.push({
|
|
@@ -122,27 +125,27 @@ var SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
122
125
|
if (isNumberSchema(schema)) {
|
|
123
126
|
if (isDefined(schema.exclusiveMinimum)) properties.push({
|
|
124
127
|
key: "exclusive-minimum",
|
|
125
|
-
prefix: "
|
|
128
|
+
prefix: `${translate("common.greaterThan")}: `,
|
|
126
129
|
value: schema.exclusiveMinimum
|
|
127
130
|
});
|
|
128
131
|
if (isDefined(schema.minimum)) properties.push({
|
|
129
132
|
key: "minimum",
|
|
130
|
-
prefix: "min:
|
|
133
|
+
prefix: `${translate("common.min")}: `,
|
|
131
134
|
value: schema.minimum
|
|
132
135
|
});
|
|
133
136
|
if (isDefined(schema.exclusiveMaximum)) properties.push({
|
|
134
137
|
key: "exclusive-maximum",
|
|
135
|
-
prefix: "
|
|
138
|
+
prefix: `${translate("common.lessThan")}: `,
|
|
136
139
|
value: schema.exclusiveMaximum
|
|
137
140
|
});
|
|
138
141
|
if (isDefined(schema.maximum)) properties.push({
|
|
139
142
|
key: "maximum",
|
|
140
|
-
prefix: "max:
|
|
143
|
+
prefix: `${translate("common.max")}: `,
|
|
141
144
|
value: schema.maximum
|
|
142
145
|
});
|
|
143
146
|
if (isDefined(schema.multipleOf)) properties.push({
|
|
144
147
|
key: "multiple-of",
|
|
145
|
-
prefix: "
|
|
148
|
+
prefix: `${translate("common.multipleOf")}: `,
|
|
146
149
|
value: schema.multipleOf
|
|
147
150
|
});
|
|
148
151
|
}
|
|
@@ -181,6 +184,20 @@ var SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
181
184
|
if (!props.value) return "";
|
|
182
185
|
return getSchemaType(props.value);
|
|
183
186
|
});
|
|
187
|
+
/**
|
|
188
|
+
* Type and format of the property keys, derived from the propertyNames schema.
|
|
189
|
+
*
|
|
190
|
+
* For a map keyed by UUIDs this renders e.g. "string · uuid" so the key
|
|
191
|
+
* constraints are not lost. Returns undefined when there is nothing to show.
|
|
192
|
+
*/
|
|
193
|
+
const propertyNamesDetail = computed(() => {
|
|
194
|
+
const schema = props.propertyNames;
|
|
195
|
+
if (!schema) return;
|
|
196
|
+
const parts = [getSchemaType(schema)];
|
|
197
|
+
if ("format" in schema && typeof schema.format === "string") parts.push(schema.format);
|
|
198
|
+
const detail = parts.filter(Boolean).join(" · ");
|
|
199
|
+
return detail.length > 0 ? detail : void 0;
|
|
200
|
+
});
|
|
184
201
|
const exampleValue = computed(() => {
|
|
185
202
|
if (props.value && "example" in props.value && props.value.example !== void 0) return props.value.example;
|
|
186
203
|
if (props.value && isArraySchema(props.value)) {
|
|
@@ -194,7 +211,7 @@ var SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
194
211
|
key: 0,
|
|
195
212
|
class: normalizeClass(["property-name", { deprecated: props.value?.deprecated }])
|
|
196
213
|
}, [renderSlot(_ctx.$slots, "name", {}, void 0, true)], 2)) : createCommentVNode("", true),
|
|
197
|
-
props.isDiscriminator ? (openBlock(), createElementBlock("div", _hoisted_2, "
|
|
214
|
+
props.isDiscriminator ? (openBlock(), createElementBlock("div", _hoisted_2, toDisplayString(unref(translate)("common.discriminator")), 1)) : createCommentVNode("", true),
|
|
198
215
|
props.value ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
199
216
|
shouldShowType.value ? (openBlock(), createBlock(SchemaPropertyDetail_default, {
|
|
200
217
|
key: 0,
|
|
@@ -202,11 +219,11 @@ var SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
202
219
|
}, {
|
|
203
220
|
default: withCtx(() => [
|
|
204
221
|
createVNode(ScreenReader_default, null, {
|
|
205
|
-
default: withCtx(() => [
|
|
222
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("common.type")) + ":", 1)]),
|
|
206
223
|
_: 1
|
|
207
224
|
}),
|
|
208
|
-
createTextVNode(toDisplayString(displayType.value), 1),
|
|
209
|
-
modelLink.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[
|
|
225
|
+
createTextVNode(" " + toDisplayString(displayType.value) + " ", 1),
|
|
226
|
+
modelLink.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[1] || (_cache[1] = createTextVNode(" · ", -1)), props.eventBus && modelLink.value.schemaKey ? (openBlock(), createBlock(LinkButton_default, {
|
|
210
227
|
key: 0,
|
|
211
228
|
onClick: _cache[0] || (_cache[0] = ($event) => props.eventBus.emit("scroll-to:model-by-name", { name: modelLink.value.schemaKey }))
|
|
212
229
|
}, {
|
|
@@ -216,6 +233,14 @@ var SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
216
233
|
]),
|
|
217
234
|
_: 1
|
|
218
235
|
})) : createCommentVNode("", true),
|
|
236
|
+
propertyNamesDetail.value ? (openBlock(), createBlock(SchemaPropertyDetail_default, {
|
|
237
|
+
key: 1,
|
|
238
|
+
truncate: ""
|
|
239
|
+
}, {
|
|
240
|
+
prefix: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("common.keys")) + ":", 1)]),
|
|
241
|
+
default: withCtx(() => [createTextVNode(" " + toDisplayString(propertyNamesDetail.value), 1)]),
|
|
242
|
+
_: 1
|
|
243
|
+
})) : createCommentVNode("", true),
|
|
219
244
|
(openBlock(true), createElementBlock(Fragment, null, renderList(validationProperties.value, (property) => {
|
|
220
245
|
return openBlock(), createBlock(SchemaPropertyDetail_default, {
|
|
221
246
|
key: property.key,
|
|
@@ -223,10 +248,10 @@ var SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
223
248
|
truncate: property.truncate
|
|
224
249
|
}, createSlots({
|
|
225
250
|
default: withCtx(() => [property.key === "format" ? (openBlock(), createBlock(ScreenReader_default, { key: 0 }, {
|
|
226
|
-
default: withCtx(() => [
|
|
251
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("common.format")) + ": ", 1)]),
|
|
227
252
|
_: 1
|
|
228
253
|
})) : property.key === "pattern" ? (openBlock(), createBlock(ScreenReader_default, { key: 1 }, {
|
|
229
|
-
default: withCtx(() => [
|
|
254
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("common.pattern")) + ": ", 1)]),
|
|
230
255
|
_: 1
|
|
231
256
|
})) : createCommentVNode("", true), createTextVNode(" " + toDisplayString(property.value), 1)]),
|
|
232
257
|
_: 2
|
|
@@ -236,26 +261,26 @@ var SchemaPropertyHeading_vue_vue_type_script_setup_true_lang_default = /* @__PU
|
|
|
236
261
|
key: "0"
|
|
237
262
|
} : void 0]), 1032, ["code", "truncate"]);
|
|
238
263
|
}), 128)),
|
|
239
|
-
props.enum ? (openBlock(), createBlock(SchemaPropertyDetail_default, { key:
|
|
240
|
-
default: withCtx(() => [
|
|
264
|
+
props.enum ? (openBlock(), createBlock(SchemaPropertyDetail_default, { key: 2 }, {
|
|
265
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("common.enum")), 1)]),
|
|
241
266
|
_: 1
|
|
242
267
|
})) : createCommentVNode("", true)
|
|
243
268
|
], 64)) : createCommentVNode("", true),
|
|
244
|
-
props.additional ? (openBlock(), createElementBlock("div", _hoisted_3, [props.value?.["x-additionalPropertiesName"] ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(props.value["x-additionalPropertiesName"]), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode("
|
|
269
|
+
props.additional ? (openBlock(), createElementBlock("div", _hoisted_3, [props.value?.["x-additionalPropertiesName"] ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(props.value["x-additionalPropertiesName"]), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(unref(translate)("common.additionalProperties")), 1)], 64))])) : createCommentVNode("", true),
|
|
245
270
|
props.value?.deprecated ? (openBlock(), createElementBlock("div", _hoisted_4, [createVNode(unref(Badge_default), null, {
|
|
246
|
-
default: withCtx(() => [
|
|
271
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("common.deprecated")), 1)]),
|
|
247
272
|
_: 1
|
|
248
273
|
})])) : createCommentVNode("", true),
|
|
249
274
|
constValue.value !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_5, [createVNode(SchemaPropertyDetail_default, { truncate: "" }, {
|
|
250
|
-
prefix: withCtx(() => [
|
|
275
|
+
prefix: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("common.const")) + ": ", 1)]),
|
|
251
276
|
default: withCtx(() => [createVNode(RenderString_default, { value: constValue.value }, null, 8, ["value"])]),
|
|
252
277
|
_: 1
|
|
253
278
|
})])) : (openBlock(), createElementBlock(Fragment, { key: 6 }, [props.value?.nullable === true ? (openBlock(), createBlock(SchemaPropertyDetail_default, { key: 0 }, {
|
|
254
|
-
default: withCtx(() => [
|
|
279
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("common.nullable")), 1)]),
|
|
255
280
|
_: 1
|
|
256
281
|
})) : createCommentVNode("", true)], 64)),
|
|
257
|
-
props.value?.writeOnly ? (openBlock(), createElementBlock("div", _hoisted_6, "
|
|
258
|
-
props.required ? (openBlock(), createElementBlock("div", _hoisted_8, "
|
|
282
|
+
props.value?.writeOnly ? (openBlock(), createElementBlock("div", _hoisted_6, toDisplayString(unref(translate)("common.writeOnly")), 1)) : props.value?.readOnly ? (openBlock(), createElementBlock("div", _hoisted_7, toDisplayString(unref(translate)("common.readOnly")), 1)) : createCommentVNode("", true),
|
|
283
|
+
props.required ? (openBlock(), createElementBlock("div", _hoisted_8, toDisplayString(unref(translate)("common.required")), 1)) : createCommentVNode("", true),
|
|
259
284
|
createVNode(SchemaPropertyDefault_default, { value: props.value?.default }, null, 8, ["value"]),
|
|
260
285
|
props.withExamples ? (openBlock(), createBlock(SchemaPropertyExamples_default, {
|
|
261
286
|
key: 10,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaPropertyHeading.vue.script.js","names":["$slots"],"sources":["../../../../src/components/Content/Schema/SchemaPropertyHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport {\n isArraySchema,\n isNumberSchema,\n isStringSchema,\n} from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\nimport { computed, toRef } from 'vue'\n\nimport { Badge } from '@/components/Badge'\nimport LinkButton from '@/components/Content/Schema/LinkButton.vue'\nimport ScreenReader from '@/components/ScreenReader.vue'\n\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { getModelNameFromSchema } from './helpers/schema-name'\nimport RenderString from './RenderString.vue'\nimport SchemaPropertyDefault from './SchemaPropertyDefault.vue'\nimport SchemaPropertyDetail from './SchemaPropertyDetail.vue'\nimport SchemaPropertyExamples from './SchemaPropertyExamples.vue'\n\nconst props = withDefaults(\n defineProps<{\n value: SchemaObject | undefined\n enum?: boolean\n isDiscriminator?: boolean\n required?: boolean\n additional?: boolean\n withExamples?: boolean\n hideModelNames?: boolean\n /** When the schema was resolved from a $ref, pass the ref name so it displays as e.g. \"Data\" instead of \"object\". */\n modelName?: string | null\n eventBus?: WorkspaceEventBus | null\n }>(),\n {\n isDiscriminator: false,\n required: false,\n withExamples: true,\n hideModelNames: false,\n eventBus: null,\n },\n)\n\n// Convert to reactive refs for composables\nconst valueRef = toRef(props, 'value')\n\nconst constValue = computed(() => {\n if (!valueRef.value) {\n return undefined\n }\n\n const schema = valueRef.value\n\n // Direct const value\n if (schema.const !== undefined) {\n return schema.const\n }\n\n // Single-item enum acts as const\n if (schema.enum?.length === 1) {\n return schema.enum[0]\n }\n\n // Check items for const values (for arrays)\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n\n if (isDefined(items.const)) {\n return items.const\n }\n\n if (items.enum?.length === 1) {\n return items.enum[0]\n }\n }\n\n return undefined\n})\n\nconst validationProperties = computed(() => {\n if (!valueRef.value) {\n return []\n }\n\n const schema = valueRef.value\n const properties = []\n\n // Array validation properties\n if (isArraySchema(schema)) {\n if (schema.minItems || schema.maxItems) {\n properties.push({\n key: 'array-range',\n value: `${schema.minItems || ''}…${schema.maxItems || ''}`,\n })\n }\n\n // Unique items\n if (schema.uniqueItems) {\n properties.push({\n key: 'unique-items',\n value: 'unique!',\n })\n }\n }\n\n // String length properties\n if (isStringSchema(schema)) {\n if (schema.minLength) {\n properties.push({\n key: 'min-length',\n prefix: 'min length: ',\n value: schema.minLength,\n })\n }\n\n if (schema.maxLength) {\n properties.push({\n key: 'max-length',\n prefix: 'max length: ',\n value: schema.maxLength,\n })\n }\n\n // Pattern\n if (schema.pattern) {\n properties.push({\n key: 'pattern',\n value: schema.pattern,\n code: true,\n truncate: true,\n })\n }\n }\n\n // Format\n if (isStringSchema(schema) || isNumberSchema(schema)) {\n if (schema.format) {\n properties.push({\n key: 'format',\n value: schema.format,\n truncate: true,\n })\n }\n }\n\n // Numeric validation properties\n if (isNumberSchema(schema)) {\n if (isDefined(schema.exclusiveMinimum)) {\n properties.push({\n key: 'exclusive-minimum',\n prefix: 'greater than: ',\n value: schema.exclusiveMinimum,\n })\n }\n\n if (isDefined(schema.minimum)) {\n properties.push({\n key: 'minimum',\n prefix: 'min: ',\n value: schema.minimum,\n })\n }\n\n if (isDefined(schema.exclusiveMaximum)) {\n properties.push({\n key: 'exclusive-maximum',\n prefix: 'less than: ',\n value: schema.exclusiveMaximum,\n })\n }\n\n if (isDefined(schema.maximum)) {\n properties.push({\n key: 'maximum',\n prefix: 'max: ',\n value: schema.maximum,\n })\n }\n\n if (isDefined(schema.multipleOf)) {\n properties.push({\n key: 'multiple-of',\n prefix: 'multiple of: ',\n value: schema.multipleOf,\n })\n }\n }\n\n return properties\n})\n\n/** Link data for navigating to the referenced model in the sidebar. */\nconst modelLink = computed(() => {\n if (!props.value) {\n return null\n }\n\n if (props.hideModelNames) {\n return null\n }\n\n if (props.modelName) {\n return { schemaKey: props.modelName, label: props.modelName }\n }\n\n const modelName = getModelNameFromSchema(props.value)\n if (modelName) {\n return { schemaKey: modelName.schemaKey, label: modelName.label }\n }\n\n if (isArraySchema(props.value) && props.value.items) {\n const itemName = getModelNameFromSchema(props.value.items)\n return itemName\n ? { schemaKey: itemName.schemaKey, label: `${itemName.label}[]` }\n : null\n }\n\n return null\n})\n\n/** Check if we should show the type information */\nconst shouldShowType = computed(() => {\n if (!props.value || !('type' in props.value)) {\n return false\n }\n\n // Always show type for arrays, even when items have const values\n if (props.value.type === 'array') {\n return true\n }\n\n // For non-arrays, only show if no const value at the schema level\n return !constValue.value\n})\n\n/** Get the display type */\nconst displayType = computed(() => {\n if (!props.value) {\n return ''\n }\n return getSchemaType(props.value)\n})\n\nconst exampleValue = computed(() => {\n // Treat only `undefined` as \"not set\" — `null` is a valid example value on a nullable schema.\n if (\n props.value &&\n 'example' in props.value &&\n props.value.example !== undefined\n ) {\n return props.value.example\n }\n\n if (props.value && isArraySchema(props.value)) {\n const itemsSchema = resolve.schema(props.value.items)\n if (\n itemsSchema &&\n 'example' in itemsSchema &&\n itemsSchema.example !== undefined\n ) {\n return itemsSchema.example\n }\n }\n\n return undefined\n})\n</script>\n<template>\n <div class=\"property-heading\">\n <div\n v-if=\"$slots.name\"\n class=\"property-name\"\n :class=\"{ deprecated: props.value?.deprecated }\">\n <slot name=\"name\" />\n </div>\n <div\n v-if=\"props.isDiscriminator\"\n class=\"property-discriminator\">\n Discriminator\n </div>\n <template v-if=\"props.value\">\n <!-- Type information -->\n <SchemaPropertyDetail\n v-if=\"shouldShowType\"\n truncate>\n <ScreenReader>Type: </ScreenReader>{{ displayType\n }}<template v-if=\"modelLink\">\n ·\n <LinkButton\n v-if=\"props.eventBus && modelLink.schemaKey\"\n @click=\"\n props.eventBus.emit('scroll-to:model-by-name', {\n name: modelLink.schemaKey,\n })\n \">\n {{ modelLink.label }}\n </LinkButton>\n <template v-else>{{ modelLink.label }}</template>\n </template>\n </SchemaPropertyDetail>\n\n <!-- Dynamic validation properties from composable -->\n <SchemaPropertyDetail\n v-for=\"property in validationProperties\"\n :key=\"property.key\"\n :code=\"property.code\"\n :truncate=\"property.truncate\">\n <ScreenReader v-if=\"property.key === 'format'\">Format:</ScreenReader>\n <ScreenReader v-else-if=\"property.key === 'pattern'\">\n Pattern:\n </ScreenReader>\n <template\n v-if=\"property.prefix\"\n #prefix>\n {{ property.prefix }}\n </template>\n {{ property.value }}\n </SchemaPropertyDetail>\n\n <!-- Enum indicator -->\n <SchemaPropertyDetail v-if=\"props.enum\">enum</SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.additional\"\n class=\"property-additional\">\n <template v-if=\"props.value?.['x-additionalPropertiesName']\">\n {{ props.value['x-additionalPropertiesName'] }}\n </template>\n <template v-else>additional properties</template>\n </div>\n <div\n v-if=\"props.value?.deprecated\"\n class=\"property-deprecated\">\n <Badge>deprecated</Badge>\n </div>\n <!-- Don't use `isDefined` here, we want to show `const` when the value is `null` -->\n <div\n v-if=\"constValue !== undefined\"\n class=\"property-const\">\n <SchemaPropertyDetail truncate>\n <template #prefix>const: </template>\n <RenderString :value=\"constValue\" />\n </SchemaPropertyDetail>\n </div>\n <template v-else>\n <!-- Shows only when a composition is used (so props.value?.type is undefined) -->\n <SchemaPropertyDetail v-if=\"(props.value as any)?.nullable === true\">\n nullable\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.value?.writeOnly\"\n class=\"property-write-only\">\n write-only\n </div>\n <div\n v-else-if=\"props.value?.readOnly\"\n class=\"property-read-only\">\n read-only\n </div>\n <div\n v-if=\"props.required\"\n class=\"property-required\">\n required\n </div>\n <SchemaPropertyDefault :value=\"props.value?.default\" />\n <SchemaPropertyExamples\n v-if=\"props.withExamples\"\n :example=\"exampleValue\"\n :examples=\"props.value?.examples\" />\n </div>\n</template>\n<style scoped>\n.property-heading {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n row-gap: 9px;\n white-space: nowrap;\n}\n\n.property-heading:has(+ .children),\n.property-heading:has(+ .property-rule) {\n margin-bottom: 9px;\n}\n\n.property-heading > * {\n margin-right: 9px;\n}\n\n.property-heading:last-child {\n margin-right: 0;\n}\n\n.property-heading > .property-detail:not(:last-of-type) {\n margin-right: 0;\n}\n\n.property-name {\n max-width: 100%;\n font-family: var(--scalar-font-code);\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n white-space: normal;\n overflow-wrap: break-word;\n}\n\n.property-additional {\n font-family: var(--scalar-font-code);\n}\n\n.property-required,\n.property-optional {\n color: var(--scalar-color-2);\n}\n\n.property-required {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-orange);\n}\n\n.property-read-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-blue);\n}\n\n.property-write-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-green);\n}\n\n.property-discriminator {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-purple);\n}\n\n.property-detail {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n display: flex;\n align-items: center;\n\n min-width: 0;\n}\n\n.property-const {\n color: var(--scalar-color-1);\n}\n\n.deprecated {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBA,MAAM,QAAQ;EAuBd,MAAM,WAAW,MAAM,OAAO,QAAO;EAErC,MAAM,aAAa,eAAe;AAChC,OAAI,CAAC,SAAS,MACZ;GAGF,MAAM,SAAS,SAAS;AAGxB,OAAI,OAAO,UAAU,KAAA,EACnB,QAAO,OAAO;AAIhB,OAAI,OAAO,MAAM,WAAW,EAC1B,QAAO,OAAO,KAAK;AAIrB,OAAI,cAAc,OAAO,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AAA,CAAA;;;IAIX,WAAA,UAAe,KAAA,KAAA,WAAA,EADvB,mBAOM,OAPN,YAOM,CAJJ,YAGuB,8BAAA,EAHD,UAAA,IAAQ,EAAA;KACjB,QAAM,cAAQ,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAAP,WAAO,GAAA,CAAA,EAAA,CAAA;4BACW,CAApC,YAAoC,sBAAA,EAArB,OAAO,WAAA,OAAU,EAAA,MAAA,GAAA,CAAA,QAAA,CAAA,CAAA,CAAA;;0BAGpC,mBAKW,UAAA,EAAA,KAAA,GAAA,EAAA,CAHoB,MAAM,OAAe,aAAQ,QAAA,WAAA,EAA1D,YAEuB,8BAAA,EAAA,KAAA,GAAA,EAAA;4BAAvB,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAA,gBAFqE,cAErE,GAAA,CAAA,EAAA,CAAA;;;IAGM,MAAM,OAAO,aAAA,WAAA,EADrB,mBAIM,OAJN,YAE8B,eAE9B,IAEa,MAAM,OAAO,YAAA,WAAA,EAD1B,mBAIM,OAJN,YAE6B,cAE7B,IAAA,mBAAA,IAAA,KAAA;IAEQ,MAAM,YAAA,WAAA,EADd,mBAIM,OAJN,YAE4B,aAE5B,IAAA,mBAAA,IAAA,KAAA;IACA,YAAuD,+BAAA,EAA/B,OAAO,MAAM,OAAO,SAAA,EAAA,MAAA,GAAA,CAAA,QAAA,CAAA;IAEpC,MAAM,gBAAA,WAAA,EADd,YAGsC,gCAAA;;KADnC,SAAS,aAAA;KACT,UAAU,MAAM,OAAO"}
|
|
1
|
+
{"version":3,"file":"SchemaPropertyHeading.vue.script.js","names":["$slots"],"sources":["../../../../src/components/Content/Schema/SchemaPropertyHeading.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport {\n isArraySchema,\n isNumberSchema,\n isStringSchema,\n} from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\nimport { computed, toRef } from 'vue'\n\nimport { Badge } from '@/components/Badge'\nimport LinkButton from '@/components/Content/Schema/LinkButton.vue'\nimport ScreenReader from '@/components/ScreenReader.vue'\nimport { useLocalization } from '@/features/localization'\n\nimport { getSchemaType } from './helpers/get-schema-type'\nimport { getModelNameFromSchema } from './helpers/schema-name'\nimport RenderString from './RenderString.vue'\nimport SchemaPropertyDefault from './SchemaPropertyDefault.vue'\nimport SchemaPropertyDetail from './SchemaPropertyDetail.vue'\nimport SchemaPropertyExamples from './SchemaPropertyExamples.vue'\n\nconst props = withDefaults(\n defineProps<{\n value: SchemaObject | undefined\n enum?: boolean\n isDiscriminator?: boolean\n required?: boolean\n additional?: boolean\n withExamples?: boolean\n hideModelNames?: boolean\n /** When the schema was resolved from a $ref, pass the ref name so it displays as e.g. \"Data\" instead of \"object\". */\n modelName?: string | null\n /** Resolved propertyNames schema, used to surface key constraints like `format` for additional properties. */\n propertyNames?: SchemaObject\n eventBus?: WorkspaceEventBus | null\n }>(),\n {\n isDiscriminator: false,\n required: false,\n withExamples: true,\n hideModelNames: false,\n eventBus: null,\n },\n)\nconst { translate } = useLocalization()\n\n// Convert to reactive refs for composables\nconst valueRef = toRef(props, 'value')\n\nconst constValue = computed(() => {\n if (!valueRef.value) {\n return undefined\n }\n\n const schema = valueRef.value\n\n // Direct const value\n if (schema.const !== undefined) {\n return schema.const\n }\n\n // Single-item enum acts as const\n if (schema.enum?.length === 1) {\n return schema.enum[0]\n }\n\n // Check items for const values (for arrays)\n if (isArraySchema(schema) && schema.items) {\n const items = resolve.schema(schema.items)\n\n if (isDefined(items.const)) {\n return items.const\n }\n\n if (items.enum?.length === 1) {\n return items.enum[0]\n }\n }\n\n return undefined\n})\n\nconst validationProperties = computed(() => {\n if (!valueRef.value) {\n return []\n }\n\n const schema = valueRef.value\n const properties = []\n\n // Array validation properties\n if (isArraySchema(schema)) {\n if (schema.minItems || schema.maxItems) {\n properties.push({\n key: 'array-range',\n value: `${schema.minItems || ''}…${schema.maxItems || ''}`,\n })\n }\n\n // Unique items\n if (schema.uniqueItems) {\n properties.push({\n key: 'unique-items',\n value: `${translate('common.unique')}!`,\n })\n }\n }\n\n // String length properties\n if (isStringSchema(schema)) {\n if (schema.minLength) {\n properties.push({\n key: 'min-length',\n prefix: `${translate('common.minLength')}: `,\n value: schema.minLength,\n })\n }\n\n if (schema.maxLength) {\n properties.push({\n key: 'max-length',\n prefix: `${translate('common.maxLength')}: `,\n value: schema.maxLength,\n })\n }\n\n // Pattern\n if (schema.pattern) {\n properties.push({\n key: 'pattern',\n value: schema.pattern,\n code: true,\n truncate: true,\n })\n }\n }\n\n // Format\n if (isStringSchema(schema) || isNumberSchema(schema)) {\n if (schema.format) {\n properties.push({\n key: 'format',\n value: schema.format,\n truncate: true,\n })\n }\n }\n\n // Numeric validation properties\n if (isNumberSchema(schema)) {\n if (isDefined(schema.exclusiveMinimum)) {\n properties.push({\n key: 'exclusive-minimum',\n prefix: `${translate('common.greaterThan')}: `,\n value: schema.exclusiveMinimum,\n })\n }\n\n if (isDefined(schema.minimum)) {\n properties.push({\n key: 'minimum',\n prefix: `${translate('common.min')}: `,\n value: schema.minimum,\n })\n }\n\n if (isDefined(schema.exclusiveMaximum)) {\n properties.push({\n key: 'exclusive-maximum',\n prefix: `${translate('common.lessThan')}: `,\n value: schema.exclusiveMaximum,\n })\n }\n\n if (isDefined(schema.maximum)) {\n properties.push({\n key: 'maximum',\n prefix: `${translate('common.max')}: `,\n value: schema.maximum,\n })\n }\n\n if (isDefined(schema.multipleOf)) {\n properties.push({\n key: 'multiple-of',\n prefix: `${translate('common.multipleOf')}: `,\n value: schema.multipleOf,\n })\n }\n }\n\n return properties\n})\n\n/** Link data for navigating to the referenced model in the sidebar. */\nconst modelLink = computed(() => {\n if (!props.value) {\n return null\n }\n\n if (props.hideModelNames) {\n return null\n }\n\n if (props.modelName) {\n return { schemaKey: props.modelName, label: props.modelName }\n }\n\n const modelName = getModelNameFromSchema(props.value)\n if (modelName) {\n return { schemaKey: modelName.schemaKey, label: modelName.label }\n }\n\n if (isArraySchema(props.value) && props.value.items) {\n const itemName = getModelNameFromSchema(props.value.items)\n return itemName\n ? { schemaKey: itemName.schemaKey, label: `${itemName.label}[]` }\n : null\n }\n\n return null\n})\n\n/** Check if we should show the type information */\nconst shouldShowType = computed(() => {\n if (!props.value || !('type' in props.value)) {\n return false\n }\n\n // Always show type for arrays, even when items have const values\n if (props.value.type === 'array') {\n return true\n }\n\n // For non-arrays, only show if no const value at the schema level\n return !constValue.value\n})\n\n/** Get the display type */\nconst displayType = computed(() => {\n if (!props.value) {\n return ''\n }\n return getSchemaType(props.value)\n})\n\n/**\n * Type and format of the property keys, derived from the propertyNames schema.\n *\n * For a map keyed by UUIDs this renders e.g. \"string · uuid\" so the key\n * constraints are not lost. Returns undefined when there is nothing to show.\n */\nconst propertyNamesDetail = computed(() => {\n const schema = props.propertyNames\n if (!schema) {\n return undefined\n }\n\n const parts = [getSchemaType(schema)]\n if ('format' in schema && typeof schema.format === 'string') {\n parts.push(schema.format)\n }\n\n const detail = parts.filter(Boolean).join(' · ')\n return detail.length > 0 ? detail : undefined\n})\n\nconst exampleValue = computed(() => {\n // Treat only `undefined` as \"not set\" — `null` is a valid example value on a nullable schema.\n if (\n props.value &&\n 'example' in props.value &&\n props.value.example !== undefined\n ) {\n return props.value.example\n }\n\n if (props.value && isArraySchema(props.value)) {\n const itemsSchema = resolve.schema(props.value.items)\n if (\n itemsSchema &&\n 'example' in itemsSchema &&\n itemsSchema.example !== undefined\n ) {\n return itemsSchema.example\n }\n }\n\n return undefined\n})\n</script>\n<template>\n <div class=\"property-heading\">\n <div\n v-if=\"$slots.name\"\n class=\"property-name\"\n :class=\"{ deprecated: props.value?.deprecated }\">\n <slot name=\"name\" />\n </div>\n <div\n v-if=\"props.isDiscriminator\"\n class=\"property-discriminator\">\n {{ translate('common.discriminator') }}\n </div>\n <template v-if=\"props.value\">\n <!-- Type information -->\n <SchemaPropertyDetail\n v-if=\"shouldShowType\"\n truncate>\n <ScreenReader>{{ translate('common.type') }}:</ScreenReader>\n {{ displayType }}\n <template v-if=\"modelLink\">\n ·\n <LinkButton\n v-if=\"props.eventBus && modelLink.schemaKey\"\n @click=\"\n props.eventBus.emit('scroll-to:model-by-name', {\n name: modelLink.schemaKey,\n })\n \">\n {{ modelLink.label }}\n </LinkButton>\n <template v-else>{{ modelLink.label }}</template>\n </template>\n </SchemaPropertyDetail>\n\n <!-- Key constraints from propertyNames (e.g. \"keys: string · uuid\") -->\n <SchemaPropertyDetail\n v-if=\"propertyNamesDetail\"\n truncate>\n <template #prefix>{{ translate('common.keys') }}:</template>\n {{ propertyNamesDetail }}\n </SchemaPropertyDetail>\n\n <!-- Dynamic validation properties from composable -->\n <SchemaPropertyDetail\n v-for=\"property in validationProperties\"\n :key=\"property.key\"\n :code=\"property.code\"\n :truncate=\"property.truncate\">\n <ScreenReader v-if=\"property.key === 'format'\">\n {{ translate('common.format') }}:\n </ScreenReader>\n <ScreenReader v-else-if=\"property.key === 'pattern'\">\n {{ translate('common.pattern') }}:\n </ScreenReader>\n <template\n v-if=\"property.prefix\"\n #prefix>\n {{ property.prefix }}\n </template>\n {{ property.value }}\n </SchemaPropertyDetail>\n\n <!-- Enum indicator -->\n <SchemaPropertyDetail v-if=\"props.enum\">\n {{ translate('common.enum') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.additional\"\n class=\"property-additional\">\n <template v-if=\"props.value?.['x-additionalPropertiesName']\">\n {{ props.value['x-additionalPropertiesName'] }}\n </template>\n <template v-else>{{ translate('common.additionalProperties') }}</template>\n </div>\n <div\n v-if=\"props.value?.deprecated\"\n class=\"property-deprecated\">\n <Badge>{{ translate('common.deprecated') }}</Badge>\n </div>\n <!-- Don't use `isDefined` here, we want to show `const` when the value is `null` -->\n <div\n v-if=\"constValue !== undefined\"\n class=\"property-const\">\n <SchemaPropertyDetail truncate>\n <template #prefix>{{ translate('common.const') }}: </template>\n <RenderString :value=\"constValue\" />\n </SchemaPropertyDetail>\n </div>\n <template v-else>\n <!-- Shows only when a composition is used (so props.value?.type is undefined) -->\n <SchemaPropertyDetail v-if=\"(props.value as any)?.nullable === true\">\n {{ translate('common.nullable') }}\n </SchemaPropertyDetail>\n </template>\n <div\n v-if=\"props.value?.writeOnly\"\n class=\"property-write-only\">\n {{ translate('common.writeOnly') }}\n </div>\n <div\n v-else-if=\"props.value?.readOnly\"\n class=\"property-read-only\">\n {{ translate('common.readOnly') }}\n </div>\n <div\n v-if=\"props.required\"\n class=\"property-required\">\n {{ translate('common.required') }}\n </div>\n <SchemaPropertyDefault :value=\"props.value?.default\" />\n <SchemaPropertyExamples\n v-if=\"props.withExamples\"\n :example=\"exampleValue\"\n :examples=\"props.value?.examples\" />\n </div>\n</template>\n<style scoped>\n.property-heading {\n display: flex;\n flex-wrap: wrap;\n align-items: baseline;\n row-gap: 9px;\n white-space: nowrap;\n}\n\n.property-heading:has(+ .children),\n.property-heading:has(+ .property-rule) {\n margin-bottom: 9px;\n}\n\n.property-heading > * {\n margin-right: 9px;\n}\n\n.property-heading:last-child {\n margin-right: 0;\n}\n\n.property-heading > .property-detail:not(:last-of-type) {\n margin-right: 0;\n}\n\n.property-name {\n max-width: 100%;\n font-family: var(--scalar-font-code);\n font-weight: var(--scalar-bold);\n font-size: var(--scalar-font-size-4);\n white-space: normal;\n overflow-wrap: break-word;\n}\n\n.property-additional {\n font-family: var(--scalar-font-code);\n}\n\n.property-required,\n.property-optional {\n color: var(--scalar-color-2);\n}\n\n.property-required {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-orange);\n}\n\n.property-read-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-blue);\n}\n\n.property-write-only {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-green);\n}\n\n.property-discriminator {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-purple);\n}\n\n.property-detail {\n font-size: var(--scalar-mini);\n color: var(--scalar-color-2);\n display: flex;\n align-items: center;\n\n min-width: 0;\n}\n\n.property-const {\n color: var(--scalar-color-1);\n}\n\n.deprecated {\n text-decoration: line-through;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwBA,MAAM,QAAQ;EAuBd,MAAM,EAAE,cAAc,iBAAgB;EAGtC,MAAM,WAAW,MAAM,OAAO,QAAO;EAErC,MAAM,aAAa,eAAe;AAChC,OAAI,CAAC,SAAS,MACZ;GAGF,MAAM,SAAS,SAAS;AAGxB,OAAI,OAAO,UAAU,KAAA,EACnB,QAAO,OAAO;AAIhB,OAAI,OAAO,MAAM,WAAW,EAC1B,QAAO,OAAO,KAAK;AAIrB,OAAI,cAAc,OAAO,IAAI,OAAO,OAAO;IACzC,MAAM,QAAQ,QAAQ,OAAO,OAAO,MAAK;AAEzC,QAAI,UAAU,MAAM,MAAM,CACxB,QAAO,MAAM;AAGf,QAAI,MAAM,MAAM,WAAW,EACzB,QAAO,MAAM,KAAK;;IAKvB;EAED,MAAM,uBAAuB,eAAe;AAC1C,OAAI,CAAC,SAAS,MACZ,QAAO,EAAC;GAGV,MAAM,SAAS,SAAS;GACxB,MAAM,aAAa,EAAC;AAGpB,OAAI,cAAc,OAAO,EAAE;AACzB,QAAI,OAAO,YAAY,OAAO,SAC5B,YAAW,KAAK;KACd,KAAK;KACL,OAAO,GAAG,OAAO,YAAY,GAAG,GAAG,OAAO,YAAY;KACvD,CAAA;AAIH,QAAI,OAAO,YACT,YAAW,KAAK;KACd,KAAK;KACL,OAAO,GAAG,UAAU,gBAAgB,CAAC;KACtC,CAAA;;AAKL,OAAI,eAAe,OAAO,EAAE;AAC1B,QAAI,OAAO,UACT,YAAW,KAAK;KACd,KAAK;KACL,QAAQ,GAAG,UAAU,mBAAmB,CAAC;KACzC,OAAO,OAAO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AS,aAAA;KACT,UAAU,MAAM,OAAO"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type DynamicScope } from '@scalar/workspace-store/helpers/dynamic-ref';
|
|
2
|
+
import type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document';
|
|
3
|
+
import { type InjectionKey } from 'vue';
|
|
4
|
+
/**
|
|
5
|
+
* The dynamic scope — the outermost-first chain of schema resources on the current render path.
|
|
6
|
+
*
|
|
7
|
+
* JSON Schema 2020-12 `$dynamicRef` does not resolve to a fixed location. It binds to the active
|
|
8
|
+
* `$dynamicAnchor` in the chain of resources entered to reach it, so the same
|
|
9
|
+
* `{ "$dynamicRef": "#itemType" }` inside a shared generic template resolves to a different concrete
|
|
10
|
+
* type depending on the path taken (e.g. `User` via a user page, `Group` via a group page).
|
|
11
|
+
*
|
|
12
|
+
* Each object `Schema` node injects this scope, appends its own resource, and re-provides it to its
|
|
13
|
+
* descendants. `SchemaProperty` reads it to bind a `$dynamicRef` property or array item to the
|
|
14
|
+
* concrete schema while walking the tree. See https://github.com/scalar/scalar/issues/9414.
|
|
15
|
+
*/
|
|
16
|
+
export declare const SCHEMA_DYNAMIC_SCOPE_SYMBOL: InjectionKey<DynamicScope>;
|
|
17
|
+
/** Read the dynamic scope provided by ancestor schema nodes (empty at the root of the tree). */
|
|
18
|
+
export declare const useDynamicScope: () => DynamicScope;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve a schema that may be a `$dynamicRef` against the active dynamic scope.
|
|
21
|
+
*
|
|
22
|
+
* Returns the bound concrete schema when the reference matches a `$dynamicAnchor` in scope. When
|
|
23
|
+
* nothing matches (or the schema is not a `$dynamicRef`) the input is returned unchanged, so
|
|
24
|
+
* rendering falls back to its prior behavior with no regression.
|
|
25
|
+
*/
|
|
26
|
+
export declare const resolveDynamicSchema: <T extends SchemaObject | undefined>(schema: T, scope: DynamicScope) => T;
|
|
27
|
+
//# sourceMappingURL=dynamic-scope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-scope.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/dynamic-scope.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAmC,MAAM,6CAA6C,CAAA;AAChH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAChG,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,KAAK,CAAA;AAE/C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,EAAE,YAAY,CAAC,YAAY,CAAkC,CAAA;AAKrG,gGAAgG;AAChG,eAAO,MAAM,eAAe,QAAO,YAAgE,CAAA;AAEnG;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,YAAY,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,YAAY,KAAG,CAMzG,CAAA"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { inject } from "vue";
|
|
2
|
+
import { isDynamicRef, resolveDynamicRef } from "@scalar/workspace-store/helpers/dynamic-ref";
|
|
3
|
+
//#region src/components/Content/Schema/helpers/dynamic-scope.ts
|
|
4
|
+
/**
|
|
5
|
+
* The dynamic scope — the outermost-first chain of schema resources on the current render path.
|
|
6
|
+
*
|
|
7
|
+
* JSON Schema 2020-12 `$dynamicRef` does not resolve to a fixed location. It binds to the active
|
|
8
|
+
* `$dynamicAnchor` in the chain of resources entered to reach it, so the same
|
|
9
|
+
* `{ "$dynamicRef": "#itemType" }` inside a shared generic template resolves to a different concrete
|
|
10
|
+
* type depending on the path taken (e.g. `User` via a user page, `Group` via a group page).
|
|
11
|
+
*
|
|
12
|
+
* Each object `Schema` node injects this scope, appends its own resource, and re-provides it to its
|
|
13
|
+
* descendants. `SchemaProperty` reads it to bind a `$dynamicRef` property or array item to the
|
|
14
|
+
* concrete schema while walking the tree. See https://github.com/scalar/scalar/issues/9414.
|
|
15
|
+
*/
|
|
16
|
+
var SCHEMA_DYNAMIC_SCOPE_SYMBOL = Symbol("schema-dynamic-scope");
|
|
17
|
+
/** Shared empty scope used as the inject default at the root, where nothing has been entered yet. */
|
|
18
|
+
var EMPTY_SCOPE = [];
|
|
19
|
+
/** Read the dynamic scope provided by ancestor schema nodes (empty at the root of the tree). */
|
|
20
|
+
var useDynamicScope = () => inject(SCHEMA_DYNAMIC_SCOPE_SYMBOL, EMPTY_SCOPE);
|
|
21
|
+
/**
|
|
22
|
+
* Resolve a schema that may be a `$dynamicRef` against the active dynamic scope.
|
|
23
|
+
*
|
|
24
|
+
* Returns the bound concrete schema when the reference matches a `$dynamicAnchor` in scope. When
|
|
25
|
+
* nothing matches (or the schema is not a `$dynamicRef`) the input is returned unchanged, so
|
|
26
|
+
* rendering falls back to its prior behavior with no regression.
|
|
27
|
+
*/
|
|
28
|
+
var resolveDynamicSchema = (schema, scope) => {
|
|
29
|
+
if (isDynamicRef(schema)) return resolveDynamicRef(schema.$dynamicRef, scope) ?? schema;
|
|
30
|
+
return schema;
|
|
31
|
+
};
|
|
32
|
+
//#endregion
|
|
33
|
+
export { SCHEMA_DYNAMIC_SCOPE_SYMBOL, resolveDynamicSchema, useDynamicScope };
|
|
34
|
+
|
|
35
|
+
//# sourceMappingURL=dynamic-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dynamic-scope.js","names":[],"sources":["../../../../../src/components/Content/Schema/helpers/dynamic-scope.ts"],"sourcesContent":["import { type DynamicScope, isDynamicRef, resolveDynamicRef } from '@scalar/workspace-store/helpers/dynamic-ref'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { type InjectionKey, inject } from 'vue'\n\n/**\n * The dynamic scope — the outermost-first chain of schema resources on the current render path.\n *\n * JSON Schema 2020-12 `$dynamicRef` does not resolve to a fixed location. It binds to the active\n * `$dynamicAnchor` in the chain of resources entered to reach it, so the same\n * `{ \"$dynamicRef\": \"#itemType\" }` inside a shared generic template resolves to a different concrete\n * type depending on the path taken (e.g. `User` via a user page, `Group` via a group page).\n *\n * Each object `Schema` node injects this scope, appends its own resource, and re-provides it to its\n * descendants. `SchemaProperty` reads it to bind a `$dynamicRef` property or array item to the\n * concrete schema while walking the tree. See https://github.com/scalar/scalar/issues/9414.\n */\nexport const SCHEMA_DYNAMIC_SCOPE_SYMBOL: InjectionKey<DynamicScope> = Symbol('schema-dynamic-scope')\n\n/** Shared empty scope used as the inject default at the root, where nothing has been entered yet. */\nconst EMPTY_SCOPE: DynamicScope = []\n\n/** Read the dynamic scope provided by ancestor schema nodes (empty at the root of the tree). */\nexport const useDynamicScope = (): DynamicScope => inject(SCHEMA_DYNAMIC_SCOPE_SYMBOL, EMPTY_SCOPE)\n\n/**\n * Resolve a schema that may be a `$dynamicRef` against the active dynamic scope.\n *\n * Returns the bound concrete schema when the reference matches a `$dynamicAnchor` in scope. When\n * nothing matches (or the schema is not a `$dynamicRef`) the input is returned unchanged, so\n * rendering falls back to its prior behavior with no regression.\n */\nexport const resolveDynamicSchema = <T extends SchemaObject | undefined>(schema: T, scope: DynamicScope): T => {\n if (isDynamicRef(schema)) {\n return (resolveDynamicRef(schema.$dynamicRef, scope) as T) ?? schema\n }\n\n return schema\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,IAAa,8BAA0D,OAAO,uBAAuB;;AAGrG,IAAM,cAA4B,EAAE;;AAGpC,IAAa,wBAAsC,OAAO,6BAA6B,YAAY;;;;;;;;AASnG,IAAa,wBAA4D,QAAW,UAA2B;AAC7G,KAAI,aAAa,OAAO,CACtB,QAAQ,kBAAkB,OAAO,aAAa,MAAM,IAAU;AAGhE,QAAO"}
|
|
@@ -5,6 +5,16 @@ type CompositionToRender = {
|
|
|
5
5
|
value: SchemaObject;
|
|
6
6
|
};
|
|
7
7
|
type DocumentSchemaLookup = Pick<OpenApiDocument, 'components'>;
|
|
8
|
+
/**
|
|
9
|
+
* Builds a synthetic `oneOf` composition from a `discriminator.mapping` when the
|
|
10
|
+
* schema declares a mapping but no explicit `oneOf`/`anyOf`. This is the shape
|
|
11
|
+
* NSwag emits for polymorphic types, where the base type is a plain object with
|
|
12
|
+
* a discriminator mapping pointing at the concrete variants.
|
|
13
|
+
*
|
|
14
|
+
* Returns `null` when there is nothing to infer (an explicit composition is
|
|
15
|
+
* already present, no document to resolve refs against, or no resolvable refs).
|
|
16
|
+
*/
|
|
17
|
+
export declare const inferDiscriminatorMappingComposition: (value: SchemaObject, document?: DocumentSchemaLookup) => SchemaObject | null;
|
|
8
18
|
/**
|
|
9
19
|
* Computes which compositions should be rendered and with which values
|
|
10
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-compositions-to-render.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/get-compositions-to-render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIjH,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,sBAAsB,CAAA;AAG5E,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"get-compositions-to-render.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Schema/helpers/get-compositions-to-render.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAIjH,OAAO,EAAE,KAAK,kBAAkB,EAAgB,MAAM,sBAAsB,CAAA;AAG5E,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,KAAK,EAAE,YAAY,CAAA;CACpB,CAAA;AAED,KAAK,oBAAoB,GAAG,IAAI,CAAC,eAAe,EAAE,YAAY,CAAC,CAAA;AAK/D;;;;;;;;GAQG;AACH,eAAO,MAAM,oCAAoC,GAC/C,OAAO,YAAY,EACnB,WAAW,oBAAoB,KAC9B,YAAY,GAAG,IA+BjB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAClC,OAAO,YAAY,GAAG,SAAS,EAC/B,WAAW,oBAAoB,KAC9B,mBAAmB,EAyCrB,CAAA"}
|
|
@@ -2,10 +2,19 @@ import { getRefName } from "./get-ref-name.js";
|
|
|
2
2
|
import { compositions } from "./schema-composition.js";
|
|
3
3
|
import { shouldRenderArrayItemComposition } from "./should-render-array-item-composition.js";
|
|
4
4
|
import { resolve } from "@scalar/workspace-store/resolve";
|
|
5
|
-
import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
|
|
6
5
|
import { isDefined } from "@scalar/helpers/array/is-defined";
|
|
6
|
+
import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
|
|
7
7
|
//#region src/components/Content/Schema/helpers/get-compositions-to-render.ts
|
|
8
8
|
var normalizeDiscriminatorMappingRef = (value) => value.startsWith("#/") || value.includes("/") ? value : `#/components/schemas/${value}`;
|
|
9
|
+
/**
|
|
10
|
+
* Builds a synthetic `oneOf` composition from a `discriminator.mapping` when the
|
|
11
|
+
* schema declares a mapping but no explicit `oneOf`/`anyOf`. This is the shape
|
|
12
|
+
* NSwag emits for polymorphic types, where the base type is a plain object with
|
|
13
|
+
* a discriminator mapping pointing at the concrete variants.
|
|
14
|
+
*
|
|
15
|
+
* Returns `null` when there is nothing to infer (an explicit composition is
|
|
16
|
+
* already present, no document to resolve refs against, or no resolvable refs).
|
|
17
|
+
*/
|
|
9
18
|
var inferDiscriminatorMappingComposition = (value, document) => {
|
|
10
19
|
if (value.oneOf || value.anyOf || !document?.components?.schemas) return null;
|
|
11
20
|
const refs = Object.values(value.discriminator?.mapping ?? {}).filter((mappingValue) => typeof mappingValue === "string").map((mappingValue) => {
|
|
@@ -52,6 +61,6 @@ var getCompositionsToRender = (value, document) => {
|
|
|
52
61
|
}).filter(isDefined);
|
|
53
62
|
};
|
|
54
63
|
//#endregion
|
|
55
|
-
export { getCompositionsToRender };
|
|
64
|
+
export { getCompositionsToRender, inferDiscriminatorMappingComposition };
|
|
56
65
|
|
|
57
66
|
//# sourceMappingURL=get-compositions-to-render.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-compositions-to-render.js","names":[],"sources":["../../../../../src/components/Content/Schema/helpers/get-compositions-to-render.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { OpenApiDocument, SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\nimport { getRefName } from './get-ref-name'\nimport { type CompositionKeyword, compositions } from './schema-composition'\nimport { shouldRenderArrayItemComposition } from './should-render-array-item-composition'\n\ntype CompositionToRender = {\n composition: CompositionKeyword\n value: SchemaObject\n}\n\ntype DocumentSchemaLookup = Pick<OpenApiDocument, 'components'>\n\nconst normalizeDiscriminatorMappingRef = (value: string) =>\n value.startsWith('#/') || value.includes('/') ? value : `#/components/schemas/${value}`\n\
|
|
1
|
+
{"version":3,"file":"get-compositions-to-render.js","names":[],"sources":["../../../../../src/components/Content/Schema/helpers/get-compositions-to-render.ts"],"sourcesContent":["import { isDefined } from '@scalar/helpers/array/is-defined'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { OpenApiDocument, SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\nimport { getRefName } from './get-ref-name'\nimport { type CompositionKeyword, compositions } from './schema-composition'\nimport { shouldRenderArrayItemComposition } from './should-render-array-item-composition'\n\ntype CompositionToRender = {\n composition: CompositionKeyword\n value: SchemaObject\n}\n\ntype DocumentSchemaLookup = Pick<OpenApiDocument, 'components'>\n\nconst normalizeDiscriminatorMappingRef = (value: string) =>\n value.startsWith('#/') || value.includes('/') ? value : `#/components/schemas/${value}`\n\n/**\n * Builds a synthetic `oneOf` composition from a `discriminator.mapping` when the\n * schema declares a mapping but no explicit `oneOf`/`anyOf`. This is the shape\n * NSwag emits for polymorphic types, where the base type is a plain object with\n * a discriminator mapping pointing at the concrete variants.\n *\n * Returns `null` when there is nothing to infer (an explicit composition is\n * already present, no document to resolve refs against, or no resolvable refs).\n */\nexport const inferDiscriminatorMappingComposition = (\n value: SchemaObject,\n document?: DocumentSchemaLookup,\n): SchemaObject | null => {\n if (value.oneOf || value.anyOf || !document?.components?.schemas) {\n return null\n }\n\n const refs = Object.values(value.discriminator?.mapping ?? {})\n .filter((mappingValue): mappingValue is string => typeof mappingValue === 'string')\n .map((mappingValue) => {\n const ref = normalizeDiscriminatorMappingRef(mappingValue)\n const refName = getRefName(ref)\n const refValue = refName ? resolve.schema(document.components?.schemas?.[refName]) : undefined\n\n if (!refValue) {\n return undefined\n }\n\n return {\n $ref: ref,\n '$ref-value': refValue,\n }\n })\n .filter(isDefined)\n\n if (refs.length === 0) {\n return null\n }\n\n return {\n ...resolve.schema(value),\n oneOf: refs as NonNullable<SchemaObject['oneOf']>,\n }\n}\n\n/**\n * Computes which compositions should be rendered and with which values\n *\n * @param value - The schema object to check for compositions\n * @returns Array of compositions to render with their values\n */\nexport const getCompositionsToRender = (\n value: SchemaObject | undefined,\n document?: DocumentSchemaLookup,\n): CompositionToRender[] => {\n if (!value) {\n return []\n }\n\n const inferredDiscriminatorComposition = inferDiscriminatorMappingComposition(value, document)\n\n return compositions\n .map((composition) => {\n if (composition === 'oneOf' && inferredDiscriminatorComposition) {\n return {\n composition,\n value: inferredDiscriminatorComposition,\n }\n }\n\n // Check for array item-level composition first (more specific case)\n if (shouldRenderArrayItemComposition(value, composition) && isArraySchema(value) && value.items) {\n return {\n composition,\n value: resolve.schema(value.items),\n }\n }\n\n // Check for property-level composition\n if (value[composition]) {\n // Skip if array items have this composition (even if complex/not rendered)\n const hasArrayItemComposition =\n isArraySchema(value) && value.items && typeof value.items === 'object' && composition in value.items\n\n if (!hasArrayItemComposition) {\n return {\n composition,\n value: resolve.schema(value),\n }\n }\n }\n\n return null\n })\n .filter(isDefined)\n}\n"],"mappings":";;;;;;;AAgBA,IAAM,oCAAoC,UACxC,MAAM,WAAW,KAAK,IAAI,MAAM,SAAS,IAAI,GAAG,QAAQ,wBAAwB;;;;;;;;;;AAWlF,IAAa,wCACX,OACA,aACwB;AACxB,KAAI,MAAM,SAAS,MAAM,SAAS,CAAC,UAAU,YAAY,QACvD,QAAO;CAGT,MAAM,OAAO,OAAO,OAAO,MAAM,eAAe,WAAW,EAAE,CAAC,CAC3D,QAAQ,iBAAyC,OAAO,iBAAiB,SAAS,CAClF,KAAK,iBAAiB;EACrB,MAAM,MAAM,iCAAiC,aAAa;EAC1D,MAAM,UAAU,WAAW,IAAI;EAC/B,MAAM,WAAW,UAAU,QAAQ,OAAO,SAAS,YAAY,UAAU,SAAS,GAAG,KAAA;AAErF,MAAI,CAAC,SACH;AAGF,SAAO;GACL,MAAM;GACN,cAAc;GACf;GACD,CACD,OAAO,UAAU;AAEpB,KAAI,KAAK,WAAW,EAClB,QAAO;AAGT,QAAO;EACL,GAAG,QAAQ,OAAO,MAAM;EACxB,OAAO;EACR;;;;;;;;AASH,IAAa,2BACX,OACA,aAC0B;AAC1B,KAAI,CAAC,MACH,QAAO,EAAE;CAGX,MAAM,mCAAmC,qCAAqC,OAAO,SAAS;AAE9F,QAAO,aACJ,KAAK,gBAAgB;AACpB,MAAI,gBAAgB,WAAW,iCAC7B,QAAO;GACL;GACA,OAAO;GACR;AAIH,MAAI,iCAAiC,OAAO,YAAY,IAAI,cAAc,MAAM,IAAI,MAAM,MACxF,QAAO;GACL;GACA,OAAO,QAAQ,OAAO,MAAM,MAAM;GACnC;AAIH,MAAI,MAAM;OAKJ,EAFF,cAAc,MAAM,IAAI,MAAM,SAAS,OAAO,MAAM,UAAU,YAAY,eAAe,MAAM,OAG/F,QAAO;IACL;IACA,OAAO,QAAQ,OAAO,MAAM;IAC7B;;AAIL,SAAO;GACP,CACD,OAAO,UAAU"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
2
2
|
import { resolve } from "@scalar/workspace-store/resolve";
|
|
3
|
-
import { objectKeys } from "@scalar/helpers/object/object-keys";
|
|
4
3
|
import { isArraySchema } from "@scalar/workspace-store/schemas/v3.1/strict/type-guards";
|
|
4
|
+
import { objectKeys } from "@scalar/helpers/object/object-keys";
|
|
5
5
|
//#region src/components/Content/Schema/helpers/merge-all-of-schemas.ts
|
|
6
6
|
/**
|
|
7
7
|
* Schema keywords whose value should reflect the *last* occurrence when merging
|
|
@@ -101,7 +101,14 @@ var mergePropertiesIntoResult = (result, properties, seenRefs = /* @__PURE__ */
|
|
|
101
101
|
continue;
|
|
102
102
|
}
|
|
103
103
|
if (!result[key]) {
|
|
104
|
-
|
|
104
|
+
const rawProperty = properties[key];
|
|
105
|
+
const newSchemaRef = rawProperty?.$ref;
|
|
106
|
+
if (rawProperty && typeof newSchemaRef === "string" && seenRefs.has(newSchemaRef)) {
|
|
107
|
+
result[key] = rawProperty;
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
const nextNewSeenRefs = typeof newSchemaRef === "string" ? new Set(seenRefs).add(newSchemaRef) : seenRefs;
|
|
111
|
+
if (schema.allOf) result[key] = mergeAllOfSchemas(schema, void 0, nextNewSeenRefs);
|
|
105
112
|
else if (isArraySchema(schema) && resolve.schema(schema.items)?.allOf) result[key] = {
|
|
106
113
|
...schema,
|
|
107
114
|
items: mergeAllOfSchemas(resolve.schema(schema.items), void 0, seenRefs)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"merge-all-of-schemas.js","names":[],"sources":["../../../../../src/components/Content/Schema/helpers/merge-all-of-schemas.ts"],"sourcesContent":["import { objectKeys } from '@scalar/helpers/object/object-keys'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\n/**\n * Schema keywords whose value should reflect the *last* occurrence when merging\n * `allOf` members. Most keywords keep the first occurrence, but for human-facing\n * annotations a later subschema is expected to override an earlier one — matching\n * OpenAPI/JSON Schema tooling like Swagger UI.\n */\nconst LAST_WINS_KEYS = new Set<string>(['description', 'title'])\n\n/**\n * Merges multiple OpenAPI schema objects into a single schema object.\n * Handles nested allOf compositions and merges properties recursively.\n *\n * @param schemas - Array of OpenAPI schema objects to merge\n * @param rootSchema - Optional root schema to merge with the result\n * @param seenRefs - `$ref` strings already being merged higher in the call stack\n * @returns Merged schema object\n */\nexport const mergeAllOfSchemas = (\n schemas: SchemaObject | undefined,\n rootSchema?: SchemaObject,\n seenRefs: Set<string> = new Set(),\n): SchemaObject => {\n // Handle max depth, empty or invalid input\n if (!schemas?.allOf?.length || !Array.isArray(schemas.allOf)) {\n return rootSchema || ({} as SchemaObject)\n }\n\n // Initialize result object once\n const result = {} as SchemaObject\n\n // Extract base schema properties (everything except allOf)\n const { allOf: _, ...baseSchema } = schemas\n\n // Process allOf schemas first\n for (const _schema of schemas.allOf) {\n if (!_schema || typeof _schema !== 'object') {\n continue\n }\n\n // Resolve ref if present\n const schema = resolve.schema(_schema)\n\n // Handle nested allOf recursively\n if (schema.allOf) {\n const nestedMerged = mergeAllOfSchemas(schema, undefined, seenRefs)\n mergeSchemaIntoResult(result, nestedMerged, false, seenRefs)\n continue\n }\n\n mergeSchemaIntoResult(result, schema, false, seenRefs)\n }\n\n // Apply base schema properties with precedence over allOf properties\n if (Object.keys(baseSchema).length > 0) {\n mergeSchemaIntoResult(result, baseSchema, true, seenRefs)\n }\n\n // Process root schema last if provided\n if (rootSchema && typeof rootSchema === 'object') {\n if (rootSchema.allOf) {\n const nestedMerged = mergeAllOfSchemas(rootSchema, undefined, seenRefs)\n mergeSchemaIntoResult(result, nestedMerged, true, seenRefs)\n } else {\n mergeSchemaIntoResult(result, rootSchema, true, seenRefs)\n }\n }\n\n return result\n}\n\n/**\n * Efficiently merges a source schema into a target result object.\n * Handles all schema merging logic in a single optimized function.\n *\n * @param result - The target schema object to merge into\n * @param schema - The source schema object to merge from\n * @param override - Whether to override existing properties (default: false)\n */\nconst mergeSchemaIntoResult = (\n result: SchemaObject,\n schema: SchemaObject,\n override: boolean = false,\n seenRefs: Set<string> = new Set(),\n): void => {\n // Early return if schema is empty\n const schemaKeys = objectKeys(schema)\n if (schemaKeys.length === 0) {\n return\n }\n\n // Loop through all schema properties and handle them appropriately\n for (const key of schemaKeys) {\n const value = getResolvedRef(schema[key]) as any\n\n if (value === undefined) {\n continue\n }\n\n // Required\n if ((key as string) === 'required') {\n // Merge required fields with deduplication\n if (Array.isArray(value) && value.length > 0) {\n // @ts-expect-error\n if (result.required?.length) {\n // @ts-expect-error\n result.required = [...new Set([...result.required, ...value])]\n } else {\n // @ts-expect-error\n result.required = value.slice()\n }\n }\n }\n // Properties\n else if ((key as string) === 'properties') {\n // Merge properties recursively\n if (value && typeof value === 'object') {\n // @ts-expect-error\n if (!result.properties) {\n // @ts-expect-error\n result.properties = {}\n }\n\n // @ts-expect-error\n mergePropertiesIntoResult(result.properties, value, seenRefs)\n }\n }\n // Items\n else if ((key as string) === 'items') {\n // Handle items (for both arrays and objects with items)\n const items = resolve.schema(value)\n if (items) {\n if (isArraySchema(schema)) {\n // @ts-expect-error\n if (!result.items) {\n // @ts-expect-error\n result.items = {}\n }\n\n // Handle allOf within array items\n if (items.allOf) {\n const mergedItems = mergeAllOfSchemas(items, undefined, seenRefs)\n // @ts-expect-error\n Object.assign(result.items, mergedItems)\n } else {\n // @ts-expect-error\n mergeItemsIntoResult(getResolvedRef(result.items), items, seenRefs)\n }\n }\n // For non-array types with items.allOf, merge into properties\n else if (items.allOf) {\n const mergedItems = mergeAllOfSchemas(items, undefined, seenRefs)\n if ('properties' in mergedItems) {\n if (!('properties' in result)) {\n // @ts-expect-error\n result.properties = {}\n }\n\n 'properties' in result && mergePropertiesIntoResult(result.properties, mergedItems.properties, seenRefs)\n }\n }\n // For non-array types without allOf, still set items if not already set\n else if (!('items' in result)) {\n // @ts-expect-error\n result.items = items\n }\n }\n }\n // Enum\n else if (key === 'enum') {\n if (Array.isArray(value) && value.length > 0) {\n result.enum = [...new Set([...(result.enum || []), ...value])]\n }\n }\n // OneOf/AnyOf\n else if (key === 'oneOf' || key === 'anyOf') {\n // Preserve the composition itself so its variants keep rendering as a\n // selector. Flattening the option properties into the parent would drop\n // the variant structure entirely and silently lose branches that have no\n // top-level `properties` (for example branches that are themselves an\n // `allOf`). The sibling `allOf` members stay on `result` as base\n // properties, which the Schema component renders above the selector.\n if (Array.isArray(value) && value.length > 0 && (override || result[key] === undefined)) {\n result[key] = value\n }\n }\n // Skip allOf as it's handled at a higher level\n else if (key === 'allOf') {\n continue\n }\n // For all other properties, preserve the first occurrence or override if specified.\n // Annotation keywords (see LAST_WINS_KEYS) always take the latest value so a later\n // allOf member can override an earlier one.\n else {\n if (override || LAST_WINS_KEYS.has(key as string) || result[key] === undefined) {\n result[key] = value\n }\n }\n }\n}\n\n/**\n * Efficiently merges properties into a result object without creating new objects.\n */\nconst mergePropertiesIntoResult = (\n result: Extract<SchemaObject, { type: 'object' }>['properties'],\n properties: Extract<SchemaObject, { type: 'object' }>['properties'],\n seenRefs: Set<string> = new Set(),\n): void => {\n const propertyKeys = Object.keys(properties ?? {})\n if (!properties || !result || propertyKeys.length === 0) {\n return\n }\n\n for (const key of propertyKeys) {\n const schema = resolve.schema(properties[key])\n if (!schema) {\n delete result[key]\n continue\n }\n\n if (typeof schema !== 'object') {\n result[key] = schema\n continue\n }\n\n if (!result[key]) {\n // Handle new property with allOf\n if (schema.allOf) {\n result[key] = mergeAllOfSchemas(schema, undefined, seenRefs)\n } else if (isArraySchema(schema) && resolve.schema(schema.items)?.allOf) {\n result[key] = {\n ...schema,\n items: mergeAllOfSchemas(resolve.schema(schema.items), undefined, seenRefs),\n }\n } else if (properties[key]) {\n result[key] = properties[key]\n }\n continue\n }\n\n // Merge existing property\n const existing = resolve.schema(result[key])\n\n // Break self-referential cycles: when this property's `$ref` is already\n // being merged higher in the call stack, keep the partially merged existing\n // schema instead of recursing into it again. This mirrors the guard in\n // `mergeItems` and covers schemas that point back at themselves through a\n // plain object property (e.g. a tree node whose `parent` $refs the node).\n const schemaRef = (schema as { $ref?: string }).$ref\n if (typeof schemaRef === 'string' && seenRefs.has(schemaRef)) {\n result[key] = existing\n continue\n }\n const nextSeenRefs = typeof schemaRef === 'string' ? new Set(seenRefs).add(schemaRef) : seenRefs\n\n if (schema.allOf) {\n result[key] = mergeAllOfSchemas({ allOf: [existing, ...schema.allOf] } as SchemaObject, undefined, nextSeenRefs)\n } else if (isArraySchema(schema) && isArraySchema(existing) && schema.items) {\n const existingItems = resolve.schema(existing.items)\n result[key] = {\n ...existing,\n type: 'array',\n items: existingItems\n ? mergeItems(existingItems, resolve.schema(schema.items), nextSeenRefs)\n : resolve.schema(schema.items),\n }\n } else {\n // Create merged object with properties handled separately\n if ('properties' in existing && 'properties' in schema) {\n const merged = { ...existing, ...schema }\n merged.properties = { ...existing.properties }\n mergePropertiesIntoResult(merged.properties, schema.properties, nextSeenRefs)\n result[key] = merged\n }\n // Simple merge without property recursion\n else {\n result[key] = { ...schema, ...existing }\n }\n }\n }\n}\n\n/**\n * Efficiently merges array items into a result object.\n */\nconst mergeItemsIntoResult = (result: SchemaObject, items: SchemaObject, seenRefs: Set<string> = new Set()): void => {\n // Handle allOf in items\n if (items.allOf || result.allOf) {\n // Build array without spreads for better performance\n const allOfSchemas: SchemaObject[] = []\n\n if (result.allOf) {\n for (const schema of result.allOf) {\n allOfSchemas.push(resolve.schema(schema))\n }\n } else {\n allOfSchemas.push(result)\n }\n\n if (items.allOf) {\n for (const schema of items.allOf) {\n allOfSchemas.push(resolve.schema(schema))\n }\n } else {\n allOfSchemas.push(items)\n }\n\n const merged = mergeAllOfSchemas({ allOf: allOfSchemas } as SchemaObject, undefined, seenRefs)\n Object.assign(result, merged)\n return\n }\n\n // Regular merge\n Object.assign(result, items)\n\n // Merge properties if both have them\n if ('properties' in result && 'properties' in items) {\n mergePropertiesIntoResult(result.properties, items.properties, seenRefs)\n }\n}\n\n/**\n * Helper function for merging items that returns a new object.\n */\nconst mergeItems = (\n existing: SchemaObject,\n incoming: SchemaObject,\n seenRefs: Set<string> = new Set(),\n): SchemaObject => {\n const incomingRef = (incoming as { $ref?: string }).$ref\n\n if (typeof incomingRef === 'string') {\n if (seenRefs.has(incomingRef)) {\n return existing\n }\n return mergeItemsInner(existing, incoming, new Set(seenRefs).add(incomingRef))\n }\n\n return mergeItemsInner(existing, incoming, seenRefs)\n}\n\nconst mergeItemsInner = (\n existing: SchemaObject,\n incoming: SchemaObject,\n seenRefs: Set<string> = new Set(),\n): SchemaObject => {\n // Handle allOf in either schema\n if (existing.allOf || incoming.allOf) {\n // Build array without spreads for better performance\n const allOfSchemas: SchemaObject[] = []\n\n if (existing.allOf) {\n for (const schema of existing.allOf) {\n allOfSchemas.push(resolve.schema(schema))\n }\n } else {\n allOfSchemas.push(existing)\n }\n\n if (incoming.allOf) {\n for (const schema of incoming.allOf) {\n allOfSchemas.push(resolve.schema(schema))\n }\n } else {\n allOfSchemas.push(incoming)\n }\n\n return mergeAllOfSchemas({ allOf: allOfSchemas } as SchemaObject, undefined, seenRefs)\n }\n\n const merged = { ...existing, ...incoming }\n\n // Recursively merge properties if both have properties\n if ('properties' in existing && 'properties' in incoming) {\n // @ts-expect-error\n merged.properties = { ...existing.properties }\n // @ts-expect-error\n mergePropertiesIntoResult(merged.properties, incoming.properties, seenRefs)\n }\n\n return merged as SchemaObject\n}\n"],"mappings":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7B,MAAI,SAAS,MACX,MAAK,MAAM,UAAU,SAAS,MAC5B,cAAa,KAAK,QAAQ,OAAO,OAAO,CAAC;MAG3C,cAAa,KAAK,SAAS;AAG7B,SAAO,kBAAkB,EAAE,OAAO,cAAc,EAAkB,KAAA,GAAW,SAAS;;CAGxF,MAAM,SAAS;EAAE,GAAG;EAAU,GAAG;EAAU;AAG3C,KAAI,gBAAgB,YAAY,gBAAgB,UAAU;AAExD,SAAO,aAAa,EAAE,GAAG,SAAS,YAAY;AAE9C,4BAA0B,OAAO,YAAY,SAAS,YAAY,SAAS;;AAG7E,QAAO"}
|
|
1
|
+
{"version":3,"file":"merge-all-of-schemas.js","names":[],"sources":["../../../../../src/components/Content/Schema/helpers/merge-all-of-schemas.ts"],"sourcesContent":["import { objectKeys } from '@scalar/helpers/object/object-keys'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isArraySchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\n/**\n * Schema keywords whose value should reflect the *last* occurrence when merging\n * `allOf` members. Most keywords keep the first occurrence, but for human-facing\n * annotations a later subschema is expected to override an earlier one — matching\n * OpenAPI/JSON Schema tooling like Swagger UI.\n */\nconst LAST_WINS_KEYS = new Set<string>(['description', 'title'])\n\n/**\n * Merges multiple OpenAPI schema objects into a single schema object.\n * Handles nested allOf compositions and merges properties recursively.\n *\n * @param schemas - Array of OpenAPI schema objects to merge\n * @param rootSchema - Optional root schema to merge with the result\n * @param seenRefs - `$ref` strings already being merged higher in the call stack\n * @returns Merged schema object\n */\nexport const mergeAllOfSchemas = (\n schemas: SchemaObject | undefined,\n rootSchema?: SchemaObject,\n seenRefs: Set<string> = new Set(),\n): SchemaObject => {\n // Handle max depth, empty or invalid input\n if (!schemas?.allOf?.length || !Array.isArray(schemas.allOf)) {\n return rootSchema || ({} as SchemaObject)\n }\n\n // Initialize result object once\n const result = {} as SchemaObject\n\n // Extract base schema properties (everything except allOf)\n const { allOf: _, ...baseSchema } = schemas\n\n // Process allOf schemas first\n for (const _schema of schemas.allOf) {\n if (!_schema || typeof _schema !== 'object') {\n continue\n }\n\n // Resolve ref if present\n const schema = resolve.schema(_schema)\n\n // Handle nested allOf recursively\n if (schema.allOf) {\n const nestedMerged = mergeAllOfSchemas(schema, undefined, seenRefs)\n mergeSchemaIntoResult(result, nestedMerged, false, seenRefs)\n continue\n }\n\n mergeSchemaIntoResult(result, schema, false, seenRefs)\n }\n\n // Apply base schema properties with precedence over allOf properties\n if (Object.keys(baseSchema).length > 0) {\n mergeSchemaIntoResult(result, baseSchema, true, seenRefs)\n }\n\n // Process root schema last if provided\n if (rootSchema && typeof rootSchema === 'object') {\n if (rootSchema.allOf) {\n const nestedMerged = mergeAllOfSchemas(rootSchema, undefined, seenRefs)\n mergeSchemaIntoResult(result, nestedMerged, true, seenRefs)\n } else {\n mergeSchemaIntoResult(result, rootSchema, true, seenRefs)\n }\n }\n\n return result\n}\n\n/**\n * Efficiently merges a source schema into a target result object.\n * Handles all schema merging logic in a single optimized function.\n *\n * @param result - The target schema object to merge into\n * @param schema - The source schema object to merge from\n * @param override - Whether to override existing properties (default: false)\n */\nconst mergeSchemaIntoResult = (\n result: SchemaObject,\n schema: SchemaObject,\n override: boolean = false,\n seenRefs: Set<string> = new Set(),\n): void => {\n // Early return if schema is empty\n const schemaKeys = objectKeys(schema)\n if (schemaKeys.length === 0) {\n return\n }\n\n // Loop through all schema properties and handle them appropriately\n for (const key of schemaKeys) {\n const value = getResolvedRef(schema[key]) as any\n\n if (value === undefined) {\n continue\n }\n\n // Required\n if ((key as string) === 'required') {\n // Merge required fields with deduplication\n if (Array.isArray(value) && value.length > 0) {\n // @ts-expect-error\n if (result.required?.length) {\n // @ts-expect-error\n result.required = [...new Set([...result.required, ...value])]\n } else {\n // @ts-expect-error\n result.required = value.slice()\n }\n }\n }\n // Properties\n else if ((key as string) === 'properties') {\n // Merge properties recursively\n if (value && typeof value === 'object') {\n // @ts-expect-error\n if (!result.properties) {\n // @ts-expect-error\n result.properties = {}\n }\n\n // @ts-expect-error\n mergePropertiesIntoResult(result.properties, value, seenRefs)\n }\n }\n // Items\n else if ((key as string) === 'items') {\n // Handle items (for both arrays and objects with items)\n const items = resolve.schema(value)\n if (items) {\n if (isArraySchema(schema)) {\n // @ts-expect-error\n if (!result.items) {\n // @ts-expect-error\n result.items = {}\n }\n\n // Handle allOf within array items\n if (items.allOf) {\n const mergedItems = mergeAllOfSchemas(items, undefined, seenRefs)\n // @ts-expect-error\n Object.assign(result.items, mergedItems)\n } else {\n // @ts-expect-error\n mergeItemsIntoResult(getResolvedRef(result.items), items, seenRefs)\n }\n }\n // For non-array types with items.allOf, merge into properties\n else if (items.allOf) {\n const mergedItems = mergeAllOfSchemas(items, undefined, seenRefs)\n if ('properties' in mergedItems) {\n if (!('properties' in result)) {\n // @ts-expect-error\n result.properties = {}\n }\n\n 'properties' in result && mergePropertiesIntoResult(result.properties, mergedItems.properties, seenRefs)\n }\n }\n // For non-array types without allOf, still set items if not already set\n else if (!('items' in result)) {\n // @ts-expect-error\n result.items = items\n }\n }\n }\n // Enum\n else if (key === 'enum') {\n if (Array.isArray(value) && value.length > 0) {\n result.enum = [...new Set([...(result.enum || []), ...value])]\n }\n }\n // OneOf/AnyOf\n else if (key === 'oneOf' || key === 'anyOf') {\n // Preserve the composition itself so its variants keep rendering as a\n // selector. Flattening the option properties into the parent would drop\n // the variant structure entirely and silently lose branches that have no\n // top-level `properties` (for example branches that are themselves an\n // `allOf`). The sibling `allOf` members stay on `result` as base\n // properties, which the Schema component renders above the selector.\n if (Array.isArray(value) && value.length > 0 && (override || result[key] === undefined)) {\n result[key] = value\n }\n }\n // Skip allOf as it's handled at a higher level\n else if (key === 'allOf') {\n continue\n }\n // For all other properties, preserve the first occurrence or override if specified.\n // Annotation keywords (see LAST_WINS_KEYS) always take the latest value so a later\n // allOf member can override an earlier one.\n else {\n if (override || LAST_WINS_KEYS.has(key as string) || result[key] === undefined) {\n result[key] = value\n }\n }\n }\n}\n\n/**\n * Efficiently merges properties into a result object without creating new objects.\n */\nconst mergePropertiesIntoResult = (\n result: Extract<SchemaObject, { type: 'object' }>['properties'],\n properties: Extract<SchemaObject, { type: 'object' }>['properties'],\n seenRefs: Set<string> = new Set(),\n): void => {\n const propertyKeys = Object.keys(properties ?? {})\n if (!properties || !result || propertyKeys.length === 0) {\n return\n }\n\n for (const key of propertyKeys) {\n const schema = resolve.schema(properties[key])\n if (!schema) {\n delete result[key]\n continue\n }\n\n if (typeof schema !== 'object') {\n result[key] = schema\n continue\n }\n\n if (!result[key]) {\n // Break self-referential cycles reached through `allOf`. When a brand-new\n // property's `$ref` is already being merged higher in the call stack,\n // keep the raw reference instead of recursing into its `allOf` forever.\n // This mirrors the guard in the \"merge existing property\" branch below and\n // covers schemas that point back at themselves through an `allOf` member\n // (e.g. a node whose `self` property $refs the node, which is an allOf).\n const rawProperty = properties[key]\n const newSchemaRef = (rawProperty as { $ref?: string })?.$ref\n if (rawProperty && typeof newSchemaRef === 'string' && seenRefs.has(newSchemaRef)) {\n result[key] = rawProperty\n continue\n }\n const nextNewSeenRefs = typeof newSchemaRef === 'string' ? new Set(seenRefs).add(newSchemaRef) : seenRefs\n\n // Handle new property with allOf\n if (schema.allOf) {\n result[key] = mergeAllOfSchemas(schema, undefined, nextNewSeenRefs)\n } else if (isArraySchema(schema) && resolve.schema(schema.items)?.allOf) {\n result[key] = {\n ...schema,\n items: mergeAllOfSchemas(resolve.schema(schema.items), undefined, seenRefs),\n }\n } else if (properties[key]) {\n result[key] = properties[key]\n }\n continue\n }\n\n // Merge existing property\n const existing = resolve.schema(result[key])\n\n // Break self-referential cycles: when this property's `$ref` is already\n // being merged higher in the call stack, keep the partially merged existing\n // schema instead of recursing into it again. This mirrors the guard in\n // `mergeItems` and covers schemas that point back at themselves through a\n // plain object property (e.g. a tree node whose `parent` $refs the node).\n const schemaRef = (schema as { $ref?: string }).$ref\n if (typeof schemaRef === 'string' && seenRefs.has(schemaRef)) {\n result[key] = existing\n continue\n }\n const nextSeenRefs = typeof schemaRef === 'string' ? new Set(seenRefs).add(schemaRef) : seenRefs\n\n if (schema.allOf) {\n result[key] = mergeAllOfSchemas({ allOf: [existing, ...schema.allOf] } as SchemaObject, undefined, nextSeenRefs)\n } else if (isArraySchema(schema) && isArraySchema(existing) && schema.items) {\n const existingItems = resolve.schema(existing.items)\n result[key] = {\n ...existing,\n type: 'array',\n items: existingItems\n ? mergeItems(existingItems, resolve.schema(schema.items), nextSeenRefs)\n : resolve.schema(schema.items),\n }\n } else {\n // Create merged object with properties handled separately\n if ('properties' in existing && 'properties' in schema) {\n const merged = { ...existing, ...schema }\n merged.properties = { ...existing.properties }\n mergePropertiesIntoResult(merged.properties, schema.properties, nextSeenRefs)\n result[key] = merged\n }\n // Simple merge without property recursion\n else {\n result[key] = { ...schema, ...existing }\n }\n }\n }\n}\n\n/**\n * Efficiently merges array items into a result object.\n */\nconst mergeItemsIntoResult = (result: SchemaObject, items: SchemaObject, seenRefs: Set<string> = new Set()): void => {\n // Handle allOf in items\n if (items.allOf || result.allOf) {\n // Build array without spreads for better performance\n const allOfSchemas: SchemaObject[] = []\n\n if (result.allOf) {\n for (const schema of result.allOf) {\n allOfSchemas.push(resolve.schema(schema))\n }\n } else {\n allOfSchemas.push(result)\n }\n\n if (items.allOf) {\n for (const schema of items.allOf) {\n allOfSchemas.push(resolve.schema(schema))\n }\n } else {\n allOfSchemas.push(items)\n }\n\n const merged = mergeAllOfSchemas({ allOf: allOfSchemas } as SchemaObject, undefined, seenRefs)\n Object.assign(result, merged)\n return\n }\n\n // Regular merge\n Object.assign(result, items)\n\n // Merge properties if both have them\n if ('properties' in result && 'properties' in items) {\n mergePropertiesIntoResult(result.properties, items.properties, seenRefs)\n }\n}\n\n/**\n * Helper function for merging items that returns a new object.\n */\nconst mergeItems = (\n existing: SchemaObject,\n incoming: SchemaObject,\n seenRefs: Set<string> = new Set(),\n): SchemaObject => {\n const incomingRef = (incoming as { $ref?: string }).$ref\n\n if (typeof incomingRef === 'string') {\n if (seenRefs.has(incomingRef)) {\n return existing\n }\n return mergeItemsInner(existing, incoming, new Set(seenRefs).add(incomingRef))\n }\n\n return mergeItemsInner(existing, incoming, seenRefs)\n}\n\nconst mergeItemsInner = (\n existing: SchemaObject,\n incoming: SchemaObject,\n seenRefs: Set<string> = new Set(),\n): SchemaObject => {\n // Handle allOf in either schema\n if (existing.allOf || incoming.allOf) {\n // Build array without spreads for better performance\n const allOfSchemas: SchemaObject[] = []\n\n if (existing.allOf) {\n for (const schema of existing.allOf) {\n allOfSchemas.push(resolve.schema(schema))\n }\n } else {\n allOfSchemas.push(existing)\n }\n\n if (incoming.allOf) {\n for (const schema of incoming.allOf) {\n allOfSchemas.push(resolve.schema(schema))\n }\n } else {\n allOfSchemas.push(incoming)\n }\n\n return mergeAllOfSchemas({ allOf: allOfSchemas } as SchemaObject, undefined, seenRefs)\n }\n\n const merged = { ...existing, ...incoming }\n\n // Recursively merge properties if both have properties\n if ('properties' in existing && 'properties' in incoming) {\n // @ts-expect-error\n merged.properties = { ...existing.properties }\n // @ts-expect-error\n mergePropertiesIntoResult(merged.properties, incoming.properties, seenRefs)\n }\n\n return merged as SchemaObject\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAM,iBAAiB,IAAI,IAAY,CAAC,eAAe,QAAQ,CAAC;;;;;;;;;;AAWhE,IAAa,qBACX,SACA,YACA,2BAAwB,IAAI,KAAK,KAChB;AAEjB,KAAI,CAAC,SAAS,OAAO,UAAU,CAAC,MAAM,QAAQ,QAAQ,MAAM,CAC1D,QAAO,cAAe,EAAE;CAI1B,MAAM,SAAS,EAAE;CAGjB,MAAM,EAAE,OAAO,GAAG,GAAG,eAAe;AAGpC,MAAK,MAAM,WAAW,QAAQ,OAAO;AACnC,MAAI,CAAC,WAAW,OAAO,YAAY,SACjC;EAIF,MAAM,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GAAW,SAAS;;CAGxF,MAAM,SAAS;EAAE,GAAG;EAAU,GAAG;EAAU;AAG3C,KAAI,gBAAgB,YAAY,gBAAgB,UAAU;AAExD,SAAO,aAAa,EAAE,GAAG,SAAS,YAAY;AAE9C,4BAA0B,OAAO,YAAY,SAAS,YAAY,SAAS;;AAG7E,QAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModernLayout.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Tags/components/ModernLayout.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ModernLayout.vue.d.ts","sourceRoot":"","sources":["../../../../../src/components/Content/Tags/components/ModernLayout.vue"],"names":[],"mappings":"AAqEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AAS9E,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,YAAY,CAAA;IACjB,cAAc,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,OAAO,CAAA;IACpB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;CACnC,CAAC;AA8GF,QAAA,IAAI,QAAQ,IAAY,CAAE;AAC1B,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAKhD,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
|
|
|
2
2
|
import ModernLayout_vue_vue_type_script_setup_true_lang_default from "./ModernLayout.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/components/Content/Tags/components/ModernLayout.vue
|
|
5
|
-
var ModernLayout_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ModernLayout_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var ModernLayout_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ModernLayout_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-76bc20f3"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { ModernLayout_default as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ModernLayout.vue.js","names":[],"sources":["../../../../../src/components/Content/Tags/components/ModernLayout.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { TraversedTag } from '@scalar/workspace-store/schemas/navigation'\nimport { computed, useId } from 'vue'\n\nimport { SectionContainer } from '@/components/Section'\nimport ShowMoreButton from '@/components/ShowMoreButton.vue'\n\nimport TagSection from './TagSection.vue'\n\nconst { tag, moreThanOneTag } = defineProps<{\n tag: TraversedTag\n moreThanOneTag: boolean\n isCollapsed: boolean\n eventBus: WorkspaceEventBus | null\n}>()\n\nconst headerId = useId()\n\nconst moreThanOneDefaultTag = computed(\n () => moreThanOneTag || tag?.title !== 'default' || tag?.description !== '',\n)\n\nconst hasChildren = computed(() => (tag?.children?.length ?? 0) > 0)\n</script>\n\n<template>\n <SectionContainer\n :aria-labelledby=\"headerId\"\n class=\"tag-section-container\"\n role=\"region\">\n <TagSection\n v-if=\"moreThanOneDefaultTag\"\n :eventBus=\"eventBus\"\n :headerId=\"headerId\"\n :isCollapsed=\"isCollapsed\"\n :tag=\"tag\" />\n <ShowMoreButton\n v-if=\"isCollapsed && moreThanOneTag && hasChildren\"\n :id=\"tag.id\"\n :aria-label=\"
|
|
1
|
+
{"version":3,"file":"ModernLayout.vue.js","names":[],"sources":["../../../../../src/components/Content/Tags/components/ModernLayout.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { TraversedTag } from '@scalar/workspace-store/schemas/navigation'\nimport { computed, useId } from 'vue'\n\nimport { SectionContainer } from '@/components/Section'\nimport ShowMoreButton from '@/components/ShowMoreButton.vue'\nimport { useLocalization } from '@/features/localization'\n\nimport TagSection from './TagSection.vue'\n\nconst { tag, moreThanOneTag } = defineProps<{\n tag: TraversedTag\n moreThanOneTag: boolean\n isCollapsed: boolean\n eventBus: WorkspaceEventBus | null\n}>()\nconst { translate } = useLocalization()\n\nconst headerId = useId()\n\nconst moreThanOneDefaultTag = computed(\n () => moreThanOneTag || tag?.title !== 'default' || tag?.description !== '',\n)\n\nconst hasChildren = computed(() => (tag?.children?.length ?? 0) > 0)\n</script>\n\n<template>\n <SectionContainer\n :aria-labelledby=\"headerId\"\n class=\"tag-section-container\"\n role=\"region\">\n <TagSection\n v-if=\"moreThanOneDefaultTag\"\n :eventBus=\"eventBus\"\n :headerId=\"headerId\"\n :isCollapsed=\"isCollapsed\"\n :tag=\"tag\" />\n <ShowMoreButton\n v-if=\"isCollapsed && moreThanOneTag && hasChildren\"\n :id=\"tag.id\"\n :aria-label=\"\n translate('navigation.showAllEndpoints', { name: tag.title })\n \"\n @click=\"\n () => eventBus?.emit('toggle:nav-item', { id: tag.id, open: true })\n \" />\n\n <!-- Show slot when section is expanded or single-tag (inverse of ShowMoreButton visibility). -->\n <div\n v-if=\"!(isCollapsed && moreThanOneTag)\"\n class=\"contents divide-y\">\n <slot />\n </div>\n </SectionContainer>\n</template>\n\n<style scoped>\n.section-container {\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.section-container:has(.show-more) {\n background-color: color-mix(in srgb, var(--scalar-background-2), transparent);\n}\n</style>\n"],"mappings":""}
|