zudoku 0.0.2-dev.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 (403) hide show
  1. package/cli.js +1 -0
  2. package/dist/app/DevPortal.d.ts +26 -0
  3. package/dist/app/DevPortal.js +41 -0
  4. package/dist/app/DevPortal.js.map +1 -0
  5. package/dist/app/Heading.d.ts +9 -0
  6. package/dist/app/Heading.js +27 -0
  7. package/dist/app/Heading.js.map +1 -0
  8. package/dist/app/app.d.ts +2 -0
  9. package/dist/app/app.js +69 -0
  10. package/dist/app/app.js.map +1 -0
  11. package/dist/app/authentication/authentication.d.ts +13 -0
  12. package/dist/app/authentication/authentication.js +2 -0
  13. package/dist/app/authentication/authentication.js.map +1 -0
  14. package/dist/app/authentication/clerk.d.ts +5 -0
  15. package/dist/app/authentication/clerk.js +36 -0
  16. package/dist/app/authentication/clerk.js.map +1 -0
  17. package/dist/app/authentication/openid.d.ts +11 -0
  18. package/dist/app/authentication/openid.js +118 -0
  19. package/dist/app/authentication/openid.js.map +1 -0
  20. package/dist/app/components/AnchorLink.d.ts +5 -0
  21. package/dist/app/components/AnchorLink.js +17 -0
  22. package/dist/app/components/AnchorLink.js.map +1 -0
  23. package/dist/app/components/CategoryHeading.d.ts +5 -0
  24. package/dist/app/components/CategoryHeading.js +6 -0
  25. package/dist/app/components/CategoryHeading.js.map +1 -0
  26. package/dist/app/components/DynamicIcon.d.ts +6 -0
  27. package/dist/app/components/DynamicIcon.js +6 -0
  28. package/dist/app/components/DynamicIcon.js.map +1 -0
  29. package/dist/app/components/Header.d.ts +2 -0
  30. package/dist/app/components/Header.js +15 -0
  31. package/dist/app/components/Header.js.map +1 -0
  32. package/dist/app/components/Layout.d.ts +4 -0
  33. package/dist/app/components/Layout.js +31 -0
  34. package/dist/app/components/Layout.js.map +1 -0
  35. package/dist/app/components/Markdown.d.ts +5 -0
  36. package/dist/app/components/Markdown.js +20 -0
  37. package/dist/app/components/Markdown.js.map +1 -0
  38. package/dist/app/components/SyntaxHighlight.d.ts +9 -0
  39. package/dist/app/components/SyntaxHighlight.js +31 -0
  40. package/dist/app/components/SyntaxHighlight.js.map +1 -0
  41. package/dist/app/components/TopNavigation.d.ts +1 -0
  42. package/dist/app/components/TopNavigation.js +11 -0
  43. package/dist/app/components/TopNavigation.js.map +1 -0
  44. package/dist/app/components/context/ComponentsContext.d.ts +10 -0
  45. package/dist/app/components/context/ComponentsContext.js +11 -0
  46. package/dist/app/components/context/ComponentsContext.js.map +1 -0
  47. package/dist/app/components/context/DevPortalProvider.d.ts +10 -0
  48. package/dist/app/components/context/DevPortalProvider.js +39 -0
  49. package/dist/app/components/context/DevPortalProvider.js.map +1 -0
  50. package/dist/app/components/context/PluginSystem.d.ts +1 -0
  51. package/dist/app/components/context/PluginSystem.js +2 -0
  52. package/dist/app/components/context/PluginSystem.js.map +1 -0
  53. package/dist/app/components/context/ThemeContext.d.ts +5 -0
  54. package/dist/app/components/context/ThemeContext.js +33 -0
  55. package/dist/app/components/context/ThemeContext.js.map +1 -0
  56. package/dist/app/components/context/ViewportAnchorContext.d.ts +15 -0
  57. package/dist/app/components/context/ViewportAnchorContext.js +89 -0
  58. package/dist/app/components/context/ViewportAnchorContext.js.map +1 -0
  59. package/dist/app/components/navigation/SideNavigation.d.ts +1 -0
  60. package/dist/app/components/navigation/SideNavigation.js +11 -0
  61. package/dist/app/components/navigation/SideNavigation.js.map +1 -0
  62. package/dist/app/components/navigation/SideNavigationCategory.d.ts +4 -0
  63. package/dist/app/components/navigation/SideNavigationCategory.js +26 -0
  64. package/dist/app/components/navigation/SideNavigationCategory.js.map +1 -0
  65. package/dist/app/components/navigation/SideNavigationItem.d.ts +12 -0
  66. package/dist/app/components/navigation/SideNavigationItem.js +38 -0
  67. package/dist/app/components/navigation/SideNavigationItem.js.map +1 -0
  68. package/dist/app/components/navigation/SideNavigationWrapper.d.ts +4 -0
  69. package/dist/app/components/navigation/SideNavigationWrapper.js +6 -0
  70. package/dist/app/components/navigation/SideNavigationWrapper.js.map +1 -0
  71. package/dist/app/components/navigation/useNavigationCollapsibleState.d.ts +7 -0
  72. package/dist/app/components/navigation/useNavigationCollapsibleState.js +16 -0
  73. package/dist/app/components/navigation/useNavigationCollapsibleState.js.map +1 -0
  74. package/dist/app/components/navigation/util.d.ts +8 -0
  75. package/dist/app/components/navigation/util.js +15 -0
  76. package/dist/app/components/navigation/util.js.map +1 -0
  77. package/dist/app/config.d.ts +3 -0
  78. package/dist/app/config.js +9 -0
  79. package/dist/app/config.js.map +1 -0
  80. package/dist/app/core/DevPortalContext.d.ts +80 -0
  81. package/dist/app/core/DevPortalContext.js +68 -0
  82. package/dist/app/core/DevPortalContext.js.map +1 -0
  83. package/dist/app/core/helmet.d.ts +4 -0
  84. package/dist/app/core/helmet.js +5 -0
  85. package/dist/app/core/helmet.js.map +1 -0
  86. package/dist/app/core/icons.d.ts +1 -0
  87. package/dist/app/core/icons.js +2 -0
  88. package/dist/app/core/icons.js.map +1 -0
  89. package/dist/app/core/plugins.d.ts +24 -0
  90. package/dist/app/core/plugins.js +4 -0
  91. package/dist/app/core/plugins.js.map +1 -0
  92. package/dist/app/core/router.d.ts +1 -0
  93. package/dist/app/core/router.js +2 -0
  94. package/dist/app/core/router.js.map +1 -0
  95. package/dist/app/core/types/combine.d.ts +4 -0
  96. package/dist/app/core/types/combine.js +2 -0
  97. package/dist/app/core/types/combine.js.map +1 -0
  98. package/dist/app/main.d.ts +1 -0
  99. package/dist/app/main.js +18 -0
  100. package/dist/app/main.js.map +1 -0
  101. package/dist/app/markdowns.d.ts +3 -0
  102. package/dist/app/markdowns.js +5 -0
  103. package/dist/app/markdowns.js.map +1 -0
  104. package/dist/app/oas/graphql/index.d.ts +12 -0
  105. package/dist/app/oas/graphql/index.js +290 -0
  106. package/dist/app/oas/graphql/index.js.map +1 -0
  107. package/dist/app/oas/graphql/server.d.ts +1 -0
  108. package/dist/app/oas/graphql/server.js +8 -0
  109. package/dist/app/oas/graphql/server.js.map +1 -0
  110. package/dist/app/oas/parser/dereference/index.d.ts +5 -0
  111. package/dist/app/oas/parser/dereference/index.js +43 -0
  112. package/dist/app/oas/parser/dereference/index.js.map +1 -0
  113. package/dist/app/oas/parser/dereference/resolveRef.d.ts +5 -0
  114. package/dist/app/oas/parser/dereference/resolveRef.js +26 -0
  115. package/dist/app/oas/parser/dereference/resolveRef.js.map +1 -0
  116. package/dist/app/oas/parser/index.d.ts +21 -0
  117. package/dist/app/oas/parser/index.js +58 -0
  118. package/dist/app/oas/parser/index.js.map +1 -0
  119. package/dist/app/oas/parser/schemas/v3.0.json +1489 -0
  120. package/dist/app/oas/parser/schemas/v3.1.json +1298 -0
  121. package/dist/app/oas/parser/upgrade/index.d.ts +9 -0
  122. package/dist/app/oas/parser/upgrade/index.js +90 -0
  123. package/dist/app/oas/parser/upgrade/index.js.map +1 -0
  124. package/dist/app/plugins/api-key/SettingsApiKeys.d.ts +4 -0
  125. package/dist/app/plugins/api-key/SettingsApiKeys.js +7 -0
  126. package/dist/app/plugins/api-key/SettingsApiKeys.js.map +1 -0
  127. package/dist/app/plugins/api-key/index.d.ts +32 -0
  128. package/dist/app/plugins/api-key/index.js +55 -0
  129. package/dist/app/plugins/api-key/index.js.map +1 -0
  130. package/dist/app/plugins/markdown/MdxPage.d.ts +3 -0
  131. package/dist/app/plugins/markdown/MdxPage.js +55 -0
  132. package/dist/app/plugins/markdown/MdxPage.js.map +1 -0
  133. package/dist/app/plugins/markdown/Toc.d.ts +4 -0
  134. package/dist/app/plugins/markdown/Toc.js +40 -0
  135. package/dist/app/plugins/markdown/Toc.js.map +1 -0
  136. package/dist/app/plugins/markdown/generateRoutes.d.ts +3 -0
  137. package/dist/app/plugins/markdown/generateRoutes.js +50 -0
  138. package/dist/app/plugins/markdown/generateRoutes.js.map +1 -0
  139. package/dist/app/plugins/markdown/index.d.ts +19 -0
  140. package/dist/app/plugins/markdown/index.js +9 -0
  141. package/dist/app/plugins/markdown/index.js.map +1 -0
  142. package/dist/app/plugins/openapi/ColorizedParam.d.ts +8 -0
  143. package/dist/app/plugins/openapi/ColorizedParam.js +40 -0
  144. package/dist/app/plugins/openapi/ColorizedParam.js.map +1 -0
  145. package/dist/app/plugins/openapi/MakeRequest.d.ts +4 -0
  146. package/dist/app/plugins/openapi/MakeRequest.js +11 -0
  147. package/dist/app/plugins/openapi/MakeRequest.js.map +1 -0
  148. package/dist/app/plugins/openapi/MethodBadge.d.ts +13 -0
  149. package/dist/app/plugins/openapi/MethodBadge.js +26 -0
  150. package/dist/app/plugins/openapi/MethodBadge.js.map +1 -0
  151. package/dist/app/plugins/openapi/OperationList.d.ts +47 -0
  152. package/dist/app/plugins/openapi/OperationList.js +82 -0
  153. package/dist/app/plugins/openapi/OperationList.js.map +1 -0
  154. package/dist/app/plugins/openapi/OperationListItem.d.ts +7 -0
  155. package/dist/app/plugins/openapi/OperationListItem.js +15 -0
  156. package/dist/app/plugins/openapi/OperationListItem.js.map +1 -0
  157. package/dist/app/plugins/openapi/ParameterList.d.ts +7 -0
  158. package/dist/app/plugins/openapi/ParameterList.js +5 -0
  159. package/dist/app/plugins/openapi/ParameterList.js.map +1 -0
  160. package/dist/app/plugins/openapi/ParameterListItem.d.ts +8 -0
  161. package/dist/app/plugins/openapi/ParameterListItem.js +13 -0
  162. package/dist/app/plugins/openapi/ParameterListItem.js.map +1 -0
  163. package/dist/app/plugins/openapi/RequestBodySidecarBox.d.ts +6 -0
  164. package/dist/app/plugins/openapi/RequestBodySidecarBox.js +19 -0
  165. package/dist/app/plugins/openapi/RequestBodySidecarBox.js.map +1 -0
  166. package/dist/app/plugins/openapi/ResponsesSidecarBox.d.ts +6 -0
  167. package/dist/app/plugins/openapi/ResponsesSidecarBox.js +15 -0
  168. package/dist/app/plugins/openapi/ResponsesSidecarBox.js.map +1 -0
  169. package/dist/app/plugins/openapi/Select.d.ts +9 -0
  170. package/dist/app/plugins/openapi/Select.js +5 -0
  171. package/dist/app/plugins/openapi/Select.js.map +1 -0
  172. package/dist/app/plugins/openapi/Sidecar.d.ts +4 -0
  173. package/dist/app/plugins/openapi/Sidecar.js +39 -0
  174. package/dist/app/plugins/openapi/Sidecar.js.map +1 -0
  175. package/dist/app/plugins/openapi/SidecarBox.d.ts +10 -0
  176. package/dist/app/plugins/openapi/SidecarBox.js +8 -0
  177. package/dist/app/plugins/openapi/SidecarBox.js.map +1 -0
  178. package/dist/app/plugins/openapi/graphql/index.d.ts +836 -0
  179. package/dist/app/plugins/openapi/graphql/index.js +4 -0
  180. package/dist/app/plugins/openapi/graphql/index.js.map +1 -0
  181. package/dist/app/plugins/openapi/index.d.ts +22 -0
  182. package/dist/app/plugins/openapi/index.js +91 -0
  183. package/dist/app/plugins/openapi/index.js.map +1 -0
  184. package/dist/app/plugins/openapi/util/generateSchemaExample.d.ts +3 -0
  185. package/dist/app/plugins/openapi/util/generateSchemaExample.js +52 -0
  186. package/dist/app/plugins/openapi/util/generateSchemaExample.js.map +1 -0
  187. package/dist/app/plugins/openapi/util/getCode.d.ts +2 -0
  188. package/dist/app/plugins/openapi/util/getCode.js +54 -0
  189. package/dist/app/plugins/openapi/util/getCode.js.map +1 -0
  190. package/dist/app/plugins/openapi/util/urql.d.ts +8 -0
  191. package/dist/app/plugins/openapi/util/urql.js +8 -0
  192. package/dist/app/plugins/openapi/util/urql.js.map +1 -0
  193. package/dist/app/plugins/openapi/worker/createSharedWorkerClient.d.ts +5 -0
  194. package/dist/app/plugins/openapi/worker/createSharedWorkerClient.js +47 -0
  195. package/dist/app/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -0
  196. package/dist/app/plugins/openapi/worker/worker.d.ts +1 -0
  197. package/dist/app/plugins/openapi/worker/worker.js +20 -0
  198. package/dist/app/plugins/openapi/worker/worker.js.map +1 -0
  199. package/dist/app/plugins/redirect/index.d.ts +10 -0
  200. package/dist/app/plugins/redirect/index.js +11 -0
  201. package/dist/app/plugins/redirect/index.js.map +1 -0
  202. package/dist/app/tailwind.d.ts +3 -0
  203. package/dist/app/tailwind.js +69 -0
  204. package/dist/app/tailwind.js.map +1 -0
  205. package/dist/app/ui/Callout.d.ts +51 -0
  206. package/dist/app/ui/Callout.js +50 -0
  207. package/dist/app/ui/Callout.js.map +1 -0
  208. package/dist/app/ui/Card.d.ts +8 -0
  209. package/dist/app/ui/Card.js +17 -0
  210. package/dist/app/ui/Card.js.map +1 -0
  211. package/dist/app/ui/Note.d.ts +8 -0
  212. package/dist/app/ui/Note.js +23 -0
  213. package/dist/app/ui/Note.js.map +1 -0
  214. package/dist/app/util/MdxComponents.d.ts +27 -0
  215. package/dist/app/util/MdxComponents.js +40 -0
  216. package/dist/app/util/MdxComponents.js.map +1 -0
  217. package/dist/app/util/cn.d.ts +2 -0
  218. package/dist/app/util/cn.js +6 -0
  219. package/dist/app/util/cn.js.map +1 -0
  220. package/dist/app/util/createWaitForNotify.d.ts +1 -0
  221. package/dist/app/util/createWaitForNotify.js +15 -0
  222. package/dist/app/util/createWaitForNotify.js.map +1 -0
  223. package/dist/app/util/groupBy.d.ts +6 -0
  224. package/dist/app/util/groupBy.js +9 -0
  225. package/dist/app/util/groupBy.js.map +1 -0
  226. package/dist/app/util/joinPath.d.ts +1 -0
  227. package/dist/app/util/joinPath.js +8 -0
  228. package/dist/app/util/joinPath.js.map +1 -0
  229. package/dist/app/util/pastellize.d.ts +4 -0
  230. package/dist/app/util/pastellize.js +14 -0
  231. package/dist/app/util/pastellize.js.map +1 -0
  232. package/dist/app/util/slugify.d.ts +3 -0
  233. package/dist/app/util/slugify.js +3 -0
  234. package/dist/app/util/slugify.js.map +1 -0
  235. package/dist/app/util/traverseNavigation.d.ts +6 -0
  236. package/dist/app/util/traverseNavigation.js +30 -0
  237. package/dist/app/util/traverseNavigation.js.map +1 -0
  238. package/dist/app/util/useScrollToAnchor.d.ts +1 -0
  239. package/dist/app/util/useScrollToAnchor.js +33 -0
  240. package/dist/app/util/useScrollToAnchor.js.map +1 -0
  241. package/dist/app/util/useScrollToTop.d.ts +1 -0
  242. package/dist/app/util/useScrollToTop.js +13 -0
  243. package/dist/app/util/useScrollToTop.js.map +1 -0
  244. package/dist/auth.d.ts +2 -0
  245. package/dist/auth.js +3 -0
  246. package/dist/auth.js.map +1 -0
  247. package/dist/cli/build/handler.d.ts +4 -0
  248. package/dist/cli/build/handler.js +9 -0
  249. package/dist/cli/build/handler.js.map +1 -0
  250. package/dist/cli/cli.d.ts +1 -0
  251. package/dist/cli/cli.js +64 -0
  252. package/dist/cli/cli.js.map +1 -0
  253. package/dist/cli/cmds/build.d.ts +8 -0
  254. package/dist/cli/cmds/build.js +23 -0
  255. package/dist/cli/cmds/build.js.map +1 -0
  256. package/dist/cli/cmds/dev.d.ts +8 -0
  257. package/dist/cli/cmds/dev.js +29 -0
  258. package/dist/cli/cmds/dev.js.map +1 -0
  259. package/dist/cli/common/analytics/lib.d.ts +17 -0
  260. package/dist/cli/common/analytics/lib.js +53 -0
  261. package/dist/cli/common/analytics/lib.js.map +1 -0
  262. package/dist/cli/common/constants.d.ts +5 -0
  263. package/dist/cli/common/constants.js +9 -0
  264. package/dist/cli/common/constants.js.map +1 -0
  265. package/dist/cli/common/logger.d.ts +2 -0
  266. package/dist/cli/common/logger.js +14 -0
  267. package/dist/cli/common/logger.js.map +1 -0
  268. package/dist/cli/common/machine-id/lib.d.ts +1 -0
  269. package/dist/cli/common/machine-id/lib.js +74 -0
  270. package/dist/cli/common/machine-id/lib.js.map +1 -0
  271. package/dist/cli/common/outdated.d.ts +1 -0
  272. package/dist/cli/common/outdated.js +70 -0
  273. package/dist/cli/common/outdated.js.map +1 -0
  274. package/dist/cli/common/output.d.ts +9 -0
  275. package/dist/cli/common/output.js +65 -0
  276. package/dist/cli/common/output.js.map +1 -0
  277. package/dist/cli/common/utils/box.d.ts +33 -0
  278. package/dist/cli/common/utils/box.js +81 -0
  279. package/dist/cli/common/utils/box.js.map +1 -0
  280. package/dist/cli/common/utils/ports.d.ts +1 -0
  281. package/dist/cli/common/utils/ports.js +18 -0
  282. package/dist/cli/common/utils/ports.js.map +1 -0
  283. package/dist/cli/common/validators/lib.d.ts +20 -0
  284. package/dist/cli/common/validators/lib.js +31 -0
  285. package/dist/cli/common/validators/lib.js.map +1 -0
  286. package/dist/cli/common/xdg/lib.d.ts +6 -0
  287. package/dist/cli/common/xdg/lib.js +18 -0
  288. package/dist/cli/common/xdg/lib.js.map +1 -0
  289. package/dist/cli/dev/handler.d.ts +5 -0
  290. package/dist/cli/dev/handler.js +22 -0
  291. package/dist/cli/dev/handler.js.map +1 -0
  292. package/dist/config/config.d.ts +37 -0
  293. package/dist/config/config.js +2 -0
  294. package/dist/config/config.js.map +1 -0
  295. package/dist/index.d.ts +7 -0
  296. package/dist/index.js +6 -0
  297. package/dist/index.js.map +1 -0
  298. package/dist/plugins.d.ts +4 -0
  299. package/dist/plugins.js +6 -0
  300. package/dist/plugins.js.map +1 -0
  301. package/dist/vite/build.d.ts +3 -0
  302. package/dist/vite/build.js +29 -0
  303. package/dist/vite/build.js.map +1 -0
  304. package/dist/vite/config.d.ts +6 -0
  305. package/dist/vite/config.js +74 -0
  306. package/dist/vite/config.js.map +1 -0
  307. package/dist/vite/dev-server.d.ts +10 -0
  308. package/dist/vite/dev-server.js +53 -0
  309. package/dist/vite/dev-server.js.map +1 -0
  310. package/dist/vite/html.d.ts +5 -0
  311. package/dist/vite/html.js +32 -0
  312. package/dist/vite/html.js.map +1 -0
  313. package/dist/vite/import-auth-plugin.d.ts +3 -0
  314. package/dist/vite/import-auth-plugin.js +28 -0
  315. package/dist/vite/import-auth-plugin.js.map +1 -0
  316. package/dist/vite/plugin.d.ts +7 -0
  317. package/dist/vite/plugin.js +109 -0
  318. package/dist/vite/plugin.js.map +1 -0
  319. package/package.json +118 -0
  320. package/src/app/DevPortal.tsx +115 -0
  321. package/src/app/Heading.tsx +60 -0
  322. package/src/app/app.tsx +85 -0
  323. package/src/app/authentication/authentication.ts +18 -0
  324. package/src/app/authentication/clerk.ts +47 -0
  325. package/src/app/authentication/openid.ts +192 -0
  326. package/src/app/components/AnchorLink.tsx +19 -0
  327. package/src/app/components/CategoryHeading.tsx +16 -0
  328. package/src/app/components/DynamicIcon.tsx +60 -0
  329. package/src/app/components/Header.tsx +69 -0
  330. package/src/app/components/Layout.tsx +56 -0
  331. package/src/app/components/Markdown.tsx +37 -0
  332. package/src/app/components/SyntaxHighlight.tsx +92 -0
  333. package/src/app/components/TopNavigation.tsx +32 -0
  334. package/src/app/components/context/ComponentsContext.tsx +24 -0
  335. package/src/app/components/context/DevPortalProvider.ts +54 -0
  336. package/src/app/components/context/PluginSystem.ts +0 -0
  337. package/src/app/components/context/ThemeContext.tsx +46 -0
  338. package/src/app/components/context/ViewportAnchorContext.tsx +139 -0
  339. package/src/app/components/navigation/SideNavigation.tsx +18 -0
  340. package/src/app/components/navigation/SideNavigationCategory.tsx +74 -0
  341. package/src/app/components/navigation/SideNavigationItem.tsx +143 -0
  342. package/src/app/components/navigation/SideNavigationWrapper.tsx +15 -0
  343. package/src/app/components/navigation/useNavigationCollapsibleState.ts +27 -0
  344. package/src/app/components/navigation/util.ts +38 -0
  345. package/src/app/config.ts +20 -0
  346. package/src/app/core/DevPortalContext.ts +164 -0
  347. package/src/app/core/helmet.ts +5 -0
  348. package/src/app/core/icons.tsx +1 -0
  349. package/src/app/core/plugins.ts +43 -0
  350. package/src/app/core/router.tsx +1 -0
  351. package/src/app/core/types/combine.ts +16 -0
  352. package/src/app/main.css +137 -0
  353. package/src/app/main.tsx +22 -0
  354. package/src/app/markdowns.ts +7 -0
  355. package/src/app/oas/graphql/index.ts +422 -0
  356. package/src/app/oas/graphql/server.ts +10 -0
  357. package/src/app/oas/parser/dereference/index.ts +59 -0
  358. package/src/app/oas/parser/dereference/resolveRef.ts +32 -0
  359. package/src/app/oas/parser/index.ts +94 -0
  360. package/src/app/oas/parser/schemas/v3.0.json +1489 -0
  361. package/src/app/oas/parser/schemas/v3.1.json +1298 -0
  362. package/src/app/oas/parser/upgrade/index.ts +108 -0
  363. package/src/app/plugins/api-key/SettingsApiKeys.tsx +22 -0
  364. package/src/app/plugins/api-key/index.tsx +123 -0
  365. package/src/app/plugins/markdown/MdxPage.tsx +128 -0
  366. package/src/app/plugins/markdown/Toc.tsx +122 -0
  367. package/src/app/plugins/markdown/generateRoutes.tsx +72 -0
  368. package/src/app/plugins/markdown/index.tsx +31 -0
  369. package/src/app/plugins/openapi/ColorizedParam.tsx +73 -0
  370. package/src/app/plugins/openapi/MakeRequest.tsx +30 -0
  371. package/src/app/plugins/openapi/MethodBadge.tsx +36 -0
  372. package/src/app/plugins/openapi/OperationList.tsx +119 -0
  373. package/src/app/plugins/openapi/OperationListItem.tsx +55 -0
  374. package/src/app/plugins/openapi/ParameterList.tsx +32 -0
  375. package/src/app/plugins/openapi/ParameterListItem.tsx +60 -0
  376. package/src/app/plugins/openapi/RequestBodySidecarBox.tsx +48 -0
  377. package/src/app/plugins/openapi/ResponsesSidecarBox.tsx +60 -0
  378. package/src/app/plugins/openapi/Select.tsx +35 -0
  379. package/src/app/plugins/openapi/Sidecar.tsx +99 -0
  380. package/src/app/plugins/openapi/SidecarBox.tsx +35 -0
  381. package/src/app/plugins/openapi/graphql/env.d.ts +48 -0
  382. package/src/app/plugins/openapi/graphql/index.ts +13 -0
  383. package/src/app/plugins/openapi/index.tsx +142 -0
  384. package/src/app/plugins/openapi/util/generateSchemaExample.ts +59 -0
  385. package/src/app/plugins/openapi/util/getCode.tsx +69 -0
  386. package/src/app/plugins/openapi/util/urql.ts +8 -0
  387. package/src/app/plugins/openapi/worker/createSharedWorkerClient.ts +60 -0
  388. package/src/app/plugins/openapi/worker/worker.ts +30 -0
  389. package/src/app/plugins/redirect/index.tsx +20 -0
  390. package/src/app/tailwind.ts +72 -0
  391. package/src/app/ui/Callout.tsx +87 -0
  392. package/src/app/ui/Card.tsx +82 -0
  393. package/src/app/ui/Note.tsx +58 -0
  394. package/src/app/util/MdxComponents.tsx +70 -0
  395. package/src/app/util/cn.ts +6 -0
  396. package/src/app/util/createWaitForNotify.ts +18 -0
  397. package/src/app/util/groupBy.ts +24 -0
  398. package/src/app/util/joinPath.tsx +10 -0
  399. package/src/app/util/pastellize.ts +25 -0
  400. package/src/app/util/slugify.ts +3 -0
  401. package/src/app/util/traverseNavigation.ts +55 -0
  402. package/src/app/util/useScrollToAnchor.ts +38 -0
  403. package/src/app/util/useScrollToTop.ts +13 -0
