@scalar/api-client 3.8.2 → 3.8.3

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 (261) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
  3. package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
  4. package/dist/components/HttpMethod/HttpMethod.vue.js.map +1 -1
  5. package/dist/components/HttpMethod/HttpMethod.vue.script.js +2 -1
  6. package/dist/components/HttpMethod/HttpMethod.vue.script.js.map +1 -1
  7. package/dist/components/SectionFilter.vue.js +1 -1
  8. package/dist/components/SectionFilter.vue.js.map +1 -1
  9. package/dist/components/SectionFilter.vue.script.js +1 -1
  10. package/dist/components/SectionFilter.vue.script.js.map +1 -1
  11. package/dist/components/Server/ServerVariablesSelect.vue.js.map +1 -1
  12. package/dist/components/Server/ServerVariablesSelect.vue.script.js +2 -1
  13. package/dist/components/Server/ServerVariablesSelect.vue.script.js.map +1 -1
  14. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js.map +1 -1
  15. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js +1 -1
  16. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js.map +1 -1
  17. package/dist/components/ViewLayout/ViewLayout.vue.js.map +1 -1
  18. package/dist/components/ViewLayout/ViewLayout.vue.script.js +1 -1
  19. package/dist/components/ViewLayout/ViewLayout.vue.script.js.map +1 -1
  20. package/dist/components/ViewLayout/ViewLayoutSection.vue.js.map +1 -1
  21. package/dist/components/ViewLayout/ViewLayoutSection.vue.script.js +1 -1
  22. package/dist/components/ViewLayout/ViewLayoutSection.vue.script.js.map +1 -1
  23. package/dist/style.css +105 -105
  24. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  25. package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
  26. package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
  27. package/dist/v2/blocks/operation-block/components/Header.vue.script.js +6 -1
  28. package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
  29. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.d.ts +4 -0
  30. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.d.ts.map +1 -1
  31. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js +1 -1
  32. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js.map +1 -1
  33. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js +7 -1
  34. package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js.map +1 -1
  35. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js.map +1 -1
  36. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.script.js +2 -1
  37. package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.script.js.map +1 -1
  38. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
  39. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js.map +1 -1
  40. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js +5 -1
  41. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.script.js.map +1 -1
  42. package/dist/v2/blocks/operation-code-sample/helpers/filter-clients-by-query.js.map +1 -1
  43. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
  44. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +171 -15
  45. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js.map +1 -1
  46. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
  47. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +14 -1
  48. package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js.map +1 -1
  49. package/dist/v2/blocks/operation-code-sample/types.d.ts +1 -1
  50. package/dist/v2/blocks/operation-code-sample/types.d.ts.map +1 -1
  51. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  52. package/dist/v2/blocks/request-block/RequestBlock.vue.js.map +1 -1
  53. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +1 -1
  54. package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
  55. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  56. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
  57. package/dist/v2/blocks/request-block/components/RequestBody.vue.js.map +1 -1
  58. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +3 -1
  59. package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
  60. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
  61. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
  62. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +4 -1
  63. package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
  64. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  65. package/dist/v2/blocks/request-block/components/RequestParams.vue.js.map +1 -1
  66. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js +2 -1
  67. package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js.map +1 -1
  68. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  69. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
  70. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +3 -1
  71. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
  72. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
  73. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js.map +1 -1
  74. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js +2 -1
  75. package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js.map +1 -1
  76. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
  77. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +74 -3
  78. package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
  79. package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
  80. package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
  81. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +1 -1
  82. package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
  83. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.js.map +1 -1
  84. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js +1 -1
  85. package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js.map +1 -1
  86. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts.map +1 -1
  87. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js +1 -1
  88. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js.map +1 -1
  89. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js +54 -12
  90. package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js.map +1 -1
  91. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.js +1 -1
  92. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.js.map +1 -1
  93. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.script.js +1 -1
  94. package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.script.js.map +1 -1
  95. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
  96. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js.map +1 -1
  97. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js +2 -1
  98. package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js.map +1 -1
  99. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.js.map +1 -1
  100. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js +1 -1
  101. package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js.map +1 -1
  102. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
  103. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js.map +1 -1
  104. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js +1 -1
  105. package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js.map +1 -1
  106. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
  107. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +1 -1
  108. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js.map +1 -1
  109. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js +2 -1
  110. package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js.map +1 -1
  111. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  112. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  113. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
  114. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +19 -4
  115. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
  116. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
  117. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js.map +1 -1
  118. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +2 -1
  119. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
  120. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js.map +1 -1
  121. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +3 -1
  122. package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
  123. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +1 -1
  124. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  125. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js.map +1 -1
  126. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +5 -1
  127. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
  128. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -1
  129. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js.map +1 -1
  130. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js +2 -1
  131. package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js.map +1 -1
  132. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  133. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js.map +1 -1
  134. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +2 -1
  135. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
  136. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts +1 -1
  137. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
  138. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.js.map +1 -1
  139. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js +1 -1
  140. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js.map +1 -1
  141. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
  142. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js.map +1 -1
  143. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js +5 -1
  144. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map +1 -1
  145. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -1
  146. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js.map +1 -1
  147. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js +2 -1
  148. package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map +1 -1
  149. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js.map +1 -1
  150. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +1 -1
  151. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
  152. package/dist/v2/components/code-input/PillTooltipHost.vue.js.map +1 -1
  153. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js +1 -1
  154. package/dist/v2/components/code-input/PillTooltipHost.vue.script.js.map +1 -1
  155. package/dist/v2/components/data-table/DataTable.vue.js.map +1 -1
  156. package/dist/v2/components/data-table/DataTable.vue.script.js +1 -1
  157. package/dist/v2/components/data-table/DataTable.vue.script.js.map +1 -1
  158. package/dist/v2/components/data-table/DataTableCell.vue.js.map +1 -1
  159. package/dist/v2/components/data-table/DataTableCell.vue.script.js +1 -1
  160. package/dist/v2/components/data-table/DataTableCell.vue.script.js.map +1 -1
  161. package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts.map +1 -1
  162. package/dist/v2/components/data-table/DataTableCheckbox.vue.js.map +1 -1
  163. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js +2 -1
  164. package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js.map +1 -1
  165. package/dist/v2/components/data-table/DataTableHeader.vue.js.map +1 -1
  166. package/dist/v2/components/data-table/DataTableHeader.vue.script.js +1 -1
  167. package/dist/v2/components/data-table/DataTableHeader.vue.script.js.map +1 -1
  168. package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
  169. package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
  170. package/dist/v2/components/data-table/DataTableInput.vue.script.js +1 -1
  171. package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
  172. package/dist/v2/components/data-table/DataTableInputSelect.vue.js.map +1 -1
  173. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js +4 -1
  174. package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js.map +1 -1
  175. package/dist/v2/components/forms/ConfirmationForm.vue.js.map +1 -1
  176. package/dist/v2/components/forms/ConfirmationForm.vue.script.js +1 -1
  177. package/dist/v2/components/forms/ConfirmationForm.vue.script.js.map +1 -1
  178. package/dist/v2/components/layout/CollapsibleSection.vue.js.map +1 -1
  179. package/dist/v2/components/layout/CollapsibleSection.vue.script.js +1 -1
  180. package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
  181. package/dist/v2/components/modals/ModalClientContainer.vue.d.ts +1 -1
  182. package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
  183. package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
  184. package/dist/v2/components/modals/ModalClientContainer.vue.js.map +1 -1
  185. package/dist/v2/components/modals/ModalClientContainer.vue.script.js +2 -1
  186. package/dist/v2/components/modals/ModalClientContainer.vue.script.js.map +1 -1
  187. package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
  188. package/dist/v2/components/server/ServerDropdown.vue.js.map +1 -1
  189. package/dist/v2/components/server/ServerDropdown.vue.script.js +3 -1
  190. package/dist/v2/components/server/ServerDropdown.vue.script.js.map +1 -1
  191. package/dist/v2/components/server/ServerDropdownItem.vue.d.ts.map +1 -1
  192. package/dist/v2/components/server/ServerDropdownItem.vue.js +1 -1
  193. package/dist/v2/components/server/ServerDropdownItem.vue.js.map +1 -1
  194. package/dist/v2/components/server/ServerDropdownItem.vue.script.js +2 -1
  195. package/dist/v2/components/server/ServerDropdownItem.vue.script.js.map +1 -1
  196. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +1 -1
  197. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  198. package/dist/v2/components/sidebar/Sidebar.vue.js.map +1 -1
  199. package/dist/v2/components/sidebar/Sidebar.vue.script.js +2 -1
  200. package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
  201. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +1 -1
  202. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  203. package/dist/v2/components/sidebar/SidebarMenu.vue.js.map +1 -1
  204. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js +1 -1
  205. package/dist/v2/components/sidebar/SidebarMenu.vue.script.js.map +1 -1
  206. package/dist/v2/constants.js +1 -1
  207. package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts +1 -1
  208. package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -1
  209. package/dist/v2/features/command-palette/components/CommandActionForm.vue.js.map +1 -1
  210. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js +2 -1
  211. package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js.map +1 -1
  212. package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
  213. package/dist/v2/features/environments/EnvironmentsList.vue.js.map +1 -1
  214. package/dist/v2/features/environments/EnvironmentsList.vue.script.js +2 -1
  215. package/dist/v2/features/environments/EnvironmentsList.vue.script.js.map +1 -1
  216. package/dist/v2/features/environments/components/Environment.vue.js.map +1 -1
  217. package/dist/v2/features/environments/components/Environment.vue.script.js +1 -1
  218. package/dist/v2/features/environments/components/Environment.vue.script.js.map +1 -1
  219. package/dist/v2/features/environments/components/EnvironmentColors.vue.js.map +1 -1
  220. package/dist/v2/features/environments/components/EnvironmentColors.vue.script.js +1 -1
  221. package/dist/v2/features/environments/components/EnvironmentColors.vue.script.js.map +1 -1
  222. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.d.ts +1 -1
  223. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.d.ts.map +1 -1
  224. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.js.map +1 -1
  225. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js +1 -1
  226. package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js.map +1 -1
  227. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts +1 -1
  228. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts.map +1 -1
  229. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.js.map +1 -1
  230. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js +2 -1
  231. package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js.map +1 -1
  232. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
  233. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
  234. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +2 -1
  235. package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
  236. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +1 -1
  237. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js.map +1 -1
  238. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js +1 -1
  239. package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js.map +1 -1
  240. package/dist/v2/features/modal/Modal.vue.d.ts +1 -1
  241. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  242. package/dist/v2/features/modal/Modal.vue.js.map +1 -1
  243. package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
  244. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +1 -1
  245. package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
  246. package/dist/v2/features/modal/helpers/create-api-client-modal.js +1 -1
  247. package/dist/v2/features/modal/helpers/create-api-client-modal.js.map +1 -1
  248. package/dist/v2/features/modal/modal-events.d.ts +1 -1
  249. package/dist/v2/features/modal/modal-events.d.ts.map +1 -1
  250. package/dist/v2/features/modal/modal-events.js.map +1 -1
  251. package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts +1 -1
  252. package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -1
  253. package/dist/v2/features/search/components/DocumentSearchModal.vue.js +1 -1
  254. package/dist/v2/features/search/components/DocumentSearchModal.vue.js.map +1 -1
  255. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +3 -1
  256. package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -1
  257. package/dist/v2/features/search/components/SearchResult.vue.js.map +1 -1
  258. package/dist/v2/features/search/components/SearchResult.vue.script.js +1 -1
  259. package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -1
  260. package/dist/vue-styles.css +105 -105
  261. package/package.json +10 -10
