fumadocs-openapi 12.1.1 → 12.2.0
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 +62 -17
- package/dist/.translations/keys.js +62 -17
- package/dist/operation.d.ts +6 -1
- package/dist/operation.js +2 -4
- package/dist/packages/shared-api/dist/components/select.js +8 -7
- package/dist/playground/auth.d.ts +5 -1
- package/dist/playground/auth.js +7 -2
- package/dist/playground/fetcher.d.ts +8 -0
- package/dist/playground/fetcher.js +30 -1
- package/dist/playground/index.d.ts +2 -1
- package/dist/playground/index.js +2 -1
- package/dist/playground/use-playground.d.ts +62 -0
- package/dist/playground/use-playground.js +140 -0
- package/dist/ui/components/endpoint.js +37 -0
- package/dist/ui/operation/index.js +6 -14
- package/dist/ui/playground/client.d.ts +9 -26
- package/dist/ui/playground/client.js +149 -389
- package/dist/ui/playground/components/fields.js +693 -0
- package/dist/ui/playground/components/oauth-panel.js +182 -0
- package/dist/ui/playground/components/request-panel.js +480 -0
- package/dist/ui/playground/components/response-panel.js +150 -0
- package/dist/ui/playground/components/result-display.d.ts +1 -0
- package/dist/ui/playground/components/result-display.js +185 -168
- package/dist/ui/playground/components/segmented.js +21 -0
- package/dist/ui/playground/components/server-select.js +100 -89
- package/dist/ui/playground/components/url-bar.js +96 -0
- package/dist/ui/playground/status-info.js +32 -45
- package/dist/utils/document/load.js +1 -1
- package/package.json +10 -10
- package/dist/packages/shared-api/dist/components/collapsible.d.ts +0 -7
- package/dist/packages/shared-api/dist/components/collapsible.js +0 -16
- package/dist/packages/shared-api/dist/components/dialog.js +0 -55
- package/dist/packages/shared-api/dist/components/input.js +0 -14
- package/dist/packages/shared-api/dist/components/label.js +0 -11
- package/dist/packages/shared-api/dist/components/playground/inputs.js +0 -439
- package/dist/ui/playground/components/oauth-dialog.js +0 -259
|
@@ -2,128 +2,139 @@
|
|
|
2
2
|
import { useServer } from "../../../utils/use-server.js";
|
|
3
3
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../../../packages/shared-api/dist/components/select.js";
|
|
4
4
|
import { cn } from "../../../utils/cn.js";
|
|
5
|
-
import {
|
|
6
|
-
import { Input } from "../../../packages/shared-api/dist/components/input.js";
|
|
7
|
-
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from "../../../packages/shared-api/dist/components/dialog.js";
|
|
8
|
-
import { useRef, useState, useSyncExternalStore } from "react";
|
|
5
|
+
import { useRef, useState } from "react";
|
|
9
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
7
|
import { StfProvider, useFieldValue, useListener, useStf } from "@fumari/stf";
|
|
11
8
|
import { useTranslations } from "@fuma-translate/react";
|
|
12
|
-
import {
|
|
9
|
+
import { Popover } from "@base-ui/react/popover";
|
|
10
|
+
import { Check, ChevronDown } from "lucide-react";
|
|
13
11
|
//#region src/ui/playground/components/server-select.tsx
|
|
14
|
-
|
|
15
|
-
function ServerSelect(
|
|
12
|
+
/** the base URL of requests, selects the server and edits its variables */
|
|
13
|
+
function ServerSelect({ className }) {
|
|
16
14
|
const { servers, server, resolveUrl, setServer, setServerVariables } = useServer();
|
|
17
15
|
const [open, setOpen] = useState(false);
|
|
18
|
-
const isMounted = useSyncExternalStore(noop, () => true, () => false);
|
|
19
16
|
const t = useTranslations({ note: "playground server select" });
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
const base = resolveUrl().replace(/\/$/, "");
|
|
18
|
+
if (!servers || servers.length === 0) return /* @__PURE__ */ jsx("span", {
|
|
19
|
+
className: cn("truncate ps-1.5 text-fd-muted-foreground", className),
|
|
20
|
+
children: base
|
|
21
|
+
});
|
|
22
|
+
const serverSchema = server ? servers.find((item) => item.url === server.url) : void 0;
|
|
23
|
+
return /* @__PURE__ */ jsxs(Popover.Root, {
|
|
23
24
|
open,
|
|
24
25
|
onOpenChange: setOpen,
|
|
25
|
-
children: [/* @__PURE__ */ jsxs(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
26
|
+
children: [/* @__PURE__ */ jsxs(Popover.Trigger, {
|
|
27
|
+
className: cn("group flex min-w-0 shrink items-center gap-1 rounded-lg px-1.5 py-1 text-fd-muted-foreground transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring data-popup-open:bg-fd-accent data-popup-open:text-fd-accent-foreground", className),
|
|
28
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
29
|
+
className: "truncate",
|
|
30
|
+
children: base
|
|
31
|
+
}), /* @__PURE__ */ jsx(ChevronDown, { className: "size-3 shrink-0 transition-transform duration-200 group-data-popup-open:rotate-180" })]
|
|
32
|
+
}), /* @__PURE__ */ jsx(Popover.Portal, { children: /* @__PURE__ */ jsx(Popover.Positioner, {
|
|
33
|
+
side: "bottom",
|
|
34
|
+
align: "start",
|
|
35
|
+
sideOffset: 8,
|
|
36
|
+
className: "z-50",
|
|
37
|
+
children: /* @__PURE__ */ jsxs(Popover.Popup, {
|
|
38
|
+
className: "flex max-h-(--available-height) w-[min(26rem,calc(100vw-2rem))] origin-(--transform-origin) flex-col overflow-y-auto rounded-xl border bg-fd-popover p-1 text-sm text-fd-popover-foreground shadow-lg transition-[opacity,scale] duration-150 ease-out outline-none data-ending-style:scale-95 data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0",
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ jsx("p", {
|
|
41
|
+
className: "px-2.5 pt-1.5 pb-1 text-xs font-medium text-fd-muted-foreground",
|
|
42
|
+
children: t("Server URL")
|
|
43
|
+
}),
|
|
44
|
+
servers.map((item) => {
|
|
45
|
+
const selected = item.url === server?.url;
|
|
46
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
47
|
+
type: "button",
|
|
48
|
+
"aria-pressed": selected,
|
|
49
|
+
onClick: () => {
|
|
50
|
+
setServer(item.url);
|
|
51
|
+
if (!item.variables) setOpen(false);
|
|
52
|
+
},
|
|
53
|
+
className: "flex w-full items-start gap-2 rounded-lg px-2.5 py-2 text-start transition-colors hover:bg-fd-accent hover:text-fd-accent-foreground focus-visible:bg-fd-accent focus-visible:outline-none",
|
|
54
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
55
|
+
className: "min-w-0 flex-1",
|
|
56
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
57
|
+
className: "block font-mono text-[0.8125rem] break-all",
|
|
58
|
+
children: item.url
|
|
59
|
+
}), item.description && /* @__PURE__ */ jsx("span", {
|
|
60
|
+
className: "mt-0.5 block text-xs text-fd-muted-foreground",
|
|
61
|
+
children: item.description
|
|
62
|
+
})]
|
|
63
|
+
}), selected && /* @__PURE__ */ jsx(Check, { className: "mt-0.5 size-3.5 shrink-0 text-fd-primary" })]
|
|
64
|
+
}, item.url);
|
|
65
|
+
}),
|
|
66
|
+
server?.variables && serverSchema?.variables && /* @__PURE__ */ jsx(ServerVariables, {
|
|
67
|
+
defaultValues: server.variables,
|
|
68
|
+
schema: serverSchema.variables,
|
|
69
|
+
onChange: setServerVariables
|
|
70
|
+
}, server.url)
|
|
71
|
+
]
|
|
72
|
+
})
|
|
73
|
+
}) })]
|
|
68
74
|
});
|
|
69
75
|
}
|
|
70
|
-
function
|
|
76
|
+
function ServerVariables({ defaultValues, onChange, schema }) {
|
|
77
|
+
const t = useTranslations({ note: "playground server select" });
|
|
71
78
|
const stf = useStf({ defaultValues: () => structuredClone(defaultValues) });
|
|
72
79
|
const timerRef = useRef(null);
|
|
73
80
|
useListener({
|
|
74
81
|
stf,
|
|
75
82
|
onUpdate() {
|
|
76
83
|
if (timerRef.current !== null) window.clearTimeout(timerRef.current);
|
|
77
|
-
timerRef.current = window.setTimeout(() => onChange(stf.dataEngine.getData()),
|
|
84
|
+
timerRef.current = window.setTimeout(() => onChange(stf.dataEngine.getData()), 300);
|
|
78
85
|
}
|
|
79
86
|
});
|
|
80
87
|
return /* @__PURE__ */ jsx(StfProvider, {
|
|
81
88
|
value: stf,
|
|
82
|
-
children: /* @__PURE__ */
|
|
83
|
-
className: "flex flex-col gap-
|
|
84
|
-
children:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
89
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
90
|
+
className: "mt-1 flex flex-col gap-2.5 border-t px-2.5 pt-2.5 pb-2",
|
|
91
|
+
children: [/* @__PURE__ */ jsx("p", {
|
|
92
|
+
className: "text-xs font-medium text-fd-muted-foreground",
|
|
93
|
+
children: t("Variables")
|
|
94
|
+
}), Object.entries(schema).map(([key, variable]) => /* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: "grid grid-cols-[minmax(0,2fr)_minmax(0,3fr)] items-center gap-3",
|
|
96
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
97
|
+
htmlFor: `server-${key}`,
|
|
98
|
+
className: "min-w-0",
|
|
99
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
100
|
+
className: "block truncate font-mono text-[0.8125rem]",
|
|
101
|
+
children: key
|
|
102
|
+
}), variable.description && /* @__PURE__ */ jsx("span", {
|
|
103
|
+
className: "block text-xs text-fd-muted-foreground",
|
|
104
|
+
children: variable.description
|
|
105
|
+
})]
|
|
106
|
+
}), /* @__PURE__ */ jsx(VariableInput, {
|
|
107
|
+
fieldName: key,
|
|
108
|
+
variable
|
|
109
|
+
})]
|
|
110
|
+
}, key))]
|
|
103
111
|
})
|
|
104
112
|
});
|
|
105
113
|
}
|
|
106
|
-
function
|
|
114
|
+
function VariableInput({ fieldName, variable }) {
|
|
107
115
|
const t = useTranslations({ note: "playground server select" });
|
|
116
|
+
const id = `server-${fieldName}`;
|
|
108
117
|
const [value, setValue] = useFieldValue([fieldName], { compute(currentValue) {
|
|
109
118
|
return typeof currentValue === "string" ? currentValue : void 0;
|
|
110
119
|
} });
|
|
111
120
|
if (variable.enum) return /* @__PURE__ */ jsxs(Select, {
|
|
112
|
-
value,
|
|
113
|
-
onValueChange: setValue,
|
|
121
|
+
value: value ?? null,
|
|
122
|
+
onValueChange: (v) => v !== null && setValue(v),
|
|
114
123
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
115
|
-
id
|
|
124
|
+
id,
|
|
125
|
+
className: "h-8 py-1 text-[0.8125rem]",
|
|
116
126
|
children: /* @__PURE__ */ jsx(SelectValue, {})
|
|
117
|
-
}), /* @__PURE__ */ jsx(SelectContent, { children: variable.enum.map((
|
|
118
|
-
value,
|
|
119
|
-
children:
|
|
120
|
-
},
|
|
127
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: variable.enum.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
128
|
+
value: item,
|
|
129
|
+
children: item
|
|
130
|
+
}, item)) })]
|
|
121
131
|
});
|
|
122
|
-
return /* @__PURE__ */ jsx(
|
|
123
|
-
id
|
|
124
|
-
value,
|
|
132
|
+
return /* @__PURE__ */ jsx("input", {
|
|
133
|
+
id,
|
|
134
|
+
value: value ?? "",
|
|
125
135
|
onChange: (e) => setValue(e.target.value),
|
|
126
|
-
placeholder: t("Enter Value")
|
|
136
|
+
placeholder: t("Enter Value"),
|
|
137
|
+
className: "h-8 w-full rounded-md border bg-fd-secondary px-2 font-mono text-[0.8125rem] text-fd-secondary-foreground outline-none placeholder:text-fd-muted-foreground focus-visible:ring-2 focus-visible:ring-fd-ring"
|
|
127
138
|
});
|
|
128
139
|
}
|
|
129
140
|
//#endregion
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { MethodLabel } from "../../components/method-label.js";
|
|
3
|
+
import { cn } from "../../../utils/cn.js";
|
|
4
|
+
import { useResolvedSchema } from "../../../packages/shared-api/dist/components/playground/schema.js";
|
|
5
|
+
import { Spinner } from "../../../packages/shared-api/dist/components/spinner.js";
|
|
6
|
+
import ServerSelect from "./server-select.js";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useFieldValue } from "@fumari/stf";
|
|
9
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
10
|
+
import { SendHorizontal } from "lucide-react";
|
|
11
|
+
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
12
|
+
//#region src/ui/playground/components/url-bar.tsx
|
|
13
|
+
function UrlBar({ method, route, parameters, deprecated = false, loading }) {
|
|
14
|
+
const t = useTranslations({ note: "playground" });
|
|
15
|
+
const isMac = typeof navigator !== "undefined" && /Mac|iPhone|iPad/.test(navigator.userAgent);
|
|
16
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
17
|
+
className: "flex items-center gap-2",
|
|
18
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
19
|
+
className: "flex h-10 min-w-0 flex-1 items-center gap-1.5 rounded-xl border bg-fd-card ps-1 pe-2 text-[0.8125rem]",
|
|
20
|
+
children: [/* @__PURE__ */ jsx(MethodLabel, {
|
|
21
|
+
className: "shrink-0 rounded-lg bg-current/10 px-2 py-1 text-xs",
|
|
22
|
+
children: method
|
|
23
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
24
|
+
className: "flex min-w-0 flex-1 items-center overflow-x-auto font-mono [scrollbar-width:none]",
|
|
25
|
+
children: [/* @__PURE__ */ jsx(ServerSelect, { className: "min-w-16" }), /* @__PURE__ */ jsx("div", {
|
|
26
|
+
className: cn("flex shrink-0 items-center whitespace-pre text-fd-foreground", deprecated && "line-through"),
|
|
27
|
+
children: route.split(/(\{[^}]+\})/).map((part, i) => {
|
|
28
|
+
if (!part.startsWith("{") || !part.endsWith("}")) return part;
|
|
29
|
+
const name = part.slice(1, -1);
|
|
30
|
+
return /* @__PURE__ */ jsx(PathParam, {
|
|
31
|
+
name,
|
|
32
|
+
param: parameters.find((p) => p.name === name)
|
|
33
|
+
}, i);
|
|
34
|
+
})
|
|
35
|
+
})]
|
|
36
|
+
})]
|
|
37
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
38
|
+
type: "submit",
|
|
39
|
+
disabled: loading,
|
|
40
|
+
className: cn(buttonVariants({ variant: "primary" }), "h-10 shrink-0 gap-2 rounded-xl px-4 transition-[background-color,scale] active:scale-[0.97] disabled:opacity-80 motion-reduce:transition-none"),
|
|
41
|
+
children: [
|
|
42
|
+
loading ? /* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }) : /* @__PURE__ */ jsx(SendHorizontal, { className: "size-3.5" }),
|
|
43
|
+
t("Send"),
|
|
44
|
+
/* @__PURE__ */ jsxs("kbd", {
|
|
45
|
+
className: "hidden font-sans text-xs text-fd-primary-foreground/60 sm:inline",
|
|
46
|
+
children: [isMac ? "⌘" : "Ctrl", " ↵"]
|
|
47
|
+
})
|
|
48
|
+
]
|
|
49
|
+
})]
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function PathParam({ name, param }) {
|
|
53
|
+
const schema = useResolvedSchema(param?.schema ?? true);
|
|
54
|
+
const [value, setValue] = useFieldValue(["path", name]);
|
|
55
|
+
const text = value == null ? "" : String(value);
|
|
56
|
+
const className = "mx-px rounded-md bg-fd-primary/10 px-1.5 py-0.5 text-fd-primary outline-none transition-colors placeholder:text-fd-primary/50 hover:bg-fd-primary/15 focus-visible:bg-fd-primary/15 focus-visible:ring-2 focus-visible:ring-fd-primary/30";
|
|
57
|
+
if (schema.enum && schema.enum.length > 0) {
|
|
58
|
+
const options = schema.enum;
|
|
59
|
+
return /* @__PURE__ */ jsxs("select", {
|
|
60
|
+
"aria-label": name,
|
|
61
|
+
title: param?.description,
|
|
62
|
+
value: String(options.indexOf(value)),
|
|
63
|
+
onChange: (e) => setValue(options[Number(e.target.value)]),
|
|
64
|
+
className: cn(className, "cursor-pointer appearance-none"),
|
|
65
|
+
children: [/* @__PURE__ */ jsx("option", {
|
|
66
|
+
value: "-1",
|
|
67
|
+
disabled: true,
|
|
68
|
+
className: "bg-fd-popover text-fd-popover-foreground",
|
|
69
|
+
children: name
|
|
70
|
+
}), options.map((item, i) => /* @__PURE__ */ jsx("option", {
|
|
71
|
+
value: i,
|
|
72
|
+
className: "bg-fd-popover text-fd-popover-foreground",
|
|
73
|
+
children: String(item)
|
|
74
|
+
}, i))]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const isNumber = schema.type === "integer" || schema.type === "number";
|
|
78
|
+
return /* @__PURE__ */ jsx("input", {
|
|
79
|
+
"aria-label": name,
|
|
80
|
+
title: param?.description,
|
|
81
|
+
value: text,
|
|
82
|
+
placeholder: name,
|
|
83
|
+
autoComplete: "off",
|
|
84
|
+
spellCheck: false,
|
|
85
|
+
inputMode: isNumber ? "decimal" : void 0,
|
|
86
|
+
onChange: (e) => {
|
|
87
|
+
const v = e.target.value;
|
|
88
|
+
if (v.length === 0) setValue(void 0);
|
|
89
|
+
else setValue(isNumber && !Number.isNaN(Number(v)) ? Number(v) : v);
|
|
90
|
+
},
|
|
91
|
+
style: { width: `calc(${Math.max(text.length, name.length, 1)}ch + 0.75rem)` },
|
|
92
|
+
className
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
//#endregion
|
|
96
|
+
export { UrlBar };
|
|
@@ -1,52 +1,39 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
1
|
import { useTranslations } from "@fuma-translate/react";
|
|
3
|
-
import { CircleCheck, CircleX } from "lucide-react";
|
|
4
2
|
//#region src/ui/playground/status-info.tsx
|
|
5
3
|
function useStatusInfo(status) {
|
|
6
4
|
const t = useTranslations({ note: "playground status info" });
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
if (status >= 400) return {
|
|
41
|
-
description: t("Error"),
|
|
42
|
-
color: "text-red-500",
|
|
43
|
-
icon: CircleX
|
|
44
|
-
};
|
|
45
|
-
return {
|
|
46
|
-
color: "text-fd-muted-foreground",
|
|
47
|
-
icon: CircleX
|
|
48
|
-
};
|
|
49
|
-
}, [t, status]);
|
|
5
|
+
const descriptions = {
|
|
6
|
+
200: t("OK"),
|
|
7
|
+
201: t("Created"),
|
|
8
|
+
202: t("Accepted"),
|
|
9
|
+
204: t("No Content"),
|
|
10
|
+
301: t("Moved Permanently"),
|
|
11
|
+
302: t("Found"),
|
|
12
|
+
304: t("Not Modified"),
|
|
13
|
+
400: t("Bad Request"),
|
|
14
|
+
401: t("Unauthorized"),
|
|
15
|
+
403: t("Forbidden"),
|
|
16
|
+
404: t("Not Found"),
|
|
17
|
+
405: t("Method Not Allowed"),
|
|
18
|
+
409: t("Conflict"),
|
|
19
|
+
422: t("Unprocessable Content"),
|
|
20
|
+
429: t("Too Many Requests"),
|
|
21
|
+
500: t("Internal Server Error"),
|
|
22
|
+
502: t("Bad Gateway"),
|
|
23
|
+
503: t("Service Unavailable")
|
|
24
|
+
};
|
|
25
|
+
if (status >= 200 && status < 300) return {
|
|
26
|
+
color: "bg-green-500",
|
|
27
|
+
description: descriptions[status] ?? t("Successful")
|
|
28
|
+
};
|
|
29
|
+
if (status >= 300 && status < 400) return {
|
|
30
|
+
color: "bg-blue-500",
|
|
31
|
+
description: descriptions[status] ?? t("Redirect")
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
color: status >= 400 && status < 500 ? "bg-amber-500" : "bg-red-500",
|
|
35
|
+
description: descriptions[status] ?? t("Error")
|
|
36
|
+
};
|
|
50
37
|
}
|
|
51
38
|
//#endregion
|
|
52
39
|
export { useStatusInfo };
|
|
@@ -6,7 +6,7 @@ import { bundle } from "@fumadocs/json-schema/bundle";
|
|
|
6
6
|
*/
|
|
7
7
|
async function loadDocument(input) {
|
|
8
8
|
try {
|
|
9
|
-
return { bundled: await bundle(input, { transform: (document) => typeof document === "object" && document !== null ? upgrade(document, "3.2") : document }) };
|
|
9
|
+
return { bundled: await bundle(input, { transform: (document) => typeof document === "object" && document !== null ? upgrade(document, "3.2", { onIncompatible: "ignore" }) : document }) };
|
|
10
10
|
} catch (e) {
|
|
11
11
|
throw new Error(`[OpenAPI] Failed to resolve input: ${input}`, { cause: e });
|
|
12
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fumadocs-openapi",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.2.0",
|
|
4
4
|
"description": "Generate MDX docs for your OpenAPI spec",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Docs",
|
|
@@ -57,29 +57,29 @@
|
|
|
57
57
|
"@fumadocs/json-schema": "0.2.0",
|
|
58
58
|
"@fumari/json-schema-ts": "^1.0.2",
|
|
59
59
|
"@fumari/stf": "1.1.1",
|
|
60
|
-
"@scalar/json-magic": "^0.
|
|
61
|
-
"@scalar/openapi-upgrader": "^0.
|
|
60
|
+
"@scalar/json-magic": "^0.15.4",
|
|
61
|
+
"@scalar/openapi-upgrader": "^0.4.1",
|
|
62
62
|
"chokidar": "^5.0.0",
|
|
63
63
|
"class-variance-authority": "^0.7.1",
|
|
64
|
-
"cn": "^0.
|
|
64
|
+
"cn": "^0.4.0",
|
|
65
65
|
"github-slugger": "^2.0.0",
|
|
66
66
|
"hast-util-to-jsx-runtime": "^2.3.6",
|
|
67
|
-
"lucide-react": "^1.
|
|
67
|
+
"lucide-react": "^1.50.0",
|
|
68
68
|
"remark": "^15.0.1",
|
|
69
69
|
"remark-rehype": "^11.1.2",
|
|
70
|
-
"shiki": "^4.
|
|
70
|
+
"shiki": "^4.5.0",
|
|
71
71
|
"yaml": "^2.9.1"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@scalar/api-client-react": "^2.0.
|
|
74
|
+
"@scalar/api-client-react": "^2.0.54",
|
|
75
75
|
"@tailwindcss/oxide": "^4.3.3",
|
|
76
|
-
"@types/node": "26.6.
|
|
76
|
+
"@types/node": "26.6.4",
|
|
77
77
|
"@types/react": "^19.3.0",
|
|
78
78
|
"@types/react-dom": "^19.3.0",
|
|
79
79
|
"fast-content-type-parse": "^4.0.0",
|
|
80
80
|
"fuma-cli": "^0.3.1",
|
|
81
|
-
"fumadocs-core": "16.
|
|
82
|
-
"fumadocs-ui": "npm:@fumadocs/base-ui@16.
|
|
81
|
+
"fumadocs-core": "16.16.0",
|
|
82
|
+
"fumadocs-ui": "npm:@fumadocs/base-ui@16.16.0",
|
|
83
83
|
"json-schema-typed": "^8.0.2",
|
|
84
84
|
"shared-api": "0.2.10",
|
|
85
85
|
"tsconfig": "0.0.0",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
2
|
-
import { Collapsible } from "@base-ui/react/collapsible";
|
|
3
|
-
//#region ../shared-api/dist/components/collapsible.d.ts
|
|
4
|
-
//#region src/components/collapsible.d.ts
|
|
5
|
-
declare const Collapsible$1: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").CollapsibleRootProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
|
-
//#endregion
|
|
7
|
-
export { Collapsible$1 as Collapsible };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
import { Collapsible } from "@base-ui/react/collapsible";
|
|
5
|
-
//#region ../shared-api/dist/components/collapsible.js
|
|
6
|
-
const Collapsible$1 = Collapsible.Root;
|
|
7
|
-
const CollapsibleTrigger = Collapsible.Trigger;
|
|
8
|
-
function CollapsibleContent({ children, className, ...props }) {
|
|
9
|
-
return /* @__PURE__ */ jsx(Collapsible.Panel, {
|
|
10
|
-
...props,
|
|
11
|
-
className: (s) => cn("overflow-hidden [&[hidden]:not([hidden='until-found'])]:hidden h-(--collapsible-panel-height) transition-[height,opacity] data-starting-style:opacity-0 data-starting-style:h-0 data-ending-style:h-0 data-ending-style:opacity-0", typeof className === "function" ? className(s) : className),
|
|
12
|
-
children
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
//#endregion
|
|
16
|
-
export { Collapsible$1 as Collapsible, CollapsibleContent, CollapsibleTrigger };
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { cn } from "../utils/cn.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
-
import { X } from "lucide-react";
|
|
5
|
-
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
6
|
-
import { Dialog } from "@base-ui/react/dialog";
|
|
7
|
-
//#region ../shared-api/dist/components/dialog.js
|
|
8
|
-
const Dialog$1 = Dialog.Root;
|
|
9
|
-
const DialogTrigger = Dialog.Trigger;
|
|
10
|
-
const DialogPortal = Dialog.Portal;
|
|
11
|
-
Dialog.Close;
|
|
12
|
-
function DialogOverlay({ className, ref, ...props }) {
|
|
13
|
-
return /* @__PURE__ */ jsx(Dialog.Backdrop, {
|
|
14
|
-
ref,
|
|
15
|
-
className: cn("fixed inset-0 z-50 bg-black/30 backdrop-blur-sm data-open:animate-fd-fade-in data-closed:animate-fd-fade-out", className),
|
|
16
|
-
...props
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
function DialogContent({ className, children, ref, ...props }) {
|
|
20
|
-
return /* @__PURE__ */ jsxs(DialogPortal, { children: [/* @__PURE__ */ jsx(DialogOverlay, {}), /* @__PURE__ */ jsxs(Dialog.Popup, {
|
|
21
|
-
ref,
|
|
22
|
-
className: cn("fixed left-1/2 top-1/2 z-50 flex flex-col gap-4 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 border bg-fd-popover p-4 shadow-lg rounded-xl duration-200 data-open:animate-fd-dialog-in data-closed:animate-fd-dialog-out focus-visible:outline-none", className),
|
|
23
|
-
...props,
|
|
24
|
-
children: [children, /* @__PURE__ */ jsx(Dialog.Close, {
|
|
25
|
-
"aria-label": "Close",
|
|
26
|
-
className: cn(buttonVariants({
|
|
27
|
-
size: "icon-sm",
|
|
28
|
-
variant: "ghost"
|
|
29
|
-
}), "absolute end-2 top-2 text-fd-muted-foreground/70"),
|
|
30
|
-
children: /* @__PURE__ */ jsx(X, {})
|
|
31
|
-
})]
|
|
32
|
-
})] });
|
|
33
|
-
}
|
|
34
|
-
function DialogHeader({ className, ...props }) {
|
|
35
|
-
return /* @__PURE__ */ jsx("div", {
|
|
36
|
-
className: cn("flex flex-col gap-1.5 text-center sm:text-start", className),
|
|
37
|
-
...props
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function DialogTitle({ className, ref, ...props }) {
|
|
41
|
-
return /* @__PURE__ */ jsx(Dialog.Title, {
|
|
42
|
-
ref,
|
|
43
|
-
className: cn("text-lg font-semibold leading-none tracking-tight", className),
|
|
44
|
-
...props
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
function DialogDescription({ className, ref, ...props }) {
|
|
48
|
-
return /* @__PURE__ */ jsx(Dialog.Description, {
|
|
49
|
-
ref,
|
|
50
|
-
className: cn("text-sm text-fd-muted-foreground", className),
|
|
51
|
-
...props
|
|
52
|
-
});
|
|
53
|
-
}
|
|
54
|
-
//#endregion
|
|
55
|
-
export { Dialog$1 as Dialog, DialogContent, DialogDescription, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger };
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { cn } from "../utils/cn.js";
|
|
2
|
-
import "react";
|
|
3
|
-
import { jsx } from "react/jsx-runtime";
|
|
4
|
-
//#region ../shared-api/dist/components/input.js
|
|
5
|
-
function Input({ className, type, ref, ...props }) {
|
|
6
|
-
return /* @__PURE__ */ jsx("input", {
|
|
7
|
-
type,
|
|
8
|
-
className: cn("flex h-9 w-full rounded-md border bg-fd-secondary px-2 py-1.5 text-[0.8125rem] 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),
|
|
9
|
-
ref,
|
|
10
|
-
...props
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
export { Input };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { cn } from "../utils/cn.js";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
//#region ../shared-api/dist/components/label.js
|
|
4
|
-
function Label({ className, ...props }) {
|
|
5
|
-
return /* @__PURE__ */ jsx("label", {
|
|
6
|
-
className: cn("text-xs font-medium text-fd-foreground peer-disabled:cursor-not-allowed peer-disabled:opacity-70", className),
|
|
7
|
-
...props
|
|
8
|
-
});
|
|
9
|
-
}
|
|
10
|
-
//#endregion
|
|
11
|
-
export { Label };
|