zudoku 0.0.0-e88b02e → 0.0.0-e8a949d

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 (435) hide show
  1. package/dist/app/demo.js +1 -1
  2. package/dist/app/demo.js.map +1 -1
  3. package/dist/app/entry.client.js +1 -15
  4. package/dist/app/entry.client.js.map +1 -1
  5. package/dist/app/entry.server.js +1 -2
  6. package/dist/app/entry.server.js.map +1 -1
  7. package/dist/app/main.d.ts +1 -1
  8. package/dist/app/sentry.js +1 -1
  9. package/dist/app/sentry.js.map +1 -1
  10. package/dist/app/standalone.js +1 -1
  11. package/dist/app/standalone.js.map +1 -1
  12. package/dist/cli/cli.js +0 -2
  13. package/dist/cli/cli.js.map +1 -1
  14. package/dist/cli/cmds/build.js +1 -0
  15. package/dist/cli/cmds/build.js.map +1 -1
  16. package/dist/cli/cmds/dev.js +5 -0
  17. package/dist/cli/cmds/dev.js.map +1 -1
  18. package/dist/cli/dev/handler.d.ts +1 -0
  19. package/dist/cli/dev/handler.js +1 -1
  20. package/dist/cli/dev/handler.js.map +1 -1
  21. package/dist/config/loader.d.ts +9 -1
  22. package/dist/config/loader.js +44 -7
  23. package/dist/config/loader.js.map +1 -1
  24. package/dist/config/validators/common.d.ts +186 -152
  25. package/dist/config/validators/common.js +6 -2
  26. package/dist/config/validators/common.js.map +1 -1
  27. package/dist/config/validators/icon-types.d.ts +1 -1
  28. package/dist/config/validators/validate.d.ts +123 -109
  29. package/dist/lib/authentication/components/CallbackHandler.js +1 -1
  30. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
  31. package/dist/lib/authentication/components/SignIn.js +1 -1
  32. package/dist/lib/authentication/components/SignIn.js.map +1 -1
  33. package/dist/lib/authentication/components/SignOut.js +1 -1
  34. package/dist/lib/authentication/components/SignOut.js.map +1 -1
  35. package/dist/lib/authentication/providers/openid.d.ts +7 -0
  36. package/dist/lib/authentication/providers/openid.js +1 -0
  37. package/dist/lib/authentication/providers/openid.js.map +1 -1
  38. package/dist/lib/components/AnchorLink.d.ts +1 -1
  39. package/dist/lib/components/AnchorLink.js +1 -1
  40. package/dist/lib/components/AnchorLink.js.map +1 -1
  41. package/dist/lib/components/Bootstrap.d.ts +1 -2
  42. package/dist/lib/components/Bootstrap.js +3 -3
  43. package/dist/lib/components/Bootstrap.js.map +1 -1
  44. package/dist/lib/components/Header.js +2 -2
  45. package/dist/lib/components/Header.js.map +1 -1
  46. package/dist/lib/components/Layout.js +2 -2
  47. package/dist/lib/components/Layout.js.map +1 -1
  48. package/dist/lib/components/Markdown.js +1 -1
  49. package/dist/lib/components/Markdown.js.map +1 -1
  50. package/dist/lib/components/MobileTopNavigation.js +1 -1
  51. package/dist/lib/components/NotFoundPage.js +1 -1
  52. package/dist/lib/components/NotFoundPage.js.map +1 -1
  53. package/dist/lib/components/ReactMarkdown.d.ts +29 -0
  54. package/dist/lib/components/ReactMarkdown.js +182 -0
  55. package/dist/lib/components/ReactMarkdown.js.map +1 -0
  56. package/dist/lib/components/SlotletProvider.d.ts +2 -2
  57. package/dist/lib/components/TopNavigation.js +1 -1
  58. package/dist/lib/components/TopNavigation.js.map +1 -1
  59. package/dist/lib/components/Zudoku.js +1 -1
  60. package/dist/lib/components/Zudoku.js.map +1 -1
  61. package/dist/lib/components/context/ZudokuContext.js +1 -1
  62. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  63. package/dist/lib/components/index.d.ts +20 -16
  64. package/dist/lib/components/index.js +7 -3
  65. package/dist/lib/components/index.js.map +1 -1
  66. package/dist/lib/components/navigation/Sidebar.js +1 -1
  67. package/dist/lib/components/navigation/SidebarBadge.d.ts +0 -9
  68. package/dist/lib/components/navigation/SidebarBadge.js +0 -9
  69. package/dist/lib/components/navigation/SidebarBadge.js.map +1 -1
  70. package/dist/lib/components/navigation/SidebarCategory.js +1 -1
  71. package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
  72. package/dist/lib/components/navigation/SidebarItem.js +1 -1
  73. package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
  74. package/dist/lib/components/navigation/utils.js +1 -1
  75. package/dist/lib/components/navigation/utils.js.map +1 -1
  76. package/dist/lib/core/plugins.d.ts +3 -5
  77. package/dist/lib/core/plugins.js.map +1 -1
  78. package/dist/lib/errors/RouterError.js +1 -1
  79. package/dist/lib/errors/RouterError.js.map +1 -1
  80. package/dist/lib/oas/parser/dereference/index.d.ts +1 -0
  81. package/dist/lib/oas/parser/dereference/index.js +6 -3
  82. package/dist/lib/oas/parser/dereference/index.js.map +1 -1
  83. package/dist/lib/plugins/api-catalog/Catalog.d.ts +2 -6
  84. package/dist/lib/plugins/api-catalog/Catalog.js +22 -15
  85. package/dist/lib/plugins/api-catalog/Catalog.js.map +1 -1
  86. package/dist/lib/plugins/api-catalog/index.d.ts +8 -1
  87. package/dist/lib/plugins/api-catalog/index.js +2 -2
  88. package/dist/lib/plugins/api-catalog/index.js.map +1 -1
  89. package/dist/lib/plugins/api-keys/CreateApiKey.js +1 -1
  90. package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
  91. package/dist/lib/plugins/api-keys/ProtectedRoute.js +1 -1
  92. package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -1
  93. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +1 -1
  94. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  95. package/dist/lib/plugins/markdown/MdxPage.js +1 -1
  96. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  97. package/dist/lib/plugins/markdown/index.d.ts +1 -0
  98. package/dist/lib/plugins/markdown/index.js.map +1 -1
  99. package/dist/lib/plugins/openapi/OperationList.js +10 -34
  100. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  101. package/dist/lib/plugins/openapi/OperationListItem.d.ts +2 -1
  102. package/dist/lib/plugins/openapi/OperationListItem.js +14 -4
  103. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  104. package/dist/lib/plugins/openapi/Route.d.ts +4 -2
  105. package/dist/lib/plugins/openapi/Route.js +22 -2
  106. package/dist/lib/plugins/openapi/Route.js.map +1 -1
  107. package/dist/lib/plugins/openapi/Sidecar.js +3 -13
  108. package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
  109. package/dist/lib/plugins/openapi/client/useCreateQuery.js +10 -1
  110. package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -1
  111. package/dist/lib/plugins/openapi/context.d.ts +3 -3
  112. package/dist/lib/plugins/openapi/index.js +18 -17
  113. package/dist/lib/plugins/openapi/index.js.map +1 -1
  114. package/dist/lib/plugins/openapi/interfaces.d.ts +19 -0
  115. package/dist/lib/plugins/openapi/schema/SchemaComponents.js +7 -1
  116. package/dist/lib/plugins/openapi/schema/SchemaComponents.js.map +1 -1
  117. package/dist/lib/plugins/openapi/util/methodToColor.d.ts +20 -0
  118. package/dist/lib/plugins/openapi/util/methodToColor.js +24 -0
  119. package/dist/lib/plugins/openapi/util/methodToColor.js.map +1 -0
  120. package/dist/lib/plugins/openapi/util/sanitizeMarkdownForMetatag.d.ts +1 -0
  121. package/dist/lib/plugins/openapi/util/sanitizeMarkdownForMetatag.js +27 -0
  122. package/dist/lib/plugins/openapi/util/sanitizeMarkdownForMetatag.js.map +1 -0
  123. package/dist/lib/plugins/redirect/index.js +1 -1
  124. package/dist/lib/plugins/redirect/index.js.map +1 -1
  125. package/dist/lib/plugins/search-inkeep/index.d.ts +22 -3
  126. package/dist/lib/plugins/search-inkeep/index.js +41 -5
  127. package/dist/lib/plugins/search-inkeep/index.js.map +1 -1
  128. package/dist/lib/plugins/search-inkeep/inkeep.d.ts +3 -4
  129. package/dist/lib/plugins/search-inkeep/inkeep.js.map +1 -1
  130. package/dist/lib/util/MdxComponents.d.ts +16 -16
  131. package/dist/lib/util/MdxComponents.js +1 -3
  132. package/dist/lib/util/MdxComponents.js.map +1 -1
  133. package/dist/lib/util/createVariantComponent.d.ts +2 -2
  134. package/dist/lib/util/useExposedProps.js +1 -1
  135. package/dist/lib/util/useExposedProps.js.map +1 -1
  136. package/dist/lib/util/useOnScreen.d.ts +1 -1
  137. package/dist/lib/util/useScrollToAnchor.js +1 -1
  138. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  139. package/dist/lib/util/useScrollToTop.js +1 -1
  140. package/dist/lib/util/useScrollToTop.js.map +1 -1
  141. package/dist/vite/build.js +4 -1
  142. package/dist/vite/build.js.map +1 -1
  143. package/dist/vite/config.d.ts +5 -1
  144. package/dist/vite/config.js +50 -25
  145. package/dist/vite/config.js.map +1 -1
  146. package/dist/vite/config.test.js +4 -1
  147. package/dist/vite/config.test.js.map +1 -1
  148. package/dist/vite/css/collect.d.ts +2 -0
  149. package/dist/vite/css/collect.js +27 -0
  150. package/dist/vite/css/collect.js.map +1 -0
  151. package/dist/vite/css/plugin.d.ts +5 -0
  152. package/dist/vite/css/plugin.js +79 -0
  153. package/dist/vite/css/plugin.js.map +1 -0
  154. package/dist/vite/dev-server.d.ts +1 -0
  155. package/dist/vite/dev-server.js +16 -6
  156. package/dist/vite/dev-server.js.map +1 -1
  157. package/dist/vite/plugin-api.js +52 -19
  158. package/dist/vite/plugin-api.js.map +1 -1
  159. package/dist/vite/plugin-mdx.js +2 -0
  160. package/dist/vite/plugin-mdx.js.map +1 -1
  161. package/dist/vite/plugin-theme-css.js +53 -1
  162. package/dist/vite/plugin-theme-css.js.map +1 -1
  163. package/dist/vite/plugin.js +4 -0
  164. package/dist/vite/plugin.js.map +1 -1
  165. package/lib/{AnchorLink-BR0MvI7n.js → AnchorLink-DFZZbmvr.js} +13 -14
  166. package/lib/AnchorLink-DFZZbmvr.js.map +1 -0
  167. package/lib/{AuthenticationPlugin-D0Em0SwR.js → AuthenticationPlugin-DVLEc6cm.js} +15 -16
  168. package/lib/AuthenticationPlugin-DVLEc6cm.js.map +1 -0
  169. package/lib/{Button-jK0EsymC.js → Button-DeAoTouo.js} +4 -4
  170. package/lib/{Button-jK0EsymC.js.map → Button-DeAoTouo.js.map} +1 -1
  171. package/lib/{CategoryHeading-Bb9dqxD3.js → CategoryHeading-CBconmtI.js} +3 -3
  172. package/lib/{CategoryHeading-Bb9dqxD3.js.map → CategoryHeading-CBconmtI.js.map} +1 -1
  173. package/lib/ClientOnly-E7hGysn1.js.map +1 -1
  174. package/lib/{Dialog-k70Qfukb.js → Dialog-Bxv1yEIg.js} +3 -3
  175. package/lib/{Dialog-k70Qfukb.js.map → Dialog-Bxv1yEIg.js.map} +1 -1
  176. package/lib/{Markdown-CdkU5HcM.js → Markdown-CZDLNOFc.js} +13235 -13225
  177. package/lib/Markdown-CZDLNOFc.js.map +1 -0
  178. package/lib/{MdxPage-ChziqNPp.js → MdxPage-DKMbBROv.js} +25 -25
  179. package/lib/MdxPage-DKMbBROv.js.map +1 -0
  180. package/lib/OperationList-CqLL5P5l.js +5068 -0
  181. package/lib/OperationList-CqLL5P5l.js.map +1 -0
  182. package/lib/Route-DYwKZ_c_.js +35 -0
  183. package/lib/Route-DYwKZ_c_.js.map +1 -0
  184. package/lib/{Select-O9ZM3ZgX.js → Select-B_IxRUUC.js} +5 -5
  185. package/lib/{Select-O9ZM3ZgX.js.map → Select-B_IxRUUC.js.map} +1 -1
  186. package/lib/SlotletProvider-pfc9oejW.js +221 -0
  187. package/lib/SlotletProvider-pfc9oejW.js.map +1 -0
  188. package/lib/{Spinner-3cQDBVGr.js → Spinner-DuxJLLNE.js} +2 -2
  189. package/lib/{Spinner-3cQDBVGr.js.map → Spinner-DuxJLLNE.js.map} +1 -1
  190. package/lib/StaggeredRender-DgsamH_G.js +17 -0
  191. package/lib/StaggeredRender-DgsamH_G.js.map +1 -0
  192. package/lib/{SyntaxHighlight-C31iouiO.js → SyntaxHighlight-Bz-lOJtH.js} +8 -10
  193. package/lib/{SyntaxHighlight-C31iouiO.js.map → SyntaxHighlight-Bz-lOJtH.js.map} +1 -1
  194. package/lib/{utils-DcpDOncX.js → ZudokuContext-hmLMUdf2.js} +54 -55
  195. package/lib/ZudokuContext-hmLMUdf2.js.map +1 -0
  196. package/lib/assets/{index-B_Jk_Yzp.js → index-C7jnHK4b.js} +218 -197
  197. package/lib/assets/index-C7jnHK4b.js.map +1 -0
  198. package/lib/assets/{worker-C_2va8B8.js → worker-DV9Ecqy9.js} +5267 -4887
  199. package/lib/assets/worker-DV9Ecqy9.js.map +1 -0
  200. package/lib/chunk-D52XG6IA-Dl7HLe6j.js +1823 -0
  201. package/lib/chunk-D52XG6IA-Dl7HLe6j.js.map +1 -0
  202. package/lib/{cn-BmFQLtkS.js → cn-qaFjX9_3.js} +2 -2
  203. package/lib/cn-qaFjX9_3.js.map +1 -0
  204. package/lib/{context-D1nXWxm7.js → context-h_UkBLvr.js} +2 -2
  205. package/lib/context-h_UkBLvr.js.map +1 -0
  206. package/lib/{createServer-BCAHdrpE.js → createServer-C4C0OO0m.js} +4804 -4462
  207. package/lib/createServer-C4C0OO0m.js.map +1 -0
  208. package/lib/{hook-hEqe7fPB.js → hook-CHq7pFyz.js} +3 -3
  209. package/lib/{hook-hEqe7fPB.js.map → hook-CHq7pFyz.js.map} +1 -1
  210. package/lib/{index-CkwDvuPt.js → index-CBXSgjaE.js} +259 -238
  211. package/lib/index-CBXSgjaE.js.map +1 -0
  212. package/lib/index-CPNSgwSb.js +36 -0
  213. package/lib/index-CPNSgwSb.js.map +1 -0
  214. package/lib/index-DyBL--Kz.js +826 -0
  215. package/lib/index-DyBL--Kz.js.map +1 -0
  216. package/lib/{index-DjB6H4GT.js → index-DzRORsY1.js} +444 -441
  217. package/lib/index-DzRORsY1.js.map +1 -0
  218. package/lib/index-LNp6rxyU.js.map +1 -1
  219. package/lib/index.esm-BSV1C092.js +692 -0
  220. package/lib/{index.esm-Bm8pj-bc.js.map → index.esm-BSV1C092.js.map} +1 -1
  221. package/lib/index.esm-BnnBRKJX.js +1214 -0
  222. package/lib/index.esm-BnnBRKJX.js.map +1 -0
  223. package/lib/invariant-Caa8-XvF.js.map +1 -1
  224. package/lib/jsx-runtime-Dx-03ztt.js +446 -0
  225. package/lib/jsx-runtime-Dx-03ztt.js.map +1 -0
  226. package/lib/post-processors/removeExtensions.js.map +1 -1
  227. package/lib/post-processors/removePaths.js.map +1 -1
  228. package/lib/post-processors/traverse.js.map +1 -1
  229. package/lib/prism-csharp.min-DUwvItt4.js +63 -0
  230. package/lib/{prism-csharp.min-Yizuc34Y.js.map → prism-csharp.min-DUwvItt4.js.map} +1 -1
  231. package/lib/prism-java.min-BtgBR4yd.js +35 -0
  232. package/lib/{prism-java.min-d5iT_mOd.js.map → prism-java.min-BtgBR4yd.js.map} +1 -1
  233. package/lib/prism-markup-BNGj0Tvm.js.map +1 -1
  234. package/lib/prism-ruby.min-DeDXCp1r.js +38 -0
  235. package/lib/{prism-ruby.min-C7LwcKyz.js.map → prism-ruby.min-DeDXCp1r.js.map} +1 -1
  236. package/lib/prism-typescript.min-CD7H2IYQ.js +34 -0
  237. package/lib/{prism-typescript.min-oSVeWCAd.js.map → prism-typescript.min-CD7H2IYQ.js.map} +1 -1
  238. package/lib/state-CFQsUZUP.js +202 -0
  239. package/lib/state-CFQsUZUP.js.map +1 -0
  240. package/lib/ui/Accordion.js +2 -2
  241. package/lib/ui/Accordion.js.map +1 -1
  242. package/lib/ui/ActionButton.js +4 -4
  243. package/lib/ui/ActionButton.js.map +1 -1
  244. package/lib/ui/Alert.js +3 -3
  245. package/lib/ui/Alert.js.map +1 -1
  246. package/lib/ui/AlertDialog.js +2 -2
  247. package/lib/ui/AlertDialog.js.map +1 -1
  248. package/lib/ui/Badge.js +3 -3
  249. package/lib/ui/Badge.js.map +1 -1
  250. package/lib/ui/Breadcrumb.js +2 -2
  251. package/lib/ui/Breadcrumb.js.map +1 -1
  252. package/lib/ui/Button.js +3 -3
  253. package/lib/ui/Button.js.map +1 -1
  254. package/lib/ui/Callout.js +2 -2
  255. package/lib/ui/Callout.js.map +1 -1
  256. package/lib/ui/Card.js +2 -2
  257. package/lib/ui/Card.js.map +1 -1
  258. package/lib/ui/Carousel.js +407 -401
  259. package/lib/ui/Carousel.js.map +1 -1
  260. package/lib/ui/Checkbox.js +2 -2
  261. package/lib/ui/Checkbox.js.map +1 -1
  262. package/lib/ui/Command.js +111 -108
  263. package/lib/ui/Command.js.map +1 -1
  264. package/lib/ui/Dialog.js +2 -2
  265. package/lib/ui/Dialog.js.map +1 -1
  266. package/lib/ui/Drawer.js +2 -2
  267. package/lib/ui/Drawer.js.map +1 -1
  268. package/lib/ui/DropdownMenu.js +2 -2
  269. package/lib/ui/DropdownMenu.js.map +1 -1
  270. package/lib/ui/Form.js +3 -3
  271. package/lib/ui/Form.js.map +1 -1
  272. package/lib/ui/HoverCard.js +2 -2
  273. package/lib/ui/Input.js +2 -2
  274. package/lib/ui/Input.js.map +1 -1
  275. package/lib/ui/Label.js +3 -3
  276. package/lib/ui/Pagination.js +2 -2
  277. package/lib/ui/Pagination.js.map +1 -1
  278. package/lib/ui/Popover.js +2 -2
  279. package/lib/ui/Popover.js.map +1 -1
  280. package/lib/ui/Progress.js +2 -2
  281. package/lib/ui/Progress.js.map +1 -1
  282. package/lib/ui/RadioGroup.js +2 -2
  283. package/lib/ui/RadioGroup.js.map +1 -1
  284. package/lib/ui/ScrollArea.js +2 -2
  285. package/lib/ui/ScrollArea.js.map +1 -1
  286. package/lib/ui/Select.js +2 -2
  287. package/lib/ui/Select.js.map +1 -1
  288. package/lib/ui/Skeleton.js +2 -2
  289. package/lib/ui/Skeleton.js.map +1 -1
  290. package/lib/ui/Slider.js +2 -2
  291. package/lib/ui/Switch.js +2 -2
  292. package/lib/ui/Switch.js.map +1 -1
  293. package/lib/ui/Tabs.js +2 -2
  294. package/lib/ui/Textarea.js +2 -2
  295. package/lib/ui/Textarea.js.map +1 -1
  296. package/lib/ui/Toggle.js +3 -3
  297. package/lib/ui/Toggle.js.map +1 -1
  298. package/lib/ui/ToggleGroup.js +2 -2
  299. package/lib/ui/ToggleGroup.js.map +1 -1
  300. package/lib/ui/Tooltip.js +2 -2
  301. package/lib/useExposedProps-DE9lR6MF.js +9 -0
  302. package/lib/useExposedProps-DE9lR6MF.js.map +1 -0
  303. package/lib/zudoku.auth-auth0.js +1 -1
  304. package/lib/zudoku.auth-auth0.js.map +1 -1
  305. package/lib/zudoku.auth-clerk.js +2 -2
  306. package/lib/zudoku.auth-clerk.js.map +1 -1
  307. package/lib/zudoku.auth-openid.js +369 -366
  308. package/lib/zudoku.auth-openid.js.map +1 -1
  309. package/lib/zudoku.components.js +722 -959
  310. package/lib/zudoku.components.js.map +1 -1
  311. package/lib/zudoku.openapi-worker.js +1 -1
  312. package/lib/zudoku.openapi-worker.js.map +1 -1
  313. package/lib/zudoku.plugin-api-catalog.js +81 -79
  314. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  315. package/lib/zudoku.plugin-api-keys.js +15 -16
  316. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  317. package/lib/zudoku.plugin-custom-pages.js +4 -4
  318. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  319. package/lib/zudoku.plugin-markdown.js +2 -2
  320. package/lib/zudoku.plugin-markdown.js.map +1 -1
  321. package/lib/zudoku.plugin-openapi.js +5 -5
  322. package/lib/zudoku.plugin-redirect.js +1 -1
  323. package/lib/zudoku.plugin-redirect.js.map +1 -1
  324. package/lib/zudoku.plugin-search-inkeep.js +53 -24
  325. package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
  326. package/package.json +52 -47
  327. package/src/app/demo.tsx +1 -1
  328. package/src/app/entry.client.tsx +1 -15
  329. package/src/app/entry.server.tsx +2 -2
  330. package/src/app/main.tsx +1 -1
  331. package/src/app/sentry.ts +1 -1
  332. package/src/app/standalone.tsx +1 -1
  333. package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
  334. package/src/lib/authentication/components/SignIn.tsx +1 -1
  335. package/src/lib/authentication/components/SignOut.tsx +1 -1
  336. package/src/lib/authentication/providers/openid.tsx +5 -3
  337. package/src/lib/components/AnchorLink.tsx +1 -1
  338. package/src/lib/components/Bootstrap.tsx +4 -6
  339. package/src/lib/components/Header.tsx +2 -2
  340. package/src/lib/components/Layout.tsx +2 -2
  341. package/src/lib/components/Markdown.tsx +1 -1
  342. package/src/lib/components/MobileTopNavigation.tsx +1 -1
  343. package/src/lib/components/NotFoundPage.tsx +1 -1
  344. package/src/lib/components/ReactMarkdown.license.txt +21 -0
  345. package/src/lib/components/ReactMarkdown.tsx +264 -0
  346. package/src/lib/components/SlotletProvider.tsx +1 -1
  347. package/src/lib/components/TopNavigation.tsx +1 -1
  348. package/src/lib/components/Zudoku.tsx +1 -1
  349. package/src/lib/components/context/ZudokuContext.ts +1 -1
  350. package/src/lib/components/index.ts +8 -4
  351. package/src/lib/components/navigation/Sidebar.tsx +1 -1
  352. package/src/lib/components/navigation/SidebarBadge.tsx +0 -10
  353. package/src/lib/components/navigation/SidebarCategory.tsx +1 -1
  354. package/src/lib/components/navigation/SidebarItem.tsx +1 -1
  355. package/src/lib/components/navigation/utils.ts +1 -1
  356. package/src/lib/core/plugins.ts +3 -7
  357. package/src/lib/errors/RouterError.tsx +1 -1
  358. package/src/lib/oas/parser/dereference/index.ts +9 -4
  359. package/src/lib/plugins/api-catalog/Catalog.tsx +59 -60
  360. package/src/lib/plugins/api-catalog/index.tsx +14 -0
  361. package/src/lib/plugins/api-keys/CreateApiKey.tsx +1 -1
  362. package/src/lib/plugins/api-keys/ProtectedRoute.tsx +1 -1
  363. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +1 -1
  364. package/src/lib/plugins/api-keys/index.tsx +1 -1
  365. package/src/lib/plugins/custom-pages/index.tsx +1 -1
  366. package/src/lib/plugins/markdown/MdxPage.tsx +1 -1
  367. package/src/lib/plugins/markdown/index.tsx +2 -1
  368. package/src/lib/plugins/openapi/OperationList.tsx +45 -50
  369. package/src/lib/plugins/openapi/OperationListItem.tsx +31 -2
  370. package/src/lib/plugins/openapi/Route.tsx +41 -9
  371. package/src/lib/plugins/openapi/Sidecar.tsx +3 -17
  372. package/src/lib/plugins/openapi/client/useCreateQuery.ts +13 -1
  373. package/src/lib/plugins/openapi/context.tsx +2 -2
  374. package/src/lib/plugins/openapi/index.tsx +37 -28
  375. package/src/lib/plugins/openapi/interfaces.ts +22 -1
  376. package/src/lib/plugins/openapi/schema/SchemaComponents.tsx +25 -1
  377. package/src/lib/plugins/openapi/util/methodToColor.ts +27 -0
  378. package/src/lib/plugins/openapi/util/sanitizeMarkdownForMetatag.tsx +32 -0
  379. package/src/lib/plugins/redirect/index.tsx +1 -1
  380. package/src/lib/plugins/search-inkeep/index.tsx +78 -23
  381. package/src/lib/plugins/search-inkeep/inkeep.ts +3 -9
  382. package/src/lib/util/MdxComponents.tsx +1 -3
  383. package/src/lib/util/createVariantComponent.tsx +2 -2
  384. package/src/lib/util/useExposedProps.tsx +1 -1
  385. package/src/lib/util/useScrollToAnchor.ts +1 -1
  386. package/src/lib/util/useScrollToTop.ts +1 -1
  387. package/dist/lib/plugins/search-inkeep/InkeepCustomTrigger.d.ts +0 -2
  388. package/dist/lib/plugins/search-inkeep/InkeepCustomTrigger.js +0 -3
  389. package/dist/lib/plugins/search-inkeep/InkeepCustomTrigger.js.map +0 -1
  390. package/lib/AnchorLink-BR0MvI7n.js.map +0 -1
  391. package/lib/AuthenticationPlugin-D0Em0SwR.js.map +0 -1
  392. package/lib/InkeepCustomTrigger-CE5-K5ex.js +0 -6
  393. package/lib/InkeepCustomTrigger-CE5-K5ex.js.map +0 -1
  394. package/lib/Markdown-CdkU5HcM.js.map +0 -1
  395. package/lib/MdxPage-ChziqNPp.js.map +0 -1
  396. package/lib/OperationList-CQKkyrZH.js +0 -4706
  397. package/lib/OperationList-CQKkyrZH.js.map +0 -1
  398. package/lib/Route-DlG_HTMu.js +0 -11
  399. package/lib/Route-DlG_HTMu.js.map +0 -1
  400. package/lib/SidebarBadge-DxFJcJ6V.js +0 -51
  401. package/lib/SidebarBadge-DxFJcJ6V.js.map +0 -1
  402. package/lib/SlotletProvider-D77pO-fA.js +0 -252
  403. package/lib/SlotletProvider-D77pO-fA.js.map +0 -1
  404. package/lib/assets/index-B_Jk_Yzp.js.map +0 -1
  405. package/lib/assets/worker-C_2va8B8.js.map +0 -1
  406. package/lib/cn-BmFQLtkS.js.map +0 -1
  407. package/lib/context-D1nXWxm7.js.map +0 -1
  408. package/lib/createServer-BCAHdrpE.js.map +0 -1
  409. package/lib/index-BuAyrJe3.js +0 -46
  410. package/lib/index-BuAyrJe3.js.map +0 -1
  411. package/lib/index-CkwDvuPt.js.map +0 -1
  412. package/lib/index-Czzd9rjU.js +0 -899
  413. package/lib/index-Czzd9rjU.js.map +0 -1
  414. package/lib/index-DjB6H4GT.js.map +0 -1
  415. package/lib/index-Yn8c3UWE.js +0 -921
  416. package/lib/index-Yn8c3UWE.js.map +0 -1
  417. package/lib/index.esm-Bm8pj-bc.js +0 -675
  418. package/lib/index.esm-C5mr_sKO.js +0 -1193
  419. package/lib/index.esm-C5mr_sKO.js.map +0 -1
  420. package/lib/jsx-runtime-B6kdoens.js +0 -635
  421. package/lib/jsx-runtime-B6kdoens.js.map +0 -1
  422. package/lib/object_hash-CvlLgU-M.js +0 -785
  423. package/lib/object_hash-CvlLgU-M.js.map +0 -1
  424. package/lib/prism-csharp.min-Yizuc34Y.js +0 -35
  425. package/lib/prism-java.min-d5iT_mOd.js +0 -7
  426. package/lib/prism-ruby.min-C7LwcKyz.js +0 -10
  427. package/lib/prism-typescript.min-oSVeWCAd.js +0 -6
  428. package/lib/router-lfyopgBI.js +0 -3024
  429. package/lib/router-lfyopgBI.js.map +0 -1
  430. package/lib/state-tsXBLONe.js +0 -203
  431. package/lib/state-tsXBLONe.js.map +0 -1
  432. package/lib/useExposedProps-CTPtylCV.js +0 -10
  433. package/lib/useExposedProps-CTPtylCV.js.map +0 -1
  434. package/lib/utils-DcpDOncX.js.map +0 -1
  435. package/src/lib/plugins/search-inkeep/InkeepCustomTrigger.tsx +0 -3
