zudoku 0.1.1-dev.14 → 0.1.1-dev.16

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 (391) hide show
  1. package/dist/app/App.js +3 -1
  2. package/dist/app/App.js.map +1 -1
  3. package/dist/app/main.js +2 -2
  4. package/dist/app/main.js.map +1 -1
  5. package/dist/config/config.d.ts +3 -3
  6. package/dist/index.d.ts +2 -6
  7. package/dist/index.js +1 -5
  8. package/dist/index.js.map +1 -1
  9. package/dist/{app → lib}/DevPortal.d.ts +2 -2
  10. package/dist/{app → lib}/DevPortal.js +4 -4
  11. package/dist/{app → lib}/DevPortal.js.map +1 -1
  12. package/dist/{app → lib}/Heading.js.map +1 -1
  13. package/dist/{app → lib}/Router.js.map +1 -1
  14. package/dist/lib/auth.d.ts +1 -0
  15. package/dist/lib/auth.js +2 -0
  16. package/dist/lib/auth.js.map +1 -0
  17. package/dist/lib/authentication/authentication.js.map +1 -0
  18. package/dist/{app → lib}/authentication/clerk.d.ts +1 -2
  19. package/dist/{app → lib}/authentication/clerk.js +1 -2
  20. package/dist/lib/authentication/clerk.js.map +1 -0
  21. package/dist/{app → lib}/authentication/openid.js.map +1 -1
  22. package/dist/{app → lib}/components/AnchorLink.js.map +1 -1
  23. package/dist/{app → lib}/components/CategoryHeading.js.map +1 -1
  24. package/dist/{app → lib}/components/Dialog.js.map +1 -1
  25. package/dist/{app → lib}/components/DynamicIcon.js.map +1 -1
  26. package/dist/{app → lib}/components/Header.js.map +1 -1
  27. package/dist/{app → lib}/components/Input.js.map +1 -1
  28. package/dist/{app → lib}/components/Layout.js.map +1 -1
  29. package/dist/{app → lib}/components/Markdown.js.map +1 -1
  30. package/dist/{app → lib}/components/SyntaxHighlight.js.map +1 -1
  31. package/dist/{app → lib}/components/TopNavigation.js.map +1 -1
  32. package/dist/{app → lib}/components/context/ComponentsContext.js.map +1 -1
  33. package/dist/{app → lib}/components/context/DevPortalProvider.js.map +1 -1
  34. package/dist/lib/components/context/PluginSystem.js.map +1 -0
  35. package/dist/{app → lib}/components/context/ThemeContext.js.map +1 -1
  36. package/dist/{app → lib}/components/context/ViewportAnchorContext.js.map +1 -1
  37. package/dist/{app → lib}/components/navigation/SideNavigation.js.map +1 -1
  38. package/dist/{app → lib}/components/navigation/SideNavigationCategory.js.map +1 -1
  39. package/dist/{app → lib}/components/navigation/SideNavigationItem.js.map +1 -1
  40. package/dist/{app → lib}/components/navigation/SideNavigationWrapper.js.map +1 -1
  41. package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js.map +1 -1
  42. package/dist/{app → lib}/components/navigation/util.js.map +1 -1
  43. package/dist/lib/components.d.ts +3 -0
  44. package/dist/lib/components.js +4 -0
  45. package/dist/lib/components.js.map +1 -0
  46. package/dist/{app → lib}/core/DevPortalContext.js.map +1 -1
  47. package/dist/{app → lib}/core/helmet.js.map +1 -1
  48. package/dist/lib/core/icons.js.map +1 -0
  49. package/dist/{app → lib}/core/plugins.js.map +1 -1
  50. package/dist/lib/core/router.js.map +1 -0
  51. package/dist/lib/core/types/combine.js.map +1 -0
  52. package/dist/{app → lib}/oas/graphql/index.js.map +1 -1
  53. package/dist/{app → lib}/oas/graphql/server.js.map +1 -1
  54. package/dist/{app → lib}/oas/parser/dereference/index.js.map +1 -1
  55. package/dist/{app → lib}/oas/parser/dereference/resolveRef.js.map +1 -1
  56. package/dist/{app → lib}/oas/parser/index.js.map +1 -1
  57. package/dist/{app → lib}/oas/parser/upgrade/index.js.map +1 -1
  58. package/dist/{app → lib}/plugins/api-key/SettingsApiKeys.js.map +1 -1
  59. package/dist/{app → lib}/plugins/api-key/index.js.map +1 -1
  60. package/dist/{app → lib}/plugins/markdown/MdxPage.js.map +1 -1
  61. package/dist/{app → lib}/plugins/markdown/Toc.js.map +1 -1
  62. package/dist/{app → lib}/plugins/markdown/generateRoutes.js.map +1 -1
  63. package/dist/{app → lib}/plugins/markdown/index.js.map +1 -1
  64. package/dist/{app → lib}/plugins/openapi/ColorizedParam.js.map +1 -1
  65. package/dist/{app → lib}/plugins/openapi/MakeRequest.js.map +1 -1
  66. package/dist/{app → lib}/plugins/openapi/MethodBadge.js.map +1 -1
  67. package/dist/{app → lib}/plugins/openapi/OperationList.js.map +1 -1
  68. package/dist/{app → lib}/plugins/openapi/OperationListItem.js.map +1 -1
  69. package/dist/{app → lib}/plugins/openapi/ParameterList.js.map +1 -1
  70. package/dist/{app → lib}/plugins/openapi/ParameterListItem.js.map +1 -1
  71. package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
  72. package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
  73. package/dist/{app → lib}/plugins/openapi/Select.js.map +1 -1
  74. package/dist/{app → lib}/plugins/openapi/Sidecar.js.map +1 -1
  75. package/dist/{app → lib}/plugins/openapi/SidecarBox.js.map +1 -1
  76. package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js.map +1 -1
  77. package/dist/{app → lib}/plugins/openapi/graphql/gql.js.map +1 -1
  78. package/dist/{app → lib}/plugins/openapi/graphql/graphql.js.map +1 -1
  79. package/dist/lib/plugins/openapi/graphql/index.js.map +1 -0
  80. package/dist/{app → lib}/plugins/openapi/index.js.map +1 -1
  81. package/dist/{app → lib}/plugins/openapi/playground/Playground.js.map +1 -1
  82. package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.js.map +1 -1
  83. package/dist/{app → lib}/plugins/openapi/util/urql.js.map +1 -1
  84. package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -1
  85. package/dist/{app → lib}/plugins/openapi/worker/worker.js.map +1 -1
  86. package/dist/{app → lib}/plugins/redirect/index.js.map +1 -1
  87. package/dist/lib/plugins.d.ts +4 -0
  88. package/dist/lib/plugins.js +6 -0
  89. package/dist/lib/plugins.js.map +1 -0
  90. package/dist/{app → lib}/ui/Button.d.ts +1 -1
  91. package/dist/{app → lib}/ui/Button.js.map +1 -1
  92. package/dist/{app → lib}/ui/Callout.js.map +1 -1
  93. package/dist/{app → lib}/ui/Card.js.map +1 -1
  94. package/dist/{app → lib}/ui/Note.js.map +1 -1
  95. package/dist/{app → lib}/ui/Tabs.js.map +1 -1
  96. package/dist/{app → lib}/util/MdxComponents.js.map +1 -1
  97. package/dist/{app → lib}/util/cn.js.map +1 -1
  98. package/dist/{app → lib}/util/createVariantComponent.js.map +1 -1
  99. package/dist/{app → lib}/util/createWaitForNotify.js.map +1 -1
  100. package/dist/{app → lib}/util/groupBy.js.map +1 -1
  101. package/dist/{app → lib}/util/joinPath.js.map +1 -1
  102. package/dist/{app → lib}/util/pastellize.js.map +1 -1
  103. package/dist/lib/util/slugify.js.map +1 -0
  104. package/dist/{app → lib}/util/traverseNavigation.js.map +1 -1
  105. package/dist/{app → lib}/util/useScrollToAnchor.js.map +1 -1
  106. package/dist/{app → lib}/util/useScrollToTop.js.map +1 -1
  107. package/dist/vite/config.d.ts +2 -1
  108. package/dist/vite/config.js +28 -18
  109. package/dist/vite/config.js.map +1 -1
  110. package/dist/vite/dev-server.js +4 -4
  111. package/dist/vite/dev-server.js.map +1 -1
  112. package/dist/vite/plugin-api.js +1 -1
  113. package/dist/vite/plugin-api.js.map +1 -1
  114. package/dist/vite/plugin-auth.js +2 -2
  115. package/dist/vite/plugin-auth.js.map +1 -1
  116. package/dist/vite/plugin-component.d.ts +3 -0
  117. package/dist/vite/plugin-component.js +22 -0
  118. package/dist/vite/plugin-component.js.map +1 -0
  119. package/dist/vite/plugin-docs.js +1 -1
  120. package/dist/vite/plugin-docs.js.map +1 -1
  121. package/dist/vite/plugin-html.js +0 -3
  122. package/dist/vite/plugin-html.js.map +1 -1
  123. package/dist/vite/plugin-mdx.js +1 -1
  124. package/dist/vite/plugin-mdx.js.map +1 -1
  125. package/package.json +18 -19
  126. package/src/app/App.tsx +4 -1
  127. package/src/app/main.tsx +3 -3
  128. package/dist/app/authentication/authentication.js.map +0 -1
  129. package/dist/app/authentication/clerk.js.map +0 -1
  130. package/dist/app/components/context/PluginSystem.js.map +0 -1
  131. package/dist/app/core/icons.js.map +0 -1
  132. package/dist/app/core/router.js.map +0 -1
  133. package/dist/app/core/types/combine.js.map +0 -1
  134. package/dist/app/plugins/openapi/graphql/index.js.map +0 -1
  135. package/dist/app/util/slugify.js.map +0 -1
  136. package/dist/auth.d.ts +0 -2
  137. package/dist/auth.js +0 -3
  138. package/dist/auth.js.map +0 -1
  139. package/dist/plugins.d.ts +0 -4
  140. package/dist/plugins.js +0 -6
  141. package/dist/plugins.js.map +0 -1
  142. package/src/app/DevPortal.tsx +0 -93
  143. package/src/app/Heading.tsx +0 -60
  144. package/src/app/Router.tsx +0 -28
  145. package/src/app/authentication/authentication.ts +0 -18
  146. package/src/app/authentication/clerk.ts +0 -47
  147. package/src/app/authentication/openid.ts +0 -192
  148. package/src/app/components/AnchorLink.tsx +0 -19
  149. package/src/app/components/CategoryHeading.tsx +0 -16
  150. package/src/app/components/Dialog.tsx +0 -119
  151. package/src/app/components/DynamicIcon.tsx +0 -60
  152. package/src/app/components/Header.tsx +0 -69
  153. package/src/app/components/Input.tsx +0 -24
  154. package/src/app/components/Layout.tsx +0 -56
  155. package/src/app/components/Markdown.tsx +0 -37
  156. package/src/app/components/SyntaxHighlight.tsx +0 -94
  157. package/src/app/components/TopNavigation.tsx +0 -32
  158. package/src/app/components/context/ComponentsContext.tsx +0 -24
  159. package/src/app/components/context/DevPortalProvider.ts +0 -54
  160. package/src/app/components/context/PluginSystem.ts +0 -0
  161. package/src/app/components/context/ThemeContext.tsx +0 -46
  162. package/src/app/components/context/ViewportAnchorContext.tsx +0 -139
  163. package/src/app/components/navigation/SideNavigation.tsx +0 -18
  164. package/src/app/components/navigation/SideNavigationCategory.tsx +0 -74
  165. package/src/app/components/navigation/SideNavigationItem.tsx +0 -143
  166. package/src/app/components/navigation/SideNavigationWrapper.tsx +0 -15
  167. package/src/app/components/navigation/useNavigationCollapsibleState.ts +0 -27
  168. package/src/app/components/navigation/util.ts +0 -38
  169. package/src/app/core/DevPortalContext.ts +0 -164
  170. package/src/app/core/helmet.ts +0 -5
  171. package/src/app/core/icons.tsx +0 -1
  172. package/src/app/core/plugins.ts +0 -43
  173. package/src/app/core/router.tsx +0 -1
  174. package/src/app/core/types/combine.ts +0 -16
  175. package/src/app/oas/graphql/index.ts +0 -422
  176. package/src/app/oas/graphql/server.ts +0 -10
  177. package/src/app/oas/parser/dereference/index.ts +0 -59
  178. package/src/app/oas/parser/dereference/resolveRef.ts +0 -32
  179. package/src/app/oas/parser/index.ts +0 -94
  180. package/src/app/oas/parser/schemas/v3.0.json +0 -1489
  181. package/src/app/oas/parser/schemas/v3.1.json +0 -1298
  182. package/src/app/oas/parser/upgrade/index.ts +0 -108
  183. package/src/app/plugins/api-key/SettingsApiKeys.tsx +0 -22
  184. package/src/app/plugins/api-key/index.tsx +0 -123
  185. package/src/app/plugins/markdown/MdxPage.tsx +0 -128
  186. package/src/app/plugins/markdown/Toc.tsx +0 -122
  187. package/src/app/plugins/markdown/generateRoutes.tsx +0 -72
  188. package/src/app/plugins/markdown/index.tsx +0 -31
  189. package/src/app/plugins/openapi/ColorizedParam.tsx +0 -82
  190. package/src/app/plugins/openapi/MakeRequest.tsx +0 -49
  191. package/src/app/plugins/openapi/MethodBadge.tsx +0 -36
  192. package/src/app/plugins/openapi/OperationList.tsx +0 -117
  193. package/src/app/plugins/openapi/OperationListItem.tsx +0 -55
  194. package/src/app/plugins/openapi/ParameterList.tsx +0 -32
  195. package/src/app/plugins/openapi/ParameterListItem.tsx +0 -60
  196. package/src/app/plugins/openapi/RequestBodySidecarBox.tsx +0 -51
  197. package/src/app/plugins/openapi/ResponsesSidecarBox.tsx +0 -60
  198. package/src/app/plugins/openapi/Select.tsx +0 -35
  199. package/src/app/plugins/openapi/Sidecar.tsx +0 -160
  200. package/src/app/plugins/openapi/SidecarBox.tsx +0 -36
  201. package/src/app/plugins/openapi/graphql/fragment-masking.ts +0 -111
  202. package/src/app/plugins/openapi/graphql/gql.ts +0 -70
  203. package/src/app/plugins/openapi/graphql/graphql.ts +0 -795
  204. package/src/app/plugins/openapi/graphql/index.ts +0 -2
  205. package/src/app/plugins/openapi/index.tsx +0 -142
  206. package/src/app/plugins/openapi/playground/Playground.tsx +0 -309
  207. package/src/app/plugins/openapi/queries.graphql +0 -6
  208. package/src/app/plugins/openapi/util/generateSchemaExample.ts +0 -59
  209. package/src/app/plugins/openapi/util/urql.ts +0 -8
  210. package/src/app/plugins/openapi/worker/createSharedWorkerClient.ts +0 -60
  211. package/src/app/plugins/openapi/worker/worker.ts +0 -30
  212. package/src/app/plugins/redirect/index.tsx +0 -20
  213. package/src/app/ui/Button.tsx +0 -56
  214. package/src/app/ui/Callout.tsx +0 -87
  215. package/src/app/ui/Card.tsx +0 -82
  216. package/src/app/ui/Note.tsx +0 -58
  217. package/src/app/ui/Tabs.tsx +0 -52
  218. package/src/app/util/MdxComponents.tsx +0 -70
  219. package/src/app/util/cn.ts +0 -6
  220. package/src/app/util/createVariantComponent.tsx +0 -30
  221. package/src/app/util/createWaitForNotify.ts +0 -18
  222. package/src/app/util/groupBy.ts +0 -24
  223. package/src/app/util/joinPath.tsx +0 -10
  224. package/src/app/util/pastellize.ts +0 -25
  225. package/src/app/util/slugify.ts +0 -3
  226. package/src/app/util/traverseNavigation.ts +0 -55
  227. package/src/app/util/useScrollToAnchor.ts +0 -38
  228. package/src/app/util/useScrollToTop.ts +0 -13
  229. /package/dist/{app → lib}/Heading.d.ts +0 -0
  230. /package/dist/{app → lib}/Heading.js +0 -0
  231. /package/dist/{app → lib}/Router.d.ts +0 -0
  232. /package/dist/{app → lib}/Router.js +0 -0
  233. /package/dist/{app → lib}/authentication/authentication.d.ts +0 -0
  234. /package/dist/{app → lib}/authentication/authentication.js +0 -0
  235. /package/dist/{app → lib}/authentication/openid.d.ts +0 -0
  236. /package/dist/{app → lib}/authentication/openid.js +0 -0
  237. /package/dist/{app → lib}/components/AnchorLink.d.ts +0 -0
  238. /package/dist/{app → lib}/components/AnchorLink.js +0 -0
  239. /package/dist/{app → lib}/components/CategoryHeading.d.ts +0 -0
  240. /package/dist/{app → lib}/components/CategoryHeading.js +0 -0
  241. /package/dist/{app → lib}/components/Dialog.d.ts +0 -0
  242. /package/dist/{app → lib}/components/Dialog.js +0 -0
  243. /package/dist/{app → lib}/components/DynamicIcon.d.ts +0 -0
  244. /package/dist/{app → lib}/components/DynamicIcon.js +0 -0
  245. /package/dist/{app → lib}/components/Header.d.ts +0 -0
  246. /package/dist/{app → lib}/components/Header.js +0 -0
  247. /package/dist/{app → lib}/components/Input.d.ts +0 -0
  248. /package/dist/{app → lib}/components/Input.js +0 -0
  249. /package/dist/{app → lib}/components/Layout.d.ts +0 -0
  250. /package/dist/{app → lib}/components/Layout.js +0 -0
  251. /package/dist/{app → lib}/components/Markdown.d.ts +0 -0
  252. /package/dist/{app → lib}/components/Markdown.js +0 -0
  253. /package/dist/{app → lib}/components/SyntaxHighlight.d.ts +0 -0
  254. /package/dist/{app → lib}/components/SyntaxHighlight.js +0 -0
  255. /package/dist/{app → lib}/components/TopNavigation.d.ts +0 -0
  256. /package/dist/{app → lib}/components/TopNavigation.js +0 -0
  257. /package/dist/{app → lib}/components/context/ComponentsContext.d.ts +0 -0
  258. /package/dist/{app → lib}/components/context/ComponentsContext.js +0 -0
  259. /package/dist/{app → lib}/components/context/DevPortalProvider.d.ts +0 -0
  260. /package/dist/{app → lib}/components/context/DevPortalProvider.js +0 -0
  261. /package/dist/{app → lib}/components/context/PluginSystem.d.ts +0 -0
  262. /package/dist/{app → lib}/components/context/PluginSystem.js +0 -0
  263. /package/dist/{app → lib}/components/context/ThemeContext.d.ts +0 -0
  264. /package/dist/{app → lib}/components/context/ThemeContext.js +0 -0
  265. /package/dist/{app → lib}/components/context/ViewportAnchorContext.d.ts +0 -0
  266. /package/dist/{app → lib}/components/context/ViewportAnchorContext.js +0 -0
  267. /package/dist/{app → lib}/components/navigation/SideNavigation.d.ts +0 -0
  268. /package/dist/{app → lib}/components/navigation/SideNavigation.js +0 -0
  269. /package/dist/{app → lib}/components/navigation/SideNavigationCategory.d.ts +0 -0
  270. /package/dist/{app → lib}/components/navigation/SideNavigationCategory.js +0 -0
  271. /package/dist/{app → lib}/components/navigation/SideNavigationItem.d.ts +0 -0
  272. /package/dist/{app → lib}/components/navigation/SideNavigationItem.js +0 -0
  273. /package/dist/{app → lib}/components/navigation/SideNavigationWrapper.d.ts +0 -0
  274. /package/dist/{app → lib}/components/navigation/SideNavigationWrapper.js +0 -0
  275. /package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.d.ts +0 -0
  276. /package/dist/{app → lib}/components/navigation/useNavigationCollapsibleState.js +0 -0
  277. /package/dist/{app → lib}/components/navigation/util.d.ts +0 -0
  278. /package/dist/{app → lib}/components/navigation/util.js +0 -0
  279. /package/dist/{app → lib}/core/DevPortalContext.d.ts +0 -0
  280. /package/dist/{app → lib}/core/DevPortalContext.js +0 -0
  281. /package/dist/{app → lib}/core/helmet.d.ts +0 -0
  282. /package/dist/{app → lib}/core/helmet.js +0 -0
  283. /package/dist/{app → lib}/core/icons.d.ts +0 -0
  284. /package/dist/{app → lib}/core/icons.js +0 -0
  285. /package/dist/{app → lib}/core/plugins.d.ts +0 -0
  286. /package/dist/{app → lib}/core/plugins.js +0 -0
  287. /package/dist/{app → lib}/core/router.d.ts +0 -0
  288. /package/dist/{app → lib}/core/router.js +0 -0
  289. /package/dist/{app → lib}/core/types/combine.d.ts +0 -0
  290. /package/dist/{app → lib}/core/types/combine.js +0 -0
  291. /package/dist/{app → lib}/oas/graphql/index.d.ts +0 -0
  292. /package/dist/{app → lib}/oas/graphql/index.js +0 -0
  293. /package/dist/{app → lib}/oas/graphql/server.d.ts +0 -0
  294. /package/dist/{app → lib}/oas/graphql/server.js +0 -0
  295. /package/dist/{app → lib}/oas/parser/dereference/index.d.ts +0 -0
  296. /package/dist/{app → lib}/oas/parser/dereference/index.js +0 -0
  297. /package/dist/{app → lib}/oas/parser/dereference/resolveRef.d.ts +0 -0
  298. /package/dist/{app → lib}/oas/parser/dereference/resolveRef.js +0 -0
  299. /package/dist/{app → lib}/oas/parser/index.d.ts +0 -0
  300. /package/dist/{app → lib}/oas/parser/index.js +0 -0
  301. /package/dist/{app → lib}/oas/parser/upgrade/index.d.ts +0 -0
  302. /package/dist/{app → lib}/oas/parser/upgrade/index.js +0 -0
  303. /package/dist/{app → lib}/plugins/api-key/SettingsApiKeys.d.ts +0 -0
  304. /package/dist/{app → lib}/plugins/api-key/SettingsApiKeys.js +0 -0
  305. /package/dist/{app → lib}/plugins/api-key/index.d.ts +0 -0
  306. /package/dist/{app → lib}/plugins/api-key/index.js +0 -0
  307. /package/dist/{app → lib}/plugins/markdown/MdxPage.d.ts +0 -0
  308. /package/dist/{app → lib}/plugins/markdown/MdxPage.js +0 -0
  309. /package/dist/{app → lib}/plugins/markdown/Toc.d.ts +0 -0
  310. /package/dist/{app → lib}/plugins/markdown/Toc.js +0 -0
  311. /package/dist/{app → lib}/plugins/markdown/generateRoutes.d.ts +0 -0
  312. /package/dist/{app → lib}/plugins/markdown/generateRoutes.js +0 -0
  313. /package/dist/{app → lib}/plugins/markdown/index.d.ts +0 -0
  314. /package/dist/{app → lib}/plugins/markdown/index.js +0 -0
  315. /package/dist/{app → lib}/plugins/openapi/ColorizedParam.d.ts +0 -0
  316. /package/dist/{app → lib}/plugins/openapi/ColorizedParam.js +0 -0
  317. /package/dist/{app → lib}/plugins/openapi/MakeRequest.d.ts +0 -0
  318. /package/dist/{app → lib}/plugins/openapi/MakeRequest.js +0 -0
  319. /package/dist/{app → lib}/plugins/openapi/MethodBadge.d.ts +0 -0
  320. /package/dist/{app → lib}/plugins/openapi/MethodBadge.js +0 -0
  321. /package/dist/{app → lib}/plugins/openapi/OperationList.d.ts +0 -0
  322. /package/dist/{app → lib}/plugins/openapi/OperationList.js +0 -0
  323. /package/dist/{app → lib}/plugins/openapi/OperationListItem.d.ts +0 -0
  324. /package/dist/{app → lib}/plugins/openapi/OperationListItem.js +0 -0
  325. /package/dist/{app → lib}/plugins/openapi/ParameterList.d.ts +0 -0
  326. /package/dist/{app → lib}/plugins/openapi/ParameterList.js +0 -0
  327. /package/dist/{app → lib}/plugins/openapi/ParameterListItem.d.ts +0 -0
  328. /package/dist/{app → lib}/plugins/openapi/ParameterListItem.js +0 -0
  329. /package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.d.ts +0 -0
  330. /package/dist/{app → lib}/plugins/openapi/RequestBodySidecarBox.js +0 -0
  331. /package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.d.ts +0 -0
  332. /package/dist/{app → lib}/plugins/openapi/ResponsesSidecarBox.js +0 -0
  333. /package/dist/{app → lib}/plugins/openapi/Select.d.ts +0 -0
  334. /package/dist/{app → lib}/plugins/openapi/Select.js +0 -0
  335. /package/dist/{app → lib}/plugins/openapi/Sidecar.d.ts +0 -0
  336. /package/dist/{app → lib}/plugins/openapi/Sidecar.js +0 -0
  337. /package/dist/{app → lib}/plugins/openapi/SidecarBox.d.ts +0 -0
  338. /package/dist/{app → lib}/plugins/openapi/SidecarBox.js +0 -0
  339. /package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.d.ts +0 -0
  340. /package/dist/{app → lib}/plugins/openapi/graphql/fragment-masking.js +0 -0
  341. /package/dist/{app → lib}/plugins/openapi/graphql/gql.d.ts +0 -0
  342. /package/dist/{app → lib}/plugins/openapi/graphql/gql.js +0 -0
  343. /package/dist/{app → lib}/plugins/openapi/graphql/graphql.d.ts +0 -0
  344. /package/dist/{app → lib}/plugins/openapi/graphql/graphql.js +0 -0
  345. /package/dist/{app → lib}/plugins/openapi/graphql/index.d.ts +0 -0
  346. /package/dist/{app → lib}/plugins/openapi/graphql/index.js +0 -0
  347. /package/dist/{app → lib}/plugins/openapi/index.d.ts +0 -0
  348. /package/dist/{app → lib}/plugins/openapi/index.js +0 -0
  349. /package/dist/{app → lib}/plugins/openapi/playground/Playground.d.ts +0 -0
  350. /package/dist/{app → lib}/plugins/openapi/playground/Playground.js +0 -0
  351. /package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.d.ts +0 -0
  352. /package/dist/{app → lib}/plugins/openapi/util/generateSchemaExample.js +0 -0
  353. /package/dist/{app → lib}/plugins/openapi/util/urql.d.ts +0 -0
  354. /package/dist/{app → lib}/plugins/openapi/util/urql.js +0 -0
  355. /package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -0
  356. /package/dist/{app → lib}/plugins/openapi/worker/createSharedWorkerClient.js +0 -0
  357. /package/dist/{app → lib}/plugins/openapi/worker/worker.d.ts +0 -0
  358. /package/dist/{app → lib}/plugins/openapi/worker/worker.js +0 -0
  359. /package/dist/{app → lib}/plugins/redirect/index.d.ts +0 -0
  360. /package/dist/{app → lib}/plugins/redirect/index.js +0 -0
  361. /package/dist/{app → lib}/ui/Button.js +0 -0
  362. /package/dist/{app → lib}/ui/Callout.d.ts +0 -0
  363. /package/dist/{app → lib}/ui/Callout.js +0 -0
  364. /package/dist/{app → lib}/ui/Card.d.ts +0 -0
  365. /package/dist/{app → lib}/ui/Card.js +0 -0
  366. /package/dist/{app → lib}/ui/Note.d.ts +0 -0
  367. /package/dist/{app → lib}/ui/Note.js +0 -0
  368. /package/dist/{app → lib}/ui/Tabs.d.ts +0 -0
  369. /package/dist/{app → lib}/ui/Tabs.js +0 -0
  370. /package/dist/{app → lib}/util/MdxComponents.d.ts +0 -0
  371. /package/dist/{app → lib}/util/MdxComponents.js +0 -0
  372. /package/dist/{app → lib}/util/cn.d.ts +0 -0
  373. /package/dist/{app → lib}/util/cn.js +0 -0
  374. /package/dist/{app → lib}/util/createVariantComponent.d.ts +0 -0
  375. /package/dist/{app → lib}/util/createVariantComponent.js +0 -0
  376. /package/dist/{app → lib}/util/createWaitForNotify.d.ts +0 -0
  377. /package/dist/{app → lib}/util/createWaitForNotify.js +0 -0
  378. /package/dist/{app → lib}/util/groupBy.d.ts +0 -0
  379. /package/dist/{app → lib}/util/groupBy.js +0 -0
  380. /package/dist/{app → lib}/util/joinPath.d.ts +0 -0
  381. /package/dist/{app → lib}/util/joinPath.js +0 -0
  382. /package/dist/{app → lib}/util/pastellize.d.ts +0 -0
  383. /package/dist/{app → lib}/util/pastellize.js +0 -0
  384. /package/dist/{app → lib}/util/slugify.d.ts +0 -0
  385. /package/dist/{app → lib}/util/slugify.js +0 -0
  386. /package/dist/{app → lib}/util/traverseNavigation.d.ts +0 -0
  387. /package/dist/{app → lib}/util/traverseNavigation.js +0 -0
  388. /package/dist/{app → lib}/util/useScrollToAnchor.d.ts +0 -0
  389. /package/dist/{app → lib}/util/useScrollToAnchor.js +0 -0
  390. /package/dist/{app → lib}/util/useScrollToTop.d.ts +0 -0
  391. /package/dist/{app → lib}/util/useScrollToTop.js +0 -0