@@ -1 +1 @@
1
- {"version":3,"file":"RequestTableRow.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/components/RequestTableRow.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton, ScalarIcon, ScalarIconButton } from '@scalar/components'\nimport { ScalarIconGlobe, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n ParameterObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, watch } from 'vue'\n\nimport { getFileName } from '@/v2/blocks/request-block/helpers/files'\nimport { validateParameter } from '@/v2/blocks/request-block/helpers/validate-parameter'\nimport { CodeInput } from '@/v2/components/code-input'\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\n\nimport RequestTableTooltip from './RequestTableTooltip.vue'\n\nexport type TableRow = {\n /** The parameter or field name/key */\n name: string\n /** The parameter value, can be a string, file, or null */\n value: string | File | null\n /** Optional description for the parameter */\n description?: string\n /** Optional route for global parameters (e.g., cookies shared across workspace) */\n globalRoute?: ApiReferenceEvents['ui:navigate']\n /** Whether the parameter is disabled/inactive */\n isDisabled?: boolean\n /** OpenAPI schema object with type, validation rules, examples, etc. */\n schema?: SchemaObject\n /** Whether the parameter is required */\n isRequired?: boolean\n /**\n * Whether the parameter is readonly and can not be modifies directly\n * User can still override the parameter which is going to show up with the linethrough style\n */\n isReadonly?: boolean\n /** Whether the parameter is overridden later on */\n isOverridden?: boolean\n /** Track the original parameter so we can update it */\n originalParameter?: ParameterObject\n /** Path to a value inside the original parameter example for expanded object parameters */\n sourceParameterValuePath?: string[]\n}\n\nconst {\n data,\n environment,\n hasCheckboxDisabled,\n invalidParams,\n showUploadButton,\n} = defineProps<{\n data: TableRow\n hasCheckboxDisabled?: boolean\n invalidParams?: Set<string>\n label?: string\n environment: XScalarEnvironment\n showUploadButton?: boolean\n}>()\n\nconst emit = defineEmits<{\n (\n e: 'upsertRow',\n payload: { name: string; value: string | File; isDisabled: boolean },\n ): void\n (e: 'deleteRow'): void\n (e: 'uploadFile'): void\n (e: 'removeFile'): void\n (e: 'navigate', route: NonNullable<TableRow['globalRoute']>): void\n}>()\n\n/**\n * Track local state for the row\n *\n * Now this is required because of the way we get default values from the schema.\n * If we have a default value in data.value, then we update isDisabled to true. We lose the default value since now\n * we have an example where value: ''. This is why we need to track the local state and update all of the params at the\n * same time.\n */\nconst name = ref<string>(data.name ?? '')\nconst value = ref<string | File>(unpackProxyObject(data.value) ?? '')\nconst isDisabled = ref<boolean>(data.isDisabled ?? false)\n\n// Keep the above state synced with the data prop\nwatch(\n () => data.name,\n (newName) => (name.value = newName ?? ''),\n)\nwatch(\n () => data.value,\n (newValue) => (value.value = unpackProxyObject(newValue) ?? ''),\n)\nwatch(\n () => data.isDisabled,\n (newIsDisabled) => (isDisabled.value = newIsDisabled ?? false),\n)\n\n/** Check if the value is a File instance */\nconst isFile = computed(() => value.value instanceof File)\n\n/** Display value handles File instances and shows filename instead */\nconst displayValue = computed(\n () =>\n (isFile.value\n ? getFileName(value.value as File)\n : (value.value as string)) ?? '',\n)\n\nconst defaultValue = computed(() => data.schema?.default as string)\n\n/** See if we can extract enum values from the schema */\nconst enumValue = computed<string[]>(() => {\n if (!data.schema) {\n return []\n }\n\n // Grab the enum from the schema\n if (data.schema.enum) {\n return data.schema.enum.map((item) => String(item))\n }\n\n // Grab the enum from the items schema\n if ('items' in data.schema) {\n const resolved = resolve.schema(data.schema.items)\n if (resolved?.enum) {\n return resolved.enum.map((item) => String(item))\n }\n }\n\n return []\n})\n\nconst minimumValue = computed(() =>\n data.schema && 'minimum' in data.schema ? data.schema.minimum : undefined,\n)\nconst maximumValue = computed(() =>\n data.schema && 'maximum' in data.schema ? data.schema.maximum : undefined,\n)\nconst typeValue = computed(() =>\n data.schema && 'type' in data.schema ? data.schema.type : undefined,\n)\n\nconst validationResult = computed(() =>\n validateParameter(data.schema, value.value),\n)\n\n/** Handle row updates while preserving existing properties */\nconst handleUpdateRow = (\n payload: Partial<{ name: string; value: string; isDisabled: boolean }>,\n): void => {\n // Update our local state\n if (payload.name !== undefined) {\n name.value = payload.name\n }\n if (payload.value !== undefined) {\n value.value = payload.value\n }\n\n // Is disabled should always be false unless you explicitly set it to true\n isDisabled.value = payload.isDisabled ?? false\n\n // Emit all of the local state\n emit('upsertRow', {\n name: name.value,\n value: value.value,\n isDisabled: isDisabled.value,\n })\n}\n</script>\n\n<template>\n <DataTableRow\n :id=\"data.name\"\n :class=\"{\n alert: validationResult.ok === false,\n error: validationResult.ok === false && invalidParams?.has(data.name),\n }\">\n <DataTableCheckbox\n class=\"!border-r\"\n :disabled=\"hasCheckboxDisabled ?? false\"\n :modelValue=\"!isDisabled\"\n @update:modelValue=\"(v) => handleUpdateRow({ isDisabled: !v })\" />\n\n <!-- Name -->\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Key`\"\n disableCloseBrackets\n :disabled=\"data.isReadonly\"\n disableEnter\n disableTabIndent\n :environment=\"environment\"\n lineWrapping\n :modelValue=\"name\"\n placeholder=\"Key\"\n :required=\"Boolean(data.isRequired)\"\n @navigate=\"(route) => emit('navigate', route)\"\n @selectVariable=\"(v: string) => handleUpdateRow({ name: v })\"\n @update:modelValue=\"(v) => handleUpdateRow({ name: v })\" />\n </DataTableCell>\n\n <!-- Value -->\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Value`\"\n class=\"pr-6 group-hover:pr-10 group-has-[.cm-focused]:pr-10\"\n :default=\"defaultValue\"\n disableCloseBrackets\n :disabled=\"data.isReadonly\"\n disableEnter\n disableTabIndent\n :enum=\"enumValue\"\n :environment=\"environment\"\n :examples=\"\n data.schema?.examples?.map((example) => String(example)) ?? []\n \"\n :linethrough=\"data.isOverridden\"\n lineWrapping\n :max=\"maximumValue\"\n :min=\"minimumValue\"\n :modelValue=\"displayValue\"\n placeholder=\"Value\"\n :type=\"typeValue\"\n withFakeData\n @navigate=\"(route) => emit('navigate', route)\"\n @update:modelValue=\"(v) => handleUpdateRow({ value: v })\">\n <template #icon>\n <ScalarButton\n v-if=\"\n Boolean(data.name || value) &&\n !data.isRequired &&\n data.isReadonly !== true\n \"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context -mr-0.5 hidden h-fit rounded p-1 group-hover:flex group-has-[.cm-focused]:flex\"\n size=\"sm\"\n variant=\"ghost\"\n @click=\"emit('deleteRow')\">\n <ScalarIconTrash class=\"size-3.5\" />\n </ScalarButton>\n\n <ScalarIconButton\n v-if=\"data.globalRoute !== undefined\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context -mr-0.5 h-fit\"\n :icon=\"ScalarIconGlobe\"\n label=\"Global cookies are shared across the whole workspace. Click to navigate.\"\n size=\"xs\"\n tooltip=\"top\"\n variant=\"ghost\"\n @click=\"emit('navigate', data.globalRoute)\" />\n\n <RequestTableTooltip\n v-if=\"data.isReadonly\"\n description=\"This is a readonly property and you can not modify it! If you want to change it you have to override it or disable it using the checkbox\"\n :value=\"null\" />\n <RequestTableTooltip\n v-else-if=\"data.schema\"\n :description=\"data.description\"\n :schema=\"data.schema\"\n :value />\n </template>\n </CodeInput>\n </DataTableCell>\n\n <!-- File upload -->\n <DataTableCell\n v-if=\"showUploadButton\"\n class=\"group/upload flex items-center justify-center whitespace-nowrap\">\n <template v-if=\"isFile\">\n <div\n class=\"text-c-2 filemask flex w-full max-w-[100%] items-center justify-center overflow-hidden p-1\">\n <span>{{ displayValue }}</span>\n </div>\n <button\n class=\"bg-b-2 mt-1 block rounded p-0.5 text-center text-xs font-medium md:pointer-events-none md:absolute md:inset-x-1 md:top-1/2 md:mt-0 md:-translate-y-1/2 md:opacity-0 md:group-hover/upload:pointer-events-auto md:group-hover/upload:opacity-100\"\n type=\"button\"\n @click=\"emit('removeFile')\">\n Delete\n </button>\n </template>\n <template v-else>\n <div class=\"p-0.5\">\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"emit('uploadFile')\">\n <span>Select File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </div>\n </template>\n </DataTableCell>\n </DataTableRow>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;SAFR,aAAa,QAAA,KAAK;SAClB,QAAQ,QAAA,KAAK;SACb,OAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;KAOD,QAAA,oBAAA,WAAA,EADR,YA+BgB,MAAA,sBAAA,EAAA;;MA7Bd,OAAM;;6BAYK,CAXK,OAAA,SAAA,WAAA,EAAhB,mBAWW,UAAA,EAAA,KAAA,GAAA,EAAA,CAVT,mBAGM,OAHN,YAGM,CADJ,mBAA+B,QAAA,MAAA,gBAAtB,aAAA,MAAY,EAAA,EAAA,CAAA,CAAA,EAEvB,mBAKS,UAAA;OAJP,OAAM;OACN,MAAK;OACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,aAAA;SAAgB,WAE9B,CAAA,EAAA,GAAA,KAAA,WAAA,EAGA,mBAaM,OAbN,YAaM,CAZJ,YAWe,MAAA,aAAA,EAAA;OAVb,OAAM;OACN,MAAK;OACL,SAAQ;OACP,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,aAAA;;8BACY,CAAA,OAAA,QAAA,OAAA,MAAxB,mBAAwB,QAAA,MAAlB,eAAW,GAAA,GACjB,YAIoB,MAAA,WAAA,EAAA;QAHlB,OAAM;QACN,MAAK;QACL,MAAK;QACL,WAAU"}
1
+ {"version":3,"file":"RequestTableRow.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/components/RequestTableRow.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { ScalarIconGlobe, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport { unpackProxyObject } from '@scalar/workspace-store/helpers/unpack-proxy'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type {\n ParameterObject,\n SchemaObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed, ref, watch } from 'vue'\n\nimport { getFileName } from '@/v2/blocks/request-block/helpers/files'\nimport { validateParameter } from '@/v2/blocks/request-block/helpers/validate-parameter'\nimport { CodeInput } from '@/v2/components/code-input'\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\n\nimport RequestTableTooltip from './RequestTableTooltip.vue'\n\nexport type TableRow = {\n /** The parameter or field name/key */\n name: string\n /** The parameter value, can be a string, file, or null */\n value: string | File | null\n /** Optional description for the parameter */\n description?: string\n /** Optional route for global parameters (e.g., cookies shared across workspace) */\n globalRoute?: ApiReferenceEvents['ui:navigate']\n /** Whether the parameter is disabled/inactive */\n isDisabled?: boolean\n /** OpenAPI schema object with type, validation rules, examples, etc. */\n schema?: SchemaObject\n /** Whether the parameter is required */\n isRequired?: boolean\n /**\n * Whether the parameter is readonly and can not be modifies directly\n * User can still override the parameter which is going to show up with the linethrough style\n */\n isReadonly?: boolean\n /** Whether the parameter is overridden later on */\n isOverridden?: boolean\n /** Track the original parameter so we can update it */\n originalParameter?: ParameterObject\n /** Path to a value inside the original parameter example for expanded object parameters */\n sourceParameterValuePath?: string[]\n}\n\nconst {\n data,\n environment,\n hasCheckboxDisabled,\n invalidParams,\n showUploadButton,\n} = defineProps<{\n data: TableRow\n hasCheckboxDisabled?: boolean\n invalidParams?: Set<string>\n label?: string\n environment: XScalarEnvironment\n showUploadButton?: boolean\n}>()\n\nconst emit = defineEmits<{\n (\n e: 'upsertRow',\n payload: { name: string; value: string | File; isDisabled: boolean },\n ): void\n (e: 'deleteRow'): void\n (e: 'uploadFile'): void\n (e: 'removeFile'): void\n (e: 'navigate', route: NonNullable<TableRow['globalRoute']>): void\n}>()\n\n/**\n * Track local state for the row\n *\n * Now this is required because of the way we get default values from the schema.\n * If we have a default value in data.value, then we update isDisabled to true. We lose the default value since now\n * we have an example where value: ''. This is why we need to track the local state and update all of the params at the\n * same time.\n */\nconst name = ref<string>(data.name ?? '')\nconst value = ref<string | File>(unpackProxyObject(data.value) ?? '')\nconst isDisabled = ref<boolean>(data.isDisabled ?? false)\n\n// Keep the above state synced with the data prop\nwatch(\n () => data.name,\n (newName) => (name.value = newName ?? ''),\n)\nwatch(\n () => data.value,\n (newValue) => (value.value = unpackProxyObject(newValue) ?? ''),\n)\nwatch(\n () => data.isDisabled,\n (newIsDisabled) => (isDisabled.value = newIsDisabled ?? false),\n)\n\n/** Check if the value is a File instance */\nconst isFile = computed(() => value.value instanceof File)\n\n/** Display value handles File instances and shows filename instead */\nconst displayValue = computed(\n () =>\n (isFile.value\n ? getFileName(value.value as File)\n : (value.value as string)) ?? '',\n)\n\nconst defaultValue = computed(() => data.schema?.default as string)\n\n/** See if we can extract enum values from the schema */\nconst enumValue = computed<string[]>(() => {\n if (!data.schema) {\n return []\n }\n\n // Grab the enum from the schema\n if (data.schema.enum) {\n return data.schema.enum.map((item) => String(item))\n }\n\n // Grab the enum from the items schema\n if ('items' in data.schema) {\n const resolved = resolve.schema(data.schema.items)\n if (resolved?.enum) {\n return resolved.enum.map((item) => String(item))\n }\n }\n\n return []\n})\n\nconst minimumValue = computed(() =>\n data.schema && 'minimum' in data.schema ? data.schema.minimum : undefined,\n)\nconst maximumValue = computed(() =>\n data.schema && 'maximum' in data.schema ? data.schema.maximum : undefined,\n)\nconst typeValue = computed(() =>\n data.schema && 'type' in data.schema ? data.schema.type : undefined,\n)\n\nconst validationResult = computed(() =>\n validateParameter(data.schema, value.value),\n)\n\n/** Handle row updates while preserving existing properties */\nconst handleUpdateRow = (\n payload: Partial<{ name: string; value: string; isDisabled: boolean }>,\n): void => {\n // Update our local state\n if (payload.name !== undefined) {\n name.value = payload.name\n }\n if (payload.value !== undefined) {\n value.value = payload.value\n }\n\n // Is disabled should always be false unless you explicitly set it to true\n isDisabled.value = payload.isDisabled ?? false\n\n // Emit all of the local state\n emit('upsertRow', {\n name: name.value,\n value: value.value,\n isDisabled: isDisabled.value,\n })\n}\n</script>\n\n<template>\n <DataTableRow\n :id=\"data.name\"\n :class=\"{\n alert: validationResult.ok === false,\n error: validationResult.ok === false && invalidParams?.has(data.name),\n }\">\n <DataTableCheckbox\n class=\"!border-r\"\n :disabled=\"hasCheckboxDisabled ?? false\"\n :modelValue=\"!isDisabled\"\n @update:modelValue=\"(v) => handleUpdateRow({ isDisabled: !v })\" />\n\n <!-- Name -->\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Key`\"\n disableCloseBrackets\n :disabled=\"data.isReadonly\"\n disableEnter\n disableTabIndent\n :environment=\"environment\"\n lineWrapping\n :modelValue=\"name\"\n placeholder=\"Key\"\n :required=\"Boolean(data.isRequired)\"\n @navigate=\"(route) => emit('navigate', route)\"\n @selectVariable=\"(v: string) => handleUpdateRow({ name: v })\"\n @update:modelValue=\"(v) => handleUpdateRow({ name: v })\" />\n </DataTableCell>\n\n <!-- Value -->\n <DataTableCell>\n <CodeInput\n :aria-label=\"`${label} Value`\"\n class=\"pr-6 group-hover:pr-10 group-has-[.cm-focused]:pr-10\"\n :default=\"defaultValue\"\n disableCloseBrackets\n :disabled=\"data.isReadonly\"\n disableEnter\n disableTabIndent\n :enum=\"enumValue\"\n :environment=\"environment\"\n :examples=\"\n data.schema?.examples?.map((example) => String(example)) ?? []\n \"\n :linethrough=\"data.isOverridden\"\n lineWrapping\n :max=\"maximumValue\"\n :min=\"minimumValue\"\n :modelValue=\"displayValue\"\n placeholder=\"Value\"\n :type=\"typeValue\"\n withFakeData\n @navigate=\"(route) => emit('navigate', route)\"\n @update:modelValue=\"(v) => handleUpdateRow({ value: v })\">\n <template #icon>\n <ScalarButton\n v-if=\"\n Boolean(data.name || value) &&\n !data.isRequired &&\n data.isReadonly !== true\n \"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context -mr-0.5 hidden h-fit rounded p-1 group-hover:flex group-has-[.cm-focused]:flex\"\n size=\"sm\"\n variant=\"ghost\"\n @click=\"emit('deleteRow')\">\n <ScalarIconTrash class=\"size-3.5\" />\n </ScalarButton>\n\n <ScalarIconButton\n v-if=\"data.globalRoute !== undefined\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 z-context -mr-0.5 h-fit\"\n :icon=\"ScalarIconGlobe\"\n label=\"Global cookies are shared across the whole workspace. Click to navigate.\"\n size=\"xs\"\n tooltip=\"top\"\n variant=\"ghost\"\n @click=\"emit('navigate', data.globalRoute)\" />\n\n <RequestTableTooltip\n v-if=\"data.isReadonly\"\n description=\"This is a readonly property and you can not modify it! If you want to change it you have to override it or disable it using the checkbox\"\n :value=\"null\" />\n <RequestTableTooltip\n v-else-if=\"data.schema\"\n :description=\"data.description\"\n :schema=\"data.schema\"\n :value />\n </template>\n </CodeInput>\n </DataTableCell>\n\n <!-- File upload -->\n <DataTableCell\n v-if=\"showUploadButton\"\n class=\"group/upload flex items-center justify-center whitespace-nowrap\">\n <template v-if=\"isFile\">\n <div\n class=\"text-c-2 filemask flex w-full max-w-[100%] items-center justify-center overflow-hidden p-1\">\n <span>{{ displayValue }}</span>\n </div>\n <button\n class=\"bg-b-2 mt-1 block rounded p-0.5 text-center text-xs font-medium md:pointer-events-none md:absolute md:inset-x-1 md:top-1/2 md:mt-0 md:-translate-y-1/2 md:opacity-0 md:group-hover/upload:pointer-events-auto md:group-hover/upload:opacity-100\"\n type=\"button\"\n @click=\"emit('removeFile')\">\n Delete\n </button>\n </template>\n <template v-else>\n <div class=\"p-0.5\">\n <ScalarButton\n class=\"bg-b-2 hover:bg-b-3 text-c-2 h-fit border-0 py-px shadow-none\"\n size=\"sm\"\n variant=\"outlined\"\n @click=\"emit('uploadFile')\">\n <span>Select File</span>\n <ScalarIcon\n class=\"ml-1\"\n icon=\"Upload\"\n size=\"xs\"\n thickness=\"2.5\" />\n </ScalarButton>\n </div>\n </template>\n </DataTableCell>\n </DataTableRow>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqEA,MAAM,OAAO;;;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;SAClB,QAAQ,QAAA,KAAK;SACb,OAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;KAOD,QAAA,oBAAA,WAAA,EADR,YA+BgB,MAAA,sBAAA,EAAA;;MA7Bd,OAAM;;6BAYK,CAXK,OAAA,SAAA,WAAA,EAAhB,mBAWW,UAAA,EAAA,KAAA,GAAA,EAAA,CAVT,mBAGM,OAHN,YAGM,CADJ,mBAA+B,QAAA,MAAA,gBAAtB,aAAA,MAAY,EAAA,EAAA,CAAA,CAAA,EAEvB,mBAKS,UAAA;OAJP,OAAM;OACN,MAAK;OACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,aAAA;SAAgB,WAE9B,CAAA,EAAA,GAAA,KAAA,WAAA,EAGA,mBAaM,OAbN,YAaM,CAZJ,YAWe,MAAA,aAAA,EAAA;OAVb,OAAM;OACN,MAAK;OACL,SAAQ;OACP,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,KAAI,aAAA;;8BACY,CAAA,OAAA,QAAA,OAAA,MAAxB,mBAAwB,QAAA,MAAlB,eAAW,GAAA,GACjB,YAIoB,MAAA,WAAA,EAAA;QAHlB,OAAM;QACN,MAAK;QACL,MAAK;QACL,WAAU"}
@@ -1 +1 @@
1
- {"version":3,"file":"RequestTableTooltip.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestTableTooltip.vue"],"names":[],"mappings":"AAuEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAKhG,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC;AAgLF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"RequestTableTooltip.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/components/RequestTableTooltip.vue"],"names":[],"mappings":"AAyEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAKhG,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,IAAI,CAAA;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,CAAC;AAgLF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RequestTableTooltip.vue.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/components/RequestTableTooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown, ScalarPopover } from '@scalar/components'\nimport { ScalarIconInfo, ScalarIconWarning } from '@scalar/icons'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { validateParameter } from '@/v2/blocks/request-block/helpers/validate-parameter'\n\nconst { schema, value, description } = defineProps<{\n schema?: SchemaObject\n value: string | File | null\n description?: string\n}>()\n\nconst invalidParameterMessage = computed(() => validateParameter(schema, value))\nconst isInvalid = computed(() => invalidParameterMessage.value.ok === false)\n</script>\n<template>\n <ScalarPopover\n :offset=\"4\"\n placement=\"left\"\n teleport>\n <button\n :aria-label=\"isInvalid ? 'Input is invalid' : 'More Information'\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 rounded p-1\"\n :role=\"isInvalid ? 'alert' : 'none'\"\n type=\"button\">\n <ScalarIconWarning\n v-if=\"isInvalid\"\n class=\"text-orange size-3.5 brightness-90 hover:brightness-75\" />\n <ScalarIconInfo\n v-else\n class=\"text-c-2 hover:text-c-1 size-3.5\" />\n </button>\n <template #popover>\n <div\n class=\"text-xxs text-c-1 grid w-fit max-w-xs min-w-0 gap-1.5 rounded px-1.5 pt-2 pb-1.5 leading-none break-words\"\n data-testid=\"request-table-tooltip-content\">\n <div\n v-if=\"invalidParameterMessage.ok === false\"\n class=\"text-error-1\">\n {{ invalidParameterMessage.message }}\n </div>\n <div\n v-else-if=\"\n schema &&\n ('type' in schema ||\n 'format' in schema ||\n 'minimum' in schema ||\n 'maximum' in schema ||\n 'default' in schema)\n \"\n class=\"schema text-c-2 truncate *:not-first:before:content-['_·_']\">\n <span v-if=\"'type' in schema\">{{ schema.type }}</span>\n <span v-if=\"'format' in schema\">{{ schema.format }}</span>\n <span v-if=\"'minimum' in schema\">min: {{ schema.minimum }}</span>\n <span v-if=\"'maximum' in schema\">max: {{ schema.maximum }}</span>\n <span v-if=\"'default' in schema\">default: {{ schema.default }}</span>\n </div>\n <ScalarMarkdown\n v-if=\"description && !isInvalid\"\n :value=\"description\" />\n </div>\n </template>\n </ScalarPopover>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"RequestTableTooltip.vue.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/components/RequestTableTooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport { ScalarPopover } from '@scalar/components/popover'\nimport { ScalarIconInfo, ScalarIconWarning } from '@scalar/icons'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { validateParameter } from '@/v2/blocks/request-block/helpers/validate-parameter'\n\nconst { schema, value, description } = defineProps<{\n schema?: SchemaObject\n value: string | File | null\n description?: string\n}>()\n\nconst invalidParameterMessage = computed(() => validateParameter(schema, value))\nconst isInvalid = computed(() => invalidParameterMessage.value.ok === false)\n</script>\n<template>\n <ScalarPopover\n :offset=\"4\"\n placement=\"left\"\n teleport>\n <button\n :aria-label=\"isInvalid ? 'Input is invalid' : 'More Information'\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 rounded p-1\"\n :role=\"isInvalid ? 'alert' : 'none'\"\n type=\"button\">\n <ScalarIconWarning\n v-if=\"isInvalid\"\n class=\"text-orange size-3.5 brightness-90 hover:brightness-75\" />\n <ScalarIconInfo\n v-else\n class=\"text-c-2 hover:text-c-1 size-3.5\" />\n </button>\n <template #popover>\n <div\n class=\"text-xxs text-c-1 grid w-fit max-w-xs min-w-0 gap-1.5 rounded px-1.5 pt-2 pb-1.5 leading-none break-words\"\n data-testid=\"request-table-tooltip-content\">\n <div\n v-if=\"invalidParameterMessage.ok === false\"\n class=\"text-error-1\">\n {{ invalidParameterMessage.message }}\n </div>\n <div\n v-else-if=\"\n schema &&\n ('type' in schema ||\n 'format' in schema ||\n 'minimum' in schema ||\n 'maximum' in schema ||\n 'default' in schema)\n \"\n class=\"schema text-c-2 truncate *:not-first:before:content-['_·_']\">\n <span v-if=\"'type' in schema\">{{ schema.type }}</span>\n <span v-if=\"'format' in schema\">{{ schema.format }}</span>\n <span v-if=\"'minimum' in schema\">min: {{ schema.minimum }}</span>\n <span v-if=\"'maximum' in schema\">max: {{ schema.maximum }}</span>\n <span v-if=\"'default' in schema\">default: {{ schema.default }}</span>\n </div>\n <ScalarMarkdown\n v-if=\"description && !isInvalid\"\n :value=\"description\" />\n </div>\n </template>\n </ScalarPopover>\n</template>\n"],"mappings":""}
@@ -1,7 +1,8 @@
1
1
  import { validateParameter } from "../helpers/validate-parameter.js";
