zudoku 0.13.6 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +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 +7 -22
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.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 +329 -264
- package/dist/config/validators/validate.js +11 -10
- 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/components/Header.js +5 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/SyntaxHighlight.js +4 -1
- package/dist/lib/components/SyntaxHighlight.js.map +1 -1
- package/dist/lib/components/TopNavigation.js +30 -5
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/ZudokuContext.d.ts +6 -12
- package/dist/lib/components/context/ZudokuContext.js +26 -20
- package/dist/lib/components/context/ZudokuContext.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 +2 -4
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -1
- package/dist/lib/components/navigation/SidebarItem.js +1 -3
- 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 -7
- 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/plugins/api-keys/CreateApiKey.js +1 -1
- package/dist/lib/plugins/api-keys/CreateApiKey.js.map +1 -1
- 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 +1 -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/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/{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/useScrollToAnchor.js.map +1 -1
- package/dist/vite/build.js +7 -2
- package/dist/vite/build.js.map +1 -1
- package/dist/vite/config.js +11 -6
- 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/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-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-sidebar.js +7 -6
- package/dist/vite/plugin-sidebar.js.map +1 -1
- package/dist/vite/plugin.js +1 -1
- 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-G5XSiZc9.js → AnchorLink-BbB2q-jx.js} +231 -275
- package/lib/AnchorLink-BbB2q-jx.js.map +1 -0
- package/lib/{AuthenticationPlugin-tBvLKsFg.js → AuthenticationPlugin-C9BHGXlE.js} +2 -2
- package/lib/{AuthenticationPlugin-tBvLKsFg.js.map → AuthenticationPlugin-C9BHGXlE.js.map} +1 -1
- package/lib/{CategoryHeading-D2WS6sRI.js → CategoryHeading-Bb9dqxD3.js} +4 -4
- package/lib/{CategoryHeading-D2WS6sRI.js.map → CategoryHeading-Bb9dqxD3.js.map} +1 -1
- package/lib/{DeveloperHint-CRiZjqd2.js → DeveloperHint-DHdLXGHA.js} +2 -2
- package/lib/{DeveloperHint-CRiZjqd2.js.map → DeveloperHint-DHdLXGHA.js.map} +1 -1
- package/lib/{Markdown-DM4zv3MA.js → Markdown-BDcCAWwm.js} +4268 -6651
- package/lib/Markdown-BDcCAWwm.js.map +1 -0
- package/lib/{MdxPage-tWI_P8wP.js → MdxPage-DKMH_t0f.js} +31 -29
- package/lib/{MdxPage-tWI_P8wP.js.map → MdxPage-DKMH_t0f.js.map} +1 -1
- package/lib/{OperationList-Cd3lue0b.js → OperationList-DnaAtLxP.js} +131 -127
- package/lib/OperationList-DnaAtLxP.js.map +1 -0
- package/lib/{Route-DI0Y0pIV.js → Route-DSbLrlig.js} +2 -2
- package/lib/{Route-DI0Y0pIV.js.map → Route-DSbLrlig.js.map} +1 -1
- package/lib/Select-Bagt3Bme.js +223 -0
- package/lib/Select-Bagt3Bme.js.map +1 -0
- package/lib/{SlotletProvider-CBqY8mp6.js → SlotletProvider-4Naek_5M.js} +4 -4
- package/lib/{SlotletProvider-CBqY8mp6.js.map → SlotletProvider-4Naek_5M.js.map} +1 -1
- 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-DEoP3GGJ.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/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-Bs9roz8y.js → index-B3F9d8oi.js} +1201 -1429
- package/lib/index-B3F9d8oi.js.map +1 -0
- package/lib/index-BuAyrJe3.js +46 -0
- package/lib/index-BuAyrJe3.js.map +1 -0
- package/lib/index.esm-C5mr_sKO.js +1193 -0
- package/lib/index.esm-C5mr_sKO.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/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 → urql-core-CqTI9H6N.js} +289 -261
- package/lib/urql-core-CqTI9H6N.js.map +1 -0
- package/lib/zudoku.auth-clerk.js +1 -1
- package/lib/zudoku.auth-openid.js +2 -2
- package/lib/zudoku.components.js +889 -2876
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.openapi-worker.js +1 -1
- package/lib/zudoku.plugin-api-keys.js +21 -18
- package/lib/zudoku.plugin-api-keys.js.map +1 -1
- package/lib/zudoku.plugin-custom-pages.js +14 -13
- 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 +6 -6
- package/package.json +30 -8
- package/src/app/entry.client.tsx +4 -2
- package/src/app/entry.server.tsx +4 -0
- package/src/app/main.css +4 -0
- package/src/app/main.tsx +10 -26
- package/src/app/standalone.tsx +1 -1
- package/src/lib/components/Header.tsx +10 -2
- package/src/lib/components/SyntaxHighlight.tsx +5 -1
- package/src/lib/components/TopNavigation.tsx +58 -24
- package/src/lib/components/context/ZudokuContext.ts +28 -20
- package/src/lib/components/navigation/Sidebar.tsx +5 -5
- package/src/lib/components/navigation/SidebarCategory.tsx +2 -4
- package/src/lib/components/navigation/SidebarItem.tsx +1 -3
- package/src/lib/components/navigation/utils.ts +11 -16
- package/src/lib/core/DevPortalContext.ts +3 -7
- package/src/lib/core/plugins.ts +2 -0
- package/src/lib/plugins/api-keys/CreateApiKey.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 +3 -3
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +1 -1
- 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/{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/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/Input-CO-1DOZa.js +0 -2229
- package/lib/Input-CO-1DOZa.js.map +0 -1
- package/lib/Markdown-DM4zv3MA.js.map +0 -1
- package/lib/OperationList-Cd3lue0b.js.map +0 -1
- package/lib/Spinner-DFQhPMBl.js +0 -505
- package/lib/Spinner-DFQhPMBl.js.map +0 -1
- package/lib/ZudokuContext-DEoP3GGJ.js.map +0 -1
- package/lib/index-Bs9roz8y.js.map +0 -1
- package/lib/index-CBr6BM_4.js +0 -2867
- package/lib/index-CBr6BM_4.js.map +0 -1
- package/lib/index-UUT9q9f9.js +0 -124
- package/lib/index-UUT9q9f9.js.map +0 -1
- package/lib/joinPath-B7kNnUX4.js +0 -8
- package/lib/joinPath-B7kNnUX4.js.map +0 -1
- package/lib/urql-core-KJnLL26g.js.map +0 -1
- package/lib/utils-G5XSiZc9.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
package/src/app/main.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type RouteObject } from "react-router-dom";
|
|
2
2
|
import { configuredApiKeysPlugin } from "virtual:zudoku-api-keys-plugin";
|
|
3
3
|
import { configuredApiPlugins } from "virtual:zudoku-api-plugins";
|
|
4
4
|
import { configuredAuthProvider } from "virtual:zudoku-auth";
|
|
@@ -9,11 +9,9 @@ import { configuredSearchPlugin } from "virtual:zudoku-search-plugin";
|
|
|
9
9
|
import { configuredSidebar } from "virtual:zudoku-sidebar";
|
|
10
10
|
import "virtual:zudoku-theme.css";
|
|
11
11
|
import { DevPortal, Layout, RouterError } from "zudoku/components";
|
|
12
|
-
import { isNavigationPlugin } from "zudoku/internal";
|
|
13
12
|
import type { ZudokuConfig } from "../config/config.js";
|
|
14
|
-
import { traverseSidebar } from "../lib/components/navigation/utils.js";
|
|
15
13
|
import type { ZudokuContextOptions } from "../lib/core/DevPortalContext.js";
|
|
16
|
-
import {
|
|
14
|
+
import { isNavigationPlugin } from "../lib/core/plugins.js";
|
|
17
15
|
|
|
18
16
|
export const convertZudokuConfigToOptions = (
|
|
19
17
|
config: ZudokuConfig,
|
|
@@ -67,9 +65,7 @@ export const convertZudokuConfigToOptions = (
|
|
|
67
65
|
};
|
|
68
66
|
};
|
|
69
67
|
|
|
70
|
-
export const
|
|
71
|
-
const options = convertZudokuConfigToOptions(config);
|
|
72
|
-
|
|
68
|
+
export const getRoutesByOptions = (options: ZudokuContextOptions) => {
|
|
73
69
|
const allPlugins = [
|
|
74
70
|
...(options.plugins ? options.plugins : []),
|
|
75
71
|
...(options.authentication?.getAuthenticationPlugin
|
|
@@ -77,27 +73,8 @@ export const getRoutesByConfig = (config: ZudokuConfig): RouteObject[] => {
|
|
|
77
73
|
: []),
|
|
78
74
|
];
|
|
79
75
|
|
|
80
|
-
const topNavRedirects =
|
|
81
|
-
options.topNavigation?.flatMap((topNavItem) => {
|
|
82
|
-
if (!options.sidebars?.[topNavItem.id]) return [];
|
|
83
|
-
|
|
84
|
-
const first =
|
|
85
|
-
topNavItem.default ??
|
|
86
|
-
traverseSidebar(options.sidebars[topNavItem.id], (item) => {
|
|
87
|
-
if (item.type === "doc") return joinPath(topNavItem.id, item.id);
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
if (!first) return [];
|
|
91
|
-
|
|
92
|
-
return {
|
|
93
|
-
path: topNavItem.id,
|
|
94
|
-
loader: () => redirect(joinPath(first)),
|
|
95
|
-
} satisfies RouteObject;
|
|
96
|
-
}) ?? [];
|
|
97
|
-
|
|
98
76
|
const routes = allPlugins
|
|
99
77
|
.flatMap((plugin) => (isNavigationPlugin(plugin) ? plugin.getRoutes() : []))
|
|
100
|
-
.concat(topNavRedirects)
|
|
101
78
|
.concat({
|
|
102
79
|
path: "*",
|
|
103
80
|
loader: () => {
|
|
@@ -105,6 +82,13 @@ export const getRoutesByConfig = (config: ZudokuConfig): RouteObject[] => {
|
|
|
105
82
|
},
|
|
106
83
|
});
|
|
107
84
|
|
|
85
|
+
return routes;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const getRoutesByConfig = (config: ZudokuConfig): RouteObject[] => {
|
|
89
|
+
const options = convertZudokuConfigToOptions(config);
|
|
90
|
+
const routes = getRoutesByOptions(options);
|
|
91
|
+
|
|
108
92
|
return [
|
|
109
93
|
{
|
|
110
94
|
element: (
|
package/src/app/standalone.tsx
CHANGED
|
@@ -16,7 +16,7 @@ if (!root) {
|
|
|
16
16
|
themeToggle();
|
|
17
17
|
|
|
18
18
|
const apiUrl = root.getAttribute("data-api-url");
|
|
19
|
-
const pageTitle = document.getElementsByTagName("title")[0]
|
|
19
|
+
const pageTitle = document.getElementsByTagName("title")[0]!.innerText;
|
|
20
20
|
const logoUrl = root.getAttribute("data-logo-url");
|
|
21
21
|
|
|
22
22
|
// IMPORTANT: This component must not contain tailwind classes
|
|
@@ -70,14 +70,22 @@ export const Header = memo(function HeaderInner() {
|
|
|
70
70
|
{page?.logo && (
|
|
71
71
|
<>
|
|
72
72
|
<img
|
|
73
|
-
src={
|
|
73
|
+
src={
|
|
74
|
+
/https?:\/\//.test(page.logo.src.light)
|
|
75
|
+
? page.logo.src.light
|
|
76
|
+
: import.meta.env.BASE_URL + page.logo.src.light
|
|
77
|
+
}
|
|
74
78
|
alt={page.logo.alt ?? page.pageTitle}
|
|
75
79
|
style={{ width: page.logo.width }}
|
|
76
80
|
className={cn("h-10", isDark && "hidden")}
|
|
77
81
|
loading="lazy"
|
|
78
82
|
/>
|
|
79
83
|
<img
|
|
80
|
-
src={
|
|
84
|
+
src={
|
|
85
|
+
/https?:\/\//.test(page.logo.src.dark)
|
|
86
|
+
? page.logo.src.dark
|
|
87
|
+
: import.meta.env.BASE_URL + page.logo.src.dark
|
|
88
|
+
}
|
|
81
89
|
alt={page.logo.alt ?? page.pageTitle}
|
|
82
90
|
style={{ width: page.logo.width }}
|
|
83
91
|
className={cn("h-10", !isDark && "hidden")}
|
|
@@ -46,6 +46,10 @@ type SyntaxHighlightProps = {
|
|
|
46
46
|
language?: string;
|
|
47
47
|
} & Omit<HighlightProps, "children" | "language">;
|
|
48
48
|
|
|
49
|
+
const remapLang = {
|
|
50
|
+
mdx: "md",
|
|
51
|
+
} as Record<string, string>;
|
|
52
|
+
|
|
49
53
|
export const SyntaxHighlight = ({
|
|
50
54
|
copyable = true,
|
|
51
55
|
language = "plain",
|
|
@@ -61,7 +65,7 @@ export const SyntaxHighlight = ({
|
|
|
61
65
|
return (
|
|
62
66
|
<Highlight
|
|
63
67
|
theme={isDark ? themes.vsDark : themes.github}
|
|
64
|
-
language={language}
|
|
68
|
+
language={remapLang[language] ?? language}
|
|
65
69
|
{...props}
|
|
66
70
|
>
|
|
67
71
|
{({ className, style, tokens, getLineProps, getTokenProps }) => (
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { cx } from "class-variance-authority";
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { Suspense } from "react";
|
|
3
|
+
import { Link } from "react-router-dom";
|
|
4
4
|
import { useAuth } from "../authentication/hook.js";
|
|
5
|
-
import {
|
|
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";
|
|
6
9
|
|
|
7
10
|
export const isHiddenItem =
|
|
8
11
|
(isAuthenticated?: boolean) =>
|
|
@@ -25,26 +28,57 @@ export const TopNavigation = () => {
|
|
|
25
28
|
}
|
|
26
29
|
|
|
27
30
|
return (
|
|
28
|
-
<
|
|
29
|
-
<
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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>
|
|
49
83
|
);
|
|
50
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
|
};
|
|
@@ -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
|
|
@@ -87,7 +85,7 @@ export const SidebarCategory = ({
|
|
|
87
85
|
)}
|
|
88
86
|
{category.link?.type === "doc" ? (
|
|
89
87
|
<NavLink
|
|
90
|
-
to={joinPath(
|
|
88
|
+
to={joinPath(category.link.id)}
|
|
91
89
|
className="flex-1"
|
|
92
90
|
onClick={() => {
|
|
93
91
|
// if it is the current path and closed then open it because there's no path change to trigger the open
|
|
@@ -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
|
|
|
@@ -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,12 +61,7 @@ export type ZudokuContextOptions = {
|
|
|
60
61
|
metadata?: Metadata;
|
|
61
62
|
page?: Page;
|
|
62
63
|
authentication?: AuthenticationProvider;
|
|
63
|
-
topNavigation?:
|
|
64
|
-
id: string;
|
|
65
|
-
label: string;
|
|
66
|
-
default?: string;
|
|
67
|
-
display?: "auth" | "anon" | "always";
|
|
68
|
-
}>;
|
|
64
|
+
topNavigation?: TopNavigationItem[];
|
|
69
65
|
sidebars?: SidebarConfig;
|
|
70
66
|
plugins?: DevPortalPlugin[];
|
|
71
67
|
slotlets?: Slotlets;
|
|
@@ -77,7 +73,7 @@ export type ZudokuContextOptions = {
|
|
|
77
73
|
|
|
78
74
|
export class DevPortalContext {
|
|
79
75
|
public plugins: NonNullable<ZudokuContextOptions["plugins"]>;
|
|
80
|
-
public sidebars:
|
|
76
|
+
public sidebars: SidebarConfig;
|
|
81
77
|
public topNavigation: NonNullable<ZudokuContextOptions["topNavigation"]>;
|
|
82
78
|
public meta: ZudokuContextOptions["metadata"];
|
|
83
79
|
public page: ZudokuContextOptions["page"];
|
package/src/lib/core/plugins.ts
CHANGED
|
@@ -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";
|
|
@@ -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
|
});
|