fumadocs-openapi 7.0.0 → 7.0.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/playground/client.js +4 -4
- package/dist/playground/inputs.d.ts +1 -1
- package/dist/playground/inputs.d.ts.map +1 -1
- package/dist/playground/inputs.js +3 -3
- package/dist/ui/components/input.js +2 -2
- package/dist/ui/components/select.js +1 -1
- package/dist/ui/server-select.js +1 -1
- package/package.json +9 -9
|
@@ -96,7 +96,7 @@ export function Client({ route, method = 'GET', authorization, parameters = [],
|
|
|
96
96
|
}
|
|
97
97
|
return (_jsx(FieldSet, { name: info.name, fieldName: fieldName, field: info }, key));
|
|
98
98
|
}
|
|
99
|
-
return (_jsx(FormProvider, { ...form, children: _jsx(SchemaContext.Provider, { value: useMemo(() => ({ references: references, dynamic: dynamicRef }), [references]), children: _jsx(AuthProvider, { authorization: authorization, children: _jsxs("form", { ...props, className: cn('not-prose flex flex-col
|
|
99
|
+
return (_jsx(FormProvider, { ...form, children: _jsx(SchemaContext.Provider, { value: useMemo(() => ({ references: references, dynamic: dynamicRef }), [references]), children: _jsx(AuthProvider, { authorization: authorization, children: _jsxs("form", { ...props, className: cn('not-prose flex flex-col rounded-xl border p-3 gap-3 shadow-md overflow-hidden', props.className), onSubmit: onSubmit, children: [_jsx(FormHeader, { method: method, route: route, isLoading: testQuery.isLoading }), servers.length > 1 ? (_jsx(CollapsiblePanel, { title: "Server URL", children: _jsx(ServerSelect, { server: server, onServerChanged: setServer, onVariablesChanged: setServerVariables }) })) : null, params.headers.length > 0 || authorization ? (_jsxs(CollapsiblePanel, { title: "Headers", children: [authorization ? (_jsx(AuthField, { authorization: authorization })) : null, params.headers.map((field) => renderCustomField(`header.${field.name}`, field, fields.parameter, field.name))] })) : null, params.paths.length > 0 ? (_jsx(CollapsiblePanel, { title: "Path", children: params.paths.map((field) => renderCustomField(`path.${field.name}`, field, fields.parameter, field.name)) })) : null, params.queries.length > 0 ? (_jsx(CollapsiblePanel, { title: "Query", children: params.queries.map((field) => renderCustomField(`query.${field.name}`, field, fields.parameter, field.name)) })) : null, params.cookies.length > 0 ? (_jsx(CollapsiblePanel, { title: "Cookies", children: params.cookies.map((field) => renderCustomField(`cookie.${field.name}`, field, fields.parameter, field.name)) })) : null, body ? (_jsx(CollapsiblePanel, { title: "Body", children: body.type === 'object' && !fields.body ? (_jsx(ObjectInput, { field: body, fieldName: "body" })) : (renderCustomField('body', body, fields.body)) })) : null, testQuery.data ? _jsx(ResultDisplay, { data: testQuery.data }) : null] }) }) }) }));
|
|
100
100
|
}
|
|
101
101
|
function AuthProvider({ authorization, children, }) {
|
|
102
102
|
const form = useFormContext();
|
|
@@ -134,8 +134,8 @@ function Route({ route, ...props }) {
|
|
|
134
134
|
const segments = route.split('/').filter((part) => part.length > 0);
|
|
135
135
|
return (_jsx("div", { ...props, className: cn('flex flex-row items-center gap-0.5 overflow-auto text-nowrap', props.className), children: segments.map((part, index) => (_jsxs(Fragment, { children: [_jsx("span", { className: "text-fd-muted-foreground", children: "/" }), part.startsWith('{') && part.endsWith('}') ? (_jsx("code", { className: "bg-fd-primary/10 text-fd-primary", children: part })) : (_jsx("code", { className: "text-fd-foreground", children: part }))] }, index))) }));
|
|
136
136
|
}
|
|
137
|
-
function FormHeader({ route, method, isLoading, }) {
|
|
138
|
-
return (_jsxs("div", { className:
|
|
137
|
+
function FormHeader({ route, method, isLoading, ...props }) {
|
|
138
|
+
return (_jsxs("div", { ...props, className: cn('flex flex-row items-center gap-2 text-sm', props.className), children: [_jsx(MethodLabel, { children: method }), _jsx(Route, { route: route, className: "flex-1" }), _jsx("button", { type: "submit", className: cn(buttonVariants({ color: 'primary', size: 'sm' }), 'px-3 py-1.5'), disabled: isLoading, children: "Send" })] }));
|
|
139
139
|
}
|
|
140
140
|
function DefaultResultDisplay({ data }) {
|
|
141
141
|
const statusInfo = useMemo(() => getStatusInfo(data.status), [data.status]);
|
|
@@ -179,7 +179,7 @@ function usePersistentAuthInfo(authorization) {
|
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
181
|
function CollapsiblePanel({ title, children, ...props }) {
|
|
182
|
-
return (_jsxs(Collapsible, { ...props, className: "
|
|
182
|
+
return (_jsxs(Collapsible, { ...props, className: "rounded-xl bg-fd-card border text-fd-card-foreground", children: [_jsxs(CollapsibleTrigger, { className: "group w-full inline-flex items-center gap-2 p-3 text-sm font-medium", children: [title, _jsx(ChevronDown, { className: "ms-auto size-4 text-fd-muted-foreground group-data-[state=open]:rotate-180" })] }), _jsx(CollapsibleContent, { children: _jsx("div", { className: "flex flex-col gap-3 p-3", children: children }) })] }));
|
|
183
183
|
}
|
|
184
184
|
function writeAuthHeader(authorization, input, header, query, cookie) {
|
|
185
185
|
if (authorization.type === 'apiKey') {
|
|
@@ -14,7 +14,7 @@ export declare function FieldInput({ field, fieldName, ...props }: HTMLAttribute
|
|
|
14
14
|
fieldName: string;
|
|
15
15
|
}): import("react/jsx-runtime").JSX.Element | null;
|
|
16
16
|
export declare function FieldSet({ field, fieldName, toolbar, name, ...props }: HTMLAttributes<HTMLElement> & {
|
|
17
|
-
name?:
|
|
17
|
+
name?: ReactNode;
|
|
18
18
|
field: RequestSchema;
|
|
19
19
|
fieldName: string;
|
|
20
20
|
toolbar?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../src/playground/inputs.tsx"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,cAAc,EAEnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAWf,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAMxD,KAAK,WAAW,CAAC,IAAI,IAAI,OAAO,CAAC,aAAa,EAAE;IAAE,IAAI,EAAE,IAAI,CAAA;CAAE,CAAC,CAAC;AA6BhE,wBAAgB,WAAW,CAAC,EAC1B,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE;IACD,KAAK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AC,CAAC;IACpD,SAAS,EAAE,MAAM,CAAC;CACnB,kDAmGA;AAED,wBAAgB,QAAQ,CAAC,EACvB,KAAK,EACL,SAAS,EACT,OAAO,EACP,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,WAAW,CAAC,GAAG;IAC/B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB,kDAgGA"}
|
|
@@ -102,10 +102,10 @@ export function FieldInput({ field, fieldName, ...props }) {
|
|
|
102
102
|
if (field.type === 'null')
|
|
103
103
|
return null;
|
|
104
104
|
if (field.type === 'object') {
|
|
105
|
-
return (_jsx(ObjectInput, { field: field, fieldName: fieldName, ...props, className: cn('rounded-lg border border-fd-primary/20 bg-fd-
|
|
105
|
+
return (_jsx(ObjectInput, { field: field, fieldName: fieldName, ...props, className: cn('rounded-lg border border-fd-primary/20 bg-fd-background/50 p-3 shadow-sm', props.className) }));
|
|
106
106
|
}
|
|
107
107
|
if (field.type === 'array') {
|
|
108
|
-
return (_jsx(ArrayInput, { fieldName: fieldName, field: field, ...props, className: cn('rounded-lg border border-fd-primary/20 bg-fd-background p-3 shadow-sm', props.className) }));
|
|
108
|
+
return (_jsx(ArrayInput, { fieldName: fieldName, field: field, ...props, className: cn('rounded-lg border border-fd-primary/20 bg-fd-background/50 p-3 shadow-sm', props.className) }));
|
|
109
109
|
}
|
|
110
110
|
if (field.type === 'file') {
|
|
111
111
|
return (_jsx(Controller, { control: control, name: fieldName, render: ({ field: { value: _, onChange, ...restField } }) => (_jsx("input", { id: fieldName, type: "file", multiple: false, onChange: (e) => {
|
|
@@ -172,7 +172,7 @@ function ArrayInput({ fieldName, field, ...props }) {
|
|
|
172
172
|
const { fields, append, remove } = useFieldArray({
|
|
173
173
|
name: fieldName,
|
|
174
174
|
});
|
|
175
|
-
return (_jsxs("div", { ...props, className: cn('flex flex-col gap-2', props.className), children: [fields.map((item, index) => (_jsx(FieldSet, { name:
|
|
175
|
+
return (_jsxs("div", { ...props, className: cn('flex flex-col gap-2', props.className), children: [fields.map((item, index) => (_jsx(FieldSet, { name: _jsxs("span", { className: "text-fd-muted-foreground", children: [fieldName.split('.').at(-1), "[", index, "]"] }), field: items, fieldName: `${fieldName}.${index}`, toolbar: _jsx("button", { type: "button", "aria-label": "Remove Item", className: cn(buttonVariants({
|
|
176
176
|
color: 'secondary',
|
|
177
177
|
size: 'sm',
|
|
178
178
|
})), onClick: () => {
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { cn } from 'fumadocs-ui/components/api';
|
|
4
4
|
import { cva } from 'class-variance-authority';
|
|
5
|
-
export const labelVariants = cva('text-[13px]
|
|
5
|
+
export const labelVariants = cva('text-[13px] text-fd-card-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70');
|
|
6
6
|
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
7
|
-
return (_jsx("input", { type: type, className: cn('flex h-9 w-full rounded-md border bg-
|
|
7
|
+
return (_jsx("input", { type: type, className: cn('flex h-9 w-full rounded-md border bg-fd-secondary px-2 py-1.5 text-[13px] text-fd-secondary-foreground transition-colors placeholder:text-fd-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-fd-ring disabled:cursor-not-allowed disabled:opacity-50', className), ref: ref, ...props }));
|
|
8
8
|
});
|
|
9
9
|
Input.displayName = 'Input';
|
|
10
10
|
export { Input };
|
|
@@ -6,7 +6,7 @@ import { cn } from 'fumadocs-ui/components/api';
|
|
|
6
6
|
const Select = SelectPrimitive.Root;
|
|
7
7
|
const SelectGroup = SelectPrimitive.Group;
|
|
8
8
|
const SelectValue = SelectPrimitive.Value;
|
|
9
|
-
const SelectTrigger = forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn('flex min-h-10 items-center w-full rounded-md border px-3 py-2 text-start text-[13px] text-fd-foreground hover:bg-fd-accent focus:outline-none focus:ring
|
|
9
|
+
const SelectTrigger = forwardRef(({ className, children, ...props }, ref) => (_jsxs(SelectPrimitive.Trigger, { ref: ref, className: cn('flex min-h-10 items-center w-full rounded-md border px-3 py-2 text-start text-[13px] text-fd-secondary-foreground bg-fd-secondary hover:bg-fd-accent focus:outline-none focus:ring focus:ring-fd-ring disabled:cursor-not-allowed disabled:opacity-50', className), ...props, children: [children, _jsx(SelectPrimitive.Icon, { asChild: true, children: _jsx(ChevronDown, { className: "ms-auto size-4 text-fd-muted-foreground" }) })] })));
|
|
10
10
|
SelectTrigger.displayName = SelectPrimitive.Trigger.displayName;
|
|
11
11
|
const SelectScrollUpButton = forwardRef(({ className, ...props }, ref) => (_jsx(SelectPrimitive.ScrollUpButton, { ref: ref, className: cn('flex items-center justify-center py-1', className), ...props, children: _jsx(ChevronUp, { className: "size-4" }) })));
|
|
12
12
|
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName;
|
package/dist/ui/server-select.js
CHANGED
|
@@ -11,7 +11,7 @@ export default function ServerSelect({ server, onServerChanged, onVariablesChang
|
|
|
11
11
|
const schema = server
|
|
12
12
|
? servers.find((item) => item.url === server.url)
|
|
13
13
|
: null;
|
|
14
|
-
return (_jsxs("div", { ...props, className: cn('flex flex-col gap-4', props.className), children: [_jsxs(Select, { value: server?.url, onValueChange: onServerChanged, children: [_jsx(SelectTrigger, { className: "
|
|
14
|
+
return (_jsxs("div", { ...props, className: cn('flex flex-col gap-4', props.className), children: [_jsxs(Select, { value: server?.url, onValueChange: onServerChanged, children: [_jsx(SelectTrigger, { className: "break-all", children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: servers.map((item) => (_jsxs(SelectItem, { value: item.url, children: [item.url, _jsx("p", { className: "text-start text-fd-muted-foreground", children: item.description })] }, item.url))) })] }), Object.entries(schema?.variables ?? {}).map(([key, variable]) => {
|
|
15
15
|
if (!server)
|
|
16
16
|
return;
|
|
17
17
|
const id = `fd_server_select_${key}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.0.1",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"NextJs",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@radix-ui/react-dialog": "^1.1.6",
|
|
48
48
|
"@radix-ui/react-select": "^2.1.6",
|
|
49
49
|
"@radix-ui/react-slot": "^1.1.2",
|
|
50
|
-
"@scalar/openapi-parser": "0.10.
|
|
50
|
+
"@scalar/openapi-parser": "0.10.10",
|
|
51
51
|
"ajv-draft-04": "^1.0.0",
|
|
52
52
|
"class-variance-authority": "^0.7.1",
|
|
53
53
|
"fast-glob": "^3.3.3",
|
|
@@ -55,25 +55,25 @@
|
|
|
55
55
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
56
56
|
"js-yaml": "^4.1.0",
|
|
57
57
|
"lucide-react": "^0.479.0",
|
|
58
|
-
"next-themes": "^0.4.
|
|
58
|
+
"next-themes": "^0.4.6",
|
|
59
59
|
"openapi-sampler": "^1.6.1",
|
|
60
60
|
"react-hook-form": "^7.54.2",
|
|
61
61
|
"remark": "^15.0.1",
|
|
62
62
|
"remark-rehype": "^11.1.1",
|
|
63
|
-
"shiki": "^3.1
|
|
63
|
+
"shiki": "^3.2.1",
|
|
64
64
|
"xml-js": "^1.6.11",
|
|
65
|
-
"fumadocs-core": "15.0.
|
|
66
|
-
"fumadocs-ui": "15.0.
|
|
65
|
+
"fumadocs-core": "15.0.17",
|
|
66
|
+
"fumadocs-ui": "15.0.17"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@scalar/api-client-react": "^1.1
|
|
69
|
+
"@scalar/api-client-react": "^1.2.1",
|
|
70
70
|
"@types/js-yaml": "^4.0.9",
|
|
71
71
|
"@types/node": "22.13.10",
|
|
72
72
|
"@types/openapi-sampler": "^1.0.3",
|
|
73
73
|
"@types/react": "^19.0.10",
|
|
74
|
-
"next": "15.2.
|
|
74
|
+
"next": "15.2.2",
|
|
75
75
|
"openapi-types": "^12.1.3",
|
|
76
|
-
"tailwindcss": "^4.0.
|
|
76
|
+
"tailwindcss": "^4.0.14",
|
|
77
77
|
"tsc-alias": "^1.8.11",
|
|
78
78
|
"eslint-config-custom": "0.0.0",
|
|
79
79
|
"tsconfig": "0.0.0"
|