@@ -0,0 +1,264 @@
1
+ /* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
2
+ /* eslint-disable @typescript-eslint/no-unnecessary-condition */
3
+
4
+ /**
5
+ * This is a fork of `react-markdown` converted to typescript.
6
+ * The reason we fork it is because react-markdown is comptaible with
7
+ * unified 11, but references the unified 10 and related packages causing
8
+ * type errors and a bunch of extra imports
9
+ *
10
+ * Source: https://github.com/remarkjs/react-markdown/blob/main/index.js
11
+ */
12
+
13
+ import { unreachable } from "devlop";
14
+ import type { Element, ElementContent, Nodes, Parents } from "hast";
15
+ import {
16
+ Components as JsxRuntimeComponents,
17
+ toJsxRuntime,
18
+ } from "hast-util-to-jsx-runtime";
19
+ import { urlAttributes } from "html-url-attributes";
20
+ import { ReactElement } from "react";
21
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
22
+ import remarkParse from "remark-parse";
23
+ import remarkRehype, { Options as RemarkRehypeOptions } from "remark-rehype";
24
+ import { PluggableList, unified } from "unified";
25
+ import { visit } from "unist-util-visit";
26
+ import { VFile } from "vfile";
27
+
28
+ const changelog =
29
+ "https://github.com/remarkjs/react-markdown/blob/main/changelog.md";
30
+
31
+ const emptyPlugins: PluggableList = [];
32
+ const emptyRemarkRehypeOptions: Readonly<RemarkRehypeOptions> = {
33
+ allowDangerousHtml: true,
34
+ };
35
+ const safeProtocol = /^(https?|ircs?|mailto|xmpp)$/i;
36
+
37
+ interface Deprecation {
38
+ from: string;
39
+ id: string;
40
+ to?: keyof Options;
41
+ }
42
+
43
+ interface AllowElement {
44
+ (
45
+ element: Readonly<Element>,
46
+ index: number,
47
+ parent: Readonly<Parents> | undefined,
48
+ ): boolean | null | undefined;
49
+ }
50
+
51
+ interface UrlTransform {
52
+ (
53
+ url: string,
54
+ key: string,
55
+ node: Readonly<Element>,
56
+ ): string | null | undefined;
57
+ }
58
+
59
+ // eslint-disable-next-line @typescript-eslint/no-empty-object-type
60
+ interface Components extends Partial<JsxRuntimeComponents> {}
61
+
62
+ interface Options {
63
+ allowElement?: AllowElement | null;
64
+ allowedElements?: ReadonlyArray<string> | null;
65
+ children?: string | null;
66
+ className?: string | null;
67
+ components?: Components | null;
68
+ disallowedElements?: ReadonlyArray<string> | null;
69
+ rehypePlugins?: PluggableList | null;
70
+ remarkPlugins?: PluggableList | null;
71
+ remarkRehypeOptions?: Readonly<RemarkRehypeOptions> | null;
72
+ skipHtml?: boolean | null;
73
+ unwrapDisallowed?: boolean | null;
74
+ urlTransform?: UrlTransform | null;
75
+ }
76
+
77
+ const deprecations: ReadonlyArray<Readonly<Deprecation>> = [
78
+ { from: "astPlugins", id: "remove-buggy-html-in-markdown-parser" },
79
+ { from: "allowDangerousHtml", id: "remove-buggy-html-in-markdown-parser" },
80
+ {
81
+ from: "allowNode",
82
+ id: "replace-allownode-allowedtypes-and-disallowedtypes",
83
+ to: "allowElement",
84
+ },
85
+ {
86
+ from: "allowedTypes",
87
+ id: "replace-allownode-allowedtypes-and-disallowedtypes",
88
+ to: "allowedElements",
89
+ },
90
+ {
91
+ from: "disallowedTypes",
92
+ id: "replace-allownode-allowedtypes-and-disallowedtypes",
93
+ to: "disallowedElements",
94
+ },
95
+ { from: "escapeHtml", id: "remove-buggy-html-in-markdown-parser" },
96
+ { from: "includeElementIndex", id: "#remove-includeelementindex" },
97
+ {
98
+ from: "includeNodeIndex",
99
+ id: "change-includenodeindex-to-includeelementindex",
100
+ },
101
+ { from: "linkTarget", id: "remove-linktarget" },
102
+ {
103
+ from: "plugins",
104
+ id: "change-plugins-to-remarkplugins",
105
+ to: "remarkPlugins",
106
+ },
107
+ { from: "rawSourcePos", id: "#remove-rawsourcepos" },
108
+ { from: "renderers", id: "change-renderers-to-components", to: "components" },
109
+ { from: "source", id: "change-source-to-children", to: "children" },
110
+ { from: "sourcePos", id: "#remove-sourcepos" },
111
+ { from: "transformImageUri", id: "#add-urltransform", to: "urlTransform" },
112
+ { from: "transformLinkUri", id: "#add-urltransform", to: "urlTransform" },
113
+ ];
114
+
115
+ export function ReactMarkdown(options: Readonly<Options>): ReactElement {
116
+ const allowedElements = options.allowedElements;
117
+ const allowElement = options.allowElement;
118
+ const children = options.children || "";
119
+ const className = options.className;
120
+ const components = options.components;
121
+ const disallowedElements = options.disallowedElements;
122
+ const rehypePlugins = options.rehypePlugins || emptyPlugins;
123
+ const remarkPlugins = options.remarkPlugins || emptyPlugins;
124
+ const remarkRehypeOptions = options.remarkRehypeOptions
125
+ ? { ...options.remarkRehypeOptions, ...emptyRemarkRehypeOptions }
126
+ : emptyRemarkRehypeOptions;
127
+ const skipHtml = options.skipHtml;
128
+ const unwrapDisallowed = options.unwrapDisallowed;
129
+ const urlTransform = options.urlTransform || defaultUrlTransform;
130
+
131
+ const processor = unified()
132
+ .use(remarkParse)
133
+ .use(remarkPlugins)
134
+ .use(remarkRehype, remarkRehypeOptions)
135
+ .use(rehypePlugins);
136
+
137
+ const file = new VFile();
138
+
139
+ if (typeof children === "string") {
140
+ file.value = children;
141
+ } else {
142
+ unreachable(
143
+ `Unexpected value '${children}' for 'children' prop, expected 'string'`,
144
+ );
145
+ }
146
+
147
+ if (allowedElements && disallowedElements) {
148
+ unreachable(
149
+ "Unexpected combined `allowedElements` and `disallowedElements`, expected one or the other",
150
+ );
151
+ }
152
+
153
+ for (const deprecation of deprecations) {
154
+ if (Object.prototype.hasOwnProperty.call(options, deprecation.from)) {
155
+ unreachable(
156
+ `Unexpected '${deprecation.from}' prop, ` +
157
+ (deprecation.to ? `use '${deprecation.to}' instead` : "remove it") +
158
+ ` (see <${changelog}#${deprecation.id}> for more info)`,
159
+ );
160
+ }
161
+ }
162
+
163
+ const mdastTree = processor.parse(file);
164
+ let hastTree: Nodes = processor.runSync(mdastTree, file);
165
+
166
+ if (className) {
167
+ hastTree = {
168
+ type: "element",
169
+ tagName: "div",
170
+ properties: { className },
171
+ children:
172
+ hastTree.type === "root"
173
+ ? (hastTree.children as ElementContent[])
174
+ : [hastTree],
175
+ };
176
+ }
177
+
178
+ // Nodes type is slightly off, different versions of `hast` have different types
179
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
180
+ // @ts-ignore
181
+ visit(hastTree, transform);
182
+
183
+ return toJsxRuntime(hastTree, {
184
+ Fragment,
185
+ components,
186
+ ignoreInvalidStyle: true,
187
+ jsx,
188
+ jsxs,
189
+ passKeys: true,
190
+ passNode: true,
191
+ });
192
+
193
+ function transform(
194
+ node: Nodes,
195
+ index: number | null,
196
+ parent: Parents | undefined,
197
+ ): number | void {
198
+ if (node.type === "raw" && parent && typeof index === "number") {
199
+ if (skipHtml) {
200
+ parent.children.splice(index, 1);
201
+ } else {
202
+ parent.children[index] = { type: "text", value: node.value };
203
+ }
204
+ return index;
205
+ }
206
+
207
+ if (node.type === "element") {
208
+ for (const key in urlAttributes) {
209
+ if (
210
+ Object.prototype.hasOwnProperty.call(urlAttributes, key) &&
211
+ Object.prototype.hasOwnProperty.call(node.properties, key)
212
+ ) {
213
+ const value = node.properties[key];
214
+ const test = urlAttributes[key];
215
+ if (
216
+ test === null ||
217
+ test === undefined ||
218
+ test.includes(node.tagName)
219
+ ) {
220
+ node.properties[key] = urlTransform(String(value || ""), key, node);
221
+ }
222
+ }
223
+ }
224
+
225
+ let remove = allowedElements
226
+ ? !allowedElements.includes(node.tagName)
227
+ : disallowedElements
228
+ ? disallowedElements.includes(node.tagName)
229
+ : false;
230
+
231
+ if (!remove && allowElement && typeof index === "number") {
232
+ remove = !allowElement(node, index, parent);
233
+ }
234
+
235
+ if (remove && parent && typeof index === "number") {
236
+ if (unwrapDisallowed && node.children) {
237
+ parent.children.splice(index, 1, ...node.children);
238
+ } else {
239
+ parent.children.splice(index, 1);
240
+ }
241
+ return index;
242
+ }
243
+ }
244
+ }
245
+ }
246
+
247
+ function defaultUrlTransform(value: string): string {
248
+ const colon = value.indexOf(":");
249
+ const questionMark = value.indexOf("?");
250
+ const numberSign = value.indexOf("#");
251
+ const slash = value.indexOf("/");
252
+
253
+ if (
254
+ colon < 0 ||
255
+ (slash > -1 && colon > slash) ||
256
+ (questionMark > -1 && colon > questionMark) ||
257
+ (numberSign > -1 && colon > numberSign) ||
258
+ safeProtocol.test(value.slice(0, colon))
259
+ ) {
260
+ return value;
261
+ }
262
+
263
+ return "";
264
+ }
@@ -10,7 +10,7 @@ import {
10
10
  type NavigateFunction,
11
11
  type Params,
12
12
  type SetURLSearchParams,
13
- } from "react-router-dom";
13
+ } from "react-router";
14
14
  import { useExposedProps } from "../util/useExposedProps.js";
