@lukoweb/apitogo 0.1.1 → 0.1.3

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.
Files changed (91) hide show
  1. package/dist/cli/cli.js +168 -57
  2. package/dist/declarations/lib/ui/Command.d.ts +1 -1
  3. package/dist/declarations/lib/util/MdxComponents.d.ts +1 -1
  4. package/package.json +2 -1
  5. package/src/app/main.tsx +150 -150
  6. package/src/config/loader.ts +245 -245
  7. package/src/index.ts +33 -33
  8. package/src/lib/authentication/components/CallbackHandler.tsx +45 -45
  9. package/src/lib/authentication/components/SignIn.tsx +46 -46
  10. package/src/lib/authentication/components/SignUp.tsx +48 -48
  11. package/src/lib/authentication/providers/clerk.tsx +224 -224
  12. package/src/lib/authentication/ui/AuthCard.tsx +7 -7
  13. package/src/lib/authentication/ui/EmailLinkCallbackUi.tsx +129 -125
  14. package/src/lib/authentication/ui/EmailLinkSentUi.tsx +105 -101
  15. package/src/lib/authentication/ui/EmailLinkSignInUi.tsx +100 -96
  16. package/src/lib/authentication/ui/EmailVerificationUi.tsx +128 -124
  17. package/src/lib/authentication/ui/ZudokuAuthUi.tsx +620 -616
  18. package/src/lib/components/AiAssistantMenuItems.tsx +102 -102
  19. package/src/lib/components/Autocomplete.tsx +123 -123
  20. package/src/lib/components/DeveloperHint.tsx +39 -35
  21. package/src/lib/components/Header.tsx +260 -260
  22. package/src/lib/components/Layout.tsx +53 -53
  23. package/src/lib/components/Main.tsx +51 -51
  24. package/src/lib/components/Mermaid.tsx +74 -70
  25. package/src/lib/components/MobileTopNavigation.tsx +276 -276
  26. package/src/lib/components/MultiSelect.tsx +86 -82
  27. package/src/lib/components/TopNavigation.tsx +103 -103
  28. package/src/lib/components/index.ts +26 -26
  29. package/src/lib/components/navigation/NavigationCategory.tsx +157 -157
  30. package/src/lib/components/navigation/NavigationFilterInput.tsx +35 -35
  31. package/src/lib/components/navigation/NavigationItem.tsx +181 -177
  32. package/src/lib/core/RouteGuard.tsx +193 -193
  33. package/src/lib/errors/ErrorMessage.tsx +50 -46
  34. package/src/lib/plugins/api-catalog/Catalog.tsx +80 -80
  35. package/src/lib/plugins/api-keys/CreateApiKey.tsx +128 -124
  36. package/src/lib/plugins/api-keys/CreateApiKeyDialog.tsx +49 -49
  37. package/src/lib/plugins/api-keys/SettingsApiKeys.tsx +72 -72
  38. package/src/lib/plugins/api-keys/settings/ApiKeyItem.tsx +342 -342
  39. package/src/lib/plugins/api-keys/settings/RevealApiKey.tsx +127 -127
  40. package/src/lib/plugins/markdown/MdxPage.tsx +285 -285
  41. package/src/lib/plugins/openapi/ApiHeader.tsx +96 -96
  42. package/src/lib/plugins/openapi/CollapsibleCode.tsx +88 -88
  43. package/src/lib/plugins/openapi/DownloadSchemaButton.tsx +94 -94
  44. package/src/lib/plugins/openapi/GeneratedExampleSidecarBox.tsx +52 -52
  45. package/src/lib/plugins/openapi/OperationListItem.tsx +183 -183
  46. package/src/lib/plugins/openapi/RequestBodySidecarBox.tsx +63 -63
  47. package/src/lib/plugins/openapi/ResponsesSidecarBox.tsx +120 -117
  48. package/src/lib/plugins/openapi/SchemaInfo.tsx +344 -344
  49. package/src/lib/plugins/openapi/SchemaList.tsx +113 -113
  50. package/src/lib/plugins/openapi/Sidecar.tsx +312 -309
  51. package/src/lib/plugins/openapi/SidecarExamples.tsx +177 -174
  52. package/src/lib/plugins/openapi/components/EnumValues.tsx +58 -58
  53. package/src/lib/plugins/openapi/components/ResponseContent.tsx +117 -114
  54. package/src/lib/plugins/openapi/playground/BodyPanel.tsx +274 -271
  55. package/src/lib/plugins/openapi/playground/CollapsibleHeader.tsx +51 -51
  56. package/src/lib/plugins/openapi/playground/ExamplesDropdown.tsx +60 -60
  57. package/src/lib/plugins/openapi/playground/Headers.tsx +188 -181
  58. package/src/lib/plugins/openapi/playground/IdentityDialog.tsx +75 -75
  59. package/src/lib/plugins/openapi/playground/IdentitySelector.tsx +38 -38
  60. package/src/lib/plugins/openapi/playground/ParamsGrid.tsx +45 -45
  61. package/src/lib/plugins/openapi/playground/Playground.tsx +602 -599
  62. package/src/lib/plugins/openapi/playground/PlaygroundDialog.tsx +56 -56
  63. package/src/lib/plugins/openapi/playground/QueryParams.tsx +151 -148
  64. package/src/lib/plugins/openapi/playground/RequestLoginDialog.tsx +70 -70
  65. package/src/lib/plugins/openapi/playground/request-panel/MultipartField.tsx +91 -91
  66. package/src/lib/plugins/openapi/playground/result-panel/AudioPlayer.tsx +50 -50
  67. package/src/lib/plugins/openapi/playground/result-panel/ResponseTab.tsx +355 -355
  68. package/src/lib/plugins/openapi/playground/result-panel/ResultPanel.tsx +106 -102
  69. package/src/lib/plugins/openapi/schema/SchemaPropertyItem.tsx +189 -184
  70. package/src/lib/plugins/openapi/schema/SchemaView.tsx +299 -299
  71. package/src/lib/plugins/search-pagefind/IndexingDialog.tsx +162 -162
  72. package/src/lib/plugins/search-pagefind/PagefindSearch.tsx +202 -202
  73. package/src/lib/plugins/search-pagefind/ResultList.tsx +122 -118
  74. package/src/lib/ui/ActionButton.tsx +21 -21
  75. package/src/lib/ui/Command.tsx +191 -191
  76. package/src/lib/util/MdxComponents.tsx +150 -150
  77. package/src/vite/config.ts +234 -231
  78. package/src/vite/dev-server.ts +291 -291
  79. package/src/vite/plugin-api-keys.ts +50 -50
  80. package/src/vite/plugin-api.ts +320 -318
  81. package/src/vite/plugin-auth.ts +38 -38
  82. package/src/vite/plugin-component.ts +45 -39
  83. package/src/vite/plugin-config.ts +75 -75
  84. package/src/vite/plugin-custom-pages.ts +36 -36
  85. package/src/vite/plugin-docs.ts +202 -202
  86. package/src/vite/plugin-markdown-export.ts +214 -214
  87. package/src/vite/plugin-mdx.ts +149 -149
  88. package/src/vite/plugin-navigation.ts +106 -106
  89. package/src/vite/plugin-search.ts +47 -47
  90. package/src/vite/plugin.ts +42 -42
  91. package/src/vite/prerender/prerender.ts +233 -233
