zudoku 0.0.0-fd0986c → 0.0.0-fdf886de
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 +1 -1
- package/dist/app/entry.client.js +1 -1
- package/dist/app/entry.server.js +1 -1
- package/dist/app/main.d.ts +1 -1
- package/dist/app/main.js +12 -6
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js +1 -1
- package/dist/config/config.d.ts +1 -0
- package/dist/config/validators/InputNavigationSchema.d.ts +251 -156
- package/dist/config/validators/InputNavigationSchema.js +5 -4
- package/dist/config/validators/InputNavigationSchema.js.map +1 -1
- package/dist/config/validators/InputNavigationSchema.test-d.js +0 -1
- package/dist/config/validators/InputNavigationSchema.test-d.js.map +1 -1
- package/dist/config/validators/NavigationSchema.js +6 -3
- package/dist/config/validators/NavigationSchema.js.map +1 -1
- package/dist/config/validators/ProtectedRoutesSchema.d.ts +13 -0
- package/dist/config/validators/ProtectedRoutesSchema.js +10 -0
- package/dist/config/validators/ProtectedRoutesSchema.js.map +1 -0
- package/dist/config/validators/icon-types.d.ts +1 -1
- package/dist/config/validators/icon-types.js +16 -0
- package/dist/config/validators/icon-types.js.map +1 -1
- package/dist/config/validators/validate.d.ts +44 -30
- package/dist/config/validators/validate.js +8 -2
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/flat-config.d.ts +11 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/authentication/components/CallbackHandler.js +11 -9
- package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
- package/dist/lib/authentication/components/OAuthErrorPage.d.ts +3 -0
- package/dist/lib/authentication/components/OAuthErrorPage.js +99 -0
- package/dist/lib/authentication/components/OAuthErrorPage.js.map +1 -0
- package/dist/lib/authentication/errors.d.ts +6 -12
- package/dist/lib/authentication/errors.js +2 -1
- package/dist/lib/authentication/errors.js.map +1 -1
- package/dist/lib/authentication/hook.d.ts +1 -0
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/azureb2c.js +4 -2
- package/dist/lib/authentication/providers/azureb2c.js.map +1 -1
- package/dist/lib/authentication/providers/clerk.js +4 -2
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/openid.js +3 -1
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/components/BuildCheck.d.ts +2 -1
- package/dist/lib/components/BuildCheck.js +9 -3
- package/dist/lib/components/BuildCheck.js.map +1 -1
- package/dist/lib/components/Header.js +1 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.js +1 -1
- package/dist/lib/components/Heading.js.map +1 -1
- package/dist/lib/components/Layout.js +4 -7
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/Markdown.js +2 -2
- package/dist/lib/components/Markdown.js.map +1 -1
- package/dist/lib/components/Meta.d.ts +2 -0
- package/dist/lib/components/Meta.js +11 -0
- package/dist/lib/components/Meta.js.map +1 -0
- package/dist/lib/components/MobileTopNavigation.js +5 -3
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/NotFoundPage.js +1 -1
- package/dist/lib/components/NotFoundPage.js.map +1 -1
- package/dist/lib/components/TopNavigation.js +4 -3
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/Typography.d.ts +1 -1
- package/dist/lib/components/Typography.js +1 -1
- package/dist/lib/components/Typography.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.js +22 -14
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/index.d.ts +0 -27
- package/dist/lib/components/index.js +0 -15
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/NavigationCategory.js +1 -1
- package/dist/lib/components/navigation/NavigationCategory.js.map +1 -1
- package/dist/lib/components/navigation/NavigationItem.d.ts +1 -1
- package/dist/lib/components/navigation/NavigationItem.js +11 -3
- package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
- package/dist/lib/components/navigation/utils.d.ts +3 -1
- package/dist/lib/components/navigation/utils.js +18 -14
- package/dist/lib/components/navigation/utils.js.map +1 -1
- package/dist/lib/core/RouteGuard.js +9 -9
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/core/ZudokuContext.d.ts +5 -1
- package/dist/lib/core/ZudokuContext.js +23 -1
- package/dist/lib/core/ZudokuContext.js.map +1 -1
- package/dist/lib/core/__internal.d.ts +37 -0
- package/dist/lib/core/__internal.js +26 -0
- package/dist/lib/core/__internal.js.map +1 -0
- package/dist/lib/core/plugins.d.ts +2 -1
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/core/router.d.ts +1 -0
- package/dist/lib/core/router.js +2 -0
- package/dist/lib/core/router.js.map +1 -0
- package/dist/lib/errors/ErrorAlert.js +1 -1
- package/dist/lib/errors/ErrorAlert.js.map +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js +13 -3
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +3 -1
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.d.ts +9 -4
- package/dist/lib/plugins/api-keys/index.js +3 -7
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/custom-pages/index.js +3 -0
- package/dist/lib/plugins/custom-pages/index.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SidecarExamples.js +1 -1
- package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.d.ts +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.js +1 -1
- package/dist/lib/plugins/openapi/graphql/gql.js.map +1 -1
- package/dist/lib/plugins/openapi/graphql/graphql.d.ts +1 -0
- package/dist/lib/plugins/openapi/graphql/graphql.js +1 -0
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +42 -10
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.js +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.js +4 -2
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/shiki.d.ts +4 -0
- package/dist/lib/shiki.js +2 -0
- package/dist/lib/shiki.js.map +1 -1
- package/dist/lib/ui/ActionButton.js +1 -1
- package/dist/lib/ui/ActionButton.js.map +1 -1
- package/dist/lib/ui/Badge.d.ts +1 -1
- package/dist/lib/ui/Button.d.ts +2 -2
- package/dist/lib/ui/CodeBlock.js +30 -4
- package/dist/lib/ui/CodeBlock.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +1 -1
- package/dist/lib/ui/Dialog.js +2 -2
- package/dist/lib/ui/Dialog.js.map +1 -1
- package/dist/lib/ui/EmbeddedCodeBlock.js +1 -1
- package/dist/lib/ui/EmbeddedCodeBlock.js.map +1 -1
- package/dist/lib/util/invariant.d.ts +6 -5
- package/dist/lib/util/invariant.js +1 -1
- package/dist/lib/util/invariant.js.map +1 -1
- package/dist/vite/config.js +6 -1
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.js +9 -1
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/mdx/remark-inject-filepath.d.ts +3 -0
- package/dist/vite/mdx/remark-inject-filepath.js +6 -0
- package/dist/vite/mdx/remark-inject-filepath.js.map +1 -0
- package/dist/vite/mdx/remark-link-rewrite.d.ts +2 -0
- package/dist/vite/mdx/remark-link-rewrite.js +20 -0
- package/dist/vite/mdx/remark-link-rewrite.js.map +1 -0
- package/dist/vite/mdx/remark-normalize-image-url.d.ts +2 -0
- package/dist/vite/mdx/remark-normalize-image-url.js +12 -0
- package/dist/vite/mdx/remark-normalize-image-url.js.map +1 -0
- package/dist/vite/{remarkStaticGeneration.d.ts → mdx/remark-static-generation.d.ts} +2 -2
- package/dist/vite/{remarkStaticGeneration.js → mdx/remark-static-generation.js} +1 -1
- package/dist/vite/mdx/remark-static-generation.js.map +1 -0
- package/dist/vite/plugin-config.d.ts +1 -1
- package/dist/vite/plugin-config.js +2 -1
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-docs.js +18 -13
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-mdx.js +6 -23
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin-theme.js +80 -40
- package/dist/vite/plugin-theme.js.map +1 -1
- package/dist/vite/prerender/worker.js +5 -1
- package/dist/vite/prerender/worker.js.map +1 -1
- package/dist/vite/shadcn-registry.d.ts +4 -4
- package/dist/vite/sitemap.js +10 -9
- package/dist/vite/sitemap.js.map +1 -1
- package/lib/Button-B3o-2Xdf.js.map +1 -1
- package/lib/Card-CMDQUPM4.js.map +1 -1
- package/lib/CategoryHeading-DCpZu3yG.js +17 -0
- package/lib/CategoryHeading-DCpZu3yG.js.map +1 -0
- package/lib/ClientOnly-E7hGysn1.js.map +1 -1
- package/lib/CodeBlock-yJjjRwj-.js +98 -0
- package/lib/CodeBlock-yJjjRwj-.js.map +1 -0
- package/lib/{Command-C9AC5cf-.js → Command-CDn17s8X.js} +2 -2
- package/lib/{Command-C9AC5cf-.js.map → Command-CDn17s8X.js.map} +1 -1
- package/lib/Dialog-BrIjMmUK.js +114 -0
- package/lib/Dialog-BrIjMmUK.js.map +1 -0
- package/lib/{Drawer-DXGPOKPx.js → Drawer-DJ05s2pH.js} +86 -86
- package/lib/{Drawer-DXGPOKPx.js.map → Drawer-DJ05s2pH.js.map} +1 -1
- package/lib/{MdxPage-BI0vLjSn.js → MdxPage-BmOQ5m5g.js} +19 -18
- package/lib/{MdxPage-BI0vLjSn.js.map → MdxPage-BmOQ5m5g.js.map} +1 -1
- package/lib/OAuthErrorPage-Jv3r8wnL.js +150 -0
- package/lib/OAuthErrorPage-Jv3r8wnL.js.map +1 -0
- package/lib/{OasProvider-CK4C2QI3.js → OasProvider-CA_lpILt.js} +3 -3
- package/lib/{OasProvider-CK4C2QI3.js.map → OasProvider-CA_lpILt.js.map} +1 -1
- package/lib/{OperationList-DhA6x6qm.js → OperationList-C-TObVw6.js} +47 -44
- package/lib/OperationList-C-TObVw6.js.map +1 -0
- package/lib/{Pagination-YjKVdgm9.js → Pagination-CBiRGddW.js} +3 -3
- package/lib/{Pagination-YjKVdgm9.js.map → Pagination-CBiRGddW.js.map} +1 -1
- package/lib/RouteGuard-JLH6tCY8.js +56 -0
- package/lib/RouteGuard-JLH6tCY8.js.map +1 -0
- package/lib/RouterError-DcVonMP1.js +41 -0
- package/lib/RouterError-DcVonMP1.js.map +1 -0
- package/lib/{SchemaList-Cx9MS7Wf.js → SchemaList-BeYWvBC7.js} +15 -14
- package/lib/{SchemaList-Cx9MS7Wf.js.map → SchemaList-BeYWvBC7.js.map} +1 -1
- package/lib/{SchemaView-C6sTKWyS.js → SchemaView-CRcShewo.js} +4 -4
- package/lib/{SchemaView-C6sTKWyS.js.map → SchemaView-CRcShewo.js.map} +1 -1
- package/lib/Select-C3efYI1n.js +273 -0
- package/lib/Select-C3efYI1n.js.map +1 -0
- package/lib/{SignUp-DiDmVb3x.js → SignUp-CxBGHgba.js} +6 -6
- package/lib/{SignUp-DiDmVb3x.js.map → SignUp-CxBGHgba.js.map} +1 -1
- package/lib/{Slot-CrCBhP3G.js → Slot-DOtTvoyj.js} +2050 -2288
- package/lib/{Slot-CrCBhP3G.js.map → Slot-DOtTvoyj.js.map} +1 -1
- package/lib/Spinner-mNLZ6awP.js.map +1 -1
- package/lib/{SyntaxHighlight-CVe58ZSY.js → SyntaxHighlight-GR0eix_L.js} +411 -409
- package/lib/SyntaxHighlight-GR0eix_L.js.map +1 -0
- package/lib/{Toc-CpsFSXeD.js → Toc-BlcGIkXc.js} +2 -2
- package/lib/{Toc-CpsFSXeD.js.map → Toc-BlcGIkXc.js.map} +1 -1
- package/lib/ZudokuContext-BuJD7yIX.js +1286 -0
- package/lib/ZudokuContext-BuJD7yIX.js.map +1 -0
- package/lib/chunk-QMGIS6GS-DqecZ6nq.js +9204 -0
- package/lib/chunk-QMGIS6GS-DqecZ6nq.js.map +1 -0
- package/lib/{circular-OvXQH6UK.js → circular-CGTcsqA3.js} +2 -2
- package/lib/{circular-OvXQH6UK.js.map → circular-CGTcsqA3.js.map} +1 -1
- package/lib/cn-dYga0KKN.js.map +1 -1
- package/lib/{createServer-B5U_8E3S.js → createServer-DjgpuLne.js} +5 -5
- package/lib/{createServer-B5U_8E3S.js.map → createServer-DjgpuLne.js.map} +1 -1
- package/lib/errors-CrI3s7mR.js +45 -0
- package/lib/errors-CrI3s7mR.js.map +1 -0
- package/lib/hook-bv3iuX7X.js +247 -0
- package/lib/hook-bv3iuX7X.js.map +1 -0
- package/lib/index-CrcNWbel.js.map +1 -1
- package/lib/{index-BzcS9JBW.js → index-CvTWnHZF.js} +860 -938
- package/lib/index-CvTWnHZF.js.map +1 -0
- package/lib/index-DI5SPFK9.js.map +1 -1
- package/lib/index-DmNq2fbN.js.map +1 -1
- package/lib/index-DzO-Qh6S.js +1061 -0
- package/lib/index-DzO-Qh6S.js.map +1 -0
- package/lib/{index-4XtG1tlD.js → index-HarEI51d.js} +2 -2
- package/lib/{index-4XtG1tlD.js.map → index-HarEI51d.js.map} +1 -1
- package/lib/index.esm-BnYHxCYC.js +683 -0
- package/lib/index.esm-BnYHxCYC.js.map +1 -0
- package/lib/index.esm-CdzlRw50.js +1254 -0
- package/lib/index.esm-CdzlRw50.js.map +1 -0
- package/lib/{invariant-DAFpPywt.js → invariant-Bm-FVUQE.js} +2 -6
- package/lib/invariant-Bm-FVUQE.js.map +1 -0
- package/lib/jsx-runtime-C5mzlN2N.js.map +1 -1
- package/lib/mutation-Dy_5up8v.js +196 -0
- package/lib/mutation-Dy_5up8v.js.map +1 -0
- package/lib/processors/removeExtensions.js.map +1 -1
- package/lib/processors/removeParameters.js.map +1 -1
- package/lib/processors/removePaths.js.map +1 -1
- package/lib/processors/traverse.js.map +1 -1
- package/lib/ui/Accordion.js.map +1 -1
- package/lib/ui/ActionButton.js +9 -9
- package/lib/ui/ActionButton.js.map +1 -1
- package/lib/ui/Alert.js.map +1 -1
- package/lib/ui/AlertDialog.js.map +1 -1
- package/lib/ui/Badge.js.map +1 -1
- package/lib/ui/Breadcrumb.js.map +1 -1
- package/lib/ui/Button.js.map +1 -1
- package/lib/ui/Callout.js.map +1 -1
- package/lib/ui/Card.js.map +1 -1
- package/lib/ui/Carousel.js.map +1 -1
- package/lib/ui/Checkbox.js.map +1 -1
- package/lib/ui/CodeBlock.js +1 -1
- package/lib/ui/Command.js +1 -1
- package/lib/ui/Command.js.map +1 -1
- package/lib/ui/Dialog.js +56 -41
- package/lib/ui/Dialog.js.map +1 -1
- package/lib/ui/Drawer.js +1 -1
- package/lib/ui/DropdownMenu.js.map +1 -1
- package/lib/ui/EmbeddedCodeBlock.js +1 -1
- package/lib/ui/EmbeddedCodeBlock.js.map +1 -1
- package/lib/ui/Form.js +1 -1
- package/lib/ui/Form.js.map +1 -1
- package/lib/ui/HoverCard.js.map +1 -1
- package/lib/ui/Input.js.map +1 -1
- package/lib/ui/Label.js.map +1 -1
- package/lib/ui/Pagination.js.map +1 -1
- package/lib/ui/Popover.js.map +1 -1
- package/lib/ui/Progress.js.map +1 -1
- package/lib/ui/RadioGroup.js.map +1 -1
- package/lib/ui/ScrollArea.js.map +1 -1
- package/lib/ui/Select.js.map +1 -1
- package/lib/ui/Skeleton.js.map +1 -1
- package/lib/ui/Slider.js.map +1 -1
- package/lib/ui/Stepper.js.map +1 -1
- package/lib/ui/Switch.js.map +1 -1
- package/lib/ui/SyntaxHighlight.js +4 -4
- package/lib/ui/Tabs.js.map +1 -1
- package/lib/ui/Textarea.js.map +1 -1
- package/lib/ui/Toggle.js.map +1 -1
- package/lib/ui/ToggleGroup.js.map +1 -1
- package/lib/ui/Tooltip.js.map +1 -1
- package/lib/useExposedProps-BH9aq4MD.js +113 -0
- package/lib/useExposedProps-BH9aq4MD.js.map +1 -0
- package/lib/useLatest-hmRS46UF.js +11 -0
- package/lib/useLatest-hmRS46UF.js.map +1 -0
- package/lib/zudoku.__internal.js +2965 -0
- package/lib/zudoku.__internal.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-azureb2c.js +46 -9880
- package/lib/zudoku.auth-azureb2c.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +25 -22
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +204 -195
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.auth-supabase.js +97 -0
- package/lib/zudoku.auth-supabase.js.map +1 -0
- package/lib/zudoku.components.js +21 -28
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +7 -7
- package/lib/zudoku.hooks.js.map +1 -1
- package/lib/zudoku.icons.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +23 -22
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +410 -295
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +8 -5
- 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 +7 -6
- package/lib/zudoku.plugin-openapi.js.map +1 -1
- package/lib/zudoku.plugin-redirect.js +3 -3
- package/lib/zudoku.plugin-redirect.js.map +1 -1
- package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +28 -27
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/lib/zudoku.plugins.js.map +1 -1
- package/lib/zudoku.router.js +123 -0
- package/lib/zudoku.router.js.map +1 -0
- package/package.json +31 -23
- package/src/app/demo.tsx +1 -1
- package/src/app/entry.client.tsx +1 -1
- package/src/app/entry.server.tsx +1 -1
- package/src/app/main.css +22 -5
- package/src/app/main.tsx +23 -11
- package/src/app/standalone.tsx +1 -1
- package/src/lib/authentication/components/CallbackHandler.tsx +22 -15
- package/src/lib/authentication/components/OAuthErrorPage.tsx +171 -0
- package/src/lib/authentication/errors.ts +27 -13
- package/src/lib/authentication/hook.ts +2 -0
- package/src/lib/authentication/providers/azureb2c.tsx +8 -3
- package/src/lib/authentication/providers/clerk.tsx +4 -1
- package/src/lib/authentication/providers/openid.tsx +7 -1
- package/src/lib/components/BuildCheck.tsx +13 -3
- package/src/lib/components/Header.tsx +4 -3
- package/src/lib/components/Heading.tsx +1 -1
- package/src/lib/components/Layout.tsx +2 -21
- package/src/lib/components/Markdown.tsx +3 -3
- package/src/lib/components/Meta.tsx +32 -0
- package/src/lib/components/MobileTopNavigation.tsx +6 -3
- package/src/lib/components/NotFoundPage.tsx +3 -2
- package/src/lib/components/TopNavigation.tsx +4 -4
- package/src/lib/components/Typography.tsx +1 -1
- package/src/lib/components/context/ZudokuContext.ts +26 -19
- package/src/lib/components/index.ts +0 -18
- package/src/lib/components/navigation/NavigationCategory.tsx +1 -1
- package/src/lib/components/navigation/NavigationItem.tsx +13 -3
- package/src/lib/components/navigation/utils.ts +21 -15
- package/src/lib/core/RouteGuard.tsx +13 -13
- package/src/lib/core/ZudokuContext.ts +37 -5
- package/src/lib/core/__internal.tsx +30 -0
- package/src/lib/core/plugins.ts +2 -1
- package/src/lib/core/router.ts +1 -0
- package/src/lib/errors/ErrorAlert.tsx +5 -7
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +17 -3
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +21 -3
- package/src/lib/plugins/api-keys/index.tsx +16 -11
- package/src/lib/plugins/custom-pages/index.tsx +3 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
- package/src/lib/plugins/openapi/SidecarExamples.tsx +1 -1
- package/src/lib/plugins/openapi/graphql/gql.ts +3 -3
- package/src/lib/plugins/openapi/graphql/graphql.ts +2 -0
- package/src/lib/plugins/openapi/index.tsx +66 -16
- package/src/lib/plugins/openapi/playground/PathParams.tsx +1 -1
- package/src/lib/plugins/openapi/playground/Playground.tsx +8 -2
- package/src/lib/shiki.ts +2 -0
- package/src/lib/ui/ActionButton.tsx +3 -1
- package/src/lib/ui/CodeBlock.tsx +38 -13
- package/src/lib/ui/Dialog.tsx +12 -3
- package/src/lib/ui/EmbeddedCodeBlock.tsx +1 -1
- package/src/lib/util/invariant.ts +7 -5
- package/src/shiki/langs/vue-vine.js +1 -0
- package/dist/vite/remarkStaticGeneration.js.map +0 -1
- package/lib/Alert-Cig_8hW6.js +0 -161
- package/lib/Alert-Cig_8hW6.js.map +0 -1
- package/lib/CodeBlock-BaBgX9Wy.js +0 -85
- package/lib/CodeBlock-BaBgX9Wy.js.map +0 -1
- package/lib/Dialog-DMWw1doX.js +0 -99
- package/lib/Dialog-DMWw1doX.js.map +0 -1
- package/lib/OperationList-DhA6x6qm.js.map +0 -1
- package/lib/RouteGuard-Vnlz_t51.js +0 -737
- package/lib/RouteGuard-Vnlz_t51.js.map +0 -1
- package/lib/SyntaxHighlight-CVe58ZSY.js.map +0 -1
- package/lib/chunk-DQRVZFIR-DHK7_Ilc.js +0 -1839
- package/lib/chunk-DQRVZFIR-DHK7_Ilc.js.map +0 -1
- package/lib/clerk-BDZ31hjU.js +0 -25190
- package/lib/clerk-BDZ31hjU.js.map +0 -1
- package/lib/errors-DOCWNkkS.js +0 -78
- package/lib/errors-DOCWNkkS.js.map +0 -1
- package/lib/hook-CZjW2buS.js +0 -1510
- package/lib/hook-CZjW2buS.js.map +0 -1
- package/lib/index-Bm35Tkgf.js +0 -107
- package/lib/index-Bm35Tkgf.js.map +0 -1
- package/lib/index-BzcS9JBW.js.map +0 -1
- package/lib/index-Sb7nQNHJ.js +0 -3980
- package/lib/index-Sb7nQNHJ.js.map +0 -1
- package/lib/index.esm-Cp4wkyud.js +0 -1236
- package/lib/index.esm-Cp4wkyud.js.map +0 -1
- package/lib/invariant-DAFpPywt.js.map +0 -1
- package/lib/useExposedProps-BIYjecPD.js +0 -9
- package/lib/useExposedProps-BIYjecPD.js.map +0 -1
|
@@ -20,12 +20,15 @@ import { ThemeSwitch } from "./ThemeSwitch.js";
|
|
|
20
20
|
import { TopNavItem, TopNavLink } from "./TopNavigation.js";
|
|
21
21
|
|
|
22
22
|
export const MobileTopNavigation = () => {
|
|
23
|
-
const
|
|
24
|
-
const
|
|
23
|
+
const context = useZudoku();
|
|
24
|
+
const authState = useAuth();
|
|
25
|
+
|
|
26
|
+
const { navigation, options, getProfileMenuItems } = context;
|
|
27
|
+
const { isAuthenticated, profile, isAuthEnabled } = authState;
|
|
25
28
|
const [drawerOpen, setDrawerOpen] = useState(false);
|
|
26
29
|
|
|
27
30
|
const accountItems = getProfileMenuItems();
|
|
28
|
-
const filteredItems = navigation.filter(isHiddenItem(
|
|
31
|
+
const filteredItems = navigation.filter(isHiddenItem(authState, context));
|
|
29
32
|
|
|
30
33
|
return (
|
|
31
34
|
<Drawer
|
|
@@ -18,9 +18,10 @@ export const NotFoundPage = () => {
|
|
|
18
18
|
<DeveloperHint>
|
|
19
19
|
Start by adding a file at{" "}
|
|
20
20
|
<code>
|
|
21
|
-
{"{
|
|
21
|
+
{"{DOCUMENT_ROOT}"}/{params["*"]}.mdx
|
|
22
22
|
</code>{" "}
|
|
23
|
-
and add some content to make this error go away.
|
|
23
|
+
and add some content to make this error go away. By default{" "}
|
|
24
|
+
<code>DOCUMENT_ROOT</code> is the `pages` directory.
|
|
24
25
|
</DeveloperHint>
|
|
25
26
|
<p>
|
|
26
27
|
It seems that the page you are looking for does not exist or may have
|
|
@@ -10,10 +10,10 @@ import { isHiddenItem, traverseNavigationItem } from "./navigation/utils.js";
|
|
|
10
10
|
import { Slot } from "./Slot.js";
|
|
11
11
|
|
|
12
12
|
export const TopNavigation = () => {
|
|
13
|
-
const
|
|
14
|
-
const {
|
|
15
|
-
|
|
16
|
-
const filteredItems = navigation.filter(isHiddenItem(
|
|
13
|
+
const context = useZudoku();
|
|
14
|
+
const { navigation } = context;
|
|
15
|
+
const auth = useAuth();
|
|
16
|
+
const filteredItems = navigation.filter(isHiddenItem(auth, context));
|
|
17
17
|
|
|
18
18
|
if (filteredItems.length === 0 || import.meta.env.MODE === "standalone") {
|
|
19
19
|
return <style>{`:root { --top-nav-height: 0px; }`}</style>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../util/cn.js";
|
|
2
2
|
|
|
3
3
|
// other styles are defined in main.css .prose
|
|
4
|
-
export const ProseClasses = "prose dark:prose-invert prose-neutral";
|
|
4
|
+
export const ProseClasses = "prose dark:prose-invert prose-neutral typography";
|
|
5
5
|
|
|
6
6
|
export const Typography = ({
|
|
7
7
|
children,
|
|
@@ -2,7 +2,6 @@ import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
3
|
import { matchPath, useLocation } from "react-router";
|
|
4
4
|
import { type NavigationItem } from "../../../config/validators/NavigationSchema.js";
|
|
5
|
-
import { useAuth } from "../../authentication/hook.js";
|
|
6
5
|
import type { ZudokuContext } from "../../core/ZudokuContext.js";
|
|
7
6
|
import { joinUrl } from "../../util/joinUrl.js";
|
|
8
7
|
import { CACHE_KEYS } from "../cache.js";
|
|
@@ -40,19 +39,33 @@ const getItemPath = (item: NavigationItem) => {
|
|
|
40
39
|
case "link":
|
|
41
40
|
return item.to;
|
|
42
41
|
case "custom-page":
|
|
43
|
-
return item.path;
|
|
42
|
+
return joinUrl(item.path);
|
|
44
43
|
default:
|
|
45
44
|
return undefined;
|
|
46
45
|
}
|
|
47
46
|
};
|
|
47
|
+
|
|
48
|
+
const extractAllPaths = (items: NavigationItem[]) => {
|
|
49
|
+
const paths = new Set<string>();
|
|
50
|
+
|
|
51
|
+
const collectPaths = (items: NavigationItem[]) => {
|
|
52
|
+
for (const item of items) {
|
|
53
|
+
const itemPath = getItemPath(item)?.split("?").at(0)?.split("#").at(0);
|
|
54
|
+
|
|
55
|
+
if (itemPath) paths.add(itemPath);
|
|
56
|
+
if (item.type === "category") {
|
|
57
|
+
collectPaths(item.items);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
collectPaths(items);
|
|
62
|
+
|
|
63
|
+
return [...paths];
|
|
64
|
+
};
|
|
65
|
+
|
|
48
66
|
export const useCurrentNavigation = () => {
|
|
49
|
-
const { getPluginNavigation, navigation
|
|
67
|
+
const { getPluginNavigation, navigation } = useZudoku();
|
|
50
68
|
const location = useLocation();
|
|
51
|
-
const auth = useAuth();
|
|
52
|
-
|
|
53
|
-
const isProtectedRoute = options.protectedRoutes?.some((route) =>
|
|
54
|
-
matchPath(route, location.pathname),
|
|
55
|
-
);
|
|
56
69
|
|
|
57
70
|
const navItem = traverseNavigation(navigation, (item, parentCategories) => {
|
|
58
71
|
if (getItemPath(item) === location.pathname) {
|
|
@@ -67,12 +80,8 @@ export const useCurrentNavigation = () => {
|
|
|
67
80
|
|
|
68
81
|
let topNavItem = navItem;
|
|
69
82
|
if (!navItem && data.length > 0) {
|
|
70
|
-
|
|
71
|
-
const pluginBasePaths = data.flatMap((item) => {
|
|
72
|
-
return getItemPath(item)?.split("?").at(0)?.split("#").at(0) ?? [];
|
|
73
|
-
});
|
|
83
|
+
const pluginBasePaths = extractAllPaths(data);
|
|
74
84
|
|
|
75
|
-
// Find top-level nav item that matches any plugin base path
|
|
76
85
|
topNavItem = navigation
|
|
77
86
|
.flatMap((item) => {
|
|
78
87
|
const itemPath = getItemPath(item);
|
|
@@ -88,13 +97,11 @@ export const useCurrentNavigation = () => {
|
|
|
88
97
|
})?.item;
|
|
89
98
|
}
|
|
90
99
|
|
|
91
|
-
const hasNavigation =
|
|
92
|
-
auth.isAuthEnabled && !auth.isAuthenticated && isProtectedRoute;
|
|
93
|
-
|
|
94
100
|
return {
|
|
95
|
-
navigation:
|
|
96
|
-
? []
|
|
97
|
-
|
|
101
|
+
navigation: [
|
|
102
|
+
...(navItem?.type === "category" ? navItem.items : []),
|
|
103
|
+
...data,
|
|
104
|
+
],
|
|
98
105
|
topNavItem,
|
|
99
106
|
};
|
|
100
107
|
};
|
|
@@ -3,44 +3,26 @@ import { Helmet } from "@zudoku/react-helmet-async";
|
|
|
3
3
|
import { useTheme as useThemeImport } from "next-themes";
|
|
4
4
|
import { Link as LinkImport } from "react-router";
|
|
5
5
|
import { useAuth as useAuthImport } from "../authentication/hook.js";
|
|
6
|
-
import { RouteGuard as RouteGuardImport } from "../core/RouteGuard.js";
|
|
7
|
-
import { RouterError as RouterErrorImport } from "../errors/RouterError.js";
|
|
8
|
-
import { ServerError as ServerErrorImport } from "../errors/ServerError.js";
|
|
9
6
|
import { Button as ButtonImport } from "../ui/Button.js";
|
|
10
7
|
import { Callout as CalloutImport } from "../ui/Callout.js";
|
|
11
|
-
import {
|
|
12
|
-
Bootstrap as BootstrapImport,
|
|
13
|
-
BootstrapStatic as BootstrapStaticImport,
|
|
14
|
-
} from "./Bootstrap.js";
|
|
15
|
-
import { BuildCheck as BuildCheckImport } from "./BuildCheck.js";
|
|
16
8
|
import {
|
|
17
9
|
CACHE_KEYS as CACHE_KEYS_IMPORT,
|
|
18
10
|
useCache as useCacheImport,
|
|
19
11
|
} from "./cache.js";
|
|
20
12
|
import { ClientOnly as ClientOnlyImport } from "./ClientOnly.js";
|
|
21
13
|
import { useZudoku as useZudokuImport } from "./context/ZudokuContext.js";
|
|
22
|
-
import { Layout as LayoutImport } from "./Layout.js";
|
|
23
14
|
import { Markdown as MarkdownImport } from "./Markdown.js";
|
|
24
15
|
import { Spinner as SpinnerImport } from "./Spinner.js";
|
|
25
|
-
import { StatusPage as StatusPageImport } from "./StatusPage.js";
|
|
26
16
|
import { Typography as TypographyImport } from "./Typography.js";
|
|
27
17
|
import { Zudoku as ZudokuImport } from "./Zudoku.js";
|
|
28
18
|
|
|
29
|
-
export const Layout = /*@__PURE__*/ LayoutImport;
|
|
30
|
-
export const RouterError = /*@__PURE__*/ RouterErrorImport;
|
|
31
|
-
export const ServerError = /*@__PURE__*/ ServerErrorImport;
|
|
32
|
-
export const Bootstrap = /*@__PURE__*/ BootstrapImport;
|
|
33
|
-
export const BootstrapStatic = /*@__PURE__*/ BootstrapStaticImport;
|
|
34
|
-
export const RouteGuard = /*@__PURE__*/ RouteGuardImport;
|
|
35
19
|
export const Head = /*@__PURE__*/ Helmet;
|
|
36
|
-
export const StatusPage = /*@__PURE__*/ StatusPageImport;
|
|
37
20
|
export const Callout = /*@__PURE__*/ CalloutImport;
|
|
38
21
|
export const Markdown = /*@__PURE__*/ MarkdownImport;
|
|
39
22
|
export const Spinner = /*@__PURE__*/ SpinnerImport;
|
|
40
23
|
export const ClientOnly = /*@__PURE__*/ ClientOnlyImport;
|
|
41
24
|
export const Button = /*@__PURE__*/ ButtonImport;
|
|
42
25
|
export const Link = /*@__PURE__*/ LinkImport;
|
|
43
|
-
export const BuildCheck = /*@__PURE__*/ BuildCheckImport;
|
|
44
26
|
export const Zudoku = /*@__PURE__*/ ZudokuImport;
|
|
45
27
|
export const Typography = /*@__PURE__*/ TypographyImport;
|
|
46
28
|
|
|
@@ -46,7 +46,7 @@ const NavigationCategoryInner = ({
|
|
|
46
46
|
}}
|
|
47
47
|
variant="ghost"
|
|
48
48
|
size="icon"
|
|
49
|
-
className="size-6 hover:bg-[hsl(
|
|
49
|
+
className="size-6 hover:bg-[hsl(from_var(--accent)_h_s_calc(l+6*var(--dark)))]"
|
|
50
50
|
>
|
|
51
51
|
<ChevronRightIcon
|
|
52
52
|
size={16}
|
|
@@ -9,13 +9,15 @@ import {
|
|
|
9
9
|
TooltipTrigger,
|
|
10
10
|
} from "zudoku/ui/Tooltip.js";
|
|
11
11
|
import type { NavigationItem as NavigationItemType } from "../../../config/validators/NavigationSchema.js";
|
|
12
|
+
import { useAuth } from "../../authentication/hook.js";
|
|
12
13
|
import { cn } from "../../util/cn.js";
|
|
13
14
|
import { joinUrl } from "../../util/joinUrl.js";
|
|
14
15
|
import { AnchorLink } from "../AnchorLink.js";
|
|
15
16
|
import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
|
|
17
|
+
import { useZudoku } from "../context/ZudokuContext.js";
|
|
16
18
|
import { NavigationBadge } from "./NavigationBadge.js";
|
|
17
19
|
import { NavigationCategory } from "./NavigationCategory.js";
|
|
18
|
-
import { navigationListItem } from "./utils.js";
|
|
20
|
+
import { isHiddenItem, navigationListItem } from "./utils.js";
|
|
19
21
|
|
|
20
22
|
const TruncatedLabel = ({
|
|
21
23
|
label,
|
|
@@ -74,6 +76,12 @@ export const NavigationItem = ({
|
|
|
74
76
|
}) => {
|
|
75
77
|
const location = useLocation();
|
|
76
78
|
const { activeAnchor } = useViewportAnchor();
|
|
79
|
+
const auth = useAuth();
|
|
80
|
+
const context = useZudoku();
|
|
81
|
+
|
|
82
|
+
if (!isHiddenItem(auth, context)(item)) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
77
85
|
|
|
78
86
|
switch (item.type) {
|
|
79
87
|
case "category":
|
|
@@ -106,7 +114,7 @@ export const NavigationItem = ({
|
|
|
106
114
|
);
|
|
107
115
|
case "link":
|
|
108
116
|
case "custom-page": {
|
|
109
|
-
const href = item.type === "link" ? item.to : item.path;
|
|
117
|
+
const href = item.type === "link" ? item.to : joinUrl(item.path);
|
|
110
118
|
return !href.startsWith("http") ? (
|
|
111
119
|
<AnchorLink
|
|
112
120
|
to={{
|
|
@@ -116,7 +124,9 @@ export const NavigationItem = ({
|
|
|
116
124
|
}}
|
|
117
125
|
{...{ [DATA_ANCHOR_ATTR]: href.split("#")[1] }}
|
|
118
126
|
className={navigationListItem({
|
|
119
|
-
isActive:
|
|
127
|
+
isActive:
|
|
128
|
+
href ===
|
|
129
|
+
[location.pathname, activeAnchor].filter(Boolean).join("#"),
|
|
120
130
|
})}
|
|
121
131
|
onClick={onRequestClose}
|
|
122
132
|
>
|
|
@@ -4,6 +4,8 @@ import type {
|
|
|
4
4
|
NavigationCategory,
|
|
5
5
|
NavigationItem,
|
|
6
6
|
} from "../../../config/validators/NavigationSchema.js";
|
|
7
|
+
import type { UseAuthReturn } from "../../authentication/hook.js";
|
|
8
|
+
import type { ZudokuContext } from "../../core/ZudokuContext.js";
|
|
7
9
|
import { joinUrl } from "../../util/joinUrl.js";
|
|
8
10
|
import { useCurrentNavigation } from "../context/ZudokuContext.js";
|
|
9
11
|
|
|
@@ -56,18 +58,18 @@ export const useIsCategoryOpen = (category: NavigationCategory) => {
|
|
|
56
58
|
const location = useLocation();
|
|
57
59
|
|
|
58
60
|
return traverseNavigationItem(category, (item) => {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
switch (item.type) {
|
|
62
|
+
case "category":
|
|
63
|
+
if (!item.link) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
return joinUrl(item.link.path) === location.pathname ? true : undefined;
|
|
67
|
+
case "custom-page":
|
|
68
|
+
case "doc":
|
|
69
|
+
return joinUrl(item.path) === location.pathname ? true : undefined;
|
|
70
|
+
case "link":
|
|
71
|
+
default:
|
|
72
|
+
return undefined;
|
|
71
73
|
}
|
|
72
74
|
});
|
|
73
75
|
};
|
|
@@ -133,14 +135,18 @@ export const navigationListItem = cva(
|
|
|
133
135
|
);
|
|
134
136
|
|
|
135
137
|
export const isHiddenItem =
|
|
136
|
-
(
|
|
138
|
+
(auth: UseAuthReturn, context: ZudokuContext) =>
|
|
137
139
|
(item: NavigationItem): boolean => {
|
|
140
|
+
if (typeof item.display === "function") {
|
|
141
|
+
return item.display({ context, auth });
|
|
142
|
+
}
|
|
143
|
+
|
|
138
144
|
if (item.display === "hide") return false;
|
|
139
145
|
if (!item.label) return false;
|
|
140
146
|
|
|
141
147
|
return (
|
|
142
|
-
(item.display === "auth" && isAuthenticated) ||
|
|
143
|
-
(item.display === "anon" && !isAuthenticated) ||
|
|
148
|
+
(item.display === "auth" && auth.isAuthenticated) ||
|
|
149
|
+
(item.display === "anon" && !auth.isAuthenticated) ||
|
|
144
150
|
!item.display ||
|
|
145
151
|
item.display === "always"
|
|
146
152
|
);
|
|
@@ -24,14 +24,18 @@ export const RouteGuard = () => {
|
|
|
24
24
|
const location = useLocation();
|
|
25
25
|
const latestPath = useLatest(location.pathname);
|
|
26
26
|
const shouldBypass = use(BypassProtectedRoutesContext);
|
|
27
|
+
const { protectedRoutes } = zudoku.options;
|
|
27
28
|
|
|
28
|
-
const
|
|
29
|
+
const authCheckFn =
|
|
30
|
+
!shouldBypass && protectedRoutes
|
|
31
|
+
? Object.entries(protectedRoutes).find(([path]) =>
|
|
32
|
+
matchPath({ path, end: true }, location.pathname),
|
|
33
|
+
)?.[1]
|
|
34
|
+
: undefined;
|
|
29
35
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
matchPath({ path, end: true }, location.pathname),
|
|
34
|
-
);
|
|
36
|
+
const isProtectedRoute = authCheckFn !== undefined;
|
|
37
|
+
const needsToSignIn =
|
|
38
|
+
isProtectedRoute && !authCheckFn({ auth, context: zudoku });
|
|
35
39
|
|
|
36
40
|
useQuery({
|
|
37
41
|
queryKey: ["login-redirect"],
|
|
@@ -42,14 +46,10 @@ export const RouteGuard = () => {
|
|
|
42
46
|
});
|
|
43
47
|
return true;
|
|
44
48
|
},
|
|
45
|
-
enabled:
|
|
46
|
-
typeof window !== "undefined" &&
|
|
47
|
-
isProtected &&
|
|
48
|
-
!auth.isPending &&
|
|
49
|
-
!auth.isAuthenticated,
|
|
49
|
+
enabled: typeof window !== "undefined" && needsToSignIn && !auth.isPending,
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
-
if (
|
|
52
|
+
if (needsToSignIn) {
|
|
53
53
|
return (
|
|
54
54
|
<Dialog
|
|
55
55
|
open={true}
|
|
@@ -71,7 +71,7 @@ export const RouteGuard = () => {
|
|
|
71
71
|
);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
if (
|
|
74
|
+
if (isProtectedRoute && !auth.isAuthEnabled) {
|
|
75
75
|
throw new ZudokuError("Authentication is not enabled", {
|
|
76
76
|
title: "Authentication is not enabled",
|
|
77
77
|
developerHint:
|
|
@@ -5,6 +5,10 @@ import type { Location } from "react-router";
|
|
|
5
5
|
import type { BundledTheme, HighlighterCore } from "shiki";
|
|
6
6
|
import type { z } from "zod/v4";
|
|
7
7
|
import type { Navigation } from "../../config/validators/NavigationSchema.js";
|
|
8
|
+
import type {
|
|
9
|
+
CallbackContext,
|
|
10
|
+
ProtectedRoutesInput,
|
|
11
|
+
} from "../../config/validators/ProtectedRoutesSchema.js";
|
|
8
12
|
import type { FooterSchema } from "../../config/validators/validate.js";
|
|
9
13
|
import type { AuthenticationPlugin } from "../authentication/authentication.js";
|
|
10
14
|
import { type AuthState, useAuthState } from "../authentication/state.js";
|
|
@@ -44,6 +48,7 @@ export type ApiKeyCache = "api-keys";
|
|
|
44
48
|
|
|
45
49
|
type Metadata = Partial<{
|
|
46
50
|
title: string;
|
|
51
|
+
defaultTitle?: string;
|
|
47
52
|
description: string;
|
|
48
53
|
logo: string;
|
|
49
54
|
favicon: string;
|
|
@@ -67,6 +72,7 @@ type Site = Partial<{
|
|
|
67
72
|
};
|
|
68
73
|
width?: string | number;
|
|
69
74
|
alt?: string;
|
|
75
|
+
href?: string;
|
|
70
76
|
};
|
|
71
77
|
banner?: {
|
|
72
78
|
message: ReactNode;
|
|
@@ -93,13 +99,30 @@ export type ZudokuContextOptions = {
|
|
|
93
99
|
components?: MdxComponentsType;
|
|
94
100
|
};
|
|
95
101
|
overrides?: ComponentsContextType;
|
|
96
|
-
protectedRoutes?:
|
|
102
|
+
protectedRoutes?: ProtectedRoutesInput;
|
|
97
103
|
syntaxHighlighting?: {
|
|
98
104
|
highlighter: HighlighterCore;
|
|
99
105
|
themes?: { light: BundledTheme; dark: BundledTheme };
|
|
100
106
|
};
|
|
101
107
|
};
|
|
102
108
|
|
|
109
|
+
export const transformProtectedRoutes = (
|
|
110
|
+
val: ProtectedRoutesInput,
|
|
111
|
+
): Record<string, (c: CallbackContext) => boolean> | undefined => {
|
|
112
|
+
if (!val) return undefined;
|
|
113
|
+
|
|
114
|
+
if (Array.isArray(val)) {
|
|
115
|
+
return Object.fromEntries(
|
|
116
|
+
val.map((route) => [
|
|
117
|
+
route,
|
|
118
|
+
(c: CallbackContext) => c.auth.isAuthenticated,
|
|
119
|
+
]),
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return val;
|
|
124
|
+
};
|
|
125
|
+
|
|
103
126
|
export class ZudokuContext {
|
|
104
127
|
public plugins: NonNullable<ZudokuContextOptions["plugins"]>;
|
|
105
128
|
public navigation: Navigation;
|
|
@@ -112,12 +135,21 @@ export class ZudokuContext {
|
|
|
112
135
|
private emitter = createNanoEvents<ZudokuEvents>();
|
|
113
136
|
|
|
114
137
|
constructor(options: ZudokuContextOptions, queryClient: QueryClient) {
|
|
115
|
-
const
|
|
116
|
-
options.plugins
|
|
117
|
-
isNavigationPlugin(plugin)
|
|
118
|
-
|
|
138
|
+
const pluginProtectedRoutes = Object.fromEntries(
|
|
139
|
+
(options.plugins ?? []).flatMap((plugin) => {
|
|
140
|
+
if (!isNavigationPlugin(plugin)) return [];
|
|
141
|
+
const routes = plugin.getProtectedRoutes?.();
|
|
142
|
+
if (!routes) return [];
|
|
143
|
+
|
|
144
|
+
return Object.entries(transformProtectedRoutes(routes) ?? {});
|
|
145
|
+
}),
|
|
119
146
|
);
|
|
120
147
|
|
|
148
|
+
const protectedRoutes = {
|
|
149
|
+
...pluginProtectedRoutes,
|
|
150
|
+
...transformProtectedRoutes(options.protectedRoutes),
|
|
151
|
+
};
|
|
152
|
+
|
|
121
153
|
this.queryClient = queryClient;
|
|
122
154
|
this.options = { ...options, protectedRoutes };
|
|
123
155
|
this.plugins = options.plugins ?? [];
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ⚠️
|
|
3
|
+
* These are re-exports consumed from the main entry point in `src/app/main.tsx`
|
|
4
|
+
* This is to ensure that they share the exact same context in React.
|
|
5
|
+
* ⚠️
|
|
6
|
+
**/
|
|
7
|
+
|
|
8
|
+
import { Helmet } from "@zudoku/react-helmet-async";
|
|
9
|
+
import {
|
|
10
|
+
Bootstrap as BootstrapImport,
|
|
11
|
+
BootstrapStatic as BootstrapStaticImport,
|
|
12
|
+
} from "../components/Bootstrap.js";
|
|
13
|
+
import { BuildCheck as BuildCheckImport } from "../components/BuildCheck.js";
|
|
14
|
+
import { Layout as LayoutImport } from "../components/Layout.js";
|
|
15
|
+
import { Meta as MetaImport } from "../components/Meta.js";
|
|
16
|
+
import { StatusPage as StatusPageImport } from "../components/StatusPage.js";
|
|
17
|
+
import { RouterError as RouterErrorImport } from "../errors/RouterError.js";
|
|
18
|
+
import { ServerError as ServerErrorImport } from "../errors/ServerError.js";
|
|
19
|
+
import { RouteGuard as RouteGuardImport } from "./RouteGuard.js";
|
|
20
|
+
|
|
21
|
+
export const Layout = LayoutImport;
|
|
22
|
+
export const RouterError = RouterErrorImport;
|
|
23
|
+
export const ServerError = ServerErrorImport;
|
|
24
|
+
export const Bootstrap = BootstrapImport;
|
|
25
|
+
export const BootstrapStatic = BootstrapStaticImport;
|
|
26
|
+
export const RouteGuard = RouteGuardImport;
|
|
27
|
+
export const Head = Helmet;
|
|
28
|
+
export const StatusPage = StatusPageImport;
|
|
29
|
+
export const BuildCheck = BuildCheckImport;
|
|
30
|
+
export const Meta = MetaImport;
|
package/src/lib/core/plugins.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { LucideIcon } from "lucide-react";
|
|
|
2
2
|
import type { ReactElement } from "react";
|
|
3
3
|
import type { Location, RouteObject } from "react-router";
|
|
4
4
|
import type { Navigation } from "../../config/validators/NavigationSchema.js";
|
|
5
|
+
import type { ProtectedRoutesInput } from "../../config/validators/ProtectedRoutesSchema.js";
|
|
5
6
|
import type { AuthenticationPlugin } from "../authentication/authentication.js";
|
|
6
7
|
import type { MdxComponentsType } from "../util/MdxComponents.js";
|
|
7
8
|
import type {
|
|
@@ -24,7 +25,7 @@ export type { AuthenticationPlugin, RouteObject };
|
|
|
24
25
|
export interface NavigationPlugin {
|
|
25
26
|
getRoutes: () => RouteObject[];
|
|
26
27
|
getNavigation?: (path: string, context: ZudokuContext) => Promise<Navigation>;
|
|
27
|
-
getProtectedRoutes?: () =>
|
|
28
|
+
getProtectedRoutes?: () => ProtectedRoutesInput;
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
export const createApiIdentityPlugin = (
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "react-router";
|
|
@@ -23,13 +23,11 @@ export function ErrorAlert({ error }: { error: unknown }) {
|
|
|
23
23
|
Error: {message}
|
|
24
24
|
{hint && <DeveloperHint className="mb-4">{hint}</DeveloperHint>}
|
|
25
25
|
{stringError && (
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
/>
|
|
32
|
-
</div>
|
|
26
|
+
<SyntaxHighlight
|
|
27
|
+
className="max-h-[400px] [&>pre]:p-4"
|
|
28
|
+
language="js"
|
|
29
|
+
code={stringError}
|
|
30
|
+
/>
|
|
33
31
|
)}
|
|
34
32
|
</Typography>
|
|
35
33
|
);
|
|
@@ -2,6 +2,7 @@ import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
|
2
2
|
import { useForm } from "react-hook-form";
|
|
3
3
|
import { useNavigate } from "react-router";
|
|
4
4
|
import { ActionButton } from "zudoku/ui/ActionButton.js";
|
|
5
|
+
import { Alert, AlertDescription, AlertTitle } from "zudoku/ui/Alert.js";
|
|
5
6
|
import { DialogClose, DialogFooter } from "zudoku/ui/Dialog.js";
|
|
6
7
|
import {
|
|
7
8
|
Select,
|
|
@@ -12,6 +13,7 @@ import {
|
|
|
12
13
|
SelectValue,
|
|
13
14
|
} from "zudoku/ui/Select.js";
|
|
14
15
|
import { useZudoku } from "../../components/context/ZudokuContext.js";
|
|
16
|
+
import { useAuth } from "../../hooks/index.js";
|
|
15
17
|
import { Button } from "../../ui/Button.js";
|
|
16
18
|
import { Input } from "../../ui/Input.js";
|
|
17
19
|
import { type ApiKeyService } from "./index.js";
|
|
@@ -33,6 +35,8 @@ export const CreateApiKey = ({
|
|
|
33
35
|
expiresOn: "30",
|
|
34
36
|
},
|
|
35
37
|
});
|
|
38
|
+
const auth = useAuth();
|
|
39
|
+
|
|
36
40
|
const createKeyMutation = useMutation({
|
|
37
41
|
mutationFn: ({ description, expiresOn }: CreateApiKey) => {
|
|
38
42
|
if (!service.createKey) {
|
|
@@ -42,10 +46,14 @@ export const CreateApiKey = ({
|
|
|
42
46
|
const expiresOnDate =
|
|
43
47
|
expiresOn !== "never" ? addDaysToDate(Number(expiresOn)) : undefined;
|
|
44
48
|
|
|
45
|
-
return service.createKey(
|
|
46
|
-
|
|
49
|
+
return service.createKey({
|
|
50
|
+
apiKey: {
|
|
51
|
+
description: description || "Secret Key",
|
|
52
|
+
expiresOn: expiresOnDate,
|
|
53
|
+
},
|
|
47
54
|
context,
|
|
48
|
-
|
|
55
|
+
auth,
|
|
56
|
+
});
|
|
49
57
|
},
|
|
50
58
|
onSuccess: async () => {
|
|
51
59
|
await queryClient.invalidateQueries({ queryKey: ["api-keys"] });
|
|
@@ -68,6 +76,12 @@ export const CreateApiKey = ({
|
|
|
68
76
|
),
|
|
69
77
|
)}
|
|
70
78
|
>
|
|
79
|
+
{createKeyMutation.error && (
|
|
80
|
+
<Alert variant="destructive" className="mb-4">
|
|
81
|
+
<AlertTitle>Error</AlertTitle>
|
|
82
|
+
<AlertDescription>{createKeyMutation.error.message}</AlertDescription>
|
|
83
|
+
</Alert>
|
|
84
|
+
)}
|
|
71
85
|
<div className="flex gap-2 flex-col text-sm font-medium">
|
|
72
86
|
Name
|
|
73
87
|
<Input {...form.register("description")} />
|
|
@@ -35,6 +35,7 @@ import { Button } from "../../ui/Button.js";
|
|
|
35
35
|
import { Input } from "../../ui/Input.js";
|
|
36
36
|
import { cn } from "../../util/cn.js";
|
|
37
37
|
import { useCopyToClipboard } from "../../util/useCopyToClipboard.js";
|
|
38
|
+
import { CreateApiKey } from "./CreateApiKey.js";
|
|
38
39
|
import { type ApiConsumer, type ApiKey, type ApiKeyService } from "./index.js";
|
|
39
40
|
|
|
40
41
|
export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
|
|
@@ -50,6 +51,8 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
|
|
|
50
51
|
retry: false,
|
|
51
52
|
});
|
|
52
53
|
|
|
54
|
+
const [isCreateApiKeyOpen, setIsCreateApiKeyOpen] = useState(false);
|
|
55
|
+
|
|
53
56
|
const deleteKeyMutation = useMutation({
|
|
54
57
|
mutationFn: ({
|
|
55
58
|
consumerId,
|
|
@@ -181,10 +184,25 @@ export const SettingsApiKeys = ({ service }: { service: ApiKeyService }) => {
|
|
|
181
184
|
|
|
182
185
|
<div className="flex justify-between pb-3">
|
|
183
186
|
<h1 className="font-medium text-2xl">API Keys</h1>
|
|
187
|
+
|
|
184
188
|
{service.createKey && (
|
|
185
|
-
<
|
|
186
|
-
|
|
187
|
-
|
|
189
|
+
<Dialog
|
|
190
|
+
open={isCreateApiKeyOpen}
|
|
191
|
+
onOpenChange={setIsCreateApiKeyOpen}
|
|
192
|
+
>
|
|
193
|
+
<DialogTrigger asChild>
|
|
194
|
+
<Button variant="outline">Create API Key</Button>
|
|
195
|
+
</DialogTrigger>
|
|
196
|
+
<DialogContent>
|
|
197
|
+
<DialogHeader>
|
|
198
|
+
<DialogTitle>Create API Key</DialogTitle>
|
|
199
|
+
</DialogHeader>
|
|
200
|
+
<CreateApiKey
|
|
201
|
+
service={service}
|
|
202
|
+
onOpenChange={setIsCreateApiKeyOpen}
|
|
203
|
+
/>
|
|
204
|
+
</DialogContent>
|
|
205
|
+
</Dialog>
|
|
188
206
|
)}
|
|
189
207
|
</div>
|
|
190
208
|
<p>Create, manage, and monitor your API keys</p>
|