fumadocs-openapi 10.2.2 → 10.2.4
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/generate-file.d.ts +53 -49
- package/dist/generate-file.d.ts.map +1 -1
- package/dist/generate-file.js +88 -102
- package/dist/generate-file.js.map +1 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +3 -1
- package/dist/playground/client.d.ts +88 -72
- package/dist/playground/client.d.ts.map +1 -1
- package/dist/playground/client.js +446 -296
- package/dist/playground/client.js.map +1 -0
- package/dist/playground/components/inputs.js +395 -172
- package/dist/playground/components/inputs.js.map +1 -0
- package/dist/playground/components/oauth-dialog.js +270 -174
- package/dist/playground/components/oauth-dialog.js.map +1 -0
- package/dist/playground/components/server-select.js +115 -55
- package/dist/playground/components/server-select.js.map +1 -0
- package/dist/playground/fetcher.d.ts +10 -18
- package/dist/playground/fetcher.d.ts.map +1 -1
- package/dist/playground/fetcher.js +67 -75
- package/dist/playground/fetcher.js.map +1 -0
- package/dist/playground/get-default-values.js +23 -26
- package/dist/playground/get-default-values.js.map +1 -0
- package/dist/playground/index.d.ts +23 -13
- package/dist/playground/index.d.ts.map +1 -1
- package/dist/playground/index.js +87 -91
- package/dist/playground/index.js.map +1 -0
- package/dist/playground/lazy.js +9 -2
- package/dist/playground/lazy.js.map +1 -0
- package/dist/playground/schema.d.ts +18 -55
- package/dist/playground/schema.d.ts.map +1 -1
- package/dist/playground/schema.js +117 -106
- package/dist/playground/schema.js.map +1 -0
- package/dist/playground/status-info.js +49 -37
- package/dist/playground/status-info.js.map +1 -0
- package/dist/requests/generators/csharp.js +40 -50
- package/dist/requests/generators/csharp.js.map +1 -0
- package/dist/requests/generators/curl.js +28 -27
- package/dist/requests/generators/curl.js.map +1 -0
- package/dist/requests/generators/go.js +39 -35
- package/dist/requests/generators/go.js.map +1 -0
- package/dist/requests/generators/index.js +49 -43
- package/dist/requests/generators/index.js.map +1 -0
- package/dist/requests/generators/java.js +56 -67
- package/dist/requests/generators/java.js.map +1 -0
- package/dist/requests/generators/javascript.js +38 -45
- package/dist/requests/generators/javascript.js.map +1 -0
- package/dist/requests/generators/python.js +33 -37
- package/dist/requests/generators/python.js.map +1 -0
- package/dist/requests/media/adapter.d.ts +38 -84
- package/dist/requests/media/adapter.d.ts.map +1 -1
- package/dist/requests/media/adapter.js +122 -169
- package/dist/requests/media/adapter.js.map +1 -0
- package/dist/requests/media/encode.d.ts +12 -7
- package/dist/requests/media/encode.d.ts.map +1 -1
- package/dist/requests/media/encode.js +131 -109
- package/dist/requests/media/encode.js.map +1 -0
- package/dist/requests/media/resolve-adapter.js +28 -28
- package/dist/requests/media/resolve-adapter.js.map +1 -0
- package/dist/requests/string-utils.js +28 -35
- package/dist/requests/string-utils.js.map +1 -0
- package/dist/requests/to-python-object.js +16 -28
- package/dist/requests/to-python-object.js.map +1 -0
- package/dist/requests/types.d.ts +25 -21
- package/dist/requests/types.d.ts.map +1 -1
- package/dist/scalar/client.js +57 -20
- package/dist/scalar/client.js.map +1 -0
- package/dist/scalar/index.d.ts +8 -2
- package/dist/scalar/index.d.ts.map +1 -1
- package/dist/scalar/index.js +29 -19
- package/dist/scalar/index.js.map +1 -0
- package/dist/server/create.d.ts +29 -25
- package/dist/server/create.d.ts.map +1 -1
- package/dist/server/create.js +42 -39
- package/dist/server/create.js.map +1 -0
- package/dist/server/index.d.ts +3 -3
- package/dist/server/index.js +4 -2
- package/dist/server/proxy.d.ts +28 -28
- package/dist/server/proxy.d.ts.map +1 -1
- package/dist/server/proxy.js +58 -75
- package/dist/server/proxy.js.map +1 -0
- package/dist/server/source-api.d.ts +32 -29
- package/dist/server/source-api.d.ts.map +1 -1
- package/dist/server/source-api.js +82 -75
- package/dist/server/source-api.js.map +1 -0
- package/dist/types.d.ts +41 -36
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/api-page.d.ts +140 -136
- package/dist/ui/api-page.d.ts.map +1 -1
- package/dist/ui/api-page.js +134 -118
- package/dist/ui/api-page.js.map +1 -0
- package/dist/ui/client/index.d.ts +30 -26
- package/dist/ui/client/index.d.ts.map +1 -1
- package/dist/ui/client/index.js +8 -2
- package/dist/ui/client/index.js.map +1 -0
- package/dist/ui/client/storage-key.js +16 -10
- package/dist/ui/client/storage-key.js.map +1 -0
- package/dist/ui/components/accordion.js +40 -14
- package/dist/ui/components/accordion.js.map +1 -0
- package/dist/ui/components/dialog.js +51 -15
- package/dist/ui/components/dialog.js.map +1 -0
- package/dist/ui/components/input.js +18 -8
- package/dist/ui/components/input.js.map +1 -0
- package/dist/ui/components/method-label.js +38 -33
- package/dist/ui/components/method-label.js.map +1 -0
- package/dist/ui/components/select.js +66 -15
- package/dist/ui/components/select.js.map +1 -0
- package/dist/ui/contexts/api.js +96 -85
- package/dist/ui/contexts/api.js.map +1 -0
- package/dist/ui/contexts/api.lazy.js +9 -2
- package/dist/ui/contexts/api.lazy.js.map +1 -0
- package/dist/ui/index.d.ts +2 -2
- package/dist/ui/index.js +3 -1
- package/dist/ui/operation/client.js +65 -27
- package/dist/ui/operation/client.js.map +1 -0
- package/dist/ui/operation/index.js +403 -186
- package/dist/ui/operation/index.js.map +1 -0
- package/dist/ui/operation/request-tabs.d.ts +15 -16
- package/dist/ui/operation/request-tabs.d.ts.map +1 -1
- package/dist/ui/operation/request-tabs.js +151 -131
- package/dist/ui/operation/request-tabs.js.map +1 -0
- package/dist/ui/operation/response-tabs.d.ts +27 -28
- package/dist/ui/operation/response-tabs.d.ts.map +1 -1
- package/dist/ui/operation/response-tabs.js +73 -56
- package/dist/ui/operation/response-tabs.js.map +1 -0
- package/dist/ui/operation/usage-tabs/client.js +117 -88
- package/dist/ui/operation/usage-tabs/client.js.map +1 -0
- package/dist/ui/operation/usage-tabs/index.d.ts +22 -21
- package/dist/ui/operation/usage-tabs/index.d.ts.map +1 -1
- package/dist/ui/operation/usage-tabs/index.js +63 -48
- package/dist/ui/operation/usage-tabs/index.js.map +1 -0
- package/dist/ui/operation/usage-tabs/lazy.js +11 -4
- package/dist/ui/operation/usage-tabs/lazy.js.map +1 -0
- package/dist/ui/schema/client.d.ts +11 -7
- package/dist/ui/schema/client.d.ts.map +1 -1
- package/dist/ui/schema/client.js +213 -127
- package/dist/ui/schema/client.js.map +1 -0
- package/dist/ui/schema/index.d.ts +51 -50
- package/dist/ui/schema/index.d.ts.map +1 -1
- package/dist/ui/schema/index.js +225 -248
- package/dist/ui/schema/index.js.map +1 -0
- package/dist/ui/schema/lazy.js +9 -2
- package/dist/ui/schema/lazy.js.map +1 -0
- package/dist/utils/cn.js +3 -1
- package/dist/utils/deep-equal.js +18 -26
- package/dist/utils/deep-equal.js.map +1 -0
- package/dist/utils/get-typescript-schema.js +21 -19
- package/dist/utils/get-typescript-schema.js.map +1 -0
- package/dist/utils/id-to-title.js +13 -16
- package/dist/utils/id-to-title.js.map +1 -0
- package/dist/utils/lazy.js +13 -11
- package/dist/utils/lazy.js.map +1 -0
- package/dist/utils/merge-schema.js +130 -174
- package/dist/utils/merge-schema.js.map +1 -0
- package/dist/utils/pages/builder.d.ts +80 -76
- package/dist/utils/pages/builder.d.ts.map +1 -1
- package/dist/utils/pages/builder.js +101 -118
- package/dist/utils/pages/builder.js.map +1 -0
- package/dist/utils/pages/preset-auto.d.ts +58 -55
- package/dist/utils/pages/preset-auto.d.ts.map +1 -1
- package/dist/utils/pages/preset-auto.js +124 -137
- package/dist/utils/pages/preset-auto.js.map +1 -0
- package/dist/utils/pages/to-body.js +21 -18
- package/dist/utils/pages/to-body.js.map +1 -0
- package/dist/utils/pages/to-static-data.js +48 -40
- package/dist/utils/pages/to-static-data.js.map +1 -0
- package/dist/utils/pages/to-text.d.ts +43 -41
- package/dist/utils/pages/to-text.d.ts.map +1 -1
- package/dist/utils/pages/to-text.js +93 -126
- package/dist/utils/pages/to-text.js.map +1 -0
- package/dist/utils/process-document.d.ts +18 -19
- package/dist/utils/process-document.d.ts.map +1 -1
- package/dist/utils/process-document.js +43 -54
- package/dist/utils/process-document.js.map +1 -0
- package/dist/utils/remove-undefined.js +18 -18
- package/dist/utils/remove-undefined.js.map +1 -0
- package/dist/utils/schema-to-string.js +46 -64
- package/dist/utils/schema-to-string.js.map +1 -0
- package/dist/utils/schema.d.ts +11 -27
- package/dist/utils/schema.d.ts.map +1 -1
- package/dist/utils/schema.js +43 -44
- package/dist/utils/schema.js.map +1 -0
- package/dist/utils/url.js +35 -56
- package/dist/utils/url.js.map +1 -0
- package/dist/utils/use-query.js +39 -33
- package/dist/utils/use-query.js.map +1 -0
- package/package.json +34 -33
- package/dist/index.d.ts.map +0 -1
- package/dist/playground/components/inputs.d.ts +0 -25
- package/dist/playground/components/inputs.d.ts.map +0 -1
- package/dist/playground/components/oauth-dialog.d.ts +0 -13
- package/dist/playground/components/oauth-dialog.d.ts.map +0 -1
- package/dist/playground/components/server-select.d.ts +0 -3
- package/dist/playground/components/server-select.d.ts.map +0 -1
- package/dist/playground/get-default-values.d.ts +0 -3
- package/dist/playground/get-default-values.d.ts.map +0 -1
- package/dist/playground/lazy.d.ts +0 -2
- package/dist/playground/lazy.d.ts.map +0 -1
- package/dist/playground/status-info.d.ts +0 -8
- package/dist/playground/status-info.d.ts.map +0 -1
- package/dist/requests/generators/csharp.d.ts +0 -3
- package/dist/requests/generators/csharp.d.ts.map +0 -1
- package/dist/requests/generators/curl.d.ts +0 -3
- package/dist/requests/generators/curl.d.ts.map +0 -1
- package/dist/requests/generators/go.d.ts +0 -3
- package/dist/requests/generators/go.d.ts.map +0 -1
- package/dist/requests/generators/index.d.ts +0 -3
- package/dist/requests/generators/index.d.ts.map +0 -1
- package/dist/requests/generators/java.d.ts +0 -3
- package/dist/requests/generators/java.d.ts.map +0 -1
- package/dist/requests/generators/javascript.d.ts +0 -3
- package/dist/requests/generators/javascript.d.ts.map +0 -1
- package/dist/requests/generators/python.d.ts +0 -3
- package/dist/requests/generators/python.d.ts.map +0 -1
- package/dist/requests/media/resolve-adapter.d.ts +0 -19
- package/dist/requests/media/resolve-adapter.d.ts.map +0 -1
- package/dist/requests/string-utils.d.ts +0 -7
- package/dist/requests/string-utils.d.ts.map +0 -1
- package/dist/requests/to-python-object.d.ts +0 -2
- package/dist/requests/to-python-object.d.ts.map +0 -1
- package/dist/requests/types.js +0 -1
- package/dist/scalar/client.d.ts +0 -7
- package/dist/scalar/client.d.ts.map +0 -1
- package/dist/server/index.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/dist/ui/client/storage-key.d.ts +0 -9
- package/dist/ui/client/storage-key.d.ts.map +0 -1
- package/dist/ui/components/accordion.d.ts +0 -8
- package/dist/ui/components/accordion.d.ts.map +0 -1
- package/dist/ui/components/dialog.d.ts +0 -20
- package/dist/ui/components/dialog.d.ts.map +0 -1
- package/dist/ui/components/input.d.ts +0 -6
- package/dist/ui/components/input.d.ts.map +0 -1
- package/dist/ui/components/method-label.d.ts +0 -10
- package/dist/ui/components/method-label.d.ts.map +0 -1
- package/dist/ui/components/select.d.ts +0 -14
- package/dist/ui/components/select.d.ts.map +0 -1
- package/dist/ui/contexts/api.d.ts +0 -33
- package/dist/ui/contexts/api.d.ts.map +0 -1
- package/dist/ui/contexts/api.lazy.d.ts +0 -2
- package/dist/ui/contexts/api.lazy.d.ts.map +0 -1
- package/dist/ui/icons.d.ts +0 -49
- package/dist/ui/icons.d.ts.map +0 -1
- package/dist/ui/icons.js +0 -281
- package/dist/ui/index.d.ts.map +0 -1
- package/dist/ui/operation/client.d.ts +0 -19
- package/dist/ui/operation/client.d.ts.map +0 -1
- package/dist/ui/operation/index.d.ts +0 -12
- package/dist/ui/operation/index.d.ts.map +0 -1
- package/dist/ui/operation/usage-tabs/client.d.ts +0 -23
- package/dist/ui/operation/usage-tabs/client.d.ts.map +0 -1
- package/dist/ui/operation/usage-tabs/lazy.d.ts +0 -4
- package/dist/ui/operation/usage-tabs/lazy.d.ts.map +0 -1
- package/dist/ui/schema/lazy.d.ts +0 -2
- package/dist/ui/schema/lazy.d.ts.map +0 -1
- package/dist/utils/cn.d.ts +0 -2
- package/dist/utils/cn.d.ts.map +0 -1
- package/dist/utils/deep-equal.d.ts +0 -2
- package/dist/utils/deep-equal.d.ts.map +0 -1
- package/dist/utils/get-typescript-schema.d.ts +0 -4
- package/dist/utils/get-typescript-schema.d.ts.map +0 -1
- package/dist/utils/id-to-title.d.ts +0 -2
- package/dist/utils/id-to-title.d.ts.map +0 -1
- package/dist/utils/lazy.d.ts +0 -5
- package/dist/utils/lazy.d.ts.map +0 -1
- package/dist/utils/merge-schema.d.ts +0 -7
- package/dist/utils/merge-schema.d.ts.map +0 -1
- package/dist/utils/pages/to-body.d.ts +0 -4
- package/dist/utils/pages/to-body.d.ts.map +0 -1
- package/dist/utils/pages/to-static-data.d.ts +0 -10
- package/dist/utils/pages/to-static-data.d.ts.map +0 -1
- package/dist/utils/remove-undefined.d.ts +0 -2
- package/dist/utils/remove-undefined.d.ts.map +0 -1
- package/dist/utils/schema-to-string.d.ts +0 -8
- package/dist/utils/schema-to-string.d.ts.map +0 -1
- package/dist/utils/url.d.ts +0 -11
- package/dist/utils/url.d.ts.map +0 -1
- package/dist/utils/use-query.d.ts +0 -8
- package/dist/utils/use-query.d.ts.map +0 -1
|
@@ -1,309 +1,459 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { useApiContext } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { encodeRequestData } from
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
2
|
+
|
|
3
|
+
import { joinURL, resolveRequestData, resolveServerUrl, withBase } from "../utils/url.js";
|
|
4
|
+
import { useStorageKey } from "../ui/client/storage-key.js";
|
|
5
|
+
import { useApiContext } from "../ui/contexts/api.js";
|
|
6
|
+
import { cn } from "../utils/cn.js";
|
|
7
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../ui/components/select.js";
|
|
8
|
+
import { labelVariants } from "../ui/components/input.js";
|
|
9
|
+
import { SchemaProvider, useResolvedSchema } from "./schema.js";
|
|
10
|
+
import { FieldInput, FieldSet, JsonInput, ObjectInput } from "./components/inputs.js";
|
|
11
|
+
import { getStatusInfo } from "./status-info.js";
|
|
12
|
+
import { MethodLabel } from "../ui/components/method-label.js";
|
|
13
|
+
import { useQuery } from "../utils/use-query.js";
|
|
14
|
+
import { encodeRequestData } from "../requests/media/encode.js";
|
|
15
|
+
import ServerSelect from "./components/server-select.js";
|
|
16
|
+
import { useExampleRequests } from "../ui/operation/usage-tabs/client.js";
|
|
17
|
+
import { Fragment, lazy, useEffect, useEffectEvent, useMemo, useState } from "react";
|
|
18
|
+
import { FormProvider, get, set, useController, useForm, useFormContext } from "react-hook-form";
|
|
19
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
import { ChevronDown, LoaderCircle, X } from "lucide-react";
|
|
21
|
+
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
22
|
+
import { DynamicCodeBlock } from "fumadocs-ui/components/dynamic-codeblock";
|
|
23
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "fumadocs-ui/components/ui/collapsible";
|
|
24
|
+
|
|
25
|
+
//#region src/playground/client.tsx
|
|
26
|
+
const OauthDialog = lazy(() => import("./components/oauth-dialog.js").then((mod) => ({ default: mod.OauthDialog })));
|
|
27
|
+
const OauthDialogTrigger = lazy(() => import("./components/oauth-dialog.js").then((mod) => ({ default: mod.OauthDialogTrigger })));
|
|
28
|
+
function PlaygroundClient({ route, method = "GET", securities, parameters = [], body, references, proxyUrl, writeOnly, readOnly, ...rest }) {
|
|
29
|
+
const { example: exampleId, examples, setExampleData } = useExampleRequests();
|
|
30
|
+
const storageKeys = useStorageKey();
|
|
31
|
+
const fieldInfoMap = useMemo(() => /* @__PURE__ */ new Map(), []);
|
|
32
|
+
const { mediaAdapters, serverRef, client: { playground: { components: { ResultDisplay = DefaultResultDisplay } = {}, requestTimeout = 10, transformAuthInputs } = {} } } = useApiContext();
|
|
33
|
+
const [securityId, setSecurityId] = useState(0);
|
|
34
|
+
const { inputs, mapInputs, initAuthValues } = useAuthInputs(securities[securityId], transformAuthInputs);
|
|
35
|
+
const defaultValues = useMemo(() => {
|
|
36
|
+
const requestData = examples.find((example) => example.id === exampleId)?.data;
|
|
37
|
+
return {
|
|
38
|
+
path: requestData?.path ?? {},
|
|
39
|
+
query: requestData?.query ?? {},
|
|
40
|
+
header: requestData?.header ?? {},
|
|
41
|
+
body: requestData?.body ?? {},
|
|
42
|
+
cookie: requestData?.cookie ?? {}
|
|
43
|
+
};
|
|
44
|
+
}, [examples, exampleId]);
|
|
45
|
+
const form = useForm({ defaultValues });
|
|
46
|
+
const testQuery = useQuery(async (input) => {
|
|
47
|
+
const targetServer = serverRef.current;
|
|
48
|
+
const fetcher = await import("./fetcher.js").then((mod) => mod.createBrowserFetcher(mediaAdapters, requestTimeout));
|
|
49
|
+
input._encoded ??= encodeRequestData({
|
|
50
|
+
...mapInputs(input),
|
|
51
|
+
method,
|
|
52
|
+
bodyMediaType: body?.mediaType
|
|
53
|
+
}, mediaAdapters, parameters);
|
|
54
|
+
return fetcher.fetch(joinURL(withBase(targetServer ? resolveServerUrl(targetServer.url, targetServer.variables) : "/", window.location.origin), resolveRequestData(route, input._encoded)), {
|
|
55
|
+
proxyUrl,
|
|
56
|
+
...input._encoded
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
const onUpdateDebounced = useEffectEvent((values) => {
|
|
60
|
+
for (const item of inputs) {
|
|
61
|
+
const value = get(values, item.fieldName);
|
|
62
|
+
if (value) localStorage.setItem(storageKeys.AuthField(item), JSON.stringify(value));
|
|
63
|
+
}
|
|
64
|
+
const data = {
|
|
65
|
+
...mapInputs(values),
|
|
66
|
+
method,
|
|
67
|
+
bodyMediaType: body?.mediaType
|
|
68
|
+
};
|
|
69
|
+
values._encoded ??= encodeRequestData(data, mediaAdapters, parameters);
|
|
70
|
+
setExampleData(data, values._encoded);
|
|
71
|
+
});
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
let timer = null;
|
|
74
|
+
const subscription = form.subscribe({
|
|
75
|
+
formState: { values: true },
|
|
76
|
+
callback({ values }) {
|
|
77
|
+
delete values._encoded;
|
|
78
|
+
if (timer) window.clearTimeout(timer);
|
|
79
|
+
timer = window.setTimeout(() => onUpdateDebounced(values), timer ? 400 : 0);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return () => subscription();
|
|
83
|
+
}, []);
|
|
84
|
+
useEffect(() => {
|
|
85
|
+
form.reset(initAuthValues(defaultValues));
|
|
86
|
+
return () => fieldInfoMap.clear();
|
|
87
|
+
}, [defaultValues]);
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
form.reset((values) => initAuthValues(values));
|
|
90
|
+
return () => {
|
|
91
|
+
form.reset((values) => {
|
|
92
|
+
for (const item of inputs) set(values, item.fieldName, void 0);
|
|
93
|
+
return values;
|
|
94
|
+
});
|
|
95
|
+
};
|
|
96
|
+
}, [inputs]);
|
|
97
|
+
const onSubmit = form.handleSubmit((value) => {
|
|
98
|
+
testQuery.start(mapInputs(value));
|
|
99
|
+
});
|
|
100
|
+
return /* @__PURE__ */ jsx(FormProvider, {
|
|
101
|
+
...form,
|
|
102
|
+
children: /* @__PURE__ */ jsx(SchemaProvider, {
|
|
103
|
+
fieldInfoMap,
|
|
104
|
+
references,
|
|
105
|
+
writeOnly,
|
|
106
|
+
readOnly,
|
|
107
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
108
|
+
...rest,
|
|
109
|
+
className: cn("not-prose flex flex-col rounded-xl border shadow-md overflow-hidden bg-fd-card text-fd-card-foreground", rest.className),
|
|
110
|
+
onSubmit,
|
|
111
|
+
children: [
|
|
112
|
+
/* @__PURE__ */ jsx(ServerSelect, {}),
|
|
113
|
+
/* @__PURE__ */ jsxs("div", {
|
|
114
|
+
className: "flex flex-row items-center gap-2 text-sm p-3 not-last:pb-0",
|
|
115
|
+
children: [
|
|
116
|
+
/* @__PURE__ */ jsx(MethodLabel, { children: method }),
|
|
117
|
+
/* @__PURE__ */ jsx(Route, {
|
|
118
|
+
route,
|
|
119
|
+
className: "flex-1"
|
|
120
|
+
}),
|
|
121
|
+
/* @__PURE__ */ jsx("button", {
|
|
122
|
+
type: "submit",
|
|
123
|
+
className: cn(buttonVariants({
|
|
124
|
+
color: "primary",
|
|
125
|
+
size: "sm"
|
|
126
|
+
}), "w-14 py-1.5"),
|
|
127
|
+
disabled: testQuery.isLoading,
|
|
128
|
+
children: testQuery.isLoading ? /* @__PURE__ */ jsx(LoaderCircle, { className: "size-4 animate-spin" }) : "Send"
|
|
129
|
+
})
|
|
130
|
+
]
|
|
131
|
+
}),
|
|
132
|
+
securities.length > 0 && /* @__PURE__ */ jsx(SecurityTabs, {
|
|
133
|
+
securities,
|
|
134
|
+
securityId,
|
|
135
|
+
setSecurityId,
|
|
136
|
+
children: inputs.map((input) => /* @__PURE__ */ jsx(Fragment, { children: input.children }, input.fieldName))
|
|
137
|
+
}),
|
|
138
|
+
/* @__PURE__ */ jsx(FormBody, {
|
|
139
|
+
body,
|
|
140
|
+
parameters
|
|
141
|
+
}),
|
|
142
|
+
testQuery.data ? /* @__PURE__ */ jsx(ResultDisplay, {
|
|
143
|
+
data: testQuery.data,
|
|
144
|
+
reset: testQuery.reset
|
|
145
|
+
}) : null
|
|
146
|
+
]
|
|
147
|
+
})
|
|
148
|
+
})
|
|
149
|
+
});
|
|
113
150
|
}
|
|
114
|
-
function SecurityTabs({ securities, setSecurityId, securityId, children
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
151
|
+
function SecurityTabs({ securities, setSecurityId, securityId, children }) {
|
|
152
|
+
const [open, setOpen] = useState(false);
|
|
153
|
+
const form = useFormContext();
|
|
154
|
+
const result = /* @__PURE__ */ jsxs(CollapsiblePanel, {
|
|
155
|
+
title: "Authorization",
|
|
156
|
+
children: [/* @__PURE__ */ jsxs(Select, {
|
|
157
|
+
value: securityId.toString(),
|
|
158
|
+
onValueChange: (v) => setSecurityId(Number(v)),
|
|
159
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, { children: /* @__PURE__ */ jsx(SelectValue, {}) }), /* @__PURE__ */ jsx(SelectContent, { children: securities.map((security, i) => /* @__PURE__ */ jsx(SelectItem, {
|
|
160
|
+
value: i.toString(),
|
|
161
|
+
children: security.map((item) => /* @__PURE__ */ jsxs("div", {
|
|
162
|
+
className: "max-w-[600px]",
|
|
163
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
164
|
+
className: "font-mono font-medium",
|
|
165
|
+
children: item.id
|
|
166
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
167
|
+
className: "text-fd-muted-foreground whitespace-pre-wrap",
|
|
168
|
+
children: item.description
|
|
169
|
+
})]
|
|
170
|
+
}, item.id))
|
|
171
|
+
}, i)) })]
|
|
172
|
+
}), children]
|
|
173
|
+
});
|
|
174
|
+
for (let i = 0; i < securities.length; i++) {
|
|
175
|
+
const security = securities[i];
|
|
176
|
+
for (const item of security) if (item.type === "oauth2") return /* @__PURE__ */ jsx(OauthDialog, {
|
|
177
|
+
scheme: item,
|
|
178
|
+
scopes: item.scopes,
|
|
179
|
+
open,
|
|
180
|
+
setOpen: (v) => {
|
|
181
|
+
setOpen(v);
|
|
182
|
+
if (v) setSecurityId(i);
|
|
183
|
+
},
|
|
184
|
+
setToken: (token) => form.setValue("header.Authorization", token),
|
|
185
|
+
children: result
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
return result;
|
|
132
189
|
}
|
|
133
|
-
const ParamTypes = [
|
|
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
|
-
|
|
190
|
+
const ParamTypes = [
|
|
191
|
+
"path",
|
|
192
|
+
"header",
|
|
193
|
+
"cookie",
|
|
194
|
+
"query"
|
|
195
|
+
];
|
|
196
|
+
function FormBody({ parameters = [], body }) {
|
|
197
|
+
const { renderParameterField, renderBodyField } = useApiContext().client.playground ?? {};
|
|
198
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [useMemo(() => {
|
|
199
|
+
return ParamTypes.map((type) => {
|
|
200
|
+
const items = parameters.filter((v) => v.in === type);
|
|
201
|
+
if (items.length === 0) return;
|
|
202
|
+
return /* @__PURE__ */ jsx(CollapsiblePanel, {
|
|
203
|
+
title: {
|
|
204
|
+
header: "Header",
|
|
205
|
+
cookie: "Cookies",
|
|
206
|
+
query: "Query",
|
|
207
|
+
path: "Path"
|
|
208
|
+
}[type],
|
|
209
|
+
children: items.map((field) => {
|
|
210
|
+
const fieldName = `${type}.${field.name}`;
|
|
211
|
+
if (renderParameterField) return renderParameterField(fieldName, field);
|
|
212
|
+
const contentTypes = field.content && Object.keys(field.content);
|
|
213
|
+
const schema = field.content && contentTypes && contentTypes.length > 0 ? field.content[contentTypes[0]].schema : field.schema;
|
|
214
|
+
return /* @__PURE__ */ jsx(FieldSet, {
|
|
215
|
+
name: field.name,
|
|
216
|
+
fieldName,
|
|
217
|
+
field: schema
|
|
218
|
+
}, fieldName);
|
|
219
|
+
})
|
|
220
|
+
}, type);
|
|
221
|
+
});
|
|
222
|
+
}, [parameters, renderParameterField]), body && /* @__PURE__ */ jsx(CollapsiblePanel, {
|
|
223
|
+
title: "Body",
|
|
224
|
+
children: renderBodyField ? renderBodyField("body", body) : /* @__PURE__ */ jsx(BodyInput, { field: body.schema })
|
|
225
|
+
})] });
|
|
160
226
|
}
|
|
161
227
|
function BodyInput({ field: _field }) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
228
|
+
const field = useResolvedSchema(_field);
|
|
229
|
+
const [isJson, setIsJson] = useState(false);
|
|
230
|
+
if (field.format === "binary") return /* @__PURE__ */ jsx(FieldSet, {
|
|
231
|
+
field,
|
|
232
|
+
fieldName: "body"
|
|
233
|
+
});
|
|
234
|
+
if (isJson) return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("button", {
|
|
235
|
+
className: cn(buttonVariants({
|
|
236
|
+
color: "secondary",
|
|
237
|
+
size: "sm",
|
|
238
|
+
className: "w-fit font-mono p-2"
|
|
239
|
+
})),
|
|
240
|
+
onClick: () => setIsJson(false),
|
|
241
|
+
type: "button",
|
|
242
|
+
children: "Close JSON Editor"
|
|
243
|
+
}), /* @__PURE__ */ jsx(JsonInput, { fieldName: "body" })] });
|
|
244
|
+
return /* @__PURE__ */ jsx(FieldSet, {
|
|
245
|
+
field,
|
|
246
|
+
fieldName: "body",
|
|
247
|
+
collapsible: false,
|
|
248
|
+
name: /* @__PURE__ */ jsx("button", {
|
|
249
|
+
type: "button",
|
|
250
|
+
className: cn(buttonVariants({
|
|
251
|
+
color: "secondary",
|
|
252
|
+
size: "sm",
|
|
253
|
+
className: "p-2"
|
|
254
|
+
})),
|
|
255
|
+
onClick: () => setIsJson(true),
|
|
256
|
+
children: "Open JSON Editor"
|
|
257
|
+
})
|
|
258
|
+
});
|
|
177
259
|
}
|
|
178
260
|
function useAuthInputs(securities, transform) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
261
|
+
const storageKeys = useStorageKey();
|
|
262
|
+
const inputs = useMemo(() => {
|
|
263
|
+
const result = [];
|
|
264
|
+
if (!securities) return result;
|
|
265
|
+
for (const security of securities) if (security.type === "http" && security.scheme === "basic") {
|
|
266
|
+
const fieldName = `header.Authorization`;
|
|
267
|
+
result.push({
|
|
268
|
+
fieldName,
|
|
269
|
+
original: security,
|
|
270
|
+
defaultValue: {
|
|
271
|
+
username: "",
|
|
272
|
+
password: ""
|
|
273
|
+
},
|
|
274
|
+
mapOutput(out) {
|
|
275
|
+
if (out && typeof out === "object") return `Basic ${btoa(`${"username" in out ? out.username : ""}:${"password" in out ? out.password : ""}`)}`;
|
|
276
|
+
return out;
|
|
277
|
+
},
|
|
278
|
+
children: /* @__PURE__ */ jsx(ObjectInput, {
|
|
279
|
+
field: {
|
|
280
|
+
type: "object",
|
|
281
|
+
properties: {
|
|
282
|
+
username: { type: "string" },
|
|
283
|
+
password: { type: "string" }
|
|
284
|
+
},
|
|
285
|
+
required: ["username", "password"]
|
|
286
|
+
},
|
|
287
|
+
fieldName
|
|
288
|
+
})
|
|
289
|
+
});
|
|
290
|
+
} else if (security.type === "oauth2") {
|
|
291
|
+
const fieldName = "header.Authorization";
|
|
292
|
+
result.push({
|
|
293
|
+
fieldName,
|
|
294
|
+
original: security,
|
|
295
|
+
defaultValue: "Bearer ",
|
|
296
|
+
children: /* @__PURE__ */ jsxs("fieldset", {
|
|
297
|
+
className: "flex flex-col gap-2",
|
|
298
|
+
children: [/* @__PURE__ */ jsx("label", {
|
|
299
|
+
htmlFor: fieldName,
|
|
300
|
+
className: cn(labelVariants()),
|
|
301
|
+
children: "Access Token"
|
|
302
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
303
|
+
className: "flex gap-2",
|
|
304
|
+
children: [/* @__PURE__ */ jsx(FieldInput, {
|
|
305
|
+
fieldName,
|
|
306
|
+
isRequired: true,
|
|
307
|
+
field: { type: "string" },
|
|
308
|
+
className: "flex-1"
|
|
309
|
+
}), /* @__PURE__ */ jsx(OauthDialogTrigger, {
|
|
310
|
+
type: "button",
|
|
311
|
+
className: cn(buttonVariants({
|
|
312
|
+
size: "sm",
|
|
313
|
+
color: "secondary"
|
|
314
|
+
})),
|
|
315
|
+
children: "Authorize"
|
|
316
|
+
})]
|
|
317
|
+
})]
|
|
318
|
+
})
|
|
319
|
+
});
|
|
320
|
+
} else if (security.type === "http") {
|
|
321
|
+
const fieldName = "header.Authorization";
|
|
322
|
+
result.push({
|
|
323
|
+
fieldName,
|
|
324
|
+
original: security,
|
|
325
|
+
defaultValue: "Bearer ",
|
|
326
|
+
children: /* @__PURE__ */ jsx(FieldSet, {
|
|
327
|
+
name: "Authorization (header)",
|
|
328
|
+
fieldName,
|
|
329
|
+
isRequired: true,
|
|
330
|
+
field: { type: "string" }
|
|
331
|
+
})
|
|
332
|
+
});
|
|
333
|
+
} else if (security.type === "apiKey") {
|
|
334
|
+
const fieldName = `${security.in}.${security.name}`;
|
|
335
|
+
result.push({
|
|
336
|
+
fieldName,
|
|
337
|
+
defaultValue: "",
|
|
338
|
+
original: security,
|
|
339
|
+
children: /* @__PURE__ */ jsx(FieldSet, {
|
|
340
|
+
fieldName,
|
|
341
|
+
name: `${security.name} (${security.in})`,
|
|
342
|
+
isRequired: true,
|
|
343
|
+
field: { type: "string" }
|
|
344
|
+
})
|
|
345
|
+
});
|
|
346
|
+
} else {
|
|
347
|
+
const fieldName = "header.Authorization";
|
|
348
|
+
result.push({
|
|
349
|
+
fieldName,
|
|
350
|
+
defaultValue: "",
|
|
351
|
+
original: security,
|
|
352
|
+
children: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(FieldSet, {
|
|
353
|
+
name: "Authorization (header)",
|
|
354
|
+
isRequired: true,
|
|
355
|
+
fieldName,
|
|
356
|
+
field: { type: "string" }
|
|
357
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
358
|
+
className: "text-fd-muted-foreground text-xs",
|
|
359
|
+
children: "OpenID Connect is not supported at the moment, you can still set an access token here."
|
|
360
|
+
})] })
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
return transform ? transform(result) : result;
|
|
364
|
+
}, [securities, transform]);
|
|
365
|
+
const mapInputs = (values) => {
|
|
366
|
+
const cloned = structuredClone(values);
|
|
367
|
+
for (const item of inputs) {
|
|
368
|
+
if (!item.mapOutput) continue;
|
|
369
|
+
set(cloned, item.fieldName, item.mapOutput(get(cloned, item.fieldName)));
|
|
370
|
+
}
|
|
371
|
+
return cloned;
|
|
372
|
+
};
|
|
373
|
+
const initAuthValues = (values) => {
|
|
374
|
+
for (const item of inputs) {
|
|
375
|
+
const stored = localStorage.getItem(storageKeys.AuthField(item));
|
|
376
|
+
if (stored) {
|
|
377
|
+
const parsed = JSON.parse(stored);
|
|
378
|
+
if (typeof parsed === typeof item.defaultValue) {
|
|
379
|
+
set(values, item.fieldName, parsed);
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
set(values, item.fieldName, item.defaultValue);
|
|
384
|
+
}
|
|
385
|
+
return values;
|
|
386
|
+
};
|
|
387
|
+
return {
|
|
388
|
+
inputs,
|
|
389
|
+
mapInputs,
|
|
390
|
+
initAuthValues
|
|
391
|
+
};
|
|
288
392
|
}
|
|
289
393
|
function Route({ route, ...props }) {
|
|
290
|
-
|
|
394
|
+
return /* @__PURE__ */ jsx("div", {
|
|
395
|
+
...props,
|
|
396
|
+
className: cn("flex flex-row items-center gap-0.5 overflow-auto text-nowrap", props.className),
|
|
397
|
+
children: route.split("/").map((part, index) => /* @__PURE__ */ jsxs(Fragment, { children: [index > 0 && /* @__PURE__ */ jsx("span", {
|
|
398
|
+
className: "text-fd-muted-foreground",
|
|
399
|
+
children: "/"
|
|
400
|
+
}), part.startsWith("{") && part.endsWith("}") ? /* @__PURE__ */ jsx("code", {
|
|
401
|
+
className: "bg-fd-primary/10 text-fd-primary",
|
|
402
|
+
children: part
|
|
403
|
+
}) : /* @__PURE__ */ jsx("code", {
|
|
404
|
+
className: "text-fd-foreground",
|
|
405
|
+
children: part
|
|
406
|
+
})] }, index))
|
|
407
|
+
});
|
|
291
408
|
}
|
|
292
|
-
function DefaultResultDisplay({ data, reset
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
409
|
+
function DefaultResultDisplay({ data, reset }) {
|
|
410
|
+
const statusInfo = useMemo(() => getStatusInfo(data.status), [data.status]);
|
|
411
|
+
const { shikiOptions } = useApiContext();
|
|
412
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
413
|
+
className: "flex flex-col gap-3 p-3",
|
|
414
|
+
children: [
|
|
415
|
+
/* @__PURE__ */ jsxs("div", {
|
|
416
|
+
className: "flex justify-between items-center",
|
|
417
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
418
|
+
className: "inline-flex items-center gap-1.5 text-sm font-medium text-fd-foreground",
|
|
419
|
+
children: [/* @__PURE__ */ jsx(statusInfo.icon, { className: cn("size-4", statusInfo.color) }), statusInfo.description]
|
|
420
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
421
|
+
type: "button",
|
|
422
|
+
className: cn(buttonVariants({ size: "icon-xs" }), "p-0 text-fd-muted-foreground hover:text-fd-accent-foreground [&_svg]:size-3.5"),
|
|
423
|
+
onClick: () => reset(),
|
|
424
|
+
"aria-label": "Dismiss response",
|
|
425
|
+
children: /* @__PURE__ */ jsx(X, {})
|
|
426
|
+
})]
|
|
427
|
+
}),
|
|
428
|
+
/* @__PURE__ */ jsx("p", {
|
|
429
|
+
className: "text-sm text-fd-muted-foreground",
|
|
430
|
+
children: data.status
|
|
431
|
+
}),
|
|
432
|
+
data.data !== void 0 && /* @__PURE__ */ jsx(DynamicCodeBlock, {
|
|
433
|
+
lang: typeof data.data === "string" && data.data.length > 5e4 ? "text" : data.type,
|
|
434
|
+
code: typeof data.data === "string" ? data.data : JSON.stringify(data.data, null, 2),
|
|
435
|
+
options: shikiOptions
|
|
436
|
+
})
|
|
437
|
+
]
|
|
438
|
+
});
|
|
300
439
|
}
|
|
301
440
|
function CollapsiblePanel({ title, children, ...props }) {
|
|
302
|
-
|
|
441
|
+
return /* @__PURE__ */ jsxs(Collapsible, {
|
|
442
|
+
...props,
|
|
443
|
+
className: "border-b last:border-b-0",
|
|
444
|
+
children: [/* @__PURE__ */ jsxs(CollapsibleTrigger, {
|
|
445
|
+
className: "group w-full flex items-center gap-2 p-3 text-sm font-medium",
|
|
446
|
+
children: [title, /* @__PURE__ */ jsx(ChevronDown, { className: "ms-auto size-3.5 text-fd-muted-foreground group-data-[state=open]:rotate-180" })]
|
|
447
|
+
}), /* @__PURE__ */ jsx(CollapsibleContent, { children: /* @__PURE__ */ jsx("div", {
|
|
448
|
+
className: "flex flex-col gap-3 p-3 pt-1",
|
|
449
|
+
children
|
|
450
|
+
}) })]
|
|
451
|
+
});
|
|
303
452
|
}
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
};
|
|
453
|
+
const Custom = { useController(props) {
|
|
454
|
+
return useController(props);
|
|
455
|
+
} };
|
|
456
|
+
|
|
457
|
+
//#endregion
|
|
458
|
+
export { Custom, PlaygroundClient as default };
|
|
459
|
+
//# sourceMappingURL=client.js.map
|