@@ -1,96 +1,100 @@
1
- import { useMutation } from "@tanstack/react-query";
2
- import { useForm } from "react-hook-form";
3
- import { Link, useNavigate, useSearchParams } from "react-router";
4
- import { ActionButton } from "@lukoweb/apitogo/ui/ActionButton.js";
5
- import { Alert, AlertDescription, AlertTitle } from "@lukoweb/apitogo/ui/Alert.js";
6
- import {
7
- CardContent,
8
- CardDescription,
9
- CardHeader,
10
- CardTitle,
11
- } from "@lukoweb/apitogo/ui/Card.js";
12
- import { Input } from "@lukoweb/apitogo/ui/Input.js";
13
- import {
14
- Form,
15
- FormControl,
16
- FormItem,
17
- FormLabel,
18
- FormMessage,
19
- } from "../../ui/Form.js";
20
- import { AuthCard } from "./AuthCard.js";
21
-
22
- type EmailLinkFormFields = {
23
- email: string;
24
- };
25
-
26
- export const EmailLinkSignInUi = ({
27
- onSubmit,
28
- }: {
29
- onSubmit: (email: string, redirectTo?: string) => Promise<void>;
30
- }) => {
31
- const navigate = useNavigate();
32
- const [searchParams] = useSearchParams();
33
- const redirectTo = searchParams.get("redirectTo");
34
-
35
- const mutation = useMutation({
36
- mutationFn: ({ email }: EmailLinkFormFields) =>
37
- onSubmit(email, redirectTo ?? undefined),
38
- onSuccess: () => {
39
- void navigate(
40
- redirectTo
41
- ? `/signin/email-link-sent?redirectTo=${encodeURIComponent(redirectTo)}`
42
- : "/signin/email-link-sent",
43
- );
44
- },
45
- });
46
-
47
- const form = useForm<EmailLinkFormFields>({
48
- defaultValues: { email: "" },
49
- });
50
-
51
- return (
52
- <AuthCard>
53
- <CardHeader>
54
- <CardTitle>Sign in with email link</CardTitle>
55
- <CardDescription>
56
- Enter your email and we'll send you a link to sign in.
57
- </CardDescription>
58
- </CardHeader>
59
- <CardContent className="flex flex-col gap-4">
60
- {mutation.error && (
61
- <Alert variant="destructive">
62
- <AlertTitle>Error</AlertTitle>
63
- <AlertDescription>{mutation.error.message}</AlertDescription>
64
- </Alert>
65
- )}
66
- <Form {...form}>
67
- <form
68
- onSubmit={form.handleSubmit((data) =>
69
- mutation.mutate({ email: data.email }),
70
- )}
71
- className="flex flex-col gap-2"
72
- >
73
- <FormItem>
74
- <FormLabel>E-Mail</FormLabel>
75
- <FormControl>
76
- <Input
77
- placeholder="you@example.com"
78
- type="email"
79
- required
80
- {...form.register("email", { required: true })}
81
- />
82
- </FormControl>
83
- <FormMessage />
84
- </FormItem>
85
- <ActionButton type="submit" isPending={mutation.isPending}>
86
- Send sign-in link
87
- </ActionButton>
88
- </form>
89
- </Form>
90
- <Link to="/signin" className="text-sm text-muted-foreground">
91
- Back to sign in
92
- </Link>
93
- </CardContent>
94
- </AuthCard>
95
- );
96
- };
1
+ import { ActionButton } from "@lukoweb/apitogo/ui/ActionButton.js";
2
+ import {
3
+ Alert,
4
+ AlertDescription,
5
+ AlertTitle,
6
+ } from "@lukoweb/apitogo/ui/Alert.js";
7
+ import {
8
+ CardContent,
9
+ CardDescription,
10
+ CardHeader,
11
+ CardTitle,
12
+ } from "@lukoweb/apitogo/ui/Card.js";
13
+ import { Input } from "@lukoweb/apitogo/ui/Input.js";
14
+ import { useMutation } from "@tanstack/react-query";
15
+ import { useForm } from "react-hook-form";
16
+ import { Link, useNavigate, useSearchParams } from "react-router";
17
+ import {
18
+ Form,
19
+ FormControl,
20
+ FormItem,
21
+ FormLabel,
22
+ FormMessage,
23
+ } from "../../ui/Form.js";
24
+ import { AuthCard } from "./AuthCard.js";
25
+
26
+ type EmailLinkFormFields = {
27
+ email: string;
28
+ };
29
+
30
+ export const EmailLinkSignInUi = ({
31
+ onSubmit,
32
+ }: {
33
+ onSubmit: (email: string, redirectTo?: string) => Promise<void>;
34
+ }) => {
35
+ const navigate = useNavigate();
36
+ const [searchParams] = useSearchParams();
37
+ const redirectTo = searchParams.get("redirectTo");
38
+
39
+ const mutation = useMutation({
40
+ mutationFn: ({ email }: EmailLinkFormFields) =>
41
+ onSubmit(email, redirectTo ?? undefined),
42
+ onSuccess: () => {
43
+ void navigate(
44
+ redirectTo
45
+ ? `/signin/email-link-sent?redirectTo=${encodeURIComponent(redirectTo)}`
46
+ : "/signin/email-link-sent",
47
+ );
48
+ },
49
+ });
50
+
51
+ const form = useForm<EmailLinkFormFields>({
52
+ defaultValues: { email: "" },
53
+ });
54
+
55
+ return (
56
+ <AuthCard>
57
+ <CardHeader>
58
+ <CardTitle>Sign in with email link</CardTitle>
59
+ <CardDescription>
60
+ Enter your email and we'll send you a link to sign in.
61
+ </CardDescription>
62
+ </CardHeader>
63
+ <CardContent className="flex flex-col gap-4">
64
+ {mutation.error && (
65
+ <Alert variant="destructive">
66
+ <AlertTitle>Error</AlertTitle>
67
+ <AlertDescription>{mutation.error.message}</AlertDescription>
68
+ </Alert>
69
+ )}
70
+ <Form {...form}>
71
+ <form
72
+ onSubmit={form.handleSubmit((data) =>
73
+ mutation.mutate({ email: data.email }),
74
+ )}
75
+ className="flex flex-col gap-2"
76
+ >
77
+ <FormItem>
78
+ <FormLabel>E-Mail</FormLabel>
79
+ <FormControl>
80
+ <Input
81
+ placeholder="you@example.com"
82
+ type="email"
83
+ required
84
+ {...form.register("email", { required: true })}
85
+ />
86
+ </FormControl>
87
+ <FormMessage />
88
+ </FormItem>
89
+ <ActionButton type="submit" isPending={mutation.isPending}>
90
+ Send sign-in link
91
+ </ActionButton>
92
+ </form>
93
+ </Form>
94
+ <Link to="/signin" className="text-sm text-muted-foreground">
95
+ Back to sign in
96
+ </Link>
97
+ </CardContent>
98
+ </AuthCard>
99
+ );
100
+ };
@@ -1,124 +1,128 @@
1
- import { useMutation, useQuery } from "@tanstack/react-query";
2
- import { CheckIcon, MailCheck, RefreshCw } from "lucide-react";
3
- import { Navigate, useSearchParams } from "react-router";
4
- import { ActionButton } from "@lukoweb/apitogo/ui/ActionButton.js";
5
- import { Alert, AlertDescription, AlertTitle } from "@lukoweb/apitogo/ui/Alert.js";
6
- import { Button } from "@lukoweb/apitogo/ui/Button.js";
7
- import {
8
- Card,
9
- CardContent,
10
- CardDescription,
11
- CardHeader,
12
- CardTitle,
13
- } from "@lukoweb/apitogo/ui/Card.js";
14
- import createVariantComponent from "../../util/createVariantComponent.js";
15
- import { getRelativeRedirectUrl } from "../utils/relativeRedirectUrl.js";
16
-
17
- export const EmailVerificationUi = ({
18
- onResendVerification,
19
- onCheckVerification,
20
- }: {
21
- onResendVerification: () => Promise<void>;
22
- onCheckVerification: () => Promise<boolean>;
23
- }) => {
24
- const [searchParams] = useSearchParams();
25
- const redirectTo = searchParams.get("redirectTo");
26
- const relativeRedirectTo = getRelativeRedirectUrl(redirectTo);
27
-
28
- const resendMutation = useMutation({
29
- mutationFn: () => onResendVerification(),
30
- });
31
-
32
- const checkVerificationMutation = useQuery({
33
- queryKey: ["check-verification"],
34
- queryFn: () => onCheckVerification(),
35
- });
36
-
37
- const error = resendMutation.error ?? checkVerificationMutation.error ?? null;
38
-
39
- return (
40
- <AuthCard>
41
- {checkVerificationMutation.data === true && (
42
- <Navigate to={relativeRedirectTo} />
43
- )}
44
- <CardHeader className="text-center">
45
- <div className="mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10">
46
- <MailCheck className="h-8 w-8 text-primary" />
47
- </div>
48
- <CardTitle>Verify your email</CardTitle>
49
- <CardDescription>We've sent a verification link</CardDescription>
50
- </CardHeader>
51
- <CardContent className="flex flex-col gap-4">
52
- {error && (
53
- <Alert variant="destructive">
54
- <AlertTitle>Error</AlertTitle>
55
- <AlertDescription>{error?.message}</AlertDescription>
56
- </Alert>
57
- )}
58
-
59
- {resendMutation.isSuccess && (
60
- <Alert>
61
- <AlertTitle>Email sent</AlertTitle>
62
- <AlertDescription>
63
- A new verification email has been sent. Please check your inbox.
64
- </AlertDescription>
65
- </Alert>
66
- )}
67
-
68
- {checkVerificationMutation.isSuccess &&
69
- !checkVerificationMutation.data && (
70
- <Alert>
71
- <AlertDescription>
72
- {checkVerificationMutation.isFetching
73
- ? "Checking verification..."
74
- : "Your email hasn't been verified yet. Please check your inbox and click the verification link."}
75
- </AlertDescription>
76
- </Alert>
77
- )}
78
-
79
- <div className="space-y-4">
80
- <ActionButton
81
- onClick={() => void checkVerificationMutation.refetch()}
82
- isPending={checkVerificationMutation.isFetching}
83
- className="w-full"
84
- >
85
- <div className="flex items-center gap-2">
86
- <CheckIcon className="h-4 w-4" /> Continue
87
- </div>
88
- </ActionButton>
89
-
90
- <div className="relative">
91
- <div className="absolute inset-0 flex items-center">
92
- <span className="w-full border-t" />
93
- </div>
94
- <div className="relative flex justify-center text-sm">
95
- <span className="bg-card px-2 text-muted-foreground">
96
- Didn't receive the email?
97
- </span>
98
- </div>
99
- </div>
100
-
101
- <Button
102
- variant="outline"
103
- onClick={() => void resendMutation.mutate()}
104
- disabled={resendMutation.isPending}
105
- className="w-full gap-2"
106
- >
107
- {resendMutation.isPending ? (
108
- <RefreshCw className="h-4 w-4 animate-spin" />
109
- ) : (
110
- <RefreshCw className="h-4 w-4" />
111
- )}
112
- Resend verification email
113
- </Button>
114
- </div>
115
-
116
- <p className="text-center text-xs text-muted-foreground">
117
- Make sure to check your spam folder if you don't see the email.
118
- </p>
119
- </CardContent>
120
- </AuthCard>
121
- );
122
- };
123
-
124
- const AuthCard = createVariantComponent(Card, "max-w-md w-full mt-10 mx-auto");
1
+ import { ActionButton } from "@lukoweb/apitogo/ui/ActionButton.js";
2
+ import {
3
+ Alert,
4
+ AlertDescription,
5
+ AlertTitle,
6
+ } from "@lukoweb/apitogo/ui/Alert.js";
7
+ import { Button } from "@lukoweb/apitogo/ui/Button.js";
8
+ import {
9
+ Card,
10
+ CardContent,
11
+ CardDescription,
12
+ CardHeader,
13
+ CardTitle,
14
+ } from "@lukoweb/apitogo/ui/Card.js";
15
+ import { useMutation, useQuery } from "@tanstack/react-query";
16
+ import { CheckIcon, MailCheck, RefreshCw } from "lucide-react";
17
+ import { Navigate, useSearchParams } from "react-router";
18
+ import createVariantComponent from "../../util/createVariantComponent.js";
19
+ import { getRelativeRedirectUrl } from "../utils/relativeRedirectUrl.js";
20
+
21
+ export const EmailVerificationUi = ({
22
+ onResendVerification,
23
+ onCheckVerification,
24
+ }: {
25
+ onResendVerification: () => Promise<void>;
26
+ onCheckVerification: () => Promise<boolean>;
27
+ }) => {
28
+ const [searchParams] = useSearchParams();
29
+ const redirectTo = searchParams.get("redirectTo");
30
+ const relativeRedirectTo = getRelativeRedirectUrl(redirectTo);
31
+
32
+ const resendMutation = useMutation({
33
+ mutationFn: () => onResendVerification(),
34
+ });
35
+
36
+ const checkVerificationMutation = useQuery({
37
+ queryKey: ["check-verification"],
38
+ queryFn: () => onCheckVerification(),
39
+ });
40
+
41
+ const error = resendMutation.error ?? checkVerificationMutation.error ?? null;
42
+
43
+ return (
44
+ <AuthCard>
45
+ {checkVerificationMutation.data === true && (
46
+ <Navigate to={relativeRedirectTo} />
47
+ )}
48
+ <CardHeader className="text-center">
49
+ <div className="mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10">
50
+ <MailCheck className="h-8 w-8 text-primary" />
51
+ </div>
52
+ <CardTitle>Verify your email</CardTitle>
53
+ <CardDescription>We've sent a verification link</CardDescription>
54
+ </CardHeader>
55
+ <CardContent className="flex flex-col gap-4">
56
+ {error && (
57
+ <Alert variant="destructive">
58
+ <AlertTitle>Error</AlertTitle>
59
+ <AlertDescription>{error?.message}</AlertDescription>
60
+ </Alert>
61
+ )}
62
+
63
+ {resendMutation.isSuccess && (
64
+ <Alert>
65
+ <AlertTitle>Email sent</AlertTitle>
66
+ <AlertDescription>
67
+ A new verification email has been sent. Please check your inbox.
68
+ </AlertDescription>
69
+ </Alert>
70
+ )}
71
+
72
+ {checkVerificationMutation.isSuccess &&
73
+ !checkVerificationMutation.data && (
74
+ <Alert>
75
+ <AlertDescription>
76
+ {checkVerificationMutation.isFetching
77
+ ? "Checking verification..."
78
+ : "Your email hasn't been verified yet. Please check your inbox and click the verification link."}
79
+ </AlertDescription>
80
+ </Alert>
81
+ )}
82
+
83
+ <div className="space-y-4">
84
+ <ActionButton
85
+ onClick={() => void checkVerificationMutation.refetch()}
86
+ isPending={checkVerificationMutation.isFetching}
87
+ className="w-full"
88
+ >
89
+ <div className="flex items-center gap-2">
90
+ <CheckIcon className="h-4 w-4" /> Continue
91
+ </div>
92
+ </ActionButton>
93
+
94
+ <div className="relative">
95
+ <div className="absolute inset-0 flex items-center">
96
+ <span className="w-full border-t" />
97
+ </div>
98
+ <div className="relative flex justify-center text-sm">
99
+ <span className="bg-card px-2 text-muted-foreground">
100
+ Didn't receive the email?
101
+ </span>
102
+ </div>
103
+ </div>
104
+
105
+ <Button
106
+ variant="outline"
107
+ onClick={() => void resendMutation.mutate()}
108
+ disabled={resendMutation.isPending}
109
+ className="w-full gap-2"
110
+ >
111
+ {resendMutation.isPending ? (
112
+ <RefreshCw className="h-4 w-4 animate-spin" />
113
+ ) : (
114
+ <RefreshCw className="h-4 w-4" />
115
+ )}
116
+ Resend verification email
117
+ </Button>
118
+ </div>
119
+
120
+ <p className="text-center text-xs text-muted-foreground">
121
+ Make sure to check your spam folder if you don't see the email.
122
+ </p>
123
+ </CardContent>
124
+ </AuthCard>
125
+ );
126
+ };
127
+
128
+ const AuthCard = createVariantComponent(Card, "max-w-md w-full mt-10 mx-auto");