zudoku 0.47.2 → 0.48.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/dist/app/ZuploBuildConfig.d.ts +4 -114
  2. package/dist/app/ZuploBuildConfig.js +1 -1
  3. package/dist/app/ZuploBuildConfig.js.map +1 -1
  4. package/dist/app/demo.js +4 -3
  5. package/dist/app/demo.js.map +1 -1
  6. package/dist/app/main.js +5 -5
  7. package/dist/app/main.js.map +1 -1
  8. package/dist/app/standalone.js +4 -3
  9. package/dist/app/standalone.js.map +1 -1
  10. package/dist/config/loader.js +1 -2
  11. package/dist/config/loader.js.map +1 -1
  12. package/dist/config/validators/BuildSchema.d.ts +20 -44
  13. package/dist/config/validators/BuildSchema.js +3 -14
  14. package/dist/config/validators/BuildSchema.js.map +1 -1
  15. package/dist/config/validators/InputNavigationSchema.d.ts +7217 -0
  16. package/dist/config/validators/InputNavigationSchema.js +74 -0
  17. package/dist/config/validators/InputNavigationSchema.js.map +1 -0
  18. package/dist/config/validators/InputNavigationSchema.test-d.d.ts +1 -0
  19. package/dist/config/validators/InputNavigationSchema.test-d.js +146 -0
  20. package/dist/config/validators/InputNavigationSchema.test-d.js.map +1 -0
  21. package/dist/config/validators/NavigationSchema.d.ts +44 -0
  22. package/dist/config/validators/NavigationSchema.js +95 -0
  23. package/dist/config/validators/NavigationSchema.js.map +1 -0
  24. package/dist/config/validators/icon-types.d.ts +2 -1
  25. package/dist/config/validators/icon-types.js +1775 -1
  26. package/dist/config/validators/icon-types.js.map +1 -1
  27. package/dist/config/validators/validate.d.ts +442 -5780
  28. package/dist/config/validators/validate.js +37 -55
  29. package/dist/config/validators/validate.js.map +1 -1
  30. package/dist/config/validators/validate.test.js +0 -2
  31. package/dist/config/validators/validate.test.js.map +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js.map +1 -1
  34. package/dist/lib/components/BuildCheck.js +1 -1
  35. package/dist/lib/components/BuildCheck.js.map +1 -1
  36. package/dist/lib/components/Header.js +10 -9
  37. package/dist/lib/components/Header.js.map +1 -1
  38. package/dist/lib/components/Heading.d.ts +6 -2
  39. package/dist/lib/components/Heading.js +2 -2
  40. package/dist/lib/components/Heading.js.map +1 -1
  41. package/dist/lib/components/Main.js +4 -4
  42. package/dist/lib/components/Main.js.map +1 -1
  43. package/dist/lib/components/MobileTopNavigation.js +5 -5
  44. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  45. package/dist/lib/components/PageProgress.d.ts +1 -0
  46. package/dist/lib/components/PageProgress.js +20 -0
  47. package/dist/lib/components/PageProgress.js.map +1 -0
  48. package/dist/lib/components/TopNavigation.d.ts +2 -3
  49. package/dist/lib/components/TopNavigation.js +45 -44
  50. package/dist/lib/components/TopNavigation.js.map +1 -1
  51. package/dist/lib/components/context/ZudokuContext.d.ts +3 -7
  52. package/dist/lib/components/context/ZudokuContext.js +44 -26
  53. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  54. package/dist/lib/components/navigation/Navigation.d.ts +5 -0
  55. package/dist/lib/components/navigation/Navigation.js +12 -0
  56. package/dist/lib/components/navigation/Navigation.js.map +1 -0
  57. package/dist/lib/components/navigation/{SidebarBadge.d.ts → NavigationBadge.d.ts} +1 -1
  58. package/dist/lib/components/navigation/{SidebarBadge.js → NavigationBadge.js} +2 -2
  59. package/dist/lib/components/navigation/NavigationBadge.js.map +1 -0
  60. package/dist/lib/components/navigation/NavigationCategory.d.ts +5 -0
  61. package/dist/lib/components/navigation/{SidebarCategory.js → NavigationCategory.js} +14 -12
  62. package/dist/lib/components/navigation/NavigationCategory.js.map +1 -0
  63. package/dist/lib/components/navigation/NavigationItem.d.ts +6 -0
  64. package/dist/lib/components/navigation/NavigationItem.js +47 -0
  65. package/dist/lib/components/navigation/NavigationItem.js.map +1 -0
  66. package/dist/lib/components/navigation/{SidebarWrapper.d.ts → NavigationWrapper.d.ts} +1 -1
  67. package/dist/lib/components/navigation/{SidebarWrapper.js → NavigationWrapper.js} +3 -3
  68. package/dist/lib/components/navigation/NavigationWrapper.js.map +1 -0
  69. package/dist/lib/components/navigation/utils.d.ts +7 -9
  70. package/dist/lib/components/navigation/utils.js +17 -17
  71. package/dist/lib/components/navigation/utils.js.map +1 -1
  72. package/dist/lib/core/ZudokuContext.d.ts +6 -8
  73. package/dist/lib/core/ZudokuContext.js +5 -7
  74. package/dist/lib/core/ZudokuContext.js.map +1 -1
  75. package/dist/lib/core/plugins.d.ts +2 -2
  76. package/dist/lib/hooks/useEvent.test.js +5 -3
  77. package/dist/lib/hooks/useEvent.test.js.map +1 -1
  78. package/dist/lib/plugins/api-catalog/Catalog.d.ts +1 -1
  79. package/dist/lib/plugins/api-catalog/index.d.ts +6 -6
  80. package/dist/lib/plugins/api-catalog/index.js +10 -10
  81. package/dist/lib/plugins/api-catalog/index.js.map +1 -1
  82. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +4 -4
  83. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  84. package/dist/lib/plugins/custom-pages/index.d.ts +3 -2
  85. package/dist/lib/plugins/custom-pages/index.js +15 -8
  86. package/dist/lib/plugins/custom-pages/index.js.map +1 -1
  87. package/dist/lib/plugins/markdown/MdxPage.js +6 -3
  88. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  89. package/dist/lib/plugins/markdown/index.d.ts +2 -1
  90. package/dist/lib/plugins/markdown/index.js +9 -26
  91. package/dist/lib/plugins/markdown/index.js.map +1 -1
  92. package/dist/lib/plugins/openapi/OperationList.js +1 -1
  93. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  94. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  95. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  96. package/dist/lib/plugins/openapi/SchemaList.js +1 -1
  97. package/dist/lib/plugins/openapi/SchemaList.js.map +1 -1
  98. package/dist/lib/plugins/openapi/graphql/gql.d.ts +1 -1
  99. package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
  100. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  101. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +3 -3
  102. package/dist/lib/plugins/openapi/graphql/graphql.js +2 -2
  103. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  104. package/dist/lib/plugins/openapi/index.d.ts +3 -3
  105. package/dist/lib/plugins/openapi/index.js +9 -9
  106. package/dist/lib/plugins/openapi/index.js.map +1 -1
  107. package/dist/lib/plugins/openapi/interfaces.d.ts +3 -3
  108. package/dist/lib/plugins/openapi/util/createNavigationCategory.d.ts +9 -0
  109. package/dist/lib/plugins/openapi/util/{createSidebarCategory.js → createNavigationCategory.js} +5 -4
  110. package/dist/lib/plugins/openapi/util/createNavigationCategory.js.map +1 -0
  111. package/dist/lib/plugins/openapi/util/getRoutes.js +2 -2
  112. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  113. package/dist/lib/plugins/openapi/util/methodColorMap.d.ts +1 -1
  114. package/dist/lib/util/useScrollToAnchor.js +3 -3
  115. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  116. package/dist/vite/api/SchemaManager.d.ts +4 -4
  117. package/dist/vite/api/SchemaManager.js +19 -19
  118. package/dist/vite/api/SchemaManager.js.map +1 -1
  119. package/dist/vite/api/SchemaManager.test.js +4 -4
  120. package/dist/vite/api/SchemaManager.test.js.map +1 -1
  121. package/dist/vite/config.js +1 -0
  122. package/dist/vite/config.js.map +1 -1
  123. package/dist/vite/plugin-api.js +8 -8
  124. package/dist/vite/plugin-api.js.map +1 -1
  125. package/dist/vite/plugin-config-reload.js +2 -0
  126. package/dist/vite/plugin-config-reload.js.map +1 -1
  127. package/dist/vite/plugin-custom-pages.js +2 -2
  128. package/dist/vite/plugin-custom-pages.js.map +1 -1
  129. package/dist/vite/plugin-docs.js +61 -59
  130. package/dist/vite/plugin-docs.js.map +1 -1
  131. package/dist/vite/{plugin-sidebar.d.ts → plugin-navigation.d.ts} +1 -1
  132. package/dist/vite/{plugin-sidebar.js → plugin-navigation.js} +20 -19
  133. package/dist/vite/plugin-navigation.js.map +1 -0
  134. package/dist/vite/plugin.js +2 -2
  135. package/dist/vite/plugin.js.map +1 -1
  136. package/dist/vite/shadcn-registry.d.ts +4 -4
  137. package/lib/{Markdown-C5j8kKSX.js → Markdown-DCAIYXF5.js} +480 -475
  138. package/lib/Markdown-DCAIYXF5.js.map +1 -0
  139. package/lib/{MdxPage-CKTMf1cR.js → MdxPage-Cf9YXWoC.js} +30 -30
  140. package/lib/MdxPage-Cf9YXWoC.js.map +1 -0
  141. package/lib/OasProvider-JMVTfG6_.js +35 -0
  142. package/lib/OasProvider-JMVTfG6_.js.map +1 -0
  143. package/lib/{OperationList-BJAKaG5p.js → OperationList-m4tFCI4S.js} +8 -8
  144. package/lib/{OperationList-BJAKaG5p.js.map → OperationList-m4tFCI4S.js.map} +1 -1
  145. package/lib/{RouteGuard-B7GVW4oL.js → RouteGuard-gV7nvzi7.js} +2 -2
  146. package/lib/{RouteGuard-B7GVW4oL.js.map → RouteGuard-gV7nvzi7.js.map} +1 -1
  147. package/lib/{SchemaList-Dgc0A8x5.js → SchemaList-_wRy4aQ0.js} +20 -20
  148. package/lib/SchemaList-_wRy4aQ0.js.map +1 -0
  149. package/lib/{SchemaView-DVx-jFN4.js → SchemaView-CRl_cQYH.js} +3 -3
  150. package/lib/{SchemaView-DVx-jFN4.js.map → SchemaView-CRl_cQYH.js.map} +1 -1
  151. package/lib/{SignUp-CRIKdWt9.js → SignUp-B6w5AwHM.js} +2 -2
  152. package/lib/{SignUp-CRIKdWt9.js.map → SignUp-B6w5AwHM.js.map} +1 -1
  153. package/lib/{Slot-ITby_hMb.js → Slot-BkYrj_uC.js} +4 -4
  154. package/lib/{Slot-ITby_hMb.js.map → Slot-BkYrj_uC.js.map} +1 -1
  155. package/lib/{SyntaxHighlight-CqKHkyEy.js → SyntaxHighlight-CH9OUJre.js} +2 -2
  156. package/lib/{SyntaxHighlight-CqKHkyEy.js.map → SyntaxHighlight-CH9OUJre.js.map} +1 -1
  157. package/lib/{Toc-Csq3UNtW.js → Toc-DRxqEsFc.js} +2 -2
  158. package/lib/{Toc-Csq3UNtW.js.map → Toc-DRxqEsFc.js.map} +1 -1
  159. package/lib/{circular-BP4OrHFK.js → circular-wJaV4vh_.js} +2 -2
  160. package/lib/{circular-BP4OrHFK.js.map → circular-wJaV4vh_.js.map} +1 -1
  161. package/lib/{createServer-zu4cDiPe.js → createServer-DN5AJLcN.js} +3 -3
  162. package/lib/{createServer-zu4cDiPe.js.map → createServer-DN5AJLcN.js.map} +1 -1
  163. package/lib/{errors-CPPSp5F4.js → errors-D_5vKvUq.js} +3 -3
  164. package/lib/{errors-CPPSp5F4.js.map → errors-D_5vKvUq.js.map} +1 -1
  165. package/lib/hook-CHXroBFt.js +1503 -0
  166. package/lib/hook-CHXroBFt.js.map +1 -0
  167. package/lib/{index-jWXxqkni.js → index-DJVaRmzI.js} +63 -62
  168. package/lib/index-DJVaRmzI.js.map +1 -0
  169. package/lib/{mutation-C1XCQTQL.js → mutation-BpcyTgWI.js} +2 -2
  170. package/lib/{mutation-C1XCQTQL.js.map → mutation-BpcyTgWI.js.map} +1 -1
  171. package/lib/ui/SyntaxHighlight.js +2 -2
  172. package/lib/{useMutation-BKvPttRn.js → useMutation-N4ockVKi.js} +3 -3
  173. package/lib/{useMutation-BKvPttRn.js.map → useMutation-N4ockVKi.js.map} +1 -1
  174. package/lib/zudoku.auth-auth0.js +1 -1
  175. package/lib/zudoku.auth-azureb2c.js +2 -2
  176. package/lib/zudoku.auth-clerk.js +2 -2
  177. package/lib/zudoku.auth-openid.js +2 -2
  178. package/lib/zudoku.components.js +2756 -3424
  179. package/lib/zudoku.components.js.map +1 -1
  180. package/lib/zudoku.hooks.js +2 -2
  181. package/lib/zudoku.plugin-api-catalog.js +44 -44
  182. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  183. package/lib/zudoku.plugin-api-keys.js +42 -39
  184. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  185. package/lib/zudoku.plugin-custom-pages.js +22 -16
  186. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  187. package/lib/zudoku.plugin-markdown.js +20 -69
  188. package/lib/zudoku.plugin-markdown.js.map +1 -1
  189. package/lib/zudoku.plugin-openapi.js +5 -5
  190. package/lib/zudoku.plugin-search-pagefind.js +2 -2
  191. package/lib/zudoku.plugins.js.map +1 -1
  192. package/package.json +12 -9
  193. package/src/app/ZuploBuildConfig.ts +1 -1
  194. package/src/app/demo.tsx +4 -3
  195. package/src/app/main.css +5 -0
  196. package/src/app/main.tsx +6 -5
  197. package/src/app/standalone.tsx +4 -3
  198. package/src/lib/components/BuildCheck.tsx +1 -1
  199. package/src/lib/components/Header.tsx +5 -3
  200. package/src/lib/components/Heading.tsx +7 -3
  201. package/src/lib/components/Main.tsx +8 -8
  202. package/src/lib/components/MobileTopNavigation.tsx +12 -11
  203. package/src/lib/components/PageProgress.tsx +28 -0
  204. package/src/lib/components/TopNavigation.tsx +57 -66
  205. package/src/lib/components/context/ZudokuContext.ts +50 -32
  206. package/src/lib/components/navigation/{Sidebar.tsx → Navigation.tsx} +18 -16
  207. package/src/lib/components/navigation/{SidebarBadge.tsx → NavigationBadge.tsx} +1 -1
  208. package/src/lib/components/navigation/{SidebarCategory.tsx → NavigationCategory.tsx} +16 -14
  209. package/src/lib/components/navigation/{SidebarItem.tsx → NavigationItem.tsx} +23 -17
  210. package/src/lib/components/navigation/{SidebarWrapper.tsx → NavigationWrapper.tsx} +2 -2
  211. package/src/lib/components/navigation/utils.ts +27 -28
  212. package/src/lib/core/ZudokuContext.ts +9 -15
  213. package/src/lib/core/plugins.ts +2 -2
  214. package/src/lib/hooks/useEvent.test.tsx +7 -5
  215. package/src/lib/plugins/api-catalog/Catalog.tsx +1 -1
  216. package/src/lib/plugins/api-catalog/index.tsx +19 -19
  217. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +6 -5
  218. package/src/lib/plugins/custom-pages/index.tsx +20 -11
  219. package/src/lib/plugins/markdown/MdxPage.tsx +6 -3
  220. package/src/lib/plugins/markdown/index.tsx +19 -40
  221. package/src/lib/plugins/openapi/OperationList.tsx +1 -1
  222. package/src/lib/plugins/openapi/OperationListItem.tsx +1 -1
  223. package/src/lib/plugins/openapi/SchemaList.tsx +2 -2
  224. package/src/lib/plugins/openapi/graphql/gql.ts +5 -5
  225. package/src/lib/plugins/openapi/graphql/graphql.ts +6 -6
  226. package/src/lib/plugins/openapi/index.tsx +11 -11
  227. package/src/lib/plugins/openapi/interfaces.ts +3 -3
  228. package/src/lib/plugins/openapi/util/{createSidebarCategory.tsx → createNavigationCategory.tsx} +6 -5
  229. package/src/lib/plugins/openapi/util/getRoutes.tsx +2 -2
  230. package/src/lib/plugins/openapi/util/methodColorMap.tsx +1 -1
  231. package/src/lib/util/useScrollToAnchor.ts +3 -3
  232. package/dist/config/validators/InputSidebarSchema.d.ts +0 -220
  233. package/dist/config/validators/InputSidebarSchema.js +0 -63
  234. package/dist/config/validators/InputSidebarSchema.js.map +0 -1
  235. package/dist/config/validators/SidebarSchema.d.ts +0 -46
  236. package/dist/config/validators/SidebarSchema.js +0 -118
  237. package/dist/config/validators/SidebarSchema.js.map +0 -1
  238. package/dist/lib/components/navigation/Sidebar.d.ts +0 -5
  239. package/dist/lib/components/navigation/Sidebar.js +0 -10
  240. package/dist/lib/components/navigation/Sidebar.js.map +0 -1
  241. package/dist/lib/components/navigation/SidebarBadge.js.map +0 -1
  242. package/dist/lib/components/navigation/SidebarCategory.d.ts +0 -5
  243. package/dist/lib/components/navigation/SidebarCategory.js.map +0 -1
  244. package/dist/lib/components/navigation/SidebarItem.d.ts +0 -6
  245. package/dist/lib/components/navigation/SidebarItem.js +0 -44
  246. package/dist/lib/components/navigation/SidebarItem.js.map +0 -1
  247. package/dist/lib/components/navigation/SidebarWrapper.js.map +0 -1
  248. package/dist/lib/plugins/markdown/resolver.d.ts +0 -32
  249. package/dist/lib/plugins/markdown/resolver.js +0 -46
  250. package/dist/lib/plugins/markdown/resolver.js.map +0 -1
  251. package/dist/lib/plugins/openapi/util/createSidebarCategory.d.ts +0 -9
  252. package/dist/lib/plugins/openapi/util/createSidebarCategory.js.map +0 -1
  253. package/dist/vite/plugin-sidebar.js.map +0 -1
  254. package/lib/Markdown-C5j8kKSX.js.map +0 -1
  255. package/lib/MdxPage-CKTMf1cR.js.map +0 -1
  256. package/lib/OasProvider-_GzmsbMg.js +0 -33
  257. package/lib/OasProvider-_GzmsbMg.js.map +0 -1
  258. package/lib/SchemaList-Dgc0A8x5.js.map +0 -1
  259. package/lib/hook-7wZANGJP.js +0 -1483
  260. package/lib/hook-7wZANGJP.js.map +0 -1
  261. package/lib/index-jWXxqkni.js.map +0 -1
  262. package/lib/joinPath-B7kNnUX4.js +0 -8
  263. package/lib/joinPath-B7kNnUX4.js.map +0 -1
  264. package/src/lib/plugins/markdown/resolver.ts +0 -59
