@clarify-labs/renderer 0.7.1 → 0.8.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/output/{ThemeRoot-CLa0yvRQ.js → ClarifyShell-BxB_6Uhd.js} +292 -141
- package/output/ClarifyShell-BxB_6Uhd.js.map +1 -0
- package/output/{ThemeRoot-DYS-lcK-.cjs → ClarifyShell-DNN5erFD.cjs} +320 -145
- package/output/ClarifyShell-DNN5erFD.cjs.map +1 -0
- package/output/{OpenApiOperation-C4xZu4i0.cjs → OpenApiOperation-9SvCA_B4.cjs} +327 -83
- package/output/OpenApiOperation-9SvCA_B4.cjs.map +1 -0
- package/output/{OpenApiOperation-LIL7bqxW.js → OpenApiOperation-J41rHO2l.js} +323 -85
- package/output/OpenApiOperation-J41rHO2l.js.map +1 -0
- package/output/{PageActions-yoDRjkq8.js → PageActions-DR0asnKH.js} +30 -69
- package/output/PageActions-DR0asnKH.js.map +1 -0
- package/output/{PageActions-1RDCHcUY.cjs → PageActions-yycPlNyL.cjs} +35 -68
- package/output/PageActions-yycPlNyL.cjs.map +1 -0
- package/output/app/AppShell.d.ts +2 -3
- package/output/app/PageBanner.d.ts +0 -2
- package/output/app/PageFooter.d.ts +1 -5
- package/output/client.cjs +8 -8
- package/output/client.js +3 -3
- package/output/components/Code.d.ts +5 -1
- package/output/components/Mermaid.d.ts +7 -0
- package/output/components/index.d.ts +1 -0
- package/output/context.d.ts +1 -1
- package/output/core/i18n.d.ts +1 -1
- package/output/core/types.d.ts +7 -14
- package/output/index.cjs +27 -24
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +7 -4
- package/output/index.js +14 -14
- package/output/index.js.map +1 -1
- package/output/mdx/components.d.ts +4 -0
- package/output/mdx/primitives.d.ts +2 -0
- package/output/openapi/components/EndpointSections.d.ts +30 -0
- package/output/preview.cjs +2 -2
- package/output/preview.cjs.map +1 -1
- package/output/preview.js +2 -2
- package/output/preview.js.map +1 -1
- package/output/{render-CRTqZzyY.cjs → render-CWvm77UW.cjs} +10 -20
- package/output/render-CWvm77UW.cjs.map +1 -0
- package/output/{render-D0ls3d2j.js → render-mGozubG5.js} +10 -20
- package/output/render-mGozubG5.js.map +1 -0
- package/output/renderer.css +83 -24
- package/output/runtime/ClarifyShell.d.ts +22 -0
- package/output/server.cjs +10 -19
- package/output/server.cjs.map +1 -1
- package/output/server.js +10 -19
- package/output/server.js.map +1 -1
- package/output/shell/search/pagefind.d.ts +0 -1
- package/output/slots/RuntimeSlot.d.ts +58 -0
- package/output/slots/context.d.ts +20 -0
- package/output/slots/index.d.ts +5 -0
- package/output/slots/types.d.ts +50 -0
- package/output/utils/localized-text.d.ts +7 -0
- package/package.json +8 -3
- package/output/OpenApiOperation-C4xZu4i0.cjs.map +0 -1
- package/output/OpenApiOperation-LIL7bqxW.js.map +0 -1
- package/output/PageActions-1RDCHcUY.cjs.map +0 -1
- package/output/PageActions-yoDRjkq8.js.map +0 -1
- package/output/ThemeRoot-CLa0yvRQ.js.map +0 -1
- package/output/ThemeRoot-DYS-lcK-.cjs.map +0 -1
- package/output/render-CRTqZzyY.cjs.map +0 -1
- package/output/render-D0ls3d2j.js.map +0 -1
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { D as copyTextToClipboard, M as useConfig, N as useLocale, O as useBuiltInText, T as localizeHref, c as remToPx, g as useTheme, l as lucideIconRegistry, n as PageTitleActions, s as useSectionStore, u as resolveLucideIconName, w as isExternalHref } from "./PageActions-DR0asnKH.js";
|
|
2
2
|
import { t as markdownRemarkPlugins } from "./remark-Dd2WU50s.js";
|
|
3
3
|
import clsx from "clsx";
|
|
4
4
|
import { Children, createContext, createElement, forwardRef, isValidElement, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
5
|
import { Link } from "react-router-dom";
|
|
6
6
|
import { Listbox, ListboxButton, ListboxOption, ListboxOptions, Tab, TabGroup, TabList, TabPanel, TabPanels, Transition } from "@headlessui/react";
|
|
7
|
-
import { AlertTriangle, ArrowRight, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, Info, Lightbulb, LinkIcon, LockKeyholeIcon, PackageIcon, ServerIcon, UnlockKeyholeIcon, XCircle } from "lucide-react";
|
|
7
|
+
import { AlertTriangle, ArrowRight, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, Info, Lightbulb, LinkIcon, LockKeyholeIcon, Maximize2, PackageIcon, ServerIcon, UnlockKeyholeIcon, XCircle, ZoomIn, ZoomOut } from "lucide-react";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { useInView } from "framer-motion";
|
|
10
10
|
import { create } from "zustand";
|
|
11
|
+
import { TransformComponent, TransformWrapper, useControls } from "react-zoom-pan-pinch";
|
|
11
12
|
import ReactMarkdown from "react-markdown";
|
|
12
13
|
import { slug } from "github-slugger";
|
|
13
14
|
import { snippetz } from "@scalar/snippetz";
|
|
@@ -207,6 +208,166 @@ function Card(arg0) {
|
|
|
207
208
|
});
|
|
208
209
|
}
|
|
209
210
|
//#endregion
|
|
211
|
+
//#region source/components/Mermaid.tsx
|
|
212
|
+
var mermaidModulePromise;
|
|
213
|
+
async function loadMermaid() {
|
|
214
|
+
mermaidModulePromise = mermaidModulePromise ?? import("mermaid").then((module) => module.default);
|
|
215
|
+
return mermaidModulePromise;
|
|
216
|
+
}
|
|
217
|
+
function ZoomControls() {
|
|
218
|
+
const { zoomIn, zoomOut, resetTransform } = useControls();
|
|
219
|
+
const t = useBuiltInText();
|
|
220
|
+
const buttonClassName = "flex h-7 w-7 items-center justify-center rounded-md bg-(--clarify-theme-tokens-colors-surface) text-(--clarify-ui-text-soft) shadow-xs ring-1 ring-(--clarify-theme-tokens-colors-border) transition hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)";
|
|
221
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
222
|
+
className: "clarify-mermaid-controls absolute top-2 right-2 z-10 flex gap-1 opacity-0 transition group-hover:opacity-100 focus-within:opacity-100",
|
|
223
|
+
children: [
|
|
224
|
+
/* @__PURE__ */ jsx("button", {
|
|
225
|
+
type: "button",
|
|
226
|
+
"aria-label": t("mermaid.zoomIn"),
|
|
227
|
+
title: t("mermaid.zoomIn"),
|
|
228
|
+
onClick: () => zoomIn(),
|
|
229
|
+
className: buttonClassName,
|
|
230
|
+
children: /* @__PURE__ */ jsx(ZoomIn, {
|
|
231
|
+
className: "h-4 w-4",
|
|
232
|
+
"aria-hidden": "true"
|
|
233
|
+
})
|
|
234
|
+
}),
|
|
235
|
+
/* @__PURE__ */ jsx("button", {
|
|
236
|
+
type: "button",
|
|
237
|
+
"aria-label": t("mermaid.zoomOut"),
|
|
238
|
+
title: t("mermaid.zoomOut"),
|
|
239
|
+
onClick: () => zoomOut(),
|
|
240
|
+
className: buttonClassName,
|
|
241
|
+
children: /* @__PURE__ */ jsx(ZoomOut, {
|
|
242
|
+
className: "h-4 w-4",
|
|
243
|
+
"aria-hidden": "true"
|
|
244
|
+
})
|
|
245
|
+
}),
|
|
246
|
+
/* @__PURE__ */ jsx("button", {
|
|
247
|
+
type: "button",
|
|
248
|
+
"aria-label": t("mermaid.resetZoom"),
|
|
249
|
+
title: t("mermaid.resetZoom"),
|
|
250
|
+
onClick: () => resetTransform(),
|
|
251
|
+
className: buttonClassName,
|
|
252
|
+
children: /* @__PURE__ */ jsx(Maximize2, {
|
|
253
|
+
className: "h-4 w-4",
|
|
254
|
+
"aria-hidden": "true"
|
|
255
|
+
})
|
|
256
|
+
})
|
|
257
|
+
]
|
|
258
|
+
});
|
|
259
|
+
}
|
|
260
|
+
function Mermaid(arg0) {
|
|
261
|
+
const { chart, className } = arg0;
|
|
262
|
+
const t = useBuiltInText();
|
|
263
|
+
const { resolvedTheme } = useTheme();
|
|
264
|
+
const renderId = `clarify-mermaid-${useId().replace(/[^a-zA-Z0-9]/g, "")}`;
|
|
265
|
+
const containerRef = useRef(null);
|
|
266
|
+
const [svg, setSvg] = useState("");
|
|
267
|
+
const [error, setError] = useState(void 0);
|
|
268
|
+
const [focused, setFocused] = useState(false);
|
|
269
|
+
useEffect(() => {
|
|
270
|
+
let cancelled = false;
|
|
271
|
+
async function renderChart() {
|
|
272
|
+
const source = chart.trim();
|
|
273
|
+
if (!source) {
|
|
274
|
+
setSvg("");
|
|
275
|
+
setError(void 0);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
const mermaid = await loadMermaid();
|
|
280
|
+
mermaid.initialize({
|
|
281
|
+
startOnLoad: false,
|
|
282
|
+
securityLevel: "strict",
|
|
283
|
+
theme: resolvedTheme === "dark" ? "dark" : "default",
|
|
284
|
+
fontFamily: "inherit"
|
|
285
|
+
});
|
|
286
|
+
const { svg: renderedSvg } = await mermaid.render(renderId, source);
|
|
287
|
+
if (!cancelled) {
|
|
288
|
+
setSvg(renderedSvg);
|
|
289
|
+
setError(void 0);
|
|
290
|
+
}
|
|
291
|
+
} catch (renderError) {
|
|
292
|
+
if (!cancelled) {
|
|
293
|
+
setSvg("");
|
|
294
|
+
setError(renderError instanceof Error ? renderError.message : String(renderError));
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
renderChart();
|
|
299
|
+
return () => {
|
|
300
|
+
cancelled = true;
|
|
301
|
+
};
|
|
302
|
+
}, [
|
|
303
|
+
chart,
|
|
304
|
+
renderId,
|
|
305
|
+
resolvedTheme
|
|
306
|
+
]);
|
|
307
|
+
if (error) return /* @__PURE__ */ jsxs("div", {
|
|
308
|
+
className: clsx("clarify-mermaid clarify-mermaid-error my-6 overflow-x-auto rounded-2xl border border-(--clarify-ui-accent-border) bg-(--clarify-ui-accent-background) p-4", className),
|
|
309
|
+
children: [
|
|
310
|
+
/* @__PURE__ */ jsx("p", {
|
|
311
|
+
className: "text-sm font-semibold text-(--clarify-error-accent-text)",
|
|
312
|
+
children: t("mermaid.renderError")
|
|
313
|
+
}),
|
|
314
|
+
/* @__PURE__ */ jsx("pre", {
|
|
315
|
+
className: "mt-2 text-xs whitespace-pre-wrap text-(--clarify-ui-text-soft)",
|
|
316
|
+
children: error
|
|
317
|
+
}),
|
|
318
|
+
/* @__PURE__ */ jsx("pre", {
|
|
319
|
+
className: "mt-2 text-xs whitespace-pre-wrap text-(--clarify-ui-text-faint)",
|
|
320
|
+
children: chart.trim()
|
|
321
|
+
})
|
|
322
|
+
]
|
|
323
|
+
});
|
|
324
|
+
if (!svg) return /* @__PURE__ */ jsx("div", {
|
|
325
|
+
className: clsx("clarify-mermaid clarify-mermaid-loading not-prose my-6 overflow-x-auto rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-4", className),
|
|
326
|
+
children: /* @__PURE__ */ jsx("pre", {
|
|
327
|
+
className: "text-xs text-(--clarify-ui-text-soft)",
|
|
328
|
+
children: chart.trim()
|
|
329
|
+
})
|
|
330
|
+
});
|
|
331
|
+
return /* @__PURE__ */ jsx("div", {
|
|
332
|
+
ref: containerRef,
|
|
333
|
+
tabIndex: 0,
|
|
334
|
+
role: "group",
|
|
335
|
+
onPointerDown: () => containerRef.current?.focus(),
|
|
336
|
+
onFocus: () => setFocused(true),
|
|
337
|
+
onBlur: () => setFocused(false),
|
|
338
|
+
className: clsx("clarify-mermaid group not-prose relative my-6 overflow-hidden rounded-2xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)", className),
|
|
339
|
+
children: /* @__PURE__ */ jsxs(TransformWrapper, {
|
|
340
|
+
minScale: .5,
|
|
341
|
+
maxScale: 8,
|
|
342
|
+
initialScale: 1,
|
|
343
|
+
centerOnInit: true,
|
|
344
|
+
smooth: true,
|
|
345
|
+
wheel: {
|
|
346
|
+
step: .05,
|
|
347
|
+
wheelDisabled: !focused,
|
|
348
|
+
touchPadDisabled: !focused
|
|
349
|
+
},
|
|
350
|
+
doubleClick: { mode: "reset" },
|
|
351
|
+
children: [
|
|
352
|
+
/* @__PURE__ */ jsx(ZoomControls, {}),
|
|
353
|
+
/* @__PURE__ */ jsx(TransformComponent, {
|
|
354
|
+
wrapperClass: "!w-full !cursor-grab active:!cursor-grabbing",
|
|
355
|
+
contentClass: "!w-full justify-center [&_svg]:h-auto [&_svg]:max-w-full",
|
|
356
|
+
wrapperStyle: { height: "min(70vh, 32rem)" },
|
|
357
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
358
|
+
className: "flex h-full w-full items-center justify-center p-4",
|
|
359
|
+
dangerouslySetInnerHTML: { __html: svg }
|
|
360
|
+
})
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ jsx("p", {
|
|
363
|
+
className: clsx("clarify-mermaid-hint pointer-events-none absolute bottom-2 left-1/2 z-10 -translate-x-1/2 rounded-full bg-(--clarify-theme-tokens-colors-surface)/90 px-2.5 py-1 text-2xs text-(--clarify-ui-text-soft) shadow-xs ring-1 ring-(--clarify-theme-tokens-colors-border) backdrop-blur-sm transition", focused ? "opacity-0" : "opacity-0 group-hover:opacity-100"),
|
|
364
|
+
children: t("mermaid.scrollHint")
|
|
365
|
+
})
|
|
366
|
+
]
|
|
367
|
+
})
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
//#endregion
|
|
210
371
|
//#region source/components/Code.tsx
|
|
211
372
|
var languageNames = {
|
|
212
373
|
js: "JavaScript",
|
|
@@ -428,8 +589,10 @@ function Code(arg0) {
|
|
|
428
589
|
});
|
|
429
590
|
}
|
|
430
591
|
function Pre(arg0) {
|
|
431
|
-
const { children, ...props } = arg0;
|
|
432
|
-
|
|
592
|
+
const { children, language, code, ...props } = arg0;
|
|
593
|
+
const isGrouped = useContext(CodeGroupContext);
|
|
594
|
+
if (language === "mermaid") return /* @__PURE__ */ jsx(Mermaid, { chart: code ?? getNodeText(children) });
|
|
595
|
+
if (isGrouped) return children;
|
|
433
596
|
return /* @__PURE__ */ jsx(CodeGroup, {
|
|
434
597
|
...props,
|
|
435
598
|
children
|
|
@@ -747,7 +910,7 @@ function HeroPattern() {
|
|
|
747
910
|
function Prose(arg0) {
|
|
748
911
|
const { as, className, ...props } = arg0;
|
|
749
912
|
return /* @__PURE__ */ jsx(as ?? "div", {
|
|
750
|
-
className: clsx(className, "clarify-prose prose max-w-none dark:prose-invert", "[html_:where(&>*)]:w-full [html_:where(&>*)]:min-w-0 [html_:where(&>*)]:max-w-full"),
|
|
913
|
+
className: clsx(className, "clarify-prose prose max-w-none min-w-0 dark:prose-invert wrap-break-word", "[html_:where(&>*)]:w-full [html_:where(&>*)]:min-w-0 [html_:where(&>*)]:max-w-full"),
|
|
751
914
|
...props
|
|
752
915
|
});
|
|
753
916
|
}
|
|
@@ -822,18 +985,29 @@ var primitives_exports = /* @__PURE__ */ __exportAll({
|
|
|
822
985
|
h2: () => h2,
|
|
823
986
|
h3: () => h3,
|
|
824
987
|
pre: () => pre,
|
|
988
|
+
table: () => table,
|
|
825
989
|
wrapper: () => wrapper
|
|
826
990
|
});
|
|
827
991
|
function wrapper(arg0) {
|
|
828
992
|
const { children } = arg0;
|
|
829
993
|
return /* @__PURE__ */ jsx("article", {
|
|
830
|
-
className: "clarify-mdx-page flex h-full flex-col pt-14 pb-10",
|
|
994
|
+
className: "clarify-mdx-page flex h-full min-w-0 flex-col pt-14 pb-10",
|
|
831
995
|
children: /* @__PURE__ */ jsx(Prose, {
|
|
832
996
|
className: "flex-auto",
|
|
833
997
|
children
|
|
834
998
|
})
|
|
835
999
|
});
|
|
836
1000
|
}
|
|
1001
|
+
function table(arg0) {
|
|
1002
|
+
const { className, ...props } = arg0;
|
|
1003
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1004
|
+
className: "overflow-x-auto",
|
|
1005
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
1006
|
+
className,
|
|
1007
|
+
...props
|
|
1008
|
+
})
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
837
1011
|
function a(arg0) {
|
|
838
1012
|
const { href = "", ...props } = arg0;
|
|
839
1013
|
return /* @__PURE__ */ jsx(LocalizedLink, {
|
|
@@ -877,16 +1051,16 @@ function Note(arg0) {
|
|
|
877
1051
|
});
|
|
878
1052
|
}
|
|
879
1053
|
function Row(arg0) {
|
|
880
|
-
const { children } = arg0;
|
|
1054
|
+
const { children, className } = arg0;
|
|
881
1055
|
return /* @__PURE__ */ jsx("div", {
|
|
882
|
-
className: "clarify-row grid grid-cols-1 items-start gap-x-8 gap-y-10 xl:max-w-none xl:grid-cols-2",
|
|
1056
|
+
className: clsx("clarify-row grid grid-cols-1 items-start gap-x-8 gap-y-10 xl:max-w-none xl:grid-cols-2", className),
|
|
883
1057
|
children
|
|
884
1058
|
});
|
|
885
1059
|
}
|
|
886
1060
|
function Col(arg0) {
|
|
887
1061
|
const { children, sticky = false } = arg0;
|
|
888
1062
|
return /* @__PURE__ */ jsx("div", {
|
|
889
|
-
className: clsx("clarify-col *:first:mt-0 *:last:mb-0", sticky && "xl:sticky xl:top-
|
|
1063
|
+
className: clsx("clarify-col *:first:mt-0 *:last:mb-0", sticky && "xl:sticky xl:top-[calc(var(--clarify-header-offset,3.5rem)+1.5rem)] xl:self-start"),
|
|
890
1064
|
children
|
|
891
1065
|
});
|
|
892
1066
|
}
|
|
@@ -937,6 +1111,23 @@ function Property(arg0) {
|
|
|
937
1111
|
}
|
|
938
1112
|
//#endregion
|
|
939
1113
|
//#region source/mdx/Markdown.tsx
|
|
1114
|
+
function getMermaidChart(children) {
|
|
1115
|
+
if (!isValidElement(children)) return void 0;
|
|
1116
|
+
const props = children.props;
|
|
1117
|
+
const className = typeof props.className === "string" ? props.className : "";
|
|
1118
|
+
if (!/\blanguage-mermaid\b/.test(className)) return void 0;
|
|
1119
|
+
return typeof props.children === "string" ? props.children : void 0;
|
|
1120
|
+
}
|
|
1121
|
+
function MarkdownTable(arg0) {
|
|
1122
|
+
const { className, ...props } = arg0;
|
|
1123
|
+
return /* @__PURE__ */ jsx("div", {
|
|
1124
|
+
className: "overflow-x-auto",
|
|
1125
|
+
children: /* @__PURE__ */ jsx("table", {
|
|
1126
|
+
className,
|
|
1127
|
+
...props
|
|
1128
|
+
})
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
940
1131
|
var markdownComponents = {
|
|
941
1132
|
a(props) {
|
|
942
1133
|
return /* @__PURE__ */ jsx(a, { ...props });
|
|
@@ -946,10 +1137,15 @@ var markdownComponents = {
|
|
|
946
1137
|
},
|
|
947
1138
|
pre(arg0) {
|
|
948
1139
|
const { children, ...props } = arg0;
|
|
1140
|
+
const chart = getMermaidChart(children);
|
|
1141
|
+
if (chart !== void 0) return /* @__PURE__ */ jsx(Mermaid, { chart });
|
|
949
1142
|
return /* @__PURE__ */ jsx(pre, {
|
|
950
1143
|
...props,
|
|
951
1144
|
children
|
|
952
1145
|
});
|
|
1146
|
+
},
|
|
1147
|
+
table(props) {
|
|
1148
|
+
return /* @__PURE__ */ jsx(MarkdownTable, { ...props });
|
|
953
1149
|
}
|
|
954
1150
|
};
|
|
955
1151
|
function Markdown(arg0) {
|
|
@@ -2060,7 +2256,10 @@ function SchemaNode(arg0) {
|
|
|
2060
2256
|
}) : null]
|
|
2061
2257
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2062
2258
|
className: "mt-0.5 text-sm/5 text-(--clarify-ui-text-soft) *:first:mt-0 *:last:mb-0",
|
|
2063
|
-
children: [node.description ? /* @__PURE__ */ jsx(Markdown, {
|
|
2259
|
+
children: [node.description ? /* @__PURE__ */ jsx(Markdown, {
|
|
2260
|
+
className: "*:first:mt-0 *:last:mb-0",
|
|
2261
|
+
children: node.description
|
|
2262
|
+
}) : fallbackDescription, node.details ? /* @__PURE__ */ jsx("p", {
|
|
2064
2263
|
className: "text-xs text-(--clarify-ui-text-faint)",
|
|
2065
2264
|
children: node.details
|
|
2066
2265
|
}) : null]
|
|
@@ -2116,7 +2315,10 @@ function ParameterList(arg0) {
|
|
|
2116
2315
|
return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", { children: title }), /* @__PURE__ */ jsx(Properties, { children: parameters.map((parameter) => /* @__PURE__ */ jsx(Property, {
|
|
2117
2316
|
name: parameter.name ?? t("openapi.parameter"),
|
|
2118
2317
|
type: [schemaToType(parameter.schema), parameter.required ? t("openapi.requiredBadge") : void 0].filter(Boolean).join(", ") || void 0,
|
|
2119
|
-
children: parameter.description ? /* @__PURE__ */ jsx(Markdown, {
|
|
2318
|
+
children: parameter.description ? /* @__PURE__ */ jsx(Markdown, {
|
|
2319
|
+
className: "*:first:mt-0 *:last:mb-0",
|
|
2320
|
+
children: parameter.description
|
|
2321
|
+
}) : t("openapi.operationParameter")
|
|
2120
2322
|
}, `${parameter.in}-${parameter.name}`)) })] });
|
|
2121
2323
|
}
|
|
2122
2324
|
function ResponseList(arg0) {
|
|
@@ -2128,33 +2330,78 @@ function ResponseList(arg0) {
|
|
|
2128
2330
|
return /* @__PURE__ */ jsx(Property, {
|
|
2129
2331
|
name: status,
|
|
2130
2332
|
type: schemaToType(getJsonLikeContent(response.content, spec)?.value.schema),
|
|
2131
|
-
children: response.description ? /* @__PURE__ */ jsx(Markdown, {
|
|
2333
|
+
children: response.description ? /* @__PURE__ */ jsx(Markdown, {
|
|
2334
|
+
className: "*:first:mt-0 *:last:mb-0",
|
|
2335
|
+
children: response.description
|
|
2336
|
+
}) : `${t("openapi.response")}.`
|
|
2132
2337
|
}, status);
|
|
2133
2338
|
}) })] });
|
|
2134
2339
|
}
|
|
2135
2340
|
//#endregion
|
|
2136
|
-
//#region source/openapi/components/
|
|
2137
|
-
function
|
|
2138
|
-
const { spec, path, method,
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2341
|
+
//#region source/openapi/components/EndpointSections.tsx
|
|
2342
|
+
function EndpointRequest(arg0) {
|
|
2343
|
+
const { spec, path, method, description, groupedParameters, parameters, requestBody, requestContents, requestSchema, selectedRequestMediaType, onSelectRequestMediaType, selectedServer, serverVariables, auth } = arg0;
|
|
2344
|
+
const t = useBuiltInText();
|
|
2345
|
+
return /* @__PURE__ */ jsxs(Row, {
|
|
2346
|
+
className: "relative mt-6",
|
|
2347
|
+
children: [/* @__PURE__ */ jsxs(Col, { children: [
|
|
2348
|
+
description ? /* @__PURE__ */ jsx(Markdown, { children: description }) : null,
|
|
2349
|
+
/* @__PURE__ */ jsx(ParameterList, {
|
|
2350
|
+
title: t("openapi.pathParameters"),
|
|
2351
|
+
parameters: groupedParameters.path
|
|
2352
|
+
}),
|
|
2353
|
+
/* @__PURE__ */ jsx(ParameterList, {
|
|
2354
|
+
title: t("openapi.queryParameters"),
|
|
2355
|
+
parameters: groupedParameters.query
|
|
2356
|
+
}),
|
|
2357
|
+
/* @__PURE__ */ jsx(ParameterList, {
|
|
2358
|
+
title: t("openapi.headers"),
|
|
2359
|
+
parameters: groupedParameters.header
|
|
2360
|
+
}),
|
|
2361
|
+
requestBody && requestContents.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2362
|
+
/* @__PURE__ */ jsx("h3", { children: t("openapi.requestBody") }),
|
|
2363
|
+
typeof requestBody.description === "string" ? /* @__PURE__ */ jsx(Markdown, { children: requestBody.description }) : null,
|
|
2364
|
+
/* @__PURE__ */ jsx(SchemaProperties, {
|
|
2365
|
+
title: t("openapi.bodyProperties"),
|
|
2366
|
+
schema: requestSchema,
|
|
2367
|
+
spec
|
|
2368
|
+
})
|
|
2369
|
+
] }) : null
|
|
2370
|
+
] }), /* @__PURE__ */ jsx(Col, {
|
|
2371
|
+
sticky: true,
|
|
2372
|
+
children: /* @__PURE__ */ jsx(RequestExamplesPanel, {
|
|
2373
|
+
spec,
|
|
2374
|
+
path,
|
|
2375
|
+
method,
|
|
2376
|
+
parameters,
|
|
2377
|
+
requestContents,
|
|
2378
|
+
selectedMediaType: selectedRequestMediaType,
|
|
2379
|
+
onSelectMediaType: onSelectRequestMediaType,
|
|
2380
|
+
selectedServer,
|
|
2381
|
+
serverVariables,
|
|
2382
|
+
auth
|
|
2383
|
+
})
|
|
2384
|
+
})]
|
|
2385
|
+
});
|
|
2386
|
+
}
|
|
2387
|
+
function EndpointResponse(arg0) {
|
|
2388
|
+
const { spec, operation } = arg0;
|
|
2389
|
+
return /* @__PURE__ */ jsxs(Row, {
|
|
2390
|
+
className: "relative mt-6",
|
|
2391
|
+
children: [/* @__PURE__ */ jsx(Col, { children: /* @__PURE__ */ jsx(ResponseList, {
|
|
2153
2392
|
operation,
|
|
2154
2393
|
spec
|
|
2394
|
+
}) }), /* @__PURE__ */ jsx(Col, {
|
|
2395
|
+
sticky: true,
|
|
2396
|
+
children: /* @__PURE__ */ jsx(ResponseExamplesPanel, {
|
|
2397
|
+
operation,
|
|
2398
|
+
spec
|
|
2399
|
+
})
|
|
2155
2400
|
})]
|
|
2156
2401
|
});
|
|
2157
2402
|
}
|
|
2403
|
+
//#endregion
|
|
2404
|
+
//#region source/openapi/components/OpenApiOperation.tsx
|
|
2158
2405
|
var endpointMethodStyles = {
|
|
2159
2406
|
GET: "bg-emerald-400/15 text-emerald-600 dark:bg-emerald-400/20 dark:text-emerald-300",
|
|
2160
2407
|
POST: "bg-sky-400/15 text-sky-600 dark:bg-sky-400/20 dark:text-sky-300",
|
|
@@ -2215,8 +2462,25 @@ function getServerPreviewUrl(server, variables) {
|
|
|
2215
2462
|
return (server.url ?? "").replace(/\{([^}]+)\}/g, (_, name) => variables[name] ?? server.variables?.[name]?.default ?? `{${name}}`);
|
|
2216
2463
|
}
|
|
2217
2464
|
function ServerUrlValue(arg0) {
|
|
2218
|
-
const { server, variables, open, onToggle } = arg0;
|
|
2465
|
+
const { server, variables, open, interactive, onToggle } = arg0;
|
|
2219
2466
|
const url = getServerPreviewUrl(server, variables);
|
|
2467
|
+
if (!interactive) return /* @__PURE__ */ jsxs("span", {
|
|
2468
|
+
"aria-label": "Server",
|
|
2469
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text-foreground) sm:w-auto sm:min-w-16 sm:max-w-(--clarify-server-url-max-width) sm:px-1.5",
|
|
2470
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
2471
|
+
className: "sm:hidden",
|
|
2472
|
+
children: /* @__PURE__ */ jsx(ServerIcon, {
|
|
2473
|
+
className: "h-4 w-4",
|
|
2474
|
+
"aria-hidden": "true"
|
|
2475
|
+
})
|
|
2476
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2477
|
+
className: "hidden min-w-0 items-center overflow-hidden sm:flex",
|
|
2478
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
2479
|
+
className: "truncate font-semibold text-xs",
|
|
2480
|
+
children: url
|
|
2481
|
+
})
|
|
2482
|
+
})]
|
|
2483
|
+
});
|
|
2220
2484
|
return /* @__PURE__ */ jsxs("button", {
|
|
2221
2485
|
type: "button",
|
|
2222
2486
|
"aria-expanded": open,
|
|
@@ -2343,6 +2607,7 @@ function AuthPanel(arg0) {
|
|
|
2343
2607
|
function EndpointIdentity(arg0) {
|
|
2344
2608
|
const { method, path, servers, selectedServerKey, selectedServer, serverVariables, serverOpen, authOptions, selectedAuthName, selectedAuth, authValues, authOpen, onSelectServer, onChangeServerVariable, onToggleServer, onToggleAuth, onSelectAuth, onChangeAuthValue } = arg0;
|
|
2345
2609
|
const segments = path.split("/").filter(Boolean);
|
|
2610
|
+
const serverInteractive = servers.length > 1 || Object.keys(selectedServer.variables ?? {}).length > 0;
|
|
2346
2611
|
return /* @__PURE__ */ jsxs("div", {
|
|
2347
2612
|
className: "not-prose flex w-full flex-col overflow-hidden rounded-xl border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) shadow-xs",
|
|
2348
2613
|
children: [
|
|
@@ -2354,6 +2619,7 @@ function EndpointIdentity(arg0) {
|
|
|
2354
2619
|
server: selectedServer,
|
|
2355
2620
|
variables: serverVariables,
|
|
2356
2621
|
open: serverOpen,
|
|
2622
|
+
interactive: serverInteractive,
|
|
2357
2623
|
onToggle: onToggleServer
|
|
2358
2624
|
}),
|
|
2359
2625
|
/* @__PURE__ */ jsx("div", {
|
|
@@ -2391,7 +2657,7 @@ function EndpointIdentity(arg0) {
|
|
|
2391
2657
|
}) : null
|
|
2392
2658
|
]
|
|
2393
2659
|
}),
|
|
2394
|
-
serverOpen ? /* @__PURE__ */ jsx(ServerPanel, {
|
|
2660
|
+
serverInteractive && serverOpen ? /* @__PURE__ */ jsx(ServerPanel, {
|
|
2395
2661
|
servers,
|
|
2396
2662
|
selectedKey: selectedServerKey,
|
|
2397
2663
|
selectedServer,
|
|
@@ -2412,7 +2678,6 @@ function EndpointIdentity(arg0) {
|
|
|
2412
2678
|
}
|
|
2413
2679
|
function OpenApiOperation(arg0) {
|
|
2414
2680
|
const { spec, path, method, operation } = arg0;
|
|
2415
|
-
const t = useBuiltInText();
|
|
2416
2681
|
const id = slug(`${method.toLowerCase()} ${path}`);
|
|
2417
2682
|
const summary = operation.summary ?? `${method} ${path}`;
|
|
2418
2683
|
const description = operation.description;
|
|
@@ -2443,9 +2708,13 @@ function OpenApiOperation(arg0) {
|
|
|
2443
2708
|
header: parameters.filter((parameter) => parameter.in === "header")
|
|
2444
2709
|
};
|
|
2445
2710
|
return /* @__PURE__ */ jsxs("section", {
|
|
2446
|
-
className: "clarify-api-endpoint scroll-mt-24
|
|
2711
|
+
className: "clarify-api-endpoint scroll-mt-24 pb-16 first:pt-0 last:pb-0",
|
|
2447
2712
|
"aria-labelledby": id,
|
|
2448
2713
|
children: [
|
|
2714
|
+
/* @__PURE__ */ jsx(Heading, {
|
|
2715
|
+
id,
|
|
2716
|
+
children: summary
|
|
2717
|
+
}),
|
|
2449
2718
|
/* @__PURE__ */ jsx(EndpointIdentity, {
|
|
2450
2719
|
method,
|
|
2451
2720
|
path,
|
|
@@ -2482,61 +2751,30 @@ function OpenApiOperation(arg0) {
|
|
|
2482
2751
|
[name]: value
|
|
2483
2752
|
}))
|
|
2484
2753
|
}),
|
|
2485
|
-
/* @__PURE__ */ jsx(
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2754
|
+
/* @__PURE__ */ jsx(EndpointRequest, {
|
|
2755
|
+
spec,
|
|
2756
|
+
path,
|
|
2757
|
+
method,
|
|
2758
|
+
description,
|
|
2759
|
+
groupedParameters,
|
|
2760
|
+
parameters,
|
|
2761
|
+
requestBody,
|
|
2762
|
+
requestContents,
|
|
2763
|
+
requestSchema,
|
|
2764
|
+
selectedRequestMediaType: selectedRequestContent?.mediaType ?? "",
|
|
2765
|
+
onSelectRequestMediaType: setSelectedRequestMediaType,
|
|
2766
|
+
selectedServer,
|
|
2767
|
+
serverVariables,
|
|
2768
|
+
auth: authInput
|
|
2489
2769
|
}),
|
|
2490
|
-
/* @__PURE__ */
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
}) : null,
|
|
2495
|
-
/* @__PURE__ */ jsx(ParameterList, {
|
|
2496
|
-
title: t("openapi.pathParameters"),
|
|
2497
|
-
parameters: groupedParameters.path
|
|
2498
|
-
}),
|
|
2499
|
-
/* @__PURE__ */ jsx(ParameterList, {
|
|
2500
|
-
title: t("openapi.queryParameters"),
|
|
2501
|
-
parameters: groupedParameters.query
|
|
2502
|
-
}),
|
|
2503
|
-
/* @__PURE__ */ jsx(ParameterList, {
|
|
2504
|
-
title: t("openapi.headers"),
|
|
2505
|
-
parameters: groupedParameters.header
|
|
2506
|
-
}),
|
|
2507
|
-
requestBody && requestContents.length > 0 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2508
|
-
/* @__PURE__ */ jsx("h3", { children: t("openapi.requestBody") }),
|
|
2509
|
-
typeof requestBody.description === "string" ? /* @__PURE__ */ jsx(Markdown, { children: requestBody.description }) : null,
|
|
2510
|
-
/* @__PURE__ */ jsx(SchemaProperties, {
|
|
2511
|
-
title: t("openapi.bodyProperties"),
|
|
2512
|
-
schema: requestSchema,
|
|
2513
|
-
spec
|
|
2514
|
-
})
|
|
2515
|
-
] }) : null,
|
|
2516
|
-
/* @__PURE__ */ jsx(ResponseList, {
|
|
2517
|
-
operation,
|
|
2518
|
-
spec
|
|
2519
|
-
})
|
|
2520
|
-
] }), /* @__PURE__ */ jsx(Col, {
|
|
2521
|
-
sticky: true,
|
|
2522
|
-
children: /* @__PURE__ */ jsx(EndpointExamples, {
|
|
2523
|
-
spec,
|
|
2524
|
-
path,
|
|
2525
|
-
method,
|
|
2526
|
-
operation,
|
|
2527
|
-
parameters,
|
|
2528
|
-
requestContents,
|
|
2529
|
-
selectedRequestMediaType: selectedRequestContent?.mediaType ?? "",
|
|
2530
|
-
onSelectRequestMediaType: setSelectedRequestMediaType,
|
|
2531
|
-
selectedServer,
|
|
2532
|
-
serverVariables,
|
|
2533
|
-
auth: authInput
|
|
2534
|
-
})
|
|
2535
|
-
})] })
|
|
2770
|
+
/* @__PURE__ */ jsx(EndpointResponse, {
|
|
2771
|
+
spec,
|
|
2772
|
+
operation
|
|
2773
|
+
})
|
|
2536
2774
|
]
|
|
2537
2775
|
});
|
|
2538
2776
|
}
|
|
2539
2777
|
//#endregion
|
|
2540
|
-
export { Code as C,
|
|
2778
|
+
export { Button as A, Code as C, Card as D, Mermaid as E, CardGroup as O, Collapse as S, Pre as T, HeroPattern as _, authPlaceholder as a, Tag as b, getServerKey as c, getRequestBody$1 as d, Markdown as f, GridPattern as g, Prose as h, ResponseExamplesPanel as i, Callout as k, getServers as l, WebFrame as m, OpenApiOperation as n, defaultServerVariables as o, primitives_exports as p, RequestExamplesPanel as r, getAuthOptions as s, EndpointIdentity as t, getMediaTypeEntries as u, Logo as v, CodeGroup as w, Feedback as x, Heading as y };
|
|
2541
2779
|
|
|
2542
|
-
//# sourceMappingURL=OpenApiOperation-
|
|
2780
|
+
//# sourceMappingURL=OpenApiOperation-J41rHO2l.js.map
|