@scalar/api-client 3.19.3 → 3.21.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 (433) hide show
  1. package/CHANGELOG.md +79 -0
  2. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
  3. package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
  4. package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
  5. package/dist/components/HttpMethod/HttpMethod.vue.js.map +1 -1
  6. package/dist/components/HttpMethod/HttpMethod.vue.script.js +15 -7
  7. package/dist/components/HttpMethod/HttpMethod.vue.script.js.map +1 -1
  8. package/dist/components/SectionFilter.vue.d.ts +2 -0
  9. package/dist/components/SectionFilter.vue.d.ts.map +1 -1
  10. package/dist/components/SectionFilter.vue.js +1 -1
  11. package/dist/components/SectionFilter.vue.js.map +1 -1
  12. package/dist/components/SectionFilter.vue.script.js +11 -8
  13. package/dist/components/SectionFilter.vue.script.js.map +1 -1
  14. package/dist/components/Server/ServerVariablesSelect.vue.d.ts.map +1 -1
  15. package/dist/components/Server/ServerVariablesSelect.vue.js.map +1 -1
  16. package/dist/components/Server/ServerVariablesSelect.vue.script.js +5 -3
  17. package/dist/components/Server/ServerVariablesSelect.vue.script.js.map +1 -1
  18. package/dist/components/Server/ServerVariablesTextbox.vue.d.ts.map +1 -1
  19. package/dist/components/Server/ServerVariablesTextbox.vue.js.map +1 -1
  20. package/dist/components/Server/ServerVariablesTextbox.vue.script.js +6 -3
  21. package/dist/components/Server/ServerVariablesTextbox.vue.script.js.map +1 -1
  22. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts.map +1 -1
  23. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js.map +1 -1
  24. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js +4 -2
  25. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js.map +1 -1
  26. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  27. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js.map +1 -1
  28. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js +3 -1
  29. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js.map +1 -1
  30. package/dist/style.css +164 -141
  31. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +3 -2
  32. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  33. package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
  34. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +16 -3
  35. package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
  36. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -2
  37. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  38. package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
  39. package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
  40. package/dist/v2/blocks/operation-block/components/Header.vue.script.js +10 -6
  41. package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
  42. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.d.ts.map +1 -1
  43. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js +1 -1
  44. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js.map +1 -1
  45. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js +6 -3
  46. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js.map +1 -1
  47. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts +1 -2
  48. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts.map +1 -1
  49. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.js.map +1 -1
  50. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -2
  51. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  52. package/dist/v2/blocks/operation-block/helpers/send-request.js +4 -3
  53. package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
  54. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +3 -2
  55. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  56. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  57. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  58. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +59 -26
  59. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  60. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  61. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  62. package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
  63. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +28 -8
  64. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  65. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.d.ts.map +1 -1
  66. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.js.map +1 -1
  67. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js +9 -3
  68. package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js.map +1 -1
  69. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.d.ts.map +1 -1
  70. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.js.map +1 -1
  71. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js +6 -4
  72. package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js.map +1 -1
  73. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  74. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
  75. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +13 -4
  76. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  77. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts +2 -0
  78. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  79. package/dist/v2/blocks/request-block/components/RequestParams.vue.js.map +1 -1
  80. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js +14 -7
  81. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js.map +1 -1
  82. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +6 -6
  83. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  84. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  85. package/dist/v2/blocks/request-block/components/RequestTable.vue.js.map +1 -1
  86. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js +40 -7
  87. package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js.map +1 -1
  88. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +16 -16
  89. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  90. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  91. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +24 -20
  92. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  93. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
  94. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js.map +1 -1
  95. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js +6 -4
  96. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js.map +1 -1
  97. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.d.ts.map +1 -1
  98. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js +14 -6
  99. package/dist/v2/blocks/request-block/helpers/create-parameter-rows.js.map +1 -1
  100. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
  101. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +5 -4
  102. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
  103. package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
  104. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  105. package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
  106. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +34 -13
  107. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
  108. package/dist/v2/blocks/response-block/components/Headers.vue.d.ts +3 -3
  109. package/dist/v2/blocks/response-block/components/Headers.vue.d.ts.map +1 -1
  110. package/dist/v2/blocks/response-block/components/Headers.vue.js.map +1 -1
  111. package/dist/v2/blocks/response-block/components/Headers.vue.script.js +5 -3
  112. package/dist/v2/blocks/response-block/components/Headers.vue.script.js.map +1 -1
  113. package/dist/v2/blocks/response-block/components/ResponseBody.vue.d.ts.map +1 -1
  114. package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +1 -1
  115. package/dist/v2/blocks/response-block/components/ResponseBody.vue.js.map +1 -1
  116. package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js +3 -1
  117. package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js.map +1 -1
  118. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.d.ts.map +1 -1
  119. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.js.map +1 -1
  120. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js +11 -3
  121. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js.map +1 -1
  122. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts.map +1 -1
  123. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js +1 -1
  124. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js.map +1 -1
  125. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js +8 -6
  126. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js.map +1 -1
  127. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts +1 -0
  128. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
  129. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js.map +1 -1
  130. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js +109 -56
  131. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js.map +1 -1
  132. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.d.ts.map +1 -1
  133. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.js.map +1 -1
  134. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js +5 -3
  135. package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js.map +1 -1
  136. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.d.ts.map +1 -1
  137. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.js.map +1 -1
  138. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js +6 -3
  139. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js.map +1 -1
  140. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.d.ts.map +1 -1
  141. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js.map +1 -1
  142. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js +7 -5
  143. package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js.map +1 -1
  144. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +2 -2
  145. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
  146. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
  147. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js.map +1 -1
  148. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js +20 -15
  149. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js.map +1 -1
  150. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
  151. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +1 -1
  152. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js.map +1 -1
  153. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js +4 -2
  154. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js.map +1 -1
  155. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.d.ts.map +1 -1
  156. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.js.map +1 -1
  157. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js +11 -6
  158. package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js.map +1 -1
  159. package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts +4 -0
  160. package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts.map +1 -0
  161. package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js +100 -0
  162. package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js.map +1 -0
  163. package/dist/v2/blocks/response-block/helpers/response-stream.d.ts +13 -0
  164. package/dist/v2/blocks/response-block/helpers/response-stream.d.ts.map +1 -0
  165. package/dist/v2/blocks/response-block/helpers/response-stream.js +97 -0
  166. package/dist/v2/blocks/response-block/helpers/response-stream.js.map +1 -0
  167. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +2 -3
  168. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  169. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  170. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
  171. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +41 -29
  172. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  173. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +6 -7
  174. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
  175. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
  176. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js.map +1 -1
  177. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +7 -4
  178. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
  179. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
  180. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js.map +1 -1
  181. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +21 -16
  182. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
  183. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  184. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
  185. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +7 -5
  186. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  187. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -1
  188. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js.map +1 -1
  189. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js +7 -5
  190. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js.map +1 -1
  191. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  192. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
  193. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +105 -40
  194. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  195. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
  196. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.js.map +1 -1
  197. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js +10 -8
  198. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js.map +1 -1
  199. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
  200. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js.map +1 -1
  201. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js +20 -14
  202. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map +1 -1
  203. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -1
  204. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js.map +1 -1
  205. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js +6 -4
  206. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map +1 -1
  207. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
  208. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map +1 -1
  209. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js +3 -1
  210. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -1
  211. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  212. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js.map +1 -1
  213. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +40 -40
  214. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
  215. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts +108 -7
  216. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts.map +1 -1
  217. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +12 -0
  218. package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js.map +1 -1
  219. package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
  220. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.d.ts.map +1 -1
  221. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js +8 -5
  222. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js.map +1 -1
  223. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +2 -0
  224. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -1
  225. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +2 -0
  226. package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js.map +1 -1
  227. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts +3 -0
  228. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts.map +1 -0
  229. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js +8 -0
  230. package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js.map +1 -0
  231. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts +3 -0
  232. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts.map +1 -0
  233. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js +11 -0
  234. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js.map +1 -0
  235. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts +19 -0
  236. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts.map +1 -0
  237. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js +117 -0
  238. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js.map +1 -0
  239. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -1
  240. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  241. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +15 -11
  242. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
  243. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts +1 -1
  244. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts.map +1 -1
  245. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js +8 -1
  246. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js.map +1 -1
  247. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -1
  248. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +6 -0
  249. package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js.map +1 -1
  250. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -1
  251. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  252. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +8 -6
  253. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
  254. package/dist/v2/components/code-input/CodeInput.vue.d.ts +4 -4
  255. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  256. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  257. package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
  258. package/dist/v2/components/code-input/CodeInput.vue.script.js +10 -10
  259. package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
  260. package/dist/v2/components/code-input/CodeInputLite.vue.d.ts +4 -4
  261. package/dist/v2/components/code-input/CodeInputLite.vue.d.ts.map +1 -1
  262. package/dist/v2/components/code-input/CodeInputLite.vue.js +1 -1
  263. package/dist/v2/components/code-input/CodeInputLite.vue.js.map +1 -1
  264. package/dist/v2/components/code-input/CodeInputLite.vue.script.js +8 -5
  265. package/dist/v2/components/code-input/CodeInputLite.vue.script.js.map +1 -1
  266. package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts +4 -0
  267. package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts.map +1 -1
  268. package/dist/v2/components/code-input/PillTooltipHost.vue.js.map +1 -1
  269. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js +7 -3
  270. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js.map +1 -1
  271. package/dist/v2/components/code-input/code-variable-widget.d.ts +3 -0
  272. package/dist/v2/components/code-input/code-variable-widget.d.ts.map +1 -1
  273. package/dist/v2/components/code-input/code-variable-widget.js +6 -3
  274. package/dist/v2/components/code-input/code-variable-widget.js.map +1 -1
  275. package/dist/v2/components/data-table/DataTable.vue.d.ts.map +1 -1
  276. package/dist/v2/components/data-table/DataTable.vue.js.map +1 -1
  277. package/dist/v2/components/data-table/DataTable.vue.script.js +2 -1
  278. package/dist/v2/components/data-table/DataTable.vue.script.js.map +1 -1
  279. package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts +0 -1
  280. package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts.map +1 -1
  281. package/dist/v2/components/data-table/DataTableCheckbox.vue.js.map +1 -1
  282. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js +4 -2
  283. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js.map +1 -1
  284. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  285. package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
  286. package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
  287. package/dist/v2/components/data-table/DataTableInput.vue.script.js +5 -3
  288. package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
  289. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
  290. package/dist/v2/components/data-table/DataTableInputSelect.vue.js.map +1 -1
  291. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js +12 -9
  292. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js.map +1 -1
  293. package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -1
  294. package/dist/v2/components/forms/ConfirmationForm.vue.js.map +1 -1
  295. package/dist/v2/components/forms/ConfirmationForm.vue.script.js +5 -3
  296. package/dist/v2/components/forms/ConfirmationForm.vue.script.js.map +1 -1
  297. package/dist/v2/components/layout/CollapsibleSection.vue.d.ts.map +1 -1
  298. package/dist/v2/components/layout/CollapsibleSection.vue.js.map +1 -1
  299. package/dist/v2/components/layout/CollapsibleSection.vue.script.js +3 -1
  300. package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
  301. package/dist/v2/components/modals/DeleteModal.vue.d.ts.map +1 -1
  302. package/dist/v2/components/modals/DeleteModal.vue.js.map +1 -1
  303. package/dist/v2/components/modals/DeleteModal.vue.script.js +3 -1
  304. package/dist/v2/components/modals/DeleteModal.vue.script.js.map +1 -1
  305. package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
  306. package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
  307. package/dist/v2/components/modals/ModalClientContainer.vue.js.map +1 -1
  308. package/dist/v2/components/modals/ModalClientContainer.vue.script.js +5 -2
  309. package/dist/v2/components/modals/ModalClientContainer.vue.script.js.map +1 -1
  310. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
  311. package/dist/v2/components/server/ServerDropdown.vue.js.map +1 -1
  312. package/dist/v2/components/server/ServerDropdown.vue.script.js +9 -5
  313. package/dist/v2/components/server/ServerDropdown.vue.script.js.map +1 -1
  314. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  315. package/dist/v2/components/sidebar/Sidebar.vue.js.map +1 -1
  316. package/dist/v2/components/sidebar/Sidebar.vue.script.js +4 -2
  317. package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
  318. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  319. package/dist/v2/components/sidebar/SidebarMenu.vue.js.map +1 -1
  320. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js +4 -2
  321. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js.map +1 -1
  322. package/dist/v2/components/sidebar/SidebarToggle.vue.d.ts.map +1 -1
  323. package/dist/v2/components/sidebar/SidebarToggle.vue.js.map +1 -1
  324. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js +4 -2
  325. package/dist/v2/components/sidebar/SidebarToggle.vue.script.js.map +1 -1
  326. package/dist/v2/constants.js +1 -1
  327. package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -1
  328. package/dist/v2/features/command-palette/components/CommandActionForm.vue.js.map +1 -1
  329. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js +4 -2
  330. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js.map +1 -1
  331. package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +2 -2
  332. package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
  333. package/dist/v2/features/environments/EnvironmentsList.vue.js.map +1 -1
  334. package/dist/v2/features/environments/EnvironmentsList.vue.script.js +4 -2
  335. package/dist/v2/features/environments/EnvironmentsList.vue.script.js.map +1 -1
  336. package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
  337. package/dist/v2/features/environments/components/Environment.vue.js.map +1 -1
  338. package/dist/v2/features/environments/components/Environment.vue.script.js +12 -10
  339. package/dist/v2/features/environments/components/Environment.vue.script.js.map +1 -1
  340. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.d.ts.map +1 -1
  341. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.js.map +1 -1
  342. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js +5 -3
  343. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js.map +1 -1
  344. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts.map +1 -1
  345. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.js.map +1 -1
  346. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js +9 -6
  347. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js.map +1 -1
  348. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
  349. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
  350. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +6 -4
  351. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
  352. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.d.ts.map +1 -1
  353. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +1 -1
  354. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js.map +1 -1
  355. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js +22 -10
  356. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js.map +1 -1
  357. package/dist/v2/features/localization/index.d.ts +18 -0
  358. package/dist/v2/features/localization/index.d.ts.map +1 -0
  359. package/dist/v2/features/localization/index.js +35 -0
  360. package/dist/v2/features/localization/index.js.map +1 -0
  361. package/dist/v2/features/localization/locales/ar.d.ts +389 -0
  362. package/dist/v2/features/localization/locales/ar.d.ts.map +1 -0
  363. package/dist/v2/features/localization/locales/ar.js +351 -0
  364. package/dist/v2/features/localization/locales/ar.js.map +1 -0
  365. package/dist/v2/features/localization/locales/de.d.ts +389 -0
  366. package/dist/v2/features/localization/locales/de.d.ts.map +1 -0
  367. package/dist/v2/features/localization/locales/de.js +351 -0
  368. package/dist/v2/features/localization/locales/de.js.map +1 -0
  369. package/dist/v2/features/localization/locales/es.d.ts +389 -0
  370. package/dist/v2/features/localization/locales/es.d.ts.map +1 -0
  371. package/dist/v2/features/localization/locales/es.js +351 -0
  372. package/dist/v2/features/localization/locales/es.js.map +1 -0
  373. package/dist/v2/features/localization/locales/fr.d.ts +389 -0
  374. package/dist/v2/features/localization/locales/fr.d.ts.map +1 -0
  375. package/dist/v2/features/localization/locales/fr.js +351 -0
  376. package/dist/v2/features/localization/locales/fr.js.map +1 -0
  377. package/dist/v2/features/localization/locales/pt.d.ts +389 -0
  378. package/dist/v2/features/localization/locales/pt.d.ts.map +1 -0
  379. package/dist/v2/features/localization/locales/pt.js +351 -0
  380. package/dist/v2/features/localization/locales/pt.js.map +1 -0
  381. package/dist/v2/features/localization/locales/ru.d.ts +389 -0
  382. package/dist/v2/features/localization/locales/ru.d.ts.map +1 -0
  383. package/dist/v2/features/localization/locales/ru.js +351 -0
  384. package/dist/v2/features/localization/locales/ru.js.map +1 -0
  385. package/dist/v2/features/localization/locales/zh-cn.d.ts +389 -0
  386. package/dist/v2/features/localization/locales/zh-cn.d.ts.map +1 -0
  387. package/dist/v2/features/localization/locales/zh-cn.js +351 -0
  388. package/dist/v2/features/localization/locales/zh-cn.js.map +1 -0
  389. package/dist/v2/features/localization/translations.d.ts +389 -0
  390. package/dist/v2/features/localization/translations.d.ts.map +1 -0
  391. package/dist/v2/features/localization/translations.js +351 -0
  392. package/dist/v2/features/localization/translations.js.map +1 -0
  393. package/dist/v2/features/modal/Modal.vue.d.ts +1 -2
  394. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  395. package/dist/v2/features/modal/Modal.vue.js.map +1 -1
  396. package/dist/v2/features/modal/Modal.vue.script.js +15 -4
  397. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  398. package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts +2 -3
  399. package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts.map +1 -1
  400. package/dist/v2/features/modal/helpers/resolve-route-parameters.js +8 -7
  401. package/dist/v2/features/modal/helpers/resolve-route-parameters.js.map +1 -1
  402. package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts +2 -3
  403. package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts.map +1 -1
  404. package/dist/v2/features/modal/hooks/use-modal-sidebar.js.map +1 -1
  405. package/dist/v2/features/modal/use-lazy-api-client.d.ts +11 -0
  406. package/dist/v2/features/modal/use-lazy-api-client.d.ts.map +1 -0
  407. package/dist/v2/features/modal/use-lazy-api-client.js +48 -0
  408. package/dist/v2/features/modal/use-lazy-api-client.js.map +1 -0
  409. package/dist/v2/features/operation/Operation.vue.d.ts +1 -2
  410. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  411. package/dist/v2/features/operation/Operation.vue.js.map +1 -1
  412. package/dist/v2/features/operation/Operation.vue.script.js +22 -6
  413. package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
  414. package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -1
  415. package/dist/v2/features/search/components/DocumentSearchModal.vue.js +1 -1
  416. package/dist/v2/features/search/components/DocumentSearchModal.vue.js.map +1 -1
  417. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +12 -8
  418. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -1
  419. package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -1
  420. package/dist/v2/features/search/components/SearchResult.vue.js.map +1 -1
  421. package/dist/v2/features/search/components/SearchResult.vue.script.js +14 -10
  422. package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -1
  423. package/dist/v2/helpers/generate-location-id.d.ts +1 -2
  424. package/dist/v2/helpers/generate-location-id.d.ts.map +1 -1
  425. package/dist/v2/helpers/generate-location-id.js.map +1 -1
  426. package/dist/v2/types/options.d.ts +1 -1
  427. package/dist/v2/types/options.d.ts.map +1 -1
  428. package/dist/v2/workspace-events.d.ts +2 -2
  429. package/dist/v2/workspace-events.d.ts.map +1 -1
  430. package/dist/v2/workspace-events.js +8 -1
  431. package/dist/v2/workspace-events.js.map +1 -1
  432. package/dist/vue-styles.css +128 -129
  433. package/package.json +22 -11
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-route-parameters.js","names":[],"sources":["../../../../../src/v2/features/modal/helpers/resolve-route-parameters.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { getResolvedPathItem } from '@scalar/workspace-store/helpers/for-each-path-item-operation'\nimport { getOperationEntries } from '@scalar/workspace-store/navigation'\nimport type { TraversedEntry, TraversedExample } from '@scalar/workspace-store/schemas/navigation'\nimport { isOpenApiDocument } from '@scalar/workspace-store/schemas/type-guards'\n\n/**\n * Payload for routing and opening the API client modal.\n *\n * `path` and `method` are optional so a caller can update `documentSlug` on its own.\n * `route()` fills in whichever fields are missing from its \"default\" placeholders, which\n * resolve to the document's first operation instead of a route that does not exist.\n */\nexport type RoutePayload = {\n /** API path, or webhook name when `isWebhook` is true. */\n path?: string\n method?: HttpMethod\n example?: string\n documentSlug?: string\n /** Resolve `path` from the OpenAPI webhooks map. */\n isWebhook?: boolean\n}\n\n/** Raw input values that may contain \"default\" placeholders. */\nexport type DefaultEntities = {\n path: string\n method: string\n example: string\n documentSlug: string\n isWebhook?: boolean\n}\n\n/** Context for resolving route parameters from the workspace store. */\ntype ResolverContext = {\n store: WorkspaceStore\n documentSlug: string | undefined\n}\n\n/** Type guard to check if an entry is an example. */\nconst isExample = (entry: TraversedEntry): entry is TraversedExample => entry.type === 'example'\n\n/**\n * Gets the document from the workspace store.\n * Returns undefined if the document slug is not provided or the document does not exist.\n * Modal routing is OpenAPI-only — AsyncAPI docs surface as undefined here.\n */\nconst getDocument = (ctx: ResolverContext) => {\n const doc = ctx.store.workspace.documents[ctx.documentSlug ?? '']\n return isOpenApiDocument(doc) ? doc : undefined\n}\n\n/**\n * Resolves the document slug from a raw input value.\n *\n * When \"default\" is specified and no document exists with that slug,\n * we fall back to the active document or the first available document.\n * Modal routing is OpenAPI-only, so the fallback skips AsyncAPI documents —\n * otherwise opening the modal with default params on a workspace that has\n * an AsyncAPI active or first document would hand a slug back that\n * `getDocument` then resolves to undefined, rendering the modal with\n * `document: null` even when OpenAPI documents exist.\n */\nexport const resolveDocumentSlug = (store: WorkspaceStore, slug: string | undefined): string | undefined => {\n const hasMatchingDocument = slug !== 'default' || store.workspace.documents[slug] !== undefined\n\n if (hasMatchingDocument) {\n return slug\n }\n\n // Prefer the active document when it is OpenAPI; otherwise pick the first\n // OpenAPI document in the workspace.\n const activeSlug = store.workspace['x-scalar-active-document']\n if (activeSlug && isOpenApiDocument(store.workspace.documents[activeSlug])) {\n return activeSlug\n }\n\n return Object.entries(store.workspace.documents).find(([, document]) => isOpenApiDocument(document))?.[0]\n}\n\n/**\n * Resolves the path from a raw input value.\n *\n * When \"default\" is specified, returns the first available path in the document.\n * This is useful for initial navigation when no specific path is requested.\n */\nexport const resolvePath = (ctx: ResolverContext, path: string | undefined, isWebhook = false): string | undefined => {\n const document = getDocument(ctx)\n\n if (!document) {\n return undefined\n }\n\n if (path === 'default') {\n return Object.keys(isWebhook ? (document.webhooks ?? {}) : (document.paths ?? {}))[0]\n }\n\n return path\n}\n\n/**\n * Resolves the HTTP method from a raw input value.\n *\n * When \"default\" is specified, returns the first valid HTTP method for the given path.\n * This ensures we select a real method rather than metadata keys like \"parameters\" or \"summary\".\n */\nexport const resolveMethod = (\n ctx: ResolverContext,\n path: string | undefined,\n method: string | undefined,\n isWebhook = false,\n): HttpMethod | undefined => {\n const document = getDocument(ctx)\n\n if (!document || !path) {\n return undefined\n }\n\n if (method === 'default') {\n const pathItem = getResolvedPathItem(isWebhook ? document.webhooks?.[path] : document.paths?.[path])\n if (!pathItem) {\n return undefined\n }\n const pathMethods = Object.keys(pathItem).filter(isHttpMethod)\n return pathMethods[0]\n }\n\n return isHttpMethod(method) ? method : undefined\n}\n\n/**\n * Resolves the example name from a raw input value.\n *\n * When \"default\" is specified, returns the first available example name.\n * Falls back to \"default\" when no examples exist, which signals to use the default request body.\n */\nexport const resolveExampleName = (\n ctx: ResolverContext,\n operation: TraversedEntry | undefined,\n exampleKey: string | undefined,\n): string => {\n const document = getDocument(ctx)\n\n if (!document || operation?.type !== 'operation') {\n return 'default'\n }\n\n const examples = operation.children?.filter(isExample) ?? []\n const matchingExample = examples.find((child) => child.name === exampleKey)\n\n if (matchingExample) {\n return matchingExample.name\n }\n\n if (exampleKey === 'default') {\n return examples[0]?.name ?? 'default'\n }\n\n return 'default'\n}\n\n/**\n * Resolves all route parameters from raw input values to their actual values.\n *\n * This function handles \"default\" placeholders by looking up actual values from the workspace store.\n * It ensures the modal can be opened even when the caller does not know specific paths, methods, or examples.\n */\nexport const resolveRouteParameters = (store: WorkspaceStore, params: DefaultEntities): Partial<RoutePayload> => {\n const documentSlug = resolveDocumentSlug(store, params.documentSlug)\n const ctx: ResolverContext = { store, documentSlug }\n const isWebhook = params.isWebhook ?? false\n\n const path = resolvePath(ctx, params.path, isWebhook)\n const method = resolveMethod(ctx, path, params.method, isWebhook)\n const routeType = isWebhook ? { isWebhook: true as const } : {}\n\n const traversedDocument = getDocument(ctx)?.['x-scalar-navigation']\n\n if (!traversedDocument) {\n return { documentSlug, path, method, example: 'default', ...routeType }\n }\n\n const operations = getOperationEntries(traversedDocument)\n const operation = operations\n .get(`${path}|${method}`)\n ?.find((entry) => entry.type === (isWebhook ? 'webhook' : 'operation'))\n const example = resolveExampleName(ctx, operation, params.example)\n\n return { documentSlug, path, method, example, ...routeType }\n}\n"],"mappings":";;;;;;AAyCA,IAAM,aAAa,UAAqD,MAAM,SAAS;;;;;;AAOvF,IAAM,eAAe,QAAyB;CAC5C,MAAM,MAAM,IAAI,MAAM,UAAU,UAAU,IAAI,gBAAgB;CAC9D,OAAO,kBAAkB,GAAG,IAAI,MAAM,KAAA;AACxC;;;;;;;;;;;;AAaA,IAAa,uBAAuB,OAAuB,SAAiD;CAG1G,IAF4B,SAAS,aAAa,MAAM,UAAU,UAAU,UAAU,KAAA,GAGpF,OAAO;CAKT,MAAM,aAAa,MAAM,UAAU;CACnC,IAAI,cAAc,kBAAkB,MAAM,UAAU,UAAU,WAAW,GACvE,OAAO;CAGT,OAAO,OAAO,QAAQ,MAAM,UAAU,SAAS,CAAC,CAAC,MAAM,GAAG,cAAc,kBAAkB,QAAQ,CAAC,CAAC,GAAG;AACzG;;;;;;;AAQA,IAAa,eAAe,KAAsB,MAA0B,YAAY,UAA8B;CACpH,MAAM,WAAW,YAAY,GAAG;CAEhC,IAAI,CAAC,UACH;CAGF,IAAI,SAAS,WACX,OAAO,OAAO,KAAK,YAAa,SAAS,YAAY,CAAC,IAAM,SAAS,SAAS,CAAC,CAAE,CAAC,CAAC;CAGrF,OAAO;AACT;;;;;;;AAQA,IAAa,iBACX,KACA,MACA,QACA,YAAY,UACe;CAC3B,MAAM,WAAW,YAAY,GAAG;CAEhC,IAAI,CAAC,YAAY,CAAC,MAChB;CAGF,IAAI,WAAW,WAAW;EACxB,MAAM,WAAW,oBAAoB,YAAY,SAAS,WAAW,QAAQ,SAAS,QAAQ,KAAK;EACnG,IAAI,CAAC,UACH;EAGF,OADoB,OAAO,KAAK,QAAQ,CAAC,CAAC,OAAO,YAC1C,CAAA,CAAY;CACrB;CAEA,OAAO,aAAa,MAAM,IAAI,SAAS,KAAA;AACzC;;;;;;;AAQA,IAAa,sBACX,KACA,WACA,eACW;CAGX,IAAI,CAFa,YAAY,GAExB,KAAY,WAAW,SAAS,aACnC,OAAO;CAGT,MAAM,WAAW,UAAU,UAAU,OAAO,SAAS,KAAK,CAAC;CAC3D,MAAM,kBAAkB,SAAS,MAAM,UAAU,MAAM,SAAS,UAAU;CAE1E,IAAI,iBACF,OAAO,gBAAgB;CAGzB,IAAI,eAAe,WACjB,OAAO,SAAS,EAAE,EAAE,QAAQ;CAG9B,OAAO;AACT;;;;;;;AAQA,IAAa,0BAA0B,OAAuB,WAAmD;CAC/G,MAAM,eAAe,oBAAoB,OAAO,OAAO,YAAY;CACnE,MAAM,MAAuB;EAAE;EAAO;CAAa;CACnD,MAAM,YAAY,OAAO,aAAa;CAEtC,MAAM,OAAO,YAAY,KAAK,OAAO,MAAM,SAAS;CACpD,MAAM,SAAS,cAAc,KAAK,MAAM,OAAO,QAAQ,SAAS;CAChE,MAAM,YAAY,YAAY,EAAE,WAAW,KAAc,IAAI,CAAC;CAE9D,MAAM,oBAAoB,YAAY,GAAG,CAAC,GAAG;CAE7C,IAAI,CAAC,mBACH,OAAO;EAAE;EAAc;EAAM;EAAQ,SAAS;EAAW,GAAG;CAAU;CAIxE,MAAM,YADa,oBAAoB,iBACrB,CAAA,CACf,IAAI,GAAG,KAAK,GAAG,QAAQ,CAAC,EACvB,MAAM,UAAU,MAAM,UAAU,YAAY,YAAY,YAAY;CAGxE,OAAO;EAAE;EAAc;EAAM;EAAQ,SAFrB,mBAAmB,KAAK,WAAW,OAAO,OAErB;EAAS,GAAG;CAAU;AAC7D"}
1
+ {"version":3,"file":"resolve-route-parameters.js","names":[],"sources":["../../../../../src/v2/features/modal/helpers/resolve-route-parameters.ts"],"sourcesContent":["import { isHttpMethod } from '@scalar/helpers/http/is-http-method'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport {\n forEachPathItemOperation,\n getPathItemOperation,\n} from '@scalar/workspace-store/helpers/for-each-path-item-operation'\nimport { getOperationEntries } from '@scalar/workspace-store/navigation'\nimport type { TraversedEntry, TraversedExample } from '@scalar/workspace-store/schemas/navigation'\nimport { isOpenApiDocument } from '@scalar/workspace-store/schemas/type-guards'\n\n/**\n * Payload for routing and opening the API client modal.\n *\n * `path` and `method` are optional so a caller can update `documentSlug` on its own.\n * `route()` fills in whichever fields are missing from its \"default\" placeholders, which\n * resolve to the document's first operation instead of a route that does not exist.\n */\nexport type RoutePayload = {\n /** API path, or webhook name when `isWebhook` is true. */\n path?: string\n method?: string\n example?: string\n documentSlug?: string\n /** Resolve `path` from the OpenAPI webhooks map. */\n isWebhook?: boolean\n}\n\n/** Raw input values that may contain \"default\" placeholders. */\nexport type DefaultEntities = {\n path: string\n method: string\n example: string\n documentSlug: string\n isWebhook?: boolean\n}\n\n/** Context for resolving route parameters from the workspace store. */\ntype ResolverContext = {\n store: WorkspaceStore\n documentSlug: string | undefined\n}\n\n/** Type guard to check if an entry is an example. */\nconst isExample = (entry: TraversedEntry): entry is TraversedExample => entry.type === 'example'\n\n/**\n * Gets the document from the workspace store.\n * Returns undefined if the document slug is not provided or the document does not exist.\n * Modal routing is OpenAPI-only — AsyncAPI docs surface as undefined here.\n */\nconst getDocument = (ctx: ResolverContext) => {\n const doc = ctx.store.workspace.documents[ctx.documentSlug ?? '']\n return isOpenApiDocument(doc) ? doc : undefined\n}\n\n/**\n * Resolves the document slug from a raw input value.\n *\n * When \"default\" is specified and no document exists with that slug,\n * we fall back to the active document or the first available document.\n * Modal routing is OpenAPI-only, so the fallback skips AsyncAPI documents —\n * otherwise opening the modal with default params on a workspace that has\n * an AsyncAPI active or first document would hand a slug back that\n * `getDocument` then resolves to undefined, rendering the modal with\n * `document: null` even when OpenAPI documents exist.\n */\nexport const resolveDocumentSlug = (store: WorkspaceStore, slug: string | undefined): string | undefined => {\n const hasMatchingDocument = slug !== 'default' || store.workspace.documents[slug] !== undefined\n\n if (hasMatchingDocument) {\n return slug\n }\n\n // Prefer the active document when it is OpenAPI; otherwise pick the first\n // OpenAPI document in the workspace.\n const activeSlug = store.workspace['x-scalar-active-document']\n if (activeSlug && isOpenApiDocument(store.workspace.documents[activeSlug])) {\n return activeSlug\n }\n\n return Object.entries(store.workspace.documents).find(([, document]) => isOpenApiDocument(document))?.[0]\n}\n\n/**\n * Resolves the path from a raw input value.\n *\n * When \"default\" is specified, returns the first available path in the document.\n * This is useful for initial navigation when no specific path is requested.\n */\nexport const resolvePath = (ctx: ResolverContext, path: string | undefined, isWebhook = false): string | undefined => {\n const document = getDocument(ctx)\n\n if (!document) {\n return undefined\n }\n\n if (path === 'default') {\n return Object.keys(isWebhook ? (document.webhooks ?? {}) : (document.paths ?? {}))[0]\n }\n\n return path\n}\n\n/**\n * Resolves the HTTP method from a raw input value.\n *\n * When \"default\" is specified, returns the first valid HTTP method for the given path.\n * This ensures we select a real method rather than metadata keys like \"parameters\" or \"summary\".\n */\nexport const resolveMethod = (\n ctx: ResolverContext,\n path: string | undefined,\n method: string | undefined,\n isWebhook = false,\n): string | undefined => {\n const document = getDocument(ctx)\n\n if (!document || !path) {\n return undefined\n }\n\n const pathItem = isWebhook ? document.webhooks?.[path] : document.paths?.[path]\n if (method === 'default' && !getPathItemOperation(pathItem, method)) {\n const methods: string[] = []\n forEachPathItemOperation(pathItem, (method) => methods.push(method))\n return methods[0]\n }\n\n return method && (isHttpMethod(method) || getPathItemOperation(pathItem, method)) ? method : undefined\n}\n\n/**\n * Resolves the example name from a raw input value.\n *\n * When \"default\" is specified, returns the first available example name.\n * Falls back to \"default\" when no examples exist, which signals to use the default request body.\n */\nexport const resolveExampleName = (\n ctx: ResolverContext,\n operation: TraversedEntry | undefined,\n exampleKey: string | undefined,\n): string => {\n const document = getDocument(ctx)\n\n if (!document || operation?.type !== 'operation') {\n return 'default'\n }\n\n const examples = operation.children?.filter(isExample) ?? []\n const matchingExample = examples.find((child) => child.name === exampleKey)\n\n if (matchingExample) {\n return matchingExample.name\n }\n\n if (exampleKey === 'default') {\n return examples[0]?.name ?? 'default'\n }\n\n return 'default'\n}\n\n/**\n * Resolves all route parameters from raw input values to their actual values.\n *\n * This function handles \"default\" placeholders by looking up actual values from the workspace store.\n * It ensures the modal can be opened even when the caller does not know specific paths, methods, or examples.\n */\nexport const resolveRouteParameters = (store: WorkspaceStore, params: DefaultEntities): Partial<RoutePayload> => {\n const documentSlug = resolveDocumentSlug(store, params.documentSlug)\n const ctx: ResolverContext = { store, documentSlug }\n const isWebhook = params.isWebhook ?? false\n\n const path = resolvePath(ctx, params.path, isWebhook)\n const method = resolveMethod(ctx, path, params.method, isWebhook)\n const routeType = isWebhook ? { isWebhook: true as const } : {}\n\n const traversedDocument = getDocument(ctx)?.['x-scalar-navigation']\n\n if (!traversedDocument) {\n return { documentSlug, path, method, example: 'default', ...routeType }\n }\n\n const operations = getOperationEntries(traversedDocument)\n const operation = operations\n .get(`${path}|${method}`)\n ?.find((entry) => entry.type === (isWebhook ? 'webhook' : 'operation'))\n const example = resolveExampleName(ctx, operation, params.example)\n\n return { documentSlug, path, method, example, ...routeType }\n}\n"],"mappings":";;;;;;AA2CA,IAAM,aAAa,UAAqD,MAAM,SAAS;;;;;;AAOvF,IAAM,eAAe,QAAyB;CAC5C,MAAM,MAAM,IAAI,MAAM,UAAU,UAAU,IAAI,gBAAgB;CAC9D,OAAO,kBAAkB,GAAG,IAAI,MAAM,KAAA;AACxC;;;;;;;;;;;;AAaA,IAAa,uBAAuB,OAAuB,SAAiD;CAG1G,IAF4B,SAAS,aAAa,MAAM,UAAU,UAAU,UAAU,KAAA,GAGpF,OAAO;CAKT,MAAM,aAAa,MAAM,UAAU;CACnC,IAAI,cAAc,kBAAkB,MAAM,UAAU,UAAU,WAAW,GACvE,OAAO;CAGT,OAAO,OAAO,QAAQ,MAAM,UAAU,SAAS,CAAC,CAAC,MAAM,GAAG,cAAc,kBAAkB,QAAQ,CAAC,CAAC,GAAG;AACzG;;;;;;;AAQ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AAY,YAAY,EAAE,WAAW,KAAc,IAAI,CAAC;CAE9D,MAAM,oBAAoB,YAAY,GAAG,CAAC,GAAG;CAE7C,IAAI,CAAC,mBACH,OAAO;EAAE;EAAc;EAAM;EAAQ,SAAS;EAAW,GAAG;CAAU;CAIxE,MAAM,YADa,oBAAoB,iBACrB,CAAA,CACf,IAAI,GAAG,KAAK,GAAG,QAAQ,CAAC,EACvB,MAAM,UAAU,MAAM,UAAU,YAAY,YAAY,YAAY;CAGxE,OAAO;EAAE;EAAc;EAAM;EAAQ,SAFrB,mBAAmB,KAAK,WAAW,OAAO,OAErB;EAAS,GAAG;CAAU;AAC7D"}
@@ -1,4 +1,3 @@
1
- import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
1
  import { createSidebarState } from '@scalar/sidebar';
3
2
  import type { WorkspaceStore } from '@scalar/workspace-store/client';
4
3
  import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
@@ -10,7 +9,7 @@ export type UseModalSidebarReturn = {
10
9
  getEntryByLocation: (location: {
11
10
  document: string;
12
11
  path?: string;
13
- method?: HttpMethod;
12
+ method?: string;
14
13
  example?: string;
15
14
  isWebhook?: boolean;
16
15
  }) => TraversedEntry | undefined;
@@ -36,7 +35,7 @@ export declare const useModalSidebar: ({ workspaceStore, documentSlug, path, met
36
35
  workspaceStore: WorkspaceStore | null;
37
36
  documentSlug: ComputedRef<string | undefined>;
38
37
  path: ComputedRef<string | undefined>;
39
- method: ComputedRef<HttpMethod | undefined>;
38
+ method: ComputedRef<string | undefined>;
40
39
  exampleName: ComputedRef<string | undefined>;
41
40
  isWebhook?: ComputedRef<boolean>;
42
41
  route: (payload: RoutePayload) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"use-modal-sidebar.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/hooks/use-modal-sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,k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,KAAK,IAAI,CAAA;CACvC,KAAG,qBAiLH,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-modal-sidebar.js","names":[],"sources":["../../../../../src/v2/features/modal/hooks/use-modal-sidebar.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { createSidebarState, generateReverseIndex, getChildEntry } from '@scalar/sidebar'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { getParentEntry } from '@scalar/workspace-store/navigation'\nimport type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\nimport { isOpenApiDocument } from '@scalar/workspace-store/schemas/type-guards'\nimport { type ComputedRef, computed, toValue, watch } from 'vue'\n\nimport type { RoutePayload } from '@/v2/features/modal/helpers/resolve-route-parameters'\nimport { generateLocationId } from '@/v2/helpers/generate-location-id'\n\nexport type UseModalSidebarReturn = {\n handleSelectItem: (id: string) => void\n state: ReturnType<typeof createSidebarState<TraversedEntry>>\n getEntryByLocation: (location: {\n document: string\n path?: string\n method?: HttpMethod\n example?: string\n isWebhook?: boolean\n }) => TraversedEntry | undefined\n}\n\n/**\n * useSidebarState - Custom hook to manage the sidebar state and navigation logic in the Scalar API client\n *\n * This composable manages the sidebar structure, synchronizes selection state\n * with the current route, and provides a handler for selecting sidebar items.\n *\n * Example usage:\n *\n * const { handleSelectItem, sidebarState } = useSidebarState({\n * workspaceStore,\n * workspaceSlug,\n * documentSlug,\n * path,\n * method,\n * exampleName,\n * })\n */\nexport const useModalSidebar = ({\n workspaceStore,\n documentSlug,\n path,\n method,\n exampleName,\n isWebhook,\n route,\n}: {\n workspaceStore: WorkspaceStore | null\n documentSlug: ComputedRef<string | undefined>\n path: ComputedRef<string | undefined>\n method: ComputedRef<HttpMethod | undefined>\n exampleName: ComputedRef<string | undefined>\n isWebhook?: ComputedRef<boolean>\n route: (payload: RoutePayload) => void\n}): UseModalSidebarReturn => {\n const activeIsWebhook = isWebhook ?? computed(() => false)\n const entries = computed<TraversedEntry[]>(() => {\n const doc = workspaceStore?.workspace.documents[toValue(documentSlug) ?? '']\n return isOpenApiDocument(doc) ? (doc['x-scalar-navigation']?.children ?? []) : []\n })\n const state = createSidebarState(entries)\n\n /**\n * Computed index for fast lookup of sidebar nodes by their unique API location.\n *\n * - Only indexes nodes of type 'operation', or 'example'.\n * - The lookup key is a serialized array of: [operationPath, operationMethod, exampleName?].\n * - Supports precise resolution of sidebar entries given an API \"location\".\n */\n const locationIndex = computed(() =>\n generateReverseIndex({\n items: entries.value,\n nestedKey: 'children',\n filter: (node) => node.type === 'operation' || node.type === 'example' || node.type === 'webhook',\n getId: (node) => {\n if (node.type === 'webhook') {\n return generateLocationId({\n document: toValue(documentSlug) ?? '',\n path: node.name,\n method: node.method,\n isWebhook: true,\n })\n }\n\n const operation = getParentEntry('operation', node)\n return generateLocationId({\n document: toValue(documentSlug) ?? '',\n path: operation?.path,\n method: operation?.method,\n example: node.type === 'example' ? node.name : undefined,\n })\n },\n }),\n )\n\n /**\n * Looks up a sidebar entry by its unique API location.\n * - First tries to find an entry matching all provided properties (including example).\n * - If not found, falls back to matching only the operation (ignores example field).\n * This allows resolving either examples, operations, or documents as appropriate.\n *\n * @param location - Object specifying the document name, path, method, and optional example name.\n * @returns The matching sidebar entry, or undefined if none found.\n *\n * Example:\n * const entry = getEntryByLocation({\n * document: 'pets',\n * path: '/pets',\n * method: 'get',\n * example: 'default',\n * })\n */\n const getEntryByLocation: UseModalSidebarReturn['getEntryByLocation'] = (location) => {\n // Try to find an entry with the most-specific location (including example)\n const entryWithExample = locationIndex.value.get(\n generateLocationId({\n document: location.document,\n path: location.path,\n method: location.method,\n example: location.example,\n isWebhook: location.isWebhook,\n }),\n )\n\n if (entryWithExample) {\n return entryWithExample\n }\n\n // Fallback to the operation (ignoring example) if an example wasn't found or specified\n return locationIndex.value.get(\n generateLocationId({\n document: location.document,\n path: location.path,\n method: location.method,\n isWebhook: location.isWebhook,\n }),\n )\n }\n\n /**\n * Handles item selection from the sidebar and routes navigation accordingly.\n *\n * Example:\n * handleSelectItem('id-of-entry')\n */\n const handleSelectItem = (id: string) => {\n const entry = state.getEntryById(id)\n\n if (!entry) {\n console.warn(`Could not find sidebar entry with id ${id} to select`)\n return\n }\n\n // Navigate to the example page\n if (entry.type === 'operation' || entry.type === 'example') {\n // If we are already in the operation, just toggle expansion\n if (state.isSelected(id)) {\n state.setExpanded(id, !state.isExpanded(id))\n return\n }\n\n const operation = getParentEntry('operation', entry)\n const example = getChildEntry('example', entry)\n\n if (example) {\n state.setSelected(example.id)\n state.setExpanded(example.id, true)\n } else {\n state.setSelected(id)\n }\n\n if (!operation) {\n return\n }\n\n return route({\n documentSlug: toValue(documentSlug),\n path: operation.path,\n method: operation.method,\n example: example?.name ?? 'default',\n })\n }\n\n if (entry.type === 'webhook') {\n state.setSelected(id)\n return route({\n documentSlug: toValue(documentSlug),\n path: entry.name,\n method: entry.method,\n example: 'default',\n isWebhook: true,\n })\n }\n\n state.setExpanded(id, !state.isExpanded(id))\n return\n }\n\n /** Keep the sidebar state in sync with the modal parameters */\n watch(\n [documentSlug, path, method, exampleName, activeIsWebhook],\n ([newDocument, newPath, newMethod, newExample, newIsWebhook]) => {\n if (!newDocument) {\n // Reset selection if no document is selected\n state.setSelected(null)\n return\n }\n\n const entry = getEntryByLocation({\n document: newDocument,\n path: newPath,\n method: newMethod,\n example: newExample,\n isWebhook: newIsWebhook,\n })\n\n if (entry) {\n state.setSelected(entry.id)\n state.setExpanded(entry.id, true)\n }\n },\n {\n immediate: true,\n },\n )\n\n return {\n handleSelectItem,\n state,\n getEntryByLocation,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAa,mBAAmB,EAC9B,gBACA,cACA,MACA,QACA,aACA,WACA,YAS2B;CAC3B,MAAM,kBAAkB,aAAa,eAAe,KAAK;CACzD,MAAM,UAAU,eAAiC;EAC/C,MAAM,MAAM,gBAAgB,UAAU,UAAU,QAAQ,YAAY,KAAK;EACzE,OAAO,kBAAk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,EAAE,CAAC;IAC3C;GACF;GAEA,MAAM,YAAY,eAAe,aAAa,KAAK;GACnD,MAAM,UAAU,cAAc,WAAW,KAAK;GAE9C,IAAI,SAAS;IACX,MAAM,YAAY,QAAQ,EAAE;IAC5B,MAAM,YAAY,QAAQ,IAAI,IAAI;GACpC,OACE,MAAM,YAAY,EAAE;GAGtB,IAAI,CAAC,WACH;GAGF,OAAO,MAAM;IACX,cAAc,QAAQ,YAAY;IAClC,MAAM,UAAU;IAChB,QAAQ,UAAU;IAClB,SAAS,SAAS,QAAQ;GAC5B,CAAC;EACH;EAEA,IAAI,MAAM,SAAS,WAAW;GAC5B,MAAM,YAAY,EAAE;GACpB,OAAO,MAAM;IACX,cAAc,QAAQ,YAAY;IAClC,MAAM,MAAM;IACZ,QAAQ,MAAM;IACd,SAAS;IACT,WAAW;GACb,CAAC;EACH;EAEA,MAAM,YAAY,IAAI,CAAC,MAAM,WAAW,EAAE,CAAC;CAE7C;;CAGA,MACE;EAAC;EAAc;EAAM;EAAQ;EAAa;CAAe,IACxD,CAAC,aAAa,SAAS,WAAW,YAAY,kBAAkB;EAC/D,IAAI,CAAC,aAAa;GAEhB,MAAM,YAAY,IAAI;GACtB;EACF;EAEA,MAAM,QAAQ,mBAAmB;GAC/B,UAAU;GACV,MAAM;GACN,QAAQ;GACR,SAAS;GACT,WAAW;EACb,CAAC;EAED,IAAI,OAAO;GACT,MAAM,YAAY,MAAM,EAAE;GAC1B,MAAM,YAAY,MAAM,IAAI,IAAI;EAClC;CACF,GACA,EACE,WAAW,KACb,CACF;CAEA,OAAO;EACL;EACA;EACA;CACF;AACF"}
1
+ {"version":3,"file":"use-modal-sidebar.js","names":[],"sources":["../../../../../src/v2/features/modal/hooks/use-modal-sidebar.ts"],"sourcesContent":["import { createSidebarState, generateReverseIndex, getChildEntry } from '@scalar/sidebar'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport { getParentEntry } from '@scalar/workspace-store/navigation'\nimport type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\nimport { isOpenApiDocument } from '@scalar/workspace-store/schemas/type-guards'\nimport { type ComputedRef, computed, toValue, watch } from 'vue'\n\nimport type { RoutePayload } from '@/v2/features/modal/helpers/resolve-route-parameters'\nimport { generateLocationId } from '@/v2/helpers/generate-location-id'\n\nexport type UseModalSidebarReturn = {\n handleSelectItem: (id: string) => void\n state: ReturnType<typeof createSidebarState<TraversedEntry>>\n getEntryByLocation: (location: {\n document: string\n path?: string\n method?: string\n example?: string\n isWebhook?: boolean\n }) => TraversedEntry | undefined\n}\n\n/**\n * useSidebarState - Custom hook to manage the sidebar state and navigation logic in the Scalar API client\n *\n * This composable manages the sidebar structure, synchronizes selection state\n * with the current route, and provides a handler for selecting sidebar items.\n *\n * Example usage:\n *\n * const { handleSelectItem, sidebarState } = useSidebarState({\n * workspaceStore,\n * workspaceSlug,\n * documentSlug,\n * path,\n * method,\n * exampleName,\n * })\n */\nexport const useModalSidebar = ({\n workspaceStore,\n documentSlug,\n path,\n method,\n exampleName,\n isWebhook,\n route,\n}: {\n workspaceStore: WorkspaceStore | null\n documentSlug: ComputedRef<string | undefined>\n path: ComputedRef<string | undefined>\n method: ComputedRef<string | undefined>\n exampleName: ComputedRef<string | undefined>\n isWebhook?: ComputedRef<boolean>\n route: (payload: RoutePayload) => void\n}): UseModalSidebarReturn => {\n const activeIsWebhook = isWebhook ?? computed(() => false)\n const entries = computed<TraversedEntry[]>(() => {\n const doc = workspaceStore?.workspace.documents[toValue(documentSlug) ?? '']\n return isOpenApiDocument(doc) ? (doc['x-scalar-navigation']?.children ?? []) : []\n })\n const state = createSidebarState(entries)\n\n /**\n * Computed index for fast lookup of sidebar nodes by their unique API location.\n *\n * - Only indexes nodes of type 'operation', or 'example'.\n * - The lookup key is a serialized array of: [operationPath, operationMethod, exampleName?].\n * - Supports precise resolution of sidebar entries given an API \"location\".\n */\n const locationIndex = computed(() =>\n generateReverseIndex({\n items: entries.value,\n nestedKey: 'children',\n filter: (node) => node.type === 'operation' || node.type === 'example' || node.type === 'webhook',\n getId: (node) => {\n if (node.type === 'webhook') {\n return generateLocationId({\n document: toValue(documentSlug) ?? '',\n path: node.name,\n method: node.method,\n isWebhook: true,\n })\n }\n\n const operation = getParentEntry('operation', node)\n return generateLocationId({\n document: toValue(documentSlug) ?? '',\n path: operation?.path,\n method: operation?.method,\n example: node.type === 'example' ? node.name : undefined,\n })\n },\n }),\n )\n\n /**\n * Looks up a sidebar entry by its unique API location.\n * - First tries to find an entry matching all provided properties (including example).\n * - If not found, falls back to matching only the operation (ignores example field).\n * This allows resolving either examples, operations, or documents as appropriate.\n *\n * @param location - Object specifying the document name, path, method, and optional example name.\n * @returns The matching sidebar entry, or undefined if none found.\n *\n * Example:\n * const entry = getEntryByLocation({\n * document: 'pets',\n * path: '/pets',\n * method: 'get',\n * example: 'default',\n * })\n */\n const getEntryByLocation: UseModalSidebarReturn['getEntryByLocation'] = (location) => {\n // Try to find an entry with the most-specific location (including example)\n const entryWithExample = locationIndex.value.get(\n generateLocationId({\n document: location.document,\n path: location.path,\n method: location.method,\n example: location.example,\n isWebhook: location.isWebhook,\n }),\n )\n\n if (entryWithExample) {\n return entryWithExample\n }\n\n // Fallback to the operation (ignoring example) if an example wasn't found or specified\n return locationIndex.value.get(\n generateLocationId({\n document: location.document,\n path: location.path,\n method: location.method,\n isWebhook: location.isWebhook,\n }),\n )\n }\n\n /**\n * Handles item selection from the sidebar and routes navigation accordingly.\n *\n * Example:\n * handleSelectItem('id-of-entry')\n */\n const handleSelectItem = (id: string) => {\n const entry = state.getEntryById(id)\n\n if (!entry) {\n console.warn(`Could not find sidebar entry with id ${id} to select`)\n return\n }\n\n // Navigate to the example page\n if (entry.type === 'operation' || entry.type === 'example') {\n // If we are already in the operation, just toggle expansion\n if (state.isSelected(id)) {\n state.setExpanded(id, !state.isExpanded(id))\n return\n }\n\n const operation = getParentEntry('operation', entry)\n const example = getChildEntry('example', entry)\n\n if (example) {\n state.setSelected(example.id)\n state.setExpanded(example.id, true)\n } else {\n state.setSelected(id)\n }\n\n if (!operation) {\n return\n }\n\n return route({\n documentSlug: toValue(documentSlug),\n path: operation.path,\n method: operation.method,\n example: example?.name ?? 'default',\n })\n }\n\n if (entry.type === 'webhook') {\n state.setSelected(id)\n return route({\n documentSlug: toValue(documentSlug),\n path: entry.name,\n method: entry.method,\n example: 'default',\n isWebhook: true,\n })\n }\n\n state.setExpanded(id, !state.isExpanded(id))\n return\n }\n\n /** Keep the sidebar state in sync with the modal parameters */\n watch(\n [documentSlug, path, method, exampleName, activeIsWebhook],\n ([newDocument, newPath, newMethod, newExample, newIsWebhook]) => {\n if (!newDocument) {\n // Reset selection if no document is selected\n state.setSelected(null)\n return\n }\n\n const entry = getEntryByLocation({\n document: newDocument,\n path: newPath,\n method: newMethod,\n example: newExample,\n isWebhook: newIsWebhook,\n })\n\n if (entry) {\n state.setSelected(entry.id)\n state.setExpanded(entry.id, true)\n }\n },\n {\n immediate: true,\n },\n )\n\n return {\n handleSelectItem,\n state,\n getEntryByLocation,\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAa,mBAAmB,EAC9B,gBACA,cACA,MACA,QACA,aACA,WACA,YAS2B;CAC3B,MAAM,kBAAkB,aAAa,eAAe,KAAK;CACzD,MAAM,UAAU,eAAiC;EAC/C,MAAM,MAAM,gBAAgB,UAAU,UAAU,QAAQ,YAAY,KAAK;EACzE,OAAO,kBAAkB,GAAG,IAAK,IAAI,sBAAsB,EAAE,YAAY,CAAC,IAAK,CAAC;CAClF,CAAC;CACD,MAAM,QAAQ,mBAAmB,OAAO;;;;;;;;CASxC,MAAM,gBAAgB,eACpB,qBAAqB;EACnB,OAAO,QAAQ;EACf,WAAW;EACX,SAAS,SAAS,KAAK,SAAS,eAAe,KAAK,SAAS,aAAa,KAAK,SAAS;EACxF,QAAQ,SAAS;GACf,IAAI,KAAK,SAAS,WAChB,OAAO,mBAAmB;IACxB,UAAU,QAAQ,YAAY,KAAK;IACn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Q;GAC5B,CAAC;EACH;EAEA,IAAI,MAAM,SAAS,WAAW;GAC5B,MAAM,YAAY,EAAE;GACpB,OAAO,MAAM;IACX,cAAc,QAAQ,YAAY;IAClC,MAAM,MAAM;IACZ,QAAQ,MAAM;IACd,SAAS;IACT,WAAW;GACb,CAAC;EACH;EAEA,MAAM,YAAY,IAAI,CAAC,MAAM,WAAW,EAAE,CAAC;CAE7C;;CAGA,MACE;EAAC;EAAc;EAAM;EAAQ;EAAa;CAAe,IACxD,CAAC,aAAa,SAAS,WAAW,YAAY,kBAAkB;EAC/D,IAAI,CAAC,aAAa;GAEhB,MAAM,YAAY,IAAI;GACtB;EACF;EAEA,MAAM,QAAQ,mBAAmB;GAC/B,UAAU;GACV,MAAM;GACN,QAAQ;GACR,SAAS;GACT,WAAW;EACb,CAAC;EAED,IAAI,OAAO;GACT,MAAM,YAAY,MAAM,EAAE;GAC1B,MAAM,YAAY,MAAM,IAAI,IAAI;EAClC;CACF,GACA,EACE,WAAW,KACb,CACF;CAEA,OAAO;EACL;EACA;EACA;CACF;AACF"}
@@ -0,0 +1,11 @@
1
+ import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
2
+ import { type ShallowRef } from 'vue';
3
+ import type { ApiClientModal } from './helpers/create-api-client-modal.js';
4
+ /** Load and mount the client only when requested, retaining the latest open intent during loading. */
5
+ export declare const useLazyApiClient: ({ eventBus, load, status, }: {
6
+ eventBus: WorkspaceEventBus;
7
+ load: () => Promise<() => ApiClientModal | null>;
8
+ /** Optional visitor-facing state for the initial download. */
9
+ status?: ShallowRef<"idle" | "loading" | "error">;
10
+ }) => ShallowRef<ApiClientModal | null>;
11
+ //# sourceMappingURL=use-lazy-api-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-lazy-api-client.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/modal/use-lazy-api-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAY,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACjF,OAAO,EAAE,KAAK,UAAU,EAA+C,MAAM,KAAK,CAAA;AAElF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAIvE,sGAAsG;AACtG,eAAO,MAAM,gBAAgB,GAAI,6BAI9B;IACD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,IAAI,EAAE,MAAM,OAAO,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,CAAA;IAChD,8DAA8D;IAC9D,MAAM,CAAC,EAAE,UAAU,CAAC,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,CAAA;CAClD,KAAG,UAAU,CAAC,cAAc,GAAG,IAAI,CAwDnC,CAAA"}
@@ -0,0 +1,48 @@
1
+ import { getCurrentScope, onScopeDispose, shallowRef } from "vue";
2
+ //#region src/v2/features/modal/use-lazy-api-client.ts
3
+ /** Load and mount the client only when requested, retaining the latest open intent during loading. */
4
+ var useLazyApiClient = ({ eventBus, load, status = shallowRef("idle") }) => {
5
+ const scope = getCurrentScope();
6
+ const client = shallowRef(null);
7
+ let disposed = false;
8
+ let loading = false;
9
+ let pending = null;
10
+ const unsubscribeOpen = eventBus.on("ui:open:client-modal", (payload) => {
11
+ pending = { payload };
12
+ status.value = "loading";
13
+ if (loading) return;
14
+ loading = true;
15
+ load().then((createClient) => {
16
+ if (disposed || !pending) return;
17
+ client.value = (scope ? scope.run(createClient) : createClient()) ?? null;
18
+ if (!client.value) return;
19
+ unsubscribeOpen();
20
+ unsubscribeClose();
21
+ eventBus.emit("ui:open:client-modal", pending.payload);
22
+ }).catch((error) => {
23
+ if (!disposed && pending) status.value = "error";
24
+ console.error("[@scalar/api-client] Could not load the API client modal.", error);
25
+ }).finally(() => {
26
+ pending = null;
27
+ loading = false;
28
+ if (status.value === "loading") status.value = "idle";
29
+ });
30
+ });
31
+ const unsubscribeClose = eventBus.on("ui:close:client-modal", () => {
32
+ pending = null;
33
+ status.value = "idle";
34
+ });
35
+ onScopeDispose(() => {
36
+ disposed = true;
37
+ status.value = "idle";
38
+ pending = null;
39
+ unsubscribeOpen();
40
+ unsubscribeClose();
41
+ client.value?.app.unmount();
42
+ }, true);
43
+ return client;
44
+ };
45
+ //#endregion
46
+ export { useLazyApiClient };
47
+
48
+ //# sourceMappingURL=use-lazy-api-client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-lazy-api-client.js","names":[],"sources":["../../../../src/v2/features/modal/use-lazy-api-client.ts"],"sourcesContent":["import type { AnyEvent, WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { type ShallowRef, getCurrentScope, onScopeDispose, shallowRef } from 'vue'\n\nimport type { ApiClientModal } from './helpers/create-api-client-modal'\n\ntype OpenPayload = Extract<AnyEvent, { event: 'ui:open:client-modal' }>['payload']\n\n/** Load and mount the client only when requested, retaining the latest open intent during loading. */\nexport const useLazyApiClient = ({\n eventBus,\n load,\n status = shallowRef('idle'),\n}: {\n eventBus: WorkspaceEventBus\n load: () => Promise<() => ApiClientModal | null>\n /** Optional visitor-facing state for the initial download. */\n status?: ShallowRef<'idle' | 'loading' | 'error'>\n}): ShallowRef<ApiClientModal | null> => {\n const scope = getCurrentScope()\n const client = shallowRef<ApiClientModal | null>(null)\n let disposed = false\n let loading = false\n let pending: { payload: OpenPayload } | null = null\n\n const unsubscribeOpen = eventBus.on('ui:open:client-modal', (payload) => {\n pending = { payload }\n status.value = 'loading'\n if (loading) {\n return\n }\n loading = true\n void load()\n .then((createClient) => {\n if (disposed || !pending) {\n return\n }\n client.value = (scope ? scope.run(createClient) : createClient()) ?? null\n if (!client.value) {\n return\n }\n unsubscribeOpen()\n unsubscribeClose()\n // Replay the full event after the modal subscribes, including example and composition selection.\n eventBus.emit('ui:open:client-modal', pending.payload)\n })\n .catch((error: unknown) => {\n if (!disposed && pending) {\n status.value = 'error'\n }\n console.error('[@scalar/api-client] Could not load the API client modal.', error)\n })\n .finally(() => {\n pending = null\n loading = false\n if (status.value === 'loading') {\n status.value = 'idle'\n }\n })\n })\n const unsubscribeClose = eventBus.on('ui:close:client-modal', () => {\n pending = null\n status.value = 'idle'\n })\n\n onScopeDispose(() => {\n disposed = true\n status.value = 'idle'\n pending = null\n unsubscribeOpen()\n unsubscribeClose()\n client.value?.app.unmount()\n }, true)\n return client\n}\n"],"mappings":";;;AAQA,IAAa,oBAAoB,EAC/B,UACA,MACA,SAAS,WAAW,MAAM,QAMa;CACvC,MAAM,QAAQ,gBAAgB;CAC9B,MAAM,SAAS,WAAkC,IAAI;CACrD,IAAI,WAAW;CACf,IAAI,UAAU;CACd,IAAI,UAA2C;CAE/C,MAAM,kBAAkB,SAAS,GAAG,yBAAyB,YAAY;EACvE,UAAU,EAAE,QAAQ;EACpB,OAAO,QAAQ;EACf,IAAI,SACF;EAEF,UAAU;EACV,KAAU,CAAC,CACR,MAAM,iBAAiB;GACtB,IAAI,YAAY,CAAC,SACf;GAEF,OAAO,SAAS,QAAQ,MAAM,IAAI,YAAY,IAAI,aAAa,MAAM;GACrE,IAAI,CAAC,OAAO,OACV;GAEF,gBAAgB;GAChB,iBAAiB;GAEjB,SAAS,KAAK,wBAAwB,QAAQ,OAAO;EACvD,CAAC,CAAC,CACD,OAAO,UAAmB;GACzB,IAAI,CAAC,YAAY,SACf,OAAO,QAAQ;GAEjB,QAAQ,MAAM,6DAA6D,KAAK;EAClF,CAAC,CAAC,CACD,cAAc;GACb,UAAU;GACV,UAAU;GACV,IAAI,OAAO,UAAU,WACnB,OAAO,QAAQ;EAEnB,CAAC;CACL,CAAC;CACD,MAAM,mBAAmB,SAAS,GAAG,+BAA+B;EAClE,UAAU;EACV,OAAO,QAAQ;CACjB,CAAC;CAED,qBAAqB;EACnB,WAAW;EACX,OAAO,QAAQ;EACf,UAAU;EACV,gBAAgB;EAChB,iBAAiB;EACjB,OAAO,OAAO,IAAI,QAAQ;CAC5B,GAAG,IAAI;CACP,OAAO;AACT"}
@@ -1,4 +1,3 @@
1
- import type { HttpMethod } from '@scalar/helpers/http/http-methods';
2
1
  import type { ClientPlugin } from '@scalar/oas-utils/helpers';
3
2
  import type { WorkspaceStore } from '@scalar/workspace-store/client';
4
3
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
@@ -31,7 +30,7 @@ export type OperationProps = {
31
30
  /** The API path currently selected (e.g. "/users/{id}") */
32
31
  path?: string;
33
32
  /** The HTTP method for the currently selected API path (e.g. GET, POST) */
34
- method?: HttpMethod;
33
+ method?: string;
35
34
  /** The name of the currently selected example (for examples within an endpoint) */
36
35
  exampleName?: string;
37
36
  /** Resolve the selected entry from the OpenAPI webhooks map. */
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AAyRA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAgBvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AACnG,OAAO,EAML,KAAK,gBAAgB,EACtB,MAAM,KAAK,CAAA;AAKZ,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAG1D;;;;;;;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAIzC,MAAM,MAAM,cAAc,GAAG;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAA;IACpB,4FAA4F;IAC5F,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAA;IAChC,8BAA8B;IAC9B,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;GAOG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAIzC,MAAM,MAAM,cAAc,GAAG;IAC3B,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,mEAAmE;IACnE,YAAY,EAAE,MAAM,CAAA;IACpB,4FAA4F;IAC5F,QAAQ,EAAE,eAAe,GAAG,IAAI,CAAA;IAChC,8BAA8B;IAC9B,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,+BAA+B;IAC/B,MAAM,EAAE,YAAY,CAAA;IACpB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,mFAAmF;IACnF,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gEAAgE;IAChE,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,uCAAuC;IACvC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,0BAA0B;IAC1B,cAAc,EAAE,cAAc,CAAA;IAC9B,qBAAqB;IACrB,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,gBAAgB,CAAC,gBAAgB,CAAC,CAAA;CAC7C,CAAA;AACD,QAAA,MAAM,YAAY;IAEd,sEAAsE;sCACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;;IADxD,sEAAsE;sCACpC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;iGA6UxD,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n\nexport type OperationProps = {\n /** Hidden modals keep their operation mounted without downloading examples. */\n isActive?: boolean\n /** The slug of the currently selected document in the workspace */\n documentSlug: string\n /** The currently active document — OpenAPI-only, the operation page has no AsyncAPI path */\n document: OpenApiDocument | null\n /** The workspace event bus */\n eventBus: WorkspaceEventBus\n /** The layout of the client */\n layout: ClientLayout\n /** The API path currently selected (e.g. \"/users/{id}\") */\n path?: string\n /** The HTTP method for the currently selected API path (e.g. GET, POST) */\n method?: HttpMethod\n /** The name of the currently selected example (for examples within an endpoint) */\n exampleName?: string\n /** Resolve the selected entry from the OpenAPI webhooks map. */\n isWebhook?: boolean\n /** The currently active environment */\n environment: XScalarEnvironment\n /** The workspace store */\n workspaceStore: WorkspaceStore\n /** Client plugins */\n plugins: ClientPlugin[]\n /** App or modal options forwarded to operation/auth blocks */\n options?: MaybeRefOrGetter<ApiClientOptions>\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getOperationExamples,\n resolveOperationExamples,\n} from '@scalar/workspace-store/helpers/operation-examples'\nimport {\n EXTERNAL_EXAMPLES,\n useExampleVisibility,\n useExternalExamples,\n} from '@scalar/workspace-store/helpers/use-external-examples'\nimport {\n getActiveProxyUrl,\n getRequestExampleContext,\n getSelectedBodyContentType,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n provide,\n ref,\n toValue,\n type ComponentPublicInstance,\n type MaybeRefOrGetter,\n} from 'vue'\n\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport { APP_VERSION } from '@/v2/constants'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ClientLayout } from '@/v2/types/layout'\nimport type { ApiClientOptions } from '@/v2/types/options'\n\nconst {\n isActive = true,\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n workspaceStore,\n plugins,\n documentSlug,\n isWebhook = false,\n} = defineProps<\n OperationProps & {\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n }\n>()\n\n/**\n * Shared request-example context (operation, servers, auth scope, cookies). Recomputed when any\n * underlying workspace or route input changes — same reactivity as the previous local computeds.\n */\nconst requestExample = computed(() => {\n if (!path || !method || !exampleName || !document) {\n return null\n }\n\n const result = getRequestExampleContext(\n workspaceStore,\n documentSlug,\n { path, method, exampleName, isWebhook },\n {\n baseServerUrl: toValue(options)?.baseServerURL,\n fallbackDocument: document,\n isElectron: isElectron(),\n layout: layout === 'web' ? 'web' : 'other',\n servers: toValue(options)?.servers,\n appVersion: APP_VERSION,\n authentication: toValue(options)?.authentication,\n },\n )\n\n return result.ok ? result.data : null\n})\n\nconst sourceOperation = computed(() => requestExample.value?.operation ?? null)\nconst getResolver = (): ReturnType<WorkspaceStore['externalExamples']> =>\n workspaceStore.externalExamples(documentSlug)\nprovide(EXTERNAL_EXAMPLES, getResolver)\nconst contentType = computed(\n () =>\n getSelectedBodyContentType(\n getResolvedRef(sourceOperation.value?.requestBody),\n exampleName,\n ) ?? undefined,\n)\nconst container = ref<ComponentPublicInstance | null>(null)\nconst visible = useExampleVisibility(container)\nconst externalExamples = useExternalExamples(\n () =>\n sourceOperation.value\n ? getOperationExamples(\n sourceOperation.value,\n exampleName ?? '',\n contentType.value,\n )\n : [],\n () => isActive && visible.value,\n getResolver,\n)\nconst operation = computed(() =>\n sourceOperation.value\n ? resolveOperationExamples(\n sourceOperation.value,\n exampleName ?? '',\n contentType.value,\n externalExamples.resolve,\n )\n : null,\n)\nconst workspaceCookies = computed(\n () => requestExample.value?.cookies.workspace ?? [],\n)\nconst documentCookies = computed(\n () => requestExample.value?.cookies.document ?? [],\n)\nconst servers = computed(() => requestExample.value?.servers.list ?? [])\nconst selectedServer = computed(\n () => requestExample.value?.servers.selected ?? null,\n)\nconst serverMeta = computed(\n () => requestExample.value?.servers.meta ?? { type: 'document' as const },\n)\n\nconst securitySchemes = computed(\n () => requestExample.value?.security.schemes ?? {},\n)\n\nconst selectedSecurity = computed(\n () =>\n requestExample.value?.security.selected ?? {\n selectedIndex: -1,\n selectedSchemes: [],\n },\n)\nconst selectedSecuritySchemes = computed(\n () => requestExample.value?.security.selectedSchemes ?? [],\n)\nconst securityRequirements = computed(\n () => requestExample.value?.security.requirements ?? [],\n)\nconst authMeta = computed(\n () => requestExample.value?.security.meta ?? { type: 'document' as const },\n)\n\nconst defaultHeaders = computed(\n () => requestExample.value?.headers.default ?? {},\n)\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation && document\">\n <OperationBlock\n ref=\"container\"\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :defaultHeaders\n :document\n :documentCookies\n :documentSecurity=\"document?.security ?? []\"\n :documentSlug\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :externalExamplesFailed=\"externalExamples.failed.value\"\n :externalExamplesPending=\"externalExamples.pending.value\"\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :isWebhook\n :layout\n :method\n :operation\n :options\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? ''\n \"\n :requestBodyCompositionSelection\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :selectedSecurity=\"selectedSecurity\"\n :selectedSecuritySchemes=\"selectedSecuritySchemes\"\n :server=\"selectedServer\"\n :serverMeta\n :servers\n :workspaceCookies\n @retry:externalExamples=\"externalExamples.retry\" />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span class=\"text-c-3\">Select an operation to view details</span>\n </div>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"Operation.vue.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n\nexport type OperationProps = {\n /** Hidden modals keep their operation mounted without downloading examples. */\n isActive?: boolean\n /** The slug of the currently selected document in the workspace */\n documentSlug: string\n /** The currently active document — OpenAPI-only, the operation page has no AsyncAPI path */\n document: OpenApiDocument | null\n /** The workspace event bus */\n eventBus: WorkspaceEventBus\n /** The layout of the client */\n layout: ClientLayout\n /** The API path currently selected (e.g. \"/users/{id}\") */\n path?: string\n /** The HTTP method for the currently selected API path (e.g. GET, POST) */\n method?: string\n /** The name of the currently selected example (for examples within an endpoint) */\n exampleName?: string\n /** Resolve the selected entry from the OpenAPI webhooks map. */\n isWebhook?: boolean\n /** The currently active environment */\n environment: XScalarEnvironment\n /** The workspace store */\n workspaceStore: WorkspaceStore\n /** Client plugins */\n plugins: ClientPlugin[]\n /** App or modal options forwarded to operation/auth blocks */\n options?: MaybeRefOrGetter<ApiClientOptions>\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getOperationExamples,\n resolveOperationExamples,\n} from '@scalar/workspace-store/helpers/operation-examples'\nimport {\n EXTERNAL_EXAMPLES,\n useExampleVisibility,\n useExternalExamples,\n} from '@scalar/workspace-store/helpers/use-external-examples'\nimport {\n getActiveProxyUrl,\n getRequestExampleContext,\n getSelectedBodyContentType,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n provide,\n ref,\n toValue,\n type ComponentPublicInstance,\n type MaybeRefOrGetter,\n} from 'vue'\n\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport { APP_VERSION } from '@/v2/constants'\nimport {\n provideLocalization,\n useLocalization,\n} from '@/v2/features/localization'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ClientLayout } from '@/v2/types/layout'\nimport type { ApiClientOptions } from '@/v2/types/options'\n\nconst {\n isActive = true,\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n workspaceStore,\n plugins,\n documentSlug,\n isWebhook = false,\n} = defineProps<\n OperationProps & {\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n }\n>()\n\nconst inheritedLocalization = useLocalization()\nconst { translate, locale, direction } = provideLocalization(\n () =>\n toValue(options)?.localization ?? {\n locale: inheritedLocalization.locale.value,\n direction: inheritedLocalization.direction.value,\n translations: inheritedLocalization.translations.value,\n },\n)\n\n/**\n * Shared request-example context (operation, servers, auth scope, cookies). Recomputed when any\n * underlying workspace or route input changes — same reactivity as the previous local computeds.\n */\nconst requestExample = computed(() => {\n if (!path || !method || !exampleName || !document) {\n return null\n }\n\n const result = getRequestExampleContext(\n workspaceStore,\n documentSlug,\n { path, method, exampleName, isWebhook },\n {\n baseServerUrl: toValue(options)?.baseServerURL,\n fallbackDocument: document,\n isElectron: isElectron(),\n layout: layout === 'web' ? 'web' : 'other',\n servers: toValue(options)?.servers,\n appVersion: APP_VERSION,\n authentication: toValue(options)?.authentication,\n },\n )\n\n return result.ok ? result.data : null\n})\n\nconst sourceOperation = computed(() => requestExample.value?.operation ?? null)\nconst getResolver = (): ReturnType<WorkspaceStore['externalExamples']> =>\n workspaceStore.externalExamples(documentSlug)\nprovide(EXTERNAL_EXAMPLES, getResolver)\nconst contentType = computed(\n () =>\n getSelectedBodyContentType(\n getResolvedRef(sourceOperation.value?.requestBody),\n exampleName,\n ) ?? undefined,\n)\nconst container = ref<ComponentPublicInstance | null>(null)\nconst visible = useExampleVisibility(container)\nconst externalExamples = useExternalExamples(\n () =>\n sourceOperation.value\n ? getOperationExamples(\n sourceOperation.value,\n exampleName ?? '',\n contentType.value,\n )\n : [],\n () => isActive && visible.value,\n getResolver,\n)\nconst operation = computed(() =>\n sourceOperation.value\n ? resolveOperationExamples(\n sourceOperation.value,\n exampleName ?? '',\n contentType.value,\n externalExamples.resolve,\n )\n : null,\n)\nconst workspaceCookies = computed(\n () => requestExample.value?.cookies.workspace ?? [],\n)\nconst documentCookies = computed(\n () => requestExample.value?.cookies.document ?? [],\n)\nconst servers = computed(() => requestExample.value?.servers.list ?? [])\nconst selectedServer = computed(\n () => requestExample.value?.servers.selected ?? null,\n)\nconst serverMeta = computed(\n () => requestExample.value?.servers.meta ?? { type: 'document' as const },\n)\n\nconst securitySchemes = computed(\n () => requestExample.value?.security.schemes ?? {},\n)\n\nconst selectedSecurity = computed(\n () =>\n requestExample.value?.security.selected ?? {\n selectedIndex: -1,\n selectedSchemes: [],\n },\n)\nconst selectedSecuritySchemes = computed(\n () => requestExample.value?.security.selectedSchemes ?? [],\n)\nconst securityRequirements = computed(\n () => requestExample.value?.security.requirements ?? [],\n)\nconst authMeta = computed(\n () => requestExample.value?.security.meta ?? { type: 'document' as const },\n)\n\nconst defaultHeaders = computed(\n () => requestExample.value?.headers.default ?? {},\n)\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation && document\">\n <OperationBlock\n ref=\"container\"\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :defaultHeaders\n :dir=\"direction\"\n :document\n :documentCookies\n :documentSecurity=\"document?.security ?? []\"\n :documentSlug\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :externalExamplesFailed=\"externalExamples.failed.value\"\n :externalExamplesPending=\"externalExamples.pending.value\"\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :isWebhook\n :lang=\"locale\"\n :layout\n :method\n :operation\n :options\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? ''\n \"\n :requestBodyCompositionSelection\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :selectedSecurity=\"selectedSecurity\"\n :selectedSecuritySchemes=\"selectedSecuritySchemes\"\n :server=\"selectedServer\"\n :serverMeta\n :servers\n :sourceOperation=\"sourceOperation ?? undefined\"\n :workspaceCookies\n @retry:externalExamples=\"externalExamples.retry\" />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\"\n :dir=\"direction\"\n :lang=\"locale\">\n <span class=\"text-c-3\">{{\n translate('apiClient.operation.selectAnOperationToViewDetails')\n }}</span>\n </div>\n</template>\n"],"mappings":""}
@@ -1,17 +1,16 @@
1
+ import { provideLocalization, useLocalization } from "../localization/index.js";
1
2
  import OperationBlock_default from "../../blocks/operation-block/OperationBlock.vue.js";
2
3
  import { APP_VERSION } from "../../constants.js";
3
4
  import { mapHiddenClientsConfig } from "../modal/helpers/map-hidden-clients-config.js";
4
- import { computed, createBlock, createElementBlock, createElementVNode, defineComponent, openBlock, provide, ref, toValue, unref } from "vue";
5
+ import { computed, createBlock, createElementBlock, createElementVNode, defineComponent, openBlock, provide, ref, toDisplayString, toValue, unref } from "vue";
5
6
  import { getActiveProxyUrl, getRequestExampleContext, getSelectedBodyContentType } from "@scalar/workspace-store/request-example";
6
7
  import { isElectron } from "@scalar/helpers/general/is-electron";
7
8
  import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
8
9
  import { getOperationExamples, resolveOperationExamples } from "@scalar/workspace-store/helpers/operation-examples";
9
10
  import { EXTERNAL_EXAMPLES, useExampleVisibility, useExternalExamples } from "@scalar/workspace-store/helpers/use-external-examples";
10
11
  //#region src/v2/features/operation/Operation.vue?vue&type=script&setup=true&lang.ts
11
- var _hoisted_1 = {
12
- key: 1,
13
- class: "flex h-full w-full items-center justify-center"
14
- };
12
+ var _hoisted_1 = ["dir", "lang"];
13
+ var _hoisted_2 = { class: "text-c-3" };
15
14
  var Operation_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
16
15
  __name: "Operation",
17
16
  props: {
@@ -37,6 +36,12 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
37
36
  requestBodyCompositionSelection: {}
38
37
  },
39
38
  setup(__props) {
39
+ const inheritedLocalization = useLocalization();
40
+ const { translate, locale, direction } = provideLocalization(() => toValue(__props.options)?.localization ?? {
41
+ locale: inheritedLocalization.locale.value,
42
+ direction: inheritedLocalization.direction.value,
43
+ translations: inheritedLocalization.translations.value
44
+ });
40
45
  /**
41
46
  * Shared request-example context (operation, servers, auth scope, cookies). Recomputed when any
42
47
  * underlying workspace or route input changes — same reactivity as the previous local computeds.
@@ -99,6 +104,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
99
104
  appVersion: unref(APP_VERSION),
100
105
  authMeta: authMeta.value,
101
106
  defaultHeaders: defaultHeaders.value,
107
+ dir: unref(direction),
102
108
  document: __props.document,
103
109
  documentCookies: documentCookies.value,
104
110
  documentSecurity: __props.document?.security ?? [],
@@ -114,6 +120,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
114
120
  history: __props.workspaceStore.history.getHistory(__props.documentSlug, __props.path, __props.method),
115
121
  httpClients: httpClients.value,
116
122
  isWebhook: __props.isWebhook,
123
+ lang: unref(locale),
117
124
  layout: __props.layout,
118
125
  method: __props.method,
119
126
  operation: operation.value,
@@ -130,6 +137,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
130
137
  server: selectedServer.value,
131
138
  serverMeta: serverMeta.value,
132
139
  servers: servers.value,
140
+ sourceOperation: sourceOperation.value ?? void 0,
133
141
  workspaceCookies: workspaceCookies.value,
134
142
  "onRetry:externalExamples": unref(externalExamples).retry
135
143
  }, null, 8, [
@@ -137,6 +145,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
137
145
  "appVersion",
138
146
  "authMeta",
139
147
  "defaultHeaders",
148
+ "dir",
140
149
  "document",
141
150
  "documentCookies",
142
151
  "documentSecurity",
@@ -152,6 +161,7 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
152
161
  "history",
153
162
  "httpClients",
154
163
  "isWebhook",
164
+ "lang",
155
165
  "layout",
156
166
  "method",
157
167
  "operation",
@@ -168,9 +178,15 @@ var Operation_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ define
168
178
  "server",
169
179
  "serverMeta",
170
180
  "servers",
181
+ "sourceOperation",
171
182
  "workspaceCookies",
172
183
  "onRetry:externalExamples"
173
- ])) : (openBlock(), createElementBlock("div", _hoisted_1, [..._cache[0] || (_cache[0] = [createElementVNode("span", { class: "text-c-3" }, "Select an operation to view details", -1)])]));
184
+ ])) : (openBlock(), createElementBlock("div", {
185
+ key: 1,
186
+ class: "flex h-full w-full items-center justify-center",
187
+ dir: unref(direction),
188
+ lang: unref(locale)
189
+ }, [createElementVNode("span", _hoisted_2, toDisplayString(unref(translate)("apiClient.operation.selectAnOperationToViewDetails")), 1)], 8, _hoisted_1));
174
190
  };
175
191
  }
176
192
  });
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.script.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n\nexport type OperationProps = {\n /** Hidden modals keep their operation mounted without downloading examples. */\n isActive?: boolean\n /** The slug of the currently selected document in the workspace */\n documentSlug: string\n /** The currently active document — OpenAPI-only, the operation page has no AsyncAPI path */\n document: OpenApiDocument | null\n /** The workspace event bus */\n eventBus: WorkspaceEventBus\n /** The layout of the client */\n layout: ClientLayout\n /** The API path currently selected (e.g. \"/users/{id}\") */\n path?: string\n /** The HTTP method for the currently selected API path (e.g. GET, POST) */\n method?: HttpMethod\n /** The name of the currently selected example (for examples within an endpoint) */\n exampleName?: string\n /** Resolve the selected entry from the OpenAPI webhooks map. */\n isWebhook?: boolean\n /** The currently active environment */\n environment: XScalarEnvironment\n /** The workspace store */\n workspaceStore: WorkspaceStore\n /** Client plugins */\n plugins: ClientPlugin[]\n /** App or modal options forwarded to operation/auth blocks */\n options?: MaybeRefOrGetter<ApiClientOptions>\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getOperationExamples,\n resolveOperationExamples,\n} from '@scalar/workspace-store/helpers/operation-examples'\nimport {\n EXTERNAL_EXAMPLES,\n useExampleVisibility,\n useExternalExamples,\n} from '@scalar/workspace-store/helpers/use-external-examples'\nimport {\n getActiveProxyUrl,\n getRequestExampleContext,\n getSelectedBodyContentType,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n provide,\n ref,\n toValue,\n type ComponentPublicInstance,\n type MaybeRefOrGetter,\n} from 'vue'\n\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport { APP_VERSION } from '@/v2/constants'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ClientLayout } from '@/v2/types/layout'\nimport type { ApiClientOptions } from '@/v2/types/options'\n\nconst {\n isActive = true,\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n workspaceStore,\n plugins,\n documentSlug,\n isWebhook = false,\n} = defineProps<\n OperationProps & {\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n }\n>()\n\n/**\n * Shared request-example context (operation, servers, auth scope, cookies). Recomputed when any\n * underlying workspace or route input changes — same reactivity as the previous local computeds.\n */\nconst requestExample = computed(() => {\n if (!path || !method || !exampleName || !document) {\n return null\n }\n\n const result = getRequestExampleContext(\n workspaceStore,\n documentSlug,\n { path, method, exampleName, isWebhook },\n {\n baseServerUrl: toValue(options)?.baseServerURL,\n fallbackDocument: document,\n isElectron: isElectron(),\n layout: layout === 'web' ? 'web' : 'other',\n servers: toValue(options)?.servers,\n appVersion: APP_VERSION,\n authentication: toValue(options)?.authentication,\n },\n )\n\n return result.ok ? result.data : null\n})\n\nconst sourceOperation = computed(() => requestExample.value?.operation ?? null)\nconst getResolver = (): ReturnType<WorkspaceStore['externalExamples']> =>\n workspaceStore.externalExamples(documentSlug)\nprovide(EXTERNAL_EXAMPLES, getResolver)\nconst contentType = computed(\n () =>\n getSelectedBodyContentType(\n getResolvedRef(sourceOperation.value?.requestBody),\n exampleName,\n ) ?? undefined,\n)\nconst container = ref<ComponentPublicInstance | null>(null)\nconst visible = useExampleVisibility(container)\nconst externalExamples = useExternalExamples(\n () =>\n sourceOperation.value\n ? getOperationExamples(\n sourceOperation.value,\n exampleName ?? '',\n contentType.value,\n )\n : [],\n () => isActive && visible.value,\n getResolver,\n)\nconst operation = computed(() =>\n sourceOperation.value\n ? resolveOperationExamples(\n sourceOperation.value,\n exampleName ?? '',\n contentType.value,\n externalExamples.resolve,\n )\n : null,\n)\nconst workspaceCookies = computed(\n () => requestExample.value?.cookies.workspace ?? [],\n)\nconst documentCookies = computed(\n () => requestExample.value?.cookies.document ?? [],\n)\nconst servers = computed(() => requestExample.value?.servers.list ?? [])\nconst selectedServer = computed(\n () => requestExample.value?.servers.selected ?? null,\n)\nconst serverMeta = computed(\n () => requestExample.value?.servers.meta ?? { type: 'document' as const },\n)\n\nconst securitySchemes = computed(\n () => requestExample.value?.security.schemes ?? {},\n)\n\nconst selectedSecurity = computed(\n () =>\n requestExample.value?.security.selected ?? {\n selectedIndex: -1,\n selectedSchemes: [],\n },\n)\nconst selectedSecuritySchemes = computed(\n () => requestExample.value?.security.selectedSchemes ?? [],\n)\nconst securityRequirements = computed(\n () => requestExample.value?.security.requirements ?? [],\n)\nconst authMeta = computed(\n () => requestExample.value?.security.meta ?? { type: 'document' as const },\n)\n\nconst defaultHeaders = computed(\n () => requestExample.value?.headers.default ?? {},\n)\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation && document\">\n <OperationBlock\n ref=\"container\"\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :defaultHeaders\n :document\n :documentCookies\n :documentSecurity=\"document?.security ?? []\"\n :documentSlug\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :externalExamplesFailed=\"externalExamples.failed.value\"\n :externalExamplesPending=\"externalExamples.pending.value\"\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :isWebhook\n :layout\n :method\n :operation\n :options\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? ''\n \"\n :requestBodyCompositionSelection\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :selectedSecurity=\"selectedSecurity\"\n :selectedSecuritySchemes=\"selectedSecuritySchemes\"\n :server=\"selectedServer\"\n :serverMeta\n :servers\n :workspaceCookies\n @retry:externalExamples=\"externalExamples.retry\" />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\">\n <span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,aAAa,QAAA,WAAQ;IACrB,aAAA,QAAA;IACA,cAAA,aAAA;IACA,UAAA,QAAA;IACA,YAAY,QAAA;IACZ,wBAAwB,MAAA,gBAAA,CAAgB,CAAC,OAAO;IAChD,yBAAyB,MAAA,gBAAA,CAAgB,CAAC,QAAQ;IAClD,kBAAkB,QAAQ,QAAA,OAAO,CAAA,EAAG,oBAAgB;IACpD,SAAS,QAAA,eAAe,QAAQ,WAAW,QAAA,cAAc,QAAA,MAAM,QAAA,MAAM;IACrE,aAAA,YAAA;IACA,WAAA,QAAA;IACA,QAAA,QAAA;IACA,QAAA,QAAA;IACA,WAAA,UAAA;IACA,SAAA,QAAA;IACA,MAAA,QAAA;IACA,SAAS,QAAA;IACT,UAAmB,MAAA,iBAAA,CAAiB,CAAY,QAAA,eAAe,UAAS,0BAAqC,QAAA,WAAM,QAAA,QAAA,OAAA,KAAA;IAMnH,iCAAA,QAAA;IACA,sBAAsB,qBAAA;IACtB,iBAAA,gBAAA;IACA,gBAAgB,QAAA,eAAe,UAAS;IACxC,kBAAkB,iBAAA;IAClB,yBAAyB,wBAAA;IACzB,QAAQ,eAAA;IACR,YAAA,WAAA;IACA,SAAA,QAAA;IACA,kBAAA,iBAAA;IACA,4BAAwB,MAAA,gBAAA,CAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAI9C,mBAIM,OAJN,YAIM,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CADJ,mBAAiE,QAAA,EAA3D,OAAM,WAAU,GAAC,uCAAmC,EAAA,CAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"Operation.vue.script.js","names":[],"sources":["../../../../src/v2/features/operation/Operation.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Operation example page\n *\n * Displays an operation with a specific example selected\n * - View example request data\n * - Modify example request data\n * - Send example request\n */\nexport default {}\n\nexport type OperationProps = {\n /** Hidden modals keep their operation mounted without downloading examples. */\n isActive?: boolean\n /** The slug of the currently selected document in the workspace */\n documentSlug: string\n /** The currently active document — OpenAPI-only, the operation page has no AsyncAPI path */\n document: OpenApiDocument | null\n /** The workspace event bus */\n eventBus: WorkspaceEventBus\n /** The layout of the client */\n layout: ClientLayout\n /** The API path currently selected (e.g. \"/users/{id}\") */\n path?: string\n /** The HTTP method for the currently selected API path (e.g. GET, POST) */\n method?: string\n /** The name of the currently selected example (for examples within an endpoint) */\n exampleName?: string\n /** Resolve the selected entry from the OpenAPI webhooks map. */\n isWebhook?: boolean\n /** The currently active environment */\n environment: XScalarEnvironment\n /** The workspace store */\n workspaceStore: WorkspaceStore\n /** Client plugins */\n plugins: ClientPlugin[]\n /** App or modal options forwarded to operation/auth blocks */\n options?: MaybeRefOrGetter<ApiClientOptions>\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { getResolvedRef } from '@scalar/workspace-store/helpers/get-resolved-ref'\nimport {\n getOperationExamples,\n resolveOperationExamples,\n} from '@scalar/workspace-store/helpers/operation-examples'\nimport {\n EXTERNAL_EXAMPLES,\n useExampleVisibility,\n useExternalExamples,\n} from '@scalar/workspace-store/helpers/use-external-examples'\nimport {\n getActiveProxyUrl,\n getRequestExampleContext,\n getSelectedBodyContentType,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport {\n computed,\n provide,\n ref,\n toValue,\n type ComponentPublicInstance,\n type MaybeRefOrGetter,\n} from 'vue'\n\nimport { OperationBlock } from '@/v2/blocks/operation-block'\nimport { APP_VERSION } from '@/v2/constants'\nimport {\n provideLocalization,\n useLocalization,\n} from '@/v2/features/localization'\nimport { mapHiddenClientsConfig } from '@/v2/features/modal/helpers/map-hidden-clients-config'\nimport type { ClientLayout } from '@/v2/types/layout'\nimport type { ApiClientOptions } from '@/v2/types/options'\n\nconst {\n isActive = true,\n document,\n layout,\n eventBus,\n path,\n method,\n environment,\n exampleName,\n options,\n workspaceStore,\n plugins,\n documentSlug,\n isWebhook = false,\n} = defineProps<\n OperationProps & {\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n }\n>()\n\nconst inheritedLocalization = useLocalization()\nconst { translate, locale, direction } = provideLocalization(\n () =>\n toValue(options)?.localization ?? {\n locale: inheritedLocalization.locale.value,\n direction: inheritedLocalization.direction.value,\n translations: inheritedLocalization.translations.value,\n },\n)\n\n/**\n * Shared request-example context (operation, servers, auth scope, cookies). Recomputed when any\n * underlying workspace or route input changes — same reactivity as the previous local computeds.\n */\nconst requestExample = computed(() => {\n if (!path || !method || !exampleName || !document) {\n return null\n }\n\n const result = getRequestExampleContext(\n workspaceStore,\n documentSlug,\n { path, method, exampleName, isWebhook },\n {\n baseServerUrl: toValue(options)?.baseServerURL,\n fallbackDocument: document,\n isElectron: isElectron(),\n layout: layout === 'web' ? 'web' : 'other',\n servers: toValue(options)?.servers,\n appVersion: APP_VERSION,\n authentication: toValue(options)?.authentication,\n },\n )\n\n return result.ok ? result.data : null\n})\n\nconst sourceOperation = computed(() => requestExample.value?.operation ?? null)\nconst getResolver = (): ReturnType<WorkspaceStore['externalExamples']> =>\n workspaceStore.externalExamples(documentSlug)\nprovide(EXTERNAL_EXAMPLES, getResolver)\nconst contentType = computed(\n () =>\n getSelectedBodyContentType(\n getResolvedRef(sourceOperation.value?.requestBody),\n exampleName,\n ) ?? undefined,\n)\nconst container = ref<ComponentPublicInstance | null>(null)\nconst visible = useExampleVisibility(container)\nconst externalExamples = useExternalExamples(\n () =>\n sourceOperation.value\n ? getOperationExamples(\n sourceOperation.value,\n exampleName ?? '',\n contentType.value,\n )\n : [],\n () => isActive && visible.value,\n getResolver,\n)\nconst operation = computed(() =>\n sourceOperation.value\n ? resolveOperationExamples(\n sourceOperation.value,\n exampleName ?? '',\n contentType.value,\n externalExamples.resolve,\n )\n : null,\n)\nconst workspaceCookies = computed(\n () => requestExample.value?.cookies.workspace ?? [],\n)\nconst documentCookies = computed(\n () => requestExample.value?.cookies.document ?? [],\n)\nconst servers = computed(() => requestExample.value?.servers.list ?? [])\nconst selectedServer = computed(\n () => requestExample.value?.servers.selected ?? null,\n)\nconst serverMeta = computed(\n () => requestExample.value?.servers.meta ?? { type: 'document' as const },\n)\n\nconst securitySchemes = computed(\n () => requestExample.value?.security.schemes ?? {},\n)\n\nconst selectedSecurity = computed(\n () =>\n requestExample.value?.security.selected ?? {\n selectedIndex: -1,\n selectedSchemes: [],\n },\n)\nconst selectedSecuritySchemes = computed(\n () => requestExample.value?.security.selectedSchemes ?? [],\n)\nconst securityRequirements = computed(\n () => requestExample.value?.security.requirements ?? [],\n)\nconst authMeta = computed(\n () => requestExample.value?.security.meta ?? { type: 'document' as const },\n)\n\nconst defaultHeaders = computed(\n () => requestExample.value?.headers.default ?? {},\n)\n\n/** Combine environments from document and workspace into a unique array of environment names */\nconst environments = computed(() => {\n return Array.from(\n new Set(\n Object.keys({\n ...document?.['x-scalar-environments'],\n ...workspaceStore.workspace['x-scalar-environments'],\n }),\n ),\n )\n})\n\n/** Temporarily use the old config.hiddenClients until we migrate to the new httpClients config */\nconst httpClients = computed(() =>\n mapHiddenClientsConfig(toValue(options)?.hiddenClients),\n)\n</script>\n\n<template>\n <!-- Operation exists -->\n <template v-if=\"path && method && exampleName && operation && document\">\n <OperationBlock\n ref=\"container\"\n :activeEnvironment=\"\n workspaceStore.workspace['x-scalar-active-environment']\n \"\n :appVersion=\"APP_VERSION\"\n :authMeta\n :defaultHeaders\n :dir=\"direction\"\n :document\n :documentCookies\n :documentSecurity=\"document?.security ?? []\"\n :documentSlug\n :documentUrl=\"document?.['x-scalar-original-source-url']\"\n :environment\n :environments\n :eventBus\n :exampleKey=\"exampleName\"\n :externalExamplesFailed=\"externalExamples.failed.value\"\n :externalExamplesPending=\"externalExamples.pending.value\"\n :hideClientButton=\"toValue(options)?.hideClientButton ?? false\"\n :history=\"workspaceStore.history.getHistory(documentSlug, path, method)\"\n :httpClients\n :isWebhook\n :lang=\"locale\"\n :layout\n :method\n :operation\n :options\n :path\n :plugins=\"plugins\"\n :proxyUrl=\"\n getActiveProxyUrl(\n workspaceStore.workspace['x-scalar-active-proxy'],\n layout === 'web' ? 'web' : 'other',\n ) ?? ''\n \"\n :requestBodyCompositionSelection\n :securityRequirements=\"securityRequirements\"\n :securitySchemes\n :selectedClient=\"workspaceStore.workspace['x-scalar-default-client']\"\n :selectedSecurity=\"selectedSecurity\"\n :selectedSecuritySchemes=\"selectedSecuritySchemes\"\n :server=\"selectedServer\"\n :serverMeta\n :servers\n :sourceOperation=\"sourceOperation ?? undefined\"\n :workspaceCookies\n @retry:externalExamples=\"externalExamples.retry\" />\n </template>\n\n <!-- Empty state -->\n <div\n v-else\n class=\"flex h-full w-full items-center justify-center\"\n :dir=\"direction\"\n :lang=\"locale\">\n <span class=\"text-c-3\">{{\n translate('apiClient.operation.selectAnOperationToViewDetails')\n }}</span>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuGA,MAAM,wBAAwB,gBAAgB;EAC9C,MAAM,EAAE,WAAW,QAAQ,cAAc,0BAErC,QAAQ,QAAA,OAAO,CAAC,EAAE,gBAAgB;GAChC,QAAQ,sBAAsB,OAAO;GACrC,WAAW,sBAAsB,UAAU;GAC3C,cAAc,sBAAsB,aAAa;EACnD,CACJ;;;;;EAMA,MAAM,iBAAiB,eAAe;GACpC,IAAI,CAAC,QAAA,QAAQ,CAAC,QAAA,UAAU,CAAC,QAAA,eAAe,CAAC,QAAA,UACvC,OAAO;GAGT,MAAM,SAAS,yBACb,QAAA,gBACA,QAAA,cACA;IAAE,MAAG,QAAA;IAAG,QAAK,QAAA;IA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AAc,QAAA,MAAM,QAAA,MAAM;IACrE,aAAA,YAAA;IACA,WAAA,QAAA;IACA,MAAM,MAAA,MAAA;IACN,QAAA,QAAA;IACA,QAAA,QAAA;IACA,WAAA,UAAA;IACA,SAAA,QAAA;IACA,MAAA,QAAA;IACA,SAAS,QAAA;IACT,UAAmB,MAAA,iBAAA,CAAiB,CAAY,QAAA,eAAe,UAAS,0BAAqC,QAAA,WAAM,QAAA,QAAA,OAAA,KAAA;IAMnH,iCAAA,QAAA;IACA,sBAAsB,qBAAA;IACtB,iBAAA,gBAAA;IACA,gBAAgB,QAAA,eAAe,UAAS;IACxC,kBAAkB,iBAAA;IAClB,yBAAyB,wBAAA;IACzB,QAAQ,eAAA;IACR,YAAA,WAAA;IACA,SAAA,QAAA;IACA,iBAAiB,gBAAA,SAAmB,KAAA;IACpC,kBAAA,iBAAA;IACA,4BAAwB,MAAA,gBAAA,CAAgB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAI9C,mBAQM,OAAA;;IANJ,OAAM;IACL,KAAK,MAAA,SAAA;IACL,MAAM,MAAA,MAAA;OACP,mBAES,QAFT,YAES,gBADP,MAAA,SAAA,CAAS,CAAA,oDAAA,CAAA,GAAA,CAAA,CAAA,GAAA,GAAA,UAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentSearchModal.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/search/components/DocumentSearchModal.vue"],"names":[],"mappings":"AAyJA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AAQnG,KAAK,WAAW,GAAG;IACjB,mDAAmD;IACnD,UAAU,EAAE,UAAU,CAAA;IACtB,qDAAqD;IACrD,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAA;CACtC,CAAC;AAqQF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"DocumentSearchModal.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/search/components/DocumentSearchModal.vue"],"names":[],"mappings":"AA6JA,OAAO,EAAe,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAGvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAA;AASnG,KAAK,WAAW,GAAG;IACjB,mDAAmD;IACnD,UAAU,EAAE,UAAU,CAAA;IACtB,qDAAqD;IACrD,QAAQ,EAAE,eAAe,GAAG,SAAS,CAAA;CACtC,CAAC;AAiRF,QAAA,MAAM,YAAY;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
2
2
  import DocumentSearchModal_vue_vue_type_script_setup_true_lang_default from "./DocumentSearchModal.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/features/search/components/DocumentSearchModal.vue
5
- var DocumentSearchModal_default = /*#__PURE__*/ _plugin_vue_export_helper_default(DocumentSearchModal_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-89ab8a2d"]]);
5
+ var DocumentSearchModal_default = /*#__PURE__*/ _plugin_vue_export_helper_default(DocumentSearchModal_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-6ea0d1fb"]]);
6
6
  //#endregion
7
7
  export { DocumentSearchModal_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentSearchModal.vue.js","names":[],"sources":["../../../../../src/v2/features/search/components/DocumentSearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { nanoid } from 'nanoid'\nimport { computed, ref, watch } from 'vue'\n\nimport { useDocumentSearch } from '@/v2/features/search/hooks/use-document-search'\n\nimport SearchResult from './SearchResult.vue'\n\nconst props = defineProps<{\n /** Controls the visibility of the search modal. */\n modalState: ModalState\n /** The document whose entries should be searched. */\n document: OpenApiDocument | undefined\n}>()\n\nconst emit = defineEmits<{\n /** Emitted when the user picks a result, passing the navigation id. */\n (e: 'select', id: string): void\n}>()\n\n/** Base id for the search form. */\nconst id = nanoid()\nconst listboxId = `${id}-search-result`\nconst instructionsId = `${id}-search-instructions`\n\nconst { query, results } = useDocumentSearch(() => props.document)\n\nconst selectedIndex = ref<number | undefined>(undefined)\n\n/**\n * Reset the query every time the modal is opened so users always start from a\n * clean state. Matches the reference search modal behaviour.\n */\nwatch(\n () => props.modalState.open,\n (open) => {\n if (open) {\n query.value = ''\n selectedIndex.value = undefined\n }\n },\n)\n\n/** Keyboard navigation, wrapping around the ends of the result list. */\nconst navigateSearchResults = (direction: 'up' | 'down') => {\n const offset = direction === 'up' ? -1 : 1\n const length = results.value.length\n if (length === 0) {\n return\n }\n\n if (typeof selectedIndex.value === 'number') {\n selectedIndex.value = (selectedIndex.value + offset + length) % length\n return\n }\n\n selectedIndex.value = offset === -1 ? length - 1 : 0\n}\n\nfunction handleSelect(idx: number | undefined) {\n if (typeof idx !== 'number' || !results.value[idx]) {\n return\n }\n\n const result = results.value[idx]\n props.modalState.hide()\n emit('select', result.item.id)\n}\n\n/**\n * aria-activedescendant for the combobox. Each result item must render the\n * matching id for assistive tech to announce the selection correctly.\n */\nconst activeDescendantId = computed(() => {\n const selectedResult = results.value[selectedIndex.value ?? -1]\n return selectedResult ? `search-result-${selectedResult.item.id}` : undefined\n})\n</script>\n\n<template>\n <ScalarModal\n aria-label=\"Document Search\"\n :state=\"modalState\"\n variant=\"search\">\n <div\n class=\"mb-0 flex flex-col\"\n role=\"search\">\n <ScalarSearchInput\n v-model=\"query\"\n :aria-activedescendant=\"activeDescendantId\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-describedby=\"instructionsId\"\n role=\"combobox\"\n @blur=\"selectedIndex = undefined\"\n @keydown.down.stop.prevent=\"navigateSearchResults('down')\"\n @keydown.enter.stop.prevent=\"() => handleSelect(selectedIndex)\"\n @keydown.up.stop.prevent=\"navigateSearchResults('up')\" />\n </div>\n <ScalarSearchResultList\n :id=\"listboxId\"\n aria-label=\"Document Search Results\"\n class=\"custom-scroll px-1 pb-1\"\n :noResults=\"!results.length\">\n <template #query>\n {{ query }}\n </template>\n <SearchResult\n v-for=\"(result, idx) in results\"\n :id=\"`search-result-${result.item.id}`\"\n :key=\"result.refIndex\"\n :isSelected=\"selectedIndex === idx\"\n :result=\"result\"\n @click.prevent=\"() => handleSelect(idx)\" />\n </ScalarSearchResultList>\n <div\n :id=\"instructionsId\"\n class=\"ref-search-meta\">\n <span\n aria-hidden=\"true\"\n class=\"contents\">\n <span>↑↓ Navigate</span>\n <span>⏎ Select</span>\n </span>\n <span class=\"sr-only\">\n Press up arrow / down arrow to navigate, enter to select, type to filter\n results\n </span>\n </div>\n </ScalarModal>\n</template>\n\n<style scoped>\n.ref-search-meta {\n background: var(--scalar-background-1);\n border-bottom-left-radius: var(--scalar-radius-lg);\n border-bottom-right-radius: var(--scalar-radius-lg);\n padding: 6px 12px;\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-3);\n font-weight: var(--scalar-semibold);\n display: flex;\n gap: 12px;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"DocumentSearchModal.vue.js","names":[],"sources":["../../../../../src/v2/features/search/components/DocumentSearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { nanoid } from 'nanoid'\nimport { computed, ref, watch } from 'vue'\n\nimport { useLocalization } from '@/v2/features/localization'\nimport { useDocumentSearch } from '@/v2/features/search/hooks/use-document-search'\n\nimport SearchResult from './SearchResult.vue'\n\nconst props = defineProps<{\n /** Controls the visibility of the search modal. */\n modalState: ModalState\n /** The document whose entries should be searched. */\n document: OpenApiDocument | undefined\n}>()\n\nconst emit = defineEmits<{\n /** Emitted when the user picks a result, passing the navigation id. */\n (e: 'select', id: string): void\n}>()\n\nconst { translate } = useLocalization()\n\n/** Base id for the search form. */\nconst id = nanoid()\nconst listboxId = `${id}-search-result`\nconst instructionsId = `${id}-search-instructions`\n\nconst { query, results } = useDocumentSearch(() => props.document)\n\nconst selectedIndex = ref<number | undefined>(undefined)\n\n/**\n * Reset the query every time the modal is opened so users always start from a\n * clean state. Matches the reference search modal behaviour.\n */\nwatch(\n () => props.modalState.open,\n (open) => {\n if (open) {\n query.value = ''\n selectedIndex.value = undefined\n }\n },\n)\n\n/** Keyboard navigation, wrapping around the ends of the result list. */\nconst navigateSearchResults = (direction: 'up' | 'down') => {\n const offset = direction === 'up' ? -1 : 1\n const length = results.value.length\n if (length === 0) {\n return\n }\n\n if (typeof selectedIndex.value === 'number') {\n selectedIndex.value = (selectedIndex.value + offset + length) % length\n return\n }\n\n selectedIndex.value = offset === -1 ? length - 1 : 0\n}\n\nfunction handleSelect(idx: number | undefined) {\n if (typeof idx !== 'number' || !results.value[idx]) {\n return\n }\n\n const result = results.value[idx]\n props.modalState.hide()\n emit('select', result.item.id)\n}\n\n/**\n * aria-activedescendant for the combobox. Each result item must render the\n * matching id for assistive tech to announce the selection correctly.\n */\nconst activeDescendantId = computed(() => {\n const selectedResult = results.value[selectedIndex.value ?? -1]\n return selectedResult ? `search-result-${selectedResult.item.id}` : undefined\n})\n</script>\n\n<template>\n <ScalarModal\n :aria-label=\"translate('apiClient.documentSearchModal.documentSearch')\"\n :state=\"modalState\"\n variant=\"search\">\n <div\n class=\"mb-0 flex flex-col\"\n role=\"search\">\n <ScalarSearchInput\n v-model=\"query\"\n :aria-activedescendant=\"activeDescendantId\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-describedby=\"instructionsId\"\n role=\"combobox\"\n @blur=\"selectedIndex = undefined\"\n @keydown.down.stop.prevent=\"navigateSearchResults('down')\"\n @keydown.enter.stop.prevent=\"() => handleSelect(selectedIndex)\"\n @keydown.up.stop.prevent=\"navigateSearchResults('up')\" />\n </div>\n <ScalarSearchResultList\n :id=\"listboxId\"\n :aria-label=\"\n translate('apiClient.documentSearchModal.documentSearchResults')\n \"\n class=\"custom-scroll px-1 pb-1\"\n :noResults=\"!results.length\">\n <template #query>\n {{ query }}\n </template>\n <SearchResult\n v-for=\"(result, idx) in results\"\n :id=\"`search-result-${result.item.id}`\"\n :key=\"result.refIndex\"\n :isSelected=\"selectedIndex === idx\"\n :result=\"result\"\n @click.prevent=\"() => handleSelect(idx)\" />\n </ScalarSearchResultList>\n <div\n :id=\"instructionsId\"\n class=\"ref-search-meta\">\n <span\n aria-hidden=\"true\"\n class=\"contents\">\n <span>{{ translate('apiClient.documentSearchModal.navigate') }}</span>\n <span>{{ translate('apiClient.documentSearchModal.select') }}</span>\n </span>\n <span class=\"sr-only\">{{\n translate('apiClient.documentSearchModal.keyboardInstructions')\n }}</span>\n </div>\n </ScalarModal>\n</template>\n\n<style scoped>\n.ref-search-meta {\n background: var(--scalar-background-1);\n border-bottom-left-radius: var(--scalar-radius-lg);\n border-bottom-right-radius: var(--scalar-radius-lg);\n padding: 6px 12px;\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-3);\n font-weight: var(--scalar-semibold);\n display: flex;\n gap: 12px;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n</style>\n"],"mappings":""}
@@ -1,3 +1,4 @@
1
+ import { useLocalization } from "../../localization/index.js";
1
2
  import { useDocumentSearch } from "../hooks/use-document-search.js";
2
3
  import SearchResult_default from "./SearchResult.vue.js";
3
4
  import { Fragment, computed, createBlock, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, isRef, openBlock, ref, renderList, toDisplayString, unref, watch, withCtx, withKeys, withModifiers } from "vue";
@@ -10,6 +11,11 @@ var _hoisted_1 = {
10
11
  class: "mb-0 flex flex-col",
11
12
  role: "search"
12
13
  };
14
+ var _hoisted_2 = {
15
+ "aria-hidden": "true",
16
+ class: "contents"
17
+ };
18
+ var _hoisted_3 = { class: "sr-only" };
13
19
  var DocumentSearchModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ defineComponent({
14
20
  __name: "DocumentSearchModal",
15
21
  props: {
@@ -20,6 +26,7 @@ var DocumentSearchModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
20
26
  setup(__props, { emit: __emit }) {
21
27
  const props = __props;
22
28
  const emit = __emit;
29
+ const { translate } = useLocalization();
23
30
  /** Base id for the search form. */
24
31
  const id = nanoid();
25
32
  const listboxId = `${id}-search-result`;
@@ -63,7 +70,7 @@ var DocumentSearchModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
63
70
  });
64
71
  return (_ctx, _cache) => {
65
72
  return openBlock(), createBlock(unref(ScalarModal), {
66
- "aria-label": "Document Search",
73
+ "aria-label": unref(translate)("apiClient.documentSearchModal.documentSearch"),
67
74
  state: __props.modalState,
68
75
  variant: "search"
69
76
  }, {
@@ -85,7 +92,7 @@ var DocumentSearchModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
85
92
  }, null, 8, ["modelValue", "aria-activedescendant"])]),
86
93
  createVNode(unref(ScalarSearchResultList), {
87
94
  id: listboxId,
88
- "aria-label": "Document Search Results",
95
+ "aria-label": unref(translate)("apiClient.documentSearchModal.documentSearchResults"),
89
96
  class: "custom-scroll px-1 pb-1",
90
97
  noResults: !unref(results).length
91
98
  }, {
@@ -105,17 +112,14 @@ var DocumentSearchModal_vue_vue_type_script_setup_true_lang_default = /*@__PURE_
105
112
  ]);
106
113
  }), 128))]),
107
114
  _: 1
108
- }, 8, ["noResults"]),
115
+ }, 8, ["aria-label", "noResults"]),
109
116
  createElementVNode("div", {
110
117
  id: instructionsId,
111
118
  class: "ref-search-meta"
112
- }, [..._cache[5] || (_cache[5] = [createElementVNode("span", {
113
- "aria-hidden": "true",
114
- class: "contents"
115
- }, [createElementVNode("span", null, "↑↓ Navigate"), createElementVNode("span", null, "⏎ Select")], -1), createElementVNode("span", { class: "sr-only" }, " Press up arrow / down arrow to navigate, enter to select, type to filter results ", -1)])])
119
+ }, [createElementVNode("span", _hoisted_2, [createElementVNode("span", null, toDisplayString(unref(translate)("apiClient.documentSearchModal.navigate")), 1), createElementVNode("span", null, toDisplayString(unref(translate)("apiClient.documentSearchModal.select")), 1)]), createElementVNode("span", _hoisted_3, toDisplayString(unref(translate)("apiClient.documentSearchModal.keyboardInstructions")), 1)])
116
120
  ]),
117
121
  _: 1
118
- }, 8, ["state"]);
122
+ }, 8, ["aria-label", "state"]);
119
123
  };
120
124
  }
121
125
  });
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentSearchModal.vue.script.js","names":[],"sources":["../../../../../src/v2/features/search/components/DocumentSearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { nanoid } from 'nanoid'\nimport { computed, ref, watch } from 'vue'\n\nimport { useDocumentSearch } from '@/v2/features/search/hooks/use-document-search'\n\nimport SearchResult from './SearchResult.vue'\n\nconst props = defineProps<{\n /** Controls the visibility of the search modal. */\n modalState: ModalState\n /** The document whose entries should be searched. */\n document: OpenApiDocument | undefined\n}>()\n\nconst emit = defineEmits<{\n /** Emitted when the user picks a result, passing the navigation id. */\n (e: 'select', id: string): void\n}>()\n\n/** Base id for the search form. */\nconst id = nanoid()\nconst listboxId = `${id}-search-result`\nconst instructionsId = `${id}-search-instructions`\n\nconst { query, results } = useDocumentSearch(() => props.document)\n\nconst selectedIndex = ref<number | undefined>(undefined)\n\n/**\n * Reset the query every time the modal is opened so users always start from a\n * clean state. Matches the reference search modal behaviour.\n */\nwatch(\n () => props.modalState.open,\n (open) => {\n if (open) {\n query.value = ''\n selectedIndex.value = undefined\n }\n },\n)\n\n/** Keyboard navigation, wrapping around the ends of the result list. */\nconst navigateSearchResults = (direction: 'up' | 'down') => {\n const offset = direction === 'up' ? -1 : 1\n const length = results.value.length\n if (length === 0) {\n return\n }\n\n if (typeof selectedIndex.value === 'number') {\n selectedIndex.value = (selectedIndex.value + offset + length) % length\n return\n }\n\n selectedIndex.value = offset === -1 ? length - 1 : 0\n}\n\nfunction handleSelect(idx: number | undefined) {\n if (typeof idx !== 'number' || !results.value[idx]) {\n return\n }\n\n const result = results.value[idx]\n props.modalState.hide()\n emit('select', result.item.id)\n}\n\n/**\n * aria-activedescendant for the combobox. Each result item must render the\n * matching id for assistive tech to announce the selection correctly.\n */\nconst activeDescendantId = computed(() => {\n const selectedResult = results.value[selectedIndex.value ?? -1]\n return selectedResult ? `search-result-${selectedResult.item.id}` : undefined\n})\n</script>\n\n<template>\n <ScalarModal\n aria-label=\"Document Search\"\n :state=\"modalState\"\n variant=\"search\">\n <div\n class=\"mb-0 flex flex-col\"\n role=\"search\">\n <ScalarSearchInput\n v-model=\"query\"\n :aria-activedescendant=\"activeDescendantId\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-describedby=\"instructionsId\"\n role=\"combobox\"\n @blur=\"selectedIndex = undefined\"\n @keydown.down.stop.prevent=\"navigateSearchResults('down')\"\n @keydown.enter.stop.prevent=\"() => handleSelect(selectedIndex)\"\n @keydown.up.stop.prevent=\"navigateSearchResults('up')\" />\n </div>\n <ScalarSearchResultList\n :id=\"listboxId\"\n aria-label=\"Document Search Results\"\n class=\"custom-scroll px-1 pb-1\"\n :noResults=\"!results.length\">\n <template #query>\n {{ query }}\n </template>\n <SearchResult\n v-for=\"(result, idx) in results\"\n :id=\"`search-result-${result.item.id}`\"\n :key=\"result.refIndex\"\n :isSelected=\"selectedIndex === idx\"\n :result=\"result\"\n @click.prevent=\"() => handleSelect(idx)\" />\n </ScalarSearchResultList>\n <div\n :id=\"instructionsId\"\n class=\"ref-search-meta\">\n <span\n aria-hidden=\"true\"\n class=\"contents\">\n <span>↑↓ Navigate</span>\n <span>⏎ Select</span>\n </span>\n <span class=\"sr-only\">\n Press up arrow / down arrow to navigate, enter to select, type to filter\n results\n </span>\n </div>\n </ScalarModal>\n</template>\n\n<style scoped>\n.ref-search-meta {\n background: var(--scalar-background-1);\n border-bottom-left-radius: var(--scalar-radius-lg);\n border-bottom-right-radius: var(--scalar-radius-lg);\n padding: 6px 12px;\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-3);\n font-weight: var(--scalar-semibold);\n display: flex;\n gap: 12px;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;EAYA,MAAM,QAAQ;EAOd,MAAM,OAAO;;EAMb,MAAM,KAAK,OAAO;EAClB,MAAM,YAAY,GAAG,GAAG;EACxB,MAAM,iBAAiB,GAAG,GAAG;EAE7B,MAAM,EAAE,OAAO,YAAY,wBAAwB,MAAM,QAAQ;EAEjE,MAAM,gBAAgB,IAAwB,KAAA,CAAS;;;;;EAMvD,YACQ,MAAM,WAAW,OACtB,SAAS;GACR,IAAI,MAAM;IACR,MAAM,QAAQ;IACd,cAAc,QAAQ,KAAA;GACxB;EACF,CACF;;EAGA,MAAM,yBAAyB,cAA6B;GAC1D,MAAM,SAAS,cAAc,OAAO,KAAK;GACzC,MAAM,SAAS,QAAQ,MAAM;GAC7B,IAAI,WAAW,GACb;GAGF,IAAI,OAAO,cAAc,UAAU,UAAU;IAC3C,cAAc,SAAS,cAAc,QAAQ,SAAS,UAAU;IAChE;GACF;GAEA,cAAc,QAAQ,WAAW,KAAK,SAAS,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,KAAK;QACjC,KAAK,OAAO;QACZ,YAAY,cAAA,UAAkB;QACtB;QACR,SAAK,oBAAgB,aAAa,GAAG,GAAA,CAAA,SAAA,CAAA;;;;;;;;;;KAE1C,mBAaM,OAAA;MAZH,IAAI;MACL,OAAM;uCACN,mBAKO,QAAA;MAJL,eAAY;MACZ,OAAM;SACN,mBAAwB,QAAA,MAAlB,aAAW,GACjB,mBAAqB,QAAA,MAAf,UAAQ,CAAA,GAAA,EAAA,GAEhB,mBAGO,QAAA,EAHD,OAAM,UAAS,GAAC,sFAGtB,EAAA,CAAA,EAAA,CAAA"}
1
+ {"version":3,"file":"DocumentSearchModal.vue.script.js","names":[],"sources":["../../../../../src/v2/features/search/components/DocumentSearchModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarSearchResultList } from '@scalar/components/search-results'\nimport type { OpenApiDocument } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { nanoid } from 'nanoid'\nimport { computed, ref, watch } from 'vue'\n\nimport { useLocalization } from '@/v2/features/localization'\nimport { useDocumentSearch } from '@/v2/features/search/hooks/use-document-search'\n\nimport SearchResult from './SearchResult.vue'\n\nconst props = defineProps<{\n /** Controls the visibility of the search modal. */\n modalState: ModalState\n /** The document whose entries should be searched. */\n document: OpenApiDocument | undefined\n}>()\n\nconst emit = defineEmits<{\n /** Emitted when the user picks a result, passing the navigation id. */\n (e: 'select', id: string): void\n}>()\n\nconst { translate } = useLocalization()\n\n/** Base id for the search form. */\nconst id = nanoid()\nconst listboxId = `${id}-search-result`\nconst instructionsId = `${id}-search-instructions`\n\nconst { query, results } = useDocumentSearch(() => props.document)\n\nconst selectedIndex = ref<number | undefined>(undefined)\n\n/**\n * Reset the query every time the modal is opened so users always start from a\n * clean state. Matches the reference search modal behaviour.\n */\nwatch(\n () => props.modalState.open,\n (open) => {\n if (open) {\n query.value = ''\n selectedIndex.value = undefined\n }\n },\n)\n\n/** Keyboard navigation, wrapping around the ends of the result list. */\nconst navigateSearchResults = (direction: 'up' | 'down') => {\n const offset = direction === 'up' ? -1 : 1\n const length = results.value.length\n if (length === 0) {\n return\n }\n\n if (typeof selectedIndex.value === 'number') {\n selectedIndex.value = (selectedIndex.value + offset + length) % length\n return\n }\n\n selectedIndex.value = offset === -1 ? length - 1 : 0\n}\n\nfunction handleSelect(idx: number | undefined) {\n if (typeof idx !== 'number' || !results.value[idx]) {\n return\n }\n\n const result = results.value[idx]\n props.modalState.hide()\n emit('select', result.item.id)\n}\n\n/**\n * aria-activedescendant for the combobox. Each result item must render the\n * matching id for assistive tech to announce the selection correctly.\n */\nconst activeDescendantId = computed(() => {\n const selectedResult = results.value[selectedIndex.value ?? -1]\n return selectedResult ? `search-result-${selectedResult.item.id}` : undefined\n})\n</script>\n\n<template>\n <ScalarModal\n :aria-label=\"translate('apiClient.documentSearchModal.documentSearch')\"\n :state=\"modalState\"\n variant=\"search\">\n <div\n class=\"mb-0 flex flex-col\"\n role=\"search\">\n <ScalarSearchInput\n v-model=\"query\"\n :aria-activedescendant=\"activeDescendantId\"\n aria-autocomplete=\"list\"\n :aria-controls=\"listboxId\"\n :aria-describedby=\"instructionsId\"\n role=\"combobox\"\n @blur=\"selectedIndex = undefined\"\n @keydown.down.stop.prevent=\"navigateSearchResults('down')\"\n @keydown.enter.stop.prevent=\"() => handleSelect(selectedIndex)\"\n @keydown.up.stop.prevent=\"navigateSearchResults('up')\" />\n </div>\n <ScalarSearchResultList\n :id=\"listboxId\"\n :aria-label=\"\n translate('apiClient.documentSearchModal.documentSearchResults')\n \"\n class=\"custom-scroll px-1 pb-1\"\n :noResults=\"!results.length\">\n <template #query>\n {{ query }}\n </template>\n <SearchResult\n v-for=\"(result, idx) in results\"\n :id=\"`search-result-${result.item.id}`\"\n :key=\"result.refIndex\"\n :isSelected=\"selectedIndex === idx\"\n :result=\"result\"\n @click.prevent=\"() => handleSelect(idx)\" />\n </ScalarSearchResultList>\n <div\n :id=\"instructionsId\"\n class=\"ref-search-meta\">\n <span\n aria-hidden=\"true\"\n class=\"contents\">\n <span>{{ translate('apiClient.documentSearchModal.navigate') }}</span>\n <span>{{ translate('apiClient.documentSearchModal.select') }}</span>\n </span>\n <span class=\"sr-only\">{{\n translate('apiClient.documentSearchModal.keyboardInstructions')\n }}</span>\n </div>\n </ScalarModal>\n</template>\n\n<style scoped>\n.ref-search-meta {\n background: var(--scalar-background-1);\n border-bottom-left-radius: var(--scalar-radius-lg);\n border-bottom-right-radius: var(--scalar-radius-lg);\n padding: 6px 12px;\n font-size: var(--scalar-font-size-4);\n color: var(--scalar-color-3);\n font-weight: var(--scalar-semibold);\n display: flex;\n gap: 12px;\n border-top: var(--scalar-border-width) solid var(--scalar-border-color);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAaA,MAAM,QAAQ;EAOd,MAAM,OAAO;EAKb,MAAM,EAAE,cAAc,gBAAgB;;EAGtC,MAAM,KAAK,OAAO;EAClB,MAAM,YAAY,GAAG,GAAG;EACxB,MAAM,iBAAiB,GAAG,GAAG;EAE7B,MAAM,EAAE,OAAO,YAAY,wBAAwB,MAAM,QAAQ;EAEjE,MAAM,gBAAgB,IAAwB,KAAA,CAAS;;;;;EAMvD,YACQ,MAAM,WAAW,OACtB,SAAS;GACR,IAAI,MAAM;IACR,MAAM,QAAQ;IACd,cAAc,QAAQ,KAAA;GACxB;EACF,CACF;;EAGA,MAAM,yBAAyB,cAA6B;GAC1D,MAAM,SAAS,cAAc,OAAO,KAAK;GACzC,MAAM,SAAS,QAAQ,MAAM;GAC7B,IAAI,WAAW,GACb;GAGF,IAAI,OAAO,cAAc,UAAU,UAAU;IAC3C,cAAc,SAAS,cAAc,QAAQ,SAAS,UAAU;IAChE;GACF;GAEA,cAAc,QAAQ,WAAW,KAAK,SAAS,IAAI;EACrD;EAEA,SAAS,aAAa,KAAyB;GAC7C,IAAI,OAAO,QAA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mB,OAAO,KAAK;QACjC,KAAK,OAAO;QACZ,YAAY,cAAA,UAAkB;QACtB;QACR,SAAK,oBAAgB,aAAa,GAAG,GAAA,CAAA,SAAA,CAAA;;;;;;;;;;KAE1C,mBAYM,OAAA;MAXH,IAAI;MACL,OAAM;SACN,mBAKO,QALP,YAKO,CAFL,mBAAsE,QAAA,MAAA,gBAA7D,MAAA,SAAA,CAAS,CAAA,wCAAA,CAAA,GAAA,CAAA,GAClB,mBAAoE,QAAA,MAAA,gBAA3D,MAAA,SAAA,CAAS,CAAA,sCAAA,CAAA,GAAA,CAAA,CAAA,CAAA,GAEpB,mBAES,QAFT,YAES,gBADP,MAAA,SAAA,CAAS,CAAA,oDAAA,CAAA,GAAA,CAAA,CAAA,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"SearchResult.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/search/components/SearchResult.vue"],"names":[],"mappings":"AAoFA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE1D,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,OAAO,CAAA;IACnB,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;CAC7B,CAAC;AA8HF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"SearchResult.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/search/components/SearchResult.vue"],"names":[],"mappings":"AA6FA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAIzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAA;AAE1D,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,OAAO,CAAA;IACnB,MAAM,EAAE,UAAU,CAAC,QAAQ,CAAC,CAAA;CAC7B,CAAC;AAwIF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}