zudoku 0.1.1-dev.4 → 0.1.1-dev.41

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 (553) hide show
  1. package/dist/app/App.js +17 -38
  2. package/dist/app/App.js.map +1 -1
  3. package/dist/app/main.js +3 -15
  4. package/dist/app/main.js.map +1 -1
  5. package/dist/cli/build/handler.js +3 -1
  6. package/dist/cli/build/handler.js.map +1 -1
  7. package/dist/cli/cmds/dev.js +0 -1
  8. package/dist/cli/cmds/dev.js.map +1 -1
  9. package/dist/cli/common/logger.d.ts +1 -2
  10. package/dist/cli/common/logger.js +3 -3
  11. package/dist/cli/common/logger.js.map +1 -1
  12. package/dist/cli/common/outdated.js +4 -4
  13. package/dist/cli/common/outdated.js.map +1 -1
  14. package/dist/cli/common/output.js +4 -4
  15. package/dist/cli/common/output.js.map +1 -1
  16. package/dist/cli/common/utils/box.js +2 -2
  17. package/dist/cli/common/utils/box.js.map +1 -1
  18. package/dist/cli/dev/handler.d.ts +1 -1
  19. package/dist/cli/dev/handler.js +14 -3
  20. package/dist/cli/dev/handler.js.map +1 -1
  21. package/dist/config/config.d.ts +20 -7
  22. package/dist/index.d.ts +2 -6
  23. package/dist/index.js +1 -5
  24. package/dist/index.js.map +1 -1
  25. package/dist/lib/authentication/authentication.js.map +1 -0
  26. package/dist/{app → lib}/authentication/clerk.d.ts +2 -2
  27. package/dist/{app → lib}/authentication/clerk.js +9 -5
  28. package/dist/lib/authentication/clerk.js.map +1 -0
  29. package/dist/{app → lib}/authentication/openid.js.map +1 -1
  30. package/dist/{app → lib}/components/AnchorLink.js.map +1 -1
  31. package/dist/{app → lib}/components/CategoryHeading.js.map +1 -1
  32. package/dist/{app → lib/components}/DevPortal.d.ts +8 -7
  33. package/dist/lib/components/DevPortal.js +28 -0
  34. package/dist/lib/components/DevPortal.js.map +1 -0
  35. package/dist/{app → lib}/components/Dialog.js +1 -1
  36. package/dist/lib/components/Dialog.js.map +1 -0
  37. package/dist/{app → lib}/components/DynamicIcon.js.map +1 -1
  38. package/dist/{app → lib}/components/Header.js +1 -1
  39. package/dist/{app → lib}/components/Header.js.map +1 -1
  40. package/dist/{app → lib/components}/Heading.js +2 -2
  41. package/dist/lib/components/Heading.js.map +1 -0
  42. package/dist/{app → lib}/components/Input.js.map +1 -1
  43. package/dist/{app → lib}/components/Layout.js +1 -2
  44. package/dist/lib/components/Layout.js.map +1 -0
  45. package/dist/lib/components/Link.d.ts +1 -0
  46. package/dist/lib/components/Link.js +2 -0
  47. package/dist/lib/components/Link.js.map +1 -0
  48. package/dist/{app → lib}/components/Markdown.js.map +1 -1
  49. package/dist/lib/components/Router.d.ts +4 -0
  50. package/dist/lib/components/Router.js +20 -0
  51. package/dist/lib/components/Router.js.map +1 -0
  52. package/dist/{app → lib}/components/SyntaxHighlight.d.ts +2 -1
  53. package/dist/{app → lib}/components/SyntaxHighlight.js +4 -1
  54. package/dist/lib/components/SyntaxHighlight.js.map +1 -0
  55. package/dist/{app → lib}/components/TopNavigation.js.map +1 -1
  56. package/dist/{app → lib}/components/context/ComponentsContext.js.map +1 -1
  57. package/dist/{app → lib}/components/context/DevPortalProvider.js +1 -1
  58. package/dist/lib/components/context/DevPortalProvider.js.map +1 -0
  59. package/dist/lib/components/context/PluginSystem.js.map +1 -0
  60. package/dist/{app → lib}/components/context/ThemeContext.js.map +1 -1
  61. package/dist/{app → lib}/components/context/ViewportAnchorContext.js.map +1 -1
  62. package/dist/lib/components/index.d.ts +3 -0
  63. package/dist/lib/components/index.js +4 -0
  64. package/dist/lib/components/index.js.map +1 -0
  65. package/dist/{app → lib}/components/navigation/SideNavigation.js +1 -1
  66. package/dist/lib/components/navigation/SideNavigation.js.map +1 -0
  67. package/dist/{app → lib}/components/navigation/SideNavigationCategory.js +1 -1
  68. package/dist/{app → lib}/components/navigation/SideNavigationCategory.js.map +1 -1
  69. package/dist/{app → lib}/components/navigation/SideNavigationItem.d.ts +2 -1
  70. package/dist/{app → lib}/components/navigation/SideNavigationItem.js +11 -4
  71. package/dist/lib/components/navigation/SideNavigationItem.js.map +1 -0
  72. package/dist/{app → lib}/components/navigation/SideNavigationWrapper.d.ts +3 -0
  73. package/dist/lib/components/navigation/SideNavigationWrapper.js +5 -0
  74. package/dist/lib/components/navigation/SideNavigationWrapper.js.map +1 -0
  75. package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js.map +1 -1
  76. package/dist/{app → lib}/components/navigation/util.js.map +1 -1
  77. package/dist/{app → lib}/core/DevPortalContext.d.ts +2 -1
  78. package/dist/{app → lib}/core/DevPortalContext.js +2 -2
  79. package/dist/lib/core/DevPortalContext.js.map +1 -0
  80. package/dist/{app → lib}/core/helmet.js.map +1 -1
  81. package/dist/lib/core/icons.js.map +1 -0
  82. package/dist/{app → lib}/core/plugins.d.ts +1 -1
  83. package/dist/{app → lib}/core/plugins.js +1 -1
  84. package/dist/{app → lib}/core/plugins.js.map +1 -1
  85. package/dist/lib/core/router.js.map +1 -0
  86. package/dist/lib/core/types/combine.js.map +1 -0
  87. package/dist/{app → lib}/oas/graphql/index.js.map +1 -1
  88. package/dist/{app → lib}/oas/graphql/server.js.map +1 -1
  89. package/dist/{app → lib}/oas/parser/dereference/index.js.map +1 -1
  90. package/dist/{app → lib}/oas/parser/dereference/resolveRef.js.map +1 -1
  91. package/dist/{app → lib}/oas/parser/index.js.map +1 -1
  92. package/dist/{app → lib}/oas/parser/upgrade/index.js.map +1 -1
  93. package/dist/lib/plugins/api-key/CreateApiKeys.d.ts +5 -0
  94. package/dist/lib/plugins/api-key/CreateApiKeys.js +37 -0
  95. package/dist/lib/plugins/api-key/CreateApiKeys.js.map +1 -0
  96. package/dist/lib/plugins/api-key/SettingsApiKeys.d.ts +5 -0
  97. package/dist/lib/plugins/api-key/SettingsApiKeys.js +38 -0
  98. package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +1 -0
  99. package/dist/lib/plugins/api-key/index.d.ts +30 -0
  100. package/dist/lib/plugins/api-key/index.js +76 -0
  101. package/dist/lib/plugins/api-key/index.js.map +1 -0
  102. package/dist/lib/plugins/index.d.ts +4 -0
  103. package/dist/lib/plugins/index.js +5 -0
  104. package/dist/lib/plugins/index.js.map +1 -0
  105. package/dist/lib/plugins/markdown/MdxPage.d.ts +5 -0
  106. package/dist/{app → lib}/plugins/markdown/MdxPage.js +8 -3
  107. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -0
  108. package/dist/{app → lib}/plugins/markdown/Toc.js.map +1 -1
  109. package/dist/{app → lib}/plugins/markdown/generateRoutes.js +1 -6
  110. package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -0
  111. package/dist/{app → lib}/plugins/markdown/index.js.map +1 -1
  112. package/dist/{app → lib}/plugins/openapi/ColorizedParam.d.ts +1 -2
  113. package/dist/{app → lib}/plugins/openapi/ColorizedParam.js +1 -1
  114. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -0
  115. package/dist/lib/plugins/openapi/MakeRequest.js +38 -0
  116. package/dist/lib/plugins/openapi/MakeRequest.js.map +1 -0
  117. package/dist/{app → lib}/plugins/openapi/MethodBadge.js.map +1 -1
  118. package/dist/{app → lib}/plugins/openapi/OperationList.js +2 -2
  119. package/dist/{app → lib}/plugins/openapi/OperationList.js.map +1 -1
  120. package/dist/lib/plugins/openapi/OperationListItem.js +38 -0
  121. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -0
  122. package/dist/{app → lib}/plugins/openapi/ParameterList.js +1 -1
  123. package/dist/{app → lib}/plugins/openapi/ParameterList.js.map +1 -1
  124. package/dist/{app → lib}/plugins/openapi/ParameterListItem.js +1 -1
  125. package/dist/{app → lib}/plugins/openapi/ParameterListItem.js.map +1 -1
  126. package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js +1 -1
  127. package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  128. package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js +2 -2
  129. package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  130. package/dist/{app → lib}/plugins/openapi/Select.js.map +1 -1
  131. package/dist/{app → lib}/plugins/openapi/Sidecar.js +13 -13
  132. package/dist/{app → lib}/plugins/openapi/Sidecar.js.map +1 -1
  133. package/dist/{app → lib}/plugins/openapi/SidecarBox.js.map +1 -1
  134. package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js.map +1 -1
  135. package/dist/{app → lib}/plugins/openapi/graphql/gql.d.ts +2 -2
  136. package/dist/{app → lib}/plugins/openapi/graphql/gql.js +1 -1
  137. package/dist/{app → lib}/plugins/openapi/graphql/gql.js.map +1 -1
  138. package/dist/{app → lib}/plugins/openapi/graphql/graphql.d.ts +1 -0
  139. package/dist/{app → lib}/plugins/openapi/graphql/graphql.js +4 -0
  140. package/dist/{app → lib}/plugins/openapi/graphql/graphql.js.map +1 -1
  141. package/dist/lib/plugins/openapi/graphql/index.js.map +1 -0
  142. package/dist/{app → lib}/plugins/openapi/index.js +3 -1
  143. package/dist/lib/plugins/openapi/index.js.map +1 -0
  144. package/dist/lib/plugins/openapi/playground/Editor.d.ts +1 -0
  145. package/dist/lib/plugins/openapi/playground/Editor.js +5 -0
  146. package/dist/lib/plugins/openapi/playground/Editor.js.map +1 -0
  147. package/dist/lib/plugins/openapi/playground/Headers.d.ts +7 -0
  148. package/dist/lib/plugins/openapi/playground/Headers.js +15 -0
  149. package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -0
  150. package/dist/lib/plugins/openapi/playground/InlineInput.d.ts +4 -0
  151. package/dist/lib/plugins/openapi/playground/InlineInput.js +3 -0
  152. package/dist/lib/plugins/openapi/playground/InlineInput.js.map +1 -0
  153. package/dist/lib/plugins/openapi/playground/PathParams.d.ts +6 -0
  154. package/dist/lib/plugins/openapi/playground/PathParams.js +21 -0
  155. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -0
  156. package/dist/lib/plugins/openapi/playground/Playground.d.ts +29 -0
  157. package/dist/lib/plugins/openapi/playground/Playground.js +90 -0
  158. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -0
  159. package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +5 -0
  160. package/dist/lib/plugins/openapi/playground/QueryParams.js +35 -0
  161. package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -0
  162. package/dist/lib/plugins/openapi/playground/UrlDisplay.d.ts +4 -0
  163. package/dist/lib/plugins/openapi/playground/UrlDisplay.js +22 -0
  164. package/dist/lib/plugins/openapi/playground/UrlDisplay.js.map +1 -0
  165. package/dist/lib/plugins/openapi/playground/createUrl.d.ts +2 -0
  166. package/dist/lib/plugins/openapi/playground/createUrl.js +15 -0
  167. package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -0
  168. package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.d.ts +1 -1
  169. package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.js +19 -9
  170. package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -0
  171. package/dist/{app → lib}/plugins/openapi/util/urql.js.map +1 -1
  172. package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.js +1 -1
  173. package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -1
  174. package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +1 -0
  175. package/dist/lib/plugins/openapi/worker/shared-worker.js +6 -0
  176. package/dist/lib/plugins/openapi/worker/shared-worker.js.map +1 -0
  177. package/dist/{app → lib}/plugins/openapi/worker/worker.js.map +1 -1
  178. package/dist/lib/plugins/openapi-worker.d.ts +1 -0
  179. package/dist/lib/plugins/openapi-worker.js +2 -0
  180. package/dist/lib/plugins/openapi-worker.js.map +1 -0
  181. package/dist/{app → lib}/plugins/redirect/index.d.ts +1 -2
  182. package/dist/{app → lib}/plugins/redirect/index.js.map +1 -1
  183. package/dist/{app → lib}/ui/Button.d.ts +1 -1
  184. package/dist/{app → lib}/ui/Button.js.map +1 -1
  185. package/dist/{app → lib}/ui/Callout.js.map +1 -1
  186. package/dist/{app → lib}/ui/Card.js.map +1 -1
  187. package/dist/{app → lib}/ui/Note.js.map +1 -1
  188. package/dist/{app → lib}/ui/Tabs.js.map +1 -1
  189. package/dist/{app → lib}/util/MdxComponents.js +2 -2
  190. package/dist/lib/util/MdxComponents.js.map +1 -0
  191. package/dist/{app → lib}/util/cn.js.map +1 -1
  192. package/dist/lib/util/createVariantComponent.d.ts +9 -0
  193. package/dist/lib/util/createVariantComponent.js +17 -0
  194. package/dist/lib/util/createVariantComponent.js.map +1 -0
  195. package/dist/{app → lib}/util/createWaitForNotify.js.map +1 -1
  196. package/dist/{app → lib}/util/groupBy.js.map +1 -1
  197. package/dist/{app → lib}/util/joinPath.js.map +1 -1
  198. package/dist/{app → lib}/util/pastellize.js.map +1 -1
  199. package/dist/lib/util/slugify.js.map +1 -0
  200. package/dist/{app → lib}/util/traverseNavigation.js.map +1 -1
  201. package/dist/{app → lib}/util/useScrollToAnchor.js.map +1 -1
  202. package/dist/{app → lib}/util/useScrollToTop.js.map +1 -1
  203. package/dist/ts.d.ts +6 -0
  204. package/dist/ts.js +62 -0
  205. package/dist/ts.js.map +1 -0
  206. package/dist/vite/build.js +2 -8
  207. package/dist/vite/build.js.map +1 -1
  208. package/dist/vite/common.d.ts +1 -0
  209. package/dist/vite/common.js +2 -0
  210. package/dist/vite/common.js.map +1 -0
  211. package/dist/vite/config.d.ts +10 -3
  212. package/dist/vite/config.js +108 -58
  213. package/dist/vite/config.js.map +1 -1
  214. package/dist/vite/config.test.js +4 -3
  215. package/dist/vite/config.test.js.map +1 -1
  216. package/dist/vite/dev-server.d.ts +2 -0
  217. package/dist/vite/dev-server.js +28 -8
  218. package/dist/vite/dev-server.js.map +1 -1
  219. package/dist/vite/html.d.ts +1 -1
  220. package/dist/vite/html.js +2 -3
  221. package/dist/vite/html.js.map +1 -1
  222. package/dist/vite/plugin-api-keys.d.ts +4 -0
  223. package/dist/vite/plugin-api-keys.js +33 -0
  224. package/dist/vite/plugin-api-keys.js.map +1 -0
  225. package/dist/vite/plugin-api.d.ts +4 -0
  226. package/dist/vite/plugin-api.js +49 -0
  227. package/dist/vite/plugin-api.js.map +1 -0
  228. package/dist/vite/plugin-auth.d.ts +4 -0
  229. package/dist/vite/plugin-auth.js +30 -0
  230. package/dist/vite/plugin-auth.js.map +1 -0
  231. package/dist/vite/plugin-component.d.ts +4 -0
  232. package/dist/vite/plugin-component.js +16 -0
  233. package/dist/vite/plugin-component.js.map +1 -0
  234. package/dist/vite/plugin-config.d.ts +7 -0
  235. package/dist/vite/plugin-config.js +25 -0
  236. package/dist/vite/plugin-config.js.map +1 -0
  237. package/dist/vite/plugin-docs.d.ts +4 -0
  238. package/dist/vite/plugin-docs.js +45 -0
  239. package/dist/vite/plugin-docs.js.map +1 -0
  240. package/dist/vite/plugin-docs.test.d.ts +1 -0
  241. package/dist/vite/plugin-docs.test.js +30 -0
  242. package/dist/vite/plugin-docs.test.js.map +1 -0
  243. package/dist/vite/plugin-html.d.ts +3 -0
  244. package/dist/vite/plugin-html.js +47 -0
  245. package/dist/vite/plugin-html.js.map +1 -0
  246. package/dist/vite/plugin-mdx.d.ts +8 -0
  247. package/dist/vite/plugin-mdx.js +61 -0
  248. package/dist/vite/plugin-mdx.js.map +1 -0
  249. package/dist/vite/plugin-metadata.d.ts +6 -0
  250. package/dist/vite/plugin-metadata.js +24 -0
  251. package/dist/vite/plugin-metadata.js.map +1 -0
  252. package/dist/vite/plugin-openapi-worker.d.ts +4 -0
  253. package/dist/vite/plugin-openapi-worker.js +28 -0
  254. package/dist/vite/plugin-openapi-worker.js.map +1 -0
  255. package/dist/vite/plugin-redirect.d.ts +4 -0
  256. package/dist/vite/plugin-redirect.js +32 -0
  257. package/dist/vite/plugin-redirect.js.map +1 -0
  258. package/dist/vite/plugin.d.ts +2 -6
  259. package/dist/vite/plugin.js +22 -104
  260. package/dist/vite/plugin.js.map +1 -1
  261. package/lib/assets/index-BPdJm2ty.js +4764 -0
  262. package/lib/assets/worker-W78u54MC.js +14473 -0
  263. package/lib/prism-bash.min-DadFsM4Z.js +6 -0
  264. package/lib/prism-java.min-d5iT_mOd.js +6 -0
  265. package/lib/prism-json.min-B1GJqK1k.js +1 -0
  266. package/lib/prism-markup-templating-DZrrEs0A.js +61 -0
  267. package/lib/prism-php.min-o7FpoMP_.js +10 -0
  268. package/lib/prism-ruby.min-C7LwcKyz.js +9 -0
  269. package/lib/urql-DMlBWUKL.js +1591 -0
  270. package/lib/util-c0rdJnKP.js +11742 -0
  271. package/lib/zudoku.auth-clerk.js +32 -0
  272. package/lib/zudoku.components.js +1294 -0
  273. package/lib/zudoku.openapi-worker.js +225 -0
  274. package/lib/zudoku.plugins.js +17280 -0
  275. package/package.json +69 -51
  276. package/src/app/App.tsx +19 -42
  277. package/src/app/main.tsx +5 -18
  278. package/src/{app → lib}/authentication/clerk.ts +11 -9
  279. package/src/{app → lib/components}/DevPortal.tsx +23 -42
  280. package/src/{app → lib}/components/Dialog.tsx +32 -32
  281. package/src/{app → lib}/components/Header.tsx +3 -3
  282. package/src/{app → lib/components}/Heading.tsx +2 -2
  283. package/src/{app → lib}/components/Layout.tsx +10 -6
  284. package/src/lib/components/Link.tsx +1 -0
  285. package/src/lib/components/Router.tsx +28 -0
  286. package/src/{app → lib}/components/SyntaxHighlight.tsx +10 -3
  287. package/src/{app → lib}/components/context/DevPortalProvider.ts +1 -1
  288. package/src/lib/components/index.ts +3 -0
  289. package/src/{app → lib}/components/navigation/SideNavigation.tsx +4 -1
  290. package/src/{app → lib}/components/navigation/SideNavigationCategory.tsx +3 -1
  291. package/src/{app → lib}/components/navigation/SideNavigationItem.tsx +15 -5
  292. package/src/lib/components/navigation/SideNavigationWrapper.tsx +18 -0
  293. package/src/{app → lib}/core/DevPortalContext.ts +7 -3
  294. package/src/{app → lib}/core/plugins.ts +1 -1
  295. package/src/lib/plugins/api-key/CreateApiKeys.tsx +84 -0
  296. package/src/lib/plugins/api-key/SettingsApiKeys.tsx +122 -0
  297. package/src/lib/plugins/api-key/index.tsx +126 -0
  298. package/src/lib/plugins/index.ts +4 -0
  299. package/src/{app → lib}/plugins/markdown/MdxPage.tsx +23 -6
  300. package/src/{app → lib}/plugins/markdown/generateRoutes.tsx +1 -16
  301. package/src/{app → lib}/plugins/openapi/ColorizedParam.tsx +0 -2
  302. package/src/lib/plugins/openapi/MakeRequest.tsx +58 -0
  303. package/src/{app → lib}/plugins/openapi/OperationList.tsx +3 -3
  304. package/src/lib/plugins/openapi/OperationListItem.tsx +191 -0
  305. package/src/{app → lib}/plugins/openapi/ParameterList.tsx +1 -1
  306. package/src/{app → lib}/plugins/openapi/ParameterListItem.tsx +4 -1
  307. package/src/{app → lib}/plugins/openapi/RequestBodySidecarBox.tsx +1 -1
  308. package/src/{app → lib}/plugins/openapi/ResponsesSidecarBox.tsx +1 -2
  309. package/src/{app → lib}/plugins/openapi/Sidecar.tsx +20 -20
  310. package/src/{app → lib}/plugins/openapi/graphql/gql.ts +3 -3
  311. package/src/{app → lib}/plugins/openapi/graphql/graphql.ts +5 -0
  312. package/src/{app → lib}/plugins/openapi/index.tsx +8 -2
  313. package/src/lib/plugins/openapi/playground/Editor.tsx +6 -0
  314. package/src/lib/plugins/openapi/playground/Headers.tsx +60 -0
  315. package/src/lib/plugins/openapi/playground/InlineInput.tsx +6 -0
  316. package/src/lib/plugins/openapi/playground/PathParams.tsx +63 -0
  317. package/src/lib/plugins/openapi/playground/Playground.tsx +324 -0
  318. package/src/lib/plugins/openapi/playground/QueryParams.tsx +111 -0
  319. package/src/lib/plugins/openapi/playground/UrlDisplay.tsx +32 -0
  320. package/src/lib/plugins/openapi/playground/createUrl.ts +22 -0
  321. package/src/{app → lib}/plugins/openapi/util/generateSchemaExample.ts +24 -9
  322. package/src/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.ts +1 -1
  323. package/src/lib/plugins/openapi/worker/shared-worker.ts +5 -0
  324. package/src/lib/plugins/openapi-worker.ts +1 -0
  325. package/src/{app → lib}/plugins/redirect/index.tsx +1 -1
  326. package/src/{app → lib}/util/MdxComponents.tsx +2 -1
  327. package/src/{app → lib}/util/createVariantComponent.tsx +13 -8
  328. package/dist/app/DevPortal.js +0 -41
  329. package/dist/app/DevPortal.js.map +0 -1
  330. package/dist/app/Heading.js.map +0 -1
  331. package/dist/app/authentication/authentication.js.map +0 -1
  332. package/dist/app/authentication/clerk.js.map +0 -1
  333. package/dist/app/components/Dialog.js.map +0 -1
  334. package/dist/app/components/Layout.js.map +0 -1
  335. package/dist/app/components/SyntaxHighlight.js.map +0 -1
  336. package/dist/app/components/context/DevPortalProvider.js.map +0 -1
  337. package/dist/app/components/context/PluginSystem.js.map +0 -1
  338. package/dist/app/components/navigation/SideNavigation.js.map +0 -1
  339. package/dist/app/components/navigation/SideNavigationItem.js.map +0 -1
  340. package/dist/app/components/navigation/SideNavigationWrapper.js +0 -6
  341. package/dist/app/components/navigation/SideNavigationWrapper.js.map +0 -1
  342. package/dist/app/config.d.ts +0 -3
  343. package/dist/app/config.js +0 -9
  344. package/dist/app/config.js.map +0 -1
  345. package/dist/app/core/DevPortalContext.js.map +0 -1
  346. package/dist/app/core/icons.js.map +0 -1
  347. package/dist/app/core/router.js.map +0 -1
  348. package/dist/app/core/types/combine.js.map +0 -1
  349. package/dist/app/markdowns.d.ts +0 -3
  350. package/dist/app/markdowns.js +0 -5
  351. package/dist/app/markdowns.js.map +0 -1
  352. package/dist/app/plugins/api-key/SettingsApiKeys.d.ts +0 -4
  353. package/dist/app/plugins/api-key/SettingsApiKeys.js +0 -7
  354. package/dist/app/plugins/api-key/SettingsApiKeys.js.map +0 -1
  355. package/dist/app/plugins/api-key/index.d.ts +0 -32
  356. package/dist/app/plugins/api-key/index.js +0 -55
  357. package/dist/app/plugins/api-key/index.js.map +0 -1
  358. package/dist/app/plugins/markdown/MdxPage.d.ts +0 -3
  359. package/dist/app/plugins/markdown/MdxPage.js.map +0 -1
  360. package/dist/app/plugins/markdown/generateRoutes.js.map +0 -1
  361. package/dist/app/plugins/openapi/ColorizedParam.js.map +0 -1
  362. package/dist/app/plugins/openapi/MakeRequest.js +0 -23
  363. package/dist/app/plugins/openapi/MakeRequest.js.map +0 -1
  364. package/dist/app/plugins/openapi/OperationListItem.js +0 -15
  365. package/dist/app/plugins/openapi/OperationListItem.js.map +0 -1
  366. package/dist/app/plugins/openapi/graphql/index.js.map +0 -1
  367. package/dist/app/plugins/openapi/index.js.map +0 -1
  368. package/dist/app/plugins/openapi/playground/Playground.d.ts +0 -8
  369. package/dist/app/plugins/openapi/playground/Playground.js +0 -98
  370. package/dist/app/plugins/openapi/playground/Playground.js.map +0 -1
  371. package/dist/app/plugins/openapi/util/generateSchemaExample.js.map +0 -1
  372. package/dist/app/util/MdxComponents.js.map +0 -1
  373. package/dist/app/util/createVariantComponent.d.ts +0 -15
  374. package/dist/app/util/createVariantComponent.js +0 -12
  375. package/dist/app/util/createVariantComponent.js.map +0 -1
  376. package/dist/app/util/slugify.js.map +0 -1
  377. package/dist/auth.d.ts +0 -2
  378. package/dist/auth.js +0 -3
  379. package/dist/auth.js.map +0 -1
  380. package/dist/plugins.d.ts +0 -4
  381. package/dist/plugins.js +0 -6
  382. package/dist/plugins.js.map +0 -1
  383. package/src/app/components/navigation/SideNavigationWrapper.tsx +0 -15
  384. package/src/app/config.ts +0 -20
  385. package/src/app/markdowns.ts +0 -7
  386. package/src/app/plugins/api-key/SettingsApiKeys.tsx +0 -22
  387. package/src/app/plugins/api-key/index.tsx +0 -123
  388. package/src/app/plugins/openapi/MakeRequest.tsx +0 -49
  389. package/src/app/plugins/openapi/OperationListItem.tsx +0 -55
  390. package/src/app/plugins/openapi/playground/Playground.tsx +0 -309
  391. package/src/app/plugins/openapi/queries.graphql +0 -6
  392. /package/dist/{app → lib}/authentication/authentication.d.ts +0 -0
  393. /package/dist/{app → lib}/authentication/authentication.js +0 -0
  394. /package/dist/{app → lib}/authentication/openid.d.ts +0 -0
  395. /package/dist/{app → lib}/authentication/openid.js +0 -0
  396. /package/dist/{app → lib}/components/AnchorLink.d.ts +0 -0
  397. /package/dist/{app → lib}/components/AnchorLink.js +0 -0
  398. /package/dist/{app → lib}/components/CategoryHeading.d.ts +0 -0
  399. /package/dist/{app → lib}/components/CategoryHeading.js +0 -0
  400. /package/dist/{app → lib}/components/Dialog.d.ts +0 -0
  401. /package/dist/{app → lib}/components/DynamicIcon.d.ts +0 -0
  402. /package/dist/{app → lib}/components/DynamicIcon.js +0 -0
  403. /package/dist/{app → lib}/components/Header.d.ts +0 -0
  404. /package/dist/{app → lib/components}/Heading.d.ts +0 -0
  405. /package/dist/{app → lib}/components/Input.d.ts +0 -0
  406. /package/dist/{app → lib}/components/Input.js +0 -0
  407. /package/dist/{app → lib}/components/Layout.d.ts +0 -0
  408. /package/dist/{app → lib}/components/Markdown.d.ts +0 -0
  409. /package/dist/{app → lib}/components/Markdown.js +0 -0
  410. /package/dist/{app → lib}/components/TopNavigation.d.ts +0 -0
  411. /package/dist/{app → lib}/components/TopNavigation.js +0 -0
  412. /package/dist/{app → lib}/components/context/ComponentsContext.d.ts +0 -0
  413. /package/dist/{app → lib}/components/context/ComponentsContext.js +0 -0
  414. /package/dist/{app → lib}/components/context/DevPortalProvider.d.ts +0 -0
  415. /package/dist/{app → lib}/components/context/PluginSystem.d.ts +0 -0
  416. /package/dist/{app → lib}/components/context/PluginSystem.js +0 -0
  417. /package/dist/{app → lib}/components/context/ThemeContext.d.ts +0 -0
  418. /package/dist/{app → lib}/components/context/ThemeContext.js +0 -0
  419. /package/dist/{app → lib}/components/context/ViewportAnchorContext.d.ts +0 -0
  420. /package/dist/{app → lib}/components/context/ViewportAnchorContext.js +0 -0
  421. /package/dist/{app → lib}/components/navigation/SideNavigation.d.ts +0 -0
  422. /package/dist/{app → lib}/components/navigation/SideNavigationCategory.d.ts +0 -0
  423. /package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.d.ts +0 -0
  424. /package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js +0 -0
  425. /package/dist/{app → lib}/components/navigation/util.d.ts +0 -0
  426. /package/dist/{app → lib}/components/navigation/util.js +0 -0
  427. /package/dist/{app → lib}/core/helmet.d.ts +0 -0
  428. /package/dist/{app → lib}/core/helmet.js +0 -0
  429. /package/dist/{app → lib}/core/icons.d.ts +0 -0
  430. /package/dist/{app → lib}/core/icons.js +0 -0
  431. /package/dist/{app → lib}/core/router.d.ts +0 -0
  432. /package/dist/{app → lib}/core/router.js +0 -0
  433. /package/dist/{app → lib}/core/types/combine.d.ts +0 -0
  434. /package/dist/{app → lib}/core/types/combine.js +0 -0
  435. /package/dist/{app → lib}/oas/graphql/index.d.ts +0 -0
  436. /package/dist/{app → lib}/oas/graphql/index.js +0 -0
  437. /package/dist/{app → lib}/oas/graphql/server.d.ts +0 -0
  438. /package/dist/{app → lib}/oas/graphql/server.js +0 -0
  439. /package/dist/{app → lib}/oas/parser/dereference/index.d.ts +0 -0
  440. /package/dist/{app → lib}/oas/parser/dereference/index.js +0 -0
  441. /package/dist/{app → lib}/oas/parser/dereference/resolveRef.d.ts +0 -0
  442. /package/dist/{app → lib}/oas/parser/dereference/resolveRef.js +0 -0
  443. /package/dist/{app → lib}/oas/parser/index.d.ts +0 -0
  444. /package/dist/{app → lib}/oas/parser/index.js +0 -0
  445. /package/dist/{app → lib}/oas/parser/upgrade/index.d.ts +0 -0
  446. /package/dist/{app → lib}/oas/parser/upgrade/index.js +0 -0
  447. /package/dist/{app → lib}/plugins/markdown/Toc.d.ts +0 -0
  448. /package/dist/{app → lib}/plugins/markdown/Toc.js +0 -0
  449. /package/dist/{app → lib}/plugins/markdown/generateRoutes.d.ts +0 -0
  450. /package/dist/{app → lib}/plugins/markdown/index.d.ts +0 -0
  451. /package/dist/{app → lib}/plugins/markdown/index.js +0 -0
  452. /package/dist/{app → lib}/plugins/openapi/MakeRequest.d.ts +0 -0
  453. /package/dist/{app → lib}/plugins/openapi/MethodBadge.d.ts +0 -0
  454. /package/dist/{app → lib}/plugins/openapi/MethodBadge.js +0 -0
  455. /package/dist/{app → lib}/plugins/openapi/OperationList.d.ts +0 -0
  456. /package/dist/{app → lib}/plugins/openapi/OperationListItem.d.ts +0 -0
  457. /package/dist/{app → lib}/plugins/openapi/ParameterList.d.ts +0 -0
  458. /package/dist/{app → lib}/plugins/openapi/ParameterListItem.d.ts +0 -0
  459. /package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.d.ts +0 -0
  460. /package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.d.ts +0 -0
  461. /package/dist/{app → lib}/plugins/openapi/Select.d.ts +0 -0
  462. /package/dist/{app → lib}/plugins/openapi/Select.js +0 -0
  463. /package/dist/{app → lib}/plugins/openapi/Sidecar.d.ts +0 -0
  464. /package/dist/{app → lib}/plugins/openapi/SidecarBox.d.ts +0 -0
  465. /package/dist/{app → lib}/plugins/openapi/SidecarBox.js +0 -0
  466. /package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.d.ts +0 -0
  467. /package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js +0 -0
  468. /package/dist/{app → lib}/plugins/openapi/graphql/index.d.ts +0 -0
  469. /package/dist/{app → lib}/plugins/openapi/graphql/index.js +0 -0
  470. /package/dist/{app → lib}/plugins/openapi/index.d.ts +0 -0
  471. /package/dist/{app → lib}/plugins/openapi/util/urql.d.ts +0 -0
  472. /package/dist/{app → lib}/plugins/openapi/util/urql.js +0 -0
  473. /package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -0
  474. /package/dist/{app → lib}/plugins/openapi/worker/worker.d.ts +0 -0
  475. /package/dist/{app → lib}/plugins/openapi/worker/worker.js +0 -0
  476. /package/dist/{app → lib}/plugins/redirect/index.js +0 -0
  477. /package/dist/{app → lib}/ui/Button.js +0 -0
  478. /package/dist/{app → lib}/ui/Callout.d.ts +0 -0
  479. /package/dist/{app → lib}/ui/Callout.js +0 -0
  480. /package/dist/{app → lib}/ui/Card.d.ts +0 -0
  481. /package/dist/{app → lib}/ui/Card.js +0 -0
  482. /package/dist/{app → lib}/ui/Note.d.ts +0 -0
  483. /package/dist/{app → lib}/ui/Note.js +0 -0
  484. /package/dist/{app → lib}/ui/Tabs.d.ts +0 -0
  485. /package/dist/{app → lib}/ui/Tabs.js +0 -0
  486. /package/dist/{app → lib}/util/MdxComponents.d.ts +0 -0
  487. /package/dist/{app → lib}/util/cn.d.ts +0 -0
  488. /package/dist/{app → lib}/util/cn.js +0 -0
  489. /package/dist/{app → lib}/util/createWaitForNotify.d.ts +0 -0
  490. /package/dist/{app → lib}/util/createWaitForNotify.js +0 -0
  491. /package/dist/{app → lib}/util/groupBy.d.ts +0 -0
  492. /package/dist/{app → lib}/util/groupBy.js +0 -0
  493. /package/dist/{app → lib}/util/joinPath.d.ts +0 -0
  494. /package/dist/{app → lib}/util/joinPath.js +0 -0
  495. /package/dist/{app → lib}/util/pastellize.d.ts +0 -0
  496. /package/dist/{app → lib}/util/pastellize.js +0 -0
  497. /package/dist/{app → lib}/util/slugify.d.ts +0 -0
  498. /package/dist/{app → lib}/util/slugify.js +0 -0
  499. /package/dist/{app → lib}/util/traverseNavigation.d.ts +0 -0
  500. /package/dist/{app → lib}/util/traverseNavigation.js +0 -0
  501. /package/dist/{app → lib}/util/useScrollToAnchor.d.ts +0 -0
  502. /package/dist/{app → lib}/util/useScrollToAnchor.js +0 -0
  503. /package/dist/{app → lib}/util/useScrollToTop.d.ts +0 -0
  504. /package/dist/{app → lib}/util/useScrollToTop.js +0 -0
  505. /package/src/{app → lib}/authentication/authentication.ts +0 -0
  506. /package/src/{app → lib}/authentication/openid.ts +0 -0
  507. /package/src/{app → lib}/components/AnchorLink.tsx +0 -0
  508. /package/src/{app → lib}/components/CategoryHeading.tsx +0 -0
  509. /package/src/{app → lib}/components/DynamicIcon.tsx +0 -0
  510. /package/src/{app → lib}/components/Input.tsx +0 -0
  511. /package/src/{app → lib}/components/Markdown.tsx +0 -0
  512. /package/src/{app → lib}/components/TopNavigation.tsx +0 -0
  513. /package/src/{app → lib}/components/context/ComponentsContext.tsx +0 -0
  514. /package/src/{app → lib}/components/context/PluginSystem.ts +0 -0
  515. /package/src/{app → lib}/components/context/ThemeContext.tsx +0 -0
  516. /package/src/{app → lib}/components/context/ViewportAnchorContext.tsx +0 -0
  517. /package/src/{app → lib}/components/navigation/useNavigationCollapsibleState.ts +0 -0
  518. /package/src/{app → lib}/components/navigation/util.ts +0 -0
  519. /package/src/{app → lib}/core/helmet.ts +0 -0
  520. /package/src/{app → lib}/core/icons.tsx +0 -0
  521. /package/src/{app → lib}/core/router.tsx +0 -0
  522. /package/src/{app → lib}/core/types/combine.ts +0 -0
  523. /package/src/{app → lib}/oas/graphql/index.ts +0 -0
  524. /package/src/{app → lib}/oas/graphql/server.ts +0 -0
  525. /package/src/{app → lib}/oas/parser/dereference/index.ts +0 -0
  526. /package/src/{app → lib}/oas/parser/dereference/resolveRef.ts +0 -0
  527. /package/src/{app → lib}/oas/parser/index.ts +0 -0
  528. /package/src/{app → lib}/oas/parser/schemas/v3.0.json +0 -0
  529. /package/src/{app → lib}/oas/parser/schemas/v3.1.json +0 -0
  530. /package/src/{app → lib}/oas/parser/upgrade/index.ts +0 -0
  531. /package/src/{app → lib}/plugins/markdown/Toc.tsx +0 -0
  532. /package/src/{app → lib}/plugins/markdown/index.tsx +0 -0
  533. /package/src/{app → lib}/plugins/openapi/MethodBadge.tsx +0 -0
  534. /package/src/{app → lib}/plugins/openapi/Select.tsx +0 -0
  535. /package/src/{app → lib}/plugins/openapi/SidecarBox.tsx +0 -0
  536. /package/src/{app → lib}/plugins/openapi/graphql/fragment-masking.ts +0 -0
  537. /package/src/{app → lib}/plugins/openapi/graphql/index.ts +0 -0
  538. /package/src/{app → lib}/plugins/openapi/util/urql.ts +0 -0
  539. /package/src/{app → lib}/plugins/openapi/worker/worker.ts +0 -0
  540. /package/src/{app → lib}/ui/Button.tsx +0 -0
  541. /package/src/{app → lib}/ui/Callout.tsx +0 -0
  542. /package/src/{app → lib}/ui/Card.tsx +0 -0
  543. /package/src/{app → lib}/ui/Note.tsx +0 -0
  544. /package/src/{app → lib}/ui/Tabs.tsx +0 -0
  545. /package/src/{app → lib}/util/cn.ts +0 -0
  546. /package/src/{app → lib}/util/createWaitForNotify.ts +0 -0
  547. /package/src/{app → lib}/util/groupBy.ts +0 -0
  548. /package/src/{app → lib}/util/joinPath.tsx +0 -0
  549. /package/src/{app → lib}/util/pastellize.ts +0 -0
  550. /package/src/{app → lib}/util/slugify.ts +0 -0
  551. /package/src/{app → lib}/util/traverseNavigation.ts +0 -0
  552. /package/src/{app → lib}/util/useScrollToAnchor.ts +0 -0
  553. /package/src/{app → lib}/util/useScrollToTop.ts +0 -0
