zudoku 0.47.1 → 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 (325) hide show
  1. package/dist/app/ZuploBuildConfig.d.ts +11 -121
  2. package/dist/app/ZuploBuildConfig.js +8 -8
  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/entry.client.d.ts +0 -2
  7. package/dist/app/entry.client.js +0 -2
  8. package/dist/app/entry.client.js.map +1 -1
  9. package/dist/app/entry.server.d.ts +0 -2
  10. package/dist/app/entry.server.js +0 -2
  11. package/dist/app/entry.server.js.map +1 -1
  12. package/dist/app/env.d.ts +7 -7
  13. package/dist/app/env.js +8 -0
  14. package/dist/app/env.js.map +1 -1
  15. package/dist/app/main.d.ts +1 -0
  16. package/dist/app/main.js +6 -5
  17. package/dist/app/main.js.map +1 -1
  18. package/dist/app/standalone.js +4 -3
  19. package/dist/app/standalone.js.map +1 -1
  20. package/dist/config/loader.js +1 -2
  21. package/dist/config/loader.js.map +1 -1
  22. package/dist/config/validators/BuildSchema.d.ts +20 -44
  23. package/dist/config/validators/BuildSchema.js +3 -14
  24. package/dist/config/validators/BuildSchema.js.map +1 -1
  25. package/dist/config/validators/InputNavigationSchema.d.ts +7217 -0
  26. package/dist/config/validators/InputNavigationSchema.js +74 -0
  27. package/dist/config/validators/InputNavigationSchema.js.map +1 -0
  28. package/dist/config/validators/InputNavigationSchema.test-d.d.ts +1 -0
  29. package/dist/config/validators/InputNavigationSchema.test-d.js +146 -0
  30. package/dist/config/validators/InputNavigationSchema.test-d.js.map +1 -0
  31. package/dist/config/validators/NavigationSchema.d.ts +44 -0
  32. package/dist/config/validators/NavigationSchema.js +95 -0
  33. package/dist/config/validators/NavigationSchema.js.map +1 -0
  34. package/dist/config/validators/icon-types.d.ts +2 -1
  35. package/dist/config/validators/icon-types.js +1775 -1
  36. package/dist/config/validators/icon-types.js.map +1 -1
  37. package/dist/config/validators/validate.d.ts +451 -5666
  38. package/dist/config/validators/validate.js +59 -66
  39. package/dist/config/validators/validate.js.map +1 -1
  40. package/dist/config/validators/validate.test.js +0 -2
  41. package/dist/config/validators/validate.test.js.map +1 -1
  42. package/dist/index.d.ts +1 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/lib/auth/issuer.js +1 -1
  45. package/dist/lib/auth/issuer.js.map +1 -1
  46. package/dist/lib/auth/issuer.test.js +1 -1
  47. package/dist/lib/auth/issuer.test.js.map +1 -1
  48. package/dist/lib/authentication/components/CallbackHandler.js +1 -1
  49. package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
  50. package/dist/lib/components/BuildCheck.js +1 -1
  51. package/dist/lib/components/BuildCheck.js.map +1 -1
  52. package/dist/lib/components/Framed.d.ts +7 -0
  53. package/dist/lib/components/Framed.js +26 -0
  54. package/dist/lib/components/Framed.js.map +1 -0
  55. package/dist/lib/components/Header.js +10 -9
  56. package/dist/lib/components/Header.js.map +1 -1
  57. package/dist/lib/components/Heading.d.ts +6 -2
  58. package/dist/lib/components/Heading.js +2 -2
  59. package/dist/lib/components/Heading.js.map +1 -1
  60. package/dist/lib/components/Main.js +4 -4
  61. package/dist/lib/components/Main.js.map +1 -1
  62. package/dist/lib/components/MobileTopNavigation.js +6 -5
  63. package/dist/lib/components/MobileTopNavigation.js.map +1 -1
  64. package/dist/lib/components/PageProgress.d.ts +1 -0
  65. package/dist/lib/components/PageProgress.js +20 -0
  66. package/dist/lib/components/PageProgress.js.map +1 -0
  67. package/dist/lib/components/TopNavigation.d.ts +2 -3
  68. package/dist/lib/components/TopNavigation.js +45 -44
  69. package/dist/lib/components/TopNavigation.js.map +1 -1
  70. package/dist/lib/components/context/ZudokuContext.d.ts +3 -7
  71. package/dist/lib/components/context/ZudokuContext.js +44 -26
  72. package/dist/lib/components/context/ZudokuContext.js.map +1 -1
  73. package/dist/lib/components/navigation/Navigation.d.ts +5 -0
  74. package/dist/lib/components/navigation/Navigation.js +12 -0
  75. package/dist/lib/components/navigation/Navigation.js.map +1 -0
  76. package/dist/lib/components/navigation/{SidebarBadge.d.ts → NavigationBadge.d.ts} +1 -1
  77. package/dist/lib/components/navigation/{SidebarBadge.js → NavigationBadge.js} +2 -2
  78. package/dist/lib/components/navigation/NavigationBadge.js.map +1 -0
  79. package/dist/lib/components/navigation/NavigationCategory.d.ts +5 -0
  80. package/dist/lib/components/navigation/{SidebarCategory.js → NavigationCategory.js} +14 -12
  81. package/dist/lib/components/navigation/NavigationCategory.js.map +1 -0
  82. package/dist/lib/components/navigation/NavigationItem.d.ts +6 -0
  83. package/dist/lib/components/navigation/NavigationItem.js +47 -0
  84. package/dist/lib/components/navigation/NavigationItem.js.map +1 -0
  85. package/dist/lib/components/navigation/{SidebarWrapper.d.ts → NavigationWrapper.d.ts} +1 -1
  86. package/dist/lib/components/navigation/{SidebarWrapper.js → NavigationWrapper.js} +3 -3
  87. package/dist/lib/components/navigation/NavigationWrapper.js.map +1 -0
  88. package/dist/lib/components/navigation/utils.d.ts +7 -9
  89. package/dist/lib/components/navigation/utils.js +17 -17
  90. package/dist/lib/components/navigation/utils.js.map +1 -1
  91. package/dist/lib/core/ZudokuContext.d.ts +6 -8
  92. package/dist/lib/core/ZudokuContext.js +5 -7
  93. package/dist/lib/core/ZudokuContext.js.map +1 -1
  94. package/dist/lib/core/plugins.d.ts +2 -2
  95. package/dist/lib/hooks/useEvent.test.js +5 -3
  96. package/dist/lib/hooks/useEvent.test.js.map +1 -1
  97. package/dist/lib/plugins/api-catalog/Catalog.d.ts +1 -1
  98. package/dist/lib/plugins/api-catalog/index.d.ts +6 -6
  99. package/dist/lib/plugins/api-catalog/index.js +10 -10
  100. package/dist/lib/plugins/api-catalog/index.js.map +1 -1
  101. package/dist/lib/plugins/api-keys/SettingsApiKeys.js +6 -6
  102. package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
  103. package/dist/lib/plugins/custom-pages/index.d.ts +3 -2
  104. package/dist/lib/plugins/custom-pages/index.js +15 -8
  105. package/dist/lib/plugins/custom-pages/index.js.map +1 -1
  106. package/dist/lib/plugins/markdown/MdxPage.js +6 -3
  107. package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
  108. package/dist/lib/plugins/markdown/index.d.ts +2 -1
  109. package/dist/lib/plugins/markdown/index.js +9 -26
  110. package/dist/lib/plugins/markdown/index.js.map +1 -1
  111. package/dist/lib/plugins/openapi/OperationList.js +1 -1
  112. package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
  113. package/dist/lib/plugins/openapi/OperationListItem.js +1 -1
  114. package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
  115. package/dist/lib/plugins/openapi/SchemaList.js +1 -1
  116. package/dist/lib/plugins/openapi/SchemaList.js.map +1 -1
  117. package/dist/lib/plugins/openapi/graphql/gql.d.ts +1 -1
  118. package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
  119. package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
  120. package/dist/lib/plugins/openapi/graphql/graphql.d.ts +3 -3
  121. package/dist/lib/plugins/openapi/graphql/graphql.js +2 -2
  122. package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
  123. package/dist/lib/plugins/openapi/index.d.ts +3 -3
  124. package/dist/lib/plugins/openapi/index.js +9 -9
  125. package/dist/lib/plugins/openapi/index.js.map +1 -1
  126. package/dist/lib/plugins/openapi/interfaces.d.ts +3 -3
  127. package/dist/lib/plugins/openapi/schema/SchemaView.js +1 -1
  128. package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
  129. package/dist/lib/plugins/openapi/util/createNavigationCategory.d.ts +9 -0
  130. package/dist/lib/plugins/openapi/util/{createSidebarCategory.js → createNavigationCategory.js} +5 -4
  131. package/dist/lib/plugins/openapi/util/createNavigationCategory.js.map +1 -0
  132. package/dist/lib/plugins/openapi/util/getRoutes.js +2 -2
  133. package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
  134. package/dist/lib/plugins/openapi/util/methodColorMap.d.ts +1 -1
  135. package/dist/lib/ui/CodeBlock.js +1 -1
  136. package/dist/lib/ui/CodeBlock.js.map +1 -1
  137. package/dist/lib/util/MdxComponents.d.ts +6 -0
  138. package/dist/lib/util/MdxComponents.js +4 -2
  139. package/dist/lib/util/MdxComponents.js.map +1 -1
  140. package/dist/lib/util/useScrollToAnchor.js +3 -3
  141. package/dist/lib/util/useScrollToAnchor.js.map +1 -1
  142. package/dist/vite/api/SchemaManager.d.ts +4 -4
  143. package/dist/vite/api/SchemaManager.js +19 -19
  144. package/dist/vite/api/SchemaManager.js.map +1 -1
  145. package/dist/vite/api/SchemaManager.test.js +4 -4
  146. package/dist/vite/api/SchemaManager.test.js.map +1 -1
  147. package/dist/vite/config.js +1 -0
  148. package/dist/vite/config.js.map +1 -1
  149. package/dist/vite/css/plugin.js +11 -0
  150. package/dist/vite/css/plugin.js.map +1 -1
  151. package/dist/vite/plugin-api.js +8 -8
  152. package/dist/vite/plugin-api.js.map +1 -1
  153. package/dist/vite/plugin-config-reload.js +2 -0
  154. package/dist/vite/plugin-config-reload.js.map +1 -1
  155. package/dist/vite/plugin-custom-pages.js +2 -2
  156. package/dist/vite/plugin-custom-pages.js.map +1 -1
  157. package/dist/vite/plugin-docs.js +61 -59
  158. package/dist/vite/plugin-docs.js.map +1 -1
  159. package/dist/vite/plugin-mdx.js +4 -2
  160. package/dist/vite/plugin-mdx.js.map +1 -1
  161. package/dist/vite/{plugin-sidebar.d.ts → plugin-navigation.d.ts} +1 -1
  162. package/dist/vite/{plugin-sidebar.js → plugin-navigation.js} +20 -19
  163. package/dist/vite/plugin-navigation.js.map +1 -0
  164. package/dist/vite/plugin-theme.d.ts +8 -0
  165. package/dist/vite/plugin-theme.js +223 -0
  166. package/dist/vite/plugin-theme.js.map +1 -0
  167. package/dist/vite/plugin-theme.test.d.ts +1 -0
  168. package/dist/vite/plugin-theme.test.js +270 -0
  169. package/dist/vite/plugin-theme.test.js.map +1 -0
  170. package/dist/vite/plugin.js +4 -6
  171. package/dist/vite/plugin.js.map +1 -1
  172. package/dist/vite/shadcn-registry.d.ts +45 -0
  173. package/dist/vite/shadcn-registry.js +29 -0
  174. package/dist/vite/shadcn-registry.js.map +1 -0
  175. package/lib/Drawer-BzkOKwgC.js.map +1 -1
  176. package/lib/{Markdown-r4buN85T.js → Markdown-DCAIYXF5.js} +885 -840
  177. package/lib/Markdown-DCAIYXF5.js.map +1 -0
  178. package/lib/{MdxPage-DYKsTerz.js → MdxPage-Cf9YXWoC.js} +30 -30
  179. package/lib/MdxPage-Cf9YXWoC.js.map +1 -0
  180. package/lib/OasProvider-JMVTfG6_.js +35 -0
  181. package/lib/OasProvider-JMVTfG6_.js.map +1 -0
  182. package/lib/{OperationList-BCVHtZNK.js → OperationList-m4tFCI4S.js} +8 -8
  183. package/lib/{OperationList-BCVHtZNK.js.map → OperationList-m4tFCI4S.js.map} +1 -1
  184. package/lib/{RouteGuard-B7GVW4oL.js → RouteGuard-gV7nvzi7.js} +2 -2
  185. package/lib/{RouteGuard-B7GVW4oL.js.map → RouteGuard-gV7nvzi7.js.map} +1 -1
  186. package/lib/{SchemaList-1oJKvBxh.js → SchemaList-_wRy4aQ0.js} +20 -20
  187. package/lib/SchemaList-_wRy4aQ0.js.map +1 -0
  188. package/lib/{SchemaView-CTqaB-79.js → SchemaView-CRl_cQYH.js} +13 -13
  189. package/lib/{SchemaView-CTqaB-79.js.map → SchemaView-CRl_cQYH.js.map} +1 -1
  190. package/lib/{SignUp-CRIKdWt9.js → SignUp-B6w5AwHM.js} +2 -2
  191. package/lib/{SignUp-CRIKdWt9.js.map → SignUp-B6w5AwHM.js.map} +1 -1
  192. package/lib/{Slot-B5qSAnwR.js → Slot-BkYrj_uC.js} +4 -4
  193. package/lib/{Slot-B5qSAnwR.js.map → Slot-BkYrj_uC.js.map} +1 -1
  194. package/lib/{SyntaxHighlight-CqKHkyEy.js → SyntaxHighlight-CH9OUJre.js} +2 -2
  195. package/lib/{SyntaxHighlight-CqKHkyEy.js.map → SyntaxHighlight-CH9OUJre.js.map} +1 -1
  196. package/lib/{Toc-lxYQEOzX.js → Toc-DRxqEsFc.js} +2 -2
  197. package/lib/{Toc-lxYQEOzX.js.map → Toc-DRxqEsFc.js.map} +1 -1
  198. package/lib/{circular-ZGGPtwMq.js → circular-wJaV4vh_.js} +2 -2
  199. package/lib/{circular-ZGGPtwMq.js.map → circular-wJaV4vh_.js.map} +1 -1
  200. package/lib/clerk-yAKDC3Qz.js.map +1 -1
  201. package/lib/{createServer-DUBpXfvA.js → createServer-DN5AJLcN.js} +3 -3
  202. package/lib/{createServer-DUBpXfvA.js.map → createServer-DN5AJLcN.js.map} +1 -1
  203. package/lib/{errors-D27ZTQgx.js → errors-D_5vKvUq.js} +10 -10
  204. package/lib/{errors-D27ZTQgx.js.map → errors-D_5vKvUq.js.map} +1 -1
  205. package/lib/hook-CHXroBFt.js +1503 -0
  206. package/lib/hook-CHXroBFt.js.map +1 -0
  207. package/lib/index-CrcNWbel.js.map +1 -1
  208. package/lib/{index-Cucjfk3D.js → index-DJVaRmzI.js} +63 -62
  209. package/lib/index-DJVaRmzI.js.map +1 -0
  210. package/lib/index-QzXzw_ra.js.map +1 -1
  211. package/lib/{mutation-C1XCQTQL.js → mutation-BpcyTgWI.js} +2 -2
  212. package/lib/{mutation-C1XCQTQL.js.map → mutation-BpcyTgWI.js.map} +1 -1
  213. package/lib/ui/CodeBlock.js +7 -7
  214. package/lib/ui/CodeBlock.js.map +1 -1
  215. package/lib/ui/SyntaxHighlight.js +2 -2
  216. package/lib/{useMutation-BKvPttRn.js → useMutation-N4ockVKi.js} +3 -3
  217. package/lib/{useMutation-BKvPttRn.js.map → useMutation-N4ockVKi.js.map} +1 -1
  218. package/lib/zudoku.auth-auth0.js +1 -1
  219. package/lib/zudoku.auth-azureb2c.js +2 -2
  220. package/lib/zudoku.auth-clerk.js +2 -2
  221. package/lib/zudoku.auth-openid.js +2 -2
  222. package/lib/zudoku.components.js +2756 -3423
  223. package/lib/zudoku.components.js.map +1 -1
  224. package/lib/zudoku.hooks.js +2 -2
  225. package/lib/zudoku.plugin-api-catalog.js +44 -44
  226. package/lib/zudoku.plugin-api-catalog.js.map +1 -1
  227. package/lib/zudoku.plugin-api-keys.js +84 -73
  228. package/lib/zudoku.plugin-api-keys.js.map +1 -1
  229. package/lib/zudoku.plugin-custom-pages.js +22 -16
  230. package/lib/zudoku.plugin-custom-pages.js.map +1 -1
  231. package/lib/zudoku.plugin-markdown.js +20 -69
  232. package/lib/zudoku.plugin-markdown.js.map +1 -1
  233. package/lib/zudoku.plugin-openapi.js +5 -5
  234. package/lib/zudoku.plugin-search-pagefind.js +2 -2
  235. package/lib/zudoku.plugins.js.map +1 -1
  236. package/package.json +16 -13
  237. package/src/app/ZuploBuildConfig.ts +8 -8
  238. package/src/app/defaultTheme.css +68 -49
  239. package/src/app/demo.tsx +4 -3
  240. package/src/app/entry.client.tsx +0 -2
  241. package/src/app/entry.server.tsx +0 -2
  242. package/src/app/env.ts +8 -0
  243. package/src/app/main.css +6 -52
  244. package/src/app/main.tsx +7 -5
  245. package/src/app/standalone.tsx +4 -3
  246. package/src/lib/auth/issuer.test.ts +1 -1
  247. package/src/lib/auth/issuer.ts +1 -1
  248. package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
  249. package/src/lib/components/BuildCheck.tsx +1 -1
  250. package/src/lib/components/Framed.tsx +51 -0
  251. package/src/lib/components/Header.tsx +5 -3
  252. package/src/lib/components/Heading.tsx +7 -3
  253. package/src/lib/components/Main.tsx +8 -8
  254. package/src/lib/components/MobileTopNavigation.tsx +16 -11
  255. package/src/lib/components/PageProgress.tsx +28 -0
  256. package/src/lib/components/TopNavigation.tsx +57 -66
  257. package/src/lib/components/context/ZudokuContext.ts +50 -32
  258. package/src/lib/components/navigation/{Sidebar.tsx → Navigation.tsx} +18 -16
  259. package/src/lib/components/navigation/{SidebarBadge.tsx → NavigationBadge.tsx} +1 -1
  260. package/src/lib/components/navigation/{SidebarCategory.tsx → NavigationCategory.tsx} +16 -14
  261. package/src/lib/components/navigation/{SidebarItem.tsx → NavigationItem.tsx} +23 -17
  262. package/src/lib/components/navigation/{SidebarWrapper.tsx → NavigationWrapper.tsx} +2 -2
  263. package/src/lib/components/navigation/utils.ts +27 -28
  264. package/src/lib/core/ZudokuContext.ts +9 -15
  265. package/src/lib/core/plugins.ts +2 -2
  266. package/src/lib/hooks/useEvent.test.tsx +7 -5
  267. package/src/lib/plugins/api-catalog/Catalog.tsx +1 -1
  268. package/src/lib/plugins/api-catalog/index.tsx +19 -19
  269. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +14 -10
  270. package/src/lib/plugins/custom-pages/index.tsx +20 -11
  271. package/src/lib/plugins/markdown/MdxPage.tsx +6 -3
  272. package/src/lib/plugins/markdown/index.tsx +19 -40
  273. package/src/lib/plugins/openapi/OperationList.tsx +1 -1
  274. package/src/lib/plugins/openapi/OperationListItem.tsx +1 -1
  275. package/src/lib/plugins/openapi/SchemaList.tsx +2 -2
  276. package/src/lib/plugins/openapi/graphql/gql.ts +5 -5
  277. package/src/lib/plugins/openapi/graphql/graphql.ts +6 -6
  278. package/src/lib/plugins/openapi/index.tsx +11 -11
  279. package/src/lib/plugins/openapi/interfaces.ts +3 -3
  280. package/src/lib/plugins/openapi/schema/SchemaView.tsx +1 -1
  281. package/src/lib/plugins/openapi/util/{createSidebarCategory.tsx → createNavigationCategory.tsx} +6 -5
  282. package/src/lib/plugins/openapi/util/getRoutes.tsx +2 -2
  283. package/src/lib/plugins/openapi/util/methodColorMap.tsx +1 -1
  284. package/src/lib/ui/CodeBlock.tsx +1 -1
  285. package/src/lib/util/MdxComponents.tsx +13 -2
  286. package/src/lib/util/useScrollToAnchor.ts +3 -3
  287. package/dist/config/validators/InputSidebarSchema.d.ts +0 -220
  288. package/dist/config/validators/InputSidebarSchema.js +0 -63
  289. package/dist/config/validators/InputSidebarSchema.js.map +0 -1
  290. package/dist/config/validators/SidebarSchema.d.ts +0 -46
  291. package/dist/config/validators/SidebarSchema.js +0 -118
  292. package/dist/config/validators/SidebarSchema.js.map +0 -1
  293. package/dist/lib/components/navigation/Sidebar.d.ts +0 -5
  294. package/dist/lib/components/navigation/Sidebar.js +0 -10
  295. package/dist/lib/components/navigation/Sidebar.js.map +0 -1
  296. package/dist/lib/components/navigation/SidebarBadge.js.map +0 -1
  297. package/dist/lib/components/navigation/SidebarCategory.d.ts +0 -5
  298. package/dist/lib/components/navigation/SidebarCategory.js.map +0 -1
  299. package/dist/lib/components/navigation/SidebarItem.d.ts +0 -6
  300. package/dist/lib/components/navigation/SidebarItem.js +0 -44
  301. package/dist/lib/components/navigation/SidebarItem.js.map +0 -1
  302. package/dist/lib/components/navigation/SidebarWrapper.js.map +0 -1
  303. package/dist/lib/plugins/markdown/resolver.d.ts +0 -32
  304. package/dist/lib/plugins/markdown/resolver.js +0 -46
  305. package/dist/lib/plugins/markdown/resolver.js.map +0 -1
  306. package/dist/lib/plugins/openapi/util/createSidebarCategory.d.ts +0 -9
  307. package/dist/lib/plugins/openapi/util/createSidebarCategory.js.map +0 -1
  308. package/dist/vite/plugin-configure-tailwind.d.ts +0 -2
  309. package/dist/vite/plugin-configure-tailwind.js +0 -38
  310. package/dist/vite/plugin-configure-tailwind.js.map +0 -1
  311. package/dist/vite/plugin-sidebar.js.map +0 -1
  312. package/dist/vite/plugin-theme-css.d.ts +0 -5
  313. package/dist/vite/plugin-theme-css.js +0 -77
  314. package/dist/vite/plugin-theme-css.js.map +0 -1
  315. package/lib/Markdown-r4buN85T.js.map +0 -1
  316. package/lib/MdxPage-DYKsTerz.js.map +0 -1
  317. package/lib/OasProvider-8vNiLpIG.js +0 -33
  318. package/lib/OasProvider-8vNiLpIG.js.map +0 -1
  319. package/lib/SchemaList-1oJKvBxh.js.map +0 -1
  320. package/lib/hook-7wZANGJP.js +0 -1483
  321. package/lib/hook-7wZANGJP.js.map +0 -1
  322. package/lib/index-Cucjfk3D.js.map +0 -1
  323. package/lib/joinPath-B7kNnUX4.js +0 -8
  324. package/lib/joinPath-B7kNnUX4.js.map +0 -1
  325. package/src/lib/plugins/markdown/resolver.ts +0 -59