15
15
 
16
16
  export type Slotlets = Record<
@@ -1,6 +1,6 @@
1
1
  import { cx } from "class-variance-authority";
2
2
  import { Suspense } from "react";
3
- import { NavLink, useNavigation } from "react-router-dom";
3
+ import { NavLink, useNavigation } from "react-router";
4
4
  import { TopNavigationItem } from "../../config/validators/common.js";
5
5
  import { useAuth } from "../authentication/hook.js";
6
6
  import { ZudokuError } from "../util/invariant.js";
@@ -11,7 +11,7 @@ import {
11
11
  useState,
12
12
  } from "react";
13
13
  import { ErrorBoundary } from "react-error-boundary";
14
- import { Outlet, useNavigation } from "react-router-dom";
14
+ import { Outlet, useNavigation } from "react-router";
15
15
  import { hasHead, isMdxProviderPlugin } from "../core/plugins.js";
16
16
  import { ZudokuContext, ZudokuContextOptions } from "../core/ZudokuContext.js";
17
17
  import { TopLevelError } from "../errors/TopLevelError.js";
@@ -1,6 +1,6 @@
1
1
  import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
2
2
  import { createContext, useContext } from "react";
3
- import { matchPath, useLocation } from "react-router-dom";
3
+ import { matchPath, useLocation } from "react-router";
4
4
  import { ZudokuContext } from "../../core/ZudokuContext.js";
