fumadocs-openapi 5.5.11 → 5.6.1
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/index.d.ts +1 -0
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +3 -1
- package/dist/ui/{client-client-ByqJh-mB.js → client-client-CTVe6RLJ.js} +25 -3
- package/dist/ui/index.d.ts +4 -2
- package/dist/ui/index.js +23 -15
- package/dist/ui/{playground-client-BEoalWj1.js → playground-client-DEv6aEwA.js} +1 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
package/dist/server/index.d.ts
CHANGED
package/dist/server/index.js
CHANGED
|
@@ -691,7 +691,7 @@ function getSchemaType(schema, ctx) {
|
|
|
691
691
|
return 'unknown';
|
|
692
692
|
}
|
|
693
693
|
|
|
694
|
-
function Operation({ path, method, ctx, hasHead }) {
|
|
694
|
+
function Operation({ baseUrls, path, method, ctx, hasHead }) {
|
|
695
695
|
let level = 2;
|
|
696
696
|
const body = noRef(method.requestBody);
|
|
697
697
|
const security = method.security ?? ctx.document.security;
|
|
@@ -789,6 +789,7 @@ function Operation({ path, method, ctx, hasHead }) {
|
|
|
789
789
|
/*#__PURE__*/ jsx(ctx.renderer.APIInfo, {
|
|
790
790
|
method: method.method,
|
|
791
791
|
route: path,
|
|
792
|
+
baseUrls: baseUrls,
|
|
792
793
|
children: info
|
|
793
794
|
}),
|
|
794
795
|
/*#__PURE__*/ jsx(APIExample, {
|
|
@@ -1104,6 +1105,7 @@ async function APIPage(props) {
|
|
|
1104
1105
|
method: method,
|
|
1105
1106
|
path: item.path,
|
|
1106
1107
|
ctx: ctx,
|
|
1108
|
+
baseUrls: document.servers ? document.servers.map((s)=>s.url) : [],
|
|
1107
1109
|
hasHead: hasHead
|
|
1108
1110
|
}, `${item.path}:${item.method}`);
|
|
1109
1111
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { forwardRef, createElement, useContext, createContext, useState, useEffect, useMemo } from 'react';
|
|
3
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
4
|
import { cn, useCopyButton, buttonVariants } from 'fumadocs-ui/components/api';
|
|
5
5
|
import dynamic from 'next/dynamic';
|
|
6
6
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
@@ -253,7 +253,7 @@ function useSchemaContext() {
|
|
|
253
253
|
return ctx;
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
const APIPlayground = dynamic(()=>import('./playground-client-
|
|
256
|
+
const APIPlayground = dynamic(()=>import('./playground-client-DEv6aEwA.js').then((mod)=>mod.APIPlayground));
|
|
257
257
|
function Root({ children, baseUrl, className, shikiOptions, ...props }) {
|
|
258
258
|
return /*#__PURE__*/ jsx("div", {
|
|
259
259
|
className: cn('flex flex-col gap-24 text-sm text-fd-muted-foreground', className),
|
|
@@ -286,5 +286,27 @@ function CopyRouteButton({ className, route, ...props }) {
|
|
|
286
286
|
})
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
|
+
function BaseUrlSelect({ baseUrls }) {
|
|
290
|
+
const { baseUrl, setBaseUrl } = useApiContext();
|
|
291
|
+
if (baseUrls.length === 0) return null;
|
|
292
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
293
|
+
className: "flex flex-row items-center gap-1 px-1",
|
|
294
|
+
children: [
|
|
295
|
+
/*#__PURE__*/ jsx("span", {
|
|
296
|
+
className: "p-0.5 text-xs font-medium text-fd-muted-foreground",
|
|
297
|
+
children: "Server"
|
|
298
|
+
}),
|
|
299
|
+
/*#__PURE__*/ jsx("select", {
|
|
300
|
+
value: baseUrl,
|
|
301
|
+
onChange: (e)=>setBaseUrl(e.target.value),
|
|
302
|
+
className: "min-w-0 flex-1 bg-transparent font-mono text-xs text-fd-foreground outline-none",
|
|
303
|
+
children: baseUrls.map((url)=>/*#__PURE__*/ jsx("option", {
|
|
304
|
+
value: url,
|
|
305
|
+
children: url
|
|
306
|
+
}, url))
|
|
307
|
+
})
|
|
308
|
+
]
|
|
309
|
+
});
|
|
310
|
+
}
|
|
289
311
|
|
|
290
|
-
export { APIPlayground as A, CircleCheck as C, Plus as P, Root as R, SchemaContext as S, Trash2 as T, CircleX as a, ChevronDown as b, ChevronUp as c, Check as d, useApiContext as e, CopyRouteButton as f, useSchemaContext as u };
|
|
312
|
+
export { APIPlayground as A, BaseUrlSelect as B, CircleCheck as C, Plus as P, Root as R, SchemaContext as S, Trash2 as T, CircleX as a, ChevronDown as b, ChevronUp as c, Check as d, useApiContext as e, CopyRouteButton as f, useSchemaContext as u };
|
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
1
2
|
import * as react from 'react';
|
|
2
3
|
import { ReactNode, ComponentType, ReactElement, MutableRefObject, HTMLAttributes } from 'react';
|
|
3
4
|
import { FieldPath, ControllerRenderProps, ControllerFieldState, UseFormStateReturn } from 'react-hook-form';
|
|
@@ -130,6 +131,7 @@ interface ResponseProps {
|
|
|
130
131
|
interface APIInfoProps {
|
|
131
132
|
method: string;
|
|
132
133
|
route: string;
|
|
134
|
+
baseUrls: string[];
|
|
133
135
|
children: ReactNode;
|
|
134
136
|
}
|
|
135
137
|
interface PropertyProps {
|
|
@@ -230,9 +232,9 @@ declare function Root({ children, baseUrl, className, shikiOptions, ...props }:
|
|
|
230
232
|
shikiOptions: RenderContext['shikiOptions'];
|
|
231
233
|
} & HTMLAttributes<HTMLDivElement>): ReactNode;
|
|
232
234
|
|
|
233
|
-
declare function APIInfo({ children, className, route, badgeClassname, method, ...props }: APIInfoProps & HTMLAttributes<HTMLDivElement> & {
|
|
235
|
+
declare function APIInfo({ children, className, route, badgeClassname, baseUrls, method, ...props }: APIInfoProps & HTMLAttributes<HTMLDivElement> & {
|
|
234
236
|
badgeClassname?: string;
|
|
235
|
-
}):
|
|
237
|
+
}): react_jsx_runtime.JSX.Element;
|
|
236
238
|
declare function API({ children, ...props }: HTMLAttributes<HTMLDivElement>): React.ReactElement;
|
|
237
239
|
declare function Property({ name, type, required, deprecated, children, }: PropertyProps): React.ReactElement;
|
|
238
240
|
declare function APIExample(props: HTMLAttributes<HTMLDivElement>): React.ReactElement;
|
package/dist/ui/index.js
CHANGED
|
@@ -3,8 +3,8 @@ import { cn } from 'fumadocs-ui/components/api';
|
|
|
3
3
|
import { Fragment } from 'react';
|
|
4
4
|
import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
|
|
5
5
|
import { cva } from 'class-variance-authority';
|
|
6
|
-
import { f as CopyRouteButton } from './client-client-
|
|
7
|
-
export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-
|
|
6
|
+
import { f as CopyRouteButton, B as BaseUrlSelect } from './client-client-CTVe6RLJ.js';
|
|
7
|
+
export { A as APIPlayground, R as Root, u as useSchemaContext } from './client-client-CTVe6RLJ.js';
|
|
8
8
|
|
|
9
9
|
const badgeVariants = cva('rounded-xl border px-1.5 py-1 text-xs font-medium leading-[12px]', {
|
|
10
10
|
variants: {
|
|
@@ -53,26 +53,34 @@ function Route({ route }) {
|
|
|
53
53
|
}, index))
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
function APIInfo({ children, className, route, badgeClassname, method = 'GET', ...props }) {
|
|
56
|
+
function APIInfo({ children, className, route, badgeClassname, baseUrls, method = 'GET', ...props }) {
|
|
57
57
|
return /*#__PURE__*/ jsxs("div", {
|
|
58
58
|
className: cn('min-w-0 flex-1', className),
|
|
59
59
|
...props,
|
|
60
60
|
children: [
|
|
61
61
|
/*#__PURE__*/ jsxs("div", {
|
|
62
|
-
className: "sticky top-[var(--fd-api-info-top)] z-[4] mb-4
|
|
62
|
+
className: "sticky top-[var(--fd-api-info-top)] z-[4] mb-4 border-b border-fd-foreground/10 bg-fd-card/50 px-4 py-1.5 shadow-lg backdrop-blur-lg max-lg:-mx-3 max-md:-mx-4 md:rounded-xl md:border md:px-1.5",
|
|
63
63
|
children: [
|
|
64
|
-
/*#__PURE__*/
|
|
65
|
-
className:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
64
|
+
/*#__PURE__*/ jsxs("div", {
|
|
65
|
+
className: "mb-2 flex flex-row items-center gap-1.5",
|
|
66
|
+
children: [
|
|
67
|
+
/*#__PURE__*/ jsx("span", {
|
|
68
|
+
className: cn(badgeVariants({
|
|
69
|
+
color: getBadgeColor(method)
|
|
70
|
+
}), badgeClassname),
|
|
71
|
+
children: method
|
|
72
|
+
}),
|
|
73
|
+
/*#__PURE__*/ jsx(Route, {
|
|
74
|
+
route: route
|
|
75
|
+
}),
|
|
76
|
+
/*#__PURE__*/ jsx(CopyRouteButton, {
|
|
77
|
+
className: "ms-auto size-6 p-1.5",
|
|
78
|
+
route: route
|
|
79
|
+
})
|
|
80
|
+
]
|
|
72
81
|
}),
|
|
73
|
-
/*#__PURE__*/ jsx(
|
|
74
|
-
|
|
75
|
-
route: route
|
|
82
|
+
/*#__PURE__*/ jsx(BaseUrlSelect, {
|
|
83
|
+
baseUrls: baseUrls
|
|
76
84
|
})
|
|
77
85
|
]
|
|
78
86
|
}),
|
|
@@ -5,7 +5,7 @@ import { forwardRef, useId, createContext, useContext, useState, useCallback, us
|
|
|
5
5
|
import { FormProvider, Controller, useFormContext, useFieldArray, useForm, useWatch } from 'react-hook-form';
|
|
6
6
|
import { Accordions, Accordion } from 'fumadocs-ui/components/accordion';
|
|
7
7
|
import { cn, buttonVariants } from 'fumadocs-ui/components/api';
|
|
8
|
-
import { C as CircleCheck, a as CircleX, b as ChevronDown, c as ChevronUp, d as Check, u as useSchemaContext, T as Trash2, P as Plus, e as useApiContext, S as SchemaContext } from './client-client-
|
|
8
|
+
import { C as CircleCheck, a as CircleX, b as ChevronDown, c as ChevronUp, d as Check, u as useSchemaContext, T as Trash2, P as Plus, e as useApiContext, S as SchemaContext } from './client-client-CTVe6RLJ.js';
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
10
|
import { cva } from 'class-variance-authority';
|
|
11
11
|
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.1",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"remark": "^15.0.1",
|
|
46
46
|
"remark-rehype": "^11.1.1",
|
|
47
47
|
"shiki": "^1.22.2",
|
|
48
|
-
"fumadocs-
|
|
49
|
-
"fumadocs-
|
|
48
|
+
"fumadocs-core": "14.4.1",
|
|
49
|
+
"fumadocs-ui": "14.4.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/js-yaml": "^4.0.9",
|