zudoku 0.0.0-fcb84d6 → 0.0.0-ff3751f
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/README.md +121 -0
- package/cli.js +2 -2
- package/dist/app/entry.client.js +2 -2
- package/dist/app/entry.client.js.map +1 -1
- package/dist/app/entry.server.js +3 -0
- package/dist/app/entry.server.js.map +1 -1
- package/dist/app/main.d.ts +1 -0
- package/dist/app/main.js +9 -26
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js.map +1 -1
- package/dist/cli/cli.js +1 -2
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/common/machine-id/lib.js.map +1 -1
- package/dist/cli/common/outdated.js.map +1 -1
- package/dist/cli/common/utils/box.js.map +1 -1
- package/dist/config/validators/InputSidebarSchema.d.ts +2 -2
- package/dist/config/validators/SidebarSchema.d.ts +24 -1
- package/dist/config/validators/SidebarSchema.js +76 -39
- package/dist/config/validators/SidebarSchema.js.map +1 -1
- package/dist/config/validators/validate.d.ts +406 -260
- package/dist/config/validators/validate.js +23 -7
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/authentication/components/CallbackHandler.js +21 -31
- package/dist/lib/authentication/components/CallbackHandler.js.map +1 -1
- package/dist/lib/authentication/hook.d.ts +1 -1
- package/dist/lib/authentication/hook.js +1 -1
- package/dist/lib/authentication/hook.js.map +1 -1
- package/dist/lib/components/Header.js +6 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/MobileTopNavigation.js +4 -1
- package/dist/lib/components/MobileTopNavigation.js.map +1 -1
- package/dist/lib/components/SlotletProvider.d.ts +2 -1
- package/dist/lib/components/SlotletProvider.js.map +1 -1
- package/dist/lib/components/SyntaxHighlight.js +4 -1
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/TopNavigation.d.ts +3 -0
- package/dist/lib/components/TopNavigation.js +38 -5
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +6 -10
- package/dist/lib/components/context/ZudokuContext.js +26 -20
- package/dist/lib/components/context/ZudokuContext.js.map +1 -1
- package/dist/lib/components/index.d.ts +17 -8
- package/dist/lib/components/index.js +10 -3
- package/dist/lib/components/index.js.map +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/SidebarCategory.js +12 -7
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
- package/dist/lib/components/navigation/SidebarItem.js +3 -5
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -1
- package/dist/lib/components/navigation/utils.js +10 -14
- package/dist/lib/components/navigation/utils.js.map +1 -1
- package/dist/lib/core/DevPortalContext.d.ts +3 -6
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +1 -0
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/errors/ErrorAlert.d.ts +1 -1
- package/dist/lib/errors/ErrorAlert.js +8 -3
- package/dist/lib/errors/ErrorAlert.js.map +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
- package/dist/lib/plugins/custom-pages/CustomPage.js +2 -2
- package/dist/lib/plugins/markdown/index.d.ts +5 -6
- package/dist/lib/plugins/markdown/index.js +31 -3
- package/dist/lib/plugins/markdown/index.js.map +1 -1
- package/dist/lib/plugins/markdown/resolver.d.ts +38 -0
- package/dist/lib/plugins/markdown/resolver.js +75 -0
- package/dist/lib/plugins/markdown/resolver.js.map +1 -0
- package/dist/lib/plugins/openapi/Endpoint.js.map +1 -1
- package/dist/lib/plugins/openapi/RequestBodySidecarBox.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +2 -2
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/client/worker.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/playground/Playground.js +2 -1
- 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/PlaygroundDialog.js.map +1 -1
- package/dist/lib/plugins/redirect/index.d.ts +2 -5
- package/dist/lib/plugins/redirect/index.js +1 -1
- package/dist/lib/plugins/redirect/index.js.map +1 -1
- package/dist/lib/ui/Accordion.d.ts +7 -0
- package/dist/lib/ui/Accordion.js +14 -0
- package/dist/lib/ui/Accordion.js.map +1 -0
- package/dist/lib/ui/Alert.d.ts +8 -0
- package/dist/lib/ui/Alert.js +23 -0
- package/dist/lib/ui/Alert.js.map +1 -0
- package/dist/lib/ui/AlertDialog.d.ts +20 -0
- package/dist/lib/ui/AlertDialog.js +27 -0
- package/dist/lib/ui/AlertDialog.js.map +1 -0
- package/dist/lib/ui/AspectRatio.d.ts +3 -0
- package/dist/lib/ui/AspectRatio.js +4 -0
- package/dist/lib/ui/AspectRatio.js.map +1 -0
- package/dist/lib/ui/Badge.d.ts +9 -0
- package/dist/lib/ui/Badge.js +21 -0
- package/dist/lib/ui/Badge.js.map +1 -0
- package/dist/lib/ui/Breadcrumb.d.ts +19 -0
- package/dist/lib/ui/Breadcrumb.js +24 -0
- package/dist/lib/ui/Breadcrumb.js.map +1 -0
- package/dist/lib/ui/Button.d.ts +2 -3
- package/dist/lib/ui/Button.js +1 -1
- package/dist/lib/ui/Button.js.map +1 -1
- package/dist/lib/ui/Carousel.d.ts +18 -0
- package/dist/lib/ui/Carousel.js +99 -0
- package/dist/lib/ui/Carousel.js.map +1 -0
- package/dist/lib/ui/Checkbox.d.ts +4 -0
- package/dist/lib/ui/Checkbox.js +9 -0
- package/dist/lib/ui/Checkbox.js.map +1 -0
- package/dist/lib/ui/Collapsible.d.ts +5 -0
- package/dist/lib/ui/Collapsible.js +6 -0
- package/dist/lib/ui/Collapsible.js.map +1 -0
- package/dist/lib/ui/Command.d.ts +80 -0
- package/dist/lib/ui/Command.js +31 -0
- package/dist/lib/ui/Command.js.map +1 -0
- package/dist/lib/{components → ui}/Dialog.js +2 -2
- package/dist/lib/ui/Dialog.js.map +1 -0
- package/dist/lib/ui/Form.d.ts +23 -0
- package/dist/lib/ui/Form.js +63 -0
- package/dist/lib/ui/Form.js.map +1 -0
- package/dist/lib/ui/HoverCard.d.ts +6 -0
- package/dist/lib/ui/HoverCard.js +10 -0
- package/dist/lib/ui/HoverCard.js.map +1 -0
- package/dist/lib/ui/Label.d.ts +5 -0
- package/dist/lib/ui/Label.js +10 -0
- package/dist/lib/ui/Label.js.map +1 -0
- package/dist/lib/ui/Pagination.d.ts +28 -0
- package/dist/lib/ui/Pagination.js +24 -0
- package/dist/lib/ui/Pagination.js.map +1 -0
- package/dist/lib/ui/Popover.d.ts +6 -0
- package/dist/lib/ui/Popover.js +10 -0
- package/dist/lib/ui/Popover.js.map +1 -0
- package/dist/lib/ui/Progress.d.ts +4 -0
- package/dist/lib/ui/Progress.js +8 -0
- package/dist/lib/ui/Progress.js.map +1 -0
- package/dist/lib/ui/RadioGroup.d.ts +5 -0
- package/dist/lib/ui/RadioGroup.js +15 -0
- package/dist/lib/ui/RadioGroup.js.map +1 -0
- package/dist/lib/ui/ScrollArea.d.ts +5 -0
- package/dist/lib/ui/ScrollArea.js +12 -0
- package/dist/lib/ui/ScrollArea.js.map +1 -0
- package/dist/lib/ui/Select.js.map +1 -0
- package/dist/lib/ui/Skeleton.d.ts +2 -0
- package/dist/lib/ui/Skeleton.js +7 -0
- package/dist/lib/ui/Skeleton.js.map +1 -0
- package/dist/lib/ui/Slider.d.ts +4 -0
- package/dist/lib/ui/Slider.js +8 -0
- package/dist/lib/ui/Slider.js.map +1 -0
- package/dist/lib/ui/Switch.d.ts +4 -0
- package/dist/lib/ui/Switch.js +8 -0
- package/dist/lib/ui/Switch.js.map +1 -0
- package/dist/lib/ui/Textarea.d.ts +4 -0
- package/dist/lib/ui/Textarea.js +9 -0
- package/dist/lib/ui/Textarea.js.map +1 -0
- package/dist/lib/ui/Toggle.d.ts +12 -0
- package/dist/lib/ui/Toggle.js +26 -0
- package/dist/lib/ui/Toggle.js.map +1 -0
- package/dist/lib/ui/ToggleGroup.d.ts +12 -0
- package/dist/lib/ui/ToggleGroup.js +21 -0
- package/dist/lib/ui/ToggleGroup.js.map +1 -0
- package/dist/lib/ui/Tooltip.d.ts +7 -0
- package/dist/lib/ui/Tooltip.js +11 -0
- package/dist/lib/ui/Tooltip.js.map +1 -0
- package/dist/lib/util/MdxComponents.js.map +1 -1
- package/dist/lib/util/invariant.d.ts +9 -0
- package/dist/lib/util/invariant.js +7 -3
- package/dist/lib/util/invariant.js.map +1 -1
- package/dist/lib/util/useExposedProps.js +3 -2
- package/dist/lib/util/useExposedProps.js.map +1 -1
- package/dist/lib/util/useScrollToAnchor.js.map +1 -1
- package/dist/vite/build.js +12 -3
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.d.ts +2 -8
- package/dist/vite/config.js +24 -59
- package/dist/vite/config.js.map +1 -1
- package/dist/vite/debug.d.ts +1 -0
- package/dist/vite/debug.js +10 -0
- package/dist/vite/debug.js.map +1 -0
- package/dist/vite/dev-server.js +1 -1
- package/dist/vite/dev-server.js.map +1 -1
- package/dist/vite/output.d.ts +101 -0
- package/dist/vite/output.js +30 -0
- package/dist/vite/output.js.map +1 -0
- package/dist/vite/plugin-component.js +17 -7
- package/dist/vite/plugin-component.js.map +1 -1
- package/dist/vite/plugin-config-reload.js +0 -2
- package/dist/vite/plugin-config-reload.js.map +1 -1
- package/dist/vite/plugin-config.d.ts +2 -3
- package/dist/vite/plugin-config.js +2 -3
- package/dist/vite/plugin-config.js.map +1 -1
- package/dist/vite/plugin-docs.js +37 -26
- package/dist/vite/plugin-docs.js.map +1 -1
- package/dist/vite/plugin-frontmatter.d.ts +2 -1
- package/dist/vite/plugin-frontmatter.js +27 -24
- package/dist/vite/plugin-frontmatter.js.map +1 -1
- package/dist/vite/plugin-search.d.ts +3 -0
- package/dist/vite/plugin-search.js +26 -0
- package/dist/vite/plugin-search.js.map +1 -0
- package/dist/vite/plugin-sidebar.js +7 -6
- package/dist/vite/plugin-sidebar.js.map +1 -1
- package/dist/vite/plugin.js +4 -2
- package/dist/vite/plugin.js.map +1 -1
- package/dist/vite/prerender.d.ts +5 -1
- package/dist/vite/prerender.js +6 -5
- package/dist/vite/prerender.js.map +1 -1
- package/lib/{utils-C8S3st2k.js → AnchorLink-BbB2q-jx.js} +231 -275
- package/lib/AnchorLink-BbB2q-jx.js.map +1 -0
- package/lib/{AuthenticationPlugin-D1nhROkO.js → AuthenticationPlugin-C9BHGXlE.js} +3 -3
- package/lib/{AuthenticationPlugin-D1nhROkO.js.map → AuthenticationPlugin-C9BHGXlE.js.map} +1 -1
- package/lib/{CategoryHeading-B7TlPvuN.js → CategoryHeading-Bb9dqxD3.js} +4 -4
- package/lib/{CategoryHeading-B7TlPvuN.js.map → CategoryHeading-Bb9dqxD3.js.map} +1 -1
- package/lib/ClientOnly-CVN6leDu.js +11 -0
- package/lib/ClientOnly-CVN6leDu.js.map +1 -0
- package/lib/{DeveloperHint-B_QCCafl.js → DeveloperHint-DHdLXGHA.js} +2 -2
- package/lib/{DeveloperHint-B_QCCafl.js.map → DeveloperHint-DHdLXGHA.js.map} +1 -1
- package/lib/Dialog-k70Qfukb.js +67 -0
- package/lib/Dialog-k70Qfukb.js.map +1 -0
- package/lib/{Markdown-Y__eLG0x.js → Markdown-BDcCAWwm.js} +4268 -6650
- package/lib/Markdown-BDcCAWwm.js.map +1 -0
- package/lib/{MdxPage-B4FcPIi5.js → MdxPage-DKMH_t0f.js} +33 -31
- package/lib/{MdxPage-B4FcPIi5.js.map → MdxPage-DKMH_t0f.js.map} +1 -1
- package/lib/{OperationList-DuPG2FA2.js → OperationList-Tj7ubW_t.js} +131 -128
- package/lib/OperationList-Tj7ubW_t.js.map +1 -0
- package/lib/{Route-Bb3QClHu.js → Route-C3DGB6OS.js} +3 -3
- package/lib/{Route-Bb3QClHu.js.map → Route-C3DGB6OS.js.map} +1 -1
- package/lib/Select-Bagt3Bme.js +223 -0
- package/lib/Select-Bagt3Bme.js.map +1 -0
- package/lib/SlotletProvider-Da7eFgd2.js +241 -0
- package/lib/SlotletProvider-Da7eFgd2.js.map +1 -0
- package/lib/Spinner-C6zroowC.js +40 -0
- package/lib/Spinner-C6zroowC.js.map +1 -0
- package/lib/StaggeredRender-DDHSzQKE.js +17 -0
- package/lib/StaggeredRender-DDHSzQKE.js.map +1 -0
- package/lib/{ZudokuContext-MRoel6bS.js → ZudokuContext-BKXGJTmu.js} +460 -411
- package/lib/ZudokuContext-BKXGJTmu.js.map +1 -0
- package/lib/__vite-browser-external-BYRIRx8p.js +9 -0
- package/lib/__vite-browser-external-BYRIRx8p.js.map +1 -0
- package/lib/_commonjsHelpers-BkfeUUK-.js +29 -0
- package/lib/_commonjsHelpers-BkfeUUK-.js.map +1 -0
- package/lib/assets/worker-Bf8vjASY.js.map +1 -1
- package/lib/cn-BmFQLtkS.js +2279 -0
- package/lib/cn-BmFQLtkS.js.map +1 -0
- package/lib/hook-sn0zMTkE.js +229 -0
- package/lib/hook-sn0zMTkE.js.map +1 -0
- package/lib/{index-CCa8ojDW.js → index-AjWCJNGC.js} +1332 -1606
- package/lib/index-AjWCJNGC.js.map +1 -0
- package/lib/index-Bn6Lc9tq.js +9 -0
- package/lib/{index-DJqnphbT.js.map → index-Bn6Lc9tq.js.map} +1 -1
- package/lib/index-BuAyrJe3.js +46 -0
- package/lib/index-BuAyrJe3.js.map +1 -0
- package/lib/{index-DFN92YJN.js → index-CRo94sKK.js} +5 -4
- package/lib/{index-DFN92YJN.js.map → index-CRo94sKK.js.map} +1 -1
- package/lib/{index-D06ATMgg.js → index-LNp6rxyU.js} +2 -2
- package/lib/{index-D06ATMgg.js.map → index-LNp6rxyU.js.map} +1 -1
- package/lib/index.esm-C5mr_sKO.js +1193 -0
- package/lib/index.esm-C5mr_sKO.js.map +1 -0
- package/lib/invariant-Caa8-XvF.js +26 -0
- package/lib/invariant-Caa8-XvF.js.map +1 -0
- package/lib/ui/Accordion.js +47 -0
- package/lib/ui/Accordion.js.map +1 -0
- package/lib/ui/Alert.js +51 -0
- package/lib/ui/Alert.js.map +1 -0
- package/lib/ui/AlertDialog.js +114 -0
- package/lib/ui/AlertDialog.js.map +1 -0
- package/lib/ui/AspectRatio.js +6 -0
- package/lib/ui/AspectRatio.js.map +1 -0
- package/lib/ui/Badge.js +27 -0
- package/lib/ui/Badge.js.map +1 -0
- package/lib/ui/Breadcrumb.js +94 -0
- package/lib/ui/Breadcrumb.js.map +1 -0
- package/lib/ui/Button.js +49 -0
- package/lib/ui/Button.js.map +1 -0
- package/lib/ui/Callout.js +77 -0
- package/lib/ui/Callout.js.map +1 -0
- package/lib/ui/Card.js +62 -0
- package/lib/ui/Card.js.map +1 -0
- package/lib/ui/Carousel.js +1410 -0
- package/lib/ui/Carousel.js.map +1 -0
- package/lib/ui/Checkbox.js +28 -0
- package/lib/ui/Checkbox.js.map +1 -0
- package/lib/ui/Collapsible.js +8 -0
- package/lib/ui/Collapsible.js.map +1 -0
- package/lib/ui/Command.js +550 -0
- package/lib/ui/Command.js.map +1 -0
- package/lib/ui/Dialog.js +101 -0
- package/lib/ui/Dialog.js.map +1 -0
- package/lib/ui/Drawer.js +1153 -0
- package/lib/ui/Drawer.js.map +1 -0
- package/lib/ui/DropdownMenu.js +145 -0
- package/lib/ui/DropdownMenu.js.map +1 -0
- package/lib/ui/Form.js +95 -0
- package/lib/ui/Form.js.map +1 -0
- package/lib/ui/HoverCard.js +24 -0
- package/lib/ui/HoverCard.js.map +1 -0
- package/lib/ui/Input.js +22 -0
- package/lib/ui/Input.js.map +1 -0
- package/lib/ui/Label.js +20 -0
- package/lib/ui/Label.js.map +1 -0
- package/lib/ui/Pagination.js +106 -0
- package/lib/ui/Pagination.js.map +1 -0
- package/lib/ui/Popover.js +24 -0
- package/lib/ui/Popover.js.map +1 -0
- package/lib/ui/Progress.js +27 -0
- package/lib/ui/Progress.js.map +1 -0
- package/lib/ui/RadioGroup.js +32 -0
- package/lib/ui/RadioGroup.js.map +1 -0
- package/lib/ui/ScrollArea.js +39 -0
- package/lib/ui/ScrollArea.js.map +1 -0
- package/lib/ui/Select.js +122 -0
- package/lib/ui/Select.js.map +1 -0
- package/lib/ui/Skeleton.js +18 -0
- package/lib/ui/Skeleton.js.map +1 -0
- package/lib/ui/Slider.js +24 -0
- package/lib/ui/Slider.js.map +1 -0
- package/lib/ui/Switch.js +28 -0
- package/lib/ui/Switch.js.map +1 -0
- package/lib/ui/Tabs.js +47 -0
- package/lib/ui/Tabs.js.map +1 -0
- package/lib/ui/Textarea.js +21 -0
- package/lib/ui/Textarea.js.map +1 -0
- package/lib/ui/Toggle.js +38 -0
- package/lib/ui/Toggle.js.map +1 -0
- package/lib/ui/ToggleGroup.js +42 -0
- package/lib/ui/ToggleGroup.js.map +1 -0
- package/lib/ui/Tooltip.js +24 -0
- package/lib/ui/Tooltip.js.map +1 -0
- package/lib/urql-core-KJnLL26g.js.map +1 -1
- package/lib/useExposedProps-ChOIUaS4.js +9 -0
- package/lib/useExposedProps-ChOIUaS4.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +477 -483
- package/lib/zudoku.auth-openid.js.map +1 -1
- package/lib/zudoku.components.js +907 -2881
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +2 -2
- package/lib/zudoku.plugin-api-keys.js +69 -76
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +9 -8
- package/lib/zudoku.plugin-custom-pages.js.map +1 -1
- package/lib/zudoku.plugin-markdown.js +93 -27
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +7 -8
- package/lib/zudoku.plugin-openapi.js.map +1 -1
- package/lib/zudoku.plugin-redirect.js +1 -1
- package/lib/zudoku.plugin-redirect.js.map +1 -1
- package/lib/zudoku.plugin-search-inkeep.js +9 -13
- package/lib/zudoku.plugin-search-inkeep.js.map +1 -1
- package/package.json +32 -9
- package/src/app/entry.client.tsx +4 -2
- package/src/app/entry.server.tsx +4 -0
- package/src/app/main.css +4 -1
- package/src/app/main.tsx +12 -30
- package/src/app/standalone.tsx +1 -1
- package/src/lib/authentication/components/CallbackHandler.tsx +20 -51
- package/src/lib/authentication/hook.ts +1 -1
- package/src/lib/components/Header.tsx +17 -2
- package/src/lib/components/MobileTopNavigation.tsx +5 -1
- package/src/lib/components/SlotletProvider.tsx +2 -0
- package/src/lib/components/SyntaxHighlight.tsx +5 -1
- package/src/lib/components/TopNavigation.tsx +70 -23
- package/src/lib/components/context/ZudokuContext.ts +28 -20
- package/src/lib/components/index.ts +13 -4
- package/src/lib/components/navigation/Sidebar.tsx +5 -5
- package/src/lib/components/navigation/SidebarCategory.tsx +13 -13
- package/src/lib/components/navigation/SidebarItem.tsx +3 -5
- package/src/lib/components/navigation/utils.ts +11 -16
- package/src/lib/core/DevPortalContext.ts +3 -2
- package/src/lib/core/plugins.ts +2 -0
- package/src/lib/errors/ErrorAlert.tsx +18 -5
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +2 -2
- package/src/lib/plugins/custom-pages/CustomPage.tsx +2 -2
- package/src/lib/plugins/markdown/index.tsx +49 -12
- package/src/lib/plugins/markdown/resolver.ts +92 -0
- package/src/lib/plugins/openapi/Endpoint.tsx +2 -2
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +1 -1
- package/src/lib/plugins/openapi/Sidecar.tsx +3 -3
- package/src/lib/plugins/openapi/client/worker.ts +2 -2
- package/src/lib/plugins/openapi/index.tsx +1 -1
- package/src/lib/plugins/openapi/playground/Playground.tsx +4 -3
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +1 -1
- package/src/lib/plugins/redirect/index.tsx +3 -7
- package/src/lib/ui/Accordion.tsx +56 -0
- package/src/lib/ui/{Note.tsx → Alert.tsx} +11 -10
- package/src/lib/ui/AlertDialog.tsx +139 -0
- package/src/lib/ui/AspectRatio.tsx +5 -0
- package/src/lib/ui/Badge.tsx +36 -0
- package/src/lib/ui/Breadcrumb.tsx +115 -0
- package/src/lib/ui/Button.tsx +1 -1
- package/src/lib/ui/Carousel.tsx +260 -0
- package/src/lib/ui/Checkbox.tsx +28 -0
- package/src/lib/ui/Collapsible.tsx +9 -0
- package/src/lib/ui/Command.tsx +151 -0
- package/src/lib/{components → ui}/Dialog.tsx +4 -3
- package/src/lib/ui/Form.tsx +177 -0
- package/src/lib/ui/HoverCard.tsx +27 -0
- package/src/lib/ui/Label.tsx +24 -0
- package/src/lib/ui/Pagination.tsx +117 -0
- package/src/lib/ui/Popover.tsx +29 -0
- package/src/lib/ui/Progress.tsx +26 -0
- package/src/lib/ui/RadioGroup.tsx +42 -0
- package/src/lib/ui/ScrollArea.tsx +46 -0
- package/src/lib/ui/Skeleton.tsx +15 -0
- package/src/lib/ui/Slider.tsx +26 -0
- package/src/lib/ui/Switch.tsx +27 -0
- package/src/lib/ui/Textarea.tsx +23 -0
- package/src/lib/ui/Toggle.tsx +43 -0
- package/src/lib/ui/ToggleGroup.tsx +59 -0
- package/src/lib/ui/Tooltip.tsx +28 -0
- package/src/lib/util/MdxComponents.tsx +0 -1
- package/src/lib/util/invariant.ts +15 -3
- package/src/lib/util/useExposedProps.tsx +8 -2
- package/src/lib/util/useScrollToAnchor.ts +1 -1
- package/dist/internal.d.ts +0 -1
- package/dist/internal.js +0 -2
- package/dist/internal.js.map +0 -1
- package/dist/lib/components/Dialog.js.map +0 -1
- package/dist/lib/components/Select.js.map +0 -1
- package/dist/lib/plugins/markdown/generateRoutes.d.ts +0 -3
- package/dist/lib/plugins/markdown/generateRoutes.js +0 -21
- package/dist/lib/plugins/markdown/generateRoutes.js.map +0 -1
- package/dist/lib/ui/Note.d.ts +0 -8
- package/dist/lib/ui/Note.js +0 -23
- package/dist/lib/ui/Note.js.map +0 -1
- package/lib/ErrorPage-DqqAV1dr.js +0 -16
- package/lib/ErrorPage-DqqAV1dr.js.map +0 -1
- package/lib/Input-a9rLgbP_.js +0 -2229
- package/lib/Input-a9rLgbP_.js.map +0 -1
- package/lib/Markdown-Y__eLG0x.js.map +0 -1
- package/lib/OperationList-DuPG2FA2.js.map +0 -1
- package/lib/SidebarBadge-BdzN0ZBK.js +0 -503
- package/lib/SidebarBadge-BdzN0ZBK.js.map +0 -1
- package/lib/SlotletProvider-DmqWiVFt.js +0 -239
- package/lib/SlotletProvider-DmqWiVFt.js.map +0 -1
- package/lib/Spinner-3cQDBVGr.js +0 -7
- package/lib/Spinner-3cQDBVGr.js.map +0 -1
- package/lib/ZudokuContext-MRoel6bS.js.map +0 -1
- package/lib/index-BijFM__9.js +0 -124
- package/lib/index-BijFM__9.js.map +0 -1
- package/lib/index-CCa8ojDW.js.map +0 -1
- package/lib/index-DJqnphbT.js +0 -35
- package/lib/index-_GxJ8hpM.js +0 -2867
- package/lib/index-_GxJ8hpM.js.map +0 -1
- package/lib/joinPath-B7kNnUX4.js +0 -8
- package/lib/joinPath-B7kNnUX4.js.map +0 -1
- package/lib/useExposedProps-BWwxa-Hg.js +0 -9
- package/lib/useExposedProps-BWwxa-Hg.js.map +0 -1
- package/lib/utils-C8S3st2k.js.map +0 -1
- package/src/lib/plugins/markdown/generateRoutes.tsx +0 -38
- /package/dist/lib/{components → ui}/Dialog.d.ts +0 -0
- /package/dist/lib/{components → ui}/Select.d.ts +0 -0
- /package/dist/lib/{components → ui}/Select.js +0 -0
- /package/src/lib/{components → ui}/Select.tsx +0 -0
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
import { cx } from "class-variance-authority";
|
|
2
|
-
import {
|
|
2
|
+
import { Suspense } from "react";
|
|
3
|
+
import { Link } from "react-router-dom";
|
|
4
|
+
import { useAuth } from "../authentication/hook.js";
|
|
5
|
+
import { TopNavigationItem } from "../../config/validators/validate.js";
|
|
6
|
+
import { joinPath } from "../util/joinPath.js";
|
|
7
|
+
import { useCurrentNavigation, useZudoku } from "./context/ZudokuContext.js";
|
|
8
|
+
import { traverseSidebar } from "./navigation/utils.js";
|
|
3
9
|
|
|
4
|
-
|
|
10
|
+
export const isHiddenItem =
|
|
11
|
+
(isAuthenticated?: boolean) =>
|
|
12
|
+
(item: { display?: "auth" | "anon" | "always" }) => {
|
|
13
|
+
return (
|
|
14
|
+
(item.display === "auth" && isAuthenticated) ||
|
|
15
|
+
(item.display === "anon" && !isAuthenticated) ||
|
|
16
|
+
!item.display ||
|
|
17
|
+
item.display === "always"
|
|
18
|
+
);
|
|
19
|
+
};
|
|
5
20
|
|
|
6
21
|
export const TopNavigation = () => {
|
|
7
22
|
const { topNavigation } = useZudoku();
|
|
23
|
+
const { isAuthenticated } = useAuth();
|
|
8
24
|
|
|
9
25
|
// Hide top nav if there is only one item
|
|
10
26
|
if (topNavigation.length <= 1) {
|
|
@@ -12,26 +28,57 @@ export const TopNavigation = () => {
|
|
|
12
28
|
}
|
|
13
29
|
|
|
14
30
|
return (
|
|
15
|
-
<
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
<Suspense>
|
|
32
|
+
<nav className="hidden lg:block border-b text-sm px-12 h-[--top-nav-height]">
|
|
33
|
+
<ul className="flex flex-row items-center gap-8">
|
|
34
|
+
{topNavigation.filter(isHiddenItem(isAuthenticated)).map((item) => (
|
|
35
|
+
<li key={item.id}>
|
|
36
|
+
<TopNavItem {...item} />
|
|
37
|
+
</li>
|
|
38
|
+
))}
|
|
39
|
+
</ul>
|
|
40
|
+
</nav>
|
|
41
|
+
</Suspense>
|
|
42
|
+
);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const TopNavItem = ({ id, label, default: defaultLink }: TopNavigationItem) => {
|
|
46
|
+
const { sidebars } = useZudoku();
|
|
47
|
+
const nav = useCurrentNavigation();
|
|
48
|
+
const currentSidebar = sidebars[id];
|
|
49
|
+
|
|
50
|
+
// TODO: This is a bit of a hack to get the first link in the sidebar
|
|
51
|
+
// We should really process this when we load the config so we can validate
|
|
52
|
+
// that the sidebar is actually set. In this case we just fall back to linking
|
|
53
|
+
// to the id if we can't resolve a sidebar.
|
|
54
|
+
const first =
|
|
55
|
+
defaultLink ??
|
|
56
|
+
(currentSidebar
|
|
57
|
+
? traverseSidebar(currentSidebar, (item) => {
|
|
58
|
+
if (item.type === "doc") return joinPath(item.id);
|
|
59
|
+
})
|
|
60
|
+
: joinPath(id));
|
|
61
|
+
|
|
62
|
+
if (!first) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
`No links found in top navigation for top navigation '${id}'. Check that the sidebar isn't empty or that a default link set.`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Manually set the active sidebar based on our logic of what is active
|
|
69
|
+
const isActive = nav.data.topNavItem?.id === id;
|
|
70
|
+
|
|
71
|
+
return (
|
|
72
|
+
<Link
|
|
73
|
+
className={cx(
|
|
74
|
+
"block py-3.5 font-medium -mb-px border-b-2",
|
|
75
|
+
isActive
|
|
76
|
+
? "border-primary text-foreground"
|
|
77
|
+
: "border-transparent text-foreground/75 hover:text-foreground hover:border-accent-foreground/25",
|
|
78
|
+
)}
|
|
79
|
+
to={first}
|
|
80
|
+
>
|
|
81
|
+
{label}
|
|
82
|
+
</Link>
|
|
36
83
|
);
|
|
37
84
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
2
2
|
import { createContext, useContext } from "react";
|
|
3
|
-
import { useLocation } from "react-router-dom";
|
|
3
|
+
import { matchPath, useLocation } from "react-router-dom";
|
|
4
4
|
import { DevPortalContext } from "../../core/DevPortalContext.js";
|
|
5
|
+
import { joinPath } from "../../util/joinPath.js";
|
|
6
|
+
import { traverseSidebar } from "../navigation/utils.js";
|
|
5
7
|
|
|
6
8
|
export const ZudokuReactContext = createContext<DevPortalContext | undefined>(
|
|
7
9
|
undefined,
|
|
@@ -25,34 +27,40 @@ export const useApiIdentities = () => {
|
|
|
25
27
|
});
|
|
26
28
|
};
|
|
27
29
|
|
|
28
|
-
export const
|
|
29
|
-
const { topNavigation } = useZudoku();
|
|
30
|
+
export const useCurrentNavigation = () => {
|
|
31
|
+
const { getPluginSidebar, sidebars, topNavigation } = useZudoku();
|
|
30
32
|
const location = useLocation();
|
|
31
33
|
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
+
const currentSidebarItem = Object.entries(sidebars).find(([, sidebar]) => {
|
|
35
|
+
return traverseSidebar(sidebar, (item) => {
|
|
36
|
+
const itemId =
|
|
37
|
+
item.type === "doc"
|
|
38
|
+
? joinPath(item.id)
|
|
39
|
+
: item.type === "category" && item.link
|
|
40
|
+
? joinPath(item.link.id)
|
|
41
|
+
: undefined;
|
|
34
42
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const location = useLocation();
|
|
43
|
+
if (itemId === location.pathname) {
|
|
44
|
+
return item;
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
const currentTopNavItem =
|
|
49
|
+
topNavigation.find((t) => t.id === currentSidebarItem?.[0]) ??
|
|
50
|
+
topNavigation.find((item) => matchPath(item.id, location.pathname));
|
|
44
51
|
|
|
45
52
|
return useSuspenseQuery({
|
|
46
53
|
queryFn: async () => {
|
|
47
|
-
const pluginSidebar =
|
|
48
|
-
? await getPluginSidebar(path)
|
|
49
|
-
: await getPluginSidebar(location.pathname);
|
|
54
|
+
const pluginSidebar = await getPluginSidebar(location.pathname);
|
|
50
55
|
|
|
51
56
|
return {
|
|
52
|
-
|
|
53
|
-
|
|
57
|
+
sidebar: [
|
|
58
|
+
...(currentSidebarItem ? currentSidebarItem[1] : []),
|
|
59
|
+
...pluginSidebar,
|
|
60
|
+
],
|
|
61
|
+
topNavItem: currentTopNavItem,
|
|
54
62
|
};
|
|
55
63
|
},
|
|
56
|
-
queryKey: ["navigation",
|
|
64
|
+
queryKey: ["navigation", location.pathname],
|
|
57
65
|
});
|
|
58
66
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useMDXComponents as useMDXComponentsImport } from "@mdx-js/react";
|
|
2
2
|
import { Helmet } from "@zudoku/react-helmet-async";
|
|
3
3
|
import { Link as LinkImport } from "react-router-dom";
|
|
4
|
+
import { useAuthState } from "../authentication/state.js";
|
|
4
5
|
import { RouterError as RouterErrorImport } from "../errors/RouterError.js";
|
|
5
6
|
import { ServerError as ServerErrorImport } from "../errors/ServerError.js";
|
|
6
7
|
import { Button as ButtonImport } from "../ui/Button.js";
|
|
@@ -9,17 +10,25 @@ import {
|
|
|
9
10
|
Bootstrap as BootstrapImport,
|
|
10
11
|
BootstrapStatic as BootstrapStaticImport,
|
|
11
12
|
} from "./Bootstrap.js";
|
|
13
|
+
import { ClientOnly as ClientOnlyImport } from "./ClientOnly.js";
|
|
12
14
|
import { DevPortal as DevPortalImport } from "./DevPortal.js";
|
|
13
15
|
import { Layout as LayoutImport } from "./Layout.js";
|
|
14
|
-
|
|
16
|
+
import { useZudoku as useZudokuImport } from "./context/ZudokuContext.js";
|
|
15
17
|
export const useMDXComponents = /*@__PURE__*/ useMDXComponentsImport;
|
|
16
|
-
export const Callout = /*@__PURE__*/ CalloutImport;
|
|
17
18
|
export const DevPortal = /*@__PURE__*/ DevPortalImport;
|
|
18
19
|
export const Layout = /*@__PURE__*/ LayoutImport;
|
|
19
|
-
export const Link: typeof LinkImport = /*@__PURE__*/ LinkImport;
|
|
20
20
|
export const RouterError = /*@__PURE__*/ RouterErrorImport;
|
|
21
21
|
export const ServerError = /*@__PURE__*/ ServerErrorImport;
|
|
22
22
|
export const Bootstrap = /*@__PURE__*/ BootstrapImport;
|
|
23
23
|
export const BootstrapStatic = /*@__PURE__*/ BootstrapStaticImport;
|
|
24
|
-
|
|
24
|
+
|
|
25
25
|
export const Head = /*@__PURE__*/ Helmet;
|
|
26
|
+
|
|
27
|
+
export const useZudoku = /*@__PURE__*/ useZudokuImport;
|
|
28
|
+
export const useAuth = /*@__PURE__*/ useAuthState;
|
|
29
|
+
export const Zudoku = /*@__PURE__*/ DevPortalImport;
|
|
30
|
+
|
|
31
|
+
export const Callout = /*@__PURE__*/ CalloutImport;
|
|
32
|
+
export const ClientOnly = /*@__PURE__*/ ClientOnlyImport;
|
|
33
|
+
export const Button = /*@__PURE__*/ ButtonImport;
|
|
34
|
+
export const Link: typeof LinkImport = /*@__PURE__*/ LinkImport;
|
|
@@ -2,23 +2,23 @@ import { useRef } from "react";
|
|
|
2
2
|
|
|
3
3
|
import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
4
4
|
import { DrawerContent, DrawerTitle } from "../../ui/Drawer.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useCurrentNavigation } from "../context/ZudokuContext.js";
|
|
6
6
|
import { Slotlet } from "../SlotletProvider.js";
|
|
7
7
|
import { SidebarItem } from "./SidebarItem.js";
|
|
8
8
|
import { SidebarWrapper } from "./SidebarWrapper.js";
|
|
9
9
|
|
|
10
10
|
export const Sidebar = () => {
|
|
11
11
|
const navRef = useRef<HTMLDivElement | null>(null);
|
|
12
|
-
const navigation =
|
|
12
|
+
const navigation = useCurrentNavigation();
|
|
13
13
|
|
|
14
14
|
return (
|
|
15
15
|
<>
|
|
16
16
|
<SidebarWrapper
|
|
17
17
|
ref={navRef}
|
|
18
|
-
pushMainContent={navigation.data.
|
|
18
|
+
pushMainContent={navigation.data.sidebar.length > 0}
|
|
19
19
|
>
|
|
20
20
|
<Slotlet name="zudoku-before-navigation" />
|
|
21
|
-
{navigation.data.
|
|
21
|
+
{navigation.data.sidebar.map((item) => (
|
|
22
22
|
<SidebarItem key={item.label} item={item} />
|
|
23
23
|
))}
|
|
24
24
|
<Slotlet name="zudoku-after-navigation" />
|
|
@@ -30,7 +30,7 @@ export const Sidebar = () => {
|
|
|
30
30
|
<VisuallyHidden>
|
|
31
31
|
<DrawerTitle>Sidebar</DrawerTitle>
|
|
32
32
|
</VisuallyHidden>
|
|
33
|
-
{navigation.data.
|
|
33
|
+
{navigation.data.sidebar.map((item) => (
|
|
34
34
|
<SidebarItem key={item.label} item={item} />
|
|
35
35
|
))}
|
|
36
36
|
</DrawerContent>
|
|
@@ -5,7 +5,6 @@ import { NavLink, useMatch } from "react-router-dom";
|
|
|
5
5
|
import type { SidebarItemCategory } from "../../../config/validators/SidebarSchema.js";
|
|
6
6
|
import { cn } from "../../util/cn.js";
|
|
7
7
|
import { joinPath } from "../../util/joinPath.js";
|
|
8
|
-
import { useTopNavigationItem } from "../context/ZudokuContext.js";
|
|
9
8
|
import { navigationListItem, SidebarItem } from "./SidebarItem.js";
|
|
10
9
|
import { useIsCategoryOpen } from "./utils.js";
|
|
11
10
|
|
|
@@ -16,7 +15,6 @@ export const SidebarCategory = ({
|
|
|
16
15
|
category: SidebarItemCategory;
|
|
17
16
|
level: number;
|
|
18
17
|
}) => {
|
|
19
|
-
const topNavItem = useTopNavigationItem();
|
|
20
18
|
const isCategoryOpen = useIsCategoryOpen(category);
|
|
21
19
|
const [hasInteracted, setHasInteracted] = useState(false);
|
|
22
20
|
|
|
@@ -26,7 +24,7 @@ export const SidebarCategory = ({
|
|
|
26
24
|
!isCollapsible || !isCollapsed || isCategoryOpen,
|
|
27
25
|
);
|
|
28
26
|
const [open, setOpen] = useState(isDefaultOpen);
|
|
29
|
-
const isActive = useMatch(
|
|
27
|
+
const isActive = useMatch(category.link?.id ?? "");
|
|
30
28
|
|
|
31
29
|
useEffect(() => {
|
|
32
30
|
// this is triggered when an item from the sidebar is clicked
|
|
@@ -65,13 +63,16 @@ export const SidebarCategory = ({
|
|
|
65
63
|
<Collapsible.Trigger className="group" asChild disabled={!isCollapsible}>
|
|
66
64
|
<div
|
|
67
65
|
onClick={() => setHasInteracted(true)}
|
|
68
|
-
className={
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
className={navigationListItem({
|
|
67
|
+
isActive: false,
|
|
68
|
+
isTopLevel: level === 0,
|
|
69
|
+
className: [
|
|
70
|
+
"text-start",
|
|
71
|
+
isCollapsible
|
|
72
|
+
? "cursor-pointer"
|
|
73
|
+
: "cursor-default hover:bg-transparent",
|
|
74
|
+
],
|
|
75
|
+
})}
|
|
75
76
|
>
|
|
76
77
|
{category.icon && (
|
|
77
78
|
<category.icon
|
|
@@ -84,7 +85,7 @@ export const SidebarCategory = ({
|
|
|
84
85
|
)}
|
|
85
86
|
{category.link?.type === "doc" ? (
|
|
86
87
|
<NavLink
|
|
87
|
-
to={joinPath(
|
|
88
|
+
to={joinPath(category.link.id)}
|
|
88
89
|
className="flex-1"
|
|
89
90
|
onClick={() => {
|
|
90
91
|
// if it is the current path and closed then open it because there's no path change to trigger the open
|
|
@@ -115,10 +116,9 @@ export const SidebarCategory = ({
|
|
|
115
116
|
className={cn(
|
|
116
117
|
// CollapsibleContent class is used to animate and it should only be applied when the user has triggered the toggle
|
|
117
118
|
hasInteracted && "CollapsibleContent",
|
|
118
|
-
"ms-[calc(var(--padding-nav-item)*1.125)]",
|
|
119
119
|
)}
|
|
120
120
|
>
|
|
121
|
-
<ul className="mt-1 border-l
|
|
121
|
+
<ul className="mt-1 border-l ms-0.5">
|
|
122
122
|
{category.items.map((item) => (
|
|
123
123
|
<SidebarItem
|
|
124
124
|
key={
|
|
@@ -6,7 +6,6 @@ import type { SidebarItem as SidebarItemType } from "../../../config/validators/
|
|
|
6
6
|
import { joinPath } from "../../util/joinPath.js";
|
|
7
7
|
import { AnchorLink } from "../AnchorLink.js";
|
|
8
8
|
import { useViewportAnchor } from "../context/ViewportAnchorContext.js";
|
|
9
|
-
import { useTopNavigationItem } from "../context/ZudokuContext.js";
|
|
10
9
|
import { SidebarBadge } from "./SidebarBadge.js";
|
|
11
10
|
import { SidebarCategory } from "./SidebarCategory.js";
|
|
12
11
|
|
|
@@ -15,8 +14,8 @@ export const navigationListItem = cva(
|
|
|
15
14
|
{
|
|
16
15
|
variants: {
|
|
17
16
|
isTopLevel: {
|
|
18
|
-
true: "font-
|
|
19
|
-
false: "-
|
|
17
|
+
true: "font-medium -mx-[--padding-nav-item]",
|
|
18
|
+
false: "-mr-[--padding-nav-item] ml-[--padding-nav-item]",
|
|
20
19
|
},
|
|
21
20
|
isActive: {
|
|
22
21
|
true: "text-primary font-medium",
|
|
@@ -43,7 +42,6 @@ export const SidebarItem = ({
|
|
|
43
42
|
basePath?: string;
|
|
44
43
|
level?: number;
|
|
45
44
|
}) => {
|
|
46
|
-
const topNavItem = useTopNavigationItem();
|
|
47
45
|
const { activeAnchor } = useViewportAnchor();
|
|
48
46
|
const [searchParams] = useSearchParams();
|
|
49
47
|
|
|
@@ -56,7 +54,7 @@ export const SidebarItem = ({
|
|
|
56
54
|
className={({ isActive }) =>
|
|
57
55
|
navigationListItem({ isActive, isTopLevel: level === 0 })
|
|
58
56
|
}
|
|
59
|
-
to={joinPath(
|
|
57
|
+
to={joinPath(item.id)}
|
|
60
58
|
>
|
|
61
59
|
{item.icon && <item.icon size={16} className="align-[-0.125em]" />}
|
|
62
60
|
{item.badge ? (
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
SidebarItemCategory,
|
|
5
5
|
} from "../../../config/validators/SidebarSchema.js";
|
|
6
6
|
import { joinPath } from "../../util/joinPath.js";
|
|
7
|
-
import {
|
|
7
|
+
import { useCurrentNavigation } from "../context/ZudokuContext.js";
|
|
8
8
|
|
|
9
9
|
export type TraverseCallback<T> = (
|
|
10
10
|
item: SidebarItem,
|
|
@@ -42,15 +42,12 @@ export const traverseSidebarItem = <T>(
|
|
|
42
42
|
|
|
43
43
|
export const useCurrentItem = () => {
|
|
44
44
|
const location = useLocation();
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
const currentSidebar =
|
|
45
|
+
const nav = useCurrentNavigation();
|
|
46
|
+
|
|
47
|
+
const currentSidebar = nav.data.sidebar;
|
|
48
48
|
|
|
49
49
|
return traverseSidebar(currentSidebar, (item) => {
|
|
50
|
-
if (
|
|
51
|
-
item.type === "doc" &&
|
|
52
|
-
joinPath(topNavItem?.id, item.id) === location.pathname
|
|
53
|
-
) {
|
|
50
|
+
if (item.type === "doc" && joinPath(item.id) === location.pathname) {
|
|
54
51
|
return item;
|
|
55
52
|
}
|
|
56
53
|
});
|
|
@@ -58,18 +55,17 @@ export const useCurrentItem = () => {
|
|
|
58
55
|
|
|
59
56
|
export const useIsCategoryOpen = (category: SidebarItemCategory) => {
|
|
60
57
|
const location = useLocation();
|
|
61
|
-
const topNavItem = useTopNavigationItem();
|
|
62
58
|
|
|
63
59
|
return traverseSidebarItem(category, (item) => {
|
|
64
60
|
if (item.type === "category" && item.link) {
|
|
65
|
-
const categoryLinkPath = joinPath(
|
|
61
|
+
const categoryLinkPath = joinPath(item.link.id);
|
|
66
62
|
if (categoryLinkPath === location.pathname) {
|
|
67
63
|
return true;
|
|
68
64
|
}
|
|
69
65
|
}
|
|
70
66
|
|
|
71
67
|
if (item.type === "doc") {
|
|
72
|
-
const docPath = joinPath(
|
|
68
|
+
const docPath = joinPath(item.id);
|
|
73
69
|
if (docPath === location.pathname) {
|
|
74
70
|
return true;
|
|
75
71
|
}
|
|
@@ -82,9 +78,8 @@ export const usePrevNext = (): {
|
|
|
82
78
|
next?: { label: string; id: string };
|
|
83
79
|
} => {
|
|
84
80
|
const currentId = useLocation().pathname;
|
|
85
|
-
const
|
|
86
|
-
const
|
|
87
|
-
const currentSidebar = topNavItem?.id ? sidebars[topNavItem.id] : [];
|
|
81
|
+
const nav = useCurrentNavigation();
|
|
82
|
+
const currentSidebar = nav.data.sidebar;
|
|
88
83
|
|
|
89
84
|
let prev;
|
|
90
85
|
let next;
|
|
@@ -94,9 +89,9 @@ export const usePrevNext = (): {
|
|
|
94
89
|
traverseSidebar(currentSidebar, (item) => {
|
|
95
90
|
const itemId =
|
|
96
91
|
item.type === "doc"
|
|
97
|
-
? joinPath(
|
|
92
|
+
? joinPath(item.id)
|
|
98
93
|
: item.type === "category" && item.link
|
|
99
|
-
? joinPath(
|
|
94
|
+
? joinPath(item.link.id)
|
|
100
95
|
: undefined;
|
|
101
96
|
|
|
102
97
|
if (!itemId) return;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { QueryClient } from "@tanstack/react-query";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
import type { SidebarConfig } from "../../config/validators/SidebarSchema.js";
|
|
4
|
+
import { TopNavigationItem } from "../../config/validators/validate.js";
|
|
4
5
|
import { type AuthenticationProvider } from "../authentication/authentication.js";
|
|
5
6
|
import type { ComponentsContextType } from "../components/context/ComponentsContext.js";
|
|
6
7
|
import { Slotlets } from "../components/SlotletProvider.js";
|
|
@@ -60,7 +61,7 @@ export type ZudokuContextOptions = {
|
|
|
60
61
|
metadata?: Metadata;
|
|
61
62
|
page?: Page;
|
|
62
63
|
authentication?: AuthenticationProvider;
|
|
63
|
-
topNavigation?:
|
|
64
|
+
topNavigation?: TopNavigationItem[];
|
|
64
65
|
sidebars?: SidebarConfig;
|
|
65
66
|
plugins?: DevPortalPlugin[];
|
|
66
67
|
slotlets?: Slotlets;
|
|
@@ -72,7 +73,7 @@ export type ZudokuContextOptions = {
|
|
|
72
73
|
|
|
73
74
|
export class DevPortalContext {
|
|
74
75
|
public plugins: NonNullable<ZudokuContextOptions["plugins"]>;
|
|
75
|
-
public sidebars:
|
|
76
|
+
public sidebars: SidebarConfig;
|
|
76
77
|
public topNavigation: NonNullable<ZudokuContextOptions["topNavigation"]>;
|
|
77
78
|
public meta: ZudokuContextOptions["metadata"];
|
|
78
79
|
public page: ZudokuContextOptions["page"];
|
package/src/lib/core/plugins.ts
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import { DeveloperHint } from "../components/DeveloperHint.js";
|
|
3
|
+
import { ZudokuError } from "../util/invariant.js";
|
|
4
|
+
|
|
5
|
+
export function ErrorAlert({ error }: { error: unknown }) {
|
|
6
|
+
const message =
|
|
7
|
+
error instanceof Error ? error.message : "Something went wrong";
|
|
8
|
+
const hint = error instanceof ZudokuError ? error.developerHint : undefined;
|
|
9
|
+
const title =
|
|
10
|
+
error instanceof ZudokuError ? error.title : "Something went wrong";
|
|
11
|
+
const stack = error instanceof Error ? error.stack : undefined;
|
|
12
|
+
const cause = error instanceof Error ? error.cause : undefined;
|
|
5
13
|
|
|
6
14
|
return (
|
|
7
15
|
<div className="flex h-screen max-h-screen min-h-full items-center justify-center bg-primary-background px-4 py-16 lg:px-8">
|
|
8
16
|
<div className="mx-auto max-w-[85%] sm:max-w-[50%]">
|
|
9
17
|
<h1 className="text-4xl font-bold tracking-tight text-h1-text sm:text-5xl">
|
|
10
|
-
|
|
18
|
+
{title}
|
|
11
19
|
</h1>
|
|
12
20
|
<p className="mt-5 text-h1-text">{message}</p>
|
|
13
|
-
{
|
|
21
|
+
{hint && <DeveloperHint className="mb-4">{hint}</DeveloperHint>}
|
|
22
|
+
{cause instanceof Error ? (
|
|
23
|
+
<pre className="mt-5 max-h-[400px] w-full overflow-scroll rounded-md border border-input-border bg-input-background p-3 text-property-name-text text-red-700">
|
|
24
|
+
{cause.stack}
|
|
25
|
+
</pre>
|
|
26
|
+
) : stack ? (
|
|
14
27
|
<pre className="mt-5 max-h-[400px] w-full overflow-scroll rounded-md border border-input-border bg-input-background p-3 text-property-name-text text-red-700">
|
|
15
28
|
{stack}
|
|
16
29
|
</pre>
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { useMutation } from "@tanstack/react-query";
|
|
2
2
|
import { useForm } from "react-hook-form";
|
|
3
3
|
import { Link, useNavigate } from "react-router-dom";
|
|
4
|
-
import { useZudoku } from "../../components/context/ZudokuContext.js";
|
|
5
4
|
import {
|
|
6
5
|
Select,
|
|
7
6
|
SelectContent,
|
|
@@ -9,7 +8,8 @@ import {
|
|
|
9
8
|
SelectItem,
|
|
10
9
|
SelectTrigger,
|
|
11
10
|
SelectValue,
|
|
12
|
-
} from "
|
|
11
|
+
} from "zudoku/ui/Select.js";
|
|
12
|
+
import { useZudoku } from "../../components/context/ZudokuContext.js";
|
|
13
13
|
import { Button } from "../../ui/Button.js";
|
|
14
14
|
import { Input } from "../../ui/Input.js";
|
|
15
15
|
import { ApiKeyService } from "./index.js";
|
|
@@ -9,8 +9,8 @@ export const CustomPage = ({
|
|
|
9
9
|
render,
|
|
10
10
|
prose = true,
|
|
11
11
|
}: Omit<CustomPageConfig, "path">) => {
|
|
12
|
-
const
|
|
13
|
-
const content = render ? React.createElement(render,
|
|
12
|
+
const exposedProps = useExposedProps();
|
|
13
|
+
const content = render ? React.createElement(render, exposedProps) : element;
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
16
|
<div className={cn(prose && ProseClasses, "max-w-full")}>{content}</div>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type { Toc } from "@stefanprobst/rehype-extract-toc";
|
|
2
2
|
import type { MDXProps } from "mdx/types.js";
|
|
3
|
+
import { RouteObject } from "react-router-dom";
|
|
4
|
+
import { ZudokuDocsConfig } from "../../../config/validators/validate.js";
|
|
3
5
|
import type { DevPortalPlugin } from "../../core/plugins.js";
|
|
4
|
-
import {
|
|
6
|
+
import { DocResolver } from "./resolver.js";
|
|
5
7
|
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
filesPath: string;
|
|
10
|
-
};
|
|
8
|
+
export interface MarkdownPluginOptions extends ZudokuDocsConfig {
|
|
9
|
+
fileImports: Record<string, () => Promise<MDXImport>>;
|
|
10
|
+
}
|
|
11
11
|
export type MarkdownPluginDefaultOptions = Pick<
|
|
12
12
|
Frontmatter,
|
|
13
13
|
"toc" | "disablePager"
|
|
@@ -27,10 +27,47 @@ export type MDXImport = {
|
|
|
27
27
|
default: (props: MDXProps) => JSX.Element;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export const markdownPlugin = (
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
export const markdownPlugin = (
|
|
31
|
+
options: MarkdownPluginOptions[],
|
|
32
|
+
): DevPortalPlugin => ({
|
|
33
|
+
getRoutes: () => {
|
|
34
|
+
const routeMap = new Map<string, RouteObject>();
|
|
35
|
+
options.forEach(({ fileImports, files, defaultOptions }) =>
|
|
36
|
+
Object.entries(fileImports).flatMap(([file, importPromise]) => {
|
|
37
|
+
const routePath = DocResolver.resolveRoutePath({
|
|
38
|
+
filesGlob: files,
|
|
39
|
+
fsPath: file,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!routePath) return [];
|
|
43
|
+
|
|
44
|
+
if (routeMap.has(routePath)) {
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.warn(
|
|
47
|
+
`Duplicate route path found for ${routePath}. Skipping file at '${file}'.`,
|
|
48
|
+
);
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const route: RouteObject = {
|
|
53
|
+
path: routePath,
|
|
54
|
+
lazy: async () => {
|
|
55
|
+
const { MdxPage } = await import("./MdxPage.js");
|
|
56
|
+
const { default: Component, ...props } = await importPromise();
|
|
57
|
+
return {
|
|
58
|
+
element: (
|
|
59
|
+
<MdxPage
|
|
60
|
+
mdxComponent={Component}
|
|
61
|
+
{...props}
|
|
62
|
+
defaultOptions={defaultOptions}
|
|
63
|
+
/>
|
|
64
|
+
),
|
|
65
|
+
};
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
routeMap.set(routePath, route);
|
|
69
|
+
}),
|
|
70
|
+
);
|
|
71
|
+
return [...routeMap.values()];
|
|
72
|
+
},
|
|
36
73
|
});
|