5
5
  import { joinPath } from "../../util/joinPath.js";
6
6
  import { traverseSidebar } from "../navigation/utils.js";
@@ -1,11 +1,13 @@
1
1
  import { useMDXComponents as useMDXComponentsImport } from "@mdx-js/react";
2
2
  import { Helmet } from "@zudoku/react-helmet-async";
3
- import { Link as LinkImport } from "react-router-dom";
4
- import { useAuthState } from "../authentication/state.js";
3
+ import { Link as LinkImport } from "react-router";
4
+ import { useAuth as useAuthImport } from "../authentication/hook.js";
5
5
  import { RouterError as RouterErrorImport } from "../errors/RouterError.js";
6
6
  import { ServerError as ServerErrorImport } from "../errors/ServerError.js";
7
7
  import { Button as ButtonImport } from "../ui/Button.js";
8
8
  import { Callout as CalloutImport } from "../ui/Callout.js";
9
+ import { Spinner as SpinnerImport } from "./Spinner.js";
10
+ import { Markdown as MarkdownImport } from "./Markdown.js";
9
11
  import {
10
12
  Bootstrap as BootstrapImport,
11
13
  BootstrapStatic as BootstrapStaticImport,
@@ -24,10 +26,12 @@ export const BootstrapStatic = /*@__PURE__*/ BootstrapStaticImport;
24
26
  export const Head = /*@__PURE__*/ Helmet;
25
27
 
26
28
  export const useZudoku = /*@__PURE__*/ useZudokuImport;
27
- export const useAuth = /*@__PURE__*/ useAuthState;
29
+ export const useAuth = /*@__PURE__*/ useAuthImport;
28
30
  export const Zudoku = /*@__PURE__*/ ZudokuImport;
29
31
 
30
32
  export const Callout = /*@__PURE__*/ CalloutImport;
33
+ export const Markdown = /*@__PURE__*/ MarkdownImport;
34
+ export const Spinner = /*@__PURE__*/ SpinnerImport;
31
35
  export const ClientOnly = /*@__PURE__*/ ClientOnlyImport;
32
36
  export const Button = /*@__PURE__*/ ButtonImport;
33
- export const Link: typeof LinkImport = /*@__PURE__*/ LinkImport;
37
+ export const Link = /*@__PURE__*/ LinkImport;
@@ -31,7 +31,7 @@ export const Sidebar = ({
31
31
  className="lg:hidden h-[100dvh] left-0 w-[320px] rounded-none"
32
32
  aria-describedby={undefined}
33
33
  >
34
- <div className="p-6 overflow-y-auto overscroll-none">
34
+ <div className="p-4 overflow-y-auto overscroll-none">
35
35
  <VisuallyHidden>
36
36
  <DrawerTitle>Sidebar</DrawerTitle>
37
37
  </VisuallyHidden>
@@ -1,15 +1,5 @@
1
1
  import { cn } from "../../util/cn.js";
2
2
 
3
- export const TextColorMap = {
4
- green: "text-green-600",
5
- blue: "text-sky-600",
6
- yellow: "text-yellow-600",
7
- red: "text-red-600",
8
- purple: "text-purple-600",
9
- indigo: "text-indigo-600",
10
- gray: "text-gray-600",
11
- };
12
-
13
3
  export const ColorMap = {
14
4
  green: "bg-green-400 dark:bg-green-800",
15
5
  blue: "bg-sky-400 dark:bg-sky-800",
@@ -1,7 +1,7 @@
1
1
  import * as Collapsible from "@radix-ui/react-collapsible";
2
2
  import { ChevronRightIcon } from "lucide-react";
3
3
  import { useEffect, useState } from "react";
4
- import { NavLink, useMatch } from "react-router-dom";
4
+ import { NavLink, useMatch } from "react-router";
5
5
  import type { SidebarItemCategory } from "../../../config/validators/SidebarSchema.js";
6
6
  import { cn } from "../../util/cn.js";
7
7
  import { joinPath } from "../../util/joinPath.js";
@@ -1,6 +1,6 @@
1
1
  import { cva } from "class-variance-authority";
2
2
  import { ExternalLinkIcon } from "lucide-react";
3
- import { NavLink, useSearchParams } from "react-router-dom";
3
+ import { NavLink, useSearchParams } from "react-router";
4
4
 
5
5
  import type { SidebarItem as SidebarItemType } from "../../../config/validators/SidebarSchema.js";
6
6
  import { joinPath } from "../../util/joinPath.js";
@@ -1,4 +1,4 @@
1
- import { useLocation } from "react-router-dom";
1
+ import { useLocation } from "react-router";
2
2
  import type {
3
3
  SidebarItem,
4
4
  SidebarItemCategory,
@@ -1,6 +1,6 @@
1
- import type { LucideProps } from "lucide-react";
1
+ import type { LucideIcon } from "lucide-react";
2
2
  import { type ReactElement } from "react";
3
- import { type RouteObject } from "react-router-dom";
3
+ import { type RouteObject } from "react-router";
4
4
  import type { Sidebar } from "../../config/validators/SidebarSchema.js";
5
5
  import { MdxComponentsType } from "../util/MdxComponents.js";
6
6
  import { ZudokuContext, type ApiIdentity } from "./ZudokuContext.js";
@@ -40,11 +40,7 @@ export type ProfileNavigationItem = {
40
40
  weight?: number;
41
41
  category?: "top" | "middle" | "bottom";
42
42
  children?: ProfileNavigationItem[];
43
- icon?: React.ComponentType<
44
- LucideProps & {
45
- [key: string]: any;
46
- }
47
- >;
43
+ icon?: LucideIcon;
48
44
  };
49
45
 
50
46
  export interface CommonPlugin {
@@ -1,4 +1,4 @@
1
- import { isRouteErrorResponse, useRouteError } from "react-router-dom";
1
+ import { isRouteErrorResponse, useRouteError } from "react-router";
2
2
  import { NotFoundPage } from "../components/NotFoundPage.js";
3
3
  import { ErrorAlert } from "./ErrorAlert.js";
4
4
 
@@ -3,6 +3,8 @@ import { resolveLocalRef } from "./resolveRef.js";
3
3
 
4
4
  export type JSONSchema = JSONSchema4 | JSONSchema6;
5
5
 
6
+ export const CIRCULAR_REF = "$[Circular Reference]";
7
+
6
8
  type CustomResolver = (ref: string) => Promise<JSONSchema | undefined>;
7
9
 
8
10
  const cache = new Map<JSONSchema, JSONSchema>();
@@ -21,12 +23,12 @@ export const dereference = async (
21
23
  }
22
24
 
23
25
  const cloned = structuredClone(schema);
24
- const visited = new Set();
26
+ const visited = new Set<unknown>();
25
27
 
26
28
  const resolve = async (current: unknown, path: string) => {
27
29
  if (isIndexableObject(current)) {
28
30
  if (visited.has(current)) {
29
- return current;
31
+ return CIRCULAR_REF;
30
32
  }
31
33
 
32
34
  visited.add(current);
@@ -39,15 +41,18 @@ export const dereference = async (
39
41
  if ("$ref" in current && typeof current.$ref === "string") {
40
42
  for (const resolver of resolvers) {
41
43
  const resolved = await resolver(current.$ref);
42
- if (resolved) return resolved;
44
+ if (resolved) return await resolve(resolved, path);
43
45
  }
44
- return await resolveLocalRef(cloned, current.$ref);
46
+ const resolved = await resolveLocalRef(cloned, current.$ref);
47
+ return await resolve(resolved, path);
45
48
  }
46
49
 
47
50
  for (const key in current) {
48
51
  current[key] = await resolve(current[key], `${path}/${key}`);
49
52
  }
50
53
  }
54
+
55
+ visited.delete(current);
51
56
  }
52
57
 
53
58
  return current;
@@ -1,37 +1,45 @@
1
1
  import slugify from "@sindresorhus/slugify";
2
- import { Fragment } from "react";
2
+ import { useSuspenseQuery } from "@tanstack/react-query";
3
+ import { useSearchParams } from "react-router";
3
4
  import { Head, Link } from "zudoku/components";
5
+ import { useAuthState } from "../../authentication/state.js";
4
6
  import { Markdown } from "../../components/Markdown.js";
5
- import { useExposedProps } from "../../util/useExposedProps.js";
6
- import type { ApiCatalogItem, CatalogCategory } from "./index.js";
7
+ import { cn } from "../../util/cn.js";
8
+ import type { ApiCatalogPluginOptions } from "./index.js";
9
+
10
+ const getKey = (category: string, tag: string) => slugify(`${category}-${tag}`);
7
11
 
8
12
  export const Catalog = ({
9
13
  items,
14
+ filterCatalogItems = (items) => items,
10
15
  categories,
11
16
  label = "API Library",
12
- }: {
13
- label: string;
14
- items: ApiCatalogItem[];
15
- categories: CatalogCategory[];
16
- }) => {
17
- const { searchParams, setSearchParams } = useExposedProps();
17
+ }: Omit<ApiCatalogPluginOptions, "navigationId">) => {
18
+ const [searchParams, setSearchParams] = useSearchParams();
18
19
  const activeCategory = searchParams.get("category");
20
+ const auth = useAuthState();
21
+
22
+ const catalogItems = useSuspenseQuery({
23
+ queryFn: () => filterCatalogItems(items, { auth }),
24
+ queryKey: ["catalogItems", auth],
25
+ });
26
+
19
27
  return (
20
28
  <section className="pt-[--padding-content-top] pb-[--padding-content-bottom]">
21
29
  <Head>
22
30
  <title>{label}</title>
23
31
  </Head>
24
32
  <div className="grid grid-cols-12 gap-12">
25
- <div className="flex flex-col gap-4 col-span-3 px-4 not-prose sticky top-48">
26
- <div className="justify-between">
27
- {categories.map((category, idx) => (
28
- <Fragment key={category.label}>
33
+ <div className="flex flex-col gap-4 col-span-3 not-prose sticky top-48">
34
+ <div className="max-w-[--side-nav-width] flex flex-col gap-4 justify-between">
35
+ {categories?.map((category, idx) => (
36
+ <div key={category.label}>
29
37
  <div className="flex justify-between mb-2.5">
30
38
  <span className="font-medium text-sm">{category.label}</span>
31
39
  {idx === 0 && activeCategory && (
32
40
  <button
33
41
  type="button"
34
- className="text-end text-sm mr-8 text-foreground/60 hover:text-foreground"
42
+ className="text-end text-sm text-foreground/60 hover:text-foreground"
35
43
  onClick={() => setSearchParams({})}
36
44
  >
37
45
  Clear
@@ -39,45 +47,41 @@ export const Catalog = ({
39
47
  )}
40
48
  </div>
41
49
  <ul className="space-y-1 [&>li]:py-2">
42
- {Array.from(
43
- new Set(
44
- category.tags
45
- .map((tag) => ({
46
- tag,
47
- count: items.filter((api) =>
48
- api.categories.find((c) => c.tags.includes(tag)),
49
- ).length,
50
- }))
51
- .map(({ tag, count }) => (
52
- <li
53
- key={slugify(category.label + " " + tag)}
54
- className={`flex px-4 rounded-lg -translate-x-4 justify-between text-sm cursor-pointer hover:text-primary transition ${
55
- slugify(tag) === activeCategory
56
- ? "font-medium bg-border/30 rounded"
57
- : ""
58
- }`}
59
- onClick={() =>
60
- setSearchParams({
61
- category: slugify(category.label + " " + tag),
62
- })
63
- }
50
+ {category.tags
51
+ .map((tag) => ({
52
+ tag,
53
+ count: items.filter((api) =>
54
+ api.categories.find((c) => c.tags.includes(tag)),
55
+ ).length,
56
+ }))
57
+ .map(({ tag, count }) => {
58
+ const slug = getKey(category.label, tag);
59
+ const isActive = slug === activeCategory;
60
+
61
+ return (
62
+ <li
63
+ key={slug}
64
+ className={cn(
65
+ "flex rounded-lg justify-between text-sm cursor-pointer hover:text-primary transition px-[--padding-nav-item] -mx-[--padding-nav-item]",
66
+ isActive && "bg-border/30 rounded",
67
+ )}
68
+ onClick={() => setSearchParams({ category: slug })}
69
+ >
70
+ <span>{tag}</span>
71
+ <span
72
+ className={cn(
73
+ "flex items-center justify-center border rounded-md w-8 text-xs font-semibold",
74
+ isActive &&
75
+ "bg-primary border-primary text-primary-foreground",
76
+ )}
64
77
  >
65
- <span>{tag}</span>
66
- <span
67
- className={`flex items-center justify-center border rounded-md w-8 text-xs font-semibold ${
68
- slugify(tag) === activeCategory
69
- ? "bg-primary border-primary text-primary-foreground"
70
- : ""
71
- }`}
72
- >
73
- {count}
74
- </span>
75
- </li>
76
- )),
77
- ),
78
- )}
78
+ {count}
79
+ </span>
80
+ </li>
81
+ );
82
+ })}
79
83
  </ul>
80
- </Fragment>
84
+ </div>
81
85
  ))}
82
86
  </div>
83
87
  </div>
@@ -85,17 +89,15 @@ export const Catalog = ({
85
89
  <h3 className="mt-0 text-2xl font-bold mb-4">{label}</h3>
86
90
 
87
91
  <div className="grid grid-cols-2 gap-4">
88
- {items
92
+ {catalogItems.data
89
93
  .filter(
90
94
  (api) =>
91
95
  !activeCategory ||
92
96
  api.categories.find((c) =>
93
- c.tags.find(
94
- (t) => slugify(c.label + " " + t) === activeCategory,
95
- ),
97
+ c.tags.find((t) => getKey(c.label, t) === activeCategory),
96
98
  ),
97
99
  )
98
- .map((api, i) => (
100
+ .map((api) => (
99
101
  <Link
100
102
  to={{
101
103
  pathname: `/${api.path}`,
@@ -104,10 +106,7 @@ export const Catalog = ({
104
106
  className="no-underline hover:!text-foreground"
105
107
  key={api.path}
106
108
  >
107
- <div
108
- className="border h-full rounded p-4 flex flex-col gap-2 cursor-pointer hover:bg-border/20 font-normal"
109
- key={i}
110
- >
109
+ <div className="border h-full rounded p-4 flex flex-col gap-2 cursor-pointer hover:bg-border/20 font-normal">
111
110
  <span className="font-semibold">{api.label}</span>
112
111
  <Markdown
113
112
  className="text-sm whitespace-pre-wrap mb-6 line-clamp-2"