@scalar/api-reference 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (466) hide show
  1. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  2. package/dist/components/Content/ReferenceEndpoint/ExampleRequest.vue.d.ts.map +1 -1
  3. package/dist/components/Content/ReferenceEndpoint/ExampleResponses.vue.d.ts.map +1 -1
  4. package/dist/components/HelpfulLink.vue.d.ts +20 -0
  5. package/dist/components/HelpfulLink.vue.d.ts.map +1 -0
  6. package/dist/components/SearchModal.vue.d.ts.map +1 -1
  7. package/dist/components/SimpleTable/SimpleCell.vue.d.ts +40 -0
  8. package/dist/components/SimpleTable/SimpleCell.vue.d.ts.map +1 -0
  9. package/dist/components/SimpleTable/SimpleHeader.vue.d.ts +10 -0
  10. package/dist/components/SimpleTable/SimpleHeader.vue.d.ts.map +1 -0
  11. package/dist/components/SimpleTable/SimpleRow.vue.d.ts +10 -0
  12. package/dist/components/SimpleTable/SimpleRow.vue.d.ts.map +1 -0
  13. package/dist/components/SimpleTable/SimpleTable.vue.d.ts +10 -0
  14. package/dist/components/SimpleTable/SimpleTable.vue.d.ts.map +1 -0
  15. package/dist/components/SimpleTable/index.d.ts +5 -0
  16. package/dist/components/SimpleTable/index.d.ts.map +1 -0
  17. package/dist/index.js +32962 -37640
  18. package/package.json +11 -11
  19. package/src/components/ApiClientModal.vue +205 -0
  20. package/src/components/ApiReference.vue +754 -0
  21. package/src/components/Card/Card.vue +12 -0
  22. package/src/components/Card/CardContent.vue +45 -0
  23. package/src/components/Card/CardFooter.vue +13 -0
  24. package/src/components/Card/CardHeader.vue +37 -0
  25. package/src/components/Card/CardTab.vue +32 -0
  26. package/src/components/Card/CardTabHeader.vue +32 -0
  27. package/src/components/Card/index.ts +6 -0
  28. package/src/components/Content/Content.vue +145 -0
  29. package/src/components/Content/Introduction/BaseUrl.vue +32 -0
  30. package/src/components/Content/Introduction/Introduction.vue +141 -0
  31. package/src/components/Content/Introduction/LanguageSelector.vue +361 -0
  32. package/src/components/Content/Introduction/index.ts +1 -0
  33. package/src/components/Content/MarkdownRenderer.vue +174 -0
  34. package/src/components/Content/ReferenceEndpoint/Copy.vue +100 -0
  35. package/src/components/Content/ReferenceEndpoint/ExampleRequest.vue +317 -0
  36. package/src/components/Content/ReferenceEndpoint/ExampleResponseTab.vue +22 -0
  37. package/src/components/Content/ReferenceEndpoint/ExampleResponses.vue +168 -0
  38. package/src/components/Content/ReferenceEndpoint/ParameterItem.vue +26 -0
  39. package/src/components/Content/ReferenceEndpoint/Parameters.vue +23 -0
  40. package/src/components/Content/ReferenceEndpoint/ReferenceEndpoint.vue +29 -0
  41. package/src/components/Content/ReferenceEndpoint/RequestBody.vue +125 -0
  42. package/src/components/Content/ReferenceEndpoint/RequestBodyProperties.vue +54 -0
  43. package/src/components/Content/ReferenceEndpoint/RequestBodyPropertiesChild.vue +39 -0
  44. package/src/components/Content/ReferenceEndpoint/index.ts +1 -0
  45. package/src/components/Content/ReferenceTag.vue +99 -0
  46. package/src/components/Content/Spinner.vue +51 -0
  47. package/src/components/Content/index.ts +1 -0
  48. package/src/components/FindAnythingButton.vue +76 -0
  49. package/src/components/FlowButton.vue +184 -0
  50. package/src/components/FlowIconButton.vue +25 -0
  51. package/src/components/FlowLoader.vue +207 -0
  52. package/src/components/FlowModal.vue +133 -0
  53. package/src/components/HelpfulLink.vue +19 -0
  54. package/src/components/Icon/FlowIcon.vue +19 -0
  55. package/src/components/Icon/Icon.vue +23 -0
  56. package/src/components/Icon/SvgRenderer.ts +66 -0
  57. package/src/components/Icon/brand/brand-adobe.svg +1 -0
  58. package/src/components/Icon/brand/brand-amazon.svg +1 -0
  59. package/src/components/Icon/brand/brand-browser-firefox.svg +5 -0
  60. package/src/components/Icon/brand/brand-browser-googlechrome.svg +5 -0
  61. package/src/components/Icon/brand/brand-creative-commons.svg +1 -0
  62. package/src/components/Icon/brand/brand-ecommerce-etsy.svg +1 -0
  63. package/src/components/Icon/brand/brand-ecommerce-patreon.svg +1 -0
  64. package/src/components/Icon/brand/brand-ecommerce-shopify.svg +5 -0
  65. package/src/components/Icon/brand/brand-ecommerce-wordpress.svg +1 -0
  66. package/src/components/Icon/brand/brand-gaming-nintendo-switch.svg +5 -0
  67. package/src/components/Icon/brand/brand-gaming-playstation.svg +1 -0
  68. package/src/components/Icon/brand/brand-gaming-xbox-live.svg +5 -0
  69. package/src/components/Icon/brand/brand-google-drive.svg +5 -0
  70. package/src/components/Icon/brand/brand-google-gmail.svg +5 -0
  71. package/src/components/Icon/brand/brand-google.svg +1 -0
  72. package/src/components/Icon/brand/brand-music-itunes.svg +1 -0
  73. package/src/components/Icon/brand/brand-music-soundcloud.svg +1 -0
  74. package/src/components/Icon/brand/brand-music-spotify.svg +1 -0
  75. package/src/components/Icon/brand/brand-office-dropbox.svg +5 -0
  76. package/src/components/Icon/brand/brand-office-slack.svg +5 -0
  77. package/src/components/Icon/brand/brand-office-zoom.svg +1 -0
  78. package/src/components/Icon/brand/brand-payments-alipay.svg +1 -0
  79. package/src/components/Icon/brand/brand-payments-paypal.svg +1 -0
  80. package/src/components/Icon/brand/brand-payments-stripe.svg +1 -0
  81. package/src/components/Icon/brand/brand-platform-android.svg +1 -0
  82. package/src/components/Icon/brand/brand-platform-apple.svg +5 -0
  83. package/src/components/Icon/brand/brand-platform-linux.svg +5 -0
  84. package/src/components/Icon/brand/brand-platform-microsoft-windows.svg +4 -0
  85. package/src/components/Icon/brand/brand-social-chat-discord.svg +5 -0
  86. package/src/components/Icon/brand/brand-social-chat-kuaishou.svg +5 -0
  87. package/src/components/Icon/brand/brand-social-chat-line.svg +5 -0
  88. package/src/components/Icon/brand/brand-social-chat-messenger.svg +5 -0
  89. package/src/components/Icon/brand/brand-social-chat-signal.svg +5 -0
  90. package/src/components/Icon/brand/brand-social-chat-snapchat.svg +5 -0
  91. package/src/components/Icon/brand/brand-social-chat-telegram.svg +5 -0
  92. package/src/components/Icon/brand/brand-social-chat-wechat.svg +5 -0
  93. package/src/components/Icon/brand/brand-social-chat-whatsapp.svg +5 -0
  94. package/src/components/Icon/brand/brand-social-media-deviantart.svg +5 -0
  95. package/src/components/Icon/brand/brand-social-media-dribbble.svg +1 -0
  96. package/src/components/Icon/brand/brand-social-media-facebook.svg +1 -0
  97. package/src/components/Icon/brand/brand-social-media-instagram.svg +5 -0
  98. package/src/components/Icon/brand/brand-social-media-linkedin.svg +5 -0
  99. package/src/components/Icon/brand/brand-social-media-pinterest.svg +5 -0
  100. package/src/components/Icon/brand/brand-social-media-reddit.svg +1 -0
  101. package/src/components/Icon/brand/brand-social-media-sina-weibo.svg +5 -0
  102. package/src/components/Icon/brand/brand-social-media-threads.svg +1 -0
  103. package/src/components/Icon/brand/brand-social-media-tiktok.svg +5 -0
  104. package/src/components/Icon/brand/brand-social-media-tinder.svg +1 -0
  105. package/src/components/Icon/brand/brand-social-media-tumblr.svg +5 -0
  106. package/src/components/Icon/brand/brand-social-media-twitter.svg +5 -0
  107. package/src/components/Icon/brand/brand-software-design-figma.svg +1 -0
  108. package/src/components/Icon/brand/brand-software-development-authy.svg +1 -0
  109. package/src/components/Icon/brand/brand-software-development-digital-ocean.svg +1 -0
  110. package/src/components/Icon/brand/brand-software-development-docker.svg +5 -0
  111. package/src/components/Icon/brand/brand-software-development-github.svg +5 -0
  112. package/src/components/Icon/brand/brand-software-development-jira.svg +1 -0
  113. package/src/components/Icon/brand/brand-software-development-openai.svg +1 -0
  114. package/src/components/Icon/brand/brand-software-development-stackexchange.svg +5 -0
  115. package/src/components/Icon/brand/brand-software-development-stackoverflow.svg +1 -0
  116. package/src/components/Icon/brand/brand-video-netflix.svg +5 -0
  117. package/src/components/Icon/brand/brand-video-twitch.svg +1 -0
  118. package/src/components/Icon/brand/brand-video-vimeo.svg +5 -0
  119. package/src/components/Icon/brand/brand-video-youtube.svg +5 -0
  120. package/src/components/Icon/brand/programming-framework-angular.svg +5 -0
  121. package/src/components/Icon/brand/programming-framework-astro.svg +5 -0
  122. package/src/components/Icon/brand/programming-framework-laravel.svg +1 -0
  123. package/src/components/Icon/brand/programming-framework-nextdotjs.svg +5 -0
  124. package/src/components/Icon/brand/programming-framework-react.svg +5 -0
  125. package/src/components/Icon/brand/programming-framework-vuedotjs.svg +1 -0
  126. package/src/components/Icon/brand/programming-language-c.svg +5 -0
  127. package/src/components/Icon/brand/programming-language-clojure.svg +5 -0
  128. package/src/components/Icon/brand/programming-language-csharp.svg +4 -0
  129. package/src/components/Icon/brand/programming-language-css3.svg +4 -0
  130. package/src/components/Icon/brand/programming-language-go.svg +4 -0
  131. package/src/components/Icon/brand/programming-language-html5.svg +4 -0
  132. package/src/components/Icon/brand/programming-language-java.svg +21 -0
  133. package/src/components/Icon/brand/programming-language-javascript-js.svg +4 -0
  134. package/src/components/Icon/brand/programming-language-json.svg +8 -0
  135. package/src/components/Icon/brand/programming-language-kotlin.svg +3 -0
  136. package/src/components/Icon/brand/programming-language-node.svg +10 -0
  137. package/src/components/Icon/brand/programming-language-objc.svg +6 -0
  138. package/src/components/Icon/brand/programming-language-ocaml.svg +4 -0
  139. package/src/components/Icon/brand/programming-language-php.svg +4 -0
  140. package/src/components/Icon/brand/programming-language-powershell.svg +10 -0
  141. package/src/components/Icon/brand/programming-language-python.svg +4 -0
  142. package/src/components/Icon/brand/programming-language-r.svg +7 -0
  143. package/src/components/Icon/brand/programming-language-ruby.svg +5 -0
  144. package/src/components/Icon/brand/programming-language-scala.svg +5 -0
  145. package/src/components/Icon/brand/programming-language-shell.svg +5 -0
  146. package/src/components/Icon/brand/programming-language-swift.svg +4 -0
  147. package/src/components/Icon/brand/programming-language-typescript.svg +5 -0
  148. package/src/components/Icon/brand/programming-tool-git.svg +1 -0
  149. package/src/components/Icon/brand/programming-tool-tailwindcss.svg +5 -0
  150. package/src/components/Icon/icons/Add.svg +4 -0
  151. package/src/components/Icon/icons/ArrowDown.svg +3 -0
  152. package/src/components/Icon/icons/ArrowLeft.svg +3 -0
  153. package/src/components/Icon/icons/ArrowRight.svg +3 -0
  154. package/src/components/Icon/icons/ArrowUp.svg +3 -0
  155. package/src/components/Icon/icons/Background.svg +8 -0
  156. package/src/components/Icon/icons/CallToAction.svg +5 -0
  157. package/src/components/Icon/icons/CheckMark.svg +3 -0
  158. package/src/components/Icon/icons/ChevronDown.svg +3 -0
  159. package/src/components/Icon/icons/ChevronLeft.svg +3 -0
  160. package/src/components/Icon/icons/ChevronRight.svg +3 -0
  161. package/src/components/Icon/icons/ChevronUp.svg +3 -0
  162. package/src/components/Icon/icons/Close.svg +3 -0
  163. package/src/components/Icon/icons/DarkMode.svg +4 -0
  164. package/src/components/Icon/icons/Delete.svg +5 -0
  165. package/src/components/Icon/icons/Discord.svg +5 -0
  166. package/src/components/Icon/icons/Duplicate.svg +6 -0
  167. package/src/components/Icon/icons/Edit.svg +4 -0
  168. package/src/components/Icon/icons/EditorBold.svg +4 -0
  169. package/src/components/Icon/icons/EditorCode.svg +6 -0
  170. package/src/components/Icon/icons/EditorHighlight.svg +12 -0
  171. package/src/components/Icon/icons/EditorItalic.svg +4 -0
  172. package/src/components/Icon/icons/EditorLink.svg +8 -0
  173. package/src/components/Icon/icons/EditorStrike.svg +4 -0
  174. package/src/components/Icon/icons/EditorUnderline.svg +6 -0
  175. package/src/components/Icon/icons/Ellipses.svg +4 -0
  176. package/src/components/Icon/icons/Error.svg +4 -0
  177. package/src/components/Icon/icons/ExternalLink.svg +7 -0
  178. package/src/components/Icon/icons/Folder.svg +4 -0
  179. package/src/components/Icon/icons/GitHub.svg +4 -0
  180. package/src/components/Icon/icons/Google.svg +4 -0
  181. package/src/components/Icon/icons/Hide.svg +5 -0
  182. package/src/components/Icon/icons/Key.svg +5 -0
  183. package/src/components/Icon/icons/Leave.svg +5 -0
  184. package/src/components/Icon/icons/LightMode.svg +6 -0
  185. package/src/components/Icon/icons/Link.svg +5 -0
  186. package/src/components/Icon/icons/Lock.svg +4 -0
  187. package/src/components/Icon/icons/Logo.svg +4 -0
  188. package/src/components/Icon/icons/LogoAPI.svg +4 -0
  189. package/src/components/Icon/icons/LogoClient.svg +4 -0
  190. package/src/components/Icon/icons/LogoMarket.svg +4 -0
  191. package/src/components/Icon/icons/LogoSwagger.svg +4 -0
  192. package/src/components/Icon/icons/Magic.svg +5 -0
  193. package/src/components/Icon/icons/Menu.svg +3 -0
  194. package/src/components/Icon/icons/Page.svg +8 -0
  195. package/src/components/Icon/icons/Payment.svg +5 -0
  196. package/src/components/Icon/icons/Refresh.svg +4 -0
  197. package/src/components/Icon/icons/Search.svg +4 -0
  198. package/src/components/Icon/icons/Show.svg +5 -0
  199. package/src/components/Icon/icons/Sigma.svg +4 -0
  200. package/src/components/Icon/icons/Trash.svg +5 -0
  201. package/src/components/Icon/icons/index.ts +65 -0
  202. package/src/components/Icon/index.ts +2 -0
  203. package/src/components/Icon/line/arrow-chevron-down.svg +1 -0
  204. package/src/components/Icon/line/arrow-chevron-left.svg +1 -0
  205. package/src/components/Icon/line/arrow-chevron-right.svg +1 -0
  206. package/src/components/Icon/line/arrow-chevron-up.svg +1 -0
  207. package/src/components/Icon/line/arrow-down.svg +1 -0
  208. package/src/components/Icon/line/arrow-left.svg +1 -0
  209. package/src/components/Icon/line/arrow-right.svg +1 -0
  210. package/src/components/Icon/line/arrow-up.svg +1 -0
  211. package/src/components/Icon/line/basic-shape-diamond.svg +1 -0
  212. package/src/components/Icon/line/basic-shape-hexagon.svg +1 -0
  213. package/src/components/Icon/line/basic-shape-primary-circle-ellipse-round.svg +1 -0
  214. package/src/components/Icon/line/basic-shape-primary-square-rectangle.svg +1 -0
  215. package/src/components/Icon/line/basic-shape-shield.svg +1 -0
  216. package/src/components/Icon/line/computer-device-desktop-monitor.svg +1 -0
  217. package/src/components/Icon/line/computer-device-desktop.svg +1 -0
  218. package/src/components/Icon/line/computer-device-laptop.svg +1 -0
  219. package/src/components/Icon/line/computer-device-mobile-phone-android-samsung-back.svg +1 -0
  220. package/src/components/Icon/line/computer-device-mobile-phone-android-samsung.svg +1 -0
  221. package/src/components/Icon/line/computer-device-mobile-phone-iphone-x-back.svg +1 -0
  222. package/src/components/Icon/line/computer-device-mobile-phone-iphone-x.svg +1 -0
  223. package/src/components/Icon/line/computer-device-mobile-tablet-touch.svg +1 -0
  224. package/src/components/Icon/line/computer-device-mobile-tablet.svg +1 -0
  225. package/src/components/Icon/line/computer-device-network-ethernet-cat6.svg +1 -0
  226. package/src/components/Icon/line/computer-device-network-lan-www.svg +1 -0
  227. package/src/components/Icon/line/computer-device-network-wifi-connection.svg +1 -0
  228. package/src/components/Icon/line/computer-device-network-wifi-router.svg +1 -0
  229. package/src/components/Icon/line/computer-keyboard-alt.svg +1 -0
  230. package/src/components/Icon/line/computer-keyboard-command-cmd-control-ctrl.svg +1 -0
  231. package/src/components/Icon/line/computer-keyboard-option.svg +1 -0
  232. package/src/components/Icon/line/computer-keyboard-shift.svg +1 -0
  233. package/src/components/Icon/line/ecology-science-erlenmeyer-flask.svg +1 -0
  234. package/src/components/Icon/line/entertainment-control-button-circle-left-arrow-rewind.svg +1 -0
  235. package/src/components/Icon/line/entertainment-control-button-circle-pause.svg +1 -0
  236. package/src/components/Icon/line/entertainment-control-button-circle-right-arrow-fast-forward.svg +1 -0
  237. package/src/components/Icon/line/entertainment-control-button-circle-stop-square.svg +1 -0
  238. package/src/components/Icon/line/entertainment-control-button-play-circle.svg +1 -0
  239. package/src/components/Icon/line/entertainment-party-popper-confetti.svg +1 -0
  240. package/src/components/Icon/line/image-flash-lightning.svg +1 -0
  241. package/src/components/Icon/line/image-photo-frame.svg +1 -0
  242. package/src/components/Icon/line/image-picture-flower.svg +1 -0
  243. package/src/components/Icon/line/interface-add.svg +1 -0
  244. package/src/components/Icon/line/interface-alert-error-exclamation-block-square.svg +1 -0
  245. package/src/components/Icon/line/interface-alert-error-x-block-square.svg +1 -0
  246. package/src/components/Icon/line/interface-alert-exclamation-diamond.svg +1 -0
  247. package/src/components/Icon/line/interface-alert-exclamation-triangle-warning.svg +1 -0
  248. package/src/components/Icon/line/interface-alert-information-circle.svg +1 -0
  249. package/src/components/Icon/line/interface-award-crown.svg +1 -0
  250. package/src/components/Icon/line/interface-bookmark-tag.svg +1 -0
  251. package/src/components/Icon/line/interface-bookmark.svg +1 -0
  252. package/src/components/Icon/line/interface-calendar-date-one.svg +1 -0
  253. package/src/components/Icon/line/interface-close.svg +1 -0
  254. package/src/components/Icon/line/interface-content-book-open-pages.svg +1 -0
  255. package/src/components/Icon/line/interface-content-book-page.svg +1 -0
  256. package/src/components/Icon/line/interface-content-file.svg +8 -0
  257. package/src/components/Icon/line/interface-content-folder.svg +1 -0
  258. package/src/components/Icon/line/interface-copy-clipboard.svg +1 -0
  259. package/src/components/Icon/line/interface-delete-bin-trash.svg +1 -0
  260. package/src/components/Icon/line/interface-dots-horizontal.svg +1 -0
  261. package/src/components/Icon/line/interface-dots-vertical.svg +1 -0
  262. package/src/components/Icon/line/interface-edit-attachment.svg +1 -0
  263. package/src/components/Icon/line/interface-edit-binocular.svg +1 -0
  264. package/src/components/Icon/line/interface-edit-magic-wand.svg +1 -0
  265. package/src/components/Icon/line/interface-edit-tool-eraser.svg +1 -0
  266. package/src/components/Icon/line/interface-edit-tool-paint-brush.svg +1 -0
  267. package/src/components/Icon/line/interface-edit-tool-paint-roller.svg +1 -0
  268. package/src/components/Icon/line/interface-edit-tool-pen.svg +1 -0
  269. package/src/components/Icon/line/interface-edit-tool-pencil.svg +1 -0
  270. package/src/components/Icon/line/interface-edit-view-eye.svg +1 -0
  271. package/src/components/Icon/line/interface-favorite-award.svg +1 -0
  272. package/src/components/Icon/line/interface-favorite-flag.svg +1 -0
  273. package/src/components/Icon/line/interface-favorite-heart.svg +1 -0
  274. package/src/components/Icon/line/interface-favorite-star.svg +1 -0
  275. package/src/components/Icon/line/interface-favorite-stars-shining.svg +1 -0
  276. package/src/components/Icon/line/interface-favorite-stars-sparkles.svg +1 -0
  277. package/src/components/Icon/line/interface-hierarchy-flowchart.svg +1 -0
  278. package/src/components/Icon/line/interface-home-house.svg +1 -0
  279. package/src/components/Icon/line/interface-hyperlink.svg +1 -0
  280. package/src/components/Icon/line/interface-lighting-brightness.svg +1 -0
  281. package/src/components/Icon/line/interface-lock-closed.svg +1 -0
  282. package/src/components/Icon/line/interface-lock-open-unlock.svg +1 -0
  283. package/src/components/Icon/line/interface-login-key.svg +1 -0
  284. package/src/components/Icon/line/interface-search.svg +1 -0
  285. package/src/components/Icon/line/interface-setting-cog.svg +1 -0
  286. package/src/components/Icon/line/interface-share-megaphone-bullhorn.svg +1 -0
  287. package/src/components/Icon/line/interface-share-rocket.svg +1 -0
  288. package/src/components/Icon/line/interface-share-satellite.svg +1 -0
  289. package/src/components/Icon/line/interface-share-space-ship.svg +1 -0
  290. package/src/components/Icon/line/interface-share.svg +1 -0
  291. package/src/components/Icon/line/interface-signal-square.svg +1 -0
  292. package/src/components/Icon/line/interface-text-formatting-left-open-quote.svg +1 -0
  293. package/src/components/Icon/line/interface-text-formatting-right-close-quote.svg +1 -0
  294. package/src/components/Icon/line/interface-time-clock-circle.svg +1 -0
  295. package/src/components/Icon/line/interface-time-hour-glass.svg +1 -0
  296. package/src/components/Icon/line/interface-users-multiple.svg +1 -0
  297. package/src/components/Icon/line/interface-validation-checkbox-square.svg +1 -0
  298. package/src/components/Icon/line/interface-weather-moon.svg +1 -0
  299. package/src/components/Icon/line/legal-justice-hammer-gavel.svg +1 -0
  300. package/src/components/Icon/line/mail-chat-bubble-square.svg +1 -0
  301. package/src/components/Icon/line/mail-send-email-paper-airplane.svg +1 -0
  302. package/src/components/Icon/line/mail-send-envelope.svg +1 -0
  303. package/src/components/Icon/line/mail-sign-hashtag.svg +1 -0
  304. package/src/components/Icon/line/money-cashier-receipt.svg +1 -0
  305. package/src/components/Icon/line/money-currency-dollar-pay.svg +1 -0
  306. package/src/components/Icon/line/money-graph-arrow-increase.svg +1 -0
  307. package/src/components/Icon/line/money-graph-bar-chart-increase.svg +1 -0
  308. package/src/components/Icon/line/nature-ecology-leaf.svg +1 -0
  309. package/src/components/Icon/line/phone-telephone.svg +1 -0
  310. package/src/components/Icon/line/programming-bug.svg +1 -0
  311. package/src/components/Icon/line/programming-cloud.svg +1 -0
  312. package/src/components/Icon/line/programming-computer-database-server.svg +1 -0
  313. package/src/components/Icon/line/programming-computer-database.svg +1 -0
  314. package/src/components/Icon/line/programming-module-four-layout.svg +1 -0
  315. package/src/components/Icon/line/programming-module-three.svg +1 -0
  316. package/src/components/Icon/line/programming-module.svg +1 -0
  317. package/src/components/Icon/line/programming-script-code.svg +1 -0
  318. package/src/components/Icon/line/shopping-cart.svg +8 -0
  319. package/src/components/Icon/line/shopping-gift-present.svg +1 -0
  320. package/src/components/Icon/line/shopping-shipping-box-parcel-package.svg +1 -0
  321. package/src/components/Icon/line/tag-new-circle.svg +1 -0
  322. package/src/components/Icon/line/travel-map-earth-globe.svg +1 -0
  323. package/src/components/Icon/localIcons.ts +68 -0
  324. package/src/components/Icon/solid/arrow-chevron-down.svg +1 -0
  325. package/src/components/Icon/solid/arrow-chevron-left.svg +1 -0
  326. package/src/components/Icon/solid/arrow-chevron-right.svg +1 -0
  327. package/src/components/Icon/solid/arrow-chevron-up.svg +1 -0
  328. package/src/components/Icon/solid/arrow-down.svg +1 -0
  329. package/src/components/Icon/solid/arrow-left.svg +1 -0
  330. package/src/components/Icon/solid/arrow-right.svg +1 -0
  331. package/src/components/Icon/solid/arrow-up.svg +1 -0
  332. package/src/components/Icon/solid/basic-shape-diamond.svg +1 -0
  333. package/src/components/Icon/solid/basic-shape-hexagon.svg +1 -0
  334. package/src/components/Icon/solid/basic-shape-primary-circle-ellipse-round.svg +1 -0
  335. package/src/components/Icon/solid/basic-shape-primary-square-rectangle.svg +1 -0
  336. package/src/components/Icon/solid/basic-shape-shield.svg +1 -0
  337. package/src/components/Icon/solid/computer-device-desktop-monitor.svg +1 -0
  338. package/src/components/Icon/solid/computer-device-desktop.svg +1 -0
  339. package/src/components/Icon/solid/computer-device-laptop.svg +1 -0
  340. package/src/components/Icon/solid/computer-device-mobile-phone-android-samsung-back.svg +1 -0
  341. package/src/components/Icon/solid/computer-device-mobile-phone-android-samsung.svg +1 -0
  342. package/src/components/Icon/solid/computer-device-mobile-phone-iphone-x-back.svg +1 -0
  343. package/src/components/Icon/solid/computer-device-mobile-phone-iphone-x.svg +1 -0
  344. package/src/components/Icon/solid/computer-device-mobile-tablet-touch.svg +1 -0
  345. package/src/components/Icon/solid/computer-device-mobile-tablet.svg +1 -0
  346. package/src/components/Icon/solid/computer-device-network-ethernet-cat6.svg +1 -0
  347. package/src/components/Icon/solid/computer-device-network-lan-www.svg +1 -0
  348. package/src/components/Icon/solid/computer-device-network-wifi-connection.svg +5 -0
  349. package/src/components/Icon/solid/computer-device-network-wifi-router.svg +1 -0
  350. package/src/components/Icon/solid/computer-keyboard-alt.svg +1 -0
  351. package/src/components/Icon/solid/computer-keyboard-command-cmd-control-ctrl.svg +1 -0
  352. package/src/components/Icon/solid/computer-keyboard-option.svg +1 -0
  353. package/src/components/Icon/solid/computer-keyboard-shift.svg +1 -0
  354. package/src/components/Icon/solid/ecology-science-erlenmeyer-flask.svg +1 -0
  355. package/src/components/Icon/solid/entertainment-control-button-circle-left-arrow-rewind.svg +1 -0
  356. package/src/components/Icon/solid/entertainment-control-button-circle-pause.svg +1 -0
  357. package/src/components/Icon/solid/entertainment-control-button-circle-play.svg +5 -0
  358. package/src/components/Icon/solid/entertainment-control-button-circle-right-arrow-fast-forward.svg +1 -0
  359. package/src/components/Icon/solid/entertainment-control-button-circle-stop-square.svg +1 -0
  360. package/src/components/Icon/solid/entertainment-party-popper-confetti.svg +1 -0
  361. package/src/components/Icon/solid/image-flash-lightning.svg +5 -0
  362. package/src/components/Icon/solid/image-photo-frame.svg +11 -0
  363. package/src/components/Icon/solid/image-picture-flower.svg +5 -0
  364. package/src/components/Icon/solid/interface-add-square.svg +5 -0
  365. package/src/components/Icon/solid/interface-alert-error-exclamation-block-square.svg +1 -0
  366. package/src/components/Icon/solid/interface-alert-error-x-block-square.svg +1 -0
  367. package/src/components/Icon/solid/interface-alert-exclamation-diamond.svg +1 -0
  368. package/src/components/Icon/solid/interface-alert-exclamation-triangle-warning.svg +1 -0
  369. package/src/components/Icon/solid/interface-alert-information-circle.svg +5 -0
  370. package/src/components/Icon/solid/interface-award-crown.svg +5 -0
  371. package/src/components/Icon/solid/interface-bookmark-tag.svg +1 -0
  372. package/src/components/Icon/solid/interface-bookmark.svg +5 -0
  373. package/src/components/Icon/solid/interface-calendar-date-one.svg +5 -0
  374. package/src/components/Icon/solid/interface-close.svg +8 -0
  375. package/src/components/Icon/solid/interface-content-book-open-pages.svg +13 -0
  376. package/src/components/Icon/solid/interface-content-book-page.svg +5 -0
  377. package/src/components/Icon/solid/interface-content-file.svg +5 -0
  378. package/src/components/Icon/solid/interface-content-folder.svg +1 -0
  379. package/src/components/Icon/solid/interface-copy-clipboard.svg +5 -0
  380. package/src/components/Icon/solid/interface-delete-bin-trash.svg +1 -0
  381. package/src/components/Icon/solid/interface-dots-horizontal.svg +1 -0
  382. package/src/components/Icon/solid/interface-dots-vertical.svg +1 -0
  383. package/src/components/Icon/solid/interface-edit-attachment.svg +5 -0
  384. package/src/components/Icon/solid/interface-edit-binocular.svg +5 -0
  385. package/src/components/Icon/solid/interface-edit-magic-wand.svg +7 -0
  386. package/src/components/Icon/solid/interface-edit-tool-eraser.svg +1 -0
  387. package/src/components/Icon/solid/interface-edit-tool-paint-brush.svg +1 -0
  388. package/src/components/Icon/solid/interface-edit-tool-paint-roller.svg +5 -0
  389. package/src/components/Icon/solid/interface-edit-tool-pen.svg +5 -0
  390. package/src/components/Icon/solid/interface-edit-tool-pencil.svg +1 -0
  391. package/src/components/Icon/solid/interface-edit-view-eye.svg +7 -0
  392. package/src/components/Icon/solid/interface-favorite-award.svg +5 -0
  393. package/src/components/Icon/solid/interface-favorite-flag.svg +1 -0
  394. package/src/components/Icon/solid/interface-favorite-heart.svg +5 -0
  395. package/src/components/Icon/solid/interface-favorite-star.svg +5 -0
  396. package/src/components/Icon/solid/interface-favorite-stars-shining.svg +1 -0
  397. package/src/components/Icon/solid/interface-favorite-stars-sparkles.svg +1 -0
  398. package/src/components/Icon/solid/interface-hierarchy-flowchart.svg +5 -0
  399. package/src/components/Icon/solid/interface-home-house.svg +5 -0
  400. package/src/components/Icon/solid/interface-hyperlink.svg +5 -0
  401. package/src/components/Icon/solid/interface-lighting-brightness.svg +22 -0
  402. package/src/components/Icon/solid/interface-lock-closed.svg +5 -0
  403. package/src/components/Icon/solid/interface-lock-open-unlock.svg +1 -0
  404. package/src/components/Icon/solid/interface-login-key.svg +5 -0
  405. package/src/components/Icon/solid/interface-search.svg +5 -0
  406. package/src/components/Icon/solid/interface-setting-cog.svg +5 -0
  407. package/src/components/Icon/solid/interface-share-megaphone-bullhorn.svg +5 -0
  408. package/src/components/Icon/solid/interface-share-rocket.svg +1 -0
  409. package/src/components/Icon/solid/interface-share-satellite.svg +8 -0
  410. package/src/components/Icon/solid/interface-share-space-ship.svg +1 -0
  411. package/src/components/Icon/solid/interface-share.svg +5 -0
  412. package/src/components/Icon/solid/interface-signal-square.svg +5 -0
  413. package/src/components/Icon/solid/interface-text-formatting-left-open-quote.svg +1 -0
  414. package/src/components/Icon/solid/interface-text-formatting-right-close-quote.svg +1 -0
  415. package/src/components/Icon/solid/interface-time-clock-circle.svg +5 -0
  416. package/src/components/Icon/solid/interface-time-hour-glass.svg +1 -0
  417. package/src/components/Icon/solid/interface-users-multiple.svg +11 -0
  418. package/src/components/Icon/solid/interface-validation-checkbox-square.svg +5 -0
  419. package/src/components/Icon/solid/interface-weather-moon.svg +5 -0
  420. package/src/components/Icon/solid/legal-justice-hammer-gavel.svg +1 -0
  421. package/src/components/Icon/solid/mail-chat-bubble-square.svg +5 -0
  422. package/src/components/Icon/solid/mail-send-email-paper-airplane.svg +5 -0
  423. package/src/components/Icon/solid/mail-send-envelope.svg +1 -0
  424. package/src/components/Icon/solid/mail-sign-hashtag.svg +5 -0
  425. package/src/components/Icon/solid/money-cashier-receipt.svg +1 -0
  426. package/src/components/Icon/solid/money-currency-dollar-pay.svg +5 -0
  427. package/src/components/Icon/solid/money-graph-arrow-increase.svg +5 -0
  428. package/src/components/Icon/solid/money-graph-bar-chart-increase.svg +1 -0
  429. package/src/components/Icon/solid/nature-ecology-leaf.svg +5 -0
  430. package/src/components/Icon/solid/phone-telephone.svg +5 -0
  431. package/src/components/Icon/solid/programming-bug.svg +5 -0
  432. package/src/components/Icon/solid/programming-cloud.svg +4 -0
  433. package/src/components/Icon/solid/programming-computer-database-server.svg +5 -0
  434. package/src/components/Icon/solid/programming-computer-database.svg +5 -0
  435. package/src/components/Icon/solid/programming-module-four-layout.svg +1 -0
  436. package/src/components/Icon/solid/programming-module-three.svg +1 -0
  437. package/src/components/Icon/solid/programming-module.svg +1 -0
  438. package/src/components/Icon/solid/programming-script-code.svg +5 -0
  439. package/src/components/Icon/solid/shopping-cart.svg +1 -0
  440. package/src/components/Icon/solid/shopping-gift-present.svg +16 -0
  441. package/src/components/Icon/solid/shopping-shipping-box-parcel-package.svg +11 -0
  442. package/src/components/Icon/solid/tag-new-circle.svg +7 -0
  443. package/src/components/Icon/solid/travel-map-earth-globe.svg +5 -0
  444. package/src/components/SearchModal.vue +305 -0
  445. package/src/components/Sidebar.vue +289 -0
  446. package/src/components/SidebarElement.vue +133 -0
  447. package/src/components/SidebarGroup.vue +12 -0
  448. package/src/components/SimpleTable/SimpleCell.vue +46 -0
  449. package/src/components/SimpleTable/SimpleHeader.vue +17 -0
  450. package/src/components/SimpleTable/SimpleRow.vue +5 -0
  451. package/src/components/SimpleTable/SimpleTable.vue +13 -0
  452. package/src/components/SimpleTable/index.ts +4 -0
  453. package/src/declarations/typographic-base.d.ts +1 -0
  454. package/src/helpers/generateAxiosCodeFromRequest.ts +42 -0
  455. package/src/helpers/generateLaravelCodeFromRequest.ts +20 -0
  456. package/src/helpers/index.ts +4 -0
  457. package/src/helpers/objectMerge.ts +19 -0
  458. package/src/helpers/specHelpers.ts +62 -0
  459. package/src/helpers/transformToJson.test.ts +7 -0
  460. package/src/helpers/transformToJson.ts +22 -0
  461. package/src/hooks/useRefOnMount.ts +12 -0
  462. package/src/index.ts +11 -0
  463. package/src/standalone.ts +28 -0
  464. package/src/stores/template.ts +66 -0
  465. package/src/stores/utility.ts +23 -0
  466. package/src/types.ts +154 -0
