@lukoweb/apitogo 0.1.1 → 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 +17 -6
- 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,102 +1,106 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import type {
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
1
|
+
import { Spinner } from "@lukoweb/apitogo/components";
|
|
2
|
+
import {
|
|
3
|
+
Alert,
|
|
4
|
+
AlertDescription,
|
|
5
|
+
AlertTitle,
|
|
6
|
+
} from "@lukoweb/apitogo/ui/Alert.js";
|
|
7
|
+
import type { UseMutationResult } from "@tanstack/react-query";
|
|
8
|
+
import { SendIcon, UnplugIcon } from "lucide-react";
|
|
9
|
+
import { Button } from "../../../../ui/Button.js";
|
|
10
|
+
import { cn } from "../../../../util/cn.js";
|
|
11
|
+
import type { PlaygroundResult } from "../Playground.js";
|
|
12
|
+
import ResponseStatusBar from "./ResponseStatusBar.js";
|
|
13
|
+
import { ResponseTab } from "./ResponseTab.js";
|
|
14
|
+
|
|
15
|
+
export const ResultPanel = ({
|
|
16
|
+
queryMutation,
|
|
17
|
+
showLongRunningWarning,
|
|
18
|
+
onCancel,
|
|
19
|
+
tip,
|
|
20
|
+
isFinished,
|
|
21
|
+
progress,
|
|
22
|
+
}: {
|
|
23
|
+
// biome-ignore lint/suspicious/noExplicitAny: Allow any type
|
|
24
|
+
queryMutation: UseMutationResult<PlaygroundResult, Error, any>;
|
|
25
|
+
showLongRunningWarning?: boolean;
|
|
26
|
+
onCancel?: () => void;
|
|
27
|
+
isFinished: boolean;
|
|
28
|
+
progress: number;
|
|
29
|
+
tip?: React.ReactNode;
|
|
30
|
+
}) => {
|
|
31
|
+
return (
|
|
32
|
+
<div className="flex flex-col overflow-y-auto h-[80vh] bg-muted/50">
|
|
33
|
+
{(queryMutation.isPending || queryMutation.data) && (
|
|
34
|
+
<ResponseStatusBar
|
|
35
|
+
status={queryMutation.data?.status}
|
|
36
|
+
time={queryMutation.data?.time}
|
|
37
|
+
size={queryMutation.data?.size}
|
|
38
|
+
isFinished={isFinished}
|
|
39
|
+
progress={progress}
|
|
40
|
+
/>
|
|
41
|
+
)}
|
|
42
|
+
{queryMutation.error ? (
|
|
43
|
+
<div className="max-w-2/3 mx-auto mt-20">
|
|
44
|
+
<Alert>
|
|
45
|
+
<UnplugIcon size={24} strokeWidth={1.5} className="me-5" />
|
|
46
|
+
<AlertTitle>Request failed</AlertTitle>
|
|
47
|
+
<AlertDescription>
|
|
48
|
+
{queryMutation.error.message ||
|
|
49
|
+
String(queryMutation.error) ||
|
|
50
|
+
"Unexpected error"}
|
|
51
|
+
</AlertDescription>
|
|
52
|
+
</Alert>
|
|
53
|
+
</div>
|
|
54
|
+
) : queryMutation.data ? (
|
|
55
|
+
<ResponseTab
|
|
56
|
+
request={queryMutation.data.request}
|
|
57
|
+
size={queryMutation.data.size}
|
|
58
|
+
headers={queryMutation.data.headers}
|
|
59
|
+
body={queryMutation.data.body}
|
|
60
|
+
isBinary={queryMutation.data.isBinary}
|
|
61
|
+
fileName={queryMutation.data.fileName}
|
|
62
|
+
blob={queryMutation.data.blob}
|
|
63
|
+
/>
|
|
64
|
+
) : queryMutation.isPending ? (
|
|
65
|
+
<div className="grid place-items-center h-full">
|
|
66
|
+
<div className="flex flex-col gap-2 items-center mt-20">
|
|
67
|
+
<Spinner />
|
|
68
|
+
<div
|
|
69
|
+
className={cn(
|
|
70
|
+
"opacity-0 pointer-events-none transition-opacity h-20 text-sm text-muted-foreground duration-300 flex flex-col gap-2 items-center",
|
|
71
|
+
showLongRunningWarning && "opacity-100 pointer-events-auto",
|
|
72
|
+
)}
|
|
73
|
+
>
|
|
74
|
+
Looks like the request is taking longer than expected.
|
|
75
|
+
<Button
|
|
76
|
+
type="button"
|
|
77
|
+
onClick={onCancel}
|
|
78
|
+
size="sm"
|
|
79
|
+
className="w-fit"
|
|
80
|
+
variant="outline"
|
|
81
|
+
>
|
|
82
|
+
Cancel
|
|
83
|
+
</Button>
|
|
84
|
+
</div>
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
) : (
|
|
88
|
+
<div className="h-full grid place-items-center">
|
|
89
|
+
<div className="flex flex-col gap-4 items-center">
|
|
90
|
+
<SendIcon
|
|
91
|
+
size={64}
|
|
92
|
+
className="text-muted-foreground"
|
|
93
|
+
strokeWidth={1.2}
|
|
94
|
+
/>
|
|
95
|
+
<span className="text-[16px] font-semibold text-muted-foreground">
|
|
96
|
+
Send your first request
|
|
97
|
+
</span>
|
|
98
|
+
{tip}
|
|
99
|
+
</div>
|
|
100
|
+
</div>
|
|
101
|
+
)}
|
|
102
|
+
</div>
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export default ResultPanel;
|
|
@@ -1,184 +1,189 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
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
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
schema.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
(
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
schema.
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
),
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
1
|
+
import {
|
|
2
|
+
Item,
|
|
3
|
+
ItemActions,
|
|
4
|
+
ItemContent,
|
|
5
|
+
ItemTitle,
|
|
6
|
+
} from "@lukoweb/apitogo/ui/Item.js";
|
|
7
|
+
import * as Collapsible from "@radix-ui/react-collapsible";
|
|
8
|
+
import { MinusIcon, PlusIcon, RefreshCcwDotIcon } from "lucide-react";
|
|
9
|
+
import { useState } from "react";
|
|
10
|
+
import { InlineCode } from "../../../components/InlineCode.js";
|
|
11
|
+
import { Markdown } from "../../../components/Markdown.js";
|
|
12
|
+
import type { SchemaObject } from "../../../oas/parser/index.js";
|
|
13
|
+
import { Button } from "../../../ui/Button.js";
|
|
14
|
+
import { cn } from "../../../util/cn.js";
|
|
15
|
+
import { ConstValue } from "../components/ConstValue.js";
|
|
16
|
+
import { EnumValues } from "../components/EnumValues.js";
|
|
17
|
+
import { ParamInfos } from "../ParamInfos.js";
|
|
18
|
+
import { SchemaExampleAndDefault } from "./SchemaExampleAndDefault.js";
|
|
19
|
+
import { SchemaView } from "./SchemaView.js";
|
|
20
|
+
import {
|
|
21
|
+
extractCircularRefInfo,
|
|
22
|
+
isArrayCircularRef,
|
|
23
|
+
isArrayType,
|
|
24
|
+
isCircularRef,
|
|
25
|
+
isComplexType,
|
|
26
|
+
} from "./utils.js";
|
|
27
|
+
|
|
28
|
+
const RecursiveIndicator = ({ circularProp }: { circularProp?: string }) => (
|
|
29
|
+
<InlineCode className="inline-flex items-center gap-1.5 text-xs translate-y-0.5">
|
|
30
|
+
<RefreshCcwDotIcon size={13} />
|
|
31
|
+
<span>{circularProp ? `${circularProp} (circular)` : "circular"}</span>
|
|
32
|
+
</InlineCode>
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const SchemaPropertyItem = ({
|
|
36
|
+
name,
|
|
37
|
+
schema,
|
|
38
|
+
group,
|
|
39
|
+
defaultOpen = false,
|
|
40
|
+
showCollapseButton = true,
|
|
41
|
+
}: {
|
|
42
|
+
name: string;
|
|
43
|
+
schema: SchemaObject;
|
|
44
|
+
group: "required" | "optional" | "deprecated";
|
|
45
|
+
defaultOpen?: boolean;
|
|
46
|
+
showCollapseButton?: boolean;
|
|
47
|
+
}) => {
|
|
48
|
+
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
49
|
+
|
|
50
|
+
const isDeprecated = group === "deprecated";
|
|
51
|
+
|
|
52
|
+
if (isCircularRef(schema)) {
|
|
53
|
+
return (
|
|
54
|
+
<Item
|
|
55
|
+
className={cn(
|
|
56
|
+
isDeprecated && "opacity-50 hover:opacity-100 transition",
|
|
57
|
+
)}
|
|
58
|
+
>
|
|
59
|
+
<ItemContent className="gap-y-2">
|
|
60
|
+
<div>
|
|
61
|
+
<ItemTitle className="inline me-2">
|
|
62
|
+
<code className={cn(isDeprecated && "line-through")}>{name}</code>
|
|
63
|
+
</ItemTitle>
|
|
64
|
+
{"\u200B"}
|
|
65
|
+
<ParamInfos
|
|
66
|
+
className="inline"
|
|
67
|
+
schema={schema}
|
|
68
|
+
extraItems={[
|
|
69
|
+
group === "required" && (
|
|
70
|
+
<span className="text-primary">required</span>
|
|
71
|
+
),
|
|
72
|
+
<RecursiveIndicator key="circular-ref" />,
|
|
73
|
+
]}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
76
|
+
<SchemaExampleAndDefault schema={schema} />
|
|
77
|
+
</ItemContent>
|
|
78
|
+
</Item>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const isCollapsible = Boolean(
|
|
83
|
+
(schema.allOf ||
|
|
84
|
+
schema.anyOf ||
|
|
85
|
+
schema.oneOf ||
|
|
86
|
+
isComplexType(schema) ||
|
|
87
|
+
(isArrayType(schema) &&
|
|
88
|
+
"items" in schema &&
|
|
89
|
+
isComplexType(schema.items)) ||
|
|
90
|
+
schema.additionalProperties) &&
|
|
91
|
+
!isArrayCircularRef(schema),
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const shouldRenderDescription = Boolean(
|
|
95
|
+
schema.description ||
|
|
96
|
+
("items" in schema && schema.items?.enum) ||
|
|
97
|
+
schema.const ||
|
|
98
|
+
schema.enum ||
|
|
99
|
+
schema.example !== undefined ||
|
|
100
|
+
schema.default !== undefined,
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<Item
|
|
105
|
+
className={cn(isDeprecated && "opacity-50 hover:opacity-100 transition")}
|
|
106
|
+
>
|
|
107
|
+
<ItemContent className="gap-y-2">
|
|
108
|
+
<div>
|
|
109
|
+
<ItemTitle className="inline me-2">
|
|
110
|
+
{isCollapsible ? (
|
|
111
|
+
<button
|
|
112
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
113
|
+
type="button"
|
|
114
|
+
className="hover:underline"
|
|
115
|
+
>
|
|
116
|
+
<code className={cn(isDeprecated && "line-through")}>
|
|
117
|
+
{name}
|
|
118
|
+
</code>
|
|
119
|
+
</button>
|
|
120
|
+
) : (
|
|
121
|
+
<code className={cn(isDeprecated && "line-through")}>{name}</code>
|
|
122
|
+
)}
|
|
123
|
+
</ItemTitle>
|
|
124
|
+
{"\u200B"}
|
|
125
|
+
<ParamInfos
|
|
126
|
+
className="inline"
|
|
127
|
+
schema={schema}
|
|
128
|
+
extraItems={[
|
|
129
|
+
group === "required" && (
|
|
130
|
+
<span className="text-primary">required</span>
|
|
131
|
+
),
|
|
132
|
+
isArrayCircularRef(schema) && (
|
|
133
|
+
<RecursiveIndicator
|
|
134
|
+
circularProp={extractCircularRefInfo(schema.items)}
|
|
135
|
+
/>
|
|
136
|
+
),
|
|
137
|
+
]}
|
|
138
|
+
/>
|
|
139
|
+
</div>
|
|
140
|
+
{shouldRenderDescription && (
|
|
141
|
+
<div className="flex flex-col gap-1.5">
|
|
142
|
+
{schema.description && (
|
|
143
|
+
<Markdown className="prose-sm" content={schema.description} />
|
|
144
|
+
)}
|
|
145
|
+
{"items" in schema && schema.items?.enum && (
|
|
146
|
+
<EnumValues values={schema.items.enum} />
|
|
147
|
+
)}
|
|
148
|
+
{schema.const && <ConstValue schema={schema} hideDescription />}
|
|
149
|
+
{schema.enum && <EnumValues values={schema.enum} />}
|
|
150
|
+
<SchemaExampleAndDefault schema={schema} />
|
|
151
|
+
</div>
|
|
152
|
+
)}
|
|
153
|
+
</ItemContent>
|
|
154
|
+
|
|
155
|
+
{isCollapsible && showCollapseButton && (
|
|
156
|
+
<ItemActions className="self-start">
|
|
157
|
+
<Button
|
|
158
|
+
variant="ghost"
|
|
159
|
+
size="icon"
|
|
160
|
+
className="rounded-full"
|
|
161
|
+
onClick={() => setIsOpen(!isOpen)}
|
|
162
|
+
aria-label="Toggle properties"
|
|
163
|
+
>
|
|
164
|
+
{isOpen ? <MinusIcon size={16} /> : <PlusIcon size={16} />}
|
|
165
|
+
</Button>
|
|
166
|
+
</ItemActions>
|
|
167
|
+
)}
|
|
168
|
+
|
|
169
|
+
{isCollapsible && (
|
|
170
|
+
<Collapsible.Root
|
|
171
|
+
defaultOpen={defaultOpen}
|
|
172
|
+
open={isOpen}
|
|
173
|
+
onOpenChange={setIsOpen}
|
|
174
|
+
className={cn("w-full", !isOpen && "contents")}
|
|
175
|
+
>
|
|
176
|
+
<Collapsible.Content asChild>
|
|
177
|
+
<ItemContent>
|
|
178
|
+
{schema.anyOf || schema.oneOf || schema.type === "object" ? (
|
|
179
|
+
<SchemaView schema={schema} />
|
|
180
|
+
) : isArrayType(schema) && "items" in schema ? (
|
|
181
|
+
<SchemaView schema={schema.items} />
|
|
182
|
+
) : null}
|
|
183
|
+
</ItemContent>
|
|
184
|
+
</Collapsible.Content>
|
|
185
|
+
</Collapsible.Root>
|
|
186
|
+
)}
|
|
187
|
+
</Item>
|
|
188
|
+
);
|
|
189
|
+
};
|