zudoku 0.0.0-f865d81 → 0.0.0-fb7d300

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 (392) hide show
  1. package/dist/app/demo.js +0 -2
  2. package/dist/app/demo.js.map +1 -1
  3. package/dist/app/entry.client.js +14 -0
  4. package/dist/app/entry.client.js.map +1 -1
  5. package/dist/app/entry.server.js +6 -6
  6. package/dist/app/entry.server.js.map +1 -1
  7. package/dist/app/main.d.ts +1 -1
  8. package/dist/app/main.js +2 -2
  9. package/dist/app/main.js.map +1 -1
  10. package/dist/app/standalone.js +0 -2
  11. package/dist/app/standalone.js.map +1 -1
  12. package/dist/cli/cli.js +1 -2
  13. package/dist/cli/cli.js.map +1 -1
  14. package/dist/codegen.d.ts +3 -0
  15. package/dist/codegen.js +45 -0
  16. package/dist/codegen.js.map +1 -0
  17. package/dist/config/validators/InputSidebarSchema.d.ts +10 -10
  18. package/dist/config/validators/validate.d.ts +125 -114
  19. package/dist/config/validators/validate.js +6 -5
  20. package/dist/config/validators/validate.js.map +1 -1
  21. package/dist/index.d.ts +2 -2
  22. package/dist/index.js +1 -1
  23. package/dist/index.js.map +1 -1
  24. package/dist/lib/authentication/AuthenticationPlugin.d.ts +4 -2
  25. package/dist/lib/authentication/AuthenticationPlugin.js +3 -0
  26. package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -1
  27. package/dist/lib/authentication/authentication.d.ts +3 -3
  28. package/dist/lib/authentication/hook.d.ts +5 -4
  29. package/dist/lib/authentication/hook.js +1 -3
  30. package/dist/lib/authentication/hook.js.map +1 -1
  31. package/dist/lib/authentication/providers/auth0.js +12 -11
  32. package/dist/lib/authentication/providers/auth0.js.map +1 -1
  33. package/dist/lib/authentication/providers/openid.d.ts +0 -1
  34. package/dist/lib/authentication/providers/openid.js +11 -26
  35. package/dist/lib/authentication/providers/openid.js.map +1 -1
  36. package/dist/lib/authentication/state.d.ts +25 -4
  37. package/dist/lib/authentication/state.js +28 -3
  38. package/dist/lib/authentication/state.js.map +1 -1
  39. package/dist/lib/authentication/use-broadcast/shared.d.ts +48 -0
  40. package/dist/lib/authentication/use-broadcast/shared.js +243 -0
  41. package/dist/lib/authentication/use-broadcast/shared.js.map +1 -0
  42. package/dist/lib/authentication/use-broadcast/useBroadcast.d.ts +24 -0
  43. package/dist/lib/authentication/use-broadcast/useBroadcast.js +106 -0
  44. package/dist/lib/authentication/use-broadcast/useBroadcast.js.map +1 -0
  45. package/dist/lib/components/Bootstrap.d.ts +3 -1
  46. package/dist/lib/components/Bootstrap.js +10 -4
  47. package/dist/lib/components/Bootstrap.js.map +1 -1
  48. package/dist/lib/components/ClientOnly.d.ts +4 -2
  49. package/dist/lib/components/ClientOnly.js +1 -1
  50. package/dist/lib/components/ClientOnly.js.map +1 -1
  51. package/dist/lib/components/DeveloperHint.js +2 -1
  52. package/dist/lib/components/DeveloperHint.js.map +1 -1
  53. package/dist/lib/components/Header.js +16 -10
  54. package/dist/lib/components/Header.js.map +1 -1
  55. package/dist/lib/components/Heading.d.ts +1 -1
  56. package/dist/lib/components/Layout.js +12 -4
  57. package/dist/lib/components/Layout.js.map +1 -1
  58. package/dist/lib/components/MobileTopNavigation.js +6 -7
  59. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  60. package/dist/lib/components/SyntaxHighlight.js +16 -12
  61. package/dist/lib/components/SyntaxHighlight.js.map +1 -1
  62. package/dist/lib/components/ThemeSwitch.d.ts +1 -0
  63. package/dist/lib/components/ThemeSwitch.js +13 -0
  64. package/dist/lib/components/ThemeSwitch.js.map +1 -0
  65. package/dist/lib/components/TopNavigation.d.ts +2 -0
  66. package/dist/lib/components/TopNavigation.js +13 -7
  67. package/dist/lib/components/TopNavigation.js.map +1 -1
  68. package/dist/lib/components/{DevPortal.d.ts → Zudoku.d.ts} +3 -3
  69. package/dist/lib/components/{DevPortal.js → Zudoku.js} +13 -14
  70. package/dist/lib/components/Zudoku.js.map +1 -0
  71. package/dist/lib/components/context/ZudokuContext.d.ts +7 -7
  72. package/dist/lib/components/context/ZudokuContext.js +8 -13
  73. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  74. package/dist/lib/components/context/ZudokuProvider.d.ts +2 -2
  75. package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
  76. package/dist/lib/components/index.d.ts +18 -10
  77. package/dist/lib/components/index.js +2 -3
  78. package/dist/lib/components/index.js.map +1 -1
  79. package/dist/lib/components/navigation/Sidebar.js +1 -1
  80. package/dist/lib/components/navigation/Sidebar.js.map +1 -1
  81. package/dist/lib/components/navigation/utils.js +2 -2
  82. package/dist/lib/components/navigation/utils.js.map +1 -1
  83. package/dist/lib/core/{DevPortalContext.d.ts → ZudokuContext.d.ts} +3 -7
  84. package/dist/lib/core/{DevPortalContext.js → ZudokuContext.js} +2 -7
  85. package/dist/lib/core/ZudokuContext.js.map +1 -0
  86. package/dist/lib/core/plugins.d.ts +18 -12
  87. package/dist/lib/core/plugins.js.map +1 -1
  88. package/dist/lib/errors/ErrorAlert.js +1 -1
  89. package/dist/lib/errors/ErrorAlert.js.map +1 -1
  90. package/dist/lib/oas/graphql/index.js +4 -4
  91. package/dist/lib/oas/graphql/index.js.map +1 -1
  92. package/dist/lib/oas/parser/upgrade/index.js +3 -1
  93. package/dist/lib/oas/parser/upgrade/index.js.map +1 -1
  94. package/dist/lib/plugins/api-keys/index.d.ts +9 -9
  95. package/dist/lib/plugins/api-keys/index.js +3 -0
  96. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  97. package/dist/lib/plugins/custom-pages/index.d.ts +2 -2
  98. package/dist/lib/plugins/custom-pages/index.js.map +1 -1
  99. package/dist/lib/plugins/markdown/index.d.ts +2 -2
  100. package/dist/lib/plugins/markdown/index.js.map +1 -1
  101. package/dist/lib/plugins/openapi/CollapsibleCode.d.ts +5 -0
  102. package/dist/lib/plugins/openapi/CollapsibleCode.js +24 -0
  103. package/dist/lib/plugins/openapi/CollapsibleCode.js.map +1 -0
  104. package/dist/lib/plugins/openapi/ColorizedParam.js +13 -9
  105. package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
  106. package/dist/lib/plugins/openapi/Endpoint.d.ts +1 -1
  107. package/dist/lib/plugins/openapi/Endpoint.js +5 -9
  108. package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
  109. package/dist/lib/plugins/openapi/OperationList.d.ts +2 -2
  110. package/dist/lib/plugins/openapi/OperationList.js +21 -22
  111. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  112. package/dist/lib/plugins/openapi/ParameterListItem.js +6 -1
  113. package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
  114. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +7 -3
  115. package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  116. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +9 -2
  117. package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  118. package/dist/lib/plugins/openapi/Route.d.ts +4 -4
  119. package/dist/lib/plugins/openapi/Route.js +2 -4
  120. package/dist/lib/plugins/openapi/Route.js.map +1 -1
  121. package/dist/lib/plugins/openapi/Sidecar.d.ts +1 -1
  122. package/dist/lib/plugins/openapi/Sidecar.js +35 -33
  123. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  124. package/dist/lib/plugins/openapi/client/GraphQLClient.d.ts +8 -0
  125. package/dist/lib/plugins/openapi/client/GraphQLClient.js +102 -0
  126. package/dist/lib/plugins/openapi/client/GraphQLClient.js.map +1 -0
  127. package/dist/lib/plugins/openapi/client/GraphQLContext.d.ts +7 -0
  128. package/dist/lib/plugins/openapi/client/GraphQLContext.js +5 -0
  129. package/dist/lib/plugins/openapi/client/GraphQLContext.js.map +1 -0
  130. package/dist/lib/plugins/openapi/client/createServer.d.ts +1 -0
  131. package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +5 -0
  132. package/dist/lib/plugins/openapi/client/useCreateQuery.js +13 -0
  133. package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -0
  134. package/dist/lib/plugins/openapi/client/worker.d.ts +4 -1
  135. package/dist/lib/plugins/openapi/client/worker.js +23 -14
  136. package/dist/lib/plugins/openapi/client/worker.js.map +1 -1
  137. package/dist/lib/plugins/openapi/graphql/fragment-masking.d.ts +3 -3
  138. package/dist/lib/plugins/openapi/graphql/fragment-masking.js +3 -4
  139. package/dist/lib/plugins/openapi/graphql/fragment-masking.js.map +1 -1
  140. package/dist/lib/plugins/openapi/graphql/gql.d.ts +5 -51
  141. package/dist/lib/plugins/openapi/graphql/gql.js +4 -2
  142. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  143. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +32 -8
  144. package/dist/lib/plugins/openapi/graphql/graphql.js +194 -662
  145. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  146. package/dist/lib/plugins/openapi/index.d.ts +2 -2
  147. package/dist/lib/plugins/openapi/index.js +40 -53
  148. package/dist/lib/plugins/openapi/index.js.map +1 -1
  149. package/dist/lib/plugins/openapi/schema/SchemaView.js +2 -1
  150. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  151. package/dist/lib/plugins/openapi/util/generateSchemaExample.d.ts +0 -1
  152. package/dist/lib/plugins/openapi/util/generateSchemaExample.js +25 -36
  153. package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -1
  154. package/dist/lib/plugins/openapi-worker.d.ts +1 -1
  155. package/dist/lib/plugins/openapi-worker.js +7 -1
  156. package/dist/lib/plugins/openapi-worker.js.map +1 -1
  157. package/dist/lib/plugins/redirect/index.d.ts +4 -7
  158. package/dist/lib/plugins/redirect/index.js +1 -1
  159. package/dist/lib/plugins/redirect/index.js.map +1 -1
  160. package/dist/lib/plugins/search-inkeep/index.d.ts +2 -2
  161. package/dist/lib/plugins/search-inkeep/index.js.map +1 -1
  162. package/dist/lib/ui/ActionButton.d.ts +4 -0
  163. package/dist/lib/ui/ActionButton.js +10 -0
  164. package/dist/lib/ui/ActionButton.js.map +1 -0
  165. package/dist/lib/util/MdxComponents.d.ts +1 -1
  166. package/dist/lib/util/useIsomorphicLayoutEffect.d.ts +3 -0
  167. package/dist/lib/util/useIsomorphicLayoutEffect.js +4 -0
  168. package/dist/lib/util/useIsomorphicLayoutEffect.js.map +1 -0
  169. package/dist/lib/util/useOnScreen.d.ts +4 -0
  170. package/dist/lib/util/useOnScreen.js +19 -0
  171. package/dist/lib/util/useOnScreen.js.map +1 -0
  172. package/dist/vite/build.js +5 -1
  173. package/dist/vite/build.js.map +1 -1
  174. package/dist/vite/config.d.ts +2 -8
  175. package/dist/vite/config.js +13 -54
  176. package/dist/vite/config.js.map +1 -1
  177. package/dist/vite/html.js +0 -2
  178. package/dist/vite/html.js.map +1 -1
  179. package/dist/vite/output.d.ts +101 -0
  180. package/dist/vite/output.js +33 -0
  181. package/dist/vite/output.js.map +1 -0
  182. package/dist/vite/plugin-component.js +1 -1
  183. package/dist/vite/plugin-component.js.map +1 -1
  184. package/dist/vite/plugin-config.d.ts +2 -3
  185. package/dist/vite/plugin-config.js +2 -3
  186. package/dist/vite/plugin-config.js.map +1 -1
  187. package/dist/vite/plugin-mdx.d.ts +0 -6
  188. package/dist/vite/plugin-mdx.js +3 -2
  189. package/dist/vite/plugin-mdx.js.map +1 -1
  190. package/dist/vite/plugin.js +1 -3
  191. package/dist/vite/plugin.js.map +1 -1
  192. package/dist/vite/prerender.js +3 -2
  193. package/dist/vite/prerender.js.map +1 -1
  194. package/dist/vite/remarkStaticGeneration.d.ts +3 -0
  195. package/dist/vite/remarkStaticGeneration.js +125 -0
  196. package/dist/vite/remarkStaticGeneration.js.map +1 -0
  197. package/lib/{AnchorLink-BbB2q-jx.js → AnchorLink-CDlhr8gL.js} +11 -10
  198. package/lib/{AnchorLink-BbB2q-jx.js.map → AnchorLink-CDlhr8gL.js.map} +1 -1
  199. package/lib/AuthenticationPlugin-D0Em0SwR.js +59 -0
  200. package/lib/{AuthenticationPlugin-C9BHGXlE.js.map → AuthenticationPlugin-D0Em0SwR.js.map} +1 -1
  201. package/lib/Button-jK0EsymC.js +48 -0
  202. package/lib/Button-jK0EsymC.js.map +1 -0
  203. package/lib/{ClientOnly-CVN6leDu.js → ClientOnly-E7hGysn1.js} +4 -4
  204. package/lib/ClientOnly-E7hGysn1.js.map +1 -0
  205. package/lib/Markdown-ievDDhFT.js +15192 -0
  206. package/lib/Markdown-ievDDhFT.js.map +1 -0
  207. package/lib/{MdxPage-DKMH_t0f.js → MdxPage-Bwn-VSsH.js} +5 -5
  208. package/lib/{MdxPage-DKMH_t0f.js.map → MdxPage-Bwn-VSsH.js.map} +1 -1
  209. package/lib/OperationList-BwBl1xrD.js +4691 -0
  210. package/lib/OperationList-BwBl1xrD.js.map +1 -0
  211. package/lib/Route-DlG_HTMu.js +11 -0
  212. package/lib/Route-DlG_HTMu.js.map +1 -0
  213. package/lib/{Select-Bagt3Bme.js → Select-O9ZM3ZgX.js} +7 -7
  214. package/lib/Select-O9ZM3ZgX.js.map +1 -0
  215. package/lib/{Spinner-C6zroowC.js → SidebarBadge-DxFJcJ6V.js} +28 -17
  216. package/lib/SidebarBadge-DxFJcJ6V.js.map +1 -0
  217. package/lib/SlotletProvider-DyomlzGx.js +252 -0
  218. package/lib/SlotletProvider-DyomlzGx.js.map +1 -0
  219. package/lib/Spinner-3cQDBVGr.js +7 -0
  220. package/lib/Spinner-3cQDBVGr.js.map +1 -0
  221. package/lib/SyntaxHighlight-DkLOsjHS.js +2983 -0
  222. package/lib/SyntaxHighlight-DkLOsjHS.js.map +1 -0
  223. package/lib/assets/{worker-Bf8vjASY.js → worker-CPsGZsve.js} +565 -561
  224. package/lib/assets/{worker-Bf8vjASY.js.map → worker-CPsGZsve.js.map} +1 -1
  225. package/lib/context-D1nXWxm7.js +22 -0
  226. package/lib/context-D1nXWxm7.js.map +1 -0
  227. package/lib/createServer-DK-g7kbB.js +16089 -0
  228. package/lib/createServer-DK-g7kbB.js.map +1 -0
  229. package/lib/{hook-sn0zMTkE.js → hook-hEqe7fPB.js} +12 -14
  230. package/lib/hook-hEqe7fPB.js.map +1 -0
  231. package/lib/index-Czzd9rjU.js +899 -0
  232. package/lib/index-Czzd9rjU.js.map +1 -0
  233. package/lib/index-DNxQ_rCt.js +1273 -0
  234. package/lib/index-DNxQ_rCt.js.map +1 -0
  235. package/lib/index-Yn8c3UWE.js +921 -0
  236. package/lib/index-Yn8c3UWE.js.map +1 -0
  237. package/lib/{router-BsfSoK2j.js → router-lfyopgBI.js} +23 -23
  238. package/lib/{router-BsfSoK2j.js.map → router-lfyopgBI.js.map} +1 -1
  239. package/lib/state-tsXBLONe.js +203 -0
  240. package/lib/{state-CsuHT8ZO.js.map → state-tsXBLONe.js.map} +1 -1
  241. package/lib/ui/ActionButton.js +25 -0
  242. package/lib/ui/ActionButton.js.map +1 -0
  243. package/lib/useExposedProps-CTPtylCV.js +10 -0
  244. package/lib/{useExposedProps-ChOIUaS4.js.map → useExposedProps-CTPtylCV.js.map} +1 -1
  245. package/lib/{ZudokuContext-BKXGJTmu.js → utils-DcpDOncX.js} +242 -246
  246. package/lib/utils-DcpDOncX.js.map +1 -0
  247. package/lib/zudoku.auth-auth0.js +24 -18
  248. package/lib/zudoku.auth-auth0.js.map +1 -1
  249. package/lib/zudoku.auth-clerk.js +2 -2
  250. package/lib/zudoku.auth-openid.js +124 -138
  251. package/lib/zudoku.auth-openid.js.map +1 -1
  252. package/lib/zudoku.components.js +1291 -1119
  253. package/lib/zudoku.components.js.map +1 -1
  254. package/lib/zudoku.openapi-worker.js +10 -16336
  255. package/lib/zudoku.openapi-worker.js.map +1 -1
  256. package/lib/zudoku.plugin-api-keys.js +41 -39
  257. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  258. package/lib/zudoku.plugin-custom-pages.js +2 -2
  259. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  260. package/lib/zudoku.plugin-markdown.js +1 -1
  261. package/lib/zudoku.plugin-markdown.js.map +1 -1
  262. package/lib/zudoku.plugin-openapi.js +5 -9
  263. package/lib/zudoku.plugin-openapi.js.map +1 -1
  264. package/lib/zudoku.plugin-redirect.js +2 -2
  265. package/lib/zudoku.plugin-redirect.js.map +1 -1
  266. package/lib/zudoku.plugin-search-inkeep.js +1 -1
  267. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  268. package/package.json +15 -5
  269. package/src/app/demo.tsx +0 -3
  270. package/src/app/entry.client.tsx +14 -0
  271. package/src/app/entry.server.tsx +59 -53
  272. package/src/app/main.css +1 -1
  273. package/src/app/main.tsx +4 -4
  274. package/src/app/standalone.tsx +0 -3
  275. package/src/lib/authentication/AuthenticationPlugin.tsx +4 -1
  276. package/src/lib/authentication/authentication.ts +3 -3
  277. package/src/lib/authentication/hook.ts +1 -3
  278. package/src/lib/authentication/providers/auth0.tsx +17 -11
  279. package/src/lib/authentication/providers/openid.tsx +12 -30
  280. package/src/lib/authentication/state.ts +50 -9
  281. package/{LICENSE.md → src/lib/authentication/use-broadcast/LICENSE.md} +2 -2
  282. package/src/lib/authentication/use-broadcast/shared.ts +372 -0
  283. package/src/lib/authentication/use-broadcast/useBroadcast.ts +146 -0
  284. package/src/lib/components/Bootstrap.tsx +36 -14
  285. package/src/lib/components/ClientOnly.tsx +6 -3
  286. package/src/lib/components/DeveloperHint.tsx +6 -1
  287. package/src/lib/components/Header.tsx +68 -40
  288. package/src/lib/components/Layout.tsx +49 -37
  289. package/src/lib/components/MobileTopNavigation.tsx +15 -18
  290. package/src/lib/components/SyntaxHighlight.tsx +81 -46
  291. package/src/lib/components/ThemeSwitch.tsx +26 -0
  292. package/src/lib/components/TopNavigation.tsx +27 -19
  293. package/src/lib/components/Zudoku.tsx +108 -0
  294. package/src/lib/components/context/ZudokuContext.ts +11 -16
  295. package/src/lib/components/context/ZudokuProvider.tsx +2 -2
  296. package/src/lib/components/index.ts +2 -3
  297. package/src/lib/components/navigation/Sidebar.tsx +3 -3
  298. package/src/lib/components/navigation/utils.ts +2 -2
  299. package/src/lib/core/{DevPortalContext.ts → ZudokuContext.ts} +3 -11
  300. package/src/lib/core/plugins.ts +20 -16
  301. package/src/lib/errors/ErrorAlert.tsx +2 -1
  302. package/src/lib/oas/graphql/index.ts +4 -4
  303. package/src/lib/oas/parser/upgrade/index.ts +3 -1
  304. package/src/lib/plugins/api-keys/index.tsx +12 -9
  305. package/src/lib/plugins/custom-pages/index.tsx +2 -2
  306. package/src/lib/plugins/markdown/index.tsx +2 -2
  307. package/src/lib/plugins/openapi/CollapsibleCode.tsx +80 -0
  308. package/src/lib/plugins/openapi/ColorizedParam.tsx +23 -14
  309. package/src/lib/plugins/openapi/Endpoint.tsx +5 -10
  310. package/src/lib/plugins/openapi/OperationList.tsx +20 -40
  311. package/src/lib/plugins/openapi/ParameterListItem.tsx +37 -31
  312. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +18 -13
  313. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +17 -12
  314. package/src/lib/plugins/openapi/Route.tsx +11 -12
  315. package/src/lib/plugins/openapi/Sidecar.tsx +73 -59
  316. package/src/lib/plugins/openapi/client/GraphQLClient.tsx +140 -0
  317. package/src/lib/plugins/openapi/client/GraphQLContext.tsx +16 -0
  318. package/src/lib/plugins/openapi/client/createServer.ts +2 -0
  319. package/src/lib/plugins/openapi/client/useCreateQuery.ts +18 -0
  320. package/src/lib/plugins/openapi/client/worker.ts +38 -24
  321. package/src/lib/plugins/openapi/graphql/fragment-masking.ts +11 -18
  322. package/src/lib/plugins/openapi/graphql/gql.ts +10 -27
  323. package/src/lib/plugins/openapi/graphql/graphql.ts +233 -665
  324. package/src/lib/plugins/openapi/index.tsx +42 -67
  325. package/src/lib/plugins/openapi/schema/SchemaView.tsx +5 -2
  326. package/src/lib/plugins/openapi/util/generateSchemaExample.ts +28 -42
  327. package/src/lib/plugins/openapi-worker.ts +11 -1
  328. package/src/lib/plugins/redirect/index.tsx +5 -9
  329. package/src/lib/plugins/search-inkeep/index.tsx +2 -2
  330. package/src/lib/ui/ActionButton.tsx +28 -0
  331. package/src/lib/util/useIsomorphicLayoutEffect.ts +5 -0
  332. package/src/lib/util/useOnScreen.ts +32 -0
  333. package/dist/lib/components/DevPortal.js.map +0 -1
  334. package/dist/lib/components/context/ThemeContext.d.ts +0 -2
  335. package/dist/lib/components/context/ThemeContext.js +0 -7
  336. package/dist/lib/components/context/ThemeContext.js.map +0 -1
  337. package/dist/lib/components/context/ThemeProvider.d.ts +0 -4
  338. package/dist/lib/components/context/ThemeProvider.js +0 -23
  339. package/dist/lib/components/context/ThemeProvider.js.map +0 -1
  340. package/dist/lib/core/DevPortalContext.js.map +0 -1
  341. package/dist/lib/plugins/openapi/client/createMemoryClient.d.ts +0 -12
  342. package/dist/lib/plugins/openapi/client/createMemoryClient.js +0 -46
  343. package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +0 -1
  344. package/dist/lib/plugins/openapi/client/createWorkerClient.d.ts +0 -10
  345. package/dist/lib/plugins/openapi/client/createWorkerClient.js +0 -61
  346. package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +0 -1
  347. package/dist/lib/plugins/openapi/client/interfaces.d.ts +0 -4
  348. package/dist/lib/plugins/openapi/client/interfaces.js +0 -2
  349. package/dist/lib/plugins/openapi/client/interfaces.js.map +0 -1
  350. package/dist/lib/themeToggle.d.ts +0 -1
  351. package/dist/lib/themeToggle.js +0 -7
  352. package/dist/lib/themeToggle.js.map +0 -1
  353. package/dist/lib/util/createWaitForNotify.d.ts +0 -1
  354. package/dist/lib/util/createWaitForNotify.js +0 -15
  355. package/dist/lib/util/createWaitForNotify.js.map +0 -1
  356. package/dist/vite/plugin-html-transform.d.ts +0 -2
  357. package/dist/vite/plugin-html-transform.js +0 -15
  358. package/dist/vite/plugin-html-transform.js.map +0 -1
  359. package/lib/AuthenticationPlugin-C9BHGXlE.js +0 -55
  360. package/lib/ClientOnly-CVN6leDu.js.map +0 -1
  361. package/lib/DeveloperHint-DHdLXGHA.js +0 -16
  362. package/lib/DeveloperHint-DHdLXGHA.js.map +0 -1
  363. package/lib/Markdown-BDcCAWwm.js +0 -18059
  364. package/lib/Markdown-BDcCAWwm.js.map +0 -1
  365. package/lib/OperationList-Tj7ubW_t.js +0 -604
  366. package/lib/OperationList-Tj7ubW_t.js.map +0 -1
  367. package/lib/Route-C3DGB6OS.js +0 -13
  368. package/lib/Route-C3DGB6OS.js.map +0 -1
  369. package/lib/Select-Bagt3Bme.js.map +0 -1
  370. package/lib/SlotletProvider-Da7eFgd2.js +0 -241
  371. package/lib/SlotletProvider-Da7eFgd2.js.map +0 -1
  372. package/lib/Spinner-C6zroowC.js.map +0 -1
  373. package/lib/StaggeredRender-DDHSzQKE.js +0 -17
  374. package/lib/StaggeredRender-DDHSzQKE.js.map +0 -1
  375. package/lib/ZudokuContext-BKXGJTmu.js.map +0 -1
  376. package/lib/hook-sn0zMTkE.js.map +0 -1
  377. package/lib/index-AjWCJNGC.js +0 -5690
  378. package/lib/index-AjWCJNGC.js.map +0 -1
  379. package/lib/index-CRo94sKK.js +0 -1783
  380. package/lib/index-CRo94sKK.js.map +0 -1
  381. package/lib/state-CsuHT8ZO.js +0 -183
  382. package/lib/urql-core-KJnLL26g.js +0 -1455
  383. package/lib/urql-core-KJnLL26g.js.map +0 -1
  384. package/lib/useExposedProps-ChOIUaS4.js +0 -9
  385. package/src/lib/components/DevPortal.tsx +0 -111
  386. package/src/lib/components/context/ThemeContext.tsx +0 -8
  387. package/src/lib/components/context/ThemeProvider.tsx +0 -27
  388. package/src/lib/plugins/openapi/client/createMemoryClient.ts +0 -51
  389. package/src/lib/plugins/openapi/client/createWorkerClient.ts +0 -75
  390. package/src/lib/plugins/openapi/client/interfaces.ts +0 -5
  391. package/src/lib/themeToggle.ts +0 -7
  392. package/src/lib/util/createWaitForNotify.ts +0 -18