@@ -0,0 +1,317 @@
1
+ <script setup lang="ts">
2
+ import {
3
+ CodeMirror,
4
+ generateRequest,
5
+ useApiClientRequestStore,
6
+ useApiClientStore,
7
+ useOperation,
8
+ } from '@scalar/api-client'
9
+ import { useClipboard } from '@scalar/use-clipboard'
10
+ import {
11
+ HTTPSnippet,
12
+ type HarRequest,
13
+ type TargetId,
14
+ availableTargets,
15
+ } from 'httpsnippet-lite'
16
+ import { computed, onMounted, ref, watch } from 'vue'
17
+
18
+ import {
19
+ generateAxiosCodeFromRequest,
20
+ generateLaravelCodeFromRequest,
21
+ } from '../../../helpers'
22
+ import { useTemplateStore } from '../../../stores/template'
23
+ import type { Operation, Server } from '../../../types'
24
+ import { Card, CardContent, CardFooter, CardHeader } from '../../Card'
25
+ import { Icon } from '../../Icon'
26
+
27
+ const props = defineProps<{ operation: Operation; server: Server }>()
28
+
29
+ const CodeMirrorValue = ref<string>('')
30
+
31
+ const { copyToClipboard } = useClipboard()
32
+
33
+ const { setActiveRequest } = useApiClientRequestStore()
34
+
35
+ const { toggleApiClient } = useApiClientStore()
36
+
37
+ const {
38
+ state: templateState,
39
+ getLanguageTitleByKey,
40
+ setItem,
41
+ } = useTemplateStore()
42
+
43
+ const CodeMirrorLanguages = computed(() => {
44
+ return [templateState.preferredLanguage]
45
+ })
46
+
47
+ const { parameterMap } = useOperation(props)
48
+
49
+ async function generateSnippet() {
50
+ let path = props.operation.path
51
+
52
+ // Replace all variables of the format {something} with the uppercase variable name without the brackets
53
+ const pathVariables = path.match(/{(.*?)}/g)
54
+
55
+ if (pathVariables) {
56
+ pathVariables.forEach((variable) => {
57
+ const variableName = variable.replace(/{|}/g, '')
58
+ path = path.replace(variable, variableName.toUpperCase())
59
+ })
60
+ }
61
+
62
+ if (templateState.preferredLanguage === 'axios') {
63
+ return generateAxiosCodeFromRequest({
64
+ method: props.operation.httpVerb.toUpperCase(),
65
+ url: `${props.server.url}${path}`,
66
+ })
67
+ } else if (templateState.preferredLanguage === 'laravel') {
68
+ return generateLaravelCodeFromRequest({
69
+ method: props.operation.httpVerb.toUpperCase(),
70
+ url: `${props.server.url}${path}`,
71
+ })
72
+ }
73
+
74
+ try {
75
+ const snippet = new HTTPSnippet({
76
+ method: props.operation.httpVerb.toUpperCase(),
77
+ url: `${props.server.url}${path}`,
78
+ } as HarRequest)
79
+ const output = (await snippet.convert(
80
+ templateState.preferredLanguage as TargetId,
81
+ )) as string
82
+ return output
83
+ } catch {
84
+ const snippet = new HTTPSnippet({
85
+ method: props.operation.httpVerb.toUpperCase(),
86
+ url: `${window.location.origin}${path}`,
87
+ } as HarRequest)
88
+ const output = (await snippet.convert(
89
+ templateState.preferredLanguage as TargetId,
90
+ )) as string
91
+
92
+ return output
93
+ }
94
+ }
95
+
96
+ onMounted(async () => {
97
+ const initialSnippet = await generateSnippet()
98
+ CodeMirrorValue.value = initialSnippet
99
+ watch(
100
+ () => templateState.preferredLanguage,
101
+ async () => {
102
+ const output = await generateSnippet()
103
+ CodeMirrorValue.value = output
104
+ },
105
+ )
106
+ })
107
+
108
+ const copyExampleRequest = async () => {
109
+ copyToClipboard(CodeMirrorValue.value)
110
+ }
111
+
112
+ function showItemInClient() {
113
+ const item = generateRequest(
114
+ props.operation,
115
+ parameterMap.value,
116
+ props.server,
117
+ )
118
+ setActiveRequest(item)
119
+ toggleApiClient()
120
+ }
121
+
122
+ // Store selected languages in LocalStorage
123
+ const localStorageKey = 'preferredLanguage'
124
+ const selectLanguage = (language: TargetId) => {
125
+ setItem('preferredLanguage', language)
126
+ localStorage.setItem(localStorageKey, language)
127
+ }
128
+
129
+ const availableLanguages = computed(() => {
130
+ return [
131
+ ...availableTargets().filter((target) => target.key !== 'http'),
132
+ { key: 'axios', title: 'JavaScript (Axios)' },
133
+ { key: 'laravel', title: 'PHP (Laravel)' },
134
+ ].sort((a, b) => a.title.localeCompare(b.title))
135
+ })
136
+ </script>
137
+ <template>
138
+ <Card class="dark-mode">
139
+ <CardHeader muted>
140
+ <span :class="`request-method request-method--${operation.httpVerb}`">
141
+ {{ operation.httpVerb }}
142
+ </span>
143
+ <span class="request-path">{{ operation.path }}</span>
144
+
145
+ <template #actions>
146
+ <div class="language-select">
147
+ <span>{{
148
+ getLanguageTitleByKey(templateState.preferredLanguage)
149
+ }}</span>
150
+ <select
151
+ class="language-select"
152
+ :value="templateState.preferredLanguage"
153
+ @input="event => selectLanguage((event.target as HTMLSelectElement).value as TargetId)">
154
+ <option
155
+ v-for="lang in availableLanguages"
156
+ :key="lang.key"
157
+ :value="lang.key">
158
+ {{ lang.title }}
159
+ </option>
160
+ </select>
161
+ </div>
162
+
163
+ <button
164
+ class="copy-button"
165
+ type="button"
166
+ @click="copyExampleRequest">
167
+ <Icon
168
+ src="solid/interface-copy-clipboard"
169
+ width="10px" />
170
+ </button>
171
+ </template>
172
+ </CardHeader>
173
+ <CardContent
174
+ borderless
175
+ frameless>
176
+ <!-- @vue-ignore -->
177
+ <CodeMirror
178
+ :content="CodeMirrorValue"
179
+ :languages="CodeMirrorLanguages"
180
+ :lineNumbers="true"
181
+ :readOnly="true" />
182
+ </CardContent>
183
+ <CardFooter muted>
184
+ <button
185
+ class="show-api-client-button"
186
+ type="button"
187
+ @click="showItemInClient">
188
+ <Icon src="solid/mail-send-email-paper-airplane" />
189
+ Test {{ operation.httpVerb }} Request in Client
190
+ </button>
191
+ </CardFooter>
192
+ </Card>
193
+ </template>
194
+ <style scoped>
195
+ .request-method--post {
196
+ color: var(--theme-post-color);
197
+ }
198
+ .request-method--patch {
199
+ color: var(--theme-patch-color);
200
+ }
201
+ .request-method--get {
202
+ color: var(--theme-get-color);
203
+ }
204
+ .request-method--delete {
205
+ color: var(--theme-delete-color);
206
+ }
207
+ .request-method--put {
208
+ color: var(--theme-put-color);
209
+ }
210
+ .request-path {
211
+ margin-left: 6px;
212
+ color: var(--theme-color-2);
213
+ white-space: nowrap;
214
+ overflow: hidden;
215
+ cursor: default;
216
+ text-overflow: ellipsis;
217
+ text-transform: none !important;
218
+ }
219
+
220
+ .language-select {
221
+ position: relative;
222
+ padding-right: 9px;
223
+ border-right: 1px solid var(--theme-border-color);
224
+ }
225
+ .language-select select {
226
+ border: none;
227
+ outline: none;
228
+ cursor: pointer;
229
+ background: var(--theme-background-3);
230
+ box-shadow: -2px 0 0 0 var(--theme-background-3);
231
+ z-index: 2;
232
+ position: absolute;
233
+ top: 0;
234
+ left: 0;
235
+ width: 100%;
236
+ height: 100%;
237
+ opacity: 0;
238
+ appearance: none;
239
+ }
240
+ .language-select span {
241
+ font-size: 12px;
242
+ color: var(--theme-color-3);
243
+ font-weight: var(--theme-semibold);
244
+ display: flex;
245
+ align-items: center;
246
+ justify-content: center;
247
+ }
248
+ .language-select span:after {
249
+ content: '';
250
+ width: 7px;
251
+ height: 7px;
252
+ transform: rotate(45deg) translate3d(-2px, -2px, 0);
253
+ display: block;
254
+ margin-left: 6px;
255
+ box-shadow: 1px 1px 0 currentColor;
256
+ }
257
+ .language-select span:hover {
258
+ background: var(--theme-background-2);
259
+ }
260
+
261
+ .copy-button {
262
+ appearance: none;
263
+ -webkit-appearance: none;
264
+ outline: none;
265
+ background: transparent;
266
+ display: flex;
267
+ cursor: pointer;
268
+ color: var(--theme-color-3);
269
+ margin-left: 6px;
270
+ border: none;
271
+ border-radius: 3px;
272
+ }
273
+
274
+ .copy-button:hover {
275
+ color: var(--theme-color-1);
276
+ }
277
+
278
+ .copy-button svg {
279
+ width: 13px;
280
+ height: 13px;
281
+ }
282
+
283
+ .show-api-client-button {
284
+ width: 100%;
285
+ display: block;
286
+ appearance: none;
287
+ outline: none;
288
+ border: none;
289
+ border-radius: var(--theme-radius-lg);
290
+ height: 35px;
291
+ display: flex;
292
+ justify-content: center;
293
+ cursor: pointer;
294
+ align-items: center;
295
+ font-weight: var(--theme-bold);
296
+ font-size: var(--theme-micro);
297
+ text-transform: uppercase;
298
+ border: 1px solid currentColor;
299
+ background: var(--theme-button-1);
300
+ color: var(--theme-button-1-color);
301
+ }
302
+ .show-api-client-button:hover {
303
+ background: var(--theme-button-1-hover);
304
+ }
305
+ .show-api-client-button svg {
306
+ height: 12px;
307
+ width: auto;
308
+ margin-right: 6px;
309
+ }
310
+
311
+ .request-method {
312
+ font-family: var(--theme-font-code);
313
+ }
314
+ .request-path {
315
+ font-family: var(--theme-font-code);
316
+ }
317
+ </style>
@@ -0,0 +1,22 @@
1
+ <script lang="ts" setup>
2
+ import { httpStatusCodes } from '@scalar/api-client'
3
+ import { useTooltip } from '@scalar/use-tooltip'
4
+ import { computed } from 'vue'
5
+
6
+ const props = defineProps<{ title: string }>()
7
+
8
+ const statusText = computed(() => {
9
+ return httpStatusCodes[props.title]?.name ?? null
10
+ })
11
+
12
+ const tooltipRef = useTooltip({
13
+ content: statusText.value,
14
+ })
15
+ </script>
16
+ <template>
17
+ <span
18
+ ref="tooltipRef"
19
+ class="codemenu-item-key">
20
+ {{ title }}
21
+ </span>
22
+ </template>
@@ -0,0 +1,168 @@
1
+ <script lang="ts" setup>
2
+ import { CodeMirror, type HttpHeader, httpHeaders } from '@scalar/api-client'
3
+ import { useClipboard } from '@scalar/use-clipboard'
4
+ import { computed, ref } from 'vue'
5
+
6
+ import type { TransformedOperation } from '../../../types'
7
+ import {
8
+ Card,
9
+ CardContent,
10
+ CardFooter,
11
+ CardTab,
12
+ CardTabHeader,
13
+ } from '../../Card'
14
+ import { Icon } from '../../Icon'
15
+ import {
16
+ SimpleCell,
17
+ SimpleHeader,
18
+ SimpleRow,
19
+ SimpleTable,
20
+ } from '../../SimpleTable'
21
+
22
+ const props = defineProps<{ operation: TransformedOperation }>()
23
+
24
+ const { copyToClipboard } = useClipboard()
25
+
26
+ // Bring the status codes in the right order.
27
+ const orderedStatusCodes = computed(() => {
28
+ return Object.keys(props?.operation?.responses ?? {}).sort((x) => {
29
+ if (x === 'default') {
30
+ return -1
31
+ }
32
+
33
+ return 0
34
+ })
35
+ })
36
+
37
+ // Keep track of the current selected tab
38
+ const selectedResponseIndex = ref<number>(0)
39
+
40
+ // Return the whole response object
41
+ const currentResponse = computed(() => {
42
+ const currentStatusCode =
43
+ orderedStatusCodes.value[selectedResponseIndex.value]
44
+
45
+ return props.operation.responses?.[currentStatusCode]
46
+ })
47
+
48
+ const currentResponseJsonBody = computed(() => {
49
+ return currentResponse.value?.content?.['application/json']?.body
50
+ })
51
+
52
+ const changeTab = (index: number) => {
53
+ selectedResponseIndex.value = index
54
+ }
55
+
56
+ const getDocumentationUrlForHttpHeader = (headerName: string) => {
57
+ return httpHeaders.find((header: HttpHeader) => {
58
+ return header.name.toLowerCase() === headerName.toLowerCase()
59
+ })?.url
60
+ }
61
+
62
+ // Make the first letter and all letters after a - uppercase
63
+ const formatHeaderName = (headerName: string) => {
64
+ return headerName
65
+ .split('-')
66
+ .map((word) => {
67
+ return word.charAt(0).toUpperCase() + word.slice(1)
68
+ })
69
+ .join('-')
70
+ }
71
+ </script>
72
+ <template>
73
+ <Card v-if="orderedStatusCodes.length">
74
+ <CardTabHeader
75
+ muted
76
+ @change="changeTab">
77
+ <CardTab
78
+ v-for="statusCode in orderedStatusCodes"
79
+ :key="statusCode">
80
+ {{ statusCode }}
81
+ </CardTab>
82
+
83
+ <template #actions>
84
+ <button
85
+ v-if="currentResponseJsonBody"
86
+ class="code-copy"
87
+ type="button"
88
+ @click="() => copyToClipboard(currentResponseJsonBody)">
89
+ <Icon
90
+ src="solid/interface-copy-clipboard"
91
+ width="10px" />
92
+ </button>
93
+ </template>
94
+ </CardTabHeader>
95
+ <CardContent
96
+ v-if="currentResponse.headers"
97
+ muted>
98
+ <SimpleTable>
99
+ <SimpleRow>
100
+ <SimpleHeader>Header</SimpleHeader>
101
+ <SimpleHeader>Description</SimpleHeader>
102
+ </SimpleRow>
103
+ <SimpleRow
104
+ v-for="(data, header) in currentResponse.headers"
105
+ :key="header">
106
+ <SimpleCell
107
+ :href="getDocumentationUrlForHttpHeader(header)"
108
+ :strong="true"
109
+ :wrap="false">
110
+ {{ formatHeaderName(header) }}
111
+ </SimpleCell>
112
+ <SimpleCell>{{ data.description }}</SimpleCell>
113
+ </SimpleRow>
114
+ </SimpleTable>
115
+ </CardContent>
116
+ <CardContent muted>
117
+ <CodeMirror
118
+ v-show="currentResponseJsonBody"
119
+ :content="currentResponseJsonBody"
120
+ :languages="['json']"
121
+ readOnly />
122
+ <div
123
+ v-if="!currentResponseJsonBody"
124
+ class="scalar-api-reference__empty-state">
125
+ No Body
126
+ </div>
127
+ </CardContent>
128
+ <CardFooter
129
+ v-if="currentResponse?.description"
130
+ muted>
131
+ <div class="description">
132
+ {{ currentResponse.description }}
133
+ </div>
134
+ </CardFooter>
135
+ </Card>
136
+ </template>
137
+
138
+ <style scoped>
139
+ .code-copy {
140
+ display: flex;
141
+ appearance: none;
142
+ -webkit-appearance: none;
143
+ outline: none;
144
+ background: transparent;
145
+ cursor: pointer;
146
+ color: var(--theme-color-3);
147
+ border: none;
148
+ }
149
+ .code-copy:hover {
150
+ color: var(--theme-color-1);
151
+ }
152
+ .code-copy svg {
153
+ width: 13px;
154
+ height: 13px;
155
+ }
156
+ .description {
157
+ font-weight: var(--theme-semibold);
158
+ font-size: var(--theme-micro);
159
+ }
160
+ .scalar-api-reference__empty-state {
161
+ border: 1px dashed var(--theme-border-color);
162
+ width: 100%;
163
+ text-align: center;
164
+ font-size: var(--theme-micro);
165
+ padding: 20px;
166
+ color: var(--theme-color-2);
167
+ }
168
+ </style>
@@ -0,0 +1,26 @@
1
+ <script setup lang="ts">
2
+ import type { Parameters } from '../../../types'
3
+ import MarkdownRenderer from '../MarkdownRenderer.vue'
4
+
5
+ defineProps<{ parameter: Parameters }>()
6
+ </script>
7
+ <template>
8
+ <li>
9
+ <span class="parameter-name">{{ parameter.name }}</span>
10
+ <span
11
+ v-if="parameter.required !== undefined"
12
+ class="parameter-required"
13
+ :class="parameter.required ? 'marc_required' : ''">
14
+ {{ parameter.required ? 'required' : 'optional' }}
15
+ </span>
16
+ <span
17
+ v-if="parameter.schema?.type"
18
+ class="parameter-type">
19
+ {{ parameter.schema?.type }}
20
+ </span>
21
+ <MarkdownRenderer
22
+ v-if="parameter.description"
23
+ class="parameter-description"
24
+ :value="parameter.description" />
25
+ </li>
26
+ </template>
@@ -0,0 +1,23 @@
1
+ <script setup lang="ts">
2
+ import type { Parameters } from '../../../types'
3
+ import ParameterItem from './ParameterItem.vue'
4
+
5
+ defineProps<{ parameters?: Parameters[]; title: string }>()
6
+ </script>
7
+ <template>
8
+ <div
9
+ v-if="parameters?.length"
10
+ class="parameters-container">
11
+ <div class="endpoint-title">
12
+ <h5 class="title">
13
+ {{ title }}
14
+ </h5>
15
+ </div>
16
+ <ul class="parameter">
17
+ <ParameterItem
18
+ v-for="item in parameters"
19
+ :key="item.name"
20
+ :parameter="item" />
21
+ </ul>
22
+ </div>
23
+ </template>
@@ -0,0 +1,29 @@
1
+ <script setup lang="ts">
2
+ import type { Server, Tag, TransformedOperation } from '../../../types'
3
+ import Copy from './Copy.vue'
4
+ import ExampleRequest from './ExampleRequest.vue'
5
+ import ExampleResponses from './ExampleResponses.vue'
6
+
7
+ defineProps<{
8
+ operation: TransformedOperation
9
+ server: Server
10
+ parentTag: Tag
11
+ }>()
12
+ </script>
13
+ <template>
14
+ <div
15
+ :id="`endpoint/${operation.operationId}`"
16
+ class="reference-container">
17
+ <Copy
18
+ :operation="operation"
19
+ :parentTag="parentTag" />
20
+ <div class="example">
21
+ <ExampleRequest
22
+ :operation="operation"
23
+ :server="server" />
24
+ <ExampleResponses
25
+ :operation="operation"
26
+ style="margin-top: 12px" />
27
+ </div>
28
+ </div>
29
+ </template>
@@ -0,0 +1,125 @@
1
+ <script setup lang="ts">
2
+ import type { RequestBody } from '../../../types'
3
+ import RequestBodyProperties from './RequestBodyProperties.vue'
4
+
5
+ defineProps<{ requestBody?: RequestBody }>()
6
+ </script>
7
+ <template>
8
+ <div
9
+ v-if="requestBody && requestBody.content['application/json']"
10
+ class="body-container">
11
+ <div class="endpoint-title">
12
+ <h5 class="title">Body</h5>
13
+ </div>
14
+ <ul
15
+ v-if="requestBody.content['application/json']"
16
+ class="parameter">
17
+ <RequestBodyProperties
18
+ :contentProperties="
19
+ requestBody.content['application/json'].schema.properties || {}
20
+ "
21
+ :required="
22
+ requestBody.content['application/json'].schema.required || []
23
+ " />
24
+ </ul>
25
+ </div>
26
+ </template>
27
+
28
+ <style>
29
+ .parameter p {
30
+ margin-top: 6px;
31
+ }
32
+ .parameter .parameter-child {
33
+ border: 1px solid var(--theme-border-color);
34
+ border-radius: 20px;
35
+ margin-top: 12px;
36
+ width: fit-content;
37
+ }
38
+ .parameter .parameter {
39
+ border: none !important;
40
+ }
41
+ .parameter-child-trigger {
42
+ padding: 6px 12px;
43
+ cursor: pointer;
44
+ font-weight: 500;
45
+ color: var(--theme-color-3);
46
+ font-size: var(--theme-micro);
47
+ display: flex;
48
+ align-items: center;
49
+ user-select: none;
50
+ }
51
+ .parameter-child-trigger:has(+ .parameter li:first-of-type:last-of-type) {
52
+ display: none;
53
+ }
54
+ .parameter-child-trigger:hover {
55
+ color: var(--theme-color-1);
56
+ }
57
+ .parameter-child-trigger > span:before {
58
+ content: 'Show ';
59
+ }
60
+ .parameter-child__open > .parameter-child-trigger span:before {
61
+ content: 'Hide ';
62
+ }
63
+ .parameter-child-trigger svg {
64
+ height: 10px;
65
+ width: 10px;
66
+ margin-right: 6px;
67
+ }
68
+ .parameter-child__open .parameter-child-trigger svg {
69
+ transform: rotate(45deg);
70
+ }
71
+ .parameter .parameter li:first-of-type {
72
+ border-top: none;
73
+ }
74
+ .parameter .parameter li {
75
+ padding: 12px;
76
+ }
77
+ .parameter-child__open > .parameter {
78
+ display: block;
79
+ }
80
+ .parameter .parameter-child__open {
81
+ width: 100%;
82
+ border-radius: 6px;
83
+ }
84
+ .parameter .parameter-child__open > svg {
85
+ transform: rotate(45deg);
86
+ }
87
+ .parameter-child__open > .parameter-child-trigger {
88
+ border-bottom: 1px solid var(--theme-border-color);
89
+ }
90
+
91
+ .parameter {
92
+ list-style: none;
93
+ font-size: var(--theme-small);
94
+ }
95
+ .parameter li {
96
+ border-top: 1px solid var(--theme-border-color);
97
+ padding: 12px 0;
98
+ }
99
+ .parameter-name {
100
+ font-weight: 500;
101
+ margin-right: 6px;
102
+ font-family: var(--theme-font-code);
103
+ font-size: 13px;
104
+ color: var(--theme-color-1);
105
+ }
106
+ .parameter-type,
107
+ .parameter-required {
108
+ color: var(--theme-color-3);
109
+ font-weight: var(--theme-semibold);
110
+ margin-right: 6px;
111
+ position: relative;
112
+ }
113
+ .marc_required {
114
+ text-transform: uppercase;
115
+ font-size: 11px;
116
+ font-weight: var(--theme-bold);
117
+ color: #ffb040;
118
+ }
119
+ .parameter-options {
120
+ position: relative;
121
+ }
122
+ .copy .parameter-description:empty {
123
+ display: none;
124
+ }
125
+ </style>