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.
- package/cli.js +1 -0
- package/dist/app/DevPortal.d.ts +26 -0
- package/dist/app/DevPortal.js +41 -0
- package/dist/app/DevPortal.js.map +1 -0
- package/dist/app/Heading.d.ts +9 -0
- package/dist/app/Heading.js +27 -0
- package/dist/app/Heading.js.map +1 -0
- package/dist/app/app.d.ts +2 -0
- package/dist/app/app.js +69 -0
- package/dist/app/app.js.map +1 -0
- package/dist/app/authentication/authentication.d.ts +13 -0
- package/dist/app/authentication/authentication.js +2 -0
- package/dist/app/authentication/authentication.js.map +1 -0
- package/dist/app/authentication/clerk.d.ts +5 -0
- package/dist/app/authentication/clerk.js +36 -0
- package/dist/app/authentication/clerk.js.map +1 -0
- package/dist/app/authentication/openid.d.ts +11 -0
- package/dist/app/authentication/openid.js +118 -0
- package/dist/app/authentication/openid.js.map +1 -0
- package/dist/app/components/AnchorLink.d.ts +5 -0
- package/dist/app/components/AnchorLink.js +17 -0
- package/dist/app/components/AnchorLink.js.map +1 -0
- package/dist/app/components/CategoryHeading.d.ts +5 -0
- package/dist/app/components/CategoryHeading.js +6 -0
- package/dist/app/components/CategoryHeading.js.map +1 -0
- package/dist/app/components/DynamicIcon.d.ts +6 -0
- package/dist/app/components/DynamicIcon.js +6 -0
- package/dist/app/components/DynamicIcon.js.map +1 -0
- package/dist/app/components/Header.d.ts +2 -0
- package/dist/app/components/Header.js +15 -0
- package/dist/app/components/Header.js.map +1 -0
- package/dist/app/components/Layout.d.ts +4 -0
- package/dist/app/components/Layout.js +31 -0
- package/dist/app/components/Layout.js.map +1 -0
- package/dist/app/components/Markdown.d.ts +5 -0
- package/dist/app/components/Markdown.js +20 -0
- package/dist/app/components/Markdown.js.map +1 -0
- package/dist/app/components/SyntaxHighlight.d.ts +9 -0
- package/dist/app/components/SyntaxHighlight.js +31 -0
- package/dist/app/components/SyntaxHighlight.js.map +1 -0
- package/dist/app/components/TopNavigation.d.ts +1 -0
- package/dist/app/components/TopNavigation.js +11 -0
- package/dist/app/components/TopNavigation.js.map +1 -0
- package/dist/app/components/context/ComponentsContext.d.ts +10 -0
- package/dist/app/components/context/ComponentsContext.js +11 -0
- package/dist/app/components/context/ComponentsContext.js.map +1 -0
- package/dist/app/components/context/DevPortalProvider.d.ts +10 -0
- package/dist/app/components/context/DevPortalProvider.js +39 -0
- package/dist/app/components/context/DevPortalProvider.js.map +1 -0
- package/dist/app/components/context/PluginSystem.d.ts +1 -0
- package/dist/app/components/context/PluginSystem.js +2 -0
- package/dist/app/components/context/PluginSystem.js.map +1 -0
- package/dist/app/components/context/ThemeContext.d.ts +5 -0
- package/dist/app/components/context/ThemeContext.js +33 -0
- package/dist/app/components/context/ThemeContext.js.map +1 -0
- package/dist/app/components/context/ViewportAnchorContext.d.ts +15 -0
- package/dist/app/components/context/ViewportAnchorContext.js +89 -0
- package/dist/app/components/context/ViewportAnchorContext.js.map +1 -0
- package/dist/app/components/navigation/SideNavigation.d.ts +1 -0
- package/dist/app/components/navigation/SideNavigation.js +11 -0
- package/dist/app/components/navigation/SideNavigation.js.map +1 -0
- package/dist/app/components/navigation/SideNavigationCategory.d.ts +4 -0
- package/dist/app/components/navigation/SideNavigationCategory.js +26 -0
- package/dist/app/components/navigation/SideNavigationCategory.js.map +1 -0
- package/dist/app/components/navigation/SideNavigationItem.d.ts +12 -0
- package/dist/app/components/navigation/SideNavigationItem.js +38 -0
- package/dist/app/components/navigation/SideNavigationItem.js.map +1 -0
- package/dist/app/components/navigation/SideNavigationWrapper.d.ts +4 -0
- package/dist/app/components/navigation/SideNavigationWrapper.js +6 -0
- package/dist/app/components/navigation/SideNavigationWrapper.js.map +1 -0
- package/dist/app/components/navigation/useNavigationCollapsibleState.d.ts +7 -0
- package/dist/app/components/navigation/useNavigationCollapsibleState.js +16 -0
- package/dist/app/components/navigation/useNavigationCollapsibleState.js.map +1 -0
- package/dist/app/components/navigation/util.d.ts +8 -0
- package/dist/app/components/navigation/util.js +15 -0
- package/dist/app/components/navigation/util.js.map +1 -0
- package/dist/app/config.d.ts +3 -0
- package/dist/app/config.js +9 -0
- package/dist/app/config.js.map +1 -0
- package/dist/app/core/DevPortalContext.d.ts +80 -0
- package/dist/app/core/DevPortalContext.js +68 -0
- package/dist/app/core/DevPortalContext.js.map +1 -0
- package/dist/app/core/helmet.d.ts +4 -0
- package/dist/app/core/helmet.js +5 -0
- package/dist/app/core/helmet.js.map +1 -0
- package/dist/app/core/icons.d.ts +1 -0
- package/dist/app/core/icons.js +2 -0
- package/dist/app/core/icons.js.map +1 -0
- package/dist/app/core/plugins.d.ts +24 -0
- package/dist/app/core/plugins.js +4 -0
- package/dist/app/core/plugins.js.map +1 -0
- package/dist/app/core/router.d.ts +1 -0
- package/dist/app/core/router.js +2 -0
- package/dist/app/core/router.js.map +1 -0
- package/dist/app/core/types/combine.d.ts +4 -0
- package/dist/app/core/types/combine.js +2 -0
- package/dist/app/core/types/combine.js.map +1 -0
- package/dist/app/main.d.ts +1 -0
- package/dist/app/main.js +18 -0
- package/dist/app/main.js.map +1 -0
- package/dist/app/markdowns.d.ts +3 -0
- package/dist/app/markdowns.js +5 -0
- package/dist/app/markdowns.js.map +1 -0
- package/dist/app/oas/graphql/index.d.ts +12 -0
- package/dist/app/oas/graphql/index.js +290 -0
- package/dist/app/oas/graphql/index.js.map +1 -0
- package/dist/app/oas/graphql/server.d.ts +1 -0
- package/dist/app/oas/graphql/server.js +8 -0
- package/dist/app/oas/graphql/server.js.map +1 -0
- package/dist/app/oas/parser/dereference/index.d.ts +5 -0
- package/dist/app/oas/parser/dereference/index.js +43 -0
- package/dist/app/oas/parser/dereference/index.js.map +1 -0
- package/dist/app/oas/parser/dereference/resolveRef.d.ts +5 -0
- package/dist/app/oas/parser/dereference/resolveRef.js +26 -0
- package/dist/app/oas/parser/dereference/resolveRef.js.map +1 -0
- package/dist/app/oas/parser/index.d.ts +21 -0
- package/dist/app/oas/parser/index.js +58 -0
- package/dist/app/oas/parser/index.js.map +1 -0
- package/dist/app/oas/parser/schemas/v3.0.json +1489 -0
- package/dist/app/oas/parser/schemas/v3.1.json +1298 -0
- package/dist/app/oas/parser/upgrade/index.d.ts +9 -0
- package/dist/app/oas/parser/upgrade/index.js +90 -0
- package/dist/app/oas/parser/upgrade/index.js.map +1 -0
- package/dist/app/plugins/api-key/SettingsApiKeys.d.ts +4 -0
- package/dist/app/plugins/api-key/SettingsApiKeys.js +7 -0
- package/dist/app/plugins/api-key/SettingsApiKeys.js.map +1 -0
- package/dist/app/plugins/api-key/index.d.ts +32 -0
- package/dist/app/plugins/api-key/index.js +55 -0
- package/dist/app/plugins/api-key/index.js.map +1 -0
- package/dist/app/plugins/markdown/MdxPage.d.ts +3 -0
- package/dist/app/plugins/markdown/MdxPage.js +55 -0
- package/dist/app/plugins/markdown/MdxPage.js.map +1 -0
- package/dist/app/plugins/markdown/Toc.d.ts +4 -0
- package/dist/app/plugins/markdown/Toc.js +40 -0
- package/dist/app/plugins/markdown/Toc.js.map +1 -0
- package/dist/app/plugins/markdown/generateRoutes.d.ts +3 -0
- package/dist/app/plugins/markdown/generateRoutes.js +50 -0
- package/dist/app/plugins/markdown/generateRoutes.js.map +1 -0
- package/dist/app/plugins/markdown/index.d.ts +19 -0
- package/dist/app/plugins/markdown/index.js +9 -0
- package/dist/app/plugins/markdown/index.js.map +1 -0
- package/dist/app/plugins/openapi/ColorizedParam.d.ts +8 -0
- package/dist/app/plugins/openapi/ColorizedParam.js +40 -0
- package/dist/app/plugins/openapi/ColorizedParam.js.map +1 -0
- package/dist/app/plugins/openapi/MakeRequest.d.ts +4 -0
- package/dist/app/plugins/openapi/MakeRequest.js +11 -0
- package/dist/app/plugins/openapi/MakeRequest.js.map +1 -0
- package/dist/app/plugins/openapi/MethodBadge.d.ts +13 -0
- package/dist/app/plugins/openapi/MethodBadge.js +26 -0
- package/dist/app/plugins/openapi/MethodBadge.js.map +1 -0
- package/dist/app/plugins/openapi/OperationList.d.ts +47 -0
- package/dist/app/plugins/openapi/OperationList.js +82 -0
- package/dist/app/plugins/openapi/OperationList.js.map +1 -0
- package/dist/app/plugins/openapi/OperationListItem.d.ts +7 -0
- package/dist/app/plugins/openapi/OperationListItem.js +15 -0
- package/dist/app/plugins/openapi/OperationListItem.js.map +1 -0
- package/dist/app/plugins/openapi/ParameterList.d.ts +7 -0
- package/dist/app/plugins/openapi/ParameterList.js +5 -0
- package/dist/app/plugins/openapi/ParameterList.js.map +1 -0
- package/dist/app/plugins/openapi/ParameterListItem.d.ts +8 -0
- package/dist/app/plugins/openapi/ParameterListItem.js +13 -0
- package/dist/app/plugins/openapi/ParameterListItem.js.map +1 -0
- package/dist/app/plugins/openapi/RequestBodySidecarBox.d.ts +6 -0
- package/dist/app/plugins/openapi/RequestBodySidecarBox.js +19 -0
- package/dist/app/plugins/openapi/RequestBodySidecarBox.js.map +1 -0
- package/dist/app/plugins/openapi/ResponsesSidecarBox.d.ts +6 -0
- package/dist/app/plugins/openapi/ResponsesSidecarBox.js +15 -0
- package/dist/app/plugins/openapi/ResponsesSidecarBox.js.map +1 -0
- package/dist/app/plugins/openapi/Select.d.ts +9 -0
- package/dist/app/plugins/openapi/Select.js +5 -0
- package/dist/app/plugins/openapi/Select.js.map +1 -0
- package/dist/app/plugins/openapi/Sidecar.d.ts +4 -0
- package/dist/app/plugins/openapi/Sidecar.js +39 -0
- package/dist/app/plugins/openapi/Sidecar.js.map +1 -0
- package/dist/app/plugins/openapi/SidecarBox.d.ts +10 -0
- package/dist/app/plugins/openapi/SidecarBox.js +8 -0
- package/dist/app/plugins/openapi/SidecarBox.js.map +1 -0
- package/dist/app/plugins/openapi/graphql/index.d.ts +836 -0
- package/dist/app/plugins/openapi/graphql/index.js +4 -0
- package/dist/app/plugins/openapi/graphql/index.js.map +1 -0
- package/dist/app/plugins/openapi/index.d.ts +22 -0
- package/dist/app/plugins/openapi/index.js +91 -0
- package/dist/app/plugins/openapi/index.js.map +1 -0
- package/dist/app/plugins/openapi/util/generateSchemaExample.d.ts +3 -0
- package/dist/app/plugins/openapi/util/generateSchemaExample.js +52 -0
- package/dist/app/plugins/openapi/util/generateSchemaExample.js.map +1 -0
- package/dist/app/plugins/openapi/util/getCode.d.ts +2 -0
- package/dist/app/plugins/openapi/util/getCode.js +54 -0
- package/dist/app/plugins/openapi/util/getCode.js.map +1 -0
- package/dist/app/plugins/openapi/util/urql.d.ts +8 -0
- package/dist/app/plugins/openapi/util/urql.js +8 -0
- package/dist/app/plugins/openapi/util/urql.js.map +1 -0
- package/dist/app/plugins/openapi/worker/createSharedWorkerClient.d.ts +5 -0
- package/dist/app/plugins/openapi/worker/createSharedWorkerClient.js +47 -0
- package/dist/app/plugins/openapi/worker/createSharedWorkerClient.js.map +1 -0
- package/dist/app/plugins/openapi/worker/worker.d.ts +1 -0
- package/dist/app/plugins/openapi/worker/worker.js +20 -0
- package/dist/app/plugins/openapi/worker/worker.js.map +1 -0
- package/dist/app/plugins/redirect/index.d.ts +10 -0
- package/dist/app/plugins/redirect/index.js +11 -0
- package/dist/app/plugins/redirect/index.js.map +1 -0
- package/dist/app/tailwind.d.ts +3 -0
- package/dist/app/tailwind.js +69 -0
- package/dist/app/tailwind.js.map +1 -0
- package/dist/app/ui/Callout.d.ts +51 -0
- package/dist/app/ui/Callout.js +50 -0
- package/dist/app/ui/Callout.js.map +1 -0
- package/dist/app/ui/Card.d.ts +8 -0
- package/dist/app/ui/Card.js +17 -0
- package/dist/app/ui/Card.js.map +1 -0
- package/dist/app/ui/Note.d.ts +8 -0
- package/dist/app/ui/Note.js +23 -0
- package/dist/app/ui/Note.js.map +1 -0
- package/dist/app/util/MdxComponents.d.ts +27 -0
- package/dist/app/util/MdxComponents.js +40 -0
- package/dist/app/util/MdxComponents.js.map +1 -0
- package/dist/app/util/cn.d.ts +2 -0
- package/dist/app/util/cn.js +6 -0
- package/dist/app/util/cn.js.map +1 -0
- package/dist/app/util/createWaitForNotify.d.ts +1 -0
- package/dist/app/util/createWaitForNotify.js +15 -0
- package/dist/app/util/createWaitForNotify.js.map +1 -0
- package/dist/app/util/groupBy.d.ts +6 -0
- package/dist/app/util/groupBy.js +9 -0
- package/dist/app/util/groupBy.js.map +1 -0
- package/dist/app/util/joinPath.d.ts +1 -0
- package/dist/app/util/joinPath.js +8 -0
- package/dist/app/util/joinPath.js.map +1 -0
- package/dist/app/util/pastellize.d.ts +4 -0
- package/dist/app/util/pastellize.js +14 -0
- package/dist/app/util/pastellize.js.map +1 -0
- package/dist/app/util/slugify.d.ts +3 -0
- package/dist/app/util/slugify.js +3 -0
- package/dist/app/util/slugify.js.map +1 -0
- package/dist/app/util/traverseNavigation.d.ts +6 -0
- package/dist/app/util/traverseNavigation.js +30 -0
- package/dist/app/util/traverseNavigation.js.map +1 -0
- package/dist/app/util/useScrollToAnchor.d.ts +1 -0
- package/dist/app/util/useScrollToAnchor.js +33 -0
- package/dist/app/util/useScrollToAnchor.js.map +1 -0
- package/dist/app/util/useScrollToTop.d.ts +1 -0
- package/dist/app/util/useScrollToTop.js +13 -0
- package/dist/app/util/useScrollToTop.js.map +1 -0
- package/dist/auth.d.ts +2 -0
- package/dist/auth.js +3 -0
- package/dist/auth.js.map +1 -0
- package/dist/cli/build/handler.d.ts +4 -0
- package/dist/cli/build/handler.js +9 -0
- package/dist/cli/build/handler.js.map +1 -0
- package/dist/cli/cli.d.ts +1 -0
- package/dist/cli/cli.js +64 -0
- package/dist/cli/cli.js.map +1 -0
- package/dist/cli/cmds/build.d.ts +8 -0
- package/dist/cli/cmds/build.js +23 -0
- package/dist/cli/cmds/build.js.map +1 -0
- package/dist/cli/cmds/dev.d.ts +8 -0
- package/dist/cli/cmds/dev.js +29 -0
- package/dist/cli/cmds/dev.js.map +1 -0
- package/dist/cli/common/analytics/lib.d.ts +17 -0
- package/dist/cli/common/analytics/lib.js +53 -0
- package/dist/cli/common/analytics/lib.js.map +1 -0
- package/dist/cli/common/constants.d.ts +5 -0
- package/dist/cli/common/constants.js +9 -0
- package/dist/cli/common/constants.js.map +1 -0
- package/dist/cli/common/logger.d.ts +2 -0
- package/dist/cli/common/logger.js +14 -0
- package/dist/cli/common/logger.js.map +1 -0
- package/dist/cli/common/machine-id/lib.d.ts +1 -0
- package/dist/cli/common/machine-id/lib.js +74 -0
- package/dist/cli/common/machine-id/lib.js.map +1 -0
- package/dist/cli/common/outdated.d.ts +1 -0
- package/dist/cli/common/outdated.js +70 -0
- package/dist/cli/common/outdated.js.map +1 -0
- package/dist/cli/common/output.d.ts +9 -0
- package/dist/cli/common/output.js +65 -0
- package/dist/cli/common/output.js.map +1 -0
- package/dist/cli/common/utils/box.d.ts +33 -0
- package/dist/cli/common/utils/box.js +81 -0
- package/dist/cli/common/utils/box.js.map +1 -0
- package/dist/cli/common/utils/ports.d.ts +1 -0
- package/dist/cli/common/utils/ports.js +18 -0
- package/dist/cli/common/utils/ports.js.map +1 -0
- package/dist/cli/common/validators/lib.d.ts +20 -0
- package/dist/cli/common/validators/lib.js +31 -0
- package/dist/cli/common/validators/lib.js.map +1 -0
- package/dist/cli/common/xdg/lib.d.ts +6 -0
- package/dist/cli/common/xdg/lib.js +18 -0
- package/dist/cli/common/xdg/lib.js.map +1 -0
- package/dist/cli/dev/handler.d.ts +5 -0
- package/dist/cli/dev/handler.js +22 -0
- package/dist/cli/dev/handler.js.map +1 -0
- package/dist/config/config.d.ts +37 -0
- package/dist/config/config.js +2 -0
- package/dist/config/config.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/plugins.d.ts +4 -0
- package/dist/plugins.js +6 -0
- package/dist/plugins.js.map +1 -0
- package/dist/vite/build.d.ts +3 -0
- package/dist/vite/build.js +29 -0
- package/dist/vite/build.js.map +1 -0
- package/dist/vite/config.d.ts +6 -0
- package/dist/vite/config.js +74 -0
- package/dist/vite/config.js.map +1 -0
- package/dist/vite/dev-server.d.ts +10 -0
- package/dist/vite/dev-server.js +53 -0
- package/dist/vite/dev-server.js.map +1 -0
- package/dist/vite/html.d.ts +5 -0
- package/dist/vite/html.js +32 -0
- package/dist/vite/html.js.map +1 -0
- package/dist/vite/import-auth-plugin.d.ts +3 -0
- package/dist/vite/import-auth-plugin.js +28 -0
- package/dist/vite/import-auth-plugin.js.map +1 -0
- package/dist/vite/plugin.d.ts +7 -0
- package/dist/vite/plugin.js +109 -0
- package/dist/vite/plugin.js.map +1 -0
- package/package.json +118 -0
- package/src/app/DevPortal.tsx +115 -0
- package/src/app/Heading.tsx +60 -0
- package/src/app/app.tsx +85 -0
- package/src/app/authentication/authentication.ts +18 -0
- package/src/app/authentication/clerk.ts +47 -0
- package/src/app/authentication/openid.ts +192 -0
- package/src/app/components/AnchorLink.tsx +19 -0
- package/src/app/components/CategoryHeading.tsx +16 -0
- package/src/app/components/DynamicIcon.tsx +60 -0
- package/src/app/components/Header.tsx +69 -0
- package/src/app/components/Layout.tsx +56 -0
- package/src/app/components/Markdown.tsx +37 -0
- package/src/app/components/SyntaxHighlight.tsx +92 -0
- package/src/app/components/TopNavigation.tsx +32 -0
- package/src/app/components/context/ComponentsContext.tsx +24 -0
- package/src/app/components/context/DevPortalProvider.ts +54 -0
- package/src/app/components/context/PluginSystem.ts +0 -0
- package/src/app/components/context/ThemeContext.tsx +46 -0
- package/src/app/components/context/ViewportAnchorContext.tsx +139 -0
- package/src/app/components/navigation/SideNavigation.tsx +18 -0
- package/src/app/components/navigation/SideNavigationCategory.tsx +74 -0
- package/src/app/components/navigation/SideNavigationItem.tsx +143 -0
- package/src/app/components/navigation/SideNavigationWrapper.tsx +15 -0
- package/src/app/components/navigation/useNavigationCollapsibleState.ts +27 -0
- package/src/app/components/navigation/util.ts +38 -0
- package/src/app/config.ts +20 -0
- package/src/app/core/DevPortalContext.ts +164 -0
- package/src/app/core/helmet.ts +5 -0
- package/src/app/core/icons.tsx +1 -0
- package/src/app/core/plugins.ts +43 -0
- package/src/app/core/router.tsx +1 -0
- package/src/app/core/types/combine.ts +16 -0
- package/src/app/main.css +137 -0
- package/src/app/main.tsx +22 -0
- package/src/app/markdowns.ts +7 -0
- package/src/app/oas/graphql/index.ts +422 -0
- package/src/app/oas/graphql/server.ts +10 -0
- package/src/app/oas/parser/dereference/index.ts +59 -0
- package/src/app/oas/parser/dereference/resolveRef.ts +32 -0
- package/src/app/oas/parser/index.ts +94 -0
- package/src/app/oas/parser/schemas/v3.0.json +1489 -0
- package/src/app/oas/parser/schemas/v3.1.json +1298 -0
- package/src/app/oas/parser/upgrade/index.ts +108 -0
- package/src/app/plugins/api-key/SettingsApiKeys.tsx +22 -0
- package/src/app/plugins/api-key/index.tsx +123 -0
- package/src/app/plugins/markdown/MdxPage.tsx +128 -0
- package/src/app/plugins/markdown/Toc.tsx +122 -0
- package/src/app/plugins/markdown/generateRoutes.tsx +72 -0
- package/src/app/plugins/markdown/index.tsx +31 -0
- package/src/app/plugins/openapi/ColorizedParam.tsx +73 -0
- package/src/app/plugins/openapi/MakeRequest.tsx +30 -0
- package/src/app/plugins/openapi/MethodBadge.tsx +36 -0
- package/src/app/plugins/openapi/OperationList.tsx +119 -0
- package/src/app/plugins/openapi/OperationListItem.tsx +55 -0
- package/src/app/plugins/openapi/ParameterList.tsx +32 -0
- package/src/app/plugins/openapi/ParameterListItem.tsx +60 -0
- package/src/app/plugins/openapi/RequestBodySidecarBox.tsx +48 -0
- package/src/app/plugins/openapi/ResponsesSidecarBox.tsx +60 -0
- package/src/app/plugins/openapi/Select.tsx +35 -0
- package/src/app/plugins/openapi/Sidecar.tsx +99 -0
- package/src/app/plugins/openapi/SidecarBox.tsx +35 -0
- package/src/app/plugins/openapi/graphql/env.d.ts +48 -0
- package/src/app/plugins/openapi/graphql/index.ts +13 -0
- package/src/app/plugins/openapi/index.tsx +142 -0
- package/src/app/plugins/openapi/util/generateSchemaExample.ts +59 -0
- package/src/app/plugins/openapi/util/getCode.tsx +69 -0
- package/src/app/plugins/openapi/util/urql.ts +8 -0
- package/src/app/plugins/openapi/worker/createSharedWorkerClient.ts +60 -0
- package/src/app/plugins/openapi/worker/worker.ts +30 -0
- package/src/app/plugins/redirect/index.tsx +20 -0
- package/src/app/tailwind.ts +72 -0
- package/src/app/ui/Callout.tsx +87 -0
- package/src/app/ui/Card.tsx +82 -0
- package/src/app/ui/Note.tsx +58 -0
- package/src/app/util/MdxComponents.tsx +70 -0
- package/src/app/util/cn.ts +6 -0
- package/src/app/util/createWaitForNotify.ts +18 -0
- package/src/app/util/groupBy.ts +24 -0
- package/src/app/util/joinPath.tsx +10 -0
- package/src/app/util/pastellize.ts +25 -0
- package/src/app/util/slugify.ts +3 -0
- package/src/app/util/traverseNavigation.ts +55 -0
- package/src/app/util/useScrollToAnchor.ts +38 -0
- package/src/app/util/useScrollToTop.ts +13 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useApiIdentities } from "../../components/context/DevPortalProvider.js";
|
|
2
|
+
import type { OperationListItemResult } from "./OperationList.js";
|
|
3
|
+
|
|
4
|
+
export const MakeRequest = ({
|
|
5
|
+
operation,
|
|
6
|
+
}: {
|
|
7
|
+
operation: OperationListItemResult;
|
|
8
|
+
}) => {
|
|
9
|
+
const identities = useApiIdentities();
|
|
10
|
+
|
|
11
|
+
return (
|
|
12
|
+
<div>
|
|
13
|
+
{identities.data.map((identity) => (
|
|
14
|
+
<button
|
|
15
|
+
key={identity.id}
|
|
16
|
+
onClick={() => {
|
|
17
|
+
const test = new Request(
|
|
18
|
+
"https://zudoku-customer-main-b36fa2f.d2.zuplo.dev" +
|
|
19
|
+
operation.path,
|
|
20
|
+
);
|
|
21
|
+
void fetch(identity.authorizeRequest(test));
|
|
22
|
+
}}
|
|
23
|
+
className="p-2 border border-border rounded hover:bg-accent"
|
|
24
|
+
>
|
|
25
|
+
Test Request {operation.path} ({identity.name})
|
|
26
|
+
</button>
|
|
27
|
+
))}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { cn } from "../../util/cn.js";
|
|
2
|
+
|
|
3
|
+
export const MethodTextColorMap = {
|
|
4
|
+
get: "text-green-600",
|
|
5
|
+
post: "text-sky-600",
|
|
6
|
+
put: "text-yellow-600",
|
|
7
|
+
delete: "text-red-600",
|
|
8
|
+
patch: "text-purple-600",
|
|
9
|
+
options: "text-indigo-600",
|
|
10
|
+
head: "text-gray-600",
|
|
11
|
+
trace: "text-gray-600",
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const MethodColorMap = {
|
|
15
|
+
get: "bg-green-400 dark:bg-green-800",
|
|
16
|
+
post: "bg-sky-400 dark:bg-sky-800",
|
|
17
|
+
put: "bg-yellow-400 dark:bg-yellow-800",
|
|
18
|
+
delete: "bg-red-400 dark:bg-red-800",
|
|
19
|
+
patch: "bg-purple-400 dark:bg-purple-600",
|
|
20
|
+
options: "bg-indigo-400 dark:bg-indigo-600",
|
|
21
|
+
head: "bg-gray-400 dark:bg-gray-600",
|
|
22
|
+
trace: "bg-gray-400 dark:bg-gray-600",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export const MethodBadge = ({ method }: { method: string }) => {
|
|
26
|
+
return (
|
|
27
|
+
<span
|
|
28
|
+
className={cn(
|
|
29
|
+
"mt-0.5 flex items-center duration-200 transition-opacity text-center uppercase font-mono text-[0.65rem] font-bold rounded text-background dark:text-zinc-50 h-4 px-1",
|
|
30
|
+
MethodColorMap[method as keyof typeof MethodColorMap],
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
{method}
|
|
34
|
+
</span>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { type ResultOf } from "gql.tada";
|
|
2
|
+
import { Heading } from "../../Heading.js";
|
|
3
|
+
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
4
|
+
import { Markdown, ProseClasses } from "../../components/Markdown.js";
|
|
5
|
+
import { cn } from "../../util/cn.js";
|
|
6
|
+
import { OperationListItem } from "./OperationListItem.js";
|
|
7
|
+
import { graphql } from "./graphql/index.js";
|
|
8
|
+
import { useOasConfig } from "./index.js";
|
|
9
|
+
import { useQuery } from "./util/urql.js";
|
|
10
|
+
|
|
11
|
+
export const OperationsFragment = graphql(`
|
|
12
|
+
fragment OperationsFragment on OperationItem {
|
|
13
|
+
slug
|
|
14
|
+
summary
|
|
15
|
+
method
|
|
16
|
+
description
|
|
17
|
+
operationId
|
|
18
|
+
contentTypes
|
|
19
|
+
path
|
|
20
|
+
parameters {
|
|
21
|
+
name
|
|
22
|
+
in
|
|
23
|
+
description
|
|
24
|
+
required
|
|
25
|
+
schema
|
|
26
|
+
style
|
|
27
|
+
}
|
|
28
|
+
requestBody {
|
|
29
|
+
content {
|
|
30
|
+
mediaType
|
|
31
|
+
encoding {
|
|
32
|
+
name
|
|
33
|
+
}
|
|
34
|
+
schema
|
|
35
|
+
}
|
|
36
|
+
description
|
|
37
|
+
required
|
|
38
|
+
}
|
|
39
|
+
responses {
|
|
40
|
+
statusCode
|
|
41
|
+
links
|
|
42
|
+
description
|
|
43
|
+
content {
|
|
44
|
+
mediaType
|
|
45
|
+
encoding {
|
|
46
|
+
name
|
|
47
|
+
}
|
|
48
|
+
schema
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
`);
|
|
53
|
+
|
|
54
|
+
const AllOperationsQuery = graphql(
|
|
55
|
+
`
|
|
56
|
+
query AllOperations($input: JSON!, $type: SchemaType!) {
|
|
57
|
+
schema(input: $input, type: $type) {
|
|
58
|
+
description
|
|
59
|
+
title
|
|
60
|
+
url
|
|
61
|
+
version
|
|
62
|
+
tags {
|
|
63
|
+
name
|
|
64
|
+
description
|
|
65
|
+
operations {
|
|
66
|
+
slug
|
|
67
|
+
...OperationsFragment
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
`,
|
|
73
|
+
[OperationsFragment],
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
export type OperationListItemResult = ResultOf<typeof OperationsFragment>;
|
|
77
|
+
|
|
78
|
+
export const OperationList = () => {
|
|
79
|
+
const { type, input } = useOasConfig();
|
|
80
|
+
const [result] = useQuery({
|
|
81
|
+
query: AllOperationsQuery,
|
|
82
|
+
variables: { type, input },
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (!result.data) return null;
|
|
86
|
+
|
|
87
|
+
return (
|
|
88
|
+
<div className="pt-[--padding-content-top]">
|
|
89
|
+
<div className={cn(ProseClasses, "mb-16")}>
|
|
90
|
+
<CategoryHeading>Overview</CategoryHeading>
|
|
91
|
+
<Heading level={1} id="description" registerSidebarAnchor>
|
|
92
|
+
{result.data.schema.title}
|
|
93
|
+
</Heading>
|
|
94
|
+
<Markdown content={result.data.schema.description ?? ""} />
|
|
95
|
+
</div>
|
|
96
|
+
{result.data?.schema.tags
|
|
97
|
+
.filter((tag) => tag.operations.length > 0)
|
|
98
|
+
.map((tag) => (
|
|
99
|
+
<div key={tag.name}>
|
|
100
|
+
{tag.name && <CategoryHeading>{tag.name}</CategoryHeading>}
|
|
101
|
+
{tag.description && (
|
|
102
|
+
<Markdown
|
|
103
|
+
className={`${ProseClasses} mt-2 mb-12`}
|
|
104
|
+
content={tag.description}
|
|
105
|
+
/>
|
|
106
|
+
)}
|
|
107
|
+
<div className="operation mb-12">
|
|
108
|
+
{tag.operations.map((fragment) => (
|
|
109
|
+
<OperationListItem
|
|
110
|
+
key={fragment.slug}
|
|
111
|
+
operationFragment={fragment}
|
|
112
|
+
/>
|
|
113
|
+
))}
|
|
114
|
+
</div>
|
|
115
|
+
</div>
|
|
116
|
+
))}
|
|
117
|
+
</div>
|
|
118
|
+
);
|
|
119
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { readFragment, type FragmentOf } from "gql.tada";
|
|
2
|
+
import { Heading } from "../../Heading.js";
|
|
3
|
+
import { Markdown, ProseClasses } from "../../components/Markdown.js";
|
|
4
|
+
import { groupBy } from "../../util/groupBy.js";
|
|
5
|
+
import { OperationsFragment } from "./OperationList.js";
|
|
6
|
+
import { ParameterList } from "./ParameterList.js";
|
|
7
|
+
import { Sidecar } from "./Sidecar.js";
|
|
8
|
+
|
|
9
|
+
export const PARAM_GROUPS = ["path", "query", "header", "cookie"] as const;
|
|
10
|
+
export type ParameterGroup = (typeof PARAM_GROUPS)[number];
|
|
11
|
+
|
|
12
|
+
export const OperationListItem = ({
|
|
13
|
+
operationFragment,
|
|
14
|
+
}: {
|
|
15
|
+
operationFragment: FragmentOf<typeof OperationsFragment>;
|
|
16
|
+
}) => {
|
|
17
|
+
const operation = readFragment(OperationsFragment, operationFragment);
|
|
18
|
+
const groupedParameters = groupBy(operation?.parameters ?? [], "in");
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<div
|
|
22
|
+
key={operation.operationId}
|
|
23
|
+
className="grid grid-cols-2 gap-8 items-start border-b-2 mb-16 pb-16 border-border"
|
|
24
|
+
>
|
|
25
|
+
<div className={ProseClasses}>
|
|
26
|
+
<Heading
|
|
27
|
+
level={2}
|
|
28
|
+
className="mt-0"
|
|
29
|
+
id={operation.slug}
|
|
30
|
+
registerSidebarAnchor
|
|
31
|
+
>
|
|
32
|
+
{operation.summary}
|
|
33
|
+
</Heading>
|
|
34
|
+
{operation.description && <Markdown content={operation.description} />}
|
|
35
|
+
{operation.parameters && operation.parameters.length > 0 && (
|
|
36
|
+
<div className="mt-4">
|
|
37
|
+
{PARAM_GROUPS.flatMap((group) =>
|
|
38
|
+
groupedParameters?.[group]?.length ? (
|
|
39
|
+
<ParameterList
|
|
40
|
+
key={group}
|
|
41
|
+
id={operation.slug}
|
|
42
|
+
groupedParameters={groupedParameters}
|
|
43
|
+
group={group}
|
|
44
|
+
/>
|
|
45
|
+
) : (
|
|
46
|
+
[]
|
|
47
|
+
),
|
|
48
|
+
)}
|
|
49
|
+
</div>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
<Sidecar operation={operation} />
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Heading } from "../../Heading.js";
|
|
2
|
+
import type { ParameterGroup } from "./OperationListItem.js";
|
|
3
|
+
import {
|
|
4
|
+
ParameterListItem,
|
|
5
|
+
type ParameterListItemResult,
|
|
6
|
+
} from "./ParameterListItem.js";
|
|
7
|
+
|
|
8
|
+
export const ParameterList = ({
|
|
9
|
+
groupedParameters,
|
|
10
|
+
group,
|
|
11
|
+
id,
|
|
12
|
+
}: {
|
|
13
|
+
groupedParameters: Record<ParameterGroup, ParameterListItemResult[]>;
|
|
14
|
+
group: ParameterGroup;
|
|
15
|
+
id: string;
|
|
16
|
+
}) => (
|
|
17
|
+
<>
|
|
18
|
+
<Heading level={3} id={`${id}/${group}-parameters`} className="capitalize">
|
|
19
|
+
{group === "header" ? "Headers" : `${group} Parameters`}
|
|
20
|
+
</Heading>
|
|
21
|
+
<ul className="list-none m-0 px-0 overflow-hidden">
|
|
22
|
+
{groupedParameters[group].map((parameter) => (
|
|
23
|
+
<ParameterListItem
|
|
24
|
+
key={`${parameter.name}-${parameter.in}`}
|
|
25
|
+
parameter={parameter}
|
|
26
|
+
id={id}
|
|
27
|
+
group={group}
|
|
28
|
+
/>
|
|
29
|
+
))}
|
|
30
|
+
</ul>
|
|
31
|
+
</>
|
|
32
|
+
);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { Markdown } from "../../components/Markdown.js";
|
|
2
|
+
import { type SchemaObject } from "../../oas/graphql/index.js";
|
|
3
|
+
import { ColorizedParam } from "./ColorizedParam.js";
|
|
4
|
+
import type { OperationListItemResult } from "./OperationList.js";
|
|
5
|
+
import type { ParameterGroup } from "./OperationListItem.js";
|
|
6
|
+
|
|
7
|
+
const getParameterSchema = (
|
|
8
|
+
parameter: ParameterListItemResult,
|
|
9
|
+
): SchemaObject => {
|
|
10
|
+
if (parameter.schema != null && typeof parameter.schema === "object") {
|
|
11
|
+
return parameter.schema;
|
|
12
|
+
}
|
|
13
|
+
return {
|
|
14
|
+
type: "string",
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export type ParameterListItemResult = NonNullable<
|
|
19
|
+
OperationListItemResult["parameters"]
|
|
20
|
+
>[number];
|
|
21
|
+
|
|
22
|
+
export const ParameterListItem = ({
|
|
23
|
+
parameter,
|
|
24
|
+
group,
|
|
25
|
+
id,
|
|
26
|
+
}: {
|
|
27
|
+
parameter: ParameterListItemResult;
|
|
28
|
+
group: ParameterGroup;
|
|
29
|
+
id: string;
|
|
30
|
+
}) => (
|
|
31
|
+
<li className="not-prose px-2 py-4 border-t border-border bg-border/20">
|
|
32
|
+
<div className="flex items-center gap-2">
|
|
33
|
+
<code>
|
|
34
|
+
{group === "path" ? (
|
|
35
|
+
<ColorizedParam
|
|
36
|
+
name={parameter.name}
|
|
37
|
+
backgroundOpacity="15%"
|
|
38
|
+
className="px-1"
|
|
39
|
+
slug={id + "-" + parameter.name.toLocaleLowerCase()}
|
|
40
|
+
/>
|
|
41
|
+
) : (
|
|
42
|
+
parameter.name
|
|
43
|
+
)}
|
|
44
|
+
</code>
|
|
45
|
+
{parameter.required && (
|
|
46
|
+
<span className="py-px px-1.5 font-medium text-xs bg-primary/75 text-muted rounded-lg">
|
|
47
|
+
required
|
|
48
|
+
</span>
|
|
49
|
+
)}
|
|
50
|
+
{getParameterSchema(parameter).type && (
|
|
51
|
+
<span className="text-xs text-muted-foreground">
|
|
52
|
+
{getParameterSchema(parameter).type}
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
</div>
|
|
56
|
+
{parameter.description && (
|
|
57
|
+
<Markdown content={parameter.description} className="prose-p:my-1" />
|
|
58
|
+
)}
|
|
59
|
+
</li>
|
|
60
|
+
);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
|
|
3
|
+
import { type SchemaObject } from "../../oas/graphql/index.js";
|
|
4
|
+
import type { OperationListItemResult } from "./OperationList.js";
|
|
5
|
+
import { Select } from "./Select.js";
|
|
6
|
+
import { SidecarBox } from "./SidecarBox.js";
|
|
7
|
+
import { generateSchemaExample } from "./util/generateSchemaExample.js";
|
|
8
|
+
|
|
9
|
+
type Content = NonNullable<
|
|
10
|
+
NonNullable<OperationListItemResult["requestBody"]>["content"]
|
|
11
|
+
>;
|
|
12
|
+
|
|
13
|
+
// @todo should we handle multiple content types?
|
|
14
|
+
export const RequestBodySidecarBox = ({ content }: { content: Content }) => {
|
|
15
|
+
const [selected, setSelected] = useState("example");
|
|
16
|
+
|
|
17
|
+
if (!content.length) return null;
|
|
18
|
+
|
|
19
|
+
return (
|
|
20
|
+
<SidecarBox.Root>
|
|
21
|
+
<SidecarBox.Head className="text-xs flex justify-between items-center">
|
|
22
|
+
<span className="font-mono">Request Body</span>
|
|
23
|
+
<Select
|
|
24
|
+
onChange={(e) => setSelected(e.target.value)}
|
|
25
|
+
options={[
|
|
26
|
+
{ value: "example", label: "Example" },
|
|
27
|
+
{ value: "schema", label: "Schema" },
|
|
28
|
+
]}
|
|
29
|
+
/>
|
|
30
|
+
</SidecarBox.Head>
|
|
31
|
+
<SidecarBox.Body>
|
|
32
|
+
<SyntaxHighlight
|
|
33
|
+
language="json"
|
|
34
|
+
noBackground
|
|
35
|
+
copyable={false}
|
|
36
|
+
className="text-xs"
|
|
37
|
+
code={JSON.stringify(
|
|
38
|
+
selected === "example"
|
|
39
|
+
? generateSchemaExample(content[0].schema as SchemaObject)
|
|
40
|
+
: content[0].schema,
|
|
41
|
+
null,
|
|
42
|
+
2,
|
|
43
|
+
)}
|
|
44
|
+
/>
|
|
45
|
+
</SidecarBox.Body>
|
|
46
|
+
</SidecarBox.Root>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
|
|
3
|
+
import { type SchemaObject } from "../../oas/graphql/index.js";
|
|
4
|
+
import { cn } from "../../util/cn.js";
|
|
5
|
+
import type { OperationListItemResult } from "./OperationList.js";
|
|
6
|
+
import { SidecarBox } from "./SidecarBox.js";
|
|
7
|
+
import { generateSchemaExample } from "./util/generateSchemaExample.js";
|
|
8
|
+
|
|
9
|
+
type Responses = OperationListItemResult["responses"];
|
|
10
|
+
export const ResponsesSidecarBox = ({
|
|
11
|
+
responses,
|
|
12
|
+
}: {
|
|
13
|
+
responses: Responses;
|
|
14
|
+
}) => {
|
|
15
|
+
const [tabIndex, setTabIndex] = useState(0);
|
|
16
|
+
|
|
17
|
+
const activeTab = responses[tabIndex];
|
|
18
|
+
const schema = activeTab?.content?.[0]?.schema as SchemaObject | undefined;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<SidecarBox.Root>
|
|
22
|
+
<SidecarBox.Head className="text-xs grid grid-rows-2 pb-0">
|
|
23
|
+
<span className="font-mono">Responses</span>
|
|
24
|
+
<div className="flex gap-2">
|
|
25
|
+
{responses.map((response, index) => (
|
|
26
|
+
<div
|
|
27
|
+
key={response.statusCode}
|
|
28
|
+
onClick={() => setTabIndex(index)}
|
|
29
|
+
className={cn(
|
|
30
|
+
"text-xs font-mono px-1.5 py-1 pb-px translate-y-px border-b-2 border-transparent rounded-t cursor-pointer",
|
|
31
|
+
tabIndex === index
|
|
32
|
+
? "text-primary dark:text-inherit border-primary"
|
|
33
|
+
: "hover:border-accent-foreground/25",
|
|
34
|
+
)}
|
|
35
|
+
>
|
|
36
|
+
{response.statusCode}
|
|
37
|
+
</div>
|
|
38
|
+
))}
|
|
39
|
+
</div>
|
|
40
|
+
</SidecarBox.Head>
|
|
41
|
+
<SidecarBox.Body>
|
|
42
|
+
{schema ? (
|
|
43
|
+
<SyntaxHighlight
|
|
44
|
+
language="json"
|
|
45
|
+
noBackground
|
|
46
|
+
copyable={false}
|
|
47
|
+
className="text-xs"
|
|
48
|
+
code={JSON.stringify(generateSchemaExample(schema), null, 2)}
|
|
49
|
+
/>
|
|
50
|
+
) : (
|
|
51
|
+
<span className="text-muted-foreground font-mono italic text-xs">
|
|
52
|
+
Empty Response
|
|
53
|
+
</span>
|
|
54
|
+
)}
|
|
55
|
+
<hr className="border-border my-1" />
|
|
56
|
+
<div className="text-xs">{responses[tabIndex].description}</div>
|
|
57
|
+
</SidecarBox.Body>
|
|
58
|
+
</SidecarBox.Root>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ChangeEventHandler } from "react";
|
|
2
|
+
import { ChevronsUpDownIcon } from "../../core/icons.js";
|
|
3
|
+
import { cn } from "../../util/cn.js";
|
|
4
|
+
|
|
5
|
+
export const Select = ({
|
|
6
|
+
onChange,
|
|
7
|
+
className,
|
|
8
|
+
options,
|
|
9
|
+
}: {
|
|
10
|
+
onChange?: ChangeEventHandler<HTMLSelectElement>;
|
|
11
|
+
className?: string;
|
|
12
|
+
options: {
|
|
13
|
+
value: string;
|
|
14
|
+
label: string;
|
|
15
|
+
}[];
|
|
16
|
+
}) => (
|
|
17
|
+
<div className={cn("grid", className)}>
|
|
18
|
+
<select
|
|
19
|
+
className={cn(
|
|
20
|
+
"row-start-1 col-start-1 border border-input text-foreground px-2 py-1 pe-6",
|
|
21
|
+
"rounded-md appearance-none bg-zinc-50 hover:bg-white dark:bg-zinc-800 hover:dark:bg-zinc-800/75",
|
|
22
|
+
)}
|
|
23
|
+
onChange={onChange}
|
|
24
|
+
>
|
|
25
|
+
{options.map((option) => (
|
|
26
|
+
<option value={option.value} key={option.value}>
|
|
27
|
+
{option.label}
|
|
28
|
+
</option>
|
|
29
|
+
))}
|
|
30
|
+
</select>
|
|
31
|
+
<div className="row-start-1 col-start-1 self-center justify-self-end relative end-2 pointer-events-none">
|
|
32
|
+
<ChevronsUpDownIcon size={14} />
|
|
33
|
+
</div>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Fragment, useState } from "react";
|
|
2
|
+
import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
|
|
3
|
+
import { cn } from "../../util/cn.js";
|
|
4
|
+
import { ColorizedParam } from "./ColorizedParam.js";
|
|
5
|
+
import { MakeRequest } from "./MakeRequest.js";
|
|
6
|
+
import { MethodTextColorMap } from "./MethodBadge.js";
|
|
7
|
+
import type { OperationListItemResult } from "./OperationList.js";
|
|
8
|
+
import { RequestBodySidecarBox } from "./RequestBodySidecarBox.js";
|
|
9
|
+
import { ResponsesSidecarBox } from "./ResponsesSidecarBox.js";
|
|
10
|
+
import { Select } from "./Select.js";
|
|
11
|
+
import { SidecarBox } from "./SidecarBox.js";
|
|
12
|
+
import { getCode } from "./util/getCode.js";
|
|
13
|
+
|
|
14
|
+
export const Sidecar = ({
|
|
15
|
+
operation,
|
|
16
|
+
}: {
|
|
17
|
+
operation: OperationListItemResult;
|
|
18
|
+
}) => {
|
|
19
|
+
const methodTextColor =
|
|
20
|
+
MethodTextColorMap[operation.method as keyof typeof MethodTextColorMap];
|
|
21
|
+
const [option, setOption] = useState("curl");
|
|
22
|
+
const requestBodyContent = operation.requestBody?.content;
|
|
23
|
+
|
|
24
|
+
const path = operation.path.split("/").map((part) => (
|
|
25
|
+
<Fragment key={part}>
|
|
26
|
+
{part.startsWith("{") && part.endsWith("}") ? (
|
|
27
|
+
<ColorizedParam
|
|
28
|
+
name={part.slice(1, -1)}
|
|
29
|
+
backgroundOpacity="0"
|
|
30
|
+
// same as in `ParameterListItem`
|
|
31
|
+
slug={operation.slug + "-" + part.slice(1, -1).toLocaleLowerCase()}
|
|
32
|
+
>
|
|
33
|
+
{part}
|
|
34
|
+
</ColorizedParam>
|
|
35
|
+
) : (
|
|
36
|
+
part
|
|
37
|
+
)}
|
|
38
|
+
/
|
|
39
|
+
<wbr />
|
|
40
|
+
</Fragment>
|
|
41
|
+
));
|
|
42
|
+
|
|
43
|
+
const language =
|
|
44
|
+
{
|
|
45
|
+
js: "javascript",
|
|
46
|
+
go: "go",
|
|
47
|
+
rust: "rust",
|
|
48
|
+
curl: "bash",
|
|
49
|
+
wget: "bash",
|
|
50
|
+
ruby: "ruby",
|
|
51
|
+
php: "php",
|
|
52
|
+
}[option] ?? "bash";
|
|
53
|
+
|
|
54
|
+
return (
|
|
55
|
+
<aside className="flex flex-col overflow-hidden sticky top-[--scroll-padding] gap-4">
|
|
56
|
+
<SidecarBox.Root>
|
|
57
|
+
<MakeRequest operation={operation} />
|
|
58
|
+
<SidecarBox.Head className="flex justify-between items-center flex-nowrap p-2 gap-2 text-xs">
|
|
59
|
+
<span className="font-mono break-words">
|
|
60
|
+
<span className={cn("font-semibold", methodTextColor)}>
|
|
61
|
+
{operation.method.toLocaleUpperCase()}
|
|
62
|
+
</span>
|
|
63
|
+
|
|
64
|
+
{path}
|
|
65
|
+
</span>
|
|
66
|
+
<Select
|
|
67
|
+
className="self-start"
|
|
68
|
+
onChange={(e) => setOption(e.target.value)}
|
|
69
|
+
options={[
|
|
70
|
+
{ value: "curl", label: "cURL" },
|
|
71
|
+
{ value: "wget", label: "wget" },
|
|
72
|
+
{ value: "js", label: "Javascript" },
|
|
73
|
+
{ value: "ruby", label: "Ruby" },
|
|
74
|
+
{ value: "php", label: "PHP" },
|
|
75
|
+
{ value: "go", label: "Go" },
|
|
76
|
+
{ value: "rust", label: "Rust" },
|
|
77
|
+
]}
|
|
78
|
+
/>
|
|
79
|
+
</SidecarBox.Head>
|
|
80
|
+
<SidecarBox.Body>
|
|
81
|
+
<SyntaxHighlight
|
|
82
|
+
language={language}
|
|
83
|
+
copyable={false}
|
|
84
|
+
noBackground
|
|
85
|
+
className="text-xs"
|
|
86
|
+
code={getCode(operation, option.toLowerCase())}
|
|
87
|
+
/>
|
|
88
|
+
</SidecarBox.Body>
|
|
89
|
+
</SidecarBox.Root>
|
|
90
|
+
{/*<MakeRequest />*/}
|
|
91
|
+
{requestBodyContent && (
|
|
92
|
+
<RequestBodySidecarBox content={requestBodyContent} />
|
|
93
|
+
)}
|
|
94
|
+
{operation.responses.length > 0 && (
|
|
95
|
+
<ResponsesSidecarBox responses={operation.responses} />
|
|
96
|
+
)}
|
|
97
|
+
</aside>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
import { cn } from "../../util/cn.js";
|
|
3
|
+
|
|
4
|
+
type BaseComponentProps<T = unknown> = PropsWithChildren<
|
|
5
|
+
T & { className?: string }
|
|
6
|
+
>;
|
|
7
|
+
export const SidecarBox = {
|
|
8
|
+
Root: ({ children, className }: BaseComponentProps) => (
|
|
9
|
+
<div
|
|
10
|
+
className={cn(
|
|
11
|
+
"rounded-lg overflow-hidden border border-border dark:border-transparent",
|
|
12
|
+
className,
|
|
13
|
+
)}
|
|
14
|
+
>
|
|
15
|
+
{children}
|
|
16
|
+
</div>
|
|
17
|
+
),
|
|
18
|
+
Head: ({ children, className }: BaseComponentProps) => (
|
|
19
|
+
<div
|
|
20
|
+
className={cn(
|
|
21
|
+
"border-b border-b-border dark:border-b-zinc-600 bg-zinc-100 dark:bg-zinc-700 p-2",
|
|
22
|
+
className,
|
|
23
|
+
)}
|
|
24
|
+
>
|
|
25
|
+
{children}
|
|
26
|
+
</div>
|
|
27
|
+
),
|
|
28
|
+
Body: ({ children, className }: BaseComponentProps) => (
|
|
29
|
+
<div
|
|
30
|
+
className={cn("bg-zinc-50 dark:bg-zinc-800 overflow-auto p-2", className)}
|
|
31
|
+
>
|
|
32
|
+
{children}
|
|
33
|
+
</div>
|
|
34
|
+
),
|
|
35
|
+
};
|