zudoku 0.0.0-fd0986c → 0.0.0-fdf886de

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 (407) hide show
  1. package/dist/app/demo.js +1 -1
  2. package/dist/app/entry.client.js +1 -1
  3. package/dist/app/entry.server.js +1 -1
  4. package/dist/app/main.d.ts +1 -1
  5. package/dist/app/main.js +12 -6
  6. package/dist/app/main.js.map +1 -1
  7. package/dist/app/standalone.js +1 -1
  8. package/dist/config/config.d.ts +1 -0
  9. package/dist/config/validators/InputNavigationSchema.d.ts +251 -156
  10. package/dist/config/validators/InputNavigationSchema.js +5 -4
  11. package/dist/config/validators/InputNavigationSchema.js.map +1 -1
  12. package/dist/config/validators/InputNavigationSchema.test-d.js +0 -1
  13. package/dist/config/validators/InputNavigationSchema.test-d.js.map +1 -1
  14. package/dist/config/validators/NavigationSchema.js +6 -3
  15. package/dist/config/validators/NavigationSchema.js.map +1 -1
  16. package/dist/config/validators/ProtectedRoutesSchema.d.ts +13 -0
  17. package/dist/config/validators/ProtectedRoutesSchema.js +10 -0
  18. package/dist/config/validators/ProtectedRoutesSchema.js.map +1 -0
  19. package/dist/config/validators/icon-types.d.ts +1 -1
  20. package/dist/config/validators/icon-types.js +16 -0
  21. package/dist/config/validators/icon-types.js.map +1 -1
  22. package/dist/config/validators/validate.d.ts +44 -30
  23. package/dist/config/validators/validate.js +8 -2
  24. package/dist/config/validators/validate.js.map +1 -1
  25. package/dist/flat-config.d.ts +11 -7
  26. package/dist/index.d.ts +1 -0
  27. package/dist/index.js +1 -0
  28. package/dist/index.js.map +1 -1
  29. package/dist/lib/authentication/components/CallbackHandler.js +11 -9
  30. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
  31. package/dist/lib/authentication/components/OAuthErrorPage.d.ts +3 -0
  32. package/dist/lib/authentication/components/OAuthErrorPage.js +99 -0
  33. package/dist/lib/authentication/components/OAuthErrorPage.js.map +1 -0
  34. package/dist/lib/authentication/errors.d.ts +6 -12
  35. package/dist/lib/authentication/errors.js +2 -1
  36. package/dist/lib/authentication/errors.js.map +1 -1
  37. package/dist/lib/authentication/hook.d.ts +1 -0
  38. package/dist/lib/authentication/hook.js.map +1 -1
  39. package/dist/lib/authentication/providers/azureb2c.js +4 -2
  40. package/dist/lib/authentication/providers/azureb2c.js.map +1 -1
  41. package/dist/lib/authentication/providers/clerk.js +4 -2
  42. package/dist/lib/authentication/providers/clerk.js.map +1 -1
  43. package/dist/lib/authentication/providers/openid.js +3 -1
  44. package/dist/lib/authentication/providers/openid.js.map +1 -1
  45. package/dist/lib/components/BuildCheck.d.ts +2 -1
  46. package/dist/lib/components/BuildCheck.js +9 -3
  47. package/dist/lib/components/BuildCheck.js.map +1 -1
  48. package/dist/lib/components/Header.js +1 -1
  49. package/dist/lib/components/Header.js.map +1 -1
  50. package/dist/lib/components/Heading.js +1 -1
  51. package/dist/lib/components/Heading.js.map +1 -1
  52. package/dist/lib/components/Layout.js +4 -7
  53. package/dist/lib/components/Layout.js.map +1 -1
  54. package/dist/lib/components/Markdown.js +2 -2
  55. package/dist/lib/components/Markdown.js.map +1 -1
  56. package/dist/lib/components/Meta.d.ts +2 -0
  57. package/dist/lib/components/Meta.js +11 -0
  58. package/dist/lib/components/Meta.js.map +1 -0
  59. package/dist/lib/components/MobileTopNavigation.js +5 -3
  60. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  61. package/dist/lib/components/NotFoundPage.js +1 -1
  62. package/dist/lib/components/NotFoundPage.js.map +1 -1
  63. package/dist/lib/components/TopNavigation.js +4 -3
  64. package/dist/lib/components/TopNavigation.js.map +1 -1
  65. package/dist/lib/components/Typography.d.ts +1 -1
  66. package/dist/lib/components/Typography.js +1 -1
  67. package/dist/lib/components/Typography.js.map +1 -1
  68. package/dist/lib/components/context/ZudokuContext.js +22 -14
  69. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  70. package/dist/lib/components/index.d.ts +0 -27
  71. package/dist/lib/components/index.js +0 -15
  72. package/dist/lib/components/index.js.map +1 -1
  73. package/dist/lib/components/navigation/NavigationCategory.js +1 -1
  74. package/dist/lib/components/navigation/NavigationCategory.js.map +1 -1
  75. package/dist/lib/components/navigation/NavigationItem.d.ts +1 -1
  76. package/dist/lib/components/navigation/NavigationItem.js +11 -3
  77. package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
  78. package/dist/lib/components/navigation/utils.d.ts +3 -1
  79. package/dist/lib/components/navigation/utils.js +18 -14
  80. package/dist/lib/components/navigation/utils.js.map +1 -1
  81. package/dist/lib/core/RouteGuard.js +9 -9
  82. package/dist/lib/core/RouteGuard.js.map +1 -1
  83. package/dist/lib/core/ZudokuContext.d.ts +5 -1
  84. package/dist/lib/core/ZudokuContext.js +23 -1
  85. package/dist/lib/core/ZudokuContext.js.map +1 -1
  86. package/dist/lib/core/__internal.d.ts +37 -0
  87. package/dist/lib/core/__internal.js +26 -0
  88. package/dist/lib/core/__internal.js.map +1 -0
  89. package/dist/lib/core/plugins.d.ts +2 -1
  90. package/dist/lib/core/plugins.js.map +1 -1
  91. package/dist/lib/core/router.d.ts +1 -0
  92. package/dist/lib/core/router.js +2 -0
  93. package/dist/lib/core/router.js.map +1 -0
  94. package/dist/lib/errors/ErrorAlert.js +1 -1
  95. package/dist/lib/errors/ErrorAlert.js.map +1 -1
  96. package/dist/lib/plugins/api-keys/CreateApiKey.js +13 -3
  97. package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
  98. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +3 -1
  99. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  100. package/dist/lib/plugins/api-keys/index.d.ts +9 -4
  101. package/dist/lib/plugins/api-keys/index.js +3 -7
  102. package/dist/lib/plugins/api-keys/index.js.map +1 -1
  103. package/dist/lib/plugins/custom-pages/index.js +3 -0
  104. package/dist/lib/plugins/custom-pages/index.js.map +1 -1
  105. package/dist/lib/plugins/openapi/Sidecar.js +1 -1
  106. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  107. package/dist/lib/plugins/openapi/SidecarExamples.js +1 -1
  108. package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
  109. package/dist/lib/plugins/openapi/graphql/gql.d.ts +1 -1
  110. package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
  111. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  112. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +1 -0
  113. package/dist/lib/plugins/openapi/graphql/graphql.js +1 -0
  114. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  115. package/dist/lib/plugins/openapi/index.js +42 -10
  116. package/dist/lib/plugins/openapi/index.js.map +1 -1
  117. package/dist/lib/plugins/openapi/playground/PathParams.js +1 -1
  118. package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
  119. package/dist/lib/plugins/openapi/playground/Playground.js +4 -2
  120. package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
  121. package/dist/lib/shiki.d.ts +4 -0
  122. package/dist/lib/shiki.js +2 -0
  123. package/dist/lib/shiki.js.map +1 -1
  124. package/dist/lib/ui/ActionButton.js +1 -1
  125. package/dist/lib/ui/ActionButton.js.map +1 -1
  126. package/dist/lib/ui/Badge.d.ts +1 -1
  127. package/dist/lib/ui/Button.d.ts +2 -2
  128. package/dist/lib/ui/CodeBlock.js +30 -4
  129. package/dist/lib/ui/CodeBlock.js.map +1 -1
  130. package/dist/lib/ui/Command.d.ts +1 -1
  131. package/dist/lib/ui/Dialog.js +2 -2
  132. package/dist/lib/ui/Dialog.js.map +1 -1
  133. package/dist/lib/ui/EmbeddedCodeBlock.js +1 -1
  134. package/dist/lib/ui/EmbeddedCodeBlock.js.map +1 -1
  135. package/dist/lib/util/invariant.d.ts +6 -5
  136. package/dist/lib/util/invariant.js +1 -1
  137. package/dist/lib/util/invariant.js.map +1 -1
  138. package/dist/vite/config.js +6 -1
  139. package/dist/vite/config.js.map +1 -1
  140. package/dist/vite/dev-server.js +9 -1
  141. package/dist/vite/dev-server.js.map +1 -1
  142. package/dist/vite/mdx/remark-inject-filepath.d.ts +3 -0
  143. package/dist/vite/mdx/remark-inject-filepath.js +6 -0
  144. package/dist/vite/mdx/remark-inject-filepath.js.map +1 -0
  145. package/dist/vite/mdx/remark-link-rewrite.d.ts +2 -0
  146. package/dist/vite/mdx/remark-link-rewrite.js +20 -0
  147. package/dist/vite/mdx/remark-link-rewrite.js.map +1 -0
  148. package/dist/vite/mdx/remark-normalize-image-url.d.ts +2 -0
  149. package/dist/vite/mdx/remark-normalize-image-url.js +12 -0
  150. package/dist/vite/mdx/remark-normalize-image-url.js.map +1 -0
  151. package/dist/vite/{remarkStaticGeneration.d.ts → mdx/remark-static-generation.d.ts} +2 -2
  152. package/dist/vite/{remarkStaticGeneration.js → mdx/remark-static-generation.js} +1 -1
  153. package/dist/vite/mdx/remark-static-generation.js.map +1 -0
  154. package/dist/vite/plugin-config.d.ts +1 -1
  155. package/dist/vite/plugin-config.js +2 -1
  156. package/dist/vite/plugin-config.js.map +1 -1
  157. package/dist/vite/plugin-docs.js +18 -13
  158. package/dist/vite/plugin-docs.js.map +1 -1
  159. package/dist/vite/plugin-mdx.js +6 -23
  160. package/dist/vite/plugin-mdx.js.map +1 -1
  161. package/dist/vite/plugin-theme.js +80 -40
  162. package/dist/vite/plugin-theme.js.map +1 -1
  163. package/dist/vite/prerender/worker.js +5 -1
  164. package/dist/vite/prerender/worker.js.map +1 -1
  165. package/dist/vite/shadcn-registry.d.ts +4 -4
  166. package/dist/vite/sitemap.js +10 -9
  167. package/dist/vite/sitemap.js.map +1 -1
  168. package/lib/Button-B3o-2Xdf.js.map +1 -1
  169. package/lib/Card-CMDQUPM4.js.map +1 -1
  170. package/lib/CategoryHeading-DCpZu3yG.js +17 -0
  171. package/lib/CategoryHeading-DCpZu3yG.js.map +1 -0
  172. package/lib/ClientOnly-E7hGysn1.js.map +1 -1
  173. package/lib/CodeBlock-yJjjRwj-.js +98 -0
  174. package/lib/CodeBlock-yJjjRwj-.js.map +1 -0
  175. package/lib/{Command-C9AC5cf-.js → Command-CDn17s8X.js} +2 -2
  176. package/lib/{Command-C9AC5cf-.js.map → Command-CDn17s8X.js.map} +1 -1
  177. package/lib/Dialog-BrIjMmUK.js +114 -0
  178. package/lib/Dialog-BrIjMmUK.js.map +1 -0
  179. package/lib/{Drawer-DXGPOKPx.js → Drawer-DJ05s2pH.js} +86 -86
  180. package/lib/{Drawer-DXGPOKPx.js.map → Drawer-DJ05s2pH.js.map} +1 -1
  181. package/lib/{MdxPage-BI0vLjSn.js → MdxPage-BmOQ5m5g.js} +19 -18
  182. package/lib/{MdxPage-BI0vLjSn.js.map → MdxPage-BmOQ5m5g.js.map} +1 -1
  183. package/lib/OAuthErrorPage-Jv3r8wnL.js +150 -0
  184. package/lib/OAuthErrorPage-Jv3r8wnL.js.map +1 -0
  185. package/lib/{OasProvider-CK4C2QI3.js → OasProvider-CA_lpILt.js} +3 -3
  186. package/lib/{OasProvider-CK4C2QI3.js.map → OasProvider-CA_lpILt.js.map} +1 -1
  187. package/lib/{OperationList-DhA6x6qm.js → OperationList-C-TObVw6.js} +47 -44
  188. package/lib/OperationList-C-TObVw6.js.map +1 -0
  189. package/lib/{Pagination-YjKVdgm9.js → Pagination-CBiRGddW.js} +3 -3
  190. package/lib/{Pagination-YjKVdgm9.js.map → Pagination-CBiRGddW.js.map} +1 -1
  191. package/lib/RouteGuard-JLH6tCY8.js +56 -0
  192. package/lib/RouteGuard-JLH6tCY8.js.map +1 -0
  193. package/lib/RouterError-DcVonMP1.js +41 -0
  194. package/lib/RouterError-DcVonMP1.js.map +1 -0
  195. package/lib/{SchemaList-Cx9MS7Wf.js → SchemaList-BeYWvBC7.js} +15 -14
  196. package/lib/{SchemaList-Cx9MS7Wf.js.map → SchemaList-BeYWvBC7.js.map} +1 -1
  197. package/lib/{SchemaView-C6sTKWyS.js → SchemaView-CRcShewo.js} +4 -4
  198. package/lib/{SchemaView-C6sTKWyS.js.map → SchemaView-CRcShewo.js.map} +1 -1
  199. package/lib/Select-C3efYI1n.js +273 -0
  200. package/lib/Select-C3efYI1n.js.map +1 -0
  201. package/lib/{SignUp-DiDmVb3x.js → SignUp-CxBGHgba.js} +6 -6
  202. package/lib/{SignUp-DiDmVb3x.js.map → SignUp-CxBGHgba.js.map} +1 -1
  203. package/lib/{Slot-CrCBhP3G.js → Slot-DOtTvoyj.js} +2050 -2288
  204. package/lib/{Slot-CrCBhP3G.js.map → Slot-DOtTvoyj.js.map} +1 -1
  205. package/lib/Spinner-mNLZ6awP.js.map +1 -1
  206. package/lib/{SyntaxHighlight-CVe58ZSY.js → SyntaxHighlight-GR0eix_L.js} +411 -409
  207. package/lib/SyntaxHighlight-GR0eix_L.js.map +1 -0
  208. package/lib/{Toc-CpsFSXeD.js → Toc-BlcGIkXc.js} +2 -2
  209. package/lib/{Toc-CpsFSXeD.js.map → Toc-BlcGIkXc.js.map} +1 -1
  210. package/lib/ZudokuContext-BuJD7yIX.js +1286 -0
  211. package/lib/ZudokuContext-BuJD7yIX.js.map +1 -0
  212. package/lib/chunk-QMGIS6GS-DqecZ6nq.js +9204 -0
  213. package/lib/chunk-QMGIS6GS-DqecZ6nq.js.map +1 -0
  214. package/lib/{circular-OvXQH6UK.js → circular-CGTcsqA3.js} +2 -2
  215. package/lib/{circular-OvXQH6UK.js.map → circular-CGTcsqA3.js.map} +1 -1
  216. package/lib/cn-dYga0KKN.js.map +1 -1
  217. package/lib/{createServer-B5U_8E3S.js → createServer-DjgpuLne.js} +5 -5
  218. package/lib/{createServer-B5U_8E3S.js.map → createServer-DjgpuLne.js.map} +1 -1
  219. package/lib/errors-CrI3s7mR.js +45 -0
  220. package/lib/errors-CrI3s7mR.js.map +1 -0
  221. package/lib/hook-bv3iuX7X.js +247 -0
  222. package/lib/hook-bv3iuX7X.js.map +1 -0
  223. package/lib/index-CrcNWbel.js.map +1 -1
  224. package/lib/{index-BzcS9JBW.js → index-CvTWnHZF.js} +860 -938
  225. package/lib/index-CvTWnHZF.js.map +1 -0
  226. package/lib/index-DI5SPFK9.js.map +1 -1
  227. package/lib/index-DmNq2fbN.js.map +1 -1
  228. package/lib/index-DzO-Qh6S.js +1061 -0
  229. package/lib/index-DzO-Qh6S.js.map +1 -0
  230. package/lib/{index-4XtG1tlD.js → index-HarEI51d.js} +2 -2
  231. package/lib/{index-4XtG1tlD.js.map → index-HarEI51d.js.map} +1 -1
  232. package/lib/index.esm-BnYHxCYC.js +683 -0
  233. package/lib/index.esm-BnYHxCYC.js.map +1 -0
  234. package/lib/index.esm-CdzlRw50.js +1254 -0
  235. package/lib/index.esm-CdzlRw50.js.map +1 -0
  236. package/lib/{invariant-DAFpPywt.js → invariant-Bm-FVUQE.js} +2 -6
  237. package/lib/invariant-Bm-FVUQE.js.map +1 -0
  238. package/lib/jsx-runtime-C5mzlN2N.js.map +1 -1
  239. package/lib/mutation-Dy_5up8v.js +196 -0
  240. package/lib/mutation-Dy_5up8v.js.map +1 -0
  241. package/lib/processors/removeExtensions.js.map +1 -1
  242. package/lib/processors/removeParameters.js.map +1 -1
  243. package/lib/processors/removePaths.js.map +1 -1
  244. package/lib/processors/traverse.js.map +1 -1
  245. package/lib/ui/Accordion.js.map +1 -1
  246. package/lib/ui/ActionButton.js +9 -9
  247. package/lib/ui/ActionButton.js.map +1 -1
  248. package/lib/ui/Alert.js.map +1 -1
  249. package/lib/ui/AlertDialog.js.map +1 -1
  250. package/lib/ui/Badge.js.map +1 -1
  251. package/lib/ui/Breadcrumb.js.map +1 -1
  252. package/lib/ui/Button.js.map +1 -1
  253. package/lib/ui/Callout.js.map +1 -1
  254. package/lib/ui/Card.js.map +1 -1
  255. package/lib/ui/Carousel.js.map +1 -1
  256. package/lib/ui/Checkbox.js.map +1 -1
  257. package/lib/ui/CodeBlock.js +1 -1
  258. package/lib/ui/Command.js +1 -1
  259. package/lib/ui/Command.js.map +1 -1
  260. package/lib/ui/Dialog.js +56 -41
  261. package/lib/ui/Dialog.js.map +1 -1
  262. package/lib/ui/Drawer.js +1 -1
  263. package/lib/ui/DropdownMenu.js.map +1 -1
  264. package/lib/ui/EmbeddedCodeBlock.js +1 -1
  265. package/lib/ui/EmbeddedCodeBlock.js.map +1 -1
  266. package/lib/ui/Form.js +1 -1
  267. package/lib/ui/Form.js.map +1 -1
  268. package/lib/ui/HoverCard.js.map +1 -1
  269. package/lib/ui/Input.js.map +1 -1
  270. package/lib/ui/Label.js.map +1 -1
  271. package/lib/ui/Pagination.js.map +1 -1
  272. package/lib/ui/Popover.js.map +1 -1
  273. package/lib/ui/Progress.js.map +1 -1
  274. package/lib/ui/RadioGroup.js.map +1 -1
  275. package/lib/ui/ScrollArea.js.map +1 -1
  276. package/lib/ui/Select.js.map +1 -1
  277. package/lib/ui/Skeleton.js.map +1 -1
  278. package/lib/ui/Slider.js.map +1 -1
  279. package/lib/ui/Stepper.js.map +1 -1
  280. package/lib/ui/Switch.js.map +1 -1
  281. package/lib/ui/SyntaxHighlight.js +4 -4
  282. package/lib/ui/Tabs.js.map +1 -1
  283. package/lib/ui/Textarea.js.map +1 -1
  284. package/lib/ui/Toggle.js.map +1 -1
  285. package/lib/ui/ToggleGroup.js.map +1 -1
  286. package/lib/ui/Tooltip.js.map +1 -1
  287. package/lib/useExposedProps-BH9aq4MD.js +113 -0
  288. package/lib/useExposedProps-BH9aq4MD.js.map +1 -0
  289. package/lib/useLatest-hmRS46UF.js +11 -0
  290. package/lib/useLatest-hmRS46UF.js.map +1 -0
  291. package/lib/zudoku.__internal.js +2965 -0
  292. package/lib/zudoku.__internal.js.map +1 -0
  293. package/lib/zudoku.auth-auth0.js +1 -1
  294. package/lib/zudoku.auth-auth0.js.map +1 -1
  295. package/lib/zudoku.auth-azureb2c.js +46 -9880
  296. package/lib/zudoku.auth-azureb2c.js.map +1 -1
  297. package/lib/zudoku.auth-clerk.js +25 -22
  298. package/lib/zudoku.auth-clerk.js.map +1 -1
  299. package/lib/zudoku.auth-openid.js +204 -195
  300. package/lib/zudoku.auth-openid.js.map +1 -1
  301. package/lib/zudoku.auth-supabase.js +97 -0
  302. package/lib/zudoku.auth-supabase.js.map +1 -0
  303. package/lib/zudoku.components.js +21 -28
  304. package/lib/zudoku.components.js.map +1 -1
  305. package/lib/zudoku.hooks.js +7 -7
  306. package/lib/zudoku.hooks.js.map +1 -1
  307. package/lib/zudoku.icons.js.map +1 -1
  308. package/lib/zudoku.plugin-api-catalog.js +23 -22
  309. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  310. package/lib/zudoku.plugin-api-keys.js +410 -295
  311. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  312. package/lib/zudoku.plugin-custom-pages.js +8 -5
  313. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  314. package/lib/zudoku.plugin-markdown.js +1 -1
  315. package/lib/zudoku.plugin-markdown.js.map +1 -1
  316. package/lib/zudoku.plugin-openapi.js +7 -6
  317. package/lib/zudoku.plugin-openapi.js.map +1 -1
  318. package/lib/zudoku.plugin-redirect.js +3 -3
  319. package/lib/zudoku.plugin-redirect.js.map +1 -1
  320. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  321. package/lib/zudoku.plugin-search-pagefind.js +28 -27
  322. package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
  323. package/lib/zudoku.plugins.js.map +1 -1
  324. package/lib/zudoku.router.js +123 -0
  325. package/lib/zudoku.router.js.map +1 -0
  326. package/package.json +31 -23
  327. package/src/app/demo.tsx +1 -1
  328. package/src/app/entry.client.tsx +1 -1
  329. package/src/app/entry.server.tsx +1 -1
  330. package/src/app/main.css +22 -5
  331. package/src/app/main.tsx +23 -11
  332. package/src/app/standalone.tsx +1 -1
  333. package/src/lib/authentication/components/CallbackHandler.tsx +22 -15
  334. package/src/lib/authentication/components/OAuthErrorPage.tsx +171 -0
  335. package/src/lib/authentication/errors.ts +27 -13
  336. package/src/lib/authentication/hook.ts +2 -0
  337. package/src/lib/authentication/providers/azureb2c.tsx +8 -3
  338. package/src/lib/authentication/providers/clerk.tsx +4 -1
  339. package/src/lib/authentication/providers/openid.tsx +7 -1
  340. package/src/lib/components/BuildCheck.tsx +13 -3
  341. package/src/lib/components/Header.tsx +4 -3
  342. package/src/lib/components/Heading.tsx +1 -1
  343. package/src/lib/components/Layout.tsx +2 -21
  344. package/src/lib/components/Markdown.tsx +3 -3
  345. package/src/lib/components/Meta.tsx +32 -0
  346. package/src/lib/components/MobileTopNavigation.tsx +6 -3
  347. package/src/lib/components/NotFoundPage.tsx +3 -2
  348. package/src/lib/components/TopNavigation.tsx +4 -4
  349. package/src/lib/components/Typography.tsx +1 -1
  350. package/src/lib/components/context/ZudokuContext.ts +26 -19
  351. package/src/lib/components/index.ts +0 -18
  352. package/src/lib/components/navigation/NavigationCategory.tsx +1 -1
  353. package/src/lib/components/navigation/NavigationItem.tsx +13 -3
  354. package/src/lib/components/navigation/utils.ts +21 -15
  355. package/src/lib/core/RouteGuard.tsx +13 -13
  356. package/src/lib/core/ZudokuContext.ts +37 -5
  357. package/src/lib/core/__internal.tsx +30 -0
  358. package/src/lib/core/plugins.ts +2 -1
  359. package/src/lib/core/router.ts +1 -0
  360. package/src/lib/errors/ErrorAlert.tsx +5 -7
  361. package/src/lib/plugins/api-keys/CreateApiKey.tsx +17 -3
  362. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +21 -3
  363. package/src/lib/plugins/api-keys/index.tsx +16 -11
  364. package/src/lib/plugins/custom-pages/index.tsx +3 -0
  365. package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
  366. package/src/lib/plugins/openapi/SidecarExamples.tsx +1 -1
  367. package/src/lib/plugins/openapi/graphql/gql.ts +3 -3
  368. package/src/lib/plugins/openapi/graphql/graphql.ts +2 -0
  369. package/src/lib/plugins/openapi/index.tsx +66 -16
  370. package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
  371. package/src/lib/plugins/openapi/playground/Playground.tsx +8 -2
  372. package/src/lib/shiki.ts +2 -0
  373. package/src/lib/ui/ActionButton.tsx +3 -1
  374. package/src/lib/ui/CodeBlock.tsx +38 -13
  375. package/src/lib/ui/Dialog.tsx +12 -3
  376. package/src/lib/ui/EmbeddedCodeBlock.tsx +1 -1
  377. package/src/lib/util/invariant.ts +7 -5
  378. package/src/shiki/langs/vue-vine.js +1 -0
  379. package/dist/vite/remarkStaticGeneration.js.map +0 -1
  380. package/lib/Alert-Cig_8hW6.js +0 -161
  381. package/lib/Alert-Cig_8hW6.js.map +0 -1
  382. package/lib/CodeBlock-BaBgX9Wy.js +0 -85
  383. package/lib/CodeBlock-BaBgX9Wy.js.map +0 -1
  384. package/lib/Dialog-DMWw1doX.js +0 -99
  385. package/lib/Dialog-DMWw1doX.js.map +0 -1
  386. package/lib/OperationList-DhA6x6qm.js.map +0 -1
  387. package/lib/RouteGuard-Vnlz_t51.js +0 -737
  388. package/lib/RouteGuard-Vnlz_t51.js.map +0 -1
  389. package/lib/SyntaxHighlight-CVe58ZSY.js.map +0 -1
  390. package/lib/chunk-DQRVZFIR-DHK7_Ilc.js +0 -1839
  391. package/lib/chunk-DQRVZFIR-DHK7_Ilc.js.map +0 -1
  392. package/lib/clerk-BDZ31hjU.js +0 -25190
  393. package/lib/clerk-BDZ31hjU.js.map +0 -1
  394. package/lib/errors-DOCWNkkS.js +0 -78
  395. package/lib/errors-DOCWNkkS.js.map +0 -1
  396. package/lib/hook-CZjW2buS.js +0 -1510
  397. package/lib/hook-CZjW2buS.js.map +0 -1
  398. package/lib/index-Bm35Tkgf.js +0 -107
  399. package/lib/index-Bm35Tkgf.js.map +0 -1
  400. package/lib/index-BzcS9JBW.js.map +0 -1
  401. package/lib/index-Sb7nQNHJ.js +0 -3980
  402. package/lib/index-Sb7nQNHJ.js.map +0 -1
  403. package/lib/index.esm-Cp4wkyud.js +0 -1236
  404. package/lib/index.esm-Cp4wkyud.js.map +0 -1
  405. package/lib/invariant-DAFpPywt.js.map +0 -1
  406. package/lib/useExposedProps-BIYjecPD.js +0 -9
  407. package/lib/useExposedProps-BIYjecPD.js.map +0 -1
