zudoku 0.45.1 → 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/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 +3 -3
- 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-tTTaDsLc.js → MdxPage-B3v1BSKr.js} +11 -11
- package/lib/MdxPage-B3v1BSKr.js.map +1 -0
- package/lib/{OasProvider-DalHQixM.js → OasProvider-5jrFuhVk.js} +3 -3
- package/lib/{OasProvider-DalHQixM.js.map → OasProvider-5jrFuhVk.js.map} +1 -1
- package/lib/{OperationList-BB09ENaq.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-BH9bgMRw.js → SchemaList-B4riYLoP.js} +61 -47
- package/lib/SchemaList-B4riYLoP.js.map +1 -0
- package/lib/{SchemaView-BsB7EFRl.js → SchemaView-CPZ6RgsF.js} +100 -95
- package/lib/SchemaView-CPZ6RgsF.js.map +1 -0
- package/lib/{AuthenticationPlugin-BTJ37DKg.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-CZaZtOBs.js → circular-oB4auIIg.js} +2 -2
- package/lib/{circular-CZaZtOBs.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-DmqFeMgf.js → createServer-DCB82j2t.js} +81 -81
- package/lib/{createServer-DmqFeMgf.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-sS7O9W-R.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 -15
- 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 +4 -4
- 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-BTJ37DKg.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-tTTaDsLc.js.map +0 -1
- package/lib/OperationList-BB09ENaq.js.map +0 -1
- package/lib/Pagination-CtmnJOJi.js +0 -48
- package/lib/Pagination-CtmnJOJi.js.map +0 -1
- package/lib/RouteGuard-lkdEJoDV.js.map +0 -1
- package/lib/SchemaList-BH9bgMRw.js.map +0 -1
- package/lib/SchemaView-BsB7EFRl.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-BnT4-Efz.js +0 -4975
- package/lib/index-BnT4-Efz.js.map +0 -1
- package/lib/index-sS7O9W-R.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,465 @@
|
|
|
1
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
2
|
+
import {
|
|
3
|
+
act,
|
|
4
|
+
screen,
|
|
5
|
+
render as testRender,
|
|
6
|
+
type RenderResult,
|
|
7
|
+
} from "@testing-library/react";
|
|
8
|
+
import type { PropsWithChildren, ReactNode } from "react";
|
|
9
|
+
import { useEffect, useState } from "react";
|
|
10
|
+
import { MemoryRouter } from "react-router";
|
|
11
|
+
import { describe, expect, it } from "vitest";
|
|
12
|
+
import { ZudokuContext } from "../core/ZudokuContext.js";
|
|
13
|
+
import { Slot } from "./Slot.js";
|
|
14
|
+
import { SlotProvider } from "./context/SlotProvider.js";
|
|
15
|
+
import { ZudokuProvider } from "./context/ZudokuProvider.js";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @vitest-environment happy-dom
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const createWrapper = (slots: Record<string, ReactNode> = {}) => {
|
|
22
|
+
const queryClient = new QueryClient();
|
|
23
|
+
const context = new ZudokuContext({}, queryClient);
|
|
24
|
+
|
|
25
|
+
const wrapper = ({ children }: PropsWithChildren) => (
|
|
26
|
+
<MemoryRouter initialEntries={["/", "/page"]}>
|
|
27
|
+
<QueryClientProvider client={queryClient}>
|
|
28
|
+
<ZudokuProvider context={context}>
|
|
29
|
+
<SlotProvider slots={slots}>{children}</SlotProvider>
|
|
30
|
+
</ZudokuProvider>
|
|
31
|
+
</QueryClientProvider>
|
|
32
|
+
</MemoryRouter>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
return { context, wrapper };
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// We wrap every render function with `act` because of Suspense:
|
|
39
|
+
// https://github.com/testing-library/react-testing-library/issues/1375
|
|
40
|
+
const render = async (
|
|
41
|
+
element: ReactNode,
|
|
42
|
+
slots: Record<string, ReactNode> = {},
|
|
43
|
+
) => {
|
|
44
|
+
let renderResult: unknown;
|
|
45
|
+
const { wrapper } = createWrapper(slots);
|
|
46
|
+
|
|
47
|
+
await act(async () => {
|
|
48
|
+
renderResult = testRender(element, { wrapper });
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return renderResult as RenderResult;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
describe("Slot", () => {
|
|
55
|
+
describe("Slot.Target", () => {
|
|
56
|
+
it("renders fallback when no slot content is provided", async () => {
|
|
57
|
+
await render(
|
|
58
|
+
<Slot.Target
|
|
59
|
+
name="footer-after"
|
|
60
|
+
fallback={<div>Fallback content</div>}
|
|
61
|
+
/>,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
expect(screen.getByText("Fallback content")).toBeInTheDocument();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it("renders nothing when no slot content and no fallback", async () => {
|
|
68
|
+
const { container } = await render(<Slot.Target name="footer-after" />);
|
|
69
|
+
expect(container.firstChild).toBeNull();
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("renders slot content when provided via SlotProvider", async () => {
|
|
73
|
+
await render(
|
|
74
|
+
<Slot.Target
|
|
75
|
+
name="footer-after"
|
|
76
|
+
fallback={<div>Fallback content</div>}
|
|
77
|
+
/>,
|
|
78
|
+
{ "footer-after": <div>Provider content</div> },
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
expect(screen.getByText("Provider content")).toBeInTheDocument();
|
|
82
|
+
expect(screen.queryByText("Fallback content")).not.toBeInTheDocument();
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
describe("Slot.Source", () => {
|
|
87
|
+
it("renders content in target slot with replace type (default)", async () => {
|
|
88
|
+
await render(
|
|
89
|
+
<>
|
|
90
|
+
<Slot.Source name="footer-after">
|
|
91
|
+
<div>Source content</div>
|
|
92
|
+
</Slot.Source>
|
|
93
|
+
<Slot.Target
|
|
94
|
+
name="footer-after"
|
|
95
|
+
fallback={<div>Fallback content</div>}
|
|
96
|
+
/>
|
|
97
|
+
</>,
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
expect(screen.getByText("Source content")).toBeInTheDocument();
|
|
101
|
+
expect(screen.queryByText("Fallback content")).not.toBeInTheDocument();
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("renders content in target slot with explicit replace type", async () => {
|
|
105
|
+
await render(
|
|
106
|
+
<>
|
|
107
|
+
<Slot.Source name="footer-after" type="replace">
|
|
108
|
+
<div>Replace content</div>
|
|
109
|
+
</Slot.Source>
|
|
110
|
+
<Slot.Target name="footer-after" />
|
|
111
|
+
</>,
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
expect(screen.getByText("Replace content")).toBeInTheDocument();
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it("prepends content when type is prepend", async () => {
|
|
118
|
+
const { container } = await render(
|
|
119
|
+
<>
|
|
120
|
+
<Slot.Source name="footer-after" type="prepend">
|
|
121
|
+
<span>Prepended</span>
|
|
122
|
+
</Slot.Source>
|
|
123
|
+
<Slot.Target name="footer-after" />
|
|
124
|
+
</>,
|
|
125
|
+
{
|
|
126
|
+
"footer-after": <span>Original</span>,
|
|
127
|
+
},
|
|
128
|
+
);
|
|
129
|
+
|
|
130
|
+
expect(container.textContent).toBe("PrependedOriginal");
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("appends content when type is append", async () => {
|
|
134
|
+
const { container } = await render(
|
|
135
|
+
<>
|
|
136
|
+
<Slot.Source name="footer-after" type="append">
|
|
137
|
+
<span>Appended</span>
|
|
138
|
+
</Slot.Source>
|
|
139
|
+
<Slot.Target name="footer-after" />
|
|
140
|
+
</>,
|
|
141
|
+
{ "footer-after": <span>Original</span> },
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
expect(container.textContent).toBe("OriginalAppended");
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
it("handles multiple sources with different types in correct order", async () => {
|
|
148
|
+
const { container } = await render(
|
|
149
|
+
<>
|
|
150
|
+
<Slot.Source name="footer-after" type="append">
|
|
151
|
+
<span>Appended</span>
|
|
152
|
+
</Slot.Source>
|
|
153
|
+
<Slot.Source name="footer-after" type="prepend">
|
|
154
|
+
<span>Prepended</span>
|
|
155
|
+
</Slot.Source>
|
|
156
|
+
<Slot.Target name="footer-after" />
|
|
157
|
+
</>,
|
|
158
|
+
{
|
|
159
|
+
"footer-after": <span>Original</span>,
|
|
160
|
+
},
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
expect(container.textContent).toBe("PrependedOriginalAppended");
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
it("replaces content when multiple replace sources are provided", async () => {
|
|
167
|
+
await render(
|
|
168
|
+
<>
|
|
169
|
+
<Slot.Source name="footer-after" type="replace">
|
|
170
|
+
<span>First replace</span>
|
|
171
|
+
</Slot.Source>
|
|
172
|
+
<Slot.Source name="footer-after" type="replace">
|
|
173
|
+
<span>Second replace</span>
|
|
174
|
+
</Slot.Source>
|
|
175
|
+
<Slot.Target name="footer-after" />
|
|
176
|
+
</>,
|
|
177
|
+
);
|
|
178
|
+
|
|
179
|
+
expect(screen.getByText("Second replace")).toBeInTheDocument();
|
|
180
|
+
expect(screen.queryByText("First replace")).not.toBeInTheDocument();
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it("cleans up slot content when component unmounts", async () => {
|
|
184
|
+
const { rerender } = await render(
|
|
185
|
+
<>
|
|
186
|
+
<Slot.Source name="footer-after">
|
|
187
|
+
<div>Source content</div>
|
|
188
|
+
</Slot.Source>
|
|
189
|
+
<Slot.Target
|
|
190
|
+
name="footer-after"
|
|
191
|
+
fallback={<div>Fallback content</div>}
|
|
192
|
+
/>
|
|
193
|
+
</>,
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
expect(screen.getByText("Source content")).toBeInTheDocument();
|
|
197
|
+
|
|
198
|
+
rerender(
|
|
199
|
+
<>
|
|
200
|
+
<Slot.Target
|
|
201
|
+
name="footer-after"
|
|
202
|
+
fallback={<div>Fallback content</div>}
|
|
203
|
+
/>
|
|
204
|
+
</>,
|
|
205
|
+
);
|
|
206
|
+
|
|
207
|
+
expect(screen.getByText("Fallback content")).toBeInTheDocument();
|
|
208
|
+
expect(screen.queryByText("Source content")).not.toBeInTheDocument();
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
it("handles multiple prepend sources in correct order", async () => {
|
|
212
|
+
const { container } = await render(
|
|
213
|
+
<>
|
|
214
|
+
<Slot.Source name="footer-after" type="prepend">
|
|
215
|
+
<span>First prepend</span>
|
|
216
|
+
</Slot.Source>
|
|
217
|
+
<Slot.Source name="footer-after" type="prepend">
|
|
218
|
+
<span>Second prepend</span>
|
|
219
|
+
</Slot.Source>
|
|
220
|
+
<Slot.Target name="footer-after" />
|
|
221
|
+
</>,
|
|
222
|
+
{ "footer-after": <span>Original</span> },
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
expect(container.textContent).toBe("Second prependFirst prependOriginal");
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
it("handles multiple append sources in correct order", async () => {
|
|
229
|
+
const { container } = await render(
|
|
230
|
+
<>
|
|
231
|
+
<Slot.Source name="footer-after" type="append">
|
|
232
|
+
<span>First append</span>
|
|
233
|
+
</Slot.Source>
|
|
234
|
+
<Slot.Source name="footer-after" type="append">
|
|
235
|
+
<span>Second append</span>
|
|
236
|
+
</Slot.Source>
|
|
237
|
+
<Slot.Target name="footer-after" />
|
|
238
|
+
</>,
|
|
239
|
+
{ "footer-after": <span>Original</span> },
|
|
240
|
+
);
|
|
241
|
+
|
|
242
|
+
expect(container.textContent).toBe("OriginalFirst appendSecond append");
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
it("handles empty children in Source", async () => {
|
|
246
|
+
const { container } = await render(
|
|
247
|
+
<>
|
|
248
|
+
<Slot.Source name="footer-after">{null}</Slot.Source>
|
|
249
|
+
<Slot.Target name="footer-after" fallback={<span>Fallback</span>} />
|
|
250
|
+
</>,
|
|
251
|
+
);
|
|
252
|
+
|
|
253
|
+
// Empty children should be ignored, showing fallback
|
|
254
|
+
expect(container.textContent).toBe("Fallback");
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
it("renders content when Target is defined before Source", async () => {
|
|
258
|
+
await render(
|
|
259
|
+
<>
|
|
260
|
+
<Slot.Target name="footer-after" />
|
|
261
|
+
<Slot.Source name="footer-after">
|
|
262
|
+
<div>Source content</div>
|
|
263
|
+
</Slot.Source>
|
|
264
|
+
</>,
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
expect(screen.getByText("Source content")).toBeInTheDocument();
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
it("renders content when Source is defined before Target", async () => {
|
|
271
|
+
await render(
|
|
272
|
+
<>
|
|
273
|
+
<Slot.Source name="footer-after">
|
|
274
|
+
<div>Source content</div>
|
|
275
|
+
</Slot.Source>
|
|
276
|
+
<Slot.Target name="footer-after" />
|
|
277
|
+
</>,
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
expect(screen.getByText("Source content")).toBeInTheDocument();
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
describe("Multiple slots", () => {
|
|
285
|
+
it("handles multiple independent slots", async () => {
|
|
286
|
+
await render(
|
|
287
|
+
<>
|
|
288
|
+
<Slot.Source name="footer-before">
|
|
289
|
+
<div>Content 1</div>
|
|
290
|
+
</Slot.Source>
|
|
291
|
+
<Slot.Source name="footer-after">
|
|
292
|
+
<div>Content 2</div>
|
|
293
|
+
</Slot.Source>
|
|
294
|
+
<Slot.Target name="footer-before" />
|
|
295
|
+
<Slot.Target name="footer-after" />
|
|
296
|
+
</>,
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
expect(screen.getByText("Content 1")).toBeInTheDocument();
|
|
300
|
+
expect(screen.getByText("Content 2")).toBeInTheDocument();
|
|
301
|
+
});
|
|
302
|
+
|
|
303
|
+
it("handles slots with same name but different targets", async () => {
|
|
304
|
+
await render(
|
|
305
|
+
<>
|
|
306
|
+
<Slot.Source name="footer-after">
|
|
307
|
+
<div>Shared content</div>
|
|
308
|
+
</Slot.Source>
|
|
309
|
+
<div data-testid="target-1">
|
|
310
|
+
<Slot.Target name="footer-after" />
|
|
311
|
+
</div>
|
|
312
|
+
<div data-testid="target-2">
|
|
313
|
+
<Slot.Target name="footer-after" />
|
|
314
|
+
</div>
|
|
315
|
+
</>,
|
|
316
|
+
);
|
|
317
|
+
|
|
318
|
+
const targets = screen.getAllByText("Shared content");
|
|
319
|
+
expect(targets).toHaveLength(2);
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
it("handles nested slots", async () => {
|
|
323
|
+
await render(
|
|
324
|
+
<>
|
|
325
|
+
<Slot.Source name="content-before">
|
|
326
|
+
<div>
|
|
327
|
+
Outer content
|
|
328
|
+
<Slot.Source name="content-after">
|
|
329
|
+
<div>Inner content</div>
|
|
330
|
+
</Slot.Source>
|
|
331
|
+
</div>
|
|
332
|
+
</Slot.Source>
|
|
333
|
+
<Slot.Target name="content-before" />
|
|
334
|
+
<Slot.Target name="content-after" />
|
|
335
|
+
</>,
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
expect(screen.getByText("Outer content")).toBeInTheDocument();
|
|
339
|
+
expect(screen.getByText("Inner content")).toBeInTheDocument();
|
|
340
|
+
});
|
|
341
|
+
});
|
|
342
|
+
|
|
343
|
+
describe("Edge cases", () => {
|
|
344
|
+
it("handles deep nesting of slots", async () => {
|
|
345
|
+
await render(
|
|
346
|
+
<>
|
|
347
|
+
<Slot.Source name="content-before">
|
|
348
|
+
<div>
|
|
349
|
+
Level 1
|
|
350
|
+
<Slot.Source name="content-after">
|
|
351
|
+
<div>
|
|
352
|
+
Level 2
|
|
353
|
+
<Slot.Source name="navigation-before">
|
|
354
|
+
<div>Level 3</div>
|
|
355
|
+
</Slot.Source>
|
|
356
|
+
</div>
|
|
357
|
+
</Slot.Source>
|
|
358
|
+
</div>
|
|
359
|
+
</Slot.Source>
|
|
360
|
+
<Slot.Target name="content-before" />
|
|
361
|
+
<Slot.Target name="content-after" />
|
|
362
|
+
<Slot.Target name="navigation-before" />
|
|
363
|
+
</>,
|
|
364
|
+
);
|
|
365
|
+
|
|
366
|
+
expect(screen.getByText("Level 1")).toBeInTheDocument();
|
|
367
|
+
expect(screen.getByText("Level 2")).toBeInTheDocument();
|
|
368
|
+
expect(screen.getByText("Level 3")).toBeInTheDocument();
|
|
369
|
+
});
|
|
370
|
+
|
|
371
|
+
it("handles many slots", async () => {
|
|
372
|
+
const manySlots = Array.from({ length: 50 }, (_, i) => `slot-${i}`);
|
|
373
|
+
|
|
374
|
+
await render(
|
|
375
|
+
<>
|
|
376
|
+
{manySlots.map((name) => (
|
|
377
|
+
<Slot.Source key={name} name={name as any}>
|
|
378
|
+
<div>Content {name}</div>
|
|
379
|
+
</Slot.Source>
|
|
380
|
+
))}
|
|
381
|
+
{manySlots.map((name) => (
|
|
382
|
+
<Slot.Target key={name} name={name as any} />
|
|
383
|
+
))}
|
|
384
|
+
</>,
|
|
385
|
+
);
|
|
386
|
+
|
|
387
|
+
manySlots.forEach((name) => {
|
|
388
|
+
expect(screen.getByText(`Content ${name}`)).toBeInTheDocument();
|
|
389
|
+
});
|
|
390
|
+
});
|
|
391
|
+
});
|
|
392
|
+
|
|
393
|
+
describe("Integration cases", () => {
|
|
394
|
+
it("handles updates", async () => {
|
|
395
|
+
const { rerender } = await render(
|
|
396
|
+
<>
|
|
397
|
+
<Slot.Source name="content-before">
|
|
398
|
+
<div>Initial content</div>
|
|
399
|
+
</Slot.Source>
|
|
400
|
+
<Slot.Target name="content-before" />
|
|
401
|
+
</>,
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
expect(screen.getByText("Initial content")).toBeInTheDocument();
|
|
405
|
+
|
|
406
|
+
rerender(
|
|
407
|
+
<>
|
|
408
|
+
<Slot.Source name="content-before">
|
|
409
|
+
<div>Updated content</div>
|
|
410
|
+
</Slot.Source>
|
|
411
|
+
<Slot.Target name="content-before" />
|
|
412
|
+
</>,
|
|
413
|
+
);
|
|
414
|
+
|
|
415
|
+
expect(screen.getByText("Updated content")).toBeInTheDocument();
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
it("handles async content", async () => {
|
|
419
|
+
vi.useFakeTimers();
|
|
420
|
+
|
|
421
|
+
const AsyncContent = () => {
|
|
422
|
+
const [content, setContent] = useState("Loading...");
|
|
423
|
+
|
|
424
|
+
useEffect(() => {
|
|
425
|
+
setTimeout(() => setContent("Loaded content"), 250);
|
|
426
|
+
}, []);
|
|
427
|
+
|
|
428
|
+
return <div>{content}</div>;
|
|
429
|
+
};
|
|
430
|
+
|
|
431
|
+
await render(
|
|
432
|
+
<>
|
|
433
|
+
<Slot.Source name="content-before">
|
|
434
|
+
<AsyncContent />
|
|
435
|
+
</Slot.Source>
|
|
436
|
+
<Slot.Target name="content-before" />
|
|
437
|
+
</>,
|
|
438
|
+
);
|
|
439
|
+
|
|
440
|
+
expect(screen.getByText("Loading...")).toBeInTheDocument();
|
|
441
|
+
|
|
442
|
+
await act(async () => {
|
|
443
|
+
vi.advanceTimersToNextTimer();
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
expect(screen.getByText("Loaded content")).toBeInTheDocument();
|
|
447
|
+
|
|
448
|
+
vi.useRealTimers();
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
it("renders render functions", async () => {
|
|
452
|
+
await render(
|
|
453
|
+
<>
|
|
454
|
+
<Slot.Source name="content-before">
|
|
455
|
+
{(props) => `Current path: ${props.location.pathname}`}
|
|
456
|
+
</Slot.Source>
|
|
457
|
+
<Slot.Target name="content-before" />
|
|
458
|
+
</>,
|
|
459
|
+
{},
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
expect(screen.getByText("Current path: /page")).toBeInTheDocument();
|
|
463
|
+
});
|
|
464
|
+
});
|
|
465
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { useId, useLayoutEffect, type ReactNode } from "react";
|
|
2
|
+
import {
|
|
3
|
+
useRenderSlot,
|
|
4
|
+
useSlotContext,
|
|
5
|
+
type SlotType,
|
|
6
|
+
} from "./context/SlotProvider.js";
|
|
7
|
+
|
|
8
|
+
// This is to augment the type of the Slot component with custom slot names
|
|
9
|
+
// This is useful for plugins to add custom slots to the Zudoku context
|
|
10
|
+
// and for the user to use them in their own components
|
|
11
|
+
export type CustomSlotNames = never;
|
|
12
|
+
|
|
13
|
+
type PredefinedSlotNames =
|
|
14
|
+
| "api-keys-list-page"
|
|
15
|
+
| "api-keys-list-page-before-keys"
|
|
16
|
+
| "footer-after"
|
|
17
|
+
| "footer-before"
|
|
18
|
+
| "head-navigation-end"
|
|
19
|
+
| "head-navigation-start"
|
|
20
|
+
| "layout-after-head"
|
|
21
|
+
| "layout-before-head"
|
|
22
|
+
| "top-navigation-after"
|
|
23
|
+
| "top-navigation-before"
|
|
24
|
+
| "top-navigation-side"
|
|
25
|
+
| "content-before"
|
|
26
|
+
| "content-after"
|
|
27
|
+
| "navigation-after"
|
|
28
|
+
| "navigation-before";
|
|
29
|
+
|
|
30
|
+
export type SlotName = PredefinedSlotNames | CustomSlotNames;
|
|
31
|
+
|
|
32
|
+
export const Slot = {
|
|
33
|
+
Source: ({
|
|
34
|
+
name,
|
|
35
|
+
children,
|
|
36
|
+
type = "replace",
|
|
37
|
+
}: {
|
|
38
|
+
name: SlotName;
|
|
39
|
+
type?: "prepend" | "replace" | "append";
|
|
40
|
+
children: SlotType;
|
|
41
|
+
}) => {
|
|
42
|
+
const id = useId();
|
|
43
|
+
const setSlot = useSlotContext((s) => s.setSlot);
|
|
44
|
+
const clearSlot = useSlotContext((s) => s.clearSlot);
|
|
45
|
+
|
|
46
|
+
if (import.meta.env.SSR) {
|
|
47
|
+
setSlot(id, name, children, type);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
useLayoutEffect(() => {
|
|
51
|
+
setSlot(id, name, children, type);
|
|
52
|
+
return () => clearSlot(id, name);
|
|
53
|
+
}, [id, name, children, type, setSlot, clearSlot]);
|
|
54
|
+
|
|
55
|
+
return null;
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
Target: ({ name, fallback }: { name: string; fallback?: ReactNode }) => {
|
|
59
|
+
const slot = useRenderSlot(name);
|
|
60
|
+
|
|
61
|
+
if (slot.length === 0) return fallback;
|
|
62
|
+
return slot;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -2,24 +2,12 @@ import { useNProgress } from "@tanem/react-nprogress";
|
|
|
2
2
|
import { cx } from "class-variance-authority";
|
|
3
3
|
import { Suspense, useEffect, useState } from "react";
|
|
4
4
|
import { NavLink, useNavigation } from "react-router";
|
|
5
|
-
import type { TopNavigationItem } from "../../config/validators/
|
|
5
|
+
import type { TopNavigationItem } from "../../config/validators/validate.js";
|
|
6
6
|
import { useAuth } from "../authentication/hook.js";
|
|
7
7
|
import { joinUrl } from "../util/joinUrl.js";
|
|
8
8
|
import { useCurrentNavigation, useZudoku } from "./context/ZudokuContext.js";
|
|
9
|
-
import { traverseSidebar } from "./navigation/utils.js";
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
export const isHiddenItem =
|
|
13
|
-
(isAuthenticated?: boolean) =>
|
|
14
|
-
(item: { display?: "auth" | "anon" | "always" | "hide" }): boolean => {
|
|
15
|
-
if (item.display === "hide") return false;
|
|
16
|
-
return (
|
|
17
|
-
(item.display === "auth" && isAuthenticated) ||
|
|
18
|
-
(item.display === "anon" && !isAuthenticated) ||
|
|
19
|
-
!item.display ||
|
|
20
|
-
item.display === "always"
|
|
21
|
-
);
|
|
22
|
-
};
|
|
9
|
+
import { isHiddenItem, traverseSidebar } from "./navigation/utils.js";
|
|
10
|
+
import { Slot } from "./Slot.js";
|
|
23
11
|
|
|
24
12
|
export const PageProgress = () => {
|
|
25
13
|
const navigation = useNavigation();
|
|
@@ -58,7 +46,7 @@ export const TopNavigation = () => {
|
|
|
58
46
|
|
|
59
47
|
return (
|
|
60
48
|
<Suspense>
|
|
61
|
-
<div className="items-center justify-between px-8 h-
|
|
49
|
+
<div className="items-center justify-between px-8 h-(--top-nav-height) hidden lg:flex text-sm relative">
|
|
62
50
|
<nav className="text-sm">
|
|
63
51
|
<ul className="flex flex-row items-center gap-8">
|
|
64
52
|
{filteredItems.map((item) => (
|
|
@@ -68,7 +56,7 @@ export const TopNavigation = () => {
|
|
|
68
56
|
))}
|
|
69
57
|
</ul>
|
|
70
58
|
</nav>
|
|
71
|
-
<
|
|
59
|
+
<Slot.Target name="top-navigation-side" />
|
|
72
60
|
</div>
|
|
73
61
|
<PageProgress />
|
|
74
62
|
</Suspense>
|
|
@@ -26,9 +26,9 @@ import {
|
|
|
26
26
|
DEFAULT_COMPONENTS,
|
|
27
27
|
} from "./context/ComponentsContext.js";
|
|
28
28
|
import { RouterEventsEmitter } from "./context/RouterEventsEmitter.js";
|
|
29
|
+
import { SlotProvider } from "./context/SlotProvider.js";
|
|
29
30
|
import { ViewportAnchorProvider } from "./context/ViewportAnchorContext.js";
|
|
30
31
|
import { ZudokuProvider } from "./context/ZudokuProvider.js";
|
|
31
|
-
import { SlotletProvider } from "./SlotletProvider.js";
|
|
32
32
|
|
|
33
33
|
let zudokuContext: ZudokuContext | undefined;
|
|
34
34
|
|
|
@@ -87,17 +87,17 @@ const ZudokoInner = memo(
|
|
|
87
87
|
<StaggeredRenderContext.Provider value={staggeredValue}>
|
|
88
88
|
<ZudokuProvider context={zudokuContext}>
|
|
89
89
|
<RouterEventsEmitter />
|
|
90
|
-
<
|
|
91
|
-
<
|
|
92
|
-
<
|
|
93
|
-
<
|
|
90
|
+
<SlotProvider slots={props.slots ?? props.UNSAFE_slotlets}>
|
|
91
|
+
<MDXProvider components={mdxComponents}>
|
|
92
|
+
<ThemeProvider attribute="class" disableTransitionOnChange>
|
|
93
|
+
<ComponentsProvider value={components}>
|
|
94
94
|
<ViewportAnchorProvider>
|
|
95
95
|
{children ?? <Outlet />}
|
|
96
96
|
</ViewportAnchorProvider>
|
|
97
|
-
</
|
|
98
|
-
</
|
|
99
|
-
</
|
|
100
|
-
</
|
|
97
|
+
</ComponentsProvider>
|
|
98
|
+
</ThemeProvider>
|
|
99
|
+
</MDXProvider>
|
|
100
|
+
</SlotProvider>
|
|
101
101
|
</ZudokuProvider>
|
|
102
102
|
</StaggeredRenderContext.Provider>
|
|
103
103
|
</>
|