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,108 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import type { OpenAPIDocument } from "../index.js";
3
+ /**
4
+ * Upgrade from OpenAPI 3.0.x to 3.1.0
5
+ *
6
+ * Taken from https://github.com/scalar/openapi-parser/blob/main/packages/openapi-parser/src/utils/upgradeFromThreeToThreeOne.ts
7
+ * https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0
8
+ */
9
+ export function traverse(
10
+ specification: Record<string, any>,
11
+ transform: (specification: Record<string, any>) => Record<string, any>,
12
+ ) {
13
+ const result: Record<string, any> = {};
14
+
15
+ for (const [key, value] of Object.entries(specification)) {
16
+ if (Array.isArray(value)) {
17
+ result[key] = value.map((item) =>
18
+ typeof item === "object" && item !== null
19
+ ? traverse(item, transform)
20
+ : item,
21
+ );
22
+ } else if (typeof value === "object" && value !== null) {
23
+ result[key] = traverse(value, transform);
24
+ } else {
25
+ result[key] = value;
26
+ }
27
+ }
28
+
29
+ return transform(result);
30
+ }
31
+
32
+ export const upgradeSchema = (schema: Record<string, any>): OpenAPIDocument => {
33
+ if (schema.openapi?.startsWith("3.0")) {
34
+ schema.openapi = "3.1.0";
35
+ }
36
+
37
+ schema = traverse(schema, (sub) => {
38
+ if (sub.type !== "undefined" && sub.nullable === true) {
39
+ sub.type = ["null", sub.type];
40
+ delete sub.nullable;
41
+ }
42
+
43
+ return sub;
44
+ });
45
+
46
+ schema = traverse(schema, (sub) => {
47
+ if (sub.exclusiveMinimum === true) {
48
+ sub.exclusiveMinimum = sub.minimum;
49
+ delete sub.minimum;
50
+ } else if (sub.exclusiveMinimum === false) {
51
+ delete sub.exclusiveMinimum;
52
+ }
53
+
54
+ if (sub.exclusiveMaximum === true) {
55
+ sub.exclusiveMaximum = sub.maximum;
56
+ delete sub.maximum;
57
+ } else if (sub.exclusiveMaximum === false) {
58
+ delete sub.exclusiveMaximum;
59
+ }
60
+
61
+ return sub;
62
+ });
63
+
64
+ schema = traverse(schema, (sub) => {
65
+ if (sub.example !== undefined) {
66
+ sub.examples = {
67
+ default: sub.example,
68
+ };
69
+ delete sub.example;
70
+ }
71
+
72
+ return sub;
73
+ });
74
+
75
+ schema = traverse(schema, (sub) => {
76
+ if (sub.type === "object" && sub.properties !== undefined) {
77
+ for (const [, value] of Object.entries(sub.properties)) {
78
+ const v = (value ?? {}) as Record<string, any>;
79
+ if (v.type === "string" && v.format === "binary") {
80
+ v.contentEncoding = "application/octet-stream";
81
+ delete v.format;
82
+ }
83
+ }
84
+ }
85
+ return sub;
86
+ });
87
+
88
+ schema = traverse(schema, (sub) => {
89
+ if (sub.type === "string" && sub.format === "binary") {
90
+ return undefined as any;
91
+ }
92
+
93
+ return sub;
94
+ });
95
+
96
+ schema = traverse(schema, (sub) => {
97
+ if (sub.type === "string" && sub.format === "base64") {
98
+ return {
99
+ type: "string",
100
+ contentEncoding: "base64",
101
+ };
102
+ }
103
+
104
+ return sub;
105
+ });
106
+
107
+ return schema as OpenAPIDocument;
108
+ };
@@ -0,0 +1,22 @@
1
+ import { useApiIdentities } from "../../components/context/DevPortalProvider.js";
2
+ import { type ApiKeyPluginOptions } from "./index.js";
3
+
4
+ export const SettingsApiKeys = ({
5
+ options,
6
+ }: {
7
+ options: ApiKeyPluginOptions;
8
+ }) => {
9
+ const keys = useApiIdentities();
10
+
11
+ return (
12
+ <div className="prose dark:prose-invert">
13
+ <h1>Who's who</h1>
14
+ <button className="border">Create API Key</button>
15
+ <ul>
16
+ {keys.data.map((key) => (
17
+ <li>{key.name}</li>
18
+ ))}
19
+ </ul>
20
+ </div>
21
+ );
22
+ };
@@ -0,0 +1,123 @@
1
+ import { DevPortalSystemPaths } from "../../DevPortal.js";
2
+ import { DevPortalContext } from "../../core/DevPortalContext.js";
3
+ import {
4
+ type ApiIdentityPlugin,
5
+ type DevPortalPlugin,
6
+ } from "../../core/plugins.js";
7
+ import { SettingsApiKeys } from "./SettingsApiKeys.js";
8
+
9
+ export type GetConsumerOptions =
10
+ | {
11
+ getConsumers: (context: DevPortalContext) => Promise<ConsumerData | void>;
12
+ }
13
+ | { consumerEndpoint: string };
14
+
15
+ export type ApiKeyPluginOptions = {
16
+ rollKey?: (
17
+ id: string,
18
+ consumerName: string,
19
+ context: DevPortalContext,
20
+ ) => Promise<void>;
21
+ deleteKey?: (
22
+ id: string,
23
+ consumerName: string,
24
+ context: DevPortalContext,
25
+ ) => Promise<void>;
26
+ updateConsumerDescription?: (
27
+ consumerName: string,
28
+ description: string,
29
+ context: DevPortalContext,
30
+ ) => Promise<void>;
31
+ createConsumer?: (
32
+ description: string,
33
+ context: DevPortalContext,
34
+ ) => Promise<void>;
35
+ deleteConsumer?: (
36
+ consumerName: string,
37
+ context: DevPortalContext,
38
+ ) => Promise<void>;
39
+ } & GetConsumerOptions;
40
+
41
+ export interface ConsumerData {
42
+ consumers: Consumer[];
43
+ }
44
+
45
+ export interface Consumer {
46
+ name: string;
47
+ createdOn?: string;
48
+ description?: string;
49
+ apiKeys: ConsumerApiKey[];
50
+ }
51
+
52
+ export interface ConsumerApiKey {
53
+ id: string;
54
+ description?: string;
55
+ createdOn?: string;
56
+ updatedOn?: string;
57
+ expiresOn?: string;
58
+ key: string;
59
+ }
60
+
61
+ const defaultGetConsumers = async (context: DevPortalContext) => {
62
+ const accessToken = await context.authentication?.getToken?.(context);
63
+
64
+ if (!accessToken) {
65
+ throw new Error("No token found");
66
+ }
67
+
68
+ const consumers = await fetch(
69
+ "https://zudoku-customer-main-b36fa2f.d2.zuplo.dev/v1/developer/api-keys",
70
+ {
71
+ headers: {
72
+ Authorization: `Bearer ${accessToken}`,
73
+ },
74
+ },
75
+ );
76
+
77
+ return { consumers: [await consumers.json()] };
78
+ };
79
+
80
+ export const apiKeyPlugin = (
81
+ options: ApiKeyPluginOptions,
82
+ ): DevPortalPlugin & ApiIdentityPlugin => {
83
+ const getConsumers =
84
+ "getConsumers" in options ? options.getConsumers : defaultGetConsumers;
85
+
86
+ return {
87
+ getNavigation: async (path: string) => {
88
+ if (path !== DevPortalSystemPaths.Settings) {
89
+ return [];
90
+ }
91
+
92
+ return [
93
+ {
94
+ path: "settings/api-keys",
95
+ label: "API Keys",
96
+ children: [],
97
+ },
98
+ ];
99
+ },
100
+ getIdentities: async (context) => {
101
+ return [];
102
+ // throw new Error("Not implemented");
103
+ // const keys = await getConsumers(context);
104
+ // return (keys ?? { consumers: [] }).consumers
105
+ // .flatMap((consumer) => consumer.apiKeys)
106
+ // .map((key) => ({
107
+ // authorizeRequest: (request: Request) => {
108
+ // request.headers.set("Authorization", `Bearer ${key.key}`);
109
+ // },
110
+ // id: key.id,
111
+ // name: key.id,
112
+ // }));
113
+ },
114
+ getRoutes: () => {
115
+ return [
116
+ {
117
+ path: "/settings/api-keys",
118
+ element: <SettingsApiKeys options={options} />,
119
+ },
120
+ ];
121
+ },
122
+ };
123
+ };
@@ -0,0 +1,128 @@
1
+ import { useMemo, type PropsWithChildren, type ReactNode } from "react";
2
+ import { Heading } from "../../Heading.js";
3
+ import { CategoryHeading } from "../../components/CategoryHeading.js";
4
+ import { ProseClasses } from "../../components/Markdown.js";
5
+ import { useTopNavigationItem } from "../../components/context/DevPortalProvider.js";
6
+ import { isPathItem } from "../../components/navigation/util.js";
7
+ import { Helmet } from "../../core/helmet.js";
8
+ import { Link, useLocation } from "../../core/router.js";
9
+ import { cn } from "../../util/cn.js";
10
+ import slugify from "../../util/slugify.js";
11
+ import { traverseNavigation } from "../../util/traverseNavigation.js";
12
+ import { Toc } from "./Toc.js";
13
+ import type { MDXImport } from "./index.js";
14
+
15
+ export const MdxPage = ({
16
+ children,
17
+ frontmatter,
18
+ tableOfContents,
19
+ }: PropsWithChildren<Omit<MDXImport, "default">>) => {
20
+ const navItem = useTopNavigationItem();
21
+ const location = useLocation();
22
+
23
+ const categoryTitle = navItem
24
+ ? traverseNavigation(navItem, (_node, fullPath, parentNodes) => {
25
+ if (fullPath === location.pathname) {
26
+ return parentNodes.at(0)?.label;
27
+ }
28
+ })
29
+ : undefined;
30
+
31
+ const title = frontmatter?.title;
32
+ const category = frontmatter?.category ?? categoryTitle;
33
+ const hideToc = frontmatter?.toc === false;
34
+
35
+ const pageTitle =
36
+ tableOfContents.find((item) => item.depth === 1)?.value ?? title;
37
+
38
+ const tocEntries =
39
+ tableOfContents.find((item) => item.depth === 1)?.children ??
40
+ // if `title` is provided by frontmatter it does not appear in the table of contents
41
+ tableOfContents.filter((item) => item.depth === 2);
42
+
43
+ const showToc = !hideToc && tocEntries.length > 0;
44
+
45
+ const { prev, next } = useMemo(() => {
46
+ let prev = { path: "", label: "" as ReactNode };
47
+ let next = { path: "", label: "" as ReactNode };
48
+ let shouldStop = false;
49
+
50
+ if (!navItem) return { prev, next };
51
+
52
+ traverseNavigation(navItem, (node, fullPath) => {
53
+ const item = { path: fullPath, label: node.label };
54
+
55
+ if (shouldStop && isPathItem(node) && !node.children?.length) {
56
+ next = item;
57
+ return true;
58
+ }
59
+ if (fullPath === location.pathname) {
60
+ shouldStop = true;
61
+ }
62
+ if (!shouldStop && isPathItem(node) && !node.children?.length) {
63
+ prev = item;
64
+ }
65
+ });
66
+
67
+ return { prev, next } as const;
68
+ }, [navItem, location.pathname]);
69
+
70
+ return (
71
+ <div className="xl:grid grid-cols-[--sidecar-grid-cols] gap-8 justify-between">
72
+ <Helmet>
73
+ <title>{pageTitle}</title>
74
+ </Helmet>
75
+ <div
76
+ className={cn(
77
+ ProseClasses,
78
+ "mx-auto max-w-full xl:w-full xl:max-w-prose flex-1 flex-shrink pt-[--padding-content-top] pb-[--padding-content-bottom]",
79
+ )}
80
+ >
81
+ <header className="-translate-y-1">
82
+ {category && <CategoryHeading>{category}</CategoryHeading>}
83
+ {title && (
84
+ <Heading level={1} id={slugify(title, { lower: true })}>
85
+ {title}
86
+ </Heading>
87
+ )}
88
+ {frontmatter?.description && (
89
+ <p className="prose-lg">{frontmatter.description}</p>
90
+ )}
91
+ </header>
92
+ {children}
93
+ <hr />
94
+ <div className="not-prose flex items-center justify-between gap-8">
95
+ {prev.path ? (
96
+ <Link
97
+ to={prev.path}
98
+ className="flex flex-col items-stretch gap-2 flex-1 truncate border border-border rounded px-6 py-4 text-start hover:border-primary/85 transition shadow-sm hover:shadow-md"
99
+ title={typeof prev.label === "string" ? prev.label : undefined}
100
+ >
101
+ <div className="text-sm text-muted-foreground">
102
+ ← Previous page
103
+ </div>
104
+ <div className="text-lg text-primary truncate">{prev.label}</div>
105
+ </Link>
106
+ ) : (
107
+ <div className="flex-1" />
108
+ )}
109
+ {next.path ? (
110
+ <Link
111
+ to={next.path}
112
+ className="flex flex-col items-stretch gap-2 flex-1 truncate border border-border rounded px-6 py-4 text-end hover:border-primary/85 transition shadow-sm hover:shadow-md"
113
+ title={typeof next.label === "string" ? next.label : undefined}
114
+ >
115
+ <div className="text-sm text-muted-foreground">Next page →</div>
116
+ <div className="text-lg text-primary truncate">{next.label}</div>
117
+ </Link>
118
+ ) : (
119
+ <div className="flex-1" />
120
+ )}
121
+ </div>
122
+ </div>
123
+ <div className="hidden xl:block">
124
+ {showToc && <Toc entries={tocEntries} />}
125
+ </div>
126
+ </div>
127
+ );
128
+ };
@@ -0,0 +1,122 @@
1
+ import type { TocEntry } from "@stefanprobst/rehype-extract-toc";
2
+ import {
3
+ useEffect,
4
+ useRef,
5
+ useState,
6
+ type CSSProperties,
7
+ type PropsWithChildren,
8
+ } from "react";
9
+ import { AnchorLink } from "../../components/AnchorLink.js";
10
+ import { useViewportAnchor } from "../../components/context/ViewportAnchorContext.js";
11
+ import { ListTreeIcon } from "../../core/icons.js";
12
+ import { cn } from "../../util/cn.js";
13
+
14
+ const DATA_ANCHOR_ATTR = "data-active";
15
+
16
+ const TocItem = ({
17
+ item,
18
+ children,
19
+ className,
20
+ isActive,
21
+ }: PropsWithChildren<{
22
+ item: TocEntry;
23
+ isActive: boolean;
24
+ className?: string;
25
+ }>) => {
26
+ return (
27
+ <li
28
+ className={cn(
29
+ "truncate",
30
+ isActive
31
+ ? "text-primary"
32
+ : "text-foreground/65 dark:text-foreground/75",
33
+ className,
34
+ )}
35
+ title={item.value}
36
+ >
37
+ <AnchorLink
38
+ to={`#${item.id}`}
39
+ {...{ [DATA_ANCHOR_ATTR]: item.id }}
40
+ className={cn(
41
+ isActive
42
+ ? "text-primary"
43
+ : "text-foreground/65 dark:text-foreground/75 hover:text-foreground",
44
+ )}
45
+ >
46
+ {item.value}
47
+ </AnchorLink>
48
+ {children}
49
+ </li>
50
+ );
51
+ };
52
+
53
+ export const Toc = ({ entries }: { entries: TocEntry[] }) => {
54
+ const { activeAnchor } = useViewportAnchor();
55
+ const listWrapperRef = useRef<HTMLUListElement>(null);
56
+ const [indicatorStyle, setIndicatorStyles] = useState<CSSProperties>({});
57
+
58
+ // synchronize active anchor indicator with the scroll position
59
+ useEffect(() => {
60
+ if (!listWrapperRef.current) return;
61
+
62
+ const activeElement = listWrapperRef.current.querySelector(
63
+ `[${DATA_ANCHOR_ATTR}='${activeAnchor}']`,
64
+ );
65
+
66
+ if (!activeElement) {
67
+ setIndicatorStyles({
68
+ "--indicator-top": "0",
69
+ "--indicator-opacity": 0,
70
+ } as CSSProperties);
71
+ return;
72
+ }
73
+
74
+ const topParent = listWrapperRef.current.getBoundingClientRect().top;
75
+ const topElement = activeElement.getBoundingClientRect().top;
76
+
77
+ setIndicatorStyles({
78
+ "--indicator-top": `${topElement - topParent}px`,
79
+ "--indicator-opacity": 1,
80
+ } as CSSProperties);
81
+ }, [activeAnchor]);
82
+
83
+ return (
84
+ <aside className="sticky top-[--header-height] h-[calc(100vh-var(--header-height))] pt-[--padding-content-top] pb-[--padding-content-bottom] overflow-y-auto ps-1 text-sm">
85
+ <div className="flex items-center gap-2 font-medium mb-2">
86
+ <ListTreeIcon size={16} />
87
+ On this page
88
+ </div>
89
+
90
+ <ul
91
+ ref={listWrapperRef}
92
+ style={indicatorStyle}
93
+ className={cn(
94
+ "relative ms-2 ps-4 font-medium list-none mt-0 space-y-2",
95
+ "before:absolute before:inset-0 before:right-auto before:bg-border before:w-[2px]",
96
+ "after:absolute after:-left-px after:-translate-y-1 after:top-[--indicator-top] after:opacity-[--indicator-opacity] after:h-6 after:bg-primary after:w-[4px] after:rounded after:ease-out after:[transition:top__150ms,opacity_325ms]",
97
+ )}
98
+ >
99
+ {entries.map((item) => (
100
+ <TocItem
101
+ isActive={item.id === activeAnchor}
102
+ key={item.id}
103
+ item={item}
104
+ className="pl-0"
105
+ >
106
+ {item.children && (
107
+ <ul className="list-none pl-4 pt-2 space-y-2">
108
+ {item.children.map((child) => (
109
+ <TocItem
110
+ item={child}
111
+ isActive={child.id === activeAnchor}
112
+ key={child.id}
113
+ />
114
+ ))}
115
+ </ul>
116
+ )}
117
+ </TocItem>
118
+ ))}
119
+ </ul>
120
+ </aside>
121
+ );
122
+ };
@@ -0,0 +1,72 @@
1
+ import { Heading } from "../../Heading.js";
2
+ import { useTopNavigationItem } from "../../components/context/DevPortalProvider.js";
3
+ import { isPathItem } from "../../components/navigation/util.js";
4
+ import { Navigate, type RouteObject } from "../../core/router.js";
5
+ import type { MdxComponentsType } from "../../util/MdxComponents.js";
6
+ import { traverseNavigation } from "../../util/traverseNavigation.js";
7
+ import { MdxPage } from "./MdxPage.js";
8
+ import type { MarkdownPluginOptions } from "./index.js";
9
+
10
+ const MarkdownHeadings = {
11
+ h2: ({ children, id }) => (
12
+ <Heading level={2} id={id} children={children} registerSidebarAnchor />
13
+ ),
14
+ h3: ({ children, id }) => (
15
+ <Heading level={3} id={id} children={children} registerSidebarAnchor />
16
+ ),
17
+ } satisfies MdxComponentsType;
18
+
19
+ export const generateRoutes = (
20
+ markdownFiles: MarkdownPluginOptions["markdownFiles"],
21
+ ): RouteObject[] => {
22
+ const routes = Object.entries(markdownFiles).flatMap(
23
+ ([file, importPromise]) => {
24
+ // @todo we can pass in the folder name and then filter the markdown files based on that path
25
+ const match = file.match(/pages\/(.*).mdx?$/);
26
+ const path = match?.at(1);
27
+
28
+ if (!path) return [];
29
+
30
+ const pathSegments = path.split("/");
31
+ const isIndexFile = pathSegments.at(-1) === "index";
32
+ const routePath = isIndexFile
33
+ ? pathSegments.slice(0, -1).join("/")
34
+ : path;
35
+
36
+ return {
37
+ path: routePath,
38
+ lazy: async () => {
39
+ const { default: Component, ...props } = await importPromise();
40
+
41
+ return {
42
+ element: (
43
+ <MdxPage {...props}>
44
+ <Component components={MarkdownHeadings} />
45
+ </MdxPage>
46
+ ),
47
+ };
48
+ },
49
+ } satisfies RouteObject;
50
+ },
51
+ );
52
+
53
+ const rootRoutes = Array.from(
54
+ new Set(routes.map((route) => route.path.split("/").at(0))),
55
+ ).map((dir) => ({
56
+ path: `/${dir}`,
57
+ element: <Redirect />,
58
+ }));
59
+
60
+ return [...routes, ...rootRoutes];
61
+ };
62
+
63
+ const Redirect = () => {
64
+ const navItem = useTopNavigationItem();
65
+
66
+ if (!navItem) return null;
67
+
68
+ return traverseNavigation(navItem, (node, fullPath) => {
69
+ if ("children" in node || !isPathItem(node)) return;
70
+ return <Navigate to={fullPath} replace />;
71
+ });
72
+ };
@@ -0,0 +1,31 @@
1
+ import type { Toc } from "@stefanprobst/rehype-extract-toc";
2
+ import type { MDXProps } from "mdx/types.js";
3
+ import type { DevPortalPlugin } from "../../core/plugins.js";
4
+ import { generateRoutes } from "./generateRoutes.js";
5
+
6
+ export type MarkdownPluginOptions = {
7
+ markdownFiles: Record<string, () => Promise<MDXImport>>;
8
+ };
9
+
10
+ export type Frontmatter = {
11
+ title?: string;
12
+ description?: string;
13
+ category?: string;
14
+ toc?: boolean;
15
+ };
16
+
17
+ export type MDXImport = {
18
+ tableOfContents: Toc;
19
+ frontmatter: Frontmatter;
20
+ default: (props: MDXProps) => JSX.Element;
21
+ };
22
+
23
+ export const markdownPlugin = ({
24
+ markdownFiles,
25
+ }: MarkdownPluginOptions): DevPortalPlugin => {
26
+ return {
27
+ getRoutes() {
28
+ return generateRoutes(markdownFiles);
29
+ },
30
+ };
31
+ };
@@ -0,0 +1,73 @@
1
+ import { useEffect, useRef, type ReactNode } from "react";
2
+ import { useTheme } from "../../components/context/ThemeContext.js";
3
+ import { cn } from "../../util/cn.js";
4
+ import { pastellize } from "../../util/pastellize.js";
5
+
6
+ const DATA_ATTR = "data-linked-param";
7
+
8
+ export const ColorizedParam = ({
9
+ name,
10
+ className,
11
+ backgroundOpacity = "100%",
12
+ slug,
13
+ children,
14
+ }: {
15
+ name: string;
16
+ className?: string;
17
+ backgroundOpacity?: string;
18
+ slug?: string;
19
+ children?: ReactNode;
20
+ }) => {
21
+ const ref = useRef<HTMLSpanElement>(null);
22
+ const [isDark] = useTheme();
23
+ const normalized = name.replace("{", "").replace("}", "");
24
+
25
+ const color = pastellize(
26
+ normalized,
27
+ !isDark ? { saturation: 100, lightness: 70 } : undefined,
28
+ );
29
+
30
+ const borderColor = `hsl(${color})`;
31
+ const backgroundColor = `hsl(${color} / ${backgroundOpacity})`;
32
+
33
+ useEffect(() => {
34
+ if (!ref.current) return;
35
+
36
+ const onMouseEnter = () => {
37
+ document.querySelectorAll(`[${DATA_ATTR}="${slug}"]`).forEach((el) => {
38
+ if (el instanceof HTMLElement) {
39
+ el.dataset.active = "true";
40
+ }
41
+ });
42
+ };
43
+ const onMouseLeave = () => {
44
+ document.querySelectorAll(`[${DATA_ATTR}="${slug}"]`).forEach((el) => {
45
+ if (el instanceof HTMLElement) {
46
+ el.dataset.active = "false";
47
+ }
48
+ });
49
+ };
50
+
51
+ ref.current.addEventListener("mouseenter", onMouseEnter);
52
+ ref.current.addEventListener("mouseleave", onMouseLeave);
53
+
54
+ return () => {
55
+ ref.current?.removeEventListener("mouseenter", onMouseEnter);
56
+ ref.current?.removeEventListener("mouseleave", onMouseLeave);
57
+ };
58
+ }, [slug]);
59
+
60
+ return (
61
+ <span
62
+ className={cn("inline-flex relative rounded group", className)}
63
+ {...{ [DATA_ATTR]: slug }}
64
+ ref={ref}
65
+ >
66
+ <span
67
+ className="absolute inset-0 border-b-2 rounded transition-opacity duration-200 opacity-30 group-data-[active=true]:opacity-100"
68
+ style={{ borderColor, backgroundColor }}
69
+ />
70
+ <span className="relative">{children ?? name}</span>
71
+ </span>
72
+ );
73
+ };