2
2
  import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, defineComponent, openBlock, toDisplayString, unref, withCtx } from "vue";
3
- import { ScalarMarkdown, ScalarPopover } from "@scalar/components";
4
3
  import { ScalarIconInfo, ScalarIconWarning } from "@scalar/icons";
4
+ import { ScalarMarkdown } from "@scalar/components/markdown";
5
+ import { ScalarPopover } from "@scalar/components/popover";
5
6
  //#region src/v2/blocks/request-block/components/RequestTableTooltip.vue?vue&type=script&setup=true&lang.ts
6
7
  var _hoisted_1 = ["aria-label", "role"];
7
8
  var _hoisted_2 = {
@@ -1 +1 @@
1
- {"version":3,"file":"RequestTableTooltip.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/components/RequestTableTooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown, ScalarPopover } from '@scalar/components'\nimport { ScalarIconInfo, ScalarIconWarning } from '@scalar/icons'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { validateParameter } from '@/v2/blocks/request-block/helpers/validate-parameter'\n\nconst { schema, value, description } = defineProps<{\n schema?: SchemaObject\n value: string | File | null\n description?: string\n}>()\n\nconst invalidParameterMessage = computed(() => validateParameter(schema, value))\nconst isInvalid = computed(() => invalidParameterMessage.value.ok === false)\n</script>\n<template>\n <ScalarPopover\n :offset=\"4\"\n placement=\"left\"\n teleport>\n <button\n :aria-label=\"isInvalid ? 'Input is invalid' : 'More Information'\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 rounded p-1\"\n :role=\"isInvalid ? 'alert' : 'none'\"\n type=\"button\">\n <ScalarIconWarning\n v-if=\"isInvalid\"\n class=\"text-orange size-3.5 brightness-90 hover:brightness-75\" />\n <ScalarIconInfo\n v-else\n class=\"text-c-2 hover:text-c-1 size-3.5\" />\n </button>\n <template #popover>\n <div\n class=\"text-xxs text-c-1 grid w-fit max-w-xs min-w-0 gap-1.5 rounded px-1.5 pt-2 pb-1.5 leading-none break-words\"\n data-testid=\"request-table-tooltip-content\">\n <div\n v-if=\"invalidParameterMessage.ok === false\"\n class=\"text-error-1\">\n {{ invalidParameterMessage.message }}\n </div>\n <div\n v-else-if=\"\n schema &&\n ('type' in schema ||\n 'format' in schema ||\n 'minimum' in schema ||\n 'maximum' in schema ||\n 'default' in schema)\n \"\n class=\"schema text-c-2 truncate *:not-first:before:content-['_·_']\">\n <span v-if=\"'type' in schema\">{{ schema.type }}</span>\n <span v-if=\"'format' in schema\">{{ schema.format }}</span>\n <span v-if=\"'minimum' in schema\">min: {{ schema.minimum }}</span>\n <span v-if=\"'maximum' in schema\">max: {{ schema.maximum }}</span>\n <span v-if=\"'default' in schema\">default: {{ schema.default }}</span>\n </div>\n <ScalarMarkdown\n v-if=\"description && !isInvalid\"\n :value=\"description\" />\n </div>\n </template>\n </ScalarPopover>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcA,MAAM,0BAA0B,eAAe,kBAAkB,QAAA,QAAQ,QAAA,MAAM,CAAA;EAC/E,MAAM,YAAY,eAAe,wBAAwB,MAAM,OAAO,MAAK;;uBAGzE,YA8CgB,MAAA,cAAA,EAAA;IA7Cb,QAAQ;IACT,WAAU;IACV,UAAA;;IAaW,SAAO,cA4BV,CA3BN,mBA2BM,OA3BN,YA2BM,CAvBI,wBAAA,MAAwB,OAAE,SAAA,WAAA,EADlC,mBAIM,OAJN,YAIM,gBADD,wBAAA,MAAwB,QAAO,EAAA,EAAA,IAGV,QAAA,WAAA,UAAiC,QAAA,UAAA,YAAoC,QAAA,UAAA,aAAqC,QAAA,UAAA,aAAqC,QAAA,UAAA,aAAqC,QAAA,WAAA,WAAA,EAD9M,mBAeM,OAfN,YAeM;eALkB,QAAA,UAAA,WAAA,EAAtB,mBAAsD,QAAA,YAAA,gBAArB,QAAA,OAAO,KAAI,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;iBACpB,QAAA,UAAA,WAAA,EAAxB,mBAA0D,QAAA,YAAA,gBAAvB,QAAA,OAAO,OAAM,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;kBACvB,QAAA,UAAA,WAAA,EAAzB,mBAAiE,QAAA,YAAhC,UAAK,gBAAG,QAAA,OAAO,QAAO,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;kBAC9B,QAAA,UAAA,WAAA,EAAzB,mBAAiE,QAAA,YAAhC,UAAK,gBAAG,QAAA,OAAO,QAAO,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;kBAC9B,QAAA,UAAA,WAAA,EAAzB,mBAAqE,QAAA,YAApC,cAAS,gBAAG,QAAA,OAAO,QAAO,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;wCAGrD,QAAA,eAAW,CAAK,UAAA,SAAA,WAAA,EADxB,YAEyB,MAAA,eAAA,EAAA;;KAAtB,OAAO,QAAA;;2BA5BL,CAXT,mBAWS,UAAA;KAVN,cAAY,UAAA,QAAS,qBAAA;KACtB,OAAM;KACL,MAAM,UAAA,QAAS,UAAA;KAChB,MAAK;QAEG,UAAA,SAAA,WAAA,EADR,YAEmE,MAAA,kBAAA,EAAA;;KAAjE,OAAM;wBACR,YAE6C,MAAA,eAAA,EAAA;;KAA3C,OAAM"}
1
+ {"version":3,"file":"RequestTableTooltip.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/components/RequestTableTooltip.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarMarkdown } from '@scalar/components/markdown'\nimport { ScalarPopover } from '@scalar/components/popover'\nimport { ScalarIconInfo, ScalarIconWarning } from '@scalar/icons'\nimport type { SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport { validateParameter } from '@/v2/blocks/request-block/helpers/validate-parameter'\n\nconst { schema, value, description } = defineProps<{\n schema?: SchemaObject\n value: string | File | null\n description?: string\n}>()\n\nconst invalidParameterMessage = computed(() => validateParameter(schema, value))\nconst isInvalid = computed(() => invalidParameterMessage.value.ok === false)\n</script>\n<template>\n <ScalarPopover\n :offset=\"4\"\n placement=\"left\"\n teleport>\n <button\n :aria-label=\"isInvalid ? 'Input is invalid' : 'More Information'\"\n class=\"text-c-2 hover:text-c-1 hover:bg-b-2 rounded p-1\"\n :role=\"isInvalid ? 'alert' : 'none'\"\n type=\"button\">\n <ScalarIconWarning\n v-if=\"isInvalid\"\n class=\"text-orange size-3.5 brightness-90 hover:brightness-75\" />\n <ScalarIconInfo\n v-else\n class=\"text-c-2 hover:text-c-1 size-3.5\" />\n </button>\n <template #popover>\n <div\n class=\"text-xxs text-c-1 grid w-fit max-w-xs min-w-0 gap-1.5 rounded px-1.5 pt-2 pb-1.5 leading-none break-words\"\n data-testid=\"request-table-tooltip-content\">\n <div\n v-if=\"invalidParameterMessage.ok === false\"\n class=\"text-error-1\">\n {{ invalidParameterMessage.message }}\n </div>\n <div\n v-else-if=\"\n schema &&\n ('type' in schema ||\n 'format' in schema ||\n 'minimum' in schema ||\n 'maximum' in schema ||\n 'default' in schema)\n \"\n class=\"schema text-c-2 truncate *:not-first:before:content-['_·_']\">\n <span v-if=\"'type' in schema\">{{ schema.type }}</span>\n <span v-if=\"'format' in schema\">{{ schema.format }}</span>\n <span v-if=\"'minimum' in schema\">min: {{ schema.minimum }}</span>\n <span v-if=\"'maximum' in schema\">max: {{ schema.maximum }}</span>\n <span v-if=\"'default' in schema\">default: {{ schema.default }}</span>\n </div>\n <ScalarMarkdown\n v-if=\"description && !isInvalid\"\n :value=\"description\" />\n </div>\n </template>\n </ScalarPopover>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAeA,MAAM,0BAA0B,eAAe,kBAAkB,QAAA,QAAQ,QAAA,MAAM,CAAA;EAC/E,MAAM,YAAY,eAAe,wBAAwB,MAAM,OAAO,MAAK;;uBAGzE,YA8CgB,MAAA,cAAA,EAAA;IA7Cb,QAAQ;IACT,WAAU;IACV,UAAA;;IAaW,SAAO,cA4BV,CA3BN,mBA2BM,OA3BN,YA2BM,CAvBI,wBAAA,MAAwB,OAAE,SAAA,WAAA,EADlC,mBAIM,OAJN,YAIM,gBADD,wBAAA,MAAwB,QAAO,EAAA,EAAA,IAGV,QAAA,WAAA,UAAiC,QAAA,UAAA,YAAoC,QAAA,UAAA,aAAqC,QAAA,UAAA,aAAqC,QAAA,UAAA,aAAqC,QAAA,WAAA,WAAA,EAD9M,mBAeM,OAfN,YAeM;eALkB,QAAA,UAAA,WAAA,EAAtB,mBAAsD,QAAA,YAAA,gBAArB,QAAA,OAAO,KAAI,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;iBACpB,QAAA,UAAA,WAAA,EAAxB,mBAA0D,QAAA,YAAA,gBAAvB,QAAA,OAAO,OAAM,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;kBACvB,QAAA,UAAA,WAAA,EAAzB,mBAAiE,QAAA,YAAhC,UAAK,gBAAG,QAAA,OAAO,QAAO,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;kBAC9B,QAAA,UAAA,WAAA,EAAzB,mBAAiE,QAAA,YAAhC,UAAK,gBAAG,QAAA,OAAO,QAAO,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;kBAC9B,QAAA,UAAA,WAAA,EAAzB,mBAAqE,QAAA,YAApC,cAAS,gBAAG,QAAA,OAAO,QAAO,EAAA,EAAA,IAAA,mBAAA,IAAA,KAAA;wCAGrD,QAAA,eAAW,CAAK,UAAA,SAAA,WAAA,EADxB,YAEyB,MAAA,eAAA,EAAA;;KAAtB,OAAO,QAAA;;2BA5BL,CAXT,mBAWS,UAAA;KAVN,cAAY,UAAA,QAAS,qBAAA;KACtB,OAAM;KACL,MAAM,UAAA,QAAS,UAAA;KAChB,MAAK;QAEG,UAAA,SAAA,WAAA,EADR,YAEmE,MAAA,kBAAA,EAAA;;KAAjE,OAAM;wBACR,YAE6C,MAAA,eAAA,EAAA;;KAA3C,OAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"get-form-body-rows.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/helpers/get-form-body-rows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAG/G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0DAA0D,CAAA;AAYxF,uGAAuG;AACvG,eAAO,MAAM,eAAe,GAC1B,SAAS,aAAa,GAAG,SAAS,GAAG,IAAI,EACzC,aAAa,MAAM,EACnB,iBAAiB,YAAY,KAC5B,QAAQ,EAuDV,CAAA"}
1
+ {"version":3,"file":"get-form-body-rows.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/request-block/helpers/get-form-body-rows.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAG/G,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,0DAA0D,CAAA;AA6GxF,uGAAuG;AACvG,eAAO,MAAM,eAAe,GAC1B,SAAS,aAAa,GAAG,SAAS,GAAG,IAAI,EACzC,aAAa,MAAM,EACnB,iBAAiB,YAAY,KAC5B,QAAQ,EAuFV,CAAA"}
@@ -8,11 +8,75 @@ var stringifyValue = (value) => {
8
8
  if (typeof value === "object" && value !== null) return JSON.stringify(value);
9
9
  return String(value);
10
10
  };
11
+ /**
12
+ * Walk a (possibly nested) object schema and collect one entry per leaf property.
13
+ *
14
+ * A "leaf" is any property whose resolved schema is not an `{ type: 'object' }` schema
15
+ * with named `properties` — i.e. primitives, arrays, files, and `additionalProperties`
16
+ * placeholders all stop the recursion. Object properties recurse, so the widget example
17
+ * (`file` + `props.{name,description,created_at}`) yields four leaves.
18
+ */
19
+ var collectLeafProperties = (schema, parentPath = [], parentRequired = true) => {
20
+ if (!isObjectSchema(schema) || !schema.properties) return [];
21
+ const requiredSet = new Set(schema.required ?? []);
22
+ const leaves = [];
23
+ for (const [key, rawChildSchema] of objectEntries(schema.properties)) {
24
+ const childSchema = resolve.schema(rawChildSchema);
25
+ const path = [...parentPath, String(key)];
26
+ const isRequired = parentRequired && requiredSet.has(String(key));
27
+ if (childSchema && isObjectSchema(childSchema) && childSchema.properties) leaves.push(...collectLeafProperties(childSchema, path, isRequired));
28
+ else leaves.push({
29
+ path,
30
+ schema: childSchema,
31
+ isRequired
32
+ });
33
+ }
34
+ return leaves;
35
+ };
36
+ /**
37
+ * Walk a schema + example together and collect one row per leaf, including example-only
38
+ * keys that the schema does not declare. Schema-declared properties come first in schema
39
+ * order; extras present in the example follow in example order at each level.
40
+ *
41
+ * Unlike `collectLeafProperties` (which is schema-only and feeds the dotted-name index),
42
+ * this walker drives what the user actually sees in the form: a row for every leaf the
43
+ * example contains, even when the schema is partial or out of date.
44
+ */
45
+ var collectExampleRows = (example, schema, parentPath = []) => {
46
+ const rows = [];
47
+ const exampleEntries = isObject(example) ? objectEntries(example) : [];
48
+ const exampleByKey = new Map(exampleEntries.map(([key, value]) => [String(key), value]));
49
+ const declaredKeys = /* @__PURE__ */ new Set();
50
+ const schemaProperties = schema && isObjectSchema(schema) ? schema.properties ?? {} : {};
51
+ for (const [key, rawChildSchema] of objectEntries(schemaProperties)) {
52
+ const keyStr = String(key);
53
+ declaredKeys.add(keyStr);
54
+ const childSchema = resolve.schema(rawChildSchema);
55
+ const path = [...parentPath, keyStr];
56
+ const exampleSubvalue = exampleByKey.get(keyStr);
57
+ if (childSchema && isObjectSchema(childSchema) && childSchema.properties) rows.push(...collectExampleRows(exampleSubvalue, childSchema, path));
58
+ else rows.push({
59
+ path,
60
+ value: exampleSubvalue
61
+ });
62
+ }
63
+ for (const [key, value] of exampleEntries) {
64
+ const keyStr = String(key);
65
+ if (declaredKeys.has(keyStr)) continue;
66
+ rows.push({
67
+ path: [...parentPath, keyStr],
68
+ value
69
+ });
70
+ }
71
+ return rows;
72
+ };
11
73
  /** Build the table rows for the form data, optionally enriched with schema (e.g. enum) per property */
12
74
  var getFormBodyRows = (example, contentType, formBodySchema) => {
13
75
  if (!example?.value || contentType !== "multipart/form-data" && contentType !== "application/x-www-form-urlencoded") return [];
14
76
  const schemaWithProperties = formBodySchema && isObjectSchema(formBodySchema) ? formBodySchema : void 0;
15
77
  const requiredSet = schemaWithProperties ? new Set(schemaWithProperties.required ?? []) : void 0;
78
+ const leafByDottedName = /* @__PURE__ */ new Map();
79
+ if (schemaWithProperties) for (const leaf of collectLeafProperties(schemaWithProperties)) leafByDottedName.set(leaf.path.join("."), leaf);
16
80
  const mapRow = ({ name, value, isDisabled = false }) => {
17
81
  const row = {
18
82
  name,
@@ -20,11 +84,11 @@ var getFormBodyRows = (example, contentType, formBodySchema) => {
20
84
  isDisabled
21
85
  };
22
86
  if (!schemaWithProperties || !name) return row;
23
- const propSchema = resolve.schema(schemaWithProperties.properties?.[name]);
87
+ const leaf = leafByDottedName.get(name);
88
+ const propSchema = leaf?.schema ?? resolve.schema(schemaWithProperties.properties?.[name]);
24
89
  row.schema = propSchema;
25
90
  row.description = propSchema?.description;
26
- row.isRequired = requiredSet?.has(name);
27
- row.isDisabled = isDisabled;
91
+ row.isRequired = leaf?.isRequired ?? requiredSet?.has(name) ?? false;
28
92
  return row;
29
93
  };
30
94
  if (Array.isArray(example.value)) return example.value.map((exampleValue) => {
@@ -39,6 +103,13 @@ var getFormBodyRows = (example, contentType, formBodySchema) => {
39
103
  isDisabled: false
40
104
  };
41
105
  });
106
+ if (contentType === "multipart/form-data" && schemaWithProperties && typeof example.value === "object") return collectExampleRows(example.value, schemaWithProperties).map(({ path, value }) => {
107
+ const rendered = value instanceof File ? value : value === void 0 || value === null ? "" : stringifyValue(value);
108
+ return mapRow({
109
+ name: path.join("."),
110
+ value: rendered
111
+ });
112
+ });
42
113
  if (typeof example.value === "object" && example.value) return objectEntries(example.value).map(([key, value]) => mapRow({
43
114
  name: String(key),
44
115
  value: stringifyValue(value)
@@ -1 +1 @@
1
- {"version":3,"file":"get-form-body-rows.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/get-form-body-rows.ts"],"sourcesContent":["import { isObject } from '@scalar/helpers/object/is-object'\nimport { objectEntries } from '@scalar/helpers/object/object-entries'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { ExampleObject, SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\nimport type { TableRow } from '@/v2/blocks/request-block/components/RequestTableRow.vue'\n\nconst stringifyValue = (value: unknown) => {\n if (value instanceof File) {\n return value.name\n }\n if (typeof value === 'object' && value !== null) {\n return JSON.stringify(value)\n }\n return String(value)\n}\n\n/** Build the table rows for the form data, optionally enriched with schema (e.g. enum) per property */\nexport const getFormBodyRows = (\n example: ExampleObject | undefined | null,\n contentType: string,\n formBodySchema?: SchemaObject,\n): TableRow[] => {\n // We only need the rows for formData\n if (\n !example?.value ||\n (contentType !== 'multipart/form-data' && contentType !== 'application/x-www-form-urlencoded')\n ) {\n return []\n }\n\n // Get all the schema properties if the schema is an object schema\n const schemaWithProperties = formBodySchema && isObjectSchema(formBodySchema) ? formBodySchema : undefined\n const requiredSet = schemaWithProperties ? new Set(schemaWithProperties.required ?? []) : undefined\n\n const mapRow = ({\n name,\n value,\n isDisabled = false,\n }: {\n name: string\n value: string | File\n isDisabled?: boolean\n }): TableRow => {\n const row: TableRow = { name, value, isDisabled }\n if (!schemaWithProperties || !name) {\n return row\n }\n const propSchema = resolve.schema(schemaWithProperties.properties?.[name])\n row.schema = propSchema\n row.description = propSchema?.description\n row.isRequired = requiredSet?.has(name)\n row.isDisabled = isDisabled\n return row\n }\n\n // We have form data stored as an array\n if (Array.isArray(example.value)) {\n return example.value.map((exampleValue) => {\n if (isObject(exampleValue)) {\n const name = String(exampleValue.name)\n const value = exampleValue.value instanceof File ? exampleValue.value : String(exampleValue.value)\n const isDisabled = Boolean(exampleValue.isDisabled)\n return mapRow({ name, value, isDisabled })\n }\n return { name: '', value: exampleValue, isDisabled: false }\n })\n }\n\n // We got an object try to convert it to an array of rows\n if (typeof example.value === 'object' && example.value) {\n return objectEntries(example.value).map(([key, value]) =>\n mapRow({ name: String(key), value: stringifyValue(value) }),\n )\n }\n\n return []\n}\n"],"mappings":";;;;;AAQA,IAAM,kBAAkB,UAAmB;AACzC,KAAI,iBAAiB,KACnB,QAAO,MAAM;AAEf,KAAI,OAAO,UAAU,YAAY,UAAU,KACzC,QAAO,KAAK,UAAU,MAAM;AAE9B,QAAO,OAAO,MAAM;;;AAItB,IAAa,mBACX,SACA,aACA,mBACe;AAEf,KACE,CAAC,SAAS,SACT,gBAAgB,yBAAyB,gBAAgB,oCAE1D,QAAO,EAAE;CAIX,MAAM,uBAAuB,kBAAkB,eAAe,eAAe,GAAG,iBAAiB,KAAA;CACjG,MAAM,cAAc,uBAAuB,IAAI,IAAI,qBAAqB,YAAY,EAAE,CAAC,GAAG,KAAA;CAE1F,MAAM,UAAU,EACd,MACA,OACA,aAAa,YAKC;EACd,MAAM,MAAgB;GAAE;GAAM;GAAO;GAAY;AACjD,MAAI,CAAC,wBAAwB,CAAC,KAC5B,QAAO;EAET,MAAM,aAAa,QAAQ,OAAO,qBAAqB,aAAa,MAAM;AAC1E,MAAI,SAAS;AACb,MAAI,cAAc,YAAY;AAC9B,MAAI,aAAa,aAAa,IAAI,KAAK;AACvC,MAAI,aAAa;AACjB,SAAO;;AAIT,KAAI,MAAM,QAAQ,QAAQ,MAAM,CAC9B,QAAO,QAAQ,MAAM,KAAK,iBAAiB;AACzC,MAAI,SAAS,aAAa,CAIxB,QAAO,OAAO;GAAE,MAHH,OAAO,aAAa,KAAK;GAGhB,OAFR,aAAa,iBAAiB,OAAO,aAAa,QAAQ,OAAO,aAAa,MAAM;GAErE,YADV,QAAQ,aAAa,WAAW;GACV,CAAC;AAE5C,SAAO;GAAE,MAAM;GAAI,OAAO;GAAc,YAAY;GAAO;GAC3D;AAIJ,KAAI,OAAO,QAAQ,UAAU,YAAY,QAAQ,MAC/C,QAAO,cAAc,QAAQ,MAAM,CAAC,KAAK,CAAC,KAAK,WAC7C,OAAO;EAAE,MAAM,OAAO,IAAI;EAAE,OAAO,eAAe,MAAM;EAAE,CAAC,CAC5D;AAGH,QAAO,EAAE"}
1
+ {"version":3,"file":"get-form-body-rows.js","names":[],"sources":["../../../../../src/v2/blocks/request-block/helpers/get-form-body-rows.ts"],"sourcesContent":["import { isObject } from '@scalar/helpers/object/is-object'\nimport { objectEntries } from '@scalar/helpers/object/object-entries'\nimport { resolve } from '@scalar/workspace-store/resolve'\nimport type { ExampleObject, SchemaObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport { isObjectSchema } from '@scalar/workspace-store/schemas/v3.1/strict/type-guards'\n\nimport type { TableRow } from '@/v2/blocks/request-block/components/RequestTableRow.vue'\n\nconst stringifyValue = (value: unknown) => {\n if (value instanceof File) {\n return value.name\n }\n if (typeof value === 'object' && value !== null) {\n return JSON.stringify(value)\n }\n return String(value)\n}\n\ntype LeafRow = {\n path: string[]\n schema: SchemaObject | undefined\n isRequired: boolean\n}\n\n/**\n * Walk a (possibly nested) object schema and collect one entry per leaf property.\n *\n * A \"leaf\" is any property whose resolved schema is not an `{ type: 'object' }` schema\n * with named `properties` — i.e. primitives, arrays, files, and `additionalProperties`\n * placeholders all stop the recursion. Object properties recurse, so the widget example\n * (`file` + `props.{name,description,created_at}`) yields four leaves.\n */\nconst collectLeafProperties = (schema: SchemaObject, parentPath: string[] = [], parentRequired = true): LeafRow[] => {\n // Nothing to walk if this is not an object schema or has no declared properties.\n if (!isObjectSchema(schema) || !schema.properties) {\n return []\n }\n\n // `required` is a list of property names on *this* schema, so build it once per level.\n const requiredSet = new Set(schema.required ?? [])\n const leaves: LeafRow[] = []\n\n for (const [key, rawChildSchema] of objectEntries(schema.properties)) {\n const childSchema = resolve.schema(rawChildSchema)\n const path = [...parentPath, String(key)]\n\n // A leaf is only required when *every* ancestor was also required — a non-required\n // parent makes the whole subtree optional regardless of inner `required` lists.\n const isRequired = parentRequired && requiredSet.has(String(key))\n\n // Nested objects with named properties recurse so each leaf gets its own row;\n // everything else (primitives, arrays, files, additionalProperties placeholders)\n // is treated as a leaf and stops the descent.\n if (childSchema && isObjectSchema(childSchema) && childSchema.properties) {\n leaves.push(...collectLeafProperties(childSchema, path, isRequired))\n } else {\n leaves.push({ path, schema: childSchema, isRequired })\n }\n }\n\n return leaves\n}\n\n/**\n * Walk a schema + example together and collect one row per leaf, including example-only\n * keys that the schema does not declare. Schema-declared properties come first in schema\n * order; extras present in the example follow in example order at each level.\n *\n * Unlike `collectLeafProperties` (which is schema-only and feeds the dotted-name index),\n * this walker drives what the user actually sees in the form: a row for every leaf the\n * example contains, even when the schema is partial or out of date.\n */\nconst collectExampleRows = (\n example: unknown,\n schema: SchemaObject | undefined,\n parentPath: string[] = [],\n): { path: string[]; value: unknown }[] => {\n const rows: { path: string[]; value: unknown }[] = []\n const exampleEntries = isObject(example) ? objectEntries(example as Record<string, unknown>) : []\n const exampleByKey = new Map<string, unknown>(exampleEntries.map(([key, value]) => [String(key), value]))\n const declaredKeys = new Set<string>()\n const schemaProperties = schema && isObjectSchema(schema) ? (schema.properties ?? {}) : {}\n\n // Schema-declared properties first, in schema order. Nested object schemas recurse so\n // each leaf gets its own row; otherwise the schema-declared key is a leaf and uses the\n // matching example value (or `undefined` when the example does not provide one).\n for (const [key, rawChildSchema] of objectEntries(schemaProperties)) {\n const keyStr = String(key)\n declaredKeys.add(keyStr)\n const childSchema = resolve.schema(rawChildSchema)\n const path = [...parentPath, keyStr]\n const exampleSubvalue = exampleByKey.get(keyStr)\n\n if (childSchema && isObjectSchema(childSchema) && childSchema.properties) {\n rows.push(...collectExampleRows(exampleSubvalue, childSchema, path))\n } else {\n rows.push({ path, value: exampleSubvalue })\n }\n }\n\n // Example-only properties at this level (preserve example order). Their inner shape is\n // not descended into — without a schema saying \"this is a nested object\" we have no\n // signal to flatten, so an object value becomes a single JSON-stringified row, matching\n // the schema-less fallback below.\n for (const [key, value] of exampleEntries) {\n const keyStr = String(key)\n if (declaredKeys.has(keyStr)) {\n continue\n }\n rows.push({ path: [...parentPath, keyStr], value })\n }\n\n return rows\n}\n\n/** Build the table rows for the form data, optionally enriched with schema (e.g. enum) per property */\nexport const getFormBodyRows = (\n example: ExampleObject | undefined | null,\n contentType: string,\n formBodySchema?: SchemaObject,\n): TableRow[] => {\n // We only need the rows for formData\n if (\n !example?.value ||\n (contentType !== 'multipart/form-data' && contentType !== 'application/x-www-form-urlencoded')\n ) {\n return []\n }\n\n // Get all the schema properties if the schema is an object schema\n const schemaWithProperties = formBodySchema && isObjectSchema(formBodySchema) ? formBodySchema : undefined\n const requiredSet = schemaWithProperties ? new Set(schemaWithProperties.required ?? []) : undefined\n\n // Pre-compute the leaf-by-dotted-name index up front so both the array and the\n // schema-driven branches can pull each row's leaf schema and required flag without\n // re-walking the schema. Without this, edited rows lose the per-leaf `Required`\n // badge because a top-level `properties[name]` lookup misses dotted names.\n const leafByDottedName = new Map<string, LeafRow>()\n if (schemaWithProperties) {\n for (const leaf of collectLeafProperties(schemaWithProperties)) {\n leafByDottedName.set(leaf.path.join('.'), leaf)\n }\n }\n\n const mapRow = ({\n name,\n value,\n isDisabled = false,\n }: {\n name: string\n value: string | File\n isDisabled?: boolean\n }): TableRow => {\n const row: TableRow = { name, value, isDisabled }\n if (!schemaWithProperties || !name) {\n return row\n }\n // Prefer the pre-resolved leaf (handles dotted names like `props.name`); fall back\n // to a top-level property lookup so user-added rows keep working.\n const leaf = leafByDottedName.get(name)\n const propSchema = leaf?.schema ?? resolve.schema(schemaWithProperties.properties?.[name])\n row.schema = propSchema\n row.description = propSchema?.description\n row.isRequired = leaf?.isRequired ?? requiredSet?.has(name) ?? false\n return row\n }\n\n // We have form data stored as an array\n if (Array.isArray(example.value)) {\n return example.value.map((exampleValue) => {\n if (isObject(exampleValue)) {\n const name = String(exampleValue.name)\n const value = exampleValue.value instanceof File ? exampleValue.value : String(exampleValue.value)\n const isDisabled = Boolean(exampleValue.isDisabled)\n return mapRow({ name, value, isDisabled })\n }\n return { name: '', value: exampleValue, isDisabled: false }\n })\n }\n\n // Schema-driven path: when the form body schema describes nested objects, emit one row\n // per leaf so users can edit individual fields. The dotted name (`props.name`) is folded\n // back into a single JSON multipart part by `build-request-body.ts` before the request is\n // sent. Gated to `multipart/form-data` because urlencoded has no regrouping step on send,\n // so dotted leaves would otherwise reach the wire as separate `props.name`-style fields.\n //\n // We walk the example alongside the schema so example-only properties (top-level extras\n // or undeclared keys inside a nested object) are still visible and editable instead of\n // being silently dropped to whatever the schema happens to declare.\n if (contentType === 'multipart/form-data' && schemaWithProperties && typeof example.value === 'object') {\n return collectExampleRows(example.value, schemaWithProperties).map(({ path, value }) => {\n // Missing values and explicit `null` (e.g. for a nullable schema) render as empty\n // inputs so the user can type a value rather than seeing the string \"null\".\n const rendered =\n value instanceof File ? value : value === undefined || value === null ? '' : stringifyValue(value)\n return mapRow({ name: path.join('.'), value: rendered })\n })\n }\n\n // We got an object try to convert it to an array of rows\n if (typeof example.value === 'object' && example.value) {\n return objectEntries(example.value).map(([key, value]) =>\n mapRow({ name: String(key), value: stringifyValue(value) }),\n )\n }\n\n return []\n}\n"],"mappings":";;;;;AAQA,IAAM,kBAAkB,UAAmB;AACzC,KAAI,iBAAiB,KACnB,QAAO,MAAM;AAEf,KAAI,OAAO,UAAU,YAAY,UAAU,KACzC,QAAO,KAAK,UAAU,MAAM;AAE9B,QAAO,OAAO,MAAM;;;;;;;;;;AAiBtB,IAAM,yBAAyB,QAAsB,aAAuB,EAAE,EAAE,iBAAiB,SAAoB;AAEnH,KAAI,CAAC,eAAe,OAAO,IAAI,CAAC,OAAO,WACrC,QAAO,EAAE;CAIX,MAAM,cAAc,IAAI,IAAI,OAAO,YAAY,EAAE,CAAC;CAClD,MAAM,SAAoB,EAAE;AAE5B,MAAK,MAAM,CAAC,KAAK,mBAAmB,cAAc,OAAO,WAAW,EAAE;EACpE,MAAM,cAAc,QAAQ,OAAO,eAAe;EAClD,MAAM,OAAO,CAAC,GAAG,YAAY,OAAO,IAAI,CAAC;EAIzC,MAAM,aAAa,kBAAkB,YAAY,IAAI,OAAO,IAAI,CAAC;AAKjE,MAAI,eAAe,eAAe,YAAY,IAAI,YAAY,WAC5D,QAAO,KAAK,GAAG,sBAAsB,aAAa,MAAM,WAAW,CAAC;MAEpE,QAAO,KAAK;GAAE;GAAM,QAAQ;GAAa;GAAY,CAAC;;AAI1D,QAAO;;;;;;;;;;;AAYT,IAAM,sBACJ,SACA,QACA,aAAuB,EAAE,KACgB;CACzC,MAAM,OAA6C,EAAE;CACrD,MAAM,iBAAiB,SAAS,QAA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2
  import ResponseBlock_vue_vue_type_script_setup_true_lang_default from "./ResponseBlock.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/blocks/response-block/ResponseBlock.vue
5
- var ResponseBlock_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ResponseBlock_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-82f4df98"]]);
5
+ var ResponseBlock_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ResponseBlock_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-7a7c6611"]]);
6
6
  //#endregion
7
7
  export { ResponseBlock_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBlock.vue.js","names":[],"sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\nimport { computed, ref, useId } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\nimport HeadersComponent from '@/v2/blocks/response-block/components/Headers.vue'\nimport ResponseBody from '@/v2/blocks/response-block/components/ResponseBody.vue'\nimport ResponseBodyStreaming from '@/v2/blocks/response-block/components/ResponseBodyStreaming.vue'\nimport ResponseBodyVirtual from '@/v2/blocks/response-block/components/ResponseBodyVirtual.vue'\nimport ResponseCookies from '@/v2/blocks/response-block/components/ResponseCookies.vue'\nimport ResponseEmpty from '@/v2/blocks/response-block/components/ResponseEmpty.vue'\nimport ResponseLoadingOverlay from '@/v2/blocks/response-block/components/ResponseLoadingOverlay.vue'\nimport ResponseMetaInformation from '@/v2/blocks/response-block/components/ResponseMetaInformation.vue'\nimport { textMediaTypes } from '@/v2/blocks/response-block/helpers/media-types'\nimport { parseSetCookie } from '@/v2/blocks/response-block/helpers/parse-set-cookie'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nconst { layout, totalPerformedRequests, response, requestPayload } =\n defineProps<{\n /** Preprocessed response */\n response: ResponseInstance | null\n /** Original request as a [url, RequestInit] tuple */\n requestPayload: RequestPayload | null\n /** Client layout */\n layout: ClientLayout\n /** Total number of performed requests */\n totalPerformedRequests: number\n /** Application version */\n appVersion: string\n /** Registered app plugins */\n plugins: ClientPlugin[]\n /** Workspace event bus */\n eventBus: WorkspaceEventBus\n }>()\n\n// Headers\nconst responseHeaders = computed(() => {\n const headers = response?.headers\n\n return headers\n ? Object.keys(headers).map((key) => ({\n name: key,\n value: headers[key] ?? '',\n }))\n : []\n})\n\n// Cookies\nconst responseCookies = computed(\n () =>\n response?.cookieHeaderKeys\n .map((setCookieValue) => parseSetCookie(setCookieValue))\n .filter(isDefined) ?? [],\n)\n\nconst responseSections = ['Cookies', 'Headers', 'Body'] as const\ntype Filter = 'All' | (typeof responseSections)[number]\nconst activeFilter = ref<Filter>('All')\n\nconst filters = computed<Filter[]>(() => ['All', ...responseSections])\n\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n/** Threshold for virtualizing response bodies in bytes */\nconst VIRTUALIZATION_THRESHOLD = 200_000\nconst shouldVirtualize = computed(() => {\n if (!response || !('size' in response)) {\n return false\n }\n\n // Get content type from headers\n const contentType =\n response.headers?.['content-type'] || response.headers?.['Content-Type']\n\n // If no content type or response size is small, don't virtualize\n if (!contentType || (response.size ?? 0) <= VIRTUALIZATION_THRESHOLD) {\n return false\n }\n\n // Do not virtualize html\n if (contentType.includes('text/html')) {\n return false\n }\n\n // Check if content type matches any text-based type\n const isTextBased = textMediaTypes.some((type) => contentType.includes(type))\n\n return isTextBased && (response.size ?? 0) > VIRTUALIZATION_THRESHOLD\n})\n\nconst requestHeaders = computed(() => {\n const headers = requestPayload?.[1]?.headers\n if (!headers) {\n return []\n }\n\n // Normalise via the Headers constructor, and then spread\n return [...new Headers(headers)].map(([name, value]) => ({\n name,\n value,\n required: false,\n }))\n})\n\nconst isSectionVisible = (\n section: (typeof responseSections)[number] | 'All',\n) => {\n if (activeFilter.value === 'All' || activeFilter.value === section) {\n return true\n }\n return false\n}\n\ndefineExpose({\n responseHeaders,\n responseCookies,\n requestHeaders,\n shouldVirtualize,\n activeFilter,\n filters,\n})\n</script>\n<template>\n <ViewLayoutSection aria-label=\"Response\">\n <template #title>\n <div class=\"flex h-8 flex-1 items-center\">\n <div\n aria-live=\"polite\"\n class=\"flex items-center\"\n :class=\"{ 'animate-response-heading': response }\">\n <span class=\"response-heading pointer-events-none absolute\">\n Response\n </span>\n <ResponseMetaInformation\n v-if=\"response\"\n class=\"animate-response-children\"\n :eventBus=\"eventBus\"\n :response=\"response\" />\n </div>\n <SectionFilter\n v-model=\"activeFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </div>\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"custom-scroll response-section-content relative grid h-full justify-stretch\"\n :class=\"{\n 'content-start': response,\n }\"\n :role=\"activeFilter === 'All' && response ? 'tabpanel' : 'none'\">\n <template v-if=\"!response\">\n <ResponseEmpty\n :appVersion=\"appVersion\"\n :layout=\"layout\"\n :totalPerformedRequests=\"totalPerformedRequests\"\n @addRequest=\"\n eventBus.emit('ui:open:command-palette', {\n action: 'create-request',\n payload: undefined,\n })\n \"\n @openCommandPalette=\"eventBus.emit('ui:open:command-palette')\"\n @sendRequest=\"eventBus.emit('operation:send:request:hotkey')\" />\n </template>\n <template v-else>\n <!-- Cookies section -->\n <ResponseCookies\n v-if=\"isSectionVisible('Cookies')\"\n :id=\"filterIds.Cookies\"\n class=\"response-section-content-cookies\"\n :cookies=\"responseCookies\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n <!-- Request headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"requestHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Request Headers</template>\n </HeadersComponent>\n <!-- Response headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Response Headers</template>\n </HeadersComponent>\n\n <!-- Inject response section plugin components -->\n <ScalarErrorBoundary\n v-for=\"(plugin, index) in plugins\"\n :key=\"index\">\n <component\n :is=\"plugin.components.response.component\"\n v-if=\"plugin?.components?.response\"\n v-show=\"activeFilter === 'All'\"\n v-bind=\"plugin.components.response.additionalProps\" />\n </ScalarErrorBoundary>\n\n <template v-if=\"activeFilter === 'All' || activeFilter === 'Body'\">\n <!-- Streaming response body -->\n <ResponseBodyStreaming\n v-if=\"'reader' in response\"\n :id=\"filterIds.Body\"\n class=\"response-section-content-body\"\n :reader=\"response.reader\" />\n\n <!-- Virtualized Text for massive responses -->\n <ResponseBodyVirtual\n v-else-if=\"shouldVirtualize && typeof response?.data === 'string'\"\n :id=\"filterIds.Body\"\n :content=\"response!.data\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n\n <!-- Regular response body -->\n <ResponseBody\n v-else\n :id=\"filterIds.Body\"\n :active=\"true\"\n class=\"response-section-content-body\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n layout=\"client\"\n :plugins=\"plugins\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\" />\n </template>\n </template>\n <ResponseLoadingOverlay :eventBus=\"eventBus\" />\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.animate-response-heading .response-heading {\n animation: push-response 0.2s ease-in-out forwards;\n opacity: 1;\n}\n@keyframes push-response {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n.animate-response-heading .animate-response-children {\n animation: response-spans 0.2s ease-in-out forwards 0.05s;\n opacity: 0;\n}\n\n@keyframes response-spans {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"ResponseBlock.vue.js","names":[],"sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components/error-boundary'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\nimport { computed, ref, useId } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\nimport HeadersComponent from '@/v2/blocks/response-block/components/Headers.vue'\nimport ResponseBody from '@/v2/blocks/response-block/components/ResponseBody.vue'\nimport ResponseBodyStreaming from '@/v2/blocks/response-block/components/ResponseBodyStreaming.vue'\nimport ResponseBodyVirtual from '@/v2/blocks/response-block/components/ResponseBodyVirtual.vue'\nimport ResponseCookies from '@/v2/blocks/response-block/components/ResponseCookies.vue'\nimport ResponseEmpty from '@/v2/blocks/response-block/components/ResponseEmpty.vue'\nimport ResponseLoadingOverlay from '@/v2/blocks/response-block/components/ResponseLoadingOverlay.vue'\nimport ResponseMetaInformation from '@/v2/blocks/response-block/components/ResponseMetaInformation.vue'\nimport { textMediaTypes } from '@/v2/blocks/response-block/helpers/media-types'\nimport { parseSetCookie } from '@/v2/blocks/response-block/helpers/parse-set-cookie'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nconst { layout, totalPerformedRequests, response, requestPayload } =\n defineProps<{\n /** Preprocessed response */\n response: ResponseInstance | null\n /** Original request as a [url, RequestInit] tuple */\n requestPayload: RequestPayload | null\n /** Client layout */\n layout: ClientLayout\n /** Total number of performed requests */\n totalPerformedRequests: number\n /** Application version */\n appVersion: string\n /** Registered app plugins */\n plugins: ClientPlugin[]\n /** Workspace event bus */\n eventBus: WorkspaceEventBus\n }>()\n\n// Headers\nconst responseHeaders = computed(() => {\n const headers = response?.headers\n\n return headers\n ? Object.keys(headers).map((key) => ({\n name: key,\n value: headers[key] ?? '',\n }))\n : []\n})\n\n// Cookies\nconst responseCookies = computed(\n () =>\n response?.cookieHeaderKeys\n .map((setCookieValue) => parseSetCookie(setCookieValue))\n .filter(isDefined) ?? [],\n)\n\nconst responseSections = ['Cookies', 'Headers', 'Body'] as const\ntype Filter = 'All' | (typeof responseSections)[number]\nconst activeFilter = ref<Filter>('All')\n\nconst filters = computed<Filter[]>(() => ['All', ...responseSections])\n\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n/** Threshold for virtualizing response bodies in bytes */\nconst VIRTUALIZATION_THRESHOLD = 200_000\nconst shouldVirtualize = computed(() => {\n if (!response || !('size' in response)) {\n return false\n }\n\n // Get content type from headers\n const contentType =\n response.headers?.['content-type'] || response.headers?.['Content-Type']\n\n // If no content type or response size is small, don't virtualize\n if (!contentType || (response.size ?? 0) <= VIRTUALIZATION_THRESHOLD) {\n return false\n }\n\n // Do not virtualize html\n if (contentType.includes('text/html')) {\n return false\n }\n\n // Check if content type matches any text-based type\n const isTextBased = textMediaTypes.some((type) => contentType.includes(type))\n\n return isTextBased && (response.size ?? 0) > VIRTUALIZATION_THRESHOLD\n})\n\nconst requestHeaders = computed(() => {\n const headers = requestPayload?.[1]?.headers\n if (!headers) {\n return []\n }\n\n // Normalise via the Headers constructor, and then spread\n return [...new Headers(headers)].map(([name, value]) => ({\n name,\n value,\n required: false,\n }))\n})\n\nconst isSectionVisible = (\n section: (typeof responseSections)[number] | 'All',\n) => {\n if (activeFilter.value === 'All' || activeFilter.value === section) {\n return true\n }\n return false\n}\n\ndefineExpose({\n responseHeaders,\n responseCookies,\n requestHeaders,\n shouldVirtualize,\n activeFilter,\n filters,\n})\n</script>\n<template>\n <ViewLayoutSection aria-label=\"Response\">\n <template #title>\n <div class=\"flex h-8 flex-1 items-center\">\n <div\n aria-live=\"polite\"\n class=\"flex items-center\"\n :class=\"{ 'animate-response-heading': response }\">\n <span class=\"response-heading pointer-events-none absolute\">\n Response\n </span>\n <ResponseMetaInformation\n v-if=\"response\"\n class=\"animate-response-children\"\n :eventBus=\"eventBus\"\n :response=\"response\" />\n </div>\n <SectionFilter\n v-model=\"activeFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </div>\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"custom-scroll response-section-content relative grid h-full justify-stretch\"\n :class=\"{\n 'content-start': response,\n }\"\n :role=\"activeFilter === 'All' && response ? 'tabpanel' : 'none'\">\n <template v-if=\"!response\">\n <ResponseEmpty\n :appVersion=\"appVersion\"\n :layout=\"layout\"\n :totalPerformedRequests=\"totalPerformedRequests\"\n @addRequest=\"\n eventBus.emit('ui:open:command-palette', {\n action: 'create-request',\n payload: undefined,\n })\n \"\n @openCommandPalette=\"eventBus.emit('ui:open:command-palette')\"\n @sendRequest=\"eventBus.emit('operation:send:request:hotkey')\" />\n </template>\n <template v-else>\n <!-- Cookies section -->\n <ResponseCookies\n v-if=\"isSectionVisible('Cookies')\"\n :id=\"filterIds.Cookies\"\n class=\"response-section-content-cookies\"\n :cookies=\"responseCookies\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n <!-- Request headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"requestHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Request Headers</template>\n </HeadersComponent>\n <!-- Response headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Response Headers</template>\n </HeadersComponent>\n\n <!-- Inject response section plugin components -->\n <ScalarErrorBoundary\n v-for=\"(plugin, index) in plugins\"\n :key=\"index\">\n <component\n :is=\"plugin.components.response.component\"\n v-if=\"plugin?.components?.response\"\n v-show=\"activeFilter === 'All'\"\n v-bind=\"plugin.components.response.additionalProps\" />\n </ScalarErrorBoundary>\n\n <template v-if=\"activeFilter === 'All' || activeFilter === 'Body'\">\n <!-- Streaming response body -->\n <ResponseBodyStreaming\n v-if=\"'reader' in response\"\n :id=\"filterIds.Body\"\n class=\"response-section-content-body\"\n :reader=\"response.reader\" />\n\n <!-- Virtualized Text for massive responses -->\n <ResponseBodyVirtual\n v-else-if=\"shouldVirtualize && typeof response?.data === 'string'\"\n :id=\"filterIds.Body\"\n :content=\"response!.data\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n\n <!-- Regular response body -->\n <ResponseBody\n v-else\n :id=\"filterIds.Body\"\n :active=\"true\"\n class=\"response-section-content-body\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n layout=\"client\"\n :plugins=\"plugins\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\" />\n </template>\n </template>\n <ResponseLoadingOverlay :eventBus=\"eventBus\" />\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.animate-response-heading .response-heading {\n animation: push-response 0.2s ease-in-out forwards;\n opacity: 1;\n}\n@keyframes push-response {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n.animate-response-heading .animate-response-children {\n animation: response-spans 0.2s ease-in-out forwards 0.05s;\n opacity: 0;\n}\n\n@keyframes response-spans {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n</style>\n"],"mappings":""}
@@ -11,8 +11,8 @@ import ResponseLoadingOverlay_default from "./components/ResponseLoadingOverlay.
11
11
  import ResponseMetaInformation_default from "./components/ResponseMetaInformation.vue.js";
12
12
  import { parseSetCookie } from "./helpers/parse-set-cookie.js";
13
13
  import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, mergeProps, normalizeClass, openBlock, ref, renderList, resolveDynamicComponent, unref, useId, vShow, withCtx, withDirectives } from "vue";
14
- import { ScalarErrorBoundary } from "@scalar/components";
15
14
  import { isDefined } from "@scalar/helpers/array/is-defined";
15
+ import { ScalarErrorBoundary } from "@scalar/components/error-boundary";
16
16
  //#region src/v2/blocks/response-block/ResponseBlock.vue?vue&type=script&setup=true&lang.ts
17
17
  var _hoisted_1 = { class: "flex h-8 flex-1 items-center" };
18
18
  var _hoisted_2 = ["id", "role"];
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\nimport { computed, ref, useId } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\nimport HeadersComponent from '@/v2/blocks/response-block/components/Headers.vue'\nimport ResponseBody from '@/v2/blocks/response-block/components/ResponseBody.vue'\nimport ResponseBodyStreaming from '@/v2/blocks/response-block/components/ResponseBodyStreaming.vue'\nimport ResponseBodyVirtual from '@/v2/blocks/response-block/components/ResponseBodyVirtual.vue'\nimport ResponseCookies from '@/v2/blocks/response-block/components/ResponseCookies.vue'\nimport ResponseEmpty from '@/v2/blocks/response-block/components/ResponseEmpty.vue'\nimport ResponseLoadingOverlay from '@/v2/blocks/response-block/components/ResponseLoadingOverlay.vue'\nimport ResponseMetaInformation from '@/v2/blocks/response-block/components/ResponseMetaInformation.vue'\nimport { textMediaTypes } from '@/v2/blocks/response-block/helpers/media-types'\nimport { parseSetCookie } from '@/v2/blocks/response-block/helpers/parse-set-cookie'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nconst { layout, totalPerformedRequests, response, requestPayload } =\n defineProps<{\n /** Preprocessed response */\n response: ResponseInstance | null\n /** Original request as a [url, RequestInit] tuple */\n requestPayload: RequestPayload | null\n /** Client layout */\n layout: ClientLayout\n /** Total number of performed requests */\n totalPerformedRequests: number\n /** Application version */\n appVersion: string\n /** Registered app plugins */\n plugins: ClientPlugin[]\n /** Workspace event bus */\n eventBus: WorkspaceEventBus\n }>()\n\n// Headers\nconst responseHeaders = computed(() => {\n const headers = response?.headers\n\n return headers\n ? Object.keys(headers).map((key) => ({\n name: key,\n value: headers[key] ?? '',\n }))\n : []\n})\n\n// Cookies\nconst responseCookies = computed(\n () =>\n response?.cookieHeaderKeys\n .map((setCookieValue) => parseSetCookie(setCookieValue))\n .filter(isDefined) ?? [],\n)\n\nconst responseSections = ['Cookies', 'Headers', 'Body'] as const\ntype Filter = 'All' | (typeof responseSections)[number]\nconst activeFilter = ref<Filter>('All')\n\nconst filters = computed<Filter[]>(() => ['All', ...responseSections])\n\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n/** Threshold for virtualizing response bodies in bytes */\nconst VIRTUALIZATION_THRESHOLD = 200_000\nconst shouldVirtualize = computed(() => {\n if (!response || !('size' in response)) {\n return false\n }\n\n // Get content type from headers\n const contentType =\n response.headers?.['content-type'] || response.headers?.['Content-Type']\n\n // If no content type or response size is small, don't virtualize\n if (!contentType || (response.size ?? 0) <= VIRTUALIZATION_THRESHOLD) {\n return false\n }\n\n // Do not virtualize html\n if (contentType.includes('text/html')) {\n return false\n }\n\n // Check if content type matches any text-based type\n const isTextBased = textMediaTypes.some((type) => contentType.includes(type))\n\n return isTextBased && (response.size ?? 0) > VIRTUALIZATION_THRESHOLD\n})\n\nconst requestHeaders = computed(() => {\n const headers = requestPayload?.[1]?.headers\n if (!headers) {\n return []\n }\n\n // Normalise via the Headers constructor, and then spread\n return [...new Headers(headers)].map(([name, value]) => ({\n name,\n value,\n required: false,\n }))\n})\n\nconst isSectionVisible = (\n section: (typeof responseSections)[number] | 'All',\n) => {\n if (activeFilter.value === 'All' || activeFilter.value === section) {\n return true\n }\n return false\n}\n\ndefineExpose({\n responseHeaders,\n responseCookies,\n requestHeaders,\n shouldVirtualize,\n activeFilter,\n filters,\n})\n</script>\n<template>\n <ViewLayoutSection aria-label=\"Response\">\n <template #title>\n <div class=\"flex h-8 flex-1 items-center\">\n <div\n aria-live=\"polite\"\n class=\"flex items-center\"\n :class=\"{ 'animate-response-heading': response }\">\n <span class=\"response-heading pointer-events-none absolute\">\n Response\n </span>\n <ResponseMetaInformation\n v-if=\"response\"\n class=\"animate-response-children\"\n :eventBus=\"eventBus\"\n :response=\"response\" />\n </div>\n <SectionFilter\n v-model=\"activeFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </div>\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"custom-scroll response-section-content relative grid h-full justify-stretch\"\n :class=\"{\n 'content-start': response,\n }\"\n :role=\"activeFilter === 'All' && response ? 'tabpanel' : 'none'\">\n <template v-if=\"!response\">\n <ResponseEmpty\n :appVersion=\"appVersion\"\n :layout=\"layout\"\n :totalPerformedRequests=\"totalPerformedRequests\"\n @addRequest=\"\n eventBus.emit('ui:open:command-palette', {\n action: 'create-request',\n payload: undefined,\n })\n \"\n @openCommandPalette=\"eventBus.emit('ui:open:command-palette')\"\n @sendRequest=\"eventBus.emit('operation:send:request:hotkey')\" />\n </template>\n <template v-else>\n <!-- Cookies section -->\n <ResponseCookies\n v-if=\"isSectionVisible('Cookies')\"\n :id=\"filterIds.Cookies\"\n class=\"response-section-content-cookies\"\n :cookies=\"responseCookies\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n <!-- Request headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"requestHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Request Headers</template>\n </HeadersComponent>\n <!-- Response headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Response Headers</template>\n </HeadersComponent>\n\n <!-- Inject response section plugin components -->\n <ScalarErrorBoundary\n v-for=\"(plugin, index) in plugins\"\n :key=\"index\">\n <component\n :is=\"plugin.components.response.component\"\n v-if=\"plugin?.components?.response\"\n v-show=\"activeFilter === 'All'\"\n v-bind=\"plugin.components.response.additionalProps\" />\n </ScalarErrorBoundary>\n\n <template v-if=\"activeFilter === 'All' || activeFilter === 'Body'\">\n <!-- Streaming response body -->\n <ResponseBodyStreaming\n v-if=\"'reader' in response\"\n :id=\"filterIds.Body\"\n class=\"response-section-content-body\"\n :reader=\"response.reader\" />\n\n <!-- Virtualized Text for massive responses -->\n <ResponseBodyVirtual\n v-else-if=\"shouldVirtualize && typeof response?.data === 'string'\"\n :id=\"filterIds.Body\"\n :content=\"response!.data\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n\n <!-- Regular response body -->\n <ResponseBody\n v-else\n :id=\"filterIds.Body\"\n :active=\"true\"\n class=\"response-section-content-body\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n layout=\"client\"\n :plugins=\"plugins\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\" />\n </template>\n </template>\n <ResponseLoadingOverlay :eventBus=\"eventBus\" />\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.animate-response-heading .response-heading {\n animation: push-response 0.2s ease-in-out forwards;\n opacity: 1;\n}\n@keyframes push-response {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n.animate-response-heading .animate-response-children {\n animation: response-spans 0.2s ease-in-out forwards 0.05s;\n opacity: 0;\n}\n\n@keyframes response-spans {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2EA,IAAM,2BAA2B;;;;;;;;;;;;;EAjCjC,MAAM,kBAAkB,eAAe;GACrC,MAAM,UAAU,QAAA,UAAU;AAE1B,UAAO,UACH,OAAO,KAAK,QAAQ,CAAC,KAAK,SAAS;IACjC,MAAM;IACN,OAAO,QAAQ,QAAQ;IACxB,EAAC,GACF,EAAC;IACN;EAGD,MAAM,kBAAkB,eAEpB,QAAA,UAAU,iBACP,KAAK,mBAAmB,eAAe,eAAe,CAAA,CACtD,OAAO,UAAU,IAAI,EAAE,CAC9B;EAEA,MAAM,mBAAmB;GAAC;GAAW;GAAW;GAAO;EAEvD,MAAM,eAAe,IAAY,MAAK;EAEtC,MAAM,UAAU,eAAyB,CAAC,OAAO,GAAG,iBAAiB,CAAA;EAErE,MAAM,YAAY,eAEd,OAAO,YACL,QAAQ,MAAM,KAAK,YAAY,CAAC,SAAS,OAAO,CAAC,CAAC,CACnD,CACL;;EAIA,MAAM,mBAAmB,eAAe;AACt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Q,YAAY,WAAA,gBAAA,WAAA,EAF5B,YAIwD,wBAHjD,OAAO,WAAW,SAAS,UAAS,EAD3C,WAIwD;;;UAA9C,OAAO,WAAW,SAAS,gBAAe,EAAA,MAAA,GAAA,GAAA,CAAA,CAAA,OAD1C,aAAA,UAAY,MAAA,CAAA,CAAA,GAAA,mBAAA,IAAA,KAAA,CAAA,CAAA;;;;KAIR,aAAA,UAAY,SAAc,aAAA,UAAY,UAAA,WAAA,EAAtD,mBA6BW,UAAA,EAAA,KAAA,GAAA,EAAA,CAAA,YA1BW,QAAA,YAAA,WAAA,EADpB,YAI8B,+BAAA;;MAF3B,IAAI,UAAA,MAAU;MACf,OAAM;MACL,QAAQ,QAAA,SAAS;sCAIP,iBAAA,SAAgB,OAAW,QAAA,UAAU,SAAI,YAAA,WAAA,EADtD,YAMyD,6BAAA;;MAJtD,IAAI,UAAA,MAAU;MACd,SAAS,QAAA,SAAU;MACnB,MAAM,QAAA,UAAU;MAChB,SAAS,gBAAA;MACT,MAAM,aAAA,UAAY,QAAA,SAAA;;;;;;;yBAGrB,YAUiB,sBAAA;;MARd,IAAI,UAAA,MAAU;MACd,QAAQ;MACT,OAAM;MACL,MAAM,QAAA,UAAU;MAChB,SAAS,gBAAA;MACV,QAAO;MACN,SAAS,QAAA;MACT,MAAM,aAAA,UAAY,QAAA,SAAA;MACnB,OAAM;;;;;;;;aAGZ,YAA+C,gCAAA,EAAtB,UAAU,QAAA,UAAQ,EAAA,MAAA,GAAA,CAAA,WAAA,CAAA,CAAA,EAAA,IAAA,WAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"ResponseBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/response-block/ResponseBlock.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarErrorBoundary } from '@scalar/components/error-boundary'\nimport { isDefined } from '@scalar/helpers/array/is-defined'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { RequestPayload } from '@scalar/workspace-store/request-example'\nimport { computed, ref, useId } from 'vue'\n\nimport SectionFilter from '@/components/SectionFilter.vue'\nimport ViewLayoutSection from '@/components/ViewLayout/ViewLayoutSection.vue'\nimport type { ResponseInstance } from '@/v2/blocks/operation-block/helpers/send-request'\nimport HeadersComponent from '@/v2/blocks/response-block/components/Headers.vue'\nimport ResponseBody from '@/v2/blocks/response-block/components/ResponseBody.vue'\nimport ResponseBodyStreaming from '@/v2/blocks/response-block/components/ResponseBodyStreaming.vue'\nimport ResponseBodyVirtual from '@/v2/blocks/response-block/components/ResponseBodyVirtual.vue'\nimport ResponseCookies from '@/v2/blocks/response-block/components/ResponseCookies.vue'\nimport ResponseEmpty from '@/v2/blocks/response-block/components/ResponseEmpty.vue'\nimport ResponseLoadingOverlay from '@/v2/blocks/response-block/components/ResponseLoadingOverlay.vue'\nimport ResponseMetaInformation from '@/v2/blocks/response-block/components/ResponseMetaInformation.vue'\nimport { textMediaTypes } from '@/v2/blocks/response-block/helpers/media-types'\nimport { parseSetCookie } from '@/v2/blocks/response-block/helpers/parse-set-cookie'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nconst { layout, totalPerformedRequests, response, requestPayload } =\n defineProps<{\n /** Preprocessed response */\n response: ResponseInstance | null\n /** Original request as a [url, RequestInit] tuple */\n requestPayload: RequestPayload | null\n /** Client layout */\n layout: ClientLayout\n /** Total number of performed requests */\n totalPerformedRequests: number\n /** Application version */\n appVersion: string\n /** Registered app plugins */\n plugins: ClientPlugin[]\n /** Workspace event bus */\n eventBus: WorkspaceEventBus\n }>()\n\n// Headers\nconst responseHeaders = computed(() => {\n const headers = response?.headers\n\n return headers\n ? Object.keys(headers).map((key) => ({\n name: key,\n value: headers[key] ?? '',\n }))\n : []\n})\n\n// Cookies\nconst responseCookies = computed(\n () =>\n response?.cookieHeaderKeys\n .map((setCookieValue) => parseSetCookie(setCookieValue))\n .filter(isDefined) ?? [],\n)\n\nconst responseSections = ['Cookies', 'Headers', 'Body'] as const\ntype Filter = 'All' | (typeof responseSections)[number]\nconst activeFilter = ref<Filter>('All')\n\nconst filters = computed<Filter[]>(() => ['All', ...responseSections])\n\nconst filterIds = computed(\n () =>\n Object.fromEntries(\n filters.value.map((section) => [section, useId()]),\n ) as Record<Filter, string>,\n)\n\n/** Threshold for virtualizing response bodies in bytes */\nconst VIRTUALIZATION_THRESHOLD = 200_000\nconst shouldVirtualize = computed(() => {\n if (!response || !('size' in response)) {\n return false\n }\n\n // Get content type from headers\n const contentType =\n response.headers?.['content-type'] || response.headers?.['Content-Type']\n\n // If no content type or response size is small, don't virtualize\n if (!contentType || (response.size ?? 0) <= VIRTUALIZATION_THRESHOLD) {\n return false\n }\n\n // Do not virtualize html\n if (contentType.includes('text/html')) {\n return false\n }\n\n // Check if content type matches any text-based type\n const isTextBased = textMediaTypes.some((type) => contentType.includes(type))\n\n return isTextBased && (response.size ?? 0) > VIRTUALIZATION_THRESHOLD\n})\n\nconst requestHeaders = computed(() => {\n const headers = requestPayload?.[1]?.headers\n if (!headers) {\n return []\n }\n\n // Normalise via the Headers constructor, and then spread\n return [...new Headers(headers)].map(([name, value]) => ({\n name,\n value,\n required: false,\n }))\n})\n\nconst isSectionVisible = (\n section: (typeof responseSections)[number] | 'All',\n) => {\n if (activeFilter.value === 'All' || activeFilter.value === section) {\n return true\n }\n return false\n}\n\ndefineExpose({\n responseHeaders,\n responseCookies,\n requestHeaders,\n shouldVirtualize,\n activeFilter,\n filters,\n})\n</script>\n<template>\n <ViewLayoutSection aria-label=\"Response\">\n <template #title>\n <div class=\"flex h-8 flex-1 items-center\">\n <div\n aria-live=\"polite\"\n class=\"flex items-center\"\n :class=\"{ 'animate-response-heading': response }\">\n <span class=\"response-heading pointer-events-none absolute\">\n Response\n </span>\n <ResponseMetaInformation\n v-if=\"response\"\n class=\"animate-response-children\"\n :eventBus=\"eventBus\"\n :response=\"response\" />\n </div>\n <SectionFilter\n v-model=\"activeFilter\"\n :filterIds=\"filterIds\"\n :filters=\"filters\" />\n </div>\n </template>\n <div\n :id=\"filterIds.All\"\n class=\"custom-scroll response-section-content relative grid h-full justify-stretch\"\n :class=\"{\n 'content-start': response,\n }\"\n :role=\"activeFilter === 'All' && response ? 'tabpanel' : 'none'\">\n <template v-if=\"!response\">\n <ResponseEmpty\n :appVersion=\"appVersion\"\n :layout=\"layout\"\n :totalPerformedRequests=\"totalPerformedRequests\"\n @addRequest=\"\n eventBus.emit('ui:open:command-palette', {\n action: 'create-request',\n payload: undefined,\n })\n \"\n @openCommandPalette=\"eventBus.emit('ui:open:command-palette')\"\n @sendRequest=\"eventBus.emit('operation:send:request:hotkey')\" />\n </template>\n <template v-else>\n <!-- Cookies section -->\n <ResponseCookies\n v-if=\"isSectionVisible('Cookies')\"\n :id=\"filterIds.Cookies\"\n class=\"response-section-content-cookies\"\n :cookies=\"responseCookies\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n <!-- Request headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"requestHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Request Headers</template>\n </HeadersComponent>\n <!-- Response headers section -->\n <HeadersComponent\n v-if=\"isSectionVisible('Headers')\"\n :id=\"filterIds.Headers\"\n class=\"response-section-content-headers\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\">\n <template #title>Response Headers</template>\n </HeadersComponent>\n\n <!-- Inject response section plugin components -->\n <ScalarErrorBoundary\n v-for=\"(plugin, index) in plugins\"\n :key=\"index\">\n <component\n :is=\"plugin.components.response.component\"\n v-if=\"plugin?.components?.response\"\n v-show=\"activeFilter === 'All'\"\n v-bind=\"plugin.components.response.additionalProps\" />\n </ScalarErrorBoundary>\n\n <template v-if=\"activeFilter === 'All' || activeFilter === 'Body'\">\n <!-- Streaming response body -->\n <ResponseBodyStreaming\n v-if=\"'reader' in response\"\n :id=\"filterIds.Body\"\n class=\"response-section-content-body\"\n :reader=\"response.reader\" />\n\n <!-- Virtualized Text for massive responses -->\n <ResponseBodyVirtual\n v-else-if=\"shouldVirtualize && typeof response?.data === 'string'\"\n :id=\"filterIds.Body\"\n :content=\"response!.data\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\" />\n\n <!-- Regular response body -->\n <ResponseBody\n v-else\n :id=\"filterIds.Body\"\n :active=\"true\"\n class=\"response-section-content-body\"\n :data=\"response?.data\"\n :headers=\"responseHeaders\"\n layout=\"client\"\n :plugins=\"plugins\"\n :role=\"activeFilter === 'All' ? 'none' : 'tabpanel'\"\n title=\"Body\" />\n </template>\n </template>\n <ResponseLoadingOverlay :eventBus=\"eventBus\" />\n </div>\n </ViewLayoutSection>\n</template>\n<style scoped>\n.animate-response-heading .response-heading {\n animation: push-response 0.2s ease-in-out forwards;\n opacity: 1;\n}\n@keyframes push-response {\n from {\n opacity: 1;\n transform: translateY(0);\n }\n to {\n opacity: 0;\n transform: translateY(-4px);\n }\n}\n.animate-response-heading .animate-response-children {\n animation: response-spans 0.2s ease-in-out forwards 0.05s;\n opacity: 0;\n}\n\n@keyframes response-spans {\n from {\n opacity: 0;\n transform: translateY(4px);\n }\n to {\n opacity: 1;\n transform: translateY(0);\n }\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2EA,IAAM,2BAA2B;;;;;;;;;;;;;EAjCjC,MAAM,kBAAkB,eAAe;GACrC,MAAM,UAAU,QAAA,UAAU;AAE1B,UAAO,UACH,OAAO,KAAK,QAAQ,CAAC,KAAK,SAAS;IACjC,MAAM;IACN,OAAO,QAAQ,QAAQ;IACxB,EAAC,GACF,EAAC;IACN;EAGD,MAAM,kBAAkB,eAEpB,QAAA,UAAU,iBACP,KAAK,mBAAmB,eAAe,eAAe,CAAA,CACtD,OAAO,UAAU,IAAI,EAAE,CAC9B;EAEA,MAA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}
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBodyDownload.vue.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyDownload.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarIcon } from '@scalar/components'\nimport { computed } from 'vue'\n\nimport { getMediaTypeConfig } from '@/v2/blocks/response-block/helpers/media-types'\n\nconst props = defineProps<{\n href: string\n type?: string\n filename?: string\n}>()\n\nconst filenameExtension = computed(() => {\n const extension =\n getMediaTypeConfig(props.type ?? '')?.extension ?? '.unknown'\n return props.filename ? props.filename : `response${extension}`\n})\n</script>\n<template>\n <a\n class=\"text-c-3 text-xxs hover:bg-b-3 flex items-center gap-1 rounded px-1.5 py-0.5 no-underline\"\n :download=\"`${filenameExtension}`\"\n :href=\"href\"\n @click.stop>\n <ScalarIcon\n icon=\"Download\"\n size=\"xs\" />\n <span>\n <span>Download</span>\n <span class=\"sr-only\">Response Body</span>\n </span>\n </a>\n</template>\n"],"mappings":""}
1
+ {"version":3,"file":"ResponseBodyDownload.vue.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyDownload.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { computed } from 'vue'\n\nimport { getMediaTypeConfig } from '@/v2/blocks/response-block/helpers/media-types'\n\nconst props = defineProps<{\n href: string\n type?: string\n filename?: string\n}>()\n\nconst filenameExtension = computed(() => {\n const extension =\n getMediaTypeConfig(props.type ?? '')?.extension ?? '.unknown'\n return props.filename ? props.filename : `response${extension}`\n})\n</script>\n<template>\n <a\n class=\"text-c-3 text-xxs hover:bg-b-3 flex items-center gap-1 rounded px-1.5 py-0.5 no-underline\"\n :download=\"`${filenameExtension}`\"\n :href=\"href\"\n @click.stop>\n <ScalarIcon\n icon=\"Download\"\n size=\"xs\" />\n <span>\n <span>Download</span>\n <span class=\"sr-only\">Response Body</span>\n </span>\n </a>\n</template>\n"],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import { getMediaTypeConfig } from "../helpers/media-types.js";
2
2
  import { computed, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, unref, withModifiers } from "vue";
3
- import { ScalarIcon } from "@scalar/components";
3
+ import { ScalarIcon } from "@scalar/components/icon";
4
4
  //#region src/v2/blocks/response-block/components/ResponseBodyDownload.vue?vue&type=script&setup=true&lang.ts
5
5
  var _hoisted_1 = ["download", "href"];
6
6
  var ResponseBodyDownload_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBodyDownload.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyDownload.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarIcon } from '@scalar/components'\nimport { computed } from 'vue'\n\nimport { getMediaTypeConfig } from '@/v2/blocks/response-block/helpers/media-types'\n\nconst props = defineProps<{\n href: string\n type?: string\n filename?: string\n}>()\n\nconst filenameExtension = computed(() => {\n const extension =\n getMediaTypeConfig(props.type ?? '')?.extension ?? '.unknown'\n return props.filename ? props.filename : `response${extension}`\n})\n</script>\n<template>\n <a\n class=\"text-c-3 text-xxs hover:bg-b-3 flex items-center gap-1 rounded px-1.5 py-0.5 no-underline\"\n :download=\"`${filenameExtension}`\"\n :href=\"href\"\n @click.stop>\n <ScalarIcon\n icon=\"Download\"\n size=\"xs\" />\n <span>\n <span>Download</span>\n <span class=\"sr-only\">Response Body</span>\n </span>\n </a>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAMA,MAAM,QAAQ;EAMd,MAAM,oBAAoB,eAAe;GACvC,MAAM,YACJ,mBAAmB,MAAM,QAAQ,GAAG,EAAE,aAAa;AACrD,UAAO,MAAM,WAAW,MAAM,WAAW,WAAW;IACrD;;uBAGC,mBAYI,KAAA;IAXF,OAAM;IACL,UAAQ,GAAK,kBAAA;IACb,MAAM,QAAA;IACN,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,IAAW,CAAA,OAAA,CAAA;OACX,YAEc,MAAA,WAAA,EAAA;IADZ,MAAK;IACL,MAAK;iCACP,mBAGO,QAAA,MAAA,CAFL,mBAAqB,QAAA,MAAf,WAAQ,EACd,mBAA0C,QAAA,EAApC,OAAM,WAAS,EAAC,gBAAa,CAAA,EAAA,GAAA,EAAA,EAAA,GAAA,WAAA"}
1
+ {"version":3,"file":"ResponseBodyDownload.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyDownload.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { computed } from 'vue'\n\nimport { getMediaTypeConfig } from '@/v2/blocks/response-block/helpers/media-types'\n\nconst props = defineProps<{\n href: string\n type?: string\n filename?: string\n}>()\n\nconst filenameExtension = computed(() => {\n const extension =\n getMediaTypeConfig(props.type ?? '')?.extension ?? '.unknown'\n return props.filename ? props.filename : `response${extension}`\n})\n</script>\n<template>\n <a\n class=\"text-c-3 text-xxs hover:bg-b-3 flex items-center gap-1 rounded px-1.5 py-0.5 no-underline\"\n :download=\"`${filenameExtension}`\"\n :href=\"href\"\n @click.stop>\n <ScalarIcon\n icon=\"Download\"\n size=\"xs\" />\n <span>\n <span>Download</span>\n <span class=\"sr-only\">Response Body</span>\n </span>\n </a>\n</template>\n"],"mappings":";;;;;;;;;;;;;EAMA,MAAM,QAAQ;EAMd,MAAM,oBAAoB,eAAe;GACvC,MAAM,YACJ,mBAAmB,MAAM,QAAQ,GAAG,EAAE,aAAa;AACrD,UAAO,MAAM,WAAW,MAAM,WAAW,WAAW;IACrD;;uBAGC,mBAYI,KAAA;IAXF,OAAM;IACL,UAAQ,GAAK,kBAAA;IACb,MAAM,QAAA;IACN,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,IAAW,CAAA,OAAA,CAAA;OACX,YAEc,MAAA,WAAA,EAAA;IADZ,MAAK;IACL,MAAK;iCACP,mBAGO,QAAA,MAAA,CAFL,mBAAqB,QAAA,MAAf,WAAQ,EACd,mBAA0C,QAAA,EAApC,OAAM,WAAS,EAAC,gBAAa,CAAA,EAAA,GAAA,EAAA,EAAA,GAAA,WAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBodyPreview.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyPreview.vue"],"names":[],"mappings":"AAkGA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gDAAgD,CAAA;AAKlF,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC3B,sGAAsG;IACtG,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC;AAgLF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
1
+ {"version":3,"file":"ResponseBodyPreview.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyPreview.vue"],"names":[],"mappings":"AAsLA,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,gDAAgD,CAAA;AAKlF,KAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,YAAY,CAAA;IAClB,KAAK,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC3B,sGAAsG;IACtG,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB,CAAC;AA+OF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
2
2
  import ResponseBodyPreview_vue_vue_type_script_setup_true_lang_default from "./ResponseBodyPreview.vue.script.js";
3
3
  /* empty css */
4
4
  //#region src/v2/blocks/response-block/components/ResponseBodyPreview.vue
5
- var ResponseBodyPreview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ResponseBodyPreview_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-65a8f4ce"]]);
5
+ var ResponseBodyPreview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(ResponseBodyPreview_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-8bc927e4"]]);
6
6
  //#endregion
7
7
  export { ResponseBodyPreview_default as default };
8
8
 
@@ -1 +1 @@
1
- {"version":3,"file":"ResponseBodyPreview.vue.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyPreview.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, ref, watch } from 'vue'\n\nimport { type MediaPreview } from '@/v2/blocks/response-block/helpers/media-types'\n\nimport ResponseBodyInfo from './ResponseBodyInfo.vue'\nimport ResponseBodyRaw from './ResponseBodyRaw.vue'\n\nconst {\n src,\n type,\n mode,\n alpha = false,\n content,\n} = defineProps<{\n src: string\n type: string\n mode: MediaPreview\n alpha?: boolean | undefined\n /** Decoded body; used when `mode` is `json` for pretty-printed preview (no JSON.parse round-trip). */\n content?: unknown\n}>()\n\nconst jsonPreviewContent = computed((): string => {\n const value = content\n if (typeof value === 'string') {\n return value\n }\n if (value == null) {\n return ''\n }\n return String(value)\n})\n\nconst error = ref(false)\n\nwatch(\n () => src,\n () => (error.value = false),\n)\n</script>\n<template>\n <ResponseBodyRaw\n v-if=\"mode === 'json'\"\n :content=\"jsonPreviewContent\"\n language=\"json\"\n prettyPrintJson />\n <div\n v-else-if=\"!error && src\"\n class=\"flex justify-center overflow-auto rounded-b\"\n :class=\"{ 'bg-preview p-2': alpha }\">\n <img\n v-if=\"mode === 'image'\"\n class=\"h-full max-w-full\"\n :class=\"{ rounded: alpha }\"\n :src=\"src\"\n @error=\"error = true\" />\n <video\n v-else-if=\"mode === 'video'\"\n autoplay\n controls\n width=\"100%\"\n @error=\"error = true\">\n <source\n :src=\"src\"\n :type=\"type\" />\n </video>\n <audio\n v-else-if=\"mode === 'audio'\"\n class=\"my-12\"\n controls\n @error=\"error = true\">\n <source\n :src=\"src\"\n :type=\"type\" />\n </audio>\n <object\n v-else\n class=\"aspect-[4/3] w-full\"\n :data=\"src\"\n :type=\"type\"\n @error=\"error = true\" />\n </div>\n <ResponseBodyInfo v-else>Preview unavailable</ResponseBodyInfo>\n</template>\n<style scoped>\n.light-mode .bg-preview {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23000' fill-opacity='10%25'%3E%3Crect width='8' height='8' /%3E%3Crect x='8' y='8' width='8' height='8' /%3E%3C/svg%3E\");\n}\n.dark-mode .bg-preview {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23FFF' fill-opacity='10%25'%3E%3Crect width='8' height='8' /%3E%3Crect x='8' y='8' width='8' height='8' /%3E%3C/svg%3E\");\n}\n</style>\n"],"mappings":""}
1
+ {"version":3,"file":"ResponseBodyPreview.vue.js","names":[],"sources":["../../../../../src/v2/blocks/response-block/components/ResponseBodyPreview.vue"],"sourcesContent":["<script lang=\"ts\" setup>\nimport { computed, ref, watch } from 'vue'\n\nimport { type MediaPreview } from '@/v2/blocks/response-block/helpers/media-types'\n\nimport ResponseBodyInfo from './ResponseBodyInfo.vue'\nimport ResponseBodyRaw from './ResponseBodyRaw.vue'\n\nconst {\n src,\n type,\n mode,\n alpha = false,\n content,\n} = defineProps<{\n src: string\n type: string\n mode: MediaPreview\n alpha?: boolean | undefined\n /** Decoded body; used when `mode` is `json` for pretty-printed preview (no JSON.parse round-trip). */\n content?: unknown\n}>()\n\nconst jsonPreviewContent = computed((): string => {\n const value = content\n if (typeof value === 'string') {\n return value\n }\n if (value == null) {\n return ''\n }\n return String(value)\n})\n\n/**\n * Validates the `src` against an allow-list of safe protocols before it is\n * passed to a rendering element. This blocks XSS vectors such as\n * `javascript:` and `vbscript:` URIs and also prevents accidentally embedding\n * a `data:text/html` payload that could execute script in the app origin.\n *\n * Allowed:\n * - `blob:` (the standard case — generated client-side by `URL.createObjectURL`)\n * - `http:` / `https:`\n * - `data:` URIs whose MIME type is a known safe media kind\n * (`image/*`, `video/*`, `audio/*`, `application/pdf`, `application/octet-stream`)\n *\n * Anything else (including malformed or relative URLs) collapses to an empty\n * string so the template falls back to the \"Preview unavailable\" message.\n */\nconst safeSrc = computed((): string => {\n if (!src) {\n return ''\n }\n\n if (/^data:/i.test(src)) {\n // The MIME type must be one of the known safe kinds AND be terminated by\n // `;` (parameters / `;base64`) or `,` (start of the payload). Anchoring\n // at the terminator prevents prefix-matching tricks like\n // `data:image/png-but-actually-html,…`.\n return /^data:(?:(?:image|video|audio)\\/[a-z0-9.+-]+|application\\/pdf|application\\/octet-stream)[;,]/i.test(\n src,\n )\n ? src\n : ''\n }\n\n try {\n const parsed = new URL(src)\n if (\n parsed.protocol === 'blob:' ||\n parsed.protocol === 'http:' ||\n parsed.protocol === 'https:'\n ) {\n return src\n }\n } catch {\n // Malformed or relative URL — refuse to render.\n }\n\n return ''\n})\n\nconst error = ref(false)\n\n/**\n * Whether the embedded document is a PDF.\n *\n * PDFs are rendered by the browser's own PDF engine (e.g. PDFium), which runs\n * in an isolated context that cannot reach this app's origin — its DOM,\n * cookies or storage. A PDF's embedded JavaScript therefore cannot be used to\n * attack us, and a strict `sandbox=\"\"` does not confine that engine; it only\n * prevents Chromium from loading the PDF viewer at all (it boots as a scripted\n * extension page), leaving the user with a blank frame. So PDFs are rendered\n * without the `sandbox` attribute, matching the original `<object>` behaviour.\n *\n * Everything else that reaches the iframe (notably `text/html`, the genuine\n * XSS vector) keeps the strict empty sandbox.\n */\nconst isPdf = computed(\n (): boolean => type.trim().toLowerCase() === 'application/pdf',\n)\n\nwatch(\n () => src,\n () => (error.value = false),\n)\n</script>\n<template>\n <ResponseBodyRaw\n v-if=\"mode === 'json'\"\n :content=\"jsonPreviewContent\"\n language=\"json\"\n prettyPrintJson />\n <div\n v-else-if=\"!error && safeSrc\"\n class=\"flex justify-center overflow-auto rounded-b\"\n :class=\"{ 'bg-preview p-2': alpha }\">\n <img\n v-if=\"mode === 'image'\"\n class=\"h-full max-w-full\"\n :class=\"{ rounded: alpha }\"\n :src=\"safeSrc\"\n referrerpolicy=\"no-referrer\"\n @error=\"error = true\" />\n <video\n v-else-if=\"mode === 'video'\"\n autoplay\n controls\n referrerpolicy=\"no-referrer\"\n width=\"100%\"\n @error=\"error = true\">\n <source\n :src=\"safeSrc\"\n :type=\"type\" />\n </video>\n <audio\n v-else-if=\"mode === 'audio'\"\n class=\"my-12\"\n controls\n referrerpolicy=\"no-referrer\"\n @error=\"error = true\">\n <source\n :src=\"safeSrc\"\n :type=\"type\" />\n </audio>\n <!--\n `<object>` would execute scripts inside the embedded document in the\n app's origin, so we render arbitrary previews inside an `<iframe>`\n instead. Non-PDF documents (notably `text/html`) get an empty `sandbox`\n attribute, which disables scripts, forms, popups and same-origin access.\n PDFs are exempted (see `isPdf` above): the empty sandbox does not confine\n the browser's PDF engine, it only stops the viewer from loading at all.\n\n Note: an `error` event on `<iframe>` is not reliably fired for failed\n navigations — browsers usually fire `load` even when the response is\n blank or an error page, and a cross-origin sandboxed frame cannot be\n introspected from JavaScript. There is therefore no useful runtime\n fallback for an unreachable URL; the URL allow-list above is what\n keeps unsafe content out in the first place.\n -->\n <iframe\n v-else\n class=\"aspect-[4/3] w-full border-0\"\n :src=\"safeSrc\"\n :sandbox=\"isPdf ? undefined : ''\"\n referrerpolicy=\"no-referrer\" />\n </div>\n <ResponseBodyInfo v-else>Preview unavailable</ResponseBodyInfo>\n</template>\n<style scoped>\n.light-mode .bg-preview {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23000' fill-opacity='10%25'%3E%3Crect width='8' height='8' /%3E%3Crect x='8' y='8' width='8' height='8' /%3E%3C/svg%3E\");\n}\n.dark-mode .bg-preview {\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23FFF' fill-opacity='10%25'%3E%3Crect width='8' height='8' /%3E%3Crect x='8' y='8' width='8' height='8' /%3E%3C/svg%3E\");\n}\n</style>\n"],"mappings":""}