fumadocs-openapi 12.2.0 → 12.3.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 +1 -3
- package/dist/.translations/keys.js +1 -3
- package/dist/packages/shared-api/dist/.translations/index.d.ts +1 -0
- package/dist/packages/shared-api/dist/.translations/keys.js +1 -0
- package/dist/packages/shared-api/dist/auto-anchor/index.js +54 -10
- package/dist/packages/shared-api/dist/components/accordion.js +3 -11
- package/dist/packages/shared-api/dist/components/collapsible.js +16 -0
- package/dist/packages/shared-api/dist/components/schema/client.d.ts +5 -0
- package/dist/packages/shared-api/dist/components/schema/client.js +408 -455
- package/dist/packages/shared-api/dist/components/select-tab.js +7 -12
- package/dist/ui/components/dialog.js +14 -0
- package/dist/ui/components/endpoint.js +11 -8
- package/dist/ui/components/heading.js +1 -1
- package/dist/ui/components/schema.js +1 -1
- package/dist/ui/{playground/components → components}/segmented.js +2 -2
- package/dist/ui/operation/index.js +261 -236
- package/dist/ui/playground/client.js +5 -4
- package/dist/ui/playground/components/fields.js +1 -1
- package/dist/ui/playground/components/request-panel.js +1 -1
- package/dist/ui/playground/components/response-panel.js +1 -1
- package/dist/ui/playground/components/result-display.js +1 -1
- package/dist/ui/playground/components/server-select.js +1 -1
- package/package.json +5 -5
- package/dist/packages/shared-api/dist/auto-anchor/client.js +0 -20
- package/dist/packages/shared-api/dist/components/popover.js +0 -23
- package/dist/packages/shared-api/dist/utils/merge-refs.js +0 -11
|
@@ -1,512 +1,465 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../../utils/cn.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Collapsible, CollapsibleContent } from "../collapsible.js";
|
|
4
4
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "../select.js";
|
|
5
|
-
import {
|
|
6
|
-
import { Fragment, Suspense, createContext, use, useCallback, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
|
|
5
|
+
import { Fragment, createContext, use, useCallback, useRef, useState } from "react";
|
|
7
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { useTranslations } from "@fuma-translate/react";
|
|
9
|
-
import {
|
|
10
|
-
import { CheckIcon, FilterIcon, LinkIcon } from "lucide-react";
|
|
8
|
+
import { CheckIcon, ChevronRightIcon, FilterIcon, FilterXIcon, LinkIcon } from "lucide-react";
|
|
11
9
|
import { buttonVariants } from "fumadocs-ui/components/ui/button";
|
|
10
|
+
import { flushSync } from "react-dom";
|
|
12
11
|
import { useCopyButton } from "fumadocs-ui/utils/use-copy-button";
|
|
12
|
+
import { Menu } from "@base-ui/react/menu";
|
|
13
|
+
import { SchemaUIProvider, useSchemaUI } from "@fumadocs/json-schema/react/client";
|
|
13
14
|
//#region ../shared-api/dist/components/schema/client.js
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (restored.has(rootId)) return;
|
|
24
|
-
const url = new URL(window.location.href);
|
|
25
|
-
const param = url.searchParams.get("path");
|
|
26
|
-
if (url.hash !== `#${rootId}` || !param) return;
|
|
27
|
-
const decoded = decodePath(param, url.searchParams.get("s-highlight"));
|
|
28
|
-
if (decoded.length === 0 || decoded.some((item) => !generated.refs[item.$ref])) return;
|
|
29
|
-
setPath(decoded);
|
|
30
|
-
restored.add(rootId);
|
|
31
|
-
if (!decoded.at(-1).highlighted) document.getElementById(rootId)?.scrollIntoView({ behavior: "smooth" });
|
|
32
|
-
}, [rootId, generated.refs]);
|
|
33
|
-
return /* @__PURE__ */ jsx(SchemaUIContext, {
|
|
34
|
-
value: useMemo(() => ({
|
|
35
|
-
rootId,
|
|
36
|
-
path,
|
|
37
|
-
setPath,
|
|
38
|
-
generated,
|
|
39
|
-
open: (name, $ref) => setPath([...path, {
|
|
40
|
-
name,
|
|
41
|
-
$ref
|
|
42
|
-
}]),
|
|
43
|
-
back: (index) => setPath(path.slice(0, index + 1))
|
|
44
|
-
}), [
|
|
45
|
-
rootId,
|
|
46
|
-
path,
|
|
47
|
-
generated
|
|
48
|
-
]),
|
|
49
|
-
children
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
function usePathState() {
|
|
53
|
-
const ctx = use(SchemaUIContext);
|
|
54
|
-
if (!ctx) throw new Error("Component must be used under <SchemaUIProvider />");
|
|
55
|
-
return ctx;
|
|
56
|
-
}
|
|
57
|
-
function useSchemaUI() {
|
|
58
|
-
return usePathState();
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* The selected member of a union schema on the path item at `pathIndex`, `depth` for nested unions.
|
|
62
|
-
*/
|
|
63
|
-
function useSchemaTabs(pathIndex, depth) {
|
|
64
|
-
const { path, setPath } = usePathState();
|
|
65
|
-
return [path[pathIndex].tabValues?.[depth] || void 0, (value) => {
|
|
66
|
-
const tabValues = path[pathIndex].tabValues?.slice(0, depth) ?? [];
|
|
67
|
-
tabValues[depth] = value;
|
|
68
|
-
setPath(path.with(pathIndex, {
|
|
69
|
-
...path[pathIndex],
|
|
70
|
-
tabValues
|
|
71
|
-
}));
|
|
72
|
-
}];
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Open state of the popover showing the schema `$ref` of the root property `pathName`.
|
|
76
|
-
*/
|
|
77
|
-
function useSchemaPopover(pathName, $ref) {
|
|
78
|
-
const { path, setPath } = usePathState();
|
|
79
|
-
return {
|
|
80
|
-
open: path.length > 1 && path[1].$ref === $ref && path[1].name === pathName && !path[0].closed,
|
|
81
|
-
onOpenChange(open) {
|
|
82
|
-
if (open) setPath([{
|
|
83
|
-
...path[0],
|
|
84
|
-
closed: false
|
|
85
|
-
}, {
|
|
86
|
-
name: pathName,
|
|
87
|
-
$ref
|
|
88
|
-
}]);
|
|
89
|
-
else setPath(path.map((item, i) => i === 0 ? {
|
|
90
|
-
...item,
|
|
91
|
-
closed: true
|
|
92
|
-
} : item));
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Whether the property `name` on the path item at `pathIndex` is highlighted by the link it was opened from.
|
|
98
|
-
*
|
|
99
|
-
* @returns the state and a ref to scroll the highlighted element into view
|
|
100
|
-
*/
|
|
101
|
-
function useSchemaHighlight(pathIndex, name) {
|
|
102
|
-
const { path } = usePathState();
|
|
103
|
-
const item = path[pathIndex];
|
|
104
|
-
const highlighted = item.highlighted === name;
|
|
105
|
-
return [highlighted, useCallback((element) => {
|
|
106
|
-
if (!element || !highlighted) return;
|
|
107
|
-
window.setTimeout(() => {
|
|
108
|
-
element.scrollIntoView({
|
|
109
|
-
behavior: "smooth",
|
|
110
|
-
block: "end"
|
|
111
|
-
});
|
|
112
|
-
delete item.highlighted;
|
|
113
|
-
}, 300);
|
|
114
|
-
}, [item, highlighted])];
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Copy the link to the property `name` of the current path.
|
|
118
|
-
*/
|
|
119
|
-
function useCopySchemaLink(name) {
|
|
120
|
-
const { path, rootId } = usePathState();
|
|
121
|
-
return useCopyButton(() => {
|
|
122
|
-
const url = new URL(window.location.href);
|
|
123
|
-
url.hash = `#${rootId}`;
|
|
124
|
-
url.searchParams.set("s-highlight", name);
|
|
125
|
-
url.searchParams.set("path", encodePath(path));
|
|
126
|
-
return navigator.clipboard.writeText(url.href);
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
function encodePath(path) {
|
|
130
|
-
return path.map((item) => [
|
|
131
|
-
item.name,
|
|
132
|
-
item.$ref,
|
|
133
|
-
...item.tabValues ?? []
|
|
134
|
-
].join("\0")).join("|");
|
|
135
|
-
}
|
|
136
|
-
function decodePath(path, highlighted) {
|
|
137
|
-
const out = [];
|
|
138
|
-
for (const part of path.split("|")) {
|
|
139
|
-
const [name, $ref, ...tabValues] = part.split("\0");
|
|
140
|
-
out.push({
|
|
141
|
-
name,
|
|
142
|
-
$ref,
|
|
143
|
-
tabValues
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
if (highlighted && out.length > 0) out[out.length - 1].highlighted = highlighted;
|
|
147
|
-
return out;
|
|
148
|
-
}
|
|
149
|
-
const typeVariants = cva("text-sm text-start text-fd-muted-foreground font-mono", { variants: { variant: { trigger: "underline hover:text-fd-accent-foreground data-[popup-open]:text-fd-accent-foreground" } } });
|
|
150
|
-
/** how a type opens its schema: a popover from the root, navigation inside the popover */
|
|
151
|
-
const TriggerContext = createContext((props) => /* @__PURE__ */ jsx(RootTypeInfoTrigger, { ...props }));
|
|
152
|
-
const renderPopoverTrigger = (props) => /* @__PURE__ */ jsx(PopoverTypeInfoTrigger, { ...props });
|
|
153
|
-
function SchemaUI({ rootId, name, required = false, as = "property", generated }) {
|
|
15
|
+
const TypeContext = createContext(null);
|
|
16
|
+
const typeClassName = "font-mono text-xs text-fd-muted-foreground";
|
|
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";
|
|
18
|
+
const chevronClassName = "size-3.5 shrink-0 text-fd-muted-foreground/60";
|
|
19
|
+
/** below the sticky headers of docs layouts */
|
|
20
|
+
const scrollMarginClassName = "scroll-mt-[calc(var(--fd-docs-row-3,0px)+1rem)]";
|
|
21
|
+
const tagClassName = "rounded-md border bg-fd-secondary px-1.5 py-0.5 text-xs text-fd-secondary-foreground";
|
|
22
|
+
function SchemaUI({ rootId, name, required = false, as = "property", selector, actions, generated }) {
|
|
154
23
|
return /* @__PURE__ */ jsx(SchemaUIProvider, {
|
|
155
|
-
rootId,
|
|
24
|
+
id: rootId,
|
|
156
25
|
name,
|
|
157
26
|
generated,
|
|
158
|
-
children: /* @__PURE__ */ jsx(
|
|
27
|
+
children: as === "body" && generated.refs[generated.$root].type !== "primitive" ? /* @__PURE__ */ jsx(SchemaCard, {
|
|
28
|
+
id: rootId,
|
|
29
|
+
selector,
|
|
30
|
+
actions
|
|
31
|
+
}) : /* @__PURE__ */ jsx(RootProperty, {
|
|
32
|
+
id: rootId,
|
|
159
33
|
name,
|
|
34
|
+
$type: generated.$root,
|
|
160
35
|
required,
|
|
161
|
-
|
|
36
|
+
actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [selector, actions] })
|
|
162
37
|
})
|
|
163
38
|
});
|
|
164
39
|
}
|
|
165
|
-
function
|
|
166
|
-
const {
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
name
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
},
|
|
200
|
-
children: /* @__PURE__ */ jsx(SchemaUIPopover, {})
|
|
201
|
-
})]
|
|
40
|
+
function RootProperty({ id, name, $type, required, actions }) {
|
|
41
|
+
const { refs, path, open, back } = useSchemaUI();
|
|
42
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
43
|
+
function isExpanded(name, $ref) {
|
|
44
|
+
return !collapsed && path[1]?.name === name && path[1].$ref === $ref;
|
|
45
|
+
}
|
|
46
|
+
return /* @__PURE__ */ jsx(TypeContext, {
|
|
47
|
+
value: {
|
|
48
|
+
isExpanded,
|
|
49
|
+
open(name, $ref) {
|
|
50
|
+
if (isExpanded(name, $ref)) return setCollapsed(true);
|
|
51
|
+
setCollapsed(false);
|
|
52
|
+
back(0);
|
|
53
|
+
open(name, $ref);
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
children: /* @__PURE__ */ jsx(ObjectProperty, {
|
|
57
|
+
id,
|
|
58
|
+
name,
|
|
59
|
+
$type,
|
|
60
|
+
required,
|
|
61
|
+
parentIndex: 0,
|
|
62
|
+
actions,
|
|
63
|
+
children: refs[$type].type !== "primitive" && /* @__PURE__ */ jsx(Collapsible, {
|
|
64
|
+
open: !collapsed && path.length > 1,
|
|
65
|
+
children: /* @__PURE__ */ jsx(CollapsibleContent, {
|
|
66
|
+
className: "flow-root overflow-clip",
|
|
67
|
+
children: /* @__PURE__ */ jsx(SchemaCard, {
|
|
68
|
+
from: 1,
|
|
69
|
+
className: "mt-2.5"
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})
|
|
202
74
|
});
|
|
203
75
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
const { open } = useSchemaUI();
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
76
|
+
const motionClassNames = {
|
|
77
|
+
forward: "motion-safe:starting:translate-x-6",
|
|
78
|
+
back: "motion-safe:starting:-translate-x-6"
|
|
79
|
+
};
|
|
80
|
+
/** the last schema of the path, with the path from `from` as breadcrumbs */
|
|
81
|
+
function SchemaCard({ from = 0, id, selector, actions, className }) {
|
|
82
|
+
const t = useTranslations({ note: "schema UI" });
|
|
83
|
+
const { path, open, back } = useSchemaUI();
|
|
84
|
+
const index = path.length - 1;
|
|
85
|
+
const { name, $ref, unions, schema } = path[index];
|
|
86
|
+
const panelKey = `${index}\0${name}\0${$ref}`;
|
|
87
|
+
const [filter, setFilter] = useState({
|
|
88
|
+
key: panelKey,
|
|
89
|
+
value: ""
|
|
216
90
|
});
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
91
|
+
const search = filter.key === panelKey ? filter.value : "";
|
|
92
|
+
const query = search.trim().toLowerCase();
|
|
93
|
+
const [motion, setMotion] = useState();
|
|
94
|
+
const headerRef = useRef(null);
|
|
95
|
+
const filterable = schema.type === "object" && schema.props.length > 0;
|
|
96
|
+
const described = from > 0 && index === from && $ref === path[0].$ref;
|
|
97
|
+
let content = null;
|
|
98
|
+
function navigate(direction, update) {
|
|
99
|
+
flushSync(() => {
|
|
100
|
+
setMotion(direction);
|
|
101
|
+
update();
|
|
102
|
+
});
|
|
103
|
+
headerRef.current?.scrollIntoView({
|
|
104
|
+
behavior: "smooth",
|
|
105
|
+
block: "nearest"
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (schema.type === "object") {
|
|
109
|
+
const props = [];
|
|
110
|
+
for (const prop of schema.props) {
|
|
111
|
+
if (query && !prop.name.toLowerCase().includes(query)) continue;
|
|
112
|
+
props.push(/* @__PURE__ */ jsx(ObjectProperty, {
|
|
113
|
+
name: prop.name,
|
|
114
|
+
$type: prop.$type,
|
|
115
|
+
required: prop.required,
|
|
116
|
+
parentIndex: index
|
|
117
|
+
}, prop.name));
|
|
118
|
+
}
|
|
119
|
+
content = props;
|
|
120
|
+
if (props.length === 0 && query) content = /* @__PURE__ */ jsxs("div", {
|
|
121
|
+
className: "not-prose my-3 flex flex-col items-center gap-3 rounded-lg border border-dashed px-4 py-6 text-center text-fd-muted-foreground",
|
|
122
|
+
children: [/* @__PURE__ */ jsx(FilterXIcon, { className: "box-content size-4 rounded-lg border bg-fd-secondary p-2" }), /* @__PURE__ */ jsxs("p", { children: [
|
|
123
|
+
t("No property matching"),
|
|
124
|
+
" ",
|
|
125
|
+
/* @__PURE__ */ jsx("span", {
|
|
126
|
+
className: "font-medium break-all text-fd-foreground",
|
|
127
|
+
children: `"${search}"`
|
|
128
|
+
})
|
|
129
|
+
] })]
|
|
130
|
+
});
|
|
131
|
+
} else if (schema.type === "array") content = /* @__PURE__ */ jsx(ObjectProperty, {
|
|
132
|
+
name: "[index: integer]",
|
|
133
|
+
$type: schema.item.$type,
|
|
134
|
+
parentIndex: index
|
|
239
135
|
});
|
|
240
|
-
}
|
|
241
|
-
function ObjectProperty({ name, $type, required, parentPathIndex, ...props }) {
|
|
242
|
-
const t = useTranslations({ note: "schema UI" });
|
|
243
|
-
const { generated: { refs } } = useSchemaUI();
|
|
244
|
-
const schema = refs[$type];
|
|
245
|
-
const [highlighted, ref] = useSchemaHighlight(parentPathIndex, name);
|
|
246
|
-
const [isChecked, onClick] = useCopySchemaLink(name);
|
|
247
136
|
return /* @__PURE__ */ jsxs("div", {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
className: cn("text-sm border-t py-4 scroll-m-20 first:border-t-0", props.className),
|
|
137
|
+
id,
|
|
138
|
+
className: cn("@container overflow-clip rounded-xl border bg-fd-card text-fd-card-foreground", scrollMarginClassName, className),
|
|
251
139
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
252
|
-
|
|
140
|
+
ref: headerRef,
|
|
141
|
+
className: cn("not-prose flex flex-wrap border-b", scrollMarginClassName),
|
|
253
142
|
children: [
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
-
className: "
|
|
256
|
-
children:
|
|
257
|
-
className: cn(highlighted ? "bg-fd-primary text-fd-primary-foreground rounded-sm" : "text-fd-primary", schema.deprecated && "line-through opacity-80"),
|
|
258
|
-
children: name
|
|
259
|
-
}), required ? /* @__PURE__ */ jsx("span", {
|
|
260
|
-
className: "text-red-400",
|
|
261
|
-
children: "*"
|
|
262
|
-
}) : /* @__PURE__ */ jsx("span", {
|
|
263
|
-
className: "text-fd-muted-foreground",
|
|
264
|
-
children: "?"
|
|
265
|
-
})]
|
|
143
|
+
selector && /* @__PURE__ */ jsx("div", {
|
|
144
|
+
className: "flex h-9 basis-full items-center border-b ps-1.5 pe-1 text-[0.8125rem]",
|
|
145
|
+
children: selector
|
|
266
146
|
}),
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
pathName: name,
|
|
272
|
-
$ref: $type,
|
|
273
|
-
children: schema.aliasName
|
|
147
|
+
/* @__PURE__ */ jsx(Breadcrumbs, {
|
|
148
|
+
from,
|
|
149
|
+
unions,
|
|
150
|
+
onBack: (index) => navigate("back", () => back(index))
|
|
274
151
|
}),
|
|
275
|
-
/* @__PURE__ */
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
})]
|
|
152
|
+
(filterable || actions) && /* @__PURE__ */ jsxs("div", {
|
|
153
|
+
className: cn("flex h-9 items-center gap-1 pe-1", filterable && "@max-xl:basis-full @max-xl:border-t @max-xl:ps-1.5"),
|
|
154
|
+
children: [filterable && /* @__PURE__ */ jsxs("label", {
|
|
155
|
+
className: "flex h-7 cursor-text items-center gap-1.5 rounded-md border bg-fd-secondary px-2 text-fd-muted-foreground transition-shadow focus-within:ring-1 focus-within:ring-fd-ring @max-xl:flex-1 @xl:w-40",
|
|
156
|
+
children: [/* @__PURE__ */ jsx(FilterIcon, { className: "size-3.5 shrink-0" }), /* @__PURE__ */ jsx("input", {
|
|
157
|
+
value: search,
|
|
158
|
+
onChange: (e) => setFilter({
|
|
159
|
+
key: panelKey,
|
|
160
|
+
value: e.target.value
|
|
161
|
+
}),
|
|
162
|
+
"aria-label": t("Filter Properties"),
|
|
163
|
+
placeholder: t("Filter Properties"),
|
|
164
|
+
className: "min-w-0 flex-1 bg-transparent text-[0.8125rem] text-fd-foreground outline-none placeholder:text-fd-muted-foreground"
|
|
165
|
+
})]
|
|
166
|
+
}), actions]
|
|
291
167
|
})
|
|
292
168
|
]
|
|
293
|
-
}), /* @__PURE__ */ jsx(
|
|
294
|
-
|
|
295
|
-
|
|
169
|
+
}), /* @__PURE__ */ jsx(TypeContext, {
|
|
170
|
+
value: { open: (name, $ref) => navigate("forward", () => open(name, $ref)) },
|
|
171
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
172
|
+
className: cn("px-3", motion && "starting:opacity-0 motion-safe:transition-[opacity,translate] motion-safe:duration-300 motion-safe:ease-[cubic-bezier(0.16,1,0.3,1)]", motion && motionClassNames[motion]),
|
|
173
|
+
children: [!described && /* @__PURE__ */ jsx(SchemaDescription, {
|
|
174
|
+
schema,
|
|
175
|
+
className: "py-2.5"
|
|
176
|
+
}), content]
|
|
177
|
+
}, panelKey)
|
|
296
178
|
})]
|
|
297
179
|
});
|
|
298
180
|
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
}), /* @__PURE__ */ jsx(PathItemBody, {
|
|
333
|
-
asSchema: refs[value],
|
|
334
|
-
pathIndex,
|
|
335
|
-
tabDepth: tabDepth + 1
|
|
181
|
+
/**
|
|
182
|
+
* The path from `from`, the crumbs between the first and last ones collapse into a menu when they don't fit.
|
|
183
|
+
*/
|
|
184
|
+
function Breadcrumbs({ from, unions, onBack }) {
|
|
185
|
+
const t = useTranslations({ note: "schema UI" });
|
|
186
|
+
const { path } = useSchemaUI();
|
|
187
|
+
const last = path.length - 1;
|
|
188
|
+
const [collapsed, setCollapsed] = useState(0);
|
|
189
|
+
const measure = useCallback((copy) => {
|
|
190
|
+
if (!copy) return;
|
|
191
|
+
const element = copy.parentElement;
|
|
192
|
+
const after = copy.previousElementSibling;
|
|
193
|
+
const update = () => setCollapsed(countCollapsed(copy, element.clientWidth - after.getBoundingClientRect().width));
|
|
194
|
+
const observer = new ResizeObserver(update);
|
|
195
|
+
update();
|
|
196
|
+
observer.observe(element);
|
|
197
|
+
observer.observe(after);
|
|
198
|
+
return () => observer.disconnect();
|
|
199
|
+
}, []);
|
|
200
|
+
const hidden = Math.min(collapsed, Math.max(0, last - from - 1));
|
|
201
|
+
const crumbs = [];
|
|
202
|
+
const menuItems = [];
|
|
203
|
+
const copy = [];
|
|
204
|
+
let names = "";
|
|
205
|
+
for (let i = from; i <= last; i++) {
|
|
206
|
+
const name = formatName(path[i].name);
|
|
207
|
+
const chevron = i > from && /* @__PURE__ */ jsx(ChevronRightIcon, { className: chevronClassName });
|
|
208
|
+
names += `${name}\0`;
|
|
209
|
+
copy.push(/* @__PURE__ */ jsxs("li", {
|
|
210
|
+
className: "flex items-center gap-0.5",
|
|
211
|
+
children: [chevron, /* @__PURE__ */ jsx("span", {
|
|
212
|
+
className: cn("px-1.5 py-1", i === last && "font-medium"),
|
|
213
|
+
children: name
|
|
336
214
|
})]
|
|
337
|
-
});
|
|
215
|
+
}, i));
|
|
216
|
+
if (i > from && i <= from + hidden) {
|
|
217
|
+
menuItems.push(/* @__PURE__ */ jsx(Menu.Item, {
|
|
218
|
+
onClick: () => onBack(i),
|
|
219
|
+
className: "truncate rounded-md px-2 py-1.5 outline-none data-highlighted:bg-fd-accent data-highlighted:text-fd-accent-foreground",
|
|
220
|
+
children: name
|
|
221
|
+
}, i));
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
crumbs.push(/* @__PURE__ */ jsxs("li", {
|
|
225
|
+
className: cn("flex items-center gap-0.5 overflow-hidden", i > from && "motion-safe:transition-opacity motion-safe:starting:opacity-0"),
|
|
226
|
+
children: [chevron, i < last ? /* @__PURE__ */ jsx("button", {
|
|
227
|
+
type: "button",
|
|
228
|
+
onClick: () => onBack(i),
|
|
229
|
+
className: crumbClassName,
|
|
230
|
+
children: name
|
|
231
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
232
|
+
"aria-current": "page",
|
|
233
|
+
className: "truncate px-1.5 py-1 font-medium",
|
|
234
|
+
children: name
|
|
235
|
+
})]
|
|
236
|
+
}, i));
|
|
338
237
|
}
|
|
339
|
-
if (
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
238
|
+
if (menuItems.length > 0) crumbs.splice(1, 0, /* @__PURE__ */ jsxs("li", {
|
|
239
|
+
className: "flex items-center gap-0.5",
|
|
240
|
+
children: [/* @__PURE__ */ jsx(ChevronRightIcon, { className: chevronClassName }), /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
241
|
+
"aria-label": t("Show Path", { note: "aria-label" }),
|
|
242
|
+
className: crumbClassName,
|
|
243
|
+
children: "…"
|
|
244
|
+
}), /* @__PURE__ */ jsx(Menu.Portal, { children: /* @__PURE__ */ jsx(Menu.Positioner, {
|
|
245
|
+
align: "start",
|
|
246
|
+
sideOffset: 4,
|
|
247
|
+
className: "z-50",
|
|
248
|
+
children: /* @__PURE__ */ jsx(Menu.Popup, {
|
|
249
|
+
className: "flex max-h-(--available-height) max-w-72 min-w-40 origin-(--transform-origin) flex-col overflow-y-auto rounded-xl border bg-fd-popover p-1 font-mono text-[0.8125rem] text-fd-popover-foreground shadow-lg outline-none transition-[opacity,scale] duration-150 ease-[cubic-bezier(0.22,1,0.36,1)] data-ending-style:scale-[0.97] data-ending-style:opacity-0 data-starting-style:scale-95 data-starting-style:opacity-0 motion-reduce:transition-none",
|
|
250
|
+
children: menuItems
|
|
251
|
+
})
|
|
252
|
+
}) })] })]
|
|
253
|
+
}, "menu"));
|
|
254
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
255
|
+
className: "relative ms-1.5 me-1 flex h-9 min-w-0 flex-1 items-center font-mono text-[0.8125rem]",
|
|
256
|
+
children: [
|
|
257
|
+
/* @__PURE__ */ jsx("ol", {
|
|
258
|
+
className: "grid min-w-0 auto-cols-[minmax(0,max-content)] grid-flow-col items-center",
|
|
259
|
+
children: crumbs
|
|
260
|
+
}),
|
|
261
|
+
/* @__PURE__ */ jsx("div", {
|
|
262
|
+
className: "flex min-w-0 items-center gap-0.5",
|
|
263
|
+
children: unions.map((union, depth) => /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(ChevronRightIcon, { className: chevronClassName }), /* @__PURE__ */ jsx(UnionSelect, { union })] }, depth))
|
|
264
|
+
}),
|
|
265
|
+
/* @__PURE__ */ jsxs("ol", {
|
|
266
|
+
ref: measure,
|
|
267
|
+
"aria-hidden": true,
|
|
268
|
+
className: "invisible absolute top-0 flex w-max",
|
|
269
|
+
children: [copy, /* @__PURE__ */ jsxs("li", {
|
|
270
|
+
className: "flex items-center gap-0.5",
|
|
271
|
+
children: [/* @__PURE__ */ jsx(ChevronRightIcon, { className: chevronClassName }), /* @__PURE__ */ jsx("span", {
|
|
272
|
+
className: "px-1.5 py-1",
|
|
273
|
+
children: "…"
|
|
274
|
+
})]
|
|
275
|
+
})]
|
|
276
|
+
}, names)
|
|
277
|
+
]
|
|
344
278
|
});
|
|
345
|
-
if (schema.type === "array") return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(SchemaDescription, { schema }), /* @__PURE__ */ jsx(ObjectProperty, {
|
|
346
|
-
name: "[index: integer]",
|
|
347
|
-
$type: schema.item.$type,
|
|
348
|
-
parentPathIndex: pathIndex
|
|
349
|
-
})] });
|
|
350
|
-
return /* @__PURE__ */ jsx(SchemaDescription, { schema });
|
|
351
279
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
const
|
|
355
|
-
const
|
|
356
|
-
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
"data-object-search-input": "",
|
|
364
|
-
onChange: (e) => setSearch(e.target.value),
|
|
365
|
-
placeholder: t("Filter Properties"),
|
|
366
|
-
className: "text-sm ps-2 py-2 flex-1 outline-none placeholder:text-fd-muted-foreground",
|
|
367
|
-
onKeyDown: (e) => {
|
|
368
|
-
if (e.key === "Enter") {
|
|
369
|
-
const item = firstItemRef.current;
|
|
370
|
-
if (item) open(item.name, item.$type);
|
|
371
|
-
e.preventDefault();
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
})]
|
|
375
|
-
}),
|
|
376
|
-
children,
|
|
377
|
-
/* @__PURE__ */ jsx(Suspense, { children: /* @__PURE__ */ jsx(ObjectSearchContent, {
|
|
378
|
-
search: deferredValue,
|
|
379
|
-
properties: schema.props,
|
|
380
|
-
firstItemRef,
|
|
381
|
-
empty: () => /* @__PURE__ */ jsxs("p", {
|
|
382
|
-
className: "text-fd-muted-foreground text-sm my-2!",
|
|
383
|
-
children: [
|
|
384
|
-
t("No property matching"),
|
|
385
|
-
" ",
|
|
386
|
-
/* @__PURE__ */ jsx("span", {
|
|
387
|
-
className: "text-fd-foreground font-medium",
|
|
388
|
-
children: `"${deferredValue}"`
|
|
389
|
-
})
|
|
390
|
-
]
|
|
391
|
-
}),
|
|
392
|
-
render: (item) => /* @__PURE__ */ jsx(ObjectProperty, {
|
|
393
|
-
name: item.name,
|
|
394
|
-
$type: item.$type,
|
|
395
|
-
required: item.required,
|
|
396
|
-
parentPathIndex: pathIndex
|
|
397
|
-
}, item.name)
|
|
398
|
-
}) })
|
|
399
|
-
] });
|
|
280
|
+
/** the number of crumbs after the first one to collapse, measured from the hidden copy of all crumbs */
|
|
281
|
+
function countCollapsed(copy, available) {
|
|
282
|
+
const widths = Array.from(copy.children, (child) => child.getBoundingClientRect().width);
|
|
283
|
+
const menu = widths.pop();
|
|
284
|
+
let total = 0;
|
|
285
|
+
for (const width of widths) total += width;
|
|
286
|
+
if (total <= available) return 0;
|
|
287
|
+
let count = 0;
|
|
288
|
+
total += menu;
|
|
289
|
+
while (count < widths.length - 2 && total > available) total -= widths[++count];
|
|
290
|
+
return count;
|
|
400
291
|
}
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
}, [properties, rawSearch]);
|
|
406
|
-
firstItemRef.current = filtered[0] ?? null;
|
|
407
|
-
if (filtered.length === 0) return empty();
|
|
408
|
-
return filtered.map(render);
|
|
292
|
+
/** shorten the names of items and additional properties, like `[index]` */
|
|
293
|
+
function formatName(name) {
|
|
294
|
+
const match = /^\[(\w+): \w+]$/.exec(name);
|
|
295
|
+
return match ? `[${match[1]}]` : name;
|
|
409
296
|
}
|
|
410
|
-
function
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
className: "font-
|
|
425
|
-
children: label
|
|
426
|
-
}
|
|
427
|
-
className: "min-w-0 flex-1 text-fd-muted-foreground wrap-break-word",
|
|
428
|
-
children
|
|
429
|
-
})]
|
|
297
|
+
function UnionSelect({ union: { schema, value, select } }) {
|
|
298
|
+
const items = schema.items.map((item) => ({
|
|
299
|
+
label: item.name,
|
|
300
|
+
value: item.$type
|
|
301
|
+
}));
|
|
302
|
+
return /* @__PURE__ */ jsxs(Select, {
|
|
303
|
+
items,
|
|
304
|
+
value,
|
|
305
|
+
onValueChange: (v) => v && select(v),
|
|
306
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
307
|
+
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
|
+
children: /* @__PURE__ */ jsx(SelectValue, { className: "truncate" })
|
|
309
|
+
}), /* @__PURE__ */ jsx(SelectContent, { children: items.map((item) => /* @__PURE__ */ jsx(SelectItem, {
|
|
310
|
+
value: item.value,
|
|
311
|
+
className: "font-mono text-[0.8125rem]",
|
|
312
|
+
children: item.label
|
|
313
|
+
}, item.value)) })]
|
|
430
314
|
});
|
|
431
315
|
}
|
|
432
|
-
function
|
|
316
|
+
function ObjectProperty({ id, name, $type, required = false, parentIndex, actions, children }) {
|
|
317
|
+
const t = useTranslations({ note: "schema UI" });
|
|
318
|
+
const { refs, path, highlighted, getLink } = useSchemaUI();
|
|
319
|
+
const schema = refs[$type];
|
|
320
|
+
const isHighlighted = highlighted === name && parentIndex === path.length - 1;
|
|
321
|
+
const [isChecked, onCopy] = useCopyButton(() => navigator.clipboard.writeText(getLink(parentIndex, name)));
|
|
322
|
+
const ref = useCallback((element) => {
|
|
323
|
+
if (!element || !isHighlighted) return;
|
|
324
|
+
const timer = window.setTimeout(() => {
|
|
325
|
+
element.scrollIntoView({
|
|
326
|
+
behavior: "smooth",
|
|
327
|
+
block: "center"
|
|
328
|
+
});
|
|
329
|
+
}, 300);
|
|
330
|
+
return () => window.clearTimeout(timer);
|
|
331
|
+
}, [isHighlighted]);
|
|
433
332
|
return /* @__PURE__ */ jsxs("div", {
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
className:
|
|
464
|
-
children:
|
|
465
|
-
},
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
333
|
+
id,
|
|
334
|
+
ref,
|
|
335
|
+
className: "group/property scroll-m-20 border-t py-2.5 first:border-t-0",
|
|
336
|
+
children: [
|
|
337
|
+
/* @__PURE__ */ jsxs("div", {
|
|
338
|
+
className: "not-prose flex flex-wrap items-center gap-x-2 gap-y-1",
|
|
339
|
+
children: [
|
|
340
|
+
/* @__PURE__ */ jsxs("code", {
|
|
341
|
+
className: "text-[0.8125rem] font-medium",
|
|
342
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
343
|
+
className: cn(isHighlighted ? "rounded-sm bg-fd-primary text-fd-primary-foreground" : "text-fd-primary", schema.deprecated && "line-through opacity-80"),
|
|
344
|
+
children: name
|
|
345
|
+
}), required ? /* @__PURE__ */ jsx("span", {
|
|
346
|
+
className: "text-red-400",
|
|
347
|
+
children: "*"
|
|
348
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
349
|
+
className: "text-fd-muted-foreground",
|
|
350
|
+
children: "?"
|
|
351
|
+
})]
|
|
352
|
+
}),
|
|
353
|
+
schema.type === "primitive" ? /* @__PURE__ */ jsx("span", {
|
|
354
|
+
className: typeClassName,
|
|
355
|
+
children: schema.aliasName
|
|
356
|
+
}) : /* @__PURE__ */ jsx(TypeInfo, {
|
|
357
|
+
name,
|
|
358
|
+
$ref: $type,
|
|
359
|
+
children: schema.aliasName
|
|
360
|
+
}),
|
|
361
|
+
schema.deprecated && /* @__PURE__ */ jsx("span", {
|
|
362
|
+
className: "font-mono text-xs text-yellow-600 dark:text-yellow-400",
|
|
363
|
+
children: t("Deprecated")
|
|
364
|
+
}),
|
|
365
|
+
/* @__PURE__ */ jsxs("button", {
|
|
366
|
+
type: "button",
|
|
367
|
+
"aria-live": "polite",
|
|
368
|
+
onClick: onCopy,
|
|
369
|
+
className: cn(buttonVariants({
|
|
370
|
+
size: "icon-xs",
|
|
371
|
+
variant: "ghost"
|
|
372
|
+
}), "-my-1 ms-auto text-fd-muted-foreground opacity-0 transition-opacity group-hover/property:opacity-100 focus-visible:opacity-100 pointer-coarse:opacity-100 [&_svg]:size-3.5"),
|
|
373
|
+
children: [isChecked ? /* @__PURE__ */ jsx(CheckIcon, {}) : /* @__PURE__ */ jsx(LinkIcon, {}), /* @__PURE__ */ jsx("span", {
|
|
374
|
+
className: "sr-only",
|
|
375
|
+
children: isChecked ? t("Copied Link", { note: "aria-label" }) : t("Copy Link", { note: "aria-label" })
|
|
376
|
+
})]
|
|
377
|
+
}),
|
|
378
|
+
actions
|
|
379
|
+
]
|
|
380
|
+
}),
|
|
381
|
+
/* @__PURE__ */ jsx(SchemaDescription, {
|
|
382
|
+
schema,
|
|
383
|
+
className: "mt-1"
|
|
384
|
+
}),
|
|
385
|
+
children
|
|
386
|
+
]
|
|
472
387
|
});
|
|
473
388
|
}
|
|
474
|
-
function
|
|
475
|
-
const {
|
|
476
|
-
const
|
|
389
|
+
function TypeInfo({ name, $ref, children }) {
|
|
390
|
+
const { refs } = useSchemaUI();
|
|
391
|
+
const { open, isExpanded } = use(TypeContext);
|
|
477
392
|
const schema = refs[$ref];
|
|
478
|
-
if (schema.type === "primitive" && !schema.description &&
|
|
479
|
-
className:
|
|
393
|
+
if (schema.type === "primitive" && !schema.description && !schema.infoTags?.length) return /* @__PURE__ */ jsx("span", {
|
|
394
|
+
className: typeClassName,
|
|
480
395
|
children
|
|
481
396
|
});
|
|
482
|
-
if (schema.type === "and" || schema.type === "or") {
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
})] }, item.$type))
|
|
491
|
-
});
|
|
492
|
-
}
|
|
397
|
+
if (schema.type === "and" || schema.type === "or") return /* @__PURE__ */ jsx("span", {
|
|
398
|
+
className: cn(typeClassName, "flex flex-wrap items-center gap-1.5"),
|
|
399
|
+
children: schema.items.map((item, i) => /* @__PURE__ */ jsxs(Fragment, { children: [i > 0 && (schema.type === "and" ? "&" : "|"), /* @__PURE__ */ jsx(TypeInfo, {
|
|
400
|
+
name,
|
|
401
|
+
$ref: item.$type,
|
|
402
|
+
children: item.name
|
|
403
|
+
})] }, item.$type))
|
|
404
|
+
});
|
|
493
405
|
if (schema.type === "array") return /* @__PURE__ */ jsxs("span", {
|
|
494
|
-
className: cn(
|
|
406
|
+
className: cn(typeClassName, "flex flex-wrap items-center"),
|
|
495
407
|
children: [
|
|
496
408
|
"array<",
|
|
497
|
-
/* @__PURE__ */ jsx(
|
|
498
|
-
|
|
409
|
+
/* @__PURE__ */ jsx(TypeInfo, {
|
|
410
|
+
name: `${name}[]`,
|
|
499
411
|
$ref: schema.item.$type,
|
|
500
412
|
children: refs[schema.item.$type].aliasName
|
|
501
413
|
}),
|
|
502
414
|
">"
|
|
503
415
|
]
|
|
504
416
|
});
|
|
505
|
-
return
|
|
506
|
-
|
|
507
|
-
$ref,
|
|
417
|
+
return /* @__PURE__ */ jsx("button", {
|
|
418
|
+
type: "button",
|
|
419
|
+
"aria-expanded": isExpanded?.(name, $ref),
|
|
420
|
+
onClick: () => open(name, $ref),
|
|
421
|
+
className: cn(typeClassName, "text-start underline decoration-dotted underline-offset-4 transition-colors hover:text-fd-accent-foreground aria-expanded:text-fd-accent-foreground aria-expanded:decoration-solid"),
|
|
508
422
|
children
|
|
509
423
|
});
|
|
510
424
|
}
|
|
425
|
+
function SchemaDescription({ schema: { description, infoTags = [] }, className }) {
|
|
426
|
+
if (!description && infoTags.length === 0) return null;
|
|
427
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
428
|
+
className: cn("flex flex-col gap-2 text-fd-muted-foreground", className),
|
|
429
|
+
children: [description && /* @__PURE__ */ jsx("div", {
|
|
430
|
+
className: "prose-no-margin",
|
|
431
|
+
children: description
|
|
432
|
+
}), infoTags.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
433
|
+
className: "flex flex-wrap gap-1.5",
|
|
434
|
+
children: infoTags.map((tag, i) => {
|
|
435
|
+
if ("node" in tag) return /* @__PURE__ */ jsx(Fragment, { children: tag.node }, i);
|
|
436
|
+
if ("list" in tag) return /* @__PURE__ */ jsxs("div", {
|
|
437
|
+
className: "not-prose flex w-full flex-wrap items-center gap-1.5 text-xs",
|
|
438
|
+
children: [tag.label, tag.list.map((item, j) => /* @__PURE__ */ jsx("code", {
|
|
439
|
+
className: tagClassName,
|
|
440
|
+
children: item
|
|
441
|
+
}, j))]
|
|
442
|
+
}, i);
|
|
443
|
+
if (tag.block) return /* @__PURE__ */ jsxs("div", {
|
|
444
|
+
className: "not-prose flex w-full flex-col gap-1.5 text-xs",
|
|
445
|
+
children: [tag.label, tag.value]
|
|
446
|
+
}, i);
|
|
447
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
448
|
+
className: cn(tagClassName, "inline-flex max-w-full items-baseline gap-1.5"),
|
|
449
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
450
|
+
className: "not-prose shrink-0 text-fd-muted-foreground",
|
|
451
|
+
children: tag.label
|
|
452
|
+
}), tag.prose ? /* @__PURE__ */ jsx("div", {
|
|
453
|
+
className: "prose-sm prose-no-margin min-w-0 flex-1",
|
|
454
|
+
children: tag.value
|
|
455
|
+
}) : /* @__PURE__ */ jsx("code", {
|
|
456
|
+
className: "not-prose min-w-0 wrap-break-word",
|
|
457
|
+
children: tag.value
|
|
458
|
+
})]
|
|
459
|
+
}, i);
|
|
460
|
+
})
|
|
461
|
+
})]
|
|
462
|
+
});
|
|
463
|
+
}
|
|
511
464
|
//#endregion
|
|
512
|
-
export {
|
|
465
|
+
export { SchemaUI };
|