zudoku 0.3.0-dev.83 → 0.3.0-dev.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +5 -1
- package/dist/app/demo.js +5 -4
- package/dist/app/demo.js.map +1 -1
- package/dist/app/main.js +3 -1
- package/dist/app/main.js.map +1 -1
- package/dist/app/standalone.js +5 -4
- package/dist/app/standalone.js.map +1 -1
- package/dist/config/validators/ResolvedSidebarSchema.d.ts +18 -0
- package/dist/config/validators/ResolvedSidebarSchema.js +76 -0
- package/dist/config/validators/ResolvedSidebarSchema.js.map +1 -0
- package/dist/config/validators/SidebarSchema.d.ts +177 -0
- package/dist/config/validators/SidebarSchema.js +71 -0
- package/dist/config/validators/SidebarSchema.js.map +1 -0
- package/dist/config/validators/validate.d.ts +411 -59
- package/dist/config/validators/validate.js +22 -4
- package/dist/config/validators/validate.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/lib/components/DevPortal.js +1 -1
- package/dist/lib/components/DevPortal.js.map +1 -1
- package/dist/lib/components/Header.js.map +1 -1
- package/dist/lib/components/Heading.d.ts +1 -1
- package/dist/lib/components/Layout.js +2 -2
- package/dist/lib/components/Layout.js.map +1 -1
- package/dist/lib/components/TopNavigation.js +5 -5
- package/dist/lib/components/TopNavigation.js.map +1 -1
- package/dist/lib/components/context/DevPortalProvider.d.ts +9 -3
- package/dist/lib/components/context/DevPortalProvider.js +11 -23
- package/dist/lib/components/context/DevPortalProvider.js.map +1 -1
- package/dist/lib/components/context/ThemeContext.d.ts +1 -4
- package/dist/lib/components/context/ThemeContext.js +3 -29
- package/dist/lib/components/context/ThemeContext.js.map +1 -1
- package/dist/lib/components/context/ThemeProvider.d.ts +4 -0
- package/dist/lib/components/context/ThemeProvider.js +23 -0
- package/dist/lib/components/context/ThemeProvider.js.map +1 -0
- package/dist/lib/components/navigation/Sidebar.d.ts +1 -0
- package/dist/lib/components/navigation/Sidebar.js +12 -0
- package/dist/lib/components/navigation/Sidebar.js.map +1 -0
- package/dist/lib/components/navigation/SidebarBadge.d.ts +22 -0
- package/dist/lib/components/navigation/SidebarBadge.js +24 -0
- package/dist/lib/components/navigation/SidebarBadge.js.map +1 -0
- package/dist/lib/components/navigation/SidebarCategory.d.ts +5 -0
- package/dist/lib/components/navigation/SidebarCategory.js +33 -0
- package/dist/lib/components/navigation/SidebarCategory.js.map +1 -0
- package/dist/lib/components/navigation/SidebarItem.d.ts +12 -0
- package/dist/lib/components/navigation/SidebarItem.js +42 -0
- package/dist/lib/components/navigation/SidebarItem.js.map +1 -0
- package/dist/lib/components/navigation/{SideNavigationWrapper.d.ts → SidebarWrapper.d.ts} +1 -1
- package/dist/lib/components/navigation/{SideNavigationWrapper.js → SidebarWrapper.js} +2 -2
- package/dist/lib/components/navigation/SidebarWrapper.js.map +1 -0
- package/dist/lib/components/navigation/utils.d.ts +16 -0
- package/dist/lib/components/navigation/utils.js +85 -0
- package/dist/lib/components/navigation/utils.js.map +1 -0
- package/dist/lib/core/DevPortalContext.d.ts +9 -32
- package/dist/lib/core/DevPortalContext.js +8 -5
- package/dist/lib/core/DevPortalContext.js.map +1 -1
- package/dist/lib/core/plugins.d.ts +6 -8
- package/dist/lib/core/plugins.js.map +1 -1
- package/dist/lib/plugins/markdown/MdxPage.js +5 -36
- package/dist/lib/plugins/markdown/MdxPage.js.map +1 -1
- package/dist/lib/plugins/markdown/generateRoutes.js +20 -43
- package/dist/lib/plugins/markdown/generateRoutes.js.map +1 -1
- package/dist/lib/plugins/openapi/Sidecar.js +12 -2
- package/dist/lib/plugins/openapi/Sidecar.js.map +1 -1
- package/dist/lib/plugins/openapi/index.js +14 -11
- package/dist/lib/plugins/openapi/index.js.map +1 -1
- package/dist/lib/plugins/openapi/interfaces.d.ts +1 -1
- package/dist/lib/util/useScrollToAnchor.js +31 -17
- package/dist/lib/util/useScrollToAnchor.js.map +1 -1
- package/dist/vite/plugin-sidebar.d.ts +3 -0
- package/dist/vite/plugin-sidebar.js +23 -0
- package/dist/vite/plugin-sidebar.js.map +1 -0
- package/dist/vite/plugin.js +2 -0
- package/dist/vite/plugin.js.map +1 -1
- package/lib/{AuthenticationPlugin-XS0DoAhE.js → AuthenticationPlugin-DgwV0hVu.js} +7 -7
- package/lib/{AuthenticationPlugin-XS0DoAhE.js.map → AuthenticationPlugin-DgwV0hVu.js.map} +1 -1
- package/lib/{CategoryHeading-DCmchnA1.js → CategoryHeading-BWq12Bfa.js} +3 -3
- package/lib/{CategoryHeading-DCmchnA1.js.map → CategoryHeading-BWq12Bfa.js.map} +1 -1
- package/lib/{Combination-C442XfGG.js → Combination-DkycFHkm.js} +4 -4
- package/lib/{Combination-C442XfGG.js.map → Combination-DkycFHkm.js.map} +1 -1
- package/lib/{DevPortalProvider-BWeAysxF.js → DevPortalProvider-CTxoCHIT.js} +375 -417
- package/lib/DevPortalProvider-CTxoCHIT.js.map +1 -0
- package/lib/DeveloperHint-BQSFXH01.js +10 -0
- package/lib/{DeveloperHint-DQVwIery.js.map → DeveloperHint-BQSFXH01.js.map} +1 -1
- package/lib/{Input-3IEt27jb.js → Input-BclXSY0g.js} +5 -5
- package/lib/{Input-3IEt27jb.js.map → Input-BclXSY0g.js.map} +1 -1
- package/lib/{Markdown-QsZ-PHET.js → Markdown-B_Gax7at.js} +1136 -1152
- package/lib/{Markdown-QsZ-PHET.js.map → Markdown-B_Gax7at.js.map} +1 -1
- package/lib/{MdxPage-CA1WmW14.js → MdxPage-Crlr0GmN.js} +67 -81
- package/lib/MdxPage-Crlr0GmN.js.map +1 -0
- package/lib/{OperationList-CHK_erYP.js → OperationList-nQ0bd8TU.js} +8 -8
- package/lib/{OperationList-CHK_erYP.js.map → OperationList-nQ0bd8TU.js.map} +1 -1
- package/lib/Route-CNvxEBnR.js +14 -0
- package/lib/{Route-D70pGn9n.js.map → Route-CNvxEBnR.js.map} +1 -1
- package/lib/{SlotletProvider-B71hNEUL.js → SlotletProvider-CzMAO73_.js} +12 -12
- package/lib/{SlotletProvider-B71hNEUL.js.map → SlotletProvider-CzMAO73_.js.map} +1 -1
- package/lib/Spinner-fF-Xv-gw.js +274 -0
- package/lib/Spinner-fF-Xv-gw.js.map +1 -0
- package/lib/index-7kcHaXD6.js +1771 -0
- package/lib/index-7kcHaXD6.js.map +1 -0
- package/lib/{index-Bl6YeerK.js → index-CgCPw6Jn.js} +1026 -1043
- package/lib/index-CgCPw6Jn.js.map +1 -0
- package/lib/{index-BH-Ub36F.js → index-DkuZvRNP.js} +4 -4
- package/lib/{index-BH-Ub36F.js.map → index-DkuZvRNP.js.map} +1 -1
- package/lib/joinPath-VeNuJa7y.js +8 -0
- package/lib/joinPath-VeNuJa7y.js.map +1 -0
- package/lib/jsx-runtime-B6kdoens.js +635 -0
- package/lib/jsx-runtime-B6kdoens.js.map +1 -0
- package/lib/{AnchorLink-BZcpTwOs.js → utils-CzT_9Tsn.js} +258 -214
- package/lib/utils-CzT_9Tsn.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 +1229 -1227
- package/lib/zudoku.components.js.map +1 -1
- package/lib/zudoku.plugin-api-keys.js +19 -19
- package/lib/zudoku.plugin-custom-page.js +2 -2
- package/lib/zudoku.plugin-markdown.js +21 -38
- package/lib/zudoku.plugin-markdown.js.map +1 -1
- package/lib/zudoku.plugin-openapi.js +8 -6
- package/lib/zudoku.plugin-openapi.js.map +1 -1
- package/package.json +4 -1
- package/src/app/demo.tsx +5 -4
- package/src/app/main.css +2 -2
- package/src/app/main.tsx +3 -1
- package/src/app/standalone.tsx +5 -4
- package/src/lib/components/DevPortal.tsx +1 -1
- package/src/lib/components/Header.tsx +2 -2
- package/src/lib/components/Layout.tsx +2 -2
- package/src/lib/components/TopNavigation.tsx +5 -5
- package/src/lib/components/context/DevPortalProvider.ts +11 -28
- package/src/lib/components/context/ThemeContext.tsx +3 -41
- package/src/lib/components/context/ThemeProvider.tsx +27 -0
- package/src/lib/components/navigation/{SideNavigation.tsx → Sidebar.tsx} +7 -7
- package/src/lib/components/navigation/SidebarBadge.tsx +40 -0
- package/src/lib/components/navigation/SidebarCategory.tsx +105 -0
- package/src/lib/components/navigation/SidebarItem.tsx +96 -0
- package/src/lib/components/navigation/{SideNavigationWrapper.tsx → SidebarWrapper.tsx} +1 -1
- package/src/lib/components/navigation/utils.ts +120 -0
- package/src/lib/core/DevPortalContext.ts +12 -44
- package/src/lib/core/plugins.ts +6 -13
- package/src/lib/plugins/markdown/MdxPage.tsx +14 -50
- package/src/lib/plugins/markdown/generateRoutes.tsx +29 -57
- package/src/lib/plugins/openapi/Sidecar.tsx +15 -2
- package/src/lib/plugins/openapi/index.tsx +17 -23
- package/src/lib/plugins/openapi/interfaces.ts +1 -1
- package/src/lib/util/useScrollToAnchor.ts +39 -18
- package/dist/lib/components/navigation/SideNavigation.d.ts +0 -1
- package/dist/lib/components/navigation/SideNavigation.js +0 -12
- package/dist/lib/components/navigation/SideNavigation.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigationCategory.d.ts +0 -4
- package/dist/lib/components/navigation/SideNavigationCategory.js +0 -26
- package/dist/lib/components/navigation/SideNavigationCategory.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigationItem.d.ts +0 -9
- package/dist/lib/components/navigation/SideNavigationItem.js +0 -44
- package/dist/lib/components/navigation/SideNavigationItem.js.map +0 -1
- package/dist/lib/components/navigation/SideNavigationWrapper.js.map +0 -1
- package/dist/lib/components/navigation/useNavigationCollapsibleState.d.ts +0 -9
- package/dist/lib/components/navigation/useNavigationCollapsibleState.js +0 -28
- package/dist/lib/components/navigation/useNavigationCollapsibleState.js.map +0 -1
- package/dist/lib/components/navigation/util.d.ts +0 -8
- package/dist/lib/components/navigation/util.js +0 -15
- package/dist/lib/components/navigation/util.js.map +0 -1
- package/dist/lib/plugins/openapi/MethodBadge.d.ts +0 -13
- package/dist/lib/plugins/openapi/MethodBadge.js +0 -26
- package/dist/lib/plugins/openapi/MethodBadge.js.map +0 -1
- package/dist/lib/util/traverseNavigation.d.ts +0 -6
- package/dist/lib/util/traverseNavigation.js +0 -30
- package/dist/lib/util/traverseNavigation.js.map +0 -1
- package/lib/AnchorLink-BZcpTwOs.js.map +0 -1
- package/lib/DevPortalProvider-BWeAysxF.js.map +0 -1
- package/lib/DeveloperHint-DQVwIery.js +0 -10
- package/lib/MdxPage-CA1WmW14.js.map +0 -1
- package/lib/Route-D70pGn9n.js +0 -13
- package/lib/Spinner-Coi7ORUV.js +0 -244
- package/lib/Spinner-Coi7ORUV.js.map +0 -1
- package/lib/index-Bl6YeerK.js.map +0 -1
- package/lib/index-Dt-pU7Vu.js +0 -916
- package/lib/index-Dt-pU7Vu.js.map +0 -1
- package/lib/jsx-runtime-CJBdjYYx.js +0 -1526
- package/lib/jsx-runtime-CJBdjYYx.js.map +0 -1
- package/src/lib/components/navigation/SideNavigationCategory.tsx +0 -72
- package/src/lib/components/navigation/SideNavigationItem.tsx +0 -148
- package/src/lib/components/navigation/useNavigationCollapsibleState.ts +0 -42
- package/src/lib/components/navigation/util.ts +0 -38
- package/src/lib/plugins/openapi/MethodBadge.tsx +0 -36
- package/src/lib/util/traverseNavigation.ts +0 -55
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { CollapsibleProps } from "@radix-ui/react-collapsible";
|
|
2
|
-
import { useEffect, useRef, useState } from "react";
|
|
3
|
-
import { useLocation } from "react-router-dom";
|
|
4
|
-
import type { NavigationNode } from "../../util/traverseNavigation.js";
|
|
5
|
-
import { checkHasActiveItem } from "./util.js";
|
|
6
|
-
|
|
7
|
-
export const useNavigationCollapsibleState = ({
|
|
8
|
-
item,
|
|
9
|
-
defaultOpen,
|
|
10
|
-
path,
|
|
11
|
-
}: {
|
|
12
|
-
item: NavigationNode;
|
|
13
|
-
defaultOpen: () => boolean;
|
|
14
|
-
path: string;
|
|
15
|
-
}): Partial<CollapsibleProps> & { "data-animate": boolean } => {
|
|
16
|
-
const [open, setOpen] = useState(defaultOpen);
|
|
17
|
-
const location = useLocation();
|
|
18
|
-
const previousLocationPath = useRef(location.pathname);
|
|
19
|
-
const [shouldAnimate, setShouldAnimate] = useState(false);
|
|
20
|
-
|
|
21
|
-
useEffect(() => {
|
|
22
|
-
if (!open && previousLocationPath.current !== location.pathname) {
|
|
23
|
-
setOpen(checkHasActiveItem(item, location.pathname, path));
|
|
24
|
-
}
|
|
25
|
-
previousLocationPath.current = location.pathname;
|
|
26
|
-
}, [open, item, path, location.pathname]);
|
|
27
|
-
|
|
28
|
-
const onOpenChange = () => {
|
|
29
|
-
setShouldAnimate(true);
|
|
30
|
-
setOpen((prev) => !prev);
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
useEffect(() => {
|
|
34
|
-
setShouldAnimate(false);
|
|
35
|
-
}, []);
|
|
36
|
-
|
|
37
|
-
return {
|
|
38
|
-
open,
|
|
39
|
-
onOpenChange,
|
|
40
|
-
"data-animate": shouldAnimate,
|
|
41
|
-
};
|
|
42
|
-
};
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { matchPath } from "react-router-dom";
|
|
2
|
-
import type {
|
|
3
|
-
HrefNavigationCategoryItem,
|
|
4
|
-
PathNavigationCategoryItem,
|
|
5
|
-
} from "../../core/DevPortalContext.js";
|
|
6
|
-
import {
|
|
7
|
-
traverseNavigationNode,
|
|
8
|
-
type NavigationNode,
|
|
9
|
-
} from "../../util/traverseNavigation.js";
|
|
10
|
-
|
|
11
|
-
export const isPathItem = (
|
|
12
|
-
item: NavigationNode,
|
|
13
|
-
): item is PathNavigationCategoryItem => "path" in item;
|
|
14
|
-
|
|
15
|
-
export const isLinkItem = (
|
|
16
|
-
item: NavigationNode,
|
|
17
|
-
): item is HrefNavigationCategoryItem => "href" in item;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Recursively checks if the current item or any of its children are active.
|
|
21
|
-
*/
|
|
22
|
-
export const checkHasActiveItem = (
|
|
23
|
-
item: NavigationNode,
|
|
24
|
-
locationPath: string,
|
|
25
|
-
basePath: string,
|
|
26
|
-
) => {
|
|
27
|
-
return Boolean(
|
|
28
|
-
traverseNavigationNode(
|
|
29
|
-
item,
|
|
30
|
-
(node, fullPath) => {
|
|
31
|
-
if (isPathItem(node) && matchPath(fullPath, locationPath)) {
|
|
32
|
-
return true;
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
basePath,
|
|
36
|
-
),
|
|
37
|
-
);
|
|
38
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { cn } from "../../util/cn.js";
|
|
2
|
-
|
|
3
|
-
export const MethodTextColorMap = {
|
|
4
|
-
get: "text-green-600",
|
|
5
|
-
post: "text-sky-600",
|
|
6
|
-
put: "text-yellow-600",
|
|
7
|
-
delete: "text-red-600",
|
|
8
|
-
patch: "text-purple-600",
|
|
9
|
-
options: "text-indigo-600",
|
|
10
|
-
head: "text-gray-600",
|
|
11
|
-
trace: "text-gray-600",
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
const MethodColorMap = {
|
|
15
|
-
get: "bg-green-400 dark:bg-green-800",
|
|
16
|
-
post: "bg-sky-400 dark:bg-sky-800",
|
|
17
|
-
put: "bg-yellow-400 dark:bg-yellow-800",
|
|
18
|
-
delete: "bg-red-400 dark:bg-red-800",
|
|
19
|
-
patch: "bg-purple-400 dark:bg-purple-600",
|
|
20
|
-
options: "bg-indigo-400 dark:bg-indigo-600",
|
|
21
|
-
head: "bg-gray-400 dark:bg-gray-600",
|
|
22
|
-
trace: "bg-gray-400 dark:bg-gray-600",
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export const MethodBadge = ({ method }: { method: string }) => {
|
|
26
|
-
return (
|
|
27
|
-
<span
|
|
28
|
-
className={cn(
|
|
29
|
-
"mt-0.5 flex items-center duration-200 transition-opacity text-center uppercase font-mono text-[0.65rem] font-bold rounded text-background dark:text-zinc-50 h-4 px-1",
|
|
30
|
-
MethodColorMap[method as keyof typeof MethodColorMap],
|
|
31
|
-
)}
|
|
32
|
-
>
|
|
33
|
-
{method}
|
|
34
|
-
</span>
|
|
35
|
-
);
|
|
36
|
-
};
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { isPathItem } from "../components/navigation/util.js";
|
|
2
|
-
import type {
|
|
3
|
-
NavigationCategory,
|
|
4
|
-
NavigationCategoryItem,
|
|
5
|
-
NavigationItem,
|
|
6
|
-
} from "../core/DevPortalContext.js";
|
|
7
|
-
import { joinPath } from "./joinPath.js";
|
|
8
|
-
|
|
9
|
-
export type NavigationNode = NavigationCategoryItem | NavigationCategory;
|
|
10
|
-
type Callback<T> = (
|
|
11
|
-
node: NavigationNode,
|
|
12
|
-
fullPath: string,
|
|
13
|
-
parentNodes: NavigationNode[],
|
|
14
|
-
) => T | undefined;
|
|
15
|
-
|
|
16
|
-
export const traverseNavigationNode = <T>(
|
|
17
|
-
node: NavigationNode,
|
|
18
|
-
callback: Callback<T>,
|
|
19
|
-
parentPath: string,
|
|
20
|
-
parentNodes: NavigationNode[] = [],
|
|
21
|
-
): T | undefined => {
|
|
22
|
-
const newPath = isPathItem(node)
|
|
23
|
-
? joinPath(parentPath, node.path)
|
|
24
|
-
: parentPath;
|
|
25
|
-
const result = callback(node, newPath, parentNodes);
|
|
26
|
-
|
|
27
|
-
if (result !== undefined) return result;
|
|
28
|
-
|
|
29
|
-
if ("children" in node && node.children) {
|
|
30
|
-
const newParentNodes = [...parentNodes, node];
|
|
31
|
-
for (const child of node.children) {
|
|
32
|
-
const childResult = traverseNavigationNode(
|
|
33
|
-
child,
|
|
34
|
-
callback,
|
|
35
|
-
newPath,
|
|
36
|
-
newParentNodes,
|
|
37
|
-
);
|
|
38
|
-
if (childResult !== undefined) return childResult;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return undefined;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const traverseNavigation = <T>(
|
|
45
|
-
navItem: NavigationItem,
|
|
46
|
-
callback: Callback<T>,
|
|
47
|
-
): T | undefined => {
|
|
48
|
-
if (navItem.categories) {
|
|
49
|
-
for (const category of navItem.categories) {
|
|
50
|
-
const result = traverseNavigationNode(category, callback, navItem.path);
|
|
51
|
-
if (result !== undefined) return result;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return undefined;
|
|
55
|
-
};
|