@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,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-DakpK96I.cjs");
|
|
2
|
-
const require_i18n = require("./i18n-
|
|
3
|
-
const require_PageActions = require("./PageActions-
|
|
4
|
-
const require_remark = require("./remark-
|
|
2
|
+
const require_i18n = require("./i18n-C-fReCj-.cjs");
|
|
3
|
+
const require_PageActions = require("./PageActions-Dg1l9KB1.cjs");
|
|
4
|
+
const require_remark = require("./remark-DTLbG8PK.cjs");
|
|
5
5
|
let clsx = require("clsx");
|
|
6
6
|
clsx = require_rolldown_runtime.__toESM(clsx, 1);
|
|
7
7
|
let react = require("react");
|
|
@@ -13,8 +13,37 @@ let framer_motion = require("framer-motion");
|
|
|
13
13
|
let zustand = require("zustand");
|
|
14
14
|
let react_markdown = require("react-markdown");
|
|
15
15
|
react_markdown = require_rolldown_runtime.__toESM(react_markdown, 1);
|
|
16
|
+
let rehype_raw = require("rehype-raw");
|
|
17
|
+
rehype_raw = require_rolldown_runtime.__toESM(rehype_raw, 1);
|
|
16
18
|
let github_slugger = require("github-slugger");
|
|
19
|
+
let shiki = require("shiki");
|
|
17
20
|
let _scalar_snippetz = require("@scalar/snippetz");
|
|
21
|
+
//#region source/components/AccordionGroup.tsx
|
|
22
|
+
function AccordionGroup(arg0) {
|
|
23
|
+
const { children, multiple = false, className, ...props } = arg0;
|
|
24
|
+
const childArray = react.Children.toArray(children);
|
|
25
|
+
const [openIndex, setOpenIndex] = (0, react.useState)(() => {
|
|
26
|
+
const defaultIndex = childArray.findIndex((child) => (0, react.isValidElement)(child) && child.props.defaultOpen);
|
|
27
|
+
return defaultIndex === -1 ? null : defaultIndex;
|
|
28
|
+
});
|
|
29
|
+
const items = childArray.map((child, index) => {
|
|
30
|
+
if (!(0, react.isValidElement)(child)) return child;
|
|
31
|
+
if (multiple) return child;
|
|
32
|
+
return (0, react.cloneElement)(child, {
|
|
33
|
+
open: openIndex === index,
|
|
34
|
+
onOpenChange: (open) => {
|
|
35
|
+
child.props.onOpenChange?.(open);
|
|
36
|
+
setOpenIndex(open ? index : null);
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
41
|
+
className: (0, clsx.default)("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),
|
|
42
|
+
...props,
|
|
43
|
+
children: items
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
18
47
|
//#region source/components/LocalizedLink.tsx
|
|
19
48
|
function useLocalizedHref(href) {
|
|
20
49
|
return require_PageActions.localizeHref(href, require_i18n.useConfig(), require_i18n.useLocale());
|
|
@@ -34,15 +63,15 @@ function LocalizedLink(arg0) {
|
|
|
34
63
|
//#endregion
|
|
35
64
|
//#region source/components/Button.tsx
|
|
36
65
|
var buttonVariantStyles = {
|
|
37
|
-
primary: "
|
|
38
|
-
secondary: "
|
|
39
|
-
filled: "
|
|
40
|
-
outline: "
|
|
66
|
+
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",
|
|
67
|
+
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)",
|
|
68
|
+
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",
|
|
69
|
+
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)",
|
|
41
70
|
text: "text-(--clarify-theme-tokens-colors-primary) hover:opacity-80 dark:text-(--clarify-theme-tokens-colors-primary) dark:hover:opacity-80"
|
|
42
71
|
};
|
|
43
72
|
function Button(arg0) {
|
|
44
73
|
const { variant = "primary", className, children, arrow, ...props } = arg0;
|
|
45
|
-
const classes = (0, clsx.default)("clarify-button not-prose inline-flex w-fit max-w-full items-center justify-center gap-1 overflow-hidden align-middle text-sm
|
|
74
|
+
const classes = (0, clsx.default)("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);
|
|
46
75
|
const arrowIcon = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowRight, {
|
|
47
76
|
"aria-hidden": "true",
|
|
48
77
|
className: (0, clsx.default)("h-4 w-4 shrink-0", variant === "text" && "relative top-px", arrow === "left" && "-ml-0.5 rotate-180", arrow === "right" && "-mr-0.5")
|
|
@@ -70,37 +99,43 @@ function Button(arg0) {
|
|
|
70
99
|
//#region source/components/Callout.tsx
|
|
71
100
|
var calloutStyles = {
|
|
72
101
|
info: {
|
|
73
|
-
container: "border-sky-500/20 bg-sky-50/
|
|
102
|
+
container: "border-sky-500/20 bg-sky-50/30 dark:border-sky-400/20 dark:bg-sky-400/5",
|
|
103
|
+
iconContainer: "bg-sky-100 ring-sky-500/15 dark:bg-sky-400/10 dark:ring-sky-400/20",
|
|
74
104
|
icon: "text-sky-600 dark:text-sky-400",
|
|
75
105
|
title: "text-sky-900 dark:text-sky-100",
|
|
76
106
|
Icon: lucide_react.Info
|
|
77
107
|
},
|
|
78
108
|
note: {
|
|
79
|
-
container: "border-zinc-500/20 bg-zinc-50
|
|
109
|
+
container: "border-zinc-500/20 bg-zinc-50/50 dark:border-white/10 dark:bg-white/5",
|
|
110
|
+
iconContainer: "bg-zinc-200/70 ring-zinc-500/15 dark:bg-white/10 dark:ring-white/10",
|
|
80
111
|
icon: "text-zinc-500 dark:text-zinc-400",
|
|
81
112
|
title: "text-zinc-900 dark:text-white",
|
|
82
113
|
Icon: lucide_react.Info
|
|
83
114
|
},
|
|
84
115
|
tip: {
|
|
85
|
-
container: "border-emerald-500/20 bg-emerald-50/
|
|
116
|
+
container: "border-emerald-500/20 bg-emerald-50/30 dark:border-emerald-400/20 dark:bg-emerald-400/5",
|
|
117
|
+
iconContainer: "bg-emerald-100 ring-emerald-500/15 dark:bg-emerald-400/10 dark:ring-emerald-400/20",
|
|
86
118
|
icon: "text-emerald-600 dark:text-emerald-400",
|
|
87
119
|
title: "text-emerald-900 dark:text-emerald-100",
|
|
88
120
|
Icon: lucide_react.Lightbulb
|
|
89
121
|
},
|
|
90
122
|
warning: {
|
|
91
|
-
container: "border-amber-500/20 bg-amber-50/
|
|
123
|
+
container: "border-amber-500/20 bg-amber-50/40 dark:border-amber-400/20 dark:bg-amber-400/5",
|
|
124
|
+
iconContainer: "bg-amber-100 ring-amber-500/15 dark:bg-amber-400/10 dark:ring-amber-400/20",
|
|
92
125
|
icon: "text-amber-600 dark:text-amber-400",
|
|
93
126
|
title: "text-amber-900 dark:text-amber-100",
|
|
94
127
|
Icon: lucide_react.AlertTriangle
|
|
95
128
|
},
|
|
96
129
|
danger: {
|
|
97
|
-
container: "border-rose-500/20 bg-rose-50/
|
|
130
|
+
container: "border-rose-500/20 bg-rose-50/40 dark:border-rose-400/20 dark:bg-rose-400/5",
|
|
131
|
+
iconContainer: "bg-rose-100 ring-rose-500/15 dark:bg-rose-400/10 dark:ring-rose-400/20",
|
|
98
132
|
icon: "text-rose-600 dark:text-rose-400",
|
|
99
133
|
title: "text-rose-900 dark:text-rose-100",
|
|
100
134
|
Icon: lucide_react.XCircle
|
|
101
135
|
},
|
|
102
136
|
success: {
|
|
103
|
-
container: "border-emerald-500/20 bg-emerald-50/
|
|
137
|
+
container: "border-emerald-500/20 bg-emerald-50/30 dark:border-emerald-400/20 dark:bg-emerald-400/5",
|
|
138
|
+
iconContainer: "bg-emerald-100 ring-emerald-500/15 dark:bg-emerald-400/10 dark:ring-emerald-400/20",
|
|
104
139
|
icon: "text-emerald-600 dark:text-emerald-400",
|
|
105
140
|
title: "text-emerald-900 dark:text-emerald-100",
|
|
106
141
|
Icon: lucide_react.CheckCircle2
|
|
@@ -121,15 +156,18 @@ function Callout(arg0) {
|
|
|
121
156
|
const Icon = style.Icon;
|
|
122
157
|
const resolvedTitle = title === void 0 ? t(defaultTitleKeys[type]) : title;
|
|
123
158
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
124
|
-
className: (0, clsx.default)("clarify-callout my-6 flex gap-3 rounded-(--clarify-theme-tokens-radius-
|
|
159
|
+
className: (0, clsx.default)("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),
|
|
125
160
|
...props,
|
|
126
|
-
children: [icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
127
|
-
className: (0, clsx.default)("
|
|
128
|
-
|
|
161
|
+
children: [icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
162
|
+
className: (0, clsx.default)("flex size-7 flex-none items-center justify-center rounded-(--clarify-theme-tokens-radius-md) ring-1 ring-inset", style.iconContainer),
|
|
163
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
164
|
+
className: (0, clsx.default)("size-4", style.icon),
|
|
165
|
+
"aria-hidden": "true"
|
|
166
|
+
})
|
|
129
167
|
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
130
168
|
className: "min-w-0 flex-1 *:first:mt-0 *:last:mb-0",
|
|
131
169
|
children: [resolvedTitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
132
|
-
className: (0, clsx.default)("mb-1 font-semibold", style.title),
|
|
170
|
+
className: (0, clsx.default)("mb-1.5 font-semibold", style.title),
|
|
133
171
|
children: resolvedTitle
|
|
134
172
|
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
135
173
|
className: "*:first:mt-0 *:last:mb-0",
|
|
@@ -148,9 +186,9 @@ function CardIcon(arg0) {
|
|
|
148
186
|
const Icon = require_PageActions.lucideIconRegistry[iconName];
|
|
149
187
|
if (!Icon) return null;
|
|
150
188
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
151
|
-
className: "flex size-
|
|
189
|
+
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",
|
|
152
190
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, {
|
|
153
|
-
className: "size-
|
|
191
|
+
className: "size-4",
|
|
154
192
|
"aria-hidden": "true"
|
|
155
193
|
})
|
|
156
194
|
});
|
|
@@ -164,7 +202,7 @@ var cardGroupColumnStyles = {
|
|
|
164
202
|
function CardGroup(arg0) {
|
|
165
203
|
const { children, cols = 2, className } = arg0;
|
|
166
204
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
167
|
-
className: (0, clsx.default)("not-prose my-
|
|
205
|
+
className: (0, clsx.default)("not-prose my-8 grid gap-3", cardGroupColumnStyles[cols], className),
|
|
168
206
|
children
|
|
169
207
|
});
|
|
170
208
|
}
|
|
@@ -174,11 +212,17 @@ function Card(arg0) {
|
|
|
174
212
|
className: "flex items-start gap-4",
|
|
175
213
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CardIcon, { name: icon }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
176
214
|
className: "min-w-0 flex-1",
|
|
177
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.
|
|
178
|
-
className: "
|
|
179
|
-
children:
|
|
215
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
216
|
+
className: "flex items-start justify-between gap-3",
|
|
217
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
218
|
+
className: "m-0 text-sm/6 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
|
|
219
|
+
children: title
|
|
220
|
+
}), href ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ArrowUpRight, {
|
|
221
|
+
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)",
|
|
222
|
+
"aria-hidden": "true"
|
|
223
|
+
}) : null]
|
|
180
224
|
}), children ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
181
|
-
className: "mt-
|
|
225
|
+
className: "mt-1.5 text-sm/6 text-(--clarify-ui-text-soft) *:m-0",
|
|
182
226
|
children
|
|
183
227
|
}) : null]
|
|
184
228
|
})]
|
|
@@ -186,7 +230,7 @@ function Card(arg0) {
|
|
|
186
230
|
className: "absolute inset-0 rounded-(--clarify-theme-tokens-radius-xl)",
|
|
187
231
|
"aria-hidden": "true"
|
|
188
232
|
}) : null] });
|
|
189
|
-
const classes = (0, clsx.default)("group relative block rounded-(--clarify-theme-tokens-radius-
|
|
233
|
+
const classes = (0, clsx.default)("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);
|
|
190
234
|
if (!href) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
191
235
|
className: classes,
|
|
192
236
|
children: content
|
|
@@ -200,7 +244,7 @@ function Card(arg0) {
|
|
|
200
244
|
}
|
|
201
245
|
//#endregion
|
|
202
246
|
//#region source/components/Mermaid.tsx
|
|
203
|
-
var MermaidViewer = (0, react.lazy)(() => Promise.resolve().then(() => require("./MermaidViewer-
|
|
247
|
+
var MermaidViewer = (0, react.lazy)(() => Promise.resolve().then(() => require("./MermaidViewer-Db7qsyVk.cjs")));
|
|
204
248
|
var mermaidModulePromise;
|
|
205
249
|
async function loadMermaid() {
|
|
206
250
|
mermaidModulePromise = mermaidModulePromise ?? import("mermaid").then((module) => module.default);
|
|
@@ -326,6 +370,27 @@ function getNodeText(node) {
|
|
|
326
370
|
if ((0, react.isValidElement)(node)) return getNodeText(node.props.children);
|
|
327
371
|
return "";
|
|
328
372
|
}
|
|
373
|
+
function getCodeTitle(node) {
|
|
374
|
+
if (!(0, react.isValidElement)(node)) return void 0;
|
|
375
|
+
const { title, children } = node.props;
|
|
376
|
+
if (title) return title;
|
|
377
|
+
return react.Children.toArray(children).map(getCodeTitle).find(Boolean);
|
|
378
|
+
}
|
|
379
|
+
function getCodeLanguage(node) {
|
|
380
|
+
if (!(0, react.isValidElement)(node)) return void 0;
|
|
381
|
+
const { className, language, children } = node.props;
|
|
382
|
+
if (language) return language;
|
|
383
|
+
const languageClass = className?.split(/\s+/).find((value) => value.startsWith("language-"));
|
|
384
|
+
if (languageClass) return languageClass.slice(9);
|
|
385
|
+
return react.Children.toArray(children).map(getCodeLanguage).find(Boolean);
|
|
386
|
+
}
|
|
387
|
+
function getCodePanelTitle(node, fallbackTitle) {
|
|
388
|
+
return getPanelTitle({
|
|
389
|
+
title: getCodeTitle(node),
|
|
390
|
+
language: getCodeLanguage(node),
|
|
391
|
+
fallbackTitle
|
|
392
|
+
});
|
|
393
|
+
}
|
|
329
394
|
function CopyButton(arg0) {
|
|
330
395
|
const { code } = arg0;
|
|
331
396
|
const t = require_i18n.useBuiltInText();
|
|
@@ -395,6 +460,7 @@ function CodeGroupHeader(arg0) {
|
|
|
395
460
|
const { title, children, selectedIndex } = arg0;
|
|
396
461
|
const t = require_i18n.useBuiltInText();
|
|
397
462
|
const hasTabs = react.Children.count(children) > 1;
|
|
463
|
+
const indicatorLayoutId = (0, react.useId)();
|
|
398
464
|
if (!title && !hasTabs) return null;
|
|
399
465
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
400
466
|
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",
|
|
@@ -402,13 +468,19 @@ function CodeGroupHeader(arg0) {
|
|
|
402
468
|
className: "mr-auto pt-3 text-xs font-semibold text-(--clarify-code-text)",
|
|
403
469
|
children: title
|
|
404
470
|
}) : null, hasTabs ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabList, {
|
|
405
|
-
className: "clarify-code-tabs -mb-px flex gap-
|
|
406
|
-
children: react.Children.map(children, (child, childIndex) => /* @__PURE__ */ (0, react_jsx_runtime.
|
|
407
|
-
className: (0, clsx.default)("clarify-code-tab border-b py-3 transition data-selected:not-data-focus:outline-hidden", childIndex === selectedIndex ? "
|
|
408
|
-
children:
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
471
|
+
className: "clarify-code-tabs -mr-2 -mb-px flex gap-0 text-xs font-medium",
|
|
472
|
+
children: react.Children.map(children, (child, childIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Tab, {
|
|
473
|
+
className: (0, clsx.default)("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)"),
|
|
474
|
+
children: [getCodePanelTitle(child, t("actions.code")), childIndex === selectedIndex ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.span, {
|
|
475
|
+
layoutId: indicatorLayoutId,
|
|
476
|
+
className: "absolute inset-x-2 bottom-0 h-0.5 rounded-full bg-(--clarify-code-accent-text)",
|
|
477
|
+
transition: {
|
|
478
|
+
type: "spring",
|
|
479
|
+
stiffness: 460,
|
|
480
|
+
damping: 34,
|
|
481
|
+
mass: .7
|
|
482
|
+
}
|
|
483
|
+
}) : null]
|
|
412
484
|
}))
|
|
413
485
|
}) : null]
|
|
414
486
|
});
|
|
@@ -473,10 +545,7 @@ var CodeGroupContext = (0, react.createContext)(false);
|
|
|
473
545
|
function CodeGroup(arg0) {
|
|
474
546
|
const { children, title, ...props } = arg0;
|
|
475
547
|
const t = require_i18n.useBuiltInText();
|
|
476
|
-
const tabGroupProps = useTabGroupProps(react.Children.map(children, (child) =>
|
|
477
|
-
...(0, react.isValidElement)(child) ? child.props : {},
|
|
478
|
-
fallbackTitle: t("actions.code")
|
|
479
|
-
})) ?? []);
|
|
548
|
+
const tabGroupProps = useTabGroupProps(react.Children.map(children, (child) => getCodePanelTitle(child, t("actions.code"))) ?? []);
|
|
480
549
|
const hasTabs = react.Children.count(children) > 1;
|
|
481
550
|
const containerClassName = "clarify-code-group my-6 overflow-hidden rounded-2xl bg-(--clarify-code-background) shadow-md ring-1 ring-(--clarify-code-border)";
|
|
482
551
|
const header = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeGroupHeader, {
|
|
@@ -520,7 +589,9 @@ function Code(arg0) {
|
|
|
520
589
|
function Pre(arg0) {
|
|
521
590
|
const { children, language, code, ...props } = arg0;
|
|
522
591
|
const isGrouped = (0, react.useContext)(CodeGroupContext);
|
|
523
|
-
|
|
592
|
+
const resolvedLanguage = language ?? getCodeLanguage(children);
|
|
593
|
+
const resolvedCode = code ?? getNodeText(children);
|
|
594
|
+
if (resolvedLanguage === "mermaid") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Mermaid, { chart: resolvedCode });
|
|
524
595
|
if (isGrouped) return children;
|
|
525
596
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeGroup, {
|
|
526
597
|
...props,
|
|
@@ -530,8 +601,9 @@ function Pre(arg0) {
|
|
|
530
601
|
//#endregion
|
|
531
602
|
//#region source/components/Collapse.tsx
|
|
532
603
|
function Collapse(arg0) {
|
|
533
|
-
const { children, title, summary, defaultOpen = false, className, ...props } = arg0;
|
|
534
|
-
const [
|
|
604
|
+
const { children, title, summary, defaultOpen = false, open: controlledOpen, onOpenChange, className, ...props } = arg0;
|
|
605
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, react.useState)(defaultOpen);
|
|
606
|
+
const open = controlledOpen ?? uncontrolledOpen;
|
|
535
607
|
const contentRef = (0, react.useRef)(null);
|
|
536
608
|
const [maxHeight, setMaxHeight] = (0, react.useState)("0px");
|
|
537
609
|
const summaryLabel = title ?? summary ?? "Details";
|
|
@@ -541,16 +613,20 @@ function Collapse(arg0) {
|
|
|
541
613
|
setMaxHeight(open ? `${contentRef.current.scrollHeight}px` : "0px");
|
|
542
614
|
}, [open, children]);
|
|
543
615
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
544
|
-
className: (0, clsx.default)("clarify-collapse my-6 overflow-hidden rounded-(--clarify-theme-tokens-radius-
|
|
616
|
+
className: (0, clsx.default)("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),
|
|
545
617
|
...props,
|
|
546
618
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
547
619
|
type: "button",
|
|
548
|
-
className: "flex w-full cursor-pointer items-center justify-between gap-3 px-4 py-
|
|
620
|
+
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)",
|
|
549
621
|
"aria-expanded": open,
|
|
550
622
|
"aria-controls": contentId,
|
|
551
|
-
onClick: () =>
|
|
623
|
+
onClick: () => {
|
|
624
|
+
const nextOpen = !open;
|
|
625
|
+
if (controlledOpen === void 0) setUncontrolledOpen(nextOpen);
|
|
626
|
+
onOpenChange?.(nextOpen);
|
|
627
|
+
},
|
|
552
628
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: summaryLabel }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDown, {
|
|
553
|
-
className: (0, clsx.default)("
|
|
629
|
+
className: (0, clsx.default)("size-4 rounded-full text-(--clarify-ui-text-faint) transition duration-200", open && "rotate-180"),
|
|
554
630
|
"aria-hidden": "true"
|
|
555
631
|
})]
|
|
556
632
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -562,7 +638,7 @@ function Collapse(arg0) {
|
|
|
562
638
|
},
|
|
563
639
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
564
640
|
ref: contentRef,
|
|
565
|
-
className: (0, clsx.default)("px-4 py-4 text-sm/6 text-(--clarify-
|
|
641
|
+
className: (0, clsx.default)("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"),
|
|
566
642
|
children
|
|
567
643
|
})
|
|
568
644
|
})]
|
|
@@ -638,6 +714,55 @@ function Feedback() {
|
|
|
638
714
|
});
|
|
639
715
|
}
|
|
640
716
|
//#endregion
|
|
717
|
+
//#region source/components/FileTree.tsx
|
|
718
|
+
function FileTree(arg0) {
|
|
719
|
+
const { children, className, ...props } = arg0;
|
|
720
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
721
|
+
className: (0, clsx.default)("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),
|
|
722
|
+
...props,
|
|
723
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
724
|
+
role: "tree",
|
|
725
|
+
className: "m-0 min-w-max list-none p-0",
|
|
726
|
+
children
|
|
727
|
+
})
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
function FileTreeItem(arg0) {
|
|
731
|
+
const { name, description, type, children, className, ...props } = arg0;
|
|
732
|
+
const isFolder = type === "folder" || children != null;
|
|
733
|
+
const FolderIcon = children ? lucide_react.FolderOpen : lucide_react.Folder;
|
|
734
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
735
|
+
role: "treeitem",
|
|
736
|
+
"aria-expanded": isFolder ? children != null : void 0,
|
|
737
|
+
className: (0, clsx.default)("clarify-file-tree-item m-0 p-0", className),
|
|
738
|
+
...props,
|
|
739
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
740
|
+
className: "flex min-h-6 items-center gap-2 whitespace-nowrap",
|
|
741
|
+
children: [
|
|
742
|
+
isFolder ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(FolderIcon, {
|
|
743
|
+
className: "size-4 flex-none text-(--clarify-ui-accent-text)",
|
|
744
|
+
"aria-hidden": "true"
|
|
745
|
+
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.File, {
|
|
746
|
+
className: "size-4 flex-none text-(--clarify-ui-text-faint)",
|
|
747
|
+
"aria-hidden": "true"
|
|
748
|
+
}),
|
|
749
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
750
|
+
className: "font-medium text-(--clarify-theme-tokens-colors-foreground)",
|
|
751
|
+
children: name
|
|
752
|
+
}),
|
|
753
|
+
description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
754
|
+
className: "font-sans text-xs text-(--clarify-ui-text-faint)",
|
|
755
|
+
children: description
|
|
756
|
+
}) : null
|
|
757
|
+
]
|
|
758
|
+
}), children ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ul", {
|
|
759
|
+
role: "group",
|
|
760
|
+
className: "m-0 ml-2.5 list-none border-l border-(--clarify-theme-tokens-colors-border) pl-4",
|
|
761
|
+
children
|
|
762
|
+
}) : null]
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
//#endregion
|
|
641
766
|
//#region source/components/Tag.tsx
|
|
642
767
|
var tagVariantStyles = {
|
|
643
768
|
small: "",
|
|
@@ -844,10 +969,50 @@ function Prose(arg0) {
|
|
|
844
969
|
});
|
|
845
970
|
}
|
|
846
971
|
//#endregion
|
|
972
|
+
//#region source/components/Steps.tsx
|
|
973
|
+
function Steps(arg0) {
|
|
974
|
+
const { children, className, ...props } = arg0;
|
|
975
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("ol", {
|
|
976
|
+
className: (0, clsx.default)("clarify-steps my-8 ml-3 list-none border-l-2 border-(--clarify-theme-tokens-colors-border) p-0", className),
|
|
977
|
+
...props,
|
|
978
|
+
children
|
|
979
|
+
});
|
|
980
|
+
}
|
|
981
|
+
function Step(arg0) {
|
|
982
|
+
const { children, title, className, ...props } = arg0;
|
|
983
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("li", {
|
|
984
|
+
className: (0, clsx.default)("clarify-step relative m-0 pb-10 pl-9 last:pb-0", className),
|
|
985
|
+
...props,
|
|
986
|
+
children: [
|
|
987
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
988
|
+
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",
|
|
989
|
+
"aria-hidden": "true"
|
|
990
|
+
}),
|
|
991
|
+
title ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
992
|
+
className: "m-0 pt-0.5 text-base font-semibold text-(--clarify-theme-tokens-colors-foreground)",
|
|
993
|
+
children: title
|
|
994
|
+
}) : null,
|
|
995
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
996
|
+
className: (0, clsx.default)("text-sm/6 text-(--clarify-ui-text-soft) *:last:mb-0", title && "mt-2.5", !title && "*:first:mt-0"),
|
|
997
|
+
children
|
|
998
|
+
})
|
|
999
|
+
]
|
|
1000
|
+
});
|
|
1001
|
+
}
|
|
1002
|
+
//#endregion
|
|
847
1003
|
//#region source/components/Tabs.tsx
|
|
1004
|
+
function TabItem(_props) {
|
|
1005
|
+
return null;
|
|
1006
|
+
}
|
|
848
1007
|
function Tabs(arg0) {
|
|
849
|
-
const { items, selectedIndex, onChange, className, listClassName, panelsClassName } = arg0;
|
|
850
|
-
const
|
|
1008
|
+
const { items, children, defaultValue, selectedIndex, onChange, className, listClassName, panelsClassName } = arg0;
|
|
1009
|
+
const childItems = react.Children.toArray(children).filter((child) => (0, react.isValidElement)(child) && child.type === TabItem).map((child, index) => ({
|
|
1010
|
+
id: child.props.value ?? `tab-${index}`,
|
|
1011
|
+
label: child.props.title,
|
|
1012
|
+
panel: child.props.children
|
|
1013
|
+
}));
|
|
1014
|
+
const resolvedItems = items ?? childItems;
|
|
1015
|
+
const [internalIndex, setInternalIndex] = (0, react.useState)(defaultValue ? Math.max(0, resolvedItems.findIndex((item) => item.id === defaultValue)) : 0);
|
|
851
1016
|
const resolvedIndex = typeof selectedIndex === "number" ? selectedIndex : internalIndex;
|
|
852
1017
|
const indicatorLayoutId = (0, react.useId)();
|
|
853
1018
|
const handleChange = (index) => {
|
|
@@ -857,14 +1022,14 @@ function Tabs(arg0) {
|
|
|
857
1022
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.TabGroup, {
|
|
858
1023
|
selectedIndex: resolvedIndex,
|
|
859
1024
|
onChange: handleChange,
|
|
860
|
-
className,
|
|
1025
|
+
className: (0, clsx.default)("clarify-tabs my-6", className),
|
|
861
1026
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabList, {
|
|
862
|
-
className: (0, clsx.default)("flex
|
|
863
|
-
children:
|
|
864
|
-
className: ({ selected }) => (0, clsx.default)("clarify-ui-tab relative inline-flex h-
|
|
1027
|
+
className: (0, clsx.default)("flex max-w-full items-stretch gap-1 overflow-x-auto border-b border-(--clarify-theme-tokens-colors-border)", listClassName),
|
|
1028
|
+
children: resolvedItems.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Tab, {
|
|
1029
|
+
className: ({ selected }) => (0, clsx.default)("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"),
|
|
865
1030
|
children: ({ selected }) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: item.label }), selected ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(framer_motion.motion.span, {
|
|
866
1031
|
layoutId: indicatorLayoutId,
|
|
867
|
-
className: "absolute inset-x-
|
|
1032
|
+
className: "absolute inset-x-2.5 -bottom-1 h-0.5 rounded-full bg-(--clarify-ui-tab-indicator)",
|
|
868
1033
|
transition: {
|
|
869
1034
|
type: "tween",
|
|
870
1035
|
duration: .16,
|
|
@@ -873,15 +1038,44 @@ function Tabs(arg0) {
|
|
|
873
1038
|
}) : null] })
|
|
874
1039
|
}, item.id))
|
|
875
1040
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabPanels, {
|
|
876
|
-
className: (0, clsx.default)("mt-
|
|
877
|
-
children:
|
|
878
|
-
className: "focus:outline-none",
|
|
1041
|
+
className: (0, clsx.default)("mt-5", panelsClassName),
|
|
1042
|
+
children: resolvedItems.map((item) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.TabPanel, {
|
|
1043
|
+
className: "focus:outline-none focus-visible:ring-2 focus-visible:ring-(--clarify-theme-tokens-colors-primary)",
|
|
879
1044
|
children: item.panel
|
|
880
1045
|
}, item.id))
|
|
881
1046
|
})]
|
|
882
1047
|
});
|
|
883
1048
|
}
|
|
884
1049
|
//#endregion
|
|
1050
|
+
//#region source/components/Tooltip.tsx
|
|
1051
|
+
function Tooltip(arg0) {
|
|
1052
|
+
const { content, children, side = "top", className, ...props } = arg0;
|
|
1053
|
+
const contentId = (0, react.useId)();
|
|
1054
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
1055
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1056
|
+
className: (0, clsx.default)("clarify-tooltip group relative inline-flex align-baseline", className),
|
|
1057
|
+
onMouseEnter: () => setOpen(true),
|
|
1058
|
+
onMouseLeave: () => setOpen(false),
|
|
1059
|
+
...props,
|
|
1060
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1061
|
+
tabIndex: 0,
|
|
1062
|
+
"aria-describedby": contentId,
|
|
1063
|
+
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)",
|
|
1064
|
+
onFocus: () => setOpen(true),
|
|
1065
|
+
onBlur: () => setOpen(false),
|
|
1066
|
+
onKeyDown: (event) => {
|
|
1067
|
+
if (event.key === "Escape") setOpen(false);
|
|
1068
|
+
},
|
|
1069
|
+
children
|
|
1070
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1071
|
+
id: contentId,
|
|
1072
|
+
role: "tooltip",
|
|
1073
|
+
className: (0, clsx.default)("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)]"),
|
|
1074
|
+
children: content
|
|
1075
|
+
})]
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
//#endregion
|
|
885
1079
|
//#region source/components/WebFrame.tsx
|
|
886
1080
|
function WebFrame(arg0) {
|
|
887
1081
|
const { src, title = "Embedded content", children, showWindow = true, className, iframeClassName, height = 420, style, ...props } = arg0;
|
|
@@ -904,53 +1098,122 @@ function WebFrame(arg0) {
|
|
|
904
1098
|
children
|
|
905
1099
|
});
|
|
906
1100
|
if (!showWindow) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
907
|
-
className: (0, clsx.default)("clarify-web-frame not-prose my-10 overflow-hidden rounded-(--clarify-theme-tokens-radius-
|
|
1101
|
+
className: (0, clsx.default)("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),
|
|
908
1102
|
children: frame
|
|
909
1103
|
});
|
|
910
1104
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
911
|
-
className: (0, clsx.default)("clarify-web-frame not-prose my-10 overflow-hidden rounded-(--clarify-theme-tokens-radius-
|
|
1105
|
+
className: (0, clsx.default)("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),
|
|
912
1106
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
913
|
-
className: "
|
|
1107
|
+
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",
|
|
914
1108
|
children: [
|
|
915
|
-
/* @__PURE__ */ (0, react_jsx_runtime.
|
|
916
|
-
className: "
|
|
917
|
-
"aria-hidden": "true"
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
924
|
-
className: "size-3 rounded-full bg-green-400",
|
|
925
|
-
"aria-hidden": "true"
|
|
1109
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1110
|
+
className: "flex items-center gap-1.5",
|
|
1111
|
+
"aria-hidden": "true",
|
|
1112
|
+
children: [
|
|
1113
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "size-2.5 rounded-full bg-red-400/80" }),
|
|
1114
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "size-2.5 rounded-full bg-amber-400/80" }),
|
|
1115
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "size-2.5 rounded-full bg-emerald-400/80" })
|
|
1116
|
+
]
|
|
926
1117
|
}),
|
|
927
|
-
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("
|
|
928
|
-
className: "
|
|
1118
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1119
|
+
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)",
|
|
929
1120
|
children: title
|
|
930
|
-
})
|
|
1121
|
+
}),
|
|
1122
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { "aria-hidden": "true" })
|
|
931
1123
|
]
|
|
932
1124
|
}), frame]
|
|
933
1125
|
});
|
|
934
1126
|
}
|
|
935
1127
|
//#endregion
|
|
1128
|
+
//#region source/components/Image.tsx
|
|
1129
|
+
function Image(arg0) {
|
|
1130
|
+
const { src, alt = "", caption, zoom = false, className, ...props } = arg0;
|
|
1131
|
+
const [open, setOpen] = (0, react.useState)(false);
|
|
1132
|
+
const image = /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
1133
|
+
...props,
|
|
1134
|
+
src,
|
|
1135
|
+
alt,
|
|
1136
|
+
className: (0, clsx.default)("block h-auto max-w-full object-contain", className)
|
|
1137
|
+
});
|
|
1138
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("figure", {
|
|
1139
|
+
className: "clarify-figure not-prose mx-auto my-8 w-fit max-w-full",
|
|
1140
|
+
children: [
|
|
1141
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1142
|
+
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)",
|
|
1143
|
+
children: zoom ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
1144
|
+
type: "button",
|
|
1145
|
+
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)",
|
|
1146
|
+
"aria-label": `Enlarge image: ${alt}`,
|
|
1147
|
+
onClick: () => setOpen(true),
|
|
1148
|
+
children: [image, /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1149
|
+
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",
|
|
1150
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Maximize2, {
|
|
1151
|
+
className: "size-4",
|
|
1152
|
+
"aria-hidden": "true"
|
|
1153
|
+
})
|
|
1154
|
+
})]
|
|
1155
|
+
}) : image
|
|
1156
|
+
}),
|
|
1157
|
+
caption ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("figcaption", {
|
|
1158
|
+
className: "mt-2 text-center text-xs/5 text-(--clarify-ui-text-faint)",
|
|
1159
|
+
children: caption
|
|
1160
|
+
}) : null,
|
|
1161
|
+
zoom ? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.Dialog, {
|
|
1162
|
+
open,
|
|
1163
|
+
onClose: setOpen,
|
|
1164
|
+
className: "relative z-50",
|
|
1165
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.DialogBackdrop, { className: "fixed inset-0 bg-black/75 backdrop-blur-sm" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1166
|
+
className: "fixed inset-0 flex items-center justify-center p-4 sm:p-8",
|
|
1167
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.DialogPanel, {
|
|
1168
|
+
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",
|
|
1169
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
1170
|
+
src,
|
|
1171
|
+
alt,
|
|
1172
|
+
className: "max-h-[calc(100dvh-5rem)] max-w-[calc(100vw-5rem)] object-contain"
|
|
1173
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1174
|
+
type: "button",
|
|
1175
|
+
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",
|
|
1176
|
+
"aria-label": "Close image preview",
|
|
1177
|
+
onClick: () => setOpen(false),
|
|
1178
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.X, {
|
|
1179
|
+
className: "size-4",
|
|
1180
|
+
"aria-hidden": "true"
|
|
1181
|
+
})
|
|
1182
|
+
})]
|
|
1183
|
+
})
|
|
1184
|
+
})]
|
|
1185
|
+
}) : null
|
|
1186
|
+
]
|
|
1187
|
+
});
|
|
1188
|
+
}
|
|
1189
|
+
//#endregion
|
|
936
1190
|
//#region source/mdx/primitives.tsx
|
|
937
1191
|
var primitives_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
|
|
1192
|
+
AccordionGroup: () => AccordionGroup,
|
|
938
1193
|
Button: () => Button,
|
|
939
1194
|
Callout: () => Callout,
|
|
940
1195
|
Card: () => Card,
|
|
941
1196
|
CardGroup: () => CardGroup,
|
|
942
1197
|
CodeGroup: () => CodeGroup,
|
|
943
1198
|
Col: () => Col,
|
|
1199
|
+
FileTree: () => FileTree,
|
|
1200
|
+
FileTreeItem: () => FileTreeItem,
|
|
944
1201
|
Note: () => Note,
|
|
945
1202
|
Properties: () => Properties,
|
|
946
1203
|
Property: () => Property,
|
|
947
1204
|
Row: () => Row,
|
|
1205
|
+
Step: () => Step,
|
|
1206
|
+
Steps: () => Steps,
|
|
1207
|
+
Tab: () => TabItem,
|
|
1208
|
+
Tabs: () => Tabs,
|
|
1209
|
+
Tooltip: () => Tooltip,
|
|
948
1210
|
WebFrame: () => WebFrame,
|
|
949
1211
|
a: () => a,
|
|
950
1212
|
code: () => code,
|
|
951
1213
|
h1: () => h1,
|
|
952
1214
|
h2: () => h2,
|
|
953
1215
|
h3: () => h3,
|
|
1216
|
+
img: () => img,
|
|
954
1217
|
pre: () => pre,
|
|
955
1218
|
table: () => table,
|
|
956
1219
|
wrapper: () => wrapper
|
|
@@ -995,6 +1258,7 @@ function h1(arg0) {
|
|
|
995
1258
|
}
|
|
996
1259
|
var code = Code;
|
|
997
1260
|
var pre = Pre;
|
|
1261
|
+
var img = Image;
|
|
998
1262
|
function h2(props) {
|
|
999
1263
|
return (0, react.createElement)(Heading, {
|
|
1000
1264
|
level: 2,
|
|
@@ -1010,8 +1274,8 @@ function h3(props) {
|
|
|
1010
1274
|
function Note(arg0) {
|
|
1011
1275
|
const { children } = arg0;
|
|
1012
1276
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1013
|
-
className: "clarify-note my-6 flex gap-
|
|
1014
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Info, { className: "mt-1
|
|
1277
|
+
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)]",
|
|
1278
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Info, { className: "mt-1 size-4 flex-none stroke-(--clarify-ui-accent-text)" }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1015
1279
|
className: "*:first:mt-0 *:last:mb-0",
|
|
1016
1280
|
children
|
|
1017
1281
|
})]
|
|
@@ -1123,6 +1387,7 @@ function Markdown(arg0) {
|
|
|
1123
1387
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_markdown.default, {
|
|
1124
1388
|
components: markdownComponents,
|
|
1125
1389
|
remarkPlugins: require_remark.markdownRemarkPlugins,
|
|
1390
|
+
rehypePlugins: [rehype_raw.default],
|
|
1126
1391
|
children
|
|
1127
1392
|
})
|
|
1128
1393
|
});
|
|
@@ -1384,8 +1649,72 @@ function listOpenApiOperations(spec) {
|
|
|
1384
1649
|
return [...listOperationsFromPathItems(paths, "path", spec), ...isRecord(webhooks) ? listOperationsFromPathItems(webhooks, "webhook", spec) : []];
|
|
1385
1650
|
}
|
|
1386
1651
|
//#endregion
|
|
1652
|
+
//#region source/components/HighlightedCode.tsx
|
|
1653
|
+
var cssVariablesTheme = (0, shiki.createCssVariablesTheme)();
|
|
1654
|
+
function HighlightedCode(arg0) {
|
|
1655
|
+
const { code, language } = arg0;
|
|
1656
|
+
const [lines, setLines] = (0, react.useState)();
|
|
1657
|
+
(0, react.useEffect)(() => {
|
|
1658
|
+
let active = true;
|
|
1659
|
+
(0, shiki.codeToTokens)(code, {
|
|
1660
|
+
lang: language,
|
|
1661
|
+
theme: cssVariablesTheme
|
|
1662
|
+
}).then((result) => {
|
|
1663
|
+
if (active) setLines(result.tokens);
|
|
1664
|
+
}).catch(() => {
|
|
1665
|
+
if (active) setLines(void 0);
|
|
1666
|
+
});
|
|
1667
|
+
return () => {
|
|
1668
|
+
active = false;
|
|
1669
|
+
};
|
|
1670
|
+
}, [code, language]);
|
|
1671
|
+
if (!lines) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
1672
|
+
className: `language-${language}`,
|
|
1673
|
+
children: code
|
|
1674
|
+
});
|
|
1675
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("code", {
|
|
1676
|
+
className: `language-${language}`,
|
|
1677
|
+
children: lines.map((line, lineIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1678
|
+
className: "line",
|
|
1679
|
+
children: [line.map((token, tokenIndex) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1680
|
+
style: {
|
|
1681
|
+
color: token.color,
|
|
1682
|
+
...token.htmlStyle
|
|
1683
|
+
},
|
|
1684
|
+
children: token.content
|
|
1685
|
+
}, tokenIndex)), lineIndex < lines.length - 1 ? "\n" : null]
|
|
1686
|
+
}, lineIndex))
|
|
1687
|
+
});
|
|
1688
|
+
}
|
|
1689
|
+
//#endregion
|
|
1387
1690
|
//#region source/openapi/lib/request-code.ts
|
|
1691
|
+
var snippetControlCharacters = [
|
|
1692
|
+
{
|
|
1693
|
+
character: "\n",
|
|
1694
|
+
placeholder: "",
|
|
1695
|
+
escape: "\\n"
|
|
1696
|
+
},
|
|
1697
|
+
{
|
|
1698
|
+
character: "\r",
|
|
1699
|
+
placeholder: "",
|
|
1700
|
+
escape: "\\r"
|
|
1701
|
+
},
|
|
1702
|
+
{
|
|
1703
|
+
character: " ",
|
|
1704
|
+
placeholder: "",
|
|
1705
|
+
escape: "\\t"
|
|
1706
|
+
}
|
|
1707
|
+
];
|
|
1388
1708
|
var snippetGenerator = (0, _scalar_snippetz.snippetz)();
|
|
1709
|
+
function protectSnippetControlCharacters(value) {
|
|
1710
|
+
if (typeof value === "string") return snippetControlCharacters.reduce((result, item) => result.replaceAll(item.character, item.placeholder), value);
|
|
1711
|
+
if (Array.isArray(value)) return value.map(protectSnippetControlCharacters);
|
|
1712
|
+
if (!isRecord$1(value)) return value;
|
|
1713
|
+
return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, protectSnippetControlCharacters(item)]));
|
|
1714
|
+
}
|
|
1715
|
+
function restoreSnippetControlCharacters(code) {
|
|
1716
|
+
return snippetControlCharacters.reduce((result, item) => result.replaceAll(item.placeholder, item.escape), code);
|
|
1717
|
+
}
|
|
1389
1718
|
function getDefaultServer(spec) {
|
|
1390
1719
|
const servers = spec.servers;
|
|
1391
1720
|
if (!Array.isArray(servers)) return { url: "https://api.example.com" };
|
|
@@ -1453,7 +1782,7 @@ function getRequestBody(requestContent) {
|
|
|
1453
1782
|
const params = getFormParams(value, requestContent);
|
|
1454
1783
|
return params.length > 0 ? { params } : void 0;
|
|
1455
1784
|
}
|
|
1456
|
-
return { serialized: stringifyExample(value) };
|
|
1785
|
+
return { serialized: stringifyExample(protectSnippetControlCharacters(value)) };
|
|
1457
1786
|
}
|
|
1458
1787
|
function getAuthorizationValue(auth) {
|
|
1459
1788
|
if (auth.scheme.type === "http" && auth.scheme.scheme?.toLowerCase() === "bearer") return `Bearer ${auth.value}`;
|
|
@@ -1506,7 +1835,7 @@ function buildSnippetErrorMessage(error) {
|
|
|
1506
1835
|
}
|
|
1507
1836
|
function buildSnippet(input, target) {
|
|
1508
1837
|
try {
|
|
1509
|
-
return decodeUrlPlaceholders(snippetGenerator.print(target.target, target.client, buildHarRequest(input)) || "");
|
|
1838
|
+
return restoreSnippetControlCharacters(decodeUrlPlaceholders(snippetGenerator.print(target.target, target.client, buildHarRequest(input)) || ""));
|
|
1510
1839
|
} catch (error) {
|
|
1511
1840
|
return buildSnippetErrorMessage(error);
|
|
1512
1841
|
}
|
|
@@ -1805,7 +2134,7 @@ function SelectControl(arg0) {
|
|
|
1805
2134
|
label: option
|
|
1806
2135
|
} : option);
|
|
1807
2136
|
const selectedOption = normalizedOptions.find((option) => option.value === value) ?? normalizedOptions[0];
|
|
1808
|
-
const wrapperClassName = compact ? "clarify-
|
|
2137
|
+
const wrapperClassName = compact ? "clarify-openai-select relative min-w-0 text-xs" : "clarify-openai-select relative shrink-0 text-xs";
|
|
1809
2138
|
const buttonSizeClassName = compact ? "w-full min-w-0 max-w-32" : "min-w-28 max-w-48";
|
|
1810
2139
|
if (normalizedOptions.length <= 1) return null;
|
|
1811
2140
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Listbox, {
|
|
@@ -1815,7 +2144,7 @@ function SelectControl(arg0) {
|
|
|
1815
2144
|
className: wrapperClassName,
|
|
1816
2145
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxButton, {
|
|
1817
2146
|
"aria-label": label,
|
|
1818
|
-
className: `clarify-
|
|
2147
|
+
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)`,
|
|
1819
2148
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
1820
2149
|
className: "flex min-w-0 items-center gap-1.5 overflow-hidden",
|
|
1821
2150
|
children: [icon ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
@@ -1831,10 +2160,10 @@ function SelectControl(arg0) {
|
|
|
1831
2160
|
})]
|
|
1832
2161
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.ListboxOptions, {
|
|
1833
2162
|
anchor: "bottom end",
|
|
1834
|
-
className: "clarify-
|
|
2163
|
+
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",
|
|
1835
2164
|
children: normalizedOptions.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxOption, {
|
|
1836
2165
|
value: option.value,
|
|
1837
|
-
className: "clarify-
|
|
2166
|
+
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)",
|
|
1838
2167
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { children: option.label }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
|
|
1839
2168
|
className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
|
|
1840
2169
|
"aria-hidden": "true"
|
|
@@ -1859,7 +2188,7 @@ function CopyCodeButton(arg0) {
|
|
|
1859
2188
|
setTimeout(() => setCopied(false), 1e3);
|
|
1860
2189
|
});
|
|
1861
2190
|
},
|
|
1862
|
-
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)",
|
|
2191
|
+
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)",
|
|
1863
2192
|
children: [copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
|
|
1864
2193
|
className: "h-3.5 w-3.5 text-(--clarify-theme-tokens-colors-primary)",
|
|
1865
2194
|
"aria-hidden": "true"
|
|
@@ -1883,31 +2212,36 @@ function ExampleMetaValue(arg0) {
|
|
|
1883
2212
|
});
|
|
1884
2213
|
}
|
|
1885
2214
|
function CodeToolbar(arg0) {
|
|
1886
|
-
const { code, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
|
|
2215
|
+
const { code, leadingControls, languageOptions, selectedLanguageKey, onSelectLanguage, clientOptions, selectedClientKey, onSelectClient } = arg0;
|
|
1887
2216
|
const t = require_i18n.useBuiltInText();
|
|
2217
|
+
const inlineControls = Boolean(leadingControls);
|
|
1888
2218
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1889
|
-
className:
|
|
2219
|
+
className: `clarify-openai-code-toolbar flex items-center gap-2 px-4 pt-3${inlineControls ? " clarify-openai-code-toolbar-inline" : ""}`,
|
|
1890
2220
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1891
|
-
className:
|
|
1892
|
-
children: [
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
2221
|
+
className: `clarify-openai-code-toolbar-controls flex min-w-0 flex-1 items-center gap-2${inlineControls ? " flex-nowrap overflow-x-auto" : " flex-wrap"}`,
|
|
2222
|
+
children: [
|
|
2223
|
+
leadingControls,
|
|
2224
|
+
languageOptions && languageOptions.length > 1 && selectedLanguageKey && onSelectLanguage ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectControl, {
|
|
2225
|
+
label: t("openapi.language"),
|
|
2226
|
+
value: selectedLanguageKey,
|
|
2227
|
+
options: languageOptions,
|
|
2228
|
+
onChange: onSelectLanguage,
|
|
2229
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CodeIcon, {
|
|
2230
|
+
className: "h-3.5 w-3.5",
|
|
2231
|
+
"aria-hidden": "true"
|
|
2232
|
+
})
|
|
2233
|
+
}) : null,
|
|
2234
|
+
clientOptions && clientOptions.length > 1 && selectedClientKey && onSelectClient ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectControl, {
|
|
2235
|
+
label: t("openapi.client"),
|
|
2236
|
+
value: selectedClientKey,
|
|
2237
|
+
options: clientOptions,
|
|
2238
|
+
onChange: onSelectClient,
|
|
2239
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.PackageIcon, {
|
|
2240
|
+
className: "h-3.5 w-3.5",
|
|
2241
|
+
"aria-hidden": "true"
|
|
2242
|
+
})
|
|
2243
|
+
}) : null
|
|
2244
|
+
]
|
|
1911
2245
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CopyCodeButton, { code })]
|
|
1912
2246
|
});
|
|
1913
2247
|
}
|
|
@@ -1979,21 +2313,38 @@ function getClientOptions(codeOptions, languageKey) {
|
|
|
1979
2313
|
//#endregion
|
|
1980
2314
|
//#region source/openapi/components/ExamplePanels.tsx
|
|
1981
2315
|
function ApiExampleCodeGroup(arg0) {
|
|
1982
|
-
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;
|
|
2316
|
+
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;
|
|
1983
2317
|
const t = require_i18n.useBuiltInText();
|
|
1984
2318
|
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";
|
|
2319
|
+
const meta = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [
|
|
2320
|
+
tag ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExampleMetaValue, {
|
|
2321
|
+
label: t("openapi.status"),
|
|
2322
|
+
value: tag,
|
|
2323
|
+
options: tagOptions,
|
|
2324
|
+
onChange: onSelectTag,
|
|
2325
|
+
className: "clarify-openai-example-status font-semibold text-emerald-400"
|
|
2326
|
+
}) : null,
|
|
2327
|
+
tag && label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-0.5 w-0.5 shrink-0 rounded-full bg-(--clarify-code-faint)" }) : null,
|
|
2328
|
+
label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExampleMetaValue, {
|
|
2329
|
+
label: t("openapi.mediaType"),
|
|
2330
|
+
value: label,
|
|
2331
|
+
options: labelOptions,
|
|
2332
|
+
onChange: onSelectLabel,
|
|
2333
|
+
className: "min-w-0 truncate text-xs text-(--clarify-code-muted)"
|
|
2334
|
+
}) : null
|
|
2335
|
+
] });
|
|
1985
2336
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1986
|
-
className: "clarify-
|
|
2337
|
+
className: "clarify-openai-example my-6 overflow-hidden rounded-2xl bg-(--clarify-code-background) shadow-md ring-1 ring-(--clarify-code-border)",
|
|
1987
2338
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1988
2339
|
className: "not-prose",
|
|
1989
2340
|
children: [
|
|
1990
2341
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1991
|
-
className: "clarify-
|
|
2342
|
+
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",
|
|
1992
2343
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("h3", {
|
|
1993
2344
|
className: "mr-auto min-w-16 truncate py-1 text-xs font-semibold text-(--clarify-code-text)",
|
|
1994
2345
|
children: title
|
|
1995
2346
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1996
|
-
className: "ml-auto flex min-w-0 items-center gap-2 whitespace-nowrap",
|
|
2347
|
+
className: "clarify-openai-example-header-controls ml-auto flex min-w-0 items-center gap-2 whitespace-nowrap",
|
|
1997
2348
|
children: [mediaTypes && mediaTypes.length > 1 && selectedMediaType && onSelectMediaType ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(SelectControl, {
|
|
1998
2349
|
label: t("openapi.mediaType"),
|
|
1999
2350
|
value: selectedMediaType,
|
|
@@ -2012,30 +2363,15 @@ function ApiExampleCodeGroup(arg0) {
|
|
|
2012
2363
|
}) : null]
|
|
2013
2364
|
})]
|
|
2014
2365
|
}),
|
|
2015
|
-
tag || label ? /* @__PURE__ */ (0, react_jsx_runtime.
|
|
2366
|
+
(tag || label) && !metaInToolbar ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2016
2367
|
className: metaClassName,
|
|
2017
|
-
children:
|
|
2018
|
-
tag ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExampleMetaValue, {
|
|
2019
|
-
label: t("openapi.status"),
|
|
2020
|
-
value: tag,
|
|
2021
|
-
options: tagOptions,
|
|
2022
|
-
onChange: onSelectTag,
|
|
2023
|
-
className: "clarify-api-example-status font-semibold text-emerald-400"
|
|
2024
|
-
}) : null,
|
|
2025
|
-
tag && label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", { className: "h-0.5 w-0.5 shrink-0 rounded-full bg-(--clarify-code-faint)" }) : null,
|
|
2026
|
-
label ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ExampleMetaValue, {
|
|
2027
|
-
label: t("openapi.mediaType"),
|
|
2028
|
-
value: label,
|
|
2029
|
-
options: labelOptions,
|
|
2030
|
-
onChange: onSelectLabel,
|
|
2031
|
-
className: "min-w-0 truncate text-xs text-(--clarify-code-muted)"
|
|
2032
|
-
}) : null
|
|
2033
|
-
]
|
|
2368
|
+
children: meta
|
|
2034
2369
|
}) : null,
|
|
2035
2370
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2036
|
-
className: "clarify-
|
|
2371
|
+
className: "clarify-openai-example-code group bg-(--clarify-code-background)",
|
|
2037
2372
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(CodeToolbar, {
|
|
2038
2373
|
code,
|
|
2374
|
+
leadingControls: metaInToolbar ? meta : void 0,
|
|
2039
2375
|
languageOptions,
|
|
2040
2376
|
selectedLanguageKey,
|
|
2041
2377
|
onSelectLanguage,
|
|
@@ -2043,10 +2379,10 @@ function ApiExampleCodeGroup(arg0) {
|
|
|
2043
2379
|
selectedClientKey,
|
|
2044
2380
|
onSelectClient
|
|
2045
2381
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("pre", {
|
|
2046
|
-
className:
|
|
2047
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
2048
|
-
|
|
2049
|
-
|
|
2382
|
+
className: "max-h-128 overflow-auto overscroll-contain px-4 pt-3 pb-4 text-xs text-(--clarify-code-text)",
|
|
2383
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(HighlightedCode, {
|
|
2384
|
+
code,
|
|
2385
|
+
language
|
|
2050
2386
|
})
|
|
2051
2387
|
})]
|
|
2052
2388
|
})
|
|
@@ -2150,6 +2486,9 @@ function RequestExamplesPanel(arg0) {
|
|
|
2150
2486
|
function firstExampleKeyForResponseContent(content, spec) {
|
|
2151
2487
|
return getExampleEntries(content?.value, spec)[0]?.key ?? "";
|
|
2152
2488
|
}
|
|
2489
|
+
function getResponseExampleBody(content, example) {
|
|
2490
|
+
return content ? stringifyExample(example?.value) : "";
|
|
2491
|
+
}
|
|
2153
2492
|
function useResponseExamplesState(arg0) {
|
|
2154
2493
|
const { operation, spec, sharedExampleKey, onSelectExampleKey, selectedStatus, onSelectStatus } = arg0;
|
|
2155
2494
|
const orderedResponses = [...getResponseEntries(operation, spec)].sort((left, right) => {
|
|
@@ -2160,8 +2499,7 @@ function useResponseExamplesState(arg0) {
|
|
|
2160
2499
|
if (!Number.isNaN(leftCode) && !Number.isNaN(rightCode)) return leftCode - rightCode;
|
|
2161
2500
|
return left.status.localeCompare(right.status);
|
|
2162
2501
|
});
|
|
2163
|
-
const
|
|
2164
|
-
const [internalSelectedStatus, setInternalSelectedStatus] = (0, react.useState)(defaultStatus);
|
|
2502
|
+
const [internalSelectedStatus, setInternalSelectedStatus] = (0, react.useState)(orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "");
|
|
2165
2503
|
const activeStatus = selectedStatus ?? internalSelectedStatus;
|
|
2166
2504
|
const selectedResponse = orderedResponses.find(({ status }) => status === activeStatus) ?? orderedResponses[0];
|
|
2167
2505
|
const responseContents = getMediaTypeEntries(selectedResponse?.response.content, spec);
|
|
@@ -2187,7 +2525,7 @@ function useResponseExamplesState(arg0) {
|
|
|
2187
2525
|
selectedContent,
|
|
2188
2526
|
examples,
|
|
2189
2527
|
selectedExample,
|
|
2190
|
-
|
|
2528
|
+
responseBody: getResponseExampleBody(selectedContent, selectedExample),
|
|
2191
2529
|
onSelectStatus: (value) => {
|
|
2192
2530
|
const nextContents = getMediaTypeEntries(orderedResponses.find(({ status }) => status === value)?.response.content, spec);
|
|
2193
2531
|
if (typeof selectedStatus === "undefined") setInternalSelectedStatus(value);
|
|
@@ -2226,21 +2564,21 @@ function ResponseExamplesPanel(arg0) {
|
|
|
2226
2564
|
selectedStatus,
|
|
2227
2565
|
onSelectStatus
|
|
2228
2566
|
});
|
|
2229
|
-
if (!state.
|
|
2567
|
+
if (!state.selectedContent || !state.responseBody) return null;
|
|
2230
2568
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ApiExampleCodeGroup, {
|
|
2231
2569
|
title: title ?? t("openapi.response"),
|
|
2232
|
-
tag: state.selectedResponse
|
|
2233
|
-
tagOptions: state.responses.map((
|
|
2234
|
-
onSelectTag: state.onSelectStatus,
|
|
2570
|
+
tag: state.selectedResponse?.status,
|
|
2571
|
+
tagOptions: state.responses.map((response) => response.status),
|
|
2572
|
+
onSelectTag: state.responses.length > 0 ? state.onSelectStatus : void 0,
|
|
2235
2573
|
label: state.selectedContent?.mediaType,
|
|
2236
2574
|
labelOptions: state.responseContents.map((content) => content.mediaType),
|
|
2237
2575
|
onSelectLabel: state.responseContents.length > 0 ? state.onSelectMediaType : void 0,
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
language: state.selectedContent ? codeLanguageForMediaType(state.selectedContent.mediaType) : "http",
|
|
2576
|
+
code: state.responseBody,
|
|
2577
|
+
language: codeLanguageForMediaType(state.selectedContent.mediaType),
|
|
2241
2578
|
examples: state.examples,
|
|
2242
2579
|
selectedExampleKey: state.selectedExample?.key,
|
|
2243
|
-
onSelectExample: state.onSelectExample
|
|
2580
|
+
onSelectExample: state.onSelectExample,
|
|
2581
|
+
metaInToolbar: true
|
|
2244
2582
|
});
|
|
2245
2583
|
}
|
|
2246
2584
|
//#endregion
|
|
@@ -2496,7 +2834,7 @@ function SchemaNode(arg0) {
|
|
|
2496
2834
|
className: "*:first:mt-0 *:last:mb-0",
|
|
2497
2835
|
children: node.description
|
|
2498
2836
|
}) : fallbackDescription, node.details ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
|
|
2499
|
-
className: "text-xs text-(--clarify-ui-text-
|
|
2837
|
+
className: "text-xs text-(--clarify-ui-text-soft)",
|
|
2500
2838
|
children: node.details
|
|
2501
2839
|
}) : null]
|
|
2502
2840
|
})]
|
|
@@ -2512,7 +2850,7 @@ function SchemaNode(arg0) {
|
|
|
2512
2850
|
"aria-label": expanded ? t("openapi.collapse") : t("openapi.expand"),
|
|
2513
2851
|
"aria-expanded": expanded,
|
|
2514
2852
|
onClick: () => setExpanded((value) => !value),
|
|
2515
|
-
className: (0, clsx.default)(rowClassName, "cursor-pointer transition"),
|
|
2853
|
+
className: (0, clsx.default)(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)"),
|
|
2516
2854
|
children: content
|
|
2517
2855
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
2518
2856
|
className: rowClassName,
|
|
@@ -2580,10 +2918,10 @@ function ResponseList(arg0) {
|
|
|
2580
2918
|
children: [
|
|
2581
2919
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2582
2920
|
className: "flex flex-wrap items-center gap-2",
|
|
2583
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2921
|
+
children: [orderedResponses.length === 1 ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2584
2922
|
className: "text-sm/5 font-semibold text-(--clarify-theme-tokens-colors-foreground)",
|
|
2585
2923
|
children: status
|
|
2586
|
-
}), type ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2924
|
+
}) : null, type ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2587
2925
|
className: "text-xs text-(--clarify-theme-tokens-colors-muted)",
|
|
2588
2926
|
children: type
|
|
2589
2927
|
}) : null]
|
|
@@ -2729,6 +3067,50 @@ function EndpointResponse(arg0) {
|
|
|
2729
3067
|
});
|
|
2730
3068
|
}
|
|
2731
3069
|
//#endregion
|
|
3070
|
+
//#region source/openapi/components/InlineListbox.tsx
|
|
3071
|
+
function InlineListbox(arg0) {
|
|
3072
|
+
const { label, value, options, onChange, compact = false, buttonContent, buttonClassName, className } = arg0;
|
|
3073
|
+
const selected = options.find((option) => option.value === value) ?? options[0];
|
|
3074
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Listbox, {
|
|
3075
|
+
value: selected?.value ?? value,
|
|
3076
|
+
onChange,
|
|
3077
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3078
|
+
className: (0, clsx.default)("pointer-events-auto relative inline-flex min-w-0", className),
|
|
3079
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.ListboxButton, {
|
|
3080
|
+
"aria-label": label,
|
|
3081
|
+
className: (0, clsx.default)(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"),
|
|
3082
|
+
children: buttonContent ?? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3083
|
+
className: "truncate",
|
|
3084
|
+
children: selected?.label ?? value
|
|
3085
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDownIcon, {
|
|
3086
|
+
className: "h-3.5 w-3.5 shrink-0 text-(--clarify-ui-text-faint)",
|
|
3087
|
+
"aria-hidden": "true"
|
|
3088
|
+
})] })
|
|
3089
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.ListboxOptions, {
|
|
3090
|
+
anchor: "bottom start",
|
|
3091
|
+
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",
|
|
3092
|
+
children: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxOption, {
|
|
3093
|
+
value: option.value,
|
|
3094
|
+
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)",
|
|
3095
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3096
|
+
className: "min-w-0",
|
|
3097
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3098
|
+
className: "block truncate",
|
|
3099
|
+
children: option.label
|
|
3100
|
+
}), option.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3101
|
+
className: "mt-0.5 block truncate text-2xs text-(--clarify-ui-text-faint)",
|
|
3102
|
+
children: option.description
|
|
3103
|
+
}) : null]
|
|
3104
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
|
|
3105
|
+
className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
|
|
3106
|
+
"aria-hidden": "true"
|
|
3107
|
+
})]
|
|
3108
|
+
}, option.value))
|
|
3109
|
+
})]
|
|
3110
|
+
})
|
|
3111
|
+
});
|
|
3112
|
+
}
|
|
3113
|
+
//#endregion
|
|
2732
3114
|
//#region source/openapi/components/OpenApiOperation.state.ts
|
|
2733
3115
|
function useOperationRequestState(spec, path, operation, source = "path") {
|
|
2734
3116
|
const parameters = getOperationParameters(spec, path, operation, source);
|
|
@@ -2836,7 +3218,7 @@ function EndpointPath(arg0) {
|
|
|
2836
3218
|
"aria-label": copied ? t("actions.copied") : t("actions.copy"),
|
|
2837
3219
|
title: copied ? t("actions.copied") : t("actions.copy"),
|
|
2838
3220
|
onClick: onCopy,
|
|
2839
|
-
className: (0, clsx.default)("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"),
|
|
3221
|
+
className: (0, clsx.default)("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"),
|
|
2840
3222
|
children: copied ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
|
|
2841
3223
|
className: "h-3.5 w-3.5",
|
|
2842
3224
|
"aria-hidden": "true"
|
|
@@ -2847,48 +3229,6 @@ function EndpointPath(arg0) {
|
|
|
2847
3229
|
}) : null]
|
|
2848
3230
|
});
|
|
2849
3231
|
}
|
|
2850
|
-
function InlineListbox(arg0) {
|
|
2851
|
-
const { label, value, options, onChange, compact = false } = arg0;
|
|
2852
|
-
const selected = options.find((option) => option.value === value) ?? options[0];
|
|
2853
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.Listbox, {
|
|
2854
|
-
value: selected?.value ?? value,
|
|
2855
|
-
onChange,
|
|
2856
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
2857
|
-
className: "pointer-events-auto relative inline-flex min-w-0",
|
|
2858
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxButton, {
|
|
2859
|
-
"aria-label": label,
|
|
2860
|
-
className: (0, clsx.default)("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"),
|
|
2861
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2862
|
-
className: "truncate",
|
|
2863
|
-
children: selected?.label ?? value
|
|
2864
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDownIcon, {
|
|
2865
|
-
className: "h-3.5 w-3.5 shrink-0 text-(--clarify-ui-text-faint)",
|
|
2866
|
-
"aria-hidden": "true"
|
|
2867
|
-
})]
|
|
2868
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_headlessui_react.ListboxOptions, {
|
|
2869
|
-
anchor: "bottom start",
|
|
2870
|
-
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",
|
|
2871
|
-
children: options.map((option) => /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_headlessui_react.ListboxOption, {
|
|
2872
|
-
value: option.value,
|
|
2873
|
-
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)",
|
|
2874
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2875
|
-
className: "min-w-0",
|
|
2876
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2877
|
-
className: "block truncate",
|
|
2878
|
-
children: option.label
|
|
2879
|
-
}), option.description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2880
|
-
className: "mt-0.5 block truncate text-2xs text-(--clarify-ui-text-faint)",
|
|
2881
|
-
children: option.description
|
|
2882
|
-
}) : null]
|
|
2883
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.CheckIcon, {
|
|
2884
|
-
className: "h-3.5 w-3.5 shrink-0 opacity-0 group-data-selected:opacity-100",
|
|
2885
|
-
"aria-hidden": "true"
|
|
2886
|
-
})]
|
|
2887
|
-
}, option.value))
|
|
2888
|
-
})]
|
|
2889
|
-
})
|
|
2890
|
-
});
|
|
2891
|
-
}
|
|
2892
3232
|
function getServerPreviewUrl(server, variables) {
|
|
2893
3233
|
return (server.url ?? "").replace(/\{([^}]+)\}/g, (_, name) => variables[name] ?? server.variables?.[name]?.default ?? `{${name}}`);
|
|
2894
3234
|
}
|
|
@@ -2912,12 +3252,12 @@ function getDefaultResponseStatus(operation, spec) {
|
|
|
2912
3252
|
return orderedResponses.find(({ status }) => status === "default")?.status ?? orderedResponses.find(({ status }) => status.startsWith("2"))?.status ?? orderedResponses[0]?.status ?? "";
|
|
2913
3253
|
}
|
|
2914
3254
|
function ServerUrlValue(arg0) {
|
|
2915
|
-
const { server, variables, open, interactive, onToggle } = arg0;
|
|
3255
|
+
const { servers, selectedKey, server, variables, open, interactive, directSelect, onSelect, onToggle } = arg0;
|
|
2916
3256
|
const url = getServerPreviewUrl(server, variables);
|
|
2917
3257
|
const protocolLabel = getServerProtocolLabel(server, variables);
|
|
2918
3258
|
if (!interactive) return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
2919
3259
|
"aria-label": "Server",
|
|
2920
|
-
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text
|
|
3260
|
+
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",
|
|
2921
3261
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2922
3262
|
className: "sm:hidden",
|
|
2923
3263
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ServerIcon, {
|
|
@@ -2935,12 +3275,47 @@ function ServerUrlValue(arg0) {
|
|
|
2935
3275
|
})]
|
|
2936
3276
|
})]
|
|
2937
3277
|
});
|
|
3278
|
+
if (directSelect) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(InlineListbox, {
|
|
3279
|
+
label: "Server",
|
|
3280
|
+
value: selectedKey,
|
|
3281
|
+
options: servers.map((option, index) => ({
|
|
3282
|
+
value: getServerKey(option, index),
|
|
3283
|
+
label: getServerLabel(option, index),
|
|
3284
|
+
description: option.description
|
|
3285
|
+
})),
|
|
3286
|
+
onChange: onSelect,
|
|
3287
|
+
className: "w-8 shrink-0 sm:w-fit sm:min-w-16 sm:max-w-(--clarify-server-url-max-width)",
|
|
3288
|
+
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",
|
|
3289
|
+
buttonContent: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3290
|
+
className: "sm:hidden",
|
|
3291
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ServerIcon, {
|
|
3292
|
+
className: "h-4 w-4",
|
|
3293
|
+
"aria-hidden": "true"
|
|
3294
|
+
})
|
|
3295
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
3296
|
+
className: "hidden min-w-0 items-center gap-1 overflow-hidden sm:flex",
|
|
3297
|
+
children: [
|
|
3298
|
+
protocolLabel ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3299
|
+
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",
|
|
3300
|
+
children: protocolLabel
|
|
3301
|
+
}) : null,
|
|
3302
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
3303
|
+
className: "truncate font-semibold text-xs",
|
|
3304
|
+
children: url
|
|
3305
|
+
}),
|
|
3306
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDownIcon, {
|
|
3307
|
+
className: "h-3.5 w-3.5 shrink-0 text-zinc-400 transition-transform group-data-open:rotate-180",
|
|
3308
|
+
"aria-hidden": "true"
|
|
3309
|
+
})
|
|
3310
|
+
]
|
|
3311
|
+
})] })
|
|
3312
|
+
});
|
|
2938
3313
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
2939
3314
|
type: "button",
|
|
2940
3315
|
"aria-expanded": open,
|
|
2941
3316
|
"aria-label": "Server",
|
|
2942
3317
|
onClick: onToggle,
|
|
2943
|
-
className: (0, clsx.default)("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-(--clarify-ui-subtle-background) text-(--clarify-ui-text
|
|
3318
|
+
className: (0, clsx.default)("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),
|
|
2944
3319
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
2945
3320
|
className: "sm:hidden",
|
|
2946
3321
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ServerIcon, {
|
|
@@ -2959,7 +3334,7 @@ function ServerUrlValue(arg0) {
|
|
|
2959
3334
|
children: url
|
|
2960
3335
|
}),
|
|
2961
3336
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.ChevronDownIcon, {
|
|
2962
|
-
className: "h-3.5 w-3.5 shrink-0 text-zinc-400",
|
|
3337
|
+
className: (0, clsx.default)("h-3.5 w-3.5 shrink-0 text-zinc-400 transition-transform", open && "rotate-180"),
|
|
2963
3338
|
"aria-hidden": "true"
|
|
2964
3339
|
})
|
|
2965
3340
|
]
|
|
@@ -3059,7 +3434,8 @@ function AuthPanel(arg0) {
|
|
|
3059
3434
|
className: "mr-2 shrink-0 text-2xs font-semibold text-(--clarify-ui-text-soft)",
|
|
3060
3435
|
children: selectedAuth.scheme.type === "apiKey" ? selectedAuth.scheme.in ?? "apiKey" : selectedAuth.scheme.scheme ?? selectedAuth.scheme.type ?? "token"
|
|
3061
3436
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("input", {
|
|
3062
|
-
value: authValues[selectedAuth.name] ??
|
|
3437
|
+
value: authValues[selectedAuth.name] ?? "",
|
|
3438
|
+
placeholder: authPlaceholder(selectedAuth),
|
|
3063
3439
|
onChange: (event) => onChangeAuthValue(selectedAuth.name, event.target.value),
|
|
3064
3440
|
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)"
|
|
3065
3441
|
})]
|
|
@@ -3070,6 +3446,7 @@ function AuthPanel(arg0) {
|
|
|
3070
3446
|
}
|
|
3071
3447
|
function EndpointIdentity(arg0) {
|
|
3072
3448
|
const { method, operationSource, path, servers, selectedServerKey, selectedServer, serverVariables, serverOpen, authOptions, selectedAuthName, selectedAuth, authValues, authOpen, onSelectServer, onChangeServerVariable, onToggleServer, onToggleAuth, onSelectAuth, onChangeAuthValue } = arg0;
|
|
3449
|
+
const directServerSelect = servers.length > 1 && servers.every((server) => Object.keys(server.variables ?? {}).length === 0);
|
|
3073
3450
|
const serverInteractive = servers.length > 1 || Object.keys(selectedServer.variables ?? {}).length > 0;
|
|
3074
3451
|
const [copiedUrl, setCopiedUrl] = (0, react.useState)(false);
|
|
3075
3452
|
const fullUrl = getFullEndpointUrl(selectedServer, serverVariables, path);
|
|
@@ -3082,7 +3459,7 @@ function EndpointIdentity(arg0) {
|
|
|
3082
3459
|
if (await require_PageActions.copyTextToClipboard(fullUrl)) setCopiedUrl(true);
|
|
3083
3460
|
}
|
|
3084
3461
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3085
|
-
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",
|
|
3462
|
+
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",
|
|
3086
3463
|
children: [
|
|
3087
3464
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
3088
3465
|
className: "flex min-w-0 items-center gap-1.5 overflow-hidden px-2.5 py-2",
|
|
@@ -3090,10 +3467,14 @@ function EndpointIdentity(arg0) {
|
|
|
3090
3467
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointMethodBadge, { method }),
|
|
3091
3468
|
operationSource === "webhook" ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointMethodBadge, { method: "WEBHOOK" }) : null,
|
|
3092
3469
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServerUrlValue, {
|
|
3470
|
+
servers,
|
|
3471
|
+
selectedKey: selectedServerKey,
|
|
3093
3472
|
server: selectedServer,
|
|
3094
3473
|
variables: serverVariables,
|
|
3095
3474
|
open: serverOpen,
|
|
3096
3475
|
interactive: serverInteractive,
|
|
3476
|
+
directSelect: directServerSelect,
|
|
3477
|
+
onSelect: onSelectServer,
|
|
3097
3478
|
onToggle: onToggleServer
|
|
3098
3479
|
}),
|
|
3099
3480
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(EndpointPath, {
|
|
@@ -3106,7 +3487,7 @@ function EndpointIdentity(arg0) {
|
|
|
3106
3487
|
"aria-expanded": authOpen,
|
|
3107
3488
|
"aria-label": "Auth",
|
|
3108
3489
|
onClick: onToggleAuth,
|
|
3109
|
-
className: (0, clsx.default)("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)"),
|
|
3490
|
+
className: (0, clsx.default)("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)"),
|
|
3110
3491
|
children: authOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.UnlockKeyholeIcon, {
|
|
3111
3492
|
className: "h-4 w-4",
|
|
3112
3493
|
"aria-hidden": "true"
|
|
@@ -3117,7 +3498,7 @@ function EndpointIdentity(arg0) {
|
|
|
3117
3498
|
}) : null
|
|
3118
3499
|
]
|
|
3119
3500
|
}),
|
|
3120
|
-
serverInteractive && serverOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServerPanel, {
|
|
3501
|
+
serverInteractive && !directServerSelect && serverOpen ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ServerPanel, {
|
|
3121
3502
|
servers,
|
|
3122
3503
|
selectedKey: selectedServerKey,
|
|
3123
3504
|
selectedServer,
|
|
@@ -3147,7 +3528,7 @@ function OpenApiOperation(arg0) {
|
|
|
3147
3528
|
const [linkedExampleKey, setLinkedExampleKey] = (0, react.useState)("");
|
|
3148
3529
|
const [selectedResponseStatus, setSelectedResponseStatus] = (0, react.useState)(() => getDefaultResponseStatus(operation, spec));
|
|
3149
3530
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("section", {
|
|
3150
|
-
className: "clarify-
|
|
3531
|
+
className: "clarify-openai-endpoint scroll-mt-24 pb-16 first:pt-0 last:pb-0",
|
|
3151
3532
|
"aria-labelledby": id,
|
|
3152
3533
|
children: [
|
|
3153
3534
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(Heading, {
|
|
@@ -3333,6 +3714,30 @@ Object.defineProperty(exports, "ResponseExamplesPanel", {
|
|
|
3333
3714
|
return ResponseExamplesPanel;
|
|
3334
3715
|
}
|
|
3335
3716
|
});
|
|
3717
|
+
Object.defineProperty(exports, "Step", {
|
|
3718
|
+
enumerable: true,
|
|
3719
|
+
get: function() {
|
|
3720
|
+
return Step;
|
|
3721
|
+
}
|
|
3722
|
+
});
|
|
3723
|
+
Object.defineProperty(exports, "Steps", {
|
|
3724
|
+
enumerable: true,
|
|
3725
|
+
get: function() {
|
|
3726
|
+
return Steps;
|
|
3727
|
+
}
|
|
3728
|
+
});
|
|
3729
|
+
Object.defineProperty(exports, "TabItem", {
|
|
3730
|
+
enumerable: true,
|
|
3731
|
+
get: function() {
|
|
3732
|
+
return TabItem;
|
|
3733
|
+
}
|
|
3734
|
+
});
|
|
3735
|
+
Object.defineProperty(exports, "Tabs", {
|
|
3736
|
+
enumerable: true,
|
|
3737
|
+
get: function() {
|
|
3738
|
+
return Tabs;
|
|
3739
|
+
}
|
|
3740
|
+
});
|
|
3336
3741
|
Object.defineProperty(exports, "Tag", {
|
|
3337
3742
|
enumerable: true,
|
|
3338
3743
|
get: function() {
|
|
@@ -3406,4 +3811,4 @@ Object.defineProperty(exports, "primitives_exports", {
|
|
|
3406
3811
|
}
|
|
3407
3812
|
});
|
|
3408
3813
|
|
|
3409
|
-
//# sourceMappingURL=OpenApiOperation-
|
|
3814
|
+
//# sourceMappingURL=OpenApiOperation-DbZjxIuj.cjs.map
|