zudoku 0.3.0-dev.5 → 0.3.0-dev.50
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/App.d.ts +1 -2
- package/dist/app/App.js +1 -28
- package/dist/app/App.js.map +1 -1
- package/dist/app/demo.d.ts +2 -0
- package/dist/app/demo.js +27 -0
- package/dist/app/demo.js.map +1 -0
- package/dist/app/entry.client.d.ts +2 -0
- package/dist/app/entry.client.js +35 -0
- package/dist/app/entry.client.js.map +1 -0
- package/dist/app/entry.server.d.ts +12 -0
- package/dist/app/entry.server.js +104 -0
- package/dist/app/entry.server.js.map +1 -0
- package/dist/app/main.d.ts +6 -1
- package/dist/app/main.js +54 -12
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.d.ts +2 -0
- package/dist/app/standalone.js +32 -0
- package/dist/app/standalone.js.map +1 -0
- package/dist/app/tailwind.d.ts +1 -1
- package/dist/app/tailwind.js +0 -4
- package/dist/app/tailwind.js.map +1 -1
- package/dist/app/zudoku-manifest.d.ts +1 -0
- package/dist/app/zudoku-manifest.js +20 -0
- package/dist/app/zudoku-manifest.js.map +1 -0
- package/dist/cli/cmds/dev.js +5 -0
- package/dist/cli/cmds/dev.js.map +1 -1
- package/dist/cli/dev/handler.d.ts +1 -0
- package/dist/cli/dev/handler.js +3 -1
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/config/config.d.ts +5 -39
- package/dist/config/validators/validate.d.ts +799 -2
- package/dist/config/validators/validate.js +134 -1
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +2 -0
- package/dist/internal.js.map +1 -0
- package/dist/lib/authentication/Callback.js +1 -1
- package/dist/lib/authentication/Callback.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +2 -2
- package/dist/lib/authentication/hook.d.ts +1 -0
- package/dist/lib/authentication/hook.js +1 -0
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +1 -0
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/clerk.js +4 -0
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +1 -1
- package/dist/lib/authentication/providers/openid.js +2 -0
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/state.d.ts +1 -0
- package/dist/lib/authentication/state.js +1 -0
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/components/Bootstrap.d.ts +12 -0
- package/dist/lib/components/Bootstrap.js +9 -0
- package/dist/lib/components/Bootstrap.js.map +1 -0
- package/dist/lib/components/DevPortal.d.ts +4 -19
- package/dist/lib/components/DevPortal.js +17 -12
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/components/ErrorPage.d.ts +6 -0
- package/dist/lib/components/ErrorPage.js +9 -0
- package/dist/lib/components/ErrorPage.js.map +1 -0
- package/dist/lib/components/Header.js +3 -3
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +9 -4
- package/dist/lib/components/Heading.js +17 -2
- package/dist/lib/components/Heading.js.map +1 -1
- package/dist/lib/components/InlineCode.d.ts +5 -0
- package/dist/lib/components/InlineCode.js +4 -0
- package/dist/lib/components/InlineCode.js.map +1 -0
- package/dist/lib/components/Layout.js +3 -2
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/NotFoundPage.d.ts +1 -0
- package/dist/lib/components/NotFoundPage.js +12 -0
- package/dist/lib/components/NotFoundPage.js.map +1 -0
- package/dist/lib/components/SyntaxHighlight.d.ts +3 -2
- package/dist/lib/components/SyntaxHighlight.js +21 -19
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +1 -1
- package/dist/lib/components/TopNavigation.js +4 -0
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/DevPortalProvider.d.ts +1 -1
- package/dist/lib/components/context/DevPortalProvider.js +2 -2
- package/dist/lib/components/context/DevPortalProvider.js.map +1 -1
- package/dist/lib/components/index.d.ts +28 -3
- package/dist/lib/components/index.js +17 -3
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +36 -6
- package/dist/lib/core/DevPortalContext.js +9 -6
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +7 -4
- package/dist/lib/core/plugins.js +1 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/errors/ErrorAlert.d.ts +3 -0
- package/dist/lib/errors/ErrorAlert.js +8 -0
- package/dist/lib/errors/ErrorAlert.js.map +1 -0
- package/dist/lib/errors/RouterError.d.ts +1 -0
- package/dist/lib/errors/RouterError.js +12 -0
- package/dist/lib/errors/RouterError.js.map +1 -0
- package/dist/lib/errors/ServerError.d.ts +3 -0
- package/dist/lib/errors/ServerError.js +6 -0
- package/dist/lib/errors/ServerError.js.map +1 -0
- package/dist/lib/errors/TopLevelError.d.ts +2 -0
- package/dist/lib/errors/TopLevelError.js +7 -0
- package/dist/lib/errors/TopLevelError.js.map +1 -0
- package/dist/lib/oas/graphql/index.js +1 -1
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/index.d.ts +1 -1
- package/dist/lib/oas/parser/index.js +38 -12
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.d.ts +4 -0
- package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.js +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.d.ts +4 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +39 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -0
- package/dist/lib/plugins/{api-key → api-keys}/index.d.ts +2 -3
- package/dist/lib/plugins/{api-key → api-keys}/index.js +15 -4
- package/dist/lib/plugins/api-keys/index.js.map +1 -0
- package/dist/lib/plugins/markdown/MdxPage.d.ts +3 -2
- package/dist/lib/plugins/markdown/MdxPage.js +7 -6
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/Toc.js +1 -1
- package/dist/lib/plugins/markdown/Toc.js.map +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.d.ts +3 -3
- package/dist/lib/plugins/markdown/generateRoutes.js +4 -4
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +4 -1
- package/dist/lib/plugins/markdown/index.js +3 -7
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +16 -5
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +10 -5
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/{MakeRequest.d.ts → PlaygroundDialogWrapper.d.ts} +1 -1
- package/dist/lib/plugins/openapi/{MakeRequest.js → PlaygroundDialogWrapper.js} +5 -5
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +1 -9
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Route.d.ts +6 -0
- package/dist/lib/plugins/openapi/Route.js +8 -0
- package/dist/lib/plugins/openapi/Route.js.map +1 -0
- package/dist/lib/plugins/openapi/SchemaListView.js +6 -27
- package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +7 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js +16 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.d.ts +8 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js +17 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js.map +1 -0
- package/dist/lib/plugins/openapi/Sidecar.js +10 -8
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/{Select.d.ts → SimpleSelect.d.ts} +3 -2
- package/dist/lib/plugins/openapi/SimpleSelect.js +5 -0
- package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.d.ts +12 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.js +46 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createServer.d.ts +4 -0
- package/dist/lib/plugins/openapi/client/createServer.js +30 -0
- package/dist/lib/plugins/openapi/client/createServer.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createWorkerClient.d.ts +10 -0
- package/dist/lib/plugins/openapi/{worker/createSharedWorkerClient.js → client/createWorkerClient.js} +15 -2
- package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/interfaces.d.ts +4 -0
- package/dist/lib/plugins/openapi/client/interfaces.js +2 -0
- package/dist/lib/plugins/openapi/client/interfaces.js.map +1 -0
- package/dist/lib/plugins/openapi/{worker → client}/worker.js +2 -2
- package/dist/lib/plugins/openapi/client/worker.js.map +1 -0
- package/dist/lib/plugins/openapi/context.d.ts +5 -0
- package/dist/lib/plugins/openapi/context.js +11 -0
- package/dist/lib/plugins/openapi/context.js.map +1 -0
- package/dist/lib/plugins/openapi/index.d.ts +4 -18
- package/dist/lib/plugins/openapi/index.js +35 -20
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +15 -0
- package/dist/lib/plugins/openapi/interfaces.js +2 -0
- package/dist/lib/plugins/openapi/interfaces.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/Headers.d.ts +2 -3
- package/dist/lib/plugins/openapi/playground/Headers.js +16 -6
- package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +4 -3
- package/dist/lib/plugins/openapi/playground/Playground.js +8 -12
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +3 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +10 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js +2 -1
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/createUrl.d.ts +1 -1
- package/dist/lib/plugins/openapi/util/prose.d.ts +1 -0
- package/dist/lib/plugins/openapi/util/prose.js +4 -0
- package/dist/lib/plugins/openapi/util/prose.js.map +1 -0
- package/dist/lib/plugins/openapi-worker.d.ts +1 -1
- package/dist/lib/plugins/openapi-worker.js +1 -1
- package/dist/lib/plugins/openapi-worker.js.map +1 -1
- package/dist/lib/plugins/redirect/index.d.ts +0 -1
- package/dist/lib/plugins/redirect/index.js +3 -4
- package/dist/lib/plugins/redirect/index.js.map +1 -1
- package/dist/lib/ui/Callout.js +2 -2
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/ui/button-variants.d.ts +1 -1
- package/dist/lib/util/MdxComponents.d.ts +2 -2
- package/dist/lib/util/MdxComponents.js +6 -4
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/groupBy.d.ts +1 -6
- package/dist/lib/util/groupBy.js +10 -8
- package/dist/lib/util/groupBy.js.map +1 -1
- package/dist/lib/util/logInit.d.ts +1 -0
- package/dist/lib/util/logInit.js +9 -0
- package/dist/lib/util/logInit.js.map +1 -0
- package/dist/lib/util/objectEntries.d.ts +4 -0
- package/dist/lib/util/objectEntries.js +2 -0
- package/dist/lib/util/objectEntries.js.map +1 -0
- package/dist/lib/util/renderIf.d.ts +1 -0
- package/dist/lib/util/renderIf.js +2 -0
- package/dist/lib/util/renderIf.js.map +1 -0
- package/dist/vite/build.js +26 -6
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +13 -12
- package/dist/vite/config.js +100 -55
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/config.test.js +7 -4
- package/dist/vite/config.test.js.map +1 -1
- package/dist/vite/dev-server.d.ts +2 -1
- package/dist/vite/dev-server.js +43 -15
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/html.js +18 -5
- package/dist/vite/html.js.map +1 -1
- package/dist/vite/plugin-api-keys.js +7 -8
- package/dist/vite/plugin-api-keys.js.map +1 -1
- package/dist/vite/plugin-api.js +9 -20
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-auth.js +5 -6
- package/dist/vite/plugin-auth.js.map +1 -1
- package/dist/vite/plugin-component.js +4 -2
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-config.d.ts +0 -2
- package/dist/vite/plugin-config.js +2 -13
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-custom-css.d.ts +6 -0
- package/dist/vite/plugin-custom-css.js +55 -0
- package/dist/vite/plugin-custom-css.js.map +1 -0
- package/dist/vite/plugin-docs.js +15 -5
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-docs.test.js +1 -1
- package/dist/vite/plugin-docs.test.js.map +1 -1
- package/dist/vite/plugin-mdx.d.ts +3 -1
- package/dist/vite/plugin-mdx.js +5 -5
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin-metadata.js +1 -1
- package/dist/vite/plugin-metadata.js.map +1 -1
- package/dist/vite/plugin-redirect.js +10 -10
- package/dist/vite/plugin-redirect.js.map +1 -1
- package/dist/vite/plugin.js +3 -5
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/prerender.d.ts +17 -0
- package/dist/vite/prerender.js +55 -0
- package/dist/vite/prerender.js.map +1 -0
- package/lib/AnchorLink-CZUp-F0P.js +705 -0
- package/lib/AnchorLink-CZUp-F0P.js.map +1 -0
- package/lib/DevPortalProvider-Do9oJqme.js +1081 -0
- package/lib/DevPortalProvider-Do9oJqme.js.map +1 -0
- package/lib/Markdown-Dbzrtopg.js +15030 -0
- package/lib/Markdown-Dbzrtopg.js.map +1 -0
- package/lib/MdxPage-JvboTsbK.js +190 -0
- package/lib/MdxPage-JvboTsbK.js.map +1 -0
- package/lib/OperationList-DGdaixGa.js +5562 -0
- package/lib/OperationList-DGdaixGa.js.map +1 -0
- package/lib/Route-C1LyvITr.js +13 -0
- package/lib/Route-C1LyvITr.js.map +1 -0
- package/lib/Select-DHm1jDdS.js +4571 -0
- package/lib/Select-DHm1jDdS.js.map +1 -0
- package/lib/Spinner-BSk0ImmP.js +182 -0
- package/lib/Spinner-BSk0ImmP.js.map +1 -0
- package/lib/_commonjsHelpers-BVfed4GL.js +29 -0
- package/lib/_commonjsHelpers-BVfed4GL.js.map +1 -0
- package/lib/assets/index-BPdJm2ty.js +1 -0
- package/lib/assets/index-BPdJm2ty.js.map +1 -0
- package/lib/assets/{worker-BCcpCNJ7.js → worker-BjPv-hjP.js} +10742 -10318
- package/lib/assets/worker-BjPv-hjP.js.map +1 -0
- package/lib/context-_fYfJFgk.js +14 -0
- package/lib/context-_fYfJFgk.js.map +1 -0
- package/lib/hook-DCYGmylw.js +77 -0
- package/lib/hook-DCYGmylw.js.map +1 -0
- package/lib/index-CXXn0D4E.js +412 -0
- package/lib/index-CXXn0D4E.js.map +1 -0
- package/lib/index-DSZ4Cj5q.js +725 -0
- package/lib/index-DSZ4Cj5q.js.map +1 -0
- package/lib/index-pI9JkN46.js +4765 -0
- package/lib/index-pI9JkN46.js.map +1 -0
- package/lib/jsx-runtime-CJZJivg2.js +1526 -0
- package/lib/jsx-runtime-CJZJivg2.js.map +1 -0
- package/lib/prism-bash.min-DadFsM4Z.js +1 -0
- package/lib/prism-bash.min-DadFsM4Z.js.map +1 -0
- package/lib/prism-csharp.min-Yizuc34Y.js +35 -0
- package/lib/prism-csharp.min-Yizuc34Y.js.map +1 -0
- package/lib/prism-java.min-d5iT_mOd.js +1 -0
- package/lib/prism-java.min-d5iT_mOd.js.map +1 -0
- package/lib/prism-json.min-B1GJqK1k.js +1 -0
- package/lib/prism-json.min-B1GJqK1k.js.map +1 -0
- package/lib/prism-markup-templating-DZrrEs0A.js +1 -0
- package/lib/prism-markup-templating-DZrrEs0A.js.map +1 -0
- package/lib/prism-objectivec.min-BXSWqpJJ.js +2 -0
- package/lib/prism-objectivec.min-BXSWqpJJ.js.map +1 -0
- package/lib/prism-php.min-o7FpoMP_.js +1 -0
- package/lib/prism-php.min-o7FpoMP_.js.map +1 -0
- package/lib/prism-ruby.min-C7LwcKyz.js +1 -0
- package/lib/prism-ruby.min-C7LwcKyz.js.map +1 -0
- package/lib/router-CBw2vqJE.js +2973 -0
- package/lib/router-CBw2vqJE.js.map +1 -0
- package/lib/slugify-CiPVjteN.js +28 -0
- package/lib/slugify-CiPVjteN.js.map +1 -0
- package/lib/state-D36MLDHk.js +289 -0
- package/lib/state-D36MLDHk.js.map +1 -0
- package/lib/urql-DMlBWUKL.js +1 -0
- package/lib/urql-DMlBWUKL.js.map +1 -0
- package/lib/util-_jwUlTBU.js +41 -0
- package/lib/util-_jwUlTBU.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +3 -1
- package/lib/zudoku.auth-auth0.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +11 -8
- package/lib/zudoku.auth-clerk.js.map +1 -0
- package/lib/zudoku.auth-openid.js +8 -4
- package/lib/zudoku.auth-openid.js.map +1 -0
- package/lib/zudoku.components.js +804 -447
- package/lib/zudoku.components.js.map +1 -0
- package/lib/zudoku.openapi-worker.js +15032 -146
- package/lib/zudoku.openapi-worker.js.map +1 -0
- package/lib/zudoku.plugin-api-keys.js +302 -0
- package/lib/zudoku.plugin-api-keys.js.map +1 -0
- package/lib/zudoku.plugin-markdown.js +49 -0
- package/lib/zudoku.plugin-markdown.js.map +1 -0
- package/lib/zudoku.plugin-openapi.js +10 -0
- package/lib/zudoku.plugin-openapi.js.map +1 -0
- package/lib/zudoku.plugin-redirect.js +11 -0
- package/lib/zudoku.plugin-redirect.js.map +1 -0
- package/package.json +37 -15
- package/src/app/App.tsx +0 -40
- package/src/app/demo-cdn.html +26 -0
- package/src/app/demo.html +18 -0
- package/src/app/demo.tsx +40 -0
- package/src/app/entry.client.tsx +47 -0
- package/src/app/entry.server.tsx +158 -0
- package/src/app/main.css +74 -0
- package/src/app/main.tsx +71 -15
- package/src/app/standalone.html +20 -0
- package/src/app/standalone.tsx +46 -0
- package/src/app/tailwind.ts +2 -6
- package/src/app/zudoku-manifest.ts +22 -0
- package/src/lib/authentication/Callback.tsx +1 -1
- package/src/lib/authentication/authentication.ts +2 -5
- package/src/lib/authentication/hook.ts +1 -0
- package/src/lib/authentication/providers/auth0.tsx +1 -0
- package/src/lib/authentication/providers/clerk.tsx +3 -0
- package/src/lib/authentication/providers/openid.tsx +3 -1
- package/src/lib/authentication/state.ts +2 -0
- package/src/lib/components/Bootstrap.tsx +37 -0
- package/src/lib/components/DevPortal.tsx +41 -56
- package/src/lib/components/ErrorPage.tsx +28 -0
- package/src/lib/components/Header.tsx +13 -7
- package/src/lib/components/Heading.tsx +26 -7
- package/src/lib/components/InlineCode.tsx +19 -0
- package/src/lib/components/Layout.tsx +9 -7
- package/src/lib/components/NotFoundPage.tsx +39 -0
- package/src/lib/components/SyntaxHighlight.tsx +27 -19
- package/src/lib/components/TopNavigation.tsx +5 -0
- package/src/lib/components/context/DevPortalProvider.ts +2 -2
- package/src/lib/components/index.ts +21 -3
- package/src/lib/core/DevPortalContext.ts +46 -17
- package/src/lib/core/plugins.ts +10 -5
- package/src/lib/errors/ErrorAlert.tsx +21 -0
- package/src/lib/errors/RouterError.tsx +13 -0
- package/src/lib/errors/ServerError.tsx +5 -0
- package/src/lib/errors/TopLevelError.tsx +8 -0
- package/src/lib/oas/graphql/index.ts +2 -2
- package/src/lib/oas/parser/index.ts +41 -20
- package/src/lib/plugins/{api-key → api-keys}/CreateApiKey.tsx +2 -8
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +139 -0
- package/src/lib/plugins/{api-key → api-keys}/index.tsx +22 -9
- package/src/lib/plugins/markdown/MdxPage.tsx +51 -34
- package/src/lib/plugins/markdown/Toc.tsx +1 -1
- package/src/lib/plugins/markdown/generateRoutes.tsx +16 -6
- package/src/lib/plugins/markdown/index.tsx +10 -7
- package/src/lib/plugins/openapi/OperationList.tsx +40 -4
- package/src/lib/plugins/openapi/OperationListItem.tsx +69 -42
- package/src/lib/plugins/openapi/ParameterList.tsx +1 -1
- package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
- package/src/lib/plugins/openapi/{MakeRequest.tsx → PlaygroundDialogWrapper.tsx} +4 -4
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +2 -16
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -1
- package/src/lib/plugins/openapi/Route.tsx +21 -0
- package/src/lib/plugins/openapi/SchemaListView.tsx +23 -192
- package/src/lib/plugins/openapi/SchemaListViewItem.tsx +110 -0
- package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +15 -10
- package/src/lib/plugins/openapi/{Select.tsx → SimpleSelect.tsx} +6 -3
- package/src/lib/plugins/openapi/client/createMemoryClient.ts +56 -0
- package/src/lib/plugins/openapi/client/createServer.ts +33 -0
- package/src/lib/plugins/openapi/{worker/createSharedWorkerClient.ts → client/createWorkerClient.ts} +21 -2
- package/src/lib/plugins/openapi/client/interfaces.ts +5 -0
- package/src/lib/plugins/openapi/{worker → client}/worker.ts +3 -3
- package/src/lib/plugins/openapi/context.tsx +16 -0
- package/src/lib/plugins/openapi/index.tsx +59 -52
- package/src/lib/plugins/openapi/interfaces.ts +9 -0
- package/src/lib/plugins/openapi/playground/Headers.tsx +60 -33
- package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
- package/src/lib/plugins/openapi/playground/Playground.tsx +158 -193
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +34 -0
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +7 -2
- package/src/lib/plugins/openapi/playground/createUrl.ts +1 -1
- package/src/lib/plugins/openapi/util/prose.ts +7 -0
- package/src/lib/plugins/openapi-worker.ts +1 -1
- package/src/lib/plugins/redirect/index.tsx +3 -4
- package/src/lib/ui/Callout.tsx +4 -4
- package/src/lib/util/MdxComponents.tsx +6 -14
- package/src/lib/util/groupBy.ts +7 -12
- package/src/lib/util/logInit.ts +9 -0
- package/src/lib/util/objectEntries.ts +5 -0
- package/src/lib/util/renderIf.ts +4 -0
- package/dist/lib/components/Link.d.ts +0 -1
- package/dist/lib/components/Link.js +0 -2
- package/dist/lib/components/Link.js.map +0 -1
- package/dist/lib/components/Router.d.ts +0 -4
- package/dist/lib/components/Router.js +0 -20
- package/dist/lib/components/Router.js.map +0 -1
- package/dist/lib/core/helmet.d.ts +0 -4
- package/dist/lib/core/helmet.js +0 -5
- package/dist/lib/core/helmet.js.map +0 -1
- package/dist/lib/core/icons.d.ts +0 -1
- package/dist/lib/core/icons.js +0 -2
- package/dist/lib/core/icons.js.map +0 -1
- package/dist/lib/core/router.d.ts +0 -1
- package/dist/lib/core/router.js +0 -2
- package/dist/lib/core/router.js.map +0 -1
- package/dist/lib/plugins/api-key/CreateApiKey.d.ts +0 -5
- package/dist/lib/plugins/api-key/CreateApiKey.js.map +0 -1
- package/dist/lib/plugins/api-key/SettingsApiKeys.d.ts +0 -5
- package/dist/lib/plugins/api-key/SettingsApiKeys.js +0 -37
- package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +0 -1
- package/dist/lib/plugins/api-key/index.js.map +0 -1
- package/dist/lib/plugins/index.d.ts +0 -4
- package/dist/lib/plugins/index.js +0 -5
- package/dist/lib/plugins/index.js.map +0 -1
- package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
- package/dist/lib/plugins/openapi/Select.js +0 -5
- package/dist/lib/plugins/openapi/Select.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -5
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +0 -1
- package/dist/lib/plugins/openapi/worker/shared-worker.js +0 -6
- package/dist/lib/plugins/openapi/worker/shared-worker.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/worker.js.map +0 -1
- package/dist/vite/common.d.ts +0 -1
- package/dist/vite/common.js +0 -5
- package/dist/vite/common.js.map +0 -1
- package/dist/vite/plugin-html.d.ts +0 -3
- package/dist/vite/plugin-html.js +0 -47
- package/dist/vite/plugin-html.js.map +0 -1
- package/dist/vite/plugin-openapi-worker.d.ts +0 -4
- package/dist/vite/plugin-openapi-worker.js +0 -28
- package/dist/vite/plugin-openapi-worker.js.map +0 -1
- package/lib/Spinner-DWHrSHMP.js +0 -8411
- package/lib/clerk-Wslx_mPo.js +0 -19685
- package/lib/index-DNx3xWa2.js +0 -3461
- package/lib/state-DfftBQ9X.js +0 -312
- package/lib/zudoku.plugins.js +0 -19873
- package/src/lib/components/Link.tsx +0 -1
- package/src/lib/components/Router.tsx +0 -28
- package/src/lib/core/helmet.ts +0 -5
- package/src/lib/core/icons.tsx +0 -1
- package/src/lib/core/router.tsx +0 -1
- package/src/lib/plugins/api-key/SettingsApiKeys.tsx +0 -122
- package/src/lib/plugins/index.ts +0 -4
- package/src/lib/plugins/openapi/worker/shared-worker.ts +0 -5
- /package/dist/lib/plugins/openapi/{worker → client}/worker.d.ts +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link
|
|
6
|
+
rel="icon"
|
|
7
|
+
type="image/svg+xml"
|
|
8
|
+
href="https://cdn.zudoku.dev/logos/icon.svg"
|
|
9
|
+
/>
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
11
|
+
<title>Zudoku Demo</title>
|
|
12
|
+
<script
|
|
13
|
+
type="module"
|
|
14
|
+
crossorigin
|
|
15
|
+
src="https://cdn.zudoku.dev/latest/demo.js"
|
|
16
|
+
></script>
|
|
17
|
+
<link
|
|
18
|
+
rel="stylesheet"
|
|
19
|
+
crossorigin
|
|
20
|
+
href="https://cdn.zudoku.dev/latest/style.css"
|
|
21
|
+
/>
|
|
22
|
+
</head>
|
|
23
|
+
<body>
|
|
24
|
+
<div id="root"></div>
|
|
25
|
+
</body>
|
|
26
|
+
</html>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link
|
|
6
|
+
rel="icon"
|
|
7
|
+
type="image/svg+xml"
|
|
8
|
+
href="https://cdn.zudoku.dev/logos/icon.svg"
|
|
9
|
+
/>
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
11
|
+
<title>Zudoku Demo</title>
|
|
12
|
+
<script type="module" crossorigin src="./demo.js"></script>
|
|
13
|
+
<link rel="stylesheet" crossorigin href="./style.css" />
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div id="root"></div>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
package/src/app/demo.tsx
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
|
|
4
|
+
// Styles
|
|
5
|
+
import "./main.css";
|
|
6
|
+
|
|
7
|
+
// Logger
|
|
8
|
+
import logger from "loglevel";
|
|
9
|
+
import "../lib/util/logInit.js";
|
|
10
|
+
|
|
11
|
+
// Base React Component
|
|
12
|
+
import { DevPortal } from "../lib/components/DevPortal.js";
|
|
13
|
+
|
|
14
|
+
// Plugins
|
|
15
|
+
import { openApiPlugin } from "../lib/plugins/openapi/index.js";
|
|
16
|
+
|
|
17
|
+
const apiUrl = new URL(window.location.href).searchParams.get("api-url");
|
|
18
|
+
logger.info(`API URL: ${apiUrl}`);
|
|
19
|
+
|
|
20
|
+
// IMPORTANT: This component must not contain tailwind classes
|
|
21
|
+
// This directory is not processed by the tailwind plugin
|
|
22
|
+
|
|
23
|
+
createRoot(document.getElementById("root")!).render(
|
|
24
|
+
<StrictMode>
|
|
25
|
+
<DevPortal
|
|
26
|
+
page={{
|
|
27
|
+
logo: "https://cdn.zudoku.dev/logos/icon.svg",
|
|
28
|
+
pageTitle: "Developer Portal",
|
|
29
|
+
}}
|
|
30
|
+
navigation={[
|
|
31
|
+
{
|
|
32
|
+
label: "API Reference",
|
|
33
|
+
path: "/demo",
|
|
34
|
+
categories: [],
|
|
35
|
+
},
|
|
36
|
+
]}
|
|
37
|
+
plugins={[openApiPlugin({ type: "url", input: apiUrl!, path: "/demo" })]}
|
|
38
|
+
/>
|
|
39
|
+
</StrictMode>,
|
|
40
|
+
);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { createRoot, hydrateRoot } from "react-dom/client";
|
|
2
|
+
import {
|
|
3
|
+
createBrowserRouter,
|
|
4
|
+
matchRoutes,
|
|
5
|
+
type RouteObject,
|
|
6
|
+
} from "react-router-dom";
|
|
7
|
+
import config from "virtual:zudoku-config";
|
|
8
|
+
import "virtual:zudoku-custom-css.css";
|
|
9
|
+
import { Bootstrap } from "zudoku/components";
|
|
10
|
+
import "./main.css";
|
|
11
|
+
import { getRoutesByConfig } from "./main.js";
|
|
12
|
+
|
|
13
|
+
const routes = getRoutesByConfig(config);
|
|
14
|
+
const root = document.getElementById("root")!;
|
|
15
|
+
|
|
16
|
+
if (root.childElementCount > 0) {
|
|
17
|
+
void hydrate(routes);
|
|
18
|
+
} else {
|
|
19
|
+
void render(routes);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
async function hydrateLazyRoutes(routes: RouteObject[]) {
|
|
23
|
+
const lazyMatches = matchRoutes(routes, window.location)?.filter(
|
|
24
|
+
(m) => m.route.lazy,
|
|
25
|
+
);
|
|
26
|
+
|
|
27
|
+
if (lazyMatches?.length) {
|
|
28
|
+
await Promise.all(
|
|
29
|
+
lazyMatches.map(async (m) => {
|
|
30
|
+
const routeModule = await m.route.lazy!();
|
|
31
|
+
Object.assign(m.route, { ...routeModule, lazy: undefined });
|
|
32
|
+
}),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function render(routes: RouteObject[]) {
|
|
38
|
+
const router = createBrowserRouter(routes);
|
|
39
|
+
createRoot(root).render(<Bootstrap router={router} />);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async function hydrate(routes: RouteObject[]) {
|
|
43
|
+
await hydrateLazyRoutes(routes);
|
|
44
|
+
const router = createBrowserRouter(routes);
|
|
45
|
+
|
|
46
|
+
hydrateRoot(root, <Bootstrap router={router} />);
|
|
47
|
+
}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { type HelmetData } from "@zudoku/react-helmet-async";
|
|
2
|
+
import type express from "express";
|
|
3
|
+
import logger from "loglevel";
|
|
4
|
+
import { Transform } from "node:stream";
|
|
5
|
+
import { renderToPipeableStream, renderToStaticMarkup } from "react-dom/server";
|
|
6
|
+
import { isRouteErrorResponse } from "react-router-dom";
|
|
7
|
+
import {
|
|
8
|
+
createStaticHandler,
|
|
9
|
+
createStaticRouter,
|
|
10
|
+
} from "react-router-dom/server.js";
|
|
11
|
+
import "virtual:zudoku-custom-css.css";
|
|
12
|
+
import { BootstrapStatic, ServerError } from "zudoku/components";
|
|
13
|
+
import type { ZudokuConfig } from "../config/config.js";
|
|
14
|
+
import type { FileWritingResponse } from "../vite/prerender.js";
|
|
15
|
+
import "./main.css";
|
|
16
|
+
import { getRoutesByConfig } from "./main.js";
|
|
17
|
+
|
|
18
|
+
export const render = async ({
|
|
19
|
+
template,
|
|
20
|
+
request: baseRequest,
|
|
21
|
+
response,
|
|
22
|
+
config,
|
|
23
|
+
}: {
|
|
24
|
+
template: string;
|
|
25
|
+
request: express.Request | Request;
|
|
26
|
+
response: express.Response | FileWritingResponse;
|
|
27
|
+
config: ZudokuConfig;
|
|
28
|
+
}) => {
|
|
29
|
+
const routes = getRoutesByConfig(config);
|
|
30
|
+
const { query, dataRoutes } = createStaticHandler(routes);
|
|
31
|
+
|
|
32
|
+
const request =
|
|
33
|
+
baseRequest instanceof Request
|
|
34
|
+
? baseRequest
|
|
35
|
+
: createFetchRequest(baseRequest, response);
|
|
36
|
+
|
|
37
|
+
if (!request) {
|
|
38
|
+
throw new Error("Either fetchRequest or expressRequest must be provided");
|
|
39
|
+
}
|
|
40
|
+
const context = await query(request);
|
|
41
|
+
let status = 200;
|
|
42
|
+
|
|
43
|
+
if (context instanceof Response) {
|
|
44
|
+
if ([301, 302, 303, 307, 308].includes(context.status)) {
|
|
45
|
+
return response.redirect(
|
|
46
|
+
context.status,
|
|
47
|
+
context.headers.get("Location")!,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
throw context;
|
|
52
|
+
} else if (context.errors) {
|
|
53
|
+
// when throwing a Response from a loader it will be caught here
|
|
54
|
+
// unfortunately it is not `instanceof Response` for some reason
|
|
55
|
+
const firstError = Object.values(context.errors).find(isRouteErrorResponse);
|
|
56
|
+
|
|
57
|
+
if (firstError?.status) {
|
|
58
|
+
status = firstError.status;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const router = createStaticRouter(dataRoutes, context);
|
|
63
|
+
const helmetContext = {} as HelmetData["context"];
|
|
64
|
+
|
|
65
|
+
const { pipe } = renderToPipeableStream(
|
|
66
|
+
<BootstrapStatic
|
|
67
|
+
router={router}
|
|
68
|
+
context={context}
|
|
69
|
+
helmetContext={helmetContext}
|
|
70
|
+
/>,
|
|
71
|
+
{
|
|
72
|
+
onShellError(error) {
|
|
73
|
+
response.status(500);
|
|
74
|
+
response.set({ "Content-Type": "text/html" });
|
|
75
|
+
|
|
76
|
+
const html = renderToStaticMarkup(<ServerError error={error} />);
|
|
77
|
+
|
|
78
|
+
response.send(html);
|
|
79
|
+
},
|
|
80
|
+
// for SSG we could use onAllReady instead of onShellReady
|
|
81
|
+
// https://react.dev/reference/react-dom/server/renderToPipeableStream#waiting-for-all-content-to-load-for-crawlers-and-static-generation
|
|
82
|
+
onShellReady() {
|
|
83
|
+
response.set({ "Content-Type": "text/html" });
|
|
84
|
+
response.status(status);
|
|
85
|
+
|
|
86
|
+
const transformStream = new Transform({
|
|
87
|
+
transform(chunk, encoding, callback) {
|
|
88
|
+
response.write(chunk, encoding);
|
|
89
|
+
callback();
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
const [htmlStart, htmlEnd] = template.split("<!--app-html-->");
|
|
94
|
+
|
|
95
|
+
response.write(
|
|
96
|
+
htmlStart.replace(
|
|
97
|
+
"<!--app-helmet-->",
|
|
98
|
+
[
|
|
99
|
+
helmetContext.helmet.title.toString(),
|
|
100
|
+
helmetContext.helmet.meta.toString(),
|
|
101
|
+
helmetContext.helmet.link.toString(),
|
|
102
|
+
helmetContext.helmet.style.toString(),
|
|
103
|
+
helmetContext.helmet.script.toString(),
|
|
104
|
+
].join("\n"),
|
|
105
|
+
),
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
transformStream.on("finish", () => {
|
|
109
|
+
response.end(htmlEnd);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
pipe(transformStream);
|
|
113
|
+
},
|
|
114
|
+
onError(error) {
|
|
115
|
+
status = 500;
|
|
116
|
+
logger.error(error);
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export function createFetchRequest(
|
|
123
|
+
req: express.Request,
|
|
124
|
+
res: express.Response | FileWritingResponse,
|
|
125
|
+
): Request {
|
|
126
|
+
const origin = `${req.protocol}://${req.get("host")}`;
|
|
127
|
+
// Note: This had to take originalUrl into account for presumably vite's proxying
|
|
128
|
+
const url = new URL(req.originalUrl || req.url, origin);
|
|
129
|
+
|
|
130
|
+
const controller = new AbortController();
|
|
131
|
+
res.on("close", () => controller.abort());
|
|
132
|
+
|
|
133
|
+
const headers = new Headers();
|
|
134
|
+
|
|
135
|
+
for (const [key, values] of Object.entries(req.headers)) {
|
|
136
|
+
if (values) {
|
|
137
|
+
if (Array.isArray(values)) {
|
|
138
|
+
for (const value of values) {
|
|
139
|
+
headers.append(key, value);
|
|
140
|
+
}
|
|
141
|
+
} else {
|
|
142
|
+
headers.set(key, values);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const init: RequestInit = {
|
|
148
|
+
method: req.method,
|
|
149
|
+
headers,
|
|
150
|
+
signal: controller.signal,
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
if (req.method !== "GET" && req.method !== "HEAD") {
|
|
154
|
+
init.body = req.body;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return new Request(url.href, init);
|
|
158
|
+
}
|
package/src/app/main.css
CHANGED
|
@@ -2,6 +2,80 @@
|
|
|
2
2
|
@tailwind components;
|
|
3
3
|
@tailwind utilities;
|
|
4
4
|
|
|
5
|
+
@font-face {
|
|
6
|
+
font-family: Geist;
|
|
7
|
+
font-style: normal;
|
|
8
|
+
font-weight: 100;
|
|
9
|
+
font-display: swap;
|
|
10
|
+
src: url("https://cdn.zudoku.dev/geist/Geist-Thin.woff2") format("woff2");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@font-face {
|
|
14
|
+
font-family: Geist;
|
|
15
|
+
font-style: normal;
|
|
16
|
+
font-weight: 200;
|
|
17
|
+
font-display: swap;
|
|
18
|
+
src: url("https://cdn.zudoku.dev/geist/Geist-UltraLight.woff2")
|
|
19
|
+
format("woff2");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@font-face {
|
|
23
|
+
font-family: Geist;
|
|
24
|
+
font-style: normal;
|
|
25
|
+
font-weight: 300;
|
|
26
|
+
font-display: swap;
|
|
27
|
+
src: url("https://cdn.zudoku.dev/geist/Geist-Light.woff2") format("woff2");
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@font-face {
|
|
31
|
+
font-family: Geist;
|
|
32
|
+
font-style: normal;
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
font-display: swap;
|
|
35
|
+
src: url("https://cdn.zudoku.dev/geist/Geist-Regular.woff2") format("woff2");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@font-face {
|
|
39
|
+
font-family: Geist;
|
|
40
|
+
font-style: normal;
|
|
41
|
+
font-weight: 500;
|
|
42
|
+
font-display: swap;
|
|
43
|
+
src: url("https://cdn.zudoku.dev/geist/Geist-Medium.woff2") format("woff2");
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
@font-face {
|
|
47
|
+
font-family: Geist;
|
|
48
|
+
font-style: normal;
|
|
49
|
+
font-weight: 600;
|
|
50
|
+
font-display: swap;
|
|
51
|
+
src: url("https://cdn.zudoku.dev/geist/Geist-SemiBold.woff2") format("woff2");
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@font-face {
|
|
55
|
+
font-family: Geist;
|
|
56
|
+
font-style: normal;
|
|
57
|
+
font-weight: 700;
|
|
58
|
+
font-display: swap;
|
|
59
|
+
src: url("https://cdn.zudoku.dev/geist/Geist-Bold.woff2") format("woff2");
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@font-face {
|
|
63
|
+
font-family: Geist;
|
|
64
|
+
font-style: normal;
|
|
65
|
+
font-weight: 800;
|
|
66
|
+
font-display: swap;
|
|
67
|
+
src: url("https://cdn.zudoku.dev/geist/Geist-Black.woff2") format("woff2");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@font-face {
|
|
71
|
+
font-family: Geist;
|
|
72
|
+
font-style: normal;
|
|
73
|
+
font-weight: 900;
|
|
74
|
+
font-display: swap;
|
|
75
|
+
src: url("https://cdn.zudoku.dev/geist/Geist-UltraBlack.woff2")
|
|
76
|
+
format("woff2");
|
|
77
|
+
}
|
|
78
|
+
|
|
5
79
|
@layer base {
|
|
6
80
|
:root {
|
|
7
81
|
--top-header-height: 65px;
|
package/src/app/main.tsx
CHANGED
|
@@ -1,18 +1,74 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
import { type RouteObject } from "react-router-dom";
|
|
2
|
+
import { configuredApiKeysPlugin } from "virtual:zudoku-api-keys-plugin";
|
|
3
|
+
import { configuredApiPlugins } from "virtual:zudoku-api-plugins";
|
|
4
|
+
import { configuredAuthProvider } from "virtual:zudoku-auth";
|
|
5
|
+
import "virtual:zudoku-custom-css.css";
|
|
6
|
+
import { configuredDocsPlugins } from "virtual:zudoku-docs-plugins";
|
|
7
|
+
import { configuredRedirectPlugin } from "virtual:zudoku-redirect-plugin";
|
|
8
|
+
import { DevPortal, Layout, RouterError } from "zudoku/components";
|
|
9
|
+
import { isNavigationPlugin } from "zudoku/internal";
|
|
10
|
+
import type { ZudokuConfig } from "../config/config.js";
|
|
11
|
+
import type { ZudokuContextOptions } from "../lib/core/DevPortalContext.js";
|
|
5
12
|
|
|
6
|
-
|
|
13
|
+
export const convertZudokuConfigToOptions = (
|
|
14
|
+
config: ZudokuConfig,
|
|
15
|
+
): ZudokuContextOptions => {
|
|
16
|
+
return {
|
|
17
|
+
page: {
|
|
18
|
+
logo: config.page?.logo ?? "https://cdn.zudoku.dev/logos/icon.svg",
|
|
19
|
+
pageTitle: "Developer Portal",
|
|
20
|
+
...config.page,
|
|
21
|
+
},
|
|
22
|
+
metadata: {
|
|
23
|
+
favicon: "https://cdn.zudoku.dev/logos/icon.svg",
|
|
24
|
+
title: "%s | Developer Portal",
|
|
25
|
+
...config.metadata,
|
|
26
|
+
},
|
|
27
|
+
mdxComponents: config.mdx?.components,
|
|
28
|
+
navigation: config.navigation ?? [],
|
|
29
|
+
authentication: configuredAuthProvider,
|
|
30
|
+
plugins: [
|
|
31
|
+
...configuredDocsPlugins,
|
|
32
|
+
...configuredApiPlugins,
|
|
33
|
+
...(configuredRedirectPlugin ? [configuredRedirectPlugin] : []),
|
|
34
|
+
...(configuredApiKeysPlugin ? [configuredApiKeysPlugin] : []),
|
|
35
|
+
...(configuredAuthProvider ? [configuredAuthProvider] : []),
|
|
36
|
+
],
|
|
37
|
+
};
|
|
38
|
+
};
|
|
7
39
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
} else if (localStorage.getItem("ENABLE_DEBUG_LOGS")) {
|
|
11
|
-
log.setLevel("debug");
|
|
12
|
-
}
|
|
40
|
+
export const getRoutesByConfig = (config: ZudokuConfig): RouteObject[] => {
|
|
41
|
+
const options = convertZudokuConfigToOptions(config);
|
|
13
42
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
43
|
+
const allPlugins = [
|
|
44
|
+
...(options.plugins ? options.plugins : []),
|
|
45
|
+
...(options.authentication ? [options.authentication] : []),
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
const routes = allPlugins
|
|
49
|
+
.flatMap((plugin) => (isNavigationPlugin(plugin) ? plugin.getRoutes() : []))
|
|
50
|
+
.concat({
|
|
51
|
+
path: "*",
|
|
52
|
+
loader: () => {
|
|
53
|
+
throw new Response("Not Found", { status: 404 });
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
return [
|
|
58
|
+
{
|
|
59
|
+
element: (
|
|
60
|
+
<DevPortal {...options}>
|
|
61
|
+
<Layout />
|
|
62
|
+
</DevPortal>
|
|
63
|
+
),
|
|
64
|
+
errorElement: (
|
|
65
|
+
<DevPortal {...options}>
|
|
66
|
+
<Layout>
|
|
67
|
+
<RouterError />
|
|
68
|
+
</Layout>
|
|
69
|
+
</DevPortal>
|
|
70
|
+
),
|
|
71
|
+
children: routes,
|
|
72
|
+
},
|
|
73
|
+
];
|
|
74
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link
|
|
6
|
+
rel="icon"
|
|
7
|
+
type="image/svg+xml"
|
|
8
|
+
href="https://cdn.zudoku.dev/logos/icon.svg"
|
|
9
|
+
/>
|
|
10
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
11
|
+
<title>Dev Portal</title>
|
|
12
|
+
<script type="module" crossorigin src="./main.js"></script>
|
|
13
|
+
<link rel="stylesheet" crossorigin href="./style.css" />
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div
|
|
17
|
+
data-api-url="https://blue-sloth-main-afc3428.d2.zuplo.dev/schemas/rewiring-america"
|
|
18
|
+
></div>
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { StrictMode } from "react";
|
|
2
|
+
import { createRoot } from "react-dom/client";
|
|
3
|
+
|
|
4
|
+
// Styles
|
|
5
|
+
import "./main.css";
|
|
6
|
+
|
|
7
|
+
// Logger
|
|
8
|
+
import "../lib/util/logInit.js";
|
|
9
|
+
|
|
10
|
+
// Base React Component
|
|
11
|
+
import { DevPortal } from "../lib/components/DevPortal.js";
|
|
12
|
+
|
|
13
|
+
// Plugins
|
|
14
|
+
import { openApiPlugin } from "../lib/plugins/openapi/index.js";
|
|
15
|
+
|
|
16
|
+
const root = document.querySelector("[data-api-url]");
|
|
17
|
+
if (!root || root.tagName !== "DIV") {
|
|
18
|
+
throw new Error("No div found with attribute data-api-url");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const apiUrl = root.getAttribute("data-api-url");
|
|
22
|
+
const pageTitle = document.getElementsByTagName("title")[0].innerText;
|
|
23
|
+
const logoUrl = root.getAttribute("data-logo-url");
|
|
24
|
+
|
|
25
|
+
// IMPORTANT: This component must not contain tailwind classes
|
|
26
|
+
// This directory is not processed by the tailwind plugin
|
|
27
|
+
|
|
28
|
+
createRoot(root).render(
|
|
29
|
+
<StrictMode>
|
|
30
|
+
<DevPortal
|
|
31
|
+
page={{
|
|
32
|
+
logo: logoUrl ?? "https://cdn.zudoku.dev/logos/icon.svg",
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
34
|
+
pageTitle: pageTitle ?? "Developer Portal",
|
|
35
|
+
}}
|
|
36
|
+
navigation={[
|
|
37
|
+
{
|
|
38
|
+
label: "API Reference",
|
|
39
|
+
path: "/",
|
|
40
|
+
categories: [],
|
|
41
|
+
},
|
|
42
|
+
]}
|
|
43
|
+
plugins={[openApiPlugin({ type: "url", input: apiUrl!, path: "/" })]}
|
|
44
|
+
/>
|
|
45
|
+
</StrictMode>,
|
|
46
|
+
);
|
package/src/app/tailwind.ts
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import typographyPlugin from "@tailwindcss/typography";
|
|
2
2
|
import type { Config } from "tailwindcss";
|
|
3
3
|
import defaultTheme from "tailwindcss/defaultTheme.js";
|
|
4
|
+
|
|
4
5
|
const content = [
|
|
5
6
|
"./src/**/*.{js,ts,jsx,tsx,md,mdx}",
|
|
6
7
|
"./node_modules/zudoku/dist/**/*.{js,ts,jsx,tsx,md,mdx}",
|
|
7
8
|
];
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
// if (process.env.NODE_ENV === "development") {
|
|
11
|
-
// content.push("../../plugins/*/src/**/*.{js,ts,jsx,tsx}");
|
|
12
|
-
// }
|
|
13
|
-
|
|
14
|
-
const config: Config = {
|
|
10
|
+
const config: Omit<Config, "content"> = {
|
|
15
11
|
darkMode: "selector",
|
|
16
12
|
content,
|
|
17
13
|
theme: {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { RouteObject } from "react-router-dom";
|
|
2
|
+
import config from "virtual:zudoku-config";
|
|
3
|
+
import { getRoutesByConfig } from "./main.js";
|
|
4
|
+
|
|
5
|
+
const routes = getRoutesByConfig(config);
|
|
6
|
+
|
|
7
|
+
const flattenPaths = (routes: RouteObject[], basePath = "") => {
|
|
8
|
+
return routes.reduce<string[]>((acc, route) => {
|
|
9
|
+
if (route.path) {
|
|
10
|
+
const fullPath = `${basePath}/${route.path}`.replace(/\/+/g, "/");
|
|
11
|
+
route.path !== "/" && acc.push(fullPath);
|
|
12
|
+
if (route.children) {
|
|
13
|
+
acc = acc.concat(flattenPaths(route.children, fullPath));
|
|
14
|
+
}
|
|
15
|
+
} else if (route.children) {
|
|
16
|
+
acc = acc.concat(flattenPaths(route.children, basePath));
|
|
17
|
+
}
|
|
18
|
+
return acc;
|
|
19
|
+
}, []);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const paths = flattenPaths(routes);
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
InitializationPlugin,
|
|
3
|
-
NavigationPlugin,
|
|
4
|
-
} from "../../lib/core/plugins.js";
|
|
1
|
+
import { CommonPlugin, NavigationPlugin } from "../core/plugins.js";
|
|
5
2
|
|
|
6
|
-
type AuthenticationPlugin = NavigationPlugin &
|
|
3
|
+
type AuthenticationPlugin = NavigationPlugin & CommonPlugin;
|
|
7
4
|
|
|
8
5
|
export interface AuthenticationProvider extends AuthenticationPlugin {
|
|
9
6
|
login(): Promise<void>;
|
|
@@ -9,6 +9,7 @@ const clerkAuth: AuthenticationProviderInitializer<
|
|
|
9
9
|
let clerkApi: Clerk;
|
|
10
10
|
|
|
11
11
|
const ensureLoaded = (async () => {
|
|
12
|
+
if (import.meta.env.SSR) return;
|
|
12
13
|
const { Clerk } = await import("@clerk/clerk-js");
|
|
13
14
|
clerkApi = new Clerk(clerkPubKey);
|
|
14
15
|
|
|
@@ -34,6 +35,7 @@ const clerkAuth: AuthenticationProviderInitializer<
|
|
|
34
35
|
if (clerkApi.session) {
|
|
35
36
|
useAuthState.setState({
|
|
36
37
|
isAuthenticated: true,
|
|
38
|
+
isPending: false,
|
|
37
39
|
profile: {
|
|
38
40
|
sub: clerkApi.session.user.id,
|
|
39
41
|
name: clerkApi.session.user.fullName ?? undefined,
|
|
@@ -46,6 +48,7 @@ const clerkAuth: AuthenticationProviderInitializer<
|
|
|
46
48
|
} else {
|
|
47
49
|
useAuthState.setState({
|
|
48
50
|
isAuthenticated: false,
|
|
51
|
+
isPending: false,
|
|
49
52
|
profile: undefined,
|
|
50
53
|
});
|
|
51
54
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logger from "loglevel";
|
|
2
2
|
import * as oauth from "oauth4webapi";
|
|
3
|
+
import type { RouteObject } from "react-router-dom";
|
|
3
4
|
import { OpenIDAuthenticationConfig } from "../../../config/config.js";
|
|
4
|
-
import { RouteObject } from "../../core/router.js";
|
|
5
5
|
import {
|
|
6
6
|
AuthenticationProvider,
|
|
7
7
|
AuthenticationProviderInitializer,
|
|
@@ -180,6 +180,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
180
180
|
async logout(): Promise<void> {
|
|
181
181
|
useAuthState.setState({
|
|
182
182
|
isAuthenticated: false,
|
|
183
|
+
isPending: false,
|
|
183
184
|
profile: undefined,
|
|
184
185
|
});
|
|
185
186
|
|
|
@@ -293,6 +294,7 @@ export class OpenIDAuthenticationProvider implements AuthenticationProvider {
|
|
|
293
294
|
|
|
294
295
|
useAuthState.setState({
|
|
295
296
|
isAuthenticated: true,
|
|
297
|
+
isPending: false,
|
|
296
298
|
profile,
|
|
297
299
|
});
|
|
298
300
|
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { create } from "zustand";
|
|
2
2
|
|
|
3
3
|
export const useAuthState = create<AuthState>(() => ({
|
|
4
|
+
isPending: true,
|
|
4
5
|
isAuthenticated: false,
|
|
5
6
|
}));
|
|
6
7
|
|
|
7
8
|
export interface AuthState {
|
|
8
9
|
isAuthenticated: boolean;
|
|
10
|
+
isPending: boolean;
|
|
9
11
|
profile?: UserProfile;
|
|
10
12
|
}
|
|
11
13
|
|