@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.
Files changed (91) hide show
  1. package/dist/cli/cli.js +37 -147
  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 +1 -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,114 +1,117 @@
1
- import * as Tabs from "@radix-ui/react-tabs";
2
- import { useState } from "react";
3
- import { Badge } from "@lukoweb/apitogo/ui/Badge.js";
4
- import { NativeSelect, NativeSelectOption } from "@lukoweb/apitogo/ui/NativeSelect.js";
5
- import { cn } from "@lukoweb/apitogo/ui/util.js";
6
- import { Markdown } from "../../../components/Markdown.js";
7
- import type { MediaTypeObject } from "../graphql/graphql.js";
8
- import { SchemaView } from "../schema/SchemaView.js";
9
-
10
- type Response = {
11
- statusCode: string;
12
- description?: string | null;
13
- content?: MediaTypeObject[] | null;
14
- };
15
-
16
- export const ResponseContent = ({
17
- responses,
18
- selectedResponse,
19
- onSelectResponse,
20
- }: {
21
- responses: Response[];
22
- selectedResponse?: string;
23
- onSelectResponse?: (value: string) => void;
24
- }) => {
25
- const [selectedMediaType, setSelectedMediaType] = useState(
26
- responses[0]?.content?.[0]?.mediaType ?? "",
27
- );
28
- const currentResponse =
29
- responses.find((r) => r.statusCode === selectedResponse) ?? responses[0];
30
-
31
- const hideTabs =
32
- responses.length === 1 && responses.at(0)?.statusCode === "200";
33
-
34
- const cardHeader = (
35
- <div className="flex flex-col text-muted-foreground">
36
- <div
37
- className={cn(
38
- "flex flex-row items-center gap-2 justify-between",
39
- !hideTabs && "px-4 py-1.5 border-b",
40
- )}
41
- >
42
- {!hideTabs && (
43
- <Tabs.List className="flex flex-row font-medium text-sm gap-4">
44
- {responses.map((response) => (
45
- <Tabs.Trigger
46
- key={response.statusCode}
47
- value={response.statusCode}
48
- className={cn(
49
- "py-0.5 h-fit -mx-2 px-2 rounded-md",
50
- "data-[state=active]:dark:ring-1 data-[state=active]:dark:ring-border data-[state=active]:bg-background data-[state=active]:drop-shadow",
51
- "data-[state=active]:font-semibold data-[state=active]:text-foreground",
52
- )}
53
- >
54
- {response.statusCode}
55
- </Tabs.Trigger>
56
- ))}
57
- </Tabs.List>
58
- )}
59
- {currentResponse?.content && currentResponse.content.length > 1 && (
60
- <NativeSelect
61
- value={selectedMediaType}
62
- onChange={(e) => setSelectedMediaType(e.target.value)}
63
- className="text-xs h-fit py-1 bg-background"
64
- >
65
- {currentResponse.content.map((c) => (
66
- <NativeSelectOption key={c.mediaType} value={c.mediaType}>
67
- {c.mediaType}
68
- </NativeSelectOption>
69
- ))}
70
- </NativeSelect>
71
- )}
72
- </div>
73
- <div className="p-2 clear-both">
74
- {hideTabs && (
75
- <Badge variant="outline" className="float-start me-2">
76
- {currentResponse?.statusCode}
77
- </Badge>
78
- )}
79
- {currentResponse?.description && (
80
- <Markdown
81
- className="text-sm text-muted-foreground max-w-none"
82
- content={currentResponse.description}
83
- />
84
- )}
85
- </div>
86
- </div>
87
- );
88
-
89
- return (
90
- <div className="flex flex-col gap-2">
91
- <Tabs.Root
92
- value={selectedResponse}
93
- onValueChange={(value) => {
94
- onSelectResponse?.(value);
95
- const newResponse = responses.find((r) => r.statusCode === value);
96
- setSelectedMediaType(newResponse?.content?.[0]?.mediaType ?? "");
97
- }}
98
- >
99
- {responses.map((response) => (
100
- <Tabs.Content key={response.statusCode} value={response.statusCode}>
101
- <SchemaView
102
- schema={
103
- response.content?.find(
104
- (content) => content.mediaType === selectedMediaType,
105
- )?.schema
106
- }
107
- cardHeader={cardHeader}
108
- />
109
- </Tabs.Content>
110
- ))}
111
- </Tabs.Root>
112
- </div>
113
- );
114
- };
1
+ import { Badge } from "@lukoweb/apitogo/ui/Badge.js";
2
+ import {
3
+ NativeSelect,
4
+ NativeSelectOption,
5
+ } from "@lukoweb/apitogo/ui/NativeSelect.js";
6
+ import { cn } from "@lukoweb/apitogo/ui/util.js";
7
+ import * as Tabs from "@radix-ui/react-tabs";
8
+ import { useState } from "react";
9
+ import { Markdown } from "../../../components/Markdown.js";
10
+ import type { MediaTypeObject } from "../graphql/graphql.js";
11
+ import { SchemaView } from "../schema/SchemaView.js";
12
+
13
+ type Response = {
14
+ statusCode: string;
15
+ description?: string | null;
16
+ content?: MediaTypeObject[] | null;
17
+ };
18
+
19
+ export const ResponseContent = ({
20
+ responses,
21
+ selectedResponse,
22
+ onSelectResponse,
23
+ }: {
24
+ responses: Response[];
25
+ selectedResponse?: string;
26
+ onSelectResponse?: (value: string) => void;
27
+ }) => {
28
+ const [selectedMediaType, setSelectedMediaType] = useState(
29
+ responses[0]?.content?.[0]?.mediaType ?? "",
30
+ );
31
+ const currentResponse =
32
+ responses.find((r) => r.statusCode === selectedResponse) ?? responses[0];
33
+
34
+ const hideTabs =
35
+ responses.length === 1 && responses.at(0)?.statusCode === "200";
36
+
37
+ const cardHeader = (
38
+ <div className="flex flex-col text-muted-foreground">
39
+ <div
40
+ className={cn(
41
+ "flex flex-row items-center gap-2 justify-between",
42
+ !hideTabs && "px-4 py-1.5 border-b",
43
+ )}
44
+ >
45
+ {!hideTabs && (
46
+ <Tabs.List className="flex flex-row font-medium text-sm gap-4">
47
+ {responses.map((response) => (
48
+ <Tabs.Trigger
49
+ key={response.statusCode}
50
+ value={response.statusCode}
51
+ className={cn(
52
+ "py-0.5 h-fit -mx-2 px-2 rounded-md",
53
+ "data-[state=active]:dark:ring-1 data-[state=active]:dark:ring-border data-[state=active]:bg-background data-[state=active]:drop-shadow",
54
+ "data-[state=active]:font-semibold data-[state=active]:text-foreground",
55
+ )}
56
+ >
57
+ {response.statusCode}
58
+ </Tabs.Trigger>
59
+ ))}
60
+ </Tabs.List>
61
+ )}
62
+ {currentResponse?.content && currentResponse.content.length > 1 && (
63
+ <NativeSelect
64
+ value={selectedMediaType}
65
+ onChange={(e) => setSelectedMediaType(e.target.value)}
66
+ className="text-xs h-fit py-1 bg-background"
67
+ >
68
+ {currentResponse.content.map((c) => (
69
+ <NativeSelectOption key={c.mediaType} value={c.mediaType}>
70
+ {c.mediaType}
71
+ </NativeSelectOption>
72
+ ))}
73
+ </NativeSelect>
74
+ )}
75
+ </div>
76
+ <div className="p-2 clear-both">
77
+ {hideTabs && (
78
+ <Badge variant="outline" className="float-start me-2">
79
+ {currentResponse?.statusCode}
80
+ </Badge>
81
+ )}
82
+ {currentResponse?.description && (
83
+ <Markdown
84
+ className="text-sm text-muted-foreground max-w-none"
85
+ content={currentResponse.description}
86
+ />
87
+ )}
88
+ </div>
89
+ </div>
90
+ );
91
+
92
+ return (
93
+ <div className="flex flex-col gap-2">
94
+ <Tabs.Root
95
+ value={selectedResponse}
96
+ onValueChange={(value) => {
97
+ onSelectResponse?.(value);
98
+ const newResponse = responses.find((r) => r.statusCode === value);
99
+ setSelectedMediaType(newResponse?.content?.[0]?.mediaType ?? "");
100
+ }}
101
+ >
102
+ {responses.map((response) => (
103
+ <Tabs.Content key={response.statusCode} value={response.statusCode}>
104
+ <SchemaView
105
+ schema={
106
+ response.content?.find(
107
+ (content) => content.mediaType === selectedMediaType,
108
+ )?.schema
109
+ }
110
+ cardHeader={cardHeader}
111
+ />
112
+ </Tabs.Content>
113
+ ))}
114
+ </Tabs.Root>
115
+ </div>
116
+ );
117
+ };