@@ -0,0 +1,324 @@
1
+ import {
2
+ Dialog,
3
+ DialogContent,
4
+ DialogDescription,
5
+ DialogHeader,
6
+ DialogTitle,
7
+ DialogTrigger,
8
+ } from "../../../components/Dialog.js";
9
+ import { Card, CardContent } from "../../../ui/Card.js";
10
+ import { Button } from "../../../ui/Button.js";
11
+ import { Tabs, TabsContent, TabsList, TabsTrigger } from "../../../ui/Tabs.js";
12
+ import { Fragment, useMemo } from "react";
13
+ import { SyntaxHighlight } from "../../../components/SyntaxHighlight.js";
14
+ import { ColorizedParam } from "../ColorizedParam.js";
15
+ import { useMutation } from "@tanstack/react-query";
16
+ import { FormProvider, useForm } from "react-hook-form";
17
+ import { Headers } from "./Headers.js";
18
+ import { QueryParams } from "./QueryParams.js";
19
+ import { PathParams } from "./PathParams.js";
20
+ import { CirclePlayIcon, LoaderCircle, MonitorCheckIcon } from "lucide-react";
21
+ import { createUrl } from "./createUrl.js";
22
+ import { UrlDisplay } from "./UrlDisplay.js";
23
+ import { useApiIdentities } from "../../../components/context/DevPortalProvider.js";
24
+
25
+ function mimeTypeToLanguage(mimeType: string) {
26
+ const mimeTypeMapping = {
27
+ "application/json": "json",
28
+ "text/json": "json",
29
+ "text/html": "html",
30
+ "text/css": "css",
31
+ "text/javascript": "javascript",
32
+ "application/xml": "xml",
33
+ "application/xhtml+xml": "xhtml",
34
+ "text/plain": "plain",
35
+ } as const;
36
+
37
+ return Object.entries(mimeTypeMapping).find(([mime]) =>
38
+ mimeType.includes(mime),
39
+ )?.[0][1];
40
+ }
41
+
42
+ const statusCodeMap: Record<number, string> = {
43
+ 200: "OK",
44
+ 201: "Created",
45
+ 202: "Accepted",
46
+ 204: "No Content",
47
+ 400: "Bad Request",
48
+ 401: "Unauthorized",
49
+ 403: "Forbidden",
50
+ 404: "Not Found",
51
+ 405: "Method Not Allowed",
52
+ 500: "Internal Server Error",
53
+ };
54
+
55
+ export type Header = {
56
+ name: string;
57
+ value: string;
58
+ };
59
+ export type QueryParam = {
60
+ name: string;
61
+ value: string;
62
+ active?: boolean;
63
+ };
64
+ export type PathParam = {
65
+ name: string;
66
+ value: string;
67
+ };
68
+
69
+ export type PlaygroundForm = {
70
+ body: string;
71
+ queryParams: QueryParam[];
72
+ pathParams: PathParam[];
73
+ headers: Header[];
74
+ };
75
+
76
+ const Playground = ({
77
+ url,
78
+ host,
79
+ method,
80
+ headers = [{ name: "", value: "" }],
81
+ queryParams = [],
82
+ pathParams = [],
83
+ hasParams,
84
+ }: {
85
+ host: string;
86
+ url: string;
87
+ method: string;
88
+ headers?: Header[];
89
+ queryParams?: QueryParam[];
90
+ pathParams?: PathParam[];
91
+ hasParams: boolean;
92
+ }) => {
93
+ const { register, control, handleSubmit, watch, ...form } =
94
+ useForm<PlaygroundForm>({
95
+ defaultValues: {
96
+ body: "",
97
+ queryParams,
98
+ headers,
99
+ pathParams,
100
+ },
101
+ });
102
+ const formState = watch();
103
+ const identities = useApiIdentities();
104
+
105
+ const queryMutation = useMutation({
106
+ mutationFn: async (data: PlaygroundForm) => {
107
+ const requestUrl = createUrl(host, url, data);
108
+ const start = performance.now();
109
+ const response = await fetch(requestUrl, {
110
+ method: method.toUpperCase(),
111
+ headers: Object.fromEntries(
112
+ data.pathParams
113
+ .filter((h) => h.name)
114
+ .map((header) => [header.name, header.value]),
115
+ ),
116
+ });
117
+
118
+ const body = await response.text();
119
+
120
+ return {
121
+ status: response.status,
122
+ headers: response.headers,
123
+ size: body.length,
124
+ body,
125
+ time: performance.now() - start,
126
+ };
127
+ },
128
+ });
129
+
130
+ const path = url.split("/").map((part, i, arr) => (
131
+ <Fragment key={part}>
132
+ {part.startsWith("{") && part.endsWith("}") ? (
133
+ <ColorizedParam
134
+ name={part}
135
+ backgroundOpacity="0"
136
+ onClick={() => {
137
+ console.log("asd");
138
+ }}
139
+ slug={part.slice(1, -1)}
140
+ >
141
+ {
142
+ formState.pathParams.find((p) => p.name === part.slice(1, -1))
143
+ ?.value
144
+ }
145
+ </ColorizedParam>
146
+ ) : (
147
+ part
148
+ )}
149
+ {i < arr.length - 1 && "/"}
150
+ <wbr />
151
+ </Fragment>
152
+ ));
153
+
154
+ const lang = mimeTypeToLanguage(
155
+ queryMutation.data?.headers.get("Content-Type") ?? "",
156
+ );
157
+
158
+ const headerEntries = Array.from(queryMutation.data?.headers.entries() ?? []);
159
+
160
+ const urlQueryParams = formState.queryParams
161
+ .filter((p) => p.active)
162
+ .map((p) => (
163
+ <Fragment key={p.name}>
164
+ {p.name}={p.value}
165
+ <wbr />
166
+ </Fragment>
167
+ ));
168
+
169
+ return (
170
+ <Dialog>
171
+ <DialogTrigger asChild>
172
+ <CirclePlayIcon
173
+ className="cursor-pointer text-primary hover:text-primary/80"
174
+ size={16}
175
+ />
176
+ </DialogTrigger>
177
+
178
+ <DialogContent className="max-w-screen-xl w-full h-5/6 overflow-auto p-0">
179
+ <FormProvider {...{ register, control, handleSubmit, watch, ...form }}>
180
+ <form
181
+ onSubmit={handleSubmit((data) => {
182
+ queryMutation.mutateAsync(data);
183
+ })}
184
+ >
185
+ <div className="grid grid-cols-2 text-sm h-full">
186
+ <div className="flex flex-col gap-4 p-8 bg-muted/50 after:bg-muted-foreground/20 relative after:absolute after:w-px after:inset-0 after:left-auto">
187
+ <div className="flex gap-2 items-stretch">
188
+ <div className="flex flex-1 items-center w-full border rounded-md border-border">
189
+ <div className="border-r border-border p-2 bg-muted rounded-l-md self-stretch font-semibold font-mono">
190
+ {method.toUpperCase()}
191
+ </div>
192
+ <div className="p-2 font-mono text-xs">
193
+ {path}
194
+ {urlQueryParams.length > 0 ? "?" : ""}
195
+ {urlQueryParams}
196
+ </div>
197
+ </div>
198
+ <Button type="submit" className="h-auto flex gap-1">
199
+ Send
200
+ </Button>
201
+ </div>
202
+ <Tabs defaultValue={hasParams ? "parameters" : "headers"}>
203
+ <TabsList>
204
+ {hasParams && (
205
+ <TabsTrigger value="parameters">Parameters</TabsTrigger>
206
+ )}
207
+ <TabsTrigger value="headers">
208
+ Headers{" "}
209
+ {formState.headers.length > 0 &&
210
+ `(${formState.headers.length})`}
211
+ </TabsTrigger>
212
+ <TabsTrigger
213
+ value="body"
214
+ disabled={["POST", "PUT", "PATCH", "DELETE"].includes(
215
+ method.toUpperCase(),
216
+ )}
217
+ >
218
+ Body
219
+ </TabsTrigger>
220
+ </TabsList>
221
+ <TabsContent value="headers">
222
+ <Headers
223
+ control={control}
224
+ register={register}
225
+ headers={formState.headers}
226
+ />
227
+ </TabsContent>
228
+ <TabsContent value="parameters">
229
+ <div className="grid grid-cols-[min-content_1fr_1fr_auto]">
230
+ {pathParams.length > 0 && (
231
+ <div className="font-semibold my-3 col-span-3">
232
+ Path Parameters
233
+ </div>
234
+ )}
235
+ <PathParams control={control} register={register} />
236
+ {queryParams.length > 0 && (
237
+ <span className="font-semibold my-3 col-span-3">
238
+ Query Parameters
239
+ </span>
240
+ )}
241
+ <QueryParams control={control} />
242
+ </div>
243
+ </TabsContent>
244
+ <TabsContent value="body">
245
+ <textarea
246
+ {...register("body")}
247
+ className="border border-border w-full rounded p-2 bg-muted h-40"
248
+ />
249
+ </TabsContent>
250
+ </Tabs>
251
+ </div>
252
+ <div className="flex flex-col gap-4 p-8 bg-muted/70">
253
+ {queryMutation.error ? (
254
+ <div>{queryMutation.error.message}</div>
255
+ ) : queryMutation.data ? (
256
+ <div className="flex flex-col gap-2">
257
+ <div className="flex gap-2">
258
+ <div className="flex text-xs gap-6">
259
+ <div>
260
+ Status: {queryMutation.data.status}{" "}
261
+ {statusCodeMap[queryMutation.data.status] ?? ""}
262
+ </div>
263
+ <div>Time: {queryMutation.data.time.toFixed(0)}ms</div>
264
+ <div>Size: {queryMutation.data.size} B</div>
265
+ </div>
266
+ </div>
267
+ {/*<UrlDisplay host={host} path={url} />*/}
268
+ <Tabs defaultValue="response">
269
+ <TabsList>
270
+ <TabsTrigger value="response">Response</TabsTrigger>
271
+ <TabsTrigger value="headers">
272
+ {headerEntries.length
273
+ ? `Headers (${headerEntries.length})`
274
+ : "No headers"}
275
+ </TabsTrigger>
276
+ </TabsList>
277
+
278
+ <TabsContent value="response">
279
+ <Card className="shadow-none p-4">
280
+ <SyntaxHighlight
281
+ language={lang ?? "json"}
282
+ noBackground
283
+ className="overflow-x-auto "
284
+ code={
285
+ queryMutation.data?.body ?? JSON.stringify("")
286
+ }
287
+ />
288
+ </Card>
289
+ </TabsContent>
290
+ <TabsContent value="headers">
291
+ <Card className="grid grid-cols-2 w-full gap-2.5 font-mono text-xs shadow-none p-4">
292
+ <div className="font-semibold">Key</div>
293
+ <div className="font-semibold">Value</div>
294
+ {headerEntries.map(([key, value]) => (
295
+ <Fragment key={key}>
296
+ <div>{key}</div>
297
+ <div>{value}</div>
298
+ </Fragment>
299
+ ))}
300
+ </Card>
301
+ </TabsContent>
302
+ </Tabs>
303
+ </div>
304
+ ) : (
305
+ <div className="grid place-items-center h-full">
306
+ <span className="text-[16px] font-semibold text-muted-foreground">
307
+ {queryMutation.isPending ? (
308
+ <LoaderCircle size={18} className="animate-spin" />
309
+ ) : (
310
+ "Send a request first to see the response here"
311
+ )}
312
+ </span>
313
+ </div>
314
+ )}
315
+ </div>
316
+ </div>
317
+ </form>
318
+ </FormProvider>
319
+ </DialogContent>
320
+ </Dialog>
321
+ );
322
+ };
323
+
324
+ export { Playground };
@@ -0,0 +1,111 @@
1
+ import {
2
+ Control,
3
+ Controller,
4
+ useFieldArray,
5
+ useFormContext,
6
+ useWatch,
7
+ } from "react-hook-form";
8
+ import { XIcon } from "lucide-react";
9
+ import { InlineInput } from "./InlineInput.js";
10
+ import { PlaygroundForm } from "./Playground.js";
11
+ import { useEffect } from "react";
12
+
13
+ const QueryParamActive = ({
14
+ i,
15
+ control,
16
+ }: {
17
+ i: number;
18
+ control: Control<PlaygroundForm>;
19
+ }) => {
20
+ const value = useWatch({ control, name: `queryParams.${i}.value` });
21
+ const active = useWatch({ control, name: `queryParams.${i}.active` });
22
+ const form = useFormContext<PlaygroundForm>();
23
+ const dirty = form.formState.dirtyFields;
24
+
25
+ console.log("dirty fields", dirty);
26
+
27
+ useEffect(() => {
28
+ if (value) {
29
+ console.log(`queryParams.${i}.active`, active);
30
+ form.setValue(`queryParams.${i}.active`, true);
31
+ }
32
+ }, [value]);
33
+
34
+ return (
35
+ <Controller
36
+ name={`queryParams.${i}.active`}
37
+ render={({ field }) => {
38
+ return (
39
+ <input
40
+ type="checkbox"
41
+ id={`queryParams.${i}.active`}
42
+ {...field}
43
+ checked={field.value}
44
+ />
45
+ );
46
+ }}
47
+ />
48
+ );
49
+ };
50
+
51
+ export const QueryParams = ({
52
+ control,
53
+ }: {
54
+ control: Control<PlaygroundForm>;
55
+ }) => {
56
+ const { fields } = useFieldArray<PlaygroundForm>({
57
+ control,
58
+ name: "queryParams",
59
+ });
60
+
61
+ return fields.map((field, i) => (
62
+ <div
63
+ key={field.id}
64
+ className="px-2 grid-cols-subgrid col-span-full grid items-center gap-x-2 has-[:focus]:bg-muted hover:bg-accent rounded overflow-hidden group"
65
+ >
66
+ <QueryParamActive i={i} control={control} />
67
+
68
+ <Controller
69
+ control={control}
70
+ render={({ field }) => {
71
+ return (
72
+ <InlineInput asChild>
73
+ <label
74
+ className="flex items-center"
75
+ htmlFor={`queryParams.${i}.active`}
76
+ >
77
+ {field.value}
78
+ </label>
79
+ </InlineInput>
80
+ );
81
+ }}
82
+ name={`queryParams.${i}.name`}
83
+ />
84
+ <Controller
85
+ control={control}
86
+ render={({ field }) => {
87
+ return (
88
+ <InlineInput {...field} placeholder="Value" className="peer" />
89
+ );
90
+ }}
91
+ name={`queryParams.${i}.value`}
92
+ />
93
+ <Controller
94
+ control={control}
95
+ render={({ field }) => {
96
+ return (
97
+ <button
98
+ className="hover:bg-black/5 p-1 rounded mr-2 text-muted-foreground invisible group-hover:visible peer-focus:visible"
99
+ onClick={() => field.onChange("")}
100
+ >
101
+ <XIcon size={16} />
102
+ </button>
103
+ );
104
+ }}
105
+ name={`queryParams.${i}.value`}
106
+ />
107
+
108
+ <div className="-mx-2 col-span-full border-b border-border"></div>
109
+ </div>
110
+ ));
111
+ };
@@ -0,0 +1,32 @@
1
+ import { useFormContext } from "react-hook-form";
2
+ import type { PlaygroundForm } from "./Playground.js";
3
+
4
+ export const UrlDisplay = ({ host, path }: { host: string; path: string }) => {
5
+ const { watch } = useFormContext<PlaygroundForm>();
6
+ const data = watch();
7
+ const url = new URL(
8
+ host +
9
+ path
10
+ .split("/")
11
+ .map((v) =>
12
+ v.startsWith("{") && v.endsWith("}")
13
+ ? data.pathParams.find((part) => part.name === v.slice(1, -1))
14
+ ?.value ?? v
15
+ : v,
16
+ )
17
+ .join("/"),
18
+ );
19
+
20
+ data.queryParams.forEach((param) => {
21
+ if (!param.value) {
22
+ return;
23
+ }
24
+ url.searchParams.set(param.name, param.value);
25
+ });
26
+
27
+ return (
28
+ <div className="overflow-auto font-mono whitespace-nowrap">
29
+ {url.toString()}
30
+ </div>
31
+ );
32
+ };
@@ -0,0 +1,22 @@
1
+ import { PlaygroundForm } from "./Playground.js";
2
+
3
+ export const createUrl = (host: string, path: string, data: PlaygroundForm) => {
4
+ const url = new URL(
5
+ host +
6
+ path
7
+ .split("/")
8
+ .map((v) =>
9
+ v.startsWith("{") && v.endsWith("}")
10
+ ? data.pathParams.find((part) => part.name === v.slice(1, -1))
11
+ ?.value ?? v
12
+ : v,
13
+ )
14
+ .join("/"),
15
+ );
16
+
17
+ data.queryParams.forEach((param) => {
18
+ url.searchParams.set(param.name, param.value);
19
+ });
20
+
21
+ return url;
22
+ };
@@ -4,7 +4,10 @@ import { type SchemaObject } from "../../../oas/graphql/index.js";
4
4
  export const isObject = (value: unknown): boolean =>
