@clarify-labs/renderer 0.10.1 → 0.10.3
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/{ClarifyShell-1LuBliwt.js → ClarifyShell-Cq5Af46F.js} +32 -12
- package/output/ClarifyShell-Cq5Af46F.js.map +1 -0
- package/output/{ClarifyShell-C6li72Ce.cjs → ClarifyShell-UsefuuLS.cjs} +31 -11
- package/output/ClarifyShell-UsefuuLS.cjs.map +1 -0
- package/output/{MermaidViewer-dXsomvM7.js → MermaidViewer-Bc9H25yK.js} +2 -2
- package/output/{MermaidViewer-dXsomvM7.js.map → MermaidViewer-Bc9H25yK.js.map} +1 -1
- package/output/{MermaidViewer-B6-BMCJG.cjs → MermaidViewer-Db7qsyVk.cjs} +2 -2
- package/output/{MermaidViewer-B6-BMCJG.cjs.map → MermaidViewer-Db7qsyVk.cjs.map} +1 -1
- package/output/{OpenApiOperation-CqNM-no4.js → OpenApiOperation-BZWeCbvy.js} +584 -204
- package/output/OpenApiOperation-BZWeCbvy.js.map +1 -0
- package/output/{OpenApiOperation-DK46w2dq.cjs → OpenApiOperation-DbZjxIuj.cjs} +605 -200
- package/output/OpenApiOperation-DbZjxIuj.cjs.map +1 -0
- package/output/{PageActions-D7K9LDGf.js → PageActions-BQeEmXbT.js} +524 -350
- package/output/PageActions-BQeEmXbT.js.map +1 -0
- package/output/{PageActions-BjB6PYmL.cjs → PageActions-Dg1l9KB1.cjs} +521 -347
- package/output/PageActions-Dg1l9KB1.cjs.map +1 -0
- package/output/{SearchDialog-CxYLjRi5.js → SearchDialog-B67VA0Ut.js} +3 -3
- package/output/{SearchDialog-CxYLjRi5.js.map → SearchDialog-B67VA0Ut.js.map} +1 -1
- package/output/{SearchDialog-CIPvXMT3.cjs → SearchDialog-DjKvqN7p.cjs} +3 -3
- package/output/{SearchDialog-CIPvXMT3.cjs.map → SearchDialog-DjKvqN7p.cjs.map} +1 -1
- package/output/app/ContentDiagnostic.d.ts +2 -1
- package/output/client.cjs +3 -3
- package/output/client.js +3 -3
- package/output/components/AccordionGroup.d.ts +7 -0
- package/output/components/Collapse.d.ts +2 -0
- package/output/components/FileTree.d.ts +10 -0
- package/output/components/HighlightedCode.d.ts +7 -0
- package/output/components/Image.d.ts +6 -0
- package/output/components/Steps.d.ts +12 -0
- package/output/components/Tabs.d.ts +12 -5
- package/output/components/Tooltip.d.ts +7 -0
- package/output/components/index.d.ts +10 -1
- package/output/core/i18n.d.ts +1 -1
- package/output/{i18n-DnqZHFT7.js → i18n-Bqth9d6Q.js} +5 -1
- package/output/i18n-Bqth9d6Q.js.map +1 -0
- package/output/{i18n-b4iTLeia.cjs → i18n-C-fReCj-.cjs} +5 -1
- package/output/i18n-C-fReCj-.cjs.map +1 -0
- package/output/index.cjs +31 -22
- package/output/index.cjs.map +1 -1
- package/output/index.d.ts +7 -6
- package/output/index.js +27 -23
- package/output/index.js.map +1 -1
- package/output/markdown.cjs +2 -1
- package/output/markdown.d.ts +1 -1
- package/output/markdown.js +2 -2
- package/output/mdx/components.d.ts +9 -0
- package/output/mdx/primitives.d.ts +4 -2
- package/output/mdx/remark.d.ts +1 -0
- package/output/openapi/components/CodeDisplay.d.ts +1 -0
- package/output/openapi/components/ExamplePanels.d.ts +2 -1
- package/output/openapi/components/InlineListbox.d.ts +18 -0
- package/output/preview.cjs +3 -3
- package/output/preview.js +3 -3
- package/output/{remark-Dd2WU50s.js → remark-C9iRQM0R.js} +4 -3
- package/output/remark-C9iRQM0R.js.map +1 -0
- package/output/{remark-zSQT0MBv.cjs → remark-DTLbG8PK.cjs} +9 -2
- package/output/remark-DTLbG8PK.cjs.map +1 -0
- package/output/{render-Di5B6Zc0.cjs → render-Dc9wxg_r.cjs} +2 -2
- package/output/{render-Di5B6Zc0.cjs.map → render-Dc9wxg_r.cjs.map} +1 -1
- package/output/{render-DKj24Jqw.js → render-aS-w4fK4.js} +2 -2
- package/output/{render-DKj24Jqw.js.map → render-aS-w4fK4.js.map} +1 -1
- package/output/renderer.css +930 -175
- package/output/server.cjs +2 -2
- package/output/server.js +2 -2
- package/package.json +3 -1
- package/output/ClarifyShell-1LuBliwt.js.map +0 -1
- package/output/ClarifyShell-C6li72Ce.cjs.map +0 -1
- package/output/OpenApiOperation-CqNM-no4.js.map +0 -1
- package/output/OpenApiOperation-DK46w2dq.cjs.map +0 -1
- package/output/PageActions-BjB6PYmL.cjs.map +0 -1
- package/output/PageActions-D7K9LDGf.js.map +0 -1
- package/output/i18n-DnqZHFT7.js.map +0 -1
- package/output/i18n-b4iTLeia.cjs.map +0 -1
- package/output/remark-Dd2WU50s.js.map +0 -1
- package/output/remark-zSQT0MBv.cjs.map +0 -1
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { a as useConfig, s as useLocale, t as useBuiltInText } from "./i18n-
|
|
2
|
-
import { C as isExternalHref, E as copyTextToClipboard, c as lucideIconRegistry, h as useTheme, l as resolveLucideIconName, n as PageTitleActions, o as useSectionStore, s as remToPx, w as localizeHref } from "./PageActions-
|
|
3
|
-
import { t as markdownRemarkPlugins } from "./remark-
|
|
1
|
+
import { a as useConfig, s as useLocale, t as useBuiltInText } from "./i18n-Bqth9d6Q.js";
|
|
2
|
+
import { C as isExternalHref, E as copyTextToClipboard, c as lucideIconRegistry, h as useTheme, l as resolveLucideIconName, n as PageTitleActions, o as useSectionStore, s as remToPx, w as localizeHref } from "./PageActions-BQeEmXbT.js";
|
|
3
|
+
import { t as markdownRemarkPlugins } from "./remark-C9iRQM0R.js";
|
|
4
4
|
import clsx from "clsx";
|
|
5
|
-
import { Children, Suspense, createContext, createElement, forwardRef, isValidElement, lazy, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
5
|
+
import { Children, Suspense, cloneElement, createContext, createElement, forwardRef, isValidElement, lazy, useContext, useEffect, useId, useLayoutEffect, useRef, useState } from "react";
|
|
6
6
|
import { Link } from "react-router-dom";
|
|
7
|
-
import { Listbox, ListboxButton, ListboxOption, ListboxOptions, Tab, TabGroup, TabList, TabPanel, TabPanels, Transition } from "@headlessui/react";
|
|
8
|
-
import { AlertTriangle, ArrowRight, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, CopyIcon, Info, Lightbulb, LinkIcon, LockKeyholeIcon, PackageIcon, ServerIcon, UnlockKeyholeIcon, XCircle } from "lucide-react";
|
|
7
|
+
import { Dialog, DialogBackdrop, DialogPanel, Listbox, ListboxButton, ListboxOption, ListboxOptions, Tab, TabGroup, TabList, TabPanel, TabPanels, Transition } from "@headlessui/react";
|
|
8
|
+
import { AlertTriangle, ArrowRight, ArrowUpRight, Check, CheckCircle2, CheckIcon, ChevronDown, ChevronDownIcon, ChevronRight, ChevronsUpDownIcon, CircleCheck, Clipboard, ClipboardIcon, CodeIcon, CopyIcon, File, Folder, FolderOpen, Info, Lightbulb, LinkIcon, LockKeyholeIcon, Maximize2, PackageIcon, ServerIcon, UnlockKeyholeIcon, X, XCircle } from "lucide-react";
|
|
9
9
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { motion, useInView } from "framer-motion";
|
|
11
11
|
import { create } from "zustand";
|
|
12
12
|
import ReactMarkdown from "react-markdown";
|
|
13
|
+
import rehypeRaw from "rehype-raw";
|
|
13
14
|
import { slug } from "github-slugger";
|
|
15
|
+
import { codeToTokens, createCssVariablesTheme } from "shiki";
|
|
14
16
|
import { snippetz } from "@scalar/snippetz";
|
|
15
17
|
//#region \0rolldown/runtime.js
|
|
16
18
|
var __defProp = Object.defineProperty;
|
|
@@ -24,6 +26,32 @@ var __exportAll = (all, no_symbols) => {
|
|
|
24
26
|
return target;
|
|
25
27
|
};
|
|
26
28
|
//#endregion
|
|
29
|
+
//#region source/components/AccordionGroup.tsx
|
|
30
|
+
function AccordionGroup(arg0) {
|
|
31
|
+
const { children, multiple = false, className, ...props } = arg0;
|
|
32
|
+
const childArray = Children.toArray(children);
|
|
33
|
+
const [openIndex, setOpenIndex] = useState(() => {
|
|
34
|
+
const defaultIndex = childArray.findIndex((child) => isValidElement(child) && child.props.defaultOpen);
|
|
35
|
+
return defaultIndex === -1 ? null : defaultIndex;
|
|
36
|
+
});
|
|
37
|
+
const items = childArray.map((child, index) => {
|
|
38
|
+
if (!isValidElement(child)) return child;
|
|
39
|
+
if (multiple) return child;
|
|
40
|
+
return cloneElement(child, {
|
|
41
|
+
open: openIndex === index,
|
|
42
|
+
onOpenChange: (open) => {
|
|
43
|
+
child.props.onOpenChange?.(open);
|
|
44
|
+
setOpenIndex(open ? index : null);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
return /* @__PURE__ */ jsx("div", {
|
|
49
|
+
className: clsx("clarify-accordion-group my-6 divide-y divide-(--clarify-theme-tokens-colors-border) overflow-hidden rounded-(--clarify-theme-tokens-radius-lg) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) [&_.clarify-collapse]:my-0 [&_.clarify-collapse]:rounded-none [&_.clarify-collapse]:border-0", className),
|
|
50
|
+
...props,
|
|
51
|
+
children: items
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
27
55
|
//#region source/components/LocalizedLink.tsx
|
|
28
56
|
function useLocalizedHref(href) {
|
|
29
57
|
return localizeHref(href, useConfig(), useLocale());
|
|
@@ -43,15 +71,15 @@ function LocalizedLink(arg0) {
|
|
|
43
71
|
//#endregion
|
|
44
72
|
//#region source/components/Button.tsx
|
|
45
73
|
var buttonVariantStyles = {
|
|
46
|
-
primary: "
|
|
47
|
-
secondary: "
|
|
48
|
-
filled: "
|
|
49
|
-
outline: "
|
|
74
|
+
primary: "bg-(--clarify-theme-tokens-colors-foreground) px-4 text-(--clarify-theme-tokens-colors-background) shadow-sm hover:-translate-y-px hover:shadow-md active:translate-y-0 active:shadow-sm dark:bg-(--clarify-theme-tokens-colors-primary) dark:text-zinc-950",
|
|
75
|
+
secondary: "bg-(--clarify-theme-tokens-colors-code-background) px-4 text-(--clarify-ui-text-soft) ring-1 ring-inset ring-(--clarify-theme-tokens-colors-border) hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)",
|
|
76
|
+
filled: "bg-(--clarify-theme-tokens-colors-primary) px-4 text-white shadow-sm hover:-translate-y-px hover:shadow-md active:translate-y-0 dark:text-zinc-950",
|
|
77
|
+
outline: "px-4 text-(--clarify-ui-text-soft) ring-1 ring-inset ring-(--clarify-theme-tokens-colors-border) hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)",
|
|
50
78
|
text: "text-(--clarify-theme-tokens-colors-primary) hover:opacity-80 dark:text-(--clarify-theme-tokens-colors-primary) dark:hover:opacity-80"
|
|
51
79
|
};
|
|
52
80
|
function Button(arg0) {
|
|
53
81
|
const { variant = "primary", className, children, arrow, ...props } = arg0;
|
|
54
|
-
const classes = clsx("clarify-button not-prose inline-flex w-fit max-w-full items-center justify-center gap-1 overflow-hidden align-middle text-sm
|
|
82
|
+
const classes = clsx("clarify-button not-prose inline-flex w-fit max-w-full items-center justify-center gap-1.5 overflow-hidden align-middle text-sm font-semibold whitespace-nowrap no-underline transition duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2 focus-visible:ring-offset-(--clarify-theme-tokens-colors-background)", variant === "text" ? "h-auto rounded-sm" : "h-9 rounded-(--clarify-theme-tokens-radius-lg)", buttonVariantStyles[variant], className);
|
|
55
83
|
const arrowIcon = /* @__PURE__ */ jsx(ArrowRight, {
|
|
56
84
|
"aria-hidden": "true",
|
|
57
85
|
className: clsx("h-4 w-4 shrink-0", variant === "text" && "relative top-px", arrow === "left" && "-ml-0.5 rotate-180", arrow === "right" && "-mr-0.5")
|
|
@@ -79,37 +107,43 @@ function Button(arg0) {
|
|
|
79
107
|
//#region source/components/Callout.tsx
|
|
80
108
|
var calloutStyles = {
|
|
81
109
|
info: {
|
|
82
|
-
container: "border-sky-500/20 bg-sky-50/
|
|
110
|
+
container: "border-sky-500/20 bg-sky-50/30 dark:border-sky-400/20 dark:bg-sky-400/5",
|
|
111
|
+
iconContainer: "bg-sky-100 ring-sky-500/15 dark:bg-sky-400/10 dark:ring-sky-400/20",
|
|
83
112
|
icon: "text-sky-600 dark:text-sky-400",
|
|
84
113
|
title: "text-sky-900 dark:text-sky-100",
|
|
85
114
|
Icon: Info
|
|
86
115
|
},
|
|
87
116
|
note: {
|
|
88
|
-
container: "border-zinc-500/20 bg-zinc-50
|
|
117
|
+
container: "border-zinc-500/20 bg-zinc-50/50 dark:border-white/10 dark:bg-white/5",
|
|
118
|
+
iconContainer: "bg-zinc-200/70 ring-zinc-500/15 dark:bg-white/10 dark:ring-white/10",
|
|
89
119
|
icon: "text-zinc-500 dark:text-zinc-400",
|
|
90
120
|
title: "text-zinc-900 dark:text-white",
|
|
91
121
|
Icon: Info
|
|
92
122
|
},
|
|
93
123
|
tip: {
|
|
94
|
-
container: "border-emerald-500/20 bg-emerald-50/
|
|
124
|
+
container: "border-emerald-500/20 bg-emerald-50/30 dark:border-emerald-400/20 dark:bg-emerald-400/5",
|
|
125
|
+
iconContainer: "bg-emerald-100 ring-emerald-500/15 dark:bg-emerald-400/10 dark:ring-emerald-400/20",
|
|
95
126
|
icon: "text-emerald-600 dark:text-emerald-400",
|
|
96
127
|
title: "text-emerald-900 dark:text-emerald-100",
|
|
97
128
|
Icon: Lightbulb
|
|
98
129
|
},
|
|
99
130
|
warning: {
|
|
100
|
-
container: "border-amber-500/20 bg-amber-50/
|
|
131
|
+
container: "border-amber-500/20 bg-amber-50/40 dark:border-amber-400/20 dark:bg-amber-400/5",
|
|
132
|
+
iconContainer: "bg-amber-100 ring-amber-500/15 dark:bg-amber-400/10 dark:ring-amber-400/20",
|
|
101
133
|
icon: "text-amber-600 dark:text-amber-400",
|
|
102
134
|
title: "text-amber-900 dark:text-amber-100",
|
|
103
135
|
Icon: AlertTriangle
|
|
104
136
|
},
|
|
105
137
|
danger: {
|
|
106
|
-
container: "border-rose-500/20 bg-rose-50/
|
|
138
|
+
container: "border-rose-500/20 bg-rose-50/40 dark:border-rose-400/20 dark:bg-rose-400/5",
|
|
139
|
+
iconContainer: "bg-rose-100 ring-rose-500/15 dark:bg-rose-400/10 dark:ring-rose-400/20",
|
|
107
140
|
icon: "text-rose-600 dark:text-rose-400",
|
|
108
141
|
title: "text-rose-900 dark:text-rose-100",
|
|
109
142
|
Icon: XCircle
|
|
110
143
|
},
|
|
111
144
|
success: {
|
|
112
|
-
container: "border-emerald-500/20 bg-emerald-50/
|
|
145
|
+
container: "border-emerald-500/20 bg-emerald-50/30 dark:border-emerald-400/20 dark:bg-emerald-400/5",
|
|
146
|
+
iconContainer: "bg-emerald-100 ring-emerald-500/15 dark:bg-emerald-400/10 dark:ring-emerald-400/20",
|
|
113
147
|
icon: "text-emerald-600 dark:text-emerald-400",
|
|
114
148
|
title: "text-emerald-900 dark:text-emerald-100",
|
|
115
149
|
Icon: CheckCircle2
|
|
@@ -130,15 +164,18 @@ function Callout(arg0) {
|
|
|
130
164
|
const Icon = style.Icon;
|
|
131
165
|
const resolvedTitle = title === void 0 ? t(defaultTitleKeys[type]) : title;
|
|
132
166
|
return /* @__PURE__ */ jsxs("div", {
|
|
133
|
-
className: clsx("clarify-callout my-6 flex gap-3 rounded-(--clarify-theme-tokens-radius-
|
|
167
|
+
className: clsx("clarify-callout my-6 flex gap-3.5 rounded-(--clarify-theme-tokens-radius-lg) border p-4 text-sm/6 text-(--clarify-ui-text-soft)", style.container, className),
|
|
134
168
|
...props,
|
|
135
|
-
children: [icon ? /* @__PURE__ */ jsx(
|
|
136
|
-
className: clsx("
|
|
137
|
-
|
|
169
|
+
children: [icon ? /* @__PURE__ */ jsx("span", {
|
|
170
|
+
className: clsx("flex size-7 flex-none items-center justify-center rounded-(--clarify-theme-tokens-radius-md) ring-1 ring-inset", style.iconContainer),
|
|
171
|
+
children: /* @__PURE__ */ jsx(Icon, {
|
|
172
|
+
className: clsx("size-4", style.icon),
|
|
173
|
+
"aria-hidden": "true"
|
|
174
|
+
})
|
|
138
175
|
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
139
176
|
className: "min-w-0 flex-1 *:first:mt-0 *:last:mb-0",
|
|
140
177
|
children: [resolvedTitle ? /* @__PURE__ */ jsx("p", {
|
|
141
|
-
className: clsx("mb-1 font-semibold", style.title),
|
|
178
|
+
className: clsx("mb-1.5 font-semibold", style.title),
|
|
142
179
|
children: resolvedTitle
|
|
143
180
|
}) : null, /* @__PURE__ */ jsx("div", {
|
|
144
181
|
className: "*:first:mt-0 *:last:mb-0",
|
|
@@ -157,9 +194,9 @@ function CardIcon(arg0) {
|
|
|
157
194
|
const Icon = lucideIconRegistry[iconName];
|
|
158
195
|
if (!Icon) return null;
|
|
159
196
|
return /* @__PURE__ */ jsx("span", {
|
|
160
|
-
className: "flex size-
|
|
197
|
+
className: "flex size-8 flex-none items-center justify-center rounded-(--clarify-theme-tokens-radius-md) bg-(--clarify-ui-accent-background) text-(--clarify-ui-accent-text) ring-1 ring-inset ring-(--clarify-ui-accent-border) transition-colors group-hover:bg-(--clarify-theme-tokens-colors-primary) group-hover:text-white dark:group-hover:text-zinc-950",
|
|
161
198
|
children: /* @__PURE__ */ jsx(Icon, {
|
|
162
|
-
className: "size-
|
|
199
|
+
className: "size-4",
|
|
163
200
|
"aria-hidden": "true"
|
|
164
201
|
})
|
|
165
202
|
});
|
|
@@ -173,7 +210,7 @@ var cardGroupColumnStyles = {
|
|
|
173
210
|
function CardGroup(arg0) {
|
|
174
211
|
const { children, cols = 2, className } = arg0;
|
|
175
212
|
return /* @__PURE__ */ jsx("div", {
|
|
176
|
-
className: clsx("not-prose my-
|
|
213
|
+
className: clsx("not-prose my-8 grid gap-3", cardGroupColumnStyles[cols], className),
|
|
177
214
|
children
|
|
178
215
|
});
|
|
179
216
|
}
|
|
@@ -183,11 +220,17 @@ function Card(arg0) {
|
|
|
183
220
|
className: "flex items-start gap-4",
|
|
184
221
|
children: [/* @__PURE__ */ jsx(CardIcon, { name: icon }), /* @__PURE__ */ jsxs("div", {
|
|
185
222
|
className: "min-w-0 flex-1",
|
|
186
|
-
children: [/* @__PURE__ */
|
|
187
|
-
className: "
|
|
188
|
-
children:
|
|
223
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
224
|
+
className: "flex items-start justify-between gap-3",
|
|
225
|
+
children: [/* @__PURE__ */ jsx("h3", {
|
|
226
|
+
className: "m-0 text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
|
|
227
|
+
children: title
|
|
228
|
+
}), href ? /* @__PURE__ */ jsx(ArrowUpRight, {
|
|
229
|
+
className: "mt-1 size-3.5 shrink-0 text-(--clarify-ui-text-faint) transition group-hover:-translate-y-0.5 group-hover:translate-x-0.5 group-hover:text-(--clarify-ui-accent-text)",
|
|
230
|
+
"aria-hidden": "true"
|
|
231
|
+
}) : null]
|
|
189
232
|
}), children ? /* @__PURE__ */ jsx("div", {
|
|
190
|
-
className: "mt-
|
|
233
|
+
className: "mt-1.5 text-sm/6 text-(--clarify-ui-text-soft) *:m-0",
|
|
191
234
|
children
|
|
192
235
|
}) : null]
|
|
193
236
|
})]
|
|
@@ -195,7 +238,7 @@ function Card(arg0) {
|
|
|
195
238
|
className: "absolute inset-0 rounded-(--clarify-theme-tokens-radius-xl)",
|
|
196
239
|
"aria-hidden": "true"
|
|
197
240
|
}) : null] });
|
|
198
|
-
const classes = clsx("group relative block rounded-(--clarify-theme-tokens-radius-
|
|
241
|
+
const classes = clsx("group relative block rounded-(--clarify-theme-tokens-radius-lg) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) p-4 transition duration-200", href && "hover:-translate-y-0.5 hover:border-(--clarify-ui-accent-border) hover:shadow-md hover:shadow-zinc-900/5 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) focus-visible:ring-offset-2 dark:hover:shadow-none", className);
|
|
199
242
|
if (!href) return /* @__PURE__ */ jsx("div", {
|
|
200
243
|
className: classes,
|
|
201
244
|
children: content
|
|
@@ -209,7 +252,7 @@ function Card(arg0) {
|
|
|
209
252
|
}
|
|
210
253
|
//#endregion
|
|
211
254
|
//#region source/components/Mermaid.tsx
|
|
212
|
-
var MermaidViewer = lazy(() => import("./MermaidViewer-
|
|
255
|
+
var MermaidViewer = lazy(() => import("./MermaidViewer-Bc9H25yK.js"));
|
|
213
256
|
var mermaidModulePromise;
|
|
214
257
|
async function loadMermaid() {
|
|
215
258
|
mermaidModulePromise = mermaidModulePromise ?? import("mermaid").then((module) => module.default);
|
|
@@ -335,6 +378,27 @@ function getNodeText(node) {
|
|
|
335
378
|
if (isValidElement(node)) return getNodeText(node.props.children);
|
|
336
379
|
return "";
|
|
337
380
|
}
|
|
381
|
+
function getCodeTitle(node) {
|
|
382
|
+
if (!isValidElement(node)) return void 0;
|
|
383
|
+
const { title, children } = node.props;
|
|
384
|
+
if (title) return title;
|
|
385
|
+
return Children.toArray(children).map(getCodeTitle).find(Boolean);
|
|
386
|
+
}
|
|
387
|
+
function getCodeLanguage(node) {
|
|
388
|
+
if (!isValidElement(node)) return void 0;
|
|
389
|
+
const { className, language, children } = node.props;
|
|
390
|
+
if (language) return language;
|
|
391
|
+
const languageClass = className?.split(/\s+/).find((value) => value.startsWith("language-"));
|
|
392
|
+
if (languageClass) return languageClass.slice(9);
|
|
393
|
+
return Children.toArray(children).map(getCodeLanguage).find(Boolean);
|
|
394
|
+
}
|
|
395
|
+
function getCodePanelTitle(node, fallbackTitle) {
|
|
396
|
+
return getPanelTitle({
|
|
397
|
+
title: getCodeTitle(node),
|
|
398
|
+
language: getCodeLanguage(node),
|
|
399
|
+
fallbackTitle
|
|
400
|
+
});
|
|
401
|
+
}
|
|
338
402
|
function CopyButton(arg0) {
|
|
339
403
|
const { code } = arg0;
|
|
340
404
|
const t = useBuiltInText();
|
|
@@ -404,6 +468,7 @@ function CodeGroupHeader(arg0) {
|
|
|
404
468
|
const { title, children, selectedIndex } = arg0;
|
|
405
469
|
const t = useBuiltInText();
|
|
406
470
|
const hasTabs = Children.count(children) > 1;
|
|
471
|
+
const indicatorLayoutId = useId();
|
|
407
472
|
if (!title && !hasTabs) return null;
|
|
408
473
|
return /* @__PURE__ */ jsxs("div", {
|
|
409
474
|
className: "clarify-code-group-header flex min-h-(--clarify-code-header-min-height) flex-wrap items-start gap-x-4 border-b border-(--clarify-code-border) bg-(--clarify-code-header-background) px-4",
|
|
@@ -411,13 +476,19 @@ function CodeGroupHeader(arg0) {
|
|
|
411
476
|
className: "mr-auto pt-3 text-xs font-semibold text-(--clarify-code-text)",
|
|
412
477
|
children: title
|
|
413
478
|
}) : null, hasTabs ? /* @__PURE__ */ jsx(TabList, {
|
|
414
|
-
className: "clarify-code-tabs -mb-px flex gap-
|
|
415
|
-
children: Children.map(children, (child, childIndex) => /* @__PURE__ */
|
|
416
|
-
className: clsx("clarify-code-tab border-b py-3 transition data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "
|
|
417
|
-
children:
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
479
|
+
className: "clarify-code-tabs -mr-2 -mb-px flex gap-0 text-xs font-medium",
|
|
480
|
+
children: Children.map(children, (child, childIndex) => /* @__PURE__ */ jsxs(Tab, {
|
|
481
|
+
className: clsx("clarify-code-tab relative border-b border-transparent px-2 py-3 transition-colors hover:bg-(--clarify-code-control-background-hover) data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "text-(--clarify-code-accent-text)" : "text-(--clarify-code-control-text) hover:text-(--clarify-code-text)"),
|
|
482
|
+
children: [getCodePanelTitle(child, t("actions.code")), childIndex === selectedIndex ? /* @__PURE__ */ jsx(motion.span, {
|
|
483
|
+
layoutId: indicatorLayoutId,
|
|
484
|
+
className: "absolute inset-x-2 bottom-0 h-0.5 rounded-full bg-(--clarify-code-accent-text)",
|
|
485
|
+
transition: {
|
|
486
|
+
type: "spring",
|
|
487
|
+
stiffness: 460,
|
|
488
|
+
damping: 34,
|
|
489
|
+
mass: .7
|
|
490
|
+
}
|
|
491
|
+
}) : null]
|
|
421
492
|
}))
|
|
422
493
|
}) : null]
|
|
423
494
|
});
|
|
@@ -482,10 +553,7 @@ var CodeGroupContext = createContext(false);
|
|
|
482
553
|
function CodeGroup(arg0) {
|
|
483
554
|
const { children, title, ...props } = arg0;
|
|
484
555
|
const t = useBuiltInText();
|
|
485
|
-
const tabGroupProps = useTabGroupProps(Children.map(children, (child) =>
|
|
486
|
-
...isValidElement(child) ? child.props : {},
|
|
487
|
-
fallbackTitle: t("actions.code")
|
|
488
|
-
})) ?? []);
|
|
556
|
+
const tabGroupProps = useTabGroupProps(Children.map(children, (child) => getCodePanelTitle(child, t("actions.code"))) ?? []);
|
|
489
557
|
const hasTabs = Children.count(children) > 1;
|
|
490
558
|
const containerClassName = "clarify-code-group my-6 overflow-hidden rounded-2xl bg-(--clarify-code-background) shadow-md ring-1 ring-(--clarify-code-border)";
|
|
491
559
|
const header = /* @__PURE__ */ jsx(CodeGroupHeader, {
|
|
@@ -529,7 +597,9 @@ function Code(arg0) {
|
|
|
529
597
|
function Pre(arg0) {
|
|
530
598
|
const { children, language, code, ...props } = arg0;
|
|
531
599
|
const isGrouped = useContext(CodeGroupContext);
|
|
532
|
-
|
|
600
|
+
const resolvedLanguage = language ?? getCodeLanguage(children);
|
|
601
|
+
const resolvedCode = code ?? getNodeText(children);
|
|
602
|
+
if (resolvedLanguage === "mermaid") return /* @__PURE__ */ jsx(Mermaid, { chart: resolvedCode });
|
|
533
603
|
if (isGrouped) return children;
|
|
534
604
|
return /* @__PURE__ */ jsx(CodeGroup, {
|
|
535
605
|
...props,
|
|
@@ -539,8 +609,9 @@ function Pre(arg0) {
|
|
|
539
609
|
//#endregion
|
|
540
610
|
//#region source/components/Collapse.tsx
|
|
541
611
|
function Collapse(arg0) {
|
|
542
|
-
const { children, title, summary, defaultOpen = false, className, ...props } = arg0;
|
|
543
|
-
const [
|
|
612
|
+
const { children, title, summary, defaultOpen = false, open: controlledOpen, onOpenChange, className, ...props } = arg0;
|
|
613
|
+
const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);
|
|
614
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
544
615
|
const contentRef = useRef(null);
|
|
545
616
|
const [maxHeight, setMaxHeight] = useState("0px");
|
|
546
617
|
const summaryLabel = title ?? summary ?? "Details";
|
|
@@ -550,16 +621,20 @@ function Collapse(arg0) {
|
|
|
550
621
|
setMaxHeight(open ? `${contentRef.current.scrollHeight}px` : "0px");
|
|
551
622
|
}, [open, children]);
|
|
552
623
|
return /* @__PURE__ */ jsxs("div", {
|
|
553
|
-
className: clsx("clarify-collapse my-6 overflow-hidden rounded-(--clarify-theme-tokens-radius-
|
|
624
|
+
className: clsx("clarify-collapse my-6 overflow-hidden rounded-(--clarify-theme-tokens-radius-lg) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) transition-colors", open && "border-(--clarify-ui-accent-border)", className),
|
|
554
625
|
...props,
|
|
555
626
|
children: [/* @__PURE__ */ jsxs("button", {
|
|
556
627
|
type: "button",
|
|
557
|
-
className: "flex w-full cursor-pointer items-center justify-between gap-3 px-4 py-
|
|
628
|
+
className: "flex min-h-11 w-full cursor-pointer items-center justify-between gap-3 px-4 py-2.5 text-left text-sm font-semibold text-(--clarify-theme-tokens-colors-foreground) transition hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-(--clarify-theme-tokens-colors-primary)",
|
|
558
629
|
"aria-expanded": open,
|
|
559
630
|
"aria-controls": contentId,
|
|
560
|
-
onClick: () =>
|
|
631
|
+
onClick: () => {
|
|
632
|
+
const nextOpen = !open;
|
|
633
|
+
if (controlledOpen === void 0) setUncontrolledOpen(nextOpen);
|
|
634
|
+
onOpenChange?.(nextOpen);
|
|
635
|
+
},
|
|
561
636
|
children: [/* @__PURE__ */ jsx("span", { children: summaryLabel }), /* @__PURE__ */ jsx(ChevronDown, {
|
|
562
|
-
className: clsx("
|
|
637
|
+
className: clsx("size-4 rounded-full text-(--clarify-ui-text-faint) transition duration-200", open && "rotate-180"),
|
|
563
638
|
"aria-hidden": "true"
|
|
564
639
|
})]
|
|
565
640
|
}), /* @__PURE__ */ jsx("div", {
|
|
@@ -571,7 +646,7 @@ function Collapse(arg0) {
|
|
|
571
646
|
},
|
|
572
647
|
children: /* @__PURE__ */ jsx("div", {
|
|
573
648
|
ref: contentRef,
|
|
574
|
-
className: clsx("px-4 py-4 text-sm/6 text-(--clarify-
|
|
649
|
+
className: clsx("px-4 py-4 text-sm/6 text-(--clarify-ui-text-soft) transition-opacity duration-200 ease-out *:first:mt-0 *:last:mb-0", open ? "opacity-100 translate-y-0" : "opacity-0 -translate-y-1"),
|
|
575
650
|
children
|
|
576
651
|
})
|
|
577
652
|
})]
|
|
@@ -647,6 +722,55 @@ function Feedback() {
|
|
|
647
722
|
});
|
|
648
723
|
}
|
|
649
724
|
//#endregion
|
|
725
|
+
//#region source/components/FileTree.tsx
|
|
726
|
+
function FileTree(arg0) {
|
|
727
|
+
const { children, className, ...props } = arg0;
|
|
728
|
+
return /* @__PURE__ */ jsx("div", {
|
|
729
|
+
className: clsx("clarify-file-tree not-prose my-6 overflow-x-auto rounded-(--clarify-theme-tokens-radius-lg) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-4 py-3 font-mono text-[13px]/6 text-(--clarify-ui-text-soft)", className),
|
|
730
|
+
...props,
|
|
731
|
+
children: /* @__PURE__ */ jsx("ul", {
|
|
732
|
+
role: "tree",
|
|
733
|
+
className: "m-0 min-w-max list-none p-0",
|
|
734
|
+
children
|
|
735
|
+
})
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
function FileTreeItem(arg0) {
|
|
739
|
+
const { name, description, type, children, className, ...props } = arg0;
|
|
740
|
+
const isFolder = type === "folder" || children != null;
|
|
741
|
+
const FolderIcon = children ? FolderOpen : Folder;
|
|
742
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
743
|
+
role: "treeitem",
|
|
744
|
+
"aria-expanded": isFolder ? children != null : void 0,
|
|
745
|
+
className: clsx("clarify-file-tree-item m-0 p-0", className),
|
|
746
|
+
...props,
|
|
747
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
748
|
+
className: "flex min-h-6 items-center gap-2 whitespace-nowrap",
|
|
749
|
+
children: [
|
|
750
|
+
isFolder ? /* @__PURE__ */ jsx(FolderIcon, {
|
|
751
|
+
className: "size-4 flex-none text-(--clarify-ui-accent-text)",
|
|
752
|
+
"aria-hidden": "true"
|
|
753
|
+
}) : /* @__PURE__ */ jsx(File, {
|
|
754
|
+
className: "size-4 flex-none text-(--clarify-ui-text-faint)",
|
|
755
|
+
"aria-hidden": "true"
|
|
756
|
+
}),
|
|
757
|
+
/* @__PURE__ */ jsx("span", {
|
|
758
|
+
className: "font-medium text-(--clarify-theme-tokens-colors-foreground)",
|
|
759
|
+
children: name
|
|
760
|
+
}),
|
|
761
|
+
description ? /* @__PURE__ */ jsx("span", {
|
|
762
|
+
className: "font-sans text-xs text-(--clarify-ui-text-faint)",
|
|
763
|
+
children: description
|
|
764
|
+
}) : null
|
|
765
|
+
]
|
|
766
|
+
}), children ? /* @__PURE__ */ jsx("ul", {
|
|
767
|
+
role: "group",
|
|
768
|
+
className: "m-0 ml-2.5 list-none border-l border-(--clarify-theme-tokens-colors-border) pl-4",
|
|
769
|
+
children
|
|
770
|
+
}) : null]
|
|
771
|
+
});
|
|
772
|
+
}
|
|
773
|
+
//#endregion
|
|
650
774
|
//#region source/components/Tag.tsx
|
|
651
775
|
var tagVariantStyles = {
|
|
652
776
|
small: "",
|
|
@@ -853,10 +977,50 @@ function Prose(arg0) {
|
|
|
853
977
|
});
|
|
854
978
|
}
|
|
855
979
|
//#endregion
|
|
980
|
+
//#region source/components/Steps.tsx
|
|
981
|
+
function Steps(arg0) {
|
|
982
|
+
const { children, className, ...props } = arg0;
|
|
983
|
+
return /* @__PURE__ */ jsx("ol", {
|
|
984
|
+
className: clsx("clarify-steps my-8 ml-3 list-none border-l-2 border-(--clarify-theme-tokens-colors-border) p-0", className),
|
|
985
|
+
...props,
|
|
986
|
+
children
|
|
987
|
+
});
|
|
988
|
+
}
|
|
989
|
+
function Step(arg0) {
|
|
990
|
+
const { children, title, className, ...props } = arg0;
|
|
991
|
+
return /* @__PURE__ */ jsxs("li", {
|
|
992
|
+
className: clsx("clarify-step relative m-0 pb-10 pl-9 last:pb-0", className),
|
|
993
|
+
...props,
|
|
994
|
+
children: [
|
|
995
|
+
/* @__PURE__ */ jsx("span", {
|
|
996
|
+
className: "absolute top-0 -left-3.5 flex size-7 items-center justify-center rounded-full bg-(--clarify-theme-tokens-colors-primary) text-xs font-semibold text-white shadow-[0_0_0_4px_var(--clarify-theme-tokens-colors-background)] before:content-[counter(list-item)] dark:text-zinc-950",
|
|
997
|
+
"aria-hidden": "true"
|
|
998
|
+
}),
|
|
999
|
+
title ? /* @__PURE__ */ jsx("h3", {
|
|
1000
|
+
className: "m-0 pt-0.5 text-base font-semibold text-(--clarify-theme-tokens-colors-foreground)",
|
|
1001
|
+
children: title
|
|
1002
|
+
}) : null,
|
|
1003
|
+
/* @__PURE__ */ jsx("div", {
|
|
1004
|
+
className: clsx("text-sm/6 text-(--clarify-ui-text-soft) *:last:mb-0", title && "mt-2.5", !title && "*:first:mt-0"),
|
|
1005
|
+
children
|
|
1006
|
+
})
|
|
1007
|
+
]
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
//#endregion
|
|
856
1011
|
//#region source/components/Tabs.tsx
|
|
1012
|
+
function TabItem(_props) {
|
|
1013
|
+
return null;
|
|
1014
|
+
}
|
|
857
1015
|
function Tabs(arg0) {
|
|
858
|
-
const { items, selectedIndex, onChange, className, listClassName, panelsClassName } = arg0;
|
|
859
|
-
const
|
|
1016
|
+
const { items, children, defaultValue, selectedIndex, onChange, className, listClassName, panelsClassName } = arg0;
|
|
1017
|
+
const childItems = Children.toArray(children).filter((child) => isValidElement(child) && child.type === TabItem).map((child, index) => ({
|
|
1018
|
+
id: child.props.value ?? `tab-${index}`,
|
|
1019
|
+
label: child.props.title,
|
|
1020
|
+
panel: child.props.children
|
|
1021
|
+
}));
|
|
1022
|
+
const resolvedItems = items ?? childItems;
|
|
1023
|
+
const [internalIndex, setInternalIndex] = useState(defaultValue ? Math.max(0, resolvedItems.findIndex((item) => item.id === defaultValue)) : 0);
|
|
860
1024
|
const resolvedIndex = typeof selectedIndex === "number" ? selectedIndex : internalIndex;
|
|
861
1025
|
const indicatorLayoutId = useId();
|
|
862
1026
|
const handleChange = (index) => {
|
|
@@ -866,14 +1030,14 @@ function Tabs(arg0) {
|
|
|
866
1030
|
return /* @__PURE__ */ jsxs(TabGroup, {
|
|
867
1031
|
selectedIndex: resolvedIndex,
|
|
868
1032
|
onChange: handleChange,
|
|
869
|
-
className,
|
|
1033
|
+
className: clsx("clarify-tabs my-6", className),
|
|
870
1034
|
children: [/* @__PURE__ */ jsx(TabList, {
|
|
871
|
-
className: clsx("flex
|
|
872
|
-
children:
|
|
873
|
-
className: ({ selected }) => clsx("clarify-ui-tab relative inline-flex h-
|
|
1035
|
+
className: clsx("flex max-w-full items-stretch gap-1 overflow-x-auto border-b border-(--clarify-theme-tokens-colors-border)", listClassName),
|
|
1036
|
+
children: resolvedItems.map((item) => /* @__PURE__ */ jsx(Tab, {
|
|
1037
|
+
className: ({ selected }) => clsx("clarify-content-tab clarify-ui-tab relative my-1 inline-flex h-9 shrink-0 items-center rounded-(--clarify-theme-tokens-radius-md) px-2.5 transition focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-(--clarify-theme-tokens-colors-primary)", selected && "clarify-ui-tab-active"),
|
|
874
1038
|
children: ({ selected }) => /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", { children: item.label }), selected ? /* @__PURE__ */ jsx(motion.span, {
|
|
875
1039
|
layoutId: indicatorLayoutId,
|
|
876
|
-
className: "absolute inset-x-
|
|
1040
|
+
className: "absolute inset-x-2.5 -bottom-1 h-0.5 rounded-full bg-(--clarify-ui-tab-indicator)",
|
|
877
1041
|
transition: {
|
|
878
1042
|
type: "tween",
|
|
879
1043
|
duration: .16,
|
|
@@ -882,15 +1046,44 @@ function Tabs(arg0) {
|
|
|
882
1046
|
}) : null] })
|
|
883
1047
|
}, item.id))
|
|
884
1048
|
}), /* @__PURE__ */ jsx(TabPanels, {
|
|
885
|
-
className: clsx("mt-
|
|
886
|
-
children:
|
|
887
|
-
className: "focus:outline-none",
|
|
1049
|
+
className: clsx("mt-5", panelsClassName),
|
|
1050
|
+
children: resolvedItems.map((item) => /* @__PURE__ */ jsx(TabPanel, {
|
|
1051
|
+
className: "focus:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)",
|
|
888
1052
|
children: item.panel
|
|
889
1053
|
}, item.id))
|
|
890
1054
|
})]
|
|
891
1055
|
});
|
|
892
1056
|
}
|
|
893
1057
|
//#endregion
|
|
1058
|
+
//#region source/components/Tooltip.tsx
|
|
1059
|
+
function Tooltip(arg0) {
|
|
1060
|
+
const { content, children, side = "top", className, ...props } = arg0;
|
|
1061
|
+
const contentId = useId();
|
|
1062
|
+
const [open, setOpen] = useState(false);
|
|
1063
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
1064
|
+
className: clsx("clarify-tooltip group relative inline-flex align-baseline", className),
|
|
1065
|
+
onMouseEnter: () => setOpen(true),
|
|
1066
|
+
onMouseLeave: () => setOpen(false),
|
|
1067
|
+
...props,
|
|
1068
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1069
|
+
tabIndex: 0,
|
|
1070
|
+
"aria-describedby": contentId,
|
|
1071
|
+
className: "cursor-help rounded-sm border-b border-dotted border-current focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)",
|
|
1072
|
+
onFocus: () => setOpen(true),
|
|
1073
|
+
onBlur: () => setOpen(false),
|
|
1074
|
+
onKeyDown: (event) => {
|
|
1075
|
+
if (event.key === "Escape") setOpen(false);
|
|
1076
|
+
},
|
|
1077
|
+
children
|
|
1078
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1079
|
+
id: contentId,
|
|
1080
|
+
role: "tooltip",
|
|
1081
|
+
className: clsx("pointer-events-none absolute left-1/2 z-30 w-max max-w-64 -translate-x-1/2 rounded-md bg-(--clarify-theme-tokens-colors-foreground) px-2.5 py-1.5 text-center text-xs/5 font-normal text-(--clarify-theme-tokens-colors-background) shadow-lg transition duration-150", open ? "opacity-100" : "opacity-0", side === "top" ? "bottom-[calc(100%+0.5rem)]" : "top-[calc(100%+0.5rem)]"),
|
|
1082
|
+
children: content
|
|
1083
|
+
})]
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
//#endregion
|
|
894
1087
|
//#region source/components/WebFrame.tsx
|
|
895
1088
|
function WebFrame(arg0) {
|
|
896
1089
|
const { src, title = "Embedded content", children, showWindow = true, className, iframeClassName, height = 420, style, ...props } = arg0;
|
|
@@ -913,53 +1106,122 @@ function WebFrame(arg0) {
|
|
|
913
1106
|
children
|
|
914
1107
|
});
|
|
915
1108
|
if (!showWindow) return /* @__PURE__ */ jsx("div", {
|
|
916
|
-
className: clsx("clarify-web-frame not-prose my-10 overflow-hidden rounded-(--clarify-theme-tokens-radius-
|
|
1109
|
+
className: clsx("clarify-web-frame not-prose my-10 overflow-hidden rounded-(--clarify-theme-tokens-radius-lg) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) shadow-lg shadow-zinc-900/5 dark:shadow-none", className),
|
|
917
1110
|
children: frame
|
|
918
1111
|
});
|
|
919
1112
|
return /* @__PURE__ */ jsxs("div", {
|
|
920
|
-
className: clsx("clarify-web-frame not-prose my-10 overflow-hidden rounded-(--clarify-theme-tokens-radius-
|
|
1113
|
+
className: clsx("clarify-web-frame not-prose my-10 overflow-hidden rounded-(--clarify-theme-tokens-radius-lg) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) shadow-lg shadow-zinc-900/5 dark:shadow-none", className),
|
|
921
1114
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
922
|
-
className: "
|
|
1115
|
+
className: "grid h-10 grid-cols-[1fr_minmax(0,2fr)_1fr] items-center gap-3 border-b border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-code-background) px-3",
|
|
923
1116
|
children: [
|
|
924
|
-
/* @__PURE__ */
|
|
925
|
-
className: "
|
|
926
|
-
"aria-hidden": "true"
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
/* @__PURE__ */ jsx("span", {
|
|
933
|
-
className: "size-3 rounded-full bg-green-400",
|
|
934
|
-
"aria-hidden": "true"
|
|
1117
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1118
|
+
className: "flex items-center gap-1.5",
|
|
1119
|
+
"aria-hidden": "true",
|
|
1120
|
+
children: [
|
|
1121
|
+
/* @__PURE__ */ jsx("span", { className: "size-2.5 rounded-full bg-red-400/80" }),
|
|
1122
|
+
/* @__PURE__ */ jsx("span", { className: "size-2.5 rounded-full bg-amber-400/80" }),
|
|
1123
|
+
/* @__PURE__ */ jsx("span", { className: "size-2.5 rounded-full bg-emerald-400/80" })
|
|
1124
|
+
]
|
|
935
1125
|
}),
|
|
936
|
-
/* @__PURE__ */ jsx("
|
|
937
|
-
className: "
|
|
1126
|
+
/* @__PURE__ */ jsx("div", {
|
|
1127
|
+
className: "truncate rounded-(--clarify-theme-tokens-radius-md) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) px-3 py-1 text-center text-xs text-(--clarify-ui-text-faint)",
|
|
938
1128
|
children: title
|
|
939
|
-
})
|
|
1129
|
+
}),
|
|
1130
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true" })
|
|
940
1131
|
]
|
|
941
1132
|
}), frame]
|
|
942
1133
|
});
|
|
943
1134
|
}
|
|
944
1135
|
//#endregion
|
|
1136
|
+
//#region source/components/Image.tsx
|
|
1137
|
+
function Image(arg0) {
|
|
1138
|
+
const { src, alt = "", caption, zoom = false, className, ...props } = arg0;
|
|
1139
|
+
const [open, setOpen] = useState(false);
|
|
1140
|
+
const image = /* @__PURE__ */ jsx("img", {
|
|
1141
|
+
...props,
|
|
1142
|
+
src,
|
|
1143
|
+
alt,
|
|
1144
|
+
className: clsx("block h-auto max-w-full object-contain", className)
|
|
1145
|
+
});
|
|
1146
|
+
return /* @__PURE__ */ jsxs("figure", {
|
|
1147
|
+
className: "clarify-figure not-prose mx-auto my-8 w-fit max-w-full",
|
|
1148
|
+
children: [
|
|
1149
|
+
/* @__PURE__ */ jsx("div", {
|
|
1150
|
+
className: "group relative w-fit max-w-full overflow-hidden rounded-(--clarify-theme-tokens-radius-lg) border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-ui-subtle-background)",
|
|
1151
|
+
children: zoom ? /* @__PURE__ */ jsxs("button", {
|
|
1152
|
+
type: "button",
|
|
1153
|
+
className: "block max-w-full cursor-zoom-in focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-(--clarify-theme-tokens-colors-primary)",
|
|
1154
|
+
"aria-label": `Enlarge image: ${alt}`,
|
|
1155
|
+
onClick: () => setOpen(true),
|
|
1156
|
+
children: [image, /* @__PURE__ */ jsx("span", {
|
|
1157
|
+
className: "absolute right-3 bottom-3 grid size-8 place-items-center rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-background)/90 text-(--clarify-ui-text-soft) opacity-0 shadow-sm transition group-hover:opacity-100 group-focus-within:opacity-100",
|
|
1158
|
+
children: /* @__PURE__ */ jsx(Maximize2, {
|
|
1159
|
+
className: "size-4",
|
|
1160
|
+
"aria-hidden": "true"
|
|
1161
|
+
})
|
|
1162
|
+
})]
|
|
1163
|
+
}) : image
|
|
1164
|
+
}),
|
|
1165
|
+
caption ? /* @__PURE__ */ jsx("figcaption", {
|
|
1166
|
+
className: "mt-2 text-center text-xs/5 text-(--clarify-ui-text-faint)",
|
|
1167
|
+
children: caption
|
|
1168
|
+
}) : null,
|
|
1169
|
+
zoom ? /* @__PURE__ */ jsxs(Dialog, {
|
|
1170
|
+
open,
|
|
1171
|
+
onClose: setOpen,
|
|
1172
|
+
className: "relative z-50",
|
|
1173
|
+
children: [/* @__PURE__ */ jsx(DialogBackdrop, { className: "fixed inset-0 bg-black/75 backdrop-blur-sm" }), /* @__PURE__ */ jsx("div", {
|
|
1174
|
+
className: "fixed inset-0 flex items-center justify-center p-4 sm:p-8",
|
|
1175
|
+
children: /* @__PURE__ */ jsxs(DialogPanel, {
|
|
1176
|
+
className: "relative max-h-full max-w-full overflow-auto rounded-(--clarify-theme-tokens-radius-lg) bg-(--clarify-theme-tokens-colors-background) p-2 shadow-2xl",
|
|
1177
|
+
children: [/* @__PURE__ */ jsx("img", {
|
|
1178
|
+
src,
|
|
1179
|
+
alt,
|
|
1180
|
+
className: "max-h-[calc(100dvh-5rem)] max-w-[calc(100vw-5rem)] object-contain"
|
|
1181
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
1182
|
+
type: "button",
|
|
1183
|
+
className: "absolute top-4 right-4 grid size-9 place-items-center rounded-md border border-white/20 bg-black/65 text-white transition hover:bg-black/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white",
|
|
1184
|
+
"aria-label": "Close image preview",
|
|
1185
|
+
onClick: () => setOpen(false),
|
|
1186
|
+
children: /* @__PURE__ */ jsx(X, {
|
|
1187
|
+
className: "size-4",
|
|
1188
|
+
"aria-hidden": "true"
|
|
1189
|
+
})
|
|
1190
|
+
})]
|
|
1191
|
+
})
|
|
1192
|
+
})]
|
|
1193
|
+
}) : null
|
|
1194
|
+
]
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
//#endregion
|
|
945
1198
|
//#region source/mdx/primitives.tsx
|
|
946
1199
|
var primitives_exports = /* @__PURE__ */ __exportAll({
|
|
1200
|
+
AccordionGroup: () => AccordionGroup,
|
|
947
1201
|
Button: () => Button,
|
|
948
1202
|
Callout: () => Callout,
|
|
949
1203
|
Card: () => Card,
|
|
950
1204
|
CardGroup: () => CardGroup,
|
|
951
1205
|
CodeGroup: () => CodeGroup,
|
|
952
1206
|
Col: () => Col,
|
|
1207
|
+
FileTree: () => FileTree,
|
|
1208
|
+
FileTreeItem: () => FileTreeItem,
|
|
953
1209
|
Note: () => Note,
|
|
954
1210
|
Properties: () => Properties,
|
|
955
1211
|
Property: () => Property,
|
|
956
1212
|
Row: () => Row,
|
|
1213
|
+
Step: () => Step,
|
|
1214
|
+
Steps: () => Steps,
|
|
1215
|
+
Tab: () => TabItem,
|
|
1216
|
+
Tabs: () => Tabs,
|
|
1217
|
+
Tooltip: () => Tooltip,
|
|
957
1218
|
WebFrame: () => WebFrame,
|
|
958
1219
|
a: () => a,
|
|
959
1220
|
code: () => code,
|
|
960
1221
|
h1: () => h1,
|
|
961
1222
|
h2: () => h2,
|
|
962
1223
|
h3: () => h3,
|
|
1224
|
+
img: () => img,
|
|
963
1225
|
pre: () => pre,
|
|
964
1226
|
table: () => table,
|
|
965
1227
|
wrapper: () => wrapper
|
|
@@ -1004,6 +1266,7 @@ function h1(arg0) {
|
|
|
1004
1266
|
}
|
|
1005
1267
|
var code = Code;
|
|
1006
1268
|
var pre = Pre;
|
|
1269
|
+
var img = Image;
|
|
1007
1270
|
function h2(props) {
|
|
1008
1271
|
return createElement(Heading, {
|
|
1009
1272
|
level: 2,
|
|
@@ -1019,8 +1282,8 @@ function h3(props) {
|
|
|
1019
1282
|
function Note(arg0) {
|
|
1020
1283
|
const { children } = arg0;
|
|
1021
1284
|
return /* @__PURE__ */ jsxs("div", {
|
|
1022
|
-
className: "clarify-note my-6 flex gap-
|
|
1023
|
-
children: [/* @__PURE__ */ jsx(Info, { className: "mt-1
|
|
1285
|
+
className: "clarify-note my-6 flex gap-3 rounded-r-(--clarify-theme-tokens-radius-lg) border-l-2 border-(--clarify-theme-tokens-colors-primary) bg-(--clarify-ui-subtle-background) px-4 py-3 text-sm/6 text-(--clarify-ui-text-soft) [--tw-prose-links-hover:var(--clarify-ui-accent-text)] [--tw-prose-links:var(--clarify-theme-tokens-colors-foreground)]",
|
|
1286
|
+
children: [/* @__PURE__ */ jsx(Info, { className: "mt-1 size-4 flex-none stroke-(--clarify-ui-accent-text)" }), /* @__PURE__ */ jsx("div", {
|
|
1024
1287
|
className: "*:first:mt-0 *:last:mb-0",
|
|
1025
1288
|
children
|
|
1026
1289
|
})]
|
|
@@ -1132,6 +1395,7 @@ function Markdown(arg0) {
|
|
|
1132
1395
|
children: /* @__PURE__ */ jsx(ReactMarkdown, {
|
|
1133
1396
|
components: markdownComponents,
|
|
1134
1397
|
remarkPlugins: markdownRemarkPlugins,
|
|
1398
|
+
rehypePlugins: [rehypeRaw],
|
|
1135
1399
|
children
|
|
1136
1400
|
})
|
|
1137
1401
|
});
|
|
@@ -1393,8 +1657,72 @@ function listOpenApiOperations(spec) {
|
|
|
1393
1657
|
return [...listOperationsFromPathItems(paths, "path", spec), ...isRecord(webhooks) ? listOperationsFromPathItems(webhooks, "webhook", spec) : []];
|
|
1394
1658
|
}
|
|
1395
1659
|
//#endregion
|
|
1660
|
+
//#region source/components/HighlightedCode.tsx
|
|
1661
|
+
var cssVariablesTheme = createCssVariablesTheme();
|
|
1662
|
+
function HighlightedCode(arg0) {
|
|
1663
|
+
const { code, language } = arg0;
|
|
1664
|
+
const [lines, setLines] = useState();
|
|
1665
|
+
useEffect(() => {
|
|
1666
|
+
let active = true;
|
|
1667
|
+
codeToTokens(code, {
|
|
1668
|
+
lang: language,
|
|
1669
|
+
theme: cssVariablesTheme
|
|
1670
|
+
}).then((result) => {
|
|
1671
|
+
if (active) setLines(result.tokens);
|
|
1672
|
+
}).catch(() => {
|
|
1673
|
+
if (active) setLines(void 0);
|
|
1674
|
+
});
|
|
1675
|
+
return () => {
|
|
1676
|
+
active = false;
|
|
1677
|
+
};
|
|
1678
|
+
}, [code, language]);
|
|
1679
|
+
if (!lines) return /* @__PURE__ */ jsx("code", {
|
|
1680
|
+
className: `language-${language}`,
|
|
1681
|
+
children: code
|
|
1682
|
+
});
|
|
1683
|
+
return /* @__PURE__ */ jsx("code", {
|
|
1684
|
+
className: `language-${language}`,
|
|
1685
|
+
children: lines.map((line, lineIndex) => /* @__PURE__ */ jsxs("span", {
|
|
1686
|
+
className: "line",
|
|
1687
|
+
children: [line.map((token, tokenIndex) => /* @__PURE__ */ jsx("span", {
|
|
1688
|
+
style: {
|
|
1689
|
+
color: token.color,
|
|
1690
|
+
...token.htmlStyle
|
|
1691
|
+
},
|
|
1692
|
+
children: token.content
|
|
1693
|
+
}, tokenIndex)), lineIndex < lines.length - 1 ? "\n" : null]
|
|
1694
|
+
}, lineIndex))
|
|
1695
|
+
});
|
|
1696
|
+
}
|
|
1697
|
+
//#endregion
|
|
1396
1698
|
//#region source/openapi/lib/request-code.ts
|
|
1699
|
+
var snippetControlCharacters = [
|
|
1700
|
+
{
|
|
1701
|
+
character: "\n",
|
|
1702
|
+
placeholder: "",
|
|
1703
|
+
escape: "\\n"
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
character: "\r",
|
|
1707
|
+
placeholder: "",
|
|
1708
|
+
escape: "\\r"
|
|
1709
|
+
},
|
|
1710
|
+
{
|
|
1711
|
+
character: " ",
|
|
1712
|
+
placeholder: "",
|
|
1713
|
+
escape: "\\t"
|
|
1714
|
+
}
|
|
1715
|
+
];
|
|
1397
1716
|
var snippetGenerator = snippetz();
|
|
1717
|
+
function protectSnippetControlCharacters(value) {
|
|
1718
|
+
if (typeof value === "string") return snippetControlCharacters.reduce((result, item) => result.replaceAll(item.character, item.placeholder), value);
|
|
1719
|
+
if (Array.isArray(value)) return value.map(protectSnippetControlCharacters);
|
|
1720
|
+
if (!isRecord$1(value)) return value;
|
|
1721
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, protectSnippetControlCharacters(item)]));
|
|
1722
|
+
}
|
|
1723
|
+
function restoreSnippetControlCharacters(code) {
|
|
1724
|
+
return snippetControlCharacters.reduce((result, item) => result.replaceAll(item.placeholder, item.escape), code);
|
|
1725
|
+
}
|
|
1398
1726
|
function getDefaultServer(spec) {
|
|
1399
1727
|
const servers = spec.servers;
|
|
1400
1728
|
if (!Array.isArray(servers)) return { url: "https://api.example.com" };
|
|
@@ -1462,7 +1790,7 @@ function getRequestBody(requestContent) {
|
|
|
1462
1790
|
const params = getFormParams(value, requestContent);
|
|
1463
1791
|
return params.length > 0 ? { params } : void 0;
|
|
1464
1792
|
}
|
|
1465
|
-
return { serialized: stringifyExample(value) };
|
|
1793
|
+
return { serialized: stringifyExample(protectSnippetControlCharacters(value)) };
|
|
1466
1794
|
}
|
|
1467
1795
|
function getAuthorizationValue(auth) {
|
|
1468
1796
|
if (auth.scheme.type === "http" && auth.scheme.scheme?.toLowerCase() === "bearer") return `Bearer ${auth.value}`;
|
|
@@ -1515,7 +1843,7 @@ function buildSnippetErrorMessage(error) {
|
|
|
1515
1843
|
}
|
|
1516
1844
|
function buildSnippet(input, target) {
|
|
1517
1845
|
try {
|
|
1518
|
-
return decodeUrlPlaceholders(snippetGenerator.print(target.target, target.client, buildHarRequest(input)) || "");
|
|
1846
|
+
return restoreSnippetControlCharacters(decodeUrlPlaceholders(snippetGenerator.print(target.target, target.client, buildHarRequest(input)) || ""));
|
|
1519
1847
|
} catch (error) {
|
|
1520
1848
|
return buildSnippetErrorMessage(error);
|
|
1521
1849
|
}
|
|
@@ -1814,7 +2142,7 @@ function SelectControl(arg0) {
|
|
|
1814
2142
|
label: option
|
|
1815
2143
|
} : option);
|
|
1816
2144
|
const selectedOption = normalizedOptions.find((option) => option.value === value) ?? normalizedOptions[0];
|
|
1817
|
-
const wrapperClassName = compact ? "clarify-
|
|
2145
|
+
const wrapperClassName = compact ? "clarify-openai-select relative min-w-0 text-xs" : "clarify-openai-select relative shrink-0 text-xs";
|
|
1818
2146
|
const buttonSizeClassName = compact ? "w-full min-w-0 max-w-32" : "min-w-28 max-w-48";
|
|
1819
2147
|
if (normalizedOptions.length <= 1) return null;
|
|
1820
2148
|
return /* @__PURE__ */ jsx(Listbox, {
|
|
@@ -1824,7 +2152,7 @@ function SelectControl(arg0) {
|
|
|
1824
2152
|
className: wrapperClassName,
|
|
1825
2153
|
children: [/* @__PURE__ */ jsxs(ListboxButton, {
|
|
1826
2154
|
"aria-label": label,
|
|
1827
|
-
className: `clarify-
|
|
2155
|
+
className: `clarify-openai-select-button flex min-h-8 ${buttonSizeClassName} items-center justify-between gap-2 rounded-lg border border-(--clarify-code-border) bg-(--clarify-code-control-background) px-2.5 py-1 text-xs font-medium whitespace-nowrap text-(--clarify-code-text) outline-hidden transition hover:border-white/20 hover:bg-(--clarify-code-control-background-hover) focus:ring-2 focus:ring-(--clarify-ui-accent-border) data-open:border-white/20 data-open:bg-(--clarify-code-control-background-active) data-open:ring-2 data-open:ring-(--clarify-ui-accent-border)`,
|
|
1828
2156
|
children: [/* @__PURE__ */ jsxs("span", {
|
|
1829
2157
|
className: "flex min-w-0 items-center gap-1.5 overflow-hidden",
|
|
1830
2158
|
children: [icon ? /* @__PURE__ */ jsx("span", {
|
|
@@ -1840,10 +2168,10 @@ function SelectControl(arg0) {
|
|
|
1840
2168
|
})]
|
|
1841
2169
|
}), /* @__PURE__ */ jsx(ListboxOptions, {
|
|
1842
2170
|
anchor: "bottom end",
|
|
1843
|
-
className: "clarify-
|
|
2171
|
+
className: "clarify-openai-select-options z-30 mt-1 max-h-64 w-max min-w-(--button-width) max-w-(--clarify-popover-max-width) overflow-auto rounded-xl bg-(--clarify-code-surface) p-1 text-xs shadow-lg shadow-black/20 ring-1 ring-(--clarify-code-border) [--anchor-gap:--spacing(1)] focus:outline-none",
|
|
1844
2172
|
children: normalizedOptions.map((option) => /* @__PURE__ */ jsxs(ListboxOption, {
|
|
1845
2173
|
value: option.value,
|
|
1846
|
-
className: "clarify-
|
|
2174
|
+
className: "clarify-openai-select-option group flex min-h-9 cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-xs whitespace-nowrap text-(--clarify-code-control-text) select-none data-focus:bg-(--clarify-code-control-background-hover) data-focus:text-(--clarify-code-text) data-selected:bg-(--clarify-code-accent-background) data-selected:text-(--clarify-code-accent-text)",
|
|
1847
2175
|
children: [/* @__PURE__ */ jsx("span", { children: option.label }), /* @__PURE__ */ jsx(CheckIcon, {
|
|
1848
2176
|
className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
|
|
1849
2177
|
"aria-hidden": "true"
|
|
@@ -1868,7 +2196,7 @@ function CopyCodeButton(arg0) {
|
|
|
1868
2196
|
setTimeout(() => setCopied(false), 1e3);
|
|
1869
2197
|
});
|
|
1870
2198
|
},
|
|
1871
|
-
className: "flex items-center gap-1.5 rounded-full bg-(--clarify-code-control-background) px-2.5 py-1.5 text-2xs font-medium text-(--clarify-code-muted) transition hover:bg-(--clarify-code-control-background-hover) hover:text-(--clarify-code-text) focus:bg-(--clarify-code-control-background-hover) focus:text-(--clarify-code-text)",
|
|
2199
|
+
className: "ml-auto flex shrink-0 items-center gap-1.5 rounded-full bg-(--clarify-code-control-background) px-2.5 py-1.5 text-2xs font-medium whitespace-nowrap text-(--clarify-code-muted) transition hover:bg-(--clarify-code-control-background-hover) hover:text-(--clarify-code-text) focus:bg-(--clarify-code-control-background-hover) focus:text-(--clarify-code-text)",
|
|
1872
2200
|
children: [copied ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
1873
2201
|
className: "h-3.5 w-3.5 text-(--clarify-theme-tokens-colors-primary)",
|
|
1874
2202
|
"aria-hidden": "true"
|
|
@@ -1892,31 +2220,36 @@ function ExampleMetaValue(arg0) {
|
|
|
1892
2220
|
});
|
|
1893
2221
|
}
|
|
1894
2222
|
function CodeToolbar(arg0) {
|
|
1895
|
-
const { code, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
|
|
2223
|
+
const { code, leadingControls, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
|
|
1896
2224
|
const t = useBuiltInText();
|
|
2225
|
+
const inlineControls = Boolean(leadingControls);
|
|
1897
2226
|
return /* @__PURE__ */ jsxs("div", {
|
|
1898
|
-
className:
|
|
2227
|
+
className: `clarify-openai-code-toolbar flex items-center gap-2 px-4 pt-3${inlineControls ? " clarify-openai-code-toolbar-inline" : ""}`,
|
|
1899
2228
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
1900
|
-
className:
|
|
1901
|
-
children: [
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
|
|
2229
|
+
className: `clarify-openai-code-toolbar-controls flex min-w-0 flex-1 items-center gap-2${inlineControls ? " flex-nowrap overflow-x-auto" : " flex-wrap"}`,
|
|
2230
|
+
children: [
|
|
2231
|
+
leadingControls,
|
|
2232
|
+
languageOptions && languageOptions.length > 1 && selectedLanguageKey && onSelectLanguage ? /* @__PURE__ */ jsx(SelectControl, {
|
|
2233
|
+
label: t("openapi.language"),
|
|
2234
|
+
value: selectedLanguageKey,
|
|
2235
|
+
options: languageOptions,
|
|
2236
|
+
onChange: onSelectLanguage,
|
|
2237
|
+
icon: /* @__PURE__ */ jsx(CodeIcon, {
|
|
2238
|
+
className: "h-3.5 w-3.5",
|
|
2239
|
+
"aria-hidden": "true"
|
|
2240
|
+
})
|
|
2241
|
+
}) : null,
|
|
2242
|
+
clientOptions && clientOptions.length > 1 && selectedClientKey && onSelectClient ? /* @__PURE__ */ jsx(SelectControl, {
|
|
2243
|
+
label: t("openapi.client"),
|
|
2244
|
+
value: selectedClientKey,
|
|
2245
|
+
options: clientOptions,
|
|
2246
|
+
onChange: onSelectClient,
|
|
2247
|
+
icon: /* @__PURE__ */ jsx(PackageIcon, {
|
|
2248
|
+
className: "h-3.5 w-3.5",
|
|
2249
|
+
"aria-hidden": "true"
|
|
2250
|
+
})
|
|
2251
|
+
}) : null
|
|
2252
|
+
]
|
|
1920
2253
|
}), /* @__PURE__ */ jsx(CopyCodeButton, { code })]
|
|
1921
2254
|
});
|
|
1922
2255
|
}
|
|
@@ -1988,21 +2321,38 @@ function getClientOptions(codeOptions, languageKey) {
|
|
|
1988
2321
|
//#endregion
|
|
1989
2322
|
//#region source/openapi/components/ExamplePanels.tsx
|
|
1990
2323
|
function ApiExampleCodeGroup(arg0) {
|
|
1991
|
-
const { title, tag, tagOptions, onSelectTag, label, labelOptions, onSelectLabel, comfortableMeta = false, code, language, mediaTypes, selectedMediaType, onSelectMediaType, examples, selectedExampleKey, onSelectExample, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
|
|
2324
|
+
const { title, tag, tagOptions, onSelectTag, label, labelOptions, onSelectLabel, comfortableMeta = false, metaInToolbar = false, code, language, mediaTypes, selectedMediaType, onSelectMediaType, examples, selectedExampleKey, onSelectExample, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
|
|
1992
2325
|
const t = useBuiltInText();
|
|
1993
2326
|
const metaClassName = comfortableMeta ? "flex min-h-11 min-w-0 items-center gap-2 border-y border-(--clarify-code-border) border-t-transparent bg-(--clarify-code-background) px-4 py-2" : "flex h-9 min-w-0 items-center gap-2 border-y border-(--clarify-code-border) border-t-transparent bg-(--clarify-code-background) px-4";
|
|
2327
|
+
const meta = /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2328
|
+
tag ? /* @__PURE__ */ jsx(ExampleMetaValue, {
|
|
2329
|
+
label: t("openapi.status"),
|
|
2330
|
+
value: tag,
|
|
2331
|
+
options: tagOptions,
|
|
2332
|
+
onChange: onSelectTag,
|
|
2333
|
+
className: "clarify-openai-example-status font-semibold text-emerald-400"
|
|
2334
|
+
}) : null,
|
|
2335
|
+
tag && label ? /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 shrink-0 rounded-full bg-(--clarify-code-faint)" }) : null,
|
|
2336
|
+
label ? /* @__PURE__ */ jsx(ExampleMetaValue, {
|
|
2337
|
+
label: t("openapi.mediaType"),
|
|
2338
|
+
value: label,
|
|
2339
|
+
options: labelOptions,
|
|
2340
|
+
onChange: onSelectLabel,
|
|
2341
|
+
className: "min-w-0 truncate text-xs text-(--clarify-code-muted)"
|
|
2342
|
+
}) : null
|
|
2343
|
+
] });
|
|
1994
2344
|
return /* @__PURE__ */ jsx("div", {
|
|
1995
|
-
className: "clarify-
|
|
2345
|
+
className: "clarify-openai-example my-6 overflow-hidden rounded-2xl bg-(--clarify-code-background) shadow-md ring-1 ring-(--clarify-code-border)",
|
|
1996
2346
|
children: /* @__PURE__ */ jsxs("div", {
|
|
1997
2347
|
className: "not-prose",
|
|
1998
2348
|
children: [
|
|
1999
2349
|
/* @__PURE__ */ jsxs("div", {
|
|
2000
|
-
className: "clarify-
|
|
2350
|
+
className: "clarify-openai-example-header flex min-h-(--clarify-code-header-min-height) items-center gap-3 border-b border-(--clarify-code-border) bg-(--clarify-code-header-background) px-4 py-2",
|
|
2001
2351
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
2002
2352
|
className: "mr-auto min-w-16 truncate py-1 text-xs font-semibold text-(--clarify-code-text)",
|
|
2003
2353
|
children: title
|
|
2004
2354
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2005
|
-
className: "ml-auto flex min-w-0 items-center gap-2 whitespace-nowrap",
|
|
2355
|
+
className: "clarify-openai-example-header-controls ml-auto flex min-w-0 items-center gap-2 whitespace-nowrap",
|
|
2006
2356
|
children: [mediaTypes && mediaTypes.length > 1 && selectedMediaType && onSelectMediaType ? /* @__PURE__ */ jsx(SelectControl, {
|
|
2007
2357
|
label: t("openapi.mediaType"),
|
|
2008
2358
|
value: selectedMediaType,
|
|
@@ -2021,30 +2371,15 @@ function ApiExampleCodeGroup(arg0) {
|
|
|
2021
2371
|
}) : null]
|
|
2022
2372
|
})]
|
|
2023
2373
|
}),
|
|
2024
|
-
tag || label ? /* @__PURE__ */
|
|
2374
|
+
(tag || label) && !metaInToolbar ? /* @__PURE__ */ jsx("div", {
|
|
2025
2375
|
className: metaClassName,
|
|
2026
|
-
children:
|
|
2027
|
-
tag ? /* @__PURE__ */ jsx(ExampleMetaValue, {
|
|
2028
|
-
label: t("openapi.status"),
|
|
2029
|
-
value: tag,
|
|
2030
|
-
options: tagOptions,
|
|
2031
|
-
onChange: onSelectTag,
|
|
2032
|
-
className: "clarify-api-example-status font-semibold text-emerald-400"
|
|
2033
|
-
}) : null,
|
|
2034
|
-
tag && label ? /* @__PURE__ */ jsx("span", { className: "h-0.5 w-0.5 shrink-0 rounded-full bg-(--clarify-code-faint)" }) : null,
|
|
2035
|
-
label ? /* @__PURE__ */ jsx(ExampleMetaValue, {
|
|
2036
|
-
label: t("openapi.mediaType"),
|
|
2037
|
-
value: label,
|
|
2038
|
-
options: labelOptions,
|
|
2039
|
-
onChange: onSelectLabel,
|
|
2040
|
-
className: "min-w-0 truncate text-xs text-(--clarify-code-muted)"
|
|
2041
|
-
}) : null
|
|
2042
|
-
]
|
|
2376
|
+
children: meta
|
|
2043
2377
|
}) : null,
|
|
2044
2378
|
/* @__PURE__ */ jsxs("div", {
|
|
2045
|
-
className: "clarify-
|
|
2379
|
+
className: "clarify-openai-example-code group bg-(--clarify-code-background)",
|
|
2046
2380
|
children: [/* @__PURE__ */ jsx(CodeToolbar, {
|
|
2047
2381
|
code,
|
|
2382
|
+
leadingControls: metaInToolbar ? meta : void 0,
|
|
2048
2383
|
languageOptions,
|
|
2049
2384
|
selectedLanguageKey,
|
|
2050
2385
|
onSelectLanguage,
|
|
@@ -2052,10 +2387,10 @@ function ApiExampleCodeGroup(arg0) {
|
|
|
2052
2387
|
selectedClientKey,
|
|
2053
2388
|
onSelectClient
|
|
2054
2389
|
}), /* @__PURE__ */ jsx("pre", {
|
|
2055
|
-
className:
|
|
2056
|
-
children: /* @__PURE__ */ jsx(
|
|
2057
|
-
|
|
2058
|
-
|
|
2390
|
+
className: "max-h-128 overflow-auto overscroll-contain px-4 pt-3 pb-4 text-xs text-(--clarify-code-text)",
|
|
2391
|
+
children: /* @__PURE__ */ jsx(HighlightedCode, {
|
|
2392
|
+
code,
|
|
2393
|
+
language
|
|
2059
2394
|
})
|
|
2060
2395
|
})]
|
|
2061
2396
|
})
|
|
@@ -2159,6 +2494,9 @@ function RequestExamplesPanel(arg0) {
|
|
|
2159
2494
|
function firstExampleKeyForResponseContent(content, spec) {
|
|
2160
2495
|
return getExampleEntries(content?.value, spec)[0]?.key ?? "";
|
|
2161
2496
|
}
|
|
2497
|
+
function getResponseExampleBody(content, example) {
|
|
2498
|
+
return content ? stringifyExample(example?.value) : "";
|
|
2499
|
+
}
|
|
2162
2500
|
function useResponseExamplesState(arg0) {
|
|
2163
2501
|
const { operation, spec, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
|
|
2164
2502
|
const orderedResponses = [...getResponseEntries(operation, spec)].sort((left, right) => {
|
|
@@ -2169,8 +2507,7 @@ function useResponseExamplesState(arg0) {
|
|
|
2169
2507
|
if (!Number.isNaN(leftCode) && !Number.isNaN(rightCode)) return leftCode - rightCode;
|
|
2170
2508
|
return left.status.localeCompare(right.status);
|
|
2171
2509
|
});
|
|
2172
|
-
const
|
|
2173
|
-
const [internalSelectedStatus, setInternalSelectedStatus] = useState(defaultStatus);
|
|
2510
|
+
const [internalSelectedStatus, setInternalSelectedStatus] = useState(orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "");
|
|
2174
2511
|
const activeStatus = selectedStatus ?? internalSelectedStatus;
|
|
2175
2512
|
const selectedResponse = orderedResponses.find(({ status }) => status === activeStatus) ?? orderedResponses[0];
|
|
2176
2513
|
const responseContents = getMediaTypeEntries(selectedResponse?.response.content, spec);
|
|
@@ -2196,7 +2533,7 @@ function useResponseExamplesState(arg0) {
|
|
|
2196
2533
|
selectedContent,
|
|
2197
2534
|
examples,
|
|
2198
2535
|
selectedExample,
|
|
2199
|
-
|
|
2536
|
+
responseBody: getResponseExampleBody(selectedContent, selectedExample),
|
|
2200
2537
|
onSelectStatus: (value) => {
|
|
2201
2538
|
const nextContents = getMediaTypeEntries(orderedResponses.find(({ status }) => status === value)?.response.content, spec);
|
|
2202
2539
|
if (typeof selectedStatus === "undefined") setInternalSelectedStatus(value);
|
|
@@ -2235,21 +2572,21 @@ function ResponseExamplesPanel(arg0) {
|
|
|
2235
2572
|
selectedStatus,
|
|
2236
2573
|
onSelectStatus
|
|
2237
2574
|
});
|
|
2238
|
-
if (!state.
|
|
2575
|
+
if (!state.selectedContent || !state.responseBody) return null;
|
|
2239
2576
|
return /* @__PURE__ */ jsx(ApiExampleCodeGroup, {
|
|
2240
2577
|
title: title ?? t("openapi.response"),
|
|
2241
|
-
tag: state.selectedResponse
|
|
2242
|
-
tagOptions: state.responses.map((
|
|
2243
|
-
onSelectTag: state.onSelectStatus,
|
|
2578
|
+
tag: state.selectedResponse?.status,
|
|
2579
|
+
tagOptions: state.responses.map((response) => response.status),
|
|
2580
|
+
onSelectTag: state.responses.length > 0 ? state.onSelectStatus : void 0,
|
|
2244
2581
|
label: state.selectedContent?.mediaType,
|
|
2245
2582
|
labelOptions: state.responseContents.map((content) => content.mediaType),
|
|
2246
2583
|
onSelectLabel: state.responseContents.length > 0 ? state.onSelectMediaType : void 0,
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
language: state.selectedContent ? codeLanguageForMediaType(state.selectedContent.mediaType) : "http",
|
|
2584
|
+
code: state.responseBody,
|
|
2585
|
+
language: codeLanguageForMediaType(state.selectedContent.mediaType),
|
|
2250
2586
|
examples: state.examples,
|
|
2251
2587
|
selectedExampleKey: state.selectedExample?.key,
|
|
2252
|
-
onSelectExample: state.onSelectExample
|
|
2588
|
+
onSelectExample: state.onSelectExample,
|
|
2589
|
+
metaInToolbar: true
|
|
2253
2590
|
});
|
|
2254
2591
|
}
|
|
2255
2592
|
//#endregion
|
|
@@ -2505,7 +2842,7 @@ function SchemaNode(arg0) {
|
|
|
2505
2842
|
className: "*:first:mt-0 *:last:mb-0",
|
|
2506
2843
|
children: node.description
|
|
2507
2844
|
}) : fallbackDescription, node.details ? /* @__PURE__ */ jsx("p", {
|
|
2508
|
-
className: "text-xs text-(--clarify-ui-text-
|
|
2845
|
+
className: "text-xs text-(--clarify-ui-text-soft)",
|
|
2509
2846
|
children: node.details
|
|
2510
2847
|
}) : null]
|
|
2511
2848
|
})]
|
|
@@ -2521,7 +2858,7 @@ function SchemaNode(arg0) {
|
|
|
2521
2858
|
"aria-label": expanded ? t("openapi.collapse") : t("openapi.expand"),
|
|
2522
2859
|
"aria-expanded": expanded,
|
|
2523
2860
|
onClick: () => setExpanded((value) => !value),
|
|
2524
|
-
className: clsx(rowClassName, "cursor-pointer transition"),
|
|
2861
|
+
className: clsx(rowClassName, "cursor-pointer transition hover:bg-(--clarify-ui-hover-background) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)"),
|
|
2525
2862
|
children: content
|
|
2526
2863
|
}) : /* @__PURE__ */ jsx("div", {
|
|
2527
2864
|
className: rowClassName,
|
|
@@ -2589,10 +2926,10 @@ function ResponseList(arg0) {
|
|
|
2589
2926
|
children: [
|
|
2590
2927
|
/* @__PURE__ */ jsxs("div", {
|
|
2591
2928
|
className: "flex flex-wrap items-center gap-2",
|
|
2592
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
2929
|
+
children: [orderedResponses.length === 1 ? /* @__PURE__ */ jsx("span", {
|
|
2593
2930
|
className: "text-sm/5 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
|
|
2594
2931
|
children: status
|
|
2595
|
-
}), type ? /* @__PURE__ */ jsx("span", {
|
|
2932
|
+
}) : null, type ? /* @__PURE__ */ jsx("span", {
|
|
2596
2933
|
className: "text-xs text-(--clarify-theme-tokens-colors-muted)",
|
|
2597
2934
|
children: type
|
|
2598
2935
|
}) : null]
|
|
@@ -2738,6 +3075,50 @@ function EndpointResponse(arg0) {
|
|
|
2738
3075
|
});
|
|
2739
3076
|
}
|
|
2740
3077
|
//#endregion
|
|
3078
|
+
//#region source/openapi/components/InlineListbox.tsx
|
|
3079
|
+
function InlineListbox(arg0) {
|
|
3080
|
+
const { label, value, options, onChange, compact = false, buttonContent, buttonClassName, className } = arg0;
|
|
3081
|
+
const selected = options.find((option) => option.value === value) ?? options[0];
|
|
3082
|
+
return /* @__PURE__ */ jsx(Listbox, {
|
|
3083
|
+
value: selected?.value ?? value,
|
|
3084
|
+
onChange,
|
|
3085
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
3086
|
+
className: clsx("pointer-events-auto relative inline-flex min-w-0", className),
|
|
3087
|
+
children: [/* @__PURE__ */ jsx(ListboxButton, {
|
|
3088
|
+
"aria-label": label,
|
|
3089
|
+
className: clsx(buttonClassName ?? "inline-flex min-w-0 items-center gap-1 rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) font-semibold text-(--clarify-ui-text-strong) shadow-xs outline-hidden transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) data-open:border-(--clarify-ui-accent-border) data-open:bg-(--clarify-ui-active-background) data-open:ring-2 data-open:ring-(--clarify-ui-accent-border)", buttonClassName ? null : compact ? "min-h-7 max-w-32 px-2 py-0.5 text-xs" : "min-h-8 w-full px-2.5 py-1.5 text-xs"),
|
|
3090
|
+
children: buttonContent ?? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
3091
|
+
className: "truncate",
|
|
3092
|
+
children: selected?.label ?? value
|
|
3093
|
+
}), /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
3094
|
+
className: "h-3.5 w-3.5 shrink-0 text-(--clarify-ui-text-faint)",
|
|
3095
|
+
"aria-hidden": "true"
|
|
3096
|
+
})] })
|
|
3097
|
+
}), /* @__PURE__ */ jsx(ListboxOptions, {
|
|
3098
|
+
anchor: "bottom start",
|
|
3099
|
+
className: "z-30 mt-1 max-h-64 w-max min-w-(--button-width) max-w-(--clarify-popover-max-width) overflow-auto rounded-xl bg-(--clarify-theme-tokens-colors-surface) p-1 text-xs shadow-lg shadow-black/10 ring-1 ring-(--clarify-theme-tokens-colors-border) [--anchor-gap:--spacing(1)] focus:outline-none",
|
|
3100
|
+
children: options.map((option) => /* @__PURE__ */ jsxs(ListboxOption, {
|
|
3101
|
+
value: option.value,
|
|
3102
|
+
className: "group flex min-h-9 cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-xs text-(--clarify-ui-text) select-none data-focus:bg-(--clarify-ui-hover-background) data-focus:text-(--clarify-ui-text-strong) data-selected:bg-(--clarify-ui-active-background) data-selected:text-(--clarify-ui-accent-text)",
|
|
3103
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
3104
|
+
className: "min-w-0",
|
|
3105
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
3106
|
+
className: "block truncate",
|
|
3107
|
+
children: option.label
|
|
3108
|
+
}), option.description ? /* @__PURE__ */ jsx("span", {
|
|
3109
|
+
className: "mt-0.5 block truncate text-2xs text-(--clarify-ui-text-faint)",
|
|
3110
|
+
children: option.description
|
|
3111
|
+
}) : null]
|
|
3112
|
+
}), /* @__PURE__ */ jsx(CheckIcon, {
|
|
3113
|
+
className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
|
|
3114
|
+
"aria-hidden": "true"
|
|
3115
|
+
})]
|
|
3116
|
+
}, option.value))
|
|
3117
|
+
})]
|
|
3118
|
+
})
|
|
3119
|
+
});
|
|
3120
|
+
}
|
|
3121
|
+
//#endregion
|
|
2741
3122
|
//#region source/openapi/components/OpenApiOperation.state.ts
|
|
2742
3123
|
function useOperationRequestState(spec, path, operation, source = "path") {
|
|
2743
3124
|
const parameters = getOperationParameters(spec, path, operation, source);
|
|
@@ -2845,7 +3226,7 @@ function EndpointPath(arg0) {
|
|
|
2845
3226
|
"aria-label": copied ? t("actions.copied") : t("actions.copy"),
|
|
2846
3227
|
title: copied ? t("actions.copied") : t("actions.copy"),
|
|
2847
3228
|
onClick: onCopy,
|
|
2848
|
-
className: clsx("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) text-(--clarify-ui-text-soft) transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground)", copied && "border-emerald-400/70 bg-emerald-50 text-emerald-700 dark:bg-emerald-400/10 dark:text-emerald-200"),
|
|
3229
|
+
className: clsx("flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) text-(--clarify-ui-text-soft) transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)", copied && "border-emerald-400/70 bg-emerald-50 text-emerald-700 dark:bg-emerald-400/10 dark:text-emerald-200"),
|
|
2849
3230
|
children: copied ? /* @__PURE__ */ jsx(CheckIcon, {
|
|
2850
3231
|
className: "h-3.5 w-3.5",
|
|
2851
3232
|
"aria-hidden": "true"
|
|
@@ -2856,48 +3237,6 @@ function EndpointPath(arg0) {
|
|
|
2856
3237
|
}) : null]
|
|
2857
3238
|
});
|
|
2858
3239
|
}
|
|
2859
|
-
function InlineListbox(arg0) {
|
|
2860
|
-
const { label, value, options, onChange, compact = false } = arg0;
|
|
2861
|
-
const selected = options.find((option) => option.value === value) ?? options[0];
|
|
2862
|
-
return /* @__PURE__ */ jsx(Listbox, {
|
|
2863
|
-
value: selected?.value ?? value,
|
|
2864
|
-
onChange,
|
|
2865
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
2866
|
-
className: "pointer-events-auto relative inline-flex min-w-0",
|
|
2867
|
-
children: [/* @__PURE__ */ jsxs(ListboxButton, {
|
|
2868
|
-
"aria-label": label,
|
|
2869
|
-
className: clsx("inline-flex min-w-0 items-center gap-1 rounded-md border border-(--clarify-theme-tokens-colors-border) bg-(--clarify-theme-tokens-colors-surface) font-semibold text-(--clarify-theme-tokens-colors-foreground) shadow-xs outline-hidden transition hover:border-(--clarify-ui-text-faint) hover:bg-(--clarify-ui-hover-background) data-open:border-(--clarify-ui-text-faint) data-open:bg-(--clarify-ui-hover-background)", compact ? "max-w-32 px-1.5 py-0.5 text-xs" : "w-full px-2.5 py-1.5 text-xs"),
|
|
2870
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
2871
|
-
className: "truncate",
|
|
2872
|
-
children: selected?.label ?? value
|
|
2873
|
-
}), /* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
2874
|
-
className: "h-3.5 w-3.5 shrink-0 text-(--clarify-ui-text-faint)",
|
|
2875
|
-
"aria-hidden": "true"
|
|
2876
|
-
})]
|
|
2877
|
-
}), /* @__PURE__ */ jsx(ListboxOptions, {
|
|
2878
|
-
anchor: "bottom start",
|
|
2879
|
-
className: "z-30 mt-1 max-h-64 w-max min-w-(--button-width) max-w-(--clarify-popover-max-width) overflow-auto rounded-xl bg-(--clarify-theme-tokens-colors-surface) p-1 text-xs shadow-lg shadow-black/10 ring-1 ring-(--clarify-theme-tokens-colors-border) [--anchor-gap:--spacing(1)] focus:outline-none",
|
|
2880
|
-
children: options.map((option) => /* @__PURE__ */ jsxs(ListboxOption, {
|
|
2881
|
-
value: option.value,
|
|
2882
|
-
className: "group flex cursor-default items-center justify-between gap-3 rounded-lg px-2.5 py-2 text-xs text-(--clarify-ui-text) select-none data-focus:bg-(--clarify-ui-hover-background) data-selected:text-(--clarify-theme-tokens-colors-primary)",
|
|
2883
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
2884
|
-
className: "min-w-0",
|
|
2885
|
-
children: [/* @__PURE__ */ jsx("span", {
|
|
2886
|
-
className: "block truncate",
|
|
2887
|
-
children: option.label
|
|
2888
|
-
}), option.description ? /* @__PURE__ */ jsx("span", {
|
|
2889
|
-
className: "mt-0.5 block truncate text-2xs text-(--clarify-ui-text-faint)",
|
|
2890
|
-
children: option.description
|
|
2891
|
-
}) : null]
|
|
2892
|
-
}), /* @__PURE__ */ jsx(CheckIcon, {
|
|
2893
|
-
className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
|
|
2894
|
-
"aria-hidden": "true"
|
|
2895
|
-
})]
|
|
2896
|
-
}, option.value))
|
|
2897
|
-
})]
|
|
2898
|
-
})
|
|
2899
|
-
});
|
|
2900
|
-
}
|
|
2901
3240
|
function getServerPreviewUrl(server, variables) {
|
|
2902
3241
|
return (server.url ?? "").replace(/\{([^}]+)\}/g, (_, name) => variables[name] ?? server.variables?.[name]?.default ?? `{${name}}`);
|
|
2903
3242
|
}
|
|
@@ -2921,12 +3260,12 @@ function getDefaultResponseStatus(operation, spec) {
|
|
|
2921
3260
|
return orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "";
|
|
2922
3261
|
}
|
|
2923
3262
|
function ServerUrlValue(arg0) {
|
|
2924
|
-
const { server, variables, open, interactive, onToggle } = arg0;
|
|
3263
|
+
const { servers, selectedKey, server, variables, open, interactive, directSelect, onSelect, onToggle } = arg0;
|
|
2925
3264
|
const url = getServerPreviewUrl(server, variables);
|
|
2926
3265
|
const protocolLabel = getServerProtocolLabel(server, variables);
|
|
2927
3266
|
if (!interactive) return /* @__PURE__ */ jsxs("span", {
|
|
2928
3267
|
"aria-label": "Server",
|
|
2929
|
-
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text
|
|
3268
|
+
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text) sm:w-auto sm:min-w-16 sm:max-w-(--clarify-server-url-max-width) sm:px-1.5",
|
|
2930
3269
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2931
3270
|
className: "sm:hidden",
|
|
2932
3271
|
children: /* @__PURE__ */ jsx(ServerIcon, {
|
|
@@ -2944,12 +3283,47 @@ function ServerUrlValue(arg0) {
|
|
|
2944
3283
|
})]
|
|
2945
3284
|
})]
|
|
2946
3285
|
});
|
|
3286
|
+
if (directSelect) return /* @__PURE__ */ jsx(InlineListbox, {
|
|
3287
|
+
label: "Server",
|
|
3288
|
+
value: selectedKey,
|
|
3289
|
+
options: servers.map((option, index) => ({
|
|
3290
|
+
value: getServerKey(option, index),
|
|
3291
|
+
label: getServerLabel(option, index),
|
|
3292
|
+
description: option.description
|
|
3293
|
+
})),
|
|
3294
|
+
onChange: onSelect,
|
|
3295
|
+
className: "w-8 shrink-0 sm:w-fit sm:min-w-16 sm:max-w-(--clarify-server-url-max-width)",
|
|
3296
|
+
buttonClassName: "group flex h-8 w-full min-w-0 cursor-pointer items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) px-0 text-(--clarify-ui-text) transition-colors hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) data-open:bg-(--clarify-ui-active-background) data-open:text-(--clarify-theme-tokens-colors-foreground) sm:px-1.5",
|
|
3297
|
+
buttonContent: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
3298
|
+
className: "sm:hidden",
|
|
3299
|
+
children: /* @__PURE__ */ jsx(ServerIcon, {
|
|
3300
|
+
className: "h-4 w-4",
|
|
3301
|
+
"aria-hidden": "true"
|
|
3302
|
+
})
|
|
3303
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
3304
|
+
className: "hidden min-w-0 items-center gap-1 overflow-hidden sm:flex",
|
|
3305
|
+
children: [
|
|
3306
|
+
protocolLabel ? /* @__PURE__ */ jsx("span", {
|
|
3307
|
+
className: "shrink-0 rounded bg-sky-100 px-1.5 py-0.5 text-2xs font-black text-sky-700 dark:bg-sky-400/15 dark:text-sky-200",
|
|
3308
|
+
children: protocolLabel
|
|
3309
|
+
}) : null,
|
|
3310
|
+
/* @__PURE__ */ jsx("span", {
|
|
3311
|
+
className: "truncate font-semibold text-xs",
|
|
3312
|
+
children: url
|
|
3313
|
+
}),
|
|
3314
|
+
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
3315
|
+
className: "h-3.5 w-3.5 shrink-0 text-zinc-400 transition-transform group-data-open:rotate-180",
|
|
3316
|
+
"aria-hidden": "true"
|
|
3317
|
+
})
|
|
3318
|
+
]
|
|
3319
|
+
})] })
|
|
3320
|
+
});
|
|
2947
3321
|
return /* @__PURE__ */ jsxs("button", {
|
|
2948
3322
|
type: "button",
|
|
2949
3323
|
"aria-expanded": open,
|
|
2950
3324
|
"aria-label": "Server",
|
|
2951
3325
|
onClick: onToggle,
|
|
2952
|
-
className: clsx("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text
|
|
3326
|
+
className: clsx("flex h-8 w-8 shrink-0 cursor-pointer items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text) transition-colors hover:bg-(--clarify-ui-hover-background) hover:text-(--clarify-theme-tokens-colors-foreground) focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) sm:w-auto sm:min-w-16 sm:max-w-(--clarify-server-url-max-width) sm:px-1.5", open ? "bg-(--clarify-ui-active-background) text-(--clarify-theme-tokens-colors-foreground)" : null),
|
|
2953
3327
|
children: [/* @__PURE__ */ jsx("span", {
|
|
2954
3328
|
className: "sm:hidden",
|
|
2955
3329
|
children: /* @__PURE__ */ jsx(ServerIcon, {
|
|
@@ -2968,7 +3342,7 @@ function ServerUrlValue(arg0) {
|
|
|
2968
3342
|
children: url
|
|
2969
3343
|
}),
|
|
2970
3344
|
/* @__PURE__ */ jsx(ChevronDownIcon, {
|
|
2971
|
-
className: "h-3.5 w-3.5 shrink-0 text-zinc-400",
|
|
3345
|
+
className: clsx("h-3.5 w-3.5 shrink-0 text-zinc-400 transition-transform", open && "rotate-180"),
|
|
2972
3346
|
"aria-hidden": "true"
|
|
2973
3347
|
})
|
|
2974
3348
|
]
|
|
@@ -3068,7 +3442,8 @@ function AuthPanel(arg0) {
|
|
|
3068
3442
|
className: "mr-2 shrink-0 text-2xs font-semibold text-(--clarify-ui-text-soft)",
|
|
3069
3443
|
children: selectedAuth.scheme.type === "apiKey" ? selectedAuth.scheme.in ?? "apiKey" : selectedAuth.scheme.scheme ?? selectedAuth.scheme.type ?? "token"
|
|
3070
3444
|
}), /* @__PURE__ */ jsx("input", {
|
|
3071
|
-
value: authValues[selectedAuth.name] ??
|
|
3445
|
+
value: authValues[selectedAuth.name] ?? "",
|
|
3446
|
+
placeholder: authPlaceholder(selectedAuth),
|
|
3072
3447
|
onChange: (event) => onChangeAuthValue(selectedAuth.name, event.target.value),
|
|
3073
3448
|
className: "min-w-0 flex-1 border-0 bg-transparent px-0 py-0 text-xs font-semibold text-(--clarify-theme-tokens-colors-foreground) outline-hidden placeholder:text-(--clarify-ui-text-faint)"
|
|
3074
3449
|
})]
|
|
@@ -3079,6 +3454,7 @@ function AuthPanel(arg0) {
|
|
|
3079
3454
|
}
|
|
3080
3455
|
function EndpointIdentity(arg0) {
|
|
3081
3456
|
const { method, operationSource, path, servers, selectedServerKey, selectedServer, serverVariables, serverOpen, authOptions, selectedAuthName, selectedAuth, authValues, authOpen, onSelectServer, onChangeServerVariable, onToggleServer, onToggleAuth, onSelectAuth, onChangeAuthValue } = arg0;
|
|
3457
|
+
const directServerSelect = servers.length > 1 && servers.every((server) => Object.keys(server.variables ?? {}).length === 0);
|
|
3082
3458
|
const serverInteractive = servers.length > 1 || Object.keys(selectedServer.variables ?? {}).length > 0;
|
|
3083
3459
|
const [copiedUrl, setCopiedUrl] = useState(false);
|
|
3084
3460
|
const fullUrl = getFullEndpointUrl(selectedServer, serverVariables, path);
|
|
@@ -3091,7 +3467,7 @@ function EndpointIdentity(arg0) {
|
|
|
3091
3467
|
if (await copyTextToClipboard(fullUrl)) setCopiedUrl(true);
|
|
3092
3468
|
}
|
|
3093
3469
|
return /* @__PURE__ */ jsxs("div", {
|
|
3094
|
-
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",
|
|
3470
|
+
className: "clarify-openai-endpoint-identity 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",
|
|
3095
3471
|
children: [
|
|
3096
3472
|
/* @__PURE__ */ jsxs("div", {
|
|
3097
3473
|
className: "flex min-w-0 items-center gap-1.5 overflow-hidden px-2.5 py-2",
|
|
@@ -3099,10 +3475,14 @@ function EndpointIdentity(arg0) {
|
|
|
3099
3475
|
/* @__PURE__ */ jsx(EndpointMethodBadge, { method }),
|
|
3100
3476
|
operationSource === "webhook" ? /* @__PURE__ */ jsx(EndpointMethodBadge, { method: "WEBHOOK" }) : null,
|
|
3101
3477
|
/* @__PURE__ */ jsx(ServerUrlValue, {
|
|
3478
|
+
servers,
|
|
3479
|
+
selectedKey: selectedServerKey,
|
|
3102
3480
|
server: selectedServer,
|
|
3103
3481
|
variables: serverVariables,
|
|
3104
3482
|
open: serverOpen,
|
|
3105
3483
|
interactive: serverInteractive,
|
|
3484
|
+
directSelect: directServerSelect,
|
|
3485
|
+
onSelect: onSelectServer,
|
|
3106
3486
|
onToggle: onToggleServer
|
|
3107
3487
|
}),
|
|
3108
3488
|
/* @__PURE__ */ jsx(EndpointPath, {
|
|
@@ -3115,7 +3495,7 @@ function EndpointIdentity(arg0) {
|
|
|
3115
3495
|
"aria-expanded": authOpen,
|
|
3116
3496
|
"aria-label": "Auth",
|
|
3117
3497
|
onClick: onToggleAuth,
|
|
3118
|
-
className: clsx("ml-auto flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-(--clarify-ui-text-soft) transition hover:bg-(--clarify-ui-hover-background) hover:text-emerald-700 dark:hover:text-emerald-200", authOpen ? "bg-emerald-100 text-emerald-800 dark:bg-emerald-400/15 dark:text-emerald-100" : "bg-(--clarify-ui-subtle-background)"),
|
|
3498
|
+
className: clsx("ml-auto flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-(--clarify-ui-text-soft) transition hover:bg-(--clarify-ui-hover-background) hover:text-emerald-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary) dark:hover:text-emerald-200", authOpen ? "bg-emerald-100 text-emerald-800 dark:bg-emerald-400/15 dark:text-emerald-100" : "bg-(--clarify-ui-subtle-background)"),
|
|
3119
3499
|
children: authOpen ? /* @__PURE__ */ jsx(UnlockKeyholeIcon, {
|
|
3120
3500
|
className: "h-4 w-4",
|
|
3121
3501
|
"aria-hidden": "true"
|
|
@@ -3126,7 +3506,7 @@ function EndpointIdentity(arg0) {
|
|
|
3126
3506
|
}) : null
|
|
3127
3507
|
]
|
|
3128
3508
|
}),
|
|
3129
|
-
serverInteractive && serverOpen ? /* @__PURE__ */ jsx(ServerPanel, {
|
|
3509
|
+
serverInteractive && !directServerSelect && serverOpen ? /* @__PURE__ */ jsx(ServerPanel, {
|
|
3130
3510
|
servers,
|
|
3131
3511
|
selectedKey: selectedServerKey,
|
|
3132
3512
|
selectedServer,
|
|
@@ -3156,7 +3536,7 @@ function OpenApiOperation(arg0) {
|
|
|
3156
3536
|
const [linkedExampleKey, setLinkedExampleKey] = useState("");
|
|
3157
3537
|
const [selectedResponseStatus, setSelectedResponseStatus] = useState(() => getDefaultResponseStatus(operation, spec));
|
|
3158
3538
|
return /* @__PURE__ */ jsxs("section", {
|
|
3159
|
-
className: "clarify-
|
|
3539
|
+
className: "clarify-openai-endpoint scroll-mt-24 pb-16 first:pt-0 last:pb-0",
|
|
3160
3540
|
"aria-labelledby": id,
|
|
3161
3541
|
children: [
|
|
3162
3542
|
/* @__PURE__ */ jsx(Heading, {
|
|
@@ -3222,6 +3602,6 @@ function OpenApiOperation(arg0) {
|
|
|
3222
3602
|
});
|
|
3223
3603
|
}
|
|
3224
3604
|
//#endregion
|
|
3225
|
-
export {
|
|
3605
|
+
export { CodeGroup as A, HeroPattern as C, Feedback as D, Tag as E, Callout as F, Button as I, Mermaid as M, Card as N, Collapse as O, CardGroup as P, GridPattern as S, Heading as T, TabItem as _, authPlaceholder as a, Steps as b, getServerKey as c, listOpenApiOperations as d, getMediaTypeEntries as f, WebFrame as g, primitives_exports as h, ResponseExamplesPanel as i, Pre as j, Code as k, getServers as l, Markdown as m, OpenApiOperation as n, defaultServerVariables as o, getRequestBody$1 as p, RequestExamplesPanel as r, getAuthOptions as s, EndpointIdentity as t, getOpenApiOperationEntry as u, Tabs as v, Logo as w, Prose as x, Step as y };
|
|
3226
3606
|
|
|
3227
|
-
//# sourceMappingURL=OpenApiOperation-
|
|
3607
|
+
//# sourceMappingURL=OpenApiOperation-BZWeCbvy.js.map
|