@@ -1,69 +0,0 @@
1
- import { MoonStarIcon, SearchIcon, SunIcon } from "lucide-react";
2
- import { memo } from "react";
3
- import { useDevPortalState } from "../core/DevPortalContext.js";
4
- import { TopNavigation } from "./TopNavigation.js";
5
- import { useDevPortal } from "./context/DevPortalProvider.js";
6
- import { useTheme } from "./context/ThemeContext.js";
7
-
8
- export const Header = memo(() => {
9
- const [isDark, toggleTheme] = useTheme();
10
- const { isLoggedIn, email } = useDevPortalState();
11
- const { login, logout, meta } = useDevPortal();
12
-
13
- const ThemeIcon = isDark ? MoonStarIcon : SunIcon;
14
-
15
- return (
16
- <header className="fixed top-0 w-full z-10 bg-background/80 backdrop-blur">
17
- <div className="max-w-screen-2xl mx-auto">
18
- <div className="grid grid-cols-[calc(var(--side-nav-width))_1fr] lg:gap-12 items-center border-b border-border px-12 h-[--top-header-height]">
19
- <div className="flex items-center gap-3.5">
20
- {meta?.logo && (
21
- <img src={meta.logo} alt="My Dev Portal" className="h-10" />
22
- )}
23
- <span className="font-bold text-2xl text-foreground/85 tracking-wide">
24
- {meta?.headerTitle}
25
- </span>
26
- </div>
27
- <div className="grid grid-cols-[--sidecar-grid-cols] items-center gap-8">
28
- <div className="w-full max-w-prose mx-auto">
29
- <button className="flex items-center border border-input hover:bg-accent hover:text-accent-foreground p-4 relative h-8 justify-start rounded-lg bg-background text-sm text-muted-foreground shadow-none w-40 sm:w-72">
30
- <div className="flex items-center gap-2 flex-grow">
31
- <SearchIcon size={14} />
32
- Search
33
- </div>
34
- <kbd className="absolute right-[0.3rem] top-[0.3rem] hidden h-5 select-none items-center gap-1 rounded border border-border bg-muted px-1.5 font-mono text-[11px] font-medium opacity-100 sm:flex">
35
- ⌘K
36
- </kbd>
37
- </button>
38
- </div>
39
- <div className="items-center justify-self-end text-sm hidden lg:flex">
40
- {!isLoggedIn ? (
41
- <button
42
- className="cursor-pointer hover:bg-secondary p-1 px-2 mx-2 rounded"
43
- onClick={logout}
44
- >
45
- Logout {email ? `(${email})` : null}
46
- </button>
47
- ) : (
48
- <button
49
- className="cursor-pointer hover:bg-secondary p-1 px-2 mx-2 rounded"
50
- onClick={login}
51
- >
52
- Login
53
- </button>
54
- )}
55
-
56
- <button
57
- className="cursor-pointer hover:bg-secondary p-2.5 -m-2.5 rounded-full"
58
- onClick={toggleTheme}
59
- >
60
- <ThemeIcon size={18} />
61
- </button>
62
- </div>
63
- </div>
64
- </div>
65
- <TopNavigation />
66
- </div>
67
- </header>
68
- );
69
- });
@@ -1,24 +0,0 @@
1
- import * as React from "react";
2
- import { cn } from "../util/cn.js";
3
-
4
- export interface InputProps
5
- extends React.InputHTMLAttributes<HTMLInputElement> {}
6
-
7
- const Input = React.forwardRef<HTMLInputElement, InputProps>(
8
- ({ className, type, ...props }, ref) => {
9
- return (
10
- <input
11
- type={type}
12
- className={cn(
13
- "flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
14
- className,
15
- )}
16
- ref={ref}
17
- {...props}
18
- />
19
- );
20
- },
21
- );
22
- Input.displayName = "Input";
23
-
24
- export { Input };
@@ -1,56 +0,0 @@
1
- import { Suspense, useEffect, useRef, type ReactNode } from "react";
2
- import { Outlet, useLocation } from "react-router-dom";
3
- import { Helmet } from "../core/helmet.js";
4
- import { useScrollToAnchor } from "../util/useScrollToAnchor.js";
5
- import { useScrollToTop } from "../util/useScrollToTop.js";
6
- import { Header } from "./Header.js";
7
- import { useDevPortal } from "./context/DevPortalProvider.js";
8
- import { useViewportAnchor } from "./context/ViewportAnchorContext.js";
9
- import { SideNavigation } from "./navigation/SideNavigation.js";
10
- import { SideNavigationWrapper } from "./navigation/SideNavigationWrapper.js";
11
-
12
- export const Layout = ({ children }: { children?: ReactNode }) => {
13
- const location = useLocation();
14
- const { setActiveAnchor } = useViewportAnchor();
15
- const { meta, handleAuthenticationResponse } = useDevPortal();
16
-
17
- useEffect(() => {
18
- void handleAuthenticationResponse(location);
19
- }, [handleAuthenticationResponse, location]);
20
-
21
- useScrollToAnchor();
22
- useScrollToTop();
23
-
24
- const previousLocationPath = useRef(location.pathname);
25
-
26
- useEffect(() => {
27
- // always reset on location change
28
- if (location.pathname !== previousLocationPath.current) {
29
- setActiveAnchor("");
30
- }
31
- previousLocationPath.current = location.pathname;
32
- }, [location.pathname, setActiveAnchor]);
33
-
34
- return (
35
- <>
36
- <Helmet titleTemplate={meta?.pageTitle}>
37
- <title>Home</title>
38
- {meta?.description && (
39
- <meta name="description" content={meta.description} />
40
- )}
41
- {meta?.favicon && <link rel="icon" href={meta.favicon} />}
42
- </Helmet>
43
- <Header />
44
- <div className="max-w-screen-2xl mx-auto pt-[--header-height] px-10 lg:px-12">
45
- <Suspense
46
- fallback={<SideNavigationWrapper>Loading...</SideNavigationWrapper>}
47
- >
48
- <SideNavigation />
49
- </Suspense>
50
- <main className="dark:border-white/10 lg:overflow-visible translate-x-0 lg:w-[calc(100%-var(--side-nav-width))] lg:translate-x-[--side-nav-width] pl-12">
51
- {children ?? <Outlet />}
52
- </main>
53
- </div>
54
- </>
55
- );
56
- };
@@ -1,37 +0,0 @@
1
- import ReactMarkdown from "react-markdown";
2
- import remarkGfm from "remark-gfm";
3
- import { visit } from "unist-util-visit";
4
- import { MdxComponents } from "../util/MdxComponents.js";
5
-
6
- // same as in packages/dev-portal/framework/vite.ts
7
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
8
- const rehypeCodeBlockPlugin = () => (tree: any) => {
9
- visit(tree, "element", (node, _index, parent) => {
10
- if (node.tagName === "code") {
11
- node.properties.inline = parent?.tagName !== "pre";
12
- }
13
- });
14
- };
15
-
16
- const remarkPlugins = [remarkGfm];
17
- const rehypePlugins = [rehypeCodeBlockPlugin];
18
-
19
- // other styles are defined in main.css .prose
20
- export const ProseClasses = "prose dark:prose-invert prose-neutral";
21
-
22
- export const Markdown = ({
23
- content,
24
- className,
25
- }: {
26
- content: string;
27
- className?: string;
28
- }) => (
29
- <ReactMarkdown
30
- remarkPlugins={remarkPlugins}
31
- rehypePlugins={rehypePlugins}
32
- components={MdxComponents}
33
- className={className}
34
- >
35
- {content}
36
- </ReactMarkdown>
37
- );
@@ -1,94 +0,0 @@
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
- // @ts-expect-error This is untyped
23
- import("prismjs/components/prism-java.min.js");
24
- }
25
-
26
- import { useState } from "react";
27
- import { cn } from "../util/cn.js";
28
- import { useTheme } from "./context/ThemeContext.js";
29
-
30
- type SyntaxHighlightProps = {
31
- className?: string;
32
- noBackground?: boolean;
33
- wrapLines?: boolean;
34
- copyable?: boolean;
35
- } & Omit<HighlightProps, "children">;
36
-
37
- export const SyntaxHighlight = ({
38
- copyable = true,
39
- ...props
40
- }: SyntaxHighlightProps) => {
41
- const [isDark] = useTheme();
42
- const [isCopied, setIsCopied] = useState(false);
43
-
44
- return (
45
- <Highlight theme={isDark ? themes.vsDark : themes.github} {...props}>
46
- {({ className, style, tokens, getLineProps, getTokenProps }) => (
47
- <pre
48
- className={cn(
49
- "group relative",
50
- className,
51
- props.className,
52
- props.noBackground && "!bg-transparent",
53
- props.wrapLines && "whitespace-pre-wrap break-words",
54
- )}
55
- style={style}
56
- >
57
- {copyable && (
58
- <button
59
- type="button"
60
- aria-label="Copy code"
61
- 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"
62
- disabled={isCopied}
63
- onClick={() => {
64
- setIsCopied(true);
65
- navigator.clipboard.writeText(
66
- tokens
67
- .map((line) => line.map(({ content }) => content).join(""))
68
- .join("\n"),
69
- );
70
- setTimeout(() => setIsCopied(false), 2000);
71
- }}
72
- >
73
- {isCopied ? (
74
- <CheckIcon className="text-emerald-600" size={18} />
75
- ) : (
76
- <CopyIcon size={18} />
77
- )}
78
- </button>
79
- )}
80
- <span className="absolute top-1.5 right-3 text-[11px] font-mono text-muted-foreground transition group-hover:opacity-0">
81
- {props.language}
82
- </span>
83
- {tokens.map((line, i) => (
84
- <div key={i} {...getLineProps({ line })}>
85
- {line.map((token, key) => (
86
- <span key={key} {...getTokenProps({ token })} />
87
- ))}
88
- </div>
89
- ))}
90
- </pre>
91
- )}
92
- </Highlight>
93
- );
94
- };
@@ -1,32 +0,0 @@
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
- };
@@ -1,24 +0,0 @@
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
- };
@@ -1,54 +0,0 @@
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
@@ -1,46 +0,0 @@
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
- };
@@ -1,139 +0,0 @@
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
- };
@@ -1,18 +0,0 @@
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
- };
@@ -1,74 +0,0 @@
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
- };