zudoku 0.3.0-dev.9 → 0.3.0-dev.91
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +5 -1
- package/dist/app/App.d.ts +1 -2
- package/dist/app/App.js +1 -29
- package/dist/app/App.js.map +1 -1
- package/dist/app/demo.d.ts +2 -0
- package/dist/app/demo.js +33 -0
- package/dist/app/demo.js.map +1 -0
- package/dist/app/entry.client.d.ts +2 -0
- package/dist/app/entry.client.js +35 -0
- package/dist/app/entry.client.js.map +1 -0
- package/dist/app/entry.server.d.ts +14 -0
- package/dist/app/entry.server.js +105 -0
- package/dist/app/entry.server.js.map +1 -0
- package/dist/app/main.d.ts +6 -1
- package/dist/app/main.js +74 -12
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.d.ts +2 -0
- package/dist/app/standalone.js +38 -0
- package/dist/app/standalone.js.map +1 -0
- package/dist/app/tailwind.d.ts +1 -1
- package/dist/app/tailwind.js +0 -4
- package/dist/app/tailwind.js.map +1 -1
- package/dist/cli/cmds/dev.js +5 -0
- package/dist/cli/cmds/dev.js.map +1 -1
- package/dist/cli/dev/handler.d.ts +1 -0
- package/dist/cli/dev/handler.js +3 -1
- package/dist/cli/dev/handler.js.map +1 -1
- package/dist/config/config.d.ts +21 -46
- package/dist/config/validators/InputSidebarSchema.d.ts +176 -0
- package/dist/config/validators/InputSidebarSchema.js +71 -0
- package/dist/config/validators/InputSidebarSchema.js.map +1 -0
- package/dist/config/validators/SidebarSchema.d.ts +17 -0
- package/dist/config/validators/SidebarSchema.js +76 -0
- package/dist/config/validators/SidebarSchema.js.map +1 -0
- package/dist/config/validators/validate.d.ts +1263 -2
- package/dist/config/validators/validate.js +170 -1
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/internal.d.ts +1 -0
- package/dist/internal.js +2 -0
- package/dist/internal.js.map +1 -0
- package/dist/lib/authentication/AuthenticationPlugin.d.ts +13 -0
- package/dist/lib/authentication/AuthenticationPlugin.js +31 -0
- package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -0
- package/dist/lib/authentication/authentication.d.ts +10 -9
- package/dist/lib/authentication/components/SignIn.d.ts +1 -0
- package/dist/lib/authentication/components/SignIn.js +14 -0
- package/dist/lib/authentication/components/SignIn.js.map +1 -0
- package/dist/lib/authentication/components/SignOut.d.ts +1 -0
- package/dist/lib/authentication/components/SignOut.js +12 -0
- package/dist/lib/authentication/components/SignOut.js.map +1 -0
- package/dist/lib/authentication/components/SignUp.d.ts +1 -0
- package/dist/lib/authentication/components/SignUp.js +10 -0
- package/dist/lib/authentication/components/SignUp.js.map +1 -0
- package/dist/lib/authentication/hook.js +4 -4
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/authentication/providers/auth0.js +11 -6
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/clerk.js +59 -30
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +30 -7
- package/dist/lib/authentication/providers/openid.js +79 -29
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/state.js +1 -1
- package/dist/lib/authentication/state.js.map +1 -1
- package/dist/lib/components/Bootstrap.d.ts +13 -0
- package/dist/lib/components/Bootstrap.js +12 -0
- package/dist/lib/components/Bootstrap.js.map +1 -0
- package/dist/lib/components/DevPortal.d.ts +5 -23
- package/dist/lib/components/DevPortal.js +43 -20
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/components/DeveloperHint.d.ts +5 -0
- package/dist/lib/components/DeveloperHint.js +10 -0
- package/dist/lib/components/DeveloperHint.js.map +1 -0
- package/dist/lib/components/ErrorPage.d.ts +6 -0
- package/dist/lib/components/ErrorPage.js +9 -0
- package/dist/lib/components/ErrorPage.js.map +1 -0
- package/dist/lib/components/Header.js +23 -4
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +9 -4
- package/dist/lib/components/Heading.js +17 -2
- package/dist/lib/components/Heading.js.map +1 -1
- package/dist/lib/components/InlineCode.d.ts +5 -0
- package/dist/lib/components/InlineCode.js +4 -0
- package/dist/lib/components/InlineCode.js.map +1 -0
- package/dist/lib/components/Layout.js +7 -5
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/NotFoundPage.d.ts +1 -0
- package/dist/lib/components/NotFoundPage.js +12 -0
- package/dist/lib/components/NotFoundPage.js.map +1 -0
- package/dist/lib/components/SlotletProvider.d.ts +9 -0
- package/dist/lib/components/SlotletProvider.js +11 -0
- package/dist/lib/components/SlotletProvider.js.map +1 -0
- package/dist/lib/components/SyntaxHighlight.d.ts +3 -2
- package/dist/lib/components/SyntaxHighlight.js +24 -22
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +1 -1
- package/dist/lib/components/TopNavigation.js +8 -4
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/ThemeContext.d.ts +1 -4
- package/dist/lib/components/context/ThemeContext.js +3 -29
- package/dist/lib/components/context/ThemeContext.js.map +1 -1
- package/dist/lib/components/context/ThemeProvider.d.ts +4 -0
- package/dist/lib/components/context/ThemeProvider.js +23 -0
- package/dist/lib/components/context/ThemeProvider.js.map +1 -0
- package/dist/lib/components/context/ZudokuContext.d.ts +15 -0
- package/dist/lib/components/context/ZudokuContext.js +46 -0
- package/dist/lib/components/context/ZudokuContext.js.map +1 -0
- package/dist/lib/components/context/ZudokuProvider.d.ts +5 -0
- package/dist/lib/components/context/ZudokuProvider.js +16 -0
- package/dist/lib/components/context/ZudokuProvider.js.map +1 -0
- package/dist/lib/components/index.d.ts +32 -3
- package/dist/lib/components/index.js +21 -3
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/Sidebar.d.ts +1 -0
- package/dist/lib/components/navigation/Sidebar.js +12 -0
- package/dist/lib/components/navigation/Sidebar.js.map +1 -0
- package/dist/lib/components/navigation/SidebarBadge.d.ts +22 -0
- package/dist/lib/components/navigation/SidebarBadge.js +24 -0
- package/dist/lib/components/navigation/SidebarBadge.js.map +1 -0
- package/dist/lib/components/navigation/SidebarCategory.d.ts +5 -0
- package/dist/lib/components/navigation/SidebarCategory.js +33 -0
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -0
- package/dist/lib/components/navigation/SidebarItem.d.ts +12 -0
- package/dist/lib/components/navigation/SidebarItem.js +42 -0
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -0
- package/dist/lib/components/navigation/{SideNavigationWrapper.d.ts → SidebarWrapper.d.ts} +1 -1
- package/dist/lib/components/navigation/{SideNavigationWrapper.js → SidebarWrapper.js} +2 -2
- package/dist/lib/components/navigation/SidebarWrapper.js.map +1 -0
- package/dist/lib/components/navigation/utils.d.ts +16 -0
- package/dist/lib/components/navigation/utils.js +85 -0
- package/dist/lib/components/navigation/utils.js.map +1 -0
- package/dist/lib/core/DevPortalContext.d.ts +58 -42
- package/dist/lib/core/DevPortalContext.js +18 -19
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +25 -10
- package/dist/lib/core/plugins.js +3 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/errors/ErrorAlert.d.ts +3 -0
- package/dist/lib/errors/ErrorAlert.js +8 -0
- package/dist/lib/errors/ErrorAlert.js.map +1 -0
- package/dist/lib/errors/RouterError.d.ts +1 -0
- package/dist/lib/errors/RouterError.js +12 -0
- package/dist/lib/errors/RouterError.js.map +1 -0
- package/dist/lib/errors/ServerError.d.ts +3 -0
- package/dist/lib/errors/ServerError.js +6 -0
- package/dist/lib/errors/ServerError.js.map +1 -0
- package/dist/lib/errors/TopLevelError.d.ts +2 -0
- package/dist/lib/errors/TopLevelError.js +7 -0
- package/dist/lib/errors/TopLevelError.js.map +1 -0
- package/dist/lib/oas/graphql/index.js +8 -5
- package/dist/lib/oas/graphql/index.js.map +1 -1
- package/dist/lib/oas/parser/index.d.ts +1 -1
- package/dist/lib/oas/parser/index.js +38 -12
- package/dist/lib/oas/parser/index.js.map +1 -1
- package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.js +4 -4
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.d.ts +1 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js +14 -0
- package/dist/lib/plugins/api-keys/ProtectedRoute.js.map +1 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +54 -0
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -0
- package/dist/lib/plugins/{api-key → api-keys}/index.d.ts +4 -5
- package/dist/lib/plugins/{api-key → api-keys}/index.js +18 -20
- package/dist/lib/plugins/api-keys/index.js.map +1 -0
- package/dist/lib/plugins/custom-page/index.d.ts +8 -0
- package/dist/lib/plugins/custom-page/index.js +12 -0
- package/dist/lib/plugins/custom-page/index.js.map +1 -0
- package/dist/lib/plugins/markdown/MdxPage.d.ts +3 -2
- package/dist/lib/plugins/markdown/MdxPage.js +10 -40
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/Toc.js +17 -9
- package/dist/lib/plugins/markdown/Toc.js.map +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.d.ts +3 -3
- package/dist/lib/plugins/markdown/generateRoutes.js +20 -43
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +4 -1
- package/dist/lib/plugins/markdown/index.js +3 -7
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/openapi/ColorizedParam.d.ts +2 -1
- package/dist/lib/plugins/openapi/ColorizedParam.js +14 -9
- package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +17 -5
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +11 -5
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterList.js +2 -1
- package/dist/lib/plugins/openapi/ParameterList.js.map +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js +1 -1
- package/dist/lib/plugins/openapi/ParameterListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/{MakeRequest.d.ts → PlaygroundDialogWrapper.d.ts} +2 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +23 -0
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -0
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js +3 -9
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Route.d.ts +6 -0
- package/dist/lib/plugins/openapi/Route.js +8 -0
- package/dist/lib/plugins/openapi/Route.js.map +1 -0
- package/dist/lib/plugins/openapi/SchemaListView.js +10 -26
- package/dist/lib/plugins/openapi/SchemaListView.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaListViewItem.d.ts +8 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js +25 -0
- package/dist/lib/plugins/openapi/SchemaListViewItem.js.map +1 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.d.ts +8 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js +17 -0
- package/dist/lib/plugins/openapi/SchemaListViewItemGroup.js.map +1 -0
- package/dist/lib/plugins/openapi/Sidecar.d.ts +4 -0
- package/dist/lib/plugins/openapi/Sidecar.js +55 -21
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/SidecarBox.d.ts +1 -0
- package/dist/lib/plugins/openapi/SidecarBox.js +3 -2
- package/dist/lib/plugins/openapi/SidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/{Select.d.ts → SimpleSelect.d.ts} +3 -2
- package/dist/lib/plugins/openapi/SimpleSelect.js +5 -0
- package/dist/lib/plugins/openapi/SimpleSelect.js.map +1 -0
- package/dist/lib/plugins/openapi/StaggeredRender.d.ts +8 -0
- package/dist/lib/plugins/openapi/StaggeredRender.js +18 -0
- package/dist/lib/plugins/openapi/StaggeredRender.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.d.ts +12 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.js +46 -0
- package/dist/lib/plugins/openapi/client/createMemoryClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createServer.d.ts +4 -0
- package/dist/lib/plugins/openapi/client/createServer.js +30 -0
- package/dist/lib/plugins/openapi/client/createServer.js.map +1 -0
- package/dist/lib/plugins/openapi/client/createWorkerClient.d.ts +10 -0
- package/dist/lib/plugins/openapi/{worker/createSharedWorkerClient.js → client/createWorkerClient.js} +15 -2
- package/dist/lib/plugins/openapi/client/createWorkerClient.js.map +1 -0
- package/dist/lib/plugins/openapi/client/interfaces.d.ts +4 -0
- package/dist/lib/plugins/openapi/client/interfaces.js +2 -0
- package/dist/lib/plugins/openapi/client/interfaces.js.map +1 -0
- package/dist/lib/plugins/openapi/{worker → client}/worker.js +2 -2
- package/dist/lib/plugins/openapi/client/worker.js.map +1 -0
- package/dist/lib/plugins/openapi/context.d.ts +5 -0
- package/dist/lib/plugins/openapi/context.js +11 -0
- package/dist/lib/plugins/openapi/context.js.map +1 -0
- package/dist/lib/plugins/openapi/graphql/gql.d.ts +6 -6
- 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 +15 -15
- package/dist/lib/plugins/openapi/graphql/graphql.js +67 -67
- package/dist/lib/plugins/openapi/graphql/graphql.js.map +1 -1
- package/dist/lib/plugins/openapi/index.d.ts +4 -18
- package/dist/lib/plugins/openapi/index.js +76 -32
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +16 -0
- package/dist/lib/plugins/openapi/interfaces.js +2 -0
- package/dist/lib/plugins/openapi/interfaces.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/Headers.js +1 -1
- package/dist/lib/plugins/openapi/playground/Headers.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PathParams.d.ts +4 -5
- package/dist/lib/plugins/openapi/playground/PathParams.js +9 -13
- package/dist/lib/plugins/openapi/playground/PathParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.d.ts +26 -14
- package/dist/lib/plugins/openapi/playground/Playground.js +54 -26
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.d.ts +5 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +12 -0
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/QueryParams.d.ts +4 -3
- package/dist/lib/plugins/openapi/playground/QueryParams.js +21 -12
- package/dist/lib/plugins/openapi/playground/QueryParams.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/ResponseTab.d.ts +4 -0
- package/dist/lib/plugins/openapi/playground/ResponseTab.js +40 -0
- package/dist/lib/plugins/openapi/playground/ResponseTab.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/createUrl.d.ts +1 -1
- package/dist/lib/plugins/openapi/playground/createUrl.js +5 -9
- package/dist/lib/plugins/openapi/playground/createUrl.js.map +1 -1
- package/dist/lib/plugins/openapi/util/prose.d.ts +1 -0
- package/dist/lib/plugins/openapi/util/prose.js +4 -0
- package/dist/lib/plugins/openapi/util/prose.js.map +1 -0
- package/dist/lib/plugins/openapi-worker.d.ts +1 -1
- package/dist/lib/plugins/openapi-worker.js +1 -1
- package/dist/lib/plugins/openapi-worker.js.map +1 -1
- package/dist/lib/plugins/redirect/index.d.ts +0 -1
- package/dist/lib/plugins/redirect/index.js +3 -4
- package/dist/lib/plugins/redirect/index.js.map +1 -1
- package/dist/lib/ui/Button.d.ts +5 -1
- package/dist/lib/ui/Button.js +24 -1
- package/dist/lib/ui/Button.js.map +1 -1
- package/dist/lib/ui/Callout.js +2 -2
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/ui/Card.js +1 -1
- package/dist/lib/ui/Card.js.map +1 -1
- package/dist/lib/ui/DropdownMenu.d.ts +27 -0
- package/dist/lib/ui/DropdownMenu.js +36 -0
- package/dist/lib/ui/DropdownMenu.js.map +1 -0
- package/dist/lib/ui/Input.js.map +1 -0
- package/dist/lib/util/MdxComponents.d.ts +2 -2
- package/dist/lib/util/MdxComponents.js +7 -5
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/fetchTimeout.d.ts +1 -0
- package/dist/lib/util/fetchTimeout.js +14 -0
- package/dist/lib/util/fetchTimeout.js.map +1 -0
- package/dist/lib/util/groupBy.d.ts +1 -6
- package/dist/lib/util/groupBy.js +10 -8
- package/dist/lib/util/groupBy.js.map +1 -1
- package/dist/lib/util/invariant.d.ts +6 -0
- package/dist/lib/util/invariant.js +21 -0
- package/dist/lib/util/invariant.js.map +1 -0
- package/dist/lib/util/joinPath.js +2 -1
- package/dist/lib/util/joinPath.js.map +1 -1
- package/dist/lib/util/logInit.d.ts +1 -0
- package/dist/lib/util/logInit.js +9 -0
- package/dist/lib/util/logInit.js.map +1 -0
- package/dist/lib/util/objectEntries.d.ts +4 -0
- package/dist/lib/util/objectEntries.js +2 -0
- package/dist/lib/util/objectEntries.js.map +1 -0
- package/dist/lib/util/renderIf.d.ts +1 -0
- package/dist/lib/util/renderIf.js +2 -0
- package/dist/lib/util/renderIf.js.map +1 -0
- package/dist/lib/util/requestIdleCallbackPolyfill.d.ts +1 -0
- package/dist/lib/util/requestIdleCallbackPolyfill.js +7 -0
- package/dist/lib/util/requestIdleCallbackPolyfill.js.map +1 -0
- package/dist/lib/util/useScrollToAnchor.js +31 -17
- package/dist/lib/util/useScrollToAnchor.js.map +1 -1
- package/dist/vite/build.js +30 -7
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +20 -12
- package/dist/vite/config.js +107 -55
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/config.test.js +6 -3
- package/dist/vite/config.test.js.map +1 -1
- package/dist/vite/dev-server.d.ts +2 -1
- package/dist/vite/dev-server.js +44 -15
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/html.js +18 -5
- package/dist/vite/html.js.map +1 -1
- package/dist/vite/plugin-api-keys.js +7 -8
- package/dist/vite/plugin-api-keys.js.map +1 -1
- package/dist/vite/plugin-api.js +9 -20
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-auth.js +5 -6
- package/dist/vite/plugin-auth.js.map +1 -1
- package/dist/vite/plugin-component.js +5 -2
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-config.d.ts +3 -6
- package/dist/vite/plugin-config.js +5 -8
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-custom-css.d.ts +6 -0
- package/dist/vite/plugin-custom-css.js +54 -0
- package/dist/vite/plugin-custom-css.js.map +1 -0
- package/dist/vite/plugin-docs.js +11 -5
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-mdx.d.ts +3 -1
- package/dist/vite/plugin-mdx.js +5 -5
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin-metadata.js +1 -1
- package/dist/vite/plugin-metadata.js.map +1 -1
- package/dist/vite/plugin-redirect.js +10 -10
- package/dist/vite/plugin-redirect.js.map +1 -1
- package/dist/vite/plugin-sidebar.d.ts +3 -0
- package/dist/vite/plugin-sidebar.js +23 -0
- package/dist/vite/plugin-sidebar.js.map +1 -0
- package/dist/vite/plugin.js +5 -5
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/prerender.d.ts +17 -0
- package/dist/vite/prerender.js +79 -0
- package/dist/vite/prerender.js.map +1 -0
- package/lib/AuthenticationPlugin-CH5NSVOu.js +55 -0
- package/lib/AuthenticationPlugin-CH5NSVOu.js.map +1 -0
- package/lib/CategoryHeading-BWq12Bfa.js +10 -0
- package/lib/CategoryHeading-BWq12Bfa.js.map +1 -0
- package/lib/Combination-D-9IH0zy.js +2789 -0
- package/lib/Combination-D-9IH0zy.js.map +1 -0
- package/lib/DeveloperHint-BQSFXH01.js +10 -0
- package/lib/DeveloperHint-BQSFXH01.js.map +1 -0
- package/lib/Input-HmAaR6kw.js +2239 -0
- package/lib/Input-HmAaR6kw.js.map +1 -0
- package/lib/Markdown-B_Gax7at.js +14108 -0
- package/lib/Markdown-B_Gax7at.js.map +1 -0
- package/lib/MdxPage-3-PenZs2.js +187 -0
- package/lib/MdxPage-3-PenZs2.js.map +1 -0
- package/lib/OperationList-DvKqvB16.js +448 -0
- package/lib/OperationList-DvKqvB16.js.map +1 -0
- package/lib/Route-CnmaDun4.js +14 -0
- package/lib/Route-CnmaDun4.js.map +1 -0
- package/lib/SlotletProvider-CzMAO73_.js +82 -0
- package/lib/SlotletProvider-CzMAO73_.js.map +1 -0
- package/lib/Spinner-D99Tq0hv.js +274 -0
- package/lib/Spinner-D99Tq0hv.js.map +1 -0
- package/lib/ZudokuContext-BIZ8zHbZ.js +1084 -0
- package/lib/ZudokuContext-BIZ8zHbZ.js.map +1 -0
- package/lib/_commonjsHelpers-BVfed4GL.js +29 -0
- package/lib/_commonjsHelpers-BVfed4GL.js.map +1 -0
- package/lib/assets/index-BPdJm2ty.js +1 -0
- package/lib/assets/index-BPdJm2ty.js.map +1 -0
- package/lib/assets/{worker-BCcpCNJ7.js → worker-CyHZIIfE.js} +10727 -10300
- package/lib/assets/worker-CyHZIIfE.js.map +1 -0
- package/lib/index-7kcHaXD6.js +1771 -0
- package/lib/index-7kcHaXD6.js.map +1 -0
- package/lib/index-7nswqEVR.js +124 -0
- package/lib/index-7nswqEVR.js.map +1 -0
- package/lib/index-DjaqWcmv.js +5934 -0
- package/lib/index-DjaqWcmv.js.map +1 -0
- package/lib/index-pI9JkN46.js +4765 -0
- package/lib/index-pI9JkN46.js.map +1 -0
- package/lib/joinPath-VeNuJa7y.js +8 -0
- package/lib/joinPath-VeNuJa7y.js.map +1 -0
- package/lib/jsx-runtime-B6kdoens.js +635 -0
- package/lib/jsx-runtime-B6kdoens.js.map +1 -0
- package/lib/prism-bash.min-DadFsM4Z.js +1 -0
- package/lib/prism-bash.min-DadFsM4Z.js.map +1 -0
- package/lib/prism-csharp.min-Yizuc34Y.js +1 -0
- package/lib/prism-csharp.min-Yizuc34Y.js.map +1 -0
- package/lib/prism-java.min-d5iT_mOd.js +1 -0
- package/lib/prism-java.min-d5iT_mOd.js.map +1 -0
- package/lib/prism-json.min-B1GJqK1k.js +1 -0
- package/lib/prism-json.min-B1GJqK1k.js.map +1 -0
- package/lib/prism-markup-templating-DZrrEs0A.js +1 -0
- package/lib/prism-markup-templating-DZrrEs0A.js.map +1 -0
- package/lib/prism-objectivec.min-BXSWqpJJ.js +1 -0
- package/lib/prism-objectivec.min-BXSWqpJJ.js.map +1 -0
- package/lib/prism-php.min-o7FpoMP_.js +1 -0
- package/lib/prism-php.min-o7FpoMP_.js.map +1 -0
- package/lib/prism-ruby.min-C7LwcKyz.js +1 -0
- package/lib/prism-ruby.min-C7LwcKyz.js.map +1 -0
- package/lib/router-BiRCp01d.js +2971 -0
- package/lib/router-BiRCp01d.js.map +1 -0
- package/lib/slugify-CiPVjteN.js +28 -0
- package/lib/slugify-CiPVjteN.js.map +1 -0
- package/lib/state-DsXXkBLH.js +288 -0
- package/lib/state-DsXXkBLH.js.map +1 -0
- package/lib/{urql-DMlBWUKL.js → urql-DrBfkb92.js} +2 -2
- package/lib/urql-DrBfkb92.js.map +1 -0
- package/lib/utils-D3g3xyZM.js +749 -0
- package/lib/utils-D3g3xyZM.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +31 -20
- package/lib/zudoku.auth-auth0.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +59 -29
- package/lib/zudoku.auth-clerk.js.map +1 -0
- package/lib/zudoku.auth-openid.js +742 -573
- package/lib/zudoku.auth-openid.js.map +1 -0
- package/lib/zudoku.components.js +2008 -684
- package/lib/zudoku.components.js.map +1 -0
- package/lib/zudoku.openapi-worker.js +15035 -146
- package/lib/zudoku.openapi-worker.js.map +1 -0
- package/lib/zudoku.plugin-api-keys.js +325 -0
- package/lib/zudoku.plugin-api-keys.js.map +1 -0
- package/lib/zudoku.plugin-custom-page.js +13 -0
- package/lib/zudoku.plugin-custom-page.js.map +1 -0
- package/lib/zudoku.plugin-markdown.js +31 -0
- package/lib/zudoku.plugin-markdown.js.map +1 -0
- package/lib/zudoku.plugin-openapi.js +14 -0
- package/lib/zudoku.plugin-openapi.js.map +1 -0
- package/lib/zudoku.plugin-redirect.js +11 -0
- package/lib/zudoku.plugin-redirect.js.map +1 -0
- package/package.json +64 -25
- package/src/app/App.tsx +0 -41
- package/src/app/demo-cdn.html +26 -0
- package/src/app/demo.html +18 -0
- package/src/app/demo.tsx +46 -0
- package/src/app/entry.client.tsx +47 -0
- package/src/app/entry.server.tsx +160 -0
- package/src/app/main.css +83 -3
- package/src/app/main.tsx +87 -15
- package/src/app/standalone.html +20 -0
- package/src/app/standalone.tsx +52 -0
- package/src/app/tailwind.ts +2 -6
- package/src/lib/authentication/AuthenticationPlugin.tsx +38 -0
- package/src/lib/authentication/authentication.ts +6 -12
- package/src/lib/authentication/components/SignIn.tsx +15 -0
- package/src/lib/authentication/components/SignOut.tsx +13 -0
- package/src/lib/authentication/components/SignUp.tsx +11 -0
- package/src/lib/authentication/hook.ts +4 -4
- package/src/lib/authentication/providers/auth0.tsx +16 -6
- package/src/lib/authentication/providers/clerk.tsx +63 -31
- package/src/lib/authentication/providers/openid.tsx +104 -34
- package/src/lib/authentication/state.ts +1 -1
- package/src/lib/components/Bootstrap.tsx +44 -0
- package/src/lib/components/DevPortal.tsx +75 -66
- package/src/lib/components/DeveloperHint.tsx +25 -0
- package/src/lib/components/ErrorPage.tsx +28 -0
- package/src/lib/components/Header.tsx +106 -31
- package/src/lib/components/Heading.tsx +26 -7
- package/src/lib/components/InlineCode.tsx +19 -0
- package/src/lib/components/Layout.tsx +16 -11
- package/src/lib/components/NotFoundPage.tsx +33 -0
- package/src/lib/components/SlotletProvider.tsx +25 -0
- package/src/lib/components/SyntaxHighlight.tsx +53 -44
- package/src/lib/components/TopNavigation.tsx +10 -5
- package/src/lib/components/context/ThemeContext.tsx +3 -41
- package/src/lib/components/context/ThemeProvider.tsx +27 -0
- package/src/lib/components/context/ZudokuContext.ts +58 -0
- package/src/lib/components/context/ZudokuProvider.tsx +26 -0
- package/src/lib/components/index.ts +25 -3
- package/src/lib/components/navigation/Sidebar.tsx +24 -0
- package/src/lib/components/navigation/SidebarBadge.tsx +40 -0
- package/src/lib/components/navigation/SidebarCategory.tsx +105 -0
- package/src/lib/components/navigation/SidebarItem.tsx +100 -0
- package/src/lib/components/navigation/{SideNavigationWrapper.tsx → SidebarWrapper.tsx} +1 -1
- package/src/lib/components/navigation/utils.ts +117 -0
- package/src/lib/core/DevPortalContext.ts +72 -68
- package/src/lib/core/plugins.ts +40 -16
- package/src/lib/errors/ErrorAlert.tsx +21 -0
- package/src/lib/errors/RouterError.tsx +13 -0
- package/src/lib/errors/ServerError.tsx +5 -0
- package/src/lib/errors/TopLevelError.tsx +8 -0
- package/src/lib/oas/graphql/index.ts +11 -6
- package/src/lib/oas/parser/index.ts +41 -20
- package/src/lib/plugins/{api-key → api-keys}/CreateApiKey.tsx +4 -4
- package/src/lib/plugins/api-keys/ProtectedRoute.tsx +29 -0
- package/src/lib/plugins/{api-key → api-keys}/SettingsApiKeys.tsx +49 -16
- package/src/lib/plugins/{api-key → api-keys}/index.tsx +27 -41
- package/src/lib/plugins/custom-page/index.tsx +22 -0
- package/src/lib/plugins/markdown/MdxPage.tsx +54 -73
- package/src/lib/plugins/markdown/Toc.tsx +53 -40
- package/src/lib/plugins/markdown/generateRoutes.tsx +35 -53
- package/src/lib/plugins/markdown/index.tsx +10 -7
- package/src/lib/plugins/openapi/ColorizedParam.tsx +23 -16
- package/src/lib/plugins/openapi/OperationList.tsx +46 -10
- package/src/lib/plugins/openapi/OperationListItem.tsx +51 -30
- package/src/lib/plugins/openapi/ParameterList.tsx +13 -10
- package/src/lib/plugins/openapi/ParameterListItem.tsx +3 -4
- package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +39 -0
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +3 -15
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +3 -2
- package/src/lib/plugins/openapi/Route.tsx +21 -0
- package/src/lib/plugins/openapi/SchemaListView.tsx +39 -192
- package/src/lib/plugins/openapi/SchemaListViewItem.tsx +125 -0
- package/src/lib/plugins/openapi/SchemaListViewItemGroup.tsx +63 -0
- package/src/lib/plugins/openapi/Sidecar.tsx +77 -30
- package/src/lib/plugins/openapi/SidecarBox.tsx +13 -2
- package/src/lib/plugins/openapi/{Select.tsx → SimpleSelect.tsx} +6 -3
- package/src/lib/plugins/openapi/StaggeredRender.tsx +31 -0
- package/src/lib/plugins/openapi/client/createMemoryClient.ts +56 -0
- package/src/lib/plugins/openapi/client/createServer.ts +33 -0
- package/src/lib/plugins/openapi/{worker/createSharedWorkerClient.ts → client/createWorkerClient.ts} +21 -2
- package/src/lib/plugins/openapi/client/interfaces.ts +5 -0
- package/src/lib/plugins/openapi/{worker → client}/worker.ts +3 -3
- package/src/lib/plugins/openapi/context.tsx +16 -0
- package/src/lib/plugins/openapi/graphql/gql.ts +8 -8
- package/src/lib/plugins/openapi/graphql/graphql.ts +80 -80
- package/src/lib/plugins/openapi/index.tsx +134 -76
- package/src/lib/plugins/openapi/interfaces.ts +10 -0
- package/src/lib/plugins/openapi/playground/Headers.tsx +1 -1
- package/src/lib/plugins/openapi/playground/PathParams.tsx +76 -50
- package/src/lib/plugins/openapi/playground/Playground.tsx +240 -230
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +40 -0
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +107 -66
- package/src/lib/plugins/openapi/playground/ResponseTab.tsx +76 -0
- package/src/lib/plugins/openapi/playground/createUrl.ts +12 -15
- package/src/lib/plugins/openapi/util/prose.ts +7 -0
- package/src/lib/plugins/openapi-worker.ts +1 -1
- package/src/lib/plugins/redirect/index.tsx +3 -4
- package/src/lib/ui/Button.tsx +32 -2
- package/src/lib/ui/Callout.tsx +4 -4
- package/src/lib/ui/Card.tsx +1 -1
- package/src/lib/ui/DropdownMenu.tsx +199 -0
- package/src/lib/util/MdxComponents.tsx +7 -15
- package/src/lib/util/fetchTimeout.tsx +21 -0
- package/src/lib/util/groupBy.ts +7 -12
- package/src/lib/util/invariant.ts +26 -0
- package/src/lib/util/joinPath.tsx +2 -1
- package/src/lib/util/logInit.ts +9 -0
- package/src/lib/util/objectEntries.ts +5 -0
- package/src/lib/util/renderIf.ts +4 -0
- package/src/lib/util/requestIdleCallbackPolyfill.ts +6 -0
- package/src/lib/util/useScrollToAnchor.ts +39 -18
- package/dist/lib/authentication/Callback.d.ts +0 -3
- package/dist/lib/authentication/Callback.js +0 -34
- package/dist/lib/authentication/Callback.js.map +0 -1
- package/dist/lib/components/Input.js.map +0 -1
- package/dist/lib/components/Link.d.ts +0 -1
- package/dist/lib/components/Link.js +0 -2
- package/dist/lib/components/Link.js.map +0 -1
- package/dist/lib/components/Router.d.ts +0 -4
- package/dist/lib/components/Router.js +0 -20
- package/dist/lib/components/Router.js.map +0 -1
- package/dist/lib/components/context/DevPortalProvider.d.ts +0 -9
- package/dist/lib/components/context/DevPortalProvider.js +0 -39
- package/dist/lib/components/context/DevPortalProvider.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigation.d.ts +0 -1
- package/dist/lib/components/navigation/SideNavigation.js +0 -11
- package/dist/lib/components/navigation/SideNavigation.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigationCategory.d.ts +0 -4
- package/dist/lib/components/navigation/SideNavigationCategory.js +0 -26
- package/dist/lib/components/navigation/SideNavigationCategory.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigationItem.d.ts +0 -13
- package/dist/lib/components/navigation/SideNavigationItem.js +0 -44
- package/dist/lib/components/navigation/SideNavigationItem.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigationWrapper.js.map +0 -1
- package/dist/lib/components/navigation/useNavigationCollapsibleState.d.ts +0 -6
- package/dist/lib/components/navigation/useNavigationCollapsibleState.js +0 -16
- package/dist/lib/components/navigation/useNavigationCollapsibleState.js.map +0 -1
- package/dist/lib/components/navigation/util.d.ts +0 -8
- package/dist/lib/components/navigation/util.js +0 -15
- package/dist/lib/components/navigation/util.js.map +0 -1
- package/dist/lib/core/helmet.d.ts +0 -4
- package/dist/lib/core/helmet.js +0 -5
- package/dist/lib/core/helmet.js.map +0 -1
- package/dist/lib/core/icons.d.ts +0 -1
- package/dist/lib/core/icons.js +0 -2
- package/dist/lib/core/icons.js.map +0 -1
- package/dist/lib/core/router.d.ts +0 -1
- package/dist/lib/core/router.js +0 -2
- package/dist/lib/core/router.js.map +0 -1
- package/dist/lib/plugins/api-key/CreateApiKey.js.map +0 -1
- package/dist/lib/plugins/api-key/SettingsApiKeys.js +0 -38
- package/dist/lib/plugins/api-key/SettingsApiKeys.js.map +0 -1
- package/dist/lib/plugins/api-key/index.js.map +0 -1
- package/dist/lib/plugins/index.d.ts +0 -4
- package/dist/lib/plugins/index.js +0 -5
- package/dist/lib/plugins/index.js.map +0 -1
- package/dist/lib/plugins/openapi/MakeRequest.js +0 -43
- package/dist/lib/plugins/openapi/MakeRequest.js.map +0 -1
- package/dist/lib/plugins/openapi/MethodBadge.d.ts +0 -13
- package/dist/lib/plugins/openapi/MethodBadge.js +0 -26
- package/dist/lib/plugins/openapi/MethodBadge.js.map +0 -1
- package/dist/lib/plugins/openapi/Select.js +0 -5
- package/dist/lib/plugins/openapi/Select.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.d.ts +0 -5
- package/dist/lib/plugins/openapi/worker/createSharedWorkerClient.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/shared-worker.d.ts +0 -1
- package/dist/lib/plugins/openapi/worker/shared-worker.js +0 -6
- package/dist/lib/plugins/openapi/worker/shared-worker.js.map +0 -1
- package/dist/lib/plugins/openapi/worker/worker.js.map +0 -1
- package/dist/lib/ui/button-variants.d.ts +0 -4
- package/dist/lib/ui/button-variants.js +0 -24
- package/dist/lib/ui/button-variants.js.map +0 -1
- package/dist/lib/util/traverseNavigation.d.ts +0 -6
- package/dist/lib/util/traverseNavigation.js +0 -30
- package/dist/lib/util/traverseNavigation.js.map +0 -1
- package/dist/vite/common.d.ts +0 -1
- package/dist/vite/common.js +0 -5
- package/dist/vite/common.js.map +0 -1
- package/dist/vite/plugin-html.d.ts +0 -3
- package/dist/vite/plugin-html.js +0 -47
- package/dist/vite/plugin-html.js.map +0 -1
- package/dist/vite/plugin-openapi-worker.d.ts +0 -4
- package/dist/vite/plugin-openapi-worker.js +0 -28
- package/dist/vite/plugin-openapi-worker.js.map +0 -1
- package/lib/Spinner-BewqqUU-.js +0 -8413
- package/lib/clerk-Wslx_mPo.js +0 -19685
- package/lib/index-PyGcnQFX.js +0 -3462
- package/lib/loglevel-CoH7VSwE.js +0 -152
- package/lib/state-2Hu1renZ.js +0 -313
- package/lib/zudoku.plugins.js +0 -19904
- package/src/lib/authentication/Callback.tsx +0 -60
- package/src/lib/components/Link.tsx +0 -1
- package/src/lib/components/Router.tsx +0 -28
- package/src/lib/components/context/DevPortalProvider.ts +0 -54
- package/src/lib/components/navigation/SideNavigation.tsx +0 -21
- package/src/lib/components/navigation/SideNavigationCategory.tsx +0 -76
- package/src/lib/components/navigation/SideNavigationItem.tsx +0 -152
- package/src/lib/components/navigation/useNavigationCollapsibleState.ts +0 -27
- package/src/lib/components/navigation/util.ts +0 -38
- package/src/lib/core/helmet.ts +0 -5
- package/src/lib/core/icons.tsx +0 -1
- package/src/lib/core/router.tsx +0 -1
- package/src/lib/plugins/index.ts +0 -4
- package/src/lib/plugins/openapi/MakeRequest.tsx +0 -63
- package/src/lib/plugins/openapi/MethodBadge.tsx +0 -36
- package/src/lib/plugins/openapi/worker/shared-worker.ts +0 -5
- package/src/lib/ui/button-variants.ts +0 -31
- package/src/lib/util/traverseNavigation.ts +0 -55
- /package/dist/lib/plugins/{api-key → api-keys}/CreateApiKey.d.ts +0 -0
- /package/dist/lib/plugins/{api-key → api-keys}/SettingsApiKeys.d.ts +0 -0
- /package/dist/lib/plugins/openapi/{worker → client}/worker.d.ts +0 -0
- /package/dist/lib/{components → ui}/Input.d.ts +0 -0
- /package/dist/lib/{components → ui}/Input.js +0 -0
- /package/src/lib/{components → ui}/Input.tsx +0 -0
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Outlet, useRouteError } from "react-router-dom";
|
|
3
|
-
import invariant from "tiny-invariant";
|
|
4
|
-
import { useAuth } from "../../authentication/hook.js";
|
|
1
|
+
import { type RouteObject } from "react-router-dom";
|
|
5
2
|
import { DevPortalContext } from "../../core/DevPortalContext.js";
|
|
6
3
|
import {
|
|
7
4
|
type ApiIdentityPlugin,
|
|
8
5
|
type DevPortalPlugin,
|
|
6
|
+
ProfileMenuPlugin,
|
|
9
7
|
} from "../../core/plugins.js";
|
|
10
|
-
import {
|
|
8
|
+
import { RouterError } from "../../errors/RouterError.js";
|
|
9
|
+
import invariant from "../../util/invariant.js";
|
|
11
10
|
import { CreateApiKey } from "./CreateApiKey.js";
|
|
11
|
+
import { ProtectedRoute } from "./ProtectedRoute.js";
|
|
12
12
|
import { SettingsApiKeys } from "./SettingsApiKeys.js";
|
|
13
13
|
|
|
14
|
-
export type ApiKeyResults = Promise<ApiKey[]>;
|
|
15
14
|
const DEFAULT_API_KEY_ENDPOINT =
|
|
16
15
|
"https://zudoku-rewiringamerica-main-ef9c9c0.d2.zuplo.dev";
|
|
17
16
|
|
|
18
17
|
export type ApiKeyService = {
|
|
19
|
-
getKeys: (context: DevPortalContext) =>
|
|
18
|
+
getKeys: (context: DevPortalContext) => Promise<ApiKey[]>;
|
|
20
19
|
rollKey?: (id: string, context: DevPortalContext) => Promise<void>;
|
|
21
20
|
deleteKey?: (id: string, context: DevPortalContext) => Promise<void>;
|
|
22
21
|
updateKeyDescription?: (
|
|
23
|
-
apiKey: {
|
|
22
|
+
apiKey: { id: string; description: string },
|
|
24
23
|
context: DevPortalContext,
|
|
25
24
|
) => Promise<void>;
|
|
26
25
|
getUsage?: (apiKeys: string[], context: DevPortalContext) => Promise<void>;
|
|
@@ -55,6 +54,16 @@ const createDefaultHandler = (endpoint: string): ApiKeyService => {
|
|
|
55
54
|
const response = await fetch(request);
|
|
56
55
|
invariant(response.ok, "Failed to delete API key");
|
|
57
56
|
},
|
|
57
|
+
rollKey: async (id, context) => {
|
|
58
|
+
const response = await fetch(
|
|
59
|
+
await context.signRequest(
|
|
60
|
+
new Request(endpoint + `/v1/developer/api-keys/${id}/key`, {
|
|
61
|
+
method: "DELETE",
|
|
62
|
+
}),
|
|
63
|
+
),
|
|
64
|
+
);
|
|
65
|
+
invariant(response.ok, "Failed to delete API key");
|
|
66
|
+
},
|
|
58
67
|
createKey: async (apiKey, context) => {
|
|
59
68
|
const request = new Request(endpoint + `/v1/developer/api-keys`, {
|
|
60
69
|
method: "POST",
|
|
@@ -82,39 +91,9 @@ const createDefaultHandler = (endpoint: string): ApiKeyService => {
|
|
|
82
91
|
};
|
|
83
92
|
};
|
|
84
93
|
|
|
85
|
-
const ProtectedRoute = () => {
|
|
86
|
-
const auth = useAuth();
|
|
87
|
-
|
|
88
|
-
// TODO: should we suspend here somehow?
|
|
89
|
-
if (auth.isPending) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return auth.isAuthenticated ? (
|
|
94
|
-
<Outlet />
|
|
95
|
-
) : (
|
|
96
|
-
<div className="flex flex-col justify-center gap-2 items-center h-1/2 my-12">
|
|
97
|
-
Please login first to view this page
|
|
98
|
-
<Button onClick={() => auth.login()}>Login</Button>
|
|
99
|
-
</div>
|
|
100
|
-
);
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
const SettingsErrorBoundary = () => {
|
|
104
|
-
const error = useRouteError();
|
|
105
|
-
logger.error(String(error));
|
|
106
|
-
|
|
107
|
-
return (
|
|
108
|
-
<div className="flex flex-col justify-center gap-2 items-center h-1/2 my-12">
|
|
109
|
-
<h1>Something went wrong</h1>
|
|
110
|
-
{error instanceof Error && <p>{error.message}</p>}
|
|
111
|
-
</div>
|
|
112
|
-
);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
94
|
export const apiKeyPlugin = (
|
|
116
95
|
options: ApiKeyPluginOptions,
|
|
117
|
-
): DevPortalPlugin & ApiIdentityPlugin => {
|
|
96
|
+
): DevPortalPlugin & ApiIdentityPlugin & ProfileMenuPlugin => {
|
|
118
97
|
const endpoint =
|
|
119
98
|
"endpoint" in options ? options.endpoint : DEFAULT_API_KEY_ENDPOINT;
|
|
120
99
|
|
|
@@ -122,6 +101,12 @@ export const apiKeyPlugin = (
|
|
|
122
101
|
"getKeys" in options ? options : createDefaultHandler(endpoint);
|
|
123
102
|
|
|
124
103
|
return {
|
|
104
|
+
getProfileMenuItems: () => [
|
|
105
|
+
{
|
|
106
|
+
label: "API Keys",
|
|
107
|
+
path: "/settings/api-keys",
|
|
108
|
+
},
|
|
109
|
+
],
|
|
125
110
|
getIdentities: async (context) => {
|
|
126
111
|
try {
|
|
127
112
|
const keys = await service.getKeys(context);
|
|
@@ -138,11 +123,12 @@ export const apiKeyPlugin = (
|
|
|
138
123
|
return [];
|
|
139
124
|
}
|
|
140
125
|
},
|
|
141
|
-
getRoutes: () => {
|
|
126
|
+
getRoutes: (): RouteObject[] => {
|
|
127
|
+
// TODO: Make lazy
|
|
142
128
|
return [
|
|
143
129
|
{
|
|
144
130
|
element: <ProtectedRoute />,
|
|
145
|
-
errorElement: <
|
|
131
|
+
errorElement: <RouterError />,
|
|
146
132
|
children: [
|
|
147
133
|
{
|
|
148
134
|
path: "/settings/api-keys",
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { RouteObject } from "react-router-dom";
|
|
3
|
+
import { ProseClasses } from "../../components/Markdown.js";
|
|
4
|
+
import type { DevPortalPlugin, NavigationPlugin } from "../../core/plugins.js";
|
|
5
|
+
|
|
6
|
+
type CustomPageConfig = Array<{
|
|
7
|
+
path: string;
|
|
8
|
+
element: ReactNode;
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
export const customPagePlugin = (
|
|
12
|
+
config: CustomPageConfig,
|
|
13
|
+
): DevPortalPlugin & NavigationPlugin => {
|
|
14
|
+
return {
|
|
15
|
+
getRoutes: (): RouteObject[] =>
|
|
16
|
+
config.map(({ path, element }) => ({
|
|
17
|
+
path,
|
|
18
|
+
// TODO: we should componentize prose pages
|
|
19
|
+
element: <div className={ProseClasses + " max-w-full"}>{element}</div>,
|
|
20
|
+
})),
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { useMDXComponents } from "@mdx-js/react";
|
|
2
|
-
import {
|
|
2
|
+
import { Helmet } from "@zudoku/react-helmet-async";
|
|
3
|
+
import { type PropsWithChildren } from "react";
|
|
4
|
+
import { Link } from "react-router-dom";
|
|
3
5
|
import { CategoryHeading } from "../../components/CategoryHeading.js";
|
|
4
6
|
import { Heading } from "../../components/Heading.js";
|
|
5
7
|
import { ProseClasses } from "../../components/Markdown.js";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
import {
|
|
9
|
+
useCurrentItem,
|
|
10
|
+
usePrevNext,
|
|
11
|
+
} from "../../components/navigation/utils.js";
|
|
10
12
|
import type { MdxComponentsType } from "../../util/MdxComponents.js";
|
|
11
13
|
import { cn } from "../../util/cn.js";
|
|
12
14
|
import slugify from "../../util/slugify.js";
|
|
13
|
-
import { traverseNavigation } from "../../util/traverseNavigation.js";
|
|
14
15
|
import { Toc } from "./Toc.js";
|
|
15
|
-
import
|
|
16
|
+
import { MarkdownPluginDefaultOptions, MDXImport } from "./index.js";
|
|
16
17
|
|
|
17
18
|
const MarkdownHeadings = {
|
|
18
19
|
h2: ({ children, id }) => (
|
|
@@ -31,29 +32,22 @@ const MarkdownHeadings = {
|
|
|
31
32
|
export const MdxPage = ({
|
|
32
33
|
mdxComponent: MdxComponent,
|
|
33
34
|
frontmatter = {},
|
|
35
|
+
defaultOptions,
|
|
34
36
|
tableOfContents,
|
|
35
37
|
}: PropsWithChildren<
|
|
36
38
|
Omit<MDXImport, "default"> & {
|
|
37
39
|
mdxComponent: MDXImport["default"];
|
|
40
|
+
defaultOptions?: MarkdownPluginDefaultOptions;
|
|
38
41
|
}
|
|
39
42
|
>) => {
|
|
40
|
-
const
|
|
41
|
-
const location = useLocation();
|
|
42
|
-
|
|
43
|
-
const categoryTitle = navItem
|
|
44
|
-
? traverseNavigation(navItem, (_node, fullPath, parentNodes) => {
|
|
45
|
-
if (fullPath === location.pathname) {
|
|
46
|
-
return parentNodes.at(0)?.label;
|
|
47
|
-
}
|
|
48
|
-
})
|
|
49
|
-
: undefined;
|
|
50
|
-
|
|
43
|
+
const categoryTitle = useCurrentItem()?.categoryLabel;
|
|
51
44
|
const title = frontmatter.title;
|
|
52
45
|
const category = frontmatter.category ?? categoryTitle;
|
|
53
|
-
const hideToc = frontmatter.toc === false;
|
|
54
|
-
|
|
46
|
+
const hideToc = frontmatter.toc === false || defaultOptions?.toc === false;
|
|
55
47
|
const pageTitle =
|
|
56
48
|
tableOfContents.find((item) => item.depth === 1)?.value ?? title;
|
|
49
|
+
const hidePager =
|
|
50
|
+
frontmatter.disablePager ?? defaultOptions?.disablePager ?? false;
|
|
57
51
|
|
|
58
52
|
const tocEntries =
|
|
59
53
|
tableOfContents.find((item) => item.depth === 1)?.children ??
|
|
@@ -62,30 +56,7 @@ export const MdxPage = ({
|
|
|
62
56
|
|
|
63
57
|
const showToc = !hideToc && tocEntries.length > 0;
|
|
64
58
|
|
|
65
|
-
const { prev, next } =
|
|
66
|
-
let prev = { path: "", label: "" as ReactNode };
|
|
67
|
-
let next = { path: "", label: "" as ReactNode };
|
|
68
|
-
let shouldStop = false;
|
|
69
|
-
|
|
70
|
-
if (!navItem) return { prev, next };
|
|
71
|
-
|
|
72
|
-
traverseNavigation(navItem, (node, fullPath) => {
|
|
73
|
-
const item = { path: fullPath, label: node.label };
|
|
74
|
-
|
|
75
|
-
if (shouldStop && isPathItem(node) && !node.children?.length) {
|
|
76
|
-
next = item;
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
if (fullPath === location.pathname) {
|
|
80
|
-
shouldStop = true;
|
|
81
|
-
}
|
|
82
|
-
if (!shouldStop && isPathItem(node) && !node.children?.length) {
|
|
83
|
-
prev = item;
|
|
84
|
-
}
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
return { prev, next } as const;
|
|
88
|
-
}, [navItem, location.pathname]);
|
|
59
|
+
const { prev, next } = usePrevNext();
|
|
89
60
|
|
|
90
61
|
return (
|
|
91
62
|
<div className="xl:grid grid-cols-[--sidecar-grid-cols] gap-8 justify-between">
|
|
@@ -112,35 +83,45 @@ export const MdxPage = ({
|
|
|
112
83
|
<MdxComponent
|
|
113
84
|
components={{ ...useMDXComponents(), ...MarkdownHeadings }}
|
|
114
85
|
/>
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
<
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
86
|
+
{!hidePager && (
|
|
87
|
+
<>
|
|
88
|
+
<hr />
|
|
89
|
+
<div className="not-prose flex items-center justify-between gap-8">
|
|
90
|
+
{prev ? (
|
|
91
|
+
<Link
|
|
92
|
+
to={prev.id}
|
|
93
|
+
className="flex flex-col items-stretch gap-2 flex-1 truncate border rounded px-6 py-4 text-start hover:border-primary/85 transition shadow-sm hover:shadow-md"
|
|
94
|
+
title={prev.label}
|
|
95
|
+
>
|
|
96
|
+
<div className="text-sm text-muted-foreground">
|
|
97
|
+
← Previous page
|
|
98
|
+
</div>
|
|
99
|
+
<div className="text-lg text-primary truncate">
|
|
100
|
+
{prev.label}
|
|
101
|
+
</div>
|
|
102
|
+
</Link>
|
|
103
|
+
) : (
|
|
104
|
+
<div className="flex-1" />
|
|
105
|
+
)}
|
|
106
|
+
{next ? (
|
|
107
|
+
<Link
|
|
108
|
+
to={next.id}
|
|
109
|
+
className="flex flex-col items-stretch gap-2 flex-1 truncate border rounded px-6 py-4 text-end hover:border-primary/85 transition shadow-sm hover:shadow-md"
|
|
110
|
+
title={next.label}
|
|
111
|
+
>
|
|
112
|
+
<div className="text-sm text-muted-foreground">
|
|
113
|
+
Next page →
|
|
114
|
+
</div>
|
|
115
|
+
<div className="text-lg text-primary truncate">
|
|
116
|
+
{next.label}
|
|
117
|
+
</div>
|
|
118
|
+
</Link>
|
|
119
|
+
) : (
|
|
120
|
+
<div className="flex-1" />
|
|
121
|
+
)}
|
|
122
|
+
</div>
|
|
123
|
+
</>
|
|
124
|
+
)}
|
|
144
125
|
</div>
|
|
145
126
|
<div className="hidden xl:block">
|
|
146
127
|
{showToc && <Toc entries={tocEntries} />}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TocEntry } from "@stefanprobst/rehype-extract-toc";
|
|
2
|
+
import { ListTreeIcon } from "lucide-react";
|
|
2
3
|
import {
|
|
3
4
|
useEffect,
|
|
4
5
|
useRef,
|
|
@@ -8,7 +9,6 @@ import {
|
|
|
8
9
|
} from "react";
|
|
9
10
|
import { AnchorLink } from "../../components/AnchorLink.js";
|
|
10
11
|
import { useViewportAnchor } from "../../components/context/ViewportAnchorContext.js";
|
|
11
|
-
import { ListTreeIcon } from "../../core/icons.js";
|
|
12
12
|
import { cn } from "../../util/cn.js";
|
|
13
13
|
|
|
14
14
|
const DATA_ANCHOR_ATTR = "data-active";
|
|
@@ -53,7 +53,11 @@ const TocItem = ({
|
|
|
53
53
|
export const Toc = ({ entries }: { entries: TocEntry[] }) => {
|
|
54
54
|
const { activeAnchor } = useViewportAnchor();
|
|
55
55
|
const listWrapperRef = useRef<HTMLUListElement>(null);
|
|
56
|
-
const
|
|
56
|
+
const paintedOnce = useRef(false);
|
|
57
|
+
const [indicatorStyle, setIndicatorStyles] = useState<CSSProperties>({
|
|
58
|
+
top: 0,
|
|
59
|
+
opacity: 0,
|
|
60
|
+
});
|
|
57
61
|
|
|
58
62
|
// synchronize active anchor indicator with the scroll position
|
|
59
63
|
useEffect(() => {
|
|
@@ -64,10 +68,7 @@ export const Toc = ({ entries }: { entries: TocEntry[] }) => {
|
|
|
64
68
|
);
|
|
65
69
|
|
|
66
70
|
if (!activeElement) {
|
|
67
|
-
setIndicatorStyles({
|
|
68
|
-
"--indicator-top": "0",
|
|
69
|
-
"--indicator-opacity": 0,
|
|
70
|
-
} as CSSProperties);
|
|
71
|
+
setIndicatorStyles({ top: 0, opacity: 0 });
|
|
71
72
|
return;
|
|
72
73
|
}
|
|
73
74
|
|
|
@@ -75,9 +76,16 @@ export const Toc = ({ entries }: { entries: TocEntry[] }) => {
|
|
|
75
76
|
const topElement = activeElement.getBoundingClientRect().top;
|
|
76
77
|
|
|
77
78
|
setIndicatorStyles({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
}
|
|
79
|
+
opacity: 1,
|
|
80
|
+
top: `${topElement - topParent}px`,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
if (paintedOnce.current) return;
|
|
84
|
+
|
|
85
|
+
// after all is painted, the indicator should animate
|
|
86
|
+
requestIdleCallback(() => {
|
|
87
|
+
paintedOnce.current = true;
|
|
88
|
+
});
|
|
81
89
|
}, [activeAnchor]);
|
|
82
90
|
|
|
83
91
|
return (
|
|
@@ -86,37 +94,42 @@ export const Toc = ({ entries }: { entries: TocEntry[] }) => {
|
|
|
86
94
|
<ListTreeIcon size={16} />
|
|
87
95
|
On this page
|
|
88
96
|
</div>
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
97
|
+
<div className="relative ms-2 ps-4">
|
|
98
|
+
<div className="absolute inset-0 right-auto bg-border w-[2px]" />
|
|
99
|
+
<div
|
|
100
|
+
className={cn(
|
|
101
|
+
"absolute -left-px -translate-y-1 h-6 w-[4px] rounded bg-primary",
|
|
102
|
+
paintedOnce.current &&
|
|
103
|
+
"ease-out [transition:top_150ms,opacity_325ms]",
|
|
104
|
+
)}
|
|
105
|
+
style={indicatorStyle}
|
|
106
|
+
/>
|
|
107
|
+
<ul
|
|
108
|
+
ref={listWrapperRef}
|
|
109
|
+
className="relative font-medium list-none space-y-2"
|
|
110
|
+
>
|
|
111
|
+
{entries.map((item) => (
|
|
112
|
+
<TocItem
|
|
113
|
+
isActive={item.id === activeAnchor}
|
|
114
|
+
key={item.id}
|
|
115
|
+
item={item}
|
|
116
|
+
className="pl-0"
|
|
117
|
+
>
|
|
118
|
+
{item.children && (
|
|
119
|
+
<ul className="list-none pl-4 pt-2 space-y-2">
|
|
120
|
+
{item.children.map((child) => (
|
|
121
|
+
<TocItem
|
|
122
|
+
item={child}
|
|
123
|
+
isActive={child.id === activeAnchor}
|
|
124
|
+
key={child.id}
|
|
125
|
+
/>
|
|
126
|
+
))}
|
|
127
|
+
</ul>
|
|
128
|
+
)}
|
|
129
|
+
</TocItem>
|
|
130
|
+
))}
|
|
131
|
+
</ul>
|
|
132
|
+
</div>
|
|
120
133
|
</aside>
|
|
121
134
|
);
|
|
122
135
|
};
|
|
@@ -1,57 +1,39 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { type RouteObject } from "react-router-dom";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
MarkdownPluginDefaultOptions,
|
|
5
|
+
MarkdownPluginOptions,
|
|
6
|
+
} from "./index.js";
|
|
7
7
|
|
|
8
8
|
export const generateRoutes = (
|
|
9
9
|
markdownFiles: MarkdownPluginOptions["markdownFiles"],
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
new Set(routes.map((route) => route.path.split("/").at(0))),
|
|
40
|
-
).map((dir) => ({
|
|
41
|
-
path: `/${dir}`,
|
|
42
|
-
element: <Redirect />,
|
|
43
|
-
}));
|
|
44
|
-
|
|
45
|
-
return [...routes, ...rootRoutes];
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const Redirect = () => {
|
|
49
|
-
const navItem = useTopNavigationItem();
|
|
50
|
-
|
|
51
|
-
if (!navItem) return null;
|
|
52
|
-
|
|
53
|
-
return traverseNavigation(navItem, (node, fullPath) => {
|
|
54
|
-
if ("children" in node || !isPathItem(node)) return;
|
|
55
|
-
return <Navigate to={fullPath} replace />;
|
|
10
|
+
defaultOptions?: MarkdownPluginDefaultOptions,
|
|
11
|
+
): RouteObject[] =>
|
|
12
|
+
Object.entries(markdownFiles).flatMap(([file, importPromise]) => {
|
|
13
|
+
// @todo we can pass in the folder name and then filter the markdown files based on that path
|
|
14
|
+
const match = file.match(/pages\/(.*).mdx?$/);
|
|
15
|
+
const path = match?.at(1);
|
|
16
|
+
|
|
17
|
+
if (!path) return [];
|
|
18
|
+
|
|
19
|
+
const pathSegments = path.split("/");
|
|
20
|
+
const isIndexFile = pathSegments.at(-1) === "index";
|
|
21
|
+
const routePath = isIndexFile ? pathSegments.slice(0, -1).join("/") : path;
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
path: routePath,
|
|
25
|
+
lazy: async () => {
|
|
26
|
+
const { MdxPage } = await import("./MdxPage.js");
|
|
27
|
+
const { default: Component, ...props } = await importPromise();
|
|
28
|
+
return {
|
|
29
|
+
element: (
|
|
30
|
+
<MdxPage
|
|
31
|
+
mdxComponent={Component}
|
|
32
|
+
{...props}
|
|
33
|
+
defaultOptions={defaultOptions}
|
|
34
|
+
/>
|
|
35
|
+
),
|
|
36
|
+
};
|
|
37
|
+
},
|
|
38
|
+
} satisfies RouteObject;
|
|
56
39
|
});
|
|
57
|
-
};
|
|
@@ -5,13 +5,19 @@ import { generateRoutes } from "./generateRoutes.js";
|
|
|
5
5
|
|
|
6
6
|
export type MarkdownPluginOptions = {
|
|
7
7
|
markdownFiles: Record<string, () => Promise<MDXImport>>;
|
|
8
|
+
defaultOptions?: MarkdownPluginDefaultOptions;
|
|
8
9
|
};
|
|
10
|
+
export type MarkdownPluginDefaultOptions = Pick<
|
|
11
|
+
Frontmatter,
|
|
12
|
+
"toc" | "disablePager"
|
|
13
|
+
>;
|
|
9
14
|
|
|
10
15
|
export type Frontmatter = {
|
|
11
16
|
title?: string;
|
|
12
17
|
description?: string;
|
|
13
18
|
category?: string;
|
|
14
19
|
toc?: boolean;
|
|
20
|
+
disablePager?: boolean;
|
|
15
21
|
};
|
|
16
22
|
|
|
17
23
|
export type MDXImport = {
|
|
@@ -22,10 +28,7 @@ export type MDXImport = {
|
|
|
22
28
|
|
|
23
29
|
export const markdownPlugin = ({
|
|
24
30
|
markdownFiles,
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
};
|
|
31
|
+
defaultOptions,
|
|
32
|
+
}: MarkdownPluginOptions): DevPortalPlugin => ({
|
|
33
|
+
getRoutes: () => generateRoutes(markdownFiles, defaultOptions),
|
|
34
|
+
});
|
|
@@ -9,7 +9,7 @@ export const usePastellizedColor = (name: string) => {
|
|
|
9
9
|
const [isDark] = useTheme();
|
|
10
10
|
return pastellize(
|
|
11
11
|
name,
|
|
12
|
-
!isDark ? { saturation:
|
|
12
|
+
!isDark ? { saturation: 85, lightness: 50 } : undefined,
|
|
13
13
|
);
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -17,6 +17,7 @@ export const ColorizedParam = ({
|
|
|
17
17
|
name,
|
|
18
18
|
className,
|
|
19
19
|
backgroundOpacity = "100%",
|
|
20
|
+
borderOpacity = "100%",
|
|
20
21
|
slug,
|
|
21
22
|
children,
|
|
22
23
|
onClick,
|
|
@@ -24,34 +25,40 @@ export const ColorizedParam = ({
|
|
|
24
25
|
name: string;
|
|
25
26
|
className?: string;
|
|
26
27
|
backgroundOpacity?: string;
|
|
28
|
+
borderOpacity?: string;
|
|
27
29
|
slug?: string;
|
|
28
30
|
children?: ReactNode;
|
|
29
31
|
onClick?: () => void;
|
|
30
32
|
}) => {
|
|
31
33
|
const ref = useRef<HTMLSpanElement>(null);
|
|
32
|
-
const normalized = name.replace(
|
|
34
|
+
const normalized = name.replace(/[{}]/g, "");
|
|
35
|
+
const normalizedSlug = slug?.replace(/[{}]/g, "");
|
|
33
36
|
const color = usePastellizedColor(normalized);
|
|
34
37
|
|
|
35
|
-
const borderColor = `hsl(${color})`;
|
|
38
|
+
const borderColor = `hsl(${color} / ${borderOpacity})`;
|
|
36
39
|
const backgroundColor = `hsl(${color} / ${backgroundOpacity})`;
|
|
37
40
|
|
|
38
41
|
useEffect(() => {
|
|
39
|
-
if (!
|
|
42
|
+
if (!normalizedSlug) return;
|
|
40
43
|
if (!ref.current) return;
|
|
41
44
|
|
|
42
45
|
const onMouseEnter = () => {
|
|
43
|
-
document
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
document
|
|
47
|
+
.querySelectorAll(`[${DATA_ATTR}="${normalizedSlug}"]`)
|
|
48
|
+
.forEach((el) => {
|
|
49
|
+
if (el instanceof HTMLElement) {
|
|
50
|
+
el.dataset.active = "true";
|
|
51
|
+
}
|
|
52
|
+
});
|
|
48
53
|
};
|
|
49
54
|
const onMouseLeave = () => {
|
|
50
|
-
document
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
+
document
|
|
56
|
+
.querySelectorAll(`[${DATA_ATTR}="${normalizedSlug}"]`)
|
|
57
|
+
.forEach((el) => {
|
|
58
|
+
if (el instanceof HTMLElement) {
|
|
59
|
+
el.dataset.active = "false";
|
|
60
|
+
}
|
|
61
|
+
});
|
|
55
62
|
};
|
|
56
63
|
|
|
57
64
|
ref.current.addEventListener("mouseenter", onMouseEnter);
|
|
@@ -61,12 +68,12 @@ export const ColorizedParam = ({
|
|
|
61
68
|
ref.current?.removeEventListener("mouseenter", onMouseEnter);
|
|
62
69
|
ref.current?.removeEventListener("mouseleave", onMouseLeave);
|
|
63
70
|
};
|
|
64
|
-
}, [
|
|
71
|
+
}, [normalizedSlug]);
|
|
65
72
|
|
|
66
73
|
return (
|
|
67
74
|
<span
|
|
68
75
|
className={cn("inline-flex relative rounded group", className)}
|
|
69
|
-
{...{ [DATA_ATTR]:
|
|
76
|
+
{...{ [DATA_ATTR]: normalizedSlug }}
|
|
70
77
|
ref={ref}
|
|
71
78
|
onClick={onClick}
|
|
72
79
|
>
|