fumadocs-openapi 5.11.1 → 5.11.2
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 +4 -9
- package/dist/server/index.d.ts +3 -2
- package/dist/server/index.js +23 -23
- package/dist/ui/client-client-Dxsry8Mu.js +538 -0
- package/dist/ui/{fetcher-B7R5rjLv.js → fetcher-C0NHTJev.js} +1 -1
- package/dist/ui/{index-client-B6op0H4J.js → index-client-wsc_5cAY.js} +18 -119
- package/dist/ui/index.d.ts +31 -19
- package/dist/ui/index.js +6 -8
- package/package.json +3 -3
- package/dist/ui/client-client-NS2E5Jdn.js +0 -312
|
@@ -1,312 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import { forwardRef, createElement, useContext, createContext, useState, useEffect, useMemo } from 'react';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import { cn, useCopyButton, buttonVariants } from 'fumadocs-ui/components/api';
|
|
5
|
-
import dynamic from 'next/dynamic';
|
|
6
|
-
import { useOnChange } from 'fumadocs-core/utils/use-on-change';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* @license lucide-react v0.469.0 - ISC
|
|
10
|
-
*
|
|
11
|
-
* This source code is licensed under the ISC license.
|
|
12
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
13
|
-
*/ const toKebabCase = (string)=>string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
14
|
-
const mergeClasses = (...classes)=>classes.filter((className, index, array)=>{
|
|
15
|
-
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
16
|
-
}).join(" ").trim();
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* @license lucide-react v0.469.0 - ISC
|
|
20
|
-
*
|
|
21
|
-
* This source code is licensed under the ISC license.
|
|
22
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
23
|
-
*/ var defaultAttributes = {
|
|
24
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
25
|
-
width: 24,
|
|
26
|
-
height: 24,
|
|
27
|
-
viewBox: "0 0 24 24",
|
|
28
|
-
fill: "none",
|
|
29
|
-
stroke: "currentColor",
|
|
30
|
-
strokeWidth: 2,
|
|
31
|
-
strokeLinecap: "round",
|
|
32
|
-
strokeLinejoin: "round"
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const Icon = /*#__PURE__*/ forwardRef(({ color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref)=>{
|
|
36
|
-
return /*#__PURE__*/ createElement("svg", {
|
|
37
|
-
ref,
|
|
38
|
-
...defaultAttributes,
|
|
39
|
-
width: size,
|
|
40
|
-
height: size,
|
|
41
|
-
stroke: color,
|
|
42
|
-
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
43
|
-
className: mergeClasses("lucide", className),
|
|
44
|
-
...rest
|
|
45
|
-
}, [
|
|
46
|
-
...iconNode.map(([tag, attrs])=>/*#__PURE__*/ createElement(tag, attrs)),
|
|
47
|
-
...Array.isArray(children) ? children : [
|
|
48
|
-
children
|
|
49
|
-
]
|
|
50
|
-
]);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
const createLucideIcon = (iconName, iconNode)=>{
|
|
54
|
-
const Component = /*#__PURE__*/ forwardRef(({ className, ...props }, ref)=>/*#__PURE__*/ createElement(Icon, {
|
|
55
|
-
ref,
|
|
56
|
-
iconNode,
|
|
57
|
-
className: mergeClasses(`lucide-${toKebabCase(iconName)}`, className),
|
|
58
|
-
...props
|
|
59
|
-
}));
|
|
60
|
-
Component.displayName = `${iconName}`;
|
|
61
|
-
return Component;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const Check = createLucideIcon("Check", [
|
|
65
|
-
[
|
|
66
|
-
"path",
|
|
67
|
-
{
|
|
68
|
-
d: "M20 6 9 17l-5-5",
|
|
69
|
-
key: "1gmf2c"
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
]);
|
|
73
|
-
|
|
74
|
-
const ChevronDown = createLucideIcon("ChevronDown", [
|
|
75
|
-
[
|
|
76
|
-
"path",
|
|
77
|
-
{
|
|
78
|
-
d: "m6 9 6 6 6-6",
|
|
79
|
-
key: "qrunsl"
|
|
80
|
-
}
|
|
81
|
-
]
|
|
82
|
-
]);
|
|
83
|
-
|
|
84
|
-
const ChevronUp = createLucideIcon("ChevronUp", [
|
|
85
|
-
[
|
|
86
|
-
"path",
|
|
87
|
-
{
|
|
88
|
-
d: "m18 15-6-6-6 6",
|
|
89
|
-
key: "153udz"
|
|
90
|
-
}
|
|
91
|
-
]
|
|
92
|
-
]);
|
|
93
|
-
|
|
94
|
-
const CircleCheck = createLucideIcon("CircleCheck", [
|
|
95
|
-
[
|
|
96
|
-
"circle",
|
|
97
|
-
{
|
|
98
|
-
cx: "12",
|
|
99
|
-
cy: "12",
|
|
100
|
-
r: "10",
|
|
101
|
-
key: "1mglay"
|
|
102
|
-
}
|
|
103
|
-
],
|
|
104
|
-
[
|
|
105
|
-
"path",
|
|
106
|
-
{
|
|
107
|
-
d: "m9 12 2 2 4-4",
|
|
108
|
-
key: "dzmm74"
|
|
109
|
-
}
|
|
110
|
-
]
|
|
111
|
-
]);
|
|
112
|
-
|
|
113
|
-
const CircleX = createLucideIcon("CircleX", [
|
|
114
|
-
[
|
|
115
|
-
"circle",
|
|
116
|
-
{
|
|
117
|
-
cx: "12",
|
|
118
|
-
cy: "12",
|
|
119
|
-
r: "10",
|
|
120
|
-
key: "1mglay"
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
[
|
|
124
|
-
"path",
|
|
125
|
-
{
|
|
126
|
-
d: "m15 9-6 6",
|
|
127
|
-
key: "1uzhvr"
|
|
128
|
-
}
|
|
129
|
-
],
|
|
130
|
-
[
|
|
131
|
-
"path",
|
|
132
|
-
{
|
|
133
|
-
d: "m9 9 6 6",
|
|
134
|
-
key: "z0biqf"
|
|
135
|
-
}
|
|
136
|
-
]
|
|
137
|
-
]);
|
|
138
|
-
|
|
139
|
-
const Copy = createLucideIcon("Copy", [
|
|
140
|
-
[
|
|
141
|
-
"rect",
|
|
142
|
-
{
|
|
143
|
-
width: "14",
|
|
144
|
-
height: "14",
|
|
145
|
-
x: "8",
|
|
146
|
-
y: "8",
|
|
147
|
-
rx: "2",
|
|
148
|
-
ry: "2",
|
|
149
|
-
key: "17jyea"
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
[
|
|
153
|
-
"path",
|
|
154
|
-
{
|
|
155
|
-
d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",
|
|
156
|
-
key: "zix9uf"
|
|
157
|
-
}
|
|
158
|
-
]
|
|
159
|
-
]);
|
|
160
|
-
|
|
161
|
-
const Plus = createLucideIcon("Plus", [
|
|
162
|
-
[
|
|
163
|
-
"path",
|
|
164
|
-
{
|
|
165
|
-
d: "M5 12h14",
|
|
166
|
-
key: "1ays0h"
|
|
167
|
-
}
|
|
168
|
-
],
|
|
169
|
-
[
|
|
170
|
-
"path",
|
|
171
|
-
{
|
|
172
|
-
d: "M12 5v14",
|
|
173
|
-
key: "s699le"
|
|
174
|
-
}
|
|
175
|
-
]
|
|
176
|
-
]);
|
|
177
|
-
|
|
178
|
-
const Trash2 = createLucideIcon("Trash2", [
|
|
179
|
-
[
|
|
180
|
-
"path",
|
|
181
|
-
{
|
|
182
|
-
d: "M3 6h18",
|
|
183
|
-
key: "d0wm0j"
|
|
184
|
-
}
|
|
185
|
-
],
|
|
186
|
-
[
|
|
187
|
-
"path",
|
|
188
|
-
{
|
|
189
|
-
d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",
|
|
190
|
-
key: "4alrt4"
|
|
191
|
-
}
|
|
192
|
-
],
|
|
193
|
-
[
|
|
194
|
-
"path",
|
|
195
|
-
{
|
|
196
|
-
d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",
|
|
197
|
-
key: "v07s0e"
|
|
198
|
-
}
|
|
199
|
-
],
|
|
200
|
-
[
|
|
201
|
-
"line",
|
|
202
|
-
{
|
|
203
|
-
x1: "10",
|
|
204
|
-
x2: "10",
|
|
205
|
-
y1: "11",
|
|
206
|
-
y2: "17",
|
|
207
|
-
key: "1uufr5"
|
|
208
|
-
}
|
|
209
|
-
],
|
|
210
|
-
[
|
|
211
|
-
"line",
|
|
212
|
-
{
|
|
213
|
-
x1: "14",
|
|
214
|
-
x2: "14",
|
|
215
|
-
y1: "11",
|
|
216
|
-
y2: "17",
|
|
217
|
-
key: "xtxkd"
|
|
218
|
-
}
|
|
219
|
-
]
|
|
220
|
-
]);
|
|
221
|
-
|
|
222
|
-
const ApiContext = /*#__PURE__*/ createContext(undefined);
|
|
223
|
-
function useApiContext() {
|
|
224
|
-
const ctx = useContext(ApiContext);
|
|
225
|
-
if (!ctx) throw new Error('Component must be used under <ApiProvider />');
|
|
226
|
-
return ctx;
|
|
227
|
-
}
|
|
228
|
-
function ApiProvider({ defaultBaseUrl, shikiOptions, children }) {
|
|
229
|
-
const [baseUrl, setBaseUrl] = useState(defaultBaseUrl);
|
|
230
|
-
useEffect(()=>{
|
|
231
|
-
setBaseUrl((prev)=>localStorage.getItem('apiBaseUrl') ?? prev);
|
|
232
|
-
}, []);
|
|
233
|
-
useOnChange(baseUrl, ()=>{
|
|
234
|
-
if (baseUrl) localStorage.setItem('apiBaseUrl', baseUrl);
|
|
235
|
-
});
|
|
236
|
-
return /*#__PURE__*/ jsx(ApiContext.Provider, {
|
|
237
|
-
value: useMemo(()=>({
|
|
238
|
-
baseUrl,
|
|
239
|
-
setBaseUrl,
|
|
240
|
-
shikiOptions
|
|
241
|
-
}), [
|
|
242
|
-
baseUrl,
|
|
243
|
-
shikiOptions
|
|
244
|
-
]),
|
|
245
|
-
children: children
|
|
246
|
-
});
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
const SchemaContext = /*#__PURE__*/ createContext(undefined);
|
|
250
|
-
function useSchemaContext() {
|
|
251
|
-
const ctx = useContext(SchemaContext);
|
|
252
|
-
if (!ctx) throw new Error('Missing provider');
|
|
253
|
-
return ctx;
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
const APIPlayground = dynamic(()=>import('./index-client-B6op0H4J.js').then(function (n) { return n.i; }).then((mod)=>mod.APIPlayground));
|
|
257
|
-
function Root({ children, baseUrl, className, shikiOptions, ...props }) {
|
|
258
|
-
return /*#__PURE__*/ jsx("div", {
|
|
259
|
-
className: cn('flex flex-col gap-24 text-sm text-fd-muted-foreground', className),
|
|
260
|
-
...props,
|
|
261
|
-
children: /*#__PURE__*/ jsx(ApiProvider, {
|
|
262
|
-
shikiOptions: shikiOptions,
|
|
263
|
-
defaultBaseUrl: baseUrl,
|
|
264
|
-
children: children
|
|
265
|
-
})
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
function CopyRouteButton({ className, route, ...props }) {
|
|
269
|
-
const { baseUrl } = useApiContext();
|
|
270
|
-
const [checked, onCopy] = useCopyButton(()=>{
|
|
271
|
-
void navigator.clipboard.writeText(`${baseUrl ?? ''}${route}`);
|
|
272
|
-
});
|
|
273
|
-
return /*#__PURE__*/ jsx("button", {
|
|
274
|
-
type: "button",
|
|
275
|
-
className: cn(buttonVariants({
|
|
276
|
-
color: 'ghost',
|
|
277
|
-
className
|
|
278
|
-
})),
|
|
279
|
-
onClick: onCopy,
|
|
280
|
-
"aria-label": "Copy route path",
|
|
281
|
-
...props,
|
|
282
|
-
children: checked ? /*#__PURE__*/ jsx(Check, {
|
|
283
|
-
className: "size-full"
|
|
284
|
-
}) : /*#__PURE__*/ jsx(Copy, {
|
|
285
|
-
className: "size-full"
|
|
286
|
-
})
|
|
287
|
-
});
|
|
288
|
-
}
|
|
289
|
-
function BaseUrlSelect({ baseUrls }) {
|
|
290
|
-
const { baseUrl, setBaseUrl } = useApiContext();
|
|
291
|
-
if (baseUrls.length <= 1) return null;
|
|
292
|
-
return /*#__PURE__*/ jsxs("div", {
|
|
293
|
-
className: "mt-2 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 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
|
-
}
|
|
311
|
-
|
|
312
|
-
export { APIPlayground as A, BaseUrlSelect as B, ChevronDown as C, Plus as P, Root as R, SchemaContext as S, Trash2 as T, ChevronUp as a, Check as b, useApiContext as c, CircleCheck as d, CircleX as e, CopyRouteButton as f, useSchemaContext as u };
|