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
|
@@ -5,15 +5,15 @@ import { anyFields, useFieldInfo, useResolvedSchema, useSchemaContext, useSchema
|
|
|
5
5
|
import { Fragment, useId, useMemo, useState } from "react";
|
|
6
6
|
import { dereference, matches, matchesType, mergeAllOf, stringify } from "@fumadocs/json-schema";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
8
9
|
import { useArray, useDataEngine, useFieldValue, useObject } from "@fumari/stf";
|
|
9
10
|
import { isPlainObject, stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
10
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
11
11
|
import { Check, ChevronRight, ChevronsUpDown, Copy, Info, Plus, Trash2, Upload, X } from "lucide-react";
|
|
12
12
|
import { Select } from "@base-ui/react/select";
|
|
13
13
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
14
14
|
import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
|
|
15
15
|
import { Popover } from "@base-ui/react/popover";
|
|
16
|
-
|
|
16
|
+
// ../shared-api/dist/components/playground/fields.js
|
|
17
17
|
/** the type of a field, at the end of its cell like a unit */
|
|
18
18
|
const typeClassName = "flex shrink-0 items-center pe-1 font-mono text-xs text-fd-muted-foreground";
|
|
19
19
|
/** holds the actions of field, reserved in tables so their types align, an end padding when stacked */
|
|
@@ -27,6 +27,25 @@ function getType(field) {
|
|
|
27
27
|
function typeLabel(field, alias = false) {
|
|
28
28
|
return field.const !== void 0 ? JSON.stringify(field.const) : stringify(field, { alias });
|
|
29
29
|
}
|
|
30
|
+
/** a union of `const` members, an `enum` whose values are named by their `title` */
|
|
31
|
+
function isConstUnion(union) {
|
|
32
|
+
return union !== void 0 && union.length > 0 && union.every((item) => typeof item === "object" && item.const !== void 0);
|
|
33
|
+
}
|
|
34
|
+
/** the values of a field rendered as a select */
|
|
35
|
+
function getOptions(field) {
|
|
36
|
+
const union = field.anyOf ?? field.oneOf;
|
|
37
|
+
if (isConstUnion(union)) return union.map((item) => ({
|
|
38
|
+
value: item.const,
|
|
39
|
+
label: item.title ?? valueLabel(item.const)
|
|
40
|
+
}));
|
|
41
|
+
return (field.const !== void 0 ? [field.const] : field.enum)?.map((value) => ({
|
|
42
|
+
value,
|
|
43
|
+
label: valueLabel(value)
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
function valueLabel(value) {
|
|
47
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
48
|
+
}
|
|
30
49
|
/**
|
|
31
50
|
* Resolve the unions and multiple types of a field from its value, like `useFieldInfo()` does initially.
|
|
32
51
|
*/
|
|
@@ -80,7 +99,7 @@ function SchemaSwitch({ fieldName, schema, depth = 0, children }) {
|
|
|
80
99
|
info.oneOf,
|
|
81
100
|
info.selectedType
|
|
82
101
|
]);
|
|
83
|
-
if (member === void 0) return children(field, null);
|
|
102
|
+
if (member === void 0 || isConstUnion(union)) return children(field, null);
|
|
84
103
|
let selector = null;
|
|
85
104
|
if (union && union.length > 1) selector = /* @__PURE__ */ jsx(TypeSelect, {
|
|
86
105
|
value: String(info.oneOf),
|
|
@@ -273,7 +292,7 @@ function ValueRow({ fieldName, field, type, end, required, marked = required, na
|
|
|
273
292
|
/** the type in the cell of a primitive field, its selector when it has multiple */
|
|
274
293
|
function cellType(field, selector) {
|
|
275
294
|
if (selector) return selector;
|
|
276
|
-
if (field.
|
|
295
|
+
if (field.type !== "null" && !getOptions(field)) return typeLabel(field);
|
|
277
296
|
}
|
|
278
297
|
/** the input of a primitive field */
|
|
279
298
|
function FieldValue({ id, fieldName, field, required = false }) {
|
|
@@ -306,12 +325,12 @@ function FieldValue({ id, fieldName, field, required = false }) {
|
|
|
306
325
|
})
|
|
307
326
|
]
|
|
308
327
|
});
|
|
309
|
-
const options = field
|
|
328
|
+
const options = getOptions(field);
|
|
310
329
|
if (options && options.length > 0) {
|
|
311
|
-
const idx = options.
|
|
312
|
-
const items = options.map((
|
|
330
|
+
const idx = options.findIndex((option) => option.value === value);
|
|
331
|
+
const items = options.map((option, i) => ({
|
|
313
332
|
value: String(i),
|
|
314
|
-
label:
|
|
333
|
+
label: option.label
|
|
315
334
|
}));
|
|
316
335
|
if (!required) items.push({
|
|
317
336
|
value: "-1",
|
|
@@ -324,7 +343,7 @@ function FieldValue({ id, fieldName, field, required = false }) {
|
|
|
324
343
|
id,
|
|
325
344
|
items,
|
|
326
345
|
value: idx !== -1 ? String(idx) : required ? null : "-1",
|
|
327
|
-
onValueChange: (v) => setValue(v === "-1" ? void 0 : options[Number(v)]),
|
|
346
|
+
onValueChange: (v) => setValue(v === "-1" ? void 0 : options[Number(v)].value),
|
|
328
347
|
placeholder: t("Select")
|
|
329
348
|
});
|
|
330
349
|
}
|
|
@@ -711,5 +730,4 @@ function FieldMarkdown({ md }) {
|
|
|
711
730
|
const { Markdown } = useSchemaContext();
|
|
712
731
|
return Markdown ? /* @__PURE__ */ jsx(Markdown, { md }) : md;
|
|
713
732
|
}
|
|
714
|
-
//#endregion
|
|
715
733
|
export { CellSelect, CheckRow, FieldRow, FieldRows, LinkRow, Row, SelectRow, TextRow, ValueRow, getNestedFields, getRemoval, resolveField };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { useDataEngine, useFieldValue } from "@fumari/stf";
|
|
5
|
-
|
|
5
|
+
// ../shared-api/dist/components/playground/json-editor.js
|
|
6
6
|
function JsonEditor({ fieldName }) {
|
|
7
7
|
const engine = useDataEngine();
|
|
8
8
|
const [value] = useFieldValue(fieldName);
|
|
@@ -50,5 +50,4 @@ function JsonEditor({ fieldName }) {
|
|
|
50
50
|
function formatJson(value) {
|
|
51
51
|
return JSON.stringify(value ?? {}, null, 2);
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
export { JsonEditor };
|
|
@@ -8,12 +8,12 @@ import { useSchemaUtils } from "./schema.js";
|
|
|
8
8
|
import { FieldRows, getNestedFields, resolveField } from "./fields.js";
|
|
9
9
|
import { memo, useState } from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { useTranslations } from "@fuma-translate/react";
|
|
11
12
|
import { useDataEngine } from "@fumari/stf";
|
|
12
13
|
import { stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
13
|
-
import { useTranslations } from "@fuma-translate/react";
|
|
14
14
|
import { ArrowLeft, ChevronRight, SendHorizontal } from "lucide-react";
|
|
15
15
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
16
|
-
|
|
16
|
+
// ../shared-api/dist/components/playground/panels.js
|
|
17
17
|
const motionClassNames = {
|
|
18
18
|
forward: "motion-safe:starting:translate-x-6",
|
|
19
19
|
back: "motion-safe:starting:-translate-x-6",
|
|
@@ -326,5 +326,4 @@ function SendingOverlay() {
|
|
|
326
326
|
children: [/* @__PURE__ */ jsx(Spinner, { className: "size-3.5" }), t("Sending request...")]
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
|
-
//#endregion
|
|
330
329
|
export { Crumb, FieldPanel, OverviewLayer, Panel, PanelHeader, PanelNav, Placeholder, RequestExampleSelect, Section, SendButton, SendShortcut, SendingOverlay, ViewSwitch, iconButtonClassName, panelCodeBlock, panelTopCodeBlock, useFieldStack };
|
|
@@ -3,7 +3,7 @@ import { cn } from "../../utils/cn.js";
|
|
|
3
3
|
import { useResolvedSchema } from "./schema.js";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { useFieldValue } from "@fumari/stf";
|
|
6
|
-
|
|
6
|
+
// ../shared-api/dist/components/playground/param-input.js
|
|
7
7
|
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";
|
|
8
8
|
/** a parameter of a URL edited in place, like `{id}` of `/users/{id}` */
|
|
9
9
|
function ParamInput({ fieldName, name, schema = true, description }) {
|
|
@@ -50,5 +50,4 @@ function ParamInput({ fieldName, name, schema = true, description }) {
|
|
|
50
50
|
className
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
export { ParamInput };
|
|
@@ -6,7 +6,7 @@ import { Fragment, useState } from "react";
|
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { useTranslations } from "@fuma-translate/react";
|
|
8
8
|
import { X } from "lucide-react";
|
|
9
|
-
|
|
9
|
+
// ../shared-api/dist/components/playground/result.js
|
|
10
10
|
function ClearButton({ onClick, className }) {
|
|
11
11
|
const t = useTranslations({ note: "playground result display" });
|
|
12
12
|
return /* @__PURE__ */ jsx("button", {
|
|
@@ -183,5 +183,4 @@ function ResponseView({ status, duration, size, url, headers, warning = false, a
|
|
|
183
183
|
})
|
|
184
184
|
});
|
|
185
185
|
}
|
|
186
|
-
//#endregion
|
|
187
186
|
export { RequestError, ResponseView };
|
|
@@ -3,7 +3,7 @@ import { dereference, matches, matchesType, mergeAllOf, sample } from "@fumadocs
|
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { useDataEngine, useFieldValue, useNamespace } from "@fumari/stf";
|
|
5
5
|
import { stringifyFieldKey } from "@fumari/stf/lib/utils";
|
|
6
|
-
|
|
6
|
+
// ../shared-api/dist/components/playground/schema.js
|
|
7
7
|
const SchemaContext = createContext(void 0);
|
|
8
8
|
const anyFields = {
|
|
9
9
|
type: [
|
|
@@ -110,5 +110,4 @@ function getUnion(schema) {
|
|
|
110
110
|
if (schema.anyOf) return [schema.anyOf, "anyOf"];
|
|
111
111
|
if (schema.oneOf) return [schema.oneOf, "oneOf"];
|
|
112
112
|
}
|
|
113
|
-
//#endregion
|
|
114
113
|
export { SchemaProvider, anyFields, useFieldInfo, useResolvedSchema, useSchemaContext, useSchemaUtils };
|
|
@@ -3,11 +3,11 @@ import { cn } from "../../utils/cn.js";
|
|
|
3
3
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../select.js";
|
|
4
4
|
import { useEffect, useRef, useState } from "react";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
-
import { StfProvider, useFieldValue, useListener, useStf } from "@fumari/stf";
|
|
7
6
|
import { useTranslations } from "@fuma-translate/react";
|
|
7
|
+
import { StfProvider, useFieldValue, useListener, useStf } from "@fumari/stf";
|
|
8
8
|
import { Check, ChevronDown } from "lucide-react";
|
|
9
9
|
import { Popover } from "@base-ui/react/popover";
|
|
10
|
-
|
|
10
|
+
// ../shared-api/dist/components/playground/server-select.js
|
|
11
11
|
/**
|
|
12
12
|
* Selects the server in a popover, `children` goes below its options, like `<ServerVariables />`.
|
|
13
13
|
*/
|
|
@@ -126,5 +126,4 @@ function VariableInput({ fieldName, variable }) {
|
|
|
126
126
|
className: cn("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", example === void 0 && "placeholder:font-sans")
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
|
-
//#endregion
|
|
130
129
|
export { ServerPopover, ServerVariables };
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
2
|
import { SchemaUIGeneratedData } from "@fumadocs/json-schema/react";
|
|
3
|
-
//#region ../shared-api/dist/components/schema/client.d.ts
|
|
4
|
-
//#region src/components/schema/client.d.ts
|
|
5
3
|
export interface SchemaUIProps {
|
|
6
4
|
/** anchor ID of the root schema, links to a property are resolved against it */
|
|
7
5
|
rootId: string;
|
|
@@ -13,5 +11,4 @@ export interface SchemaUIProps {
|
|
|
13
11
|
/** actions of the root schema, like copying its type definitions */
|
|
14
12
|
actions?: ReactNode;
|
|
15
13
|
generated: SchemaUIGeneratedData;
|
|
16
|
-
}
|
|
17
|
-
//#endregion
|
|
14
|
+
}
|
|
@@ -11,7 +11,7 @@ import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
|
|
|
11
11
|
import { flushSync } from "react-dom";
|
|
12
12
|
import { Menu } from "@base-ui/react/menu";
|
|
13
13
|
import { SchemaUIProvider, useSchemaUI } from "@fumadocs/json-schema/react/client";
|
|
14
|
-
|
|
14
|
+
// ../shared-api/dist/components/schema/client.js
|
|
15
15
|
const TypeContext = createContext(null);
|
|
16
16
|
const typeClassName = "font-mono text-xs text-fd-muted-foreground";
|
|
17
17
|
const crumbClassName = "truncate rounded-md 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-inset focus-visible:ring-fd-ring data-popup-open:bg-fd-accent";
|
|
@@ -295,6 +295,7 @@ function formatName(name) {
|
|
|
295
295
|
return match ? `[${match[1]}]` : name;
|
|
296
296
|
}
|
|
297
297
|
function UnionSelect({ union: { schema, value, select } }) {
|
|
298
|
+
const t = useTranslations({ note: "schema UI" });
|
|
298
299
|
const items = schema.items.map((item) => ({
|
|
299
300
|
label: item.name,
|
|
300
301
|
value: item.$type
|
|
@@ -304,6 +305,7 @@ function UnionSelect({ union: { schema, value, select } }) {
|
|
|
304
305
|
value,
|
|
305
306
|
onValueChange: (v) => v && select(v),
|
|
306
307
|
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
308
|
+
"aria-label": t("Schema variant"),
|
|
307
309
|
className: "h-7 w-auto min-w-0 gap-1 border-0 bg-transparent px-1.5 py-0 text-[0.8125rem] font-medium text-fd-foreground hover:bg-fd-accent focus:ring-0 focus-visible:ring-2 focus-visible:ring-inset data-popup-open:bg-fd-accent",
|
|
308
310
|
children: /* @__PURE__ */ jsx(SelectValue, { className: "truncate" })
|
|
309
311
|
}), /* @__PURE__ */ jsx(SelectContent, { children: items.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
@@ -483,5 +485,4 @@ function OpenTag({ label, value, open: { name, $ref } }) {
|
|
|
483
485
|
]
|
|
484
486
|
});
|
|
485
487
|
}
|
|
486
|
-
//#endregion
|
|
487
488
|
export { SchemaUI };
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { SchemaUIProps } from "./client.js";
|
|
2
2
|
import { GenerateSchemaUIOptions } from "@fumadocs/json-schema/react";
|
|
3
|
-
//#region ../shared-api/dist/components/schema/index.d.ts
|
|
4
|
-
//#region src/components/schema/index.d.ts
|
|
5
3
|
export interface SchemaUIOptions extends Omit<GenerateSchemaUIOptions, 'translations'> {
|
|
6
4
|
client: Omit<SchemaUIProps, 'generated'>;
|
|
7
5
|
}
|
|
8
|
-
//#endregion
|
|
9
6
|
export type { SchemaUIProps };
|
|
@@ -4,7 +4,7 @@ import { useMemo } from "react";
|
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { useTranslations } from "@fuma-translate/react";
|
|
6
6
|
import { generateSchemaUI } from "@fumadocs/json-schema/react";
|
|
7
|
-
|
|
7
|
+
// ../shared-api/dist/components/schema/index.js
|
|
8
8
|
function Schema({ client, ...options }) {
|
|
9
9
|
const translations = useTranslations().translations;
|
|
10
10
|
const generated = useMemo(() => generateSchemaUI({
|
|
@@ -24,5 +24,4 @@ function Schema({ client, ...options }) {
|
|
|
24
24
|
generated
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { Schema, SchemaUI };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { cn } from "../utils/cn.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Tabs } from "@base-ui/react/tabs";
|
|
5
|
-
|
|
5
|
+
// ../shared-api/dist/components/segmented.js
|
|
6
6
|
const Segmented = Tabs.Root;
|
|
7
7
|
const SegmentedPanel = Tabs.Panel;
|
|
8
8
|
/** a pill switch with a sliding indicator, its panels go in `<SegmentedPanel />` */
|
|
@@ -17,5 +17,4 @@ function SegmentedList({ items, className, ...props }) {
|
|
|
17
17
|
}, item.value)), /* @__PURE__ */ jsx(Tabs.Indicator, { className: "absolute top-(--active-tab-top) left-0 -z-1 h-(--active-tab-height) w-(--active-tab-width) translate-x-(--active-tab-left) rounded-md bg-fd-background shadow-sm ring-1 ring-fd-border transition-[translate,width] duration-250 ease-[cubic-bezier(0.16,1,0.3,1)] motion-reduce:transition-none dark:bg-fd-accent" })]
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
|
-
//#endregion
|
|
21
20
|
export { Segmented, SegmentedList, SegmentedPanel };
|
|
@@ -4,7 +4,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from ".
|
|
|
4
4
|
import { AnchorSection, useAnchorLink } from "../auto-anchor/index.js";
|
|
5
5
|
import { createContext, use, useMemo, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
|
|
7
|
+
// ../shared-api/dist/components/select-tab.js
|
|
8
8
|
const Context = createContext(null);
|
|
9
9
|
function SelectTabs({ defaultValue, children }) {
|
|
10
10
|
const [value, setValue] = useState(defaultValue ?? null);
|
|
@@ -50,5 +50,4 @@ function SelectTabTrigger({ items, className, ...props }) {
|
|
|
50
50
|
}, value)) })]
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
export { SelectTab, SelectTabTrigger, SelectTabs };
|
|
@@ -3,7 +3,7 @@ import "react";
|
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Check, ChevronDown } from "lucide-react";
|
|
5
5
|
import { Select } from "@base-ui/react/select";
|
|
6
|
-
|
|
6
|
+
// ../shared-api/dist/components/select.js
|
|
7
7
|
const Select$2 = Select.Root;
|
|
8
8
|
Select.Group;
|
|
9
9
|
const SelectValue = Select.Value;
|
|
@@ -71,5 +71,4 @@ function SelectItem({ className, children, description, ref, ...props }) {
|
|
|
71
71
|
})]
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
|
-
//#endregion
|
|
75
74
|
export { Select$2 as Select, SelectContent, SelectItem, SelectScrollDownButton, SelectScrollUpButton, SelectTrigger, SelectValue };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../utils/cn.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { Loader2Icon } from "lucide-react";
|
|
4
|
-
|
|
4
|
+
// ../shared-api/dist/components/spinner.js
|
|
5
5
|
function Spinner({ className, ...props }) {
|
|
6
6
|
return /* @__PURE__ */ jsx(Loader2Icon, {
|
|
7
7
|
role: "status",
|
|
@@ -10,5 +10,4 @@ function Spinner({ className, ...props }) {
|
|
|
10
10
|
...props
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
|
-
//#endregion
|
|
14
13
|
export { Spinner };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { MetaData, PageData } from "fumadocs-core/source";
|
|
2
|
-
//#region ../shared-api/dist/source.d.ts
|
|
3
|
-
//#region src/source.d.ts
|
|
4
2
|
export interface SourceOptions {
|
|
5
3
|
baseDir?: string;
|
|
6
4
|
/** Generate `meta.json` files */
|
|
7
5
|
meta?: boolean | {
|
|
8
6
|
folderStyle?: 'folder' | 'separator';
|
|
9
7
|
};
|
|
10
|
-
}
|
|
11
|
-
//#endregion
|
|
8
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
2
|
import { PathUtils } from "fumadocs-core/source";
|
|
3
|
-
|
|
3
|
+
// ../shared-api/dist/source.js
|
|
4
4
|
/** convert output entries into virtual files for `loader()` */
|
|
5
5
|
function toVirtualFiles(entries, { baseDir = "", meta = false }, toPage) {
|
|
6
6
|
const { folderStyle = "folder" } = typeof meta === "object" ? meta : {};
|
|
@@ -46,5 +46,4 @@ function getMetaPages(entries, parent, folderStyle) {
|
|
|
46
46
|
}
|
|
47
47
|
return pages;
|
|
48
48
|
}
|
|
49
|
-
//#endregion
|
|
50
49
|
export { getMetaPages, toVirtualFiles };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../shared-api/dist/utils/document-cache.js
|
|
2
2
|
/** Browsers load each document once per session, servers cache documents themselves. */
|
|
3
3
|
function createDocumentCache() {
|
|
4
4
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -12,5 +12,4 @@ function createDocumentCache() {
|
|
|
12
12
|
return promise;
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
//#endregion
|
|
16
15
|
export { createDocumentCache };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../shared-api/dist/utils/id-to-title.js
|
|
2
2
|
function idToTitle(id) {
|
|
3
3
|
let result = [];
|
|
4
4
|
for (const c of id) if (result.length === 0) result.push(c.toLocaleUpperCase());
|
|
@@ -8,5 +8,4 @@ function idToTitle(id) {
|
|
|
8
8
|
else result.push(c);
|
|
9
9
|
return result.join("");
|
|
10
10
|
}
|
|
11
|
-
//#endregion
|
|
12
11
|
export { idToTitle };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// ../shared-api/dist/utils/is-plain-object.js
|
|
2
2
|
function isPlainObject(value) {
|
|
3
3
|
if (typeof value !== "object" || value === null) return false;
|
|
4
4
|
const prototype = Object.getPrototypeOf(value);
|
|
5
5
|
return prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null;
|
|
6
6
|
}
|
|
7
|
-
//#endregion
|
|
8
7
|
export { isPlainObject };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../shared-api/dist/utils/url.js
|
|
2
2
|
function joinURL(base, pathname) {
|
|
3
3
|
if (pathname.startsWith("/")) pathname = pathname.slice(1);
|
|
4
4
|
if (base.endsWith("/")) base = base.slice(0, -1);
|
|
@@ -9,5 +9,4 @@ function resolveServerUrl(template, variables) {
|
|
|
9
9
|
for (const [key, value] of Object.entries(variables)) template = template.replaceAll(`{${key}}`, value);
|
|
10
10
|
return template;
|
|
11
11
|
}
|
|
12
|
-
//#endregion
|
|
13
12
|
export { joinURL, resolveServerUrl };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useMemo, useRef, useState } from "react";
|
|
3
|
-
|
|
3
|
+
// ../shared-api/dist/utils/use-query.js
|
|
4
4
|
function useQuery(fn) {
|
|
5
5
|
const [loading, setLoading] = useState(false);
|
|
6
6
|
const [data, setData] = useState();
|
|
@@ -35,5 +35,4 @@ function useQuery(fn) {
|
|
|
35
35
|
loading
|
|
36
36
|
]);
|
|
37
37
|
}
|
|
38
|
-
//#endregion
|
|
39
38
|
export { useQuery };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { isPlainObject } from "./is-plain-object.js";
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
|
|
4
|
+
// ../shared-api/dist/utils/use-server-store.js
|
|
5
5
|
/**
|
|
6
6
|
* The selected server of an API page, persisted in `localStorage`.
|
|
7
7
|
*/
|
|
@@ -52,5 +52,4 @@ function useServerStore({ storageKey, keyOf, resolve, defaultKey }) {
|
|
|
52
52
|
storageKey
|
|
53
53
|
]);
|
|
54
54
|
}
|
|
55
|
-
//#endregion
|
|
56
55
|
export { useServerStore };
|
|
@@ -3,7 +3,6 @@ import { OAuthFlows, OperationObject, SecuritySchemeObject } from "../types.js";
|
|
|
3
3
|
import { FC, ReactNode } from "react";
|
|
4
4
|
import { JsonSchema } from "@fumadocs/json-schema";
|
|
5
5
|
import { DataEngine, FieldKey, Stf } from "@fumari/stf";
|
|
6
|
-
//#region src/playground/auth.d.ts
|
|
7
6
|
/** how token requests authenticate the client */
|
|
8
7
|
interface OAuthClient {
|
|
9
8
|
client_id: string;
|
|
@@ -110,18 +109,20 @@ interface ReturnedFlow extends PendingFlow {
|
|
|
110
109
|
/** the URL it returned to */
|
|
111
110
|
url: URL;
|
|
112
111
|
}
|
|
113
|
-
interface
|
|
112
|
+
interface OAuthFlowState {
|
|
113
|
+
/** the page is finishing the returned OAuth flow */
|
|
114
|
+
isLoading: boolean;
|
|
115
|
+
error?: unknown;
|
|
116
|
+
/** token info of the OAuth flow the page finished, by scheme */
|
|
117
|
+
store: Record<string, TokenInfo | undefined>;
|
|
118
|
+
}
|
|
119
|
+
interface PlaygroundAuthState extends OAuthFlowState {
|
|
114
120
|
/** the values of security schemes, shared by the playgrounds of page */
|
|
115
121
|
stf: Stf;
|
|
116
122
|
/** the flow that returned to the page, until it is handled */
|
|
117
123
|
returned?: ReturnedFlow;
|
|
118
124
|
/** `origin` of the flow that returned to the page */
|
|
119
125
|
origin?: string;
|
|
120
|
-
/** the page is finishing the returned OAuth flow */
|
|
121
|
-
isLoading: boolean;
|
|
122
|
-
error?: unknown;
|
|
123
|
-
/** token info of the OAuth flow the page finished, by scheme */
|
|
124
|
-
store: Record<string, TokenInfo | undefined>;
|
|
125
126
|
}
|
|
126
127
|
/**
|
|
127
128
|
* The auth of page: the values of security schemes, and the flow that returned to it.
|
|
@@ -205,5 +206,4 @@ export interface AuthFieldsOptions {
|
|
|
205
206
|
* The auth fields of an API playground: the values it persists, and the request data they encode into.
|
|
206
207
|
*/
|
|
207
208
|
export declare function useAuthFields(engine: DataEngine, { operation, providers, transform }?: AuthFieldsOptions): AuthFields;
|
|
208
|
-
//#endregion
|
|
209
209
|
export {};
|