@@ -10,7 +10,7 @@ import {
10
10
  EyeIcon,
11
11
  EyeOffIcon,
12
12
  PencilLineIcon,
13
- RotateCwIcon,
13
+ RefreshCwIcon,
14
14
  TrashIcon,
15
15
  XIcon,
16
16
  } from "lucide-react";
@@ -278,18 +278,19 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
278
278
  <div className="flex justify-end">
279
279
  {service.updateConsumer && (
280
280
  <Button
281
- size="icon"
282
281
  variant="ghost"
283
282
  onClick={() =>
284
283
  handleStartEdit(consumers.id, consumers.label)
285
284
  }
286
285
  className={cn(
286
+ "flex gap-2",
287
287
  editingConsumerId === consumers.id &&
288
288
  "opacity-0! pointer-events-none",
289
289
  )}
290
290
  disabled={editingConsumerId === consumers.id}
291
291
  >
292
292
  <PencilLineIcon size={16} />
293
+ Edit label
293
294
  </Button>
294
295
  )}
295
296
  {service.rollKey && (
@@ -299,9 +300,9 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
299
300
  title="Roll this key"
300
301
  variant="ghost"
301
302
  disabled={rollKeyMutation.isPending}
302
- className="flex items-center gap-1"
303
+ className="flex items-center gap-2"
303
304
  >
304
- <RotateCwIcon
305
+ <RefreshCwIcon
305
306
  size={16}
306
307
  className={
307
308
  rollKeyMutation.isPending
@@ -309,7 +310,7 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
309
310
  : undefined
310
311
  }
311
312
  />
312
- Roll
313
+ Roll key
313
314
  </Button>
314
315
  </DialogTrigger>
315
316
  <DialogContent>
@@ -1,6 +1,8 @@
1
1
  import { type ComponentType, type ReactNode } from "react";
2
2
  import type { RouteObject } from "react-router";
3
- import type { NavigationPlugin, ZudokuPlugin } from "../../core/plugins.js";
3
+ import type { NavigationItem } from "../../../config/validators/NavigationSchema.js";
4
+ import { traverseNavigation } from "../../components/navigation/utils.js";
5
+ import type { NavigationPlugin } from "../../core/plugins.js";
4
6
  import type { ExposedComponentProps } from "../../util/useExposedProps.js";
5
7
  import { CustomPage } from "./CustomPage.js";
6
8
 
@@ -12,13 +14,20 @@ export type CustomPageConfig = {
12
14
  };
13
15
 
14
16
  export const customPagesPlugin = (
15
- config: CustomPageConfig[],
16
- ): ZudokuPlugin & NavigationPlugin => {
17
- return {
18
- getRoutes: (): RouteObject[] =>
19
- config.map(({ path, ...props }) => ({
20
- path,
21
- element: <CustomPage {...props} />,
22
- })),
23
- };
24
- };
17
+ navigation: NavigationItem[] = [],
18
+ ): NavigationPlugin => ({
19
+ getRoutes: (): RouteObject[] => {
20
+ const customPages: RouteObject[] = [];
21
+
22
+ traverseNavigation(navigation, (item) => {
23
+ if (item.type === "custom-page") {
24
+ customPages.push({
25
+ path: item.path,
26
+ element: <CustomPage {...item} />,
27
+ });
28
+ }
29
+ });
30
+
31
+ return customPages;
32
+ },
33
+ });
@@ -25,12 +25,12 @@ declare global {
25
25
 
26
26
  const MarkdownHeadings = {
27
27
  h2: ({ children, id }) => (
28
- <Heading level={2} id={id} registerSidebarAnchor>
28
+ <Heading level={2} id={id} registerNavigationAnchor>
29
29
  {children}
30
30
  </Heading>
31
31
  ),
32
32
  h3: ({ children, id }) => (
33
- <Heading level={3} id={id} registerSidebarAnchor>
33
+ <Heading level={3} id={id} registerNavigationAnchor>
34
34
  {children}
35
35
  </Heading>
36
36
  ),
@@ -58,7 +58,10 @@ export const MdxPage = ({
58
58
  const pageTitle =
59
59
  tableOfContents.find((item) => item.depth === 1)?.value ?? title;
60
60
  const hidePager =
61
- frontmatter.disablePager ?? defaultOptions?.disablePager ?? false;
61
+ frontmatter.disable_pager ??
62
+ frontmatter.disablePager ??
63
+ defaultOptions?.disablePager ??
64
+ false;
62
65
 
63
66
  const tocEntries =
64
67
  tableOfContents.find((item) => item.depth === 1)?.children ??
@@ -1,10 +1,8 @@
1
1
  import type { Toc } from "@stefanprobst/rehype-extract-toc";
2
2
  import type { MDXProps } from "mdx/types.js";
3
3
  import { type JSX } from "react";
4
- import type { RouteObject } from "react-router";
5
4
  import type { ZudokuDocsConfig } from "../../../config/validators/validate.js";
6
5
  import type { ZudokuPlugin } from "../../core/plugins.js";
7
- import { DocResolver } from "./resolver.js";
8
6
 
9
7
  export interface MarkdownPluginOptions extends ZudokuDocsConfig {
10
8
  fileImports: Record<string, () => Promise<MDXImport>>;
@@ -20,6 +18,7 @@ export type Frontmatter = {
20
18
  category?: string;
21
19
  toc?: boolean;
22
20
  disablePager?: boolean;
21
+ disable_pager?: boolean;
23
22
  };
24
23
 
25
24
  export type MDXImport = {
@@ -30,47 +29,27 @@ export type MDXImport = {
30
29
  };
31
30
 
32
31
  export const markdownPlugin = (
33
- options: MarkdownPluginOptions[],
32
+ options: MarkdownPluginOptions,
34
33
  ): ZudokuPlugin => ({
35
34
  getRoutes: () => {
36
- const routeMap = new Map<string, RouteObject>();
37
- options.forEach(({ fileImports, files, defaultOptions }) =>
38
- Object.entries(fileImports).flatMap(([file, importPromise]) => {
39
- const routePath = DocResolver.resolveRoutePath({
40
- filesGlob: files,
41
- fsPath: file,
42
- });
43
-
44
- if (!routePath) return [];
45
-
46
- if (routeMap.has(routePath)) {
47
- // eslint-disable-next-line no-console
48
- console.warn(
49
- `Duplicate route path found for ${routePath}. Skipping file at '${file}'.`,
50
- );
51
- return [];
52
- }
53
-
54
- const route: RouteObject = {
55
- path: routePath,
56
- lazy: async () => {
57
- const { MdxPage } = await import("./MdxPage.js");
58
- const { default: Component, ...props } = await importPromise();
59
- return {
60
- element: (
61
- <MdxPage
62
- file={file}
63
- mdxComponent={Component}
64
- {...props}
65
- defaultOptions={defaultOptions}
66
- />
67
- ),
68
- };
69
- },
70
- };
71
- routeMap.set(routePath, route);
35
+ return Object.entries(options.fileImports).map(
36
+ ([routePath, importPromise]) => ({
37
+ path: routePath,
38
+ lazy: async () => {
39
+ const { MdxPage } = await import("./MdxPage.js");
40
+ const { default: Component, ...props } = await importPromise();
41
+ return {
42
+ element: (
43
+ <MdxPage
44
+ file={routePath}
45
+ mdxComponent={Component}
46
+ {...props}
47
+ defaultOptions={options.defaultOptions}
48
+ />
49
+ ),
50
+ };
51
+ },
72
52
  }),
73
53
  );
74
- return [...routeMap.values()];
75
54
  },
76
55
  });
@@ -241,7 +241,7 @@ export const OperationList = ({
241
241
  <Heading
242
242
  level={1}
243
243
  id="description"
244
- registerSidebarAnchor
244
+ registerNavigationAnchor
245
245
  className="mb-0"
246
246
  >
247
247
  {schema.tag.name ?? "Other endpoints"}
@@ -53,7 +53,7 @@ export const OperationListItem = ({
53
53
  <Heading
54
54
  level={2}
55
55
  id={operation.slug}
56
- registerSidebarAnchor
56
+ registerNavigationAnchor
57
57
  className="break-all col-span-full"
58
58
  >
59
59
  {operation.summary}
@@ -83,7 +83,7 @@ export function SchemaList() {
83
83
  <Heading
84
84
  level={1}
85
85
  id="schemas"
86
- registerSidebarAnchor
86
+ registerNavigationAnchor
87
87
  className="mb-0"
88
88
  >
89
89
  Schemas
@@ -129,7 +129,7 @@ export function SchemaList() {
129
129
  {schemas.map((schema) => (
130
130
  <Collapsible key={schema.name} className="group" defaultOpen>
131
131
  <Heading
132
- registerSidebarAnchor
132
+ registerNavigationAnchor
133
133
  level={2}
134
134
  className="flex items-center gap-1 justify-between w-fit"
135
135
  id={slugify(schema.name)}
@@ -19,7 +19,7 @@ type Documents = {
19
19
  "\n query OperationsForTag(\n $input: JSON!\n $type: SchemaType!\n $tag: String\n $untagged: Boolean\n ) {\n schema(input: $input, type: $type) {\n servers {\n url\n }\n description\n summary\n title\n url\n version\n tag(slug: $tag, untagged: $untagged) {\n name\n description\n operations {\n slug\n ...OperationsFragment\n }\n next {\n name\n slug\n }\n prev {\n name\n slug\n }\n }\n }\n }\n": typeof types.OperationsForTagDocument;
20
20
  "\n query GetSchemas($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n title\n description\n summary\n components {\n schemas {\n name\n schema\n extensions\n }\n }\n }\n }\n": typeof types.GetSchemasDocument;
21
21
  "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n": typeof types.GetServerQueryDocument;
22
- "\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n": typeof types.GetSidebarOperationsDocument;
22
+ "\n query GetNavigationOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n": typeof types.GetNavigationOperationsDocument;
23
23
  };
24
24
  const documents: Documents = {
25
25
  "\n query ServersQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
@@ -34,8 +34,8 @@ const documents: Documents = {
34
34
  types.GetSchemasDocument,
35
35
  "\n query getServerQuery($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n url\n servers {\n url\n }\n }\n }\n":
36
36
  types.GetServerQueryDocument,
37
- "\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n":
38
- types.GetSidebarOperationsDocument,
37
+ "\n query GetNavigationOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n":
38
+ types.GetNavigationOperationsDocument,
39
39
  };
40
40
 
41
41
  /**
@@ -78,8 +78,8 @@ export function graphql(
78
78
  * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
79
79
  */
80
80
  export function graphql(
81
- source: "\n query GetSidebarOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n",
82
- ): typeof import("./graphql.js").GetSidebarOperationsDocument;
81
+ source: "\n query GetNavigationOperations($input: JSON!, $type: SchemaType!) {\n schema(input: $input, type: $type) {\n tags {\n slug\n name\n extensions\n operations {\n summary\n slug\n method\n operationId\n path\n }\n }\n components {\n schemas {\n __typename\n }\n }\n }\n }\n",
82
+ ): typeof import("./graphql.js").GetNavigationOperationsDocument;
83
83
 
84
84
  export function graphql(source: string) {
85
85
  return (documents as any)[source] ?? {};
@@ -374,12 +374,12 @@ export type GetServerQueryQuery = {
374
374
  };
375
375
  };
376
376
 
377
- export type GetSidebarOperationsQueryVariables = Exact<{
377
+ export type GetNavigationOperationsQueryVariables = Exact<{
378
378
  input: Scalars["JSON"]["input"];
379
379
  type: SchemaType;
380
380
  }>;
381
381
 
382
- export type GetSidebarOperationsQuery = {
382
+ export type GetNavigationOperationsQuery = {
383
383
  __typename?: "Query";
384
384
  schema: {
385
385
  __typename?: "Schema";
@@ -642,8 +642,8 @@ export const GetServerQueryDocument = new TypedDocumentString(`
642
642
  GetServerQueryQuery,
643
643
  GetServerQueryQueryVariables
644
644
  >;
645
- export const GetSidebarOperationsDocument = new TypedDocumentString(`
646
- query GetSidebarOperations($input: JSON!, $type: SchemaType!) {
645
+ export const GetNavigationOperationsDocument = new TypedDocumentString(`
646
+ query GetNavigationOperations($input: JSON!, $type: SchemaType!) {
647
647
  schema(input: $input, type: $type) {
648
648
  tags {
649
649
  slug
@@ -665,6 +665,6 @@ export const GetSidebarOperationsDocument = new TypedDocumentString(`
665
665
  }
666
666
  }
667
667
  `) as unknown as TypedDocumentString<
668
- GetSidebarOperationsQuery,
669
- GetSidebarOperationsQueryVariables
668
+ GetNavigationOperationsQuery,
669
+ GetNavigationOperationsQueryVariables
670
670
  >;
@@ -7,16 +7,16 @@ import { Button } from "../../ui/Button.js";
7
7
  import { joinUrl } from "../../util/joinUrl.js";
8
8
  import { GraphQLClient } from "./client/GraphQLClient.js";
9
9
  import { createQuery } from "./client/useCreateQuery.js";
10
- import type { GetSidebarOperationsQuery as GetSidebarOperationsQueryResult } from "./graphql/graphql.js";
10
+ import type { GetNavigationOperationsQuery as GetNavigationOperationsQueryResult } from "./graphql/graphql.js";
11
11
  import { graphql } from "./graphql/index.js";
12
12
  import { type OasPluginConfig } from "./interfaces.js";
13
13
  import type { PlaygroundContentProps } from "./playground/Playground.js";
14
14
  import { PlaygroundDialog } from "./playground/PlaygroundDialog.js";
15
- import { createSidebarCategory } from "./util/createSidebarCategory.js";
15
+ import { createNavigationCategory } from "./util/createNavigationCategory.js";
16
16
  import { getRoutes, getVersions } from "./util/getRoutes.js";
17
17
 
18
- export const GetSidebarOperationsQuery = graphql(`
19
- query GetSidebarOperations($input: JSON!, $type: SchemaType!) {
18
+ export const GetNavigationOperationsQuery = graphql(`
19
+ query GetNavigationOperations($input: JSON!, $type: SchemaType!) {
20
20
  schema(input: $input, type: $type) {
21
21
  tags {
22
22
  slug
@@ -40,14 +40,14 @@ export const GetSidebarOperationsQuery = graphql(`
40
40
  `);
41
41
 
42
42
  export type OperationResult =
43
- GetSidebarOperationsQueryResult["schema"]["tags"][number]["operations"][number];
43
+ GetNavigationOperationsQueryResult["schema"]["tags"][number]["operations"][number];
44
44
 
45
45
  export type OpenApiPluginOptions = OasPluginConfig;
46
46
 
47
47
  export const UNTAGGED_PATH = "~endpoints";
48
48
 
49
49
  export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
50
- const basePath = joinUrl(config.navigationId ?? "/reference");
50
+ const basePath = joinUrl(config.path);
51
51
  const client = new GraphQLClient(config);
52
52
 
53
53
  return {
@@ -117,7 +117,7 @@ export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
117
117
  );
118
118
  },
119
119
  }),
120
- getSidebar: async (path, context) => {
120
+ getNavigation: async (path, context) => {
121
121
  if (!matchPath({ path: basePath, end: false }, path)) {
122
122
  return [];
123
123
  }
@@ -133,7 +133,7 @@ export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
133
133
  const { type } = config;
134
134
  const input = type === "file" ? config.input[version!] : config.input;
135
135
 
136
- const query = createQuery(client, GetSidebarOperationsQuery, {
136
+ const query = createQuery(client, GetNavigationOperationsQuery, {
137
137
  type,
138
138
  input,
139
139
  });
@@ -150,7 +150,7 @@ export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
150
150
  const isCollapsible =
151
151
  tag.extensions?.["x-zudoku-collapsible"] ?? true;
152
152
 
153
- return createSidebarCategory({
153
+ return createNavigationCategory({
154
154
  label: tag.name,
155
155
  path: categoryPath,
156
156
  operations: tag.operations,
@@ -165,7 +165,7 @@ export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
165
165
 
166
166
  if (untaggedOperations) {
167
167
  categories.push(
168
- createSidebarCategory({
168
+ createNavigationCategory({
169
169
  label: "Other endpoints",
170
170
  path: joinUrl(basePath, versionParam, UNTAGGED_PATH),
171
171
  operations: untaggedOperations,
@@ -178,7 +178,7 @@ export const openApiPlugin = (config: OasPluginConfig): ZudokuPlugin => {
178
178
  categories.push({
179
179
  type: "link" as const,
180
180
  label: "Schemas",
181
- href: joinUrl(basePath, versionParam, "~schemas"),
181
+ to: joinUrl(basePath, versionParam, "~schemas"),
182
182
  });
183
183
  }
184
184
 
@@ -32,7 +32,7 @@ type Content = {
32
32
  examples?: Array<Example> | null;
33
33
  };
34
34
 
35
- export type transformExamples = (options: {
35
+ export type TransformExamplesFn = (options: {
36
36
  content: Content[];
37
37
  context: ZudokuContext;
38
38
  auth: AuthState;
@@ -42,7 +42,7 @@ export type transformExamples = (options: {
42
42
 
43
43
  type BaseOasConfig = {
44
44
  server?: string;
45
- navigationId?: string;
45
+ path?: string;
46
46
  skipPreload?: boolean;
47
47
  tagPages?: Array<string>;
48
48
  schemaImports?: SchemaImports;
@@ -52,7 +52,7 @@ type BaseOasConfig = {
52
52
  disableSidecar?: boolean;
53
53
  showVersionSelect?: "always" | "if-available" | "hide";
54
54
  expandAllTags?: boolean;
55
- transformExamples?: transformExamples;
55
+ transformExamples?: TransformExamplesFn;
56
56
  };
57
57
  };
58
58
 
@@ -1,8 +1,8 @@
1
- import type { SidebarItem } from "../../../../config/validators/SidebarSchema.js";
1
+ import type { NavigationItem } from "../../../../config/validators/NavigationSchema.js";
2
2
  import type { OperationResult } from "../index.js";
3
3
  import { MethodColorMap } from "./methodColorMap.js";
4
4
 
5
- export const createSidebarCategory = ({
5
+ export const createNavigationCategory = ({
6
6
  label,
7
7
  path,
8
8
  operations,
@@ -14,12 +14,13 @@ export const createSidebarCategory = ({
14
14
  operations: OperationResult[];
15
15
  collapsible?: boolean;
16
16
  collapsed?: boolean;
17
- }): SidebarItem => ({
17
+ }): NavigationItem => ({
18
18
  type: "category",
19
19
  label,
20
20
  link: {
21
21
  type: "doc" as const,
22
- id: path,
22
+ path,
23
+ file: path,
23
24
  label,
24
25
  },
25
26
  collapsible,
@@ -27,7 +28,7 @@ export const createSidebarCategory = ({
27
28
  items: operations.map((operation) => ({
28
29
  type: "link" as const,
29
30
  label: operation.summary ?? operation.path,
30
- href: `${path}#${operation.slug}`,
31
+ to: `${path}#${operation.slug}`,
31
32
  badge: {
32
33
  label: operation.method,
33
34
  color: MethodColorMap[operation.method.toLowerCase()]!,
@@ -12,7 +12,7 @@ import type { GraphQLClient } from "../client/GraphQLClient.js";
12
12
  import { useCreateQuery } from "../client/useCreateQuery.js";
13
13
  import { useOasConfig } from "../context.js";
14
14
  import {
15
- GetSidebarOperationsQuery,
15
+ GetNavigationOperationsQuery,
16
16
  type OpenApiPluginOptions,
17
17
  UNTAGGED_PATH,
18
18
  } from "../index.js";
@@ -71,7 +71,7 @@ const NonTagPagesOperationList = ({
71
71
  const { type, input } = useOasConfig();
72
72
  const { tag: currentTag } = useParams();
73
73
  const location = useLocation();
74
- const query = useCreateQuery(GetSidebarOperationsQuery, { type, input });
74
+ const query = useCreateQuery(GetNavigationOperationsQuery, { type, input });
75
75
  const {
76
76
  data: { schema },
77
77
  } = useSuspenseQuery(query);
@@ -1,4 +1,4 @@
1
- import { ColorMap } from "../../../components/navigation/SidebarBadge.js";
1
+ import { type ColorMap } from "../../../components/navigation/NavigationBadge.js";
2
2
 
3
3
  export const MethodColorMap: Record<string, keyof typeof ColorMap> = {
4
4
  get: "green",
@@ -1,7 +1,7 @@
1
1
  import { useCallback, useEffect, useRef } from "react";
2
2
  import { useLocation } from "react-router";
3
3
  import { useViewportAnchor } from "../components/context/ViewportAnchorContext.js";
4
- import { DATA_ANCHOR_ATTR } from "../components/navigation/SidebarItem.js";
4
+ import { DATA_ANCHOR_ATTR } from "../components/navigation/NavigationItem.js";
5
5
  import { scrollIntoViewIfNeeded } from "./scrollIntoViewIfNeeded.js";
6
6
 
7
7
  export const useScrollToHash = () => {
@@ -11,8 +11,8 @@ export const useScrollToHash = () => {
11
11
  (hash: string) => {
12
12
  const cleanHash = hash.replace(/^#/, "");
13
13
 
14
- // Operation list items might have subdivisions that the sidebar doesn't show.
15
- // The subdivisions are separated by a slash so we need to remove everything before the slash to get the sidebar correct item.
14
+ // Operation list items might have subdivisions that the navigation doesn't show.
15
+ // The subdivisions are separated by a slash so we need to remove everything before the slash to get the navigation correct item.
16
16
  const linkHash = cleanHash.split("/").at(0)!;
17
17
  const element = document.getElementById(decodeURIComponent(cleanHash));
18
18