@@ -4,13 +4,13 @@ import { useNavigation } from "react-router";
4
4
  import { Drawer, DrawerTrigger } from "zudoku/ui/Drawer.js";
5
5
  import { cn } from "../util/cn.js";
6
6
  import { useCurrentNavigation, useZudoku } from "./context/ZudokuContext.js";
7
- import { Sidebar } from "./navigation/Sidebar.js";
7
+ import { Navigation } from "./navigation/Navigation.js";
8
8
  import { Slot } from "./Slot.js";
9
9
 
10
10
  export const Main = ({ children }: PropsWithChildren) => {
11
11
  const [isDrawerOpen, setDrawerOpen] = useState(false);
12
- const { sidebar } = useCurrentNavigation();
13
- const hasSidebar = sidebar.length > 0;
12
+ const { navigation } = useCurrentNavigation();
13
+ const hasNavigation = navigation.length > 0;
14
14
  const isNavigating = useNavigation().state === "loading";
15
15
  const { options } = useZudoku();
16
16
 
@@ -20,13 +20,13 @@ export const Main = ({ children }: PropsWithChildren) => {
20
20
  open={isDrawerOpen}
21
21
  onOpenChange={(open) => setDrawerOpen(open)}
22
22
  >
23
- {hasSidebar && (
24
- <Sidebar
23
+ {hasNavigation && (
24
+ <Navigation
25
25
  onRequestClose={() => setDrawerOpen(false)}
26
- sidebar={sidebar}
26
+ navigation={navigation}
27
27
  />
28
28
  )}
29
- {hasSidebar && (
29
+ {hasNavigation && (
30
30
  <div className="lg:hidden -mx-4 px-4 py-2 sticky bg-background/80 backdrop-blur-xs z-10 top-0 start-0 end-0 border-b">
31
31
  <DrawerTrigger className="flex items-center gap-2 px-4">
32
32
  <PanelLeftIcon size={16} strokeWidth={1.5} />
@@ -38,7 +38,7 @@ export const Main = ({ children }: PropsWithChildren) => {
38
38
  data-pagefind-body
39
39
  className={cn(
40
40
  "px-4 lg:pe-8 lg:px-8",
41
- !hasSidebar && "col-span-full",
41
+ !hasNavigation && "col-span-full",
42
42
  isNavigating && "animate-pulse",
43
43
  )}
44
44
  >
@@ -11,15 +11,19 @@ import {
11
11
  import { useZudoku } from "./context/ZudokuContext.js";
12
12
  import { PoweredByZudoku } from "./navigation/PoweredByZudoku.js";
13
13
  import { isHiddenItem } from "./navigation/utils.js";
14
+ import { PageProgress } from "./PageProgress.js";
14
15
  import { Search } from "./Search.js";
16
+ import { Slot } from "./Slot.js";
15
17
  import { ThemeSwitch } from "./ThemeSwitch.js";
16
- import { PageProgress, TopNavItem } from "./TopNavigation.js";
18
+ import { TopNavItem } from "./TopNavigation.js";
17
19
 
18
20
  export const MobileTopNavigation = () => {
19
- const { topNavigation, options } = useZudoku();
21
+ const { navigation, options } = useZudoku();
20
22
  const { isAuthenticated } = useAuth();
21
23
  const [drawerOpen, setDrawerOpen] = useState(false);
22
24
 
25
+ const filteredItems = navigation.filter(isHiddenItem(isAuthenticated));
26
+
23
27
  return (
24
28
  <Drawer
25
29
  direction={options.page?.dir === "rtl" ? "left" : "right"}
@@ -43,18 +47,19 @@ export const MobileTopNavigation = () => {
43
47
  </VisuallyHidden>
44
48
  <Search className="flex p-4" />
45
49
  <ul className="flex flex-col items-center gap-4 p-4">
50
+ <li className="empty:hidden">
51
+ <Slot.Target name="top-navigation-side" />
52
+ </li>
46
53
  <li>
47
54
  <ThemeSwitch />
48
55
  </li>
49
- {topNavigation
50
- .filter(isHiddenItem(isAuthenticated))
51
- .map((item) => (
52
- <li key={item.label}>
53
- <button type="button" onClick={() => setDrawerOpen(false)}>
54
- <TopNavItem {...item} />
55
- </button>
56
- </li>
57
- ))}
56
+ {filteredItems.map((item) => (
57
+ <li key={item.label}>
58
+ <button type="button" onClick={() => setDrawerOpen(false)}>
59
+ <TopNavItem {...item} />
60
+ </button>
61
+ </li>
62
+ ))}
58
63
  </ul>
59
64
  </div>
60
65
  {options.page?.showPoweredBy !== false && (
@@ -0,0 +1,28 @@
1
+ import { useNProgress } from "@tanem/react-nprogress";
2
+ import { useEffect, useState } from "react";
3
+ import { useNavigation } from "react-router";
4
+
5
+ export const PageProgress = () => {
6
+ const navigation = useNavigation();
7
+ const isNavigating = navigation.state === "loading";
8
+ // delay the animation to avoid flickering
9
+ const [isAnimating, setIsAnimating] = useState(false);
10
+
11
+ useEffect(() => {
12
+ const timer = setTimeout(() => setIsAnimating(isNavigating), 200);
13
+
14
+ return () => clearTimeout(timer);
15
+ }, [isNavigating]);
16
+
17
+ const { isFinished, progress } = useNProgress({ isAnimating });
18
+
19
+ return (
20
+ <div
21
+ className="absolute w-0 left-0 right-0 bottom-[-1px] h-[2px] bg-primary transition-all duration-300 ease-in-out"
22
+ style={{
23
+ opacity: isFinished ? 0 : 1,
24
+ width: isFinished ? 0 : `${progress * 100}%`,
25
+ }}
26
+ />
27
+ );
28
+ };
@@ -1,44 +1,19 @@
1
- import { useNProgress } from "@tanem/react-nprogress";
2
1
  import { cx } from "class-variance-authority";
3
- import { Suspense, useEffect, useState } from "react";
4
- import { NavLink, useNavigation } from "react-router";
5
- import type { TopNavigationItem } from "../../config/validators/validate.js";
2
+ import { deepEqual } from "fast-equals";
3
+ import { Suspense } from "react";
4
+ import { NavLink } from "react-router";
5
+ import { type NavigationItem } from "../../config/validators/NavigationSchema.js";
6
6
  import { useAuth } from "../authentication/hook.js";
7
7
  import { joinUrl } from "../util/joinUrl.js";
8
8
  import { useCurrentNavigation, useZudoku } from "./context/ZudokuContext.js";
9
- import { isHiddenItem, traverseSidebar } from "./navigation/utils.js";
9
+ import { isHiddenItem, traverseNavigationItem } from "./navigation/utils.js";
10
10
  import { Slot } from "./Slot.js";
11
11
 
12
- export const PageProgress = () => {
13
- const navigation = useNavigation();
14
- const isNavigating = navigation.state === "loading";
15
- // delay the animation to avoid flickering
16
- const [isAnimating, setIsAnimating] = useState(false);
17
-
18
- useEffect(() => {
19
- const timer = setTimeout(() => setIsAnimating(isNavigating), 100);
20
-
21
- return () => clearTimeout(timer);
22
- }, [isNavigating]);
23
-
24
- const { isFinished, progress } = useNProgress({ isAnimating });
25
-
26
- return (
27
- <div
28
- className="absolute w-0 left-0 right-0 bottom-[-1px] h-[2px] bg-primary transition-all duration-300 ease-in-out"
29
- style={{
30
- opacity: isFinished ? 0 : 1,
31
- width: isFinished ? 0 : `${progress * 100}%`,
32
- }}
33
- />
34
- );
35
- };
36
-
37
12
  export const TopNavigation = () => {
38
- const { topNavigation } = useZudoku();
13
+ const { navigation } = useZudoku();
39
14
  const { isAuthenticated } = useAuth();
40
15
 
41
- const filteredItems = topNavigation.filter(isHiddenItem(isAuthenticated));
16
+ const filteredItems = navigation.filter(isHiddenItem(isAuthenticated));
42
17
 
43
18
  if (filteredItems.length === 0 || import.meta.env.MODE === "standalone") {
44
19
  return <style>{`:root { --top-nav-height: 0px; }`}</style>;
@@ -50,7 +25,7 @@ export const TopNavigation = () => {
50
25
  <nav className="text-sm">
51
26
  <ul className="flex flex-row items-center gap-8">
52
27
  {filteredItems.map((item) => (
53
- <li key={item.id}>
28
+ <li key={item.label + item.type}>
54
29
  <TopNavItem {...item} />
55
30
  </li>
56
31
  ))}
@@ -58,50 +33,66 @@ export const TopNavigation = () => {
58
33
  </nav>
59
34
  <Slot.Target name="top-navigation-side" />
60
35
  </div>
61
- <PageProgress />
36
+ {/* <PageProgress /> */}
62
37
  </Suspense>
63
38
  );
64
39
  };
65
40
 
66
- export const TopNavItem = ({
67
- id,
68
- label,
69
- default: defaultLink,
70
- }: TopNavigationItem) => {
71
- const { sidebars } = useZudoku();
72
- const currentSidebar = sidebars[id];
41
+ const getPathForItem = (item: NavigationItem): string => {
42
+ switch (item.type) {
43
+ case "doc":
44
+ return joinUrl(item.path);
45
+ case "link":
46
+ return item.to;
47
+ case "category": {
48
+ if (item.link?.path) {
49
+ return joinUrl(item.link.path);
50
+ }
51
+
52
+ return (
53
+ traverseNavigationItem(item, (child) => {
54
+ if (child.type !== "category") {
55
+ return getPathForItem(child);
56
+ }
57
+ }) ?? ""
58
+ );
59
+ }
60
+ case "custom-page":
61
+ return item.path;
62
+ }
63
+ };
64
+
65
+ export const TopNavItem = (item: NavigationItem) => {
73
66
  const currentNav = useCurrentNavigation();
74
- const isNavigating = Boolean(useNavigation().location);
75
- const isActive = currentNav.topNavItem?.id === id && !isNavigating;
67
+ const isActiveTopNavItem = deepEqual(currentNav.topNavItem, item);
76
68
 
77
- // TODO: This is a bit of a hack to get the first link in the sidebar
78
- // We should really process this when we load the config so we can validate
79
- // that the sidebar is actually set. In this case we just fall back to linking
80
- // to the id if we can't resolve a sidebar.
81
- const first =
82
- defaultLink ??
83
- (currentSidebar
84
- ? traverseSidebar(currentSidebar, (item) => {
85
- if (item.type === "doc") return joinUrl(item.id);
86
- })
87
- : joinUrl(id)) ??
88
- joinUrl(id);
69
+ const path = getPathForItem(item);
89
70
 
90
71
  return (
91
- // We don't use isActive here because it has to be inside the sidebar,
92
- // the top nav id doesn't necessarily start with the sidebar id
72
+ // We don't use isActive here because it has to be inside the navigation,
73
+ // the top nav id doesn't necessarily start with the navigation id
93
74
  <NavLink
94
- className={({ isPending }) =>
95
- cx(
96
- "block lg:py-3.5 font-medium -mb-px",
75
+ viewTransition
76
+ to={path}
77
+ className={({ isActive: isActiveNavLink, isPending }) => {
78
+ const isActive = isActiveNavLink || isActiveTopNavItem;
79
+ return cx(
80
+ "flex items-center gap-2 lg:py-3.5 font-medium -mb-px transition duration-150 delay-75 relative",
97
81
  isActive || isPending
98
- ? "border-primary text-foreground"
99
- : "border-transparent text-foreground/75 hover:text-foreground hover:border-accent-foreground/25",
100
- )
101
- }
102
- to={first}
82
+ ? [
83
+ "text-foreground",
84
+ // underline with view transition animation
85
+ "after:content-[''] after:absolute after:bottom-0 after:left-0 after:right-0",
86
+ "after:h-0.5 after:bg-primary",
87
+ isActive && "after:[view-transition-name:top-nav-underline]",
88
+ isPending && "after:bg-primary/25",
89
+ ]
90
+ : "text-foreground/75 hover:text-foreground",
91
+ );
92
+ }}
103
93
  >
104
- {label}
94
+ {item.icon && <item.icon size={16} className="align-[-0.125em]" />}
95
+ {item.label}
105
96
  </NavLink>
106
97
  );
107
98
  };
@@ -1,11 +1,12 @@
1
1
  import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
2
2
  import { createContext, useContext } from "react";
3
3
  import { matchPath, useLocation } from "react-router";
4
+ import { type NavigationItem } from "../../../config/validators/NavigationSchema.js";
4
5
  import { useAuth } from "../../authentication/hook.js";
5
6
  import type { ZudokuContext } from "../../core/ZudokuContext.js";
6
7
  import { joinUrl } from "../../util/joinUrl.js";
7
8
  import { CACHE_KEYS } from "../cache.js";
8
- import { traverseSidebar } from "../navigation/utils.js";
9
+ import { traverseNavigation } from "../navigation/utils.js";
9
10
 
10
11
  export const ZudokuReactContext = createContext<ZudokuContext | undefined>(
11
12
  undefined,
@@ -30,8 +31,22 @@ export const useApiIdentities = () => {
30
31
  });
31
32
  };
32
33
 
34
+ const getItemPath = (item: NavigationItem) => {
35
+ switch (item.type) {
36
+ case "doc":
37
+ return joinUrl(item.path);
38
+ case "category":
39
+ return item.link ? joinUrl(item.link.path) : undefined;
40
+ case "link":
41
+ return item.to;
42
+ case "custom-page":
43
+ return item.path;
44
+ default:
45
+ return undefined;
46
+ }
47
+ };
33
48
  export const useCurrentNavigation = () => {
34
- const { getPluginSidebar, sidebars, topNavigation, options } = useZudoku();
49
+ const { getPluginNavigation, navigation, options } = useZudoku();
35
50
  const location = useLocation();
36
51
  const auth = useAuth();
37
52
 
@@ -39,44 +54,47 @@ export const useCurrentNavigation = () => {
39
54
  matchPath(route, location.pathname),
40
55
  );
41
56
 
42
- let currentSidebarItem = Object.entries(sidebars).find(([, sidebar]) => {
43
- return traverseSidebar(sidebar, (item) => {
44
- const itemId =
45
- item.type === "doc"
46
- ? joinUrl(item.id)
47
- : item.type === "category" && item.link
48
- ? joinUrl(item.link.id)
49
- : undefined;
50
-
51
- if (itemId === location.pathname) {
52
- return item;
53
- }
54
- });
57
+ const navItem = traverseNavigation(navigation, (item, parentCategories) => {
58
+ if (getItemPath(item) === location.pathname) {
59
+ return parentCategories.at(0) ?? item;
60
+ }
55
61
  });
56
- const currentTopNavItem =
57
- topNavigation.find((t) => t.id === currentSidebarItem?.[0]) ??
58
- topNavigation.find((item) => matchPath(item.id, location.pathname));
59
-
60
- if (
61
- currentTopNavItem &&
62
- !currentSidebarItem &&
63
- currentTopNavItem.id in sidebars
64
- ) {
65
- currentSidebarItem = ["", sidebars[currentTopNavItem.id]!];
66
- }
67
62
 
68
63
  const { data } = useSuspenseQuery({
69
- queryFn: () => getPluginSidebar(location.pathname),
70
- queryKey: ["plugin-sidebar", location.pathname],
64
+ queryFn: () => getPluginNavigation(location.pathname),
65
+ queryKey: ["plugin-navigation", location.pathname],
71
66
  });
72
67
 
73
- const hideSidebar =
68
+ let topNavItem = navItem;
69
+ 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
+ });
74
+
75
+ // Find top-level nav item that matches any plugin base path
76
+ topNavItem = navigation
77
+ .flatMap((item) => {
78
+ const itemPath = getItemPath(item);
79
+ return itemPath ? [{ item, path: itemPath }] : [];
80
+ })
81
+ .sort((a, b) => b.path.length - a.path.length)
82
+ .find(({ path }) => {
83
+ return pluginBasePaths.some(
84
+ (basePath) =>
85
+ matchPath({ path, end: false }, basePath) ??
86
+ matchPath({ path: basePath, end: false }, path),
87
+ );
88
+ })?.item;
89
+ }
90
+
91
+ const hasNavigation =
74
92
  auth.isAuthEnabled && !auth.isAuthenticated && isProtectedRoute;
75
93
 
76
94
  return {
77
- sidebar: hideSidebar
95
+ navigation: hasNavigation
78
96
  ? []
79
- : [...(currentSidebarItem ? currentSidebarItem[1] : []), ...data],
80
- topNavItem: currentTopNavItem,
97
+ : [...(navItem?.type === "category" ? navItem.items : []), ...data],
98
+ topNavItem,
81
99
  };
82
100
  };
@@ -1,42 +1,44 @@
1
1
  import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
2
- import type { SidebarItem as SidebarItemType } from "../../../config/validators/SidebarSchema.js";
2
+ import type { NavigationItem as NavigationItemType } from "../../../config/validators/NavigationSchema.js";
3
3
  import { DrawerContent, DrawerTitle } from "../../ui/Drawer.js";
4
4
  import { Slot } from "../Slot.js";
5
- import { SidebarItem } from "./SidebarItem.js";
6
- import { SidebarWrapper } from "./SidebarWrapper.js";
5
+ import { NavigationItem } from "./NavigationItem.js";
6
+ import { NavigationWrapper } from "./NavigationWrapper.js";
7
7
 
8
- export const Sidebar = ({
8
+ export const Navigation = ({
9
9
  onRequestClose,
10
- sidebar,
10
+ navigation,
11
11
  }: {
12
12
  onRequestClose?: () => void;
13
- sidebar: SidebarItemType[];
13
+ navigation: NavigationItemType[];
14
14
  }) => (
15
15
  <>
16
- <SidebarWrapper>
16
+ <NavigationWrapper>
17
17
  <Slot.Target name="navigation-before" />
18
- {sidebar.map((item) => (
19
- <SidebarItem
18
+ {navigation.map((item) => (
19
+ <NavigationItem
20
20
  key={
21
- ("id" in item ? item.id : "") +
22
- ("href" in item ? item.href : "") +
23
- item.label
21
+ item.type +
22
+ (item.label ?? "") +
23
+ ("path" in item ? item.path : "") +
24
+ ("file" in item ? item.file : "") +
25
+ ("to" in item ? item.to : "")
24
26
  }
25
27
  item={item}
26
28
  />
27
29
  ))}
28
30
  <Slot.Target name="navigation-after" />
29
- </SidebarWrapper>
31
+ </NavigationWrapper>
30
32
  <DrawerContent
31
33
  className="lg:hidden h-[100dvh] start-0 w-[320px] rounded-none"
32
34
  aria-describedby={undefined}
33
35
  >
34
36
  <div className="p-4 overflow-y-auto overscroll-none">
35
37
  <VisuallyHidden>
36
- <DrawerTitle>Sidebar</DrawerTitle>
38
+ <DrawerTitle>Navigation</DrawerTitle>
37
39
  </VisuallyHidden>
38
- {sidebar.map((item) => (
39
- <SidebarItem
40
+ {navigation.map((item) => (
41
+ <NavigationItem
40
42
  key={item.label}
41
43
  item={item}
42
44
  onRequestClose={onRequestClose}
@@ -22,7 +22,7 @@ export const ColorMapInvert = {
22
22
  outline: "",
23
23
  };
24
24
 
25
- export const SidebarBadge = ({
25
+ export const NavigationBadge = ({
26
26
  color,
27
27
  label,
28
28
  className,
@@ -4,17 +4,17 @@ import { ChevronRightIcon } from "lucide-react";
4
4
  import { memo, useEffect, useState } from "react";
5
5
  import { NavLink, useLocation, useMatch } from "react-router";
6
6
  import { Button } from "zudoku/ui/Button.js";
7
- import type { SidebarItemCategory } from "../../../config/validators/SidebarSchema.js";
7
+ import type { NavigationCategory as NavigationCategoryType } from "../../../config/validators/NavigationSchema.js";
8
8
  import { cn } from "../../util/cn.js";
9
9
  import { joinUrl } from "../../util/joinUrl.js";
10
- import { SidebarItem } from "./SidebarItem.js";
10
+ import { NavigationItem } from "./NavigationItem.js";
11
11
  import { navigationListItem, useIsCategoryOpen } from "./utils.js";
12
12
 
13
- const SidebarCategoryInner = ({
13
+ const NavigationCategoryInner = ({
14
14
  category,
15
15
  onRequestClose,
16
16
  }: {
17
- category: SidebarItemCategory;
17
+ category: NavigationCategoryType;
18
18
  onRequestClose?: () => void;
19
19
  }) => {
20
20
  const isCategoryOpen = useIsCategoryOpen(category);
@@ -27,11 +27,11 @@ const SidebarCategoryInner = ({
27
27
  !isCollapsible || !isCollapsed || isCategoryOpen,
28
28
  );
29
29
  const [open, setOpen] = useState(isDefaultOpen);
30
- const isActive = useMatch(category.link?.id ?? "");
30
+ const isActive = useMatch(category.link?.path ?? "");
31
31
 
32
32
  useEffect(() => {
33
- // this is triggered when an item from the sidebar is clicked
34
- // and the sidebar, enclosing this item, is not opened
33
+ // this is triggered when an item from the navigation is clicked
34
+ // and the navigation, enclosing this item, is not opened
35
35
  if (isCategoryOpen) {
36
36
  setOpen(true);
37
37
  }
@@ -85,7 +85,7 @@ const SidebarCategoryInner = ({
85
85
  {category.link?.type === "doc" ? (
86
86
  <NavLink
87
87
  to={{
88
- pathname: joinUrl(category.link.id),
88
+ pathname: joinUrl(category.link.path),
89
89
  search: location.search,
90
90
  }}
91
91
  className={styles}
@@ -123,11 +123,13 @@ const SidebarCategoryInner = ({
123
123
  >
124
124
  <ul className="relative after:absolute after:-start-(--padding-nav-item) after:translate-x-[1.5px] after:top-0 after:bottom-0 after:w-px after:bg-border">
125
125
  {category.items.map((item) => (
126
- <SidebarItem
126
+ <NavigationItem
127
127
  key={
128
- ("id" in item ? item.id : "") +
129
- ("href" in item ? item.href : "") +
130
- item.label
128
+ item.type +
129
+ (item.label ?? "") +
130
+ ("path" in item ? item.path : "") +
131
+ ("file" in item ? item.file : "") +
132
+ ("to" in item ? item.to : "")
131
133
  }
132
134
  onRequestClose={onRequestClose}
133
135
  item={item}
@@ -139,6 +141,6 @@ const SidebarCategoryInner = ({
139
141
  );
140
142
  };
141
143
 
142
- export const SidebarCategory = memo(SidebarCategoryInner, deepEqual);
144
+ export const NavigationCategory = memo(NavigationCategoryInner, deepEqual);
143
145
 
144
- SidebarCategory.displayName = "SidebarCategory";
146
+ NavigationCategory.displayName = "NavigationCategory";
@@ -8,13 +8,13 @@ import {
8
8
  TooltipProvider,
9
9
  TooltipTrigger,
10
10
  } from "zudoku/ui/Tooltip.js";
11
- import type { SidebarItem as SidebarItemType } from "../../../config/validators/SidebarSchema.js";
11
+ import type { NavigationItem as NavigationItemType } from "../../../config/validators/NavigationSchema.js";
12
12
  import { cn } from "../../util/cn.js";
13
13
  import { joinUrl } from "../../util/joinUrl.js";
14
14
  import { AnchorLink } from "../AnchorLink.js";
15
15
  import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
16
- import { SidebarBadge } from "./SidebarBadge.js";
17
- import { SidebarCategory } from "./SidebarCategory.js";
16
+ import { NavigationBadge } from "./NavigationBadge.js";
17
+ import { NavigationCategory } from "./NavigationCategory.js";
18
18
  import { navigationListItem } from "./utils.js";
19
19
 
20
20
  const TruncatedLabel = ({
@@ -65,11 +65,11 @@ const TruncatedLabel = ({
65
65
 
66
66
  export const DATA_ANCHOR_ATTR = "data-anchor";
67
67
 
68
- export const SidebarItem = ({
68
+ export const NavigationItem = ({
69
69
  item,
70
70
  onRequestClose,
71
71
  }: {
72
- item: SidebarItemType;
72
+ item: NavigationItemType;
73
73
  onRequestClose?: () => void;
74
74
  }) => {
75
75
  const location = useLocation();
@@ -78,23 +78,26 @@ export const SidebarItem = ({
78
78
  switch (item.type) {
79
79
  case "category":
80
80
  return (
81
- <SidebarCategory category={item} onRequestClose={onRequestClose} />
81
+ <NavigationCategory category={item} onRequestClose={onRequestClose} />
82
82
  );
83
83
  case "doc":
84
84
  return (
85
85
  <NavLink
86
+ viewTransition
86
87
  className={({ isActive, isPending }) =>
87
88
  navigationListItem({ isActive, isPending })
88
89
  }
89
- to={joinUrl(item.id)}
90
+ to={joinUrl(item.path)}
90
91
  onClick={onRequestClose}
91
92
  end
92
93
  >
93
94
  {item.icon && <item.icon size={16} className="align-[-0.125em]" />}
94
95
  {item.badge ? (
95
96
  <>
96
- <TruncatedLabel label={item.label} className="flex-1" />
97
- <SidebarBadge {...item.badge} />
97
+ {item.label && (
98
+ <TruncatedLabel label={item.label} className="flex-1" />
99
+ )}
100
+ <NavigationBadge {...item.badge} />
98
101
  </>
99
102
  ) : (
100
103
  item.label
@@ -102,24 +105,26 @@ export const SidebarItem = ({
102
105
  </NavLink>
103
106
  );
104
107
  case "link":
105
- return !item.href.startsWith("http") ? (
108
+ case "custom-page": {
109
+ const href = item.type === "link" ? item.to : item.path;
110
+ return !href.startsWith("http") ? (
106
111
  <AnchorLink
107
112
  to={{
108
- pathname: item.href.split("#")[0],
109
- hash: item.href.split("#")[1],
113
+ pathname: href.split("#")[0],
114
+ hash: href.split("#")[1],
110
115
  search: location.search,
111
116
  }}
112
- {...{ [DATA_ANCHOR_ATTR]: item.href.split("#")[1] }}
117
+ {...{ [DATA_ANCHOR_ATTR]: href.split("#")[1] }}
113
118
  className={navigationListItem({
114
- isActive: item.href === [location.pathname, activeAnchor].join("#"),
119
+ isActive: href === [location.pathname, activeAnchor].join("#"),
115
120
  })}
116
121
  onClick={onRequestClose}
117
122
  >
118
123
  {item.icon && <item.icon size={16} className="align-[-0.125em]" />}
119
124
  {item.badge ? (
120
125
  <>
121
- <TruncatedLabel label={item.label} />
122
- <SidebarBadge {...item.badge} />
126
+ {item.label && <TruncatedLabel label={item.label} />}
127
+ <NavigationBadge {...item.badge} />
123
128
  </>
124
129
  ) : (
125
130
  <span className="break-all">{item.label}</span>
@@ -128,7 +133,7 @@ export const SidebarItem = ({
128
133
  ) : (
129
134
  <a
130
135
  className={navigationListItem()}
131
- href={item.href}
136
+ href={href}
132
137
  target="_blank"
133
138
  rel="noopener noreferrer"
134
139
  onClick={onRequestClose}
@@ -141,5 +146,6 @@ export const SidebarItem = ({
141
146
  </span>
142
147
  </a>
143
148
  );
149
+ }
144
150
  }
145
151
  };