@scalar/api-reference 1.58.0 → 1.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (332) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/dist/blocks/index.d.ts +1 -0
  3. package/dist/blocks/index.d.ts.map +1 -1
  4. package/dist/blocks/index.js +2 -1
  5. package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.d.ts +24 -0
  6. package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.d.ts.map +1 -0
  7. package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.js +7 -0
  8. package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.js.map +1 -0
  9. package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.script.js +80 -0
  10. package/dist/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.script.js.map +1 -0
  11. package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.d.ts +25 -0
  12. package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.d.ts.map +1 -0
  13. package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.js +7 -0
  14. package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.js.map +1 -0
  15. package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.script.js +76 -0
  16. package/dist/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue.script.js.map +1 -0
  17. package/dist/blocks/scalar-asyncapi-server-selector-block/index.d.ts +2 -0
  18. package/dist/blocks/scalar-asyncapi-server-selector-block/index.d.ts.map +1 -0
  19. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts +2 -3
  20. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.d.ts.map +1 -1
  21. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.js +1 -1
  22. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.js.map +1 -1
  23. package/dist/blocks/scalar-client-selector-block/components/ClientDropdown.vue.script.js.map +1 -1
  24. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts +2 -6
  25. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.d.ts.map +1 -1
  26. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.js +1 -1
  27. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.js.map +1 -1
  28. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.script.js +26 -36
  29. package/dist/blocks/scalar-client-selector-block/components/ClientSelector.vue.script.js.map +1 -1
  30. package/dist/blocks/scalar-client-selector-block/helpers/featured-clients.d.ts +1 -1
  31. package/dist/blocks/scalar-client-selector-block/helpers/featured-clients.d.ts.map +1 -1
  32. package/dist/blocks/scalar-client-selector-block/helpers/featured-clients.js.map +1 -1
  33. package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.d.ts +9 -0
  34. package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.d.ts.map +1 -0
  35. package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.js +9 -0
  36. package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.js.map +1 -0
  37. package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.script.js +225 -0
  38. package/dist/blocks/scalar-sdk-installation-instructions/components/SdkInstallationInstructions.vue.script.js.map +1 -0
  39. package/dist/blocks/scalar-sdk-installation-instructions/helpers/language-icon.d.ts +4 -0
  40. package/dist/blocks/scalar-sdk-installation-instructions/helpers/language-icon.d.ts.map +1 -0
  41. package/dist/blocks/scalar-sdk-installation-instructions/helpers/language-icon.js +59 -0
  42. package/dist/blocks/scalar-sdk-installation-instructions/helpers/language-icon.js.map +1 -0
  43. package/dist/blocks/scalar-sdk-installation-instructions/helpers/renderable-sdks.d.ts +19 -0
  44. package/dist/blocks/scalar-sdk-installation-instructions/helpers/renderable-sdks.d.ts.map +1 -0
  45. package/dist/blocks/scalar-sdk-installation-instructions/helpers/renderable-sdks.js +19 -0
  46. package/dist/blocks/scalar-sdk-installation-instructions/helpers/renderable-sdks.js.map +1 -0
  47. package/dist/blocks/scalar-sdk-installation-instructions/helpers/visible-tab-count.d.ts +16 -0
  48. package/dist/blocks/scalar-sdk-installation-instructions/helpers/visible-tab-count.d.ts.map +1 -0
  49. package/dist/blocks/scalar-sdk-installation-instructions/helpers/visible-tab-count.js +29 -0
  50. package/dist/blocks/scalar-sdk-installation-instructions/helpers/visible-tab-count.js.map +1 -0
  51. package/dist/blocks/scalar-sdk-installation-instructions/index.d.ts +3 -0
  52. package/dist/blocks/scalar-sdk-installation-instructions/index.d.ts.map +1 -0
  53. package/dist/blocks/scalar-server-selector-block/components/ServerSelector.vue.script.js +1 -1
  54. package/dist/browser/chunks/{AgentScalarChatInterface-DIIVMX31.js → AgentScalarChatInterface-BXB1nZKJ.js} +4 -4
  55. package/dist/browser/chunks/ScalarTextInput.vue-XkIzhvc0.js +27 -0
  56. package/dist/browser/chunks/basic-shape-diamond.svg-BTEOT1FL.js +1 -1
  57. package/dist/browser/chunks/basic-shape-hexagon.svg-BSPzaCgF.js +1 -1
  58. package/dist/browser/chunks/basic-shape-primary-circle-ellipse-round.svg-DKmZ8UUU.js +1 -1
  59. package/dist/browser/chunks/basic-shape-primary-square-rectangle.svg-n2YRykHD.js +1 -1
  60. package/dist/browser/chunks/basic-shape-shield.svg-Bec9cJDA.js +1 -1
  61. package/dist/browser/chunks/browser-67K6wmG9.js +1 -1
  62. package/dist/browser/chunks/computer-device-desktop-monitor.svg-m6j893Hb.js +1 -1
  63. package/dist/browser/chunks/computer-device-desktop.svg-Dk1VVO7k.js +1 -1
  64. package/dist/browser/chunks/computer-device-laptop.svg-BNGVUCYS.js +1 -1
  65. package/dist/browser/chunks/computer-device-mobile-phone-android-samsung-back.svg-CC4UUTFw.js +1 -1
  66. package/dist/browser/chunks/computer-device-mobile-phone-android-samsung.svg-D8ExpMpL.js +1 -1
  67. package/dist/browser/chunks/computer-device-mobile-phone-iphone-x-back.svg-CLm7sgMM.js +1 -1
  68. package/dist/browser/chunks/computer-device-mobile-phone-iphone-x.svg-Xrttg6_7.js +1 -1
  69. package/dist/browser/chunks/computer-device-mobile-tablet-touch.svg-DQ2oTvOG.js +1 -1
  70. package/dist/browser/chunks/computer-device-mobile-tablet.svg-DCr0XlRc.js +1 -1
  71. package/dist/browser/chunks/computer-device-network-ethernet-cat6.svg-AK9l0iOl.js +1 -1
  72. package/dist/browser/chunks/computer-device-network-lan-www.svg-gUIdFBlE.js +1 -1
  73. package/dist/browser/chunks/computer-device-network-wifi-connection.svg-Be-EMm4e.js +1 -1
  74. package/dist/browser/chunks/computer-device-network-wifi-router.svg-Dc2VzyqK.js +1 -1
  75. package/dist/browser/chunks/ecology-science-erlenmeyer-flask.svg-DHgy7Jfd.js +1 -1
  76. package/dist/browser/chunks/image-flash-lightning.svg-EETR_y1q.js +1 -1
  77. package/dist/browser/chunks/image-picture-flower.svg-DN1AYzJU.js +1 -1
  78. package/dist/browser/chunks/interface-alert-exclamation-diamond.svg-C5NozMV_.js +1 -1
  79. package/dist/browser/chunks/interface-alert-exclamation-triangle-warning.svg-DaAg2fF5.js +1 -1
  80. package/dist/browser/chunks/interface-alert-information-circle.svg-ckkkt9Mv.js +1 -1
  81. package/dist/browser/chunks/interface-award-crown.svg-pjvn9hY-.js +1 -1
  82. package/dist/browser/chunks/interface-bookmark-tag.svg-r2r-lQq4.js +1 -1
  83. package/dist/browser/chunks/interface-bookmark.svg-BK9HKQBT.js +1 -1
  84. package/dist/browser/chunks/interface-calendar-date-one.svg-DNnF0M1I.js +1 -1
  85. package/dist/browser/chunks/interface-content-book-open-pages.svg-CQj_w9Vp.js +1 -1
  86. package/dist/browser/chunks/interface-content-book-page.svg-DppoeJRe.js +1 -1
  87. package/dist/browser/chunks/interface-content-file.svg-CvcD7OiY.js +1 -1
  88. package/dist/browser/chunks/interface-content-folder.svg-BmtS5I9A.js +1 -1
  89. package/dist/browser/chunks/interface-copy-clipboard.svg-Be6EI50X.js +1 -1
  90. package/dist/browser/chunks/interface-edit-attachment.svg-G5TKzpWX.js +1 -1
  91. package/dist/browser/chunks/interface-edit-binocular.svg-jzL-DvGB.js +1 -1
  92. package/dist/browser/chunks/interface-edit-magic-wand.svg-BOTlymvp.js +1 -1
  93. package/dist/browser/chunks/interface-edit-tool-paint-roller.svg-s9dwryx7.js +1 -1
  94. package/dist/browser/chunks/interface-edit-tool-pencil.svg-C7v0dbB3.js +1 -1
  95. package/dist/browser/chunks/interface-favorite-award.svg-CYHUgUG0.js +1 -1
  96. package/dist/browser/chunks/interface-favorite-flag.svg-C10zlKOb.js +1 -1
  97. package/dist/browser/chunks/interface-favorite-heart.svg-eoduXxlz.js +1 -1
  98. package/dist/browser/chunks/interface-favorite-star.svg-BSmxJetr.js +1 -1
  99. package/dist/browser/chunks/interface-favorite-stars-sparkles.svg-JTFLj3Ls.js +1 -1
  100. package/dist/browser/chunks/interface-hierarchy-flowchart.svg-Cg_Wy0kN.js +1 -1
  101. package/dist/browser/chunks/interface-home-house.svg-DytoGRnv.js +1 -1
  102. package/dist/browser/chunks/interface-hyperlink.svg-CuEfmmQI.js +1 -1
  103. package/dist/browser/chunks/interface-lighting-brightness.svg-DSK0h_Pa.js +1 -1
  104. package/dist/browser/chunks/interface-lock-closed.svg-Cn6TaLYv.js +1 -1
  105. package/dist/browser/chunks/interface-lock-open-unlock.svg-CVkG5-9W.js +1 -1
  106. package/dist/browser/chunks/interface-login-key.svg-y-cwwXjN.js +1 -1
  107. package/dist/browser/chunks/interface-search.svg-S-puVFJB.js +1 -1
  108. package/dist/browser/chunks/interface-setting-cog.svg-CTH4_lLg.js +1 -1
  109. package/dist/browser/chunks/interface-share-megaphone-bullhorn.svg-Pbp39MyC.js +1 -1
  110. package/dist/browser/chunks/interface-share-rocket.svg-BgCsIRZO.js +1 -1
  111. package/dist/browser/chunks/interface-share-satellite.svg-DAMN9d5G.js +1 -1
  112. package/dist/browser/chunks/interface-share-space-ship.svg-Dt-Mejxk.js +1 -1
  113. package/dist/browser/chunks/interface-share.svg-vFYTXSti.js +1 -1
  114. package/dist/browser/chunks/interface-signal-square.svg-DNG4LpAe.js +1 -1
  115. package/dist/browser/chunks/interface-time-clock-circle.svg-Bpz-nLxo.js +1 -1
  116. package/dist/browser/chunks/interface-time-hour-glass.svg-D7agfKsH.js +1 -1
  117. package/dist/browser/chunks/interface-users-multiple.svg-CkPJBBnG.js +1 -1
  118. package/dist/browser/chunks/interface-weather-moon.svg-CaTZFMPO.js +1 -1
  119. package/dist/browser/chunks/mail-chat-bubble-square.svg-DC8RIihp.js +1 -1
  120. package/dist/browser/chunks/mail-send-email-paper-airplane.svg-D8OLs9jz.js +1 -1
  121. package/dist/browser/chunks/mail-send-envelope.svg-CV33h5Sx.js +1 -1
  122. package/dist/browser/chunks/modal-Bp9V4D2s.js +66 -0
  123. package/dist/browser/chunks/{modal-BA6EnLMO.js → modal-CtAiwzwH.js} +2 -2
  124. package/dist/browser/chunks/money-cashier-receipt.svg-CJL8C2gs.js +1 -1
  125. package/dist/browser/chunks/money-currency-dollar-pay.svg-VdBplCTx.js +1 -1
  126. package/dist/browser/chunks/money-graph-arrow-increase.svg-DcRov3zk.js +1 -1
  127. package/dist/browser/chunks/money-graph-bar-chart-increase.svg-Cc7KxjX-.js +1 -1
  128. package/dist/browser/chunks/nature-ecology-leaf.svg-DR3cTZxt.js +1 -1
  129. package/dist/browser/chunks/phone-telephone.svg-DyY0gUlk.js +1 -1
  130. package/dist/browser/chunks/programming-bug.svg-BHLT-Qhp.js +1 -1
  131. package/dist/browser/chunks/programming-cloud.svg-B6YW33ba.js +1 -1
  132. package/dist/browser/chunks/programming-computer-database-server.svg-B6o5Sdn-.js +1 -1
  133. package/dist/browser/chunks/programming-computer-database.svg-Cl7OVtpJ.js +1 -1
  134. package/dist/browser/chunks/programming-module-four-layout.svg-BQrerL1x.js +1 -1
  135. package/dist/browser/chunks/programming-module-three.svg-B2KTQzBM.js +1 -1
  136. package/dist/browser/chunks/programming-module.svg-CiID7kPm.js +1 -1
  137. package/dist/browser/chunks/programming-script-code.svg-D1M5rtkN.js +1 -1
  138. package/dist/browser/chunks/runtime-core.esm-bundler-Byrbbu5Q.js +1 -1
  139. package/dist/browser/chunks/shopping-cart.svg-BEegiIR9.js +1 -1
  140. package/dist/browser/chunks/shopping-gift-present.svg-BUHwuLix.js +1 -1
  141. package/dist/browser/chunks/shopping-shipping-box-parcel-package.svg-D6fxWdYx.js +1 -1
  142. package/dist/browser/chunks/tag-new-circle.svg-jsg1bGs0.js +1 -1
  143. package/dist/browser/chunks/travel-map-earth-globe.svg-ClbMiU-f.js +1 -1
  144. package/dist/browser/chunks/vendor-nugWm4eq.js +337 -0
  145. package/dist/browser/standalone.esm.js +19 -18
  146. package/dist/browser/standalone.js +245 -240
  147. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  148. package/dist/components/ApiReference.vue.js +1 -1
  149. package/dist/components/ApiReference.vue.js.map +1 -1
  150. package/dist/components/ApiReference.vue.script.js +19 -3
  151. package/dist/components/ApiReference.vue.script.js.map +1 -1
  152. package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.d.ts +1 -1
  153. package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.d.ts.map +1 -1
  154. package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.js.map +1 -1
  155. package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js +4 -2
  156. package/dist/components/Content/AsyncApi/AsyncApiTraversedEntry.vue.script.js.map +1 -1
  157. package/dist/components/Content/AsyncApi/Channel.vue.d.ts +4 -0
  158. package/dist/components/Content/AsyncApi/Channel.vue.d.ts.map +1 -1
  159. package/dist/components/Content/AsyncApi/Channel.vue.js +1 -1
  160. package/dist/components/Content/AsyncApi/Channel.vue.js.map +1 -1
  161. package/dist/components/Content/AsyncApi/Channel.vue.script.js +43 -3
  162. package/dist/components/Content/AsyncApi/Channel.vue.script.js.map +1 -1
  163. package/dist/components/Content/AsyncApi/helpers/adapt-async-api-parameters.d.ts +14 -0
  164. package/dist/components/Content/AsyncApi/helpers/adapt-async-api-parameters.d.ts.map +1 -0
  165. package/dist/components/Content/AsyncApi/helpers/adapt-async-api-parameters.js +34 -0
  166. package/dist/components/Content/AsyncApi/helpers/adapt-async-api-parameters.js.map +1 -0
  167. package/dist/components/Content/Auth/Auth.vue.d.ts +1 -1
  168. package/dist/components/Content/Auth/Auth.vue.d.ts.map +1 -1
  169. package/dist/components/Content/Auth/Auth.vue.js.map +1 -1
  170. package/dist/components/Content/Auth/Auth.vue.script.js +2 -0
  171. package/dist/components/Content/Auth/Auth.vue.script.js.map +1 -1
  172. package/dist/components/Content/Content.vue.d.ts +3 -3
  173. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  174. package/dist/components/Content/Content.vue.js.map +1 -1
  175. package/dist/components/Content/Content.vue.script.js +50 -6
  176. package/dist/components/Content/Content.vue.script.js.map +1 -1
  177. package/dist/components/Content/Models/Model.vue.d.ts +4 -2
  178. package/dist/components/Content/Models/Model.vue.d.ts.map +1 -1
  179. package/dist/components/Content/Models/Model.vue.js.map +1 -1
  180. package/dist/components/Content/Models/Model.vue.script.js +6 -1
  181. package/dist/components/Content/Models/Model.vue.script.js.map +1 -1
  182. package/dist/components/Content/Models/components/ClassicLayout.vue.d.ts +4 -2
  183. package/dist/components/Content/Models/components/ClassicLayout.vue.d.ts.map +1 -1
  184. package/dist/components/Content/Models/components/ClassicLayout.vue.js +1 -1
  185. package/dist/components/Content/Models/components/ClassicLayout.vue.js.map +1 -1
  186. package/dist/components/Content/Models/components/ClassicLayout.vue.script.js +9 -2
  187. package/dist/components/Content/Models/components/ClassicLayout.vue.script.js.map +1 -1
  188. package/dist/components/Content/Models/components/ModernLayout.vue.d.ts +4 -1
  189. package/dist/components/Content/Models/components/ModernLayout.vue.d.ts.map +1 -1
  190. package/dist/components/Content/Models/components/ModernLayout.vue.js.map +1 -1
  191. package/dist/components/Content/Models/components/ModernLayout.vue.script.js +5 -1
  192. package/dist/components/Content/Models/components/ModernLayout.vue.script.js.map +1 -1
  193. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +1 -1
  194. package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
  195. package/dist/components/Content/Operations/TraversedEntry.vue.js.map +1 -1
  196. package/dist/components/Content/Operations/TraversedEntry.vue.script.js +7 -2
  197. package/dist/components/Content/Operations/TraversedEntry.vue.script.js.map +1 -1
  198. package/dist/components/Content/Schema/Schema.vue.d.ts +6 -0
  199. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  200. package/dist/components/Content/Schema/Schema.vue.js +1 -1
  201. package/dist/components/Content/Schema/Schema.vue.js.map +1 -1
  202. package/dist/components/Content/Schema/Schema.vue.script.js +32 -7
  203. package/dist/components/Content/Schema/Schema.vue.script.js.map +1 -1
  204. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
  205. package/dist/components/Content/Schema/SchemaComposition.vue.js.map +1 -1
  206. package/dist/components/Content/Schema/SchemaComposition.vue.script.js +16 -3
  207. package/dist/components/Content/Schema/SchemaComposition.vue.script.js.map +1 -1
  208. package/dist/components/Content/Schema/SchemaObjectExampleCodeBlock.vue.script.js +1 -1
  209. package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts.map +1 -1
  210. package/dist/components/Content/Schema/SchemaObjectProperties.vue.js.map +1 -1
  211. package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js +7 -0
  212. package/dist/components/Content/Schema/SchemaObjectProperties.vue.script.js.map +1 -1
  213. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +2 -0
  214. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  215. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  216. package/dist/components/Content/Schema/SchemaProperty.vue.js.map +1 -1
  217. package/dist/components/Content/Schema/SchemaProperty.vue.script.js +17 -2
  218. package/dist/components/Content/Schema/SchemaProperty.vue.script.js.map +1 -1
  219. package/dist/components/Content/Schema/helpers/get-compositions-to-render.d.ts +3 -2
  220. package/dist/components/Content/Schema/helpers/get-compositions-to-render.d.ts.map +1 -1
  221. package/dist/components/Content/Schema/helpers/get-compositions-to-render.js +26 -1
  222. package/dist/components/Content/Schema/helpers/get-compositions-to-render.js.map +1 -1
  223. package/dist/components/Content/Schema/helpers/schema-cycle.d.ts +31 -0
  224. package/dist/components/Content/Schema/helpers/schema-cycle.d.ts.map +1 -0
  225. package/dist/components/Content/Schema/helpers/schema-cycle.js +39 -0
  226. package/dist/components/Content/Schema/helpers/schema-cycle.js.map +1 -0
  227. package/dist/components/Content/Schema/types.d.ts +10 -0
  228. package/dist/components/Content/Schema/types.d.ts.map +1 -1
  229. package/dist/features/Operation/Operation.vue.d.ts +1 -1
  230. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  231. package/dist/features/Operation/Operation.vue.js.map +1 -1
  232. package/dist/features/Operation/Operation.vue.script.js +4 -0
  233. package/dist/features/Operation/Operation.vue.script.js.map +1 -1
  234. package/dist/features/Operation/components/ContentTypeSelect.vue.script.js +1 -1
  235. package/dist/features/Operation/components/Header.vue.d.ts +4 -1
  236. package/dist/features/Operation/components/Header.vue.d.ts.map +1 -1
  237. package/dist/features/Operation/components/Header.vue.js.map +1 -1
  238. package/dist/features/Operation/components/Header.vue.script.js +6 -2
  239. package/dist/features/Operation/components/Header.vue.script.js.map +1 -1
  240. package/dist/features/Operation/components/Headers.vue.d.ts +4 -1
  241. package/dist/features/Operation/components/Headers.vue.d.ts.map +1 -1
  242. package/dist/features/Operation/components/Headers.vue.js +1 -1
  243. package/dist/features/Operation/components/Headers.vue.js.map +1 -1
  244. package/dist/features/Operation/components/Headers.vue.script.js +10 -4
  245. package/dist/features/Operation/components/Headers.vue.script.js.map +1 -1
  246. package/dist/features/Operation/components/OperationParameters.vue.d.ts +4 -2
  247. package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
  248. package/dist/features/Operation/components/OperationParameters.vue.js.map +1 -1
  249. package/dist/features/Operation/components/OperationParameters.vue.script.js +12 -1
  250. package/dist/features/Operation/components/OperationParameters.vue.script.js.map +1 -1
  251. package/dist/features/Operation/components/OperationResponses.vue.d.ts +4 -2
  252. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  253. package/dist/features/Operation/components/OperationResponses.vue.js.map +1 -1
  254. package/dist/features/Operation/components/OperationResponses.vue.script.js +3 -0
  255. package/dist/features/Operation/components/OperationResponses.vue.script.js.map +1 -1
  256. package/dist/features/Operation/components/ParameterList.vue.d.ts +4 -2
  257. package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
  258. package/dist/features/Operation/components/ParameterList.vue.js.map +1 -1
  259. package/dist/features/Operation/components/ParameterList.vue.script.js +3 -0
  260. package/dist/features/Operation/components/ParameterList.vue.script.js.map +1 -1
  261. package/dist/features/Operation/components/ParameterListItem.vue.d.ts +4 -2
  262. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  263. package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
  264. package/dist/features/Operation/components/ParameterListItem.vue.js.map +1 -1
  265. package/dist/features/Operation/components/ParameterListItem.vue.script.js +8 -1
  266. package/dist/features/Operation/components/ParameterListItem.vue.script.js.map +1 -1
  267. package/dist/features/Operation/components/RequestBody.vue.d.ts +4 -1
  268. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  269. package/dist/features/Operation/components/RequestBody.vue.js +1 -1
  270. package/dist/features/Operation/components/RequestBody.vue.js.map +1 -1
  271. package/dist/features/Operation/components/RequestBody.vue.script.js +10 -3
  272. package/dist/features/Operation/components/RequestBody.vue.script.js.map +1 -1
  273. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +4 -2
  274. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  275. package/dist/features/Operation/components/callbacks/Callback.vue.js +1 -1
  276. package/dist/features/Operation/components/callbacks/Callback.vue.js.map +1 -1
  277. package/dist/features/Operation/components/callbacks/Callback.vue.script.js +5 -0
  278. package/dist/features/Operation/components/callbacks/Callback.vue.script.js.map +1 -1
  279. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +4 -2
  280. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
  281. package/dist/features/Operation/components/callbacks/Callbacks.vue.js.map +1 -1
  282. package/dist/features/Operation/components/callbacks/Callbacks.vue.script.js +3 -0
  283. package/dist/features/Operation/components/callbacks/Callbacks.vue.script.js.map +1 -1
  284. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +3 -1
  285. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  286. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  287. package/dist/features/Operation/layouts/ClassicLayout.vue.js.map +1 -1
  288. package/dist/features/Operation/layouts/ClassicLayout.vue.script.js +8 -1
  289. package/dist/features/Operation/layouts/ClassicLayout.vue.script.js.map +1 -1
  290. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +3 -1
  291. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  292. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  293. package/dist/features/Operation/layouts/ModernLayout.vue.js.map +1 -1
  294. package/dist/features/Operation/layouts/ModernLayout.vue.script.js +170 -176
  295. package/dist/features/Operation/layouts/ModernLayout.vue.script.js.map +1 -1
  296. package/dist/features/Search/components/SearchButton.vue.d.ts.map +1 -1
  297. package/dist/features/Search/components/SearchButton.vue.js.map +1 -1
  298. package/dist/features/Search/components/SearchButton.vue.script.js +13 -1
  299. package/dist/features/Search/components/SearchButton.vue.script.js.map +1 -1
  300. package/dist/features/Search/components/SearchModal.vue.d.ts.map +1 -1
  301. package/dist/features/Search/components/SearchModal.vue.js +1 -1
  302. package/dist/features/Search/components/SearchModal.vue.js.map +1 -1
  303. package/dist/features/Search/components/SearchModal.vue.script.js +2 -3
  304. package/dist/features/Search/components/SearchModal.vue.script.js.map +1 -1
  305. package/dist/features/developer-tools/components/ApiReferenceToolbarConfigTheme.vue.script.js +1 -1
  306. package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
  307. package/dist/features/example-responses/ExampleResponse.vue.js +1 -1
  308. package/dist/features/example-responses/ExampleResponse.vue.js.map +1 -1
  309. package/dist/features/example-responses/ExampleResponse.vue.script.js +6 -7
  310. package/dist/features/example-responses/ExampleResponse.vue.script.js.map +1 -1
  311. package/dist/features/example-responses/ExampleResponses.vue.script.js +1 -1
  312. package/dist/features/example-responses/ExampleSchema.vue.d.ts.map +1 -1
  313. package/dist/features/example-responses/ExampleSchema.vue.js.map +1 -1
  314. package/dist/features/example-responses/ExampleSchema.vue.script.js +6 -7
  315. package/dist/features/example-responses/ExampleSchema.vue.script.js.map +1 -1
  316. package/dist/features/info-object/Contact.vue.d.ts.map +1 -1
  317. package/dist/features/info-object/Contact.vue.js.map +1 -1
  318. package/dist/features/info-object/Contact.vue.script.js +15 -4
  319. package/dist/features/info-object/Contact.vue.script.js.map +1 -1
  320. package/dist/helpers/load-from-perssistance.d.ts +2 -1
  321. package/dist/helpers/load-from-perssistance.d.ts.map +1 -1
  322. package/dist/helpers/load-from-perssistance.js +4 -3
  323. package/dist/helpers/load-from-perssistance.js.map +1 -1
  324. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  325. package/dist/standalone/lib/html-api.js +60 -2
  326. package/dist/standalone/lib/html-api.js.map +1 -1
  327. package/dist/style.css +557 -374
  328. package/dist/vue-styles.css +547 -357
  329. package/package.json +16 -16
  330. package/dist/browser/chunks/ScalarTextInput.vue-DDsQgpOo.js +0 -27
  331. package/dist/browser/chunks/modal-DW-P3H1k.js +0 -66
  332. package/dist/browser/chunks/vendor-Ad2vN5Ro.js +0 -333