@@ -0,0 +1,108 @@
1
+ import { MDXProvider } from "@mdx-js/react";
2
+ import { Helmet } from "@zudoku/react-helmet-async";
3
+ import { ThemeProvider } from "next-themes";
4
+ import {
5
+ Fragment,
6
+ memo,
7
+ type PropsWithChildren,
8
+ useContext,
9
+ useEffect,
10
+ useMemo,
11
+ useState,
12
+ } from "react";
13
+ import { ErrorBoundary } from "react-error-boundary";
14
+ import { Outlet, useNavigation } from "react-router-dom";
15
+ import { hasHead, isMdxProviderPlugin } from "../core/plugins.js";
16
+ import { ZudokuContext, ZudokuContextOptions } from "../core/ZudokuContext.js";
17
+ import { TopLevelError } from "../errors/TopLevelError.js";
18
+ import { StaggeredRenderContext } from "../plugins/openapi/StaggeredRender.js";
19
+ import { MdxComponents } from "../util/MdxComponents.js";
20
+ import "../util/requestIdleCallbackPolyfill.js";
21
+ import {
22
+ ComponentsProvider,
23
+ DEFAULT_COMPONENTS,
24
+ } from "./context/ComponentsContext.js";
25
+ import { ViewportAnchorProvider } from "./context/ViewportAnchorContext.js";
26
+ import { ZudokuProvider } from "./context/ZudokuProvider.js";
27
+ import { SlotletProvider } from "./SlotletProvider.js";
28
+
29
+ const ZudokoInner = memo(
30
+ ({ children, ...props }: PropsWithChildren<ZudokuContextOptions>) => {
31
+ const components = useMemo(
32
+ () => ({ ...DEFAULT_COMPONENTS, ...props.overrides }),
33
+ [props.overrides],
34
+ );
35
+
36
+ const mdxComponents = useMemo(() => {
37
+ const componentsFromPlugins = (props.plugins ?? [])
38
+ .filter(isMdxProviderPlugin)
39
+ .flatMap((plugin) =>
40
+ plugin.getMdxComponents ? [plugin.getMdxComponents()] : [],
41
+ );
42
+
43
+ return {
44
+ ...componentsFromPlugins.reduce(
45
+ (acc, curr) => ({ ...acc, ...curr }),
46
+ {},
47
+ ),
48
+ ...MdxComponents,
49
+ ...props.mdx?.components,
50
+ };
51
+ }, [props.mdx?.components, props.plugins]);
52
+ const { stagger } = useContext(StaggeredRenderContext);
53
+ const [didNavigate, setDidNavigate] = useState(false);
54
+ const staggeredValue = useMemo(
55
+ () => (didNavigate ? { stagger: true } : { stagger }),
56
+ [stagger, didNavigate],
57
+ );
58
+ const navigation = useNavigation();
59
+
60
+ useEffect(() => {
61
+ if (didNavigate) {
62
+ return;
63
+ }
64
+ setDidNavigate(true);
65
+ }, [didNavigate, navigation.location]);
66
+
67
+ const [zudokuContext] = useState(() => new ZudokuContext(props));
68
+
69
+ const heads = props.plugins
70
+ ?.filter(hasHead)
71
+ // eslint-disable-next-line react/no-array-index-key
72
+ .map((plugin, i) => <Fragment key={i}>{plugin.getHead?.()}</Fragment>);
73
+
74
+ return (
75
+ <>
76
+ <Helmet>{heads}</Helmet>
77
+ <StaggeredRenderContext.Provider value={staggeredValue}>
78
+ <ZudokuProvider context={zudokuContext}>
79
+ <MDXProvider components={mdxComponents}>
80
+ <ThemeProvider attribute="class" disableTransitionOnChange>
81
+ <ComponentsProvider value={components}>
82
+ <SlotletProvider slotlets={props.slotlets}>
83
+ <ViewportAnchorProvider>
84
+ {children ?? <Outlet />}
85
+ </ViewportAnchorProvider>
86
+ </SlotletProvider>
87
+ </ComponentsProvider>
88
+ </ThemeProvider>
89
+ </MDXProvider>
90
+ </ZudokuProvider>
91
+ </StaggeredRenderContext.Provider>
92
+ </>
93
+ );
94
+ },
95
+ );
96
+
97
+ ZudokoInner.displayName = "ZudokoInner";
98
+
99
+ const Zudoku = (props: ZudokuContextOptions) => {
100
+ return (
101
+ <ErrorBoundary FallbackComponent={TopLevelError}>
102
+ <ZudokoInner {...props} />
103
+ </ErrorBoundary>
104
+ );
105
+ };
106
+ Zudoku.displayName = "Zudoku";
107
+
108
+ export { Zudoku };
@@ -1,11 +1,11 @@
1
1
  import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