@@ -0,0 +1,92 @@
1
+ import {
2
+ Highlight,
3
+ Prism,
4
+ themes,
5
+ type HighlightProps,
6
+ } from "prism-react-renderer";
7
+
8
+ import { CheckIcon, CopyIcon } from "lucide-react";
9
+
10
+ if (!import.meta.env.SSR) {
11
+ globalThis.Prism = Prism;
12
+ // @ts-expect-error This is untyped
13
+ import("prismjs/components/prism-bash.min.js");
14
+ // @ts-expect-error This is untyped
15
+ import("prismjs/components/prism-ruby.min.js");
16
+ // @ts-expect-error This is untyped
17
+ import("prismjs/components/prism-markup-templating.js");
18
+ // @ts-expect-error This is untyped
19
+ import("prismjs/components/prism-php.min.js");
20
+ // @ts-expect-error This is untyped
21
+ import("prismjs/components/prism-json.min.js");
22
+ }
23
+
24
+ import { useState } from "react";
25
+ import { cn } from "../util/cn.js";
26
+ import { useTheme } from "./context/ThemeContext.js";
27
+
28
+ type SyntaxHighlightProps = {
29
+ className?: string;
30
+ noBackground?: boolean;
31
+ wrapLines?: boolean;
32
+ copyable?: boolean;
33
+ } & Omit<HighlightProps, "children">;
34
+
35
+ export const SyntaxHighlight = ({
36
+ copyable = true,
37
+ ...props
38
+ }: SyntaxHighlightProps) => {
39
+ const [isDark] = useTheme();
40
+ const [isCopied, setIsCopied] = useState(false);
41
+
42
+ return (
43
+ <Highlight theme={isDark ? themes.vsDark : themes.github} {...props}>
44
+ {({ className, style, tokens, getLineProps, getTokenProps }) => (
45
+ <pre
46
+ className={cn(
47
+ "group relative",
48
+ className,
49
+ props.className,
50
+ props.noBackground && "!bg-transparent",
51
+ props.wrapLines && "whitespace-pre-wrap break-words",
52
+ )}
53
+ style={style}
54
+ >
55
+ {copyable && (
56
+ <button
57
+ type="button"
58
+ aria-label="Copy code"
59
+ className="absolute top-1.5 right-3 p-3 opacity-0 group-hover:opacity-100 transition hover:bg-zinc-500/10 hover:dark:bg-zinc-700/25 rounded-lg text-sm text-gray-400 hover:text-gray-600 dark:text-gray-500 dark:hover:text-gray-400"
60
+ disabled={isCopied}
61
+ onClick={() => {
62
+ setIsCopied(true);
63
+ navigator.clipboard.writeText(
64
+ tokens
65
+ .map((line) => line.map(({ content }) => content).join(""))
66
+ .join("\n"),
67
+ );
68
+ setTimeout(() => setIsCopied(false), 2000);
69
+ }}
70
+ >
71
+ {isCopied ? (
72
+ <CheckIcon className="text-emerald-600" size={18} />
73
+ ) : (
74
+ <CopyIcon size={18} />
75
+ )}
76
+ </button>
77
+ )}
78
+ <span className="absolute top-1.5 right-3 text-[11px] font-mono text-muted-foreground transition group-hover:opacity-0">
79
+ {props.language}
80
+ </span>
81
+ {tokens.map((line, i) => (
82
+ <div key={i} {...getLineProps({ line })}>
83
+ {line.map((token, key) => (
84
+ <span key={key} {...getTokenProps({ token })} />
85
+ ))}
86
+ </div>
87
+ ))}
88
+ </pre>
89
+ )}
90
+ </Highlight>
91
+ );
92
+ };
@@ -0,0 +1,32 @@
1
+ import { cx } from "class-variance-authority";
2
+ import { NavLink } from "react-router-dom";
3
+
4
+ import { useDevPortal } from "./context/DevPortalProvider.js";
5
+
6
+ export const TopNavigation = () => {
7
+ const { navigation } = useDevPortal();
8
+
9
+ return (
10
+ <nav className="border-b border-border text-sm px-12 h-[--top-nav-height]">
11
+ <ul className="flex flex-row items-center gap-8">
12
+ {navigation.map((item) => (
13
+ <li key={item.label}>
14
+ <NavLink
15
+ className={({ isActive }) =>
16
+ cx(
17
+ "block py-3.5 font-medium -mb-px border-b-2",
18
+ isActive
19
+ ? "border-primary text-foreground"
20
+ : "border-transparent text-foreground/75 hover:text-foreground hover:border-accent-foreground/25",
21
+ )
22
+ }
23
+ to={item.path}
24
+ >
25
+ {item.label}
26
+ </NavLink>
27
+ </li>
28
+ ))}
29
+ </ul>
30
+ </nav>
31
+ );
32
+ };
@@ -0,0 +1,24 @@
1
+ import {
2
+ createContext,
3
+ useContext,
4
+ type ComponentProps,
5
+ type ComponentType,
6
+ } from "react";
7
+ import { Header } from "../Header.js";
8
+
9
+ export const DEFAULT_COMPONENTS = {
10
+ Header,
11
+ };
12
+
13
+ export type ComponentsContextType = {
14
+ Header?: ComponentType<ComponentProps<typeof Header>>;
15
+ };
16
+
17
+ const ComponentsContext =
18
+ createContext<Required<ComponentsContextType>>(DEFAULT_COMPONENTS);
19
+
20
+ export const ComponentsProvider = ComponentsContext.Provider;
21
+
22
+ export const useComponents = () => {
23
+ return useContext(ComponentsContext);
24
+ };
@@ -0,0 +1,54 @@
1
+ import { useSuspenseQuery } from "@tanstack/react-query";
2
+ import { createContext, useContext } from "react";
3
+ import { matchPath, useLocation } from "react-router-dom";
4
+ import { DevPortalContext } from "../../core/DevPortalContext.js";
5
+
6
+ const DevPortalReactContext = createContext<DevPortalContext | undefined>(
7
+ undefined,
8
+ );
9
+
10
+ export const DevPortalProvider = DevPortalReactContext.Provider;
11
+
12
+ export const useDevPortal = () => {
13
+ const context = useContext(DevPortalReactContext);
14
+
15
+ if (!context) {
16
+ throw new Error("useDevPortal must be used within a DevPortalProvider.");
17
+ }
18
+
19
+ return context;
20
+ };
21
+
22
+ export const useApiIdentities = () => {
23
+ const { getApiIdentities } = useDevPortal();
24
+ return useSuspenseQuery({
25
+ queryFn: getApiIdentities,
26
+ queryKey: ["api-keys"],
27
+ });
28
+ };
29
+
30
+ export const useTopNavigationItem = () => {
31
+ const { navigation } = useDevPortal();
32
+ const location = useLocation();
33
+
34
+ return navigation.find((item) =>
35
+ matchPath({ path: item.path, end: false }, location.pathname),
36
+ );
37
+ };
38
+
39
+ export const useNavigation = () => {
40
+ const { getNavigation } = useDevPortal();
41
+ const navItem = useTopNavigationItem();
42
+
43
+ const path = navItem?.path ?? "";
44
+
45
+ return useSuspenseQuery({
46
+ queryFn: async () => {
47
+ return {
48
+ items: [...(navItem?.categories ?? []), ...(await getNavigation(path))],
49
+ currentTopNavItem: navItem,
50
+ };
51
+ },
52
+ queryKey: ["navigation", path],
53
+ });
54
+ };
File without changes
@@ -0,0 +1,46 @@
1
+ import {
2
+ createContext,
3
+ type ReactNode,
4
+ useCallback,
5
+ useEffect,
6
+ useState,
7
+ useContext,
8
+ } from "react";
9
+
10
+ const ThemeContext = createContext<readonly [boolean, () => void]>([
11
+ false,
12
+ () => {},
13
+ ]);
14
+
15
+ export const useTheme = () => {
16
+ const context = useContext(ThemeContext);
17
+ if (!context) {
18
+ throw new Error("useTheme must be used within a ThemeProvider");
19
+ }
20
+ return context;
21
+ };
22
+
23
+ export const ThemeProvider = (props: { children: ReactNode }) => {
24
+ const [dark, setDark] = useState(false);
25
+
26
+ // On mount, read the preferred theme from the persistence
27
+ useEffect(() => {
28
+ const theme = localStorage.getItem("theme");
29
+ const prefersDark = window.matchMedia("(prefers-color-scheme: dark)");
30
+ const isDark = theme === "dark" || (!theme && prefersDark.matches);
31
+
32
+ setDark(isDark);
33
+ }, [dark]);
34
+
35
+ // To toggle between dark and light modes
36
+ const toggle = useCallback(() => {
37
+ const toggled = !dark;
38
+ document.documentElement.classList.toggle("dark", toggled);
39
+ localStorage.setItem("theme", toggled ? "dark" : "light");
40
+ setDark(toggled);
41
+ }, [dark]);
42
+
43
+ const value = [dark, toggle] as const;
44
+
45
+ return <ThemeContext.Provider value={value} {...props} />;
46
+ };
@@ -0,0 +1,139 @@
1
+ import {
2
+ type ReactNode,
3
+ createContext,
4
+ useCallback,
5
+ useContext,
6
+ useEffect,
7
+ useMemo,
8
+ useRef,
9
+ useState,
10
+ } from "react";
11
+
12
+ type AnchorContextType = {
13
+ activeAnchor?: string;
14
+ setActiveAnchor: (anchor: string) => void;
15
+ observe: (element: HTMLElement | null) => void;
16
+ unobserve: (element: HTMLElement | null) => void;
17
+ };
18
+
19
+ const ViewportAnchorContext = createContext<AnchorContextType | undefined>(
20
+ undefined,
21
+ );
22
+
23
+ export const useViewportAnchor = () => {
24
+ const context = useContext(ViewportAnchorContext);
25
+
26
+ if (!context) {
27
+ throw new Error(
28
+ "useViewportAnchor must be used within a CurrentAnchorProvider",
29
+ );
30
+ }
31
+
32
+ return context;
33
+ };
34
+
35
+ export const useRegisterAnchorElement = () => {
36
+ const elementRef = useRef<HTMLElement | null>(null);
37
+
38
+ const { observe, unobserve } = useViewportAnchor();
39
+
40
+ useEffect(() => {
41
+ const element = elementRef.current;
42
+
43
+ if (!element) return;
44
+
45
+ observe(element);
46
+
47
+ return () => unobserve(element);
48
+ }, [observe, unobserve]);
49
+
50
+ const setRef = useCallback((el: HTMLElement | null) => {
51
+ if (!el) return;
52
+ elementRef.current = el;
53
+ }, []);
54
+
55
+ return { ref: setRef };
56
+ };
57
+
58
+ export const ViewportAnchorProvider = ({
59
+ children,
60
+ }: {
61
+ children: ReactNode;
62
+ }) => {
63
+ const [activeAnchor, setActiveAnchor] = useState("");
64
+ const observerRef = useRef<IntersectionObserver | null>(null);
65
+ const registeredElements = useRef(new Set<HTMLElement>());
66
+
67
+ useEffect(() => {
68
+ observerRef.current = new IntersectionObserver(
69
+ (entries) => {
70
+ for (const entry of entries) {
71
+ if (entry.isIntersecting && entry.target.id) {
72
+ setActiveAnchor(entry.target.id);
73
+ }
74
+ }
75
+ },
76
+ {
77
+ // 115px is the height of the sticky header
78
+ // see --header-height in `main.css`
79
+ rootMargin: "115px 0px -80% 0px",
80
+ threshold: 0.75,
81
+ },
82
+ );
83
+
84
+ return () => observerRef.current?.disconnect();
85
+ }, []);
86
+
87
+ useEffect(() => {
88
+ const elements = registeredElements.current;
89
+ const handleScroll = () => {
90
+ const hasReachedTop = window.scrollY === 0;
91
+ const hasReachedBottom =
92
+ window.innerHeight + window.scrollY >= document.body.scrollHeight;
93
+
94
+ if (hasReachedTop) {
95
+ // reset the active anchor when we reach the top
96
+ setActiveAnchor("");
97
+ } else if (hasReachedBottom) {
98
+ requestIdleCallback(() => {
99
+ // set the last anchor when we reach the bottom
100
+ const lastItem = Array.from(elements).pop();
101
+ setActiveAnchor(lastItem?.id ?? "");
102
+ });
103
+ }
104
+ };
105
+
106
+ document.addEventListener("scroll", handleScroll);
107
+
108
+ return () => {
109
+ elements.clear();
110
+ document.removeEventListener("scroll", handleScroll);
111
+ };
112
+ }, []);
113
+
114
+ const observeFns = useMemo(() => {
115
+ return {
116
+ observe: (element: HTMLElement | null) => {
117
+ if (!element || !observerRef.current) return;
118
+ registeredElements.current.add(element);
119
+ observerRef.current.observe(element);
120
+ },
121
+ unobserve: (element: HTMLElement | null) => {
122
+ if (!element || !observerRef.current) return;
123
+ registeredElements.current.delete(element);
124
+ observerRef.current.unobserve(element);
125
+ },
126
+ };
127
+ }, []);
128
+
129
+ const value = useMemo(
130
+ () => ({ activeAnchor, setActiveAnchor, ...observeFns }),
131
+ [activeAnchor, setActiveAnchor, observeFns],
132
+ );
133
+
134
+ return (
135
+ <ViewportAnchorContext.Provider value={value}>
136
+ {children}
137
+ </ViewportAnchorContext.Provider>
138
+ );
139
+ };
@@ -0,0 +1,18 @@
1
+ import { useRef } from "react";
2
+
3
+ import { useNavigation } from "../context/DevPortalProvider.js";
4
+ import { SideNavigationCategory } from "./SideNavigationCategory.js";
5
+ import { SideNavigationWrapper } from "./SideNavigationWrapper.js";
6
+
7
+ export const SideNavigation = () => {
8
+ const navRef = useRef<HTMLDivElement | null>(null);
9
+ const navigation = useNavigation();
10
+
11
+ return (
12
+ <SideNavigationWrapper ref={navRef}>
13
+ {navigation.data.items.map((category) => (
14
+ <SideNavigationCategory key={category.label} category={category} />
15
+ ))}
16
+ </SideNavigationWrapper>
17
+ );
18
+ };
@@ -0,0 +1,74 @@
1
+ import * as Collapsible from "@radix-ui/react-collapsible";
2
+ import { ChevronRightIcon } from "lucide-react";
3
+ import { useLocation } from "react-router-dom";
4
+ import type { NavigationCategory } from "../../core/DevPortalContext.js";
5
+ import { cn } from "../../util/cn.js";
6
+ import { joinPath } from "../../util/joinPath.js";
7
+ import { useTopNavigationItem } from "../context/DevPortalProvider.js";
8
+ import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
9
+ import { SideNavigationItem } from "./SideNavigationItem.js";
10
+ import { useNavigationCollapsibleState } from "./useNavigationCollapsibleState.js";
11
+ import { checkHasActiveItem, isPathItem } from "./util.js";
12
+
13
+ export const SideNavigationCategory = ({
14
+ category,
15
+ }: {
16
+ category: NavigationCategory;
17
+ }) => {
18
+ const { activeAnchor } = useViewportAnchor();
19
+ const navItem = useTopNavigationItem();
20
+ const location = useLocation();
21
+
22
+ const isCollapsible = category.collapsible ?? true;
23
+
24
+ const [isOpen, setIsOpen] = useNavigationCollapsibleState({
25
+ item: category,
26
+ path: navItem?.path ?? "",
27
+ defaultOpen: () =>
28
+ !isCollapsible ||
29
+ category.expanded ||
30
+ checkHasActiveItem(category, location.pathname, navItem?.path ?? ""),
31
+ });
32
+
33
+ return (
34
+ <Collapsible.Root
35
+ key={category.label}
36
+ open={isOpen}
37
+ onOpenChange={() => setIsOpen((prev) => !prev)}
38
+ >
39
+ {category.label.length > 0 && (
40
+ <Collapsible.Trigger asChild={isCollapsible} disabled={!isCollapsible}>
41
+ <h5
42
+ className={cn(
43
+ "flex group items-center justify-between cursor-pointer font-semibold text-foreground/90 px-[--padding-nav-item] py-1.5 rounded-lg transition-colors duration-300 -mx-[--padding-nav-item]",
44
+ isCollapsible ? "hover:bg-accent" : "cursor-auto",
45
+ )}
46
+ >
47
+ {category.label}
48
+ {isCollapsible && (
49
+ <ChevronRightIcon
50
+ className="group-data-[state=open]:rotate-90 transition"
51
+ size={16}
52
+ />
53
+ )}
54
+ </h5>
55
+ </Collapsible.Trigger>
56
+ )}
57
+ <Collapsible.Content className="CollapsibleContent -mx-[--padding-nav-item]">
58
+ {/* margin on Collapsible.Content will lead jumpiness when animating because it's not added to the calculated height */}
59
+ <ul className="space-y-0.5 mt-1.5 mb-4 ms-3">
60
+ {category.children.map((item) => (
61
+ <SideNavigationItem
62
+ key={isPathItem(item) ? item.path + item.label : item.href}
63
+ category={category}
64
+ item={item}
65
+ activeAnchor={activeAnchor}
66
+ currentTopNavItem={navItem}
67
+ basePath={joinPath(navItem?.path, category.path)}
68
+ />
69
+ ))}
70
+ </ul>
71
+ </Collapsible.Content>
72
+ </Collapsible.Root>
73
+ );
74
+ };
@@ -0,0 +1,143 @@
1
+ import * as Collapsible from "@radix-ui/react-collapsible";
2
+ import { cva } from "class-variance-authority";
3
+ import { ChevronRightIcon, ExternalLinkIcon } from "lucide-react";
4
+ import { NavLink, useLocation } from "react-router-dom";
5
+
6
+ import type {
7
+ NavigationCategory,
8
+ NavigationCategoryItem,
9
+ NavigationItem,
10
+ } from "../../core/DevPortalContext.js";
11
+ import { cn } from "../../util/cn.js";
12
+ import { joinPath } from "../../util/joinPath.js";
13
+ import { AnchorLink } from "../AnchorLink.js";
14
+ import { DynamicIcon, isValidIcon } from "../DynamicIcon.js";
15
+ import { useNavigationCollapsibleState } from "./useNavigationCollapsibleState.js";
16
+ import { checkHasActiveItem, isLinkItem, isPathItem } from "./util.js";
17
+
18
+ export const linkItem = cva(
19
+ "flex px-[--padding-nav-item] py-1.5 rounded-lg hover:bg-accent transition-colors duration-300",
20
+ {
21
+ variants: {
22
+ isActive: {
23
+ true: "text-primary font-medium",
24
+ false: "text-foreground/80",
25
+ },
26
+ },
27
+ },
28
+ );
29
+
30
+ export const DATA_ANCHOR_ATTR = "data-anchor";
31
+
32
+ export const SideNavigationItem = ({
33
+ category,
34
+ item,
35
+ activeAnchor,
36
+ currentTopNavItem,
37
+ basePath = "",
38
+ }: {
39
+ category: NavigationCategory;
40
+ item: NavigationCategoryItem;
41
+ activeAnchor?: string;
42
+ currentTopNavItem?: NavigationItem;
43
+ basePath?: string;
44
+ }) => {
45
+ const currentPath = isPathItem(item) ? joinPath(basePath, item.path) : "";
46
+ const location = useLocation();
47
+
48
+ const [isOpen, setIsOpen] = useNavigationCollapsibleState({
49
+ item,
50
+ path: currentPath,
51
+ defaultOpen: () => checkHasActiveItem(item, location.pathname, currentPath),
52
+ });
53
+
54
+ if (isLinkItem(item)) {
55
+ const classes = cn(
56
+ "flex items-center gap-2",
57
+ linkItem({ isActive: item.href === location.pathname }),
58
+ );
59
+ return item.href.startsWith("http") ? (
60
+ <a
61
+ className={classes}
62
+ href={item.href}
63
+ target="_blank"
64
+ rel="noopener noreferrer"
65
+ >
66
+ {item.label}
67
+ <ExternalLinkIcon size={14} />
68
+ </a>
69
+ ) : (
70
+ <NavLink className={classes} to={item.href}>
71
+ {item.label}
72
+ </NavLink>
73
+ );
74
+ }
75
+
76
+ const linkContent = (
77
+ <div className="flex justify-between w-full">
78
+ <div className="flex items-center gap-2 truncate w-full">
79
+ {isValidIcon(item.icon) && <DynamicIcon name={item.icon} size={16} />}
80
+ {typeof item.label !== "string" ? (
81
+ item.label
82
+ ) : (
83
+ <span className="truncate">{item.label}</span>
84
+ )}
85
+ </div>
86
+ {item.children && (
87
+ <ChevronRightIcon
88
+ size={16}
89
+ className="transition shrink-0 group-data-[state=open]:rotate-90"
90
+ />
91
+ )}
92
+ </div>
93
+ );
94
+
95
+ return (
96
+ <li title={typeof item.label === "string" ? item.label : item.title}>
97
+ {item.children ? (
98
+ <Collapsible.Root
99
+ open={isOpen}
100
+ onOpenChange={() => setIsOpen((prev) => !prev)}
101
+ className="flex flex-col"
102
+ >
103
+ <Collapsible.Trigger
104
+ className={cn("group text-start", linkItem({ isActive: false }))}
105
+ >
106
+ {linkContent}
107
+ </Collapsible.Trigger>
108
+ <Collapsible.Content className="CollapsibleContent ms-[calc(var(--padding-nav-item)*1.125)]">
109
+ <ul className="mt-1 border-border border-l ps-1.5">
110
+ {item.children.map((child) => (
111
+ <SideNavigationItem
112
+ key={isPathItem(child) ? child.path : child.href}
113
+ category={category}
114
+ item={child}
115
+ activeAnchor={activeAnchor}
116
+ currentTopNavItem={currentTopNavItem}
117
+ basePath={currentPath}
118
+ />
119
+ ))}
120
+ </ul>
121
+ </Collapsible.Content>
122
+ </Collapsible.Root>
123
+ ) : item.path.startsWith("#") ? (
124
+ <AnchorLink
125
+ to={item.path}
126
+ {...{ [DATA_ANCHOR_ATTR]: item.path }}
127
+ className={linkItem({
128
+ isActive: item.path.slice(1) === activeAnchor,
129
+ })}
130
+ >
131
+ {linkContent}
132
+ </AnchorLink>
133
+ ) : (
134
+ <NavLink
135
+ className={({ isActive }) => linkItem({ isActive })}
136
+ to={currentPath}
137
+ >
138
+ {linkContent}
139
+ </NavLink>
140
+ )}
141
+ </li>
142
+ );
143
+ };
@@ -0,0 +1,15 @@
1
+ import { forwardRef, type PropsWithChildren } from "react";
2
+
3
+ export const SideNavigationWrapper = forwardRef<
4
+ HTMLDivElement,
5
+ PropsWithChildren
6
+ >(({ children }, ref) => {
7
+ return (
8
+ <nav
9
+ className="hidden lg:flex flex-col fixed text-sm overflow-y-auto shrink-0 p-[--padding-nav-item] -mx-[--padding-nav-item] pb-20 pt-[--padding-content-top] w-[--side-nav-width] h-[calc(100%-var(--header-height))] scroll-pt-2 gap-2"
10
+ ref={ref}
11
+ >
12
+ {children}
13
+ </nav>
14
+ );
15
+ });
@@ -0,0 +1,27 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ import { useLocation } from "react-router-dom";
3
+ import type { NavigationNode } from "../../util/traverseNavigation.js";
4
+ import { checkHasActiveItem } from "./util.js";
5
+
6
+ export const useNavigationCollapsibleState = ({
7
+ item,
8
+ defaultOpen,
9
+ path,
10
+ }: {
11
+ item: NavigationNode;
12
+ defaultOpen: () => boolean;
13
+ path: string;
14
+ }) => {
15
+ const [isOpen, setIsOpen] = useState(defaultOpen);
16
+ const location = useLocation();
17
+ const previousLocationPath = useRef(location.pathname);
18
+
19
+ useEffect(() => {
20
+ if (!isOpen && previousLocationPath.current !== location.pathname) {
21
+ setIsOpen(checkHasActiveItem(item, location.pathname, path));
22
+ }
23
+ previousLocationPath.current = location.pathname;
24
+ }, [isOpen, item, path, location.pathname]);
25
+
26
+ return [isOpen, setIsOpen] as const;
27
+ };