@@ -20,12 +20,15 @@ import { ThemeSwitch } from "./ThemeSwitch.js";
20
20
  import { TopNavItem, TopNavLink } from "./TopNavigation.js";
21
21
 
22
22
  export const MobileTopNavigation = () => {
23
- const { navigation, options, getProfileMenuItems } = useZudoku();
24
- const { isAuthenticated, profile, isAuthEnabled, login } = useAuth();
23
+ const context = useZudoku();
24
+ const authState = useAuth();
25
+
26
+ const { navigation, options, getProfileMenuItems } = context;
27
+ const { isAuthenticated, profile, isAuthEnabled } = authState;
25
28
  const [drawerOpen, setDrawerOpen] = useState(false);
26
29
 
27
30
  const accountItems = getProfileMenuItems();
28
- const filteredItems = navigation.filter(isHiddenItem(isAuthenticated));
31
+ const filteredItems = navigation.filter(isHiddenItem(authState, context));
29
32
 
30
33
  return (
31
34
  <Drawer
@@ -18,9 +18,10 @@ export const NotFoundPage = () => {
18
18
  <DeveloperHint>
19
19
  Start by adding a file at{" "}
20
20
  <code>
21
- {"{PROJECT_ROOT}"}/{params["*"]}.mdx
21
+ {"{DOCUMENT_ROOT}"}/{params["*"]}.mdx
22
22
  </code>{" "}
23
- and add some content to make this error go away.
23
+ and add some content to make this error go away. By default{" "}
24
+ <code>DOCUMENT_ROOT</code> is the `pages` directory.
24
25
  </DeveloperHint>
25
26
  <p>
26
27
  It seems that the page you are looking for does not exist or may have
@@ -10,10 +10,10 @@ import { isHiddenItem, traverseNavigationItem } from "./navigation/utils.js";
10
10
  import { Slot } from "./Slot.js";
11
11
 
12
12
  export const TopNavigation = () => {
13
- const { navigation } = useZudoku();
14
- const { isAuthenticated } = useAuth();
15
-
16
- const filteredItems = navigation.filter(isHiddenItem(isAuthenticated));
13
+ const context = useZudoku();
14
+ const { navigation } = context;
15
+ const auth = useAuth();
16
+ const filteredItems = navigation.filter(isHiddenItem(auth, context));
17
17
 
18
18
  if (filteredItems.length === 0 || import.meta.env.MODE === "standalone") {
19
19
  return <style>{`:root { --top-nav-height: 0px; }`}</style>;
@@ -1,7 +1,7 @@
1
1
  import { cn } from "../util/cn.js";
2
2
 
3
3
  // other styles are defined in main.css .prose
4
- export const ProseClasses = "prose dark:prose-invert prose-neutral";
4
+ export const ProseClasses = "prose dark:prose-invert prose-neutral typography";
5
5
 
6
6
  export const Typography = ({
7
7
  children,
@@ -2,7 +2,6 @@ import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
2
2
  import { createContext, useContext } from "react";
3
3
  import { matchPath, useLocation } from "react-router";
4
4
  import { type NavigationItem } from "../../../config/validators/NavigationSchema.js";
5
- import { useAuth } from "../../authentication/hook.js";
6
5
  import type { ZudokuContext } from "../../core/ZudokuContext.js";
7
6
  import { joinUrl } from "../../util/joinUrl.js";
8
7
  import { CACHE_KEYS } from "../cache.js";
@@ -40,19 +39,33 @@ const getItemPath = (item: NavigationItem) => {
40
39
  case "link":
41
40
  return item.to;
42
41
  case "custom-page":
43
- return item.path;
42
+ return joinUrl(item.path);
44
43
  default:
45
44
  return undefined;
46
45
  }
47
46
  };
47
+
48
+ const extractAllPaths = (items: NavigationItem[]) => {
49
+ const paths = new Set<string>();
50
+
51
+ const collectPaths = (items: NavigationItem[]) => {
52
+ for (const item of items) {
53
+ const itemPath = getItemPath(item)?.split("?").at(0)?.split("#").at(0);
54
+
55
+ if (itemPath) paths.add(itemPath);
56
+ if (item.type === "category") {
57
+ collectPaths(item.items);
58
+ }
59
+ }
60
+ };
61
+ collectPaths(items);
62
+
63
+ return [...paths];
64
+ };
65
+
48
66
  export const useCurrentNavigation = () => {
49
- const { getPluginNavigation, navigation, options } = useZudoku();
67
+ const { getPluginNavigation, navigation } = useZudoku();
50
68
  const location = useLocation();
51
- const auth = useAuth();
52
-
53
- const isProtectedRoute = options.protectedRoutes?.some((route) =>
54
- matchPath(route, location.pathname),
55
- );
56
69
 
57
70
  const navItem = traverseNavigation(navigation, (item, parentCategories) => {
58
71
  if (getItemPath(item) === location.pathname) {
@@ -67,12 +80,8 @@ export const useCurrentNavigation = () => {
67
80
 
68
81
  let topNavItem = navItem;
69
82
  if (!navItem && data.length > 0) {
70
- // Extract base paths from plugin navigation items
71
- const pluginBasePaths = data.flatMap((item) => {
72
- return getItemPath(item)?.split("?").at(0)?.split("#").at(0) ?? [];
73
- });
83
+ const pluginBasePaths = extractAllPaths(data);
74
84
 
75
- // Find top-level nav item that matches any plugin base path
76
85
  topNavItem = navigation
77
86
  .flatMap((item) => {
78
87
  const itemPath = getItemPath(item);
@@ -88,13 +97,11 @@ export const useCurrentNavigation = () => {
88
97
  })?.item;
89
98
  }
90
99
 
91
- const hasNavigation =
92
- auth.isAuthEnabled && !auth.isAuthenticated && isProtectedRoute;
93
-
94
100
  return {
95
- navigation: hasNavigation
96
- ? []
97
- : [...(navItem?.type === "category" ? navItem.items : []), ...data],
101
+ navigation: [
102
+ ...(navItem?.type === "category" ? navItem.items : []),
103
+ ...data,
104
+ ],
98
105
  topNavItem,
99
106
  };
100
107
  };
@@ -3,44 +3,26 @@ import { Helmet } from "@zudoku/react-helmet-async";
3
3
  import { useTheme as useThemeImport } from "next-themes";
4
4
  import { Link as LinkImport } from "react-router";
5
5
  import { useAuth as useAuthImport } from "../authentication/hook.js";
6
- import { RouteGuard as RouteGuardImport } from "../core/RouteGuard.js";
7
- import { RouterError as RouterErrorImport } from "../errors/RouterError.js";
8
- import { ServerError as ServerErrorImport } from "../errors/ServerError.js";
9
6
  import { Button as ButtonImport } from "../ui/Button.js";
10
7
  import { Callout as CalloutImport } from "../ui/Callout.js";
11
- import {
12
- Bootstrap as BootstrapImport,
13
- BootstrapStatic as BootstrapStaticImport,
14
- } from "./Bootstrap.js";
15
- import { BuildCheck as BuildCheckImport } from "./BuildCheck.js";
16
8
  import {
17
9
  CACHE_KEYS as CACHE_KEYS_IMPORT,
18
10
  useCache as useCacheImport,
19
11
  } from "./cache.js";
20
12
  import { ClientOnly as ClientOnlyImport } from "./ClientOnly.js";
21
13
  import { useZudoku as useZudokuImport } from "./context/ZudokuContext.js";
22
- import { Layout as LayoutImport } from "./Layout.js";
23
14
  import { Markdown as MarkdownImport } from "./Markdown.js";
24
15
  import { Spinner as SpinnerImport } from "./Spinner.js";
25
- import { StatusPage as StatusPageImport } from "./StatusPage.js";
26
16
  import { Typography as TypographyImport } from "./Typography.js";
27
17
  import { Zudoku as ZudokuImport } from "./Zudoku.js";
28
18
 
29
- export const Layout = /*@__PURE__*/ LayoutImport;
30
- export const RouterError = /*@__PURE__*/ RouterErrorImport;
31
- export const ServerError = /*@__PURE__*/ ServerErrorImport;
32
- export const Bootstrap = /*@__PURE__*/ BootstrapImport;
33
- export const BootstrapStatic = /*@__PURE__*/ BootstrapStaticImport;
34
- export const RouteGuard = /*@__PURE__*/ RouteGuardImport;
35
19
  export const Head = /*@__PURE__*/ Helmet;
36
- export const StatusPage = /*@__PURE__*/ StatusPageImport;
37
20
  export const Callout = /*@__PURE__*/ CalloutImport;
38
21
  export const Markdown = /*@__PURE__*/ MarkdownImport;
39
22
  export const Spinner = /*@__PURE__*/ SpinnerImport;
40
23
  export const ClientOnly = /*@__PURE__*/ ClientOnlyImport;
41
24
  export const Button = /*@__PURE__*/ ButtonImport;
42
25
  export const Link = /*@__PURE__*/ LinkImport;
43
- export const BuildCheck = /*@__PURE__*/ BuildCheckImport;
44
26
  export const Zudoku = /*@__PURE__*/ ZudokuImport;
45
27
  export const Typography = /*@__PURE__*/ TypographyImport;
46
28
 
@@ -46,7 +46,7 @@ const NavigationCategoryInner = ({
46
46
  }}
47
47
  variant="ghost"
48
48
  size="icon"
49
- className="size-6 hover:bg-[hsl(from_hsl(var(--accent))_h_s_calc(l-5))] hover:dark:bg-[hsl(from_hsl(var(--accent))_h_s_calc(l+5))]"
49
+ className="size-6 hover:bg-[hsl(from_var(--accent)_h_s_calc(l+6*var(--dark)))]"
50
50
  >
51
51
  <ChevronRightIcon
52
52
  size={16}
@@ -9,13 +9,15 @@ import {
9
9
  TooltipTrigger,
10
10
  } from "zudoku/ui/Tooltip.js";
11
11
  import type { NavigationItem as NavigationItemType } from "../../../config/validators/NavigationSchema.js";
12
+ import { useAuth } from "../../authentication/hook.js";
12
13
  import { cn } from "../../util/cn.js";
13
14
  import { joinUrl } from "../../util/joinUrl.js";
14
15
  import { AnchorLink } from "../AnchorLink.js";
15
16
  import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
17
+ import { useZudoku } from "../context/ZudokuContext.js";
16
18
  import { NavigationBadge } from "./NavigationBadge.js";
17
19
  import { NavigationCategory } from "./NavigationCategory.js";
18
- import { navigationListItem } from "./utils.js";
20
+ import { isHiddenItem, navigationListItem } from "./utils.js";
19
21
 
20
22
  const TruncatedLabel = ({
21
23
  label,
@@ -74,6 +76,12 @@ export const NavigationItem = ({
74
76
  }) => {
75
77
  const location = useLocation();
76
78
  const { activeAnchor } = useViewportAnchor();
79
+ const auth = useAuth();
80
+ const context = useZudoku();
81
+
82
+ if (!isHiddenItem(auth, context)(item)) {
83
+ return null;
84
+ }
77
85
 
78
86
  switch (item.type) {
79
87
  case "category":
@@ -106,7 +114,7 @@ export const NavigationItem = ({
106
114
  );
107
115
  case "link":
108
116
  case "custom-page": {
109
- const href = item.type === "link" ? item.to : item.path;
117
+ const href = item.type === "link" ? item.to : joinUrl(item.path);
110
118
  return !href.startsWith("http") ? (
111
119
  <AnchorLink
112
120
  to={{
@@ -116,7 +124,9 @@ export const NavigationItem = ({
116
124
  }}
117
125
  {...{ [DATA_ANCHOR_ATTR]: href.split("#")[1] }}
118
126
  className={navigationListItem({
119
- isActive: href === [location.pathname, activeAnchor].join("#"),
127
+ isActive:
128
+ href ===
129
+ [location.pathname, activeAnchor].filter(Boolean).join("#"),
120
130
  })}
121
131
  onClick={onRequestClose}
122
132
  >
@@ -4,6 +4,8 @@ import type {
4
4
  NavigationCategory,
5
5
  NavigationItem,
6
6
  } from "../../../config/validators/NavigationSchema.js";
7
+ import type { UseAuthReturn } from "../../authentication/hook.js";
8
+ import type { ZudokuContext } from "../../core/ZudokuContext.js";
7
9
  import { joinUrl } from "../../util/joinUrl.js";
8
10
  import { useCurrentNavigation } from "../context/ZudokuContext.js";
9
11
 
@@ -56,18 +58,18 @@ export const useIsCategoryOpen = (category: NavigationCategory) => {
56
58
  const location = useLocation();
57
59
 
58
60
  return traverseNavigationItem(category, (item) => {
59
- if (item.type === "category" && item.link) {
60
- const categoryLinkPath = joinUrl(item.link.path);
61
- if (categoryLinkPath === location.pathname) {
62
- return true;
63
- }
64
- }
65
-
66
- if (item.type === "doc") {
67
- const docPath = joinUrl(item.path);
68
- if (docPath === location.pathname) {
69
- return true;
70
- }
61
+ switch (item.type) {
62
+ case "category":
63
+ if (!item.link) {
64
+ return undefined;
65
+ }
66
+ return joinUrl(item.link.path) === location.pathname ? true : undefined;
67
+ case "custom-page":
68
+ case "doc":
69
+ return joinUrl(item.path) === location.pathname ? true : undefined;
70
+ case "link":
71
+ default:
72
+ return undefined;
71
73
  }
72
74
  });
73
75
  };
@@ -133,14 +135,18 @@ export const navigationListItem = cva(
133
135
  );
134
136
 
135
137
  export const isHiddenItem =
136
- (isAuthenticated?: boolean) =>
138
+ (auth: UseAuthReturn, context: ZudokuContext) =>
137
139
  (item: NavigationItem): boolean => {
140
+ if (typeof item.display === "function") {
141
+ return item.display({ context, auth });
142
+ }
143
+
138
144
  if (item.display === "hide") return false;
139
145
  if (!item.label) return false;
140
146
 
141
147
  return (
142
- (item.display === "auth" && isAuthenticated) ||
143
- (item.display === "anon" && !isAuthenticated) ||
148
+ (item.display === "auth" && auth.isAuthenticated) ||
149
+ (item.display === "anon" && !auth.isAuthenticated) ||
144
150
  !item.display ||
145
151
  item.display === "always"
146
152
  );
@@ -24,14 +24,18 @@ export const RouteGuard = () => {
24
24
  const location = useLocation();
25
25
  const latestPath = useLatest(location.pathname);
26
26
  const shouldBypass = use(BypassProtectedRoutesContext);
27
+ const { protectedRoutes } = zudoku.options;
27
28
 
28
- const { protectedRoutes = [] } = zudoku.options;
29
+ const authCheckFn =
30
+ !shouldBypass && protectedRoutes
31
+ ? Object.entries(protectedRoutes).find(([path]) =>
32
+ matchPath({ path, end: true }, location.pathname),
33
+ )?.[1]
34
+ : undefined;
29
35
 
30
- const isProtected =
31
- !shouldBypass &&
32
- protectedRoutes.some((path) =>
33
- matchPath({ path, end: true }, location.pathname),
34
- );
36
+ const isProtectedRoute = authCheckFn !== undefined;
37
+ const needsToSignIn =
38
+ isProtectedRoute && !authCheckFn({ auth, context: zudoku });
35
39
 
36
40
  useQuery({
37
41
  queryKey: ["login-redirect"],
@@ -42,14 +46,10 @@ export const RouteGuard = () => {
42
46
  });
43
47
  return true;
44
48
  },
45
- enabled:
46
- typeof window !== "undefined" &&
47
- isProtected &&
48
- !auth.isPending &&
49
- !auth.isAuthenticated,
49
+ enabled: typeof window !== "undefined" && needsToSignIn && !auth.isPending,
50
50
  });
51
51
 
52
- if (isProtected && !auth.isAuthenticated) {
52
+ if (needsToSignIn) {
53
53
  return (
54
54
  <Dialog
55
55
  open={true}
@@ -71,7 +71,7 @@ export const RouteGuard = () => {
71
71
  );
72
72
  }
73
73
 
74
- if (isProtected && !auth.isAuthEnabled) {
74
+ if (isProtectedRoute && !auth.isAuthEnabled) {
75
75
  throw new ZudokuError("Authentication is not enabled", {
76
76
  title: "Authentication is not enabled",
77
77
  developerHint:
@@ -5,6 +5,10 @@ import type { Location } from "react-router";
5
5
  import type { BundledTheme, HighlighterCore } from "shiki";
6
6
  import type { z } from "zod/v4";
7
7
  import type { Navigation } from "../../config/validators/NavigationSchema.js";
8
+ import type {
9
+ CallbackContext,
10
+ ProtectedRoutesInput,
11
+ } from "../../config/validators/ProtectedRoutesSchema.js";
8
12
  import type { FooterSchema } from "../../config/validators/validate.js";
9
13
  import type { AuthenticationPlugin } from "../authentication/authentication.js";
10
14
  import { type AuthState, useAuthState } from "../authentication/state.js";
@@ -44,6 +48,7 @@ export type ApiKeyCache = "api-keys";
44
48
 
45
49
  type Metadata = Partial<{
46
50
  title: string;
51
+ defaultTitle?: string;
47
52
  description: string;
48
53
  logo: string;
49
54
  favicon: string;
@@ -67,6 +72,7 @@ type Site = Partial<{
67
72
  };
68
73
  width?: string | number;
69
74
  alt?: string;
75
+ href?: string;
70
76
  };
71
77
  banner?: {
72
78
  message: ReactNode;
@@ -93,13 +99,30 @@ export type ZudokuContextOptions = {
93
99
  components?: MdxComponentsType;
94
100
  };
95
101
  overrides?: ComponentsContextType;
96
- protectedRoutes?: string[];
102
+ protectedRoutes?: ProtectedRoutesInput;
97
103
  syntaxHighlighting?: {
98
104
  highlighter: HighlighterCore;
99
105
  themes?: { light: BundledTheme; dark: BundledTheme };
100
106
  };
101
107
  };
102
108
 
109
+ export const transformProtectedRoutes = (
110
+ val: ProtectedRoutesInput,
111
+ ): Record<string, (c: CallbackContext) => boolean> | undefined => {
112
+ if (!val) return undefined;
113
+
114
+ if (Array.isArray(val)) {
115
+ return Object.fromEntries(
116
+ val.map((route) => [
117
+ route,
118
+ (c: CallbackContext) => c.auth.isAuthenticated,
119
+ ]),
120
+ );
121
+ }
122
+
123
+ return val;
124
+ };
125
+
103
126
  export class ZudokuContext {
104
127
  public plugins: NonNullable<ZudokuContextOptions["plugins"]>;
105
128
  public navigation: Navigation;
@@ -112,12 +135,21 @@ export class ZudokuContext {
112
135
  private emitter = createNanoEvents<ZudokuEvents>();
113
136
 
114
137
  constructor(options: ZudokuContextOptions, queryClient: QueryClient) {
115
- const protectedRoutes = (options.protectedRoutes ?? []).concat(
116
- options.plugins?.flatMap((plugin) =>
117
- isNavigationPlugin(plugin) ? (plugin.getProtectedRoutes?.() ?? []) : [],
118
- ) ?? [],
138
+ const pluginProtectedRoutes = Object.fromEntries(
139
+ (options.plugins ?? []).flatMap((plugin) => {
140
+ if (!isNavigationPlugin(plugin)) return [];
141
+ const routes = plugin.getProtectedRoutes?.();
142
+ if (!routes) return [];
143
+
144
+ return Object.entries(transformProtectedRoutes(routes) ?? {});
145
+ }),
119
146
  );
120
147
 
148
+ const protectedRoutes = {
149
+ ...pluginProtectedRoutes,
150
+ ...transformProtectedRoutes(options.protectedRoutes),
151
+ };
152
+
121
153
  this.queryClient = queryClient;
122
154
  this.options = { ...options, protectedRoutes };
123
155
  this.plugins = options.plugins ?? [];
@@ -0,0 +1,30 @@
1
+ /**
2
+ * ⚠️
3
+ * These are re-exports consumed from the main entry point in `src/app/main.tsx`
4
+ * This is to ensure that they share the exact same context in React.
5
+ * ⚠️
6
+ **/
7
+
8
+ import { Helmet } from "@zudoku/react-helmet-async";
9
+ import {
10
+ Bootstrap as BootstrapImport,
11
+ BootstrapStatic as BootstrapStaticImport,
12
+ } from "../components/Bootstrap.js";
13
+ import { BuildCheck as BuildCheckImport } from "../components/BuildCheck.js";
14
+ import { Layout as LayoutImport } from "../components/Layout.js";
15
+ import { Meta as MetaImport } from "../components/Meta.js";
16
+ import { StatusPage as StatusPageImport } from "../components/StatusPage.js";
17
+ import { RouterError as RouterErrorImport } from "../errors/RouterError.js";
18
+ import { ServerError as ServerErrorImport } from "../errors/ServerError.js";
19
+ import { RouteGuard as RouteGuardImport } from "./RouteGuard.js";
20
+
21
+ export const Layout = LayoutImport;
22
+ export const RouterError = RouterErrorImport;
23
+ export const ServerError = ServerErrorImport;
24
+ export const Bootstrap = BootstrapImport;
25
+ export const BootstrapStatic = BootstrapStaticImport;
26
+ export const RouteGuard = RouteGuardImport;
27
+ export const Head = Helmet;
28
+ export const StatusPage = StatusPageImport;
29
+ export const BuildCheck = BuildCheckImport;
30
+ export const Meta = MetaImport;
@@ -2,6 +2,7 @@ import type { LucideIcon } from "lucide-react";
2
2
  import type { ReactElement } from "react";
3
3
  import type { Location, RouteObject } from "react-router";
4
4
  import type { Navigation } from "../../config/validators/NavigationSchema.js";
5
+ import type { ProtectedRoutesInput } from "../../config/validators/ProtectedRoutesSchema.js";
5
6
  import type { AuthenticationPlugin } from "../authentication/authentication.js";
6
7
  import type { MdxComponentsType } from "../util/MdxComponents.js";
7
8
  import type {
@@ -24,7 +25,7 @@ export type { AuthenticationPlugin, RouteObject };
24
25
  export interface NavigationPlugin {
25
26
  getRoutes: () => RouteObject[];
26
27
  getNavigation?: (path: string, context: ZudokuContext) => Promise<Navigation>;
27
- getProtectedRoutes?: () => string[];
28
+ getProtectedRoutes?: () => ProtectedRoutesInput;
28
29
  }
29
30
 
30
31
  export const createApiIdentityPlugin = (
@@ -0,0 +1 @@
1
+ export * from "react-router";
@@ -23,13 +23,11 @@ export function ErrorAlert({ error }: { error: unknown }) {
23
23
  Error: {message}
24
24
  {hint && <DeveloperHint className="mb-4">{hint}</DeveloperHint>}
25
25
  {stringError && (
26
- <div>
27
- <SyntaxHighlight
28
- className="max-h-[400px] border mt-2"
29
- language="js"
30
- code={stringError}
31
- />
32
- </div>
26
+ <SyntaxHighlight
27
+ className="max-h-[400px] [&>pre]:p-4"
28
+ language="js"
29
+ code={stringError}
30
+ />
33
31
  )}
34
32
  </Typography>
35
33
  );
@@ -2,6 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
2
2
  import { useForm } from "react-hook-form";
3
3
  import { useNavigate } from "react-router";
4
4
  import { ActionButton } from "zudoku/ui/ActionButton.js";
5
+ import { Alert, AlertDescription, AlertTitle } from "zudoku/ui/Alert.js";
5
6
  import { DialogClose, DialogFooter } from "zudoku/ui/Dialog.js";
6
7
  import {
7
8
  Select,
@@ -12,6 +13,7 @@ import {
12
13
  SelectValue,
13
14
  } from "zudoku/ui/Select.js";
14
15
  import { useZudoku } from "../../components/context/ZudokuContext.js";
16
+ import { useAuth } from "../../hooks/index.js";
15
17
  import { Button } from "../../ui/Button.js";
16
18
  import { Input } from "../../ui/Input.js";
17
19
  import { type ApiKeyService } from "./index.js";
@@ -33,6 +35,8 @@ export const CreateApiKey = ({
33
35
  expiresOn: "30",
34
36
  },
35
37
  });
38
+ const auth = useAuth();
39
+
36
40
  const createKeyMutation = useMutation({
37
41
  mutationFn: ({ description, expiresOn }: CreateApiKey) => {
38
42
  if (!service.createKey) {
@@ -42,10 +46,14 @@ export const CreateApiKey = ({
42
46
  const expiresOnDate =
43
47
  expiresOn !== "never" ? addDaysToDate(Number(expiresOn)) : undefined;
44
48
 
45
- return service.createKey(
46
- { description: description || "Secret Key", expiresOn: expiresOnDate },
49
+ return service.createKey({
50
+ apiKey: {
51
+ description: description || "Secret Key",
52
+ expiresOn: expiresOnDate,
53
+ },
47
54
  context,
48
- );
55
+ auth,
56
+ });
49
57
  },
50
58
  onSuccess: async () => {
51
59
  await queryClient.invalidateQueries({ queryKey: ["api-keys"] });
@@ -68,6 +76,12 @@ export const CreateApiKey = ({
68
76
  ),
69
77
  )}
70
78
  >
79
+ {createKeyMutation.error && (
80
+ <Alert variant="destructive" className="mb-4">
81
+ <AlertTitle>Error</AlertTitle>
82
+ <AlertDescription>{createKeyMutation.error.message}</AlertDescription>
83
+ </Alert>
84
+ )}
71
85
  <div className="flex gap-2 flex-col text-sm font-medium">
72
86
  Name
73
87
  <Input {...form.register("description")} />
@@ -35,6 +35,7 @@ import { Button } from "../../ui/Button.js";
35
35
  import { Input } from "../../ui/Input.js";
36
36
  import { cn } from "../../util/cn.js";
37
37
  import { useCopyToClipboard } from "../../util/useCopyToClipboard.js";
38
+ import { CreateApiKey } from "./CreateApiKey.js";
38
39
  import { type ApiConsumer, type ApiKey, type ApiKeyService } from "./index.js";
39
40
 
40
41
  export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
@@ -50,6 +51,8 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
50
51
  retry: false,
51
52
  });
52
53
 
54
+ const [isCreateApiKeyOpen, setIsCreateApiKeyOpen] = useState(false);
55
+
53
56
  const deleteKeyMutation = useMutation({
54
57
  mutationFn: ({
55
58
  consumerId,
@@ -181,10 +184,25 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
181
184
 
182
185
  <div className="flex justify-between pb-3">
183
186
  <h1 className="font-medium text-2xl">API Keys</h1>
187
+
184
188
  {service.createKey && (
185
- <Button asChild>
186
- <Link to="/settings/api-keys/new">Create API Key</Link>
187
- </Button>
189
+ <Dialog
190
+ open={isCreateApiKeyOpen}
191
+ onOpenChange={setIsCreateApiKeyOpen}
192
+ >
193
+ <DialogTrigger asChild>
194
+ <Button variant="outline">Create API Key</Button>
195
+ </DialogTrigger>
196
+ <DialogContent>
197
+ <DialogHeader>
198
+ <DialogTitle>Create API Key</DialogTitle>
199
+ </DialogHeader>
200
+ <CreateApiKey
201
+ service={service}
202
+ onOpenChange={setIsCreateApiKeyOpen}
203
+ />
204
+ </DialogContent>
205
+ </Dialog>
188
206
  )}
189
207
  </div>
190
208
  <p>Create, manage, and monitor your API keys</p>