zudoku 0.45.0 → 0.46.0
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 +8 -2
- package/dist/app/main.js +4 -23
- package/dist/app/main.js.map +1 -1
- package/dist/config/config.d.ts +2 -2
- package/dist/config/file-exists.d.ts +1 -0
- package/dist/config/file-exists.js +5 -0
- package/dist/config/file-exists.js.map +1 -0
- package/dist/config/loader.d.ts +19 -4
- package/dist/config/loader.js +94 -14
- package/dist/config/loader.js.map +1 -1
- package/dist/config/validators/validate.d.ts +3536 -743
- package/dist/config/validators/validate.js +396 -11
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/authentication/AuthenticationPlugin.d.ts +7 -2
- package/dist/lib/authentication/AuthenticationPlugin.js +13 -1
- package/dist/lib/authentication/AuthenticationPlugin.js.map +1 -1
- package/dist/lib/authentication/authentication.d.ts +2 -4
- package/dist/lib/authentication/providers/auth0.js.map +1 -1
- package/dist/lib/authentication/providers/clerk.js +62 -43
- package/dist/lib/authentication/providers/clerk.js.map +1 -1
- package/dist/lib/authentication/providers/openid.d.ts +7 -12
- package/dist/lib/authentication/providers/openid.js +11 -22
- package/dist/lib/authentication/providers/openid.js.map +1 -1
- package/dist/lib/authentication/providers/supabase.js +3 -5
- package/dist/lib/authentication/providers/supabase.js.map +1 -1
- package/dist/lib/components/Autocomplete.js +1 -1
- package/dist/lib/components/Banner.js +1 -1
- package/dist/lib/components/Banner.js.map +1 -1
- package/dist/lib/components/ErrorPage.js +1 -1
- package/dist/lib/components/Footer.js +5 -5
- package/dist/lib/components/Footer.js.map +1 -1
- package/dist/lib/components/Header.js +16 -8
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.js +6 -1
- package/dist/lib/components/Heading.js.map +1 -1
- package/dist/lib/components/InlineCode.js +1 -1
- package/dist/lib/components/InlineCode.js.map +1 -1
- package/dist/lib/components/Layout.js +2 -2
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/Main.js +2 -2
- package/dist/lib/components/Main.js.map +1 -1
- package/dist/lib/components/Markdown.js +8 -3
- package/dist/lib/components/Markdown.js.map +1 -1
- package/dist/lib/components/MobileTopNavigation.js +3 -2
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/NotFoundPage.js +1 -1
- package/dist/lib/components/Pagination.js +1 -1
- package/dist/lib/components/Pagination.js.map +1 -1
- package/dist/lib/components/Search.js +1 -1
- package/dist/lib/components/Search.js.map +1 -1
- package/dist/lib/components/Slot.d.ts +17 -0
- package/dist/lib/components/Slot.js +24 -0
- package/dist/lib/components/Slot.js.map +1 -0
- package/dist/lib/components/Slot.test.js +168 -0
- package/dist/lib/components/Slot.test.js.map +1 -0
- package/dist/lib/components/TopNavigation.d.ts +1 -4
- package/dist/lib/components/TopNavigation.js +3 -11
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/Zudoku.js +2 -2
- package/dist/lib/components/Zudoku.js.map +1 -1
- package/dist/lib/components/context/SlotProvider.d.ts +26 -0
- package/dist/lib/components/context/SlotProvider.js +83 -0
- package/dist/lib/components/context/SlotProvider.js.map +1 -0
- package/dist/lib/components/context/ZudokuContext.d.ts +1 -1
- package/dist/lib/components/context/ZudokuProvider.js +2 -1
- package/dist/lib/components/context/ZudokuProvider.js.map +1 -1
- package/dist/lib/components/index.d.ts +29 -23
- package/dist/lib/components/index.js +13 -7
- package/dist/lib/components/index.js.map +1 -1
- package/dist/lib/components/navigation/PoweredByZudoku.js +1 -1
- package/dist/lib/components/navigation/Sidebar.js +3 -3
- package/dist/lib/components/navigation/Sidebar.js.map +1 -1
- package/dist/lib/components/navigation/SidebarBadge.js +1 -1
- package/dist/lib/components/navigation/SidebarBadge.js.map +1 -1
- package/dist/lib/components/navigation/SidebarCategory.js +3 -3
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
- package/dist/lib/components/navigation/SidebarItem.d.ts +0 -5
- package/dist/lib/components/navigation/SidebarItem.js +19 -23
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
- package/dist/lib/components/navigation/SidebarWrapper.js +1 -1
- package/dist/lib/components/navigation/Toc.js +1 -1
- package/dist/lib/components/navigation/Toc.js.map +1 -1
- package/dist/lib/components/navigation/utils.d.ts +8 -0
- package/dist/lib/components/navigation/utils.js +34 -6
- package/dist/lib/components/navigation/utils.js.map +1 -1
- package/dist/lib/core/ZudokuContext.d.ts +12 -8
- package/dist/lib/core/ZudokuContext.js +6 -5
- package/dist/lib/core/ZudokuContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +5 -2
- package/dist/lib/core/plugins.js +1 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/errors/ErrorAlert.js +1 -1
- package/dist/lib/hooks/index.d.ts +19 -0
- package/dist/lib/hooks/index.js +11 -0
- package/dist/lib/hooks/index.js.map +1 -1
- package/dist/lib/plugins/api-catalog/Catalog.js +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.d.ts +3 -2
- package/dist/lib/plugins/api-keys/CreateApiKey.js +8 -4
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
- package/dist/lib/plugins/api-keys/SettingsApiKeys.d.ts +1 -1
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js +54 -23
- package/dist/lib/plugins/api-keys/SettingsApiKeys.js.map +1 -1
- package/dist/lib/plugins/api-keys/index.d.ts +18 -9
- package/dist/lib/plugins/api-keys/index.js +49 -34
- package/dist/lib/plugins/api-keys/index.js.map +1 -1
- package/dist/lib/plugins/custom-pages/index.d.ts +1 -1
- package/dist/lib/plugins/markdown/MdxPage.js +1 -1
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/index.d.ts +1 -1
- package/dist/lib/plugins/markdown/resolver.d.ts +1 -1
- package/dist/lib/plugins/markdown/resolver.js.map +1 -1
- package/dist/lib/plugins/openapi/CollapsibleCode.js +1 -1
- package/dist/lib/plugins/openapi/ColorizedParam.js +1 -1
- package/dist/lib/plugins/openapi/ColorizedParam.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationList.js +1 -1
- package/dist/lib/plugins/openapi/OperationList.js.map +1 -1
- package/dist/lib/plugins/openapi/OperationListItem.js +2 -3
- package/dist/lib/plugins/openapi/OperationListItem.js.map +1 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js +5 -1
- package/dist/lib/plugins/openapi/PlaygroundDialogWrapper.js.map +1 -1
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.d.ts +2 -4
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js +1 -4
- package/dist/lib/plugins/openapi/ResponsesSidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/SchemaList.js +6 -5
- package/dist/lib/plugins/openapi/SchemaList.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +1 -1
- package/dist/lib/plugins/openapi/SidecarExamples.js +8 -0
- package/dist/lib/plugins/openapi/SidecarExamples.js.map +1 -1
- package/dist/lib/plugins/openapi/components/EnumValues.js +1 -1
- package/dist/lib/plugins/openapi/components/EnumValues.js.map +1 -1
- package/dist/lib/plugins/openapi/components/ResponseContent.d.ts +12 -0
- package/dist/lib/plugins/openapi/components/ResponseContent.js +21 -0
- package/dist/lib/plugins/openapi/components/ResponseContent.js.map +1 -0
- package/dist/lib/plugins/openapi/playground/Playground.js +2 -0
- package/dist/lib/plugins/openapi/playground/Playground.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/PlaygroundDialog.js +1 -1
- package/dist/lib/plugins/openapi/playground/SubmitButton.js +7 -10
- package/dist/lib/plugins/openapi/playground/SubmitButton.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js +2 -2
- package/dist/lib/plugins/openapi/schema/SchemaExampleAndDefault.js.map +1 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.d.ts +2 -1
- package/dist/lib/plugins/openapi/schema/SchemaView.js +3 -3
- package/dist/lib/plugins/openapi/schema/SchemaView.js.map +1 -1
- package/dist/lib/plugins/redirect/index.d.ts +1 -1
- package/dist/lib/ui/Badge.d.ts +2 -2
- package/dist/lib/ui/Badge.js +1 -1
- package/dist/lib/ui/Badge.js.map +1 -1
- package/dist/lib/ui/Button.d.ts +2 -2
- package/dist/lib/ui/Button.js +8 -6
- package/dist/lib/ui/Button.js.map +1 -1
- package/dist/lib/ui/Callout.js +1 -1
- package/dist/lib/ui/Callout.js.map +1 -1
- package/dist/lib/ui/Card.js +1 -1
- package/dist/lib/ui/Checkbox.js +1 -1
- package/dist/lib/ui/Checkbox.js.map +1 -1
- package/dist/lib/ui/Command.d.ts +2 -2
- package/dist/lib/ui/Command.js +3 -3
- package/dist/lib/ui/Command.js.map +1 -1
- package/dist/lib/ui/Dialog.js +1 -1
- package/dist/lib/ui/Dialog.js.map +1 -1
- package/dist/lib/ui/DropdownMenu.js +4 -4
- package/dist/lib/ui/DropdownMenu.js.map +1 -1
- package/dist/lib/ui/HoverCard.js +1 -1
- package/dist/lib/ui/HoverCard.js.map +1 -1
- package/dist/lib/ui/Input.js +1 -1
- package/dist/lib/ui/Input.js.map +1 -1
- package/dist/lib/ui/Popover.js +1 -1
- package/dist/lib/ui/Popover.js.map +1 -1
- package/dist/lib/ui/RadioGroup.js +1 -1
- package/dist/lib/ui/RadioGroup.js.map +1 -1
- package/dist/lib/ui/Select.js +2 -2
- package/dist/lib/ui/Select.js.map +1 -1
- package/dist/lib/ui/Slider.js +1 -1
- package/dist/lib/ui/Slider.js.map +1 -1
- package/dist/lib/ui/Switch.js +1 -1
- package/dist/lib/ui/Switch.js.map +1 -1
- package/dist/lib/ui/Tabs.js +2 -2
- package/dist/lib/ui/Tabs.js.map +1 -1
- package/dist/lib/ui/Textarea.js +1 -1
- package/dist/lib/ui/Textarea.js.map +1 -1
- package/dist/lib/ui/Toggle.js +1 -1
- package/dist/lib/ui/Toggle.js.map +1 -1
- package/dist/lib/ui/Tooltip.d.ts +2 -1
- package/dist/lib/ui/Tooltip.js +2 -1
- package/dist/lib/ui/Tooltip.js.map +1 -1
- package/dist/lib/util/useExposedProps.d.ts +8 -1
- package/dist/lib/util/useExposedProps.js.map +1 -1
- package/dist/vite/api/SchemaManager.js +16 -1
- package/dist/vite/api/SchemaManager.js.map +1 -1
- package/dist/vite/build.js +44 -6
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +2 -9
- package/dist/vite/config.js +6 -95
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/config.test.js +1 -1
- package/dist/vite/config.test.js.map +1 -1
- package/dist/vite/css/plugin.d.ts +1 -2
- package/dist/vite/css/plugin.js +3 -2
- package/dist/vite/css/plugin.js.map +1 -1
- package/dist/vite/dev-server.d.ts +0 -1
- package/dist/vite/dev-server.js +10 -12
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/html.d.ts +2 -2
- package/dist/vite/html.js +5 -2
- package/dist/vite/html.js.map +1 -1
- package/dist/vite/plugin-api-keys.d.ts +1 -2
- package/dist/vite/plugin-api-keys.js +9 -3
- package/dist/vite/plugin-api-keys.js.map +1 -1
- package/dist/vite/plugin-api.d.ts +1 -2
- package/dist/vite/plugin-api.js +5 -4
- package/dist/vite/plugin-api.js.map +1 -1
- package/dist/vite/plugin-auth.d.ts +1 -2
- package/dist/vite/plugin-auth.js +3 -2
- package/dist/vite/plugin-auth.js.map +1 -1
- package/dist/vite/plugin-component.d.ts +1 -2
- package/dist/vite/plugin-component.js +3 -2
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-config-reload.d.ts +1 -2
- package/dist/vite/plugin-config-reload.js +21 -22
- package/dist/vite/plugin-config-reload.js.map +1 -1
- package/dist/vite/plugin-config.d.ts +1 -2
- package/dist/vite/plugin-config.js +4 -3
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-configure-tailwind.d.ts +2 -0
- package/dist/vite/plugin-configure-tailwind.js +38 -0
- package/dist/vite/plugin-configure-tailwind.js.map +1 -0
- package/dist/vite/plugin-custom-pages.d.ts +1 -2
- package/dist/vite/plugin-custom-pages.js +3 -2
- package/dist/vite/plugin-custom-pages.js.map +1 -1
- package/dist/vite/plugin-docs.d.ts +1 -2
- package/dist/vite/plugin-docs.js +4 -3
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-frontmatter.d.ts +1 -2
- package/dist/vite/plugin-frontmatter.js +3 -2
- package/dist/vite/plugin-frontmatter.js.map +1 -1
- package/dist/vite/plugin-mdx.d.ts +1 -2
- package/dist/vite/plugin-mdx.js +3 -2
- package/dist/vite/plugin-mdx.js.map +1 -1
- package/dist/vite/plugin-redirect.d.ts +1 -2
- package/dist/vite/plugin-redirect.js +3 -2
- package/dist/vite/plugin-redirect.js.map +1 -1
- package/dist/vite/plugin-search.d.ts +1 -2
- package/dist/vite/plugin-search.js +3 -2
- package/dist/vite/plugin-search.js.map +1 -1
- package/dist/vite/plugin-shiki-register.d.ts +1 -2
- package/dist/vite/plugin-shiki-register.js +2 -1
- package/dist/vite/plugin-shiki-register.js.map +1 -1
- package/dist/vite/plugin-sidebar.d.ts +1 -2
- package/dist/vite/plugin-sidebar.js +3 -2
- package/dist/vite/plugin-sidebar.js.map +1 -1
- package/dist/vite/plugin-theme-css.d.ts +1 -2
- package/dist/vite/plugin-theme-css.js +20 -60
- package/dist/vite/plugin-theme-css.js.map +1 -1
- package/dist/vite/plugin.d.ts +1 -2
- package/dist/vite/plugin.js +22 -21
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/sitemap.d.ts +1 -1
- package/dist/zuplo/with-zuplo.d.ts +2 -2
- package/dist/zuplo/with-zuplo.js.map +1 -1
- package/lib/Button-BE9IVkWV.js +51 -0
- package/lib/Button-BE9IVkWV.js.map +1 -0
- package/lib/{Callout-XadUe37J.js → Callout-BkgOUkoZ.js} +9 -8
- package/lib/Callout-BkgOUkoZ.js.map +1 -0
- package/lib/{Card-BlCYNw5W.js → Card-DPhGbYUM.js} +3 -3
- package/lib/{Card-BlCYNw5W.js.map → Card-DPhGbYUM.js.map} +1 -1
- package/lib/{CategoryHeading-DZi-Szor.js → CategoryHeading-Cu2RwgjC.js} +2 -2
- package/lib/{CategoryHeading-DZi-Szor.js.map → CategoryHeading-Cu2RwgjC.js.map} +1 -1
- package/lib/{Dialog-CNf2oWXG.js → Dialog-Du6WMcIA.js} +8 -7
- package/lib/Dialog-Du6WMcIA.js.map +1 -0
- package/lib/{Drawer-BPBxzel2.js → Drawer-BzkOKwgC.js} +2 -2
- package/lib/{Drawer-BPBxzel2.js.map → Drawer-BzkOKwgC.js.map} +1 -1
- package/lib/Markdown-BRAyzyUJ.js +15348 -0
- package/lib/Markdown-BRAyzyUJ.js.map +1 -0
- package/lib/{MdxPage-Sjv6y3cA.js → MdxPage-B3v1BSKr.js} +11 -11
- package/lib/MdxPage-B3v1BSKr.js.map +1 -0
- package/lib/{OasProvider-CzRXrs_-.js → OasProvider-5jrFuhVk.js} +3 -3
- package/lib/{OasProvider-CzRXrs_-.js.map → OasProvider-5jrFuhVk.js.map} +1 -1
- package/lib/{OperationList-DefCF3ZI.js → OperationList-BmoMLQPO.js} +1039 -1005
- package/lib/OperationList-BmoMLQPO.js.map +1 -0
- package/lib/Pagination-Cr0fWZS3.js +36 -0
- package/lib/Pagination-Cr0fWZS3.js.map +1 -0
- package/lib/RouteGuard-PrSVLbSr.js +55 -0
- package/lib/RouteGuard-PrSVLbSr.js.map +1 -0
- package/lib/{SchemaList-zHQ2Ekyw.js → SchemaList-B4riYLoP.js} +61 -47
- package/lib/SchemaList-B4riYLoP.js.map +1 -0
- package/lib/{SchemaView-CqF4oMU-.js → SchemaView-CPZ6RgsF.js} +100 -95
- package/lib/SchemaView-CPZ6RgsF.js.map +1 -0
- package/lib/{AuthenticationPlugin-UNaAuxNo.js → SignUp-CWaiH0tY.js} +23 -50
- package/lib/SignUp-CWaiH0tY.js.map +1 -0
- package/lib/Slot-Bo6K4tnb.js +160 -0
- package/lib/Slot-Bo6K4tnb.js.map +1 -0
- package/lib/{SyntaxHighlight-UxOF1xNb.js → SyntaxHighlight-DedRjJNr.js} +233 -212
- package/lib/{SyntaxHighlight-UxOF1xNb.js.map → SyntaxHighlight-DedRjJNr.js.map} +1 -1
- package/lib/{Toc-Ax54Pw8S.js → Toc-lL3fzNkl.js} +5 -5
- package/lib/Toc-lL3fzNkl.js.map +1 -0
- package/lib/{circular-B_TODp4H.js → circular-oB4auIIg.js} +2 -2
- package/lib/{circular-B_TODp4H.js.map → circular-oB4auIIg.js.map} +1 -1
- package/lib/clsx-OuTLNxxd.js +17 -0
- package/lib/clsx-OuTLNxxd.js.map +1 -0
- package/lib/{cn-CwJPJKOE.js → cn-wvCW-ho6.js} +1015 -562
- package/lib/cn-wvCW-ho6.js.map +1 -0
- package/lib/{createServer-CXd8q7nF.js → createServer-DCB82j2t.js} +81 -81
- package/lib/{createServer-CXd8q7nF.js.map → createServer-DCB82j2t.js.map} +1 -1
- package/lib/{hook-BwOB_iZo.js → hook-DawSLaZr.js} +323 -300
- package/lib/hook-DawSLaZr.js.map +1 -0
- package/lib/{index-BY8J3gEh.js → index-BXYvD5-7.js} +868 -758
- package/lib/index-BXYvD5-7.js.map +1 -0
- package/lib/{index-Z13x6tPX.js → index-DI5SPFK9.js} +2 -2
- package/lib/{index-Z13x6tPX.js.map → index-DI5SPFK9.js.map} +1 -1
- package/lib/index-QzXzw_ra.js +24 -0
- package/lib/index-QzXzw_ra.js.map +1 -0
- package/lib/{RouteGuard-lkdEJoDV.js → index.esm-BFcSKCe-.js} +232 -281
- package/lib/index.esm-BFcSKCe-.js.map +1 -0
- package/lib/{index.esm-D2ZUREQN.js → index.esm-DSfX_eMP.js} +3 -3
- package/lib/{index.esm-D2ZUREQN.js.map → index.esm-DSfX_eMP.js.map} +1 -1
- package/lib/joinPath-B7kNnUX4.js +8 -0
- package/lib/joinPath-B7kNnUX4.js.map +1 -0
- package/lib/{mutation-CL2MCRQL.js → mutation-oxMvODNQ.js} +2 -2
- package/lib/{mutation-CL2MCRQL.js.map → mutation-oxMvODNQ.js.map} +1 -1
- package/lib/ui/Accordion.js +1 -1
- package/lib/ui/ActionButton.js +2 -2
- package/lib/ui/Alert.js +2 -2
- package/lib/ui/AlertDialog.js +1 -1
- package/lib/ui/Badge.js +3 -3
- package/lib/ui/Badge.js.map +1 -1
- package/lib/ui/Breadcrumb.js +1 -1
- package/lib/ui/Button.js +20 -18
- package/lib/ui/Button.js.map +1 -1
- package/lib/ui/Callout.js +6 -5
- package/lib/ui/Callout.js.map +1 -1
- package/lib/ui/Card.js +8 -8
- package/lib/ui/Card.js.map +1 -1
- package/lib/ui/Carousel.js +1 -1
- package/lib/ui/Checkbox.js +7 -7
- package/lib/ui/Checkbox.js.map +1 -1
- package/lib/ui/CodeBlock.js +1 -1
- package/lib/ui/Command.js +43 -43
- package/lib/ui/Command.js.map +1 -1
- package/lib/ui/Dialog.js +2 -2
- package/lib/ui/Dialog.js.map +1 -1
- package/lib/ui/Drawer.js +2 -2
- package/lib/ui/DropdownMenu.js +34 -34
- package/lib/ui/DropdownMenu.js.map +1 -1
- package/lib/ui/Form.js +2 -2
- package/lib/ui/HoverCard.js +5 -5
- package/lib/ui/HoverCard.js.map +1 -1
- package/lib/ui/Input.js +2 -2
- package/lib/ui/Input.js.map +1 -1
- package/lib/ui/Label.js +2 -2
- package/lib/ui/Pagination.js +1 -1
- package/lib/ui/Popover.js +2 -2
- package/lib/ui/Popover.js.map +1 -1
- package/lib/ui/Progress.js +1 -1
- package/lib/ui/RadioGroup.js +10 -10
- package/lib/ui/RadioGroup.js.map +1 -1
- package/lib/ui/ScrollArea.js +1 -1
- package/lib/ui/Select.js +31 -31
- package/lib/ui/Select.js.map +1 -1
- package/lib/ui/Skeleton.js +1 -1
- package/lib/ui/Slider.js +5 -5
- package/lib/ui/Slider.js.map +1 -1
- package/lib/ui/Switch.js +5 -5
- package/lib/ui/Switch.js.map +1 -1
- package/lib/ui/SyntaxHighlight.js +2 -2
- package/lib/ui/Tabs.js +16 -16
- package/lib/ui/Tabs.js.map +1 -1
- package/lib/ui/Textarea.js +5 -5
- package/lib/ui/Textarea.js.map +1 -1
- package/lib/ui/Toggle.js +7 -7
- package/lib/ui/Toggle.js.map +1 -1
- package/lib/ui/ToggleGroup.js +1 -1
- package/lib/ui/Tooltip.js +15 -8
- package/lib/ui/Tooltip.js.map +1 -1
- package/lib/ui/util.js +1 -1
- package/lib/useExposedProps-DG8J6ewJ.js.map +1 -1
- package/lib/useMutation-C_j3dA_L.js +97 -0
- package/lib/useMutation-C_j3dA_L.js.map +1 -0
- package/lib/zudoku.auth-auth0.js +1 -1
- package/lib/zudoku.auth-auth0.js.map +1 -1
- package/lib/zudoku.auth-clerk.js +99 -82
- package/lib/zudoku.auth-clerk.js.map +1 -1
- package/lib/zudoku.auth-openid.js +246 -216
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +4957 -33
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.hooks.js +21 -12
- package/lib/zudoku.hooks.js.map +1 -1
- package/lib/zudoku.plugin-api-catalog.js +8 -8
- package/lib/zudoku.plugin-api-catalog.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +5022 -214
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +2 -2
- package/lib/zudoku.plugin-custom-pages.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +1 -1
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +3 -3
- package/lib/zudoku.plugin-redirect.js.map +1 -1
- package/lib/zudoku.plugin-search-pagefind.js +5 -5
- package/lib/zudoku.plugins.js +7 -6
- package/lib/zudoku.plugins.js.map +1 -1
- package/package.json +15 -16
- package/src/app/defaultTheme.css +54 -0
- package/src/app/font.geist.css +73 -0
- package/src/app/main.css +113 -156
- package/src/app/main.tsx +4 -28
- package/src/lib/authentication/AuthenticationPlugin.tsx +18 -4
- package/src/lib/authentication/authentication.ts +2 -5
- package/src/lib/authentication/providers/auth0.tsx +8 -2
- package/src/lib/authentication/providers/clerk.tsx +72 -48
- package/src/lib/authentication/providers/openid.tsx +19 -26
- package/src/lib/authentication/providers/supabase.tsx +7 -7
- package/src/lib/components/Autocomplete.tsx +1 -1
- package/src/lib/components/Banner.tsx +1 -1
- package/src/lib/components/ErrorPage.tsx +1 -1
- package/src/lib/components/Footer.tsx +7 -10
- package/src/lib/components/Header.tsx +29 -29
- package/src/lib/components/Heading.tsx +9 -5
- package/src/lib/components/InlineCode.tsx +1 -1
- package/src/lib/components/Layout.tsx +3 -3
- package/src/lib/components/Main.tsx +4 -4
- package/src/lib/components/Markdown.tsx +14 -4
- package/src/lib/components/MobileTopNavigation.tsx +3 -2
- package/src/lib/components/NotFoundPage.tsx +1 -1
- package/src/lib/components/Pagination.tsx +3 -9
- package/src/lib/components/Search.tsx +1 -1
- package/src/lib/components/Slot.test.tsx +465 -0
- package/src/lib/components/Slot.tsx +64 -0
- package/src/lib/components/TopNavigation.tsx +5 -17
- package/src/lib/components/Zudoku.tsx +9 -9
- package/src/lib/components/context/SlotProvider.tsx +149 -0
- package/src/lib/components/context/ZudokuProvider.tsx +2 -1
- package/src/lib/components/index.ts +14 -10
- package/src/lib/components/navigation/PoweredByZudoku.tsx +1 -1
- package/src/lib/components/navigation/Sidebar.tsx +3 -3
- package/src/lib/components/navigation/SidebarBadge.tsx +1 -1
- package/src/lib/components/navigation/SidebarCategory.tsx +3 -3
- package/src/lib/components/navigation/SidebarItem.tsx +57 -30
- package/src/lib/components/navigation/SidebarWrapper.tsx +2 -2
- package/src/lib/components/navigation/Toc.tsx +2 -2
- package/src/lib/components/navigation/utils.ts +42 -6
- package/src/lib/core/ZudokuContext.ts +24 -12
- package/src/lib/core/plugins.ts +10 -2
- package/src/lib/errors/ErrorAlert.tsx +1 -1
- package/src/lib/hooks/index.ts +11 -0
- package/src/lib/plugins/api-catalog/Catalog.tsx +1 -1
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +54 -42
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +292 -112
- package/src/lib/plugins/api-keys/index.tsx +101 -55
- package/src/lib/plugins/custom-pages/index.tsx +1 -1
- package/src/lib/plugins/markdown/MdxPage.tsx +2 -2
- package/src/lib/plugins/markdown/index.tsx +2 -2
- package/src/lib/plugins/markdown/resolver.ts +4 -2
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +1 -1
- package/src/lib/plugins/openapi/ColorizedParam.tsx +2 -2
- package/src/lib/plugins/openapi/OperationList.tsx +2 -2
- package/src/lib/plugins/openapi/OperationListItem.tsx +6 -34
- package/src/lib/plugins/openapi/PlaygroundDialogWrapper.tsx +7 -1
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +5 -16
- package/src/lib/plugins/openapi/SchemaList.tsx +20 -8
- package/src/lib/plugins/openapi/Sidecar.tsx +1 -1
- package/src/lib/plugins/openapi/SidecarExamples.tsx +6 -0
- package/src/lib/plugins/openapi/components/EnumValues.tsx +1 -1
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +104 -0
- package/src/lib/plugins/openapi/playground/Playground.tsx +7 -1
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +1 -1
- package/src/lib/plugins/openapi/playground/SubmitButton.tsx +24 -29
- package/src/lib/plugins/openapi/schema/SchemaExampleAndDefault.tsx +2 -2
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +7 -3
- package/src/lib/plugins/redirect/index.tsx +1 -1
- package/src/lib/ui/Badge.tsx +2 -2
- package/src/lib/ui/Button.tsx +9 -6
- package/src/lib/ui/Callout.tsx +1 -0
- package/src/lib/ui/Card.tsx +1 -1
- package/src/lib/ui/Checkbox.tsx +1 -1
- package/src/lib/ui/Command.tsx +5 -5
- package/src/lib/ui/Dialog.tsx +1 -1
- package/src/lib/ui/DropdownMenu.tsx +4 -4
- package/src/lib/ui/HoverCard.tsx +1 -1
- package/src/lib/ui/Input.tsx +1 -1
- package/src/lib/ui/Popover.tsx +1 -1
- package/src/lib/ui/RadioGroup.tsx +1 -1
- package/src/lib/ui/Select.tsx +3 -3
- package/src/lib/ui/Slider.tsx +1 -1
- package/src/lib/ui/Switch.tsx +1 -1
- package/src/lib/ui/Tabs.tsx +2 -2
- package/src/lib/ui/Textarea.tsx +1 -1
- package/src/lib/ui/Toggle.tsx +1 -1
- package/src/lib/ui/Tooltip.tsx +16 -1
- package/src/lib/util/useExposedProps.tsx +12 -1
- package/dist/app/tailwind.d.ts +0 -4
- package/dist/app/tailwind.js +0 -97
- package/dist/app/tailwind.js.map +0 -1
- package/dist/config/common.d.ts +0 -10
- package/dist/config/common.js +0 -2
- package/dist/config/common.js.map +0 -1
- package/dist/config/validators/common.d.ts +0 -8001
- package/dist/config/validators/common.js +0 -414
- package/dist/config/validators/common.js.map +0 -1
- package/dist/lib/components/SlotletProvider.d.ts +0 -17
- package/dist/lib/components/SlotletProvider.js +0 -18
- package/dist/lib/components/SlotletProvider.js.map +0 -1
- package/dist/vite/plugin-docs.test.js +0 -22
- package/dist/vite/plugin-docs.test.js.map +0 -1
- package/lib/AuthenticationPlugin-UNaAuxNo.js.map +0 -1
- package/lib/Button-Bdk_Ij3U.js +0 -49
- package/lib/Button-Bdk_Ij3U.js.map +0 -1
- package/lib/Callout-XadUe37J.js.map +0 -1
- package/lib/Dialog-CNf2oWXG.js.map +0 -1
- package/lib/Markdown-D96AphCL.js +0 -7691
- package/lib/Markdown-D96AphCL.js.map +0 -1
- package/lib/MdxPage-Sjv6y3cA.js.map +0 -1
- package/lib/OperationList-DefCF3ZI.js.map +0 -1
- package/lib/Pagination-B89j9KJS.js +0 -48
- package/lib/Pagination-B89j9KJS.js.map +0 -1
- package/lib/RouteGuard-lkdEJoDV.js.map +0 -1
- package/lib/SchemaList-zHQ2Ekyw.js.map +0 -1
- package/lib/SchemaView-CqF4oMU-.js.map +0 -1
- package/lib/Select-HTio1oSE.js +0 -211
- package/lib/Select-HTio1oSE.js.map +0 -1
- package/lib/SlotletProvider-CTgIBRWg.js +0 -257
- package/lib/SlotletProvider-CTgIBRWg.js.map +0 -1
- package/lib/Toc-Ax54Pw8S.js.map +0 -1
- package/lib/cn-CwJPJKOE.js.map +0 -1
- package/lib/hook-BwOB_iZo.js.map +0 -1
- package/lib/index-BY8J3gEh.js.map +0 -1
- package/lib/index-CT2PstvH.js +0 -4982
- package/lib/index-CT2PstvH.js.map +0 -1
- package/src/app/tailwind.ts +0 -103
- package/src/lib/components/SlotletProvider.tsx +0 -55
- /package/dist/{vite/plugin-docs.test.d.ts → lib/components/Slot.test.d.ts} +0 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
Fragment,
|
|
4
|
+
use,
|
|
5
|
+
useMemo,
|
|
6
|
+
useRef,
|
|
7
|
+
type ComponentType,
|
|
8
|
+
type PropsWithChildren,
|
|
9
|
+
type ReactNode,
|
|
10
|
+
} from "react";
|
|
11
|
+
import { createStore, useStore } from "zustand";
|
|
12
|
+
import {
|
|
13
|
+
useExposedProps,
|
|
14
|
+
type ExposedComponentProps,
|
|
15
|
+
} from "../../util/useExposedProps.js";
|
|
16
|
+
|
|
17
|
+
export type SlotType = ReactNode | ComponentType<ExposedComponentProps>;
|
|
18
|
+
|
|
19
|
+
type SlotItem = {
|
|
20
|
+
id: string;
|
|
21
|
+
content: SlotType;
|
|
22
|
+
type: "prepend" | "replace" | "append";
|
|
23
|
+
sequence: number;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type SlotStoreState = {
|
|
27
|
+
items: Map<string, SlotItem[]>;
|
|
28
|
+
// to guarantee the order of the items when appending/prepending
|
|
29
|
+
sequences: Map<string, number>;
|
|
30
|
+
getItems: (name: string) => SlotItem[];
|
|
31
|
+
setSlot: (
|
|
32
|
+
id: string,
|
|
33
|
+
name: string,
|
|
34
|
+
content: SlotType,
|
|
35
|
+
type: "prepend" | "replace" | "append",
|
|
36
|
+
) => void;
|
|
37
|
+
clearSlot: (id: string, name: string) => void;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export type SlotStore = ReturnType<typeof createSlotStore>;
|
|
41
|
+
|
|
42
|
+
const createSlotStore = ({
|
|
43
|
+
slots = {},
|
|
44
|
+
}: {
|
|
45
|
+
slots?: Record<string, SlotType>;
|
|
46
|
+
} = {}) => {
|
|
47
|
+
const initialItems = new Map(
|
|
48
|
+
Object.entries(slots).map(([id, content]) => [
|
|
49
|
+
id,
|
|
50
|
+
[{ id, content, type: "replace", sequence: 0 } satisfies SlotItem],
|
|
51
|
+
]),
|
|
52
|
+
);
|
|
53
|
+
const EMPTY_ITEMS: SlotItem[] = [];
|
|
54
|
+
|
|
55
|
+
return createStore<SlotStoreState>()((set, get) => ({
|
|
56
|
+
items: initialItems,
|
|
57
|
+
sequences: new Map(),
|
|
58
|
+
getItems: (name) => get().items.get(name) ?? EMPTY_ITEMS,
|
|
59
|
+
setSlot: (id, name, content, type) =>
|
|
60
|
+
set((state) => {
|
|
61
|
+
if (content == null) return state;
|
|
62
|
+
|
|
63
|
+
const items = new Map(state.items);
|
|
64
|
+
const sequences = new Map(state.sequences);
|
|
65
|
+
const existing = items.get(name) ?? [];
|
|
66
|
+
const filtered = existing.filter((item) => item.id !== id);
|
|
67
|
+
|
|
68
|
+
const currentSequence = sequences.get(name) ?? 0;
|
|
69
|
+
const newSequence = currentSequence + 1;
|
|
70
|
+
sequences.set(name, newSequence);
|
|
71
|
+
|
|
72
|
+
const newItem = {
|
|
73
|
+
id,
|
|
74
|
+
content,
|
|
75
|
+
type,
|
|
76
|
+
// Use negative sequence values for "prepend" to ensure they are sorted before positive values for "append".
|
|
77
|
+
sequence: type === "prepend" ? -newSequence : newSequence,
|
|
78
|
+
} satisfies SlotItem;
|
|
79
|
+
|
|
80
|
+
if (type === "replace") {
|
|
81
|
+
const nonReplaceItems = filtered.filter(
|
|
82
|
+
(item) => item.type !== "replace",
|
|
83
|
+
);
|
|
84
|
+
items.set(name, [...nonReplaceItems, newItem]);
|
|
85
|
+
} else {
|
|
86
|
+
items.set(name, [...filtered, newItem]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return { items, sequences };
|
|
90
|
+
}),
|
|
91
|
+
clearSlot: (id, name) =>
|
|
92
|
+
set((state) => {
|
|
93
|
+
const items = new Map(state.items);
|
|
94
|
+
const sequences = new Map(state.sequences);
|
|
95
|
+
const existing = items.get(name) ?? [];
|
|
96
|
+
const filtered = existing.filter((item) => item.id !== id);
|
|
97
|
+
|
|
98
|
+
if (filtered.length === 0) {
|
|
99
|
+
items.delete(name);
|
|
100
|
+
sequences.delete(name);
|
|
101
|
+
} else {
|
|
102
|
+
items.set(name, filtered);
|
|
103
|
+
}
|
|
104
|
+
return { items, sequences };
|
|
105
|
+
}),
|
|
106
|
+
}));
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const SlotContext = createContext(createSlotStore());
|
|
110
|
+
|
|
111
|
+
export const SlotProvider = ({
|
|
112
|
+
children,
|
|
113
|
+
slots,
|
|
114
|
+
}: PropsWithChildren<{
|
|
115
|
+
slots?: Record<string, SlotType>;
|
|
116
|
+
}>) => {
|
|
117
|
+
const store = useRef<SlotStore>(createSlotStore({ slots })).current;
|
|
118
|
+
return <SlotContext value={store}>{children}</SlotContext>;
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export function useSlotContext<T>(selector: (state: SlotStoreState) => T): T {
|
|
122
|
+
const store = use(SlotContext);
|
|
123
|
+
return useStore(store, selector);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const ORDER = ["prepend", "replace", "append"] as const;
|
|
127
|
+
|
|
128
|
+
export const useRenderSlot = (name: string) => {
|
|
129
|
+
const exposedProps = useExposedProps();
|
|
130
|
+
const items = useSlotContext((s) => s.getItems(name));
|
|
131
|
+
|
|
132
|
+
return useMemo(() => {
|
|
133
|
+
if (items.length === 0) return [];
|
|
134
|
+
|
|
135
|
+
return items
|
|
136
|
+
.toSorted((a, b) => {
|
|
137
|
+
const typeOrder = ORDER.indexOf(a.type) - ORDER.indexOf(b.type);
|
|
138
|
+
if (typeOrder !== 0) return typeOrder;
|
|
139
|
+
return a.sequence - b.sequence;
|
|
140
|
+
})
|
|
141
|
+
.map((item) =>
|
|
142
|
+
typeof item.content === "function" ? (
|
|
143
|
+
<item.content key={item.id} {...exposedProps} />
|
|
144
|
+
) : (
|
|
145
|
+
<Fragment key={item.id}>{item.content}</Fragment>
|
|
146
|
+
),
|
|
147
|
+
);
|
|
148
|
+
}, [items, exposedProps]);
|
|
149
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
2
2
|
import type { PropsWithChildren } from "react";
|
|
3
3
|
import { ZudokuContext } from "../../core/ZudokuContext.js";
|
|
4
|
+
import { NO_DEHYDRATE } from "../cache.js";
|
|
4
5
|
import { ZudokuReactContext } from "./ZudokuContext.js";
|
|
5
6
|
|
|
6
7
|
export const ZudokuProvider = ({
|
|
@@ -12,7 +13,7 @@ export const ZudokuProvider = ({
|
|
|
12
13
|
await context.initialize();
|
|
13
14
|
return true;
|
|
14
15
|
},
|
|
15
|
-
queryKey: ["zudoku-initialize"],
|
|
16
|
+
queryKey: ["zudoku-initialize", NO_DEHYDRATE],
|
|
16
17
|
});
|
|
17
18
|
|
|
18
19
|
return (
|
|
@@ -25,22 +25,13 @@ import { Spinner as SpinnerImport } from "./Spinner.js";
|
|
|
25
25
|
import { StatusPage as StatusPageImport } from "./StatusPage.js";
|
|
26
26
|
import { Zudoku as ZudokuImport } from "./Zudoku.js";
|
|
27
27
|
|
|
28
|
-
export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
|
|
29
28
|
export const Layout = /*@__PURE__*/ LayoutImport;
|
|
30
29
|
export const RouterError = /*@__PURE__*/ RouterErrorImport;
|
|
31
30
|
export const ServerError = /*@__PURE__*/ ServerErrorImport;
|
|
32
31
|
export const Bootstrap = /*@__PURE__*/ BootstrapImport;
|
|
33
32
|
export const BootstrapStatic = /*@__PURE__*/ BootstrapStaticImport;
|
|
34
33
|
export const RouteGuard = /*@__PURE__*/ RouteGuardImport;
|
|
35
|
-
|
|
36
34
|
export const Head = /*@__PURE__*/ Helmet;
|
|
37
|
-
|
|
38
|
-
export const useZudoku = /*@__PURE__*/ useZudokuImport;
|
|
39
|
-
export const useAuth = /*@__PURE__*/ useAuthImport;
|
|
40
|
-
export const useCache = /*@__PURE__*/ useCacheImport;
|
|
41
|
-
export const CACHE_KEYS = /*@__PURE__*/ CACHE_KEYS_IMPORT;
|
|
42
|
-
export const Zudoku = /*@__PURE__*/ ZudokuImport;
|
|
43
|
-
|
|
44
35
|
export const StatusPage = /*@__PURE__*/ StatusPageImport;
|
|
45
36
|
export const Callout = /*@__PURE__*/ CalloutImport;
|
|
46
37
|
export const Markdown = /*@__PURE__*/ MarkdownImport;
|
|
@@ -48,5 +39,18 @@ export const Spinner = /*@__PURE__*/ SpinnerImport;
|
|
|
48
39
|
export const ClientOnly = /*@__PURE__*/ ClientOnlyImport;
|
|
49
40
|
export const Button = /*@__PURE__*/ ButtonImport;
|
|
50
41
|
export const Link = /*@__PURE__*/ LinkImport;
|
|
51
|
-
export const useTheme = /*@__PURE__*/ useThemeImport;
|
|
52
42
|
export const BuildCheck = /*@__PURE__*/ BuildCheckImport;
|
|
43
|
+
export const Zudoku = /*@__PURE__*/ ZudokuImport;
|
|
44
|
+
|
|
45
|
+
/** @deprecated Import from `zudoku/hooks` instead */
|
|
46
|
+
export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
|
|
47
|
+
/** @deprecated Import from `zudoku/hooks` instead */
|
|
48
|
+
export const useZudoku = /*@__PURE__*/ useZudokuImport;
|
|
49
|
+
/** @deprecated Import from `zudoku/hooks` instead */
|
|
50
|
+
export const useAuth = /*@__PURE__*/ useAuthImport;
|
|
51
|
+
/** @deprecated Import from `zudoku/hooks` instead */
|
|
52
|
+
export const useCache = /*@__PURE__*/ useCacheImport;
|
|
53
|
+
/** @deprecated Import from `zudoku/hooks` instead */
|
|
54
|
+
export const CACHE_KEYS = /*@__PURE__*/ CACHE_KEYS_IMPORT;
|
|
55
|
+
/** @deprecated Import from `zudoku/hooks` instead */
|
|
56
|
+
export const useTheme = /*@__PURE__*/ useThemeImport;
|
|
@@ -9,7 +9,7 @@ export const PoweredByZudoku = ({ className }: { className?: string }) => (
|
|
|
9
9
|
target="_blank"
|
|
10
10
|
rel="noopener noreferrer"
|
|
11
11
|
className={cn(
|
|
12
|
-
"flex justify-between items-center w-full border border-transparent hover:border-border rounded-full hover:shadow-
|
|
12
|
+
"flex justify-between items-center w-full border border-transparent hover:border-border rounded-full hover:shadow-xs h-7 px-3 text-nowrap hover:bg-muted/80 transition-all",
|
|
13
13
|
className,
|
|
14
14
|
)}
|
|
15
15
|
>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
2
2
|
import type { SidebarItem as SidebarItemType } from "../../../config/validators/SidebarSchema.js";
|
|
3
3
|
import { DrawerContent, DrawerTitle } from "../../ui/Drawer.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Slot } from "../Slot.js";
|
|
5
5
|
import { SidebarItem } from "./SidebarItem.js";
|
|
6
6
|
import { SidebarWrapper } from "./SidebarWrapper.js";
|
|
7
7
|
|
|
@@ -14,7 +14,7 @@ export const Sidebar = ({
|
|
|
14
14
|
}) => (
|
|
15
15
|
<>
|
|
16
16
|
<SidebarWrapper>
|
|
17
|
-
<
|
|
17
|
+
<Slot.Target name="navigation-before" />
|
|
18
18
|
{sidebar.map((item) => (
|
|
19
19
|
<SidebarItem
|
|
20
20
|
key={
|
|
@@ -25,7 +25,7 @@ export const Sidebar = ({
|
|
|
25
25
|
item={item}
|
|
26
26
|
/>
|
|
27
27
|
))}
|
|
28
|
-
<
|
|
28
|
+
<Slot.Target name="navigation-after" />
|
|
29
29
|
</SidebarWrapper>
|
|
30
30
|
<DrawerContent
|
|
31
31
|
className="lg:hidden h-[100dvh] start-0 w-[320px] rounded-none"
|
|
@@ -36,7 +36,7 @@ export const SidebarBadge = ({
|
|
|
36
36
|
return (
|
|
37
37
|
<span
|
|
38
38
|
className={cn(
|
|
39
|
-
"flex items-center duration-200 transition-opacity text-center uppercase text-[0.65rem] font-bold rounded text-background dark:text-zinc-50 h-full",
|
|
39
|
+
"flex items-center duration-200 transition-opacity text-center uppercase text-[0.65rem] leading-5 font-bold rounded-sm text-background dark:text-zinc-50 h-full",
|
|
40
40
|
color === "outline" ? "px-3" : "mt-0.5 px-1",
|
|
41
41
|
invert ? ColorMapInvert[color] : ColorMap[color],
|
|
42
42
|
className,
|
|
@@ -7,8 +7,8 @@ import { Button } from "zudoku/ui/Button.js";
|
|
|
7
7
|
import type { SidebarItemCategory } from "../../../config/validators/SidebarSchema.js";
|
|
8
8
|
import { cn } from "../../util/cn.js";
|
|
9
9
|
import { joinUrl } from "../../util/joinUrl.js";
|
|
10
|
-
import {
|
|
11
|
-
import { useIsCategoryOpen } from "./utils.js";
|
|
10
|
+
import { SidebarItem } from "./SidebarItem.js";
|
|
11
|
+
import { navigationListItem, useIsCategoryOpen } from "./utils.js";
|
|
12
12
|
|
|
13
13
|
const SidebarCategoryInner = ({
|
|
14
14
|
category,
|
|
@@ -121,7 +121,7 @@ const SidebarCategoryInner = ({
|
|
|
121
121
|
"ms-6 my-1",
|
|
122
122
|
)}
|
|
123
123
|
>
|
|
124
|
-
<ul className="relative after:absolute after:-start-
|
|
124
|
+
<ul className="relative after:absolute after:-start-(--padding-nav-item) after:translate-x-[1.5px] after:top-0 after:bottom-0 after:w-px after:bg-border">
|
|
125
125
|
{category.items.map((item) => (
|
|
126
126
|
<SidebarItem
|
|
127
127
|
key={
|
|
@@ -1,36 +1,67 @@
|
|
|
1
|
-
import { cva } from "class-variance-authority";
|
|
2
1
|
import { ExternalLinkIcon } from "lucide-react";
|
|
2
|
+
import { useEffect, useRef, useState } from "react";
|
|
3
3
|
import { NavLink, useLocation } from "react-router";
|
|
4
|
-
|
|
4
|
+
import {
|
|
5
|
+
Tooltip,
|
|
6
|
+
TooltipArrow,
|
|
7
|
+
TooltipContent,
|
|
8
|
+
TooltipProvider,
|
|
9
|
+
TooltipTrigger,
|
|
10
|
+
} from "zudoku/ui/Tooltip.js";
|
|
5
11
|
import type { SidebarItem as SidebarItemType } from "../../../config/validators/SidebarSchema.js";
|
|
12
|
+
import { cn } from "../../util/cn.js";
|
|
6
13
|
import { joinUrl } from "../../util/joinUrl.js";
|
|
7
14
|
import { AnchorLink } from "../AnchorLink.js";
|
|
8
15
|
import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
|
|
9
16
|
import { SidebarBadge } from "./SidebarBadge.js";
|
|
10
17
|
import { SidebarCategory } from "./SidebarCategory.js";
|
|
18
|
+
import { navigationListItem } from "./utils.js";
|
|
19
|
+
|
|
20
|
+
const TruncatedLabel = ({
|
|
21
|
+
label,
|
|
22
|
+
className,
|
|
23
|
+
}: {
|
|
24
|
+
label: string;
|
|
25
|
+
className?: string;
|
|
26
|
+
}) => {
|
|
27
|
+
const ref = useRef<HTMLSpanElement>(null);
|
|
28
|
+
const [isTruncated, setIsTruncated] = useState(false);
|
|
11
29
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!ref.current) return;
|
|
32
|
+
|
|
33
|
+
if (ref.current.offsetWidth < ref.current.scrollWidth) {
|
|
34
|
+
setIsTruncated(true);
|
|
35
|
+
}
|
|
36
|
+
}, []);
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<>
|
|
40
|
+
<span
|
|
41
|
+
className={cn("truncate flex-1", className)}
|
|
42
|
+
title={label}
|
|
43
|
+
ref={ref}
|
|
44
|
+
>
|
|
45
|
+
{label}
|
|
46
|
+
</span>
|
|
47
|
+
{isTruncated && (
|
|
48
|
+
<TooltipProvider delayDuration={500}>
|
|
49
|
+
<Tooltip disableHoverableContent>
|
|
50
|
+
<TooltipTrigger className="absolute inset-0 z-10" />
|
|
51
|
+
<TooltipContent
|
|
52
|
+
className="max-w-64 rounded-lg"
|
|
53
|
+
side="bottom"
|
|
54
|
+
align="center"
|
|
55
|
+
>
|
|
56
|
+
<TooltipArrow />
|
|
57
|
+
{label}
|
|
58
|
+
</TooltipContent>
|
|
59
|
+
</Tooltip>
|
|
60
|
+
</TooltipProvider>
|
|
61
|
+
)}
|
|
62
|
+
</>
|
|
63
|
+
);
|
|
64
|
+
};
|
|
34
65
|
|
|
35
66
|
export const DATA_ANCHOR_ATTR = "data-anchor";
|
|
36
67
|
|
|
@@ -62,9 +93,7 @@ export const SidebarItem = ({
|
|
|
62
93
|
{item.icon && <item.icon size={16} className="align-[-0.125em]" />}
|
|
63
94
|
{item.badge ? (
|
|
64
95
|
<>
|
|
65
|
-
<
|
|
66
|
-
{item.label}
|
|
67
|
-
</span>
|
|
96
|
+
<TruncatedLabel label={item.label} className="flex-1" />
|
|
68
97
|
<SidebarBadge {...item.badge} />
|
|
69
98
|
</>
|
|
70
99
|
) : (
|
|
@@ -89,9 +118,7 @@ export const SidebarItem = ({
|
|
|
89
118
|
>
|
|
90
119
|
{item.badge ? (
|
|
91
120
|
<>
|
|
92
|
-
<
|
|
93
|
-
{item.label}
|
|
94
|
-
</span>
|
|
121
|
+
<TruncatedLabel label={item.label} />
|
|
95
122
|
<SidebarBadge {...item.badge} />
|
|
96
123
|
</>
|
|
97
124
|
) : (
|
|
@@ -19,12 +19,12 @@ export const SidebarWrapper = ({
|
|
|
19
19
|
}, []);
|
|
20
20
|
|
|
21
21
|
return (
|
|
22
|
-
<div className="grid sticky top-
|
|
22
|
+
<div className="grid sticky top-(--header-height) lg:h-[calc(100vh-var(--header-height))] grid-rows-[1fr_min-content] border-r">
|
|
23
23
|
<nav
|
|
24
24
|
ref={navRef}
|
|
25
25
|
className={cn(
|
|
26
26
|
"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",
|
|
27
|
-
"-mx-
|
|
27
|
+
"-mx-(--padding-nav-item) pb-[8vh] pt-(--padding-content-top) scroll-pt-2 gap-1",
|
|
28
28
|
// Revert the padding/margin on the first child
|
|
29
29
|
"-mt-2.5",
|
|
30
30
|
className,
|
|
@@ -80,7 +80,7 @@ export const Toc = ({ entries }: { entries: TocEntry[] }) => {
|
|
|
80
80
|
}, [activeAnchor]);
|
|
81
81
|
|
|
82
82
|
return (
|
|
83
|
-
<aside className="sticky scrollbar top-8 lg:top-
|
|
83
|
+
<aside className="sticky scrollbar top-8 lg:top-(--header-height) h-[calc(100vh-var(--header-height))] pt-(--padding-content-top) pb-(--padding-content-bottom) overflow-y-auto ps-1 text-sm">
|
|
84
84
|
<div className="flex items-center gap-2 font-medium mb-2">
|
|
85
85
|
<ListTreeIcon size={16} />
|
|
86
86
|
On this page
|
|
@@ -89,7 +89,7 @@ export const Toc = ({ entries }: { entries: TocEntry[] }) => {
|
|
|
89
89
|
<div className="absolute inset-0 end-auto bg-border w-[2px]" />
|
|
90
90
|
<div
|
|
91
91
|
className={cn(
|
|
92
|
-
"absolute -start-px -translate-y-1 h-6 w-[4px] rounded bg-primary",
|
|
92
|
+
"absolute -start-px -translate-y-1 h-6 w-[4px] rounded-sm bg-primary",
|
|
93
93
|
paintedOnce.current &&
|
|
94
94
|
"ease-out [transition:top_150ms,opacity_325ms]",
|
|
95
95
|
)}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
1
2
|
import { useLocation } from "react-router";
|
|
2
3
|
import type {
|
|
3
4
|
SidebarItem,
|
|
4
5
|
SidebarItemCategory,
|
|
5
6
|
} from "../../../config/validators/SidebarSchema.js";
|
|
6
|
-
import {
|
|
7
|
+
import { joinUrl } from "../../util/joinUrl.js";
|
|
7
8
|
import { useCurrentNavigation } from "../context/ZudokuContext.js";
|
|
8
9
|
|
|
9
10
|
export type TraverseCallback<T> = (
|
|
@@ -47,7 +48,7 @@ export const useCurrentItem = () => {
|
|
|
47
48
|
const currentSidebar = nav.sidebar;
|
|
48
49
|
|
|
49
50
|
return traverseSidebar(currentSidebar, (item) => {
|
|
50
|
-
if (item.type === "doc" &&
|
|
51
|
+
if (item.type === "doc" && joinUrl(item.id) === location.pathname) {
|
|
51
52
|
return item;
|
|
52
53
|
}
|
|
53
54
|
});
|
|
@@ -58,14 +59,14 @@ export const useIsCategoryOpen = (category: SidebarItemCategory) => {
|
|
|
58
59
|
|
|
59
60
|
return traverseSidebarItem(category, (item) => {
|
|
60
61
|
if (item.type === "category" && item.link) {
|
|
61
|
-
const categoryLinkPath =
|
|
62
|
+
const categoryLinkPath = joinUrl(item.link.id);
|
|
62
63
|
if (categoryLinkPath === location.pathname) {
|
|
63
64
|
return true;
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
|
|
67
68
|
if (item.type === "doc") {
|
|
68
|
-
const docPath =
|
|
69
|
+
const docPath = joinUrl(item.id);
|
|
69
70
|
if (docPath === location.pathname) {
|
|
70
71
|
return true;
|
|
71
72
|
}
|
|
@@ -89,9 +90,9 @@ export const usePrevNext = (): {
|
|
|
89
90
|
traverseSidebar(currentSidebar, (item) => {
|
|
90
91
|
const itemId =
|
|
91
92
|
item.type === "doc"
|
|
92
|
-
?
|
|
93
|
+
? joinUrl(item.id)
|
|
93
94
|
: item.type === "category" && item.link
|
|
94
|
-
?
|
|
95
|
+
? joinUrl(item.link.id)
|
|
95
96
|
: undefined;
|
|
96
97
|
|
|
97
98
|
if (!itemId) return;
|
|
@@ -110,3 +111,38 @@ export const usePrevNext = (): {
|
|
|
110
111
|
|
|
111
112
|
return { prev, next };
|
|
112
113
|
};
|
|
114
|
+
|
|
115
|
+
export const navigationListItem = cva(
|
|
116
|
+
"relative flex items-center gap-2 px-(--padding-nav-item) my-0.5 py-1.5 rounded-lg hover:bg-accent tabular-nums",
|
|
117
|
+
{
|
|
118
|
+
variants: {
|
|
119
|
+
isActive: {
|
|
120
|
+
true: "bg-accent font-medium",
|
|
121
|
+
false: "text-foreground/80",
|
|
122
|
+
},
|
|
123
|
+
isMuted: {
|
|
124
|
+
true: "text-foreground/30",
|
|
125
|
+
false: "",
|
|
126
|
+
},
|
|
127
|
+
isPending: {
|
|
128
|
+
true: "bg-accent animate-pulse",
|
|
129
|
+
false: "",
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
defaultVariants: {
|
|
133
|
+
isActive: false,
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
export const isHiddenItem =
|
|
139
|
+
(isAuthenticated?: boolean) =>
|
|
140
|
+
(item: { display?: "auth" | "anon" | "always" | "hide" }): boolean => {
|
|
141
|
+
if (item.display === "hide") return false;
|
|
142
|
+
return (
|
|
143
|
+
(item.display === "auth" && isAuthenticated) ||
|
|
144
|
+
(item.display === "anon" && !isAuthenticated) ||
|
|
145
|
+
!item.display ||
|
|
146
|
+
item.display === "always"
|
|
147
|
+
);
|
|
148
|
+
};
|
|
@@ -4,20 +4,21 @@ import type { ReactNode } from "react";
|
|
|
4
4
|
import type { Location } from "react-router";
|
|
5
5
|
import type { BundledTheme, HighlighterCore } from "shiki";
|
|
6
6
|
import type { z } from "zod";
|
|
7
|
+
import type { SidebarConfig } from "../../config/validators/SidebarSchema.js";
|
|
7
8
|
import type {
|
|
8
9
|
FooterSchema,
|
|
9
10
|
TopNavigationItem,
|
|
10
|
-
} from "../../config/validators/
|
|
11
|
-
import type {
|
|
12
|
-
import type { AuthenticationProvider } from "../authentication/authentication.js";
|
|
11
|
+
} from "../../config/validators/validate.js";
|
|
12
|
+
import type { AuthenticationPlugin } from "../authentication/authentication.js";
|
|
13
13
|
import { type AuthState, useAuthState } from "../authentication/state.js";
|
|
14
14
|
import type { ComponentsContextType } from "../components/context/ComponentsContext.js";
|
|
15
|
-
import type {
|
|
15
|
+
import type { SlotType } from "../components/context/SlotProvider.js";
|
|
16
16
|
import { joinPath } from "../util/joinPath.js";
|
|
17
17
|
import type { MdxComponentsType } from "../util/MdxComponents.js";
|
|
18
18
|
import { objectEntries } from "../util/objectEntries.js";
|
|
19
19
|
import {
|
|
20
20
|
isApiIdentityPlugin,
|
|
21
|
+
isAuthenticationPlugin,
|
|
21
22
|
isEventConsumerPlugin,
|
|
22
23
|
isNavigationPlugin,
|
|
23
24
|
type NavigationPlugin,
|
|
@@ -81,11 +82,15 @@ export type ZudokuContextOptions = {
|
|
|
81
82
|
canonicalUrlOrigin?: string;
|
|
82
83
|
metadata?: Metadata;
|
|
83
84
|
page?: Page;
|
|
84
|
-
authentication?:
|
|
85
|
+
authentication?: AuthenticationPlugin;
|
|
85
86
|
topNavigation?: TopNavigationItem[];
|
|
86
87
|
sidebars?: SidebarConfig;
|
|
87
88
|
plugins?: ZudokuPlugin[];
|
|
88
|
-
|
|
89
|
+
slots?: Record<string, SlotType>;
|
|
90
|
+
/**
|
|
91
|
+
* @deprecated Use `slots` instead
|
|
92
|
+
*/
|
|
93
|
+
UNSAFE_slotlets?: Record<string, SlotType>;
|
|
89
94
|
mdx?: {
|
|
90
95
|
components?: MdxComponentsType;
|
|
91
96
|
};
|
|
@@ -103,19 +108,26 @@ export class ZudokuContext {
|
|
|
103
108
|
public topNavigation: NonNullable<ZudokuContextOptions["topNavigation"]>;
|
|
104
109
|
public meta: ZudokuContextOptions["metadata"];
|
|
105
110
|
public page: ZudokuContextOptions["page"];
|
|
106
|
-
public authentication?: ZudokuContextOptions["authentication"];
|
|
111
|
+
public readonly authentication?: ZudokuContextOptions["authentication"];
|
|
112
|
+
public readonly queryClient: QueryClient;
|
|
113
|
+
public readonly options: ZudokuContextOptions;
|
|
107
114
|
private readonly navigationPlugins: NavigationPlugin[];
|
|
108
115
|
private emitter = createNanoEvents<ZudokuEvents>();
|
|
109
116
|
|
|
110
|
-
constructor(
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
117
|
+
constructor(options: ZudokuContextOptions, queryClient: QueryClient) {
|
|
118
|
+
const protectedRoutes = (options.protectedRoutes ?? []).concat(
|
|
119
|
+
options.plugins?.flatMap((plugin) =>
|
|
120
|
+
isNavigationPlugin(plugin) ? (plugin.getProtectedRoutes?.() ?? []) : [],
|
|
121
|
+
) ?? [],
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
this.queryClient = queryClient;
|
|
125
|
+
this.options = { ...options, protectedRoutes };
|
|
114
126
|
this.plugins = options.plugins ?? [];
|
|
115
127
|
this.topNavigation = options.topNavigation ?? [];
|
|
116
128
|
this.sidebars = options.sidebars ?? {};
|
|
117
129
|
this.navigationPlugins = this.plugins.filter(isNavigationPlugin);
|
|
118
|
-
this.authentication =
|
|
130
|
+
this.authentication = this.plugins.find(isAuthenticationPlugin);
|
|
119
131
|
this.meta = options.metadata;
|
|
120
132
|
this.page = options.page;
|
|
121
133
|
this.plugins.forEach((plugin) => {
|
package/src/lib/core/plugins.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { LucideIcon } from "lucide-react";
|
|
|
2
2
|
import type { ReactElement } from "react";
|
|
3
3
|
import type { Location, RouteObject } from "react-router";
|
|
4
4
|
import type { Sidebar } from "../../config/validators/SidebarSchema.js";
|
|
5
|
+
import type { AuthenticationPlugin } from "../authentication/authentication.js";
|
|
5
6
|
import type { MdxComponentsType } from "../util/MdxComponents.js";
|
|
6
7
|
import type {
|
|
7
8
|
ApiIdentity,
|
|
@@ -15,13 +16,15 @@ export type ZudokuPlugin =
|
|
|
15
16
|
| NavigationPlugin
|
|
16
17
|
| ApiIdentityPlugin
|
|
17
18
|
| SearchProviderPlugin
|
|
18
|
-
| EventConsumerPlugin
|
|
19
|
+
| EventConsumerPlugin
|
|
20
|
+
| AuthenticationPlugin;
|
|
19
21
|
|
|
20
|
-
export type { RouteObject };
|
|
22
|
+
export type { AuthenticationPlugin, RouteObject };
|
|
21
23
|
|
|
22
24
|
export interface NavigationPlugin {
|
|
23
25
|
getRoutes: () => RouteObject[];
|
|
24
26
|
getSidebar?: (path: string, context: ZudokuContext) => Promise<Sidebar>;
|
|
27
|
+
getProtectedRoutes?: () => string[];
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
export const createApiIdentityPlugin = (
|
|
@@ -83,6 +86,11 @@ export const isNavigationPlugin = (
|
|
|
83
86
|
): obj is NavigationPlugin =>
|
|
84
87
|
"getRoutes" in obj && typeof obj.getRoutes === "function";
|
|
85
88
|
|
|
89
|
+
export const isAuthenticationPlugin = (
|
|
90
|
+
obj: ZudokuPlugin,
|
|
91
|
+
): obj is AuthenticationPlugin =>
|
|
92
|
+
"signUp" in obj && typeof obj.signUp === "function";
|
|
93
|
+
|
|
86
94
|
export const isSearchPlugin = (
|
|
87
95
|
obj: ZudokuPlugin,
|
|
88
96
|
): obj is SearchProviderPlugin =>
|
|
@@ -22,7 +22,7 @@ export function ErrorAlert({ error }: { error: unknown }) {
|
|
|
22
22
|
<div
|
|
23
23
|
className={cn(
|
|
24
24
|
ProseClasses,
|
|
25
|
-
"grid grid-cols-1 !max-w-none pt-
|
|
25
|
+
"grid grid-cols-1 !max-w-none pt-(--padding-content-top)",
|
|
26
26
|
)}
|
|
27
27
|
>
|
|
28
28
|
<Heading level={1}>{title}</Heading>
|
package/src/lib/hooks/index.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
+
import { useMDXComponents as useMDXComponentsImport } from "@mdx-js/react";
|
|
1
2
|
import { useTheme as useThemeImport } from "next-themes";
|
|
3
|
+
import { useAuth as useAuthImport } from "../authentication/hook.js";
|
|
4
|
+
import { CACHE_KEYS, useCache as useCacheImport } from "../components/cache.js";
|
|
5
|
+
import { useZudoku as useZudokuImport } from "../components/context/ZudokuContext.js";
|
|
6
|
+
import { useExposedProps as useExposedPropsImport } from "../util/useExposedProps.js";
|
|
2
7
|
import { useEvent as useEventImport } from "./useEvent.js";
|
|
3
8
|
|
|
4
9
|
export const useEvent = /*@__PURE__*/ useEventImport;
|
|
5
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 };
|
|
@@ -29,7 +29,7 @@ export const Catalog = ({
|
|
|
29
29
|
const dataSet = activeCategory ? { "data-pagefind-ignore": "all" } : {};
|
|
30
30
|
|
|
31
31
|
return (
|
|
32
|
-
<section className="pt-
|
|
32
|
+
<section className="pt-(--padding-content-top)" {...dataSet}>
|
|
33
33
|
<Helmet>
|
|
34
34
|
<title>
|
|
35
35
|
{categoryLabel ? `${categoryLabel} - ` : ""}
|