5
5
  typeof value === "object" && value !== null && !Array.isArray(value);
6
6
 
7
- export const generateSchemaExample = (schema: SchemaObject): any => {
7
+ export const generateSchemaExample = (
8
+ schema: SchemaObject,
9
+ name?: string,
10
+ ): any => {
8
11
  // Directly return the example or default if they exist
9
12
  if (schema.example !== undefined) {
10
13
  return schema.example;
@@ -18,25 +21,37 @@ export const generateSchemaExample = (schema: SchemaObject): any => {
18
21
  }
19
22
 
20
23
  // Recursively process objects and arrays
21
- return processComplexTypes(schema);
24
+ return processComplexTypes(schema, name);
22
25
  };
23
26
 
24
- function processComplexTypes(schema: SchemaObject): any {
25
- if (schema.type === "object" && schema.properties) {
27
+ function processComplexTypes(schema: SchemaObject, name?: string): any {
28
+ const properties = Object.entries(schema.properties ?? {}).concat(
29
+ Object.entries(schema.additionalProperties ?? {}),
30
+ );
31
+ if (schema.type === "object" && properties.length > 0) {
26
32
  const obj: { [key: string]: any } = {};
27
- Object.keys(schema.properties!).forEach((key) => {
28
- obj[key] = generateSchemaExample(schema.properties![key]);
33
+ properties.forEach(([key, propSchema]) => {
34
+ const value = generateSchemaExample(propSchema, key);
35
+ if (value !== undefined) {
36
+ obj[key] = value;
37
+ }
29
38
  });
30
39
  return obj;
31
40
  } else if (schema.type === "array" && schema.items) {
32
- return [generateSchemaExample(schema.items)];
41
+ console.log(name, "array", schema.items, schema);
42
+ const value = generateSchemaExample(schema.items, name);
43
+ if (value !== undefined) {
44
+ return [value];
45
+ }
46
+ return [];
33
47
  }
34
48
  // Fallback for missing or undefined types
35
- return getDefaultForType(schema.type);
49
+ return undefined; //getDefaultForType(schema.type);
36
50
  }
37
51
 
38
52
  function getDefaultForType(type?: string | string[]): any {
39
53
  if (Array.isArray(type)) {
54
+ debugger;
40
55
  return getDefaultForSingleType(type[0]);
41
56
  }
42
57
  return getDefaultForSingleType(type);
@@ -54,6 +69,6 @@ function getDefaultForSingleType(type?: string): any {
54
69
  case "null":
55
70
  return null;
56
71
  default:
57
- return undefined;
72
+ return "undefined";
58
73
  }
59
74
  }
@@ -1,4 +1,4 @@
1
- import { monotonicFactory } from "ulid";
1
+ import { monotonicFactory } from "ulidx";
2
2
  import { createWaitForNotify } from "../../../util/createWaitForNotify.js";
3
3
  import {
4
4
  cacheExchange,
@@ -0,0 +1,5 @@
1
+ export function createSharedWorker() {
2
+ return new SharedWorker(new URL("./worker.ts", import.meta.url), {
3
+ type: "module",
4
+ });
5
+ }
@@ -0,0 +1 @@
1
+ export { createSharedWorkerClient } from "./openapi/worker/createSharedWorkerClient.js";
@@ -1,7 +1,7 @@
1
1
  import { Navigate } from "react-router-dom";
2
2
  import type { DevPortalPlugin } from "../../core/plugins.js";
3
3
 
4
- type Redirect = {
4
+ export type Redirect = {
5
5
  from: string;
6
6
  to: string;
7
7
  replace?: boolean;
@@ -2,7 +2,7 @@ import { MDXProvider } from "@mdx-js/react";
2
2
  import type { ComponentProps } from "react";
3
3
 
4
4
  import { Link } from "react-router-dom";
5
- import { Heading } from "../Heading.js";
5
+ import { Heading } from "../components/Heading.js";
6
6
  import { SyntaxHighlight } from "../components/SyntaxHighlight.js";
7
7
  import { Callout } from "../ui/Callout.js";
8
8
  import { cn } from "./cn.js";
@@ -51,6 +51,7 @@ export const MdxComponents = {
51
51
  <SyntaxHighlight
52
52
  language={match?.[1] ?? "markup"}
53
53
  className="rounded-xl overflow-x-auto p-4 border border-border dark:!bg-foreground/10 dark:border-transparent"
54
+ showLanguageIndicator
54
55
  code={String(children).trim()}
55
56
  />
56
57
  );
@@ -1,7 +1,8 @@
1
- import { cva } from "class-variance-authority";
2
- import { ClassValue } from "clsx";
3
1
  import * as React from "react";
4
- import { JSX } from "react/jsx-runtime";
2
+ import { cva } from "class-variance-authority";
3
+ import { Slot } from "@radix-ui/react-slot";
4
+ import type { ClassValue } from "clsx";
5
+ import type { JSX } from "react/jsx-runtime";
5
6
  import { cn } from "./cn.js";
6
7
 
7
8
  const createVariantComponent = <
@@ -12,15 +13,19 @@ const createVariantComponent = <
12
13
  cvx: ClassValue | C,
13
14
  // variantProps: Array<keyof VariantProps<C>> = [],
14
15
  ) => {
15
- const MyVariant = ({
16
- className,
17
- ...props
18
- }: JSX.IntrinsicElements[E] & { className?: ClassValue }) =>
19
- React.createElement(tag, {
16
+ const MyVariant = React.forwardRef<
17
+ HTMLElement,
18
+ JSX.IntrinsicElements[E] & { className?: ClassValue; asChild?: boolean }
19
+ >(({ className, asChild, ...props }, ref) => {
20
+ const Comp = asChild ? Slot : tag;
21
+
22
+ return React.createElement(Comp, {
20
23
  ...props,
24
+ ref,
21
25
  className:
22
26
  typeof cvx === "function" ? cvx({ className }) : cn(cvx, className),
23
27
  });
28
+ });
24
29
 
25
30
  MyVariant.displayName = `VariantComponent(${tag})`;
26
31
 
@@ -1,41 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { MDXProvider } from "@mdx-js/react";
3
- import { QueryClientProvider } from "@tanstack/react-query";
4
- import { memo, Suspense, useEffect, useMemo } from "react";
5
- import { createBrowserRouter, RouterProvider } from "react-router-dom";
6
- import { ComponentsProvider, DEFAULT_COMPONENTS, } from "./components/context/ComponentsContext.js";
7
- import { DevPortalProvider } from "./components/context/DevPortalProvider.js";
8
- import { ThemeProvider } from "./components/context/ThemeContext.js";
9
- import { ViewportAnchorProvider } from "./components/context/ViewportAnchorContext.js";
10
- import { Layout } from "./components/Layout.js";
11
- import { DevPortalContext, queryClient, } from "./core/DevPortalContext.js";
12
- import { HelmetProvider } from "./core/helmet.js";
13
- import { isNavigationPlugin } from "./core/plugins.js";
14
- import { MdxComponents } from "./util/MdxComponents.js";
15
- export const DevPortalSystemPaths = {
16
- Settings: "/settings",
17
- };
18
- const DevPortal = (props) => {
19
- const router = useMemo(() => {
20
- const routes = (props.plugins ?? []).flatMap((plugin) => isNavigationPlugin(plugin) ? plugin.getRoutes() : []);
21
- return createBrowserRouter([
22
- {
23
- path: "/",
24
- element: _jsx(Layout, {}),
25
- errorElement: (_jsx(Layout, { children: _jsx("div", { className: "h-[75vh] flex items-center justify-center", children: "Error, look at the console" }) })),
26
- children: routes,
27
- },
28
- ]);
29
- }, [props.plugins]);
30
- const components = useMemo(() => ({ ...DEFAULT_COMPONENTS, ...props.overrides }), [props.overrides]);
31
- const mdxComponents = useMemo(() => ({ ...MdxComponents, ...props.mdxComponents }), [props.mdxComponents]);
32
- const devPortalContext = useMemo(() => new DevPortalContext(props), [props]);
33
- useEffect(() => {
34
- void devPortalContext.initialize();
35
- }, [devPortalContext]);
36
- return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(HelmetProvider, { children: _jsx(DevPortalProvider, { value: devPortalContext, children: _jsx(MDXProvider, { components: mdxComponents, children: _jsx(ThemeProvider, { children: _jsx(ComponentsProvider, { value: components, children: _jsx(ViewportAnchorProvider, { children: _jsx(Suspense, { fallback: _jsx("div", { className: "grid place-items-center h-full", children: "Loading..." }), children: _jsx(RouterProvider, { router: router }) }) }) }) }) }) }) }) }));
37
- };
38
- const MemoDevPortal = memo(DevPortal);
39
- MemoDevPortal.displayName = "DevPortal";
40
- export default MemoDevPortal;
41
- //# sourceMappingURL=DevPortal.js.map