zudoku 0.0.0-f865d81 → 0.0.0-fb7d300
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/dist/app/demo.js +0 -2
- package/dist/app/demo.js.map +1 -1
- package/dist/app/entry.client.js +14 -0
- package/dist/app/entry.client.js.map +1 -1
- package/dist/app/entry.server.js +6 -6
- package/dist/app/entry.server.js.map +1 -1
- package/dist/app/main.d.ts +1 -1
- package/dist/app/main.js +2 -2
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js +0 -2
- package/dist/app/standalone.js.map +1 -1
- package/dist/cli/cli.js +1 -2
- package/dist/cli/cli.js.map +1 -1
- package/dist/codegen.d.ts +3 -0
- package/dist/codegen.js +45 -0
- package/dist/codegen.js.map +1 -0
- package/dist/config/validators/InputSidebarSchema.d.ts +10 -10
- package/dist/config/validators/validate.d.ts +125 -114
- package/dist/config/validators/validate.js +6 -5
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/authentication/AuthenticationPlugin.d.ts +4 -2
- package/dist/lib/authentication/AuthenticationPlugin.js +3 -0
- package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +3 -3
- package/dist/lib/authentication/hook.d.ts +5 -4
- package/dist/lib/authentication/hook.js +1 -3
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +12 -11
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +0 -1
- package/dist/lib/authentication/providers/openid.js +11 -26
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/state.d.ts +25 -4
- package/dist/lib/authentication/state.js +28 -3
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/authentication/use-broadcast/shared.d.ts +48 -0
- package/dist/lib/authentication/use-broadcast/shared.js +243 -0
- package/dist/lib/authentication/use-broadcast/shared.js.map +1 -0
- package/dist/lib/authentication/use-broadcast/useBroadcast.d.ts +24 -0
- package/dist/lib/authentication/use-broadcast/useBroadcast.js +106 -0
- package/dist/lib/authentication/use-broadcast/useBroadcast.js.map +1 -0
- package/dist/lib/components/Bootstrap.d.ts +3 -1
- package/dist/lib/components/Bootstrap.js +10 -4
- package/dist/lib/components/Bootstrap.js.map +1 -1
- package/dist/lib/components/ClientOnly.d.ts +4 -2
- package/dist/lib/components/ClientOnly.js +1 -1
- package/dist/lib/components/ClientOnly.js.map +1 -1
- package/dist/lib/components/DeveloperHint.js +2 -1
- package/dist/lib/components/DeveloperHint.js.map +1 -1
- package/dist/lib/components/Header.js +16 -10
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/Layout.js +12 -4
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/MobileTopNavigation.js +6 -7
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/SyntaxHighlight.js +16 -12
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/ThemeSwitch.d.ts +1 -0
- package/dist/lib/components/ThemeSwitch.js +13 -0
- package/dist/lib/components/ThemeSwitch.js.map +1 -0
- package/dist/lib/components/TopNavigation.d.ts +2 -0
- package/dist/lib/components/TopNavigation.js +13 -7
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/{DevPortal.d.ts → Zudoku.d.ts} +3 -3
- package/dist/lib/components/{DevPortal.js → Zudoku.js} +13 -14
- package/dist/lib/components/Zudoku.js.map +1 -0
- package/dist/lib/components/context/ZudokuContext.d.ts +7 -7
- package/dist/lib/components/context/ZudokuContext.js +8 -13
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/context/ZudokuProvider.d.ts +2 -2
- package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
- package/dist/lib/components/index.d.ts +18 -10
- package/dist/lib/components/index.js +2 -3
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/Sidebar.js +1 -1
- package/dist/lib/components/navigation/Sidebar.js.map +1 -1
- package/dist/lib/components/navigation/utils.js +2 -2
- package/dist/lib/components/navigation/utils.js.map +1 -1
- package/dist/lib/core/{DevPortalContext.d.ts → ZudokuContext.d.ts} +3 -7
- package/dist/lib/core/{DevPortalContext.js → ZudokuContext.js} +2 -7
- package/dist/lib/core/ZudokuContext.js.map +1 -0
- package/dist/lib/core/plugins.d.ts +18 -12
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/errors/ErrorAlert.js +1 -1
- package/dist/lib/errors/ErrorAlert.js.map +1 -1
- package/dist/lib/oas/graphql/index.js +4 -4
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/upgrade/index.js +3 -1
- package/dist/lib/oas/parser/upgrade/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.d.ts +9 -9
- package/dist/lib/plugins/api-keys/index.js +3 -0
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/custom-pages/index.d.ts +2 -2
- package/dist/lib/plugins/custom-pages/index.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +2 -2
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.d.ts +5 -0
- package/dist/lib/plugins/openapi/CollapsibleCode.js +24 -0
- package/dist/lib/plugins/openapi/CollapsibleCode.js.map +1 -0
- package/dist/lib/plugins/openapi/ColorizedParam.js +13 -9
- package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/lib/plugins/openapi/Endpoint.d.ts +1 -1
- package/dist/lib/plugins/openapi/Endpoint.js +5 -9
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.d.ts +2 -2
- package/dist/lib/plugins/openapi/OperationList.js +21 -22
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +6 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +7 -3
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +9 -2
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Route.d.ts +4 -4
- package/dist/lib/plugins/openapi/Route.js +2 -4
- package/dist/lib/plugins/openapi/Route.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.d.ts +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +35 -33
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/client/GraphQLClient.d.ts +8 -0
- package/dist/lib/plugins/openapi/client/GraphQLClient.js +102 -0
- package/dist/lib/plugins/openapi/client/GraphQLClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/GraphQLContext.d.ts +7 -0
- package/dist/lib/plugins/openapi/client/GraphQLContext.js +5 -0
- package/dist/lib/plugins/openapi/client/GraphQLContext.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createServer.d.ts +1 -0
- package/dist/lib/plugins/openapi/client/useCreateQuery.d.ts +5 -0
- package/dist/lib/plugins/openapi/client/useCreateQuery.js +13 -0
- package/dist/lib/plugins/openapi/client/useCreateQuery.js.map +1 -0
- package/dist/lib/plugins/openapi/client/worker.d.ts +4 -1
- package/dist/lib/plugins/openapi/client/worker.js +23 -14
- package/dist/lib/plugins/openapi/client/worker.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/fragment-masking.d.ts +3 -3
- package/dist/lib/plugins/openapi/graphql/fragment-masking.js +3 -4
- package/dist/lib/plugins/openapi/graphql/fragment-masking.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.d.ts +5 -51
- package/dist/lib/plugins/openapi/graphql/gql.js +4 -2
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +32 -8
- package/dist/lib/plugins/openapi/graphql/graphql.js +194 -662
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/index.d.ts +2 -2
- package/dist/lib/plugins/openapi/index.js +40 -53
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +2 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.d.ts +0 -1
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js +25 -36
- package/dist/lib/plugins/openapi/util/generateSchemaExample.js.map +1 -1
- package/dist/lib/plugins/openapi-worker.d.ts +1 -1
- package/dist/lib/plugins/openapi-worker.js +7 -1
- package/dist/lib/plugins/openapi-worker.js.map +1 -1
- package/dist/lib/plugins/redirect/index.d.ts +4 -7
- package/dist/lib/plugins/redirect/index.js +1 -1
- package/dist/lib/plugins/redirect/index.js.map +1 -1
- package/dist/lib/plugins/search-inkeep/index.d.ts +2 -2
- package/dist/lib/plugins/search-inkeep/index.js.map +1 -1
- package/dist/lib/ui/ActionButton.d.ts +4 -0
- package/dist/lib/ui/ActionButton.js +10 -0
- package/dist/lib/ui/ActionButton.js.map +1 -0
- package/dist/lib/util/MdxComponents.d.ts +1 -1
- package/dist/lib/util/useIsomorphicLayoutEffect.d.ts +3 -0
- package/dist/lib/util/useIsomorphicLayoutEffect.js +4 -0
- package/dist/lib/util/useIsomorphicLayoutEffect.js.map +1 -0
- package/dist/lib/util/useOnScreen.d.ts +4 -0
- package/dist/lib/util/useOnScreen.js +19 -0
- package/dist/lib/util/useOnScreen.js.map +1 -0
- package/dist/vite/build.js +5 -1
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +2 -8
- package/dist/vite/config.js +13 -54
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/html.js +0 -2
- package/dist/vite/html.js.map +1 -1
- package/dist/vite/output.d.ts +101 -0
- package/dist/vite/output.js +33 -0
- package/dist/vite/output.js.map +1 -0
- package/dist/vite/plugin-component.js +1 -1
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-config.d.ts +2 -3
- package/dist/vite/plugin-config.js +2 -3
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-mdx.d.ts +0 -6
- package/dist/vite/plugin-mdx.js +3 -2
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin.js +1 -3
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/prerender.js +3 -2
- package/dist/vite/prerender.js.map +1 -1
- package/dist/vite/remarkStaticGeneration.d.ts +3 -0
- package/dist/vite/remarkStaticGeneration.js +125 -0
- package/dist/vite/remarkStaticGeneration.js.map +1 -0
- package/lib/{AnchorLink-BbB2q-jx.js → AnchorLink-CDlhr8gL.js} +11 -10
- package/lib/{AnchorLink-BbB2q-jx.js.map → AnchorLink-CDlhr8gL.js.map} +1 -1
- package/lib/AuthenticationPlugin-D0Em0SwR.js +59 -0
- package/lib/{AuthenticationPlugin-C9BHGXlE.js.map → AuthenticationPlugin-D0Em0SwR.js.map} +1 -1
- package/lib/Button-jK0EsymC.js +48 -0
- package/lib/Button-jK0EsymC.js.map +1 -0
- package/lib/{ClientOnly-CVN6leDu.js → ClientOnly-E7hGysn1.js} +4 -4
- package/lib/ClientOnly-E7hGysn1.js.map +1 -0
- package/lib/Markdown-ievDDhFT.js +15192 -0
- package/lib/Markdown-ievDDhFT.js.map +1 -0
- package/lib/{MdxPage-DKMH_t0f.js → MdxPage-Bwn-VSsH.js} +5 -5
- package/lib/{MdxPage-DKMH_t0f.js.map → MdxPage-Bwn-VSsH.js.map} +1 -1
- package/lib/OperationList-BwBl1xrD.js +4691 -0
- package/lib/OperationList-BwBl1xrD.js.map +1 -0
- package/lib/Route-DlG_HTMu.js +11 -0
- package/lib/Route-DlG_HTMu.js.map +1 -0
- package/lib/{Select-Bagt3Bme.js → Select-O9ZM3ZgX.js} +7 -7
- package/lib/Select-O9ZM3ZgX.js.map +1 -0
- package/lib/{Spinner-C6zroowC.js → SidebarBadge-DxFJcJ6V.js} +28 -17
- package/lib/SidebarBadge-DxFJcJ6V.js.map +1 -0
- package/lib/SlotletProvider-DyomlzGx.js +252 -0
- package/lib/SlotletProvider-DyomlzGx.js.map +1 -0
- package/lib/Spinner-3cQDBVGr.js +7 -0
- package/lib/Spinner-3cQDBVGr.js.map +1 -0
- package/lib/SyntaxHighlight-DkLOsjHS.js +2983 -0
- package/lib/SyntaxHighlight-DkLOsjHS.js.map +1 -0
- package/lib/assets/{worker-Bf8vjASY.js → worker-CPsGZsve.js} +565 -561
- package/lib/assets/{worker-Bf8vjASY.js.map → worker-CPsGZsve.js.map} +1 -1
- package/lib/context-D1nXWxm7.js +22 -0
- package/lib/context-D1nXWxm7.js.map +1 -0
- package/lib/createServer-DK-g7kbB.js +16089 -0
- package/lib/createServer-DK-g7kbB.js.map +1 -0
- package/lib/{hook-sn0zMTkE.js → hook-hEqe7fPB.js} +12 -14
- package/lib/hook-hEqe7fPB.js.map +1 -0
- package/lib/index-Czzd9rjU.js +899 -0
- package/lib/index-Czzd9rjU.js.map +1 -0
- package/lib/index-DNxQ_rCt.js +1273 -0
- package/lib/index-DNxQ_rCt.js.map +1 -0
- package/lib/index-Yn8c3UWE.js +921 -0
- package/lib/index-Yn8c3UWE.js.map +1 -0
- package/lib/{router-BsfSoK2j.js → router-lfyopgBI.js} +23 -23
- package/lib/{router-BsfSoK2j.js.map → router-lfyopgBI.js.map} +1 -1
- package/lib/state-tsXBLONe.js +203 -0
- package/lib/{state-CsuHT8ZO.js.map → state-tsXBLONe.js.map} +1 -1
- package/lib/ui/ActionButton.js +25 -0
- package/lib/ui/ActionButton.js.map +1 -0
- package/lib/useExposedProps-CTPtylCV.js +10 -0
- package/lib/{useExposedProps-ChOIUaS4.js.map → useExposedProps-CTPtylCV.js.map} +1 -1
- package/lib/{ZudokuContext-BKXGJTmu.js → utils-DcpDOncX.js} +242 -246
- package/lib/utils-DcpDOncX.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +24 -18
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +2 -2
- package/lib/zudoku.auth-openid.js +124 -138
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +1291 -1119
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +10 -16336
- package/lib/zudoku.openapi-worker.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +41 -39
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +2 -2
- package/lib/zudoku.plugin-custom-pages.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +5 -9
- package/lib/zudoku.plugin-openapi.js.map +1 -1
- package/lib/zudoku.plugin-redirect.js +2 -2
- package/lib/zudoku.plugin-redirect.js.map +1 -1
- package/lib/zudoku.plugin-search-inkeep.js +1 -1
- package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
- package/package.json +15 -5
- package/src/app/demo.tsx +0 -3
- package/src/app/entry.client.tsx +14 -0
- package/src/app/entry.server.tsx +59 -53
- package/src/app/main.css +1 -1
- package/src/app/main.tsx +4 -4
- package/src/app/standalone.tsx +0 -3
- package/src/lib/authentication/AuthenticationPlugin.tsx +4 -1
- package/src/lib/authentication/authentication.ts +3 -3
- package/src/lib/authentication/hook.ts +1 -3
- package/src/lib/authentication/providers/auth0.tsx +17 -11
- package/src/lib/authentication/providers/openid.tsx +12 -30
- package/src/lib/authentication/state.ts +50 -9
- package/{LICENSE.md → src/lib/authentication/use-broadcast/LICENSE.md} +2 -2
- package/src/lib/authentication/use-broadcast/shared.ts +372 -0
- package/src/lib/authentication/use-broadcast/useBroadcast.ts +146 -0
- package/src/lib/components/Bootstrap.tsx +36 -14
- package/src/lib/components/ClientOnly.tsx +6 -3
- package/src/lib/components/DeveloperHint.tsx +6 -1
- package/src/lib/components/Header.tsx +68 -40
- package/src/lib/components/Layout.tsx +49 -37
- package/src/lib/components/MobileTopNavigation.tsx +15 -18
- package/src/lib/components/SyntaxHighlight.tsx +81 -46
- package/src/lib/components/ThemeSwitch.tsx +26 -0
- package/src/lib/components/TopNavigation.tsx +27 -19
- package/src/lib/components/Zudoku.tsx +108 -0
- package/src/lib/components/context/ZudokuContext.ts +11 -16
- package/src/lib/components/context/ZudokuProvider.tsx +2 -2
- package/src/lib/components/index.ts +2 -3
- package/src/lib/components/navigation/Sidebar.tsx +3 -3
- package/src/lib/components/navigation/utils.ts +2 -2
- package/src/lib/core/{DevPortalContext.ts → ZudokuContext.ts} +3 -11
- package/src/lib/core/plugins.ts +20 -16
- package/src/lib/errors/ErrorAlert.tsx +2 -1
- package/src/lib/oas/graphql/index.ts +4 -4
- package/src/lib/oas/parser/upgrade/index.ts +3 -1
- package/src/lib/plugins/api-keys/index.tsx +12 -9
- package/src/lib/plugins/custom-pages/index.tsx +2 -2
- package/src/lib/plugins/markdown/index.tsx +2 -2
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +80 -0
- package/src/lib/plugins/openapi/ColorizedParam.tsx +23 -14
- package/src/lib/plugins/openapi/Endpoint.tsx +5 -10
- package/src/lib/plugins/openapi/OperationList.tsx +20 -40
- package/src/lib/plugins/openapi/ParameterListItem.tsx +37 -31
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +18 -13
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +17 -12
- package/src/lib/plugins/openapi/Route.tsx +11 -12
- package/src/lib/plugins/openapi/Sidecar.tsx +73 -59
- package/src/lib/plugins/openapi/client/GraphQLClient.tsx +140 -0
- package/src/lib/plugins/openapi/client/GraphQLContext.tsx +16 -0
- package/src/lib/plugins/openapi/client/createServer.ts +2 -0
- package/src/lib/plugins/openapi/client/useCreateQuery.ts +18 -0
- package/src/lib/plugins/openapi/client/worker.ts +38 -24
- package/src/lib/plugins/openapi/graphql/fragment-masking.ts +11 -18
- package/src/lib/plugins/openapi/graphql/gql.ts +10 -27
- package/src/lib/plugins/openapi/graphql/graphql.ts +233 -665
- package/src/lib/plugins/openapi/index.tsx +42 -67
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +5 -2
- package/src/lib/plugins/openapi/util/generateSchemaExample.ts +28 -42
- package/src/lib/plugins/openapi-worker.ts +11 -1
- package/src/lib/plugins/redirect/index.tsx +5 -9
- package/src/lib/plugins/search-inkeep/index.tsx +2 -2
- package/src/lib/ui/ActionButton.tsx +28 -0
- package/src/lib/util/useIsomorphicLayoutEffect.ts +5 -0
- package/src/lib/util/useOnScreen.ts +32 -0
- package/dist/lib/components/DevPortal.js.map +0 -1
- package/dist/lib/components/context/ThemeContext.d.ts +0 -2
- package/dist/lib/components/context/ThemeContext.js +0 -7
- package/dist/lib/components/context/ThemeContext.js.map +0 -1
- package/dist/lib/components/context/ThemeProvider.d.ts +0 -4
- package/dist/lib/components/context/ThemeProvider.js +0 -23
- package/dist/lib/components/context/ThemeProvider.js.map +0 -1
- package/dist/lib/core/DevPortalContext.js.map +0 -1
- package/dist/lib/plugins/openapi/client/createMemoryClient.d.ts +0 -12
- package/dist/lib/plugins/openapi/client/createMemoryClient.js +0 -46
- package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +0 -1
- package/dist/lib/plugins/openapi/client/createWorkerClient.d.ts +0 -10
- package/dist/lib/plugins/openapi/client/createWorkerClient.js +0 -61
- package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +0 -1
- package/dist/lib/plugins/openapi/client/interfaces.d.ts +0 -4
- package/dist/lib/plugins/openapi/client/interfaces.js +0 -2
- package/dist/lib/plugins/openapi/client/interfaces.js.map +0 -1
- package/dist/lib/themeToggle.d.ts +0 -1
- package/dist/lib/themeToggle.js +0 -7
- package/dist/lib/themeToggle.js.map +0 -1
- package/dist/lib/util/createWaitForNotify.d.ts +0 -1
- package/dist/lib/util/createWaitForNotify.js +0 -15
- package/dist/lib/util/createWaitForNotify.js.map +0 -1
- package/dist/vite/plugin-html-transform.d.ts +0 -2
- package/dist/vite/plugin-html-transform.js +0 -15
- package/dist/vite/plugin-html-transform.js.map +0 -1
- package/lib/AuthenticationPlugin-C9BHGXlE.js +0 -55
- package/lib/ClientOnly-CVN6leDu.js.map +0 -1
- package/lib/DeveloperHint-DHdLXGHA.js +0 -16
- package/lib/DeveloperHint-DHdLXGHA.js.map +0 -1
- package/lib/Markdown-BDcCAWwm.js +0 -18059
- package/lib/Markdown-BDcCAWwm.js.map +0 -1
- package/lib/OperationList-Tj7ubW_t.js +0 -604
- package/lib/OperationList-Tj7ubW_t.js.map +0 -1
- package/lib/Route-C3DGB6OS.js +0 -13
- package/lib/Route-C3DGB6OS.js.map +0 -1
- package/lib/Select-Bagt3Bme.js.map +0 -1
- package/lib/SlotletProvider-Da7eFgd2.js +0 -241
- package/lib/SlotletProvider-Da7eFgd2.js.map +0 -1
- package/lib/Spinner-C6zroowC.js.map +0 -1
- package/lib/StaggeredRender-DDHSzQKE.js +0 -17
- package/lib/StaggeredRender-DDHSzQKE.js.map +0 -1
- package/lib/ZudokuContext-BKXGJTmu.js.map +0 -1
- package/lib/hook-sn0zMTkE.js.map +0 -1
- package/lib/index-AjWCJNGC.js +0 -5690
- package/lib/index-AjWCJNGC.js.map +0 -1
- package/lib/index-CRo94sKK.js +0 -1783
- package/lib/index-CRo94sKK.js.map +0 -1
- package/lib/state-CsuHT8ZO.js +0 -183
- package/lib/urql-core-KJnLL26g.js +0 -1455
- package/lib/urql-core-KJnLL26g.js.map +0 -1
- package/lib/useExposedProps-ChOIUaS4.js +0 -9
- package/src/lib/components/DevPortal.tsx +0 -111
- package/src/lib/components/context/ThemeContext.tsx +0 -8
- package/src/lib/components/context/ThemeProvider.tsx +0 -27
- package/src/lib/plugins/openapi/client/createMemoryClient.ts +0 -51
- package/src/lib/plugins/openapi/client/createWorkerClient.ts +0 -75
- package/src/lib/plugins/openapi/client/interfaces.ts +0 -5
- package/src/lib/themeToggle.ts +0 -7
- package/src/lib/util/createWaitForNotify.ts +0 -18
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { useTheme } from "next-themes";
|
|
2
|
+
import { useEffect, useRef, type CSSProperties, type ReactNode } from "react";
|
|
3
3
|
import { cn } from "../../util/cn.js";
|
|
4
4
|
import { pastellize } from "../../util/pastellize.js";
|
|
5
5
|
|
|
6
6
|
export const DATA_ATTR = "data-linked-param";
|
|
7
7
|
|
|
8
8
|
export const usePastellizedColor = (name: string) => {
|
|
9
|
-
const
|
|
9
|
+
const { resolvedTheme } = useTheme();
|
|
10
10
|
return pastellize(
|
|
11
11
|
name,
|
|
12
|
-
|
|
12
|
+
resolvedTheme === "light" ? { saturation: 85, lightness: 50 } : undefined,
|
|
13
13
|
);
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -61,27 +61,36 @@ export const ColorizedParam = ({
|
|
|
61
61
|
});
|
|
62
62
|
};
|
|
63
63
|
|
|
64
|
-
ref.current
|
|
65
|
-
|
|
64
|
+
const el = ref.current;
|
|
65
|
+
|
|
66
|
+
el.addEventListener("mouseenter", onMouseEnter);
|
|
67
|
+
el.addEventListener("mouseleave", onMouseLeave);
|
|
66
68
|
|
|
67
69
|
return () => {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
+
el.removeEventListener("mouseenter", onMouseEnter);
|
|
71
|
+
el.removeEventListener("mouseleave", onMouseLeave);
|
|
70
72
|
};
|
|
71
73
|
}, [normalizedSlug]);
|
|
72
74
|
|
|
73
75
|
return (
|
|
74
76
|
<span
|
|
75
|
-
className={cn("inline-flex relative rounded group", className)}
|
|
76
77
|
{...{ [DATA_ATTR]: normalizedSlug }}
|
|
78
|
+
className={cn(
|
|
79
|
+
"relative after:rounded after:absolute after:inset-0 after:-bottom-0.5 after:border-b-2 after:transition-opacity after:duration-200",
|
|
80
|
+
"after:pointer-events-none after:border-[--border-color] after:opacity-30 after:data-[active=true]:opacity-100",
|
|
81
|
+
className,
|
|
82
|
+
)}
|
|
83
|
+
suppressHydrationWarning
|
|
77
84
|
ref={ref}
|
|
78
85
|
onClick={onClick}
|
|
86
|
+
style={
|
|
87
|
+
{
|
|
88
|
+
"--border-color": borderColor,
|
|
89
|
+
"--background-color": backgroundColor,
|
|
90
|
+
} as CSSProperties
|
|
91
|
+
}
|
|
79
92
|
>
|
|
80
|
-
|
|
81
|
-
className="absolute inset-0 border-b-2 transition-opacity duration-200 opacity-30 group-data-[active=true]:opacity-100"
|
|
82
|
-
style={{ borderColor, backgroundColor }}
|
|
83
|
-
/>
|
|
84
|
-
<span className="relative">{children ?? name}</span>
|
|
93
|
+
{children ?? name}
|
|
85
94
|
</span>
|
|
86
95
|
);
|
|
87
96
|
};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
1
2
|
import { CheckIcon, CopyIcon } from "lucide-react";
|
|
2
3
|
import { useState, useTransition } from "react";
|
|
3
|
-
import { useQuery } from "urql";
|
|
4
4
|
import { useSelectedServerStore } from "../../authentication/state.js";
|
|
5
5
|
import { InlineCode } from "../../components/InlineCode.js";
|
|
6
6
|
import { Button } from "../../ui/Button.js";
|
|
7
|
+
import { useCreateQuery } from "./client/useCreateQuery.js";
|
|
7
8
|
import { useOasConfig } from "./context.js";
|
|
8
9
|
import { graphql } from "./graphql/index.js";
|
|
9
10
|
import { SimpleSelect } from "./SimpleSelect.js";
|
|
@@ -42,19 +43,13 @@ const CopyButton = ({ url }: { url: string }) => {
|
|
|
42
43
|
);
|
|
43
44
|
};
|
|
44
45
|
|
|
45
|
-
const context = { suspense: true } as const;
|
|
46
|
-
|
|
47
46
|
export const Endpoint = () => {
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
context,
|
|
52
|
-
});
|
|
47
|
+
const { input, type } = useOasConfig();
|
|
48
|
+
const query = useCreateQuery(ServersQuery, { input, type });
|
|
49
|
+
const result = useSuspenseQuery(query);
|
|
53
50
|
const [, startTransition] = useTransition();
|
|
54
51
|
const { selectedServer, setSelectedServer } = useSelectedServerStore();
|
|
55
52
|
|
|
56
|
-
if (!result.data) return null;
|
|
57
|
-
|
|
58
53
|
const { servers } = result.data.schema;
|
|
59
54
|
|
|
60
55
|
if (servers.length === 1) {
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { ResultOf } from "@graphql-typed-document-node/core";
|
|
2
|
-
import {
|
|
2
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
3
3
|
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
4
|
-
import { DeveloperHint } from "../../components/DeveloperHint.js";
|
|
5
|
-
import { ErrorPage } from "../../components/ErrorPage.js";
|
|
6
4
|
import { Heading } from "../../components/Heading.js";
|
|
7
|
-
import { InlineCode } from "../../components/InlineCode.js";
|
|
8
5
|
import { Markdown, ProseClasses } from "../../components/Markdown.js";
|
|
9
|
-
import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
|
|
10
6
|
import { cn } from "../../util/cn.js";
|
|
11
7
|
import { Endpoint } from "./Endpoint.js";
|
|
12
8
|
import { OperationListItem } from "./OperationListItem.js";
|
|
13
9
|
import StaggeredRender from "./StaggeredRender.js";
|
|
10
|
+
import { useCreateQuery } from "./client/useCreateQuery.js";
|
|
14
11
|
import { useOasConfig } from "./context.js";
|
|
15
12
|
import { graphql } from "./graphql/index.js";
|
|
16
13
|
|
|
@@ -44,6 +41,13 @@ export const OperationsFragment = graphql(/* GraphQL */ `
|
|
|
44
41
|
encoding {
|
|
45
42
|
name
|
|
46
43
|
}
|
|
44
|
+
examples {
|
|
45
|
+
name
|
|
46
|
+
description
|
|
47
|
+
externalValue
|
|
48
|
+
value
|
|
49
|
+
summary
|
|
50
|
+
}
|
|
47
51
|
schema
|
|
48
52
|
}
|
|
49
53
|
description
|
|
@@ -54,6 +58,13 @@ export const OperationsFragment = graphql(/* GraphQL */ `
|
|
|
54
58
|
links
|
|
55
59
|
description
|
|
56
60
|
content {
|
|
61
|
+
examples {
|
|
62
|
+
name
|
|
63
|
+
description
|
|
64
|
+
externalValue
|
|
65
|
+
value
|
|
66
|
+
summary
|
|
67
|
+
}
|
|
57
68
|
mediaType
|
|
58
69
|
encoding {
|
|
59
70
|
name
|
|
@@ -85,41 +96,10 @@ const AllOperationsQuery = graphql(/* GraphQL */ `
|
|
|
85
96
|
}
|
|
86
97
|
`);
|
|
87
98
|
|
|
88
|
-
const suspenseContext = { suspense: true };
|
|
89
|
-
|
|
90
99
|
export const OperationList = () => {
|
|
91
|
-
const {
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
query: AllOperationsQuery,
|
|
95
|
-
variables: { type, input },
|
|
96
|
-
context: suspenseContext,
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
const error = result.error?.graphQLErrors.at(0);
|
|
100
|
-
|
|
101
|
-
// Looks like there is no Suspense level error handling (yet)?
|
|
102
|
-
// So we handle the error case in the component directly
|
|
103
|
-
if (error) {
|
|
104
|
-
return (
|
|
105
|
-
<ErrorPage
|
|
106
|
-
category="Error"
|
|
107
|
-
title="Schema cannot be displayed"
|
|
108
|
-
message={
|
|
109
|
-
<>
|
|
110
|
-
<DeveloperHint className="mb-4">
|
|
111
|
-
Check your configuration value <InlineCode>apis.type</InlineCode>{" "}
|
|
112
|
-
and <InlineCode>apis.input</InlineCode> in the Zudoku config.
|
|
113
|
-
</DeveloperHint>
|
|
114
|
-
An error occurred while trying to fetch the API reference:
|
|
115
|
-
<SyntaxHighlight code={error.toString()} language="plain" />
|
|
116
|
-
</>
|
|
117
|
-
}
|
|
118
|
-
/>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
if (!result.data) return null;
|
|
100
|
+
const { input, type } = useOasConfig();
|
|
101
|
+
const query = useCreateQuery(AllOperationsQuery, { input, type });
|
|
102
|
+
const result = useSuspenseQuery(query);
|
|
123
103
|
|
|
124
104
|
return (
|
|
125
105
|
<div className="pt-[--padding-content-top]">
|
|
@@ -140,7 +120,7 @@ export const OperationList = () => {
|
|
|
140
120
|
{result.data.schema.tags
|
|
141
121
|
.filter((tag) => tag.operations.length > 0)
|
|
142
122
|
.map((tag) => (
|
|
143
|
-
<div key={tag.name}>
|
|
123
|
+
<div key={tag.name} className="[content-visibility:auto]">
|
|
144
124
|
{tag.name && <CategoryHeading>{tag.name}</CategoryHeading>}
|
|
145
125
|
{tag.description && (
|
|
146
126
|
<Markdown
|
|
@@ -27,36 +27,42 @@ export const ParameterListItem = ({
|
|
|
27
27
|
parameter: ParameterListItemResult;
|
|
28
28
|
group: ParameterGroup;
|
|
29
29
|
id: string;
|
|
30
|
-
}) =>
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
30
|
+
}) => {
|
|
31
|
+
const paramSchema = getParameterSchema(parameter);
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<li className="p-4 bg-border/20 text-sm flex flex-col gap-1">
|
|
35
|
+
<div className="flex items-center gap-2">
|
|
36
|
+
<code>
|
|
37
|
+
{group === "path" ? (
|
|
38
|
+
<ColorizedParam
|
|
39
|
+
name={parameter.name}
|
|
40
|
+
backgroundOpacity="15%"
|
|
41
|
+
slug={id + "-" + parameter.name.toLocaleLowerCase()}
|
|
42
|
+
/>
|
|
43
|
+
) : (
|
|
44
|
+
parameter.name
|
|
45
|
+
)}
|
|
46
|
+
</code>
|
|
47
|
+
{parameter.required && (
|
|
48
|
+
<span className="py-px px-1.5 font-medium bg-primary/75 text-muted rounded-lg">
|
|
49
|
+
required
|
|
50
|
+
</span>
|
|
42
51
|
)}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
{paramSchema.type && (
|
|
53
|
+
<span className="text-muted-foreground">
|
|
54
|
+
{paramSchema.type === "array"
|
|
55
|
+
? `${paramSchema.items.type}[]`
|
|
56
|
+
: paramSchema.type}
|
|
57
|
+
</span>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
{parameter.description && (
|
|
61
|
+
<Markdown
|
|
62
|
+
content={parameter.description}
|
|
63
|
+
className="text-sm prose-p:my-1 prose-code:whitespace-pre-line"
|
|
64
|
+
/>
|
|
53
65
|
)}
|
|
54
|
-
</
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
content={parameter.description}
|
|
58
|
-
className="text-sm prose-p:my-1 prose-code:whitespace-pre-line"
|
|
59
|
-
/>
|
|
60
|
-
)}
|
|
61
|
-
</li>
|
|
62
|
-
);
|
|
66
|
+
</li>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
|
|
2
2
|
import { type SchemaObject } from "../../oas/graphql/index.js";
|
|
3
|
+
import { CollapsibleCode } from "./CollapsibleCode.js";
|
|
3
4
|
import type { OperationListItemResult } from "./OperationList.js";
|
|
4
5
|
import * as SidecarBox from "./SidecarBox.js";
|
|
5
6
|
import { generateSchemaExample } from "./util/generateSchemaExample.js";
|
|
@@ -12,6 +13,14 @@ type Content = NonNullable<
|
|
|
12
13
|
export const RequestBodySidecarBox = ({ content }: { content: Content }) => {
|
|
13
14
|
if (!content.length) return null;
|
|
14
15
|
|
|
16
|
+
const firstContent = content.at(0);
|
|
17
|
+
|
|
18
|
+
const example =
|
|
19
|
+
firstContent?.examples?.at(0)?.value ??
|
|
20
|
+
(firstContent?.schema
|
|
21
|
+
? generateSchemaExample(firstContent.schema as SchemaObject)
|
|
22
|
+
: "");
|
|
23
|
+
|
|
15
24
|
return (
|
|
16
25
|
<>
|
|
17
26
|
<SidecarBox.Root>
|
|
@@ -19,19 +28,15 @@ export const RequestBodySidecarBox = ({ content }: { content: Content }) => {
|
|
|
19
28
|
<span className="font-mono">Request Body Example</span>
|
|
20
29
|
</SidecarBox.Head>
|
|
21
30
|
<SidecarBox.Body className="p-0">
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
null,
|
|
32
|
-
2,
|
|
33
|
-
)}
|
|
34
|
-
/>
|
|
31
|
+
<CollapsibleCode>
|
|
32
|
+
<SyntaxHighlight
|
|
33
|
+
language={example ? "json" : "plain"}
|
|
34
|
+
noBackground
|
|
35
|
+
copyable
|
|
36
|
+
className="[--scrollbar-color:gray] text-xs max-h-[500px] p-2"
|
|
37
|
+
code={example ? JSON.stringify(example, null, 2) : "No example"}
|
|
38
|
+
/>
|
|
39
|
+
</CollapsibleCode>
|
|
35
40
|
</SidecarBox.Body>
|
|
36
41
|
</SidecarBox.Root>
|
|
37
42
|
</>
|
|
@@ -2,6 +2,7 @@ import * as Tabs from "@radix-ui/react-tabs";
|
|
|
2
2
|
import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
|
|
3
3
|
import { type SchemaObject } from "../../oas/graphql/index.js";
|
|
4
4
|
import { cn } from "../../util/cn.js";
|
|
5
|
+
import { CollapsibleCode } from "./CollapsibleCode.js";
|
|
5
6
|
import type { OperationListItemResult } from "./OperationList.js";
|
|
6
7
|
import * as SidecarBox from "./SidecarBox.js";
|
|
7
8
|
import { generateSchemaExample } from "./util/generateSchemaExample.js";
|
|
@@ -41,25 +42,29 @@ export const ResponsesSidecarBox = ({
|
|
|
41
42
|
</Tabs.List>
|
|
42
43
|
</SidecarBox.Head>
|
|
43
44
|
{responses.map((response) => {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
const firstContent = response.content?.at(0);
|
|
46
|
+
|
|
47
|
+
const example =
|
|
48
|
+
firstContent?.examples?.at(0)?.value ??
|
|
49
|
+
(firstContent?.schema
|
|
50
|
+
? generateSchemaExample(firstContent.schema as SchemaObject)
|
|
51
|
+
: "");
|
|
47
52
|
|
|
48
53
|
return (
|
|
49
54
|
<Tabs.Content key={response.statusCode} value={response.statusCode}>
|
|
50
55
|
<SidecarBox.Body className="p-0">
|
|
51
|
-
|
|
56
|
+
<CollapsibleCode>
|
|
52
57
|
<SyntaxHighlight
|
|
53
|
-
language="json"
|
|
58
|
+
language={example ? "json" : "plain"}
|
|
54
59
|
noBackground
|
|
55
|
-
className="text-xs max-h-[
|
|
56
|
-
code={
|
|
60
|
+
className="[--scrollbar-color:gray] text-xs max-h-[500px] p-2"
|
|
61
|
+
code={
|
|
62
|
+
example
|
|
63
|
+
? JSON.stringify(example, null, 2)
|
|
64
|
+
: "Empty response"
|
|
65
|
+
}
|
|
57
66
|
/>
|
|
58
|
-
|
|
59
|
-
<span className="text-muted-foreground font-mono italic text-xs">
|
|
60
|
-
Empty Response
|
|
61
|
-
</span>
|
|
62
|
-
)}
|
|
67
|
+
</CollapsibleCode>
|
|
63
68
|
</SidecarBox.Body>
|
|
64
69
|
<SidecarBox.Footer className="flex justify-end text-xs">
|
|
65
70
|
{response.description}
|
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
import { Outlet } from "react-router-dom";
|
|
2
|
-
import {
|
|
2
|
+
import type { GraphQLClient } from "./client/GraphQLClient.js";
|
|
3
|
+
import { GraphQLProvider } from "./client/GraphQLContext.js";
|
|
3
4
|
import { OasConfigProvider } from "./context.js";
|
|
4
5
|
import { OasPluginConfig } from "./interfaces.js";
|
|
5
6
|
|
|
6
|
-
export
|
|
7
|
+
export const OpenApiRoute = ({
|
|
7
8
|
config,
|
|
8
9
|
client,
|
|
9
10
|
}: {
|
|
10
11
|
config: OasPluginConfig;
|
|
11
|
-
client:
|
|
12
|
-
})
|
|
13
|
-
|
|
14
|
-
<
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
);
|
|
20
|
-
}
|
|
12
|
+
client: GraphQLClient;
|
|
13
|
+
}) => (
|
|
14
|
+
<OasConfigProvider value={{ config }}>
|
|
15
|
+
<GraphQLProvider client={client}>
|
|
16
|
+
<Outlet />
|
|
17
|
+
</GraphQLProvider>
|
|
18
|
+
</OasConfigProvider>
|
|
19
|
+
);
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
1
2
|
import { HTTPSnippet } from "@zudoku/httpsnippet";
|
|
2
3
|
import { Fragment, useMemo, useTransition } from "react";
|
|
3
4
|
import { useSearchParams } from "react-router-dom";
|
|
4
|
-
import { useQuery } from "urql";
|
|
5
5
|
import { useSelectedServerStore } from "../../authentication/state.js";
|
|
6
6
|
import { TextColorMap } from "../../components/navigation/SidebarBadge.js";
|
|
7
7
|
import { SyntaxHighlight } from "../../components/SyntaxHighlight.js";
|
|
8
8
|
import type { SchemaObject } from "../../oas/parser/index.js";
|
|
9
9
|
import { cn } from "../../util/cn.js";
|
|
10
|
+
import { useOnScreen } from "../../util/useOnScreen.js";
|
|
11
|
+
import { useCreateQuery } from "./client/useCreateQuery.js";
|
|
12
|
+
import { CollapsibleCode } from "./CollapsibleCode.js";
|
|
10
13
|
import { ColorizedParam } from "./ColorizedParam.js";
|
|
11
14
|
import { useOasConfig } from "./context.js";
|
|
12
15
|
import { graphql } from "./graphql/index.js";
|
|
@@ -73,8 +76,6 @@ export const GetServerQuery = graphql(/* GraphQL */ `
|
|
|
73
76
|
}
|
|
74
77
|
`);
|
|
75
78
|
|
|
76
|
-
const context = { suspense: true };
|
|
77
|
-
|
|
78
79
|
const methodToColor = {
|
|
79
80
|
get: TextColorMap.green,
|
|
80
81
|
post: TextColorMap.blue,
|
|
@@ -86,6 +87,20 @@ const methodToColor = {
|
|
|
86
87
|
trace: TextColorMap.gray,
|
|
87
88
|
};
|
|
88
89
|
|
|
90
|
+
const EXAMPLE_LANGUAGES = [
|
|
91
|
+
{ value: "shell", label: "cURL" },
|
|
92
|
+
{ value: "js", label: "JavaScript" },
|
|
93
|
+
{ value: "python", label: "Python" },
|
|
94
|
+
{ value: "java", label: "Java" },
|
|
95
|
+
{ value: "go", label: "Go" },
|
|
96
|
+
{ value: "csharp", label: "C#" },
|
|
97
|
+
{ value: "kotlin", label: "Kotlin" },
|
|
98
|
+
{ value: "objc", label: "Objective-C" },
|
|
99
|
+
{ value: "php", label: "PHP" },
|
|
100
|
+
{ value: "ruby", label: "Ruby" },
|
|
101
|
+
{ value: "swift", label: "Swift" },
|
|
102
|
+
];
|
|
103
|
+
|
|
89
104
|
export const Sidecar = ({
|
|
90
105
|
operation,
|
|
91
106
|
selectedResponse,
|
|
@@ -95,12 +110,10 @@ export const Sidecar = ({
|
|
|
95
110
|
selectedResponse?: string;
|
|
96
111
|
onSelectResponse: (response: string) => void;
|
|
97
112
|
}) => {
|
|
98
|
-
const
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
context,
|
|
103
|
-
});
|
|
113
|
+
const { input, type } = useOasConfig();
|
|
114
|
+
const query = useCreateQuery(GetServerQuery, { input, type });
|
|
115
|
+
const result = useSuspenseQuery(query);
|
|
116
|
+
|
|
104
117
|
const methodTextColor =
|
|
105
118
|
methodToColor[
|
|
106
119
|
operation.method.toLocaleLowerCase() as keyof typeof methodToColor
|
|
@@ -149,7 +162,7 @@ export const Sidecar = ({
|
|
|
149
162
|
const snippet = new HTTPSnippet({
|
|
150
163
|
method: operation.method.toLocaleUpperCase(),
|
|
151
164
|
url:
|
|
152
|
-
(selectedServer ?? result.data
|
|
165
|
+
(selectedServer ?? result.data.schema.url ?? "") +
|
|
153
166
|
operation.path.replaceAll("{", ":").replaceAll("}", ""),
|
|
154
167
|
postData: example
|
|
155
168
|
? {
|
|
@@ -167,15 +180,20 @@ export const Sidecar = ({
|
|
|
167
180
|
|
|
168
181
|
return getConverted(snippet, selectedLang);
|
|
169
182
|
}, [
|
|
170
|
-
|
|
171
|
-
selectedLang,
|
|
183
|
+
requestBodyContent,
|
|
172
184
|
operation.method,
|
|
173
185
|
operation.path,
|
|
174
|
-
|
|
186
|
+
selectedServer,
|
|
187
|
+
result.data.schema.url,
|
|
188
|
+
selectedLang,
|
|
175
189
|
]);
|
|
190
|
+
const [ref, isOnScreen] = useOnScreen({ rootMargin: "200px 0px 200px 0px" });
|
|
176
191
|
|
|
177
192
|
return (
|
|
178
|
-
<aside
|
|
193
|
+
<aside
|
|
194
|
+
ref={ref}
|
|
195
|
+
className="flex flex-col overflow-hidden sticky top-[--scroll-padding] gap-4"
|
|
196
|
+
>
|
|
179
197
|
<SidecarBox.Root>
|
|
180
198
|
<SidecarBox.Head className="flex justify-between items-center flex-nowrap py-3 gap-2 text-xs">
|
|
181
199
|
<span className="font-mono break-words">
|
|
@@ -185,55 +203,51 @@ export const Sidecar = ({
|
|
|
185
203
|
|
|
186
204
|
{path}
|
|
187
205
|
</span>
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
206
|
+
{isOnScreen && (
|
|
207
|
+
<PlaygroundDialogWrapper
|
|
208
|
+
server={result.data.schema.url ?? ""}
|
|
209
|
+
servers={
|
|
210
|
+
result.data.schema.servers.map((server) => server.url) ?? []
|
|
211
|
+
}
|
|
212
|
+
operation={operation}
|
|
213
|
+
/>
|
|
214
|
+
)}
|
|
195
215
|
</SidecarBox.Head>
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
{ value: "php", label: "PHP" },
|
|
227
|
-
{ value: "ruby", label: "Ruby" },
|
|
228
|
-
{ value: "swift", label: "Swift" },
|
|
229
|
-
]}
|
|
230
|
-
/>
|
|
231
|
-
</SidecarBox.Footer>
|
|
216
|
+
{isOnScreen && (
|
|
217
|
+
<>
|
|
218
|
+
<SidecarBox.Body className="p-0">
|
|
219
|
+
<CollapsibleCode>
|
|
220
|
+
<SyntaxHighlight
|
|
221
|
+
language={selectedLang}
|
|
222
|
+
noBackground
|
|
223
|
+
className="[--scrollbar-color:gray] text-xs max-h-[500px] p-2"
|
|
224
|
+
code={code!}
|
|
225
|
+
/>
|
|
226
|
+
</CollapsibleCode>
|
|
227
|
+
</SidecarBox.Body>
|
|
228
|
+
<SidecarBox.Footer className="flex items-center text-xs gap-2 justify-end py-1">
|
|
229
|
+
<span>Show example in</span>
|
|
230
|
+
<SimpleSelect
|
|
231
|
+
className="self-start max-w-[150px]"
|
|
232
|
+
value={selectedLang}
|
|
233
|
+
onChange={(e) => {
|
|
234
|
+
startTransition(() => {
|
|
235
|
+
setSearchParams((prev) => {
|
|
236
|
+
prev.set("lang", e.target.value);
|
|
237
|
+
return prev;
|
|
238
|
+
});
|
|
239
|
+
});
|
|
240
|
+
}}
|
|
241
|
+
options={EXAMPLE_LANGUAGES}
|
|
242
|
+
/>
|
|
243
|
+
</SidecarBox.Footer>
|
|
244
|
+
</>
|
|
245
|
+
)}
|
|
232
246
|
</SidecarBox.Root>
|
|
233
|
-
{requestBodyContent && (
|
|
247
|
+
{isOnScreen && requestBodyContent && (
|
|
234
248
|
<RequestBodySidecarBox content={requestBodyContent} />
|
|
235
249
|
)}
|
|
236
|
-
{operation.responses.length > 0 && (
|
|
250
|
+
{isOnScreen && operation.responses.length > 0 && (
|
|
237
251
|
<ResponsesSidecarBox
|
|
238
252
|
selectedResponse={selectedResponse}
|
|
239
253
|
onSelectResponse={onSelectResponse}
|