fumadocs-openapi 12.5.5 → 12.5.7
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/css/generated/shared.css +1 -1
- package/dist/.translations/index.d.ts +6 -3
- package/dist/.translations/keys.js +6 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/generate-file.d.ts +1 -3
- package/dist/generate-file.js +3 -3
- package/dist/i18n.d.ts +1 -3
- package/dist/i18n.js +1 -2
- package/dist/index.browser.d.ts +0 -2
- package/dist/index.browser.js +1 -2
- package/dist/node_modules/.pnpm/fast-content-type-parse@4.0.1/node_modules/fast-content-type-parse/index.js +1 -2
- package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/array-helper.js +1 -2
- package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/js2xml.js +1 -2
- package/dist/node_modules/.pnpm/xml-js@1.6.11/node_modules/xml-js/lib/options-helper.js +1 -2
- package/dist/operation.d.ts +1 -3
- package/dist/operation.js +3 -4
- package/dist/packages/shared-api/dist/.translations/index.d.ts +2 -5
- package/dist/packages/shared-api/dist/.translations/keys.js +2 -2
- package/dist/packages/shared-api/dist/auto-anchor/index.js +1 -2
- package/dist/packages/shared-api/dist/codegen.d.ts +0 -3
- package/dist/packages/shared-api/dist/codegen.js +1 -2
- package/dist/packages/shared-api/dist/components/badge.js +1 -2
- package/dist/packages/shared-api/dist/components/collapsible.js +1 -2
- package/dist/packages/shared-api/dist/components/copy-typescript.js +1 -2
- package/dist/packages/shared-api/dist/components/defaults.d.ts +1 -4
- package/dist/packages/shared-api/dist/components/defaults.js +1 -2
- package/dist/packages/shared-api/dist/components/dialog.js +1 -2
- package/dist/packages/shared-api/dist/components/example.js +3 -3
- package/dist/packages/shared-api/dist/components/playground/fields.js +28 -10
- package/dist/packages/shared-api/dist/components/playground/json-editor.js +1 -2
- package/dist/packages/shared-api/dist/components/playground/panels.js +2 -3
- package/dist/packages/shared-api/dist/components/playground/param-input.js +1 -2
- package/dist/packages/shared-api/dist/components/playground/result.js +1 -2
- package/dist/packages/shared-api/dist/components/playground/schema.js +1 -2
- package/dist/packages/shared-api/dist/components/playground/server-select.js +2 -3
- package/dist/packages/shared-api/dist/components/schema/client.d.ts +1 -4
- package/dist/packages/shared-api/dist/components/schema/client.js +3 -2
- package/dist/packages/shared-api/dist/components/schema/index.d.ts +0 -3
- package/dist/packages/shared-api/dist/components/schema/index.js +1 -2
- package/dist/packages/shared-api/dist/components/segmented.js +1 -2
- package/dist/packages/shared-api/dist/components/select-tab.js +1 -2
- package/dist/packages/shared-api/dist/components/select.js +1 -2
- package/dist/packages/shared-api/dist/components/spinner.js +1 -2
- package/dist/packages/shared-api/dist/i18n.js +1 -2
- package/dist/packages/shared-api/dist/source.d.ts +1 -4
- package/dist/packages/shared-api/dist/source.js +1 -2
- package/dist/packages/shared-api/dist/utils/document-cache.js +1 -2
- package/dist/packages/shared-api/dist/utils/id-to-title.js +1 -2
- package/dist/packages/shared-api/dist/utils/is-plain-object.js +1 -2
- package/dist/packages/shared-api/dist/utils/url.js +1 -2
- package/dist/packages/shared-api/dist/utils/use-query.js +1 -2
- package/dist/packages/shared-api/dist/utils/use-server-store.js +1 -2
- package/dist/playground/auth.d.ts +8 -8
- package/dist/playground/auth.js +90 -59
- package/dist/playground/fetcher.d.ts +1 -3
- package/dist/playground/fetcher.js +1 -2
- package/dist/playground/use-playground.d.ts +1 -3
- package/dist/playground/use-playground.js +3 -4
- package/dist/requests/generators/all.d.ts +1 -3
- package/dist/requests/generators/all.js +1 -2
- package/dist/requests/generators/csharp.d.ts +1 -3
- package/dist/requests/generators/csharp.js +1 -2
- package/dist/requests/generators/curl.d.ts +1 -3
- package/dist/requests/generators/curl.js +1 -2
- package/dist/requests/generators/go.d.ts +1 -3
- package/dist/requests/generators/go.js +1 -2
- package/dist/requests/generators/index.d.ts +1 -3
- package/dist/requests/generators/index.js +1 -2
- package/dist/requests/generators/java.d.ts +1 -3
- package/dist/requests/generators/java.js +1 -2
- package/dist/requests/generators/javascript.d.ts +1 -3
- package/dist/requests/generators/javascript.js +1 -2
- package/dist/requests/generators/python.d.ts +1 -3
- package/dist/requests/generators/python.js +1 -2
- package/dist/requests/generators/rust.d.ts +1 -3
- package/dist/requests/generators/rust.js +1 -2
- package/dist/requests/media/adapter.d.ts +0 -2
- package/dist/requests/media/adapter.js +1 -2
- package/dist/requests/media/encode.d.ts +1 -3
- package/dist/requests/media/encode.js +1 -2
- package/dist/requests/media/resolve-adapter.d.ts +1 -3
- package/dist/requests/media/resolve-adapter.js +1 -2
- package/dist/requests/string-utils.js +1 -2
- package/dist/requests/types.d.ts +1 -3
- package/dist/server/index.d.ts +0 -2
- package/dist/server/index.js +1 -2
- package/dist/server/oauth.d.ts +1 -3
- package/dist/server/oauth.js +7 -11
- package/dist/server/proxy.d.ts +0 -2
- package/dist/server/proxy.js +8 -4
- package/dist/types/openapi.d.ts +1 -3
- package/dist/types.d.ts +1 -3
- package/dist/ui/base.d.ts +1 -3
- package/dist/ui/base.js +1 -2
- package/dist/ui/components/codeblock.js +1 -2
- package/dist/ui/components/endpoint.js +1 -2
- package/dist/ui/components/heading.js +1 -2
- package/dist/ui/components/markdown.js +1 -2
- package/dist/ui/components/method-label.js +1 -2
- package/dist/ui/components/schema.js +1 -2
- package/dist/ui/index.d.ts +0 -2
- package/dist/ui/index.js +1 -2
- package/dist/ui/operation/index.js +29 -16
- package/dist/ui/operation/usage-tabs.js +13 -6
- package/dist/ui/playground/client.d.ts +5 -4
- package/dist/ui/playground/client.js +5 -6
- package/dist/ui/playground/components/auth.js +4 -5
- package/dist/ui/playground/components/request-panel.d.ts +8 -0
- package/dist/ui/playground/components/request-panel.js +17 -11
- package/dist/ui/playground/components/response-panel.js +1 -2
- package/dist/ui/playground/components/result-display.d.ts +1 -3
- package/dist/ui/playground/components/result-display.js +1 -2
- package/dist/ui/playground/components/server-select.js +1 -2
- package/dist/ui/playground/components/url-bar.js +1 -2
- package/dist/ui/scalar/client.js +1 -2
- package/dist/ui/scalar/index.d.ts +1 -3
- package/dist/ui/scalar/index.js +1 -2
- package/dist/utils/create-page.d.ts +1 -3
- package/dist/utils/create-page.js +2 -4
- package/dist/utils/document/dereference.d.ts +1 -3
- package/dist/utils/document/dereference.js +1 -2
- package/dist/utils/document/load.js +1 -2
- package/dist/utils/get-example-requests.js +2 -3
- package/dist/utils/pages/builder.d.ts +0 -2
- package/dist/utils/pages/builder.js +1 -2
- package/dist/utils/pages/preset-auto.d.ts +0 -2
- package/dist/utils/pages/preset-auto.js +1 -2
- package/dist/utils/pages/to-static-data.d.ts +1 -3
- package/dist/utils/pages/to-static-data.js +1 -2
- package/dist/utils/pages/to-text.d.ts +1 -3
- package/dist/utils/pages/to-text.js +1 -2
- package/dist/utils/schema.js +1 -2
- package/dist/utils/use-server.d.ts +2 -4
- package/dist/utils/use-server.js +3 -3
- package/package.json +3 -3
package/dist/server/proxy.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/server/proxy.d.ts
|
|
2
1
|
declare const methods: readonly ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD'];
|
|
3
2
|
type Handler = (req: Request) => Promise<Response>;
|
|
4
3
|
type OriginMatcher = string | RegExp;
|
|
@@ -30,5 +29,4 @@ export interface CreateProxyOptions {
|
|
|
30
29
|
};
|
|
31
30
|
}
|
|
32
31
|
export declare function createProxy(options?: CreateProxyOptions): Proxy;
|
|
33
|
-
//#endregion
|
|
34
32
|
export {};
|
package/dist/server/proxy.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/server/proxy.ts
|
|
2
2
|
const methods = [
|
|
3
3
|
"GET",
|
|
4
4
|
"POST",
|
|
@@ -61,6 +61,7 @@ function createProxy(options = {}) {
|
|
|
61
61
|
let method = initial.method;
|
|
62
62
|
let url = new URL(initial.url);
|
|
63
63
|
const headers = new Headers(initial.headers);
|
|
64
|
+
headers.delete("content-length");
|
|
64
65
|
let body = initial.body && methodsWithBody.has(method.toUpperCase()) ? await initial.arrayBuffer() : void 0;
|
|
65
66
|
for (let redirects = 0; redirects <= maxRedirects; redirects++) {
|
|
66
67
|
const response = await send(url, {
|
|
@@ -87,7 +88,6 @@ function createProxy(options = {}) {
|
|
|
87
88
|
case 303:
|
|
88
89
|
method = "GET";
|
|
89
90
|
body = void 0;
|
|
90
|
-
headers.delete("content-length");
|
|
91
91
|
headers.delete("content-type");
|
|
92
92
|
}
|
|
93
93
|
url = next;
|
|
@@ -171,8 +171,13 @@ let publicFetch;
|
|
|
171
171
|
*/
|
|
172
172
|
async function createPublicFetch() {
|
|
173
173
|
if ("Bun" in globalThis) throw new ProxyError("Private networks cannot be blocked on Bun, specify `allowedOrigins`.", 500);
|
|
174
|
+
const key = Symbol.for("undici.globalDispatcher.1");
|
|
175
|
+
const builtin = Reflect.get(globalThis, key);
|
|
174
176
|
const [{ Agent, fetch }, dns, { BlockList, isIP }] = await Promise.all([
|
|
175
|
-
import("undici")
|
|
177
|
+
import("undici").then((undici) => {
|
|
178
|
+
Reflect.set(globalThis, key, builtin);
|
|
179
|
+
return undici;
|
|
180
|
+
}),
|
|
176
181
|
import("node:dns"),
|
|
177
182
|
import("node:net")
|
|
178
183
|
]);
|
|
@@ -196,5 +201,4 @@ async function createPublicFetch() {
|
|
|
196
201
|
});
|
|
197
202
|
};
|
|
198
203
|
}
|
|
199
|
-
//#endregion
|
|
200
204
|
export { createProxy };
|
package/dist/types/openapi.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/types/openapi.d.ts
|
|
2
1
|
/** Original copy: https://github.com/scalar/scalar/blob/main/packages/openapi-types/src/openapi-types.ts
|
|
3
2
|
* - Removed Record<string, unknown> fallbacks
|
|
4
3
|
*/
|
|
@@ -897,5 +896,4 @@ export type IJsonSchema = {
|
|
|
897
896
|
oneOf?: IJsonSchema[];
|
|
898
897
|
not?: IJsonSchema;
|
|
899
898
|
$ref?: string;
|
|
900
|
-
};
|
|
901
|
-
//#endregion
|
|
899
|
+
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { OpenAPIV3, OpenAPIV3_2 } from "./types/openapi.js";
|
|
2
2
|
import { InlineCodeUsageGenerator } from "./requests/generators/index.js";
|
|
3
|
-
//#region src/types.d.ts
|
|
4
3
|
export type Document = OpenAPIV3_2.Document;
|
|
5
4
|
export type OperationObject = OpenAPIV3_2.OperationObject & {
|
|
6
5
|
'x-codeSamples'?: InlineCodeUsageGenerator[];
|
|
@@ -23,5 +22,4 @@ export type ExampleObject = OpenAPIV3_2.ExampleObject;
|
|
|
23
22
|
export type MediaTypeObject = OpenAPIV3_2.MediaTypeObject;
|
|
24
23
|
export type RequestBodyObject = OpenAPIV3_2.RequestBodyObject;
|
|
25
24
|
export type DistributiveOmit<T, K extends PropertyKey> = T extends unknown ? Omit<T, K> : never;
|
|
26
|
-
export type Awaitable<T> = T | Promise<T>;
|
|
27
|
-
//#endregion
|
|
25
|
+
export type Awaitable<T> = T | Promise<T>;
|
package/dist/ui/base.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { OpenAPIPageProps } from "../utils/pages/builder.js";
|
|
2
2
|
import { CreateOpenAPIPageOptions } from "./index.js";
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
//#region src/ui/base.d.ts
|
|
5
4
|
/**
|
|
6
5
|
* Create `<OpenAPIPage />` (a client component) without the full Shiki bundle.
|
|
7
6
|
*/
|
|
8
|
-
export declare function createOpenAPIPageBase(options: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare function createOpenAPIPageBase(options: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
|
package/dist/ui/base.js
CHANGED
|
@@ -3,7 +3,7 @@ import { createRenderer } from "../utils/create-page.js";
|
|
|
3
3
|
import { Schema } from "../packages/shared-api/dist/components/schema/index.js";
|
|
4
4
|
import { Operation } from "./operation/index.js";
|
|
5
5
|
import { jsxs } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/ui/base.tsx
|
|
7
7
|
/**
|
|
8
8
|
* Create `<OpenAPIPage />` (a client component) without the full Shiki bundle.
|
|
9
9
|
*/
|
|
@@ -24,5 +24,4 @@ function Layout({ operations, webhooks }) {
|
|
|
24
24
|
children: [operations?.map((item) => item.children), webhooks?.map((item) => item.children)]
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { createOpenAPIPageBase };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useComponents } from "../../utils/create-page.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/ui/components/codeblock.tsx
|
|
5
5
|
function ClientCodeBlock(props) {
|
|
6
6
|
const { CodeBlock } = useComponents();
|
|
7
7
|
return /* @__PURE__ */ jsx(CodeBlock, { ...props });
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { ClientCodeBlock };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { MethodLabel } from "./method-label.js";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/ui/components/endpoint.tsx
|
|
5
5
|
function EndpointBar({ method, route, deprecated = false, children, ...props }) {
|
|
6
6
|
return /* @__PURE__ */ jsxs("div", {
|
|
7
7
|
...props,
|
|
@@ -36,5 +36,4 @@ function Route({ route, ...props }) {
|
|
|
36
36
|
})
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
|
-
//#endregion
|
|
40
39
|
export { EndpointBar };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useComponents } from "../../utils/create-page.js";
|
|
3
3
|
import { useAnchorId } from "../../packages/shared-api/dist/auto-anchor/index.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
5
|
+
// src/ui/components/heading.tsx
|
|
6
6
|
/**
|
|
7
7
|
* A heading of the page, `id` is resolved against the anchor sections it is under.
|
|
8
8
|
*/
|
|
@@ -13,5 +13,4 @@ function Heading({ id, ...props }) {
|
|
|
13
13
|
...props
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
|
-
//#endregion
|
|
17
16
|
export { Heading };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useComponents } from "../../utils/create-page.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
|
|
4
|
+
// src/ui/components/markdown.tsx
|
|
5
5
|
function Markdown({ md }) {
|
|
6
6
|
const { Markdown: Comp } = useComponents();
|
|
7
7
|
return /* @__PURE__ */ jsx(Comp, { md });
|
|
8
8
|
}
|
|
9
|
-
//#endregion
|
|
10
9
|
export { Markdown };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Badge } from "../../packages/shared-api/dist/components/badge.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/ui/components/method-label.tsx
|
|
4
4
|
function getMethodColor(method) {
|
|
5
5
|
switch (method.toUpperCase()) {
|
|
6
6
|
case "PUT": return "yellow";
|
|
@@ -17,5 +17,4 @@ function MethodLabel({ children, ...props }) {
|
|
|
17
17
|
children: children.toUpperCase()
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { MethodLabel };
|
|
@@ -3,7 +3,7 @@ import { useComponents, useRenderContext } from "../../utils/create-page.js";
|
|
|
3
3
|
import { useAnchorId } from "../../packages/shared-api/dist/auto-anchor/index.js";
|
|
4
4
|
import { useMemo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
-
|
|
6
|
+
// src/ui/components/schema.tsx
|
|
7
7
|
/**
|
|
8
8
|
* The Schema UI of the page, with the anchor ID of the root schema resolved.
|
|
9
9
|
*/
|
|
@@ -24,5 +24,4 @@ function SchemaUI({ client, ...props }) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { SchemaUI };
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { OpenAPIPageProps, OpenAPIPageProps_Preloaded, OpenAPIPageProps_Spec } from "../utils/pages/builder.js";
|
|
2
2
|
import { CreateOpenAPIRendererOptions } from "../utils/create-page.js";
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
//#region src/ui/index.d.ts
|
|
5
4
|
export interface CreateOpenAPIPageOptions extends Omit<CreateOpenAPIRendererOptions, 'components'> {
|
|
6
5
|
/**
|
|
7
6
|
* Replace parts of the UI, e.g. the ones installed with Fumadocs CLI.
|
|
@@ -12,5 +11,4 @@ export interface CreateOpenAPIPageOptions extends Omit<CreateOpenAPIRendererOpti
|
|
|
12
11
|
* Create `<OpenAPIPage />` (a client component).
|
|
13
12
|
*/
|
|
14
13
|
export declare function createOpenAPIPage(options?: CreateOpenAPIPageOptions): FC<OpenAPIPageProps>;
|
|
15
|
-
//#endregion
|
|
16
14
|
export type { OpenAPIPageProps, OpenAPIPageProps_Preloaded, OpenAPIPageProps_Spec };
|
package/dist/ui/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { createOpenAPIPageBase } from "./base.js";
|
|
3
3
|
import { defaultShikiFactory } from "fumadocs-core/highlight/shiki/full";
|
|
4
|
-
|
|
4
|
+
// src/ui/index.tsx
|
|
5
5
|
/**
|
|
6
6
|
* Create `<OpenAPIPage />` (a client component).
|
|
7
7
|
*/
|
|
@@ -11,5 +11,4 @@ function createOpenAPIPage(options = {}) {
|
|
|
11
11
|
shiki: options.shiki ?? defaultShikiFactory
|
|
12
12
|
});
|
|
13
13
|
}
|
|
14
|
-
//#endregion
|
|
15
14
|
export { createOpenAPIPage };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { OperationProvider, useOperation } from "../../operation.js";
|
|
3
2
|
import { useOpenAPI, useRenderContext } from "../../utils/create-page.js";
|
|
3
|
+
import { OperationProvider, useOperation } from "../../operation.js";
|
|
4
4
|
import { Badge } from "../../packages/shared-api/dist/components/badge.js";
|
|
5
5
|
import { MethodLabel } from "../components/method-label.js";
|
|
6
6
|
import { Markdown } from "../components/markdown.js";
|
|
@@ -11,18 +11,18 @@ import { SchemaUI } from "../components/schema.js";
|
|
|
11
11
|
import { SelectTab, SelectTabTrigger, SelectTabs } from "../../packages/shared-api/dist/components/select-tab.js";
|
|
12
12
|
import { Heading } from "../components/heading.js";
|
|
13
13
|
import { CopyTypeScript } from "../../packages/shared-api/dist/components/copy-typescript.js";
|
|
14
|
-
import { Segmented, SegmentedList, SegmentedPanel } from "../../packages/shared-api/dist/components/segmented.js";
|
|
15
14
|
import { EndpointBar } from "../components/endpoint.js";
|
|
15
|
+
import { Segmented, SegmentedList, SegmentedPanel } from "../../packages/shared-api/dist/components/segmented.js";
|
|
16
16
|
import { DialogPopup } from "../../packages/shared-api/dist/components/dialog.js";
|
|
17
|
-
import
|
|
18
|
-
import { Fragment, useState } from "react";
|
|
17
|
+
import { Fragment, Suspense, lazy, useState } from "react";
|
|
19
18
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
20
19
|
import { useTranslations } from "@fuma-translate/react";
|
|
21
20
|
import { ChevronRight, Plus, X } from "lucide-react";
|
|
22
21
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
23
22
|
import { Dialog } from "@base-ui/react/dialog";
|
|
24
23
|
import { Callout } from "fumadocs-ui/components/callout";
|
|
25
|
-
|
|
24
|
+
// src/ui/operation/index.tsx
|
|
25
|
+
const PlaygroundClient = lazy(() => import("../playground/client.js"));
|
|
26
26
|
function Operation({ type, path, method, operation, pathItem, ...props }) {
|
|
27
27
|
return /* @__PURE__ */ jsx(OperationProvider, {
|
|
28
28
|
type,
|
|
@@ -88,7 +88,10 @@ function OperationContent({ showTitle, showDescription, headingLevel = 2 }) {
|
|
|
88
88
|
children: /* @__PURE__ */ jsx(MediaContent, {
|
|
89
89
|
schema: content.schema,
|
|
90
90
|
required: requestBody.required,
|
|
91
|
-
selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
91
|
+
selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
92
|
+
"aria-label": t("Media type"),
|
|
93
|
+
items
|
|
94
|
+
}),
|
|
92
95
|
request: true
|
|
93
96
|
})
|
|
94
97
|
}, mediaType))
|
|
@@ -153,7 +156,10 @@ function OperationContent({ showTitle, showDescription, headingLevel = 2 }) {
|
|
|
153
156
|
className: "overflow-hidden rounded-xl border bg-fd-card",
|
|
154
157
|
children: [/* @__PURE__ */ jsx("div", {
|
|
155
158
|
className: "flex h-9 items-center border-b ps-1.5 pe-1 text-[0.8125rem] not-prose",
|
|
156
|
-
children: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
159
|
+
children: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
160
|
+
"aria-label": t("Security scheme"),
|
|
161
|
+
items
|
|
162
|
+
})
|
|
157
163
|
}), security.map((requirement, i) => /* @__PURE__ */ jsx(SelectTab, {
|
|
158
164
|
value: items[i].value,
|
|
159
165
|
className: "px-3",
|
|
@@ -179,7 +185,12 @@ function OperationContent({ showTitle, showDescription, headingLevel = 2 }) {
|
|
|
179
185
|
})] });
|
|
180
186
|
if (type === "operation") {
|
|
181
187
|
const playground = ctx.playground;
|
|
182
|
-
|
|
188
|
+
const endpoint = /* @__PURE__ */ jsx(EndpointBar, {
|
|
189
|
+
method,
|
|
190
|
+
route: path,
|
|
191
|
+
deprecated: operation.deprecated
|
|
192
|
+
});
|
|
193
|
+
let apiPlayground = endpoint;
|
|
183
194
|
if (playground?.enabled ?? true) {
|
|
184
195
|
const { enabled: _, render, ...options } = playground ?? {};
|
|
185
196
|
apiPlayground = render ? render({
|
|
@@ -187,12 +198,11 @@ function OperationContent({ showTitle, showDescription, headingLevel = 2 }) {
|
|
|
187
198
|
method,
|
|
188
199
|
operation,
|
|
189
200
|
pathItem
|
|
190
|
-
}) : /* @__PURE__ */ jsx(
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
});
|
|
201
|
+
}) : /* @__PURE__ */ jsx(Suspense, {
|
|
202
|
+
fallback: endpoint,
|
|
203
|
+
children: /* @__PURE__ */ jsx(PlaygroundClient, { ...options })
|
|
204
|
+
});
|
|
205
|
+
}
|
|
196
206
|
const slots = {
|
|
197
207
|
header: headNode,
|
|
198
208
|
description: descriptionNode,
|
|
@@ -326,6 +336,7 @@ function ResponseSection({ responses, headingLevel }) {
|
|
|
326
336
|
});
|
|
327
337
|
}
|
|
328
338
|
function ResponseContent({ item: { status, response, content }, onLink }) {
|
|
339
|
+
const t = useTranslations({ note: "operation page" });
|
|
329
340
|
const segments = ["response", status];
|
|
330
341
|
const ref = useAnchorLink(segments, onLink);
|
|
331
342
|
const contentTypes = Object.entries(content);
|
|
@@ -348,7 +359,10 @@ function ResponseContent({ item: { status, response, content }, onLink }) {
|
|
|
348
359
|
anchorSegments: [mediaType],
|
|
349
360
|
children: /* @__PURE__ */ jsx(MediaContent, {
|
|
350
361
|
schema: media.schema,
|
|
351
|
-
selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
362
|
+
selector: /* @__PURE__ */ jsx(SelectTabTrigger, {
|
|
363
|
+
"aria-label": t("Media type"),
|
|
364
|
+
items
|
|
365
|
+
})
|
|
352
366
|
})
|
|
353
367
|
}, mediaType))]
|
|
354
368
|
})
|
|
@@ -496,5 +510,4 @@ function Callback({ item, path, headingLevel }) {
|
|
|
496
510
|
})]
|
|
497
511
|
});
|
|
498
512
|
}
|
|
499
|
-
//#endregion
|
|
500
513
|
export { Operation };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useCodeUsage, useExampleRequests, useOperation, useResponseExamples } from "../../operation.js";
|
|
3
2
|
import { useOpenAPI, useRenderContext } from "../../utils/create-page.js";
|
|
3
|
+
import { useCodeUsage, useExampleRequests, useOperation, useResponseExamples } from "../../operation.js";
|
|
4
4
|
import { MethodLabel } from "../components/method-label.js";
|
|
5
5
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../packages/shared-api/dist/components/select.js";
|
|
6
6
|
import { ExampleHeader, ExampleSelect, captionCodeBlock, cardCodeBlock, exampleActions, exampleCardClassName, exampleCodeBlock, selectCodeUsage, useCodeUsageId } from "../../packages/shared-api/dist/components/example.js";
|
|
@@ -12,7 +12,7 @@ import { getRaw } from "@scalar/json-magic/magic-proxy";
|
|
|
12
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useTranslations } from "@fuma-translate/react";
|
|
14
14
|
import { Switch } from "@base-ui/react/switch";
|
|
15
|
-
|
|
15
|
+
// src/ui/operation/usage-tabs.tsx
|
|
16
16
|
function UsageTabs() {
|
|
17
17
|
const ctx = useRenderContext();
|
|
18
18
|
const t = useTranslations({ note: "operation page" });
|
|
@@ -38,6 +38,7 @@ function UsageTabs() {
|
|
|
38
38
|
});
|
|
39
39
|
}
|
|
40
40
|
function UsageTabsSelector() {
|
|
41
|
+
const t = useTranslations({ note: "operation page" });
|
|
41
42
|
const { items, selected, select } = useExampleRequests();
|
|
42
43
|
function renderItem(item) {
|
|
43
44
|
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
@@ -58,6 +59,7 @@ function UsageTabsSelector() {
|
|
|
58
59
|
value: selected,
|
|
59
60
|
onValueChange: (v) => v !== null && select(v),
|
|
60
61
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
62
|
+
"aria-label": t("Example request"),
|
|
61
63
|
className: "not-prose mb-4 rounded-xl bg-fd-card px-3",
|
|
62
64
|
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
63
65
|
}), /* @__PURE__ */ jsx(SelectContent, { children: options.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
@@ -69,6 +71,7 @@ function UsageTabsSelector() {
|
|
|
69
71
|
const storageKey = "fumadocs_openapi_requests";
|
|
70
72
|
/** the code usages of the selected example request, with a select of their languages */
|
|
71
73
|
function CodeUsages({ title, selectExample = false, className, viewportClassName }) {
|
|
74
|
+
const t = useTranslations({ note: "operation page" });
|
|
72
75
|
const generators = useOperation().codeUsages.map();
|
|
73
76
|
const examples = useExampleRequests();
|
|
74
77
|
const selected = useCodeUsageId(storageKey);
|
|
@@ -92,13 +95,15 @@ function CodeUsages({ title, selectExample = false, className, viewportClassName
|
|
|
92
95
|
})),
|
|
93
96
|
value: example.id,
|
|
94
97
|
onValueChange: examples.select,
|
|
98
|
+
"aria-label": t("Example request"),
|
|
95
99
|
align: "start",
|
|
96
100
|
className: "-ms-2 max-w-full text-fd-foreground"
|
|
97
101
|
}) : title,
|
|
98
102
|
Actions: exampleActions(/* @__PURE__ */ jsx(ExampleSelect, {
|
|
99
103
|
items,
|
|
100
104
|
value: id,
|
|
101
|
-
onValueChange: (value) => selectCodeUsage(storageKey, value)
|
|
105
|
+
onValueChange: (value) => selectCodeUsage(storageKey, value),
|
|
106
|
+
"aria-label": t("Code language")
|
|
102
107
|
})),
|
|
103
108
|
className: cn(exampleCodeBlock.className, className),
|
|
104
109
|
viewportProps: { className: viewportClassName }
|
|
@@ -143,6 +148,7 @@ function ResponseTabsDefaultContent({ tabs }) {
|
|
|
143
148
|
})),
|
|
144
149
|
value: String(index),
|
|
145
150
|
onValueChange: (v) => setIndex(Number(v)),
|
|
151
|
+
"aria-label": t("Example"),
|
|
146
152
|
align: "start",
|
|
147
153
|
className: "-ms-2"
|
|
148
154
|
}), example.description && /* @__PURE__ */ jsx("div", {
|
|
@@ -183,7 +189,8 @@ function ResponseTabsDefaultContent({ tabs }) {
|
|
|
183
189
|
onValueChange: (v) => {
|
|
184
190
|
setCode(v);
|
|
185
191
|
setIndex(0);
|
|
186
|
-
}
|
|
192
|
+
},
|
|
193
|
+
"aria-label": t("Response status")
|
|
187
194
|
})]
|
|
188
195
|
}), body]
|
|
189
196
|
});
|
|
@@ -226,7 +233,8 @@ function RequestTabsDefaultContent() {
|
|
|
226
233
|
label: item.id === "_default" ? t("Default") : item.name
|
|
227
234
|
})),
|
|
228
235
|
value: item.id,
|
|
229
|
-
onValueChange: select
|
|
236
|
+
onValueChange: select,
|
|
237
|
+
"aria-label": t("Example request")
|
|
230
238
|
})
|
|
231
239
|
}),
|
|
232
240
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -266,5 +274,4 @@ function RequestTabsDefaultContent() {
|
|
|
266
274
|
]
|
|
267
275
|
});
|
|
268
276
|
}
|
|
269
|
-
//#endregion
|
|
270
277
|
export { CodeUsages, RequestTabs, UsageTabs };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ParameterObject } from "../../types.js";
|
|
2
2
|
import { DefaultResultDisplay, ResultDisplayProps } from "./components/result-display.js";
|
|
3
3
|
import { PlaygroundOptions, RequestBodyInfo } from "../../playground/use-playground.js";
|
|
4
|
+
import { ParameterFieldContext } from "./components/request-panel.js";
|
|
4
5
|
import { ComponentProps, FC, ReactNode } from "react";
|
|
5
6
|
import { FieldKey } from "@fumari/stf";
|
|
6
|
-
//#region src/ui/playground/client.d.ts
|
|
7
7
|
export interface PlaygroundClientProps extends ComponentProps<'div'>, PlaygroundClientOptions {
|
|
8
8
|
/** @deprecated it defaults to `true` for requests */
|
|
9
9
|
writeOnly?: boolean;
|
|
@@ -25,12 +25,14 @@ export interface PlaygroundClientOptions extends PlaygroundOptions {
|
|
|
25
25
|
/**
|
|
26
26
|
* render the parameter inputs of API endpoint, return `undefined` to keep the default input of a parameter.
|
|
27
27
|
*
|
|
28
|
+
* `ctx.renderDefault(schema)` renders the default input with another schema, like an `enum` of values loaded at runtime.
|
|
29
|
+
*
|
|
28
30
|
* for updating values, use:
|
|
29
31
|
* - the `Custom.useController()` from `fumadocs-openapi/ui/playground/client`.
|
|
30
32
|
*
|
|
31
33
|
* Recommended types packages: `json-schema-typed`.
|
|
32
34
|
*/
|
|
33
|
-
renderParameterField?: (fieldName: FieldKey, param: ParameterObject) => ReactNode;
|
|
35
|
+
renderParameterField?: (fieldName: FieldKey, param: ParameterObject, ctx: ParameterFieldContext) => ReactNode;
|
|
34
36
|
/**
|
|
35
37
|
* render the input for API endpoint body.
|
|
36
38
|
*
|
|
@@ -47,5 +49,4 @@ export declare const Custom: {
|
|
|
47
49
|
setValue: (newValue: unknown) => boolean;
|
|
48
50
|
};
|
|
49
51
|
};
|
|
50
|
-
|
|
51
|
-
export { DefaultResultDisplay, type ResultDisplayProps };
|
|
52
|
+
export { DefaultResultDisplay, type ParameterFieldContext, type ResultDisplayProps };
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useExampleRequests, useOperation } from "../../operation.js";
|
|
3
2
|
import { useOpenAPI } from "../../utils/create-page.js";
|
|
3
|
+
import { useExampleRequests, useOperation } from "../../operation.js";
|
|
4
4
|
import { usePlayground } from "../../playground/use-playground.js";
|
|
5
5
|
import { Markdown } from "../components/markdown.js";
|
|
6
6
|
import { cn } from "../../utils/cn.js";
|
|
7
|
+
import { EndpointBar } from "../components/endpoint.js";
|
|
8
|
+
import { DialogPopup, PlaygroundTrigger } from "../../packages/shared-api/dist/components/dialog.js";
|
|
7
9
|
import { SchemaProvider } from "../../packages/shared-api/dist/components/playground/schema.js";
|
|
8
10
|
import { RequestExampleSelect, ViewSwitch, iconButtonClassName } from "../../packages/shared-api/dist/components/playground/panels.js";
|
|
9
11
|
import { DefaultResultDisplay } from "./components/result-display.js";
|
|
10
|
-
import { EndpointBar } from "../components/endpoint.js";
|
|
11
|
-
import { DialogPopup, PlaygroundTrigger } from "../../packages/shared-api/dist/components/dialog.js";
|
|
12
12
|
import { UrlBar } from "./components/url-bar.js";
|
|
13
13
|
import { builtinAuthProviders } from "./components/auth.js";
|
|
14
14
|
import { RequestPanel } from "./components/request-panel.js";
|
|
15
15
|
import { ResponsePanel } from "./components/response-panel.js";
|
|
16
16
|
import { useMemo, useState } from "react";
|
|
17
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
-
import { StfProvider, useFieldValue } from "@fumari/stf";
|
|
19
18
|
import { useTranslations } from "@fuma-translate/react";
|
|
19
|
+
import { StfProvider, useFieldValue } from "@fumari/stf";
|
|
20
20
|
import { X } from "lucide-react";
|
|
21
21
|
import { Dialog } from "@base-ui/react/dialog";
|
|
22
22
|
import { useOnChange } from "fumadocs-core/utils/use-on-change";
|
|
23
|
-
|
|
23
|
+
// src/ui/playground/client.tsx
|
|
24
24
|
function PlaygroundClient({ writeOnly = true, readOnly = false, authProviders, transformAuthInputs, fetchOptions, components, renderParameterField, renderBodyField, ...rest }) {
|
|
25
25
|
const { doc } = useOpenAPI();
|
|
26
26
|
const { path, method, operation } = useOperation();
|
|
@@ -162,5 +162,4 @@ const Custom = { useController(fieldName, options) {
|
|
|
162
162
|
setValue
|
|
163
163
|
};
|
|
164
164
|
} };
|
|
165
|
-
//#endregion
|
|
166
165
|
export { Custom, DefaultResultDisplay, PlaygroundClient as default };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useServer } from "../../../utils/use-server.js";
|
|
3
|
-
import { useQuery } from "../../../packages/shared-api/dist/utils/use-query.js";
|
|
4
|
-
import { finishOAuthFlow, requestOAuthToken, useAuthRedirect, useOpenIdConnectFlows } from "../../../playground/auth.js";
|
|
5
3
|
import { useOpenAPI } from "../../../utils/create-page.js";
|
|
4
|
+
import { finishOAuthFlow, requestOAuthToken, useAuthRedirect, useOpenIdConnectFlows } from "../../../playground/auth.js";
|
|
6
5
|
import { Markdown } from "../../components/markdown.js";
|
|
7
6
|
import { cn } from "../../../utils/cn.js";
|
|
8
7
|
import { Spinner } from "../../../packages/shared-api/dist/components/spinner.js";
|
|
9
8
|
import { CheckRow, SelectRow, TextRow, ValueRow } from "../../../packages/shared-api/dist/components/playground/fields.js";
|
|
10
9
|
import { iconButtonClassName } from "../../../packages/shared-api/dist/components/playground/panels.js";
|
|
10
|
+
import { useQuery } from "../../../packages/shared-api/dist/utils/use-query.js";
|
|
11
11
|
import { Suspense, useEffect, useRef, useState } from "react";
|
|
12
12
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { StfProvider, useDataEngine, useStf } from "@fumari/stf";
|
|
14
13
|
import { useTranslations } from "@fuma-translate/react";
|
|
14
|
+
import { StfProvider, useDataEngine, useStf } from "@fumari/stf";
|
|
15
15
|
import { Check, Copy, ExternalLink, ShieldCheck } from "lucide-react";
|
|
16
16
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
17
17
|
import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
|
|
18
|
-
|
|
18
|
+
// src/ui/playground/components/auth.tsx
|
|
19
19
|
/** the rows of OAuth and mutual TLS schemes in the built-in UI, after the providers of page */
|
|
20
20
|
const builtinAuthProviders = [{
|
|
21
21
|
on: ({ scheme }) => scheme.type === "oauth2" || scheme.type === "openIdConnect",
|
|
@@ -351,5 +351,4 @@ function DeviceVerification({ code, onCancel }) {
|
|
|
351
351
|
})]
|
|
352
352
|
})] });
|
|
353
353
|
}
|
|
354
|
-
//#endregion
|
|
355
354
|
export { builtinAuthProviders };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import "../../../playground/use-playground.js";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { JsonSchema } from "@fumadocs/json-schema";
|
|
4
|
+
import { FieldKey } from "@fumari/stf";
|
|
5
|
+
export interface ParameterFieldContext {
|
|
6
|
+
/** the default input of parameter, `schema` replaces its schema, like an `enum` of values loaded at runtime */
|
|
7
|
+
renderDefault: (schema?: JsonSchema) => ReactNode;
|
|
8
|
+
}
|
|
@@ -9,10 +9,10 @@ import { Crumb, FieldPanel, OverviewLayer, Panel, PanelNav, Section, useFieldSta
|
|
|
9
9
|
import { JsonEditor } from "../../../packages/shared-api/dist/components/playground/json-editor.js";
|
|
10
10
|
import { Fragment, createContext, use, useState } from "react";
|
|
11
11
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
12
|
-
import { stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
13
12
|
import { useTranslations } from "@fuma-translate/react";
|
|
13
|
+
import { stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
14
14
|
import { Braces, Cookie, KeyRound, PlusIcon, Route, Rows3, SlidersHorizontal } from "lucide-react";
|
|
15
|
-
|
|
15
|
+
// src/ui/playground/components/request-panel.tsx
|
|
16
16
|
const sectionIcons = {
|
|
17
17
|
path: Route,
|
|
18
18
|
query: SlidersHorizontal,
|
|
@@ -101,14 +101,21 @@ function Overview({ auth, body, sectionNames, onNavigate, onAuthorize, renderPar
|
|
|
101
101
|
title: sectionNames[type],
|
|
102
102
|
count: items.length,
|
|
103
103
|
children: items.map((param, i) => {
|
|
104
|
-
const
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
const renderDefault = (schema) => {
|
|
105
|
+
const entry = schema === void 0 ? entries[i] : {
|
|
106
|
+
...entries[i],
|
|
107
|
+
schema
|
|
108
|
+
};
|
|
109
|
+
const siblings = schema === void 0 ? entries : entries.map((item, index) => index === i ? entry : item);
|
|
110
|
+
return /* @__PURE__ */ jsx(FieldRow, {
|
|
111
|
+
entry,
|
|
112
|
+
required: param.required,
|
|
113
|
+
description: param.description,
|
|
114
|
+
onNavigate: () => onNavigate(entry, siblings)
|
|
115
|
+
});
|
|
116
|
+
};
|
|
117
|
+
const custom = renderParameterField?.(entries[i].fieldName, param, { renderDefault });
|
|
118
|
+
return /* @__PURE__ */ jsx(Fragment, { children: custom === void 0 ? renderDefault() : custom }, param.name);
|
|
112
119
|
})
|
|
113
120
|
}, type);
|
|
114
121
|
}),
|
|
@@ -236,5 +243,4 @@ function BodySection({ body, renderBodyField, onNavigate }) {
|
|
|
236
243
|
children: content
|
|
237
244
|
});
|
|
238
245
|
}
|
|
239
|
-
//#endregion
|
|
240
246
|
export { RequestPanel };
|
|
@@ -12,7 +12,7 @@ import { useState } from "react";
|
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
13
|
import { useTranslations } from "@fuma-translate/react";
|
|
14
14
|
import { SendHorizontal } from "lucide-react";
|
|
15
|
-
|
|
15
|
+
// src/ui/playground/components/response-panel.tsx
|
|
16
16
|
function ResponsePanel({ response, loading, onReset, ResultDisplay = DefaultResultDisplay, className }) {
|
|
17
17
|
const t = useTranslations({ note: "playground" });
|
|
18
18
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -100,5 +100,4 @@ function ResponseExamples() {
|
|
|
100
100
|
]
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
|
-
//#endregion
|
|
104
103
|
export { ResponsePanel };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { FetchResult } from "../../../playground/fetcher.js";
|
|
2
2
|
import { ComponentProps } from "react";
|
|
3
|
-
//#region src/ui/playground/components/result-display.d.ts
|
|
4
3
|
export interface ResultDisplayProps extends ComponentProps<'div'> {
|
|
5
4
|
data: FetchResult;
|
|
6
5
|
reset: () => void;
|
|
7
6
|
}
|
|
8
|
-
export declare function DefaultResultDisplay({ data, reset, ...rest }: ResultDisplayProps): import("react").JSX.Element;
|
|
9
|
-
//#endregion
|
|
7
|
+
export declare function DefaultResultDisplay({ data, reset, ...rest }: ResultDisplayProps): import("react").JSX.Element;
|
|
@@ -6,7 +6,7 @@ import { useCallback, useMemo } from "react";
|
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { useTranslations } from "@fuma-translate/react";
|
|
8
8
|
import { DownloadIcon, FileIcon } from "lucide-react";
|
|
9
|
-
|
|
9
|
+
// src/ui/playground/components/result-display.tsx
|
|
10
10
|
function DefaultResultDisplay({ data, reset, ...rest }) {
|
|
11
11
|
if (data.type === "client_error") return /* @__PURE__ */ jsx(RequestError, {
|
|
12
12
|
...rest,
|
|
@@ -109,5 +109,4 @@ function TextResult({ lang, data }) {
|
|
|
109
109
|
codeblock: panelCodeBlock
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
|
-
//#endregion
|
|
113
112
|
export { DefaultResultDisplay };
|
|
@@ -4,7 +4,7 @@ import { cn } from "../../../utils/cn.js";
|
|
|
4
4
|
import { ServerPopover, ServerVariables } from "../../../packages/shared-api/dist/components/playground/server-select.js";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useTranslations } from "@fuma-translate/react";
|
|
7
|
-
|
|
7
|
+
// src/ui/playground/components/server-select.tsx
|
|
8
8
|
/** the base URL of requests, selects the server and edits its variables */
|
|
9
9
|
function ServerSelect({ className }) {
|
|
10
10
|
const { servers, server, resolveUrl, setServer, setServerVariables } = useServer();
|
|
@@ -39,5 +39,4 @@ function ServerSelect({ className }) {
|
|
|
39
39
|
}, server.url)
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
|
-
//#endregion
|
|
43
42
|
export { ServerSelect as default };
|