@lukoweb/apitogo 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.js +37 -147
- package/dist/declarations/lib/ui/Command.d.ts +1 -1
- package/dist/declarations/lib/util/MdxComponents.d.ts +1 -1
- package/package.json +1 -1
- package/src/app/main.tsx +150 -150
- package/src/config/loader.ts +245 -245
- package/src/index.ts +33 -33
- package/src/lib/authentication/components/CallbackHandler.tsx +45 -45
- package/src/lib/authentication/components/SignIn.tsx +46 -46
- package/src/lib/authentication/components/SignUp.tsx +48 -48
- package/src/lib/authentication/providers/clerk.tsx +224 -224
- package/src/lib/authentication/ui/AuthCard.tsx +7 -7
- package/src/lib/authentication/ui/EmailLinkCallbackUi.tsx +129 -125
- package/src/lib/authentication/ui/EmailLinkSentUi.tsx +105 -101
- package/src/lib/authentication/ui/EmailLinkSignInUi.tsx +100 -96
- package/src/lib/authentication/ui/EmailVerificationUi.tsx +128 -124
- package/src/lib/authentication/ui/ZudokuAuthUi.tsx +620 -616
- package/src/lib/components/AiAssistantMenuItems.tsx +102 -102
- package/src/lib/components/Autocomplete.tsx +123 -123
- package/src/lib/components/DeveloperHint.tsx +39 -35
- package/src/lib/components/Header.tsx +260 -260
- package/src/lib/components/Layout.tsx +53 -53
- package/src/lib/components/Main.tsx +51 -51
- package/src/lib/components/Mermaid.tsx +74 -70
- package/src/lib/components/MobileTopNavigation.tsx +276 -276
- package/src/lib/components/MultiSelect.tsx +86 -82
- package/src/lib/components/TopNavigation.tsx +103 -103
- package/src/lib/components/index.ts +26 -26
- package/src/lib/components/navigation/NavigationCategory.tsx +157 -157
- package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -35
- package/src/lib/components/navigation/NavigationItem.tsx +181 -177
- package/src/lib/core/RouteGuard.tsx +193 -193
- package/src/lib/errors/ErrorMessage.tsx +50 -46
- package/src/lib/plugins/api-catalog/Catalog.tsx +80 -80
- package/src/lib/plugins/api-keys/CreateApiKey.tsx +128 -124
- package/src/lib/plugins/api-keys/CreateApiKeyDialog.tsx +49 -49
- package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +72 -72
- package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -342
- package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +127 -127
- package/src/lib/plugins/markdown/MdxPage.tsx +285 -285
- package/src/lib/plugins/openapi/ApiHeader.tsx +96 -96
- package/src/lib/plugins/openapi/CollapsibleCode.tsx +88 -88
- package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +94 -94
- package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -52
- package/src/lib/plugins/openapi/OperationListItem.tsx +183 -183
- package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +63 -63
- package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +120 -117
- package/src/lib/plugins/openapi/SchemaInfo.tsx +344 -344
- package/src/lib/plugins/openapi/SchemaList.tsx +113 -113
- package/src/lib/plugins/openapi/Sidecar.tsx +312 -309
- package/src/lib/plugins/openapi/SidecarExamples.tsx +177 -174
- package/src/lib/plugins/openapi/components/EnumValues.tsx +58 -58
- package/src/lib/plugins/openapi/components/ResponseContent.tsx +117 -114
- package/src/lib/plugins/openapi/playground/BodyPanel.tsx +274 -271
- package/src/lib/plugins/openapi/playground/CollapsibleHeader.tsx +51 -51
- package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +60 -60
- package/src/lib/plugins/openapi/playground/Headers.tsx +188 -181
- package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +75 -75
- package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +38 -38
- package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +45 -45
- package/src/lib/plugins/openapi/playground/Playground.tsx +602 -599
- package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +56 -56
- package/src/lib/plugins/openapi/playground/QueryParams.tsx +151 -148
- package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +70 -70
- package/src/lib/plugins/openapi/playground/request-panel/MultipartField.tsx +91 -91
- package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -50
- package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +355 -355
- package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +106 -102
- package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +189 -184
- package/src/lib/plugins/openapi/schema/SchemaView.tsx +299 -299
- package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +162 -162
- package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +202 -202
- package/src/lib/plugins/search-pagefind/ResultList.tsx +122 -118
- package/src/lib/ui/ActionButton.tsx +21 -21
- package/src/lib/ui/Command.tsx +191 -191
- package/src/lib/util/MdxComponents.tsx +150 -150
- package/src/vite/config.ts +234 -231
- package/src/vite/dev-server.ts +291 -291
- package/src/vite/plugin-api-keys.ts +50 -50
- package/src/vite/plugin-api.ts +320 -318
- package/src/vite/plugin-auth.ts +38 -38
- package/src/vite/plugin-component.ts +45 -39
- package/src/vite/plugin-config.ts +75 -75
- package/src/vite/plugin-custom-pages.ts +36 -36
- package/src/vite/plugin-docs.ts +202 -202
- package/src/vite/plugin-markdown-export.ts +214 -214
- package/src/vite/plugin-mdx.ts +149 -149
- package/src/vite/plugin-navigation.ts +106 -106
- package/src/vite/plugin-search.ts +47 -47
- package/src/vite/plugin.ts +42 -42
- package/src/vite/prerender/prerender.ts +233 -233
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { cn } from "../util/cn.js";
|
|
6
|
-
import { useCurrentNavigation, useZudoku } from "./context/ZudokuContext.js";
|
|
7
|
-
import { Navigation } from "./navigation/Navigation.js";
|
|
8
|
-
import { Slot } from "./Slot.js";
|
|
9
|
-
|
|
10
|
-
export const Main = ({ children }: PropsWithChildren) => {
|
|
11
|
-
const [isDrawerOpen, setDrawerOpen] = useState(false);
|
|
12
|
-
const { navigation } = useCurrentNavigation();
|
|
13
|
-
const hasNavigation = navigation.length > 0;
|
|
14
|
-
const isNavigating = useNavigation().state === "loading";
|
|
15
|
-
const { options } = useZudoku();
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<Drawer
|
|
19
|
-
direction={options.site?.dir === "rtl" ? "right" : "left"}
|
|
20
|
-
open={isDrawerOpen}
|
|
21
|
-
onOpenChange={(open) => setDrawerOpen(open)}
|
|
22
|
-
>
|
|
23
|
-
{hasNavigation && (
|
|
24
|
-
<Navigation
|
|
25
|
-
onRequestClose={() => setDrawerOpen(false)}
|
|
26
|
-
navigation={navigation}
|
|
27
|
-
/>
|
|
28
|
-
)}
|
|
29
|
-
{hasNavigation && (
|
|
30
|
-
<div className="lg:hidden m-0 p-0 md:-mx-4 md:px-4 py-2 sticky bg-background/80 backdrop-blur-xs z-10 top-0 start-0 end-0 border-b">
|
|
31
|
-
<DrawerTrigger className="flex items-center gap-2 px-4">
|
|
32
|
-
<PanelLeftIcon size={16} strokeWidth={1.5} />
|
|
33
|
-
<span className="text-sm">Menu</span>
|
|
34
|
-
</DrawerTrigger>
|
|
35
|
-
</div>
|
|
36
|
-
)}
|
|
37
|
-
<main
|
|
38
|
-
data-pagefind-body
|
|
39
|
-
className={cn(
|
|
40
|
-
"px-4 lg:pe-8 lg:px-8",
|
|
41
|
-
!hasNavigation && "col-span-full",
|
|
42
|
-
isNavigating && "animate-pulse",
|
|
43
|
-
)}
|
|
44
|
-
>
|
|
45
|
-
<Slot.Target name="content-before" />
|
|
46
|
-
{children}
|
|
47
|
-
<Slot.Target name="content-after" />
|
|
48
|
-
</main>
|
|
49
|
-
</Drawer>
|
|
50
|
-
);
|
|
51
|
-
};
|
|
1
|
+
import { Drawer, DrawerTrigger } from "@lukoweb/apitogo/ui/Drawer.js";
|
|
2
|
+
import { PanelLeftIcon } from "lucide-react";
|
|
3
|
+
import { type PropsWithChildren, useState } from "react";
|
|
4
|
+
import { useNavigation } from "react-router";
|
|
5
|
+
import { cn } from "../util/cn.js";
|
|
6
|
+
import { useCurrentNavigation, useZudoku } from "./context/ZudokuContext.js";
|
|
7
|
+
import { Navigation } from "./navigation/Navigation.js";
|
|
8
|
+
import { Slot } from "./Slot.js";
|
|
9
|
+
|
|
10
|
+
export const Main = ({ children }: PropsWithChildren) => {
|
|
11
|
+
const [isDrawerOpen, setDrawerOpen] = useState(false);
|
|
12
|
+
const { navigation } = useCurrentNavigation();
|
|
13
|
+
const hasNavigation = navigation.length > 0;
|
|
14
|
+
const isNavigating = useNavigation().state === "loading";
|
|
15
|
+
const { options } = useZudoku();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<Drawer
|
|
19
|
+
direction={options.site?.dir === "rtl" ? "right" : "left"}
|
|
20
|
+
open={isDrawerOpen}
|
|
21
|
+
onOpenChange={(open) => setDrawerOpen(open)}
|
|
22
|
+
>
|
|
23
|
+
{hasNavigation && (
|
|
24
|
+
<Navigation
|
|
25
|
+
onRequestClose={() => setDrawerOpen(false)}
|
|
26
|
+
navigation={navigation}
|
|
27
|
+
/>
|
|
28
|
+
)}
|
|
29
|
+
{hasNavigation && (
|
|
30
|
+
<div className="lg:hidden m-0 p-0 md:-mx-4 md:px-4 py-2 sticky bg-background/80 backdrop-blur-xs z-10 top-0 start-0 end-0 border-b">
|
|
31
|
+
<DrawerTrigger className="flex items-center gap-2 px-4">
|
|
32
|
+
<PanelLeftIcon size={16} strokeWidth={1.5} />
|
|
33
|
+
<span className="text-sm">Menu</span>
|
|
34
|
+
</DrawerTrigger>
|
|
35
|
+
</div>
|
|
36
|
+
)}
|
|
37
|
+
<main
|
|
38
|
+
data-pagefind-body
|
|
39
|
+
className={cn(
|
|
40
|
+
"px-4 lg:pe-8 lg:px-8",
|
|
41
|
+
!hasNavigation && "col-span-full",
|
|
42
|
+
isNavigating && "animate-pulse",
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
<Slot.Target name="content-before" />
|
|
46
|
+
{children}
|
|
47
|
+
<Slot.Target name="content-after" />
|
|
48
|
+
</main>
|
|
49
|
+
</Drawer>
|
|
50
|
+
);
|
|
51
|
+
};
|
|
@@ -1,70 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
1
|
+
import {
|
|
2
|
+
Alert,
|
|
3
|
+
AlertDescription,
|
|
4
|
+
AlertTitle,
|
|
5
|
+
} from "@lukoweb/apitogo/ui/Alert.js";
|
|
6
|
+
import { useQuery } from "@tanstack/react-query";
|
|
7
|
+
import type { MermaidConfig } from "mermaid";
|
|
8
|
+
import type { ComponentProps } from "react";
|
|
9
|
+
import { useId } from "react";
|
|
10
|
+
import { useTheme } from "../hooks/index.js";
|
|
11
|
+
import { Spinner } from "./Spinner.js";
|
|
12
|
+
|
|
13
|
+
export type MermaidProps = {
|
|
14
|
+
chart: string;
|
|
15
|
+
config?: MermaidConfig;
|
|
16
|
+
} & ComponentProps<"div">;
|
|
17
|
+
|
|
18
|
+
let mermaidPromise: Promise<typeof import("mermaid").default> | null = null;
|
|
19
|
+
|
|
20
|
+
const loadMermaid = () => {
|
|
21
|
+
if (!mermaidPromise) {
|
|
22
|
+
mermaidPromise = import("mermaid")
|
|
23
|
+
.then((mod) => mod.default)
|
|
24
|
+
.catch((error) => {
|
|
25
|
+
throw new Error(
|
|
26
|
+
"Mermaid is not installed. Please install it with: npm install mermaid",
|
|
27
|
+
{ cause: error },
|
|
28
|
+
);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return mermaidPromise;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Mermaid = ({ chart, config, ...props }: MermaidProps) => {
|
|
35
|
+
const id = useId();
|
|
36
|
+
const theme = useTheme();
|
|
37
|
+
|
|
38
|
+
const {
|
|
39
|
+
data: svg,
|
|
40
|
+
error,
|
|
41
|
+
isPending,
|
|
42
|
+
} = useQuery({
|
|
43
|
+
queryKey: ["mermaid", chart, config, theme.resolvedTheme],
|
|
44
|
+
queryFn: async () => {
|
|
45
|
+
const mermaid = await loadMermaid();
|
|
46
|
+
mermaid.initialize({
|
|
47
|
+
theme: theme.resolvedTheme === "dark" ? "dark" : "base",
|
|
48
|
+
...config,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const { svg } = await mermaid.render(id, chart);
|
|
52
|
+
return svg;
|
|
53
|
+
},
|
|
54
|
+
enabled: typeof window !== "undefined",
|
|
55
|
+
retry: false,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (error)
|
|
59
|
+
return (
|
|
60
|
+
<Alert className="flex flex-col gap-2" variant="destructive">
|
|
61
|
+
<AlertTitle>Mermaid Error</AlertTitle>
|
|
62
|
+
<AlertDescription className="overflow-auto wrap-break-word whitespace-pre-wrap font-mono text-xs">
|
|
63
|
+
{error.message}
|
|
64
|
+
</AlertDescription>
|
|
65
|
+
</Alert>
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
if (isPending) return <Spinner />;
|
|
69
|
+
|
|
70
|
+
// biome-ignore lint/security/noDangerouslySetInnerHtml: Mermaid generates valid SVG
|
|
71
|
+
return <div {...props} dangerouslySetInnerHTML={{ __html: svg }} />;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export default Mermaid;
|