package/CHANGELOG.md CHANGED
@@ -1,5 +1,80 @@
1
1
  # @scalar/api-reference
2
2
 
3
+ ## 1.59.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#9435](https://github.com/scalar/scalar/pull/9435): feat(api-reference): render AsyncAPI channel parameters
8
+
9
+ Channel address parameters (the `{param}` placeholders in a channel address) are now shown in the API reference, reusing the same parameter list component as OpenAPI operations. Their `enum`, `default`, and `examples` are displayed on a string schema.
10
+
11
+ - [#9438](https://github.com/scalar/scalar/pull/9438): feat(api-reference): add an AsyncAPI server selector
12
+
13
+ Adds a server selector for AsyncAPI documents in the API reference introduction. It mirrors the OpenAPI server selector but works with the AsyncAPI server shape (a named map of `host`/`protocol`/`pathname`), labelling each server with its constructed connection URL.
14
+
15
+ Server selection and variable changes are now persisted to the workspace store via new `asyncapi-server:update:selected` and `asyncapi-server:update:variables` events and their mutators, mirroring the OpenAPI wiring.
16
+
17
+ - [#9422](https://github.com/scalar/scalar/pull/9422): Add a `nonce` option for Content Security Policy support.
18
+
19
+ When you pass a `nonce`, the rendered HTML stamps it onto the inline `<script>` and the CDN `<script>` tag (and Scalar's own `<style>` tags, plus a matching `<meta property="csp-nonce">`). This lets the API Reference run under a strict `script-src` with no `unsafe-inline` and no `unsafe-eval`.
20
+
21
+ ```ts
22
+ ApiReference({
23
+ url: '/openapi.json',
24
+ // Match this value in your `script-src` CSP directive.
25
+ nonce: 'r4nd0m',
26
+ })
27
+ ```
28
+
29
+ Note: `style-src` still needs `'unsafe-inline'`. The reference renders inline `style="…"` attributes, which a CSP nonce can never authorize (nonces only apply to `<script>`, `<style>` and `<link>` elements), so a nonce-only `style-src` is not possible. The win is a fully strict `script-src`.
30
+
31
+ - [#9400](https://github.com/scalar/scalar/pull/9400): feat(api-reference): add `expandAllSchemaProperties` config option.
32
+
33
+ When enabled, nested schema properties are expanded by default while keeping the
34
+ "Show/Hide Child Attributes" button available for manual collapsing. Expansion
35
+ is cycle-safe: every finite branch is expanded fully, and self-referential
36
+ ($ref or inline) schemas stop at the point they would otherwise recurse forever.
37
+
38
+ - [#9399](https://github.com/scalar/scalar/pull/9399): Show custom SDK installation instructions from `x-scalar-sdk-installation` in the introduction card, falling back to the client selector when there are none. Each entry takes a `lang` and a Markdown `description`, so a single tab can render rich instructions with syntax-highlighted code blocks (for example Maven and Gradle for Java)
39
+
40
+ ### Patch Changes
41
+
42
+ - [#9388](https://github.com/scalar/scalar/pull/9388): Add `ScalarVirtualCodeBlock` component with copy button support for virtualized code blocks
43
+ - [#9436](https://github.com/scalar/scalar/pull/9436): Hide the client selector for AsyncAPI documents
44
+ - [#9398](https://github.com/scalar/scalar/pull/9398): feat: read code samples from x-readme, x-stainless and x-scalar extensions
45
+
46
+ In addition to `x-codeSamples`, the code sample picker now reads custom samples from `x-scalar-examples`, `x-stainless-snippets`, `x-stainless-examples`, and `x-readme.code-samples`. When more than one is present on an operation, the highest-priority source is used (x-scalar-examples > x-stainless-snippets > x-stainless-examples > x-readme > x-codeSamples).
47
+
48
+ - [#9426](https://github.com/scalar/scalar/pull/9426): feat(api-reference): render the contact URL from `info.contact.url`
49
+ - [#8573](https://github.com/scalar/scalar/pull/8573): fix(api-reference): infer discriminator variants from mapping
50
+ - [#9131](https://github.com/scalar/scalar/pull/9131): fix(api-reference): preserve OAuth redirect URI when switching OpenAPI documents
51
+
52
+ When using multiple OpenAPI documents with OAuth configured via `oauth2RedirectUri`,
53
+ switching to another document no longer clears the Redirect URL in the Authentication
54
+ section.
55
+
56
+ The fix threads `oauth2RedirectUri` from the top-level configuration into the security
57
+ scheme merge chain so that each newly loaded document's OAuth flows are pre-populated
58
+ with the configured redirect URI, rather than relying solely on a component-level watcher
59
+ that would skip re-population when the same OAuth flow identity was detected across
60
+ documents.
61
+
62
+ - [#9391](https://github.com/scalar/scalar/pull/9391): fix: stabilize the tab title at the top of the document
63
+
64
+ The document-start sentinel and the Introduction section both fire an intersection event at scroll-top. They resolved to different entries, so the tab title raced between the section title and the document title. The sentinel now emits the Introduction entry, so both agree.
65
+
66
+ - [#9370](https://github.com/scalar/scalar/pull/9370): fix(api-reference): rework the modern operation layout with CSS grid so the request example sits directly under the description on narrow screens, and move the operation title and auth badge into the same grid
67
+ - [#9421](https://github.com/scalar/scalar/pull/9421): fix(api-reference): avoid SSR hydration mismatch from the search shortcut and teleport ids
68
+
69
+ The macOS search shortcut symbol was derived from `navigator` during render, so a Mac client hydrated `⌘` where the server sent `⌃`. The platform is now resolved after mount. Teleport target ids and the search modal ids also switched from `nanoid()` to Vue's SSR-stable `useId()`.
70
+
71
+ - [#9392](https://github.com/scalar/scalar/pull/9392): Clean up the standalone build's injected `<head>` styles on `destroy()` so they no longer linger after SPA-style navigation (Turbo Drive, htmx). The styles are re-attached when a new instance mounts.
72
+ - [#9420](https://github.com/scalar/scalar/pull/9420): fix(api-reference): make x-tagGroups titles navigable from search
73
+
74
+ Tag group titles appeared as search results but clicking them did nothing,
75
+ because the flattened modern layout rendered no element carrying the tag
76
+ group id to scroll to. The group now exposes its id as a scroll anchor.
77
+
3
78
  ## 1.58.0
4
79
 
5
80
  ### Minor Changes
@@ -1,3 +1,4 @@
1
+ export { AsyncApiServerSelector } from './scalar-asyncapi-server-selector-block';
1
2
  export { ClientSelector } from './scalar-client-selector-block';
2
3
  export { InfoBlock, IntroductionCardItem } from './scalar-info-block';
3
4
  export { ServerSelector } from './scalar-server-selector-block';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAC/D,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA"}
@@ -1,5 +1,6 @@
1
+ import AsyncApiServerSelector_default from "./scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue.js";
1
2
  import ClientSelector_default from "./scalar-client-selector-block/components/ClientSelector.vue.js";
2
3
  import InfoBlock_default from "./scalar-info-block/components/InfoBlock.vue.js";
3
4
  import IntroductionCardItem_default from "./scalar-info-block/components/IntroductionCardItem.vue.js";
4
5
  import ServerSelector_default from "./scalar-server-selector-block/components/ServerSelector.vue.js";
5
- export { ClientSelector_default as ClientSelector, InfoBlock_default as InfoBlock, IntroductionCardItem_default as IntroductionCardItem, ServerSelector_default as ServerSelector };
6
+ export { AsyncApiServerSelector_default as AsyncApiServerSelector, ClientSelector_default as ClientSelector, InfoBlock_default as InfoBlock, IntroductionCardItem_default as IntroductionCardItem, ServerSelector_default as ServerSelector };
@@ -0,0 +1,24 @@
1
+ import type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example';
2
+ import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
3
+ type SelectorProps = {
4
+ /** The event bus to use for emitting events */
5
+ eventBus: WorkspaceEventBus;
6
+ /** The currently selected server */
7
+ selectedServer: AsyncApiServerEntry | null;
8
+ /** Available servers */
9
+ servers: AsyncApiServerEntry[];
10
+ };
11
+ /**
12
+ * AsyncApiServerSelector
13
+ *
14
+ * Core component for rendering an AsyncAPI server selector block. It mirrors the
15
+ * OpenAPI ServerSelector, but works with the AsyncAPI server shape (a named map
16
+ * of `host`/`protocol`/`pathname` rather than an array of `url`).
17
+ *
18
+ * @event asyncapi-server:update:selected - Emitted when the selected server changes
19
+ * @event asyncapi-server:update:variables - Emitted when a server variable changes
20
+ */
21
+ declare const _default: typeof __VLS_export;
22
+ export default _default;
23
+ declare const __VLS_export: import("vue").DefineComponent<SelectorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<SelectorProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
24
+ //# sourceMappingURL=AsyncApiServerSelector.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncApiServerSelector.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue"],"names":[],"mappings":"AAmHA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAClF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAOvE,KAAK,aAAa,GAAG;IACnB,+CAA+C;IAC/C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,oCAAoC;IACpC,cAAc,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAC1C,wBAAwB;IACxB,OAAO,EAAE,mBAAmB,EAAE,CAAA;CAC/B,CAAA;AAED;;;;;;;;;GASG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY,sSAiKd,CAAC"}
@@ -0,0 +1,7 @@
1
+ import AsyncApiServerSelector_vue_vue_type_script_setup_true_lang_default from "./AsyncApiServerSelector.vue.script.js";
2
+ //#region src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue
3
+ var AsyncApiServerSelector_default = AsyncApiServerSelector_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { AsyncApiServerSelector_default as default };
6
+
7
+ //# sourceMappingURL=AsyncApiServerSelector.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncApiServerSelector.vue.js","names":[],"sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue"],"sourcesContent":["<script lang=\"ts\">\ntype SelectorProps = {\n /** The event bus to use for emitting events */\n eventBus: WorkspaceEventBus\n /** The currently selected server */\n selectedServer: AsyncApiServerEntry | null\n /** Available servers */\n servers: AsyncApiServerEntry[]\n}\n\n/**\n * AsyncApiServerSelector\n *\n * Core component for rendering an AsyncAPI server selector block. It mirrors the\n * OpenAPI ServerSelector, but works with the AsyncAPI server shape (a named map\n * of `host`/`protocol`/`pathname` rather than an array of `url`).\n *\n * @event asyncapi-server:update:selected - Emitted when the selected server changes\n * @event asyncapi-server:update:variables - Emitted when a server variable changes\n */\nexport default {}\n</script>\n\n<script lang=\"ts\" setup>\nimport { ServerVariablesForm } from '@scalar/api-client/components/Server'\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, useId } from 'vue'\n\nimport Selector from './Selector.vue'\n\nconst { eventBus, servers, selectedServer } = defineProps<SelectorProps>()\n\nconst id = useId()\n\n/**\n * Normalize AsyncAPI server variables into the shape the shared\n * ServerVariablesForm expects (resolving references and defaulting `default`).\n */\nconst serverVariables = computed(() => {\n const variables = selectedServer?.server.variables\n if (!variables) {\n return undefined\n }\n\n return Object.fromEntries(\n Object.entries(variables).map(([name, variable]) => {\n const resolved = getResolvedRef(variable)\n return [\n name,\n {\n default: resolved.default ?? '',\n enum: resolved.enum,\n description: resolved.description,\n },\n ]\n }),\n )\n})\n\n/** Update the selected server */\nconst updateServer = (name: string) => {\n eventBus.emit('asyncapi-server:update:selected', { name })\n}\n\n/** Update a server variable on the selected server */\nconst updateServerVariable = (key: string, value: string) => {\n if (!selectedServer) {\n return\n }\n\n eventBus.emit('asyncapi-server:update:variables', {\n name: selectedServer.name,\n key,\n value,\n })\n}\n</script>\n\n<template>\n <label\n class=\"bg-b-2 flex h-8 items-center rounded-t-xl border-x border-t px-3 py-2.5 font-medium\">\n Server\n </label>\n <div\n :id=\"id\"\n class=\"border\"\n :class=\"{\n 'rounded-b-xl': !selectedServer?.description && !serverVariables,\n }\">\n <Selector\n v-if=\"servers.length\"\n :selectedServer\n :servers=\"servers\"\n :target=\"id\"\n @update:modelValue=\"updateServer\" />\n </div>\n <ServerVariablesForm\n layout=\"reference\"\n :variables=\"serverVariables\"\n @update:variable=\"updateServerVariable\" />\n\n <!-- Description -->\n <ScalarMarkdown\n v-if=\"selectedServer?.description\"\n class=\"text-c-3 rounded-b-xl border-x border-b px-3 py-1.5\"\n :value=\"selectedServer.description\" />\n</template>\n"],"mappings":""}
@@ -0,0 +1,80 @@
1
+ import Selector_default from "./Selector.vue.js";
2
+ import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, unref, useId } from "vue";
3
+ import { ServerVariablesForm } from "@scalar/api-client/components/Server";
4
+ import { ScalarMarkdown } from "@scalar/components/markdown";
5
+ import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
6
+ //#region src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue?vue&type=script&setup=true&lang.ts
7
+ var _hoisted_1 = ["id"];
8
+ var AsyncApiServerSelector_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
9
+ __name: "AsyncApiServerSelector",
10
+ props: {
11
+ eventBus: {},
12
+ selectedServer: {},
13
+ servers: {}
14
+ },
15
+ setup(__props) {
16
+ const id = useId();
17
+ /**
18
+ * Normalize AsyncAPI server variables into the shape the shared
19
+ * ServerVariablesForm expects (resolving references and defaulting `default`).
20
+ */
21
+ const serverVariables = computed(() => {
22
+ const variables = __props.selectedServer?.server.variables;
23
+ if (!variables) return;
24
+ return Object.fromEntries(Object.entries(variables).map(([name, variable]) => {
25
+ const resolved = getResolvedRef(variable);
26
+ return [name, {
27
+ default: resolved.default ?? "",
28
+ enum: resolved.enum,
29
+ description: resolved.description
30
+ }];
31
+ }));
32
+ });
33
+ /** Update the selected server */
34
+ const updateServer = (name) => {
35
+ __props.eventBus.emit("asyncapi-server:update:selected", { name });
36
+ };
37
+ /** Update a server variable on the selected server */
38
+ const updateServerVariable = (key, value) => {
39
+ if (!__props.selectedServer) return;
40
+ __props.eventBus.emit("asyncapi-server:update:variables", {
41
+ name: __props.selectedServer.name,
42
+ key,
43
+ value
44
+ });
45
+ };
46
+ return (_ctx, _cache) => {
47
+ return openBlock(), createElementBlock(Fragment, null, [
48
+ _cache[0] || (_cache[0] = createElementVNode("label", { class: "bg-b-2 flex h-8 items-center rounded-t-xl border-x border-t px-3 py-2.5 font-medium" }, " Server ", -1)),
49
+ createElementVNode("div", {
50
+ id: unref(id),
51
+ class: normalizeClass(["border", { "rounded-b-xl": !__props.selectedServer?.description && !serverVariables.value }])
52
+ }, [__props.servers.length ? (openBlock(), createBlock(Selector_default, {
53
+ key: 0,
54
+ selectedServer: __props.selectedServer,
55
+ servers: __props.servers,
56
+ target: unref(id),
57
+ "onUpdate:modelValue": updateServer
58
+ }, null, 8, [
59
+ "selectedServer",
60
+ "servers",
61
+ "target"
62
+ ])) : createCommentVNode("", true)], 10, _hoisted_1),
63
+ createVNode(unref(ServerVariablesForm), {
64
+ layout: "reference",
65
+ variables: serverVariables.value,
66
+ "onUpdate:variable": updateServerVariable
67
+ }, null, 8, ["variables"]),
68
+ __props.selectedServer?.description ? (openBlock(), createBlock(unref(ScalarMarkdown), {
69
+ key: 0,
70
+ class: "text-c-3 rounded-b-xl border-x border-b px-3 py-1.5",
71
+ value: __props.selectedServer.description
72
+ }, null, 8, ["value"])) : createCommentVNode("", true)
73
+ ], 64);
74
+ };
75
+ }
76
+ });
77
+ //#endregion
78
+ export { AsyncApiServerSelector_vue_vue_type_script_setup_true_lang_default as default };
79
+
80
+ //# sourceMappingURL=AsyncApiServerSelector.vue.script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AsyncApiServerSelector.vue.script.js","names":[],"sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/AsyncApiServerSelector.vue"],"sourcesContent":["<script lang=\"ts\">\ntype SelectorProps = {\n /** The event bus to use for emitting events */\n eventBus: WorkspaceEventBus\n /** The currently selected server */\n selectedServer: AsyncApiServerEntry | null\n /** Available servers */\n servers: AsyncApiServerEntry[]\n}\n\n/**\n * AsyncApiServerSelector\n *\n * Core component for rendering an AsyncAPI server selector block. It mirrors the\n * OpenAPI ServerSelector, but works with the AsyncAPI server shape (a named map\n * of `host`/`protocol`/`pathname` rather than an array of `url`).\n *\n * @event asyncapi-server:update:selected - Emitted when the selected server changes\n * @event asyncapi-server:update:variables - Emitted when a server variable changes\n */\nexport default {}\n</script>\n\n<script lang=\"ts\" setup>\nimport { ServerVariablesForm } from '@scalar/api-client/components/Server'\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport { computed, useId } from 'vue'\n\nimport Selector from './Selector.vue'\n\nconst { eventBus, servers, selectedServer } = defineProps<SelectorProps>()\n\nconst id = useId()\n\n/**\n * Normalize AsyncAPI server variables into the shape the shared\n * ServerVariablesForm expects (resolving references and defaulting `default`).\n */\nconst serverVariables = computed(() => {\n const variables = selectedServer?.server.variables\n if (!variables) {\n return undefined\n }\n\n return Object.fromEntries(\n Object.entries(variables).map(([name, variable]) => {\n const resolved = getResolvedRef(variable)\n return [\n name,\n {\n default: resolved.default ?? '',\n enum: resolved.enum,\n description: resolved.description,\n },\n ]\n }),\n )\n})\n\n/** Update the selected server */\nconst updateServer = (name: string) => {\n eventBus.emit('asyncapi-server:update:selected', { name })\n}\n\n/** Update a server variable on the selected server */\nconst updateServerVariable = (key: string, value: string) => {\n if (!selectedServer) {\n return\n }\n\n eventBus.emit('asyncapi-server:update:variables', {\n name: selectedServer.name,\n key,\n value,\n })\n}\n</script>\n\n<template>\n <label\n class=\"bg-b-2 flex h-8 items-center rounded-t-xl border-x border-t px-3 py-2.5 font-medium\">\n Server\n </label>\n <div\n :id=\"id\"\n class=\"border\"\n :class=\"{\n 'rounded-b-xl': !selectedServer?.description && !serverVariables,\n }\">\n <Selector\n v-if=\"servers.length\"\n :selectedServer\n :servers=\"servers\"\n :target=\"id\"\n @update:modelValue=\"updateServer\" />\n </div>\n <ServerVariablesForm\n layout=\"reference\"\n :variables=\"serverVariables\"\n @update:variable=\"updateServerVariable\" />\n\n <!-- Description -->\n <ScalarMarkdown\n v-if=\"selectedServer?.description\"\n class=\"text-c-3 rounded-b-xl border-x border-b px-3 py-1.5\"\n :value=\"selectedServer.description\" />\n</template>\n"],"mappings":";;;;;;;;;;;;;;;EAmCA,MAAM,KAAK,OAAM;;;;;EAMjB,MAAM,kBAAkB,eAAe;GACrC,MAAM,YAAY,QAAA,gBAAgB,OAAO;AACzC,OAAI,CAAC,UACH;AAGF,UAAO,OAAO,YACZ,OAAO,QAAQ,UAAU,CAAC,KAAK,CAAC,MAAM,cAAc;IAClD,MAAM,WAAW,eAAe,SAAQ;AACxC,WAAO,CACL,MACA;KACE,SAAS,SAAS,WAAW;KAC7B,MAAM,SAAS;KACf,aAAa,SAAS;KACvB,CACH;KACA,CACJ;IACD;;EAGD,MAAM,gBAAgB,SAAiB;AACrC,WAAA,SAAS,KAAK,mCAAmC,EAAE,MAAM,CAAA;;;EAI3D,MAAM,wBAAwB,KAAa,UAAkB;AAC3D,OAAI,CAAC,QAAA,eACH;AAGF,WAAA,SAAS,KAAK,oCAAoC;IAChD,MAAM,QAAA,eAAe;IACrB;IACA;IACD,CAAA;;;;8BAKD,mBAGQ,SAAA,EAFN,OAAM,uFAAqF,EAAC,YAE9F,GAAA;IACA,mBAYM,OAAA;KAXH,IAAI,MAAA,GAAE;KACP,OAAK,eAAA,CAAC,UAAQ,EAAA,gBAAA,CACmB,QAAA,gBAAgB,eAAW,CAAK,gBAAA,OAAA,CAAA,CAAA;QAIzD,QAAA,QAAQ,UAAA,WAAA,EADhB,YAKsC,kBAAA;;KAHnC,gBAAA,QAAA;KACA,SAAS,QAAA;KACT,QAAQ,MAAA,GAAE;KACV,uBAAmB;;;;;;IAExB,YAG4C,MAAA,oBAAA,EAAA;KAF1C,QAAO;KACN,WAAW,gBAAA;KACX,qBAAiB;;IAIZ,QAAA,gBAAgB,eAAA,WAAA,EADxB,YAGwC,MAAA,eAAA,EAAA;;KADtC,OAAM;KACL,OAAO,QAAA,eAAe"}
@@ -0,0 +1,25 @@
1
+ import type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example';
2
+ type __VLS_Props = {
3
+ /** The selected server */
4
+ selectedServer: AsyncApiServerEntry | null;
5
+ /** Available servers */
6
+ servers: AsyncApiServerEntry[];
7
+ /** The id of the target to use for the popover (e.g. address bar) */
8
+ target: string;
9
+ };
10
+ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {
11
+ servers: AsyncApiServerEntry[];
12
+ serverUrlWithoutTrailingSlash: import("vue").ComputedRef<string>;
13
+ serverOptions: import("vue").ComputedRef<{
14
+ id: string;
15
+ label: string;
16
+ }[]>;
17
+ selectedServer: AsyncApiServerEntry | null;
18
+ }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
19
+ "update:modelValue": (value: string) => any;
20
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
21
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
22
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
23
+ declare const _default: typeof __VLS_export;
24
+ export default _default;
25
+ //# sourceMappingURL=Selector.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Selector.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue"],"names":[],"mappings":"AAoFA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAA;AAGlF,KAAK,WAAW,GAAG;IACjB,0BAA0B;IAC1B,cAAc,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAC1C,wBAAwB;IACxB,OAAO,EAAE,mBAAmB,EAAE,CAAA;IAC9B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAA;CACf,CAAC;AAmMF,QAAA,MAAM,YAAY;;;;;;;;;;;;kFAIhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -0,0 +1,7 @@
1
+ import Selector_vue_vue_type_script_setup_true_lang_default from "./Selector.vue.script.js";
2
+ //#region src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue
3
+ var Selector_default = Selector_vue_vue_type_script_setup_true_lang_default;
4
+ //#endregion
5
+ export { Selector_default as default };
6
+
7
+ //# sourceMappingURL=Selector.vue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Selector.vue.js","names":[],"sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarListbox } from '@scalar/components/listbox'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example'\nimport { computed } from 'vue'\n\nconst { target, servers, selectedServer } = defineProps<{\n /** The selected server */\n selectedServer: AsyncApiServerEntry | null\n /** Available servers */\n servers: AsyncApiServerEntry[]\n /** The id of the target to use for the popover (e.g. address bar) */\n target: string\n}>()\n\nconst emit = defineEmits<{\n /** Emitted with the server name when the selected server changes */\n (e: 'update:modelValue', value: string): void\n}>()\n\n/**\n * AsyncAPI servers are a named map without a single `url`, so we key options by\n * the server name and label them with the constructed connection URL.\n */\nconst serverOptions = computed(() =>\n servers.map((server) => ({\n id: server.name,\n label: server.url,\n })),\n)\n\nconst serverUrlWithoutTrailingSlash = computed(\n () => selectedServer?.url?.replace(/\\/$/, '') || '',\n)\n\nconst selectedServerOption = computed(() =>\n serverOptions.value.find((opt) => opt.id === selectedServer?.name),\n)\n\n// For testing\ndefineExpose({\n servers,\n serverUrlWithoutTrailingSlash,\n serverOptions,\n selectedServer,\n})\n</script>\n<template>\n <ScalarListbox\n v-if=\"serverOptions.length > 1\"\n ref=\"elem\"\n class=\"group\"\n :modelValue=\"selectedServerOption\"\n :options=\"serverOptions\"\n placement=\"bottom-start\"\n resize\n :target=\"target\"\n @update:modelValue=\"(e) => emit('update:modelValue', e.id)\">\n <ScalarButton\n class=\"bg-b-1 text-c-1 h-auto w-full justify-start gap-1.5 overflow-x-auto rounded-t-none !rounded-b-xl px-3 py-1.5 text-base/5.25 font-normal whitespace-nowrap -outline-offset-1\"\n variant=\"ghost\">\n <span class=\"sr-only\">Server:</span>\n <span class=\"overflow-x-auto\">{{\n serverUrlWithoutTrailingSlash || 'Select a server'\n }}</span>\n <ScalarIconCaretDown\n class=\"text-c-2 ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarListbox>\n <div\n v-else\n class=\"text-c-1 flex h-auto w-full items-center gap-0.75 !rounded-b-xl px-3 py-1.5 text-base leading-[20px] whitespace-nowrap\">\n <span class=\"sr-only\">Server:</span>\n <span class=\"overflow-x-auto\">{{ serverUrlWithoutTrailingSlash }}</span>\n </div>\n</template>\n"],"mappings":""}
@@ -0,0 +1,76 @@
1
+ import { computed, createBlock, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, toDisplayString, unref, withCtx } from "vue";
2
+ import { ScalarIconCaretDown } from "@scalar/icons";
3
+ import { ScalarButton } from "@scalar/components/button";
4
+ import { ScalarListbox } from "@scalar/components/listbox";
5
+ //#region src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue?vue&type=script&setup=true&lang.ts
6
+ var _hoisted_1 = { class: "overflow-x-auto" };
7
+ var _hoisted_2 = {
8
+ key: 1,
9
+ class: "text-c-1 flex h-auto w-full items-center gap-0.75 !rounded-b-xl px-3 py-1.5 text-base leading-[20px] whitespace-nowrap"
10
+ };
11
+ var _hoisted_3 = { class: "overflow-x-auto" };
12
+ var Selector_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
13
+ __name: "Selector",
14
+ props: {
15
+ selectedServer: {},
16
+ servers: {},
17
+ target: {}
18
+ },
19
+ emits: ["update:modelValue"],
20
+ setup(__props, { expose: __expose, emit: __emit }) {
21
+ const emit = __emit;
22
+ /**
23
+ * AsyncAPI servers are a named map without a single `url`, so we key options by
24
+ * the server name and label them with the constructed connection URL.
25
+ */
26
+ const serverOptions = computed(() => __props.servers.map((server) => ({
27
+ id: server.name,
28
+ label: server.url
29
+ })));
30
+ const serverUrlWithoutTrailingSlash = computed(() => __props.selectedServer?.url?.replace(/\/$/, "") || "");
31
+ const selectedServerOption = computed(() => serverOptions.value.find((opt) => opt.id === __props.selectedServer?.name));
32
+ __expose({
33
+ servers: __props.servers,
34
+ serverUrlWithoutTrailingSlash,
35
+ serverOptions,
36
+ selectedServer: __props.selectedServer
37
+ });
38
+ return (_ctx, _cache) => {
39
+ return serverOptions.value.length > 1 ? (openBlock(), createBlock(unref(ScalarListbox), {
40
+ key: 0,
41
+ ref: "elem",
42
+ class: "group",
43
+ modelValue: selectedServerOption.value,
44
+ options: serverOptions.value,
45
+ placement: "bottom-start",
46
+ resize: "",
47
+ target: __props.target,
48
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = (e) => emit("update:modelValue", e.id))
49
+ }, {
50
+ default: withCtx(() => [createVNode(unref(ScalarButton), {
51
+ class: "bg-b-1 text-c-1 h-auto w-full justify-start gap-1.5 overflow-x-auto rounded-t-none !rounded-b-xl px-3 py-1.5 text-base/5.25 font-normal whitespace-nowrap -outline-offset-1",
52
+ variant: "ghost"
53
+ }, {
54
+ default: withCtx(() => [
55
+ _cache[1] || (_cache[1] = createElementVNode("span", { class: "sr-only" }, "Server:", -1)),
56
+ createElementVNode("span", _hoisted_1, toDisplayString(serverUrlWithoutTrailingSlash.value || "Select a server"), 1),
57
+ createVNode(unref(ScalarIconCaretDown), {
58
+ class: "text-c-2 ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
59
+ weight: "bold"
60
+ })
61
+ ]),
62
+ _: 1
63
+ })]),
64
+ _: 1
65
+ }, 8, [
66
+ "modelValue",
67
+ "options",
68
+ "target"
69
+ ])) : (openBlock(), createElementBlock("div", _hoisted_2, [_cache[2] || (_cache[2] = createElementVNode("span", { class: "sr-only" }, "Server:", -1)), createElementVNode("span", _hoisted_3, toDisplayString(serverUrlWithoutTrailingSlash.value), 1)]));
70
+ };
71
+ }
72
+ });
73
+ //#endregion
74
+ export { Selector_vue_vue_type_script_setup_true_lang_default as default };
75
+
76
+ //# sourceMappingURL=Selector.vue.script.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Selector.vue.script.js","names":[],"sources":["../../../../src/blocks/scalar-asyncapi-server-selector-block/components/Selector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarListbox } from '@scalar/components/listbox'\nimport { ScalarIconCaretDown } from '@scalar/icons'\nimport type { AsyncApiServerEntry } from '@scalar/workspace-store/channel-example'\nimport { computed } from 'vue'\n\nconst { target, servers, selectedServer } = defineProps<{\n /** The selected server */\n selectedServer: AsyncApiServerEntry | null\n /** Available servers */\n servers: AsyncApiServerEntry[]\n /** The id of the target to use for the popover (e.g. address bar) */\n target: string\n}>()\n\nconst emit = defineEmits<{\n /** Emitted with the server name when the selected server changes */\n (e: 'update:modelValue', value: string): void\n}>()\n\n/**\n * AsyncAPI servers are a named map without a single `url`, so we key options by\n * the server name and label them with the constructed connection URL.\n */\nconst serverOptions = computed(() =>\n servers.map((server) => ({\n id: server.name,\n label: server.url,\n })),\n)\n\nconst serverUrlWithoutTrailingSlash = computed(\n () => selectedServer?.url?.replace(/\\/$/, '') || '',\n)\n\nconst selectedServerOption = computed(() =>\n serverOptions.value.find((opt) => opt.id === selectedServer?.name),\n)\n\n// For testing\ndefineExpose({\n servers,\n serverUrlWithoutTrailingSlash,\n serverOptions,\n selectedServer,\n})\n</script>\n<template>\n <ScalarListbox\n v-if=\"serverOptions.length > 1\"\n ref=\"elem\"\n class=\"group\"\n :modelValue=\"selectedServerOption\"\n :options=\"serverOptions\"\n placement=\"bottom-start\"\n resize\n :target=\"target\"\n @update:modelValue=\"(e) => emit('update:modelValue', e.id)\">\n <ScalarButton\n class=\"bg-b-1 text-c-1 h-auto w-full justify-start gap-1.5 overflow-x-auto rounded-t-none !rounded-b-xl px-3 py-1.5 text-base/5.25 font-normal whitespace-nowrap -outline-offset-1\"\n variant=\"ghost\">\n <span class=\"sr-only\">Server:</span>\n <span class=\"overflow-x-auto\">{{\n serverUrlWithoutTrailingSlash || 'Select a server'\n }}</span>\n <ScalarIconCaretDown\n class=\"text-c-2 ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100\"\n weight=\"bold\" />\n </ScalarButton>\n </ScalarListbox>\n <div\n v-else\n class=\"text-c-1 flex h-auto w-full items-center gap-0.75 !rounded-b-xl px-3 py-1.5 text-base leading-[20px] whitespace-nowrap\">\n <span class=\"sr-only\">Server:</span>\n <span class=\"overflow-x-auto\">{{ serverUrlWithoutTrailingSlash }}</span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAgBA,MAAM,OAAO;;;;;EASb,MAAM,gBAAgB,eACpB,QAAA,QAAQ,KAAK,YAAY;GACvB,IAAI,OAAO;GACX,OAAO,OAAO;GACf,EAAE,CACL;EAEA,MAAM,gCAAgC,eAC9B,QAAA,gBAAgB,KAAK,QAAQ,OAAO,GAAG,IAAI,GACnD;EAEA,MAAM,uBAAuB,eAC3B,cAAc,MAAM,MAAM,QAAQ,IAAI,OAAO,QAAA,gBAAgB,KAAK,CACpE;AAGA,WAAa;GACX,SAAM,QAAA;GACN;GACA;GACA,gBAAa,QAAA;GACd,CAAA;;UAIS,cAAA,MAAc,SAAM,KAAA,WAAA,EAD5B,YAqBgB,MAAA,cAAA,EAAA;;IAnBd,KAAI;IACJ,OAAM;IACL,YAAY,qBAAA;IACZ,SAAS,cAAA;IACV,WAAU;IACV,QAAA;IACC,QAAQ,QAAA;IACR,uBAAiB,OAAA,OAAA,OAAA,MAAG,MAAM,KAAI,qBAAsB,EAAE,GAAE;;2BAW1C,CAVf,YAUe,MAAA,aAAA,EAAA;KATb,OAAM;KACN,SAAQ;;4BAC4B;gCAApC,mBAAoC,QAAA,EAA9B,OAAM,WAAS,EAAC,WAAO,GAAA;MAC7B,mBAES,QAFT,YAES,gBADP,8BAAA,SAA6B,kBAAA,EAAA,EAAA;MAE/B,YAEkB,MAAA,oBAAA,EAAA;OADhB,OAAM;OACN,QAAO;;;;;;;;;;uBAGb,mBAKM,OALN,YAKM,CAAA,OAAA,OAAA,OAAA,KAFJ,mBAAoC,QAAA,EAA9B,OAAM,WAAS,EAAC,WAAO,GAAA,GAC7B,mBAAwE,QAAxE,YAAwE,gBAAvC,8BAAA,MAA6B,EAAA,EAAA,CAAA,CAAA"}
@@ -0,0 +1,2 @@
1
+ export { default as AsyncApiServerSelector } from './components/AsyncApiServerSelector.vue.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/blocks/scalar-asyncapi-server-selector-block/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,sBAAsB,EAAE,MAAM,yCAAyC,CAAA"}
@@ -1,11 +1,10 @@
1
1
  import { type ClientOption, type ClientOptionGroup } from '@scalar/api-client/blocks/operation-code-sample';
2
- import type { AvailableClients } from '@scalar/types/snippetz';
3
2
  import { type WorkspaceEventBus } from '@scalar/workspace-store/events';
4
3
  type __VLS_Props = {
5
4
  /** Client options */
6
5
  clientOptions: ClientOptionGroup[];
7
- /** The currently selected Http Client */
8
- selectedClient?: AvailableClients[number];
6
+ /** The currently selected Http Client (a built-in client id or a custom sample id) */
7
+ selectedClient?: string;
9
8
  /** List of featured clients */
10
9
  featuredClients: ClientOption[];
11
10
  /** Event bus */
@@ -1 +1 @@
1
- {"version":3,"file":"ClientDropdown.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"names":[],"mappings":"AA4PA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEvB,MAAM,iDAAiD,CAAA;AAIxD,OAAO,KAAK,EAAE,gBAAgB,EAAY,MAAM,wBAAwB,CAAA;AACxE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAKvE,KAAK,WAAW,GAAG;IACf,qBAAqB;IACrB,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,yCAAyC;IACzC,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC,+BAA+B;IAC/B,eAAe,EAAE,YAAY,EAAE,CAAA;IAC/B,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AAqPJ,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ClientDropdown.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"names":[],"mappings":"AA4PA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAEvB,MAAM,iDAAiD,CAAA;AAKxD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAKvE,KAAK,WAAW,GAAG;IACf,qBAAqB;IACrB,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,+BAA+B;IAC/B,eAAe,EAAE,YAAY,EAAE,CAAA;IAC/B,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AAqPJ,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
2
2
  import ClientDropdown_vue_vue_type_script_setup_true_lang_default from "./ClientDropdown.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/blocks/scalar-client-selector-block/components/ClientDropdown.vue
5
- var ClientDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ClientDropdown_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-3150aaa3"]]);
5
+ var ClientDropdown_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ClientDropdown_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-c2617b43"]]);
6
6
  //#endregion
7
7
  export { ClientDropdown_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"ClientDropdown.vue.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Tab } from '@headlessui/vue'\nimport {\n filterClientsByQuery,\n findClient,\n type ClientOption,\n type ClientOptionGroup,\n type CustomClientOption,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport type { AvailableClients, TargetId } from '@scalar/types/snippetz'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { computed, ref } from 'vue'\n\nimport { isFeaturedClient } from '@/blocks/scalar-client-selector-block/helpers/featured-clients'\n\nconst { clientOptions, featuredClients, eventBus, selectedClient } =\n defineProps<{\n /** Client options */\n clientOptions: ClientOptionGroup[]\n /** The currently selected Http Client */\n selectedClient?: AvailableClients[number]\n /** List of featured clients */\n featuredClients: ClientOption[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n }>()\n\nconst containerRef = ref<HTMLElement>()\n\n/**\n * Icons have longer names to appear in icon searches, e.g. \"javascript-js\" instead of just \"javascript\". This function\n * maps the language key to the icon name.\n */\nconst getIconByLanguageKey = (targetKey: TargetId) =>\n `programming-language-${targetKey === 'js' ? 'javascript' : targetKey}` as const\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption | CustomClientOption) => {\n if (!containerRef.value) {\n return\n }\n\n // We need to freeze the ui to prevent scrolling as the clients change\n const unfreeze = freezeElement(containerRef.value)\n setTimeout(() => {\n unfreeze()\n }, 300)\n\n // Update the store\n if (option.clientKey !== 'custom') {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n/** Calculates the targetKey from the selected client id */\nconst selectedTargetKey = computed(\n () => selectedClient?.split('/')[0] as TargetId | undefined,\n)\n</script>\n<template>\n <div\n ref=\"containerRef\"\n class=\"client-libraries-content\">\n <Tab\n v-for=\"featuredClient in featuredClients\"\n :key=\"featuredClient.clientKey\"\n class=\"client-libraries rendered-code-sdks\"\n :class=\"{\n 'client-libraries__active': featuredClient.id === selectedClient,\n }\">\n <div :class=\"`client-libraries-icon__${featuredClient.targetKey}`\">\n <ScalarIcon\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(featuredClient.targetKey)\" />\n </div>\n <span class=\"client-libraries-text\">{{\n featuredClient.targetTitle\n }}</span>\n </Tab>\n\n <!-- Client Dropdown -->\n <ScalarCombobox\n :filterFn=\"filterClientsByQuery\"\n :modelValue=\"findClient(clientOptions, selectedClient)\"\n :options=\"clientOptions\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <button\n class=\"client-libraries client-libraries__select\"\n :class=\"{\n 'client-libraries__active':\n selectedClient && !isFeaturedClient(selectedClient),\n }\"\n type=\"button\">\n <div\n aria-hidden=\"true\"\n class=\"client-libraries-icon__more\">\n <template v-if=\"selectedClient && !isFeaturedClient(selectedClient)\">\n <div :class=\"`client-libraries-icon__${selectedTargetKey}`\">\n <ScalarIcon\n v-if=\"selectedTargetKey\"\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(selectedTargetKey)\" />\n </div>\n </template>\n <template v-else>\n <svg\n class=\"client-libraries-icon\"\n height=\"50\"\n role=\"presentation\"\n viewBox=\"0 0 50 50\"\n width=\"50\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <g\n fill=\"currentColor\"\n fill-rule=\"nonzero\">\n <path\n d=\"M10.71 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M21.13 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M31.55 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0\" />\n </g>\n </svg>\n </template>\n </div>\n <span\n v-if=\"clientOptions.length\"\n class=\"client-libraries-text client-libraries-text-more\">\n More\n </span>\n <span class=\"sr-only\">Select from all clients</span>\n </button>\n </ScalarCombobox>\n </div>\n</template>\n<style scoped>\n.client-libraries-content {\n container: client-libraries-content / inline-size;\n display: flex;\n justify-content: center;\n overflow: hidden;\n padding: 0 12px;\n background-color: var(--scalar-background-1);\n border-left: var(--scalar-border-width) solid var(--scalar-border-color);\n border-right: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.client-libraries {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n position: relative;\n cursor: pointer;\n white-space: nowrap;\n padding: 8px 2px;\n gap: 6px;\n color: var(--scalar-color-3);\n border-bottom: 1px solid transparent;\n user-select: none;\n}\n\n.client-libraries:not(.client-libraries__active):hover:before {\n content: '';\n position: absolute;\n width: calc(100% - 4px);\n height: calc(100% - 4px);\n background: var(--scalar-background-2);\n left: 2px;\n top: 2px;\n z-index: 0;\n border-radius: var(--scalar-radius);\n}\n.client-libraries:active {\n color: var(--scalar-color-1);\n}\n.client-libraries:focus-visible {\n outline: none;\n box-shadow: inset 0 0 0 1px var(--scalar-color-accent);\n}\n/* remove php and c on mobile */\n@media screen and (max-width: 450px) {\n .client-libraries:nth-of-type(4),\n .client-libraries:nth-of-type(5) {\n display: none;\n }\n}\n.client-libraries-icon {\n max-width: 14px;\n max-height: 14px;\n min-width: 14px;\n width: 100%;\n aspect-ratio: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n color: currentColor;\n}\n.client-libraries-icon__more svg {\n height: initial;\n}\n@container client-libraries-content (width < 400px) {\n .client-libraries__select {\n width: fit-content;\n\n .client-libraries-icon__more + span {\n display: none;\n }\n }\n}\n@container client-libraries-content (width < 380px) {\n .client-libraries {\n width: 100%;\n }\n .client-libraries span {\n display: none;\n }\n}\n.client-libraries__active {\n color: var(--scalar-color-1);\n border-bottom: 1px solid var(--scalar-color-1);\n}\n@keyframes codeloader {\n 0% {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(1turn);\n }\n}\n.client-libraries .client-libraries-text {\n font-size: var(--scalar-small);\n position: relative;\n display: flex;\n align-items: center;\n}\n.client-libraries__active .client-libraries-text {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n@media screen and (max-width: 600px) {\n .references-classic .client-libraries {\n flex-direction: column;\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"ClientDropdown.vue.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Tab } from '@headlessui/vue'\nimport {\n filterClientsByQuery,\n findClient,\n type ClientOption,\n type ClientOptionGroup,\n type CustomClientOption,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport type { TargetId } from '@scalar/types/snippetz'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { computed, ref } from 'vue'\n\nimport { isFeaturedClient } from '@/blocks/scalar-client-selector-block/helpers/featured-clients'\n\nconst { clientOptions, featuredClients, eventBus, selectedClient } =\n defineProps<{\n /** Client options */\n clientOptions: ClientOptionGroup[]\n /** The currently selected Http Client (a built-in client id or a custom sample id) */\n selectedClient?: string\n /** List of featured clients */\n featuredClients: ClientOption[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n }>()\n\nconst containerRef = ref<HTMLElement>()\n\n/**\n * Icons have longer names to appear in icon searches, e.g. \"javascript-js\" instead of just \"javascript\". This function\n * maps the language key to the icon name.\n */\nconst getIconByLanguageKey = (targetKey: TargetId) =>\n `programming-language-${targetKey === 'js' ? 'javascript' : targetKey}` as const\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption | CustomClientOption) => {\n if (!containerRef.value) {\n return\n }\n\n // We need to freeze the ui to prevent scrolling as the clients change\n const unfreeze = freezeElement(containerRef.value)\n setTimeout(() => {\n unfreeze()\n }, 300)\n\n // Update the store\n if (option.clientKey !== 'custom') {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n/** Calculates the targetKey from the selected client id */\nconst selectedTargetKey = computed(\n () => selectedClient?.split('/')[0] as TargetId | undefined,\n)\n</script>\n<template>\n <div\n ref=\"containerRef\"\n class=\"client-libraries-content\">\n <Tab\n v-for=\"featuredClient in featuredClients\"\n :key=\"featuredClient.clientKey\"\n class=\"client-libraries rendered-code-sdks\"\n :class=\"{\n 'client-libraries__active': featuredClient.id === selectedClient,\n }\">\n <div :class=\"`client-libraries-icon__${featuredClient.targetKey}`\">\n <ScalarIcon\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(featuredClient.targetKey)\" />\n </div>\n <span class=\"client-libraries-text\">{{\n featuredClient.targetTitle\n }}</span>\n </Tab>\n\n <!-- Client Dropdown -->\n <ScalarCombobox\n :filterFn=\"filterClientsByQuery\"\n :modelValue=\"findClient(clientOptions, selectedClient)\"\n :options=\"clientOptions\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <button\n class=\"client-libraries client-libraries__select\"\n :class=\"{\n 'client-libraries__active':\n selectedClient && !isFeaturedClient(selectedClient),\n }\"\n type=\"button\">\n <div\n aria-hidden=\"true\"\n class=\"client-libraries-icon__more\">\n <template v-if=\"selectedClient && !isFeaturedClient(selectedClient)\">\n <div :class=\"`client-libraries-icon__${selectedTargetKey}`\">\n <ScalarIcon\n v-if=\"selectedTargetKey\"\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(selectedTargetKey)\" />\n </div>\n </template>\n <template v-else>\n <svg\n class=\"client-libraries-icon\"\n height=\"50\"\n role=\"presentation\"\n viewBox=\"0 0 50 50\"\n width=\"50\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <g\n fill=\"currentColor\"\n fill-rule=\"nonzero\">\n <path\n d=\"M10.71 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M21.13 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M31.55 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0\" />\n </g>\n </svg>\n </template>\n </div>\n <span\n v-if=\"clientOptions.length\"\n class=\"client-libraries-text client-libraries-text-more\">\n More\n </span>\n <span class=\"sr-only\">Select from all clients</span>\n </button>\n </ScalarCombobox>\n </div>\n</template>\n<style scoped>\n.client-libraries-content {\n container: client-libraries-content / inline-size;\n display: flex;\n justify-content: center;\n overflow: hidden;\n padding: 0 12px;\n background-color: var(--scalar-background-1);\n border-left: var(--scalar-border-width) solid var(--scalar-border-color);\n border-right: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.client-libraries {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n position: relative;\n cursor: pointer;\n white-space: nowrap;\n padding: 8px 2px;\n gap: 6px;\n color: var(--scalar-color-3);\n border-bottom: 1px solid transparent;\n user-select: none;\n}\n\n.client-libraries:not(.client-libraries__active):hover:before {\n content: '';\n position: absolute;\n width: calc(100% - 4px);\n height: calc(100% - 4px);\n background: var(--scalar-background-2);\n left: 2px;\n top: 2px;\n z-index: 0;\n border-radius: var(--scalar-radius);\n}\n.client-libraries:active {\n color: var(--scalar-color-1);\n}\n.client-libraries:focus-visible {\n outline: none;\n box-shadow: inset 0 0 0 1px var(--scalar-color-accent);\n}\n/* remove php and c on mobile */\n@media screen and (max-width: 450px) {\n .client-libraries:nth-of-type(4),\n .client-libraries:nth-of-type(5) {\n display: none;\n }\n}\n.client-libraries-icon {\n max-width: 14px;\n max-height: 14px;\n min-width: 14px;\n width: 100%;\n aspect-ratio: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n color: currentColor;\n}\n.client-libraries-icon__more svg {\n height: initial;\n}\n@container client-libraries-content (width < 400px) {\n .client-libraries__select {\n width: fit-content;\n\n .client-libraries-icon__more + span {\n display: none;\n }\n }\n}\n@container client-libraries-content (width < 380px) {\n .client-libraries {\n width: 100%;\n }\n .client-libraries span {\n display: none;\n }\n}\n.client-libraries__active {\n color: var(--scalar-color-1);\n border-bottom: 1px solid var(--scalar-color-1);\n}\n@keyframes codeloader {\n 0% {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(1turn);\n }\n}\n.client-libraries .client-libraries-text {\n font-size: var(--scalar-small);\n position: relative;\n display: flex;\n align-items: center;\n}\n.client-libraries__active .client-libraries-text {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n@media screen and (max-width: 600px) {\n .references-classic .client-libraries {\n flex-direction: column;\n }\n}\n</style>\n"],"mappings":""}
@@ -1 +1 @@
1
- {"version":3,"file":"ClientDropdown.vue.script.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Tab } from '@headlessui/vue'\nimport {\n filterClientsByQuery,\n findClient,\n type ClientOption,\n type ClientOptionGroup,\n type CustomClientOption,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport type { AvailableClients, TargetId } from '@scalar/types/snippetz'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { computed, ref } from 'vue'\n\nimport { isFeaturedClient } from '@/blocks/scalar-client-selector-block/helpers/featured-clients'\n\nconst { clientOptions, featuredClients, eventBus, selectedClient } =\n defineProps<{\n /** Client options */\n clientOptions: ClientOptionGroup[]\n /** The currently selected Http Client */\n selectedClient?: AvailableClients[number]\n /** List of featured clients */\n featuredClients: ClientOption[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n }>()\n\nconst containerRef = ref<HTMLElement>()\n\n/**\n * Icons have longer names to appear in icon searches, e.g. \"javascript-js\" instead of just \"javascript\". This function\n * maps the language key to the icon name.\n */\nconst getIconByLanguageKey = (targetKey: TargetId) =>\n `programming-language-${targetKey === 'js' ? 'javascript' : targetKey}` as const\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption | CustomClientOption) => {\n if (!containerRef.value) {\n return\n }\n\n // We need to freeze the ui to prevent scrolling as the clients change\n const unfreeze = freezeElement(containerRef.value)\n setTimeout(() => {\n unfreeze()\n }, 300)\n\n // Update the store\n if (option.clientKey !== 'custom') {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n/** Calculates the targetKey from the selected client id */\nconst selectedTargetKey = computed(\n () => selectedClient?.split('/')[0] as TargetId | undefined,\n)\n</script>\n<template>\n <div\n ref=\"containerRef\"\n class=\"client-libraries-content\">\n <Tab\n v-for=\"featuredClient in featuredClients\"\n :key=\"featuredClient.clientKey\"\n class=\"client-libraries rendered-code-sdks\"\n :class=\"{\n 'client-libraries__active': featuredClient.id === selectedClient,\n }\">\n <div :class=\"`client-libraries-icon__${featuredClient.targetKey}`\">\n <ScalarIcon\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(featuredClient.targetKey)\" />\n </div>\n <span class=\"client-libraries-text\">{{\n featuredClient.targetTitle\n }}</span>\n </Tab>\n\n <!-- Client Dropdown -->\n <ScalarCombobox\n :filterFn=\"filterClientsByQuery\"\n :modelValue=\"findClient(clientOptions, selectedClient)\"\n :options=\"clientOptions\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <button\n class=\"client-libraries client-libraries__select\"\n :class=\"{\n 'client-libraries__active':\n selectedClient && !isFeaturedClient(selectedClient),\n }\"\n type=\"button\">\n <div\n aria-hidden=\"true\"\n class=\"client-libraries-icon__more\">\n <template v-if=\"selectedClient && !isFeaturedClient(selectedClient)\">\n <div :class=\"`client-libraries-icon__${selectedTargetKey}`\">\n <ScalarIcon\n v-if=\"selectedTargetKey\"\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(selectedTargetKey)\" />\n </div>\n </template>\n <template v-else>\n <svg\n class=\"client-libraries-icon\"\n height=\"50\"\n role=\"presentation\"\n viewBox=\"0 0 50 50\"\n width=\"50\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <g\n fill=\"currentColor\"\n fill-rule=\"nonzero\">\n <path\n d=\"M10.71 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M21.13 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M31.55 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0\" />\n </g>\n </svg>\n </template>\n </div>\n <span\n v-if=\"clientOptions.length\"\n class=\"client-libraries-text client-libraries-text-more\">\n More\n </span>\n <span class=\"sr-only\">Select from all clients</span>\n </button>\n </ScalarCombobox>\n </div>\n</template>\n<style scoped>\n.client-libraries-content {\n container: client-libraries-content / inline-size;\n display: flex;\n justify-content: center;\n overflow: hidden;\n padding: 0 12px;\n background-color: var(--scalar-background-1);\n border-left: var(--scalar-border-width) solid var(--scalar-border-color);\n border-right: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.client-libraries {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n position: relative;\n cursor: pointer;\n white-space: nowrap;\n padding: 8px 2px;\n gap: 6px;\n color: var(--scalar-color-3);\n border-bottom: 1px solid transparent;\n user-select: none;\n}\n\n.client-libraries:not(.client-libraries__active):hover:before {\n content: '';\n position: absolute;\n width: calc(100% - 4px);\n height: calc(100% - 4px);\n background: var(--scalar-background-2);\n left: 2px;\n top: 2px;\n z-index: 0;\n border-radius: var(--scalar-radius);\n}\n.client-libraries:active {\n color: var(--scalar-color-1);\n}\n.client-libraries:focus-visible {\n outline: none;\n box-shadow: inset 0 0 0 1px var(--scalar-color-accent);\n}\n/* remove php and c on mobile */\n@media screen and (max-width: 450px) {\n .client-libraries:nth-of-type(4),\n .client-libraries:nth-of-type(5) {\n display: none;\n }\n}\n.client-libraries-icon {\n max-width: 14px;\n max-height: 14px;\n min-width: 14px;\n width: 100%;\n aspect-ratio: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n color: currentColor;\n}\n.client-libraries-icon__more svg {\n height: initial;\n}\n@container client-libraries-content (width < 400px) {\n .client-libraries__select {\n width: fit-content;\n\n .client-libraries-icon__more + span {\n display: none;\n }\n }\n}\n@container client-libraries-content (width < 380px) {\n .client-libraries {\n width: 100%;\n }\n .client-libraries span {\n display: none;\n }\n}\n.client-libraries__active {\n color: var(--scalar-color-1);\n border-bottom: 1px solid var(--scalar-color-1);\n}\n@keyframes codeloader {\n 0% {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(1turn);\n }\n}\n.client-libraries .client-libraries-text {\n font-size: var(--scalar-small);\n position: relative;\n display: flex;\n align-items: center;\n}\n.client-libraries__active .client-libraries-text {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n@media screen and (max-width: 600px) {\n .references-classic .client-libraries {\n flex-direction: column;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BA,MAAM,eAAe,KAAiB;;;;;EAMtC,MAAM,wBAAwB,cAC5B,wBAAwB,cAAc,OAAO,eAAe;;EAG9D,MAAM,gBAAgB,WAA8C;AAClE,OAAI,CAAC,aAAa,MAChB;GAIF,MAAM,WAAW,cAAc,aAAa,MAAK;AACjD,oBAAiB;AACf,cAAS;MACR,IAAG;AAGN,OAAI,OAAO,cAAc,SACvB,SAAA,SAAS,KAAK,oCAAoC,OAAO,GAAE;;;EAK/D,MAAM,oBAAoB,eAClB,QAAA,gBAAgB,MAAM,IAAI,CAAC,GACnC;;uBAGE,mBAuEM,OAAA;aAtEA;IAAJ,KAAI;IACJ,OAAM;yBACN,mBAeM,UAAA,MAAA,WAdqB,QAAA,kBAAlB,mBAAc;wBADvB,YAeM,MAAA,IAAA,EAAA;KAbH,KAAK,eAAe;KACrB,OAAK,eAAA,CAAC,uCAAqC,EAAA,4BACG,eAAe,OAAO,QAAA,gBAAA,CAAA,CAAA;;4BAO9D,CAJN,mBAIM,OAAA,EAJA,OAAK,eAAA,0BAA4B,eAAe,YAAS,EAAA,EAAA,CAC7D,YAE2D,MAAA,WAAA,EAAA;MADzD,OAAM;MACL,MAAM,qBAAqB,eAAe,UAAS;iCAExD,mBAES,QAFT,YAES,gBADP,eAAe,YAAW,EAAA,EAAA,CAAA,CAAA;;;cAK9B,YAiDiB,MAAA,eAAA,EAAA;IAhDd,UAAU,MAAA,qBAAoB;IAC9B,YAAY,MAAA,WAAU,CAAC,QAAA,eAAe,QAAA,eAAc;IACpD,SAAS,QAAA;IACV,WAAU;IACV,UAAA;IACC,uBAAiB,OAAA,OAAA,OAAA,MAAA,WAAE,aAAa,OAAM;;2BA0C9B,CAzCT,mBAyCS,UAAA;KAxCP,OAAK,eAAA,CAAC,6CAA2C,EAAA,4BACW,QAAA,kBAAc,CAAK,MAAA,iBAAgB,CAAC,QAAA,eAAc,EAAA,CAAA,CAAA;KAI9G,MAAK;;KACL,mBA2BM,OA3BN,YA2BM,CAxBY,QAAA,kBAAc,CAAK,MAAA,iBAAgB,CAAC,QAAA,eAAc,IAAA,WAAA,EAChE,mBAKM,OAAA;;MALA,OAAK,eAAA,0BAA4B,kBAAA,QAAiB;SAE9C,kBAAA,SAAA,WAAA,EADR,YAGoD,MAAA,WAAA,EAAA;;MADlD,OAAM;MACL,MAAM,qBAAqB,kBAAA,MAAiB;iFAIjD,mBAaM,OAbN,YAaM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CANJ,mBAKI,KAAA;MAJF,MAAK;MACL,aAAU;SACV,mBACoL,QAAA,EAAlL,GAAE,+KAA6K,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,CAAA,EAAA,CAAA;KAMjL,QAAA,cAAc,UAAA,WAAA,EADtB,mBAIO,QAJP,YAE2D,SAE3D,IAAA,mBAAA,IAAA,KAAA;+BACA,mBAAoD,QAAA,EAA9C,OAAM,WAAS,EAAC,2BAAuB,GAAA"}
1
+ {"version":3,"file":"ClientDropdown.vue.script.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientDropdown.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Tab } from '@headlessui/vue'\nimport {\n filterClientsByQuery,\n findClient,\n type ClientOption,\n type ClientOptionGroup,\n type CustomClientOption,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCombobox } from '@scalar/components/combobox'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { freezeElement } from '@scalar/helpers/dom/freeze-element'\nimport type { TargetId } from '@scalar/types/snippetz'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { computed, ref } from 'vue'\n\nimport { isFeaturedClient } from '@/blocks/scalar-client-selector-block/helpers/featured-clients'\n\nconst { clientOptions, featuredClients, eventBus, selectedClient } =\n defineProps<{\n /** Client options */\n clientOptions: ClientOptionGroup[]\n /** The currently selected Http Client (a built-in client id or a custom sample id) */\n selectedClient?: string\n /** List of featured clients */\n featuredClients: ClientOption[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n }>()\n\nconst containerRef = ref<HTMLElement>()\n\n/**\n * Icons have longer names to appear in icon searches, e.g. \"javascript-js\" instead of just \"javascript\". This function\n * maps the language key to the icon name.\n */\nconst getIconByLanguageKey = (targetKey: TargetId) =>\n `programming-language-${targetKey === 'js' ? 'javascript' : targetKey}` as const\n\n/** Set custom example, or update the selected HTTP client globally */\nconst selectClient = (option: ClientOption | CustomClientOption) => {\n if (!containerRef.value) {\n return\n }\n\n // We need to freeze the ui to prevent scrolling as the clients change\n const unfreeze = freezeElement(containerRef.value)\n setTimeout(() => {\n unfreeze()\n }, 300)\n\n // Update the store\n if (option.clientKey !== 'custom') {\n eventBus.emit('workspace:update:selected-client', option.id)\n }\n}\n\n/** Calculates the targetKey from the selected client id */\nconst selectedTargetKey = computed(\n () => selectedClient?.split('/')[0] as TargetId | undefined,\n)\n</script>\n<template>\n <div\n ref=\"containerRef\"\n class=\"client-libraries-content\">\n <Tab\n v-for=\"featuredClient in featuredClients\"\n :key=\"featuredClient.clientKey\"\n class=\"client-libraries rendered-code-sdks\"\n :class=\"{\n 'client-libraries__active': featuredClient.id === selectedClient,\n }\">\n <div :class=\"`client-libraries-icon__${featuredClient.targetKey}`\">\n <ScalarIcon\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(featuredClient.targetKey)\" />\n </div>\n <span class=\"client-libraries-text\">{{\n featuredClient.targetTitle\n }}</span>\n </Tab>\n\n <!-- Client Dropdown -->\n <ScalarCombobox\n :filterFn=\"filterClientsByQuery\"\n :modelValue=\"findClient(clientOptions, selectedClient)\"\n :options=\"clientOptions\"\n placement=\"bottom-end\"\n teleport\n @update:modelValue=\"selectClient($event as ClientOption)\">\n <button\n class=\"client-libraries client-libraries__select\"\n :class=\"{\n 'client-libraries__active':\n selectedClient && !isFeaturedClient(selectedClient),\n }\"\n type=\"button\">\n <div\n aria-hidden=\"true\"\n class=\"client-libraries-icon__more\">\n <template v-if=\"selectedClient && !isFeaturedClient(selectedClient)\">\n <div :class=\"`client-libraries-icon__${selectedTargetKey}`\">\n <ScalarIcon\n v-if=\"selectedTargetKey\"\n class=\"client-libraries-icon\"\n :icon=\"getIconByLanguageKey(selectedTargetKey)\" />\n </div>\n </template>\n <template v-else>\n <svg\n class=\"client-libraries-icon\"\n height=\"50\"\n role=\"presentation\"\n viewBox=\"0 0 50 50\"\n width=\"50\"\n xmlns=\"http://www.w3.org/2000/svg\">\n <g\n fill=\"currentColor\"\n fill-rule=\"nonzero\">\n <path\n d=\"M10.71 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M21.13 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0M31.55 25.3a3.87 3.87 0 1 0 7.74 0 3.87 3.87 0 0 0-7.74 0\" />\n </g>\n </svg>\n </template>\n </div>\n <span\n v-if=\"clientOptions.length\"\n class=\"client-libraries-text client-libraries-text-more\">\n More\n </span>\n <span class=\"sr-only\">Select from all clients</span>\n </button>\n </ScalarCombobox>\n </div>\n</template>\n<style scoped>\n.client-libraries-content {\n container: client-libraries-content / inline-size;\n display: flex;\n justify-content: center;\n overflow: hidden;\n padding: 0 12px;\n background-color: var(--scalar-background-1);\n border-left: var(--scalar-border-width) solid var(--scalar-border-color);\n border-right: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n.client-libraries {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n position: relative;\n cursor: pointer;\n white-space: nowrap;\n padding: 8px 2px;\n gap: 6px;\n color: var(--scalar-color-3);\n border-bottom: 1px solid transparent;\n user-select: none;\n}\n\n.client-libraries:not(.client-libraries__active):hover:before {\n content: '';\n position: absolute;\n width: calc(100% - 4px);\n height: calc(100% - 4px);\n background: var(--scalar-background-2);\n left: 2px;\n top: 2px;\n z-index: 0;\n border-radius: var(--scalar-radius);\n}\n.client-libraries:active {\n color: var(--scalar-color-1);\n}\n.client-libraries:focus-visible {\n outline: none;\n box-shadow: inset 0 0 0 1px var(--scalar-color-accent);\n}\n/* remove php and c on mobile */\n@media screen and (max-width: 450px) {\n .client-libraries:nth-of-type(4),\n .client-libraries:nth-of-type(5) {\n display: none;\n }\n}\n.client-libraries-icon {\n max-width: 14px;\n max-height: 14px;\n min-width: 14px;\n width: 100%;\n aspect-ratio: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n position: relative;\n box-sizing: border-box;\n color: currentColor;\n}\n.client-libraries-icon__more svg {\n height: initial;\n}\n@container client-libraries-content (width < 400px) {\n .client-libraries__select {\n width: fit-content;\n\n .client-libraries-icon__more + span {\n display: none;\n }\n }\n}\n@container client-libraries-content (width < 380px) {\n .client-libraries {\n width: 100%;\n }\n .client-libraries span {\n display: none;\n }\n}\n.client-libraries__active {\n color: var(--scalar-color-1);\n border-bottom: 1px solid var(--scalar-color-1);\n}\n@keyframes codeloader {\n 0% {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(1turn);\n }\n}\n.client-libraries .client-libraries-text {\n font-size: var(--scalar-small);\n position: relative;\n display: flex;\n align-items: center;\n}\n.client-libraries__active .client-libraries-text {\n color: var(--scalar-color-1);\n font-weight: var(--scalar-semibold);\n}\n@media screen and (max-width: 600px) {\n .references-classic .client-libraries {\n flex-direction: column;\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BA,MAAM,eAAe,KAAiB;;;;;EAMtC,MAAM,wBAAwB,cAC5B,wBAAwB,cAAc,OAAO,eAAe;;EAG9D,MAAM,gBAAgB,WAA8C;AAClE,OAAI,CAAC,aAAa,MAChB;GAIF,MAAM,WAAW,cAAc,aAAa,MAAK;AACjD,oBAAiB;AACf,cAAS;MACR,IAAG;AAGN,OAAI,OAAO,cAAc,SACvB,SAAA,SAAS,KAAK,oCAAoC,OAAO,GAAE;;;EAK/D,MAAM,oBAAoB,eAClB,QAAA,gBAAgB,MAAM,IAAI,CAAC,GACnC;;uBAGE,mBAuEM,OAAA;aAtEA;IAAJ,KAAI;IACJ,OAAM;yBACN,mBAeM,UAAA,MAAA,WAdqB,QAAA,kBAAlB,mBAAc;wBADvB,YAeM,MAAA,IAAA,EAAA;KAbH,KAAK,eAAe;KACrB,OAAK,eAAA,CAAC,uCAAqC,EAAA,4BACG,eAAe,OAAO,QAAA,gBAAA,CAAA,CAAA;;4BAO9D,CAJN,mBAIM,OAAA,EAJA,OAAK,eAAA,0BAA4B,eAAe,YAAS,EAAA,EAAA,CAC7D,YAE2D,MAAA,WAAA,EAAA;MADzD,OAAM;MACL,MAAM,qBAAqB,eAAe,UAAS;iCAExD,mBAES,QAFT,YAES,gBADP,eAAe,YAAW,EAAA,EAAA,CAAA,CAAA;;;cAK9B,YAiDiB,MAAA,eAAA,EAAA;IAhDd,UAAU,MAAA,qBAAoB;IAC9B,YAAY,MAAA,WAAU,CAAC,QAAA,eAAe,QAAA,eAAc;IACpD,SAAS,QAAA;IACV,WAAU;IACV,UAAA;IACC,uBAAiB,OAAA,OAAA,OAAA,MAAA,WAAE,aAAa,OAAM;;2BA0C9B,CAzCT,mBAyCS,UAAA;KAxCP,OAAK,eAAA,CAAC,6CAA2C,EAAA,4BACW,QAAA,kBAAc,CAAK,MAAA,iBAAgB,CAAC,QAAA,eAAc,EAAA,CAAA,CAAA;KAI9G,MAAK;;KACL,mBA2BM,OA3BN,YA2BM,CAxBY,QAAA,kBAAc,CAAK,MAAA,iBAAgB,CAAC,QAAA,eAAc,IAAA,WAAA,EAChE,mBAKM,OAAA;;MALA,OAAK,eAAA,0BAA4B,kBAAA,QAAiB;SAE9C,kBAAA,SAAA,WAAA,EADR,YAGoD,MAAA,WAAA,EAAA;;MADlD,OAAM;MACL,MAAM,qBAAqB,kBAAA,MAAiB;iFAIjD,mBAaM,OAbN,YAaM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CANJ,mBAKI,KAAA;MAJF,MAAK;MACL,aAAU;SACV,mBACoL,QAAA,EAAlL,GAAE,+KAA6K,CAAA,CAAA,EAAA,GAAA,CAAA,EAAA,CAAA,EAAA,CAAA;KAMjL,QAAA,cAAc,UAAA,WAAA,EADtB,mBAIO,QAJP,YAE2D,SAE3D,IAAA,mBAAA,IAAA,KAAA;+BACA,mBAAoD,QAAA,EAA9C,OAAM,WAAS,EAAC,2BAAuB,GAAA"}
@@ -1,14 +1,10 @@
1
1
  import { type ClientOptionGroup } from '@scalar/api-client/blocks/operation-code-sample';
2
- import type { AvailableClient } from '@scalar/snippetz';
3
2
  import { type WorkspaceEventBus } from '@scalar/workspace-store/events';
4
- import type { XScalarSdkInstallation } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-sdk-installation';
5
3
  type __VLS_Props = {
6
- /** Selected SDK installation instructions */
7
- xScalarSdkInstallation?: XScalarSdkInstallation['x-scalar-sdk-installation'];
8
4
  /** Computed list of all available Http Client options */
9
5
  clientOptions: ClientOptionGroup[];
10
- /** The currently selected Http Client */
11
- selectedClient?: AvailableClient;
6
+ /** The currently selected Http Client (a built-in client id or a custom sample id) */
7
+ selectedClient?: string;
12
8
  /** Event bus */
13
9
  eventBus: WorkspaceEventBus;
14
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ClientSelector.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientSelector.vue"],"names":[],"mappings":"AAkNA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,iDAAiD,CAAA;AAGxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+EAA+E,CAAA;AAU3H,KAAK,WAAW,GAAG;IACjB,6CAA6C;IAC7C,sBAAsB,CAAC,EAAE,sBAAsB,CAAC,2BAA2B,CAAC,CAAA;IAC5E,yDAAyD;IACzD,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,yCAAyC;IACzC,cAAc,CAAC,EAAE,eAAe,CAAA;IAChC,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AA8RF,QAAA,MAAM,YAAY;;oPAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ClientSelector.vue.d.ts","sourceRoot":"","sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientSelector.vue"],"names":[],"mappings":"AAqLA,OAAO,EAEL,KAAK,iBAAiB,EACvB,MAAM,iDAAiD,CAAA;AACxD,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAUvE,KAAK,WAAW,GAAG;IACjB,yDAAyD;IACzD,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;AAwOF,QAAA,MAAM,YAAY;;oPAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../_virtual/_plugin-vue_exp
2
2
  import ClientSelector_vue_vue_type_script_setup_true_lang_default from "./ClientSelector.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/blocks/scalar-client-selector-block/components/ClientSelector.vue
5
- var ClientSelector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ClientSelector_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-570e3418"]]);
5
+ var ClientSelector_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ClientSelector_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-0769d07b"]]);
6
6
  //#endregion
7
7
  export { ClientSelector_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"ClientSelector.vue.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientSelector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/vue'\nimport {\n DEFAULT_CLIENT,\n type ClientOptionGroup,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { ScalarCodeBlock } from '@scalar/components/code-block'\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport type { AvailableClient } from '@scalar/snippetz'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarSdkInstallation } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-sdk-installation'\nimport { computed, useId, useTemplateRef } from 'vue'\n\nimport {\n getFeaturedClients,\n isFeaturedClient,\n} from '@/blocks/scalar-client-selector-block/helpers/featured-clients'\n\nimport ClientDropdown from './ClientDropdown.vue'\n\nconst {\n clientOptions,\n xScalarSdkInstallation,\n eventBus,\n selectedClient = DEFAULT_CLIENT,\n} = defineProps<{\n /** Selected SDK installation instructions */\n xScalarSdkInstallation?: XScalarSdkInstallation['x-scalar-sdk-installation']\n /** Computed list of all available Http Client options */\n clientOptions: ClientOptionGroup[]\n /** The currently selected Http Client */\n selectedClient?: AvailableClient\n /** Event bus */\n eventBus: WorkspaceEventBus\n}>()\n\nconst headingId = useId()\nconst morePanel = useId()\n\n/** Grab the option for the currently selected Http Client */\nconst selectedClientOption = computed(\n () =>\n clientOptions.flatMap(\n (optionGroup) =>\n optionGroup.options.find((option) => option.id === selectedClient) ??\n [],\n )[0],\n)\n\n/** List of featured clients */\nconst featuredClients = computed(() => getFeaturedClients(clientOptions))\n\n/** Currently selected tab index */\nconst tabIndex = computed(() =>\n featuredClients.value.findIndex(\n (featuredClient) => selectedClient === featuredClient.id,\n ),\n)\n\nconst wrapper = useTemplateRef('wrapper-ref')\n\n/** Emit the selected client event on tab */\nconst onTabSelect = (i: number) => {\n const client = featuredClients.value[i]\n\n if (!client || !wrapper.value) {\n return\n }\n\n eventBus.emit('workspace:update:selected-client', client.id)\n}\n\nconst installationInstructions = computed(() => {\n // Check whether we have instructions at all\n if (\n !Array.isArray(xScalarSdkInstallation) ||\n !xScalarSdkInstallation?.length\n ) {\n return undefined\n }\n\n // Find the instructions for the current language\n const instruction = xScalarSdkInstallation.find((instruction) => {\n const targetKey = selectedClient?.split('/')[0]?.toLowerCase()\n return instruction.lang.toLowerCase() === targetKey\n })\n\n // Nothing found?\n if (!instruction) {\n return undefined\n }\n\n // Got it!\n return instruction\n})\n\ndefineExpose({\n selectedClientOption,\n})\n</script>\n<template>\n <div\n v-if=\"clientOptions.length\"\n ref=\"wrapper-ref\">\n <TabGroup\n manual\n :selectedIndex=\"tabIndex\"\n @change=\"onTabSelect\">\n <div\n :id=\"headingId\"\n class=\"client-libraries-heading\">\n Client Libraries\n </div>\n\n <!-- Tabs -->\n <TabList\n :aria-labelledby=\"headingId\"\n class=\"client-libraries-list\">\n <ClientDropdown\n :clientOptions\n :eventBus\n :featuredClients\n :morePanel\n :selectedClient />\n </TabList>\n\n <!-- Content -->\n <TabPanels>\n <template\n v-if=\"\n installationInstructions?.source ||\n installationInstructions?.description\n \">\n <div\n v-if=\"installationInstructions.description\"\n class=\"selected-client card-footer -outline-offset-2\"\n :class=\"installationInstructions.source && 'rounded-b-none'\"\n role=\"tabpanel\"\n tabindex=\"0\">\n <ScalarMarkdown :value=\"installationInstructions.description\" />\n </div>\n <div\n v-if=\"installationInstructions.source\"\n class=\"selected-client card-footer border-t-0 p-0\"\n role=\"tabpanel\"\n tabindex=\"1\">\n <ScalarCodeBlock\n class=\"rounded-b-lg *:first:p-3\"\n :content=\"installationInstructions.source\"\n copy=\"always\"\n lang=\"shell\" />\n </div>\n </template>\n <template v-else-if=\"isFeaturedClient(selectedClient)\">\n <TabPanel\n v-for=\"client in featuredClients\"\n :key=\"client.id\"\n class=\"selected-client card-footer -outline-offset-2\">\n {{ client.title }}\n </TabPanel>\n </template>\n <div\n v-else\n :id=\"morePanel\"\n class=\"selected-client card-footer -outline-offset-2\"\n role=\"tabpanel\"\n tabindex=\"0\">\n {{ selectedClientOption?.title }}\n </div>\n </TabPanels>\n </TabGroup>\n </div>\n</template>\n<style scoped>\n.selected-client {\n color: var(--scalar-color-1);\n font-size: var(--scalar-small);\n font-family: var(--scalar-font-code);\n padding: 9px 12px;\n border-top: none;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n background: var(--scalar-background-1);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-bottom-left-radius: var(--scalar-radius-xl);\n border-bottom-right-radius: var(--scalar-radius-xl);\n min-height: fit-content;\n}\n.client-libraries-heading {\n font-size: var(--scalar-small);\n font-weight: var(--scalar-font-medium);\n color: var(--scalar-color-1);\n padding: 9px 12px;\n background-color: var(--scalar-background-2);\n display: flex;\n align-items: center;\n max-height: 32px;\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-top-left-radius: var(--scalar-radius-xl);\n border-top-right-radius: var(--scalar-radius-xl);\n}\n:deep(.scalar-codeblock-pre .hljs) {\n margin-top: 8px;\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"ClientSelector.vue.js","names":[],"sources":["../../../../src/blocks/scalar-client-selector-block/components/ClientSelector.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { TabGroup, TabList, TabPanel, TabPanels } from '@headlessui/vue'\nimport {\n DEFAULT_CLIENT,\n type ClientOptionGroup,\n} from '@scalar/api-client/blocks/operation-code-sample'\nimport { type WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { computed, ref, useId, useTemplateRef, watch } from 'vue'\n\nimport {\n getFeaturedClients,\n isFeaturedClient,\n} from '@/blocks/scalar-client-selector-block/helpers/featured-clients'\n\nimport ClientDropdown from './ClientDropdown.vue'\n\nconst {\n clientOptions,\n eventBus,\n selectedClient = DEFAULT_CLIENT,\n} = defineProps<{\n /** Computed list of all available Http Client options */\n clientOptions: ClientOptionGroup[]\n /** The currently selected Http Client (a built-in client id or a custom sample id) */\n selectedClient?: string\n /** Event bus */\n eventBus: WorkspaceEventBus\n}>()\n\nconst headingId = useId()\nconst morePanel = useId()\n\n/**\n * Whether a selection is a custom code sample (e.g. `custom/python`) rather than\n * a built-in client. Custom samples are matched by the `custom/` id prefix, which\n * mirrors the `^custom/` pattern enforced on the stored default client.\n */\nconst isCustomSelection = (client: string | undefined) =>\n Boolean(client?.startsWith('custom/'))\n\n/**\n * The generic client this selector actually displays.\n *\n * The introduction selector only represents the built-in HTTP clients. Custom\n * code samples are operation-specific and \"always just have the generic\n * clients\", so when one is selected globally we keep showing the last generic\n * client here instead of switching to (and failing to render) a custom sample.\n */\nconst activeClient = ref(\n isCustomSelection(selectedClient) ? DEFAULT_CLIENT : selectedClient,\n)\n\nwatch(\n () => selectedClient,\n (newClient) => {\n if (!isCustomSelection(newClient)) {\n activeClient.value = newClient\n }\n },\n)\n\n/** Grab the option for the currently selected Http Client */\nconst selectedClientOption = computed(\n () =>\n clientOptions.flatMap(\n (optionGroup) =>\n optionGroup.options.find(\n (option) => option.id === activeClient.value,\n ) ?? [],\n )[0],\n)\n\n/** List of featured clients */\nconst featuredClients = computed(() => getFeaturedClients(clientOptions))\n\n/** Currently selected tab index */\nconst tabIndex = computed(() =>\n featuredClients.value.findIndex(\n (featuredClient) => activeClient.value === featuredClient.id,\n ),\n)\n\nconst wrapper = useTemplateRef('wrapper-ref')\n\n/** Emit the selected client event on tab */\nconst onTabSelect = (i: number) => {\n const client = featuredClients.value[i]\n\n if (!client || !wrapper.value) {\n return\n }\n\n eventBus.emit('workspace:update:selected-client', client.id)\n}\n\ndefineExpose({\n selectedClientOption,\n})\n</script>\n<template>\n <div\n v-if=\"clientOptions.length\"\n ref=\"wrapper-ref\">\n <TabGroup\n manual\n :selectedIndex=\"tabIndex\"\n @change=\"onTabSelect\">\n <div\n :id=\"headingId\"\n class=\"client-libraries-heading\">\n Client Libraries\n </div>\n\n <!-- Tabs -->\n <TabList\n :aria-labelledby=\"headingId\"\n class=\"client-libraries-list\">\n <ClientDropdown\n :clientOptions\n :eventBus\n :featuredClients\n :morePanel\n :selectedClient=\"activeClient\" />\n </TabList>\n\n <!-- Content -->\n <TabPanels>\n <template v-if=\"isFeaturedClient(activeClient)\">\n <TabPanel\n v-for=\"client in featuredClients\"\n :key=\"client.id\"\n class=\"selected-client card-footer -outline-offset-2\">\n {{ client.title }}\n </TabPanel>\n </template>\n <div\n v-else\n :id=\"morePanel\"\n class=\"selected-client card-footer -outline-offset-2\"\n role=\"tabpanel\"\n tabindex=\"0\">\n {{ selectedClientOption?.title }}\n </div>\n </TabPanels>\n </TabGroup>\n </div>\n</template>\n<style scoped>\n.selected-client {\n color: var(--scalar-color-1);\n font-size: var(--scalar-small);\n font-family: var(--scalar-font-code);\n padding: 9px 12px;\n border-top: none;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n background: var(--scalar-background-1);\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-bottom-left-radius: var(--scalar-radius-xl);\n border-bottom-right-radius: var(--scalar-radius-xl);\n min-height: fit-content;\n}\n.client-libraries-heading {\n font-size: var(--scalar-small);\n font-weight: var(--scalar-font-medium);\n color: var(--scalar-color-1);\n padding: 9px 12px;\n background-color: var(--scalar-background-2);\n display: flex;\n align-items: center;\n max-height: 32px;\n border: var(--scalar-border-width) solid var(--scalar-border-color);\n border-top-left-radius: var(--scalar-radius-xl);\n border-top-right-radius: var(--scalar-radius-xl);\n}\n</style>\n"],"mappings":""}