zudoku 0.0.0-feat-openapi-docs-redesign.dab3fc6a → 0.0.0-feat-navigation-at-property.z8cd07fa5
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/main.d.ts +6 -6
- package/dist/app/main.js +1 -1
- package/dist/app/main.js.map +1 -1
- package/dist/app/sentry.js +1 -1
- package/dist/cli/common/version-check.js +12 -3
- package/dist/cli/common/version-check.js.map +1 -1
- package/dist/config/create-plugin.d.ts +2 -0
- package/dist/config/create-plugin.js +55 -0
- package/dist/config/create-plugin.js.map +1 -0
- package/dist/config/loader.js +3 -1
- package/dist/config/loader.js.map +1 -1
- package/dist/config/validators/BuildSchema.js +18 -3
- package/dist/config/validators/BuildSchema.js.map +1 -1
- package/dist/config/validators/InputNavigationSchema.d.ts +133 -45
- package/dist/config/validators/InputNavigationSchema.js +30 -0
- package/dist/config/validators/InputNavigationSchema.js.map +1 -1
- package/dist/config/validators/NavigationSchema.d.ts +18 -4
- package/dist/config/validators/NavigationSchema.js +15 -5
- package/dist/config/validators/NavigationSchema.js.map +1 -1
- package/dist/config/validators/ProtectedRoutesSchema.d.ts +1 -1
- package/dist/config/validators/validate.d.ts +104 -14
- package/dist/config/validators/validate.js +15 -4
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/config/validators/validate.test.js +43 -0
- package/dist/config/validators/validate.test.js.map +1 -1
- package/dist/flat-config.d.ts +68 -32
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/auth/issuer.js +1 -1
- package/dist/lib/auth/issuer.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +3 -2
- package/dist/lib/authentication/components/CallbackHandler.js +1 -1
- package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
- package/dist/lib/authentication/components/SignIn.js +4 -2
- package/dist/lib/authentication/components/SignIn.js.map +1 -1
- package/dist/lib/authentication/components/SignUp.js +4 -2
- package/dist/lib/authentication/components/SignUp.js.map +1 -1
- package/dist/lib/authentication/hook.d.ts +2 -0
- package/dist/lib/authentication/hook.js +10 -0
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +17 -8
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/clerk.js +0 -22
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/firebase.js +67 -9
- package/dist/lib/authentication/providers/firebase.js.map +1 -1
- package/dist/lib/authentication/providers/supabase.js +6 -15
- package/dist/lib/authentication/providers/supabase.js.map +1 -1
- package/dist/lib/authentication/ui/EmailVerificationUi.d.ts +4 -0
- package/dist/lib/authentication/ui/EmailVerificationUi.js +34 -0
- package/dist/lib/authentication/ui/EmailVerificationUi.js.map +1 -0
- package/dist/lib/authentication/ui/ZudokuAuthUi.d.ts +7 -2
- package/dist/lib/authentication/ui/ZudokuAuthUi.js +48 -12
- package/dist/lib/authentication/ui/ZudokuAuthUi.js.map +1 -1
- package/dist/lib/authentication/utils/relativeRedirectUrl.d.ts +1 -0
- package/dist/lib/authentication/utils/relativeRedirectUrl.js +8 -0
- package/dist/lib/authentication/utils/relativeRedirectUrl.js.map +1 -0
- package/dist/lib/components/Bootstrap.js +1 -2
- package/dist/lib/components/Bootstrap.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/Mermaid.d.ts +7 -0
- package/dist/lib/components/Mermaid.js +42 -0
- package/dist/lib/components/Mermaid.js.map +1 -0
- package/dist/lib/components/MobileTopNavigation.js +3 -2
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/PagefindSearchMeta.d.ts +8 -0
- package/dist/lib/components/PagefindSearchMeta.js +7 -0
- package/dist/lib/components/PagefindSearchMeta.js.map +1 -0
- package/dist/lib/components/Pagination.js +2 -2
- package/dist/lib/components/Pagination.js.map +1 -1
- package/dist/lib/components/Slot.test.js +1 -1
- package/dist/lib/components/Slot.test.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +7 -1
- package/dist/lib/components/TopNavigation.js +8 -3
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/Zudoku.d.ts +4 -1
- package/dist/lib/components/Zudoku.js +5 -11
- package/dist/lib/components/Zudoku.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +9 -4
- package/dist/lib/components/context/ZudokuContext.js +26 -8
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/context/ZudokuProvider.js +1 -1
- package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
- package/dist/lib/components/context/ZudokuReactContext.d.ts +11 -0
- package/dist/lib/components/context/ZudokuReactContext.js +4 -0
- package/dist/lib/components/context/ZudokuReactContext.js.map +1 -0
- package/dist/lib/components/index.d.ts +18 -69
- package/dist/lib/components/index.js +19 -32
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/Navigation.js +4 -3
- package/dist/lib/components/navigation/Navigation.js.map +1 -1
- package/dist/lib/components/navigation/NavigationCategory.js +8 -0
- package/dist/lib/components/navigation/NavigationCategory.js.map +1 -1
- package/dist/lib/components/navigation/NavigationFilterContext.d.ts +8 -0
- package/dist/lib/components/navigation/NavigationFilterContext.js +12 -0
- package/dist/lib/components/navigation/NavigationFilterContext.js.map +1 -0
- package/dist/lib/components/navigation/NavigationFilterInput.d.ts +3 -0
- package/dist/lib/components/navigation/NavigationFilterInput.js +9 -0
- package/dist/lib/components/navigation/NavigationFilterInput.js.map +1 -0
- package/dist/lib/components/navigation/NavigationItem.js +13 -3
- package/dist/lib/components/navigation/NavigationItem.js.map +1 -1
- package/dist/lib/components/navigation/NavigationWrapper.js +1 -1
- package/dist/lib/components/navigation/NavigationWrapper.js.map +1 -1
- package/dist/lib/components/navigation/utils.d.ts +6 -1
- package/dist/lib/components/navigation/utils.js +26 -2
- package/dist/lib/components/navigation/utils.js.map +1 -1
- package/dist/lib/core/RouteGuard.js +12 -7
- package/dist/lib/core/RouteGuard.js.map +1 -1
- package/dist/lib/core/ZudokuContext.d.ts +2 -1
- package/dist/lib/core/ZudokuContext.js +3 -1
- package/dist/lib/core/ZudokuContext.js.map +1 -1
- package/dist/lib/core/__internal.d.ts +1 -0
- package/dist/lib/core/__internal.js +2 -0
- package/dist/lib/core/__internal.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +18 -4
- package/dist/lib/core/plugins.js +1 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/core/react-query.d.ts +1 -0
- package/dist/lib/core/react-query.js +2 -0
- package/dist/lib/core/react-query.js.map +1 -0
- package/dist/lib/core/transform-config.d.ts +4 -0
- package/dist/lib/core/transform-config.js +42 -0
- package/dist/lib/core/transform-config.js.map +1 -0
- package/dist/lib/core/transform-config.test.d.ts +1 -0
- package/dist/lib/core/transform-config.test.js +83 -0
- package/dist/lib/core/transform-config.test.js.map +1 -0
- package/dist/lib/errors/ErrorAlert.js +1 -2
- package/dist/lib/errors/ErrorAlert.js.map +1 -1
- package/dist/lib/errors/ErrorMessage.d.ts +3 -0
- package/dist/lib/errors/ErrorMessage.js +16 -0
- package/dist/lib/errors/ErrorMessage.js.map +1 -0
- package/dist/lib/hooks/index.d.ts +7 -28
- package/dist/lib/hooks/index.js +7 -15
- package/dist/lib/hooks/index.js.map +1 -1
- package/dist/lib/hooks/useEvent.test.js +1 -1
- package/dist/lib/hooks/useEvent.test.js.map +1 -1
- package/dist/lib/navigation/pathMatcher.d.ts +8 -0
- package/dist/lib/navigation/pathMatcher.js +62 -0
- package/dist/lib/navigation/pathMatcher.js.map +1 -0
- package/dist/lib/navigation/pathMatcher.test.d.ts +1 -0
- package/dist/lib/navigation/pathMatcher.test.js +115 -0
- package/dist/lib/navigation/pathMatcher.test.js.map +1 -0
- package/dist/lib/navigation/positionItems.d.ts +10 -0
- package/dist/lib/navigation/positionItems.js +54 -0
- package/dist/lib/navigation/positionItems.js.map +1 -0
- package/dist/lib/navigation/positionItems.test.d.ts +1 -0
- package/dist/lib/navigation/positionItems.test.js +229 -0
- package/dist/lib/navigation/positionItems.test.js.map +1 -0
- package/dist/lib/oas/graphql/circular.d.ts +2 -0
- package/dist/lib/oas/graphql/circular.js +21 -16
- package/dist/lib/oas/graphql/circular.js.map +1 -1
- package/dist/lib/oas/graphql/circular.test.d.ts +1 -0
- package/dist/lib/oas/graphql/circular.test.js +183 -0
- package/dist/lib/oas/graphql/circular.test.js.map +1 -0
- package/dist/lib/oas/graphql/index.js +7 -3
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/index.d.ts +1 -0
- package/dist/lib/oas/parser/index.js +14 -5
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +9 -172
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.d.ts +11 -4
- package/dist/lib/plugins/api-keys/index.js +36 -22
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/api-keys/settings/ApiKeyItem.d.ts +12 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js +133 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyItem.js.map +1 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.d.ts +4 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.js +33 -0
- package/dist/lib/plugins/api-keys/settings/ApiKeyList.js.map +1 -0
- package/dist/lib/plugins/api-keys/settings/RevealApiKey.d.ts +6 -0
- package/dist/lib/plugins/api-keys/settings/RevealApiKey.js +39 -0
- package/dist/lib/plugins/api-keys/settings/RevealApiKey.js.map +1 -0
- package/dist/lib/plugins/openapi/DownloadSchemaButton.d.ts +3 -0
- package/dist/lib/plugins/openapi/DownloadSchemaButton.js +47 -0
- package/dist/lib/plugins/openapi/DownloadSchemaButton.js.map +1 -0
- package/dist/lib/plugins/openapi/Endpoint.js +3 -6
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/GeneratedExampleSidecarBox.js +1 -1
- package/dist/lib/plugins/openapi/OasProvider.js +26 -13
- package/dist/lib/plugins/openapi/OasProvider.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +20 -10
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +2 -2
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/ParamInfos.js +1 -0
- package/dist/lib/plugins/openapi/ParamInfos.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/ResponsesSidecarBox.d.ts +2 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +4 -3
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaList.js +2 -1
- package/dist/lib/plugins/openapi/SchemaList.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +12 -3
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +11 -5
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +19 -13
- package/dist/lib/plugins/openapi/playground/Playground.js +8 -4
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/fileUtils.d.ts +1 -0
- package/dist/lib/plugins/openapi/playground/fileUtils.js +3 -0
- package/dist/lib/plugins/openapi/playground/fileUtils.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.d.ts +6 -0
- package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.js +20 -0
- package/dist/lib/plugins/openapi/playground/result-panel/AudioPlayer.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js +7 -2
- package/dist/lib/plugins/openapi/playground/result-panel/ResponseTab.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.d.ts +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +16 -7
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/utils.d.ts +2 -2
- package/dist/lib/plugins/openapi/schema/utils.js +11 -3
- package/dist/lib/plugins/openapi/schema/utils.js.map +1 -1
- package/dist/lib/plugins/openapi/util/createHttpSnippet.js +24 -1
- package/dist/lib/plugins/openapi/util/createHttpSnippet.js.map +1 -1
- package/dist/lib/plugins/openapi/util/getRoutes.d.ts +9 -1
- package/dist/lib/plugins/openapi/util/getRoutes.js +30 -2
- package/dist/lib/plugins/openapi/util/getRoutes.js.map +1 -1
- package/dist/lib/plugins/search-pagefind/IndexingDialog.d.ts +3 -0
- package/dist/lib/plugins/search-pagefind/IndexingDialog.js +64 -0
- package/dist/lib/plugins/search-pagefind/IndexingDialog.js.map +1 -0
- package/dist/lib/plugins/search-pagefind/PagefindSearch.js +22 -5
- package/dist/lib/plugins/search-pagefind/PagefindSearch.js.map +1 -1
- package/dist/lib/plugins/search-pagefind/ResultList.js +5 -4
- package/dist/lib/plugins/search-pagefind/ResultList.js.map +1 -1
- package/dist/lib/shiki.d.ts +1 -1
- package/dist/lib/shiki.js +18 -12
- package/dist/lib/shiki.js.map +1 -1
- package/dist/lib/ui/Alert.d.ts +3 -2
- package/dist/lib/ui/Alert.js +9 -5
- package/dist/lib/ui/Alert.js.map +1 -1
- package/dist/lib/ui/Button.d.ts +2 -2
- package/dist/lib/ui/Button.js +10 -9
- package/dist/lib/ui/Button.js.map +1 -1
- package/dist/lib/ui/ButtonGroup.d.ts +11 -0
- package/dist/lib/ui/ButtonGroup.js +28 -0
- package/dist/lib/ui/ButtonGroup.js.map +1 -0
- package/dist/lib/ui/Command.d.ts +3 -3
- package/dist/lib/ui/Command.js +2 -2
- package/dist/lib/ui/Command.js.map +1 -1
- package/dist/lib/ui/DropdownMenu.d.ts +21 -23
- package/dist/lib/ui/DropdownMenu.js +47 -32
- package/dist/lib/ui/DropdownMenu.js.map +1 -1
- package/dist/lib/ui/InputGroup.d.ts +16 -0
- package/dist/lib/ui/InputGroup.js +65 -0
- package/dist/lib/ui/InputGroup.js.map +1 -0
- package/dist/lib/ui/Kbd.d.ts +3 -0
- package/dist/lib/ui/Kbd.js +10 -0
- package/dist/lib/ui/Kbd.js.map +1 -0
- package/dist/lib/ui/Secret.js +2 -2
- package/dist/lib/ui/Secret.js.map +1 -1
- package/dist/lib/util/MdxComponents.d.ts +1 -0
- package/dist/lib/util/MdxComponents.js +2 -0
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/flattenAllOf.d.ts +0 -2
- package/dist/lib/util/flattenAllOf.js +0 -23
- package/dist/lib/util/flattenAllOf.js.map +1 -1
- package/dist/lib/util/flattenAllOf.test.js +69 -13
- package/dist/lib/util/flattenAllOf.test.js.map +1 -1
- package/dist/lib/util/flattenAllOfProcessor.d.ts +2 -0
- package/dist/lib/util/flattenAllOfProcessor.js +48 -0
- package/dist/lib/util/flattenAllOfProcessor.js.map +1 -0
- package/dist/lib/util/invariant.d.ts +1 -1
- package/dist/lib/util/invariant.js +2 -2
- package/dist/lib/util/invariant.js.map +1 -1
- package/dist/lib/util/readFrontmatter.d.ts +6 -0
- package/dist/lib/util/readFrontmatter.js +13 -0
- package/dist/lib/util/readFrontmatter.js.map +1 -0
- package/dist/vite/api/SchemaManager.d.ts +17 -1
- package/dist/vite/api/SchemaManager.js +52 -11
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/api/SchemaManager.test.js +111 -0
- package/dist/vite/api/SchemaManager.test.js.map +1 -1
- package/dist/vite/build.js +91 -73
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.js +16 -1
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/dev-server.js +25 -0
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/error-handler.js +1 -5
- package/dist/vite/error-handler.js.map +1 -1
- package/dist/vite/mdx/remark-inject-filepath.js +5 -1
- package/dist/vite/mdx/remark-inject-filepath.js.map +1 -1
- package/dist/vite/mdx/remark-last-modified.js +57 -3
- package/dist/vite/mdx/remark-last-modified.js.map +1 -1
- package/dist/vite/mdx/remark-link-rewrite.js +4 -3
- package/dist/vite/mdx/remark-link-rewrite.js.map +1 -1
- package/dist/vite/pagefind-dev-index.d.ts +16 -0
- package/dist/vite/pagefind-dev-index.js +68 -0
- package/dist/vite/pagefind-dev-index.js.map +1 -0
- package/dist/vite/plugin-api-keys.js +5 -1
- package/dist/vite/plugin-api-keys.js.map +1 -1
- package/dist/vite/plugin-api.js +44 -4
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-config.js +16 -4
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-docs.js +9 -7
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-frontmatter.js +3 -5
- package/dist/vite/plugin-frontmatter.js.map +1 -1
- package/dist/vite/plugin-markdown-export.js +8 -7
- package/dist/vite/plugin-markdown-export.js.map +1 -1
- package/dist/vite/plugin-theme.js +2 -1
- package/dist/vite/plugin-theme.js.map +1 -1
- package/dist/vite/prerender/prerender.js +4 -20
- package/dist/vite/prerender/prerender.js.map +1 -1
- package/dist/vite/prerender/utils.d.ts +2 -0
- package/dist/vite/prerender/utils.js +30 -0
- package/dist/vite/prerender/utils.js.map +1 -0
- package/dist/vite/prerender/worker.js +6 -1
- package/dist/vite/prerender/worker.js.map +1 -1
- package/dist/vite/zuplo.d.ts +13 -0
- package/dist/vite/zuplo.js +15 -0
- package/dist/vite/zuplo.js.map +1 -0
- package/lib/ActionButton-B0CXL1Lq.js +25 -0
- package/lib/ActionButton-B0CXL1Lq.js.map +1 -0
- package/lib/Button-GUVe7pmt.js +54 -0
- package/lib/Button-GUVe7pmt.js.map +1 -0
- package/lib/{Card-KFniaZn5.js → Card-DCdq37aA.js} +2 -2
- package/lib/{Card-KFniaZn5.js.map → Card-DCdq37aA.js.map} +1 -1
- package/lib/ClaudeLogo-DoZ7fHHk.js +73 -0
- package/lib/ClaudeLogo-DoZ7fHHk.js.map +1 -0
- package/lib/{Command-CUcrW3qs.js → Command-N6VujV30.js} +26 -26
- package/lib/Command-N6VujV30.js.map +1 -0
- package/lib/{Dialog-BQciPiHN.js → Dialog-hlvmmQ_c.js} +2 -2
- package/lib/{Dialog-BQciPiHN.js.map → Dialog-hlvmmQ_c.js.map} +1 -1
- package/lib/{Drawer-Ci7XwhqT.js → Drawer-Ch7927PF.js} +7 -7
- package/lib/{Drawer-Ci7XwhqT.js.map → Drawer-Ch7927PF.js.map} +1 -1
- package/lib/DropdownMenu-DN0jNrjj.js +104 -0
- package/lib/DropdownMenu-DN0jNrjj.js.map +1 -0
- package/lib/Frame-DKlOmSkU.js +205 -0
- package/lib/Frame-DKlOmSkU.js.map +1 -0
- package/lib/HydrationBoundary-CJu4vUlG.js +601 -0
- package/lib/HydrationBoundary-CJu4vUlG.js.map +1 -0
- package/lib/IndexingDialog-D0YdGfbn.js +100 -0
- package/lib/IndexingDialog-D0YdGfbn.js.map +1 -0
- package/lib/Input-Cx-GeKoF.js +22 -0
- package/lib/Input-Cx-GeKoF.js.map +1 -0
- package/lib/MdxPage-Bc_5OsQ5.js +210 -0
- package/lib/MdxPage-Bc_5OsQ5.js.map +1 -0
- package/lib/Mermaid-Chx5BPHn.js +104 -0
- package/lib/Mermaid-Chx5BPHn.js.map +1 -0
- package/lib/{OAuthErrorPage-DnKnq4xK.js → OAuthErrorPage-D-VcZ5cO.js} +26 -23
- package/lib/OAuthErrorPage-D-VcZ5cO.js.map +1 -0
- package/lib/OasProvider-CZqLHoRo.js +48 -0
- package/lib/OasProvider-CZqLHoRo.js.map +1 -0
- package/lib/{OperationList-D8EDc9v7.js → OperationList-BmV1XvEY.js} +2136 -2002
- package/lib/OperationList-BmV1XvEY.js.map +1 -0
- package/lib/RouteGuard-Dns7HD7C.js +77 -0
- package/lib/RouteGuard-Dns7HD7C.js.map +1 -0
- package/lib/{SchemaList-E6lF7dID.js → SchemaList-D23IyrX5.js} +28 -27
- package/lib/SchemaList-D23IyrX5.js.map +1 -0
- package/lib/SchemaView-DVbiGPo3.js +438 -0
- package/lib/SchemaView-DVbiGPo3.js.map +1 -0
- package/lib/Secret-CyhXSA8i.js +263 -0
- package/lib/Secret-CyhXSA8i.js.map +1 -0
- package/lib/SignUp-DfEe1w5X.js +55 -0
- package/lib/SignUp-DfEe1w5X.js.map +1 -0
- package/lib/{SyntaxHighlight-C19vH0V_.js → SyntaxHighlight-N2RffYNz.js} +1469 -1411
- package/lib/SyntaxHighlight-N2RffYNz.js.map +1 -0
- package/lib/{Toc-DbWS75JZ.js → Toc-Cpo_HSYx.js} +3 -3
- package/lib/{Toc-DbWS75JZ.js.map → Toc-Cpo_HSYx.js.map} +1 -1
- package/lib/{ErrorAlert-_1Zmhr68.js → Zudoku-GbutmWzP.js} +5663 -4482
- package/lib/Zudoku-GbutmWzP.js.map +1 -0
- package/lib/ZudokuContext-LPkD2SQs.js +250 -0
- package/lib/ZudokuContext-LPkD2SQs.js.map +1 -0
- package/lib/ZudokuReactContext-DGJAP1sN.js +222 -0
- package/lib/ZudokuReactContext-DGJAP1sN.js.map +1 -0
- package/lib/chunk-EPOLDU6W-C6C8jAwd.js +8558 -0
- package/lib/chunk-EPOLDU6W-C6C8jAwd.js.map +1 -0
- package/lib/{circular-BoYo7au5.js → circular-DfSpMuY7.js} +6429 -6019
- package/lib/circular-DfSpMuY7.js.map +1 -0
- package/lib/{cn-dYga0KKN.js → cn-5-Gd1Dss.js} +531 -498
- package/lib/cn-5-Gd1Dss.js.map +1 -0
- package/lib/{createServer-B_BZ7xX8.js → createServer-4kaAMuIM.js} +2790 -2737
- package/lib/createServer-4kaAMuIM.js.map +1 -0
- package/lib/createVariantComponent-Dc0vtOvr.js +18 -0
- package/lib/createVariantComponent-Dc0vtOvr.js.map +1 -0
- package/lib/{errors-CD873hrG.js → errors-CtZTDEB6.js} +3 -3
- package/lib/{errors-CD873hrG.js.map → errors-CtZTDEB6.js.map} +1 -1
- package/lib/firebase-D286uF4e.js +7615 -0
- package/lib/firebase-D286uF4e.js.map +1 -0
- package/lib/hook-DyEn6D2Q.js +53 -0
- package/lib/hook-DyEn6D2Q.js.map +1 -0
- package/lib/{index-HNVs5cgX.js → index-B7bvsQHg.js} +853 -802
- package/lib/index-B7bvsQHg.js.map +1 -0
- package/lib/{index-BK0jKRrX.js → index-CVumYRba.js} +2 -2
- package/lib/{index-BK0jKRrX.js.map → index-CVumYRba.js.map} +1 -1
- package/lib/index-CrcNWbel.js.map +1 -1
- package/lib/index-DAWHN3cH.js +86 -0
- package/lib/index-DAWHN3cH.js.map +1 -0
- package/lib/index.esm-BYObtETB.js.map +1 -1
- package/lib/index.esm-BkpWrvLZ.js +34 -0
- package/lib/index.esm-BkpWrvLZ.js.map +1 -0
- package/lib/{index.esm-BnYHxCYC.js → index.esm-Ca5zvoff.js} +2 -2
- package/lib/{index.esm-BnYHxCYC.js.map → index.esm-Ca5zvoff.js.map} +1 -1
- package/lib/{invariant-Bm-FVUQE.js → invariant-B_t_F2s_.js} +4 -4
- package/lib/invariant-B_t_F2s_.js.map +1 -0
- package/lib/jsx-runtime-BzflLqGi.js.map +1 -1
- package/lib/{mutation-BSU0xu4m.js → mutation-B7eFBLZY.js} +70 -44
- package/lib/mutation-B7eFBLZY.js.map +1 -0
- package/lib/ui/Accordion.js +1 -1
- package/lib/ui/ActionButton.js +2 -2
- package/lib/ui/Alert.js +32 -20
- package/lib/ui/Alert.js.map +1 -1
- package/lib/ui/AlertDialog.js +1 -1
- package/lib/ui/Badge.js +1 -1
- package/lib/ui/Breadcrumb.js +1 -1
- package/lib/ui/Button.js +27 -25
- package/lib/ui/Button.js.map +1 -1
- package/lib/ui/ButtonGroup.js +77 -0
- package/lib/ui/ButtonGroup.js.map +1 -0
- package/lib/ui/Callout.js +1 -1
- package/lib/ui/Card.js +1 -1
- package/lib/ui/Carousel.js +1 -1
- package/lib/ui/Carousel.js.map +1 -1
- package/lib/ui/Checkbox.js +1 -1
- package/lib/ui/CodeBlock.js +1 -1
- package/lib/ui/Command.js +5 -5
- package/lib/ui/Command.js.map +1 -1
- package/lib/ui/Dialog.js +1 -1
- package/lib/ui/Drawer.js +3 -3
- package/lib/ui/DropdownMenu.js +227 -140
- package/lib/ui/DropdownMenu.js.map +1 -1
- package/lib/ui/EmbeddedCodeBlock.js +1 -1
- package/lib/ui/Form.js +1 -1
- package/lib/ui/Frame.js +1 -1
- package/lib/ui/HoverCard.js +1 -1
- package/lib/ui/Input.js +1 -1
- package/lib/ui/InputGroup.js +155 -0
- package/lib/ui/InputGroup.js.map +1 -0
- package/lib/ui/Item.js +1 -1
- package/lib/ui/Kbd.js +32 -0
- package/lib/ui/Kbd.js.map +1 -0
- package/lib/ui/Label.js +1 -1
- package/lib/ui/NativeSelect.js +1 -1
- package/lib/ui/Pagination.js +1 -1
- package/lib/ui/Popover.js +1 -1
- package/lib/ui/Progress.js +1 -1
- package/lib/ui/RadioGroup.js +1 -1
- package/lib/ui/ScrollArea.js +1 -1
- package/lib/ui/Secret.js +3 -3
- package/lib/ui/Secret.js.map +1 -1
- package/lib/ui/Separator.js +1 -1
- package/lib/ui/Skeleton.js +1 -1
- package/lib/ui/Slider.js +1 -1
- package/lib/ui/Switch.js +1 -1
- package/lib/ui/SyntaxHighlight.js +3 -3
- package/lib/ui/Tabs.js +1 -1
- package/lib/ui/Textarea.js +1 -1
- package/lib/ui/Toggle.js +1 -1
- package/lib/ui/ToggleGroup.js +1 -1
- package/lib/ui/Value.js +1 -1
- package/lib/ui/util.js +1 -1
- package/lib/useExposedProps-CzTDfXfq.js +30 -0
- package/lib/useExposedProps-CzTDfXfq.js.map +1 -0
- package/lib/useMutation-CErliDZ9.js +119 -0
- package/lib/useMutation-CErliDZ9.js.map +1 -0
- package/lib/useQuery-ht7aWJ3S.js +1212 -0
- package/lib/useQuery-ht7aWJ3S.js.map +1 -0
- package/lib/useSuspenseQuery-DQH4Bmc2.js +18 -0
- package/lib/useSuspenseQuery-DQH4Bmc2.js.map +1 -0
- package/lib/zudoku.__internal.js +1540 -1553
- package/lib/zudoku.__internal.js.map +1 -1
- package/lib/zudoku.auth-auth0.js +19 -18
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-azureb2c.js +14 -13
- package/lib/zudoku.auth-azureb2c.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +52 -75
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-firebase.js +10 -0
- package/lib/zudoku.auth-firebase.js.map +1 -0
- package/lib/zudoku.auth-openid.js +8 -7
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.auth-supabase.js +31 -40
- package/lib/zudoku.auth-supabase.js.map +1 -1
- package/lib/zudoku.components.js +29 -25
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +20 -20
- package/lib/zudoku.hooks.js.map +1 -1
- package/lib/zudoku.mermaid.js +11 -0
- package/lib/zudoku.mermaid.js.map +1 -0
- package/lib/zudoku.plugin-api-catalog.js +42 -37
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +617 -550
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-openapi.js +3 -3
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +186 -226
- package/lib/zudoku.plugin-search-pagefind.js.map +1 -1
- package/lib/zudoku.plugins.js +9 -8
- package/lib/zudoku.plugins.js.map +1 -1
- package/lib/zudoku.react-query.js +441 -0
- package/lib/zudoku.react-query.js.map +1 -0
- package/lib/zudoku.router.js +1130 -1404
- package/lib/zudoku.router.js.map +1 -1
- package/package.json +63 -37
- package/src/app/defaultTheme.css +4 -0
- package/src/app/main.css +2 -0
- package/src/app/main.tsx +1 -1
- package/src/app/sentry.ts +1 -1
- package/src/lib/auth/issuer.ts +1 -1
- package/src/lib/authentication/authentication.ts +8 -2
- package/src/lib/authentication/components/CallbackHandler.tsx +1 -1
- package/src/lib/authentication/components/SignIn.tsx +5 -2
- package/src/lib/authentication/components/SignUp.tsx +5 -2
- package/src/lib/authentication/hook.ts +16 -0
- package/src/lib/authentication/providers/auth0.tsx +21 -10
- package/src/lib/authentication/providers/clerk.tsx +0 -26
- package/src/lib/authentication/providers/firebase.tsx +98 -6
- package/src/lib/authentication/providers/supabase.tsx +6 -15
- package/src/lib/authentication/ui/EmailVerificationUi.tsx +129 -0
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +181 -39
- package/src/lib/authentication/utils/relativeRedirectUrl.ts +12 -0
- package/src/lib/components/Bootstrap.tsx +1 -4
- package/src/lib/components/Mermaid.tsx +68 -0
- package/src/lib/components/MobileTopNavigation.tsx +16 -9
- package/src/lib/components/PagefindSearchMeta.tsx +14 -0
- package/src/lib/components/Pagination.tsx +4 -5
- package/src/lib/components/Slot.test.tsx +1 -1
- package/src/lib/components/TopNavigation.tsx +26 -8
- package/src/lib/components/Zudoku.tsx +22 -21
- package/src/lib/components/context/ZudokuContext.ts +33 -12
- package/src/lib/components/context/ZudokuProvider.tsx +1 -1
- package/src/lib/components/context/ZudokuReactContext.tsx +17 -0
- package/src/lib/components/index.ts +19 -35
- package/src/lib/components/navigation/Navigation.tsx +4 -3
- package/src/lib/components/navigation/NavigationCategory.tsx +9 -0
- package/src/lib/components/navigation/NavigationFilterContext.tsx +28 -0
- package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -0
- package/src/lib/components/navigation/NavigationItem.tsx +26 -4
- package/src/lib/components/navigation/NavigationWrapper.tsx +1 -1
- package/src/lib/components/navigation/utils.ts +44 -2
- package/src/lib/core/RouteGuard.tsx +30 -24
- package/src/lib/core/ZudokuContext.ts +7 -1
- package/src/lib/core/__internal.tsx +2 -0
- package/src/lib/core/plugins.ts +27 -3
- package/src/lib/core/react-query.ts +1 -0
- package/src/lib/core/transform-config.test.tsx +99 -0
- package/src/lib/core/transform-config.ts +67 -0
- package/src/lib/errors/ErrorAlert.tsx +1 -6
- package/src/lib/errors/ErrorMessage.tsx +38 -0
- package/src/lib/hooks/index.ts +7 -16
- package/src/lib/hooks/useEvent.test.tsx +1 -1
- package/src/lib/navigation/pathMatcher.test.ts +136 -0
- package/src/lib/navigation/pathMatcher.ts +93 -0
- package/src/lib/navigation/positionItems.test.ts +265 -0
- package/src/lib/navigation/positionItems.ts +111 -0
- package/src/lib/oas/graphql/circular.test.ts +221 -0
- package/src/lib/oas/graphql/circular.ts +31 -18
- package/src/lib/oas/graphql/index.ts +7 -3
- package/src/lib/oas/parser/index.ts +19 -6
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +36 -476
- package/src/lib/plugins/api-keys/index.tsx +76 -32
- package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -0
- package/src/lib/plugins/api-keys/settings/ApiKeyList.tsx +67 -0
- package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +124 -0
- package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +115 -0
- package/src/lib/plugins/openapi/Endpoint.tsx +20 -27
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +1 -1
- package/src/lib/plugins/openapi/OasProvider.tsx +38 -17
- package/src/lib/plugins/openapi/OperationList.tsx +48 -28
- package/src/lib/plugins/openapi/OperationListItem.tsx +5 -5
- package/src/lib/plugins/openapi/ParamInfos.tsx +1 -0
- package/src/lib/plugins/openapi/ParameterList.tsx +2 -2
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +37 -15
- package/src/lib/plugins/openapi/SchemaList.tsx +4 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +20 -3
- package/src/lib/plugins/openapi/index.tsx +16 -7
- package/src/lib/plugins/openapi/interfaces.ts +21 -7
- package/src/lib/plugins/openapi/playground/Playground.tsx +8 -4
- package/src/lib/plugins/openapi/playground/fileUtils.ts +4 -0
- package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -0
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +33 -17
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +56 -43
- package/src/lib/plugins/openapi/schema/utils.ts +20 -6
- package/src/lib/plugins/openapi/util/createHttpSnippet.ts +29 -1
- package/src/lib/plugins/openapi/util/getRoutes.tsx +38 -3
- package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +163 -0
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +61 -22
- package/src/lib/plugins/search-pagefind/ResultList.tsx +8 -3
- package/src/lib/shiki.ts +21 -12
- package/src/lib/ui/Alert.tsx +17 -5
- package/src/lib/ui/Button.tsx +11 -10
- package/src/lib/ui/ButtonGroup.tsx +82 -0
- package/src/lib/ui/Command.tsx +3 -3
- package/src/lib/ui/DropdownMenu.tsx +226 -170
- package/src/lib/ui/InputGroup.tsx +168 -0
- package/src/lib/ui/Kbd.tsx +28 -0
- package/src/lib/ui/Secret.tsx +2 -2
- package/src/lib/util/MdxComponents.tsx +2 -0
- package/src/lib/util/flattenAllOf.test.ts +73 -20
- package/src/lib/util/flattenAllOf.ts +0 -36
- package/src/lib/util/flattenAllOfProcessor.ts +58 -0
- package/src/lib/util/invariant.ts +2 -1
- package/src/lib/util/readFrontmatter.ts +14 -0
- package/src/shiki/langs/c3.js +1 -0
- package/src/shiki/langs/gn.js +1 -0
- package/src/shiki/langs/markdown-nix.js +1 -0
- package/src/shiki/langs/moonbit.js +1 -0
- package/src/shiki/langs/openscad.js +1 -0
- package/src/zuplo/enrich-with-zuplo-mcp.ts +168 -0
- package/src/zuplo/enrich-with-zuplo.ts +254 -0
- package/src/zuplo/policy-types.ts +46 -0
- package/src/zuplo/with-zuplo-processors.ts +35 -0
- package/src/zuplo/with-zuplo.ts +14 -0
- package/dist/vite/create-pagefind-index.d.ts +0 -4
- package/dist/vite/create-pagefind-index.js +0 -12
- package/dist/vite/create-pagefind-index.js.map +0 -1
- package/lib/Button-B3ucvvQw.js +0 -52
- package/lib/Button-B3ucvvQw.js.map +0 -1
- package/lib/Command-CUcrW3qs.js.map +0 -1
- package/lib/DropdownMenu-BZ2NKQ3K.js +0 -126
- package/lib/DropdownMenu-BZ2NKQ3K.js.map +0 -1
- package/lib/ErrorAlert-_1Zmhr68.js.map +0 -1
- package/lib/MdxPage-B2t1EShN.js +0 -240
- package/lib/MdxPage-B2t1EShN.js.map +0 -1
- package/lib/OAuthErrorPage-DnKnq4xK.js.map +0 -1
- package/lib/OasProvider-BhuIkD4Z.js +0 -36
- package/lib/OasProvider-BhuIkD4Z.js.map +0 -1
- package/lib/OperationList-D8EDc9v7.js.map +0 -1
- package/lib/Pagination-hk-llhpw.js +0 -37
- package/lib/Pagination-hk-llhpw.js.map +0 -1
- package/lib/RouteGuard-Brz95MSt.js +0 -77
- package/lib/RouteGuard-Brz95MSt.js.map +0 -1
- package/lib/RouterError-CMaIfdjb.js +0 -42
- package/lib/RouterError-CMaIfdjb.js.map +0 -1
- package/lib/SchemaList-E6lF7dID.js.map +0 -1
- package/lib/SchemaView-CIv-OXgv.js +0 -572
- package/lib/SchemaView-CIv-OXgv.js.map +0 -1
- package/lib/Select-DFRCS31-.js +0 -399
- package/lib/Select-DFRCS31-.js.map +0 -1
- package/lib/SignUp-sGYAsj2K.js +0 -50
- package/lib/SignUp-sGYAsj2K.js.map +0 -1
- package/lib/SyntaxHighlight-C19vH0V_.js.map +0 -1
- package/lib/ZudokuContext-BUZ5hkWB.js +0 -1508
- package/lib/ZudokuContext-BUZ5hkWB.js.map +0 -1
- package/lib/chunk-PVWAREVJ-BMhpCH5D.js +0 -7965
- package/lib/chunk-PVWAREVJ-BMhpCH5D.js.map +0 -1
- package/lib/circular-BoYo7au5.js.map +0 -1
- package/lib/cn-dYga0KKN.js.map +0 -1
- package/lib/createServer-B_BZ7xX8.js.map +0 -1
- package/lib/hook-CMeoxziF.js +0 -40
- package/lib/hook-CMeoxziF.js.map +0 -1
- package/lib/index-HNVs5cgX.js.map +0 -1
- package/lib/index-pMMX55GH.js +0 -1059
- package/lib/index-pMMX55GH.js.map +0 -1
- package/lib/invariant-Bm-FVUQE.js.map +0 -1
- package/lib/mutation-BSU0xu4m.js.map +0 -1
- package/lib/useExposedProps-U3pmsHaG.js +0 -113
- package/lib/useExposedProps-U3pmsHaG.js.map +0 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ExternalLinkIcon } from "lucide-react";
|
|
2
2
|
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { NavLink, useLocation } from "react-router";
|
|
4
|
+
import { Separator } from "zudoku/ui/Separator.js";
|
|
4
5
|
import { Tooltip, TooltipContent, TooltipTrigger } from "zudoku/ui/Tooltip.js";
|
|
5
6
|
import type { NavigationItem as NavigationItemType } from "../../../config/validators/NavigationSchema.js";
|
|
6
7
|
import { useAuth } from "../../authentication/hook.js";
|
|
@@ -11,6 +12,8 @@ import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
|
|
|
11
12
|
import { useZudoku } from "../context/ZudokuContext.js";
|
|
12
13
|
import { NavigationBadge } from "./NavigationBadge.js";
|
|
13
14
|
import { NavigationCategory } from "./NavigationCategory.js";
|
|
15
|
+
import { useNavigationFilter } from "./NavigationFilterContext.js";
|
|
16
|
+
import { NavigationFilterInput } from "./NavigationFilterInput.js";
|
|
14
17
|
import { navigationListItem, shouldShowItem } from "./utils.js";
|
|
15
18
|
|
|
16
19
|
const TruncatedLabel = ({
|
|
@@ -65,8 +68,9 @@ export const NavigationItem = ({
|
|
|
65
68
|
const { activeAnchor } = useViewportAnchor();
|
|
66
69
|
const auth = useAuth();
|
|
67
70
|
const context = useZudoku();
|
|
71
|
+
const { query } = useNavigationFilter();
|
|
68
72
|
|
|
69
|
-
if (!shouldShowItem(auth, context)(item)) {
|
|
73
|
+
if (!shouldShowItem({ auth, context, filterQuery: query })(item)) {
|
|
70
74
|
return null;
|
|
71
75
|
}
|
|
72
76
|
|
|
@@ -75,6 +79,18 @@ export const NavigationItem = ({
|
|
|
75
79
|
return (
|
|
76
80
|
<NavigationCategory category={item} onRequestClose={onRequestClose} />
|
|
77
81
|
);
|
|
82
|
+
case "separator":
|
|
83
|
+
return (
|
|
84
|
+
<Separator className="my-1 mx-auto w-[calc(100%-var(--padding-nav-item)*2)]!" />
|
|
85
|
+
);
|
|
86
|
+
case "section":
|
|
87
|
+
return (
|
|
88
|
+
<div className="mt-4 px-(--padding-nav-item) text-xs font-semibold text-muted-foreground uppercase tracking-wider">
|
|
89
|
+
{item.label}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
case "filter":
|
|
93
|
+
return <NavigationFilterInput placeholder={item.placeholder} />;
|
|
78
94
|
case "doc":
|
|
79
95
|
return (
|
|
80
96
|
<NavLink
|
|
@@ -86,7 +102,9 @@ export const NavigationItem = ({
|
|
|
86
102
|
onClick={onRequestClose}
|
|
87
103
|
end
|
|
88
104
|
>
|
|
89
|
-
{item.icon &&
|
|
105
|
+
{item.icon && (
|
|
106
|
+
<item.icon size={16} className="align-[-0.125em] shrink-0" />
|
|
107
|
+
)}
|
|
90
108
|
{item.badge ? (
|
|
91
109
|
<>
|
|
92
110
|
{item.label && (
|
|
@@ -117,7 +135,9 @@ export const NavigationItem = ({
|
|
|
117
135
|
})}
|
|
118
136
|
onClick={onRequestClose}
|
|
119
137
|
>
|
|
120
|
-
{item.icon &&
|
|
138
|
+
{item.icon && (
|
|
139
|
+
<item.icon size={16} className="align-[-0.125em] shrink-0" />
|
|
140
|
+
)}
|
|
121
141
|
{item.badge ? (
|
|
122
142
|
<>
|
|
123
143
|
{item.label && <TruncatedLabel label={item.label} />}
|
|
@@ -135,7 +155,9 @@ export const NavigationItem = ({
|
|
|
135
155
|
rel="noopener noreferrer"
|
|
136
156
|
onClick={onRequestClose}
|
|
137
157
|
>
|
|
138
|
-
{item.icon &&
|
|
158
|
+
{item.icon && (
|
|
159
|
+
<item.icon size={16} className="align-[-0.125em] shrink-0" />
|
|
160
|
+
)}
|
|
139
161
|
<span className="whitespace-normal">{item.label}</span>
|
|
140
162
|
{/* This prevents that the icon would be positioned in its own line if the text fills a line entirely */}
|
|
141
163
|
<span className="whitespace-nowrap">
|
|
@@ -27,7 +27,7 @@ export const NavigationWrapper = ({
|
|
|
27
27
|
ref={navRef}
|
|
28
28
|
className={cn(
|
|
29
29
|
"hidden max-w-[calc(var(--side-nav-width)+var(--padding-nav-item))] lg:flex scrollbar flex-col overflow-y-auto shrink-0 text-sm pe-3 ps-4 lg:ps-8",
|
|
30
|
-
"-mx-(--padding-nav-item) pb-[8vh] pt-(--padding-content-top) scroll-pt-2
|
|
30
|
+
"-mx-(--padding-nav-item) pb-[8vh] pt-(--padding-content-top) scroll-pt-2",
|
|
31
31
|
// Revert the padding/margin on the first child
|
|
32
32
|
"-mt-2.5",
|
|
33
33
|
className,
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
} from "../../../config/validators/NavigationSchema.js";
|
|
7
7
|
import type { UseAuthReturn } from "../../authentication/hook.js";
|
|
8
8
|
import type { ZudokuContext } from "../../core/ZudokuContext.js";
|
|
9
|
+
import { isPositionedItem } from "../../navigation/positionItems.js";
|
|
9
10
|
import { joinUrl } from "../../util/joinUrl.js";
|
|
10
11
|
import { useCurrentNavigation } from "../context/ZudokuContext.js";
|
|
11
12
|
|
|
@@ -86,6 +87,13 @@ export const usePrevNext = (): {
|
|
|
86
87
|
let foundCurrent = false;
|
|
87
88
|
|
|
88
89
|
traverseNavigation(navigation, (item) => {
|
|
90
|
+
if (
|
|
91
|
+
item.type === "separator" ||
|
|
92
|
+
item.type === "section" ||
|
|
93
|
+
item.type === "filter"
|
|
94
|
+
)
|
|
95
|
+
return;
|
|
96
|
+
|
|
89
97
|
const itemId =
|
|
90
98
|
item.type === "doc"
|
|
91
99
|
? joinUrl(item.path)
|
|
@@ -111,7 +119,7 @@ export const usePrevNext = (): {
|
|
|
111
119
|
};
|
|
112
120
|
|
|
113
121
|
export const navigationListItem = cva(
|
|
114
|
-
"relative flex items-center gap-2 px-(--padding-nav-item) my-
|
|
122
|
+
"relative flex items-center gap-2 px-(--padding-nav-item) my-px py-1.5 rounded-lg hover:bg-accent tabular-nums",
|
|
115
123
|
{
|
|
116
124
|
variants: {
|
|
117
125
|
isActive: {
|
|
@@ -133,9 +141,43 @@ export const navigationListItem = cva(
|
|
|
133
141
|
},
|
|
134
142
|
);
|
|
135
143
|
|
|
144
|
+
export const itemMatchesFilter = (
|
|
145
|
+
item: NavigationItem,
|
|
146
|
+
query: string,
|
|
147
|
+
): boolean => {
|
|
148
|
+
if (["separator", "section", "filter"].includes(item.type)) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
if (item.label?.toLowerCase().includes(query.toLowerCase())) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (item.type === "category") {
|
|
156
|
+
return item.items.some((child) => itemMatchesFilter(child, query));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return false;
|
|
160
|
+
};
|
|
161
|
+
|
|
136
162
|
export const shouldShowItem =
|
|
137
|
-
(
|
|
163
|
+
({
|
|
164
|
+
auth,
|
|
165
|
+
context,
|
|
166
|
+
filterQuery,
|
|
167
|
+
}: {
|
|
168
|
+
auth: UseAuthReturn;
|
|
169
|
+
context: ZudokuContext;
|
|
170
|
+
filterQuery?: string;
|
|
171
|
+
}) =>
|
|
138
172
|
(item: NavigationItem): boolean => {
|
|
173
|
+
if (item.type === "filter") return true;
|
|
174
|
+
|
|
175
|
+
if (isPositionedItem(item)) return false;
|
|
176
|
+
|
|
177
|
+
if (filterQuery?.trim() && !itemMatchesFilter(item, filterQuery)) {
|
|
178
|
+
return false;
|
|
179
|
+
}
|
|
180
|
+
|
|
139
181
|
if (typeof item.display === "function") {
|
|
140
182
|
return item.display({ context, auth });
|
|
141
183
|
}
|
|
@@ -27,16 +27,31 @@ export const RouteGuard = () => {
|
|
|
27
27
|
const shouldBypass = use(BypassProtectedRoutesContext);
|
|
28
28
|
const { protectedRoutes } = zudoku.options;
|
|
29
29
|
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
: undefined;
|
|
30
|
+
const protectedRouteEntry = protectedRoutes
|
|
31
|
+
? Object.entries(protectedRoutes).find(([path]) =>
|
|
32
|
+
matchPath({ path, end: true }, location.pathname),
|
|
33
|
+
)
|
|
34
|
+
: undefined;
|
|
36
35
|
|
|
37
|
-
const isProtectedRoute =
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
const isProtectedRoute = protectedRouteEntry !== undefined;
|
|
37
|
+
|
|
38
|
+
// SSR/prerendering mode: render content with search meta tag, skip all auth
|
|
39
|
+
if (shouldBypass) {
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
{isProtectedRoute && (
|
|
43
|
+
<Helmet>
|
|
44
|
+
<meta
|
|
45
|
+
name="pagefind"
|
|
46
|
+
data-pagefind-filter={`section:${SEARCH_PROTECTED_SECTION}`}
|
|
47
|
+
content="true"
|
|
48
|
+
/>
|
|
49
|
+
</Helmet>
|
|
50
|
+
)}
|
|
51
|
+
<Outlet />
|
|
52
|
+
</>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
40
55
|
|
|
41
56
|
if (isProtectedRoute && !auth.isAuthEnabled) {
|
|
42
57
|
throw new ZudokuError("Authentication is not enabled", {
|
|
@@ -46,6 +61,10 @@ export const RouteGuard = () => {
|
|
|
46
61
|
});
|
|
47
62
|
}
|
|
48
63
|
|
|
64
|
+
const authCheckFn = protectedRouteEntry?.[1];
|
|
65
|
+
const needsToSignIn =
|
|
66
|
+
isProtectedRoute && !authCheckFn?.({ auth, context: zudoku });
|
|
67
|
+
|
|
49
68
|
if (needsToSignIn && auth.isPending && typeof window !== "undefined") {
|
|
50
69
|
return null;
|
|
51
70
|
}
|
|
@@ -91,7 +110,7 @@ export const RouteGuard = () => {
|
|
|
91
110
|
)
|
|
92
111
|
}
|
|
93
112
|
>
|
|
94
|
-
Login
|
|
113
|
+
Login
|
|
95
114
|
</Button>
|
|
96
115
|
</DialogFooter>
|
|
97
116
|
</DialogContent>
|
|
@@ -99,18 +118,5 @@ export const RouteGuard = () => {
|
|
|
99
118
|
);
|
|
100
119
|
}
|
|
101
120
|
|
|
102
|
-
return
|
|
103
|
-
<>
|
|
104
|
-
{shouldBypass && (
|
|
105
|
-
<Helmet>
|
|
106
|
-
<meta
|
|
107
|
-
name="pagefind"
|
|
108
|
-
data-pagefind-filter={`section:${SEARCH_PROTECTED_SECTION}`}
|
|
109
|
-
content="true"
|
|
110
|
-
/>
|
|
111
|
-
</Helmet>
|
|
112
|
-
)}
|
|
113
|
-
<Outlet />
|
|
114
|
-
</>
|
|
115
|
-
);
|
|
121
|
+
return <Outlet />;
|
|
116
122
|
};
|
|
@@ -132,10 +132,15 @@ export class ZudokuContext {
|
|
|
132
132
|
public readonly getAuthState: () => AuthState;
|
|
133
133
|
public readonly queryClient: QueryClient;
|
|
134
134
|
public readonly options: ZudokuContextOptions;
|
|
135
|
+
public readonly env: Record<string, string | undefined>;
|
|
135
136
|
private readonly navigationPlugins: NavigationPlugin[];
|
|
136
137
|
private emitter = createNanoEvents<ZudokuEvents>();
|
|
137
138
|
|
|
138
|
-
constructor(
|
|
139
|
+
constructor(
|
|
140
|
+
options: ZudokuContextOptions,
|
|
141
|
+
queryClient: QueryClient,
|
|
142
|
+
env: Record<string, string | undefined>,
|
|
143
|
+
) {
|
|
139
144
|
const pluginProtectedRoutes = Object.fromEntries(
|
|
140
145
|
(options.plugins ?? []).flatMap((plugin) => {
|
|
141
146
|
if (!isNavigationPlugin(plugin)) return [];
|
|
@@ -152,6 +157,7 @@ export class ZudokuContext {
|
|
|
152
157
|
};
|
|
153
158
|
|
|
154
159
|
this.queryClient = queryClient;
|
|
160
|
+
this.env = env;
|
|
155
161
|
this.options = { ...options, protectedRoutes };
|
|
156
162
|
this.plugins = options.plugins ?? [];
|
|
157
163
|
this.navigation = options.navigation ?? [];
|
|
@@ -17,6 +17,7 @@ import { StatusPage as StatusPageImport } from "../components/StatusPage.js";
|
|
|
17
17
|
import { RouterError as RouterErrorImport } from "../errors/RouterError.js";
|
|
18
18
|
import { ServerError as ServerErrorImport } from "../errors/ServerError.js";
|
|
19
19
|
import { RouteGuard as RouteGuardImport } from "./RouteGuard.js";
|
|
20
|
+
import { runPluginTransformConfig as runPluginTransformConfigImport } from "./transform-config.js";
|
|
20
21
|
|
|
21
22
|
export const Layout = LayoutImport;
|
|
22
23
|
export const RouterError = RouterErrorImport;
|
|
@@ -28,3 +29,4 @@ export const Head = Helmet;
|
|
|
28
29
|
export const StatusPage = StatusPageImport;
|
|
29
30
|
export const BuildCheck = BuildCheckImport;
|
|
30
31
|
export const Meta = MetaImport;
|
|
32
|
+
export const runPluginTransformConfig = runPluginTransformConfigImport;
|
package/src/lib/core/plugins.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { LucideIcon } from "lucide-react";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
3
|
import type { Location, RouteObject } from "react-router";
|
|
4
4
|
import type { Navigation } from "../../config/validators/NavigationSchema.js";
|
|
5
5
|
import type { ProtectedRoutesInput } from "../../config/validators/ProtectedRoutesSchema.js";
|
|
6
|
+
import type { ZudokuConfig } from "../../config/validators/validate.js";
|
|
6
7
|
import type { AuthenticationPlugin } from "../authentication/authentication.js";
|
|
7
8
|
import type { MdxComponentsType } from "../util/MdxComponents.js";
|
|
8
9
|
import type {
|
|
@@ -18,7 +19,8 @@ export type ZudokuPlugin =
|
|
|
18
19
|
| ApiIdentityPlugin
|
|
19
20
|
| SearchProviderPlugin
|
|
20
21
|
| EventConsumerPlugin
|
|
21
|
-
| AuthenticationPlugin
|
|
22
|
+
| AuthenticationPlugin
|
|
23
|
+
| TransformConfigPlugin;
|
|
22
24
|
|
|
23
25
|
export type { AuthenticationPlugin, RouteObject };
|
|
24
26
|
|
|
@@ -60,11 +62,28 @@ export type ProfileNavigationItem = {
|
|
|
60
62
|
icon?: LucideIcon;
|
|
61
63
|
};
|
|
62
64
|
|
|
65
|
+
export interface ConfigHookContext {
|
|
66
|
+
mode: typeof process.env.ZUDOKU_ENV;
|
|
67
|
+
rootDir: string;
|
|
68
|
+
configPath: string;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface TransformConfigContext {
|
|
72
|
+
config: ZudokuConfig;
|
|
73
|
+
merge: <T extends Partial<ZudokuConfig>>(partial: T) => ZudokuConfig & T;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface TransformConfigPlugin {
|
|
77
|
+
transformConfig?: (
|
|
78
|
+
context: TransformConfigContext,
|
|
79
|
+
) => ZudokuConfig | void | Promise<ZudokuConfig | void>;
|
|
80
|
+
}
|
|
81
|
+
|
|
63
82
|
export interface CommonPlugin {
|
|
64
83
|
initialize?: (
|
|
65
84
|
context: ZudokuContext,
|
|
66
85
|
) => Promise<void | boolean> | void | boolean;
|
|
67
|
-
getHead?: (
|
|
86
|
+
getHead?: (args: { location: Location }) => ReactNode | undefined;
|
|
68
87
|
getMdxComponents?: () => MdxComponentsType;
|
|
69
88
|
}
|
|
70
89
|
|
|
@@ -110,3 +129,8 @@ export const isApiIdentityPlugin = (
|
|
|
110
129
|
obj: ZudokuPlugin,
|
|
111
130
|
): obj is ApiIdentityPlugin =>
|
|
112
131
|
"getIdentities" in obj && typeof obj.getIdentities === "function";
|
|
132
|
+
|
|
133
|
+
export const isTransformConfigPlugin = (
|
|
134
|
+
obj: ZudokuPlugin,
|
|
135
|
+
): obj is TransformConfigPlugin =>
|
|
136
|
+
"transformConfig" in obj && typeof obj.transformConfig === "function";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "@tanstack/react-query";
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { describe, expect, test } from "vitest";
|
|
2
|
+
import { isPlainObject, mergeConfig } from "./transform-config.js";
|
|
3
|
+
|
|
4
|
+
describe("isPlainObject", () => {
|
|
5
|
+
test("returns true for plain objects", () => {
|
|
6
|
+
expect(isPlainObject({})).toBe(true);
|
|
7
|
+
expect(isPlainObject({ a: 1 })).toBe(true);
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
test("returns false for arrays", () => {
|
|
11
|
+
expect(isPlainObject([])).toBe(false);
|
|
12
|
+
expect(isPlainObject([1, 2, 3])).toBe(false);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test("returns false for null and undefined", () => {
|
|
16
|
+
expect(isPlainObject(null)).toBe(false);
|
|
17
|
+
expect(isPlainObject(undefined)).toBe(false);
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
test("returns false for class instances", () => {
|
|
21
|
+
expect(isPlainObject(new Date())).toBe(false);
|
|
22
|
+
expect(isPlainObject(new Map())).toBe(false);
|
|
23
|
+
expect(isPlainObject(/regex/)).toBe(false);
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
describe("mergeConfig", () => {
|
|
28
|
+
test("merges flat objects", () => {
|
|
29
|
+
const target = { a: 1, b: 2 };
|
|
30
|
+
const source = { b: 3, c: 4 };
|
|
31
|
+
expect(mergeConfig(target, source)).toEqual({ a: 1, b: 3, c: 4 });
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("merges nested objects", () => {
|
|
35
|
+
const target = { nested: { a: 1, b: 2 } } as Record<string, unknown>;
|
|
36
|
+
const source = { nested: { b: 3, c: 4 } };
|
|
37
|
+
expect(mergeConfig(target, source)).toEqual({
|
|
38
|
+
nested: { a: 1, b: 3, c: 4 },
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test("replaces arrays instead of merging", () => {
|
|
43
|
+
const target = { arr: [1, 2, 3] };
|
|
44
|
+
const source = { arr: [4, 5] };
|
|
45
|
+
expect(mergeConfig(target, source)).toEqual({ arr: [4, 5] });
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test("preserves React elements without deep cloning", () => {
|
|
49
|
+
const element = <div className="test">Hello</div>;
|
|
50
|
+
const target = { banner: { message: "old" } };
|
|
51
|
+
const source = { banner: { message: element } };
|
|
52
|
+
|
|
53
|
+
const result = mergeConfig(target, source);
|
|
54
|
+
|
|
55
|
+
// Should be the exact same reference, not a clone
|
|
56
|
+
expect(result.banner.message).toBe(element);
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
test("does not clone React element children", () => {
|
|
60
|
+
const child = <strong>Bold</strong>;
|
|
61
|
+
const element = <div>{child} text</div>;
|
|
62
|
+
const target = { site: { banner: {} } };
|
|
63
|
+
const source = { site: { banner: { message: element } } };
|
|
64
|
+
|
|
65
|
+
const result = mergeConfig(target, source);
|
|
66
|
+
|
|
67
|
+
// The element should be identical (same reference)
|
|
68
|
+
expect(result.site.banner.message).toBe(element);
|
|
69
|
+
// Children should be preserved exactly
|
|
70
|
+
expect(result.site.banner.message.props.children).toBe(
|
|
71
|
+
element.props.children,
|
|
72
|
+
);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test("handles null and undefined values", () => {
|
|
76
|
+
const target = { a: 1, b: 2 };
|
|
77
|
+
const source = { a: null, c: undefined };
|
|
78
|
+
expect(mergeConfig(target, source)).toEqual({
|
|
79
|
+
a: null,
|
|
80
|
+
b: 2,
|
|
81
|
+
c: undefined,
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("replaces non-plain objects", () => {
|
|
86
|
+
const date = new Date("2024-01-01");
|
|
87
|
+
const target = { date: new Date("2020-01-01") };
|
|
88
|
+
const source = { date };
|
|
89
|
+
const result = mergeConfig(target, source);
|
|
90
|
+
expect(result.date).toBe(date);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
test("does not mutate target", () => {
|
|
94
|
+
const target = { a: 1, nested: { b: 2 } };
|
|
95
|
+
const source = { a: 2, nested: { c: 3 } };
|
|
96
|
+
mergeConfig(target, source);
|
|
97
|
+
expect(target).toEqual({ a: 1, nested: { b: 2 } });
|
|
98
|
+
});
|
|
99
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { isValidElement } from "react";
|
|
2
|
+
import type { ZudokuConfig } from "../../config/validators/validate.js";
|
|
3
|
+
import { isTransformConfigPlugin } from "./plugins.js";
|
|
4
|
+
|
|
5
|
+
export const isPlainObject = (
|
|
6
|
+
value: unknown,
|
|
7
|
+
): value is Record<string, unknown> =>
|
|
8
|
+
typeof value === "object" &&
|
|
9
|
+
value !== null &&
|
|
10
|
+
!Array.isArray(value) &&
|
|
11
|
+
Object.getPrototypeOf(value) === Object.prototype;
|
|
12
|
+
|
|
13
|
+
export const mergeConfig = <
|
|
14
|
+
T extends Record<string, unknown>,
|
|
15
|
+
S extends Record<string, unknown>,
|
|
16
|
+
>(
|
|
17
|
+
target: T,
|
|
18
|
+
source: S,
|
|
19
|
+
): T & S => {
|
|
20
|
+
const result = { ...target } as T & S;
|
|
21
|
+
|
|
22
|
+
for (const key of Object.keys(source) as (keyof S)[]) {
|
|
23
|
+
const sourceValue = source[key];
|
|
24
|
+
const targetValue = target[key as keyof T];
|
|
25
|
+
|
|
26
|
+
// Don't merge React elements, arrays, or non-plain objects - just replace
|
|
27
|
+
if (
|
|
28
|
+
isValidElement(sourceValue) ||
|
|
29
|
+
Array.isArray(sourceValue) ||
|
|
30
|
+
!isPlainObject(sourceValue)
|
|
31
|
+
) {
|
|
32
|
+
(result as Record<string, unknown>)[key as string] = sourceValue;
|
|
33
|
+
} else if (isPlainObject(targetValue)) {
|
|
34
|
+
(result as Record<string, unknown>)[key as string] = mergeConfig(
|
|
35
|
+
targetValue,
|
|
36
|
+
sourceValue,
|
|
37
|
+
);
|
|
38
|
+
} else {
|
|
39
|
+
(result as Record<string, unknown>)[key as string] = sourceValue;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const runPluginTransformConfig = async <T extends ZudokuConfig>(
|
|
47
|
+
config: T,
|
|
48
|
+
): Promise<T> => {
|
|
49
|
+
const plugins = config.plugins ?? [];
|
|
50
|
+
|
|
51
|
+
let result = config;
|
|
52
|
+
|
|
53
|
+
for (const plugin of plugins.filter(isTransformConfigPlugin)) {
|
|
54
|
+
const merge = <T extends Record<string, unknown>>(partial: T) =>
|
|
55
|
+
mergeConfig(result, partial);
|
|
56
|
+
|
|
57
|
+
const transformed = await plugin.transformConfig?.({
|
|
58
|
+
config: result,
|
|
59
|
+
merge,
|
|
60
|
+
});
|
|
61
|
+
if (!transformed) continue;
|
|
62
|
+
|
|
63
|
+
result = transformed as T;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return result;
|
|
67
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SyntaxHighlight } from "zudoku/ui/SyntaxHighlight.js";
|
|
2
1
|
import { DeveloperHint } from "../components/DeveloperHint.js";
|
|
3
2
|
import { Heading } from "../components/Heading.js";
|
|
4
3
|
import { Typography } from "../components/Typography.js";
|
|
@@ -22,11 +21,7 @@ export function ErrorAlert({ error }: { error: unknown }) {
|
|
|
22
21
|
Error: {message}
|
|
23
22
|
{hint && <DeveloperHint className="mb-4">{hint}</DeveloperHint>}
|
|
24
23
|
{stringError && (
|
|
25
|
-
<
|
|
26
|
-
className="max-h-[400px] [&>pre]:p-4"
|
|
27
|
-
language="js"
|
|
28
|
-
code={stringError}
|
|
29
|
-
/>
|
|
24
|
+
<pre className="max-h-[400px] [&>pre]:p-4">{stringError}</pre>
|
|
30
25
|
)}
|
|
31
26
|
</Typography>
|
|
32
27
|
);
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Alert, AlertDescription, AlertTitle } from "zudoku/ui/Alert.js";
|
|
2
|
+
import { SyntaxHighlight } from "zudoku/ui/SyntaxHighlight.js";
|
|
3
|
+
import { DeveloperHint } from "../components/DeveloperHint.js";
|
|
4
|
+
import { ZudokuError } from "../util/invariant.js";
|
|
5
|
+
|
|
6
|
+
export function ErrorMessage({ error }: { error: unknown }) {
|
|
7
|
+
const message =
|
|
8
|
+
error instanceof Error ? error.message : "Something went wrong";
|
|
9
|
+
|
|
10
|
+
const showDeveloperHints = process.env.NODE_ENV === "development";
|
|
11
|
+
|
|
12
|
+
const hint = error instanceof ZudokuError ? error.developerHint : undefined;
|
|
13
|
+
const title =
|
|
14
|
+
error instanceof ZudokuError ? error.title : "Something went wrong";
|
|
15
|
+
const stack = error instanceof Error ? error.stack : undefined;
|
|
16
|
+
const cause = error instanceof Error ? error.cause : undefined;
|
|
17
|
+
|
|
18
|
+
const stringError = cause instanceof Error ? String(cause.stack) : stack;
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<>
|
|
22
|
+
<Alert variant="destructive">
|
|
23
|
+
<AlertTitle>{title}</AlertTitle>
|
|
24
|
+
<AlertDescription>{message}</AlertDescription>
|
|
25
|
+
</Alert>
|
|
26
|
+
{showDeveloperHints && hint && (
|
|
27
|
+
<DeveloperHint className="mb-4">{hint}</DeveloperHint>
|
|
28
|
+
)}
|
|
29
|
+
{showDeveloperHints && stringError && (
|
|
30
|
+
<SyntaxHighlight
|
|
31
|
+
className="max-h-[400px] [&>pre]:p-4"
|
|
32
|
+
language="js"
|
|
33
|
+
code={stringError}
|
|
34
|
+
/>
|
|
35
|
+
)}
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
}
|
package/src/lib/hooks/index.ts
CHANGED
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
export const useEvent = /*@__PURE__*/ useEventImport;
|
|
10
|
-
export const useTheme = /*@__PURE__*/ useThemeImport;
|
|
11
|
-
export const useExposedProps = /*@__PURE__*/ useExposedPropsImport;
|
|
12
|
-
export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
|
|
13
|
-
export const useAuth = /*@__PURE__*/ useAuthImport;
|
|
14
|
-
export const useZudoku = /*@__PURE__*/ useZudokuImport;
|
|
15
|
-
export const useCache = /*@__PURE__*/ useCacheImport;
|
|
16
|
-
export { CACHE_KEYS };
|
|
1
|
+
export { useMDXComponents } from "@mdx-js/react";
|
|
2
|
+
export { useTheme } from "next-themes";
|
|
3
|
+
export { useAuth } from "../authentication/hook.js";
|
|
4
|
+
export { CACHE_KEYS, useCache } from "../components/cache.js";
|
|
5
|
+
export { useZudoku } from "../components/context/ZudokuContext.js";
|
|
6
|
+
export { useExposedProps } from "../util/useExposedProps.js";
|
|
7
|
+
export { useEvent } from "./useEvent.js";
|
|
@@ -13,7 +13,7 @@ import { useEvent } from "./useEvent.js";
|
|
|
13
13
|
|
|
14
14
|
const createTestContext = () => {
|
|
15
15
|
const queryClient = new QueryClient();
|
|
16
|
-
const context = new ZudokuContext({}, queryClient);
|
|
16
|
+
const context = new ZudokuContext({}, queryClient, {});
|
|
17
17
|
const wrapper = ({ children }: PropsWithChildren) => (
|
|
18
18
|
<QueryClientProvider client={queryClient}>
|
|
19
19
|
<ZudokuProvider context={context}>{children}</ZudokuProvider>
|