2
2
  import { createContext, useContext } from "react";
3
3
  import { matchPath, useLocation } from "react-router-dom";
4
- import { DevPortalContext } from "../../core/DevPortalContext.js";
4
+ import { ZudokuContext } from "../../core/ZudokuContext.js";
5
5
  import { joinPath } from "../../util/joinPath.js";
6
6
  import { traverseSidebar } from "../navigation/utils.js";
7
7
 
8
- export const ZudokuReactContext = createContext<DevPortalContext | undefined>(
8
+ export const ZudokuReactContext = createContext<ZudokuContext | undefined>(
9
9
  undefined,
10
10
  );
11
11
 
@@ -13,7 +13,7 @@ export const useZudoku = () => {
13
13
  const context = useContext(ZudokuReactContext);
14
14
 
15
15
  if (!context) {
16
- throw new Error("useDevPortal must be used within a DevPortalProvider.");
16
+ throw new Error("useZudoku must be used within a ZudokuProvider.");
17
17
  }
18
18
 
19
19
  return context;
@@ -49,18 +49,13 @@ export const useCurrentNavigation = () => {
49
49
  topNavigation.find((t) => t.id === currentSidebarItem?.[0]) ??
50
50
  topNavigation.find((item) => matchPath(item.id, location.pathname));
51
51
 
52
- return useSuspenseQuery({
53
- queryFn: async () => {
54
- const pluginSidebar = await getPluginSidebar(location.pathname);
55
-
56
- return {
57
- sidebar: [
58
- ...(currentSidebarItem ? currentSidebarItem[1] : []),
59
- ...pluginSidebar,
60
- ],
61
- topNavItem: currentTopNavItem,
62
- };
63
- },
64
- queryKey: ["navigation", location.pathname],
52
+ const { data } = useSuspenseQuery({
53
+ queryFn: () => getPluginSidebar(location.pathname),
54
+ queryKey: ["plugin-sidebar", location.pathname],
65
55
  });
56
+
57
+ return {
58
+ sidebar: [...(currentSidebarItem ? currentSidebarItem[1] : []), ...data],
59
+ topNavItem: currentTopNavItem,
60
+ };
66
61
  };
@@ -1,12 +1,12 @@
1
1
  import { useSuspenseQuery } from "@tanstack/react-query";
2
2
  import type { PropsWithChildren } from "react";
3
- import { DevPortalContext } from "../../core/DevPortalContext.js";
3
+ import { ZudokuContext } from "../../core/ZudokuContext.js";
4
4
  import { ZudokuReactContext } from "./ZudokuContext.js";
5
5
 
6
6
  export const ZudokuProvider = ({
7
7
  children,
8
8
  context,
9
- }: PropsWithChildren<{ context: DevPortalContext }>) => {
9
+ }: PropsWithChildren<{ context: ZudokuContext }>) => {
10
10
  useSuspenseQuery({
11
11
  queryFn: async () => {
12
12
  await context.initialize();
@@ -11,11 +11,10 @@ import {
11
11
  BootstrapStatic as BootstrapStaticImport,
12
12
  } from "./Bootstrap.js";
13
13
  import { ClientOnly as ClientOnlyImport } from "./ClientOnly.js";
14
- import { DevPortal as DevPortalImport } from "./DevPortal.js";
15
14
  import { Layout as LayoutImport } from "./Layout.js";
15
+ import { Zudoku as ZudokuImport } from "./Zudoku.js";
16
16
  import { useZudoku as useZudokuImport } from "./context/ZudokuContext.js";
17
17
  export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
18
- export const DevPortal = /*@__PURE__*/ DevPortalImport;
19
18
  export const Layout = /*@__PURE__*/ LayoutImport;
20
19
  export const RouterError = /*@__PURE__*/ RouterErrorImport;
21
20
  export const ServerError = /*@__PURE__*/ ServerErrorImport;
@@ -26,7 +25,7 @@ export const Head = /*@__PURE__*/ Helmet;
26
25
 
27
26
  export const useZudoku = /*@__PURE__*/ useZudokuImport;
28
27
  export const useAuth = /*@__PURE__*/ useAuthState;
29
- export const Zudoku = /*@__PURE__*/ DevPortalImport;
28
+ export const Zudoku = /*@__PURE__*/ ZudokuImport;
30
29
 
31
30
  export const Callout = /*@__PURE__*/ CalloutImport;
32
31
  export const ClientOnly = /*@__PURE__*/ ClientOnlyImport;
@@ -15,10 +15,10 @@ export const Sidebar = () => {
15
15
  <>
16
16
  <SidebarWrapper
17
17
  ref={navRef}
18
- pushMainContent={navigation.data.sidebar.length > 0}
18
+ pushMainContent={navigation.sidebar.length > 0}
19
19
  >
20
20
  <Slotlet name="zudoku-before-navigation" />
21
- {navigation.data.sidebar.map((item) => (
21
+ {navigation.sidebar.map((item) => (
22
22
  <SidebarItem key={item.label} item={item} />
23
23
  ))}
24
24
  <Slotlet name="zudoku-after-navigation" />
@@ -30,7 +30,7 @@ export const Sidebar = () => {
30
30
  <VisuallyHidden>
31
31
  <DrawerTitle>Sidebar</DrawerTitle>
32
32
  </VisuallyHidden>
33
- {navigation.data.sidebar.map((item) => (
33
+ {navigation.sidebar.map((item) => (
34
34
  <SidebarItem key={item.label} item={item} />
35
35
  ))}
36
36
  </DrawerContent>
@@ -44,7 +44,7 @@ export const useCurrentItem = () => {
44
44
  const location = useLocation();
45
45
  const nav = useCurrentNavigation();
46
46
 
47
- const currentSidebar = nav.data.sidebar;
47
+ const currentSidebar = nav.sidebar;
48
48
 
49
49
  return traverseSidebar(currentSidebar, (item) => {
50
50
  if (item.type === "doc" && joinPath(item.id) === location.pathname) {
@@ -79,7 +79,7 @@ export const usePrevNext = (): {
79
79
  } => {
80
80
  const currentId = useLocation().pathname;
81
81
  const nav = useCurrentNavigation();
82
- const currentSidebar = nav.data.sidebar;
82
+ const currentSidebar = nav.sidebar;
83
83
 
84
84
  let prev;
85
85
  let next;
@@ -1,4 +1,3 @@
1
- import { QueryClient } from "@tanstack/react-query";
2
1
  import { ReactNode } from "react";
3
2
  import type { SidebarConfig } from "../../config/validators/SidebarSchema.js";
4
3
  import { TopNavigationItem } from "../../config/validators/validate.js";
@@ -8,11 +7,11 @@ import { Slotlets } from "../components/SlotletProvider.js";
8
7
  import { joinPath } from "../util/joinPath.js";
9
8
  import type { MdxComponentsType } from "../util/MdxComponents.js";
10
9
  import {
11
- type DevPortalPlugin,
12
10
  isApiIdentityPlugin,
13
11
  isNavigationPlugin,
14
12
  type NavigationPlugin,
15
13
  needsInitialization,
14
+ type ZudokuPlugin,
16
15
  } from "./plugins.js";
17
16
 
18
17
  export interface ApiIdentity {
@@ -21,10 +20,7 @@ export interface ApiIdentity {
21
20
  id: string;
22
21
  }
23
22
 
24
- export const queryClient = new QueryClient();
25
-
26
23
  export type ApiKeyCache = "api-keys";
27
- export type DevPortalCacheKey = ApiKeyCache | string;
28
24
 
29
25
  type Metadata = Partial<{
30
26
  title: string;
@@ -63,7 +59,7 @@ export type ZudokuContextOptions = {
63
59
  authentication?: AuthenticationProvider;
64
60
  topNavigation?: TopNavigationItem[];
65
61
  sidebars?: SidebarConfig;
66
- plugins?: DevPortalPlugin[];
62
+ plugins?: ZudokuPlugin[];
67
63
  slotlets?: Slotlets;
68
64
  mdx?: {
69
65
  components?: MdxComponentsType;
@@ -71,7 +67,7 @@ export type ZudokuContextOptions = {
71
67
  overrides?: ComponentsContextType;
72
68
  };
73
69
 
74
- export class DevPortalContext {
70
+ export class ZudokuContext {
75
71
  public plugins: NonNullable<ZudokuContextOptions["plugins"]>;
76
72
  public sidebars: SidebarConfig;
77
73
  public topNavigation: NonNullable<ZudokuContextOptions["topNavigation"]>;
@@ -98,10 +94,6 @@ export class DevPortalContext {
98
94
  );
99
95
  };
100
96
 
101
- invalidateCache = async (key: DevPortalCacheKey[]) => {
102
- await queryClient.invalidateQueries({ queryKey: key });
103
- };
104
-
105
97
  getApiIdentities = async () => {
106
98
  const keys = await Promise.all(
107
99
  this.plugins
@@ -1,10 +1,11 @@
1
+ import type { LucideProps } from "lucide-react";
1
2
  import { type ReactElement } from "react";
2
3
  import { type RouteObject } from "react-router-dom";
3
4
  import type { Sidebar } from "../../config/validators/SidebarSchema.js";
4
5
  import { MdxComponentsType } from "../util/MdxComponents.js";
5
- import { DevPortalContext, type ApiIdentity } from "./DevPortalContext.js";
6
+ import { ZudokuContext, type ApiIdentity } from "./ZudokuContext.js";
6
7
 
7
- export type DevPortalPlugin =
8
+ export type ZudokuPlugin =
8
9
  | CommonPlugin
9
10
  | ProfileMenuPlugin
10
11
  | NavigationPlugin
@@ -19,7 +20,7 @@ export interface NavigationPlugin {
19
20
  }
20
21
 
21
22
  export interface ApiIdentityPlugin {
22
- getIdentities: (context: DevPortalContext) => Promise<ApiIdentity[]>;
23
+ getIdentities: (context: ZudokuContext) => Promise<ApiIdentity[]>;
23
24
  }
24
25
 
25
26
  export interface SearchProviderPlugin {
@@ -30,52 +31,55 @@ export interface SearchProviderPlugin {
30
31
  }
31
32
 
32
33
  export interface ProfileMenuPlugin {
33
- getProfileMenuItems: (context: DevPortalContext) => ProfileNavigationItem[];
34
+ getProfileMenuItems: (context: ZudokuContext) => ProfileNavigationItem[];
34
35
  }
35
36
 
36
37
  export type ProfileNavigationItem = {
37
38
  label: string;
38
39
  path?: string;
40
+ weight?: number;
41
+ category?: "top" | "middle" | "bottom";
39
42
  children?: ProfileNavigationItem[];
43
+ icon?: React.ComponentType<
44
+ LucideProps & {
45
+ [key: string]: any;
46
+ }
47
+ >;
40
48
  };
41
49
 
42
50
  export interface CommonPlugin {
43
51
  initialize?: (
44
- context: DevPortalContext,
52
+ context: ZudokuContext,
45
53
  ) => Promise<void | boolean> | void | boolean;
46
54
  getHead?: () => ReactElement | undefined;
47
55
  getMdxComponents?: () => MdxComponentsType;
48
56
  }
49
57
 
50
58
  export const isProfileMenuPlugin = (
51
- obj: DevPortalPlugin,
59
+ obj: ZudokuPlugin,
52
60
  ): obj is ProfileMenuPlugin =>
53
61
  "getProfileMenuItems" in obj && typeof obj.getProfileMenuItems === "function";
54
62
 
55
63
  export const isNavigationPlugin = (
56
- obj: DevPortalPlugin,
64
+ obj: ZudokuPlugin,
57
65
  ): obj is NavigationPlugin =>
58
66
  "getRoutes" in obj && typeof obj.getRoutes === "function";
59
67
 
60
68
  export const isSearchPlugin = (
61
- obj: DevPortalPlugin,
69
+ obj: ZudokuPlugin,
62
70
  ): obj is SearchProviderPlugin =>
63
71
  "renderSearch" in obj && typeof obj.renderSearch === "function";
64
72
 
65
- export const needsInitialization = (
66
- obj: DevPortalPlugin,
67
- ): obj is CommonPlugin =>
73
+ export const needsInitialization = (obj: ZudokuPlugin): obj is CommonPlugin =>
68
74
  "initialize" in obj && typeof obj.initialize === "function";
69
75
 
70
- export const hasHead = (obj: DevPortalPlugin): obj is CommonPlugin =>
76
+ export const hasHead = (obj: ZudokuPlugin): obj is CommonPlugin =>
71
77
  "getHead" in obj && typeof obj.getHead === "function";
72
78
 
73
- export const isMdxProviderPlugin = (
74
- obj: DevPortalPlugin,
75
- ): obj is CommonPlugin =>
79
+ export const isMdxProviderPlugin = (obj: ZudokuPlugin): obj is CommonPlugin =>
76
80
  "getMdxComponents" in obj && typeof obj.getMdxComponents === "function";
77
81
 
78
82
  export const isApiIdentityPlugin = (
79
- obj: DevPortalPlugin,
83
+ obj: ZudokuPlugin,
80
84
  ): obj is ApiIdentityPlugin =>
81
85
  "getIdentities" in obj && typeof obj.getIdentities === "function";
@@ -5,6 +5,7 @@ import { ZudokuError } from "../util/invariant.js";
5
5
  export function ErrorAlert({ error }: { error: unknown }) {
6
6
  const message =
7
7
  error instanceof Error ? error.message : "Something went wrong";
8
+
8
9
  const hint = error instanceof ZudokuError ? error.developerHint : undefined;
9
10
  const title =
10
11
  error instanceof ZudokuError ? error.title : "Something went wrong";
@@ -12,7 +13,7 @@ export function ErrorAlert({ error }: { error: unknown }) {
12
13
  const cause = error instanceof Error ? error.cause : undefined;
13
14
 
14
15
  return (
15
- <div className="flex h-screen max-h-screen min-h-full items-center justify-center bg-primary-background px-4 py-16 lg:px-8">
16
+ <div className="flex h-screen max-h-[calc(100vh-var(--header-height))] min-h-full items-center justify-center bg-primary-background px-4 py-16 lg:px-8">
16
17
  <div className="mx-auto max-w-[85%] sm:max-w-[50%]">
17
18
  <h1 className="text-4xl font-bold tracking-tight text-h1-text sm:text-5xl">
18
19
  {title}
@@ -206,7 +206,7 @@ const ExampleItem = builder
206
206
  name: t.exposeString("name"),
207
207
  summary: t.exposeString("summary", { nullable: true }),
208
208
  description: t.exposeString("description", { nullable: true }),
209
- value: t.exposeString("value", { nullable: true }),
209
+ value: t.expose("value", { type: JSONScalar, nullable: true }),
210
210
  externalValue: t.exposeString("externalValue", { nullable: true }),
211
211
  }),
212
212
  });
@@ -348,10 +348,10 @@ const OperationItem = builder
348
348
  statusCode,
349
349
  description: response.description,
350
350
  content: Object.entries(response.content ?? {}).map(
351
- ([mediaType, mediaTypeObject]) => ({
351
+ ([mediaType, { schema, examples }]) => ({
352
352
  mediaType,
353
- schema: mediaTypeObject.schema,
354
- examples: Object.entries(mediaTypeObject.examples ?? {}).map(
353
+ schema,
354
+ examples: Object.entries(examples ?? {}).map(
355
355
  ([name, value]) => ({ name, ...value }),
356
356
  ),
357
357
  }),
@@ -64,7 +64,9 @@ export const upgradeSchema = (schema: Record<string, any>): OpenAPIDocument => {
64
64
  schema = traverse(schema, (sub) => {
65
65
  if (sub.example !== undefined) {
66
66
  sub.examples = {
67
- default: sub.example,
67
+ default: {
68
+ value: sub.example,
69
+ },
68
70
  };
69
71
  delete sub.example;
70
72
  }
@@ -1,8 +1,9 @@
1
+ import { FileKey2Icon } from "lucide-react";
1
2
  import { type RouteObject } from "react-router-dom";
2
- import { DevPortalContext } from "../../core/DevPortalContext.js";
3
+ import { ZudokuContext } from "../../core/ZudokuContext.js";
3
4
  import {
4
5
  type ApiIdentityPlugin,
5
- type DevPortalPlugin,
6
+ type ZudokuPlugin,
6
7
  ProfileMenuPlugin,
7
8
  } from "../../core/plugins.js";
8
9
  import { RouterError } from "../../errors/RouterError.js";
@@ -15,17 +16,17 @@ const DEFAULT_API_KEY_ENDPOINT =
15
16
  "https://zudoku-rewiringamerica-main-ef9c9c0.d2.zuplo.dev";
16
17
 
17
18
  export type ApiKeyService = {
18
- getKeys: (context: DevPortalContext) => Promise<ApiKey[]>;
19
- rollKey?: (id: string, context: DevPortalContext) => Promise<void>;
20
- deleteKey?: (id: string, context: DevPortalContext) => Promise<void>;
19
+ getKeys: (context: ZudokuContext) => Promise<ApiKey[]>;
20
+ rollKey?: (id: string, context: ZudokuContext) => Promise<void>;
21
+ deleteKey?: (id: string, context: ZudokuContext) => Promise<void>;
21
22
  updateKeyDescription?: (
22
23
  apiKey: { id: string; description: string },
23
- context: DevPortalContext,
24
+ context: ZudokuContext,
24
25
  ) => Promise<void>;
25
- getUsage?: (apiKeys: string[], context: DevPortalContext) => Promise<void>;
26
+ getUsage?: (apiKeys: string[], context: ZudokuContext) => Promise<void>;
26
27
  createKey?: (
27
28
  apiKey: { description: string; expiresOn?: string },
28
- context: DevPortalContext,
29
+ context: ZudokuContext,
29
30
  ) => Promise<void>;
30
31
  };
31
32
 
@@ -93,7 +94,7 @@ const createDefaultHandler = (endpoint: string): ApiKeyService => {
93
94
 
94
95
  export const apiKeyPlugin = (
95
96
  options: ApiKeyPluginOptions,
96
- ): DevPortalPlugin & ApiIdentityPlugin & ProfileMenuPlugin => {
97
+ ): ZudokuPlugin & ApiIdentityPlugin & ProfileMenuPlugin => {
97
98
  const endpoint =
98
99
  "endpoint" in options ? options.endpoint : DEFAULT_API_KEY_ENDPOINT;
99
100
 
@@ -105,6 +106,8 @@ export const apiKeyPlugin = (
105
106
  {
106
107
  label: "API Keys",
107
108
  path: "/settings/api-keys",
109
+ category: "middle",
110
+ icon: FileKey2Icon,
108
111
  },
109
112
  ],
110
113
  getIdentities: async (context) => {
@@ -1,7 +1,7 @@
1
1
  import { type ComponentType, type ReactNode } from "react";
2
2
  import type { RouteObject } from "react-router-dom";
3
3
  import { type ExposedComponentProps } from "../../components/SlotletProvider.js";
4
- import type { DevPortalPlugin, NavigationPlugin } from "../../core/plugins.js";
4
+ import type { NavigationPlugin, ZudokuPlugin } from "../../core/plugins.js";
5
5
  import { CustomPage } from "./CustomPage.js";
6
6
 
7
7
  export type CustomPageConfig = {
@@ -13,7 +13,7 @@ export type CustomPageConfig = {
13
13
 
14
14
  export const customPagesPlugin = (
15
15
  config: CustomPageConfig[],
16
- ): DevPortalPlugin & NavigationPlugin => {
16
+ ): ZudokuPlugin & NavigationPlugin => {
17
17
  return {
18
18
  getRoutes: (): RouteObject[] =>
19
19
  config.map(({ path, ...props }) => ({
@@ -2,7 +2,7 @@ import type { Toc } from "@stefanprobst/rehype-extract-toc";
2
2
  import type { MDXProps } from "mdx/types.js";
3
3
  import { RouteObject } from "react-router-dom";
4
4
  import { ZudokuDocsConfig } from "../../../config/validators/validate.js";
5
- import type { DevPortalPlugin } from "../../core/plugins.js";
5
+ import type { ZudokuPlugin } from "../../core/plugins.js";
6
6
  import { DocResolver } from "./resolver.js";
7
7
 
8
8
  export interface MarkdownPluginOptions extends ZudokuDocsConfig {
@@ -29,7 +29,7 @@ export type MDXImport = {
29
29
 
30
30
  export const markdownPlugin = (
31
31
  options: MarkdownPluginOptions[],
32
- ): DevPortalPlugin => ({
32
+ ): ZudokuPlugin => ({
33
33
  getRoutes: () => {
34
34
  const routeMap = new Map<string, RouteObject>();
35
35
  options.forEach(({ fileImports, files, defaultOptions }) =>
@@ -0,0 +1,80 @@
1
+ import { type CSSProperties, type ReactNode, useRef, useState } from "react";
2
+ import { Button } from "zudoku/ui/Button.js";
3
+ import {
4
+ Collapsible,
5
+ CollapsibleContent,
6
+ CollapsibleTrigger,
7
+ } from "zudoku/ui/Collapsible.js";
8
+ import { cn } from "../../util/cn.js";
9
+ import useIsomorphicLayoutEffect from "../../util/useIsomorphicLayoutEffect.js";
10
+
11
+ export const CollapsibleCode = ({
12
+ children,
13
+ maxHeight = 250,
14
+ }: {
15
+ children: ReactNode;
16
+ maxHeight?: number;
17
+ }) => {
18
+ const contentRef = useRef<HTMLDivElement | null>(null);
19
+ const [isOverflowing, setIsOverflowing] = useState(false);
20
+ const [open, setOpen] = useState(false);
21
+
22
+ useIsomorphicLayoutEffect(() => {
23
+ const el = contentRef.current;
24
+ if (!el) return;
25
+
26
+ setIsOverflowing(el.scrollHeight > maxHeight);
27
+
28
+ const observer = new ResizeObserver(() => {
29
+ setIsOverflowing(el.scrollHeight > maxHeight);
30
+ });
31
+ observer.observe(el);
32
+
33
+ return () => observer.disconnect();
34
+ }, [maxHeight]);
35
+
36
+ return (
37
+ <Collapsible
38
+ className="group"
39
+ open={open}
40
+ onOpenChange={setOpen}
41
+ style={{ "--max-height": `${maxHeight}px` } as CSSProperties}
42
+ >
43
+ <CollapsibleContent
44
+ forceMount
45
+ className={cn(
46
+ "relative overflow-hidden",
47
+ !open && isOverflowing && "max-h-[--max-height]",
48
+ )}
49
+ >
50
+ {!open && isOverflowing && (
51
+ <div className="absolute inset-0 bg-gradient-to-b from-transparent to-zinc-50/90 dark:to-zinc-800/90 z-10"></div>
52
+ )}
53
+ <div ref={contentRef}>{children}</div>
54
+ {!open && isOverflowing && (
55
+ <CollapsibleTrigger
56
+ className="absolute inset-0 grid place-items-center z-10"
57
+ asChild
58
+ >
59
+ <div>
60
+ <Button className="bg-primary/70 border border-accent-foreground/25">
61
+ Expand code
62
+ </Button>
63
+ </div>
64
+ </CollapsibleTrigger>
65
+ )}
66
+ </CollapsibleContent>
67
+ {isOverflowing && (
68
+ <div
69
+ className={cn("flex justify-center w-full mb-2", !open && "hidden")}
70
+ >
71
+ <CollapsibleTrigger asChild>
72
+ <Button className="border border-accent-foreground/25">
73
+ Collapse code
74
+ </Button>
75
+ </CollapsibleTrigger>
76
+ </div>
77
+ )}
78
+ </Collapsible>
79
+ );
80
+ };